import "core-js/modules/es.array.iterator.js";
import "core-js/modules/web.dom-collections.iterator.js";
import React, { useEffect, useState } from 'react';
import { FullscreenExitOutlined, FullscreenOutlined } from '@wii/icons';
import Tooltip from '../tooltip';
import Button from '../button';
import { isBrowser } from '../utils';
import { useIntl } from '../wau-provider';
import { jsx as _jsx } from "react/jsx-runtime";
const FullScreenIcon = () => {
  const intl = useIntl();
  const [fullscreen, setFullscreen] = useState(false);
  useEffect(() => {
    if (!isBrowser()) {
      return;
    }
    document.onfullscreenchange = () => {
      setFullscreen(!!document.fullscreenElement);
    };
  }, []);
  return fullscreen ? /*#__PURE__*/_jsx(Tooltip, {
    title: intl.getMessage('tableToolBar.exitFullScreen', '全屏'),
    children: /*#__PURE__*/_jsx(Button, {
      icon: /*#__PURE__*/_jsx(FullscreenExitOutlined, {})
    })
  }) : /*#__PURE__*/_jsx(Tooltip, {
    title: intl.getMessage('tableToolBar.fullScreen', '全屏'),
    children: /*#__PURE__*/_jsx(Button, {
      icon: /*#__PURE__*/_jsx(FullscreenOutlined, {})
    })
  });
};
export default /*#__PURE__*/React.memo(FullScreenIcon);