import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
import React from "react";
import classNames from "classnames";
import { Video as VideoTaro, View } from "@tarojs/components";
import { mergeProps } from "../../utils/merge-props";
var defaultProps = {
    source: {
        type: {},
        src: ''
    },
    options: {
        controls: true,
        muted: false,
        autoplay: false,
        poster: '',
        playsinline: false,
        loop: false
    }
};
var classPrefix = 'nut-video';
export var Video = function(props) {
    var _props_options;
    var _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 = _object_without_properties(_mergeProps, [
        "source",
        "options",
        "className",
        "style",
        "src",
        "muted",
        "loop",
        "poster",
        "controls",
        "autoplay",
        "onPlay",
        "onPause",
        "onPlayEnd"
    ]);
    var classes = classNames(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.createElement(View, {
        className: classes,
        style: style
    }, /*#__PURE__*/ React.createElement(VideoTaro, _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';
