import { defineComponent, useAttrs, ref, createElementBlock, openBlock, mergeProps, unref, createElementVNode, createTextVNode } from 'vue';
import '../../../utils/index.mjs';
import { audioPlayerProps } from './audio-player.mjs';
import { createNamespace } from '../../../utils/create-namespace.mjs';

"use strict";
const _hoisted_1 = ["src", "autoplay", "loop", "preload", "muted", "controls"];
const _hoisted_2 = ["src", "type"];
var _sfc_main = /* @__PURE__ */ defineComponent({
  ...{ name: "LlAudioPlayer" },
  __name: "audio-player",
  props: audioPlayerProps,
  setup(__props) {
    const attrs = useAttrs();
    const bem = createNamespace("audio-player");
    const audioElement = ref();
    const audioTypeMap = {
      MP3: "audio/mpeg",
      OGG: "audio/ogg",
      AAC: "audio/aac",
      WAV: "audio/wav",
      WMA: "audio/x-ms-wma",
      WEBM: "audio/webm",
      FLAC: "audio/flac",
      ALAC: "audio/alac",
      AMR: "audio/amr",
      MIDI: "audio/midi"
    };
    const getType = (format) => {
      return audioTypeMap[format.toUpperCase()] || "audio/mpeg";
    };
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("audio", mergeProps({
        ref_key: "audioElement",
        ref: audioElement
      }, unref(attrs), {
        class: [unref(bem).b()],
        src: _ctx.src,
        autoplay: _ctx.autoplay,
        loop: _ctx.loop,
        preload: _ctx.preload,
        muted: _ctx.muted,
        controls: _ctx.controls
      }), [
        createElementVNode("source", {
          src: _ctx.src,
          type: getType(_ctx.format)
        }, null, 8, _hoisted_2),
        _cache[0] || (_cache[0] = createTextVNode(
          " \u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u97F3\u9891\u64AD\u653E\u3002 ",
          -1
          /* CACHED */
        ))
      ], 16, _hoisted_1);
    };
  }
});

export { _sfc_main as default };
//# sourceMappingURL=audio-player.vue2.mjs.map
