"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;

exports.__esModule = true;
exports.Camera = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));

var _react = _interopRequireDefault(require("react"));

var _core = require("../core");

var _excluded = ["children", "lookControls"];

function toCameraProps(_ref) {
  var far = _ref.far,
      fov = _ref.fov,
      _ref$lookControlsEnab = _ref.lookControlsEnabled,
      lookControlsEnabled = _ref$lookControlsEnab === void 0 ? true : _ref$lookControlsEnab,
      near = _ref.near,
      reverseMouseDrag = _ref.reverseMouseDrag,
      _ref$wasdControlsEnab = _ref.wasdControlsEnabled,
      wasdControlsEnabled = _ref$wasdControlsEnab === void 0 ? false : _ref$wasdControlsEnab;
  return {
    far: far,
    fov: fov,
    'look-controls-enabled': lookControlsEnabled,
    near: near,
    'reverse-mouse-drag': reverseMouseDrag,
    'wasd-controls-enabled': wasdControlsEnabled
  };
}
/**
 * The camera primitive determines what the user sees.
 * We can change the viewport by modifying the camera entity’s position and rotation.
 *
 * @see https://aframe.io/docs/1.3.0/primitives/a-camera.html
 *
 * @example
 * ```tsx
 * <Scene>
 *   <Box />
 *   <Camera />
 * </Scene>
 * ```
 */


var Camera = function Camera(props) {
  var cameraKeys = ['far', 'fov', 'lookControlsEnabled', 'near', 'reverseMouseDrag', 'wasdControlsEnabled'];
  var children = props.children,
      _props$lookControls = props.lookControls,
      lookControls = _props$lookControls === void 0 ? {
    magicWindowTrackingEnabled: false,
    reverseMouseDrag: true,
    reverseTouchDrag: true
  } : _props$lookControls,
      restProps = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
  return /*#__PURE__*/_react.default.createElement("a-camera", (0, _extends2.default)({}, (0, _core.toProps)((0, _extends2.default)({
    lookControls: lookControls
  }, restProps), cameraKeys), toCameraProps(restProps)), children);
};

exports.Camera = Camera;