"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "Video", {
    enumerable: true,
    get: function() {
        return Video;
    }
});
var _interop_require_default = require("@swc/helpers/_/_interop_require_default");
var _object_spread = require("@swc/helpers/_/_object_spread");
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 _mergeprops = require("../../utils/merge-props");
var defaultProps = {
    source: {
        type: {},
        src: ''
    },
    options: {
        controls: true,
        muted: false,
        autoplay: false,
        poster: '',
        playsinline: false,
        loop: false
    }
};
var classPrefix = 'nut-video';
var Video = function Video(props) {
    var _props_options;
    var _mergeProps = (0, _mergeprops.mergeProps)(defaultProps, props), source = _mergeProps.source, options = _mergeProps.options, className = _mergeProps.className, style = _mergeProps.style, src = _mergeProps.src, muted = _mergeProps.muted, loop = _mergeProps.loop, poster = _mergeProps.poster, controls = _mergeProps.controls, autoplay = _mergeProps.autoplay, onPlay = _mergeProps.onPlay, onPause = _mergeProps.onPause, onPlayEnd = _mergeProps.onPlayEnd, restProps = (0, _object_without_properties._)(_mergeProps, [
        "source",
        "options",
        "className",
        "style",
        "src",
        "muted",
        "loop",
        "poster",
        "controls",
        "autoplay",
        "onPlay",
        "onPause",
        "onPlayEnd"
    ]);
    var classes = (0, _classnames.default)(classPrefix, className);
    var _props_options_controls, _ref;
    var effectiveControls = (_ref = (_props_options_controls = (_props_options = props.options) === null || _props_options === void 0 ? void 0 : _props_options.controls) !== null && _props_options_controls !== void 0 ? _props_options_controls : controls) !== null && _ref !== void 0 ? _ref : options.controls;
    return /*#__PURE__*/ _react.default.createElement(_components.View, {
        className: classes,
        style: style
    }, /*#__PURE__*/ _react.default.createElement(_components.Video, (0, _object_spread._)({
        className: "".concat(classPrefix, "-player"),
        muted: options.muted || muted,
        autoplay: options.autoplay || autoplay,
        loop: options.loop || loop,
        poster: options.poster || poster,
        controls: effectiveControls,
        src: source.src || src,
        onPlay: onPlay,
        onPause: onPause,
        onEnded: onPlayEnd
    }, restProps)));
};
Video.displayName = 'NutVideo';
