"use strict";

exports.__esModule = true;
exports.default = void 0;
var _react = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _blur = require("@react-native-community/blur");
var _novaIcons = require("@coorpacademy/nova-icons");
var _templateContext = require("../../template/app-review/template-context");
var _index = _interopRequireDefault(require("../../hoc/touchable/index.native"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
const createStyleSheet = theme => _reactNative.StyleSheet.create({
  container: {
    position: 'absolute',
    bottom: 0,
    paddingTop: 10,
    paddingBottom: 34,
    paddingHorizontal: 20,
    width: '100%',
    shadowColor: '#000',
    shadowOffset: {
      width: 0,
      height: 2
    },
    shadowOpacity: 0.15,
    shadowRadius: 3,
    elevation: 4
  },
  blur: {
    position: 'absolute',
    top: 0,
    bottom: 0,
    left: 0,
    right: 0
  },
  navbar: {
    flexDirection: 'row',
    justifyContent: 'space-between',
    alignSelf: 'center',
    overflow: 'hidden',
    height: 66,
    borderRadius: 12,
    backgroundColor: _reactNative.Platform.OS === 'ios' ? theme.colors.gray.light : '#edededee'
  },
  button: {
    alignItems: 'center',
    flex: 1,
    height: '100%',
    maxWidth: 110,
    marginTop: theme.spacing.small
  },
  buttonText: {
    fontSize: theme.fontSize.small,
    lineHeight: 26,
    // height: 11,
    color: theme.colors.text.primary
  },
  dot: {
    width: 8,
    height: 8,
    borderRadius: 8,
    backgroundColor: theme.colors.cta,
    marginTop: 3,
    position: 'absolute',
    alignSelf: 'center'
  },
  dotShadow: {
    marginTop: -87,
    width: 200,
    height: 100,
    position: 'absolute',
    alignSelf: 'center',
    transform: [{
      rotateX: '180deg'
    }, {
      scaleX: 0.7
    }]
  }
});
const Button = ({
  testID,
  title,
  selected,
  Icon,
  styles,
  theme,
  onPress
}) => /*#__PURE__*/_react.default.createElement(_index.default, {
  testID: testID,
  style: styles.button,
  onPress: onPress
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
  style: {
    alignItems: 'center'
  }
}, /*#__PURE__*/_react.default.createElement(Icon, {
  height: 16,
  width: 16,
  color: selected ? theme.colors.cta : theme.colors.text.primary
}), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
  style: styles.buttonText
}, title)), selected ? /*#__PURE__*/_react.default.createElement(_reactNative.View, null, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
  style: styles.dot
}), /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionNavigationNavBar, {
  color: theme.colors.cta,
  style: styles.dotShadow
})) : null);
const NavigationBar = ({
  items,
  selectedItemIndex
}) => {
  const templateContext = (0, _templateContext.useTemplateContext)();
  const [styleSheet, setStylesheet] = (0, _react.useState)(null);
  const {
    theme
  } = templateContext;
  (0, _react.useEffect)(() => {
    const _stylesheet = createStyleSheet(theme);
    setStylesheet(_stylesheet);
  }, [theme]);
  if (!styleSheet) {
    return null;
  }
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: styleSheet.container
  }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: styleSheet.navbar
  }, _reactNative.Platform.OS === 'ios' ? /*#__PURE__*/_react.default.createElement(_blur.BlurView, {
    style: styleSheet.blur,
    blurAmount: 75,
    blurType: "xlight"
  }) : null, items.map((prop, index) => {
    const handlePress = prop.action;
    return /*#__PURE__*/_react.default.createElement(Button, {
      key: `button-${prop.label}`,
      title: prop.label,
      Icon: prop.icon,
      onPress: handlePress,
      selected: index === selectedItemIndex,
      testID: `navigationButton_${index}`,
      styles: styleSheet,
      theme: theme
    });
  })));
};
var _default = exports.default = NavigationBar;
//# sourceMappingURL=index.native.js.map