@brainfish-ai/components 0.9.0 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39120,36 +39120,22 @@ Vimeo.isMatch = (href) => {
39120
39120
  return regex.test(href);
39121
39121
  };
39122
39122
 
39123
+ const WISTIA_REGEXES = [
39124
+ /^(https?:\/\/)?[a-zA-Z0-9-_~]+\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)\/?(\?.*)?$/i,
39125
+ /^(https?:\/\/)?[a-zA-Z0-9-_~]+\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)\/?(\?.*)?$/i,
39126
+ /^(https?:\/\/)?[a-zA-Z0-9-_~]+\.wistia\.net\/embed\/iframe\/([a-zA-Z0-9-_~]+)\/?(\?.*)?$/i
39127
+ ];
39123
39128
  function Wistia(props) {
39124
- const extractMatches = (href) => {
39125
- const urlRegexes = [
39126
- /^https?:\/\/([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)\/?$/,
39127
- /^https?:\/\/fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)\/?$/,
39128
- /^fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)\/?$/,
39129
- /^([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)\/?$/
39130
- ];
39131
- for (const regex of urlRegexes) {
39132
- const match = href.match(regex);
39133
- if (match) return match;
39134
- }
39135
- return null;
39136
- };
39137
- const matches = extractMatches(props.attrs.href);
39129
+ const matches = WISTIA_REGEXES.find((regex) => regex.test(props.attrs.href))?.exec(props.attrs.href);
39138
39130
  if (!matches) return null;
39139
- const domain = matches[1];
39140
- const videoId = matches[2] || matches[1];
39141
- const embedUrl = domain ? `https://${domain}.wistia.com/embed/iframe/${videoId}?seo=true&videoFoam=false` : `https://fast.wistia.com/embed/iframe/${videoId}`;
39131
+ const videoId = matches[2];
39132
+ if (!videoId) return null;
39133
+ const url = new URL(props.attrs.href.startsWith("http") ? props.attrs.href : `https://${props.attrs.href}`);
39134
+ const isCustomDomain = !url.hostname.startsWith("fast.wistia.");
39135
+ const embedUrl = isCustomDomain ? `https://${url.hostname}/embed/iframe/${videoId}?seo=true&videoFoam=false` : `https://${url.hostname}/embed/iframe/${videoId}`;
39142
39136
  return /* @__PURE__ */ React.createElement(Frame, { ...props, src: embedUrl, border: true, title: `Wistia Embed (${videoId})` });
39143
39137
  }
39144
- Wistia.isMatch = (href) => {
39145
- const urlRegexes = [
39146
- /^https?:\/\/([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,
39147
- /^https?:\/\/fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,
39148
- /^fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,
39149
- /^([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i
39150
- ];
39151
- return urlRegexes.some((regex) => regex.test(href));
39152
- };
39138
+ Wistia.isMatch = (href) => WISTIA_REGEXES.some((regex) => regex.test(href));
39153
39139
 
39154
39140
  const YOUTUBE_URL_REGEX = /^(?:https?:\/\/)?(?:www\.)?(?:youtube(?:-nocookie)?\.com\/(?:watch\?v=|embed\/|v\/|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})(?:\/|[?&].*)?$/i;
39155
39141
  const extractTimestamp = (href) => {
@@ -39490,4 +39476,4 @@ const FormattedMessage = memo(({ message, isStreaming, redirectRules = [] }) =>
39490
39476
  FormattedMessage.displayName = "FormattedMessage";
39491
39477
 
39492
39478
  export { CodeBlock as C, FormattedMessage as F, MemoizedReactMarkdown as M, ZoomableImage as Z, MermaidDiagram as a, getDefaultExportFromCjs as g };
39493
- //# sourceMappingURL=FormattedMessage.aTdTW_T0.js.map
39479
+ //# sourceMappingURL=FormattedMessage.DkFftNx6.js.map