"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "Divider", {
    enumerable: true,
    get: function() {
        return Divider;
    }
});
var _interop_require_default = require("@swc/helpers/_/_interop_require_default");
var _define_property = require("@swc/helpers/_/_define_property");
var _object_spread = require("@swc/helpers/_/_object_spread");
var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
var _object_without_properties = require("@swc/helpers/_/_object_without_properties");
var _react = /*#__PURE__*/ _interop_require_default._(require("react"));
var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
var _components = require("@tarojs/components");
var _typings = require("../../utils/typings");
var _index = require("../configprovider/index");
var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typings.ComponentDefaults), {
    contentPosition: 'center',
    direction: 'horizontal'
});
var classPrefix = "nut-divider";
var Divider = function Divider(props) {
    var _ref = (0, _object_spread._)({}, defaultProps, props), children = _ref.children, contentPosition = _ref.contentPosition, style = _ref.style, className = _ref.className, direction = _ref.direction, rest = (0, _object_without_properties._)(_ref, [
        "children",
        "contentPosition",
        "style",
        "className",
        "direction"
    ]);
    var rtl = (0, _index.useRtl)();
    var _obj, _obj1;
    var classes = direction === 'horizontal' ? (0, _classnames.default)((_obj = {}, (0, _define_property._)(_obj, "".concat(classPrefix), true), (0, _define_property._)(_obj, "".concat(classPrefix, "-center"), children), (0, _define_property._)(_obj, "".concat(classPrefix, "-left"), contentPosition === 'left'), (0, _define_property._)(_obj, "".concat(classPrefix, "-right"), contentPosition === 'right'), (0, _define_property._)(_obj, "".concat(classPrefix, "-rtl"), ([
        'left',
        'right'
    ].includes(contentPosition) || children) && rtl), _obj)) : (0, _classnames.default)((_obj1 = {}, (0, _define_property._)(_obj1, "".concat(classPrefix), true), (0, _define_property._)(_obj1, "".concat(classPrefix, "-vertical"), direction === 'vertical'), _obj1));
    var getClassNames = function getClassNames(direction) {
        return "".concat(classes.split(' ').map(function(item) {
            return "".concat(item, "-").concat(direction);
        }).join(' '));
    };
    return /*#__PURE__*/ _react.default.createElement(_components.View, {
        className: "".concat(classes, " ").concat(className || ''),
        style: style
    }, direction === 'horizontal' && /*#__PURE__*/ _react.default.createElement(_components.View, {
        className: getClassNames('before'),
        style: style
    }), children, direction === 'horizontal' && /*#__PURE__*/ _react.default.createElement(_components.View, {
        className: getClassNames('after'),
        style: style
    }));
};
Divider.displayName = 'NutDivider';
