diff --git a/.firebase/hosting.YnVpbGQ.cache b/.firebase/hosting.YnVpbGQ.cache deleted file mode 100644 index 015ba83..0000000 --- a/.firebase/hosting.YnVpbGQ.cache +++ /dev/null @@ -1,9 +0,0 @@ -images/favicon64.ico,1662680797038,89e19b8359c52def4495280484ae2828952cbf6a4731377651cc248c1069c4a4 -images/polyzero-logo.png,1662680797039,08ab76011e8a51fb69e70a81512a05e6e9f3d6707d8b44ec5ff8be0d8875f83f -asset-manifest.json,1662692166166,10c11a697e22e9547f0e7c9d93d47a2dbafcd0d278329d7b2c5b15fe34804328 -index.html,1662692166166,e864bec4f913f5f296e81aed9a9891d1b2f8367e4ef0539669eeb64ff05253ec -static/js/main.d7a297d9.js.LICENSE.txt,1662692166166,e0d5e4474bb55128a4cc7d929d6be03b44c775898963e6820ffd8a667e91a0d6 -static/css/main.d9c6f8a3.css.map,1662692166166,2cbc966b5d79a13735c7ccc49f2f68da811f42810fb1aa8bf603755ef7a76ad4 -static/css/main.d9c6f8a3.css,1662692166166,5ecd0e53ff9cc665fbf57a80c6faa1114e84cb7b77535c492bf8a05b72b3214f -static/js/main.d7a297d9.js,1662692166166,922e1dce9b6b9d712d627a5d5bc9060f32a870c98cbd2098f68b29aa680becc8 -static/js/main.d7a297d9.js.map,1662692166166,636b4f91b543a8e441d5dd8447363daec212c025afbda17a024cc0fdfdce1319 diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml deleted file mode 100644 index 92b28bb..0000000 --- a/.github/workflows/firebase-hosting-merge.yml +++ /dev/null @@ -1,20 +0,0 @@ -# This file was auto-generated by the Firebase CLI -# https://github.com/firebase/firebase-tools - -name: Deploy to Firebase Hosting on merge -'on': - push: - branches: - - production -jobs: - build_and_deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - run: npm ci && npm run build - - uses: FirebaseExtended/action-hosting-deploy@v0 - with: - repoToken: '${{ secrets.GITHUB_TOKEN }}' - firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_POLYZERO_37EFC }}' - channelId: live - projectId: polyzero-37efc diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml deleted file mode 100644 index 216541b..0000000 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by the Firebase CLI -# https://github.com/firebase/firebase-tools - -name: Deploy to Firebase Hosting on PR -'on': pull_request -jobs: - build_and_preview: - if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - run: npm ci && npm run build - - uses: FirebaseExtended/action-hosting-deploy@v0 - with: - repoToken: '${{ secrets.GITHUB_TOKEN }}' - firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_POLYZERO_37EFC }}' - projectId: polyzero-37efc diff --git a/PolyZero_files/bundle.js b/PolyZero_files/bundle.js deleted file mode 100644 index 9f438ef..0000000 --- a/PolyZero_files/bundle.js +++ /dev/null @@ -1,123095 +0,0 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ "./src/assets/socialMediaIcons/icons8-facebook.svg": -/*!*********************************************************!*\ - !*** ./src/assets/socialMediaIcons/icons8-facebook.svg ***! - \*********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ReactComponent": () => (/* binding */ ForwardRef), -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -var _path, _path2; - -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - - - -function SvgIcons8Facebook(_ref, svgRef) { - let { - title, - titleId, - ...props - } = _ref; - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg", _extends({ - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 48 48", - width: "64px", - height: "96px", - ref: svgRef, - "aria-labelledby": titleId - }, props), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("title", { - id: titleId - }, title) : null, _path || (_path = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#039be5", - d: "M24 5A19 19 0 1 0 24 43A19 19 0 1 0 24 5Z" - })), _path2 || (_path2 = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#fff", - d: "M26.572,29.036h4.917l0.772-4.995h-5.69v-2.73c0-2.075,0.678-3.915,2.619-3.915h3.119v-4.359c-0.548-0.074-1.707-0.236-3.897-0.236c-4.573,0-7.254,2.415-7.254,7.917v3.323h-4.701v4.995h4.701v13.729C22.089,42.905,23.032,43,24,43c0.875,0,1.729-0.08,2.572-0.194V29.036z" - }))); -} - -const ForwardRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(SvgIcons8Facebook); -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__webpack_require__.p + "static/media/icons8-facebook.1c6c45826672f15b032e6c6b8b0848bc.svg"); - - -/***/ }), - -/***/ "./src/assets/socialMediaIcons/icons8-instagram.svg": -/*!**********************************************************!*\ - !*** ./src/assets/socialMediaIcons/icons8-instagram.svg ***! - \**********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ReactComponent": () => (/* binding */ ForwardRef), -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -var _path, _path2, _path3, _path4, _path5, _path6, _path7, _path8, _path9, _path10, _path11, _path12, _path13, _path14, _path15, _path16, _g, _g2; - -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - - - -function SvgIcons8Instagram(_ref, svgRef) { - let { - title, - titleId, - ...props - } = _ref; - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg", _extends({ - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 48 48", - width: "64px", - height: "96px", - ref: svgRef, - "aria-labelledby": titleId - }, props), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("title", { - id: titleId - }, title) : null, _path || (_path = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#304ffe", - d: "M41.67,13.48c-0.4,0.26-0.97,0.5-1.21,0.77c-0.09,0.09-0.14,0.19-0.12,0.29v1.03l-0.3,1.01l-0.3,1l-0.33,1.1 l-0.68,2.25l-0.66,2.22l-0.5,1.67c0,0.26-0.01,0.52-0.03,0.77c-0.07,0.96-0.27,1.88-0.59,2.74c-0.19,0.53-0.42,1.04-0.7,1.52 c-0.1,0.19-0.22,0.38-0.34,0.56c-0.4,0.63-0.88,1.21-1.41,1.72c-0.41,0.41-0.86,0.79-1.35,1.11c0,0,0,0-0.01,0 c-0.08,0.07-0.17,0.13-0.27,0.18c-0.31,0.21-0.64,0.39-0.98,0.55c-0.23,0.12-0.46,0.22-0.7,0.31c-0.05,0.03-0.11,0.05-0.16,0.07 c-0.57,0.27-1.23,0.45-1.89,0.54c-0.04,0.01-0.07,0.01-0.11,0.02c-0.4,0.07-0.79,0.13-1.19,0.16c-0.18,0.02-0.37,0.03-0.55,0.03 l-0.71-0.04l-3.42-0.18c0-0.01-0.01,0-0.01,0l-1.72-0.09c-0.13,0-0.27,0-0.4-0.01c-0.54-0.02-1.06-0.08-1.58-0.19 c-0.01,0-0.01,0-0.01,0c-0.95-0.18-1.86-0.5-2.71-0.93c-0.47-0.24-0.93-0.51-1.36-0.82c-0.18-0.13-0.35-0.27-0.52-0.42 c-0.48-0.4-0.91-0.83-1.31-1.27c-0.06-0.06-0.11-0.12-0.16-0.18c-0.06-0.06-0.12-0.13-0.17-0.19c-0.38-0.48-0.7-0.97-0.96-1.49 c-0.24-0.46-0.43-0.95-0.58-1.49c-0.06-0.19-0.11-0.37-0.15-0.57c-0.01-0.01-0.02-0.03-0.02-0.05c-0.1-0.41-0.19-0.84-0.24-1.27 c-0.06-0.33-0.09-0.66-0.09-1c-0.02-0.13-0.02-0.27-0.02-0.4l1.91-2.95l1.87-2.88l0.85-1.31l0.77-1.18l0.26-0.41v-1.03 c0.02-0.23,0.03-0.47,0.02-0.69c-0.01-0.7-0.15-1.38-0.38-2.03c-0.22-0.69-0.53-1.34-0.85-1.94c-0.38-0.69-0.78-1.31-1.11-1.87 C14,7.4,13.66,6.73,13.75,6.26C14.47,6.09,15.23,6,16,6h16c4.18,0,7.78,2.6,9.27,6.26C41.43,12.65,41.57,13.06,41.67,13.48z" - })), _path2 || (_path2 = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#4928f4", - d: "M42,16v0.27l-1.38,0.8l-0.88,0.51l-0.97,0.56l-1.94,1.13l-1.9,1.1l-1.94,1.12l-0.77,0.45 c0,0.48-0.12,0.92-0.34,1.32c-0.31,0.58-0.83,1.06-1.49,1.47c-0.67,0.41-1.49,0.74-2.41,0.98c0,0,0-0.01-0.01,0 c-3.56,0.92-8.42,0.5-10.78-1.26c-0.66-0.49-1.12-1.09-1.32-1.78c-0.06-0.23-0.09-0.48-0.09-0.73v-7.19 c0.01-0.15-0.09-0.3-0.27-0.45c-0.54-0.43-1.81-0.84-3.23-1.25c-1.11-0.31-2.3-0.62-3.3-0.92c-0.79-0.24-1.46-0.48-1.86-0.71 c0.18-0.35,0.39-0.7,0.61-1.03c1.4-2.05,3.54-3.56,6.02-4.13C14.47,6.09,15.23,6,16,6h10.8c5.37,0.94,10.32,3.13,14.47,6.26 c0.16,0.39,0.3,0.8,0.4,1.22c0.18,0.66,0.29,1.34,0.32,2.05C42,15.68,42,15.84,42,16z" - })), _path3 || (_path3 = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#6200ea", - d: "M42,16v4.41l-0.22,0.68l-0.75,2.33l-0.78,2.4l-0.41,1.28l-0.38,1.19l-0.37,1.13l-0.36,1.12l-0.19,0.59 l-0.25,0.78c0,0.76-0.02,1.43-0.07,2c-0.01,0.06-0.02,0.12-0.02,0.18c-0.06,0.53-0.14,0.98-0.27,1.36 c-0.01,0.06-0.03,0.12-0.05,0.17c-0.26,0.72-0.65,1.18-1.23,1.48c-0.14,0.08-0.3,0.14-0.47,0.2c-0.53,0.18-1.2,0.27-2.02,0.32 c-0.6,0.04-1.29,0.05-2.07,0.05H31.4l-1.19-0.05L30,37.61l-2.17-0.09l-2.2-0.09l-7.25-0.3l-1.88-0.08h-0.26 c-0.78-0.01-1.45-0.06-2.03-0.14c-0.84-0.13-1.49-0.35-1.98-0.68c-0.7-0.45-1.11-1.11-1.35-2.03c-0.06-0.22-0.11-0.45-0.14-0.7 c-0.1-0.58-0.15-1.25-0.18-2c0-0.15,0-0.3-0.01-0.46c-0.01-0.01,0-0.01,0-0.01v-0.58c-0.01-0.29-0.01-0.59-0.01-0.9l0.05-1.61 l0.03-1.15l0.04-1.34v-0.19l0.07-2.46l0.07-2.46l0.07-2.31l0.06-2.27l0.02-0.6c0-0.31-1.05-0.49-2.22-0.64 c-0.93-0.12-1.95-0.23-2.56-0.37c0.05-0.23,0.1-0.46,0.16-0.68c0.18-0.72,0.45-1.4,0.79-2.05c0.18-0.35,0.39-0.7,0.61-1.03 c2.16-0.95,4.41-1.69,6.76-2.17c2.06-0.43,4.21-0.66,6.43-0.66c7.36,0,14.16,2.49,19.54,6.69c0.52,0.4,1.03,0.83,1.53,1.28 C42,15.68,42,15.84,42,16z" - })), _path4 || (_path4 = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#673ab7", - d: "M42,18.37v4.54l-0.55,1.06l-1.05,2.05l-0.56,1.08l-0.51,0.99l-0.22,0.43c0,0.31,0,0.61-0.02,0.9 c0,0.43-0.02,0.84-0.05,1.22c-0.04,0.45-0.1,0.86-0.16,1.24c-0.15,0.79-0.36,1.47-0.66,2.03c-0.04,0.07-0.08,0.14-0.12,0.2 c-0.11,0.18-0.24,0.35-0.38,0.51c-0.18,0.22-0.38,0.41-0.61,0.57c-0.34,0.26-0.74,0.47-1.2,0.63c-0.57,0.21-1.23,0.35-2.01,0.43 c-0.51,0.05-1.07,0.08-1.68,0.08l-0.42,0.02l-2.08,0.12h-0.01L27.5,36.6l-2.25,0.13l-3.1,0.18l-3.77,0.22l-0.55,0.03 c-0.51,0-0.99-0.03-1.45-0.09c-0.05-0.01-0.09-0.02-0.14-0.02c-0.68-0.11-1.3-0.29-1.86-0.54c-0.68-0.3-1.27-0.7-1.77-1.18 c-0.44-0.43-0.82-0.92-1.13-1.47c-0.07-0.13-0.14-0.25-0.2-0.39c-0.3-0.59-0.54-1.25-0.72-1.97c-0.03-0.12-0.06-0.25-0.08-0.38 c-0.06-0.23-0.11-0.47-0.14-0.72c-0.11-0.64-0.17-1.32-0.2-2.03v-0.01c-0.01-0.29-0.02-0.57-0.02-0.87l-0.49-1.17l-0.07-0.18 L9.5,25.99L8.75,24.2l-0.12-0.29l-0.72-1.73l-0.8-1.93c0,0,0,0-0.01,0L6.29,18.3L6,17.59V16c0-0.63,0.06-1.25,0.17-1.85 c0.05-0.23,0.1-0.46,0.16-0.68c0.85-0.49,1.74-0.94,2.65-1.34c2.08-0.93,4.31-1.62,6.62-2.04c1.72-0.31,3.51-0.48,5.32-0.48 c7.31,0,13.94,2.65,19.12,6.97c0.2,0.16,0.39,0.32,0.58,0.49C41.09,17.48,41.55,17.91,42,18.37z" - })), _path5 || (_path5 = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#8e24aa", - d: "M42,21.35v5.14l-0.57,1.19l-1.08,2.25l-0.01,0.03c0,0.43-0.02,0.82-0.05,1.17c-0.1,1.15-0.38,1.88-0.84,2.33 c-0.33,0.34-0.74,0.53-1.25,0.63c-0.03,0.01-0.07,0.01-0.1,0.02c-0.16,0.03-0.33,0.05-0.51,0.05c-0.62,0.06-1.35,0.02-2.19-0.04 c-0.09,0-0.19-0.01-0.29-0.02c-0.61-0.04-1.26-0.08-1.98-0.11c-0.39-0.01-0.8-0.02-1.22-0.02h-0.02l-1.01,0.08h-0.01l-2.27,0.16 l-2.59,0.2l-0.38,0.03l-3.03,0.22l-1.57,0.12l-1.55,0.11c-0.27,0-0.53,0-0.79-0.01c0,0-0.01-0.01-0.01,0 c-1.13-0.02-2.14-0.09-3.04-0.26c-0.83-0.14-1.56-0.36-2.18-0.69c-0.64-0.31-1.17-0.75-1.6-1.31c-0.41-0.55-0.71-1.24-0.9-2.07 c0-0.01,0-0.01,0-0.01c-0.14-0.67-0.22-1.45-0.22-2.33l-0.15-0.27L9.7,26.35l-0.13-0.22L9.5,25.99l-0.93-1.65l-0.46-0.83 l-0.58-1.03l-1-1.79L6,19.75v-3.68c0.88-0.58,1.79-1.09,2.73-1.55c1.14-0.58,2.32-1.07,3.55-1.47c1.34-0.44,2.74-0.79,4.17-1.02 c1.45-0.24,2.94-0.36,4.47-0.36c6.8,0,13.04,2.43,17.85,6.47c0.22,0.17,0.43,0.36,0.64,0.54c0.84,0.75,1.64,1.56,2.37,2.41 C41.86,21.18,41.94,21.26,42,21.35z" - })), _path6 || (_path6 = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#c2185b", - d: "M42,24.71v7.23c-0.24-0.14-0.57-0.31-0.98-0.49c-0.22-0.11-0.47-0.22-0.73-0.32 c-0.38-0.17-0.79-0.33-1.25-0.49c-0.1-0.04-0.2-0.07-0.31-0.1c-0.18-0.07-0.37-0.13-0.56-0.19c-0.59-0.18-1.24-0.35-1.92-0.5 c-0.26-0.05-0.53-0.1-0.8-0.14c-0.87-0.15-1.8-0.24-2.77-0.25c-0.08-0.01-0.17-0.01-0.25-0.01l-2.57,0.02l-3.5,0.02h-0.01 l-7.49,0.06c-2.38,0-3.84,0.57-4.72,0.8c0,0-0.01,0-0.01,0.01c-0.93,0.24-1.22,0.09-1.3-1.54c-0.02-0.45-0.03-1.03-0.03-1.74 l-0.56-0.43l-0.98-0.74l-0.6-0.46l-0.12-0.09L8.88,24.1l-0.25-0.19l-0.52-0.4l-0.96-0.72L6,21.91v-3.4 c0.1-0.08,0.19-0.15,0.29-0.21c1.45-1,3-1.85,4.64-2.54c1.46-0.62,3-1.11,4.58-1.46c0.43-0.09,0.87-0.18,1.32-0.24 c1.33-0.23,2.7-0.34,4.09-0.34c6.01,0,11.53,2.09,15.91,5.55c0.66,0.52,1.3,1.07,1.9,1.66c0.82,0.78,1.59,1.61,2.3,2.49 c0.14,0.18,0.28,0.36,0.42,0.55C41.64,24.21,41.82,24.46,42,24.71z" - })), _path7 || (_path7 = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#d81b60", - d: "M42,28.72V32c0,0.65-0.06,1.29-0.18,1.91c-0.18,0.92-0.49,1.8-0.91,2.62c-0.22,0.05-0.47,0.05-0.75,0.01 c-0.63-0.11-1.37-0.44-2.17-0.87c-0.04-0.01-0.08-0.03-0.11-0.05c-0.25-0.13-0.51-0.27-0.77-0.43c-0.53-0.29-1.09-0.61-1.65-0.91 c-0.12-0.06-0.24-0.12-0.35-0.18c-0.64-0.33-1.3-0.63-1.96-0.86c0,0,0,0-0.01,0c-0.14-0.05-0.29-0.1-0.44-0.14 c-0.57-0.16-1.15-0.26-1.71-0.26l-1.1-0.32l-4.87-1.41c0,0,0,0-0.01,0l-2.99-0.87h-0.01l-1.3-0.38c-3.76,0-6.07,1.6-7.19,0.99 c-0.44-0.23-0.7-0.81-0.79-1.95c-0.03-0.32-0.04-0.68-0.04-1.1l-1.17-0.57l-0.05-0.02h-0.01l-0.84-0.42L9.7,26.35l-0.07-0.03 l-0.17-0.09L7.5,25.28L6,24.55v-3.43c0.17-0.15,0.35-0.29,0.53-0.43c0.19-0.15,0.38-0.29,0.57-0.44c0.01,0,0.01,0,0.01,0 c1.18-0.85,2.43-1.6,3.76-2.22c1.55-0.74,3.2-1.31,4.91-1.68c0.25-0.06,0.51-0.12,0.77-0.16c1.42-0.27,2.88-0.41,4.37-0.41 c5.27,0,10.11,1.71,14.01,4.59c1.13,0.84,2.18,1.77,3.14,2.78c0.79,0.83,1.52,1.73,2.18,2.67c0.05,0.07,0.1,0.14,0.15,0.2 c0.37,0.54,0.71,1.09,1.03,1.66C41.64,28.02,41.82,28.37,42,28.72z" - })), _path8 || (_path8 = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#f50057", - d: "M41.82,33.91c-0.18,0.92-0.49,1.8-0.91,2.62c-0.19,0.37-0.4,0.72-0.63,1.06c-0.14,0.21-0.29,0.41-0.44,0.6 c-0.36-0.14-0.89-0.34-1.54-0.56c0,0,0,0,0-0.01c-0.49-0.17-1.05-0.35-1.65-0.52c-0.17-0.05-0.34-0.1-0.52-0.15 c-0.71-0.19-1.45-0.36-2.17-0.46c-0.6-0.1-1.19-0.16-1.74-0.16l-0.46-0.13h-0.01l-2.42-0.7l-1.49-0.43l-1.66-0.48h-0.01l-0.54-0.15 l-6.53-1.88l-1.88-0.54l-1.4-0.33l-2.28-0.54l-0.28-0.07c0,0,0,0-0.01,0l-2.29-0.53c0-0.01,0-0.01,0-0.01l-0.41-0.09l-0.21-0.05 l-1.67-0.39l-0.19-0.05l-1.42-1.17L6,27.9v-4.08c0.37-0.36,0.75-0.7,1.15-1.03c0.12-0.11,0.25-0.21,0.38-0.31 c0.12-0.1,0.25-0.2,0.38-0.3c0.91-0.69,1.87-1.31,2.89-1.84c1.3-0.7,2.68-1.26,4.13-1.66c0.28-0.09,0.56-0.17,0.85-0.23 c1.64-0.41,3.36-0.62,5.14-0.62c4.47,0,8.63,1.35,12.07,3.66c1.71,1.15,3.25,2.53,4.55,4.1c0.66,0.79,1.26,1.62,1.79,2.5 c0.05,0.07,0.09,0.13,0.13,0.2c0.32,0.53,0.62,1.08,0.89,1.64c0.25,0.5,0.47,1,0.67,1.52C41.34,32.25,41.6,33.07,41.82,33.91z" - })), _path9 || (_path9 = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#ff1744", - d: "M40.28,37.59c-0.14,0.21-0.29,0.41-0.44,0.6c-0.44,0.55-0.92,1.05-1.46,1.49c-0.47,0.39-0.97,0.74-1.5,1.04 c-0.2-0.05-0.4-0.11-0.61-0.19c-0.66-0.23-1.35-0.61-1.99-1.01c-0.96-0.61-1.79-1.27-2.16-1.57c-0.14-0.12-0.21-0.18-0.21-0.18 l-1.7-0.15L30,37.6l-2.2-0.19l-2.28-0.2l-3.37-0.3l-5.34-0.47l-0.02-0.01l-1.88-0.91l-1.9-0.92l-1.53-0.74l-0.33-0.16l-0.41-0.2 l-1.42-0.69L7.43,31.9l-0.59-0.29L6,31.35v-4.47c0.47-0.56,0.97-1.09,1.5-1.6c0.34-0.32,0.7-0.64,1.07-0.94 c0.06-0.05,0.12-0.1,0.18-0.14c0.04-0.05,0.09-0.08,0.13-0.1c0.59-0.48,1.21-0.91,1.85-1.3c0.74-0.47,1.52-0.89,2.33-1.24 c0.87-0.39,1.78-0.72,2.72-0.97c1.63-0.46,3.36-0.7,5.14-0.7c4.08,0,7.85,1.24,10.96,3.37c1.99,1.36,3.71,3.08,5.07,5.07 c0.45,0.64,0.85,1.32,1.22,2.02c0.13,0.26,0.26,0.52,0.37,0.78c0.12,0.25,0.23,0.5,0.34,0.75c0.21,0.52,0.4,1.04,0.57,1.58 c0.32,1,0.56,2.02,0.71,3.08C40.21,36.89,40.25,37.24,40.28,37.59z" - })), _path10 || (_path10 = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#ff5722", - d: "M38.39,39.42c0,0.08,0,0.17-0.01,0.26c-0.47,0.39-0.97,0.74-1.5,1.04c-0.22,0.12-0.44,0.24-0.67,0.34 c-0.23,0.11-0.46,0.21-0.7,0.3c-0.34-0.18-0.8-0.4-1.29-0.61c-0.69-0.31-1.44-0.59-2.02-0.68c-0.14-0.03-0.27-0.04-0.39-0.04 l-1.64-0.21h-0.02l-2.04-0.27l-2.06-0.27l-0.96-0.12l-7.56-0.98c-0.49,0-1.01-0.03-1.55-0.1c-0.66-0.06-1.35-0.16-2.04-0.3 c-0.68-0.12-1.37-0.28-2.03-0.45c-0.69-0.16-1.37-0.35-2-0.53c-0.73-0.22-1.41-0.43-1.98-0.62c-0.47-0.15-0.87-0.29-1.18-0.4 c-0.18-0.43-0.33-0.88-0.44-1.34C6.1,33.66,6,32.84,6,32v-1.67c0.32-0.53,0.67-1.05,1.06-1.54c0.71-0.94,1.52-1.8,2.4-2.56 c0.03-0.04,0.07-0.07,0.1-0.09l0.01-0.01c0.31-0.28,0.63-0.53,0.97-0.77c0.04-0.04,0.08-0.07,0.12-0.1 c0.16-0.12,0.33-0.24,0.51-0.35c1.43-0.97,3.01-1.73,4.7-2.24c1.6-0.48,3.29-0.73,5.05-0.73c3.49,0,6.75,1.03,9.47,2.79 c2.01,1.29,3.74,2.99,5.06,4.98c0.16,0.23,0.31,0.46,0.46,0.7c0.69,1.17,1.26,2.43,1.68,3.75c0.05,0.15,0.09,0.3,0.13,0.46 c0.08,0.27,0.15,0.55,0.21,0.83c0.02,0.07,0.04,0.14,0.06,0.22c0.14,0.63,0.24,1.29,0.31,1.95c0,0.01,0,0.01,0,0.01 C38.36,38.22,38.39,38.82,38.39,39.42z" - })), _path11 || (_path11 = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#ff6f00", - d: "M36.33,39.42c0,0.35-0.02,0.73-0.06,1.11c-0.02,0.18-0.04,0.36-0.06,0.53c-0.23,0.11-0.46,0.21-0.7,0.3 c-0.45,0.17-0.91,0.31-1.38,0.41c-0.32,0.07-0.65,0.13-0.98,0.16h-0.01c-0.31-0.19-0.67-0.42-1.04-0.68 c-0.67-0.47-1.37-1-1.93-1.43c-0.01-0.01-0.01-0.01-0.02-0.02c-0.59-0.45-1.01-0.79-1.01-0.79l-1.06,0.04l-2.04,0.07l-0.95,0.04 l-3.82,0.14l-3.23,0.12c-0.21,0.01-0.46,0.01-0.77,0h-0.01c-0.42-0.01-0.92-0.04-1.47-0.09c-0.64-0.05-1.34-0.11-2.05-0.18 c-0.69-0.08-1.39-0.16-2.06-0.24c-0.74-0.08-1.44-0.17-2.04-0.25c-0.47-0.06-0.88-0.11-1.21-0.15c-0.28-0.32-0.53-0.65-0.77-1.01 c-0.36-0.54-0.67-1.11-0.91-1.72c-0.18-0.43-0.33-0.88-0.44-1.34c0.29-0.89,0.67-1.73,1.12-2.54c0.36-0.66,0.78-1.29,1.24-1.89 c0.45-0.59,0.94-1.14,1.47-1.64v-0.01c0.15-0.15,0.3-0.29,0.45-0.42c0.28-0.26,0.57-0.5,0.87-0.73h0.01 c0.01-0.02,0.02-0.02,0.03-0.03c0.24-0.19,0.49-0.36,0.74-0.53c1.48-1.01,3.15-1.76,4.95-2.2c1.19-0.29,2.44-0.45,3.73-0.45 c2.54,0,4.94,0.61,7.05,1.71h0.01c1.81,0.93,3.41,2.21,4.7,3.75c0.71,0.82,1.32,1.72,1.82,2.67c0.35,0.64,0.65,1.31,0.9,1.99 c0.02,0.06,0.04,0.11,0.06,0.16c0.17,0.5,0.32,1.02,0.45,1.54c0.09,0.37,0.16,0.75,0.22,1.13c0.02,0.12,0.04,0.23,0.05,0.35 C36.28,37.99,36.33,38.7,36.33,39.42z" - })), _path12 || (_path12 = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#ff9800", - d: "M34.28,39.42v0.1c0,0.34-0.03,0.77-0.06,1.23c-0.03,0.34-0.06,0.69-0.09,1.02c-0.32,0.07-0.65,0.13-0.98,0.16 h-0.01C32.76,41.98,32.39,42,32,42h-1.75l-0.38-0.11l-1.97-0.6l-2-0.6l-4.63-1.39l-2-0.6c0,0-0.83,0.33-2,0.72h-0.01 c-0.45,0.15-0.94,0.31-1.46,0.47c-0.65,0.19-1.34,0.38-2.02,0.53c-0.7,0.16-1.39,0.28-2.01,0.33c-0.19,0.02-0.38,0.03-0.55,0.03 c-0.56-0.31-1.1-0.68-1.59-1.09c-0.43-0.36-0.83-0.75-1.2-1.18c-0.28-0.32-0.53-0.65-0.77-1.01c0.07-0.45,0.15-0.89,0.27-1.32 c0.3-1.19,0.77-2.33,1.39-3.37c0.34-0.59,0.72-1.16,1.16-1.69c0.01-0.03,0.04-0.06,0.07-0.08c-0.01-0.01,0-0.01,0-0.01 c0.13-0.17,0.27-0.33,0.41-0.48c0-0.01,0-0.01,0-0.01c0.41-0.44,0.83-0.86,1.29-1.25c0.16-0.13,0.31-0.26,0.48-0.39 c0.03-0.03,0.06-0.05,0.1-0.08c2.25-1.72,5.06-2.76,8.09-2.76c3.44,0,6.57,1.29,8.94,3.41c1.14,1.03,2.11,2.26,2.84,3.63 c0.06,0.1,0.12,0.21,0.17,0.32c0.09,0.18,0.18,0.37,0.26,0.57c0.33,0.72,0.59,1.48,0.77,2.26c0.02,0.08,0.04,0.16,0.06,0.24 c0.08,0.37,0.15,0.75,0.2,1.13C34.24,38.21,34.28,38.81,34.28,39.42z" - })), _path13 || (_path13 = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#ffc107", - d: "M32.22,39.42c0,0.2-0.01,0.42-0.02,0.65c-0.02,0.37-0.05,0.77-0.1,1.18c-0.02,0.25-0.06,0.5-0.1,0.75h-5.48 l-1.06-0.17l-4.14-0.66l-0.59-0.09l-1.35-0.22c-0.59,0-1.87,0.26-3.22,0.51c-0.71,0.13-1.43,0.27-2.08,0.36 c-0.08,0.01-0.16,0.02-0.23,0.03h-0.01c-0.7-0.15-1.38-0.38-2.02-0.68c-0.2-0.09-0.4-0.19-0.6-0.3c-0.56-0.31-1.1-0.68-1.59-1.09 c-0.01-0.12-0.02-0.22-0.02-0.27c0-0.26,0.01-0.51,0.03-0.76c0.04-0.64,0.13-1.26,0.27-1.86c0.22-0.91,0.54-1.79,0.97-2.6 c0.08-0.17,0.17-0.34,0.27-0.5c0.04-0.08,0.09-0.15,0.13-0.23c0.18-0.29,0.38-0.57,0.58-0.85c0.42-0.55,0.89-1.07,1.39-1.54 c0.01,0,0.01,0,0.01,0c0.04-0.04,0.08-0.08,0.12-0.11c0.05-0.04,0.09-0.09,0.14-0.12c0.2-0.18,0.4-0.34,0.61-0.49 c0-0.01,0.01-0.01,0.01-0.01c1.89-1.41,4.23-2.24,6.78-2.24c1.98,0,3.82,0.5,5.43,1.38h0.01c1.38,0.76,2.58,1.79,3.53,3.03 c0.37,0.48,0.7,0.99,0.98,1.53h0.01c0.05,0.1,0.1,0.2,0.15,0.3c0.3,0.59,0.54,1.21,0.72,1.85h0.01c0.01,0.05,0.03,0.1,0.04,0.15 c0.12,0.43,0.22,0.87,0.29,1.32c0.01,0.09,0.02,0.19,0.03,0.28C32.19,38.43,32.22,38.92,32.22,39.42z" - })), _path14 || (_path14 = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#ffd54f", - d: "M30.17,39.31c0,0.16,0,0.33-0.02,0.49v0.01c0,0.01,0,0.01,0,0.01c-0.02,0.72-0.12,1.43-0.28,2.07 c0,0.04-0.01,0.07-0.03,0.11h-4.67l-3.85-0.83l-0.51-0.11l-0.08,0.02l-4.27,0.88L16.27,42H16c-0.64,0-1.27-0.06-1.88-0.18 c-0.09-0.02-0.18-0.04-0.27-0.06h-0.01c-0.7-0.15-1.38-0.38-2.02-0.68c-0.02-0.11-0.04-0.22-0.05-0.33 c-0.07-0.43-0.1-0.88-0.1-1.33c0-0.17,0-0.34,0.01-0.51c0.03-0.54,0.11-1.07,0.23-1.58c0.08-0.38,0.19-0.75,0.32-1.1 c0.11-0.31,0.24-0.61,0.38-0.9c0.12-0.25,0.26-0.49,0.4-0.73c0.14-0.23,0.29-0.45,0.45-0.67c0.4-0.55,0.87-1.06,1.39-1.51 c0.3-0.26,0.63-0.51,0.97-0.73c1.46-0.96,3.21-1.52,5.1-1.52c0.37,0,0.73,0.02,1.08,0.07h0.02c1.07,0.12,2.07,0.42,2.99,0.87 c0.01,0,0.01,0,0.01,0c1.45,0.71,2.68,1.78,3.58,3.1c0.15,0.22,0.3,0.46,0.43,0.7c0.11,0.19,0.21,0.39,0.3,0.59 c0.14,0.31,0.27,0.64,0.38,0.97h0.01c0.11,0.37,0.21,0.74,0.28,1.13v0.01C30.11,38.16,30.17,38.73,30.17,39.31z" - })), _path15 || (_path15 = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#ffe082", - d: "M28.11,39.52v0.03c0,0.59-0.07,1.17-0.21,1.74c-0.05,0.24-0.12,0.48-0.21,0.71h-4.48l-2.29-0.63L18.63,42H16 c-0.64,0-1.27-0.06-1.88-0.18c-0.02-0.03-0.03-0.06-0.04-0.09c-0.14-0.43-0.25-0.86-0.3-1.31c-0.04-0.29-0.06-0.59-0.06-0.9 c0-0.12,0-0.25,0.02-0.37c0.01-0.47,0.08-0.93,0.2-1.37c0.06-0.3,0.15-0.59,0.27-0.87c0.04-0.14,0.1-0.27,0.17-0.4 c0.15-0.34,0.33-0.67,0.53-0.99c0.22-0.32,0.46-0.62,0.73-0.9c0.32-0.36,0.68-0.69,1.09-0.96c0.7-0.51,1.5-0.89,2.37-1.1 c0.58-0.16,1.19-0.24,1.82-0.24c2,0,3.79,0.8,5.09,2.09c0.05,0.05,0.11,0.11,0.16,0.18h0.01c0.14,0.15,0.27,0.3,0.4,0.47 c0.37,0.47,0.68,0.98,0.92,1.54c0.12,0.26,0.22,0.53,0.3,0.81c0.01,0.04,0.02,0.07,0.03,0.11c0.14,0.49,0.23,1,0.25,1.53 C28.1,39.2,28.11,39.36,28.11,39.52z" - })), _path16 || (_path16 = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#ffecb3", - d: "M26.06,39.52c0,0.41-0.05,0.8-0.16,1.17c-0.1,0.4-0.25,0.78-0.44,1.14c-0.03,0.06-0.1,0.17-0.1,0.17h-8.88 c-0.01-0.01-0.02-0.03-0.02-0.04c-0.12-0.19-0.22-0.38-0.3-0.59c-0.2-0.46-0.32-0.96-0.36-1.48c-0.02-0.12-0.02-0.25-0.02-0.37 c0-0.06,0-0.13,0.01-0.19c0.01-0.44,0.07-0.86,0.19-1.25c0.1-0.36,0.23-0.69,0.4-1.01c0,0,0.01-0.01,0.01-0.02 c0.12-0.21,0.25-0.42,0.4-0.62c0.49-0.66,1.14-1.2,1.89-1.55c0.01,0,0.01,0,0.01,0c0.24-0.12,0.49-0.22,0.75-0.29c0,0,0,0,0.01,0 c0.46-0.14,0.96-0.21,1.47-0.21c0.59,0,1.16,0.09,1.68,0.28c0.19,0.05,0.37,0.13,0.55,0.22c0,0,0,0,0.01,0 c0.86,0.41,1.59,1.05,2.09,1.85c0.1,0.15,0.19,0.31,0.27,0.48c0.04,0.07,0.08,0.15,0.11,0.22c0.23,0.52,0.37,1.09,0.41,1.69 c0.01,0.05,0.01,0.1,0.01,0.16C26.06,39.36,26.06,39.44,26.06,39.52z" - })), _g || (_g = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "none", - stroke: "#fff", - strokeLinecap: "round", - strokeLinejoin: "round", - strokeMiterlimit: 10, - strokeWidth: 2, - d: "M30,11H18c-3.9,0-7,3.1-7,7v12c0,3.9,3.1,7,7,7h12c3.9,0,7-3.1,7-7V18C37,14.1,33.9,11,30,11z" - }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("circle", { - cx: 31, - cy: 16, - r: 1, - fill: "#fff" - }))), _g2 || (_g2 = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("circle", { - cx: 24, - cy: 24, - r: 6, - fill: "none", - stroke: "#fff", - strokeLinecap: "round", - strokeLinejoin: "round", - strokeMiterlimit: 10, - strokeWidth: 2 - })))); -} - -const ForwardRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(SvgIcons8Instagram); -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__webpack_require__.p + "static/media/icons8-instagram.30f201bfa73e2d1f1d8409a82298032e.svg"); - - -/***/ }), - -/***/ "./src/assets/socialMediaIcons/icons8-line.svg": -/*!*****************************************************!*\ - !*** ./src/assets/socialMediaIcons/icons8-line.svg ***! - \*****************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ReactComponent": () => (/* binding */ ForwardRef), -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -var _path, _path2; - -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - - - -function SvgIcons8Line(_ref, svgRef) { - let { - title, - titleId, - ...props - } = _ref; - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg", _extends({ - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 48 48", - width: "64px", - height: "96px", - ref: svgRef, - "aria-labelledby": titleId - }, props), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("title", { - id: titleId - }, title) : null, _path || (_path = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#00c300", - d: "M12.5,42h23c3.59,0,6.5-2.91,6.5-6.5v-23C42,8.91,39.09,6,35.5,6h-23C8.91,6,6,8.91,6,12.5v23C6,39.09,8.91,42,12.5,42z" - })), _path2 || (_path2 = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#fff", - d: "M37.113,22.417c0-5.865-5.88-10.637-13.107-10.637s-13.108,4.772-13.108,10.637c0,5.258,4.663,9.662,10.962,10.495c0.427,0.092,1.008,0.282,1.155,0.646c0.132,0.331,0.086,0.85,0.042,1.185c0,0-0.153,0.925-0.187,1.122c-0.057,0.331-0.263,1.296,1.135,0.707c1.399-0.589,7.548-4.445,10.298-7.611h-0.001C36.203,26.879,37.113,24.764,37.113,22.417z M18.875,25.907h-2.604c-0.379,0-0.687-0.308-0.687-0.688V20.01c0-0.379,0.308-0.687,0.687-0.687c0.379,0,0.687,0.308,0.687,0.687v4.521h1.917c0.379,0,0.687,0.308,0.687,0.687C19.562,25.598,19.254,25.907,18.875,25.907z M21.568,25.219c0,0.379-0.308,0.688-0.687,0.688s-0.687-0.308-0.687-0.688V20.01c0-0.379,0.308-0.687,0.687-0.687s0.687,0.308,0.687,0.687V25.219z M27.838,25.219c0,0.297-0.188,0.559-0.47,0.652c-0.071,0.024-0.145,0.036-0.218,0.036c-0.215,0-0.42-0.103-0.549-0.275l-2.669-3.635v3.222c0,0.379-0.308,0.688-0.688,0.688c-0.379,0-0.688-0.308-0.688-0.688V20.01c0-0.296,0.189-0.558,0.47-0.652c0.071-0.024,0.144-0.035,0.218-0.035c0.214,0,0.42,0.103,0.549,0.275l2.67,3.635V20.01c0-0.379,0.309-0.687,0.688-0.687c0.379,0,0.687,0.308,0.687,0.687V25.219z M32.052,21.927c0.379,0,0.688,0.308,0.688,0.688c0,0.379-0.308,0.687-0.688,0.687h-1.917v1.23h1.917c0.379,0,0.688,0.308,0.688,0.687c0,0.379-0.309,0.688-0.688,0.688h-2.604c-0.378,0-0.687-0.308-0.687-0.688v-2.603c0-0.001,0-0.001,0-0.001c0,0,0-0.001,0-0.001v-2.601c0-0.001,0-0.001,0-0.002c0-0.379,0.308-0.687,0.687-0.687h2.604c0.379,0,0.688,0.308,0.688,0.687s-0.308,0.687-0.688,0.687h-1.917v1.23H32.052z" - }))); -} - -const ForwardRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(SvgIcons8Line); -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__webpack_require__.p + "static/media/icons8-line.3a34768d140958f26bc99abf820f16f0.svg"); - - -/***/ }), - -/***/ "./src/assets/socialMediaIcons/icons8-linkedin.svg": -/*!*********************************************************!*\ - !*** ./src/assets/socialMediaIcons/icons8-linkedin.svg ***! - \*********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ReactComponent": () => (/* binding */ ForwardRef), -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -var _path, _path2; - -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - - - -function SvgIcons8Linkedin(_ref, svgRef) { - let { - title, - titleId, - ...props - } = _ref; - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg", _extends({ - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 48 48", - width: "64px", - height: "96px", - ref: svgRef, - "aria-labelledby": titleId - }, props), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("title", { - id: titleId - }, title) : null, _path || (_path = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#0288D1", - d: "M42,37c0,2.762-2.238,5-5,5H11c-2.761,0-5-2.238-5-5V11c0-2.762,2.239-5,5-5h26c2.762,0,5,2.238,5,5V37z" - })), _path2 || (_path2 = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#FFF", - d: "M12 19H17V36H12zM14.485 17h-.028C12.965 17 12 15.888 12 14.499 12 13.08 12.995 12 14.514 12c1.521 0 2.458 1.08 2.486 2.499C17 15.887 16.035 17 14.485 17zM36 36h-5v-9.099c0-2.198-1.225-3.698-3.192-3.698-1.501 0-2.313 1.012-2.707 1.99C24.957 25.543 25 26.511 25 27v9h-5V19h5v2.616C25.721 20.5 26.85 19 29.738 19c3.578 0 6.261 2.25 6.261 7.274L36 36 36 36z" - }))); -} - -const ForwardRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(SvgIcons8Linkedin); -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__webpack_require__.p + "static/media/icons8-linkedin.196fbfc183ebb1b2ffeefb01e2a38a93.svg"); - - -/***/ }), - -/***/ "./src/assets/socialMediaIcons/icons8-twitter.svg": -/*!********************************************************!*\ - !*** ./src/assets/socialMediaIcons/icons8-twitter.svg ***! - \********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ReactComponent": () => (/* binding */ ForwardRef), -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -var _path; - -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - - - -function SvgIcons8Twitter(_ref, svgRef) { - let { - title, - titleId, - ...props - } = _ref; - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg", _extends({ - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 48 48", - width: "64px", - height: "96px", - ref: svgRef, - "aria-labelledby": titleId - }, props), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("title", { - id: titleId - }, title) : null, _path || (_path = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { - fill: "#03A9F4", - d: "M42,12.429c-1.323,0.586-2.746,0.977-4.247,1.162c1.526-0.906,2.7-2.351,3.251-4.058c-1.428,0.837-3.01,1.452-4.693,1.776C34.967,9.884,33.05,9,30.926,9c-4.08,0-7.387,3.278-7.387,7.32c0,0.572,0.067,1.129,0.193,1.67c-6.138-0.308-11.582-3.226-15.224-7.654c-0.64,1.082-1,2.349-1,3.686c0,2.541,1.301,4.778,3.285,6.096c-1.211-0.037-2.351-0.374-3.349-0.914c0,0.022,0,0.055,0,0.086c0,3.551,2.547,6.508,5.923,7.181c-0.617,0.169-1.269,0.263-1.941,0.263c-0.477,0-0.942-0.054-1.392-0.135c0.94,2.902,3.667,5.023,6.898,5.086c-2.528,1.96-5.712,3.134-9.174,3.134c-0.598,0-1.183-0.034-1.761-0.104C9.268,36.786,13.152,38,17.321,38c13.585,0,21.017-11.156,21.017-20.834c0-0.317-0.01-0.633-0.025-0.945C39.763,15.197,41.013,13.905,42,12.429" - }))); -} - -const ForwardRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(SvgIcons8Twitter); -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__webpack_require__.p + "static/media/icons8-twitter.5ae6e9d6a5a1e36524202da16a7c38ee.svg"); - - -/***/ }), - -/***/ "./src/App.jsx": -/*!*********************!*\ - !*** ./src/App.jsx ***! - \*********************/ -/***/ ((module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! react-router-dom */ "./node_modules/react-router-dom/index.js"); -/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! react-router-dom */ "./node_modules/react-router/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _components_Login__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/Login */ "./src/components/Login.jsx"); -/* harmony import */ var _components_Landing__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/Landing */ "./src/components/Landing.jsx"); -/* harmony import */ var _components_Tiers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/Tiers */ "./src/components/Tiers.jsx"); -/* harmony import */ var _components_NavBar__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/NavBar */ "./src/components/NavBar.jsx"); -/* harmony import */ var _pages_Footprint__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./pages/Footprint */ "./src/pages/Footprint.jsx"); -/* harmony import */ var _components_Registration__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/Registration */ "./src/components/Registration.jsx"); -/* harmony import */ var _components_PaymentsForm__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./components/PaymentsForm */ "./src/components/PaymentsForm.jsx"); -/* harmony import */ var _pages_OrderConfirmation__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./pages/OrderConfirmation */ "./src/pages/OrderConfirmation.jsx"); -/* harmony import */ var _pages_Resources__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./pages/Resources */ "./src/pages/Resources.jsx"); -/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! react/jsx-dev-runtime */ "./node_modules/react/jsx-dev-runtime.js"); -/* provided dependency */ var __react_refresh_utils__ = __webpack_require__(/*! ./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js */ "./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js"); -__webpack_require__.$Refresh$.runtime = __webpack_require__(/*! ./node_modules/react-refresh/runtime.js */ "./node_modules/react-refresh/runtime.js"); - -var _jsxFileName = "/Users/josh/Desktop/polyzero/src/App.jsx", - _s = __webpack_require__.$Refresh$.signature(); - - - - - - - - - - - - - - - -function App() { - _s(); - - const [tier, setTier] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)({}); - return /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxDEV)("div", { - className: "flex flex-col h-screen", - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxDEV)(react_router_dom__WEBPACK_IMPORTED_MODULE_11__.BrowserRouter, { - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxDEV)(_components_NavBar__WEBPACK_IMPORTED_MODULE_4__["default"], {}, void 0, false, { - fileName: _jsxFileName, - lineNumber: 20, - columnNumber: 9 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxDEV)(react_router_dom__WEBPACK_IMPORTED_MODULE_12__.Routes, { - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxDEV)(react_router_dom__WEBPACK_IMPORTED_MODULE_12__.Route, { - exact: true, - path: "/", - element: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxDEV)(_components_Landing__WEBPACK_IMPORTED_MODULE_2__["default"], {}, void 0, false, { - fileName: _jsxFileName, - lineNumber: 22, - columnNumber: 42 - }, this) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 22, - columnNumber: 11 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxDEV)(react_router_dom__WEBPACK_IMPORTED_MODULE_12__.Route, { - exact: true, - path: "/login", - element: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxDEV)(_components_Login__WEBPACK_IMPORTED_MODULE_1__["default"], {}, void 0, false, { - fileName: _jsxFileName, - lineNumber: 23, - columnNumber: 47 - }, this) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 23, - columnNumber: 11 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxDEV)(react_router_dom__WEBPACK_IMPORTED_MODULE_12__.Route, { - exact: true, - path: "/registration", - element: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxDEV)(_components_Registration__WEBPACK_IMPORTED_MODULE_6__["default"], {}, void 0, false, { - fileName: _jsxFileName, - lineNumber: 24, - columnNumber: 54 - }, this) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 24, - columnNumber: 11 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxDEV)(react_router_dom__WEBPACK_IMPORTED_MODULE_12__.Route, { - exact: true, - path: "/footprint", - element: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxDEV)(_pages_Footprint__WEBPACK_IMPORTED_MODULE_5__["default"], {}, void 0, false, { - fileName: _jsxFileName, - lineNumber: 25, - columnNumber: 51 - }, this) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 25, - columnNumber: 11 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxDEV)(react_router_dom__WEBPACK_IMPORTED_MODULE_12__.Route, { - exact: true, - path: "/tiers", - element: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxDEV)(_components_Tiers__WEBPACK_IMPORTED_MODULE_3__["default"], { - setTier: setTier - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 26, - columnNumber: 47 - }, this) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 26, - columnNumber: 11 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxDEV)(react_router_dom__WEBPACK_IMPORTED_MODULE_12__.Route, { - exact: true, - path: "/payment", - element: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxDEV)(_components_PaymentsForm__WEBPACK_IMPORTED_MODULE_7__["default"], {}, void 0, false, { - fileName: _jsxFileName, - lineNumber: 27, - columnNumber: 49 - }, this) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 27, - columnNumber: 11 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxDEV)(react_router_dom__WEBPACK_IMPORTED_MODULE_12__.Route, { - exact: true, - path: "/resources", - element: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxDEV)(_pages_Resources__WEBPACK_IMPORTED_MODULE_9__["default"], {}, void 0, false, { - fileName: _jsxFileName, - lineNumber: 28, - columnNumber: 51 - }, this) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 28, - columnNumber: 11 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxDEV)(react_router_dom__WEBPACK_IMPORTED_MODULE_12__.Route, { - exact: true, - path: "/confirmation", - element: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxDEV)(_pages_OrderConfirmation__WEBPACK_IMPORTED_MODULE_8__["default"], { - tier: tier - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 32, - columnNumber: 22 - }, this) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 29, - columnNumber: 11 - }, this)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 21, - columnNumber: 9 - }, this)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 19, - columnNumber: 7 - }, this) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 18, - columnNumber: 5 - }, this); -} - -_s(App, "VHaViVzo7lrPCguxRwxa8NgsJ2A="); - -_c = App; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (App); - -var _c; - -__webpack_require__.$Refresh$.register(_c, "App"); - -const $ReactRefreshModuleId$ = __webpack_require__.$Refresh$.moduleId; -const $ReactRefreshCurrentExports$ = __react_refresh_utils__.getModuleExports( - $ReactRefreshModuleId$ -); - -function $ReactRefreshModuleRuntime$(exports) { - if (true) { - let errorOverlay; - if (true) { - errorOverlay = false; - } - let testMode; - if (typeof __react_refresh_test__ !== 'undefined') { - testMode = __react_refresh_test__; - } - return __react_refresh_utils__.executeRuntime( - exports, - $ReactRefreshModuleId$, - module.hot, - errorOverlay, - testMode - ); - } -} - -if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Promise) { - $ReactRefreshCurrentExports$.then($ReactRefreshModuleRuntime$); -} else { - $ReactRefreshModuleRuntime$($ReactRefreshCurrentExports$); -} - -/***/ }), - -/***/ "./src/components/FootprintCard.jsx": -/*!******************************************!*\ - !*** ./src/components/FootprintCard.jsx ***! - \******************************************/ -/***/ ((module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var flowbite_react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! flowbite-react */ "./node_modules/flowbite-react/lib/esm/index.js"); -/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-dev-runtime */ "./node_modules/react/jsx-dev-runtime.js"); -/* provided dependency */ var __react_refresh_utils__ = __webpack_require__(/*! ./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js */ "./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js"); -__webpack_require__.$Refresh$.runtime = __webpack_require__(/*! ./node_modules/react-refresh/runtime.js */ "./node_modules/react-refresh/runtime.js"); - -var _jsxFileName = "/Users/josh/Desktop/polyzero/src/components/FootprintCard.jsx"; - - - -const FootprintCard = _ref => { - let { - title, - grocery, - takeOut, - petBottles, - disposables, - setResult, - change - } = _ref; - - function getResult() { - setResult(title); - change(true); - } - - return /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("div", { - className: "transition ease-out duration-300 hover:-translate-y-1 hover:scale-105", - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_0__.Card, { - horizontal: true, - imgAlt: "Meaningful alt text for an image that is not purely decorative", - imgSrc: "https://media.timeout.com/images/105656638/image.jpg", - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("h2", { - className: "text-4xl font-bold tracking-tight text-center text-gray-900 dark:text-white", - children: title - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 24, - columnNumber: 9 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("div", { - className: "flex flex-col gap-2 h-96", - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("h4", { - className: "font-medium", - children: "Grocery Store" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 29, - columnNumber: 11 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("p", { - className: "font-normal text-gray-700 dark:text-gray-400", - children: grocery - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 30, - columnNumber: 11 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("h4", { - className: "font-medium", - children: "Take-out" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 33, - columnNumber: 11 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("p", { - className: "font-normal text-gray-700 dark:text-gray-400", - children: takeOut - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 34, - columnNumber: 11 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("h4", { - className: "font-medium", - children: "PET bottles" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 37, - columnNumber: 11 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("p", { - className: "font-normal text-gray-700 dark:text-gray-400", - children: petBottles - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 38, - columnNumber: 11 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("h4", { - className: "font-medium", - children: "Disposables" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 41, - columnNumber: 11 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("p", { - className: "font-normal text-gray-700 dark:text-gray-400", - children: disposables - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 42, - columnNumber: 11 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 28, - columnNumber: 9 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("button", { - className: "inline-flex items-center mt-4 py-2 px-3 text-sm font-medium justify-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800", - onClick: getResult, - children: "Select" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 47, - columnNumber: 9 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 19, - columnNumber: 7 - }, undefined) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 18, - columnNumber: 5 - }, undefined); -}; - -_c = FootprintCard; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (FootprintCard); - -var _c; - -__webpack_require__.$Refresh$.register(_c, "FootprintCard"); - -const $ReactRefreshModuleId$ = __webpack_require__.$Refresh$.moduleId; -const $ReactRefreshCurrentExports$ = __react_refresh_utils__.getModuleExports( - $ReactRefreshModuleId$ -); - -function $ReactRefreshModuleRuntime$(exports) { - if (true) { - let errorOverlay; - if (true) { - errorOverlay = false; - } - let testMode; - if (typeof __react_refresh_test__ !== 'undefined') { - testMode = __react_refresh_test__; - } - return __react_refresh_utils__.executeRuntime( - exports, - $ReactRefreshModuleId$, - module.hot, - errorOverlay, - testMode - ); - } -} - -if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Promise) { - $ReactRefreshCurrentExports$.then($ReactRefreshModuleRuntime$); -} else { - $ReactRefreshModuleRuntime$($ReactRefreshCurrentExports$); -} - -/***/ }), - -/***/ "./src/components/Landing.jsx": -/*!************************************!*\ - !*** ./src/components/Landing.jsx ***! - \************************************/ -/***/ ((module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var _Landing_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Landing.css */ "./src/components/Landing.css"); -/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react-router-dom */ "./node_modules/react-router/index.js"); -/* harmony import */ var _assets_socialMediaIcons_icons8_linkedin_svg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../assets/socialMediaIcons/icons8-linkedin.svg */ "./src/assets/socialMediaIcons/icons8-linkedin.svg"); -/* harmony import */ var _assets_socialMediaIcons_icons8_facebook_svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../assets/socialMediaIcons/icons8-facebook.svg */ "./src/assets/socialMediaIcons/icons8-facebook.svg"); -/* harmony import */ var _assets_socialMediaIcons_icons8_instagram_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../assets/socialMediaIcons/icons8-instagram.svg */ "./src/assets/socialMediaIcons/icons8-instagram.svg"); -/* harmony import */ var _assets_socialMediaIcons_icons8_twitter_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../assets/socialMediaIcons/icons8-twitter.svg */ "./src/assets/socialMediaIcons/icons8-twitter.svg"); -/* harmony import */ var _assets_socialMediaIcons_icons8_line_svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../assets/socialMediaIcons/icons8-line.svg */ "./src/assets/socialMediaIcons/icons8-line.svg"); -/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-dev-runtime */ "./node_modules/react/jsx-dev-runtime.js"); -/* provided dependency */ var __react_refresh_utils__ = __webpack_require__(/*! ./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js */ "./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js"); -__webpack_require__.$Refresh$.runtime = __webpack_require__(/*! ./node_modules/react-refresh/runtime.js */ "./node_modules/react-refresh/runtime.js"); - -var _jsxFileName = "/Users/josh/Desktop/polyzero/src/components/Landing.jsx", - _s = __webpack_require__.$Refresh$.signature(); - - - - - - - - - - -const Landing = () => { - _s(); - - const plasticConsumption = [" In Japan, 37 Kilograms Per capita annual single plastic consumption in Japan.", " In Japan 1 Kilogram of plastic equals to 5.6kg- 6kg CO2 over its lifetime.", " Japan is the 2nd biggest consumer of disposable plastic.", " In Japan, the average CO2 from plastic per capita is 207-222kg per annum.", " Single-use plastics, which account for half of the plastic we use each year, have an average useful life of 12 to 15 minutes and yet can take up to 500 years to break down."]; - const randomFact = plasticConsumption[Math.floor(Math.random() * plasticConsumption.length)]; - - const copyToClipboard = async () => { - await navigator.clipboard.writeText(randomFact); - }; - - const navigateTo = (0,react_router_dom__WEBPACK_IMPORTED_MODULE_7__.useNavigate)(); - return /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("div", { - className: "mt-11", - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("div", { - className: "flex-col items-center mt-11 align-items ", - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("div", { - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("img", { - className: "flex-col items-center mx-auto ", - alt: "Pictue of river running through jungle", - src: "https://siwi.org/wp-content/uploads/2021/07/why-water_topics-present-at-launch_rivers2.jpg", - width: "500", - height: "400" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 30, - columnNumber: 11 - }, undefined) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 29, - columnNumber: 9 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("h1", { - className: " mx-auto flex justify-center text-7xl gap-8 mt-11 ", - children: "PolyZero" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 38, - columnNumber: 9 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("p", { - className: " mx-auto flex justify-center text-1xl gap-8 mt-11", - children: "A better way to help the planet." - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 41, - columnNumber: 9 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("button", { - onClick: () => navigateTo("/footprint"), - className: " flex mx-auto mt-5 items-center py-2 px-3 text-sm font-medium justify-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800 ", - type: "button", - children: ["Get started", " "] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 44, - columnNumber: 9 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 28, - columnNumber: 7 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("div", { - className: "flex-col ", - children: [" ", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("div", { - class: " flex flex-col justify-center items-center", - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("h1", { - className: "text-2xl mb-7 mt-7 underline font-light", - children: "Did you know" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 55, - columnNumber: 11 - }, undefined) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 54, - columnNumber: 9 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("div", { - className: "flex flex-col justify-center items-center text-center font-bold mt-2 ", - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("div", { - className: "max-w-xs", - children: randomFact - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 60, - columnNumber: 11 - }, undefined) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 59, - columnNumber: 9 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 52, - columnNumber: 7 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("button", { - onClick: () => navigateTo("/resources"), - className: " flex mx-auto items-center mb-3 mt-9 py-2 px-3 text-sm font-medium justify-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800", - type: "button", - children: ["Learn more", " "] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 63, - columnNumber: 7 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 27, - columnNumber: 5 - }, undefined); -}; - -_s(Landing, "ymtrZ8G6aCOC+j9g/5vfaOOqM8M=", false, function () { - return [react_router_dom__WEBPACK_IMPORTED_MODULE_7__.useNavigate]; -}); - -_c = Landing; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Landing); - -var _c; - -__webpack_require__.$Refresh$.register(_c, "Landing"); - -const $ReactRefreshModuleId$ = __webpack_require__.$Refresh$.moduleId; -const $ReactRefreshCurrentExports$ = __react_refresh_utils__.getModuleExports( - $ReactRefreshModuleId$ -); - -function $ReactRefreshModuleRuntime$(exports) { - if (true) { - let errorOverlay; - if (true) { - errorOverlay = false; - } - let testMode; - if (typeof __react_refresh_test__ !== 'undefined') { - testMode = __react_refresh_test__; - } - return __react_refresh_utils__.executeRuntime( - exports, - $ReactRefreshModuleId$, - module.hot, - errorOverlay, - testMode - ); - } -} - -if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Promise) { - $ReactRefreshCurrentExports$.then($ReactRefreshModuleRuntime$); -} else { - $ReactRefreshModuleRuntime$($ReactRefreshCurrentExports$); -} - -/***/ }), - -/***/ "./src/components/Login.jsx": -/*!**********************************!*\ - !*** ./src/components/Login.jsx ***! - \**********************************/ -/***/ ((module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var flowbite_react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flowbite-react */ "./node_modules/flowbite-react/lib/esm/index.js"); -/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react-router-dom */ "./node_modules/react-router/index.js"); -/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react-router-dom */ "./node_modules/react-router-dom/index.js"); -/* harmony import */ var _firebase_firebase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../firebase/firebase */ "./src/firebase/firebase.js"); -/* harmony import */ var react_firebase_hooks_auth__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-firebase-hooks/auth */ "./node_modules/react-firebase-hooks/auth/dist/index.esm.js"); -/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-dev-runtime */ "./node_modules/react/jsx-dev-runtime.js"); -/* provided dependency */ var __react_refresh_utils__ = __webpack_require__(/*! ./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js */ "./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js"); -__webpack_require__.$Refresh$.runtime = __webpack_require__(/*! ./node_modules/react-refresh/runtime.js */ "./node_modules/react-refresh/runtime.js"); - -var _jsxFileName = "/Users/josh/Desktop/polyzero/src/components/Login.jsx", - _s = __webpack_require__.$Refresh$.signature(); - - - - - - - - - -function Login() { - _s(); - - const [email, setEmail] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(""); - const [password, setPassword] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(""); - const [user, loading, error] = (0,react_firebase_hooks_auth__WEBPACK_IMPORTED_MODULE_3__.useAuthState)(_firebase_firebase__WEBPACK_IMPORTED_MODULE_2__.auth); - const navigate = (0,react_router_dom__WEBPACK_IMPORTED_MODULE_5__.useNavigate)(); - - const logIn = e => { - e.preventDefault(); - (0,_firebase_firebase__WEBPACK_IMPORTED_MODULE_2__.logInWithEmailAndPassword)(email, password); - if (user) navigate("/"); - }; - - (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - if (loading) { - // maybe trigger a loading screen - return; - } - - if (user) navigate("/"); - }, [user, loading]); - return /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.Fragment, { - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - className: "flex items-center justify-center p-6", - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - className: "flex items-center justify-center bg-gray-100 rounded-lg shadow dark:border px-4", - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - className: "p-6 space-y-4 md:space-y-6 flex flex-col items-center justify-center", - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("h1", { - className: "text-xl font-bold leading-tight tracking-tight text-gray-900", - children: "LogIn" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 36, - columnNumber: 13 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("form", { - className: "space-y-4 md:space-y-6", - action: "#", - onSubmit: logIn, - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("label", { - for: "email", - className: "block mb-2 text-sm font-medium text-gray-900 dark:text-white", - children: "E-MAIL" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 45, - columnNumber: 17 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.TextInput, { - id: "email1", - type: "email", - placeholder: "email@email.com", - value: email, - onChange: e => setEmail(e.target.value), - required: true, - name: "email", - className: "bg-gray-50 items-center border border-gray-300 text-gray-900 rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 51, - columnNumber: 17 - }, this)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 44, - columnNumber: 15 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("label", { - for: "password", - className: "block mb-2 text-sm font-medium text-gray-900 dark:text-white", - children: "PASSWORD" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 63, - columnNumber: 17 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.TextInput, { - id: "password1", - type: "password", - required: true, - value: password, - onChange: e => setPassword(e.target.value), - name: "password", - placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022", - className: "bg-gray-50 items-center border border-gray-300 text-gray-900 rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 69, - columnNumber: 17 - }, this)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 62, - columnNumber: 15 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - className: "flex items-center justify-center", - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("button", { - type: "submit", - className: "bg-blue-600 items-center border text-white rounded-lg block w-full p-2.5", - children: "Log in" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 81, - columnNumber: 17 - }, this) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 80, - columnNumber: 15 - }, this)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 39, - columnNumber: 13 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - className: "flex items-center justify-center", - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("button", { - type: "button", - onClick: _firebase_firebase__WEBPACK_IMPORTED_MODULE_2__.registerWithGoogle, - className: "bg-blue-600 items-center border text-white rounded-lg block w-full p-2.5", - children: "Google" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 90, - columnNumber: 15 - }, this) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 89, - columnNumber: 13 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - className: "flex items-center justify-center", - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("p", { - className: "text-sm font-light text-gray-500 dark:text-gray-400", - children: ["Don't have an account yet?", " ", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(react_router_dom__WEBPACK_IMPORTED_MODULE_6__.Link, { - to: "/registration", - className: "font-medium text-blue hover:underline dark:text-primary-500", - children: "Register" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 101, - columnNumber: 17 - }, this)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 99, - columnNumber: 15 - }, this) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 98, - columnNumber: 13 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - className: "flex items-center justify-center", - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("p", { - className: "text-sm font-light text-gray-500 dark:text-gray-400" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 110, - columnNumber: 15 - }, this) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 109, - columnNumber: 13 - }, this)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 35, - columnNumber: 11 - }, this) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 34, - columnNumber: 9 - }, this) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 33, - columnNumber: 7 - }, this) - }, void 0, false); -} - -_s(Login, "IceGxTbTgTGSQnLoZr+N6VBeGRg=", false, function () { - return [react_firebase_hooks_auth__WEBPACK_IMPORTED_MODULE_3__.useAuthState, react_router_dom__WEBPACK_IMPORTED_MODULE_5__.useNavigate]; -}); - -_c = Login; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Login); - -var _c; - -__webpack_require__.$Refresh$.register(_c, "Login"); - -const $ReactRefreshModuleId$ = __webpack_require__.$Refresh$.moduleId; -const $ReactRefreshCurrentExports$ = __react_refresh_utils__.getModuleExports( - $ReactRefreshModuleId$ -); - -function $ReactRefreshModuleRuntime$(exports) { - if (true) { - let errorOverlay; - if (true) { - errorOverlay = false; - } - let testMode; - if (typeof __react_refresh_test__ !== 'undefined') { - testMode = __react_refresh_test__; - } - return __react_refresh_utils__.executeRuntime( - exports, - $ReactRefreshModuleId$, - module.hot, - errorOverlay, - testMode - ); - } -} - -if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Promise) { - $ReactRefreshCurrentExports$.then($ReactRefreshModuleRuntime$); -} else { - $ReactRefreshModuleRuntime$($ReactRefreshCurrentExports$); -} - -/***/ }), - -/***/ "./src/components/NavBar.jsx": -/*!***********************************!*\ - !*** ./src/components/NavBar.jsx ***! - \***********************************/ -/***/ ((module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var flowbite_react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flowbite-react */ "./node_modules/flowbite-react/lib/esm/index.js"); -/* harmony import */ var _firebase_firebase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../firebase/firebase */ "./src/firebase/firebase.js"); -/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react-router-dom */ "./node_modules/react-router-dom/index.js"); -/* harmony import */ var react_firebase_hooks_auth__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-firebase-hooks/auth */ "./node_modules/react-firebase-hooks/auth/dist/index.esm.js"); -/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-dev-runtime */ "./node_modules/react/jsx-dev-runtime.js"); -/* provided dependency */ var __react_refresh_utils__ = __webpack_require__(/*! ./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js */ "./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js"); -__webpack_require__.$Refresh$.runtime = __webpack_require__(/*! ./node_modules/react-refresh/runtime.js */ "./node_modules/react-refresh/runtime.js"); - -var _jsxFileName = "/Users/josh/Desktop/polyzero/src/components/NavBar.jsx", - _s = __webpack_require__.$Refresh$.signature(); - - - - - - - - - -const NavBar = () => { - _s(); - - const [userInfo, setUserInfo] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); - const [user, loading, error] = (0,react_firebase_hooks_auth__WEBPACK_IMPORTED_MODULE_3__.useAuthState)(_firebase_firebase__WEBPACK_IMPORTED_MODULE_2__.auth); - (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - if (loading) return; - if (user && !userInfo) (0,_firebase_firebase__WEBPACK_IMPORTED_MODULE_2__.getUserInfo)(user.uid).then(res => res.forEach(doc => setUserInfo(doc.data())));else if (!user) setUserInfo(null); // eslint-disable-next-line react-hooks/exhaustive-deps - }, [user, loading]); - return /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Navbar, { - rounded: true, - border: true, - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Navbar.Collapse, { - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Navbar.Link, { - href: "/", - active: true, - children: "Home" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 25, - columnNumber: 9 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Navbar.Link, { - href: "/navbars", - children: "About" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 28, - columnNumber: 9 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 24, - columnNumber: 7 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Navbar.Brand, { - href: "/", - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("img", { - src: "https://raw.githubusercontent.com/poly-zero/polyzero/main/public/images/favicon64.ico", - className: "mr-3 h-14", - alt: "PolyZero Logo" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 33, - columnNumber: 9 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("span", { - className: "self-center whitespace-nowrap text-2xl font-semibold dark:text-white", - children: "PolyZero" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 38, - columnNumber: 9 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 32, - columnNumber: 7 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - className: "flex items-center gap-4", - children: user ? /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.Fragment, { - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("p", { - className: "text-sm", - children: user.displayName - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 46, - columnNumber: 13 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Dropdown, { - arrowIcon: false, - inline: true, - label: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Avatar, { - img: "https://thispersondoesnotexist.com/image", - rounded: true, - alt: "Your profile pic" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 51, - columnNumber: 17 - }, undefined), - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Dropdown.Header, { - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("span", { - className: "block text-sm", - children: user.displayName - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 60, - columnNumber: 19 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("span", { - className: "block text-sm font-medium truncate", - children: user.email - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 61, - columnNumber: 19 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 59, - columnNumber: 17 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Dropdown.Item, { - children: "Dashboard" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 65, - columnNumber: 17 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Dropdown.Item, { - children: "Settings" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 66, - columnNumber: 17 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Dropdown.Item, { - onClick: () => (0,_firebase_firebase__WEBPACK_IMPORTED_MODULE_2__.logout)(), - children: "Log out" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 67, - columnNumber: 17 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 58, - columnNumber: 15 - }, undefined) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 47, - columnNumber: 13 - }, undefined)] - }, void 0, true) : /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.Fragment, { - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Button.Group, { - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Button, { - color: "gray", - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(react_router_dom__WEBPACK_IMPORTED_MODULE_5__.Link, { - to: "/login", - children: "Log in" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 75, - columnNumber: 17 - }, undefined) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 74, - columnNumber: 15 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Button, { - color: "gray", - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(react_router_dom__WEBPACK_IMPORTED_MODULE_5__.Link, { - to: "/registration", - children: "Register" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 78, - columnNumber: 17 - }, undefined) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 77, - columnNumber: 15 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 73, - columnNumber: 13 - }, undefined) - }, void 0, false) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 43, - columnNumber: 7 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 22, - columnNumber: 5 - }, undefined); -}; - -_s(NavBar, "saflh98UgOU2diTDTUylAJD64Z4=", false, function () { - return [react_firebase_hooks_auth__WEBPACK_IMPORTED_MODULE_3__.useAuthState]; -}); - -_c = NavBar; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NavBar); - -var _c; - -__webpack_require__.$Refresh$.register(_c, "NavBar"); - -const $ReactRefreshModuleId$ = __webpack_require__.$Refresh$.moduleId; -const $ReactRefreshCurrentExports$ = __react_refresh_utils__.getModuleExports( - $ReactRefreshModuleId$ -); - -function $ReactRefreshModuleRuntime$(exports) { - if (true) { - let errorOverlay; - if (true) { - errorOverlay = false; - } - let testMode; - if (typeof __react_refresh_test__ !== 'undefined') { - testMode = __react_refresh_test__; - } - return __react_refresh_utils__.executeRuntime( - exports, - $ReactRefreshModuleId$, - module.hot, - errorOverlay, - testMode - ); - } -} - -if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Promise) { - $ReactRefreshCurrentExports$.then($ReactRefreshModuleRuntime$); -} else { - $ReactRefreshModuleRuntime$($ReactRefreshCurrentExports$); -} - -/***/ }), - -/***/ "./src/components/PaymentsForm.jsx": -/*!*****************************************!*\ - !*** ./src/components/PaymentsForm.jsx ***! - \*****************************************/ -/***/ ((module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var _PaymentsForm_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PaymentsForm.css */ "./src/components/PaymentsForm.css"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react/jsx-dev-runtime */ "./node_modules/react/jsx-dev-runtime.js"); -/* provided dependency */ var __react_refresh_utils__ = __webpack_require__(/*! ./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js */ "./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js"); -__webpack_require__.$Refresh$.runtime = __webpack_require__(/*! ./node_modules/react-refresh/runtime.js */ "./node_modules/react-refresh/runtime.js"); - -var _jsxFileName = "/Users/josh/Desktop/polyzero/src/components/PaymentsForm.jsx", - _s = __webpack_require__.$Refresh$.signature(); - - - - - -const PaymentsForm = () => { - _s(); - - const [cvv, setCvv] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(""); - const [name, setName] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(""); - const [cardNumber, setcardNumber] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(""); - const [expiry, setExpiry] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(""); - - const handleSubmit = async e => { - e.preventDefault(); - const body = { - name, - cardNumber, - expiry, - cvv - }; - - try { - await fetch("/", { - method: "POST", - headers: { - "Content-Type": "application/json" - }, - body: JSON.stringify(body) - }); - window.location = "/"; - } catch (error) { - console.log(error); - } - }; - - return /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)(react__WEBPACK_IMPORTED_MODULE_1__.Fragment, { - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("h1", { - class: "mb-4 text-3xl font-extrabold text-gray-900 dark:text-white md:text-5xl lg:text-6xl text-center mt-10", - children: ["Want to", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("span", { - class: "text-transparent bg-clip-text bg-gradient-to-r to-emerald-600 from-sky-400", - children: [" ", "save the planet?"] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 29, - columnNumber: 9 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 27, - columnNumber: 7 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("div", { - onSubmit: handleSubmit, - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("div", { - className: "flex justify-center items-center ", - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("div", { - className: "h-auto w-80 bg-white p-3 rounded-lg", - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("p", { - className: "text-xl font-semibold", - children: "Payment Details" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 37, - columnNumber: 13 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("div", { - className: "input_text mt-6 relative", - children: [" ", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("span", { - className: "absolute left-0 text-sm -top-4", - children: "Cardholder Name" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 40, - columnNumber: 15 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("input", { - type: "text", - className: "h-12 pl-7 outline-none px-2 focus:border-blue-900 transition-all w-full border-b rounded-lg", - placeholder: "Name on card", - onChange: e => setName(e.target.value) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 43, - columnNumber: 15 - }, undefined), " ", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("i", { - className: "absolute left-2 top-4 text-gray-400 fa fa-user" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 49, - columnNumber: 15 - }, undefined), " "] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 38, - columnNumber: 13 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("div", { - className: "input_text mt-8 relative", - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("input", { - type: "text", - className: "h-12 pl-7 outline-none px-2 focus:border-blue-900 transition-all w-full border-b rounded-lg", - placeholder: "0000 0000 0000 0000", - "data-slots": "0", - "data-accept": "\\d", - size: "19", - onChange: e => setcardNumber(e.target.value) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 53, - columnNumber: 15 - }, undefined), " ", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("span", { - className: "absolute left-0 text-sm -top-4", - children: "Card Number" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 62, - columnNumber: 15 - }, undefined), " ", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("i", { - className: "absolute left-2 top-[14px] text-gray-400 text-sm fa fa-credit-card" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 65, - columnNumber: 15 - }, undefined), " "] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 51, - columnNumber: 13 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("div", { - className: "mt-8 flex gap-5 ", - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("div", { - className: "input_text relative w-full", - children: [" ", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("input", { - type: "text", - className: "h-12 pl-7 outline-none px-2 focus:border-blue-900 transition-all w-full border-b rounded-lg", - placeholder: "mm/yyyy", - "data-slots": "my", - onChange: e => setExpiry(e.target.value) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 70, - columnNumber: 17 - }, undefined), " ", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("span", { - className: "absolute left-0 text-sm -top-4", - children: "Expiry" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 77, - columnNumber: 17 - }, undefined), " ", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("i", { - className: "absolute left-2 top-4 text-gray-400 fa fa-calendar-o" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 78, - columnNumber: 17 - }, undefined), " "] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 68, - columnNumber: 15 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("div", { - className: "input_text relative w-full", - children: [" ", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("input", { - type: "text", - className: "h-12 pl-7 outline-none px-2 focus:border-blue-900 transition-all w-full border-b rounded-lg", - placeholder: "000", - "data-slots": "0", - "data-accept": "\\d", - size: "3", - onChange: e => setCvv(e.target.value) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 82, - columnNumber: 17 - }, undefined), " ", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("span", { - className: "absolute left-0 text-sm -top-4", - children: "CVV" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 91, - columnNumber: 17 - }, undefined), " ", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("i", { - className: "absolute left-2 top-4 text-gray-400 fa fa-lock" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 92, - columnNumber: 17 - }, undefined), " "] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 80, - columnNumber: 15 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 67, - columnNumber: 13 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("p", { - className: "text-lg text-center mt-4 text-gray-600 font-semibold", - children: "Payment amount:\xA51298" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 95, - columnNumber: 13 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("div", { - className: "flex justify-center mt-4", - children: [" ", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("button", { - className: "outline-none pay h-12 bg-blue-500 text-white mb-3 mr-1 hover:bg-orange-700 rounded-lg w-1/2 cursor-pointer transition-all", - path: "/tiers", - onClick: () => window.location.href = "/tiers", - children: "Back" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 100, - columnNumber: 15 - }, undefined), " ", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("br", {}, void 0, false, { - fileName: _jsxFileName, - lineNumber: 107, - columnNumber: 15 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxDEV)("button", { - className: "outline-none pay h-12 bg-blue-500 text-white mb-3 hover:bg-orange-700 rounded-lg w-1/2 cursor-pointer transition-all", - children: "Pay" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 108, - columnNumber: 15 - }, undefined), " "] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 98, - columnNumber: 13 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 36, - columnNumber: 11 - }, undefined) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 35, - columnNumber: 9 - }, undefined) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 34, - columnNumber: 7 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 26, - columnNumber: 5 - }, undefined); -}; - -_s(PaymentsForm, "FH7fAdn6FIm2Bqfwn2PdDUyAeKs="); - -_c = PaymentsForm; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PaymentsForm); - -var _c; - -__webpack_require__.$Refresh$.register(_c, "PaymentsForm"); - -const $ReactRefreshModuleId$ = __webpack_require__.$Refresh$.moduleId; -const $ReactRefreshCurrentExports$ = __react_refresh_utils__.getModuleExports( - $ReactRefreshModuleId$ -); - -function $ReactRefreshModuleRuntime$(exports) { - if (true) { - let errorOverlay; - if (true) { - errorOverlay = false; - } - let testMode; - if (typeof __react_refresh_test__ !== 'undefined') { - testMode = __react_refresh_test__; - } - return __react_refresh_utils__.executeRuntime( - exports, - $ReactRefreshModuleId$, - module.hot, - errorOverlay, - testMode - ); - } -} - -if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Promise) { - $ReactRefreshCurrentExports$.then($ReactRefreshModuleRuntime$); -} else { - $ReactRefreshModuleRuntime$($ReactRefreshCurrentExports$); -} - -/***/ }), - -/***/ "./src/components/Registration.jsx": -/*!*****************************************!*\ - !*** ./src/components/Registration.jsx ***! - \*****************************************/ -/***/ ((module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var flowbite_react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flowbite-react */ "./node_modules/flowbite-react/lib/esm/index.js"); -/* harmony import */ var react_firebase_hooks_auth__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-firebase-hooks/auth */ "./node_modules/react-firebase-hooks/auth/dist/index.esm.js"); -/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react-router-dom */ "./node_modules/react-router/index.js"); -/* harmony import */ var _firebase_firebase__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../firebase/firebase */ "./src/firebase/firebase.js"); -/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-dev-runtime */ "./node_modules/react/jsx-dev-runtime.js"); -/* provided dependency */ var __react_refresh_utils__ = __webpack_require__(/*! ./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js */ "./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js"); -__webpack_require__.$Refresh$.runtime = __webpack_require__(/*! ./node_modules/react-refresh/runtime.js */ "./node_modules/react-refresh/runtime.js"); - -var _jsxFileName = "/Users/josh/Desktop/polyzero/src/components/Registration.jsx", - _s = __webpack_require__.$Refresh$.signature(); - - - - - - - - -function Registration() { - _s(); - - const [email, setEmail] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(""); - const [password, setPassword] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(""); - const [name, setName] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(""); - const [user, loading, error] = (0,react_firebase_hooks_auth__WEBPACK_IMPORTED_MODULE_2__.useAuthState)(_firebase_firebase__WEBPACK_IMPORTED_MODULE_3__.auth); - let navigate = (0,react_router_dom__WEBPACK_IMPORTED_MODULE_5__.useNavigate)(); - - const register = e => { - e.preventDefault(); - if (!name) alert("Please enter name"); - (0,_firebase_firebase__WEBPACK_IMPORTED_MODULE_3__.registerWithEmailAndPassword)(name, email, password); - }; - - (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - if (loading) return; - if (user) navigate("/"); - }, [user, loading]); - return /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("form", { - className: "flex flex-col gap-4", - onSubmit: register, - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - className: "mb-2 block", - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Label, { - htmlFor: "user1", - value: "Your User Name" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 35, - columnNumber: 13 - }, this) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 34, - columnNumber: 11 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.TextInput, { - id: "user1", - type: "text", - placeholder: "username", - required: true, - value: name, - onChange: e => setName(e.target.value) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 37, - columnNumber: 11 - }, this)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 33, - columnNumber: 9 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - className: "mb-2 block", - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Label, { - htmlFor: "email1", - value: "Your email" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 48, - columnNumber: 13 - }, this) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 47, - columnNumber: 11 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.TextInput, { - id: "email1", - type: "email", - placeholder: "name@flowbite.com", - required: true, - value: email, - onChange: e => setEmail(e.target.value) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 50, - columnNumber: 11 - }, this)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 46, - columnNumber: 9 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - className: "mb-2 block", - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Label, { - htmlFor: "password1", - value: "Your password" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 61, - columnNumber: 13 - }, this) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 60, - columnNumber: 11 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.TextInput, { - id: "password1", - type: "password", - required: true, - value: password, - onChange: e => setPassword(e.target.value) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 63, - columnNumber: 11 - }, this)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 59, - columnNumber: 9 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - className: "flex items-center gap-2", - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Checkbox, { - id: "remember" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 72, - columnNumber: 11 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Label, { - htmlFor: "remember", - children: "Remember me" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 73, - columnNumber: 11 - }, this)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 71, - columnNumber: 9 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Button, { - type: "submit", - children: "Submit" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 75, - columnNumber: 9 - }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_1__.Button, { - type: "submit", - onClick: _firebase_firebase__WEBPACK_IMPORTED_MODULE_3__.registerWithGoogle, - children: "Google" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 76, - columnNumber: 9 - }, this)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 32, - columnNumber: 7 - }, this) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 31, - columnNumber: 5 - }, this); -} - -_s(Registration, "s1jk6Pklvq1hiGfy1RYIR0NNHug=", false, function () { - return [react_firebase_hooks_auth__WEBPACK_IMPORTED_MODULE_2__.useAuthState, react_router_dom__WEBPACK_IMPORTED_MODULE_5__.useNavigate]; -}); - -_c = Registration; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Registration); - -var _c; - -__webpack_require__.$Refresh$.register(_c, "Registration"); - -const $ReactRefreshModuleId$ = __webpack_require__.$Refresh$.moduleId; -const $ReactRefreshCurrentExports$ = __react_refresh_utils__.getModuleExports( - $ReactRefreshModuleId$ -); - -function $ReactRefreshModuleRuntime$(exports) { - if (true) { - let errorOverlay; - if (true) { - errorOverlay = false; - } - let testMode; - if (typeof __react_refresh_test__ !== 'undefined') { - testMode = __react_refresh_test__; - } - return __react_refresh_utils__.executeRuntime( - exports, - $ReactRefreshModuleId$, - module.hot, - errorOverlay, - testMode - ); - } -} - -if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Promise) { - $ReactRefreshCurrentExports$.then($ReactRefreshModuleRuntime$); -} else { - $ReactRefreshModuleRuntime$($ReactRefreshCurrentExports$); -} - -/***/ }), - -/***/ "./src/components/Results.jsx": -/*!************************************!*\ - !*** ./src/components/Results.jsx ***! - \************************************/ -/***/ ((module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-dev-runtime */ "./node_modules/react/jsx-dev-runtime.js"); -/* provided dependency */ var __react_refresh_utils__ = __webpack_require__(/*! ./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js */ "./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js"); -__webpack_require__.$Refresh$.runtime = __webpack_require__(/*! ./node_modules/react-refresh/runtime.js */ "./node_modules/react-refresh/runtime.js"); - -var _jsxFileName = "/Users/josh/Desktop/polyzero/src/components/Results.jsx"; - - -const Results = _ref => { - let { - result - } = _ref; - const results = { - "🐕 Small": "103.6kg", - "🐎 Medium": "207.2kg", - "🐘 High": "310.8kg" - }; - return /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV)("div", { - id: "results", - className: "flex justify-center items-center ", - children: results[result] ? /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV)("h1", { - className: "mb-4 text-3xl font-extrabold text-gray-900 dark:text-white md:text-5xl lg:text-6xl text-center", - children: ["You consume approximately", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV)("span", { - className: "text-transparent bg-clip-text bg-gradient-to-r to-emerald-600 from-sky-400", - children: ` ${results[result]} ` - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 13, - columnNumber: 11 - }, undefined), "of CO2e"] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 11, - columnNumber: 9 - }, undefined) : "" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 9, - columnNumber: 5 - }, undefined); -}; - -_c = Results; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Results); - -var _c; - -__webpack_require__.$Refresh$.register(_c, "Results"); - -const $ReactRefreshModuleId$ = __webpack_require__.$Refresh$.moduleId; -const $ReactRefreshCurrentExports$ = __react_refresh_utils__.getModuleExports( - $ReactRefreshModuleId$ -); - -function $ReactRefreshModuleRuntime$(exports) { - if (true) { - let errorOverlay; - if (true) { - errorOverlay = false; - } - let testMode; - if (typeof __react_refresh_test__ !== 'undefined') { - testMode = __react_refresh_test__; - } - return __react_refresh_utils__.executeRuntime( - exports, - $ReactRefreshModuleId$, - module.hot, - errorOverlay, - testMode - ); - } -} - -if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Promise) { - $ReactRefreshCurrentExports$.then($ReactRefreshModuleRuntime$); -} else { - $ReactRefreshModuleRuntime$($ReactRefreshCurrentExports$); -} - -/***/ }), - -/***/ "./src/components/TierCard.jsx": -/*!*************************************!*\ - !*** ./src/components/TierCard.jsx ***! - \*************************************/ -/***/ ((module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var flowbite_react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! flowbite-react */ "./node_modules/flowbite-react/lib/esm/index.js"); -/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-router-dom */ "./node_modules/react-router/index.js"); -/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-dev-runtime */ "./node_modules/react/jsx-dev-runtime.js"); -/* provided dependency */ var __react_refresh_utils__ = __webpack_require__(/*! ./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js */ "./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js"); -__webpack_require__.$Refresh$.runtime = __webpack_require__(/*! ./node_modules/react-refresh/runtime.js */ "./node_modules/react-refresh/runtime.js"); - -var _jsxFileName = "/Users/josh/Desktop/polyzero/src/components/TierCard.jsx", - _s = __webpack_require__.$Refresh$.signature(); - - - - - -const TierCard = _ref => { - _s(); - - let { - title, - description, - cost, - image, - setTier - } = _ref; - const navigateTo = (0,react_router_dom__WEBPACK_IMPORTED_MODULE_2__.useNavigate)(); - - function assignTier() { - setTier({ - image: image, - title: title, - description: description, - cost: cost - }); - navigateTo("/confirmation"); - } - - return /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("div", { - className: "transition ease-out duration-300 hover:-translate-y-1 hover:scale-105", - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_0__.Card, { - imgSrc: image, - imgAlt: "", - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("h2", { - className: "text-4xl font-bold tracking-tight text-gray-900 dark:text-white", - children: title - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 20, - columnNumber: 9 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("p", { - className: "text-lg font-normal text-gray-700 dark:text-gray-400", - children: description - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 23, - columnNumber: 9 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("h3", { - className: "text-2xl font-bold tracking-tight text-gray-900 dark:text-white", - children: cost - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 26, - columnNumber: 9 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("button", { - class: "inline-flex items-center py-2 px-3 text-sm font-medium justify-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800", - onClick: assignTier, - children: "Select" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 29, - columnNumber: 9 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 19, - columnNumber: 7 - }, undefined) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 18, - columnNumber: 5 - }, undefined); -}; - -_s(TierCard, "ymtrZ8G6aCOC+j9g/5vfaOOqM8M=", false, function () { - return [react_router_dom__WEBPACK_IMPORTED_MODULE_2__.useNavigate]; -}); - -_c = TierCard; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TierCard); - -var _c; - -__webpack_require__.$Refresh$.register(_c, "TierCard"); - -const $ReactRefreshModuleId$ = __webpack_require__.$Refresh$.moduleId; -const $ReactRefreshCurrentExports$ = __react_refresh_utils__.getModuleExports( - $ReactRefreshModuleId$ -); - -function $ReactRefreshModuleRuntime$(exports) { - if (true) { - let errorOverlay; - if (true) { - errorOverlay = false; - } - let testMode; - if (typeof __react_refresh_test__ !== 'undefined') { - testMode = __react_refresh_test__; - } - return __react_refresh_utils__.executeRuntime( - exports, - $ReactRefreshModuleId$, - module.hot, - errorOverlay, - testMode - ); - } -} - -if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Promise) { - $ReactRefreshCurrentExports$.then($ReactRefreshModuleRuntime$); -} else { - $ReactRefreshModuleRuntime$($ReactRefreshCurrentExports$); -} - -/***/ }), - -/***/ "./src/components/Tiers.jsx": -/*!**********************************!*\ - !*** ./src/components/Tiers.jsx ***! - \**********************************/ -/***/ ((module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var _TierCard__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TierCard */ "./src/components/TierCard.jsx"); -/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-dev-runtime */ "./node_modules/react/jsx-dev-runtime.js"); -/* provided dependency */ var __react_refresh_utils__ = __webpack_require__(/*! ./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js */ "./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js"); -__webpack_require__.$Refresh$.runtime = __webpack_require__(/*! ./node_modules/react-refresh/runtime.js */ "./node_modules/react-refresh/runtime.js"); - -var _jsxFileName = "/Users/josh/Desktop/polyzero/src/components/Tiers.jsx"; - - - -const Tiers = _ref => { - let { - setTier - } = _ref; - const tierCards = [{ - title: "Supporter", - description: "Support for 1 year", - cost: "¥518", - image: "https://picsum.photos/800" - }, { - title: "Ally", - description: "Support for 5 years", - cost: "¥2,590", - image: "https://picsum.photos/800" - }, { - title: "Defender", - description: "Support for 10 years", - cost: "¥5180", - image: "https://picsum.photos/800" - }, { - title: "Hero", - description: "Support for a lifetime", - cost: "¥16,576", - image: "https://picsum.photos/800" - }]; - return /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("div", { - className: "flex flex-col flex-grow mt-8 items-center gap-6 md:items-center md:justify-center md:mt-0 md:gap-10", - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("div", { - className: "w-1/2 flex justify-center items-center", - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("h1", { - class: "mb-4 text-3xl font-extrabold text-gray-900 dark:text-white md:text-5xl lg:text-6xl text-center", - children: ["Want to", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("span", { - class: "text-transparent bg-clip-text bg-gradient-to-r to-emerald-600 from-sky-400", - children: [" ", "save the planet?"] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 36, - columnNumber: 11 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 34, - columnNumber: 9 - }, undefined) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 33, - columnNumber: 7 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("div", { - className: "flex flex-col gap-8 w-3/4 justify-center items-center md:flex-row md:gap-14 md:w-11/12", - children: tierCards.map(tier => { - return /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)(_TierCard__WEBPACK_IMPORTED_MODULE_0__["default"], { - title: tier.title, - description: tier.description, - cost: tier.cost, - image: tier.image, - setTier: setTier - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 45, - columnNumber: 13 - }, undefined); - }) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 42, - columnNumber: 7 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 32, - columnNumber: 5 - }, undefined); -}; - -_c = Tiers; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Tiers); - -var _c; - -__webpack_require__.$Refresh$.register(_c, "Tiers"); - -const $ReactRefreshModuleId$ = __webpack_require__.$Refresh$.moduleId; -const $ReactRefreshCurrentExports$ = __react_refresh_utils__.getModuleExports( - $ReactRefreshModuleId$ -); - -function $ReactRefreshModuleRuntime$(exports) { - if (true) { - let errorOverlay; - if (true) { - errorOverlay = false; - } - let testMode; - if (typeof __react_refresh_test__ !== 'undefined') { - testMode = __react_refresh_test__; - } - return __react_refresh_utils__.executeRuntime( - exports, - $ReactRefreshModuleId$, - module.hot, - errorOverlay, - testMode - ); - } -} - -if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Promise) { - $ReactRefreshCurrentExports$.then($ReactRefreshModuleRuntime$); -} else { - $ReactRefreshModuleRuntime$($ReactRefreshCurrentExports$); -} - -/***/ }), - -/***/ "./src/firebase/firebase.js": -/*!**********************************!*\ - !*** ./src/firebase/firebase.js ***! - \**********************************/ -/***/ ((module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "auth": () => (/* binding */ auth), -/* harmony export */ "db": () => (/* binding */ db), -/* harmony export */ "getUserInfo": () => (/* binding */ getUserInfo), -/* harmony export */ "logInWithEmailAndPassword": () => (/* binding */ logInWithEmailAndPassword), -/* harmony export */ "logout": () => (/* binding */ logout), -/* harmony export */ "registerWithEmailAndPassword": () => (/* binding */ registerWithEmailAndPassword), -/* harmony export */ "registerWithGoogle": () => (/* binding */ registerWithGoogle), -/* harmony export */ "sendPasswordReset": () => (/* binding */ sendPasswordReset) -/* harmony export */ }); -/* harmony import */ var firebase_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! firebase/app */ "./node_modules/firebase/app/dist/index.esm.js"); -/* harmony import */ var firebase_auth__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! firebase/auth */ "./node_modules/firebase/auth/dist/index.esm.js"); -/* harmony import */ var firebase_firestore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! firebase/firestore */ "./node_modules/firebase/firestore/dist/index.esm.js"); -/* provided dependency */ var __react_refresh_utils__ = __webpack_require__(/*! ./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js */ "./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js"); -__webpack_require__.$Refresh$.runtime = __webpack_require__(/*! ./node_modules/react-refresh/runtime.js */ "./node_modules/react-refresh/runtime.js"); - -// Import the functions you need from the SDKs you need - - - // TODO: Add SDKs for Firebase products that you want to use -// https://firebase.google.com/docs/web/setup#available-libraries -// Your web app's Firebase configuration - -const firebaseConfig = { - apiKey: "AIzaSyChf-PyMiVObm6krhwzetP4lUKee4vzvrQ", - authDomain: "polyzero-37efc.firebaseapp.com", - projectId: "polyzero-37efc", - storageBucket: "polyzero-37efc.appspot.com", - messagingSenderId: "63330640151", - appId: "1:63330640151:web:0677a82628cba788d91752" -}; // Initialize Firebase - -const app = (0,firebase_app__WEBPACK_IMPORTED_MODULE_0__.initializeApp)(firebaseConfig); -const auth = (0,firebase_auth__WEBPACK_IMPORTED_MODULE_1__.getAuth)(app); -const db = (0,firebase_firestore__WEBPACK_IMPORTED_MODULE_2__.getFirestore)(app); -const googleProvider = new firebase_auth__WEBPACK_IMPORTED_MODULE_1__.GoogleAuthProvider(); - -const registerWithGoogle = async () => { - try { - const res = await (0,firebase_auth__WEBPACK_IMPORTED_MODULE_1__.signInWithPopup)(auth, googleProvider); - const user = res.user; - const q = (0,firebase_firestore__WEBPACK_IMPORTED_MODULE_2__.query)((0,firebase_firestore__WEBPACK_IMPORTED_MODULE_2__.collection)(db, "users"), (0,firebase_firestore__WEBPACK_IMPORTED_MODULE_2__.where)("uid", "==", user.uid)); - const docs = await (0,firebase_firestore__WEBPACK_IMPORTED_MODULE_2__.getDocs)(q); - - if (docs.docs.length === 0) { - await (0,firebase_firestore__WEBPACK_IMPORTED_MODULE_2__.addDoc)((0,firebase_firestore__WEBPACK_IMPORTED_MODULE_2__.collection)(db, "users"), { - uid: user.uid, - name: user.displayName, - authProvider: "google", - email: user.email, - badge: [0], - footprint: 0 - }); - } - } catch (err) { - console.error(err); - alert(err.message); - } -}; - -const registerWithEmailAndPassword = async (name, email, password) => { - try { - const res = await (0,firebase_auth__WEBPACK_IMPORTED_MODULE_1__.createUserWithEmailAndPassword)(auth, email, password); - const user = res.user; - await (0,firebase_firestore__WEBPACK_IMPORTED_MODULE_2__.addDoc)((0,firebase_firestore__WEBPACK_IMPORTED_MODULE_2__.collection)(db, "users"), { - uid: user.uid, - name, - authProvider: "local", - email, - badge: [0], - footprint: 0 - }); - } catch (err) { - console.error(err); - alert(err.message); - } -}; - -const logInWithEmailAndPassword = async (email, password) => { - try { - await (0,firebase_auth__WEBPACK_IMPORTED_MODULE_1__.signInWithEmailAndPassword)(auth, email, password); - } catch (err) { - console.error(err); - alert(err.message); - } -}; - -const getUserInfo = async userId => { - try { - const q = (0,firebase_firestore__WEBPACK_IMPORTED_MODULE_2__.query)((0,firebase_firestore__WEBPACK_IMPORTED_MODULE_2__.collection)(db, "users"), (0,firebase_firestore__WEBPACK_IMPORTED_MODULE_2__.where)("uid", "==", userId)); - const docs = await (0,firebase_firestore__WEBPACK_IMPORTED_MODULE_2__.getDocs)(q); - return docs; - } catch (err) { - console.error(err); - alert(err.message); - } -}; - -const sendPasswordReset = async email => { - try { - await (0,firebase_auth__WEBPACK_IMPORTED_MODULE_1__.sendPasswordResetEmail)(auth, email); - alert("Password reset link sent!"); - } catch (err) { - console.error(err); - alert(err.message); - } -}; - -const logout = () => { - (0,firebase_auth__WEBPACK_IMPORTED_MODULE_1__.signOut)(auth); -}; - - - -const $ReactRefreshModuleId$ = __webpack_require__.$Refresh$.moduleId; -const $ReactRefreshCurrentExports$ = __react_refresh_utils__.getModuleExports( - $ReactRefreshModuleId$ -); - -function $ReactRefreshModuleRuntime$(exports) { - if (true) { - let errorOverlay; - if (true) { - errorOverlay = false; - } - let testMode; - if (typeof __react_refresh_test__ !== 'undefined') { - testMode = __react_refresh_test__; - } - return __react_refresh_utils__.executeRuntime( - exports, - $ReactRefreshModuleId$, - module.hot, - errorOverlay, - testMode - ); - } -} - -if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Promise) { - $ReactRefreshCurrentExports$.then($ReactRefreshModuleRuntime$); -} else { - $ReactRefreshModuleRuntime$($ReactRefreshCurrentExports$); -} - -/***/ }), - -/***/ "./src/index.jsx": -/*!***********************!*\ - !*** ./src/index.jsx ***! - \***********************/ -/***/ ((module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var react_dom_client__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom/client */ "./node_modules/react-dom/client.js"); -/* harmony import */ var _App__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./App */ "./src/App.jsx"); -/* harmony import */ var _index_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./index.css */ "./src/index.css"); -/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-dev-runtime */ "./node_modules/react/jsx-dev-runtime.js"); -/* provided dependency */ var __react_refresh_utils__ = __webpack_require__(/*! ./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js */ "./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js"); -__webpack_require__.$Refresh$.runtime = __webpack_require__(/*! ./node_modules/react-refresh/runtime.js */ "./node_modules/react-refresh/runtime.js"); - -var _jsxFileName = "/Users/josh/Desktop/polyzero/src/index.jsx"; - - - - - -const root = react_dom_client__WEBPACK_IMPORTED_MODULE_1__.createRoot(document.getElementById("root")); -root.render( /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)((react__WEBPACK_IMPORTED_MODULE_0___default().StrictMode), { - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(_App__WEBPACK_IMPORTED_MODULE_2__["default"], {}, void 0, false, { - fileName: _jsxFileName, - lineNumber: 9, - columnNumber: 5 - }, undefined) -}, void 0, false, { - fileName: _jsxFileName, - lineNumber: 8, - columnNumber: 3 -}, undefined)); - -const $ReactRefreshModuleId$ = __webpack_require__.$Refresh$.moduleId; -const $ReactRefreshCurrentExports$ = __react_refresh_utils__.getModuleExports( - $ReactRefreshModuleId$ -); - -function $ReactRefreshModuleRuntime$(exports) { - if (true) { - let errorOverlay; - if (true) { - errorOverlay = false; - } - let testMode; - if (typeof __react_refresh_test__ !== 'undefined') { - testMode = __react_refresh_test__; - } - return __react_refresh_utils__.executeRuntime( - exports, - $ReactRefreshModuleId$, - module.hot, - errorOverlay, - testMode - ); - } -} - -if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Promise) { - $ReactRefreshCurrentExports$.then($ReactRefreshModuleRuntime$); -} else { - $ReactRefreshModuleRuntime$($ReactRefreshCurrentExports$); -} - -/***/ }), - -/***/ "./src/pages/Footprint.jsx": -/*!*********************************!*\ - !*** ./src/pages/Footprint.jsx ***! - \*********************************/ -/***/ ((module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var _components_FootprintCard__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/FootprintCard */ "./src/components/FootprintCard.jsx"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _components_Results__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/Results */ "./src/components/Results.jsx"); -/* harmony import */ var flowbite_react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! flowbite-react */ "./node_modules/flowbite-react/lib/esm/index.js"); -/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react-router-dom */ "./node_modules/react-router/index.js"); -/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-dev-runtime */ "./node_modules/react/jsx-dev-runtime.js"); -/* provided dependency */ var __react_refresh_utils__ = __webpack_require__(/*! ./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js */ "./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js"); -__webpack_require__.$Refresh$.runtime = __webpack_require__(/*! ./node_modules/react-refresh/runtime.js */ "./node_modules/react-refresh/runtime.js"); - -var _jsxFileName = "/Users/josh/Desktop/polyzero/src/pages/Footprint.jsx", - _s = __webpack_require__.$Refresh$.signature(); - - - - - - - - -const Footprint = () => { - _s(); - - const [result, setResult] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(""); - const [change, setChange] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false); - const navigateTo = (0,react_router_dom__WEBPACK_IMPORTED_MODULE_5__.useNavigate)(); - const plasticFootprintEstimation = [{ - title: "🐕 Small", - grocery: "I grow most of my own vegetables, or primarily buy packaging-free fruits & vegetables", - takeOut: "I cook at home most meals, and rarely order take-out", - petBottles: "I very rarely use drink vending machines", - disposables: "I make an effort to avoid plastic packaging on the items I choose from the supermarket" - }, { - title: "🐎 Medium", - grocery: "I try to avoid single-serving sizes and buy bulk-size and minimally packaged products whenever possible.", - takeOut: "I order takeout or delivery 1-2 times per month or less. ", - petBottles: "I buy no more than 1-2 drinks in PET bottles per month.", - disposables: "I carry reusable bags, water bottle/cup, cutlery, straw, etc. to avoid disposables." - }, { - title: "🐘 High", - grocery: "I appreciate that my supermarket thoroughly packages foods in plastic for freshness and sanitation", - takeOut: "I order delivery (such as Uber Eats) 1-2 times per week or more", - petBottles: "I drink 1-2 (or more) PET bottle drinks per week from vending machines, convenience stores, etc.", - disposables: "I often receive a plastic bag and/or disposable utensils at the cash register" - }]; - return /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - className: "flex flex-col flex-grow mt-8 items-center gap-6 md:items-center md:justify-center md:mt-0 md:gap-10", - children: [!result ? /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("h1", { - className: "mb-4 text-3xl font-extrabold text-gray-900 dark:text-white md:text-5xl lg:text-6xl text-center", - children: ["What is your ", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("span", { - children: " " - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 49, - columnNumber: 24 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("span", { - className: "text-transparent bg-clip-text bg-gradient-to-r to-emerald-600 from-sky-400", - children: "plastic footprint" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 50, - columnNumber: 11 - }, undefined), "?"] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 48, - columnNumber: 9 - }, undefined) : /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(_components_Results__WEBPACK_IMPORTED_MODULE_2__["default"], { - result: result - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 56, - columnNumber: 9 - }, undefined), !result ? /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)("div", { - className: "flex flex-col gap-8 w-3/4 justify-center items-center md:flex-row md:gap-14 md:w-full", - children: plasticFootprintEstimation.map(card => { - return /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(_components_FootprintCard__WEBPACK_IMPORTED_MODULE_0__["default"], { - title: card.title, - grocery: card.grocery, - takeOut: card.takeOut, - petBottles: card.petBottles, - disposables: card.disposables, - buttonText: "Select", - setResult: setResult, - change: setChange - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 64, - columnNumber: 15 - }, undefined); - }) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 61, - columnNumber: 9 - }, undefined) : /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_3__.Button, { - size: "xl", - onClick: () => navigateTo("/tiers"), - children: "Start offsetting" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 78, - columnNumber: 9 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 46, - columnNumber: 5 - }, undefined); -}; - -_s(Footprint, "a4iAuax1ZCXfIhycTFnX6ag5fyQ=", false, function () { - return [react_router_dom__WEBPACK_IMPORTED_MODULE_5__.useNavigate]; -}); - -_c = Footprint; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Footprint); - -var _c; - -__webpack_require__.$Refresh$.register(_c, "Footprint"); - -const $ReactRefreshModuleId$ = __webpack_require__.$Refresh$.moduleId; -const $ReactRefreshCurrentExports$ = __react_refresh_utils__.getModuleExports( - $ReactRefreshModuleId$ -); - -function $ReactRefreshModuleRuntime$(exports) { - if (true) { - let errorOverlay; - if (true) { - errorOverlay = false; - } - let testMode; - if (typeof __react_refresh_test__ !== 'undefined') { - testMode = __react_refresh_test__; - } - return __react_refresh_utils__.executeRuntime( - exports, - $ReactRefreshModuleId$, - module.hot, - errorOverlay, - testMode - ); - } -} - -if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Promise) { - $ReactRefreshCurrentExports$.then($ReactRefreshModuleRuntime$); -} else { - $ReactRefreshModuleRuntime$($ReactRefreshCurrentExports$); -} - -/***/ }), - -/***/ "./src/pages/OrderConfirmation.jsx": -/*!*****************************************!*\ - !*** ./src/pages/OrderConfirmation.jsx ***! - \*****************************************/ -/***/ ((module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var flowbite_react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! flowbite-react */ "./node_modules/flowbite-react/lib/esm/index.js"); -/* harmony import */ var _assets_socialMediaIcons_icons8_facebook_svg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../assets/socialMediaIcons/icons8-facebook.svg */ "./src/assets/socialMediaIcons/icons8-facebook.svg"); -/* harmony import */ var _assets_socialMediaIcons_icons8_instagram_svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../assets/socialMediaIcons/icons8-instagram.svg */ "./src/assets/socialMediaIcons/icons8-instagram.svg"); -/* harmony import */ var _assets_socialMediaIcons_icons8_linkedin_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../assets/socialMediaIcons/icons8-linkedin.svg */ "./src/assets/socialMediaIcons/icons8-linkedin.svg"); -/* harmony import */ var _assets_socialMediaIcons_icons8_twitter_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../assets/socialMediaIcons/icons8-twitter.svg */ "./src/assets/socialMediaIcons/icons8-twitter.svg"); -/* harmony import */ var _assets_socialMediaIcons_icons8_line_svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../assets/socialMediaIcons/icons8-line.svg */ "./src/assets/socialMediaIcons/icons8-line.svg"); -/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-dev-runtime */ "./node_modules/react/jsx-dev-runtime.js"); -/* provided dependency */ var __react_refresh_utils__ = __webpack_require__(/*! ./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js */ "./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js"); -__webpack_require__.$Refresh$.runtime = __webpack_require__(/*! ./node_modules/react-refresh/runtime.js */ "./node_modules/react-refresh/runtime.js"); - -var _jsxFileName = "/Users/josh/Desktop/polyzero/src/pages/OrderConfirmation.jsx"; - - - - - - - - -const OrderConfirmation = _ref => { - let { - tier - } = _ref; - return /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("div", { - className: "flex flex-col flex-grow items-center justify-center", - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("div", { - className: "flex flex-col items-center w-1/2", - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("h1", { - class: "text-3xl font-extrabold text-gray-900 dark:text-white md:text-5xl lg:text-6xl text-center", - children: ["Thank you for supporting,", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("span", { - class: "text-transparent bg-clip-text bg-gradient-to-r to-emerald-600 from-sky-400", - children: [" ", "Zach"] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 14, - columnNumber: 11 - }, undefined), "!"] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 12, - columnNumber: 9 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("p", { - className: "w-1/2 my-8 text-xl font-normal text-center text-gray-500 dark:text-gray-400", - children: "Here at PolyZero we focus on markets where technology, innovation, and capital can unlock long-term value and drive economic growth." - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 20, - columnNumber: 9 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 11, - columnNumber: 7 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("div", { - className: "flex rounded-lg bg-slate-200 items-center px-20 py-8 gap-24", - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("div", { - className: "max-w-xs", - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)(flowbite_react__WEBPACK_IMPORTED_MODULE_0__.Card, { - imgSrc: tier.image, - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("h5", { - className: "text-2xl font-bold tracking-tight text-gray-900 dark:text-white", - children: tier.title - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 29, - columnNumber: 13 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("p", { - className: "font-normal text-gray-700 dark:text-gray-400", - children: tier.description - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 32, - columnNumber: 13 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("h5", { - className: "text-2xl font-bold tracking-tight text-gray-900 dark:text-white", - children: tier.cost - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 35, - columnNumber: 13 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 28, - columnNumber: 11 - }, undefined) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 27, - columnNumber: 9 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("div", { - className: "flex flex-col items-center w-1/2", - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("h2", { - className: "mb-4 text-4xl font-extrabold tracking-tight leading-none text-gray-900 dark:text-white", - children: "Share what you did:" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 41, - columnNumber: 11 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("div", { - className: "flex gap-4", - children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)(_assets_socialMediaIcons_icons8_facebook_svg__WEBPACK_IMPORTED_MODULE_1__.ReactComponent, {}, void 0, false, { - fileName: _jsxFileName, - lineNumber: 45, - columnNumber: 13 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)(_assets_socialMediaIcons_icons8_instagram_svg__WEBPACK_IMPORTED_MODULE_2__.ReactComponent, {}, void 0, false, { - fileName: _jsxFileName, - lineNumber: 46, - columnNumber: 13 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)(_assets_socialMediaIcons_icons8_twitter_svg__WEBPACK_IMPORTED_MODULE_4__.ReactComponent, {}, void 0, false, { - fileName: _jsxFileName, - lineNumber: 47, - columnNumber: 13 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)(_assets_socialMediaIcons_icons8_linkedin_svg__WEBPACK_IMPORTED_MODULE_3__.ReactComponent, {}, void 0, false, { - fileName: _jsxFileName, - lineNumber: 48, - columnNumber: 13 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)(_assets_socialMediaIcons_icons8_line_svg__WEBPACK_IMPORTED_MODULE_5__.ReactComponent, {}, void 0, false, { - fileName: _jsxFileName, - lineNumber: 49, - columnNumber: 13 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 44, - columnNumber: 11 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("h2", { - className: "mb-4 text-4xl font-extrabold tracking-tight leading-none text-gray-900 dark:text-white", - children: "Learn more" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 52, - columnNumber: 11 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxDEV)("div", { - className: "flex gap-4" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 55, - columnNumber: 11 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 40, - columnNumber: 9 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 26, - columnNumber: 7 - }, undefined)] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 10, - columnNumber: 5 - }, undefined); -}; - -_c = OrderConfirmation; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (OrderConfirmation); - -var _c; - -__webpack_require__.$Refresh$.register(_c, "OrderConfirmation"); - -const $ReactRefreshModuleId$ = __webpack_require__.$Refresh$.moduleId; -const $ReactRefreshCurrentExports$ = __react_refresh_utils__.getModuleExports( - $ReactRefreshModuleId$ -); - -function $ReactRefreshModuleRuntime$(exports) { - if (true) { - let errorOverlay; - if (true) { - errorOverlay = false; - } - let testMode; - if (typeof __react_refresh_test__ !== 'undefined') { - testMode = __react_refresh_test__; - } - return __react_refresh_utils__.executeRuntime( - exports, - $ReactRefreshModuleId$, - module.hot, - errorOverlay, - testMode - ); - } -} - -if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Promise) { - $ReactRefreshCurrentExports$.then($ReactRefreshModuleRuntime$); -} else { - $ReactRefreshModuleRuntime$($ReactRefreshCurrentExports$); -} - -/***/ }), - -/***/ "./src/pages/Resources.jsx": -/*!*********************************!*\ - !*** ./src/pages/Resources.jsx ***! - \*********************************/ -/***/ ((module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-router-dom */ "./node_modules/react-router/index.js"); -/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-dev-runtime */ "./node_modules/react/jsx-dev-runtime.js"); -/* provided dependency */ var __react_refresh_utils__ = __webpack_require__(/*! ./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js */ "./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js"); -__webpack_require__.$Refresh$.runtime = __webpack_require__(/*! ./node_modules/react-refresh/runtime.js */ "./node_modules/react-refresh/runtime.js"); - -var _jsxFileName = "/Users/josh/Desktop/polyzero/src/pages/Resources.jsx", - _s = __webpack_require__.$Refresh$.signature(); - - - - - -const Resources = () => { - _s(); - - const navigateTo = (0,react_router_dom__WEBPACK_IMPORTED_MODULE_2__.useNavigate)(); - return /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("div", { - className: " flex justify-center items-center", - children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("ul", { - className: " flex flex-row space-x-4 mx ", - children: [" ", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("li", { - children: ["1", /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("a", { - href: "https://timeforchange.org/plastic-bags-and-plastic-bottles-co2-emissions-during-their-lifetime/", - className: "text-blue-600 hover:text-blue-800 text-center font-light", - children: "Click here for the full report" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 12, - columnNumber: 11 - }, undefined), " "] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 10, - columnNumber: 9 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("li", { - children: "2" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 19, - columnNumber: 9 - }, undefined), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxDEV)("li", { - children: "3" - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 20, - columnNumber: 9 - }, undefined), " "] - }, void 0, true, { - fileName: _jsxFileName, - lineNumber: 8, - columnNumber: 7 - }, undefined) - }, void 0, false, { - fileName: _jsxFileName, - lineNumber: 7, - columnNumber: 5 - }, undefined) //
- //
- // {" "} - //
- // The carbon footprint of just five plastic bags is the equvialant of - // 1kg of CO2e. - //

Source:

- // - // Click here for the full report - // {" "} - //
- // The carbon footprint of just five plastic bags is the equvialant of - // 1kg of CO2e. - //

Source:

- // - // Click here for the full report - // - //
- //
hi
- //
- //
- //
- ; -}; - -_s(Resources, "ymtrZ8G6aCOC+j9g/5vfaOOqM8M=", false, function () { - return [react_router_dom__WEBPACK_IMPORTED_MODULE_2__.useNavigate]; -}); - -_c = Resources; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Resources); - -var _c; - -__webpack_require__.$Refresh$.register(_c, "Resources"); - -const $ReactRefreshModuleId$ = __webpack_require__.$Refresh$.moduleId; -const $ReactRefreshCurrentExports$ = __react_refresh_utils__.getModuleExports( - $ReactRefreshModuleId$ -); - -function $ReactRefreshModuleRuntime$(exports) { - if (true) { - let errorOverlay; - if (true) { - errorOverlay = false; - } - let testMode; - if (typeof __react_refresh_test__ !== 'undefined') { - testMode = __react_refresh_test__; - } - return __react_refresh_utils__.executeRuntime( - exports, - $ReactRefreshModuleId$, - module.hot, - errorOverlay, - testMode - ); - } -} - -if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Promise) { - $ReactRefreshCurrentExports$.then($ReactRefreshModuleRuntime$); -} else { - $ReactRefreshModuleRuntime$($ReactRefreshCurrentExports$); -} - -/***/ }), - -/***/ "./node_modules/@firebase/auth/dist/esm2017/index-6bd8d405.js": -/*!********************************************************************!*\ - !*** ./node_modules/@firebase/auth/dist/esm2017/index-6bd8d405.js ***! - \********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "$": () => (/* binding */ signInWithCustomToken), -/* harmony export */ "A": () => (/* binding */ ActionCodeOperation), -/* harmony export */ "B": () => (/* binding */ debugErrorMap), -/* harmony export */ "C": () => (/* binding */ prodErrorMap), -/* harmony export */ "D": () => (/* binding */ AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY), -/* harmony export */ "E": () => (/* binding */ initializeAuth), -/* harmony export */ "F": () => (/* binding */ FactorId), -/* harmony export */ "G": () => (/* binding */ connectAuthEmulator), -/* harmony export */ "H": () => (/* binding */ AuthCredential), -/* harmony export */ "I": () => (/* binding */ EmailAuthCredential), -/* harmony export */ "J": () => (/* binding */ OAuthCredential), -/* harmony export */ "K": () => (/* binding */ PhoneAuthCredential), -/* harmony export */ "L": () => (/* binding */ inMemoryPersistence), -/* harmony export */ "M": () => (/* binding */ EmailAuthProvider), -/* harmony export */ "N": () => (/* binding */ FacebookAuthProvider), -/* harmony export */ "O": () => (/* binding */ OperationType), -/* harmony export */ "P": () => (/* binding */ PhoneAuthProvider), -/* harmony export */ "Q": () => (/* binding */ GoogleAuthProvider), -/* harmony export */ "R": () => (/* binding */ RecaptchaVerifier), -/* harmony export */ "S": () => (/* binding */ SignInMethod), -/* harmony export */ "T": () => (/* binding */ GithubAuthProvider), -/* harmony export */ "U": () => (/* binding */ OAuthProvider), -/* harmony export */ "V": () => (/* binding */ SAMLAuthProvider), -/* harmony export */ "W": () => (/* binding */ TwitterAuthProvider), -/* harmony export */ "X": () => (/* binding */ signInAnonymously), -/* harmony export */ "Y": () => (/* binding */ signInWithCredential), -/* harmony export */ "Z": () => (/* binding */ linkWithCredential), -/* harmony export */ "_": () => (/* binding */ reauthenticateWithCredential), -/* harmony export */ "a": () => (/* binding */ browserSessionPersistence), -/* harmony export */ "a0": () => (/* binding */ sendPasswordResetEmail), -/* harmony export */ "a1": () => (/* binding */ confirmPasswordReset), -/* harmony export */ "a2": () => (/* binding */ applyActionCode), -/* harmony export */ "a3": () => (/* binding */ checkActionCode), -/* harmony export */ "a4": () => (/* binding */ verifyPasswordResetCode), -/* harmony export */ "a5": () => (/* binding */ createUserWithEmailAndPassword), -/* harmony export */ "a6": () => (/* binding */ signInWithEmailAndPassword), -/* harmony export */ "a7": () => (/* binding */ sendSignInLinkToEmail), -/* harmony export */ "a8": () => (/* binding */ isSignInWithEmailLink), -/* harmony export */ "a9": () => (/* binding */ signInWithEmailLink), -/* harmony export */ "aA": () => (/* binding */ AuthEventManager), -/* harmony export */ "aB": () => (/* binding */ _getRedirectResult), -/* harmony export */ "aC": () => (/* binding */ _overrideRedirectResult), -/* harmony export */ "aD": () => (/* binding */ _clearRedirectOutcomes), -/* harmony export */ "aE": () => (/* binding */ _castAuth), -/* harmony export */ "aF": () => (/* binding */ UserImpl), -/* harmony export */ "aG": () => (/* binding */ AuthImpl), -/* harmony export */ "aH": () => (/* binding */ _getClientVersion), -/* harmony export */ "aI": () => (/* binding */ _generateEventId), -/* harmony export */ "aJ": () => (/* binding */ AuthPopup), -/* harmony export */ "aK": () => (/* binding */ FetchProvider), -/* harmony export */ "aL": () => (/* binding */ SAMLAuthCredential), -/* harmony export */ "aa": () => (/* binding */ fetchSignInMethodsForEmail), -/* harmony export */ "ab": () => (/* binding */ sendEmailVerification), -/* harmony export */ "ac": () => (/* binding */ verifyBeforeUpdateEmail), -/* harmony export */ "ad": () => (/* binding */ ActionCodeURL), -/* harmony export */ "ae": () => (/* binding */ parseActionCodeURL), -/* harmony export */ "af": () => (/* binding */ updateProfile), -/* harmony export */ "ag": () => (/* binding */ updateEmail), -/* harmony export */ "ah": () => (/* binding */ updatePassword), -/* harmony export */ "ai": () => (/* binding */ getIdToken), -/* harmony export */ "aj": () => (/* binding */ getIdTokenResult), -/* harmony export */ "ak": () => (/* binding */ unlink), -/* harmony export */ "al": () => (/* binding */ getAdditionalUserInfo), -/* harmony export */ "am": () => (/* binding */ reload), -/* harmony export */ "an": () => (/* binding */ getMultiFactorResolver), -/* harmony export */ "ao": () => (/* binding */ multiFactor), -/* harmony export */ "ap": () => (/* binding */ _isIOS7Or8), -/* harmony export */ "aq": () => (/* binding */ debugAssert), -/* harmony export */ "ar": () => (/* binding */ _isIOS), -/* harmony export */ "as": () => (/* binding */ _isAndroid), -/* harmony export */ "at": () => (/* binding */ _fail), -/* harmony export */ "au": () => (/* binding */ _getRedirectUrl), -/* harmony export */ "av": () => (/* binding */ _getProjectConfig), -/* harmony export */ "aw": () => (/* binding */ _createError), -/* harmony export */ "ax": () => (/* binding */ _assert), -/* harmony export */ "ay": () => (/* binding */ _getInstance), -/* harmony export */ "az": () => (/* binding */ _persistenceKeyName), -/* harmony export */ "b": () => (/* binding */ browserLocalPersistence), -/* harmony export */ "c": () => (/* binding */ signInWithPopup), -/* harmony export */ "d": () => (/* binding */ linkWithPopup), -/* harmony export */ "e": () => (/* binding */ reauthenticateWithPopup), -/* harmony export */ "f": () => (/* binding */ signInWithRedirect), -/* harmony export */ "g": () => (/* binding */ linkWithRedirect), -/* harmony export */ "h": () => (/* binding */ reauthenticateWithRedirect), -/* harmony export */ "i": () => (/* binding */ indexedDBLocalPersistence), -/* harmony export */ "j": () => (/* binding */ getRedirectResult), -/* harmony export */ "k": () => (/* binding */ browserPopupRedirectResolver), -/* harmony export */ "l": () => (/* binding */ linkWithPhoneNumber), -/* harmony export */ "m": () => (/* binding */ PhoneMultiFactorGenerator), -/* harmony export */ "n": () => (/* binding */ getAuth), -/* harmony export */ "o": () => (/* binding */ ProviderId), -/* harmony export */ "p": () => (/* binding */ setPersistence), -/* harmony export */ "q": () => (/* binding */ onIdTokenChanged), -/* harmony export */ "r": () => (/* binding */ reauthenticateWithPhoneNumber), -/* harmony export */ "s": () => (/* binding */ signInWithPhoneNumber), -/* harmony export */ "t": () => (/* binding */ beforeAuthStateChanged), -/* harmony export */ "u": () => (/* binding */ updatePhoneNumber), -/* harmony export */ "v": () => (/* binding */ onAuthStateChanged), -/* harmony export */ "w": () => (/* binding */ useDeviceLanguage), -/* harmony export */ "x": () => (/* binding */ updateCurrentUser), -/* harmony export */ "y": () => (/* binding */ signOut), -/* harmony export */ "z": () => (/* binding */ deleteUser) -/* harmony export */ }); -/* harmony import */ var _firebase_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/index.esm2017.js"); -/* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/esm/index.esm2017.js"); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _firebase_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @firebase/logger */ "./node_modules/@firebase/logger/dist/esm/index.esm2017.js"); -/* harmony import */ var _firebase_component__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @firebase/component */ "./node_modules/@firebase/component/dist/esm/index.esm2017.js"); - - - - - -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * An enum of factors that may be used for multifactor authentication. - * - * @public - */ - -const FactorId = { - /** Phone as second factor */ - PHONE: 'phone' -}; -/** - * Enumeration of supported providers. - * - * @public - */ - -const ProviderId = { - /** Facebook provider ID */ - FACEBOOK: 'facebook.com', - - /** GitHub provider ID */ - GITHUB: 'github.com', - - /** Google provider ID */ - GOOGLE: 'google.com', - - /** Password provider */ - PASSWORD: 'password', - - /** Phone provider */ - PHONE: 'phone', - - /** Twitter provider ID */ - TWITTER: 'twitter.com' -}; -/** - * Enumeration of supported sign-in methods. - * - * @public - */ - -const SignInMethod = { - /** Email link sign in method */ - EMAIL_LINK: 'emailLink', - - /** Email/password sign in method */ - EMAIL_PASSWORD: 'password', - - /** Facebook sign in method */ - FACEBOOK: 'facebook.com', - - /** GitHub sign in method */ - GITHUB: 'github.com', - - /** Google sign in method */ - GOOGLE: 'google.com', - - /** Phone sign in method */ - PHONE: 'phone', - - /** Twitter sign in method */ - TWITTER: 'twitter.com' -}; -/** - * Enumeration of supported operation types. - * - * @public - */ - -const OperationType = { - /** Operation involving linking an additional provider to an already signed-in user. */ - LINK: 'link', - - /** Operation involving using a provider to reauthenticate an already signed-in user. */ - REAUTHENTICATE: 'reauthenticate', - - /** Operation involving signing in a user. */ - SIGN_IN: 'signIn' -}; -/** - * An enumeration of the possible email action types. - * - * @public - */ - -const ActionCodeOperation = { - /** The email link sign-in action. */ - EMAIL_SIGNIN: 'EMAIL_SIGNIN', - - /** The password reset action. */ - PASSWORD_RESET: 'PASSWORD_RESET', - - /** The email revocation action. */ - RECOVER_EMAIL: 'RECOVER_EMAIL', - - /** The revert second factor addition email action. */ - REVERT_SECOND_FACTOR_ADDITION: 'REVERT_SECOND_FACTOR_ADDITION', - - /** The revert second factor addition email action. */ - VERIFY_AND_CHANGE_EMAIL: 'VERIFY_AND_CHANGE_EMAIL', - - /** The email verification action. */ - VERIFY_EMAIL: 'VERIFY_EMAIL' -}; -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function _debugErrorMap() { - return { - ["admin-restricted-operation" - /* ADMIN_ONLY_OPERATION */ - ]: 'This operation is restricted to administrators only.', - ["argument-error" - /* ARGUMENT_ERROR */ - ]: '', - ["app-not-authorized" - /* APP_NOT_AUTHORIZED */ - ]: "This app, identified by the domain where it's hosted, is not " + 'authorized to use Firebase Authentication with the provided API key. ' + 'Review your key configuration in the Google API console.', - ["app-not-installed" - /* APP_NOT_INSTALLED */ - ]: 'The requested mobile application corresponding to the identifier (' + 'Android package name or iOS bundle ID) provided is not installed on ' + 'this device.', - ["captcha-check-failed" - /* CAPTCHA_CHECK_FAILED */ - ]: 'The reCAPTCHA response token provided is either invalid, expired, ' + 'already used or the domain associated with it does not match the list ' + 'of whitelisted domains.', - ["code-expired" - /* CODE_EXPIRED */ - ]: 'The SMS code has expired. Please re-send the verification code to try ' + 'again.', - ["cordova-not-ready" - /* CORDOVA_NOT_READY */ - ]: 'Cordova framework is not ready.', - ["cors-unsupported" - /* CORS_UNSUPPORTED */ - ]: 'This browser is not supported.', - ["credential-already-in-use" - /* CREDENTIAL_ALREADY_IN_USE */ - ]: 'This credential is already associated with a different user account.', - ["custom-token-mismatch" - /* CREDENTIAL_MISMATCH */ - ]: 'The custom token corresponds to a different audience.', - ["requires-recent-login" - /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */ - ]: 'This operation is sensitive and requires recent authentication. Log in ' + 'again before retrying this request.', - ["dependent-sdk-initialized-before-auth" - /* DEPENDENT_SDK_INIT_BEFORE_AUTH */ - ]: 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' + 'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' + 'starting any other Firebase SDK.', - ["dynamic-link-not-activated" - /* DYNAMIC_LINK_NOT_ACTIVATED */ - ]: 'Please activate Dynamic Links in the Firebase Console and agree to the terms and ' + 'conditions.', - ["email-change-needs-verification" - /* EMAIL_CHANGE_NEEDS_VERIFICATION */ - ]: 'Multi-factor users must always have a verified email.', - ["email-already-in-use" - /* EMAIL_EXISTS */ - ]: 'The email address is already in use by another account.', - ["emulator-config-failed" - /* EMULATOR_CONFIG_FAILED */ - ]: 'Auth instance has already been used to make a network call. Auth can ' + 'no longer be configured to use the emulator. Try calling ' + '"connectAuthEmulator()" sooner.', - ["expired-action-code" - /* EXPIRED_OOB_CODE */ - ]: 'The action code has expired.', - ["cancelled-popup-request" - /* EXPIRED_POPUP_REQUEST */ - ]: 'This operation has been cancelled due to another conflicting popup being opened.', - ["internal-error" - /* INTERNAL_ERROR */ - ]: 'An internal AuthError has occurred.', - ["invalid-app-credential" - /* INVALID_APP_CREDENTIAL */ - ]: 'The phone verification request contains an invalid application verifier.' + ' The reCAPTCHA token response is either invalid or expired.', - ["invalid-app-id" - /* INVALID_APP_ID */ - ]: 'The mobile app identifier is not registed for the current project.', - ["invalid-user-token" - /* INVALID_AUTH */ - ]: "This user's credential isn't valid for this project. This can happen " + "if the user's token has been tampered with, or if the user isn't for " + 'the project associated with this API key.', - ["invalid-auth-event" - /* INVALID_AUTH_EVENT */ - ]: 'An internal AuthError has occurred.', - ["invalid-verification-code" - /* INVALID_CODE */ - ]: 'The SMS verification code used to create the phone auth credential is ' + 'invalid. Please resend the verification code sms and be sure to use the ' + 'verification code provided by the user.', - ["invalid-continue-uri" - /* INVALID_CONTINUE_URI */ - ]: 'The continue URL provided in the request is invalid.', - ["invalid-cordova-configuration" - /* INVALID_CORDOVA_CONFIGURATION */ - ]: 'The following Cordova plugins must be installed to enable OAuth sign-in: ' + 'cordova-plugin-buildinfo, cordova-universal-links-plugin, ' + 'cordova-plugin-browsertab, cordova-plugin-inappbrowser and ' + 'cordova-plugin-customurlscheme.', - ["invalid-custom-token" - /* INVALID_CUSTOM_TOKEN */ - ]: 'The custom token format is incorrect. Please check the documentation.', - ["invalid-dynamic-link-domain" - /* INVALID_DYNAMIC_LINK_DOMAIN */ - ]: 'The provided dynamic link domain is not configured or authorized for the current project.', - ["invalid-email" - /* INVALID_EMAIL */ - ]: 'The email address is badly formatted.', - ["invalid-emulator-scheme" - /* INVALID_EMULATOR_SCHEME */ - ]: 'Emulator URL must start with a valid scheme (http:// or https://).', - ["invalid-api-key" - /* INVALID_API_KEY */ - ]: 'Your API key is invalid, please check you have copied it correctly.', - ["invalid-cert-hash" - /* INVALID_CERT_HASH */ - ]: 'The SHA-1 certificate hash provided is invalid.', - ["invalid-credential" - /* INVALID_IDP_RESPONSE */ - ]: 'The supplied auth credential is malformed or has expired.', - ["invalid-message-payload" - /* INVALID_MESSAGE_PAYLOAD */ - ]: 'The email template corresponding to this action contains invalid characters in its message. ' + 'Please fix by going to the Auth email templates section in the Firebase Console.', - ["invalid-multi-factor-session" - /* INVALID_MFA_SESSION */ - ]: 'The request does not contain a valid proof of first factor successful sign-in.', - ["invalid-oauth-provider" - /* INVALID_OAUTH_PROVIDER */ - ]: 'EmailAuthProvider is not supported for this operation. This operation ' + 'only supports OAuth providers.', - ["invalid-oauth-client-id" - /* INVALID_OAUTH_CLIENT_ID */ - ]: 'The OAuth client ID provided is either invalid or does not match the ' + 'specified API key.', - ["unauthorized-domain" - /* INVALID_ORIGIN */ - ]: 'This domain is not authorized for OAuth operations for your Firebase ' + 'project. Edit the list of authorized domains from the Firebase console.', - ["invalid-action-code" - /* INVALID_OOB_CODE */ - ]: 'The action code is invalid. This can happen if the code is malformed, ' + 'expired, or has already been used.', - ["wrong-password" - /* INVALID_PASSWORD */ - ]: 'The password is invalid or the user does not have a password.', - ["invalid-persistence-type" - /* INVALID_PERSISTENCE */ - ]: 'The specified persistence type is invalid. It can only be local, session or none.', - ["invalid-phone-number" - /* INVALID_PHONE_NUMBER */ - ]: 'The format of the phone number provided is incorrect. Please enter the ' + 'phone number in a format that can be parsed into E.164 format. E.164 ' + 'phone numbers are written in the format [+][country code][subscriber ' + 'number including area code].', - ["invalid-provider-id" - /* INVALID_PROVIDER_ID */ - ]: 'The specified provider ID is invalid.', - ["invalid-recipient-email" - /* INVALID_RECIPIENT_EMAIL */ - ]: 'The email corresponding to this action failed to send as the provided ' + 'recipient email address is invalid.', - ["invalid-sender" - /* INVALID_SENDER */ - ]: 'The email template corresponding to this action contains an invalid sender email or name. ' + 'Please fix by going to the Auth email templates section in the Firebase Console.', - ["invalid-verification-id" - /* INVALID_SESSION_INFO */ - ]: 'The verification ID used to create the phone auth credential is invalid.', - ["invalid-tenant-id" - /* INVALID_TENANT_ID */ - ]: "The Auth instance's tenant ID is invalid.", - ["login-blocked" - /* LOGIN_BLOCKED */ - ]: 'Login blocked by user-provided method: {$originalMessage}', - ["missing-android-pkg-name" - /* MISSING_ANDROID_PACKAGE_NAME */ - ]: 'An Android Package Name must be provided if the Android App is required to be installed.', - ["auth-domain-config-required" - /* MISSING_AUTH_DOMAIN */ - ]: 'Be sure to include authDomain when calling firebase.initializeApp(), ' + 'by following the instructions in the Firebase console.', - ["missing-app-credential" - /* MISSING_APP_CREDENTIAL */ - ]: 'The phone verification request is missing an application verifier ' + 'assertion. A reCAPTCHA response token needs to be provided.', - ["missing-verification-code" - /* MISSING_CODE */ - ]: 'The phone auth credential was created with an empty SMS verification code.', - ["missing-continue-uri" - /* MISSING_CONTINUE_URI */ - ]: 'A continue URL must be provided in the request.', - ["missing-iframe-start" - /* MISSING_IFRAME_START */ - ]: 'An internal AuthError has occurred.', - ["missing-ios-bundle-id" - /* MISSING_IOS_BUNDLE_ID */ - ]: 'An iOS Bundle ID must be provided if an App Store ID is provided.', - ["missing-or-invalid-nonce" - /* MISSING_OR_INVALID_NONCE */ - ]: 'The request does not contain a valid nonce. This can occur if the ' + 'SHA-256 hash of the provided raw nonce does not match the hashed nonce ' + 'in the ID token payload.', - ["missing-multi-factor-info" - /* MISSING_MFA_INFO */ - ]: 'No second factor identifier is provided.', - ["missing-multi-factor-session" - /* MISSING_MFA_SESSION */ - ]: 'The request is missing proof of first factor successful sign-in.', - ["missing-phone-number" - /* MISSING_PHONE_NUMBER */ - ]: 'To send verification codes, provide a phone number for the recipient.', - ["missing-verification-id" - /* MISSING_SESSION_INFO */ - ]: 'The phone auth credential was created with an empty verification ID.', - ["app-deleted" - /* MODULE_DESTROYED */ - ]: 'This instance of FirebaseApp has been deleted.', - ["multi-factor-info-not-found" - /* MFA_INFO_NOT_FOUND */ - ]: 'The user does not have a second factor matching the identifier provided.', - ["multi-factor-auth-required" - /* MFA_REQUIRED */ - ]: 'Proof of ownership of a second factor is required to complete sign-in.', - ["account-exists-with-different-credential" - /* NEED_CONFIRMATION */ - ]: 'An account already exists with the same email address but different ' + 'sign-in credentials. Sign in using a provider associated with this ' + 'email address.', - ["network-request-failed" - /* NETWORK_REQUEST_FAILED */ - ]: 'A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.', - ["no-auth-event" - /* NO_AUTH_EVENT */ - ]: 'An internal AuthError has occurred.', - ["no-such-provider" - /* NO_SUCH_PROVIDER */ - ]: 'User was not linked to an account with the given provider.', - ["null-user" - /* NULL_USER */ - ]: 'A null user object was provided as the argument for an operation which ' + 'requires a non-null user object.', - ["operation-not-allowed" - /* OPERATION_NOT_ALLOWED */ - ]: 'The given sign-in provider is disabled for this Firebase project. ' + 'Enable it in the Firebase console, under the sign-in method tab of the ' + 'Auth section.', - ["operation-not-supported-in-this-environment" - /* OPERATION_NOT_SUPPORTED */ - ]: 'This operation is not supported in the environment this application is ' + 'running on. "location.protocol" must be http, https or chrome-extension' + ' and web storage must be enabled.', - ["popup-blocked" - /* POPUP_BLOCKED */ - ]: 'Unable to establish a connection with the popup. It may have been blocked by the browser.', - ["popup-closed-by-user" - /* POPUP_CLOSED_BY_USER */ - ]: 'The popup has been closed by the user before finalizing the operation.', - ["provider-already-linked" - /* PROVIDER_ALREADY_LINKED */ - ]: 'User can only be linked to one identity for the given provider.', - ["quota-exceeded" - /* QUOTA_EXCEEDED */ - ]: "The project's quota for this operation has been exceeded.", - ["redirect-cancelled-by-user" - /* REDIRECT_CANCELLED_BY_USER */ - ]: 'The redirect operation has been cancelled by the user before finalizing.', - ["redirect-operation-pending" - /* REDIRECT_OPERATION_PENDING */ - ]: 'A redirect sign-in operation is already pending.', - ["rejected-credential" - /* REJECTED_CREDENTIAL */ - ]: 'The request contains malformed or mismatching credentials.', - ["second-factor-already-in-use" - /* SECOND_FACTOR_ALREADY_ENROLLED */ - ]: 'The second factor is already enrolled on this account.', - ["maximum-second-factor-count-exceeded" - /* SECOND_FACTOR_LIMIT_EXCEEDED */ - ]: 'The maximum allowed number of second factors on a user has been exceeded.', - ["tenant-id-mismatch" - /* TENANT_ID_MISMATCH */ - ]: "The provided tenant ID does not match the Auth instance's tenant ID", - ["timeout" - /* TIMEOUT */ - ]: 'The operation has timed out.', - ["user-token-expired" - /* TOKEN_EXPIRED */ - ]: "The user's credential is no longer valid. The user must sign in again.", - ["too-many-requests" - /* TOO_MANY_ATTEMPTS_TRY_LATER */ - ]: 'We have blocked all requests from this device due to unusual activity. ' + 'Try again later.', - ["unauthorized-continue-uri" - /* UNAUTHORIZED_DOMAIN */ - ]: 'The domain of the continue URL is not whitelisted. Please whitelist ' + 'the domain in the Firebase console.', - ["unsupported-first-factor" - /* UNSUPPORTED_FIRST_FACTOR */ - ]: 'Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.', - ["unsupported-persistence-type" - /* UNSUPPORTED_PERSISTENCE */ - ]: 'The current environment does not support the specified persistence type.', - ["unsupported-tenant-operation" - /* UNSUPPORTED_TENANT_OPERATION */ - ]: 'This operation is not supported in a multi-tenant context.', - ["unverified-email" - /* UNVERIFIED_EMAIL */ - ]: 'The operation requires a verified email.', - ["user-cancelled" - /* USER_CANCELLED */ - ]: 'The user did not grant your application the permissions it requested.', - ["user-not-found" - /* USER_DELETED */ - ]: 'There is no user record corresponding to this identifier. The user may ' + 'have been deleted.', - ["user-disabled" - /* USER_DISABLED */ - ]: 'The user account has been disabled by an administrator.', - ["user-mismatch" - /* USER_MISMATCH */ - ]: 'The supplied credentials do not correspond to the previously signed in user.', - ["user-signed-out" - /* USER_SIGNED_OUT */ - ]: '', - ["weak-password" - /* WEAK_PASSWORD */ - ]: 'The password must be 6 characters long or more.', - ["web-storage-unsupported" - /* WEB_STORAGE_UNSUPPORTED */ - ]: 'This browser is not supported or 3rd party cookies and data may be disabled.', - ["already-initialized" - /* ALREADY_INITIALIZED */ - ]: 'initializeAuth() has already been called with ' + 'different options. To avoid this error, call initializeAuth() with the ' + 'same options as when it was originally called, or call getAuth() to return the' + ' already initialized instance.' - }; -} - -function _prodErrorMap() { - // We will include this one message in the prod error map since by the very - // nature of this error, developers will never be able to see the message - // using the debugErrorMap (which is installed during auth initialization). - return { - ["dependent-sdk-initialized-before-auth" - /* DEPENDENT_SDK_INIT_BEFORE_AUTH */ - ]: 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' + 'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' + 'starting any other Firebase SDK.' - }; -} -/** - * A verbose error map with detailed descriptions for most error codes. - * - * See discussion at {@link AuthErrorMap} - * - * @public - */ - - -const debugErrorMap = _debugErrorMap; -/** - * A minimal error map with all verbose error messages stripped. - * - * See discussion at {@link AuthErrorMap} - * - * @public - */ - -const prodErrorMap = _prodErrorMap; - -const _DEFAULT_AUTH_ERROR_FACTORY = new _firebase_util__WEBPACK_IMPORTED_MODULE_0__.ErrorFactory('auth', 'Firebase', _prodErrorMap()); -/** - * A map of potential `Auth` error codes, for easier comparison with errors - * thrown by the SDK. - * - * @remarks - * Note that you can't tree-shake individual keys - * in the map, so by using the map you might substantially increase your - * bundle size. - * - * @public - */ - - -const AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY = { - ADMIN_ONLY_OPERATION: 'auth/admin-restricted-operation', - ARGUMENT_ERROR: 'auth/argument-error', - APP_NOT_AUTHORIZED: 'auth/app-not-authorized', - APP_NOT_INSTALLED: 'auth/app-not-installed', - CAPTCHA_CHECK_FAILED: 'auth/captcha-check-failed', - CODE_EXPIRED: 'auth/code-expired', - CORDOVA_NOT_READY: 'auth/cordova-not-ready', - CORS_UNSUPPORTED: 'auth/cors-unsupported', - CREDENTIAL_ALREADY_IN_USE: 'auth/credential-already-in-use', - CREDENTIAL_MISMATCH: 'auth/custom-token-mismatch', - CREDENTIAL_TOO_OLD_LOGIN_AGAIN: 'auth/requires-recent-login', - DEPENDENT_SDK_INIT_BEFORE_AUTH: 'auth/dependent-sdk-initialized-before-auth', - DYNAMIC_LINK_NOT_ACTIVATED: 'auth/dynamic-link-not-activated', - EMAIL_CHANGE_NEEDS_VERIFICATION: 'auth/email-change-needs-verification', - EMAIL_EXISTS: 'auth/email-already-in-use', - EMULATOR_CONFIG_FAILED: 'auth/emulator-config-failed', - EXPIRED_OOB_CODE: 'auth/expired-action-code', - EXPIRED_POPUP_REQUEST: 'auth/cancelled-popup-request', - INTERNAL_ERROR: 'auth/internal-error', - INVALID_API_KEY: 'auth/invalid-api-key', - INVALID_APP_CREDENTIAL: 'auth/invalid-app-credential', - INVALID_APP_ID: 'auth/invalid-app-id', - INVALID_AUTH: 'auth/invalid-user-token', - INVALID_AUTH_EVENT: 'auth/invalid-auth-event', - INVALID_CERT_HASH: 'auth/invalid-cert-hash', - INVALID_CODE: 'auth/invalid-verification-code', - INVALID_CONTINUE_URI: 'auth/invalid-continue-uri', - INVALID_CORDOVA_CONFIGURATION: 'auth/invalid-cordova-configuration', - INVALID_CUSTOM_TOKEN: 'auth/invalid-custom-token', - INVALID_DYNAMIC_LINK_DOMAIN: 'auth/invalid-dynamic-link-domain', - INVALID_EMAIL: 'auth/invalid-email', - INVALID_EMULATOR_SCHEME: 'auth/invalid-emulator-scheme', - INVALID_IDP_RESPONSE: 'auth/invalid-credential', - INVALID_MESSAGE_PAYLOAD: 'auth/invalid-message-payload', - INVALID_MFA_SESSION: 'auth/invalid-multi-factor-session', - INVALID_OAUTH_CLIENT_ID: 'auth/invalid-oauth-client-id', - INVALID_OAUTH_PROVIDER: 'auth/invalid-oauth-provider', - INVALID_OOB_CODE: 'auth/invalid-action-code', - INVALID_ORIGIN: 'auth/unauthorized-domain', - INVALID_PASSWORD: 'auth/wrong-password', - INVALID_PERSISTENCE: 'auth/invalid-persistence-type', - INVALID_PHONE_NUMBER: 'auth/invalid-phone-number', - INVALID_PROVIDER_ID: 'auth/invalid-provider-id', - INVALID_RECIPIENT_EMAIL: 'auth/invalid-recipient-email', - INVALID_SENDER: 'auth/invalid-sender', - INVALID_SESSION_INFO: 'auth/invalid-verification-id', - INVALID_TENANT_ID: 'auth/invalid-tenant-id', - MFA_INFO_NOT_FOUND: 'auth/multi-factor-info-not-found', - MFA_REQUIRED: 'auth/multi-factor-auth-required', - MISSING_ANDROID_PACKAGE_NAME: 'auth/missing-android-pkg-name', - MISSING_APP_CREDENTIAL: 'auth/missing-app-credential', - MISSING_AUTH_DOMAIN: 'auth/auth-domain-config-required', - MISSING_CODE: 'auth/missing-verification-code', - MISSING_CONTINUE_URI: 'auth/missing-continue-uri', - MISSING_IFRAME_START: 'auth/missing-iframe-start', - MISSING_IOS_BUNDLE_ID: 'auth/missing-ios-bundle-id', - MISSING_OR_INVALID_NONCE: 'auth/missing-or-invalid-nonce', - MISSING_MFA_INFO: 'auth/missing-multi-factor-info', - MISSING_MFA_SESSION: 'auth/missing-multi-factor-session', - MISSING_PHONE_NUMBER: 'auth/missing-phone-number', - MISSING_SESSION_INFO: 'auth/missing-verification-id', - MODULE_DESTROYED: 'auth/app-deleted', - NEED_CONFIRMATION: 'auth/account-exists-with-different-credential', - NETWORK_REQUEST_FAILED: 'auth/network-request-failed', - NULL_USER: 'auth/null-user', - NO_AUTH_EVENT: 'auth/no-auth-event', - NO_SUCH_PROVIDER: 'auth/no-such-provider', - OPERATION_NOT_ALLOWED: 'auth/operation-not-allowed', - OPERATION_NOT_SUPPORTED: 'auth/operation-not-supported-in-this-environment', - POPUP_BLOCKED: 'auth/popup-blocked', - POPUP_CLOSED_BY_USER: 'auth/popup-closed-by-user', - PROVIDER_ALREADY_LINKED: 'auth/provider-already-linked', - QUOTA_EXCEEDED: 'auth/quota-exceeded', - REDIRECT_CANCELLED_BY_USER: 'auth/redirect-cancelled-by-user', - REDIRECT_OPERATION_PENDING: 'auth/redirect-operation-pending', - REJECTED_CREDENTIAL: 'auth/rejected-credential', - SECOND_FACTOR_ALREADY_ENROLLED: 'auth/second-factor-already-in-use', - SECOND_FACTOR_LIMIT_EXCEEDED: 'auth/maximum-second-factor-count-exceeded', - TENANT_ID_MISMATCH: 'auth/tenant-id-mismatch', - TIMEOUT: 'auth/timeout', - TOKEN_EXPIRED: 'auth/user-token-expired', - TOO_MANY_ATTEMPTS_TRY_LATER: 'auth/too-many-requests', - UNAUTHORIZED_DOMAIN: 'auth/unauthorized-continue-uri', - UNSUPPORTED_FIRST_FACTOR: 'auth/unsupported-first-factor', - UNSUPPORTED_PERSISTENCE: 'auth/unsupported-persistence-type', - UNSUPPORTED_TENANT_OPERATION: 'auth/unsupported-tenant-operation', - UNVERIFIED_EMAIL: 'auth/unverified-email', - USER_CANCELLED: 'auth/user-cancelled', - USER_DELETED: 'auth/user-not-found', - USER_DISABLED: 'auth/user-disabled', - USER_MISMATCH: 'auth/user-mismatch', - USER_SIGNED_OUT: 'auth/user-signed-out', - WEAK_PASSWORD: 'auth/weak-password', - WEB_STORAGE_UNSUPPORTED: 'auth/web-storage-unsupported', - ALREADY_INITIALIZED: 'auth/already-initialized' -}; -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -const logClient = new _firebase_logger__WEBPACK_IMPORTED_MODULE_2__.Logger('@firebase/auth'); - -function _logError(msg) { - if (logClient.logLevel <= _firebase_logger__WEBPACK_IMPORTED_MODULE_2__.LogLevel.ERROR) { - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key2 = 1; _key2 < _len; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } - - logClient.error(`Auth (${_firebase_app__WEBPACK_IMPORTED_MODULE_1__.SDK_VERSION}): ${msg}`, ...args); - } -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -function _fail(authOrCode) { - for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key3 = 1; _key3 < _len2; _key3++) { - rest[_key3 - 1] = arguments[_key3]; - } - - throw createErrorInternal(authOrCode, ...rest); -} - -function _createError(authOrCode) { - for (var _len3 = arguments.length, rest = new Array(_len3 > 1 ? _len3 - 1 : 0), _key4 = 1; _key4 < _len3; _key4++) { - rest[_key4 - 1] = arguments[_key4]; - } - - return createErrorInternal(authOrCode, ...rest); -} - -function _errorWithCustomMessage(auth, code, message) { - const errorMap = Object.assign(Object.assign({}, prodErrorMap()), { - [code]: message - }); - const factory = new _firebase_util__WEBPACK_IMPORTED_MODULE_0__.ErrorFactory('auth', 'Firebase', errorMap); - return factory.create(code, { - appName: auth.name - }); -} - -function _assertInstanceOf(auth, object, instance) { - const constructorInstance = instance; - - if (!(object instanceof constructorInstance)) { - if (constructorInstance.name !== object.constructor.name) { - _fail(auth, "argument-error" - /* ARGUMENT_ERROR */ - ); - } - - throw _errorWithCustomMessage(auth, "argument-error" - /* ARGUMENT_ERROR */ - , `Type of ${object.constructor.name} does not match expected instance.` + `Did you pass a reference from a different Auth SDK?`); - } -} - -function createErrorInternal(authOrCode) { - for (var _len4 = arguments.length, rest = new Array(_len4 > 1 ? _len4 - 1 : 0), _key5 = 1; _key5 < _len4; _key5++) { - rest[_key5 - 1] = arguments[_key5]; - } - - if (typeof authOrCode !== 'string') { - const code = rest[0]; - const fullParams = [...rest.slice(1)]; - - if (fullParams[0]) { - fullParams[0].appName = authOrCode.name; - } - - return authOrCode._errorFactory.create(code, ...fullParams); - } - - return _DEFAULT_AUTH_ERROR_FACTORY.create(authOrCode, ...rest); -} - -function _assert(assertion, authOrCode) { - if (!assertion) { - for (var _len5 = arguments.length, rest = new Array(_len5 > 2 ? _len5 - 2 : 0), _key6 = 2; _key6 < _len5; _key6++) { - rest[_key6 - 2] = arguments[_key6]; - } - - throw createErrorInternal(authOrCode, ...rest); - } -} -/** - * Unconditionally fails, throwing an internal error with the given message. - * - * @param failure type of failure encountered - * @throws Error - */ - - -function debugFail(failure) { - // Log the failure in addition to throw an exception, just in case the - // exception is swallowed. - const message = `INTERNAL ASSERTION FAILED: ` + failure; - - _logError(message); // NOTE: We don't use FirebaseError here because these are internal failures - // that cannot be handled by the user. (Also it would create a circular - // dependency between the error and assert modules which doesn't work.) - - - throw new Error(message); -} -/** - * Fails if the given assertion condition is false, throwing an Error with the - * given message if it did. - * - * @param assertion - * @param message - */ - - -function debugAssert(assertion, message) { - if (!assertion) { - debugFail(message); - } -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const instanceCache = new Map(); - -function _getInstance(cls) { - debugAssert(cls instanceof Function, 'Expected a class definition'); - let instance = instanceCache.get(cls); - - if (instance) { - debugAssert(instance instanceof cls, 'Instance stored in cache mismatched with class'); - return instance; - } - - instance = new cls(); - instanceCache.set(cls, instance); - return instance; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Initializes an {@link Auth} instance with fine-grained control over - * {@link Dependencies}. - * - * @remarks - * - * This function allows more control over the {@link Auth} instance than - * {@link getAuth}. `getAuth` uses platform-specific defaults to supply - * the {@link Dependencies}. In general, `getAuth` is the easiest way to - * initialize Auth and works for most use cases. Use `initializeAuth` if you - * need control over which persistence layer is used, or to minimize bundle - * size if you're not using either `signInWithPopup` or `signInWithRedirect`. - * - * For example, if your app only uses anonymous accounts and you only want - * accounts saved for the current session, initialize `Auth` with: - * - * ```js - * const auth = initializeAuth(app, { - * persistence: browserSessionPersistence, - * popupRedirectResolver: undefined, - * }); - * ``` - * - * @public - */ - - -function initializeAuth(app, deps) { - const provider = (0,_firebase_app__WEBPACK_IMPORTED_MODULE_1__._getProvider)(app, 'auth'); - - if (provider.isInitialized()) { - const auth = provider.getImmediate(); - const initialOptions = provider.getOptions(); - - if ((0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.deepEqual)(initialOptions, deps !== null && deps !== void 0 ? deps : {})) { - return auth; - } else { - _fail(auth, "already-initialized" - /* ALREADY_INITIALIZED */ - ); - } - } - - const auth = provider.initialize({ - options: deps - }); - return auth; -} - -function _initializeAuthInstance(auth, deps) { - const persistence = (deps === null || deps === void 0 ? void 0 : deps.persistence) || []; - const hierarchy = (Array.isArray(persistence) ? persistence : [persistence]).map(_getInstance); - - if (deps === null || deps === void 0 ? void 0 : deps.errorMap) { - auth._updateErrorMap(deps.errorMap); - } // This promise is intended to float; auth initialization happens in the - // background, meanwhile the auth object may be used by the app. - // eslint-disable-next-line @typescript-eslint/no-floating-promises - - - auth._initializeWithPersistence(hierarchy, deps === null || deps === void 0 ? void 0 : deps.popupRedirectResolver); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -function _getCurrentUrl() { - var _a; - - return typeof self !== 'undefined' && ((_a = self.location) === null || _a === void 0 ? void 0 : _a.href) || ''; -} - -function _isHttpOrHttps() { - return _getCurrentScheme() === 'http:' || _getCurrentScheme() === 'https:'; -} - -function _getCurrentScheme() { - var _a; - - return typeof self !== 'undefined' && ((_a = self.location) === null || _a === void 0 ? void 0 : _a.protocol) || null; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Determine whether the browser is working online - */ - - -function _isOnline() { - if (typeof navigator !== 'undefined' && navigator && 'onLine' in navigator && typeof navigator.onLine === 'boolean' && ( // Apply only for traditional web apps and Chrome extensions. - // This is especially true for Cordova apps which have unreliable - // navigator.onLine behavior unless cordova-plugin-network-information is - // installed which overwrites the native navigator.onLine value and - // defines navigator.connection. - _isHttpOrHttps() || (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.isBrowserExtension)() || 'connection' in navigator)) { - return navigator.onLine; - } // If we can't determine the state, assume it is online. - - - return true; -} - -function _getUserLanguage() { - if (typeof navigator === 'undefined') { - return null; - } - - const navigatorLanguage = navigator; - return (// Most reliable, but only supported in Chrome/Firefox. - navigatorLanguage.languages && navigatorLanguage.languages[0] || // Supported in most browsers, but returns the language of the browser - // UI, not the language set in browser settings. - navigatorLanguage.language || // Couldn't determine language. - null - ); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A structure to help pick between a range of long and short delay durations - * depending on the current environment. In general, the long delay is used for - * mobile environments whereas short delays are used for desktop environments. - */ - - -class Delay { - constructor(shortDelay, longDelay) { - this.shortDelay = shortDelay; - this.longDelay = longDelay; // Internal error when improperly initialized. - - debugAssert(longDelay > shortDelay, 'Short delay should be less than long delay!'); - this.isMobile = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.isMobileCordova)() || (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.isReactNative)(); - } - - get() { - if (!_isOnline()) { - // Pick the shorter timeout. - return Math.min(5000 - /* OFFLINE */ - , this.shortDelay); - } // If running in a mobile environment, return the long delay, otherwise - // return the short delay. - // This could be improved in the future to dynamically change based on other - // variables instead of just reading the current environment. - - - return this.isMobile ? this.longDelay : this.shortDelay; - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -function _emulatorUrl(config, path) { - debugAssert(config.emulator, 'Emulator should always be set here'); - const { - url - } = config.emulator; - - if (!path) { - return url; - } - - return `${url}${path.startsWith('/') ? path.slice(1) : path}`; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class FetchProvider { - static initialize(fetchImpl, headersImpl, responseImpl) { - this.fetchImpl = fetchImpl; - - if (headersImpl) { - this.headersImpl = headersImpl; - } - - if (responseImpl) { - this.responseImpl = responseImpl; - } - } - - static fetch() { - if (this.fetchImpl) { - return this.fetchImpl; - } - - if (typeof self !== 'undefined' && 'fetch' in self) { - return self.fetch; - } - - debugFail('Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill'); - } - - static headers() { - if (this.headersImpl) { - return this.headersImpl; - } - - if (typeof self !== 'undefined' && 'Headers' in self) { - return self.Headers; - } - - debugFail('Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill'); - } - - static response() { - if (this.responseImpl) { - return this.responseImpl; - } - - if (typeof self !== 'undefined' && 'Response' in self) { - return self.Response; - } - - debugFail('Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill'); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Map from errors returned by the server to errors to developer visible errors - */ - - -const SERVER_ERROR_MAP = { - // Custom token errors. - ["CREDENTIAL_MISMATCH" - /* CREDENTIAL_MISMATCH */ - ]: "custom-token-mismatch" - /* CREDENTIAL_MISMATCH */ - , - // This can only happen if the SDK sends a bad request. - ["MISSING_CUSTOM_TOKEN" - /* MISSING_CUSTOM_TOKEN */ - ]: "internal-error" - /* INTERNAL_ERROR */ - , - // Create Auth URI errors. - ["INVALID_IDENTIFIER" - /* INVALID_IDENTIFIER */ - ]: "invalid-email" - /* INVALID_EMAIL */ - , - // This can only happen if the SDK sends a bad request. - ["MISSING_CONTINUE_URI" - /* MISSING_CONTINUE_URI */ - ]: "internal-error" - /* INTERNAL_ERROR */ - , - // Sign in with email and password errors (some apply to sign up too). - ["INVALID_PASSWORD" - /* INVALID_PASSWORD */ - ]: "wrong-password" - /* INVALID_PASSWORD */ - , - // This can only happen if the SDK sends a bad request. - ["MISSING_PASSWORD" - /* MISSING_PASSWORD */ - ]: "internal-error" - /* INTERNAL_ERROR */ - , - // Sign up with email and password errors. - ["EMAIL_EXISTS" - /* EMAIL_EXISTS */ - ]: "email-already-in-use" - /* EMAIL_EXISTS */ - , - ["PASSWORD_LOGIN_DISABLED" - /* PASSWORD_LOGIN_DISABLED */ - ]: "operation-not-allowed" - /* OPERATION_NOT_ALLOWED */ - , - // Verify assertion for sign in with credential errors: - ["INVALID_IDP_RESPONSE" - /* INVALID_IDP_RESPONSE */ - ]: "invalid-credential" - /* INVALID_IDP_RESPONSE */ - , - ["INVALID_PENDING_TOKEN" - /* INVALID_PENDING_TOKEN */ - ]: "invalid-credential" - /* INVALID_IDP_RESPONSE */ - , - ["FEDERATED_USER_ID_ALREADY_LINKED" - /* FEDERATED_USER_ID_ALREADY_LINKED */ - ]: "credential-already-in-use" - /* CREDENTIAL_ALREADY_IN_USE */ - , - // This can only happen if the SDK sends a bad request. - ["MISSING_REQ_TYPE" - /* MISSING_REQ_TYPE */ - ]: "internal-error" - /* INTERNAL_ERROR */ - , - // Send Password reset email errors: - ["EMAIL_NOT_FOUND" - /* EMAIL_NOT_FOUND */ - ]: "user-not-found" - /* USER_DELETED */ - , - ["RESET_PASSWORD_EXCEED_LIMIT" - /* RESET_PASSWORD_EXCEED_LIMIT */ - ]: "too-many-requests" - /* TOO_MANY_ATTEMPTS_TRY_LATER */ - , - ["EXPIRED_OOB_CODE" - /* EXPIRED_OOB_CODE */ - ]: "expired-action-code" - /* EXPIRED_OOB_CODE */ - , - ["INVALID_OOB_CODE" - /* INVALID_OOB_CODE */ - ]: "invalid-action-code" - /* INVALID_OOB_CODE */ - , - // This can only happen if the SDK sends a bad request. - ["MISSING_OOB_CODE" - /* MISSING_OOB_CODE */ - ]: "internal-error" - /* INTERNAL_ERROR */ - , - // Operations that require ID token in request: - ["CREDENTIAL_TOO_OLD_LOGIN_AGAIN" - /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */ - ]: "requires-recent-login" - /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */ - , - ["INVALID_ID_TOKEN" - /* INVALID_ID_TOKEN */ - ]: "invalid-user-token" - /* INVALID_AUTH */ - , - ["TOKEN_EXPIRED" - /* TOKEN_EXPIRED */ - ]: "user-token-expired" - /* TOKEN_EXPIRED */ - , - ["USER_NOT_FOUND" - /* USER_NOT_FOUND */ - ]: "user-token-expired" - /* TOKEN_EXPIRED */ - , - // Other errors. - ["TOO_MANY_ATTEMPTS_TRY_LATER" - /* TOO_MANY_ATTEMPTS_TRY_LATER */ - ]: "too-many-requests" - /* TOO_MANY_ATTEMPTS_TRY_LATER */ - , - // Phone Auth related errors. - ["INVALID_CODE" - /* INVALID_CODE */ - ]: "invalid-verification-code" - /* INVALID_CODE */ - , - ["INVALID_SESSION_INFO" - /* INVALID_SESSION_INFO */ - ]: "invalid-verification-id" - /* INVALID_SESSION_INFO */ - , - ["INVALID_TEMPORARY_PROOF" - /* INVALID_TEMPORARY_PROOF */ - ]: "invalid-credential" - /* INVALID_IDP_RESPONSE */ - , - ["MISSING_SESSION_INFO" - /* MISSING_SESSION_INFO */ - ]: "missing-verification-id" - /* MISSING_SESSION_INFO */ - , - ["SESSION_EXPIRED" - /* SESSION_EXPIRED */ - ]: "code-expired" - /* CODE_EXPIRED */ - , - // Other action code errors when additional settings passed. - // MISSING_CONTINUE_URI is getting mapped to INTERNAL_ERROR above. - // This is OK as this error will be caught by client side validation. - ["MISSING_ANDROID_PACKAGE_NAME" - /* MISSING_ANDROID_PACKAGE_NAME */ - ]: "missing-android-pkg-name" - /* MISSING_ANDROID_PACKAGE_NAME */ - , - ["UNAUTHORIZED_DOMAIN" - /* UNAUTHORIZED_DOMAIN */ - ]: "unauthorized-continue-uri" - /* UNAUTHORIZED_DOMAIN */ - , - // getProjectConfig errors when clientId is passed. - ["INVALID_OAUTH_CLIENT_ID" - /* INVALID_OAUTH_CLIENT_ID */ - ]: "invalid-oauth-client-id" - /* INVALID_OAUTH_CLIENT_ID */ - , - // User actions (sign-up or deletion) disabled errors. - ["ADMIN_ONLY_OPERATION" - /* ADMIN_ONLY_OPERATION */ - ]: "admin-restricted-operation" - /* ADMIN_ONLY_OPERATION */ - , - // Multi factor related errors. - ["INVALID_MFA_PENDING_CREDENTIAL" - /* INVALID_MFA_PENDING_CREDENTIAL */ - ]: "invalid-multi-factor-session" - /* INVALID_MFA_SESSION */ - , - ["MFA_ENROLLMENT_NOT_FOUND" - /* MFA_ENROLLMENT_NOT_FOUND */ - ]: "multi-factor-info-not-found" - /* MFA_INFO_NOT_FOUND */ - , - ["MISSING_MFA_ENROLLMENT_ID" - /* MISSING_MFA_ENROLLMENT_ID */ - ]: "missing-multi-factor-info" - /* MISSING_MFA_INFO */ - , - ["MISSING_MFA_PENDING_CREDENTIAL" - /* MISSING_MFA_PENDING_CREDENTIAL */ - ]: "missing-multi-factor-session" - /* MISSING_MFA_SESSION */ - , - ["SECOND_FACTOR_EXISTS" - /* SECOND_FACTOR_EXISTS */ - ]: "second-factor-already-in-use" - /* SECOND_FACTOR_ALREADY_ENROLLED */ - , - ["SECOND_FACTOR_LIMIT_EXCEEDED" - /* SECOND_FACTOR_LIMIT_EXCEEDED */ - ]: "maximum-second-factor-count-exceeded" - /* SECOND_FACTOR_LIMIT_EXCEEDED */ - , - // Blocking functions related errors. - ["BLOCKING_FUNCTION_ERROR_RESPONSE" - /* BLOCKING_FUNCTION_ERROR_RESPONSE */ - ]: "internal-error" - /* INTERNAL_ERROR */ - -}; -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -const DEFAULT_API_TIMEOUT_MS = new Delay(30000, 60000); - -function _addTidIfNecessary(auth, request) { - if (auth.tenantId && !request.tenantId) { - return Object.assign(Object.assign({}, request), { - tenantId: auth.tenantId - }); - } - - return request; -} - -async function _performApiRequest(auth, method, path, request) { - let customErrorMap = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {}; - return _performFetchWithErrorHandling(auth, customErrorMap, async () => { - let body = {}; - let params = {}; - - if (request) { - if (method === "GET" - /* GET */ - ) { - params = request; - } else { - body = { - body: JSON.stringify(request) - }; - } - } - - const query = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.querystring)(Object.assign({ - key: auth.config.apiKey - }, params)).slice(1); - const headers = await auth._getAdditionalHeaders(); - headers["Content-Type" - /* CONTENT_TYPE */ - ] = 'application/json'; - - if (auth.languageCode) { - headers["X-Firebase-Locale" - /* X_FIREBASE_LOCALE */ - ] = auth.languageCode; - } - - return FetchProvider.fetch()(_getFinalTarget(auth, auth.config.apiHost, path, query), Object.assign({ - method, - headers, - referrerPolicy: 'no-referrer' - }, body)); - }); -} - -async function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) { - auth._canInitEmulator = false; - const errorMap = Object.assign(Object.assign({}, SERVER_ERROR_MAP), customErrorMap); - - try { - const networkTimeout = new NetworkTimeout(auth); - const response = await Promise.race([fetchFn(), networkTimeout.promise]); // If we've reached this point, the fetch succeeded and the networkTimeout - // didn't throw; clear the network timeout delay so that Node won't hang - - networkTimeout.clearNetworkTimeout(); - const json = await response.json(); - - if ('needConfirmation' in json) { - throw _makeTaggedError(auth, "account-exists-with-different-credential" - /* NEED_CONFIRMATION */ - , json); - } - - if (response.ok && !('errorMessage' in json)) { - return json; - } else { - const errorMessage = response.ok ? json.errorMessage : json.error.message; - const [serverErrorCode, serverErrorMessage] = errorMessage.split(' : '); - - if (serverErrorCode === "FEDERATED_USER_ID_ALREADY_LINKED" - /* FEDERATED_USER_ID_ALREADY_LINKED */ - ) { - throw _makeTaggedError(auth, "credential-already-in-use" - /* CREDENTIAL_ALREADY_IN_USE */ - , json); - } else if (serverErrorCode === "EMAIL_EXISTS" - /* EMAIL_EXISTS */ - ) { - throw _makeTaggedError(auth, "email-already-in-use" - /* EMAIL_EXISTS */ - , json); - } else if (serverErrorCode === "USER_DISABLED" - /* USER_DISABLED */ - ) { - throw _makeTaggedError(auth, "user-disabled" - /* USER_DISABLED */ - , json); - } - - const authError = errorMap[serverErrorCode] || serverErrorCode.toLowerCase().replace(/[_\s]+/g, '-'); - - if (serverErrorMessage) { - throw _errorWithCustomMessage(auth, authError, serverErrorMessage); - } else { - _fail(auth, authError); - } - } - } catch (e) { - if (e instanceof _firebase_util__WEBPACK_IMPORTED_MODULE_0__.FirebaseError) { - throw e; - } - - _fail(auth, "network-request-failed" - /* NETWORK_REQUEST_FAILED */ - ); - } -} - -async function _performSignInRequest(auth, method, path, request) { - let customErrorMap = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {}; - const serverResponse = await _performApiRequest(auth, method, path, request, customErrorMap); - - if ('mfaPendingCredential' in serverResponse) { - _fail(auth, "multi-factor-auth-required" - /* MFA_REQUIRED */ - , { - _serverResponse: serverResponse - }); - } - - return serverResponse; -} - -function _getFinalTarget(auth, host, path, query) { - const base = `${host}${path}?${query}`; - - if (!auth.config.emulator) { - return `${auth.config.apiScheme}://${base}`; - } - - return _emulatorUrl(auth.config, base); -} - -class NetworkTimeout { - constructor(auth) { - this.auth = auth; // Node timers and browser timers are fundamentally incompatible, but we - // don't care about the value here - // eslint-disable-next-line @typescript-eslint/no-explicit-any - - this.timer = null; - this.promise = new Promise((_, reject) => { - this.timer = setTimeout(() => { - return reject(_createError(this.auth, "network-request-failed" - /* NETWORK_REQUEST_FAILED */ - )); - }, DEFAULT_API_TIMEOUT_MS.get()); - }); - } - - clearNetworkTimeout() { - clearTimeout(this.timer); - } - -} - -function _makeTaggedError(auth, code, response) { - const errorParams = { - appName: auth.name - }; - - if (response.email) { - errorParams.email = response.email; - } - - if (response.phoneNumber) { - errorParams.phoneNumber = response.phoneNumber; - } - - const error = _createError(auth, code, errorParams); // We know customData is defined on error because errorParams is defined - - - error.customData._tokenResponse = response; - return error; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -async function deleteAccount(auth, request) { - return _performApiRequest(auth, "POST" - /* POST */ - , "/v1/accounts:delete" - /* DELETE_ACCOUNT */ - , request); -} - -async function deleteLinkedAccounts(auth, request) { - return _performApiRequest(auth, "POST" - /* POST */ - , "/v1/accounts:update" - /* SET_ACCOUNT_INFO */ - , request); -} - -async function getAccountInfo(auth, request) { - return _performApiRequest(auth, "POST" - /* POST */ - , "/v1/accounts:lookup" - /* GET_ACCOUNT_INFO */ - , request); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -function utcTimestampToDateString(utcTimestamp) { - if (!utcTimestamp) { - return undefined; - } - - try { - // Convert to date object. - const date = new Date(Number(utcTimestamp)); // Test date is valid. - - if (!isNaN(date.getTime())) { - // Convert to UTC date string. - return date.toUTCString(); - } - } catch (e) {// Do nothing. undefined will be returned. - } - - return undefined; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Returns a JSON Web Token (JWT) used to identify the user to a Firebase service. - * - * @remarks - * Returns the current token if it has not expired or if it will not expire in the next five - * minutes. Otherwise, this will refresh the token and return a new one. - * - * @param user - The user. - * @param forceRefresh - Force refresh regardless of token expiration. - * - * @public - */ - - -function getIdToken(user) { - let forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - return (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(user).getIdToken(forceRefresh); -} -/** - * Returns a deserialized JSON Web Token (JWT) used to identitfy the user to a Firebase service. - * - * @remarks - * Returns the current token if it has not expired or if it will not expire in the next five - * minutes. Otherwise, this will refresh the token and return a new one. - * - * @param user - The user. - * @param forceRefresh - Force refresh regardless of token expiration. - * - * @public - */ - - -async function getIdTokenResult(user) { - let forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - const userInternal = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(user); - const token = await userInternal.getIdToken(forceRefresh); - - const claims = _parseToken(token); - - _assert(claims && claims.exp && claims.auth_time && claims.iat, userInternal.auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - const firebase = typeof claims.firebase === 'object' ? claims.firebase : undefined; - const signInProvider = firebase === null || firebase === void 0 ? void 0 : firebase['sign_in_provider']; - return { - claims, - token, - authTime: utcTimestampToDateString(secondsStringToMilliseconds(claims.auth_time)), - issuedAtTime: utcTimestampToDateString(secondsStringToMilliseconds(claims.iat)), - expirationTime: utcTimestampToDateString(secondsStringToMilliseconds(claims.exp)), - signInProvider: signInProvider || null, - signInSecondFactor: (firebase === null || firebase === void 0 ? void 0 : firebase['sign_in_second_factor']) || null - }; -} - -function secondsStringToMilliseconds(seconds) { - return Number(seconds) * 1000; -} - -function _parseToken(token) { - var _a; - - const [algorithm, payload, signature] = token.split('.'); - - if (algorithm === undefined || payload === undefined || signature === undefined) { - _logError('JWT malformed, contained fewer than 3 sections'); - - return null; - } - - try { - const decoded = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.base64Decode)(payload); - - if (!decoded) { - _logError('Failed to decode base64 JWT payload'); - - return null; - } - - return JSON.parse(decoded); - } catch (e) { - _logError('Caught error parsing JWT payload as JSON', (_a = e) === null || _a === void 0 ? void 0 : _a.toString()); - - return null; - } -} -/** - * Extract expiresIn TTL from a token by subtracting the expiration from the issuance. - */ - - -function _tokenExpiresIn(token) { - const parsedToken = _parseToken(token); - - _assert(parsedToken, "internal-error" - /* INTERNAL_ERROR */ - ); - - _assert(typeof parsedToken.exp !== 'undefined', "internal-error" - /* INTERNAL_ERROR */ - ); - - _assert(typeof parsedToken.iat !== 'undefined', "internal-error" - /* INTERNAL_ERROR */ - ); - - return Number(parsedToken.exp) - Number(parsedToken.iat); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -async function _logoutIfInvalidated(user, promise) { - let bypassAuthState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - - if (bypassAuthState) { - return promise; - } - - try { - return await promise; - } catch (e) { - if (e instanceof _firebase_util__WEBPACK_IMPORTED_MODULE_0__.FirebaseError && isUserInvalidated(e)) { - if (user.auth.currentUser === user) { - await user.auth.signOut(); - } - } - - throw e; - } -} - -function isUserInvalidated(_ref) { - let { - code - } = _ref; - return code === `auth/${"user-disabled" - /* USER_DISABLED */ - }` || code === `auth/${"user-token-expired" - /* TOKEN_EXPIRED */ - }`; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class ProactiveRefresh { - constructor(user) { - this.user = user; - this.isRunning = false; // Node timers and browser timers return fundamentally different types. - // We don't actually care what the value is but TS won't accept unknown and - // we can't cast properly in both environments. - // eslint-disable-next-line @typescript-eslint/no-explicit-any - - this.timerId = null; - this.errorBackoff = 30000 - /* RETRY_BACKOFF_MIN */ - ; - } - - _start() { - if (this.isRunning) { - return; - } - - this.isRunning = true; - this.schedule(); - } - - _stop() { - if (!this.isRunning) { - return; - } - - this.isRunning = false; - - if (this.timerId !== null) { - clearTimeout(this.timerId); - } - } - - getInterval(wasError) { - var _a; - - if (wasError) { - const interval = this.errorBackoff; - this.errorBackoff = Math.min(this.errorBackoff * 2, 960000 - /* RETRY_BACKOFF_MAX */ - ); - return interval; - } else { - // Reset the error backoff - this.errorBackoff = 30000 - /* RETRY_BACKOFF_MIN */ - ; - const expTime = (_a = this.user.stsTokenManager.expirationTime) !== null && _a !== void 0 ? _a : 0; - const interval = expTime - Date.now() - 300000 - /* OFFSET */ - ; - return Math.max(0, interval); - } - } - - schedule() { - let wasError = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - - if (!this.isRunning) { - // Just in case... - return; - } - - const interval = this.getInterval(wasError); - this.timerId = setTimeout(async () => { - await this.iteration(); - }, interval); - } - - async iteration() { - var _a; - - try { - await this.user.getIdToken(true); - } catch (e) { - // Only retry on network errors - if (((_a = e) === null || _a === void 0 ? void 0 : _a.code) === `auth/${"network-request-failed" - /* NETWORK_REQUEST_FAILED */ - }`) { - this.schedule( - /* wasError */ - true); - } - - return; - } - - this.schedule(); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class UserMetadata { - constructor(createdAt, lastLoginAt) { - this.createdAt = createdAt; - this.lastLoginAt = lastLoginAt; - - this._initializeTime(); - } - - _initializeTime() { - this.lastSignInTime = utcTimestampToDateString(this.lastLoginAt); - this.creationTime = utcTimestampToDateString(this.createdAt); - } - - _copy(metadata) { - this.createdAt = metadata.createdAt; - this.lastLoginAt = metadata.lastLoginAt; - - this._initializeTime(); - } - - toJSON() { - return { - createdAt: this.createdAt, - lastLoginAt: this.lastLoginAt - }; - } - -} -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -async function _reloadWithoutSaving(user) { - var _a; - - const auth = user.auth; - const idToken = await user.getIdToken(); - const response = await _logoutIfInvalidated(user, getAccountInfo(auth, { - idToken - })); - - _assert(response === null || response === void 0 ? void 0 : response.users.length, auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - const coreAccount = response.users[0]; - - user._notifyReloadListener(coreAccount); - - const newProviderData = ((_a = coreAccount.providerUserInfo) === null || _a === void 0 ? void 0 : _a.length) ? extractProviderData(coreAccount.providerUserInfo) : []; - const providerData = mergeProviderData(user.providerData, newProviderData); // Preserves the non-nonymous status of the stored user, even if no more - // credentials (federated or email/password) are linked to the user. If - // the user was previously anonymous, then use provider data to update. - // On the other hand, if it was not anonymous before, it should never be - // considered anonymous now. - - const oldIsAnonymous = user.isAnonymous; - const newIsAnonymous = !(user.email && coreAccount.passwordHash) && !(providerData === null || providerData === void 0 ? void 0 : providerData.length); - const isAnonymous = !oldIsAnonymous ? false : newIsAnonymous; - const updates = { - uid: coreAccount.localId, - displayName: coreAccount.displayName || null, - photoURL: coreAccount.photoUrl || null, - email: coreAccount.email || null, - emailVerified: coreAccount.emailVerified || false, - phoneNumber: coreAccount.phoneNumber || null, - tenantId: coreAccount.tenantId || null, - providerData, - metadata: new UserMetadata(coreAccount.createdAt, coreAccount.lastLoginAt), - isAnonymous - }; - Object.assign(user, updates); -} -/** - * Reloads user account data, if signed in. - * - * @param user - The user. - * - * @public - */ - - -async function reload(user) { - const userInternal = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(user); - await _reloadWithoutSaving(userInternal); // Even though the current user hasn't changed, update - // current user will trigger a persistence update w/ the - // new info. - - await userInternal.auth._persistUserIfCurrent(userInternal); - - userInternal.auth._notifyListenersIfCurrent(userInternal); -} - -function mergeProviderData(original, newData) { - const deduped = original.filter(o => !newData.some(n => n.providerId === o.providerId)); - return [...deduped, ...newData]; -} - -function extractProviderData(providers) { - return providers.map(_a => { - var { - providerId - } = _a, - provider = (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__rest)(_a, ["providerId"]); - - return { - providerId, - uid: provider.rawId || '', - displayName: provider.displayName || null, - email: provider.email || null, - phoneNumber: provider.phoneNumber || null, - photoURL: provider.photoUrl || null - }; - }); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -async function requestStsToken(auth, refreshToken) { - const response = await _performFetchWithErrorHandling(auth, {}, async () => { - const body = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.querystring)({ - 'grant_type': 'refresh_token', - 'refresh_token': refreshToken - }).slice(1); - const { - tokenApiHost, - apiKey - } = auth.config; - - const url = _getFinalTarget(auth, tokenApiHost, "/v1/token" - /* TOKEN */ - , `key=${apiKey}`); - - const headers = await auth._getAdditionalHeaders(); - headers["Content-Type" - /* CONTENT_TYPE */ - ] = 'application/x-www-form-urlencoded'; - return FetchProvider.fetch()(url, { - method: "POST" - /* POST */ - , - headers, - body - }); - }); // The response comes back in snake_case. Convert to camel: - - return { - accessToken: response.access_token, - expiresIn: response.expires_in, - refreshToken: response.refresh_token - }; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * We need to mark this class as internal explicitly to exclude it in the public typings, because - * it references AuthInternal which has a circular dependency with UserInternal. - * - * @internal - */ - - -class StsTokenManager { - constructor() { - this.refreshToken = null; - this.accessToken = null; - this.expirationTime = null; - } - - get isExpired() { - return !this.expirationTime || Date.now() > this.expirationTime - 30000 - /* TOKEN_REFRESH */ - ; - } - - updateFromServerResponse(response) { - _assert(response.idToken, "internal-error" - /* INTERNAL_ERROR */ - ); - - _assert(typeof response.idToken !== 'undefined', "internal-error" - /* INTERNAL_ERROR */ - ); - - _assert(typeof response.refreshToken !== 'undefined', "internal-error" - /* INTERNAL_ERROR */ - ); - - const expiresIn = 'expiresIn' in response && typeof response.expiresIn !== 'undefined' ? Number(response.expiresIn) : _tokenExpiresIn(response.idToken); - this.updateTokensAndExpiration(response.idToken, response.refreshToken, expiresIn); - } - - async getToken(auth) { - let forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - - _assert(!this.accessToken || this.refreshToken, auth, "user-token-expired" - /* TOKEN_EXPIRED */ - ); - - if (!forceRefresh && this.accessToken && !this.isExpired) { - return this.accessToken; - } - - if (this.refreshToken) { - await this.refresh(auth, this.refreshToken); - return this.accessToken; - } - - return null; - } - - clearRefreshToken() { - this.refreshToken = null; - } - - async refresh(auth, oldToken) { - const { - accessToken, - refreshToken, - expiresIn - } = await requestStsToken(auth, oldToken); - this.updateTokensAndExpiration(accessToken, refreshToken, Number(expiresIn)); - } - - updateTokensAndExpiration(accessToken, refreshToken, expiresInSec) { - this.refreshToken = refreshToken || null; - this.accessToken = accessToken || null; - this.expirationTime = Date.now() + expiresInSec * 1000; - } - - static fromJSON(appName, object) { - const { - refreshToken, - accessToken, - expirationTime - } = object; - const manager = new StsTokenManager(); - - if (refreshToken) { - _assert(typeof refreshToken === 'string', "internal-error" - /* INTERNAL_ERROR */ - , { - appName - }); - - manager.refreshToken = refreshToken; - } - - if (accessToken) { - _assert(typeof accessToken === 'string', "internal-error" - /* INTERNAL_ERROR */ - , { - appName - }); - - manager.accessToken = accessToken; - } - - if (expirationTime) { - _assert(typeof expirationTime === 'number', "internal-error" - /* INTERNAL_ERROR */ - , { - appName - }); - - manager.expirationTime = expirationTime; - } - - return manager; - } - - toJSON() { - return { - refreshToken: this.refreshToken, - accessToken: this.accessToken, - expirationTime: this.expirationTime - }; - } - - _assign(stsTokenManager) { - this.accessToken = stsTokenManager.accessToken; - this.refreshToken = stsTokenManager.refreshToken; - this.expirationTime = stsTokenManager.expirationTime; - } - - _clone() { - return Object.assign(new StsTokenManager(), this.toJSON()); - } - - _performRefresh() { - return debugFail('not implemented'); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -function assertStringOrUndefined(assertion, appName) { - _assert(typeof assertion === 'string' || typeof assertion === 'undefined', "internal-error" - /* INTERNAL_ERROR */ - , { - appName - }); -} - -class UserImpl { - constructor(_a) { - var { - uid, - auth, - stsTokenManager - } = _a, - opt = (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__rest)(_a, ["uid", "auth", "stsTokenManager"]); // For the user object, provider is always Firebase. - - - this.providerId = "firebase" - /* FIREBASE */ - ; - this.proactiveRefresh = new ProactiveRefresh(this); - this.reloadUserInfo = null; - this.reloadListener = null; - this.uid = uid; - this.auth = auth; - this.stsTokenManager = stsTokenManager; - this.accessToken = stsTokenManager.accessToken; - this.displayName = opt.displayName || null; - this.email = opt.email || null; - this.emailVerified = opt.emailVerified || false; - this.phoneNumber = opt.phoneNumber || null; - this.photoURL = opt.photoURL || null; - this.isAnonymous = opt.isAnonymous || false; - this.tenantId = opt.tenantId || null; - this.providerData = opt.providerData ? [...opt.providerData] : []; - this.metadata = new UserMetadata(opt.createdAt || undefined, opt.lastLoginAt || undefined); - } - - async getIdToken(forceRefresh) { - const accessToken = await _logoutIfInvalidated(this, this.stsTokenManager.getToken(this.auth, forceRefresh)); - - _assert(accessToken, this.auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - if (this.accessToken !== accessToken) { - this.accessToken = accessToken; - await this.auth._persistUserIfCurrent(this); - - this.auth._notifyListenersIfCurrent(this); - } - - return accessToken; - } - - getIdTokenResult(forceRefresh) { - return getIdTokenResult(this, forceRefresh); - } - - reload() { - return reload(this); - } - - _assign(user) { - if (this === user) { - return; - } - - _assert(this.uid === user.uid, this.auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - this.displayName = user.displayName; - this.photoURL = user.photoURL; - this.email = user.email; - this.emailVerified = user.emailVerified; - this.phoneNumber = user.phoneNumber; - this.isAnonymous = user.isAnonymous; - this.tenantId = user.tenantId; - this.providerData = user.providerData.map(userInfo => Object.assign({}, userInfo)); - - this.metadata._copy(user.metadata); - - this.stsTokenManager._assign(user.stsTokenManager); - } - - _clone(auth) { - return new UserImpl(Object.assign(Object.assign({}, this), { - auth, - stsTokenManager: this.stsTokenManager._clone() - })); - } - - _onReload(callback) { - // There should only ever be one listener, and that is a single instance of MultiFactorUser - _assert(!this.reloadListener, this.auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - this.reloadListener = callback; - - if (this.reloadUserInfo) { - this._notifyReloadListener(this.reloadUserInfo); - - this.reloadUserInfo = null; - } - } - - _notifyReloadListener(userInfo) { - if (this.reloadListener) { - this.reloadListener(userInfo); - } else { - // If no listener is subscribed yet, save the result so it's available when they do subscribe - this.reloadUserInfo = userInfo; - } - } - - _startProactiveRefresh() { - this.proactiveRefresh._start(); - } - - _stopProactiveRefresh() { - this.proactiveRefresh._stop(); - } - - async _updateTokensIfNecessary(response) { - let reload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - let tokensRefreshed = false; - - if (response.idToken && response.idToken !== this.stsTokenManager.accessToken) { - this.stsTokenManager.updateFromServerResponse(response); - tokensRefreshed = true; - } - - if (reload) { - await _reloadWithoutSaving(this); - } - - await this.auth._persistUserIfCurrent(this); - - if (tokensRefreshed) { - this.auth._notifyListenersIfCurrent(this); - } - } - - async delete() { - const idToken = await this.getIdToken(); - await _logoutIfInvalidated(this, deleteAccount(this.auth, { - idToken - })); - this.stsTokenManager.clearRefreshToken(); // TODO: Determine if cancellable-promises are necessary to use in this class so that delete() - // cancels pending actions... - - return this.auth.signOut(); - } - - toJSON() { - return Object.assign(Object.assign({ - uid: this.uid, - email: this.email || undefined, - emailVerified: this.emailVerified, - displayName: this.displayName || undefined, - isAnonymous: this.isAnonymous, - photoURL: this.photoURL || undefined, - phoneNumber: this.phoneNumber || undefined, - tenantId: this.tenantId || undefined, - providerData: this.providerData.map(userInfo => Object.assign({}, userInfo)), - stsTokenManager: this.stsTokenManager.toJSON(), - // Redirect event ID must be maintained in case there is a pending - // redirect event. - _redirectEventId: this._redirectEventId - }, this.metadata.toJSON()), { - // Required for compatibility with the legacy SDK (go/firebase-auth-sdk-persistence-parsing): - apiKey: this.auth.config.apiKey, - appName: this.auth.name - }); - } - - get refreshToken() { - return this.stsTokenManager.refreshToken || ''; - } - - static _fromJSON(auth, object) { - var _a, _b, _c, _d, _e, _f, _g, _h; - - const displayName = (_a = object.displayName) !== null && _a !== void 0 ? _a : undefined; - const email = (_b = object.email) !== null && _b !== void 0 ? _b : undefined; - const phoneNumber = (_c = object.phoneNumber) !== null && _c !== void 0 ? _c : undefined; - const photoURL = (_d = object.photoURL) !== null && _d !== void 0 ? _d : undefined; - const tenantId = (_e = object.tenantId) !== null && _e !== void 0 ? _e : undefined; - - const _redirectEventId = (_f = object._redirectEventId) !== null && _f !== void 0 ? _f : undefined; - - const createdAt = (_g = object.createdAt) !== null && _g !== void 0 ? _g : undefined; - const lastLoginAt = (_h = object.lastLoginAt) !== null && _h !== void 0 ? _h : undefined; - const { - uid, - emailVerified, - isAnonymous, - providerData, - stsTokenManager: plainObjectTokenManager - } = object; - - _assert(uid && plainObjectTokenManager, auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - const stsTokenManager = StsTokenManager.fromJSON(this.name, plainObjectTokenManager); - - _assert(typeof uid === 'string', auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - assertStringOrUndefined(displayName, auth.name); - assertStringOrUndefined(email, auth.name); - - _assert(typeof emailVerified === 'boolean', auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - _assert(typeof isAnonymous === 'boolean', auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - assertStringOrUndefined(phoneNumber, auth.name); - assertStringOrUndefined(photoURL, auth.name); - assertStringOrUndefined(tenantId, auth.name); - assertStringOrUndefined(_redirectEventId, auth.name); - assertStringOrUndefined(createdAt, auth.name); - assertStringOrUndefined(lastLoginAt, auth.name); - const user = new UserImpl({ - uid, - auth, - email, - emailVerified, - displayName, - isAnonymous, - photoURL, - phoneNumber, - tenantId, - stsTokenManager, - createdAt, - lastLoginAt - }); - - if (providerData && Array.isArray(providerData)) { - user.providerData = providerData.map(userInfo => Object.assign({}, userInfo)); - } - - if (_redirectEventId) { - user._redirectEventId = _redirectEventId; - } - - return user; - } - /** - * Initialize a User from an idToken server response - * @param auth - * @param idTokenResponse - */ - - - static async _fromIdTokenResponse(auth, idTokenResponse) { - let isAnonymous = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - const stsTokenManager = new StsTokenManager(); - stsTokenManager.updateFromServerResponse(idTokenResponse); // Initialize the Firebase Auth user. - - const user = new UserImpl({ - uid: idTokenResponse.localId, - auth, - stsTokenManager, - isAnonymous - }); // Updates the user info and data and resolves with a user instance. - - await _reloadWithoutSaving(user); - return user; - } - -} -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class InMemoryPersistence { - constructor() { - this.type = "NONE" - /* NONE */ - ; - this.storage = {}; - } - - async _isAvailable() { - return true; - } - - async _set(key, value) { - this.storage[key] = value; - } - - async _get(key) { - const value = this.storage[key]; - return value === undefined ? null : value; - } - - async _remove(key) { - delete this.storage[key]; - } - - _addListener(_key, _listener) { - // Listeners are not supported for in-memory storage since it cannot be shared across windows/workers - return; - } - - _removeListener(_key, _listener) { - // Listeners are not supported for in-memory storage since it cannot be shared across windows/workers - return; - } - -} - -InMemoryPersistence.type = 'NONE'; -/** - * An implementation of {@link Persistence} of type 'NONE'. - * - * @public - */ - -const inMemoryPersistence = InMemoryPersistence; -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function _persistenceKeyName(key, apiKey, appName) { - return `${"firebase" - /* PERSISTENCE */ - }:${key}:${apiKey}:${appName}`; -} - -class PersistenceUserManager { - constructor(persistence, auth, userKey) { - this.persistence = persistence; - this.auth = auth; - this.userKey = userKey; - const { - config, - name - } = this.auth; - this.fullUserKey = _persistenceKeyName(this.userKey, config.apiKey, name); - this.fullPersistenceKey = _persistenceKeyName("persistence" - /* PERSISTENCE_USER */ - , config.apiKey, name); - this.boundEventHandler = auth._onStorageEvent.bind(auth); - - this.persistence._addListener(this.fullUserKey, this.boundEventHandler); - } - - setCurrentUser(user) { - return this.persistence._set(this.fullUserKey, user.toJSON()); - } - - async getCurrentUser() { - const blob = await this.persistence._get(this.fullUserKey); - return blob ? UserImpl._fromJSON(this.auth, blob) : null; - } - - removeCurrentUser() { - return this.persistence._remove(this.fullUserKey); - } - - savePersistenceForRedirect() { - return this.persistence._set(this.fullPersistenceKey, this.persistence.type); - } - - async setPersistence(newPersistence) { - if (this.persistence === newPersistence) { - return; - } - - const currentUser = await this.getCurrentUser(); - await this.removeCurrentUser(); - this.persistence = newPersistence; - - if (currentUser) { - return this.setCurrentUser(currentUser); - } - } - - delete() { - this.persistence._removeListener(this.fullUserKey, this.boundEventHandler); - } - - static async create(auth, persistenceHierarchy) { - let userKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "authUser"; - - if (!persistenceHierarchy.length) { - return new PersistenceUserManager(_getInstance(inMemoryPersistence), auth, userKey); - } // Eliminate any persistences that are not available - - - const availablePersistences = (await Promise.all(persistenceHierarchy.map(async persistence => { - if (await persistence._isAvailable()) { - return persistence; - } - - return undefined; - }))).filter(persistence => persistence); // Fall back to the first persistence listed, or in memory if none available - - let selectedPersistence = availablePersistences[0] || _getInstance(inMemoryPersistence); - - const key = _persistenceKeyName(userKey, auth.config.apiKey, auth.name); // Pull out the existing user, setting the chosen persistence to that - // persistence if the user exists. - - - let userToMigrate = null; // Note, here we check for a user in _all_ persistences, not just the - // ones deemed available. If we can migrate a user out of a broken - // persistence, we will (but only if that persistence supports migration). - - for (const persistence of persistenceHierarchy) { - try { - const blob = await persistence._get(key); - - if (blob) { - const user = UserImpl._fromJSON(auth, blob); // throws for unparsable blob (wrong format) - - - if (persistence !== selectedPersistence) { - userToMigrate = user; - } - - selectedPersistence = persistence; - break; - } - } catch (_a) {} - } // If we find the user in a persistence that does support migration, use - // that migration path (of only persistences that support migration) - - - const migrationHierarchy = availablePersistences.filter(p => p._shouldAllowMigration); // If the persistence does _not_ allow migration, just finish off here - - if (!selectedPersistence._shouldAllowMigration || !migrationHierarchy.length) { - return new PersistenceUserManager(selectedPersistence, auth, userKey); - } - - selectedPersistence = migrationHierarchy[0]; - - if (userToMigrate) { - // This normally shouldn't throw since chosenPersistence.isAvailable() is true, but if it does - // we'll just let it bubble to surface the error. - await selectedPersistence._set(key, userToMigrate.toJSON()); - } // Attempt to clear the key in other persistences but ignore errors. This helps prevent issues - // such as users getting stuck with a previous account after signing out and refreshing the tab. - - - await Promise.all(persistenceHierarchy.map(async persistence => { - if (persistence !== selectedPersistence) { - try { - await persistence._remove(key); - } catch (_a) {} - } - })); - return new PersistenceUserManager(selectedPersistence, auth, userKey); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Determine the browser for the purposes of reporting usage to the API - */ - - -function _getBrowserName(userAgent) { - const ua = userAgent.toLowerCase(); - - if (ua.includes('opera/') || ua.includes('opr/') || ua.includes('opios/')) { - return "Opera" - /* OPERA */ - ; - } else if (_isIEMobile(ua)) { - // Windows phone IEMobile browser. - return "IEMobile" - /* IEMOBILE */ - ; - } else if (ua.includes('msie') || ua.includes('trident/')) { - return "IE" - /* IE */ - ; - } else if (ua.includes('edge/')) { - return "Edge" - /* EDGE */ - ; - } else if (_isFirefox(ua)) { - return "Firefox" - /* FIREFOX */ - ; - } else if (ua.includes('silk/')) { - return "Silk" - /* SILK */ - ; - } else if (_isBlackBerry(ua)) { - // Blackberry browser. - return "Blackberry" - /* BLACKBERRY */ - ; - } else if (_isWebOS(ua)) { - // WebOS default browser. - return "Webos" - /* WEBOS */ - ; - } else if (_isSafari(ua)) { - return "Safari" - /* SAFARI */ - ; - } else if ((ua.includes('chrome/') || _isChromeIOS(ua)) && !ua.includes('edge/')) { - return "Chrome" - /* CHROME */ - ; - } else if (_isAndroid(ua)) { - // Android stock browser. - return "Android" - /* ANDROID */ - ; - } else { - // Most modern browsers have name/version at end of user agent string. - const re = /([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/; - const matches = userAgent.match(re); - - if ((matches === null || matches === void 0 ? void 0 : matches.length) === 2) { - return matches[1]; - } - } - - return "Other" - /* OTHER */ - ; -} - -function _isFirefox() { - let ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getUA)(); - return /firefox\//i.test(ua); -} - -function _isSafari() { - let userAgent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getUA)(); - const ua = userAgent.toLowerCase(); - return ua.includes('safari/') && !ua.includes('chrome/') && !ua.includes('crios/') && !ua.includes('android'); -} - -function _isChromeIOS() { - let ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getUA)(); - return /crios\//i.test(ua); -} - -function _isIEMobile() { - let ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getUA)(); - return /iemobile/i.test(ua); -} - -function _isAndroid() { - let ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getUA)(); - return /android/i.test(ua); -} - -function _isBlackBerry() { - let ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getUA)(); - return /blackberry/i.test(ua); -} - -function _isWebOS() { - let ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getUA)(); - return /webos/i.test(ua); -} - -function _isIOS() { - let ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getUA)(); - return /iphone|ipad|ipod/i.test(ua) || /macintosh/i.test(ua) && /mobile/i.test(ua); -} - -function _isIOS7Or8() { - let ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getUA)(); - return /(iPad|iPhone|iPod).*OS 7_\d/i.test(ua) || /(iPad|iPhone|iPod).*OS 8_\d/i.test(ua); -} - -function _isIOSStandalone() { - let ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getUA)(); - - var _a; - - return _isIOS(ua) && !!((_a = window.navigator) === null || _a === void 0 ? void 0 : _a.standalone); -} - -function _isIE10() { - return (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.isIE)() && document.documentMode === 10; -} - -function _isMobileBrowser() { - let ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getUA)(); - // TODO: implement getBrowserName equivalent for OS. - return _isIOS(ua) || _isAndroid(ua) || _isWebOS(ua) || _isBlackBerry(ua) || /windows phone/i.test(ua) || _isIEMobile(ua); -} - -function _isIframe() { - try { - // Check that the current window is not the top window. - // If so, return true. - return !!(window && window !== window.top); - } catch (e) { - return false; - } -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Determine the SDK version string - */ - - -function _getClientVersion(clientPlatform) { - let frameworks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; - let reportedPlatform; - - switch (clientPlatform) { - case "Browser" - /* BROWSER */ - : - // In a browser environment, report the browser name. - reportedPlatform = _getBrowserName((0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getUA)()); - break; - - case "Worker" - /* WORKER */ - : - // Technically a worker runs from a browser but we need to differentiate a - // worker from a browser. - // For example: Chrome-Worker/JsCore/4.9.1/FirebaseCore-web. - reportedPlatform = `${_getBrowserName((0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getUA)())}-${clientPlatform}`; - break; - - default: - reportedPlatform = clientPlatform; - } - - const reportedFrameworks = frameworks.length ? frameworks.join(',') : 'FirebaseCore-web'; - /* default value if no other framework is used */ - - return `${reportedPlatform}/${"JsCore" - /* CORE */ - }/${_firebase_app__WEBPACK_IMPORTED_MODULE_1__.SDK_VERSION}/${reportedFrameworks}`; -} -/** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class AuthMiddlewareQueue { - constructor(auth) { - this.auth = auth; - this.queue = []; - } - - pushCallback(callback, onAbort) { - // The callback could be sync or async. Wrap it into a - // function that is always async. - const wrappedCallback = user => new Promise((resolve, reject) => { - try { - const result = callback(user); // Either resolve with existing promise or wrap a non-promise - // return value into a promise. - - resolve(result); - } catch (e) { - // Sync callback throws. - reject(e); - } - }); // Attach the onAbort if present - - - wrappedCallback.onAbort = onAbort; - this.queue.push(wrappedCallback); - const index = this.queue.length - 1; - return () => { - // Unsubscribe. Replace with no-op. Do not remove from array, or it will disturb - // indexing of other elements. - this.queue[index] = () => Promise.resolve(); - }; - } - - async runMiddleware(nextUser) { - var _a; - - if (this.auth.currentUser === nextUser) { - return; - } // While running the middleware, build a temporary stack of onAbort - // callbacks to call if one middleware callback rejects. - - - const onAbortStack = []; - - try { - for (const beforeStateCallback of this.queue) { - await beforeStateCallback(nextUser); // Only push the onAbort if the callback succeeds - - if (beforeStateCallback.onAbort) { - onAbortStack.push(beforeStateCallback.onAbort); - } - } - } catch (e) { - // Run all onAbort, with separate try/catch to ignore any errors and - // continue - onAbortStack.reverse(); - - for (const onAbort of onAbortStack) { - try { - onAbort(); - } catch (_) { - /* swallow error */ - } - } - - throw this.auth._errorFactory.create("login-blocked" - /* LOGIN_BLOCKED */ - , { - originalMessage: (_a = e) === null || _a === void 0 ? void 0 : _a.message - }); - } - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class AuthImpl { - constructor(app, heartbeatServiceProvider, config) { - this.app = app; - this.heartbeatServiceProvider = heartbeatServiceProvider; - this.config = config; - this.currentUser = null; - this.emulatorConfig = null; - this.operations = Promise.resolve(); - this.authStateSubscription = new Subscription(this); - this.idTokenSubscription = new Subscription(this); - this.beforeStateQueue = new AuthMiddlewareQueue(this); - this.redirectUser = null; - this.isProactiveRefreshEnabled = false; // Any network calls will set this to true and prevent subsequent emulator - // initialization - - this._canInitEmulator = true; - this._isInitialized = false; - this._deleted = false; - this._initializationPromise = null; - this._popupRedirectResolver = null; - this._errorFactory = _DEFAULT_AUTH_ERROR_FACTORY; // Tracks the last notified UID for state change listeners to prevent - // repeated calls to the callbacks. Undefined means it's never been - // called, whereas null means it's been called with a signed out user - - this.lastNotifiedUid = undefined; - this.languageCode = null; - this.tenantId = null; - this.settings = { - appVerificationDisabledForTesting: false - }; - this.frameworks = []; - this.name = app.name; - this.clientVersion = config.sdkClientVersion; - } - - _initializeWithPersistence(persistenceHierarchy, popupRedirectResolver) { - if (popupRedirectResolver) { - this._popupRedirectResolver = _getInstance(popupRedirectResolver); - } // Have to check for app deletion throughout initialization (after each - // promise resolution) - - - this._initializationPromise = this.queue(async () => { - var _a, _b; - - if (this._deleted) { - return; - } - - this.persistenceManager = await PersistenceUserManager.create(this, persistenceHierarchy); - - if (this._deleted) { - return; - } // Initialize the resolver early if necessary (only applicable to web: - // this will cause the iframe to load immediately in certain cases) - - - if ((_a = this._popupRedirectResolver) === null || _a === void 0 ? void 0 : _a._shouldInitProactively) { - // If this fails, don't halt auth loading - try { - await this._popupRedirectResolver._initialize(this); - } catch (e) { - /* Ignore the error */ - } - } - - await this.initializeCurrentUser(popupRedirectResolver); - this.lastNotifiedUid = ((_b = this.currentUser) === null || _b === void 0 ? void 0 : _b.uid) || null; - - if (this._deleted) { - return; - } - - this._isInitialized = true; - }); - return this._initializationPromise; - } - /** - * If the persistence is changed in another window, the user manager will let us know - */ - - - async _onStorageEvent() { - if (this._deleted) { - return; - } - - const user = await this.assertedPersistence.getCurrentUser(); - - if (!this.currentUser && !user) { - // No change, do nothing (was signed out and remained signed out). - return; - } // If the same user is to be synchronized. - - - if (this.currentUser && user && this.currentUser.uid === user.uid) { - // Data update, simply copy data changes. - this._currentUser._assign(user); // If tokens changed from previous user tokens, this will trigger - // notifyAuthListeners_. - - - await this.currentUser.getIdToken(); - return; - } // Update current Auth state. Either a new login or logout. - // Skip blocking callbacks, they should not apply to a change in another tab. - - - await this._updateCurrentUser(user, - /* skipBeforeStateCallbacks */ - true); - } - - async initializeCurrentUser(popupRedirectResolver) { - var _a; // First check to see if we have a pending redirect event. - - - const previouslyStoredUser = await this.assertedPersistence.getCurrentUser(); - let futureCurrentUser = previouslyStoredUser; - let needsTocheckMiddleware = false; - - if (popupRedirectResolver && this.config.authDomain) { - await this.getOrInitRedirectPersistenceManager(); - const redirectUserEventId = (_a = this.redirectUser) === null || _a === void 0 ? void 0 : _a._redirectEventId; - const storedUserEventId = futureCurrentUser === null || futureCurrentUser === void 0 ? void 0 : futureCurrentUser._redirectEventId; - const result = await this.tryRedirectSignIn(popupRedirectResolver); // If the stored user (i.e. the old "currentUser") has a redirectId that - // matches the redirect user, then we want to initially sign in with the - // new user object from result. - // TODO(samgho): More thoroughly test all of this - - if ((!redirectUserEventId || redirectUserEventId === storedUserEventId) && (result === null || result === void 0 ? void 0 : result.user)) { - futureCurrentUser = result.user; - needsTocheckMiddleware = true; - } - } // If no user in persistence, there is no current user. Set to null. - - - if (!futureCurrentUser) { - return this.directlySetCurrentUser(null); - } - - if (!futureCurrentUser._redirectEventId) { - // This isn't a redirect link operation, we can reload and bail. - // First though, ensure that we check the middleware is happy. - if (needsTocheckMiddleware) { - try { - await this.beforeStateQueue.runMiddleware(futureCurrentUser); - } catch (e) { - futureCurrentUser = previouslyStoredUser; // We know this is available since the bit is only set when the - // resolver is available - - this._popupRedirectResolver._overrideRedirectResult(this, () => Promise.reject(e)); - } - } - - if (futureCurrentUser) { - return this.reloadAndSetCurrentUserOrClear(futureCurrentUser); - } else { - return this.directlySetCurrentUser(null); - } - } - - _assert(this._popupRedirectResolver, this, "argument-error" - /* ARGUMENT_ERROR */ - ); - - await this.getOrInitRedirectPersistenceManager(); // If the redirect user's event ID matches the current user's event ID, - // DO NOT reload the current user, otherwise they'll be cleared from storage. - // This is important for the reauthenticateWithRedirect() flow. - - if (this.redirectUser && this.redirectUser._redirectEventId === futureCurrentUser._redirectEventId) { - return this.directlySetCurrentUser(futureCurrentUser); - } - - return this.reloadAndSetCurrentUserOrClear(futureCurrentUser); - } - - async tryRedirectSignIn(redirectResolver) { - // The redirect user needs to be checked (and signed in if available) - // during auth initialization. All of the normal sign in and link/reauth - // flows call back into auth and push things onto the promise queue. We - // need to await the result of the redirect sign in *inside the promise - // queue*. This presents a problem: we run into deadlock. See: - // ┌> [Initialization] ─────┐ - // ┌> [] │ - // └─ [getRedirectResult] <─┘ - // where [] are tasks on the queue and arrows denote awaits - // Initialization will never complete because it's waiting on something - // that's waiting for initialization to complete! - // - // Instead, this method calls getRedirectResult() (stored in - // _completeRedirectFn) with an optional parameter that instructs all of - // the underlying auth operations to skip anything that mutates auth state. - let result = null; - - try { - // We know this._popupRedirectResolver is set since redirectResolver - // is passed in. The _completeRedirectFn expects the unwrapped extern. - result = await this._popupRedirectResolver._completeRedirectFn(this, redirectResolver, true); - } catch (e) { - // Swallow any errors here; the code can retrieve them in - // getRedirectResult(). - await this._setRedirectUser(null); - } - - return result; - } - - async reloadAndSetCurrentUserOrClear(user) { - var _a; - - try { - await _reloadWithoutSaving(user); - } catch (e) { - if (((_a = e) === null || _a === void 0 ? void 0 : _a.code) !== `auth/${"network-request-failed" - /* NETWORK_REQUEST_FAILED */ - }`) { - // Something's wrong with the user's token. Log them out and remove - // them from storage - return this.directlySetCurrentUser(null); - } - } - - return this.directlySetCurrentUser(user); - } - - useDeviceLanguage() { - this.languageCode = _getUserLanguage(); - } - - async _delete() { - this._deleted = true; - } - - async updateCurrentUser(userExtern) { - // The public updateCurrentUser method needs to make a copy of the user, - // and also check that the project matches - const user = userExtern ? (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(userExtern) : null; - - if (user) { - _assert(user.auth.config.apiKey === this.config.apiKey, this, "invalid-user-token" - /* INVALID_AUTH */ - ); - } - - return this._updateCurrentUser(user && user._clone(this)); - } - - async _updateCurrentUser(user) { - let skipBeforeStateCallbacks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - - if (this._deleted) { - return; - } - - if (user) { - _assert(this.tenantId === user.tenantId, this, "tenant-id-mismatch" - /* TENANT_ID_MISMATCH */ - ); - } - - if (!skipBeforeStateCallbacks) { - await this.beforeStateQueue.runMiddleware(user); - } - - return this.queue(async () => { - await this.directlySetCurrentUser(user); - this.notifyAuthListeners(); - }); - } - - async signOut() { - // Run first, to block _setRedirectUser() if any callbacks fail. - await this.beforeStateQueue.runMiddleware(null); // Clear the redirect user when signOut is called - - if (this.redirectPersistenceManager || this._popupRedirectResolver) { - await this._setRedirectUser(null); - } // Prevent callbacks from being called again in _updateCurrentUser, as - // they were already called in the first line. - - - return this._updateCurrentUser(null, - /* skipBeforeStateCallbacks */ - true); - } - - setPersistence(persistence) { - return this.queue(async () => { - await this.assertedPersistence.setPersistence(_getInstance(persistence)); - }); - } - - _getPersistence() { - return this.assertedPersistence.persistence.type; - } - - _updateErrorMap(errorMap) { - this._errorFactory = new _firebase_util__WEBPACK_IMPORTED_MODULE_0__.ErrorFactory('auth', 'Firebase', errorMap()); - } - - onAuthStateChanged(nextOrObserver, error, completed) { - return this.registerStateListener(this.authStateSubscription, nextOrObserver, error, completed); - } - - beforeAuthStateChanged(callback, onAbort) { - return this.beforeStateQueue.pushCallback(callback, onAbort); - } - - onIdTokenChanged(nextOrObserver, error, completed) { - return this.registerStateListener(this.idTokenSubscription, nextOrObserver, error, completed); - } - - toJSON() { - var _a; - - return { - apiKey: this.config.apiKey, - authDomain: this.config.authDomain, - appName: this.name, - currentUser: (_a = this._currentUser) === null || _a === void 0 ? void 0 : _a.toJSON() - }; - } - - async _setRedirectUser(user, popupRedirectResolver) { - const redirectManager = await this.getOrInitRedirectPersistenceManager(popupRedirectResolver); - return user === null ? redirectManager.removeCurrentUser() : redirectManager.setCurrentUser(user); - } - - async getOrInitRedirectPersistenceManager(popupRedirectResolver) { - if (!this.redirectPersistenceManager) { - const resolver = popupRedirectResolver && _getInstance(popupRedirectResolver) || this._popupRedirectResolver; - - _assert(resolver, this, "argument-error" - /* ARGUMENT_ERROR */ - ); - - this.redirectPersistenceManager = await PersistenceUserManager.create(this, [_getInstance(resolver._redirectPersistence)], "redirectUser" - /* REDIRECT_USER */ - ); - this.redirectUser = await this.redirectPersistenceManager.getCurrentUser(); - } - - return this.redirectPersistenceManager; - } - - async _redirectUserForId(id) { - var _a, _b; // Make sure we've cleared any pending persistence actions if we're not in - // the initializer - - - if (this._isInitialized) { - await this.queue(async () => {}); - } - - if (((_a = this._currentUser) === null || _a === void 0 ? void 0 : _a._redirectEventId) === id) { - return this._currentUser; - } - - if (((_b = this.redirectUser) === null || _b === void 0 ? void 0 : _b._redirectEventId) === id) { - return this.redirectUser; - } - - return null; - } - - async _persistUserIfCurrent(user) { - if (user === this.currentUser) { - return this.queue(async () => this.directlySetCurrentUser(user)); - } - } - /** Notifies listeners only if the user is current */ - - - _notifyListenersIfCurrent(user) { - if (user === this.currentUser) { - this.notifyAuthListeners(); - } - } - - _key() { - return `${this.config.authDomain}:${this.config.apiKey}:${this.name}`; - } - - _startProactiveRefresh() { - this.isProactiveRefreshEnabled = true; - - if (this.currentUser) { - this._currentUser._startProactiveRefresh(); - } - } - - _stopProactiveRefresh() { - this.isProactiveRefreshEnabled = false; - - if (this.currentUser) { - this._currentUser._stopProactiveRefresh(); - } - } - /** Returns the current user cast as the internal type */ - - - get _currentUser() { - return this.currentUser; - } - - notifyAuthListeners() { - var _a, _b; - - if (!this._isInitialized) { - return; - } - - this.idTokenSubscription.next(this.currentUser); - const currentUid = (_b = (_a = this.currentUser) === null || _a === void 0 ? void 0 : _a.uid) !== null && _b !== void 0 ? _b : null; - - if (this.lastNotifiedUid !== currentUid) { - this.lastNotifiedUid = currentUid; - this.authStateSubscription.next(this.currentUser); - } - } - - registerStateListener(subscription, nextOrObserver, error, completed) { - if (this._deleted) { - return () => {}; - } - - const cb = typeof nextOrObserver === 'function' ? nextOrObserver : nextOrObserver.next.bind(nextOrObserver); - const promise = this._isInitialized ? Promise.resolve() : this._initializationPromise; - - _assert(promise, this, "internal-error" - /* INTERNAL_ERROR */ - ); // The callback needs to be called asynchronously per the spec. - // eslint-disable-next-line @typescript-eslint/no-floating-promises - - - promise.then(() => cb(this.currentUser)); - - if (typeof nextOrObserver === 'function') { - return subscription.addObserver(nextOrObserver, error, completed); - } else { - return subscription.addObserver(nextOrObserver); - } - } - /** - * Unprotected (from race conditions) method to set the current user. This - * should only be called from within a queued callback. This is necessary - * because the queue shouldn't rely on another queued callback. - */ - - - async directlySetCurrentUser(user) { - if (this.currentUser && this.currentUser !== user) { - this._currentUser._stopProactiveRefresh(); - } - - if (user && this.isProactiveRefreshEnabled) { - user._startProactiveRefresh(); - } - - this.currentUser = user; - - if (user) { - await this.assertedPersistence.setCurrentUser(user); - } else { - await this.assertedPersistence.removeCurrentUser(); - } - } - - queue(action) { - // In case something errors, the callback still should be called in order - // to keep the promise chain alive - this.operations = this.operations.then(action, action); - return this.operations; - } - - get assertedPersistence() { - _assert(this.persistenceManager, this, "internal-error" - /* INTERNAL_ERROR */ - ); - - return this.persistenceManager; - } - - _logFramework(framework) { - if (!framework || this.frameworks.includes(framework)) { - return; - } - - this.frameworks.push(framework); // Sort alphabetically so that "FirebaseCore-web,FirebaseUI-web" and - // "FirebaseUI-web,FirebaseCore-web" aren't viewed as different. - - this.frameworks.sort(); - this.clientVersion = _getClientVersion(this.config.clientPlatform, this._getFrameworks()); - } - - _getFrameworks() { - return this.frameworks; - } - - async _getAdditionalHeaders() { - var _a; // Additional headers on every request - - - const headers = { - ["X-Client-Version" - /* X_CLIENT_VERSION */ - ]: this.clientVersion - }; - - if (this.app.options.appId) { - headers["X-Firebase-gmpid" - /* X_FIREBASE_GMPID */ - ] = this.app.options.appId; - } // If the heartbeat service exists, add the heartbeat string - - - const heartbeatsHeader = await ((_a = this.heartbeatServiceProvider.getImmediate({ - optional: true - })) === null || _a === void 0 ? void 0 : _a.getHeartbeatsHeader()); - - if (heartbeatsHeader) { - headers["X-Firebase-Client" - /* X_FIREBASE_CLIENT */ - ] = heartbeatsHeader; - } - - return headers; - } - -} -/** - * Method to be used to cast down to our private implmentation of Auth. - * It will also handle unwrapping from the compat type if necessary - * - * @param auth Auth object passed in from developer - */ - - -function _castAuth(auth) { - return (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(auth); -} -/** Helper class to wrap subscriber logic */ - - -class Subscription { - constructor(auth) { - this.auth = auth; - this.observer = null; - this.addObserver = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.createSubscribe)(observer => this.observer = observer); - } - - get next() { - _assert(this.observer, this.auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - return this.observer.next.bind(this.observer); - } - -} -/** - * Changes the {@link Auth} instance to communicate with the Firebase Auth Emulator, instead of production - * Firebase Auth services. - * - * @remarks - * This must be called synchronously immediately following the first call to - * {@link initializeAuth}. Do not use with production credentials as emulator - * traffic is not encrypted. - * - * - * @example - * ```javascript - * connectAuthEmulator(auth, 'http://127.0.0.1:9099', { disableWarnings: true }); - * ``` - * - * @param auth - The {@link Auth} instance. - * @param url - The URL at which the emulator is running (eg, 'http://localhost:9099'). - * @param options - Optional. `options.disableWarnings` defaults to `false`. Set it to - * `true` to disable the warning banner attached to the DOM. - * - * @public - */ - - -function connectAuthEmulator(auth, url, options) { - const authInternal = _castAuth(auth); - - _assert(authInternal._canInitEmulator, authInternal, "emulator-config-failed" - /* EMULATOR_CONFIG_FAILED */ - ); - - _assert(/^https?:\/\//.test(url), authInternal, "invalid-emulator-scheme" - /* INVALID_EMULATOR_SCHEME */ - ); - - const disableWarnings = !!(options === null || options === void 0 ? void 0 : options.disableWarnings); - const protocol = extractProtocol(url); - const { - host, - port - } = extractHostAndPort(url); - const portStr = port === null ? '' : `:${port}`; // Always replace path with "/" (even if input url had no path at all, or had a different one). - - authInternal.config.emulator = { - url: `${protocol}//${host}${portStr}/` - }; - authInternal.settings.appVerificationDisabledForTesting = true; - authInternal.emulatorConfig = Object.freeze({ - host, - port, - protocol: protocol.replace(':', ''), - options: Object.freeze({ - disableWarnings - }) - }); - - if (!disableWarnings) { - emitEmulatorWarning(); - } -} - -function extractProtocol(url) { - const protocolEnd = url.indexOf(':'); - return protocolEnd < 0 ? '' : url.substr(0, protocolEnd + 1); -} - -function extractHostAndPort(url) { - const protocol = extractProtocol(url); - const authority = /(\/\/)?([^?#/]+)/.exec(url.substr(protocol.length)); // Between // and /, ? or #. - - if (!authority) { - return { - host: '', - port: null - }; - } - - const hostAndPort = authority[2].split('@').pop() || ''; // Strip out "username:password@". - - const bracketedIPv6 = /^(\[[^\]]+\])(:|$)/.exec(hostAndPort); - - if (bracketedIPv6) { - const host = bracketedIPv6[1]; - return { - host, - port: parsePort(hostAndPort.substr(host.length + 1)) - }; - } else { - const [host, port] = hostAndPort.split(':'); - return { - host, - port: parsePort(port) - }; - } -} - -function parsePort(portStr) { - if (!portStr) { - return null; - } - - const port = Number(portStr); - - if (isNaN(port)) { - return null; - } - - return port; -} - -function emitEmulatorWarning() { - function attachBanner() { - const el = document.createElement('p'); - const sty = el.style; - el.innerText = 'Running in emulator mode. Do not use with production credentials.'; - sty.position = 'fixed'; - sty.width = '100%'; - sty.backgroundColor = '#ffffff'; - sty.border = '.1em solid #000000'; - sty.color = '#b50000'; - sty.bottom = '0px'; - sty.left = '0px'; - sty.margin = '0px'; - sty.zIndex = '10000'; - sty.textAlign = 'center'; - el.classList.add('firebase-emulator-warning'); - document.body.appendChild(el); - } - - if (typeof console !== 'undefined' && typeof console.info === 'function') { - console.info('WARNING: You are using the Auth Emulator,' + ' which is intended for local testing only. Do not use with' + ' production credentials.'); - } - - if (typeof window !== 'undefined' && typeof document !== 'undefined') { - if (document.readyState === 'loading') { - window.addEventListener('DOMContentLoaded', attachBanner); - } else { - attachBanner(); - } - } -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Interface that represents the credentials returned by an {@link AuthProvider}. - * - * @remarks - * Implementations specify the details about each auth provider's credential requirements. - * - * @public - */ - - -class AuthCredential { - /** @internal */ - constructor( - /** - * The authentication provider ID for the credential. - * - * @remarks - * For example, 'facebook.com', or 'google.com'. - */ - providerId, - /** - * The authentication sign in method for the credential. - * - * @remarks - * For example, {@link SignInMethod}.EMAIL_PASSWORD, or - * {@link SignInMethod}.EMAIL_LINK. This corresponds to the sign-in method - * identifier as returned in {@link fetchSignInMethodsForEmail}. - */ - signInMethod) { - this.providerId = providerId; - this.signInMethod = signInMethod; - } - /** - * Returns a JSON-serializable representation of this object. - * - * @returns a JSON-serializable representation of this object. - */ - - - toJSON() { - return debugFail('not implemented'); - } - /** @internal */ - - - _getIdTokenResponse(_auth) { - return debugFail('not implemented'); - } - /** @internal */ - - - _linkToIdToken(_auth, _idToken) { - return debugFail('not implemented'); - } - /** @internal */ - - - _getReauthenticationResolver(_auth) { - return debugFail('not implemented'); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -async function resetPassword(auth, request) { - return _performApiRequest(auth, "POST" - /* POST */ - , "/v1/accounts:resetPassword" - /* RESET_PASSWORD */ - , _addTidIfNecessary(auth, request)); -} - -async function updateEmailPassword(auth, request) { - return _performApiRequest(auth, "POST" - /* POST */ - , "/v1/accounts:update" - /* SET_ACCOUNT_INFO */ - , request); -} - -async function applyActionCode$1(auth, request) { - return _performApiRequest(auth, "POST" - /* POST */ - , "/v1/accounts:update" - /* SET_ACCOUNT_INFO */ - , _addTidIfNecessary(auth, request)); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -async function signInWithPassword(auth, request) { - return _performSignInRequest(auth, "POST" - /* POST */ - , "/v1/accounts:signInWithPassword" - /* SIGN_IN_WITH_PASSWORD */ - , _addTidIfNecessary(auth, request)); -} - -async function sendOobCode(auth, request) { - return _performApiRequest(auth, "POST" - /* POST */ - , "/v1/accounts:sendOobCode" - /* SEND_OOB_CODE */ - , _addTidIfNecessary(auth, request)); -} - -async function sendEmailVerification$1(auth, request) { - return sendOobCode(auth, request); -} - -async function sendPasswordResetEmail$1(auth, request) { - return sendOobCode(auth, request); -} - -async function sendSignInLinkToEmail$1(auth, request) { - return sendOobCode(auth, request); -} - -async function verifyAndChangeEmail(auth, request) { - return sendOobCode(auth, request); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -async function signInWithEmailLink$1(auth, request) { - return _performSignInRequest(auth, "POST" - /* POST */ - , "/v1/accounts:signInWithEmailLink" - /* SIGN_IN_WITH_EMAIL_LINK */ - , _addTidIfNecessary(auth, request)); -} - -async function signInWithEmailLinkForLinking(auth, request) { - return _performSignInRequest(auth, "POST" - /* POST */ - , "/v1/accounts:signInWithEmailLink" - /* SIGN_IN_WITH_EMAIL_LINK */ - , _addTidIfNecessary(auth, request)); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Interface that represents the credentials returned by {@link EmailAuthProvider} for - * {@link ProviderId}.PASSWORD - * - * @remarks - * Covers both {@link SignInMethod}.EMAIL_PASSWORD and - * {@link SignInMethod}.EMAIL_LINK. - * - * @public - */ - - -class EmailAuthCredential extends AuthCredential { - /** @internal */ - constructor( - /** @internal */ - _email, - /** @internal */ - _password, signInMethod) { - let _tenantId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; - - super("password" - /* PASSWORD */ - , signInMethod); - this._email = _email; - this._password = _password; - this._tenantId = _tenantId; - } - /** @internal */ - - - static _fromEmailAndPassword(email, password) { - return new EmailAuthCredential(email, password, "password" - /* EMAIL_PASSWORD */ - ); - } - /** @internal */ - - - static _fromEmailAndCode(email, oobCode) { - let tenantId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; - return new EmailAuthCredential(email, oobCode, "emailLink" - /* EMAIL_LINK */ - , tenantId); - } - /** {@inheritdoc AuthCredential.toJSON} */ - - - toJSON() { - return { - email: this._email, - password: this._password, - signInMethod: this.signInMethod, - tenantId: this._tenantId - }; - } - /** - * Static method to deserialize a JSON representation of an object into an {@link AuthCredential}. - * - * @param json - Either `object` or the stringified representation of the object. When string is - * provided, `JSON.parse` would be called first. - * - * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned. - */ - - - static fromJSON(json) { - const obj = typeof json === 'string' ? JSON.parse(json) : json; - - if ((obj === null || obj === void 0 ? void 0 : obj.email) && (obj === null || obj === void 0 ? void 0 : obj.password)) { - if (obj.signInMethod === "password" - /* EMAIL_PASSWORD */ - ) { - return this._fromEmailAndPassword(obj.email, obj.password); - } else if (obj.signInMethod === "emailLink" - /* EMAIL_LINK */ - ) { - return this._fromEmailAndCode(obj.email, obj.password, obj.tenantId); - } - } - - return null; - } - /** @internal */ - - - async _getIdTokenResponse(auth) { - switch (this.signInMethod) { - case "password" - /* EMAIL_PASSWORD */ - : - return signInWithPassword(auth, { - returnSecureToken: true, - email: this._email, - password: this._password - }); - - case "emailLink" - /* EMAIL_LINK */ - : - return signInWithEmailLink$1(auth, { - email: this._email, - oobCode: this._password - }); - - default: - _fail(auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - } - } - /** @internal */ - - - async _linkToIdToken(auth, idToken) { - switch (this.signInMethod) { - case "password" - /* EMAIL_PASSWORD */ - : - return updateEmailPassword(auth, { - idToken, - returnSecureToken: true, - email: this._email, - password: this._password - }); - - case "emailLink" - /* EMAIL_LINK */ - : - return signInWithEmailLinkForLinking(auth, { - idToken, - email: this._email, - oobCode: this._password - }); - - default: - _fail(auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - } - } - /** @internal */ - - - _getReauthenticationResolver(auth) { - return this._getIdTokenResponse(auth); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -async function signInWithIdp(auth, request) { - return _performSignInRequest(auth, "POST" - /* POST */ - , "/v1/accounts:signInWithIdp" - /* SIGN_IN_WITH_IDP */ - , _addTidIfNecessary(auth, request)); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const IDP_REQUEST_URI$1 = 'http://localhost'; -/** - * Represents the OAuth credentials returned by an {@link OAuthProvider}. - * - * @remarks - * Implementations specify the details about each auth provider's credential requirements. - * - * @public - */ - -class OAuthCredential extends AuthCredential { - constructor() { - super(...arguments); - this.pendingToken = null; - } - /** @internal */ - - - static _fromParams(params) { - const cred = new OAuthCredential(params.providerId, params.signInMethod); - - if (params.idToken || params.accessToken) { - // OAuth 2 and either ID token or access token. - if (params.idToken) { - cred.idToken = params.idToken; - } - - if (params.accessToken) { - cred.accessToken = params.accessToken; - } // Add nonce if available and no pendingToken is present. - - - if (params.nonce && !params.pendingToken) { - cred.nonce = params.nonce; - } - - if (params.pendingToken) { - cred.pendingToken = params.pendingToken; - } - } else if (params.oauthToken && params.oauthTokenSecret) { - // OAuth 1 and OAuth token with token secret - cred.accessToken = params.oauthToken; - cred.secret = params.oauthTokenSecret; - } else { - _fail("argument-error" - /* ARGUMENT_ERROR */ - ); - } - - return cred; - } - /** {@inheritdoc AuthCredential.toJSON} */ - - - toJSON() { - return { - idToken: this.idToken, - accessToken: this.accessToken, - secret: this.secret, - nonce: this.nonce, - pendingToken: this.pendingToken, - providerId: this.providerId, - signInMethod: this.signInMethod - }; - } - /** - * Static method to deserialize a JSON representation of an object into an - * {@link AuthCredential}. - * - * @param json - Input can be either Object or the stringified representation of the object. - * When string is provided, JSON.parse would be called first. - * - * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned. - */ - - - static fromJSON(json) { - const obj = typeof json === 'string' ? JSON.parse(json) : json; - - const { - providerId, - signInMethod - } = obj, - rest = (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__rest)(obj, ["providerId", "signInMethod"]); - - if (!providerId || !signInMethod) { - return null; - } - - const cred = new OAuthCredential(providerId, signInMethod); - cred.idToken = rest.idToken || undefined; - cred.accessToken = rest.accessToken || undefined; - cred.secret = rest.secret; - cred.nonce = rest.nonce; - cred.pendingToken = rest.pendingToken || null; - return cred; - } - /** @internal */ - - - _getIdTokenResponse(auth) { - const request = this.buildRequest(); - return signInWithIdp(auth, request); - } - /** @internal */ - - - _linkToIdToken(auth, idToken) { - const request = this.buildRequest(); - request.idToken = idToken; - return signInWithIdp(auth, request); - } - /** @internal */ - - - _getReauthenticationResolver(auth) { - const request = this.buildRequest(); - request.autoCreate = false; - return signInWithIdp(auth, request); - } - - buildRequest() { - const request = { - requestUri: IDP_REQUEST_URI$1, - returnSecureToken: true - }; - - if (this.pendingToken) { - request.pendingToken = this.pendingToken; - } else { - const postBody = {}; - - if (this.idToken) { - postBody['id_token'] = this.idToken; - } - - if (this.accessToken) { - postBody['access_token'] = this.accessToken; - } - - if (this.secret) { - postBody['oauth_token_secret'] = this.secret; - } - - postBody['providerId'] = this.providerId; - - if (this.nonce && !this.pendingToken) { - postBody['nonce'] = this.nonce; - } - - request.postBody = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.querystring)(postBody); - } - - return request; - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -async function sendPhoneVerificationCode(auth, request) { - return _performApiRequest(auth, "POST" - /* POST */ - , "/v1/accounts:sendVerificationCode" - /* SEND_VERIFICATION_CODE */ - , _addTidIfNecessary(auth, request)); -} - -async function signInWithPhoneNumber$1(auth, request) { - return _performSignInRequest(auth, "POST" - /* POST */ - , "/v1/accounts:signInWithPhoneNumber" - /* SIGN_IN_WITH_PHONE_NUMBER */ - , _addTidIfNecessary(auth, request)); -} - -async function linkWithPhoneNumber$1(auth, request) { - const response = await _performSignInRequest(auth, "POST" - /* POST */ - , "/v1/accounts:signInWithPhoneNumber" - /* SIGN_IN_WITH_PHONE_NUMBER */ - , _addTidIfNecessary(auth, request)); - - if (response.temporaryProof) { - throw _makeTaggedError(auth, "account-exists-with-different-credential" - /* NEED_CONFIRMATION */ - , response); - } - - return response; -} - -const VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_ = { - ["USER_NOT_FOUND" - /* USER_NOT_FOUND */ - ]: "user-not-found" - /* USER_DELETED */ - -}; - -async function verifyPhoneNumberForExisting(auth, request) { - const apiRequest = Object.assign(Object.assign({}, request), { - operation: 'REAUTH' - }); - return _performSignInRequest(auth, "POST" - /* POST */ - , "/v1/accounts:signInWithPhoneNumber" - /* SIGN_IN_WITH_PHONE_NUMBER */ - , _addTidIfNecessary(auth, apiRequest), VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Represents the credentials returned by {@link PhoneAuthProvider}. - * - * @public - */ - - -class PhoneAuthCredential extends AuthCredential { - constructor(params) { - super("phone" - /* PHONE */ - , "phone" - /* PHONE */ - ); - this.params = params; - } - /** @internal */ - - - static _fromVerification(verificationId, verificationCode) { - return new PhoneAuthCredential({ - verificationId, - verificationCode - }); - } - /** @internal */ - - - static _fromTokenResponse(phoneNumber, temporaryProof) { - return new PhoneAuthCredential({ - phoneNumber, - temporaryProof - }); - } - /** @internal */ - - - _getIdTokenResponse(auth) { - return signInWithPhoneNumber$1(auth, this._makeVerificationRequest()); - } - /** @internal */ - - - _linkToIdToken(auth, idToken) { - return linkWithPhoneNumber$1(auth, Object.assign({ - idToken - }, this._makeVerificationRequest())); - } - /** @internal */ - - - _getReauthenticationResolver(auth) { - return verifyPhoneNumberForExisting(auth, this._makeVerificationRequest()); - } - /** @internal */ - - - _makeVerificationRequest() { - const { - temporaryProof, - phoneNumber, - verificationId, - verificationCode - } = this.params; - - if (temporaryProof && phoneNumber) { - return { - temporaryProof, - phoneNumber - }; - } - - return { - sessionInfo: verificationId, - code: verificationCode - }; - } - /** {@inheritdoc AuthCredential.toJSON} */ - - - toJSON() { - const obj = { - providerId: this.providerId - }; - - if (this.params.phoneNumber) { - obj.phoneNumber = this.params.phoneNumber; - } - - if (this.params.temporaryProof) { - obj.temporaryProof = this.params.temporaryProof; - } - - if (this.params.verificationCode) { - obj.verificationCode = this.params.verificationCode; - } - - if (this.params.verificationId) { - obj.verificationId = this.params.verificationId; - } - - return obj; - } - /** Generates a phone credential based on a plain object or a JSON string. */ - - - static fromJSON(json) { - if (typeof json === 'string') { - json = JSON.parse(json); - } - - const { - verificationId, - verificationCode, - phoneNumber, - temporaryProof - } = json; - - if (!verificationCode && !verificationId && !phoneNumber && !temporaryProof) { - return null; - } - - return new PhoneAuthCredential({ - verificationId, - verificationCode, - phoneNumber, - temporaryProof - }); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Maps the mode string in action code URL to Action Code Info operation. - * - * @param mode - */ - - -function parseMode(mode) { - switch (mode) { - case 'recoverEmail': - return "RECOVER_EMAIL" - /* RECOVER_EMAIL */ - ; - - case 'resetPassword': - return "PASSWORD_RESET" - /* PASSWORD_RESET */ - ; - - case 'signIn': - return "EMAIL_SIGNIN" - /* EMAIL_SIGNIN */ - ; - - case 'verifyEmail': - return "VERIFY_EMAIL" - /* VERIFY_EMAIL */ - ; - - case 'verifyAndChangeEmail': - return "VERIFY_AND_CHANGE_EMAIL" - /* VERIFY_AND_CHANGE_EMAIL */ - ; - - case 'revertSecondFactorAddition': - return "REVERT_SECOND_FACTOR_ADDITION" - /* REVERT_SECOND_FACTOR_ADDITION */ - ; - - default: - return null; - } -} -/** - * Helper to parse FDL links - * - * @param url - */ - - -function parseDeepLink(url) { - const link = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.querystringDecode)((0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.extractQuerystring)(url))['link']; // Double link case (automatic redirect). - - const doubleDeepLink = link ? (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.querystringDecode)((0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.extractQuerystring)(link))['deep_link_id'] : null; // iOS custom scheme links. - - const iOSDeepLink = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.querystringDecode)((0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.extractQuerystring)(url))['deep_link_id']; - const iOSDoubleDeepLink = iOSDeepLink ? (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.querystringDecode)((0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.extractQuerystring)(iOSDeepLink))['link'] : null; - return iOSDoubleDeepLink || iOSDeepLink || doubleDeepLink || link || url; -} -/** - * A utility class to parse email action URLs such as password reset, email verification, - * email link sign in, etc. - * - * @public - */ - - -class ActionCodeURL { - /** - * @param actionLink - The link from which to extract the URL. - * @returns The {@link ActionCodeURL} object, or null if the link is invalid. - * - * @internal - */ - constructor(actionLink) { - var _a, _b, _c, _d, _e, _f; - - const searchParams = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.querystringDecode)((0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.extractQuerystring)(actionLink)); - const apiKey = (_a = searchParams["apiKey" - /* API_KEY */ - ]) !== null && _a !== void 0 ? _a : null; - const code = (_b = searchParams["oobCode" - /* CODE */ - ]) !== null && _b !== void 0 ? _b : null; - const operation = parseMode((_c = searchParams["mode" - /* MODE */ - ]) !== null && _c !== void 0 ? _c : null); // Validate API key, code and mode. - - _assert(apiKey && code && operation, "argument-error" - /* ARGUMENT_ERROR */ - ); - - this.apiKey = apiKey; - this.operation = operation; - this.code = code; - this.continueUrl = (_d = searchParams["continueUrl" - /* CONTINUE_URL */ - ]) !== null && _d !== void 0 ? _d : null; - this.languageCode = (_e = searchParams["languageCode" - /* LANGUAGE_CODE */ - ]) !== null && _e !== void 0 ? _e : null; - this.tenantId = (_f = searchParams["tenantId" - /* TENANT_ID */ - ]) !== null && _f !== void 0 ? _f : null; - } - /** - * Parses the email action link string and returns an {@link ActionCodeURL} if the link is valid, - * otherwise returns null. - * - * @param link - The email action link string. - * @returns The {@link ActionCodeURL} object, or null if the link is invalid. - * - * @public - */ - - - static parseLink(link) { - const actionLink = parseDeepLink(link); - - try { - return new ActionCodeURL(actionLink); - } catch (_a) { - return null; - } - } - -} -/** - * Parses the email action link string and returns an {@link ActionCodeURL} if - * the link is valid, otherwise returns null. - * - * @public - */ - - -function parseActionCodeURL(link) { - return ActionCodeURL.parseLink(link); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Provider for generating {@link EmailAuthCredential}. - * - * @public - */ - - -class EmailAuthProvider { - constructor() { - /** - * Always set to {@link ProviderId}.PASSWORD, even for email link. - */ - this.providerId = EmailAuthProvider.PROVIDER_ID; - } - /** - * Initialize an {@link AuthCredential} using an email and password. - * - * @example - * ```javascript - * const authCredential = EmailAuthProvider.credential(email, password); - * const userCredential = await signInWithCredential(auth, authCredential); - * ``` - * - * @example - * ```javascript - * const userCredential = await signInWithEmailAndPassword(auth, email, password); - * ``` - * - * @param email - Email address. - * @param password - User account password. - * @returns The auth provider credential. - */ - - - static credential(email, password) { - return EmailAuthCredential._fromEmailAndPassword(email, password); - } - /** - * Initialize an {@link AuthCredential} using an email and an email link after a sign in with - * email link operation. - * - * @example - * ```javascript - * const authCredential = EmailAuthProvider.credentialWithLink(auth, email, emailLink); - * const userCredential = await signInWithCredential(auth, authCredential); - * ``` - * - * @example - * ```javascript - * await sendSignInLinkToEmail(auth, email); - * // Obtain emailLink from user. - * const userCredential = await signInWithEmailLink(auth, email, emailLink); - * ``` - * - * @param auth - The {@link Auth} instance used to verify the link. - * @param email - Email address. - * @param emailLink - Sign-in email link. - * @returns - The auth provider credential. - */ - - - static credentialWithLink(email, emailLink) { - const actionCodeUrl = ActionCodeURL.parseLink(emailLink); - - _assert(actionCodeUrl, "argument-error" - /* ARGUMENT_ERROR */ - ); - - return EmailAuthCredential._fromEmailAndCode(email, actionCodeUrl.code, actionCodeUrl.tenantId); - } - -} -/** - * Always set to {@link ProviderId}.PASSWORD, even for email link. - */ - - -EmailAuthProvider.PROVIDER_ID = "password" -/* PASSWORD */ -; -/** - * Always set to {@link SignInMethod}.EMAIL_PASSWORD. - */ - -EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD = "password" -/* EMAIL_PASSWORD */ -; -/** - * Always set to {@link SignInMethod}.EMAIL_LINK. - */ - -EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD = "emailLink" -/* EMAIL_LINK */ -; -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * The base class for all Federated providers (OAuth (including OIDC), SAML). - * - * This class is not meant to be instantiated directly. - * - * @public - */ - -class FederatedAuthProvider { - /** - * Constructor for generic OAuth providers. - * - * @param providerId - Provider for which credentials should be generated. - */ - constructor(providerId) { - this.providerId = providerId; - /** @internal */ - - this.defaultLanguageCode = null; - /** @internal */ - - this.customParameters = {}; - } - /** - * Set the language gode. - * - * @param languageCode - language code - */ - - - setDefaultLanguage(languageCode) { - this.defaultLanguageCode = languageCode; - } - /** - * Sets the OAuth custom parameters to pass in an OAuth request for popup and redirect sign-in - * operations. - * - * @remarks - * For a detailed list, check the reserved required OAuth 2.0 parameters such as `client_id`, - * `redirect_uri`, `scope`, `response_type`, and `state` are not allowed and will be ignored. - * - * @param customOAuthParameters - The custom OAuth parameters to pass in the OAuth request. - */ - - - setCustomParameters(customOAuthParameters) { - this.customParameters = customOAuthParameters; - return this; - } - /** - * Retrieve the current list of {@link CustomParameters}. - */ - - - getCustomParameters() { - return this.customParameters; - } - -} -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Common code to all OAuth providers. This is separate from the - * {@link OAuthProvider} so that child providers (like - * {@link GoogleAuthProvider}) don't inherit the `credential` instance method. - * Instead, they rely on a static `credential` method. - */ - - -class BaseOAuthProvider extends FederatedAuthProvider { - constructor() { - super(...arguments); - /** @internal */ - - this.scopes = []; - } - /** - * Add an OAuth scope to the credential. - * - * @param scope - Provider OAuth scope to add. - */ - - - addScope(scope) { - // If not already added, add scope to list. - if (!this.scopes.includes(scope)) { - this.scopes.push(scope); - } - - return this; - } - /** - * Retrieve the current list of OAuth scopes. - */ - - - getScopes() { - return [...this.scopes]; - } - -} -/** - * Provider for generating generic {@link OAuthCredential}. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new OAuthProvider('google.com'); - * // Start a sign in process for an unauthenticated user. - * provider.addScope('profile'); - * provider.addScope('email'); - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a OAuth Access Token for the provider. - * const credential = provider.credentialFromResult(auth, result); - * const token = credential.accessToken; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new OAuthProvider('google.com'); - * provider.addScope('profile'); - * provider.addScope('email'); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a OAuth Access Token for the provider. - * const credential = provider.credentialFromResult(auth, result); - * const token = credential.accessToken; - * ``` - * @public - */ - - -class OAuthProvider extends BaseOAuthProvider { - /** - * Creates an {@link OAuthCredential} from a JSON string or a plain object. - * @param json - A plain object or a JSON string - */ - static credentialFromJSON(json) { - const obj = typeof json === 'string' ? JSON.parse(json) : json; - - _assert('providerId' in obj && 'signInMethod' in obj, "argument-error" - /* ARGUMENT_ERROR */ - ); - - return OAuthCredential._fromParams(obj); - } - /** - * Creates a {@link OAuthCredential} from a generic OAuth provider's access token or ID token. - * - * @remarks - * The raw nonce is required when an ID token with a nonce field is provided. The SHA-256 hash of - * the raw nonce must match the nonce field in the ID token. - * - * @example - * ```javascript - * // `googleUser` from the onsuccess Google Sign In callback. - * // Initialize a generate OAuth provider with a `google.com` providerId. - * const provider = new OAuthProvider('google.com'); - * const credential = provider.credential({ - * idToken: googleUser.getAuthResponse().id_token, - * }); - * const result = await signInWithCredential(credential); - * ``` - * - * @param params - Either the options object containing the ID token, access token and raw nonce - * or the ID token string. - */ - - - credential(params) { - return this._credential(Object.assign(Object.assign({}, params), { - nonce: params.rawNonce - })); - } - /** An internal credential method that accepts more permissive options */ - - - _credential(params) { - _assert(params.idToken || params.accessToken, "argument-error" - /* ARGUMENT_ERROR */ - ); // For OAuthCredential, sign in method is same as providerId. - - - return OAuthCredential._fromParams(Object.assign(Object.assign({}, params), { - providerId: this.providerId, - signInMethod: this.providerId - })); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - - - static credentialFromResult(userCredential) { - return OAuthProvider.oauthCredentialFromTaggedObject(userCredential); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - - - static credentialFromError(error) { - return OAuthProvider.oauthCredentialFromTaggedObject(error.customData || {}); - } - - static oauthCredentialFromTaggedObject(_ref2) { - let { - _tokenResponse: tokenResponse - } = _ref2; - - if (!tokenResponse) { - return null; - } - - const { - oauthIdToken, - oauthAccessToken, - oauthTokenSecret, - pendingToken, - nonce, - providerId - } = tokenResponse; - - if (!oauthAccessToken && !oauthTokenSecret && !oauthIdToken && !pendingToken) { - return null; - } - - if (!providerId) { - return null; - } - - try { - return new OAuthProvider(providerId)._credential({ - idToken: oauthIdToken, - accessToken: oauthAccessToken, - nonce, - pendingToken - }); - } catch (e) { - return null; - } - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.FACEBOOK. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new FacebookAuthProvider(); - * // Start a sign in process for an unauthenticated user. - * provider.addScope('user_birthday'); - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Facebook Access Token. - * const credential = FacebookAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new FacebookAuthProvider(); - * provider.addScope('user_birthday'); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a Facebook Access Token. - * const credential = FacebookAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * ``` - * - * @public - */ - - -class FacebookAuthProvider extends BaseOAuthProvider { - constructor() { - super("facebook.com" - /* FACEBOOK */ - ); - } - /** - * Creates a credential for Facebook. - * - * @example - * ```javascript - * // `event` from the Facebook auth.authResponseChange callback. - * const credential = FacebookAuthProvider.credential(event.authResponse.accessToken); - * const result = await signInWithCredential(credential); - * ``` - * - * @param accessToken - Facebook access token. - */ - - - static credential(accessToken) { - return OAuthCredential._fromParams({ - providerId: FacebookAuthProvider.PROVIDER_ID, - signInMethod: FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD, - accessToken - }); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - - - static credentialFromResult(userCredential) { - return FacebookAuthProvider.credentialFromTaggedObject(userCredential); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - - - static credentialFromError(error) { - return FacebookAuthProvider.credentialFromTaggedObject(error.customData || {}); - } - - static credentialFromTaggedObject(_ref3) { - let { - _tokenResponse: tokenResponse - } = _ref3; - - if (!tokenResponse || !('oauthAccessToken' in tokenResponse)) { - return null; - } - - if (!tokenResponse.oauthAccessToken) { - return null; - } - - try { - return FacebookAuthProvider.credential(tokenResponse.oauthAccessToken); - } catch (_a) { - return null; - } - } - -} -/** Always set to {@link SignInMethod}.FACEBOOK. */ - - -FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD = "facebook.com" -/* FACEBOOK */ -; -/** Always set to {@link ProviderId}.FACEBOOK. */ - -FacebookAuthProvider.PROVIDER_ID = "facebook.com" -/* FACEBOOK */ -; -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Provider for generating an an {@link OAuthCredential} for {@link ProviderId}.GOOGLE. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new GoogleAuthProvider(); - * // Start a sign in process for an unauthenticated user. - * provider.addScope('profile'); - * provider.addScope('email'); - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Google Access Token. - * const credential = GoogleAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new GoogleAuthProvider(); - * provider.addScope('profile'); - * provider.addScope('email'); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a Google Access Token. - * const credential = GoogleAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * ``` - * - * @public - */ - -class GoogleAuthProvider extends BaseOAuthProvider { - constructor() { - super("google.com" - /* GOOGLE */ - ); - this.addScope('profile'); - } - /** - * Creates a credential for Google. At least one of ID token and access token is required. - * - * @example - * ```javascript - * // \`googleUser\` from the onsuccess Google Sign In callback. - * const credential = GoogleAuthProvider.credential(googleUser.getAuthResponse().id_token); - * const result = await signInWithCredential(credential); - * ``` - * - * @param idToken - Google ID token. - * @param accessToken - Google access token. - */ - - - static credential(idToken, accessToken) { - return OAuthCredential._fromParams({ - providerId: GoogleAuthProvider.PROVIDER_ID, - signInMethod: GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD, - idToken, - accessToken - }); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - - - static credentialFromResult(userCredential) { - return GoogleAuthProvider.credentialFromTaggedObject(userCredential); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - - - static credentialFromError(error) { - return GoogleAuthProvider.credentialFromTaggedObject(error.customData || {}); - } - - static credentialFromTaggedObject(_ref4) { - let { - _tokenResponse: tokenResponse - } = _ref4; - - if (!tokenResponse) { - return null; - } - - const { - oauthIdToken, - oauthAccessToken - } = tokenResponse; - - if (!oauthIdToken && !oauthAccessToken) { - // This could be an oauth 1 credential or a phone credential - return null; - } - - try { - return GoogleAuthProvider.credential(oauthIdToken, oauthAccessToken); - } catch (_a) { - return null; - } - } - -} -/** Always set to {@link SignInMethod}.GOOGLE. */ - - -GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD = "google.com" -/* GOOGLE */ -; -/** Always set to {@link ProviderId}.GOOGLE. */ - -GoogleAuthProvider.PROVIDER_ID = "google.com" -/* GOOGLE */ -; -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GITHUB. - * - * @remarks - * GitHub requires an OAuth 2.0 redirect, so you can either handle the redirect directly, or use - * the {@link signInWithPopup} handler: - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new GithubAuthProvider(); - * // Start a sign in process for an unauthenticated user. - * provider.addScope('repo'); - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Github Access Token. - * const credential = GithubAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new GithubAuthProvider(); - * provider.addScope('repo'); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a Github Access Token. - * const credential = GithubAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * ``` - * @public - */ - -class GithubAuthProvider extends BaseOAuthProvider { - constructor() { - super("github.com" - /* GITHUB */ - ); - } - /** - * Creates a credential for Github. - * - * @param accessToken - Github access token. - */ - - - static credential(accessToken) { - return OAuthCredential._fromParams({ - providerId: GithubAuthProvider.PROVIDER_ID, - signInMethod: GithubAuthProvider.GITHUB_SIGN_IN_METHOD, - accessToken - }); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - - - static credentialFromResult(userCredential) { - return GithubAuthProvider.credentialFromTaggedObject(userCredential); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - - - static credentialFromError(error) { - return GithubAuthProvider.credentialFromTaggedObject(error.customData || {}); - } - - static credentialFromTaggedObject(_ref5) { - let { - _tokenResponse: tokenResponse - } = _ref5; - - if (!tokenResponse || !('oauthAccessToken' in tokenResponse)) { - return null; - } - - if (!tokenResponse.oauthAccessToken) { - return null; - } - - try { - return GithubAuthProvider.credential(tokenResponse.oauthAccessToken); - } catch (_a) { - return null; - } - } - -} -/** Always set to {@link SignInMethod}.GITHUB. */ - - -GithubAuthProvider.GITHUB_SIGN_IN_METHOD = "github.com" -/* GITHUB */ -; -/** Always set to {@link ProviderId}.GITHUB. */ - -GithubAuthProvider.PROVIDER_ID = "github.com" -/* GITHUB */ -; -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -const IDP_REQUEST_URI = 'http://localhost'; -/** - * @public - */ - -class SAMLAuthCredential extends AuthCredential { - /** @internal */ - constructor(providerId, pendingToken) { - super(providerId, providerId); - this.pendingToken = pendingToken; - } - /** @internal */ - - - _getIdTokenResponse(auth) { - const request = this.buildRequest(); - return signInWithIdp(auth, request); - } - /** @internal */ - - - _linkToIdToken(auth, idToken) { - const request = this.buildRequest(); - request.idToken = idToken; - return signInWithIdp(auth, request); - } - /** @internal */ - - - _getReauthenticationResolver(auth) { - const request = this.buildRequest(); - request.autoCreate = false; - return signInWithIdp(auth, request); - } - /** {@inheritdoc AuthCredential.toJSON} */ - - - toJSON() { - return { - signInMethod: this.signInMethod, - providerId: this.providerId, - pendingToken: this.pendingToken - }; - } - /** - * Static method to deserialize a JSON representation of an object into an - * {@link AuthCredential}. - * - * @param json - Input can be either Object or the stringified representation of the object. - * When string is provided, JSON.parse would be called first. - * - * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned. - */ - - - static fromJSON(json) { - const obj = typeof json === 'string' ? JSON.parse(json) : json; - const { - providerId, - signInMethod, - pendingToken - } = obj; - - if (!providerId || !signInMethod || !pendingToken || providerId !== signInMethod) { - return null; - } - - return new SAMLAuthCredential(providerId, pendingToken); - } - /** - * Helper static method to avoid exposing the constructor to end users. - * - * @internal - */ - - - static _create(providerId, pendingToken) { - return new SAMLAuthCredential(providerId, pendingToken); - } - - buildRequest() { - return { - requestUri: IDP_REQUEST_URI, - returnSecureToken: true, - pendingToken: this.pendingToken - }; - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const SAML_PROVIDER_PREFIX = 'saml.'; -/** - * An {@link AuthProvider} for SAML. - * - * @public - */ - -class SAMLAuthProvider extends FederatedAuthProvider { - /** - * Constructor. The providerId must start with "saml." - * @param providerId - SAML provider ID. - */ - constructor(providerId) { - _assert(providerId.startsWith(SAML_PROVIDER_PREFIX), "argument-error" - /* ARGUMENT_ERROR */ - ); - - super(providerId); - } - /** - * Generates an {@link AuthCredential} from a {@link UserCredential} after a - * successful SAML flow completes. - * - * @remarks - * - * For example, to get an {@link AuthCredential}, you could write the - * following code: - * - * ```js - * const userCredential = await signInWithPopup(auth, samlProvider); - * const credential = SAMLAuthProvider.credentialFromResult(userCredential); - * ``` - * - * @param userCredential - The user credential. - */ - - - static credentialFromResult(userCredential) { - return SAMLAuthProvider.samlCredentialFromTaggedObject(userCredential); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - - - static credentialFromError(error) { - return SAMLAuthProvider.samlCredentialFromTaggedObject(error.customData || {}); - } - /** - * Creates an {@link AuthCredential} from a JSON string or a plain object. - * @param json - A plain object or a JSON string - */ - - - static credentialFromJSON(json) { - const credential = SAMLAuthCredential.fromJSON(json); - - _assert(credential, "argument-error" - /* ARGUMENT_ERROR */ - ); - - return credential; - } - - static samlCredentialFromTaggedObject(_ref6) { - let { - _tokenResponse: tokenResponse - } = _ref6; - - if (!tokenResponse) { - return null; - } - - const { - pendingToken, - providerId - } = tokenResponse; - - if (!pendingToken || !providerId) { - return null; - } - - try { - return SAMLAuthCredential._create(providerId, pendingToken); - } catch (e) { - return null; - } - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.TWITTER. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new TwitterAuthProvider(); - * // Start a sign in process for an unauthenticated user. - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Twitter Access Token and Secret. - * const credential = TwitterAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * const secret = credential.secret; - * } - * ``` - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new TwitterAuthProvider(); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a Twitter Access Token and Secret. - * const credential = TwitterAuthProvider.credentialFromResult(result); - * const token = credential.accessToken; - * const secret = credential.secret; - * ``` - * - * @public - */ - - -class TwitterAuthProvider extends BaseOAuthProvider { - constructor() { - super("twitter.com" - /* TWITTER */ - ); - } - /** - * Creates a credential for Twitter. - * - * @param token - Twitter access token. - * @param secret - Twitter secret. - */ - - - static credential(token, secret) { - return OAuthCredential._fromParams({ - providerId: TwitterAuthProvider.PROVIDER_ID, - signInMethod: TwitterAuthProvider.TWITTER_SIGN_IN_METHOD, - oauthToken: token, - oauthTokenSecret: secret - }); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}. - * - * @param userCredential - The user credential. - */ - - - static credentialFromResult(userCredential) { - return TwitterAuthProvider.credentialFromTaggedObject(userCredential); - } - /** - * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was - * thrown during a sign-in, link, or reauthenticate operation. - * - * @param userCredential - The user credential. - */ - - - static credentialFromError(error) { - return TwitterAuthProvider.credentialFromTaggedObject(error.customData || {}); - } - - static credentialFromTaggedObject(_ref7) { - let { - _tokenResponse: tokenResponse - } = _ref7; - - if (!tokenResponse) { - return null; - } - - const { - oauthAccessToken, - oauthTokenSecret - } = tokenResponse; - - if (!oauthAccessToken || !oauthTokenSecret) { - return null; - } - - try { - return TwitterAuthProvider.credential(oauthAccessToken, oauthTokenSecret); - } catch (_a) { - return null; - } - } - -} -/** Always set to {@link SignInMethod}.TWITTER. */ - - -TwitterAuthProvider.TWITTER_SIGN_IN_METHOD = "twitter.com" -/* TWITTER */ -; -/** Always set to {@link ProviderId}.TWITTER. */ - -TwitterAuthProvider.PROVIDER_ID = "twitter.com" -/* TWITTER */ -; -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -async function signUp(auth, request) { - return _performSignInRequest(auth, "POST" - /* POST */ - , "/v1/accounts:signUp" - /* SIGN_UP */ - , _addTidIfNecessary(auth, request)); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class UserCredentialImpl { - constructor(params) { - this.user = params.user; - this.providerId = params.providerId; - this._tokenResponse = params._tokenResponse; - this.operationType = params.operationType; - } - - static async _fromIdTokenResponse(auth, operationType, idTokenResponse) { - let isAnonymous = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - const user = await UserImpl._fromIdTokenResponse(auth, idTokenResponse, isAnonymous); - const providerId = providerIdForResponse(idTokenResponse); - const userCred = new UserCredentialImpl({ - user, - providerId, - _tokenResponse: idTokenResponse, - operationType - }); - return userCred; - } - - static async _forOperation(user, operationType, response) { - await user._updateTokensIfNecessary(response, - /* reload */ - true); - const providerId = providerIdForResponse(response); - return new UserCredentialImpl({ - user, - providerId, - _tokenResponse: response, - operationType - }); - } - -} - -function providerIdForResponse(response) { - if (response.providerId) { - return response.providerId; - } - - if ('phoneNumber' in response) { - return "phone" - /* PHONE */ - ; - } - - return null; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Asynchronously signs in as an anonymous user. - * - * @remarks - * If there is already an anonymous user signed in, that user will be returned; otherwise, a - * new anonymous user identity will be created and returned. - * - * @param auth - The {@link Auth} instance. - * - * @public - */ - - -async function signInAnonymously(auth) { - var _a; - - const authInternal = _castAuth(auth); - - await authInternal._initializationPromise; - - if ((_a = authInternal.currentUser) === null || _a === void 0 ? void 0 : _a.isAnonymous) { - // If an anonymous user is already signed in, no need to sign them in again. - return new UserCredentialImpl({ - user: authInternal.currentUser, - providerId: null, - operationType: "signIn" - /* SIGN_IN */ - - }); - } - - const response = await signUp(authInternal, { - returnSecureToken: true - }); - const userCredential = await UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" - /* SIGN_IN */ - , response, true); - await authInternal._updateCurrentUser(userCredential.user); - return userCredential; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class MultiFactorError extends _firebase_util__WEBPACK_IMPORTED_MODULE_0__.FirebaseError { - constructor(auth, error, operationType, user) { - var _a; - - super(error.code, error.message); - this.operationType = operationType; - this.user = user; // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work - - Object.setPrototypeOf(this, MultiFactorError.prototype); - this.customData = { - appName: auth.name, - tenantId: (_a = auth.tenantId) !== null && _a !== void 0 ? _a : undefined, - _serverResponse: error.customData._serverResponse, - operationType - }; - } - - static _fromErrorAndOperation(auth, error, operationType, user) { - return new MultiFactorError(auth, error, operationType, user); - } - -} - -function _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user) { - const idTokenProvider = operationType === "reauthenticate" - /* REAUTHENTICATE */ - ? credential._getReauthenticationResolver(auth) : credential._getIdTokenResponse(auth); - return idTokenProvider.catch(error => { - if (error.code === `auth/${"multi-factor-auth-required" - /* MFA_REQUIRED */ - }`) { - throw MultiFactorError._fromErrorAndOperation(auth, error, operationType, user); - } - - throw error; - }); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Takes a set of UserInfo provider data and converts it to a set of names - */ - - -function providerDataAsNames(providerData) { - return new Set(providerData.map(_ref8 => { - let { - providerId - } = _ref8; - return providerId; - }).filter(pid => !!pid)); -} -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Unlinks a provider from a user account. - * - * @param user - The user. - * @param providerId - The provider to unlink. - * - * @public - */ - - -async function unlink(user, providerId) { - const userInternal = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(user); - await _assertLinkedStatus(true, userInternal, providerId); - const { - providerUserInfo - } = await deleteLinkedAccounts(userInternal.auth, { - idToken: await userInternal.getIdToken(), - deleteProvider: [providerId] - }); - const providersLeft = providerDataAsNames(providerUserInfo || []); - userInternal.providerData = userInternal.providerData.filter(pd => providersLeft.has(pd.providerId)); - - if (!providersLeft.has("phone" - /* PHONE */ - )) { - userInternal.phoneNumber = null; - } - - await userInternal.auth._persistUserIfCurrent(userInternal); - return userInternal; -} - -async function _link$1(user, credential) { - let bypassAuthState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - const response = await _logoutIfInvalidated(user, credential._linkToIdToken(user.auth, await user.getIdToken()), bypassAuthState); - return UserCredentialImpl._forOperation(user, "link" - /* LINK */ - , response); -} - -async function _assertLinkedStatus(expected, user, provider) { - await _reloadWithoutSaving(user); - const providerIds = providerDataAsNames(user.providerData); - const code = expected === false ? "provider-already-linked" - /* PROVIDER_ALREADY_LINKED */ - : "no-such-provider" - /* NO_SUCH_PROVIDER */ - ; - - _assert(providerIds.has(provider) === expected, user.auth, code); -} -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -async function _reauthenticate(user, credential) { - let bypassAuthState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - - var _a; - - const { - auth - } = user; - const operationType = "reauthenticate" - /* REAUTHENTICATE */ - ; - - try { - const response = await _logoutIfInvalidated(user, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user), bypassAuthState); - - _assert(response.idToken, auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - const parsed = _parseToken(response.idToken); - - _assert(parsed, auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - const { - sub: localId - } = parsed; - - _assert(user.uid === localId, auth, "user-mismatch" - /* USER_MISMATCH */ - ); - - return UserCredentialImpl._forOperation(user, operationType, response); - } catch (e) { - // Convert user deleted error into user mismatch - if (((_a = e) === null || _a === void 0 ? void 0 : _a.code) === `auth/${"user-not-found" - /* USER_DELETED */ - }`) { - _fail(auth, "user-mismatch" - /* USER_MISMATCH */ - ); - } - - throw e; - } -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -async function _signInWithCredential(auth, credential) { - let bypassAuthState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - const operationType = "signIn" - /* SIGN_IN */ - ; - const response = await _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential); - const userCredential = await UserCredentialImpl._fromIdTokenResponse(auth, operationType, response); - - if (!bypassAuthState) { - await auth._updateCurrentUser(userCredential.user); - } - - return userCredential; -} -/** - * Asynchronously signs in with the given credentials. - * - * @remarks - * An {@link AuthProvider} can be used to generate the credential. - * - * @param auth - The {@link Auth} instance. - * @param credential - The auth credential. - * - * @public - */ - - -async function signInWithCredential(auth, credential) { - return _signInWithCredential(_castAuth(auth), credential); -} -/** - * Links the user account with the given credentials. - * - * @remarks - * An {@link AuthProvider} can be used to generate the credential. - * - * @param user - The user. - * @param credential - The auth credential. - * - * @public - */ - - -async function linkWithCredential(user, credential) { - const userInternal = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(user); - await _assertLinkedStatus(false, userInternal, credential.providerId); - return _link$1(userInternal, credential); -} -/** - * Re-authenticates a user using a fresh credential. - * - * @remarks - * Use before operations such as {@link updatePassword} that require tokens from recent sign-in - * attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error. - * - * @param user - The user. - * @param credential - The auth credential. - * - * @public - */ - - -async function reauthenticateWithCredential(user, credential) { - return _reauthenticate((0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(user), credential); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -async function signInWithCustomToken$1(auth, request) { - return _performSignInRequest(auth, "POST" - /* POST */ - , "/v1/accounts:signInWithCustomToken" - /* SIGN_IN_WITH_CUSTOM_TOKEN */ - , _addTidIfNecessary(auth, request)); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Asynchronously signs in using a custom token. - * - * @remarks - * Custom tokens are used to integrate Firebase Auth with existing auth systems, and must - * be generated by an auth backend using the - * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#createcustomtoken | createCustomToken} - * method in the {@link https://firebase.google.com/docs/auth/admin | Admin SDK} . - * - * Fails with an error if the token is invalid, expired, or not accepted by the Firebase Auth service. - * - * @param auth - The {@link Auth} instance. - * @param customToken - The custom token to sign in with. - * - * @public - */ - - -async function signInWithCustomToken(auth, customToken) { - const authInternal = _castAuth(auth); - - const response = await signInWithCustomToken$1(authInternal, { - token: customToken, - returnSecureToken: true - }); - const cred = await UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" - /* SIGN_IN */ - , response); - await authInternal._updateCurrentUser(cred.user); - return cred; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class MultiFactorInfoImpl { - constructor(factorId, response) { - this.factorId = factorId; - this.uid = response.mfaEnrollmentId; - this.enrollmentTime = new Date(response.enrolledAt).toUTCString(); - this.displayName = response.displayName; - } - - static _fromServerResponse(auth, enrollment) { - if ('phoneInfo' in enrollment) { - return PhoneMultiFactorInfoImpl._fromServerResponse(auth, enrollment); - } - - return _fail(auth, "internal-error" - /* INTERNAL_ERROR */ - ); - } - -} - -class PhoneMultiFactorInfoImpl extends MultiFactorInfoImpl { - constructor(response) { - super("phone" - /* PHONE */ - , response); - this.phoneNumber = response.phoneInfo; - } - - static _fromServerResponse(_auth, enrollment) { - return new PhoneMultiFactorInfoImpl(enrollment); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -function _setActionCodeSettingsOnRequest(auth, request, actionCodeSettings) { - var _a; - - _assert(((_a = actionCodeSettings.url) === null || _a === void 0 ? void 0 : _a.length) > 0, auth, "invalid-continue-uri" - /* INVALID_CONTINUE_URI */ - ); - - _assert(typeof actionCodeSettings.dynamicLinkDomain === 'undefined' || actionCodeSettings.dynamicLinkDomain.length > 0, auth, "invalid-dynamic-link-domain" - /* INVALID_DYNAMIC_LINK_DOMAIN */ - ); - - request.continueUrl = actionCodeSettings.url; - request.dynamicLinkDomain = actionCodeSettings.dynamicLinkDomain; - request.canHandleCodeInApp = actionCodeSettings.handleCodeInApp; - - if (actionCodeSettings.iOS) { - _assert(actionCodeSettings.iOS.bundleId.length > 0, auth, "missing-ios-bundle-id" - /* MISSING_IOS_BUNDLE_ID */ - ); - - request.iOSBundleId = actionCodeSettings.iOS.bundleId; - } - - if (actionCodeSettings.android) { - _assert(actionCodeSettings.android.packageName.length > 0, auth, "missing-android-pkg-name" - /* MISSING_ANDROID_PACKAGE_NAME */ - ); - - request.androidInstallApp = actionCodeSettings.android.installApp; - request.androidMinimumVersionCode = actionCodeSettings.android.minimumVersion; - request.androidPackageName = actionCodeSettings.android.packageName; - } -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Sends a password reset email to the given email address. - * - * @remarks - * To complete the password reset, call {@link confirmPasswordReset} with the code supplied in - * the email sent to the user, along with the new password specified by the user. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await sendPasswordResetEmail(auth, 'user@example.com', actionCodeSettings); - * // Obtain code from user. - * await confirmPasswordReset('user@example.com', code); - * ``` - * - * @param auth - The {@link Auth} instance. - * @param email - The user's email address. - * @param actionCodeSettings - The {@link ActionCodeSettings}. - * - * @public - */ - - -async function sendPasswordResetEmail(auth, email, actionCodeSettings) { - const authModular = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(auth); - const request = { - requestType: "PASSWORD_RESET" - /* PASSWORD_RESET */ - , - email - }; - - if (actionCodeSettings) { - _setActionCodeSettingsOnRequest(authModular, request, actionCodeSettings); - } - - await sendPasswordResetEmail$1(authModular, request); -} -/** - * Completes the password reset process, given a confirmation code and new password. - * - * @param auth - The {@link Auth} instance. - * @param oobCode - A confirmation code sent to the user. - * @param newPassword - The new password. - * - * @public - */ - - -async function confirmPasswordReset(auth, oobCode, newPassword) { - await resetPassword((0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(auth), { - oobCode, - newPassword - }); // Do not return the email. -} -/** - * Applies a verification code sent to the user by email or other out-of-band mechanism. - * - * @param auth - The {@link Auth} instance. - * @param oobCode - A verification code sent to the user. - * - * @public - */ - - -async function applyActionCode(auth, oobCode) { - await applyActionCode$1((0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(auth), { - oobCode - }); -} -/** - * Checks a verification code sent to the user by email or other out-of-band mechanism. - * - * @returns metadata about the code. - * - * @param auth - The {@link Auth} instance. - * @param oobCode - A verification code sent to the user. - * - * @public - */ - - -async function checkActionCode(auth, oobCode) { - const authModular = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(auth); - const response = await resetPassword(authModular, { - oobCode - }); // Email could be empty only if the request type is EMAIL_SIGNIN or - // VERIFY_AND_CHANGE_EMAIL. - // New email should not be empty if the request type is - // VERIFY_AND_CHANGE_EMAIL. - // Multi-factor info could not be empty if the request type is - // REVERT_SECOND_FACTOR_ADDITION. - - const operation = response.requestType; - - _assert(operation, authModular, "internal-error" - /* INTERNAL_ERROR */ - ); - - switch (operation) { - case "EMAIL_SIGNIN" - /* EMAIL_SIGNIN */ - : - break; - - case "VERIFY_AND_CHANGE_EMAIL" - /* VERIFY_AND_CHANGE_EMAIL */ - : - _assert(response.newEmail, authModular, "internal-error" - /* INTERNAL_ERROR */ - ); - - break; - - case "REVERT_SECOND_FACTOR_ADDITION" - /* REVERT_SECOND_FACTOR_ADDITION */ - : - _assert(response.mfaInfo, authModular, "internal-error" - /* INTERNAL_ERROR */ - ); - - // fall through - - default: - _assert(response.email, authModular, "internal-error" - /* INTERNAL_ERROR */ - ); - - } // The multi-factor info for revert second factor addition - - - let multiFactorInfo = null; - - if (response.mfaInfo) { - multiFactorInfo = MultiFactorInfoImpl._fromServerResponse(_castAuth(authModular), response.mfaInfo); - } - - return { - data: { - email: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" - /* VERIFY_AND_CHANGE_EMAIL */ - ? response.newEmail : response.email) || null, - previousEmail: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" - /* VERIFY_AND_CHANGE_EMAIL */ - ? response.email : response.newEmail) || null, - multiFactorInfo - }, - operation - }; -} -/** - * Checks a password reset code sent to the user by email or other out-of-band mechanism. - * - * @returns the user's email address if valid. - * - * @param auth - The {@link Auth} instance. - * @param code - A verification code sent to the user. - * - * @public - */ - - -async function verifyPasswordResetCode(auth, code) { - const { - data - } = await checkActionCode((0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(auth), code); // Email should always be present since a code was sent to it - - return data.email; -} -/** - * Creates a new user account associated with the specified email address and password. - * - * @remarks - * On successful creation of the user account, this user will also be signed in to your application. - * - * User account creation can fail if the account already exists or the password is invalid. - * - * Note: The email address acts as a unique identifier for the user and enables an email-based - * password reset. This function will create a new user account and set the initial user password. - * - * @param auth - The {@link Auth} instance. - * @param email - The user's email address. - * @param password - The user's chosen password. - * - * @public - */ - - -async function createUserWithEmailAndPassword(auth, email, password) { - const authInternal = _castAuth(auth); - - const response = await signUp(authInternal, { - returnSecureToken: true, - email, - password - }); - const userCredential = await UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" - /* SIGN_IN */ - , response); - await authInternal._updateCurrentUser(userCredential.user); - return userCredential; -} -/** - * Asynchronously signs in using an email and password. - * - * @remarks - * Fails with an error if the email address and password do not match. - * - * Note: The user's password is NOT the password used to access the user's email account. The - * email address serves as a unique identifier for the user, and the password is used to access - * the user's account in your Firebase project. See also: {@link createUserWithEmailAndPassword}. - * - * @param auth - The {@link Auth} instance. - * @param email - The users email address. - * @param password - The users password. - * - * @public - */ - - -function signInWithEmailAndPassword(auth, email, password) { - return signInWithCredential((0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(auth), EmailAuthProvider.credential(email, password)); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Sends a sign-in email link to the user with the specified email. - * - * @remarks - * The sign-in operation has to always be completed in the app unlike other out of band email - * actions (password reset and email verifications). This is because, at the end of the flow, - * the user is expected to be signed in and their Auth state persisted within the app. - * - * To complete sign in with the email link, call {@link signInWithEmailLink} with the email - * address and the email link supplied in the email sent to the user. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings); - * // Obtain emailLink from the user. - * if(isSignInWithEmailLink(auth, emailLink)) { - * await signInWithEmailLink(auth, 'user@example.com', emailLink); - * } - * ``` - * - * @param authInternal - The {@link Auth} instance. - * @param email - The user's email address. - * @param actionCodeSettings - The {@link ActionCodeSettings}. - * - * @public - */ - - -async function sendSignInLinkToEmail(auth, email, actionCodeSettings) { - const authModular = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(auth); - const request = { - requestType: "EMAIL_SIGNIN" - /* EMAIL_SIGNIN */ - , - email - }; - - _assert(actionCodeSettings.handleCodeInApp, authModular, "argument-error" - /* ARGUMENT_ERROR */ - ); - - if (actionCodeSettings) { - _setActionCodeSettingsOnRequest(authModular, request, actionCodeSettings); - } - - await sendSignInLinkToEmail$1(authModular, request); -} -/** - * Checks if an incoming link is a sign-in with email link suitable for {@link signInWithEmailLink}. - * - * @param auth - The {@link Auth} instance. - * @param emailLink - The link sent to the user's email address. - * - * @public - */ - - -function isSignInWithEmailLink(auth, emailLink) { - const actionCodeUrl = ActionCodeURL.parseLink(emailLink); - return (actionCodeUrl === null || actionCodeUrl === void 0 ? void 0 : actionCodeUrl.operation) === "EMAIL_SIGNIN" - /* EMAIL_SIGNIN */ - ; -} -/** - * Asynchronously signs in using an email and sign-in email link. - * - * @remarks - * If no link is passed, the link is inferred from the current URL. - * - * Fails with an error if the email address is invalid or OTP in email link expires. - * - * Note: Confirm the link is a sign-in email link before calling this method firebase.auth.Auth.isSignInWithEmailLink. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings); - * // Obtain emailLink from the user. - * if(isSignInWithEmailLink(auth, emailLink)) { - * await signInWithEmailLink(auth, 'user@example.com', emailLink); - * } - * ``` - * - * @param auth - The {@link Auth} instance. - * @param email - The user's email address. - * @param emailLink - The link sent to the user's email address. - * - * @public - */ - - -async function signInWithEmailLink(auth, email, emailLink) { - const authModular = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(auth); - const credential = EmailAuthProvider.credentialWithLink(email, emailLink || _getCurrentUrl()); // Check if the tenant ID in the email link matches the tenant ID on Auth - // instance. - - _assert(credential._tenantId === (authModular.tenantId || null), authModular, "tenant-id-mismatch" - /* TENANT_ID_MISMATCH */ - ); - - return signInWithCredential(authModular, credential); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -async function createAuthUri(auth, request) { - return _performApiRequest(auth, "POST" - /* POST */ - , "/v1/accounts:createAuthUri" - /* CREATE_AUTH_URI */ - , _addTidIfNecessary(auth, request)); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Gets the list of possible sign in methods for the given email address. - * - * @remarks - * This is useful to differentiate methods of sign-in for the same provider, eg. - * {@link EmailAuthProvider} which has 2 methods of sign-in, - * {@link SignInMethod}.EMAIL_PASSWORD and - * {@link SignInMethod}.EMAIL_LINK. - * - * @param auth - The {@link Auth} instance. - * @param email - The user's email address. - * - * @public - */ - - -async function fetchSignInMethodsForEmail(auth, email) { - // createAuthUri returns an error if continue URI is not http or https. - // For environments like Cordova, Chrome extensions, native frameworks, file - // systems, etc, use http://localhost as continue URL. - const continueUri = _isHttpOrHttps() ? _getCurrentUrl() : 'http://localhost'; - const request = { - identifier: email, - continueUri - }; - const { - signinMethods - } = await createAuthUri((0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(auth), request); - return signinMethods || []; -} -/** - * Sends a verification email to a user. - * - * @remarks - * The verification process is completed by calling {@link applyActionCode}. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await sendEmailVerification(user, actionCodeSettings); - * // Obtain code from the user. - * await applyActionCode(auth, code); - * ``` - * - * @param user - The user. - * @param actionCodeSettings - The {@link ActionCodeSettings}. - * - * @public - */ - - -async function sendEmailVerification(user, actionCodeSettings) { - const userInternal = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(user); - const idToken = await user.getIdToken(); - const request = { - requestType: "VERIFY_EMAIL" - /* VERIFY_EMAIL */ - , - idToken - }; - - if (actionCodeSettings) { - _setActionCodeSettingsOnRequest(userInternal.auth, request, actionCodeSettings); - } - - const { - email - } = await sendEmailVerification$1(userInternal.auth, request); - - if (email !== user.email) { - await user.reload(); - } -} -/** - * Sends a verification email to a new email address. - * - * @remarks - * The user's email will be updated to the new one after being verified. - * - * If you have a custom email action handler, you can complete the verification process by calling - * {@link applyActionCode}. - * - * @example - * ```javascript - * const actionCodeSettings = { - * url: 'https://www.example.com/?email=user@example.com', - * iOS: { - * bundleId: 'com.example.ios' - * }, - * android: { - * packageName: 'com.example.android', - * installApp: true, - * minimumVersion: '12' - * }, - * handleCodeInApp: true - * }; - * await verifyBeforeUpdateEmail(user, 'newemail@example.com', actionCodeSettings); - * // Obtain code from the user. - * await applyActionCode(auth, code); - * ``` - * - * @param user - The user. - * @param newEmail - The new email address to be verified before update. - * @param actionCodeSettings - The {@link ActionCodeSettings}. - * - * @public - */ - - -async function verifyBeforeUpdateEmail(user, newEmail, actionCodeSettings) { - const userInternal = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(user); - const idToken = await user.getIdToken(); - const request = { - requestType: "VERIFY_AND_CHANGE_EMAIL" - /* VERIFY_AND_CHANGE_EMAIL */ - , - idToken, - newEmail - }; - - if (actionCodeSettings) { - _setActionCodeSettingsOnRequest(userInternal.auth, request, actionCodeSettings); - } - - const { - email - } = await verifyAndChangeEmail(userInternal.auth, request); - - if (email !== user.email) { - // If the local copy of the email on user is outdated, reload the - // user. - await user.reload(); - } -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -async function updateProfile$1(auth, request) { - return _performApiRequest(auth, "POST" - /* POST */ - , "/v1/accounts:update" - /* SET_ACCOUNT_INFO */ - , request); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Updates a user's profile data. - * - * @param user - The user. - * @param profile - The profile's `displayName` and `photoURL` to update. - * - * @public - */ - - -async function updateProfile(user, _ref9) { - let { - displayName, - photoURL: photoUrl - } = _ref9; - - if (displayName === undefined && photoUrl === undefined) { - return; - } - - const userInternal = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(user); - const idToken = await userInternal.getIdToken(); - const profileRequest = { - idToken, - displayName, - photoUrl, - returnSecureToken: true - }; - const response = await _logoutIfInvalidated(userInternal, updateProfile$1(userInternal.auth, profileRequest)); - userInternal.displayName = response.displayName || null; - userInternal.photoURL = response.photoUrl || null; // Update the password provider as well - - const passwordProvider = userInternal.providerData.find(_ref10 => { - let { - providerId - } = _ref10; - return providerId === "password"; - } - /* PASSWORD */ - ); - - if (passwordProvider) { - passwordProvider.displayName = userInternal.displayName; - passwordProvider.photoURL = userInternal.photoURL; - } - - await userInternal._updateTokensIfNecessary(response); -} -/** - * Updates the user's email address. - * - * @remarks - * An email will be sent to the original email address (if it was set) that allows to revoke the - * email address change, in order to protect them from account hijacking. - * - * Important: this is a security sensitive operation that requires the user to have recently signed - * in. If this requirement isn't met, ask the user to authenticate again and then call - * {@link reauthenticateWithCredential}. - * - * @param user - The user. - * @param newEmail - The new email address. - * - * @public - */ - - -function updateEmail(user, newEmail) { - return updateEmailOrPassword((0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(user), newEmail, null); -} -/** - * Updates the user's password. - * - * @remarks - * Important: this is a security sensitive operation that requires the user to have recently signed - * in. If this requirement isn't met, ask the user to authenticate again and then call - * {@link reauthenticateWithCredential}. - * - * @param user - The user. - * @param newPassword - The new password. - * - * @public - */ - - -function updatePassword(user, newPassword) { - return updateEmailOrPassword((0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(user), null, newPassword); -} - -async function updateEmailOrPassword(user, email, password) { - const { - auth - } = user; - const idToken = await user.getIdToken(); - const request = { - idToken, - returnSecureToken: true - }; - - if (email) { - request.email = email; - } - - if (password) { - request.password = password; - } - - const response = await _logoutIfInvalidated(user, updateEmailPassword(auth, request)); - await user._updateTokensIfNecessary(response, - /* reload */ - true); -} -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Parse the `AdditionalUserInfo` from the ID token response. - * - */ - - -function _fromIdTokenResponse(idTokenResponse) { - var _a, _b; - - if (!idTokenResponse) { - return null; - } - - const { - providerId - } = idTokenResponse; - const profile = idTokenResponse.rawUserInfo ? JSON.parse(idTokenResponse.rawUserInfo) : {}; - const isNewUser = idTokenResponse.isNewUser || idTokenResponse.kind === "identitytoolkit#SignupNewUserResponse" - /* SignupNewUser */ - ; - - if (!providerId && (idTokenResponse === null || idTokenResponse === void 0 ? void 0 : idTokenResponse.idToken)) { - const signInProvider = (_b = (_a = _parseToken(idTokenResponse.idToken)) === null || _a === void 0 ? void 0 : _a.firebase) === null || _b === void 0 ? void 0 : _b['sign_in_provider']; - - if (signInProvider) { - const filteredProviderId = signInProvider !== "anonymous" - /* ANONYMOUS */ - && signInProvider !== "custom" - /* CUSTOM */ - ? signInProvider : null; // Uses generic class in accordance with the legacy SDK. - - return new GenericAdditionalUserInfo(isNewUser, filteredProviderId); - } - } - - if (!providerId) { - return null; - } - - switch (providerId) { - case "facebook.com" - /* FACEBOOK */ - : - return new FacebookAdditionalUserInfo(isNewUser, profile); - - case "github.com" - /* GITHUB */ - : - return new GithubAdditionalUserInfo(isNewUser, profile); - - case "google.com" - /* GOOGLE */ - : - return new GoogleAdditionalUserInfo(isNewUser, profile); - - case "twitter.com" - /* TWITTER */ - : - return new TwitterAdditionalUserInfo(isNewUser, profile, idTokenResponse.screenName || null); - - case "custom" - /* CUSTOM */ - : - case "anonymous" - /* ANONYMOUS */ - : - return new GenericAdditionalUserInfo(isNewUser, null); - - default: - return new GenericAdditionalUserInfo(isNewUser, providerId, profile); - } -} - -class GenericAdditionalUserInfo { - constructor(isNewUser, providerId) { - let profile = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - this.isNewUser = isNewUser; - this.providerId = providerId; - this.profile = profile; - } - -} - -class FederatedAdditionalUserInfoWithUsername extends GenericAdditionalUserInfo { - constructor(isNewUser, providerId, profile, username) { - super(isNewUser, providerId, profile); - this.username = username; - } - -} - -class FacebookAdditionalUserInfo extends GenericAdditionalUserInfo { - constructor(isNewUser, profile) { - super(isNewUser, "facebook.com" - /* FACEBOOK */ - , profile); - } - -} - -class GithubAdditionalUserInfo extends FederatedAdditionalUserInfoWithUsername { - constructor(isNewUser, profile) { - super(isNewUser, "github.com" - /* GITHUB */ - , profile, typeof (profile === null || profile === void 0 ? void 0 : profile.login) === 'string' ? profile === null || profile === void 0 ? void 0 : profile.login : null); - } - -} - -class GoogleAdditionalUserInfo extends GenericAdditionalUserInfo { - constructor(isNewUser, profile) { - super(isNewUser, "google.com" - /* GOOGLE */ - , profile); - } - -} - -class TwitterAdditionalUserInfo extends FederatedAdditionalUserInfoWithUsername { - constructor(isNewUser, profile, screenName) { - super(isNewUser, "twitter.com" - /* TWITTER */ - , profile, screenName); - } - -} -/** - * Extracts provider specific {@link AdditionalUserInfo} for the given credential. - * - * @param userCredential - The user credential. - * - * @public - */ - - -function getAdditionalUserInfo(userCredential) { - const { - user, - _tokenResponse - } = userCredential; - - if (user.isAnonymous && !_tokenResponse) { - // Handle the special case where signInAnonymously() gets called twice. - // No network call is made so there's nothing to actually fill this in - return { - providerId: null, - isNewUser: false, - profile: null - }; - } - - return _fromIdTokenResponse(_tokenResponse); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Non-optional auth methods. - -/** - * Changes the type of persistence on the {@link Auth} instance for the currently saved - * `Auth` session and applies this type of persistence for future sign-in requests, including - * sign-in with redirect requests. - * - * @remarks - * This makes it easy for a user signing in to specify whether their session should be - * remembered or not. It also makes it easier to never persist the `Auth` state for applications - * that are shared by other users or have sensitive data. - * - * @example - * ```javascript - * setPersistence(auth, browserSessionPersistence); - * ``` - * - * @param auth - The {@link Auth} instance. - * @param persistence - The {@link Persistence} to use. - * @returns A `Promise` that resolves once the persistence change has completed - * - * @public - */ - - -function setPersistence(auth, persistence) { - return (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(auth).setPersistence(persistence); -} -/** - * Adds an observer for changes to the signed-in user's ID token. - * - * @remarks - * This includes sign-in, sign-out, and token refresh events. - * - * @param auth - The {@link Auth} instance. - * @param nextOrObserver - callback triggered on change. - * @param error - Deprecated. This callback is never triggered. Errors - * on signing in/out can be caught in promises returned from - * sign-in/sign-out functions. - * @param completed - Deprecated. This callback is never triggered. - * - * @public - */ - - -function onIdTokenChanged(auth, nextOrObserver, error, completed) { - return (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(auth).onIdTokenChanged(nextOrObserver, error, completed); -} -/** - * Adds a blocking callback that runs before an auth state change - * sets a new user. - * - * @param auth - The {@link Auth} instance. - * @param callback - callback triggered before new user value is set. - * If this throws, it blocks the user from being set. - * @param onAbort - callback triggered if a later `beforeAuthStateChanged()` - * callback throws, allowing you to undo any side effects. - */ - - -function beforeAuthStateChanged(auth, callback, onAbort) { - return (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(auth).beforeAuthStateChanged(callback, onAbort); -} -/** - * Adds an observer for changes to the user's sign-in state. - * - * @remarks - * To keep the old behavior, see {@link onIdTokenChanged}. - * - * @param auth - The {@link Auth} instance. - * @param nextOrObserver - callback triggered on change. - * @param error - Deprecated. This callback is never triggered. Errors - * on signing in/out can be caught in promises returned from - * sign-in/sign-out functions. - * @param completed - Deprecated. This callback is never triggered. - * - * @public - */ - - -function onAuthStateChanged(auth, nextOrObserver, error, completed) { - return (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(auth).onAuthStateChanged(nextOrObserver, error, completed); -} -/** - * Sets the current language to the default device/browser preference. - * - * @param auth - The {@link Auth} instance. - * - * @public - */ - - -function useDeviceLanguage(auth) { - (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(auth).useDeviceLanguage(); -} -/** - * Asynchronously sets the provided user as {@link Auth.currentUser} on the - * {@link Auth} instance. - * - * @remarks - * A new instance copy of the user provided will be made and set as currentUser. - * - * This will trigger {@link onAuthStateChanged} and {@link onIdTokenChanged} listeners - * like other sign in methods. - * - * The operation fails with an error if the user to be updated belongs to a different Firebase - * project. - * - * @param auth - The {@link Auth} instance. - * @param user - The new {@link User}. - * - * @public - */ - - -function updateCurrentUser(auth, user) { - return (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(auth).updateCurrentUser(user); -} -/** - * Signs out the current user. - * - * @param auth - The {@link Auth} instance. - * - * @public - */ - - -function signOut(auth) { - return (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(auth).signOut(); -} -/** - * Deletes and signs out the user. - * - * @remarks - * Important: this is a security-sensitive operation that requires the user to have recently - * signed in. If this requirement isn't met, ask the user to authenticate again and then call - * {@link reauthenticateWithCredential}. - * - * @param user - The user. - * - * @public - */ - - -async function deleteUser(user) { - return (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(user).delete(); -} - -class MultiFactorSessionImpl { - constructor(type, credential) { - this.type = type; - this.credential = credential; - } - - static _fromIdtoken(idToken) { - return new MultiFactorSessionImpl("enroll" - /* ENROLL */ - , idToken); - } - - static _fromMfaPendingCredential(mfaPendingCredential) { - return new MultiFactorSessionImpl("signin" - /* SIGN_IN */ - , mfaPendingCredential); - } - - toJSON() { - const key = this.type === "enroll" - /* ENROLL */ - ? 'idToken' : 'pendingCredential'; - return { - multiFactorSession: { - [key]: this.credential - } - }; - } - - static fromJSON(obj) { - var _a, _b; - - if (obj === null || obj === void 0 ? void 0 : obj.multiFactorSession) { - if ((_a = obj.multiFactorSession) === null || _a === void 0 ? void 0 : _a.pendingCredential) { - return MultiFactorSessionImpl._fromMfaPendingCredential(obj.multiFactorSession.pendingCredential); - } else if ((_b = obj.multiFactorSession) === null || _b === void 0 ? void 0 : _b.idToken) { - return MultiFactorSessionImpl._fromIdtoken(obj.multiFactorSession.idToken); - } - } - - return null; - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class MultiFactorResolverImpl { - constructor(session, hints, signInResolver) { - this.session = session; - this.hints = hints; - this.signInResolver = signInResolver; - } - /** @internal */ - - - static _fromError(authExtern, error) { - const auth = _castAuth(authExtern); - - const serverResponse = error.customData._serverResponse; - const hints = (serverResponse.mfaInfo || []).map(enrollment => MultiFactorInfoImpl._fromServerResponse(auth, enrollment)); - - _assert(serverResponse.mfaPendingCredential, auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - const session = MultiFactorSessionImpl._fromMfaPendingCredential(serverResponse.mfaPendingCredential); - - return new MultiFactorResolverImpl(session, hints, async assertion => { - const mfaResponse = await assertion._process(auth, session); // Clear out the unneeded fields from the old login response - - delete serverResponse.mfaInfo; - delete serverResponse.mfaPendingCredential; // Use in the new token & refresh token in the old response - - const idTokenResponse = Object.assign(Object.assign({}, serverResponse), { - idToken: mfaResponse.idToken, - refreshToken: mfaResponse.refreshToken - }); // TODO: we should collapse this switch statement into UserCredentialImpl._forOperation and have it support the SIGN_IN case - - switch (error.operationType) { - case "signIn" - /* SIGN_IN */ - : - const userCredential = await UserCredentialImpl._fromIdTokenResponse(auth, error.operationType, idTokenResponse); - await auth._updateCurrentUser(userCredential.user); - return userCredential; - - case "reauthenticate" - /* REAUTHENTICATE */ - : - _assert(error.user, auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - return UserCredentialImpl._forOperation(error.user, error.operationType, idTokenResponse); - - default: - _fail(auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - } - }); - } - - async resolveSignIn(assertionExtern) { - const assertion = assertionExtern; - return this.signInResolver(assertion); - } - -} -/** - * Provides a {@link MultiFactorResolver} suitable for completion of a - * multi-factor flow. - * - * @param auth - The {@link Auth} instance. - * @param error - The {@link MultiFactorError} raised during a sign-in, or - * reauthentication operation. - * - * @public - */ - - -function getMultiFactorResolver(auth, error) { - var _a; - - const authModular = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(auth); - const errorInternal = error; - - _assert(error.customData.operationType, authModular, "argument-error" - /* ARGUMENT_ERROR */ - ); - - _assert((_a = errorInternal.customData._serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, "argument-error" - /* ARGUMENT_ERROR */ - ); - - return MultiFactorResolverImpl._fromError(authModular, errorInternal); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -function startEnrollPhoneMfa(auth, request) { - return _performApiRequest(auth, "POST" - /* POST */ - , "/v2/accounts/mfaEnrollment:start" - /* START_PHONE_MFA_ENROLLMENT */ - , _addTidIfNecessary(auth, request)); -} - -function finalizeEnrollPhoneMfa(auth, request) { - return _performApiRequest(auth, "POST" - /* POST */ - , "/v2/accounts/mfaEnrollment:finalize" - /* FINALIZE_PHONE_MFA_ENROLLMENT */ - , _addTidIfNecessary(auth, request)); -} - -function withdrawMfa(auth, request) { - return _performApiRequest(auth, "POST" - /* POST */ - , "/v2/accounts/mfaEnrollment:withdraw" - /* WITHDRAW_MFA */ - , _addTidIfNecessary(auth, request)); -} - -class MultiFactorUserImpl { - constructor(user) { - this.user = user; - this.enrolledFactors = []; - - user._onReload(userInfo => { - if (userInfo.mfaInfo) { - this.enrolledFactors = userInfo.mfaInfo.map(enrollment => MultiFactorInfoImpl._fromServerResponse(user.auth, enrollment)); - } - }); - } - - static _fromUser(user) { - return new MultiFactorUserImpl(user); - } - - async getSession() { - return MultiFactorSessionImpl._fromIdtoken(await this.user.getIdToken()); - } - - async enroll(assertionExtern, displayName) { - const assertion = assertionExtern; - const session = await this.getSession(); - const finalizeMfaResponse = await _logoutIfInvalidated(this.user, assertion._process(this.user.auth, session, displayName)); // New tokens will be issued after enrollment of the new second factors. - // They need to be updated on the user. - - await this.user._updateTokensIfNecessary(finalizeMfaResponse); // The user needs to be reloaded to get the new multi-factor information - // from server. USER_RELOADED event will be triggered and `enrolledFactors` - // will be updated. - - return this.user.reload(); - } - - async unenroll(infoOrUid) { - var _a; - - const mfaEnrollmentId = typeof infoOrUid === 'string' ? infoOrUid : infoOrUid.uid; - const idToken = await this.user.getIdToken(); - const idTokenResponse = await _logoutIfInvalidated(this.user, withdrawMfa(this.user.auth, { - idToken, - mfaEnrollmentId - })); // Remove the second factor from the user's list. - - this.enrolledFactors = this.enrolledFactors.filter(_ref11 => { - let { - uid - } = _ref11; - return uid !== mfaEnrollmentId; - }); // Depending on whether the backend decided to revoke the user's session, - // the tokenResponse may be empty. If the tokens were not updated (and they - // are now invalid), reloading the user will discover this and invalidate - // the user's state accordingly. - - await this.user._updateTokensIfNecessary(idTokenResponse); - - try { - await this.user.reload(); - } catch (e) { - if (((_a = e) === null || _a === void 0 ? void 0 : _a.code) !== `auth/${"user-token-expired" - /* TOKEN_EXPIRED */ - }`) { - throw e; - } - } - } - -} - -const multiFactorUserCache = new WeakMap(); -/** - * The {@link MultiFactorUser} corresponding to the user. - * - * @remarks - * This is used to access all multi-factor properties and operations related to the user. - * - * @param user - The user. - * - * @public - */ - -function multiFactor(user) { - const userModular = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(user); - - if (!multiFactorUserCache.has(userModular)) { - multiFactorUserCache.set(userModular, MultiFactorUserImpl._fromUser(userModular)); - } - - return multiFactorUserCache.get(userModular); -} - -const STORAGE_AVAILABLE_KEY = '__sak'; -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// There are two different browser persistence types: local and session. -// Both have the same implementation but use a different underlying storage -// object. - -class BrowserPersistenceClass { - constructor(storageRetriever, type) { - this.storageRetriever = storageRetriever; - this.type = type; - } - - _isAvailable() { - try { - if (!this.storage) { - return Promise.resolve(false); - } - - this.storage.setItem(STORAGE_AVAILABLE_KEY, '1'); - this.storage.removeItem(STORAGE_AVAILABLE_KEY); - return Promise.resolve(true); - } catch (_a) { - return Promise.resolve(false); - } - } - - _set(key, value) { - this.storage.setItem(key, JSON.stringify(value)); - return Promise.resolve(); - } - - _get(key) { - const json = this.storage.getItem(key); - return Promise.resolve(json ? JSON.parse(json) : null); - } - - _remove(key) { - this.storage.removeItem(key); - return Promise.resolve(); - } - - get storage() { - return this.storageRetriever(); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -function _iframeCannotSyncWebStorage() { - const ua = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getUA)(); - return _isSafari(ua) || _isIOS(ua); -} // The polling period in case events are not supported - - -const _POLLING_INTERVAL_MS$1 = 1000; // The IE 10 localStorage cross tab synchronization delay in milliseconds - -const IE10_LOCAL_STORAGE_SYNC_DELAY = 10; - -class BrowserLocalPersistence extends BrowserPersistenceClass { - constructor() { - super(() => window.localStorage, "LOCAL" - /* LOCAL */ - ); - - this.boundEventHandler = (event, poll) => this.onStorageEvent(event, poll); - - this.listeners = {}; - this.localCache = {}; // setTimeout return value is platform specific - // eslint-disable-next-line @typescript-eslint/no-explicit-any - - this.pollTimer = null; // Safari or iOS browser and embedded in an iframe. - - this.safariLocalStorageNotSynced = _iframeCannotSyncWebStorage() && _isIframe(); // Whether to use polling instead of depending on window events - - this.fallbackToPolling = _isMobileBrowser(); - this._shouldAllowMigration = true; - } - - forAllChangedKeys(cb) { - // Check all keys with listeners on them. - for (const key of Object.keys(this.listeners)) { - // Get value from localStorage. - const newValue = this.storage.getItem(key); - const oldValue = this.localCache[key]; // If local map value does not match, trigger listener with storage event. - // Differentiate this simulated event from the real storage event. - - if (newValue !== oldValue) { - cb(key, oldValue, newValue); - } - } - } - - onStorageEvent(event) { - let poll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - - // Key would be null in some situations, like when localStorage is cleared - if (!event.key) { - this.forAllChangedKeys((key, _oldValue, newValue) => { - this.notifyListeners(key, newValue); - }); - return; - } - - const key = event.key; // Check the mechanism how this event was detected. - // The first event will dictate the mechanism to be used. - - if (poll) { - // Environment detects storage changes via polling. - // Remove storage event listener to prevent possible event duplication. - this.detachListener(); - } else { - // Environment detects storage changes via storage event listener. - // Remove polling listener to prevent possible event duplication. - this.stopPolling(); - } // Safari embedded iframe. Storage event will trigger with the delta - // changes but no changes will be applied to the iframe localStorage. - - - if (this.safariLocalStorageNotSynced) { - // Get current iframe page value. - const storedValue = this.storage.getItem(key); // Value not synchronized, synchronize manually. - - if (event.newValue !== storedValue) { - if (event.newValue !== null) { - // Value changed from current value. - this.storage.setItem(key, event.newValue); - } else { - // Current value deleted. - this.storage.removeItem(key); - } - } else if (this.localCache[key] === event.newValue && !poll) { - // Already detected and processed, do not trigger listeners again. - return; - } - } - - const triggerListeners = () => { - // Keep local map up to date in case storage event is triggered before - // poll. - const storedValue = this.storage.getItem(key); - - if (!poll && this.localCache[key] === storedValue) { - // Real storage event which has already been detected, do nothing. - // This seems to trigger in some IE browsers for some reason. - return; - } - - this.notifyListeners(key, storedValue); - }; - - const storedValue = this.storage.getItem(key); - - if (_isIE10() && storedValue !== event.newValue && event.newValue !== event.oldValue) { - // IE 10 has this weird bug where a storage event would trigger with the - // correct key, oldValue and newValue but localStorage.getItem(key) does - // not yield the updated value until a few milliseconds. This ensures - // this recovers from that situation. - setTimeout(triggerListeners, IE10_LOCAL_STORAGE_SYNC_DELAY); - } else { - triggerListeners(); - } - } - - notifyListeners(key, value) { - this.localCache[key] = value; - const listeners = this.listeners[key]; - - if (listeners) { - for (const listener of Array.from(listeners)) { - listener(value ? JSON.parse(value) : value); - } - } - } - - startPolling() { - this.stopPolling(); - this.pollTimer = setInterval(() => { - this.forAllChangedKeys((key, oldValue, newValue) => { - this.onStorageEvent(new StorageEvent('storage', { - key, - oldValue, - newValue - }), - /* poll */ - true); - }); - }, _POLLING_INTERVAL_MS$1); - } - - stopPolling() { - if (this.pollTimer) { - clearInterval(this.pollTimer); - this.pollTimer = null; - } - } - - attachListener() { - window.addEventListener('storage', this.boundEventHandler); - } - - detachListener() { - window.removeEventListener('storage', this.boundEventHandler); - } - - _addListener(key, listener) { - if (Object.keys(this.listeners).length === 0) { - // Whether browser can detect storage event when it had already been pushed to the background. - // This may happen in some mobile browsers. A localStorage change in the foreground window - // will not be detected in the background window via the storage event. - // This was detected in iOS 7.x mobile browsers - if (this.fallbackToPolling) { - this.startPolling(); - } else { - this.attachListener(); - } - } - - if (!this.listeners[key]) { - this.listeners[key] = new Set(); // Populate the cache to avoid spuriously triggering on first poll. - - this.localCache[key] = this.storage.getItem(key); - } - - this.listeners[key].add(listener); - } - - _removeListener(key, listener) { - if (this.listeners[key]) { - this.listeners[key].delete(listener); - - if (this.listeners[key].size === 0) { - delete this.listeners[key]; - } - } - - if (Object.keys(this.listeners).length === 0) { - this.detachListener(); - this.stopPolling(); - } - } // Update local cache on base operations: - - - async _set(key, value) { - await super._set(key, value); - this.localCache[key] = JSON.stringify(value); - } - - async _get(key) { - const value = await super._get(key); - this.localCache[key] = JSON.stringify(value); - return value; - } - - async _remove(key) { - await super._remove(key); - delete this.localCache[key]; - } - -} - -BrowserLocalPersistence.type = 'LOCAL'; -/** - * An implementation of {@link Persistence} of type `LOCAL` using `localStorage` - * for the underlying storage. - * - * @public - */ - -const browserLocalPersistence = BrowserLocalPersistence; -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -class BrowserSessionPersistence extends BrowserPersistenceClass { - constructor() { - super(() => window.sessionStorage, "SESSION" - /* SESSION */ - ); - } - - _addListener(_key, _listener) { - // Listeners are not supported for session storage since it cannot be shared across windows - return; - } - - _removeListener(_key, _listener) { - // Listeners are not supported for session storage since it cannot be shared across windows - return; - } - -} - -BrowserSessionPersistence.type = 'SESSION'; -/** - * An implementation of {@link Persistence} of `SESSION` using `sessionStorage` - * for the underlying storage. - * - * @public - */ - -const browserSessionPersistence = BrowserSessionPersistence; -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Shim for Promise.allSettled, note the slightly different format of `fulfilled` vs `status`. - * - * @param promises - Array of promises to wait on. - */ - -function _allSettled(promises) { - return Promise.all(promises.map(async promise => { - try { - const value = await promise; - return { - fulfilled: true, - value - }; - } catch (reason) { - return { - fulfilled: false, - reason - }; - } - })); -} -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Interface class for receiving messages. - * - */ - - -class Receiver { - constructor(eventTarget) { - this.eventTarget = eventTarget; - this.handlersMap = {}; - this.boundEventHandler = this.handleEvent.bind(this); - } - /** - * Obtain an instance of a Receiver for a given event target, if none exists it will be created. - * - * @param eventTarget - An event target (such as window or self) through which the underlying - * messages will be received. - */ - - - static _getInstance(eventTarget) { - // The results are stored in an array since objects can't be keys for other - // objects. In addition, setting a unique property on an event target as a - // hash map key may not be allowed due to CORS restrictions. - const existingInstance = this.receivers.find(receiver => receiver.isListeningto(eventTarget)); - - if (existingInstance) { - return existingInstance; - } - - const newInstance = new Receiver(eventTarget); - this.receivers.push(newInstance); - return newInstance; - } - - isListeningto(eventTarget) { - return this.eventTarget === eventTarget; - } - /** - * Fans out a MessageEvent to the appropriate listeners. - * - * @remarks - * Sends an {@link Status.ACK} upon receipt and a {@link Status.DONE} once all handlers have - * finished processing. - * - * @param event - The MessageEvent. - * - */ - - - async handleEvent(event) { - const messageEvent = event; - const { - eventId, - eventType, - data - } = messageEvent.data; - const handlers = this.handlersMap[eventType]; - - if (!(handlers === null || handlers === void 0 ? void 0 : handlers.size)) { - return; - } - - messageEvent.ports[0].postMessage({ - status: "ack" - /* ACK */ - , - eventId, - eventType - }); - const promises = Array.from(handlers).map(async handler => handler(messageEvent.origin, data)); - const response = await _allSettled(promises); - messageEvent.ports[0].postMessage({ - status: "done" - /* DONE */ - , - eventId, - eventType, - response - }); - } - /** - * Subscribe an event handler for a particular event. - * - * @param eventType - Event name to subscribe to. - * @param eventHandler - The event handler which should receive the events. - * - */ - - - _subscribe(eventType, eventHandler) { - if (Object.keys(this.handlersMap).length === 0) { - this.eventTarget.addEventListener('message', this.boundEventHandler); - } - - if (!this.handlersMap[eventType]) { - this.handlersMap[eventType] = new Set(); - } - - this.handlersMap[eventType].add(eventHandler); - } - /** - * Unsubscribe an event handler from a particular event. - * - * @param eventType - Event name to unsubscribe from. - * @param eventHandler - Optinoal event handler, if none provided, unsubscribe all handlers on this event. - * - */ - - - _unsubscribe(eventType, eventHandler) { - if (this.handlersMap[eventType] && eventHandler) { - this.handlersMap[eventType].delete(eventHandler); - } - - if (!eventHandler || this.handlersMap[eventType].size === 0) { - delete this.handlersMap[eventType]; - } - - if (Object.keys(this.handlersMap).length === 0) { - this.eventTarget.removeEventListener('message', this.boundEventHandler); - } - } - -} - -Receiver.receivers = []; -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function _generateEventId() { - let prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; - let digits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10; - let random = ''; - - for (let i = 0; i < digits; i++) { - random += Math.floor(Math.random() * 10); - } - - return prefix + random; -} -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Interface for sending messages and waiting for a completion response. - * - */ - - -class Sender { - constructor(target) { - this.target = target; - this.handlers = new Set(); - } - /** - * Unsubscribe the handler and remove it from our tracking Set. - * - * @param handler - The handler to unsubscribe. - */ - - - removeMessageHandler(handler) { - if (handler.messageChannel) { - handler.messageChannel.port1.removeEventListener('message', handler.onMessage); - handler.messageChannel.port1.close(); - } - - this.handlers.delete(handler); - } - /** - * Send a message to the Receiver located at {@link target}. - * - * @remarks - * We'll first wait a bit for an ACK , if we get one we will wait significantly longer until the - * receiver has had a chance to fully process the event. - * - * @param eventType - Type of event to send. - * @param data - The payload of the event. - * @param timeout - Timeout for waiting on an ACK from the receiver. - * - * @returns An array of settled promises from all the handlers that were listening on the receiver. - */ - - - async _send(eventType, data) { - let timeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50; - const messageChannel = typeof MessageChannel !== 'undefined' ? new MessageChannel() : null; - - if (!messageChannel) { - throw new Error("connection_unavailable" - /* CONNECTION_UNAVAILABLE */ - ); - } // Node timers and browser timers return fundamentally different types. - // We don't actually care what the value is but TS won't accept unknown and - // we can't cast properly in both environments. - // eslint-disable-next-line @typescript-eslint/no-explicit-any - - - let completionTimer; - let handler; - return new Promise((resolve, reject) => { - const eventId = _generateEventId('', 20); - - messageChannel.port1.start(); - const ackTimer = setTimeout(() => { - reject(new Error("unsupported_event" - /* UNSUPPORTED_EVENT */ - )); - }, timeout); - handler = { - messageChannel, - - onMessage(event) { - const messageEvent = event; - - if (messageEvent.data.eventId !== eventId) { - return; - } - - switch (messageEvent.data.status) { - case "ack" - /* ACK */ - : - // The receiver should ACK first. - clearTimeout(ackTimer); - completionTimer = setTimeout(() => { - reject(new Error("timeout" - /* TIMEOUT */ - )); - }, 3000 - /* COMPLETION */ - ); - break; - - case "done" - /* DONE */ - : - // Once the receiver's handlers are finished we will get the results. - clearTimeout(completionTimer); - resolve(messageEvent.data.response); - break; - - default: - clearTimeout(ackTimer); - clearTimeout(completionTimer); - reject(new Error("invalid_response" - /* INVALID_RESPONSE */ - )); - break; - } - } - - }; - this.handlers.add(handler); - messageChannel.port1.addEventListener('message', handler.onMessage); - this.target.postMessage({ - eventType, - eventId, - data - }, [messageChannel.port2]); - }).finally(() => { - if (handler) { - this.removeMessageHandler(handler); - } - }); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Lazy accessor for window, since the compat layer won't tree shake this out, - * we need to make sure not to mess with window unless we have to - */ - - -function _window() { - return window; -} - -function _setWindowLocation(url) { - _window().location.href = url; -} -/** - * @license - * Copyright 2020 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -function _isWorker() { - return typeof _window()['WorkerGlobalScope'] !== 'undefined' && typeof _window()['importScripts'] === 'function'; -} - -async function _getActiveServiceWorker() { - if (!(navigator === null || navigator === void 0 ? void 0 : navigator.serviceWorker)) { - return null; - } - - try { - const registration = await navigator.serviceWorker.ready; - return registration.active; - } catch (_a) { - return null; - } -} - -function _getServiceWorkerController() { - var _a; - - return ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.serviceWorker) === null || _a === void 0 ? void 0 : _a.controller) || null; -} - -function _getWorkerGlobalScope() { - return _isWorker() ? self : null; -} -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const DB_NAME = 'firebaseLocalStorageDb'; -const DB_VERSION = 1; -const DB_OBJECTSTORE_NAME = 'firebaseLocalStorage'; -const DB_DATA_KEYPATH = 'fbase_key'; -/** - * Promise wrapper for IDBRequest - * - * Unfortunately we can't cleanly extend Promise since promises are not callable in ES6 - * - */ - -class DBPromise { - constructor(request) { - this.request = request; - } - - toPromise() { - return new Promise((resolve, reject) => { - this.request.addEventListener('success', () => { - resolve(this.request.result); - }); - this.request.addEventListener('error', () => { - reject(this.request.error); - }); - }); - } - -} - -function getObjectStore(db, isReadWrite) { - return db.transaction([DB_OBJECTSTORE_NAME], isReadWrite ? 'readwrite' : 'readonly').objectStore(DB_OBJECTSTORE_NAME); -} - -function _deleteDatabase() { - const request = indexedDB.deleteDatabase(DB_NAME); - return new DBPromise(request).toPromise(); -} - -function _openDatabase() { - const request = indexedDB.open(DB_NAME, DB_VERSION); - return new Promise((resolve, reject) => { - request.addEventListener('error', () => { - reject(request.error); - }); - request.addEventListener('upgradeneeded', () => { - const db = request.result; - - try { - db.createObjectStore(DB_OBJECTSTORE_NAME, { - keyPath: DB_DATA_KEYPATH - }); - } catch (e) { - reject(e); - } - }); - request.addEventListener('success', async () => { - const db = request.result; // Strange bug that occurs in Firefox when multiple tabs are opened at the - // same time. The only way to recover seems to be deleting the database - // and re-initializing it. - // https://github.com/firebase/firebase-js-sdk/issues/634 - - if (!db.objectStoreNames.contains(DB_OBJECTSTORE_NAME)) { - // Need to close the database or else you get a `blocked` event - db.close(); - await _deleteDatabase(); - resolve(await _openDatabase()); - } else { - resolve(db); - } - }); - }); -} - -async function _putObject(db, key, value) { - const request = getObjectStore(db, true).put({ - [DB_DATA_KEYPATH]: key, - value - }); - return new DBPromise(request).toPromise(); -} - -async function getObject(db, key) { - const request = getObjectStore(db, false).get(key); - const data = await new DBPromise(request).toPromise(); - return data === undefined ? null : data.value; -} - -function _deleteObject(db, key) { - const request = getObjectStore(db, true).delete(key); - return new DBPromise(request).toPromise(); -} - -const _POLLING_INTERVAL_MS = 800; -const _TRANSACTION_RETRY_COUNT = 3; - -class IndexedDBLocalPersistence { - constructor() { - this.type = "LOCAL" - /* LOCAL */ - ; - this._shouldAllowMigration = true; - this.listeners = {}; - this.localCache = {}; // setTimeout return value is platform specific - // eslint-disable-next-line @typescript-eslint/no-explicit-any - - this.pollTimer = null; - this.pendingWrites = 0; - this.receiver = null; - this.sender = null; - this.serviceWorkerReceiverAvailable = false; - this.activeServiceWorker = null; // Fire & forget the service worker registration as it may never resolve - - this._workerInitializationPromise = this.initializeServiceWorkerMessaging().then(() => {}, () => {}); - } - - async _openDb() { - if (this.db) { - return this.db; - } - - this.db = await _openDatabase(); - return this.db; - } - - async _withRetries(op) { - let numAttempts = 0; - - while (true) { - try { - const db = await this._openDb(); - return await op(db); - } catch (e) { - if (numAttempts++ > _TRANSACTION_RETRY_COUNT) { - throw e; - } - - if (this.db) { - this.db.close(); - this.db = undefined; - } // TODO: consider adding exponential backoff - - } - } - } - /** - * IndexedDB events do not propagate from the main window to the worker context. We rely on a - * postMessage interface to send these events to the worker ourselves. - */ - - - async initializeServiceWorkerMessaging() { - return _isWorker() ? this.initializeReceiver() : this.initializeSender(); - } - /** - * As the worker we should listen to events from the main window. - */ - - - async initializeReceiver() { - this.receiver = Receiver._getInstance(_getWorkerGlobalScope()); // Refresh from persistence if we receive a KeyChanged message. - - this.receiver._subscribe("keyChanged" - /* KEY_CHANGED */ - , async (_origin, data) => { - const keys = await this._poll(); - return { - keyProcessed: keys.includes(data.key) - }; - }); // Let the sender know that we are listening so they give us more timeout. - - - this.receiver._subscribe("ping" - /* PING */ - , async (_origin, _data) => { - return ["keyChanged" - /* KEY_CHANGED */ - ]; - }); - } - /** - * As the main window, we should let the worker know when keys change (set and remove). - * - * @remarks - * {@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/ready | ServiceWorkerContainer.ready} - * may not resolve. - */ - - - async initializeSender() { - var _a, _b; // Check to see if there's an active service worker. - - - this.activeServiceWorker = await _getActiveServiceWorker(); - - if (!this.activeServiceWorker) { - return; - } - - this.sender = new Sender(this.activeServiceWorker); // Ping the service worker to check what events they can handle. - - const results = await this.sender._send("ping" - /* PING */ - , {}, 800 - /* LONG_ACK */ - ); - - if (!results) { - return; - } - - if (((_a = results[0]) === null || _a === void 0 ? void 0 : _a.fulfilled) && ((_b = results[0]) === null || _b === void 0 ? void 0 : _b.value.includes("keyChanged" - /* KEY_CHANGED */ - ))) { - this.serviceWorkerReceiverAvailable = true; - } - } - /** - * Let the worker know about a changed key, the exact key doesn't technically matter since the - * worker will just trigger a full sync anyway. - * - * @remarks - * For now, we only support one service worker per page. - * - * @param key - Storage key which changed. - */ - - - async notifyServiceWorker(key) { - if (!this.sender || !this.activeServiceWorker || _getServiceWorkerController() !== this.activeServiceWorker) { - return; - } - - try { - await this.sender._send("keyChanged" - /* KEY_CHANGED */ - , { - key - }, // Use long timeout if receiver has previously responded to a ping from us. - this.serviceWorkerReceiverAvailable ? 800 - /* LONG_ACK */ - : 50 - /* ACK */ - ); - } catch (_a) {// This is a best effort approach. Ignore errors. - } - } - - async _isAvailable() { - try { - if (!indexedDB) { - return false; - } - - const db = await _openDatabase(); - await _putObject(db, STORAGE_AVAILABLE_KEY, '1'); - await _deleteObject(db, STORAGE_AVAILABLE_KEY); - return true; - } catch (_a) {} - - return false; - } - - async _withPendingWrite(write) { - this.pendingWrites++; - - try { - await write(); - } finally { - this.pendingWrites--; - } - } - - async _set(key, value) { - return this._withPendingWrite(async () => { - await this._withRetries(db => _putObject(db, key, value)); - this.localCache[key] = value; - return this.notifyServiceWorker(key); - }); - } - - async _get(key) { - const obj = await this._withRetries(db => getObject(db, key)); - this.localCache[key] = obj; - return obj; - } - - async _remove(key) { - return this._withPendingWrite(async () => { - await this._withRetries(db => _deleteObject(db, key)); - delete this.localCache[key]; - return this.notifyServiceWorker(key); - }); - } - - async _poll() { - // TODO: check if we need to fallback if getAll is not supported - const result = await this._withRetries(db => { - const getAllRequest = getObjectStore(db, false).getAll(); - return new DBPromise(getAllRequest).toPromise(); - }); - - if (!result) { - return []; - } // If we have pending writes in progress abort, we'll get picked up on the next poll - - - if (this.pendingWrites !== 0) { - return []; - } - - const keys = []; - const keysInResult = new Set(); - - for (const { - fbase_key: key, - value - } of result) { - keysInResult.add(key); - - if (JSON.stringify(this.localCache[key]) !== JSON.stringify(value)) { - this.notifyListeners(key, value); - keys.push(key); - } - } - - for (const localKey of Object.keys(this.localCache)) { - if (this.localCache[localKey] && !keysInResult.has(localKey)) { - // Deleted - this.notifyListeners(localKey, null); - keys.push(localKey); - } - } - - return keys; - } - - notifyListeners(key, newValue) { - this.localCache[key] = newValue; - const listeners = this.listeners[key]; - - if (listeners) { - for (const listener of Array.from(listeners)) { - listener(newValue); - } - } - } - - startPolling() { - this.stopPolling(); - this.pollTimer = setInterval(async () => this._poll(), _POLLING_INTERVAL_MS); - } - - stopPolling() { - if (this.pollTimer) { - clearInterval(this.pollTimer); - this.pollTimer = null; - } - } - - _addListener(key, listener) { - if (Object.keys(this.listeners).length === 0) { - this.startPolling(); - } - - if (!this.listeners[key]) { - this.listeners[key] = new Set(); // Populate the cache to avoid spuriously triggering on first poll. - - void this._get(key); // This can happen in the background async and we can return immediately. - } - - this.listeners[key].add(listener); - } - - _removeListener(key, listener) { - if (this.listeners[key]) { - this.listeners[key].delete(listener); - - if (this.listeners[key].size === 0) { - delete this.listeners[key]; - } - } - - if (Object.keys(this.listeners).length === 0) { - this.stopPolling(); - } - } - -} - -IndexedDBLocalPersistence.type = 'LOCAL'; -/** - * An implementation of {@link Persistence} of type `LOCAL` using `indexedDB` - * for the underlying storage. - * - * @public - */ - -const indexedDBLocalPersistence = IndexedDBLocalPersistence; -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function startSignInPhoneMfa(auth, request) { - return _performApiRequest(auth, "POST" - /* POST */ - , "/v2/accounts/mfaSignIn:start" - /* START_PHONE_MFA_SIGN_IN */ - , _addTidIfNecessary(auth, request)); -} - -function finalizeSignInPhoneMfa(auth, request) { - return _performApiRequest(auth, "POST" - /* POST */ - , "/v2/accounts/mfaSignIn:finalize" - /* FINALIZE_PHONE_MFA_SIGN_IN */ - , _addTidIfNecessary(auth, request)); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -async function getRecaptchaParams(auth) { - return (await _performApiRequest(auth, "GET" - /* GET */ - , "/v1/recaptchaParams" - /* GET_RECAPTCHA_PARAM */ - )).recaptchaSiteKey || ''; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -function getScriptParentElement() { - var _a, _b; - - return (_b = (_a = document.getElementsByTagName('head')) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : document; -} - -function _loadJS(url) { - // TODO: consider adding timeout support & cancellation - return new Promise((resolve, reject) => { - const el = document.createElement('script'); - el.setAttribute('src', url); - el.onload = resolve; - - el.onerror = e => { - const error = _createError("internal-error" - /* INTERNAL_ERROR */ - ); - - error.customData = e; - reject(error); - }; - - el.type = 'text/javascript'; - el.charset = 'UTF-8'; - getScriptParentElement().appendChild(el); - }); -} - -function _generateCallbackName(prefix) { - return `__${prefix}${Math.floor(Math.random() * 1000000)}`; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const _SOLVE_TIME_MS = 500; -const _EXPIRATION_TIME_MS = 60000; -const _WIDGET_ID_START = 1000000000000; - -class MockReCaptcha { - constructor(auth) { - this.auth = auth; - this.counter = _WIDGET_ID_START; - this._widgets = new Map(); - } - - render(container, parameters) { - const id = this.counter; - - this._widgets.set(id, new MockWidget(container, this.auth.name, parameters || {})); - - this.counter++; - return id; - } - - reset(optWidgetId) { - var _a; - - const id = optWidgetId || _WIDGET_ID_START; - void ((_a = this._widgets.get(id)) === null || _a === void 0 ? void 0 : _a.delete()); - - this._widgets.delete(id); - } - - getResponse(optWidgetId) { - var _a; - - const id = optWidgetId || _WIDGET_ID_START; - return ((_a = this._widgets.get(id)) === null || _a === void 0 ? void 0 : _a.getResponse()) || ''; - } - - async execute(optWidgetId) { - var _a; - - const id = optWidgetId || _WIDGET_ID_START; - void ((_a = this._widgets.get(id)) === null || _a === void 0 ? void 0 : _a.execute()); - return ''; - } - -} - -class MockWidget { - constructor(containerOrId, appName, params) { - this.params = params; - this.timerId = null; - this.deleted = false; - this.responseToken = null; - - this.clickHandler = () => { - this.execute(); - }; - - const container = typeof containerOrId === 'string' ? document.getElementById(containerOrId) : containerOrId; - - _assert(container, "argument-error" - /* ARGUMENT_ERROR */ - , { - appName - }); - - this.container = container; - this.isVisible = this.params.size !== 'invisible'; - - if (this.isVisible) { - this.execute(); - } else { - this.container.addEventListener('click', this.clickHandler); - } - } - - getResponse() { - this.checkIfDeleted(); - return this.responseToken; - } - - delete() { - this.checkIfDeleted(); - this.deleted = true; - - if (this.timerId) { - clearTimeout(this.timerId); - this.timerId = null; - } - - this.container.removeEventListener('click', this.clickHandler); - } - - execute() { - this.checkIfDeleted(); - - if (this.timerId) { - return; - } - - this.timerId = window.setTimeout(() => { - this.responseToken = generateRandomAlphaNumericString(50); - const { - callback, - 'expired-callback': expiredCallback - } = this.params; - - if (callback) { - try { - callback(this.responseToken); - } catch (e) {} - } - - this.timerId = window.setTimeout(() => { - this.timerId = null; - this.responseToken = null; - - if (expiredCallback) { - try { - expiredCallback(); - } catch (e) {} - } - - if (this.isVisible) { - this.execute(); - } - }, _EXPIRATION_TIME_MS); - }, _SOLVE_TIME_MS); - } - - checkIfDeleted() { - if (this.deleted) { - throw new Error('reCAPTCHA mock was already deleted!'); - } - } - -} - -function generateRandomAlphaNumericString(len) { - const chars = []; - const allowedChars = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; - - for (let i = 0; i < len; i++) { - chars.push(allowedChars.charAt(Math.floor(Math.random() * allowedChars.length))); - } - - return chars.join(''); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// ReCaptcha will load using the same callback, so the callback function needs -// to be kept around - - -const _JSLOAD_CALLBACK = _generateCallbackName('rcb'); - -const NETWORK_TIMEOUT_DELAY = new Delay(30000, 60000); -const RECAPTCHA_BASE = 'https://www.google.com/recaptcha/api.js?'; -/** - * Loader for the GReCaptcha library. There should only ever be one of this. - */ - -class ReCaptchaLoaderImpl { - constructor() { - var _a; - - this.hostLanguage = ''; - this.counter = 0; - /** - * Check for `render()` method. `window.grecaptcha` will exist if the Enterprise - * version of the ReCAPTCHA script was loaded by someone else (e.g. App Check) but - * `window.grecaptcha.render()` will not. Another load will add it. - */ - - this.librarySeparatelyLoaded = !!((_a = _window().grecaptcha) === null || _a === void 0 ? void 0 : _a.render); - } - - load(auth) { - let hl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; - - _assert(isHostLanguageValid(hl), auth, "argument-error" - /* ARGUMENT_ERROR */ - ); - - if (this.shouldResolveImmediately(hl)) { - return Promise.resolve(_window().grecaptcha); - } - - return new Promise((resolve, reject) => { - const networkTimeout = _window().setTimeout(() => { - reject(_createError(auth, "network-request-failed" - /* NETWORK_REQUEST_FAILED */ - )); - }, NETWORK_TIMEOUT_DELAY.get()); - - _window()[_JSLOAD_CALLBACK] = () => { - _window().clearTimeout(networkTimeout); - - delete _window()[_JSLOAD_CALLBACK]; - - const recaptcha = _window().grecaptcha; - - if (!recaptcha) { - reject(_createError(auth, "internal-error" - /* INTERNAL_ERROR */ - )); - return; - } // Wrap the greptcha render function so that we know if the developer has - // called it separately - - - const render = recaptcha.render; - - recaptcha.render = (container, params) => { - const widgetId = render(container, params); - this.counter++; - return widgetId; - }; - - this.hostLanguage = hl; - resolve(recaptcha); - }; - - const url = `${RECAPTCHA_BASE}?${(0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.querystring)({ - onload: _JSLOAD_CALLBACK, - render: 'explicit', - hl - })}`; - - _loadJS(url).catch(() => { - clearTimeout(networkTimeout); - reject(_createError(auth, "internal-error" - /* INTERNAL_ERROR */ - )); - }); - }); - } - - clearedOneInstance() { - this.counter--; - } - - shouldResolveImmediately(hl) { - var _a; // We can resolve immediately if: - // • grecaptcha is already defined AND ( - // 1. the requested language codes are the same OR - // 2. there exists already a ReCaptcha on the page - // 3. the library was already loaded by the app - // In cases (2) and (3), we _can't_ reload as it would break the recaptchas - // that are already in the page - - - return !!((_a = _window().grecaptcha) === null || _a === void 0 ? void 0 : _a.render) && (hl === this.hostLanguage || this.counter > 0 || this.librarySeparatelyLoaded); - } - -} - -function isHostLanguageValid(hl) { - return hl.length <= 6 && /^\s*[a-zA-Z0-9\-]*\s*$/.test(hl); -} - -class MockReCaptchaLoaderImpl { - async load(auth) { - return new MockReCaptcha(auth); - } - - clearedOneInstance() {} - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const RECAPTCHA_VERIFIER_TYPE = 'recaptcha'; -const DEFAULT_PARAMS = { - theme: 'light', - type: 'image' -}; -/** - * An {@link https://www.google.com/recaptcha/ | reCAPTCHA}-based application verifier. - * - * @public - */ - -class RecaptchaVerifier { - /** - * - * @param containerOrId - The reCAPTCHA container parameter. - * - * @remarks - * This has different meaning depending on whether the reCAPTCHA is hidden or visible. For a - * visible reCAPTCHA the container must be empty. If a string is used, it has to correspond to - * an element ID. The corresponding element must also must be in the DOM at the time of - * initialization. - * - * @param parameters - The optional reCAPTCHA parameters. - * - * @remarks - * Check the reCAPTCHA docs for a comprehensive list. All parameters are accepted except for - * the sitekey. Firebase Auth backend provisions a reCAPTCHA for each project and will - * configure this upon rendering. For an invisible reCAPTCHA, a size key must have the value - * 'invisible'. - * - * @param authExtern - The corresponding Firebase {@link Auth} instance. - */ - constructor(containerOrId) { - let parameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Object.assign({}, DEFAULT_PARAMS); - let authExtern = arguments.length > 2 ? arguments[2] : undefined; - this.parameters = parameters; - /** - * The application verifier type. - * - * @remarks - * For a reCAPTCHA verifier, this is 'recaptcha'. - */ - - this.type = RECAPTCHA_VERIFIER_TYPE; - this.destroyed = false; - this.widgetId = null; - this.tokenChangeListeners = new Set(); - this.renderPromise = null; - this.recaptcha = null; - this.auth = _castAuth(authExtern); - this.isInvisible = this.parameters.size === 'invisible'; - - _assert(typeof document !== 'undefined', this.auth, "operation-not-supported-in-this-environment" - /* OPERATION_NOT_SUPPORTED */ - ); - - const container = typeof containerOrId === 'string' ? document.getElementById(containerOrId) : containerOrId; - - _assert(container, this.auth, "argument-error" - /* ARGUMENT_ERROR */ - ); - - this.container = container; - this.parameters.callback = this.makeTokenCallback(this.parameters.callback); - this._recaptchaLoader = this.auth.settings.appVerificationDisabledForTesting ? new MockReCaptchaLoaderImpl() : new ReCaptchaLoaderImpl(); - this.validateStartingState(); // TODO: Figure out if sdk version is needed - } - /** - * Waits for the user to solve the reCAPTCHA and resolves with the reCAPTCHA token. - * - * @returns A Promise for the reCAPTCHA token. - */ - - - async verify() { - this.assertNotDestroyed(); - const id = await this.render(); - const recaptcha = this.getAssertedRecaptcha(); - const response = recaptcha.getResponse(id); - - if (response) { - return response; - } - - return new Promise(resolve => { - const tokenChange = token => { - if (!token) { - return; // Ignore token expirations. - } - - this.tokenChangeListeners.delete(tokenChange); - resolve(token); - }; - - this.tokenChangeListeners.add(tokenChange); - - if (this.isInvisible) { - recaptcha.execute(id); - } - }); - } - /** - * Renders the reCAPTCHA widget on the page. - * - * @returns A Promise that resolves with the reCAPTCHA widget ID. - */ - - - render() { - try { - this.assertNotDestroyed(); - } catch (e) { - // This method returns a promise. Since it's not async (we want to return the - // _same_ promise if rendering is still occurring), the API surface should - // reject with the error rather than just throw - return Promise.reject(e); - } - - if (this.renderPromise) { - return this.renderPromise; - } - - this.renderPromise = this.makeRenderPromise().catch(e => { - this.renderPromise = null; - throw e; - }); - return this.renderPromise; - } - /** @internal */ - - - _reset() { - this.assertNotDestroyed(); - - if (this.widgetId !== null) { - this.getAssertedRecaptcha().reset(this.widgetId); - } - } - /** - * Clears the reCAPTCHA widget from the page and destroys the instance. - */ - - - clear() { - this.assertNotDestroyed(); - this.destroyed = true; - - this._recaptchaLoader.clearedOneInstance(); - - if (!this.isInvisible) { - this.container.childNodes.forEach(node => { - this.container.removeChild(node); - }); - } - } - - validateStartingState() { - _assert(!this.parameters.sitekey, this.auth, "argument-error" - /* ARGUMENT_ERROR */ - ); - - _assert(this.isInvisible || !this.container.hasChildNodes(), this.auth, "argument-error" - /* ARGUMENT_ERROR */ - ); - - _assert(typeof document !== 'undefined', this.auth, "operation-not-supported-in-this-environment" - /* OPERATION_NOT_SUPPORTED */ - ); - } - - makeTokenCallback(existing) { - return token => { - this.tokenChangeListeners.forEach(listener => listener(token)); - - if (typeof existing === 'function') { - existing(token); - } else if (typeof existing === 'string') { - const globalFunc = _window()[existing]; - - if (typeof globalFunc === 'function') { - globalFunc(token); - } - } - }; - } - - assertNotDestroyed() { - _assert(!this.destroyed, this.auth, "internal-error" - /* INTERNAL_ERROR */ - ); - } - - async makeRenderPromise() { - await this.init(); - - if (!this.widgetId) { - let container = this.container; - - if (!this.isInvisible) { - const guaranteedEmpty = document.createElement('div'); - container.appendChild(guaranteedEmpty); - container = guaranteedEmpty; - } - - this.widgetId = this.getAssertedRecaptcha().render(container, this.parameters); - } - - return this.widgetId; - } - - async init() { - _assert(_isHttpOrHttps() && !_isWorker(), this.auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - await domReady(); - this.recaptcha = await this._recaptchaLoader.load(this.auth, this.auth.languageCode || undefined); - const siteKey = await getRecaptchaParams(this.auth); - - _assert(siteKey, this.auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - this.parameters.sitekey = siteKey; - } - - getAssertedRecaptcha() { - _assert(this.recaptcha, this.auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - return this.recaptcha; - } - -} - -function domReady() { - let resolver = null; - return new Promise(resolve => { - if (document.readyState === 'complete') { - resolve(); - return; - } // Document not ready, wait for load before resolving. - // Save resolver, so we can remove listener in case it was externally - // cancelled. - - - resolver = () => resolve(); - - window.addEventListener('load', resolver); - }).catch(e => { - if (resolver) { - window.removeEventListener('load', resolver); - } - - throw e; - }); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class ConfirmationResultImpl { - constructor(verificationId, onConfirmation) { - this.verificationId = verificationId; - this.onConfirmation = onConfirmation; - } - - confirm(verificationCode) { - const authCredential = PhoneAuthCredential._fromVerification(this.verificationId, verificationCode); - - return this.onConfirmation(authCredential); - } - -} -/** - * Asynchronously signs in using a phone number. - * - * @remarks - * This method sends a code via SMS to the given - * phone number, and returns a {@link ConfirmationResult}. After the user - * provides the code sent to their phone, call {@link ConfirmationResult.confirm} - * with the code to sign the user in. - * - * For abuse prevention, this method also requires a {@link ApplicationVerifier}. - * This SDK includes a reCAPTCHA-based implementation, {@link RecaptchaVerifier}. - * This function can work on other platforms that do not support the - * {@link RecaptchaVerifier} (like React Native), but you need to use a - * third-party {@link ApplicationVerifier} implementation. - * - * @example - * ```javascript - * // 'recaptcha-container' is the ID of an element in the DOM. - * const applicationVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container'); - * const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier); - * // Obtain a verificationCode from the user. - * const credential = await confirmationResult.confirm(verificationCode); - * ``` - * - * @param auth - The {@link Auth} instance. - * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101). - * @param appVerifier - The {@link ApplicationVerifier}. - * - * @public - */ - - -async function signInWithPhoneNumber(auth, phoneNumber, appVerifier) { - const authInternal = _castAuth(auth); - - const verificationId = await _verifyPhoneNumber(authInternal, phoneNumber, (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(appVerifier)); - return new ConfirmationResultImpl(verificationId, cred => signInWithCredential(authInternal, cred)); -} -/** - * Links the user account with the given phone number. - * - * @param user - The user. - * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101). - * @param appVerifier - The {@link ApplicationVerifier}. - * - * @public - */ - - -async function linkWithPhoneNumber(user, phoneNumber, appVerifier) { - const userInternal = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(user); - await _assertLinkedStatus(false, userInternal, "phone" - /* PHONE */ - ); - const verificationId = await _verifyPhoneNumber(userInternal.auth, phoneNumber, (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(appVerifier)); - return new ConfirmationResultImpl(verificationId, cred => linkWithCredential(userInternal, cred)); -} -/** - * Re-authenticates a user using a fresh phone credential. - * - * @remarks Use before operations such as {@link updatePassword} that require tokens from recent sign-in attempts. - * - * @param user - The user. - * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101). - * @param appVerifier - The {@link ApplicationVerifier}. - * - * @public - */ - - -async function reauthenticateWithPhoneNumber(user, phoneNumber, appVerifier) { - const userInternal = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(user); - const verificationId = await _verifyPhoneNumber(userInternal.auth, phoneNumber, (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(appVerifier)); - return new ConfirmationResultImpl(verificationId, cred => reauthenticateWithCredential(userInternal, cred)); -} -/** - * Returns a verification ID to be used in conjunction with the SMS code that is sent. - * - */ - - -async function _verifyPhoneNumber(auth, options, verifier) { - var _a; - - const recaptchaToken = await verifier.verify(); - - try { - _assert(typeof recaptchaToken === 'string', auth, "argument-error" - /* ARGUMENT_ERROR */ - ); - - _assert(verifier.type === RECAPTCHA_VERIFIER_TYPE, auth, "argument-error" - /* ARGUMENT_ERROR */ - ); - - let phoneInfoOptions; - - if (typeof options === 'string') { - phoneInfoOptions = { - phoneNumber: options - }; - } else { - phoneInfoOptions = options; - } - - if ('session' in phoneInfoOptions) { - const session = phoneInfoOptions.session; - - if ('phoneNumber' in phoneInfoOptions) { - _assert(session.type === "enroll" - /* ENROLL */ - , auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - const response = await startEnrollPhoneMfa(auth, { - idToken: session.credential, - phoneEnrollmentInfo: { - phoneNumber: phoneInfoOptions.phoneNumber, - recaptchaToken - } - }); - return response.phoneSessionInfo.sessionInfo; - } else { - _assert(session.type === "signin" - /* SIGN_IN */ - , auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - const mfaEnrollmentId = ((_a = phoneInfoOptions.multiFactorHint) === null || _a === void 0 ? void 0 : _a.uid) || phoneInfoOptions.multiFactorUid; - - _assert(mfaEnrollmentId, auth, "missing-multi-factor-info" - /* MISSING_MFA_INFO */ - ); - - const response = await startSignInPhoneMfa(auth, { - mfaPendingCredential: session.credential, - mfaEnrollmentId, - phoneSignInInfo: { - recaptchaToken - } - }); - return response.phoneResponseInfo.sessionInfo; - } - } else { - const { - sessionInfo - } = await sendPhoneVerificationCode(auth, { - phoneNumber: phoneInfoOptions.phoneNumber, - recaptchaToken - }); - return sessionInfo; - } - } finally { - verifier._reset(); - } -} -/** - * Updates the user's phone number. - * - * @example - * ``` - * // 'recaptcha-container' is the ID of an element in the DOM. - * const applicationVerifier = new RecaptchaVerifier('recaptcha-container'); - * const provider = new PhoneAuthProvider(auth); - * const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier); - * // Obtain the verificationCode from the user. - * const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * await updatePhoneNumber(user, phoneCredential); - * ``` - * - * @param user - The user. - * @param credential - A credential authenticating the new phone number. - * - * @public - */ - - -async function updatePhoneNumber(user, credential) { - await _link$1((0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(user), credential); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Provider for generating an {@link PhoneAuthCredential}. - * - * @example - * ```javascript - * // 'recaptcha-container' is the ID of an element in the DOM. - * const applicationVerifier = new RecaptchaVerifier('recaptcha-container'); - * const provider = new PhoneAuthProvider(auth); - * const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier); - * // Obtain the verificationCode from the user. - * const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const userCredential = await signInWithCredential(auth, phoneCredential); - * ``` - * - * @public - */ - - -class PhoneAuthProvider { - /** - * @param auth - The Firebase {@link Auth} instance in which sign-ins should occur. - * - */ - constructor(auth) { - /** Always set to {@link ProviderId}.PHONE. */ - this.providerId = PhoneAuthProvider.PROVIDER_ID; - this.auth = _castAuth(auth); - } - /** - * - * Starts a phone number authentication flow by sending a verification code to the given phone - * number. - * - * @example - * ```javascript - * const provider = new PhoneAuthProvider(auth); - * const verificationId = await provider.verifyPhoneNumber(phoneNumber, applicationVerifier); - * // Obtain verificationCode from the user. - * const authCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const userCredential = await signInWithCredential(auth, authCredential); - * ``` - * - * @example - * An alternative flow is provided using the `signInWithPhoneNumber` method. - * ```javascript - * const confirmationResult = signInWithPhoneNumber(auth, phoneNumber, applicationVerifier); - * // Obtain verificationCode from the user. - * const userCredential = confirmationResult.confirm(verificationCode); - * ``` - * - * @param phoneInfoOptions - The user's {@link PhoneInfoOptions}. The phone number should be in - * E.164 format (e.g. +16505550101). - * @param applicationVerifier - For abuse prevention, this method also requires a - * {@link ApplicationVerifier}. This SDK includes a reCAPTCHA-based implementation, - * {@link RecaptchaVerifier}. - * - * @returns A Promise for a verification ID that can be passed to - * {@link PhoneAuthProvider.credential} to identify this flow.. - */ - - - verifyPhoneNumber(phoneOptions, applicationVerifier) { - return _verifyPhoneNumber(this.auth, phoneOptions, (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(applicationVerifier)); - } - /** - * Creates a phone auth credential, given the verification ID from - * {@link PhoneAuthProvider.verifyPhoneNumber} and the code that was sent to the user's - * mobile device. - * - * @example - * ```javascript - * const provider = new PhoneAuthProvider(auth); - * const verificationId = provider.verifyPhoneNumber(phoneNumber, applicationVerifier); - * // Obtain verificationCode from the user. - * const authCredential = PhoneAuthProvider.credential(verificationId, verificationCode); - * const userCredential = signInWithCredential(auth, authCredential); - * ``` - * - * @example - * An alternative flow is provided using the `signInWithPhoneNumber` method. - * ```javascript - * const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier); - * // Obtain verificationCode from the user. - * const userCredential = await confirmationResult.confirm(verificationCode); - * ``` - * - * @param verificationId - The verification ID returned from {@link PhoneAuthProvider.verifyPhoneNumber}. - * @param verificationCode - The verification code sent to the user's mobile device. - * - * @returns The auth provider credential. - */ - - - static credential(verificationId, verificationCode) { - return PhoneAuthCredential._fromVerification(verificationId, verificationCode); - } - /** - * Generates an {@link AuthCredential} from a {@link UserCredential}. - * @param userCredential - The user credential. - */ - - - static credentialFromResult(userCredential) { - const credential = userCredential; - return PhoneAuthProvider.credentialFromTaggedObject(credential); - } - /** - * Returns an {@link AuthCredential} when passed an error. - * - * @remarks - * - * This method works for errors like - * `auth/account-exists-with-different-credentials`. This is useful for - * recovering when attempting to set a user's phone number but the number - * in question is already tied to another account. For example, the following - * code tries to update the current user's phone number, and if that - * fails, links the user with the account associated with that number: - * - * ```js - * const provider = new PhoneAuthProvider(auth); - * const verificationId = await provider.verifyPhoneNumber(number, verifier); - * try { - * const code = ''; // Prompt the user for the verification code - * await updatePhoneNumber( - * auth.currentUser, - * PhoneAuthProvider.credential(verificationId, code)); - * } catch (e) { - * if ((e as FirebaseError)?.code === 'auth/account-exists-with-different-credential') { - * const cred = PhoneAuthProvider.credentialFromError(e); - * await linkWithCredential(auth.currentUser, cred); - * } - * } - * - * // At this point, auth.currentUser.phoneNumber === number. - * ``` - * - * @param error - The error to generate a credential from. - */ - - - static credentialFromError(error) { - return PhoneAuthProvider.credentialFromTaggedObject(error.customData || {}); - } - - static credentialFromTaggedObject(_ref12) { - let { - _tokenResponse: tokenResponse - } = _ref12; - - if (!tokenResponse) { - return null; - } - - const { - phoneNumber, - temporaryProof - } = tokenResponse; - - if (phoneNumber && temporaryProof) { - return PhoneAuthCredential._fromTokenResponse(phoneNumber, temporaryProof); - } - - return null; - } - -} -/** Always set to {@link ProviderId}.PHONE. */ - - -PhoneAuthProvider.PROVIDER_ID = "phone" -/* PHONE */ -; -/** Always set to {@link SignInMethod}.PHONE. */ - -PhoneAuthProvider.PHONE_SIGN_IN_METHOD = "phone" -/* PHONE */ -; -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Chooses a popup/redirect resolver to use. This prefers the override (which - * is directly passed in), and falls back to the property set on the auth - * object. If neither are available, this function errors w/ an argument error. - */ - -function _withDefaultResolver(auth, resolverOverride) { - if (resolverOverride) { - return _getInstance(resolverOverride); - } - - _assert(auth._popupRedirectResolver, auth, "argument-error" - /* ARGUMENT_ERROR */ - ); - - return auth._popupRedirectResolver; -} -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class IdpCredential extends AuthCredential { - constructor(params) { - super("custom" - /* CUSTOM */ - , "custom" - /* CUSTOM */ - ); - this.params = params; - } - - _getIdTokenResponse(auth) { - return signInWithIdp(auth, this._buildIdpRequest()); - } - - _linkToIdToken(auth, idToken) { - return signInWithIdp(auth, this._buildIdpRequest(idToken)); - } - - _getReauthenticationResolver(auth) { - return signInWithIdp(auth, this._buildIdpRequest()); - } - - _buildIdpRequest(idToken) { - const request = { - requestUri: this.params.requestUri, - sessionId: this.params.sessionId, - postBody: this.params.postBody, - tenantId: this.params.tenantId, - pendingToken: this.params.pendingToken, - returnSecureToken: true, - returnIdpCredential: true - }; - - if (idToken) { - request.idToken = idToken; - } - - return request; - } - -} - -function _signIn(params) { - return _signInWithCredential(params.auth, new IdpCredential(params), params.bypassAuthState); -} - -function _reauth(params) { - const { - auth, - user - } = params; - - _assert(user, auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - return _reauthenticate(user, new IdpCredential(params), params.bypassAuthState); -} - -async function _link(params) { - const { - auth, - user - } = params; - - _assert(user, auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - return _link$1(user, new IdpCredential(params), params.bypassAuthState); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Popup event manager. Handles the popup's entire lifecycle; listens to auth - * events - */ - - -class AbstractPopupRedirectOperation { - constructor(auth, filter, resolver, user) { - let bypassAuthState = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; - this.auth = auth; - this.resolver = resolver; - this.user = user; - this.bypassAuthState = bypassAuthState; - this.pendingPromise = null; - this.eventManager = null; - this.filter = Array.isArray(filter) ? filter : [filter]; - } - - execute() { - return new Promise(async (resolve, reject) => { - this.pendingPromise = { - resolve, - reject - }; - - try { - this.eventManager = await this.resolver._initialize(this.auth); - await this.onExecution(); - this.eventManager.registerConsumer(this); - } catch (e) { - this.reject(e); - } - }); - } - - async onAuthEvent(event) { - const { - urlResponse, - sessionId, - postBody, - tenantId, - error, - type - } = event; - - if (error) { - this.reject(error); - return; - } - - const params = { - auth: this.auth, - requestUri: urlResponse, - sessionId: sessionId, - tenantId: tenantId || undefined, - postBody: postBody || undefined, - user: this.user, - bypassAuthState: this.bypassAuthState - }; - - try { - this.resolve(await this.getIdpTask(type)(params)); - } catch (e) { - this.reject(e); - } - } - - onError(error) { - this.reject(error); - } - - getIdpTask(type) { - switch (type) { - case "signInViaPopup" - /* SIGN_IN_VIA_POPUP */ - : - case "signInViaRedirect" - /* SIGN_IN_VIA_REDIRECT */ - : - return _signIn; - - case "linkViaPopup" - /* LINK_VIA_POPUP */ - : - case "linkViaRedirect" - /* LINK_VIA_REDIRECT */ - : - return _link; - - case "reauthViaPopup" - /* REAUTH_VIA_POPUP */ - : - case "reauthViaRedirect" - /* REAUTH_VIA_REDIRECT */ - : - return _reauth; - - default: - _fail(this.auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - } - } - - resolve(cred) { - debugAssert(this.pendingPromise, 'Pending promise was never set'); - this.pendingPromise.resolve(cred); - this.unregisterAndCleanUp(); - } - - reject(error) { - debugAssert(this.pendingPromise, 'Pending promise was never set'); - this.pendingPromise.reject(error); - this.unregisterAndCleanUp(); - } - - unregisterAndCleanUp() { - if (this.eventManager) { - this.eventManager.unregisterConsumer(this); - } - - this.pendingPromise = null; - this.cleanUp(); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const _POLL_WINDOW_CLOSE_TIMEOUT = new Delay(2000, 10000); -/** - * Authenticates a Firebase client using a popup-based OAuth authentication flow. - * - * @remarks - * If succeeds, returns the signed in user along with the provider's credential. If sign in was - * unsuccessful, returns an error object containing additional information about the error. - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new FacebookAuthProvider(); - * const result = await signInWithPopup(auth, provider); - * - * // The signed-in user info. - * const user = result.user; - * // This gives you a Facebook Access Token. - * const credential = provider.credentialFromResult(auth, result); - * const token = credential.accessToken; - * ``` - * - * @param auth - The {@link Auth} instance. - * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}. - * Non-OAuth providers like {@link EmailAuthProvider} will throw an error. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * - * @public - */ - - -async function signInWithPopup(auth, provider, resolver) { - const authInternal = _castAuth(auth); - - _assertInstanceOf(auth, provider, FederatedAuthProvider); - - const resolverInternal = _withDefaultResolver(authInternal, resolver); - - const action = new PopupOperation(authInternal, "signInViaPopup" - /* SIGN_IN_VIA_POPUP */ - , provider, resolverInternal); - return action.executeNotNull(); -} -/** - * Reauthenticates the current user with the specified {@link OAuthProvider} using a pop-up based - * OAuth flow. - * - * @remarks - * If the reauthentication is successful, the returned result will contain the user and the - * provider's credential. - * - * @example - * ```javascript - * // Sign in using a popup. - * const provider = new FacebookAuthProvider(); - * const result = await signInWithPopup(auth, provider); - * // Reauthenticate using a popup. - * await reauthenticateWithPopup(result.user, provider); - * ``` - * - * @param user - The user. - * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}. - * Non-OAuth providers like {@link EmailAuthProvider} will throw an error. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * @public - */ - - -async function reauthenticateWithPopup(user, provider, resolver) { - const userInternal = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(user); - - _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider); - - const resolverInternal = _withDefaultResolver(userInternal.auth, resolver); - - const action = new PopupOperation(userInternal.auth, "reauthViaPopup" - /* REAUTH_VIA_POPUP */ - , provider, resolverInternal, userInternal); - return action.executeNotNull(); -} -/** - * Links the authenticated provider to the user account using a pop-up based OAuth flow. - * - * @remarks - * If the linking is successful, the returned result will contain the user and the provider's credential. - * - * - * @example - * ```javascript - * // Sign in using some other provider. - * const result = await signInWithEmailAndPassword(auth, email, password); - * // Link using a popup. - * const provider = new FacebookAuthProvider(); - * await linkWithPopup(result.user, provider); - * ``` - * - * @param user - The user. - * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}. - * Non-OAuth providers like {@link EmailAuthProvider} will throw an error. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * @public - */ - - -async function linkWithPopup(user, provider, resolver) { - const userInternal = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(user); - - _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider); - - const resolverInternal = _withDefaultResolver(userInternal.auth, resolver); - - const action = new PopupOperation(userInternal.auth, "linkViaPopup" - /* LINK_VIA_POPUP */ - , provider, resolverInternal, userInternal); - return action.executeNotNull(); -} -/** - * Popup event manager. Handles the popup's entire lifecycle; listens to auth - * events - * - */ - - -class PopupOperation extends AbstractPopupRedirectOperation { - constructor(auth, filter, provider, resolver, user) { - super(auth, filter, resolver, user); - this.provider = provider; - this.authWindow = null; - this.pollId = null; - - if (PopupOperation.currentPopupAction) { - PopupOperation.currentPopupAction.cancel(); - } - - PopupOperation.currentPopupAction = this; - } - - async executeNotNull() { - const result = await this.execute(); - - _assert(result, this.auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - return result; - } - - async onExecution() { - debugAssert(this.filter.length === 1, 'Popup operations only handle one event'); - - const eventId = _generateEventId(); - - this.authWindow = await this.resolver._openPopup(this.auth, this.provider, this.filter[0], // There's always one, see constructor - eventId); - this.authWindow.associatedEvent = eventId; // Check for web storage support and origin validation _after_ the popup is - // loaded. These operations are slow (~1 second or so) Rather than - // waiting on them before opening the window, optimistically open the popup - // and check for storage support at the same time. If storage support is - // not available, this will cause the whole thing to reject properly. It - // will also close the popup, but since the promise has already rejected, - // the popup closed by user poll will reject into the void. - - this.resolver._originValidation(this.auth).catch(e => { - this.reject(e); - }); - - this.resolver._isIframeWebStorageSupported(this.auth, isSupported => { - if (!isSupported) { - this.reject(_createError(this.auth, "web-storage-unsupported" - /* WEB_STORAGE_UNSUPPORTED */ - )); - } - }); // Handle user closure. Notice this does *not* use await - - - this.pollUserCancellation(); - } - - get eventId() { - var _a; - - return ((_a = this.authWindow) === null || _a === void 0 ? void 0 : _a.associatedEvent) || null; - } - - cancel() { - this.reject(_createError(this.auth, "cancelled-popup-request" - /* EXPIRED_POPUP_REQUEST */ - )); - } - - cleanUp() { - if (this.authWindow) { - this.authWindow.close(); - } - - if (this.pollId) { - window.clearTimeout(this.pollId); - } - - this.authWindow = null; - this.pollId = null; - PopupOperation.currentPopupAction = null; - } - - pollUserCancellation() { - const poll = () => { - var _a, _b; - - if ((_b = (_a = this.authWindow) === null || _a === void 0 ? void 0 : _a.window) === null || _b === void 0 ? void 0 : _b.closed) { - // Make sure that there is sufficient time for whatever action to - // complete. The window could have closed but the sign in network - // call could still be in flight. - this.pollId = window.setTimeout(() => { - this.pollId = null; - this.reject(_createError(this.auth, "popup-closed-by-user" - /* POPUP_CLOSED_BY_USER */ - )); - }, 2000 - /* AUTH_EVENT */ - ); - return; - } - - this.pollId = window.setTimeout(poll, _POLL_WINDOW_CLOSE_TIMEOUT.get()); - }; - - poll(); - } - -} // Only one popup is ever shown at once. The lifecycle of the current popup -// can be managed / cancelled by the constructor. - - -PopupOperation.currentPopupAction = null; -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -const PENDING_REDIRECT_KEY = 'pendingRedirect'; // We only get one redirect outcome for any one auth, so just store it -// in here. - -const redirectOutcomeMap = new Map(); - -class RedirectAction extends AbstractPopupRedirectOperation { - constructor(auth, resolver) { - let bypassAuthState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - super(auth, ["signInViaRedirect" - /* SIGN_IN_VIA_REDIRECT */ - , "linkViaRedirect" - /* LINK_VIA_REDIRECT */ - , "reauthViaRedirect" - /* REAUTH_VIA_REDIRECT */ - , "unknown" - /* UNKNOWN */ - ], resolver, undefined, bypassAuthState); - this.eventId = null; - } - /** - * Override the execute function; if we already have a redirect result, then - * just return it. - */ - - - async execute() { - let readyOutcome = redirectOutcomeMap.get(this.auth._key()); - - if (!readyOutcome) { - try { - const hasPendingRedirect = await _getAndClearPendingRedirectStatus(this.resolver, this.auth); - const result = hasPendingRedirect ? await super.execute() : null; - - readyOutcome = () => Promise.resolve(result); - } catch (e) { - readyOutcome = () => Promise.reject(e); - } - - redirectOutcomeMap.set(this.auth._key(), readyOutcome); - } // If we're not bypassing auth state, the ready outcome should be set to - // null. - - - if (!this.bypassAuthState) { - redirectOutcomeMap.set(this.auth._key(), () => Promise.resolve(null)); - } - - return readyOutcome(); - } - - async onAuthEvent(event) { - if (event.type === "signInViaRedirect" - /* SIGN_IN_VIA_REDIRECT */ - ) { - return super.onAuthEvent(event); - } else if (event.type === "unknown" - /* UNKNOWN */ - ) { - // This is a sentinel value indicating there's no pending redirect - this.resolve(null); - return; - } - - if (event.eventId) { - const user = await this.auth._redirectUserForId(event.eventId); - - if (user) { - this.user = user; - return super.onAuthEvent(event); - } else { - this.resolve(null); - } - } - } - - async onExecution() {} - - cleanUp() {} - -} - -async function _getAndClearPendingRedirectStatus(resolver, auth) { - const key = pendingRedirectKey(auth); - const persistence = resolverPersistence(resolver); - - if (!(await persistence._isAvailable())) { - return false; - } - - const hasPendingRedirect = (await persistence._get(key)) === 'true'; - await persistence._remove(key); - return hasPendingRedirect; -} - -async function _setPendingRedirectStatus(resolver, auth) { - return resolverPersistence(resolver)._set(pendingRedirectKey(auth), 'true'); -} - -function _clearRedirectOutcomes() { - redirectOutcomeMap.clear(); -} - -function _overrideRedirectResult(auth, result) { - redirectOutcomeMap.set(auth._key(), result); -} - -function resolverPersistence(resolver) { - return _getInstance(resolver._redirectPersistence); -} - -function pendingRedirectKey(auth) { - return _persistenceKeyName(PENDING_REDIRECT_KEY, auth.config.apiKey, auth.name); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Authenticates a Firebase client using a full-page redirect flow. - * - * @remarks - * To handle the results and errors for this operation, refer to {@link getRedirectResult}. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new FacebookAuthProvider(); - * // You can add additional scopes to the provider: - * provider.addScope('user_birthday'); - * // Start a sign in process for an unauthenticated user. - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Facebook Access Token. - * const credential = provider.credentialFromResult(auth, result); - * const token = credential.accessToken; - * } - * // As this API can be used for sign-in, linking and reauthentication, - * // check the operationType to determine what triggered this redirect - * // operation. - * const operationType = result.operationType; - * ``` - * - * @param auth - The {@link Auth} instance. - * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}. - * Non-OAuth providers like {@link EmailAuthProvider} will throw an error. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * @public - */ - - -function signInWithRedirect(auth, provider, resolver) { - return _signInWithRedirect(auth, provider, resolver); -} - -async function _signInWithRedirect(auth, provider, resolver) { - const authInternal = _castAuth(auth); - - _assertInstanceOf(auth, provider, FederatedAuthProvider); - - const resolverInternal = _withDefaultResolver(authInternal, resolver); - - await _setPendingRedirectStatus(resolverInternal, authInternal); - return resolverInternal._openRedirect(authInternal, provider, "signInViaRedirect" - /* SIGN_IN_VIA_REDIRECT */ - ); -} -/** - * Reauthenticates the current user with the specified {@link OAuthProvider} using a full-page redirect flow. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new FacebookAuthProvider(); - * const result = await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * // Link using a redirect. - * await linkWithRedirect(result.user, provider); - * // This will again trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * ``` - * - * @param user - The user. - * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}. - * Non-OAuth providers like {@link EmailAuthProvider} will throw an error. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * @public - */ - - -function reauthenticateWithRedirect(user, provider, resolver) { - return _reauthenticateWithRedirect(user, provider, resolver); -} - -async function _reauthenticateWithRedirect(user, provider, resolver) { - const userInternal = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(user); - - _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider); // Allow the resolver to error before persisting the redirect user - - - const resolverInternal = _withDefaultResolver(userInternal.auth, resolver); - - await _setPendingRedirectStatus(resolverInternal, userInternal.auth); - const eventId = await prepareUserForRedirect(userInternal); - return resolverInternal._openRedirect(userInternal.auth, provider, "reauthViaRedirect" - /* REAUTH_VIA_REDIRECT */ - , eventId); -} -/** - * Links the {@link OAuthProvider} to the user account using a full-page redirect flow. - * - * @example - * ```javascript - * // Sign in using some other provider. - * const result = await signInWithEmailAndPassword(auth, email, password); - * // Link using a redirect. - * const provider = new FacebookAuthProvider(); - * await linkWithRedirect(result.user, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * ``` - * - * @param user - The user. - * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}. - * Non-OAuth providers like {@link EmailAuthProvider} will throw an error. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * - * @public - */ - - -function linkWithRedirect(user, provider, resolver) { - return _linkWithRedirect(user, provider, resolver); -} - -async function _linkWithRedirect(user, provider, resolver) { - const userInternal = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getModularInstance)(user); - - _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider); // Allow the resolver to error before persisting the redirect user - - - const resolverInternal = _withDefaultResolver(userInternal.auth, resolver); - - await _assertLinkedStatus(false, userInternal, provider.providerId); - await _setPendingRedirectStatus(resolverInternal, userInternal.auth); - const eventId = await prepareUserForRedirect(userInternal); - return resolverInternal._openRedirect(userInternal.auth, provider, "linkViaRedirect" - /* LINK_VIA_REDIRECT */ - , eventId); -} -/** - * Returns a {@link UserCredential} from the redirect-based sign-in flow. - * - * @remarks - * If sign-in succeeded, returns the signed in user. If sign-in was unsuccessful, fails with an - * error. If no redirect operation was called, returns a {@link UserCredential} - * with a null `user`. - * - * @example - * ```javascript - * // Sign in using a redirect. - * const provider = new FacebookAuthProvider(); - * // You can add additional scopes to the provider: - * provider.addScope('user_birthday'); - * // Start a sign in process for an unauthenticated user. - * await signInWithRedirect(auth, provider); - * // This will trigger a full page redirect away from your app - * - * // After returning from the redirect when your app initializes you can obtain the result - * const result = await getRedirectResult(auth); - * if (result) { - * // This is the signed-in user - * const user = result.user; - * // This gives you a Facebook Access Token. - * const credential = provider.credentialFromResult(auth, result); - * const token = credential.accessToken; - * } - * // As this API can be used for sign-in, linking and reauthentication, - * // check the operationType to determine what triggered this redirect - * // operation. - * const operationType = result.operationType; - * ``` - * - * @param auth - The {@link Auth} instance. - * @param resolver - An instance of {@link PopupRedirectResolver}, optional - * if already supplied to {@link initializeAuth} or provided by {@link getAuth}. - * - * @public - */ - - -async function getRedirectResult(auth, resolver) { - await _castAuth(auth)._initializationPromise; - return _getRedirectResult(auth, resolver, false); -} - -async function _getRedirectResult(auth, resolverExtern) { - let bypassAuthState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - - const authInternal = _castAuth(auth); - - const resolver = _withDefaultResolver(authInternal, resolverExtern); - - const action = new RedirectAction(authInternal, resolver, bypassAuthState); - const result = await action.execute(); - - if (result && !bypassAuthState) { - delete result.user._redirectEventId; - await authInternal._persistUserIfCurrent(result.user); - await authInternal._setRedirectUser(null, resolverExtern); - } - - return result; -} - -async function prepareUserForRedirect(user) { - const eventId = _generateEventId(`${user.uid}:::`); - - user._redirectEventId = eventId; - await user.auth._setRedirectUser(user); - await user.auth._persistUserIfCurrent(user); - return eventId; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// The amount of time to store the UIDs of seen events; this is -// set to 10 min by default - - -const EVENT_DUPLICATION_CACHE_DURATION_MS = 10 * 60 * 1000; - -class AuthEventManager { - constructor(auth) { - this.auth = auth; - this.cachedEventUids = new Set(); - this.consumers = new Set(); - this.queuedRedirectEvent = null; - this.hasHandledPotentialRedirect = false; - this.lastProcessedEventTime = Date.now(); - } - - registerConsumer(authEventConsumer) { - this.consumers.add(authEventConsumer); - - if (this.queuedRedirectEvent && this.isEventForConsumer(this.queuedRedirectEvent, authEventConsumer)) { - this.sendToConsumer(this.queuedRedirectEvent, authEventConsumer); - this.saveEventToCache(this.queuedRedirectEvent); - this.queuedRedirectEvent = null; - } - } - - unregisterConsumer(authEventConsumer) { - this.consumers.delete(authEventConsumer); - } - - onEvent(event) { - // Check if the event has already been handled - if (this.hasEventBeenHandled(event)) { - return false; - } - - let handled = false; - this.consumers.forEach(consumer => { - if (this.isEventForConsumer(event, consumer)) { - handled = true; - this.sendToConsumer(event, consumer); - this.saveEventToCache(event); - } - }); - - if (this.hasHandledPotentialRedirect || !isRedirectEvent(event)) { - // If we've already seen a redirect before, or this is a popup event, - // bail now - return handled; - } - - this.hasHandledPotentialRedirect = true; // If the redirect wasn't handled, hang on to it - - if (!handled) { - this.queuedRedirectEvent = event; - handled = true; - } - - return handled; - } - - sendToConsumer(event, consumer) { - var _a; - - if (event.error && !isNullRedirectEvent(event)) { - const code = ((_a = event.error.code) === null || _a === void 0 ? void 0 : _a.split('auth/')[1]) || "internal-error" - /* INTERNAL_ERROR */ - ; - consumer.onError(_createError(this.auth, code)); - } else { - consumer.onAuthEvent(event); - } - } - - isEventForConsumer(event, consumer) { - const eventIdMatches = consumer.eventId === null || !!event.eventId && event.eventId === consumer.eventId; - return consumer.filter.includes(event.type) && eventIdMatches; - } - - hasEventBeenHandled(event) { - if (Date.now() - this.lastProcessedEventTime >= EVENT_DUPLICATION_CACHE_DURATION_MS) { - this.cachedEventUids.clear(); - } - - return this.cachedEventUids.has(eventUid(event)); - } - - saveEventToCache(event) { - this.cachedEventUids.add(eventUid(event)); - this.lastProcessedEventTime = Date.now(); - } - -} - -function eventUid(e) { - return [e.type, e.eventId, e.sessionId, e.tenantId].filter(v => v).join('-'); -} - -function isNullRedirectEvent(_ref13) { - let { - type, - error - } = _ref13; - return type === "unknown" - /* UNKNOWN */ - && (error === null || error === void 0 ? void 0 : error.code) === `auth/${"no-auth-event" - /* NO_AUTH_EVENT */ - }`; -} - -function isRedirectEvent(event) { - switch (event.type) { - case "signInViaRedirect" - /* SIGN_IN_VIA_REDIRECT */ - : - case "linkViaRedirect" - /* LINK_VIA_REDIRECT */ - : - case "reauthViaRedirect" - /* REAUTH_VIA_REDIRECT */ - : - return true; - - case "unknown" - /* UNKNOWN */ - : - return isNullRedirectEvent(event); - - default: - return false; - } -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -async function _getProjectConfig(auth) { - let request = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - return _performApiRequest(auth, "GET" - /* GET */ - , "/v1/projects" - /* GET_PROJECT_CONFIG */ - , request); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const IP_ADDRESS_REGEX = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/; -const HTTP_REGEX = /^https?/; - -async function _validateOrigin(auth) { - // Skip origin validation if we are in an emulated environment - if (auth.config.emulator) { - return; - } - - const { - authorizedDomains - } = await _getProjectConfig(auth); - - for (const domain of authorizedDomains) { - try { - if (matchDomain(domain)) { - return; - } - } catch (_a) {// Do nothing if there's a URL error; just continue searching - } - } // In the old SDK, this error also provides helpful messages. - - - _fail(auth, "unauthorized-domain" - /* INVALID_ORIGIN */ - ); -} - -function matchDomain(expected) { - const currentUrl = _getCurrentUrl(); - - const { - protocol, - hostname - } = new URL(currentUrl); - - if (expected.startsWith('chrome-extension://')) { - const ceUrl = new URL(expected); - - if (ceUrl.hostname === '' && hostname === '') { - // For some reason we're not parsing chrome URLs properly - return protocol === 'chrome-extension:' && expected.replace('chrome-extension://', '') === currentUrl.replace('chrome-extension://', ''); - } - - return protocol === 'chrome-extension:' && ceUrl.hostname === hostname; - } - - if (!HTTP_REGEX.test(protocol)) { - return false; - } - - if (IP_ADDRESS_REGEX.test(expected)) { - // The domain has to be exactly equal to the pattern, as an IP domain will - // only contain the IP, no extra character. - return hostname === expected; - } // Dots in pattern should be escaped. - - - const escapedDomainPattern = expected.replace(/\./g, '\\.'); // Non ip address domains. - // domain.com = *.domain.com OR domain.com - - const re = new RegExp('^(.+\\.' + escapedDomainPattern + '|' + escapedDomainPattern + ')$', 'i'); - return re.test(hostname); -} -/** - * @license - * Copyright 2020 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const NETWORK_TIMEOUT = new Delay(30000, 60000); -/** - * Reset unlaoded GApi modules. If gapi.load fails due to a network error, - * it will stop working after a retrial. This is a hack to fix this issue. - */ - -function resetUnloadedGapiModules() { - // Clear last failed gapi.load state to force next gapi.load to first - // load the failed gapi.iframes module. - // Get gapix.beacon context. - const beacon = _window().___jsl; // Get current hint. - - - if (beacon === null || beacon === void 0 ? void 0 : beacon.H) { - // Get gapi hint. - for (const hint of Object.keys(beacon.H)) { - // Requested modules. - beacon.H[hint].r = beacon.H[hint].r || []; // Loaded modules. - - beacon.H[hint].L = beacon.H[hint].L || []; // Set requested modules to a copy of the loaded modules. - - beacon.H[hint].r = [...beacon.H[hint].L]; // Clear pending callbacks. - - if (beacon.CP) { - for (let i = 0; i < beacon.CP.length; i++) { - // Remove all failed pending callbacks. - beacon.CP[i] = null; - } - } - } - } -} - -function loadGapi(auth) { - return new Promise((resolve, reject) => { - var _a, _b, _c; // Function to run when gapi.load is ready. - - - function loadGapiIframe() { - // The developer may have tried to previously run gapi.load and failed. - // Run this to fix that. - resetUnloadedGapiModules(); - gapi.load('gapi.iframes', { - callback: () => { - resolve(gapi.iframes.getContext()); - }, - ontimeout: () => { - // The above reset may be sufficient, but having this reset after - // failure ensures that if the developer calls gapi.load after the - // connection is re-established and before another attempt to embed - // the iframe, it would work and would not be broken because of our - // failed attempt. - // Timeout when gapi.iframes.Iframe not loaded. - resetUnloadedGapiModules(); - reject(_createError(auth, "network-request-failed" - /* NETWORK_REQUEST_FAILED */ - )); - }, - timeout: NETWORK_TIMEOUT.get() - }); - } - - if ((_b = (_a = _window().gapi) === null || _a === void 0 ? void 0 : _a.iframes) === null || _b === void 0 ? void 0 : _b.Iframe) { - // If gapi.iframes.Iframe available, resolve. - resolve(gapi.iframes.getContext()); - } else if (!!((_c = _window().gapi) === null || _c === void 0 ? void 0 : _c.load)) { - // Gapi loader ready, load gapi.iframes. - loadGapiIframe(); - } else { - // Create a new iframe callback when this is called so as not to overwrite - // any previous defined callback. This happens if this method is called - // multiple times in parallel and could result in the later callback - // overwriting the previous one. This would end up with a iframe - // timeout. - const cbName = _generateCallbackName('iframefcb'); // GApi loader not available, dynamically load platform.js. - - - _window()[cbName] = () => { - // GApi loader should be ready. - if (!!gapi.load) { - loadGapiIframe(); - } else { - // Gapi loader failed, throw error. - reject(_createError(auth, "network-request-failed" - /* NETWORK_REQUEST_FAILED */ - )); - } - }; // Load GApi loader. - - - return _loadJS(`https://apis.google.com/js/api.js?onload=${cbName}`).catch(e => reject(e)); - } - }).catch(error => { - // Reset cached promise to allow for retrial. - cachedGApiLoader = null; - throw error; - }); -} - -let cachedGApiLoader = null; - -function _loadGapi(auth) { - cachedGApiLoader = cachedGApiLoader || loadGapi(auth); - return cachedGApiLoader; -} -/** - * @license - * Copyright 2020 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const PING_TIMEOUT = new Delay(5000, 15000); -const IFRAME_PATH = '__/auth/iframe'; -const EMULATED_IFRAME_PATH = 'emulator/auth/iframe'; -const IFRAME_ATTRIBUTES = { - style: { - position: 'absolute', - top: '-100px', - width: '1px', - height: '1px' - }, - 'aria-hidden': 'true', - tabindex: '-1' -}; // Map from apiHost to endpoint ID for passing into iframe. In current SDK, apiHost can be set to -// anything (not from a list of endpoints with IDs as in legacy), so this is the closest we can get. - -const EID_FROM_APIHOST = new Map([["identitytoolkit.googleapis.com" -/* API_HOST */ -, 'p'], ['staging-identitytoolkit.sandbox.googleapis.com', 's'], ['test-identitytoolkit.sandbox.googleapis.com', 't'] // test -]); - -function getIframeUrl(auth) { - const config = auth.config; - - _assert(config.authDomain, auth, "auth-domain-config-required" - /* MISSING_AUTH_DOMAIN */ - ); - - const url = config.emulator ? _emulatorUrl(config, EMULATED_IFRAME_PATH) : `https://${auth.config.authDomain}/${IFRAME_PATH}`; - const params = { - apiKey: config.apiKey, - appName: auth.name, - v: _firebase_app__WEBPACK_IMPORTED_MODULE_1__.SDK_VERSION - }; - const eid = EID_FROM_APIHOST.get(auth.config.apiHost); - - if (eid) { - params.eid = eid; - } - - const frameworks = auth._getFrameworks(); - - if (frameworks.length) { - params.fw = frameworks.join(','); - } - - return `${url}?${(0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.querystring)(params).slice(1)}`; -} - -async function _openIframe(auth) { - const context = await _loadGapi(auth); - - const gapi = _window().gapi; - - _assert(gapi, auth, "internal-error" - /* INTERNAL_ERROR */ - ); - - return context.open({ - where: document.body, - url: getIframeUrl(auth), - messageHandlersFilter: gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER, - attributes: IFRAME_ATTRIBUTES, - dontclear: true - }, iframe => new Promise(async (resolve, reject) => { - await iframe.restyle({ - // Prevent iframe from closing on mouse out. - setHideOnLeave: false - }); - - const networkError = _createError(auth, "network-request-failed" - /* NETWORK_REQUEST_FAILED */ - ); // Confirm iframe is correctly loaded. - // To fallback on failure, set a timeout. - - - const networkErrorTimer = _window().setTimeout(() => { - reject(networkError); - }, PING_TIMEOUT.get()); // Clear timer and resolve pending iframe ready promise. - - - function clearTimerAndResolve() { - _window().clearTimeout(networkErrorTimer); - - resolve(iframe); - } // This returns an IThenable. However the reject part does not call - // when the iframe is not loaded. - - - iframe.ping(clearTimerAndResolve).then(clearTimerAndResolve, () => { - reject(networkError); - }); - })); -} -/** - * @license - * Copyright 2020 Google LLC. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const BASE_POPUP_OPTIONS = { - location: 'yes', - resizable: 'yes', - statusbar: 'yes', - toolbar: 'no' -}; -const DEFAULT_WIDTH = 500; -const DEFAULT_HEIGHT = 600; -const TARGET_BLANK = '_blank'; -const FIREFOX_EMPTY_URL = 'http://localhost'; - -class AuthPopup { - constructor(window) { - this.window = window; - this.associatedEvent = null; - } - - close() { - if (this.window) { - try { - this.window.close(); - } catch (e) {} - } - } - -} - -function _open(auth, url, name) { - let width = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_WIDTH; - let height = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : DEFAULT_HEIGHT; - const top = Math.max((window.screen.availHeight - height) / 2, 0).toString(); - const left = Math.max((window.screen.availWidth - width) / 2, 0).toString(); - let target = ''; - const options = Object.assign(Object.assign({}, BASE_POPUP_OPTIONS), { - width: width.toString(), - height: height.toString(), - top, - left - }); // Chrome iOS 7 and 8 is returning an undefined popup win when target is - // specified, even though the popup is not necessarily blocked. - - const ua = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.getUA)().toLowerCase(); - - if (name) { - target = _isChromeIOS(ua) ? TARGET_BLANK : name; - } - - if (_isFirefox(ua)) { - // Firefox complains when invalid URLs are popped out. Hacky way to bypass. - url = url || FIREFOX_EMPTY_URL; // Firefox disables by default scrolling on popup windows, which can create - // issues when the user has many Google accounts, for instance. - - options.scrollbars = 'yes'; - } - - const optionsString = Object.entries(options).reduce((accum, _ref14) => { - let [key, value] = _ref14; - return `${accum}${key}=${value},`; - }, ''); - - if (_isIOSStandalone(ua) && target !== '_self') { - openAsNewWindowIOS(url || '', target); - return new AuthPopup(null); - } // about:blank getting sanitized causing browsers like IE/Edge to display - // brief error message before redirecting to handler. - - - const newWin = window.open(url || '', target, optionsString); - - _assert(newWin, auth, "popup-blocked" - /* POPUP_BLOCKED */ - ); // Flaky on IE edge, encapsulate with a try and catch. - - - try { - newWin.focus(); - } catch (e) {} - - return new AuthPopup(newWin); -} - -function openAsNewWindowIOS(url, target) { - const el = document.createElement('a'); - el.href = url; - el.target = target; - const click = document.createEvent('MouseEvent'); - click.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 1, null); - el.dispatchEvent(click); -} -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * URL for Authentication widget which will initiate the OAuth handshake - * - * @internal - */ - - -const WIDGET_PATH = '__/auth/handler'; -/** - * URL for emulated environment - * - * @internal - */ - -const EMULATOR_WIDGET_PATH = 'emulator/auth/handler'; - -function _getRedirectUrl(auth, provider, authType, redirectUrl, eventId, additionalParams) { - _assert(auth.config.authDomain, auth, "auth-domain-config-required" - /* MISSING_AUTH_DOMAIN */ - ); - - _assert(auth.config.apiKey, auth, "invalid-api-key" - /* INVALID_API_KEY */ - ); - - const params = { - apiKey: auth.config.apiKey, - appName: auth.name, - authType, - redirectUrl, - v: _firebase_app__WEBPACK_IMPORTED_MODULE_1__.SDK_VERSION, - eventId - }; - - if (provider instanceof FederatedAuthProvider) { - provider.setDefaultLanguage(auth.languageCode); - params.providerId = provider.providerId || ''; - - if (!(0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.isEmpty)(provider.getCustomParameters())) { - params.customParameters = JSON.stringify(provider.getCustomParameters()); - } // TODO set additionalParams from the provider as well? - - - for (const [key, value] of Object.entries(additionalParams || {})) { - params[key] = value; - } - } - - if (provider instanceof BaseOAuthProvider) { - const scopes = provider.getScopes().filter(scope => scope !== ''); - - if (scopes.length > 0) { - params.scopes = scopes.join(','); - } - } - - if (auth.tenantId) { - params.tid = auth.tenantId; - } // TODO: maybe set eid as endipointId - // TODO: maybe set fw as Frameworks.join(",") - - - const paramsDict = params; - - for (const key of Object.keys(paramsDict)) { - if (paramsDict[key] === undefined) { - delete paramsDict[key]; - } - } - - return `${getHandlerBase(auth)}?${(0,_firebase_util__WEBPACK_IMPORTED_MODULE_0__.querystring)(paramsDict).slice(1)}`; -} - -function getHandlerBase(_ref15) { - let { - config - } = _ref15; - - if (!config.emulator) { - return `https://${config.authDomain}/${WIDGET_PATH}`; - } - - return _emulatorUrl(config, EMULATOR_WIDGET_PATH); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * The special web storage event - * - */ - - -const WEB_STORAGE_SUPPORT_KEY = 'webStorageSupport'; - -class BrowserPopupRedirectResolver { - constructor() { - this.eventManagers = {}; - this.iframes = {}; - this.originValidationPromises = {}; - this._redirectPersistence = browserSessionPersistence; - this._completeRedirectFn = _getRedirectResult; - this._overrideRedirectResult = _overrideRedirectResult; - } // Wrapping in async even though we don't await anywhere in order - // to make sure errors are raised as promise rejections - - - async _openPopup(auth, provider, authType, eventId) { - var _a; - - debugAssert((_a = this.eventManagers[auth._key()]) === null || _a === void 0 ? void 0 : _a.manager, '_initialize() not called before _openPopup()'); - - const url = _getRedirectUrl(auth, provider, authType, _getCurrentUrl(), eventId); - - return _open(auth, url, _generateEventId()); - } - - async _openRedirect(auth, provider, authType, eventId) { - await this._originValidation(auth); - - _setWindowLocation(_getRedirectUrl(auth, provider, authType, _getCurrentUrl(), eventId)); - - return new Promise(() => {}); - } - - _initialize(auth) { - const key = auth._key(); - - if (this.eventManagers[key]) { - const { - manager, - promise - } = this.eventManagers[key]; - - if (manager) { - return Promise.resolve(manager); - } else { - debugAssert(promise, 'If manager is not set, promise should be'); - return promise; - } - } - - const promise = this.initAndGetManager(auth); - this.eventManagers[key] = { - promise - }; // If the promise is rejected, the key should be removed so that the - // operation can be retried later. - - promise.catch(() => { - delete this.eventManagers[key]; - }); - return promise; - } - - async initAndGetManager(auth) { - const iframe = await _openIframe(auth); - const manager = new AuthEventManager(auth); - iframe.register('authEvent', iframeEvent => { - _assert(iframeEvent === null || iframeEvent === void 0 ? void 0 : iframeEvent.authEvent, auth, "invalid-auth-event" - /* INVALID_AUTH_EVENT */ - ); // TODO: Consider splitting redirect and popup events earlier on - - - const handled = manager.onEvent(iframeEvent.authEvent); - return { - status: handled ? "ACK" - /* ACK */ - : "ERROR" - /* ERROR */ - - }; - }, gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER); - this.eventManagers[auth._key()] = { - manager - }; - this.iframes[auth._key()] = iframe; - return manager; - } - - _isIframeWebStorageSupported(auth, cb) { - const iframe = this.iframes[auth._key()]; - - iframe.send(WEB_STORAGE_SUPPORT_KEY, { - type: WEB_STORAGE_SUPPORT_KEY - }, result => { - var _a; - - const isSupported = (_a = result === null || result === void 0 ? void 0 : result[0]) === null || _a === void 0 ? void 0 : _a[WEB_STORAGE_SUPPORT_KEY]; - - if (isSupported !== undefined) { - cb(!!isSupported); - } - - _fail(auth, "internal-error" - /* INTERNAL_ERROR */ - ); - }, gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER); - } - - _originValidation(auth) { - const key = auth._key(); - - if (!this.originValidationPromises[key]) { - this.originValidationPromises[key] = _validateOrigin(auth); - } - - return this.originValidationPromises[key]; - } - - get _shouldInitProactively() { - // Mobile browsers and Safari need to optimistically initialize - return _isMobileBrowser() || _isSafari() || _isIOS(); - } - -} -/** - * An implementation of {@link PopupRedirectResolver} suitable for browser - * based applications. - * - * @public - */ - - -const browserPopupRedirectResolver = BrowserPopupRedirectResolver; - -class MultiFactorAssertionImpl { - constructor(factorId) { - this.factorId = factorId; - } - - _process(auth, session, displayName) { - switch (session.type) { - case "enroll" - /* ENROLL */ - : - return this._finalizeEnroll(auth, session.credential, displayName); - - case "signin" - /* SIGN_IN */ - : - return this._finalizeSignIn(auth, session.credential); - - default: - return debugFail('unexpected MultiFactorSessionType'); - } - } - -} -/** - * {@inheritdoc PhoneMultiFactorAssertion} - * - * @public - */ - - -class PhoneMultiFactorAssertionImpl extends MultiFactorAssertionImpl { - constructor(credential) { - super("phone" - /* PHONE */ - ); - this.credential = credential; - } - /** @internal */ - - - static _fromCredential(credential) { - return new PhoneMultiFactorAssertionImpl(credential); - } - /** @internal */ - - - _finalizeEnroll(auth, idToken, displayName) { - return finalizeEnrollPhoneMfa(auth, { - idToken, - displayName, - phoneVerificationInfo: this.credential._makeVerificationRequest() - }); - } - /** @internal */ - - - _finalizeSignIn(auth, mfaPendingCredential) { - return finalizeSignInPhoneMfa(auth, { - mfaPendingCredential, - phoneVerificationInfo: this.credential._makeVerificationRequest() - }); - } - -} -/** - * Provider for generating a {@link PhoneMultiFactorAssertion}. - * - * @public - */ - - -class PhoneMultiFactorGenerator { - constructor() {} - /** - * Provides a {@link PhoneMultiFactorAssertion} to confirm ownership of the phone second factor. - * - * @param phoneAuthCredential - A credential provided by {@link PhoneAuthProvider.credential}. - * @returns A {@link PhoneMultiFactorAssertion} which can be used with - * {@link MultiFactorResolver.resolveSignIn} - */ - - - static assertion(credential) { - return PhoneMultiFactorAssertionImpl._fromCredential(credential); - } - -} -/** - * The identifier of the phone second factor: `phone`. - */ - - -PhoneMultiFactorGenerator.FACTOR_ID = 'phone'; -var name = "@firebase/auth"; -var version = "0.20.6"; -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -class AuthInterop { - constructor(auth) { - this.auth = auth; - this.internalListeners = new Map(); - } - - getUid() { - var _a; - - this.assertAuthConfigured(); - return ((_a = this.auth.currentUser) === null || _a === void 0 ? void 0 : _a.uid) || null; - } - - async getToken(forceRefresh) { - this.assertAuthConfigured(); - await this.auth._initializationPromise; - - if (!this.auth.currentUser) { - return null; - } - - const accessToken = await this.auth.currentUser.getIdToken(forceRefresh); - return { - accessToken - }; - } - - addAuthTokenListener(listener) { - this.assertAuthConfigured(); - - if (this.internalListeners.has(listener)) { - return; - } - - const unsubscribe = this.auth.onIdTokenChanged(user => { - var _a; - - listener(((_a = user) === null || _a === void 0 ? void 0 : _a.stsTokenManager.accessToken) || null); - }); - this.internalListeners.set(listener, unsubscribe); - this.updateProactiveRefresh(); - } - - removeAuthTokenListener(listener) { - this.assertAuthConfigured(); - const unsubscribe = this.internalListeners.get(listener); - - if (!unsubscribe) { - return; - } - - this.internalListeners.delete(listener); - unsubscribe(); - this.updateProactiveRefresh(); - } - - assertAuthConfigured() { - _assert(this.auth._initializationPromise, "dependent-sdk-initialized-before-auth" - /* DEPENDENT_SDK_INIT_BEFORE_AUTH */ - ); - } - - updateProactiveRefresh() { - if (this.internalListeners.size > 0) { - this.auth._startProactiveRefresh(); - } else { - this.auth._stopProactiveRefresh(); - } - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -function getVersionForPlatform(clientPlatform) { - switch (clientPlatform) { - case "Node" - /* NODE */ - : - return 'node'; - - case "ReactNative" - /* REACT_NATIVE */ - : - return 'rn'; - - case "Worker" - /* WORKER */ - : - return 'webworker'; - - case "Cordova" - /* CORDOVA */ - : - return 'cordova'; - - default: - return undefined; - } -} -/** @internal */ - - -function registerAuth(clientPlatform) { - (0,_firebase_app__WEBPACK_IMPORTED_MODULE_1__._registerComponent)(new _firebase_component__WEBPACK_IMPORTED_MODULE_3__.Component("auth" - /* AUTH */ - , (container, _ref16) => { - let { - options: deps - } = _ref16; - const app = container.getProvider('app').getImmediate(); - const heartbeatServiceProvider = container.getProvider('heartbeat'); - const { - apiKey, - authDomain - } = app.options; - return ((app, heartbeatServiceProvider) => { - _assert(apiKey && !apiKey.includes(':'), "invalid-api-key" - /* INVALID_API_KEY */ - , { - appName: app.name - }); // Auth domain is optional if IdP sign in isn't being used - - - _assert(!(authDomain === null || authDomain === void 0 ? void 0 : authDomain.includes(':')), "argument-error" - /* ARGUMENT_ERROR */ - , { - appName: app.name - }); - - const config = { - apiKey, - authDomain, - clientPlatform, - apiHost: "identitytoolkit.googleapis.com" - /* API_HOST */ - , - tokenApiHost: "securetoken.googleapis.com" - /* TOKEN_API_HOST */ - , - apiScheme: "https" - /* API_SCHEME */ - , - sdkClientVersion: _getClientVersion(clientPlatform) - }; - const authInstance = new AuthImpl(app, heartbeatServiceProvider, config); - - _initializeAuthInstance(authInstance, deps); - - return authInstance; - })(app, heartbeatServiceProvider); - }, "PUBLIC" - /* PUBLIC */ - ) - /** - * Auth can only be initialized by explicitly calling getAuth() or initializeAuth() - * For why we do this, See go/firebase-next-auth-init - */ - .setInstantiationMode("EXPLICIT" - /* EXPLICIT */ - ) - /** - * Because all firebase products that depend on auth depend on auth-internal directly, - * we need to initialize auth-internal after auth is initialized to make it available to other firebase products. - */ - .setInstanceCreatedCallback((container, _instanceIdentifier, _instance) => { - const authInternalProvider = container.getProvider("auth-internal" - /* AUTH_INTERNAL */ - ); - authInternalProvider.initialize(); - })); - - (0,_firebase_app__WEBPACK_IMPORTED_MODULE_1__._registerComponent)(new _firebase_component__WEBPACK_IMPORTED_MODULE_3__.Component("auth-internal" - /* AUTH_INTERNAL */ - , container => { - const auth = _castAuth(container.getProvider("auth" - /* AUTH */ - ).getImmediate()); - - return (auth => new AuthInterop(auth))(auth); - }, "PRIVATE" - /* PRIVATE */ - ).setInstantiationMode("EXPLICIT" - /* EXPLICIT */ - )); - - (0,_firebase_app__WEBPACK_IMPORTED_MODULE_1__.registerVersion)(name, version, getVersionForPlatform(clientPlatform)); // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation - - (0,_firebase_app__WEBPACK_IMPORTED_MODULE_1__.registerVersion)(name, version, 'esm2017'); -} -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Returns the Auth instance associated with the provided {@link @firebase/app#FirebaseApp}. - * If no instance exists, initializes an Auth instance with platform-specific default dependencies. - * - * @param app - The Firebase App. - * - * @public - */ - - -function getAuth() { - let app = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0,_firebase_app__WEBPACK_IMPORTED_MODULE_1__.getApp)(); - - const provider = (0,_firebase_app__WEBPACK_IMPORTED_MODULE_1__._getProvider)(app, 'auth'); - - if (provider.isInitialized()) { - return provider.getImmediate(); - } - - return initializeAuth(app, { - popupRedirectResolver: browserPopupRedirectResolver, - persistence: [indexedDBLocalPersistence, browserLocalPersistence, browserSessionPersistence] - }); -} - -registerAuth("Browser" -/* BROWSER */ -); - - -/***/ }), - -/***/ "./node_modules/@firebase/auth/dist/esm2017/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/@firebase/auth/dist/esm2017/index.js ***! - \***********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ActionCodeOperation": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.A), -/* harmony export */ "ActionCodeURL": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.ad), -/* harmony export */ "AuthCredential": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.H), -/* harmony export */ "AuthErrorCodes": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.D), -/* harmony export */ "EmailAuthCredential": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.I), -/* harmony export */ "EmailAuthProvider": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.M), -/* harmony export */ "FacebookAuthProvider": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.N), -/* harmony export */ "FactorId": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.F), -/* harmony export */ "GithubAuthProvider": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.T), -/* harmony export */ "GoogleAuthProvider": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.Q), -/* harmony export */ "OAuthCredential": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.J), -/* harmony export */ "OAuthProvider": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.U), -/* harmony export */ "OperationType": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.O), -/* harmony export */ "PhoneAuthCredential": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.K), -/* harmony export */ "PhoneAuthProvider": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.P), -/* harmony export */ "PhoneMultiFactorGenerator": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.m), -/* harmony export */ "ProviderId": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.o), -/* harmony export */ "RecaptchaVerifier": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.R), -/* harmony export */ "SAMLAuthProvider": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.V), -/* harmony export */ "SignInMethod": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.S), -/* harmony export */ "TwitterAuthProvider": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.W), -/* harmony export */ "applyActionCode": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.a2), -/* harmony export */ "beforeAuthStateChanged": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.t), -/* harmony export */ "browserLocalPersistence": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.b), -/* harmony export */ "browserPopupRedirectResolver": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.k), -/* harmony export */ "browserSessionPersistence": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.a), -/* harmony export */ "checkActionCode": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.a3), -/* harmony export */ "confirmPasswordReset": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.a1), -/* harmony export */ "connectAuthEmulator": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.G), -/* harmony export */ "createUserWithEmailAndPassword": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.a5), -/* harmony export */ "debugErrorMap": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.B), -/* harmony export */ "deleteUser": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.z), -/* harmony export */ "fetchSignInMethodsForEmail": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.aa), -/* harmony export */ "getAdditionalUserInfo": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.al), -/* harmony export */ "getAuth": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.n), -/* harmony export */ "getIdToken": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.ai), -/* harmony export */ "getIdTokenResult": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.aj), -/* harmony export */ "getMultiFactorResolver": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.an), -/* harmony export */ "getRedirectResult": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.j), -/* harmony export */ "inMemoryPersistence": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.L), -/* harmony export */ "indexedDBLocalPersistence": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.i), -/* harmony export */ "initializeAuth": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.E), -/* harmony export */ "isSignInWithEmailLink": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.a8), -/* harmony export */ "linkWithCredential": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.Z), -/* harmony export */ "linkWithPhoneNumber": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.l), -/* harmony export */ "linkWithPopup": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.d), -/* harmony export */ "linkWithRedirect": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.g), -/* harmony export */ "multiFactor": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.ao), -/* harmony export */ "onAuthStateChanged": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.v), -/* harmony export */ "onIdTokenChanged": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.q), -/* harmony export */ "parseActionCodeURL": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.ae), -/* harmony export */ "prodErrorMap": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.C), -/* harmony export */ "reauthenticateWithCredential": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__._), -/* harmony export */ "reauthenticateWithPhoneNumber": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.r), -/* harmony export */ "reauthenticateWithPopup": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.e), -/* harmony export */ "reauthenticateWithRedirect": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.h), -/* harmony export */ "reload": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.am), -/* harmony export */ "sendEmailVerification": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.ab), -/* harmony export */ "sendPasswordResetEmail": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.a0), -/* harmony export */ "sendSignInLinkToEmail": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.a7), -/* harmony export */ "setPersistence": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.p), -/* harmony export */ "signInAnonymously": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.X), -/* harmony export */ "signInWithCredential": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.Y), -/* harmony export */ "signInWithCustomToken": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.$), -/* harmony export */ "signInWithEmailAndPassword": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.a6), -/* harmony export */ "signInWithEmailLink": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.a9), -/* harmony export */ "signInWithPhoneNumber": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.s), -/* harmony export */ "signInWithPopup": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.c), -/* harmony export */ "signInWithRedirect": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.f), -/* harmony export */ "signOut": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.y), -/* harmony export */ "unlink": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.ak), -/* harmony export */ "updateCurrentUser": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.x), -/* harmony export */ "updateEmail": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.ag), -/* harmony export */ "updatePassword": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.ah), -/* harmony export */ "updatePhoneNumber": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.u), -/* harmony export */ "updateProfile": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.af), -/* harmony export */ "useDeviceLanguage": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.w), -/* harmony export */ "verifyBeforeUpdateEmail": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.ac), -/* harmony export */ "verifyPasswordResetCode": () => (/* reexport safe */ _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__.a4) -/* harmony export */ }); -/* harmony import */ var _index_6bd8d405_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index-6bd8d405.js */ "./node_modules/@firebase/auth/dist/esm2017/index-6bd8d405.js"); -/* harmony import */ var _firebase_util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/index.esm2017.js"); -/* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/esm/index.esm2017.js"); -/* harmony import */ var _firebase_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @firebase/logger */ "./node_modules/@firebase/logger/dist/esm/index.esm2017.js"); -/* harmony import */ var _firebase_component__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @firebase/component */ "./node_modules/@firebase/component/dist/esm/index.esm2017.js"); - - - - - - - -/***/ }), - -/***/ "./node_modules/@firebase/firestore/dist/index.esm2017.js": -/*!****************************************************************!*\ - !*** ./node_modules/@firebase/firestore/dist/index.esm2017.js ***! - \****************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "AbstractUserDataWriter": () => (/* binding */ cl), -/* harmony export */ "Bytes": () => (/* binding */ sh), -/* harmony export */ "CACHE_SIZE_UNLIMITED": () => (/* binding */ $a), -/* harmony export */ "CollectionReference": () => (/* binding */ Sa), -/* harmony export */ "DocumentReference": () => (/* binding */ va), -/* harmony export */ "DocumentSnapshot": () => (/* binding */ Oh), -/* harmony export */ "FieldPath": () => (/* binding */ eh), -/* harmony export */ "FieldValue": () => (/* binding */ ih), -/* harmony export */ "Firestore": () => (/* binding */ Ba), -/* harmony export */ "FirestoreError": () => (/* binding */ Q), -/* harmony export */ "GeoPoint": () => (/* binding */ rh), -/* harmony export */ "LoadBundleTask": () => (/* binding */ Fa), -/* harmony export */ "Query": () => (/* binding */ Va), -/* harmony export */ "QueryConstraint": () => (/* binding */ qh), -/* harmony export */ "QueryDocumentSnapshot": () => (/* binding */ Fh), -/* harmony export */ "QuerySnapshot": () => (/* binding */ $h), -/* harmony export */ "SnapshotMetadata": () => (/* binding */ Mh), -/* harmony export */ "Timestamp": () => (/* binding */ ut), -/* harmony export */ "Transaction": () => (/* binding */ Vl), -/* harmony export */ "WriteBatch": () => (/* binding */ ll), -/* harmony export */ "_DatabaseId": () => (/* binding */ ue), -/* harmony export */ "_DocumentKey": () => (/* binding */ dt), -/* harmony export */ "_EmptyAppCheckTokenProvider": () => (/* binding */ et), -/* harmony export */ "_EmptyAuthCredentialsProvider": () => (/* binding */ z), -/* harmony export */ "_FieldPath": () => (/* binding */ ft), -/* harmony export */ "_cast": () => (/* binding */ Ea), -/* harmony export */ "_debugAssert": () => (/* binding */ q), -/* harmony export */ "_isBase64Available": () => (/* binding */ Yt), -/* harmony export */ "_logWarn": () => (/* binding */ $), -/* harmony export */ "_validateIsNotUsedTogether": () => (/* binding */ ya), -/* harmony export */ "addDoc": () => (/* binding */ Al), -/* harmony export */ "arrayRemove": () => (/* binding */ Nl), -/* harmony export */ "arrayUnion": () => (/* binding */ xl), -/* harmony export */ "clearIndexedDbPersistence": () => (/* binding */ Wa), -/* harmony export */ "collection": () => (/* binding */ Da), -/* harmony export */ "collectionGroup": () => (/* binding */ Ca), -/* harmony export */ "connectFirestoreEmulator": () => (/* binding */ Pa), -/* harmony export */ "deleteDoc": () => (/* binding */ El), -/* harmony export */ "deleteField": () => (/* binding */ Dl), -/* harmony export */ "disableNetwork": () => (/* binding */ Ja), -/* harmony export */ "doc": () => (/* binding */ xa), -/* harmony export */ "documentId": () => (/* binding */ nh), -/* harmony export */ "enableIndexedDbPersistence": () => (/* binding */ Ga), -/* harmony export */ "enableMultiTabIndexedDbPersistence": () => (/* binding */ Qa), -/* harmony export */ "enableNetwork": () => (/* binding */ Ha), -/* harmony export */ "endAt": () => (/* binding */ nl), -/* harmony export */ "endBefore": () => (/* binding */ el), -/* harmony export */ "ensureFirestoreConfigured": () => (/* binding */ qa), -/* harmony export */ "executeWrite": () => (/* binding */ Pl), -/* harmony export */ "getDoc": () => (/* binding */ dl), -/* harmony export */ "getDocFromCache": () => (/* binding */ wl), -/* harmony export */ "getDocFromServer": () => (/* binding */ ml), -/* harmony export */ "getDocs": () => (/* binding */ gl), -/* harmony export */ "getDocsFromCache": () => (/* binding */ yl), -/* harmony export */ "getDocsFromServer": () => (/* binding */ pl), -/* harmony export */ "getFirestore": () => (/* binding */ Ua), -/* harmony export */ "increment": () => (/* binding */ kl), -/* harmony export */ "initializeFirestore": () => (/* binding */ La), -/* harmony export */ "limit": () => (/* binding */ Hh), -/* harmony export */ "limitToLast": () => (/* binding */ Jh), -/* harmony export */ "loadBundle": () => (/* binding */ Xa), -/* harmony export */ "namedQuery": () => (/* binding */ Za), -/* harmony export */ "onSnapshot": () => (/* binding */ Rl), -/* harmony export */ "onSnapshotsInSync": () => (/* binding */ bl), -/* harmony export */ "orderBy": () => (/* binding */ Wh), -/* harmony export */ "query": () => (/* binding */ Kh), -/* harmony export */ "queryEqual": () => (/* binding */ ka), -/* harmony export */ "refEqual": () => (/* binding */ Na), -/* harmony export */ "runTransaction": () => (/* binding */ Sl), -/* harmony export */ "serverTimestamp": () => (/* binding */ Cl), -/* harmony export */ "setDoc": () => (/* binding */ Il), -/* harmony export */ "setIndexConfiguration": () => (/* binding */ Ol), -/* harmony export */ "setLogLevel": () => (/* binding */ M), -/* harmony export */ "snapshotEqual": () => (/* binding */ Lh), -/* harmony export */ "startAfter": () => (/* binding */ Zh), -/* harmony export */ "startAt": () => (/* binding */ Xh), -/* harmony export */ "terminate": () => (/* binding */ Ya), -/* harmony export */ "updateDoc": () => (/* binding */ Tl), -/* harmony export */ "waitForPendingWrites": () => (/* binding */ za), -/* harmony export */ "where": () => (/* binding */ Qh), -/* harmony export */ "writeBatch": () => (/* binding */ Ml) -/* harmony export */ }); -/* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/esm/index.esm2017.js"); -/* harmony import */ var _firebase_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @firebase/component */ "./node_modules/@firebase/component/dist/esm/index.esm2017.js"); -/* harmony import */ var _firebase_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @firebase/logger */ "./node_modules/@firebase/logger/dist/esm/index.esm2017.js"); -/* harmony import */ var _firebase_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/index.esm2017.js"); -/* harmony import */ var _firebase_webchannel_wrapper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @firebase/webchannel-wrapper */ "./node_modules/@firebase/webchannel-wrapper/dist/index.esm2017.js"); - - - - - -const D = "@firebase/firestore"; -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Simple wrapper around a nullable UID. Mostly exists to make code more - * readable. - */ - -class C { - constructor(t) { - this.uid = t; - } - - isAuthenticated() { - return null != this.uid; - } - /** - * Returns a key representing this user, suitable for inclusion in a - * dictionary. - */ - - - toKey() { - return this.isAuthenticated() ? "uid:" + this.uid : "anonymous-user"; - } - - isEqual(t) { - return t.uid === this.uid; - } - -} -/** A user with a null UID. */ - - -C.UNAUTHENTICATED = new C(null), // TODO(mikelehen): Look into getting a proper uid-equivalent for -// non-FirebaseAuth providers. -C.GOOGLE_CREDENTIALS = new C("google-credentials-uid"), C.FIRST_PARTY = new C("first-party-uid"), C.MOCK_USER = new C("mock-user"); -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -let x = "9.9.4"; -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -const N = new _firebase_logger__WEBPACK_IMPORTED_MODULE_2__.Logger("@firebase/firestore"); // Helper methods are needed because variables can't be exported as read/write - -function k() { - return N.logLevel; -} -/** - * Sets the verbosity of Cloud Firestore logs (debug, error, or silent). - * - * @param logLevel - The verbosity you set for activity and error logging. Can - * be any of the following values: - * - * - */ - - -function M(t) { - N.setLogLevel(t); -} - -function O(t) { - if (N.logLevel <= _firebase_logger__WEBPACK_IMPORTED_MODULE_2__.LogLevel.DEBUG) { - for (var _len = arguments.length, e = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - e[_key - 1] = arguments[_key]; - } - - const n = e.map(B); - N.debug(`Firestore (${x}): ${t}`, ...n); - } -} - -function F(t) { - if (N.logLevel <= _firebase_logger__WEBPACK_IMPORTED_MODULE_2__.LogLevel.ERROR) { - for (var _len2 = arguments.length, e = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - e[_key2 - 1] = arguments[_key2]; - } - - const n = e.map(B); - N.error(`Firestore (${x}): ${t}`, ...n); - } -} -/** - * @internal - */ - - -function $(t) { - if (N.logLevel <= _firebase_logger__WEBPACK_IMPORTED_MODULE_2__.LogLevel.WARN) { - for (var _len3 = arguments.length, e = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { - e[_key3 - 1] = arguments[_key3]; - } - - const n = e.map(B); - N.warn(`Firestore (${x}): ${t}`, ...n); - } -} -/** - * Converts an additional log parameter to a string representation. - */ - - -function B(t) { - if ("string" == typeof t) return t; - - try { - return e = t, JSON.stringify(e); - } catch (e) { - // Converting to JSON failed, just log the object directly - return t; - } - /** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - /** Formats an object as a JSON string, suitable for logging. */ - - - var e; -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Unconditionally fails, throwing an Error with the given message. - * Messages are stripped in production builds. - * - * Returns `never` and can be used in expressions: - * @example - * let futureVar = fail('not implemented yet'); - */ - - -function L() { - let t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "Unexpected state"; - // Log the failure in addition to throw an exception, just in case the - // exception is swallowed. - const e = `FIRESTORE (${x}) INTERNAL ASSERTION FAILED: ` + t; // NOTE: We don't use FirestoreError here because these are internal failures - // that cannot be handled by the user. (Also it would create a circular - // dependency between the error and assert modules which doesn't work.) - - throw F(e), new Error(e); -} -/** - * Fails if the given assertion condition is false, throwing an Error with the - * given message if it did. - * - * Messages are stripped in production builds. - */ - - -function U(t, e) { - t || L(); -} -/** - * Fails if the given assertion condition is false, throwing an Error with the - * given message if it did. - * - * The code of callsites invoking this function are stripped out in production - * builds. Any side-effects of code within the debugAssert() invocation will not - * happen in this case. - * - * @internal - */ - - -function q(t, e) { - t || L(); -} -/** - * Casts `obj` to `T`. In non-production builds, verifies that `obj` is an - * instance of `T` before casting. - */ - - -function K(t, // eslint-disable-next-line @typescript-eslint/no-explicit-any -e) { - return t; -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const G = { - // Causes are copied from: - // https://github.com/grpc/grpc/blob/bceec94ea4fc5f0085d81235d8e1c06798dc341a/include/grpc%2B%2B/impl/codegen/status_code_enum.h - - /** Not an error; returned on success. */ - OK: "ok", - - /** The operation was cancelled (typically by the caller). */ - CANCELLED: "cancelled", - - /** Unknown error or an error from a different error domain. */ - UNKNOWN: "unknown", - - /** - * Client specified an invalid argument. Note that this differs from - * FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are - * problematic regardless of the state of the system (e.g., a malformed file - * name). - */ - INVALID_ARGUMENT: "invalid-argument", - - /** - * Deadline expired before operation could complete. For operations that - * change the state of the system, this error may be returned even if the - * operation has completed successfully. For example, a successful response - * from a server could have been delayed long enough for the deadline to - * expire. - */ - DEADLINE_EXCEEDED: "deadline-exceeded", - - /** Some requested entity (e.g., file or directory) was not found. */ - NOT_FOUND: "not-found", - - /** - * Some entity that we attempted to create (e.g., file or directory) already - * exists. - */ - ALREADY_EXISTS: "already-exists", - - /** - * The caller does not have permission to execute the specified operation. - * PERMISSION_DENIED must not be used for rejections caused by exhausting - * some resource (use RESOURCE_EXHAUSTED instead for those errors). - * PERMISSION_DENIED must not be used if the caller can not be identified - * (use UNAUTHENTICATED instead for those errors). - */ - PERMISSION_DENIED: "permission-denied", - - /** - * The request does not have valid authentication credentials for the - * operation. - */ - UNAUTHENTICATED: "unauthenticated", - - /** - * Some resource has been exhausted, perhaps a per-user quota, or perhaps the - * entire file system is out of space. - */ - RESOURCE_EXHAUSTED: "resource-exhausted", - - /** - * Operation was rejected because the system is not in a state required for - * the operation's execution. For example, directory to be deleted may be - * non-empty, an rmdir operation is applied to a non-directory, etc. - * - * A litmus test that may help a service implementor in deciding - * between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: - * (a) Use UNAVAILABLE if the client can retry just the failing call. - * (b) Use ABORTED if the client should retry at a higher-level - * (e.g., restarting a read-modify-write sequence). - * (c) Use FAILED_PRECONDITION if the client should not retry until - * the system state has been explicitly fixed. E.g., if an "rmdir" - * fails because the directory is non-empty, FAILED_PRECONDITION - * should be returned since the client should not retry unless - * they have first fixed up the directory by deleting files from it. - * (d) Use FAILED_PRECONDITION if the client performs conditional - * REST Get/Update/Delete on a resource and the resource on the - * server does not match the condition. E.g., conflicting - * read-modify-write on the same resource. - */ - FAILED_PRECONDITION: "failed-precondition", - - /** - * The operation was aborted, typically due to a concurrency issue like - * sequencer check failures, transaction aborts, etc. - * - * See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, - * and UNAVAILABLE. - */ - ABORTED: "aborted", - - /** - * Operation was attempted past the valid range. E.g., seeking or reading - * past end of file. - * - * Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed - * if the system state changes. For example, a 32-bit file system will - * generate INVALID_ARGUMENT if asked to read at an offset that is not in the - * range [0,2^32-1], but it will generate OUT_OF_RANGE if asked to read from - * an offset past the current file size. - * - * There is a fair bit of overlap between FAILED_PRECONDITION and - * OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific error) - * when it applies so that callers who are iterating through a space can - * easily look for an OUT_OF_RANGE error to detect when they are done. - */ - OUT_OF_RANGE: "out-of-range", - - /** Operation is not implemented or not supported/enabled in this service. */ - UNIMPLEMENTED: "unimplemented", - - /** - * Internal errors. Means some invariants expected by underlying System has - * been broken. If you see one of these errors, Something is very broken. - */ - INTERNAL: "internal", - - /** - * The service is currently unavailable. This is a most likely a transient - * condition and may be corrected by retrying with a backoff. - * - * See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, - * and UNAVAILABLE. - */ - UNAVAILABLE: "unavailable", - - /** Unrecoverable data loss or corruption. */ - DATA_LOSS: "data-loss" -}; -/** An error returned by a Firestore operation. */ - -class Q extends _firebase_util__WEBPACK_IMPORTED_MODULE_3__.FirebaseError { - /** @hideconstructor */ - constructor( - /** - * The backend error code associated with this error. - */ - t, - /** - * A custom error description. - */ - e) { - super(t, e), this.code = t, this.message = e, // HACK: We write a toString property directly because Error is not a real - // class and so inheritance does not work correctly. We could alternatively - // do the same "back-door inheritance" trick that FirebaseError does. - this.toString = () => `${this.name}: [code=${this.code}]: ${this.message}`; - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class j { - constructor() { - this.promise = new Promise((t, e) => { - this.resolve = t, this.reject = e; - }); - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class W { - constructor(t, e) { - this.user = e, this.type = "OAuth", this.headers = new Map(), this.headers.set("Authorization", `Bearer ${t}`); - } - -} -/** - * A CredentialsProvider that always yields an empty token. - * @internal - */ - - -class z { - getToken() { - return Promise.resolve(null); - } - - invalidateToken() {} - - start(t, e) { - // Fire with initial user. - t.enqueueRetryable(() => e(C.UNAUTHENTICATED)); - } - - shutdown() {} - -} -/** - * A CredentialsProvider that always returns a constant token. Used for - * emulator token mocking. - */ - - -class H { - constructor(t) { - this.token = t, - /** - * Stores the listener registered with setChangeListener() - * This isn't actually necessary since the UID never changes, but we use this - * to verify the listen contract is adhered to in tests. - */ - this.changeListener = null; - } - - getToken() { - return Promise.resolve(this.token); - } - - invalidateToken() {} - - start(t, e) { - this.changeListener = e, // Fire with initial user. - t.enqueueRetryable(() => e(this.token.user)); - } - - shutdown() { - this.changeListener = null; - } - -} - -class J { - constructor(t) { - this.t = t, - /** Tracks the current User. */ - this.currentUser = C.UNAUTHENTICATED, - /** - * Counter used to detect if the token changed while a getToken request was - * outstanding. - */ - this.i = 0, this.forceRefresh = !1, this.auth = null; - } - - start(t, e) { - let n = this.i; // A change listener that prevents double-firing for the same token change. - - const s = t => this.i !== n ? (n = this.i, e(t)) : Promise.resolve(); // A promise that can be waited on to block on the next token change. - // This promise is re-created after each change. - - - let i = new j(); - - this.o = () => { - this.i++, this.currentUser = this.u(), i.resolve(), i = new j(), t.enqueueRetryable(() => s(this.currentUser)); - }; - - const r = () => { - const e = i; - t.enqueueRetryable(async () => { - await e.promise, await s(this.currentUser); - }); - }, - o = t => { - O("FirebaseAuthCredentialsProvider", "Auth detected"), this.auth = t, this.auth.addAuthTokenListener(this.o), r(); - }; - - this.t.onInit(t => o(t)), // Our users can initialize Auth right after Firestore, so we give it - // a chance to register itself with the component framework before we - // determine whether to start up in unauthenticated mode. - setTimeout(() => { - if (!this.auth) { - const t = this.t.getImmediate({ - optional: !0 - }); - t ? o(t) : ( // If auth is still not available, proceed with `null` user - O("FirebaseAuthCredentialsProvider", "Auth not yet detected"), i.resolve(), i = new j()); - } - }, 0), r(); - } - - getToken() { - // Take note of the current value of the tokenCounter so that this method - // can fail (with an ABORTED error) if there is a token change while the - // request is outstanding. - const t = this.i, - e = this.forceRefresh; - return this.forceRefresh = !1, this.auth ? this.auth.getToken(e).then(e => // Cancel the request since the token changed while the request was - // outstanding so the response is potentially for a previous user (which - // user, we can't be sure). - this.i !== t ? (O("FirebaseAuthCredentialsProvider", "getToken aborted due to token change."), this.getToken()) : e ? (U("string" == typeof e.accessToken), new W(e.accessToken, this.currentUser)) : null) : Promise.resolve(null); - } - - invalidateToken() { - this.forceRefresh = !0; - } - - shutdown() { - this.auth && this.auth.removeAuthTokenListener(this.o); - } // Auth.getUid() can return null even with a user logged in. It is because - // getUid() is synchronous, but the auth code populating Uid is asynchronous. - // This method should only be called in the AuthTokenListener callback - // to guarantee to get the actual user. - - - u() { - const t = this.auth && this.auth.getUid(); - return U(null === t || "string" == typeof t), new C(t); - } - -} -/* - * FirstPartyToken provides a fresh token each time its value - * is requested, because if the token is too old, requests will be rejected. - * Technically this may no longer be necessary since the SDK should gracefully - * recover from unauthenticated errors (see b/33147818 for context), but it's - * safer to keep the implementation as-is. - */ - - -class Y { - constructor(t, e, n, s) { - this.h = t, this.l = e, this.m = n, this.g = s, this.type = "FirstParty", this.user = C.FIRST_PARTY, this.p = new Map(); - } - /** Gets an authorization token, using a provided factory function, or falling back to First Party GAPI. */ - - - I() { - return this.g ? this.g() : ( // Make sure this really is a Gapi client. - U(!("object" != typeof this.h || null === this.h || !this.h.auth || !this.h.auth.getAuthHeaderValueForFirstParty)), this.h.auth.getAuthHeaderValueForFirstParty([])); - } - - get headers() { - this.p.set("X-Goog-AuthUser", this.l); // Use array notation to prevent minification - - const t = this.I(); - return t && this.p.set("Authorization", t), this.m && this.p.set("X-Goog-Iam-Authorization-Token", this.m), this.p; - } - -} -/* - * Provides user credentials required for the Firestore JavaScript SDK - * to authenticate the user, using technique that is only available - * to applications hosted by Google. - */ - - -class X { - constructor(t, e, n, s) { - this.h = t, this.l = e, this.m = n, this.g = s; - } - - getToken() { - return Promise.resolve(new Y(this.h, this.l, this.m, this.g)); - } - - start(t, e) { - // Fire with initial uid. - t.enqueueRetryable(() => e(C.FIRST_PARTY)); - } - - shutdown() {} - - invalidateToken() {} - -} - -class Z { - constructor(t) { - this.value = t, this.type = "AppCheck", this.headers = new Map(), t && t.length > 0 && this.headers.set("x-firebase-appcheck", this.value); - } - -} - -class tt { - constructor(t) { - this.T = t, this.forceRefresh = !1, this.appCheck = null, this.A = null; - } - - start(t, e) { - const n = t => { - null != t.error && O("FirebaseAppCheckTokenProvider", `Error getting App Check token; using placeholder token instead. Error: ${t.error.message}`); - const n = t.token !== this.A; - return this.A = t.token, O("FirebaseAppCheckTokenProvider", `Received ${n ? "new" : "existing"} token.`), n ? e(t.token) : Promise.resolve(); - }; - - this.o = e => { - t.enqueueRetryable(() => n(e)); - }; - - const s = t => { - O("FirebaseAppCheckTokenProvider", "AppCheck detected"), this.appCheck = t, this.appCheck.addTokenListener(this.o); - }; - - this.T.onInit(t => s(t)), // Our users can initialize AppCheck after Firestore, so we give it - // a chance to register itself with the component framework. - setTimeout(() => { - if (!this.appCheck) { - const t = this.T.getImmediate({ - optional: !0 - }); - t ? s(t) : // If AppCheck is still not available, proceed without it. - O("FirebaseAppCheckTokenProvider", "AppCheck not yet detected"); - } - }, 0); - } - - getToken() { - const t = this.forceRefresh; - return this.forceRefresh = !1, this.appCheck ? this.appCheck.getToken(t).then(t => t ? (U("string" == typeof t.token), this.A = t.token, new Z(t.token)) : null) : Promise.resolve(null); - } - - invalidateToken() { - this.forceRefresh = !0; - } - - shutdown() { - this.appCheck && this.appCheck.removeTokenListener(this.o); - } - -} -/** - * An AppCheck token provider that always yields an empty token. - * @internal - */ - - -class et { - getToken() { - return Promise.resolve(new Z("")); - } - - invalidateToken() {} - - start(t, e) {} - - shutdown() {} - -} -/** - * Builds a CredentialsProvider depending on the type of - * the credentials passed in. - */ - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Generates `nBytes` of random bytes. - * - * If `nBytes < 0` , an error will be thrown. - */ - - -function nt(t) { - // Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available. - const e = // eslint-disable-next-line @typescript-eslint/no-explicit-any - "undefined" != typeof self && (self.crypto || self.msCrypto), - n = new Uint8Array(t); - if (e && "function" == typeof e.getRandomValues) e.getRandomValues(n);else // Falls back to Math.random - for (let e = 0; e < t; e++) n[e] = Math.floor(256 * Math.random()); - return n; -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class st { - static R() { - // Alphanumeric characters - const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", - e = Math.floor(256 / t.length) * t.length; // The largest byte value that is a multiple of `char.length`. - - let n = ""; - - for (; n.length < 20;) { - const s = nt(40); - - for (let i = 0; i < s.length; ++i) // Only accept values that are [0, maxMultiple), this ensures they can - // be evenly mapped to indices of `chars` via a modulo operation. - n.length < 20 && s[i] < e && (n += t.charAt(s[i] % t.length)); - } - - return n; - } - -} - -function it(t, e) { - return t < e ? -1 : t > e ? 1 : 0; -} -/** Helper to compare arrays using isEqual(). */ - - -function rt(t, e, n) { - return t.length === e.length && t.every((t, s) => n(t, e[s])); -} -/** - * Returns the immediate lexicographically-following string. This is useful to - * construct an inclusive range for indexeddb iterators. - */ - - -function ot(t) { - // Return the input string, with an additional NUL byte appended. - return t + "\0"; -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// The earliest date supported by Firestore timestamps (0001-01-01T00:00:00Z). - -/** - * A `Timestamp` represents a point in time independent of any time zone or - * calendar, represented as seconds and fractions of seconds at nanosecond - * resolution in UTC Epoch time. - * - * It is encoded using the Proleptic Gregorian Calendar which extends the - * Gregorian calendar backwards to year one. It is encoded assuming all minutes - * are 60 seconds long, i.e. leap seconds are "smeared" so that no leap second - * table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to - * 9999-12-31T23:59:59.999999999Z. - * - * For examples and further specifications, refer to the - * {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}. - */ - - -class ut { - /** - * Creates a new timestamp. - * - * @param seconds - The number of seconds of UTC time since Unix epoch - * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - * 9999-12-31T23:59:59Z inclusive. - * @param nanoseconds - The non-negative fractions of a second at nanosecond - * resolution. Negative second values with fractions must still have - * non-negative nanoseconds values that count forward in time. Must be - * from 0 to 999,999,999 inclusive. - */ - constructor( - /** - * The number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. - */ - t, - /** - * The fractions of a second at nanosecond resolution.* - */ - e) { - if (this.seconds = t, this.nanoseconds = e, e < 0) throw new Q(G.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + e); - if (e >= 1e9) throw new Q(G.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + e); - if (t < -62135596800) throw new Q(G.INVALID_ARGUMENT, "Timestamp seconds out of range: " + t); // This will break in the year 10,000. - - if (t >= 253402300800) throw new Q(G.INVALID_ARGUMENT, "Timestamp seconds out of range: " + t); - } - /** - * Creates a new timestamp with the current date, with millisecond precision. - * - * @returns a new timestamp representing the current date. - */ - - - static now() { - return ut.fromMillis(Date.now()); - } - /** - * Creates a new timestamp from the given date. - * - * @param date - The date to initialize the `Timestamp` from. - * @returns A new `Timestamp` representing the same point in time as the given - * date. - */ - - - static fromDate(t) { - return ut.fromMillis(t.getTime()); - } - /** - * Creates a new timestamp from the given number of milliseconds. - * - * @param milliseconds - Number of milliseconds since Unix epoch - * 1970-01-01T00:00:00Z. - * @returns A new `Timestamp` representing the same point in time as the given - * number of milliseconds. - */ - - - static fromMillis(t) { - const e = Math.floor(t / 1e3), - n = Math.floor(1e6 * (t - 1e3 * e)); - return new ut(e, n); - } - /** - * Converts a `Timestamp` to a JavaScript `Date` object. This conversion - * causes a loss of precision since `Date` objects only support millisecond - * precision. - * - * @returns JavaScript `Date` object representing the same point in time as - * this `Timestamp`, with millisecond precision. - */ - - - toDate() { - return new Date(this.toMillis()); - } - /** - * Converts a `Timestamp` to a numeric timestamp (in milliseconds since - * epoch). This operation causes a loss of precision. - * - * @returns The point in time corresponding to this timestamp, represented as - * the number of milliseconds since Unix epoch 1970-01-01T00:00:00Z. - */ - - - toMillis() { - return 1e3 * this.seconds + this.nanoseconds / 1e6; - } - - _compareTo(t) { - return this.seconds === t.seconds ? it(this.nanoseconds, t.nanoseconds) : it(this.seconds, t.seconds); - } - /** - * Returns true if this `Timestamp` is equal to the provided one. - * - * @param other - The `Timestamp` to compare against. - * @returns true if this `Timestamp` is equal to the provided one. - */ - - - isEqual(t) { - return t.seconds === this.seconds && t.nanoseconds === this.nanoseconds; - } - /** Returns a textual representation of this `Timestamp`. */ - - - toString() { - return "Timestamp(seconds=" + this.seconds + ", nanoseconds=" + this.nanoseconds + ")"; - } - /** Returns a JSON-serializable representation of this `Timestamp`. */ - - - toJSON() { - return { - seconds: this.seconds, - nanoseconds: this.nanoseconds - }; - } - /** - * Converts this object to a primitive string, which allows `Timestamp` objects - * to be compared using the `>`, `<=`, `>=` and `>` operators. - */ - - - valueOf() { - // This method returns a string of the form . where - // is translated to have a non-negative value and both - // and are left-padded with zeroes to be a consistent length. - // Strings with this format then have a lexiographical ordering that matches - // the expected ordering. The translation is done to avoid having - // a leading negative sign (i.e. a leading '-' character) in its string - // representation, which would affect its lexiographical ordering. - const t = this.seconds - -62135596800; // Note: Up to 12 decimal digits are required to represent all valid - // 'seconds' values. - - return String(t).padStart(12, "0") + "." + String(this.nanoseconds).padStart(9, "0"); - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A version of a document in Firestore. This corresponds to the version - * timestamp, such as update_time or read_time. - */ - - -class ct { - constructor(t) { - this.timestamp = t; - } - - static fromTimestamp(t) { - return new ct(t); - } - - static min() { - return new ct(new ut(0, 0)); - } - - static max() { - return new ct(new ut(253402300799, 999999999)); - } - - compareTo(t) { - return this.timestamp._compareTo(t.timestamp); - } - - isEqual(t) { - return this.timestamp.isEqual(t.timestamp); - } - /** Returns a number representation of the version for use in spec tests. */ - - - toMicroseconds() { - // Convert to microseconds. - return 1e6 * this.timestamp.seconds + this.timestamp.nanoseconds / 1e3; - } - - toString() { - return "SnapshotVersion(" + this.timestamp.toString() + ")"; - } - - toTimestamp() { - return this.timestamp; - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Path represents an ordered sequence of string segments. - */ - - -class at { - constructor(t, e, n) { - void 0 === e ? e = 0 : e > t.length && L(), void 0 === n ? n = t.length - e : n > t.length - e && L(), this.segments = t, this.offset = e, this.len = n; - } - - get length() { - return this.len; - } - - isEqual(t) { - return 0 === at.comparator(this, t); - } - - child(t) { - const e = this.segments.slice(this.offset, this.limit()); - return t instanceof at ? t.forEach(t => { - e.push(t); - }) : e.push(t), this.construct(e); - } - /** The index of one past the last segment of the path. */ - - - limit() { - return this.offset + this.length; - } - - popFirst(t) { - return t = void 0 === t ? 1 : t, this.construct(this.segments, this.offset + t, this.length - t); - } - - popLast() { - return this.construct(this.segments, this.offset, this.length - 1); - } - - firstSegment() { - return this.segments[this.offset]; - } - - lastSegment() { - return this.get(this.length - 1); - } - - get(t) { - return this.segments[this.offset + t]; - } - - isEmpty() { - return 0 === this.length; - } - - isPrefixOf(t) { - if (t.length < this.length) return !1; - - for (let e = 0; e < this.length; e++) if (this.get(e) !== t.get(e)) return !1; - - return !0; - } - - isImmediateParentOf(t) { - if (this.length + 1 !== t.length) return !1; - - for (let e = 0; e < this.length; e++) if (this.get(e) !== t.get(e)) return !1; - - return !0; - } - - forEach(t) { - for (let e = this.offset, n = this.limit(); e < n; e++) t(this.segments[e]); - } - - toArray() { - return this.segments.slice(this.offset, this.limit()); - } - - static comparator(t, e) { - const n = Math.min(t.length, e.length); - - for (let s = 0; s < n; s++) { - const n = t.get(s), - i = e.get(s); - if (n < i) return -1; - if (n > i) return 1; - } - - return t.length < e.length ? -1 : t.length > e.length ? 1 : 0; - } - -} -/** - * A slash-separated path for navigating resources (documents and collections) - * within Firestore. - * - * @internal - */ - - -class ht extends at { - construct(t, e, n) { - return new ht(t, e, n); - } - - canonicalString() { - // NOTE: The client is ignorant of any path segments containing escape - // sequences (e.g. __id123__) and just passes them through raw (they exist - // for legacy reasons and should not be used frequently). - return this.toArray().join("/"); - } - - toString() { - return this.canonicalString(); - } - /** - * Creates a resource path from the given slash-delimited string. If multiple - * arguments are provided, all components are combined. Leading and trailing - * slashes from all components are ignored. - */ - - - static fromString() { - // NOTE: The client is ignorant of any path segments containing escape - // sequences (e.g. __id123__) and just passes them through raw (they exist - // for legacy reasons and should not be used frequently). - const e = []; - - for (var _len4 = arguments.length, t = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { - t[_key4] = arguments[_key4]; - } - - for (const n of t) { - if (n.indexOf("//") >= 0) throw new Q(G.INVALID_ARGUMENT, `Invalid segment (${n}). Paths must not contain // in them.`); // Strip leading and traling slashed. - - e.push(...n.split("/").filter(t => t.length > 0)); - } - - return new ht(e); - } - - static emptyPath() { - return new ht([]); - } - -} - -const lt = /^[_a-zA-Z][_a-zA-Z0-9]*$/; -/** - * A dot-separated path for navigating sub-objects within a document. - * @internal - */ - -class ft extends at { - construct(t, e, n) { - return new ft(t, e, n); - } - /** - * Returns true if the string could be used as a segment in a field path - * without escaping. - */ - - - static isValidIdentifier(t) { - return lt.test(t); - } - - canonicalString() { - return this.toArray().map(t => (t = t.replace(/\\/g, "\\\\").replace(/`/g, "\\`"), ft.isValidIdentifier(t) || (t = "`" + t + "`"), t)).join("."); - } - - toString() { - return this.canonicalString(); - } - /** - * Returns true if this field references the key of a document. - */ - - - isKeyField() { - return 1 === this.length && "__name__" === this.get(0); - } - /** - * The field designating the key of a document. - */ - - - static keyField() { - return new ft(["__name__"]); - } - /** - * Parses a field string from the given server-formatted string. - * - * - Splitting the empty string is not allowed (for now at least). - * - Empty segments within the string (e.g. if there are two consecutive - * separators) are not allowed. - * - * TODO(b/37244157): we should make this more strict. Right now, it allows - * non-identifier path components, even if they aren't escaped. - */ - - - static fromServerFormat(t) { - const e = []; - let n = "", - s = 0; - - const i = () => { - if (0 === n.length) throw new Q(G.INVALID_ARGUMENT, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`); - e.push(n), n = ""; - }; - - let r = !1; - - for (; s < t.length;) { - const e = t[s]; - - if ("\\" === e) { - if (s + 1 === t.length) throw new Q(G.INVALID_ARGUMENT, "Path has trailing escape character: " + t); - const e = t[s + 1]; - if ("\\" !== e && "." !== e && "`" !== e) throw new Q(G.INVALID_ARGUMENT, "Path has invalid escape sequence: " + t); - n += e, s += 2; - } else "`" === e ? (r = !r, s++) : "." !== e || r ? (n += e, s++) : (i(), s++); - } - - if (i(), r) throw new Q(G.INVALID_ARGUMENT, "Unterminated ` in path: " + t); - return new ft(e); - } - - static emptyPath() { - return new ft([]); - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @internal - */ - - -class dt { - constructor(t) { - this.path = t; - } - - static fromPath(t) { - return new dt(ht.fromString(t)); - } - - static fromName(t) { - return new dt(ht.fromString(t).popFirst(5)); - } - - static empty() { - return new dt(ht.emptyPath()); - } - - get collectionGroup() { - return this.path.popLast().lastSegment(); - } - /** Returns true if the document is in the specified collectionId. */ - - - hasCollectionId(t) { - return this.path.length >= 2 && this.path.get(this.path.length - 2) === t; - } - /** Returns the collection group (i.e. the name of the parent collection) for this key. */ - - - getCollectionGroup() { - return this.path.get(this.path.length - 2); - } - /** Returns the fully qualified path to the parent collection. */ - - - getCollectionPath() { - return this.path.popLast(); - } - - isEqual(t) { - return null !== t && 0 === ht.comparator(this.path, t.path); - } - - toString() { - return this.path.toString(); - } - - static comparator(t, e) { - return ht.comparator(t.path, e.path); - } - - static isDocumentKey(t) { - return t.length % 2 == 0; - } - /** - * Creates and returns a new document key with the given segments. - * - * @param segments - The segments of the path to the document - * @returns A new instance of DocumentKey - */ - - - static fromSegments(t) { - return new dt(new ht(t.slice())); - } - -} -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * The initial mutation batch id for each index. Gets updated during index - * backfill. - */ - -/** - * An index definition for field indexes in Firestore. - * - * Every index is associated with a collection. The definition contains a list - * of fields and their index kind (which can be `ASCENDING`, `DESCENDING` or - * `CONTAINS` for ArrayContains/ArrayContainsAny queries). - * - * Unlike the backend, the SDK does not differentiate between collection or - * collection group-scoped indices. Every index can be used for both single - * collection and collection group queries. - */ - - -class _t { - constructor( - /** - * The index ID. Returns -1 if the index ID is not available (e.g. the index - * has not yet been persisted). - */ - t, - /** The collection ID this index applies to. */ - e, - /** The field segments for this index. */ - n, - /** Shows how up-to-date the index is for the current user. */ - s) { - this.indexId = t, this.collectionGroup = e, this.fields = n, this.indexState = s; - } - -} -/** An ID for an index that has not yet been added to persistence. */ - -/** Returns the ArrayContains/ArrayContainsAny segment for this index. */ - - -function wt(t) { - return t.fields.find(t => 2 - /* CONTAINS */ - === t.kind); -} -/** Returns all directional (ascending/descending) segments for this index. */ - - -function mt(t) { - return t.fields.filter(t => 2 - /* CONTAINS */ - !== t.kind); -} -/** - * Returns the order of the document key component for the given index. - * - * PORTING NOTE: This is only used in the Web IndexedDb implementation. - */ - -/** - * Compares indexes by collection group and segments. Ignores update time and - * index ID. - */ - - -function gt(t, e) { - let n = it(t.collectionGroup, e.collectionGroup); - if (0 !== n) return n; - - for (let s = 0; s < Math.min(t.fields.length, e.fields.length); ++s) if (n = pt(t.fields[s], e.fields[s]), 0 !== n) return n; - - return it(t.fields.length, e.fields.length); -} -/** Returns a debug representation of the field index */ - - -_t.UNKNOWN_ID = -1; -/** An index component consisting of field path and index type. */ - -class yt { - constructor( - /** The field path of the component. */ - t, - /** The fields sorting order. */ - e) { - this.fieldPath = t, this.kind = e; - } - -} - -function pt(t, e) { - const n = ft.comparator(t.fieldPath, e.fieldPath); - return 0 !== n ? n : it(t.kind, e.kind); -} -/** - * Stores the "high water mark" that indicates how updated the Index is for the - * current user. - */ - - -class It { - constructor( - /** - * Indicates when the index was last updated (relative to other indexes). - */ - t, - /** The the latest indexed read time, document and batch id. */ - e) { - this.sequenceNumber = t, this.offset = e; - } - /** The state of an index that has not yet been backfilled. */ - - - static empty() { - return new It(0, At.min()); - } - -} -/** - * Creates an offset that matches all documents with a read time higher than - * `readTime`. - */ - - -function Tt(t, e) { - // We want to create an offset that matches all documents with a read time - // greater than the provided read time. To do so, we technically need to - // create an offset for `(readTime, MAX_DOCUMENT_KEY)`. While we could use - // Unicode codepoints to generate MAX_DOCUMENT_KEY, it is much easier to use - // `(readTime + 1, DocumentKey.empty())` since `> DocumentKey.empty()` matches - // all valid document IDs. - const n = t.toTimestamp().seconds, - s = t.toTimestamp().nanoseconds + 1, - i = ct.fromTimestamp(1e9 === s ? new ut(n + 1, 0) : new ut(n, s)); - return new At(i, dt.empty(), e); -} -/** Creates a new offset based on the provided document. */ - - -function Et(t) { - return new At(t.readTime, t.key, -1); -} -/** - * Stores the latest read time, document and batch ID that were processed for an - * index. - */ - - -class At { - constructor( - /** - * The latest read time version that has been indexed by Firestore for this - * field index. - */ - t, - /** - * The key of the last document that was indexed for this query. Use - * `DocumentKey.empty()` if no document has been indexed. - */ - e, - /* - * The largest mutation batch id that's been processed by Firestore. - */ - n) { - this.readTime = t, this.documentKey = e, this.largestBatchId = n; - } - /** Returns an offset that sorts before all regular offsets. */ - - - static min() { - return new At(ct.min(), dt.empty(), -1); - } - /** Returns an offset that sorts after all regular offsets. */ - - - static max() { - return new At(ct.max(), dt.empty(), -1); - } - -} - -function Rt(t, e) { - let n = t.readTime.compareTo(e.readTime); - return 0 !== n ? n : (n = dt.comparator(t.documentKey, e.documentKey), 0 !== n ? n : it(t.largestBatchId, e.largestBatchId)); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const bt = "The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab."; -/** - * A base class representing a persistence transaction, encapsulating both the - * transaction's sequence numbers as well as a list of onCommitted listeners. - * - * When you call Persistence.runTransaction(), it will create a transaction and - * pass it to your callback. You then pass it to any method that operates - * on persistence. - */ - -class Pt { - constructor() { - this.onCommittedListeners = []; - } - - addOnCommittedListener(t) { - this.onCommittedListeners.push(t); - } - - raiseOnCommittedEvent() { - this.onCommittedListeners.forEach(t => t()); - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Verifies the error thrown by a LocalStore operation. If a LocalStore - * operation fails because the primary lease has been taken by another client, - * we ignore the error (the persistence layer will immediately call - * `applyPrimaryLease` to propagate the primary state change). All other errors - * are re-thrown. - * - * @param err - An error returned by a LocalStore operation. - * @returns A Promise that resolves after we recovered, or the original error. - */ - - -async function vt(t) { - if (t.code !== G.FAILED_PRECONDITION || t.message !== bt) throw t; - O("LocalStore", "Unexpectedly lost primary lease"); -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * PersistencePromise is essentially a re-implementation of Promise except - * it has a .next() method instead of .then() and .next() and .catch() callbacks - * are executed synchronously when a PersistencePromise resolves rather than - * asynchronously (Promise implementations use setImmediate() or similar). - * - * This is necessary to interoperate with IndexedDB which will automatically - * commit transactions if control is returned to the event loop without - * synchronously initiating another operation on the transaction. - * - * NOTE: .then() and .catch() only allow a single consumer, unlike normal - * Promises. - */ - - -class Vt { - constructor(t) { - // NOTE: next/catchCallback will always point to our own wrapper functions, - // not the user's raw next() or catch() callbacks. - this.nextCallback = null, this.catchCallback = null, // When the operation resolves, we'll set result or error and mark isDone. - this.result = void 0, this.error = void 0, this.isDone = !1, // Set to true when .then() or .catch() are called and prevents additional - // chaining. - this.callbackAttached = !1, t(t => { - this.isDone = !0, this.result = t, this.nextCallback && // value should be defined unless T is Void, but we can't express - // that in the type system. - this.nextCallback(t); - }, t => { - this.isDone = !0, this.error = t, this.catchCallback && this.catchCallback(t); - }); - } - - catch(t) { - return this.next(void 0, t); - } - - next(t, e) { - return this.callbackAttached && L(), this.callbackAttached = !0, this.isDone ? this.error ? this.wrapFailure(e, this.error) : this.wrapSuccess(t, this.result) : new Vt((n, s) => { - this.nextCallback = e => { - this.wrapSuccess(t, e).next(n, s); - }, this.catchCallback = t => { - this.wrapFailure(e, t).next(n, s); - }; - }); - } - - toPromise() { - return new Promise((t, e) => { - this.next(t, e); - }); - } - - wrapUserFunction(t) { - try { - const e = t(); - return e instanceof Vt ? e : Vt.resolve(e); - } catch (t) { - return Vt.reject(t); - } - } - - wrapSuccess(t, e) { - return t ? this.wrapUserFunction(() => t(e)) : Vt.resolve(e); - } - - wrapFailure(t, e) { - return t ? this.wrapUserFunction(() => t(e)) : Vt.reject(e); - } - - static resolve(t) { - return new Vt((e, n) => { - e(t); - }); - } - - static reject(t) { - return new Vt((e, n) => { - n(t); - }); - } - - static waitFor( // Accept all Promise types in waitFor(). - // eslint-disable-next-line @typescript-eslint/no-explicit-any - t) { - return new Vt((e, n) => { - let s = 0, - i = 0, - r = !1; - t.forEach(t => { - ++s, t.next(() => { - ++i, r && i === s && e(); - }, t => n(t)); - }), r = !0, i === s && e(); - }); - } - /** - * Given an array of predicate functions that asynchronously evaluate to a - * boolean, implements a short-circuiting `or` between the results. Predicates - * will be evaluated until one of them returns `true`, then stop. The final - * result will be whether any of them returned `true`. - */ - - - static or(t) { - let e = Vt.resolve(!1); - - for (const n of t) e = e.next(t => t ? Vt.resolve(t) : n()); - - return e; - } - - static forEach(t, e) { - const n = []; - return t.forEach((t, s) => { - n.push(e.call(this, t, s)); - }), this.waitFor(n); - } - /** - * Concurrently map all array elements through asynchronous function. - */ - - - static mapArray(t, e) { - return new Vt((n, s) => { - const i = t.length, - r = new Array(i); - let o = 0; - - for (let u = 0; u < i; u++) { - const c = u; - e(t[c]).next(t => { - r[c] = t, ++o, o === i && n(r); - }, t => s(t)); - } - }); - } - /** - * An alternative to recursive PersistencePromise calls, that avoids - * potential memory problems from unbounded chains of promises. - * - * The `action` will be called repeatedly while `condition` is true. - */ - - - static doWhile(t, e) { - return new Vt((n, s) => { - const i = () => { - !0 === t() ? e().next(() => { - i(); - }, s) : n(); - }; - - i(); - }); - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// References to `window` are guarded by SimpleDb.isAvailable() - -/* eslint-disable no-restricted-globals */ - -/** - * Wraps an IDBTransaction and exposes a store() method to get a handle to a - * specific object store. - */ - - -class St { - constructor(t, e) { - this.action = t, this.transaction = e, this.aborted = !1, - /** - * A `Promise` that resolves with the result of the IndexedDb transaction. - */ - this.P = new j(), this.transaction.oncomplete = () => { - this.P.resolve(); - }, this.transaction.onabort = () => { - e.error ? this.P.reject(new xt(t, e.error)) : this.P.resolve(); - }, this.transaction.onerror = e => { - const n = Ft(e.target.error); - this.P.reject(new xt(t, n)); - }; - } - - static open(t, e, n, s) { - try { - return new St(e, t.transaction(s, n)); - } catch (t) { - throw new xt(e, t); - } - } - - get v() { - return this.P.promise; - } - - abort(t) { - t && this.P.reject(t), this.aborted || (O("SimpleDb", "Aborting transaction:", t ? t.message : "Client-initiated abort"), this.aborted = !0, this.transaction.abort()); - } - - V() { - // If the browser supports V3 IndexedDB, we invoke commit() explicitly to - // speed up index DB processing if the event loop remains blocks. - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const t = this.transaction; - this.aborted || "function" != typeof t.commit || t.commit(); - } - /** - * Returns a SimpleDbStore for the specified store. All - * operations performed on the SimpleDbStore happen within the context of this - * transaction and it cannot be used anymore once the transaction is - * completed. - * - * Note that we can't actually enforce that the KeyType and ValueType are - * correct, but they allow type safety through the rest of the consuming code. - */ - - - store(t) { - const e = this.transaction.objectStore(t); - return new kt(e); - } - -} -/** - * Provides a wrapper around IndexedDb with a simplified interface that uses - * Promise-like return values to chain operations. Real promises cannot be used - * since .then() continuations are executed asynchronously (e.g. via - * .setImmediate), which would cause IndexedDB to end the transaction. - * See PersistencePromise for more details. - */ - - -class Dt { - /* - * Creates a new SimpleDb wrapper for IndexedDb database `name`. - * - * Note that `version` must not be a downgrade. IndexedDB does not support - * downgrading the schema version. We currently do not support any way to do - * versioning outside of IndexedDB's versioning mechanism, as only - * version-upgrade transactions are allowed to do things like create - * objectstores. - */ - constructor(t, e, n) { - this.name = t, this.version = e, this.S = n; // NOTE: According to https://bugs.webkit.org/show_bug.cgi?id=197050, the - // bug we're checking for should exist in iOS >= 12.2 and < 13, but for - // whatever reason it's much harder to hit after 12.2 so we only proactively - // log on 12.2. - - 12.2 === Dt.D((0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getUA)()) && F("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround."); - } - /** Deletes the specified database. */ - - - static delete(t) { - return O("SimpleDb", "Removing database:", t), Mt(window.indexedDB.deleteDatabase(t)).toPromise(); - } - /** Returns true if IndexedDB is available in the current environment. */ - - - static C() { - if (!(0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.isIndexedDBAvailable)()) return !1; - if (Dt.N()) return !0; // We extensively use indexed array values and compound keys, - // which IE and Edge do not support. However, they still have indexedDB - // defined on the window, so we need to check for them here and make sure - // to return that persistence is not enabled for those browsers. - // For tracking support of this feature, see here: - // https://developer.microsoft.com/en-us/microsoft-edge/platform/status/indexeddbarraysandmultientrysupport/ - // Check the UA string to find out the browser. - - const t = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getUA)(), - e = Dt.D(t), - n = 0 < e && e < 10, - s = Dt.k(t), - i = 0 < s && s < 4.5; // IE 10 - // ua = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)'; - // IE 11 - // ua = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko'; - // Edge - // ua = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, - // like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0'; - // iOS Safari: Disable for users running iOS version < 10. - - return !(t.indexOf("MSIE ") > 0 || t.indexOf("Trident/") > 0 || t.indexOf("Edge/") > 0 || n || i); - } - /** - * Returns true if the backing IndexedDB store is the Node IndexedDBShim - * (see https://github.com/axemclion/IndexedDBShim). - */ - - - static N() { - var t; - return "undefined" != typeof process && "YES" === (null === (t = ({"NODE_ENV":"development","PUBLIC_URL":"","WDS_SOCKET_HOST":undefined,"WDS_SOCKET_PATH":undefined,"WDS_SOCKET_PORT":undefined,"FAST_REFRESH":true,"REACT_APP_API_KEY":"AIzaSyChf-PyMiVObm6krhwzetP4lUKee4vzvrQ","REACT_APP_AUTH_DOMAIN":"polyzero-37efc.firebaseapp.com","REACT_APP_PROJECT_ID":"polyzero-37efc","REACT_APP_STORAGE_BUCKET":"polyzero-37efc.appspot.com","REACT_APP_MSG_SENDER_ID":"63330640151","REACT_APP_APP_ID":"1:63330640151:web:0677a82628cba788d91752"})) || void 0 === t ? void 0 : t.M); - } - /** Helper to get a typed SimpleDbStore from a transaction. */ - - - static O(t, e) { - return t.store(e); - } // visible for testing - - /** Parse User Agent to determine iOS version. Returns -1 if not found. */ - - - static D(t) { - const e = t.match(/i(?:phone|pad|pod) os ([\d_]+)/i), - n = e ? e[1].split("_").slice(0, 2).join(".") : "-1"; - return Number(n); - } // visible for testing - - /** Parse User Agent to determine Android version. Returns -1 if not found. */ - - - static k(t) { - const e = t.match(/Android ([\d.]+)/i), - n = e ? e[1].split(".").slice(0, 2).join(".") : "-1"; - return Number(n); - } - /** - * Opens the specified database, creating or upgrading it if necessary. - */ - - - async F(t) { - return this.db || (O("SimpleDb", "Opening database:", this.name), this.db = await new Promise((e, n) => { - // TODO(mikelehen): Investigate browser compatibility. - // https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB - // suggests IE9 and older WebKit browsers handle upgrade - // differently. They expect setVersion, as described here: - // https://developer.mozilla.org/en-US/docs/Web/API/IDBVersionChangeRequest/setVersion - const s = indexedDB.open(this.name, this.version); - s.onsuccess = t => { - const n = t.target.result; - e(n); - }, s.onblocked = () => { - n(new xt(t, "Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed.")); - }, s.onerror = e => { - const s = e.target.error; - "VersionError" === s.name ? n(new Q(G.FAILED_PRECONDITION, "A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")) : "InvalidStateError" === s.name ? n(new Q(G.FAILED_PRECONDITION, "Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: " + s)) : n(new xt(t, s)); - }, s.onupgradeneeded = t => { - O("SimpleDb", 'Database "' + this.name + '" requires upgrade from version:', t.oldVersion); - const e = t.target.result; - this.S.$(e, s.transaction, t.oldVersion, this.version).next(() => { - O("SimpleDb", "Database upgrade to version " + this.version + " complete"); - }); - }; - })), this.B && (this.db.onversionchange = t => this.B(t)), this.db; - } - - L(t) { - this.B = t, this.db && (this.db.onversionchange = e => t(e)); - } - - async runTransaction(t, e, n, s) { - const i = "readonly" === e; - let r = 0; - - for (;;) { - ++r; - - try { - this.db = await this.F(t); - const e = St.open(this.db, t, i ? "readonly" : "readwrite", n), - r = s(e).next(t => (e.V(), t)).catch(t => ( // Abort the transaction if there was an error. - e.abort(t), Vt.reject(t))).toPromise(); // As noted above, errors are propagated by aborting the transaction. So - // we swallow any error here to avoid the browser logging it as unhandled. - - return r.catch(() => {}), // Wait for the transaction to complete (i.e. IndexedDb's onsuccess event to - // fire), but still return the original transactionFnResult back to the - // caller. - await e.v, r; - } catch (t) { - const e = t, - n = "FirebaseError" !== e.name && r < 3; // TODO(schmidt-sebastian): We could probably be smarter about this and - // not retry exceptions that are likely unrecoverable (such as quota - // exceeded errors). - // Note: We cannot use an instanceof check for FirestoreException, since the - // exception is wrapped in a generic error by our async/await handling. - - if (O("SimpleDb", "Transaction failed with error:", e.message, "Retrying:", n), this.close(), !n) return Promise.reject(e); - } - } - } - - close() { - this.db && this.db.close(), this.db = void 0; - } - -} -/** - * A controller for iterating over a key range or index. It allows an iterate - * callback to delete the currently-referenced object, or jump to a new key - * within the key range or index. - */ - - -class Ct { - constructor(t) { - this.U = t, this.q = !1, this.K = null; - } - - get isDone() { - return this.q; - } - - get G() { - return this.K; - } - - set cursor(t) { - this.U = t; - } - /** - * This function can be called to stop iteration at any point. - */ - - - done() { - this.q = !0; - } - /** - * This function can be called to skip to that next key, which could be - * an index or a primary key. - */ - - - j(t) { - this.K = t; - } - /** - * Delete the current cursor value from the object store. - * - * NOTE: You CANNOT do this with a keysOnly query. - */ - - - delete() { - return Mt(this.U.delete()); - } - -} -/** An error that wraps exceptions that thrown during IndexedDB execution. */ - - -class xt extends Q { - constructor(t, e) { - super(G.UNAVAILABLE, `IndexedDB transaction '${t}' failed: ${e}`), this.name = "IndexedDbTransactionError"; - } - -} -/** Verifies whether `e` is an IndexedDbTransactionError. */ - - -function Nt(t) { - // Use name equality, as instanceof checks on errors don't work with errors - // that wrap other errors. - return "IndexedDbTransactionError" === t.name; -} -/** - * A wrapper around an IDBObjectStore providing an API that: - * - * 1) Has generic KeyType / ValueType parameters to provide strongly-typed - * methods for acting against the object store. - * 2) Deals with IndexedDB's onsuccess / onerror event callbacks, making every - * method return a PersistencePromise instead. - * 3) Provides a higher-level API to avoid needing to do excessive wrapping of - * intermediate IndexedDB types (IDBCursorWithValue, etc.) - */ - - -class kt { - constructor(t) { - this.store = t; - } - - put(t, e) { - let n; - return void 0 !== e ? (O("SimpleDb", "PUT", this.store.name, t, e), n = this.store.put(e, t)) : (O("SimpleDb", "PUT", this.store.name, "", t), n = this.store.put(t)), Mt(n); - } - /** - * Adds a new value into an Object Store and returns the new key. Similar to - * IndexedDb's `add()`, this method will fail on primary key collisions. - * - * @param value - The object to write. - * @returns The key of the value to add. - */ - - - add(t) { - O("SimpleDb", "ADD", this.store.name, t, t); - return Mt(this.store.add(t)); - } - /** - * Gets the object with the specified key from the specified store, or null - * if no object exists with the specified key. - * - * @key The key of the object to get. - * @returns The object with the specified key or null if no object exists. - */ - - - get(t) { - // We're doing an unsafe cast to ValueType. - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return Mt(this.store.get(t)).next(e => ( // Normalize nonexistence to null. - void 0 === e && (e = null), O("SimpleDb", "GET", this.store.name, t, e), e)); - } - - delete(t) { - O("SimpleDb", "DELETE", this.store.name, t); - return Mt(this.store.delete(t)); - } - /** - * If we ever need more of the count variants, we can add overloads. For now, - * all we need is to count everything in a store. - * - * Returns the number of rows in the store. - */ - - - count() { - O("SimpleDb", "COUNT", this.store.name); - return Mt(this.store.count()); - } - - W(t, e) { - const n = this.options(t, e); // Use `getAll()` if the browser supports IndexedDB v3, as it is roughly - // 20% faster. Unfortunately, getAll() does not support custom indices. - - if (n.index || "function" != typeof this.store.getAll) { - const t = this.cursor(n), - e = []; - return this.H(t, (t, n) => { - e.push(n); - }).next(() => e); - } - - { - const t = this.store.getAll(n.range); - return new Vt((e, n) => { - t.onerror = t => { - n(t.target.error); - }, t.onsuccess = t => { - e(t.target.result); - }; - }); - } - } - /** - * Loads the first `count` elements from the provided index range. Loads all - * elements if no limit is provided. - */ - - - J(t, e) { - const n = this.store.getAll(t, null === e ? void 0 : e); - return new Vt((t, e) => { - n.onerror = t => { - e(t.target.error); - }, n.onsuccess = e => { - t(e.target.result); - }; - }); - } - - Y(t, e) { - O("SimpleDb", "DELETE ALL", this.store.name); - const n = this.options(t, e); - n.X = !1; - const s = this.cursor(n); - return this.H(s, (t, e, n) => n.delete()); - } - - Z(t, e) { - let n; - e ? n = t : (n = {}, e = t); - const s = this.cursor(n); - return this.H(s, e); - } - /** - * Iterates over a store, but waits for the given callback to complete for - * each entry before iterating the next entry. This allows the callback to do - * asynchronous work to determine if this iteration should continue. - * - * The provided callback should return `true` to continue iteration, and - * `false` otherwise. - */ - - - tt(t) { - const e = this.cursor({}); - return new Vt((n, s) => { - e.onerror = t => { - const e = Ft(t.target.error); - s(e); - }, e.onsuccess = e => { - const s = e.target.result; - s ? t(s.primaryKey, s.value).next(t => { - t ? s.continue() : n(); - }) : n(); - }; - }); - } - - H(t, e) { - const n = []; - return new Vt((s, i) => { - t.onerror = t => { - i(t.target.error); - }, t.onsuccess = t => { - const i = t.target.result; - if (!i) return void s(); - const r = new Ct(i), - o = e(i.primaryKey, i.value, r); - - if (o instanceof Vt) { - const t = o.catch(t => (r.done(), Vt.reject(t))); - n.push(t); - } - - r.isDone ? s() : null === r.G ? i.continue() : i.continue(r.G); - }; - }).next(() => Vt.waitFor(n)); - } - - options(t, e) { - let n; - return void 0 !== t && ("string" == typeof t ? n = t : e = t), { - index: n, - range: e - }; - } - - cursor(t) { - let e = "next"; - - if (t.reverse && (e = "prev"), t.index) { - const n = this.store.index(t.index); - return t.X ? n.openKeyCursor(t.range, e) : n.openCursor(t.range, e); - } - - return this.store.openCursor(t.range, e); - } - -} -/** - * Wraps an IDBRequest in a PersistencePromise, using the onsuccess / onerror - * handlers to resolve / reject the PersistencePromise as appropriate. - */ - - -function Mt(t) { - return new Vt((e, n) => { - t.onsuccess = t => { - const n = t.target.result; - e(n); - }, t.onerror = t => { - const e = Ft(t.target.error); - n(e); - }; - }); -} // Guard so we only report the error once. - - -let Ot = !1; - -function Ft(t) { - const e = Dt.D((0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getUA)()); - - if (e >= 12.2 && e < 13) { - const e = "An internal error was encountered in the Indexed Database server"; - - if (t.message.indexOf(e) >= 0) { - // Wrap error in a more descriptive one. - const t = new Q("internal", `IOS_INDEXEDDB_BUG1: IndexedDb has thrown '${e}'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.`); - return Ot || (Ot = !0, // Throw a global exception outside of this promise chain, for the user to - // potentially catch. - setTimeout(() => { - throw t; - }, 0)), t; - } - } - - return t; -} -/** This class is responsible for the scheduling of Index Backfiller. */ - - -class $t { - constructor(t, e) { - this.asyncQueue = t, this.et = e, this.task = null; - } - - start() { - this.nt(15); - } - - stop() { - this.task && (this.task.cancel(), this.task = null); - } - - get started() { - return null !== this.task; - } - - nt(t) { - O("IndexBackiller", `Scheduled in ${t}ms`), this.task = this.asyncQueue.enqueueAfterDelay("index_backfill" - /* IndexBackfill */ - , t, async () => { - this.task = null; - - try { - O("IndexBackiller", `Documents written: ${await this.et.st()}`); - } catch (t) { - Nt(t) ? O("IndexBackiller", "Ignoring IndexedDB error during index backfill: ", t) : await vt(t); - } - - await this.nt(1); - }); - } - -} -/** Implements the steps for backfilling indexes. */ - - -class Bt { - constructor( - /** - * LocalStore provides access to IndexManager and LocalDocumentView. - * These properties will update when the user changes. Consequently, - * making a local copy of IndexManager and LocalDocumentView will require - * updates over time. The simpler solution is to rely on LocalStore to have - * an up-to-date references to IndexManager and LocalDocumentStore. - */ - t, e) { - this.localStore = t, this.persistence = e; - } - - async st() { - let t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 50; - return this.persistence.runTransaction("Backfill Indexes", "readwrite-primary", e => this.it(e, t)); - } - /** Writes index entries until the cap is reached. Returns the number of documents processed. */ - - - it(t, e) { - const n = new Set(); - let s = e, - i = !0; - return Vt.doWhile(() => !0 === i && s > 0, () => this.localStore.indexManager.getNextCollectionGroupToUpdate(t).next(e => { - if (null !== e && !n.has(e)) return O("IndexBackiller", `Processing collection: ${e}`), this.rt(t, e, s).next(t => { - s -= t, n.add(e); - }); - i = !1; - })).next(() => e - s); - } - /** - * Writes entries for the provided collection group. Returns the number of documents processed. - */ - - - rt(t, e, n) { - // Use the earliest offset of all field indexes to query the local cache. - return this.localStore.indexManager.getMinOffsetFromCollectionGroup(t, e).next(s => this.localStore.localDocuments.getNextDocuments(t, e, s, n).next(n => { - const i = n.changes; - return this.localStore.indexManager.updateIndexEntries(t, i).next(() => this.ot(s, n)).next(n => (O("IndexBackiller", `Updating offset: ${n}`), this.localStore.indexManager.updateCollectionGroup(t, e, n))).next(() => i.size); - })); - } - /** Returns the next offset based on the provided documents. */ - - - ot(t, e) { - let n = t; - return e.changes.forEach((t, e) => { - const s = Et(e); - Rt(s, n) > 0 && (n = s); - }), new At(n.readTime, n.documentKey, Math.max(e.batchId, t.largestBatchId)); - } - -} -/** - * @license - * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * `ListenSequence` is a monotonic sequence. It is initialized with a minimum value to - * exceed. All subsequent calls to next will return increasing values. If provided with a - * `SequenceNumberSyncer`, it will additionally bump its next value when told of a new value, as - * well as write out sequence numbers that it produces via `next()`. - */ - - -class Lt { - constructor(t, e) { - this.previousValue = t, e && (e.sequenceNumberHandler = t => this.ut(t), this.ct = t => e.writeSequenceNumber(t)); - } - - ut(t) { - return this.previousValue = Math.max(t, this.previousValue), this.previousValue; - } - - next() { - const t = ++this.previousValue; - return this.ct && this.ct(t), t; - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -function Ut(t) { - let e = 0; - - for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e++; - - return e; -} - -function qt(t, e) { - for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]); -} - -function Kt(t) { - for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1; - - return !0; -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// An immutable sorted map implementation, based on a Left-leaning Red-Black -// tree. - - -Lt.at = -1; - -class Gt { - constructor(t, e) { - this.comparator = t, this.root = e || jt.EMPTY; - } // Returns a copy of the map, with the specified key/value added or replaced. - - - insert(t, e) { - return new Gt(this.comparator, this.root.insert(t, e, this.comparator).copy(null, null, jt.BLACK, null, null)); - } // Returns a copy of the map, with the specified key removed. - - - remove(t) { - return new Gt(this.comparator, this.root.remove(t, this.comparator).copy(null, null, jt.BLACK, null, null)); - } // Returns the value of the node with the given key, or null. - - - get(t) { - let e = this.root; - - for (; !e.isEmpty();) { - const n = this.comparator(t, e.key); - if (0 === n) return e.value; - n < 0 ? e = e.left : n > 0 && (e = e.right); - } - - return null; - } // Returns the index of the element in this sorted map, or -1 if it doesn't - // exist. - - - indexOf(t) { - // Number of nodes that were pruned when descending right - let e = 0, - n = this.root; - - for (; !n.isEmpty();) { - const s = this.comparator(t, n.key); - if (0 === s) return e + n.left.size; - s < 0 ? n = n.left : ( // Count all nodes left of the node plus the node itself - e += n.left.size + 1, n = n.right); - } // Node not found - - - return -1; - } - - isEmpty() { - return this.root.isEmpty(); - } // Returns the total number of nodes in the map. - - - get size() { - return this.root.size; - } // Returns the minimum key in the map. - - - minKey() { - return this.root.minKey(); - } // Returns the maximum key in the map. - - - maxKey() { - return this.root.maxKey(); - } // Traverses the map in key order and calls the specified action function - // for each key/value pair. If action returns true, traversal is aborted. - // Returns the first truthy value returned by action, or the last falsey - // value returned by action. - - - inorderTraversal(t) { - return this.root.inorderTraversal(t); - } - - forEach(t) { - this.inorderTraversal((e, n) => (t(e, n), !1)); - } - - toString() { - const t = []; - return this.inorderTraversal((e, n) => (t.push(`${e}:${n}`), !1)), `{${t.join(", ")}}`; - } // Traverses the map in reverse key order and calls the specified action - // function for each key/value pair. If action returns true, traversal is - // aborted. - // Returns the first truthy value returned by action, or the last falsey - // value returned by action. - - - reverseTraversal(t) { - return this.root.reverseTraversal(t); - } // Returns an iterator over the SortedMap. - - - getIterator() { - return new Qt(this.root, null, this.comparator, !1); - } - - getIteratorFrom(t) { - return new Qt(this.root, t, this.comparator, !1); - } - - getReverseIterator() { - return new Qt(this.root, null, this.comparator, !0); - } - - getReverseIteratorFrom(t) { - return new Qt(this.root, t, this.comparator, !0); - } - -} // end SortedMap -// An iterator over an LLRBNode. - - -class Qt { - constructor(t, e, n, s) { - this.isReverse = s, this.nodeStack = []; - let i = 1; - - for (; !t.isEmpty();) if (i = e ? n(t.key, e) : 1, // flip the comparison if we're going in reverse - e && s && (i *= -1), i < 0) // This node is less than our start key. ignore it - t = this.isReverse ? t.left : t.right;else { - if (0 === i) { - // This node is exactly equal to our start key. Push it on the stack, - // but stop iterating; - this.nodeStack.push(t); - break; - } // This node is greater than our start key, add it to the stack and move - // to the next one - - - this.nodeStack.push(t), t = this.isReverse ? t.right : t.left; - } - } - - getNext() { - let t = this.nodeStack.pop(); - const e = { - key: t.key, - value: t.value - }; - if (this.isReverse) for (t = t.left; !t.isEmpty();) this.nodeStack.push(t), t = t.right;else for (t = t.right; !t.isEmpty();) this.nodeStack.push(t), t = t.left; - return e; - } - - hasNext() { - return this.nodeStack.length > 0; - } - - peek() { - if (0 === this.nodeStack.length) return null; - const t = this.nodeStack[this.nodeStack.length - 1]; - return { - key: t.key, - value: t.value - }; - } - -} // end SortedMapIterator -// Represents a node in a Left-leaning Red-Black tree. - - -class jt { - constructor(t, e, n, s, i) { - this.key = t, this.value = e, this.color = null != n ? n : jt.RED, this.left = null != s ? s : jt.EMPTY, this.right = null != i ? i : jt.EMPTY, this.size = this.left.size + 1 + this.right.size; - } // Returns a copy of the current node, optionally replacing pieces of it. - - - copy(t, e, n, s, i) { - return new jt(null != t ? t : this.key, null != e ? e : this.value, null != n ? n : this.color, null != s ? s : this.left, null != i ? i : this.right); - } - - isEmpty() { - return !1; - } // Traverses the tree in key order and calls the specified action function - // for each node. If action returns true, traversal is aborted. - // Returns the first truthy value returned by action, or the last falsey - // value returned by action. - - - inorderTraversal(t) { - return this.left.inorderTraversal(t) || t(this.key, this.value) || this.right.inorderTraversal(t); - } // Traverses the tree in reverse key order and calls the specified action - // function for each node. If action returns true, traversal is aborted. - // Returns the first truthy value returned by action, or the last falsey - // value returned by action. - - - reverseTraversal(t) { - return this.right.reverseTraversal(t) || t(this.key, this.value) || this.left.reverseTraversal(t); - } // Returns the minimum node in the tree. - - - min() { - return this.left.isEmpty() ? this : this.left.min(); - } // Returns the maximum key in the tree. - - - minKey() { - return this.min().key; - } // Returns the maximum key in the tree. - - - maxKey() { - return this.right.isEmpty() ? this.key : this.right.maxKey(); - } // Returns new tree, with the key/value added. - - - insert(t, e, n) { - let s = this; - const i = n(t, s.key); - return s = i < 0 ? s.copy(null, null, null, s.left.insert(t, e, n), null) : 0 === i ? s.copy(null, e, null, null, null) : s.copy(null, null, null, null, s.right.insert(t, e, n)), s.fixUp(); - } - - removeMin() { - if (this.left.isEmpty()) return jt.EMPTY; - let t = this; - return t.left.isRed() || t.left.left.isRed() || (t = t.moveRedLeft()), t = t.copy(null, null, null, t.left.removeMin(), null), t.fixUp(); - } // Returns new tree, with the specified item removed. - - - remove(t, e) { - let n, - s = this; - if (e(t, s.key) < 0) s.left.isEmpty() || s.left.isRed() || s.left.left.isRed() || (s = s.moveRedLeft()), s = s.copy(null, null, null, s.left.remove(t, e), null);else { - if (s.left.isRed() && (s = s.rotateRight()), s.right.isEmpty() || s.right.isRed() || s.right.left.isRed() || (s = s.moveRedRight()), 0 === e(t, s.key)) { - if (s.right.isEmpty()) return jt.EMPTY; - n = s.right.min(), s = s.copy(n.key, n.value, null, null, s.right.removeMin()); - } - - s = s.copy(null, null, null, null, s.right.remove(t, e)); - } - return s.fixUp(); - } - - isRed() { - return this.color; - } // Returns new tree after performing any needed rotations. - - - fixUp() { - let t = this; - return t.right.isRed() && !t.left.isRed() && (t = t.rotateLeft()), t.left.isRed() && t.left.left.isRed() && (t = t.rotateRight()), t.left.isRed() && t.right.isRed() && (t = t.colorFlip()), t; - } - - moveRedLeft() { - let t = this.colorFlip(); - return t.right.left.isRed() && (t = t.copy(null, null, null, null, t.right.rotateRight()), t = t.rotateLeft(), t = t.colorFlip()), t; - } - - moveRedRight() { - let t = this.colorFlip(); - return t.left.left.isRed() && (t = t.rotateRight(), t = t.colorFlip()), t; - } - - rotateLeft() { - const t = this.copy(null, null, jt.RED, null, this.right.left); - return this.right.copy(null, null, this.color, t, null); - } - - rotateRight() { - const t = this.copy(null, null, jt.RED, this.left.right, null); - return this.left.copy(null, null, this.color, null, t); - } - - colorFlip() { - const t = this.left.copy(null, null, !this.left.color, null, null), - e = this.right.copy(null, null, !this.right.color, null, null); - return this.copy(null, null, !this.color, t, e); - } // For testing. - - - checkMaxDepth() { - const t = this.check(); - return Math.pow(2, t) <= this.size + 1; - } // In a balanced RB tree, the black-depth (number of black nodes) from root to - // leaves is equal on both sides. This function verifies that or asserts. - - - check() { - if (this.isRed() && this.left.isRed()) throw L(); - if (this.right.isRed()) throw L(); - const t = this.left.check(); - if (t !== this.right.check()) throw L(); - return t + (this.isRed() ? 0 : 1); - } - -} // end LLRBNode -// Empty node is shared between all LLRB trees. -// eslint-disable-next-line @typescript-eslint/no-explicit-any - - -jt.EMPTY = null, jt.RED = !0, jt.BLACK = !1; // end LLRBEmptyNode - -jt.EMPTY = new // Represents an empty node (a leaf node in the Red-Black Tree). -class { - constructor() { - this.size = 0; - } - - get key() { - throw L(); - } - - get value() { - throw L(); - } - - get color() { - throw L(); - } - - get left() { - throw L(); - } - - get right() { - throw L(); - } // Returns a copy of the current node. - - - copy(t, e, n, s, i) { - return this; - } // Returns a copy of the tree, with the specified key/value added. - - - insert(t, e, n) { - return new jt(t, e); - } // Returns a copy of the tree, with the specified key removed. - - - remove(t, e) { - return this; - } - - isEmpty() { - return !0; - } - - inorderTraversal(t) { - return !1; - } - - reverseTraversal(t) { - return !1; - } - - minKey() { - return null; - } - - maxKey() { - return null; - } - - isRed() { - return !1; - } // For testing. - - - checkMaxDepth() { - return !0; - } - - check() { - return 0; - } - -}(); -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * SortedSet is an immutable (copy-on-write) collection that holds elements - * in order specified by the provided comparator. - * - * NOTE: if provided comparator returns 0 for two elements, we consider them to - * be equal! - */ - -class Wt { - constructor(t) { - this.comparator = t, this.data = new Gt(this.comparator); - } - - has(t) { - return null !== this.data.get(t); - } - - first() { - return this.data.minKey(); - } - - last() { - return this.data.maxKey(); - } - - get size() { - return this.data.size; - } - - indexOf(t) { - return this.data.indexOf(t); - } - /** Iterates elements in order defined by "comparator" */ - - - forEach(t) { - this.data.inorderTraversal((e, n) => (t(e), !1)); - } - /** Iterates over `elem`s such that: range[0] <= elem < range[1]. */ - - - forEachInRange(t, e) { - const n = this.data.getIteratorFrom(t[0]); - - for (; n.hasNext();) { - const s = n.getNext(); - if (this.comparator(s.key, t[1]) >= 0) return; - e(s.key); - } - } - /** - * Iterates over `elem`s such that: start <= elem until false is returned. - */ - - - forEachWhile(t, e) { - let n; - - for (n = void 0 !== e ? this.data.getIteratorFrom(e) : this.data.getIterator(); n.hasNext();) { - if (!t(n.getNext().key)) return; - } - } - /** Finds the least element greater than or equal to `elem`. */ - - - firstAfterOrEqual(t) { - const e = this.data.getIteratorFrom(t); - return e.hasNext() ? e.getNext().key : null; - } - - getIterator() { - return new zt(this.data.getIterator()); - } - - getIteratorFrom(t) { - return new zt(this.data.getIteratorFrom(t)); - } - /** Inserts or updates an element */ - - - add(t) { - return this.copy(this.data.remove(t).insert(t, !0)); - } - /** Deletes an element */ - - - delete(t) { - return this.has(t) ? this.copy(this.data.remove(t)) : this; - } - - isEmpty() { - return this.data.isEmpty(); - } - - unionWith(t) { - let e = this; // Make sure `result` always refers to the larger one of the two sets. - - return e.size < t.size && (e = t, t = this), t.forEach(t => { - e = e.add(t); - }), e; - } - - isEqual(t) { - if (!(t instanceof Wt)) return !1; - if (this.size !== t.size) return !1; - const e = this.data.getIterator(), - n = t.data.getIterator(); - - for (; e.hasNext();) { - const t = e.getNext().key, - s = n.getNext().key; - if (0 !== this.comparator(t, s)) return !1; - } - - return !0; - } - - toArray() { - const t = []; - return this.forEach(e => { - t.push(e); - }), t; - } - - toString() { - const t = []; - return this.forEach(e => t.push(e)), "SortedSet(" + t.toString() + ")"; - } - - copy(t) { - const e = new Wt(this.comparator); - return e.data = t, e; - } - -} - -class zt { - constructor(t) { - this.iter = t; - } - - getNext() { - return this.iter.getNext().key; - } - - hasNext() { - return this.iter.hasNext(); - } - -} -/** - * Compares two sorted sets for equality using their natural ordering. The - * method computes the intersection and invokes `onAdd` for every element that - * is in `after` but not `before`. `onRemove` is invoked for every element in - * `before` but missing from `after`. - * - * The method creates a copy of both `before` and `after` and runs in O(n log - * n), where n is the size of the two lists. - * - * @param before - The elements that exist in the original set. - * @param after - The elements to diff against the original set. - * @param comparator - The comparator for the elements in before and after. - * @param onAdd - A function to invoke for every element that is part of ` - * after` but not `before`. - * @param onRemove - A function to invoke for every element that is part of - * `before` but not `after`. - */ - -/** - * Returns the next element from the iterator or `undefined` if none available. - */ - - -function Ht(t) { - return t.hasNext() ? t.getNext() : void 0; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Provides a set of fields that can be used to partially patch a document. - * FieldMask is used in conjunction with ObjectValue. - * Examples: - * foo - Overwrites foo entirely with the provided value. If foo is not - * present in the companion ObjectValue, the field is deleted. - * foo.bar - Overwrites only the field bar of the object foo. - * If foo is not an object, foo is replaced with an object - * containing foo - */ - - -class Jt { - constructor(t) { - this.fields = t, // TODO(dimond): validation of FieldMask - // Sort the field mask to support `FieldMask.isEqual()` and assert below. - t.sort(ft.comparator); - } - - static empty() { - return new Jt([]); - } - /** - * Returns a new FieldMask object that is the result of adding all the given - * fields paths to this field mask. - */ - - - unionWith(t) { - let e = new Wt(ft.comparator); - - for (const t of this.fields) e = e.add(t); - - for (const n of t) e = e.add(n); - - return new Jt(e.toArray()); - } - /** - * Verifies that `fieldPath` is included by at least one field in this field - * mask. - * - * This is an O(n) operation, where `n` is the size of the field mask. - */ - - - covers(t) { - for (const e of this.fields) if (e.isPrefixOf(t)) return !0; - - return !1; - } - - isEqual(t) { - return rt(this.fields, t.fields, (t, e) => t.isEqual(e)); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** Converts a Base64 encoded string to a binary string. */ - -/** True if and only if the Base64 conversion functions are available. */ - - -function Yt() { - return "undefined" != typeof atob; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Immutable class that represents a "proto" byte string. - * - * Proto byte strings can either be Base64-encoded strings or Uint8Arrays when - * sent on the wire. This class abstracts away this differentiation by holding - * the proto byte string in a common class that must be converted into a string - * before being sent as a proto. - * @internal - */ - - -class Xt { - constructor(t) { - this.binaryString = t; - } - - static fromBase64String(t) { - const e = atob(t); - return new Xt(e); - } - - static fromUint8Array(t) { - // TODO(indexing); Remove the copy of the byte string here as this method - // is frequently called during indexing. - const e = - /** - * Helper function to convert an Uint8array to a binary string. - */ - function (t) { - let e = ""; - - for (let n = 0; n < t.length; ++n) e += String.fromCharCode(t[n]); - - return e; - } - /** - * Helper function to convert a binary string to an Uint8Array. - */ - (t); - - return new Xt(e); - } - - [Symbol.iterator]() { - let t = 0; - return { - next: () => t < this.binaryString.length ? { - value: this.binaryString.charCodeAt(t++), - done: !1 - } : { - value: void 0, - done: !0 - } - }; - } - - toBase64() { - return t = this.binaryString, btoa(t); - /** Converts a binary string to a Base64 encoded string. */ - - var t; - } - - toUint8Array() { - return function (t) { - const e = new Uint8Array(t.length); - - for (let n = 0; n < t.length; n++) e[n] = t.charCodeAt(n); - - return e; - } - /** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - // A RegExp matching ISO 8601 UTC timestamps with optional fraction. - (this.binaryString); - } - - approximateByteSize() { - return 2 * this.binaryString.length; - } - - compareTo(t) { - return it(this.binaryString, t.binaryString); - } - - isEqual(t) { - return this.binaryString === t.binaryString; - } - -} - -Xt.EMPTY_BYTE_STRING = new Xt(""); -const Zt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/); -/** - * Converts the possible Proto values for a timestamp value into a "seconds and - * nanos" representation. - */ - -function te(t) { - // The json interface (for the browser) will return an iso timestamp string, - // while the proto js library (for node) will return a - // google.protobuf.Timestamp instance. - if (U(!!t), "string" == typeof t) { - // The date string can have higher precision (nanos) than the Date class - // (millis), so we do some custom parsing here. - // Parse the nanos right out of the string. - let e = 0; - const n = Zt.exec(t); - - if (U(!!n), n[1]) { - // Pad the fraction out to 9 digits (nanos). - let t = n[1]; - t = (t + "000000000").substr(0, 9), e = Number(t); - } // Parse the date to get the seconds. - - - const s = new Date(t); - return { - seconds: Math.floor(s.getTime() / 1e3), - nanos: e - }; - } - - return { - seconds: ee(t.seconds), - nanos: ee(t.nanos) - }; -} -/** - * Converts the possible Proto types for numbers into a JavaScript number. - * Returns 0 if the value is not numeric. - */ - - -function ee(t) { - // TODO(bjornick): Handle int64 greater than 53 bits. - return "number" == typeof t ? t : "string" == typeof t ? Number(t) : 0; -} -/** Converts the possible Proto types for Blobs into a ByteString. */ - - -function ne(t) { - return "string" == typeof t ? Xt.fromBase64String(t) : Xt.fromUint8Array(t); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Represents a locally-applied ServerTimestamp. - * - * Server Timestamps are backed by MapValues that contain an internal field - * `__type__` with a value of `server_timestamp`. The previous value and local - * write time are stored in its `__previous_value__` and `__local_write_time__` - * fields respectively. - * - * Notes: - * - ServerTimestampValue instances are created as the result of applying a - * transform. They can only exist in the local view of a document. Therefore - * they do not need to be parsed or serialized. - * - When evaluated locally (e.g. for snapshot.data()), they by default - * evaluate to `null`. This behavior can be configured by passing custom - * FieldValueOptions to value(). - * - With respect to other ServerTimestampValues, they sort by their - * localWriteTime. - */ - - -function se(t) { - var e, n; - return "server_timestamp" === (null === (n = ((null === (e = null == t ? void 0 : t.mapValue) || void 0 === e ? void 0 : e.fields) || {}).__type__) || void 0 === n ? void 0 : n.stringValue); -} -/** - * Creates a new ServerTimestamp proto value (using the internal format). - */ - -/** - * Returns the value of the field before this ServerTimestamp was set. - * - * Preserving the previous values allows the user to display the last resoled - * value until the backend responds with the timestamp. - */ - - -function ie(t) { - const e = t.mapValue.fields.__previous_value__; - return se(e) ? ie(e) : e; -} -/** - * Returns the local time at which this timestamp was first set. - */ - - -function re(t) { - const e = te(t.mapValue.fields.__local_write_time__.timestampValue); - return new ut(e.seconds, e.nanos); -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class oe { - /** - * Constructs a DatabaseInfo using the provided host, databaseId and - * persistenceKey. - * - * @param databaseId - The database to use. - * @param appId - The Firebase App Id. - * @param persistenceKey - A unique identifier for this Firestore's local - * storage (used in conjunction with the databaseId). - * @param host - The Firestore backend host to connect to. - * @param ssl - Whether to use SSL when connecting. - * @param forceLongPolling - Whether to use the forceLongPolling option - * when using WebChannel as the network transport. - * @param autoDetectLongPolling - Whether to use the detectBufferingProxy - * option when using WebChannel as the network transport. - * @param useFetchStreams Whether to use the Fetch API instead of - * XMLHTTPRequest - */ - constructor(t, e, n, s, i, r, o, u) { - this.databaseId = t, this.appId = e, this.persistenceKey = n, this.host = s, this.ssl = i, this.forceLongPolling = r, this.autoDetectLongPolling = o, this.useFetchStreams = u; - } - -} -/** The default database name for a project. */ - -/** - * Represents the database ID a Firestore client is associated with. - * @internal - */ - - -class ue { - constructor(t, e) { - this.projectId = t, this.database = e || "(default)"; - } - - static empty() { - return new ue("", ""); - } - - get isDefaultDatabase() { - return "(default)" === this.database; - } - - isEqual(t) { - return t instanceof ue && t.projectId === this.projectId && t.database === this.database; - } - -} -/** - * Returns whether a variable is either undefined or null. - */ - - -function ce(t) { - return null == t; -} -/** Returns whether the value represents -0. */ - - -function ae(t) { - // Detect if the value is -0.0. Based on polyfill from - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - return 0 === t && 1 / t == -1 / 0; -} -/** - * Returns whether a value is an integer and in the safe integer range - * @param value - The value to test for being an integer and in the safe range - */ - - -function he(t) { - return "number" == typeof t && Number.isInteger(t) && !ae(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const le = { - mapValue: { - fields: { - __type__: { - stringValue: "__max__" - } - } - } -}, - fe = { - nullValue: "NULL_VALUE" -}; -/** Extracts the backend's type order for the provided value. */ - -function de(t) { - return "nullValue" in t ? 0 - /* NullValue */ - : "booleanValue" in t ? 1 - /* BooleanValue */ - : "integerValue" in t || "doubleValue" in t ? 2 - /* NumberValue */ - : "timestampValue" in t ? 3 - /* TimestampValue */ - : "stringValue" in t ? 5 - /* StringValue */ - : "bytesValue" in t ? 6 - /* BlobValue */ - : "referenceValue" in t ? 7 - /* RefValue */ - : "geoPointValue" in t ? 8 - /* GeoPointValue */ - : "arrayValue" in t ? 9 - /* ArrayValue */ - : "mapValue" in t ? se(t) ? 4 - /* ServerTimestampValue */ - : ve(t) ? 9007199254740991 - /* MaxValue */ - : 10 - /* ObjectValue */ - : L(); -} -/** Tests `left` and `right` for equality based on the backend semantics. */ - - -function _e(t, e) { - if (t === e) return !0; - const n = de(t); - if (n !== de(e)) return !1; - - switch (n) { - case 0 - /* NullValue */ - : - case 9007199254740991 - /* MaxValue */ - : - return !0; - - case 1 - /* BooleanValue */ - : - return t.booleanValue === e.booleanValue; - - case 4 - /* ServerTimestampValue */ - : - return re(t).isEqual(re(e)); - - case 3 - /* TimestampValue */ - : - return function (t, e) { - if ("string" == typeof t.timestampValue && "string" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length) // Use string equality for ISO 8601 timestamps - return t.timestampValue === e.timestampValue; - const n = te(t.timestampValue), - s = te(e.timestampValue); - return n.seconds === s.seconds && n.nanos === s.nanos; - }(t, e); - - case 5 - /* StringValue */ - : - return t.stringValue === e.stringValue; - - case 6 - /* BlobValue */ - : - return function (t, e) { - return ne(t.bytesValue).isEqual(ne(e.bytesValue)); - }(t, e); - - case 7 - /* RefValue */ - : - return t.referenceValue === e.referenceValue; - - case 8 - /* GeoPointValue */ - : - return function (t, e) { - return ee(t.geoPointValue.latitude) === ee(e.geoPointValue.latitude) && ee(t.geoPointValue.longitude) === ee(e.geoPointValue.longitude); - }(t, e); - - case 2 - /* NumberValue */ - : - return function (t, e) { - if ("integerValue" in t && "integerValue" in e) return ee(t.integerValue) === ee(e.integerValue); - - if ("doubleValue" in t && "doubleValue" in e) { - const n = ee(t.doubleValue), - s = ee(e.doubleValue); - return n === s ? ae(n) === ae(s) : isNaN(n) && isNaN(s); - } - - return !1; - }(t, e); - - case 9 - /* ArrayValue */ - : - return rt(t.arrayValue.values || [], e.arrayValue.values || [], _e); - - case 10 - /* ObjectValue */ - : - return function (t, e) { - const n = t.mapValue.fields || {}, - s = e.mapValue.fields || {}; - if (Ut(n) !== Ut(s)) return !1; - - for (const t in n) if (n.hasOwnProperty(t) && (void 0 === s[t] || !_e(n[t], s[t]))) return !1; - - return !0; - } - /** Returns true if the ArrayValue contains the specified element. */ - (t, e); - - default: - return L(); - } -} - -function we(t, e) { - return void 0 !== (t.values || []).find(t => _e(t, e)); -} - -function me(t, e) { - if (t === e) return 0; - const n = de(t), - s = de(e); - if (n !== s) return it(n, s); - - switch (n) { - case 0 - /* NullValue */ - : - case 9007199254740991 - /* MaxValue */ - : - return 0; - - case 1 - /* BooleanValue */ - : - return it(t.booleanValue, e.booleanValue); - - case 2 - /* NumberValue */ - : - return function (t, e) { - const n = ee(t.integerValue || t.doubleValue), - s = ee(e.integerValue || e.doubleValue); - return n < s ? -1 : n > s ? 1 : n === s ? 0 : // one or both are NaN. - isNaN(n) ? isNaN(s) ? 0 : -1 : 1; - }(t, e); - - case 3 - /* TimestampValue */ - : - return ge(t.timestampValue, e.timestampValue); - - case 4 - /* ServerTimestampValue */ - : - return ge(re(t), re(e)); - - case 5 - /* StringValue */ - : - return it(t.stringValue, e.stringValue); - - case 6 - /* BlobValue */ - : - return function (t, e) { - const n = ne(t), - s = ne(e); - return n.compareTo(s); - }(t.bytesValue, e.bytesValue); - - case 7 - /* RefValue */ - : - return function (t, e) { - const n = t.split("/"), - s = e.split("/"); - - for (let t = 0; t < n.length && t < s.length; t++) { - const e = it(n[t], s[t]); - if (0 !== e) return e; - } - - return it(n.length, s.length); - }(t.referenceValue, e.referenceValue); - - case 8 - /* GeoPointValue */ - : - return function (t, e) { - const n = it(ee(t.latitude), ee(e.latitude)); - if (0 !== n) return n; - return it(ee(t.longitude), ee(e.longitude)); - }(t.geoPointValue, e.geoPointValue); - - case 9 - /* ArrayValue */ - : - return function (t, e) { - const n = t.values || [], - s = e.values || []; - - for (let t = 0; t < n.length && t < s.length; ++t) { - const e = me(n[t], s[t]); - if (e) return e; - } - - return it(n.length, s.length); - }(t.arrayValue, e.arrayValue); - - case 10 - /* ObjectValue */ - : - return function (t, e) { - if (t === le.mapValue && e === le.mapValue) return 0; - if (t === le.mapValue) return 1; - if (e === le.mapValue) return -1; - const n = t.fields || {}, - s = Object.keys(n), - i = e.fields || {}, - r = Object.keys(i); // Even though MapValues are likely sorted correctly based on their insertion - // order (e.g. when received from the backend), local modifications can bring - // elements out of order. We need to re-sort the elements to ensure that - // canonical IDs are independent of insertion order. - - s.sort(), r.sort(); - - for (let t = 0; t < s.length && t < r.length; ++t) { - const e = it(s[t], r[t]); - if (0 !== e) return e; - const o = me(n[s[t]], i[r[t]]); - if (0 !== o) return o; - } - - return it(s.length, r.length); - } - /** - * Generates the canonical ID for the provided field value (as used in Target - * serialization). - */ - (t.mapValue, e.mapValue); - - default: - throw L(); - } -} - -function ge(t, e) { - if ("string" == typeof t && "string" == typeof e && t.length === e.length) return it(t, e); - const n = te(t), - s = te(e), - i = it(n.seconds, s.seconds); - return 0 !== i ? i : it(n.nanos, s.nanos); -} - -function ye(t) { - return pe(t); -} - -function pe(t) { - return "nullValue" in t ? "null" : "booleanValue" in t ? "" + t.booleanValue : "integerValue" in t ? "" + t.integerValue : "doubleValue" in t ? "" + t.doubleValue : "timestampValue" in t ? function (t) { - const e = te(t); - return `time(${e.seconds},${e.nanos})`; - }(t.timestampValue) : "stringValue" in t ? t.stringValue : "bytesValue" in t ? ne(t.bytesValue).toBase64() : "referenceValue" in t ? (n = t.referenceValue, dt.fromName(n).toString()) : "geoPointValue" in t ? `geo(${(e = t.geoPointValue).latitude},${e.longitude})` : "arrayValue" in t ? function (t) { - let e = "[", - n = !0; - - for (const s of t.values || []) n ? n = !1 : e += ",", e += pe(s); - - return e + "]"; - } - /** Returns a reference value for the provided database and key. */ - (t.arrayValue) : "mapValue" in t ? function (t) { - // Iteration order in JavaScript is not guaranteed. To ensure that we generate - // matching canonical IDs for identical maps, we need to sort the keys. - const e = Object.keys(t.fields || {}).sort(); - let n = "{", - s = !0; - - for (const i of e) s ? s = !1 : n += ",", n += `${i}:${pe(t.fields[i])}`; - - return n + "}"; - }(t.mapValue) : L(); - var e, n; -} - -function Ie(t, e) { - return { - referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}` - }; -} -/** Returns true if `value` is an IntegerValue . */ - - -function Te(t) { - return !!t && "integerValue" in t; -} -/** Returns true if `value` is a DoubleValue. */ - -/** Returns true if `value` is an ArrayValue. */ - - -function Ee(t) { - return !!t && "arrayValue" in t; -} -/** Returns true if `value` is a NullValue. */ - - -function Ae(t) { - return !!t && "nullValue" in t; -} -/** Returns true if `value` is NaN. */ - - -function Re(t) { - return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue)); -} -/** Returns true if `value` is a MapValue. */ - - -function be(t) { - return !!t && "mapValue" in t; -} -/** Creates a deep copy of `source`. */ - - -function Pe(t) { - if (t.geoPointValue) return { - geoPointValue: Object.assign({}, t.geoPointValue) - }; - if (t.timestampValue && "object" == typeof t.timestampValue) return { - timestampValue: Object.assign({}, t.timestampValue) - }; - - if (t.mapValue) { - const e = { - mapValue: { - fields: {} - } - }; - return qt(t.mapValue.fields, (t, n) => e.mapValue.fields[t] = Pe(n)), e; - } - - if (t.arrayValue) { - const e = { - arrayValue: { - values: [] - } - }; - - for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] = Pe(t.arrayValue.values[n]); - - return e; - } - - return Object.assign({}, t); -} -/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */ - - -function ve(t) { - return "__max__" === (((t.mapValue || {}).fields || {}).__type__ || {}).stringValue; -} -/** Returns the lowest value for the given value type (inclusive). */ - - -function Ve(t) { - return "nullValue" in t ? fe : "booleanValue" in t ? { - booleanValue: !1 - } : "integerValue" in t || "doubleValue" in t ? { - doubleValue: NaN - } : "timestampValue" in t ? { - timestampValue: { - seconds: Number.MIN_SAFE_INTEGER - } - } : "stringValue" in t ? { - stringValue: "" - } : "bytesValue" in t ? { - bytesValue: "" - } : "referenceValue" in t ? Ie(ue.empty(), dt.empty()) : "geoPointValue" in t ? { - geoPointValue: { - latitude: -90, - longitude: -180 - } - } : "arrayValue" in t ? { - arrayValue: {} - } : "mapValue" in t ? { - mapValue: {} - } : L(); -} -/** Returns the largest value for the given value type (exclusive). */ - - -function Se(t) { - return "nullValue" in t ? { - booleanValue: !1 - } : "booleanValue" in t ? { - doubleValue: NaN - } : "integerValue" in t || "doubleValue" in t ? { - timestampValue: { - seconds: Number.MIN_SAFE_INTEGER - } - } : "timestampValue" in t ? { - stringValue: "" - } : "stringValue" in t ? { - bytesValue: "" - } : "bytesValue" in t ? Ie(ue.empty(), dt.empty()) : "referenceValue" in t ? { - geoPointValue: { - latitude: -90, - longitude: -180 - } - } : "geoPointValue" in t ? { - arrayValue: {} - } : "arrayValue" in t ? { - mapValue: {} - } : "mapValue" in t ? le : L(); -} - -function De(t, e) { - const n = me(t.value, e.value); - return 0 !== n ? n : t.inclusive && !e.inclusive ? -1 : !t.inclusive && e.inclusive ? 1 : 0; -} - -function Ce(t, e) { - const n = me(t.value, e.value); - return 0 !== n ? n : t.inclusive && !e.inclusive ? 1 : !t.inclusive && e.inclusive ? -1 : 0; -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * An ObjectValue represents a MapValue in the Firestore Proto and offers the - * ability to add and remove fields (via the ObjectValueBuilder). - */ - - -class xe { - constructor(t) { - this.value = t; - } - - static empty() { - return new xe({ - mapValue: {} - }); - } - /** - * Returns the value at the given path or null. - * - * @param path - the path to search - * @returns The value at the path or null if the path is not set. - */ - - - field(t) { - if (t.isEmpty()) return this.value; - { - let e = this.value; - - for (let n = 0; n < t.length - 1; ++n) if (e = (e.mapValue.fields || {})[t.get(n)], !be(e)) return null; - - return e = (e.mapValue.fields || {})[t.lastSegment()], e || null; - } - } - /** - * Sets the field to the provided value. - * - * @param path - The field path to set. - * @param value - The value to set. - */ - - - set(t, e) { - this.getFieldsMap(t.popLast())[t.lastSegment()] = Pe(e); - } - /** - * Sets the provided fields to the provided values. - * - * @param data - A map of fields to values (or null for deletes). - */ - - - setAll(t) { - let e = ft.emptyPath(), - n = {}, - s = []; - t.forEach((t, i) => { - if (!e.isImmediateParentOf(i)) { - // Insert the accumulated changes at this parent location - const t = this.getFieldsMap(e); - this.applyChanges(t, n, s), n = {}, s = [], e = i.popLast(); - } - - t ? n[i.lastSegment()] = Pe(t) : s.push(i.lastSegment()); - }); - const i = this.getFieldsMap(e); - this.applyChanges(i, n, s); - } - /** - * Removes the field at the specified path. If there is no field at the - * specified path, nothing is changed. - * - * @param path - The field path to remove. - */ - - - delete(t) { - const e = this.field(t.popLast()); - be(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()]; - } - - isEqual(t) { - return _e(this.value, t.value); - } - /** - * Returns the map that contains the leaf element of `path`. If the parent - * entry does not yet exist, or if it is not a map, a new map will be created. - */ - - - getFieldsMap(t) { - let e = this.value; - e.mapValue.fields || (e.mapValue = { - fields: {} - }); - - for (let n = 0; n < t.length; ++n) { - let s = e.mapValue.fields[t.get(n)]; - be(s) && s.mapValue.fields || (s = { - mapValue: { - fields: {} - } - }, e.mapValue.fields[t.get(n)] = s), e = s; - } - - return e.mapValue.fields; - } - /** - * Modifies `fieldsMap` by adding, replacing or deleting the specified - * entries. - */ - - - applyChanges(t, e, n) { - qt(e, (e, n) => t[e] = n); - - for (const e of n) delete t[e]; - } - - clone() { - return new xe(Pe(this.value)); - } - -} -/** - * Returns a FieldMask built from all fields in a MapValue. - */ - - -function Ne(t) { - const e = []; - return qt(t.fields, (t, n) => { - const s = new ft([t]); - - if (be(n)) { - const t = Ne(n.mapValue).fields; - if (0 === t.length) // Preserve the empty map by adding it to the FieldMask. - e.push(s);else // For nested and non-empty ObjectValues, add the FieldPath of the - // leaf nodes. - for (const n of t) e.push(s.child(n)); - } else // For nested and non-empty ObjectValues, add the FieldPath of the leaf - // nodes. - e.push(s); - }), new Jt(e); -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Represents a document in Firestore with a key, version, data and whether it - * has local mutations applied to it. - * - * Documents can transition between states via `convertToFoundDocument()`, - * `convertToNoDocument()` and `convertToUnknownDocument()`. If a document does - * not transition to one of these states even after all mutations have been - * applied, `isValidDocument()` returns false and the document should be removed - * from all views. - */ - - -class ke { - constructor(t, e, n, s, i, r) { - this.key = t, this.documentType = e, this.version = n, this.readTime = s, this.data = i, this.documentState = r; - } - /** - * Creates a document with no known version or data, but which can serve as - * base document for mutations. - */ - - - static newInvalidDocument(t) { - return new ke(t, 0 - /* INVALID */ - , ct.min(), ct.min(), xe.empty(), 0 - /* SYNCED */ - ); - } - /** - * Creates a new document that is known to exist with the given data at the - * given version. - */ - - - static newFoundDocument(t, e, n) { - return new ke(t, 1 - /* FOUND_DOCUMENT */ - , e, ct.min(), n, 0 - /* SYNCED */ - ); - } - /** Creates a new document that is known to not exist at the given version. */ - - - static newNoDocument(t, e) { - return new ke(t, 2 - /* NO_DOCUMENT */ - , e, ct.min(), xe.empty(), 0 - /* SYNCED */ - ); - } - /** - * Creates a new document that is known to exist at the given version but - * whose data is not known (e.g. a document that was updated without a known - * base document). - */ - - - static newUnknownDocument(t, e) { - return new ke(t, 3 - /* UNKNOWN_DOCUMENT */ - , e, ct.min(), xe.empty(), 2 - /* HAS_COMMITTED_MUTATIONS */ - ); - } - /** - * Changes the document type to indicate that it exists and that its version - * and data are known. - */ - - - convertToFoundDocument(t, e) { - return this.version = t, this.documentType = 1 - /* FOUND_DOCUMENT */ - , this.data = e, this.documentState = 0 - /* SYNCED */ - , this; - } - /** - * Changes the document type to indicate that it doesn't exist at the given - * version. - */ - - - convertToNoDocument(t) { - return this.version = t, this.documentType = 2 - /* NO_DOCUMENT */ - , this.data = xe.empty(), this.documentState = 0 - /* SYNCED */ - , this; - } - /** - * Changes the document type to indicate that it exists at a given version but - * that its data is not known (e.g. a document that was updated without a known - * base document). - */ - - - convertToUnknownDocument(t) { - return this.version = t, this.documentType = 3 - /* UNKNOWN_DOCUMENT */ - , this.data = xe.empty(), this.documentState = 2 - /* HAS_COMMITTED_MUTATIONS */ - , this; - } - - setHasCommittedMutations() { - return this.documentState = 2 - /* HAS_COMMITTED_MUTATIONS */ - , this; - } - - setHasLocalMutations() { - return this.documentState = 1 - /* HAS_LOCAL_MUTATIONS */ - , this.version = ct.min(), this; - } - - setReadTime(t) { - return this.readTime = t, this; - } - - get hasLocalMutations() { - return 1 - /* HAS_LOCAL_MUTATIONS */ - === this.documentState; - } - - get hasCommittedMutations() { - return 2 - /* HAS_COMMITTED_MUTATIONS */ - === this.documentState; - } - - get hasPendingWrites() { - return this.hasLocalMutations || this.hasCommittedMutations; - } - - isValidDocument() { - return 0 - /* INVALID */ - !== this.documentType; - } - - isFoundDocument() { - return 1 - /* FOUND_DOCUMENT */ - === this.documentType; - } - - isNoDocument() { - return 2 - /* NO_DOCUMENT */ - === this.documentType; - } - - isUnknownDocument() { - return 3 - /* UNKNOWN_DOCUMENT */ - === this.documentType; - } - - isEqual(t) { - return t instanceof ke && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data); - } - - mutableCopy() { - return new ke(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState); - } - - toString() { - return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`; - } - -} -/** - * Compares the value for field `field` in the provided documents. Throws if - * the field does not exist in both documents. - */ - -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Visible for testing - - -class Me { - constructor(t) { - let e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - let n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; - let s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; - let i = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null; - let r = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null; - let o = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null; - this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = s, this.limit = i, this.startAt = r, this.endAt = o, this.ht = null; - } - -} -/** - * Initializes a Target with a path and optional additional query constraints. - * Path must currently be empty if this is a collection group query. - * - * NOTE: you should always construct `Target` from `Query.toTarget` instead of - * using this factory method, because `Query` provides an implicit `orderBy` - * property. - */ - - -function Oe(t) { - let e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - let n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; - let s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; - let i = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null; - let r = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null; - let o = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null; - return new Me(t, e, n, s, i, r, o); -} - -function Fe(t) { - const e = K(t); - - if (null === e.ht) { - let t = e.path.canonicalString(); - null !== e.collectionGroup && (t += "|cg:" + e.collectionGroup), t += "|f:", t += e.filters.map(t => { - return (e = t).field.canonicalString() + e.op.toString() + ye(e.value); - var e; - }).join(","), t += "|ob:", t += e.orderBy.map(t => function (t) { - // TODO(b/29183165): Make this collision robust. - return t.field.canonicalString() + t.dir; - }(t)).join(","), ce(e.limit) || (t += "|l:", t += e.limit), e.startAt && (t += "|lb:", t += e.startAt.inclusive ? "b:" : "a:", t += e.startAt.position.map(t => ye(t)).join(",")), e.endAt && (t += "|ub:", t += e.endAt.inclusive ? "a:" : "b:", t += e.endAt.position.map(t => ye(t)).join(",")), e.ht = t; - } - - return e.ht; -} - -function $e(t) { - let e = t.path.canonicalString(); - return null !== t.collectionGroup && (e += " collectionGroup=" + t.collectionGroup), t.filters.length > 0 && (e += `, filters: [${t.filters.map(t => { - return `${(e = t).field.canonicalString()} ${e.op} ${ye(e.value)}`; - /** Returns a debug description for `filter`. */ - - var e; - /** Filter that matches on key fields (i.e. '__name__'). */ - }).join(", ")}]`), ce(t.limit) || (e += ", limit: " + t.limit), t.orderBy.length > 0 && (e += `, orderBy: [${t.orderBy.map(t => function (t) { - return `${t.field.canonicalString()} (${t.dir})`; - }(t)).join(", ")}]`), t.startAt && (e += ", startAt: ", e += t.startAt.inclusive ? "b:" : "a:", e += t.startAt.position.map(t => ye(t)).join(",")), t.endAt && (e += ", endAt: ", e += t.endAt.inclusive ? "a:" : "b:", e += t.endAt.position.map(t => ye(t)).join(",")), `Target(${e})`; -} - -function Be(t, e) { - if (t.limit !== e.limit) return !1; - if (t.orderBy.length !== e.orderBy.length) return !1; - - for (let n = 0; n < t.orderBy.length; n++) if (!en(t.orderBy[n], e.orderBy[n])) return !1; - - if (t.filters.length !== e.filters.length) return !1; - - for (let i = 0; i < t.filters.length; i++) if (n = t.filters[i], s = e.filters[i], n.op !== s.op || !n.field.isEqual(s.field) || !_e(n.value, s.value)) return !1; - - var n, s; - return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!sn(t.startAt, e.startAt) && sn(t.endAt, e.endAt); -} - -function Le(t) { - return dt.isDocumentKey(t.path) && null === t.collectionGroup && 0 === t.filters.length; -} -/** Returns the field filters that target the given field path. */ - - -function Ue(t, e) { - return t.filters.filter(t => t instanceof Ge && t.field.isEqual(e)); -} -/** - * Returns the values that are used in ARRAY_CONTAINS or ARRAY_CONTAINS_ANY - * filters. Returns `null` if there are no such filters. - */ - -/** - * Returns the value to use as the lower bound for ascending index segment at - * the provided `fieldPath` (or the upper bound for an descending segment). - */ - - -function qe(t, e, n) { - let s = fe, - i = !0; // Process all filters to find a value for the current field segment - - for (const n of Ue(t, e)) { - let t = fe, - e = !0; - - switch (n.op) { - case "<" - /* LESS_THAN */ - : - case "<=" - /* LESS_THAN_OR_EQUAL */ - : - t = Ve(n.value); - break; - - case "==" - /* EQUAL */ - : - case "in" - /* IN */ - : - case ">=" - /* GREATER_THAN_OR_EQUAL */ - : - t = n.value; - break; - - case ">" - /* GREATER_THAN */ - : - t = n.value, e = !1; - break; - - case "!=" - /* NOT_EQUAL */ - : - case "not-in" - /* NOT_IN */ - : - t = fe; - // Remaining filters cannot be used as lower bounds. - } - - De({ - value: s, - inclusive: i - }, { - value: t, - inclusive: e - }) < 0 && (s = t, i = e); - } // If there is an additional bound, compare the values against the existing - // range to see if we can narrow the scope. - - - if (null !== n) for (let r = 0; r < t.orderBy.length; ++r) { - if (t.orderBy[r].field.isEqual(e)) { - const t = n.position[r]; - De({ - value: s, - inclusive: i - }, { - value: t, - inclusive: n.inclusive - }) < 0 && (s = t, i = n.inclusive); - break; - } - } - return { - value: s, - inclusive: i - }; -} -/** - * Returns the value to use as the upper bound for ascending index segment at - * the provided `fieldPath` (or the lower bound for a descending segment). - */ - - -function Ke(t, e, n) { - let s = le, - i = !0; // Process all filters to find a value for the current field segment - - for (const n of Ue(t, e)) { - let t = le, - e = !0; - - switch (n.op) { - case ">=" - /* GREATER_THAN_OR_EQUAL */ - : - case ">" - /* GREATER_THAN */ - : - t = Se(n.value), e = !1; - break; - - case "==" - /* EQUAL */ - : - case "in" - /* IN */ - : - case "<=" - /* LESS_THAN_OR_EQUAL */ - : - t = n.value; - break; - - case "<" - /* LESS_THAN */ - : - t = n.value, e = !1; - break; - - case "!=" - /* NOT_EQUAL */ - : - case "not-in" - /* NOT_IN */ - : - t = le; - // Remaining filters cannot be used as upper bounds. - } - - Ce({ - value: s, - inclusive: i - }, { - value: t, - inclusive: e - }) > 0 && (s = t, i = e); - } // If there is an additional bound, compare the values against the existing - // range to see if we can narrow the scope. - - - if (null !== n) for (let r = 0; r < t.orderBy.length; ++r) { - if (t.orderBy[r].field.isEqual(e)) { - const t = n.position[r]; - Ce({ - value: s, - inclusive: i - }, { - value: t, - inclusive: n.inclusive - }) > 0 && (s = t, i = n.inclusive); - break; - } - } - return { - value: s, - inclusive: i - }; -} -/** Returns the number of segments of a perfect index for this target. */ - - -class Ge extends class {} { - constructor(t, e, n) { - super(), this.field = t, this.op = e, this.value = n; - } - /** - * Creates a filter based on the provided arguments. - */ - - - static create(t, e, n) { - return t.isKeyField() ? "in" - /* IN */ - === e || "not-in" - /* NOT_IN */ - === e ? this.lt(t, e, n) : new Qe(t, e, n) : "array-contains" - /* ARRAY_CONTAINS */ - === e ? new He(t, n) : "in" - /* IN */ - === e ? new Je(t, n) : "not-in" - /* NOT_IN */ - === e ? new Ye(t, n) : "array-contains-any" - /* ARRAY_CONTAINS_ANY */ - === e ? new Xe(t, n) : new Ge(t, e, n); - } - - static lt(t, e, n) { - return "in" - /* IN */ - === e ? new je(t, n) : new We(t, n); - } - - matches(t) { - const e = t.data.field(this.field); // Types do not have to match in NOT_EQUAL filters. - - return "!=" - /* NOT_EQUAL */ - === this.op ? null !== e && this.ft(me(e, this.value)) : null !== e && de(this.value) === de(e) && this.ft(me(e, this.value)); // Only compare types with matching backend order (such as double and int). - } - - ft(t) { - switch (this.op) { - case "<" - /* LESS_THAN */ - : - return t < 0; - - case "<=" - /* LESS_THAN_OR_EQUAL */ - : - return t <= 0; - - case "==" - /* EQUAL */ - : - return 0 === t; - - case "!=" - /* NOT_EQUAL */ - : - return 0 !== t; - - case ">" - /* GREATER_THAN */ - : - return t > 0; - - case ">=" - /* GREATER_THAN_OR_EQUAL */ - : - return t >= 0; - - default: - return L(); - } - } - - dt() { - return ["<" - /* LESS_THAN */ - , "<=" - /* LESS_THAN_OR_EQUAL */ - , ">" - /* GREATER_THAN */ - , ">=" - /* GREATER_THAN_OR_EQUAL */ - , "!=" - /* NOT_EQUAL */ - , "not-in" - /* NOT_IN */ - ].indexOf(this.op) >= 0; - } - -} - -class Qe extends Ge { - constructor(t, e, n) { - super(t, e, n), this.key = dt.fromName(n.referenceValue); - } - - matches(t) { - const e = dt.comparator(t.key, this.key); - return this.ft(e); - } - -} -/** Filter that matches on key fields within an array. */ - - -class je extends Ge { - constructor(t, e) { - super(t, "in" - /* IN */ - , e), this.keys = ze("in" - /* IN */ - , e); - } - - matches(t) { - return this.keys.some(e => e.isEqual(t.key)); - } - -} -/** Filter that matches on key fields not present within an array. */ - - -class We extends Ge { - constructor(t, e) { - super(t, "not-in" - /* NOT_IN */ - , e), this.keys = ze("not-in" - /* NOT_IN */ - , e); - } - - matches(t) { - return !this.keys.some(e => e.isEqual(t.key)); - } - -} - -function ze(t, e) { - var n; - return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map(t => dt.fromName(t.referenceValue)); -} -/** A Filter that implements the array-contains operator. */ - - -class He extends Ge { - constructor(t, e) { - super(t, "array-contains" - /* ARRAY_CONTAINS */ - , e); - } - - matches(t) { - const e = t.data.field(this.field); - return Ee(e) && we(e.arrayValue, this.value); - } - -} -/** A Filter that implements the IN operator. */ - - -class Je extends Ge { - constructor(t, e) { - super(t, "in" - /* IN */ - , e); - } - - matches(t) { - const e = t.data.field(this.field); - return null !== e && we(this.value.arrayValue, e); - } - -} -/** A Filter that implements the not-in operator. */ - - -class Ye extends Ge { - constructor(t, e) { - super(t, "not-in" - /* NOT_IN */ - , e); - } - - matches(t) { - if (we(this.value.arrayValue, { - nullValue: "NULL_VALUE" - })) return !1; - const e = t.data.field(this.field); - return null !== e && !we(this.value.arrayValue, e); - } - -} -/** A Filter that implements the array-contains-any operator. */ - - -class Xe extends Ge { - constructor(t, e) { - super(t, "array-contains-any" - /* ARRAY_CONTAINS_ANY */ - , e); - } - - matches(t) { - const e = t.data.field(this.field); - return !(!Ee(e) || !e.arrayValue.values) && e.arrayValue.values.some(t => we(this.value.arrayValue, t)); - } - -} -/** - * Represents a bound of a query. - * - * The bound is specified with the given components representing a position and - * whether it's just before or just after the position (relative to whatever the - * query order is). - * - * The position represents a logical index position for a query. It's a prefix - * of values for the (potentially implicit) order by clauses of a query. - * - * Bound provides a function to determine whether a document comes before or - * after a bound. This is influenced by whether the position is just before or - * just after the provided values. - */ - - -class Ze { - constructor(t, e) { - this.position = t, this.inclusive = e; - } - -} -/** - * An ordering on a field, in some Direction. Direction defaults to ASCENDING. - */ - - -class tn { - constructor(t) { - let e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "asc"; - this.field = t, this.dir = e; - } - -} - -function en(t, e) { - return t.dir === e.dir && t.field.isEqual(e.field); -} - -function nn(t, e, n) { - let s = 0; - - for (let i = 0; i < t.position.length; i++) { - const r = e[i], - o = t.position[i]; - if (r.field.isKeyField()) s = dt.comparator(dt.fromName(o.referenceValue), n.key);else { - s = me(o, n.data.field(r.field)); - } - if ("desc" - /* DESCENDING */ - === r.dir && (s *= -1), 0 !== s) break; - } - - return s; -} -/** - * Returns true if a document sorts after a bound using the provided sort - * order. - */ - - -function sn(t, e) { - if (null === t) return null === e; - if (null === e) return !1; - if (t.inclusive !== e.inclusive || t.position.length !== e.position.length) return !1; - - for (let n = 0; n < t.position.length; n++) { - if (!_e(t.position[n], e.position[n])) return !1; - } - - return !0; -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Query encapsulates all the query attributes we support in the SDK. It can - * be run against the LocalStore, as well as be converted to a `Target` to - * query the RemoteStore results. - * - * Visible for testing. - */ - - -class rn { - /** - * Initializes a Query with a path and optional additional query constraints. - * Path must currently be empty if this is a collection group query. - */ - constructor(t) { - let e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - let n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; - let s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; - let i = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null; - let r = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : "F"; - let o = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null; - let u = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null; - this.path = t, this.collectionGroup = e, this.explicitOrderBy = n, this.filters = s, this.limit = i, this.limitType = r, this.startAt = o, this.endAt = u, this._t = null, // The corresponding `Target` of this `Query` instance. - this.wt = null, this.startAt, this.endAt; - } - -} -/** Creates a new Query instance with the options provided. */ - - -function on(t, e, n, s, i, r, o, u) { - return new rn(t, e, n, s, i, r, o, u); -} -/** Creates a new Query for a query that matches all documents at `path` */ - - -function un(t) { - return new rn(t); -} -/** - * Helper to convert a collection group query into a collection query at a - * specific path. This is used when executing collection group queries, since - * we have to split the query into a set of collection queries at multiple - * paths. - */ - -/** - * Returns true if this query does not specify any query constraints that - * could remove results. - */ - - -function cn(t) { - return 0 === t.filters.length && null === t.limit && null == t.startAt && null == t.endAt && (0 === t.explicitOrderBy.length || 1 === t.explicitOrderBy.length && t.explicitOrderBy[0].field.isKeyField()); -} - -function an(t) { - return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null; -} - -function hn(t) { - for (const e of t.filters) if (e.dt()) return e.field; - - return null; -} -/** - * Checks if any of the provided Operators are included in the query and - * returns the first one that is, or null if none are. - */ - -/** - * Returns whether the query matches a collection group rather than a specific - * collection. - */ - - -function ln(t) { - return null !== t.collectionGroup; -} -/** - * Returns the implicit order by constraint that is used to execute the Query, - * which can be different from the order by constraints the user provided (e.g. - * the SDK and backend always orders by `__name__`). - */ - - -function fn(t) { - const e = K(t); - - if (null === e._t) { - e._t = []; - const t = hn(e), - n = an(e); - if (null !== t && null === n) // In order to implicitly add key ordering, we must also add the - // inequality filter field for it to be a valid query. - // Note that the default inequality field and key ordering is ascending. - t.isKeyField() || e._t.push(new tn(t)), e._t.push(new tn(ft.keyField(), "asc" - /* ASCENDING */ - ));else { - let t = !1; - - for (const n of e.explicitOrderBy) e._t.push(n), n.field.isKeyField() && (t = !0); - - if (!t) { - // The order of the implicit key ordering always matches the last - // explicit order by - const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" - /* ASCENDING */ - ; - - e._t.push(new tn(ft.keyField(), t)); - } - } - } - - return e._t; -} -/** - * Converts this `Query` instance to it's corresponding `Target` representation. - */ - - -function dn(t) { - const e = K(t); - if (!e.wt) if ("F" - /* First */ - === e.limitType) e.wt = Oe(e.path, e.collectionGroup, fn(e), e.filters, e.limit, e.startAt, e.endAt);else { - // Flip the orderBy directions since we want the last results - const t = []; - - for (const n of fn(e)) { - const e = "desc" - /* DESCENDING */ - === n.dir ? "asc" - /* ASCENDING */ - : "desc" - /* DESCENDING */ - ; - t.push(new tn(n.field, e)); - } // We need to swap the cursors to match the now-flipped query ordering. - - - const n = e.endAt ? new Ze(e.endAt.position, e.endAt.inclusive) : null, - s = e.startAt ? new Ze(e.startAt.position, e.startAt.inclusive) : null; // Now return as a LimitType.First query. - - e.wt = Oe(e.path, e.collectionGroup, t, e.filters, e.limit, n, s); - } - return e.wt; -} - -function _n(t, e, n) { - return new rn(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt); -} - -function wn(t, e) { - return Be(dn(t), dn(e)) && t.limitType === e.limitType; -} // TODO(b/29183165): This is used to get a unique string from a query to, for -// example, use as a dictionary key, but the implementation is subject to -// collisions. Make it collision-free. - - -function mn(t) { - return `${Fe(dn(t))}|lt:${t.limitType}`; -} - -function gn(t) { - return `Query(target=${$e(dn(t))}; limitType=${t.limitType})`; -} -/** Returns whether `doc` matches the constraints of `query`. */ - - -function yn(t, e) { - return e.isFoundDocument() && function (t, e) { - const n = e.key.path; - return null !== t.collectionGroup ? e.key.hasCollectionId(t.collectionGroup) && t.path.isPrefixOf(n) : dt.isDocumentKey(t.path) ? t.path.isEqual(n) : t.path.isImmediateParentOf(n); - } - /** - * A document must have a value for every ordering clause in order to show up - * in the results. - */ - (t, e) && function (t, e) { - for (const n of t.explicitOrderBy) // order by key always matches - if (!n.field.isKeyField() && null === e.data.field(n.field)) return !1; - - return !0; - }(t, e) && function (t, e) { - for (const n of t.filters) if (!n.matches(e)) return !1; - - return !0; - } - /** Makes sure a document is within the bounds, if provided. */ - (t, e) && function (t, e) { - if (t.startAt && ! - /** - * Returns true if a document sorts before a bound using the provided sort - * order. - */ - function (t, e, n) { - const s = nn(t, e, n); - return t.inclusive ? s <= 0 : s < 0; - }(t.startAt, fn(t), e)) return !1; - if (t.endAt && !function (t, e, n) { - const s = nn(t, e, n); - return t.inclusive ? s >= 0 : s > 0; - }(t.endAt, fn(t), e)) return !1; - return !0; - } - /** - * Returns the collection group that this query targets. - * - * PORTING NOTE: This is only used in the Web SDK to facilitate multi-tab - * synchronization for query results. - */ - (t, e); -} - -function pn(t) { - return t.collectionGroup || (t.path.length % 2 == 1 ? t.path.lastSegment() : t.path.get(t.path.length - 2)); -} -/** - * Returns a new comparator function that can be used to compare two documents - * based on the Query's ordering constraint. - */ - - -function In(t) { - return (e, n) => { - let s = !1; - - for (const i of fn(t)) { - const t = Tn(i, e, n); - if (0 !== t) return t; - s = s || i.field.isKeyField(); - } - - return 0; - }; -} - -function Tn(t, e, n) { - const s = t.field.isKeyField() ? dt.comparator(e.key, n.key) : function (t, e, n) { - const s = e.data.field(t), - i = n.data.field(t); - return null !== s && null !== i ? me(s, i) : L(); - }(t.field, e, n); - - switch (t.dir) { - case "asc" - /* ASCENDING */ - : - return s; - - case "desc" - /* DESCENDING */ - : - return -1 * s; - - default: - return L(); - } -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Returns an DoubleValue for `value` that is encoded based the serializer's - * `useProto3Json` setting. - */ - - -function En(t, e) { - if (t.gt) { - if (isNaN(e)) return { - doubleValue: "NaN" - }; - if (e === 1 / 0) return { - doubleValue: "Infinity" - }; - if (e === -1 / 0) return { - doubleValue: "-Infinity" - }; - } - - return { - doubleValue: ae(e) ? "-0" : e - }; -} -/** - * Returns an IntegerValue for `value`. - */ - - -function An(t) { - return { - integerValue: "" + t - }; -} -/** - * Returns a value for a number that's appropriate to put into a proto. - * The return value is an IntegerValue if it can safely represent the value, - * otherwise a DoubleValue is returned. - */ - - -function Rn(t, e) { - return he(e) ? An(e) : En(t, e); -} -/** - * @license - * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** Used to represent a field transform on a mutation. */ - - -class bn { - constructor() { - // Make sure that the structural type of `TransformOperation` is unique. - // See https://github.com/microsoft/TypeScript/issues/5451 - this._ = void 0; - } - -} -/** - * Computes the local transform result against the provided `previousValue`, - * optionally using the provided localWriteTime. - */ - - -function Pn(t, e, n) { - return t instanceof Sn ? function (t, e) { - const n = { - fields: { - __type__: { - stringValue: "server_timestamp" - }, - __local_write_time__: { - timestampValue: { - seconds: t.seconds, - nanos: t.nanoseconds - } - } - } - }; - return e && (n.fields.__previous_value__ = e), { - mapValue: n - }; - }(n, e) : t instanceof Dn ? Cn(t, e) : t instanceof xn ? Nn(t, e) : function (t, e) { - // PORTING NOTE: Since JavaScript's integer arithmetic is limited to 53 bit - // precision and resolves overflows by reducing precision, we do not - // manually cap overflows at 2^63. - const n = Vn(t, e), - s = Mn(n) + Mn(t.yt); - return Te(n) && Te(t.yt) ? An(s) : En(t.It, s); - }(t, e); -} -/** - * Computes a final transform result after the transform has been acknowledged - * by the server, potentially using the server-provided transformResult. - */ - - -function vn(t, e, n) { - // The server just sends null as the transform result for array operations, - // so we have to calculate a result the same as we do for local - // applications. - return t instanceof Dn ? Cn(t, e) : t instanceof xn ? Nn(t, e) : n; -} -/** - * If this transform operation is not idempotent, returns the base value to - * persist for this transform. If a base value is returned, the transform - * operation is always applied to this base value, even if document has - * already been updated. - * - * Base values provide consistent behavior for non-idempotent transforms and - * allow us to return the same latency-compensated value even if the backend - * has already applied the transform operation. The base value is null for - * idempotent transforms, as they can be re-played even if the backend has - * already applied them. - * - * @returns a base value to store along with the mutation, or null for - * idempotent transforms. - */ - - -function Vn(t, e) { - return t instanceof kn ? Te(n = e) || function (t) { - return !!t && "doubleValue" in t; - } - /** Returns true if `value` is either an IntegerValue or a DoubleValue. */ - (n) ? e : { - integerValue: 0 - } : null; - var n; -} -/** Transforms a value into a server-generated timestamp. */ - - -class Sn extends bn {} -/** Transforms an array value via a union operation. */ - - -class Dn extends bn { - constructor(t) { - super(), this.elements = t; - } - -} - -function Cn(t, e) { - const n = On(e); - - for (const e of t.elements) n.some(t => _e(t, e)) || n.push(e); - - return { - arrayValue: { - values: n - } - }; -} -/** Transforms an array value via a remove operation. */ - - -class xn extends bn { - constructor(t) { - super(), this.elements = t; - } - -} - -function Nn(t, e) { - let n = On(e); - - for (const e of t.elements) n = n.filter(t => !_e(t, e)); - - return { - arrayValue: { - values: n - } - }; -} -/** - * Implements the backend semantics for locally computed NUMERIC_ADD (increment) - * transforms. Converts all field values to integers or doubles, but unlike the - * backend does not cap integer values at 2^63. Instead, JavaScript number - * arithmetic is used and precision loss can occur for values greater than 2^53. - */ - - -class kn extends bn { - constructor(t, e) { - super(), this.It = t, this.yt = e; - } - -} - -function Mn(t) { - return ee(t.integerValue || t.doubleValue); -} - -function On(t) { - return Ee(t) && t.arrayValue.values ? t.arrayValue.values.slice() : []; -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** A field path and the TransformOperation to perform upon it. */ - - -class Fn { - constructor(t, e) { - this.field = t, this.transform = e; - } - -} - -function $n(t, e) { - return t.field.isEqual(e.field) && function (t, e) { - return t instanceof Dn && e instanceof Dn || t instanceof xn && e instanceof xn ? rt(t.elements, e.elements, _e) : t instanceof kn && e instanceof kn ? _e(t.yt, e.yt) : t instanceof Sn && e instanceof Sn; - }(t.transform, e.transform); -} -/** The result of successfully applying a mutation to the backend. */ - - -class Bn { - constructor( - /** - * The version at which the mutation was committed: - * - * - For most operations, this is the updateTime in the WriteResult. - * - For deletes, the commitTime of the WriteResponse (because deletes are - * not stored and have no updateTime). - * - * Note that these versions can be different: No-op writes will not change - * the updateTime even though the commitTime advances. - */ - t, - /** - * The resulting fields returned from the backend after a mutation - * containing field transforms has been committed. Contains one FieldValue - * for each FieldTransform that was in the mutation. - * - * Will be empty if the mutation did not contain any field transforms. - */ - e) { - this.version = t, this.transformResults = e; - } - -} -/** - * Encodes a precondition for a mutation. This follows the model that the - * backend accepts with the special case of an explicit "empty" precondition - * (meaning no precondition). - */ - - -class Ln { - constructor(t, e) { - this.updateTime = t, this.exists = e; - } - /** Creates a new empty Precondition. */ - - - static none() { - return new Ln(); - } - /** Creates a new Precondition with an exists flag. */ - - - static exists(t) { - return new Ln(void 0, t); - } - /** Creates a new Precondition based on a version a document exists at. */ - - - static updateTime(t) { - return new Ln(t); - } - /** Returns whether this Precondition is empty. */ - - - get isNone() { - return void 0 === this.updateTime && void 0 === this.exists; - } - - isEqual(t) { - return this.exists === t.exists && (this.updateTime ? !!t.updateTime && this.updateTime.isEqual(t.updateTime) : !t.updateTime); - } - -} -/** Returns true if the preconditions is valid for the given document. */ - - -function Un(t, e) { - return void 0 !== t.updateTime ? e.isFoundDocument() && e.version.isEqual(t.updateTime) : void 0 === t.exists || t.exists === e.isFoundDocument(); -} -/** - * A mutation describes a self-contained change to a document. Mutations can - * create, replace, delete, and update subsets of documents. - * - * Mutations not only act on the value of the document but also its version. - * - * For local mutations (mutations that haven't been committed yet), we preserve - * the existing version for Set and Patch mutations. For Delete mutations, we - * reset the version to 0. - * - * Here's the expected transition table. - * - * MUTATION APPLIED TO RESULTS IN - * - * SetMutation Document(v3) Document(v3) - * SetMutation NoDocument(v3) Document(v0) - * SetMutation InvalidDocument(v0) Document(v0) - * PatchMutation Document(v3) Document(v3) - * PatchMutation NoDocument(v3) NoDocument(v3) - * PatchMutation InvalidDocument(v0) UnknownDocument(v3) - * DeleteMutation Document(v3) NoDocument(v0) - * DeleteMutation NoDocument(v3) NoDocument(v0) - * DeleteMutation InvalidDocument(v0) NoDocument(v0) - * - * For acknowledged mutations, we use the updateTime of the WriteResponse as - * the resulting version for Set and Patch mutations. As deletes have no - * explicit update time, we use the commitTime of the WriteResponse for - * Delete mutations. - * - * If a mutation is acknowledged by the backend but fails the precondition check - * locally, we transition to an `UnknownDocument` and rely on Watch to send us - * the updated version. - * - * Field transforms are used only with Patch and Set Mutations. We use the - * `updateTransforms` message to store transforms, rather than the `transforms`s - * messages. - * - * ## Subclassing Notes - * - * Every type of mutation needs to implement its own applyToRemoteDocument() and - * applyToLocalView() to implement the actual behavior of applying the mutation - * to some source document (see `setMutationApplyToRemoteDocument()` for an - * example). - */ - - -class qn {} -/** - * A utility method to calculate a `Mutation` representing the overlay from the - * final state of the document, and a `FieldMask` representing the fields that - * are mutated by the local mutations. - */ - - -function Kn(t, e) { - if (!t.hasLocalMutations || e && 0 === e.fields.length) return null; // mask is null when sets or deletes are applied to the current document. - - if (null === e) return t.isNoDocument() ? new Zn(t.key, Ln.none()) : new zn(t.key, t.data, Ln.none()); - { - const n = t.data, - s = xe.empty(); - let i = new Wt(ft.comparator); - - for (let t of e.fields) if (!i.has(t)) { - let e = n.field(t); // If we are deleting a nested field, we take the immediate parent as - // the mask used to construct the resulting mutation. - // Justification: Nested fields can create parent fields implicitly. If - // only a leaf entry is deleted in later mutations, the parent field - // should still remain, but we may have lost this information. - // Consider mutation (foo.bar 1), then mutation (foo.bar delete()). - // This leaves the final result (foo, {}). Despite the fact that `doc` - // has the correct result, `foo` is not in `mask`, and the resulting - // mutation would miss `foo`. - - null === e && t.length > 1 && (t = t.popLast(), e = n.field(t)), null === e ? s.delete(t) : s.set(t, e), i = i.add(t); - } - - return new Hn(t.key, s, new Jt(i.toArray()), Ln.none()); - } -} -/** - * Applies this mutation to the given document for the purposes of computing a - * new remote document. If the input document doesn't match the expected state - * (e.g. it is invalid or outdated), the document type may transition to - * unknown. - * - * @param mutation - The mutation to apply. - * @param document - The document to mutate. The input document can be an - * invalid document if the client has no knowledge of the pre-mutation state - * of the document. - * @param mutationResult - The result of applying the mutation from the backend. - */ - - -function Gn(t, e, n) { - t instanceof zn ? function (t, e, n) { - // Unlike setMutationApplyToLocalView, if we're applying a mutation to a - // remote document the server has accepted the mutation so the precondition - // must have held. - const s = t.value.clone(), - i = Yn(t.fieldTransforms, e, n.transformResults); - s.setAll(i), e.convertToFoundDocument(n.version, s).setHasCommittedMutations(); - }(t, e, n) : t instanceof Hn ? function (t, e, n) { - if (!Un(t.precondition, e)) // Since the mutation was not rejected, we know that the precondition - // matched on the backend. We therefore must not have the expected version - // of the document in our cache and convert to an UnknownDocument with a - // known updateTime. - return void e.convertToUnknownDocument(n.version); - const s = Yn(t.fieldTransforms, e, n.transformResults), - i = e.data; - i.setAll(Jn(t)), i.setAll(s), e.convertToFoundDocument(n.version, i).setHasCommittedMutations(); - }(t, e, n) : function (t, e, n) { - // Unlike applyToLocalView, if we're applying a mutation to a remote - // document the server has accepted the mutation so the precondition must - // have held. - e.convertToNoDocument(n.version).setHasCommittedMutations(); - }(0, e, n); -} -/** - * Applies this mutation to the given document for the purposes of computing - * the new local view of a document. If the input document doesn't match the - * expected state, the document is not modified. - * - * @param mutation - The mutation to apply. - * @param document - The document to mutate. The input document can be an - * invalid document if the client has no knowledge of the pre-mutation state - * of the document. - * @param previousMask - The fields that have been updated before applying this mutation. - * @param localWriteTime - A timestamp indicating the local write time of the - * batch this mutation is a part of. - * @returns A `FieldMask` representing the fields that are changed by applying this mutation. - */ - - -function Qn(t, e, n, s) { - return t instanceof zn ? function (t, e, n, s) { - if (!Un(t.precondition, e)) // The mutation failed to apply (e.g. a document ID created with add() - // caused a name collision). - return n; - const i = t.value.clone(), - r = Xn(t.fieldTransforms, s, e); - return i.setAll(r), e.convertToFoundDocument(e.version, i).setHasLocalMutations(), null; // SetMutation overwrites all fields. - } - /** - * A mutation that modifies fields of the document at the given key with the - * given values. The values are applied through a field mask: - * - * * When a field is in both the mask and the values, the corresponding field - * is updated. - * * When a field is in neither the mask nor the values, the corresponding - * field is unmodified. - * * When a field is in the mask but not in the values, the corresponding field - * is deleted. - * * When a field is not in the mask but is in the values, the values map is - * ignored. - */ - (t, e, n, s) : t instanceof Hn ? function (t, e, n, s) { - if (!Un(t.precondition, e)) return n; - const i = Xn(t.fieldTransforms, s, e), - r = e.data; - if (r.setAll(Jn(t)), r.setAll(i), e.convertToFoundDocument(e.version, r).setHasLocalMutations(), null === n) return null; - return n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map(t => t.field)); - } - /** - * Returns a FieldPath/Value map with the content of the PatchMutation. - */ - (t, e, n, s) : function (t, e, n) { - if (Un(t.precondition, e)) return e.convertToNoDocument(e.version).setHasLocalMutations(), null; - return n; - } - /** - * A mutation that verifies the existence of the document at the given key with - * the provided precondition. - * - * The `verify` operation is only used in Transactions, and this class serves - * primarily to facilitate serialization into protos. - */ - (t, e, n); -} -/** - * If this mutation is not idempotent, returns the base value to persist with - * this mutation. If a base value is returned, the mutation is always applied - * to this base value, even if document has already been updated. - * - * The base value is a sparse object that consists of only the document - * fields for which this mutation contains a non-idempotent transformation - * (e.g. a numeric increment). The provided value guarantees consistent - * behavior for non-idempotent transforms and allow us to return the same - * latency-compensated value even if the backend has already applied the - * mutation. The base value is null for idempotent mutations, as they can be - * re-played even if the backend has already applied them. - * - * @returns a base value to store along with the mutation, or null for - * idempotent mutations. - */ - - -function jn(t, e) { - let n = null; - - for (const s of t.fieldTransforms) { - const t = e.data.field(s.field), - i = Vn(s.transform, t || null); - null != i && (null === n && (n = xe.empty()), n.set(s.field, i)); - } - - return n || null; -} - -function Wn(t, e) { - return t.type === e.type && !!t.key.isEqual(e.key) && !!t.precondition.isEqual(e.precondition) && !!function (t, e) { - return void 0 === t && void 0 === e || !(!t || !e) && rt(t, e, (t, e) => $n(t, e)); - }(t.fieldTransforms, e.fieldTransforms) && (0 - /* Set */ - === t.type ? t.value.isEqual(e.value) : 1 - /* Patch */ - !== t.type || t.data.isEqual(e.data) && t.fieldMask.isEqual(e.fieldMask)); -} -/** - * A mutation that creates or replaces the document at the given key with the - * object value contents. - */ - - -class zn extends qn { - constructor(t, e, n) { - let s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; - super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = s, this.type = 0 - /* Set */ - ; - } - - getFieldMask() { - return null; - } - -} - -class Hn extends qn { - constructor(t, e, n, s) { - let i = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : []; - super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = s, this.fieldTransforms = i, this.type = 1 - /* Patch */ - ; - } - - getFieldMask() { - return this.fieldMask; - } - -} - -function Jn(t) { - const e = new Map(); - return t.fieldMask.fields.forEach(n => { - if (!n.isEmpty()) { - const s = t.data.field(n); - e.set(n, s); - } - }), e; -} -/** - * Creates a list of "transform results" (a transform result is a field value - * representing the result of applying a transform) for use after a mutation - * containing transforms has been acknowledged by the server. - * - * @param fieldTransforms - The field transforms to apply the result to. - * @param mutableDocument - The current state of the document after applying all - * previous mutations. - * @param serverTransformResults - The transform results received by the server. - * @returns The transform results list. - */ - - -function Yn(t, e, n) { - const s = new Map(); - U(t.length === n.length); - - for (let i = 0; i < n.length; i++) { - const r = t[i], - o = r.transform, - u = e.data.field(r.field); - s.set(r.field, vn(o, u, n[i])); - } - - return s; -} -/** - * Creates a list of "transform results" (a transform result is a field value - * representing the result of applying a transform) for use when applying a - * transform locally. - * - * @param fieldTransforms - The field transforms to apply the result to. - * @param localWriteTime - The local time of the mutation (used to - * generate ServerTimestampValues). - * @param mutableDocument - The document to apply transforms on. - * @returns The transform results list. - */ - - -function Xn(t, e, n) { - const s = new Map(); - - for (const i of t) { - const t = i.transform, - r = n.data.field(i.field); - s.set(i.field, Pn(t, r, e)); - } - - return s; -} -/** A mutation that deletes the document at the given key. */ - - -class Zn extends qn { - constructor(t, e) { - super(), this.key = t, this.precondition = e, this.type = 2 - /* Delete */ - , this.fieldTransforms = []; - } - - getFieldMask() { - return null; - } - -} - -class ts extends qn { - constructor(t, e) { - super(), this.key = t, this.precondition = e, this.type = 3 - /* Verify */ - , this.fieldTransforms = []; - } - - getFieldMask() { - return null; - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class es { - // TODO(b/33078163): just use simplest form of existence filter for now - constructor(t) { - this.count = t; - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Error Codes describing the different ways GRPC can fail. These are copied - * directly from GRPC's sources here: - * - * https://github.com/grpc/grpc/blob/bceec94ea4fc5f0085d81235d8e1c06798dc341a/include/grpc%2B%2B/impl/codegen/status_code_enum.h - * - * Important! The names of these identifiers matter because the string forms - * are used for reverse lookups from the webchannel stream. Do NOT change the - * names of these identifiers or change this into a const enum. - */ - - -var ns, ss; -/** - * Determines whether an error code represents a permanent error when received - * in response to a non-write operation. - * - * See isPermanentWriteError for classifying write errors. - */ - -function is(t) { - switch (t) { - default: - return L(); - - case G.CANCELLED: - case G.UNKNOWN: - case G.DEADLINE_EXCEEDED: - case G.RESOURCE_EXHAUSTED: - case G.INTERNAL: - case G.UNAVAILABLE: // Unauthenticated means something went wrong with our token and we need - // to retry with new credentials which will happen automatically. - - case G.UNAUTHENTICATED: - return !1; - - case G.INVALID_ARGUMENT: - case G.NOT_FOUND: - case G.ALREADY_EXISTS: - case G.PERMISSION_DENIED: - case G.FAILED_PRECONDITION: // Aborted might be retried in some scenarios, but that is dependant on - // the context and should handled individually by the calling code. - // See https://cloud.google.com/apis/design/errors. - - case G.ABORTED: - case G.OUT_OF_RANGE: - case G.UNIMPLEMENTED: - case G.DATA_LOSS: - return !0; - } -} -/** - * Determines whether an error code represents a permanent error when received - * in response to a write operation. - * - * Write operations must be handled specially because as of b/119437764, ABORTED - * errors on the write stream should be retried too (even though ABORTED errors - * are not generally retryable). - * - * Note that during the initial handshake on the write stream an ABORTED error - * signals that we should discard our stream token (i.e. it is permanent). This - * means a handshake error should be classified with isPermanentError, above. - */ - -/** - * Maps an error Code from GRPC status code number, like 0, 1, or 14. These - * are not the same as HTTP status codes. - * - * @returns The Code equivalent to the given GRPC status code. Fails if there - * is no match. - */ - - -function rs(t) { - if (void 0 === t) // This shouldn't normally happen, but in certain error cases (like trying - // to send invalid proto messages) we may get an error with no GRPC code. - return F("GRPC error has no .code"), G.UNKNOWN; - - switch (t) { - case ns.OK: - return G.OK; - - case ns.CANCELLED: - return G.CANCELLED; - - case ns.UNKNOWN: - return G.UNKNOWN; - - case ns.DEADLINE_EXCEEDED: - return G.DEADLINE_EXCEEDED; - - case ns.RESOURCE_EXHAUSTED: - return G.RESOURCE_EXHAUSTED; - - case ns.INTERNAL: - return G.INTERNAL; - - case ns.UNAVAILABLE: - return G.UNAVAILABLE; - - case ns.UNAUTHENTICATED: - return G.UNAUTHENTICATED; - - case ns.INVALID_ARGUMENT: - return G.INVALID_ARGUMENT; - - case ns.NOT_FOUND: - return G.NOT_FOUND; - - case ns.ALREADY_EXISTS: - return G.ALREADY_EXISTS; - - case ns.PERMISSION_DENIED: - return G.PERMISSION_DENIED; - - case ns.FAILED_PRECONDITION: - return G.FAILED_PRECONDITION; - - case ns.ABORTED: - return G.ABORTED; - - case ns.OUT_OF_RANGE: - return G.OUT_OF_RANGE; - - case ns.UNIMPLEMENTED: - return G.UNIMPLEMENTED; - - case ns.DATA_LOSS: - return G.DATA_LOSS; - - default: - return L(); - } -} -/** - * Converts an HTTP response's error status to the equivalent error code. - * - * @param status - An HTTP error response status ("FAILED_PRECONDITION", - * "UNKNOWN", etc.) - * @returns The equivalent Code. Non-matching responses are mapped to - * Code.UNKNOWN. - */ - - -(ss = ns || (ns = {}))[ss.OK = 0] = "OK", ss[ss.CANCELLED = 1] = "CANCELLED", ss[ss.UNKNOWN = 2] = "UNKNOWN", ss[ss.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT", ss[ss.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", ss[ss.NOT_FOUND = 5] = "NOT_FOUND", ss[ss.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", ss[ss.PERMISSION_DENIED = 7] = "PERMISSION_DENIED", ss[ss.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", ss[ss.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED", ss[ss.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", ss[ss.ABORTED = 10] = "ABORTED", ss[ss.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", ss[ss.UNIMPLEMENTED = 12] = "UNIMPLEMENTED", ss[ss.INTERNAL = 13] = "INTERNAL", ss[ss.UNAVAILABLE = 14] = "UNAVAILABLE", ss[ss.DATA_LOSS = 15] = "DATA_LOSS"; -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A map implementation that uses objects as keys. Objects must have an - * associated equals function and must be immutable. Entries in the map are - * stored together with the key being produced from the mapKeyFn. This map - * automatically handles collisions of keys. - */ - -class os { - constructor(t, e) { - this.mapKeyFn = t, this.equalsFn = e, - /** - * The inner map for a key/value pair. Due to the possibility of collisions we - * keep a list of entries that we do a linear search through to find an actual - * match. Note that collisions should be rare, so we still expect near - * constant time lookups in practice. - */ - this.inner = {}, - /** The number of entries stored in the map */ - this.innerSize = 0; - } - /** Get a value for this key, or undefined if it does not exist. */ - - - get(t) { - const e = this.mapKeyFn(t), - n = this.inner[e]; - if (void 0 !== n) for (const [e, s] of n) if (this.equalsFn(e, t)) return s; - } - - has(t) { - return void 0 !== this.get(t); - } - /** Put this key and value in the map. */ - - - set(t, e) { - const n = this.mapKeyFn(t), - s = this.inner[n]; - if (void 0 === s) return this.inner[n] = [[t, e]], void this.innerSize++; - - for (let n = 0; n < s.length; n++) if (this.equalsFn(s[n][0], t)) // This is updating an existing entry and does not increase `innerSize`. - return void (s[n] = [t, e]); - - s.push([t, e]), this.innerSize++; - } - /** - * Remove this key from the map. Returns a boolean if anything was deleted. - */ - - - delete(t) { - const e = this.mapKeyFn(t), - n = this.inner[e]; - if (void 0 === n) return !1; - - for (let s = 0; s < n.length; s++) if (this.equalsFn(n[s][0], t)) return 1 === n.length ? delete this.inner[e] : n.splice(s, 1), this.innerSize--, !0; - - return !1; - } - - forEach(t) { - qt(this.inner, (e, n) => { - for (const [e, s] of n) t(e, s); - }); - } - - isEmpty() { - return Kt(this.inner); - } - - size() { - return this.innerSize; - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const us = new Gt(dt.comparator); - -function cs() { - return us; -} - -const as = new Gt(dt.comparator); - -function hs() { - let e = as; - - for (var _len5 = arguments.length, t = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { - t[_key5] = arguments[_key5]; - } - - for (const n of t) e = e.insert(n.key, n); - - return e; -} - -function ls(t) { - let e = as; - return t.forEach((t, n) => e = e.insert(t, n.overlayedDocument)), e; -} - -function fs() { - return _s(); -} - -function ds() { - return _s(); -} - -function _s() { - return new os(t => t.toString(), (t, e) => t.isEqual(e)); -} - -const ws = new Gt(dt.comparator); -const ms = new Wt(dt.comparator); - -function gs() { - let e = ms; - - for (var _len6 = arguments.length, t = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { - t[_key6] = arguments[_key6]; - } - - for (const n of t) e = e.add(n); - - return e; -} - -const ys = new Wt(it); - -function ps() { - return ys; -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * An event from the RemoteStore. It is split into targetChanges (changes to the - * state or the set of documents in our watched targets) and documentUpdates - * (changes to the actual documents). - */ - - -class Is { - constructor( - /** - * The snapshot version this event brings us up to, or MIN if not set. - */ - t, - /** - * A map from target to changes to the target. See TargetChange. - */ - e, - /** - * A set of targets that is known to be inconsistent. Listens for these - * targets should be re-established without resume tokens. - */ - n, - /** - * A set of which documents have changed or been deleted, along with the - * doc's new values (if not deleted). - */ - s, - /** - * A set of which document updates are due only to limbo resolution targets. - */ - i) { - this.snapshotVersion = t, this.targetChanges = e, this.targetMismatches = n, this.documentUpdates = s, this.resolvedLimboDocuments = i; - } - /** - * HACK: Views require RemoteEvents in order to determine whether the view is - * CURRENT, but secondary tabs don't receive remote events. So this method is - * used to create a synthesized RemoteEvent that can be used to apply a - * CURRENT status change to a View, for queries executed in a different tab. - */ - // PORTING NOTE: Multi-tab only - - - static createSynthesizedRemoteEventForCurrentChange(t, e) { - const n = new Map(); - return n.set(t, Ts.createSynthesizedTargetChangeForCurrentChange(t, e)), new Is(ct.min(), n, ps(), cs(), gs()); - } - -} -/** - * A TargetChange specifies the set of changes for a specific target as part of - * a RemoteEvent. These changes track which documents are added, modified or - * removed, as well as the target's resume token and whether the target is - * marked CURRENT. - * The actual changes *to* documents are not part of the TargetChange since - * documents may be part of multiple targets. - */ - - -class Ts { - constructor( - /** - * An opaque, server-assigned token that allows watching a query to be resumed - * after disconnecting without retransmitting all the data that matches the - * query. The resume token essentially identifies a point in time from which - * the server should resume sending results. - */ - t, - /** - * The "current" (synced) status of this target. Note that "current" - * has special meaning in the RPC protocol that implies that a target is - * both up-to-date and consistent with the rest of the watch stream. - */ - e, - /** - * The set of documents that were newly assigned to this target as part of - * this remote event. - */ - n, - /** - * The set of documents that were already assigned to this target but received - * an update during this remote event. - */ - s, - /** - * The set of documents that were removed from this target as part of this - * remote event. - */ - i) { - this.resumeToken = t, this.current = e, this.addedDocuments = n, this.modifiedDocuments = s, this.removedDocuments = i; - } - /** - * This method is used to create a synthesized TargetChanges that can be used to - * apply a CURRENT status change to a View (for queries executed in a different - * tab) or for new queries (to raise snapshots with correct CURRENT status). - */ - - - static createSynthesizedTargetChangeForCurrentChange(t, e) { - return new Ts(Xt.EMPTY_BYTE_STRING, e, gs(), gs(), gs()); - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Represents a changed document and a list of target ids to which this change - * applies. - * - * If document has been deleted NoDocument will be provided. - */ - - -class Es { - constructor( - /** The new document applies to all of these targets. */ - t, - /** The new document is removed from all of these targets. */ - e, - /** The key of the document for this change. */ - n, - /** - * The new document or NoDocument if it was deleted. Is null if the - * document went out of view without the server sending a new document. - */ - s) { - this.Tt = t, this.removedTargetIds = e, this.key = n, this.Et = s; - } - -} - -class As { - constructor(t, e) { - this.targetId = t, this.At = e; - } - -} - -class Rs { - constructor( - /** What kind of change occurred to the watch target. */ - t, - /** The target IDs that were added/removed/set. */ - e) { - let n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Xt.EMPTY_BYTE_STRING; - let s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; - this.state = t, this.targetIds = e, this.resumeToken = n, this.cause = s; - } - -} -/** Tracks the internal state of a Watch target. */ - - -class bs { - constructor() { - /** - * The number of pending responses (adds or removes) that we are waiting on. - * We only consider targets active that have no pending responses. - */ - this.Rt = 0, - /** - * Keeps track of the document changes since the last raised snapshot. - * - * These changes are continuously updated as we receive document updates and - * always reflect the current set of changes against the last issued snapshot. - */ - this.bt = Vs(), - /** See public getters for explanations of these fields. */ - this.Pt = Xt.EMPTY_BYTE_STRING, this.vt = !1, - /** - * Whether this target state should be included in the next snapshot. We - * initialize to true so that newly-added targets are included in the next - * RemoteEvent. - */ - this.Vt = !0; - } - /** - * Whether this target has been marked 'current'. - * - * 'Current' has special meaning in the RPC protocol: It implies that the - * Watch backend has sent us all changes up to the point at which the target - * was added and that the target is consistent with the rest of the watch - * stream. - */ - - - get current() { - return this.vt; - } - /** The last resume token sent to us for this target. */ - - - get resumeToken() { - return this.Pt; - } - /** Whether this target has pending target adds or target removes. */ - - - get St() { - return 0 !== this.Rt; - } - /** Whether we have modified any state that should trigger a snapshot. */ - - - get Dt() { - return this.Vt; - } - /** - * Applies the resume token to the TargetChange, but only when it has a new - * value. Empty resumeTokens are discarded. - */ - - - Ct(t) { - t.approximateByteSize() > 0 && (this.Vt = !0, this.Pt = t); - } - /** - * Creates a target change from the current set of changes. - * - * To reset the document changes after raising this snapshot, call - * `clearPendingChanges()`. - */ - - - xt() { - let t = gs(), - e = gs(), - n = gs(); - return this.bt.forEach((s, i) => { - switch (i) { - case 0 - /* Added */ - : - t = t.add(s); - break; - - case 2 - /* Modified */ - : - e = e.add(s); - break; - - case 1 - /* Removed */ - : - n = n.add(s); - break; - - default: - L(); - } - }), new Ts(this.Pt, this.vt, t, e, n); - } - /** - * Resets the document changes and sets `hasPendingChanges` to false. - */ - - - Nt() { - this.Vt = !1, this.bt = Vs(); - } - - kt(t, e) { - this.Vt = !0, this.bt = this.bt.insert(t, e); - } - - Mt(t) { - this.Vt = !0, this.bt = this.bt.remove(t); - } - - Ot() { - this.Rt += 1; - } - - Ft() { - this.Rt -= 1; - } - - $t() { - this.Vt = !0, this.vt = !0; - } - -} -/** - * A helper class to accumulate watch changes into a RemoteEvent. - */ - - -class Ps { - constructor(t) { - this.Bt = t, - /** The internal state of all tracked targets. */ - this.Lt = new Map(), - /** Keeps track of the documents to update since the last raised snapshot. */ - this.Ut = cs(), - /** A mapping of document keys to their set of target IDs. */ - this.qt = vs(), - /** - * A list of targets with existence filter mismatches. These targets are - * known to be inconsistent and their listens needs to be re-established by - * RemoteStore. - */ - this.Kt = new Wt(it); - } - /** - * Processes and adds the DocumentWatchChange to the current set of changes. - */ - - - Gt(t) { - for (const e of t.Tt) t.Et && t.Et.isFoundDocument() ? this.Qt(e, t.Et) : this.jt(e, t.key, t.Et); - - for (const e of t.removedTargetIds) this.jt(e, t.key, t.Et); - } - /** Processes and adds the WatchTargetChange to the current set of changes. */ - - - Wt(t) { - this.forEachTarget(t, e => { - const n = this.zt(e); - - switch (t.state) { - case 0 - /* NoChange */ - : - this.Ht(e) && n.Ct(t.resumeToken); - break; - - case 1 - /* Added */ - : - // We need to decrement the number of pending acks needed from watch - // for this targetId. - n.Ft(), n.St || // We have a freshly added target, so we need to reset any state - // that we had previously. This can happen e.g. when remove and add - // back a target for existence filter mismatches. - n.Nt(), n.Ct(t.resumeToken); - break; - - case 2 - /* Removed */ - : - // We need to keep track of removed targets to we can post-filter and - // remove any target changes. - // We need to decrement the number of pending acks needed from watch - // for this targetId. - n.Ft(), n.St || this.removeTarget(e); - break; - - case 3 - /* Current */ - : - this.Ht(e) && (n.$t(), n.Ct(t.resumeToken)); - break; - - case 4 - /* Reset */ - : - this.Ht(e) && ( // Reset the target and synthesizes removes for all existing - // documents. The backend will re-add any documents that still - // match the target before it sends the next global snapshot. - this.Jt(e), n.Ct(t.resumeToken)); - break; - - default: - L(); - } - }); - } - /** - * Iterates over all targetIds that the watch change applies to: either the - * targetIds explicitly listed in the change or the targetIds of all currently - * active targets. - */ - - - forEachTarget(t, e) { - t.targetIds.length > 0 ? t.targetIds.forEach(e) : this.Lt.forEach((t, n) => { - this.Ht(n) && e(n); - }); - } - /** - * Handles existence filters and synthesizes deletes for filter mismatches. - * Targets that are invalidated by filter mismatches are added to - * `pendingTargetResets`. - */ - - - Yt(t) { - const e = t.targetId, - n = t.At.count, - s = this.Xt(e); - - if (s) { - const t = s.target; - if (Le(t)) { - if (0 === n) { - // The existence filter told us the document does not exist. We deduce - // that this document does not exist and apply a deleted document to - // our updates. Without applying this deleted document there might be - // another query that will raise this document as part of a snapshot - // until it is resolved, essentially exposing inconsistency between - // queries. - const n = new dt(t.path); - this.jt(e, n, ke.newNoDocument(n, ct.min())); - } else U(1 === n); - } else { - this.Zt(e) !== n && ( // Existence filter mismatch: We reset the mapping and raise a new - // snapshot with `isFromCache:true`. - this.Jt(e), this.Kt = this.Kt.add(e)); - } - } - } - /** - * Converts the currently accumulated state into a remote event at the - * provided snapshot version. Resets the accumulated changes before returning. - */ - - - te(t) { - const e = new Map(); - this.Lt.forEach((n, s) => { - const i = this.Xt(s); - - if (i) { - if (n.current && Le(i.target)) { - // Document queries for document that don't exist can produce an empty - // result set. To update our local cache, we synthesize a document - // delete if we have not previously received the document. This - // resolves the limbo state of the document, removing it from - // limboDocumentRefs. - // TODO(dimond): Ideally we would have an explicit lookup target - // instead resulting in an explicit delete message and we could - // remove this special logic. - const e = new dt(i.target.path); - null !== this.Ut.get(e) || this.ee(s, e) || this.jt(s, e, ke.newNoDocument(e, t)); - } - - n.Dt && (e.set(s, n.xt()), n.Nt()); - } - }); - let n = gs(); // We extract the set of limbo-only document updates as the GC logic - // special-cases documents that do not appear in the target cache. - // TODO(gsoltis): Expand on this comment once GC is available in the JS - // client. - - this.qt.forEach((t, e) => { - let s = !0; - e.forEachWhile(t => { - const e = this.Xt(t); - return !e || 2 - /* LimboResolution */ - === e.purpose || (s = !1, !1); - }), s && (n = n.add(t)); - }), this.Ut.forEach((e, n) => n.setReadTime(t)); - const s = new Is(t, e, this.Kt, this.Ut, n); - return this.Ut = cs(), this.qt = vs(), this.Kt = new Wt(it), s; - } - /** - * Adds the provided document to the internal list of document updates and - * its document key to the given target's mapping. - */ - // Visible for testing. - - - Qt(t, e) { - if (!this.Ht(t)) return; - const n = this.ee(t, e.key) ? 2 - /* Modified */ - : 0 - /* Added */ - ; - this.zt(t).kt(e.key, n), this.Ut = this.Ut.insert(e.key, e), this.qt = this.qt.insert(e.key, this.ne(e.key).add(t)); - } - /** - * Removes the provided document from the target mapping. If the - * document no longer matches the target, but the document's state is still - * known (e.g. we know that the document was deleted or we received the change - * that caused the filter mismatch), the new document can be provided - * to update the remote document cache. - */ - // Visible for testing. - - - jt(t, e, n) { - if (!this.Ht(t)) return; - const s = this.zt(t); - this.ee(t, e) ? s.kt(e, 1 - /* Removed */ - ) : // The document may have entered and left the target before we raised a - // snapshot, so we can just ignore the change. - s.Mt(e), this.qt = this.qt.insert(e, this.ne(e).delete(t)), n && (this.Ut = this.Ut.insert(e, n)); - } - - removeTarget(t) { - this.Lt.delete(t); - } - /** - * Returns the current count of documents in the target. This includes both - * the number of documents that the LocalStore considers to be part of the - * target as well as any accumulated changes. - */ - - - Zt(t) { - const e = this.zt(t).xt(); - return this.Bt.getRemoteKeysForTarget(t).size + e.addedDocuments.size - e.removedDocuments.size; - } - /** - * Increment the number of acks needed from watch before we can consider the - * server to be 'in-sync' with the client's active targets. - */ - - - Ot(t) { - this.zt(t).Ot(); - } - - zt(t) { - let e = this.Lt.get(t); - return e || (e = new bs(), this.Lt.set(t, e)), e; - } - - ne(t) { - let e = this.qt.get(t); - return e || (e = new Wt(it), this.qt = this.qt.insert(t, e)), e; - } - /** - * Verifies that the user is still interested in this target (by calling - * `getTargetDataForTarget()`) and that we are not waiting for pending ADDs - * from watch. - */ - - - Ht(t) { - const e = null !== this.Xt(t); - return e || O("WatchChangeAggregator", "Detected inactive target", t), e; - } - /** - * Returns the TargetData for an active target (i.e. a target that the user - * is still interested in that has no outstanding target change requests). - */ - - - Xt(t) { - const e = this.Lt.get(t); - return e && e.St ? null : this.Bt.se(t); - } - /** - * Resets the state of a Watch target to its initial state (e.g. sets - * 'current' to false, clears the resume token and removes its target mapping - * from all documents). - */ - - - Jt(t) { - this.Lt.set(t, new bs()); - this.Bt.getRemoteKeysForTarget(t).forEach(e => { - this.jt(t, e, - /*updatedDocument=*/ - null); - }); - } - /** - * Returns whether the LocalStore considers the document to be part of the - * specified target. - */ - - - ee(t, e) { - return this.Bt.getRemoteKeysForTarget(t).has(e); - } - -} - -function vs() { - return new Gt(dt.comparator); -} - -function Vs() { - return new Gt(dt.comparator); -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const Ss = (() => { - const t = { - asc: "ASCENDING", - desc: "DESCENDING" - }; - return t; -})(), - Ds = (() => { - const t = { - "<": "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" - }; - return t; -})(); -/** - * This class generates JsonObject values for the Datastore API suitable for - * sending to either GRPC stub methods or via the JSON/HTTP REST API. - * - * The serializer supports both Protobuf.js and Proto3 JSON formats. By - * setting `useProto3Json` to true, the serializer will use the Proto3 JSON - * format. - * - * For a description of the Proto3 JSON format check - * https://developers.google.com/protocol-buffers/docs/proto3#json - * - * TODO(klimt): We can remove the databaseId argument if we keep the full - * resource name in documents. - */ - - -class Cs { - constructor(t, e) { - this.databaseId = t, this.gt = e; - } - -} -/** - * Returns a value for a Date that's appropriate to put into a proto. - */ - - -function xs(t, e) { - if (t.gt) { - return `${new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + e.nanoseconds).slice(-9)}Z`; - } - - return { - seconds: "" + e.seconds, - nanos: e.nanoseconds - }; -} -/** - * Returns a value for bytes that's appropriate to put in a proto. - * - * Visible for testing. - */ - - -function Ns(t, e) { - return t.gt ? e.toBase64() : e.toUint8Array(); -} -/** - * Returns a ByteString based on the proto string value. - */ - - -function ks(t, e) { - return xs(t, e.toTimestamp()); -} - -function Ms(t) { - return U(!!t), ct.fromTimestamp(function (t) { - const e = te(t); - return new ut(e.seconds, e.nanos); - }(t)); -} - -function Os(t, e) { - return function (t) { - return new ht(["projects", t.projectId, "databases", t.database]); - }(t).child("documents").child(e).canonicalString(); -} - -function Fs(t) { - const e = ht.fromString(t); - return U(ai(e)), e; -} - -function $s(t, e) { - return Os(t.databaseId, e.path); -} - -function Bs(t, e) { - const n = Fs(e); - if (n.get(1) !== t.databaseId.projectId) throw new Q(G.INVALID_ARGUMENT, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId); - if (n.get(3) !== t.databaseId.database) throw new Q(G.INVALID_ARGUMENT, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database); - return new dt(Ks(n)); -} - -function Ls(t, e) { - return Os(t.databaseId, e); -} - -function Us(t) { - const e = Fs(t); // In v1beta1 queries for collections at the root did not have a trailing - // "/documents". In v1 all resource paths contain "/documents". Preserve the - // ability to read the v1beta1 form for compatibility with queries persisted - // in the local target cache. - - return 4 === e.length ? ht.emptyPath() : Ks(e); -} - -function qs(t) { - return new ht(["projects", t.databaseId.projectId, "databases", t.databaseId.database]).canonicalString(); -} - -function Ks(t) { - return U(t.length > 4 && "documents" === t.get(4)), t.popFirst(5); -} -/** Creates a Document proto from key and fields (but no create/update time) */ - - -function Gs(t, e, n) { - return { - name: $s(t, e), - fields: n.value.mapValue.fields - }; -} - -function Qs(t, e, n) { - const s = Bs(t, e.name), - i = Ms(e.updateTime), - r = new xe({ - mapValue: { - fields: e.fields - } - }), - o = ke.newFoundDocument(s, i, r); - return n && o.setHasCommittedMutations(), n ? o.setHasCommittedMutations() : o; -} - -function js(t, e) { - return "found" in e ? function (t, e) { - U(!!e.found), e.found.name, e.found.updateTime; - const n = Bs(t, e.found.name), - s = Ms(e.found.updateTime), - i = new xe({ - mapValue: { - fields: e.found.fields - } - }); - return ke.newFoundDocument(n, s, i); - }(t, e) : "missing" in e ? function (t, e) { - U(!!e.missing), U(!!e.readTime); - const n = Bs(t, e.missing), - s = Ms(e.readTime); - return ke.newNoDocument(n, s); - }(t, e) : L(); -} - -function Ws(t, e) { - let n; - - if ("targetChange" in e) { - e.targetChange; // proto3 default value is unset in JSON (undefined), so use 'NO_CHANGE' - // if unset - - const s = function (t) { - return "NO_CHANGE" === t ? 0 - /* NoChange */ - : "ADD" === t ? 1 - /* Added */ - : "REMOVE" === t ? 2 - /* Removed */ - : "CURRENT" === t ? 3 - /* Current */ - : "RESET" === t ? 4 - /* Reset */ - : L(); - }(e.targetChange.targetChangeType || "NO_CHANGE"), - i = e.targetChange.targetIds || [], - r = function (t, e) { - return t.gt ? (U(void 0 === e || "string" == typeof e), Xt.fromBase64String(e || "")) : (U(void 0 === e || e instanceof Uint8Array), Xt.fromUint8Array(e || new Uint8Array())); - }(t, e.targetChange.resumeToken), - o = e.targetChange.cause, - u = o && function (t) { - const e = void 0 === t.code ? G.UNKNOWN : rs(t.code); - return new Q(e, t.message || ""); - } - /** - * Returns a value for a number (or null) that's appropriate to put into - * a google.protobuf.Int32Value proto. - * DO NOT USE THIS FOR ANYTHING ELSE. - * This method cheats. It's typed as returning "number" because that's what - * our generated proto interfaces say Int32Value must be. But GRPC actually - * expects a { value: } struct. - */ - (o); - - n = new Rs(s, i, r, u || null); - } else if ("documentChange" in e) { - e.documentChange; - const s = e.documentChange; - s.document, s.document.name, s.document.updateTime; - const i = Bs(t, s.document.name), - r = Ms(s.document.updateTime), - o = new xe({ - mapValue: { - fields: s.document.fields - } - }), - u = ke.newFoundDocument(i, r, o), - c = s.targetIds || [], - a = s.removedTargetIds || []; - n = new Es(c, a, u.key, u); - } else if ("documentDelete" in e) { - e.documentDelete; - const s = e.documentDelete; - s.document; - const i = Bs(t, s.document), - r = s.readTime ? Ms(s.readTime) : ct.min(), - o = ke.newNoDocument(i, r), - u = s.removedTargetIds || []; - n = new Es([], u, o.key, o); - } else if ("documentRemove" in e) { - e.documentRemove; - const s = e.documentRemove; - s.document; - const i = Bs(t, s.document), - r = s.removedTargetIds || []; - n = new Es([], r, i, null); - } else { - if (!("filter" in e)) return L(); - { - e.filter; - const t = e.filter; - t.targetId; - const s = t.count || 0, - i = new es(s), - r = t.targetId; - n = new As(r, i); - } - } - - return n; -} - -function zs(t, e) { - let n; - if (e instanceof zn) n = { - update: Gs(t, e.key, e.value) - };else if (e instanceof Zn) n = { - delete: $s(t, e.key) - };else if (e instanceof Hn) n = { - update: Gs(t, e.key, e.data), - updateMask: ci(e.fieldMask) - };else { - if (!(e instanceof ts)) return L(); - n = { - verify: $s(t, e.key) - }; - } - return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map(t => function (t, e) { - const n = e.transform; - if (n instanceof Sn) return { - fieldPath: e.field.canonicalString(), - setToServerValue: "REQUEST_TIME" - }; - if (n instanceof Dn) return { - fieldPath: e.field.canonicalString(), - appendMissingElements: { - values: n.elements - } - }; - if (n instanceof xn) return { - fieldPath: e.field.canonicalString(), - removeAllFromArray: { - values: n.elements - } - }; - if (n instanceof kn) return { - fieldPath: e.field.canonicalString(), - increment: n.yt - }; - throw L(); - }(0, t))), e.precondition.isNone || (n.currentDocument = function (t, e) { - return void 0 !== e.updateTime ? { - updateTime: ks(t, e.updateTime) - } : void 0 !== e.exists ? { - exists: e.exists - } : L(); - }(t, e.precondition)), n; -} - -function Hs(t, e) { - const n = e.currentDocument ? function (t) { - return void 0 !== t.updateTime ? Ln.updateTime(Ms(t.updateTime)) : void 0 !== t.exists ? Ln.exists(t.exists) : Ln.none(); - }(e.currentDocument) : Ln.none(), - s = e.updateTransforms ? e.updateTransforms.map(e => function (t, e) { - let n = null; - if ("setToServerValue" in e) U("REQUEST_TIME" === e.setToServerValue), n = new Sn();else if ("appendMissingElements" in e) { - const t = e.appendMissingElements.values || []; - n = new Dn(t); - } else if ("removeAllFromArray" in e) { - const t = e.removeAllFromArray.values || []; - n = new xn(t); - } else "increment" in e ? n = new kn(t, e.increment) : L(); - const s = ft.fromServerFormat(e.fieldPath); - return new Fn(s, n); - }(t, e)) : []; - - if (e.update) { - e.update.name; - const i = Bs(t, e.update.name), - r = new xe({ - mapValue: { - fields: e.update.fields - } - }); - - if (e.updateMask) { - const t = function (t) { - const e = t.fieldPaths || []; - return new Jt(e.map(t => ft.fromServerFormat(t))); - }(e.updateMask); - - return new Hn(i, r, t, n, s); - } - - return new zn(i, r, n, s); - } - - if (e.delete) { - const s = Bs(t, e.delete); - return new Zn(s, n); - } - - if (e.verify) { - const s = Bs(t, e.verify); - return new ts(s, n); - } - - return L(); -} - -function Js(t, e) { - return t && t.length > 0 ? (U(void 0 !== e), t.map(t => function (t, e) { - // NOTE: Deletes don't have an updateTime. - let n = t.updateTime ? Ms(t.updateTime) : Ms(e); - return n.isEqual(ct.min()) && ( // The Firestore Emulator currently returns an update time of 0 for - // deletes of non-existing documents (rather than null). This breaks the - // test "get deleted doc while offline with source=cache" as NoDocuments - // with version 0 are filtered by IndexedDb's RemoteDocumentCache. - // TODO(#2149): Remove this when Emulator is fixed - n = Ms(e)), new Bn(n, t.transformResults || []); - }(t, e))) : []; -} - -function Ys(t, e) { - return { - documents: [Ls(t, e.path)] - }; -} - -function Xs(t, e) { - // Dissect the path into parent, collectionId, and optional key filter. - const n = { - structuredQuery: {} - }, - s = e.path; - null !== e.collectionGroup ? (n.parent = Ls(t, s), n.structuredQuery.from = [{ - collectionId: e.collectionGroup, - allDescendants: !0 - }]) : (n.parent = Ls(t, s.popLast()), n.structuredQuery.from = [{ - collectionId: s.lastSegment() - }]); - - const i = function (t) { - if (0 === t.length) return; - const e = t.map(t => // visible for testing - function (t) { - if ("==" - /* EQUAL */ - === t.op) { - if (Re(t.value)) return { - unaryFilter: { - field: ii(t.field), - op: "IS_NAN" - } - }; - if (Ae(t.value)) return { - unaryFilter: { - field: ii(t.field), - op: "IS_NULL" - } - }; - } else if ("!=" - /* NOT_EQUAL */ - === t.op) { - if (Re(t.value)) return { - unaryFilter: { - field: ii(t.field), - op: "IS_NOT_NAN" - } - }; - if (Ae(t.value)) return { - unaryFilter: { - field: ii(t.field), - op: "IS_NOT_NULL" - } - }; - } - - return { - fieldFilter: { - field: ii(t.field), - op: si(t.op), - value: t.value - } - }; - }(t)); - if (1 === e.length) return e[0]; - return { - compositeFilter: { - op: "AND", - filters: e - } - }; - }(e.filters); - - i && (n.structuredQuery.where = i); - - const r = function (t) { - if (0 === t.length) return; - return t.map(t => // visible for testing - function (t) { - return { - field: ii(t.field), - direction: ni(t.dir) - }; - }(t)); - }(e.orderBy); - - r && (n.structuredQuery.orderBy = r); - - const o = function (t, e) { - return t.gt || ce(e) ? e : { - value: e - }; - } - /** - * Returns a number (or null) from a google.protobuf.Int32Value proto. - */ - (t, e.limit); - - var u; - return null !== o && (n.structuredQuery.limit = o), e.startAt && (n.structuredQuery.startAt = { - before: (u = e.startAt).inclusive, - values: u.position - }), e.endAt && (n.structuredQuery.endAt = function (t) { - return { - before: !t.inclusive, - values: t.position - }; - }(e.endAt)), n; -} - -function Zs(t) { - let e = Us(t.parent); - const n = t.structuredQuery, - s = n.from ? n.from.length : 0; - let i = null; - - if (s > 0) { - U(1 === s); - const t = n.from[0]; - t.allDescendants ? i = t.collectionId : e = e.child(t.collectionId); - } - - let r = []; - n.where && (r = ei(n.where)); - let o = []; - n.orderBy && (o = n.orderBy.map(t => function (t) { - return new tn(ri(t.field), // visible for testing - function (t) { - switch (t) { - case "ASCENDING": - return "asc" - /* ASCENDING */ - ; - - case "DESCENDING": - return "desc" - /* DESCENDING */ - ; - - default: - return; - } - } // visible for testing - (t.direction)); - }(t))); - let u = null; - n.limit && (u = function (t) { - let e; - return e = "object" == typeof t ? t.value : t, ce(e) ? null : e; - }(n.limit)); - let c = null; - n.startAt && (c = function (t) { - const e = !!t.before, - n = t.values || []; - return new Ze(n, e); - }(n.startAt)); - let a = null; - return n.endAt && (a = function (t) { - const e = !t.before, - n = t.values || []; - return new Ze(n, e); - } // visible for testing - (n.endAt)), on(e, i, o, r, u, "F" - /* First */ - , c, a); -} - -function ti(t, e) { - const n = function (t, e) { - switch (e) { - case 0 - /* Listen */ - : - return null; - - case 1 - /* ExistenceFilterMismatch */ - : - return "existence-filter-mismatch"; - - case 2 - /* LimboResolution */ - : - return "limbo-document"; - - default: - return L(); - } - }(0, e.purpose); - - return null == n ? null : { - "goog-listen-tags": n - }; -} - -function ei(t) { - return t ? void 0 !== t.unaryFilter ? [ui(t)] : void 0 !== t.fieldFilter ? [oi(t)] : void 0 !== t.compositeFilter ? t.compositeFilter.filters.map(t => ei(t)).reduce((t, e) => t.concat(e)) : L() : []; -} - -function ni(t) { - return Ss[t]; -} - -function si(t) { - return Ds[t]; -} - -function ii(t) { - return { - fieldPath: t.canonicalString() - }; -} - -function ri(t) { - return ft.fromServerFormat(t.fieldPath); -} - -function oi(t) { - return Ge.create(ri(t.fieldFilter.field), function (t) { - switch (t) { - case "EQUAL": - return "==" - /* EQUAL */ - ; - - case "NOT_EQUAL": - return "!=" - /* NOT_EQUAL */ - ; - - case "GREATER_THAN": - return ">" - /* GREATER_THAN */ - ; - - case "GREATER_THAN_OR_EQUAL": - return ">=" - /* GREATER_THAN_OR_EQUAL */ - ; - - case "LESS_THAN": - return "<" - /* LESS_THAN */ - ; - - case "LESS_THAN_OR_EQUAL": - return "<=" - /* LESS_THAN_OR_EQUAL */ - ; - - case "ARRAY_CONTAINS": - return "array-contains" - /* ARRAY_CONTAINS */ - ; - - case "IN": - return "in" - /* IN */ - ; - - case "NOT_IN": - return "not-in" - /* NOT_IN */ - ; - - case "ARRAY_CONTAINS_ANY": - return "array-contains-any" - /* ARRAY_CONTAINS_ANY */ - ; - - default: - return L(); - } - }(t.fieldFilter.op), t.fieldFilter.value); -} - -function ui(t) { - switch (t.unaryFilter.op) { - case "IS_NAN": - const e = ri(t.unaryFilter.field); - return Ge.create(e, "==" - /* EQUAL */ - , { - doubleValue: NaN - }); - - case "IS_NULL": - const n = ri(t.unaryFilter.field); - return Ge.create(n, "==" - /* EQUAL */ - , { - nullValue: "NULL_VALUE" - }); - - case "IS_NOT_NAN": - const s = ri(t.unaryFilter.field); - return Ge.create(s, "!=" - /* NOT_EQUAL */ - , { - doubleValue: NaN - }); - - case "IS_NOT_NULL": - const i = ri(t.unaryFilter.field); - return Ge.create(i, "!=" - /* NOT_EQUAL */ - , { - nullValue: "NULL_VALUE" - }); - - default: - return L(); - } -} - -function ci(t) { - const e = []; - return t.fields.forEach(t => e.push(t.canonicalString())), { - fieldPaths: e - }; -} - -function ai(t) { - // Resource names have at least 4 components (project ID, database ID) - return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2); -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Encodes a resource path into a IndexedDb-compatible string form. - */ - - -function hi(t) { - let e = ""; - - for (let n = 0; n < t.length; n++) e.length > 0 && (e = fi(e)), e = li(t.get(n), e); - - return fi(e); -} -/** Encodes a single segment of a resource path into the given result */ - - -function li(t, e) { - let n = e; - const s = t.length; - - for (let e = 0; e < s; e++) { - const s = t.charAt(e); - - switch (s) { - case "\0": - n += ""; - break; - - case "": - n += ""; - break; - - default: - n += s; - } - } - - return n; -} -/** Encodes a path separator into the given result */ - - -function fi(t) { - return t + ""; -} -/** - * Decodes the given IndexedDb-compatible string form of a resource path into - * a ResourcePath instance. Note that this method is not suitable for use with - * decoding resource names from the server; those are One Platform format - * strings. - */ - - -function di(t) { - // Event the empty path must encode as a path of at least length 2. A path - // with exactly 2 must be the empty path. - const e = t.length; - if (U(e >= 2), 2 === e) return U("" === t.charAt(0) && "" === t.charAt(1)), ht.emptyPath(); // Escape characters cannot exist past the second-to-last position in the - // source value. - - const n = e - 2, - s = []; - let i = ""; - - for (let r = 0; r < e;) { - // The last two characters of a valid encoded path must be a separator, so - // there must be an end to this segment. - const e = t.indexOf("", r); - (e < 0 || e > n) && L(); - - switch (t.charAt(e + 1)) { - case "": - const n = t.substring(r, e); - let o; - 0 === i.length ? // Avoid copying for the common case of a segment that excludes \0 - // and \001 - o = n : (i += n, o = i, i = ""), s.push(o); - break; - - case "": - i += t.substring(r, e), i += "\0"; - break; - - case "": - // The escape character can be used in the output to encode itself. - i += t.substring(r, e + 1); - break; - - default: - L(); - } - - r = e + 2; - } - - return new ht(s); -} -/** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const _i = ["userId", "batchId"]; -/** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Name of the IndexedDb object store. - * - * Note that the name 'owner' is chosen to ensure backwards compatibility with - * older clients that only supported single locked access to the persistence - * layer. - */ - -/** - * Creates a [userId, encodedPath] key for use in the DbDocumentMutations - * index to iterate over all at document mutations for a given path or lower. - */ - -function wi(t, e) { - return [t, hi(e)]; -} -/** - * Creates a full index key of [userId, encodedPath, batchId] for inserting - * and deleting into the DbDocumentMutations index. - */ - - -function mi(t, e, n) { - return [t, hi(e), n]; -} -/** - * Because we store all the useful information for this store in the key, - * there is no useful information to store as the value. The raw (unencoded) - * path cannot be stored because IndexedDb doesn't store prototype - * information. - */ - - -const gi = {}, - yi = ["prefixPath", "collectionGroup", "readTime", "documentId"], - pi = ["prefixPath", "collectionGroup", "documentId"], - Ii = ["collectionGroup", "readTime", "prefixPath", "documentId"], - Ti = ["canonicalId", "targetId"], - Ei = ["targetId", "path"], - Ai = ["path", "targetId"], - Ri = ["collectionId", "parent"], - bi = ["indexId", "uid"], - Pi = ["uid", "sequenceNumber"], - vi = ["indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey"], - Vi = ["indexId", "uid", "orderedDocumentKey"], - Si = ["userId", "collectionPath", "documentId"], - Di = ["userId", "collectionPath", "largestBatchId"], - Ci = ["userId", "collectionGroup", "largestBatchId"], - xi = [...[...[...[...["mutationQueues", "mutations", "documentMutations", "remoteDocuments", "targets", "owner", "targetGlobal", "targetDocuments"], "clientMetadata"], "remoteDocumentGlobal"], "collectionParents"], "bundles", "namedQueries"], - Ni = [...xi, "documentOverlays"], - ki = ["mutationQueues", "mutations", "documentMutations", "remoteDocumentsV14", "targets", "owner", "targetGlobal", "targetDocuments", "clientMetadata", "remoteDocumentGlobal", "collectionParents", "bundles", "namedQueries", "documentOverlays"], - Mi = ki, - Oi = [...Mi, "indexConfiguration", "indexState", "indexEntries"]; -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -class Fi extends Pt { - constructor(t, e) { - super(), this.ie = t, this.currentSequenceNumber = e; - } - -} - -function $i(t, e) { - const n = K(t); - return Dt.O(n.ie, e); -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A batch of mutations that will be sent as one unit to the backend. - */ - - -class Bi { - /** - * @param batchId - The unique ID of this mutation batch. - * @param localWriteTime - The original write time of this mutation. - * @param baseMutations - Mutations that are used to populate the base - * values when this mutation is applied locally. This can be used to locally - * overwrite values that are persisted in the remote document cache. Base - * mutations are never sent to the backend. - * @param mutations - The user-provided mutations in this mutation batch. - * User-provided mutations are applied both locally and remotely on the - * backend. - */ - constructor(t, e, n, s) { - this.batchId = t, this.localWriteTime = e, this.baseMutations = n, this.mutations = s; - } - /** - * Applies all the mutations in this MutationBatch to the specified document - * to compute the state of the remote document - * - * @param document - The document to apply mutations to. - * @param batchResult - The result of applying the MutationBatch to the - * backend. - */ - - - applyToRemoteDocument(t, e) { - const n = e.mutationResults; - - for (let e = 0; e < this.mutations.length; e++) { - const s = this.mutations[e]; - - if (s.key.isEqual(t.key)) { - Gn(s, t, n[e]); - } - } - } - /** - * Computes the local view of a document given all the mutations in this - * batch. - * - * @param document - The document to apply mutations to. - * @param mutatedFields - Fields that have been updated before applying this mutation batch. - * @returns A `FieldMask` representing all the fields that are mutated. - */ - - - applyToLocalView(t, e) { - // First, apply the base state. This allows us to apply non-idempotent - // transform against a consistent set of values. - for (const n of this.baseMutations) n.key.isEqual(t.key) && (e = Qn(n, t, e, this.localWriteTime)); // Second, apply all user-provided mutations. - - - for (const n of this.mutations) n.key.isEqual(t.key) && (e = Qn(n, t, e, this.localWriteTime)); - - return e; - } - /** - * Computes the local view for all provided documents given the mutations in - * this batch. Returns a `DocumentKey` to `Mutation` map which can be used to - * replace all the mutation applications. - */ - - - applyToLocalDocumentSet(t, e) { - // TODO(mrschmidt): This implementation is O(n^2). If we apply the mutations - // directly (as done in `applyToLocalView()`), we can reduce the complexity - // to O(n). - const n = ds(); - return this.mutations.forEach(s => { - const i = t.get(s.key), - r = i.overlayedDocument; // TODO(mutabledocuments): This method should take a MutableDocumentMap - // and we should remove this cast. - - let o = this.applyToLocalView(r, i.mutatedFields); // Set mutatedFields to null if the document is only from local mutations. - // This creates a Set or Delete mutation, instead of trying to create a - // patch mutation as the overlay. - - o = e.has(s.key) ? null : o; - const u = Kn(r, o); - null !== u && n.set(s.key, u), r.isValidDocument() || r.convertToNoDocument(ct.min()); - }), n; - } - - keys() { - return this.mutations.reduce((t, e) => t.add(e.key), gs()); - } - - isEqual(t) { - return this.batchId === t.batchId && rt(this.mutations, t.mutations, (t, e) => Wn(t, e)) && rt(this.baseMutations, t.baseMutations, (t, e) => Wn(t, e)); - } - -} -/** The result of applying a mutation batch to the backend. */ - - -class Li { - constructor(t, e, n, - /** - * A pre-computed mapping from each mutated document to the resulting - * version. - */ - s) { - this.batch = t, this.commitVersion = e, this.mutationResults = n, this.docVersions = s; - } - /** - * Creates a new MutationBatchResult for the given batch and results. There - * must be one result for each mutation in the batch. This static factory - * caches a document=>version mapping (docVersions). - */ - - - static from(t, e, n) { - U(t.mutations.length === n.length); - let s = ws; - const i = t.mutations; - - for (let t = 0; t < i.length; t++) s = s.insert(i[t].key, n[t].version); - - return new Li(t, e, n, s); - } - -} -/** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Representation of an overlay computed by Firestore. - * - * Holds information about a mutation and the largest batch id in Firestore when - * the mutation was created. - */ - - -class Ui { - constructor(t, e) { - this.largestBatchId = t, this.mutation = e; - } - - getKey() { - return this.mutation.key; - } - - isEqual(t) { - return null !== t && this.mutation === t.mutation; - } - - toString() { - return `Overlay{\n largestBatchId: ${this.largestBatchId},\n mutation: ${this.mutation.toString()}\n }`; - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * An immutable set of metadata that the local store tracks for each target. - */ - - -class qi { - constructor( - /** The target being listened to. */ - t, - /** - * The target ID to which the target corresponds; Assigned by the - * LocalStore for user listens and by the SyncEngine for limbo watches. - */ - e, - /** The purpose of the target. */ - n, - /** - * The sequence number of the last transaction during which this target data - * was modified. - */ - s) { - let i = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ct.min(); - let r = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : ct.min(); - let o = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : Xt.EMPTY_BYTE_STRING; - this.target = t, this.targetId = e, this.purpose = n, this.sequenceNumber = s, this.snapshotVersion = i, this.lastLimboFreeSnapshotVersion = r, this.resumeToken = o; - } - /** Creates a new target data instance with an updated sequence number. */ - - - withSequenceNumber(t) { - return new qi(this.target, this.targetId, this.purpose, t, this.snapshotVersion, this.lastLimboFreeSnapshotVersion, this.resumeToken); - } - /** - * Creates a new target data instance with an updated resume token and - * snapshot version. - */ - - - withResumeToken(t, e) { - return new qi(this.target, this.targetId, this.purpose, this.sequenceNumber, e, this.lastLimboFreeSnapshotVersion, t); - } - /** - * Creates a new target data instance with an updated last limbo free - * snapshot version number. - */ - - - withLastLimboFreeSnapshotVersion(t) { - return new qi(this.target, this.targetId, this.purpose, this.sequenceNumber, this.snapshotVersion, t, this.resumeToken); - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** Serializer for values stored in the LocalStore. */ - - -class Ki { - constructor(t) { - this.re = t; - } - -} -/** Decodes a remote document from storage locally to a Document. */ - - -function Gi(t, e) { - let n; - if (e.document) n = Qs(t.re, e.document, !!e.hasCommittedMutations);else if (e.noDocument) { - const t = dt.fromSegments(e.noDocument.path), - s = zi(e.noDocument.readTime); - n = ke.newNoDocument(t, s), e.hasCommittedMutations && n.setHasCommittedMutations(); - } else { - if (!e.unknownDocument) return L(); - { - const t = dt.fromSegments(e.unknownDocument.path), - s = zi(e.unknownDocument.version); - n = ke.newUnknownDocument(t, s); - } - } - return e.readTime && n.setReadTime(function (t) { - const e = new ut(t[0], t[1]); - return ct.fromTimestamp(e); - }(e.readTime)), n; -} -/** Encodes a document for storage locally. */ - - -function Qi(t, e) { - const n = e.key, - s = { - prefixPath: n.getCollectionPath().popLast().toArray(), - collectionGroup: n.collectionGroup, - documentId: n.path.lastSegment(), - readTime: ji(e.readTime), - hasCommittedMutations: e.hasCommittedMutations - }; - if (e.isFoundDocument()) s.document = function (t, e) { - return { - name: $s(t, e.key), - fields: e.data.value.mapValue.fields, - updateTime: xs(t, e.version.toTimestamp()) - }; - }(t.re, e);else if (e.isNoDocument()) s.noDocument = { - path: n.path.toArray(), - readTime: Wi(e.version) - };else { - if (!e.isUnknownDocument()) return L(); - s.unknownDocument = { - path: n.path.toArray(), - version: Wi(e.version) - }; - } - return s; -} - -function ji(t) { - const e = t.toTimestamp(); - return [e.seconds, e.nanoseconds]; -} - -function Wi(t) { - const e = t.toTimestamp(); - return { - seconds: e.seconds, - nanoseconds: e.nanoseconds - }; -} - -function zi(t) { - const e = new ut(t.seconds, t.nanoseconds); - return ct.fromTimestamp(e); -} -/** Encodes a batch of mutations into a DbMutationBatch for local storage. */ - -/** Decodes a DbMutationBatch into a MutationBatch */ - - -function Hi(t, e) { - const n = (e.baseMutations || []).map(e => Hs(t.re, e)); // Squash old transform mutations into existing patch or set mutations. - // The replacement of representing `transforms` with `update_transforms` - // on the SDK means that old `transform` mutations stored in IndexedDB need - // to be updated to `update_transforms`. - // TODO(b/174608374): Remove this code once we perform a schema migration. - - for (let t = 0; t < e.mutations.length - 1; ++t) { - const n = e.mutations[t]; - - if (t + 1 < e.mutations.length && void 0 !== e.mutations[t + 1].transform) { - const s = e.mutations[t + 1]; - n.updateTransforms = s.transform.fieldTransforms, e.mutations.splice(t + 1, 1), ++t; - } - } - - const s = e.mutations.map(e => Hs(t.re, e)), - i = ut.fromMillis(e.localWriteTimeMs); - return new Bi(e.batchId, i, n, s); -} -/** Decodes a DbTarget into TargetData */ - - -function Ji(t) { - const e = zi(t.readTime), - n = void 0 !== t.lastLimboFreeSnapshotVersion ? zi(t.lastLimboFreeSnapshotVersion) : ct.min(); - let s; - var i; - return void 0 !== t.query.documents ? (U(1 === (i = t.query).documents.length), s = dn(un(Us(i.documents[0])))) : s = function (t) { - return dn(Zs(t)); - }(t.query), new qi(s, t.targetId, 0 - /* Listen */ - , t.lastListenSequenceNumber, e, n, Xt.fromBase64String(t.resumeToken)); -} -/** Encodes TargetData into a DbTarget for storage locally. */ - - -function Yi(t, e) { - const n = Wi(e.snapshotVersion), - s = Wi(e.lastLimboFreeSnapshotVersion); - let i; - i = Le(e.target) ? Ys(t.re, e.target) : Xs(t.re, e.target); // We can't store the resumeToken as a ByteString in IndexedDb, so we - // convert it to a base64 string for storage. - - const r = e.resumeToken.toBase64(); // lastListenSequenceNumber is always 0 until we do real GC. - - return { - targetId: e.targetId, - canonicalId: Fe(e.target), - readTime: n, - resumeToken: r, - lastListenSequenceNumber: e.sequenceNumber, - lastLimboFreeSnapshotVersion: s, - query: i - }; -} -/** - * A helper function for figuring out what kind of query has been stored. - */ - -/** - * Encodes a `BundledQuery` from bundle proto to a Query object. - * - * This reconstructs the original query used to build the bundle being loaded, - * including features exists only in SDKs (for example: limit-to-last). - */ - - -function Xi(t) { - const e = Zs({ - parent: t.parent, - structuredQuery: t.structuredQuery - }); - return "LAST" === t.limitType ? _n(e, e.limit, "L" - /* Last */ - ) : e; -} -/** Encodes a NamedQuery proto object to a NamedQuery model object. */ - -/** Encodes a DbDocumentOverlay object to an Overlay model object. */ - - -function Zi(t, e) { - return new Ui(e.largestBatchId, Hs(t.re, e.overlayMutation)); -} -/** Decodes an Overlay model object into a DbDocumentOverlay object. */ - -/** - * Returns the DbDocumentOverlayKey corresponding to the given user and - * document key. - */ - - -function tr(t, e) { - const n = e.path.lastSegment(); - return [t, hi(e.path.popLast()), n]; -} - -function er(t, e, n, s) { - return { - indexId: t, - uid: e.uid || "", - sequenceNumber: n, - readTime: Wi(s.readTime), - documentKey: hi(s.documentKey.path), - largestBatchId: s.largestBatchId - }; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class nr { - getBundleMetadata(t, e) { - return sr(t).get(e).next(t => { - if (t) return { - id: (e = t).bundleId, - createTime: zi(e.createTime), - version: e.version - }; - /** Encodes a DbBundle to a BundleMetadata object. */ - - var e; - /** Encodes a BundleMetadata to a DbBundle. */ - }); - } - - saveBundleMetadata(t, e) { - return sr(t).put({ - bundleId: (n = e).id, - createTime: Wi(Ms(n.createTime)), - version: n.version - }); - var n; - /** Encodes a DbNamedQuery to a NamedQuery. */ - } - - getNamedQuery(t, e) { - return ir(t).get(e).next(t => { - if (t) return { - name: (e = t).name, - query: Xi(e.bundledQuery), - readTime: zi(e.readTime) - }; - var e; - /** Encodes a NamedQuery from a bundle proto to a DbNamedQuery. */ - }); - } - - saveNamedQuery(t, e) { - return ir(t).put(function (t) { - return { - name: t.name, - readTime: Wi(Ms(t.readTime)), - bundledQuery: t.bundledQuery - }; - }(e)); - } - -} -/** - * Helper to get a typed SimpleDbStore for the bundles object store. - */ - - -function sr(t) { - return $i(t, "bundles"); -} -/** - * Helper to get a typed SimpleDbStore for the namedQueries object store. - */ - - -function ir(t) { - return $i(t, "namedQueries"); -} -/** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Implementation of DocumentOverlayCache using IndexedDb. - */ - - -class rr { - /** - * @param serializer - The document serializer. - * @param userId - The userId for which we are accessing overlays. - */ - constructor(t, e) { - this.It = t, this.userId = e; - } - - static oe(t, e) { - const n = e.uid || ""; - return new rr(t, n); - } - - getOverlay(t, e) { - return or(t).get(tr(this.userId, e)).next(t => t ? Zi(this.It, t) : null); - } - - getOverlays(t, e) { - const n = fs(); - return Vt.forEach(e, e => this.getOverlay(t, e).next(t => { - null !== t && n.set(e, t); - })).next(() => n); - } - - saveOverlays(t, e, n) { - const s = []; - return n.forEach((n, i) => { - const r = new Ui(e, i); - s.push(this.ue(t, r)); - }), Vt.waitFor(s); - } - - removeOverlaysForBatchId(t, e, n) { - const s = new Set(); // Get the set of unique collection paths. - - e.forEach(t => s.add(hi(t.getCollectionPath()))); - const i = []; - return s.forEach(e => { - const s = IDBKeyRange.bound([this.userId, e, n], [this.userId, e, n + 1], - /*lowerOpen=*/ - !1, - /*upperOpen=*/ - !0); - i.push(or(t).Y("collectionPathOverlayIndex", s)); - }), Vt.waitFor(i); - } - - getOverlaysForCollection(t, e, n) { - const s = fs(), - i = hi(e), - r = IDBKeyRange.bound([this.userId, i, n], [this.userId, i, Number.POSITIVE_INFINITY], - /*lowerOpen=*/ - !0); - return or(t).W("collectionPathOverlayIndex", r).next(t => { - for (const e of t) { - const t = Zi(this.It, e); - s.set(t.getKey(), t); - } - - return s; - }); - } - - getOverlaysForCollectionGroup(t, e, n, s) { - const i = fs(); - let r; // We want batch IDs larger than `sinceBatchId`, and so the lower bound - // is not inclusive. - - const o = IDBKeyRange.bound([this.userId, e, n], [this.userId, e, Number.POSITIVE_INFINITY], - /*lowerOpen=*/ - !0); - return or(t).Z({ - index: "collectionGroupOverlayIndex", - range: o - }, (t, e, n) => { - // We do not want to return partial batch overlays, even if the size - // of the result set exceeds the given `count` argument. Therefore, we - // continue to aggregate results even after the result size exceeds - // `count` if there are more overlays from the `currentBatchId`. - const o = Zi(this.It, e); - i.size() < s || o.largestBatchId === r ? (i.set(o.getKey(), o), r = o.largestBatchId) : n.done(); - }).next(() => i); - } - - ue(t, e) { - return or(t).put(function (t, e, n) { - const [s, i, r] = tr(e, n.mutation.key); - return { - userId: e, - collectionPath: i, - documentId: r, - collectionGroup: n.mutation.key.getCollectionGroup(), - largestBatchId: n.largestBatchId, - overlayMutation: zs(t.re, n.mutation) - }; - }(this.It, this.userId, e)); - } - -} -/** - * Helper to get a typed SimpleDbStore for the document overlay object store. - */ - - -function or(t) { - return $i(t, "documentOverlays"); -} -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Note: This code is copied from the backend. Code that is not used by -// Firestore was removed. - -/** Firestore index value writer. */ - - -class ur { - constructor() {} // The write methods below short-circuit writing terminators for values - // containing a (terminating) truncated value. - // As an example, consider the resulting encoding for: - // ["bar", [2, "foo"]] -> (STRING, "bar", TERM, ARRAY, NUMBER, 2, STRING, "foo", TERM, TERM, TERM) - // ["bar", [2, truncated("foo")]] -> (STRING, "bar", TERM, ARRAY, NUMBER, 2, STRING, "foo", TRUNC) - // ["bar", truncated(["foo"])] -> (STRING, "bar", TERM, ARRAY. STRING, "foo", TERM, TRUNC) - - /** Writes an index value. */ - - - ce(t, e) { - this.ae(t, e), // Write separator to split index values - // (see go/firestore-storage-format#encodings). - e.he(); - } - - ae(t, e) { - if ("nullValue" in t) this.le(e, 5);else if ("booleanValue" in t) this.le(e, 10), e.fe(t.booleanValue ? 1 : 0);else if ("integerValue" in t) this.le(e, 15), e.fe(ee(t.integerValue));else if ("doubleValue" in t) { - const n = ee(t.doubleValue); - isNaN(n) ? this.le(e, 13) : (this.le(e, 15), ae(n) ? // -0.0, 0 and 0.0 are all considered the same - e.fe(0) : e.fe(n)); - } else if ("timestampValue" in t) { - const n = t.timestampValue; - this.le(e, 20), "string" == typeof n ? e.de(n) : (e.de(`${n.seconds || ""}`), e.fe(n.nanos || 0)); - } else if ("stringValue" in t) this._e(t.stringValue, e), this.we(e);else if ("bytesValue" in t) this.le(e, 30), e.me(ne(t.bytesValue)), this.we(e);else if ("referenceValue" in t) this.ge(t.referenceValue, e);else if ("geoPointValue" in t) { - const n = t.geoPointValue; - this.le(e, 45), e.fe(n.latitude || 0), e.fe(n.longitude || 0); - } else "mapValue" in t ? ve(t) ? this.le(e, Number.MAX_SAFE_INTEGER) : (this.ye(t.mapValue, e), this.we(e)) : "arrayValue" in t ? (this.pe(t.arrayValue, e), this.we(e)) : L(); - } - - _e(t, e) { - this.le(e, 25), this.Ie(t, e); - } - - Ie(t, e) { - e.de(t); - } - - ye(t, e) { - const n = t.fields || {}; - this.le(e, 55); - - for (const t of Object.keys(n)) this._e(t, e), this.ae(n[t], e); - } - - pe(t, e) { - const n = t.values || []; - this.le(e, 50); - - for (const t of n) this.ae(t, e); - } - - ge(t, e) { - this.le(e, 37); - dt.fromName(t).path.forEach(t => { - this.le(e, 60), this.Ie(t, e); - }); - } - - le(t, e) { - t.fe(e); - } - - we(t) { - // While the SDK does not implement truncation, the truncation marker is - // used to terminate all variable length values (which are strings, bytes, - // references, arrays and maps). - t.fe(2); - } - -} - -ur.Te = new ur(); -/** - * Counts the number of zeros in a byte. - * - * Visible for testing. - */ - -function cr(t) { - if (0 === t) return 8; - let e = 0; - return t >> 4 == 0 && ( // Test if the first four bits are zero. - e += 4, t <<= 4), t >> 6 == 0 && ( // Test if the first two (or next two) bits are zero. - e += 2, t <<= 2), t >> 7 == 0 && ( // Test if the remaining bit is zero. - e += 1), e; -} -/** Counts the number of leading zeros in the given byte array. */ - -/** - * Returns the number of bytes required to store "value". Leading zero bytes - * are skipped. - */ - - -function ar(t) { - // This is just the number of bytes for the unsigned representation of the number. - const e = 64 - function (t) { - let e = 0; - - for (let n = 0; n < 8; ++n) { - const s = cr(255 & t[n]); - if (e += s, 8 !== s) break; - } - - return e; - }(t); - - return Math.ceil(e / 8); -} -/** - * OrderedCodeWriter is a minimal-allocation implementation of the writing - * behavior defined by the backend. - * - * The code is ported from its Java counterpart. - */ - - -class hr { - constructor() { - this.buffer = new Uint8Array(1024), this.position = 0; - } - - Ee(t) { - const e = t[Symbol.iterator](); - let n = e.next(); - - for (; !n.done;) this.Ae(n.value), n = e.next(); - - this.Re(); - } - - be(t) { - const e = t[Symbol.iterator](); - let n = e.next(); - - for (; !n.done;) this.Pe(n.value), n = e.next(); - - this.ve(); - } - /** Writes utf8 bytes into this byte sequence, ascending. */ - - - Ve(t) { - for (const e of t) { - const t = e.charCodeAt(0); - if (t < 128) this.Ae(t);else if (t < 2048) this.Ae(960 | t >>> 6), this.Ae(128 | 63 & t);else if (e < "\ud800" || "\udbff" < e) this.Ae(480 | t >>> 12), this.Ae(128 | 63 & t >>> 6), this.Ae(128 | 63 & t);else { - const t = e.codePointAt(0); - this.Ae(240 | t >>> 18), this.Ae(128 | 63 & t >>> 12), this.Ae(128 | 63 & t >>> 6), this.Ae(128 | 63 & t); - } - } - - this.Re(); - } - /** Writes utf8 bytes into this byte sequence, descending */ - - - Se(t) { - for (const e of t) { - const t = e.charCodeAt(0); - if (t < 128) this.Pe(t);else if (t < 2048) this.Pe(960 | t >>> 6), this.Pe(128 | 63 & t);else if (e < "\ud800" || "\udbff" < e) this.Pe(480 | t >>> 12), this.Pe(128 | 63 & t >>> 6), this.Pe(128 | 63 & t);else { - const t = e.codePointAt(0); - this.Pe(240 | t >>> 18), this.Pe(128 | 63 & t >>> 12), this.Pe(128 | 63 & t >>> 6), this.Pe(128 | 63 & t); - } - } - - this.ve(); - } - - De(t) { - // Values are encoded with a single byte length prefix, followed by the - // actual value in big-endian format with leading 0 bytes dropped. - const e = this.Ce(t), - n = ar(e); - this.xe(1 + n), this.buffer[this.position++] = 255 & n; // Write the length - - for (let t = e.length - n; t < e.length; ++t) this.buffer[this.position++] = 255 & e[t]; - } - - Ne(t) { - // Values are encoded with a single byte length prefix, followed by the - // inverted value in big-endian format with leading 0 bytes dropped. - const e = this.Ce(t), - n = ar(e); - this.xe(1 + n), this.buffer[this.position++] = ~(255 & n); // Write the length - - for (let t = e.length - n; t < e.length; ++t) this.buffer[this.position++] = ~(255 & e[t]); - } - /** - * Writes the "infinity" byte sequence that sorts after all other byte - * sequences written in ascending order. - */ - - - ke() { - this.Me(255), this.Me(255); - } - /** - * Writes the "infinity" byte sequence that sorts before all other byte - * sequences written in descending order. - */ - - - Oe() { - this.Fe(255), this.Fe(255); - } - /** - * Resets the buffer such that it is the same as when it was newly - * constructed. - */ - - - reset() { - this.position = 0; - } - - seed(t) { - this.xe(t.length), this.buffer.set(t, this.position), this.position += t.length; - } - /** Makes a copy of the encoded bytes in this buffer. */ - - - $e() { - return this.buffer.slice(0, this.position); - } - /** - * Encodes `val` into an encoding so that the order matches the IEEE 754 - * floating-point comparison results with the following exceptions: - * -0.0 < 0.0 - * all non-NaN < NaN - * NaN = NaN - */ - - - Ce(t) { - const e = - /** Converts a JavaScript number to a byte array (using big endian encoding). */ - function (t) { - const e = new DataView(new ArrayBuffer(8)); - return e.setFloat64(0, t, - /* littleEndian= */ - !1), new Uint8Array(e.buffer); - }(t), - n = 0 != (128 & e[0]); // Check if the first bit is set. We use a bit mask since value[0] is - // encoded as a number from 0 to 255. - // Revert the two complement to get natural ordering - - - e[0] ^= n ? 255 : 128; - - for (let t = 1; t < e.length; ++t) e[t] ^= n ? 255 : 0; - - return e; - } - /** Writes a single byte ascending to the buffer. */ - - - Ae(t) { - const e = 255 & t; - 0 === e ? (this.Me(0), this.Me(255)) : 255 === e ? (this.Me(255), this.Me(0)) : this.Me(e); - } - /** Writes a single byte descending to the buffer. */ - - - Pe(t) { - const e = 255 & t; - 0 === e ? (this.Fe(0), this.Fe(255)) : 255 === e ? (this.Fe(255), this.Fe(0)) : this.Fe(t); - } - - Re() { - this.Me(0), this.Me(1); - } - - ve() { - this.Fe(0), this.Fe(1); - } - - Me(t) { - this.xe(1), this.buffer[this.position++] = t; - } - - Fe(t) { - this.xe(1), this.buffer[this.position++] = ~t; - } - - xe(t) { - const e = t + this.position; - if (e <= this.buffer.length) return; // Try doubling. - - let n = 2 * this.buffer.length; // Still not big enough? Just allocate the right size. - - n < e && (n = e); // Create the new buffer. - - const s = new Uint8Array(n); - s.set(this.buffer), // copy old data - this.buffer = s; - } - -} - -class lr { - constructor(t) { - this.Be = t; - } - - me(t) { - this.Be.Ee(t); - } - - de(t) { - this.Be.Ve(t); - } - - fe(t) { - this.Be.De(t); - } - - he() { - this.Be.ke(); - } - -} - -class fr { - constructor(t) { - this.Be = t; - } - - me(t) { - this.Be.be(t); - } - - de(t) { - this.Be.Se(t); - } - - fe(t) { - this.Be.Ne(t); - } - - he() { - this.Be.Oe(); - } - -} -/** - * Implements `DirectionalIndexByteEncoder` using `OrderedCodeWriter` for the - * actual encoding. - */ - - -class dr { - constructor() { - this.Be = new hr(), this.Le = new lr(this.Be), this.Ue = new fr(this.Be); - } - - seed(t) { - this.Be.seed(t); - } - - qe(t) { - return 0 - /* ASCENDING */ - === t ? this.Le : this.Ue; - } - - $e() { - return this.Be.$e(); - } - - reset() { - this.Be.reset(); - } - -} -/** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** Represents an index entry saved by the SDK in persisted storage. */ - - -class _r { - constructor(t, e, n, s) { - this.indexId = t, this.documentKey = e, this.arrayValue = n, this.directionalValue = s; - } - /** - * Returns an IndexEntry entry that sorts immediately after the current - * directional value. - */ - - - Ke() { - const t = this.directionalValue.length, - e = 0 === t || 255 === this.directionalValue[t - 1] ? t + 1 : t, - n = new Uint8Array(e); - return n.set(this.directionalValue, 0), e !== t ? n.set([0], this.directionalValue.length) : ++n[n.length - 1], new _r(this.indexId, this.documentKey, this.arrayValue, n); - } - -} - -function wr(t, e) { - let n = t.indexId - e.indexId; - return 0 !== n ? n : (n = mr(t.arrayValue, e.arrayValue), 0 !== n ? n : (n = mr(t.directionalValue, e.directionalValue), 0 !== n ? n : dt.comparator(t.documentKey, e.documentKey))); -} - -function mr(t, e) { - for (let n = 0; n < t.length && n < e.length; ++n) { - const s = t[n] - e[n]; - if (0 !== s) return s; - } - - return t.length - e.length; -} -/** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A light query planner for Firestore. - * - * This class matches a `FieldIndex` against a Firestore Query `Target`. It - * determines whether a given index can be used to serve the specified target. - * - * The following table showcases some possible index configurations: - * - * Query | Index - * ----------------------------------------------------------------------------- - * where('a', '==', 'a').where('b', '==', 'b') | a ASC, b DESC - * where('a', '==', 'a').where('b', '==', 'b') | a ASC - * where('a', '==', 'a').where('b', '==', 'b') | b DESC - * where('a', '>=', 'a').orderBy('a') | a ASC - * where('a', '>=', 'a').orderBy('a', 'desc') | a DESC - * where('a', '>=', 'a').orderBy('a').orderBy('b') | a ASC, b ASC - * where('a', '>=', 'a').orderBy('a').orderBy('b') | a ASC - * where('a', 'array-contains', 'a').orderBy('b') | a CONTAINS, b ASCENDING - * where('a', 'array-contains', 'a').orderBy('b') | a CONTAINS - */ - - -class gr { - constructor(t) { - this.collectionId = null != t.collectionGroup ? t.collectionGroup : t.path.lastSegment(), this.Ge = t.orderBy, this.Qe = []; - - for (const e of t.filters) { - const t = e; - t.dt() ? this.je = t : this.Qe.push(t); - } - } - /** - * Returns whether the index can be used to serve the TargetIndexMatcher's - * target. - * - * An index is considered capable of serving the target when: - * - The target uses all index segments for its filters and orderBy clauses. - * The target can have additional filter and orderBy clauses, but not - * fewer. - * - If an ArrayContains/ArrayContainsAnyfilter is used, the index must also - * have a corresponding `CONTAINS` segment. - * - All directional index segments can be mapped to the target as a series of - * equality filters, a single inequality filter and a series of orderBy - * clauses. - * - The segments that represent the equality filters may appear out of order. - * - The optional segment for the inequality filter must appear after all - * equality segments. - * - The segments that represent that orderBy clause of the target must appear - * in order after all equality and inequality segments. Single orderBy - * clauses cannot be skipped, but a continuous orderBy suffix may be - * omitted. - */ - - - We(t) { - // If there is an array element, find a matching filter. - const e = wt(t); - if (void 0 !== e && !this.ze(e)) return !1; - const n = mt(t); - let s = 0, - i = 0; // Process all equalities first. Equalities can appear out of order. - - for (; s < n.length && this.ze(n[s]); ++s); // If we already have processed all segments, all segments are used to serve - // the equality filters and we do not need to map any segments to the - // target's inequality and orderBy clauses. - - - if (s === n.length) return !0; // If there is an inequality filter, the next segment must match both the - // filter and the first orderBy clause. - - if (void 0 !== this.je) { - const t = n[s]; - if (!this.He(this.je, t) || !this.Je(this.Ge[i++], t)) return !1; - ++s; - } // All remaining segments need to represent the prefix of the target's - // orderBy. - - - for (; s < n.length; ++s) { - const t = n[s]; - if (i >= this.Ge.length || !this.Je(this.Ge[i++], t)) return !1; - } - - return !0; - } - - ze(t) { - for (const e of this.Qe) if (this.He(e, t)) return !0; - - return !1; - } - - He(t, e) { - if (void 0 === t || !t.field.isEqual(e.fieldPath)) return !1; - const n = "array-contains" - /* ARRAY_CONTAINS */ - === t.op || "array-contains-any" - /* ARRAY_CONTAINS_ANY */ - === t.op; - return 2 - /* CONTAINS */ - === e.kind === n; - } - - Je(t, e) { - return !!t.field.isEqual(e.fieldPath) && (0 - /* ASCENDING */ - === e.kind && "asc" - /* ASCENDING */ - === t.dir || 1 - /* DESCENDING */ - === e.kind && "desc" - /* DESCENDING */ - === t.dir); - } - -} -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * An in-memory implementation of IndexManager. - */ - - -class yr { - constructor() { - this.Ye = new pr(); - } - - addToCollectionParentIndex(t, e) { - return this.Ye.add(e), Vt.resolve(); - } - - getCollectionParents(t, e) { - return Vt.resolve(this.Ye.getEntries(e)); - } - - addFieldIndex(t, e) { - // Field indices are not supported with memory persistence. - return Vt.resolve(); - } - - deleteFieldIndex(t, e) { - // Field indices are not supported with memory persistence. - return Vt.resolve(); - } - - getDocumentsMatchingTarget(t, e) { - // Field indices are not supported with memory persistence. - return Vt.resolve(null); - } - - getIndexType(t, e) { - // Field indices are not supported with memory persistence. - return Vt.resolve(0 - /* NONE */ - ); - } - - getFieldIndexes(t, e) { - // Field indices are not supported with memory persistence. - return Vt.resolve([]); - } - - getNextCollectionGroupToUpdate(t) { - // Field indices are not supported with memory persistence. - return Vt.resolve(null); - } - - getMinOffset(t, e) { - return Vt.resolve(At.min()); - } - - getMinOffsetFromCollectionGroup(t, e) { - return Vt.resolve(At.min()); - } - - updateCollectionGroup(t, e, n) { - // Field indices are not supported with memory persistence. - return Vt.resolve(); - } - - updateIndexEntries(t, e) { - // Field indices are not supported with memory persistence. - return Vt.resolve(); - } - -} -/** - * Internal implementation of the collection-parent index exposed by MemoryIndexManager. - * Also used for in-memory caching by IndexedDbIndexManager and initial index population - * in indexeddb_schema.ts - */ - - -class pr { - constructor() { - this.index = {}; - } // Returns false if the entry already existed. - - - add(t) { - const e = t.lastSegment(), - n = t.popLast(), - s = this.index[e] || new Wt(ht.comparator), - i = !s.has(n); - return this.index[e] = s.add(n), i; - } - - has(t) { - const e = t.lastSegment(), - n = t.popLast(), - s = this.index[e]; - return s && s.has(n); - } - - getEntries(t) { - return (this.index[t] || new Wt(ht.comparator)).toArray(); - } - -} -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const Ir = new Uint8Array(0); -/** - * A persisted implementation of IndexManager. - * - * PORTING NOTE: Unlike iOS and Android, the Web SDK does not memoize index - * data as it supports multi-tab access. - */ - -class Tr { - constructor(t, e) { - this.user = t, this.databaseId = e, - /** - * An in-memory copy of the index entries we've already written since the SDK - * launched. Used to avoid re-writing the same entry repeatedly. - * - * This is *NOT* a complete cache of what's in persistence and so can never be - * used to satisfy reads. - */ - this.Xe = new pr(), - /** - * Maps from a target to its equivalent list of sub-targets. Each sub-target - * contains only one term from the target's disjunctive normal form (DNF). - */ - this.Ze = new os(t => Fe(t), (t, e) => Be(t, e)), this.uid = t.uid || ""; - } - /** - * Adds a new entry to the collection parent index. - * - * Repeated calls for the same collectionPath should be avoided within a - * transaction as IndexedDbIndexManager only caches writes once a transaction - * has been committed. - */ - - - addToCollectionParentIndex(t, e) { - if (!this.Xe.has(e)) { - const n = e.lastSegment(), - s = e.popLast(); - t.addOnCommittedListener(() => { - // Add the collection to the in memory cache only if the transaction was - // successfully committed. - this.Xe.add(e); - }); - const i = { - collectionId: n, - parent: hi(s) - }; - return Er(t).put(i); - } - - return Vt.resolve(); - } - - getCollectionParents(t, e) { - const n = [], - s = IDBKeyRange.bound([e, ""], [ot(e), ""], - /*lowerOpen=*/ - !1, - /*upperOpen=*/ - !0); - return Er(t).W(s).next(t => { - for (const s of t) { - // This collectionId guard shouldn't be necessary (and isn't as long - // as we're running in a real browser), but there's a bug in - // indexeddbshim that breaks our range in our tests running in node: - // https://github.com/axemclion/IndexedDBShim/issues/334 - if (s.collectionId !== e) break; - n.push(di(s.parent)); - } - - return n; - }); - } - - addFieldIndex(t, e) { - // TODO(indexing): Verify that the auto-incrementing index ID works in - // Safari & Firefox. - const n = Rr(t), - s = function (t) { - return { - indexId: t.indexId, - collectionGroup: t.collectionGroup, - fields: t.fields.map(t => [t.fieldPath.canonicalString(), t.kind]) - }; - }(e); - - delete s.indexId; // `indexId` is auto-populated by IndexedDb - - const i = n.add(s); - - if (e.indexState) { - const n = br(t); - return i.next(t => { - n.put(er(t, this.user, e.indexState.sequenceNumber, e.indexState.offset)); - }); - } - - return i.next(); - } - - deleteFieldIndex(t, e) { - const n = Rr(t), - s = br(t), - i = Ar(t); - return n.delete(e.indexId).next(() => s.delete(IDBKeyRange.bound([e.indexId], [e.indexId + 1], - /*lowerOpen=*/ - !1, - /*upperOpen=*/ - !0))).next(() => i.delete(IDBKeyRange.bound([e.indexId], [e.indexId + 1], - /*lowerOpen=*/ - !1, - /*upperOpen=*/ - !0))); - } - - getDocumentsMatchingTarget(t, e) { - const n = Ar(t); - let s = !0; - const i = new Map(); - return Vt.forEach(this.tn(e), e => this.en(t, e).next(t => { - s && (s = !!t), i.set(e, t); - })).next(() => { - if (s) { - let t = gs(); - const s = []; - return Vt.forEach(i, (i, r) => { - var o; - O("IndexedDbIndexManager", `Using index ${(o = i, `id=${o.indexId}|cg=${o.collectionGroup}|f=${o.fields.map(t => `${t.fieldPath}:${t.kind}`).join(",")}`)} to execute ${Fe(e)}`); - - const u = function (t, e) { - const n = wt(e); - if (void 0 === n) return null; - - for (const e of Ue(t, n.fieldPath)) switch (e.op) { - case "array-contains-any" - /* ARRAY_CONTAINS_ANY */ - : - return e.value.arrayValue.values || []; - - case "array-contains" - /* ARRAY_CONTAINS */ - : - return [e.value]; - // Remaining filters are not array filters. - } - - return null; - } - /** - * Returns the list of values that are used in != or NOT_IN filters. Returns - * `null` if there are no such filters. - */ - (r, i), - c = function (t, e) { - const n = new Map(); - - for (const s of mt(e)) for (const e of Ue(t, s.fieldPath)) switch (e.op) { - case "==" - /* EQUAL */ - : - case "in" - /* IN */ - : - // Encode equality prefix, which is encoded in the index value before - // the inequality (e.g. `a == 'a' && b != 'b'` is encoded to - // `value != 'ab'`). - n.set(s.fieldPath.canonicalString(), e.value); - break; - - case "not-in" - /* NOT_IN */ - : - case "!=" - /* NOT_EQUAL */ - : - // NotIn/NotEqual is always a suffix. There cannot be any remaining - // segments and hence we can return early here. - return n.set(s.fieldPath.canonicalString(), e.value), Array.from(n.values()); - // Remaining filters cannot be used as notIn bounds. - } - - return null; - } - /** - * Returns a lower bound of field values that can be used as a starting point to - * scan the index defined by `fieldIndex`. Returns `MIN_VALUE` if no lower bound - * exists. - */ - (r, i), - a = function (t, e) { - const n = []; - let s = !0; // For each segment, retrieve a lower bound if there is a suitable filter or - // startAt. - - for (const i of mt(e)) { - const e = 0 - /* ASCENDING */ - === i.kind ? qe(t, i.fieldPath, t.startAt) : Ke(t, i.fieldPath, t.startAt); - n.push(e.value), s && (s = e.inclusive); - } - - return new Ze(n, s); - } - /** - * Returns an upper bound of field values that can be used as an ending point - * when scanning the index defined by `fieldIndex`. Returns `MAX_VALUE` if no - * upper bound exists. - */ - (r, i), - h = function (t, e) { - const n = []; - let s = !0; // For each segment, retrieve an upper bound if there is a suitable filter or - // endAt. - - for (const i of mt(e)) { - const e = 0 - /* ASCENDING */ - === i.kind ? Ke(t, i.fieldPath, t.endAt) : qe(t, i.fieldPath, t.endAt); - n.push(e.value), s && (s = e.inclusive); - } - - return new Ze(n, s); - }(r, i), - l = this.nn(i, r, a), - f = this.nn(i, r, h), - d = this.sn(i, r, c), - _ = this.rn(i.indexId, u, l, a.inclusive, f, h.inclusive, d); - - return Vt.forEach(_, i => n.J(i, e.limit).next(e => { - e.forEach(e => { - const n = dt.fromSegments(e.documentKey); - t.has(n) || (t = t.add(n), s.push(n)); - }); - })); - }).next(() => s); - } - - return Vt.resolve(null); - }); - } - - tn(t) { - let e = this.Ze.get(t); - return e || ( // TODO(orquery): Implement DNF transform - e = [t], this.Ze.set(t, e), e); - } - /** - * Constructs a key range query on `DbIndexEntryStore` that unions all - * bounds. - */ - - - rn(t, e, n, s, i, r, o) { - // The number of total index scans we union together. This is similar to a - // distributed normal form, but adapted for array values. We create a single - // index range per value in an ARRAY_CONTAINS or ARRAY_CONTAINS_ANY filter - // combined with the values from the query bounds. - const u = (null != e ? e.length : 1) * Math.max(n.length, i.length), - c = u / (null != e ? e.length : 1), - a = []; - - for (let h = 0; h < u; ++h) { - const u = e ? this.on(e[h / c]) : Ir, - l = this.un(t, u, n[h % c], s), - f = this.cn(t, u, i[h % c], r), - d = o.map(e => this.un(t, u, e, - /* inclusive= */ - !0)); - a.push(...this.createRange(l, f, d)); - } - - return a; - } - /** Generates the lower bound for `arrayValue` and `directionalValue`. */ - - - un(t, e, n, s) { - const i = new _r(t, dt.empty(), e, n); - return s ? i : i.Ke(); - } - /** Generates the upper bound for `arrayValue` and `directionalValue`. */ - - - cn(t, e, n, s) { - const i = new _r(t, dt.empty(), e, n); - return s ? i.Ke() : i; - } - - en(t, e) { - const n = new gr(e), - s = null != e.collectionGroup ? e.collectionGroup : e.path.lastSegment(); - return this.getFieldIndexes(t, s).next(t => { - // Return the index with the most number of segments. - let e = null; - - for (const s of t) { - n.We(s) && (!e || s.fields.length > e.fields.length) && (e = s); - } - - return e; - }); - } - - getIndexType(t, e) { - let n = 2 - /* FULL */ - ; - return Vt.forEach(this.tn(e), e => this.en(t, e).next(t => { - t ? 0 - /* NONE */ - !== n && t.fields.length < function (t) { - let e = new Wt(ft.comparator), - n = !1; - - for (const s of t.filters) { - // TODO(orquery): Use the flattened filters here - const t = s; // __name__ is not an explicit segment of any index, so we don't need to - // count it. - - t.field.isKeyField() || ( // ARRAY_CONTAINS or ARRAY_CONTAINS_ANY filters must be counted separately. - // For instance, it is possible to have an index for "a ARRAY a ASC". Even - // though these are on the same field, they should be counted as two - // separate segments in an index. - "array-contains" - /* ARRAY_CONTAINS */ - === t.op || "array-contains-any" - /* ARRAY_CONTAINS_ANY */ - === t.op ? n = !0 : e = e.add(t.field)); - } - - for (const n of t.orderBy) // __name__ is not an explicit segment of any index, so we don't need to - // count it. - n.field.isKeyField() || (e = e.add(n.field)); - - return e.size + (n ? 1 : 0); - }(e) && (n = 1 - /* PARTIAL */ - ) : n = 0 - /* NONE */ - ; - })).next(() => n); - } - /** - * Returns the byte encoded form of the directional values in the field index. - * Returns `null` if the document does not have all fields specified in the - * index. - */ - - - an(t, e) { - const n = new dr(); - - for (const s of mt(t)) { - const t = e.data.field(s.fieldPath); - if (null == t) return null; - const i = n.qe(s.kind); - ur.Te.ce(t, i); - } - - return n.$e(); - } - /** Encodes a single value to the ascending index format. */ - - - on(t) { - const e = new dr(); - return ur.Te.ce(t, e.qe(0 - /* ASCENDING */ - )), e.$e(); - } - /** - * Returns an encoded form of the document key that sorts based on the key - * ordering of the field index. - */ - - - hn(t, e) { - const n = new dr(); - return ur.Te.ce(Ie(this.databaseId, e), n.qe(function (t) { - const e = mt(t); - return 0 === e.length ? 0 - /* ASCENDING */ - : e[e.length - 1].kind; - }(t))), n.$e(); - } - /** - * Encodes the given field values according to the specification in `target`. - * For IN queries, a list of possible values is returned. - */ - - - sn(t, e, n) { - if (null === n) return []; - let s = []; - s.push(new dr()); - let i = 0; - - for (const r of mt(t)) { - const t = n[i++]; - - for (const n of s) if (this.ln(e, r.fieldPath) && Ee(t)) s = this.fn(s, r, t);else { - const e = n.qe(r.kind); - ur.Te.ce(t, e); - } - } - - return this.dn(s); - } - /** - * Encodes the given bounds according to the specification in `target`. For IN - * queries, a list of possible values is returned. - */ - - - nn(t, e, n) { - return this.sn(t, e, n.position); - } - /** Returns the byte representation for the provided encoders. */ - - - dn(t) { - const e = []; - - for (let n = 0; n < t.length; ++n) e[n] = t[n].$e(); - - return e; - } - /** - * Creates a separate encoder for each element of an array. - * - * The method appends each value to all existing encoders (e.g. filter("a", - * "==", "a1").filter("b", "in", ["b1", "b2"]) becomes ["a1,b1", "a1,b2"]). A - * list of new encoders is returned. - */ - - - fn(t, e, n) { - const s = [...t], - i = []; - - for (const t of n.arrayValue.values || []) for (const n of s) { - const s = new dr(); - s.seed(n.$e()), ur.Te.ce(t, s.qe(e.kind)), i.push(s); - } - - return i; - } - - ln(t, e) { - return !!t.filters.find(t => t instanceof Ge && t.field.isEqual(e) && ("in" - /* IN */ - === t.op || "not-in" - /* NOT_IN */ - === t.op)); - } - - getFieldIndexes(t, e) { - const n = Rr(t), - s = br(t); - return (e ? n.W("collectionGroupIndex", IDBKeyRange.bound(e, e)) : n.W()).next(t => { - const e = []; - return Vt.forEach(t, t => s.get([t.indexId, this.uid]).next(n => { - e.push(function (t, e) { - const n = e ? new It(e.sequenceNumber, new At(zi(e.readTime), new dt(di(e.documentKey)), e.largestBatchId)) : It.empty(), - s = t.fields.map(_ref => { - let [t, e] = _ref; - return new yt(ft.fromServerFormat(t), e); - }); - return new _t(t.indexId, t.collectionGroup, s, n); - }(t, n)); - })).next(() => e); - }); - } - - getNextCollectionGroupToUpdate(t) { - return this.getFieldIndexes(t).next(t => 0 === t.length ? null : (t.sort((t, e) => { - const n = t.indexState.sequenceNumber - e.indexState.sequenceNumber; - return 0 !== n ? n : it(t.collectionGroup, e.collectionGroup); - }), t[0].collectionGroup)); - } - - updateCollectionGroup(t, e, n) { - const s = Rr(t), - i = br(t); - return this._n(t).next(t => s.W("collectionGroupIndex", IDBKeyRange.bound(e, e)).next(e => Vt.forEach(e, e => i.put(er(e.indexId, this.user, t, n))))); - } - - updateIndexEntries(t, e) { - // Porting Note: `getFieldIndexes()` on Web does not cache index lookups as - // it could be used across different IndexedDB transactions. As any cached - // data might be invalidated by other multi-tab clients, we can only trust - // data within a single IndexedDB transaction. We therefore add a cache - // here. - const n = new Map(); - return Vt.forEach(e, (e, s) => { - const i = n.get(e.collectionGroup); - return (i ? Vt.resolve(i) : this.getFieldIndexes(t, e.collectionGroup)).next(i => (n.set(e.collectionGroup, i), Vt.forEach(i, n => this.wn(t, e, n).next(e => { - const i = this.mn(s, n); - return e.isEqual(i) ? Vt.resolve() : this.gn(t, s, n, e, i); - })))); - }); - } - - yn(t, e, n, s) { - return Ar(t).put({ - indexId: s.indexId, - uid: this.uid, - arrayValue: s.arrayValue, - directionalValue: s.directionalValue, - orderedDocumentKey: this.hn(n, e.key), - documentKey: e.key.path.toArray() - }); - } - - pn(t, e, n, s) { - return Ar(t).delete([s.indexId, this.uid, s.arrayValue, s.directionalValue, this.hn(n, e.key), e.key.path.toArray()]); - } - - wn(t, e, n) { - const s = Ar(t); - let i = new Wt(wr); - return s.Z({ - index: "documentKeyIndex", - range: IDBKeyRange.only([n.indexId, this.uid, this.hn(n, e)]) - }, (t, s) => { - i = i.add(new _r(n.indexId, e, s.arrayValue, s.directionalValue)); - }).next(() => i); - } - /** Creates the index entries for the given document. */ - - - mn(t, e) { - let n = new Wt(wr); - const s = this.an(e, t); - if (null == s) return n; - const i = wt(e); - - if (null != i) { - const r = t.data.field(i.fieldPath); - if (Ee(r)) for (const i of r.arrayValue.values || []) n = n.add(new _r(e.indexId, t.key, this.on(i), s)); - } else n = n.add(new _r(e.indexId, t.key, Ir, s)); - - return n; - } - /** - * Updates the index entries for the provided document by deleting entries - * that are no longer referenced in `newEntries` and adding all newly added - * entries. - */ - - - gn(t, e, n, s, i) { - O("IndexedDbIndexManager", "Updating index entries for document '%s'", e.key); - const r = []; - return function (t, e, n, s, i) { - const r = t.getIterator(), - o = e.getIterator(); - let u = Ht(r), - c = Ht(o); // Walk through the two sets at the same time, using the ordering defined by - // `comparator`. - - for (; u || c;) { - let t = !1, - e = !1; - - if (u && c) { - const s = n(u, c); - s < 0 ? // The element was removed if the next element in our ordered - // walkthrough is only in `before`. - e = !0 : s > 0 && ( // The element was added if the next element in our ordered walkthrough - // is only in `after`. - t = !0); - } else null != u ? e = !0 : t = !0; - - t ? (s(c), c = Ht(o)) : e ? (i(u), u = Ht(r)) : (u = Ht(r), c = Ht(o)); - } - }(s, i, wr, - /* onAdd= */ - s => { - r.push(this.yn(t, e, n, s)); - }, - /* onRemove= */ - s => { - r.push(this.pn(t, e, n, s)); - }), Vt.waitFor(r); - } - - _n(t) { - let e = 1; - return br(t).Z({ - index: "sequenceNumberIndex", - reverse: !0, - range: IDBKeyRange.upperBound([this.uid, Number.MAX_SAFE_INTEGER]) - }, (t, n, s) => { - s.done(), e = n.sequenceNumber + 1; - }).next(() => e); - } - /** - * Returns a new set of IDB ranges that splits the existing range and excludes - * any values that match the `notInValue` from these ranges. As an example, - * '[foo > 2 && foo != 3]` becomes `[foo > 2 && < 3, foo > 3]`. - */ - - - createRange(t, e, n) { - // The notIn values need to be sorted and unique so that we can return a - // sorted set of non-overlapping ranges. - n = n.sort((t, e) => wr(t, e)).filter((t, e, n) => !e || 0 !== wr(t, n[e - 1])); - const s = []; - s.push(t); - - for (const i of n) { - const n = wr(i, t), - r = wr(i, e); - if (0 === n) // `notInValue` is the lower bound. We therefore need to raise the bound - // to the next value. - s[0] = t.Ke();else if (n > 0 && r < 0) // `notInValue` is in the middle of the range - s.push(i), s.push(i.Ke());else if (r > 0) // `notInValue` (and all following values) are out of the range - break; - } - - s.push(e); - const i = []; - - for (let t = 0; t < s.length; t += 2) i.push(IDBKeyRange.bound([s[t].indexId, this.uid, s[t].arrayValue, s[t].directionalValue, Ir, []], [s[t + 1].indexId, this.uid, s[t + 1].arrayValue, s[t + 1].directionalValue, Ir, []])); - - return i; - } - - getMinOffsetFromCollectionGroup(t, e) { - return this.getFieldIndexes(t, e).next(Pr); - } - - getMinOffset(t, e) { - return Vt.mapArray(this.tn(e), e => this.en(t, e).next(t => t || L())).next(Pr); - } - -} -/** - * Helper to get a typed SimpleDbStore for the collectionParents - * document store. - */ - - -function Er(t) { - return $i(t, "collectionParents"); -} -/** - * Helper to get a typed SimpleDbStore for the index entry object store. - */ - - -function Ar(t) { - return $i(t, "indexEntries"); -} -/** - * Helper to get a typed SimpleDbStore for the index configuration object store. - */ - - -function Rr(t) { - return $i(t, "indexConfiguration"); -} -/** - * Helper to get a typed SimpleDbStore for the index state object store. - */ - - -function br(t) { - return $i(t, "indexState"); -} - -function Pr(t) { - U(0 !== t.length); - let e = t[0].indexState.offset, - n = e.largestBatchId; - - for (let s = 1; s < t.length; s++) { - const i = t[s].indexState.offset; - Rt(i, e) < 0 && (e = i), n < i.largestBatchId && (n = i.largestBatchId); - } - - return new At(e.readTime, e.documentKey, n); -} -/** - * @license - * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const vr = { - didRun: !1, - sequenceNumbersCollected: 0, - targetsRemoved: 0, - documentsRemoved: 0 -}; - -class Vr { - constructor( // When we attempt to collect, we will only do so if the cache size is greater than this - // threshold. Passing `COLLECTION_DISABLED` here will cause collection to always be skipped. - t, // The percentage of sequence numbers that we will attempt to collect - e, // A cap on the total number of sequence numbers that will be collected. This prevents - // us from collecting a huge number of sequence numbers if the cache has grown very large. - n) { - this.cacheSizeCollectionThreshold = t, this.percentileToCollect = e, this.maximumSequenceNumbersToCollect = n; - } - - static withCacheSize(t) { - return new Vr(t, Vr.DEFAULT_COLLECTION_PERCENTILE, Vr.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Delete a mutation batch and the associated document mutations. - * @returns A PersistencePromise of the document mutations that were removed. - */ - - -function Sr(t, e, n) { - const s = t.store("mutations"), - i = t.store("documentMutations"), - r = [], - o = IDBKeyRange.only(n.batchId); - let u = 0; - const c = s.Z({ - range: o - }, (t, e, n) => (u++, n.delete())); - r.push(c.next(() => { - U(1 === u); - })); - const a = []; - - for (const t of n.mutations) { - const s = mi(e, t.key.path, n.batchId); - r.push(i.delete(s)), a.push(t.key); - } - - return Vt.waitFor(r).next(() => a); -} -/** - * Returns an approximate size for the given document. - */ - - -function Dr(t) { - if (!t) return 0; - let e; - if (t.document) e = t.document;else if (t.unknownDocument) e = t.unknownDocument;else { - if (!t.noDocument) throw L(); - e = t.noDocument; - } - return JSON.stringify(e).length; -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** A mutation queue for a specific user, backed by IndexedDB. */ - - -Vr.DEFAULT_COLLECTION_PERCENTILE = 10, Vr.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT = 1e3, Vr.DEFAULT = new Vr(41943040, Vr.DEFAULT_COLLECTION_PERCENTILE, Vr.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT), Vr.DISABLED = new Vr(-1, 0, 0); - -class Cr { - constructor( - /** - * The normalized userId (e.g. null UID => "" userId) used to store / - * retrieve mutations. - */ - t, e, n, s) { - this.userId = t, this.It = e, this.indexManager = n, this.referenceDelegate = s, - /** - * Caches the document keys for pending mutation batches. If the mutation - * has been removed from IndexedDb, the cached value may continue to - * be used to retrieve the batch's document keys. To remove a cached value - * locally, `removeCachedMutationKeys()` should be invoked either directly - * or through `removeMutationBatches()`. - * - * With multi-tab, when the primary client acknowledges or rejects a mutation, - * this cache is used by secondary clients to invalidate the local - * view of the documents that were previously affected by the mutation. - */ - // PORTING NOTE: Multi-tab only. - this.In = {}; - } - /** - * Creates a new mutation queue for the given user. - * @param user - The user for which to create a mutation queue. - * @param serializer - The serializer to use when persisting to IndexedDb. - */ - - - static oe(t, e, n, s) { - // TODO(mcg): Figure out what constraints there are on userIDs - // In particular, are there any reserved characters? are empty ids allowed? - // For the moment store these together in the same mutations table assuming - // that empty userIDs aren't allowed. - U("" !== t.uid); - const i = t.isAuthenticated() ? t.uid : ""; - return new Cr(i, e, n, s); - } - - checkEmpty(t) { - let e = !0; - const n = IDBKeyRange.bound([this.userId, Number.NEGATIVE_INFINITY], [this.userId, Number.POSITIVE_INFINITY]); - return Nr(t).Z({ - index: "userMutationsIndex", - range: n - }, (t, n, s) => { - e = !1, s.done(); - }).next(() => e); - } - - addMutationBatch(t, e, n, s) { - const i = kr(t), - r = Nr(t); // The IndexedDb implementation in Chrome (and Firefox) does not handle - // compound indices that include auto-generated keys correctly. To ensure - // that the index entry is added correctly in all browsers, we perform two - // writes: The first write is used to retrieve the next auto-generated Batch - // ID, and the second write populates the index and stores the actual - // mutation batch. - // See: https://bugs.chromium.org/p/chromium/issues/detail?id=701972 - // We write an empty object to obtain key - // eslint-disable-next-line @typescript-eslint/no-explicit-any - - return r.add({}).next(o => { - U("number" == typeof o); - - const u = new Bi(o, e, n, s), - c = function (t, e, n) { - const s = n.baseMutations.map(e => zs(t.re, e)), - i = n.mutations.map(e => zs(t.re, e)); - return { - userId: e, - batchId: n.batchId, - localWriteTimeMs: n.localWriteTime.toMillis(), - baseMutations: s, - mutations: i - }; - }(this.It, this.userId, u), - a = []; - - let h = new Wt((t, e) => it(t.canonicalString(), e.canonicalString())); - - for (const t of s) { - const e = mi(this.userId, t.key.path, o); - h = h.add(t.key.path.popLast()), a.push(r.put(c)), a.push(i.put(e, gi)); - } - - return h.forEach(e => { - a.push(this.indexManager.addToCollectionParentIndex(t, e)); - }), t.addOnCommittedListener(() => { - this.In[o] = u.keys(); - }), Vt.waitFor(a).next(() => u); - }); - } - - lookupMutationBatch(t, e) { - return Nr(t).get(e).next(t => t ? (U(t.userId === this.userId), Hi(this.It, t)) : null); - } - /** - * Returns the document keys for the mutation batch with the given batchId. - * For primary clients, this method returns `null` after - * `removeMutationBatches()` has been called. Secondary clients return a - * cached result until `removeCachedMutationKeys()` is invoked. - */ - // PORTING NOTE: Multi-tab only. - - - Tn(t, e) { - return this.In[e] ? Vt.resolve(this.In[e]) : this.lookupMutationBatch(t, e).next(t => { - if (t) { - const n = t.keys(); - return this.In[e] = n, n; - } - - return null; - }); - } - - getNextMutationBatchAfterBatchId(t, e) { - const n = e + 1, - s = IDBKeyRange.lowerBound([this.userId, n]); - let i = null; - return Nr(t).Z({ - index: "userMutationsIndex", - range: s - }, (t, e, s) => { - e.userId === this.userId && (U(e.batchId >= n), i = Hi(this.It, e)), s.done(); - }).next(() => i); - } - - getHighestUnacknowledgedBatchId(t) { - const e = IDBKeyRange.upperBound([this.userId, Number.POSITIVE_INFINITY]); - let n = -1; - return Nr(t).Z({ - index: "userMutationsIndex", - range: e, - reverse: !0 - }, (t, e, s) => { - n = e.batchId, s.done(); - }).next(() => n); - } - - getAllMutationBatches(t) { - const e = IDBKeyRange.bound([this.userId, -1], [this.userId, Number.POSITIVE_INFINITY]); - return Nr(t).W("userMutationsIndex", e).next(t => t.map(t => Hi(this.It, t))); - } - - getAllMutationBatchesAffectingDocumentKey(t, e) { - // Scan the document-mutation index starting with a prefix starting with - // the given documentKey. - const n = wi(this.userId, e.path), - s = IDBKeyRange.lowerBound(n), - i = []; - return kr(t).Z({ - range: s - }, (n, s, r) => { - const [o, u, c] = n, - a = di(u); // Only consider rows matching exactly the specific key of - // interest. Note that because we order by path first, and we - // order terminators before path separators, we'll encounter all - // the index rows for documentKey contiguously. In particular, all - // the rows for documentKey will occur before any rows for - // documents nested in a subcollection beneath documentKey so we - // can stop as soon as we hit any such row. - - if (o === this.userId && e.path.isEqual(a)) // Look up the mutation batch in the store. - return Nr(t).get(c).next(t => { - if (!t) throw L(); - U(t.userId === this.userId), i.push(Hi(this.It, t)); - }); - r.done(); - }).next(() => i); - } - - getAllMutationBatchesAffectingDocumentKeys(t, e) { - let n = new Wt(it); - const s = []; - return e.forEach(e => { - const i = wi(this.userId, e.path), - r = IDBKeyRange.lowerBound(i), - o = kr(t).Z({ - range: r - }, (t, s, i) => { - const [r, o, u] = t, - c = di(o); // Only consider rows matching exactly the specific key of - // interest. Note that because we order by path first, and we - // order terminators before path separators, we'll encounter all - // the index rows for documentKey contiguously. In particular, all - // the rows for documentKey will occur before any rows for - // documents nested in a subcollection beneath documentKey so we - // can stop as soon as we hit any such row. - - r === this.userId && e.path.isEqual(c) ? n = n.add(u) : i.done(); - }); - s.push(o); - }), Vt.waitFor(s).next(() => this.En(t, n)); - } - - getAllMutationBatchesAffectingQuery(t, e) { - const n = e.path, - s = n.length + 1, - i = wi(this.userId, n), - r = IDBKeyRange.lowerBound(i); // Collect up unique batchIDs encountered during a scan of the index. Use a - // SortedSet to accumulate batch IDs so they can be traversed in order in a - // scan of the main table. - - let o = new Wt(it); - return kr(t).Z({ - range: r - }, (t, e, i) => { - const [r, u, c] = t, - a = di(u); - r === this.userId && n.isPrefixOf(a) ? // Rows with document keys more than one segment longer than the - // query path can't be matches. For example, a query on 'rooms' - // can't match the document /rooms/abc/messages/xyx. - // TODO(mcg): we'll need a different scanner when we implement - // ancestor queries. - a.length === s && (o = o.add(c)) : i.done(); - }).next(() => this.En(t, o)); - } - - En(t, e) { - const n = [], - s = []; // TODO(rockwood): Implement this using iterate. - - return e.forEach(e => { - s.push(Nr(t).get(e).next(t => { - if (null === t) throw L(); - U(t.userId === this.userId), n.push(Hi(this.It, t)); - })); - }), Vt.waitFor(s).next(() => n); - } - - removeMutationBatch(t, e) { - return Sr(t.ie, this.userId, e).next(n => (t.addOnCommittedListener(() => { - this.An(e.batchId); - }), Vt.forEach(n, e => this.referenceDelegate.markPotentiallyOrphaned(t, e)))); - } - /** - * Clears the cached keys for a mutation batch. This method should be - * called by secondary clients after they process mutation updates. - * - * Note that this method does not have to be called from primary clients as - * the corresponding cache entries are cleared when an acknowledged or - * rejected batch is removed from the mutation queue. - */ - // PORTING NOTE: Multi-tab only - - - An(t) { - delete this.In[t]; - } - - performConsistencyCheck(t) { - return this.checkEmpty(t).next(e => { - if (!e) return Vt.resolve(); // Verify that there are no entries in the documentMutations index if - // the queue is empty. - - const n = IDBKeyRange.lowerBound([this.userId]); - const s = []; - return kr(t).Z({ - range: n - }, (t, e, n) => { - if (t[0] === this.userId) { - const e = di(t[1]); - s.push(e); - } else n.done(); - }).next(() => { - U(0 === s.length); - }); - }); - } - - containsKey(t, e) { - return xr(t, this.userId, e); - } // PORTING NOTE: Multi-tab only (state is held in memory in other clients). - - /** Returns the mutation queue's metadata from IndexedDb. */ - - - Rn(t) { - return Mr(t).get(this.userId).next(t => t || { - userId: this.userId, - lastAcknowledgedBatchId: -1, - lastStreamToken: "" - }); - } - -} -/** - * @returns true if the mutation queue for the given user contains a pending - * mutation for the given key. - */ - - -function xr(t, e, n) { - const s = wi(e, n.path), - i = s[1], - r = IDBKeyRange.lowerBound(s); - let o = !1; - return kr(t).Z({ - range: r, - X: !0 - }, (t, n, s) => { - const [r, u, - /*batchID*/ - c] = t; - r === e && u === i && (o = !0), s.done(); - }).next(() => o); -} -/** Returns true if any mutation queue contains the given document. */ - -/** - * Helper to get a typed SimpleDbStore for the mutations object store. - */ - - -function Nr(t) { - return $i(t, "mutations"); -} -/** - * Helper to get a typed SimpleDbStore for the mutationQueues object store. - */ - - -function kr(t) { - return $i(t, "documentMutations"); -} -/** - * Helper to get a typed SimpleDbStore for the mutationQueues object store. - */ - - -function Mr(t) { - return $i(t, "mutationQueues"); -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** Offset to ensure non-overlapping target ids. */ - -/** - * Generates monotonically increasing target IDs for sending targets to the - * watch stream. - * - * The client constructs two generators, one for the target cache, and one for - * for the sync engine (to generate limbo documents targets). These - * generators produce non-overlapping IDs (by using even and odd IDs - * respectively). - * - * By separating the target ID space, the query cache can generate target IDs - * that persist across client restarts, while sync engine can independently - * generate in-memory target IDs that are transient and can be reused after a - * restart. - */ - - -class Or { - constructor(t) { - this.bn = t; - } - - next() { - return this.bn += 2, this.bn; - } - - static Pn() { - // The target cache generator must return '2' in its first call to `next()` - // as there is no differentiation in the protocol layer between an unset - // number and the number '0'. If we were to sent a target with target ID - // '0', the backend would consider it unset and replace it with its own ID. - return new Or(0); - } - - static vn() { - // Sync engine assigns target IDs for limbo document detection. - return new Or(-1); - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class Fr { - constructor(t, e) { - this.referenceDelegate = t, this.It = e; - } // PORTING NOTE: We don't cache global metadata for the target cache, since - // some of it (in particular `highestTargetId`) can be modified by secondary - // tabs. We could perhaps be more granular (and e.g. still cache - // `lastRemoteSnapshotVersion` in memory) but for simplicity we currently go - // to IndexedDb whenever we need to read metadata. We can revisit if it turns - // out to have a meaningful performance impact. - - - allocateTargetId(t) { - return this.Vn(t).next(e => { - const n = new Or(e.highestTargetId); - return e.highestTargetId = n.next(), this.Sn(t, e).next(() => e.highestTargetId); - }); - } - - getLastRemoteSnapshotVersion(t) { - return this.Vn(t).next(t => ct.fromTimestamp(new ut(t.lastRemoteSnapshotVersion.seconds, t.lastRemoteSnapshotVersion.nanoseconds))); - } - - getHighestSequenceNumber(t) { - return this.Vn(t).next(t => t.highestListenSequenceNumber); - } - - setTargetsMetadata(t, e, n) { - return this.Vn(t).next(s => (s.highestListenSequenceNumber = e, n && (s.lastRemoteSnapshotVersion = n.toTimestamp()), e > s.highestListenSequenceNumber && (s.highestListenSequenceNumber = e), this.Sn(t, s))); - } - - addTargetData(t, e) { - return this.Dn(t, e).next(() => this.Vn(t).next(n => (n.targetCount += 1, this.Cn(e, n), this.Sn(t, n)))); - } - - updateTargetData(t, e) { - return this.Dn(t, e); - } - - removeTargetData(t, e) { - return this.removeMatchingKeysForTargetId(t, e.targetId).next(() => $r(t).delete(e.targetId)).next(() => this.Vn(t)).next(e => (U(e.targetCount > 0), e.targetCount -= 1, this.Sn(t, e))); - } - /** - * Drops any targets with sequence number less than or equal to the upper bound, excepting those - * present in `activeTargetIds`. Document associations for the removed targets are also removed. - * Returns the number of targets removed. - */ - - - removeTargets(t, e, n) { - let s = 0; - const i = []; - return $r(t).Z((r, o) => { - const u = Ji(o); - u.sequenceNumber <= e && null === n.get(u.targetId) && (s++, i.push(this.removeTargetData(t, u))); - }).next(() => Vt.waitFor(i)).next(() => s); - } - /** - * Call provided function with each `TargetData` that we have cached. - */ - - - forEachTarget(t, e) { - return $r(t).Z((t, n) => { - const s = Ji(n); - e(s); - }); - } - - Vn(t) { - return Br(t).get("targetGlobalKey").next(t => (U(null !== t), t)); - } - - Sn(t, e) { - return Br(t).put("targetGlobalKey", e); - } - - Dn(t, e) { - return $r(t).put(Yi(this.It, e)); - } - /** - * In-place updates the provided metadata to account for values in the given - * TargetData. Saving is done separately. Returns true if there were any - * changes to the metadata. - */ - - - Cn(t, e) { - let n = !1; - return t.targetId > e.highestTargetId && (e.highestTargetId = t.targetId, n = !0), t.sequenceNumber > e.highestListenSequenceNumber && (e.highestListenSequenceNumber = t.sequenceNumber, n = !0), n; - } - - getTargetCount(t) { - return this.Vn(t).next(t => t.targetCount); - } - - getTargetData(t, e) { - // Iterating by the canonicalId may yield more than one result because - // canonicalId values are not required to be unique per target. This query - // depends on the queryTargets index to be efficient. - const n = Fe(e), - s = IDBKeyRange.bound([n, Number.NEGATIVE_INFINITY], [n, Number.POSITIVE_INFINITY]); - let i = null; - return $r(t).Z({ - range: s, - index: "queryTargetsIndex" - }, (t, n, s) => { - const r = Ji(n); // After finding a potential match, check that the target is - // actually equal to the requested target. - - Be(e, r.target) && (i = r, s.done()); - }).next(() => i); - } - - addMatchingKeys(t, e, n) { - // PORTING NOTE: The reverse index (documentsTargets) is maintained by - // IndexedDb. - const s = [], - i = Lr(t); - return e.forEach(e => { - const r = hi(e.path); - s.push(i.put({ - targetId: n, - path: r - })), s.push(this.referenceDelegate.addReference(t, n, e)); - }), Vt.waitFor(s); - } - - removeMatchingKeys(t, e, n) { - // PORTING NOTE: The reverse index (documentsTargets) is maintained by - // IndexedDb. - const s = Lr(t); - return Vt.forEach(e, e => { - const i = hi(e.path); - return Vt.waitFor([s.delete([n, i]), this.referenceDelegate.removeReference(t, n, e)]); - }); - } - - removeMatchingKeysForTargetId(t, e) { - const n = Lr(t), - s = IDBKeyRange.bound([e], [e + 1], - /*lowerOpen=*/ - !1, - /*upperOpen=*/ - !0); - return n.delete(s); - } - - getMatchingKeysForTargetId(t, e) { - const n = IDBKeyRange.bound([e], [e + 1], - /*lowerOpen=*/ - !1, - /*upperOpen=*/ - !0), - s = Lr(t); - let i = gs(); - return s.Z({ - range: n, - X: !0 - }, (t, e, n) => { - const s = di(t[1]), - r = new dt(s); - i = i.add(r); - }).next(() => i); - } - - containsKey(t, e) { - const n = hi(e.path), - s = IDBKeyRange.bound([n], [ot(n)], - /*lowerOpen=*/ - !1, - /*upperOpen=*/ - !0); - let i = 0; - return Lr(t).Z({ - index: "documentTargetsIndex", - X: !0, - range: s - }, (_ref2, n, s) => { - let [t, e] = _ref2; - // Having a sentinel row for a document does not count as containing that document; - // For the target cache, containing the document means the document is part of some - // target. - 0 !== t && (i++, s.done()); - }).next(() => i > 0); - } - /** - * Looks up a TargetData entry by target ID. - * - * @param targetId - The target ID of the TargetData entry to look up. - * @returns The cached TargetData entry, or null if the cache has no entry for - * the target. - */ - // PORTING NOTE: Multi-tab only. - - - se(t, e) { - return $r(t).get(e).next(t => t ? Ji(t) : null); - } - -} -/** - * Helper to get a typed SimpleDbStore for the queries object store. - */ - - -function $r(t) { - return $i(t, "targets"); -} -/** - * Helper to get a typed SimpleDbStore for the target globals object store. - */ - - -function Br(t) { - return $i(t, "targetGlobal"); -} -/** - * Helper to get a typed SimpleDbStore for the document target object store. - */ - - -function Lr(t) { - return $i(t, "targetDocuments"); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -function Ur(_ref3, _ref4) { - let [t, e] = _ref3; - let [n, s] = _ref4; - const i = it(t, n); - return 0 === i ? it(e, s) : i; -} -/** - * Used to calculate the nth sequence number. Keeps a rolling buffer of the - * lowest n values passed to `addElement`, and finally reports the largest of - * them in `maxValue`. - */ - - -class qr { - constructor(t) { - this.xn = t, this.buffer = new Wt(Ur), this.Nn = 0; - } - - kn() { - return ++this.Nn; - } - - Mn(t) { - const e = [t, this.kn()]; - if (this.buffer.size < this.xn) this.buffer = this.buffer.add(e);else { - const t = this.buffer.last(); - Ur(e, t) < 0 && (this.buffer = this.buffer.delete(t).add(e)); - } - } - - get maxValue() { - // Guaranteed to be non-empty. If we decide we are not collecting any - // sequence numbers, nthSequenceNumber below short-circuits. If we have - // decided that we are collecting n sequence numbers, it's because n is some - // percentage of the existing sequence numbers. That means we should never - // be in a situation where we are collecting sequence numbers but don't - // actually have any. - return this.buffer.last()[0]; - } - -} -/** - * This class is responsible for the scheduling of LRU garbage collection. It handles checking - * whether or not GC is enabled, as well as which delay to use before the next run. - */ - - -class Kr { - constructor(t, e, n) { - this.garbageCollector = t, this.asyncQueue = e, this.localStore = n, this.On = null; - } - - start() { - -1 !== this.garbageCollector.params.cacheSizeCollectionThreshold && this.Fn(6e4); - } - - stop() { - this.On && (this.On.cancel(), this.On = null); - } - - get started() { - return null !== this.On; - } - - Fn(t) { - O("LruGarbageCollector", `Garbage collection scheduled in ${t}ms`), this.On = this.asyncQueue.enqueueAfterDelay("lru_garbage_collection" - /* LruGarbageCollection */ - , t, async () => { - this.On = null; - - try { - await this.localStore.collectGarbage(this.garbageCollector); - } catch (t) { - Nt(t) ? O("LruGarbageCollector", "Ignoring IndexedDB error during garbage collection: ", t) : await vt(t); - } - - await this.Fn(3e5); - }); - } - -} -/** Implements the steps for LRU garbage collection. */ - - -class Gr { - constructor(t, e) { - this.$n = t, this.params = e; - } - - calculateTargetCount(t, e) { - return this.$n.Bn(t).next(t => Math.floor(e / 100 * t)); - } - - nthSequenceNumber(t, e) { - if (0 === e) return Vt.resolve(Lt.at); - const n = new qr(e); - return this.$n.forEachTarget(t, t => n.Mn(t.sequenceNumber)).next(() => this.$n.Ln(t, t => n.Mn(t))).next(() => n.maxValue); - } - - removeTargets(t, e, n) { - return this.$n.removeTargets(t, e, n); - } - - removeOrphanedDocuments(t, e) { - return this.$n.removeOrphanedDocuments(t, e); - } - - collect(t, e) { - return -1 === this.params.cacheSizeCollectionThreshold ? (O("LruGarbageCollector", "Garbage collection skipped; disabled"), Vt.resolve(vr)) : this.getCacheSize(t).next(n => n < this.params.cacheSizeCollectionThreshold ? (O("LruGarbageCollector", `Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`), vr) : this.Un(t, e)); - } - - getCacheSize(t) { - return this.$n.getCacheSize(t); - } - - Un(t, e) { - let n, s, i, r, o, c, a; - const h = Date.now(); - return this.calculateTargetCount(t, this.params.percentileToCollect).next(e => ( // Cap at the configured max - e > this.params.maximumSequenceNumbersToCollect ? (O("LruGarbageCollector", `Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${e}`), s = this.params.maximumSequenceNumbersToCollect) : s = e, r = Date.now(), this.nthSequenceNumber(t, s))).next(s => (n = s, o = Date.now(), this.removeTargets(t, n, e))).next(e => (i = e, c = Date.now(), this.removeOrphanedDocuments(t, n))).next(t => { - if (a = Date.now(), k() <= _firebase_logger__WEBPACK_IMPORTED_MODULE_2__.LogLevel.DEBUG) { - O("LruGarbageCollector", `LRU Garbage Collection\n\tCounted targets in ${r - h}ms\n\tDetermined least recently used ${s} in ` + (o - r) + "ms\n" + `\tRemoved ${i} targets in ` + (c - o) + "ms\n" + `\tRemoved ${t} documents in ` + (a - c) + "ms\n" + `Total Duration: ${a - h}ms`); - } - - return Vt.resolve({ - didRun: !0, - sequenceNumbersCollected: s, - targetsRemoved: i, - documentsRemoved: t - }); - }); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** Provides LRU functionality for IndexedDB persistence. */ - - -class Qr { - constructor(t, e) { - this.db = t, this.garbageCollector = function (t, e) { - return new Gr(t, e); - }(this, e); - } - - Bn(t) { - const e = this.qn(t); - return this.db.getTargetCache().getTargetCount(t).next(t => e.next(e => t + e)); - } - - qn(t) { - let e = 0; - return this.Ln(t, t => { - e++; - }).next(() => e); - } - - forEachTarget(t, e) { - return this.db.getTargetCache().forEachTarget(t, e); - } - - Ln(t, e) { - return this.Kn(t, (t, n) => e(n)); - } - - addReference(t, e, n) { - return jr(t, n); - } - - removeReference(t, e, n) { - return jr(t, n); - } - - removeTargets(t, e, n) { - return this.db.getTargetCache().removeTargets(t, e, n); - } - - markPotentiallyOrphaned(t, e) { - return jr(t, e); - } - /** - * Returns true if anything would prevent this document from being garbage - * collected, given that the document in question is not present in any - * targets and has a sequence number less than or equal to the upper bound for - * the collection run. - */ - - - Gn(t, e) { - return function (t, e) { - let n = !1; - return Mr(t).tt(s => xr(t, s, e).next(t => (t && (n = !0), Vt.resolve(!t)))).next(() => n); - }(t, e); - } - - removeOrphanedDocuments(t, e) { - const n = this.db.getRemoteDocumentCache().newChangeBuffer(), - s = []; - let i = 0; - return this.Kn(t, (r, o) => { - if (o <= e) { - const e = this.Gn(t, r).next(e => { - if (!e) // Our size accounting requires us to read all documents before - // removing them. - return i++, n.getEntry(t, r).next(() => (n.removeEntry(r, ct.min()), Lr(t).delete([0, hi(r.path)]))); - }); - s.push(e); - } - }).next(() => Vt.waitFor(s)).next(() => n.apply(t)).next(() => i); - } - - removeTarget(t, e) { - const n = e.withSequenceNumber(t.currentSequenceNumber); - return this.db.getTargetCache().updateTargetData(t, n); - } - - updateLimboDocument(t, e) { - return jr(t, e); - } - /** - * Call provided function for each document in the cache that is 'orphaned'. Orphaned - * means not a part of any target, so the only entry in the target-document index for - * that document will be the sentinel row (targetId 0), which will also have the sequence - * number for the last time the document was accessed. - */ - - - Kn(t, e) { - const n = Lr(t); - let s, - i = Lt.at; - return n.Z({ - index: "documentTargetsIndex" - }, (_ref5, _ref6) => { - let [t, n] = _ref5; - let { - path: r, - sequenceNumber: o - } = _ref6; - 0 === t ? ( // if nextToReport is valid, report it, this is a new key so the - // last one must not be a member of any targets. - i !== Lt.at && e(new dt(di(s)), i), // set nextToReport to be this sequence number. It's the next one we - // might report, if we don't find any targets for this document. - // Note that the sequence number must be defined when the targetId - // is 0. - i = o, s = r) : // set nextToReport to be invalid, we know we don't need to report - // this one since we found a target for it. - i = Lt.at; - }).next(() => { - // Since we report sequence numbers after getting to the next key, we - // need to check if the last key we iterated over was an orphaned - // document and report it. - i !== Lt.at && e(new dt(di(s)), i); - }); - } - - getCacheSize(t) { - return this.db.getRemoteDocumentCache().getSize(t); - } - -} - -function jr(t, e) { - return Lr(t).put( - /** - * @returns A value suitable for writing a sentinel row in the target-document - * store. - */ - function (t, e) { - return { - targetId: 0, - path: hi(t.path), - sequenceNumber: e - }; - }(e, t.currentSequenceNumber)); -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * An in-memory buffer of entries to be written to a RemoteDocumentCache. - * It can be used to batch up a set of changes to be written to the cache, but - * additionally supports reading entries back with the `getEntry()` method, - * falling back to the underlying RemoteDocumentCache if no entry is - * buffered. - * - * Entries added to the cache *must* be read first. This is to facilitate - * calculating the size delta of the pending changes. - * - * PORTING NOTE: This class was implemented then removed from other platforms. - * If byte-counting ends up being needed on the other platforms, consider - * porting this class as part of that implementation work. - */ - - -class Wr { - constructor() { - // A mapping of document key to the new cache entry that should be written. - this.changes = new os(t => t.toString(), (t, e) => t.isEqual(e)), this.changesApplied = !1; - } - /** - * Buffers a `RemoteDocumentCache.addEntry()` call. - * - * You can only modify documents that have already been retrieved via - * `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`). - */ - - - addEntry(t) { - this.assertNotApplied(), this.changes.set(t.key, t); - } - /** - * Buffers a `RemoteDocumentCache.removeEntry()` call. - * - * You can only remove documents that have already been retrieved via - * `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`). - */ - - - removeEntry(t, e) { - this.assertNotApplied(), this.changes.set(t, ke.newInvalidDocument(t).setReadTime(e)); - } - /** - * Looks up an entry in the cache. The buffered changes will first be checked, - * and if no buffered change applies, this will forward to - * `RemoteDocumentCache.getEntry()`. - * - * @param transaction - The transaction in which to perform any persistence - * operations. - * @param documentKey - The key of the entry to look up. - * @returns The cached document or an invalid document if we have nothing - * cached. - */ - - - getEntry(t, e) { - this.assertNotApplied(); - const n = this.changes.get(e); - return void 0 !== n ? Vt.resolve(n) : this.getFromCache(t, e); - } - /** - * Looks up several entries in the cache, forwarding to - * `RemoteDocumentCache.getEntry()`. - * - * @param transaction - The transaction in which to perform any persistence - * operations. - * @param documentKeys - The keys of the entries to look up. - * @returns A map of cached documents, indexed by key. If an entry cannot be - * found, the corresponding key will be mapped to an invalid document. - */ - - - getEntries(t, e) { - return this.getAllFromCache(t, e); - } - /** - * Applies buffered changes to the underlying RemoteDocumentCache, using - * the provided transaction. - */ - - - apply(t) { - return this.assertNotApplied(), this.changesApplied = !0, this.applyChanges(t); - } - /** Helper to assert this.changes is not null */ - - - assertNotApplied() {} - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * The RemoteDocumentCache for IndexedDb. To construct, invoke - * `newIndexedDbRemoteDocumentCache()`. - */ - - -class zr { - constructor(t) { - this.It = t; - } - - setIndexManager(t) { - this.indexManager = t; - } - /** - * Adds the supplied entries to the cache. - * - * All calls of `addEntry` are required to go through the RemoteDocumentChangeBuffer - * returned by `newChangeBuffer()` to ensure proper accounting of metadata. - */ - - - addEntry(t, e, n) { - return Xr(t).put(n); - } - /** - * Removes a document from the cache. - * - * All calls of `removeEntry` are required to go through the RemoteDocumentChangeBuffer - * returned by `newChangeBuffer()` to ensure proper accounting of metadata. - */ - - - removeEntry(t, e, n) { - return Xr(t).delete( - /** - * Returns a key that can be used for document lookups via the primary key of - * the DbRemoteDocument object store. - */ - function (t, e) { - const n = t.path.toArray(); - return [ - /* prefix path */ - n.slice(0, n.length - 2), - /* collection id */ - n[n.length - 2], ji(e), - /* document id */ - n[n.length - 1]]; - } - /** - * Returns a key that can be used for document lookups on the - * `DbRemoteDocumentDocumentCollectionGroupIndex` index. - */ - (e, n)); - } - /** - * Updates the current cache size. - * - * Callers to `addEntry()` and `removeEntry()` *must* call this afterwards to update the - * cache's metadata. - */ - - - updateMetadata(t, e) { - return this.getMetadata(t).next(n => (n.byteSize += e, this.Qn(t, n))); - } - - getEntry(t, e) { - let n = ke.newInvalidDocument(e); - return Xr(t).Z({ - index: "documentKeyIndex", - range: IDBKeyRange.only(Zr(e)) - }, (t, s) => { - n = this.jn(e, s); - }).next(() => n); - } - /** - * Looks up an entry in the cache. - * - * @param documentKey - The key of the entry to look up. - * @returns The cached document entry and its size. - */ - - - Wn(t, e) { - let n = { - size: 0, - document: ke.newInvalidDocument(e) - }; - return Xr(t).Z({ - index: "documentKeyIndex", - range: IDBKeyRange.only(Zr(e)) - }, (t, s) => { - n = { - document: this.jn(e, s), - size: Dr(s) - }; - }).next(() => n); - } - - getEntries(t, e) { - let n = cs(); - return this.zn(t, e, (t, e) => { - const s = this.jn(t, e); - n = n.insert(t, s); - }).next(() => n); - } - /** - * Looks up several entries in the cache. - * - * @param documentKeys - The set of keys entries to look up. - * @returns A map of documents indexed by key and a map of sizes indexed by - * key (zero if the document does not exist). - */ - - - Hn(t, e) { - let n = cs(), - s = new Gt(dt.comparator); - return this.zn(t, e, (t, e) => { - const i = this.jn(t, e); - n = n.insert(t, i), s = s.insert(t, Dr(e)); - }).next(() => ({ - documents: n, - Jn: s - })); - } - - zn(t, e, n) { - if (e.isEmpty()) return Vt.resolve(); - let s = new Wt(eo); - e.forEach(t => s = s.add(t)); - const i = IDBKeyRange.bound(Zr(s.first()), Zr(s.last())), - r = s.getIterator(); - let o = r.getNext(); - return Xr(t).Z({ - index: "documentKeyIndex", - range: i - }, (t, e, s) => { - const i = dt.fromSegments([...e.prefixPath, e.collectionGroup, e.documentId]); // Go through keys not found in cache. - - for (; o && eo(o, i) < 0;) n(o, null), o = r.getNext(); - - o && o.isEqual(i) && ( // Key found in cache. - n(o, e), o = r.hasNext() ? r.getNext() : null), // Skip to the next key (if there is one). - o ? s.j(Zr(o)) : s.done(); - }).next(() => { - // The rest of the keys are not in the cache. One case where `iterate` - // above won't go through them is when the cache is empty. - for (; o;) n(o, null), o = r.hasNext() ? r.getNext() : null; - }); - } - - getAllFromCollection(t, e, n) { - const s = [e.popLast().toArray(), e.lastSegment(), ji(n.readTime), n.documentKey.path.isEmpty() ? "" : n.documentKey.path.lastSegment()], - i = [e.popLast().toArray(), e.lastSegment(), [Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER], ""]; - return Xr(t).W(IDBKeyRange.bound(s, i, !0)).next(t => { - let e = cs(); - - for (const n of t) { - const t = this.jn(dt.fromSegments(n.prefixPath.concat(n.collectionGroup, n.documentId)), n); - e = e.insert(t.key, t); - } - - return e; - }); - } - - getAllFromCollectionGroup(t, e, n, s) { - let i = cs(); - const r = to(e, n), - o = to(e, At.max()); - return Xr(t).Z({ - index: "collectionGroupIndex", - range: IDBKeyRange.bound(r, o, !0) - }, (t, e, n) => { - const r = this.jn(dt.fromSegments(e.prefixPath.concat(e.collectionGroup, e.documentId)), e); - i = i.insert(r.key, r), i.size === s && n.done(); - }).next(() => i); - } - - newChangeBuffer(t) { - return new Jr(this, !!t && t.trackRemovals); - } - - getSize(t) { - return this.getMetadata(t).next(t => t.byteSize); - } - - getMetadata(t) { - return Yr(t).get("remoteDocumentGlobalKey").next(t => (U(!!t), t)); - } - - Qn(t, e) { - return Yr(t).put("remoteDocumentGlobalKey", e); - } - /** - * Decodes `dbRemoteDoc` and returns the document (or an invalid document if - * the document corresponds to the format used for sentinel deletes). - */ - - - jn(t, e) { - if (e) { - const t = Gi(this.It, e); // Whether the document is a sentinel removal and should only be used in the - // `getNewDocumentChanges()` - - if (!(t.isNoDocument() && t.version.isEqual(ct.min()))) return t; - } - - return ke.newInvalidDocument(t); - } - -} -/** Creates a new IndexedDbRemoteDocumentCache. */ - - -function Hr(t) { - return new zr(t); -} -/** - * Handles the details of adding and updating documents in the IndexedDbRemoteDocumentCache. - * - * Unlike the MemoryRemoteDocumentChangeBuffer, the IndexedDb implementation computes the size - * delta for all submitted changes. This avoids having to re-read all documents from IndexedDb - * when we apply the changes. - */ - - -class Jr extends Wr { - /** - * @param documentCache - The IndexedDbRemoteDocumentCache to apply the changes to. - * @param trackRemovals - Whether to create sentinel deletes that can be tracked by - * `getNewDocumentChanges()`. - */ - constructor(t, e) { - super(), this.Yn = t, this.trackRemovals = e, // A map of document sizes and read times prior to applying the changes in - // this buffer. - this.Xn = new os(t => t.toString(), (t, e) => t.isEqual(e)); - } - - applyChanges(t) { - const e = []; - let n = 0, - s = new Wt((t, e) => it(t.canonicalString(), e.canonicalString())); - return this.changes.forEach((i, r) => { - const o = this.Xn.get(i); - - if (e.push(this.Yn.removeEntry(t, i, o.readTime)), r.isValidDocument()) { - const u = Qi(this.Yn.It, r); - s = s.add(i.path.popLast()); - const c = Dr(u); - n += c - o.size, e.push(this.Yn.addEntry(t, i, u)); - } else if (n -= o.size, this.trackRemovals) { - // In order to track removals, we store a "sentinel delete" in the - // RemoteDocumentCache. This entry is represented by a NoDocument - // with a version of 0 and ignored by `maybeDecodeDocument()` but - // preserved in `getNewDocumentChanges()`. - const n = Qi(this.Yn.It, r.convertToNoDocument(ct.min())); - e.push(this.Yn.addEntry(t, i, n)); - } - }), s.forEach(n => { - e.push(this.Yn.indexManager.addToCollectionParentIndex(t, n)); - }), e.push(this.Yn.updateMetadata(t, n)), Vt.waitFor(e); - } - - getFromCache(t, e) { - // Record the size of everything we load from the cache so we can compute a delta later. - return this.Yn.Wn(t, e).next(t => (this.Xn.set(e, { - size: t.size, - readTime: t.document.readTime - }), t.document)); - } - - getAllFromCache(t, e) { - // Record the size of everything we load from the cache so we can compute - // a delta later. - return this.Yn.Hn(t, e).next(_ref7 => { - let { - documents: t, - Jn: e - } = _ref7; - return (// Note: `getAllFromCache` returns two maps instead of a single map from - // keys to `DocumentSizeEntry`s. This is to allow returning the - // `MutableDocumentMap` directly, without a conversion. - e.forEach((e, n) => { - this.Xn.set(e, { - size: n, - readTime: t.get(e).readTime - }); - }), t - ); - }); - } - -} - -function Yr(t) { - return $i(t, "remoteDocumentGlobal"); -} -/** - * Helper to get a typed SimpleDbStore for the remoteDocuments object store. - */ - - -function Xr(t) { - return $i(t, "remoteDocumentsV14"); -} -/** - * Returns a key that can be used for document lookups on the - * `DbRemoteDocumentDocumentKeyIndex` index. - */ - - -function Zr(t) { - const e = t.path.toArray(); - return [ - /* prefix path */ - e.slice(0, e.length - 2), - /* collection id */ - e[e.length - 2], - /* document id */ - e[e.length - 1]]; -} - -function to(t, e) { - const n = e.documentKey.path.toArray(); - return [ - /* collection id */ - t, ji(e.readTime), - /* prefix path */ - n.slice(0, n.length - 2), - /* document id */ - n.length > 0 ? n[n.length - 1] : ""]; -} -/** - * Comparator that compares document keys according to the primary key sorting - * used by the `DbRemoteDocumentDocument` store (by prefix path, collection id - * and then document ID). - * - * Visible for testing. - */ - - -function eo(t, e) { - const n = t.path.toArray(), - s = e.path.toArray(); // The ordering is based on https://chromium.googlesource.com/chromium/blink/+/fe5c21fef94dae71c1c3344775b8d8a7f7e6d9ec/Source/modules/indexeddb/IDBKey.cpp#74 - - let i = 0; - - for (let t = 0; t < n.length - 2 && t < s.length - 2; ++t) if (i = it(n[t], s[t]), i) return i; - - return i = it(n.length, s.length), i || (i = it(n[n.length - 2], s[s.length - 2]), i || it(n[n.length - 1], s[s.length - 1])); -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Schema Version for the Web client: - * 1. Initial version including Mutation Queue, Query Cache, and Remote - * Document Cache - * 2. Used to ensure a targetGlobal object exists and add targetCount to it. No - * longer required because migration 3 unconditionally clears it. - * 3. Dropped and re-created Query Cache to deal with cache corruption related - * to limbo resolution. Addresses - * https://github.com/firebase/firebase-ios-sdk/issues/1548 - * 4. Multi-Tab Support. - * 5. Removal of held write acks. - * 6. Create document global for tracking document cache size. - * 7. Ensure every cached document has a sentinel row with a sequence number. - * 8. Add collection-parent index for Collection Group queries. - * 9. Change RemoteDocumentChanges store to be keyed by readTime rather than - * an auto-incrementing ID. This is required for Index-Free queries. - * 10. Rewrite the canonical IDs to the explicit Protobuf-based format. - * 11. Add bundles and named_queries for bundle support. - * 12. Add document overlays. - * 13. Rewrite the keys of the remote document cache to allow for efficient - * document lookup via `getAll()`. - * 14. Add overlays. - * 15. Add indexing support. - */ - -/** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Represents a local view (overlay) of a document, and the fields that are - * locally mutated. - */ - - -class no { - constructor(t, - /** - * The fields that are locally mutated by patch mutations. If the overlayed - * document is from set or delete mutations, this returns null. - */ - e) { - this.overlayedDocument = t, this.mutatedFields = e; - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A readonly view of the local state of all documents we're tracking (i.e. we - * have a cached version in remoteDocumentCache or local mutations for the - * document). The view is computed by applying the mutations in the - * MutationQueue to the RemoteDocumentCache. - */ - - -class so { - constructor(t, e, n, s) { - this.remoteDocumentCache = t, this.mutationQueue = e, this.documentOverlayCache = n, this.indexManager = s; - } - /** - * Get the local view of the document identified by `key`. - * - * @returns Local view of the document or null if we don't have any cached - * state for it. - */ - - - getDocument(t, e) { - let n = null; - return this.documentOverlayCache.getOverlay(t, e).next(s => (n = s, this.getBaseDocument(t, e, n))).next(t => (null !== n && Qn(n.mutation, t, Jt.empty(), ut.now()), t)); - } - /** - * Gets the local view of the documents identified by `keys`. - * - * If we don't have cached state for a document in `keys`, a NoDocument will - * be stored for that key in the resulting set. - */ - - - getDocuments(t, e) { - return this.remoteDocumentCache.getEntries(t, e).next(e => this.getLocalViewOfDocuments(t, e, gs()).next(() => e)); - } - /** - * Similar to `getDocuments`, but creates the local view from the given - * `baseDocs` without retrieving documents from the local store. - * - * @param transaction - The transaction this operation is scoped to. - * @param docs - The documents to apply local mutations to get the local views. - * @param existenceStateChanged - The set of document keys whose existence state - * is changed. This is useful to determine if some documents overlay needs - * to be recalculated. - */ - - - getLocalViewOfDocuments(t, e) { - let n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : gs(); - const s = fs(); - return this.populateOverlays(t, s, e).next(() => this.computeViews(t, e, s, n).next(t => { - let e = hs(); - return t.forEach((t, n) => { - e = e.insert(t, n.overlayedDocument); - }), e; - })); - } - /** - * Gets the overlayed documents for the given document map, which will include - * the local view of those documents and a `FieldMask` indicating which fields - * are mutated locally, `null` if overlay is a Set or Delete mutation. - */ - - - getOverlayedDocuments(t, e) { - const n = fs(); - return this.populateOverlays(t, n, e).next(() => this.computeViews(t, e, n, gs())); - } - /** - * Fetches the overlays for {@code docs} and adds them to provided overlay map - * if the map does not already contain an entry for the given document key. - */ - - - populateOverlays(t, e, n) { - const s = []; - return n.forEach(t => { - e.has(t) || s.push(t); - }), this.documentOverlayCache.getOverlays(t, s).next(t => { - t.forEach((t, n) => { - e.set(t, n); - }); - }); - } - /** - * Computes the local view for the given documents. - * - * @param docs - The documents to compute views for. It also has the base - * version of the documents. - * @param overlays - The overlays that need to be applied to the given base - * version of the documents. - * @param existenceStateChanged - A set of documents whose existence states - * might have changed. This is used to determine if we need to re-calculate - * overlays from mutation queues. - * @return A map represents the local documents view. - */ - - - computeViews(t, e, n, s) { - let i = cs(); - - const r = _s(), - o = _s(); - - return e.forEach((t, e) => { - const o = n.get(e.key); // Recalculate an overlay if the document's existence state changed due to - // a remote event *and* the overlay is a PatchMutation. This is because - // document existence state can change if some patch mutation's - // preconditions are met. - // NOTE: we recalculate when `overlay` is undefined as well, because there - // might be a patch mutation whose precondition does not match before the - // change (hence overlay is undefined), but would now match. - - s.has(e.key) && (void 0 === o || o.mutation instanceof Hn) ? i = i.insert(e.key, e) : void 0 !== o && (r.set(e.key, o.mutation.getFieldMask()), Qn(o.mutation, e, o.mutation.getFieldMask(), ut.now())); - }), this.recalculateAndSaveOverlays(t, i).next(t => (t.forEach((t, e) => r.set(t, e)), e.forEach((t, e) => { - var n; - return o.set(t, new no(e, null !== (n = r.get(t)) && void 0 !== n ? n : null)); - }), o)); - } - - recalculateAndSaveOverlays(t, e) { - const n = _s(); // A reverse lookup map from batch id to the documents within that batch. - - - let s = new Gt((t, e) => t - e), - i = gs(); - return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t, e).next(t => { - for (const i of t) i.keys().forEach(t => { - const r = e.get(t); - if (null === r) return; - let o = n.get(t) || Jt.empty(); - o = i.applyToLocalView(r, o), n.set(t, o); - const u = (s.get(i.batchId) || gs()).add(t); - s = s.insert(i.batchId, u); - }); - }).next(() => { - const r = [], - o = s.getReverseIterator(); // Iterate in descending order of batch IDs, and skip documents that are - // already saved. - - for (; o.hasNext();) { - const s = o.getNext(), - u = s.key, - c = s.value, - a = ds(); - c.forEach(t => { - if (!i.has(t)) { - const s = Kn(e.get(t), n.get(t)); - null !== s && a.set(t, s), i = i.add(t); - } - }), r.push(this.documentOverlayCache.saveOverlays(t, u, a)); - } - - return Vt.waitFor(r); - }).next(() => n); - } - /** - * Recalculates overlays by reading the documents from remote document cache - * first, and saves them after they are calculated. - */ - - - recalculateAndSaveOverlaysForDocumentKeys(t, e) { - return this.remoteDocumentCache.getEntries(t, e).next(e => this.recalculateAndSaveOverlays(t, e)); - } - /** - * Performs a query against the local view of all documents. - * - * @param transaction - The persistence transaction. - * @param query - The query to match documents against. - * @param offset - Read time and key to start scanning by (exclusive). - */ - - - getDocumentsMatchingQuery(t, e, n) { - /** - * Returns whether the query matches a single document by path (rather than a - * collection). - */ - return function (t) { - return dt.isDocumentKey(t.path) && null === t.collectionGroup && 0 === t.filters.length; - }(e) ? this.getDocumentsMatchingDocumentQuery(t, e.path) : ln(e) ? this.getDocumentsMatchingCollectionGroupQuery(t, e, n) : this.getDocumentsMatchingCollectionQuery(t, e, n); - } - /** - * Given a collection group, returns the next documents that follow the provided offset, along - * with an updated batch ID. - * - *

The documents returned by this method are ordered by remote version from the provided - * offset. If there are no more remote documents after the provided offset, documents with - * mutations in order of batch id from the offset are returned. Since all documents in a batch are - * returned together, the total number of documents returned can exceed {@code count}. - * - * @param transaction - * @param collectionGroup The collection group for the documents. - * @param offset The offset to index into. - * @param count The number of documents to return - * @return A LocalWriteResult with the documents that follow the provided offset and the last processed batch id. - */ - - - getNextDocuments(t, e, n, s) { - return this.remoteDocumentCache.getAllFromCollectionGroup(t, e, n, s).next(i => { - const r = s - i.size > 0 ? this.documentOverlayCache.getOverlaysForCollectionGroup(t, e, n.largestBatchId, s - i.size) : Vt.resolve(fs()); // The callsite will use the largest batch ID together with the latest read time to create - // a new index offset. Since we only process batch IDs if all remote documents have been read, - // no overlay will increase the overall read time. This is why we only need to special case - // the batch id. - - let o = -1, - u = i; - return r.next(e => Vt.forEach(e, (e, n) => (o < n.largestBatchId && (o = n.largestBatchId), i.get(e) ? Vt.resolve() : this.getBaseDocument(t, e, n).next(t => { - u = u.insert(e, t); - }))).next(() => this.populateOverlays(t, e, i)).next(() => this.computeViews(t, u, e, gs())).next(t => ({ - batchId: o, - changes: ls(t) - }))); - }); - } - - getDocumentsMatchingDocumentQuery(t, e) { - // Just do a simple document lookup. - return this.getDocument(t, new dt(e)).next(t => { - let e = hs(); - return t.isFoundDocument() && (e = e.insert(t.key, t)), e; - }); - } - - getDocumentsMatchingCollectionGroupQuery(t, e, n) { - const s = e.collectionGroup; - let i = hs(); - return this.indexManager.getCollectionParents(t, s).next(r => Vt.forEach(r, r => { - const o = function (t, e) { - return new rn(e, - /*collectionGroup=*/ - null, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt); - }(e, r.child(s)); - - return this.getDocumentsMatchingCollectionQuery(t, o, n).next(t => { - t.forEach((t, e) => { - i = i.insert(t, e); - }); - }); - }).next(() => i)); - } - - getDocumentsMatchingCollectionQuery(t, e, n) { - // Query the remote documents and overlay mutations. - let s; - return this.remoteDocumentCache.getAllFromCollection(t, e.path, n).next(i => (s = i, this.documentOverlayCache.getOverlaysForCollection(t, e.path, n.largestBatchId))).next(t => { - // As documents might match the query because of their overlay we need to - // include documents for all overlays in the initial document set. - t.forEach((t, e) => { - const n = e.getKey(); - null === s.get(n) && (s = s.insert(n, ke.newInvalidDocument(n))); - }); // Apply the overlays and match against the query. - - let n = hs(); - return s.forEach((s, i) => { - const r = t.get(s); - void 0 !== r && Qn(r.mutation, i, Jt.empty(), ut.now()), // Finally, insert the documents that still match the query - yn(e, i) && (n = n.insert(s, i)); - }), n; - }); - } - /** Returns a base document that can be used to apply `overlay`. */ - - - getBaseDocument(t, e, n) { - return null === n || 1 - /* Patch */ - === n.mutation.type ? this.remoteDocumentCache.getEntry(t, e) : Vt.resolve(ke.newInvalidDocument(e)); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class io { - constructor(t) { - this.It = t, this.Zn = new Map(), this.ts = new Map(); - } - - getBundleMetadata(t, e) { - return Vt.resolve(this.Zn.get(e)); - } - - saveBundleMetadata(t, e) { - /** Decodes a BundleMetadata proto into a BundleMetadata object. */ - var n; - return this.Zn.set(e.id, { - id: (n = e).id, - version: n.version, - createTime: Ms(n.createTime) - }), Vt.resolve(); - } - - getNamedQuery(t, e) { - return Vt.resolve(this.ts.get(e)); - } - - saveNamedQuery(t, e) { - return this.ts.set(e.name, function (t) { - return { - name: t.name, - query: Xi(t.bundledQuery), - readTime: Ms(t.readTime) - }; - }(e)), Vt.resolve(); - } - -} -/** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * An in-memory implementation of DocumentOverlayCache. - */ - - -class ro { - constructor() { - // A map sorted by DocumentKey, whose value is a pair of the largest batch id - // for the overlay and the overlay itself. - this.overlays = new Gt(dt.comparator), this.es = new Map(); - } - - getOverlay(t, e) { - return Vt.resolve(this.overlays.get(e)); - } - - getOverlays(t, e) { - const n = fs(); - return Vt.forEach(e, e => this.getOverlay(t, e).next(t => { - null !== t && n.set(e, t); - })).next(() => n); - } - - saveOverlays(t, e, n) { - return n.forEach((n, s) => { - this.ue(t, e, s); - }), Vt.resolve(); - } - - removeOverlaysForBatchId(t, e, n) { - const s = this.es.get(n); - return void 0 !== s && (s.forEach(t => this.overlays = this.overlays.remove(t)), this.es.delete(n)), Vt.resolve(); - } - - getOverlaysForCollection(t, e, n) { - const s = fs(), - i = e.length + 1, - r = new dt(e.child("")), - o = this.overlays.getIteratorFrom(r); - - for (; o.hasNext();) { - const t = o.getNext().value, - r = t.getKey(); - if (!e.isPrefixOf(r.path)) break; // Documents from sub-collections - - r.path.length === i && t.largestBatchId > n && s.set(t.getKey(), t); - } - - return Vt.resolve(s); - } - - getOverlaysForCollectionGroup(t, e, n, s) { - let i = new Gt((t, e) => t - e); - const r = this.overlays.getIterator(); - - for (; r.hasNext();) { - const t = r.getNext().value; - - if (t.getKey().getCollectionGroup() === e && t.largestBatchId > n) { - let e = i.get(t.largestBatchId); - null === e && (e = fs(), i = i.insert(t.largestBatchId, e)), e.set(t.getKey(), t); - } - } - - const o = fs(), - u = i.getIterator(); - - for (; u.hasNext();) { - if (u.getNext().value.forEach((t, e) => o.set(t, e)), o.size() >= s) break; - } - - return Vt.resolve(o); - } - - ue(t, e, n) { - // Remove the association of the overlay to its batch id. - const s = this.overlays.get(n.key); - - if (null !== s) { - const t = this.es.get(s.largestBatchId).delete(n.key); - this.es.set(s.largestBatchId, t); - } - - this.overlays = this.overlays.insert(n.key, new Ui(e, n)); // Create the association of this overlay to the given largestBatchId. - - let i = this.es.get(e); - void 0 === i && (i = gs(), this.es.set(e, i)), this.es.set(e, i.add(n.key)); - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A collection of references to a document from some kind of numbered entity - * (either a target ID or batch ID). As references are added to or removed from - * the set corresponding events are emitted to a registered garbage collector. - * - * Each reference is represented by a DocumentReference object. Each of them - * contains enough information to uniquely identify the reference. They are all - * stored primarily in a set sorted by key. A document is considered garbage if - * there's no references in that set (this can be efficiently checked thanks to - * sorting by key). - * - * ReferenceSet also keeps a secondary set that contains references sorted by - * IDs. This one is used to efficiently implement removal of all references by - * some target ID. - */ - - -class oo { - constructor() { - // A set of outstanding references to a document sorted by key. - this.ns = new Wt(uo.ss), // A set of outstanding references to a document sorted by target id. - this.rs = new Wt(uo.os); - } - /** Returns true if the reference set contains no references. */ - - - isEmpty() { - return this.ns.isEmpty(); - } - /** Adds a reference to the given document key for the given ID. */ - - - addReference(t, e) { - const n = new uo(t, e); - this.ns = this.ns.add(n), this.rs = this.rs.add(n); - } - /** Add references to the given document keys for the given ID. */ - - - us(t, e) { - t.forEach(t => this.addReference(t, e)); - } - /** - * Removes a reference to the given document key for the given - * ID. - */ - - - removeReference(t, e) { - this.cs(new uo(t, e)); - } - - hs(t, e) { - t.forEach(t => this.removeReference(t, e)); - } - /** - * Clears all references with a given ID. Calls removeRef() for each key - * removed. - */ - - - ls(t) { - const e = new dt(new ht([])), - n = new uo(e, t), - s = new uo(e, t + 1), - i = []; - return this.rs.forEachInRange([n, s], t => { - this.cs(t), i.push(t.key); - }), i; - } - - fs() { - this.ns.forEach(t => this.cs(t)); - } - - cs(t) { - this.ns = this.ns.delete(t), this.rs = this.rs.delete(t); - } - - ds(t) { - const e = new dt(new ht([])), - n = new uo(e, t), - s = new uo(e, t + 1); - let i = gs(); - return this.rs.forEachInRange([n, s], t => { - i = i.add(t.key); - }), i; - } - - containsKey(t) { - const e = new uo(t, 0), - n = this.ns.firstAfterOrEqual(e); - return null !== n && t.isEqual(n.key); - } - -} - -class uo { - constructor(t, e) { - this.key = t, this._s = e; - } - /** Compare by key then by ID */ - - - static ss(t, e) { - return dt.comparator(t.key, e.key) || it(t._s, e._s); - } - /** Compare by ID then by key */ - - - static os(t, e) { - return it(t._s, e._s) || dt.comparator(t.key, e.key); - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class co { - constructor(t, e) { - this.indexManager = t, this.referenceDelegate = e, - /** - * The set of all mutations that have been sent but not yet been applied to - * the backend. - */ - this.mutationQueue = [], - /** Next value to use when assigning sequential IDs to each mutation batch. */ - this.ws = 1, - /** An ordered mapping between documents and the mutations batch IDs. */ - this.gs = new Wt(uo.ss); - } - - checkEmpty(t) { - return Vt.resolve(0 === this.mutationQueue.length); - } - - addMutationBatch(t, e, n, s) { - const i = this.ws; - this.ws++, this.mutationQueue.length > 0 && this.mutationQueue[this.mutationQueue.length - 1]; - const r = new Bi(i, e, n, s); - this.mutationQueue.push(r); // Track references by document key and index collection parents. - - for (const e of s) this.gs = this.gs.add(new uo(e.key, i)), this.indexManager.addToCollectionParentIndex(t, e.key.path.popLast()); - - return Vt.resolve(r); - } - - lookupMutationBatch(t, e) { - return Vt.resolve(this.ys(e)); - } - - getNextMutationBatchAfterBatchId(t, e) { - const n = e + 1, - s = this.ps(n), - i = s < 0 ? 0 : s; // The requested batchId may still be out of range so normalize it to the - // start of the queue. - - return Vt.resolve(this.mutationQueue.length > i ? this.mutationQueue[i] : null); - } - - getHighestUnacknowledgedBatchId() { - return Vt.resolve(0 === this.mutationQueue.length ? -1 : this.ws - 1); - } - - getAllMutationBatches(t) { - return Vt.resolve(this.mutationQueue.slice()); - } - - getAllMutationBatchesAffectingDocumentKey(t, e) { - const n = new uo(e, 0), - s = new uo(e, Number.POSITIVE_INFINITY), - i = []; - return this.gs.forEachInRange([n, s], t => { - const e = this.ys(t._s); - i.push(e); - }), Vt.resolve(i); - } - - getAllMutationBatchesAffectingDocumentKeys(t, e) { - let n = new Wt(it); - return e.forEach(t => { - const e = new uo(t, 0), - s = new uo(t, Number.POSITIVE_INFINITY); - this.gs.forEachInRange([e, s], t => { - n = n.add(t._s); - }); - }), Vt.resolve(this.Is(n)); - } - - getAllMutationBatchesAffectingQuery(t, e) { - // Use the query path as a prefix for testing if a document matches the - // query. - const n = e.path, - s = n.length + 1; // Construct a document reference for actually scanning the index. Unlike - // the prefix the document key in this reference must have an even number of - // segments. The empty segment can be used a suffix of the query path - // because it precedes all other segments in an ordered traversal. - - let i = n; - dt.isDocumentKey(i) || (i = i.child("")); - const r = new uo(new dt(i), 0); // Find unique batchIDs referenced by all documents potentially matching the - // query. - - let o = new Wt(it); - return this.gs.forEachWhile(t => { - const e = t.key.path; - return !!n.isPrefixOf(e) && ( // Rows with document keys more than one segment longer than the query - // path can't be matches. For example, a query on 'rooms' can't match - // the document /rooms/abc/messages/xyx. - // TODO(mcg): we'll need a different scanner when we implement - // ancestor queries. - e.length === s && (o = o.add(t._s)), !0); - }, r), Vt.resolve(this.Is(o)); - } - - Is(t) { - // Construct an array of matching batches, sorted by batchID to ensure that - // multiple mutations affecting the same document key are applied in order. - const e = []; - return t.forEach(t => { - const n = this.ys(t); - null !== n && e.push(n); - }), e; - } - - removeMutationBatch(t, e) { - U(0 === this.Ts(e.batchId, "removed")), this.mutationQueue.shift(); - let n = this.gs; - return Vt.forEach(e.mutations, s => { - const i = new uo(s.key, e.batchId); - return n = n.delete(i), this.referenceDelegate.markPotentiallyOrphaned(t, s.key); - }).next(() => { - this.gs = n; - }); - } - - An(t) {// No-op since the memory mutation queue does not maintain a separate cache. - } - - containsKey(t, e) { - const n = new uo(e, 0), - s = this.gs.firstAfterOrEqual(n); - return Vt.resolve(e.isEqual(s && s.key)); - } - - performConsistencyCheck(t) { - return this.mutationQueue.length, Vt.resolve(); - } - /** - * Finds the index of the given batchId in the mutation queue and asserts that - * the resulting index is within the bounds of the queue. - * - * @param batchId - The batchId to search for - * @param action - A description of what the caller is doing, phrased in passive - * form (e.g. "acknowledged" in a routine that acknowledges batches). - */ - - - Ts(t, e) { - return this.ps(t); - } - /** - * Finds the index of the given batchId in the mutation queue. This operation - * is O(1). - * - * @returns The computed index of the batch with the given batchId, based on - * the state of the queue. Note this index can be negative if the requested - * batchId has already been remvoed from the queue or past the end of the - * queue if the batchId is larger than the last added batch. - */ - - - ps(t) { - if (0 === this.mutationQueue.length) // As an index this is past the end of the queue - return 0; // Examine the front of the queue to figure out the difference between the - // batchId and indexes in the array. Note that since the queue is ordered - // by batchId, if the first batch has a larger batchId then the requested - // batchId doesn't exist in the queue. - - return t - this.mutationQueue[0].batchId; - } - /** - * A version of lookupMutationBatch that doesn't return a promise, this makes - * other functions that uses this code easier to read and more efficent. - */ - - - ys(t) { - const e = this.ps(t); - if (e < 0 || e >= this.mutationQueue.length) return null; - return this.mutationQueue[e]; - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * The memory-only RemoteDocumentCache for IndexedDb. To construct, invoke - * `newMemoryRemoteDocumentCache()`. - */ - - -class ao { - /** - * @param sizer - Used to assess the size of a document. For eager GC, this is - * expected to just return 0 to avoid unnecessarily doing the work of - * calculating the size. - */ - constructor(t) { - this.Es = t, - /** Underlying cache of documents and their read times. */ - this.docs = new Gt(dt.comparator), - /** Size of all cached documents. */ - this.size = 0; - } - - setIndexManager(t) { - this.indexManager = t; - } - /** - * Adds the supplied entry to the cache and updates the cache size as appropriate. - * - * All calls of `addEntry` are required to go through the RemoteDocumentChangeBuffer - * returned by `newChangeBuffer()`. - */ - - - addEntry(t, e) { - const n = e.key, - s = this.docs.get(n), - i = s ? s.size : 0, - r = this.Es(e); - return this.docs = this.docs.insert(n, { - document: e.mutableCopy(), - size: r - }), this.size += r - i, this.indexManager.addToCollectionParentIndex(t, n.path.popLast()); - } - /** - * Removes the specified entry from the cache and updates the cache size as appropriate. - * - * All calls of `removeEntry` are required to go through the RemoteDocumentChangeBuffer - * returned by `newChangeBuffer()`. - */ - - - removeEntry(t) { - const e = this.docs.get(t); - e && (this.docs = this.docs.remove(t), this.size -= e.size); - } - - getEntry(t, e) { - const n = this.docs.get(e); - return Vt.resolve(n ? n.document.mutableCopy() : ke.newInvalidDocument(e)); - } - - getEntries(t, e) { - let n = cs(); - return e.forEach(t => { - const e = this.docs.get(t); - n = n.insert(t, e ? e.document.mutableCopy() : ke.newInvalidDocument(t)); - }), Vt.resolve(n); - } - - getAllFromCollection(t, e, n) { - let s = cs(); // Documents are ordered by key, so we can use a prefix scan to narrow down - // the documents we need to match the query against. - - const i = new dt(e.child("")), - r = this.docs.getIteratorFrom(i); - - for (; r.hasNext();) { - const { - key: t, - value: { - document: i - } - } = r.getNext(); - if (!e.isPrefixOf(t.path)) break; - t.path.length > e.length + 1 || Rt(Et(i), n) <= 0 || (s = s.insert(i.key, i.mutableCopy())); - } - - return Vt.resolve(s); - } - - getAllFromCollectionGroup(t, e, n, s) { - // This method should only be called from the IndexBackfiller if persistence - // is enabled. - L(); - } - - As(t, e) { - return Vt.forEach(this.docs, t => e(t)); - } - - newChangeBuffer(t) { - // `trackRemovals` is ignores since the MemoryRemoteDocumentCache keeps - // a separate changelog and does not need special handling for removals. - return new ho(this); - } - - getSize(t) { - return Vt.resolve(this.size); - } - -} -/** - * Creates a new memory-only RemoteDocumentCache. - * - * @param sizer - Used to assess the size of a document. For eager GC, this is - * expected to just return 0 to avoid unnecessarily doing the work of - * calculating the size. - */ - -/** - * Handles the details of adding and updating documents in the MemoryRemoteDocumentCache. - */ - - -class ho extends Wr { - constructor(t) { - super(), this.Yn = t; - } - - applyChanges(t) { - const e = []; - return this.changes.forEach((n, s) => { - s.isValidDocument() ? e.push(this.Yn.addEntry(t, s)) : this.Yn.removeEntry(n); - }), Vt.waitFor(e); - } - - getFromCache(t, e) { - return this.Yn.getEntry(t, e); - } - - getAllFromCache(t, e) { - return this.Yn.getEntries(t, e); - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class lo { - constructor(t) { - this.persistence = t, - /** - * Maps a target to the data about that target - */ - this.Rs = new os(t => Fe(t), Be), - /** The last received snapshot version. */ - this.lastRemoteSnapshotVersion = ct.min(), - /** The highest numbered target ID encountered. */ - this.highestTargetId = 0, - /** The highest sequence number encountered. */ - this.bs = 0, - /** - * A ordered bidirectional mapping between documents and the remote target - * IDs. - */ - this.Ps = new oo(), this.targetCount = 0, this.vs = Or.Pn(); - } - - forEachTarget(t, e) { - return this.Rs.forEach((t, n) => e(n)), Vt.resolve(); - } - - getLastRemoteSnapshotVersion(t) { - return Vt.resolve(this.lastRemoteSnapshotVersion); - } - - getHighestSequenceNumber(t) { - return Vt.resolve(this.bs); - } - - allocateTargetId(t) { - return this.highestTargetId = this.vs.next(), Vt.resolve(this.highestTargetId); - } - - setTargetsMetadata(t, e, n) { - return n && (this.lastRemoteSnapshotVersion = n), e > this.bs && (this.bs = e), Vt.resolve(); - } - - Dn(t) { - this.Rs.set(t.target, t); - const e = t.targetId; - e > this.highestTargetId && (this.vs = new Or(e), this.highestTargetId = e), t.sequenceNumber > this.bs && (this.bs = t.sequenceNumber); - } - - addTargetData(t, e) { - return this.Dn(e), this.targetCount += 1, Vt.resolve(); - } - - updateTargetData(t, e) { - return this.Dn(e), Vt.resolve(); - } - - removeTargetData(t, e) { - return this.Rs.delete(e.target), this.Ps.ls(e.targetId), this.targetCount -= 1, Vt.resolve(); - } - - removeTargets(t, e, n) { - let s = 0; - const i = []; - return this.Rs.forEach((r, o) => { - o.sequenceNumber <= e && null === n.get(o.targetId) && (this.Rs.delete(r), i.push(this.removeMatchingKeysForTargetId(t, o.targetId)), s++); - }), Vt.waitFor(i).next(() => s); - } - - getTargetCount(t) { - return Vt.resolve(this.targetCount); - } - - getTargetData(t, e) { - const n = this.Rs.get(e) || null; - return Vt.resolve(n); - } - - addMatchingKeys(t, e, n) { - return this.Ps.us(e, n), Vt.resolve(); - } - - removeMatchingKeys(t, e, n) { - this.Ps.hs(e, n); - const s = this.persistence.referenceDelegate, - i = []; - return s && e.forEach(e => { - i.push(s.markPotentiallyOrphaned(t, e)); - }), Vt.waitFor(i); - } - - removeMatchingKeysForTargetId(t, e) { - return this.Ps.ls(e), Vt.resolve(); - } - - getMatchingKeysForTargetId(t, e) { - const n = this.Ps.ds(e); - return Vt.resolve(n); - } - - containsKey(t, e) { - return Vt.resolve(this.Ps.containsKey(e)); - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A memory-backed instance of Persistence. Data is stored only in RAM and - * not persisted across sessions. - */ - - -class fo { - /** - * The constructor accepts a factory for creating a reference delegate. This - * allows both the delegate and this instance to have strong references to - * each other without having nullable fields that would then need to be - * checked or asserted on every access. - */ - constructor(t, e) { - this.Vs = {}, this.overlays = {}, this.Ss = new Lt(0), this.Ds = !1, this.Ds = !0, this.referenceDelegate = t(this), this.Cs = new lo(this); - this.indexManager = new yr(), this.remoteDocumentCache = function (t) { - return new ao(t); - }(t => this.referenceDelegate.xs(t)), this.It = new Ki(e), this.Ns = new io(this.It); - } - - start() { - return Promise.resolve(); - } - - shutdown() { - // No durable state to ensure is closed on shutdown. - return this.Ds = !1, Promise.resolve(); - } - - get started() { - return this.Ds; - } - - setDatabaseDeletedListener() {// No op. - } - - setNetworkEnabled() {// No op. - } - - getIndexManager(t) { - // We do not currently support indices for memory persistence, so we can - // return the same shared instance of the memory index manager. - return this.indexManager; - } - - getDocumentOverlayCache(t) { - let e = this.overlays[t.toKey()]; - return e || (e = new ro(), this.overlays[t.toKey()] = e), e; - } - - getMutationQueue(t, e) { - let n = this.Vs[t.toKey()]; - return n || (n = new co(e, this.referenceDelegate), this.Vs[t.toKey()] = n), n; - } - - getTargetCache() { - return this.Cs; - } - - getRemoteDocumentCache() { - return this.remoteDocumentCache; - } - - getBundleCache() { - return this.Ns; - } - - runTransaction(t, e, n) { - O("MemoryPersistence", "Starting transaction:", t); - const s = new _o(this.Ss.next()); - return this.referenceDelegate.ks(), n(s).next(t => this.referenceDelegate.Ms(s).next(() => t)).toPromise().then(t => (s.raiseOnCommittedEvent(), t)); - } - - Os(t, e) { - return Vt.or(Object.values(this.Vs).map(n => () => n.containsKey(t, e))); - } - -} -/** - * Memory persistence is not actually transactional, but future implementations - * may have transaction-scoped state. - */ - - -class _o extends Pt { - constructor(t) { - super(), this.currentSequenceNumber = t; - } - -} - -class wo { - constructor(t) { - this.persistence = t, - /** Tracks all documents that are active in Query views. */ - this.Fs = new oo(), - /** The list of documents that are potentially GCed after each transaction. */ - this.$s = null; - } - - static Bs(t) { - return new wo(t); - } - - get Ls() { - if (this.$s) return this.$s; - throw L(); - } - - addReference(t, e, n) { - return this.Fs.addReference(n, e), this.Ls.delete(n.toString()), Vt.resolve(); - } - - removeReference(t, e, n) { - return this.Fs.removeReference(n, e), this.Ls.add(n.toString()), Vt.resolve(); - } - - markPotentiallyOrphaned(t, e) { - return this.Ls.add(e.toString()), Vt.resolve(); - } - - removeTarget(t, e) { - this.Fs.ls(e.targetId).forEach(t => this.Ls.add(t.toString())); - const n = this.persistence.getTargetCache(); - return n.getMatchingKeysForTargetId(t, e.targetId).next(t => { - t.forEach(t => this.Ls.add(t.toString())); - }).next(() => n.removeTargetData(t, e)); - } - - ks() { - this.$s = new Set(); - } - - Ms(t) { - // Remove newly orphaned documents. - const e = this.persistence.getRemoteDocumentCache().newChangeBuffer(); - return Vt.forEach(this.Ls, n => { - const s = dt.fromPath(n); - return this.Us(t, s).next(t => { - t || e.removeEntry(s, ct.min()); - }); - }).next(() => (this.$s = null, e.apply(t))); - } - - updateLimboDocument(t, e) { - return this.Us(t, e).next(t => { - t ? this.Ls.delete(e.toString()) : this.Ls.add(e.toString()); - }); - } - - xs(t) { - // For eager GC, we don't care about the document size, there are no size thresholds. - return 0; - } - - Us(t, e) { - return Vt.or([() => Vt.resolve(this.Fs.containsKey(e)), () => this.persistence.getTargetCache().containsKey(t, e), () => this.persistence.Os(t, e)]); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** Performs database creation and schema upgrades. */ - - -class mo { - constructor(t) { - this.It = t; - } - /** - * Performs database creation and schema upgrades. - * - * Note that in production, this method is only ever used to upgrade the schema - * to SCHEMA_VERSION. Different values of toVersion are only used for testing - * and local feature development. - */ - - - $(t, e, n, s) { - const i = new St("createOrUpgrade", e); - n < 1 && s >= 1 && (function (t) { - t.createObjectStore("owner"); - }(t), function (t) { - t.createObjectStore("mutationQueues", { - keyPath: "userId" - }); - t.createObjectStore("mutations", { - keyPath: "batchId", - autoIncrement: !0 - }).createIndex("userMutationsIndex", _i, { - unique: !0 - }), t.createObjectStore("documentMutations"); - } - /** - * Upgrade function to migrate the 'mutations' store from V1 to V3. Loads - * and rewrites all data. - */ - (t), go(t), function (t) { - t.createObjectStore("remoteDocuments"); - }(t)); // Migration 2 to populate the targetGlobal object no longer needed since - // migration 3 unconditionally clears it. - - let r = Vt.resolve(); - return n < 3 && s >= 3 && ( // Brand new clients don't need to drop and recreate--only clients that - // potentially have corrupt data. - 0 !== n && (!function (t) { - t.deleteObjectStore("targetDocuments"), t.deleteObjectStore("targets"), t.deleteObjectStore("targetGlobal"); - }(t), go(t)), r = r.next(() => - /** - * Creates the target global singleton row. - * - * @param txn - The version upgrade transaction for indexeddb - */ - function (t) { - const e = t.store("targetGlobal"), - n = { - highestTargetId: 0, - highestListenSequenceNumber: 0, - lastRemoteSnapshotVersion: ct.min().toTimestamp(), - targetCount: 0 - }; - return e.put("targetGlobalKey", n); - }(i))), n < 4 && s >= 4 && (0 !== n && ( // Schema version 3 uses auto-generated keys to generate globally unique - // mutation batch IDs (this was previously ensured internally by the - // client). To migrate to the new schema, we have to read all mutations - // and write them back out. We preserve the existing batch IDs to guarantee - // consistency with other object stores. Any further mutation batch IDs will - // be auto-generated. - r = r.next(() => function (t, e) { - return e.store("mutations").W().next(n => { - t.deleteObjectStore("mutations"); - t.createObjectStore("mutations", { - keyPath: "batchId", - autoIncrement: !0 - }).createIndex("userMutationsIndex", _i, { - unique: !0 - }); - const s = e.store("mutations"), - i = n.map(t => s.put(t)); - return Vt.waitFor(i); - }); - }(t, i))), r = r.next(() => { - !function (t) { - t.createObjectStore("clientMetadata", { - keyPath: "clientId" - }); - }(t); - })), n < 5 && s >= 5 && (r = r.next(() => this.qs(i))), n < 6 && s >= 6 && (r = r.next(() => (function (t) { - t.createObjectStore("remoteDocumentGlobal"); - }(t), this.Ks(i)))), n < 7 && s >= 7 && (r = r.next(() => this.Gs(i))), n < 8 && s >= 8 && (r = r.next(() => this.Qs(t, i))), n < 9 && s >= 9 && (r = r.next(() => { - // Multi-Tab used to manage its own changelog, but this has been moved - // to the DbRemoteDocument object store itself. Since the previous change - // log only contained transient data, we can drop its object store. - !function (t) { - t.objectStoreNames.contains("remoteDocumentChanges") && t.deleteObjectStore("remoteDocumentChanges"); - }(t); // Note: Schema version 9 used to create a read time index for the - // RemoteDocumentCache. This is now done with schema version 13. - })), n < 10 && s >= 10 && (r = r.next(() => this.js(i))), n < 11 && s >= 11 && (r = r.next(() => { - !function (t) { - t.createObjectStore("bundles", { - keyPath: "bundleId" - }); - }(t), function (t) { - t.createObjectStore("namedQueries", { - keyPath: "name" - }); - }(t); - })), n < 12 && s >= 12 && (r = r.next(() => { - !function (t) { - const e = t.createObjectStore("documentOverlays", { - keyPath: Si - }); - e.createIndex("collectionPathOverlayIndex", Di, { - unique: !1 - }), e.createIndex("collectionGroupOverlayIndex", Ci, { - unique: !1 - }); - }(t); - })), n < 13 && s >= 13 && (r = r.next(() => function (t) { - const e = t.createObjectStore("remoteDocumentsV14", { - keyPath: yi - }); - e.createIndex("documentKeyIndex", pi), e.createIndex("collectionGroupIndex", Ii); - }(t)).next(() => this.Ws(t, i)).next(() => t.deleteObjectStore("remoteDocuments"))), n < 14 && s >= 14 && (r = r.next(() => this.zs(t, i))), n < 15 && s >= 15 && (r = r.next(() => function (t) { - t.createObjectStore("indexConfiguration", { - keyPath: "indexId", - autoIncrement: !0 - }).createIndex("collectionGroupIndex", "collectionGroup", { - unique: !1 - }); - t.createObjectStore("indexState", { - keyPath: bi - }).createIndex("sequenceNumberIndex", Pi, { - unique: !1 - }); - t.createObjectStore("indexEntries", { - keyPath: vi - }).createIndex("documentKeyIndex", Vi, { - unique: !1 - }); - }(t))), r; - } - - Ks(t) { - let e = 0; - return t.store("remoteDocuments").Z((t, n) => { - e += Dr(n); - }).next(() => { - const n = { - byteSize: e - }; - return t.store("remoteDocumentGlobal").put("remoteDocumentGlobalKey", n); - }); - } - - qs(t) { - const e = t.store("mutationQueues"), - n = t.store("mutations"); - return e.W().next(e => Vt.forEach(e, e => { - const s = IDBKeyRange.bound([e.userId, -1], [e.userId, e.lastAcknowledgedBatchId]); - return n.W("userMutationsIndex", s).next(n => Vt.forEach(n, n => { - U(n.userId === e.userId); - const s = Hi(this.It, n); - return Sr(t, e.userId, s).next(() => {}); - })); - })); - } - /** - * Ensures that every document in the remote document cache has a corresponding sentinel row - * with a sequence number. Missing rows are given the most recently used sequence number. - */ - - - Gs(t) { - const e = t.store("targetDocuments"), - n = t.store("remoteDocuments"); - return t.store("targetGlobal").get("targetGlobalKey").next(t => { - const s = []; - return n.Z((n, i) => { - const r = new ht(n), - o = function (t) { - return [0, hi(t)]; - }(r); - - s.push(e.get(o).next(n => n ? Vt.resolve() : (n => e.put({ - targetId: 0, - path: hi(n), - sequenceNumber: t.highestListenSequenceNumber - }))(r))); - }).next(() => Vt.waitFor(s)); - }); - } - - Qs(t, e) { - // Create the index. - t.createObjectStore("collectionParents", { - keyPath: Ri - }); - - const n = e.store("collectionParents"), - s = new pr(), - i = t => { - if (s.add(t)) { - const e = t.lastSegment(), - s = t.popLast(); - return n.put({ - collectionId: e, - parent: hi(s) - }); - } - }; // Helper to add an index entry iff we haven't already written it. - // Index existing remote documents. - - - return e.store("remoteDocuments").Z({ - X: !0 - }, (t, e) => { - const n = new ht(t); - return i(n.popLast()); - }).next(() => e.store("documentMutations").Z({ - X: !0 - }, (_ref8, s) => { - let [t, e, n] = _ref8; - const r = di(e); - return i(r.popLast()); - })); - } - - js(t) { - const e = t.store("targets"); - return e.Z((t, n) => { - const s = Ji(n), - i = Yi(this.It, s); - return e.put(i); - }); - } - - Ws(t, e) { - const n = e.store("remoteDocuments"), - s = []; - return n.Z((t, n) => { - const i = e.store("remoteDocumentsV14"), - r = (o = n, o.document ? new dt(ht.fromString(o.document.name).popFirst(5)) : o.noDocument ? dt.fromSegments(o.noDocument.path) : o.unknownDocument ? dt.fromSegments(o.unknownDocument.path) : L()).path.toArray(); - var o; - /** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - const u = { - prefixPath: r.slice(0, r.length - 2), - collectionGroup: r[r.length - 2], - documentId: r[r.length - 1], - readTime: n.readTime || [0, 0], - unknownDocument: n.unknownDocument, - noDocument: n.noDocument, - document: n.document, - hasCommittedMutations: !!n.hasCommittedMutations - }; - s.push(i.put(u)); - }).next(() => Vt.waitFor(s)); - } - - zs(t, e) { - const n = e.store("mutations"), - s = Hr(this.It), - i = new fo(wo.Bs, this.It.re); - return n.W().next(t => { - const n = new Map(); - return t.forEach(t => { - var e; - let s = null !== (e = n.get(t.userId)) && void 0 !== e ? e : gs(); - Hi(this.It, t).keys().forEach(t => s = s.add(t)), n.set(t.userId, s); - }), Vt.forEach(n, (t, n) => { - const r = new C(n), - o = rr.oe(this.It, r), - u = i.getIndexManager(r), - c = Cr.oe(r, this.It, u, i.referenceDelegate); - return new so(s, c, o, u).recalculateAndSaveOverlaysForDocumentKeys(new Fi(e, Lt.at), t).next(); - }); - }); - } - -} - -function go(t) { - t.createObjectStore("targetDocuments", { - keyPath: Ei - }).createIndex("documentTargetsIndex", Ai, { - unique: !0 - }); // NOTE: This is unique only because the TargetId is the suffix. - - t.createObjectStore("targets", { - keyPath: "targetId" - }).createIndex("queryTargetsIndex", Ti, { - unique: !0 - }), t.createObjectStore("targetGlobal"); -} - -const yo = "Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time."; -/** - * Oldest acceptable age in milliseconds for client metadata before the client - * is considered inactive and its associated data is garbage collected. - */ - -/** - * An IndexedDB-backed instance of Persistence. Data is stored persistently - * across sessions. - * - * On Web only, the Firestore SDKs support shared access to its persistence - * layer. This allows multiple browser tabs to read and write to IndexedDb and - * to synchronize state even without network connectivity. Shared access is - * currently optional and not enabled unless all clients invoke - * `enablePersistence()` with `{synchronizeTabs:true}`. - * - * In multi-tab mode, if multiple clients are active at the same time, the SDK - * will designate one client as the “primary client”. An effort is made to pick - * a visible, network-connected and active client, and this client is - * responsible for letting other clients know about its presence. The primary - * client writes a unique client-generated identifier (the client ID) to - * IndexedDb’s “owner” store every 4 seconds. If the primary client fails to - * update this entry, another client can acquire the lease and take over as - * primary. - * - * Some persistence operations in the SDK are designated as primary-client only - * operations. This includes the acknowledgment of mutations and all updates of - * remote documents. The effects of these operations are written to persistence - * and then broadcast to other tabs via LocalStorage (see - * `WebStorageSharedClientState`), which then refresh their state from - * persistence. - * - * Similarly, the primary client listens to notifications sent by secondary - * clients to discover persistence changes written by secondary clients, such as - * the addition of new mutations and query targets. - * - * If multi-tab is not enabled and another tab already obtained the primary - * lease, IndexedDbPersistence enters a failed state and all subsequent - * operations will automatically fail. - * - * Additionally, there is an optimization so that when a tab is closed, the - * primary lease is released immediately (this is especially important to make - * sure that a refreshed tab is able to immediately re-acquire the primary - * lease). Unfortunately, IndexedDB cannot be reliably used in window.unload - * since it is an asynchronous API. So in addition to attempting to give up the - * lease, the leaseholder writes its client ID to a "zombiedClient" entry in - * LocalStorage which acts as an indicator that another tab should go ahead and - * take the primary lease immediately regardless of the current lease timestamp. - * - * TODO(b/114226234): Remove `synchronizeTabs` section when multi-tab is no - * longer optional. - */ - -class po { - constructor( - /** - * Whether to synchronize the in-memory state of multiple tabs and share - * access to local persistence. - */ - t, e, n, s, i, r, o, u, c, - /** - * If set to true, forcefully obtains database access. Existing tabs will - * no longer be able to access IndexedDB. - */ - a) { - let h = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : 15; - if (this.allowTabSynchronization = t, this.persistenceKey = e, this.clientId = n, this.Hs = i, this.window = r, this.document = o, this.Js = c, this.Ys = a, this.Xs = h, this.Ss = null, this.Ds = !1, this.isPrimary = !1, this.networkEnabled = !0, - /** Our window.unload handler, if registered. */ - this.Zs = null, this.inForeground = !1, - /** Our 'visibilitychange' listener if registered. */ - this.ti = null, - /** The client metadata refresh task. */ - this.ei = null, - /** The last time we garbage collected the client metadata object store. */ - this.ni = Number.NEGATIVE_INFINITY, - /** A listener to notify on primary state changes. */ - this.si = t => Promise.resolve(), !po.C()) throw new Q(G.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled."); - this.referenceDelegate = new Qr(this, s), this.ii = e + "main", this.It = new Ki(u), this.ri = new Dt(this.ii, this.Xs, new mo(this.It)), this.Cs = new Fr(this.referenceDelegate, this.It), this.remoteDocumentCache = Hr(this.It), this.Ns = new nr(), this.window && this.window.localStorage ? this.oi = this.window.localStorage : (this.oi = null, !1 === a && F("IndexedDbPersistence", "LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page.")); - } - /** - * Attempt to start IndexedDb persistence. - * - * @returns Whether persistence was enabled. - */ - - - start() { - // NOTE: This is expected to fail sometimes (in the case of another tab - // already having the persistence lock), so it's the first thing we should - // do. - return this.ui().then(() => { - if (!this.isPrimary && !this.allowTabSynchronization) // Fail `start()` if `synchronizeTabs` is disabled and we cannot - // obtain the primary lease. - throw new Q(G.FAILED_PRECONDITION, yo); - return this.ci(), this.ai(), this.hi(), this.runTransaction("getHighestListenSequenceNumber", "readonly", t => this.Cs.getHighestSequenceNumber(t)); - }).then(t => { - this.Ss = new Lt(t, this.Js); - }).then(() => { - this.Ds = !0; - }).catch(t => (this.ri && this.ri.close(), Promise.reject(t))); - } - /** - * Registers a listener that gets called when the primary state of the - * instance changes. Upon registering, this listener is invoked immediately - * with the current primary state. - * - * PORTING NOTE: This is only used for Web multi-tab. - */ - - - li(t) { - return this.si = async e => { - if (this.started) return t(e); - }, t(this.isPrimary); - } - /** - * Registers a listener that gets called when the database receives a - * version change event indicating that it has deleted. - * - * PORTING NOTE: This is only used for Web multi-tab. - */ - - - setDatabaseDeletedListener(t) { - this.ri.L(async e => { - // Check if an attempt is made to delete IndexedDB. - null === e.newVersion && (await t()); - }); - } - /** - * Adjusts the current network state in the client's metadata, potentially - * affecting the primary lease. - * - * PORTING NOTE: This is only used for Web multi-tab. - */ - - - setNetworkEnabled(t) { - this.networkEnabled !== t && (this.networkEnabled = t, // Schedule a primary lease refresh for immediate execution. The eventual - // lease update will be propagated via `primaryStateListener`. - this.Hs.enqueueAndForget(async () => { - this.started && (await this.ui()); - })); - } - /** - * Updates the client metadata in IndexedDb and attempts to either obtain or - * extend the primary lease for the local client. Asynchronously notifies the - * primary state listener if the client either newly obtained or released its - * primary lease. - */ - - - ui() { - return this.runTransaction("updateClientMetadataAndTryBecomePrimary", "readwrite", t => To(t).put({ - clientId: this.clientId, - updateTimeMs: Date.now(), - networkEnabled: this.networkEnabled, - inForeground: this.inForeground - }).next(() => { - if (this.isPrimary) return this.fi(t).next(t => { - t || (this.isPrimary = !1, this.Hs.enqueueRetryable(() => this.si(!1))); - }); - }).next(() => this.di(t)).next(e => this.isPrimary && !e ? this._i(t).next(() => !1) : !!e && this.wi(t).next(() => !0))).catch(t => { - if (Nt(t)) // Proceed with the existing state. Any subsequent access to - // IndexedDB will verify the lease. - return O("IndexedDbPersistence", "Failed to extend owner lease: ", t), this.isPrimary; - if (!this.allowTabSynchronization) throw t; - return O("IndexedDbPersistence", "Releasing owner lease after error during lease refresh", t), - /* isPrimary= */ - !1; - }).then(t => { - this.isPrimary !== t && this.Hs.enqueueRetryable(() => this.si(t)), this.isPrimary = t; - }); - } - - fi(t) { - return Io(t).get("owner").next(t => Vt.resolve(this.mi(t))); - } - - gi(t) { - return To(t).delete(this.clientId); - } - /** - * If the garbage collection threshold has passed, prunes the - * RemoteDocumentChanges and the ClientMetadata store based on the last update - * time of all clients. - */ - - - async yi() { - if (this.isPrimary && !this.pi(this.ni, 18e5)) { - this.ni = Date.now(); - const t = await this.runTransaction("maybeGarbageCollectMultiClientState", "readwrite-primary", t => { - const e = $i(t, "clientMetadata"); - return e.W().next(t => { - const n = this.Ii(t, 18e5), - s = t.filter(t => -1 === n.indexOf(t)); // Delete metadata for clients that are no longer considered active. - - return Vt.forEach(s, t => e.delete(t.clientId)).next(() => s); - }); - }).catch(() => []); // Delete potential leftover entries that may continue to mark the - // inactive clients as zombied in LocalStorage. - // Ideally we'd delete the IndexedDb and LocalStorage zombie entries for - // the client atomically, but we can't. So we opt to delete the IndexedDb - // entries first to avoid potentially reviving a zombied client. - - if (this.oi) for (const e of t) this.oi.removeItem(this.Ti(e.clientId)); - } - } - /** - * Schedules a recurring timer to update the client metadata and to either - * extend or acquire the primary lease if the client is eligible. - */ - - - hi() { - this.ei = this.Hs.enqueueAfterDelay("client_metadata_refresh" - /* ClientMetadataRefresh */ - , 4e3, () => this.ui().then(() => this.yi()).then(() => this.hi())); - } - /** Checks whether `client` is the local client. */ - - - mi(t) { - return !!t && t.ownerId === this.clientId; - } - /** - * Evaluate the state of all active clients and determine whether the local - * client is or can act as the holder of the primary lease. Returns whether - * the client is eligible for the lease, but does not actually acquire it. - * May return 'false' even if there is no active leaseholder and another - * (foreground) client should become leaseholder instead. - */ - - - di(t) { - if (this.Ys) return Vt.resolve(!0); - return Io(t).get("owner").next(e => { - // A client is eligible for the primary lease if: - // - its network is enabled and the client's tab is in the foreground. - // - its network is enabled and no other client's tab is in the - // foreground. - // - every clients network is disabled and the client's tab is in the - // foreground. - // - every clients network is disabled and no other client's tab is in - // the foreground. - // - the `forceOwningTab` setting was passed in. - if (null !== e && this.pi(e.leaseTimestampMs, 5e3) && !this.Ei(e.ownerId)) { - if (this.mi(e) && this.networkEnabled) return !0; - - if (!this.mi(e)) { - if (!e.allowTabSynchronization) // Fail the `canActAsPrimary` check if the current leaseholder has - // not opted into multi-tab synchronization. If this happens at - // client startup, we reject the Promise returned by - // `enablePersistence()` and the user can continue to use Firestore - // with in-memory persistence. - // If this fails during a lease refresh, we will instead block the - // AsyncQueue from executing further operations. Note that this is - // acceptable since mixing & matching different `synchronizeTabs` - // settings is not supported. - // TODO(b/114226234): Remove this check when `synchronizeTabs` can - // no longer be turned off. - throw new Q(G.FAILED_PRECONDITION, yo); - return !1; - } - } - - return !(!this.networkEnabled || !this.inForeground) || To(t).W().next(t => void 0 === this.Ii(t, 5e3).find(t => { - if (this.clientId !== t.clientId) { - const e = !this.networkEnabled && t.networkEnabled, - n = !this.inForeground && t.inForeground, - s = this.networkEnabled === t.networkEnabled; - if (e || n && s) return !0; - } - - return !1; - })); - }).next(t => (this.isPrimary !== t && O("IndexedDbPersistence", `Client ${t ? "is" : "is not"} eligible for a primary lease.`), t)); - } - - async shutdown() { - // The shutdown() operations are idempotent and can be called even when - // start() aborted (e.g. because it couldn't acquire the persistence lease). - this.Ds = !1, this.Ai(), this.ei && (this.ei.cancel(), this.ei = null), this.Ri(), this.bi(), // Use `SimpleDb.runTransaction` directly to avoid failing if another tab - // has obtained the primary lease. - await this.ri.runTransaction("shutdown", "readwrite", ["owner", "clientMetadata"], t => { - const e = new Fi(t, Lt.at); - return this._i(e).next(() => this.gi(e)); - }), this.ri.close(), // Remove the entry marking the client as zombied from LocalStorage since - // we successfully deleted its metadata from IndexedDb. - this.Pi(); - } - /** - * Returns clients that are not zombied and have an updateTime within the - * provided threshold. - */ - - - Ii(t, e) { - return t.filter(t => this.pi(t.updateTimeMs, e) && !this.Ei(t.clientId)); - } - /** - * Returns the IDs of the clients that are currently active. If multi-tab - * is not supported, returns an array that only contains the local client's - * ID. - * - * PORTING NOTE: This is only used for Web multi-tab. - */ - - - vi() { - return this.runTransaction("getActiveClients", "readonly", t => To(t).W().next(t => this.Ii(t, 18e5).map(t => t.clientId))); - } - - get started() { - return this.Ds; - } - - getMutationQueue(t, e) { - return Cr.oe(t, this.It, e, this.referenceDelegate); - } - - getTargetCache() { - return this.Cs; - } - - getRemoteDocumentCache() { - return this.remoteDocumentCache; - } - - getIndexManager(t) { - return new Tr(t, this.It.re.databaseId); - } - - getDocumentOverlayCache(t) { - return rr.oe(this.It, t); - } - - getBundleCache() { - return this.Ns; - } - - runTransaction(t, e, n) { - O("IndexedDbPersistence", "Starting transaction:", t); - const s = "readonly" === e ? "readonly" : "readwrite", - i = 15 === (r = this.Xs) ? Oi : 14 === r ? Mi : 13 === r ? ki : 12 === r ? Ni : 11 === r ? xi : void L(); - /** Returns the object stores for the provided schema. */ - - var r; - let o; // Do all transactions as readwrite against all object stores, since we - // are the only reader/writer. - - return this.ri.runTransaction(t, s, i, s => (o = new Fi(s, this.Ss ? this.Ss.next() : Lt.at), "readwrite-primary" === e ? this.fi(o).next(t => !!t || this.di(o)).next(e => { - if (!e) throw F(`Failed to obtain primary lease for action '${t}'.`), this.isPrimary = !1, this.Hs.enqueueRetryable(() => this.si(!1)), new Q(G.FAILED_PRECONDITION, bt); - return n(o); - }).next(t => this.wi(o).next(() => t)) : this.Vi(o).next(() => n(o)))).then(t => (o.raiseOnCommittedEvent(), t)); - } - /** - * Verifies that the current tab is the primary leaseholder or alternatively - * that the leaseholder has opted into multi-tab synchronization. - */ - // TODO(b/114226234): Remove this check when `synchronizeTabs` can no longer - // be turned off. - - - Vi(t) { - return Io(t).get("owner").next(t => { - if (null !== t && this.pi(t.leaseTimestampMs, 5e3) && !this.Ei(t.ownerId) && !this.mi(t) && !(this.Ys || this.allowTabSynchronization && t.allowTabSynchronization)) throw new Q(G.FAILED_PRECONDITION, yo); - }); - } - /** - * Obtains or extends the new primary lease for the local client. This - * method does not verify that the client is eligible for this lease. - */ - - - wi(t) { - const e = { - ownerId: this.clientId, - allowTabSynchronization: this.allowTabSynchronization, - leaseTimestampMs: Date.now() - }; - return Io(t).put("owner", e); - } - - static C() { - return Dt.C(); - } - /** Checks the primary lease and removes it if we are the current primary. */ - - - _i(t) { - const e = Io(t); - return e.get("owner").next(t => this.mi(t) ? (O("IndexedDbPersistence", "Releasing primary lease."), e.delete("owner")) : Vt.resolve()); - } - /** Verifies that `updateTimeMs` is within `maxAgeMs`. */ - - - pi(t, e) { - const n = Date.now(); - return !(t < n - e) && (!(t > n) || (F(`Detected an update time that is in the future: ${t} > ${n}`), !1)); - } - - ci() { - null !== this.document && "function" == typeof this.document.addEventListener && (this.ti = () => { - this.Hs.enqueueAndForget(() => (this.inForeground = "visible" === this.document.visibilityState, this.ui())); - }, this.document.addEventListener("visibilitychange", this.ti), this.inForeground = "visible" === this.document.visibilityState); - } - - Ri() { - this.ti && (this.document.removeEventListener("visibilitychange", this.ti), this.ti = null); - } - /** - * Attaches a window.unload handler that will synchronously write our - * clientId to a "zombie client id" location in LocalStorage. This can be used - * by tabs trying to acquire the primary lease to determine that the lease - * is no longer valid even if the timestamp is recent. This is particularly - * important for the refresh case (so the tab correctly re-acquires the - * primary lease). LocalStorage is used for this rather than IndexedDb because - * it is a synchronous API and so can be used reliably from an unload - * handler. - */ - - - ai() { - var t; - "function" == typeof (null === (t = this.window) || void 0 === t ? void 0 : t.addEventListener) && (this.Zs = () => { - // Note: In theory, this should be scheduled on the AsyncQueue since it - // accesses internal state. We execute this code directly during shutdown - // to make sure it gets a chance to run. - this.Ai(), (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.isSafari)() && navigator.appVersion.match(/Version\/1[45]/) && // On Safari 14 and 15, we do not run any cleanup actions as it might - // trigger a bug that prevents Safari from re-opening IndexedDB during - // the next page load. - // See https://bugs.webkit.org/show_bug.cgi?id=226547 - this.Hs.enterRestrictedMode( - /* purgeExistingTasks= */ - !0), this.Hs.enqueueAndForget(() => this.shutdown()); - }, this.window.addEventListener("pagehide", this.Zs)); - } - - bi() { - this.Zs && (this.window.removeEventListener("pagehide", this.Zs), this.Zs = null); - } - /** - * Returns whether a client is "zombied" based on its LocalStorage entry. - * Clients become zombied when their tab closes without running all of the - * cleanup logic in `shutdown()`. - */ - - - Ei(t) { - var e; - - try { - const n = null !== (null === (e = this.oi) || void 0 === e ? void 0 : e.getItem(this.Ti(t))); - return O("IndexedDbPersistence", `Client '${t}' ${n ? "is" : "is not"} zombied in LocalStorage`), n; - } catch (t) { - // Gracefully handle if LocalStorage isn't working. - return F("IndexedDbPersistence", "Failed to get zombied client id.", t), !1; - } - } - /** - * Record client as zombied (a client that had its tab closed). Zombied - * clients are ignored during primary tab selection. - */ - - - Ai() { - if (this.oi) try { - this.oi.setItem(this.Ti(this.clientId), String(Date.now())); - } catch (t) { - // Gracefully handle if LocalStorage isn't available / working. - F("Failed to set zombie client id.", t); - } - } - /** Removes the zombied client entry if it exists. */ - - - Pi() { - if (this.oi) try { - this.oi.removeItem(this.Ti(this.clientId)); - } catch (t) {// Ignore - } - } - - Ti(t) { - return `firestore_zombie_${this.persistenceKey}_${t}`; - } - -} -/** - * Helper to get a typed SimpleDbStore for the primary client object store. - */ - - -function Io(t) { - return $i(t, "owner"); -} -/** - * Helper to get a typed SimpleDbStore for the client metadata object store. - */ - - -function To(t) { - return $i(t, "clientMetadata"); -} -/** - * Generates a string used as a prefix when storing data in IndexedDB and - * LocalStorage. - */ - - -function Eo(t, e) { - // Use two different prefix formats: - // * firestore / persistenceKey / projectID . databaseID / ... - // * firestore / persistenceKey / projectID / ... - // projectIDs are DNS-compatible names and cannot contain dots - // so there's no danger of collisions. - let n = t.projectId; - return t.isDefaultDatabase || (n += "." + t.database), "firestore/" + e + "/" + n + "/"; -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A set of changes to what documents are currently in view and out of view for - * a given query. These changes are sent to the LocalStore by the View (via - * the SyncEngine) and are used to pin / unpin documents as appropriate. - */ - - -class Ao { - constructor(t, e, n, s) { - this.targetId = t, this.fromCache = e, this.Si = n, this.Di = s; - } - - static Ci(t, e) { - let n = gs(), - s = gs(); - - for (const t of e.docChanges) switch (t.type) { - case 0 - /* Added */ - : - n = n.add(t.doc.key); - break; - - case 1 - /* Removed */ - : - s = s.add(t.doc.key); - // do nothing - } - - return new Ao(t, e.fromCache, n, s); - } - -} -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * The Firestore query engine. - * - * Firestore queries can be executed in three modes. The Query Engine determines - * what mode to use based on what data is persisted. The mode only determines - * the runtime complexity of the query - the result set is equivalent across all - * implementations. - * - * The Query engine will use indexed-based execution if a user has configured - * any index that can be used to execute query (via `setIndexConfiguration()`). - * Otherwise, the engine will try to optimize the query by re-using a previously - * persisted query result. If that is not possible, the query will be executed - * via a full collection scan. - * - * Index-based execution is the default when available. The query engine - * supports partial indexed execution and merges the result from the index - * lookup with documents that have not yet been indexed. The index evaluation - * matches the backend's format and as such, the SDK can use indexing for all - * queries that the backend supports. - * - * If no index exists, the query engine tries to take advantage of the target - * document mapping in the TargetCache. These mappings exists for all queries - * that have been synced with the backend at least once and allow the query - * engine to only read documents that previously matched a query plus any - * documents that were edited after the query was last listened to. - * - * There are some cases when this optimization is not guaranteed to produce - * the same results as full collection scans. In these cases, query - * processing falls back to full scans. These cases are: - * - * - Limit queries where a document that matched the query previously no longer - * matches the query. - * - * - Limit queries where a document edit may cause the document to sort below - * another document that is in the local cache. - * - * - Queries that have never been CURRENT or free of limbo documents. - */ - - -class Ro { - constructor() { - this.xi = !1; - } - /** Sets the document view to query against. */ - - - initialize(t, e) { - this.Ni = t, this.indexManager = e, this.xi = !0; - } - /** Returns all local documents matching the specified query. */ - - - getDocumentsMatchingQuery(t, e, n, s) { - return this.ki(t, e).next(i => i || this.Mi(t, e, s, n)).next(n => n || this.Oi(t, e)); - } - /** - * Performs an indexed query that evaluates the query based on a collection's - * persisted index values. Returns `null` if an index is not available. - */ - - - ki(t, e) { - if (cn(e)) // Queries that match all documents don't benefit from using - // key-based lookups. It is more efficient to scan all documents in a - // collection, rather than to perform individual lookups. - return Vt.resolve(null); - let n = dn(e); - return this.indexManager.getIndexType(t, n).next(s => 0 - /* NONE */ - === s ? null : (null !== e.limit && 1 - /* PARTIAL */ - === s && ( // We cannot apply a limit for targets that are served using a partial - // index. If a partial index will be used to serve the target, the - // query may return a superset of documents that match the target - // (e.g. if the index doesn't include all the target's filters), or - // may return the correct set of documents in the wrong order (e.g. if - // the index doesn't include a segment for one of the orderBys). - // Therefore, a limit should not be applied in such cases. - e = _n(e, null, "F" - /* First */ - ), n = dn(e)), this.indexManager.getDocumentsMatchingTarget(t, n).next(s => { - const i = gs(...s); - return this.Ni.getDocuments(t, i).next(s => this.indexManager.getMinOffset(t, n).next(n => { - const r = this.Fi(e, s); - return this.$i(e, r, i, n.readTime) ? this.ki(t, _n(e, null, "F" - /* First */ - )) : this.Bi(t, r, e, n); - })); - }))); - } - /** - * Performs a query based on the target's persisted query mapping. Returns - * `null` if the mapping is not available or cannot be used. - */ - - - Mi(t, e, n, s) { - return cn(e) || s.isEqual(ct.min()) ? this.Oi(t, e) : this.Ni.getDocuments(t, n).next(i => { - const r = this.Fi(e, i); - return this.$i(e, r, n, s) ? this.Oi(t, e) : (k() <= _firebase_logger__WEBPACK_IMPORTED_MODULE_2__.LogLevel.DEBUG && O("QueryEngine", "Re-using previous result from %s to execute query: %s", s.toString(), gn(e)), this.Bi(t, r, e, Tt(s, -1))); - }); // Queries that have never seen a snapshot without limbo free documents - // should also be run as a full collection scan. - } - /** Applies the query filter and sorting to the provided documents. */ - - - Fi(t, e) { - // Sort the documents and re-apply the query filter since previously - // matching documents do not necessarily still match the query. - let n = new Wt(In(t)); - return e.forEach((e, s) => { - yn(t, s) && (n = n.add(s)); - }), n; - } - /** - * Determines if a limit query needs to be refilled from cache, making it - * ineligible for index-free execution. - * - * @param query - The query. - * @param sortedPreviousResults - The documents that matched the query when it - * was last synchronized, sorted by the query's comparator. - * @param remoteKeys - The document keys that matched the query at the last - * snapshot. - * @param limboFreeSnapshotVersion - The version of the snapshot when the - * query was last synchronized. - */ - - - $i(t, e, n, s) { - if (null === t.limit) // Queries without limits do not need to be refilled. - return !1; - if (n.size !== e.size) // The query needs to be refilled if a previously matching document no - // longer matches. - return !0; // Limit queries are not eligible for index-free query execution if there is - // a potential that an older document from cache now sorts before a document - // that was previously part of the limit. This, however, can only happen if - // the document at the edge of the limit goes out of limit. - // If a document that is not the limit boundary sorts differently, - // the boundary of the limit itself did not change and documents from cache - // will continue to be "rejected" by this boundary. Therefore, we can ignore - // any modifications that don't affect the last document. - - const i = "F" - /* First */ - === t.limitType ? e.last() : e.first(); - return !!i && (i.hasPendingWrites || i.version.compareTo(s) > 0); - } - - Oi(t, e) { - return k() <= _firebase_logger__WEBPACK_IMPORTED_MODULE_2__.LogLevel.DEBUG && O("QueryEngine", "Using full collection scan to execute query:", gn(e)), this.Ni.getDocumentsMatchingQuery(t, e, At.min()); - } - /** - * Combines the results from an indexed execution with the remaining documents - * that have not yet been indexed. - */ - - - Bi(t, e, n, s) { - // Retrieve all results for documents that were updated since the offset. - return this.Ni.getDocumentsMatchingQuery(t, n, s).next(t => ( // Merge with existing results - e.forEach(e => { - t = t.insert(e.key, e); - }), t)); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Implements `LocalStore` interface. - * - * Note: some field defined in this class might have public access level, but - * the class is not exported so they are only accessible from this module. - * This is useful to implement optional features (like bundles) in free - * functions, such that they are tree-shakeable. - */ - - -class bo { - constructor( - /** Manages our in-memory or durable persistence. */ - t, e, n, s) { - this.persistence = t, this.Li = e, this.It = s, - /** - * Maps a targetID to data about its target. - * - * PORTING NOTE: We are using an immutable data structure on Web to make re-runs - * of `applyRemoteEvent()` idempotent. - */ - this.Ui = new Gt(it), - /** Maps a target to its targetID. */ - // TODO(wuandy): Evaluate if TargetId can be part of Target. - this.qi = new os(t => Fe(t), Be), - /** - * A per collection group index of the last read time processed by - * `getNewDocumentChanges()`. - * - * PORTING NOTE: This is only used for multi-tab synchronization. - */ - this.Ki = new Map(), this.Gi = t.getRemoteDocumentCache(), this.Cs = t.getTargetCache(), this.Ns = t.getBundleCache(), this.Qi(n); - } - - Qi(t) { - // TODO(indexing): Add spec tests that test these components change after a - // user change - this.documentOverlayCache = this.persistence.getDocumentOverlayCache(t), this.indexManager = this.persistence.getIndexManager(t), this.mutationQueue = this.persistence.getMutationQueue(t, this.indexManager), this.localDocuments = new so(this.Gi, this.mutationQueue, this.documentOverlayCache, this.indexManager), this.Gi.setIndexManager(this.indexManager), this.Li.initialize(this.localDocuments, this.indexManager); - } - - collectGarbage(t) { - return this.persistence.runTransaction("Collect garbage", "readwrite-primary", e => t.collect(e, this.Ui)); - } - -} - -function Po( -/** Manages our in-memory or durable persistence. */ -t, e, n, s) { - return new bo(t, e, n, s); -} -/** - * Tells the LocalStore that the currently authenticated user has changed. - * - * In response the local store switches the mutation queue to the new user and - * returns any resulting document changes. - */ -// PORTING NOTE: Android and iOS only return the documents affected by the -// change. - - -async function vo(t, e) { - const n = K(t); - return await n.persistence.runTransaction("Handle user change", "readonly", t => { - // Swap out the mutation queue, grabbing the pending mutation batches - // before and after. - let s; - return n.mutationQueue.getAllMutationBatches(t).next(i => (s = i, n.Qi(e), n.mutationQueue.getAllMutationBatches(t))).next(e => { - const i = [], - r = []; // Union the old/new changed keys. - - let o = gs(); - - for (const t of s) { - i.push(t.batchId); - - for (const e of t.mutations) o = o.add(e.key); - } - - for (const t of e) { - r.push(t.batchId); - - for (const e of t.mutations) o = o.add(e.key); - } // Return the set of all (potentially) changed documents and the list - // of mutation batch IDs that were affected by change. - - - return n.localDocuments.getDocuments(t, o).next(t => ({ - ji: t, - removedBatchIds: i, - addedBatchIds: r - })); - }); - }); -} -/* Accepts locally generated Mutations and commit them to storage. */ - -/** - * Acknowledges the given batch. - * - * On the happy path when a batch is acknowledged, the local store will - * - * + remove the batch from the mutation queue; - * + apply the changes to the remote document cache; - * + recalculate the latency compensated view implied by those changes (there - * may be mutations in the queue that affect the documents but haven't been - * acknowledged yet); and - * + give the changed documents back the sync engine - * - * @returns The resulting (modified) documents. - */ - - -function Vo(t, e) { - const n = K(t); - return n.persistence.runTransaction("Acknowledge batch", "readwrite-primary", t => { - const s = e.batch.keys(), - i = n.Gi.newChangeBuffer({ - trackRemovals: !0 - }); - return function (t, e, n, s) { - const i = n.batch, - r = i.keys(); - let o = Vt.resolve(); - return r.forEach(t => { - o = o.next(() => s.getEntry(e, t)).next(e => { - const r = n.docVersions.get(t); - U(null !== r), e.version.compareTo(r) < 0 && (i.applyToRemoteDocument(e, n), e.isValidDocument() && ( // We use the commitVersion as the readTime rather than the - // document's updateTime since the updateTime is not advanced - // for updates that do not modify the underlying document. - e.setReadTime(n.commitVersion), s.addEntry(e))); - }); - }), o.next(() => t.mutationQueue.removeMutationBatch(e, i)); - } - /** Returns the local view of the documents affected by a mutation batch. */ - // PORTING NOTE: Multi-Tab only. - (n, t, e, i).next(() => i.apply(t)).next(() => n.mutationQueue.performConsistencyCheck(t)).next(() => n.documentOverlayCache.removeOverlaysForBatchId(t, s, e.batch.batchId)).next(() => n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t, function (t) { - let e = gs(); - - for (let n = 0; n < t.mutationResults.length; ++n) { - t.mutationResults[n].transformResults.length > 0 && (e = e.add(t.batch.mutations[n].key)); - } - - return e; - } - /** - * Removes mutations from the MutationQueue for the specified batch; - * LocalDocuments will be recalculated. - * - * @returns The resulting modified documents. - */ - (e))).next(() => n.localDocuments.getDocuments(t, s)); - }); -} -/** - * Returns the last consistent snapshot processed (used by the RemoteStore to - * determine whether to buffer incoming snapshots from the backend). - */ - - -function So(t) { - const e = K(t); - return e.persistence.runTransaction("Get last remote snapshot version", "readonly", t => e.Cs.getLastRemoteSnapshotVersion(t)); -} -/** - * Updates the "ground-state" (remote) documents. We assume that the remote - * event reflects any write batches that have been acknowledged or rejected - * (i.e. we do not re-apply local mutations to updates from this event). - * - * LocalDocuments are re-calculated if there are remaining mutations in the - * queue. - */ - - -function Do(t, e) { - const n = K(t), - s = e.snapshotVersion; - let i = n.Ui; - return n.persistence.runTransaction("Apply remote event", "readwrite-primary", t => { - const r = n.Gi.newChangeBuffer({ - trackRemovals: !0 - }); // Reset newTargetDataByTargetMap in case this transaction gets re-run. - - i = n.Ui; - const o = []; - e.targetChanges.forEach((r, u) => { - const c = i.get(u); - if (!c) return; // Only update the remote keys if the target is still active. This - // ensures that we can persist the updated target data along with - // the updated assignment. - - o.push(n.Cs.removeMatchingKeys(t, r.removedDocuments, u).next(() => n.Cs.addMatchingKeys(t, r.addedDocuments, u))); - let a = c.withSequenceNumber(t.currentSequenceNumber); - e.targetMismatches.has(u) ? a = a.withResumeToken(Xt.EMPTY_BYTE_STRING, ct.min()).withLastLimboFreeSnapshotVersion(ct.min()) : r.resumeToken.approximateByteSize() > 0 && (a = a.withResumeToken(r.resumeToken, s)), i = i.insert(u, a), // Update the target data if there are target changes (or if - // sufficient time has passed since the last update). - - /** - * Returns true if the newTargetData should be persisted during an update of - * an active target. TargetData should always be persisted when a target is - * being released and should not call this function. - * - * While the target is active, TargetData updates can be omitted when nothing - * about the target has changed except metadata like the resume token or - * snapshot version. Occasionally it's worth the extra write to prevent these - * values from getting too stale after a crash, but this doesn't have to be - * too frequent. - */ - function (t, e, n) { - // Always persist target data if we don't already have a resume token. - if (0 === t.resumeToken.approximateByteSize()) return !0; // Don't allow resume token changes to be buffered indefinitely. This - // allows us to be reasonably up-to-date after a crash and avoids needing - // to loop over all active queries on shutdown. Especially in the browser - // we may not get time to do anything interesting while the current tab is - // closing. - - if (e.snapshotVersion.toMicroseconds() - t.snapshotVersion.toMicroseconds() >= 3e8) return !0; // Otherwise if the only thing that has changed about a target is its resume - // token it's not worth persisting. Note that the RemoteStore keeps an - // in-memory view of the currently active targets which includes the current - // resume token, so stream failure or user changes will still use an - // up-to-date resume token regardless of what we do here. - - return n.addedDocuments.size + n.modifiedDocuments.size + n.removedDocuments.size > 0; - } - /** - * Notifies local store of the changed views to locally pin documents. - */ - (c, a, r) && o.push(n.Cs.updateTargetData(t, a)); - }); - let u = cs(), - c = gs(); // HACK: The only reason we allow a null snapshot version is so that we - // can synthesize remote events when we get permission denied errors while - // trying to resolve the state of a locally cached document that is in - // limbo. - - if (e.documentUpdates.forEach(s => { - e.resolvedLimboDocuments.has(s) && o.push(n.persistence.referenceDelegate.updateLimboDocument(t, s)); - }), // Each loop iteration only affects its "own" doc, so it's safe to get all - // the remote documents in advance in a single call. - o.push(Co(t, r, e.documentUpdates).next(t => { - u = t.Wi, c = t.zi; - })), !s.isEqual(ct.min())) { - const e = n.Cs.getLastRemoteSnapshotVersion(t).next(e => n.Cs.setTargetsMetadata(t, t.currentSequenceNumber, s)); - o.push(e); - } - - return Vt.waitFor(o).next(() => r.apply(t)).next(() => n.localDocuments.getLocalViewOfDocuments(t, u, c)).next(() => u); - }).then(t => (n.Ui = i, t)); -} -/** - * Populates document change buffer with documents from backend or a bundle. - * Returns the document changes resulting from applying those documents, and - * also a set of documents whose existence state are changed as a result. - * - * @param txn - Transaction to use to read existing documents from storage. - * @param documentBuffer - Document buffer to collect the resulted changes to be - * applied to storage. - * @param documents - Documents to be applied. - */ - - -function Co(t, e, n) { - let s = gs(), - i = gs(); - return n.forEach(t => s = s.add(t)), e.getEntries(t, s).next(t => { - let s = cs(); - return n.forEach((n, r) => { - const o = t.get(n); // Check if see if there is a existence state change for this document. - - r.isFoundDocument() !== o.isFoundDocument() && (i = i.add(n)), // Note: The order of the steps below is important, since we want - // to ensure that rejected limbo resolutions (which fabricate - // NoDocuments with SnapshotVersion.min()) never add documents to - // cache. - r.isNoDocument() && r.version.isEqual(ct.min()) ? ( // NoDocuments with SnapshotVersion.min() are used in manufactured - // events. We remove these documents from cache since we lost - // access. - e.removeEntry(n, r.readTime), s = s.insert(n, r)) : !o.isValidDocument() || r.version.compareTo(o.version) > 0 || 0 === r.version.compareTo(o.version) && o.hasPendingWrites ? (e.addEntry(r), s = s.insert(n, r)) : O("LocalStore", "Ignoring outdated watch update for ", n, ". Current version:", o.version, " Watch version:", r.version); - }), { - Wi: s, - zi: i - }; - }); -} -/** - * Gets the mutation batch after the passed in batchId in the mutation queue - * or null if empty. - * @param afterBatchId - If provided, the batch to search after. - * @returns The next mutation or null if there wasn't one. - */ - - -function xo(t, e) { - const n = K(t); - return n.persistence.runTransaction("Get next mutation batch", "readonly", t => (void 0 === e && (e = -1), n.mutationQueue.getNextMutationBatchAfterBatchId(t, e))); -} -/** - * Reads the current value of a Document with a given key or null if not - * found - used for testing. - */ - -/** - * Assigns the given target an internal ID so that its results can be pinned so - * they don't get GC'd. A target must be allocated in the local store before - * the store can be used to manage its view. - * - * Allocating an already allocated `Target` will return the existing `TargetData` - * for that `Target`. - */ - - -function No(t, e) { - const n = K(t); - return n.persistence.runTransaction("Allocate target", "readwrite", t => { - let s; - return n.Cs.getTargetData(t, e).next(i => i ? ( // This target has been listened to previously, so reuse the - // previous targetID. - // TODO(mcg): freshen last accessed date? - s = i, Vt.resolve(s)) : n.Cs.allocateTargetId(t).next(i => (s = new qi(e, i, 0 - /* Listen */ - , t.currentSequenceNumber), n.Cs.addTargetData(t, s).next(() => s)))); - }).then(t => { - // If Multi-Tab is enabled, the existing target data may be newer than - // the in-memory data - const s = n.Ui.get(t.targetId); - return (null === s || t.snapshotVersion.compareTo(s.snapshotVersion) > 0) && (n.Ui = n.Ui.insert(t.targetId, t), n.qi.set(e, t.targetId)), t; - }); -} -/** - * Returns the TargetData as seen by the LocalStore, including updates that may - * have not yet been persisted to the TargetCache. - */ -// Visible for testing. - -/** - * Unpins all the documents associated with the given target. If - * `keepPersistedTargetData` is set to false and Eager GC enabled, the method - * directly removes the associated target data from the target cache. - * - * Releasing a non-existing `Target` is a no-op. - */ -// PORTING NOTE: `keepPersistedTargetData` is multi-tab only. - - -async function ko(t, e, n) { - const s = K(t), - i = s.Ui.get(e), - r = n ? "readwrite" : "readwrite-primary"; - - try { - n || (await s.persistence.runTransaction("Release target", r, t => s.persistence.referenceDelegate.removeTarget(t, i))); - } catch (t) { - if (!Nt(t)) throw t; // All `releaseTarget` does is record the final metadata state for the - // target, but we've been recording this periodically during target - // activity. If we lose this write this could cause a very slight - // difference in the order of target deletion during GC, but we - // don't define exact LRU semantics so this is acceptable. - - O("LocalStore", `Failed to update sequence numbers for target ${e}: ${t}`); - } - - s.Ui = s.Ui.remove(e), s.qi.delete(i.target); -} -/** - * Runs the specified query against the local store and returns the results, - * potentially taking advantage of query data from previous executions (such - * as the set of remote keys). - * - * @param usePreviousResults - Whether results from previous executions can - * be used to optimize this query execution. - */ - - -function Mo(t, e, n) { - const s = K(t); - let i = ct.min(), - r = gs(); - return s.persistence.runTransaction("Execute query", "readonly", t => function (t, e, n) { - const s = K(t), - i = s.qi.get(n); - return void 0 !== i ? Vt.resolve(s.Ui.get(i)) : s.Cs.getTargetData(e, n); - }(s, t, dn(e)).next(e => { - if (e) return i = e.lastLimboFreeSnapshotVersion, s.Cs.getMatchingKeysForTargetId(t, e.targetId).next(t => { - r = t; - }); - }).next(() => s.Li.getDocumentsMatchingQuery(t, e, n ? i : ct.min(), n ? r : gs())).next(t => ($o(s, pn(e), t), { - documents: t, - Hi: r - }))); -} // PORTING NOTE: Multi-Tab only. - - -function Oo(t, e) { - const n = K(t), - s = K(n.Cs), - i = n.Ui.get(e); - return i ? Promise.resolve(i.target) : n.persistence.runTransaction("Get target data", "readonly", t => s.se(t, e).next(t => t ? t.target : null)); -} -/** - * Returns the set of documents that have been updated since the last call. - * If this is the first call, returns the set of changes since client - * initialization. Further invocations will return document that have changed - * since the prior call. - */ -// PORTING NOTE: Multi-Tab only. - - -function Fo(t, e) { - const n = K(t), - s = n.Ki.get(e) || ct.min(); // Get the current maximum read time for the collection. This should always - // exist, but to reduce the chance for regressions we default to - // SnapshotVersion.Min() - // TODO(indexing): Consider removing the default value. - - return n.persistence.runTransaction("Get new document changes", "readonly", t => n.Gi.getAllFromCollectionGroup(t, e, Tt(s, -1), - /* limit= */ - Number.MAX_SAFE_INTEGER)).then(t => ($o(n, e, t), t)); -} -/** Sets the collection group's maximum read time from the given documents. */ -// PORTING NOTE: Multi-Tab only. - - -function $o(t, e, n) { - let s = ct.min(); - n.forEach((t, e) => { - e.readTime.compareTo(s) > 0 && (s = e.readTime); - }), t.Ki.set(e, s); -} -/** - * Creates a new target using the given bundle name, which will be used to - * hold the keys of all documents from the bundle in query-document mappings. - * This ensures that the loaded documents do not get garbage collected - * right away. - */ - -/** - * Applies the documents from a bundle to the "ground-state" (remote) - * documents. - * - * LocalDocuments are re-calculated if there are remaining mutations in the - * queue. - */ - - -async function Bo(t, e, n, s) { - const i = K(t); - let r = gs(), - o = cs(); - - for (const t of n) { - const n = e.Ji(t.metadata.name); - t.document && (r = r.add(n)); - const s = e.Yi(t); - s.setReadTime(e.Xi(t.metadata.readTime)), o = o.insert(n, s); - } - - const u = i.Gi.newChangeBuffer({ - trackRemovals: !0 - }), - c = await No(i, function (t) { - // It is OK that the path used for the query is not valid, because this will - // not be read and queried. - return dn(un(ht.fromString(`__bundle__/docs/${t}`))); - }(s)); // Allocates a target to hold all document keys from the bundle, such that - // they will not get garbage collected right away. - - return i.persistence.runTransaction("Apply bundle documents", "readwrite", t => Co(t, u, o).next(e => (u.apply(t), e)).next(e => i.Cs.removeMatchingKeysForTargetId(t, c.targetId).next(() => i.Cs.addMatchingKeys(t, r, c.targetId)).next(() => i.localDocuments.getLocalViewOfDocuments(t, e.Wi, e.zi)).next(() => e.Wi))); -} -/** - * Returns a promise of a boolean to indicate if the given bundle has already - * been loaded and the create time is newer than the current loading bundle. - */ - -/** - * Saves the given `NamedQuery` to local persistence. - */ - - -async function Lo(t, e) { - let n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : gs(); - // Allocate a target for the named query such that it can be resumed - // from associated read time if users use it to listen. - // NOTE: this also means if no corresponding target exists, the new target - // will remain active and will not get collected, unless users happen to - // unlisten the query somehow. - const s = await No(t, dn(Xi(e.bundledQuery))), - i = K(t); - return i.persistence.runTransaction("Save named query", "readwrite", t => { - const r = Ms(e.readTime); // Simply save the query itself if it is older than what the SDK already - // has. - - if (s.snapshotVersion.compareTo(r) >= 0) return i.Ns.saveNamedQuery(t, e); // Update existing target data because the query from the bundle is newer. - - const o = s.withResumeToken(Xt.EMPTY_BYTE_STRING, r); - return i.Ui = i.Ui.insert(o.targetId, o), i.Cs.updateTargetData(t, o).next(() => i.Cs.removeMatchingKeysForTargetId(t, s.targetId)).next(() => i.Cs.addMatchingKeys(t, n, s.targetId)).next(() => i.Ns.saveNamedQuery(t, e)); - }); -} -/** Assembles the key for a client state in WebStorage */ - - -function Uo(t, e) { - return `firestore_clients_${t}_${e}`; -} // The format of the WebStorage key that stores the mutation state is: -// firestore_mutations__ -// (for unauthenticated users) -// or: firestore_mutations___ -// 'user_uid' is last to avoid needing to escape '_' characters that it might -// contain. - -/** Assembles the key for a mutation batch in WebStorage */ - - -function qo(t, e, n) { - let s = `firestore_mutations_${t}_${n}`; - return e.isAuthenticated() && (s += `_${e.uid}`), s; -} // The format of the WebStorage key that stores a query target's metadata is: -// firestore_targets__ - -/** Assembles the key for a query state in WebStorage */ - - -function Ko(t, e) { - return `firestore_targets_${t}_${e}`; -} // The WebStorage prefix that stores the primary tab's online state. The -// format of the key is: -// firestore_online_state_ - -/** - * Holds the state of a mutation batch, including its user ID, batch ID and - * whether the batch is 'pending', 'acknowledged' or 'rejected'. - */ -// Visible for testing - - -class Go { - constructor(t, e, n, s) { - this.user = t, this.batchId = e, this.state = n, this.error = s; - } - /** - * Parses a MutationMetadata from its JSON representation in WebStorage. - * Logs a warning and returns null if the format of the data is not valid. - */ - - - static Zi(t, e, n) { - const s = JSON.parse(n); - let i, - r = "object" == typeof s && -1 !== ["pending", "acknowledged", "rejected"].indexOf(s.state) && (void 0 === s.error || "object" == typeof s.error); - return r && s.error && (r = "string" == typeof s.error.message && "string" == typeof s.error.code, r && (i = new Q(s.error.code, s.error.message))), r ? new Go(t, e, s.state, i) : (F("SharedClientState", `Failed to parse mutation state for ID '${e}': ${n}`), null); - } - - tr() { - const t = { - state: this.state, - updateTimeMs: Date.now() - }; - return this.error && (t.error = { - code: this.error.code, - message: this.error.message - }), JSON.stringify(t); - } - -} -/** - * Holds the state of a query target, including its target ID and whether the - * target is 'not-current', 'current' or 'rejected'. - */ -// Visible for testing - - -class Qo { - constructor(t, e, n) { - this.targetId = t, this.state = e, this.error = n; - } - /** - * Parses a QueryTargetMetadata from its JSON representation in WebStorage. - * Logs a warning and returns null if the format of the data is not valid. - */ - - - static Zi(t, e) { - const n = JSON.parse(e); - let s, - i = "object" == typeof n && -1 !== ["not-current", "current", "rejected"].indexOf(n.state) && (void 0 === n.error || "object" == typeof n.error); - return i && n.error && (i = "string" == typeof n.error.message && "string" == typeof n.error.code, i && (s = new Q(n.error.code, n.error.message))), i ? new Qo(t, n.state, s) : (F("SharedClientState", `Failed to parse target state for ID '${t}': ${e}`), null); - } - - tr() { - const t = { - state: this.state, - updateTimeMs: Date.now() - }; - return this.error && (t.error = { - code: this.error.code, - message: this.error.message - }), JSON.stringify(t); - } - -} -/** - * This class represents the immutable ClientState for a client read from - * WebStorage, containing the list of active query targets. - */ - - -class jo { - constructor(t, e) { - this.clientId = t, this.activeTargetIds = e; - } - /** - * Parses a RemoteClientState from the JSON representation in WebStorage. - * Logs a warning and returns null if the format of the data is not valid. - */ - - - static Zi(t, e) { - const n = JSON.parse(e); - let s = "object" == typeof n && n.activeTargetIds instanceof Array, - i = ps(); - - for (let t = 0; s && t < n.activeTargetIds.length; ++t) s = he(n.activeTargetIds[t]), i = i.add(n.activeTargetIds[t]); - - return s ? new jo(t, i) : (F("SharedClientState", `Failed to parse client data for instance '${t}': ${e}`), null); - } - -} -/** - * This class represents the online state for all clients participating in - * multi-tab. The online state is only written to by the primary client, and - * used in secondary clients to update their query views. - */ - - -class Wo { - constructor(t, e) { - this.clientId = t, this.onlineState = e; - } - /** - * Parses a SharedOnlineState from its JSON representation in WebStorage. - * Logs a warning and returns null if the format of the data is not valid. - */ - - - static Zi(t) { - const e = JSON.parse(t); - return "object" == typeof e && -1 !== ["Unknown", "Online", "Offline"].indexOf(e.onlineState) && "string" == typeof e.clientId ? new Wo(e.clientId, e.onlineState) : (F("SharedClientState", `Failed to parse online state: ${t}`), null); - } - -} -/** - * Metadata state of the local client. Unlike `RemoteClientState`, this class is - * mutable and keeps track of all pending mutations, which allows us to - * update the range of pending mutation batch IDs as new mutations are added or - * removed. - * - * The data in `LocalClientState` is not read from WebStorage and instead - * updated via its instance methods. The updated state can be serialized via - * `toWebStorageJSON()`. - */ -// Visible for testing. - - -class zo { - constructor() { - this.activeTargetIds = ps(); - } - - er(t) { - this.activeTargetIds = this.activeTargetIds.add(t); - } - - nr(t) { - this.activeTargetIds = this.activeTargetIds.delete(t); - } - /** - * Converts this entry into a JSON-encoded format we can use for WebStorage. - * Does not encode `clientId` as it is part of the key in WebStorage. - */ - - - tr() { - const t = { - activeTargetIds: this.activeTargetIds.toArray(), - updateTimeMs: Date.now() - }; - return JSON.stringify(t); - } - -} -/** - * `WebStorageSharedClientState` uses WebStorage (window.localStorage) as the - * backing store for the SharedClientState. It keeps track of all active - * clients and supports modifications of the local client's data. - */ - - -class Ho { - constructor(t, e, n, s, i) { - this.window = t, this.Hs = e, this.persistenceKey = n, this.sr = s, this.syncEngine = null, this.onlineStateHandler = null, this.sequenceNumberHandler = null, this.ir = this.rr.bind(this), this.ur = new Gt(it), this.started = !1, - /** - * Captures WebStorage events that occur before `start()` is called. These - * events are replayed once `WebStorageSharedClientState` is started. - */ - this.cr = []; // Escape the special characters mentioned here: - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions - - const r = n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); - this.storage = this.window.localStorage, this.currentUser = i, this.ar = Uo(this.persistenceKey, this.sr), this.hr = - /** Assembles the key for the current sequence number. */ - function (t) { - return `firestore_sequence_number_${t}`; - } - /** - * @license - * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - (this.persistenceKey), this.ur = this.ur.insert(this.sr, new zo()), this.lr = new RegExp(`^firestore_clients_${r}_([^_]*)$`), this.dr = new RegExp(`^firestore_mutations_${r}_(\\d+)(?:_(.*))?$`), this._r = new RegExp(`^firestore_targets_${r}_(\\d+)$`), this.wr = - /** Assembles the key for the online state of the primary tab. */ - function (t) { - return `firestore_online_state_${t}`; - } // The WebStorage prefix that plays as a event to indicate the remote documents - // might have changed due to some secondary tabs loading a bundle. - // format of the key is: - // firestore_bundle_loaded_v2_ - // The version ending with "v2" stores the list of modified collection groups. - (this.persistenceKey), this.mr = function (t) { - return `firestore_bundle_loaded_v2_${t}`; - } // The WebStorage key prefix for the key that stores the last sequence number allocated. The key - // looks like 'firestore_sequence_number_'. - (this.persistenceKey), // Rather than adding the storage observer during start(), we add the - // storage observer during initialization. This ensures that we collect - // events before other components populate their initial state (during their - // respective start() calls). Otherwise, we might for example miss a - // mutation that is added after LocalStore's start() processed the existing - // mutations but before we observe WebStorage events. - this.window.addEventListener("storage", this.ir); - } - /** Returns 'true' if WebStorage is available in the current environment. */ - - - static C(t) { - return !(!t || !t.localStorage); - } - - async start() { - // Retrieve the list of existing clients to backfill the data in - // SharedClientState. - const t = await this.syncEngine.vi(); - - for (const e of t) { - if (e === this.sr) continue; - const t = this.getItem(Uo(this.persistenceKey, e)); - - if (t) { - const n = jo.Zi(e, t); - n && (this.ur = this.ur.insert(n.clientId, n)); - } - } - - this.gr(); // Check if there is an existing online state and call the callback handler - // if applicable. - - const e = this.storage.getItem(this.wr); - - if (e) { - const t = this.yr(e); - t && this.pr(t); - } - - for (const t of this.cr) this.rr(t); - - this.cr = [], // Register a window unload hook to remove the client metadata entry from - // WebStorage even if `shutdown()` was not called. - this.window.addEventListener("pagehide", () => this.shutdown()), this.started = !0; - } - - writeSequenceNumber(t) { - this.setItem(this.hr, JSON.stringify(t)); - } - - getAllActiveQueryTargets() { - return this.Ir(this.ur); - } - - isActiveQueryTarget(t) { - let e = !1; - return this.ur.forEach((n, s) => { - s.activeTargetIds.has(t) && (e = !0); - }), e; - } - - addPendingMutation(t) { - this.Tr(t, "pending"); - } - - updateMutationState(t, e, n) { - this.Tr(t, e, n), // Once a final mutation result is observed by other clients, they no longer - // access the mutation's metadata entry. Since WebStorage replays events - // in order, it is safe to delete the entry right after updating it. - this.Er(t); - } - - addLocalQueryTarget(t) { - let e = "not-current"; // Lookup an existing query state if the target ID was already registered - // by another tab - - if (this.isActiveQueryTarget(t)) { - const n = this.storage.getItem(Ko(this.persistenceKey, t)); - - if (n) { - const s = Qo.Zi(t, n); - s && (e = s.state); - } - } - - return this.Ar.er(t), this.gr(), e; - } - - removeLocalQueryTarget(t) { - this.Ar.nr(t), this.gr(); - } - - isLocalQueryTarget(t) { - return this.Ar.activeTargetIds.has(t); - } - - clearQueryState(t) { - this.removeItem(Ko(this.persistenceKey, t)); - } - - updateQueryState(t, e, n) { - this.Rr(t, e, n); - } - - handleUserChange(t, e, n) { - e.forEach(t => { - this.Er(t); - }), this.currentUser = t, n.forEach(t => { - this.addPendingMutation(t); - }); - } - - setOnlineState(t) { - this.br(t); - } - - notifyBundleLoaded(t) { - this.Pr(t); - } - - shutdown() { - this.started && (this.window.removeEventListener("storage", this.ir), this.removeItem(this.ar), this.started = !1); - } - - getItem(t) { - const e = this.storage.getItem(t); - return O("SharedClientState", "READ", t, e), e; - } - - setItem(t, e) { - O("SharedClientState", "SET", t, e), this.storage.setItem(t, e); - } - - removeItem(t) { - O("SharedClientState", "REMOVE", t), this.storage.removeItem(t); - } - - rr(t) { - // Note: The function is typed to take Event to be interface-compatible with - // `Window.addEventListener`. - const e = t; - - if (e.storageArea === this.storage) { - if (O("SharedClientState", "EVENT", e.key, e.newValue), e.key === this.ar) return void F("Received WebStorage notification for local change. Another client might have garbage-collected our state"); - this.Hs.enqueueRetryable(async () => { - if (this.started) { - if (null !== e.key) if (this.lr.test(e.key)) { - if (null == e.newValue) { - const t = this.vr(e.key); - return this.Vr(t, null); - } - - { - const t = this.Sr(e.key, e.newValue); - if (t) return this.Vr(t.clientId, t); - } - } else if (this.dr.test(e.key)) { - if (null !== e.newValue) { - const t = this.Dr(e.key, e.newValue); - if (t) return this.Cr(t); - } - } else if (this._r.test(e.key)) { - if (null !== e.newValue) { - const t = this.Nr(e.key, e.newValue); - if (t) return this.kr(t); - } - } else if (e.key === this.wr) { - if (null !== e.newValue) { - const t = this.yr(e.newValue); - if (t) return this.pr(t); - } - } else if (e.key === this.hr) { - const t = function (t) { - let e = Lt.at; - if (null != t) try { - const n = JSON.parse(t); - U("number" == typeof n), e = n; - } catch (t) { - F("SharedClientState", "Failed to read sequence number from WebStorage", t); - } - return e; - } - /** - * `MemorySharedClientState` is a simple implementation of SharedClientState for - * clients using memory persistence. The state in this class remains fully - * isolated and no synchronization is performed. - */ - (e.newValue); - - t !== Lt.at && this.sequenceNumberHandler(t); - } else if (e.key === this.mr) { - const t = this.Mr(e.newValue); - await Promise.all(t.map(t => this.syncEngine.Or(t))); - } - } else this.cr.push(e); - }); - } - } - - get Ar() { - return this.ur.get(this.sr); - } - - gr() { - this.setItem(this.ar, this.Ar.tr()); - } - - Tr(t, e, n) { - const s = new Go(this.currentUser, t, e, n), - i = qo(this.persistenceKey, this.currentUser, t); - this.setItem(i, s.tr()); - } - - Er(t) { - const e = qo(this.persistenceKey, this.currentUser, t); - this.removeItem(e); - } - - br(t) { - const e = { - clientId: this.sr, - onlineState: t - }; - this.storage.setItem(this.wr, JSON.stringify(e)); - } - - Rr(t, e, n) { - const s = Ko(this.persistenceKey, t), - i = new Qo(t, e, n); - this.setItem(s, i.tr()); - } - - Pr(t) { - const e = JSON.stringify(Array.from(t)); - this.setItem(this.mr, e); - } - /** - * Parses a client state key in WebStorage. Returns null if the key does not - * match the expected key format. - */ - - - vr(t) { - const e = this.lr.exec(t); - return e ? e[1] : null; - } - /** - * Parses a client state in WebStorage. Returns 'null' if the value could not - * be parsed. - */ - - - Sr(t, e) { - const n = this.vr(t); - return jo.Zi(n, e); - } - /** - * Parses a mutation batch state in WebStorage. Returns 'null' if the value - * could not be parsed. - */ - - - Dr(t, e) { - const n = this.dr.exec(t), - s = Number(n[1]), - i = void 0 !== n[2] ? n[2] : null; - return Go.Zi(new C(i), s, e); - } - /** - * Parses a query target state from WebStorage. Returns 'null' if the value - * could not be parsed. - */ - - - Nr(t, e) { - const n = this._r.exec(t), - s = Number(n[1]); - - return Qo.Zi(s, e); - } - /** - * Parses an online state from WebStorage. Returns 'null' if the value - * could not be parsed. - */ - - - yr(t) { - return Wo.Zi(t); - } - - Mr(t) { - return JSON.parse(t); - } - - async Cr(t) { - if (t.user.uid === this.currentUser.uid) return this.syncEngine.Fr(t.batchId, t.state, t.error); - O("SharedClientState", `Ignoring mutation for non-active user ${t.user.uid}`); - } - - kr(t) { - return this.syncEngine.$r(t.targetId, t.state, t.error); - } - - Vr(t, e) { - const n = e ? this.ur.insert(t, e) : this.ur.remove(t), - s = this.Ir(this.ur), - i = this.Ir(n), - r = [], - o = []; - return i.forEach(t => { - s.has(t) || r.push(t); - }), s.forEach(t => { - i.has(t) || o.push(t); - }), this.syncEngine.Br(r, o).then(() => { - this.ur = n; - }); - } - - pr(t) { - // We check whether the client that wrote this online state is still active - // by comparing its client ID to the list of clients kept active in - // IndexedDb. If a client does not update their IndexedDb client state - // within 5 seconds, it is considered inactive and we don't emit an online - // state event. - this.ur.get(t.clientId) && this.onlineStateHandler(t.onlineState); - } - - Ir(t) { - let e = ps(); - return t.forEach((t, n) => { - e = e.unionWith(n.activeTargetIds); - }), e; - } - -} - -class Jo { - constructor() { - this.Lr = new zo(), this.Ur = {}, this.onlineStateHandler = null, this.sequenceNumberHandler = null; - } - - addPendingMutation(t) {// No op. - } - - updateMutationState(t, e, n) {// No op. - } - - addLocalQueryTarget(t) { - return this.Lr.er(t), this.Ur[t] || "not-current"; - } - - updateQueryState(t, e, n) { - this.Ur[t] = e; - } - - removeLocalQueryTarget(t) { - this.Lr.nr(t); - } - - isLocalQueryTarget(t) { - return this.Lr.activeTargetIds.has(t); - } - - clearQueryState(t) { - delete this.Ur[t]; - } - - getAllActiveQueryTargets() { - return this.Lr.activeTargetIds; - } - - isActiveQueryTarget(t) { - return this.Lr.activeTargetIds.has(t); - } - - start() { - return this.Lr = new zo(), Promise.resolve(); - } - - handleUserChange(t, e, n) {// No op. - } - - setOnlineState(t) {// No op. - } - - shutdown() {} - - writeSequenceNumber(t) {} - - notifyBundleLoaded(t) {// No op. - } - -} -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class Yo { - qr(t) {// No-op. - } - - shutdown() {// No-op. - } - -} -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// References to `window` are guarded by BrowserConnectivityMonitor.isAvailable() - -/* eslint-disable no-restricted-globals */ - -/** - * Browser implementation of ConnectivityMonitor. - */ - - -class Xo { - constructor() { - this.Kr = () => this.Gr(), this.Qr = () => this.jr(), this.Wr = [], this.zr(); - } - - qr(t) { - this.Wr.push(t); - } - - shutdown() { - window.removeEventListener("online", this.Kr), window.removeEventListener("offline", this.Qr); - } - - zr() { - window.addEventListener("online", this.Kr), window.addEventListener("offline", this.Qr); - } - - Gr() { - O("ConnectivityMonitor", "Network connectivity changed: AVAILABLE"); - - for (const t of this.Wr) t(0 - /* AVAILABLE */ - ); - } - - jr() { - O("ConnectivityMonitor", "Network connectivity changed: UNAVAILABLE"); - - for (const t of this.Wr) t(1 - /* UNAVAILABLE */ - ); - } // TODO(chenbrian): Consider passing in window either into this component or - // here for testing via FakeWindow. - - /** Checks that all used attributes of window are available. */ - - - static C() { - return "undefined" != typeof window && void 0 !== window.addEventListener && void 0 !== window.removeEventListener; - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const Zo = { - BatchGetDocuments: "batchGet", - Commit: "commit", - RunQuery: "runQuery" -}; -/** - * Maps RPC names to the corresponding REST endpoint name. - * - * We use array notation to avoid mangling. - */ - -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Provides a simple helper class that implements the Stream interface to - * bridge to other implementations that are streams but do not implement the - * interface. The stream callbacks are invoked with the callOn... methods. - */ - -class tu { - constructor(t) { - this.Hr = t.Hr, this.Jr = t.Jr; - } - - Yr(t) { - this.Xr = t; - } - - Zr(t) { - this.eo = t; - } - - onMessage(t) { - this.no = t; - } - - close() { - this.Jr(); - } - - send(t) { - this.Hr(t); - } - - so() { - this.Xr(); - } - - io(t) { - this.eo(t); - } - - ro(t) { - this.no(t); - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class eu extends -/** - * Base class for all Rest-based connections to the backend (WebChannel and - * HTTP). - */ -class { - constructor(t) { - this.databaseInfo = t, this.databaseId = t.databaseId; - const e = t.ssl ? "https" : "http"; - this.oo = e + "://" + t.host, this.uo = "projects/" + this.databaseId.projectId + "/databases/" + this.databaseId.database + "/documents"; - } - - co(t, e, n, s, i) { - const r = this.ao(t, e); - O("RestConnection", "Sending: ", r, n); - const o = {}; - return this.ho(o, s, i), this.lo(t, r, o, n).then(t => (O("RestConnection", "Received: ", t), t), e => { - throw $("RestConnection", `${t} failed with error: `, e, "url: ", r, "request:", n), e; - }); - } - - fo(t, e, n, s, i, r) { - // The REST API automatically aggregates all of the streamed results, so we - // can just use the normal invoke() method. - return this.co(t, e, n, s, i); - } - /** - * Modifies the headers for a request, adding any authorization token if - * present and any additional headers for the request. - */ - - - ho(t, e, n) { - t["X-Goog-Api-Client"] = "gl-js/ fire/" + x, // Content-Type: text/plain will avoid preflight requests which might - // mess with CORS and redirects by proxies. If we add custom headers - // we will need to change this code to potentially use the $httpOverwrite - // parameter supported by ESF to avoid triggering preflight requests. - t["Content-Type"] = "text/plain", this.databaseInfo.appId && (t["X-Firebase-GMPID"] = this.databaseInfo.appId), e && e.headers.forEach((e, n) => t[n] = e), n && n.headers.forEach((e, n) => t[n] = e); - } - - ao(t, e) { - const n = Zo[t]; - return `${this.oo}/v1/${e}:${n}`; - } - -} { - constructor(t) { - super(t), this.forceLongPolling = t.forceLongPolling, this.autoDetectLongPolling = t.autoDetectLongPolling, this.useFetchStreams = t.useFetchStreams; - } - - lo(t, e, n, s) { - return new Promise((i, r) => { - const o = new _firebase_webchannel_wrapper__WEBPACK_IMPORTED_MODULE_4__.XhrIo(); - o.listenOnce(_firebase_webchannel_wrapper__WEBPACK_IMPORTED_MODULE_4__.EventType.COMPLETE, () => { - try { - switch (o.getLastErrorCode()) { - case _firebase_webchannel_wrapper__WEBPACK_IMPORTED_MODULE_4__.ErrorCode.NO_ERROR: - const e = o.getResponseJson(); - O("Connection", "XHR received:", JSON.stringify(e)), i(e); - break; - - case _firebase_webchannel_wrapper__WEBPACK_IMPORTED_MODULE_4__.ErrorCode.TIMEOUT: - O("Connection", 'RPC "' + t + '" timed out'), r(new Q(G.DEADLINE_EXCEEDED, "Request time out")); - break; - - case _firebase_webchannel_wrapper__WEBPACK_IMPORTED_MODULE_4__.ErrorCode.HTTP_ERROR: - const n = o.getStatus(); - - if (O("Connection", 'RPC "' + t + '" failed with status:', n, "response text:", o.getResponseText()), n > 0) { - const t = o.getResponseJson().error; - - if (t && t.status && t.message) { - const e = function (t) { - const e = t.toLowerCase().replace(/_/g, "-"); - return Object.values(G).indexOf(e) >= 0 ? e : G.UNKNOWN; - }(t.status); - - r(new Q(e, t.message)); - } else r(new Q(G.UNKNOWN, "Server responded with status " + o.getStatus())); - } else // If we received an HTTP_ERROR but there's no status code, - // it's most probably a connection issue - r(new Q(G.UNAVAILABLE, "Connection failed.")); - - break; - - default: - L(); - } - } finally { - O("Connection", 'RPC "' + t + '" completed.'); - } - }); - const u = JSON.stringify(s); - o.send(e, "POST", u, n, 15); - }); - } - - _o(t, e, n) { - const s = [this.oo, "/", "google.firestore.v1.Firestore", "/", t, "/channel"], - i = (0,_firebase_webchannel_wrapper__WEBPACK_IMPORTED_MODULE_4__.createWebChannelTransport)(), - r = (0,_firebase_webchannel_wrapper__WEBPACK_IMPORTED_MODULE_4__.getStatEventTarget)(), - o = { - // Required for backend stickiness, routing behavior is based on this - // parameter. - httpSessionIdParam: "gsessionid", - initMessageHeaders: {}, - messageUrlParams: { - // This param is used to improve routing and project isolation by the - // backend and must be included in every request. - database: `projects/${this.databaseId.projectId}/databases/${this.databaseId.database}` - }, - sendRawJson: !0, - supportsCrossDomainXhr: !0, - internalChannelParams: { - // Override the default timeout (randomized between 10-20 seconds) since - // a large write batch on a slow internet connection may take a long - // time to send to the backend. Rather than have WebChannel impose a - // tight timeout which could lead to infinite timeouts and retries, we - // set it very large (5-10 minutes) and rely on the browser's builtin - // timeouts to kick in if the request isn't working. - forwardChannelRequestTimeoutMs: 6e5 - }, - forceLongPolling: this.forceLongPolling, - detectBufferingProxy: this.autoDetectLongPolling - }; - this.useFetchStreams && (o.xmlHttpFactory = new _firebase_webchannel_wrapper__WEBPACK_IMPORTED_MODULE_4__.FetchXmlHttpFactory({})), this.ho(o.initMessageHeaders, e, n), // Sending the custom headers we just added to request.initMessageHeaders - // (Authorization, etc.) will trigger the browser to make a CORS preflight - // request because the XHR will no longer meet the criteria for a "simple" - // CORS request: - // https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Simple_requests - // Therefore to avoid the CORS preflight request (an extra network - // roundtrip), we use the httpHeadersOverwriteParam option to specify that - // the headers should instead be encoded into a special "$httpHeaders" query - // parameter, which is recognized by the webchannel backend. This is - // formally defined here: - // https://github.com/google/closure-library/blob/b0e1815b13fb92a46d7c9b3c30de5d6a396a3245/closure/goog/net/rpc/httpcors.js#L32 - // TODO(b/145624756): There is a backend bug where $httpHeaders isn't respected if the request - // doesn't have an Origin header. So we have to exclude a few browser environments that are - // known to (sometimes) not include an Origin. See - // https://github.com/firebase/firebase-js-sdk/issues/1491. - (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.isMobileCordova)() || (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.isReactNative)() || (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.isElectron)() || (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.isIE)() || (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.isUWP)() || (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.isBrowserExtension)() || (o.httpHeadersOverwriteParam = "$httpHeaders"); - const u = s.join(""); - O("Connection", "Creating WebChannel: " + u, o); - const c = i.createWebChannel(u, o); // WebChannel supports sending the first message with the handshake - saving - // a network round trip. However, it will have to call send in the same - // JS event loop as open. In order to enforce this, we delay actually - // opening the WebChannel until send is called. Whether we have called - // open is tracked with this variable. - - let a = !1, - h = !1; // A flag to determine whether the stream was closed (by us or through an - // error/close event) to avoid delivering multiple close events or sending - // on a closed stream - - const l = new tu({ - Hr: t => { - h ? O("Connection", "Not sending because WebChannel is closed:", t) : (a || (O("Connection", "Opening WebChannel transport."), c.open(), a = !0), O("Connection", "WebChannel sending:", t), c.send(t)); - }, - Jr: () => c.close() - }), - y = (t, e, n) => { - // TODO(dimond): closure typing seems broken because WebChannel does - // not implement goog.events.Listenable - t.listen(e, t => { - try { - n(t); - } catch (t) { - setTimeout(() => { - throw t; - }, 0); - } - }); - }; // Closure events are guarded and exceptions are swallowed, so catch any - // exception and rethrow using a setTimeout so they become visible again. - // Note that eventually this function could go away if we are confident - // enough the code is exception free. - - - return y(c, _firebase_webchannel_wrapper__WEBPACK_IMPORTED_MODULE_4__.WebChannel.EventType.OPEN, () => { - h || O("Connection", "WebChannel transport opened."); - }), y(c, _firebase_webchannel_wrapper__WEBPACK_IMPORTED_MODULE_4__.WebChannel.EventType.CLOSE, () => { - h || (h = !0, O("Connection", "WebChannel transport closed"), l.io()); - }), y(c, _firebase_webchannel_wrapper__WEBPACK_IMPORTED_MODULE_4__.WebChannel.EventType.ERROR, t => { - h || (h = !0, $("Connection", "WebChannel transport errored:", t), l.io(new Q(G.UNAVAILABLE, "The operation could not be completed"))); - }), y(c, _firebase_webchannel_wrapper__WEBPACK_IMPORTED_MODULE_4__.WebChannel.EventType.MESSAGE, t => { - var e; - - if (!h) { - const n = t.data[0]; - U(!!n); // TODO(b/35143891): There is a bug in One Platform that caused errors - // (and only errors) to be wrapped in an extra array. To be forward - // compatible with the bug we need to check either condition. The latter - // can be removed once the fix has been rolled out. - // Use any because msgData.error is not typed. - - const s = n, - i = s.error || (null === (e = s[0]) || void 0 === e ? void 0 : e.error); - - if (i) { - O("Connection", "WebChannel received error:", i); // error.status will be a string like 'OK' or 'NOT_FOUND'. - - const t = i.status; - - let e = - /** - * Maps an error Code from a GRPC status identifier like 'NOT_FOUND'. - * - * @returns The Code equivalent to the given status string or undefined if - * there is no match. - */ - function (t) { - // lookup by string - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const e = ns[t]; - if (void 0 !== e) return rs(e); - }(t), - n = i.message; - - void 0 === e && (e = G.INTERNAL, n = "Unknown error status: " + t + " with message " + i.message), // Mark closed so no further events are propagated - h = !0, l.io(new Q(e, n)), c.close(); - } else O("Connection", "WebChannel received:", n), l.ro(n); - } - }), y(r, _firebase_webchannel_wrapper__WEBPACK_IMPORTED_MODULE_4__.Event.STAT_EVENT, t => { - t.stat === _firebase_webchannel_wrapper__WEBPACK_IMPORTED_MODULE_4__.Stat.PROXY ? O("Connection", "Detected buffering proxy") : t.stat === _firebase_webchannel_wrapper__WEBPACK_IMPORTED_MODULE_4__.Stat.NOPROXY && O("Connection", "Detected no buffering proxy"); - }), setTimeout(() => { - // Technically we could/should wait for the WebChannel opened event, - // but because we want to send the first message with the WebChannel - // handshake we pretend the channel opened here (asynchronously), and - // then delay the actual open until the first message is sent. - l.so(); - }, 0), l; - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** Initializes the WebChannelConnection for the browser. */ - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** The Platform's 'window' implementation or null if not available. */ - - -function nu() { - // `window` is not always available, e.g. in ReactNative and WebWorkers. - // eslint-disable-next-line no-restricted-globals - return "undefined" != typeof window ? window : null; -} -/** The Platform's 'document' implementation or null if not available. */ - - -function su() { - // `document` is not always available, e.g. in ReactNative and WebWorkers. - // eslint-disable-next-line no-restricted-globals - return "undefined" != typeof document ? document : null; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -function iu(t) { - return new Cs(t, - /* useProto3Json= */ - !0); -} -/** - * An instance of the Platform's 'TextEncoder' implementation. - */ - -/** - * A helper for running delayed tasks following an exponential backoff curve - * between attempts. - * - * Each delay is made up of a "base" delay which follows the exponential - * backoff curve, and a +/- 50% "jitter" that is calculated and added to the - * base delay. This prevents clients from accidentally synchronizing their - * delays causing spikes of load to the backend. - */ - - -class ru { - constructor( - /** - * The AsyncQueue to run backoff operations on. - */ - t, - /** - * The ID to use when scheduling backoff operations on the AsyncQueue. - */ - e) { - let n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1e3; - let s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1.5; - let i = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 6e4; - this.Hs = t, this.timerId = e, this.wo = n, this.mo = s, this.yo = i, this.po = 0, this.Io = null, - /** The last backoff attempt, as epoch milliseconds. */ - this.To = Date.now(), this.reset(); - } - /** - * Resets the backoff delay. - * - * The very next backoffAndWait() will have no delay. If it is called again - * (i.e. due to an error), initialDelayMs (plus jitter) will be used, and - * subsequent ones will increase according to the backoffFactor. - */ - - - reset() { - this.po = 0; - } - /** - * Resets the backoff delay to the maximum delay (e.g. for use after a - * RESOURCE_EXHAUSTED error). - */ - - - Eo() { - this.po = this.yo; - } - /** - * Returns a promise that resolves after currentDelayMs, and increases the - * delay for any subsequent attempts. If there was a pending backoff operation - * already, it will be canceled. - */ - - - Ao(t) { - // Cancel any pending backoff operation. - this.cancel(); // First schedule using the current base (which may be 0 and should be - // honored as such). - - const e = Math.floor(this.po + this.Ro()), - n = Math.max(0, Date.now() - this.To), - s = Math.max(0, e - n); // Guard against lastAttemptTime being in the future due to a clock change. - - s > 0 && O("ExponentialBackoff", `Backing off for ${s} ms (base delay: ${this.po} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`), this.Io = this.Hs.enqueueAfterDelay(this.timerId, s, () => (this.To = Date.now(), t())), // Apply backoff factor to determine next delay and ensure it is within - // bounds. - this.po *= this.mo, this.po < this.wo && (this.po = this.wo), this.po > this.yo && (this.po = this.yo); - } - - bo() { - null !== this.Io && (this.Io.skipDelay(), this.Io = null); - } - - cancel() { - null !== this.Io && (this.Io.cancel(), this.Io = null); - } - /** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ - - - Ro() { - return (Math.random() - .5) * this.po; - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A PersistentStream is an abstract base class that represents a streaming RPC - * to the Firestore backend. It's built on top of the connections own support - * for streaming RPCs, and adds several critical features for our clients: - * - * - Exponential backoff on failure - * - Authentication via CredentialsProvider - * - Dispatching all callbacks into the shared worker queue - * - Closing idle streams after 60 seconds of inactivity - * - * Subclasses of PersistentStream implement serialization of models to and - * from the JSON representation of the protocol buffers for a specific - * streaming RPC. - * - * ## Starting and Stopping - * - * Streaming RPCs are stateful and need to be start()ed before messages can - * be sent and received. The PersistentStream will call the onOpen() function - * of the listener once the stream is ready to accept requests. - * - * Should a start() fail, PersistentStream will call the registered onClose() - * listener with a FirestoreError indicating what went wrong. - * - * A PersistentStream can be started and stopped repeatedly. - * - * Generic types: - * SendType: The type of the outgoing message of the underlying - * connection stream - * ReceiveType: The type of the incoming message of the underlying - * connection stream - * ListenerType: The type of the listener that will be used for callbacks - */ - - -class ou { - constructor(t, e, n, s, i, r, o, u) { - this.Hs = t, this.Po = n, this.vo = s, this.Vo = i, this.authCredentialsProvider = r, this.appCheckCredentialsProvider = o, this.listener = u, this.state = 0 - /* Initial */ - , - /** - * A close count that's incremented every time the stream is closed; used by - * getCloseGuardedDispatcher() to invalidate callbacks that happen after - * close. - */ - this.So = 0, this.Do = null, this.Co = null, this.stream = null, this.xo = new ru(t, e); - } - /** - * Returns true if start() has been called and no error has occurred. True - * indicates the stream is open or in the process of opening (which - * encompasses respecting backoff, getting auth tokens, and starting the - * actual RPC). Use isOpen() to determine if the stream is open and ready for - * outbound requests. - */ - - - No() { - return 1 - /* Starting */ - === this.state || 5 - /* Backoff */ - === this.state || this.ko(); - } - /** - * Returns true if the underlying RPC is open (the onOpen() listener has been - * called) and the stream is ready for outbound requests. - */ - - - ko() { - return 2 - /* Open */ - === this.state || 3 - /* Healthy */ - === this.state; - } - /** - * Starts the RPC. Only allowed if isStarted() returns false. The stream is - * not immediately ready for use: onOpen() will be invoked when the RPC is - * ready for outbound requests, at which point isOpen() will return true. - * - * When start returns, isStarted() will return true. - */ - - - start() { - 4 - /* Error */ - !== this.state ? this.auth() : this.Mo(); - } - /** - * Stops the RPC. This call is idempotent and allowed regardless of the - * current isStarted() state. - * - * When stop returns, isStarted() and isOpen() will both return false. - */ - - - async stop() { - this.No() && (await this.close(0 - /* Initial */ - )); - } - /** - * After an error the stream will usually back off on the next attempt to - * start it. If the error warrants an immediate restart of the stream, the - * sender can use this to indicate that the receiver should not back off. - * - * Each error will call the onClose() listener. That function can decide to - * inhibit backoff if required. - */ - - - Oo() { - this.state = 0 - /* Initial */ - , this.xo.reset(); - } - /** - * Marks this stream as idle. If no further actions are performed on the - * stream for one minute, the stream will automatically close itself and - * notify the stream's onClose() handler with Status.OK. The stream will then - * be in a !isStarted() state, requiring the caller to start the stream again - * before further use. - * - * Only streams that are in state 'Open' can be marked idle, as all other - * states imply pending network operations. - */ - - - Fo() { - // Starts the idle time if we are in state 'Open' and are not yet already - // running a timer (in which case the previous idle timeout still applies). - this.ko() && null === this.Do && (this.Do = this.Hs.enqueueAfterDelay(this.Po, 6e4, () => this.$o())); - } - /** Sends a message to the underlying stream. */ - - - Bo(t) { - this.Lo(), this.stream.send(t); - } - /** Called by the idle timer when the stream should close due to inactivity. */ - - - async $o() { - if (this.ko()) // When timing out an idle stream there's no reason to force the stream into backoff when - // it restarts so set the stream state to Initial instead of Error. - return this.close(0 - /* Initial */ - ); - } - /** Marks the stream as active again. */ - - - Lo() { - this.Do && (this.Do.cancel(), this.Do = null); - } - /** Cancels the health check delayed operation. */ - - - Uo() { - this.Co && (this.Co.cancel(), this.Co = null); - } - /** - * Closes the stream and cleans up as necessary: - * - * * closes the underlying GRPC stream; - * * calls the onClose handler with the given 'error'; - * * sets internal stream state to 'finalState'; - * * adjusts the backoff timer based on the error - * - * A new stream can be opened by calling start(). - * - * @param finalState - the intended state of the stream after closing. - * @param error - the error the connection was closed with. - */ - - - async close(t, e) { - // Cancel any outstanding timers (they're guaranteed not to execute). - this.Lo(), this.Uo(), this.xo.cancel(), // Invalidates any stream-related callbacks (e.g. from auth or the - // underlying stream), guaranteeing they won't execute. - this.So++, 4 - /* Error */ - !== t ? // If this is an intentional close ensure we don't delay our next connection attempt. - this.xo.reset() : e && e.code === G.RESOURCE_EXHAUSTED ? ( // Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.) - F(e.toString()), F("Using maximum backoff delay to prevent overloading the backend."), this.xo.Eo()) : e && e.code === G.UNAUTHENTICATED && 3 - /* Healthy */ - !== this.state && ( // "unauthenticated" error means the token was rejected. This should rarely - // happen since both Auth and AppCheck ensure a sufficient TTL when we - // request a token. If a user manually resets their system clock this can - // fail, however. In this case, we should get a Code.UNAUTHENTICATED error - // before we received the first message and we need to invalidate the token - // to ensure that we fetch a new token. - this.authCredentialsProvider.invalidateToken(), this.appCheckCredentialsProvider.invalidateToken()), // Clean up the underlying stream because we are no longer interested in events. - null !== this.stream && (this.qo(), this.stream.close(), this.stream = null), // This state must be assigned before calling onClose() to allow the callback to - // inhibit backoff or otherwise manipulate the state in its non-started state. - this.state = t, // Notify the listener that the stream closed. - await this.listener.Zr(e); - } - /** - * Can be overridden to perform additional cleanup before the stream is closed. - * Calling super.tearDown() is not required. - */ - - - qo() {} - - auth() { - this.state = 1 - /* Starting */ - ; - const t = this.Ko(this.So), - e = this.So; // TODO(mikelehen): Just use dispatchIfNotClosed, but see TODO below. - - Promise.all([this.authCredentialsProvider.getToken(), this.appCheckCredentialsProvider.getToken()]).then(_ref9 => { - let [t, n] = _ref9; - // Stream can be stopped while waiting for authentication. - // TODO(mikelehen): We really should just use dispatchIfNotClosed - // and let this dispatch onto the queue, but that opened a spec test can - // of worms that I don't want to deal with in this PR. - this.So === e && // Normally we'd have to schedule the callback on the AsyncQueue. - // However, the following calls are safe to be called outside the - // AsyncQueue since they don't chain asynchronous calls - this.Go(t, n); - }, e => { - t(() => { - const t = new Q(G.UNKNOWN, "Fetching auth token failed: " + e.message); - return this.Qo(t); - }); - }); - } - - Go(t, e) { - const n = this.Ko(this.So); - this.stream = this.jo(t, e), this.stream.Yr(() => { - n(() => (this.state = 2 - /* Open */ - , this.Co = this.Hs.enqueueAfterDelay(this.vo, 1e4, () => (this.ko() && (this.state = 3 - /* Healthy */ - ), Promise.resolve())), this.listener.Yr())); - }), this.stream.Zr(t => { - n(() => this.Qo(t)); - }), this.stream.onMessage(t => { - n(() => this.onMessage(t)); - }); - } - - Mo() { - this.state = 5 - /* Backoff */ - , this.xo.Ao(async () => { - this.state = 0 - /* Initial */ - , this.start(); - }); - } // Visible for tests - - - Qo(t) { - // In theory the stream could close cleanly, however, in our current model - // we never expect this to happen because if we stop a stream ourselves, - // this callback will never be called. To prevent cases where we retry - // without a backoff accidentally, we set the stream to error in all cases. - return O("PersistentStream", `close with error: ${t}`), this.stream = null, this.close(4 - /* Error */ - , t); - } - /** - * Returns a "dispatcher" function that dispatches operations onto the - * AsyncQueue but only runs them if closeCount remains unchanged. This allows - * us to turn auth / stream callbacks into no-ops if the stream is closed / - * re-opened, etc. - */ - - - Ko(t) { - return e => { - this.Hs.enqueueAndForget(() => this.So === t ? e() : (O("PersistentStream", "stream callback skipped by getCloseGuardedDispatcher."), Promise.resolve())); - }; - } - -} -/** - * A PersistentStream that implements the Listen RPC. - * - * Once the Listen stream has called the onOpen() listener, any number of - * listen() and unlisten() calls can be made to control what changes will be - * sent from the server for ListenResponses. - */ - - -class uu extends ou { - constructor(t, e, n, s, i, r) { - super(t, "listen_stream_connection_backoff" - /* ListenStreamConnectionBackoff */ - , "listen_stream_idle" - /* ListenStreamIdle */ - , "health_check_timeout" - /* HealthCheckTimeout */ - , e, n, s, r), this.It = i; - } - - jo(t, e) { - return this.Vo._o("Listen", t, e); - } - - onMessage(t) { - // A successful response means the stream is healthy - this.xo.reset(); - - const e = Ws(this.It, t), - n = function (t) { - // We have only reached a consistent snapshot for the entire stream if there - // is a read_time set and it applies to all targets (i.e. the list of - // targets is empty). The backend is guaranteed to send such responses. - if (!("targetChange" in t)) return ct.min(); - const e = t.targetChange; - return e.targetIds && e.targetIds.length ? ct.min() : e.readTime ? Ms(e.readTime) : ct.min(); - }(t); - - return this.listener.Wo(e, n); - } - /** - * Registers interest in the results of the given target. If the target - * includes a resumeToken it will be included in the request. Results that - * affect the target will be streamed back as WatchChange messages that - * reference the targetId. - */ - - - zo(t) { - const e = {}; - e.database = qs(this.It), e.addTarget = function (t, e) { - let n; - const s = e.target; - return n = Le(s) ? { - documents: Ys(t, s) - } : { - query: Xs(t, s) - }, n.targetId = e.targetId, e.resumeToken.approximateByteSize() > 0 ? n.resumeToken = Ns(t, e.resumeToken) : e.snapshotVersion.compareTo(ct.min()) > 0 && ( // TODO(wuandy): Consider removing above check because it is most likely true. - // Right now, many tests depend on this behaviour though (leaving min() out - // of serialization). - n.readTime = xs(t, e.snapshotVersion.toTimestamp())), n; - }(this.It, t); - const n = ti(this.It, t); - n && (e.labels = n), this.Bo(e); - } - /** - * Unregisters interest in the results of the target associated with the - * given targetId. - */ - - - Ho(t) { - const e = {}; - e.database = qs(this.It), e.removeTarget = t, this.Bo(e); - } - -} -/** - * A Stream that implements the Write RPC. - * - * The Write RPC requires the caller to maintain special streamToken - * state in between calls, to help the server understand which responses the - * client has processed by the time the next request is made. Every response - * will contain a streamToken; this value must be passed to the next - * request. - * - * After calling start() on this stream, the next request must be a handshake, - * containing whatever streamToken is on hand. Once a response to this - * request is received, all pending mutations may be submitted. When - * submitting multiple batches of mutations at the same time, it's - * okay to use the same streamToken for the calls to writeMutations. - * - * TODO(b/33271235): Use proto types - */ - - -class cu extends ou { - constructor(t, e, n, s, i, r) { - super(t, "write_stream_connection_backoff" - /* WriteStreamConnectionBackoff */ - , "write_stream_idle" - /* WriteStreamIdle */ - , "health_check_timeout" - /* HealthCheckTimeout */ - , e, n, s, r), this.It = i, this.Jo = !1; - } - /** - * Tracks whether or not a handshake has been successfully exchanged and - * the stream is ready to accept mutations. - */ - - - get Yo() { - return this.Jo; - } // Override of PersistentStream.start - - - start() { - this.Jo = !1, this.lastStreamToken = void 0, super.start(); - } - - qo() { - this.Jo && this.Xo([]); - } - - jo(t, e) { - return this.Vo._o("Write", t, e); - } - - onMessage(t) { - if ( // Always capture the last stream token. - U(!!t.streamToken), this.lastStreamToken = t.streamToken, this.Jo) { - // A successful first write response means the stream is healthy, - // Note, that we could consider a successful handshake healthy, however, - // the write itself might be causing an error we want to back off from. - this.xo.reset(); - const e = Js(t.writeResults, t.commitTime), - n = Ms(t.commitTime); - return this.listener.Zo(n, e); - } // The first response is always the handshake response - - - return U(!t.writeResults || 0 === t.writeResults.length), this.Jo = !0, this.listener.tu(); - } - /** - * Sends an initial streamToken to the server, performing the handshake - * required to make the StreamingWrite RPC work. Subsequent - * calls should wait until onHandshakeComplete was called. - */ - - - eu() { - // TODO(dimond): Support stream resumption. We intentionally do not set the - // stream token on the handshake, ignoring any stream token we might have. - const t = {}; - t.database = qs(this.It), this.Bo(t); - } - /** Sends a group of mutations to the Firestore backend to apply. */ - - - Xo(t) { - const e = { - streamToken: this.lastStreamToken, - writes: t.map(t => zs(this.It, t)) - }; - this.Bo(e); - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Datastore and its related methods are a wrapper around the external Google - * Cloud Datastore grpc API, which provides an interface that is more convenient - * for the rest of the client SDK architecture to consume. - */ - -/** - * An implementation of Datastore that exposes additional state for internal - * consumption. - */ - - -class au extends class {} { - constructor(t, e, n, s) { - super(), this.authCredentials = t, this.appCheckCredentials = e, this.Vo = n, this.It = s, this.nu = !1; - } - - su() { - if (this.nu) throw new Q(G.FAILED_PRECONDITION, "The client has already been terminated."); - } - /** Invokes the provided RPC with auth and AppCheck tokens. */ - - - co(t, e, n) { - return this.su(), Promise.all([this.authCredentials.getToken(), this.appCheckCredentials.getToken()]).then(_ref10 => { - let [s, i] = _ref10; - return this.Vo.co(t, e, n, s, i); - }).catch(t => { - throw "FirebaseError" === t.name ? (t.code === G.UNAUTHENTICATED && (this.authCredentials.invalidateToken(), this.appCheckCredentials.invalidateToken()), t) : new Q(G.UNKNOWN, t.toString()); - }); - } - /** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ - - - fo(t, e, n, s) { - return this.su(), Promise.all([this.authCredentials.getToken(), this.appCheckCredentials.getToken()]).then(_ref11 => { - let [i, r] = _ref11; - return this.Vo.fo(t, e, n, i, r, s); - }).catch(t => { - throw "FirebaseError" === t.name ? (t.code === G.UNAUTHENTICATED && (this.authCredentials.invalidateToken(), this.appCheckCredentials.invalidateToken()), t) : new Q(G.UNKNOWN, t.toString()); - }); - } - - terminate() { - this.nu = !0; - } - -} // TODO(firestorexp): Make sure there is only one Datastore instance per -// firestore-exp client. - -/** - * A component used by the RemoteStore to track the OnlineState (that is, - * whether or not the client as a whole should be considered to be online or - * offline), implementing the appropriate heuristics. - * - * In particular, when the client is trying to connect to the backend, we - * allow up to MAX_WATCH_STREAM_FAILURES within ONLINE_STATE_TIMEOUT_MS for - * a connection to succeed. If we have too many failures or the timeout elapses, - * then we set the OnlineState to Offline, and the client will behave as if - * it is offline (get()s will return cached data, etc.). - */ - - -class hu { - constructor(t, e) { - this.asyncQueue = t, this.onlineStateHandler = e, - /** The current OnlineState. */ - this.state = "Unknown" - /* Unknown */ - , - /** - * A count of consecutive failures to open the stream. If it reaches the - * maximum defined by MAX_WATCH_STREAM_FAILURES, we'll set the OnlineState to - * Offline. - */ - this.iu = 0, - /** - * A timer that elapses after ONLINE_STATE_TIMEOUT_MS, at which point we - * transition from OnlineState.Unknown to OnlineState.Offline without waiting - * for the stream to actually fail (MAX_WATCH_STREAM_FAILURES times). - */ - this.ru = null, - /** - * Whether the client should log a warning message if it fails to connect to - * the backend (initially true, cleared after a successful stream, or if we've - * logged the message already). - */ - this.ou = !0; - } - /** - * Called by RemoteStore when a watch stream is started (including on each - * backoff attempt). - * - * If this is the first attempt, it sets the OnlineState to Unknown and starts - * the onlineStateTimer. - */ - - - uu() { - 0 === this.iu && (this.cu("Unknown" - /* Unknown */ - ), this.ru = this.asyncQueue.enqueueAfterDelay("online_state_timeout" - /* OnlineStateTimeout */ - , 1e4, () => (this.ru = null, this.au("Backend didn't respond within 10 seconds."), this.cu("Offline" - /* Offline */ - ), Promise.resolve()))); - } - /** - * Updates our OnlineState as appropriate after the watch stream reports a - * failure. The first failure moves us to the 'Unknown' state. We then may - * allow multiple failures (based on MAX_WATCH_STREAM_FAILURES) before we - * actually transition to the 'Offline' state. - */ - - - hu(t) { - "Online" - /* Online */ - === this.state ? this.cu("Unknown" - /* Unknown */ - ) : (this.iu++, this.iu >= 1 && (this.lu(), this.au(`Connection failed 1 times. Most recent error: ${t.toString()}`), this.cu("Offline" - /* Offline */ - ))); - } - /** - * Explicitly sets the OnlineState to the specified state. - * - * Note that this resets our timers / failure counters, etc. used by our - * Offline heuristics, so must not be used in place of - * handleWatchStreamStart() and handleWatchStreamFailure(). - */ - - - set(t) { - this.lu(), this.iu = 0, "Online" - /* Online */ - === t && ( // We've connected to watch at least once. Don't warn the developer - // about being offline going forward. - this.ou = !1), this.cu(t); - } - - cu(t) { - t !== this.state && (this.state = t, this.onlineStateHandler(t)); - } - - au(t) { - const e = `Could not reach Cloud Firestore backend. ${t}\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.ou ? (F(e), this.ou = !1) : O("OnlineStateTracker", e); - } - - lu() { - null !== this.ru && (this.ru.cancel(), this.ru = null); - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class lu { - constructor( - /** - * The local store, used to fill the write pipeline with outbound mutations. - */ - t, - /** The client-side proxy for interacting with the backend. */ - e, n, s, i) { - this.localStore = t, this.datastore = e, this.asyncQueue = n, this.remoteSyncer = {}, - /** - * A list of up to MAX_PENDING_WRITES writes that we have fetched from the - * LocalStore via fillWritePipeline() and have or will send to the write - * stream. - * - * Whenever writePipeline.length > 0 the RemoteStore will attempt to start or - * restart the write stream. When the stream is established the writes in the - * pipeline will be sent in order. - * - * Writes remain in writePipeline until they are acknowledged by the backend - * and thus will automatically be re-sent if the stream is interrupted / - * restarted before they're acknowledged. - * - * Write responses from the backend are linked to their originating request - * purely based on order, and so we can just shift() writes from the front of - * the writePipeline as we receive responses. - */ - this.fu = [], - /** - * A mapping of watched targets that the client cares about tracking and the - * user has explicitly called a 'listen' for this target. - * - * These targets may or may not have been sent to or acknowledged by the - * server. On re-establishing the listen stream, these targets should be sent - * to the server. The targets removed with unlistens are removed eagerly - * without waiting for confirmation from the listen stream. - */ - this.du = new Map(), - /** - * A set of reasons for why the RemoteStore may be offline. If empty, the - * RemoteStore may start its network connections. - */ - this._u = new Set(), - /** - * Event handlers that get called when the network is disabled or enabled. - * - * PORTING NOTE: These functions are used on the Web client to create the - * underlying streams (to support tree-shakeable streams). On Android and iOS, - * the streams are created during construction of RemoteStore. - */ - this.wu = [], this.mu = i, this.mu.qr(t => { - n.enqueueAndForget(async () => { - // Porting Note: Unlike iOS, `restartNetwork()` is called even when the - // network becomes unreachable as we don't have any other way to tear - // down our streams. - Iu(this) && (O("RemoteStore", "Restarting streams for network reachability change."), await async function (t) { - const e = K(t); - e._u.add(4 - /* ConnectivityChange */ - ), await du(e), e.gu.set("Unknown" - /* Unknown */ - ), e._u.delete(4 - /* ConnectivityChange */ - ), await fu(e); - }(this)); - }); - }), this.gu = new hu(n, s); - } - -} - -async function fu(t) { - if (Iu(t)) for (const e of t.wu) await e( - /* enabled= */ - !0); -} -/** - * Temporarily disables the network. The network can be re-enabled using - * enableNetwork(). - */ - - -async function du(t) { - for (const e of t.wu) await e( - /* enabled= */ - !1); -} -/** - * Starts new listen for the given target. Uses resume token if provided. It - * is a no-op if the target of given `TargetData` is already being listened to. - */ - - -function _u(t, e) { - const n = K(t); - n.du.has(e.targetId) || ( // Mark this as something the client is currently listening for. - n.du.set(e.targetId, e), pu(n) ? // The listen will be sent in onWatchStreamOpen - yu(n) : $u(n).ko() && mu(n, e)); -} -/** - * Removes the listen from server. It is a no-op if the given target id is - * not being listened to. - */ - - -function wu(t, e) { - const n = K(t), - s = $u(n); - n.du.delete(e), s.ko() && gu(n, e), 0 === n.du.size && (s.ko() ? s.Fo() : Iu(n) && // Revert to OnlineState.Unknown if the watch stream is not open and we - // have no listeners, since without any listens to send we cannot - // confirm if the stream is healthy and upgrade to OnlineState.Online. - n.gu.set("Unknown" - /* Unknown */ - )); -} -/** - * We need to increment the the expected number of pending responses we're due - * from watch so we wait for the ack to process any messages from this target. - */ - - -function mu(t, e) { - t.yu.Ot(e.targetId), $u(t).zo(e); -} -/** - * We need to increment the expected number of pending responses we're due - * from watch so we wait for the removal on the server before we process any - * messages from this target. - */ - - -function gu(t, e) { - t.yu.Ot(e), $u(t).Ho(e); -} - -function yu(t) { - t.yu = new Ps({ - getRemoteKeysForTarget: e => t.remoteSyncer.getRemoteKeysForTarget(e), - se: e => t.du.get(e) || null - }), $u(t).start(), t.gu.uu(); -} -/** - * Returns whether the watch stream should be started because it's necessary - * and has not yet been started. - */ - - -function pu(t) { - return Iu(t) && !$u(t).No() && t.du.size > 0; -} - -function Iu(t) { - return 0 === K(t)._u.size; -} - -function Tu(t) { - t.yu = void 0; -} - -async function Eu(t) { - t.du.forEach((e, n) => { - mu(t, e); - }); -} - -async function Au(t, e) { - Tu(t), // If we still need the watch stream, retry the connection. - pu(t) ? (t.gu.hu(e), yu(t)) : // No need to restart watch stream because there are no active targets. - // The online state is set to unknown because there is no active attempt - // at establishing a connection - t.gu.set("Unknown" - /* Unknown */ - ); -} - -async function Ru(t, e, n) { - if ( // Mark the client as online since we got a message from the server - t.gu.set("Online" - /* Online */ - ), e instanceof Rs && 2 - /* Removed */ - === e.state && e.cause) // There was an error on a target, don't wait for a consistent snapshot - // to raise events - try { - await ( - /** Handles an error on a target */ - async function (t, e) { - const n = e.cause; - - for (const s of e.targetIds) // A watched target might have been removed already. - t.du.has(s) && (await t.remoteSyncer.rejectListen(s, n), t.du.delete(s), t.yu.removeTarget(s)); - } - /** - * Attempts to fill our write pipeline with writes from the LocalStore. - * - * Called internally to bootstrap or refill the write pipeline and by - * SyncEngine whenever there are new mutations to process. - * - * Starts the write stream if necessary. - */ - (t, e) - ); - } catch (n) { - O("RemoteStore", "Failed to remove targets %s: %s ", e.targetIds.join(","), n), await bu(t, n); - } else if (e instanceof Es ? t.yu.Gt(e) : e instanceof As ? t.yu.Yt(e) : t.yu.Wt(e), !n.isEqual(ct.min())) try { - const e = await So(t.localStore); - n.compareTo(e) >= 0 && ( // We have received a target change with a global snapshot if the snapshot - // version is not equal to SnapshotVersion.min(). - await ( - /** - * Takes a batch of changes from the Datastore, repackages them as a - * RemoteEvent, and passes that on to the listener, which is typically the - * SyncEngine. - */ - function (t, e) { - const n = t.yu.te(e); // Update in-memory resume tokens. LocalStore will update the - // persistent view of these when applying the completed RemoteEvent. - - return n.targetChanges.forEach((n, s) => { - if (n.resumeToken.approximateByteSize() > 0) { - const i = t.du.get(s); // A watched target might have been removed already. - - i && t.du.set(s, i.withResumeToken(n.resumeToken, e)); - } - }), // Re-establish listens for the targets that have been invalidated by - // existence filter mismatches. - n.targetMismatches.forEach(e => { - const n = t.du.get(e); - if (!n) // A watched target might have been removed already. - return; // Clear the resume token for the target, since we're in a known mismatch - // state. - - t.du.set(e, n.withResumeToken(Xt.EMPTY_BYTE_STRING, n.snapshotVersion)), // Cause a hard reset by unwatching and rewatching immediately, but - // deliberately don't send a resume token so that we get a full update. - gu(t, e); // Mark the target we send as being on behalf of an existence filter - // mismatch, but don't actually retain that in listenTargets. This ensures - // that we flag the first re-listen this way without impacting future - // listens of this target (that might happen e.g. on reconnect). - - const s = new qi(n.target, e, 1 - /* ExistenceFilterMismatch */ - , n.sequenceNumber); - mu(t, s); - }), t.remoteSyncer.applyRemoteEvent(n); - }(t, n) - )); - } catch (e) { - O("RemoteStore", "Failed to raise snapshot:", e), await bu(t, e); - } -} -/** - * Recovery logic for IndexedDB errors that takes the network offline until - * `op` succeeds. Retries are scheduled with backoff using - * `enqueueRetryable()`. If `op()` is not provided, IndexedDB access is - * validated via a generic operation. - * - * The returned Promise is resolved once the network is disabled and before - * any retry attempt. - */ - - -async function bu(t, e, n) { - if (!Nt(e)) throw e; - t._u.add(1 - /* IndexedDbFailed */ - ), // Disable network and raise offline snapshots - await du(t), t.gu.set("Offline" - /* Offline */ - ), n || ( // Use a simple read operation to determine if IndexedDB recovered. - // Ideally, we would expose a health check directly on SimpleDb, but - // RemoteStore only has access to persistence through LocalStore. - n = () => So(t.localStore)), // Probe IndexedDB periodically and re-enable network - t.asyncQueue.enqueueRetryable(async () => { - O("RemoteStore", "Retrying IndexedDB access"), await n(), t._u.delete(1 - /* IndexedDbFailed */ - ), await fu(t); - }); -} -/** - * Executes `op`. If `op` fails, takes the network offline until `op` - * succeeds. Returns after the first attempt. - */ - - -function Pu(t, e) { - return e().catch(n => bu(t, n, e)); -} - -async function vu(t) { - const e = K(t), - n = Bu(e); - let s = e.fu.length > 0 ? e.fu[e.fu.length - 1].batchId : -1; - - for (; Vu(e);) try { - const t = await xo(e.localStore, s); - - if (null === t) { - 0 === e.fu.length && n.Fo(); - break; - } - - s = t.batchId, Su(e, t); - } catch (t) { - await bu(e, t); - } - - Du(e) && Cu(e); -} -/** - * Returns true if we can add to the write pipeline (i.e. the network is - * enabled and the write pipeline is not full). - */ - - -function Vu(t) { - return Iu(t) && t.fu.length < 10; -} -/** - * Queues additional writes to be sent to the write stream, sending them - * immediately if the write stream is established. - */ - - -function Su(t, e) { - t.fu.push(e); - const n = Bu(t); - n.ko() && n.Yo && n.Xo(e.mutations); -} - -function Du(t) { - return Iu(t) && !Bu(t).No() && t.fu.length > 0; -} - -function Cu(t) { - Bu(t).start(); -} - -async function xu(t) { - Bu(t).eu(); -} - -async function Nu(t) { - const e = Bu(t); // Send the write pipeline now that the stream is established. - - for (const n of t.fu) e.Xo(n.mutations); -} - -async function ku(t, e, n) { - const s = t.fu.shift(), - i = Li.from(s, e, n); - await Pu(t, () => t.remoteSyncer.applySuccessfulWrite(i)), // It's possible that with the completion of this mutation another - // slot has freed up. - await vu(t); -} - -async function Mu(t, e) { - // If the write stream closed after the write handshake completes, a write - // operation failed and we fail the pending operation. - e && Bu(t).Yo && ( // This error affects the actual write. - await async function (t, e) { - // Only handle permanent errors here. If it's transient, just let the retry - // logic kick in. - if (n = e.code, is(n) && n !== G.ABORTED) { - // This was a permanent error, the request itself was the problem - // so it's not going to succeed if we resend it. - const n = t.fu.shift(); // In this case it's also unlikely that the server itself is melting - // down -- this was just a bad request so inhibit backoff on the next - // restart. - - Bu(t).Oo(), await Pu(t, () => t.remoteSyncer.rejectFailedWrite(n.batchId, e)), // It's possible that with the completion of this mutation - // another slot has freed up. - await vu(t); - } - - var n; - }(t, e)), // The write stream might have been started by refilling the write - // pipeline for failed writes - Du(t) && Cu(t); -} - -async function Ou(t, e) { - const n = K(t); - n.asyncQueue.verifyOperationInProgress(), O("RemoteStore", "RemoteStore received new credentials"); - const s = Iu(n); // Tear down and re-create our network streams. This will ensure we get a - // fresh auth token for the new user and re-fill the write pipeline with - // new mutations from the LocalStore (since mutations are per-user). - - n._u.add(3 - /* CredentialChange */ - ), await du(n), s && // Don't set the network status to Unknown if we are offline. - n.gu.set("Unknown" - /* Unknown */ - ), await n.remoteSyncer.handleCredentialChange(e), n._u.delete(3 - /* CredentialChange */ - ), await fu(n); -} -/** - * Toggles the network state when the client gains or loses its primary lease. - */ - - -async function Fu(t, e) { - const n = K(t); - e ? (n._u.delete(2 - /* IsSecondary */ - ), await fu(n)) : e || (n._u.add(2 - /* IsSecondary */ - ), await du(n), n.gu.set("Unknown" - /* Unknown */ - )); -} -/** - * If not yet initialized, registers the WatchStream and its network state - * callback with `remoteStoreImpl`. Returns the existing stream if one is - * already available. - * - * PORTING NOTE: On iOS and Android, the WatchStream gets registered on startup. - * This is not done on Web to allow it to be tree-shaken. - */ - - -function $u(t) { - return t.pu || ( // Create stream (but note that it is not started yet). - t.pu = function (t, e, n) { - const s = K(t); - return s.su(), new uu(e, s.Vo, s.authCredentials, s.appCheckCredentials, s.It, n); - } - /** - * @license - * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - (t.datastore, t.asyncQueue, { - Yr: Eu.bind(null, t), - Zr: Au.bind(null, t), - Wo: Ru.bind(null, t) - }), t.wu.push(async e => { - e ? (t.pu.Oo(), pu(t) ? yu(t) : t.gu.set("Unknown" - /* Unknown */ - )) : (await t.pu.stop(), Tu(t)); - })), t.pu; -} -/** - * If not yet initialized, registers the WriteStream and its network state - * callback with `remoteStoreImpl`. Returns the existing stream if one is - * already available. - * - * PORTING NOTE: On iOS and Android, the WriteStream gets registered on startup. - * This is not done on Web to allow it to be tree-shaken. - */ - - -function Bu(t) { - return t.Iu || ( // Create stream (but note that it is not started yet). - t.Iu = function (t, e, n) { - const s = K(t); - return s.su(), new cu(e, s.Vo, s.authCredentials, s.appCheckCredentials, s.It, n); - }(t.datastore, t.asyncQueue, { - Yr: xu.bind(null, t), - Zr: Mu.bind(null, t), - tu: Nu.bind(null, t), - Zo: ku.bind(null, t) - }), t.wu.push(async e => { - e ? (t.Iu.Oo(), // This will start the write stream if necessary. - await vu(t)) : (await t.Iu.stop(), t.fu.length > 0 && (O("RemoteStore", `Stopping write stream with ${t.fu.length} pending writes`), t.fu = [])); - })), t.Iu; -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Represents an operation scheduled to be run in the future on an AsyncQueue. - * - * It is created via DelayedOperation.createAndSchedule(). - * - * Supports cancellation (via cancel()) and early execution (via skipDelay()). - * - * Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type - * in newer versions of TypeScript defines `finally`, which is not available in - * IE. - */ - - -class Lu { - constructor(t, e, n, s, i) { - this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = s, this.removalCallback = i, this.deferred = new j(), this.then = this.deferred.promise.then.bind(this.deferred.promise), // It's normal for the deferred promise to be canceled (due to cancellation) - // and so we attach a dummy catch callback to avoid - // 'UnhandledPromiseRejectionWarning' log spam. - this.deferred.promise.catch(t => {}); - } - /** - * Creates and returns a DelayedOperation that has been scheduled to be - * executed on the provided asyncQueue after the provided delayMs. - * - * @param asyncQueue - The queue to schedule the operation on. - * @param id - A Timer ID identifying the type of operation this is. - * @param delayMs - The delay (ms) before the operation should be scheduled. - * @param op - The operation to run. - * @param removalCallback - A callback to be called synchronously once the - * operation is executed or canceled, notifying the AsyncQueue to remove it - * from its delayedOperations list. - * PORTING NOTE: This exists to prevent making removeDelayedOperation() and - * the DelayedOperation class public. - */ - - - static createAndSchedule(t, e, n, s, i) { - const r = Date.now() + n, - o = new Lu(t, e, r, s, i); - return o.start(n), o; - } - /** - * Starts the timer. This is called immediately after construction by - * createAndSchedule(). - */ - - - start(t) { - this.timerHandle = setTimeout(() => this.handleDelayElapsed(), t); - } - /** - * Queues the operation to run immediately (if it hasn't already been run or - * canceled). - */ - - - skipDelay() { - return this.handleDelayElapsed(); - } - /** - * Cancels the operation if it hasn't already been executed or canceled. The - * promise will be rejected. - * - * As long as the operation has not yet been run, calling cancel() provides a - * guarantee that the operation will not be run. - */ - - - cancel(t) { - null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new Q(G.CANCELLED, "Operation cancelled" + (t ? ": " + t : "")))); - } - - handleDelayElapsed() { - this.asyncQueue.enqueueAndForget(() => null !== this.timerHandle ? (this.clearTimeout(), this.op().then(t => this.deferred.resolve(t))) : Promise.resolve()); - } - - clearTimeout() { - null !== this.timerHandle && (this.removalCallback(this), clearTimeout(this.timerHandle), this.timerHandle = null); - } - -} -/** - * Returns a FirestoreError that can be surfaced to the user if the provided - * error is an IndexedDbTransactionError. Re-throws the error otherwise. - */ - - -function Uu(t, e) { - if (F("AsyncQueue", `${e}: ${t}`), Nt(t)) return new Q(G.UNAVAILABLE, `${e}: ${t}`); - throw t; -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * DocumentSet is an immutable (copy-on-write) collection that holds documents - * in order specified by the provided comparator. We always add a document key - * comparator on top of what is provided to guarantee document equality based on - * the key. - */ - - -class qu { - /** The default ordering is by key if the comparator is omitted */ - constructor(t) { - // We are adding document key comparator to the end as it's the only - // guaranteed unique property of a document. - this.comparator = t ? (e, n) => t(e, n) || dt.comparator(e.key, n.key) : (t, e) => dt.comparator(t.key, e.key), this.keyedMap = hs(), this.sortedSet = new Gt(this.comparator); - } - /** - * Returns an empty copy of the existing DocumentSet, using the same - * comparator. - */ - - - static emptySet(t) { - return new qu(t.comparator); - } - - has(t) { - return null != this.keyedMap.get(t); - } - - get(t) { - return this.keyedMap.get(t); - } - - first() { - return this.sortedSet.minKey(); - } - - last() { - return this.sortedSet.maxKey(); - } - - isEmpty() { - return this.sortedSet.isEmpty(); - } - /** - * Returns the index of the provided key in the document set, or -1 if the - * document key is not present in the set; - */ - - - indexOf(t) { - const e = this.keyedMap.get(t); - return e ? this.sortedSet.indexOf(e) : -1; - } - - get size() { - return this.sortedSet.size; - } - /** Iterates documents in order defined by "comparator" */ - - - forEach(t) { - this.sortedSet.inorderTraversal((e, n) => (t(e), !1)); - } - /** Inserts or updates a document with the same key */ - - - add(t) { - // First remove the element if we have it. - const e = this.delete(t.key); - return e.copy(e.keyedMap.insert(t.key, t), e.sortedSet.insert(t, null)); - } - /** Deletes a document with a given key */ - - - delete(t) { - const e = this.get(t); - return e ? this.copy(this.keyedMap.remove(t), this.sortedSet.remove(e)) : this; - } - - isEqual(t) { - if (!(t instanceof qu)) return !1; - if (this.size !== t.size) return !1; - const e = this.sortedSet.getIterator(), - n = t.sortedSet.getIterator(); - - for (; e.hasNext();) { - const t = e.getNext().key, - s = n.getNext().key; - if (!t.isEqual(s)) return !1; - } - - return !0; - } - - toString() { - const t = []; - return this.forEach(e => { - t.push(e.toString()); - }), 0 === t.length ? "DocumentSet ()" : "DocumentSet (\n " + t.join(" \n") + "\n)"; - } - - copy(t, e) { - const n = new qu(); - return n.comparator = this.comparator, n.keyedMap = t, n.sortedSet = e, n; - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * DocumentChangeSet keeps track of a set of changes to docs in a query, merging - * duplicate events for the same doc. - */ - - -class Ku { - constructor() { - this.Tu = new Gt(dt.comparator); - } - - track(t) { - const e = t.doc.key, - n = this.Tu.get(e); - n ? // Merge the new change with the existing change. - 0 - /* Added */ - !== t.type && 3 - /* Metadata */ - === n.type ? this.Tu = this.Tu.insert(e, t) : 3 - /* Metadata */ - === t.type && 1 - /* Removed */ - !== n.type ? this.Tu = this.Tu.insert(e, { - type: n.type, - doc: t.doc - }) : 2 - /* Modified */ - === t.type && 2 - /* Modified */ - === n.type ? this.Tu = this.Tu.insert(e, { - type: 2 - /* Modified */ - , - doc: t.doc - }) : 2 - /* Modified */ - === t.type && 0 - /* Added */ - === n.type ? this.Tu = this.Tu.insert(e, { - type: 0 - /* Added */ - , - doc: t.doc - }) : 1 - /* Removed */ - === t.type && 0 - /* Added */ - === n.type ? this.Tu = this.Tu.remove(e) : 1 - /* Removed */ - === t.type && 2 - /* Modified */ - === n.type ? this.Tu = this.Tu.insert(e, { - type: 1 - /* Removed */ - , - doc: n.doc - }) : 0 - /* Added */ - === t.type && 1 - /* Removed */ - === n.type ? this.Tu = this.Tu.insert(e, { - type: 2 - /* Modified */ - , - doc: t.doc - }) : // This includes these cases, which don't make sense: - // Added->Added - // Removed->Removed - // Modified->Added - // Removed->Modified - // Metadata->Added - // Removed->Metadata - L() : this.Tu = this.Tu.insert(e, t); - } - - Eu() { - const t = []; - return this.Tu.inorderTraversal((e, n) => { - t.push(n); - }), t; - } - -} - -class Gu { - constructor(t, e, n, s, i, r, o, u) { - this.query = t, this.docs = e, this.oldDocs = n, this.docChanges = s, this.mutatedKeys = i, this.fromCache = r, this.syncStateChanged = o, this.excludesMetadataChanges = u; - } - /** Returns a view snapshot as if all documents in the snapshot were added. */ - - - static fromInitialDocuments(t, e, n, s) { - const i = []; - return e.forEach(t => { - i.push({ - type: 0 - /* Added */ - , - doc: t - }); - }), new Gu(t, e, qu.emptySet(e), i, n, s, - /* syncStateChanged= */ - !0, - /* excludesMetadataChanges= */ - !1); - } - - get hasPendingWrites() { - return !this.mutatedKeys.isEmpty(); - } - - isEqual(t) { - if (!(this.fromCache === t.fromCache && this.syncStateChanged === t.syncStateChanged && this.mutatedKeys.isEqual(t.mutatedKeys) && wn(this.query, t.query) && this.docs.isEqual(t.docs) && this.oldDocs.isEqual(t.oldDocs))) return !1; - const e = this.docChanges, - n = t.docChanges; - if (e.length !== n.length) return !1; - - for (let t = 0; t < e.length; t++) if (e[t].type !== n[t].type || !e[t].doc.isEqual(n[t].doc)) return !1; - - return !0; - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Holds the listeners and the last received ViewSnapshot for a query being - * tracked by EventManager. - */ - - -class Qu { - constructor() { - this.Au = void 0, this.listeners = []; - } - -} - -class ju { - constructor() { - this.queries = new os(t => mn(t), wn), this.onlineState = "Unknown" - /* Unknown */ - , this.Ru = new Set(); - } - -} - -async function Wu(t, e) { - const n = K(t), - s = e.query; - let i = !1, - r = n.queries.get(s); - if (r || (i = !0, r = new Qu()), i) try { - r.Au = await n.onListen(s); - } catch (t) { - const n = Uu(t, `Initialization of query '${gn(e.query)}' failed`); - return void e.onError(n); - } - - if (n.queries.set(s, r), r.listeners.push(e), // Run global snapshot listeners if a consistent snapshot has been emitted. - e.bu(n.onlineState), r.Au) { - e.Pu(r.Au) && Yu(n); - } -} - -async function zu(t, e) { - const n = K(t), - s = e.query; - let i = !1; - const r = n.queries.get(s); - - if (r) { - const t = r.listeners.indexOf(e); - t >= 0 && (r.listeners.splice(t, 1), i = 0 === r.listeners.length); - } - - if (i) return n.queries.delete(s), n.onUnlisten(s); -} - -function Hu(t, e) { - const n = K(t); - let s = !1; - - for (const t of e) { - const e = t.query, - i = n.queries.get(e); - - if (i) { - for (const e of i.listeners) e.Pu(t) && (s = !0); - - i.Au = t; - } - } - - s && Yu(n); -} - -function Ju(t, e, n) { - const s = K(t), - i = s.queries.get(e); - if (i) for (const t of i.listeners) t.onError(n); // Remove all listeners. NOTE: We don't need to call syncEngine.unlisten() - // after an error. - - s.queries.delete(e); -} // Call all global snapshot listeners that have been set. - - -function Yu(t) { - t.Ru.forEach(t => { - t.next(); - }); -} -/** - * QueryListener takes a series of internal view snapshots and determines - * when to raise the event. - * - * It uses an Observer to dispatch events. - */ - - -class Xu { - constructor(t, e, n) { - this.query = t, this.vu = e, - /** - * Initial snapshots (e.g. from cache) may not be propagated to the wrapped - * observer. This flag is set to true once we've actually raised an event. - */ - this.Vu = !1, this.Su = null, this.onlineState = "Unknown" - /* Unknown */ - , this.options = n || {}; - } - /** - * Applies the new ViewSnapshot to this listener, raising a user-facing event - * if applicable (depending on what changed, whether the user has opted into - * metadata-only changes, etc.). Returns true if a user-facing event was - * indeed raised. - */ - - - Pu(t) { - if (!this.options.includeMetadataChanges) { - // Remove the metadata only changes. - const e = []; - - for (const n of t.docChanges) 3 - /* Metadata */ - !== n.type && e.push(n); - - t = new Gu(t.query, t.docs, t.oldDocs, e, t.mutatedKeys, t.fromCache, t.syncStateChanged, - /* excludesMetadataChanges= */ - !0); - } - - let e = !1; - return this.Vu ? this.Du(t) && (this.vu.next(t), e = !0) : this.Cu(t, this.onlineState) && (this.xu(t), e = !0), this.Su = t, e; - } - - onError(t) { - this.vu.error(t); - } - /** Returns whether a snapshot was raised. */ - - - bu(t) { - this.onlineState = t; - let e = !1; - return this.Su && !this.Vu && this.Cu(this.Su, t) && (this.xu(this.Su), e = !0), e; - } - - Cu(t, e) { - // Always raise the first event when we're synced - if (!t.fromCache) return !0; // NOTE: We consider OnlineState.Unknown as online (it should become Offline - // or Online if we wait long enough). - - const n = "Offline" - /* Offline */ - !== e; // Don't raise the event if we're online, aren't synced yet (checked - // above) and are waiting for a sync. - - return (!this.options.Nu || !n) && (!t.docs.isEmpty() || "Offline" - /* Offline */ - === e); // Raise data from cache if we have any documents or we are offline - } - - Du(t) { - // We don't need to handle includeDocumentMetadataChanges here because - // the Metadata only changes have already been stripped out if needed. - // At this point the only changes we will see are the ones we should - // propagate. - if (t.docChanges.length > 0) return !0; - const e = this.Su && this.Su.hasPendingWrites !== t.hasPendingWrites; - return !(!t.syncStateChanged && !e) && !0 === this.options.includeMetadataChanges; // Generally we should have hit one of the cases above, but it's possible - // to get here if there were only metadata docChanges and they got - // stripped out. - } - - xu(t) { - t = Gu.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache), this.Vu = !0, this.vu.next(t); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A complete element in the bundle stream, together with the byte length it - * occupies in the stream. - */ - - -class Zu { - constructor(t, // How many bytes this element takes to store in the bundle. - e) { - this.payload = t, this.byteLength = e; - } - - ku() { - return "metadata" in this.payload; - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Helper to convert objects from bundles to model objects in the SDK. - */ - - -class tc { - constructor(t) { - this.It = t; - } - - Ji(t) { - return Bs(this.It, t); - } - /** - * Converts a BundleDocument to a MutableDocument. - */ - - - Yi(t) { - return t.metadata.exists ? Qs(this.It, t.document, !1) : ke.newNoDocument(this.Ji(t.metadata.name), this.Xi(t.metadata.readTime)); - } - - Xi(t) { - return Ms(t); - } - -} -/** - * A class to process the elements from a bundle, load them into local - * storage and provide progress update while loading. - */ - - -class ec { - constructor(t, e, n) { - this.Mu = t, this.localStore = e, this.It = n, - /** Batched queries to be saved into storage */ - this.queries = [], - /** Batched documents to be saved into storage */ - this.documents = [], - /** The collection groups affected by this bundle. */ - this.collectionGroups = new Set(), this.progress = nc(t); - } - /** - * Adds an element from the bundle to the loader. - * - * Returns a new progress if adding the element leads to a new progress, - * otherwise returns null. - */ - - - Ou(t) { - this.progress.bytesLoaded += t.byteLength; - let e = this.progress.documentsLoaded; - if (t.payload.namedQuery) this.queries.push(t.payload.namedQuery);else if (t.payload.documentMetadata) { - this.documents.push({ - metadata: t.payload.documentMetadata - }), t.payload.documentMetadata.exists || ++e; - const n = ht.fromString(t.payload.documentMetadata.name); - this.collectionGroups.add(n.get(n.length - 2)); - } else t.payload.document && (this.documents[this.documents.length - 1].document = t.payload.document, ++e); - return e !== this.progress.documentsLoaded ? (this.progress.documentsLoaded = e, Object.assign({}, this.progress)) : null; - } - - Fu(t) { - const e = new Map(), - n = new tc(this.It); - - for (const s of t) if (s.metadata.queries) { - const t = n.Ji(s.metadata.name); - - for (const n of s.metadata.queries) { - const s = (e.get(n) || gs()).add(t); - e.set(n, s); - } - } - - return e; - } - /** - * Update the progress to 'Success' and return the updated progress. - */ - - - async complete() { - const t = await Bo(this.localStore, new tc(this.It), this.documents, this.Mu.id), - e = this.Fu(this.documents); - - for (const t of this.queries) await Lo(this.localStore, t, e.get(t.name)); - - return this.progress.taskState = "Success", { - progress: this.progress, - $u: this.collectionGroups, - Bu: t - }; - } - -} -/** - * Returns a `LoadBundleTaskProgress` representing the initial progress of - * loading a bundle. - */ - - -function nc(t) { - return { - taskState: "Running", - documentsLoaded: 0, - bytesLoaded: 0, - totalDocuments: t.totalDocuments, - totalBytes: t.totalBytes - }; -} -/** - * Returns a `LoadBundleTaskProgress` representing the progress that the loading - * has succeeded. - */ - -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class sc { - constructor(t) { - this.key = t; - } - -} - -class ic { - constructor(t) { - this.key = t; - } - -} -/** - * View is responsible for computing the final merged truth of what docs are in - * a query. It gets notified of local and remote changes to docs, and applies - * the query filters and limits to determine the most correct possible results. - */ - - -class rc { - constructor(t, - /** Documents included in the remote target */ - e) { - this.query = t, this.Lu = e, this.Uu = null, - /** - * A flag whether the view is current with the backend. A view is considered - * current after it has seen the current flag from the backend and did not - * lose consistency within the watch stream (e.g. because of an existence - * filter mismatch). - */ - this.current = !1, - /** Documents in the view but not in the remote target */ - this.qu = gs(), - /** Document Keys that have local changes */ - this.mutatedKeys = gs(), this.Ku = In(t), this.Gu = new qu(this.Ku); - } - /** - * The set of remote documents that the server has told us belongs to the target associated with - * this view. - */ - - - get Qu() { - return this.Lu; - } - /** - * Iterates over a set of doc changes, applies the query limit, and computes - * what the new results should be, what the changes were, and whether we may - * need to go back to the local cache for more results. Does not make any - * changes to the view. - * @param docChanges - The doc changes to apply to this view. - * @param previousChanges - If this is being called with a refill, then start - * with this set of docs and changes instead of the current view. - * @returns a new set of docs, changes, and refill flag. - */ - - - ju(t, e) { - const n = e ? e.Wu : new Ku(), - s = e ? e.Gu : this.Gu; - let i = e ? e.mutatedKeys : this.mutatedKeys, - r = s, - o = !1; // Track the last doc in a (full) limit. This is necessary, because some - // update (a delete, or an update moving a doc past the old limit) might - // mean there is some other document in the local cache that either should - // come (1) between the old last limit doc and the new last document, in the - // case of updates, or (2) after the new last document, in the case of - // deletes. So we keep this doc at the old limit to compare the updates to. - // Note that this should never get used in a refill (when previousChanges is - // set), because there will only be adds -- no deletes or updates. - - const u = "F" - /* First */ - === this.query.limitType && s.size === this.query.limit ? s.last() : null, - c = "L" - /* Last */ - === this.query.limitType && s.size === this.query.limit ? s.first() : null; // Drop documents out to meet limit/limitToLast requirement. - - if (t.inorderTraversal((t, e) => { - const a = s.get(t), - h = yn(this.query, e) ? e : null, - l = !!a && this.mutatedKeys.has(a.key), - f = !!h && (h.hasLocalMutations || // We only consider committed mutations for documents that were - // mutated during the lifetime of the view. - this.mutatedKeys.has(h.key) && h.hasCommittedMutations); - let d = !1; // Calculate change - - if (a && h) { - a.data.isEqual(h.data) ? l !== f && (n.track({ - type: 3 - /* Metadata */ - , - doc: h - }), d = !0) : this.zu(a, h) || (n.track({ - type: 2 - /* Modified */ - , - doc: h - }), d = !0, (u && this.Ku(h, u) > 0 || c && this.Ku(h, c) < 0) && ( // This doc moved from inside the limit to outside the limit. - // That means there may be some other doc in the local cache - // that should be included instead. - o = !0)); - } else !a && h ? (n.track({ - type: 0 - /* Added */ - , - doc: h - }), d = !0) : a && !h && (n.track({ - type: 1 - /* Removed */ - , - doc: a - }), d = !0, (u || c) && ( // A doc was removed from a full limit query. We'll need to - // requery from the local cache to see if we know about some other - // doc that should be in the results. - o = !0)); - - d && (h ? (r = r.add(h), i = f ? i.add(t) : i.delete(t)) : (r = r.delete(t), i = i.delete(t))); - }), null !== this.query.limit) for (; r.size > this.query.limit;) { - const t = "F" - /* First */ - === this.query.limitType ? r.last() : r.first(); - r = r.delete(t.key), i = i.delete(t.key), n.track({ - type: 1 - /* Removed */ - , - doc: t - }); - } - return { - Gu: r, - Wu: n, - $i: o, - mutatedKeys: i - }; - } - - zu(t, e) { - // We suppress the initial change event for documents that were modified as - // part of a write acknowledgment (e.g. when the value of a server transform - // is applied) as Watch will send us the same document again. - // By suppressing the event, we only raise two user visible events (one with - // `hasPendingWrites` and the final state of the document) instead of three - // (one with `hasPendingWrites`, the modified document with - // `hasPendingWrites` and the final state of the document). - return t.hasLocalMutations && e.hasCommittedMutations && !e.hasLocalMutations; - } - /** - * Updates the view with the given ViewDocumentChanges and optionally updates - * limbo docs and sync state from the provided target change. - * @param docChanges - The set of changes to make to the view's docs. - * @param updateLimboDocuments - Whether to update limbo documents based on - * this change. - * @param targetChange - A target change to apply for computing limbo docs and - * sync state. - * @returns A new ViewChange with the given docs, changes, and sync state. - */ - // PORTING NOTE: The iOS/Android clients always compute limbo document changes. - - - applyChanges(t, e, n) { - const s = this.Gu; - this.Gu = t.Gu, this.mutatedKeys = t.mutatedKeys; // Sort changes based on type and query comparator - - const i = t.Wu.Eu(); - i.sort((t, e) => function (t, e) { - const n = t => { - switch (t) { - case 0 - /* Added */ - : - return 1; - - case 2 - /* Modified */ - : - case 3 - /* Metadata */ - : - // A metadata change is converted to a modified change at the public - // api layer. Since we sort by document key and then change type, - // metadata and modified changes must be sorted equivalently. - return 2; - - case 1 - /* Removed */ - : - return 0; - - default: - return L(); - } - }; - - return n(t) - n(e); - } - /** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - (t.type, e.type) || this.Ku(t.doc, e.doc)), this.Hu(n); - const r = e ? this.Ju() : [], - o = 0 === this.qu.size && this.current ? 1 - /* Synced */ - : 0 - /* Local */ - , - u = o !== this.Uu; - - if (this.Uu = o, 0 !== i.length || u) { - return { - snapshot: new Gu(this.query, t.Gu, s, i, t.mutatedKeys, 0 - /* Local */ - === o, u, - /* excludesMetadataChanges= */ - !1), - Yu: r - }; - } // no changes - - - return { - Yu: r - }; - } - /** - * Applies an OnlineState change to the view, potentially generating a - * ViewChange if the view's syncState changes as a result. - */ - - - bu(t) { - return this.current && "Offline" - /* Offline */ - === t ? ( // If we're offline, set `current` to false and then call applyChanges() - // to refresh our syncState and generate a ViewChange as appropriate. We - // are guaranteed to get a new TargetChange that sets `current` back to - // true once the client is back online. - this.current = !1, this.applyChanges({ - Gu: this.Gu, - Wu: new Ku(), - mutatedKeys: this.mutatedKeys, - $i: !1 - }, - /* updateLimboDocuments= */ - !1)) : { - Yu: [] - }; - } - /** - * Returns whether the doc for the given key should be in limbo. - */ - - - Xu(t) { - // If the remote end says it's part of this query, it's not in limbo. - return !this.Lu.has(t) && // The local store doesn't think it's a result, so it shouldn't be in limbo. - !!this.Gu.has(t) && !this.Gu.get(t).hasLocalMutations; - } - /** - * Updates syncedDocuments, current, and limbo docs based on the given change. - * Returns the list of changes to which docs are in limbo. - */ - - - Hu(t) { - t && (t.addedDocuments.forEach(t => this.Lu = this.Lu.add(t)), t.modifiedDocuments.forEach(t => {}), t.removedDocuments.forEach(t => this.Lu = this.Lu.delete(t)), this.current = t.current); - } - - Ju() { - // We can only determine limbo documents when we're in-sync with the server. - if (!this.current) return []; // TODO(klimt): Do this incrementally so that it's not quadratic when - // updating many documents. - - const t = this.qu; - this.qu = gs(), this.Gu.forEach(t => { - this.Xu(t.key) && (this.qu = this.qu.add(t.key)); - }); // Diff the new limbo docs with the old limbo docs. - - const e = []; - return t.forEach(t => { - this.qu.has(t) || e.push(new ic(t)); - }), this.qu.forEach(n => { - t.has(n) || e.push(new sc(n)); - }), e; - } - /** - * Update the in-memory state of the current view with the state read from - * persistence. - * - * We update the query view whenever a client's primary status changes: - * - When a client transitions from primary to secondary, it can miss - * LocalStorage updates and its query views may temporarily not be - * synchronized with the state on disk. - * - For secondary to primary transitions, the client needs to update the list - * of `syncedDocuments` since secondary clients update their query views - * based purely on synthesized RemoteEvents. - * - * @param queryResult.documents - The documents that match the query according - * to the LocalStore. - * @param queryResult.remoteKeys - The keys of the documents that match the - * query according to the backend. - * - * @returns The ViewChange that resulted from this synchronization. - */ - // PORTING NOTE: Multi-tab only. - - - Zu(t) { - this.Lu = t.Hi, this.qu = gs(); - const e = this.ju(t.documents); - return this.applyChanges(e, - /*updateLimboDocuments=*/ - !0); - } - /** - * Returns a view snapshot as if this query was just listened to. Contains - * a document add for every existing document and the `fromCache` and - * `hasPendingWrites` status of the already established view. - */ - // PORTING NOTE: Multi-tab only. - - - tc() { - return Gu.fromInitialDocuments(this.query, this.Gu, this.mutatedKeys, 0 - /* Local */ - === this.Uu); - } - -} -/** - * QueryView contains all of the data that SyncEngine needs to keep track of for - * a particular query. - */ - - -class oc { - constructor( - /** - * The query itself. - */ - t, - /** - * The target number created by the client that is used in the watch - * stream to identify this query. - */ - e, - /** - * The view is responsible for computing the final merged truth of what - * docs are in the query. It gets notified of local and remote changes, - * and applies the query filters and limits to determine the most correct - * possible results. - */ - n) { - this.query = t, this.targetId = e, this.view = n; - } - -} -/** Tracks a limbo resolution. */ - - -class uc { - constructor(t) { - this.key = t, - /** - * Set to true once we've received a document. This is used in - * getRemoteKeysForTarget() and ultimately used by WatchChangeAggregator to - * decide whether it needs to manufacture a delete event for the target once - * the target is CURRENT. - */ - this.ec = !1; - } - -} -/** - * An implementation of `SyncEngine` coordinating with other parts of SDK. - * - * The parts of SyncEngine that act as a callback to RemoteStore need to be - * registered individually. This is done in `syncEngineWrite()` and - * `syncEngineListen()` (as well as `applyPrimaryState()`) as these methods - * serve as entry points to RemoteStore's functionality. - * - * Note: some field defined in this class might have public access level, but - * the class is not exported so they are only accessible from this module. - * This is useful to implement optional features (like bundles) in free - * functions, such that they are tree-shakeable. - */ - - -class cc { - constructor(t, e, n, // PORTING NOTE: Manages state synchronization in multi-tab environments. - s, i, r) { - this.localStore = t, this.remoteStore = e, this.eventManager = n, this.sharedClientState = s, this.currentUser = i, this.maxConcurrentLimboResolutions = r, this.nc = {}, this.sc = new os(t => mn(t), wn), this.ic = new Map(), - /** - * The keys of documents that are in limbo for which we haven't yet started a - * limbo resolution query. The strings in this set are the result of calling - * `key.path.canonicalString()` where `key` is a `DocumentKey` object. - * - * The `Set` type was chosen because it provides efficient lookup and removal - * of arbitrary elements and it also maintains insertion order, providing the - * desired queue-like FIFO semantics. - */ - this.rc = new Set(), - /** - * Keeps track of the target ID for each document that is in limbo with an - * active target. - */ - this.oc = new Gt(dt.comparator), - /** - * Keeps track of the information about an active limbo resolution for each - * active target ID that was started for the purpose of limbo resolution. - */ - this.uc = new Map(), this.cc = new oo(), - /** Stores user completion handlers, indexed by User and BatchId. */ - this.ac = {}, - /** Stores user callbacks waiting for all pending writes to be acknowledged. */ - this.hc = new Map(), this.lc = Or.vn(), this.onlineState = "Unknown" - /* Unknown */ - , // The primary state is set to `true` or `false` immediately after Firestore - // startup. In the interim, a client should only be considered primary if - // `isPrimary` is true. - this.fc = void 0; - } - - get isPrimaryClient() { - return !0 === this.fc; - } - -} -/** - * Initiates the new listen, resolves promise when listen enqueued to the - * server. All the subsequent view snapshots or errors are sent to the - * subscribed handlers. Returns the initial snapshot. - */ - - -async function ac(t, e) { - const n = $c(t); - let s, i; - const r = n.sc.get(e); - if (r) // PORTING NOTE: With Multi-Tab Web, it is possible that a query view - // already exists when EventManager calls us for the first time. This - // happens when the primary tab is already listening to this query on - // behalf of another tab and the user of the primary also starts listening - // to the query. EventManager will not have an assigned target ID in this - // case and calls `listen` to obtain this ID. - s = r.targetId, n.sharedClientState.addLocalQueryTarget(s), i = r.view.tc();else { - const t = await No(n.localStore, dn(e)); - n.isPrimaryClient && _u(n.remoteStore, t); - const r = n.sharedClientState.addLocalQueryTarget(t.targetId); - s = t.targetId, i = await hc(n, e, s, "current" === r); - } - return i; -} -/** - * Registers a view for a previously unknown query and computes its initial - * snapshot. - */ - - -async function hc(t, e, n, s) { - // PORTING NOTE: On Web only, we inject the code that registers new Limbo - // targets based on view changes. This allows us to only depend on Limbo - // changes when user code includes queries. - t.dc = (e, n, s) => async function (t, e, n, s) { - let i = e.view.ju(n); - i.$i && ( // The query has a limit and some docs were removed, so we need - // to re-run the query against the local store to make sure we - // didn't lose any good docs that had been past the limit. - i = await Mo(t.localStore, e.query, - /* usePreviousResults= */ - !1).then(_ref12 => { - let { - documents: t - } = _ref12; - return e.view.ju(t, i); - })); - const r = s && s.targetChanges.get(e.targetId), - o = e.view.applyChanges(i, - /* updateLimboDocuments= */ - t.isPrimaryClient, r); - return Ac(t, e.targetId, o.Yu), o.snapshot; - }(t, e, n, s); - - const i = await Mo(t.localStore, e, - /* usePreviousResults= */ - !0), - r = new rc(e, i.Hi), - o = r.ju(i.documents), - u = Ts.createSynthesizedTargetChangeForCurrentChange(n, s && "Offline" - /* Offline */ - !== t.onlineState), - c = r.applyChanges(o, - /* updateLimboDocuments= */ - t.isPrimaryClient, u); - Ac(t, n, c.Yu); - const a = new oc(e, n, r); - return t.sc.set(e, a), t.ic.has(n) ? t.ic.get(n).push(e) : t.ic.set(n, [e]), c.snapshot; -} -/** Stops listening to the query. */ - - -async function lc(t, e) { - const n = K(t), - s = n.sc.get(e), - i = n.ic.get(s.targetId); - if (i.length > 1) return n.ic.set(s.targetId, i.filter(t => !wn(t, e))), void n.sc.delete(e); // No other queries are mapped to the target, clean up the query and the target. - - if (n.isPrimaryClient) { - // We need to remove the local query target first to allow us to verify - // whether any other client is still interested in this target. - n.sharedClientState.removeLocalQueryTarget(s.targetId); - n.sharedClientState.isActiveQueryTarget(s.targetId) || (await ko(n.localStore, s.targetId, - /*keepPersistedTargetData=*/ - !1).then(() => { - n.sharedClientState.clearQueryState(s.targetId), wu(n.remoteStore, s.targetId), Tc(n, s.targetId); - }).catch(vt)); - } else Tc(n, s.targetId), await ko(n.localStore, s.targetId, - /*keepPersistedTargetData=*/ - !0); -} -/** - * Initiates the write of local mutation batch which involves adding the - * writes to the mutation queue, notifying the remote store about new - * mutations and raising events for any changes this write caused. - * - * The promise returned by this call is resolved when the above steps - * have completed, *not* when the write was acked by the backend. The - * userCallback is resolved once the write was acked/rejected by the - * backend (or failed locally for any other reason). - */ - - -async function fc(t, e, n) { - const s = Bc(t); - - try { - const t = await function (t, e) { - const n = K(t), - s = ut.now(), - i = e.reduce((t, e) => t.add(e.key), gs()); - let r, o; - return n.persistence.runTransaction("Locally write mutations", "readwrite", t => { - // Figure out which keys do not have a remote version in the cache, this - // is needed to create the right overlay mutation: if no remote version - // presents, we do not need to create overlays as patch mutations. - // TODO(Overlay): Is there a better way to determine this? Using the - // document version does not work because local mutations set them back - // to 0. - let u = cs(), - c = gs(); - return n.Gi.getEntries(t, i).next(t => { - u = t, u.forEach((t, e) => { - e.isValidDocument() || (c = c.add(t)); - }); - }).next(() => n.localDocuments.getOverlayedDocuments(t, u)).next(i => { - r = i; // For non-idempotent mutations (such as `FieldValue.increment()`), - // we record the base state in a separate patch mutation. This is - // later used to guarantee consistent values and prevents flicker - // even if the backend sends us an update that already includes our - // transform. - - const o = []; - - for (const t of e) { - const e = jn(t, r.get(t.key).overlayedDocument); - null != e && // NOTE: The base state should only be applied if there's some - // existing document to override, so use a Precondition of - // exists=true - o.push(new Hn(t.key, e, Ne(e.value.mapValue), Ln.exists(!0))); - } - - return n.mutationQueue.addMutationBatch(t, s, o, e); - }).next(e => { - o = e; - const s = e.applyToLocalDocumentSet(r, c); - return n.documentOverlayCache.saveOverlays(t, e.batchId, s); - }); - }).then(() => ({ - batchId: o.batchId, - changes: ls(r) - })); - }(s.localStore, e); - s.sharedClientState.addPendingMutation(t.batchId), function (t, e, n) { - let s = t.ac[t.currentUser.toKey()]; - s || (s = new Gt(it)); - s = s.insert(e, n), t.ac[t.currentUser.toKey()] = s; - } - /** - * Resolves or rejects the user callback for the given batch and then discards - * it. - */ - (s, t.batchId, n), await Pc(s, t.changes), await vu(s.remoteStore); - } catch (t) { - // If we can't persist the mutation, we reject the user callback and - // don't send the mutation. The user can then retry the write. - const e = Uu(t, "Failed to persist write"); - n.reject(e); - } -} -/** - * Applies one remote event to the sync engine, notifying any views of the - * changes, and releasing any pending mutation batches that would become - * visible because of the snapshot version the remote event contains. - */ - - -async function dc(t, e) { - const n = K(t); - - try { - const t = await Do(n.localStore, e); // Update `receivedDocument` as appropriate for any limbo targets. - - e.targetChanges.forEach((t, e) => { - const s = n.uc.get(e); - s && ( // Since this is a limbo resolution lookup, it's for a single document - // and it could be added, modified, or removed, but not a combination. - U(t.addedDocuments.size + t.modifiedDocuments.size + t.removedDocuments.size <= 1), t.addedDocuments.size > 0 ? s.ec = !0 : t.modifiedDocuments.size > 0 ? U(s.ec) : t.removedDocuments.size > 0 && (U(s.ec), s.ec = !1)); - }), await Pc(n, t, e); - } catch (t) { - await vt(t); - } -} -/** - * Applies an OnlineState change to the sync engine and notifies any views of - * the change. - */ - - -function _c(t, e, n) { - const s = K(t); // If we are the secondary client, we explicitly ignore the remote store's - // online state (the local client may go offline, even though the primary - // tab remains online) and only apply the primary tab's online state from - // SharedClientState. - - if (s.isPrimaryClient && 0 - /* RemoteStore */ - === n || !s.isPrimaryClient && 1 - /* SharedClientState */ - === n) { - const t = []; - s.sc.forEach((n, s) => { - const i = s.view.bu(e); - i.snapshot && t.push(i.snapshot); - }), function (t, e) { - const n = K(t); - n.onlineState = e; - let s = !1; - n.queries.forEach((t, n) => { - for (const t of n.listeners) // Run global snapshot listeners if a consistent snapshot has been emitted. - t.bu(e) && (s = !0); - }), s && Yu(n); - }(s.eventManager, e), t.length && s.nc.Wo(t), s.onlineState = e, s.isPrimaryClient && s.sharedClientState.setOnlineState(e); - } -} -/** - * Rejects the listen for the given targetID. This can be triggered by the - * backend for any active target. - * - * @param syncEngine - The sync engine implementation. - * @param targetId - The targetID corresponds to one previously initiated by the - * user as part of TargetData passed to listen() on RemoteStore. - * @param err - A description of the condition that has forced the rejection. - * Nearly always this will be an indication that the user is no longer - * authorized to see the data matching the target. - */ - - -async function wc(t, e, n) { - const s = K(t); // PORTING NOTE: Multi-tab only. - - s.sharedClientState.updateQueryState(e, "rejected", n); - const i = s.uc.get(e), - r = i && i.key; - - if (r) { - // TODO(klimt): We really only should do the following on permission - // denied errors, but we don't have the cause code here. - // It's a limbo doc. Create a synthetic event saying it was deleted. - // This is kind of a hack. Ideally, we would have a method in the local - // store to purge a document. However, it would be tricky to keep all of - // the local store's invariants with another method. - let t = new Gt(dt.comparator); // TODO(b/217189216): This limbo document should ideally have a read time, - // so that it is picked up by any read-time based scans. The backend, - // however, does not send a read time for target removals. - - t = t.insert(r, ke.newNoDocument(r, ct.min())); - const n = gs().add(r), - i = new Is(ct.min(), - /* targetChanges= */ - new Map(), - /* targetMismatches= */ - new Wt(it), t, n); - await dc(s, i), // Since this query failed, we won't want to manually unlisten to it. - // We only remove it from bookkeeping after we successfully applied the - // RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to - // this query when the RemoteStore restarts the Watch stream, which should - // re-trigger the target failure. - s.oc = s.oc.remove(r), s.uc.delete(e), bc(s); - } else await ko(s.localStore, e, - /* keepPersistedTargetData */ - !1).then(() => Tc(s, e, n)).catch(vt); -} - -async function mc(t, e) { - const n = K(t), - s = e.batch.batchId; - - try { - const t = await Vo(n.localStore, e); // The local store may or may not be able to apply the write result and - // raise events immediately (depending on whether the watcher is caught - // up), so we raise user callbacks first so that they consistently happen - // before listen events. - - Ic(n, s, - /*error=*/ - null), pc(n, s), n.sharedClientState.updateMutationState(s, "acknowledged"), await Pc(n, t); - } catch (t) { - await vt(t); - } -} - -async function gc(t, e, n) { - const s = K(t); - - try { - const t = await function (t, e) { - const n = K(t); - return n.persistence.runTransaction("Reject batch", "readwrite-primary", t => { - let s; - return n.mutationQueue.lookupMutationBatch(t, e).next(e => (U(null !== e), s = e.keys(), n.mutationQueue.removeMutationBatch(t, e))).next(() => n.mutationQueue.performConsistencyCheck(t)).next(() => n.documentOverlayCache.removeOverlaysForBatchId(t, s, e)).next(() => n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t, s)).next(() => n.localDocuments.getDocuments(t, s)); - }); - } - /** - * Returns the largest (latest) batch id in mutation queue that is pending - * server response. - * - * Returns `BATCHID_UNKNOWN` if the queue is empty. - */ - (s.localStore, e); // The local store may or may not be able to apply the write result and - // raise events immediately (depending on whether the watcher is caught up), - // so we raise user callbacks first so that they consistently happen before - // listen events. - - Ic(s, e, n), pc(s, e), s.sharedClientState.updateMutationState(e, "rejected", n), await Pc(s, t); - } catch (n) { - await vt(n); - } -} -/** - * Registers a user callback that resolves when all pending mutations at the moment of calling - * are acknowledged . - */ - - -async function yc(t, e) { - const n = K(t); - Iu(n.remoteStore) || O("SyncEngine", "The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled."); - - try { - const t = await function (t) { - const e = K(t); - return e.persistence.runTransaction("Get highest unacknowledged batch id", "readonly", t => e.mutationQueue.getHighestUnacknowledgedBatchId(t)); - }(n.localStore); - if (-1 === t) // Trigger the callback right away if there is no pending writes at the moment. - return void e.resolve(); - const s = n.hc.get(t) || []; - s.push(e), n.hc.set(t, s); - } catch (t) { - const n = Uu(t, "Initialization of waitForPendingWrites() operation failed"); - e.reject(n); - } -} -/** - * Triggers the callbacks that are waiting for this batch id to get acknowledged by server, - * if there are any. - */ - - -function pc(t, e) { - (t.hc.get(e) || []).forEach(t => { - t.resolve(); - }), t.hc.delete(e); -} -/** Reject all outstanding callbacks waiting for pending writes to complete. */ - - -function Ic(t, e, n) { - const s = K(t); - let i = s.ac[s.currentUser.toKey()]; // NOTE: Mutations restored from persistence won't have callbacks, so it's - // okay for there to be no callback for this ID. - - if (i) { - const t = i.get(e); - t && (n ? t.reject(n) : t.resolve(), i = i.remove(e)), s.ac[s.currentUser.toKey()] = i; - } -} - -function Tc(t, e) { - let n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; - t.sharedClientState.removeLocalQueryTarget(e); - - for (const s of t.ic.get(e)) t.sc.delete(s), n && t.nc._c(s, n); - - if (t.ic.delete(e), t.isPrimaryClient) { - t.cc.ls(e).forEach(e => { - t.cc.containsKey(e) || // We removed the last reference for this key - Ec(t, e); - }); - } -} - -function Ec(t, e) { - t.rc.delete(e.path.canonicalString()); // It's possible that the target already got removed because the query failed. In that case, - // the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target. - - const n = t.oc.get(e); - null !== n && (wu(t.remoteStore, n), t.oc = t.oc.remove(e), t.uc.delete(n), bc(t)); -} - -function Ac(t, e, n) { - for (const s of n) if (s instanceof sc) t.cc.addReference(s.key, e), Rc(t, s);else if (s instanceof ic) { - O("SyncEngine", "Document no longer in limbo: " + s.key), t.cc.removeReference(s.key, e); - t.cc.containsKey(s.key) || // We removed the last reference for this key - Ec(t, s.key); - } else L(); -} - -function Rc(t, e) { - const n = e.key, - s = n.path.canonicalString(); - t.oc.get(n) || t.rc.has(s) || (O("SyncEngine", "New document in limbo: " + n), t.rc.add(s), bc(t)); -} -/** - * Starts listens for documents in limbo that are enqueued for resolution, - * subject to a maximum number of concurrent resolutions. - * - * Without bounding the number of concurrent resolutions, the server can fail - * with "resource exhausted" errors which can lead to pathological client - * behavior as seen in https://github.com/firebase/firebase-js-sdk/issues/2683. - */ - - -function bc(t) { - for (; t.rc.size > 0 && t.oc.size < t.maxConcurrentLimboResolutions;) { - const e = t.rc.values().next().value; - t.rc.delete(e); - const n = new dt(ht.fromString(e)), - s = t.lc.next(); - t.uc.set(s, new uc(n)), t.oc = t.oc.insert(n, s), _u(t.remoteStore, new qi(dn(un(n.path)), s, 2 - /* LimboResolution */ - , Lt.at)); - } -} - -async function Pc(t, e, n) { - const s = K(t), - i = [], - r = [], - o = []; - s.sc.isEmpty() || (s.sc.forEach((t, u) => { - o.push(s.dc(u, e, n).then(t => { - if (t) { - s.isPrimaryClient && s.sharedClientState.updateQueryState(u.targetId, t.fromCache ? "not-current" : "current"), i.push(t); - const e = Ao.Ci(u.targetId, t); - r.push(e); - } - })); - }), await Promise.all(o), s.nc.Wo(i), await async function (t, e) { - const n = K(t); - - try { - await n.persistence.runTransaction("notifyLocalViewChanges", "readwrite", t => Vt.forEach(e, e => Vt.forEach(e.Si, s => n.persistence.referenceDelegate.addReference(t, e.targetId, s)).next(() => Vt.forEach(e.Di, s => n.persistence.referenceDelegate.removeReference(t, e.targetId, s))))); - } catch (t) { - if (!Nt(t)) throw t; // If `notifyLocalViewChanges` fails, we did not advance the sequence - // number for the documents that were included in this transaction. - // This might trigger them to be deleted earlier than they otherwise - // would have, but it should not invalidate the integrity of the data. - - O("LocalStore", "Failed to update sequence numbers: " + t); - } - - for (const t of e) { - const e = t.targetId; - - if (!t.fromCache) { - const t = n.Ui.get(e), - s = t.snapshotVersion, - i = t.withLastLimboFreeSnapshotVersion(s); // Advance the last limbo free snapshot version - - n.Ui = n.Ui.insert(e, i); - } - } - }(s.localStore, r)); -} - -async function vc(t, e) { - const n = K(t); - - if (!n.currentUser.isEqual(e)) { - O("SyncEngine", "User change. New user:", e.toKey()); - const t = await vo(n.localStore, e); - n.currentUser = e, // Fails tasks waiting for pending writes requested by previous user. - function (t, e) { - t.hc.forEach(t => { - t.forEach(t => { - t.reject(new Q(G.CANCELLED, e)); - }); - }), t.hc.clear(); - }(n, "'waitForPendingWrites' promise is rejected due to a user change."), // TODO(b/114226417): Consider calling this only in the primary tab. - n.sharedClientState.handleUserChange(e, t.removedBatchIds, t.addedBatchIds), await Pc(n, t.ji); - } -} - -function Vc(t, e) { - const n = K(t), - s = n.uc.get(e); - if (s && s.ec) return gs().add(s.key); - { - let t = gs(); - const s = n.ic.get(e); - if (!s) return t; - - for (const e of s) { - const s = n.sc.get(e); - t = t.unionWith(s.view.Qu); - } - - return t; - } -} -/** - * Reconcile the list of synced documents in an existing view with those - * from persistence. - */ - - -async function Sc(t, e) { - const n = K(t), - s = await Mo(n.localStore, e.query, - /* usePreviousResults= */ - !0), - i = e.view.Zu(s); - return n.isPrimaryClient && Ac(n, e.targetId, i.Yu), i; -} -/** - * Retrieves newly changed documents from remote document cache and raises - * snapshots if needed. - */ -// PORTING NOTE: Multi-Tab only. - - -async function Dc(t, e) { - const n = K(t); - return Fo(n.localStore, e).then(t => Pc(n, t)); -} -/** Applies a mutation state to an existing batch. */ -// PORTING NOTE: Multi-Tab only. - - -async function Cc(t, e, n, s) { - const i = K(t), - r = await function (t, e) { - const n = K(t), - s = K(n.mutationQueue); - return n.persistence.runTransaction("Lookup mutation documents", "readonly", t => s.Tn(t, e).next(e => e ? n.localDocuments.getDocuments(t, e) : Vt.resolve(null))); - } // PORTING NOTE: Multi-Tab only. - (i.localStore, e); - null !== r ? ("pending" === n ? // If we are the primary client, we need to send this write to the - // backend. Secondary clients will ignore these writes since their remote - // connection is disabled. - await vu(i.remoteStore) : "acknowledged" === n || "rejected" === n ? ( // NOTE: Both these methods are no-ops for batches that originated from - // other clients. - Ic(i, e, s || null), pc(i, e), function (t, e) { - K(K(t).mutationQueue).An(e); - } // PORTING NOTE: Multi-Tab only. - (i.localStore, e)) : L(), await Pc(i, r)) : // A throttled tab may not have seen the mutation before it was completed - // and removed from the mutation queue, in which case we won't have cached - // the affected documents. In this case we can safely ignore the update - // since that means we didn't apply the mutation locally at all (if we - // had, we would have cached the affected documents), and so we will just - // see any resulting document changes via normal remote document updates - // as applicable. - O("SyncEngine", "Cannot apply mutation batch with id: " + e); -} -/** Applies a query target change from a different tab. */ -// PORTING NOTE: Multi-Tab only. - - -async function xc(t, e) { - const n = K(t); - - if ($c(n), Bc(n), !0 === e && !0 !== n.fc) { - // Secondary tabs only maintain Views for their local listeners and the - // Views internal state may not be 100% populated (in particular - // secondary tabs don't track syncedDocuments, the set of documents the - // server considers to be in the target). So when a secondary becomes - // primary, we need to need to make sure that all views for all targets - // match the state on disk. - const t = n.sharedClientState.getAllActiveQueryTargets(), - e = await Nc(n, t.toArray()); - n.fc = !0, await Fu(n.remoteStore, !0); - - for (const t of e) _u(n.remoteStore, t); - } else if (!1 === e && !1 !== n.fc) { - const t = []; - let e = Promise.resolve(); - n.ic.forEach((s, i) => { - n.sharedClientState.isLocalQueryTarget(i) ? t.push(i) : e = e.then(() => (Tc(n, i), ko(n.localStore, i, - /*keepPersistedTargetData=*/ - !0))), wu(n.remoteStore, i); - }), await e, await Nc(n, t), // PORTING NOTE: Multi-Tab only. - function (t) { - const e = K(t); - e.uc.forEach((t, n) => { - wu(e.remoteStore, n); - }), e.cc.fs(), e.uc = new Map(), e.oc = new Gt(dt.comparator); - } - /** - * Reconcile the query views of the provided query targets with the state from - * persistence. Raises snapshots for any changes that affect the local - * client and returns the updated state of all target's query data. - * - * @param syncEngine - The sync engine implementation - * @param targets - the list of targets with views that need to be recomputed - * @param transitionToPrimary - `true` iff the tab transitions from a secondary - * tab to a primary tab - */ - // PORTING NOTE: Multi-Tab only. - (n), n.fc = !1, await Fu(n.remoteStore, !1); - } -} - -async function Nc(t, e, n) { - const s = K(t), - i = [], - r = []; - - for (const t of e) { - let e; - const n = s.ic.get(t); - - if (n && 0 !== n.length) { - // For queries that have a local View, we fetch their current state - // from LocalStore (as the resume token and the snapshot version - // might have changed) and reconcile their views with the persisted - // state (the list of syncedDocuments may have gotten out of sync). - e = await No(s.localStore, dn(n[0])); - - for (const t of n) { - const e = s.sc.get(t), - n = await Sc(s, e); - n.snapshot && r.push(n.snapshot); - } - } else { - // For queries that never executed on this client, we need to - // allocate the target in LocalStore and initialize a new View. - const n = await Oo(s.localStore, t); - e = await No(s.localStore, n), await hc(s, kc(n), t, - /*current=*/ - !1); - } - - i.push(e); - } - - return s.nc.Wo(r), i; -} -/** - * Creates a `Query` object from the specified `Target`. There is no way to - * obtain the original `Query`, so we synthesize a `Query` from the `Target` - * object. - * - * The synthesized result might be different from the original `Query`, but - * since the synthesized `Query` should return the same results as the - * original one (only the presentation of results might differ), the potential - * difference will not cause issues. - */ -// PORTING NOTE: Multi-Tab only. - - -function kc(t) { - return on(t.path, t.collectionGroup, t.orderBy, t.filters, t.limit, "F" - /* First */ - , t.startAt, t.endAt); -} -/** Returns the IDs of the clients that are currently active. */ -// PORTING NOTE: Multi-Tab only. - - -function Mc(t) { - const e = K(t); - return K(K(e.localStore).persistence).vi(); -} -/** Applies a query target change from a different tab. */ -// PORTING NOTE: Multi-Tab only. - - -async function Oc(t, e, n, s) { - const i = K(t); - if (i.fc) // If we receive a target state notification via WebStorage, we are - // either already secondary or another tab has taken the primary lease. - return void O("SyncEngine", "Ignoring unexpected query state notification."); - const r = i.ic.get(e); - if (r && r.length > 0) switch (n) { - case "current": - case "not-current": - { - const t = await Fo(i.localStore, pn(r[0])), - s = Is.createSynthesizedRemoteEventForCurrentChange(e, "current" === n); - await Pc(i, t, s); - break; - } - - case "rejected": - await ko(i.localStore, e, - /* keepPersistedTargetData */ - !0), Tc(i, e, s); - break; - - default: - L(); - } -} -/** Adds or removes Watch targets for queries from different tabs. */ - - -async function Fc(t, e, n) { - const s = $c(t); - - if (s.fc) { - for (const t of e) { - if (s.ic.has(t)) { - // A target might have been added in a previous attempt - O("SyncEngine", "Adding an already active target " + t); - continue; - } - - const e = await Oo(s.localStore, t), - n = await No(s.localStore, e); - await hc(s, kc(e), n.targetId, - /*current=*/ - !1), _u(s.remoteStore, n); - } - - for (const t of n) // Check that the target is still active since the target might have been - // removed if it has been rejected by the backend. - s.ic.has(t) && ( // Release queries that are still active. - await ko(s.localStore, t, - /* keepPersistedTargetData */ - !1).then(() => { - wu(s.remoteStore, t), Tc(s, t); - }).catch(vt)); - } -} - -function $c(t) { - const e = K(t); - return e.remoteStore.remoteSyncer.applyRemoteEvent = dc.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget = Vc.bind(null, e), e.remoteStore.remoteSyncer.rejectListen = wc.bind(null, e), e.nc.Wo = Hu.bind(null, e.eventManager), e.nc._c = Ju.bind(null, e.eventManager), e; -} - -function Bc(t) { - const e = K(t); - return e.remoteStore.remoteSyncer.applySuccessfulWrite = mc.bind(null, e), e.remoteStore.remoteSyncer.rejectFailedWrite = gc.bind(null, e), e; -} -/** - * Loads a Firestore bundle into the SDK. The returned promise resolves when - * the bundle finished loading. - * - * @param syncEngine - SyncEngine to use. - * @param bundleReader - Bundle to load into the SDK. - * @param task - LoadBundleTask used to update the loading progress to public API. - */ - - -function Lc(t, e, n) { - const s = K(t); // eslint-disable-next-line @typescript-eslint/no-floating-promises - - ( - /** Loads a bundle and returns the list of affected collection groups. */ - async function (t, e, n) { - try { - const s = await e.getMetadata(); - if (await function (t, e) { - const n = K(t), - s = Ms(e.createTime); - return n.persistence.runTransaction("hasNewerBundle", "readonly", t => n.Ns.getBundleMetadata(t, e.id)).then(t => !!t && t.createTime.compareTo(s) >= 0); - } - /** - * Saves the given `BundleMetadata` to local persistence. - */ - (t.localStore, s)) return await e.close(), n._completeWith(function (t) { - return { - taskState: "Success", - documentsLoaded: t.totalDocuments, - bytesLoaded: t.totalBytes, - totalDocuments: t.totalDocuments, - totalBytes: t.totalBytes - }; - }(s)), Promise.resolve(new Set()); - - n._updateProgress(nc(s)); - - const i = new ec(s, t.localStore, e.It); - let r = await e.wc(); - - for (; r;) { - const t = await i.Ou(r); - t && n._updateProgress(t), r = await e.wc(); - } - - const o = await i.complete(); - return await Pc(t, o.Bu, - /* remoteEvent */ - void 0), // Save metadata, so loading the same bundle will skip. - await function (t, e) { - const n = K(t); - return n.persistence.runTransaction("Save bundle", "readwrite", t => n.Ns.saveBundleMetadata(t, e)); - } - /** - * Returns a promise of a `NamedQuery` associated with given query name. Promise - * resolves to undefined if no persisted data can be found. - */ - (t.localStore, s), n._completeWith(o.progress), Promise.resolve(o.$u); - } catch (t) { - return $("SyncEngine", `Loading bundle failed with ${t}`), n._failWith(t), Promise.resolve(new Set()); - } - } - /** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - /** - * Provides all components needed for Firestore with in-memory persistence. - * Uses EagerGC garbage collection. - */ - )(s, e, n).then(t => { - s.sharedClientState.notifyBundleLoaded(t); - }); -} - -class Uc { - constructor() { - this.synchronizeTabs = !1; - } - - async initialize(t) { - this.It = iu(t.databaseInfo.databaseId), this.sharedClientState = this.mc(t), this.persistence = this.gc(t), await this.persistence.start(), this.localStore = this.yc(t), this.gcScheduler = this.Ic(t, this.localStore), this.indexBackfillerScheduler = this.Tc(t, this.localStore); - } - - Ic(t, e) { - return null; - } - - Tc(t, e) { - return null; - } - - yc(t) { - return Po(this.persistence, new Ro(), t.initialUser, this.It); - } - - gc(t) { - return new fo(wo.Bs, this.It); - } - - mc(t) { - return new Jo(); - } - - async terminate() { - this.gcScheduler && this.gcScheduler.stop(), await this.sharedClientState.shutdown(), await this.persistence.shutdown(); - } - -} -/** - * Provides all components needed for Firestore with IndexedDB persistence. - */ - - -class qc extends Uc { - constructor(t, e, n) { - super(), this.Ec = t, this.cacheSizeBytes = e, this.forceOwnership = n, this.synchronizeTabs = !1; - } - - async initialize(t) { - await super.initialize(t), await this.Ec.initialize(this, t), // Enqueue writes from a previous session - await Bc(this.Ec.syncEngine), await vu(this.Ec.remoteStore), // NOTE: This will immediately call the listener, so we make sure to - // set it after localStore / remoteStore are started. - await this.persistence.li(() => (this.gcScheduler && !this.gcScheduler.started && this.gcScheduler.start(), this.indexBackfillerScheduler && !this.indexBackfillerScheduler.started && this.indexBackfillerScheduler.start(), Promise.resolve())); - } - - yc(t) { - return Po(this.persistence, new Ro(), t.initialUser, this.It); - } - - Ic(t, e) { - const n = this.persistence.referenceDelegate.garbageCollector; - return new Kr(n, t.asyncQueue, e); - } - - Tc(t, e) { - const n = new Bt(e, this.persistence); - return new $t(t.asyncQueue, n); - } - - gc(t) { - const e = Eo(t.databaseInfo.databaseId, t.databaseInfo.persistenceKey), - n = void 0 !== this.cacheSizeBytes ? Vr.withCacheSize(this.cacheSizeBytes) : Vr.DEFAULT; - return new po(this.synchronizeTabs, e, t.clientId, n, t.asyncQueue, nu(), su(), this.It, this.sharedClientState, !!this.forceOwnership); - } - - mc(t) { - return new Jo(); - } - -} -/** - * Provides all components needed for Firestore with multi-tab IndexedDB - * persistence. - * - * In the legacy client, this provider is used to provide both multi-tab and - * non-multi-tab persistence since we cannot tell at build time whether - * `synchronizeTabs` will be enabled. - */ - - -class Kc extends qc { - constructor(t, e) { - super(t, e, - /* forceOwnership= */ - !1), this.Ec = t, this.cacheSizeBytes = e, this.synchronizeTabs = !0; - } - - async initialize(t) { - await super.initialize(t); - const e = this.Ec.syncEngine; - this.sharedClientState instanceof Ho && (this.sharedClientState.syncEngine = { - Fr: Cc.bind(null, e), - $r: Oc.bind(null, e), - Br: Fc.bind(null, e), - vi: Mc.bind(null, e), - Or: Dc.bind(null, e) - }, await this.sharedClientState.start()), // NOTE: This will immediately call the listener, so we make sure to - // set it after localStore / remoteStore are started. - await this.persistence.li(async t => { - await xc(this.Ec.syncEngine, t), this.gcScheduler && (t && !this.gcScheduler.started ? this.gcScheduler.start() : t || this.gcScheduler.stop()), this.indexBackfillerScheduler && (t && !this.indexBackfillerScheduler.started ? this.indexBackfillerScheduler.start() : t || this.indexBackfillerScheduler.stop()); - }); - } - - mc(t) { - const e = nu(); - if (!Ho.C(e)) throw new Q(G.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage."); - const n = Eo(t.databaseInfo.databaseId, t.databaseInfo.persistenceKey); - return new Ho(e, t.asyncQueue, n, t.clientId, t.initialUser); - } - -} -/** - * Initializes and wires the components that are needed to interface with the - * network. - */ - - -class Gc { - async initialize(t, e) { - this.localStore || (this.localStore = t.localStore, this.sharedClientState = t.sharedClientState, this.datastore = this.createDatastore(e), this.remoteStore = this.createRemoteStore(e), this.eventManager = this.createEventManager(e), this.syncEngine = this.createSyncEngine(e, - /* startAsPrimary=*/ - !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t => _c(this.syncEngine, t, 1 - /* SharedClientState */ - ), this.remoteStore.remoteSyncer.handleCredentialChange = vc.bind(null, this.syncEngine), await Fu(this.remoteStore, this.syncEngine.isPrimaryClient)); - } - - createEventManager(t) { - return new ju(); - } - - createDatastore(t) { - const e = iu(t.databaseInfo.databaseId), - n = (s = t.databaseInfo, new eu(s)); - var s; - /** Return the Platform-specific connectivity monitor. */ - - return function (t, e, n, s) { - return new au(t, e, n, s); - }(t.authCredentials, t.appCheckCredentials, n, e); - } - - createRemoteStore(t) { - return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t => _c(this.syncEngine, t, 0 - /* RemoteStore */ - ), r = Xo.C() ? new Xo() : new Yo(), new lu(e, n, s, i, r); - var e, n, s, i, r; - /** Re-enables the network. Idempotent. */ - } - - createSyncEngine(t, e) { - return function (t, e, n, // PORTING NOTE: Manages state synchronization in multi-tab environments. - s, i, r, o) { - const u = new cc(t, e, n, s, i, r); - return o && (u.fc = !0), u; - }(this.localStore, this.remoteStore, this.eventManager, this.sharedClientState, t.initialUser, t.maxConcurrentLimboResolutions, e); - } - - terminate() { - return async function (t) { - const e = K(t); - O("RemoteStore", "RemoteStore shutting down."), e._u.add(5 - /* Shutdown */ - ), await du(e), e.mu.shutdown(), // Set the OnlineState to Unknown (rather than Offline) to avoid potentially - // triggering spurious listener events with cached data, etc. - e.gu.set("Unknown" - /* Unknown */ - ); - }(this.remoteStore); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * How many bytes to read each time when `ReadableStreamReader.read()` is - * called. Only applicable for byte streams that we control (e.g. those backed - * by an UInt8Array). - */ - -/** - * Builds a `ByteStreamReader` from a UInt8Array. - * @param source - The data source to use. - * @param bytesPerRead - How many bytes each `read()` from the returned reader - * will read. - */ - - -function Qc(t) { - let e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10240; - let n = 0; // The TypeScript definition for ReadableStreamReader changed. We use - // `any` here to allow this code to compile with different versions. - // See https://github.com/microsoft/TypeScript/issues/42970 - // eslint-disable-next-line @typescript-eslint/no-explicit-any - - return { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - async read() { - if (n < t.byteLength) { - const s = { - value: t.slice(n, n + e), - done: !1 - }; - return n += e, s; - } - - return { - done: !0 - }; - }, - - async cancel() {}, - - releaseLock() {}, - - closed: Promise.reject("unimplemented") - }; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * On web, a `ReadableStream` is wrapped around by a `ByteStreamReader`. - */ - -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * A wrapper implementation of Observer that will dispatch events - * asynchronously. To allow immediate silencing, a mute call is added which - * causes events scheduled to no longer be raised. - */ - - -class jc { - constructor(t) { - this.observer = t, - /** - * When set to true, will not raise future events. Necessary to deal with - * async detachment of listener. - */ - this.muted = !1; - } - - next(t) { - this.observer.next && this.Ac(this.observer.next, t); - } - - error(t) { - this.observer.error ? this.Ac(this.observer.error, t) : F("Uncaught Error in snapshot listener:", t); - } - - Rc() { - this.muted = !0; - } - - Ac(t, e) { - this.muted || setTimeout(() => { - this.muted || t(e); - }, 0); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A class representing a bundle. - * - * Takes a bundle stream or buffer, and presents abstractions to read bundled - * elements out of the underlying content. - */ - - -class Wc { - constructor( - /** The reader to read from underlying binary bundle data source. */ - t, e) { - this.bc = t, this.It = e, - /** Cached bundle metadata. */ - this.metadata = new j(), - /** - * Internal buffer to hold bundle content, accumulating incomplete element - * content. - */ - this.buffer = new Uint8Array(), this.Pc = new TextDecoder("utf-8"), // Read the metadata (which is the first element). - this.vc().then(t => { - t && t.ku() ? this.metadata.resolve(t.payload.metadata) : this.metadata.reject(new Error(`The first element of the bundle is not a metadata, it is\n ${JSON.stringify(null == t ? void 0 : t.payload)}`)); - }, t => this.metadata.reject(t)); - } - - close() { - return this.bc.cancel(); - } - - async getMetadata() { - return this.metadata.promise; - } - - async wc() { - // Makes sure metadata is read before proceeding. - return await this.getMetadata(), this.vc(); - } - /** - * Reads from the head of internal buffer, and pulling more data from - * underlying stream if a complete element cannot be found, until an - * element(including the prefixed length and the JSON string) is found. - * - * Once a complete element is read, it is dropped from internal buffer. - * - * Returns either the bundled element, or null if we have reached the end of - * the stream. - */ - - - async vc() { - const t = await this.Vc(); - if (null === t) return null; - const e = this.Pc.decode(t), - n = Number(e); - isNaN(n) && this.Sc(`length string (${e}) is not valid number`); - const s = await this.Dc(n); - return new Zu(JSON.parse(s), t.length + n); - } - /** First index of '{' from the underlying buffer. */ - - - Cc() { - return this.buffer.findIndex(t => t === "{".charCodeAt(0)); - } - /** - * Reads from the beginning of the internal buffer, until the first '{', and - * return the content. - * - * If reached end of the stream, returns a null. - */ - - - async Vc() { - for (; this.Cc() < 0;) { - if (await this.xc()) break; - } // Broke out of the loop because underlying stream is closed, and there - // happens to be no more data to process. - - - if (0 === this.buffer.length) return null; - const t = this.Cc(); // Broke out of the loop because underlying stream is closed, but still - // cannot find an open bracket. - - t < 0 && this.Sc("Reached the end of bundle when a length string is expected."); - const e = this.buffer.slice(0, t); // Update the internal buffer to drop the read length. - - return this.buffer = this.buffer.slice(t), e; - } - /** - * Reads from a specified position from the internal buffer, for a specified - * number of bytes, pulling more data from the underlying stream if needed. - * - * Returns a string decoded from the read bytes. - */ - - - async Dc(t) { - for (; this.buffer.length < t;) { - (await this.xc()) && this.Sc("Reached the end of bundle when more is expected."); - } - - const e = this.Pc.decode(this.buffer.slice(0, t)); // Update the internal buffer to drop the read json string. - - return this.buffer = this.buffer.slice(t), e; - } - - Sc(t) { - // eslint-disable-next-line @typescript-eslint/no-floating-promises - throw this.bc.cancel(), new Error(`Invalid bundle format: ${t}`); - } - /** - * Pulls more data from underlying stream to internal buffer. - * Returns a boolean indicating whether the stream is finished. - */ - - - async xc() { - const t = await this.bc.read(); - - if (!t.done) { - const e = new Uint8Array(this.buffer.length + t.value.length); - e.set(this.buffer), e.set(t.value, this.buffer.length), this.buffer = e; - } - - return t.done; - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Internal transaction object responsible for accumulating the mutations to - * perform and the base versions for any documents read. - */ - - -class zc { - constructor(t) { - this.datastore = t, // The version of each document that was read during this transaction. - this.readVersions = new Map(), this.mutations = [], this.committed = !1, - /** - * A deferred usage error that occurred previously in this transaction that - * will cause the transaction to fail once it actually commits. - */ - this.lastWriteError = null, - /** - * Set of documents that have been written in the transaction. - * - * When there's more than one write to the same key in a transaction, any - * writes after the first are handled differently. - */ - this.writtenDocs = new Set(); - } - - async lookup(t) { - if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new Q(G.INVALID_ARGUMENT, "Firestore transactions require all reads to be executed before all writes."); - const e = await async function (t, e) { - const n = K(t), - s = qs(n.It) + "/documents", - i = { - documents: e.map(t => $s(n.It, t)) - }, - r = await n.fo("BatchGetDocuments", s, i, e.length), - o = new Map(); - r.forEach(t => { - const e = js(n.It, t); - o.set(e.key.toString(), e); - }); - const u = []; - return e.forEach(t => { - const e = o.get(t.toString()); - U(!!e), u.push(e); - }), u; - }(this.datastore, t); - return e.forEach(t => this.recordVersion(t)), e; - } - - set(t, e) { - this.write(e.toMutation(t, this.precondition(t))), this.writtenDocs.add(t.toString()); - } - - update(t, e) { - try { - this.write(e.toMutation(t, this.preconditionForUpdate(t))); - } catch (t) { - this.lastWriteError = t; - } - - this.writtenDocs.add(t.toString()); - } - - delete(t) { - this.write(new Zn(t, this.precondition(t))), this.writtenDocs.add(t.toString()); - } - - async commit() { - if (this.ensureCommitNotCalled(), this.lastWriteError) throw this.lastWriteError; - const t = this.readVersions; // For each mutation, note that the doc was written. - - this.mutations.forEach(e => { - t.delete(e.key.toString()); - }), // For each document that was read but not written to, we want to perform - // a `verify` operation. - t.forEach((t, e) => { - const n = dt.fromPath(e); - this.mutations.push(new ts(n, this.precondition(n))); - }), await async function (t, e) { - const n = K(t), - s = qs(n.It) + "/documents", - i = { - writes: e.map(t => zs(n.It, t)) - }; - await n.co("Commit", s, i); - }(this.datastore, this.mutations), this.committed = !0; - } - - recordVersion(t) { - let e; - if (t.isFoundDocument()) e = t.version;else { - if (!t.isNoDocument()) throw L(); // Represent a deleted doc using SnapshotVersion.min(). - - e = ct.min(); - } - const n = this.readVersions.get(t.key.toString()); - - if (n) { - if (!e.isEqual(n)) // This transaction will fail no matter what. - throw new Q(G.ABORTED, "Document version changed between two reads."); - } else this.readVersions.set(t.key.toString(), e); - } - /** - * Returns the version of this document when it was read in this transaction, - * as a precondition, or no precondition if it was not read. - */ - - - precondition(t) { - const e = this.readVersions.get(t.toString()); - return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(ct.min()) ? Ln.exists(!1) : Ln.updateTime(e) : Ln.none(); - } - /** - * Returns the precondition for a document if the operation is an update. - */ - - - preconditionForUpdate(t) { - const e = this.readVersions.get(t.toString()); // The first time a document is written, we want to take into account the - // read time and existence - - if (!this.writtenDocs.has(t.toString()) && e) { - if (e.isEqual(ct.min())) // The document doesn't exist, so fail the transaction. - // This has to be validated locally because you can't send a - // precondition that a document does not exist without changing the - // semantics of the backend write to be an insert. This is the reverse - // of what we want, since we want to assert that the document doesn't - // exist but then send the update and have it fail. Since we can't - // express that to the backend, we have to validate locally. - // Note: this can change once we can send separate verify writes in the - // transaction. - throw new Q(G.INVALID_ARGUMENT, "Can't update a document that doesn't exist."); // Document exists, base precondition on document update time. - - return Ln.updateTime(e); - } // Document was not read, so we just use the preconditions for a blind - // update. - - - return Ln.exists(!0); - } - - write(t) { - this.ensureCommitNotCalled(), this.mutations.push(t); - } - - ensureCommitNotCalled() {} - -} -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * TransactionRunner encapsulates the logic needed to run and retry transactions - * with backoff. - */ - - -class Hc { - constructor(t, e, n, s, i) { - this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = s, this.deferred = i, this.Nc = n.maxAttempts, this.xo = new ru(this.asyncQueue, "transaction_retry" - /* TransactionRetry */ - ); - } - /** Runs the transaction and sets the result on deferred. */ - - - run() { - this.Nc -= 1, this.kc(); - } - - kc() { - this.xo.Ao(async () => { - const t = new zc(this.datastore), - e = this.Mc(t); - e && e.then(e => { - this.asyncQueue.enqueueAndForget(() => t.commit().then(() => { - this.deferred.resolve(e); - }).catch(t => { - this.Oc(t); - })); - }).catch(t => { - this.Oc(t); - }); - }); - } - - Mc(t) { - try { - const e = this.updateFunction(t); - return !ce(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")), null); - } catch (t) { - // Do not retry errors thrown by user provided updateFunction. - return this.deferred.reject(t), null; - } - } - - Oc(t) { - this.Nc > 0 && this.Fc(t) ? (this.Nc -= 1, this.asyncQueue.enqueueAndForget(() => (this.kc(), Promise.resolve()))) : this.deferred.reject(t); - } - - Fc(t) { - if ("FirebaseError" === t.name) { - // In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and - // non-matching document versions with ABORTED. These errors should be retried. - const e = t.code; - return "aborted" === e || "failed-precondition" === e || !is(e); - } - - return !1; - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * FirestoreClient is a top-level class that constructs and owns all of the - * pieces of the client SDK architecture. It is responsible for creating the - * async queue that is shared by all of the other components in the system. - */ - - -class Jc { - constructor(t, e, - /** - * Asynchronous queue responsible for all of our internal processing. When - * we get incoming work from the user (via public API) or the network - * (incoming GRPC messages), we should always schedule onto this queue. - * This ensures all of our work is properly serialized (e.g. we don't - * start processing a new operation while the previous one is waiting for - * an async I/O to complete). - */ - n, s) { - this.authCredentials = t, this.appCheckCredentials = e, this.asyncQueue = n, this.databaseInfo = s, this.user = C.UNAUTHENTICATED, this.clientId = st.R(), this.authCredentialListener = () => Promise.resolve(), this.appCheckCredentialListener = () => Promise.resolve(), this.authCredentials.start(n, async t => { - O("FirestoreClient", "Received user=", t.uid), await this.authCredentialListener(t), this.user = t; - }), this.appCheckCredentials.start(n, t => (O("FirestoreClient", "Received new app check token=", t), this.appCheckCredentialListener(t, this.user))); - } - - async getConfiguration() { - return { - asyncQueue: this.asyncQueue, - databaseInfo: this.databaseInfo, - clientId: this.clientId, - authCredentials: this.authCredentials, - appCheckCredentials: this.appCheckCredentials, - initialUser: this.user, - maxConcurrentLimboResolutions: 100 - }; - } - - setCredentialChangeListener(t) { - this.authCredentialListener = t; - } - - setAppCheckTokenChangeListener(t) { - this.appCheckCredentialListener = t; - } - /** - * Checks that the client has not been terminated. Ensures that other methods on - * this class cannot be called after the client is terminated. - */ - - - verifyNotTerminated() { - if (this.asyncQueue.isShuttingDown) throw new Q(G.FAILED_PRECONDITION, "The client has already been terminated."); - } - - terminate() { - this.asyncQueue.enterRestrictedMode(); - const t = new j(); - return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async () => { - try { - this.onlineComponents && (await this.onlineComponents.terminate()), this.offlineComponents && (await this.offlineComponents.terminate()), // The credentials provider must be terminated after shutting down the - // RemoteStore as it will prevent the RemoteStore from retrieving auth - // tokens. - this.authCredentials.shutdown(), this.appCheckCredentials.shutdown(), t.resolve(); - } catch (e) { - const n = Uu(e, "Failed to shutdown persistence"); - t.reject(n); - } - }), t.promise; - } - -} - -async function Yc(t, e) { - t.asyncQueue.verifyOperationInProgress(), O("FirestoreClient", "Initializing OfflineComponentProvider"); - const n = await t.getConfiguration(); - await e.initialize(n); - let s = n.initialUser; - t.setCredentialChangeListener(async t => { - s.isEqual(t) || (await vo(e.localStore, t), s = t); - }), // When a user calls clearPersistence() in one client, all other clients - // need to be terminated to allow the delete to succeed. - e.persistence.setDatabaseDeletedListener(() => t.terminate()), t.offlineComponents = e; -} - -async function Xc(t, e) { - t.asyncQueue.verifyOperationInProgress(); - const n = await Zc(t); - O("FirestoreClient", "Initializing OnlineComponentProvider"); - const s = await t.getConfiguration(); - await e.initialize(n, s), // The CredentialChangeListener of the online component provider takes - // precedence over the offline component provider. - t.setCredentialChangeListener(t => Ou(e.remoteStore, t)), t.setAppCheckTokenChangeListener((t, n) => Ou(e.remoteStore, n)), t.onlineComponents = e; -} - -async function Zc(t) { - return t.offlineComponents || (O("FirestoreClient", "Using default OfflineComponentProvider"), await Yc(t, new Uc())), t.offlineComponents; -} - -async function ta(t) { - return t.onlineComponents || (O("FirestoreClient", "Using default OnlineComponentProvider"), await Xc(t, new Gc())), t.onlineComponents; -} - -function ea(t) { - return Zc(t).then(t => t.persistence); -} - -function na(t) { - return Zc(t).then(t => t.localStore); -} - -function sa(t) { - return ta(t).then(t => t.remoteStore); -} - -function ia(t) { - return ta(t).then(t => t.syncEngine); -} - -async function ra(t) { - const e = await ta(t), - n = e.eventManager; - return n.onListen = ac.bind(null, e.syncEngine), n.onUnlisten = lc.bind(null, e.syncEngine), n; -} -/** Enables the network connection and re-enqueues all pending operations. */ - - -function oa(t) { - return t.asyncQueue.enqueue(async () => { - const e = await ea(t), - n = await sa(t); - return e.setNetworkEnabled(!0), function (t) { - const e = K(t); - return e._u.delete(0 - /* UserDisabled */ - ), fu(e); - }(n); - }); -} -/** Disables the network connection. Pending operations will not complete. */ - - -function ua(t) { - return t.asyncQueue.enqueue(async () => { - const e = await ea(t), - n = await sa(t); - return e.setNetworkEnabled(!1), async function (t) { - const e = K(t); - e._u.add(0 - /* UserDisabled */ - ), await du(e), // Set the OnlineState to Offline so get()s return from cache, etc. - e.gu.set("Offline" - /* Offline */ - ); - }(n); - }); -} -/** - * Returns a Promise that resolves when all writes that were pending at the time - * this method was called received server acknowledgement. An acknowledgement - * can be either acceptance or rejection. - */ - - -function ca(t, e) { - const n = new j(); - return t.asyncQueue.enqueueAndForget(async () => async function (t, e, n) { - try { - const s = await function (t, e) { - const n = K(t); - return n.persistence.runTransaction("read document", "readonly", t => n.localDocuments.getDocument(t, e)); - }(t, e); - s.isFoundDocument() ? n.resolve(s) : s.isNoDocument() ? n.resolve(null) : n.reject(new Q(G.UNAVAILABLE, "Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)")); - } catch (t) { - const s = Uu(t, `Failed to get document '${e} from cache`); - n.reject(s); - } - } - /** - * Retrieves a latency-compensated document from the backend via a - * SnapshotListener. - */ - (await na(t), e, n)), n.promise; -} - -function aa(t, e) { - let n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - const s = new j(); - return t.asyncQueue.enqueueAndForget(async () => function (t, e, n, s, i) { - const r = new jc({ - next: r => { - // Remove query first before passing event to user to avoid - // user actions affecting the now stale query. - e.enqueueAndForget(() => zu(t, o)); - const u = r.docs.has(n); - !u && r.fromCache ? // TODO(dimond): If we're online and the document doesn't - // exist then we resolve with a doc.exists set to false. If - // we're offline however, we reject the Promise in this - // case. Two options: 1) Cache the negative response from - // the server so we can deliver that even when you're - // offline 2) Actually reject the Promise in the online case - // if the document doesn't exist. - i.reject(new Q(G.UNAVAILABLE, "Failed to get document because the client is offline.")) : u && r.fromCache && s && "server" === s.source ? i.reject(new Q(G.UNAVAILABLE, 'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')) : i.resolve(r); - }, - error: t => i.reject(t) - }), - o = new Xu(un(n.path), r, { - includeMetadataChanges: !0, - Nu: !0 - }); - return Wu(t, o); - }(await ra(t), t.asyncQueue, e, n, s)), s.promise; -} - -function ha(t, e) { - const n = new j(); - return t.asyncQueue.enqueueAndForget(async () => async function (t, e, n) { - try { - const s = await Mo(t, e, - /* usePreviousResults= */ - !0), - i = new rc(e, s.Hi), - r = i.ju(s.documents), - o = i.applyChanges(r, - /* updateLimboDocuments= */ - !1); - n.resolve(o.snapshot); - } catch (t) { - const s = Uu(t, `Failed to execute query '${e} against cache`); - n.reject(s); - } - } - /** - * Retrieves a latency-compensated query snapshot from the backend via a - * SnapshotListener. - */ - (await na(t), e, n)), n.promise; -} - -function la(t, e) { - let n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - const s = new j(); - return t.asyncQueue.enqueueAndForget(async () => function (t, e, n, s, i) { - const r = new jc({ - next: n => { - // Remove query first before passing event to user to avoid - // user actions affecting the now stale query. - e.enqueueAndForget(() => zu(t, o)), n.fromCache && "server" === s.source ? i.reject(new Q(G.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: t => i.reject(t) - }), - o = new Xu(n, r, { - includeMetadataChanges: !0, - Nu: !0 - }); - return Wu(t, o); - }(await ra(t), t.asyncQueue, e, n, s)), s.promise; -} - -function fa(t, e) { - const n = new jc(e); - return t.asyncQueue.enqueueAndForget(async () => function (t, e) { - K(t).Ru.add(e), // Immediately fire an initial event, indicating all existing listeners - // are in-sync. - e.next(); - }(await ra(t), n)), () => { - n.Rc(), t.asyncQueue.enqueueAndForget(async () => function (t, e) { - K(t).Ru.delete(e); - }(await ra(t), n)); - }; -} -/** - * Takes an updateFunction in which a set of reads and writes can be performed - * atomically. In the updateFunction, the client can read and write values - * using the supplied transaction object. After the updateFunction, all - * changes will be committed. If a retryable error occurs (ex: some other - * client has changed any of the data referenced), then the updateFunction - * will be called again after a backoff. If the updateFunction still fails - * after all retries, then the transaction will be rejected. - * - * The transaction object passed to the updateFunction contains methods for - * accessing documents and collections. Unlike other datastore access, data - * accessed with the transaction will not reflect local changes that have not - * been committed. For this reason, it is required that all reads are - * performed before any writes. Transactions must be performed while online. - */ - - -function da(t, e, n) { - const s = new j(); - return t.asyncQueue.enqueueAndForget(async () => { - const i = await function (t) { - return ta(t).then(t => t.datastore); - }(t); - new Hc(t.asyncQueue, i, n, e, s).run(); - }), s.promise; -} - -function _a(t, e, n, s) { - const i = function (t, e) { - let n; - n = "string" == typeof t ? new TextEncoder().encode(t) : t; - return function (t, e) { - return new Wc(t, e); - }(function (t, e) { - if (t instanceof Uint8Array) return Qc(t, e); - if (t instanceof ArrayBuffer) return Qc(new Uint8Array(t), e); - if (t instanceof ReadableStream) return t.getReader(); - throw new Error("Source of `toByteStreamReader` has to be a ArrayBuffer or ReadableStream"); - }(n), e); - } - /** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - (n, iu(e)); - - t.asyncQueue.enqueueAndForget(async () => { - Lc(await ia(t), i, s); - }); -} - -function wa(t, e) { - return t.asyncQueue.enqueue(async () => function (t, e) { - const n = K(t); - return n.persistence.runTransaction("Get named query", "readonly", t => n.Ns.getNamedQuery(t, e)); - }(await na(t), e)); -} - -const ma = new Map(); -/** - * An instance map that ensures only one Datastore exists per Firestore - * instance. - */ - -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function ga(t, e, n) { - if (!n) throw new Q(G.INVALID_ARGUMENT, `Function ${t}() cannot be called with an empty ${e}.`); -} -/** - * Validates that two boolean options are not set at the same time. - * @internal - */ - - -function ya(t, e, n, s) { - if (!0 === e && !0 === s) throw new Q(G.INVALID_ARGUMENT, `${t} and ${n} cannot be used together.`); -} -/** - * Validates that `path` refers to a document (indicated by the fact it contains - * an even numbers of segments). - */ - - -function pa(t) { - if (!dt.isDocumentKey(t)) throw new Q(G.INVALID_ARGUMENT, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`); -} -/** - * Validates that `path` refers to a collection (indicated by the fact it - * contains an odd numbers of segments). - */ - - -function Ia(t) { - if (dt.isDocumentKey(t)) throw new Q(G.INVALID_ARGUMENT, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`); -} -/** - * Returns true if it's a non-null object without a custom prototype - * (i.e. excludes Array, Date, etc.). - */ - -/** Returns a string describing the type / value of the provided input. */ - - -function Ta(t) { - if (void 0 === t) return "undefined"; - if (null === t) return "null"; - if ("string" == typeof t) return t.length > 20 && (t = `${t.substring(0, 20)}...`), JSON.stringify(t); - if ("number" == typeof t || "boolean" == typeof t) return "" + t; - - if ("object" == typeof t) { - if (t instanceof Array) return "an array"; - { - const e = - /** try to get the constructor name for an object. */ - function (t) { - if (t.constructor) return t.constructor.name; - return null; - } - /** - * Casts `obj` to `T`, optionally unwrapping Compat types to expose the - * underlying instance. Throws if `obj` is not an instance of `T`. - * - * This cast is used in the Lite and Full SDK to verify instance types for - * arguments passed to the public API. - * @internal - */ - (t); - - return e ? `a custom ${e} object` : "an object"; - } - } - - return "function" == typeof t ? "a function" : L(); -} - -function Ea(t, // eslint-disable-next-line @typescript-eslint/no-explicit-any -e) { - if ("_delegate" in t && ( // Unwrap Compat types - // eslint-disable-next-line @typescript-eslint/no-explicit-any - t = t._delegate), !(t instanceof e)) { - if (e.name === t.constructor.name) throw new Q(G.INVALID_ARGUMENT, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?"); - { - const n = Ta(t); - throw new Q(G.INVALID_ARGUMENT, `Expected type '${e.name}', but it was: ${n}`); - } - } - - return t; -} - -function Aa(t, e) { - if (e <= 0) throw new Q(G.INVALID_ARGUMENT, `Function ${t}() requires a positive number, but it was: ${e}.`); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// settings() defaults: - -/** - * A concrete type describing all the values that can be applied via a - * user-supplied `FirestoreSettings` object. This is a separate type so that - * defaults can be supplied and the value can be checked for equality. - */ - - -class Ra { - constructor(t) { - var e; - - if (void 0 === t.host) { - if (void 0 !== t.ssl) throw new Q(G.INVALID_ARGUMENT, "Can't provide ssl option if host option is not set"); - this.host = "firestore.googleapis.com", this.ssl = true; - } else this.host = t.host, this.ssl = null === (e = t.ssl) || void 0 === e || e; - - 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 Q(G.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576"); - this.cacheSizeBytes = t.cacheSizeBytes; - } - this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling, this.useFetchStreams = !!t.useFetchStreams, ya("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling); - } - - isEqual(t) { - return this.host === t.host && this.ssl === t.ssl && this.credentials === t.credentials && this.cacheSizeBytes === t.cacheSizeBytes && this.experimentalForceLongPolling === t.experimentalForceLongPolling && this.experimentalAutoDetectLongPolling === t.experimentalAutoDetectLongPolling && this.ignoreUndefinedProperties === t.ignoreUndefinedProperties && this.useFetchStreams === t.useFetchStreams; - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * The Cloud Firestore service interface. - * - * Do not call this constructor directly. Instead, use {@link getFirestore}. - */ - - -class ba { - /** @hideconstructor */ - constructor(t, e, n, s) { - this._authCredentials = t, this._appCheckCredentials = e, this._databaseId = n, this._app = s, - /** - * Whether it's a Firestore or Firestore Lite instance. - */ - this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new Ra({}), this._settingsFrozen = !1; - } - /** - * The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service - * instance. - */ - - - get app() { - if (!this._app) throw new Q(G.FAILED_PRECONDITION, "Firestore was not initialized using the Firebase SDK. 'app' is not available"); - return this._app; - } - - get _initialized() { - return this._settingsFrozen; - } - - get _terminated() { - return void 0 !== this._terminateTask; - } - - _setSettings(t) { - if (this._settingsFrozen) throw new Q(G.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 Ra(t), void 0 !== t.credentials && (this._authCredentials = function (t) { - if (!t) return new z(); - - switch (t.type) { - case "gapi": - const e = t.client; - return new X(e, t.sessionIndex || "0", t.iamToken || null, t.authTokenFactory || null); - - case "provider": - return t.client; - - default: - throw new Q(G.INVALID_ARGUMENT, "makeAuthCredentialsProvider failed due to invalid credential type"); - } - }(t.credentials)); - } - - _getSettings() { - return this._settings; - } - - _freezeSettings() { - return this._settingsFrozen = !0, this._settings; - } - - _delete() { - return this._terminateTask || (this._terminateTask = this._terminate()), this._terminateTask; - } - /** Returns a JSON-serializable representation of this `Firestore` instance. */ - - - toJSON() { - return { - app: this._app, - databaseId: this._databaseId, - settings: this._settings - }; - } - /** - * Terminates all components used by this client. Subclasses can override - * this method to clean up their own dependencies, but must also call this - * method. - * - * Only ever called once. - */ - - - _terminate() { - /** - * Removes all components associated with the provided instance. Must be called - * when the `Firestore` instance is terminated. - */ - return function (t) { - const e = ma.get(t); - e && (O("ComponentProvider", "Removing Datastore"), ma.delete(t), e.terminate()); - }(this), Promise.resolve(); - } - -} -/** - * Modify this instance to communicate with the Cloud Firestore emulator. - * - * Note: This must be called before this instance has been used to do any - * operations. - * - * @param firestore - The `Firestore` instance to configure to connect to the - * emulator. - * @param host - the emulator host (ex: localhost). - * @param port - the emulator port (ex: 9000). - * @param options.mockUserToken - the mock auth token to use for unit testing - * Security Rules. - */ - - -function Pa(t, e, n) { - let s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; - var i; - - const r = (t = Ea(t, ba))._getSettings(); - - if ("firestore.googleapis.com" !== r.host && r.host !== e && $("Host has been set in both settings() and useEmulator(), emulator host will be used"), t._setSettings(Object.assign(Object.assign({}, r), { - host: `${e}:${n}`, - ssl: !1 - })), s.mockUserToken) { - let e, n; - if ("string" == typeof s.mockUserToken) e = s.mockUserToken, n = C.MOCK_USER;else { - // Let createMockUserToken validate first (catches common mistakes like - // invalid field "uid" and missing field "sub" / "user_id".) - e = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.createMockUserToken)(s.mockUserToken, null === (i = t._app) || void 0 === i ? void 0 : i.options.projectId); - const r = s.mockUserToken.sub || s.mockUserToken.user_id; - if (!r) throw new Q(G.INVALID_ARGUMENT, "mockUserToken must contain 'sub' or 'user_id' field!"); - n = new C(r); - } - t._authCredentials = new H(new W(e, n)); - } -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A `DocumentReference` refers to a document location in a Firestore database - * and can be used to write, read, or listen to the location. The document at - * the referenced location may or may not exist. - */ - - -class va { - /** @hideconstructor */ - constructor(t, - /** - * If provided, the `FirestoreDataConverter` associated with this instance. - */ - e, n) { - this.converter = e, this._key = n, - /** The type of this Firestore reference. */ - this.type = "document", this.firestore = t; - } - - get _path() { - return this._key.path; - } - /** - * The document's identifier within its collection. - */ - - - get id() { - return this._key.path.lastSegment(); - } - /** - * A string representing the path of the referenced document (relative - * to the root of the database). - */ - - - get path() { - return this._key.path.canonicalString(); - } - /** - * The collection this `DocumentReference` belongs to. - */ - - - get parent() { - return new Sa(this.firestore, this.converter, this._key.path.popLast()); - } - - withConverter(t) { - return new va(this.firestore, t, this._key); - } - -} -/** - * A `Query` refers to a query which you can read or listen to. You can also - * construct refined `Query` objects by adding filters and ordering. - */ - - -class Va { - // This is the lite version of the Query class in the main SDK. - - /** @hideconstructor protected */ - constructor(t, - /** - * If provided, the `FirestoreDataConverter` associated with this instance. - */ - e, n) { - this.converter = e, this._query = n, - /** The type of this Firestore reference. */ - this.type = "query", this.firestore = t; - } - - withConverter(t) { - return new Va(this.firestore, t, this._query); - } - -} -/** - * A `CollectionReference` object can be used for adding documents, getting - * document references, and querying for documents (using {@link query}). - */ - - -class Sa extends Va { - /** @hideconstructor */ - constructor(t, e, n) { - super(t, e, un(n)), this._path = n, - /** The type of this Firestore reference. */ - this.type = "collection"; - } - /** The collection's identifier. */ - - - get id() { - return this._query.path.lastSegment(); - } - /** - * A string representing the path of the referenced collection (relative - * to the root of the database). - */ - - - get path() { - return this._query.path.canonicalString(); - } - /** - * A reference to the containing `DocumentReference` if this is a - * subcollection. If this isn't a subcollection, the reference is null. - */ - - - get parent() { - const t = this._path.popLast(); - - return t.isEmpty() ? null : new va(this.firestore, - /* converter= */ - null, new dt(t)); - } - - withConverter(t) { - return new Sa(this.firestore, t, this._path); - } - -} - -function Da(t, e) { - for (var _len7 = arguments.length, n = new Array(_len7 > 2 ? _len7 - 2 : 0), _key7 = 2; _key7 < _len7; _key7++) { - n[_key7 - 2] = arguments[_key7]; - } - - if (t = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(t), ga("collection", "path", e), t instanceof ba) { - const s = ht.fromString(e, ...n); - return Ia(s), new Sa(t, - /* converter= */ - null, s); - } - - { - if (!(t instanceof va || t instanceof Sa)) throw new Q(G.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore"); - - const s = t._path.child(ht.fromString(e, ...n)); - - return Ia(s), new Sa(t.firestore, - /* converter= */ - null, s); - } -} // TODO(firestorelite): Consider using ErrorFactory - -// https://github.com/firebase/firebase-js-sdk/blob/0131e1f/packages/util/src/errors.ts#L106 - -/** - * Creates and returns a new `Query` instance that includes all documents in the - * database that are contained in a collection or subcollection with the - * given `collectionId`. - * - * @param firestore - A reference to the root `Firestore` instance. - * @param collectionId - Identifies the collections to query over. Every - * collection or subcollection with this ID as the last segment of its path - * will be included. Cannot contain a slash. - * @returns The created `Query`. - */ - - -function Ca(t, e) { - if (t = Ea(t, ba), ga("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new Q(G.INVALID_ARGUMENT, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`); - return new Va(t, - /* converter= */ - null, - /** - * Creates a new Query for a collection group query that matches all documents - * within the provided collection group. - */ - function (t) { - return new rn(ht.emptyPath(), t); - }(e)); -} - -function xa(t, e) { - for (var _len8 = arguments.length, n = new Array(_len8 > 2 ? _len8 - 2 : 0), _key8 = 2; _key8 < _len8; _key8++) { - n[_key8 - 2] = arguments[_key8]; - } - - if (t = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(t), // We allow omission of 'pathString' but explicitly prohibit passing in both - // 'undefined' and 'null'. - 1 === arguments.length && (e = st.R()), ga("doc", "path", e), t instanceof ba) { - const s = ht.fromString(e, ...n); - return pa(s), new va(t, - /* converter= */ - null, new dt(s)); - } - - { - if (!(t instanceof va || t instanceof Sa)) throw new Q(G.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore"); - - const s = t._path.child(ht.fromString(e, ...n)); - - return pa(s), new va(t.firestore, t instanceof Sa ? t.converter : null, new dt(s)); - } -} -/** - * Returns true if the provided references are equal. - * - * @param left - A reference to compare. - * @param right - A reference to compare. - * @returns true if the references point to the same location in the same - * Firestore database. - */ - - -function Na(t, e) { - return t = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(t), e = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(e), (t instanceof va || t instanceof Sa) && (e instanceof va || e instanceof Sa) && t.firestore === e.firestore && t.path === e.path && t.converter === e.converter; -} -/** - * Returns true if the provided queries point to the same collection and apply - * the same constraints. - * - * @param left - A `Query` to compare. - * @param right - A `Query` to compare. - * @returns true if the references point to the same location in the same - * Firestore database. - */ - - -function ka(t, e) { - return t = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(t), e = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(e), t instanceof Va && e instanceof Va && t.firestore === e.firestore && wn(t._query, e._query) && t.converter === e.converter; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class Ma { - constructor() { - // The last promise in the queue. - this.$c = Promise.resolve(), // A list of retryable operations. Retryable operations are run in order and - // retried with backoff. - this.Bc = [], // Is this AsyncQueue being shut down? Once it is set to true, it will not - // be changed again. - this.Lc = !1, // Operations scheduled to be queued in the future. Operations are - // automatically removed after they are run or canceled. - this.Uc = [], // visible for testing - this.qc = null, // Flag set while there's an outstanding AsyncQueue operation, used for - // assertion sanity-checks. - this.Kc = !1, // Enabled during shutdown on Safari to prevent future access to IndexedDB. - this.Gc = !1, // List of TimerIds to fast-forward delays for. - this.Qc = [], // Backoff timer used to schedule retries for retryable operations - this.xo = new ru(this, "async_queue_retry" - /* AsyncQueueRetry */ - ), // Visibility handler that triggers an immediate retry of all retryable - // operations. Meant to speed up recovery when we regain file system access - // after page comes into foreground. - this.jc = () => { - const t = su(); - t && O("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.xo.bo(); - }; - const t = su(); - t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.jc); - } - - get isShuttingDown() { - return this.Lc; - } - /** - * Adds a new operation to the queue without waiting for it to complete (i.e. - * we ignore the Promise result). - */ - - - enqueueAndForget(t) { - // eslint-disable-next-line @typescript-eslint/no-floating-promises - this.enqueue(t); - } - - enqueueAndForgetEvenWhileRestricted(t) { - this.Wc(), // eslint-disable-next-line @typescript-eslint/no-floating-promises - this.zc(t); - } - - enterRestrictedMode(t) { - if (!this.Lc) { - this.Lc = !0, this.Gc = t || !1; - const e = su(); - e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.jc); - } - } - - enqueue(t) { - if (this.Wc(), this.Lc) // Return a Promise which never resolves. - return new Promise(() => {}); // Create a deferred Promise that we can return to the callee. This - // allows us to return a "hanging Promise" only to the callee and still - // advance the queue even when the operation is not run. - - const e = new j(); - return this.zc(() => this.Lc && this.Gc ? Promise.resolve() : (t().then(e.resolve, e.reject), e.promise)).then(() => e.promise); - } - - enqueueRetryable(t) { - this.enqueueAndForget(() => (this.Bc.push(t), this.Hc())); - } - /** - * Runs the next operation from the retryable queue. If the operation fails, - * reschedules with backoff. - */ - - - async Hc() { - if (0 !== this.Bc.length) { - try { - await this.Bc[0](), this.Bc.shift(), this.xo.reset(); - } catch (t) { - if (!Nt(t)) throw t; // Failure will be handled by AsyncQueue - - O("AsyncQueue", "Operation failed with retryable error: " + t); - } - - this.Bc.length > 0 && // If there are additional operations, we re-schedule `retryNextOp()`. - // This is necessary to run retryable operations that failed during - // their initial attempt since we don't know whether they are already - // enqueued. If, for example, `op1`, `op2`, `op3` are enqueued and `op1` - // needs to be re-run, we will run `op1`, `op1`, `op2` using the - // already enqueued calls to `retryNextOp()`. `op3()` will then run in the - // call scheduled here. - // Since `backoffAndRun()` cancels an existing backoff and schedules a - // new backoff on every call, there is only ever a single additional - // operation in the queue. - this.xo.Ao(() => this.Hc()); - } - } - - zc(t) { - const e = this.$c.then(() => (this.Kc = !0, t().catch(t => { - this.qc = t, this.Kc = !1; - - const e = - /** - * Chrome includes Error.message in Error.stack. Other browsers do not. - * This returns expected output of message + stack when available. - * @param error - Error or FirestoreError - */ - function (t) { - let e = t.message || ""; - t.stack && (e = t.stack.includes(t.message) ? t.stack : t.message + "\n" + t.stack); - return e; - } - /** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - (t); // Re-throw the error so that this.tail becomes a rejected Promise and - // all further attempts to chain (via .then) will just short-circuit - // and return the rejected Promise. - - - throw F("INTERNAL UNHANDLED ERROR: ", e), t; - }).then(t => (this.Kc = !1, t)))); - return this.$c = e, e; - } - - enqueueAfterDelay(t, e, n) { - this.Wc(), // Fast-forward delays for timerIds that have been overriden. - this.Qc.indexOf(t) > -1 && (e = 0); - const s = Lu.createAndSchedule(this, t, e, n, t => this.Jc(t)); - return this.Uc.push(s), s; - } - - Wc() { - this.qc && L(); - } - - verifyOperationInProgress() {} - /** - * Waits until all currently queued tasks are finished executing. Delayed - * operations are not run. - */ - - - async Yc() { - // Operations in the queue prior to draining may have enqueued additional - // operations. Keep draining the queue until the tail is no longer advanced, - // which indicates that no more new operations were enqueued and that all - // operations were executed. - let t; - - do { - t = this.$c, await t; - } while (t !== this.$c); - } - /** - * For Tests: Determine if a delayed operation with a particular TimerId - * exists. - */ - - - Xc(t) { - for (const e of this.Uc) if (e.timerId === t) return !0; - - return !1; - } - /** - * For Tests: Runs some or all delayed operations early. - * - * @param lastTimerId - Delayed operations up to and including this TimerId - * will be drained. Pass TimerId.All to run all delayed operations. - * @returns a Promise that resolves once all operations have been run. - */ - - - Zc(t) { - // Note that draining may generate more delayed ops, so we do that first. - return this.Yc().then(() => { - // Run ops in the same order they'd run if they ran naturally. - this.Uc.sort((t, e) => t.targetTimeMs - e.targetTimeMs); - - for (const e of this.Uc) if (e.skipDelay(), "all" - /* All */ - !== t && e.timerId === t) break; - - return this.Yc(); - }); - } - /** - * For Tests: Skip all subsequent delays for a timer id. - */ - - - ta(t) { - this.Qc.push(t); - } - /** Called once a DelayedOperation is run or canceled. */ - - - Jc(t) { - // NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small. - const e = this.Uc.indexOf(t); - this.Uc.splice(e, 1); - } - -} - -function Oa(t) { - /** - * Returns true if obj is an object and contains at least one of the specified - * methods. - */ - return function (t, e) { - if ("object" != typeof t || null === t) return !1; - const n = t; - - for (const t of e) if (t in n && "function" == typeof n[t]) return !0; - - return !1; - } - /** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - /** - * Represents the task of loading a Firestore bundle. It provides progress of bundle - * loading, as well as task completion and error events. - * - * The API is compatible with `Promise`. - */ - (t, ["next", "error", "complete"]); -} - -class Fa { - constructor() { - this._progressObserver = {}, this._taskCompletionResolver = new j(), this._lastProgress = { - taskState: "Running", - totalBytes: 0, - totalDocuments: 0, - bytesLoaded: 0, - documentsLoaded: 0 - }; - } - /** - * Registers functions to listen to bundle loading progress events. - * @param next - Called when there is a progress update from bundle loading. Typically `next` calls occur - * each time a Firestore document is loaded from the bundle. - * @param error - Called when an error occurs during bundle loading. The task aborts after reporting the - * error, and there should be no more updates after this. - * @param complete - Called when the loading task is complete. - */ - - - onProgress(t, e, n) { - this._progressObserver = { - next: t, - error: e, - complete: n - }; - } - /** - * Implements the `Promise.catch` interface. - * - * @param onRejected - Called when an error occurs during bundle loading. - */ - - - catch(t) { - return this._taskCompletionResolver.promise.catch(t); - } - /** - * Implements the `Promise.then` interface. - * - * @param onFulfilled - Called on the completion of the loading task with a final `LoadBundleTaskProgress` update. - * The update will always have its `taskState` set to `"Success"`. - * @param onRejected - Called when an error occurs during bundle loading. - */ - - - then(t, e) { - return this._taskCompletionResolver.promise.then(t, e); - } - /** - * Notifies all observers that bundle loading has completed, with a provided - * `LoadBundleTaskProgress` object. - * - * @private - */ - - - _completeWith(t) { - this._updateProgress(t), this._progressObserver.complete && this._progressObserver.complete(), this._taskCompletionResolver.resolve(t); - } - /** - * Notifies all observers that bundle loading has failed, with a provided - * `Error` as the reason. - * - * @private - */ - - - _failWith(t) { - this._lastProgress.taskState = "Error", this._progressObserver.next && this._progressObserver.next(this._lastProgress), this._progressObserver.error && this._progressObserver.error(t), this._taskCompletionResolver.reject(t); - } - /** - * Notifies a progress update of loading a bundle. - * @param progress - The new progress. - * - * @private - */ - - - _updateProgress(t) { - this._lastProgress = t, this._progressObserver.next && this._progressObserver.next(t); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** DOMException error code constants. */ - - -const $a = -1; -/** - * The Cloud Firestore service interface. - * - * Do not call this constructor directly. Instead, use {@link getFirestore}. - */ - -class Ba extends ba { - /** @hideconstructor */ - constructor(t, e, n, s) { - super(t, e, n, s), - /** - * Whether it's a {@link Firestore} or Firestore Lite instance. - */ - this.type = "firestore", this._queue = new Ma(), this._persistenceKey = (null == s ? void 0 : s.name) || "[DEFAULT]"; - } - - _terminate() { - return this._firestoreClient || // The client must be initialized to ensure that all subsequent API - // usage throws an exception. - Ka(this), this._firestoreClient.terminate(); - } - -} -/** - * Initializes a new instance of {@link Firestore} with the provided settings. - * Can only be called before any other function, including - * {@link getFirestore}. If the custom settings are empty, this function is - * equivalent to calling {@link getFirestore}. - * - * @param app - The {@link @firebase/app#FirebaseApp} with which the {@link Firestore} instance will - * be associated. - * @param settings - A settings object to configure the {@link Firestore} instance. - * @param databaseId - The name of database. - * @returns A newly initialized {@link Firestore} instance. - */ - - -function La(t, e, n) { - n || (n = "(default)"); - - const s = (0,_firebase_app__WEBPACK_IMPORTED_MODULE_0__._getProvider)(t, "firestore"); - - if (s.isInitialized(n)) { - const t = s.getImmediate({ - identifier: n - }), - i = s.getOptions(n); - if ((0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.deepEqual)(i, e)) return t; - throw new Q(G.FAILED_PRECONDITION, "initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance."); - } - - if (void 0 !== e.cacheSizeBytes && -1 !== e.cacheSizeBytes && e.cacheSizeBytes < 1048576) throw new Q(G.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576"); - return s.initialize({ - options: e, - instanceIdentifier: n - }); -} - -function Ua(e, n) { - const s = "object" == typeof e ? e : (0,_firebase_app__WEBPACK_IMPORTED_MODULE_0__.getApp)(), - i = "string" == typeof e ? e : n || "(default)"; - return (0,_firebase_app__WEBPACK_IMPORTED_MODULE_0__._getProvider)(s, "firestore").getImmediate({ - identifier: i - }); -} -/** - * @internal - */ - - -function qa(t) { - return t._firestoreClient || Ka(t), t._firestoreClient.verifyNotTerminated(), t._firestoreClient; -} - -function Ka(t) { - var e; - - const n = t._freezeSettings(), - s = function (t, e, n, s) { - return new oe(t, e, n, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams); - }(t._databaseId, (null === (e = t._app) || void 0 === e ? void 0 : e.options.appId) || "", t._persistenceKey, n); - - t._firestoreClient = new Jc(t._authCredentials, t._appCheckCredentials, t._queue, s); -} -/** - * Attempts to enable persistent storage, if possible. - * - * Must be called before any other functions (other than - * {@link initializeFirestore}, {@link getFirestore} or - * {@link clearIndexedDbPersistence}. - * - * If this fails, `enableIndexedDbPersistence()` will reject the promise it - * returns. Note that even after this failure, the {@link Firestore} instance will - * remain usable, however offline persistence will be disabled. - * - * There are several reasons why this can fail, which can be identified by - * the `code` on the error. - * - * * failed-precondition: The app is already open in another browser tab. - * * unimplemented: The browser is incompatible with the offline - * persistence implementation. - * - * @param firestore - The {@link Firestore} instance to enable persistence for. - * @param persistenceSettings - Optional settings object to configure - * persistence. - * @returns A `Promise` that represents successfully enabling persistent storage. - */ - - -function Ga(t, e) { - th(t = Ea(t, Ba)); - - const n = qa(t), - s = t._freezeSettings(), - i = new Gc(); - - return ja(n, i, new qc(i, s.cacheSizeBytes, null == e ? void 0 : e.forceOwnership)); -} -/** - * Attempts to enable multi-tab persistent storage, if possible. If enabled - * across all tabs, all operations share access to local persistence, including - * shared execution of queries and latency-compensated local document updates - * across all connected instances. - * - * If this fails, `enableMultiTabIndexedDbPersistence()` will reject the promise - * it returns. Note that even after this failure, the {@link Firestore} instance will - * remain usable, however offline persistence will be disabled. - * - * There are several reasons why this can fail, which can be identified by - * the `code` on the error. - * - * * failed-precondition: The app is already open in another browser tab and - * multi-tab is not enabled. - * * unimplemented: The browser is incompatible with the offline - * persistence implementation. - * - * @param firestore - The {@link Firestore} instance to enable persistence for. - * @returns A `Promise` that represents successfully enabling persistent - * storage. - */ - - -function Qa(t) { - th(t = Ea(t, Ba)); - - const e = qa(t), - n = t._freezeSettings(), - s = new Gc(); - - return ja(e, s, new Kc(s, n.cacheSizeBytes)); -} -/** - * Registers both the `OfflineComponentProvider` and `OnlineComponentProvider`. - * If the operation fails with a recoverable error (see - * `canRecoverFromIndexedDbError()` below), the returned Promise is rejected - * but the client remains usable. - */ - - -function ja(t, e, n) { - const s = new j(); - return t.asyncQueue.enqueue(async () => { - try { - await Yc(t, n), await Xc(t, e), s.resolve(); - } catch (t) { - const e = t; - if (! - /** - * Decides whether the provided error allows us to gracefully disable - * persistence (as opposed to crashing the client). - */ - function (t) { - if ("FirebaseError" === t.name) return t.code === G.FAILED_PRECONDITION || t.code === G.UNIMPLEMENTED; - if ("undefined" != typeof DOMException && t instanceof DOMException) // There are a few known circumstances where we can open IndexedDb but - // trying to read/write will fail (e.g. quota exceeded). For - // well-understood cases, we attempt to detect these and then gracefully - // fall back to memory persistence. - // NOTE: Rather than continue to add to this list, we could decide to - // always fall back, with the risk that we might accidentally hide errors - // representing actual SDK bugs. - // When the browser is out of quota we could get either quota exceeded - // or an aborted error depending on whether the error happened during - // schema migration. - return 22 === t.code || 20 === t.code || // Firefox Private Browsing mode disables IndexedDb and returns - // INVALID_STATE for any usage. - 11 === t.code; - return !0; - } - /** - * Clears the persistent storage. This includes pending writes and cached - * documents. - * - * Must be called while the {@link Firestore} instance is not started (after the app is - * terminated or when the app is first initialized). On startup, this function - * must be called before other functions (other than {@link - * initializeFirestore} or {@link getFirestore})). If the {@link Firestore} - * instance is still running, the promise will be rejected with the error code - * of `failed-precondition`. - * - * Note: `clearIndexedDbPersistence()` is primarily intended to help write - * reliable tests that use Cloud Firestore. It uses an efficient mechanism for - * dropping existing data but does not attempt to securely overwrite or - * otherwise make cached data unrecoverable. For applications that are sensitive - * to the disclosure of cached data in between user sessions, we strongly - * recommend not enabling persistence at all. - * - * @param firestore - The {@link Firestore} instance to clear persistence for. - * @returns A `Promise` that is resolved when the persistent storage is - * cleared. Otherwise, the promise is rejected with an error. - */ - (e)) throw e; - $("Error enabling offline persistence. Falling back to persistence disabled: " + e), s.reject(e); - } - }).then(() => s.promise); -} - -function Wa(t) { - if (t._initialized && !t._terminated) throw new Q(G.FAILED_PRECONDITION, "Persistence can only be cleared before a Firestore instance is initialized or after it is terminated."); - const e = new j(); - return t._queue.enqueueAndForgetEvenWhileRestricted(async () => { - try { - await async function (t) { - if (!Dt.C()) return Promise.resolve(); - const e = t + "main"; - await Dt.delete(e); - } - /** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - /** - * Compares two array for equality using comparator. The method computes the - * intersection and invokes `onAdd` for every element that is in `after` but not - * `before`. `onRemove` is invoked for every element in `before` but missing - * from `after`. - * - * The method creates a copy of both `before` and `after` and runs in O(n log - * n), where n is the size of the two lists. - * - * @param before - The elements that exist in the original array. - * @param after - The elements to diff against the original array. - * @param comparator - The comparator for the elements in before and after. - * @param onAdd - A function to invoke for every element that is part of ` - * after` but not `before`. - * @param onRemove - A function to invoke for every element that is part of - * `before` but not `after`. - */ - (Eo(t._databaseId, t._persistenceKey)), e.resolve(); - } catch (t) { - e.reject(t); - } - }), e.promise; -} -/** - * Waits until all currently pending writes for the active user have been - * acknowledged by the backend. - * - * The returned promise resolves immediately if there are no outstanding writes. - * Otherwise, the promise waits for all previously issued writes (including - * those written in a previous app session), but it does not wait for writes - * that were added after the function is called. If you want to wait for - * additional writes, call `waitForPendingWrites()` again. - * - * Any outstanding `waitForPendingWrites()` promises are rejected during user - * changes. - * - * @returns A `Promise` which resolves when all currently pending writes have been - * acknowledged by the backend. - */ - - -function za(t) { - return function (t) { - const e = new j(); - return t.asyncQueue.enqueueAndForget(async () => yc(await ia(t), e)), e.promise; - }(qa(t = Ea(t, Ba))); -} -/** - * Re-enables use of the network for this {@link Firestore} instance after a prior - * call to {@link disableNetwork}. - * - * @returns A `Promise` that is resolved once the network has been enabled. - */ - - -function Ha(t) { - return oa(qa(t = Ea(t, Ba))); -} -/** - * Disables network usage for this instance. It can be re-enabled via {@link - * enableNetwork}. While the network is disabled, any snapshot listeners, - * `getDoc()` or `getDocs()` calls will return results from cache, and any write - * operations will be queued until the network is restored. - * - * @returns A `Promise` that is resolved once the network has been disabled. - */ - - -function Ja(t) { - return ua(qa(t = Ea(t, Ba))); -} -/** - * Terminates the provided {@link Firestore} instance. - * - * After calling `terminate()` only the `clearIndexedDbPersistence()` function - * may be used. Any other function will throw a `FirestoreError`. - * - * To restart after termination, create a new instance of FirebaseFirestore with - * {@link getFirestore}. - * - * Termination does not cancel any pending writes, and any promises that are - * awaiting a response from the server will not be resolved. If you have - * persistence enabled, the next time you start this instance, it will resume - * sending these writes to the server. - * - * Note: Under normal circumstances, calling `terminate()` is not required. This - * function is useful only when you want to force this instance to release all - * of its resources or in combination with `clearIndexedDbPersistence()` to - * ensure that all local state is destroyed between test runs. - * - * @returns A `Promise` that is resolved when the instance has been successfully - * terminated. - */ - - -function Ya(t) { - return (0,_firebase_app__WEBPACK_IMPORTED_MODULE_0__._removeServiceInstance)(t.app, "firestore", t._databaseId.database), t._delete(); -} -/** - * Loads a Firestore bundle into the local cache. - * - * @param firestore - The {@link Firestore} instance to load bundles for. - * @param bundleData - An object representing the bundle to be loaded. Valid - * objects are `ArrayBuffer`, `ReadableStream` or `string`. - * - * @returns A `LoadBundleTask` object, which notifies callers with progress - * updates, and completion or error events. It can be used as a - * `Promise`. - */ - - -function Xa(t, e) { - const n = qa(t = Ea(t, Ba)), - s = new Fa(); - return _a(n, t._databaseId, e, s), s; -} -/** - * Reads a Firestore {@link Query} from local cache, identified by the given - * name. - * - * The named queries are packaged into bundles on the server side (along - * with resulting documents), and loaded to local cache using `loadBundle`. Once - * in local cache, use this method to extract a {@link Query} by name. - * - * @param firestore - The {@link Firestore} instance to read the query from. - * @param name - The name of the query. - * @returns A `Promise` that is resolved with the Query or `null`. - */ - - -function Za(t, e) { - return wa(qa(t = Ea(t, Ba)), e).then(e => e ? new Va(t, null, e.query) : null); -} - -function th(t) { - if (t._initialized || t._terminated) throw new Q(G.FAILED_PRECONDITION, "Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object."); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A `FieldPath` refers to a field in a document. The path may consist of a - * single field name (referring to a top-level field in the document), or a - * list of field names (referring to a nested field in the document). - * - * Create a `FieldPath` by providing field names. If more than one field - * name is provided, the path will point to a nested field in a document. - */ - - -class eh { - /** - * Creates a `FieldPath` from the provided field names. If more than one field - * name is provided, the path will point to a nested field in a document. - * - * @param fieldNames - A list of field names. - */ - constructor() { - for (var _len9 = arguments.length, t = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) { - t[_key9] = arguments[_key9]; - } - - for (let e = 0; e < t.length; ++e) if (0 === t[e].length) throw new Q(G.INVALID_ARGUMENT, "Invalid field name at argument $(i + 1). Field names must not be empty."); - - this._internalPath = new ft(t); - } - /** - * Returns true if this `FieldPath` is equal to the provided one. - * - * @param other - The `FieldPath` to compare against. - * @returns true if this `FieldPath` is equal to the provided one. - */ - - - isEqual(t) { - return this._internalPath.isEqual(t._internalPath); - } - -} -/** - * Returns a special sentinel `FieldPath` to refer to the ID of a document. - * It can be used in queries to sort or filter by the document ID. - */ - - -function nh() { - return new eh("__name__"); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * An immutable object representing an array of bytes. - */ - - -class sh { - /** @hideconstructor */ - constructor(t) { - this._byteString = t; - } - /** - * Creates a new `Bytes` object from the given Base64 string, converting it to - * bytes. - * - * @param base64 - The Base64 string used to create the `Bytes` object. - */ - - - static fromBase64String(t) { - try { - return new sh(Xt.fromBase64String(t)); - } catch (t) { - throw new Q(G.INVALID_ARGUMENT, "Failed to construct data from Base64 string: " + t); - } - } - /** - * Creates a new `Bytes` object from the given Uint8Array. - * - * @param array - The Uint8Array used to create the `Bytes` object. - */ - - - static fromUint8Array(t) { - return new sh(Xt.fromUint8Array(t)); - } - /** - * Returns the underlying bytes as a Base64-encoded string. - * - * @returns The Base64-encoded string created from the `Bytes` object. - */ - - - toBase64() { - return this._byteString.toBase64(); - } - /** - * Returns the underlying bytes in a new `Uint8Array`. - * - * @returns The Uint8Array created from the `Bytes` object. - */ - - - toUint8Array() { - return this._byteString.toUint8Array(); - } - /** - * Returns a string representation of the `Bytes` object. - * - * @returns A string representation of the `Bytes` object. - */ - - - toString() { - return "Bytes(base64: " + this.toBase64() + ")"; - } - /** - * Returns true if this `Bytes` object is equal to the provided one. - * - * @param other - The `Bytes` object to compare against. - * @returns true if this `Bytes` object is equal to the provided one. - */ - - - isEqual(t) { - return this._byteString.isEqual(t._byteString); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Sentinel values that can be used when writing document fields with `set()` - * or `update()`. - */ - - -class ih { - /** - * @param _methodName - The public API endpoint that returns this class. - * @hideconstructor - */ - constructor(t) { - this._methodName = t; - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * An immutable object representing a geographic location in Firestore. The - * location is represented as latitude/longitude pair. - * - * Latitude values are in the range of [-90, 90]. - * Longitude values are in the range of [-180, 180]. - */ - - -class rh { - /** - * Creates a new immutable `GeoPoint` object with the provided latitude and - * longitude values. - * @param latitude - The latitude as number between -90 and 90. - * @param longitude - The longitude as number between -180 and 180. - */ - constructor(t, e) { - if (!isFinite(t) || t < -90 || t > 90) throw new Q(G.INVALID_ARGUMENT, "Latitude must be a number between -90 and 90, but was: " + t); - if (!isFinite(e) || e < -180 || e > 180) throw new Q(G.INVALID_ARGUMENT, "Longitude must be a number between -180 and 180, but was: " + e); - this._lat = t, this._long = e; - } - /** - * The latitude of this `GeoPoint` instance. - */ - - - get latitude() { - return this._lat; - } - /** - * The longitude of this `GeoPoint` instance. - */ - - - get longitude() { - return this._long; - } - /** - * Returns true if this `GeoPoint` is equal to the provided one. - * - * @param other - The `GeoPoint` to compare against. - * @returns true if this `GeoPoint` is equal to the provided one. - */ - - - isEqual(t) { - return this._lat === t._lat && this._long === t._long; - } - /** Returns a JSON-serializable representation of this GeoPoint. */ - - - toJSON() { - return { - latitude: this._lat, - longitude: this._long - }; - } - /** - * Actually private to JS consumers of our API, so this function is prefixed - * with an underscore. - */ - - - _compareTo(t) { - return it(this._lat, t._lat) || it(this._long, t._long); - } - -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const oh = /^__.*__$/; -/** The result of parsing document data (e.g. for a setData call). */ - -class uh { - constructor(t, e, n) { - this.data = t, this.fieldMask = e, this.fieldTransforms = n; - } - - toMutation(t, e) { - return null !== this.fieldMask ? new Hn(t, this.data, this.fieldMask, e, this.fieldTransforms) : new zn(t, this.data, e, this.fieldTransforms); - } - -} -/** The result of parsing "update" data (i.e. for an updateData call). */ - - -class ch { - constructor(t, // The fieldMask does not include document transforms. - e, n) { - this.data = t, this.fieldMask = e, this.fieldTransforms = n; - } - - toMutation(t, e) { - return new Hn(t, this.data, this.fieldMask, e, this.fieldTransforms); - } - -} - -function ah(t) { - switch (t) { - case 0 - /* Set */ - : // fall through - - case 2 - /* MergeSet */ - : // fall through - - case 1 - /* Update */ - : - return !0; - - case 3 - /* Argument */ - : - case 4 - /* ArrayArgument */ - : - return !1; - - default: - throw L(); - } -} -/** A "context" object passed around while parsing user data. */ - - -class hh { - /** - * Initializes a ParseContext with the given source and path. - * - * @param settings - The settings for the parser. - * @param databaseId - The database ID of the Firestore instance. - * @param serializer - The serializer to use to generate the Value proto. - * @param ignoreUndefinedProperties - Whether to ignore undefined properties - * rather than throw. - * @param fieldTransforms - A mutable list of field transforms encountered - * while parsing the data. - * @param fieldMask - A mutable list of field paths encountered while parsing - * the data. - * - * TODO(b/34871131): We don't support array paths right now, so path can be - * null to indicate the context represents any location within an array (in - * which case certain features will not work and errors will be somewhat - * compromised). - */ - constructor(t, e, n, s, i, r) { - this.settings = t, this.databaseId = e, this.It = n, this.ignoreUndefinedProperties = s, // Minor hack: If fieldTransforms is undefined, we assume this is an - // external call and we need to validate the entire path. - void 0 === i && this.ea(), this.fieldTransforms = i || [], this.fieldMask = r || []; - } - - get path() { - return this.settings.path; - } - - get na() { - return this.settings.na; - } - /** Returns a new context with the specified settings overwritten. */ - - - sa(t) { - return new hh(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.It, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask); - } - - ia(t) { - var e; - const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), - s = this.sa({ - path: n, - ra: !1 - }); - return s.oa(t), s; - } - - ua(t) { - var e; - const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), - s = this.sa({ - path: n, - ra: !1 - }); - return s.ea(), s; - } - - ca(t) { - // TODO(b/34871131): We don't support array paths right now; so make path - // undefined. - return this.sa({ - path: void 0, - ra: !0 - }); - } - - aa(t) { - return Dh(t, this.settings.methodName, this.settings.ha || !1, this.path, this.settings.la); - } - /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ - - - contains(t) { - return void 0 !== this.fieldMask.find(e => t.isPrefixOf(e)) || void 0 !== this.fieldTransforms.find(e => t.isPrefixOf(e.field)); - } - - ea() { - // TODO(b/34871131): Remove null check once we have proper paths for fields - // within arrays. - if (this.path) for (let t = 0; t < this.path.length; t++) this.oa(this.path.get(t)); - } - - oa(t) { - if (0 === t.length) throw this.aa("Document fields must not be empty"); - if (ah(this.na) && oh.test(t)) throw this.aa('Document fields cannot begin and end with "__"'); - } - -} -/** - * Helper for parsing raw user input (provided via the API) into internal model - * classes. - */ - - -class lh { - constructor(t, e, n) { - this.databaseId = t, this.ignoreUndefinedProperties = e, this.It = n || iu(t); - } - /** Creates a new top-level parse context. */ - - - fa(t, e, n) { - let s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1; - return new hh({ - na: t, - methodName: e, - la: n, - path: ft.emptyPath(), - ra: !1, - ha: s - }, this.databaseId, this.It, this.ignoreUndefinedProperties); - } - -} - -function fh(t) { - const e = t._freezeSettings(), - n = iu(t._databaseId); - - return new lh(t._databaseId, !!e.ignoreUndefinedProperties, n); -} -/** Parse document data from a set() call. */ - - -function dh(t, e, n, s, i) { - let r = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {}; - const o = t.fa(r.merge || r.mergeFields ? 2 - /* MergeSet */ - : 0 - /* Set */ - , e, n, i); - Ph("Data must be an object, but it was:", o, s); - const u = Rh(s, o); - let c, a; - if (r.merge) c = new Jt(o.fieldMask), a = o.fieldTransforms;else if (r.mergeFields) { - const t = []; - - for (const s of r.mergeFields) { - const i = vh(e, s, n); - if (!o.contains(i)) throw new Q(G.INVALID_ARGUMENT, `Field '${i}' is specified in your field mask but missing from your input data.`); - Ch(t, i) || t.push(i); - } - - c = new Jt(t), a = o.fieldTransforms.filter(t => c.covers(t.field)); - } else c = null, a = o.fieldTransforms; - return new uh(new xe(u), c, a); -} - -class _h extends ih { - _toFieldTransform(t) { - if (2 - /* MergeSet */ - !== t.na) throw 1 - /* Update */ - === t.na ? t.aa(`${this._methodName}() can only appear at the top level of your update data`) : t.aa(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`); // No transform to add for a delete, but we need to add it to our - // fieldMask so it gets deleted. - - return t.fieldMask.push(t.path), null; - } - - isEqual(t) { - return t instanceof _h; - } - -} -/** - * Creates a child context for parsing SerializableFieldValues. - * - * This is different than calling `ParseContext.contextWith` because it keeps - * the fieldTransforms and fieldMask separate. - * - * The created context has its `dataSource` set to `UserDataSource.Argument`. - * Although these values are used with writes, any elements in these FieldValues - * are not considered writes since they cannot contain any FieldValue sentinels, - * etc. - * - * @param fieldValue - The sentinel FieldValue for which to create a child - * context. - * @param context - The parent context. - * @param arrayElement - Whether or not the FieldValue has an array. - */ - - -function wh(t, e, n) { - return new hh({ - na: 3 - /* Argument */ - , - la: e.settings.la, - methodName: t._methodName, - ra: n - }, e.databaseId, e.It, e.ignoreUndefinedProperties); -} - -class mh extends ih { - _toFieldTransform(t) { - return new Fn(t.path, new Sn()); - } - - isEqual(t) { - return t instanceof mh; - } - -} - -class gh extends ih { - constructor(t, e) { - super(t), this.da = e; - } - - _toFieldTransform(t) { - const e = wh(this, t, - /*array=*/ - !0), - n = this.da.map(t => Ah(t, e)), - s = new Dn(n); - return new Fn(t.path, s); - } - - isEqual(t) { - // TODO(mrschmidt): Implement isEquals - return this === t; - } - -} - -class yh extends ih { - constructor(t, e) { - super(t), this.da = e; - } - - _toFieldTransform(t) { - const e = wh(this, t, - /*array=*/ - !0), - n = this.da.map(t => Ah(t, e)), - s = new xn(n); - return new Fn(t.path, s); - } - - isEqual(t) { - // TODO(mrschmidt): Implement isEquals - return this === t; - } - -} - -class ph extends ih { - constructor(t, e) { - super(t), this._a = e; - } - - _toFieldTransform(t) { - const e = new kn(t.It, Rn(t.It, this._a)); - return new Fn(t.path, e); - } - - isEqual(t) { - // TODO(mrschmidt): Implement isEquals - return this === t; - } - -} -/** Parse update data from an update() call. */ - - -function Ih(t, e, n, s) { - const i = t.fa(1 - /* Update */ - , e, n); - Ph("Data must be an object, but it was:", i, s); - const r = [], - o = xe.empty(); - qt(s, (t, s) => { - const u = Sh(e, t, n); // For Compat types, we have to "extract" the underlying types before - // performing validation. - - s = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(s); - const c = i.ua(u); - if (s instanceof _h) // Add it to the field mask, but don't add anything to updateData. - r.push(u);else { - const t = Ah(s, c); - null != t && (r.push(u), o.set(u, t)); - } - }); - const u = new Jt(r); - return new ch(o, u, i.fieldTransforms); -} -/** Parse update data from a list of field/value arguments. */ - - -function Th(t, e, n, s, i, r) { - const o = t.fa(1 - /* Update */ - , e, n), - u = [vh(e, s, n)], - c = [i]; - if (r.length % 2 != 0) throw new Q(G.INVALID_ARGUMENT, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`); - - for (let t = 0; t < r.length; t += 2) u.push(vh(e, r[t])), c.push(r[t + 1]); - - const a = [], - h = xe.empty(); // We iterate in reverse order to pick the last value for a field if the - // user specified the field multiple times. - - for (let t = u.length - 1; t >= 0; --t) if (!Ch(a, u[t])) { - const e = u[t]; - let n = c[t]; // For Compat types, we have to "extract" the underlying types before - // performing validation. - - n = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(n); - const s = o.ua(e); - if (n instanceof _h) // Add it to the field mask, but don't add anything to updateData. - a.push(e);else { - const t = Ah(n, s); - null != t && (a.push(e), h.set(e, t)); - } - } - - const l = new Jt(a); - return new ch(h, l, o.fieldTransforms); -} -/** - * Parse a "query value" (e.g. value in a where filter or a value in a cursor - * bound). - * - * @param allowArrays - Whether the query value is an array that may directly - * contain additional arrays (e.g. the operand of an `in` query). - */ - - -function Eh(t, e, n) { - let s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1; - return Ah(n, t.fa(s ? 4 - /* ArrayArgument */ - : 3 - /* Argument */ - , e)); -} -/** - * Parses user data to Protobuf Values. - * - * @param input - Data to be parsed. - * @param context - A context object representing the current path being parsed, - * the source of the data being parsed, etc. - * @returns The parsed value, or null if the value was a FieldValue sentinel - * that should not be included in the resulting parsed data. - */ - - -function Ah(t, e) { - if (bh( // Unwrap the API type from the Compat SDK. This will return the API type - // from firestore-exp. - t = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(t))) return Ph("Unsupported field value:", e, t), Rh(t, e); - if (t instanceof ih) // FieldValues usually parse into transforms (except deleteField()) - // in which case we do not want to include this field in our parsed data - // (as doing so will overwrite the field directly prior to the transform - // trying to transform it). So we don't add this location to - // context.fieldMask and we return null as our parsing result. - - /** - * "Parses" the provided FieldValueImpl, adding any necessary transforms to - * context.fieldTransforms. - */ - return function (t, e) { - // Sentinels are only supported with writes, and not within arrays. - if (!ah(e.na)) throw e.aa(`${t._methodName}() can only be used with update() and set()`); - if (!e.path) throw e.aa(`${t._methodName}() is not currently supported inside arrays`); - - const n = t._toFieldTransform(e); - - n && e.fieldTransforms.push(n); - } - /** - * Helper to parse a scalar value (i.e. not an Object, Array, or FieldValue) - * - * @returns The parsed value - */ - (t, e), null; - if (void 0 === t && e.ignoreUndefinedProperties) // If the input is undefined it can never participate in the fieldMask, so - // don't handle this below. If `ignoreUndefinedProperties` is false, - // `parseScalarValue` will reject an undefined value. - return null; - - if ( // If context.path is null we are inside an array and we don't support - // field mask paths more granular than the top-level array. - e.path && e.fieldMask.push(e.path), t instanceof Array) { - // TODO(b/34871131): Include the path containing the array in the error - // message. - // In the case of IN queries, the parsed data is an array (representing - // the set of values to be included for the IN query) that may directly - // contain additional arrays (each representing an individual field - // value), so we disable this validation. - if (e.settings.ra && 4 - /* ArrayArgument */ - !== e.na) throw e.aa("Nested arrays are not supported"); - return function (t, e) { - const n = []; - let s = 0; - - for (const i of t) { - let t = Ah(i, e.ca(s)); - null == t && ( // Just include nulls in the array for fields being replaced with a - // sentinel. - t = { - nullValue: "NULL_VALUE" - }), n.push(t), s++; - } - - return { - arrayValue: { - values: n - } - }; - }(t, e); - } - - return function (t, e) { - if (null === (t = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(t))) return { - nullValue: "NULL_VALUE" - }; - if ("number" == typeof t) return Rn(e.It, t); - if ("boolean" == typeof t) return { - booleanValue: t - }; - if ("string" == typeof t) return { - stringValue: t - }; - - if (t instanceof Date) { - const n = ut.fromDate(t); - return { - timestampValue: xs(e.It, n) - }; - } - - if (t instanceof ut) { - // Firestore backend truncates precision down to microseconds. To ensure - // offline mode works the same with regards to truncation, perform the - // truncation immediately without waiting for the backend to do that. - const n = new ut(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3)); - return { - timestampValue: xs(e.It, n) - }; - } - - if (t instanceof rh) return { - geoPointValue: { - latitude: t.latitude, - longitude: t.longitude - } - }; - if (t instanceof sh) return { - bytesValue: Ns(e.It, t._byteString) - }; - - if (t instanceof va) { - const n = e.databaseId, - s = t.firestore._databaseId; - if (!s.isEqual(n)) throw e.aa(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`); - return { - referenceValue: Os(t.firestore._databaseId || e.databaseId, t._key.path) - }; - } - - throw e.aa(`Unsupported field value: ${Ta(t)}`); - } - /** - * Checks whether an object looks like a JSON object that should be converted - * into a struct. Normal class/prototype instances are considered to look like - * JSON objects since they should be converted to a struct value. Arrays, Dates, - * GeoPoints, etc. are not considered to look like JSON objects since they map - * to specific FieldValue types other than ObjectValue. - */ - (t, e); -} - -function Rh(t, e) { - const n = {}; - return Kt(t) ? // If we encounter an empty object, we explicitly add it to the update - // mask to ensure that the server creates a map entry. - e.path && e.path.length > 0 && e.fieldMask.push(e.path) : qt(t, (t, s) => { - const i = Ah(s, e.ia(t)); - null != i && (n[t] = i); - }), { - mapValue: { - fields: n - } - }; -} - -function bh(t) { - return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof ut || t instanceof rh || t instanceof sh || t instanceof va || t instanceof ih); -} - -function Ph(t, e, n) { - if (!bh(n) || !function (t) { - return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t)); - }(n)) { - const s = Ta(n); - throw "an object" === s ? e.aa(t + " a custom object") : e.aa(t + " " + s); - } -} -/** - * Helper that calls fromDotSeparatedString() but wraps any error thrown. - */ - - -function vh(t, e, n) { - if (( // If required, replace the FieldPath Compat class with with the firestore-exp - // FieldPath. - e = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(e)) instanceof eh) return e._internalPath; - if ("string" == typeof e) return Sh(t, e); - throw Dh("Field path arguments must be of type string or ", t, - /* hasConverter= */ - !1, - /* path= */ - void 0, n); -} -/** - * Matches any characters in a field path string that are reserved. - */ - - -const Vh = new RegExp("[~\\*/\\[\\]]"); -/** - * Wraps fromDotSeparatedString with an error message about the method that - * was thrown. - * @param methodName - The publicly visible method name - * @param path - The dot-separated string form of a field path which will be - * split on dots. - * @param targetDoc - The document against which the field path will be - * evaluated. - */ - -function Sh(t, e, n) { - if (e.search(Vh) >= 0) throw Dh(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t, - /* hasConverter= */ - !1, - /* path= */ - void 0, n); - - try { - return new eh(...e.split("."))._internalPath; - } catch (s) { - throw Dh(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t, - /* hasConverter= */ - !1, - /* path= */ - void 0, n); - } -} - -function Dh(t, e, n, s, i) { - const r = s && !s.isEmpty(), - o = void 0 !== i; - let u = `Function ${e}() called with invalid data`; - n && (u += " (via `toFirestore()`)"), u += ". "; - let c = ""; - return (r || o) && (c += " (found", r && (c += ` in field ${s}`), o && (c += ` in document ${i}`), c += ")"), new Q(G.INVALID_ARGUMENT, u + t + c); -} -/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ - - -function Ch(t, e) { - return t.some(t => t.isEqual(e)); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A `DocumentSnapshot` contains data read from a document in your Firestore - * database. The data can be extracted with `.data()` or `.get()` to - * get a specific field. - * - * For a `DocumentSnapshot` that points to a non-existing document, any data - * access will return 'undefined'. You can use the `exists()` method to - * explicitly verify a document's existence. - */ - - -class xh { - // Note: This class is stripped down version of the DocumentSnapshot in - // the legacy SDK. The changes are: - // - No support for SnapshotMetadata. - // - No support for SnapshotOptions. - - /** @hideconstructor protected */ - constructor(t, e, n, s, i) { - this._firestore = t, this._userDataWriter = e, this._key = n, this._document = s, this._converter = i; - } - /** Property of the `DocumentSnapshot` that provides the document's ID. */ - - - get id() { - return this._key.path.lastSegment(); - } - /** - * The `DocumentReference` for the document included in the `DocumentSnapshot`. - */ - - - get ref() { - return new va(this._firestore, this._converter, this._key); - } - /** - * Signals whether or not the document at the snapshot's location exists. - * - * @returns true if the document exists. - */ - - - exists() { - return null !== this._document; - } - /** - * Retrieves all fields in the document as an `Object`. Returns `undefined` if - * the document doesn't exist. - * - * @returns An `Object` containing all fields in the document or `undefined` - * if the document doesn't exist. - */ - - - data() { - if (this._document) { - if (this._converter) { - // We only want to use the converter and create a new DocumentSnapshot - // if a converter has been provided. - const t = new Nh(this._firestore, this._userDataWriter, this._key, this._document, - /* converter= */ - null); - return this._converter.fromFirestore(t); - } - - return this._userDataWriter.convertValue(this._document.data.value); - } - } - /** - * Retrieves the field specified by `fieldPath`. Returns `undefined` if the - * document or field doesn't exist. - * - * @param fieldPath - The path (for example 'foo' or 'foo.bar') to a specific - * field. - * @returns The data at the specified field location or undefined if no such - * field exists in the document. - */ - // We are using `any` here to avoid an explicit cast by our users. - // eslint-disable-next-line @typescript-eslint/no-explicit-any - - - get(t) { - if (this._document) { - const e = this._document.data.field(kh("DocumentSnapshot.get", t)); - - if (null !== e) return this._userDataWriter.convertValue(e); - } - } - -} -/** - * A `QueryDocumentSnapshot` contains data read from a document in your - * Firestore database as part of a query. The document is guaranteed to exist - * and its data can be extracted with `.data()` or `.get()` to get a - * specific field. - * - * A `QueryDocumentSnapshot` offers the same API surface as a - * `DocumentSnapshot`. Since query results contain only existing documents, the - * `exists` property will always be true and `data()` will never return - * 'undefined'. - */ - - -class Nh extends xh { - /** - * Retrieves all fields in the document as an `Object`. - * - * @override - * @returns An `Object` containing all fields in the document. - */ - data() { - return super.data(); - } - -} -/** - * Helper that calls `fromDotSeparatedString()` but wraps any error thrown. - */ - - -function kh(t, e) { - return "string" == typeof e ? Sh(t, e) : e instanceof eh ? e._internalPath : e._delegate._internalPath; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Metadata about a snapshot, describing the state of the snapshot. - */ - - -class Mh { - /** @hideconstructor */ - constructor(t, e) { - this.hasPendingWrites = t, this.fromCache = e; - } - /** - * Returns true if this `SnapshotMetadata` is equal to the provided one. - * - * @param other - The `SnapshotMetadata` to compare against. - * @returns true if this `SnapshotMetadata` is equal to the provided one. - */ - - - isEqual(t) { - return this.hasPendingWrites === t.hasPendingWrites && this.fromCache === t.fromCache; - } - -} -/** - * A `DocumentSnapshot` contains data read from a document in your Firestore - * database. The data can be extracted with `.data()` or `.get()` to - * get a specific field. - * - * For a `DocumentSnapshot` that points to a non-existing document, any data - * access will return 'undefined'. You can use the `exists()` method to - * explicitly verify a document's existence. - */ - - -class Oh extends xh { - /** @hideconstructor protected */ - constructor(t, e, n, s, i, r) { - super(t, e, n, s, r), this._firestore = t, this._firestoreImpl = t, this.metadata = i; - } - /** - * Returns whether or not the data exists. True if the document exists. - */ - - - exists() { - return super.exists(); - } - /** - * Retrieves all fields in the document as an `Object`. Returns `undefined` if - * the document doesn't exist. - * - * By default, `serverTimestamp()` values that have not yet been - * set to their final value will be returned as `null`. You can override - * this by passing an options object. - * - * @param options - An options object to configure how data is retrieved from - * the snapshot (for example the desired behavior for server timestamps that - * have not yet been set to their final value). - * @returns An `Object` containing all fields in the document or `undefined` if - * the document doesn't exist. - */ - - - data() { - let t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - if (this._document) { - if (this._converter) { - // We only want to use the converter and create a new DocumentSnapshot - // if a converter has been provided. - const e = new Fh(this._firestore, this._userDataWriter, this._key, this._document, this.metadata, - /* converter= */ - null); - return this._converter.fromFirestore(e, t); - } - - return this._userDataWriter.convertValue(this._document.data.value, t.serverTimestamps); - } - } - /** - * Retrieves the field specified by `fieldPath`. Returns `undefined` if the - * document or field doesn't exist. - * - * By default, a `serverTimestamp()` that has not yet been set to - * its final value will be returned as `null`. You can override this by - * passing an options object. - * - * @param fieldPath - The path (for example 'foo' or 'foo.bar') to a specific - * field. - * @param options - An options object to configure how the field is retrieved - * from the snapshot (for example the desired behavior for server timestamps - * that have not yet been set to their final value). - * @returns The data at the specified field location or undefined if no such - * field exists in the document. - */ - // We are using `any` here to avoid an explicit cast by our users. - // eslint-disable-next-line @typescript-eslint/no-explicit-any - - - get(t) { - let e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - if (this._document) { - const n = this._document.data.field(kh("DocumentSnapshot.get", t)); - - if (null !== n) return this._userDataWriter.convertValue(n, e.serverTimestamps); - } - } - -} -/** - * A `QueryDocumentSnapshot` contains data read from a document in your - * Firestore database as part of a query. The document is guaranteed to exist - * and its data can be extracted with `.data()` or `.get()` to get a - * specific field. - * - * A `QueryDocumentSnapshot` offers the same API surface as a - * `DocumentSnapshot`. Since query results contain only existing documents, the - * `exists` property will always be true and `data()` will never return - * 'undefined'. - */ - - -class Fh extends Oh { - /** - * Retrieves all fields in the document as an `Object`. - * - * By default, `serverTimestamp()` values that have not yet been - * set to their final value will be returned as `null`. You can override - * this by passing an options object. - * - * @override - * @param options - An options object to configure how data is retrieved from - * the snapshot (for example the desired behavior for server timestamps that - * have not yet been set to their final value). - * @returns An `Object` containing all fields in the document. - */ - data() { - let t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - return super.data(t); - } - -} -/** - * A `QuerySnapshot` contains zero or more `DocumentSnapshot` objects - * representing the results of a query. The documents can be accessed as an - * array via the `docs` property or enumerated using the `forEach` method. The - * number of documents can be determined via the `empty` and `size` - * properties. - */ - - -class $h { - /** @hideconstructor */ - constructor(t, e, n, s) { - this._firestore = t, this._userDataWriter = e, this._snapshot = s, this.metadata = new Mh(s.hasPendingWrites, s.fromCache), this.query = n; - } - /** An array of all the documents in the `QuerySnapshot`. */ - - - get docs() { - const t = []; - return this.forEach(e => t.push(e)), t; - } - /** The number of documents in the `QuerySnapshot`. */ - - - get size() { - return this._snapshot.docs.size; - } - /** True if there are no documents in the `QuerySnapshot`. */ - - - get empty() { - return 0 === this.size; - } - /** - * Enumerates all of the documents in the `QuerySnapshot`. - * - * @param callback - A callback to be called with a `QueryDocumentSnapshot` for - * each document in the snapshot. - * @param thisArg - The `this` binding for the callback. - */ - - - forEach(t, e) { - this._snapshot.docs.forEach(n => { - t.call(e, new Fh(this._firestore, this._userDataWriter, n.key, n, new Mh(this._snapshot.mutatedKeys.has(n.key), this._snapshot.fromCache), this.query.converter)); - }); - } - /** - * Returns an array of the documents changes since the last snapshot. If this - * is the first snapshot, all documents will be in the list as 'added' - * changes. - * - * @param options - `SnapshotListenOptions` that control whether metadata-only - * changes (i.e. only `DocumentSnapshot.metadata` changed) should trigger - * snapshot events. - */ - - - docChanges() { - let t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - const e = !!t.includeMetadataChanges; - if (e && this._snapshot.excludesMetadataChanges) throw new Q(G.INVALID_ARGUMENT, "To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot()."); - return this._cachedChanges && this._cachedChangesIncludeMetadataChanges === e || (this._cachedChanges = - /** Calculates the array of `DocumentChange`s for a given `ViewSnapshot`. */ - function (t, e) { - if (t._snapshot.oldDocs.isEmpty()) { - let e = 0; - return t._snapshot.docChanges.map(n => ({ - type: "added", - doc: new Fh(t._firestore, t._userDataWriter, n.doc.key, n.doc, new Mh(t._snapshot.mutatedKeys.has(n.doc.key), t._snapshot.fromCache), t.query.converter), - oldIndex: -1, - newIndex: e++ - })); - } - - { - // A `DocumentSet` that is updated incrementally as changes are applied to use - // to lookup the index of a document. - let n = t._snapshot.oldDocs; - return t._snapshot.docChanges.filter(t => e || 3 - /* Metadata */ - !== t.type).map(e => { - const s = new Fh(t._firestore, t._userDataWriter, e.doc.key, e.doc, new Mh(t._snapshot.mutatedKeys.has(e.doc.key), t._snapshot.fromCache), t.query.converter); - let i = -1, - r = -1; - return 0 - /* Added */ - !== e.type && (i = n.indexOf(e.doc.key), n = n.delete(e.doc.key)), 1 - /* Removed */ - !== e.type && (n = n.add(e.doc), r = n.indexOf(e.doc.key)), { - type: Bh(e.type), - doc: s, - oldIndex: i, - newIndex: r - }; - }); - } - }(this, e), this._cachedChangesIncludeMetadataChanges = e), this._cachedChanges; - } - -} - -function Bh(t) { - switch (t) { - case 0 - /* Added */ - : - return "added"; - - case 2 - /* Modified */ - : - case 3 - /* Metadata */ - : - return "modified"; - - case 1 - /* Removed */ - : - return "removed"; - - default: - return L(); - } -} // TODO(firestoreexp): Add tests for snapshotEqual with different snapshot -// metadata - -/** - * Returns true if the provided snapshots are equal. - * - * @param left - A snapshot to compare. - * @param right - A snapshot to compare. - * @returns true if the snapshots are equal. - */ - - -function Lh(t, e) { - return t instanceof Oh && e instanceof Oh ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof $h && e instanceof $h && t._firestore === e._firestore && ka(t.query, e.query) && t.metadata.isEqual(e.metadata) && t._snapshot.isEqual(e._snapshot); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -function Uh(t) { - if ("L" - /* Last */ - === t.limitType && 0 === t.explicitOrderBy.length) throw new Q(G.UNIMPLEMENTED, "limitToLast() queries require specifying at least one orderBy() clause"); -} -/** - * A `QueryConstraint` is used to narrow the set of documents returned by a - * Firestore query. `QueryConstraint`s are created by invoking {@link where}, - * {@link orderBy}, {@link (startAt:1)}, {@link (startAfter:1)}, {@link - * endBefore:1}, {@link (endAt:1)}, {@link limit} or {@link limitToLast} and - * can then be passed to {@link query} to create a new query instance that - * also contains this `QueryConstraint`. - */ - - -class qh {} -/** - * Creates a new immutable instance of {@link Query} that is extended to also include - * additional query constraints. - * - * @param query - The {@link Query} instance to use as a base for the new constraints. - * @param queryConstraints - The list of {@link QueryConstraint}s to apply. - * @throws if any of the provided query constraints cannot be combined with the - * existing or new constraints. - */ - - -function Kh(t) { - for (var _len10 = arguments.length, e = new Array(_len10 > 1 ? _len10 - 1 : 0), _key10 = 1; _key10 < _len10; _key10++) { - e[_key10 - 1] = arguments[_key10]; - } - - for (const n of e) t = n._apply(t); - - return t; -} - -class Gh extends qh { - constructor(t, e, n) { - super(), this.wa = t, this.ma = e, this.ga = n, this.type = "where"; - } - - _apply(t) { - const e = fh(t.firestore), - n = function (t, e, n, s, i, r, o) { - let u; - - if (i.isKeyField()) { - if ("array-contains" - /* ARRAY_CONTAINS */ - === r || "array-contains-any" - /* ARRAY_CONTAINS_ANY */ - === r) throw new Q(G.INVALID_ARGUMENT, `Invalid Query. You can't perform '${r}' queries on documentId().`); - - if ("in" - /* IN */ - === r || "not-in" - /* NOT_IN */ - === r) { - rl(o, r); - const e = []; - - for (const n of o) e.push(il(s, t, n)); - - u = { - arrayValue: { - values: e - } - }; - } else u = il(s, t, o); - } else "in" - /* IN */ - !== r && "not-in" - /* NOT_IN */ - !== r && "array-contains-any" - /* ARRAY_CONTAINS_ANY */ - !== r || rl(o, r), u = Eh(n, e, o, - /* allowArrays= */ - "in" - /* IN */ - === r || "not-in" - /* NOT_IN */ - === r); - - const c = Ge.create(i, r, u); - return function (t, e) { - if (e.dt()) { - const n = hn(t); - if (null !== n && !n.isEqual(e.field)) throw new Q(G.INVALID_ARGUMENT, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${e.field.toString()}'`); - const s = an(t); - null !== s && ol(t, e.field, s); - } - - const n = function (t, e) { - for (const n of t.filters) if (e.indexOf(n.op) >= 0) return n.op; - - return null; - }(t, - /** - * Given an operator, returns the set of operators that cannot be used with it. - * - * Operators in a query must adhere to the following set of rules: - * 1. Only one array operator is allowed. - * 2. Only one disjunctive operator is allowed. - * 3. `NOT_EQUAL` cannot be used with another `NOT_EQUAL` operator. - * 4. `NOT_IN` cannot be used with array, disjunctive, or `NOT_EQUAL` operators. - * - * Array operators: `ARRAY_CONTAINS`, `ARRAY_CONTAINS_ANY` - * Disjunctive operators: `IN`, `ARRAY_CONTAINS_ANY`, `NOT_IN` - */ - function (t) { - switch (t) { - case "!=" - /* NOT_EQUAL */ - : - return ["!=" - /* NOT_EQUAL */ - , "not-in" - /* NOT_IN */ - ]; - - case "array-contains" - /* ARRAY_CONTAINS */ - : - return ["array-contains" - /* ARRAY_CONTAINS */ - , "array-contains-any" - /* ARRAY_CONTAINS_ANY */ - , "not-in" - /* NOT_IN */ - ]; - - case "in" - /* IN */ - : - return ["array-contains-any" - /* ARRAY_CONTAINS_ANY */ - , "in" - /* IN */ - , "not-in" - /* NOT_IN */ - ]; - - case "array-contains-any" - /* ARRAY_CONTAINS_ANY */ - : - return ["array-contains" - /* ARRAY_CONTAINS */ - , "array-contains-any" - /* ARRAY_CONTAINS_ANY */ - , "in" - /* IN */ - , "not-in" - /* NOT_IN */ - ]; - - case "not-in" - /* NOT_IN */ - : - return ["array-contains" - /* ARRAY_CONTAINS */ - , "array-contains-any" - /* ARRAY_CONTAINS_ANY */ - , "in" - /* IN */ - , "not-in" - /* NOT_IN */ - , "!=" - /* NOT_EQUAL */ - ]; - - default: - return []; - } - }(e.op)); - - if (null !== n) // Special case when it's a duplicate op to give a slightly clearer error message. - throw n === e.op ? new Q(G.INVALID_ARGUMENT, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new Q(G.INVALID_ARGUMENT, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`); - }(t, c), c; - }(t._query, "where", e, t.firestore._databaseId, this.wa, this.ma, this.ga); - - return new Va(t.firestore, t.converter, function (t, e) { - const n = t.filters.concat([e]); - return new rn(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt); - }(t._query, n)); - } - -} -/** - * Creates a {@link QueryConstraint} that enforces that documents must contain the - * specified field and that the value should satisfy the relation constraint - * provided. - * - * @param fieldPath - The path to compare - * @param opStr - The operation string (e.g "<", "<=", "==", "<", - * "<=", "!="). - * @param value - The value for comparison - * @returns The created {@link Query}. - */ - - -function Qh(t, e, n) { - const s = e, - i = kh("where", t); - return new Gh(i, s, n); -} - -class jh extends qh { - constructor(t, e) { - super(), this.wa = t, this.ya = e, this.type = "orderBy"; - } - - _apply(t) { - const e = function (t, e, n) { - if (null !== t.startAt) throw new Q(G.INVALID_ARGUMENT, "Invalid query. You must not call startAt() or startAfter() before calling orderBy()."); - if (null !== t.endAt) throw new Q(G.INVALID_ARGUMENT, "Invalid query. You must not call endAt() or endBefore() before calling orderBy()."); - const s = new tn(e, n); - return function (t, e) { - if (null === an(t)) { - // This is the first order by. It must match any inequality. - const n = hn(t); - null !== n && ol(t, n, e.field); - } - }(t, s), s; - } - /** - * Create a `Bound` from a query and a document. - * - * Note that the `Bound` will always include the key of the document - * and so only the provided document will compare equal to the returned - * position. - * - * Will throw if the document does not contain all fields of the order by - * of the query or if any of the fields in the order by are an uncommitted - * server timestamp. - */ - (t._query, this.wa, this.ya); - - return new Va(t.firestore, t.converter, function (t, e) { - // TODO(dimond): validate that orderBy does not list the same key twice. - const n = t.explicitOrderBy.concat([e]); - return new rn(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt); - }(t._query, e)); - } - -} -/** - * Creates a {@link QueryConstraint} that sorts the query result by the - * specified field, optionally in descending order instead of ascending. - * - * @param fieldPath - The field to sort by. - * @param directionStr - Optional direction to sort by ('asc' or 'desc'). If - * not specified, order will be ascending. - * @returns The created {@link Query}. - */ - - -function Wh(t) { - let e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "asc"; - const n = e, - s = kh("orderBy", t); - return new jh(s, n); -} - -class zh extends qh { - constructor(t, e, n) { - super(), this.type = t, this.pa = e, this.Ia = n; - } - - _apply(t) { - return new Va(t.firestore, t.converter, _n(t._query, this.pa, this.Ia)); - } - -} -/** - * Creates a {@link QueryConstraint} that only returns the first matching documents. - * - * @param limit - The maximum number of items to return. - * @returns The created {@link Query}. - */ - - -function Hh(t) { - return Aa("limit", t), new zh("limit", t, "F" - /* First */ - ); -} -/** - * Creates a {@link QueryConstraint} that only returns the last matching documents. - * - * You must specify at least one `orderBy` clause for `limitToLast` queries, - * otherwise an exception will be thrown during execution. - * - * @param limit - The maximum number of items to return. - * @returns The created {@link Query}. - */ - - -function Jh(t) { - return Aa("limitToLast", t), new zh("limitToLast", t, "L" - /* Last */ - ); -} - -class Yh extends qh { - constructor(t, e, n) { - super(), this.type = t, this.Ta = e, this.Ea = n; - } - - _apply(t) { - const e = sl(t, this.type, this.Ta, this.Ea); - return new Va(t.firestore, t.converter, function (t, e) { - return new rn(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt); - }(t._query, e)); - } - -} - -function Xh() { - for (var _len11 = arguments.length, t = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) { - t[_key11] = arguments[_key11]; - } - - return new Yh("startAt", t, - /*inclusive=*/ - !0); -} - -function Zh() { - for (var _len12 = arguments.length, t = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) { - t[_key12] = arguments[_key12]; - } - - return new Yh("startAfter", t, - /*inclusive=*/ - !1); -} - -class tl extends qh { - constructor(t, e, n) { - super(), this.type = t, this.Ta = e, this.Ea = n; - } - - _apply(t) { - const e = sl(t, this.type, this.Ta, this.Ea); - return new Va(t.firestore, t.converter, function (t, e) { - return new rn(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e); - }(t._query, e)); - } - -} - -function el() { - for (var _len13 = arguments.length, t = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) { - t[_key13] = arguments[_key13]; - } - - return new tl("endBefore", t, - /*inclusive=*/ - !1); -} - -function nl() { - for (var _len14 = arguments.length, t = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) { - t[_key14] = arguments[_key14]; - } - - return new tl("endAt", t, - /*inclusive=*/ - !0); -} -/** Helper function to create a bound from a document or fields */ - - -function sl(t, e, n, s) { - if (n[0] = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(n[0]), n[0] instanceof xh) return function (t, e, n, s, i) { - if (!s) throw new Q(G.NOT_FOUND, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`); - const r = []; // Because people expect to continue/end a query at the exact document - // provided, we need to use the implicit sort order rather than the explicit - // sort order, because it's guaranteed to contain the document key. That way - // the position becomes unambiguous and the query continues/ends exactly at - // the provided document. Without the key (by using the explicit sort - // orders), multiple documents could match the position, yielding duplicate - // results. - - for (const n of fn(t)) if (n.field.isKeyField()) r.push(Ie(e, s.key));else { - const t = s.data.field(n.field); - if (se(t)) throw new Q(G.INVALID_ARGUMENT, 'Invalid query. You are trying to start or end a query using a document for which the field "' + n.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)'); - - if (null === t) { - const t = n.field.canonicalString(); - throw new Q(G.INVALID_ARGUMENT, `Invalid query. You are trying to start or end a query using a document for which the field '${t}' (used as the orderBy) does not exist.`); - } - - r.push(t); - } - - return new Ze(r, i); - } - /** - * Converts a list of field values to a `Bound` for the given query. - */ - (t._query, t.firestore._databaseId, e, n[0]._document, s); - { - const i = fh(t.firestore); - return function (t, e, n, s, i, r) { - // Use explicit order by's because it has to match the query the user made - const o = t.explicitOrderBy; - if (i.length > o.length) throw new Q(G.INVALID_ARGUMENT, `Too many arguments provided to ${s}(). The number of arguments must be less than or equal to the number of orderBy() clauses`); - const u = []; - - for (let r = 0; r < i.length; r++) { - const c = i[r]; - - if (o[r].field.isKeyField()) { - if ("string" != typeof c) throw new Q(G.INVALID_ARGUMENT, `Invalid query. Expected a string for document ID in ${s}(), but got a ${typeof c}`); - if (!ln(t) && -1 !== c.indexOf("/")) throw new Q(G.INVALID_ARGUMENT, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${s}() must be a plain document ID, but '${c}' contains a slash.`); - const n = t.path.child(ht.fromString(c)); - if (!dt.isDocumentKey(n)) throw new Q(G.INVALID_ARGUMENT, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${s}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`); - const i = new dt(n); - u.push(Ie(e, i)); - } else { - const t = Eh(n, s, c); - u.push(t); - } - } - - return new Ze(u, r); - } - /** - * Parses the given `documentIdValue` into a `ReferenceValue`, throwing - * appropriate errors if the value is anything other than a `DocumentReference` - * or `string`, or if the string is malformed. - */ - (t._query, t.firestore._databaseId, i, e, n, s); - } -} - -function il(t, e, n) { - if ("string" == typeof (n = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(n))) { - if ("" === n) throw new Q(G.INVALID_ARGUMENT, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string."); - if (!ln(e) && -1 !== n.indexOf("/")) throw new Q(G.INVALID_ARGUMENT, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`); - const s = e.path.child(ht.fromString(n)); - if (!dt.isDocumentKey(s)) throw new Q(G.INVALID_ARGUMENT, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${s}' is not because it has an odd number of segments (${s.length}).`); - return Ie(t, new dt(s)); - } - - if (n instanceof va) return Ie(t, n._key); - throw new Q(G.INVALID_ARGUMENT, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Ta(n)}.`); -} -/** - * Validates that the value passed into a disjunctive filter satisfies all - * array requirements. - */ - - -function rl(t, e) { - if (!Array.isArray(t) || 0 === t.length) throw new Q(G.INVALID_ARGUMENT, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`); - if (t.length > 10) throw new Q(G.INVALID_ARGUMENT, `Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`); -} - -function ol(t, e, n) { - if (!n.isEqual(e)) throw new Q(G.INVALID_ARGUMENT, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`); -} -/** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const ul = { - maxAttempts: 5 -}; -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Converts Firestore's internal types to the JavaScript types that we expose - * to the user. - * - * @internal - */ - -class cl { - convertValue(t) { - let e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "none"; - - switch (de(t)) { - case 0 - /* NullValue */ - : - return null; - - case 1 - /* BooleanValue */ - : - return t.booleanValue; - - case 2 - /* NumberValue */ - : - return ee(t.integerValue || t.doubleValue); - - case 3 - /* TimestampValue */ - : - return this.convertTimestamp(t.timestampValue); - - case 4 - /* ServerTimestampValue */ - : - return this.convertServerTimestamp(t, e); - - case 5 - /* StringValue */ - : - return t.stringValue; - - case 6 - /* BlobValue */ - : - return this.convertBytes(ne(t.bytesValue)); - - case 7 - /* RefValue */ - : - return this.convertReference(t.referenceValue); - - case 8 - /* GeoPointValue */ - : - return this.convertGeoPoint(t.geoPointValue); - - case 9 - /* ArrayValue */ - : - return this.convertArray(t.arrayValue, e); - - case 10 - /* ObjectValue */ - : - return this.convertObject(t.mapValue, e); - - default: - throw L(); - } - } - - convertObject(t, e) { - const n = {}; - return qt(t.fields, (t, s) => { - n[t] = this.convertValue(s, e); - }), n; - } - - convertGeoPoint(t) { - return new rh(ee(t.latitude), ee(t.longitude)); - } - - convertArray(t, e) { - return (t.values || []).map(t => this.convertValue(t, e)); - } - - convertServerTimestamp(t, e) { - switch (e) { - case "previous": - const n = ie(t); - return null == n ? null : this.convertValue(n, e); - - case "estimate": - return this.convertTimestamp(re(t)); - - default: - return null; - } - } - - convertTimestamp(t) { - const e = te(t); - return new ut(e.seconds, e.nanos); - } - - convertDocumentKey(t, e) { - const n = ht.fromString(t); - U(ai(n)); - const s = new ue(n.get(1), n.get(3)), - i = new dt(n.popFirst(5)); - return s.isEqual(e) || // TODO(b/64130202): Somehow support foreign references. - F(`Document ${i} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`), i; - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Converts custom model object of type T into `DocumentData` by applying the - * converter if it exists. - * - * This function is used when converting user objects to `DocumentData` - * because we want to provide the user with a more specific error message if - * their `set()` or fails due to invalid data originating from a `toFirestore()` - * call. - */ - - -function al(t, e, n) { - let s; // Cast to `any` in order to satisfy the union type constraint on - // toFirestore(). - // eslint-disable-next-line @typescript-eslint/no-explicit-any - - return s = t ? n && (n.merge || n.mergeFields) ? t.toFirestore(e, n) : t.toFirestore(e) : e, s; -} - -class hl extends cl { - constructor(t) { - super(), this.firestore = t; - } - - convertBytes(t) { - return new sh(t); - } - - convertReference(t) { - const e = this.convertDocumentKey(t, this.firestore._databaseId); - return new va(this.firestore, - /* converter= */ - null, e); - } - -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A write batch, used to perform multiple writes as a single atomic unit. - * - * A `WriteBatch` object can be acquired by calling {@link writeBatch}. It - * provides methods for adding writes to the write batch. None of the writes - * will be committed (or visible locally) until {@link WriteBatch.commit} is - * called. - */ - - -class ll { - /** @hideconstructor */ - constructor(t, e) { - this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1, this._dataReader = fh(t); - } - - set(t, e, n) { - this._verifyNotCommitted(); - - const s = fl(t, this._firestore), - i = al(s.converter, e, n), - r = dh(this._dataReader, "WriteBatch.set", s._key, i, null !== s.converter, n); - return this._mutations.push(r.toMutation(s._key, Ln.none())), this; - } - - update(t, e, n) { - this._verifyNotCommitted(); - - const i = fl(t, this._firestore); // For Compat types, we have to "extract" the underlying types before - // performing validation. - - let r; - - for (var _len15 = arguments.length, s = new Array(_len15 > 3 ? _len15 - 3 : 0), _key15 = 3; _key15 < _len15; _key15++) { - s[_key15 - 3] = arguments[_key15]; - } - - return r = "string" == typeof (e = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(e)) || e instanceof eh ? Th(this._dataReader, "WriteBatch.update", i._key, e, n, s) : Ih(this._dataReader, "WriteBatch.update", i._key, e), this._mutations.push(r.toMutation(i._key, Ln.exists(!0))), this; - } - /** - * Deletes the document referred to by the provided {@link DocumentReference}. - * - * @param documentRef - A reference to the document to be deleted. - * @returns This `WriteBatch` instance. Used for chaining method calls. - */ - - - delete(t) { - this._verifyNotCommitted(); - - const e = fl(t, this._firestore); - return this._mutations = this._mutations.concat(new Zn(e._key, Ln.none())), this; - } - /** - * Commits all of the writes in this write batch as a single atomic unit. - * - * The result of these writes will only be reflected in document reads that - * occur after the returned promise resolves. If the client is offline, the - * write fails. If you would like to see local modifications or buffer writes - * until the client is online, use the full Firestore SDK. - * - * @returns A `Promise` resolved once all of the writes in the batch have been - * successfully written to the backend as an atomic unit (note that it won't - * resolve while you're offline). - */ - - - commit() { - return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve(); - } - - _verifyNotCommitted() { - if (this._committed) throw new Q(G.FAILED_PRECONDITION, "A write batch can no longer be used after commit() has been called."); - } - -} - -function fl(t, e) { - if ((t = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(t)).firestore !== e) throw new Q(G.INVALID_ARGUMENT, "Provided document reference is from a different Firestore instance."); - return t; -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// TODO(mrschmidt) Consider using `BaseTransaction` as the base class in the -// legacy SDK. - -/** - * A reference to a transaction. - * - * The `Transaction` object passed to a transaction's `updateFunction` provides - * the methods to read and write data within the transaction context. See - * {@link runTransaction}. - */ - -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Reads the document referred to by this `DocumentReference`. - * - * Note: `getDoc()` attempts to provide up-to-date data when possible by waiting - * for data from the server, but it may return cached data or fail if you are - * offline and the server cannot be reached. To specify this behavior, invoke - * {@link getDocFromCache} or {@link getDocFromServer}. - * - * @param reference - The reference of the document to fetch. - * @returns A Promise resolved with a `DocumentSnapshot` containing the - * current document contents. - */ - - -function dl(t) { - t = Ea(t, va); - const e = Ea(t.firestore, Ba); - return aa(qa(e), t._key).then(n => vl(e, t, n)); -} - -class _l extends cl { - constructor(t) { - super(), this.firestore = t; - } - - convertBytes(t) { - return new sh(t); - } - - convertReference(t) { - const e = this.convertDocumentKey(t, this.firestore._databaseId); - return new va(this.firestore, - /* converter= */ - null, e); - } - -} -/** - * Reads the document referred to by this `DocumentReference` from cache. - * Returns an error if the document is not currently cached. - * - * @returns A `Promise` resolved with a `DocumentSnapshot` containing the - * current document contents. - */ - - -function wl(t) { - t = Ea(t, va); - const e = Ea(t.firestore, Ba), - n = qa(e), - s = new _l(e); - return ca(n, t._key).then(n => new Oh(e, s, t._key, n, new Mh(null !== n && n.hasLocalMutations, - /* fromCache= */ - !0), t.converter)); -} -/** - * Reads the document referred to by this `DocumentReference` from the server. - * Returns an error if the network is not available. - * - * @returns A `Promise` resolved with a `DocumentSnapshot` containing the - * current document contents. - */ - - -function ml(t) { - t = Ea(t, va); - const e = Ea(t.firestore, Ba); - return aa(qa(e), t._key, { - source: "server" - }).then(n => vl(e, t, n)); -} -/** - * Executes the query and returns the results as a `QuerySnapshot`. - * - * Note: `getDocs()` attempts to provide up-to-date data when possible by - * waiting for data from the server, but it may return cached data or fail if - * you are offline and the server cannot be reached. To specify this behavior, - * invoke {@link getDocsFromCache} or {@link getDocsFromServer}. - * - * @returns A `Promise` that will be resolved with the results of the query. - */ - - -function gl(t) { - t = Ea(t, Va); - const e = Ea(t.firestore, Ba), - n = qa(e), - s = new _l(e); - return Uh(t._query), la(n, t._query).then(n => new $h(e, s, t, n)); -} -/** - * Executes the query and returns the results as a `QuerySnapshot` from cache. - * Returns an error if the document is not currently cached. - * - * @returns A `Promise` that will be resolved with the results of the query. - */ - - -function yl(t) { - t = Ea(t, Va); - const e = Ea(t.firestore, Ba), - n = qa(e), - s = new _l(e); - return ha(n, t._query).then(n => new $h(e, s, t, n)); -} -/** - * Executes the query and returns the results as a `QuerySnapshot` from the - * server. Returns an error if the network is not available. - * - * @returns A `Promise` that will be resolved with the results of the query. - */ - - -function pl(t) { - t = Ea(t, Va); - const e = Ea(t.firestore, Ba), - n = qa(e), - s = new _l(e); - return la(n, t._query, { - source: "server" - }).then(n => new $h(e, s, t, n)); -} - -function Il(t, e, n) { - t = Ea(t, va); - const s = Ea(t.firestore, Ba), - i = al(t.converter, e, n); - return Pl(s, [dh(fh(s), "setDoc", t._key, i, null !== t.converter, n).toMutation(t._key, Ln.none())]); -} - -function Tl(t, e, n) { - t = Ea(t, va); - const i = Ea(t.firestore, Ba), - r = fh(i); - let o; - - for (var _len16 = arguments.length, s = new Array(_len16 > 3 ? _len16 - 3 : 0), _key16 = 3; _key16 < _len16; _key16++) { - s[_key16 - 3] = arguments[_key16]; - } - - o = "string" == typeof ( // For Compat types, we have to "extract" the underlying types before - // performing validation. - e = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(e)) || e instanceof eh ? Th(r, "updateDoc", t._key, e, n, s) : Ih(r, "updateDoc", t._key, e); - return Pl(i, [o.toMutation(t._key, Ln.exists(!0))]); -} -/** - * Deletes the document referred to by the specified `DocumentReference`. - * - * @param reference - A reference to the document to delete. - * @returns A Promise resolved once the document has been successfully - * deleted from the backend (note that it won't resolve while you're offline). - */ - - -function El(t) { - return Pl(Ea(t.firestore, Ba), [new Zn(t._key, Ln.none())]); -} -/** - * Add a new document to specified `CollectionReference` with the given data, - * assigning it a document ID automatically. - * - * @param reference - A reference to the collection to add this document to. - * @param data - An Object containing the data for the new document. - * @returns A `Promise` resolved with a `DocumentReference` pointing to the - * newly created document after it has been written to the backend (Note that it - * won't resolve while you're offline). - */ - - -function Al(t, e) { - const n = Ea(t.firestore, Ba), - s = xa(t), - i = al(t.converter, e); - return Pl(n, [dh(fh(t.firestore), "addDoc", s._key, i, null !== t.converter, {}).toMutation(s._key, Ln.exists(!1))]).then(() => s); -} - -function Rl(t) { - for (var _len17 = arguments.length, e = new Array(_len17 > 1 ? _len17 - 1 : 0), _key17 = 1; _key17 < _len17; _key17++) { - e[_key17 - 1] = arguments[_key17]; - } - - var n, s, i; - t = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(t); - let r = { - includeMetadataChanges: !1 - }, - o = 0; - "object" != typeof e[o] || Oa(e[o]) || (r = e[o], o++); - const u = { - includeMetadataChanges: r.includeMetadataChanges - }; - - if (Oa(e[o])) { - const t = e[o]; - e[o] = null === (n = t.next) || void 0 === n ? void 0 : n.bind(t), e[o + 1] = null === (s = t.error) || void 0 === s ? void 0 : s.bind(t), e[o + 2] = null === (i = t.complete) || void 0 === i ? void 0 : i.bind(t); - } - - let c, a, h; - if (t instanceof va) a = Ea(t.firestore, Ba), h = un(t._key.path), c = { - next: n => { - e[o] && e[o](vl(a, t, n)); - }, - error: e[o + 1], - complete: e[o + 2] - };else { - const n = Ea(t, Va); - a = Ea(n.firestore, Ba), h = n._query; - const s = new _l(a); - c = { - next: t => { - e[o] && e[o](new $h(a, s, n, t)); - }, - error: e[o + 1], - complete: e[o + 2] - }, Uh(t._query); - } - return function (t, e, n, s) { - const i = new jc(s), - r = new Xu(e, i, n); - return t.asyncQueue.enqueueAndForget(async () => Wu(await ra(t), r)), () => { - i.Rc(), t.asyncQueue.enqueueAndForget(async () => zu(await ra(t), r)); - }; - }(qa(a), h, u, c); -} - -function bl(t, e) { - return fa(qa(t = Ea(t, Ba)), Oa(e) ? e : { - next: e - }); -} -/** - * Locally writes `mutations` on the async queue. - * @internal - */ - - -function Pl(t, e) { - return function (t, e) { - const n = new j(); - return t.asyncQueue.enqueueAndForget(async () => fc(await ia(t), e, n)), n.promise; - }(qa(t), e); -} -/** - * Converts a {@link ViewSnapshot} that contains the single document specified by `ref` - * to a {@link DocumentSnapshot}. - */ - - -function vl(t, e, n) { - const s = n.docs.get(e._key), - i = new _l(t); - return new Oh(t, i, e._key, s, new Mh(n.hasPendingWrites, n.fromCache), e.converter); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A reference to a transaction. - * - * The `Transaction` object passed to a transaction's `updateFunction` provides - * the methods to read and write data within the transaction context. See - * {@link runTransaction}. - */ - - -class Vl extends class { - /** @hideconstructor */ - constructor(t, e) { - this._firestore = t, this._transaction = e, this._dataReader = fh(t); - } - /** - * Reads the document referenced by the provided {@link DocumentReference}. - * - * @param documentRef - A reference to the document to be read. - * @returns A `DocumentSnapshot` with the read data. - */ - - - get(t) { - const e = fl(t, this._firestore), - n = new hl(this._firestore); - return this._transaction.lookup([e._key]).then(t => { - if (!t || 1 !== t.length) return L(); - const s = t[0]; - if (s.isFoundDocument()) return new xh(this._firestore, n, s.key, s, e.converter); - if (s.isNoDocument()) return new xh(this._firestore, n, e._key, null, e.converter); - throw L(); - }); - } - - set(t, e, n) { - const s = fl(t, this._firestore), - i = al(s.converter, e, n), - r = dh(this._dataReader, "Transaction.set", s._key, i, null !== s.converter, n); - return this._transaction.set(s._key, r), this; - } - - update(t, e, n) { - const i = fl(t, this._firestore); // For Compat types, we have to "extract" the underlying types before - // performing validation. - - let r; - - for (var _len18 = arguments.length, s = new Array(_len18 > 3 ? _len18 - 3 : 0), _key18 = 3; _key18 < _len18; _key18++) { - s[_key18 - 3] = arguments[_key18]; - } - - return r = "string" == typeof (e = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(e)) || e instanceof eh ? Th(this._dataReader, "Transaction.update", i._key, e, n, s) : Ih(this._dataReader, "Transaction.update", i._key, e), this._transaction.update(i._key, r), this; - } - /** - * Deletes the document referred to by the provided {@link DocumentReference}. - * - * @param documentRef - A reference to the document to be deleted. - * @returns This `Transaction` instance. Used for chaining method calls. - */ - - - delete(t) { - const e = fl(t, this._firestore); - return this._transaction.delete(e._key), this; - } - -} { - // This class implements the same logic as the Transaction API in the Lite SDK - // but is subclassed in order to return its own DocumentSnapshot types. - - /** @hideconstructor */ - constructor(t, e) { - super(t, e), this._firestore = t; - } - /** - * Reads the document referenced by the provided {@link DocumentReference}. - * - * @param documentRef - A reference to the document to be read. - * @returns A `DocumentSnapshot` with the read data. - */ - - - get(t) { - const e = fl(t, this._firestore), - n = new _l(this._firestore); - return super.get(t).then(t => new Oh(this._firestore, n, e._key, t._document, new Mh( - /* hasPendingWrites= */ - !1, - /* fromCache= */ - !1), e.converter)); - } - -} -/** - * Executes the given `updateFunction` and then attempts to commit the changes - * applied within the transaction. If any document read within the transaction - * has changed, Cloud Firestore retries the `updateFunction`. If it fails to - * commit after 5 attempts, the transaction fails. - * - * The maximum number of writes allowed in a single transaction is 500. - * - * @param firestore - A reference to the Firestore database to run this - * transaction against. - * @param updateFunction - The function to execute within the transaction - * context. - * @param options - An options object to configure maximum number of attempts to - * commit. - * @returns If the transaction completed successfully or was explicitly aborted - * (the `updateFunction` returned a failed promise), the promise returned by the - * `updateFunction `is returned here. Otherwise, if the transaction failed, a - * rejected promise with the corresponding failure error is returned. - */ - - -function Sl(t, e, n) { - t = Ea(t, Ba); - const s = Object.assign(Object.assign({}, ul), n); - !function (t) { - if (t.maxAttempts < 1) throw new Q(G.INVALID_ARGUMENT, "Max attempts must be at least 1"); - }(s); - return da(qa(t), n => e(new Vl(t, n)), s); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or - * {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion. - */ - - -function Dl() { - return new _h("deleteField"); -} -/** - * Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to - * include a server-generated timestamp in the written data. - */ - - -function Cl() { - return new mh("serverTimestamp"); -} -/** - * Returns a special value that can be used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link - * @firebase/firestore/lite#(updateDoc:1)} that tells the server to union the given elements with any array - * value that already exists on the server. Each specified element that doesn't - * already exist in the array will be added to the end. If the field being - * modified is not already an array it will be overwritten with an array - * containing exactly the specified elements. - * - * @param elements - The elements to union into the array. - * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or - * `updateDoc()`. - */ - - -function xl() { - for (var _len19 = arguments.length, t = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) { - t[_key19] = arguments[_key19]; - } - - // NOTE: We don't actually parse the data until it's used in set() or - // update() since we'd need the Firestore instance to do this. - return new gh("arrayUnion", t); -} -/** - * Returns a special value that can be used with {@link (setDoc:1)} or {@link - * updateDoc:1} that tells the server to remove the given elements from any - * array value that already exists on the server. All instances of each element - * specified will be removed from the array. If the field being modified is not - * already an array it will be overwritten with an empty array. - * - * @param elements - The elements to remove from the array. - * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or - * `updateDoc()` - */ - - -function Nl() { - for (var _len20 = arguments.length, t = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) { - t[_key20] = arguments[_key20]; - } - - // NOTE: We don't actually parse the data until it's used in set() or - // update() since we'd need the Firestore instance to do this. - return new yh("arrayRemove", t); -} -/** - * Returns a special value that can be used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link - * @firebase/firestore/lite#(updateDoc:1)} that tells the server to increment the field's current value by - * the given value. - * - * If either the operand or the current field value uses floating point - * precision, all arithmetic follows IEEE 754 semantics. If both values are - * integers, values outside of JavaScript's safe number range - * (`Number.MIN_SAFE_INTEGER` to `Number.MAX_SAFE_INTEGER`) are also subject to - * precision loss. Furthermore, once processed by the Firestore backend, all - * integer operations are capped between -2^63 and 2^63-1. - * - * If the current field value is not of type `number`, or if the field does not - * yet exist, the transformation sets the field to the given value. - * - * @param n - The value to increment by. - * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or - * `updateDoc()` - */ - - -function kl(t) { - return new ph("increment", t); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Creates a write batch, used for performing multiple writes as a single - * atomic operation. The maximum number of writes allowed in a single {@link WriteBatch} - * is 500. - * - * Unlike transactions, write batches are persisted offline and therefore are - * preferable when you don't need to condition your writes on read data. - * - * @returns A {@link WriteBatch} that can be used to atomically execute multiple - * writes. - */ - - -function Ml(t) { - return qa(t = Ea(t, Ba)), new ll(t, e => Pl(t, e)); -} -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -function Ol(t, e) { - var n; - const s = qa(t = Ea(t, Ba)); // PORTING NOTE: We don't return an error if the user has not enabled - // persistence since `enableIndexeddbPersistence()` can fail on the Web. - - if (!(null === (n = s.offlineComponents) || void 0 === n ? void 0 : n.indexBackfillerScheduler)) return $("Cannot enable indexes when persistence is disabled"), Promise.resolve(); - - const i = function (t) { - const e = "string" == typeof t ? function (t) { - var e; - - try { - return JSON.parse(t); - } catch (t) { - throw new Q(G.INVALID_ARGUMENT, "Failed to parse JSON: " + (null === (e = t) || void 0 === e ? void 0 : e.message)); - } - }(t) : t, - n = []; - if (Array.isArray(e.indexes)) for (const t of e.indexes) { - const e = Fl(t, "collectionGroup"), - s = []; - if (Array.isArray(t.fields)) for (const e of t.fields) { - const t = Sh("setIndexConfiguration", Fl(e, "fieldPath")); - "CONTAINS" === e.arrayConfig ? s.push(new yt(t, 2 - /* CONTAINS */ - )) : "ASCENDING" === e.order ? s.push(new yt(t, 0 - /* ASCENDING */ - )) : "DESCENDING" === e.order && s.push(new yt(t, 1 - /* DESCENDING */ - )); - } - n.push(new _t(_t.UNKNOWN_ID, e, s, It.empty())); - } - return n; - }(e); - - return na(s).then(t => async function (t, e) { - const n = K(t), - s = n.indexManager, - i = []; - return n.persistence.runTransaction("Configure indexes", "readwrite", t => s.getFieldIndexes(t).next(n => function (t, e, n, s, i) { - t = [...t], e = [...e], t.sort(n), e.sort(n); - const r = t.length, - o = e.length; - let u = 0, - c = 0; - - for (; u < o && c < r;) { - const r = n(t[c], e[u]); - r < 0 ? // The element was removed if the next element in our ordered - // walkthrough is only in `before`. - i(t[c++]) : r > 0 ? // The element was added if the next element in our ordered walkthrough - // is only in `after`. - s(e[u++]) : (u++, c++); - } - - for (; u < o;) s(e[u++]); - - for (; c < r;) i(t[c++]); - }(n, e, gt, e => { - i.push(s.addFieldIndex(t, e)); - }, e => { - i.push(s.deleteFieldIndex(t, e)); - })).next(() => Vt.waitFor(i))); - } - /** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - // The format of the LocalStorage key that stores the client state is: - // firestore_clients__ - (t, i)); -} - -function Fl(t, e) { - if ("string" != typeof t[e]) throw new Q(G.INVALID_ARGUMENT, "Missing string value for: " + e); - return t[e]; -} -/** - * Cloud Firestore - * - * @packageDocumentation - */ - - -!function (t) { - let e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0; - !function (t) { - x = t; - }(_firebase_app__WEBPACK_IMPORTED_MODULE_0__.SDK_VERSION), (0,_firebase_app__WEBPACK_IMPORTED_MODULE_0__._registerComponent)(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__.Component("firestore", (t, _ref13) => { - let { - instanceIdentifier: n, - options: s - } = _ref13; - const i = t.getProvider("app").getImmediate(), - r = new Ba(new J(t.getProvider("auth-internal")), new tt(t.getProvider("app-check-internal")), function (t, e) { - if (!Object.prototype.hasOwnProperty.apply(t.options, ["projectId"])) throw new Q(G.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.'); - return new ue(t.options.projectId, e); - } - /** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - /** Sentinel value that sorts before any Mutation Batch ID. */ - (i, n), i); - return s = Object.assign({ - useFetchStreams: e - }, s), r._setSettings(s), r; - }, "PUBLIC").setMultipleInstances(!0)), (0,_firebase_app__WEBPACK_IMPORTED_MODULE_0__.registerVersion)(D, "3.4.15", t), // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation - (0,_firebase_app__WEBPACK_IMPORTED_MODULE_0__.registerVersion)(D, "3.4.15", "esm2017"); -}(); - - -/***/ }), - -/***/ "./node_modules/@firebase/util/dist/index.esm2017.js": -/*!***********************************************************!*\ - !*** ./node_modules/@firebase/util/dist/index.esm2017.js ***! - \***********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "CONSTANTS": () => (/* binding */ CONSTANTS), -/* harmony export */ "Deferred": () => (/* binding */ Deferred), -/* harmony export */ "ErrorFactory": () => (/* binding */ ErrorFactory), -/* harmony export */ "FirebaseError": () => (/* binding */ FirebaseError), -/* harmony export */ "MAX_VALUE_MILLIS": () => (/* binding */ MAX_VALUE_MILLIS), -/* harmony export */ "RANDOM_FACTOR": () => (/* binding */ RANDOM_FACTOR), -/* harmony export */ "Sha1": () => (/* binding */ Sha1), -/* harmony export */ "areCookiesEnabled": () => (/* binding */ areCookiesEnabled), -/* harmony export */ "assert": () => (/* binding */ assert), -/* harmony export */ "assertionError": () => (/* binding */ assertionError), -/* harmony export */ "async": () => (/* binding */ async), -/* harmony export */ "base64": () => (/* binding */ base64), -/* harmony export */ "base64Decode": () => (/* binding */ base64Decode), -/* harmony export */ "base64Encode": () => (/* binding */ base64Encode), -/* harmony export */ "base64urlEncodeWithoutPadding": () => (/* binding */ base64urlEncodeWithoutPadding), -/* harmony export */ "calculateBackoffMillis": () => (/* binding */ calculateBackoffMillis), -/* harmony export */ "contains": () => (/* binding */ contains), -/* harmony export */ "createMockUserToken": () => (/* binding */ createMockUserToken), -/* harmony export */ "createSubscribe": () => (/* binding */ createSubscribe), -/* harmony export */ "decode": () => (/* binding */ decode), -/* harmony export */ "deepCopy": () => (/* binding */ deepCopy), -/* harmony export */ "deepEqual": () => (/* binding */ deepEqual), -/* harmony export */ "deepExtend": () => (/* binding */ deepExtend), -/* harmony export */ "errorPrefix": () => (/* binding */ errorPrefix), -/* harmony export */ "extractQuerystring": () => (/* binding */ extractQuerystring), -/* harmony export */ "getGlobal": () => (/* binding */ getGlobal), -/* harmony export */ "getModularInstance": () => (/* binding */ getModularInstance), -/* harmony export */ "getUA": () => (/* binding */ getUA), -/* harmony export */ "isAdmin": () => (/* binding */ isAdmin), -/* harmony export */ "isBrowser": () => (/* binding */ isBrowser), -/* harmony export */ "isBrowserExtension": () => (/* binding */ isBrowserExtension), -/* harmony export */ "isElectron": () => (/* binding */ isElectron), -/* harmony export */ "isEmpty": () => (/* binding */ isEmpty), -/* harmony export */ "isIE": () => (/* binding */ isIE), -/* harmony export */ "isIndexedDBAvailable": () => (/* binding */ isIndexedDBAvailable), -/* harmony export */ "isMobileCordova": () => (/* binding */ isMobileCordova), -/* harmony export */ "isNode": () => (/* binding */ isNode), -/* harmony export */ "isNodeSdk": () => (/* binding */ isNodeSdk), -/* harmony export */ "isReactNative": () => (/* binding */ isReactNative), -/* harmony export */ "isSafari": () => (/* binding */ isSafari), -/* harmony export */ "isUWP": () => (/* binding */ isUWP), -/* harmony export */ "isValidFormat": () => (/* binding */ isValidFormat), -/* harmony export */ "isValidTimestamp": () => (/* binding */ isValidTimestamp), -/* harmony export */ "issuedAtTime": () => (/* binding */ issuedAtTime), -/* harmony export */ "jsonEval": () => (/* binding */ jsonEval), -/* harmony export */ "map": () => (/* binding */ map), -/* harmony export */ "ordinal": () => (/* binding */ ordinal), -/* harmony export */ "promiseWithTimeout": () => (/* binding */ promiseWithTimeout), -/* harmony export */ "querystring": () => (/* binding */ querystring), -/* harmony export */ "querystringDecode": () => (/* binding */ querystringDecode), -/* harmony export */ "safeGet": () => (/* binding */ safeGet), -/* harmony export */ "stringLength": () => (/* binding */ stringLength), -/* harmony export */ "stringToByteArray": () => (/* binding */ stringToByteArray), -/* harmony export */ "stringify": () => (/* binding */ stringify), -/* harmony export */ "uuidv4": () => (/* binding */ uuidv4), -/* harmony export */ "validateArgCount": () => (/* binding */ validateArgCount), -/* harmony export */ "validateCallback": () => (/* binding */ validateCallback), -/* harmony export */ "validateContextObject": () => (/* binding */ validateContextObject), -/* harmony export */ "validateIndexedDBOpenable": () => (/* binding */ validateIndexedDBOpenable), -/* harmony export */ "validateNamespace": () => (/* binding */ validateNamespace) -/* harmony export */ }); -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Firebase constants. Some of these (@defines) can be overridden at compile-time. - */ -const CONSTANTS = { - /** - * @define {boolean} Whether this is the client Node.js SDK. - */ - NODE_CLIENT: false, - - /** - * @define {boolean} Whether this is the Admin Node.js SDK. - */ - NODE_ADMIN: false, - - /** - * Firebase SDK Version - */ - SDK_VERSION: '${JSCORE_VERSION}' -}; -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Throws an error if the provided assertion is falsy - */ - -const assert = function (assertion, message) { - if (!assertion) { - throw assertionError(message); - } -}; -/** - * Returns an Error object suitable for throwing. - */ - - -const assertionError = function (message) { - return new Error('Firebase Database (' + CONSTANTS.SDK_VERSION + ') INTERNAL ASSERT FAILED: ' + message); -}; -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -const stringToByteArray$1 = function (str) { - // TODO(user): Use native implementations if/when available - const out = []; - let p = 0; - - for (let i = 0; i < str.length; i++) { - let c = str.charCodeAt(i); - - if (c < 128) { - out[p++] = c; - } else if (c < 2048) { - out[p++] = c >> 6 | 192; - out[p++] = c & 63 | 128; - } else if ((c & 0xfc00) === 0xd800 && i + 1 < str.length && (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00) { - // Surrogate Pair - c = 0x10000 + ((c & 0x03ff) << 10) + (str.charCodeAt(++i) & 0x03ff); - out[p++] = c >> 18 | 240; - out[p++] = c >> 12 & 63 | 128; - out[p++] = c >> 6 & 63 | 128; - out[p++] = c & 63 | 128; - } else { - out[p++] = c >> 12 | 224; - out[p++] = c >> 6 & 63 | 128; - out[p++] = c & 63 | 128; - } - } - - return out; -}; -/** - * Turns an array of numbers into the string given by the concatenation of the - * characters to which the numbers correspond. - * @param bytes Array of numbers representing characters. - * @return Stringification of the array. - */ - - -const byteArrayToString = function (bytes) { - // TODO(user): Use native implementations if/when available - const out = []; - let pos = 0, - c = 0; - - while (pos < bytes.length) { - const c1 = bytes[pos++]; - - if (c1 < 128) { - out[c++] = String.fromCharCode(c1); - } else if (c1 > 191 && c1 < 224) { - const c2 = bytes[pos++]; - out[c++] = String.fromCharCode((c1 & 31) << 6 | c2 & 63); - } else if (c1 > 239 && c1 < 365) { - // Surrogate Pair - const c2 = bytes[pos++]; - const c3 = bytes[pos++]; - const c4 = bytes[pos++]; - const u = ((c1 & 7) << 18 | (c2 & 63) << 12 | (c3 & 63) << 6 | c4 & 63) - 0x10000; - out[c++] = String.fromCharCode(0xd800 + (u >> 10)); - out[c++] = String.fromCharCode(0xdc00 + (u & 1023)); - } else { - const c2 = bytes[pos++]; - const c3 = bytes[pos++]; - out[c++] = String.fromCharCode((c1 & 15) << 12 | (c2 & 63) << 6 | c3 & 63); - } - } - - return out.join(''); -}; // We define it as an object literal instead of a class because a class compiled down to es5 can't -// be treeshaked. https://github.com/rollup/rollup/issues/1691 -// Static lookup maps, lazily populated by init_() - - -const base64 = { - /** - * Maps bytes to characters. - */ - byteToCharMap_: null, - - /** - * Maps characters to bytes. - */ - charToByteMap_: null, - - /** - * Maps bytes to websafe characters. - * @private - */ - byteToCharMapWebSafe_: null, - - /** - * Maps websafe characters to bytes. - * @private - */ - charToByteMapWebSafe_: null, - - /** - * Our default alphabet, shared between - * ENCODED_VALS and ENCODED_VALS_WEBSAFE - */ - ENCODED_VALS_BASE: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + 'abcdefghijklmnopqrstuvwxyz' + '0123456789', - - /** - * Our default alphabet. Value 64 (=) is special; it means "nothing." - */ - get ENCODED_VALS() { - return this.ENCODED_VALS_BASE + '+/='; - }, - - /** - * Our websafe alphabet. - */ - get ENCODED_VALS_WEBSAFE() { - return this.ENCODED_VALS_BASE + '-_.'; - }, - - /** - * Whether this browser supports the atob and btoa functions. This extension - * started at Mozilla but is now implemented by many browsers. We use the - * ASSUME_* variables to avoid pulling in the full useragent detection library - * but still allowing the standard per-browser compilations. - * - */ - HAS_NATIVE_SUPPORT: typeof atob === 'function', - - /** - * Base64-encode an array of bytes. - * - * @param input An array of bytes (numbers with - * value in [0, 255]) to encode. - * @param webSafe Boolean indicating we should use the - * alternative alphabet. - * @return The base64 encoded string. - */ - encodeByteArray(input, webSafe) { - if (!Array.isArray(input)) { - throw Error('encodeByteArray takes an array as a parameter'); - } - - this.init_(); - const byteToCharMap = webSafe ? this.byteToCharMapWebSafe_ : this.byteToCharMap_; - const output = []; - - for (let i = 0; i < input.length; i += 3) { - const byte1 = input[i]; - const haveByte2 = i + 1 < input.length; - const byte2 = haveByte2 ? input[i + 1] : 0; - const haveByte3 = i + 2 < input.length; - const byte3 = haveByte3 ? input[i + 2] : 0; - const outByte1 = byte1 >> 2; - const outByte2 = (byte1 & 0x03) << 4 | byte2 >> 4; - let outByte3 = (byte2 & 0x0f) << 2 | byte3 >> 6; - let outByte4 = byte3 & 0x3f; - - if (!haveByte3) { - outByte4 = 64; - - if (!haveByte2) { - outByte3 = 64; - } - } - - output.push(byteToCharMap[outByte1], byteToCharMap[outByte2], byteToCharMap[outByte3], byteToCharMap[outByte4]); - } - - return output.join(''); - }, - - /** - * Base64-encode a string. - * - * @param input A string to encode. - * @param webSafe If true, we should use the - * alternative alphabet. - * @return The base64 encoded string. - */ - encodeString(input, webSafe) { - // Shortcut for Mozilla browsers that implement - // a native base64 encoder in the form of "btoa/atob" - if (this.HAS_NATIVE_SUPPORT && !webSafe) { - return btoa(input); - } - - return this.encodeByteArray(stringToByteArray$1(input), webSafe); - }, - - /** - * Base64-decode a string. - * - * @param input to decode. - * @param webSafe True if we should use the - * alternative alphabet. - * @return string representing the decoded value. - */ - decodeString(input, webSafe) { - // Shortcut for Mozilla browsers that implement - // a native base64 encoder in the form of "btoa/atob" - if (this.HAS_NATIVE_SUPPORT && !webSafe) { - return atob(input); - } - - return byteArrayToString(this.decodeStringToByteArray(input, webSafe)); - }, - - /** - * Base64-decode a string. - * - * In base-64 decoding, groups of four characters are converted into three - * bytes. If the encoder did not apply padding, the input length may not - * be a multiple of 4. - * - * In this case, the last group will have fewer than 4 characters, and - * padding will be inferred. If the group has one or two characters, it decodes - * to one byte. If the group has three characters, it decodes to two bytes. - * - * @param input Input to decode. - * @param webSafe True if we should use the web-safe alphabet. - * @return bytes representing the decoded value. - */ - decodeStringToByteArray(input, webSafe) { - this.init_(); - const charToByteMap = webSafe ? this.charToByteMapWebSafe_ : this.charToByteMap_; - const output = []; - - for (let i = 0; i < input.length;) { - const byte1 = charToByteMap[input.charAt(i++)]; - const haveByte2 = i < input.length; - const byte2 = haveByte2 ? charToByteMap[input.charAt(i)] : 0; - ++i; - const haveByte3 = i < input.length; - const byte3 = haveByte3 ? charToByteMap[input.charAt(i)] : 64; - ++i; - const haveByte4 = i < input.length; - const byte4 = haveByte4 ? charToByteMap[input.charAt(i)] : 64; - ++i; - - if (byte1 == null || byte2 == null || byte3 == null || byte4 == null) { - throw Error(); - } - - const outByte1 = byte1 << 2 | byte2 >> 4; - output.push(outByte1); - - if (byte3 !== 64) { - const outByte2 = byte2 << 4 & 0xf0 | byte3 >> 2; - output.push(outByte2); - - if (byte4 !== 64) { - const outByte3 = byte3 << 6 & 0xc0 | byte4; - output.push(outByte3); - } - } - } - - return output; - }, - - /** - * Lazy static initialization function. Called before - * accessing any of the static map variables. - * @private - */ - init_() { - if (!this.byteToCharMap_) { - this.byteToCharMap_ = {}; - this.charToByteMap_ = {}; - this.byteToCharMapWebSafe_ = {}; - this.charToByteMapWebSafe_ = {}; // We want quick mappings back and forth, so we precompute two maps. - - for (let i = 0; i < this.ENCODED_VALS.length; i++) { - this.byteToCharMap_[i] = this.ENCODED_VALS.charAt(i); - this.charToByteMap_[this.byteToCharMap_[i]] = i; - this.byteToCharMapWebSafe_[i] = this.ENCODED_VALS_WEBSAFE.charAt(i); - this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[i]] = i; // Be forgiving when decoding and correctly decode both encodings. - - if (i >= this.ENCODED_VALS_BASE.length) { - this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(i)] = i; - this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(i)] = i; - } - } - } - } - -}; -/** - * URL-safe base64 encoding - */ - -const base64Encode = function (str) { - const utf8Bytes = stringToByteArray$1(str); - return base64.encodeByteArray(utf8Bytes, true); -}; -/** - * URL-safe base64 encoding (without "." padding in the end). - * e.g. Used in JSON Web Token (JWT) parts. - */ - - -const base64urlEncodeWithoutPadding = function (str) { - // Use base64url encoding and remove padding in the end (dot characters). - return base64Encode(str).replace(/\./g, ''); -}; -/** - * URL-safe base64 decoding - * - * NOTE: DO NOT use the global atob() function - it does NOT support the - * base64Url variant encoding. - * - * @param str To be decoded - * @return Decoded result, if possible - */ - - -const base64Decode = function (str) { - try { - return base64.decodeString(str, true); - } catch (e) { - console.error('base64Decode failed: ', e); - } - - return null; -}; -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Do a deep-copy of basic JavaScript Objects or Arrays. - */ - - -function deepCopy(value) { - return deepExtend(undefined, value); -} -/** - * Copy properties from source to target (recursively allows extension - * of Objects and Arrays). Scalar values in the target are over-written. - * If target is undefined, an object of the appropriate type will be created - * (and returned). - * - * We recursively copy all child properties of plain Objects in the source- so - * that namespace- like dictionaries are merged. - * - * Note that the target can be a function, in which case the properties in - * the source Object are copied onto it as static properties of the Function. - * - * Note: we don't merge __proto__ to prevent prototype pollution - */ - - -function deepExtend(target, source) { - if (!(source instanceof Object)) { - return source; - } - - switch (source.constructor) { - case Date: - // Treat Dates like scalars; if the target date object had any child - // properties - they will be lost! - const dateValue = source; - return new Date(dateValue.getTime()); - - case Object: - if (target === undefined) { - target = {}; - } - - break; - - case Array: - // Always copy the array source and overwrite the target. - target = []; - break; - - default: - // Not a plain Object - treat it as a scalar. - return source; - } - - for (const prop in source) { - // use isValidKey to guard against prototype pollution. See https://snyk.io/vuln/SNYK-JS-LODASH-450202 - if (!source.hasOwnProperty(prop) || !isValidKey(prop)) { - continue; - } - - target[prop] = deepExtend(target[prop], source[prop]); - } - - return target; -} - -function isValidKey(key) { - return key !== '__proto__'; -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -class Deferred { - constructor() { - this.reject = () => {}; - - this.resolve = () => {}; - - this.promise = new Promise((resolve, reject) => { - this.resolve = resolve; - this.reject = reject; - }); - } - /** - * Our API internals are not promiseified and cannot because our callback APIs have subtle expectations around - * invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback - * and returns a node-style callback which will resolve or reject the Deferred's promise. - */ - - - wrapCallback(callback) { - return (error, value) => { - if (error) { - this.reject(error); - } else { - this.resolve(value); - } - - if (typeof callback === 'function') { - // Attaching noop handler just in case developer wasn't expecting - // promises - this.promise.catch(() => {}); // Some of our callbacks don't expect a value and our own tests - // assert that the parameter length is 1 - - if (callback.length === 1) { - callback(error); - } else { - callback(error, value); - } - } - }; - } - -} -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -function createMockUserToken(token, projectId) { - if (token.uid) { - throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.'); - } // Unsecured JWTs use "none" as the algorithm. - - - const header = { - alg: 'none', - type: 'JWT' - }; - const project = projectId || 'demo-project'; - const iat = token.iat || 0; - const sub = token.sub || token.user_id; - - if (!sub) { - throw new Error("mockUserToken must contain 'sub' or 'user_id' field!"); - } - - const payload = Object.assign({ - // Set all required fields to decent defaults - iss: `https://securetoken.google.com/${project}`, - aud: project, - iat, - exp: iat + 3600, - auth_time: iat, - sub, - user_id: sub, - firebase: { - sign_in_provider: 'custom', - identities: {} - } - }, token); // Unsecured JWTs use the empty string as a signature. - - const signature = ''; - return [base64urlEncodeWithoutPadding(JSON.stringify(header)), base64urlEncodeWithoutPadding(JSON.stringify(payload)), signature].join('.'); -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Returns navigator.userAgent string or '' if it's not defined. - * @return user agent string - */ - - -function getUA() { - if (typeof navigator !== 'undefined' && typeof navigator['userAgent'] === 'string') { - return navigator['userAgent']; - } else { - return ''; - } -} -/** - * Detect Cordova / PhoneGap / Ionic frameworks on a mobile device. - * - * Deliberately does not rely on checking `file://` URLs (as this fails PhoneGap - * in the Ripple emulator) nor Cordova `onDeviceReady`, which would normally - * wait for a callback. - */ - - -function isMobileCordova() { - return typeof window !== 'undefined' && // @ts-ignore Setting up an broadly applicable index signature for Window - // just to deal with this case would probably be a bad idea. - !!(window['cordova'] || window['phonegap'] || window['PhoneGap']) && /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(getUA()); -} -/** - * Detect Node.js. - * - * @return true if Node.js environment is detected. - */ -// Node detection logic from: https://github.com/iliakan/detect-node/ - - -function isNode() { - try { - return Object.prototype.toString.call(__webpack_require__.g.process) === '[object process]'; - } catch (e) { - return false; - } -} -/** - * Detect Browser Environment - */ - - -function isBrowser() { - return typeof self === 'object' && self.self === self; -} - -function isBrowserExtension() { - const runtime = typeof chrome === 'object' ? chrome.runtime : typeof browser === 'object' ? browser.runtime : undefined; - return typeof runtime === 'object' && runtime.id !== undefined; -} -/** - * Detect React Native. - * - * @return true if ReactNative environment is detected. - */ - - -function isReactNative() { - return typeof navigator === 'object' && navigator['product'] === 'ReactNative'; -} -/** Detects Electron apps. */ - - -function isElectron() { - return getUA().indexOf('Electron/') >= 0; -} -/** Detects Internet Explorer. */ - - -function isIE() { - const ua = getUA(); - return ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0; -} -/** Detects Universal Windows Platform apps. */ - - -function isUWP() { - return getUA().indexOf('MSAppHost/') >= 0; -} -/** - * Detect whether the current SDK build is the Node version. - * - * @return true if it's the Node SDK build. - */ - - -function isNodeSdk() { - return CONSTANTS.NODE_CLIENT === true || CONSTANTS.NODE_ADMIN === true; -} -/** Returns true if we are running in Safari. */ - - -function isSafari() { - return !isNode() && navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrome'); -} -/** - * This method checks if indexedDB is supported by current browser/service worker context - * @return true if indexedDB is supported by current browser/service worker context - */ - - -function isIndexedDBAvailable() { - return typeof indexedDB === 'object'; -} -/** - * This method validates browser/sw context for indexedDB by opening a dummy indexedDB database and reject - * if errors occur during the database open operation. - * - * @throws exception if current browser/sw context can't run idb.open (ex: Safari iframe, Firefox - * private browsing) - */ - - -function validateIndexedDBOpenable() { - return new Promise((resolve, reject) => { - try { - let preExist = true; - const DB_CHECK_NAME = 'validate-browser-context-for-indexeddb-analytics-module'; - const request = self.indexedDB.open(DB_CHECK_NAME); - - request.onsuccess = () => { - request.result.close(); // delete database only when it doesn't pre-exist - - if (!preExist) { - self.indexedDB.deleteDatabase(DB_CHECK_NAME); - } - - resolve(true); - }; - - request.onupgradeneeded = () => { - preExist = false; - }; - - request.onerror = () => { - var _a; - - reject(((_a = request.error) === null || _a === void 0 ? void 0 : _a.message) || ''); - }; - } catch (error) { - reject(error); - } - }); -} -/** - * - * This method checks whether cookie is enabled within current browser - * @return true if cookie is enabled within current browser - */ - - -function areCookiesEnabled() { - if (typeof navigator === 'undefined' || !navigator.cookieEnabled) { - return false; - } - - return true; -} -/** - * Polyfill for `globalThis` object. - * @returns the `globalThis` object for the given environment. - */ - - -function getGlobal() { - if (typeof self !== 'undefined') { - return self; - } - - if (typeof window !== 'undefined') { - return window; - } - - if (typeof __webpack_require__.g !== 'undefined') { - return __webpack_require__.g; - } - - throw new Error('Unable to locate global object.'); -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Standardized Firebase Error. - * - * Usage: - * - * // Typescript string literals for type-safe codes - * type Err = - * 'unknown' | - * 'object-not-found' - * ; - * - * // Closure enum for type-safe error codes - * // at-enum {string} - * var Err = { - * UNKNOWN: 'unknown', - * OBJECT_NOT_FOUND: 'object-not-found', - * } - * - * let errors: Map = { - * 'generic-error': "Unknown error", - * 'file-not-found': "Could not find file: {$file}", - * }; - * - * // Type-safe function - must pass a valid error code as param. - * let error = new ErrorFactory('service', 'Service', errors); - * - * ... - * throw error.create(Err.GENERIC); - * ... - * throw error.create(Err.FILE_NOT_FOUND, {'file': fileName}); - * ... - * // Service: Could not file file: foo.txt (service/file-not-found). - * - * catch (e) { - * assert(e.message === "Could not find file: foo.txt."); - * if ((e as FirebaseError)?.code === 'service/file-not-found') { - * console.log("Could not read file: " + e['file']); - * } - * } - */ - - -const ERROR_NAME = 'FirebaseError'; // Based on code from: -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types - -class FirebaseError extends Error { - constructor( - /** The error code for this error. */ - code, message, - /** Custom data for this error. */ - customData) { - super(message); - this.code = code; - this.customData = customData; - /** The custom name for all FirebaseErrors. */ - - this.name = ERROR_NAME; // Fix For ES5 - // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work - - Object.setPrototypeOf(this, FirebaseError.prototype); // Maintains proper stack trace for where our error was thrown. - // Only available on V8. - - if (Error.captureStackTrace) { - Error.captureStackTrace(this, ErrorFactory.prototype.create); - } - } - -} - -class ErrorFactory { - constructor(service, serviceName, errors) { - this.service = service; - this.serviceName = serviceName; - this.errors = errors; - } - - create(code) { - const customData = (arguments.length <= 1 ? undefined : arguments[1]) || {}; - const fullCode = `${this.service}/${code}`; - const template = this.errors[code]; - const message = template ? replaceTemplate(template, customData) : 'Error'; // Service Name: Error message (service/code). - - const fullMessage = `${this.serviceName}: ${message} (${fullCode}).`; - const error = new FirebaseError(fullCode, fullMessage, customData); - return error; - } - -} - -function replaceTemplate(template, data) { - return template.replace(PATTERN, (_, key) => { - const value = data[key]; - return value != null ? String(value) : `<${key}?>`; - }); -} - -const PATTERN = /\{\$([^}]+)}/g; -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Evaluates a JSON string into a javascript object. - * - * @param {string} str A string containing JSON. - * @return {*} The javascript object representing the specified JSON. - */ - -function jsonEval(str) { - return JSON.parse(str); -} -/** - * Returns JSON representing a javascript object. - * @param {*} data Javascript object to be stringified. - * @return {string} The JSON contents of the object. - */ - - -function stringify(data) { - return JSON.stringify(data); -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Decodes a Firebase auth. token into constituent parts. - * - * Notes: - * - May return with invalid / incomplete claims if there's no native base64 decoding support. - * - Doesn't check if the token is actually valid. - */ - - -const decode = function (token) { - let header = {}, - claims = {}, - data = {}, - signature = ''; - - try { - const parts = token.split('.'); - header = jsonEval(base64Decode(parts[0]) || ''); - claims = jsonEval(base64Decode(parts[1]) || ''); - signature = parts[2]; - data = claims['d'] || {}; - delete claims['d']; - } catch (e) {} - - return { - header, - claims, - data, - signature - }; -}; -/** - * Decodes a Firebase auth. token and checks the validity of its time-based claims. Will return true if the - * token is within the time window authorized by the 'nbf' (not-before) and 'iat' (issued-at) claims. - * - * Notes: - * - May return a false negative if there's no native base64 decoding support. - * - Doesn't check if the token is actually valid. - */ - - -const isValidTimestamp = function (token) { - const claims = decode(token).claims; - const now = Math.floor(new Date().getTime() / 1000); - let validSince = 0, - validUntil = 0; - - if (typeof claims === 'object') { - if (claims.hasOwnProperty('nbf')) { - validSince = claims['nbf']; - } else if (claims.hasOwnProperty('iat')) { - validSince = claims['iat']; - } - - if (claims.hasOwnProperty('exp')) { - validUntil = claims['exp']; - } else { - // token will expire after 24h by default - validUntil = validSince + 86400; - } - } - - return !!now && !!validSince && !!validUntil && now >= validSince && now <= validUntil; -}; -/** - * Decodes a Firebase auth. token and returns its issued at time if valid, null otherwise. - * - * Notes: - * - May return null if there's no native base64 decoding support. - * - Doesn't check if the token is actually valid. - */ - - -const issuedAtTime = function (token) { - const claims = decode(token).claims; - - if (typeof claims === 'object' && claims.hasOwnProperty('iat')) { - return claims['iat']; - } - - return null; -}; -/** - * Decodes a Firebase auth. token and checks the validity of its format. Expects a valid issued-at time. - * - * Notes: - * - May return a false negative if there's no native base64 decoding support. - * - Doesn't check if the token is actually valid. - */ - - -const isValidFormat = function (token) { - const decoded = decode(token), - claims = decoded.claims; - return !!claims && typeof claims === 'object' && claims.hasOwnProperty('iat'); -}; -/** - * Attempts to peer into an auth token and determine if it's an admin auth token by looking at the claims portion. - * - * Notes: - * - May return a false negative if there's no native base64 decoding support. - * - Doesn't check if the token is actually valid. - */ - - -const isAdmin = function (token) { - const claims = decode(token).claims; - return typeof claims === 'object' && claims['admin'] === true; -}; -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -function contains(obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key); -} - -function safeGet(obj, key) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - return obj[key]; - } else { - return undefined; - } -} - -function isEmpty(obj) { - for (const key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - return false; - } - } - - return true; -} - -function map(obj, fn, contextObj) { - const res = {}; - - for (const key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - res[key] = fn.call(contextObj, obj[key], key, obj); - } - } - - return res; -} -/** - * Deep equal two objects. Support Arrays and Objects. - */ - - -function deepEqual(a, b) { - if (a === b) { - return true; - } - - const aKeys = Object.keys(a); - const bKeys = Object.keys(b); - - for (const k of aKeys) { - if (!bKeys.includes(k)) { - return false; - } - - const aProp = a[k]; - const bProp = b[k]; - - if (isObject(aProp) && isObject(bProp)) { - if (!deepEqual(aProp, bProp)) { - return false; - } - } else if (aProp !== bProp) { - return false; - } - } - - for (const k of bKeys) { - if (!aKeys.includes(k)) { - return false; - } - } - - return true; -} - -function isObject(thing) { - return thing !== null && typeof thing === 'object'; -} -/** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Rejects if the given promise doesn't resolve in timeInMS milliseconds. - * @internal - */ - - -function promiseWithTimeout(promise) { - let timeInMS = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2000; - const deferredPromise = new Deferred(); - setTimeout(() => deferredPromise.reject('timeout!'), timeInMS); - promise.then(deferredPromise.resolve, deferredPromise.reject); - return deferredPromise.promise; -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Returns a querystring-formatted string (e.g. &arg=val&arg2=val2) from a - * params object (e.g. {arg: 'val', arg2: 'val2'}) - * Note: You must prepend it with ? when adding it to a URL. - */ - - -function querystring(querystringParams) { - const params = []; - - for (const [key, value] of Object.entries(querystringParams)) { - if (Array.isArray(value)) { - value.forEach(arrayVal => { - params.push(encodeURIComponent(key) + '=' + encodeURIComponent(arrayVal)); - }); - } else { - params.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); - } - } - - return params.length ? '&' + params.join('&') : ''; -} -/** - * Decodes a querystring (e.g. ?arg=val&arg2=val2) into a params object - * (e.g. {arg: 'val', arg2: 'val2'}) - */ - - -function querystringDecode(querystring) { - const obj = {}; - const tokens = querystring.replace(/^\?/, '').split('&'); - tokens.forEach(token => { - if (token) { - const [key, value] = token.split('='); - obj[decodeURIComponent(key)] = decodeURIComponent(value); - } - }); - return obj; -} -/** - * Extract the query string part of a URL, including the leading question mark (if present). - */ - - -function extractQuerystring(url) { - const queryStart = url.indexOf('?'); - - if (!queryStart) { - return ''; - } - - const fragmentStart = url.indexOf('#', queryStart); - return url.substring(queryStart, fragmentStart > 0 ? fragmentStart : undefined); -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview SHA-1 cryptographic hash. - * Variable names follow the notation in FIPS PUB 180-3: - * http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf. - * - * Usage: - * var sha1 = new sha1(); - * sha1.update(bytes); - * var hash = sha1.digest(); - * - * Performance: - * Chrome 23: ~400 Mbit/s - * Firefox 16: ~250 Mbit/s - * - */ - -/** - * SHA-1 cryptographic hash constructor. - * - * The properties declared here are discussed in the above algorithm document. - * @constructor - * @final - * @struct - */ - - -class Sha1 { - constructor() { - /** - * Holds the previous values of accumulated variables a-e in the compress_ - * function. - * @private - */ - this.chain_ = []; - /** - * A buffer holding the partially computed hash result. - * @private - */ - - this.buf_ = []; - /** - * An array of 80 bytes, each a part of the message to be hashed. Referred to - * as the message schedule in the docs. - * @private - */ - - this.W_ = []; - /** - * Contains data needed to pad messages less than 64 bytes. - * @private - */ - - this.pad_ = []; - /** - * @private {number} - */ - - this.inbuf_ = 0; - /** - * @private {number} - */ - - this.total_ = 0; - this.blockSize = 512 / 8; - this.pad_[0] = 128; - - for (let i = 1; i < this.blockSize; ++i) { - this.pad_[i] = 0; - } - - this.reset(); - } - - reset() { - this.chain_[0] = 0x67452301; - this.chain_[1] = 0xefcdab89; - this.chain_[2] = 0x98badcfe; - this.chain_[3] = 0x10325476; - this.chain_[4] = 0xc3d2e1f0; - this.inbuf_ = 0; - this.total_ = 0; - } - /** - * Internal compress helper function. - * @param buf Block to compress. - * @param offset Offset of the block in the buffer. - * @private - */ - - - compress_(buf, offset) { - if (!offset) { - offset = 0; - } - - const W = this.W_; // get 16 big endian words - - if (typeof buf === 'string') { - for (let i = 0; i < 16; i++) { - // TODO(user): [bug 8140122] Recent versions of Safari for Mac OS and iOS - // have a bug that turns the post-increment ++ operator into pre-increment - // during JIT compilation. We have code that depends heavily on SHA-1 for - // correctness and which is affected by this bug, so I've removed all uses - // of post-increment ++ in which the result value is used. We can revert - // this change once the Safari bug - // (https://bugs.webkit.org/show_bug.cgi?id=109036) has been fixed and - // most clients have been updated. - W[i] = buf.charCodeAt(offset) << 24 | buf.charCodeAt(offset + 1) << 16 | buf.charCodeAt(offset + 2) << 8 | buf.charCodeAt(offset + 3); - offset += 4; - } - } else { - for (let i = 0; i < 16; i++) { - W[i] = buf[offset] << 24 | buf[offset + 1] << 16 | buf[offset + 2] << 8 | buf[offset + 3]; - offset += 4; - } - } // expand to 80 words - - - for (let i = 16; i < 80; i++) { - const t = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; - W[i] = (t << 1 | t >>> 31) & 0xffffffff; - } - - let a = this.chain_[0]; - let b = this.chain_[1]; - let c = this.chain_[2]; - let d = this.chain_[3]; - let e = this.chain_[4]; - let f, k; // TODO(user): Try to unroll this loop to speed up the computation. - - for (let i = 0; i < 80; i++) { - if (i < 40) { - if (i < 20) { - f = d ^ b & (c ^ d); - k = 0x5a827999; - } else { - f = b ^ c ^ d; - k = 0x6ed9eba1; - } - } else { - if (i < 60) { - f = b & c | d & (b | c); - k = 0x8f1bbcdc; - } else { - f = b ^ c ^ d; - k = 0xca62c1d6; - } - } - - const t = (a << 5 | a >>> 27) + f + e + k + W[i] & 0xffffffff; - e = d; - d = c; - c = (b << 30 | b >>> 2) & 0xffffffff; - b = a; - a = t; - } - - this.chain_[0] = this.chain_[0] + a & 0xffffffff; - this.chain_[1] = this.chain_[1] + b & 0xffffffff; - this.chain_[2] = this.chain_[2] + c & 0xffffffff; - this.chain_[3] = this.chain_[3] + d & 0xffffffff; - this.chain_[4] = this.chain_[4] + e & 0xffffffff; - } - - update(bytes, length) { - // TODO(johnlenz): tighten the function signature and remove this check - if (bytes == null) { - return; - } - - if (length === undefined) { - length = bytes.length; - } - - const lengthMinusBlock = length - this.blockSize; - let n = 0; // Using local instead of member variables gives ~5% speedup on Firefox 16. - - const buf = this.buf_; - let inbuf = this.inbuf_; // The outer while loop should execute at most twice. - - while (n < length) { - // When we have no data in the block to top up, we can directly process the - // input buffer (assuming it contains sufficient data). This gives ~25% - // speedup on Chrome 23 and ~15% speedup on Firefox 16, but requires that - // the data is provided in large chunks (or in multiples of 64 bytes). - if (inbuf === 0) { - while (n <= lengthMinusBlock) { - this.compress_(bytes, n); - n += this.blockSize; - } - } - - if (typeof bytes === 'string') { - while (n < length) { - buf[inbuf] = bytes.charCodeAt(n); - ++inbuf; - ++n; - - if (inbuf === this.blockSize) { - this.compress_(buf); - inbuf = 0; // Jump to the outer loop so we use the full-block optimization. - - break; - } - } - } else { - while (n < length) { - buf[inbuf] = bytes[n]; - ++inbuf; - ++n; - - if (inbuf === this.blockSize) { - this.compress_(buf); - inbuf = 0; // Jump to the outer loop so we use the full-block optimization. - - break; - } - } - } - } - - this.inbuf_ = inbuf; - this.total_ += length; - } - /** @override */ - - - digest() { - const digest = []; - let totalBits = this.total_ * 8; // Add pad 0x80 0x00*. - - if (this.inbuf_ < 56) { - this.update(this.pad_, 56 - this.inbuf_); - } else { - this.update(this.pad_, this.blockSize - (this.inbuf_ - 56)); - } // Add # bits. - - - for (let i = this.blockSize - 1; i >= 56; i--) { - this.buf_[i] = totalBits & 255; - totalBits /= 256; // Don't use bit-shifting here! - } - - this.compress_(this.buf_); - let n = 0; - - for (let i = 0; i < 5; i++) { - for (let j = 24; j >= 0; j -= 8) { - digest[n] = this.chain_[i] >> j & 255; - ++n; - } - } - - return digest; - } - -} -/** - * Helper to make a Subscribe function (just like Promise helps make a - * Thenable). - * - * @param executor Function which can make calls to a single Observer - * as a proxy. - * @param onNoObservers Callback when count of Observers goes to zero. - */ - - -function createSubscribe(executor, onNoObservers) { - const proxy = new ObserverProxy(executor, onNoObservers); - return proxy.subscribe.bind(proxy); -} -/** - * Implement fan-out for any number of Observers attached via a subscribe - * function. - */ - - -class ObserverProxy { - /** - * @param executor Function which can make calls to a single Observer - * as a proxy. - * @param onNoObservers Callback when count of Observers goes to zero. - */ - constructor(executor, onNoObservers) { - this.observers = []; - this.unsubscribes = []; - this.observerCount = 0; // Micro-task scheduling by calling task.then(). - - this.task = Promise.resolve(); - this.finalized = false; - this.onNoObservers = onNoObservers; // Call the executor asynchronously so subscribers that are called - // synchronously after the creation of the subscribe function - // can still receive the very first value generated in the executor. - - this.task.then(() => { - executor(this); - }).catch(e => { - this.error(e); - }); - } - - next(value) { - this.forEachObserver(observer => { - observer.next(value); - }); - } - - error(error) { - this.forEachObserver(observer => { - observer.error(error); - }); - this.close(error); - } - - complete() { - this.forEachObserver(observer => { - observer.complete(); - }); - this.close(); - } - /** - * Subscribe function that can be used to add an Observer to the fan-out list. - * - * - We require that no event is sent to a subscriber sychronously to their - * call to subscribe(). - */ - - - subscribe(nextOrObserver, error, complete) { - let observer; - - if (nextOrObserver === undefined && error === undefined && complete === undefined) { - throw new Error('Missing Observer.'); - } // Assemble an Observer object when passed as callback functions. - - - if (implementsAnyMethods(nextOrObserver, ['next', 'error', 'complete'])) { - observer = nextOrObserver; - } else { - observer = { - next: nextOrObserver, - error, - complete - }; - } - - if (observer.next === undefined) { - observer.next = noop; - } - - if (observer.error === undefined) { - observer.error = noop; - } - - if (observer.complete === undefined) { - observer.complete = noop; - } - - const unsub = this.unsubscribeOne.bind(this, this.observers.length); // Attempt to subscribe to a terminated Observable - we - // just respond to the Observer with the final error or complete - // event. - - if (this.finalized) { - // eslint-disable-next-line @typescript-eslint/no-floating-promises - this.task.then(() => { - try { - if (this.finalError) { - observer.error(this.finalError); - } else { - observer.complete(); - } - } catch (e) {// nothing - } - - return; - }); - } - - this.observers.push(observer); - return unsub; - } // Unsubscribe is synchronous - we guarantee that no events are sent to - // any unsubscribed Observer. - - - unsubscribeOne(i) { - if (this.observers === undefined || this.observers[i] === undefined) { - return; - } - - delete this.observers[i]; - this.observerCount -= 1; - - if (this.observerCount === 0 && this.onNoObservers !== undefined) { - this.onNoObservers(this); - } - } - - forEachObserver(fn) { - if (this.finalized) { - // Already closed by previous event....just eat the additional values. - return; - } // Since sendOne calls asynchronously - there is no chance that - // this.observers will become undefined. - - - for (let i = 0; i < this.observers.length; i++) { - this.sendOne(i, fn); - } - } // Call the Observer via one of it's callback function. We are careful to - // confirm that the observe has not been unsubscribed since this asynchronous - // function had been queued. - - - sendOne(i, fn) { - // Execute the callback asynchronously - // eslint-disable-next-line @typescript-eslint/no-floating-promises - this.task.then(() => { - if (this.observers !== undefined && this.observers[i] !== undefined) { - try { - fn(this.observers[i]); - } catch (e) { - // Ignore exceptions raised in Observers or missing methods of an - // Observer. - // Log error to console. b/31404806 - if (typeof console !== 'undefined' && console.error) { - console.error(e); - } - } - } - }); - } - - close(err) { - if (this.finalized) { - return; - } - - this.finalized = true; - - if (err !== undefined) { - this.finalError = err; - } // Proxy is no longer needed - garbage collect references - // eslint-disable-next-line @typescript-eslint/no-floating-promises - - - this.task.then(() => { - this.observers = undefined; - this.onNoObservers = undefined; - }); - } - -} -/** Turn synchronous function into one called asynchronously. */ -// eslint-disable-next-line @typescript-eslint/ban-types - - -function async(fn, onError) { - return function () { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - Promise.resolve(true).then(() => { - fn(...args); - }).catch(error => { - if (onError) { - onError(error); - } - }); - }; -} -/** - * Return true if the object passed in implements any of the named methods. - */ - - -function implementsAnyMethods(obj, methods) { - if (typeof obj !== 'object' || obj === null) { - return false; - } - - for (const method of methods) { - if (method in obj && typeof obj[method] === 'function') { - return true; - } - } - - return false; -} - -function noop() {// do nothing -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Check to make sure the appropriate number of arguments are provided for a public function. - * Throws an error if it fails. - * - * @param fnName The function name - * @param minCount The minimum number of arguments to allow for the function call - * @param maxCount The maximum number of argument to allow for the function call - * @param argCount The actual number of arguments provided. - */ - - -const validateArgCount = function (fnName, minCount, maxCount, argCount) { - let argError; - - if (argCount < minCount) { - argError = 'at least ' + minCount; - } else if (argCount > maxCount) { - argError = maxCount === 0 ? 'none' : 'no more than ' + maxCount; - } - - if (argError) { - const error = fnName + ' failed: Was called with ' + argCount + (argCount === 1 ? ' argument.' : ' arguments.') + ' Expects ' + argError + '.'; - throw new Error(error); - } -}; -/** - * Generates a string to prefix an error message about failed argument validation - * - * @param fnName The function name - * @param argName The name of the argument - * @return The prefix to add to the error thrown for validation. - */ - - -function errorPrefix(fnName, argName) { - return `${fnName} failed: ${argName} argument `; -} -/** - * @param fnName - * @param argumentNumber - * @param namespace - * @param optional - */ - - -function validateNamespace(fnName, namespace, optional) { - if (optional && !namespace) { - return; - } - - if (typeof namespace !== 'string') { - //TODO: I should do more validation here. We only allow certain chars in namespaces. - throw new Error(errorPrefix(fnName, 'namespace') + 'must be a valid firebase namespace.'); - } -} - -function validateCallback(fnName, argumentName, // eslint-disable-next-line @typescript-eslint/ban-types -callback, optional) { - if (optional && !callback) { - return; - } - - if (typeof callback !== 'function') { - throw new Error(errorPrefix(fnName, argumentName) + 'must be a valid function.'); - } -} - -function validateContextObject(fnName, argumentName, context, optional) { - if (optional && !context) { - return; - } - - if (typeof context !== 'object' || context === null) { - throw new Error(errorPrefix(fnName, argumentName) + 'must be a valid context object.'); - } -} -/** - * @license - * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Code originally came from goog.crypt.stringToUtf8ByteArray, but for some reason they -// automatically replaced '\r\n' with '\n', and they didn't handle surrogate pairs, -// so it's been modified. -// Note that not all Unicode characters appear as single characters in JavaScript strings. -// fromCharCode returns the UTF-16 encoding of a character - so some Unicode characters -// use 2 characters in Javascript. All 4-byte UTF-8 characters begin with a first -// character in the range 0xD800 - 0xDBFF (the first character of a so-called surrogate -// pair). -// See http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3 - -/** - * @param {string} str - * @return {Array} - */ - - -const stringToByteArray = function (str) { - const out = []; - let p = 0; - - for (let i = 0; i < str.length; i++) { - let c = str.charCodeAt(i); // Is this the lead surrogate in a surrogate pair? - - if (c >= 0xd800 && c <= 0xdbff) { - const high = c - 0xd800; // the high 10 bits. - - i++; - assert(i < str.length, 'Surrogate pair missing trail surrogate.'); - const low = str.charCodeAt(i) - 0xdc00; // the low 10 bits. - - c = 0x10000 + (high << 10) + low; - } - - if (c < 128) { - out[p++] = c; - } else if (c < 2048) { - out[p++] = c >> 6 | 192; - out[p++] = c & 63 | 128; - } else if (c < 65536) { - out[p++] = c >> 12 | 224; - out[p++] = c >> 6 & 63 | 128; - out[p++] = c & 63 | 128; - } else { - out[p++] = c >> 18 | 240; - out[p++] = c >> 12 & 63 | 128; - out[p++] = c >> 6 & 63 | 128; - out[p++] = c & 63 | 128; - } - } - - return out; -}; -/** - * Calculate length without actually converting; useful for doing cheaper validation. - * @param {string} str - * @return {number} - */ - - -const stringLength = function (str) { - let p = 0; - - for (let i = 0; i < str.length; i++) { - const c = str.charCodeAt(i); - - if (c < 128) { - p++; - } else if (c < 2048) { - p += 2; - } else if (c >= 0xd800 && c <= 0xdbff) { - // Lead surrogate of a surrogate pair. The pair together will take 4 bytes to represent. - p += 4; - i++; // skip trail surrogate. - } else { - p += 3; - } - } - - return p; -}; -/** - * @license - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Copied from https://stackoverflow.com/a/2117523 - * Generates a new uuid. - * @public - */ - - -const uuidv4 = function () { - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => { - const r = Math.random() * 16 | 0, - v = c === 'x' ? r : r & 0x3 | 0x8; - return v.toString(16); - }); -}; -/** - * @license - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * The amount of milliseconds to exponentially increase. - */ - - -const DEFAULT_INTERVAL_MILLIS = 1000; -/** - * The factor to backoff by. - * Should be a number greater than 1. - */ - -const DEFAULT_BACKOFF_FACTOR = 2; -/** - * The maximum milliseconds to increase to. - * - *

Visible for testing - */ - -const MAX_VALUE_MILLIS = 4 * 60 * 60 * 1000; // Four hours, like iOS and Android. - -/** - * The percentage of backoff time to randomize by. - * See - * http://go/safe-client-behavior#step-1-determine-the-appropriate-retry-interval-to-handle-spike-traffic - * for context. - * - *

Visible for testing - */ - -const RANDOM_FACTOR = 0.5; -/** - * Based on the backoff method from - * https://github.com/google/closure-library/blob/master/closure/goog/math/exponentialbackoff.js. - * Extracted here so we don't need to pass metadata and a stateful ExponentialBackoff object around. - */ - -function calculateBackoffMillis(backoffCount) { - let intervalMillis = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_INTERVAL_MILLIS; - let backoffFactor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_BACKOFF_FACTOR; - // Calculates an exponentially increasing value. - // Deviation: calculates value from count and a constant interval, so we only need to save value - // and count to restore state. - const currBaseValue = intervalMillis * Math.pow(backoffFactor, backoffCount); // A random "fuzz" to avoid waves of retries. - // Deviation: randomFactor is required. - - const randomWait = Math.round( // A fraction of the backoff value to add/subtract. - // Deviation: changes multiplication order to improve readability. - RANDOM_FACTOR * currBaseValue * ( // A random float (rounded to int by Math.round above) in the range [-1, 1]. Determines - // if we add or subtract. - Math.random() - 0.5) * 2); // Limits backoff to max to avoid effectively permanent backoff. - - return Math.min(MAX_VALUE_MILLIS, currBaseValue + randomWait); -} -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Provide English ordinal letters after a number - */ - - -function ordinal(i) { - if (!Number.isFinite(i)) { - return `${i}`; - } - - return i + indicator(i); -} - -function indicator(i) { - i = Math.abs(i); - const cent = i % 100; - - if (cent >= 10 && cent <= 20) { - return 'th'; - } - - const dec = i % 10; - - if (dec === 1) { - return 'st'; - } - - if (dec === 2) { - return 'nd'; - } - - if (dec === 3) { - return 'rd'; - } - - return 'th'; -} -/** - * @license - * Copyright 2021 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -function getModularInstance(service) { - if (service && service._delegate) { - return service._delegate; - } else { - return service; - } -} - - - -/***/ }), - -/***/ "./node_modules/@firebase/webchannel-wrapper/dist/index.esm2017.js": -/*!*************************************************************************!*\ - !*** ./node_modules/@firebase/webchannel-wrapper/dist/index.esm2017.js ***! - \*************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ErrorCode": () => (/* binding */ ErrorCode), -/* harmony export */ "Event": () => (/* binding */ Event), -/* harmony export */ "EventType": () => (/* binding */ EventType), -/* harmony export */ "FetchXmlHttpFactory": () => (/* binding */ FetchXmlHttpFactory), -/* harmony export */ "Stat": () => (/* binding */ Stat), -/* harmony export */ "WebChannel": () => (/* binding */ WebChannel), -/* harmony export */ "XhrIo": () => (/* binding */ XhrIo), -/* harmony export */ "createWebChannelTransport": () => (/* binding */ createWebChannelTransport), -/* harmony export */ "default": () => (/* binding */ esm), -/* harmony export */ "getStatEventTarget": () => (/* binding */ getStatEventTarget) -/* harmony export */ }); -var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {}; -var esm = {}; -/* - - Copyright The Closure Library Authors. - SPDX-License-Identifier: Apache-2.0 -*/ - -var k, - goog = goog || {}, - l = commonjsGlobal || self; - -function aa() {} - -function ba(a) { - var b = typeof a; - b = "object" != b ? b : a ? Array.isArray(a) ? "array" : b : "null"; - return "array" == b || "object" == b && "number" == typeof a.length; -} - -function p(a) { - var b = typeof a; - return "object" == b && null != a || "function" == b; -} - -function da(a) { - return Object.prototype.hasOwnProperty.call(a, ea) && a[ea] || (a[ea] = ++fa); -} - -var ea = "closure_uid_" + (1E9 * Math.random() >>> 0), - fa = 0; - -function ha(a, b, c) { - return a.call.apply(a.bind, arguments); -} - -function ia(a, b, c) { - if (!a) throw Error(); - - if (2 < arguments.length) { - var d = Array.prototype.slice.call(arguments, 2); - return function () { - var e = Array.prototype.slice.call(arguments); - Array.prototype.unshift.apply(e, d); - return a.apply(b, e); - }; - } - - return function () { - return a.apply(b, arguments); - }; -} - -function q(a, b, c) { - Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? q = ha : q = ia; - return q.apply(null, arguments); -} - -function ja(a, b) { - var c = Array.prototype.slice.call(arguments, 1); - return function () { - var d = c.slice(); - d.push.apply(d, arguments); - return a.apply(this, d); - }; -} - -function t(a, b) { - function c() {} - - c.prototype = b.prototype; - a.Z = b.prototype; - a.prototype = new c(); - a.prototype.constructor = a; - - a.Vb = function (d, e, f) { - for (var h = Array(arguments.length - 2), n = 2; n < arguments.length; n++) h[n - 2] = arguments[n]; - - return b.prototype[e].apply(d, h); - }; -} - -function v() { - this.s = this.s; - this.o = this.o; -} - -var ka = 0, - la = {}; -v.prototype.s = !1; - -v.prototype.na = function () { - if (!this.s && (this.s = !0, this.M(), 0 != ka)) { - var a = da(this); - delete la[a]; - } -}; - -v.prototype.M = function () { - if (this.o) for (; this.o.length;) this.o.shift()(); -}; - -const ma = Array.prototype.indexOf ? function (a, b) { - return Array.prototype.indexOf.call(a, b, void 0); -} : function (a, b) { - if ("string" === typeof a) return "string" !== typeof b || 1 != b.length ? -1 : a.indexOf(b, 0); - - for (let c = 0; c < a.length; c++) if (c in a && a[c] === b) return c; - - return -1; -}, - na = Array.prototype.forEach ? function (a, b, c) { - Array.prototype.forEach.call(a, b, c); -} : function (a, b, c) { - const d = a.length, - e = "string" === typeof a ? a.split("") : a; - - for (let f = 0; f < d; f++) f in e && b.call(c, e[f], f, a); -}; - -function oa(a) { - a: { - var b = pa; - const c = a.length, - d = "string" === typeof a ? a.split("") : a; - - for (let e = 0; e < c; e++) if (e in d && b.call(void 0, d[e], e, a)) { - b = e; - break a; - } - - b = -1; - } - - return 0 > b ? null : "string" === typeof a ? a.charAt(b) : a[b]; -} - -function qa(a) { - return Array.prototype.concat.apply([], arguments); -} - -function ra(a) { - const b = a.length; - - if (0 < b) { - const c = Array(b); - - for (let d = 0; d < b; d++) c[d] = a[d]; - - return c; - } - - return []; -} - -function sa(a) { - return /^[\s\xa0]*$/.test(a); -} - -var ta = String.prototype.trim ? function (a) { - return a.trim(); -} : function (a) { - return /^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(a)[1]; -}; - -function w(a, b) { - return -1 != a.indexOf(b); -} - -function ua(a, b) { - return a < b ? -1 : a > b ? 1 : 0; -} - -var x; - -a: { - var va = l.navigator; - - if (va) { - var wa = va.userAgent; - - if (wa) { - x = wa; - break a; - } - } - - x = ""; -} - -function xa(a, b, c) { - for (const d in a) b.call(c, a[d], d, a); -} - -function ya(a) { - const b = {}; - - for (const c in a) b[c] = a[c]; - - return b; -} - -var za = "constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "); - -function Aa(a, b) { - let c, d; - - for (let e = 1; e < arguments.length; e++) { - d = arguments[e]; - - for (c in d) a[c] = d[c]; - - for (let f = 0; f < za.length; f++) c = za[f], Object.prototype.hasOwnProperty.call(d, c) && (a[c] = d[c]); - } -} - -function Ca(a) { - Ca[" "](a); - return a; -} - -Ca[" "] = aa; - -function Fa(a) { - var b = Ga; - return Object.prototype.hasOwnProperty.call(b, 9) ? b[9] : b[9] = a(9); -} - -var Ha = w(x, "Opera"), - y = w(x, "Trident") || w(x, "MSIE"), - Ia = w(x, "Edge"), - Ja = Ia || y, - Ka = w(x, "Gecko") && !(w(x.toLowerCase(), "webkit") && !w(x, "Edge")) && !(w(x, "Trident") || w(x, "MSIE")) && !w(x, "Edge"), - La = w(x.toLowerCase(), "webkit") && !w(x, "Edge"); - -function Ma() { - var a = l.document; - return a ? a.documentMode : void 0; -} - -var Na; - -a: { - var Oa = "", - Pa = function () { - var a = x; - if (Ka) return /rv:([^\);]+)(\)|;)/.exec(a); - if (Ia) return /Edge\/([\d\.]+)/.exec(a); - if (y) return /\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a); - if (La) return /WebKit\/(\S+)/.exec(a); - if (Ha) return /(?:Version)[ \/]?(\S+)/.exec(a); - }(); - - Pa && (Oa = Pa ? Pa[1] : ""); - - if (y) { - var Qa = Ma(); - - if (null != Qa && Qa > parseFloat(Oa)) { - Na = String(Qa); - break a; - } - } - - Na = Oa; -} - -var Ga = {}; - -function Ra() { - return Fa(function () { - let a = 0; - const b = ta(String(Na)).split("."), - c = ta("9").split("."), - d = Math.max(b.length, c.length); - - for (let h = 0; 0 == a && h < d; h++) { - var e = b[h] || "", - f = c[h] || ""; - - do { - e = /(\d*)(\D*)(.*)/.exec(e) || ["", "", "", ""]; - f = /(\d*)(\D*)(.*)/.exec(f) || ["", "", "", ""]; - if (0 == e[0].length && 0 == f[0].length) break; - a = ua(0 == e[1].length ? 0 : parseInt(e[1], 10), 0 == f[1].length ? 0 : parseInt(f[1], 10)) || ua(0 == e[2].length, 0 == f[2].length) || ua(e[2], f[2]); - e = e[3]; - f = f[3]; - } while (0 == a); - } - - return 0 <= a; - }); -} - -var Sa; - -if (l.document && y) { - var Ta = Ma(); - Sa = Ta ? Ta : parseInt(Na, 10) || void 0; -} else Sa = void 0; - -var Ua = Sa; - -var Va = function () { - if (!l.addEventListener || !Object.defineProperty) return !1; - var a = !1, - b = Object.defineProperty({}, "passive", { - get: function () { - a = !0; - } - }); - - try { - l.addEventListener("test", aa, b), l.removeEventListener("test", aa, b); - } catch (c) {} - - return a; -}(); - -function z(a, b) { - this.type = a; - this.g = this.target = b; - this.defaultPrevented = !1; -} - -z.prototype.h = function () { - this.defaultPrevented = !0; -}; - -function A(a, b) { - z.call(this, a ? a.type : ""); - this.relatedTarget = this.g = this.target = null; - this.button = this.screenY = this.screenX = this.clientY = this.clientX = 0; - this.key = ""; - this.metaKey = this.shiftKey = this.altKey = this.ctrlKey = !1; - this.state = null; - this.pointerId = 0; - this.pointerType = ""; - this.i = null; - - if (a) { - var c = this.type = a.type, - d = a.changedTouches && a.changedTouches.length ? a.changedTouches[0] : null; - this.target = a.target || a.srcElement; - this.g = b; - - if (b = a.relatedTarget) { - if (Ka) { - a: { - try { - Ca(b.nodeName); - var e = !0; - break a; - } catch (f) {} - - e = !1; - } - - e || (b = null); - } - } else "mouseover" == c ? b = a.fromElement : "mouseout" == c && (b = a.toElement); - - this.relatedTarget = b; - d ? (this.clientX = void 0 !== d.clientX ? d.clientX : d.pageX, this.clientY = void 0 !== d.clientY ? d.clientY : d.pageY, this.screenX = d.screenX || 0, this.screenY = d.screenY || 0) : (this.clientX = void 0 !== a.clientX ? a.clientX : a.pageX, this.clientY = void 0 !== a.clientY ? a.clientY : a.pageY, this.screenX = a.screenX || 0, this.screenY = a.screenY || 0); - this.button = a.button; - this.key = a.key || ""; - this.ctrlKey = a.ctrlKey; - this.altKey = a.altKey; - this.shiftKey = a.shiftKey; - this.metaKey = a.metaKey; - this.pointerId = a.pointerId || 0; - this.pointerType = "string" === typeof a.pointerType ? a.pointerType : Wa[a.pointerType] || ""; - this.state = a.state; - this.i = a; - a.defaultPrevented && A.Z.h.call(this); - } -} - -t(A, z); -var Wa = { - 2: "touch", - 3: "pen", - 4: "mouse" -}; - -A.prototype.h = function () { - A.Z.h.call(this); - var a = this.i; - a.preventDefault ? a.preventDefault() : a.returnValue = !1; -}; - -var B = "closure_listenable_" + (1E6 * Math.random() | 0); -var Xa = 0; - -function Ya(a, b, c, d, e) { - this.listener = a; - this.proxy = null; - this.src = b; - this.type = c; - this.capture = !!d; - this.ia = e; - this.key = ++Xa; - this.ca = this.fa = !1; -} - -function Za(a) { - a.ca = !0; - a.listener = null; - a.proxy = null; - a.src = null; - a.ia = null; -} - -function $a(a) { - this.src = a; - this.g = {}; - this.h = 0; -} - -$a.prototype.add = function (a, b, c, d, e) { - var f = a.toString(); - a = this.g[f]; - a || (a = this.g[f] = [], this.h++); - var h = ab(a, b, d, e); - -1 < h ? (b = a[h], c || (b.fa = !1)) : (b = new Ya(b, this.src, f, !!d, e), b.fa = c, a.push(b)); - return b; -}; - -function bb(a, b) { - var c = b.type; - - if (c in a.g) { - var d = a.g[c], - e = ma(d, b), - f; - (f = 0 <= e) && Array.prototype.splice.call(d, e, 1); - f && (Za(b), 0 == a.g[c].length && (delete a.g[c], a.h--)); - } -} - -function ab(a, b, c, d) { - for (var e = 0; e < a.length; ++e) { - var f = a[e]; - if (!f.ca && f.listener == b && f.capture == !!c && f.ia == d) return e; - } - - return -1; -} - -var cb = "closure_lm_" + (1E6 * Math.random() | 0), - db = {}; - -function fb(a, b, c, d, e) { - if (d && d.once) return gb(a, b, c, d, e); - - if (Array.isArray(b)) { - for (var f = 0; f < b.length; f++) fb(a, b[f], c, d, e); - - return null; - } - - c = hb(c); - return a && a[B] ? a.N(b, c, p(d) ? !!d.capture : !!d, e) : ib(a, b, c, !1, d, e); -} - -function ib(a, b, c, d, e, f) { - if (!b) throw Error("Invalid event type"); - var h = p(e) ? !!e.capture : !!e, - n = jb(a); - n || (a[cb] = n = new $a(a)); - c = n.add(b, c, d, h, f); - if (c.proxy) return c; - d = kb(); - c.proxy = d; - d.src = a; - d.listener = c; - if (a.addEventListener) Va || (e = h), void 0 === e && (e = !1), a.addEventListener(b.toString(), d, e);else if (a.attachEvent) a.attachEvent(lb(b.toString()), d);else if (a.addListener && a.removeListener) a.addListener(d);else throw Error("addEventListener and attachEvent are unavailable."); - return c; -} - -function kb() { - function a(c) { - return b.call(a.src, a.listener, c); - } - - var b = mb; - return a; -} - -function gb(a, b, c, d, e) { - if (Array.isArray(b)) { - for (var f = 0; f < b.length; f++) gb(a, b[f], c, d, e); - - return null; - } - - c = hb(c); - return a && a[B] ? a.O(b, c, p(d) ? !!d.capture : !!d, e) : ib(a, b, c, !0, d, e); -} - -function nb(a, b, c, d, e) { - if (Array.isArray(b)) for (var f = 0; f < b.length; f++) nb(a, b[f], c, d, e);else (d = p(d) ? !!d.capture : !!d, c = hb(c), a && a[B]) ? (a = a.i, b = String(b).toString(), b in a.g && (f = a.g[b], c = ab(f, c, d, e), -1 < c && (Za(f[c]), Array.prototype.splice.call(f, c, 1), 0 == f.length && (delete a.g[b], a.h--)))) : a && (a = jb(a)) && (b = a.g[b.toString()], a = -1, b && (a = ab(b, c, d, e)), (c = -1 < a ? b[a] : null) && ob(c)); -} - -function ob(a) { - if ("number" !== typeof a && a && !a.ca) { - var b = a.src; - if (b && b[B]) bb(b.i, a);else { - var c = a.type, - d = a.proxy; - b.removeEventListener ? b.removeEventListener(c, d, a.capture) : b.detachEvent ? b.detachEvent(lb(c), d) : b.addListener && b.removeListener && b.removeListener(d); - (c = jb(b)) ? (bb(c, a), 0 == c.h && (c.src = null, b[cb] = null)) : Za(a); - } - } -} - -function lb(a) { - return a in db ? db[a] : db[a] = "on" + a; -} - -function mb(a, b) { - if (a.ca) a = !0;else { - b = new A(b, this); - var c = a.listener, - d = a.ia || a.src; - a.fa && ob(a); - a = c.call(d, b); - } - return a; -} - -function jb(a) { - a = a[cb]; - return a instanceof $a ? a : null; -} - -var pb = "__closure_events_fn_" + (1E9 * Math.random() >>> 0); - -function hb(a) { - if ("function" === typeof a) return a; - a[pb] || (a[pb] = function (b) { - return a.handleEvent(b); - }); - return a[pb]; -} - -function C() { - v.call(this); - this.i = new $a(this); - this.P = this; - this.I = null; -} - -t(C, v); -C.prototype[B] = !0; - -C.prototype.removeEventListener = function (a, b, c, d) { - nb(this, a, b, c, d); -}; - -function D(a, b) { - var c, - d = a.I; - if (d) for (c = []; d; d = d.I) c.push(d); - a = a.P; - d = b.type || b; - if ("string" === typeof b) b = new z(b, a);else if (b instanceof z) b.target = b.target || a;else { - var e = b; - b = new z(d, a); - Aa(b, e); - } - e = !0; - if (c) for (var f = c.length - 1; 0 <= f; f--) { - var h = b.g = c[f]; - e = qb(h, d, !0, b) && e; - } - h = b.g = a; - e = qb(h, d, !0, b) && e; - e = qb(h, d, !1, b) && e; - if (c) for (f = 0; f < c.length; f++) h = b.g = c[f], e = qb(h, d, !1, b) && e; -} - -C.prototype.M = function () { - C.Z.M.call(this); - - if (this.i) { - var a = this.i, - c; - - for (c in a.g) { - for (var d = a.g[c], e = 0; e < d.length; e++) Za(d[e]); - - delete a.g[c]; - a.h--; - } - } - - this.I = null; -}; - -C.prototype.N = function (a, b, c, d) { - return this.i.add(String(a), b, !1, c, d); -}; - -C.prototype.O = function (a, b, c, d) { - return this.i.add(String(a), b, !0, c, d); -}; - -function qb(a, b, c, d) { - b = a.i.g[String(b)]; - if (!b) return !0; - b = b.concat(); - - for (var e = !0, f = 0; f < b.length; ++f) { - var h = b[f]; - - if (h && !h.ca && h.capture == c) { - var n = h.listener, - u = h.ia || h.src; - h.fa && bb(a.i, h); - e = !1 !== n.call(u, d) && e; - } - } - - return e && !d.defaultPrevented; -} - -var rb = l.JSON.stringify; - -function sb() { - var a = tb; - let b = null; - a.g && (b = a.g, a.g = a.g.next, a.g || (a.h = null), b.next = null); - return b; -} - -class ub { - constructor() { - this.h = this.g = null; - } - - add(a, b) { - const c = vb.get(); - c.set(a, b); - this.h ? this.h.next = c : this.g = c; - this.h = c; - } - -} - -var vb = new class { - constructor(a, b) { - this.i = a; - this.j = b; - this.h = 0; - this.g = null; - } - - get() { - let a; - 0 < this.h ? (this.h--, a = this.g, this.g = a.next, a.next = null) : a = this.i(); - return a; - } - -}(() => new wb(), a => a.reset()); - -class wb { - constructor() { - this.next = this.g = this.h = null; - } - - set(a, b) { - this.h = a; - this.g = b; - this.next = null; - } - - reset() { - this.next = this.g = this.h = null; - } - -} - -function yb(a) { - l.setTimeout(() => { - throw a; - }, 0); -} - -function zb(a, b) { - Ab || Bb(); - Cb || (Ab(), Cb = !0); - tb.add(a, b); -} - -var Ab; - -function Bb() { - var a = l.Promise.resolve(void 0); - - Ab = function () { - a.then(Db); - }; -} - -var Cb = !1, - tb = new ub(); - -function Db() { - for (var a; a = sb();) { - try { - a.h.call(a.g); - } catch (c) { - yb(c); - } - - var b = vb; - b.j(a); - 100 > b.h && (b.h++, a.next = b.g, b.g = a); - } - - Cb = !1; -} - -function Eb(a, b) { - C.call(this); - this.h = a || 1; - this.g = b || l; - this.j = q(this.kb, this); - this.l = Date.now(); -} - -t(Eb, C); -k = Eb.prototype; -k.da = !1; -k.S = null; - -k.kb = function () { - if (this.da) { - var a = Date.now() - this.l; - 0 < a && a < .8 * this.h ? this.S = this.g.setTimeout(this.j, this.h - a) : (this.S && (this.g.clearTimeout(this.S), this.S = null), D(this, "tick"), this.da && (Fb(this), this.start())); - } -}; - -k.start = function () { - this.da = !0; - this.S || (this.S = this.g.setTimeout(this.j, this.h), this.l = Date.now()); -}; - -function Fb(a) { - a.da = !1; - a.S && (a.g.clearTimeout(a.S), a.S = null); -} - -k.M = function () { - Eb.Z.M.call(this); - Fb(this); - delete this.g; -}; - -function Gb(a, b, c) { - if ("function" === typeof a) c && (a = q(a, c));else if (a && "function" == typeof a.handleEvent) a = q(a.handleEvent, a);else throw Error("Invalid listener argument"); - return 2147483647 < Number(b) ? -1 : l.setTimeout(a, b || 0); -} - -function Hb(a) { - a.g = Gb(() => { - a.g = null; - a.i && (a.i = !1, Hb(a)); - }, a.j); - const b = a.h; - a.h = null; - a.m.apply(null, b); -} - -class Ib extends v { - constructor(a, b) { - super(); - this.m = a; - this.j = b; - this.h = null; - this.i = !1; - this.g = null; - } - - l(a) { - this.h = arguments; - this.g ? this.i = !0 : Hb(this); - } - - M() { - super.M(); - this.g && (l.clearTimeout(this.g), this.g = null, this.i = !1, this.h = null); - } - -} - -function E(a) { - v.call(this); - this.h = a; - this.g = {}; -} - -t(E, v); -var Jb = []; - -function Kb(a, b, c, d) { - Array.isArray(c) || (c && (Jb[0] = c.toString()), c = Jb); - - for (var e = 0; e < c.length; e++) { - var f = fb(b, c[e], d || a.handleEvent, !1, a.h || a); - if (!f) break; - a.g[f.key] = f; - } -} - -function Lb(a) { - xa(a.g, function (b, c) { - this.g.hasOwnProperty(c) && ob(b); - }, a); - a.g = {}; -} - -E.prototype.M = function () { - E.Z.M.call(this); - Lb(this); -}; - -E.prototype.handleEvent = function () { - throw Error("EventHandler.handleEvent not implemented"); -}; - -function Mb() { - this.g = !0; -} - -Mb.prototype.Aa = function () { - this.g = !1; -}; - -function Nb(a, b, c, d, e, f) { - a.info(function () { - if (a.g) { - if (f) { - var h = ""; - - for (var n = f.split("&"), u = 0; u < n.length; u++) { - var m = n[u].split("="); - - if (1 < m.length) { - var r = m[0]; - m = m[1]; - var G = r.split("_"); - h = 2 <= G.length && "type" == G[1] ? h + (r + "=" + m + "&") : h + (r + "=redacted&"); - } - } - } else h = null; - } else h = f; - return "XMLHTTP REQ (" + d + ") [attempt " + e + "]: " + b + "\n" + c + "\n" + h; - }); -} - -function Ob(a, b, c, d, e, f, h) { - a.info(function () { - return "XMLHTTP RESP (" + d + ") [ attempt " + e + "]: " + b + "\n" + c + "\n" + f + " " + h; - }); -} - -function F(a, b, c, d) { - a.info(function () { - return "XMLHTTP TEXT (" + b + "): " + Pb(a, c) + (d ? " " + d : ""); - }); -} - -function Qb(a, b) { - a.info(function () { - return "TIMEOUT: " + b; - }); -} - -Mb.prototype.info = function () {}; - -function Pb(a, b) { - if (!a.g) return b; - if (!b) return null; - - try { - var c = JSON.parse(b); - if (c) for (a = 0; a < c.length; a++) if (Array.isArray(c[a])) { - var d = c[a]; - - if (!(2 > d.length)) { - var e = d[1]; - - if (Array.isArray(e) && !(1 > e.length)) { - var f = e[0]; - if ("noop" != f && "stop" != f && "close" != f) for (var h = 1; h < e.length; h++) e[h] = ""; - } - } - } - return rb(c); - } catch (n) { - return b; - } -} - -var H = {}, - Rb = null; - -function Sb() { - return Rb = Rb || new C(); -} - -H.Ma = "serverreachability"; - -function Tb(a) { - z.call(this, H.Ma, a); -} - -t(Tb, z); - -function I(a) { - const b = Sb(); - D(b, new Tb(b, a)); -} - -H.STAT_EVENT = "statevent"; - -function Ub(a, b) { - z.call(this, H.STAT_EVENT, a); - this.stat = b; -} - -t(Ub, z); - -function J(a) { - const b = Sb(); - D(b, new Ub(b, a)); -} - -H.Na = "timingevent"; - -function Vb(a, b) { - z.call(this, H.Na, a); - this.size = b; -} - -t(Vb, z); - -function K(a, b) { - if ("function" !== typeof a) throw Error("Fn must not be null and must be a function"); - return l.setTimeout(function () { - a(); - }, b); -} - -var Wb = { - NO_ERROR: 0, - lb: 1, - yb: 2, - xb: 3, - sb: 4, - wb: 5, - zb: 6, - Ja: 7, - TIMEOUT: 8, - Cb: 9 -}; -var Xb = { - qb: "complete", - Mb: "success", - Ka: "error", - Ja: "abort", - Eb: "ready", - Fb: "readystatechange", - TIMEOUT: "timeout", - Ab: "incrementaldata", - Db: "progress", - tb: "downloadprogress", - Ub: "uploadprogress" -}; - -function Yb() {} - -Yb.prototype.h = null; - -function Zb(a) { - return a.h || (a.h = a.i()); -} - -function $b() {} - -var L = { - OPEN: "a", - pb: "b", - Ka: "c", - Bb: "d" -}; - -function ac() { - z.call(this, "d"); -} - -t(ac, z); - -function bc() { - z.call(this, "c"); -} - -t(bc, z); -var cc; - -function dc() {} - -t(dc, Yb); - -dc.prototype.g = function () { - return new XMLHttpRequest(); -}; - -dc.prototype.i = function () { - return {}; -}; - -cc = new dc(); - -function M(a, b, c, d) { - this.l = a; - this.j = b; - this.m = c; - this.X = d || 1; - this.V = new E(this); - this.P = ec; - a = Ja ? 125 : void 0; - this.W = new Eb(a); - this.H = null; - this.i = !1; - this.s = this.A = this.v = this.K = this.F = this.Y = this.B = null; - this.D = []; - this.g = null; - this.C = 0; - this.o = this.u = null; - this.N = -1; - this.I = !1; - this.O = 0; - this.L = null; - this.aa = this.J = this.$ = this.U = !1; - this.h = new fc(); -} - -function fc() { - this.i = null; - this.g = ""; - this.h = !1; -} - -var ec = 45E3, - gc = {}, - hc = {}; -k = M.prototype; - -k.setTimeout = function (a) { - this.P = a; -}; - -function ic(a, b, c) { - a.K = 1; - a.v = jc(N(b)); - a.s = c; - a.U = !0; - kc(a, null); -} - -function kc(a, b) { - a.F = Date.now(); - lc(a); - a.A = N(a.v); - var c = a.A, - d = a.X; - Array.isArray(d) || (d = [String(d)]); - mc(c.h, "t", d); - a.C = 0; - c = a.l.H; - a.h = new fc(); - a.g = nc(a.l, c ? b : null, !a.s); - 0 < a.O && (a.L = new Ib(q(a.Ia, a, a.g), a.O)); - Kb(a.V, a.g, "readystatechange", a.gb); - b = a.H ? ya(a.H) : {}; - a.s ? (a.u || (a.u = "POST"), b["Content-Type"] = "application/x-www-form-urlencoded", a.g.ea(a.A, a.u, a.s, b)) : (a.u = "GET", a.g.ea(a.A, a.u, null, b)); - I(1); - Nb(a.j, a.u, a.A, a.m, a.X, a.s); -} - -k.gb = function (a) { - a = a.target; - const b = this.L; - b && 3 == O(a) ? b.l() : this.Ia(a); -}; - -k.Ia = function (a) { - try { - if (a == this.g) a: { - const r = O(this.g); - var b = this.g.Da(); - const G = this.g.ba(); - - if (!(3 > r) && (3 != r || Ja || this.g && (this.h.h || this.g.ga() || oc(this.g)))) { - this.I || 4 != r || 7 == b || (8 == b || 0 >= G ? I(3) : I(2)); - pc(this); - var c = this.g.ba(); - this.N = c; - - b: if (qc(this)) { - var d = oc(this.g); - a = ""; - var e = d.length, - f = 4 == O(this.g); - - if (!this.h.i) { - if ("undefined" === typeof TextDecoder) { - P(this); - rc(this); - var h = ""; - break b; - } - - this.h.i = new l.TextDecoder(); - } - - for (b = 0; b < e; b++) this.h.h = !0, a += this.h.i.decode(d[b], { - stream: f && b == e - 1 - }); - - d.splice(0, e); - this.h.g += a; - this.C = 0; - h = this.h.g; - } else h = this.g.ga(); - - this.i = 200 == c; - Ob(this.j, this.u, this.A, this.m, this.X, r, c); - - if (this.i) { - if (this.$ && !this.J) { - b: { - if (this.g) { - var n, - u = this.g; - - if ((n = u.g ? u.g.getResponseHeader("X-HTTP-Initial-Response") : null) && !sa(n)) { - var m = n; - break b; - } - } - - m = null; - } - - if (c = m) F(this.j, this.m, c, "Initial handshake response via X-HTTP-Initial-Response"), this.J = !0, sc(this, c);else { - this.i = !1; - this.o = 3; - J(12); - P(this); - rc(this); - break a; - } - } - - this.U ? (tc(this, r, h), Ja && this.i && 3 == r && (Kb(this.V, this.W, "tick", this.fb), this.W.start())) : (F(this.j, this.m, h, null), sc(this, h)); - 4 == r && P(this); - this.i && !this.I && (4 == r ? uc(this.l, this) : (this.i = !1, lc(this))); - } else 400 == c && 0 < h.indexOf("Unknown SID") ? (this.o = 3, J(12)) : (this.o = 0, J(13)), P(this), rc(this); - } - } - } catch (r) {} finally {} -}; - -function qc(a) { - return a.g ? "GET" == a.u && 2 != a.K && a.l.Ba : !1; -} - -function tc(a, b, c) { - let d = !0, - e; - - for (; !a.I && a.C < c.length;) if (e = vc(a, c), e == hc) { - 4 == b && (a.o = 4, J(14), d = !1); - F(a.j, a.m, null, "[Incomplete Response]"); - break; - } else if (e == gc) { - a.o = 4; - J(15); - F(a.j, a.m, c, "[Invalid Chunk]"); - d = !1; - break; - } else F(a.j, a.m, e, null), sc(a, e); - - qc(a) && e != hc && e != gc && (a.h.g = "", a.C = 0); - 4 != b || 0 != c.length || a.h.h || (a.o = 1, J(16), d = !1); - a.i = a.i && d; - d ? 0 < c.length && !a.aa && (a.aa = !0, b = a.l, b.g == a && b.$ && !b.L && (b.h.info("Great, no buffering proxy detected. Bytes received: " + c.length), wc(b), b.L = !0, J(11))) : (F(a.j, a.m, c, "[Invalid Chunked Response]"), P(a), rc(a)); -} - -k.fb = function () { - if (this.g) { - var a = O(this.g), - b = this.g.ga(); - this.C < b.length && (pc(this), tc(this, a, b), this.i && 4 != a && lc(this)); - } -}; - -function vc(a, b) { - var c = a.C, - d = b.indexOf("\n", c); - if (-1 == d) return hc; - c = Number(b.substring(c, d)); - if (isNaN(c)) return gc; - d += 1; - if (d + c > b.length) return hc; - b = b.substr(d, c); - a.C = d + c; - return b; -} - -k.cancel = function () { - this.I = !0; - P(this); -}; - -function lc(a) { - a.Y = Date.now() + a.P; - xc(a, a.P); -} - -function xc(a, b) { - if (null != a.B) throw Error("WatchDog timer not null"); - a.B = K(q(a.eb, a), b); -} - -function pc(a) { - a.B && (l.clearTimeout(a.B), a.B = null); -} - -k.eb = function () { - this.B = null; - const a = Date.now(); - 0 <= a - this.Y ? (Qb(this.j, this.A), 2 != this.K && (I(3), J(17)), P(this), this.o = 2, rc(this)) : xc(this, this.Y - a); -}; - -function rc(a) { - 0 == a.l.G || a.I || uc(a.l, a); -} - -function P(a) { - pc(a); - var b = a.L; - b && "function" == typeof b.na && b.na(); - a.L = null; - Fb(a.W); - Lb(a.V); - a.g && (b = a.g, a.g = null, b.abort(), b.na()); -} - -function sc(a, b) { - try { - var c = a.l; - if (0 != c.G && (c.g == a || yc(c.i, a))) if (c.I = a.N, !a.J && yc(c.i, a) && 3 == c.G) { - try { - var d = c.Ca.g.parse(b); - } catch (m) { - d = null; - } - - if (Array.isArray(d) && 3 == d.length) { - var e = d; - if (0 == e[0]) a: { - if (!c.u) { - if (c.g) if (c.g.F + 3E3 < a.F) zc(c), Ac(c);else break a; - Bc(c); - J(18); - } - } else c.ta = e[1], 0 < c.ta - c.U && 37500 > e[2] && c.N && 0 == c.A && !c.v && (c.v = K(q(c.ab, c), 6E3)); - - if (1 >= Cc(c.i) && c.ka) { - try { - c.ka(); - } catch (m) {} - - c.ka = void 0; - } - } else Q(c, 11); - } else if ((a.J || c.g == a) && zc(c), !sa(b)) for (e = c.Ca.g.parse(b), b = 0; b < e.length; b++) { - let m = e[b]; - c.U = m[0]; - m = m[1]; - if (2 == c.G) { - if ("c" == m[0]) { - c.J = m[1]; - c.la = m[2]; - const r = m[3]; - null != r && (c.ma = r, c.h.info("VER=" + c.ma)); - const G = m[4]; - null != G && (c.za = G, c.h.info("SVER=" + c.za)); - const Da = m[5]; - null != Da && "number" === typeof Da && 0 < Da && (d = 1.5 * Da, c.K = d, c.h.info("backChannelRequestTimeoutMs_=" + d)); - d = c; - const ca = a.g; - - if (ca) { - const Ea = ca.g ? ca.g.getResponseHeader("X-Client-Wire-Protocol") : null; - - if (Ea) { - var f = d.i; - !f.g && (w(Ea, "spdy") || w(Ea, "quic") || w(Ea, "h2")) && (f.j = f.l, f.g = new Set(), f.h && (Dc(f, f.h), f.h = null)); - } - - if (d.D) { - const xb = ca.g ? ca.g.getResponseHeader("X-HTTP-Session-Id") : null; - xb && (d.sa = xb, R(d.F, d.D, xb)); - } - } - - c.G = 3; - c.j && c.j.xa(); - c.$ && (c.O = Date.now() - a.F, c.h.info("Handshake RTT: " + c.O + "ms")); - d = c; - var h = a; - d.oa = Ec(d, d.H ? d.la : null, d.W); - - if (h.J) { - Fc(d.i, h); - var n = h, - u = d.K; - u && n.setTimeout(u); - n.B && (pc(n), lc(n)); - d.g = h; - } else Gc(d); - - 0 < c.l.length && Hc(c); - } else "stop" != m[0] && "close" != m[0] || Q(c, 7); - } else 3 == c.G && ("stop" == m[0] || "close" == m[0] ? "stop" == m[0] ? Q(c, 7) : Ic(c) : "noop" != m[0] && c.j && c.j.wa(m), c.A = 0); - } - I(4); - } catch (m) {} -} - -function Jc(a) { - if (a.R && "function" == typeof a.R) return a.R(); - if ("string" === typeof a) return a.split(""); - - if (ba(a)) { - for (var b = [], c = a.length, d = 0; d < c; d++) b.push(a[d]); - - return b; - } - - b = []; - c = 0; - - for (d in a) b[c++] = a[d]; - - return b; -} - -function Kc(a, b) { - if (a.forEach && "function" == typeof a.forEach) a.forEach(b, void 0);else if (ba(a) || "string" === typeof a) na(a, b, void 0);else { - if (a.T && "function" == typeof a.T) var c = a.T();else if (a.R && "function" == typeof a.R) c = void 0;else if (ba(a) || "string" === typeof a) { - c = []; - - for (var d = a.length, e = 0; e < d; e++) c.push(e); - } else for (e in c = [], d = 0, a) c[d++] = e; - d = Jc(a); - e = d.length; - - for (var f = 0; f < e; f++) b.call(void 0, d[f], c && c[f], a); - } -} - -function S(a, b) { - this.h = {}; - this.g = []; - this.i = 0; - var c = arguments.length; - - if (1 < c) { - if (c % 2) throw Error("Uneven number of arguments"); - - for (var d = 0; d < c; d += 2) this.set(arguments[d], arguments[d + 1]); - } else if (a) if (a instanceof S) for (c = a.T(), d = 0; d < c.length; d++) this.set(c[d], a.get(c[d]));else for (d in a) this.set(d, a[d]); -} - -k = S.prototype; - -k.R = function () { - Lc(this); - - for (var a = [], b = 0; b < this.g.length; b++) a.push(this.h[this.g[b]]); - - return a; -}; - -k.T = function () { - Lc(this); - return this.g.concat(); -}; - -function Lc(a) { - if (a.i != a.g.length) { - for (var b = 0, c = 0; b < a.g.length;) { - var d = a.g[b]; - T(a.h, d) && (a.g[c++] = d); - b++; - } - - a.g.length = c; - } - - if (a.i != a.g.length) { - var e = {}; - - for (c = b = 0; b < a.g.length;) d = a.g[b], T(e, d) || (a.g[c++] = d, e[d] = 1), b++; - - a.g.length = c; - } -} - -k.get = function (a, b) { - return T(this.h, a) ? this.h[a] : b; -}; - -k.set = function (a, b) { - T(this.h, a) || (this.i++, this.g.push(a)); - this.h[a] = b; -}; - -k.forEach = function (a, b) { - for (var c = this.T(), d = 0; d < c.length; d++) { - var e = c[d], - f = this.get(e); - a.call(b, f, e, this); - } -}; - -function T(a, b) { - return Object.prototype.hasOwnProperty.call(a, b); -} - -var Mc = /^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/; - -function Nc(a, b) { - if (a) { - a = a.split("&"); - - for (var c = 0; c < a.length; c++) { - var d = a[c].indexOf("="), - e = null; - - if (0 <= d) { - var f = a[c].substring(0, d); - e = a[c].substring(d + 1); - } else f = a[c]; - - b(f, e ? decodeURIComponent(e.replace(/\+/g, " ")) : ""); - } - } -} - -function U(a, b) { - this.i = this.s = this.j = ""; - this.m = null; - this.o = this.l = ""; - this.g = !1; - - if (a instanceof U) { - this.g = void 0 !== b ? b : a.g; - Oc(this, a.j); - this.s = a.s; - Pc(this, a.i); - Qc(this, a.m); - this.l = a.l; - b = a.h; - var c = new Rc(); - c.i = b.i; - b.g && (c.g = new S(b.g), c.h = b.h); - Sc(this, c); - this.o = a.o; - } else a && (c = String(a).match(Mc)) ? (this.g = !!b, Oc(this, c[1] || "", !0), this.s = Tc(c[2] || ""), Pc(this, c[3] || "", !0), Qc(this, c[4]), this.l = Tc(c[5] || "", !0), Sc(this, c[6] || "", !0), this.o = Tc(c[7] || "")) : (this.g = !!b, this.h = new Rc(null, this.g)); -} - -U.prototype.toString = function () { - var a = [], - b = this.j; - b && a.push(Uc(b, Vc, !0), ":"); - var c = this.i; - if (c || "file" == b) a.push("//"), (b = this.s) && a.push(Uc(b, Vc, !0), "@"), a.push(encodeURIComponent(String(c)).replace(/%25([0-9a-fA-F]{2})/g, "%$1")), c = this.m, null != c && a.push(":", String(c)); - if (c = this.l) this.i && "/" != c.charAt(0) && a.push("/"), a.push(Uc(c, "/" == c.charAt(0) ? Wc : Xc, !0)); - (c = this.h.toString()) && a.push("?", c); - (c = this.o) && a.push("#", Uc(c, Yc)); - return a.join(""); -}; - -function N(a) { - return new U(a); -} - -function Oc(a, b, c) { - a.j = c ? Tc(b, !0) : b; - a.j && (a.j = a.j.replace(/:$/, "")); -} - -function Pc(a, b, c) { - a.i = c ? Tc(b, !0) : b; -} - -function Qc(a, b) { - if (b) { - b = Number(b); - if (isNaN(b) || 0 > b) throw Error("Bad port number " + b); - a.m = b; - } else a.m = null; -} - -function Sc(a, b, c) { - b instanceof Rc ? (a.h = b, Zc(a.h, a.g)) : (c || (b = Uc(b, $c)), a.h = new Rc(b, a.g)); -} - -function R(a, b, c) { - a.h.set(b, c); -} - -function jc(a) { - R(a, "zx", Math.floor(2147483648 * Math.random()).toString(36) + Math.abs(Math.floor(2147483648 * Math.random()) ^ Date.now()).toString(36)); - return a; -} - -function ad(a) { - return a instanceof U ? N(a) : new U(a, void 0); -} - -function bd(a, b, c, d) { - var e = new U(null, void 0); - a && Oc(e, a); - b && Pc(e, b); - c && Qc(e, c); - d && (e.l = d); - return e; -} - -function Tc(a, b) { - return a ? b ? decodeURI(a.replace(/%25/g, "%2525")) : decodeURIComponent(a) : ""; -} - -function Uc(a, b, c) { - return "string" === typeof a ? (a = encodeURI(a).replace(b, cd), c && (a = a.replace(/%25([0-9a-fA-F]{2})/g, "%$1")), a) : null; -} - -function cd(a) { - a = a.charCodeAt(0); - return "%" + (a >> 4 & 15).toString(16) + (a & 15).toString(16); -} - -var Vc = /[#\/\?@]/g, - Xc = /[#\?:]/g, - Wc = /[#\?]/g, - $c = /[#\?@]/g, - Yc = /#/g; - -function Rc(a, b) { - this.h = this.g = null; - this.i = a || null; - this.j = !!b; -} - -function V(a) { - a.g || (a.g = new S(), a.h = 0, a.i && Nc(a.i, function (b, c) { - a.add(decodeURIComponent(b.replace(/\+/g, " ")), c); - })); -} - -k = Rc.prototype; - -k.add = function (a, b) { - V(this); - this.i = null; - a = W(this, a); - var c = this.g.get(a); - c || this.g.set(a, c = []); - c.push(b); - this.h += 1; - return this; -}; - -function dd(a, b) { - V(a); - b = W(a, b); - T(a.g.h, b) && (a.i = null, a.h -= a.g.get(b).length, a = a.g, T(a.h, b) && (delete a.h[b], a.i--, a.g.length > 2 * a.i && Lc(a))); -} - -function ed(a, b) { - V(a); - b = W(a, b); - return T(a.g.h, b); -} - -k.forEach = function (a, b) { - V(this); - this.g.forEach(function (c, d) { - na(c, function (e) { - a.call(b, e, d, this); - }, this); - }, this); -}; - -k.T = function () { - V(this); - - for (var a = this.g.R(), b = this.g.T(), c = [], d = 0; d < b.length; d++) for (var e = a[d], f = 0; f < e.length; f++) c.push(b[d]); - - return c; -}; - -k.R = function (a) { - V(this); - var b = []; - if ("string" === typeof a) ed(this, a) && (b = qa(b, this.g.get(W(this, a))));else { - a = this.g.R(); - - for (var c = 0; c < a.length; c++) b = qa(b, a[c]); - } - return b; -}; - -k.set = function (a, b) { - V(this); - this.i = null; - a = W(this, a); - ed(this, a) && (this.h -= this.g.get(a).length); - this.g.set(a, [b]); - this.h += 1; - return this; -}; - -k.get = function (a, b) { - if (!a) return b; - a = this.R(a); - return 0 < a.length ? String(a[0]) : b; -}; - -function mc(a, b, c) { - dd(a, b); - 0 < c.length && (a.i = null, a.g.set(W(a, b), ra(c)), a.h += c.length); -} - -k.toString = function () { - if (this.i) return this.i; - if (!this.g) return ""; - - for (var a = [], b = this.g.T(), c = 0; c < b.length; c++) { - var d = b[c], - e = encodeURIComponent(String(d)); - d = this.R(d); - - for (var f = 0; f < d.length; f++) { - var h = e; - "" !== d[f] && (h += "=" + encodeURIComponent(String(d[f]))); - a.push(h); - } - } - - return this.i = a.join("&"); -}; - -function W(a, b) { - b = String(b); - a.j && (b = b.toLowerCase()); - return b; -} - -function Zc(a, b) { - b && !a.j && (V(a), a.i = null, a.g.forEach(function (c, d) { - var e = d.toLowerCase(); - d != e && (dd(this, d), mc(this, e, c)); - }, a)); - a.j = b; -} - -var fd = class { - constructor(a, b) { - this.h = a; - this.g = b; - } - -}; - -function gd(a) { - this.l = a || hd; - l.PerformanceNavigationTiming ? (a = l.performance.getEntriesByType("navigation"), a = 0 < a.length && ("hq" == a[0].nextHopProtocol || "h2" == a[0].nextHopProtocol)) : a = !!(l.g && l.g.Ea && l.g.Ea() && l.g.Ea().Zb); - this.j = a ? this.l : 1; - this.g = null; - 1 < this.j && (this.g = new Set()); - this.h = null; - this.i = []; -} - -var hd = 10; - -function id(a) { - return a.h ? !0 : a.g ? a.g.size >= a.j : !1; -} - -function Cc(a) { - return a.h ? 1 : a.g ? a.g.size : 0; -} - -function yc(a, b) { - return a.h ? a.h == b : a.g ? a.g.has(b) : !1; -} - -function Dc(a, b) { - a.g ? a.g.add(b) : a.h = b; -} - -function Fc(a, b) { - a.h && a.h == b ? a.h = null : a.g && a.g.has(b) && a.g.delete(b); -} - -gd.prototype.cancel = function () { - this.i = jd(this); - if (this.h) this.h.cancel(), this.h = null;else if (this.g && 0 !== this.g.size) { - for (const a of this.g.values()) a.cancel(); - - this.g.clear(); - } -}; - -function jd(a) { - if (null != a.h) return a.i.concat(a.h.D); - - if (null != a.g && 0 !== a.g.size) { - let b = a.i; - - for (const c of a.g.values()) b = b.concat(c.D); - - return b; - } - - return ra(a.i); -} - -function kd() {} - -kd.prototype.stringify = function (a) { - return l.JSON.stringify(a, void 0); -}; - -kd.prototype.parse = function (a) { - return l.JSON.parse(a, void 0); -}; - -function ld() { - this.g = new kd(); -} - -function md(a, b, c) { - const d = c || ""; - - try { - Kc(a, function (e, f) { - let h = e; - p(e) && (h = rb(e)); - b.push(d + f + "=" + encodeURIComponent(h)); - }); - } catch (e) { - throw b.push(d + "type=" + encodeURIComponent("_badmap")), e; - } -} - -function nd(a, b) { - const c = new Mb(); - - if (l.Image) { - const d = new Image(); - d.onload = ja(od, c, d, "TestLoadImage: loaded", !0, b); - d.onerror = ja(od, c, d, "TestLoadImage: error", !1, b); - d.onabort = ja(od, c, d, "TestLoadImage: abort", !1, b); - d.ontimeout = ja(od, c, d, "TestLoadImage: timeout", !1, b); - l.setTimeout(function () { - if (d.ontimeout) d.ontimeout(); - }, 1E4); - d.src = a; - } else b(!1); -} - -function od(a, b, c, d, e) { - try { - b.onload = null, b.onerror = null, b.onabort = null, b.ontimeout = null, e(d); - } catch (f) {} -} - -function pd(a) { - this.l = a.$b || null; - this.j = a.ib || !1; -} - -t(pd, Yb); - -pd.prototype.g = function () { - return new qd(this.l, this.j); -}; - -pd.prototype.i = function (a) { - return function () { - return a; - }; -}({}); - -function qd(a, b) { - C.call(this); - this.D = a; - this.u = b; - this.m = void 0; - this.readyState = rd; - 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; -} - -t(qd, C); -var rd = 0; -k = qd.prototype; - -k.open = function (a, b) { - if (this.readyState != rd) throw this.abort(), Error("Error reopening a connection"); - this.C = a; - this.B = b; - this.readyState = 1; - sd(this); -}; - -k.send = function (a) { - if (1 != this.readyState) throw this.abort(), Error("need to call open() first. "); - this.g = !0; - const b = { - headers: this.v, - method: this.C, - credentials: this.m, - cache: void 0 - }; - a && (b.body = a); - (this.D || l).fetch(new Request(this.B, b)).then(this.Va.bind(this), this.ha.bind(this)); -}; - -k.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, td(this)); - this.readyState = rd; -}; - -k.Va = function (a) { - if (this.g && (this.l = a, this.h || (this.status = this.l.status, this.statusText = this.l.statusText, this.h = a.headers, this.readyState = 2, sd(this)), this.g && (this.readyState = 3, sd(this), this.g))) if ("arraybuffer" === this.responseType) a.arrayBuffer().then(this.Ta.bind(this), this.ha.bind(this));else if ("undefined" !== typeof l.ReadableStream && "body" in a) { - this.j = a.body.getReader(); - - if (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(); - - ud(this); - } else a.text().then(this.Ua.bind(this), this.ha.bind(this)); -}; - -function ud(a) { - a.j.read().then(a.Sa.bind(a)).catch(a.ha.bind(a)); -} - -k.Sa = function (a) { - if (this.g) { - if (this.u && a.value) this.response.push(a.value);else if (!this.u) { - var b = a.value ? a.value : new Uint8Array(0); - if (b = this.A.decode(b, { - stream: !a.done - })) this.response = this.responseText += b; - } - a.done ? td(this) : sd(this); - 3 == this.readyState && ud(this); - } -}; - -k.Ua = function (a) { - this.g && (this.response = this.responseText = a, td(this)); -}; - -k.Ta = function (a) { - this.g && (this.response = a, td(this)); -}; - -k.ha = function () { - this.g && td(this); -}; - -function td(a) { - a.readyState = 4; - a.l = null; - a.j = null; - a.A = null; - sd(a); -} - -k.setRequestHeader = function (a, b) { - this.v.append(a, b); -}; - -k.getResponseHeader = function (a) { - return this.h ? this.h.get(a.toLowerCase()) || "" : ""; -}; - -k.getAllResponseHeaders = function () { - if (!this.h) return ""; - const a = [], - b = this.h.entries(); - - for (var c = b.next(); !c.done;) c = c.value, a.push(c[0] + ": " + c[1]), c = b.next(); - - return a.join("\r\n"); -}; - -function sd(a) { - a.onreadystatechange && a.onreadystatechange.call(a); -} - -Object.defineProperty(qd.prototype, "withCredentials", { - get: function () { - return "include" === this.m; - }, - set: function (a) { - this.m = a ? "include" : "same-origin"; - } -}); -var vd = l.JSON.parse; - -function X(a) { - C.call(this); - this.headers = new S(); - this.u = a || 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 = wd; - this.K = this.L = !1; -} - -t(X, C); -var wd = "", - xd = /^https?$/i, - yd = ["POST", "PUT"]; -k = X.prototype; - -k.ea = function (a, b, c, d) { - if (this.g) throw Error("[goog.net.XhrIo] Object is active with another request=" + this.H + "; newUri=" + a); - b = b ? b.toUpperCase() : "GET"; - this.H = a; - this.j = ""; - this.m = 0; - this.D = !1; - this.h = !0; - this.g = this.u ? this.u.g() : cc.g(); - this.C = this.u ? Zb(this.u) : Zb(cc); - this.g.onreadystatechange = q(this.Fa, this); - - try { - this.F = !0, this.g.open(b, String(a), !0), this.F = !1; - } catch (f) { - zd(this, f); - return; - } - - a = c || ""; - const e = new S(this.headers); - d && Kc(d, function (f, h) { - e.set(h, f); - }); - d = oa(e.T()); - c = l.FormData && a instanceof l.FormData; - !(0 <= ma(yd, b)) || d || c || e.set("Content-Type", "application/x-www-form-urlencoded;charset=utf-8"); - e.forEach(function (f, h) { - this.g.setRequestHeader(h, f); - }, this); - this.J && (this.g.responseType = this.J); - "withCredentials" in this.g && this.g.withCredentials !== this.L && (this.g.withCredentials = this.L); - - try { - Ad(this), 0 < this.B && ((this.K = Bd(this.g)) ? (this.g.timeout = this.B, this.g.ontimeout = q(this.pa, this)) : this.A = Gb(this.pa, this.B, this)), this.v = !0, this.g.send(a), this.v = !1; - } catch (f) { - zd(this, f); - } -}; - -function Bd(a) { - return y && Ra() && "number" === typeof a.timeout && void 0 !== a.ontimeout; -} - -function pa(a) { - return "content-type" == a.toLowerCase(); -} - -k.pa = function () { - "undefined" != typeof goog && this.g && (this.j = "Timed out after " + this.B + "ms, aborting", this.m = 8, D(this, "timeout"), this.abort(8)); -}; - -function zd(a, b) { - a.h = !1; - a.g && (a.l = !0, a.g.abort(), a.l = !1); - a.j = b; - a.m = 5; - Cd(a); - Dd(a); -} - -function Cd(a) { - a.D || (a.D = !0, D(a, "complete"), D(a, "error")); -} - -k.abort = function (a) { - this.g && this.h && (this.h = !1, this.l = !0, this.g.abort(), this.l = !1, this.m = a || 7, D(this, "complete"), D(this, "abort"), Dd(this)); -}; - -k.M = function () { - this.g && (this.h && (this.h = !1, this.l = !0, this.g.abort(), this.l = !1), Dd(this, !0)); - X.Z.M.call(this); -}; - -k.Fa = function () { - this.s || (this.F || this.v || this.l ? Ed(this) : this.cb()); -}; - -k.cb = function () { - Ed(this); -}; - -function Ed(a) { - if (a.h && "undefined" != typeof goog && (!a.C[1] || 4 != O(a) || 2 != a.ba())) if (a.v && 4 == O(a)) Gb(a.Fa, 0, a);else if (D(a, "readystatechange"), 4 == O(a)) { - a.h = !1; - - try { - const n = a.ba(); - - a: switch (n) { - case 200: - case 201: - case 202: - case 204: - case 206: - case 304: - case 1223: - var b = !0; - break a; - - default: - b = !1; - } - - var c; - - if (!(c = b)) { - var d; - - if (d = 0 === n) { - var e = String(a.H).match(Mc)[1] || null; - - if (!e && l.self && l.self.location) { - var f = l.self.location.protocol; - e = f.substr(0, f.length - 1); - } - - d = !xd.test(e ? e.toLowerCase() : ""); - } - - c = d; - } - - if (c) D(a, "complete"), D(a, "success");else { - a.m = 6; - - try { - var h = 2 < O(a) ? a.g.statusText : ""; - } catch (u) { - h = ""; - } - - a.j = h + " [" + a.ba() + "]"; - Cd(a); - } - } finally { - Dd(a); - } - } -} - -function Dd(a, b) { - if (a.g) { - Ad(a); - const c = a.g, - d = a.C[0] ? aa : null; - a.g = null; - a.C = null; - b || D(a, "ready"); - - try { - c.onreadystatechange = d; - } catch (e) {} - } -} - -function Ad(a) { - a.g && a.K && (a.g.ontimeout = null); - a.A && (l.clearTimeout(a.A), a.A = null); -} - -function O(a) { - return a.g ? a.g.readyState : 0; -} - -k.ba = function () { - try { - return 2 < O(this) ? this.g.status : -1; - } catch (a) { - return -1; - } -}; - -k.ga = function () { - try { - return this.g ? this.g.responseText : ""; - } catch (a) { - return ""; - } -}; - -k.Qa = function (a) { - if (this.g) { - var b = this.g.responseText; - a && 0 == b.indexOf(a) && (b = b.substring(a.length)); - return vd(b); - } -}; - -function oc(a) { - try { - if (!a.g) return null; - if ("response" in a.g) return a.g.response; - - switch (a.J) { - case wd: - case "text": - return a.g.responseText; - - case "arraybuffer": - if ("mozResponseArrayBuffer" in a.g) return a.g.mozResponseArrayBuffer; - } - - return null; - } catch (b) { - return null; - } -} - -k.Da = function () { - return this.m; -}; - -k.La = function () { - return "string" === typeof this.j ? this.j : String(this.j); -}; - -function Fd(a) { - let b = ""; - xa(a, function (c, d) { - b += d; - b += ":"; - b += c; - b += "\r\n"; - }); - return b; -} - -function Gd(a, b, c) { - a: { - for (d in c) { - var d = !1; - break a; - } - - d = !0; - } - - d || (c = Fd(c), "string" === typeof a ? null != c && encodeURIComponent(String(c)) : R(a, b, c)); -} - -function Hd(a, b, c) { - return c && c.internalChannelParams ? c.internalChannelParams[a] || b : b; -} - -function Id(a) { - this.za = 0; - this.l = []; - this.h = new Mb(); - this.la = this.oa = this.F = this.W = this.g = this.sa = this.D = this.aa = this.o = this.P = this.s = null; - this.Za = this.V = 0; - this.Xa = Hd("failFast", !1, a); - this.N = this.v = this.u = this.m = this.j = null; - this.X = !0; - this.I = this.ta = this.U = -1; - this.Y = this.A = this.C = 0; - this.Pa = Hd("baseRetryDelayMs", 5E3, a); - this.$a = Hd("retryDelaySeedMs", 1E4, a); - this.Ya = Hd("forwardChannelMaxRetries", 2, a); - this.ra = Hd("forwardChannelRequestTimeoutMs", 2E4, a); - this.qa = a && a.xmlHttpFactory || void 0; - this.Ba = a && a.Yb || !1; - this.K = void 0; - this.H = a && a.supportsCrossDomainXhr || !1; - this.J = ""; - this.i = new gd(a && a.concurrentRequestLimit); - this.Ca = new ld(); - this.ja = a && a.fastHandshake || !1; - this.Ra = a && a.Wb || !1; - a && a.Aa && this.h.Aa(); - a && a.forceLongPolling && (this.X = !1); - this.$ = !this.ja && this.X && a && a.detectBufferingProxy || !1; - this.ka = void 0; - this.O = 0; - this.L = !1; - this.B = null; - this.Wa = !a || !1 !== a.Xb; -} - -k = Id.prototype; -k.ma = 8; -k.G = 1; - -function Ic(a) { - Jd(a); - - if (3 == a.G) { - var b = a.V++, - c = N(a.F); - R(c, "SID", a.J); - R(c, "RID", b); - R(c, "TYPE", "terminate"); - Kd(a, c); - b = new M(a, a.h, b, void 0); - b.K = 2; - b.v = jc(N(c)); - c = !1; - l.navigator && l.navigator.sendBeacon && (c = l.navigator.sendBeacon(b.v.toString(), "")); - !c && l.Image && (new Image().src = b.v, c = !0); - c || (b.g = nc(b.l, null), b.g.ea(b.v)); - b.F = Date.now(); - lc(b); - } - - Ld(a); -} - -k.hb = function (a) { - try { - this.h.info("Origin Trials invoked: " + a); - } catch (b) {} -}; - -function Ac(a) { - a.g && (wc(a), a.g.cancel(), a.g = null); -} - -function Jd(a) { - Ac(a); - a.u && (l.clearTimeout(a.u), a.u = null); - zc(a); - a.i.cancel(); - a.m && ("number" === typeof a.m && l.clearTimeout(a.m), a.m = null); -} - -function Md(a, b) { - a.l.push(new fd(a.Za++, b)); - 3 == a.G && Hc(a); -} - -function Hc(a) { - id(a.i) || a.m || (a.m = !0, zb(a.Ha, a), a.C = 0); -} - -function Nd(a, b) { - if (Cc(a.i) >= a.i.j - (a.m ? 1 : 0)) return !1; - if (a.m) return a.l = b.D.concat(a.l), !0; - if (1 == a.G || 2 == a.G || a.C >= (a.Xa ? 0 : a.Ya)) return !1; - a.m = K(q(a.Ha, a, b), Od(a, a.C)); - a.C++; - return !0; -} - -k.Ha = function (a) { - if (this.m) if (this.m = null, 1 == this.G) { - if (!a) { - this.V = Math.floor(1E5 * Math.random()); - a = this.V++; - const e = new M(this, this.h, a, void 0); - let f = this.s; - this.P && (f ? (f = ya(f), Aa(f, this.P)) : f = this.P); - null === this.o && (e.H = f); - if (this.ja) a: { - var b = 0; - - for (var c = 0; c < this.l.length; c++) { - b: { - var d = this.l[c]; - - if ("__data__" in d.g && (d = d.g.__data__, "string" === typeof d)) { - d = d.length; - break b; - } - - d = void 0; - } - - if (void 0 === d) break; - b += d; - - if (4096 < b) { - b = c; - break a; - } - - if (4096 === b || c === this.l.length - 1) { - b = c + 1; - break a; - } - } - - b = 1E3; - } else b = 1E3; - b = Pd(this, e, b); - c = N(this.F); - R(c, "RID", a); - R(c, "CVER", 22); - this.D && R(c, "X-HTTP-Session-Id", this.D); - Kd(this, c); - this.o && f && Gd(c, this.o, f); - Dc(this.i, e); - this.Ra && R(c, "TYPE", "init"); - this.ja ? (R(c, "$req", b), R(c, "SID", "null"), e.$ = !0, ic(e, c, null)) : ic(e, c, b); - this.G = 2; - } - } else 3 == this.G && (a ? Qd(this, a) : 0 == this.l.length || id(this.i) || Qd(this)); -}; - -function Qd(a, b) { - var c; - b ? c = b.m : c = a.V++; - const d = N(a.F); - R(d, "SID", a.J); - R(d, "RID", c); - R(d, "AID", a.U); - Kd(a, d); - a.o && a.s && Gd(d, a.o, a.s); - c = new M(a, a.h, c, a.C + 1); - null === a.o && (c.H = a.s); - b && (a.l = b.D.concat(a.l)); - b = Pd(a, c, 1E3); - c.setTimeout(Math.round(.5 * a.ra) + Math.round(.5 * a.ra * Math.random())); - Dc(a.i, c); - ic(c, d, b); -} - -function Kd(a, b) { - a.j && Kc({}, function (c, d) { - R(b, d, c); - }); -} - -function Pd(a, b, c) { - c = Math.min(a.l.length, c); - var d = a.j ? q(a.j.Oa, a.j, a) : null; - - a: { - var e = a.l; - let f = -1; - - for (;;) { - const h = ["count=" + c]; - -1 == f ? 0 < c ? (f = e[0].h, h.push("ofs=" + f)) : f = 0 : h.push("ofs=" + f); - let n = !0; - - for (let u = 0; u < c; u++) { - let m = e[u].h; - const r = e[u].g; - m -= f; - if (0 > m) f = Math.max(0, e[u].h - 100), n = !1;else try { - md(r, h, "req" + m + "_"); - } catch (G) { - d && d(r); - } - } - - if (n) { - d = h.join("&"); - break a; - } - } - } - - a = a.l.splice(0, c); - b.D = a; - return d; -} - -function Gc(a) { - a.g || a.u || (a.Y = 1, zb(a.Ga, a), a.A = 0); -} - -function Bc(a) { - if (a.g || a.u || 3 <= a.A) return !1; - a.Y++; - a.u = K(q(a.Ga, a), Od(a, a.A)); - a.A++; - return !0; -} - -k.Ga = function () { - this.u = null; - Rd(this); - - if (this.$ && !(this.L || null == this.g || 0 >= this.O)) { - var a = 2 * this.O; - this.h.info("BP detection timer enabled: " + a); - this.B = K(q(this.bb, this), a); - } -}; - -k.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, J(10), Ac(this), Rd(this)); -}; - -function wc(a) { - null != a.B && (l.clearTimeout(a.B), a.B = null); -} - -function Rd(a) { - a.g = new M(a, a.h, "rpc", a.Y); - null === a.o && (a.g.H = a.s); - a.g.O = 0; - var b = N(a.oa); - R(b, "RID", "rpc"); - R(b, "SID", a.J); - R(b, "CI", a.N ? "0" : "1"); - R(b, "AID", a.U); - Kd(a, b); - R(b, "TYPE", "xmlhttp"); - a.o && a.s && Gd(b, a.o, a.s); - a.K && a.g.setTimeout(a.K); - var c = a.g; - a = a.la; - c.K = 1; - c.v = jc(N(b)); - c.s = null; - c.U = !0; - kc(c, a); -} - -k.ab = function () { - null != this.v && (this.v = null, Ac(this), Bc(this), J(19)); -}; - -function zc(a) { - null != a.v && (l.clearTimeout(a.v), a.v = null); -} - -function uc(a, b) { - var c = null; - - if (a.g == b) { - zc(a); - wc(a); - a.g = null; - var d = 2; - } else if (yc(a.i, b)) c = b.D, Fc(a.i, b), d = 1;else return; - - a.I = b.N; - if (0 != a.G) if (b.i) { - if (1 == d) { - c = b.s ? b.s.length : 0; - b = Date.now() - b.F; - var e = a.C; - d = Sb(); - D(d, new Vb(d, c, b, e)); - Hc(a); - } else Gc(a); - } else if (e = b.o, 3 == e || 0 == e && 0 < a.I || !(1 == d && Nd(a, b) || 2 == d && Bc(a))) switch (c && 0 < c.length && (b = a.i, b.i = b.i.concat(c)), e) { - case 1: - Q(a, 5); - break; - - case 4: - Q(a, 10); - break; - - case 3: - Q(a, 6); - break; - - default: - Q(a, 2); - } -} - -function Od(a, b) { - let c = a.Pa + Math.floor(Math.random() * a.$a); - a.j || (c *= 2); - return c * b; -} - -function Q(a, b) { - a.h.info("Error code " + b); - - if (2 == b) { - var c = null; - a.j && (c = null); - var d = q(a.jb, a); - c || (c = new U("//www.google.com/images/cleardot.gif"), l.location && "http" == l.location.protocol || Oc(c, "https"), jc(c)); - nd(c.toString(), d); - } else J(2); - - a.G = 0; - a.j && a.j.va(b); - Ld(a); - Jd(a); -} - -k.jb = function (a) { - a ? (this.h.info("Successfully pinged google.com"), J(2)) : (this.h.info("Failed to ping google.com"), J(1)); -}; - -function Ld(a) { - a.G = 0; - a.I = -1; - - if (a.j) { - if (0 != jd(a.i).length || 0 != a.l.length) a.i.i.length = 0, ra(a.l), a.l.length = 0; - a.j.ua(); - } -} - -function Ec(a, b, c) { - let d = ad(c); - if ("" != d.i) b && Pc(d, b + "." + d.i), Qc(d, d.m);else { - const e = l.location; - d = bd(e.protocol, b ? b + "." + e.hostname : e.hostname, +e.port, c); - } - a.aa && xa(a.aa, function (e, f) { - R(d, f, e); - }); - b = a.D; - c = a.sa; - b && c && R(d, b, c); - R(d, "VER", a.ma); - Kd(a, d); - return d; -} - -function nc(a, b, c) { - if (b && !a.H) throw Error("Can't create secondary domain capable XhrIo object."); - b = c && a.Ba && !a.qa ? new X(new pd({ - ib: !0 - })) : new X(a.qa); - b.L = a.H; - return b; -} - -function Sd() {} - -k = Sd.prototype; - -k.xa = function () {}; - -k.wa = function () {}; - -k.va = function () {}; - -k.ua = function () {}; - -k.Oa = function () {}; - -function Td() { - if (y && !(10 <= Number(Ua))) throw Error("Environmental error: no available transport."); -} - -Td.prototype.g = function (a, b) { - return new Y(a, b); -}; - -function Y(a, b) { - C.call(this); - this.g = new Id(b); - this.l = a; - this.h = b && b.messageUrlParams || null; - a = b && b.messageHeaders || null; - b && b.clientProtocolHeaderRequired && (a ? a["X-Client-Protocol"] = "webchannel" : a = { - "X-Client-Protocol": "webchannel" - }); - this.g.s = a; - a = b && b.initMessageHeaders || null; - b && b.messageContentType && (a ? a["X-WebChannel-Content-Type"] = b.messageContentType : a = { - "X-WebChannel-Content-Type": b.messageContentType - }); - b && b.ya && (a ? a["X-WebChannel-Client-Profile"] = b.ya : a = { - "X-WebChannel-Client-Profile": b.ya - }); - this.g.P = a; - (a = b && b.httpHeadersOverwriteParam) && !sa(a) && (this.g.o = a); - this.A = b && b.supportsCrossDomainXhr || !1; - this.v = b && b.sendRawJson || !1; - (b = b && b.httpSessionIdParam) && !sa(b) && (this.g.D = b, a = this.h, null !== a && b in a && (a = this.h, b in a && delete a[b])); - this.j = new Z(this); -} - -t(Y, C); - -Y.prototype.m = function () { - this.g.j = this.j; - this.A && (this.g.H = !0); - var a = this.g, - b = this.l, - c = this.h || void 0; - a.Wa && (a.h.info("Origin Trials enabled."), zb(q(a.hb, a, b))); - J(0); - a.W = b; - a.aa = c || {}; - a.N = a.X; - a.F = Ec(a, null, a.W); - Hc(a); -}; - -Y.prototype.close = function () { - Ic(this.g); -}; - -Y.prototype.u = function (a) { - if ("string" === typeof a) { - var b = {}; - b.__data__ = a; - Md(this.g, b); - } else this.v ? (b = {}, b.__data__ = rb(a), Md(this.g, b)) : Md(this.g, a); -}; - -Y.prototype.M = function () { - this.g.j = null; - delete this.j; - Ic(this.g); - delete this.g; - Y.Z.M.call(this); -}; - -function Ud(a) { - ac.call(this); - var b = a.__sm__; - - if (b) { - a: { - for (const c in b) { - a = c; - break a; - } - - a = void 0; - } - - if (this.i = a) a = this.i, b = null !== b && a in b ? b[a] : void 0; - this.data = b; - } else this.data = a; -} - -t(Ud, ac); - -function Vd() { - bc.call(this); - this.status = 1; -} - -t(Vd, bc); - -function Z(a) { - this.g = a; -} - -t(Z, Sd); - -Z.prototype.xa = function () { - D(this.g, "a"); -}; - -Z.prototype.wa = function (a) { - D(this.g, new Ud(a)); -}; - -Z.prototype.va = function (a) { - D(this.g, new Vd(a)); -}; - -Z.prototype.ua = function () { - D(this.g, "b"); -}; -/* -Copyright 2017 Google LLC -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at -http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - - -Td.prototype.createWebChannel = Td.prototype.g; -Y.prototype.send = Y.prototype.u; -Y.prototype.open = Y.prototype.m; -Y.prototype.close = Y.prototype.close; -Wb.NO_ERROR = 0; -Wb.TIMEOUT = 8; -Wb.HTTP_ERROR = 6; -Xb.COMPLETE = "complete"; -$b.EventType = L; -L.OPEN = "a"; -L.CLOSE = "b"; -L.ERROR = "c"; -L.MESSAGE = "d"; -C.prototype.listen = C.prototype.N; -X.prototype.listenOnce = X.prototype.O; -X.prototype.getLastError = X.prototype.La; -X.prototype.getLastErrorCode = X.prototype.Da; -X.prototype.getStatus = X.prototype.ba; -X.prototype.getResponseJson = X.prototype.Qa; -X.prototype.getResponseText = X.prototype.ga; -X.prototype.send = X.prototype.ea; - -var createWebChannelTransport = esm.createWebChannelTransport = function () { - return new Td(); -}; - -var getStatEventTarget = esm.getStatEventTarget = function () { - return Sb(); -}; - -var ErrorCode = esm.ErrorCode = Wb; -var EventType = esm.EventType = Xb; -var Event = esm.Event = H; -var Stat = esm.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 -}; -var FetchXmlHttpFactory = esm.FetchXmlHttpFactory = pd; -var WebChannel = esm.WebChannel = $b; -var XhrIo = esm.XhrIo = X; - - -/***/ }), - -/***/ "./node_modules/@floating-ui/react-dom-interactions/dist/floating-ui.react-dom-interactions.esm.js": -/*!*********************************************************************************************************!*\ - !*** ./node_modules/@floating-ui/react-dom-interactions/dist/floating-ui.react-dom-interactions.esm.js ***! - \*********************************************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "FloatingDelayGroup": () => (/* binding */ FloatingDelayGroup), -/* harmony export */ "FloatingFocusManager": () => (/* binding */ FloatingFocusManager), -/* harmony export */ "FloatingNode": () => (/* binding */ FloatingNode), -/* harmony export */ "FloatingOverlay": () => (/* binding */ FloatingOverlay), -/* harmony export */ "FloatingPortal": () => (/* binding */ FloatingPortal), -/* harmony export */ "FloatingTree": () => (/* binding */ FloatingTree), -/* harmony export */ "arrow": () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_0__.arrow), -/* harmony export */ "autoPlacement": () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_0__.autoPlacement), -/* harmony export */ "autoUpdate": () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_0__.autoUpdate), -/* harmony export */ "computePosition": () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_0__.computePosition), -/* harmony export */ "detectOverflow": () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_0__.detectOverflow), -/* harmony export */ "flip": () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_0__.flip), -/* harmony export */ "getOverflowAncestors": () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_0__.getOverflowAncestors), -/* harmony export */ "hide": () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_0__.hide), -/* harmony export */ "inline": () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_0__.inline), -/* harmony export */ "inner": () => (/* binding */ inner), -/* harmony export */ "limitShift": () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_0__.limitShift), -/* harmony export */ "offset": () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_0__.offset), -/* harmony export */ "safePolygon": () => (/* binding */ safePolygon), -/* harmony export */ "shift": () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_0__.shift), -/* harmony export */ "size": () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_0__.size), -/* harmony export */ "useClick": () => (/* binding */ useClick), -/* harmony export */ "useDelayGroup": () => (/* binding */ useDelayGroup), -/* harmony export */ "useDelayGroupContext": () => (/* binding */ useDelayGroupContext), -/* harmony export */ "useDismiss": () => (/* binding */ useDismiss), -/* harmony export */ "useFloating": () => (/* binding */ useFloating), -/* harmony export */ "useFloatingNodeId": () => (/* binding */ useFloatingNodeId), -/* harmony export */ "useFloatingParentNodeId": () => (/* binding */ useFloatingParentNodeId), -/* harmony export */ "useFloatingPortalNode": () => (/* binding */ useFloatingPortalNode), -/* harmony export */ "useFloatingTree": () => (/* binding */ useFloatingTree), -/* harmony export */ "useFocus": () => (/* binding */ useFocus), -/* harmony export */ "useHover": () => (/* binding */ useHover), -/* harmony export */ "useId": () => (/* binding */ useId), -/* harmony export */ "useInnerOffset": () => (/* binding */ useInnerOffset), -/* harmony export */ "useInteractions": () => (/* binding */ useInteractions), -/* harmony export */ "useListNavigation": () => (/* binding */ useListNavigation), -/* harmony export */ "useRole": () => (/* binding */ useRole), -/* harmony export */ "useTypeahead": () => (/* binding */ useTypeahead) -/* harmony export */ }); -/* harmony import */ var _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @floating-ui/react-dom */ "./node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.js"); -/* harmony import */ var _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @floating-ui/react-dom */ "./node_modules/@floating-ui/core/dist/floating-ui.core.browser.mjs"); -/* harmony import */ var _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @floating-ui/react-dom */ "./node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.mjs"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js"); -/* harmony import */ var aria_hidden__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! aria-hidden */ "./node_modules/aria-hidden/dist/es2015/index.js"); - - - - - - -var index = typeof document !== 'undefined' ? react__WEBPACK_IMPORTED_MODULE_1__.useLayoutEffect : react__WEBPACK_IMPORTED_MODULE_1__.useEffect; - -function createPubSub() { - const map = new Map(); - return { - emit(event, data) { - var _map$get; - - (_map$get = map.get(event)) == null ? void 0 : _map$get.forEach(handler => handler(data)); - }, - - on(event, listener) { - map.set(event, [...(map.get(event) || []), listener]); - }, - - off(event, listener) { - map.set(event, (map.get(event) || []).filter(l => l !== listener)); - } - - }; -} - -let serverHandoffComplete = false; -let count = 0; - -const genId = () => "floating-ui-" + count++; - -function useFloatingId() { - const [id, setId] = react__WEBPACK_IMPORTED_MODULE_1__.useState(() => serverHandoffComplete ? genId() : undefined); - index(() => { - if (id == null) { - setId(genId()); - } // eslint-disable-next-line react-hooks/exhaustive-deps - - }, []); - react__WEBPACK_IMPORTED_MODULE_1__.useEffect(() => { - if (!serverHandoffComplete) { - serverHandoffComplete = true; - } - }, []); - return id; -} // `toString()` prevents bundlers from trying to `import { useId } from 'react'` - - -const useReactId = react__WEBPACK_IMPORTED_MODULE_1__[/*#__PURE__*/'useId'.toString()]; -/** - * Uses React 18's built-in `useId()` when available, or falls back to a - * slightly less performant (requiring a double render) implementation for - * earlier React versions. - * @see https://floating-ui.com/docs/useId - */ - -const useId = useReactId != null ? useReactId : useFloatingId; -const FloatingNodeContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.createContext(null); -const FloatingTreeContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.createContext(null); - -const useFloatingParentNodeId = () => { - var _React$useContext$id, _React$useContext; - - return (_React$useContext$id = (_React$useContext = react__WEBPACK_IMPORTED_MODULE_1__.useContext(FloatingNodeContext)) == null ? void 0 : _React$useContext.id) != null ? _React$useContext$id : null; -}; - -const useFloatingTree = () => react__WEBPACK_IMPORTED_MODULE_1__.useContext(FloatingTreeContext); -/** - * Registers a node into the floating tree, returning its id. - */ - - -const useFloatingNodeId = () => { - const id = useId(); - const tree = useFloatingTree(); - const parentId = useFloatingParentNodeId(); - index(() => { - const node = { - id, - parentId - }; - tree == null ? void 0 : tree.addNode(node); - return () => { - tree == null ? void 0 : tree.removeNode(node); - }; - }, [tree, id, parentId]); - return id; -}; -/** - * Provides parent node context for nested floating elements. - * @see https://floating-ui.com/docs/FloatingTree - */ - - -const FloatingNode = _ref => { - let { - children, - id - } = _ref; - const parentId = useFloatingParentNodeId(); - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.createElement(FloatingNodeContext.Provider, { - value: react__WEBPACK_IMPORTED_MODULE_1__.useMemo(() => ({ - id, - parentId - }), [id, parentId]) - }, children); -}; -/** - * Provides context for nested floating elements when they are not children of - * each other on the DOM (i.e. portalled to a common node, rather than their - * respective parent). - * @see https://floating-ui.com/docs/FloatingTree - */ - - -const FloatingTree = _ref2 => { - let { - children - } = _ref2; - const nodesRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef([]); - const addNode = react__WEBPACK_IMPORTED_MODULE_1__.useCallback(node => { - nodesRef.current = [...nodesRef.current, node]; - }, []); - const removeNode = react__WEBPACK_IMPORTED_MODULE_1__.useCallback(node => { - nodesRef.current = nodesRef.current.filter(n => n !== node); - }, []); - const events = react__WEBPACK_IMPORTED_MODULE_1__.useState(() => createPubSub())[0]; - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.createElement(FloatingTreeContext.Provider, { - value: react__WEBPACK_IMPORTED_MODULE_1__.useMemo(() => ({ - nodesRef, - addNode, - removeNode, - events - }), [nodesRef, addNode, removeNode, events]) - }, children); -}; - -function getDocument(floating) { - var _floating$ownerDocume; - - return (_floating$ownerDocume = floating == null ? void 0 : floating.ownerDocument) != null ? _floating$ownerDocume : document; -} - -function getWindow(value) { - var _getDocument$defaultV; - - return (_getDocument$defaultV = getDocument(value).defaultView) != null ? _getDocument$defaultV : window; -} - -function isElement(value) { - return value ? value instanceof getWindow(value).Element : false; -} - -function isHTMLElement(value) { - return value ? value instanceof getWindow(value).HTMLElement : false; -} // `toString()` prevents bundlers from trying to `import { useInsertionEffect } from 'react'` - - -const useInsertionEffect = react__WEBPACK_IMPORTED_MODULE_1__[/*#__PURE__*/'useInsertionEffect'.toString()]; - -function useEvent(callback) { - const ref = react__WEBPACK_IMPORTED_MODULE_1__.useRef(() => { - if (true) { - throw new Error('Cannot call an event handler while rendering.'); - } - }); - - if (useInsertionEffect) { - // eslint-disable-next-line react-hooks/rules-of-hooks - useInsertionEffect(() => { - ref.current = callback; - }); - } else { - ref.current = callback; - } - - return react__WEBPACK_IMPORTED_MODULE_1__.useCallback(function () { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - return ref.current == null ? void 0 : ref.current(...args); - }, []); -} - -function useFloating(_temp) { - let { - open = false, - onOpenChange: unstable_onOpenChange, - whileElementsMounted, - placement, - middleware, - strategy, - nodeId - } = _temp === void 0 ? {} : _temp; - const [domReference, setDomReference] = react__WEBPACK_IMPORTED_MODULE_1__.useState(null); - const tree = useFloatingTree(); - const domReferenceRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(null); - const dataRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef({}); - const events = react__WEBPACK_IMPORTED_MODULE_1__.useState(() => createPubSub())[0]; - const position = (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_0__.useFloating)({ - placement, - middleware, - strategy, - whileElementsMounted - }); - const onOpenChange = useEvent(unstable_onOpenChange); - const refs = react__WEBPACK_IMPORTED_MODULE_1__.useMemo(() => ({ ...position.refs, - domReference: domReferenceRef - }), [position.refs]); - const context = react__WEBPACK_IMPORTED_MODULE_1__.useMemo(() => ({ ...position, - refs, - dataRef, - nodeId, - events, - open, - onOpenChange, - _: { - domReference - } - }), [position, nodeId, events, open, onOpenChange, refs, domReference]); - index(() => { - const node = tree == null ? void 0 : tree.nodesRef.current.find(node => node.id === nodeId); - - if (node) { - node.context = context; - } - }); - const { - reference - } = position; - const setReference = react__WEBPACK_IMPORTED_MODULE_1__.useCallback(node => { - if (isElement(node) || node === null) { - context.refs.domReference.current = node; - setDomReference(node); - } - - reference(node); - }, [reference, context.refs]); - return react__WEBPACK_IMPORTED_MODULE_1__.useMemo(() => ({ ...position, - context, - refs, - reference: setReference - }), [position, refs, context, setReference]); -} - -function mergeProps(userProps, propsList, elementKey) { - const map = new Map(); - return { ...(elementKey === 'floating' && { - tabIndex: -1 - }), - ...userProps, - ...propsList.map(value => value ? value[elementKey] : null).concat(userProps).reduce((acc, props) => { - if (!props) { - return acc; - } - - Object.entries(props).forEach(_ref => { - let [key, value] = _ref; - - if (key.indexOf('on') === 0) { - if (!map.has(key)) { - map.set(key, []); - } - - if (typeof value === 'function') { - var _map$get; - - (_map$get = map.get(key)) == null ? void 0 : _map$get.push(value); - - acc[key] = function () { - var _map$get2; - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - (_map$get2 = map.get(key)) == null ? void 0 : _map$get2.forEach(fn => fn(...args)); - }; - } - } else { - acc[key] = value; - } - }); - return acc; - }, {}) - }; -} - -const useInteractions = function (propsList) { - if (propsList === void 0) { - propsList = []; - } - - return { - getReferenceProps: userProps => mergeProps(userProps, propsList, 'reference'), - getFloatingProps: userProps => mergeProps(userProps, propsList, 'floating'), - getItemProps: userProps => mergeProps(userProps, propsList, 'item') - }; -}; - -function getChildren(nodes, id) { - var _nodes$filter; - - let allChildren = (_nodes$filter = nodes.filter(node => { - var _node$context; - - return node.parentId === id && ((_node$context = node.context) == null ? void 0 : _node$context.open); - })) != null ? _nodes$filter : []; - let currentChildren = allChildren; - - while (currentChildren.length) { - var _nodes$filter2; - - currentChildren = (_nodes$filter2 = nodes.filter(node => { - var _currentChildren; - - return (_currentChildren = currentChildren) == null ? void 0 : _currentChildren.some(n => { - var _node$context2; - - return node.parentId === n.id && ((_node$context2 = node.context) == null ? void 0 : _node$context2.open); - }); - })) != null ? _nodes$filter2 : []; - allChildren = allChildren.concat(currentChildren); - } - - return allChildren; -} - -function isPointInPolygon(point, polygon) { - const [x, y] = point; - let isInside = false; - const length = polygon.length; - - for (let i = 0, j = length - 1; i < length; j = i++) { - const [xi, yi] = polygon[i] || [0, 0]; - const [xj, yj] = polygon[j] || [0, 0]; - const intersect = yi >= y !== yj >= y && x <= (xj - xi) * (y - yi) / (yj - yi) + xi; - - if (intersect) { - isInside = !isInside; - } - } - - return isInside; -} - -function safePolygon(_temp) { - let { - restMs = 0, - buffer = 0.5, - blockPointerEvents = true, - debug = null - } = _temp === void 0 ? {} : _temp; - let timeoutId; - let polygonIsDestroyed = false; - - const fn = _ref => { - let { - x, - y, - placement, - refs, - onClose, - nodeId, - tree, - leave = false - } = _ref; - return function onPointerMove(event) { - var _refs$domReference$cu, _refs$floating$curren; - - clearTimeout(timeoutId); - - function close() { - clearTimeout(timeoutId); - onClose(); - } - - if (event.pointerType && event.pointerType !== 'mouse') { - return; - } - - const { - clientX, - clientY - } = event; - const target = 'composedPath' in event ? event.composedPath()[0] : event.target; - const targetNode = target; // If the pointer is over the reference or floating element already, there - // is no need to run the logic. - - if (event.type === 'pointermove' && (_refs$domReference$cu = refs.domReference.current) != null && _refs$domReference$cu.contains(targetNode)) { - return; - } // If any nested child is open, abort. - - - if (tree && getChildren(tree.nodesRef.current, nodeId).some(_ref2 => { - let { - context - } = _ref2; - return context == null ? void 0 : context.open; - })) { - return; - } // The cursor landed, so we destroy the polygon logic - - - if ((_refs$floating$curren = refs.floating.current) != null && _refs$floating$curren.contains(targetNode) && !leave) { - polygonIsDestroyed = true; - return; - } - - if (!refs.domReference.current || !refs.floating.current || placement == null || x == null || y == null) { - return; - } - - const refRect = refs.domReference.current.getBoundingClientRect(); - const rect = refs.floating.current.getBoundingClientRect(); - const side = placement.split('-')[0]; - const cursorLeaveFromRight = x > rect.right - rect.width / 2; - const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2; // If the pointer is leaving from the opposite side, the "buffer" logic - // creates a point where the floating element remains open, but should be - // ignored. - // A constant of 1 handles floating point rounding errors. - - if (side === 'top' && y >= refRect.bottom - 1 || side === 'bottom' && y <= refRect.top + 1 || side === 'left' && x >= refRect.right - 1 || side === 'right' && x <= refRect.left + 1) { - return close(); - } // Ignore when the cursor is within the rectangular trough between the - // two elements. Since the triangle is created from the cursor point, - // which can start beyond the ref element's edge, traversing back and - // forth from the ref to the floating element can cause it to close. This - // ensures it always remains open in that case. - - - switch (side) { - case 'top': - if (clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= refRect.top + 1) { - return; - } - - break; - - case 'bottom': - if (clientX >= rect.left && clientX <= rect.right && clientY >= refRect.bottom - 1 && clientY <= rect.bottom) { - return; - } - - break; - - case 'left': - if (clientX >= rect.left && clientX <= refRect.left + 1 && clientY >= rect.top && clientY <= rect.bottom) { - return; - } - - break; - - case 'right': - if (clientX >= refRect.right - 1 && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom) { - return; - } - - break; - } - - if (polygonIsDestroyed) { - return close(); - } - - function getPolygon(_ref3) { - let [x, y] = _ref3; - const isFloatingWider = rect.width > refRect.width; - const isFloatingTaller = rect.height > refRect.height; - - switch (side) { - case 'top': - { - const cursorPointOne = [isFloatingWider ? x + buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y + buffer + 1]; - const cursorPointTwo = [isFloatingWider ? x - buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y + buffer + 1]; - const commonPoints = [[rect.left, cursorLeaveFromRight ? rect.bottom - buffer : isFloatingWider ? rect.bottom - buffer : rect.top], [rect.right, cursorLeaveFromRight ? isFloatingWider ? rect.bottom - buffer : rect.top : rect.bottom - buffer]]; - return [cursorPointOne, cursorPointTwo, ...commonPoints]; - } - - case 'bottom': - { - const cursorPointOne = [isFloatingWider ? x + buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y - buffer]; - const cursorPointTwo = [isFloatingWider ? x - buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y - buffer]; - const commonPoints = [[rect.left, cursorLeaveFromRight ? rect.top + buffer : isFloatingWider ? rect.top + buffer : rect.bottom], [rect.right, cursorLeaveFromRight ? isFloatingWider ? rect.top + buffer : rect.bottom : rect.top + buffer]]; - return [cursorPointOne, cursorPointTwo, ...commonPoints]; - } - - case 'left': - { - const cursorPointOne = [x + buffer + 1, isFloatingTaller ? y + buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4]; - const cursorPointTwo = [x + buffer + 1, isFloatingTaller ? y - buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4]; - const commonPoints = [[cursorLeaveFromBottom ? rect.right - buffer : isFloatingTaller ? rect.right - buffer : rect.left, rect.top], [cursorLeaveFromBottom ? isFloatingTaller ? rect.right - buffer : rect.left : rect.right - buffer, rect.bottom]]; - return [...commonPoints, cursorPointOne, cursorPointTwo]; - } - - case 'right': - { - const cursorPointOne = [x - buffer, isFloatingTaller ? y + buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4]; - const cursorPointTwo = [x - buffer, isFloatingTaller ? y - buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4]; - const commonPoints = [[cursorLeaveFromBottom ? rect.left + buffer : isFloatingTaller ? rect.left + buffer : rect.right, rect.top], [cursorLeaveFromBottom ? isFloatingTaller ? rect.left + buffer : rect.right : rect.left + buffer, rect.bottom]]; - return [cursorPointOne, cursorPointTwo, ...commonPoints]; - } - } - } - - const poly = getPolygon([x, y]); - - if (true) { - debug == null ? void 0 : debug(poly.slice(0, 4).join(', ')); - } - - if (!isPointInPolygon([clientX, clientY], poly)) { - close(); - } else if (restMs) { - timeoutId = setTimeout(onClose, restMs); - } - }; - }; - - fn.__options = { - blockPointerEvents - }; - return fn; -} - -const DEFAULT_ID = 'floating-ui-root'; - -const useFloatingPortalNode = function (_temp) { - let { - id = DEFAULT_ID, - enabled = true - } = _temp === void 0 ? {} : _temp; - const [portalEl, setPortalEl] = react__WEBPACK_IMPORTED_MODULE_1__.useState(null); - index(() => { - if (!enabled) { - return; - } - - const rootNode = document.getElementById(id); - - if (rootNode) { - setPortalEl(rootNode); - } else { - const newPortalEl = document.createElement('div'); - newPortalEl.id = id; - setPortalEl(newPortalEl); - - if (!document.body.contains(newPortalEl)) { - document.body.appendChild(newPortalEl); - } - } - }, [id, enabled]); - return portalEl; -}; -/** - * Portals your floating element outside of the main app node. - * @see https://floating-ui.com/docs/FloatingPortal - */ - - -const FloatingPortal = _ref => { - let { - children, - id = DEFAULT_ID, - root = null - } = _ref; - const portalNode = useFloatingPortalNode({ - id, - enabled: !root - }); - - if (root) { - return /*#__PURE__*/(0,react_dom__WEBPACK_IMPORTED_MODULE_2__.createPortal)(children, root); - } - - if (portalNode) { - return /*#__PURE__*/(0,react_dom__WEBPACK_IMPORTED_MODULE_2__.createPortal)(children, portalNode); - } - - return null; -}; - -function _extends() { - _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - - return target; - }; - - return _extends.apply(this, arguments); -} // Avoid Chrome DevTools blue warning - - -function getPlatform() { - const uaData = navigator.userAgentData; - - if (uaData != null && uaData.platform) { - return uaData.platform; - } - - return navigator.platform; -} - -function getUserAgent() { - const uaData = navigator.userAgentData; - - if (uaData != null && uaData.brands) { - return uaData.brands.map(_ref => { - let { - brand, - version - } = _ref; - return brand + "/" + version; - }).join(' '); - } - - return navigator.userAgent; -} - -const identifier = 'data-floating-ui-scroll-lock'; -/** - * Provides base styling for a fixed overlay element to dim content or block - * pointer events behind a floating element. - * It's a regular `

`, so it can be styled via any CSS solution you prefer. - * @see https://floating-ui.com/docs/FloatingOverlay - */ - -const FloatingOverlay = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.forwardRef(function FloatingOverlay(_ref, ref) { - let { - lockScroll = false, - ...rest - } = _ref; - index(() => { - var _window$visualViewpor, _window$visualViewpor2, _window$visualViewpor3, _window$visualViewpor4; - - if (!lockScroll) { - return; - } - - const alreadyLocked = document.body.hasAttribute(identifier); - - if (alreadyLocked) { - return; - } - - document.body.setAttribute(identifier, ''); // RTL scrollbar - - const scrollbarX = Math.round(document.documentElement.getBoundingClientRect().left) + document.documentElement.scrollLeft; - const paddingProp = scrollbarX ? 'paddingLeft' : 'paddingRight'; - const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth; // Only iOS doesn't respect `overflow: hidden` on document.body, and this - // technique has fewer side effects. - - if (!/iP(hone|ad|od)|iOS/.test(getPlatform())) { - Object.assign(document.body.style, { - overflow: 'hidden', - [paddingProp]: scrollbarWidth + "px" - }); - return () => { - document.body.removeAttribute(identifier); - Object.assign(document.body.style, { - overflow: '', - [paddingProp]: '' - }); - }; - } // iOS 12 does not support `visuaViewport`. - - - const offsetLeft = (_window$visualViewpor = (_window$visualViewpor2 = window.visualViewport) == null ? void 0 : _window$visualViewpor2.offsetLeft) != null ? _window$visualViewpor : 0; - const offsetTop = (_window$visualViewpor3 = (_window$visualViewpor4 = window.visualViewport) == null ? void 0 : _window$visualViewpor4.offsetTop) != null ? _window$visualViewpor3 : 0; - const scrollX = window.pageXOffset; - const scrollY = window.pageYOffset; - Object.assign(document.body.style, { - position: 'fixed', - overflow: 'hidden', - top: -(scrollY - Math.floor(offsetTop)) + "px", - left: -(scrollX - Math.floor(offsetLeft)) + "px", - right: '0', - [paddingProp]: scrollbarWidth + "px" - }); - return () => { - Object.assign(document.body.style, { - position: '', - overflow: '', - top: '', - left: '', - right: '', - [paddingProp]: '' - }); - document.body.removeAttribute(identifier); - window.scrollTo(scrollX, scrollY); - }; - }, [lockScroll]); - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.createElement("div", _extends({ - ref: ref - }, rest, { - style: { - position: 'fixed', - overflow: 'auto', - top: 0, - right: 0, - bottom: 0, - left: 0, - ...rest.style - } - })); -}); -/** - * Find the real active element. Traverses into shadowRoots. - */ - -function activeElement(doc) { - let activeElement = doc.activeElement; - - while (((_activeElement = activeElement) == null ? void 0 : (_activeElement$shadow = _activeElement.shadowRoot) == null ? void 0 : _activeElement$shadow.activeElement) != null) { - var _activeElement, _activeElement$shadow; - - activeElement = activeElement.shadowRoot.activeElement; - } - - return activeElement; -} - -function getAncestors(nodes, id) { - var _nodes$find; - - let allAncestors = []; - let currentParentId = (_nodes$find = nodes.find(node => node.id === id)) == null ? void 0 : _nodes$find.parentId; - - while (currentParentId) { - const currentNode = nodes.find(node => node.id === currentParentId); - currentParentId = currentNode == null ? void 0 : currentNode.parentId; - - if (currentNode) { - allAncestors = allAncestors.concat(currentNode); - } - } - - return allAncestors; -} - -function getTarget(event) { - if ('composedPath' in event) { - return event.composedPath()[0]; - } // TS thinks `event` is of type never as it assumes all browsers support - // `composedPath()`, but browsers without shadow DOM don't. - - - return event.target; -} - -const TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled])," + "[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; - -function isTypeableElement(element) { - return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR); -} - -function stopEvent(event) { - event.preventDefault(); - event.stopPropagation(); -} - -function useLatestRef(value) { - const ref = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(value); - index(() => { - ref.current = value; - }); - return ref; -} - -function focus(el, preventScroll) { - if (preventScroll === void 0) { - preventScroll = false; - } // `pointerDown` clicks occur before `focus`, so the button will steal the - // focus unless we wait a frame. - - - requestAnimationFrame(() => { - el == null ? void 0 : el.focus({ - preventScroll - }); - }); -} - -const SELECTOR = 'select:not([disabled]),a[href],button:not([disabled]),[tabindex],' + 'iframe,object,embed,area[href],audio[controls],video[controls],' + TYPEABLE_SELECTOR; -const FocusGuard = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.forwardRef(function FocusGuard(props, ref) { - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.createElement("span", _extends({}, props, { - ref: ref, - tabIndex: 0, - style: { - position: 'fixed', - opacity: '0', - pointerEvents: 'none', - outline: '0' - } - })); -}); -/** - * Provides focus management for the floating element. - * @see https://floating-ui.com/docs/FloatingFocusManager - */ - -function FloatingFocusManager(_ref) { - var _tree$nodesRef$curren; - - let { - context: { - refs, - nodeId, - onOpenChange, - dataRef, - events - }, - children, - order = ['content'], - endGuard = true, - preventTabbing = false, - initialFocus = 0, - returnFocus = true, - modal = true - } = _ref; - const orderRef = useLatestRef(order); - const tree = useFloatingTree(); - const root = (tree == null ? void 0 : (_tree$nodesRef$curren = tree.nodesRef.current.find(node => node.id === nodeId)) == null ? void 0 : _tree$nodesRef$curren.parentId) == null; - const getTabbableElements = react__WEBPACK_IMPORTED_MODULE_1__.useCallback(() => { - return orderRef.current.map(type => { - if (type === 'reference') { - return refs.domReference.current; - } - - if (refs.floating.current && type === 'floating') { - return refs.floating.current; - } - - if (type === 'content') { - var _refs$floating$curren, _refs$floating$curren2; - - return Array.from((_refs$floating$curren = (_refs$floating$curren2 = refs.floating.current) == null ? void 0 : _refs$floating$curren2.querySelectorAll(SELECTOR)) != null ? _refs$floating$curren : []); - } - - return null; - }).flat().filter(el => { - if (el === refs.floating.current || el === refs.domReference.current) { - return true; - } - - if (isHTMLElement(el)) { - var _el$getAttribute; - - const tabIndex = (_el$getAttribute = el.getAttribute('tabindex')) != null ? _el$getAttribute : '0'; - return tabIndex[0].trim() !== '-'; - } - }); - }, [orderRef, refs]); - react__WEBPACK_IMPORTED_MODULE_1__.useEffect(() => { - if (!modal) { - return; - } // If the floating element has no focusable elements inside it, fallback - // to focusing the floating element and preventing tab navigation - - - const noTabbableContentElements = getTabbableElements().filter(el => el !== refs.floating.current && el !== refs.domReference.current).length === 0; - - function onKeyDown(event) { - if (event.key === 'Tab') { - if (preventTabbing || noTabbableContentElements) { - stopEvent(event); - } - - const els = getTabbableElements(); - const target = getTarget(event); - - if (orderRef.current[0] === 'reference' && target === refs.domReference.current) { - stopEvent(event); - - if (event.shiftKey) { - focus(els[els.length - 1]); - } else { - focus(els[1]); - } - } - - if (orderRef.current[1] === 'floating' && target === refs.floating.current && event.shiftKey) { - stopEvent(event); - focus(els[0]); - } - } - } - - const doc = getDocument(refs.floating.current); - doc.addEventListener('keydown', onKeyDown); - return () => { - doc.removeEventListener('keydown', onKeyDown); - }; - }, [preventTabbing, modal, getTabbableElements, orderRef, refs]); - react__WEBPACK_IMPORTED_MODULE_1__.useEffect(() => { - let isPointerDown = false; - - function onFocusOut(event) { - var _refs$floating$curren3, _getAncestors; - - const relatedTarget = event.relatedTarget; - const focusMovedOutsideFloating = !((_refs$floating$curren3 = refs.floating.current) != null && _refs$floating$curren3.contains(relatedTarget)); - const focusMovedOutsideReference = isElement(refs.domReference.current) && !refs.domReference.current.contains(relatedTarget); - const isChildOpen = tree && getChildren(tree.nodesRef.current, nodeId).length > 0; - const isParentRelated = tree && event.currentTarget === refs.domReference.current && ((_getAncestors = getAncestors(tree.nodesRef.current, nodeId)) == null ? void 0 : _getAncestors.some(node => { - var _node$context, _node$context$refs$fl; - - return (_node$context = node.context) == null ? void 0 : (_node$context$refs$fl = _node$context.refs.floating.current) == null ? void 0 : _node$context$refs$fl.contains(relatedTarget); - })); - - if (focusMovedOutsideFloating && focusMovedOutsideReference && !isChildOpen && !isParentRelated && !isPointerDown) { - onOpenChange(false); - } - } - - function onPointerDown() { - // In Safari, buttons *lose* focus when pressing them. This causes the - // reference `focusout` to fire, which closes the floating element. - isPointerDown = true; - setTimeout(() => { - isPointerDown = false; - }); - } - - const floating = refs.floating.current; - const reference = refs.domReference.current; - - if (floating && isHTMLElement(reference)) { - if (!modal) { - floating.addEventListener('focusout', onFocusOut); - reference.addEventListener('focusout', onFocusOut); - reference.addEventListener('pointerdown', onPointerDown); - } - - let cleanup; - - if (modal) { - if (orderRef.current.includes('reference')) { - cleanup = (0,aria_hidden__WEBPACK_IMPORTED_MODULE_3__.hideOthers)([reference, floating]); - } else { - cleanup = (0,aria_hidden__WEBPACK_IMPORTED_MODULE_3__.hideOthers)(floating); - } - } - - return () => { - if (!modal) { - floating.removeEventListener('focusout', onFocusOut); - reference.removeEventListener('focusout', onFocusOut); - reference.removeEventListener('pointerdown', onPointerDown); - } - - cleanup == null ? void 0 : cleanup(); - }; - } - }, [nodeId, tree, modal, onOpenChange, orderRef, dataRef, getTabbableElements, refs]); - react__WEBPACK_IMPORTED_MODULE_1__.useEffect(() => { - // Retain `returnFocus` behavior for root nodes - if (preventTabbing && !root) { - return; - } - - const floating = refs.floating.current; - const doc = getDocument(floating); - let returnFocusValue = returnFocus; - let preventReturnFocusScroll = false; - let previouslyFocusedElement = activeElement(doc); - - if (previouslyFocusedElement === doc.body && refs.domReference.current) { - previouslyFocusedElement = refs.domReference.current; - } - - if (!preventTabbing) { - if (typeof initialFocus === 'number') { - var _getTabbableElements$; - - const el = (_getTabbableElements$ = getTabbableElements()[initialFocus]) != null ? _getTabbableElements$ : floating; - focus(el, el === floating); - } else if (isHTMLElement(initialFocus.current)) { - var _initialFocus$current; - - const el = (_initialFocus$current = initialFocus.current) != null ? _initialFocus$current : floating; - focus(el, el === floating); - } - } // Dismissing via outside `pointerdown` should always ignore `returnFocus` - // to prevent unwanted scrolling. - - - function onDismiss(allowReturnFocus) { - if (allowReturnFocus === void 0) { - allowReturnFocus = false; - } - - if (typeof allowReturnFocus === 'object') { - returnFocusValue = true; - preventReturnFocusScroll = allowReturnFocus.preventScroll; - } else { - returnFocusValue = allowReturnFocus; - } - } - - events.on('dismiss', onDismiss); - return () => { - events.off('dismiss', onDismiss); - - if (returnFocusValue && isHTMLElement(previouslyFocusedElement)) { - focus(previouslyFocusedElement, preventReturnFocusScroll); - } - }; - }, [preventTabbing, getTabbableElements, initialFocus, returnFocus, refs, events, root]); - - const isTypeableCombobox = () => { - var _refs$domReference$cu; - - return ((_refs$domReference$cu = refs.domReference.current) == null ? void 0 : _refs$domReference$cu.getAttribute('role')) === 'combobox' && isTypeableElement(refs.domReference.current); - }; - - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.createElement(react__WEBPACK_IMPORTED_MODULE_1__.Fragment, null, modal && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.createElement(FocusGuard, { - onFocus: event => { - if (isTypeableCombobox()) { - return; - } - - stopEvent(event); - const els = getTabbableElements(); - - if (order[0] === 'reference') { - focus(els[0]); - } else { - focus(els[els.length - 1]); - } - } - }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.cloneElement(children, order.includes('floating') ? { - tabIndex: 0 - } : {}), modal && endGuard && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.createElement(FocusGuard, { - onFocus: event => { - if (isTypeableCombobox()) { - return; - } - - stopEvent(event); - focus(getTabbableElements()[0]); - } - })); -} - -function usePrevious(value) { - const ref = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(); - index(() => { - ref.current = value; - }, [value]); - return ref.current; -} - -function getDelay(value, prop, pointerType) { - if (pointerType && pointerType !== 'mouse') { - return 0; - } - - if (typeof value === 'number') { - return value; - } - - return value == null ? void 0 : value[prop]; -} -/** - * Adds hover event listeners that change the open state, like CSS :hover. - * @see https://floating-ui.com/docs/useHover - */ - - -const useHover = function (context, _temp) { - let { - enabled = true, - delay = 0, - handleClose = null, - mouseOnly = false, - restMs = 0, - move = true - } = _temp === void 0 ? {} : _temp; - const { - open, - onOpenChange, - dataRef, - events, - refs, - _ - } = context; - const tree = useFloatingTree(); - const parentId = useFloatingParentNodeId(); - const handleCloseRef = useLatestRef(handleClose); - const delayRef = useLatestRef(delay); - const previousOpen = usePrevious(open); - const pointerTypeRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(); - const timeoutRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(); - const handlerRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(); - const restTimeoutRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(); - const blockMouseMoveRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(true); - const performedPointerEventsMutationRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(false); - const isHoverOpen = react__WEBPACK_IMPORTED_MODULE_1__.useCallback(() => { - var _dataRef$current$open; - - const type = (_dataRef$current$open = dataRef.current.openEvent) == null ? void 0 : _dataRef$current$open.type; - return (type == null ? void 0 : type.includes('mouse')) && type !== 'mousedown'; - }, [dataRef]); - react__WEBPACK_IMPORTED_MODULE_1__.useEffect(() => { - if (!enabled) { - return; - } - - function onDismiss() { - clearTimeout(timeoutRef.current); - clearTimeout(restTimeoutRef.current); - blockMouseMoveRef.current = true; - } - - events.on('dismiss', onDismiss); - return () => { - events.off('dismiss', onDismiss); - }; - }, [enabled, events, refs]); - react__WEBPACK_IMPORTED_MODULE_1__.useEffect(() => { - if (!enabled || !handleCloseRef.current) { - return; - } - - function onLeave() { - if (isHoverOpen()) { - onOpenChange(false); - } - } - - const html = getDocument(refs.floating.current).documentElement; - html.addEventListener('mouseleave', onLeave); - return () => { - html.removeEventListener('mouseleave', onLeave); - }; - }, [refs, onOpenChange, enabled, handleCloseRef, dataRef, isHoverOpen]); - const closeWithDelay = react__WEBPACK_IMPORTED_MODULE_1__.useCallback(function (runElseBranch) { - if (runElseBranch === void 0) { - runElseBranch = true; - } - - const closeDelay = getDelay(delayRef.current, 'close', pointerTypeRef.current); - - if (closeDelay && !handlerRef.current) { - clearTimeout(timeoutRef.current); - timeoutRef.current = setTimeout(() => onOpenChange(false), closeDelay); - } else if (runElseBranch) { - clearTimeout(timeoutRef.current); - onOpenChange(false); - } - }, [delayRef, onOpenChange]); - const cleanupPointerMoveHandler = react__WEBPACK_IMPORTED_MODULE_1__.useCallback(() => { - if (handlerRef.current) { - getDocument(refs.floating.current).removeEventListener('pointermove', handlerRef.current); - handlerRef.current = undefined; - } - }, [refs]); - const clearPointerEvents = react__WEBPACK_IMPORTED_MODULE_1__.useCallback(() => { - getDocument(refs.floating.current).body.style.pointerEvents = ''; - performedPointerEventsMutationRef.current = false; - }, [refs]); // Registering the mouse events on the reference directly to bypass React's - // delegation system. If the cursor was on a disabled element and then entered - // the reference (no gap), `mouseenter` doesn't fire in the delegation system. - - react__WEBPACK_IMPORTED_MODULE_1__.useEffect(() => { - if (!enabled) { - return; - } - - function isClickLikeOpenEvent() { - return dataRef.current.openEvent ? ['click', 'mousedown'].includes(dataRef.current.openEvent.type) : false; - } - - function onMouseEnter(event) { - clearTimeout(timeoutRef.current); - blockMouseMoveRef.current = false; - - if (mouseOnly && pointerTypeRef.current !== 'mouse' || restMs > 0 && getDelay(delayRef.current, 'open') === 0) { - return; - } - - dataRef.current.openEvent = event; - const openDelay = getDelay(delayRef.current, 'open', pointerTypeRef.current); - - if (openDelay) { - timeoutRef.current = setTimeout(() => { - onOpenChange(true); - }, openDelay); - } else { - onOpenChange(true); - } - } - - function onMouseLeave(event) { - if (isClickLikeOpenEvent()) { - return; - } - - const doc = getDocument(refs.floating.current); - clearTimeout(restTimeoutRef.current); - - if (handleCloseRef.current) { - clearTimeout(timeoutRef.current); - handlerRef.current && doc.removeEventListener('pointermove', handlerRef.current); - handlerRef.current = handleCloseRef.current({ ...context, - tree, - x: event.clientX, - y: event.clientY, - - onClose() { - clearPointerEvents(); - cleanupPointerMoveHandler(); - closeWithDelay(); - } - - }); - doc.addEventListener('pointermove', handlerRef.current); - return; - } - - closeWithDelay(); - } // Ensure the floating element closes after scrolling even if the pointer - // did not move. - // https://github.com/floating-ui/floating-ui/discussions/1692 - - - function onScrollMouseLeave(event) { - if (isClickLikeOpenEvent()) { - return; - } - - handleCloseRef.current == null ? void 0 : handleCloseRef.current({ ...context, - tree, - x: event.clientX, - y: event.clientY, - leave: true, - - onClose() { - clearPointerEvents(); - cleanupPointerMoveHandler(); - closeWithDelay(); - } - - })(event); - } - - const floating = refs.floating.current; - const reference = refs.domReference.current; - - if (isElement(reference)) { - open && reference.addEventListener('mouseleave', onScrollMouseLeave); - floating == null ? void 0 : floating.addEventListener('mouseleave', onScrollMouseLeave); - move && reference.addEventListener('mousemove', onMouseEnter, { - once: true - }); - reference.addEventListener('mouseenter', onMouseEnter); - reference.addEventListener('mouseleave', onMouseLeave); - return () => { - open && reference.removeEventListener('mouseleave', onScrollMouseLeave); - floating == null ? void 0 : floating.removeEventListener('mouseleave', onScrollMouseLeave); - move && reference.removeEventListener('mousemove', onMouseEnter); - reference.removeEventListener('mouseenter', onMouseEnter); - reference.removeEventListener('mouseleave', onMouseLeave); - }; - } - }, [// Ensure the effect is re-run when the reference changes. - // https://github.com/floating-ui/floating-ui/issues/1833 - _.domReference, enabled, context, mouseOnly, restMs, move, closeWithDelay, cleanupPointerMoveHandler, clearPointerEvents, onOpenChange, open, tree, refs, delayRef, handleCloseRef, dataRef]); // Block pointer-events of every element other than the reference and floating - // while the floating element is open and has a `handleClose` handler. Also - // handles nested floating elements. - // https://github.com/floating-ui/floating-ui/issues/1722 - - index(() => { - if (!enabled) { - return; - } - - if (open && handleCloseRef.current && handleCloseRef.current.__options.blockPointerEvents && isHoverOpen()) { - getDocument(refs.floating.current).body.style.pointerEvents = 'none'; - performedPointerEventsMutationRef.current = true; - const reference = refs.domReference.current; - const floating = refs.floating.current; - - if (isElement(reference) && floating) { - var _tree$nodesRef$curren, _tree$nodesRef$curren2; - - const parentFloating = tree == null ? void 0 : (_tree$nodesRef$curren = tree.nodesRef.current.find(node => node.id === parentId)) == null ? void 0 : (_tree$nodesRef$curren2 = _tree$nodesRef$curren.context) == null ? void 0 : _tree$nodesRef$curren2.refs.floating.current; - - if (parentFloating) { - parentFloating.style.pointerEvents = ''; - } - - reference.style.pointerEvents = 'auto'; - floating.style.pointerEvents = 'auto'; - return () => { - reference.style.pointerEvents = ''; - floating.style.pointerEvents = ''; - }; - } - } - }, [enabled, open, parentId, refs, tree, handleCloseRef, dataRef, isHoverOpen]); - index(() => { - if (previousOpen && !open) { - pointerTypeRef.current = undefined; - cleanupPointerMoveHandler(); - clearPointerEvents(); - } - }); - react__WEBPACK_IMPORTED_MODULE_1__.useEffect(() => { - return () => { - cleanupPointerMoveHandler(); - clearTimeout(timeoutRef.current); - clearTimeout(restTimeoutRef.current); - - if (performedPointerEventsMutationRef.current) { - clearPointerEvents(); - } - }; - }, [enabled, cleanupPointerMoveHandler, clearPointerEvents]); - - if (!enabled) { - return {}; - } - - function setPointerRef(event) { - pointerTypeRef.current = event.pointerType; - } - - return { - reference: { - onPointerDown: setPointerRef, - onPointerEnter: setPointerRef, - - onMouseMove() { - if (open || restMs === 0) { - return; - } - - clearTimeout(restTimeoutRef.current); - restTimeoutRef.current = setTimeout(() => { - if (!blockMouseMoveRef.current) { - onOpenChange(true); - } - }, restMs); - } - - }, - floating: { - onMouseEnter() { - clearTimeout(timeoutRef.current); - }, - - onMouseLeave() { - closeWithDelay(false); - } - - } - }; -}; - -const FloatingDelayGroupContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.createContext({ - delay: 1000, - initialDelay: 1000, - currentId: null, - setCurrentId: () => {}, - setState: () => {} -}); - -const useDelayGroupContext = () => react__WEBPACK_IMPORTED_MODULE_1__.useContext(FloatingDelayGroupContext); -/** - * Provides context for a group of floating elements that should share a - * `delay`. - * @see https://floating-ui.com/docs/FloatingDelayGroup - */ - - -const FloatingDelayGroup = _ref => { - let { - children, - delay - } = _ref; - const [state, setState] = react__WEBPACK_IMPORTED_MODULE_1__.useState({ - delay, - initialDelay: delay, - currentId: null - }); - const setCurrentId = react__WEBPACK_IMPORTED_MODULE_1__.useCallback(currentId => { - setState(state => ({ ...state, - currentId - })); - }, []); - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.createElement(FloatingDelayGroupContext.Provider, { - value: react__WEBPACK_IMPORTED_MODULE_1__.useMemo(() => ({ ...state, - setState, - setCurrentId - }), [state, setState, setCurrentId]) - }, children); -}; - -const useDelayGroup = (_ref2, _ref3) => { - let { - open, - onOpenChange - } = _ref2; - let { - id - } = _ref3; - const { - currentId, - initialDelay, - setState - } = useDelayGroupContext(); - react__WEBPACK_IMPORTED_MODULE_1__.useEffect(() => { - if (currentId) { - setState(state => ({ ...state, - delay: { - open: 1, - close: getDelay(initialDelay, 'close') - } - })); - - if (currentId !== id) { - onOpenChange(false); - } - } - }, [id, onOpenChange, setState, currentId, initialDelay]); - react__WEBPACK_IMPORTED_MODULE_1__.useEffect(() => { - if (!open && currentId === id) { - onOpenChange(false); - setState(state => ({ ...state, - delay: initialDelay, - currentId: null - })); - } - }, [open, setState, currentId, id, onOpenChange, initialDelay]); -}; - -function getArgsWithCustomFloatingHeight(args, prop) { - return { ...args, - rects: { ...args.rects, - floating: { ...args.rects.floating, - height: args.elements.floating[prop] - } - } - }; -} - -const inner = options => ({ - name: 'inner', - options, - - async fn(middlewareArguments) { - const { - listRef, - overflowRef, - onFallbackChange, - offset: innerOffset = 0, - index = 0, - minItemsVisible = 4, - referenceOverflowThreshold = 0, - ...detectOverflowOptions - } = options; - const { - rects, - elements: { - floating - } - } = middlewareArguments; - const item = listRef.current[index]; - - if (true) { - if (!middlewareArguments.placement.startsWith('bottom')) { - console.warn(['Floating UI: `placement` side must be "bottom" when using the', '`inner` middleware.'].join(' ')); - } - } - - if (!item) { - return {}; - } - - const nextArgs = { ...middlewareArguments, - ...(await (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.offset)(-item.offsetTop - rects.reference.height / 2 - item.offsetHeight / 2 - innerOffset).fn(middlewareArguments)) - }; - const overflow = await (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.detectOverflow)(getArgsWithCustomFloatingHeight(nextArgs, 'scrollHeight'), detectOverflowOptions); - const refOverflow = await (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.detectOverflow)(nextArgs, { ...detectOverflowOptions, - elementContext: 'reference' - }); - const diffY = Math.max(0, overflow.top); - const nextY = nextArgs.y + diffY; - const maxHeight = Math.max(0, floating.scrollHeight - diffY - Math.max(0, overflow.bottom)); - floating.style.maxHeight = maxHeight + "px"; - floating.scrollTop = diffY; // There is not enough space, fallback to standard anchored positioning - - if (onFallbackChange) { - if (floating.offsetHeight < item.offsetHeight * Math.min(minItemsVisible, listRef.current.length - 1) - 1 || refOverflow.top >= -referenceOverflowThreshold || refOverflow.bottom >= -referenceOverflowThreshold) { - (0,react_dom__WEBPACK_IMPORTED_MODULE_2__.flushSync)(() => onFallbackChange(true)); - } else { - (0,react_dom__WEBPACK_IMPORTED_MODULE_2__.flushSync)(() => onFallbackChange(false)); - } - } - - if (overflowRef) { - overflowRef.current = await (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.detectOverflow)(getArgsWithCustomFloatingHeight({ ...nextArgs, - y: nextY - }, 'offsetHeight'), detectOverflowOptions); - } - - return { - y: nextY - }; - } - -}); - -const useInnerOffset = (_ref, _ref2) => { - let { - open, - refs - } = _ref; - let { - enabled = true, - overflowRef, - onChange - } = _ref2; - const onChangeRef = useLatestRef(onChange); - const controlledScrollingRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(false); - const prevScrollTopRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(null); - const initialOverflowRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(null); - react__WEBPACK_IMPORTED_MODULE_1__.useEffect(() => { - if (!enabled) { - return; - } - - function onWheel(e) { - if (e.ctrlKey || !el || overflowRef.current == null) { - return; - } - - const dY = e.deltaY; - const isAtTop = overflowRef.current.top >= -0.5; - const isAtBottom = overflowRef.current.bottom >= -0.5; - const remainingScroll = el.scrollHeight - el.clientHeight; - const sign = dY < 0 ? -1 : 1; - const method = dY < 0 ? 'max' : 'min'; - - if (el.scrollHeight <= el.clientHeight) { - return; - } - - if (!isAtTop && dY > 0 || !isAtBottom && dY < 0) { - e.preventDefault(); - (0,react_dom__WEBPACK_IMPORTED_MODULE_2__.flushSync)(() => { - onChangeRef.current(d => d + Math[method](dY, remainingScroll * sign)); - }); - } else if (/firefox/i.test(getUserAgent())) { - // Needed to propagate scrolling during momentum scrolling phase once - // it gets limited by the boundary. UX improvement, not critical. - el.scrollTop += dY; - } - } - - const el = refs.floating.current; - - if (open && el) { - el.addEventListener('wheel', onWheel); // Wait for the position to be ready. - - requestAnimationFrame(() => { - prevScrollTopRef.current = el.scrollTop; - - if (overflowRef.current != null) { - initialOverflowRef.current = { ...overflowRef.current - }; - } - }); - return () => { - prevScrollTopRef.current = null; - initialOverflowRef.current = null; - el.removeEventListener('wheel', onWheel); - }; - } - }, [enabled, open, refs, overflowRef, onChangeRef]); - - if (!enabled) { - return {}; - } - - return { - floating: { - onKeyDown() { - controlledScrollingRef.current = true; - }, - - onWheel() { - controlledScrollingRef.current = false; - }, - - onPointerMove() { - controlledScrollingRef.current = false; - }, - - onScroll() { - const el = refs.floating.current; - - if (!overflowRef.current || !el || !controlledScrollingRef.current) { - return; - } - - if (prevScrollTopRef.current !== null) { - const scrollDiff = el.scrollTop - prevScrollTopRef.current; - - if (overflowRef.current.bottom < -0.5 && scrollDiff < -1 || overflowRef.current.top < -0.5 && scrollDiff > 1) { - (0,react_dom__WEBPACK_IMPORTED_MODULE_2__.flushSync)(() => onChange(d => d + scrollDiff)); - } - } // [Firefox] Wait for the height change to have been applied. - - - requestAnimationFrame(() => { - prevScrollTopRef.current = el.scrollTop; - }); - } - - } - }; -}; -/** - * Adds relevant screen reader props for a given element `role`. - * @see https://floating-ui.com/docs/useRole - */ - - -const useRole = function (_ref, _temp) { - let { - open - } = _ref; - let { - enabled = true, - role = 'dialog' - } = _temp === void 0 ? {} : _temp; - const rootId = useId(); - const referenceId = useId(); - const floatingProps = { - id: rootId, - role - }; - - if (!enabled) { - return {}; - } - - if (role === 'tooltip') { - return { - reference: { - 'aria-describedby': open ? rootId : undefined - }, - floating: floatingProps - }; - } - - return { - reference: { - 'aria-expanded': open ? 'true' : 'false', - 'aria-haspopup': role === 'alertdialog' ? 'dialog' : role, - 'aria-controls': open ? rootId : undefined, - ...(role === 'listbox' && { - role: 'combobox' - }), - ...(role === 'menu' && { - id: referenceId - }) - }, - floating: { ...floatingProps, - ...(role === 'menu' && { - 'aria-labelledby': referenceId - }) - } - }; -}; - -function isButtonTarget(event) { - return isHTMLElement(event.target) && event.target.tagName === 'BUTTON'; -} -/** - * Adds click event listeners that change the open state. - * @see https://floating-ui.com/docs/useClick - */ - - -const useClick = function (_ref, _temp) { - let { - open, - onOpenChange, - dataRef, - refs - } = _ref; - let { - enabled = true, - pointerDown = false, - toggle = true, - ignoreMouse = false, - keyboardHandlers = true - } = _temp === void 0 ? {} : _temp; - const pointerTypeRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(); - - function isSpaceIgnored() { - return isTypeableElement(refs.domReference.current); - } - - if (!enabled) { - return {}; - } - - return { - reference: { - onPointerDown(event) { - pointerTypeRef.current = event.pointerType; - }, - - onMouseDown(event) { - // Ignore all buttons except for the "main" button. - // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button - if (event.button !== 0) { - return; - } - - if (pointerTypeRef.current === 'mouse' && ignoreMouse) { - return; - } - - if (!pointerDown) { - return; - } - - if (open) { - if (toggle && (dataRef.current.openEvent ? dataRef.current.openEvent.type === 'mousedown' : true)) { - onOpenChange(false); - } - } else { - onOpenChange(true); - } - - dataRef.current.openEvent = event.nativeEvent; - }, - - onClick(event) { - if (pointerDown && pointerTypeRef.current) { - pointerTypeRef.current = undefined; - return; - } - - if (pointerTypeRef.current === 'mouse' && ignoreMouse) { - return; - } - - if (open) { - if (toggle && (dataRef.current.openEvent ? dataRef.current.openEvent.type === 'click' : true)) { - onOpenChange(false); - } - } else { - onOpenChange(true); - } - - dataRef.current.openEvent = event.nativeEvent; - }, - - onKeyDown(event) { - pointerTypeRef.current = undefined; - - if (!keyboardHandlers) { - return; - } - - if (isButtonTarget(event)) { - return; - } - - if (event.key === ' ' && !isSpaceIgnored()) { - // Prvent scrolling - event.preventDefault(); - } - - if (event.key === 'Enter') { - if (open) { - if (toggle) { - onOpenChange(false); - } - } else { - onOpenChange(true); - } - } - }, - - onKeyUp(event) { - if (!keyboardHandlers) { - return; - } - - if (isButtonTarget(event) || isSpaceIgnored()) { - return; - } - - if (event.key === ' ') { - if (open) { - if (toggle) { - onOpenChange(false); - } - } else { - onOpenChange(true); - } - } - } - - } - }; -}; -/** - * Check whether the event.target is within the provided node. Uses event.composedPath if available for custom element support. - * - * @param event The event whose target/composedPath to check - * @param node The node to check against - * @returns Whether the event.target/composedPath is within the node. - */ - - -function isEventTargetWithin(event, node) { - if (node == null) { - return false; - } - - if ('composedPath' in event) { - return event.composedPath().includes(node); - } // TS thinks `event` is of type never as it assumes all browsers support composedPath, but browsers without shadow dom don't - - - const e = event; - return e.target != null && node.contains(e.target); -} -/** - * Adds listeners that dismiss (close) the floating element. - * @see https://floating-ui.com/docs/useDismiss - */ - - -const useDismiss = function (_ref, _temp) { - let { - open, - onOpenChange, - refs, - events, - nodeId - } = _ref; - let { - enabled = true, - escapeKey = true, - outsidePointerDown = true, - referencePointerDown = false, - ancestorScroll = false, - bubbles = true - } = _temp === void 0 ? {} : _temp; - const tree = useFloatingTree(); - const nested = useFloatingParentNodeId() != null; - const insideReactTreeRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(false); - react__WEBPACK_IMPORTED_MODULE_1__.useEffect(() => { - if (!open || !enabled) { - return; - } - - function onKeyDown(event) { - if (event.key === 'Escape') { - if (!bubbles && tree && getChildren(tree.nodesRef.current, nodeId).length > 0) { - return; - } - - events.emit('dismiss', { - preventScroll: false - }); - onOpenChange(false); - } - } - - function onPointerDown(event) { - // Given developers can stop the propagation of the synthetic event, - // we can only be confident with a positive value. - const insideReactTree = insideReactTreeRef.current; - insideReactTreeRef.current = false; - - if (insideReactTree) { - return; - } - - const target = getTarget(event); // Check if the click occurred on the scrollbar - - if (isElement(target) && refs.floating.current) { - var _refs$floating$curren; - - const win = (_refs$floating$curren = refs.floating.current.ownerDocument.defaultView) != null ? _refs$floating$curren : window; - const canScrollX = target.scrollWidth > target.clientWidth; - const canScrollY = target.scrollHeight > target.clientHeight; - let xCond = canScrollY && event.offsetX > target.clientWidth; // In some browsers it is possible to change the (or window) - // scrollbar to the left side, but is very rare and is difficult to - // check for. Plus, for modal dialogs with backdrops, it is more - // important that the backdrop is checked but not so much the window. - - if (canScrollY) { - const isRTL = win.getComputedStyle(target).direction === 'rtl'; - - if (isRTL) { - xCond = event.offsetX <= target.offsetWidth - target.clientWidth; - } - } - - if (xCond || canScrollX && event.offsetY > target.clientHeight) { - return; - } - } - - const targetIsInsideChildren = tree && getChildren(tree.nodesRef.current, nodeId).some(node => { - var _node$context; - - return isEventTargetWithin(event, (_node$context = node.context) == null ? void 0 : _node$context.refs.floating.current); - }); - - if (isEventTargetWithin(event, refs.floating.current) || isEventTargetWithin(event, refs.domReference.current) || targetIsInsideChildren) { - return; - } - - if (!bubbles && tree && getChildren(tree.nodesRef.current, nodeId).length > 0) { - return; - } - - events.emit('dismiss', nested ? { - preventScroll: true - } : false); - onOpenChange(false); - } - - function onScroll() { - onOpenChange(false); - } - - const doc = getDocument(refs.floating.current); - escapeKey && doc.addEventListener('keydown', onKeyDown); - outsidePointerDown && doc.addEventListener('pointerdown', onPointerDown); - const ancestors = (ancestorScroll ? [...(isElement(refs.reference.current) ? (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_5__.getOverflowAncestors)(refs.reference.current) : []), ...(isElement(refs.floating.current) ? (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_5__.getOverflowAncestors)(refs.floating.current) : [])] : []).filter(ancestor => { - var _doc$defaultView; - - return (// Ignore the visual viewport for scrolling dismissal (allow pinch-zoom) - ancestor !== ((_doc$defaultView = doc.defaultView) == null ? void 0 : _doc$defaultView.visualViewport) - ); - }); - ancestors.forEach(ancestor => ancestor.addEventListener('scroll', onScroll, { - passive: true - })); - return () => { - escapeKey && doc.removeEventListener('keydown', onKeyDown); - outsidePointerDown && doc.removeEventListener('pointerdown', onPointerDown); - ancestors.forEach(ancestor => ancestor.removeEventListener('scroll', onScroll)); - }; - }, [escapeKey, outsidePointerDown, events, tree, nodeId, open, onOpenChange, ancestorScroll, enabled, bubbles, refs, nested]); - - if (!enabled) { - return {}; - } - - return { - reference: { - onPointerDown() { - if (referencePointerDown) { - events.emit('dismiss'); - onOpenChange(false); - } - } - - }, - floating: { - onPointerDownCapture() { - insideReactTreeRef.current = true; - } - - } - }; -}; -/** - * Adds focus event listeners that change the open state, like CSS :focus. - * @see https://floating-ui.com/docs/useFocus - */ - - -const useFocus = function (_ref, _temp) { - let { - open, - onOpenChange, - dataRef, - refs, - events - } = _ref; - let { - enabled = true, - keyboardOnly = true - } = _temp === void 0 ? {} : _temp; - const pointerTypeRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(''); - const blockFocusRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(false); - const timeoutRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(); - react__WEBPACK_IMPORTED_MODULE_1__.useEffect(() => { - var _doc$defaultView; - - if (!enabled) { - return; - } - - const doc = getDocument(refs.floating.current); - const win = (_doc$defaultView = doc.defaultView) != null ? _doc$defaultView : window; - - function onBlur() { - if (!open && isHTMLElement(refs.domReference.current)) { - refs.domReference.current.blur(); - } - } - - win.addEventListener('blur', onBlur); - return () => { - win.removeEventListener('blur', onBlur); - }; - }, [refs, open, enabled]); - react__WEBPACK_IMPORTED_MODULE_1__.useEffect(() => { - if (!enabled) { - return; - } - - function onDismiss() { - blockFocusRef.current = true; - } - - events.on('dismiss', onDismiss); - return () => { - events.off('dismiss', onDismiss); - }; - }, [events, enabled]); - react__WEBPACK_IMPORTED_MODULE_1__.useEffect(() => { - return () => { - clearTimeout(timeoutRef.current); - }; - }, []); - - if (!enabled) { - return {}; - } - - return { - reference: { - onPointerDown(_ref2) { - let { - pointerType - } = _ref2; - pointerTypeRef.current = pointerType; - blockFocusRef.current = !!(pointerType && keyboardOnly); - }, - - onPointerLeave() { - blockFocusRef.current = false; - }, - - onFocus(event) { - var _dataRef$current$open, _refs$domReference$cu, _dataRef$current$open2; - - if (blockFocusRef.current) { - return; - } // Dismiss with click should ignore the subsequent `focus` trigger, but - // only if the click originated inside the reference element. - - - if (event.type === 'focus' && ((_dataRef$current$open = dataRef.current.openEvent) == null ? void 0 : _dataRef$current$open.type) === 'mousedown' && (_refs$domReference$cu = refs.domReference.current) != null && _refs$domReference$cu.contains((_dataRef$current$open2 = dataRef.current.openEvent) == null ? void 0 : _dataRef$current$open2.target)) { - return; - } - - dataRef.current.openEvent = event.nativeEvent; - onOpenChange(true); - }, - - onBlur(event) { - const target = event.relatedTarget; // Wait for the window blur listener to fire. - - timeoutRef.current = setTimeout(() => { - var _refs$floating$curren, _refs$domReference$cu2; // When focusing the reference element (e.g. regular click), then - // clicking into the floating element, prevent it from hiding. - // Note: it must be focusable, e.g. `tabindex="-1"`. - - - if ((_refs$floating$curren = refs.floating.current) != null && _refs$floating$curren.contains(target) || (_refs$domReference$cu2 = refs.domReference.current) != null && _refs$domReference$cu2.contains(target)) { - return; - } - - blockFocusRef.current = false; - onOpenChange(false); - }); - } - - } - }; -}; - -const ARROW_UP = 'ArrowUp'; -const ARROW_DOWN = 'ArrowDown'; -const ARROW_LEFT = 'ArrowLeft'; -const ARROW_RIGHT = 'ArrowRight'; - -function isDifferentRow(index, cols, prevRow) { - return Math.floor(index / cols) !== prevRow; -} - -function isIndexOutOfBounds(listRef, index) { - return index < 0 || index >= listRef.current.length; -} - -function findNonDisabledIndex(listRef, _temp) { - let { - startingIndex = -1, - decrement = false, - disabledIndices, - amount = 1 - } = _temp === void 0 ? {} : _temp; - const list = listRef.current; - let index = startingIndex; - - do { - var _list$index, _list$index2; - - index = index + (decrement ? -amount : amount); - } while (index >= 0 && index <= list.length - 1 && (disabledIndices ? disabledIndices.includes(index) : list[index] == null || ((_list$index = list[index]) == null ? void 0 : _list$index.hasAttribute('disabled')) || ((_list$index2 = list[index]) == null ? void 0 : _list$index2.getAttribute('aria-disabled')) === 'true')); - - return index; -} - -function doSwitch(orientation, vertical, horizontal) { - switch (orientation) { - case 'vertical': - return vertical; - - case 'horizontal': - return horizontal; - - default: - return vertical || horizontal; - } -} - -function isMainOrientationKey(key, orientation) { - const vertical = key === ARROW_UP || key === ARROW_DOWN; - const horizontal = key === ARROW_LEFT || key === ARROW_RIGHT; - return doSwitch(orientation, vertical, horizontal); -} - -function isMainOrientationToEndKey(key, orientation, rtl) { - const vertical = key === ARROW_DOWN; - const horizontal = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT; - return doSwitch(orientation, vertical, horizontal) || key === 'Enter' || key == ' ' || key === ''; -} - -function isCrossOrientationOpenKey(key, orientation, rtl) { - const vertical = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT; - const horizontal = key === ARROW_DOWN; - return doSwitch(orientation, vertical, horizontal); -} - -function isCrossOrientationCloseKey(key, orientation, rtl) { - const vertical = rtl ? key === ARROW_RIGHT : key === ARROW_LEFT; - const horizontal = key === ARROW_UP; - return doSwitch(orientation, vertical, horizontal); -} - -function getMinIndex(listRef, disabledIndices) { - return findNonDisabledIndex(listRef, { - disabledIndices - }); -} - -function getMaxIndex(listRef, disabledIndices) { - return findNonDisabledIndex(listRef, { - decrement: true, - startingIndex: listRef.current.length, - disabledIndices - }); -} -/** - * Adds focus-managed indexed navigation via arrow keys to a list of items - * within the floating element. - * @see https://floating-ui.com/docs/useListNavigation - */ - - -const useListNavigation = function (_ref, _temp2) { - let { - open, - onOpenChange, - refs - } = _ref; - let { - listRef, - activeIndex, - onNavigate: unstable_onNavigate = () => {}, - enabled = true, - selectedIndex = null, - allowEscape = false, - loop = false, - nested = false, - rtl = false, - virtual = false, - focusItemOnOpen = 'auto', - focusItemOnHover = true, - openOnArrowKeyDown = true, - disabledIndices = undefined, - orientation = 'vertical', - cols = 1 - } = _temp2 === void 0 ? { - listRef: { - current: [] - }, - activeIndex: null, - onNavigate: () => {} - } : _temp2; - - if (true) { - if (allowEscape) { - if (!loop) { - console.warn(['Floating UI: `useListNavigation` looping must be enabled to allow', 'escaping.'].join(' ')); - } - - if (!virtual) { - console.warn(['Floating UI: `useListNavigation` must be virtual to allow', 'escaping.'].join(' ')); - } - } - - if (orientation === 'vertical' && cols > 1) { - console.warn(['Floating UI: In grid list navigation mode (`cols` > 1), the', '`orientation` should be either "horizontal" or "both".'].join(' ')); - } - } - - const parentId = useFloatingParentNodeId(); - const tree = useFloatingTree(); - const previousOpen = usePrevious(open); - const onNavigate = useEvent(unstable_onNavigate); - const previousOnNavigate = useEvent(usePrevious(unstable_onNavigate)); - const focusItemOnOpenRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(focusItemOnOpen); - const indexRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(selectedIndex != null ? selectedIndex : -1); - const keyRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(null); - const disabledIndicesRef = useLatestRef(disabledIndices); - const blockPointerLeaveRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(false); - const frameRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(-1); - const [activeId, setActiveId] = react__WEBPACK_IMPORTED_MODULE_1__.useState(); - const focusItem = react__WEBPACK_IMPORTED_MODULE_1__.useCallback((listRef, indexRef) => { - // `pointerDown` clicks occur before `focus`, so the button will steal the - // focus unless we wait a frame. - frameRef.current = requestAnimationFrame(() => { - if (virtual) { - var _listRef$current$inde; - - setActiveId((_listRef$current$inde = listRef.current[indexRef.current]) == null ? void 0 : _listRef$current$inde.id); - } else { - var _listRef$current$inde2; - - (_listRef$current$inde2 = listRef.current[indexRef.current]) == null ? void 0 : _listRef$current$inde2.focus({ - preventScroll: true - }); - } - }); - }, [virtual]); // Sync `selectedIndex` to be the `activeIndex` upon opening the floating - // element. Also, reset `activeIndex` upon closing the floating element. - - index(() => { - if (!enabled) { - return; - } - - if (!previousOpen && open && focusItemOnOpenRef.current && selectedIndex != null) { - onNavigate(selectedIndex); - } // Unset `activeIndex`. Since the user can specify `onNavigate` - // conditionally (onNavigate: open ? setActiveIndex : setSelectedIndex) - // we store and call the previous function - - - if (previousOpen && !open) { - cancelAnimationFrame(frameRef.current); - indexRef.current = -1; - previousOnNavigate(null); - } - }, [open, previousOpen, selectedIndex, listRef, focusItem, enabled, onNavigate, previousOnNavigate]); // Sync `activeIndex` to be the focused item while the floating element is - // open. - - index(() => { - if (!enabled) { - return; - } - - if (open) { - if (activeIndex == null) { - if (selectedIndex != null) { - return; - } // Reset while the floating element was open (e.g. the list changed). - - - if (previousOpen) { - indexRef.current = -1; - focusItem(listRef, indexRef); - } // Initial sync - - - if (!previousOpen && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) { - indexRef.current = keyRef.current == null || isMainOrientationToEndKey(keyRef.current, orientation, rtl) || nested ? getMinIndex(listRef, disabledIndicesRef.current) : getMaxIndex(listRef, disabledIndicesRef.current); - onNavigate(indexRef.current); - focusItem(listRef, indexRef); - } - } else if (!isIndexOutOfBounds(listRef, activeIndex)) { - indexRef.current = activeIndex; - focusItem(listRef, indexRef); - } - } - }, [open, previousOpen, activeIndex, selectedIndex, nested, listRef, onNavigate, focusItem, enabled, allowEscape, orientation, rtl, virtual, disabledIndicesRef]); // Ensure the parent floating element has focus when a nested child closes - // to allow arrow key navigation to work after the pointer leaves the child. - - index(() => { - if (!enabled) { - return; - } - - if (!open && previousOpen) { - var _tree$nodesRef$curren, _tree$nodesRef$curren2; - - const parentFloating = tree == null ? void 0 : (_tree$nodesRef$curren = tree.nodesRef.current.find(node => node.id === parentId)) == null ? void 0 : (_tree$nodesRef$curren2 = _tree$nodesRef$curren.context) == null ? void 0 : _tree$nodesRef$curren2.refs.floating.current; - - if (parentFloating && !parentFloating.contains(activeElement(getDocument(parentFloating)))) { - parentFloating.focus({ - preventScroll: true - }); - } - } - }, [enabled, open, previousOpen, tree, parentId]); - index(() => { - keyRef.current = null; - }); - - function onKeyDown(event) { - blockPointerLeaveRef.current = true; - - if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl)) { - stopEvent(event); - onOpenChange(false); - - if (isHTMLElement(refs.domReference.current)) { - refs.domReference.current.focus(); - } - - return; - } - - const currentIndex = indexRef.current; - const minIndex = getMinIndex(listRef, disabledIndices); - const maxIndex = getMaxIndex(listRef, disabledIndices); - - if (event.key === 'Home') { - indexRef.current = minIndex; - onNavigate(indexRef.current); - } - - if (event.key === 'End') { - indexRef.current = maxIndex; - onNavigate(indexRef.current); - } // Grid navigation - - - if (cols > 1) { - const prevIndex = indexRef.current; - - if (event.key === ARROW_UP) { - stopEvent(event); - - if (prevIndex === -1) { - indexRef.current = maxIndex; - } else { - indexRef.current = findNonDisabledIndex(listRef, { - startingIndex: prevIndex, - amount: cols, - decrement: true, - disabledIndices - }); - - if (loop && (prevIndex - cols < minIndex || indexRef.current < 0)) { - const col = prevIndex % cols; - const maxCol = maxIndex % cols; - const offset = maxIndex - (maxCol - col); - - if (maxCol === col) { - indexRef.current = maxIndex; - } else { - indexRef.current = maxCol > col ? offset : offset - cols; - } - } - } - - if (isIndexOutOfBounds(listRef, indexRef.current)) { - indexRef.current = prevIndex; - } - - onNavigate(indexRef.current); - } - - if (event.key === ARROW_DOWN) { - stopEvent(event); - - if (prevIndex === -1) { - indexRef.current = minIndex; - } else { - indexRef.current = findNonDisabledIndex(listRef, { - startingIndex: prevIndex, - amount: cols, - disabledIndices - }); - - if (loop && prevIndex + cols > maxIndex) { - indexRef.current = findNonDisabledIndex(listRef, { - startingIndex: prevIndex % cols - cols, - amount: cols, - disabledIndices - }); - } - } - - if (isIndexOutOfBounds(listRef, indexRef.current)) { - indexRef.current = prevIndex; - } - - onNavigate(indexRef.current); - } // Remains on the same row/column - - - if (orientation === 'both') { - const prevRow = Math.floor(prevIndex / cols); - - if (event.key === ARROW_RIGHT) { - stopEvent(event); - - if (prevIndex % cols !== cols - 1) { - indexRef.current = findNonDisabledIndex(listRef, { - startingIndex: prevIndex, - disabledIndices - }); - - if (loop && isDifferentRow(indexRef.current, cols, prevRow)) { - indexRef.current = findNonDisabledIndex(listRef, { - startingIndex: prevIndex - prevIndex % cols - 1, - disabledIndices - }); - } - } else if (loop) { - indexRef.current = findNonDisabledIndex(listRef, { - startingIndex: prevIndex - prevIndex % cols - 1, - disabledIndices - }); - } - - if (isDifferentRow(indexRef.current, cols, prevRow)) { - indexRef.current = prevIndex; - } - } - - if (event.key === ARROW_LEFT) { - stopEvent(event); - - if (prevIndex % cols !== 0) { - indexRef.current = findNonDisabledIndex(listRef, { - startingIndex: prevIndex, - disabledIndices, - decrement: true - }); - - if (loop && isDifferentRow(indexRef.current, cols, prevRow)) { - indexRef.current = findNonDisabledIndex(listRef, { - startingIndex: prevIndex + (cols - prevIndex % cols), - decrement: true, - disabledIndices - }); - } - } else if (loop) { - indexRef.current = findNonDisabledIndex(listRef, { - startingIndex: prevIndex + (cols - prevIndex % cols), - decrement: true, - disabledIndices - }); - } - - if (isDifferentRow(indexRef.current, cols, prevRow)) { - indexRef.current = prevIndex; - } - } - - const lastRow = Math.floor(maxIndex / cols) === prevRow; - - if (isIndexOutOfBounds(listRef, indexRef.current)) { - if (loop && lastRow) { - indexRef.current = event.key === ARROW_LEFT ? maxIndex : findNonDisabledIndex(listRef, { - startingIndex: prevIndex - prevIndex % cols - 1, - disabledIndices - }); - } else { - indexRef.current = prevIndex; - } - } - - onNavigate(indexRef.current); - return; - } - } - - if (isMainOrientationKey(event.key, orientation)) { - stopEvent(event); // Reset the index if no item is focused. - - if (open && !virtual && activeElement(event.currentTarget.ownerDocument) === event.currentTarget) { - indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex; - onNavigate(indexRef.current); - return; - } - - if (isMainOrientationToEndKey(event.key, orientation, rtl)) { - if (loop) { - indexRef.current = currentIndex >= maxIndex ? allowEscape && currentIndex !== listRef.current.length ? -1 : minIndex : findNonDisabledIndex(listRef, { - startingIndex: currentIndex, - disabledIndices - }); - } else { - indexRef.current = Math.min(maxIndex, findNonDisabledIndex(listRef, { - startingIndex: currentIndex, - disabledIndices - })); - } - } else { - if (loop) { - indexRef.current = currentIndex <= minIndex ? allowEscape && currentIndex !== -1 ? listRef.current.length : maxIndex : findNonDisabledIndex(listRef, { - startingIndex: currentIndex, - decrement: true, - disabledIndices - }); - } else { - indexRef.current = Math.max(minIndex, findNonDisabledIndex(listRef, { - startingIndex: currentIndex, - decrement: true, - disabledIndices - })); - } - } - - if (isIndexOutOfBounds(listRef, indexRef.current)) { - onNavigate(null); - } else { - onNavigate(indexRef.current); - } - } - } - - if (!enabled) { - return {}; - } - - return { - reference: { ...(virtual && open && activeIndex != null && { - 'aria-activedescendant': activeId - }), - - onKeyDown(event) { - blockPointerLeaveRef.current = true; - - if (virtual && open) { - return onKeyDown(event); - } - - const isNavigationKey = event.key.indexOf('Arrow') === 0 || event.key === 'Enter' || event.key === ' ' || event.key === ''; - - if (isNavigationKey) { - keyRef.current = event.key; - } - - if (nested) { - if (isCrossOrientationOpenKey(event.key, orientation, rtl)) { - stopEvent(event); - - if (open) { - indexRef.current = getMinIndex(listRef, disabledIndices); - onNavigate(indexRef.current); - } else { - onOpenChange(true); - } - } - - return; - } - - if (isMainOrientationKey(event.key, orientation)) { - if (selectedIndex != null) { - indexRef.current = selectedIndex; - } - - stopEvent(event); - - if (!open && openOnArrowKeyDown) { - onOpenChange(true); - } else { - onKeyDown(event); - } - - if (open) { - onNavigate(indexRef.current); - } - } - } - - }, - floating: { - 'aria-orientation': orientation === 'both' ? undefined : orientation, - ...(virtual && activeIndex != null && { - 'aria-activedescendant': activeId - }), - onKeyDown, - - onPointerMove() { - blockPointerLeaveRef.current = false; - } - - }, - item: { - onFocus(_ref2) { - let { - currentTarget - } = _ref2; - const index = listRef.current.indexOf(currentTarget); - - if (index !== -1) { - onNavigate(index); - } - }, - - onClick: _ref3 => { - let { - currentTarget - } = _ref3; - return currentTarget.focus({ - preventScroll: true - }); - }, - // Safari - ...(focusItemOnHover && { - onMouseMove(_ref4) { - let { - currentTarget - } = _ref4; - const target = currentTarget; - - if (target) { - const index = listRef.current.indexOf(target); - - if (index !== -1) { - onNavigate(index); - } - } - }, - - onPointerLeave() { - if (!blockPointerLeaveRef.current) { - indexRef.current = -1; - focusItem(listRef, indexRef); - onNavigate(null); - - if (!virtual) { - var _refs$floating$curren; - - (_refs$floating$curren = refs.floating.current) == null ? void 0 : _refs$floating$curren.focus({ - preventScroll: true - }); - } - } - } - - }) - } - }; -}; -/** - * Provides a matching callback that can be used to focus an item as the user - * types, often used in tandem with `useListNavigation()`. - * @see https://floating-ui.com/docs/useTypeahead - */ - - -const useTypeahead = function (_ref, _temp) { - var _ref2; - - let { - open, - dataRef - } = _ref; - let { - listRef, - activeIndex, - onMatch = () => {}, - enabled = true, - findMatch = null, - resetMs = 1000, - ignoreKeys = [], - selectedIndex = null - } = _temp === void 0 ? { - listRef: { - current: [] - }, - activeIndex: null - } : _temp; - const timeoutIdRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(); - const stringRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(''); - const prevIndexRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef((_ref2 = selectedIndex != null ? selectedIndex : activeIndex) != null ? _ref2 : -1); - const matchIndexRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(null); - index(() => { - if (open) { - clearTimeout(timeoutIdRef.current); - matchIndexRef.current = null; - stringRef.current = ''; - } - }, [open]); - index(() => { - // Sync arrow key navigation but not typeahead navigation - if (open && stringRef.current === '') { - var _ref3; - - prevIndexRef.current = (_ref3 = selectedIndex != null ? selectedIndex : activeIndex) != null ? _ref3 : -1; - } - }, [open, selectedIndex, activeIndex]); - - function onKeyDown(event) { - // Correctly scope nested non-portalled floating elements. Since the nested - // floating element is inside of the another, we find the closest role - // that indicates the floating element scope. - const target = getTarget(event.nativeEvent); - - if (isElement(target) && (activeElement(getDocument(target)) !== event.currentTarget ? target.closest('[role="dialog"],[role="menu"],[role="listbox"],[role="tree"],[role="grid"]') !== event.currentTarget : false)) { - return; - } - - if (stringRef.current.length > 0 && stringRef.current[0] !== ' ') { - dataRef.current.typing = true; - - if (event.key === ' ') { - stopEvent(event); - } - } - - const listContent = listRef.current; - - if (listContent == null || ignoreKeys.includes(event.key) || // Character key - event.key.length !== 1 || // Modifier key - event.ctrlKey || event.metaKey || event.altKey) { - return; - } // Bail out if the list contains a word like "llama" or "aaron". TODO: - // allow it in this case, too. - - - const allowRapidSuccessionOfFirstLetter = listContent.every(text => { - var _text$, _text$2; - - return text ? ((_text$ = text[0]) == null ? void 0 : _text$.toLocaleLowerCase()) !== ((_text$2 = text[1]) == null ? void 0 : _text$2.toLocaleLowerCase()) : true; - }); // Allows the user to cycle through items that start with the same letter - // in rapid succession - - if (allowRapidSuccessionOfFirstLetter && stringRef.current === event.key) { - stringRef.current = ''; - prevIndexRef.current = matchIndexRef.current; - } - - stringRef.current += event.key; - clearTimeout(timeoutIdRef.current); - timeoutIdRef.current = setTimeout(() => { - stringRef.current = ''; - prevIndexRef.current = matchIndexRef.current; - dataRef.current.typing = false; - }, resetMs); - const prevIndex = prevIndexRef.current; - const orderedList = [...listContent.slice((prevIndex != null ? prevIndex : 0) + 1), ...listContent.slice(0, (prevIndex != null ? prevIndex : 0) + 1)]; - const str = findMatch ? findMatch(orderedList, stringRef.current) : orderedList.find(text => (text == null ? void 0 : text.toLocaleLowerCase().indexOf(stringRef.current.toLocaleLowerCase())) === 0); - const index = str ? listContent.indexOf(str) : -1; - - if (index !== -1) { - onMatch(index); - matchIndexRef.current = index; - } - } - - if (!enabled) { - return {}; - } - - return { - reference: { - onKeyDown - }, - floating: { - onKeyDown - } - }; -}; - - - -/***/ }), - -/***/ "./node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.js ***! - \*******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "arrow": () => (/* binding */ arrow), -/* harmony export */ "autoPlacement": () => (/* reexport safe */ _floating_ui_dom__WEBPACK_IMPORTED_MODULE_0__.autoPlacement), -/* harmony export */ "autoUpdate": () => (/* reexport safe */ _floating_ui_dom__WEBPACK_IMPORTED_MODULE_0__.autoUpdate), -/* harmony export */ "computePosition": () => (/* reexport safe */ _floating_ui_dom__WEBPACK_IMPORTED_MODULE_0__.computePosition), -/* harmony export */ "detectOverflow": () => (/* reexport safe */ _floating_ui_dom__WEBPACK_IMPORTED_MODULE_0__.detectOverflow), -/* harmony export */ "flip": () => (/* reexport safe */ _floating_ui_dom__WEBPACK_IMPORTED_MODULE_0__.flip), -/* harmony export */ "getOverflowAncestors": () => (/* reexport safe */ _floating_ui_dom__WEBPACK_IMPORTED_MODULE_0__.getOverflowAncestors), -/* harmony export */ "hide": () => (/* reexport safe */ _floating_ui_dom__WEBPACK_IMPORTED_MODULE_0__.hide), -/* harmony export */ "inline": () => (/* reexport safe */ _floating_ui_dom__WEBPACK_IMPORTED_MODULE_0__.inline), -/* harmony export */ "limitShift": () => (/* reexport safe */ _floating_ui_dom__WEBPACK_IMPORTED_MODULE_0__.limitShift), -/* harmony export */ "offset": () => (/* reexport safe */ _floating_ui_dom__WEBPACK_IMPORTED_MODULE_0__.offset), -/* harmony export */ "shift": () => (/* reexport safe */ _floating_ui_dom__WEBPACK_IMPORTED_MODULE_0__.shift), -/* harmony export */ "size": () => (/* reexport safe */ _floating_ui_dom__WEBPACK_IMPORTED_MODULE_0__.size), -/* harmony export */ "useFloating": () => (/* binding */ useFloating) -/* harmony export */ }); -/* harmony import */ var _floating_ui_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @floating-ui/dom */ "./node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.mjs"); -/* harmony import */ var _floating_ui_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @floating-ui/dom */ "./node_modules/@floating-ui/core/dist/floating-ui.core.browser.mjs"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js"); - - - - - -var index = typeof document !== 'undefined' ? react__WEBPACK_IMPORTED_MODULE_1__.useLayoutEffect : react__WEBPACK_IMPORTED_MODULE_1__.useEffect; // Fork of `fast-deep-equal` that only does the comparisons we need and compares -// functions - -function deepEqual(a, b) { - if (a === b) { - return true; - } - - if (typeof a !== typeof b) { - return false; - } - - if (typeof a === 'function' && a.toString() === b.toString()) { - return true; - } - - let length, i, keys; - - if (a && b && typeof a == 'object') { - if (Array.isArray(a)) { - length = a.length; - if (length != b.length) return false; - - for (i = length; i-- !== 0;) { - if (!deepEqual(a[i], b[i])) { - return false; - } - } - - return true; - } - - keys = Object.keys(a); - length = keys.length; - - if (length !== Object.keys(b).length) { - return false; - } - - for (i = length; i-- !== 0;) { - if (!Object.prototype.hasOwnProperty.call(b, keys[i])) { - return false; - } - } - - for (i = length; i-- !== 0;) { - const key = keys[i]; - - if (key === '_owner' && a.$$typeof) { - continue; - } - - if (!deepEqual(a[key], b[key])) { - return false; - } - } - - return true; - } - - return a !== a && b !== b; -} - -function useLatestRef(value) { - const ref = react__WEBPACK_IMPORTED_MODULE_1__.useRef(value); - index(() => { - ref.current = value; - }); - return ref; -} - -function useFloating(_temp) { - let { - middleware, - placement = 'bottom', - strategy = 'absolute', - whileElementsMounted - } = _temp === void 0 ? {} : _temp; - const [data, setData] = react__WEBPACK_IMPORTED_MODULE_1__.useState({ - // Setting these to `null` will allow the consumer to determine if - // `computePosition()` has run yet - x: null, - y: null, - strategy, - placement, - middlewareData: {} - }); - const [latestMiddleware, setLatestMiddleware] = react__WEBPACK_IMPORTED_MODULE_1__.useState(middleware); - - if (!deepEqual(latestMiddleware == null ? void 0 : latestMiddleware.map(_ref => { - let { - name, - options - } = _ref; - return { - name, - options - }; - }), middleware == null ? void 0 : middleware.map(_ref2 => { - let { - name, - options - } = _ref2; - return { - name, - options - }; - }))) { - setLatestMiddleware(middleware); - } - - const reference = react__WEBPACK_IMPORTED_MODULE_1__.useRef(null); - const floating = react__WEBPACK_IMPORTED_MODULE_1__.useRef(null); - const cleanupRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(null); - const dataRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(data); - const whileElementsMountedRef = useLatestRef(whileElementsMounted); - const update = react__WEBPACK_IMPORTED_MODULE_1__.useCallback(() => { - if (!reference.current || !floating.current) { - return; - } - - (0,_floating_ui_dom__WEBPACK_IMPORTED_MODULE_0__.computePosition)(reference.current, floating.current, { - middleware: latestMiddleware, - placement, - strategy - }).then(data => { - if (isMountedRef.current && !deepEqual(dataRef.current, data)) { - dataRef.current = data; - react_dom__WEBPACK_IMPORTED_MODULE_2__.flushSync(() => { - setData(data); - }); - } - }); - }, [latestMiddleware, placement, strategy]); - index(() => { - // Skip first update - if (isMountedRef.current) { - update(); - } - }, [update]); - const isMountedRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(false); - index(() => { - isMountedRef.current = true; - return () => { - isMountedRef.current = false; - }; - }, []); - const runElementMountCallback = react__WEBPACK_IMPORTED_MODULE_1__.useCallback(() => { - if (typeof cleanupRef.current === 'function') { - cleanupRef.current(); - cleanupRef.current = null; - } - - if (reference.current && floating.current) { - if (whileElementsMountedRef.current) { - const cleanupFn = whileElementsMountedRef.current(reference.current, floating.current, update); - cleanupRef.current = cleanupFn; - } else { - update(); - } - } - }, [update, whileElementsMountedRef]); - const setReference = react__WEBPACK_IMPORTED_MODULE_1__.useCallback(node => { - reference.current = node; - runElementMountCallback(); - }, [runElementMountCallback]); - const setFloating = react__WEBPACK_IMPORTED_MODULE_1__.useCallback(node => { - floating.current = node; - runElementMountCallback(); - }, [runElementMountCallback]); - const refs = react__WEBPACK_IMPORTED_MODULE_1__.useMemo(() => ({ - reference, - floating - }), []); - return react__WEBPACK_IMPORTED_MODULE_1__.useMemo(() => ({ ...data, - update, - refs, - reference: setReference, - floating: setFloating - }), [data, update, refs, setReference, setFloating]); -} -/** - * Positions an inner element of the floating element such that it is centered - * to the reference element. - * This wraps the core `arrow` middleware to allow React refs as the element. - * @see https://floating-ui.com/docs/arrow - */ - - -const arrow = options => { - const { - element, - padding - } = options; - - function isRef(value) { - return Object.prototype.hasOwnProperty.call(value, 'current'); - } - - return { - name: 'arrow', - options, - - fn(args) { - if (isRef(element)) { - if (element.current != null) { - return (0,_floating_ui_dom__WEBPACK_IMPORTED_MODULE_3__.arrow)({ - element: element.current, - padding - }).fn(args); - } - - return {}; - } else if (element) { - return (0,_floating_ui_dom__WEBPACK_IMPORTED_MODULE_3__.arrow)({ - element, - padding - }).fn(args); - } - - return {}; - } - - }; -}; - - - -/***/ }), - -/***/ "./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js": -/*!***************************************************************************************!*\ - !*** ./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js ***! - \***************************************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* global __webpack_require__ */ -var Refresh = __webpack_require__(/*! react-refresh/runtime */ "./node_modules/react-refresh/runtime.js"); -/** - * Extracts exports from a webpack module object. - * @param {string} moduleId A Webpack module ID. - * @returns {*} An exports object from the module. - */ - - -function getModuleExports(moduleId) { - if (typeof moduleId === 'undefined') { - // `moduleId` is unavailable, which indicates that this module is not in the cache, - // which means we won't be able to capture any exports, - // and thus they cannot be refreshed safely. - // These are likely runtime or dynamically generated modules. - return {}; - } - - var maybeModule = __webpack_require__.c[moduleId]; - - if (typeof maybeModule === 'undefined') { - // `moduleId` is available but the module in cache is unavailable, - // which indicates the module is somehow corrupted (e.g. broken Webpacak `module` globals). - // We will warn the user (as this is likely a mistake) and assume they cannot be refreshed. - console.warn('[React Refresh] Failed to get exports for module: ' + moduleId + '.'); - return {}; - } - - var exportsOrPromise = maybeModule.exports; - - if (typeof Promise !== 'undefined' && exportsOrPromise instanceof Promise) { - return exportsOrPromise.then(function (exports) { - return exports; - }); - } - - return exportsOrPromise; -} -/** - * Calculates the signature of a React refresh boundary. - * If this signature changes, it's unsafe to accept the boundary. - * - * This implementation is based on the one in [Metro](https://github.com/facebook/metro/blob/907d6af22ac6ebe58572be418e9253a90665ecbd/packages/metro/src/lib/polyfills/require.js#L795-L816). - * @param {*} moduleExports A Webpack module exports object. - * @returns {string[]} A React refresh boundary signature array. - */ - - -function getReactRefreshBoundarySignature(moduleExports) { - var signature = []; - signature.push(Refresh.getFamilyByType(moduleExports)); - - if (moduleExports == null || typeof moduleExports !== 'object') { - // Exit if we can't iterate over exports. - return signature; - } - - for (var key in moduleExports) { - if (key === '__esModule') { - continue; - } - - signature.push(key); - signature.push(Refresh.getFamilyByType(moduleExports[key])); - } - - return signature; -} -/** - * Creates a helper that performs a delayed React refresh. - * @returns {function(function(): void): void} A debounced React refresh function. - */ - - -function createDebounceUpdate() { - /** - * A cached setTimeout handler. - * @type {number | undefined} - */ - var refreshTimeout; - /** - * Performs react refresh on a delay and clears the error overlay. - * @param {function(): void} callback - * @returns {void} - */ - - function enqueueUpdate(callback) { - if (typeof refreshTimeout === 'undefined') { - refreshTimeout = setTimeout(function () { - refreshTimeout = undefined; - Refresh.performReactRefresh(); - callback(); - }, 30); - } - } - - return enqueueUpdate; -} -/** - * Checks if all exports are likely a React component. - * - * This implementation is based on the one in [Metro](https://github.com/facebook/metro/blob/febdba2383113c88296c61e28e4ef6a7f4939fda/packages/metro/src/lib/polyfills/require.js#L748-L774). - * @param {*} moduleExports A Webpack module exports object. - * @returns {boolean} Whether the exports are React component like. - */ - - -function isReactRefreshBoundary(moduleExports) { - if (Refresh.isLikelyComponentType(moduleExports)) { - return true; - } - - if (moduleExports === undefined || moduleExports === null || typeof moduleExports !== 'object') { - // Exit if we can't iterate over exports. - return false; - } - - var hasExports = false; - var areAllExportsComponents = true; - - for (var key in moduleExports) { - hasExports = true; // This is the ES Module indicator flag - - if (key === '__esModule') { - continue; - } // We can (and have to) safely execute getters here, - // as Webpack manually assigns harmony exports to getters, - // without any side-effects attached. - // Ref: https://github.com/webpack/webpack/blob/b93048643fe74de2a6931755911da1212df55897/lib/MainTemplate.js#L281 - - - var exportValue = moduleExports[key]; - - if (!Refresh.isLikelyComponentType(exportValue)) { - areAllExportsComponents = false; - } - } - - return hasExports && areAllExportsComponents; -} -/** - * Checks if exports are likely a React component and registers them. - * - * This implementation is based on the one in [Metro](https://github.com/facebook/metro/blob/febdba2383113c88296c61e28e4ef6a7f4939fda/packages/metro/src/lib/polyfills/require.js#L818-L835). - * @param {*} moduleExports A Webpack module exports object. - * @param {string} moduleId A Webpack module ID. - * @returns {void} - */ - - -function registerExportsForReactRefresh(moduleExports, moduleId) { - if (Refresh.isLikelyComponentType(moduleExports)) { - // Register module.exports if it is likely a component - Refresh.register(moduleExports, moduleId + ' %exports%'); - } - - if (moduleExports === undefined || moduleExports === null || typeof moduleExports !== 'object') { - // Exit if we can't iterate over the exports. - return; - } - - for (var key in moduleExports) { - // Skip registering the ES Module indicator - if (key === '__esModule') { - continue; - } - - var exportValue = moduleExports[key]; - - if (Refresh.isLikelyComponentType(exportValue)) { - var typeID = moduleId + ' %exports% ' + key; - Refresh.register(exportValue, typeID); - } - } -} -/** - * Compares previous and next module objects to check for mutated boundaries. - * - * This implementation is based on the one in [Metro](https://github.com/facebook/metro/blob/907d6af22ac6ebe58572be418e9253a90665ecbd/packages/metro/src/lib/polyfills/require.js#L776-L792). - * @param {*} prevExports The current Webpack module exports object. - * @param {*} nextExports The next Webpack module exports object. - * @returns {boolean} Whether the React refresh boundary should be invalidated. - */ - - -function shouldInvalidateReactRefreshBoundary(prevExports, nextExports) { - var prevSignature = getReactRefreshBoundarySignature(prevExports); - var nextSignature = getReactRefreshBoundarySignature(nextExports); - - if (prevSignature.length !== nextSignature.length) { - return true; - } - - for (var i = 0; i < nextSignature.length; i += 1) { - if (prevSignature[i] !== nextSignature[i]) { - return true; - } - } - - return false; -} - -var enqueueUpdate = createDebounceUpdate(); - -function executeRuntime(moduleExports, moduleId, webpackHot, refreshOverlay, isTest) { - registerExportsForReactRefresh(moduleExports, moduleId); - - if (webpackHot) { - var isHotUpdate = !!webpackHot.data; - var prevExports; - - if (isHotUpdate) { - prevExports = webpackHot.data.prevExports; - } - - if (isReactRefreshBoundary(moduleExports)) { - webpackHot.dispose( - /** - * A callback to performs a full refresh if React has unrecoverable errors, - * and also caches the to-be-disposed module. - * @param {*} data A hot module data object from Webpack HMR. - * @returns {void} - */ - function hotDisposeCallback(data) { - // We have to mutate the data object to get data registered and cached - data.prevExports = moduleExports; - }); - webpackHot.accept( - /** - * An error handler to allow self-recovering behaviours. - * @param {Error} error An error occurred during evaluation of a module. - * @returns {void} - */ - function hotErrorHandler(error) { - if (typeof refreshOverlay !== 'undefined' && refreshOverlay) { - refreshOverlay.handleRuntimeError(error); - } - - if (typeof isTest !== 'undefined' && isTest) { - if (window.onHotAcceptError) { - window.onHotAcceptError(error.message); - } - } - - __webpack_require__.c[moduleId].hot.accept(hotErrorHandler); - }); - - if (isHotUpdate) { - if (isReactRefreshBoundary(prevExports) && shouldInvalidateReactRefreshBoundary(prevExports, moduleExports)) { - webpackHot.invalidate(); - } else { - enqueueUpdate( - /** - * A function to dismiss the error overlay after performing React refresh. - * @returns {void} - */ - function updateCallback() { - if (typeof refreshOverlay !== 'undefined' && refreshOverlay) { - refreshOverlay.clearRuntimeErrors(); - } - }); - } - } - } else { - if (isHotUpdate && typeof prevExports !== 'undefined') { - webpackHot.invalidate(); - } - } - } -} - -module.exports = Object.freeze({ - enqueueUpdate: enqueueUpdate, - executeRuntime: executeRuntime, - getModuleExports: getModuleExports, - isReactRefreshBoundary: isReactRefreshBoundary, - shouldInvalidateReactRefreshBoundary: shouldInvalidateReactRefreshBoundary, - registerExportsForReactRefresh: registerExportsForReactRefresh -}); - -/***/ }), - -/***/ "./node_modules/ansi-html-community/index.js": -/*!***************************************************!*\ - !*** ./node_modules/ansi-html-community/index.js ***! - \***************************************************/ -/***/ ((module) => { - -"use strict"; - - -module.exports = ansiHTML; // Reference to https://github.com/sindresorhus/ansi-regex - -var _regANSI = /(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/; -var _defColors = { - reset: ['fff', '000'], - // [FOREGROUD_COLOR, BACKGROUND_COLOR] - black: '000', - red: 'ff0000', - green: '209805', - yellow: 'e8bf03', - blue: '0000ff', - magenta: 'ff00ff', - cyan: '00ffee', - lightgrey: 'f0f0f0', - darkgrey: '888' -}; -var _styles = { - 30: 'black', - 31: 'red', - 32: 'green', - 33: 'yellow', - 34: 'blue', - 35: 'magenta', - 36: 'cyan', - 37: 'lightgrey' -}; -var _openTags = { - '1': 'font-weight:bold', - // bold - '2': 'opacity:0.5', - // dim - '3': '', - // italic - '4': '', - // underscore - '8': 'display:none', - // hidden - '9': '' // delete - -}; -var _closeTags = { - '23': '', - // reset italic - '24': '', - // reset underscore - '29': '' // reset delete - -}; -[0, 21, 22, 27, 28, 39, 49].forEach(function (n) { - _closeTags[n] = ''; -}); -/** - * Converts text with ANSI color codes to HTML markup. - * @param {String} text - * @returns {*} - */ - -function ansiHTML(text) { - // Returns the text if the string has no ANSI escape code. - if (!_regANSI.test(text)) { - return text; - } // Cache opened sequence. - - - var ansiCodes = []; // Replace with markup. - - var ret = text.replace(/\033\[(\d+)m/g, function (match, seq) { - var ot = _openTags[seq]; - - if (ot) { - // If current sequence has been opened, close it. - if (!!~ansiCodes.indexOf(seq)) { - // eslint-disable-line no-extra-boolean-cast - ansiCodes.pop(); - return ''; - } // Open tag. - - - ansiCodes.push(seq); - return ot[0] === '<' ? ot : ''; - } - - var ct = _closeTags[seq]; - - if (ct) { - // Pop sequence - ansiCodes.pop(); - return ct; - } - - return ''; - }); // Make sure tags are closed. - - var l = ansiCodes.length; - l > 0 && (ret += Array(l + 1).join('')); - return ret; -} -/** - * Customize colors. - * @param {Object} colors reference to _defColors - */ - - -ansiHTML.setColors = function (colors) { - if (typeof colors !== 'object') { - throw new Error('`colors` parameter must be an Object.'); - } - - var _finalColors = {}; - - for (var key in _defColors) { - var hex = colors.hasOwnProperty(key) ? colors[key] : null; - - if (!hex) { - _finalColors[key] = _defColors[key]; - continue; - } - - if ('reset' === key) { - if (typeof hex === 'string') { - hex = [hex]; - } - - if (!Array.isArray(hex) || hex.length === 0 || hex.some(function (h) { - return typeof h !== 'string'; - })) { - throw new Error('The value of `' + key + '` property must be an Array and each item could only be a hex string, e.g.: FF0000'); - } - - var defHexColor = _defColors[key]; - - if (!hex[0]) { - hex[0] = defHexColor[0]; - } - - if (hex.length === 1 || !hex[1]) { - hex = [hex[0]]; - hex.push(defHexColor[1]); - } - - hex = hex.slice(0, 2); - } else if (typeof hex !== 'string') { - throw new Error('The value of `' + key + '` property must be a hex string, e.g.: FF0000'); - } - - _finalColors[key] = hex; - } - - _setTags(_finalColors); -}; -/** - * Reset colors. - */ - - -ansiHTML.reset = function () { - _setTags(_defColors); -}; -/** - * Expose tags, including open and close. - * @type {Object} - */ - - -ansiHTML.tags = {}; - -if (Object.defineProperty) { - Object.defineProperty(ansiHTML.tags, 'open', { - get: function () { - return _openTags; - } - }); - Object.defineProperty(ansiHTML.tags, 'close', { - get: function () { - return _closeTags; - } - }); -} else { - ansiHTML.tags.open = _openTags; - ansiHTML.tags.close = _closeTags; -} - -function _setTags(colors) { - // reset all - _openTags['0'] = 'font-weight:normal;opacity:1;color:#' + colors.reset[0] + ';background:#' + colors.reset[1]; // inverse - - _openTags['7'] = 'color:#' + colors.reset[1] + ';background:#' + colors.reset[0]; // dark grey - - _openTags['90'] = 'color:#' + colors.darkgrey; - - for (var code in _styles) { - var color = _styles[code]; - var oriColor = colors[color] || '000'; - _openTags[code] = 'color:#' + oriColor; - code = parseInt(code); - _openTags[(code + 10).toString()] = 'background:#' + oriColor; - } -} - -ansiHTML.reset(); - -/***/ }), - -/***/ "./node_modules/aria-hidden/dist/es2015/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/aria-hidden/dist/es2015/index.js ***! - \*******************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "hideOthers": () => (/* binding */ hideOthers), -/* harmony export */ "inertOthers": () => (/* binding */ inertOthers), -/* harmony export */ "supportsInert": () => (/* binding */ supportsInert), -/* harmony export */ "suppressOthers": () => (/* binding */ suppressOthers) -/* harmony export */ }); -var getDefaultParent = function (originalTarget) { - if (typeof document === 'undefined') { - return null; - } - - var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget; - return sampleTarget.ownerDocument.body; -}; - -var counterMap = new WeakMap(); -var uncontrolledNodes = new WeakMap(); -var markerMap = {}; -var lockCount = 0; -/** - * Marks everything except given node(or nodes) as aria-hidden - * @param {Element | Element[]} originalTarget - elements to keep on the page - * @param [parentNode] - top element, defaults to document.body - * @param {String} [markerName] - a special attribute to mark every node - * @param {String} [controlAttribute] - html Attribute to control - * @return {Undo} undo command - */ - -var applyAttributeToOthers = function (originalTarget, parentNode, markerName, controlAttribute) { - var targets = Array.isArray(originalTarget) ? originalTarget : [originalTarget]; - - if (!markerMap[markerName]) { - markerMap[markerName] = new WeakMap(); - } - - var markerCounter = markerMap[markerName]; - var hiddenNodes = []; - var elementsToKeep = new Set(); - var elementsToStop = new Set(targets); - - var keep = function (el) { - if (!el || elementsToKeep.has(el)) { - return; - } - - elementsToKeep.add(el); - keep(el.parentNode); - }; - - targets.forEach(keep); - - var deep = function (parent) { - if (!parent || elementsToStop.has(parent)) { - return; - } - - Array.prototype.forEach.call(parent.children, function (node) { - if (elementsToKeep.has(node)) { - deep(node); - } else { - var attr = node.getAttribute(controlAttribute); - var alreadyHidden = attr !== null && attr !== 'false'; - var counterValue = (counterMap.get(node) || 0) + 1; - var markerValue = (markerCounter.get(node) || 0) + 1; - counterMap.set(node, counterValue); - markerCounter.set(node, markerValue); - hiddenNodes.push(node); - - if (counterValue === 1 && alreadyHidden) { - uncontrolledNodes.set(node, true); - } - - if (markerValue === 1) { - node.setAttribute(markerName, 'true'); - } - - if (!alreadyHidden) { - node.setAttribute(controlAttribute, 'true'); - } - } - }); - }; - - deep(parentNode); - elementsToKeep.clear(); - lockCount++; - return function () { - hiddenNodes.forEach(function (node) { - var counterValue = counterMap.get(node) - 1; - var markerValue = markerCounter.get(node) - 1; - counterMap.set(node, counterValue); - markerCounter.set(node, markerValue); - - if (!counterValue) { - if (!uncontrolledNodes.has(node)) { - node.removeAttribute(controlAttribute); - } - - uncontrolledNodes.delete(node); - } - - if (!markerValue) { - node.removeAttribute(markerName); - } - }); - lockCount--; - - if (!lockCount) { - // clear - counterMap = new WeakMap(); - counterMap = new WeakMap(); - uncontrolledNodes = new WeakMap(); - markerMap = {}; - } - }; -}; -/** - * Marks everything except given node(or nodes) as aria-hidden - * @param {Element | Element[]} originalTarget - elements to keep on the page - * @param [parentNode] - top element, defaults to document.body - * @param {String} [markerName] - a special attribute to mark every node - * @return {Undo} undo command - */ - - -var hideOthers = function (originalTarget, parentNode, markerName) { - if (markerName === void 0) { - markerName = 'data-aria-hidden'; - } - - var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]); - var activeParentNode = parentNode || getDefaultParent(originalTarget); - - if (!activeParentNode) { - return function () { - return null; - }; - } // we should not hide ariaLive elements - https://github.com/theKashey/aria-hidden/issues/10 - - - targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll('[aria-live]'))); - return applyAttributeToOthers(targets, activeParentNode, markerName, 'aria-hidden'); -}; -/** - * Marks everything except given node(or nodes) as inert - * @param {Element | Element[]} originalTarget - elements to keep on the page - * @param [parentNode] - top element, defaults to document.body - * @param {String} [markerName] - a special attribute to mark every node - * @return {Undo} undo command - */ - -var inertOthers = function (originalTarget, parentNode, markerName) { - if (markerName === void 0) { - markerName = 'data-inert-ed'; - } - - var activeParentNode = parentNode || getDefaultParent(originalTarget); - - if (!activeParentNode) { - return function () { - return null; - }; - } - - return applyAttributeToOthers(originalTarget, activeParentNode, markerName, 'inert'); -}; -/** - * @returns if current browser supports inert - */ - -var supportsInert = function () { - return typeof HTMLElement !== 'undefined' && HTMLElement.prototype.hasOwnProperty('inert'); -}; -/** - * Automatic function to "suppress" DOM elements - _hide_ or _inert_ in the best possible way - * @param {Element | Element[]} originalTarget - elements to keep on the page - * @param [parentNode] - top element, defaults to document.body - * @param {String} [markerName] - a special attribute to mark every node - * @return {Undo} undo command - */ - -var suppressOthers = function (originalTarget, parentNode, markerName) { - if (markerName === void 0) { - markerName = 'data-suppressed'; - } - - return (supportsInert() ? inertOthers : hideOthers)(originalTarget, parentNode, markerName); -}; - -/***/ }), - -/***/ "./node_modules/classnames/index.js": -/*!******************************************!*\ - !*** ./node_modules/classnames/index.js ***! - \******************************************/ -/***/ ((module, exports) => { - -var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! - Copyright (c) 2018 Jed Watson. - Licensed under the MIT License (MIT), see - http://jedwatson.github.io/classnames -*/ - -/* global define */ -(function () { - 'use strict'; - - var hasOwn = {}.hasOwnProperty; - - function classNames() { - var classes = []; - - for (var i = 0; i < arguments.length; i++) { - var arg = arguments[i]; - if (!arg) continue; - var argType = typeof arg; - - if (argType === 'string' || argType === 'number') { - classes.push(arg); - } else if (Array.isArray(arg)) { - if (arg.length) { - var inner = classNames.apply(null, arg); - - if (inner) { - classes.push(inner); - } - } - } else if (argType === 'object') { - if (arg.toString === Object.prototype.toString) { - for (var key in arg) { - if (hasOwn.call(arg, key) && arg[key]) { - classes.push(key); - } - } - } else { - classes.push(arg.toString()); - } - } - } - - return classes.join(' '); - } - - if ( true && module.exports) { - classNames.default = classNames; - module.exports = classNames; - } else if (true) { - // register as 'classnames', consistent with npm package name - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { - return classNames; - }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else {} -})(); - -/***/ }), - -/***/ "./node_modules/core-js-pure/actual/global-this.js": -/*!*********************************************************!*\ - !*** ./node_modules/core-js-pure/actual/global-this.js ***! - \*********************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var parent = __webpack_require__(/*! ../stable/global-this */ "./node_modules/core-js-pure/stable/global-this.js"); - -module.exports = parent; - -/***/ }), - -/***/ "./node_modules/core-js-pure/es/global-this.js": -/*!*****************************************************!*\ - !*** ./node_modules/core-js-pure/es/global-this.js ***! - \*****************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -__webpack_require__(/*! ../modules/es.global-this */ "./node_modules/core-js-pure/modules/es.global-this.js"); - -module.exports = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js-pure/internals/global.js"); - -/***/ }), - -/***/ "./node_modules/core-js-pure/features/global-this.js": -/*!***********************************************************!*\ - !*** ./node_modules/core-js-pure/features/global-this.js ***! - \***********************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -module.exports = __webpack_require__(/*! ../full/global-this */ "./node_modules/core-js-pure/full/global-this.js"); - -/***/ }), - -/***/ "./node_modules/core-js-pure/full/global-this.js": -/*!*******************************************************!*\ - !*** ./node_modules/core-js-pure/full/global-this.js ***! - \*******************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -// TODO: remove from `core-js@4` -__webpack_require__(/*! ../modules/esnext.global-this */ "./node_modules/core-js-pure/modules/esnext.global-this.js"); - -var parent = __webpack_require__(/*! ../actual/global-this */ "./node_modules/core-js-pure/actual/global-this.js"); - -module.exports = parent; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/a-callable.js": -/*!***********************************************************!*\ - !*** ./node_modules/core-js-pure/internals/a-callable.js ***! - \***********************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var isCallable = __webpack_require__(/*! ../internals/is-callable */ "./node_modules/core-js-pure/internals/is-callable.js"); - -var tryToString = __webpack_require__(/*! ../internals/try-to-string */ "./node_modules/core-js-pure/internals/try-to-string.js"); - -var $TypeError = TypeError; // `Assert: IsCallable(argument) is true` - -module.exports = function (argument) { - if (isCallable(argument)) return argument; - throw $TypeError(tryToString(argument) + ' is not a function'); -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/an-object.js": -/*!**********************************************************!*\ - !*** ./node_modules/core-js-pure/internals/an-object.js ***! - \**********************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js-pure/internals/is-object.js"); - -var $String = String; -var $TypeError = TypeError; // `Assert: Type(argument) is Object` - -module.exports = function (argument) { - if (isObject(argument)) return argument; - throw $TypeError($String(argument) + ' is not an object'); -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/classof-raw.js": -/*!************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/classof-raw.js ***! - \************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ "./node_modules/core-js-pure/internals/function-uncurry-this.js"); - -var toString = uncurryThis({}.toString); -var stringSlice = uncurryThis(''.slice); - -module.exports = function (it) { - return stringSlice(toString(it), 8, -1); -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/create-non-enumerable-property.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/create-non-enumerable-property.js ***! - \*******************************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js-pure/internals/descriptors.js"); - -var definePropertyModule = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js-pure/internals/object-define-property.js"); - -var createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ "./node_modules/core-js-pure/internals/create-property-descriptor.js"); - -module.exports = DESCRIPTORS ? function (object, key, value) { - return definePropertyModule.f(object, key, createPropertyDescriptor(1, value)); -} : function (object, key, value) { - object[key] = value; - return object; -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/create-property-descriptor.js": -/*!***************************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/create-property-descriptor.js ***! - \***************************************************************************/ -/***/ ((module) => { - -module.exports = function (bitmap, value) { - return { - enumerable: !(bitmap & 1), - configurable: !(bitmap & 2), - writable: !(bitmap & 4), - value: value - }; -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/define-global-property.js": -/*!***********************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/define-global-property.js ***! - \***********************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js-pure/internals/global.js"); // eslint-disable-next-line es-x/no-object-defineproperty -- safe - - -var defineProperty = Object.defineProperty; - -module.exports = function (key, value) { - try { - defineProperty(global, key, { - value: value, - configurable: true, - writable: true - }); - } catch (error) { - global[key] = value; - } - - return value; -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/descriptors.js": -/*!************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/descriptors.js ***! - \************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js-pure/internals/fails.js"); // Detect IE8's incomplete defineProperty implementation - - -module.exports = !fails(function () { - // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing - return Object.defineProperty({}, 1, { - get: function () { - return 7; - } - })[1] != 7; -}); - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/document-create-element.js": -/*!************************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/document-create-element.js ***! - \************************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js-pure/internals/global.js"); - -var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js-pure/internals/is-object.js"); - -var document = global.document; // typeof document.createElement is 'object' in old IE - -var EXISTS = isObject(document) && isObject(document.createElement); - -module.exports = function (it) { - return EXISTS ? document.createElement(it) : {}; -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/engine-user-agent.js": -/*!******************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/engine-user-agent.js ***! - \******************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var getBuiltIn = __webpack_require__(/*! ../internals/get-built-in */ "./node_modules/core-js-pure/internals/get-built-in.js"); - -module.exports = getBuiltIn('navigator', 'userAgent') || ''; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/engine-v8-version.js": -/*!******************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/engine-v8-version.js ***! - \******************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js-pure/internals/global.js"); - -var userAgent = __webpack_require__(/*! ../internals/engine-user-agent */ "./node_modules/core-js-pure/internals/engine-user-agent.js"); - -var process = global.process; -var Deno = global.Deno; -var versions = process && process.versions || Deno && Deno.version; -var v8 = versions && versions.v8; -var match, version; - -if (v8) { - match = v8.split('.'); // in old Chrome, versions of V8 isn't V8 = Chrome / 10 - // but their correct versions are not interesting for us - - version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]); -} // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0` -// so check `userAgent` even if `.v8` exists, but 0 - - -if (!version && userAgent) { - match = userAgent.match(/Edge\/(\d+)/); - - if (!match || match[1] >= 74) { - match = userAgent.match(/Chrome\/(\d+)/); - if (match) version = +match[1]; - } -} - -module.exports = version; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/export.js": -/*!*******************************************************!*\ - !*** ./node_modules/core-js-pure/internals/export.js ***! - \*******************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js-pure/internals/global.js"); - -var apply = __webpack_require__(/*! ../internals/function-apply */ "./node_modules/core-js-pure/internals/function-apply.js"); - -var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ "./node_modules/core-js-pure/internals/function-uncurry-this.js"); - -var isCallable = __webpack_require__(/*! ../internals/is-callable */ "./node_modules/core-js-pure/internals/is-callable.js"); - -var getOwnPropertyDescriptor = (__webpack_require__(/*! ../internals/object-get-own-property-descriptor */ "./node_modules/core-js-pure/internals/object-get-own-property-descriptor.js").f); - -var isForced = __webpack_require__(/*! ../internals/is-forced */ "./node_modules/core-js-pure/internals/is-forced.js"); - -var path = __webpack_require__(/*! ../internals/path */ "./node_modules/core-js-pure/internals/path.js"); - -var bind = __webpack_require__(/*! ../internals/function-bind-context */ "./node_modules/core-js-pure/internals/function-bind-context.js"); - -var createNonEnumerableProperty = __webpack_require__(/*! ../internals/create-non-enumerable-property */ "./node_modules/core-js-pure/internals/create-non-enumerable-property.js"); - -var hasOwn = __webpack_require__(/*! ../internals/has-own-property */ "./node_modules/core-js-pure/internals/has-own-property.js"); - -var wrapConstructor = function (NativeConstructor) { - var Wrapper = function (a, b, c) { - if (this instanceof Wrapper) { - switch (arguments.length) { - case 0: - return new NativeConstructor(); - - case 1: - return new NativeConstructor(a); - - case 2: - return new NativeConstructor(a, b); - } - - return new NativeConstructor(a, b, c); - } - - return apply(NativeConstructor, this, arguments); - }; - - Wrapper.prototype = NativeConstructor.prototype; - return Wrapper; -}; -/* - options.target - name of the target object - options.global - target is the global object - options.stat - export as static methods of target - options.proto - export as prototype methods of target - options.real - real prototype method for the `pure` version - options.forced - export even if the native feature is available - options.bind - bind methods to the target, required for the `pure` version - options.wrap - wrap constructors to preventing global pollution, required for the `pure` version - options.unsafe - use the simple assignment of property instead of delete + defineProperty - options.sham - add a flag to not completely full polyfills - options.enumerable - export as enumerable property - options.dontCallGetSet - prevent calling a getter on target - options.name - the .name of the function if it does not match the key -*/ - - -module.exports = function (options, source) { - var TARGET = options.target; - var GLOBAL = options.global; - var STATIC = options.stat; - var PROTO = options.proto; - var nativeSource = GLOBAL ? global : STATIC ? global[TARGET] : (global[TARGET] || {}).prototype; - var target = GLOBAL ? path : path[TARGET] || createNonEnumerableProperty(path, TARGET, {})[TARGET]; - var targetPrototype = target.prototype; - var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE; - var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor; - - for (key in source) { - FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contains in native - - USE_NATIVE = !FORCED && nativeSource && hasOwn(nativeSource, key); - targetProperty = target[key]; - if (USE_NATIVE) if (options.dontCallGetSet) { - descriptor = getOwnPropertyDescriptor(nativeSource, key); - nativeProperty = descriptor && descriptor.value; - } else nativeProperty = nativeSource[key]; // export native or implementation - - sourceProperty = USE_NATIVE && nativeProperty ? nativeProperty : source[key]; - if (USE_NATIVE && typeof targetProperty == typeof sourceProperty) continue; // bind timers to global for call from export context - - if (options.bind && USE_NATIVE) resultProperty = bind(sourceProperty, global); // wrap global constructors for prevent changs in this version - else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty); // make static versions for prototype methods - else if (PROTO && isCallable(sourceProperty)) resultProperty = uncurryThis(sourceProperty); // default case - else resultProperty = sourceProperty; // add a flag to not completely full polyfills - - if (options.sham || sourceProperty && sourceProperty.sham || targetProperty && targetProperty.sham) { - createNonEnumerableProperty(resultProperty, 'sham', true); - } - - createNonEnumerableProperty(target, key, resultProperty); - - if (PROTO) { - VIRTUAL_PROTOTYPE = TARGET + 'Prototype'; - - if (!hasOwn(path, VIRTUAL_PROTOTYPE)) { - createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {}); - } // export virtual prototype methods - - - createNonEnumerableProperty(path[VIRTUAL_PROTOTYPE], key, sourceProperty); // export real prototype methods - - if (options.real && targetPrototype && !targetPrototype[key]) { - createNonEnumerableProperty(targetPrototype, key, sourceProperty); - } - } - } -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/fails.js": -/*!******************************************************!*\ - !*** ./node_modules/core-js-pure/internals/fails.js ***! - \******************************************************/ -/***/ ((module) => { - -module.exports = function (exec) { - try { - return !!exec(); - } catch (error) { - return true; - } -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/function-apply.js": -/*!***************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/function-apply.js ***! - \***************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var NATIVE_BIND = __webpack_require__(/*! ../internals/function-bind-native */ "./node_modules/core-js-pure/internals/function-bind-native.js"); - -var FunctionPrototype = Function.prototype; -var apply = FunctionPrototype.apply; -var call = FunctionPrototype.call; // eslint-disable-next-line es-x/no-reflect -- safe - -module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () { - return call.apply(apply, arguments); -}); - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/function-bind-context.js": -/*!**********************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/function-bind-context.js ***! - \**********************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ "./node_modules/core-js-pure/internals/function-uncurry-this.js"); - -var aCallable = __webpack_require__(/*! ../internals/a-callable */ "./node_modules/core-js-pure/internals/a-callable.js"); - -var NATIVE_BIND = __webpack_require__(/*! ../internals/function-bind-native */ "./node_modules/core-js-pure/internals/function-bind-native.js"); - -var bind = uncurryThis(uncurryThis.bind); // optional / simple context binding - -module.exports = function (fn, that) { - aCallable(fn); - return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function - /* ...args */ - () { - return fn.apply(that, arguments); - }; -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/function-bind-native.js": -/*!*********************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/function-bind-native.js ***! - \*********************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js-pure/internals/fails.js"); - -module.exports = !fails(function () { - // eslint-disable-next-line es-x/no-function-prototype-bind -- safe - var test = function () { - /* empty */ - }.bind(); // eslint-disable-next-line no-prototype-builtins -- safe - - - return typeof test != 'function' || test.hasOwnProperty('prototype'); -}); - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/function-call.js": -/*!**************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/function-call.js ***! - \**************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var NATIVE_BIND = __webpack_require__(/*! ../internals/function-bind-native */ "./node_modules/core-js-pure/internals/function-bind-native.js"); - -var call = Function.prototype.call; -module.exports = NATIVE_BIND ? call.bind(call) : function () { - return call.apply(call, arguments); -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/function-uncurry-this.js": -/*!**********************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/function-uncurry-this.js ***! - \**********************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var NATIVE_BIND = __webpack_require__(/*! ../internals/function-bind-native */ "./node_modules/core-js-pure/internals/function-bind-native.js"); - -var FunctionPrototype = Function.prototype; -var bind = FunctionPrototype.bind; -var call = FunctionPrototype.call; -var uncurryThis = NATIVE_BIND && bind.bind(call, call); -module.exports = NATIVE_BIND ? function (fn) { - return fn && uncurryThis(fn); -} : function (fn) { - return fn && function () { - return call.apply(fn, arguments); - }; -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/get-built-in.js": -/*!*************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/get-built-in.js ***! - \*************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var path = __webpack_require__(/*! ../internals/path */ "./node_modules/core-js-pure/internals/path.js"); - -var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js-pure/internals/global.js"); - -var isCallable = __webpack_require__(/*! ../internals/is-callable */ "./node_modules/core-js-pure/internals/is-callable.js"); - -var aFunction = function (variable) { - return isCallable(variable) ? variable : undefined; -}; - -module.exports = function (namespace, method) { - return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace]) : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method]; -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/get-method.js": -/*!***********************************************************!*\ - !*** ./node_modules/core-js-pure/internals/get-method.js ***! - \***********************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var aCallable = __webpack_require__(/*! ../internals/a-callable */ "./node_modules/core-js-pure/internals/a-callable.js"); - -var isNullOrUndefined = __webpack_require__(/*! ../internals/is-null-or-undefined */ "./node_modules/core-js-pure/internals/is-null-or-undefined.js"); // `GetMethod` abstract operation -// https://tc39.es/ecma262/#sec-getmethod - - -module.exports = function (V, P) { - var func = V[P]; - return isNullOrUndefined(func) ? undefined : aCallable(func); -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/global.js": -/*!*******************************************************!*\ - !*** ./node_modules/core-js-pure/internals/global.js ***! - \*******************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var check = function (it) { - return it && it.Math == Math && it; -}; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 - - -module.exports = // eslint-disable-next-line es-x/no-global-this -- safe -check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || // eslint-disable-next-line no-restricted-globals -- safe -check(typeof self == 'object' && self) || check(typeof __webpack_require__.g == 'object' && __webpack_require__.g) || // eslint-disable-next-line no-new-func -- fallback -function () { - return this; -}() || Function('return this')(); - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/has-own-property.js": -/*!*****************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/has-own-property.js ***! - \*****************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ "./node_modules/core-js-pure/internals/function-uncurry-this.js"); - -var toObject = __webpack_require__(/*! ../internals/to-object */ "./node_modules/core-js-pure/internals/to-object.js"); - -var hasOwnProperty = uncurryThis({}.hasOwnProperty); // `HasOwnProperty` abstract operation -// https://tc39.es/ecma262/#sec-hasownproperty -// eslint-disable-next-line es-x/no-object-hasown -- safe - -module.exports = Object.hasOwn || function hasOwn(it, key) { - return hasOwnProperty(toObject(it), key); -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/ie8-dom-define.js": -/*!***************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/ie8-dom-define.js ***! - \***************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js-pure/internals/descriptors.js"); - -var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js-pure/internals/fails.js"); - -var createElement = __webpack_require__(/*! ../internals/document-create-element */ "./node_modules/core-js-pure/internals/document-create-element.js"); // Thanks to IE8 for its funny defineProperty - - -module.exports = !DESCRIPTORS && !fails(function () { - // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing - return Object.defineProperty(createElement('div'), 'a', { - get: function () { - return 7; - } - }).a != 7; -}); - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/indexed-object.js": -/*!***************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/indexed-object.js ***! - \***************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ "./node_modules/core-js-pure/internals/function-uncurry-this.js"); - -var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js-pure/internals/fails.js"); - -var classof = __webpack_require__(/*! ../internals/classof-raw */ "./node_modules/core-js-pure/internals/classof-raw.js"); - -var $Object = Object; -var split = uncurryThis(''.split); // fallback for non-array-like ES3 and non-enumerable old V8 strings - -module.exports = fails(function () { - // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 - // eslint-disable-next-line no-prototype-builtins -- safe - return !$Object('z').propertyIsEnumerable(0); -}) ? function (it) { - return classof(it) == 'String' ? split(it, '') : $Object(it); -} : $Object; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/is-callable.js": -/*!************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/is-callable.js ***! - \************************************************************/ -/***/ ((module) => { - -// `IsCallable` abstract operation -// https://tc39.es/ecma262/#sec-iscallable -module.exports = function (argument) { - return typeof argument == 'function'; -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/is-forced.js": -/*!**********************************************************!*\ - !*** ./node_modules/core-js-pure/internals/is-forced.js ***! - \**********************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js-pure/internals/fails.js"); - -var isCallable = __webpack_require__(/*! ../internals/is-callable */ "./node_modules/core-js-pure/internals/is-callable.js"); - -var replacement = /#|\.prototype\./; - -var isForced = function (feature, detection) { - var value = data[normalize(feature)]; - return value == POLYFILL ? true : value == NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection; -}; - -var normalize = isForced.normalize = function (string) { - return String(string).replace(replacement, '.').toLowerCase(); -}; - -var data = isForced.data = {}; -var NATIVE = isForced.NATIVE = 'N'; -var POLYFILL = isForced.POLYFILL = 'P'; -module.exports = isForced; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/is-null-or-undefined.js": -/*!*********************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/is-null-or-undefined.js ***! - \*********************************************************************/ -/***/ ((module) => { - -// we can't use just `it == null` since of `document.all` special case -// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec -module.exports = function (it) { - return it === null || it === undefined; -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/is-object.js": -/*!**********************************************************!*\ - !*** ./node_modules/core-js-pure/internals/is-object.js ***! - \**********************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var isCallable = __webpack_require__(/*! ../internals/is-callable */ "./node_modules/core-js-pure/internals/is-callable.js"); - -var documentAll = typeof document == 'object' && document.all; // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot - -var SPECIAL_DOCUMENT_ALL = typeof documentAll == 'undefined' && documentAll !== undefined; -module.exports = SPECIAL_DOCUMENT_ALL ? function (it) { - return typeof it == 'object' ? it !== null : isCallable(it) || it === documentAll; -} : function (it) { - return typeof it == 'object' ? it !== null : isCallable(it); -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/is-pure.js": -/*!********************************************************!*\ - !*** ./node_modules/core-js-pure/internals/is-pure.js ***! - \********************************************************/ -/***/ ((module) => { - -module.exports = true; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/is-symbol.js": -/*!**********************************************************!*\ - !*** ./node_modules/core-js-pure/internals/is-symbol.js ***! - \**********************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var getBuiltIn = __webpack_require__(/*! ../internals/get-built-in */ "./node_modules/core-js-pure/internals/get-built-in.js"); - -var isCallable = __webpack_require__(/*! ../internals/is-callable */ "./node_modules/core-js-pure/internals/is-callable.js"); - -var isPrototypeOf = __webpack_require__(/*! ../internals/object-is-prototype-of */ "./node_modules/core-js-pure/internals/object-is-prototype-of.js"); - -var USE_SYMBOL_AS_UID = __webpack_require__(/*! ../internals/use-symbol-as-uid */ "./node_modules/core-js-pure/internals/use-symbol-as-uid.js"); - -var $Object = Object; -module.exports = USE_SYMBOL_AS_UID ? function (it) { - return typeof it == 'symbol'; -} : function (it) { - var $Symbol = getBuiltIn('Symbol'); - return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it)); -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/object-define-property.js": -/*!***********************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/object-define-property.js ***! - \***********************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js-pure/internals/descriptors.js"); - -var IE8_DOM_DEFINE = __webpack_require__(/*! ../internals/ie8-dom-define */ "./node_modules/core-js-pure/internals/ie8-dom-define.js"); - -var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(/*! ../internals/v8-prototype-define-bug */ "./node_modules/core-js-pure/internals/v8-prototype-define-bug.js"); - -var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js-pure/internals/an-object.js"); - -var toPropertyKey = __webpack_require__(/*! ../internals/to-property-key */ "./node_modules/core-js-pure/internals/to-property-key.js"); - -var $TypeError = TypeError; // eslint-disable-next-line es-x/no-object-defineproperty -- safe - -var $defineProperty = Object.defineProperty; // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe - -var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; -var ENUMERABLE = 'enumerable'; -var CONFIGURABLE = 'configurable'; -var WRITABLE = 'writable'; // `Object.defineProperty` method -// https://tc39.es/ecma262/#sec-object.defineproperty - -exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) { - anObject(O); - P = toPropertyKey(P); - anObject(Attributes); - - if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) { - var current = $getOwnPropertyDescriptor(O, P); - - if (current && current[WRITABLE]) { - O[P] = Attributes.value; - Attributes = { - configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE], - enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE], - writable: false - }; - } - } - - return $defineProperty(O, P, Attributes); -} : $defineProperty : function defineProperty(O, P, Attributes) { - anObject(O); - P = toPropertyKey(P); - anObject(Attributes); - if (IE8_DOM_DEFINE) try { - return $defineProperty(O, P, Attributes); - } catch (error) { - /* empty */ - } - if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported'); - if ('value' in Attributes) O[P] = Attributes.value; - return O; -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/object-get-own-property-descriptor.js": -/*!***********************************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/object-get-own-property-descriptor.js ***! - \***********************************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js-pure/internals/descriptors.js"); - -var call = __webpack_require__(/*! ../internals/function-call */ "./node_modules/core-js-pure/internals/function-call.js"); - -var propertyIsEnumerableModule = __webpack_require__(/*! ../internals/object-property-is-enumerable */ "./node_modules/core-js-pure/internals/object-property-is-enumerable.js"); - -var createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ "./node_modules/core-js-pure/internals/create-property-descriptor.js"); - -var toIndexedObject = __webpack_require__(/*! ../internals/to-indexed-object */ "./node_modules/core-js-pure/internals/to-indexed-object.js"); - -var toPropertyKey = __webpack_require__(/*! ../internals/to-property-key */ "./node_modules/core-js-pure/internals/to-property-key.js"); - -var hasOwn = __webpack_require__(/*! ../internals/has-own-property */ "./node_modules/core-js-pure/internals/has-own-property.js"); - -var IE8_DOM_DEFINE = __webpack_require__(/*! ../internals/ie8-dom-define */ "./node_modules/core-js-pure/internals/ie8-dom-define.js"); // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe - - -var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method -// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor - -exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { - O = toIndexedObject(O); - P = toPropertyKey(P); - if (IE8_DOM_DEFINE) try { - return $getOwnPropertyDescriptor(O, P); - } catch (error) { - /* empty */ - } - if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]); -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/object-is-prototype-of.js": -/*!***********************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/object-is-prototype-of.js ***! - \***********************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ "./node_modules/core-js-pure/internals/function-uncurry-this.js"); - -module.exports = uncurryThis({}.isPrototypeOf); - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/object-property-is-enumerable.js": -/*!******************************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/object-property-is-enumerable.js ***! - \******************************************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - - -var $propertyIsEnumerable = {}.propertyIsEnumerable; // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe - -var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug - -var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ - 1: 2 -}, 1); // `Object.prototype.propertyIsEnumerable` method implementation -// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable - -exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) { - var descriptor = getOwnPropertyDescriptor(this, V); - return !!descriptor && descriptor.enumerable; -} : $propertyIsEnumerable; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/ordinary-to-primitive.js": -/*!**********************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/ordinary-to-primitive.js ***! - \**********************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var call = __webpack_require__(/*! ../internals/function-call */ "./node_modules/core-js-pure/internals/function-call.js"); - -var isCallable = __webpack_require__(/*! ../internals/is-callable */ "./node_modules/core-js-pure/internals/is-callable.js"); - -var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js-pure/internals/is-object.js"); - -var $TypeError = TypeError; // `OrdinaryToPrimitive` abstract operation -// https://tc39.es/ecma262/#sec-ordinarytoprimitive - -module.exports = function (input, pref) { - var fn, val; - if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val; - if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val; - if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val; - throw $TypeError("Can't convert object to primitive value"); -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/path.js": -/*!*****************************************************!*\ - !*** ./node_modules/core-js-pure/internals/path.js ***! - \*****************************************************/ -/***/ ((module) => { - -module.exports = {}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/require-object-coercible.js": -/*!*************************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/require-object-coercible.js ***! - \*************************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var isNullOrUndefined = __webpack_require__(/*! ../internals/is-null-or-undefined */ "./node_modules/core-js-pure/internals/is-null-or-undefined.js"); - -var $TypeError = TypeError; // `RequireObjectCoercible` abstract operation -// https://tc39.es/ecma262/#sec-requireobjectcoercible - -module.exports = function (it) { - if (isNullOrUndefined(it)) throw $TypeError("Can't call method on " + it); - return it; -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/shared-store.js": -/*!*************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/shared-store.js ***! - \*************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js-pure/internals/global.js"); - -var defineGlobalProperty = __webpack_require__(/*! ../internals/define-global-property */ "./node_modules/core-js-pure/internals/define-global-property.js"); - -var SHARED = '__core-js_shared__'; -var store = global[SHARED] || defineGlobalProperty(SHARED, {}); -module.exports = store; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/shared.js": -/*!*******************************************************!*\ - !*** ./node_modules/core-js-pure/internals/shared.js ***! - \*******************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var IS_PURE = __webpack_require__(/*! ../internals/is-pure */ "./node_modules/core-js-pure/internals/is-pure.js"); - -var store = __webpack_require__(/*! ../internals/shared-store */ "./node_modules/core-js-pure/internals/shared-store.js"); - -(module.exports = function (key, value) { - return store[key] || (store[key] = value !== undefined ? value : {}); -})('versions', []).push({ - version: '3.25.0', - mode: IS_PURE ? 'pure' : 'global', - copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)', - license: 'https://github.com/zloirock/core-js/blob/v3.25.0/LICENSE', - source: 'https://github.com/zloirock/core-js' -}); - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/symbol-constructor-detection.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/symbol-constructor-detection.js ***! - \*****************************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* eslint-disable es-x/no-symbol -- required for testing */ -var V8_VERSION = __webpack_require__(/*! ../internals/engine-v8-version */ "./node_modules/core-js-pure/internals/engine-v8-version.js"); - -var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js-pure/internals/fails.js"); // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing - - -module.exports = !!Object.getOwnPropertySymbols && !fails(function () { - var symbol = Symbol(); // Chrome 38 Symbol has incorrect toString conversion - // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances - - return !String(symbol) || !(Object(symbol) instanceof Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances - !Symbol.sham && V8_VERSION && V8_VERSION < 41; -}); - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/to-indexed-object.js": -/*!******************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/to-indexed-object.js ***! - \******************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -// toObject with fallback for non-array-like ES3 strings -var IndexedObject = __webpack_require__(/*! ../internals/indexed-object */ "./node_modules/core-js-pure/internals/indexed-object.js"); - -var requireObjectCoercible = __webpack_require__(/*! ../internals/require-object-coercible */ "./node_modules/core-js-pure/internals/require-object-coercible.js"); - -module.exports = function (it) { - return IndexedObject(requireObjectCoercible(it)); -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/to-object.js": -/*!**********************************************************!*\ - !*** ./node_modules/core-js-pure/internals/to-object.js ***! - \**********************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var requireObjectCoercible = __webpack_require__(/*! ../internals/require-object-coercible */ "./node_modules/core-js-pure/internals/require-object-coercible.js"); - -var $Object = Object; // `ToObject` abstract operation -// https://tc39.es/ecma262/#sec-toobject - -module.exports = function (argument) { - return $Object(requireObjectCoercible(argument)); -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/to-primitive.js": -/*!*************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/to-primitive.js ***! - \*************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var call = __webpack_require__(/*! ../internals/function-call */ "./node_modules/core-js-pure/internals/function-call.js"); - -var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js-pure/internals/is-object.js"); - -var isSymbol = __webpack_require__(/*! ../internals/is-symbol */ "./node_modules/core-js-pure/internals/is-symbol.js"); - -var getMethod = __webpack_require__(/*! ../internals/get-method */ "./node_modules/core-js-pure/internals/get-method.js"); - -var ordinaryToPrimitive = __webpack_require__(/*! ../internals/ordinary-to-primitive */ "./node_modules/core-js-pure/internals/ordinary-to-primitive.js"); - -var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js-pure/internals/well-known-symbol.js"); - -var $TypeError = TypeError; -var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); // `ToPrimitive` abstract operation -// https://tc39.es/ecma262/#sec-toprimitive - -module.exports = function (input, pref) { - if (!isObject(input) || isSymbol(input)) return input; - var exoticToPrim = getMethod(input, TO_PRIMITIVE); - var result; - - if (exoticToPrim) { - if (pref === undefined) pref = 'default'; - result = call(exoticToPrim, input, pref); - if (!isObject(result) || isSymbol(result)) return result; - throw $TypeError("Can't convert object to primitive value"); - } - - if (pref === undefined) pref = 'number'; - return ordinaryToPrimitive(input, pref); -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/to-property-key.js": -/*!****************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/to-property-key.js ***! - \****************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var toPrimitive = __webpack_require__(/*! ../internals/to-primitive */ "./node_modules/core-js-pure/internals/to-primitive.js"); - -var isSymbol = __webpack_require__(/*! ../internals/is-symbol */ "./node_modules/core-js-pure/internals/is-symbol.js"); // `ToPropertyKey` abstract operation -// https://tc39.es/ecma262/#sec-topropertykey - - -module.exports = function (argument) { - var key = toPrimitive(argument, 'string'); - return isSymbol(key) ? key : key + ''; -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/try-to-string.js": -/*!**************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/try-to-string.js ***! - \**************************************************************/ -/***/ ((module) => { - -var $String = String; - -module.exports = function (argument) { - try { - return $String(argument); - } catch (error) { - return 'Object'; - } -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/uid.js": -/*!****************************************************!*\ - !*** ./node_modules/core-js-pure/internals/uid.js ***! - \****************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var uncurryThis = __webpack_require__(/*! ../internals/function-uncurry-this */ "./node_modules/core-js-pure/internals/function-uncurry-this.js"); - -var id = 0; -var postfix = Math.random(); -var toString = uncurryThis(1.0.toString); - -module.exports = function (key) { - return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36); -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/use-symbol-as-uid.js": -/*!******************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/use-symbol-as-uid.js ***! - \******************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* eslint-disable es-x/no-symbol -- required for testing */ -var NATIVE_SYMBOL = __webpack_require__(/*! ../internals/symbol-constructor-detection */ "./node_modules/core-js-pure/internals/symbol-constructor-detection.js"); - -module.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == 'symbol'; - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/v8-prototype-define-bug.js": -/*!************************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/v8-prototype-define-bug.js ***! - \************************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js-pure/internals/descriptors.js"); - -var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js-pure/internals/fails.js"); // V8 ~ Chrome 36- -// https://bugs.chromium.org/p/v8/issues/detail?id=3334 - - -module.exports = DESCRIPTORS && fails(function () { - // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing - return Object.defineProperty(function () { - /* empty */ - }, 'prototype', { - value: 42, - writable: false - }).prototype != 42; -}); - -/***/ }), - -/***/ "./node_modules/core-js-pure/internals/well-known-symbol.js": -/*!******************************************************************!*\ - !*** ./node_modules/core-js-pure/internals/well-known-symbol.js ***! - \******************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js-pure/internals/global.js"); - -var shared = __webpack_require__(/*! ../internals/shared */ "./node_modules/core-js-pure/internals/shared.js"); - -var hasOwn = __webpack_require__(/*! ../internals/has-own-property */ "./node_modules/core-js-pure/internals/has-own-property.js"); - -var uid = __webpack_require__(/*! ../internals/uid */ "./node_modules/core-js-pure/internals/uid.js"); - -var NATIVE_SYMBOL = __webpack_require__(/*! ../internals/symbol-constructor-detection */ "./node_modules/core-js-pure/internals/symbol-constructor-detection.js"); - -var USE_SYMBOL_AS_UID = __webpack_require__(/*! ../internals/use-symbol-as-uid */ "./node_modules/core-js-pure/internals/use-symbol-as-uid.js"); - -var WellKnownSymbolsStore = shared('wks'); -var Symbol = global.Symbol; -var symbolFor = Symbol && Symbol['for']; -var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid; - -module.exports = function (name) { - if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) { - var description = 'Symbol.' + name; - - if (NATIVE_SYMBOL && hasOwn(Symbol, name)) { - WellKnownSymbolsStore[name] = Symbol[name]; - } else if (USE_SYMBOL_AS_UID && symbolFor) { - WellKnownSymbolsStore[name] = symbolFor(description); - } else { - WellKnownSymbolsStore[name] = createWellKnownSymbol(description); - } - } - - return WellKnownSymbolsStore[name]; -}; - -/***/ }), - -/***/ "./node_modules/core-js-pure/modules/es.global-this.js": -/*!*************************************************************!*\ - !*** ./node_modules/core-js-pure/modules/es.global-this.js ***! - \*************************************************************/ -/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - -var $ = __webpack_require__(/*! ../internals/export */ "./node_modules/core-js-pure/internals/export.js"); - -var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js-pure/internals/global.js"); // `globalThis` object -// https://tc39.es/ecma262/#sec-globalthis - - -$({ - global: true -}, { - globalThis: global -}); - -/***/ }), - -/***/ "./node_modules/core-js-pure/modules/esnext.global-this.js": -/*!*****************************************************************!*\ - !*** ./node_modules/core-js-pure/modules/esnext.global-this.js ***! - \*****************************************************************/ -/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - -// TODO: Remove from `core-js@4` -__webpack_require__(/*! ../modules/es.global-this */ "./node_modules/core-js-pure/modules/es.global-this.js"); - -/***/ }), - -/***/ "./node_modules/core-js-pure/stable/global-this.js": -/*!*********************************************************!*\ - !*** ./node_modules/core-js-pure/stable/global-this.js ***! - \*********************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var parent = __webpack_require__(/*! ../es/global-this */ "./node_modules/core-js-pure/es/global-this.js"); - -module.exports = parent; - -/***/ }), - -/***/ "./node_modules/css-loader/dist/runtime/api.js": -/*!*****************************************************!*\ - !*** ./node_modules/css-loader/dist/runtime/api.js ***! - \*****************************************************/ -/***/ ((module) => { - -"use strict"; - -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - -module.exports = function (cssWithMappingToString) { - var list = []; // return the list of modules as css string - - list.toString = function toString() { - return this.map(function (item) { - var content = ""; - var needLayer = typeof item[5] !== "undefined"; - - if (item[4]) { - content += "@supports (".concat(item[4], ") {"); - } - - if (item[2]) { - content += "@media ".concat(item[2], " {"); - } - - if (needLayer) { - content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {"); - } - - content += cssWithMappingToString(item); - - if (needLayer) { - content += "}"; - } - - if (item[2]) { - content += "}"; - } - - if (item[4]) { - content += "}"; - } - - return content; - }).join(""); - }; // import a list of modules into the list - - - list.i = function i(modules, media, dedupe, supports, layer) { - if (typeof modules === "string") { - modules = [[null, modules, undefined]]; - } - - var alreadyImportedModules = {}; - - if (dedupe) { - for (var k = 0; k < this.length; k++) { - var id = this[k][0]; - - if (id != null) { - alreadyImportedModules[id] = true; - } - } - } - - for (var _k = 0; _k < modules.length; _k++) { - var item = [].concat(modules[_k]); - - if (dedupe && alreadyImportedModules[item[0]]) { - continue; - } - - if (typeof layer !== "undefined") { - if (typeof item[5] === "undefined") { - item[5] = layer; - } else { - item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}"); - item[5] = layer; - } - } - - if (media) { - if (!item[2]) { - item[2] = media; - } else { - item[1] = "@media ".concat(item[2], " {").concat(item[1], "}"); - item[2] = media; - } - } - - if (supports) { - if (!item[4]) { - item[4] = "".concat(supports); - } else { - item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}"); - item[4] = supports; - } - } - - list.push(item); - } - }; - - return list; -}; - -/***/ }), - -/***/ "./node_modules/css-loader/dist/runtime/getUrl.js": -/*!********************************************************!*\ - !*** ./node_modules/css-loader/dist/runtime/getUrl.js ***! - \********************************************************/ -/***/ ((module) => { - -"use strict"; - - -module.exports = function (url, options) { - if (!options) { - options = {}; - } - - if (!url) { - return url; - } - - url = String(url.__esModule ? url.default : url); // If url is already wrapped in quotes, remove them - - if (/^['"].*['"]$/.test(url)) { - url = url.slice(1, -1); - } - - if (options.hash) { - url += options.hash; - } // Should url be wrapped? - // See https://drafts.csswg.org/css-values-3/#urls - - - if (/["'() \t\n]|(%20)/.test(url) || options.needQuotes) { - return "\"".concat(url.replace(/"/g, '\\"').replace(/\n/g, "\\n"), "\""); - } - - return url; -}; - -/***/ }), - -/***/ "./node_modules/css-loader/dist/runtime/sourceMaps.js": -/*!************************************************************!*\ - !*** ./node_modules/css-loader/dist/runtime/sourceMaps.js ***! - \************************************************************/ -/***/ ((module) => { - -"use strict"; - - -module.exports = function (item) { - var content = item[1]; - var cssMapping = item[3]; - - if (!cssMapping) { - return content; - } - - if (typeof btoa === "function") { - var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping)))); - var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64); - var sourceMapping = "/*# ".concat(data, " */"); - var sourceURLs = cssMapping.sources.map(function (source) { - return "/*# sourceURL=".concat(cssMapping.sourceRoot || "").concat(source, " */"); - }); - return [content].concat(sourceURLs).concat([sourceMapping]).join("\n"); - } - - return [content].join("\n"); -}; - -/***/ }), - -/***/ "./node_modules/events/events.js": -/*!***************************************!*\ - !*** ./node_modules/events/events.js ***! - \***************************************/ -/***/ ((module) => { - -"use strict"; -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - - -var R = typeof Reflect === 'object' ? Reflect : null; -var ReflectApply = R && typeof R.apply === 'function' ? R.apply : function ReflectApply(target, receiver, args) { - return Function.prototype.apply.call(target, receiver, args); -}; -var ReflectOwnKeys; - -if (R && typeof R.ownKeys === 'function') { - ReflectOwnKeys = R.ownKeys; -} else if (Object.getOwnPropertySymbols) { - ReflectOwnKeys = function ReflectOwnKeys(target) { - return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target)); - }; -} else { - ReflectOwnKeys = function ReflectOwnKeys(target) { - return Object.getOwnPropertyNames(target); - }; -} - -function ProcessEmitWarning(warning) { - if (console && console.warn) console.warn(warning); -} - -var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { - return value !== value; -}; - -function EventEmitter() { - EventEmitter.init.call(this); -} - -module.exports = EventEmitter; -module.exports.once = once; // Backwards-compat with node 0.10.x - -EventEmitter.EventEmitter = EventEmitter; -EventEmitter.prototype._events = undefined; -EventEmitter.prototype._eventsCount = 0; -EventEmitter.prototype._maxListeners = undefined; // By default EventEmitters will print a warning if more than 10 listeners are -// added to it. This is a useful default which helps finding memory leaks. - -var defaultMaxListeners = 10; - -function checkListener(listener) { - if (typeof listener !== 'function') { - throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); - } -} - -Object.defineProperty(EventEmitter, 'defaultMaxListeners', { - enumerable: true, - get: function () { - return defaultMaxListeners; - }, - set: function (arg) { - if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { - throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); - } - - defaultMaxListeners = arg; - } -}); - -EventEmitter.init = function () { - if (this._events === undefined || this._events === Object.getPrototypeOf(this)._events) { - this._events = Object.create(null); - this._eventsCount = 0; - } - - this._maxListeners = this._maxListeners || undefined; -}; // Obviously not all Emitters should be limited to 10. This function allows -// that to be increased. Set to zero for unlimited. - - -EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { - if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { - throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); - } - - this._maxListeners = n; - return this; -}; - -function _getMaxListeners(that) { - if (that._maxListeners === undefined) return EventEmitter.defaultMaxListeners; - return that._maxListeners; -} - -EventEmitter.prototype.getMaxListeners = function getMaxListeners() { - return _getMaxListeners(this); -}; - -EventEmitter.prototype.emit = function emit(type) { - var args = []; - - for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); - - var doError = type === 'error'; - var events = this._events; - if (events !== undefined) doError = doError && events.error === undefined;else if (!doError) return false; // If there is no 'error' event listener then throw. - - if (doError) { - var er; - if (args.length > 0) er = args[0]; - - if (er instanceof Error) { - // Note: The comments on the `throw` lines are intentional, they show - // up in Node's output if this results in an unhandled exception. - throw er; // Unhandled 'error' event - } // At least give some kind of context to the user - - - var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); - err.context = er; - throw err; // Unhandled 'error' event - } - - var handler = events[type]; - if (handler === undefined) return false; - - if (typeof handler === 'function') { - ReflectApply(handler, this, args); - } else { - var len = handler.length; - var listeners = arrayClone(handler, len); - - for (var i = 0; i < len; ++i) ReflectApply(listeners[i], this, args); - } - - return true; -}; - -function _addListener(target, type, listener, prepend) { - var m; - var events; - var existing; - checkListener(listener); - events = target._events; - - if (events === undefined) { - events = target._events = Object.create(null); - target._eventsCount = 0; - } else { - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (events.newListener !== undefined) { - target.emit('newListener', type, listener.listener ? listener.listener : listener); // Re-assign `events` because a newListener handler could have caused the - // this._events to be assigned to a new object - - events = target._events; - } - - existing = events[type]; - } - - if (existing === undefined) { - // Optimize the case of one listener. Don't need the extra array object. - existing = events[type] = listener; - ++target._eventsCount; - } else { - if (typeof existing === 'function') { - // Adding the second element, need to change to array. - existing = events[type] = prepend ? [listener, existing] : [existing, listener]; // If we've already got an array, just append. - } else if (prepend) { - existing.unshift(listener); - } else { - existing.push(listener); - } // Check for listener leak - - - m = _getMaxListeners(target); - - if (m > 0 && existing.length > m && !existing.warned) { - existing.warned = true; // No error code for this since it is a Warning - // eslint-disable-next-line no-restricted-syntax - - var w = new Error('Possible EventEmitter memory leak detected. ' + existing.length + ' ' + String(type) + ' listeners ' + 'added. Use emitter.setMaxListeners() to ' + 'increase limit'); - w.name = 'MaxListenersExceededWarning'; - w.emitter = target; - w.type = type; - w.count = existing.length; - ProcessEmitWarning(w); - } - } - - return target; -} - -EventEmitter.prototype.addListener = function addListener(type, listener) { - return _addListener(this, type, listener, false); -}; - -EventEmitter.prototype.on = EventEmitter.prototype.addListener; - -EventEmitter.prototype.prependListener = function prependListener(type, listener) { - return _addListener(this, type, listener, true); -}; - -function onceWrapper() { - if (!this.fired) { - this.target.removeListener(this.type, this.wrapFn); - this.fired = true; - if (arguments.length === 0) return this.listener.call(this.target); - return this.listener.apply(this.target, arguments); - } -} - -function _onceWrap(target, type, listener) { - var state = { - fired: false, - wrapFn: undefined, - target: target, - type: type, - listener: listener - }; - var wrapped = onceWrapper.bind(state); - wrapped.listener = listener; - state.wrapFn = wrapped; - return wrapped; -} - -EventEmitter.prototype.once = function once(type, listener) { - checkListener(listener); - this.on(type, _onceWrap(this, type, listener)); - return this; -}; - -EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { - checkListener(listener); - this.prependListener(type, _onceWrap(this, type, listener)); - return this; -}; // Emits a 'removeListener' event if and only if the listener was removed. - - -EventEmitter.prototype.removeListener = function removeListener(type, listener) { - var list, events, position, i, originalListener; - checkListener(listener); - events = this._events; - if (events === undefined) return this; - list = events[type]; - if (list === undefined) return this; - - if (list === listener || list.listener === listener) { - if (--this._eventsCount === 0) this._events = Object.create(null);else { - delete events[type]; - if (events.removeListener) this.emit('removeListener', type, list.listener || listener); - } - } else if (typeof list !== 'function') { - position = -1; - - for (i = list.length - 1; i >= 0; i--) { - if (list[i] === listener || list[i].listener === listener) { - originalListener = list[i].listener; - position = i; - break; - } - } - - if (position < 0) return this; - if (position === 0) list.shift();else { - spliceOne(list, position); - } - if (list.length === 1) events[type] = list[0]; - if (events.removeListener !== undefined) this.emit('removeListener', type, originalListener || listener); - } - - return this; -}; - -EventEmitter.prototype.off = EventEmitter.prototype.removeListener; - -EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) { - var listeners, events, i; - events = this._events; - if (events === undefined) return this; // not listening for removeListener, no need to emit - - if (events.removeListener === undefined) { - if (arguments.length === 0) { - this._events = Object.create(null); - this._eventsCount = 0; - } else if (events[type] !== undefined) { - if (--this._eventsCount === 0) this._events = Object.create(null);else delete events[type]; - } - - return this; - } // emit removeListener for all listeners on all events - - - if (arguments.length === 0) { - var keys = Object.keys(events); - var key; - - for (i = 0; i < keys.length; ++i) { - key = keys[i]; - if (key === 'removeListener') continue; - this.removeAllListeners(key); - } - - this.removeAllListeners('removeListener'); - this._events = Object.create(null); - this._eventsCount = 0; - return this; - } - - listeners = events[type]; - - if (typeof listeners === 'function') { - this.removeListener(type, listeners); - } else if (listeners !== undefined) { - // LIFO order - for (i = listeners.length - 1; i >= 0; i--) { - this.removeListener(type, listeners[i]); - } - } - - return this; -}; - -function _listeners(target, type, unwrap) { - var events = target._events; - if (events === undefined) return []; - var evlistener = events[type]; - if (evlistener === undefined) return []; - if (typeof evlistener === 'function') return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); -} - -EventEmitter.prototype.listeners = function listeners(type) { - return _listeners(this, type, true); -}; - -EventEmitter.prototype.rawListeners = function rawListeners(type) { - return _listeners(this, type, false); -}; - -EventEmitter.listenerCount = function (emitter, type) { - if (typeof emitter.listenerCount === 'function') { - return emitter.listenerCount(type); - } else { - return listenerCount.call(emitter, type); - } -}; - -EventEmitter.prototype.listenerCount = listenerCount; - -function listenerCount(type) { - var events = this._events; - - if (events !== undefined) { - var evlistener = events[type]; - - if (typeof evlistener === 'function') { - return 1; - } else if (evlistener !== undefined) { - return evlistener.length; - } - } - - return 0; -} - -EventEmitter.prototype.eventNames = function eventNames() { - return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; -}; - -function arrayClone(arr, n) { - var copy = new Array(n); - - for (var i = 0; i < n; ++i) copy[i] = arr[i]; - - return copy; -} - -function spliceOne(list, index) { - for (; index + 1 < list.length; index++) list[index] = list[index + 1]; - - list.pop(); -} - -function unwrapListeners(arr) { - var ret = new Array(arr.length); - - for (var i = 0; i < ret.length; ++i) { - ret[i] = arr[i].listener || arr[i]; - } - - return ret; -} - -function once(emitter, name) { - return new Promise(function (resolve, reject) { - function errorListener(err) { - emitter.removeListener(name, resolver); - reject(err); - } - - function resolver() { - if (typeof emitter.removeListener === 'function') { - emitter.removeListener('error', errorListener); - } - - resolve([].slice.call(arguments)); - } - - ; - eventTargetAgnosticAddListener(emitter, name, resolver, { - once: true - }); - - if (name !== 'error') { - addErrorHandlerIfEventEmitter(emitter, errorListener, { - once: true - }); - } - }); -} - -function addErrorHandlerIfEventEmitter(emitter, handler, flags) { - if (typeof emitter.on === 'function') { - eventTargetAgnosticAddListener(emitter, 'error', handler, flags); - } -} - -function eventTargetAgnosticAddListener(emitter, name, listener, flags) { - if (typeof emitter.on === 'function') { - if (flags.once) { - emitter.once(name, listener); - } else { - emitter.on(name, listener); - } - } else if (typeof emitter.addEventListener === 'function') { - // EventTarget does not have `error` event semantics like Node - // EventEmitters, we do not listen for `error` events here. - emitter.addEventListener(name, function wrapListener(arg) { - // IE does not have builtin `{ once: true }` support so we - // have to do it manually. - if (flags.once) { - emitter.removeEventListener(name, wrapListener); - } - - listener(arg); - }); - } else { - throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); - } -} - -/***/ }), - -/***/ "./node_modules/firebase/app/dist/index.esm.js": -/*!*****************************************************!*\ - !*** ./node_modules/firebase/app/dist/index.esm.js ***! - \*****************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "FirebaseError": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.FirebaseError), -/* harmony export */ "SDK_VERSION": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.SDK_VERSION), -/* harmony export */ "_DEFAULT_ENTRY_NAME": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._DEFAULT_ENTRY_NAME), -/* harmony export */ "_addComponent": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._addComponent), -/* harmony export */ "_addOrOverwriteComponent": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._addOrOverwriteComponent), -/* harmony export */ "_apps": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._apps), -/* harmony export */ "_clearComponents": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._clearComponents), -/* harmony export */ "_components": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._components), -/* harmony export */ "_getProvider": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._getProvider), -/* harmony export */ "_registerComponent": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._registerComponent), -/* harmony export */ "_removeServiceInstance": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._removeServiceInstance), -/* harmony export */ "deleteApp": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.deleteApp), -/* harmony export */ "getApp": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.getApp), -/* harmony export */ "getApps": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.getApps), -/* harmony export */ "initializeApp": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.initializeApp), -/* harmony export */ "onLog": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.onLog), -/* harmony export */ "registerVersion": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.registerVersion), -/* harmony export */ "setLogLevel": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.setLogLevel) -/* harmony export */ }); -/* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/esm/index.esm2017.js"); - - -var name = "firebase"; -var version = "9.9.4"; -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -(0,_firebase_app__WEBPACK_IMPORTED_MODULE_0__.registerVersion)(name, version, 'app'); - -/***/ }), - -/***/ "./node_modules/firebase/auth/dist/index.esm.js": -/*!******************************************************!*\ - !*** ./node_modules/firebase/auth/dist/index.esm.js ***! - \******************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ActionCodeOperation": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.ActionCodeOperation), -/* harmony export */ "ActionCodeURL": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.ActionCodeURL), -/* harmony export */ "AuthCredential": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.AuthCredential), -/* harmony export */ "AuthErrorCodes": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.AuthErrorCodes), -/* harmony export */ "EmailAuthCredential": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.EmailAuthCredential), -/* harmony export */ "EmailAuthProvider": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.EmailAuthProvider), -/* harmony export */ "FacebookAuthProvider": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.FacebookAuthProvider), -/* harmony export */ "FactorId": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.FactorId), -/* harmony export */ "GithubAuthProvider": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.GithubAuthProvider), -/* harmony export */ "GoogleAuthProvider": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.GoogleAuthProvider), -/* harmony export */ "OAuthCredential": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.OAuthCredential), -/* harmony export */ "OAuthProvider": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.OAuthProvider), -/* harmony export */ "OperationType": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.OperationType), -/* harmony export */ "PhoneAuthCredential": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.PhoneAuthCredential), -/* harmony export */ "PhoneAuthProvider": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.PhoneAuthProvider), -/* harmony export */ "PhoneMultiFactorGenerator": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.PhoneMultiFactorGenerator), -/* harmony export */ "ProviderId": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.ProviderId), -/* harmony export */ "RecaptchaVerifier": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.RecaptchaVerifier), -/* harmony export */ "SAMLAuthProvider": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.SAMLAuthProvider), -/* harmony export */ "SignInMethod": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.SignInMethod), -/* harmony export */ "TwitterAuthProvider": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.TwitterAuthProvider), -/* harmony export */ "applyActionCode": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.applyActionCode), -/* harmony export */ "beforeAuthStateChanged": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.beforeAuthStateChanged), -/* harmony export */ "browserLocalPersistence": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.browserLocalPersistence), -/* harmony export */ "browserPopupRedirectResolver": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.browserPopupRedirectResolver), -/* harmony export */ "browserSessionPersistence": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.browserSessionPersistence), -/* harmony export */ "checkActionCode": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.checkActionCode), -/* harmony export */ "confirmPasswordReset": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.confirmPasswordReset), -/* harmony export */ "connectAuthEmulator": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.connectAuthEmulator), -/* harmony export */ "createUserWithEmailAndPassword": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.createUserWithEmailAndPassword), -/* harmony export */ "debugErrorMap": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.debugErrorMap), -/* harmony export */ "deleteUser": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.deleteUser), -/* harmony export */ "fetchSignInMethodsForEmail": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.fetchSignInMethodsForEmail), -/* harmony export */ "getAdditionalUserInfo": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.getAdditionalUserInfo), -/* harmony export */ "getAuth": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.getAuth), -/* harmony export */ "getIdToken": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.getIdToken), -/* harmony export */ "getIdTokenResult": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.getIdTokenResult), -/* harmony export */ "getMultiFactorResolver": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.getMultiFactorResolver), -/* harmony export */ "getRedirectResult": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.getRedirectResult), -/* harmony export */ "inMemoryPersistence": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.inMemoryPersistence), -/* harmony export */ "indexedDBLocalPersistence": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.indexedDBLocalPersistence), -/* harmony export */ "initializeAuth": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.initializeAuth), -/* harmony export */ "isSignInWithEmailLink": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.isSignInWithEmailLink), -/* harmony export */ "linkWithCredential": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.linkWithCredential), -/* harmony export */ "linkWithPhoneNumber": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.linkWithPhoneNumber), -/* harmony export */ "linkWithPopup": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.linkWithPopup), -/* harmony export */ "linkWithRedirect": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.linkWithRedirect), -/* harmony export */ "multiFactor": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.multiFactor), -/* harmony export */ "onAuthStateChanged": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.onAuthStateChanged), -/* harmony export */ "onIdTokenChanged": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.onIdTokenChanged), -/* harmony export */ "parseActionCodeURL": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.parseActionCodeURL), -/* harmony export */ "prodErrorMap": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.prodErrorMap), -/* harmony export */ "reauthenticateWithCredential": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.reauthenticateWithCredential), -/* harmony export */ "reauthenticateWithPhoneNumber": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.reauthenticateWithPhoneNumber), -/* harmony export */ "reauthenticateWithPopup": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.reauthenticateWithPopup), -/* harmony export */ "reauthenticateWithRedirect": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.reauthenticateWithRedirect), -/* harmony export */ "reload": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.reload), -/* harmony export */ "sendEmailVerification": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.sendEmailVerification), -/* harmony export */ "sendPasswordResetEmail": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.sendPasswordResetEmail), -/* harmony export */ "sendSignInLinkToEmail": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.sendSignInLinkToEmail), -/* harmony export */ "setPersistence": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.setPersistence), -/* harmony export */ "signInAnonymously": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.signInAnonymously), -/* harmony export */ "signInWithCredential": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.signInWithCredential), -/* harmony export */ "signInWithCustomToken": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.signInWithCustomToken), -/* harmony export */ "signInWithEmailAndPassword": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.signInWithEmailAndPassword), -/* harmony export */ "signInWithEmailLink": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.signInWithEmailLink), -/* harmony export */ "signInWithPhoneNumber": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.signInWithPhoneNumber), -/* harmony export */ "signInWithPopup": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.signInWithPopup), -/* harmony export */ "signInWithRedirect": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.signInWithRedirect), -/* harmony export */ "signOut": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.signOut), -/* harmony export */ "unlink": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.unlink), -/* harmony export */ "updateCurrentUser": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.updateCurrentUser), -/* harmony export */ "updateEmail": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.updateEmail), -/* harmony export */ "updatePassword": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.updatePassword), -/* harmony export */ "updatePhoneNumber": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.updatePhoneNumber), -/* harmony export */ "updateProfile": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.updateProfile), -/* harmony export */ "useDeviceLanguage": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.useDeviceLanguage), -/* harmony export */ "verifyBeforeUpdateEmail": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.verifyBeforeUpdateEmail), -/* harmony export */ "verifyPasswordResetCode": () => (/* reexport safe */ _firebase_auth__WEBPACK_IMPORTED_MODULE_0__.verifyPasswordResetCode) -/* harmony export */ }); -/* harmony import */ var _firebase_auth__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/auth */ "./node_modules/@firebase/auth/dist/esm2017/index.js"); - - -/***/ }), - -/***/ "./node_modules/firebase/firestore/dist/index.esm.js": -/*!***********************************************************!*\ - !*** ./node_modules/firebase/firestore/dist/index.esm.js ***! - \***********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "AbstractUserDataWriter": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.AbstractUserDataWriter), -/* harmony export */ "Bytes": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.Bytes), -/* harmony export */ "CACHE_SIZE_UNLIMITED": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.CACHE_SIZE_UNLIMITED), -/* harmony export */ "CollectionReference": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.CollectionReference), -/* harmony export */ "DocumentReference": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.DocumentReference), -/* harmony export */ "DocumentSnapshot": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.DocumentSnapshot), -/* harmony export */ "FieldPath": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.FieldPath), -/* harmony export */ "FieldValue": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.FieldValue), -/* harmony export */ "Firestore": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.Firestore), -/* harmony export */ "FirestoreError": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.FirestoreError), -/* harmony export */ "GeoPoint": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.GeoPoint), -/* harmony export */ "LoadBundleTask": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.LoadBundleTask), -/* harmony export */ "Query": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.Query), -/* harmony export */ "QueryConstraint": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.QueryConstraint), -/* harmony export */ "QueryDocumentSnapshot": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.QueryDocumentSnapshot), -/* harmony export */ "QuerySnapshot": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.QuerySnapshot), -/* harmony export */ "SnapshotMetadata": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.SnapshotMetadata), -/* harmony export */ "Timestamp": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.Timestamp), -/* harmony export */ "Transaction": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.Transaction), -/* harmony export */ "WriteBatch": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.WriteBatch), -/* harmony export */ "_DatabaseId": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__._DatabaseId), -/* harmony export */ "_DocumentKey": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__._DocumentKey), -/* harmony export */ "_EmptyAppCheckTokenProvider": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__._EmptyAppCheckTokenProvider), -/* harmony export */ "_EmptyAuthCredentialsProvider": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__._EmptyAuthCredentialsProvider), -/* harmony export */ "_FieldPath": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__._FieldPath), -/* harmony export */ "_cast": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__._cast), -/* harmony export */ "_debugAssert": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__._debugAssert), -/* harmony export */ "_isBase64Available": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__._isBase64Available), -/* harmony export */ "_logWarn": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__._logWarn), -/* harmony export */ "_validateIsNotUsedTogether": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__._validateIsNotUsedTogether), -/* harmony export */ "addDoc": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.addDoc), -/* harmony export */ "arrayRemove": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.arrayRemove), -/* harmony export */ "arrayUnion": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.arrayUnion), -/* harmony export */ "clearIndexedDbPersistence": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.clearIndexedDbPersistence), -/* harmony export */ "collection": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.collection), -/* harmony export */ "collectionGroup": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.collectionGroup), -/* harmony export */ "connectFirestoreEmulator": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.connectFirestoreEmulator), -/* harmony export */ "deleteDoc": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.deleteDoc), -/* harmony export */ "deleteField": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.deleteField), -/* harmony export */ "disableNetwork": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.disableNetwork), -/* harmony export */ "doc": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.doc), -/* harmony export */ "documentId": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.documentId), -/* harmony export */ "enableIndexedDbPersistence": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.enableIndexedDbPersistence), -/* harmony export */ "enableMultiTabIndexedDbPersistence": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.enableMultiTabIndexedDbPersistence), -/* harmony export */ "enableNetwork": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.enableNetwork), -/* harmony export */ "endAt": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.endAt), -/* harmony export */ "endBefore": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.endBefore), -/* harmony export */ "ensureFirestoreConfigured": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.ensureFirestoreConfigured), -/* harmony export */ "executeWrite": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.executeWrite), -/* harmony export */ "getDoc": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.getDoc), -/* harmony export */ "getDocFromCache": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.getDocFromCache), -/* harmony export */ "getDocFromServer": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.getDocFromServer), -/* harmony export */ "getDocs": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.getDocs), -/* harmony export */ "getDocsFromCache": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.getDocsFromCache), -/* harmony export */ "getDocsFromServer": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.getDocsFromServer), -/* harmony export */ "getFirestore": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.getFirestore), -/* harmony export */ "increment": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.increment), -/* harmony export */ "initializeFirestore": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.initializeFirestore), -/* harmony export */ "limit": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.limit), -/* harmony export */ "limitToLast": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.limitToLast), -/* harmony export */ "loadBundle": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.loadBundle), -/* harmony export */ "namedQuery": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.namedQuery), -/* harmony export */ "onSnapshot": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.onSnapshot), -/* harmony export */ "onSnapshotsInSync": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.onSnapshotsInSync), -/* harmony export */ "orderBy": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.orderBy), -/* harmony export */ "query": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.query), -/* harmony export */ "queryEqual": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.queryEqual), -/* harmony export */ "refEqual": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.refEqual), -/* harmony export */ "runTransaction": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.runTransaction), -/* harmony export */ "serverTimestamp": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.serverTimestamp), -/* harmony export */ "setDoc": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.setDoc), -/* harmony export */ "setIndexConfiguration": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.setIndexConfiguration), -/* harmony export */ "setLogLevel": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.setLogLevel), -/* harmony export */ "snapshotEqual": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.snapshotEqual), -/* harmony export */ "startAfter": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.startAfter), -/* harmony export */ "startAt": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.startAt), -/* harmony export */ "terminate": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.terminate), -/* harmony export */ "updateDoc": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.updateDoc), -/* harmony export */ "waitForPendingWrites": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.waitForPendingWrites), -/* harmony export */ "where": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.where), -/* harmony export */ "writeBatch": () => (/* reexport safe */ _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__.writeBatch) -/* harmony export */ }); -/* harmony import */ var _firebase_firestore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/firestore */ "./node_modules/@firebase/firestore/dist/index.esm2017.js"); - - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Accordion/AccordionContent.js": -/*!**************************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Accordion/AccordionContent.js ***! - \**************************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "AccordionContent": () => (/* binding */ AccordionContent) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _AccordionPanelContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./AccordionPanelContext */ "./node_modules/flowbite-react/lib/esm/components/Accordion/AccordionPanelContext.js"); - - - - -const AccordionContent = _ref => { - let { - children, - ...props - } = _ref; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_1__.excludeClassName)(props); - const { - isOpen - } = (0,_AccordionPanelContext__WEBPACK_IMPORTED_MODULE_3__.useAccordionContext)(); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__.useTheme)().theme.accordion.content; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme.base, - "data-testid": "flowbite-accordion-content", - hidden: !isOpen, - ...theirProps, - children: children - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Accordion/AccordionPanel.js": -/*!************************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Accordion/AccordionPanel.js ***! - \************************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "AccordionPanel": () => (/* binding */ AccordionPanel) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _AccordionPanelContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./AccordionPanelContext */ "./node_modules/flowbite-react/lib/esm/components/Accordion/AccordionPanelContext.js"); - - - -const AccordionPanel = _ref => { - let { - children, - ...props - } = _ref; - const { - alwaysOpen - } = props; - const [isOpen, setOpen] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(props.isOpen); - const provider = alwaysOpen ? { ...props, - isOpen, - setOpen: () => setOpen(!isOpen) - } : props; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_AccordionPanelContext__WEBPACK_IMPORTED_MODULE_2__.AccordionPanelContext.Provider, { - value: provider, - children: children - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Accordion/AccordionPanelContext.js": -/*!*******************************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Accordion/AccordionPanelContext.js ***! - \*******************************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "AccordionPanelContext": () => (/* binding */ AccordionPanelContext), -/* harmony export */ "useAccordionContext": () => (/* binding */ useAccordionContext) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); - -const AccordionPanelContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(undefined); -function useAccordionContext() { - const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(AccordionPanelContext); - - if (!context) { - throw new Error('useAccordionContext should be used within the AccordionPanelContext provider!'); - } - - return context; -} - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Accordion/AccordionTitle.js": -/*!************************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Accordion/AccordionTitle.js ***! - \************************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "AccordionTitle": () => (/* binding */ AccordionTitle) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _AccordionPanelContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./AccordionPanelContext */ "./node_modules/flowbite-react/lib/esm/components/Accordion/AccordionPanelContext.js"); - - - - - -const AccordionTitle = _ref => { - let { - as: Heading = 'h2', - children, - ...props - } = _ref; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - const { - arrowIcon: ArrowIcon, - flush, - isOpen, - setOpen - } = (0,_AccordionPanelContext__WEBPACK_IMPORTED_MODULE_4__.useAccordionContext)(); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.accordion.title; - - const onClick = () => typeof setOpen !== 'undefined' && setOpen(); - - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("button", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, theme.flush[flush ? 'on' : 'off'], theme.open[isOpen ? 'on' : 'off']), - onClick: onClick, - type: "button", - ...theirProps, - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Heading, { - className: theme.heading, - "data-testid": "flowbite-accordion-heading", - children: children - }), ArrowIcon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(ArrowIcon, { - "aria-hidden": true, - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.arrow.base, theme.arrow.open[isOpen ? 'on' : 'off']), - "data-testid": "flowbite-accordion-arrow" - })] - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Accordion/index.js": -/*!***************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Accordion/index.js ***! - \***************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Accordion": () => (/* binding */ Accordion) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var react_icons_hi__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react-icons/hi */ "./node_modules/react-icons/hi/index.esm.js"); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _AccordionContent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./AccordionContent */ "./node_modules/flowbite-react/lib/esm/components/Accordion/AccordionContent.js"); -/* harmony import */ var _AccordionPanel__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./AccordionPanel */ "./node_modules/flowbite-react/lib/esm/components/Accordion/AccordionPanel.js"); -/* harmony import */ var _AccordionTitle__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./AccordionTitle */ "./node_modules/flowbite-react/lib/esm/components/Accordion/AccordionTitle.js"); - - - - - - - - - - -const AccordionComponent = _ref => { - let { - alwaysOpen = false, - arrowIcon = react_icons_hi__WEBPACK_IMPORTED_MODULE_8__.HiChevronDown, - children, - flush = false, - ...props - } = _ref; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_3__.excludeClassName)(props); - const [isOpen, setOpen] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(0); - const panels = (0,react__WEBPACK_IMPORTED_MODULE_2__.useMemo)(() => react__WEBPACK_IMPORTED_MODULE_2__.Children.map(children, (child, i) => (0,react__WEBPACK_IMPORTED_MODULE_2__.cloneElement)(child, { - alwaysOpen, - arrowIcon, - flush, - isOpen: isOpen === i, - setOpen: () => setOpen(i) - })), [alwaysOpen, arrowIcon, children, flush, isOpen]); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__.useTheme)().theme.accordion; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, theme.flush[flush ? 'on' : 'off']), - "data-testid": "flowbite-accordion", - ...theirProps, - children: panels - }); -}; - -AccordionComponent.displayName = 'Accordion'; -_AccordionPanel__WEBPACK_IMPORTED_MODULE_6__.AccordionPanel.displayName = 'Accordion.Panel'; -_AccordionTitle__WEBPACK_IMPORTED_MODULE_7__.AccordionTitle.displayName = 'Accordion.Title'; -_AccordionContent__WEBPACK_IMPORTED_MODULE_5__.AccordionContent.displayName = 'Accordion.Content'; -const Accordion = Object.assign(AccordionComponent, { - Panel: _AccordionPanel__WEBPACK_IMPORTED_MODULE_6__.AccordionPanel, - Title: _AccordionTitle__WEBPACK_IMPORTED_MODULE_7__.AccordionTitle, - Content: _AccordionContent__WEBPACK_IMPORTED_MODULE_5__.AccordionContent -}); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Alert/index.js": -/*!***********************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Alert/index.js ***! - \***********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Alert": () => (/* binding */ Alert) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react_icons_hi__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-icons/hi */ "./node_modules/react-icons/hi/index.esm.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - - -const Alert = _ref => { - let { - additionalContent, - children, - color = 'info', - icon: Icon, - onDismiss, - rounded = true, - withBorderAccent - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__.useTheme)().theme.alert; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, theme.color[color], rounded && theme.rounded, withBorderAccent && theme.borderAccent), - role: "alert", - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { - className: "flex items-center", - children: [Icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Icon, { - className: theme.icon - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - children: children - }), typeof onDismiss === 'function' && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("button", { - "aria-label": "Dismiss", - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.closeButton.base, theme.closeButton.color[color]), - onClick: onDismiss, - type: "button", - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_icons_hi__WEBPACK_IMPORTED_MODULE_3__.HiX, { - "aria-hidden": true, - className: "h-5 w-5" - }) - })] - }), additionalContent && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - children: additionalContent - })] - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Avatar/AvatarGroup.js": -/*!******************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Avatar/AvatarGroup.js ***! - \******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); - - -const AvatarGroup = _ref => { - let { - children - } = _ref; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - "data-testid": "avatar-group-element", - className: "mb-5 flex -space-x-4", - children: children - }); -}; - -AvatarGroup.displayName = 'Avatar.Group'; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AvatarGroup); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Avatar/AvatarGroupCounter.js": -/*!*************************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Avatar/AvatarGroupCounter.js ***! - \*************************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); - - -const AvatarGroupCounter = _ref => { - let { - total, - href - } = _ref; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("a", { - className: "relative flex h-10 w-10 items-center justify-center rounded-full bg-gray-700 text-xs font-medium text-white ring-2 ring-gray-300 hover:bg-gray-600 dark:ring-gray-500 ", - href: href, - children: ["+", total] - }); -}; - -AvatarGroupCounter.displayName = 'Avatar.GroupCounter'; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AvatarGroupCounter); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Avatar/index.js": -/*!************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Avatar/index.js ***! - \************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Avatar": () => (/* binding */ Avatar) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _AvatarGroup__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./AvatarGroup */ "./node_modules/flowbite-react/lib/esm/components/Avatar/AvatarGroup.js"); -/* harmony import */ var _AvatarGroupCounter__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./AvatarGroupCounter */ "./node_modules/flowbite-react/lib/esm/components/Avatar/AvatarGroupCounter.js"); - - - - - - - -const AvatarComponent = _ref => { - let { - alt = '', - bordered = false, - children, - img, - rounded = false, - size = 'md', - stacked = false, - status, - statusPosition = 'top-left', - ...props - } = _ref; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.avatar; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { - className: theme.base, - "data-testid": "flowbite-avatar", - ...theirProps, - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { - className: "relative", - children: [img ? (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { - alt: alt, - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(bordered && theme.bordered, rounded && theme.rounded, stacked && theme.stacked, theme.img.on, theme.size[size]), - "data-testid": "flowbite-avatar-img", - src: img - }) : (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(bordered && theme.bordered, rounded && theme.rounded, stacked && theme.stacked, theme.img.off, theme.size[size]), - "data-testid": "flowbite-avatar-img", - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("svg", { - className: "absolute -bottom-1 h-auto w-auto text-gray-400", - fill: "currentColor", - viewBox: "0 0 20 20", - xmlns: "http://www.w3.org/2000/svg", - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { - fillRule: "evenodd", - d: "M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z", - clipRule: "evenodd" - }) - }) - }), status && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.status.base, theme.status[status], theme.statusPosition[statusPosition]) - })] - }), children && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - children: children - })] - }); -}; - -AvatarComponent.displayName = 'Avatar'; -const Avatar = Object.assign(AvatarComponent, { - Group: _AvatarGroup__WEBPACK_IMPORTED_MODULE_4__["default"], - Counter: _AvatarGroupCounter__WEBPACK_IMPORTED_MODULE_5__["default"] -}); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Badge/index.js": -/*!***********************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Badge/index.js ***! - \***********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Badge": () => (/* binding */ Badge) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - - -const Badge = _ref => { - let { - children, - color = 'info', - href, - icon: Icon, - size = 'xs', - ...props - } = _ref; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.badge; - - const Content = () => (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("span", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, theme.color[color], theme.icon[Icon ? 'on' : 'off'], theme.size[size]), - "data-testid": "flowbite-badge", - ...theirProps, - children: [Icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Icon, { - "aria-hidden": true, - className: theme.icon.size[size], - "data-testid": "flowbite-badge-icon" - }), children && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - children: children - })] - }); - - return href ? (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("a", { - className: theme.href, - href: href, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Content, {}) - }) : (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Content, {}); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Breadcrumb/BreadcrumbItem.js": -/*!*************************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Breadcrumb/BreadcrumbItem.js ***! - \*************************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var react_icons_hi__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-icons/hi */ "./node_modules/react-icons/hi/index.esm.js"); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - - - -const BreadcrumbItem = _ref => { - let { - children, - href, - icon: Icon, - ...props - } = _ref; - const isLink = typeof href !== 'undefined'; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_1__.excludeClassName)(props); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__.useTheme)().theme.breadcrumb.item; - const Component = isLink ? 'a' : 'span'; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("li", { - className: theme.base, - ...theirProps, - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_icons_hi__WEBPACK_IMPORTED_MODULE_3__.HiOutlineChevronRight, { - "aria-hidden": true, - className: theme.chevron, - "data-testid": "flowbite-breadcrumb-separator" - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(Component, { - className: theme.href[isLink ? 'on' : 'off'], - "data-testid": "flowbite-breadcrumb-item", - href: href, - children: [Icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Icon, { - "aria-hidden": true, - className: theme.icon - }), children] - })] - }); -}; - -BreadcrumbItem.displayName = 'Breadcrumb.Item'; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BreadcrumbItem); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Breadcrumb/index.js": -/*!****************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Breadcrumb/index.js ***! - \****************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Breadcrumb": () => (/* binding */ Breadcrumb) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _BreadcrumbItem__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BreadcrumbItem */ "./node_modules/flowbite-react/lib/esm/components/Breadcrumb/BreadcrumbItem.js"); - - - - -const BreadcrumbComponent = _ref => { - let { - children, - ...props - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_1__.useTheme)().theme.breadcrumb; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("nav", { - "aria-label": "Breadcrumb", - ...props, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("ol", { - className: theme.list, - children: children - }) - }); -}; - -BreadcrumbComponent.displayName = 'Breadcrumb'; -const Breadcrumb = Object.assign(BreadcrumbComponent, { - Item: _BreadcrumbItem__WEBPACK_IMPORTED_MODULE_2__["default"] -}); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Button/ButtonGroup.js": -/*!******************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Button/ButtonGroup.js ***! - \******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - - - -const ButtonGroup = _ref => { - let { - children, - outline, - pill, - ...props - } = _ref; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - const items = (0,react__WEBPACK_IMPORTED_MODULE_1__.useMemo)(() => react__WEBPACK_IMPORTED_MODULE_1__.Children.map(children, (child, index) => (0,react__WEBPACK_IMPORTED_MODULE_1__.cloneElement)(child, { - outline, - pill, - positionInGroup: index === 0 ? 'start' : index === children.length - 1 ? 'end' : 'middle' - })), [children, outline, pill]); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.buttonGroup; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme.base, - role: "group", - ...theirProps, - children: items - }); -}; - -ButtonGroup.displayName = 'Button.Group'; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ButtonGroup); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Button/index.js": -/*!************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Button/index.js ***! - \************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Button": () => (/* binding */ Button) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _ButtonGroup__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ButtonGroup */ "./node_modules/flowbite-react/lib/esm/components/Button/ButtonGroup.js"); - - - - - - -const ButtonComponent = _ref => { - let { - children, - color = 'info', - disabled = false, - gradientDuoTone, - gradientMonochrome, - href, - label, - outline = false, - pill = false, - positionInGroup = 'none', - size = 'md', - ...props - } = _ref; - const isLink = typeof href !== 'undefined'; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - const { - buttonGroup: groupTheme, - button: theme - } = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme; - const Component = isLink ? 'a' : 'button'; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Component, { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(disabled && theme.disabled, !gradientDuoTone && !gradientMonochrome && theme.color[color], gradientDuoTone && !gradientMonochrome && theme.gradientDuoTone[gradientDuoTone], !gradientDuoTone && gradientMonochrome && theme.gradient[gradientMonochrome], groupTheme.position[positionInGroup], outline && theme.outline.color[color], theme.base, theme.pill[pill ? 'on' : 'off']), - disabled: disabled, - href: href, - type: isLink ? undefined : 'button', - ...theirProps, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.inner.base, theme.inner.position[positionInGroup], theme.outline[outline ? 'on' : 'off'], theme.outline.pill[outline && pill ? 'on' : 'off'], theme.size[size]), - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { - children: [typeof children !== 'undefined' && children, typeof label !== 'undefined' && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - className: theme.label, - "data-testid": "flowbite-button-label", - children: label - })] - }) - }) - }); -}; - -ButtonComponent.displayName = 'Button'; -const Button = Object.assign(ButtonComponent, { - Group: _ButtonGroup__WEBPACK_IMPORTED_MODULE_4__["default"] -}); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Card/index.js": -/*!**********************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Card/index.js ***! - \**********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Card": () => (/* binding */ Card) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - - -const Card = _ref => { - let { - children, - horizontal, - href, - imgAlt, - imgSrc, - ...props - } = _ref; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.card; - const Component = typeof href === 'undefined' ? 'div' : 'a'; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(Component, { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, theme.horizontal[horizontal ? 'on' : 'off'], href && theme.href), - "data-testid": "flowbite-card", - href: href, - ...theirProps, - children: [imgSrc && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { - alt: imgAlt ?? '', - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.img.base, theme.img.horizontal[horizontal ? 'on' : 'off']), - src: imgSrc - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme.children, - children: children - })] - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Carousel/index.js": -/*!**************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Carousel/index.js ***! - \**************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Carousel": () => (/* binding */ Carousel) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var react_icons_hi__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react-icons/hi */ "./node_modules/react-icons/hi/index.esm.js"); -/* harmony import */ var react_indiana_drag_scroll__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-indiana-drag-scroll */ "./node_modules/react-indiana-drag-scroll/dist/index.es.js"); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _helpers_window_exists__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../helpers/window-exists */ "./node_modules/flowbite-react/lib/esm/helpers/window-exists.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - - - - - - -const Carousel = _ref => { - let { - children, - indicators = true, - leftControl, - rightControl, - slide = true, - slideInterval, - ...props - } = _ref; - const isDeviceMobile = (0,_helpers_window_exists__WEBPACK_IMPORTED_MODULE_5__["default"])() && navigator.userAgent.indexOf('IEMobile') !== -1; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_4__.excludeClassName)(props); - const carouselContainer = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null); - const [activeItem, setActiveItem] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(0); - const [isDragging, setIsDragging] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(false); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_6__.useTheme)().theme.carousel; - const items = (0,react__WEBPACK_IMPORTED_MODULE_2__.useMemo)(() => react__WEBPACK_IMPORTED_MODULE_2__.Children.map(children, child => (0,react__WEBPACK_IMPORTED_MODULE_2__.cloneElement)(child, { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.item.base, child.props.className) - })), [children, theme.item.base]); - const navigateTo = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(item => () => { - item = (item + items.length) % items.length; - - if (carouselContainer.current) { - carouselContainer.current.scrollLeft = carouselContainer.current.clientWidth * item; - } - - setActiveItem(item); - }, [items.length]); - (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => { - if (carouselContainer.current && !isDragging) { - setActiveItem(Math.round(carouselContainer.current.scrollLeft / carouselContainer.current.clientWidth)); - } - }, [isDragging]); - (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => { - if (slide) { - const intervalId = setInterval(() => !isDragging && navigateTo(activeItem + 1)(), slideInterval ?? 3000); - return () => clearInterval(intervalId); - } - }, [activeItem, isDragging, navigateTo, slide, slideInterval]); - - const handleDragging = dragging => () => setIsDragging(dragging); - - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { - className: theme.base, - "data-testid": "carousel", - ...theirProps, - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_indiana_drag_scroll__WEBPACK_IMPORTED_MODULE_3__["default"], { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.scrollContainer.base, (isDeviceMobile || !isDragging) && theme.scrollContainer.snap), - draggingClassName: "cursor-grab", - innerRef: carouselContainer, - onEndScroll: handleDragging(false), - onStartScroll: handleDragging(true), - vertical: false, - children: items?.map((item, index) => (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme.item.wrapper, - "data-active": activeItem === index, - "data-testid": "carousel-item", - children: item - }, index)) - }), indicators && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme.indicators.wrapper, - children: items.map((_, index) => (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("button", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.indicators.base, theme.indicators.active[index === activeItem ? 'on' : 'off']), - onClick: navigateTo(index), - "data-testid": "carousel-indicator" - }, index)) - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme.leftControl, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("button", { - className: "group", - "data-testid": "carousel-left-control", - onClick: navigateTo(activeItem - 1), - type: "button", - children: leftControl ? leftControl : (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(DefaultLeftControl, {}) - }) - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme.rightControl, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("button", { - className: "group", - "data-testid": "carousel-right-control", - onClick: navigateTo(activeItem + 1), - type: "button", - children: rightControl ? rightControl : (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(DefaultRightControl, {}) - }) - })] - }); -}; - -const DefaultLeftControl = () => { - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_6__.useTheme)().theme.carousel; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - className: theme.control.base, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_icons_hi__WEBPACK_IMPORTED_MODULE_7__.HiOutlineChevronLeft, { - className: theme.control.icon - }) - }); -}; - -const DefaultRightControl = () => { - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_6__.useTheme)().theme.carousel; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - className: theme.control.base, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_icons_hi__WEBPACK_IMPORTED_MODULE_7__.HiOutlineChevronRight, { - className: theme.control.icon - }) - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/DarkThemeToggle/index.js": -/*!*********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/DarkThemeToggle/index.js ***! - \*********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "DarkThemeToggle": () => (/* binding */ DarkThemeToggle) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react_icons_hi__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-icons/hi */ "./node_modules/react-icons/hi/index.esm.js"); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - - - -const DarkThemeToggle = props => { - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.darkThemeToggle; - const { - mode, - toggleMode - } = (0,react__WEBPACK_IMPORTED_MODULE_1__.useContext)(_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.ThemeContext); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("button", { - className: theme.base, - "data-testid": "dark-theme-toggle", - onClick: toggleMode, - type: "button", - "aria-label": "Toggle dark mode", - ...theirProps, - children: mode === 'dark' ? (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_icons_hi__WEBPACK_IMPORTED_MODULE_4__.HiSun, { - "aria-label": "Currently dark mode", - className: theme.icon - }) : (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_icons_hi__WEBPACK_IMPORTED_MODULE_4__.HiMoon, { - "aria-label": "Currently light mode", - className: theme.icon - }) - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Dropdown/DropdownDivider.js": -/*!************************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Dropdown/DropdownDivider.js ***! - \************************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "DropdownDivider": () => (/* binding */ DropdownDivider) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - -const DropdownDivider = () => { - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_1__.useTheme)().theme.dropdown.floating.divider; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Dropdown/DropdownHeader.js": -/*!***********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Dropdown/DropdownHeader.js ***! - \***********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "DropdownHeader": () => (/* binding */ DropdownHeader) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _DropdownDivider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./DropdownDivider */ "./node_modules/flowbite-react/lib/esm/components/Dropdown/DropdownDivider.js"); - - - - -const DropdownHeader = _ref => { - let { - children, - ...props - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__.useTheme)().theme.dropdown.floating.header; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_1__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme, - ...theirProps, - children: children - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_DropdownDivider__WEBPACK_IMPORTED_MODULE_3__.DropdownDivider, {})] - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Dropdown/DropdownItem.js": -/*!*********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Dropdown/DropdownItem.js ***! - \*********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "DropdownItem": () => (/* binding */ DropdownItem) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - -const DropdownItem = _ref => { - let { - children, - onClick, - icon: Icon - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_1__.useTheme)().theme.dropdown.floating.item; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("li", { - className: theme.base, - onClick: onClick, - children: [Icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Icon, { - className: theme.icon - }), children] - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Dropdown/index.js": -/*!**************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Dropdown/index.js ***! - \**************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Dropdown": () => (/* binding */ Dropdown) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react_icons_hi__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! react-icons/hi */ "./node_modules/react-icons/hi/index.esm.js"); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Button__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Button */ "./node_modules/flowbite-react/lib/esm/components/Button/index.js"); -/* harmony import */ var _Floating__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Floating */ "./node_modules/flowbite-react/lib/esm/components/Floating/index.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _DropdownDivider__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./DropdownDivider */ "./node_modules/flowbite-react/lib/esm/components/Dropdown/DropdownDivider.js"); -/* harmony import */ var _DropdownHeader__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./DropdownHeader */ "./node_modules/flowbite-react/lib/esm/components/Dropdown/DropdownHeader.js"); -/* harmony import */ var _DropdownItem__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./DropdownItem */ "./node_modules/flowbite-react/lib/esm/components/Dropdown/DropdownItem.js"); - - - - - - - - - - -const icons = { - top: react_icons_hi__WEBPACK_IMPORTED_MODULE_9__.HiOutlineChevronUp, - right: react_icons_hi__WEBPACK_IMPORTED_MODULE_9__.HiOutlineChevronRight, - bottom: react_icons_hi__WEBPACK_IMPORTED_MODULE_9__.HiOutlineChevronDown, - left: react_icons_hi__WEBPACK_IMPORTED_MODULE_9__.HiOutlineChevronLeft -}; - -const DropdownComponent = _ref => { - let { - children, - ...props - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_5__.useTheme)().theme.dropdown; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - const { - placement = props.inline ? 'bottom-start' : 'bottom', - trigger = 'click', - label, - inline, - floatingArrow = false, - arrowIcon = true, - ...buttonProps - } = theirProps; - const Icon = (0,react__WEBPACK_IMPORTED_MODULE_1__.useMemo)(() => { - const [p] = placement.split('-'); - return icons[p] ?? react_icons_hi__WEBPACK_IMPORTED_MODULE_9__.HiOutlineChevronDown; - }, [placement]); - const content = (0,react__WEBPACK_IMPORTED_MODULE_1__.useMemo)(() => (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("ul", { - className: theme.content, - children: children - }), [children, theme]); - - const TriggerWrapper = _ref2 => { - let { - children - } = _ref2; - return inline ? (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("button", { - className: theme.inlineWrapper, - children: children - }) : (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Button__WEBPACK_IMPORTED_MODULE_3__.Button, { ...buttonProps, - children: children - }); - }; - - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Floating__WEBPACK_IMPORTED_MODULE_4__.Floating, { - content: content, - style: "auto", - animation: "duration-100", - placement: placement, - arrow: floatingArrow, - trigger: trigger, - theme: theme.floating, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(TriggerWrapper, { - children: [label, arrowIcon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Icon, { - className: theme.arrowIcon - })] - }) - }); -}; - -DropdownComponent.displayName = 'Dropdown'; -_DropdownItem__WEBPACK_IMPORTED_MODULE_8__.DropdownItem.displayName = 'Dropdown.Item'; -_DropdownHeader__WEBPACK_IMPORTED_MODULE_7__.DropdownHeader.displayName = 'Dropdown.Header'; -_DropdownDivider__WEBPACK_IMPORTED_MODULE_6__.DropdownDivider.displayName = 'Dropdown.Divider'; -const Dropdown = Object.assign(DropdownComponent, { - Item: _DropdownItem__WEBPACK_IMPORTED_MODULE_8__.DropdownItem, - Header: _DropdownHeader__WEBPACK_IMPORTED_MODULE_7__.DropdownHeader, - Divider: _DropdownDivider__WEBPACK_IMPORTED_MODULE_6__.DropdownDivider -}); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Floating/index.js": -/*!**************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Floating/index.js ***! - \**************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Floating": () => (/* binding */ Floating) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var _floating_ui_react_dom_interactions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @floating-ui/react-dom-interactions */ "./node_modules/@floating-ui/react-dom-interactions/dist/floating-ui.react-dom-interactions.esm.js"); -/* harmony import */ var _floating_ui_react_dom_interactions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @floating-ui/react-dom-interactions */ "./node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.mjs"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _helpers_floating__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../helpers/floating */ "./node_modules/flowbite-react/lib/esm/helpers/floating.js"); - - - - - - -/** - * @see https://floating-ui.com/docs/react-dom-interactions - */ - -const Floating = _ref => { - let { - children, - content, - theme, - animation = 'duration-300', - arrow = true, - placement = 'top', - style = 'dark', - trigger = 'hover', - ...props - } = _ref; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_3__.excludeClassName)(props); - const arrowRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null); - const [open, setOpen] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(false); - const floatingTooltip = (0,_floating_ui_react_dom_interactions__WEBPACK_IMPORTED_MODULE_5__.useFloating)({ - middleware: (0,_helpers_floating__WEBPACK_IMPORTED_MODULE_4__.getMiddleware)({ - arrowRef, - placement - }), - onOpenChange: setOpen, - open, - placement: (0,_helpers_floating__WEBPACK_IMPORTED_MODULE_4__.getPlacement)({ - placement - }) - }); - const { - context, - floating, - middlewareData: { - arrow: { - x: arrowX, - y: arrowY - } = {} - }, - reference, - refs, - strategy, - update, - x, - y - } = floatingTooltip; - const { - getFloatingProps, - getReferenceProps - } = (0,_floating_ui_react_dom_interactions__WEBPACK_IMPORTED_MODULE_5__.useInteractions)([(0,_floating_ui_react_dom_interactions__WEBPACK_IMPORTED_MODULE_5__.useClick)(context, { - enabled: trigger === 'click' - }), (0,_floating_ui_react_dom_interactions__WEBPACK_IMPORTED_MODULE_5__.useFocus)(context), (0,_floating_ui_react_dom_interactions__WEBPACK_IMPORTED_MODULE_5__.useHover)(context, { - enabled: trigger === 'hover' - }), (0,_floating_ui_react_dom_interactions__WEBPACK_IMPORTED_MODULE_5__.useRole)(context, { - role: 'tooltip' - })]); - (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => { - if (refs.reference.current && refs.floating.current && open) { - return (0,_floating_ui_react_dom_interactions__WEBPACK_IMPORTED_MODULE_6__.autoUpdate)(refs.reference.current, refs.floating.current, update); - } - }, [open, refs.floating, refs.reference, update]); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme.target, - ...getReferenceProps({ - ref: reference - }), - "data-testid": "flowbite-tooltip-target", - children: children - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { - "data-testid": "flowbite-tooltip", - ...getFloatingProps({ - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, animation && `${theme.animation} ${animation}`, !open && theme.hidden, theme.style[style]), - ref: floating, - style: { - position: strategy, - top: y ?? ' ', - left: x ?? ' ' - }, - ...theirProps - }), - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme.content, - children: content - }), arrow && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.arrow.base, { - [theme.arrow.style.dark]: style === 'dark', - [theme.arrow.style.light]: style === 'light', - [theme.arrow.style.auto]: style === 'auto' - }), - "data-testid": "flowbite-tooltip-arrow", - ref: arrowRef, - style: { - top: arrowY ?? ' ', - left: arrowX ?? ' ', - right: ' ', - bottom: ' ', - [(0,_helpers_floating__WEBPACK_IMPORTED_MODULE_4__.getArrowPlacement)({ - placement: floatingTooltip.placement - })]: theme.arrow.placement - }, - children: "\u00A0" - })] - })] - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js": -/*!*********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js ***! - \*********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ThemeContext": () => (/* binding */ ThemeContext), -/* harmony export */ "ThemeProvider": () => (/* binding */ ThemeProvider), -/* harmony export */ "useTheme": () => (/* binding */ useTheme), -/* harmony export */ "useThemeMode": () => (/* binding */ useThemeMode) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_window_exists__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/window-exists */ "./node_modules/flowbite-react/lib/esm/helpers/window-exists.js"); -/* harmony import */ var _theme_default__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/default */ "./node_modules/flowbite-react/lib/esm/theme/default.js"); - - - - -const ThemeContext = (0,react__WEBPACK_IMPORTED_MODULE_1__.createContext)({ - theme: _theme_default__WEBPACK_IMPORTED_MODULE_3__["default"] -}); -const ThemeProvider = _ref => { - let { - children, - value - } = _ref; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(ThemeContext.Provider, { - value: value, - children: children - }); -}; -function useTheme() { - return (0,react__WEBPACK_IMPORTED_MODULE_1__.useContext)(ThemeContext); -} -const useThemeMode = usePreferences => { - if (!usePreferences) return [undefined, undefined, undefined]; - const [mode, setMode] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(undefined); - - const savePreference = m => localStorage.setItem('theme', m); - - const toggleMode = () => { - if (!mode) { - return; - } - - if ((0,_helpers_window_exists__WEBPACK_IMPORTED_MODULE_2__["default"])()) { - document.documentElement.classList.toggle('dark'); - } - - savePreference(mode); - setMode(mode == 'dark' ? 'light' : 'dark'); - }; - - if (usePreferences) { - (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => { - const userPreference = (0,_helpers_window_exists__WEBPACK_IMPORTED_MODULE_2__["default"])() && !!window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches; - const userMode = localStorage.getItem('theme') || (userPreference ? 'dark' : 'light'); - - if (userMode) { - setMode(userMode); - } - }, []); - (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => { - if (!mode) { - return; - } - - savePreference(mode); - - if (!(0,_helpers_window_exists__WEBPACK_IMPORTED_MODULE_2__["default"])()) { - return; - } - - if (mode != 'dark') { - document.documentElement.classList.remove('dark'); - } else { - document.documentElement.classList.add('dark'); - } - }, [mode]); - } - - return [mode, setMode, toggleMode]; -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Flowbite/index.js": -/*!**************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Flowbite/index.js ***! - \**************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Flowbite": () => (/* binding */ Flowbite) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_mergeDeep__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/mergeDeep */ "./node_modules/flowbite-react/lib/esm/helpers/mergeDeep.js"); -/* harmony import */ var _helpers_window_exists__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../helpers/window-exists */ "./node_modules/flowbite-react/lib/esm/helpers/window-exists.js"); -/* harmony import */ var _theme_default__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../theme/default */ "./node_modules/flowbite-react/lib/esm/theme/default.js"); -/* harmony import */ var _ThemeContext__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - - - - -const Flowbite = _ref => { - let { - children, - theme = {} - } = _ref; - const { - theme: customTheme = {}, - dark, - usePreferences = true - } = theme; - const [mode, setMode, toggleMode] = (0,_ThemeContext__WEBPACK_IMPORTED_MODULE_5__.useThemeMode)(usePreferences); - const mergedTheme = (0,_helpers_mergeDeep__WEBPACK_IMPORTED_MODULE_2__.mergeDeep)(_theme_default__WEBPACK_IMPORTED_MODULE_4__["default"], customTheme); - (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => { - if (dark) { - if (setMode != null) { - setMode('dark'); - } - - if ((0,_helpers_window_exists__WEBPACK_IMPORTED_MODULE_3__["default"])()) { - document.documentElement.classList.add('dark'); - } - } - }, [dark, setMode]); - const themeContextValue = (0,react__WEBPACK_IMPORTED_MODULE_1__.useMemo)(() => ({ - theme: mergedTheme, - mode, - toggleMode - }), [mode, toggleMode, mergedTheme]); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_ThemeContext__WEBPACK_IMPORTED_MODULE_5__.ThemeContext.Provider, { - value: themeContextValue, - children: children - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Footer/FooterBrand.js": -/*!******************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Footer/FooterBrand.js ***! - \******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "FooterBrand": () => (/* binding */ FooterBrand) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - -const FooterBrand = _ref => { - let { - alt, - children, - href, - name, - src - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_1__.useTheme)().theme.footer.brand; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - children: href ? (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("a", { - "data-testid": "flowbite-footer-brand", - href: href, - className: theme.base, - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { - alt: alt, - src: src, - className: theme.img - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - "data-testid": "flowbite-footer-brand-span", - className: theme.span, - children: name - }), children] - }) : (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { - alt: alt, - "data-testid": "flowbite-footer-brand", - src: src, - className: theme.img - }) - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Footer/FooterCopyright.js": -/*!**********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Footer/FooterCopyright.js ***! - \**********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "FooterCopyright": () => (/* binding */ FooterCopyright) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - -const FooterCopyright = _ref => { - let { - href, - by, - year - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_1__.useTheme)().theme.footer.copyright; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("span", { - className: theme.base, - "data-testid": "flowbite-footer-copyright", - children: ["\u00A9 ", year, href ? (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("a", { - href: href, - className: theme.href, - children: by - }) : (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - "data-testid": "flowbite-footer-copyright-span", - className: theme.span, - children: by - })] - }) - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Footer/FooterDivider.js": -/*!********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Footer/FooterDivider.js ***! - \********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "FooterDivider": () => (/* binding */ FooterDivider) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - -const FooterDivider = () => { - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_1__.useTheme)().theme.footer.divider; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("hr", { - "data-testid": "footer-divider", - className: theme.base - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Footer/FooterIcon.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Footer/FooterIcon.js ***! - \*****************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "FooterIcon": () => (/* binding */ FooterIcon) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - -const FooterIcon = _ref => { - let { - href, - ariaLabel, - icon: Icon - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_1__.useTheme)().theme.footer.icon; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - children: href ? (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("a", { - "aria-label": ariaLabel, - "data-testid": "flowbite-footer-icon", - href: href, - className: theme.base, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Icon, { - className: theme.size - }) - }) : (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Icon, { - "data-testid": "flowbite-footer-icon", - className: theme.size - }) - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Footer/FooterLink.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Footer/FooterLink.js ***! - \*****************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "FooterLink": () => (/* binding */ FooterLink) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - -const FooterLink = _ref => { - let { - children, - href - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_1__.useTheme)().theme.footer.groupLink.link; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("li", { - className: theme.base, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("a", { - href: href, - className: theme.href, - children: children - }) - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Footer/FooterLinkGroup.js": -/*!**********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Footer/FooterLinkGroup.js ***! - \**********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "FooterLinkGroup": () => (/* binding */ FooterLinkGroup) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - -const FooterLinkGroup = _ref => { - let { - children, - col = false - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__.useTheme)().theme.footer.groupLink; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("ul", { - "data-testid": "footer-groupLink", - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, col && theme.col), - children: children - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Footer/FooterTitle.js": -/*!******************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Footer/FooterTitle.js ***! - \******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "FooterTitle": () => (/* binding */ FooterTitle) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - -const FooterTitle = _ref => { - let { - title - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_1__.useTheme)().theme.footer.title; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("h2", { - "data-testid": "flowbite-footer-title", - className: theme.base, - children: title - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Footer/index.js": -/*!************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Footer/index.js ***! - \************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Footer": () => (/* binding */ Footer), -/* harmony export */ "FooterComponent": () => (/* binding */ FooterComponent) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _FooterBrand__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./FooterBrand */ "./node_modules/flowbite-react/lib/esm/components/Footer/FooterBrand.js"); -/* harmony import */ var _FooterCopyright__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./FooterCopyright */ "./node_modules/flowbite-react/lib/esm/components/Footer/FooterCopyright.js"); -/* harmony import */ var _FooterDivider__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./FooterDivider */ "./node_modules/flowbite-react/lib/esm/components/Footer/FooterDivider.js"); -/* harmony import */ var _FooterIcon__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./FooterIcon */ "./node_modules/flowbite-react/lib/esm/components/Footer/FooterIcon.js"); -/* harmony import */ var _FooterLink__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./FooterLink */ "./node_modules/flowbite-react/lib/esm/components/Footer/FooterLink.js"); -/* harmony import */ var _FooterLinkGroup__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./FooterLinkGroup */ "./node_modules/flowbite-react/lib/esm/components/Footer/FooterLinkGroup.js"); -/* harmony import */ var _FooterTitle__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./FooterTitle */ "./node_modules/flowbite-react/lib/esm/components/Footer/FooterTitle.js"); - - - - - - - - - - -const FooterComponent = _ref => { - let { - children, - bgDark = false, - container = false - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__.useTheme)().theme.footer; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("footer", { - "data-testid": "flowbite-footer", - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, bgDark && theme.bgDark, container && theme.container), - children: children - }); -}; -FooterComponent.displayName = 'Footer'; -_FooterCopyright__WEBPACK_IMPORTED_MODULE_4__.FooterCopyright.displayName = 'Footer.Copyright'; -_FooterLink__WEBPACK_IMPORTED_MODULE_7__.FooterLink.displayName = 'Footer.Link'; -_FooterBrand__WEBPACK_IMPORTED_MODULE_3__.FooterBrand.displayName = 'Footer.Brand'; -_FooterLinkGroup__WEBPACK_IMPORTED_MODULE_8__.FooterLinkGroup.displayName = 'Footer.LinkGroup'; -_FooterIcon__WEBPACK_IMPORTED_MODULE_6__.FooterIcon.displayName = 'Footer.Icon'; -_FooterTitle__WEBPACK_IMPORTED_MODULE_9__.FooterTitle.displayName = 'Footer.Title'; -_FooterDivider__WEBPACK_IMPORTED_MODULE_5__.FooterDivider.displayName = 'Footer.Divider'; -const Footer = Object.assign(FooterComponent, { - Copyright: _FooterCopyright__WEBPACK_IMPORTED_MODULE_4__.FooterCopyright, - Link: _FooterLink__WEBPACK_IMPORTED_MODULE_7__.FooterLink, - LinkGroup: _FooterLinkGroup__WEBPACK_IMPORTED_MODULE_8__.FooterLinkGroup, - Brand: _FooterBrand__WEBPACK_IMPORTED_MODULE_3__.FooterBrand, - Icon: _FooterIcon__WEBPACK_IMPORTED_MODULE_6__.FooterIcon, - Title: _FooterTitle__WEBPACK_IMPORTED_MODULE_9__.FooterTitle, - Divider: _FooterDivider__WEBPACK_IMPORTED_MODULE_5__.FooterDivider -}); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/FormControls/Checkbox.js": -/*!*********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/FormControls/Checkbox.js ***! - \*********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Checkbox": () => (/* binding */ Checkbox) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - - -const Checkbox = (0,react__WEBPACK_IMPORTED_MODULE_1__.forwardRef)((props, ref) => { - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.formControls.checkbox; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("input", { - ref: ref, - className: theme.base, - type: "checkbox", - ...theirProps - }); -}); -Checkbox.displayName = 'Checkbox'; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/FormControls/FileInput.js": -/*!**********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/FormControls/FileInput.js ***! - \**********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "FileInput": () => (/* binding */ FileInput) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _HelperText__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./HelperText */ "./node_modules/flowbite-react/lib/esm/components/FormControls/HelperText.js"); - - - - - - -const FileInput = (0,react__WEBPACK_IMPORTED_MODULE_2__.forwardRef)((_ref, ref) => { - let { - sizing = 'md', - helperText, - color = 'gray', - ...props - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__.useTheme)().theme.formControls.fileInput; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_3__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme.base, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme.field.base, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("input", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.field.input.base, theme.field.input.colors[color], theme.field.input.sizes[sizing]), - ...theirProps, - type: "file", - ref: ref - }) - }) - }), helperText && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_HelperText__WEBPACK_IMPORTED_MODULE_5__["default"], { - color: color, - children: helperText - })] - }); -}); -FileInput.displayName = 'FileInput'; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/FormControls/HelperText.js": -/*!***********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/FormControls/HelperText.js ***! - \***********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - - - -const HelperText = _ref => { - let { - value, - children, - color = 'default', - ...props - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.formControls.helperText; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("p", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, theme.colors[color]), - ...theirProps, - children: value ?? children ?? '' - }); -}; - -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (HelperText); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/FormControls/Label.js": -/*!******************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/FormControls/Label.js ***! - \******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Label": () => (/* binding */ Label) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - - -const Label = _ref => { - let { - children, - color = 'default', - disabled = false, - value, - ...props - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.formControls.label; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("label", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, theme.colors[color], disabled ?? theme.disabled), - ...theirProps, - children: value ?? children ?? '' - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/FormControls/Radio.js": -/*!******************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/FormControls/Radio.js ***! - \******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Radio": () => (/* binding */ Radio) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - - -const Radio = (0,react__WEBPACK_IMPORTED_MODULE_1__.forwardRef)((props, ref) => { - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.formControls.radio; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("input", { - ref: ref, - className: theme.base, - type: "radio", - ...theirProps - }); -}); -Radio.displayName = 'Radio'; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/FormControls/Select.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/FormControls/Select.js ***! - \*******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Select": () => (/* binding */ Select) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _HelperText__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./HelperText */ "./node_modules/flowbite-react/lib/esm/components/FormControls/HelperText.js"); - - - - - - -const Select = (0,react__WEBPACK_IMPORTED_MODULE_2__.forwardRef)((_ref, ref) => { - let { - children, - sizing = 'md', - shadow, - helperText, - addon, - icon: Icon, - color = 'gray', - ...props - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__.useTheme)().theme.formControls.select; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_3__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { - className: theme.base, - children: [addon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - className: theme.addon, - children: addon - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { - className: theme.field.base, - children: [Icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme.field.icon.base, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Icon, { - className: theme.field.icon.svg - }) - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("select", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.field.select.base, theme.field.select.colors[color], theme.field.select.withIcon[Icon ? 'on' : 'off'], theme.field.select.withAddon[addon ? 'on' : 'off'], theme.field.select.withShadow[shadow ? 'on' : 'off'], theme.field.select.sizes[sizing]), - ...theirProps, - ref: ref, - children: children - }), helperText && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_HelperText__WEBPACK_IMPORTED_MODULE_5__["default"], { - color: color, - children: helperText - })] - })] - }); -}); -Select.displayName = 'Select'; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/FormControls/TextInput.js": -/*!**********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/FormControls/TextInput.js ***! - \**********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TextInput": () => (/* binding */ TextInput) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _HelperText__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./HelperText */ "./node_modules/flowbite-react/lib/esm/components/FormControls/HelperText.js"); - - - - - - -const TextInput = (0,react__WEBPACK_IMPORTED_MODULE_2__.forwardRef)((_ref, ref) => { - let { - sizing = 'md', - shadow, - helperText, - addon, - icon: Icon, - color = 'gray', - ...props - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__.useTheme)().theme.formControls.textInput; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_3__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { - className: theme.base, - children: [addon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - className: theme.addon, - children: addon - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { - className: theme.field.base, - children: [Icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme.field.icon.base, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Icon, { - className: theme.field.icon.svg - }) - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("input", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.field.input.base, theme.field.input.colors[color], theme.field.input.withIcon[Icon ? 'on' : 'off'], theme.field.input.withAddon[addon ? 'on' : 'off'], theme.field.input.withShadow[shadow ? 'on' : 'off'], theme.field.input.sizes[sizing]), - ...theirProps, - ref: ref - })] - })] - }), helperText && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_HelperText__WEBPACK_IMPORTED_MODULE_5__["default"], { - color: color, - children: helperText - })] - }); -}); -TextInput.displayName = 'TextInput'; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/FormControls/Textarea.js": -/*!*********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/FormControls/Textarea.js ***! - \*********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Textarea": () => (/* binding */ Textarea) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _HelperText__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./HelperText */ "./node_modules/flowbite-react/lib/esm/components/FormControls/HelperText.js"); - - - - - - -const Textarea = (0,react__WEBPACK_IMPORTED_MODULE_2__.forwardRef)((_ref, ref) => { - let { - shadow, - helperText, - color = 'gray', - ...props - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__.useTheme)().theme.formControls.textarea; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_3__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("textarea", { - ref: ref, - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, theme.colors[color], theme.withShadow[shadow ? 'on' : 'off']), - ...theirProps - }), helperText && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_HelperText__WEBPACK_IMPORTED_MODULE_5__["default"], { - color: color, - children: helperText - })] - }); -}); -Textarea.displayName = 'Textarea'; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/FormControls/ToggleSwitch.js": -/*!*************************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/FormControls/ToggleSwitch.js ***! - \*************************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ToggleSwitch": () => (/* binding */ ToggleSwitch) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - - - -const ToggleSwitch = _ref => { - let { - checked, - disabled, - label, - name, - onChange, - ...props - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__.useTheme)().theme.formControls.toggleSwitch; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_3__.excludeClassName)(props); - const id = (0,react__WEBPACK_IMPORTED_MODULE_2__.useId)(); - - const toggle = () => onChange(!checked); - - const handleClick = event => { - event.preventDefault(); - toggle(); - }; - - const handleKeyPress = event => { - event.preventDefault(); - }; - - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { - children: [name && checked && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("input", { - checked: checked, - hidden: true, - name: name, - readOnly: true, - type: "checkbox", - className: "sr-only" - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("button", { - "aria-checked": checked, - "aria-labelledby": `${id}-flowbite-toggleswitch-label`, - disabled: disabled, - id: `${id}-flowbite-toggleswitch`, - onClick: handleClick, - onKeyPress: handleKeyPress, - role: "switch", - tabIndex: 0, - type: "button", - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, theme.active[disabled ? 'off' : 'on']), - ...theirProps, - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.toggle.base, theme.toggle.checked[checked ? 'on' : 'off']) - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - "data-testid": "flowbite-toggleswitch-label", - id: `${id}-flowbite-toggleswitch-label`, - className: theme.label, - children: label - })] - })] - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/FormControls/index.js": -/*!******************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/FormControls/index.js ***! - \******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Checkbox": () => (/* reexport safe */ _Checkbox__WEBPACK_IMPORTED_MODULE_0__.Checkbox), -/* harmony export */ "FileInput": () => (/* reexport safe */ _FileInput__WEBPACK_IMPORTED_MODULE_1__.FileInput), -/* harmony export */ "Label": () => (/* reexport safe */ _Label__WEBPACK_IMPORTED_MODULE_3__.Label), -/* harmony export */ "Radio": () => (/* reexport safe */ _Radio__WEBPACK_IMPORTED_MODULE_4__.Radio), -/* harmony export */ "Select": () => (/* reexport safe */ _Select__WEBPACK_IMPORTED_MODULE_5__.Select), -/* harmony export */ "TextInput": () => (/* reexport safe */ _TextInput__WEBPACK_IMPORTED_MODULE_7__.TextInput), -/* harmony export */ "Textarea": () => (/* reexport safe */ _Textarea__WEBPACK_IMPORTED_MODULE_6__.Textarea), -/* harmony export */ "ToggleSwitch": () => (/* reexport safe */ _ToggleSwitch__WEBPACK_IMPORTED_MODULE_8__.ToggleSwitch) -/* harmony export */ }); -/* harmony import */ var _Checkbox__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Checkbox */ "./node_modules/flowbite-react/lib/esm/components/FormControls/Checkbox.js"); -/* harmony import */ var _FileInput__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./FileInput */ "./node_modules/flowbite-react/lib/esm/components/FormControls/FileInput.js"); -/* harmony import */ var _HelperText__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./HelperText */ "./node_modules/flowbite-react/lib/esm/components/FormControls/HelperText.js"); -/* harmony import */ var _Label__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Label */ "./node_modules/flowbite-react/lib/esm/components/FormControls/Label.js"); -/* harmony import */ var _Radio__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Radio */ "./node_modules/flowbite-react/lib/esm/components/FormControls/Radio.js"); -/* harmony import */ var _Select__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Select */ "./node_modules/flowbite-react/lib/esm/components/FormControls/Select.js"); -/* harmony import */ var _Textarea__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Textarea */ "./node_modules/flowbite-react/lib/esm/components/FormControls/Textarea.js"); -/* harmony import */ var _TextInput__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./TextInput */ "./node_modules/flowbite-react/lib/esm/components/FormControls/TextInput.js"); -/* harmony import */ var _ToggleSwitch__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./ToggleSwitch */ "./node_modules/flowbite-react/lib/esm/components/FormControls/ToggleSwitch.js"); - - - - - - - - - - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/ListGroup/ListGroupItem.js": -/*!***********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/ListGroup/ListGroupItem.js ***! - \***********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ListGroupItem": () => (/* binding */ ListGroupItem) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - - -const ListGroupItem = _ref => { - let { - active: isActive, - children, - href, - icon: Icon, - onClick, - ...props - } = _ref; - const isLink = typeof href !== 'undefined'; - const Component = isLink ? 'a' : 'button'; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.listGroup.item; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("li", { - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(Component, { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.active[isActive ? 'on' : 'off'], theme.base, theme.href[isLink ? 'on' : 'off']), - href: href, - onClick: onClick, - type: isLink ? undefined : 'button', - ...theirProps, - children: [Icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Icon, { - "aria-hidden": true, - className: theme.icon, - "data-testid": "flowbite-list-group-item-icon" - }), children] - }) - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/ListGroup/index.js": -/*!***************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/ListGroup/index.js ***! - \***************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ListGroup": () => (/* binding */ ListGroup) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _ListGroupItem__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ListGroupItem */ "./node_modules/flowbite-react/lib/esm/components/ListGroup/ListGroupItem.js"); - - - - - -const ListGroupComponent = _ref => { - let { - children, - ...props - } = _ref; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_1__.excludeClassName)(props); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__.useTheme)().theme.listGroup.base; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("ul", { - className: theme, - ...theirProps, - children: children - }); -}; - -ListGroupComponent.displayName = 'ListGroup'; -_ListGroupItem__WEBPACK_IMPORTED_MODULE_3__.ListGroupItem.displayName = 'ListGroup.Item'; -const ListGroup = Object.assign(ListGroupComponent, { - Item: _ListGroupItem__WEBPACK_IMPORTED_MODULE_3__.ListGroupItem -}); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Modal/ModalBody.js": -/*!***************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Modal/ModalBody.js ***! - \***************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ModalBody": () => (/* binding */ ModalBody) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _ModalContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ModalContext */ "./node_modules/flowbite-react/lib/esm/components/Modal/ModalContext.js"); - - - - - -const ModalBody = _ref => { - let { - children, - ...props - } = _ref; - const { - popup - } = (0,_ModalContext__WEBPACK_IMPORTED_MODULE_4__.useModalContext)(); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.modal.body; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, { - [theme.popup]: popup - }), - ...theirProps, - children: children - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Modal/ModalContext.js": -/*!******************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Modal/ModalContext.js ***! - \******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ModalContext": () => (/* binding */ ModalContext), -/* harmony export */ "useModalContext": () => (/* binding */ useModalContext) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); - -const ModalContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(undefined); -function useModalContext() { - const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(ModalContext); - - if (!context) { - throw new Error('useModalContext should be used within the ModalContext provider!'); - } - - return context; -} - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Modal/ModalFooter.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Modal/ModalFooter.js ***! - \*****************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ModalFooter": () => (/* binding */ ModalFooter) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _ModalContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ModalContext */ "./node_modules/flowbite-react/lib/esm/components/Modal/ModalContext.js"); - - - - - -const ModalFooter = _ref => { - let { - children, - ...props - } = _ref; - const { - popup - } = (0,_ModalContext__WEBPACK_IMPORTED_MODULE_4__.useModalContext)(); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.modal.footer; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, { - [theme.popup]: !popup - }), - ...theirProps, - children: children - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Modal/ModalHeader.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Modal/ModalHeader.js ***! - \*****************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ModalHeader": () => (/* binding */ ModalHeader) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react_icons_hi__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react-icons/hi */ "./node_modules/react-icons/hi/index.esm.js"); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _ModalContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ModalContext */ "./node_modules/flowbite-react/lib/esm/components/Modal/ModalContext.js"); - - - - - - -const ModalHeader = _ref => { - let { - children, - ...props - } = _ref; - const { - popup, - onClose - } = (0,_ModalContext__WEBPACK_IMPORTED_MODULE_4__.useModalContext)(); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.modal.header; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, { - [theme.popup]: popup - }), - ...theirProps, - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("h3", { - className: theme.title, - children: children - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("button", { - "aria-label": "Close", - className: theme.close.base, - type: "button", - onClick: onClose, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_icons_hi__WEBPACK_IMPORTED_MODULE_5__.HiOutlineX, { - "aria-hidden": true, - className: theme.close.icon - }) - })] - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Modal/index.js": -/*!***********************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Modal/index.js ***! - \***********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Modal": () => (/* binding */ Modal) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js"); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _helpers_window_exists__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../helpers/window-exists */ "./node_modules/flowbite-react/lib/esm/helpers/window-exists.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _ModalBody__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ModalBody */ "./node_modules/flowbite-react/lib/esm/components/Modal/ModalBody.js"); -/* harmony import */ var _ModalContext__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./ModalContext */ "./node_modules/flowbite-react/lib/esm/components/Modal/ModalContext.js"); -/* harmony import */ var _ModalFooter__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ModalFooter */ "./node_modules/flowbite-react/lib/esm/components/Modal/ModalFooter.js"); -/* harmony import */ var _ModalHeader__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./ModalHeader */ "./node_modules/flowbite-react/lib/esm/components/Modal/ModalHeader.js"); - - - - - - - - - - - - -const ModalComponent = _ref => { - let { - children, - root = (0,_helpers_window_exists__WEBPACK_IMPORTED_MODULE_5__["default"])() ? document.body : undefined, - show, - popup, - size = '2xl', - position = 'center', - onClose, - ...props - } = _ref; - const [container] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)((0,_helpers_window_exists__WEBPACK_IMPORTED_MODULE_5__["default"])() ? document.createElement('div') : undefined); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_6__.useTheme)().theme.modal; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_4__.excludeClassName)(props); - (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => { - if (!container || !root || !show) { - return; - } - - root.appendChild(container); - return () => { - root.removeChild(container); - }; - }, [container, root, show]); - return container ? (0,react_dom__WEBPACK_IMPORTED_MODULE_3__.createPortal)((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_ModalContext__WEBPACK_IMPORTED_MODULE_8__.ModalContext.Provider, { - value: { - popup, - onClose - }, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - "aria-hidden": !show, - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, theme.positions[position], show ? theme.show.on : theme.show.off), - "data-testid": "modal", - role: "dialog", - ...theirProps, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.content.base, theme.sizes[size]), - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme.content.inner, - children: children - }) - }) - }) - }), container) : null; -}; - -ModalComponent.displayName = 'Modal'; -_ModalHeader__WEBPACK_IMPORTED_MODULE_10__.ModalHeader.displayName = 'Modal.Header'; -_ModalBody__WEBPACK_IMPORTED_MODULE_7__.ModalBody.displayName = 'Modal.Body'; -_ModalFooter__WEBPACK_IMPORTED_MODULE_9__.ModalFooter.displayName = 'Modal.Footer'; -const Modal = Object.assign(ModalComponent, { - Header: _ModalHeader__WEBPACK_IMPORTED_MODULE_10__.ModalHeader, - Body: _ModalBody__WEBPACK_IMPORTED_MODULE_7__.ModalBody, - Footer: _ModalFooter__WEBPACK_IMPORTED_MODULE_9__.ModalFooter -}); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Navbar/NavbarBrand.js": -/*!******************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Navbar/NavbarBrand.js ***! - \******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "NavbarBrand": () => (/* binding */ NavbarBrand) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - -const NavbarBrand = _ref => { - let { - children, - href, - ...props - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__.useTheme)().theme.navbar; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_1__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("a", { - href: href, - className: theme.brand, - ...theirProps, - children: children - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Navbar/NavbarCollapse.js": -/*!*********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Navbar/NavbarCollapse.js ***! - \*********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "NavbarCollapse": () => (/* binding */ NavbarCollapse) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _NavbarContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./NavbarContext */ "./node_modules/flowbite-react/lib/esm/components/Navbar/NavbarContext.js"); - - - - - -const NavbarCollapse = _ref => { - let { - children, - ...props - } = _ref; - const { - isOpen - } = (0,_NavbarContext__WEBPACK_IMPORTED_MODULE_4__.useNavbarContext)(); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.navbar.collapse; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, theme.hidden[!isOpen ? 'on' : 'off']), - "data-testid": "flowbite-navbar-collapse", - ...theirProps, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("ul", { - className: theme.list, - children: children - }) - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Navbar/NavbarContext.js": -/*!********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Navbar/NavbarContext.js ***! - \********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "NavbarContext": () => (/* binding */ NavbarContext), -/* harmony export */ "useNavbarContext": () => (/* binding */ useNavbarContext) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); - -const NavbarContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(undefined); -function useNavbarContext() { - const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(NavbarContext); - - if (!context) { - throw new Error('useNavBarContext should be used within the NavbarContext provider!'); - } - - return context; -} - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Navbar/NavbarLink.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Navbar/NavbarLink.js ***! - \*****************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "NavbarLink": () => (/* binding */ NavbarLink) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - - -const NavbarLink = _ref => { - let { - active, - disabled, - href, - children, - ...props - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.navbar.link; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("li", { - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("a", { - href: href, - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, { - [theme.active.on]: active, - [theme.active.off]: !active && !disabled - }, theme.disabled[disabled ? 'on' : 'off']), - ...theirProps, - children: children - }) - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Navbar/NavbarToggle.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Navbar/NavbarToggle.js ***! - \*******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "NavbarToggle": () => (/* binding */ NavbarToggle) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var react_icons_go__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-icons/go */ "./node_modules/react-icons/go/index.esm.js"); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _NavbarContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./NavbarContext */ "./node_modules/flowbite-react/lib/esm/components/Navbar/NavbarContext.js"); - - - - - -const NavbarToggle = _ref => { - let { - barIcon: BarIcon = react_icons_go__WEBPACK_IMPORTED_MODULE_4__.GoThreeBars, - ...props - } = _ref; - const { - isOpen, - setIsOpen - } = (0,_NavbarContext__WEBPACK_IMPORTED_MODULE_3__.useNavbarContext)(); - - const handleClick = () => { - setIsOpen(!isOpen); - }; - - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__.useTheme)().theme.navbar.toggle; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_1__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("button", { - className: theme.base, - "data-testid": "flowbite-navbar-toggle", - onClick: handleClick, - ...theirProps, - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - className: "sr-only", - children: "Open main menu" - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(BarIcon, { - className: theme.icon - })] - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Navbar/index.js": -/*!************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Navbar/index.js ***! - \************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Navbar": () => (/* binding */ Navbar) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _NavbarBrand__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./NavbarBrand */ "./node_modules/flowbite-react/lib/esm/components/Navbar/NavbarBrand.js"); -/* harmony import */ var _NavbarCollapse__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./NavbarCollapse */ "./node_modules/flowbite-react/lib/esm/components/Navbar/NavbarCollapse.js"); -/* harmony import */ var _NavbarContext__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./NavbarContext */ "./node_modules/flowbite-react/lib/esm/components/Navbar/NavbarContext.js"); -/* harmony import */ var _NavbarLink__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./NavbarLink */ "./node_modules/flowbite-react/lib/esm/components/Navbar/NavbarLink.js"); -/* harmony import */ var _NavbarToggle__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./NavbarToggle */ "./node_modules/flowbite-react/lib/esm/components/Navbar/NavbarToggle.js"); - - - - - - - - - - - -const NavbarComponent = _ref => { - let { - children, - menuOpen, - fluid = false, - rounded, - border, - ...props - } = _ref; - const [isOpen, setIsOpen] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(menuOpen); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__.useTheme)().theme.navbar; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_3__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_NavbarContext__WEBPACK_IMPORTED_MODULE_7__.NavbarContext.Provider, { - value: { - isOpen, - setIsOpen - }, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("nav", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, theme.bordered[border ? 'on' : 'off'], theme.rounded[rounded ? 'on' : 'off']), - ...theirProps, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.inner.base, theme.inner.fluid[fluid ? 'on' : 'off']), - children: children - }) - }) - }); -}; - -NavbarComponent.displayName = 'Navbar'; -_NavbarBrand__WEBPACK_IMPORTED_MODULE_5__.NavbarBrand.displayName = 'Navbar.Brand'; -_NavbarCollapse__WEBPACK_IMPORTED_MODULE_6__.NavbarCollapse.displayName = 'Navbar.Collapse'; -_NavbarLink__WEBPACK_IMPORTED_MODULE_8__.NavbarLink.displayName = 'Navbar.Link'; -_NavbarToggle__WEBPACK_IMPORTED_MODULE_9__.NavbarToggle.displayName = 'Navbar.Toggle'; -const Navbar = Object.assign(NavbarComponent, { - Brand: _NavbarBrand__WEBPACK_IMPORTED_MODULE_5__.NavbarBrand, - Collapse: _NavbarCollapse__WEBPACK_IMPORTED_MODULE_6__.NavbarCollapse, - Link: _NavbarLink__WEBPACK_IMPORTED_MODULE_8__.NavbarLink, - Toggle: _NavbarToggle__WEBPACK_IMPORTED_MODULE_9__.NavbarToggle -}); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Pagination/index.js": -/*!****************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Pagination/index.js ***! - \****************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Pagination": () => (/* binding */ Pagination) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react_icons_hi__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react-icons/hi */ "./node_modules/react-icons/hi/index.esm.js"); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _helpers_range__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../helpers/range */ "./node_modules/flowbite-react/lib/esm/helpers/range.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - - - - -const Pagination = _ref => { - let { - currentPage, - layout = 'pagination', - onPageChange, - showIcons: showIcon = false, - totalPages, - ...props - } = _ref; - const firstPage = Math.max(1, currentPage - 3); - const lastPage = Math.min(currentPage + 3, totalPages); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__.useTheme)().theme.pagination; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - - const goToNextPage = () => { - onPageChange(Math.min(currentPage + 1, totalPages)); - }; - - const goToPreviousPage = () => { - onPageChange(Math.max(currentPage - 1, 1)); - }; - - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("nav", { - className: theme.base, - ...theirProps, - children: [layout === 'table' && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { - className: theme.layout.table.base, - children: ["Showing ", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - className: theme.layout.table.span, - children: firstPage - }), " to\u00A0", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - className: theme.layout.table.span, - children: lastPage - }), " of\u00A0", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - className: theme.layout.table.span, - children: totalPages - }), " Entries"] - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("ul", { - className: theme.pages.base, - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("li", { - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("button", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.pages.previous.base, showIcon && theme.pages.showIcon), - onClick: () => goToPreviousPage(), - children: [showIcon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_icons_hi__WEBPACK_IMPORTED_MODULE_5__.HiChevronLeft, { - "aria-hidden": true, - className: theme.pages.previous.icon - }), "Previous"] - }) - }), layout === 'pagination' && (0,_helpers_range__WEBPACK_IMPORTED_MODULE_3__["default"])(firstPage, lastPage).map(page => (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("li", { - "aria-current": page === currentPage ? 'page' : undefined, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("button", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.pages.selector.base, { - [theme.pages.selector.active]: currentPage === page - }), - onClick: () => onPageChange(page), - children: page - }) - }, page)), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("li", { - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("button", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.pages.next.base, showIcon && theme.pages.showIcon), - onClick: () => goToNextPage(), - children: ["Next", showIcon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_icons_hi__WEBPACK_IMPORTED_MODULE_5__.HiChevronRight, { - "aria-hidden": true, - className: theme.pages.showIcon - })] - }) - })] - })] - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Progress/index.js": -/*!**************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Progress/index.js ***! - \**************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Progress": () => (/* binding */ Progress) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - - - -const Progress = _ref => { - let { - color = 'blue', - label = 'progressbar', - labelPosition = 'none', - labelProgress = false, - progress, - size = 'md', - ...props - } = _ref; - const id = (0,react__WEBPACK_IMPORTED_MODULE_2__.useId)(); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__.useTheme)().theme.progress; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_3__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { - id: id, - "aria-label": label, - "aria-valuenow": progress, - role: "progressbar", - ...theirProps, - children: [label && labelPosition === 'outside' && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { - className: theme.label, - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - children: label - }), labelProgress && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("span", { - children: [progress, "%"] - })] - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, theme.size[size]), - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.bar, theme.color[color], theme.size[size]), - style: { - width: `${progress}%` - }, - children: label && labelPosition === 'inside' && label - }) - })] - }) - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Rating/RatingAdvanced.js": -/*!*********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Rating/RatingAdvanced.js ***! - \*********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "RatingAdvanced": () => (/* binding */ RatingAdvanced) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - -const RatingAdvanced = _ref => { - let { - percentFilled = 0, - children, - ...props - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__.useTheme)().theme.rating.advanced; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_1__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { - className: theme.base, - ...theirProps, - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - className: theme.label, - children: children - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme.progress.base, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme.progress.fill, - "data-testid": "flowbite-rating-fill", - style: { - width: `${percentFilled}%` - } - }) - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - className: theme.progress.label, - children: `${percentFilled}%` - })] - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Rating/RatingContext.js": -/*!********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Rating/RatingContext.js ***! - \********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "RatingContext": () => (/* binding */ RatingContext), -/* harmony export */ "useRatingContext": () => (/* binding */ useRatingContext) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); - -const RatingContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(undefined); -function useRatingContext() { - const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(RatingContext); - - if (!context) { - throw new Error('useRatingContext should be used within the RatingContext provider!'); - } - - return context; -} - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Rating/RatingStar.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Rating/RatingStar.js ***! - \*****************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "RatingStar": () => (/* binding */ RatingStar) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react_icons_hi__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-icons/hi */ "./node_modules/react-icons/hi/index.esm.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _RatingContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./RatingContext */ "./node_modules/flowbite-react/lib/esm/components/Rating/RatingContext.js"); - - - - - -const RatingStar = _ref => { - let { - filled = true, - starIcon: Icon = react_icons_hi__WEBPACK_IMPORTED_MODULE_4__.HiStar - } = _ref; - const { - size = 'sm' - } = (0,_RatingContext__WEBPACK_IMPORTED_MODULE_3__.useRatingContext)(); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__.useTheme)().theme.rating.star; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Icon, { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.sizes[size], theme[filled ? 'filled' : 'empty']), - "data-testid": "flowbite-rating-star" - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Rating/index.js": -/*!************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Rating/index.js ***! - \************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Rating": () => (/* binding */ Rating) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _RatingAdvanced__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./RatingAdvanced */ "./node_modules/flowbite-react/lib/esm/components/Rating/RatingAdvanced.js"); -/* harmony import */ var _RatingContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./RatingContext */ "./node_modules/flowbite-react/lib/esm/components/Rating/RatingContext.js"); -/* harmony import */ var _RatingStar__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./RatingStar */ "./node_modules/flowbite-react/lib/esm/components/Rating/RatingStar.js"); - - - - - - - -const RatingComponent = _ref => { - let { - children, - size = 'sm', - ...props - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__.useTheme)().theme.rating; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_1__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_RatingContext__WEBPACK_IMPORTED_MODULE_4__.RatingContext.Provider, { - value: { - size - }, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme.base, - ...theirProps, - children: children - }) - }); -}; - -RatingComponent.displayName = 'Rating'; -_RatingStar__WEBPACK_IMPORTED_MODULE_5__.RatingStar.displayName = 'Rating.Star'; -_RatingAdvanced__WEBPACK_IMPORTED_MODULE_3__.RatingAdvanced.displayName = 'Rating.Advanced'; -const Rating = Object.assign(RatingComponent, { - Star: _RatingStar__WEBPACK_IMPORTED_MODULE_5__.RatingStar, - Advanced: _RatingAdvanced__WEBPACK_IMPORTED_MODULE_3__.RatingAdvanced -}); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarCTA.js": -/*!******************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarCTA.js ***! - \******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _SidebarContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./SidebarContext */ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarContext.js"); - - - - - - -const SidebarCTA = _ref => { - let { - children, - color = 'info', - ...props - } = _ref; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - const { - isCollapsed - } = (0,_SidebarContext__WEBPACK_IMPORTED_MODULE_4__.useSidebarContext)(); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.sidebar.cta; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, theme.color[color]), - "data-testid": "sidebar-cta", - hidden: isCollapsed, - ...theirProps, - children: children - }); -}; - -SidebarCTA.displayName = 'Sidebar.CTA'; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SidebarCTA); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarCollapse.js": -/*!***********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarCollapse.js ***! - \***********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var react_icons_hi__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react-icons/hi */ "./node_modules/react-icons/hi/index.esm.js"); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _Tooltip__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Tooltip */ "./node_modules/flowbite-react/lib/esm/components/Tooltip/index.js"); -/* harmony import */ var _SidebarContext__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./SidebarContext */ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarContext.js"); -/* harmony import */ var _SidebarItemContext__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./SidebarItemContext */ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarItemContext.js"); - - - - - - - - - - -const SidebarCollapse = _ref => { - let { - children, - icon: Icon, - label, - ...props - } = _ref; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_3__.excludeClassName)(props); - const id = (0,react__WEBPACK_IMPORTED_MODULE_2__.useId)(); - const { - isCollapsed - } = (0,_SidebarContext__WEBPACK_IMPORTED_MODULE_6__.useSidebarContext)(); - const [isOpen, setOpen] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(false); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__.useTheme)().theme.sidebar.collapse; - - const Wrapper = _ref2 => { - let { - children - } = _ref2; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("li", { - children: isCollapsed ? (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Tooltip__WEBPACK_IMPORTED_MODULE_5__.Tooltip, { - content: label, - placement: "right", - children: children - }) : children - }); - }; - - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(Wrapper, { - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("button", { - className: theme.button, - id: `flowbite-sidebar-collapse-${id}`, - onClick: () => setOpen(!isOpen), - type: "button", - ...theirProps, - children: [Icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Icon, { - "aria-hidden": true, - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.icon.base, theme.icon.open[isOpen ? 'on' : 'off']), - "data-testid": "flowbite-sidebar-collapse-icon" - }), isCollapsed ? (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - className: "sr-only", - children: label - }) : (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - className: theme.label.base, - "data-testid": "flowbite-sidebar-collapse-label", - children: label - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_icons_hi__WEBPACK_IMPORTED_MODULE_8__.HiChevronDown, { - "aria-hidden": true, - className: theme.label.icon - })] - })] - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("ul", { - "aria-labelledby": `flowbite-sidebar-collapse-${id}`, - className: theme.list, - hidden: !isOpen, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_SidebarItemContext__WEBPACK_IMPORTED_MODULE_7__.SidebarItemContext.Provider, { - value: { - isInsideCollapse: true - }, - children: children - }) - })] - }); -}; - -SidebarCollapse.displayName = 'Sidebar.Collapse'; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SidebarCollapse); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarContext.js": -/*!**********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarContext.js ***! - \**********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "SidebarContext": () => (/* binding */ SidebarContext), -/* harmony export */ "useSidebarContext": () => (/* binding */ useSidebarContext) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); - -const SidebarContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(undefined); -function useSidebarContext() { - const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(SidebarContext); - - if (!context) { - throw new Error('useSidebarContext should be used within the SidebarContext provider!'); - } - - return context; -} - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarItem.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarItem.js ***! - \*******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Badge__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Badge */ "./node_modules/flowbite-react/lib/esm/components/Badge/index.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _Tooltip__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Tooltip */ "./node_modules/flowbite-react/lib/esm/components/Tooltip/index.js"); -/* harmony import */ var _SidebarContext__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./SidebarContext */ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarContext.js"); -/* harmony import */ var _SidebarItemContext__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./SidebarItemContext */ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarItemContext.js"); - - - - - - - - - - -const SidebarItem = _ref => { - let { - as: Component = 'a', - children, - icon: Icon, - active: isActive, - label, - labelColor = 'info', - ...props - } = _ref; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_3__.excludeClassName)(props); - const id = (0,react__WEBPACK_IMPORTED_MODULE_2__.useId)(); - const { - isCollapsed - } = (0,_SidebarContext__WEBPACK_IMPORTED_MODULE_7__.useSidebarContext)(); - const { - isInsideCollapse - } = (0,_SidebarItemContext__WEBPACK_IMPORTED_MODULE_8__.useSidebarItemContext)(); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_5__.useTheme)().theme.sidebar.item; - - const ListItem = _ref2 => { - let { - children: wrapperChildren - } = _ref2; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("li", { - children: isCollapsed ? (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Tooltip__WEBPACK_IMPORTED_MODULE_6__.Tooltip, { - content: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(TooltipContent, { - children: children - }), - placement: "right", - children: wrapperChildren - }) : wrapperChildren - }); - }; - - const TooltipContent = _ref3 => { - let { - children - } = _ref3; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Children, { - children: children - }); - }; - - const Children = _ref4 => { - let { - children - } = _ref4; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.content.base), - "data-testid": "flowbite-sidebar-item-content", - id: `flowbite-sidebar-item-${id}`, - children: children - }); - }; - - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(ListItem, { - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(Component, { - "aria-labelledby": `flowbite-sidebar-item-${id}`, - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, isActive && theme.active, !isCollapsed && isInsideCollapse && theme.collapsed.insideCollapse), - ...theirProps, - children: [Icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Icon, { - "aria-hidden": true, - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.icon.base, isActive && theme.icon.active), - "data-testid": "flowbite-sidebar-item-icon" - }), isCollapsed && !Icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - className: theme.collapsed.noIcon, - children: children.charAt(0).toLocaleUpperCase() ?? '?' - }), !isCollapsed && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Children, { - children: children - }), !isCollapsed && label && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Badge__WEBPACK_IMPORTED_MODULE_4__.Badge, { - color: labelColor, - "data-testid": "flowbite-sidebar-label", - hidden: isCollapsed, - children: label - })] - }) - }); -}; - -SidebarItem.displayName = 'Sidebar.Item'; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SidebarItem); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarItemContext.js": -/*!**************************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarItemContext.js ***! - \**************************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "SidebarItemContext": () => (/* binding */ SidebarItemContext), -/* harmony export */ "useSidebarItemContext": () => (/* binding */ useSidebarItemContext) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); - -const SidebarItemContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(undefined); -function useSidebarItemContext() { - const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(SidebarItemContext); - - if (!context) { - throw new Error('useSidebarItemContext should be used within the SidebarItemContext provider!'); - } - - return context; -} - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarItemGroup.js": -/*!************************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarItemGroup.js ***! - \************************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _SidebarItemContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./SidebarItemContext */ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarItemContext.js"); - - - - - -const SidebarItemGroup = _ref => { - let { - children, - ...props - } = _ref; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_1__.excludeClassName)(props); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__.useTheme)().theme.sidebar.itemGroup; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("ul", { - className: theme, - "data-testid": "flowbite-sidebar-item-group", - ...theirProps, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_SidebarItemContext__WEBPACK_IMPORTED_MODULE_3__.SidebarItemContext.Provider, { - value: { - isInsideCollapse: false - }, - children: children - }) - }); -}; - -SidebarItemGroup.displayName = 'Sidebar.ItemGroup'; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SidebarItemGroup); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarItems.js": -/*!********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarItems.js ***! - \********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - - -const SidebarItems = _ref => { - let { - children, - ...props - } = _ref; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_1__.excludeClassName)(props); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_2__.useTheme)().theme.sidebar.items; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme, - "data-testid": "flowbite-sidebar-items", - ...theirProps, - children: children - }); -}; - -SidebarItems.displayName = 'Sidebar.Items'; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SidebarItems); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarLogo.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarLogo.js ***! - \*******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _SidebarContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./SidebarContext */ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarContext.js"); - - - - - - -const SidebarLogo = _ref => { - let { - children, - href, - img, - imgAlt = '', - ...props - } = _ref; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - const id = (0,react__WEBPACK_IMPORTED_MODULE_1__.useId)(); - const { - isCollapsed - } = (0,_SidebarContext__WEBPACK_IMPORTED_MODULE_4__.useSidebarContext)(); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.sidebar.logo; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("a", { - "aria-labelledby": `flowbite-sidebar-logo-${id}`, - className: theme.base, - href: href, - ...theirProps, - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { - alt: imgAlt, - className: theme.img, - src: img - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - className: theme.collapsed[isCollapsed ? 'on' : 'off'], - id: `flowbite-sidebar-logo-${id}`, - children: children - })] - }); -}; - -SidebarLogo.displayName = 'Sidebar.Logo'; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SidebarLogo); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Sidebar/index.js": -/*!*************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Sidebar/index.js ***! - \*************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Sidebar": () => (/* binding */ Sidebar) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _SidebarCollapse__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./SidebarCollapse */ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarCollapse.js"); -/* harmony import */ var _SidebarContext__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./SidebarContext */ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarContext.js"); -/* harmony import */ var _SidebarCTA__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./SidebarCTA */ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarCTA.js"); -/* harmony import */ var _SidebarItem__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./SidebarItem */ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarItem.js"); -/* harmony import */ var _SidebarItemGroup__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./SidebarItemGroup */ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarItemGroup.js"); -/* harmony import */ var _SidebarItems__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./SidebarItems */ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarItems.js"); -/* harmony import */ var _SidebarLogo__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./SidebarLogo */ "./node_modules/flowbite-react/lib/esm/components/Sidebar/SidebarLogo.js"); - - - - - - - - - - - - -const SidebarComponent = _ref => { - let { - children, - collapseBehavior = 'collapse', - collapsed: isCollapsed = false, - ...props - } = _ref; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.sidebar; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_SidebarContext__WEBPACK_IMPORTED_MODULE_5__.SidebarContext.Provider, { - value: { - isCollapsed - }, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("aside", { - "aria-label": "Sidebar", - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, theme.collapsed[isCollapsed ? 'on' : 'off']), - hidden: isCollapsed && collapseBehavior === 'hide', - ...theirProps, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: theme.inner, - children: children - }) - }) - }); -}; - -SidebarComponent.displayName = 'Sidebar'; -const Sidebar = Object.assign(SidebarComponent, { - Collapse: _SidebarCollapse__WEBPACK_IMPORTED_MODULE_4__["default"], - CTA: _SidebarCTA__WEBPACK_IMPORTED_MODULE_6__["default"], - Item: _SidebarItem__WEBPACK_IMPORTED_MODULE_7__["default"], - Items: _SidebarItems__WEBPACK_IMPORTED_MODULE_9__["default"], - ItemGroup: _SidebarItemGroup__WEBPACK_IMPORTED_MODULE_8__["default"], - Logo: _SidebarLogo__WEBPACK_IMPORTED_MODULE_10__["default"] -}); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Spinner/index.js": -/*!*************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Spinner/index.js ***! - \*************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Spinner": () => (/* binding */ Spinner) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - - -const Spinner = _ref => { - let { - color = 'info', - light, - size = 'md', - ...props - } = _ref; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_2__.excludeClassName)(props); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.spinner; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - role: "status", - ...theirProps, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("svg", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, theme.color[color], theme.light[light ? 'on' : 'off'].base, theme.light[light ? 'on' : 'off'].color[color], theme.size[size]), - fill: "none", - viewBox: "0 0 100 101", - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { - d: "M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z", - fill: "currentColor" - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { - d: "M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z", - fill: "currentFill" - })] - }) - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Tab/TabItem.js": -/*!***********************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Tab/TabItem.js ***! - \***********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TabItem": () => (/* binding */ TabItem) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); - -const TabItem = _ref => { - let { - children - } = _ref; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { - children: children - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Tab/index.js": -/*!*********************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Tab/index.js ***! - \*********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Tabs": () => (/* binding */ Tabs), -/* harmony export */ "TabsComponent": () => (/* binding */ TabsComponent) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _TabItem__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./TabItem */ "./node_modules/flowbite-react/lib/esm/components/Tab/TabItem.js"); - - - - - - -const TabsComponent = _ref => { - let { - children, - style = 'default', - ...rest - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__.useTheme)().theme.tab; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_3__.excludeClassName)(rest); - const id = (0,react__WEBPACK_IMPORTED_MODULE_2__.useId)(); - const tabs = (0,react__WEBPACK_IMPORTED_MODULE_2__.useMemo)(() => react__WEBPACK_IMPORTED_MODULE_2__.Children.map(children, _ref2 => { - let { - props - } = _ref2; - return props; - }), [children]); - const tabRefs = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)([]); - const [activeTab, setActiveTab] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(Math.max(0, tabs.findIndex(tab => tab.active))); - const [focusedTab, setFocusedTab] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(Math.max(0, tabs.findIndex(tab => tab.active))); - - const handleClick = _ref3 => { - let { - target - } = _ref3; - setActiveTab(target); - setFocusedTab(target); - }; - - const handleKeyboard = _ref4 => { - let { - event, - target - } = _ref4; - - if (event.key === 'ArrowLeft') { - setFocusedTab(Math.max(0, focusedTab - 1)); - } - - if (event.key === 'ArrowRight') { - setFocusedTab(Math.min(tabs.length - 1, focusedTab + 1)); - } - - if (event.key === 'Enter') { - setActiveTab(target); - setFocusedTab(target); - } - }; - - (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => { - tabRefs.current[focusedTab]?.focus(); - }, [focusedTab]); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { - className: theme.base, - children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - "aria-label": "Tabs", - role: "tablist", - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.tablist.base, theme.tablist.styles[style]), - ...theirProps, - children: tabs.map((tab, index) => (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("button", { - type: "button", - "aria-controls": `${id}-tabpanel-${index}`, - "aria-selected": index === activeTab, - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.tablist.tabitem.base, theme.tablist.tabitem.styles[style], { - [theme.tablist.tabitem.styles[style].active.on]: index === activeTab, - [theme.tablist.tabitem.styles[style].active.off]: index !== activeTab && !tab.disabled - }), - disabled: tab.disabled, - id: `${id}-tab-${index}`, - onClick: () => handleClick({ - target: index - }), - onKeyDown: event => handleKeyboard({ - event, - target: index - }), - ref: element => tabRefs.current[index] = element, - role: "tab", - tabIndex: index === focusedTab ? 0 : -1, - children: [tab.icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(tab.icon, { - className: theme.tablist.tabitem.icon - }), tab.title] - }, index)) - }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - children: tabs.map((tab, index) => (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - "aria-labelledby": `${id}-tab-${index}`, - className: theme.tabpanel, - hidden: index !== activeTab, - id: `${id}-tabpanel-${index}`, - role: "tabpanel", - tabIndex: 0, - children: tab.children - }, index)) - })] - }); -}; -TabsComponent.displayName = 'Tabs.Group'; -_TabItem__WEBPACK_IMPORTED_MODULE_5__.TabItem.displayName = 'Tabs.Item'; -const Tabs = { - Group: TabsComponent, - Item: _TabItem__WEBPACK_IMPORTED_MODULE_5__.TabItem -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Table/TableBody.js": -/*!***************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Table/TableBody.js ***! - \***************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TableBody": () => (/* binding */ TableBody) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); - -const TableBody = _ref => { - let { - children, - ...props - } = _ref; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("tbody", { ...props, - children: children - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Table/TableCell.js": -/*!***************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Table/TableCell.js ***! - \***************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TableCell": () => (/* binding */ TableCell) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); - - -const TableCell = _ref => { - let { - children, - className, - ...props - } = _ref; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("td", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()('px-6 py-4', className), - ...props, - children: children - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Table/TableContext.js": -/*!******************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Table/TableContext.js ***! - \******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TableContext": () => (/* binding */ TableContext), -/* harmony export */ "useTableContext": () => (/* binding */ useTableContext) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); - -const TableContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(undefined); -function useTableContext() { - const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(TableContext); - - if (!context) { - throw new Error('useTableContext should be used within the TableContext provider!'); - } - - return context; -} - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Table/TableHead.js": -/*!***************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Table/TableHead.js ***! - \***************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TableHead": () => (/* binding */ TableHead) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); - - -const TableHead = _ref => { - let { - children, - className, - ...props - } = _ref; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("thead", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()('bg-gray-50 text-xs uppercase text-gray-700 dark:bg-gray-700 dark:text-gray-400', className), - ...props, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("tr", { - children: children - }) - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Table/TableHeadCell.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Table/TableHeadCell.js ***! - \*******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TableHeadCell": () => (/* binding */ TableHeadCell) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); - - -const TableHeadCell = _ref => { - let { - children, - className, - ...props - } = _ref; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("th", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()('px-6 py-3', className), - ...props, - children: children - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Table/TableRow.js": -/*!**************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Table/TableRow.js ***! - \**************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TableRow": () => (/* binding */ TableRow) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _TableContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TableContext */ "./node_modules/flowbite-react/lib/esm/components/Table/TableContext.js"); - - - -const TableRow = _ref => { - let { - children, - className, - ...props - } = _ref; - const { - striped, - hoverable - } = (0,_TableContext__WEBPACK_IMPORTED_MODULE_2__.useTableContext)(); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("tr", { - "data-testid": "table-row-element", - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()({ - 'odd:bg-white even:bg-gray-50 odd:dark:bg-gray-800 even:dark:bg-gray-700': striped, - 'hover:bg-gray-50 dark:hover:bg-gray-600': hoverable - }, className), - ...props, - children: children - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Table/index.js": -/*!***********************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Table/index.js ***! - \***********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Table": () => (/* binding */ Table) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _TableBody__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TableBody */ "./node_modules/flowbite-react/lib/esm/components/Table/TableBody.js"); -/* harmony import */ var _TableCell__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TableCell */ "./node_modules/flowbite-react/lib/esm/components/Table/TableCell.js"); -/* harmony import */ var _TableContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./TableContext */ "./node_modules/flowbite-react/lib/esm/components/Table/TableContext.js"); -/* harmony import */ var _TableHead__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./TableHead */ "./node_modules/flowbite-react/lib/esm/components/Table/TableHead.js"); -/* harmony import */ var _TableHeadCell__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./TableHeadCell */ "./node_modules/flowbite-react/lib/esm/components/Table/TableHeadCell.js"); -/* harmony import */ var _TableRow__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./TableRow */ "./node_modules/flowbite-react/lib/esm/components/Table/TableRow.js"); - - - - - - - - - -const TableComponent = _ref => { - let { - children, - striped, - hoverable, - className, - ...props - } = _ref; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - "data-testid": "table-element", - className: "relative overflow-x-auto shadow-md sm:rounded-lg", - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_TableContext__WEBPACK_IMPORTED_MODULE_4__.TableContext.Provider, { - value: { - striped, - hoverable - }, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("table", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()('w-full text-left text-sm text-gray-500 dark:text-gray-400', className), - ...props, - children: children - }) - }) - }); -}; - -TableComponent.displayName = 'Table'; -_TableHead__WEBPACK_IMPORTED_MODULE_5__.TableHead.displayName = 'Table.Head'; -_TableBody__WEBPACK_IMPORTED_MODULE_2__.TableBody.displayName = 'Table.Body'; -_TableRow__WEBPACK_IMPORTED_MODULE_7__.TableRow.displayName = 'Table.Row'; -_TableCell__WEBPACK_IMPORTED_MODULE_3__.TableCell.displayName = 'Table.Cell'; -_TableHeadCell__WEBPACK_IMPORTED_MODULE_6__.TableHeadCell.displayName = 'Table.HeadCell'; -const Table = Object.assign(TableComponent, { - Head: _TableHead__WEBPACK_IMPORTED_MODULE_5__.TableHead, - Body: _TableBody__WEBPACK_IMPORTED_MODULE_2__.TableBody, - Row: _TableRow__WEBPACK_IMPORTED_MODULE_7__.TableRow, - Cell: _TableCell__WEBPACK_IMPORTED_MODULE_3__.TableCell, - HeadCell: _TableHeadCell__WEBPACK_IMPORTED_MODULE_6__.TableHeadCell -}); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineBody.js": -/*!*********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineBody.js ***! - \*********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TimelineBody": () => (/* binding */ TimelineBody) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); - - -const TimelineBody = _ref => { - let { - children, - className, - ...props - } = _ref; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("p", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()('mb-4 text-base font-normal text-gray-500 dark:text-gray-400', className), - ...props, - children: children - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineContent.js": -/*!************************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineContent.js ***! - \************************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TimelineContent": () => (/* binding */ TimelineContent) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _TimelineContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TimelineContext */ "./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineContext.js"); - - - -const TimelineContent = _ref => { - let { - children, - className, - ...props - } = _ref; - const { - horizontal - } = (0,_TimelineContext__WEBPACK_IMPORTED_MODULE_2__.useTimelineContext)(); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - "data-testid": "timeline-content", - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()({ - 'mt-3 sm:pr-8': horizontal - }, className), - ...props, - children: children - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineContext.js": -/*!************************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineContext.js ***! - \************************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TimelineContext": () => (/* binding */ TimelineContext), -/* harmony export */ "useTimelineContext": () => (/* binding */ useTimelineContext) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); - -const TimelineContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(undefined); -function useTimelineContext() { - const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(TimelineContext); - - if (!context) { - throw new Error('useTimelineContext should be used within the TimelineContext providor!'); - } - - return context; -} - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineItem.js": -/*!*********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineItem.js ***! - \*********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TimelineItem": () => (/* binding */ TimelineItem) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _TimelineContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TimelineContext */ "./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineContext.js"); - - - -const TimelineItem = _ref => { - let { - children, - className, - ...props - } = _ref; - const { - horizontal - } = (0,_TimelineContext__WEBPACK_IMPORTED_MODULE_2__.useTimelineContext)(); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("li", { - "data-testid": "timeline-item", - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()({ - 'mb-10 ml-6': !horizontal, - 'relative mb-6 sm:mb-0': horizontal - }, className), - ...props, - children: children - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Timeline/TimelinePoint.js": -/*!**********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Timeline/TimelinePoint.js ***! - \**********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TimelinePoint": () => (/* binding */ TimelinePoint) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _TimelineContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TimelineContext */ "./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineContext.js"); - - - -const TimelinePoint = _ref => { - let { - children, - className, - icon: Icon, - ...props - } = _ref; - const { - horizontal - } = (0,_TimelineContext__WEBPACK_IMPORTED_MODULE_2__.useTimelineContext)(); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { - "data-testid": "timeline-point", - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()({ - 'flex items-center': horizontal - }, className), - ...props, - children: [children, Icon ? (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { - className: "absolute -left-3 flex h-6 w-6 items-center justify-center rounded-full bg-blue-200 ring-8 ring-white dark:bg-blue-900 dark:ring-gray-900", - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Icon, { - "aria-hidden": true, - className: "h-3 w-3 text-blue-600 dark:text-blue-300" - }) - }) : (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: "absolute -left-1.5 mt-1.5 h-3 w-3 rounded-full border border-white bg-gray-200 dark:border-gray-900 dark:bg-gray-700" - }), horizontal ? (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - className: "hidden h-0.5 w-full bg-gray-200 dark:bg-gray-700 sm:flex" - }) : ''] - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineTime.js": -/*!*********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineTime.js ***! - \*********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TimelineTime": () => (/* binding */ TimelineTime) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); - - -const TimelineTime = _ref => { - let { - children, - className, - ...props - } = _ref; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("time", { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()('mb-1 text-sm font-normal leading-none text-gray-400 dark:text-gray-500', className), - ...props, - children: children - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineTitle.js": -/*!**********************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineTitle.js ***! - \**********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TimelineTitle": () => (/* binding */ TimelineTitle) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); - - -const TimelineTitle = _ref => { - let { - children, - className, - as = 'h3', - ...props - } = _ref; - const Tag = as; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Tag, { - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()('text-lg font-semibold text-gray-900 dark:text-white', className), - ...props, - children: children - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Timeline/index.js": -/*!**************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Timeline/index.js ***! - \**************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Timeline": () => (/* binding */ Timeline) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _TimelineBody__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TimelineBody */ "./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineBody.js"); -/* harmony import */ var _TimelineContent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TimelineContent */ "./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineContent.js"); -/* harmony import */ var _TimelineContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./TimelineContext */ "./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineContext.js"); -/* harmony import */ var _TimelineItem__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./TimelineItem */ "./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineItem.js"); -/* harmony import */ var _TimelinePoint__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./TimelinePoint */ "./node_modules/flowbite-react/lib/esm/components/Timeline/TimelinePoint.js"); -/* harmony import */ var _TimelineTime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./TimelineTime */ "./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineTime.js"); -/* harmony import */ var _TimelineTitle__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./TimelineTitle */ "./node_modules/flowbite-react/lib/esm/components/Timeline/TimelineTitle.js"); - - - - - - - - - - -const TimelineComponent = _ref => { - let { - children, - horizontal - } = _ref; - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_TimelineContext__WEBPACK_IMPORTED_MODULE_4__.TimelineContext.Provider, { - value: { - horizontal - }, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("ol", { - "data-testid": "timeline-component", - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()({ - 'relative border-l border-gray-200 dark:border-gray-700': !horizontal, - 'items-center sm:flex': horizontal - }), - children: children - }) - }); -}; - -TimelineComponent.displayName = 'Timeline'; -_TimelineItem__WEBPACK_IMPORTED_MODULE_5__.TimelineItem.displayName = 'Timeline.Item'; -_TimelinePoint__WEBPACK_IMPORTED_MODULE_6__.TimelinePoint.displayName = 'Timeline.Point'; -_TimelineContent__WEBPACK_IMPORTED_MODULE_3__.TimelineContent.displayName = 'Timeline.Content'; -_TimelineTime__WEBPACK_IMPORTED_MODULE_7__.TimelineTime.displayName = 'Timeline.Time'; -_TimelineTitle__WEBPACK_IMPORTED_MODULE_8__.TimelineTitle.displayName = 'Timeline.Title'; -_TimelineBody__WEBPACK_IMPORTED_MODULE_2__.TimelineBody.displayName = 'Timeline.Body'; -const Timeline = Object.assign(TimelineComponent, { - Item: _TimelineItem__WEBPACK_IMPORTED_MODULE_5__.TimelineItem, - Point: _TimelinePoint__WEBPACK_IMPORTED_MODULE_6__.TimelinePoint, - Content: _TimelineContent__WEBPACK_IMPORTED_MODULE_3__.TimelineContent, - Time: _TimelineTime__WEBPACK_IMPORTED_MODULE_7__.TimelineTime, - Title: _TimelineTitle__WEBPACK_IMPORTED_MODULE_8__.TimelineTitle, - Body: _TimelineBody__WEBPACK_IMPORTED_MODULE_2__.TimelineBody -}); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Toast/ToastContext.js": -/*!******************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Toast/ToastContext.js ***! - \******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ToastContext": () => (/* binding */ ToastContext), -/* harmony export */ "useToastContext": () => (/* binding */ useToastContext) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); - -const ToastContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(undefined); -function useToastContext() { - const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(ToastContext); - - if (!context) { - throw new Error('useToastContext should be used within the ToastContext provider!'); - } - - return context; -} - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Toast/ToastToggle.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Toast/ToastToggle.js ***! - \*****************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ToastToggle": () => (/* binding */ ToastToggle) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var react_icons_hi__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-icons/hi */ "./node_modules/react-icons/hi/index.esm.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _ToastContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ToastContext */ "./node_modules/flowbite-react/lib/esm/components/Toast/ToastContext.js"); - - - - -const ToastToggle = _ref => { - let { - xIcon: XIcon = react_icons_hi__WEBPACK_IMPORTED_MODULE_3__.HiX - } = _ref; - const { - duration, - isClosed, - isRemoved, - setIsClosed, - setIsRemoved - } = (0,_ToastContext__WEBPACK_IMPORTED_MODULE_2__.useToastContext)(); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_1__.useTheme)().theme.toast.toggle; - - const handleClick = () => { - setIsClosed(!isClosed); - setTimeout(() => setIsRemoved(!isRemoved), duration); - }; - - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("button", { - "aria-label": "Close", - onClick: handleClick, - type: "button", - className: theme.base, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(XIcon, { - className: theme.icon - }) - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Toast/index.js": -/*!***********************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Toast/index.js ***! - \***********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Toast": () => (/* binding */ Toast) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); -/* harmony import */ var _ToastContext__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ToastContext */ "./node_modules/flowbite-react/lib/esm/components/Toast/ToastContext.js"); -/* harmony import */ var _ToastToggle__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ToastToggle */ "./node_modules/flowbite-react/lib/esm/components/Toast/ToastToggle.js"); - - - - - - - -const durationClasses = { - 75: 'duration-75', - 100: 'duration-100', - 150: 'duration-150', - 200: 'duration-200', - 300: 'duration-300', - 500: 'duration-500', - 700: 'duration-700', - 1000: 'duration-1000' -}; - -const ToastComponent = _ref => { - let { - children, - duration = 300, - ...props - } = _ref; - const [isClosed, setIsClosed] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(false); - const [isRemoved, setIsRemoved] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(false); - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_4__.useTheme)().theme.toast; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_3__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_ToastContext__WEBPACK_IMPORTED_MODULE_5__.ToastContext.Provider, { - value: { - duration, - isClosed, - isRemoved, - setIsClosed, - setIsRemoved - }, - children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { - "data-testid": "flowbite-toast", - className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(theme.base, durationClasses[duration], { - [theme.closed]: isClosed - }, { - [theme.removed]: isRemoved - }), - ...theirProps, - children: children - }) - }); -}; - -ToastComponent.displayName = 'Toast'; -_ToastToggle__WEBPACK_IMPORTED_MODULE_6__.ToastToggle.displayName = 'Toast.Toggle'; -const Toast = Object.assign(ToastComponent, { - Toggle: _ToastToggle__WEBPACK_IMPORTED_MODULE_6__.ToastToggle -}); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/Tooltip/index.js": -/*!*************************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/Tooltip/index.js ***! - \*************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Tooltip": () => (/* binding */ Tooltip) -/* harmony export */ }); -/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); -/* harmony import */ var _helpers_exclude__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../helpers/exclude */ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js"); -/* harmony import */ var _Floating__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Floating */ "./node_modules/flowbite-react/lib/esm/components/Floating/index.js"); -/* harmony import */ var _Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Flowbite/ThemeContext */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/ThemeContext.js"); - - - - -/** - * @see https://floating-ui.com/docs/react-dom-interactions - */ - -const Tooltip = _ref => { - let { - animation = 'duration-300', - arrow = true, - children, - content, - placement = 'top', - style = 'dark', - trigger = 'hover', - ...props - } = _ref; - const theme = (0,_Flowbite_ThemeContext__WEBPACK_IMPORTED_MODULE_3__.useTheme)().theme.tooltip; - const theirProps = (0,_helpers_exclude__WEBPACK_IMPORTED_MODULE_1__.excludeClassName)(props); - return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Floating__WEBPACK_IMPORTED_MODULE_2__.Floating, { - content: content, - style: style, - animation: animation, - placement: placement, - arrow: arrow, - trigger: trigger, - theme: theme, - ...theirProps, - children: children - }); -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/components/index.js": -/*!*****************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/components/index.js ***! - \*****************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Accordion": () => (/* reexport safe */ _Accordion__WEBPACK_IMPORTED_MODULE_0__.Accordion), -/* harmony export */ "Alert": () => (/* reexport safe */ _Alert__WEBPACK_IMPORTED_MODULE_1__.Alert), -/* harmony export */ "Avatar": () => (/* reexport safe */ _Avatar__WEBPACK_IMPORTED_MODULE_2__.Avatar), -/* harmony export */ "Badge": () => (/* reexport safe */ _Badge__WEBPACK_IMPORTED_MODULE_3__.Badge), -/* harmony export */ "Breadcrumb": () => (/* reexport safe */ _Breadcrumb__WEBPACK_IMPORTED_MODULE_4__.Breadcrumb), -/* harmony export */ "Button": () => (/* reexport safe */ _Button__WEBPACK_IMPORTED_MODULE_5__.Button), -/* harmony export */ "Card": () => (/* reexport safe */ _Card__WEBPACK_IMPORTED_MODULE_6__.Card), -/* harmony export */ "Carousel": () => (/* reexport safe */ _Carousel__WEBPACK_IMPORTED_MODULE_7__.Carousel), -/* harmony export */ "Checkbox": () => (/* reexport safe */ _FormControls__WEBPACK_IMPORTED_MODULE_12__.Checkbox), -/* harmony export */ "DarkThemeToggle": () => (/* reexport safe */ _DarkThemeToggle__WEBPACK_IMPORTED_MODULE_8__.DarkThemeToggle), -/* harmony export */ "Dropdown": () => (/* reexport safe */ _Dropdown__WEBPACK_IMPORTED_MODULE_9__.Dropdown), -/* harmony export */ "FileInput": () => (/* reexport safe */ _FormControls__WEBPACK_IMPORTED_MODULE_12__.FileInput), -/* harmony export */ "Flowbite": () => (/* reexport safe */ _Flowbite__WEBPACK_IMPORTED_MODULE_10__.Flowbite), -/* harmony export */ "Footer": () => (/* reexport safe */ _Footer__WEBPACK_IMPORTED_MODULE_11__.Footer), -/* harmony export */ "FooterComponent": () => (/* reexport safe */ _Footer__WEBPACK_IMPORTED_MODULE_11__.FooterComponent), -/* harmony export */ "Label": () => (/* reexport safe */ _FormControls__WEBPACK_IMPORTED_MODULE_12__.Label), -/* harmony export */ "ListGroup": () => (/* reexport safe */ _ListGroup__WEBPACK_IMPORTED_MODULE_13__.ListGroup), -/* harmony export */ "Modal": () => (/* reexport safe */ _Modal__WEBPACK_IMPORTED_MODULE_14__.Modal), -/* harmony export */ "Navbar": () => (/* reexport safe */ _Navbar__WEBPACK_IMPORTED_MODULE_15__.Navbar), -/* harmony export */ "Pagination": () => (/* reexport safe */ _Pagination__WEBPACK_IMPORTED_MODULE_16__.Pagination), -/* harmony export */ "Progress": () => (/* reexport safe */ _Progress__WEBPACK_IMPORTED_MODULE_17__.Progress), -/* harmony export */ "Radio": () => (/* reexport safe */ _FormControls__WEBPACK_IMPORTED_MODULE_12__.Radio), -/* harmony export */ "Rating": () => (/* reexport safe */ _Rating__WEBPACK_IMPORTED_MODULE_18__.Rating), -/* harmony export */ "Select": () => (/* reexport safe */ _FormControls__WEBPACK_IMPORTED_MODULE_12__.Select), -/* harmony export */ "Sidebar": () => (/* reexport safe */ _Sidebar__WEBPACK_IMPORTED_MODULE_19__.Sidebar), -/* harmony export */ "Spinner": () => (/* reexport safe */ _Spinner__WEBPACK_IMPORTED_MODULE_20__.Spinner), -/* harmony export */ "Table": () => (/* reexport safe */ _Table__WEBPACK_IMPORTED_MODULE_22__.Table), -/* harmony export */ "Tabs": () => (/* reexport safe */ _Tab__WEBPACK_IMPORTED_MODULE_21__.Tabs), -/* harmony export */ "TabsComponent": () => (/* reexport safe */ _Tab__WEBPACK_IMPORTED_MODULE_21__.TabsComponent), -/* harmony export */ "TextInput": () => (/* reexport safe */ _FormControls__WEBPACK_IMPORTED_MODULE_12__.TextInput), -/* harmony export */ "Textarea": () => (/* reexport safe */ _FormControls__WEBPACK_IMPORTED_MODULE_12__.Textarea), -/* harmony export */ "Timeline": () => (/* reexport safe */ _Timeline__WEBPACK_IMPORTED_MODULE_23__.Timeline), -/* harmony export */ "Toast": () => (/* reexport safe */ _Toast__WEBPACK_IMPORTED_MODULE_24__.Toast), -/* harmony export */ "ToggleSwitch": () => (/* reexport safe */ _FormControls__WEBPACK_IMPORTED_MODULE_12__.ToggleSwitch), -/* harmony export */ "Tooltip": () => (/* reexport safe */ _Tooltip__WEBPACK_IMPORTED_MODULE_25__.Tooltip) -/* harmony export */ }); -/* harmony import */ var _Accordion__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Accordion */ "./node_modules/flowbite-react/lib/esm/components/Accordion/index.js"); -/* harmony import */ var _Alert__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Alert */ "./node_modules/flowbite-react/lib/esm/components/Alert/index.js"); -/* harmony import */ var _Avatar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Avatar */ "./node_modules/flowbite-react/lib/esm/components/Avatar/index.js"); -/* harmony import */ var _Badge__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Badge */ "./node_modules/flowbite-react/lib/esm/components/Badge/index.js"); -/* harmony import */ var _Breadcrumb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Breadcrumb */ "./node_modules/flowbite-react/lib/esm/components/Breadcrumb/index.js"); -/* harmony import */ var _Button__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Button */ "./node_modules/flowbite-react/lib/esm/components/Button/index.js"); -/* harmony import */ var _Card__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Card */ "./node_modules/flowbite-react/lib/esm/components/Card/index.js"); -/* harmony import */ var _Carousel__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Carousel */ "./node_modules/flowbite-react/lib/esm/components/Carousel/index.js"); -/* harmony import */ var _DarkThemeToggle__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./DarkThemeToggle */ "./node_modules/flowbite-react/lib/esm/components/DarkThemeToggle/index.js"); -/* harmony import */ var _Dropdown__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Dropdown */ "./node_modules/flowbite-react/lib/esm/components/Dropdown/index.js"); -/* harmony import */ var _Flowbite__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Flowbite */ "./node_modules/flowbite-react/lib/esm/components/Flowbite/index.js"); -/* harmony import */ var _Footer__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Footer */ "./node_modules/flowbite-react/lib/esm/components/Footer/index.js"); -/* harmony import */ var _FormControls__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./FormControls */ "./node_modules/flowbite-react/lib/esm/components/FormControls/index.js"); -/* harmony import */ var _ListGroup__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./ListGroup */ "./node_modules/flowbite-react/lib/esm/components/ListGroup/index.js"); -/* harmony import */ var _Modal__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Modal */ "./node_modules/flowbite-react/lib/esm/components/Modal/index.js"); -/* harmony import */ var _Navbar__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./Navbar */ "./node_modules/flowbite-react/lib/esm/components/Navbar/index.js"); -/* harmony import */ var _Pagination__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Pagination */ "./node_modules/flowbite-react/lib/esm/components/Pagination/index.js"); -/* harmony import */ var _Progress__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./Progress */ "./node_modules/flowbite-react/lib/esm/components/Progress/index.js"); -/* harmony import */ var _Rating__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./Rating */ "./node_modules/flowbite-react/lib/esm/components/Rating/index.js"); -/* harmony import */ var _Sidebar__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./Sidebar */ "./node_modules/flowbite-react/lib/esm/components/Sidebar/index.js"); -/* harmony import */ var _Spinner__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./Spinner */ "./node_modules/flowbite-react/lib/esm/components/Spinner/index.js"); -/* harmony import */ var _Tab__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./Tab */ "./node_modules/flowbite-react/lib/esm/components/Tab/index.js"); -/* harmony import */ var _Table__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./Table */ "./node_modules/flowbite-react/lib/esm/components/Table/index.js"); -/* harmony import */ var _Timeline__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./Timeline */ "./node_modules/flowbite-react/lib/esm/components/Timeline/index.js"); -/* harmony import */ var _Toast__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./Toast */ "./node_modules/flowbite-react/lib/esm/components/Toast/index.js"); -/* harmony import */ var _Tooltip__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./Tooltip */ "./node_modules/flowbite-react/lib/esm/components/Tooltip/index.js"); - - - - - - - - - - - - - - - - - - - - - - - - - - - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/helpers/exclude.js": -/*!****************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/helpers/exclude.js ***! - \****************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), -/* harmony export */ "excludeClassName": () => (/* binding */ excludeClassName) -/* harmony export */ }); -const excludeClassName = props => { - return exclude({ - key: 'className', - source: props - }); -}; - -const exclude = _ref => { - let { - key, - source - } = _ref; - delete source[key]; - return source; -}; - -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (exclude); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/helpers/floating.js": -/*!*****************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/helpers/floating.js ***! - \*****************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "getArrowPlacement": () => (/* binding */ getArrowPlacement), -/* harmony export */ "getMiddleware": () => (/* binding */ getMiddleware), -/* harmony export */ "getPlacement": () => (/* binding */ getPlacement) -/* harmony export */ }); -/* harmony import */ var _floating_ui_react_dom_interactions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @floating-ui/react-dom-interactions */ "./node_modules/@floating-ui/core/dist/floating-ui.core.browser.mjs"); - - -/** - * @see https://floating-ui.com/docs/middleware - */ - -const getMiddleware = _ref => { - let { - arrowRef, - placement - } = _ref; - const middleware = []; - middleware.push((0,_floating_ui_react_dom_interactions__WEBPACK_IMPORTED_MODULE_0__.offset)(8)); - middleware.push(placement === 'auto' ? (0,_floating_ui_react_dom_interactions__WEBPACK_IMPORTED_MODULE_0__.autoPlacement)() : (0,_floating_ui_react_dom_interactions__WEBPACK_IMPORTED_MODULE_0__.flip)()); - middleware.push((0,_floating_ui_react_dom_interactions__WEBPACK_IMPORTED_MODULE_0__.shift)({ - padding: 8 - })); - - if (arrowRef.current) { - middleware.push((0,_floating_ui_react_dom_interactions__WEBPACK_IMPORTED_MODULE_0__.arrow)({ - element: arrowRef.current - })); - } - - return middleware; -}; -const getPlacement = _ref2 => { - let { - placement - } = _ref2; - return placement === 'auto' ? undefined : placement; -}; -const getArrowPlacement = _ref3 => { - let { - placement - } = _ref3; - return { - top: 'bottom', - right: 'left', - bottom: 'top', - left: 'right' - }[placement.split('-')[0]]; -}; - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/helpers/mergeDeep.js": -/*!******************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/helpers/mergeDeep.js ***! - \******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "isObject": () => (/* binding */ isObject), -/* harmony export */ "mergeDeep": () => (/* binding */ mergeDeep) -/* harmony export */ }); -// source: https://stackoverflow.com/questions/27936772/how-to-deep-merge-instead-of-shallow-merge - -/** - * Simple object check. - * @param item - * @returns {boolean} - */ -function isObject(item) { - return item && typeof item === 'object' && !Array.isArray(item); -} -/** - * Deep merge two objects. - * @param target - * @param ...sources - */ - -function mergeDeep(target) { - for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - sources[_key - 1] = arguments[_key]; - } - - if (!sources.length) return target; - const source = sources.shift(); - - if (isObject(target) && isObject(source)) { - for (const key in source) { - if (isObject(source[key])) { - if (!target[key]) Object.assign(target, { - [key]: {} - }); - mergeDeep(target[key], source[key]); - } else { - Object.assign(target, { - [key]: source[key] - }); - } - } - } - - return mergeDeep(target, ...sources); -} - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/helpers/range.js": -/*!**************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/helpers/range.js ***! - \**************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((start, end) => { - if (start >= end) { - return []; - } - - return [...Array(end - start + 1).keys()].map(key => key + start); -}); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/helpers/window-exists.js": -/*!**********************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/helpers/window-exists.js ***! - \**********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (() => typeof window !== 'undefined'); - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/index.js": -/*!******************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/index.js ***! - \******************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Accordion": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Accordion), -/* harmony export */ "Alert": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Alert), -/* harmony export */ "Avatar": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Avatar), -/* harmony export */ "Badge": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Badge), -/* harmony export */ "Breadcrumb": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Breadcrumb), -/* harmony export */ "Button": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Button), -/* harmony export */ "Card": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Card), -/* harmony export */ "Carousel": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Carousel), -/* harmony export */ "Checkbox": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Checkbox), -/* harmony export */ "DarkThemeToggle": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.DarkThemeToggle), -/* harmony export */ "Dropdown": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Dropdown), -/* harmony export */ "FileInput": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.FileInput), -/* harmony export */ "Flowbite": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Flowbite), -/* harmony export */ "Footer": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Footer), -/* harmony export */ "FooterComponent": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.FooterComponent), -/* harmony export */ "Label": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Label), -/* harmony export */ "ListGroup": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.ListGroup), -/* harmony export */ "Modal": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Modal), -/* harmony export */ "Navbar": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Navbar), -/* harmony export */ "Pagination": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Pagination), -/* harmony export */ "Progress": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Progress), -/* harmony export */ "Radio": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Radio), -/* harmony export */ "Rating": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Rating), -/* harmony export */ "Select": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Select), -/* harmony export */ "Sidebar": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Sidebar), -/* harmony export */ "Spinner": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Spinner), -/* harmony export */ "Table": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Table), -/* harmony export */ "Tabs": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Tabs), -/* harmony export */ "TabsComponent": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.TabsComponent), -/* harmony export */ "TextInput": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.TextInput), -/* harmony export */ "Textarea": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Textarea), -/* harmony export */ "Timeline": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Timeline), -/* harmony export */ "Toast": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Toast), -/* harmony export */ "ToggleSwitch": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.ToggleSwitch), -/* harmony export */ "Tooltip": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_0__.Tooltip) -/* harmony export */ }); -/* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./components */ "./node_modules/flowbite-react/lib/esm/components/index.js"); -/* harmony import */ var _theme_default__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme/default */ "./node_modules/flowbite-react/lib/esm/theme/default.js"); - - - -/***/ }), - -/***/ "./node_modules/flowbite-react/lib/esm/theme/default.js": -/*!**************************************************************!*\ - !*** ./node_modules/flowbite-react/lib/esm/theme/default.js ***! - \**************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -const theme = { - accordion: { - base: 'divide-y divide-gray-200 border-gray-200 dark:divide-gray-700 dark:border-gray-700', - content: { - base: 'py-5 px-5 last:rounded-b-lg dark:bg-gray-900 first:rounded-t-lg' - }, - flush: { - off: 'rounded-lg border', - on: 'border-b' - }, - title: { - arrow: { - base: 'h-6 w-6 shrink-0', - open: { - off: '', - on: 'rotate-180' - } - }, - base: 'flex w-full items-center justify-between first:rounded-t-lg last:rounded-b-lg py-5 px-5 text-left font-medium text-gray-500 dark:text-gray-400', - flush: { - off: 'hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 dark:hover:bg-gray-800 dark:focus:ring-gray-800', - on: '!bg-transparent dark:!bg-transparent' - }, - heading: '', - open: { - off: '', - on: 'text-gray-900 bg-gray-100 dark:bg-gray-800 dark:text-white' - } - } - }, - alert: { - base: 'flex flex-col gap-2 p-4 text-sm', - borderAccent: 'border-t-4', - closeButton: { - base: '-mx-1.5 -my-1.5 ml-auto inline-flex h-8 w-8 rounded-lg p-1.5 focus:ring-2', - color: { - info: 'bg-blue-100 text-blue-500 hover:bg-blue-200 focus:ring-blue-400 dark:bg-blue-200 dark:text-blue-600 dark:hover:bg-blue-300', - gray: 'bg-gray-100 text-gray-500 hover:bg-gray-200 focus:ring-gray-400 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-white', - failure: 'bg-red-100 text-red-500 hover:bg-red-200 focus:ring-red-400 dark:bg-red-200 dark:text-red-600 dark:hover:bg-red-300', - success: 'bg-green-100 text-green-500 hover:bg-green-200 focus:ring-green-400 dark:bg-green-200 dark:text-green-600 dark:hover:bg-green-300', - warning: 'bg-yellow-100 text-yellow-500 hover:bg-yellow-200 focus:ring-yellow-400 dark:bg-yellow-200 dark:text-yellow-600 dark:hover:bg-yellow-300' - } - }, - color: { - info: 'text-blue-700 bg-blue-100 border-blue-500 dark:bg-blue-200 dark:text-blue-800', - gray: 'text-gray-700 bg-gray-100 border-gray-500 dark:bg-gray-700 dark:text-gray-300', - failure: 'text-red-700 bg-red-100 border-red-500 dark:bg-red-200 dark:text-red-800', - success: 'text-green-700 bg-green-100 border-green-500 dark:bg-green-200 dark:text-green-800', - warning: 'text-yellow-700 bg-yellow-100 border-yellow-500 dark:bg-yellow-200 dark:text-yellow-800' - }, - icon: 'mr-3 inline h-5 w-5 flex-shrink-0', - rounded: 'rounded-lg' - }, - avatar: { - base: 'flex items-center space-x-4', - bordered: 'p-1 ring-2 ring-gray-300 dark:ring-gray-500', - img: { - off: 'rounded relative overflow-hidden bg-gray-100 dark:bg-gray-600', - on: 'rounded' - }, - rounded: '!rounded-full', - size: { - xs: 'w-6 h-6', - sm: 'w-8 h-8', - md: 'w-10 h-10', - lg: 'w-20 h-20', - xl: 'w-36 h-36' - }, - stacked: 'ring-2 ring-gray-300 dark:ring-gray-500', - status: { - away: 'bg-yellow-400', - base: 'absolute h-3.5 w-3.5 rounded-full border-2 border-white dark:border-gray-800', - busy: 'bg-red-400', - offline: 'bg-gray-400', - online: 'bg-green-400' - }, - statusPosition: { - 'bottom-left': '-bottom-1 -left-1', - 'bottom-center': '-botton-1 center', - 'bottom-right': '-bottom-1 -right-1', - 'top-left': '-top-1 -left-1', - 'top-center': '-top-1 center', - 'top-right': '-top-1 -right-1', - 'center-right': 'center -right-1', - center: 'center center', - 'center-left': 'center -left-1' - } - }, - badge: { - base: 'flex h-fit items-center gap-1 font-semibold', - color: { - info: 'bg-blue-100 text-blue-800 dark:bg-blue-200 dark:text-blue-800 group-hover:bg-blue-200 dark:group-hover:bg-blue-300', - gray: 'bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300 group-hover:bg-gray-200 dark:group-hover:bg-gray-600', - failure: 'bg-red-100 text-red-800 dark:bg-red-200 dark:text-red-900 group-hover:bg-red-200 dark:group-hover:bg-red-300', - success: 'bg-green-100 text-green-800 dark:bg-green-200 dark:text-green-900 group-hover:bg-green-200 dark:group-hover:bg-green-300', - warning: 'bg-yellow-100 text-yellow-800 dark:bg-yellow-200 dark:text-yellow-900 group-hover:bg-yellow-200 dark:group-hover:bg-yellow-300', - indigo: 'bg-indigo-100 text-indigo-800 dark:bg-indigo-200 dark:text-indigo-900 group-hover:bg-indigo-200 dark:group-hover:bg-indigo-300', - purple: 'bg-purple-100 text-purple-800 dark:bg-purple-200 dark:text-purple-900 group-hover:bg-purple-200 dark:group-hover:bg-purple-300', - pink: 'bg-pink-100 text-pink-800 dark:bg-pink-200 dark:text-pink-900 group-hover:bg-pink-200 dark:group-hover:bg-pink-300' - }, - href: 'group', - icon: { - off: 'rounded px-2 py-0.5', - on: 'rounded-full p-1.5', - size: { - xs: 'w-3 h-3', - sm: 'w-3.5 h-3.5' - } - }, - size: { - xs: 'p-1 text-xs', - sm: 'p-1.5 text-sm' - } - }, - breadcrumb: { - item: { - base: 'group flex items-center', - chevron: 'mx-1 h-6 w-6 text-gray-400 group-first:hidden md:mx-2', - href: { - off: 'flex items-center text-sm font-medium text-gray-500 dark:text-gray-400', - on: 'flex items-center text-sm font-medium text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white' - }, - icon: 'mr-2 h-4 w-4' - }, - list: 'flex items-center' - }, - button: { - base: 'group flex h-min w-fit items-center justify-center p-0.5 text-center font-medium focus:z-10', - color: { - dark: 'text-white bg-gray-800 border border-transparent hover:bg-gray-900 focus:ring-4 focus:ring-gray-300 disabled:hover:bg-gray-800 dark:bg-gray-800 dark:hover:bg-gray-700 dark:focus:ring-gray-800 dark:border-gray-700 dark:disabled:hover:bg-gray-800', - failure: 'text-white bg-red-700 border border-transparent hover:bg-red-800 focus:ring-4 focus:ring-red-300 disabled:hover:bg-red-800 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900 dark:disabled:hover:bg-red-600', - gray: 'text-gray-900 bg-white border border-gray-200 hover:bg-gray-100 hover:text-blue-700 disabled:hover:bg-white focus:ring-blue-700 focus:text-blue-700 dark:bg-transparent dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 focus:ring-2 dark:disabled:hover:bg-gray-800', - info: 'text-white bg-blue-700 border border-transparent hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 disabled:hover:bg-blue-700 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800 dark:disabled:hover:bg-blue-600', - light: 'text-gray-900 bg-white border border-gray-300 hover:bg-gray-100 focus:ring-4 focus:ring-blue-300 disabled:hover:bg-white dark:bg-gray-600 dark:text-white dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-700 dark:focus:ring-gray-700', - purple: 'text-white bg-purple-700 border border-transparent hover:bg-purple-800 focus:ring-4 focus:ring-purple-300 disabled:hover:bg-purple-700 dark:bg-purple-600 dark:hover:bg-purple-700 dark:focus:ring-purple-900 dark:disabled:hover:bg-purple-600', - success: 'text-white bg-green-700 border border-transparent hover:bg-green-800 focus:ring-4 focus:ring-green-300 disabled:hover:bg-green-700 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800 dark:disabled:hover:bg-green-600', - warning: 'text-white bg-yellow-400 border border-transparent hover:bg-yellow-500 focus:ring-4 focus:ring-yellow-300 disabled:hover:bg-yellow-400 dark:focus:ring-yellow-900 dark:disabled:hover:bg-yellow-400' - }, - disabled: 'cursor-not-allowed opacity-50', - gradient: { - cyan: 'text-white bg-gradient-to-r from-cyan-400 via-cyan-500 to-cyan-600 hover:bg-gradient-to-br focus:ring-4 focus:ring-cyan-300 dark:focus:ring-cyan-800', - failure: 'text-white bg-gradient-to-r from-red-400 via-red-500 to-red-600 hover:bg-gradient-to-br focus:ring-4 focus:ring-red-300 dark:focus:ring-red-800', - info: 'text-white bg-gradient-to-r from-blue-500 via-blue-600 to-blue-700 hover:bg-gradient-to-br focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800 ', - lime: 'text-gray-900 bg-gradient-to-r from-lime-200 via-lime-400 to-lime-500 hover:bg-gradient-to-br focus:ring-4 focus:ring-lime-300 dark:focus:ring-lime-800', - pink: 'text-white bg-gradient-to-r from-pink-400 via-pink-500 to-pink-600 hover:bg-gradient-to-br focus:ring-4 focus:ring-pink-300 dark:focus:ring-pink-800', - purple: 'text-white bg-gradient-to-r from-purple-500 via-purple-600 to-purple-700 hover:bg-gradient-to-br focus:ring-4 focus:ring-purple-300 dark:focus:ring-purple-800', - success: 'text-white bg-gradient-to-r from-green-400 via-green-500 to-green-600 hover:bg-gradient-to-br focus:ring-4 focus:ring-green-300 dark:focus:ring-green-800', - teal: 'text-white bg-gradient-to-r from-teal-400 via-teal-500 to-teal-600 hover:bg-gradient-to-br focus:ring-4 focus:ring-teal-300 dark:focus:ring-teal-800' - }, - gradientDuoTone: { - cyanToBlue: 'text-white bg-gradient-to-r from-cyan-500 to-blue-500 hover:bg-gradient-to-bl focus:ring-4 focus:ring-cyan-300 dark:focus:ring-cyan-800', - greenToBlue: 'text-white bg-gradient-to-br from-green-400 to-blue-600 hover:bg-gradient-to-bl focus:ring-4 focus:ring-green-200 dark:focus:ring-green-800', - pinkToOrange: 'text-white bg-gradient-to-br from-pink-500 to-orange-400 hover:bg-gradient-to-bl focus:ring-4 focus:ring-pink-200 dark:focus:ring-pink-800', - purpleToBlue: 'text-white bg-gradient-to-br from-purple-600 to-blue-500 hover:bg-gradient-to-bl focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800', - purpleToPink: 'text-white bg-gradient-to-r from-purple-500 to-pink-500 hover:bg-gradient-to-l focus:ring-4 focus:ring-purple-200 dark:focus:ring-purple-800', - redToYellow: 'text-gray-900 bg-gradient-to-r from-red-200 via-red-300 to-yellow-200 hover:bg-gradient-to-bl focus:ring-4 focus:ring-red-100 dark:focus:ring-red-400', - tealToLime: 'text-gray-900 bg-gradient-to-r from-teal-200 to-lime-200 hover:bg-gradient-to-l hover:from-teal-200 hover:to-lime-200 hover:!text-gray-900 focus:ring-4 focus:ring-lime-200 dark:focus:ring-teal-700' - }, - inner: { - base: 'flex items-center', - position: { - none: '', - start: 'rounded-r-none', - middle: '!rounded-none', - end: 'rounded-l-none' - } - }, - label: 'ml-2 inline-flex h-4 w-4 items-center justify-center rounded-full bg-blue-200 text-xs font-semibold text-blue-800', - outline: { - color: { - gray: 'border border-gray-900 dark:border-white' - }, - off: '', - on: 'bg-white text-gray-900 transition-all duration-75 ease-in group-hover:bg-opacity-0 group-hover:text-inherit dark:bg-gray-900 dark:text-white', - pill: { - off: 'rounded-md', - on: 'rounded-full' - } - }, - pill: { - off: 'rounded-lg', - on: 'rounded-full' - }, - size: { - xs: 'text-xs px-2 py-1', - sm: 'text-sm px-3 py-1.5', - md: 'text-sm px-4 py-2', - lg: 'text-base px-5 py-2.5', - xl: 'text-base px-6 py-3' - } - }, - buttonGroup: { - base: 'inline-flex', - position: { - none: 'focus:!ring-2', - start: 'rounded-r-none', - middle: '!rounded-none border-l-0 pl-0', - end: 'rounded-l-none border-l-0 pl-0' - } - }, - card: { - base: 'flex rounded-lg border border-gray-200 bg-white shadow-md dark:border-gray-700 dark:bg-gray-800', - children: 'flex h-full flex-col justify-center gap-4 p-6', - horizontal: { - off: 'flex-col', - on: 'flex-col md:max-w-xl md:flex-row' - }, - href: 'hover:bg-gray-100 dark:hover:bg-gray-700', - img: { - base: '', - horizontal: { - off: 'rounded-t-lg', - on: 'h-96 w-full rounded-t-lg object-cover md:h-auto md:w-48 md:rounded-none md:rounded-l-lg' - } - } - }, - carousel: { - base: 'relative h-full w-full', - indicators: { - active: { - off: 'bg-white/50 hover:bg-white dark:bg-gray-800/50 dark:hover:bg-gray-800', - on: 'bg-white dark:bg-gray-800' - }, - base: 'h-3 w-3 rounded-full', - wrapper: 'absolute bottom-5 left-1/2 flex -translate-x-1/2 space-x-3' - }, - item: { - base: 'absolute top-1/2 left-1/2 block w-full -translate-x-1/2 -translate-y-1/2', - wrapper: 'w-full flex-shrink-0 transform cursor-grab snap-center' - }, - control: { - base: 'inline-flex h-8 w-8 items-center justify-center rounded-full bg-white/30 group-hover:bg-white/50 group-focus:outline-none group-focus:ring-4 group-focus:ring-white dark:bg-gray-800/30 dark:group-hover:bg-gray-800/60 dark:group-focus:ring-gray-800/70 sm:h-10 sm:w-10', - icon: 'h-5 w-5 text-white dark:text-gray-800 sm:h-6 sm:w-6' - }, - leftControl: 'absolute top-0 left-0 flex h-full items-center justify-center px-4 focus:outline-none', - rightControl: 'absolute top-0 right-0 flex h-full items-center justify-center px-4 focus:outline-none', - scrollContainer: { - base: 'flex h-full snap-mandatory overflow-y-hidden overflow-x-scroll scroll-smooth rounded-lg', - snap: 'snap-x' - } - }, - darkThemeToggle: { - base: 'rounded-lg p-2.5 text-sm text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-700', - icon: 'h-5 w-5' - }, - dropdown: { - floating: { - target: 'w-fit', - base: 'z-10 w-fit rounded divide-y divide-gray-100 shadow', - animation: 'transition-opacity', - hidden: 'invisible opacity-0', - style: { - dark: 'bg-gray-900 text-white dark:bg-gray-700', - light: 'border border-gray-200 bg-white text-gray-900', - auto: 'border border-gray-200 bg-white text-gray-900 dark:border-none dark:bg-gray-700 dark:text-white' - }, - header: 'block py-2 px-4 text-sm text-gray-700 dark:text-gray-200', - content: 'py-1 text-sm text-gray-700 dark:text-gray-200', - arrow: { - base: 'absolute z-10 h-2 w-2 rotate-45', - style: { - dark: 'bg-gray-900 dark:bg-gray-700', - light: 'bg-white', - auto: 'bg-white dark:bg-gray-700' - }, - placement: '-4px' - }, - item: { - base: 'flex items-center justify-start py-2 px-4 text-sm text-gray-700 cursor-pointer hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-600 dark:hover:text-white', - icon: 'mr-2 h-4 w-4' - }, - divider: 'my-1 h-px bg-gray-100 dark:bg-gray-600' - }, - arrowIcon: 'ml-2 h-4 w-4', - inlineWrapper: 'flex items-center', - content: 'py-1' - }, - footer: { - base: 'w-full rounded-lg bg-white shadow dark:bg-gray-800 md:flex md:items-center md:justify-between', - container: 'w-full p-6', - bgDark: 'bg-gray-800', - groupLink: { - base: 'flex flex-wrap text-sm text-gray-500 dark:text-white', - link: { - base: 'last:mr-0 md:mr-6', - href: 'hover:underline' - }, - col: 'flex-col space-y-4' - }, - icon: { - base: 'text-gray-500 dark:hover:text-white', - size: 'h-5 w-5' - }, - title: { - base: 'mb-6 text-sm font-semibold uppercase text-gray-500 dark:text-white' - }, - divider: { - base: 'w-full my-6 border-gray-200 sm:mx-auto dark:border-gray-700 lg:my-8' - }, - copyright: { - base: 'text-sm text-gray-500 dark:text-gray-400 sm:text-center', - href: 'ml-1 hover:underline', - span: 'ml-1' - }, - brand: { - base: 'mb-4 flex items-center sm:mb-0', - img: 'mr-3 h-8', - span: 'self-center whitespace-nowrap text-2xl font-semibold text-gray-800 dark:text-white' - } - }, - formControls: { - helperText: { - base: 'mt-2 text-sm', - colors: { - gray: 'text-gray-500 dark:text-gray-400', - info: 'text-blue-700 dark:text-blue-800', - success: 'text-green-600 dark:text-green-500', - failure: 'text-red-600 dark:text-red-500', - warning: 'text-yellow-500 dark:text-yellow-600' - } - }, - label: { - base: 'text-sm font-medium', - colors: { - default: 'text-gray-900 dark:text-gray-300', - info: 'text-blue-500 dark:text-blue-600', - failure: 'text-red-700 dark:text-red-500', - warning: 'text-yellow-500 dark:text-yellow-600', - success: 'text-green-700 dark:text-green-500' - }, - disabled: 'opacity-50' - }, - radio: { - base: 'h-4 w-4 border border-gray-300 focus:ring-2 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:focus:bg-blue-600 dark:focus:ring-blue-600' - }, - checkbox: { - base: 'h-4 w-4 rounded border border-gray-300 bg-gray-100 focus:ring-2 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:ring-offset-gray-800 dark:focus:ring-blue-600' - }, - textInput: { - base: 'flex', - addon: 'inline-flex items-center rounded-l-md border border-r-0 border-gray-300 bg-gray-200 px-3 text-sm text-gray-900 dark:border-gray-600 dark:bg-gray-600 dark:text-gray-400', - field: { - base: 'relative w-full', - icon: { - base: 'pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3', - svg: 'h-5 w-5 text-gray-500 dark:text-gray-400' - }, - input: { - base: 'block w-full border disabled:cursor-not-allowed disabled:opacity-50', - sizes: { - sm: 'p-2 sm:text-xs', - md: 'p-2.5 text-sm', - lg: 'sm:text-md p-4' - }, - colors: { - gray: 'bg-gray-50 border-gray-300 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500', - info: 'border-blue-500 bg-blue-50 text-blue-900 placeholder-blue-700 focus:border-blue-500 focus:ring-blue-500 dark:border-blue-400 dark:bg-blue-100 dark:focus:border-blue-500 dark:focus:ring-blue-500', - failure: 'border-red-500 bg-red-50 text-red-900 placeholder-red-700 focus:border-red-500 focus:ring-red-500 dark:border-red-400 dark:bg-red-100 dark:focus:border-red-500 dark:focus:ring-red-500', - warning: 'border-yellow-500 bg-yellow-50 text-yellow-900 placeholder-yellow-700 focus:border-yellow-500 focus:ring-yellow-500 dark:border-yellow-400 dark:bg-yellow-100 dark:focus:border-yellow-500 dark:focus:ring-yellow-500', - success: 'border-green-500 bg-green-50 text-green-900 placeholder-green-700 focus:border-green-500 focus:ring-green-500 dark:border-green-400 dark:bg-green-100 dark:focus:border-green-500 dark:focus:ring-green-500' - }, - withIcon: { - on: 'pl-10', - off: '' - }, - withAddon: { - on: 'rounded-r-lg', - off: 'rounded-lg' - }, - withShadow: { - on: 'shadow-sm dark:shadow-sm-light', - off: '' - } - } - } - }, - fileInput: { - base: 'flex', - field: { - base: 'relative w-full', - input: { - base: 'rounded-lg block w-full border disabled:cursor-not-allowed disabled:opacity-50', - sizes: { - sm: 'sm:text-xs', - md: 'text-sm', - lg: 'sm:text-md' - }, - colors: { - gray: 'bg-gray-50 border-gray-300 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500', - info: 'border-blue-500 bg-blue-50 text-blue-900 placeholder-blue-700 focus:border-blue-500 focus:ring-blue-500 dark:border-blue-400 dark:bg-blue-100 dark:focus:border-blue-500 dark:focus:ring-blue-500', - failure: 'border-red-500 bg-red-50 text-red-900 placeholder-red-700 focus:border-red-500 focus:ring-red-500 dark:border-red-400 dark:bg-red-100 dark:focus:border-red-500 dark:focus:ring-red-500', - warning: 'border-yellow-500 bg-yellow-50 text-yellow-900 placeholder-yellow-700 focus:border-yellow-500 focus:ring-yellow-500 dark:border-yellow-400 dark:bg-yellow-100 dark:focus:border-yellow-500 dark:focus:ring-yellow-500', - success: 'border-green-500 bg-green-50 text-green-900 placeholder-green-700 focus:border-green-500 focus:ring-green-500 dark:border-green-400 dark:bg-green-100 dark:focus:border-green-500 dark:focus:ring-green-500' - } - } - } - }, - toggleSwitch: { - base: 'group relative flex items-center rounded-lg focus:outline-none', - active: { - on: 'cursor-pointer', - off: 'cursor-not-allowed opacity-50' - }, - toggle: { - base: 'toggle-bg h-6 w-11 rounded-full border group-focus:ring-4 group-focus:ring-blue-500/25', - checked: { - on: 'border-blue-700 bg-blue-700 after:translate-x-full after:border-white', - off: 'border-gray-200 bg-gray-200 dark:border-gray-600 dark:bg-gray-700' - } - }, - label: 'ml-3 text-sm font-medium text-gray-900 dark:text-gray-300' - }, - textarea: { - base: 'block w-full rounded-lg border disabled:cursor-not-allowed disabled:opacity-50', - colors: { - gray: 'bg-gray-50 border-gray-300 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500', - info: 'border-blue-500 bg-blue-50 text-blue-900 placeholder-blue-700 focus:border-blue-500 focus:ring-blue-500 dark:border-blue-400 dark:bg-blue-100 dark:focus:border-blue-500 dark:focus:ring-blue-500', - failure: 'border-red-500 bg-red-50 text-red-900 placeholder-red-700 focus:border-red-500 focus:ring-red-500 dark:border-red-400 dark:bg-red-100 dark:focus:border-red-500 dark:focus:ring-red-500', - warning: 'border-yellow-500 bg-yellow-50 text-yellow-900 placeholder-yellow-700 focus:border-yellow-500 focus:ring-yellow-500 dark:border-yellow-400 dark:bg-yellow-100 dark:focus:border-yellow-500 dark:focus:ring-yellow-500', - success: 'border-green-500 bg-green-50 text-green-900 placeholder-green-700 focus:border-green-500 focus:ring-green-500 dark:border-green-400 dark:bg-green-100 dark:focus:border-green-500 dark:focus:ring-green-500' - }, - withShadow: { - on: 'shadow-sm dark:shadow-sm-light', - off: '' - } - }, - select: { - base: 'flex', - addon: 'inline-flex items-center rounded-l-md border border-r-0 border-gray-300 bg-gray-200 px-3 text-sm text-gray-900 dark:border-gray-600 dark:bg-gray-600 dark:text-gray-400', - field: { - base: 'relative w-full', - icon: { - base: 'pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3', - svg: 'h-5 w-5 text-gray-500 dark:text-gray-400' - }, - select: { - base: 'block w-full border disabled:cursor-not-allowed disabled:opacity-50', - withIcon: { - on: 'pl-10', - off: '' - }, - withAddon: { - on: 'rounded-r-lg', - off: 'rounded-lg' - }, - withShadow: { - on: 'shadow-sm dark:shadow-sm-light', - off: '' - }, - sizes: { - sm: 'p-2 sm:text-xs', - md: 'p-2.5 text-sm', - lg: 'sm:text-md p-4' - }, - colors: { - gray: 'bg-gray-50 border-gray-300 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500', - info: 'border-blue-500 bg-blue-50 text-blue-900 placeholder-blue-700 focus:border-blue-500 focus:ring-blue-500 dark:border-blue-400 dark:bg-blue-100 dark:focus:border-blue-500 dark:focus:ring-blue-500', - failure: 'border-red-500 bg-red-50 text-red-900 placeholder-red-700 focus:border-red-500 focus:ring-red-500 dark:border-red-400 dark:bg-red-100 dark:focus:border-red-500 dark:focus:ring-red-500', - warning: 'border-yellow-500 bg-yellow-50 text-yellow-900 placeholder-yellow-700 focus:border-yellow-500 focus:ring-yellow-500 dark:border-yellow-400 dark:bg-yellow-100 dark:focus:border-yellow-500 dark:focus:ring-yellow-500', - success: 'border-green-500 bg-green-50 text-green-900 placeholder-green-700 focus:border-green-500 focus:ring-green-500 dark:border-green-400 dark:bg-green-100 dark:focus:border-green-500 dark:focus:ring-green-500' - } - } - } - } - }, - listGroup: { - base: 'list-none rounded-lg border border-gray-200 bg-white text-sm font-medium text-gray-900 dark:border-gray-600 dark:bg-gray-700 dark:text-white', - item: { - active: { - off: 'hover:bg-gray-100 hover:text-blue-700 focus:text-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-700 dark:border-gray-600 dark:hover:bg-gray-600 dark:hover:text-white dark:focus:text-white dark:focus:ring-gray-500', - on: 'bg-blue-700 text-white dark:bg-gray-800' - }, - base: 'flex w-full cursor-pointer border-b border-gray-200 py-2 px-4 first:rounded-t-lg last:rounded-b-lg last:border-b-0 dark:border-gray-600', - href: { - off: '', - on: '' - }, - icon: 'mr-2 h-4 w-4 fill-current' - } - }, - modal: { - base: 'fixed top-0 right-0 left-0 z-50 h-modal overflow-y-auto overflow-x-hidden md:inset-0 md:h-full', - show: { - on: 'flex bg-gray-900 bg-opacity-50 dark:bg-opacity-80', - off: 'hidden' - }, - content: { - base: 'relative h-full w-full p-4 md:h-auto', - inner: 'relative rounded-lg bg-white shadow dark:bg-gray-700' - }, - body: { - base: 'p-6', - popup: 'pt-0' - }, - header: { - base: 'flex items-start justify-between rounded-t dark:border-gray-600 border-b p-5', - popup: '!p-2 !border-b-0', - title: 'text-xl font-medium text-gray-900 dark:text-white', - close: { - base: 'ml-auto inline-flex items-center rounded-lg bg-transparent p-1.5 text-sm text-gray-400 hover:bg-gray-200 hover:text-gray-900 dark:hover:bg-gray-600 dark:hover:text-white', - icon: 'h-5 w-5' - } - }, - footer: { - base: 'flex items-center space-x-2 rounded-b border-gray-200 p-6 dark:border-gray-600', - popup: 'border-t' - }, - sizes: { - sm: 'max-w-sm', - md: 'max-w-md', - lg: 'max-w-lg', - xl: 'max-w-xl', - '2xl': 'max-w-2xl', - '3xl': 'max-w-3xl', - '4xl': 'max-w-4xl', - '5xl': 'max-w-5xl', - '6xl': 'max-w-6xl', - '7xl': 'max-w-7xl' - }, - positions: { - 'top-left': 'items-start justify-start', - 'top-center': 'items-start justify-center', - 'top-right': 'items-start justify-end', - 'center-left': 'items-center justify-start', - center: 'items-center justify-center', - 'center-right': 'items-center justify-end', - 'bottom-right': 'items-end justify-end', - 'bottom-center': 'items-end justify-center', - 'bottom-left': 'items-end justify-start' - } - }, - navbar: { - base: 'border-gray-200 bg-white px-2 py-2.5 dark:border-gray-700 dark:bg-gray-800 sm:px-4', - rounded: { - on: 'rounded', - off: '' - }, - bordered: { - on: 'border', - off: '' - }, - inner: { - base: 'mx-auto flex flex-wrap items-center justify-between', - fluid: { - on: '', - off: 'container' - } - }, - brand: 'flex items-center', - collapse: { - base: 'w-full md:block md:w-auto', - list: 'mt-4 flex flex-col md:mt-0 md:flex-row md:space-x-8 md:text-sm md:font-medium', - hidden: { - on: 'hidden', - off: '' - } - }, - link: { - base: 'block py-2 pr-4 pl-3 md:p-0', - active: { - on: 'bg-blue-700 text-white dark:text-white md:bg-transparent md:text-blue-700', - off: 'border-b border-gray-100 text-gray-700 hover:bg-gray-50 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white md:border-0 md:hover:bg-transparent md:hover:text-blue-700 md:dark:hover:bg-transparent md:dark:hover:text-white' - }, - disabled: { - on: 'text-gray-400 hover:cursor-not-allowed dark:text-gray-600', - off: '' - } - }, - toggle: { - base: 'inline-flex items-center rounded-lg p-2 text-sm text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600 md:hidden', - icon: 'h-6 w-6 shrink-0' - } - }, - rating: { - base: 'flex items-center', - star: { - sizes: { - sm: 'w-5 h-5', - md: 'w-7 h-7', - lg: 'w-10 h-10' - }, - filled: 'text-yellow-400', - empty: 'text-gray-300 dark:text-gray-500' - }, - advanced: { - base: 'flex items-center', - label: 'text-sm font-medium text-blue-600 dark:text-blue-500', - progress: { - base: 'mx-4 h-5 w-2/4 rounded bg-gray-200 dark:bg-gray-700', - fill: 'h-5 rounded bg-yellow-400', - label: 'text-sm font-medium text-blue-600 dark:text-blue-500' - } - } - }, - pagination: { - base: '', - layout: { - table: { - base: 'text-sm text-gray-700 dark:text-gray-400', - span: 'font-semibold text-gray-900 dark:text-white' - } - }, - pages: { - base: 'xs:mt-0 mt-2 inline-flex items-center -space-x-px', - showIcon: 'inline-flex', - previous: { - base: 'ml-0 rounded-l-lg border border-gray-300 bg-white py-2 px-3 leading-tight text-gray-500 hover:bg-gray-100 hover:text-gray-700 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white', - icon: 'h-5 w-5' - }, - next: { - base: 'rounded-r-lg border border-gray-300 bg-white py-2 px-3 leading-tight text-gray-500 hover:bg-gray-100 hover:text-gray-700 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white', - icon: 'h-5 w-5' - }, - selector: { - base: 'w-12 border border-gray-300 bg-white py-2 leading-tight text-gray-500 hover:bg-gray-100 hover:text-gray-700 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white', - active: 'bg-blue-50 text-blue-600 hover:bg-blue-100 hover:text-blue-700 dark:border-gray-700 dark:bg-gray-700 dark:text-white' - } - } - }, - sidebar: { - base: 'h-full', - inner: 'h-full overflow-y-auto overflow-x-hidden rounded bg-white py-4 px-3 dark:bg-gray-800', - collapsed: { - on: 'w-16', - off: 'w-64' - }, - collapse: { - button: 'group flex w-full items-center rounded-lg p-2 text-base font-normal text-gray-900 transition duration-75 hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700', - icon: { - base: 'h-6 w-6 text-gray-500 transition duration-75 group-hover:text-gray-900 dark:text-gray-400 dark:group-hover:text-white', - open: { - off: '', - on: 'text-gray-900' - } - }, - label: { - base: 'ml-3 flex-1 whitespace-nowrap text-left', - icon: 'h-6 w-6' - }, - list: 'space-y-2 py-2' - }, - cta: { - base: 'mt-6 rounded-lg p-4', - color: { - blue: 'bg-blue-50 dark:bg-blue-900', - dark: 'bg-dark-50 dark:bg-dark-900', - failure: 'bg-red-50 dark:bg-red-900', - gray: 'bg-alternative-50 dark:bg-alternative-900', - green: 'bg-green-50 dark:bg-green-900', - light: 'bg-light-50 dark:bg-light-900', - red: 'bg-red-50 dark:bg-red-900', - purple: 'bg-purple-50 dark:bg-purple-900', - success: 'bg-green-50 dark:bg-green-900', - yellow: 'bg-yellow-50 dark:bg-yellow-900', - warning: 'bg-yellow-50 dark:bg-yellow-900' - } - }, - item: { - base: 'flex items-center justify-center rounded-lg p-2 text-base font-normal text-gray-900 hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700', - active: 'bg-gray-100 dark:bg-gray-700', - collapsed: { - insideCollapse: 'group w-full pl-8 transition duration-75', - noIcon: 'font-bold' - }, - content: { - base: 'px-3 flex-1 whitespace-nowrap' - }, - icon: { - base: 'h-6 w-6 flex-shrink-0 text-gray-500 transition duration-75 group-hover:text-gray-900 dark:text-gray-400 dark:group-hover:text-white', - active: 'text-gray-700 dark:text-gray-100' - } - }, - items: '', - itemGroup: 'mt-4 space-y-2 border-t border-gray-200 pt-4 first:mt-0 first:border-t-0 first:pt-0 dark:border-gray-700', - logo: { - base: 'mb-5 flex items-center pl-2.5', - collapsed: { - on: 'hidden', - off: 'self-center whitespace-nowrap text-xl font-semibold dark:text-white' - }, - img: 'mr-3 h-6 sm:h-7' - } - }, - progress: { - base: 'w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700', - label: 'mb-1 flex justify-between font-medium dark:text-white', - bar: 'flex items-center justify-center rounded-full text-center font-medium leading-none text-blue-100', - color: { - dark: 'bg-gray-600 dark:bg-gray-300', - blue: 'bg-blue-600', - red: 'bg-red-600 dark:bg-red-500', - green: 'bg-green-600 dark:bg-green-500', - yellow: 'bg-yellow-400', - indigo: 'bg-indigo-600 dark:bg-indigo-500', - purple: 'bg-purple-600 dark:bg-purple-500' - }, - size: { - sm: 'h-1.5', - md: 'h-2.5', - lg: 'h-4', - xl: 'h-6' - } - }, - spinner: { - base: 'inline animate-spin text-gray-200', - color: { - failure: 'fill-red-600', - gray: 'fill-gray-600', - info: 'fill-blue-600', - pink: 'fill-pink-600', - purple: 'fill-purple-600', - success: 'fill-green-500', - warning: 'fill-yellow-400' - }, - light: { - off: { - base: 'dark:text-gray-600', - color: { - failure: '', - gray: 'dark:fill-gray-300', - info: '', - pink: '', - purple: '', - success: '', - warning: '' - } - }, - on: { - base: '', - color: { - failure: '', - gray: '', - info: '', - pink: '', - purple: '', - success: '', - warning: '' - } - } - }, - size: { - xs: 'w-3 h-3', - sm: 'w-4 h-4', - md: 'w-6 h-6', - lg: 'w-8 h-8', - xl: 'w-10 h-10' - } - }, - tab: { - base: 'flex flex-col gap-2', - tablist: { - base: 'flex text-center', - styles: { - default: 'flex-wrap border-b border-gray-200 dark:border-gray-700', - underline: 'flex-wrap -mb-px border-b border-gray-200 dark:border-gray-700', - pills: 'flex-wrap font-medium text-sm text-gray-500 dark:text-gray-400', - fullWidth: 'hidden text-sm font-medium rounded-lg divide-x divide-gray-200 shadow sm:flex dark:divide-gray-700 dark:text-gray-400' - }, - tabitem: { - base: 'flex items-center justify-center p-4 text-sm font-medium first:ml-0 disabled:cursor-not-allowed disabled:text-gray-400 disabled:dark:text-gray-500', - styles: { - default: { - base: 'rounded-t-lg', - active: { - on: 'bg-gray-100 text-blue-600 dark:bg-gray-800 dark:text-blue-500', - off: 'text-gray-500 hover:bg-gray-50 hover:text-gray-600 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-300' - } - }, - underline: { - base: 'rounded-t-lg', - active: { - on: 'text-blue-600 rounded-t-lg border-b-2 border-blue-600 active dark:text-blue-500 dark:border-blue-500', - off: 'border-b-2 border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-300' - } - }, - pills: { - base: '', - active: { - on: 'rounded-lg bg-blue-600 text-white', - off: 'rounded-lg hover:text-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 dark:hover:text-white' - } - }, - fullWidth: { - base: 'ml-2 first:ml-0 w-full first:rounded-l-lg last:rounded-r-lg', - active: { - on: 'inline-block p-4 w-full text-gray-900 bg-gray-100 focus:ring-4 focus:ring-blue-300 active focus:outline-none dark:bg-gray-700 dark:text-white', - off: 'bg-white hover:text-gray-700 hover:bg-gray-50 focus:ring-4 focus:ring-blue-300 focus:outline-none dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700' - } - } - }, - icon: 'mr-2 h-5 w-5' - } - }, - tabpanel: 'p-4' - }, - toast: { - base: 'flex w-full max-w-xs items-center rounded-lg bg-white p-4 text-gray-500 shadow dark:bg-gray-800 dark:text-gray-400', - closed: 'opacity-0 ease-out', - removed: 'hidden', - toggle: { - base: '-mx-1.5 -my-1.5 ml-auto inline-flex h-8 w-8 rounded-lg bg-white p-1.5 text-gray-400 hover:bg-gray-100 hover:text-gray-900 focus:ring-2 focus:ring-gray-300 dark:bg-gray-800 dark:text-gray-500 dark:hover:bg-gray-700 dark:hover:text-white', - icon: 'h-5 w-5 shrink-0' - } - }, - tooltip: { - target: 'w-fit', - base: 'absolute inline-block rounded-lg py-2 px-3 text-sm font-medium shadow-sm', - animation: 'transition-opacity', - hidden: 'invisible opacity-0', - style: { - dark: 'bg-gray-900 text-white dark:bg-gray-700', - light: 'border border-gray-200 bg-white text-gray-900', - auto: 'border border-gray-200 bg-white text-gray-900 dark:border-none dark:bg-gray-700 dark:text-white' - }, - content: 'relative z-20', - arrow: { - base: 'absolute z-10 h-2 w-2 rotate-45', - style: { - dark: 'bg-gray-900 dark:bg-gray-700', - light: 'bg-white', - auto: 'bg-white dark:bg-gray-700' - }, - placement: '-4px' - } - } -}; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (theme); - -/***/ }), - -/***/ "./node_modules/history/index.js": -/*!***************************************!*\ - !*** ./node_modules/history/index.js ***! - \***************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Action": () => (/* binding */ Action), -/* harmony export */ "createBrowserHistory": () => (/* binding */ createBrowserHistory), -/* harmony export */ "createHashHistory": () => (/* binding */ createHashHistory), -/* harmony export */ "createMemoryHistory": () => (/* binding */ createMemoryHistory), -/* harmony export */ "createPath": () => (/* binding */ createPath), -/* harmony export */ "parsePath": () => (/* binding */ parsePath) -/* harmony export */ }); -/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./node_modules/@babel/runtime/helpers/esm/extends.js"); - -/** - * Actions represent the type of change to a location value. - * - * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action - */ - -var Action; - -(function (Action) { - /** - * A POP indicates a change to an arbitrary index in the history stack, such - * as a back or forward navigation. It does not describe the direction of the - * navigation, only that the current index changed. - * - * Note: This is the default action for newly created history objects. - */ - Action["Pop"] = "POP"; - /** - * A PUSH indicates a new entry being added to the history stack, such as when - * a link is clicked and a new page loads. When this happens, all subsequent - * entries in the stack are lost. - */ - - Action["Push"] = "PUSH"; - /** - * A REPLACE indicates the entry at the current index in the history stack - * being replaced by a new one. - */ - - Action["Replace"] = "REPLACE"; -})(Action || (Action = {})); - -var readOnly = true ? function (obj) { - return Object.freeze(obj); -} : 0; - -function warning(cond, message) { - if (!cond) { - // eslint-disable-next-line no-console - if (typeof console !== 'undefined') console.warn(message); - - try { - // Welcome to debugging history! - // - // This error is thrown as a convenience so you can more easily - // find the source for a warning that appears in the console by - // enabling "pause on exceptions" in your JavaScript debugger. - throw new Error(message); // eslint-disable-next-line no-empty - } catch (e) {} - } -} - -var BeforeUnloadEventType = 'beforeunload'; -var HashChangeEventType = 'hashchange'; -var PopStateEventType = 'popstate'; -/** - * Browser history stores the location in regular URLs. This is the standard for - * most web apps, but it requires some configuration on the server to ensure you - * serve the same app at multiple URLs. - * - * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory - */ - -function createBrowserHistory(options) { - if (options === void 0) { - options = {}; - } - - var _options = options, - _options$window = _options.window, - window = _options$window === void 0 ? document.defaultView : _options$window; - var globalHistory = window.history; - - function getIndexAndLocation() { - var _window$location = window.location, - pathname = _window$location.pathname, - search = _window$location.search, - hash = _window$location.hash; - var state = globalHistory.state || {}; - return [state.idx, readOnly({ - pathname: pathname, - search: search, - hash: hash, - state: state.usr || null, - key: state.key || 'default' - })]; - } - - var blockedPopTx = null; - - function handlePop() { - if (blockedPopTx) { - blockers.call(blockedPopTx); - blockedPopTx = null; - } else { - var nextAction = Action.Pop; - - var _getIndexAndLocation = getIndexAndLocation(), - nextIndex = _getIndexAndLocation[0], - nextLocation = _getIndexAndLocation[1]; - - if (blockers.length) { - if (nextIndex != null) { - var delta = index - nextIndex; - - if (delta) { - // Revert the POP - blockedPopTx = { - action: nextAction, - location: nextLocation, - retry: function retry() { - go(delta * -1); - } - }; - go(delta); - } - } else { - // Trying to POP to a location with no index. We did not create - // this location, so we can't effectively block the navigation. - true ? warning(false, // TODO: Write up a doc that explains our blocking strategy in - // detail and link to it here so people can understand better what - // is going on and how to avoid it. - "You are trying to block a POP navigation to a location that was not " + "created by the history library. The block will fail silently in " + "production, but in general you should do all navigation with the " + "history library (instead of using window.history.pushState directly) " + "to avoid this situation.") : 0; - } - } else { - applyTx(nextAction); - } - } - } - - window.addEventListener(PopStateEventType, handlePop); - var action = Action.Pop; - - var _getIndexAndLocation2 = getIndexAndLocation(), - index = _getIndexAndLocation2[0], - location = _getIndexAndLocation2[1]; - - var listeners = createEvents(); - var blockers = createEvents(); - - if (index == null) { - index = 0; - globalHistory.replaceState((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, globalHistory.state, { - idx: index - }), ''); - } - - function createHref(to) { - return typeof to === 'string' ? to : createPath(to); - } // state defaults to `null` because `window.history.state` does - - - function getNextLocation(to, state) { - if (state === void 0) { - state = null; - } - - return readOnly((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({ - pathname: location.pathname, - hash: '', - search: '' - }, typeof to === 'string' ? parsePath(to) : to, { - state: state, - key: createKey() - })); - } - - function getHistoryStateAndUrl(nextLocation, index) { - return [{ - usr: nextLocation.state, - key: nextLocation.key, - idx: index - }, createHref(nextLocation)]; - } - - function allowTx(action, location, retry) { - return !blockers.length || (blockers.call({ - action: action, - location: location, - retry: retry - }), false); - } - - function applyTx(nextAction) { - action = nextAction; - - var _getIndexAndLocation3 = getIndexAndLocation(); - - index = _getIndexAndLocation3[0]; - location = _getIndexAndLocation3[1]; - listeners.call({ - action: action, - location: location - }); - } - - function push(to, state) { - var nextAction = Action.Push; - var nextLocation = getNextLocation(to, state); - - function retry() { - push(to, state); - } - - if (allowTx(nextAction, nextLocation, retry)) { - var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1), - historyState = _getHistoryStateAndUr[0], - url = _getHistoryStateAndUr[1]; // TODO: Support forced reloading - // try...catch because iOS limits us to 100 pushState calls :/ - - - try { - globalHistory.pushState(historyState, '', url); - } catch (error) { - // They are going to lose state here, but there is no real - // way to warn them about it since the page will refresh... - window.location.assign(url); - } - - applyTx(nextAction); - } - } - - function replace(to, state) { - var nextAction = Action.Replace; - var nextLocation = getNextLocation(to, state); - - function retry() { - replace(to, state); - } - - if (allowTx(nextAction, nextLocation, retry)) { - var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index), - historyState = _getHistoryStateAndUr2[0], - url = _getHistoryStateAndUr2[1]; // TODO: Support forced reloading - - - globalHistory.replaceState(historyState, '', url); - applyTx(nextAction); - } - } - - function go(delta) { - globalHistory.go(delta); - } - - var history = { - get action() { - return action; - }, - - get location() { - return location; - }, - - createHref: createHref, - push: push, - replace: replace, - go: go, - back: function back() { - go(-1); - }, - forward: function forward() { - go(1); - }, - listen: function listen(listener) { - return listeners.push(listener); - }, - block: function block(blocker) { - var unblock = blockers.push(blocker); - - if (blockers.length === 1) { - window.addEventListener(BeforeUnloadEventType, promptBeforeUnload); - } - - return function () { - unblock(); // Remove the beforeunload listener so the document may - // still be salvageable in the pagehide event. - // See https://html.spec.whatwg.org/#unloading-documents - - if (!blockers.length) { - window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload); - } - }; - } - }; - return history; -} -/** - * Hash history stores the location in window.location.hash. This makes it ideal - * for situations where you don't want to send the location to the server for - * some reason, either because you do cannot configure it or the URL space is - * reserved for something else. - * - * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory - */ - - -function createHashHistory(options) { - if (options === void 0) { - options = {}; - } - - var _options2 = options, - _options2$window = _options2.window, - window = _options2$window === void 0 ? document.defaultView : _options2$window; - var globalHistory = window.history; - - function getIndexAndLocation() { - var _parsePath = parsePath(window.location.hash.substr(1)), - _parsePath$pathname = _parsePath.pathname, - pathname = _parsePath$pathname === void 0 ? '/' : _parsePath$pathname, - _parsePath$search = _parsePath.search, - search = _parsePath$search === void 0 ? '' : _parsePath$search, - _parsePath$hash = _parsePath.hash, - hash = _parsePath$hash === void 0 ? '' : _parsePath$hash; - - var state = globalHistory.state || {}; - return [state.idx, readOnly({ - pathname: pathname, - search: search, - hash: hash, - state: state.usr || null, - key: state.key || 'default' - })]; - } - - var blockedPopTx = null; - - function handlePop() { - if (blockedPopTx) { - blockers.call(blockedPopTx); - blockedPopTx = null; - } else { - var nextAction = Action.Pop; - - var _getIndexAndLocation4 = getIndexAndLocation(), - nextIndex = _getIndexAndLocation4[0], - nextLocation = _getIndexAndLocation4[1]; - - if (blockers.length) { - if (nextIndex != null) { - var delta = index - nextIndex; - - if (delta) { - // Revert the POP - blockedPopTx = { - action: nextAction, - location: nextLocation, - retry: function retry() { - go(delta * -1); - } - }; - go(delta); - } - } else { - // Trying to POP to a location with no index. We did not create - // this location, so we can't effectively block the navigation. - true ? warning(false, // TODO: Write up a doc that explains our blocking strategy in - // detail and link to it here so people can understand better - // what is going on and how to avoid it. - "You are trying to block a POP navigation to a location that was not " + "created by the history library. The block will fail silently in " + "production, but in general you should do all navigation with the " + "history library (instead of using window.history.pushState directly) " + "to avoid this situation.") : 0; - } - } else { - applyTx(nextAction); - } - } - } - - window.addEventListener(PopStateEventType, handlePop); // popstate does not fire on hashchange in IE 11 and old (trident) Edge - // https://developer.mozilla.org/de/docs/Web/API/Window/popstate_event - - window.addEventListener(HashChangeEventType, function () { - var _getIndexAndLocation5 = getIndexAndLocation(), - nextLocation = _getIndexAndLocation5[1]; // Ignore extraneous hashchange events. - - - if (createPath(nextLocation) !== createPath(location)) { - handlePop(); - } - }); - var action = Action.Pop; - - var _getIndexAndLocation6 = getIndexAndLocation(), - index = _getIndexAndLocation6[0], - location = _getIndexAndLocation6[1]; - - var listeners = createEvents(); - var blockers = createEvents(); - - if (index == null) { - index = 0; - globalHistory.replaceState((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, globalHistory.state, { - idx: index - }), ''); - } - - function getBaseHref() { - var base = document.querySelector('base'); - var href = ''; - - if (base && base.getAttribute('href')) { - var url = window.location.href; - var hashIndex = url.indexOf('#'); - href = hashIndex === -1 ? url : url.slice(0, hashIndex); - } - - return href; - } - - function createHref(to) { - return getBaseHref() + '#' + (typeof to === 'string' ? to : createPath(to)); - } - - function getNextLocation(to, state) { - if (state === void 0) { - state = null; - } - - return readOnly((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({ - pathname: location.pathname, - hash: '', - search: '' - }, typeof to === 'string' ? parsePath(to) : to, { - state: state, - key: createKey() - })); - } - - function getHistoryStateAndUrl(nextLocation, index) { - return [{ - usr: nextLocation.state, - key: nextLocation.key, - idx: index - }, createHref(nextLocation)]; - } - - function allowTx(action, location, retry) { - return !blockers.length || (blockers.call({ - action: action, - location: location, - retry: retry - }), false); - } - - function applyTx(nextAction) { - action = nextAction; - - var _getIndexAndLocation7 = getIndexAndLocation(); - - index = _getIndexAndLocation7[0]; - location = _getIndexAndLocation7[1]; - listeners.call({ - action: action, - location: location - }); - } - - function push(to, state) { - var nextAction = Action.Push; - var nextLocation = getNextLocation(to, state); - - function retry() { - push(to, state); - } - - true ? warning(nextLocation.pathname.charAt(0) === '/', "Relative pathnames are not supported in hash history.push(" + JSON.stringify(to) + ")") : 0; - - if (allowTx(nextAction, nextLocation, retry)) { - var _getHistoryStateAndUr3 = getHistoryStateAndUrl(nextLocation, index + 1), - historyState = _getHistoryStateAndUr3[0], - url = _getHistoryStateAndUr3[1]; // TODO: Support forced reloading - // try...catch because iOS limits us to 100 pushState calls :/ - - - try { - globalHistory.pushState(historyState, '', url); - } catch (error) { - // They are going to lose state here, but there is no real - // way to warn them about it since the page will refresh... - window.location.assign(url); - } - - applyTx(nextAction); - } - } - - function replace(to, state) { - var nextAction = Action.Replace; - var nextLocation = getNextLocation(to, state); - - function retry() { - replace(to, state); - } - - true ? warning(nextLocation.pathname.charAt(0) === '/', "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(to) + ")") : 0; - - if (allowTx(nextAction, nextLocation, retry)) { - var _getHistoryStateAndUr4 = getHistoryStateAndUrl(nextLocation, index), - historyState = _getHistoryStateAndUr4[0], - url = _getHistoryStateAndUr4[1]; // TODO: Support forced reloading - - - globalHistory.replaceState(historyState, '', url); - applyTx(nextAction); - } - } - - function go(delta) { - globalHistory.go(delta); - } - - var history = { - get action() { - return action; - }, - - get location() { - return location; - }, - - createHref: createHref, - push: push, - replace: replace, - go: go, - back: function back() { - go(-1); - }, - forward: function forward() { - go(1); - }, - listen: function listen(listener) { - return listeners.push(listener); - }, - block: function block(blocker) { - var unblock = blockers.push(blocker); - - if (blockers.length === 1) { - window.addEventListener(BeforeUnloadEventType, promptBeforeUnload); - } - - return function () { - unblock(); // Remove the beforeunload listener so the document may - // still be salvageable in the pagehide event. - // See https://html.spec.whatwg.org/#unloading-documents - - if (!blockers.length) { - window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload); - } - }; - } - }; - return history; -} -/** - * Memory history stores the current location in memory. It is designed for use - * in stateful non-browser environments like tests and React Native. - * - * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#creatememoryhistory - */ - - -function createMemoryHistory(options) { - if (options === void 0) { - options = {}; - } - - var _options3 = options, - _options3$initialEntr = _options3.initialEntries, - initialEntries = _options3$initialEntr === void 0 ? ['/'] : _options3$initialEntr, - initialIndex = _options3.initialIndex; - var entries = initialEntries.map(function (entry) { - var location = readOnly((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({ - pathname: '/', - search: '', - hash: '', - state: null, - key: createKey() - }, typeof entry === 'string' ? parsePath(entry) : entry)); - true ? warning(location.pathname.charAt(0) === '/', "Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: " + JSON.stringify(entry) + ")") : 0; - return location; - }); - var index = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1); - var action = Action.Pop; - var location = entries[index]; - var listeners = createEvents(); - var blockers = createEvents(); - - function createHref(to) { - return typeof to === 'string' ? to : createPath(to); - } - - function getNextLocation(to, state) { - if (state === void 0) { - state = null; - } - - return readOnly((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({ - pathname: location.pathname, - search: '', - hash: '' - }, typeof to === 'string' ? parsePath(to) : to, { - state: state, - key: createKey() - })); - } - - function allowTx(action, location, retry) { - return !blockers.length || (blockers.call({ - action: action, - location: location, - retry: retry - }), false); - } - - function applyTx(nextAction, nextLocation) { - action = nextAction; - location = nextLocation; - listeners.call({ - action: action, - location: location - }); - } - - function push(to, state) { - var nextAction = Action.Push; - var nextLocation = getNextLocation(to, state); - - function retry() { - push(to, state); - } - - true ? warning(location.pathname.charAt(0) === '/', "Relative pathnames are not supported in memory history.push(" + JSON.stringify(to) + ")") : 0; - - if (allowTx(nextAction, nextLocation, retry)) { - index += 1; - entries.splice(index, entries.length, nextLocation); - applyTx(nextAction, nextLocation); - } - } - - function replace(to, state) { - var nextAction = Action.Replace; - var nextLocation = getNextLocation(to, state); - - function retry() { - replace(to, state); - } - - true ? warning(location.pathname.charAt(0) === '/', "Relative pathnames are not supported in memory history.replace(" + JSON.stringify(to) + ")") : 0; - - if (allowTx(nextAction, nextLocation, retry)) { - entries[index] = nextLocation; - applyTx(nextAction, nextLocation); - } - } - - function go(delta) { - var nextIndex = clamp(index + delta, 0, entries.length - 1); - var nextAction = Action.Pop; - var nextLocation = entries[nextIndex]; - - function retry() { - go(delta); - } - - if (allowTx(nextAction, nextLocation, retry)) { - index = nextIndex; - applyTx(nextAction, nextLocation); - } - } - - var history = { - get index() { - return index; - }, - - get action() { - return action; - }, - - get location() { - return location; - }, - - createHref: createHref, - push: push, - replace: replace, - go: go, - back: function back() { - go(-1); - }, - forward: function forward() { - go(1); - }, - listen: function listen(listener) { - return listeners.push(listener); - }, - block: function block(blocker) { - return blockers.push(blocker); - } - }; - return history; -} //////////////////////////////////////////////////////////////////////////////// -// UTILS -//////////////////////////////////////////////////////////////////////////////// - - -function clamp(n, lowerBound, upperBound) { - return Math.min(Math.max(n, lowerBound), upperBound); -} - -function promptBeforeUnload(event) { - // Cancel the event. - event.preventDefault(); // Chrome (and legacy IE) requires returnValue to be set. - - event.returnValue = ''; -} - -function createEvents() { - var handlers = []; - return { - get length() { - return handlers.length; - }, - - push: function push(fn) { - handlers.push(fn); - return function () { - handlers = handlers.filter(function (handler) { - return handler !== fn; - }); - }; - }, - call: function call(arg) { - handlers.forEach(function (fn) { - return fn && fn(arg); - }); - } - }; -} - -function createKey() { - return Math.random().toString(36).substr(2, 8); -} -/** - * Creates a string URL path from the given pathname, search, and hash components. - * - * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createpath - */ - - -function createPath(_ref) { - var _ref$pathname = _ref.pathname, - pathname = _ref$pathname === void 0 ? '/' : _ref$pathname, - _ref$search = _ref.search, - search = _ref$search === void 0 ? '' : _ref$search, - _ref$hash = _ref.hash, - hash = _ref$hash === void 0 ? '' : _ref$hash; - if (search && search !== '?') pathname += search.charAt(0) === '?' ? search : '?' + search; - if (hash && hash !== '#') pathname += hash.charAt(0) === '#' ? hash : '#' + hash; - return pathname; -} -/** - * Parses a string URL path into its separate pathname, search, and hash components. - * - * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath - */ - - -function parsePath(path) { - var parsedPath = {}; - - if (path) { - var hashIndex = path.indexOf('#'); - - if (hashIndex >= 0) { - parsedPath.hash = path.substr(hashIndex); - path = path.substr(0, hashIndex); - } - - var searchIndex = path.indexOf('?'); - - if (searchIndex >= 0) { - parsedPath.search = path.substr(searchIndex); - path = path.substr(0, searchIndex); - } - - if (path) { - parsedPath.pathname = path; - } - } - - return parsedPath; -} - - - -/***/ }), - -/***/ "./node_modules/html-entities/lib/index.js": -/*!*************************************************!*\ - !*** ./node_modules/html-entities/lib/index.js ***! - \*************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - - -var __assign = this && this.__assign || function () { - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - - return t; - }; - - return __assign.apply(this, arguments); -}; - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); - -var named_references_1 = __webpack_require__(/*! ./named-references */ "./node_modules/html-entities/lib/named-references.js"); - -var numeric_unicode_map_1 = __webpack_require__(/*! ./numeric-unicode-map */ "./node_modules/html-entities/lib/numeric-unicode-map.js"); - -var surrogate_pairs_1 = __webpack_require__(/*! ./surrogate-pairs */ "./node_modules/html-entities/lib/surrogate-pairs.js"); - -var allNamedReferences = __assign(__assign({}, named_references_1.namedReferences), { - all: named_references_1.namedReferences.html5 -}); - -var encodeRegExps = { - specialChars: /[<>'"&]/g, - nonAscii: /(?:[<>'"&\u0080-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g, - nonAsciiPrintable: /(?:[<>'"&\x01-\x08\x11-\x15\x17-\x1F\x7f-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g, - extensive: /(?:[\x01-\x0c\x0e-\x1f\x21-\x2c\x2e-\x2f\x3a-\x40\x5b-\x60\x7b-\x7d\x7f-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g -}; -var defaultEncodeOptions = { - mode: 'specialChars', - level: 'all', - numeric: 'decimal' -}; -/** Encodes all the necessary (specified by `level`) characters in the text */ - -function encode(text, _a) { - var _b = _a === void 0 ? defaultEncodeOptions : _a, - _c = _b.mode, - mode = _c === void 0 ? 'specialChars' : _c, - _d = _b.numeric, - numeric = _d === void 0 ? 'decimal' : _d, - _e = _b.level, - level = _e === void 0 ? 'all' : _e; - - if (!text) { - return ''; - } - - var encodeRegExp = encodeRegExps[mode]; - var references = allNamedReferences[level].characters; - var isHex = numeric === 'hexadecimal'; - encodeRegExp.lastIndex = 0; - - var _b = encodeRegExp.exec(text); - - var _c; - - if (_b) { - _c = ''; - var _d = 0; - - do { - if (_d !== _b.index) { - _c += text.substring(_d, _b.index); - } - - var _e = _b[0]; - var result_1 = references[_e]; - - if (!result_1) { - var code_1 = _e.length > 1 ? surrogate_pairs_1.getCodePoint(_e, 0) : _e.charCodeAt(0); - result_1 = (isHex ? '&#x' + code_1.toString(16) : '&#' + code_1) + ';'; - } - - _c += result_1; - _d = _b.index + _e.length; - } while (_b = encodeRegExp.exec(text)); - - if (_d !== text.length) { - _c += text.substring(_d); - } - } else { - _c = text; - } - - return _c; -} - -exports.encode = encode; -var defaultDecodeOptions = { - scope: 'body', - level: 'all' -}; -var strict = /&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);/g; -var attribute = /&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+)[;=]?/g; -var baseDecodeRegExps = { - xml: { - strict: strict, - attribute: attribute, - body: named_references_1.bodyRegExps.xml - }, - html4: { - strict: strict, - attribute: attribute, - body: named_references_1.bodyRegExps.html4 - }, - html5: { - strict: strict, - attribute: attribute, - body: named_references_1.bodyRegExps.html5 - } -}; - -var decodeRegExps = __assign(__assign({}, baseDecodeRegExps), { - all: baseDecodeRegExps.html5 -}); - -var fromCharCode = String.fromCharCode; -var outOfBoundsChar = fromCharCode(65533); -var defaultDecodeEntityOptions = { - level: 'all' -}; -/** Decodes a single entity */ - -function decodeEntity(entity, _a) { - var _b = (_a === void 0 ? defaultDecodeEntityOptions : _a).level, - level = _b === void 0 ? 'all' : _b; - - if (!entity) { - return ''; - } - - var _b = entity; - var decodeEntityLastChar_1 = entity[entity.length - 1]; - - if (false) {} else if (false) {} else { - var decodeResultByReference_1 = allNamedReferences[level].entities[entity]; - - if (decodeResultByReference_1) { - _b = decodeResultByReference_1; - } else if (entity[0] === '&' && entity[1] === '#') { - var decodeSecondChar_1 = entity[2]; - var decodeCode_1 = decodeSecondChar_1 == 'x' || decodeSecondChar_1 == 'X' ? parseInt(entity.substr(3), 16) : parseInt(entity.substr(2)); - _b = decodeCode_1 >= 0x10ffff ? outOfBoundsChar : decodeCode_1 > 65535 ? surrogate_pairs_1.fromCodePoint(decodeCode_1) : fromCharCode(numeric_unicode_map_1.numericUnicodeMap[decodeCode_1] || decodeCode_1); - } - } - - return _b; -} - -exports.decodeEntity = decodeEntity; -/** Decodes all entities in the text */ - -function decode(text, _a) { - var decodeSecondChar_1 = _a === void 0 ? defaultDecodeOptions : _a, - decodeCode_1 = decodeSecondChar_1.level, - level = decodeCode_1 === void 0 ? 'all' : decodeCode_1, - _b = decodeSecondChar_1.scope, - scope = _b === void 0 ? level === 'xml' ? 'strict' : 'body' : _b; - - if (!text) { - return ''; - } - - var decodeRegExp = decodeRegExps[level][scope]; - var references = allNamedReferences[level].entities; - var isAttribute = scope === 'attribute'; - var isStrict = scope === 'strict'; - decodeRegExp.lastIndex = 0; - var replaceMatch_1 = decodeRegExp.exec(text); - var replaceResult_1; - - if (replaceMatch_1) { - replaceResult_1 = ''; - var replaceLastIndex_1 = 0; - - do { - if (replaceLastIndex_1 !== replaceMatch_1.index) { - replaceResult_1 += text.substring(replaceLastIndex_1, replaceMatch_1.index); - } - - var replaceInput_1 = replaceMatch_1[0]; - var decodeResult_1 = replaceInput_1; - var decodeEntityLastChar_2 = replaceInput_1[replaceInput_1.length - 1]; - - if (isAttribute && decodeEntityLastChar_2 === '=') { - decodeResult_1 = replaceInput_1; - } else if (isStrict && decodeEntityLastChar_2 !== ';') { - decodeResult_1 = replaceInput_1; - } else { - var decodeResultByReference_2 = references[replaceInput_1]; - - if (decodeResultByReference_2) { - decodeResult_1 = decodeResultByReference_2; - } else if (replaceInput_1[0] === '&' && replaceInput_1[1] === '#') { - var decodeSecondChar_2 = replaceInput_1[2]; - var decodeCode_2 = decodeSecondChar_2 == 'x' || decodeSecondChar_2 == 'X' ? parseInt(replaceInput_1.substr(3), 16) : parseInt(replaceInput_1.substr(2)); - decodeResult_1 = decodeCode_2 >= 0x10ffff ? outOfBoundsChar : decodeCode_2 > 65535 ? surrogate_pairs_1.fromCodePoint(decodeCode_2) : fromCharCode(numeric_unicode_map_1.numericUnicodeMap[decodeCode_2] || decodeCode_2); - } - } - - replaceResult_1 += decodeResult_1; - replaceLastIndex_1 = replaceMatch_1.index + replaceInput_1.length; - } while (replaceMatch_1 = decodeRegExp.exec(text)); - - if (replaceLastIndex_1 !== text.length) { - replaceResult_1 += text.substring(replaceLastIndex_1); - } - } else { - replaceResult_1 = text; - } - - return replaceResult_1; -} - -exports.decode = decode; - -/***/ }), - -/***/ "./node_modules/html-entities/lib/named-references.js": -/*!************************************************************!*\ - !*** ./node_modules/html-entities/lib/named-references.js ***! - \************************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.bodyRegExps = { - xml: /&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);?/g, - html4: /&(?:nbsp|iexcl|cent|pound|curren|yen|brvbar|sect|uml|copy|ordf|laquo|not|shy|reg|macr|deg|plusmn|sup2|sup3|acute|micro|para|middot|cedil|sup1|ordm|raquo|frac14|frac12|frac34|iquest|Agrave|Aacute|Acirc|Atilde|Auml|Aring|AElig|Ccedil|Egrave|Eacute|Ecirc|Euml|Igrave|Iacute|Icirc|Iuml|ETH|Ntilde|Ograve|Oacute|Ocirc|Otilde|Ouml|times|Oslash|Ugrave|Uacute|Ucirc|Uuml|Yacute|THORN|szlig|agrave|aacute|acirc|atilde|auml|aring|aelig|ccedil|egrave|eacute|ecirc|euml|igrave|iacute|icirc|iuml|eth|ntilde|ograve|oacute|ocirc|otilde|ouml|divide|oslash|ugrave|uacute|ucirc|uuml|yacute|thorn|yuml|quot|amp|lt|gt|#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);?/g, - html5: /&(?:AElig|AMP|Aacute|Acirc|Agrave|Aring|Atilde|Auml|COPY|Ccedil|ETH|Eacute|Ecirc|Egrave|Euml|GT|Iacute|Icirc|Igrave|Iuml|LT|Ntilde|Oacute|Ocirc|Ograve|Oslash|Otilde|Ouml|QUOT|REG|THORN|Uacute|Ucirc|Ugrave|Uuml|Yacute|aacute|acirc|acute|aelig|agrave|amp|aring|atilde|auml|brvbar|ccedil|cedil|cent|copy|curren|deg|divide|eacute|ecirc|egrave|eth|euml|frac12|frac14|frac34|gt|iacute|icirc|iexcl|igrave|iquest|iuml|laquo|lt|macr|micro|middot|nbsp|not|ntilde|oacute|ocirc|ograve|ordf|ordm|oslash|otilde|ouml|para|plusmn|pound|quot|raquo|reg|sect|shy|sup1|sup2|sup3|szlig|thorn|times|uacute|ucirc|ugrave|uml|uuml|yacute|yen|yuml|#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);?/g -}; -exports.namedReferences = { - xml: { - entities: { - "<": "<", - ">": ">", - """: '"', - "'": "'", - "&": "&" - }, - characters: { - "<": "<", - ">": ">", - '"': """, - "'": "'", - "&": "&" - } - }, - html4: { - entities: { - "'": "'", - " ": " ", - " ": " ", - "¡": "¡", - "¡": "¡", - "¢": "¢", - "¢": "¢", - "£": "£", - "£": "£", - "¤": "¤", - "¤": "¤", - "¥": "¥", - "¥": "¥", - "¦": "¦", - "¦": "¦", - "§": "§", - "§": "§", - "¨": "¨", - "¨": "¨", - "©": "©", - "©": "©", - "ª": "ª", - "ª": "ª", - "«": "«", - "«": "«", - "¬": "¬", - "¬": "¬", - "­": "­", - "­": "­", - "®": "®", - "®": "®", - "¯": "¯", - "¯": "¯", - "°": "°", - "°": "°", - "±": "±", - "±": "±", - "²": "²", - "²": "²", - "³": "³", - "³": "³", - "´": "´", - "´": "´", - "µ": "µ", - "µ": "µ", - "¶": "¶", - "¶": "¶", - "·": "·", - "·": "·", - "¸": "¸", - "¸": "¸", - "¹": "¹", - "¹": "¹", - "º": "º", - "º": "º", - "»": "»", - "»": "»", - "¼": "¼", - "¼": "¼", - "½": "½", - "½": "½", - "¾": "¾", - "¾": "¾", - "¿": "¿", - "¿": "¿", - "À": "À", - "À": "À", - "Á": "Á", - "Á": "Á", - "Â": "Â", - "Â": "Â", - "Ã": "Ã", - "Ã": "Ã", - "Ä": "Ä", - "Ä": "Ä", - "Å": "Å", - "Å": "Å", - "Æ": "Æ", - "Æ": "Æ", - "Ç": "Ç", - "Ç": "Ç", - "È": "È", - "È": "È", - "É": "É", - "É": "É", - "Ê": "Ê", - "Ê": "Ê", - "Ë": "Ë", - "Ë": "Ë", - "Ì": "Ì", - "Ì": "Ì", - "Í": "Í", - "Í": "Í", - "Î": "Î", - "Î": "Î", - "Ï": "Ï", - "Ï": "Ï", - "Ð": "Ð", - "Ð": "Ð", - "Ñ": "Ñ", - "Ñ": "Ñ", - "Ò": "Ò", - "Ò": "Ò", - "Ó": "Ó", - "Ó": "Ó", - "Ô": "Ô", - "Ô": "Ô", - "Õ": "Õ", - "Õ": "Õ", - "Ö": "Ö", - "Ö": "Ö", - "×": "×", - "×": "×", - "Ø": "Ø", - "Ø": "Ø", - "Ù": "Ù", - "Ù": "Ù", - "Ú": "Ú", - "Ú": "Ú", - "Û": "Û", - "Û": "Û", - "Ü": "Ü", - "Ü": "Ü", - "Ý": "Ý", - "Ý": "Ý", - "Þ": "Þ", - "Þ": "Þ", - "ß": "ß", - "ß": "ß", - "à": "à", - "à": "à", - "á": "á", - "á": "á", - "â": "â", - "â": "â", - "ã": "ã", - "ã": "ã", - "ä": "ä", - "ä": "ä", - "å": "å", - "å": "å", - "æ": "æ", - "æ": "æ", - "ç": "ç", - "ç": "ç", - "è": "è", - "è": "è", - "é": "é", - "é": "é", - "ê": "ê", - "ê": "ê", - "ë": "ë", - "ë": "ë", - "ì": "ì", - "ì": "ì", - "í": "í", - "í": "í", - "î": "î", - "î": "î", - "ï": "ï", - "ï": "ï", - "ð": "ð", - "ð": "ð", - "ñ": "ñ", - "ñ": "ñ", - "ò": "ò", - "ò": "ò", - "ó": "ó", - "ó": "ó", - "ô": "ô", - "ô": "ô", - "õ": "õ", - "õ": "õ", - "ö": "ö", - "ö": "ö", - "÷": "÷", - "÷": "÷", - "ø": "ø", - "ø": "ø", - "ù": "ù", - "ù": "ù", - "ú": "ú", - "ú": "ú", - "û": "û", - "û": "û", - "ü": "ü", - "ü": "ü", - "ý": "ý", - "ý": "ý", - "þ": "þ", - "þ": "þ", - "ÿ": "ÿ", - "ÿ": "ÿ", - """: '"', - """: '"', - "&": "&", - "&": "&", - "<": "<", - "<": "<", - ">": ">", - ">": ">", - "Œ": "Œ", - "œ": "œ", - "Š": "Š", - "š": "š", - "Ÿ": "Ÿ", - "ˆ": "ˆ", - "˜": "˜", - " ": " ", - " ": " ", - " ": " ", - "‌": "‌", - "‍": "‍", - "‎": "‎", - "‏": "‏", - "–": "–", - "—": "—", - "‘": "‘", - "’": "’", - "‚": "‚", - "“": "“", - "”": "”", - "„": "„", - "†": "†", - "‡": "‡", - "‰": "‰", - "‹": "‹", - "›": "›", - "€": "€", - "ƒ": "ƒ", - "Α": "Α", - "Β": "Β", - "Γ": "Γ", - "Δ": "Δ", - "Ε": "Ε", - "Ζ": "Ζ", - "Η": "Η", - "Θ": "Θ", - "Ι": "Ι", - "Κ": "Κ", - "Λ": "Λ", - "Μ": "Μ", - "Ν": "Ν", - "Ξ": "Ξ", - "Ο": "Ο", - "Π": "Π", - "Ρ": "Ρ", - "Σ": "Σ", - "Τ": "Τ", - "Υ": "Υ", - "Φ": "Φ", - "Χ": "Χ", - "Ψ": "Ψ", - "Ω": "Ω", - "α": "α", - "β": "β", - "γ": "γ", - "δ": "δ", - "ε": "ε", - "ζ": "ζ", - "η": "η", - "θ": "θ", - "ι": "ι", - "κ": "κ", - "λ": "λ", - "μ": "μ", - "ν": "ν", - "ξ": "ξ", - "ο": "ο", - "π": "π", - "ρ": "ρ", - "ς": "ς", - "σ": "σ", - "τ": "τ", - "υ": "υ", - "φ": "φ", - "χ": "χ", - "ψ": "ψ", - "ω": "ω", - "ϑ": "ϑ", - "ϒ": "ϒ", - "ϖ": "ϖ", - "•": "•", - "…": "…", - "′": "′", - "″": "″", - "‾": "‾", - "⁄": "⁄", - "℘": "℘", - "ℑ": "ℑ", - "ℜ": "ℜ", - "™": "™", - "ℵ": "ℵ", - "←": "←", - "↑": "↑", - "→": "→", - "↓": "↓", - "↔": "↔", - "↵": "↵", - "⇐": "⇐", - "⇑": "⇑", - "⇒": "⇒", - "⇓": "⇓", - "⇔": "⇔", - "∀": "∀", - "∂": "∂", - "∃": "∃", - "∅": "∅", - "∇": "∇", - "∈": "∈", - "∉": "∉", - "∋": "∋", - "∏": "∏", - "∑": "∑", - "−": "−", - "∗": "∗", - "√": "√", - "∝": "∝", - "∞": "∞", - "∠": "∠", - "∧": "∧", - "∨": "∨", - "∩": "∩", - "∪": "∪", - "∫": "∫", - "∴": "∴", - "∼": "∼", - "≅": "≅", - "≈": "≈", - "≠": "≠", - "≡": "≡", - "≤": "≤", - "≥": "≥", - "⊂": "⊂", - "⊃": "⊃", - "⊄": "⊄", - "⊆": "⊆", - "⊇": "⊇", - "⊕": "⊕", - "⊗": "⊗", - "⊥": "⊥", - "⋅": "⋅", - "⌈": "⌈", - "⌉": "⌉", - "⌊": "⌊", - "⌋": "⌋", - "⟨": "〈", - "⟩": "〉", - "◊": "◊", - "♠": "♠", - "♣": "♣", - "♥": "♥", - "♦": "♦" - }, - characters: { - "'": "'", - " ": " ", - "¡": "¡", - "¢": "¢", - "£": "£", - "¤": "¤", - "¥": "¥", - "¦": "¦", - "§": "§", - "¨": "¨", - "©": "©", - "ª": "ª", - "«": "«", - "¬": "¬", - "­": "­", - "®": "®", - "¯": "¯", - "°": "°", - "±": "±", - "²": "²", - "³": "³", - "´": "´", - "µ": "µ", - "¶": "¶", - "·": "·", - "¸": "¸", - "¹": "¹", - "º": "º", - "»": "»", - "¼": "¼", - "½": "½", - "¾": "¾", - "¿": "¿", - "À": "À", - "Á": "Á", - "Â": "Â", - "Ã": "Ã", - "Ä": "Ä", - "Å": "Å", - "Æ": "Æ", - "Ç": "Ç", - "È": "È", - "É": "É", - "Ê": "Ê", - "Ë": "Ë", - "Ì": "Ì", - "Í": "Í", - "Î": "Î", - "Ï": "Ï", - "Ð": "Ð", - "Ñ": "Ñ", - "Ò": "Ò", - "Ó": "Ó", - "Ô": "Ô", - "Õ": "Õ", - "Ö": "Ö", - "×": "×", - "Ø": "Ø", - "Ù": "Ù", - "Ú": "Ú", - "Û": "Û", - "Ü": "Ü", - "Ý": "Ý", - "Þ": "Þ", - "ß": "ß", - "à": "à", - "á": "á", - "â": "â", - "ã": "ã", - "ä": "ä", - "å": "å", - "æ": "æ", - "ç": "ç", - "è": "è", - "é": "é", - "ê": "ê", - "ë": "ë", - "ì": "ì", - "í": "í", - "î": "î", - "ï": "ï", - "ð": "ð", - "ñ": "ñ", - "ò": "ò", - "ó": "ó", - "ô": "ô", - "õ": "õ", - "ö": "ö", - "÷": "÷", - "ø": "ø", - "ù": "ù", - "ú": "ú", - "û": "û", - "ü": "ü", - "ý": "ý", - "þ": "þ", - "ÿ": "ÿ", - '"': """, - "&": "&", - "<": "<", - ">": ">", - "Œ": "Œ", - "œ": "œ", - "Š": "Š", - "š": "š", - "Ÿ": "Ÿ", - "ˆ": "ˆ", - "˜": "˜", - " ": " ", - " ": " ", - " ": " ", - "‌": "‌", - "‍": "‍", - "‎": "‎", - "‏": "‏", - "–": "–", - "—": "—", - "‘": "‘", - "’": "’", - "‚": "‚", - "“": "“", - "”": "”", - "„": "„", - "†": "†", - "‡": "‡", - "‰": "‰", - "‹": "‹", - "›": "›", - "€": "€", - "ƒ": "ƒ", - "Α": "Α", - "Β": "Β", - "Γ": "Γ", - "Δ": "Δ", - "Ε": "Ε", - "Ζ": "Ζ", - "Η": "Η", - "Θ": "Θ", - "Ι": "Ι", - "Κ": "Κ", - "Λ": "Λ", - "Μ": "Μ", - "Ν": "Ν", - "Ξ": "Ξ", - "Ο": "Ο", - "Π": "Π", - "Ρ": "Ρ", - "Σ": "Σ", - "Τ": "Τ", - "Υ": "Υ", - "Φ": "Φ", - "Χ": "Χ", - "Ψ": "Ψ", - "Ω": "Ω", - "α": "α", - "β": "β", - "γ": "γ", - "δ": "δ", - "ε": "ε", - "ζ": "ζ", - "η": "η", - "θ": "θ", - "ι": "ι", - "κ": "κ", - "λ": "λ", - "μ": "μ", - "ν": "ν", - "ξ": "ξ", - "ο": "ο", - "π": "π", - "ρ": "ρ", - "ς": "ς", - "σ": "σ", - "τ": "τ", - "υ": "υ", - "φ": "φ", - "χ": "χ", - "ψ": "ψ", - "ω": "ω", - "ϑ": "ϑ", - "ϒ": "ϒ", - "ϖ": "ϖ", - "•": "•", - "…": "…", - "′": "′", - "″": "″", - "‾": "‾", - "⁄": "⁄", - "℘": "℘", - "ℑ": "ℑ", - "ℜ": "ℜ", - "™": "™", - "ℵ": "ℵ", - "←": "←", - "↑": "↑", - "→": "→", - "↓": "↓", - "↔": "↔", - "↵": "↵", - "⇐": "⇐", - "⇑": "⇑", - "⇒": "⇒", - "⇓": "⇓", - "⇔": "⇔", - "∀": "∀", - "∂": "∂", - "∃": "∃", - "∅": "∅", - "∇": "∇", - "∈": "∈", - "∉": "∉", - "∋": "∋", - "∏": "∏", - "∑": "∑", - "−": "−", - "∗": "∗", - "√": "√", - "∝": "∝", - "∞": "∞", - "∠": "∠", - "∧": "∧", - "∨": "∨", - "∩": "∩", - "∪": "∪", - "∫": "∫", - "∴": "∴", - "∼": "∼", - "≅": "≅", - "≈": "≈", - "≠": "≠", - "≡": "≡", - "≤": "≤", - "≥": "≥", - "⊂": "⊂", - "⊃": "⊃", - "⊄": "⊄", - "⊆": "⊆", - "⊇": "⊇", - "⊕": "⊕", - "⊗": "⊗", - "⊥": "⊥", - "⋅": "⋅", - "⌈": "⌈", - "⌉": "⌉", - "⌊": "⌊", - "⌋": "⌋", - "〈": "⟨", - "〉": "⟩", - "◊": "◊", - "♠": "♠", - "♣": "♣", - "♥": "♥", - "♦": "♦" - } - }, - html5: { - entities: { - "Æ": "Æ", - "Æ": "Æ", - "&": "&", - "&": "&", - "Á": "Á", - "Á": "Á", - "Ă": "Ă", - "Â": "Â", - "Â": "Â", - "А": "А", - "𝔄": "𝔄", - "À": "À", - "À": "À", - "Α": "Α", - "Ā": "Ā", - "⩓": "⩓", - "Ą": "Ą", - "𝔸": "𝔸", - "⁡": "⁡", - "Å": "Å", - "Å": "Å", - "𝒜": "𝒜", - "≔": "≔", - "Ã": "Ã", - "Ã": "Ã", - "Ä": "Ä", - "Ä": "Ä", - "∖": "∖", - "⫧": "⫧", - "⌆": "⌆", - "Б": "Б", - "∵": "∵", - "ℬ": "ℬ", - "Β": "Β", - "𝔅": "𝔅", - "𝔹": "𝔹", - "˘": "˘", - "ℬ": "ℬ", - "≎": "≎", - "Ч": "Ч", - "©": "©", - "©": "©", - "Ć": "Ć", - "⋒": "⋒", - "ⅅ": "ⅅ", - "ℭ": "ℭ", - "Č": "Č", - "Ç": "Ç", - "Ç": "Ç", - "Ĉ": "Ĉ", - "∰": "∰", - "Ċ": "Ċ", - "¸": "¸", - "·": "·", - "ℭ": "ℭ", - "Χ": "Χ", - "⊙": "⊙", - "⊖": "⊖", - "⊕": "⊕", - "⊗": "⊗", - "∲": "∲", - "”": "”", - "’": "’", - "∷": "∷", - "⩴": "⩴", - "≡": "≡", - "∯": "∯", - "∮": "∮", - "ℂ": "ℂ", - "∐": "∐", - "∳": "∳", - "⨯": "⨯", - "𝒞": "𝒞", - "⋓": "⋓", - "≍": "≍", - "ⅅ": "ⅅ", - "⤑": "⤑", - "Ђ": "Ђ", - "Ѕ": "Ѕ", - "Џ": "Џ", - "‡": "‡", - "↡": "↡", - "⫤": "⫤", - "Ď": "Ď", - "Д": "Д", - "∇": "∇", - "Δ": "Δ", - "𝔇": "𝔇", - "´": "´", - "˙": "˙", - "˝": "˝", - "`": "`", - "˜": "˜", - "⋄": "⋄", - "ⅆ": "ⅆ", - "𝔻": "𝔻", - "¨": "¨", - "⃜": "⃜", - "≐": "≐", - "∯": "∯", - "¨": "¨", - "⇓": "⇓", - "⇐": "⇐", - "⇔": "⇔", - "⫤": "⫤", - "⟸": "⟸", - "⟺": "⟺", - "⟹": "⟹", - "⇒": "⇒", - "⊨": "⊨", - "⇑": "⇑", - "⇕": "⇕", - "∥": "∥", - "↓": "↓", - "⤓": "⤓", - "⇵": "⇵", - "̑": "̑", - "⥐": "⥐", - "⥞": "⥞", - "↽": "↽", - "⥖": "⥖", - "⥟": "⥟", - "⇁": "⇁", - "⥗": "⥗", - "⊤": "⊤", - "↧": "↧", - "⇓": "⇓", - "𝒟": "𝒟", - "Đ": "Đ", - "Ŋ": "Ŋ", - "Ð": "Ð", - "Ð": "Ð", - "É": "É", - "É": "É", - "Ě": "Ě", - "Ê": "Ê", - "Ê": "Ê", - "Э": "Э", - "Ė": "Ė", - "𝔈": "𝔈", - "È": "È", - "È": "È", - "∈": "∈", - "Ē": "Ē", - "◻": "◻", - "▫": "▫", - "Ę": "Ę", - "𝔼": "𝔼", - "Ε": "Ε", - "⩵": "⩵", - "≂": "≂", - "⇌": "⇌", - "ℰ": "ℰ", - "⩳": "⩳", - "Η": "Η", - "Ë": "Ë", - "Ë": "Ë", - "∃": "∃", - "ⅇ": "ⅇ", - "Ф": "Ф", - "𝔉": "𝔉", - "◼": "◼", - "▪": "▪", - "𝔽": "𝔽", - "∀": "∀", - "ℱ": "ℱ", - "ℱ": "ℱ", - "Ѓ": "Ѓ", - ">": ">", - ">": ">", - "Γ": "Γ", - "Ϝ": "Ϝ", - "Ğ": "Ğ", - "Ģ": "Ģ", - "Ĝ": "Ĝ", - "Г": "Г", - "Ġ": "Ġ", - "𝔊": "𝔊", - "⋙": "⋙", - "𝔾": "𝔾", - "≥": "≥", - "⋛": "⋛", - "≧": "≧", - "⪢": "⪢", - "≷": "≷", - "⩾": "⩾", - "≳": "≳", - "𝒢": "𝒢", - "≫": "≫", - "Ъ": "Ъ", - "ˇ": "ˇ", - "^": "^", - "Ĥ": "Ĥ", - "ℌ": "ℌ", - "ℋ": "ℋ", - "ℍ": "ℍ", - "─": "─", - "ℋ": "ℋ", - "Ħ": "Ħ", - "≎": "≎", - "≏": "≏", - "Е": "Е", - "IJ": "IJ", - "Ё": "Ё", - "Í": "Í", - "Í": "Í", - "Î": "Î", - "Î": "Î", - "И": "И", - "İ": "İ", - "ℑ": "ℑ", - "Ì": "Ì", - "Ì": "Ì", - "ℑ": "ℑ", - "Ī": "Ī", - "ⅈ": "ⅈ", - "⇒": "⇒", - "∬": "∬", - "∫": "∫", - "⋂": "⋂", - "⁣": "⁣", - "⁢": "⁢", - "Į": "Į", - "𝕀": "𝕀", - "Ι": "Ι", - "ℐ": "ℐ", - "Ĩ": "Ĩ", - "І": "І", - "Ï": "Ï", - "Ï": "Ï", - "Ĵ": "Ĵ", - "Й": "Й", - "𝔍": "𝔍", - "𝕁": "𝕁", - "𝒥": "𝒥", - "Ј": "Ј", - "Є": "Є", - "Х": "Х", - "Ќ": "Ќ", - "Κ": "Κ", - "Ķ": "Ķ", - "К": "К", - "𝔎": "𝔎", - "𝕂": "𝕂", - "𝒦": "𝒦", - "Љ": "Љ", - "<": "<", - "<": "<", - "Ĺ": "Ĺ", - "Λ": "Λ", - "⟪": "⟪", - "ℒ": "ℒ", - "↞": "↞", - "Ľ": "Ľ", - "Ļ": "Ļ", - "Л": "Л", - "⟨": "⟨", - "←": "←", - "⇤": "⇤", - "⇆": "⇆", - "⌈": "⌈", - "⟦": "⟦", - "⥡": "⥡", - "⇃": "⇃", - "⥙": "⥙", - "⌊": "⌊", - "↔": "↔", - "⥎": "⥎", - "⊣": "⊣", - "↤": "↤", - "⥚": "⥚", - "⊲": "⊲", - "⧏": "⧏", - "⊴": "⊴", - "⥑": "⥑", - "⥠": "⥠", - "↿": "↿", - "⥘": "⥘", - "↼": "↼", - "⥒": "⥒", - "⇐": "⇐", - "⇔": "⇔", - "⋚": "⋚", - "≦": "≦", - "≶": "≶", - "⪡": "⪡", - "⩽": "⩽", - "≲": "≲", - "𝔏": "𝔏", - "⋘": "⋘", - "⇚": "⇚", - "Ŀ": "Ŀ", - "⟵": "⟵", - "⟷": "⟷", - "⟶": "⟶", - "⟸": "⟸", - "⟺": "⟺", - "⟹": "⟹", - "𝕃": "𝕃", - "↙": "↙", - "↘": "↘", - "ℒ": "ℒ", - "↰": "↰", - "Ł": "Ł", - "≪": "≪", - "⤅": "⤅", - "М": "М", - " ": " ", - "ℳ": "ℳ", - "𝔐": "𝔐", - "∓": "∓", - "𝕄": "𝕄", - "ℳ": "ℳ", - "Μ": "Μ", - "Њ": "Њ", - "Ń": "Ń", - "Ň": "Ň", - "Ņ": "Ņ", - "Н": "Н", - "​": "​", - "​": "​", - "​": "​", - "​": "​", - "≫": "≫", - "≪": "≪", - " ": "\n", - "𝔑": "𝔑", - "⁠": "⁠", - " ": " ", - "ℕ": "ℕ", - "⫬": "⫬", - "≢": "≢", - "≭": "≭", - "∦": "∦", - "∉": "∉", - "≠": "≠", - "≂̸": "≂̸", - "∄": "∄", - "≯": "≯", - "≱": "≱", - "≧̸": "≧̸", - "≫̸": "≫̸", - "≹": "≹", - "⩾̸": "⩾̸", - "≵": "≵", - "≎̸": "≎̸", - "≏̸": "≏̸", - "⋪": "⋪", - "⧏̸": "⧏̸", - "⋬": "⋬", - "≮": "≮", - "≰": "≰", - "≸": "≸", - "≪̸": "≪̸", - "⩽̸": "⩽̸", - "≴": "≴", - "⪢̸": "⪢̸", - "⪡̸": "⪡̸", - "⊀": "⊀", - "⪯̸": "⪯̸", - "⋠": "⋠", - "∌": "∌", - "⋫": "⋫", - "⧐̸": "⧐̸", - "⋭": "⋭", - "⊏̸": "⊏̸", - "⋢": "⋢", - "⊐̸": "⊐̸", - "⋣": "⋣", - "⊂⃒": "⊂⃒", - "⊈": "⊈", - "⊁": "⊁", - "⪰̸": "⪰̸", - "⋡": "⋡", - "≿̸": "≿̸", - "⊃⃒": "⊃⃒", - "⊉": "⊉", - "≁": "≁", - "≄": "≄", - "≇": "≇", - "≉": "≉", - "∤": "∤", - "𝒩": "𝒩", - "Ñ": "Ñ", - "Ñ": "Ñ", - "Ν": "Ν", - "Œ": "Œ", - "Ó": "Ó", - "Ó": "Ó", - "Ô": "Ô", - "Ô": "Ô", - "О": "О", - "Ő": "Ő", - "𝔒": "𝔒", - "Ò": "Ò", - "Ò": "Ò", - "Ō": "Ō", - "Ω": "Ω", - "Ο": "Ο", - "𝕆": "𝕆", - "“": "“", - "‘": "‘", - "⩔": "⩔", - "𝒪": "𝒪", - "Ø": "Ø", - "Ø": "Ø", - "Õ": "Õ", - "Õ": "Õ", - "⨷": "⨷", - "Ö": "Ö", - "Ö": "Ö", - "‾": "‾", - "⏞": "⏞", - "⎴": "⎴", - "⏜": "⏜", - "∂": "∂", - "П": "П", - "𝔓": "𝔓", - "Φ": "Φ", - "Π": "Π", - "±": "±", - "ℌ": "ℌ", - "ℙ": "ℙ", - "⪻": "⪻", - "≺": "≺", - "⪯": "⪯", - "≼": "≼", - "≾": "≾", - "″": "″", - "∏": "∏", - "∷": "∷", - "∝": "∝", - "𝒫": "𝒫", - "Ψ": "Ψ", - """: '"', - """: '"', - "𝔔": "𝔔", - "ℚ": "ℚ", - "𝒬": "𝒬", - "⤐": "⤐", - "®": "®", - "®": "®", - "Ŕ": "Ŕ", - "⟫": "⟫", - "↠": "↠", - "⤖": "⤖", - "Ř": "Ř", - "Ŗ": "Ŗ", - "Р": "Р", - "ℜ": "ℜ", - "∋": "∋", - "⇋": "⇋", - "⥯": "⥯", - "ℜ": "ℜ", - "Ρ": "Ρ", - "⟩": "⟩", - "→": "→", - "⇥": "⇥", - "⇄": "⇄", - "⌉": "⌉", - "⟧": "⟧", - "⥝": "⥝", - "⇂": "⇂", - "⥕": "⥕", - "⌋": "⌋", - "⊢": "⊢", - "↦": "↦", - "⥛": "⥛", - "⊳": "⊳", - "⧐": "⧐", - "⊵": "⊵", - "⥏": "⥏", - "⥜": "⥜", - "↾": "↾", - "⥔": "⥔", - "⇀": "⇀", - "⥓": "⥓", - "⇒": "⇒", - "ℝ": "ℝ", - "⥰": "⥰", - "⇛": "⇛", - "ℛ": "ℛ", - "↱": "↱", - "⧴": "⧴", - "Щ": "Щ", - "Ш": "Ш", - "Ь": "Ь", - "Ś": "Ś", - "⪼": "⪼", - "Š": "Š", - "Ş": "Ş", - "Ŝ": "Ŝ", - "С": "С", - "𝔖": "𝔖", - "↓": "↓", - "←": "←", - "→": "→", - "↑": "↑", - "Σ": "Σ", - "∘": "∘", - "𝕊": "𝕊", - "√": "√", - "□": "□", - "⊓": "⊓", - "⊏": "⊏", - "⊑": "⊑", - "⊐": "⊐", - "⊒": "⊒", - "⊔": "⊔", - "𝒮": "𝒮", - "⋆": "⋆", - "⋐": "⋐", - "⋐": "⋐", - "⊆": "⊆", - "≻": "≻", - "⪰": "⪰", - "≽": "≽", - "≿": "≿", - "∋": "∋", - "∑": "∑", - "⋑": "⋑", - "⊃": "⊃", - "⊇": "⊇", - "⋑": "⋑", - "Þ": "Þ", - "Þ": "Þ", - "™": "™", - "Ћ": "Ћ", - "Ц": "Ц", - " ": "\t", - "Τ": "Τ", - "Ť": "Ť", - "Ţ": "Ţ", - "Т": "Т", - "𝔗": "𝔗", - "∴": "∴", - "Θ": "Θ", - "  ": "  ", - " ": " ", - "∼": "∼", - "≃": "≃", - "≅": "≅", - "≈": "≈", - "𝕋": "𝕋", - "⃛": "⃛", - "𝒯": "𝒯", - "Ŧ": "Ŧ", - "Ú": "Ú", - "Ú": "Ú", - "↟": "↟", - "⥉": "⥉", - "Ў": "Ў", - "Ŭ": "Ŭ", - "Û": "Û", - "Û": "Û", - "У": "У", - "Ű": "Ű", - "𝔘": "𝔘", - "Ù": "Ù", - "Ù": "Ù", - "Ū": "Ū", - "_": "_", - "⏟": "⏟", - "⎵": "⎵", - "⏝": "⏝", - "⋃": "⋃", - "⊎": "⊎", - "Ų": "Ų", - "𝕌": "𝕌", - "↑": "↑", - "⤒": "⤒", - "⇅": "⇅", - "↕": "↕", - "⥮": "⥮", - "⊥": "⊥", - "↥": "↥", - "⇑": "⇑", - "⇕": "⇕", - "↖": "↖", - "↗": "↗", - "ϒ": "ϒ", - "Υ": "Υ", - "Ů": "Ů", - "𝒰": "𝒰", - "Ũ": "Ũ", - "Ü": "Ü", - "Ü": "Ü", - "⊫": "⊫", - "⫫": "⫫", - "В": "В", - "⊩": "⊩", - "⫦": "⫦", - "⋁": "⋁", - "‖": "‖", - "‖": "‖", - "∣": "∣", - "|": "|", - "❘": "❘", - "≀": "≀", - " ": " ", - "𝔙": "𝔙", - "𝕍": "𝕍", - "𝒱": "𝒱", - "⊪": "⊪", - "Ŵ": "Ŵ", - "⋀": "⋀", - "𝔚": "𝔚", - "𝕎": "𝕎", - "𝒲": "𝒲", - "𝔛": "𝔛", - "Ξ": "Ξ", - "𝕏": "𝕏", - "𝒳": "𝒳", - "Я": "Я", - "Ї": "Ї", - "Ю": "Ю", - "Ý": "Ý", - "Ý": "Ý", - "Ŷ": "Ŷ", - "Ы": "Ы", - "𝔜": "𝔜", - "𝕐": "𝕐", - "𝒴": "𝒴", - "Ÿ": "Ÿ", - "Ж": "Ж", - "Ź": "Ź", - "Ž": "Ž", - "З": "З", - "Ż": "Ż", - "​": "​", - "Ζ": "Ζ", - "ℨ": "ℨ", - "ℤ": "ℤ", - "𝒵": "𝒵", - "á": "á", - "á": "á", - "ă": "ă", - "∾": "∾", - "∾̳": "∾̳", - "∿": "∿", - "â": "â", - "â": "â", - "´": "´", - "´": "´", - "а": "а", - "æ": "æ", - "æ": "æ", - "⁡": "⁡", - "𝔞": "𝔞", - "à": "à", - "à": "à", - "ℵ": "ℵ", - "ℵ": "ℵ", - "α": "α", - "ā": "ā", - "⨿": "⨿", - "&": "&", - "&": "&", - "∧": "∧", - "⩕": "⩕", - "⩜": "⩜", - "⩘": "⩘", - "⩚": "⩚", - "∠": "∠", - "⦤": "⦤", - "∠": "∠", - "∡": "∡", - "⦨": "⦨", - "⦩": "⦩", - "⦪": "⦪", - "⦫": "⦫", - "⦬": "⦬", - "⦭": "⦭", - "⦮": "⦮", - "⦯": "⦯", - "∟": "∟", - "⊾": "⊾", - "⦝": "⦝", - "∢": "∢", - "Å": "Å", - "⍼": "⍼", - "ą": "ą", - "𝕒": "𝕒", - "≈": "≈", - "⩰": "⩰", - "⩯": "⩯", - "≊": "≊", - "≋": "≋", - "'": "'", - "≈": "≈", - "≊": "≊", - "å": "å", - "å": "å", - "𝒶": "𝒶", - "*": "*", - "≈": "≈", - "≍": "≍", - "ã": "ã", - "ã": "ã", - "ä": "ä", - "ä": "ä", - "∳": "∳", - "⨑": "⨑", - "⫭": "⫭", - "≌": "≌", - "϶": "϶", - "‵": "‵", - "∽": "∽", - "⋍": "⋍", - "⊽": "⊽", - "⌅": "⌅", - "⌅": "⌅", - "⎵": "⎵", - "⎶": "⎶", - "≌": "≌", - "б": "б", - "„": "„", - "∵": "∵", - "∵": "∵", - "⦰": "⦰", - "϶": "϶", - "ℬ": "ℬ", - "β": "β", - "ℶ": "ℶ", - "≬": "≬", - "𝔟": "𝔟", - "⋂": "⋂", - "◯": "◯", - "⋃": "⋃", - "⨀": "⨀", - "⨁": "⨁", - "⨂": "⨂", - "⨆": "⨆", - "★": "★", - "▽": "▽", - "△": "△", - "⨄": "⨄", - "⋁": "⋁", - "⋀": "⋀", - "⤍": "⤍", - "⧫": "⧫", - "▪": "▪", - "▴": "▴", - "▾": "▾", - "◂": "◂", - "▸": "▸", - "␣": "␣", - "▒": "▒", - "░": "░", - "▓": "▓", - "█": "█", - "=⃥": "=⃥", - "≡⃥": "≡⃥", - "⌐": "⌐", - "𝕓": "𝕓", - "⊥": "⊥", - "⊥": "⊥", - "⋈": "⋈", - "╗": "╗", - "╔": "╔", - "╖": "╖", - "╓": "╓", - "═": "═", - "╦": "╦", - "╩": "╩", - "╤": "╤", - "╧": "╧", - "╝": "╝", - "╚": "╚", - "╜": "╜", - "╙": "╙", - "║": "║", - "╬": "╬", - "╣": "╣", - "╠": "╠", - "╫": "╫", - "╢": "╢", - "╟": "╟", - "⧉": "⧉", - "╕": "╕", - "╒": "╒", - "┐": "┐", - "┌": "┌", - "─": "─", - "╥": "╥", - "╨": "╨", - "┬": "┬", - "┴": "┴", - "⊟": "⊟", - "⊞": "⊞", - "⊠": "⊠", - "╛": "╛", - "╘": "╘", - "┘": "┘", - "└": "└", - "│": "│", - "╪": "╪", - "╡": "╡", - "╞": "╞", - "┼": "┼", - "┤": "┤", - "├": "├", - "‵": "‵", - "˘": "˘", - "¦": "¦", - "¦": "¦", - "𝒷": "𝒷", - "⁏": "⁏", - "∽": "∽", - "⋍": "⋍", - "\": "\\", - "⧅": "⧅", - "⟈": "⟈", - "•": "•", - "•": "•", - "≎": "≎", - "⪮": "⪮", - "≏": "≏", - "≏": "≏", - "ć": "ć", - "∩": "∩", - "⩄": "⩄", - "⩉": "⩉", - "⩋": "⩋", - "⩇": "⩇", - "⩀": "⩀", - "∩︀": "∩︀", - "⁁": "⁁", - "ˇ": "ˇ", - "⩍": "⩍", - "č": "č", - "ç": "ç", - "ç": "ç", - "ĉ": "ĉ", - "⩌": "⩌", - "⩐": "⩐", - "ċ": "ċ", - "¸": "¸", - "¸": "¸", - "⦲": "⦲", - "¢": "¢", - "¢": "¢", - "·": "·", - "𝔠": "𝔠", - "ч": "ч", - "✓": "✓", - "✓": "✓", - "χ": "χ", - "○": "○", - "⧃": "⧃", - "ˆ": "ˆ", - "≗": "≗", - "↺": "↺", - "↻": "↻", - "®": "®", - "Ⓢ": "Ⓢ", - "⊛": "⊛", - "⊚": "⊚", - "⊝": "⊝", - "≗": "≗", - "⨐": "⨐", - "⫯": "⫯", - "⧂": "⧂", - "♣": "♣", - "♣": "♣", - ":": ":", - "≔": "≔", - "≔": "≔", - ",": ",", - "@": "@", - "∁": "∁", - "∘": "∘", - "∁": "∁", - "ℂ": "ℂ", - "≅": "≅", - "⩭": "⩭", - "∮": "∮", - "𝕔": "𝕔", - "∐": "∐", - "©": "©", - "©": "©", - "℗": "℗", - "↵": "↵", - "✗": "✗", - "𝒸": "𝒸", - "⫏": "⫏", - "⫑": "⫑", - "⫐": "⫐", - "⫒": "⫒", - "⋯": "⋯", - "⤸": "⤸", - "⤵": "⤵", - "⋞": "⋞", - "⋟": "⋟", - "↶": "↶", - "⤽": "⤽", - "∪": "∪", - "⩈": "⩈", - "⩆": "⩆", - "⩊": "⩊", - "⊍": "⊍", - "⩅": "⩅", - "∪︀": "∪︀", - "↷": "↷", - "⤼": "⤼", - "⋞": "⋞", - "⋟": "⋟", - "⋎": "⋎", - "⋏": "⋏", - "¤": "¤", - "¤": "¤", - "↶": "↶", - "↷": "↷", - "⋎": "⋎", - "⋏": "⋏", - "∲": "∲", - "∱": "∱", - "⌭": "⌭", - "⇓": "⇓", - "⥥": "⥥", - "†": "†", - "ℸ": "ℸ", - "↓": "↓", - "‐": "‐", - "⊣": "⊣", - "⤏": "⤏", - "˝": "˝", - "ď": "ď", - "д": "д", - "ⅆ": "ⅆ", - "‡": "‡", - "⇊": "⇊", - "⩷": "⩷", - "°": "°", - "°": "°", - "δ": "δ", - "⦱": "⦱", - "⥿": "⥿", - "𝔡": "𝔡", - "⇃": "⇃", - "⇂": "⇂", - "⋄": "⋄", - "⋄": "⋄", - "♦": "♦", - "♦": "♦", - "¨": "¨", - "ϝ": "ϝ", - "⋲": "⋲", - "÷": "÷", - "÷": "÷", - "÷": "÷", - "⋇": "⋇", - "⋇": "⋇", - "ђ": "ђ", - "⌞": "⌞", - "⌍": "⌍", - "$": "$", - "𝕕": "𝕕", - "˙": "˙", - "≐": "≐", - "≑": "≑", - "∸": "∸", - "∔": "∔", - "⊡": "⊡", - "⌆": "⌆", - "↓": "↓", - "⇊": "⇊", - "⇃": "⇃", - "⇂": "⇂", - "⤐": "⤐", - "⌟": "⌟", - "⌌": "⌌", - "𝒹": "𝒹", - "ѕ": "ѕ", - "⧶": "⧶", - "đ": "đ", - "⋱": "⋱", - "▿": "▿", - "▾": "▾", - "⇵": "⇵", - "⥯": "⥯", - "⦦": "⦦", - "џ": "џ", - "⟿": "⟿", - "⩷": "⩷", - "≑": "≑", - "é": "é", - "é": "é", - "⩮": "⩮", - "ě": "ě", - "≖": "≖", - "ê": "ê", - "ê": "ê", - "≕": "≕", - "э": "э", - "ė": "ė", - "ⅇ": "ⅇ", - "≒": "≒", - "𝔢": "𝔢", - "⪚": "⪚", - "è": "è", - "è": "è", - "⪖": "⪖", - "⪘": "⪘", - "⪙": "⪙", - "⏧": "⏧", - "ℓ": "ℓ", - "⪕": "⪕", - "⪗": "⪗", - "ē": "ē", - "∅": "∅", - "∅": "∅", - "∅": "∅", - " ": " ", - " ": " ", - " ": " ", - "ŋ": "ŋ", - " ": " ", - "ę": "ę", - "𝕖": "𝕖", - "⋕": "⋕", - "⧣": "⧣", - "⩱": "⩱", - "ε": "ε", - "ε": "ε", - "ϵ": "ϵ", - "≖": "≖", - "≕": "≕", - "≂": "≂", - "⪖": "⪖", - "⪕": "⪕", - "=": "=", - "≟": "≟", - "≡": "≡", - "⩸": "⩸", - "⧥": "⧥", - "≓": "≓", - "⥱": "⥱", - "ℯ": "ℯ", - "≐": "≐", - "≂": "≂", - "η": "η", - "ð": "ð", - "ð": "ð", - "ë": "ë", - "ë": "ë", - "€": "€", - "!": "!", - "∃": "∃", - "ℰ": "ℰ", - "ⅇ": "ⅇ", - "≒": "≒", - "ф": "ф", - "♀": "♀", - "ffi": "ffi", - "ff": "ff", - "ffl": "ffl", - "𝔣": "𝔣", - "fi": "fi", - "fj": "fj", - "♭": "♭", - "fl": "fl", - "▱": "▱", - "ƒ": "ƒ", - "𝕗": "𝕗", - "∀": "∀", - "⋔": "⋔", - "⫙": "⫙", - "⨍": "⨍", - "½": "½", - "½": "½", - "⅓": "⅓", - "¼": "¼", - "¼": "¼", - "⅕": "⅕", - "⅙": "⅙", - "⅛": "⅛", - "⅔": "⅔", - "⅖": "⅖", - "¾": "¾", - "¾": "¾", - "⅗": "⅗", - "⅜": "⅜", - "⅘": "⅘", - "⅚": "⅚", - "⅝": "⅝", - "⅞": "⅞", - "⁄": "⁄", - "⌢": "⌢", - "𝒻": "𝒻", - "≧": "≧", - "⪌": "⪌", - "ǵ": "ǵ", - "γ": "γ", - "ϝ": "ϝ", - "⪆": "⪆", - "ğ": "ğ", - "ĝ": "ĝ", - "г": "г", - "ġ": "ġ", - "≥": "≥", - "⋛": "⋛", - "≥": "≥", - "≧": "≧", - "⩾": "⩾", - "⩾": "⩾", - "⪩": "⪩", - "⪀": "⪀", - "⪂": "⪂", - "⪄": "⪄", - "⋛︀": "⋛︀", - "⪔": "⪔", - "𝔤": "𝔤", - "≫": "≫", - "⋙": "⋙", - "ℷ": "ℷ", - "ѓ": "ѓ", - "≷": "≷", - "⪒": "⪒", - "⪥": "⪥", - "⪤": "⪤", - "≩": "≩", - "⪊": "⪊", - "⪊": "⪊", - "⪈": "⪈", - "⪈": "⪈", - "≩": "≩", - "⋧": "⋧", - "𝕘": "𝕘", - "`": "`", - "ℊ": "ℊ", - "≳": "≳", - "⪎": "⪎", - "⪐": "⪐", - ">": ">", - ">": ">", - "⪧": "⪧", - "⩺": "⩺", - "⋗": "⋗", - "⦕": "⦕", - "⩼": "⩼", - "⪆": "⪆", - "⥸": "⥸", - "⋗": "⋗", - "⋛": "⋛", - "⪌": "⪌", - "≷": "≷", - "≳": "≳", - "≩︀": "≩︀", - "≩︀": "≩︀", - "⇔": "⇔", - " ": " ", - "½": "½", - "ℋ": "ℋ", - "ъ": "ъ", - "↔": "↔", - "⥈": "⥈", - "↭": "↭", - "ℏ": "ℏ", - "ĥ": "ĥ", - "♥": "♥", - "♥": "♥", - "…": "…", - "⊹": "⊹", - "𝔥": "𝔥", - "⤥": "⤥", - "⤦": "⤦", - "⇿": "⇿", - "∻": "∻", - "↩": "↩", - "↪": "↪", - "𝕙": "𝕙", - "―": "―", - "𝒽": "𝒽", - "ℏ": "ℏ", - "ħ": "ħ", - "⁃": "⁃", - "‐": "‐", - "í": "í", - "í": "í", - "⁣": "⁣", - "î": "î", - "î": "î", - "и": "и", - "е": "е", - "¡": "¡", - "¡": "¡", - "⇔": "⇔", - "𝔦": "𝔦", - "ì": "ì", - "ì": "ì", - "ⅈ": "ⅈ", - "⨌": "⨌", - "∭": "∭", - "⧜": "⧜", - "℩": "℩", - "ij": "ij", - "ī": "ī", - "ℑ": "ℑ", - "ℐ": "ℐ", - "ℑ": "ℑ", - "ı": "ı", - "⊷": "⊷", - "Ƶ": "Ƶ", - "∈": "∈", - "℅": "℅", - "∞": "∞", - "⧝": "⧝", - "ı": "ı", - "∫": "∫", - "⊺": "⊺", - "ℤ": "ℤ", - "⊺": "⊺", - "⨗": "⨗", - "⨼": "⨼", - "ё": "ё", - "į": "į", - "𝕚": "𝕚", - "ι": "ι", - "⨼": "⨼", - "¿": "¿", - "¿": "¿", - "𝒾": "𝒾", - "∈": "∈", - "⋹": "⋹", - "⋵": "⋵", - "⋴": "⋴", - "⋳": "⋳", - "∈": "∈", - "⁢": "⁢", - "ĩ": "ĩ", - "і": "і", - "ï": "ï", - "ï": "ï", - "ĵ": "ĵ", - "й": "й", - "𝔧": "𝔧", - "ȷ": "ȷ", - "𝕛": "𝕛", - "𝒿": "𝒿", - "ј": "ј", - "є": "є", - "κ": "κ", - "ϰ": "ϰ", - "ķ": "ķ", - "к": "к", - "𝔨": "𝔨", - "ĸ": "ĸ", - "х": "х", - "ќ": "ќ", - "𝕜": "𝕜", - "𝓀": "𝓀", - "⇚": "⇚", - "⇐": "⇐", - "⤛": "⤛", - "⤎": "⤎", - "≦": "≦", - "⪋": "⪋", - "⥢": "⥢", - "ĺ": "ĺ", - "⦴": "⦴", - "ℒ": "ℒ", - "λ": "λ", - "⟨": "⟨", - "⦑": "⦑", - "⟨": "⟨", - "⪅": "⪅", - "«": "«", - "«": "«", - "←": "←", - "⇤": "⇤", - "⤟": "⤟", - "⤝": "⤝", - "↩": "↩", - "↫": "↫", - "⤹": "⤹", - "⥳": "⥳", - "↢": "↢", - "⪫": "⪫", - "⤙": "⤙", - "⪭": "⪭", - "⪭︀": "⪭︀", - "⤌": "⤌", - "❲": "❲", - "{": "{", - "[": "[", - "⦋": "⦋", - "⦏": "⦏", - "⦍": "⦍", - "ľ": "ľ", - "ļ": "ļ", - "⌈": "⌈", - "{": "{", - "л": "л", - "⤶": "⤶", - "“": "“", - "„": "„", - "⥧": "⥧", - "⥋": "⥋", - "↲": "↲", - "≤": "≤", - "←": "←", - "↢": "↢", - "↽": "↽", - "↼": "↼", - "⇇": "⇇", - "↔": "↔", - "⇆": "⇆", - "⇋": "⇋", - "↭": "↭", - "⋋": "⋋", - "⋚": "⋚", - "≤": "≤", - "≦": "≦", - "⩽": "⩽", - "⩽": "⩽", - "⪨": "⪨", - "⩿": "⩿", - "⪁": "⪁", - "⪃": "⪃", - "⋚︀": "⋚︀", - "⪓": "⪓", - "⪅": "⪅", - "⋖": "⋖", - "⋚": "⋚", - "⪋": "⪋", - "≶": "≶", - "≲": "≲", - "⥼": "⥼", - "⌊": "⌊", - "𝔩": "𝔩", - "≶": "≶", - "⪑": "⪑", - "↽": "↽", - "↼": "↼", - "⥪": "⥪", - "▄": "▄", - "љ": "љ", - "≪": "≪", - "⇇": "⇇", - "⌞": "⌞", - "⥫": "⥫", - "◺": "◺", - "ŀ": "ŀ", - "⎰": "⎰", - "⎰": "⎰", - "≨": "≨", - "⪉": "⪉", - "⪉": "⪉", - "⪇": "⪇", - "⪇": "⪇", - "≨": "≨", - "⋦": "⋦", - "⟬": "⟬", - "⇽": "⇽", - "⟦": "⟦", - "⟵": "⟵", - "⟷": "⟷", - "⟼": "⟼", - "⟶": "⟶", - "↫": "↫", - "↬": "↬", - "⦅": "⦅", - "𝕝": "𝕝", - "⨭": "⨭", - "⨴": "⨴", - "∗": "∗", - "_": "_", - "◊": "◊", - "◊": "◊", - "⧫": "⧫", - "(": "(", - "⦓": "⦓", - "⇆": "⇆", - "⌟": "⌟", - "⇋": "⇋", - "⥭": "⥭", - "‎": "‎", - "⊿": "⊿", - "‹": "‹", - "𝓁": "𝓁", - "↰": "↰", - "≲": "≲", - "⪍": "⪍", - "⪏": "⪏", - "[": "[", - "‘": "‘", - "‚": "‚", - "ł": "ł", - "<": "<", - "<": "<", - "⪦": "⪦", - "⩹": "⩹", - "⋖": "⋖", - "⋋": "⋋", - "⋉": "⋉", - "⥶": "⥶", - "⩻": "⩻", - "⦖": "⦖", - "◃": "◃", - "⊴": "⊴", - "◂": "◂", - "⥊": "⥊", - "⥦": "⥦", - "≨︀": "≨︀", - "≨︀": "≨︀", - "∺": "∺", - "¯": "¯", - "¯": "¯", - "♂": "♂", - "✠": "✠", - "✠": "✠", - "↦": "↦", - "↦": "↦", - "↧": "↧", - "↤": "↤", - "↥": "↥", - "▮": "▮", - "⨩": "⨩", - "м": "м", - "—": "—", - "∡": "∡", - "𝔪": "𝔪", - "℧": "℧", - "µ": "µ", - "µ": "µ", - "∣": "∣", - "*": "*", - "⫰": "⫰", - "·": "·", - "·": "·", - "−": "−", - "⊟": "⊟", - "∸": "∸", - "⨪": "⨪", - "⫛": "⫛", - "…": "…", - "∓": "∓", - "⊧": "⊧", - "𝕞": "𝕞", - "∓": "∓", - "𝓂": "𝓂", - "∾": "∾", - "μ": "μ", - "⊸": "⊸", - "⊸": "⊸", - "⋙̸": "⋙̸", - "≫⃒": "≫⃒", - "≫̸": "≫̸", - "⇍": "⇍", - "⇎": "⇎", - "⋘̸": "⋘̸", - "≪⃒": "≪⃒", - "≪̸": "≪̸", - "⇏": "⇏", - "⊯": "⊯", - "⊮": "⊮", - "∇": "∇", - "ń": "ń", - "∠⃒": "∠⃒", - "≉": "≉", - "⩰̸": "⩰̸", - "≋̸": "≋̸", - "ʼn": "ʼn", - "≉": "≉", - "♮": "♮", - "♮": "♮", - "ℕ": "ℕ", - " ": " ", - " ": " ", - "≎̸": "≎̸", - "≏̸": "≏̸", - "⩃": "⩃", - "ň": "ň", - "ņ": "ņ", - "≇": "≇", - "⩭̸": "⩭̸", - "⩂": "⩂", - "н": "н", - "–": "–", - "≠": "≠", - "⇗": "⇗", - "⤤": "⤤", - "↗": "↗", - "↗": "↗", - "≐̸": "≐̸", - "≢": "≢", - "⤨": "⤨", - "≂̸": "≂̸", - "∄": "∄", - "∄": "∄", - "𝔫": "𝔫", - "≧̸": "≧̸", - "≱": "≱", - "≱": "≱", - "≧̸": "≧̸", - "⩾̸": "⩾̸", - "⩾̸": "⩾̸", - "≵": "≵", - "≯": "≯", - "≯": "≯", - "⇎": "⇎", - "↮": "↮", - "⫲": "⫲", - "∋": "∋", - "⋼": "⋼", - "⋺": "⋺", - "∋": "∋", - "њ": "њ", - "⇍": "⇍", - "≦̸": "≦̸", - "↚": "↚", - "‥": "‥", - "≰": "≰", - "↚": "↚", - "↮": "↮", - "≰": "≰", - "≦̸": "≦̸", - "⩽̸": "⩽̸", - "⩽̸": "⩽̸", - "≮": "≮", - "≴": "≴", - "≮": "≮", - "⋪": "⋪", - "⋬": "⋬", - "∤": "∤", - "𝕟": "𝕟", - "¬": "¬", - "¬": "¬", - "∉": "∉", - "⋹̸": "⋹̸", - "⋵̸": "⋵̸", - "∉": "∉", - "⋷": "⋷", - "⋶": "⋶", - "∌": "∌", - "∌": "∌", - "⋾": "⋾", - "⋽": "⋽", - "∦": "∦", - "∦": "∦", - "⫽⃥": "⫽⃥", - "∂̸": "∂̸", - "⨔": "⨔", - "⊀": "⊀", - "⋠": "⋠", - "⪯̸": "⪯̸", - "⊀": "⊀", - "⪯̸": "⪯̸", - "⇏": "⇏", - "↛": "↛", - "⤳̸": "⤳̸", - "↝̸": "↝̸", - "↛": "↛", - "⋫": "⋫", - "⋭": "⋭", - "⊁": "⊁", - "⋡": "⋡", - "⪰̸": "⪰̸", - "𝓃": "𝓃", - "∤": "∤", - "∦": "∦", - "≁": "≁", - "≄": "≄", - "≄": "≄", - "∤": "∤", - "∦": "∦", - "⋢": "⋢", - "⋣": "⋣", - "⊄": "⊄", - "⫅̸": "⫅̸", - "⊈": "⊈", - "⊂⃒": "⊂⃒", - "⊈": "⊈", - "⫅̸": "⫅̸", - "⊁": "⊁", - "⪰̸": "⪰̸", - "⊅": "⊅", - "⫆̸": "⫆̸", - "⊉": "⊉", - "⊃⃒": "⊃⃒", - "⊉": "⊉", - "⫆̸": "⫆̸", - "≹": "≹", - "ñ": "ñ", - "ñ": "ñ", - "≸": "≸", - "⋪": "⋪", - "⋬": "⋬", - "⋫": "⋫", - "⋭": "⋭", - "ν": "ν", - "#": "#", - "№": "№", - " ": " ", - "⊭": "⊭", - "⤄": "⤄", - "≍⃒": "≍⃒", - "⊬": "⊬", - "≥⃒": "≥⃒", - ">⃒": ">⃒", - "⧞": "⧞", - "⤂": "⤂", - "≤⃒": "≤⃒", - "<⃒": "<⃒", - "⊴⃒": "⊴⃒", - "⤃": "⤃", - "⊵⃒": "⊵⃒", - "∼⃒": "∼⃒", - "⇖": "⇖", - "⤣": "⤣", - "↖": "↖", - "↖": "↖", - "⤧": "⤧", - "Ⓢ": "Ⓢ", - "ó": "ó", - "ó": "ó", - "⊛": "⊛", - "⊚": "⊚", - "ô": "ô", - "ô": "ô", - "о": "о", - "⊝": "⊝", - "ő": "ő", - "⨸": "⨸", - "⊙": "⊙", - "⦼": "⦼", - "œ": "œ", - "⦿": "⦿", - "𝔬": "𝔬", - "˛": "˛", - "ò": "ò", - "ò": "ò", - "⧁": "⧁", - "⦵": "⦵", - "Ω": "Ω", - "∮": "∮", - "↺": "↺", - "⦾": "⦾", - "⦻": "⦻", - "‾": "‾", - "⧀": "⧀", - "ō": "ō", - "ω": "ω", - "ο": "ο", - "⦶": "⦶", - "⊖": "⊖", - "𝕠": "𝕠", - "⦷": "⦷", - "⦹": "⦹", - "⊕": "⊕", - "∨": "∨", - "↻": "↻", - "⩝": "⩝", - "ℴ": "ℴ", - "ℴ": "ℴ", - "ª": "ª", - "ª": "ª", - "º": "º", - "º": "º", - "⊶": "⊶", - "⩖": "⩖", - "⩗": "⩗", - "⩛": "⩛", - "ℴ": "ℴ", - "ø": "ø", - "ø": "ø", - "⊘": "⊘", - "õ": "õ", - "õ": "õ", - "⊗": "⊗", - "⨶": "⨶", - "ö": "ö", - "ö": "ö", - "⌽": "⌽", - "∥": "∥", - "¶": "¶", - "¶": "¶", - "∥": "∥", - "⫳": "⫳", - "⫽": "⫽", - "∂": "∂", - "п": "п", - "%": "%", - ".": ".", - "‰": "‰", - "⊥": "⊥", - "‱": "‱", - "𝔭": "𝔭", - "φ": "φ", - "ϕ": "ϕ", - "ℳ": "ℳ", - "☎": "☎", - "π": "π", - "⋔": "⋔", - "ϖ": "ϖ", - "ℏ": "ℏ", - "ℎ": "ℎ", - "ℏ": "ℏ", - "+": "+", - "⨣": "⨣", - "⊞": "⊞", - "⨢": "⨢", - "∔": "∔", - "⨥": "⨥", - "⩲": "⩲", - "±": "±", - "±": "±", - "⨦": "⨦", - "⨧": "⨧", - "±": "±", - "⨕": "⨕", - "𝕡": "𝕡", - "£": "£", - "£": "£", - "≺": "≺", - "⪳": "⪳", - "⪷": "⪷", - "≼": "≼", - "⪯": "⪯", - "≺": "≺", - "⪷": "⪷", - "≼": "≼", - "⪯": "⪯", - "⪹": "⪹", - "⪵": "⪵", - "⋨": "⋨", - "≾": "≾", - "′": "′", - "ℙ": "ℙ", - "⪵": "⪵", - "⪹": "⪹", - "⋨": "⋨", - "∏": "∏", - "⌮": "⌮", - "⌒": "⌒", - "⌓": "⌓", - "∝": "∝", - "∝": "∝", - "≾": "≾", - "⊰": "⊰", - "𝓅": "𝓅", - "ψ": "ψ", - " ": " ", - "𝔮": "𝔮", - "⨌": "⨌", - "𝕢": "𝕢", - "⁗": "⁗", - "𝓆": "𝓆", - "ℍ": "ℍ", - "⨖": "⨖", - "?": "?", - "≟": "≟", - """: '"', - """: '"', - "⇛": "⇛", - "⇒": "⇒", - "⤜": "⤜", - "⤏": "⤏", - "⥤": "⥤", - "∽̱": "∽̱", - "ŕ": "ŕ", - "√": "√", - "⦳": "⦳", - "⟩": "⟩", - "⦒": "⦒", - "⦥": "⦥", - "⟩": "⟩", - "»": "»", - "»": "»", - "→": "→", - "⥵": "⥵", - "⇥": "⇥", - "⤠": "⤠", - "⤳": "⤳", - "⤞": "⤞", - "↪": "↪", - "↬": "↬", - "⥅": "⥅", - "⥴": "⥴", - "↣": "↣", - "↝": "↝", - "⤚": "⤚", - "∶": "∶", - "ℚ": "ℚ", - "⤍": "⤍", - "❳": "❳", - "}": "}", - "]": "]", - "⦌": "⦌", - "⦎": "⦎", - "⦐": "⦐", - "ř": "ř", - "ŗ": "ŗ", - "⌉": "⌉", - "}": "}", - "р": "р", - "⤷": "⤷", - "⥩": "⥩", - "”": "”", - "”": "”", - "↳": "↳", - "ℜ": "ℜ", - "ℛ": "ℛ", - "ℜ": "ℜ", - "ℝ": "ℝ", - "▭": "▭", - "®": "®", - "®": "®", - "⥽": "⥽", - "⌋": "⌋", - "𝔯": "𝔯", - "⇁": "⇁", - "⇀": "⇀", - "⥬": "⥬", - "ρ": "ρ", - "ϱ": "ϱ", - "→": "→", - "↣": "↣", - "⇁": "⇁", - "⇀": "⇀", - "⇄": "⇄", - "⇌": "⇌", - "⇉": "⇉", - "↝": "↝", - "⋌": "⋌", - "˚": "˚", - "≓": "≓", - "⇄": "⇄", - "⇌": "⇌", - "‏": "‏", - "⎱": "⎱", - "⎱": "⎱", - "⫮": "⫮", - "⟭": "⟭", - "⇾": "⇾", - "⟧": "⟧", - "⦆": "⦆", - "𝕣": "𝕣", - "⨮": "⨮", - "⨵": "⨵", - ")": ")", - "⦔": "⦔", - "⨒": "⨒", - "⇉": "⇉", - "›": "›", - "𝓇": "𝓇", - "↱": "↱", - "]": "]", - "’": "’", - "’": "’", - "⋌": "⋌", - "⋊": "⋊", - "▹": "▹", - "⊵": "⊵", - "▸": "▸", - "⧎": "⧎", - "⥨": "⥨", - "℞": "℞", - "ś": "ś", - "‚": "‚", - "≻": "≻", - "⪴": "⪴", - "⪸": "⪸", - "š": "š", - "≽": "≽", - "⪰": "⪰", - "ş": "ş", - "ŝ": "ŝ", - "⪶": "⪶", - "⪺": "⪺", - "⋩": "⋩", - "⨓": "⨓", - "≿": "≿", - "с": "с", - "⋅": "⋅", - "⊡": "⊡", - "⩦": "⩦", - "⇘": "⇘", - "⤥": "⤥", - "↘": "↘", - "↘": "↘", - "§": "§", - "§": "§", - ";": ";", - "⤩": "⤩", - "∖": "∖", - "∖": "∖", - "✶": "✶", - "𝔰": "𝔰", - "⌢": "⌢", - "♯": "♯", - "щ": "щ", - "ш": "ш", - "∣": "∣", - "∥": "∥", - "­": "­", - "­": "­", - "σ": "σ", - "ς": "ς", - "ς": "ς", - "∼": "∼", - "⩪": "⩪", - "≃": "≃", - "≃": "≃", - "⪞": "⪞", - "⪠": "⪠", - "⪝": "⪝", - "⪟": "⪟", - "≆": "≆", - "⨤": "⨤", - "⥲": "⥲", - "←": "←", - "∖": "∖", - "⨳": "⨳", - "⧤": "⧤", - "∣": "∣", - "⌣": "⌣", - "⪪": "⪪", - "⪬": "⪬", - "⪬︀": "⪬︀", - "ь": "ь", - "/": "/", - "⧄": "⧄", - "⌿": "⌿", - "𝕤": "𝕤", - "♠": "♠", - "♠": "♠", - "∥": "∥", - "⊓": "⊓", - "⊓︀": "⊓︀", - "⊔": "⊔", - "⊔︀": "⊔︀", - "⊏": "⊏", - "⊑": "⊑", - "⊏": "⊏", - "⊑": "⊑", - "⊐": "⊐", - "⊒": "⊒", - "⊐": "⊐", - "⊒": "⊒", - "□": "□", - "□": "□", - "▪": "▪", - "▪": "▪", - "→": "→", - "𝓈": "𝓈", - "∖": "∖", - "⌣": "⌣", - "⋆": "⋆", - "☆": "☆", - "★": "★", - "ϵ": "ϵ", - "ϕ": "ϕ", - "¯": "¯", - "⊂": "⊂", - "⫅": "⫅", - "⪽": "⪽", - "⊆": "⊆", - "⫃": "⫃", - "⫁": "⫁", - "⫋": "⫋", - "⊊": "⊊", - "⪿": "⪿", - "⥹": "⥹", - "⊂": "⊂", - "⊆": "⊆", - "⫅": "⫅", - "⊊": "⊊", - "⫋": "⫋", - "⫇": "⫇", - "⫕": "⫕", - "⫓": "⫓", - "≻": "≻", - "⪸": "⪸", - "≽": "≽", - "⪰": "⪰", - "⪺": "⪺", - "⪶": "⪶", - "⋩": "⋩", - "≿": "≿", - "∑": "∑", - "♪": "♪", - "¹": "¹", - "¹": "¹", - "²": "²", - "²": "²", - "³": "³", - "³": "³", - "⊃": "⊃", - "⫆": "⫆", - "⪾": "⪾", - "⫘": "⫘", - "⊇": "⊇", - "⫄": "⫄", - "⟉": "⟉", - "⫗": "⫗", - "⥻": "⥻", - "⫂": "⫂", - "⫌": "⫌", - "⊋": "⊋", - "⫀": "⫀", - "⊃": "⊃", - "⊇": "⊇", - "⫆": "⫆", - "⊋": "⊋", - "⫌": "⫌", - "⫈": "⫈", - "⫔": "⫔", - "⫖": "⫖", - "⇙": "⇙", - "⤦": "⤦", - "↙": "↙", - "↙": "↙", - "⤪": "⤪", - "ß": "ß", - "ß": "ß", - "⌖": "⌖", - "τ": "τ", - "⎴": "⎴", - "ť": "ť", - "ţ": "ţ", - "т": "т", - "⃛": "⃛", - "⌕": "⌕", - "𝔱": "𝔱", - "∴": "∴", - "∴": "∴", - "θ": "θ", - "ϑ": "ϑ", - "ϑ": "ϑ", - "≈": "≈", - "∼": "∼", - " ": " ", - "≈": "≈", - "∼": "∼", - "þ": "þ", - "þ": "þ", - "˜": "˜", - "×": "×", - "×": "×", - "⊠": "⊠", - "⨱": "⨱", - "⨰": "⨰", - "∭": "∭", - "⤨": "⤨", - "⊤": "⊤", - "⌶": "⌶", - "⫱": "⫱", - "𝕥": "𝕥", - "⫚": "⫚", - "⤩": "⤩", - "‴": "‴", - "™": "™", - "▵": "▵", - "▿": "▿", - "◃": "◃", - "⊴": "⊴", - "≜": "≜", - "▹": "▹", - "⊵": "⊵", - "◬": "◬", - "≜": "≜", - "⨺": "⨺", - "⨹": "⨹", - "⧍": "⧍", - "⨻": "⨻", - "⏢": "⏢", - "𝓉": "𝓉", - "ц": "ц", - "ћ": "ћ", - "ŧ": "ŧ", - "≬": "≬", - "↞": "↞", - "↠": "↠", - "⇑": "⇑", - "⥣": "⥣", - "ú": "ú", - "ú": "ú", - "↑": "↑", - "ў": "ў", - "ŭ": "ŭ", - "û": "û", - "û": "û", - "у": "у", - "⇅": "⇅", - "ű": "ű", - "⥮": "⥮", - "⥾": "⥾", - "𝔲": "𝔲", - "ù": "ù", - "ù": "ù", - "↿": "↿", - "↾": "↾", - "▀": "▀", - "⌜": "⌜", - "⌜": "⌜", - "⌏": "⌏", - "◸": "◸", - "ū": "ū", - "¨": "¨", - "¨": "¨", - "ų": "ų", - "𝕦": "𝕦", - "↑": "↑", - "↕": "↕", - "↿": "↿", - "↾": "↾", - "⊎": "⊎", - "υ": "υ", - "ϒ": "ϒ", - "υ": "υ", - "⇈": "⇈", - "⌝": "⌝", - "⌝": "⌝", - "⌎": "⌎", - "ů": "ů", - "◹": "◹", - "𝓊": "𝓊", - "⋰": "⋰", - "ũ": "ũ", - "▵": "▵", - "▴": "▴", - "⇈": "⇈", - "ü": "ü", - "ü": "ü", - "⦧": "⦧", - "⇕": "⇕", - "⫨": "⫨", - "⫩": "⫩", - "⊨": "⊨", - "⦜": "⦜", - "ϵ": "ϵ", - "ϰ": "ϰ", - "∅": "∅", - "ϕ": "ϕ", - "ϖ": "ϖ", - "∝": "∝", - "↕": "↕", - "ϱ": "ϱ", - "ς": "ς", - "⊊︀": "⊊︀", - "⫋︀": "⫋︀", - "⊋︀": "⊋︀", - "⫌︀": "⫌︀", - "ϑ": "ϑ", - "⊲": "⊲", - "⊳": "⊳", - "в": "в", - "⊢": "⊢", - "∨": "∨", - "⊻": "⊻", - "≚": "≚", - "⋮": "⋮", - "|": "|", - "|": "|", - "𝔳": "𝔳", - "⊲": "⊲", - "⊂⃒": "⊂⃒", - "⊃⃒": "⊃⃒", - "𝕧": "𝕧", - "∝": "∝", - "⊳": "⊳", - "𝓋": "𝓋", - "⫋︀": "⫋︀", - "⊊︀": "⊊︀", - "⫌︀": "⫌︀", - "⊋︀": "⊋︀", - "⦚": "⦚", - "ŵ": "ŵ", - "⩟": "⩟", - "∧": "∧", - "≙": "≙", - "℘": "℘", - "𝔴": "𝔴", - "𝕨": "𝕨", - "℘": "℘", - "≀": "≀", - "≀": "≀", - "𝓌": "𝓌", - "⋂": "⋂", - "◯": "◯", - "⋃": "⋃", - "▽": "▽", - "𝔵": "𝔵", - "⟺": "⟺", - "⟷": "⟷", - "ξ": "ξ", - "⟸": "⟸", - "⟵": "⟵", - "⟼": "⟼", - "⋻": "⋻", - "⨀": "⨀", - "𝕩": "𝕩", - "⨁": "⨁", - "⨂": "⨂", - "⟹": "⟹", - "⟶": "⟶", - "𝓍": "𝓍", - "⨆": "⨆", - "⨄": "⨄", - "△": "△", - "⋁": "⋁", - "⋀": "⋀", - "ý": "ý", - "ý": "ý", - "я": "я", - "ŷ": "ŷ", - "ы": "ы", - "¥": "¥", - "¥": "¥", - "𝔶": "𝔶", - "ї": "ї", - "𝕪": "𝕪", - "𝓎": "𝓎", - "ю": "ю", - "ÿ": "ÿ", - "ÿ": "ÿ", - "ź": "ź", - "ž": "ž", - "з": "з", - "ż": "ż", - "ℨ": "ℨ", - "ζ": "ζ", - "𝔷": "𝔷", - "ж": "ж", - "⇝": "⇝", - "𝕫": "𝕫", - "𝓏": "𝓏", - "‍": "‍", - "‌": "‌" - }, - characters: { - "Æ": "Æ", - "&": "&", - "Á": "Á", - "Ă": "Ă", - "Â": "Â", - "А": "А", - "𝔄": "𝔄", - "À": "À", - "Α": "Α", - "Ā": "Ā", - "⩓": "⩓", - "Ą": "Ą", - "𝔸": "𝔸", - "⁡": "⁡", - "Å": "Å", - "𝒜": "𝒜", - "≔": "≔", - "Ã": "Ã", - "Ä": "Ä", - "∖": "∖", - "⫧": "⫧", - "⌆": "⌆", - "Б": "Б", - "∵": "∵", - "ℬ": "ℬ", - "Β": "Β", - "𝔅": "𝔅", - "𝔹": "𝔹", - "˘": "˘", - "≎": "≎", - "Ч": "Ч", - "©": "©", - "Ć": "Ć", - "⋒": "⋒", - "ⅅ": "ⅅ", - "ℭ": "ℭ", - "Č": "Č", - "Ç": "Ç", - "Ĉ": "Ĉ", - "∰": "∰", - "Ċ": "Ċ", - "¸": "¸", - "·": "·", - "Χ": "Χ", - "⊙": "⊙", - "⊖": "⊖", - "⊕": "⊕", - "⊗": "⊗", - "∲": "∲", - "”": "”", - "’": "’", - "∷": "∷", - "⩴": "⩴", - "≡": "≡", - "∯": "∯", - "∮": "∮", - "ℂ": "ℂ", - "∐": "∐", - "∳": "∳", - "⨯": "⨯", - "𝒞": "𝒞", - "⋓": "⋓", - "≍": "≍", - "⤑": "⤑", - "Ђ": "Ђ", - "Ѕ": "Ѕ", - "Џ": "Џ", - "‡": "‡", - "↡": "↡", - "⫤": "⫤", - "Ď": "Ď", - "Д": "Д", - "∇": "∇", - "Δ": "Δ", - "𝔇": "𝔇", - "´": "´", - "˙": "˙", - "˝": "˝", - "`": "`", - "˜": "˜", - "⋄": "⋄", - "ⅆ": "ⅆ", - "𝔻": "𝔻", - "¨": "¨", - "⃜": "⃜", - "≐": "≐", - "⇓": "⇓", - "⇐": "⇐", - "⇔": "⇔", - "⟸": "⟸", - "⟺": "⟺", - "⟹": "⟹", - "⇒": "⇒", - "⊨": "⊨", - "⇑": "⇑", - "⇕": "⇕", - "∥": "∥", - "↓": "↓", - "⤓": "⤓", - "⇵": "⇵", - "̑": "̑", - "⥐": "⥐", - "⥞": "⥞", - "↽": "↽", - "⥖": "⥖", - "⥟": "⥟", - "⇁": "⇁", - "⥗": "⥗", - "⊤": "⊤", - "↧": "↧", - "𝒟": "𝒟", - "Đ": "Đ", - "Ŋ": "Ŋ", - "Ð": "Ð", - "É": "É", - "Ě": "Ě", - "Ê": "Ê", - "Э": "Э", - "Ė": "Ė", - "𝔈": "𝔈", - "È": "È", - "∈": "∈", - "Ē": "Ē", - "◻": "◻", - "▫": "▫", - "Ę": "Ę", - "𝔼": "𝔼", - "Ε": "Ε", - "⩵": "⩵", - "≂": "≂", - "⇌": "⇌", - "ℰ": "ℰ", - "⩳": "⩳", - "Η": "Η", - "Ë": "Ë", - "∃": "∃", - "ⅇ": "ⅇ", - "Ф": "Ф", - "𝔉": "𝔉", - "◼": "◼", - "▪": "▪", - "𝔽": "𝔽", - "∀": "∀", - "ℱ": "ℱ", - "Ѓ": "Ѓ", - ">": ">", - "Γ": "Γ", - "Ϝ": "Ϝ", - "Ğ": "Ğ", - "Ģ": "Ģ", - "Ĝ": "Ĝ", - "Г": "Г", - "Ġ": "Ġ", - "𝔊": "𝔊", - "⋙": "⋙", - "𝔾": "𝔾", - "≥": "≥", - "⋛": "⋛", - "≧": "≧", - "⪢": "⪢", - "≷": "≷", - "⩾": "⩾", - "≳": "≳", - "𝒢": "𝒢", - "≫": "≫", - "Ъ": "Ъ", - "ˇ": "ˇ", - "^": "^", - "Ĥ": "Ĥ", - "ℌ": "ℌ", - "ℋ": "ℋ", - "ℍ": "ℍ", - "─": "─", - "Ħ": "Ħ", - "≏": "≏", - "Е": "Е", - "IJ": "IJ", - "Ё": "Ё", - "Í": "Í", - "Î": "Î", - "И": "И", - "İ": "İ", - "ℑ": "ℑ", - "Ì": "Ì", - "Ī": "Ī", - "ⅈ": "ⅈ", - "∬": "∬", - "∫": "∫", - "⋂": "⋂", - "⁣": "⁣", - "⁢": "⁢", - "Į": "Į", - "𝕀": "𝕀", - "Ι": "Ι", - "ℐ": "ℐ", - "Ĩ": "Ĩ", - "І": "І", - "Ï": "Ï", - "Ĵ": "Ĵ", - "Й": "Й", - "𝔍": "𝔍", - "𝕁": "𝕁", - "𝒥": "𝒥", - "Ј": "Ј", - "Є": "Є", - "Х": "Х", - "Ќ": "Ќ", - "Κ": "Κ", - "Ķ": "Ķ", - "К": "К", - "𝔎": "𝔎", - "𝕂": "𝕂", - "𝒦": "𝒦", - "Љ": "Љ", - "<": "<", - "Ĺ": "Ĺ", - "Λ": "Λ", - "⟪": "⟪", - "ℒ": "ℒ", - "↞": "↞", - "Ľ": "Ľ", - "Ļ": "Ļ", - "Л": "Л", - "⟨": "⟨", - "←": "←", - "⇤": "⇤", - "⇆": "⇆", - "⌈": "⌈", - "⟦": "⟦", - "⥡": "⥡", - "⇃": "⇃", - "⥙": "⥙", - "⌊": "⌊", - "↔": "↔", - "⥎": "⥎", - "⊣": "⊣", - "↤": "↤", - "⥚": "⥚", - "⊲": "⊲", - "⧏": "⧏", - "⊴": "⊴", - "⥑": "⥑", - "⥠": "⥠", - "↿": "↿", - "⥘": "⥘", - "↼": "↼", - "⥒": "⥒", - "⋚": "⋚", - "≦": "≦", - "≶": "≶", - "⪡": "⪡", - "⩽": "⩽", - "≲": "≲", - "𝔏": "𝔏", - "⋘": "⋘", - "⇚": "⇚", - "Ŀ": "Ŀ", - "⟵": "⟵", - "⟷": "⟷", - "⟶": "⟶", - "𝕃": "𝕃", - "↙": "↙", - "↘": "↘", - "↰": "↰", - "Ł": "Ł", - "≪": "≪", - "⤅": "⤅", - "М": "М", - " ": " ", - "ℳ": "ℳ", - "𝔐": "𝔐", - "∓": "∓", - "𝕄": "𝕄", - "Μ": "Μ", - "Њ": "Њ", - "Ń": "Ń", - "Ň": "Ň", - "Ņ": "Ņ", - "Н": "Н", - "​": "​", - "\n": " ", - "𝔑": "𝔑", - "⁠": "⁠", - " ": " ", - "ℕ": "ℕ", - "⫬": "⫬", - "≢": "≢", - "≭": "≭", - "∦": "∦", - "∉": "∉", - "≠": "≠", - "≂̸": "≂̸", - "∄": "∄", - "≯": "≯", - "≱": "≱", - "≧̸": "≧̸", - "≫̸": "≫̸", - "≹": "≹", - "⩾̸": "⩾̸", - "≵": "≵", - "≎̸": "≎̸", - "≏̸": "≏̸", - "⋪": "⋪", - "⧏̸": "⧏̸", - "⋬": "⋬", - "≮": "≮", - "≰": "≰", - "≸": "≸", - "≪̸": "≪̸", - "⩽̸": "⩽̸", - "≴": "≴", - "⪢̸": "⪢̸", - "⪡̸": "⪡̸", - "⊀": "⊀", - "⪯̸": "⪯̸", - "⋠": "⋠", - "∌": "∌", - "⋫": "⋫", - "⧐̸": "⧐̸", - "⋭": "⋭", - "⊏̸": "⊏̸", - "⋢": "⋢", - "⊐̸": "⊐̸", - "⋣": "⋣", - "⊂⃒": "⊂⃒", - "⊈": "⊈", - "⊁": "⊁", - "⪰̸": "⪰̸", - "⋡": "⋡", - "≿̸": "≿̸", - "⊃⃒": "⊃⃒", - "⊉": "⊉", - "≁": "≁", - "≄": "≄", - "≇": "≇", - "≉": "≉", - "∤": "∤", - "𝒩": "𝒩", - "Ñ": "Ñ", - "Ν": "Ν", - "Œ": "Œ", - "Ó": "Ó", - "Ô": "Ô", - "О": "О", - "Ő": "Ő", - "𝔒": "𝔒", - "Ò": "Ò", - "Ō": "Ō", - "Ω": "Ω", - "Ο": "Ο", - "𝕆": "𝕆", - "“": "“", - "‘": "‘", - "⩔": "⩔", - "𝒪": "𝒪", - "Ø": "Ø", - "Õ": "Õ", - "⨷": "⨷", - "Ö": "Ö", - "‾": "‾", - "⏞": "⏞", - "⎴": "⎴", - "⏜": "⏜", - "∂": "∂", - "П": "П", - "𝔓": "𝔓", - "Φ": "Φ", - "Π": "Π", - "±": "±", - "ℙ": "ℙ", - "⪻": "⪻", - "≺": "≺", - "⪯": "⪯", - "≼": "≼", - "≾": "≾", - "″": "″", - "∏": "∏", - "∝": "∝", - "𝒫": "𝒫", - "Ψ": "Ψ", - '"': """, - "𝔔": "𝔔", - "ℚ": "ℚ", - "𝒬": "𝒬", - "⤐": "⤐", - "®": "®", - "Ŕ": "Ŕ", - "⟫": "⟫", - "↠": "↠", - "⤖": "⤖", - "Ř": "Ř", - "Ŗ": "Ŗ", - "Р": "Р", - "ℜ": "ℜ", - "∋": "∋", - "⇋": "⇋", - "⥯": "⥯", - "Ρ": "Ρ", - "⟩": "⟩", - "→": "→", - "⇥": "⇥", - "⇄": "⇄", - "⌉": "⌉", - "⟧": "⟧", - "⥝": "⥝", - "⇂": "⇂", - "⥕": "⥕", - "⌋": "⌋", - "⊢": "⊢", - "↦": "↦", - "⥛": "⥛", - "⊳": "⊳", - "⧐": "⧐", - "⊵": "⊵", - "⥏": "⥏", - "⥜": "⥜", - "↾": "↾", - "⥔": "⥔", - "⇀": "⇀", - "⥓": "⥓", - "ℝ": "ℝ", - "⥰": "⥰", - "⇛": "⇛", - "ℛ": "ℛ", - "↱": "↱", - "⧴": "⧴", - "Щ": "Щ", - "Ш": "Ш", - "Ь": "Ь", - "Ś": "Ś", - "⪼": "⪼", - "Š": "Š", - "Ş": "Ş", - "Ŝ": "Ŝ", - "С": "С", - "𝔖": "𝔖", - "↑": "↑", - "Σ": "Σ", - "∘": "∘", - "𝕊": "𝕊", - "√": "√", - "□": "□", - "⊓": "⊓", - "⊏": "⊏", - "⊑": "⊑", - "⊐": "⊐", - "⊒": "⊒", - "⊔": "⊔", - "𝒮": "𝒮", - "⋆": "⋆", - "⋐": "⋐", - "⊆": "⊆", - "≻": "≻", - "⪰": "⪰", - "≽": "≽", - "≿": "≿", - "∑": "∑", - "⋑": "⋑", - "⊃": "⊃", - "⊇": "⊇", - "Þ": "Þ", - "™": "™", - "Ћ": "Ћ", - "Ц": "Ц", - "\t": " ", - "Τ": "Τ", - "Ť": "Ť", - "Ţ": "Ţ", - "Т": "Т", - "𝔗": "𝔗", - "∴": "∴", - "Θ": "Θ", - "  ": "  ", - " ": " ", - "∼": "∼", - "≃": "≃", - "≅": "≅", - "≈": "≈", - "𝕋": "𝕋", - "⃛": "⃛", - "𝒯": "𝒯", - "Ŧ": "Ŧ", - "Ú": "Ú", - "↟": "↟", - "⥉": "⥉", - "Ў": "Ў", - "Ŭ": "Ŭ", - "Û": "Û", - "У": "У", - "Ű": "Ű", - "𝔘": "𝔘", - "Ù": "Ù", - "Ū": "Ū", - _: "_", - "⏟": "⏟", - "⎵": "⎵", - "⏝": "⏝", - "⋃": "⋃", - "⊎": "⊎", - "Ų": "Ų", - "𝕌": "𝕌", - "⤒": "⤒", - "⇅": "⇅", - "↕": "↕", - "⥮": "⥮", - "⊥": "⊥", - "↥": "↥", - "↖": "↖", - "↗": "↗", - "ϒ": "ϒ", - "Υ": "Υ", - "Ů": "Ů", - "𝒰": "𝒰", - "Ũ": "Ũ", - "Ü": "Ü", - "⊫": "⊫", - "⫫": "⫫", - "В": "В", - "⊩": "⊩", - "⫦": "⫦", - "⋁": "⋁", - "‖": "‖", - "∣": "∣", - "|": "|", - "❘": "❘", - "≀": "≀", - " ": " ", - "𝔙": "𝔙", - "𝕍": "𝕍", - "𝒱": "𝒱", - "⊪": "⊪", - "Ŵ": "Ŵ", - "⋀": "⋀", - "𝔚": "𝔚", - "𝕎": "𝕎", - "𝒲": "𝒲", - "𝔛": "𝔛", - "Ξ": "Ξ", - "𝕏": "𝕏", - "𝒳": "𝒳", - "Я": "Я", - "Ї": "Ї", - "Ю": "Ю", - "Ý": "Ý", - "Ŷ": "Ŷ", - "Ы": "Ы", - "𝔜": "𝔜", - "𝕐": "𝕐", - "𝒴": "𝒴", - "Ÿ": "Ÿ", - "Ж": "Ж", - "Ź": "Ź", - "Ž": "Ž", - "З": "З", - "Ż": "Ż", - "Ζ": "Ζ", - "ℨ": "ℨ", - "ℤ": "ℤ", - "𝒵": "𝒵", - "á": "á", - "ă": "ă", - "∾": "∾", - "∾̳": "∾̳", - "∿": "∿", - "â": "â", - "а": "а", - "æ": "æ", - "𝔞": "𝔞", - "à": "à", - "ℵ": "ℵ", - "α": "α", - "ā": "ā", - "⨿": "⨿", - "∧": "∧", - "⩕": "⩕", - "⩜": "⩜", - "⩘": "⩘", - "⩚": "⩚", - "∠": "∠", - "⦤": "⦤", - "∡": "∡", - "⦨": "⦨", - "⦩": "⦩", - "⦪": "⦪", - "⦫": "⦫", - "⦬": "⦬", - "⦭": "⦭", - "⦮": "⦮", - "⦯": "⦯", - "∟": "∟", - "⊾": "⊾", - "⦝": "⦝", - "∢": "∢", - "⍼": "⍼", - "ą": "ą", - "𝕒": "𝕒", - "⩰": "⩰", - "⩯": "⩯", - "≊": "≊", - "≋": "≋", - "'": "'", - "å": "å", - "𝒶": "𝒶", - "*": "*", - "ã": "ã", - "ä": "ä", - "⨑": "⨑", - "⫭": "⫭", - "≌": "≌", - "϶": "϶", - "‵": "‵", - "∽": "∽", - "⋍": "⋍", - "⊽": "⊽", - "⌅": "⌅", - "⎶": "⎶", - "б": "б", - "„": "„", - "⦰": "⦰", - "β": "β", - "ℶ": "ℶ", - "≬": "≬", - "𝔟": "𝔟", - "◯": "◯", - "⨀": "⨀", - "⨁": "⨁", - "⨂": "⨂", - "⨆": "⨆", - "★": "★", - "▽": "▽", - "△": "△", - "⨄": "⨄", - "⤍": "⤍", - "⧫": "⧫", - "▴": "▴", - "▾": "▾", - "◂": "◂", - "▸": "▸", - "␣": "␣", - "▒": "▒", - "░": "░", - "▓": "▓", - "█": "█", - "=⃥": "=⃥", - "≡⃥": "≡⃥", - "⌐": "⌐", - "𝕓": "𝕓", - "⋈": "⋈", - "╗": "╗", - "╔": "╔", - "╖": "╖", - "╓": "╓", - "═": "═", - "╦": "╦", - "╩": "╩", - "╤": "╤", - "╧": "╧", - "╝": "╝", - "╚": "╚", - "╜": "╜", - "╙": "╙", - "║": "║", - "╬": "╬", - "╣": "╣", - "╠": "╠", - "╫": "╫", - "╢": "╢", - "╟": "╟", - "⧉": "⧉", - "╕": "╕", - "╒": "╒", - "┐": "┐", - "┌": "┌", - "╥": "╥", - "╨": "╨", - "┬": "┬", - "┴": "┴", - "⊟": "⊟", - "⊞": "⊞", - "⊠": "⊠", - "╛": "╛", - "╘": "╘", - "┘": "┘", - "└": "└", - "│": "│", - "╪": "╪", - "╡": "╡", - "╞": "╞", - "┼": "┼", - "┤": "┤", - "├": "├", - "¦": "¦", - "𝒷": "𝒷", - "⁏": "⁏", - "\\": "\", - "⧅": "⧅", - "⟈": "⟈", - "•": "•", - "⪮": "⪮", - "ć": "ć", - "∩": "∩", - "⩄": "⩄", - "⩉": "⩉", - "⩋": "⩋", - "⩇": "⩇", - "⩀": "⩀", - "∩︀": "∩︀", - "⁁": "⁁", - "⩍": "⩍", - "č": "č", - "ç": "ç", - "ĉ": "ĉ", - "⩌": "⩌", - "⩐": "⩐", - "ċ": "ċ", - "⦲": "⦲", - "¢": "¢", - "𝔠": "𝔠", - "ч": "ч", - "✓": "✓", - "χ": "χ", - "○": "○", - "⧃": "⧃", - "ˆ": "ˆ", - "≗": "≗", - "↺": "↺", - "↻": "↻", - "Ⓢ": "Ⓢ", - "⊛": "⊛", - "⊚": "⊚", - "⊝": "⊝", - "⨐": "⨐", - "⫯": "⫯", - "⧂": "⧂", - "♣": "♣", - ":": ":", - ",": ",", - "@": "@", - "∁": "∁", - "⩭": "⩭", - "𝕔": "𝕔", - "℗": "℗", - "↵": "↵", - "✗": "✗", - "𝒸": "𝒸", - "⫏": "⫏", - "⫑": "⫑", - "⫐": "⫐", - "⫒": "⫒", - "⋯": "⋯", - "⤸": "⤸", - "⤵": "⤵", - "⋞": "⋞", - "⋟": "⋟", - "↶": "↶", - "⤽": "⤽", - "∪": "∪", - "⩈": "⩈", - "⩆": "⩆", - "⩊": "⩊", - "⊍": "⊍", - "⩅": "⩅", - "∪︀": "∪︀", - "↷": "↷", - "⤼": "⤼", - "⋎": "⋎", - "⋏": "⋏", - "¤": "¤", - "∱": "∱", - "⌭": "⌭", - "⥥": "⥥", - "†": "†", - "ℸ": "ℸ", - "‐": "‐", - "⤏": "⤏", - "ď": "ď", - "д": "д", - "⇊": "⇊", - "⩷": "⩷", - "°": "°", - "δ": "δ", - "⦱": "⦱", - "⥿": "⥿", - "𝔡": "𝔡", - "♦": "♦", - "ϝ": "ϝ", - "⋲": "⋲", - "÷": "÷", - "⋇": "⋇", - "ђ": "ђ", - "⌞": "⌞", - "⌍": "⌍", - $: "$", - "𝕕": "𝕕", - "≑": "≑", - "∸": "∸", - "∔": "∔", - "⊡": "⊡", - "⌟": "⌟", - "⌌": "⌌", - "𝒹": "𝒹", - "ѕ": "ѕ", - "⧶": "⧶", - "đ": "đ", - "⋱": "⋱", - "▿": "▿", - "⦦": "⦦", - "џ": "џ", - "⟿": "⟿", - "é": "é", - "⩮": "⩮", - "ě": "ě", - "≖": "≖", - "ê": "ê", - "≕": "≕", - "э": "э", - "ė": "ė", - "≒": "≒", - "𝔢": "𝔢", - "⪚": "⪚", - "è": "è", - "⪖": "⪖", - "⪘": "⪘", - "⪙": "⪙", - "⏧": "⏧", - "ℓ": "ℓ", - "⪕": "⪕", - "⪗": "⪗", - "ē": "ē", - "∅": "∅", - " ": " ", - " ": " ", - " ": " ", - "ŋ": "ŋ", - " ": " ", - "ę": "ę", - "𝕖": "𝕖", - "⋕": "⋕", - "⧣": "⧣", - "⩱": "⩱", - "ε": "ε", - "ϵ": "ϵ", - "=": "=", - "≟": "≟", - "⩸": "⩸", - "⧥": "⧥", - "≓": "≓", - "⥱": "⥱", - "ℯ": "ℯ", - "η": "η", - "ð": "ð", - "ë": "ë", - "€": "€", - "!": "!", - "ф": "ф", - "♀": "♀", - "ffi": "ffi", - "ff": "ff", - "ffl": "ffl", - "𝔣": "𝔣", - "fi": "fi", - fj: "fj", - "♭": "♭", - "fl": "fl", - "▱": "▱", - "ƒ": "ƒ", - "𝕗": "𝕗", - "⋔": "⋔", - "⫙": "⫙", - "⨍": "⨍", - "½": "½", - "⅓": "⅓", - "¼": "¼", - "⅕": "⅕", - "⅙": "⅙", - "⅛": "⅛", - "⅔": "⅔", - "⅖": "⅖", - "¾": "¾", - "⅗": "⅗", - "⅜": "⅜", - "⅘": "⅘", - "⅚": "⅚", - "⅝": "⅝", - "⅞": "⅞", - "⁄": "⁄", - "⌢": "⌢", - "𝒻": "𝒻", - "⪌": "⪌", - "ǵ": "ǵ", - "γ": "γ", - "⪆": "⪆", - "ğ": "ğ", - "ĝ": "ĝ", - "г": "г", - "ġ": "ġ", - "⪩": "⪩", - "⪀": "⪀", - "⪂": "⪂", - "⪄": "⪄", - "⋛︀": "⋛︀", - "⪔": "⪔", - "𝔤": "𝔤", - "ℷ": "ℷ", - "ѓ": "ѓ", - "⪒": "⪒", - "⪥": "⪥", - "⪤": "⪤", - "≩": "≩", - "⪊": "⪊", - "⪈": "⪈", - "⋧": "⋧", - "𝕘": "𝕘", - "ℊ": "ℊ", - "⪎": "⪎", - "⪐": "⪐", - "⪧": "⪧", - "⩺": "⩺", - "⋗": "⋗", - "⦕": "⦕", - "⩼": "⩼", - "⥸": "⥸", - "≩︀": "≩︀", - "ъ": "ъ", - "⥈": "⥈", - "↭": "↭", - "ℏ": "ℏ", - "ĥ": "ĥ", - "♥": "♥", - "…": "…", - "⊹": "⊹", - "𝔥": "𝔥", - "⤥": "⤥", - "⤦": "⤦", - "⇿": "⇿", - "∻": "∻", - "↩": "↩", - "↪": "↪", - "𝕙": "𝕙", - "―": "―", - "𝒽": "𝒽", - "ħ": "ħ", - "⁃": "⁃", - "í": "í", - "î": "î", - "и": "и", - "е": "е", - "¡": "¡", - "𝔦": "𝔦", - "ì": "ì", - "⨌": "⨌", - "∭": "∭", - "⧜": "⧜", - "℩": "℩", - "ij": "ij", - "ī": "ī", - "ı": "ı", - "⊷": "⊷", - "Ƶ": "Ƶ", - "℅": "℅", - "∞": "∞", - "⧝": "⧝", - "⊺": "⊺", - "⨗": "⨗", - "⨼": "⨼", - "ё": "ё", - "į": "į", - "𝕚": "𝕚", - "ι": "ι", - "¿": "¿", - "𝒾": "𝒾", - "⋹": "⋹", - "⋵": "⋵", - "⋴": "⋴", - "⋳": "⋳", - "ĩ": "ĩ", - "і": "і", - "ï": "ï", - "ĵ": "ĵ", - "й": "й", - "𝔧": "𝔧", - "ȷ": "ȷ", - "𝕛": "𝕛", - "𝒿": "𝒿", - "ј": "ј", - "є": "є", - "κ": "κ", - "ϰ": "ϰ", - "ķ": "ķ", - "к": "к", - "𝔨": "𝔨", - "ĸ": "ĸ", - "х": "х", - "ќ": "ќ", - "𝕜": "𝕜", - "𝓀": "𝓀", - "⤛": "⤛", - "⤎": "⤎", - "⪋": "⪋", - "⥢": "⥢", - "ĺ": "ĺ", - "⦴": "⦴", - "λ": "λ", - "⦑": "⦑", - "⪅": "⪅", - "«": "«", - "⤟": "⤟", - "⤝": "⤝", - "↫": "↫", - "⤹": "⤹", - "⥳": "⥳", - "↢": "↢", - "⪫": "⪫", - "⤙": "⤙", - "⪭": "⪭", - "⪭︀": "⪭︀", - "⤌": "⤌", - "❲": "❲", - "{": "{", - "[": "[", - "⦋": "⦋", - "⦏": "⦏", - "⦍": "⦍", - "ľ": "ľ", - "ļ": "ļ", - "л": "л", - "⤶": "⤶", - "⥧": "⥧", - "⥋": "⥋", - "↲": "↲", - "≤": "≤", - "⇇": "⇇", - "⋋": "⋋", - "⪨": "⪨", - "⩿": "⩿", - "⪁": "⪁", - "⪃": "⪃", - "⋚︀": "⋚︀", - "⪓": "⪓", - "⋖": "⋖", - "⥼": "⥼", - "𝔩": "𝔩", - "⪑": "⪑", - "⥪": "⥪", - "▄": "▄", - "љ": "љ", - "⥫": "⥫", - "◺": "◺", - "ŀ": "ŀ", - "⎰": "⎰", - "≨": "≨", - "⪉": "⪉", - "⪇": "⪇", - "⋦": "⋦", - "⟬": "⟬", - "⇽": "⇽", - "⟼": "⟼", - "↬": "↬", - "⦅": "⦅", - "𝕝": "𝕝", - "⨭": "⨭", - "⨴": "⨴", - "∗": "∗", - "◊": "◊", - "(": "(", - "⦓": "⦓", - "⥭": "⥭", - "‎": "‎", - "⊿": "⊿", - "‹": "‹", - "𝓁": "𝓁", - "⪍": "⪍", - "⪏": "⪏", - "‚": "‚", - "ł": "ł", - "⪦": "⪦", - "⩹": "⩹", - "⋉": "⋉", - "⥶": "⥶", - "⩻": "⩻", - "⦖": "⦖", - "◃": "◃", - "⥊": "⥊", - "⥦": "⥦", - "≨︀": "≨︀", - "∺": "∺", - "¯": "¯", - "♂": "♂", - "✠": "✠", - "▮": "▮", - "⨩": "⨩", - "м": "м", - "—": "—", - "𝔪": "𝔪", - "℧": "℧", - "µ": "µ", - "⫰": "⫰", - "−": "−", - "⨪": "⨪", - "⫛": "⫛", - "⊧": "⊧", - "𝕞": "𝕞", - "𝓂": "𝓂", - "μ": "μ", - "⊸": "⊸", - "⋙̸": "⋙̸", - "≫⃒": "≫⃒", - "⇍": "⇍", - "⇎": "⇎", - "⋘̸": "⋘̸", - "≪⃒": "≪⃒", - "⇏": "⇏", - "⊯": "⊯", - "⊮": "⊮", - "ń": "ń", - "∠⃒": "∠⃒", - "⩰̸": "⩰̸", - "≋̸": "≋̸", - "ʼn": "ʼn", - "♮": "♮", - "⩃": "⩃", - "ň": "ň", - "ņ": "ņ", - "⩭̸": "⩭̸", - "⩂": "⩂", - "н": "н", - "–": "–", - "⇗": "⇗", - "⤤": "⤤", - "≐̸": "≐̸", - "⤨": "⤨", - "𝔫": "𝔫", - "↮": "↮", - "⫲": "⫲", - "⋼": "⋼", - "⋺": "⋺", - "њ": "њ", - "≦̸": "≦̸", - "↚": "↚", - "‥": "‥", - "𝕟": "𝕟", - "¬": "¬", - "⋹̸": "⋹̸", - "⋵̸": "⋵̸", - "⋷": "⋷", - "⋶": "⋶", - "⋾": "⋾", - "⋽": "⋽", - "⫽⃥": "⫽⃥", - "∂̸": "∂̸", - "⨔": "⨔", - "↛": "↛", - "⤳̸": "⤳̸", - "↝̸": "↝̸", - "𝓃": "𝓃", - "⊄": "⊄", - "⫅̸": "⫅̸", - "⊅": "⊅", - "⫆̸": "⫆̸", - "ñ": "ñ", - "ν": "ν", - "#": "#", - "№": "№", - " ": " ", - "⊭": "⊭", - "⤄": "⤄", - "≍⃒": "≍⃒", - "⊬": "⊬", - "≥⃒": "≥⃒", - ">⃒": ">⃒", - "⧞": "⧞", - "⤂": "⤂", - "≤⃒": "≤⃒", - "<⃒": "<⃒", - "⊴⃒": "⊴⃒", - "⤃": "⤃", - "⊵⃒": "⊵⃒", - "∼⃒": "∼⃒", - "⇖": "⇖", - "⤣": "⤣", - "⤧": "⤧", - "ó": "ó", - "ô": "ô", - "о": "о", - "ő": "ő", - "⨸": "⨸", - "⦼": "⦼", - "œ": "œ", - "⦿": "⦿", - "𝔬": "𝔬", - "˛": "˛", - "ò": "ò", - "⧁": "⧁", - "⦵": "⦵", - "⦾": "⦾", - "⦻": "⦻", - "⧀": "⧀", - "ō": "ō", - "ω": "ω", - "ο": "ο", - "⦶": "⦶", - "𝕠": "𝕠", - "⦷": "⦷", - "⦹": "⦹", - "∨": "∨", - "⩝": "⩝", - "ℴ": "ℴ", - "ª": "ª", - "º": "º", - "⊶": "⊶", - "⩖": "⩖", - "⩗": "⩗", - "⩛": "⩛", - "ø": "ø", - "⊘": "⊘", - "õ": "õ", - "⨶": "⨶", - "ö": "ö", - "⌽": "⌽", - "¶": "¶", - "⫳": "⫳", - "⫽": "⫽", - "п": "п", - "%": "%", - ".": ".", - "‰": "‰", - "‱": "‱", - "𝔭": "𝔭", - "φ": "φ", - "ϕ": "ϕ", - "☎": "☎", - "π": "π", - "ϖ": "ϖ", - "ℎ": "ℎ", - "+": "+", - "⨣": "⨣", - "⨢": "⨢", - "⨥": "⨥", - "⩲": "⩲", - "⨦": "⨦", - "⨧": "⨧", - "⨕": "⨕", - "𝕡": "𝕡", - "£": "£", - "⪳": "⪳", - "⪷": "⪷", - "⪹": "⪹", - "⪵": "⪵", - "⋨": "⋨", - "′": "′", - "⌮": "⌮", - "⌒": "⌒", - "⌓": "⌓", - "⊰": "⊰", - "𝓅": "𝓅", - "ψ": "ψ", - " ": " ", - "𝔮": "𝔮", - "𝕢": "𝕢", - "⁗": "⁗", - "𝓆": "𝓆", - "⨖": "⨖", - "?": "?", - "⤜": "⤜", - "⥤": "⥤", - "∽̱": "∽̱", - "ŕ": "ŕ", - "⦳": "⦳", - "⦒": "⦒", - "⦥": "⦥", - "»": "»", - "⥵": "⥵", - "⤠": "⤠", - "⤳": "⤳", - "⤞": "⤞", - "⥅": "⥅", - "⥴": "⥴", - "↣": "↣", - "↝": "↝", - "⤚": "⤚", - "∶": "∶", - "❳": "❳", - "}": "}", - "]": "]", - "⦌": "⦌", - "⦎": "⦎", - "⦐": "⦐", - "ř": "ř", - "ŗ": "ŗ", - "р": "р", - "⤷": "⤷", - "⥩": "⥩", - "↳": "↳", - "▭": "▭", - "⥽": "⥽", - "𝔯": "𝔯", - "⥬": "⥬", - "ρ": "ρ", - "ϱ": "ϱ", - "⇉": "⇉", - "⋌": "⋌", - "˚": "˚", - "‏": "‏", - "⎱": "⎱", - "⫮": "⫮", - "⟭": "⟭", - "⇾": "⇾", - "⦆": "⦆", - "𝕣": "𝕣", - "⨮": "⨮", - "⨵": "⨵", - ")": ")", - "⦔": "⦔", - "⨒": "⨒", - "›": "›", - "𝓇": "𝓇", - "⋊": "⋊", - "▹": "▹", - "⧎": "⧎", - "⥨": "⥨", - "℞": "℞", - "ś": "ś", - "⪴": "⪴", - "⪸": "⪸", - "š": "š", - "ş": "ş", - "ŝ": "ŝ", - "⪶": "⪶", - "⪺": "⪺", - "⋩": "⋩", - "⨓": "⨓", - "с": "с", - "⋅": "⋅", - "⩦": "⩦", - "⇘": "⇘", - "§": "§", - ";": ";", - "⤩": "⤩", - "✶": "✶", - "𝔰": "𝔰", - "♯": "♯", - "щ": "щ", - "ш": "ш", - "­": "­", - "σ": "σ", - "ς": "ς", - "⩪": "⩪", - "⪞": "⪞", - "⪠": "⪠", - "⪝": "⪝", - "⪟": "⪟", - "≆": "≆", - "⨤": "⨤", - "⥲": "⥲", - "⨳": "⨳", - "⧤": "⧤", - "⌣": "⌣", - "⪪": "⪪", - "⪬": "⪬", - "⪬︀": "⪬︀", - "ь": "ь", - "/": "/", - "⧄": "⧄", - "⌿": "⌿", - "𝕤": "𝕤", - "♠": "♠", - "⊓︀": "⊓︀", - "⊔︀": "⊔︀", - "𝓈": "𝓈", - "☆": "☆", - "⊂": "⊂", - "⫅": "⫅", - "⪽": "⪽", - "⫃": "⫃", - "⫁": "⫁", - "⫋": "⫋", - "⊊": "⊊", - "⪿": "⪿", - "⥹": "⥹", - "⫇": "⫇", - "⫕": "⫕", - "⫓": "⫓", - "♪": "♪", - "¹": "¹", - "²": "²", - "³": "³", - "⫆": "⫆", - "⪾": "⪾", - "⫘": "⫘", - "⫄": "⫄", - "⟉": "⟉", - "⫗": "⫗", - "⥻": "⥻", - "⫂": "⫂", - "⫌": "⫌", - "⊋": "⊋", - "⫀": "⫀", - "⫈": "⫈", - "⫔": "⫔", - "⫖": "⫖", - "⇙": "⇙", - "⤪": "⤪", - "ß": "ß", - "⌖": "⌖", - "τ": "τ", - "ť": "ť", - "ţ": "ţ", - "т": "т", - "⌕": "⌕", - "𝔱": "𝔱", - "θ": "θ", - "ϑ": "ϑ", - "þ": "þ", - "×": "×", - "⨱": "⨱", - "⨰": "⨰", - "⌶": "⌶", - "⫱": "⫱", - "𝕥": "𝕥", - "⫚": "⫚", - "‴": "‴", - "▵": "▵", - "≜": "≜", - "◬": "◬", - "⨺": "⨺", - "⨹": "⨹", - "⧍": "⧍", - "⨻": "⨻", - "⏢": "⏢", - "𝓉": "𝓉", - "ц": "ц", - "ћ": "ћ", - "ŧ": "ŧ", - "⥣": "⥣", - "ú": "ú", - "ў": "ў", - "ŭ": "ŭ", - "û": "û", - "у": "у", - "ű": "ű", - "⥾": "⥾", - "𝔲": "𝔲", - "ù": "ù", - "▀": "▀", - "⌜": "⌜", - "⌏": "⌏", - "◸": "◸", - "ū": "ū", - "ų": "ų", - "𝕦": "𝕦", - "υ": "υ", - "⇈": "⇈", - "⌝": "⌝", - "⌎": "⌎", - "ů": "ů", - "◹": "◹", - "𝓊": "𝓊", - "⋰": "⋰", - "ũ": "ũ", - "ü": "ü", - "⦧": "⦧", - "⫨": "⫨", - "⫩": "⫩", - "⦜": "⦜", - "⊊︀": "⊊︀", - "⫋︀": "⫋︀", - "⊋︀": "⊋︀", - "⫌︀": "⫌︀", - "в": "в", - "⊻": "⊻", - "≚": "≚", - "⋮": "⋮", - "𝔳": "𝔳", - "𝕧": "𝕧", - "𝓋": "𝓋", - "⦚": "⦚", - "ŵ": "ŵ", - "⩟": "⩟", - "≙": "≙", - "℘": "℘", - "𝔴": "𝔴", - "𝕨": "𝕨", - "𝓌": "𝓌", - "𝔵": "𝔵", - "ξ": "ξ", - "⋻": "⋻", - "𝕩": "𝕩", - "𝓍": "𝓍", - "ý": "ý", - "я": "я", - "ŷ": "ŷ", - "ы": "ы", - "¥": "¥", - "𝔶": "𝔶", - "ї": "ї", - "𝕪": "𝕪", - "𝓎": "𝓎", - "ю": "ю", - "ÿ": "ÿ", - "ź": "ź", - "ž": "ž", - "з": "з", - "ż": "ż", - "ζ": "ζ", - "𝔷": "𝔷", - "ж": "ж", - "⇝": "⇝", - "𝕫": "𝕫", - "𝓏": "𝓏", - "‍": "‍", - "‌": "‌" - } - } -}; - -/***/ }), - -/***/ "./node_modules/html-entities/lib/numeric-unicode-map.js": -/*!***************************************************************!*\ - !*** ./node_modules/html-entities/lib/numeric-unicode-map.js ***! - \***************************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.numericUnicodeMap = { - 0: 65533, - 128: 8364, - 130: 8218, - 131: 402, - 132: 8222, - 133: 8230, - 134: 8224, - 135: 8225, - 136: 710, - 137: 8240, - 138: 352, - 139: 8249, - 140: 338, - 142: 381, - 145: 8216, - 146: 8217, - 147: 8220, - 148: 8221, - 149: 8226, - 150: 8211, - 151: 8212, - 152: 732, - 153: 8482, - 154: 353, - 155: 8250, - 156: 339, - 158: 382, - 159: 376 -}; - -/***/ }), - -/***/ "./node_modules/html-entities/lib/surrogate-pairs.js": -/*!***********************************************************!*\ - !*** ./node_modules/html-entities/lib/surrogate-pairs.js ***! - \***********************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); - -exports.fromCodePoint = String.fromCodePoint || function (astralCodePoint) { - return String.fromCharCode(Math.floor((astralCodePoint - 65536) / 1024) + 55296, (astralCodePoint - 65536) % 1024 + 56320); -}; - -exports.getCodePoint = String.prototype.codePointAt ? function (input, position) { - return input.codePointAt(position); -} : function (input, position) { - return (input.charCodeAt(position) - 55296) * 1024 + input.charCodeAt(position + 1) - 56320 + 65536; -}; -exports.highSurrogateFrom = 55296; -exports.highSurrogateTo = 56319; - -/***/ }), - -/***/ "./node_modules/react-dom/cjs/react-dom.development.js": -/*!*************************************************************!*\ - !*** ./node_modules/react-dom/cjs/react-dom.development.js ***! - \*************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; -/** - * @license React - * react-dom.development.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - -if (true) { - (function () { - 'use strict'; - /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ - - if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === 'function') { - __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); - } - - var React = __webpack_require__(/*! react */ "./node_modules/react/index.js"); - - var Scheduler = __webpack_require__(/*! scheduler */ "./node_modules/scheduler/index.js"); - - var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - var suppressWarning = false; - - function setSuppressWarning(newSuppressWarning) { - { - suppressWarning = newSuppressWarning; - } - } // In DEV, calls to console.warn and console.error get replaced - // by calls to these methods by a Babel plugin. - // - // In PROD (or in packages without access to React internals), - // they are left as they are instead. - - - function warn(format) { - { - if (!suppressWarning) { - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - printWarning('warn', format, args); - } - } - } - - function error(format) { - { - if (!suppressWarning) { - for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } - - printWarning('error', format, args); - } - } - } - - function printWarning(level, format, args) { - // When changing this logic, you might want to also - // update consoleWithStackDev.www.js as well. - { - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); - - if (stack !== '') { - format += '%s'; - args = args.concat([stack]); - } // eslint-disable-next-line react-internal/safe-string-coercion - - - var argsWithFormat = args.map(function (item) { - return String(item); - }); // Careful: RN currently depends on this prefix - - argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it - // breaks IE9: https://github.com/facebook/react/issues/13610 - // eslint-disable-next-line react-internal/no-production-logging - - Function.prototype.apply.call(console[level], console, argsWithFormat); - } - } - - var FunctionComponent = 0; - var ClassComponent = 1; - var IndeterminateComponent = 2; // Before we know whether it is function or class - - var HostRoot = 3; // Root of a host tree. Could be nested inside another node. - - var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. - - var HostComponent = 5; - var HostText = 6; - var Fragment = 7; - var Mode = 8; - var ContextConsumer = 9; - var ContextProvider = 10; - var ForwardRef = 11; - var Profiler = 12; - var SuspenseComponent = 13; - var MemoComponent = 14; - var SimpleMemoComponent = 15; - var LazyComponent = 16; - var IncompleteClassComponent = 17; - var DehydratedFragment = 18; - var SuspenseListComponent = 19; - var ScopeComponent = 21; - var OffscreenComponent = 22; - var LegacyHiddenComponent = 23; - var CacheComponent = 24; - var TracingMarkerComponent = 25; // ----------------------------------------------------------------------------- - - var enableClientRenderFallbackOnTextMismatch = true; // TODO: Need to review this code one more time before landing - // the react-reconciler package. - - var enableNewReconciler = false; // Support legacy Primer support on internal FB www - - var enableLazyContextPropagation = false; // FB-only usage. The new API has different semantics. - - var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber - - var enableSuspenseAvoidThisFallback = false; // Enables unstable_avoidThisFallback feature in Fizz - // React DOM Chopping Block - // - // Similar to main Chopping Block but only flags related to React DOM. These are - // grouped because we will likely batch all of them into a single major release. - // ----------------------------------------------------------------------------- - // Disable support for comment nodes as React DOM containers. Already disabled - // in open source, but www codebase still relies on it. Need to remove. - - var disableCommentsAsDOMContainers = true; // Disable javascript: URL strings in href for XSS protection. - // and client rendering, mostly to allow JSX attributes to apply to the custom - // element's object properties instead of only HTML attributes. - // https://github.com/facebook/react/issues/11347 - - var enableCustomElementPropertySupport = false; // Disables children for