const n = (t) => {
  const e = [/(?:https?:\/\/)?(?:www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9_-]+)/, /(?:https?:\/\/)?(?:www\.)?youtube\.com\/embed\/([a-zA-Z0-9_-]+)/, /(?:https?:\/\/)?(?:www\.)?youtube\.com\/v\/([a-zA-Z0-9_-]+)/, /(?:https?:\/\/)?youtu\.be\/([a-zA-Z0-9_-]+)/, /(?:https?:\/\/)?(?:www\.)?youtube\.com\/watch\?.*v=([a-zA-Z0-9_-]+)/];
  for (const u of e) {
    const o = t.match(u);
    if (o && o[1])
      return o[1];
  }
  return null;
}, r = (t) => n(t) !== null, s = (t, e) => {
  if (r(t)) {
    const u = n(t);
    return {
      src: t,
      type: "video/youtube",
      isYouTube: !0,
      youTubeId: u || void 0
    };
  }
  return {
    src: t,
    type: e || "video/mp4",
    isYouTube: !1
  };
};
export {
  n as extractYouTubeId,
  r as isYouTubeUrl,
  s as processVideoSource
};
