"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useResponsive = void 0;
var _react = require("react");
var _ResponsiveContext = _interopRequireDefault(require("../ResponsiveContext"));
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.

const useResponsive = () => {
  const isResponsive = (0, _react.useContext)(_ResponsiveContext.default);
  const isInResponsiveContext = typeof isResponsive === 'boolean';
  const [isResponsiveInternal, setIsResponsiveInternal] = (0, _react.useState)(false);
  return {
    isResponsive: isInResponsiveContext ? isResponsive : isResponsiveInternal,
    isInResponsiveContext,
    compact: () => {
      setIsResponsiveInternal(true);
      return false;
    },
    expand: () => {
      setIsResponsiveInternal(false);
      return false;
    }
  };
};
exports.useResponsive = useResponsive;