(self["webpackChunkapp"] = self["webpackChunkapp"] || []).push([[9544],{

/***/ 9544:
/*!**********************************************************************!*\
  !*** ./node_modules/@capacitor-community/keep-awake/dist/esm/web.js ***!
  \**********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "KeepAwakeWeb": () => (/* binding */ KeepAwakeWeb)
/* harmony export */ });
/* harmony import */ var _Volumes_case_workspace_work_APPS_KA_APP_WORK_NOW_KA_PASS_V2_2_6_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */ 71670);
/* harmony import */ var _capacitor_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @capacitor/core */ 26549);


class KeepAwakeWeb extends _capacitor_core__WEBPACK_IMPORTED_MODULE_1__.WebPlugin {
  constructor() {
    super(...arguments);
    this.wakeLock = null;
    this._isSupported = typeof navigator !== 'undefined' && 'wakeLock' in navigator;

    this.handleVisibilityChange = () => {
      if (document.visibilityState === 'visible') this.keepAwake();
    };
  }

  keepAwake() {
    var _this = this;

    return (0,_Volumes_case_workspace_work_APPS_KA_APP_WORK_NOW_KA_PASS_V2_2_6_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
      if (!_this._isSupported) {
        _this.throwUnsupportedError();
      }

      if (_this.wakeLock) {
        yield _this.allowSleep();
      }

      _this.wakeLock = yield navigator.wakeLock.request('screen');
      document.addEventListener('visibilitychange', _this.handleVisibilityChange);
      document.addEventListener('fullscreenchange', _this.handleVisibilityChange);
    })();
  }

  allowSleep() {
    var _this2 = this;

    return (0,_Volumes_case_workspace_work_APPS_KA_APP_WORK_NOW_KA_PASS_V2_2_6_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
      var _a;

      if (!_this2._isSupported) {
        _this2.throwUnsupportedError();
      }

      (_a = _this2.wakeLock) === null || _a === void 0 ? void 0 : _a.release();
      _this2.wakeLock = null;
      document.removeEventListener('visibilitychange', _this2.handleVisibilityChange);
      document.removeEventListener('fullscreenchange', _this2.handleVisibilityChange);
    })();
  }

  isSupported() {
    var _this3 = this;

    return (0,_Volumes_case_workspace_work_APPS_KA_APP_WORK_NOW_KA_PASS_V2_2_6_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
      const result = {
        isSupported: _this3._isSupported
      };
      return result;
    })();
  }

  isKeptAwake() {
    var _this4 = this;

    return (0,_Volumes_case_workspace_work_APPS_KA_APP_WORK_NOW_KA_PASS_V2_2_6_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
      if (!_this4._isSupported) {
        _this4.throwUnsupportedError();
      }

      const result = {
        isKeptAwake: !!_this4.wakeLock
      };
      return result;
    })();
  }

  throwUnsupportedError() {
    throw this.unavailable('Screen Wake Lock API not available in this browser.');
  }

}

/***/ })

}])
//# sourceMappingURL=9544.js.map