{"version":3,"file":"commerce-component-register-embedded-video-register-js.602fdc257b3ece52042b.js?ssi=0","mappings":";oMAmBAA,GAAsB,EAAAC,EAAAC,YACtB,EAAKC,YAAA,aAAAC,KAAAC,GAA8CC,KACnD,MAAAC,EAAA,IACSC,EAAAC,GAAwBC,kBACxB,EAAAF,EAAAG,MAAYD,eAErB,OAA2BT,EAAAW,cAC3B,SACA,CACAN,MACA,aAAAF,GAAAG,EAAAM,WAA0DL,EAAAC,GAAwBC,cAAAG,UAClFV,WAAmB,EAAAW,EAAAC,IACnB,eACA,kFACA,iEACA,oTACA,8DACA,+EACA,uGACA,6FACA,8IACAZ,GAEAa,KAAA,YACAX,GAEsBJ,EAAAW,cAAoBK,EAAAC,EAAQ,CAAI,qBAAAf,UAAA,aAAAgB,KAAA,QAOtD,SAAAC,EAAAC,GACA,QAAAC,SAAAC,cAAA,eAAiDF,MACjD,CAwCA,SAAAG,EAAAC,GACA,MAAAC,EAAA,qEAAAC,KAAAF,GACA,OAAAC,EAAAA,EAAA,OACA,CAWA,SAAAE,EAAAH,GACA,MAAAC,EAAA,8DAAAC,KAAAF,GACA,OAAAC,EAAAA,EAAA,OACA,CAoCA,SAAAG,EAAAJ,GACA,MAAAC,EAAA,gFAAAC,KAAAF,GACA,OAAAC,EAAAA,EAAA,OACA,CACA,SAAAI,EAAAC,GACA,MAAAC,EAAAH,EAAAE,GACA,GAAAC,EACA,oCAAyCA,kBAEzC,MAAAC,EAAAT,EAAAO,GACA,GAAAE,EACA,8CAAmDA,oBAEnD,MAAAC,EAAAN,EAAAG,GACA,OAAAG,EACA,wCAAmDA,WAEnD,IACA,CACA,SAAAC,EAAAV,EAAAW,EAAA,cACA,MAAAC,EAAAZ,EAAAa,SAAA,aACA,SAAYb,IAAMY,IAAYD,GAC9B,CACA,SAAAG,GAAAlB,IACAA,EAAAmB,MACAA,EAAAC,MACAA,EAAAC,KACAA,EAAAC,UACAA,IAEA,OAAyB1C,EAAAW,cACzB,SACA,CACA4B,QACAI,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A,iFACAI,UAAA,GAEA,CACA9I,KAAA,QACAiI,aAAA,cACA3J,KAAA,SACAoK,WAAA,4GACAI,UAAA,GAEA,CACA9I,KAAA,sBACAiI,aAAA,+BACA3J,KAAA,SACAwK,UAAA","sources":["webpack://@logos/commerceweb-frontend/./node_modules/@faithlife/commerce-components/dist/chunk-355RE3FP.js","webpack://@logos/commerceweb-frontend/./node_modules/@faithlife/commerce-components/dist/chunk-QJ7P73DS.js","webpack://@logos/commerceweb-frontend/./node_modules/@faithlife/commerce-components/dist/chunk-QRK3ZKRF.js","webpack://@logos/commerceweb-frontend/javascript/node_modules/lucide-react/dist/esm/icons/circle-play.mjs","webpack://@logos/commerceweb-frontend/./node_modules/@faithlife/commerce-components/dist/chunk-VET77HDC.js"],"sourcesContent":["import {\n  AmberImage\n} from \"./chunk-AF677QN7.js\";\nimport {\n  PlayIcon\n} from \"./chunk-QRK3ZKRF.js\";\nimport {\n  commerceResourceDefaults,\n  useResources\n} from \"./chunk-A263RQU4.js\";\nimport {\n  cn\n} from \"./chunk-NZVMNINS.js\";\n\n// src/components/embedded-video/component.tsx\nimport React2, { useCallback, useEffect, useRef, useState } from \"react\";\n\n// src/components/embedded-video/video-play-button.tsx\nimport React, { forwardRef } from \"react\";\nvar VideoPlayButton = forwardRef(\n  ({ className, \"aria-label\": ariaLabel, ...props }, ref) => {\n    const resources = {\n      ...commerceResourceDefaults.embeddedVideo,\n      ...useResources().embeddedVideo\n    };\n    return /* @__PURE__ */ React.createElement(\n      \"button\",\n      {\n        ref,\n        \"aria-label\": ariaLabel ?? resources.playLabel ?? commerceResourceDefaults.embeddedVideo.playLabel,\n        className: cn(\n          \"tw-preflight\",\n          \"inline-flex size-[90px] cursor-pointer items-center justify-center rounded-full\",\n          \"border-foreground-inverse bg-surface-inverse/75 border-[1.5px]\",\n          \"shadow-[0px_4px_12px_2px_rgb(from_var(--theme-colors-primary-c500)_r_g_b_/_0.18),0px_12px_24px_0px_rgb(from_var(--theme-colors-primary-c500)_r_g_b_/_0.12),0px_22px_40px_-4px_rgb(from_var(--theme-colors-primary-c500)_r_g_b_/_0.08),0px_36px_24px_-4px_rgb(from_var(--theme-colors-primary-c500)_r_g_b_/_0.10)]\",\n          \"duration-short transition-all motion-reduce:transition-none\",\n          \"hover:border-foreground-inverse hover:bg-action-primary hover:border-[1.5px]\",\n          \"focus-visible:border-foreground-inverse focus-visible:bg-action-primary focus-visible:border-[1.5px]\",\n          \"active:border-pressed active:bg-surface-inverse/75 active:border-[3px] active:outline-none\",\n          \"disabled:border-foreground-inverse disabled:bg-surface-inverse disabled:pointer-events-none disabled:border-[1.5px] disabled:opacity-[0.33]\",\n          className\n        ),\n        type: \"button\",\n        ...props\n      },\n      /* @__PURE__ */ React.createElement(PlayIcon, { \"aria-hidden\": \"true\", className: \"text-white\", size: 32 })\n    );\n  }\n);\nVideoPlayButton.displayName = \"VideoPlayButton\";\n\n// src/components/embedded-video/component.tsx\nfunction hasScript(src) {\n  return !!document.querySelector(`script[src=\"${src}\"]`);\n}\nfunction attachPlaylistWistiaScript(playlistId) {\n  const playlistSrc = \"https://fast.wistia.com/assets/external/playlist-v1.js\";\n  if (hasScript(playlistSrc)) return;\n  const wistiaPlaylistsScript = document.createElement(\"script\");\n  wistiaPlaylistsScript.src = playlistSrc;\n  wistiaPlaylistsScript.async = false;\n  wistiaPlaylistsScript.onload = () => {\n    const playlistDetailsScript = document.createElement(\"script\");\n    playlistDetailsScript.type = \"text/javascript\";\n    playlistDetailsScript.async = false;\n    playlistDetailsScript.text = `wistiaPlaylist = Wistia.playlist(${JSON.stringify(playlistId)}, {\n        version: \"v1\",\n        theme: \"tab\",\n        videoOptions: {\n          volumeControl: true,\n          autoPlay: true,\n          videoWidth: \"640\",\n          videoHeight: \"360\",\n          inlineOptionsOnly: true,\n          version: \"v1\"\n        },\n        videoFoam: \"true\",\n        media_0_0: {\n          autoPlay: false,\n          controlsVisibleOnLoad: false\n        }\n        });`;\n    document.body.appendChild(playlistDetailsScript);\n  };\n  document.body.appendChild(wistiaPlaylistsScript);\n}\nfunction attachSingleVideoWistiaScript() {\n  const src = \"https://fast.wistia.net/assets/external/E-v1.js\";\n  if (hasScript(src)) return;\n  const script = document.createElement(\"script\");\n  script.src = src;\n  script.async = true;\n  document.body.appendChild(script);\n}\nfunction parseFaithlifeTvAssetId(url) {\n  const match = /(?:faithlifetv\\.com|tv\\.faithlife\\.com)\\/media\\/(?:assets\\/)?(\\d+)/.exec(url);\n  return match ? match[1] : null;\n}\nfunction isFaithlifeTvUrl(url) {\n  return url.includes(\"faithlifetv.com\") || url.includes(\"tv.faithlife.com\");\n}\nfunction isWistiaUrl(url) {\n  return url.includes(\"wistia\");\n}\nfunction getWistiaPlaylistId(url) {\n  const match = /playlists\\/(\\w+)/.exec(url);\n  return match ? match[1] : null;\n}\nfunction getWistiaMediaId(url) {\n  const match = /(?:wistia\\.com\\/medias\\/|wistia\\.net\\/embed\\/iframe\\/)(\\w+)/.exec(url);\n  return match ? match[1] : null;\n}\nfunction isUrl(value) {\n  return value.includes(\"://\") || value.includes(\".\");\n}\nfunction parseAmberAssetId(url) {\n  const match = /\\/assets\\/(\\d+)(?:\\/|$)/.exec(url);\n  return match ? match[1] : null;\n}\nfunction isAmberAssetUrl(url) {\n  return url.includes(\"files.logoscdn.com\") && /\\/assets\\/\\d+(?:\\/|$)/.test(url);\n}\nfunction normalizeVideoUrl(input, provider) {\n  if (!input) return input;\n  if (isUrl(input)) {\n    if (isAmberAssetUrl(input)) {\n      const assetId = parseAmberAssetId(input);\n      if (assetId) {\n        return `https://faithlifetv.com/media/assets/${assetId}`;\n      }\n    }\n    return input;\n  }\n  switch (provider) {\n    case \"youtube\":\n      return `https://www.youtube.com/embed/${input}`;\n    case \"wistia\":\n      return `https://fast.wistia.net/embed/iframe/${input}`;\n    case \"faithlifetv\":\n      return `https://faithlifetv.com/media/assets/${input}`;\n    default:\n      if (/^\\d+$/.test(input)) {\n        return `https://faithlifetv.com/media/assets/${input}`;\n      }\n      return input;\n  }\n}\nfunction getYouTubeVideoId(url) {\n  const match = /(?:youtube\\.com\\/embed\\/|youtube\\.com\\/watch\\?v=|youtu\\.be\\/)([a-zA-Z0-9_-]+)/.exec(url);\n  return match ? match[1] : null;\n}\nfunction getProviderThumbnailUrl(videoUrl) {\n  const youtubeId = getYouTubeVideoId(videoUrl);\n  if (youtubeId) {\n    return `https://img.youtube.com/vi/${youtubeId}/hqdefault.jpg`;\n  }\n  const fltvAssetId = parseFaithlifeTvAssetId(videoUrl);\n  if (fltvAssetId) {\n    return `https://files.logoscdn.com/v1/assets/${fltvAssetId}/optimized?w=640`;\n  }\n  const wistiaMediaId = getWistiaMediaId(videoUrl);\n  if (wistiaMediaId) {\n    return `https://fast.wistia.com/embed/medias/${wistiaMediaId}/swatch`;\n  }\n  return null;\n}\nfunction appendQueryParam(url, param = \"autoplay=1\") {\n  const separator = url.includes(\"?\") ? \"&\" : \"?\";\n  return `${url}${separator}${param}`;\n}\nfunction VideoIframe({\n  src,\n  allow,\n  title,\n  name,\n  scrolling\n}) {\n  return /* @__PURE__ */ React2.createElement(\n    \"iframe\",\n    {\n      allow,\n      allowFullScreen: true,\n      className: \"absolute inset-0 h-full w-full border-none\",\n      name,\n      scrolling,\n      src,\n      title\n    }\n  );\n}\nvar aspectRatioClasses = {\n  \"16:9\": \"aspect-[16/9]\",\n  \"4:3\": \"aspect-[4/3]\",\n  \"1:1\": \"aspect-square\",\n  \"21:9\": \"aspect-[21/9]\"\n};\nvar aspectRatioValues = {\n  \"16:9\": [16, 9],\n  \"4:3\": [4, 3],\n  \"1:1\": [1, 1],\n  \"21:9\": [21, 9]\n};\nfunction EmbeddedVideo({\n  videoUrl: videoUrlInput = \"\",\n  provider,\n  coverImage,\n  aspectRatio = \"16:9\",\n  thumbnailSizes = { mobile: \"100vw\" },\n  autoplayTrigger = \"none\",\n  muted = false,\n  className,\n  \"data-testid\": testId,\n  title,\n  playButtonAriaLabel,\n  showRatingPrompt = false,\n  playButtonClassName\n}) {\n  const resources = {\n    ...commerceResourceDefaults.embeddedVideo,\n    ...useResources().embeddedVideo\n  };\n  const resolvedTitle = title ?? resources.title ?? commerceResourceDefaults.embeddedVideo.title;\n  const resolvedPlayButtonAriaLabel = playButtonAriaLabel ?? resources.playLabel ?? commerceResourceDefaults.embeddedVideo.playLabel;\n  const [isPlaying, setIsPlaying] = useState(false);\n  const containerRef = useRef(null);\n  const videoUrl = normalizeVideoUrl(videoUrlInput, provider);\n  const isFltv = isFaithlifeTvUrl(videoUrl);\n  const fltvAssetId = isFltv ? parseFaithlifeTvAssetId(videoUrl) : null;\n  const isWistia = isWistiaUrl(videoUrl);\n  const wistiaPlaylistId = isWistia ? getWistiaPlaylistId(videoUrl) : null;\n  const effectiveAutoplayTrigger = isFltv ? \"none\" : autoplayTrigger;\n  const autoplayActive = effectiveAutoplayTrigger !== \"none\";\n  const effectiveMuted = muted || autoplayActive;\n  const allowAttribute = isPlaying ? \"fullscreen;autoplay\" : \"fullscreen\";\n  useEffect(() => {\n    if (!isWistia || !isPlaying) return;\n    if (wistiaPlaylistId) {\n      attachPlaylistWistiaScript(wistiaPlaylistId);\n    } else {\n      attachSingleVideoWistiaScript();\n    }\n  }, [isWistia, isPlaying, wistiaPlaylistId]);\n  useEffect(() => {\n    if (effectiveAutoplayTrigger !== \"scroll\" || !containerRef.current) return;\n    const observer = new IntersectionObserver(\n      ([entry]) => {\n        setIsPlaying(entry.isIntersecting);\n      },\n      { threshold: 0.5 }\n    );\n    observer.observe(containerRef.current);\n    return () => {\n      observer.disconnect();\n    };\n  }, [effectiveAutoplayTrigger]);\n  const handlePlay = useCallback(() => {\n    setIsPlaying(true);\n  }, []);\n  const handleMouseEnter = useCallback(() => {\n    if (effectiveAutoplayTrigger === \"hover\") {\n      setIsPlaying(true);\n    }\n  }, [effectiveAutoplayTrigger]);\n  const handleMouseLeave = useCallback(() => {\n    if (effectiveAutoplayTrigger === \"hover\") {\n      setIsPlaying(false);\n    }\n  }, [effectiveAutoplayTrigger]);\n  if (!videoUrl) return null;\n  const thumbnailSrc = typeof coverImage === \"string\" ? coverImage || getProviderThumbnailUrl(videoUrl) : !coverImage ? getProviderThumbnailUrl(videoUrl) : null;\n  let videoMarkup;\n  if (isFltv && fltvAssetId) {\n    const fltvSrc = `https://tv.faithlife.com/media/assets/${fltvAssetId}?embedded=1${isPlaying ? \"&autoplay=1\" : \"\"}${showRatingPrompt ? \"\" : \"&noRating=1\"}`;\n    videoMarkup = /* @__PURE__ */ React2.createElement(VideoIframe, { allow: allowAttribute, scrolling: \"no\", src: fltvSrc, title: resolvedTitle });\n  } else if (wistiaPlaylistId) {\n    videoMarkup = /* @__PURE__ */ React2.createElement(\n      \"div\",\n      {\n        className: \"absolute inset-0\",\n        \"data-video-height\": \"360\",\n        \"data-video-width\": \"640\",\n        id: `wistia_${wistiaPlaylistId}`\n      },\n      \"\\xA0\"\n    );\n  } else if (isWistia) {\n    const wistiaMediaId = getWistiaMediaId(videoUrl);\n    const wistiaEmbedUrl = wistiaMediaId ? `https://fast.wistia.net/embed/iframe/${wistiaMediaId}` : videoUrl;\n    let wistiaSrc = isPlaying ? appendQueryParam(wistiaEmbedUrl, \"autoPlay=true\") : wistiaEmbedUrl;\n    if (effectiveMuted) {\n      wistiaSrc = appendQueryParam(wistiaSrc, \"muted=true\");\n    }\n    videoMarkup = /* @__PURE__ */ React2.createElement(\n      VideoIframe,\n      {\n        allow: allowAttribute,\n        name: \"wistia_embed\",\n        src: wistiaSrc,\n        title: resolvedTitle\n      }\n    );\n  } else {\n    const youtubeId = getYouTubeVideoId(videoUrl);\n    const embedUrl = youtubeId ? `https://www.youtube.com/embed/${youtubeId}` : videoUrl;\n    let iframeSrc = isPlaying ? appendQueryParam(embedUrl) : embedUrl;\n    if (effectiveMuted) {\n      iframeSrc = appendQueryParam(iframeSrc, \"mute=1\");\n    }\n    videoMarkup = /* @__PURE__ */ React2.createElement(VideoIframe, { allow: allowAttribute, src: iframeSrc, title: resolvedTitle });\n  }\n  return /* @__PURE__ */ React2.createElement(\n    \"div\",\n    {\n      ref: containerRef,\n      className: cn(\n        \"tw-preflight bg-surface-media relative overflow-hidden\",\n        aspectRatioClasses[aspectRatio],\n        className\n      ),\n      \"data-testid\": testId,\n      onMouseEnter: handleMouseEnter,\n      onMouseLeave: handleMouseLeave\n    },\n    isPlaying ? videoMarkup : /* @__PURE__ */ React2.createElement(\n      \"div\",\n      {\n        \"aria-label\": resolvedPlayButtonAriaLabel,\n        className: \"absolute inset-0 cursor-pointer\",\n        onClick: handlePlay,\n        onKeyDown: (e) => {\n          if (e.key === \"Enter\" || e.key === \" \") {\n            e.preventDefault();\n            handlePlay();\n          }\n        },\n        role: \"button\",\n        tabIndex: 0\n      },\n      typeof coverImage !== \"string\" && coverImage ? coverImage : thumbnailSrc && /* @__PURE__ */ React2.createElement(\n        AmberImage,\n        {\n          alt: \"\",\n          className: \"absolute inset-0 h-full w-full\",\n          height: 360,\n          objectFit: \"cover\" /* Cover */,\n          sizes: thumbnailSizes,\n          src: thumbnailSrc,\n          targetAspectRatio: aspectRatioValues[aspectRatio],\n          width: 640\n        }\n      ),\n      /* @__PURE__ */ React2.createElement(\n        \"div\",\n        {\n          className: cn(\"absolute inset-0 flex items-center justify-center\", playButtonClassName)\n        },\n        /* @__PURE__ */ React2.createElement(VideoPlayButton, { \"aria-hidden\": \"true\", tabIndex: -1 })\n      )\n    )\n  );\n}\n\nexport {\n  VideoPlayButton,\n  EmbeddedVideo\n};\n//# sourceMappingURL=chunk-355RE3FP.js.map","// src/config/storybook.ts\nvar STORYBOOK_BASE_URL = \"https://storybook.commercecomponents.logos.com\";\nfunction getStorybookDocsUrl(storyId) {\n  return `${STORYBOOK_BASE_URL}/?path=/story/${storyId}`;\n}\nfunction getStorybookDocsUrlForTier(tier, name, story = \"default\") {\n  const storySlug = story.toLowerCase().replace(/\\s+/g, \"-\");\n  return getStorybookDocsUrl(`${tier}-${name}--${storySlug}`);\n}\nfunction getStorybookDocsUrlForComponent(component, story = \"default\") {\n  return getStorybookDocsUrlForTier(\"components\", component, story);\n}\nfunction getStorybookDocsUrlForOrganism(organism, story = \"default\") {\n  return getStorybookDocsUrlForTier(\"organisms\", organism, story);\n}\nfunction getStorybookDocsUrlForMolecule(molecule, story = \"default\") {\n  return getStorybookDocsUrlForTier(\"molecules\", molecule, story);\n}\nfunction getStorybookDocsUrlForAtom(atom, story = \"default\") {\n  return getStorybookDocsUrlForTier(\"atoms\", atom, story);\n}\n\nexport {\n  getStorybookDocsUrl,\n  getStorybookDocsUrlForComponent,\n  getStorybookDocsUrlForOrganism,\n  getStorybookDocsUrlForMolecule,\n  getStorybookDocsUrlForAtom\n};\n//# sourceMappingURL=chunk-QJ7P73DS.js.map","import {\n  Icon,\n  selectIconVariant\n} from \"./chunk-5AEEBCQE.js\";\n\n// src/icons/media/play-icon.tsx\nimport React from \"react\";\nvar VARIANTS = {\n  \"12\": { paths: [\"M11.9561 6L1 12V0L11.9561 6Z\"], viewBox: \"0 0 12 12\" },\n  \"16\": { paths: [\"M15.6084 8L1 16V0L15.6084 8Z\"], viewBox: \"0 0 16 16\" },\n  \"24\": { paths: [\"M23.957 12L2.04395 24V0L23.957 12Z\"], viewBox: \"0 0 24 24\" },\n  \"32\": { paths: [\"M32.2178 16L3 32V0L32.2178 16Z\"], viewBox: \"0 0 33 32\" }\n};\nfunction PlayIcon({ size = 24, ...props }) {\n  const { paths, viewBox } = selectIconVariant(VARIANTS, typeof size === \"number\" ? size : 24);\n  return /* @__PURE__ */ React.createElement(Icon, { size, viewBox, ...props }, paths.map((d, i) => /* @__PURE__ */ React.createElement(\"path\", { key: i, d, fill: \"currentColor\" })));\n}\n\nexport {\n  PlayIcon\n};\n//# sourceMappingURL=chunk-QRK3ZKRF.js.map","/**\n * @license lucide-react v1.27.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n  [\n    \"path\",\n    {\n      d: \"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z\",\n      key: \"kmsa83\"\n    }\n  ],\n  [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }]\n];\nconst CirclePlay = createLucideIcon(\"circle-play\", __iconNode);\n\nexport { __iconNode, CirclePlay as default };\n//# sourceMappingURL=circle-play.mjs.map\n","import {\n  EmbeddedVideo\n} from \"./chunk-355RE3FP.js\";\nimport {\n  lucideIconUri\n} from \"./chunk-BEFWWR2C.js\";\nimport {\n  getStorybookDocsUrlForComponent\n} from \"./chunk-QJ7P73DS.js\";\n\n// src/components/embedded-video/register.tsx\nimport { Builder } from \"@builder.io/react\";\nimport { CirclePlay } from \"lucide-react\";\nvar registerComponent = () => {\n  Builder.registerComponent(EmbeddedVideo, {\n    name: \"EmbeddedVideo\",\n    friendlyName: \"Embedded Video\",\n    docsLink: getStorybookDocsUrlForComponent(\"embedded-video\"),\n    image: lucideIconUri(CirclePlay),\n    inputs: [\n      {\n        name: \"videoUrl\",\n        friendlyName: \"Video URL or ID\",\n        type: \"string\",\n        required: true,\n        helperText: \"The URL or video ID. When using a bare ID, set the Provider field so the correct embed URL is generated.\"\n      },\n      {\n        name: \"provider\",\n        friendlyName: \"Provider\",\n        type: \"string\",\n        enum: [\n          { label: \"YouTube\", value: \"youtube\" },\n          { label: \"Wistia\", value: \"wistia\" },\n          { label: \"Amber / Faithlife TV\", value: \"faithlifetv\" }\n        ],\n        helperText: \"Required when Video URL is a bare ID instead of a full URL. Numeric-only IDs default to Amber / Faithlife TV. Full Amber asset URLs (files.logoscdn.com) are detected automatically and do not require setting this field.\"\n      },\n      {\n        name: \"coverImage\",\n        friendlyName: \"Cover Image\",\n        type: \"string\",\n        helperText: \"Amber asset ID or image URL to use as the cover image. YouTube, Wistia, and Faithlife TV thumbnails are used automatically when no value is provided. Setting this field overrides the auto-detected thumbnail.\"\n      },\n      {\n        name: \"aspectRatio\",\n        friendlyName: \"Aspect Ratio\",\n        type: \"string\",\n        enum: [\"16:9\", \"4:3\", \"1:1\", \"21:9\"],\n        defaultValue: \"16:9\",\n        helperText: \"The aspect ratio of the video player.\"\n      },\n      {\n        name: \"autoplayTrigger\",\n        friendlyName: \"Autoplay Trigger\",\n        type: \"string\",\n        enum: [\"none\", \"scroll\", \"hover\"],\n        defaultValue: \"none\",\n        helperText: 'How the video starts playing automatically. \"scroll\" plays when visible in the viewport, \"hover\" plays on mouse enter and pauses on leave. Video is automatically muted to satisfy browser autoplay policies. Supported for YouTube and Wistia only; Faithlife TV does not support autoplay.',\n        advanced: true\n      },\n      {\n        name: \"muted\",\n        friendlyName: \"Muted\",\n        type: \"boolean\",\n        defaultValue: false,\n        helperText: \"Start the video muted. Automatically enabled when an autoplay trigger is set. Has no effect on Faithlife TV embeds.\",\n        advanced: true\n      },\n      {\n        name: \"showRatingPrompt\",\n        friendlyName: \"Show Rating Prompt\",\n        type: \"boolean\",\n        defaultValue: false,\n        helperText: \"Show the Faithlife TV post-video rating prompt. No effect for other providers.\",\n        advanced: true\n      },\n      {\n        name: \"title\",\n        friendlyName: \"Video Title\",\n        type: \"string\",\n        helperText: 'Descriptive title announced to assistive technology for the video iframe (e.g. \"Product overview video\").',\n        advanced: true\n      },\n      {\n        name: \"playButtonAriaLabel\",\n        friendlyName: \"Play Button Accessible Label\",\n        type: \"string\",\n        advanced: true\n      }\n    ]\n  });\n};\n\nexport {\n  registerComponent\n};\n//# sourceMappingURL=chunk-VET77HDC.js.map"],"names":["VideoPlayButton","react__WEBPACK_IMPORTED_MODULE_4__","forwardRef","className","ariaLabel","props","ref","resources","_chunk_A263RQU4_js__WEBPACK_IMPORTED_MODULE_2__","SS","embeddedVideo","fn","createElement","playLabel","_chunk_NZVMNINS_js__WEBPACK_IMPORTED_MODULE_3__","cn","type","_chunk_QRK3ZKRF_js__WEBPACK_IMPORTED_MODULE_1__","u","size","hasScript","src","document","querySelector","parseFaithlifeTvAssetId","url","match","exec","getWistiaMediaId","getYouTubeVideoId","getProviderThumbnailUrl","videoUrl","youtubeId","fltvAssetId","wistiaMediaId","appendQueryParam","param","separator","includes","VideoIframe","allow","title","name","scrolling","allowFullScreen","displayName","aspectRatioClasses","aspectRatioValues","EmbeddedVideo","videoUrlInput","provider","coverImage","aspectRatio","thumbnailSizes","mobile","autoplayTrigger","muted","testId","playButtonAriaLabel","showRatingPrompt","playButtonClassName","resolvedTitle","resolvedPlayButtonAriaLabel","isPlaying","setIsPlaying","useState","containerRef","useRef","input","value","test","assetId","parseAmberAssetId","normalizeVideoUrl","isFltv","isWistia","isWistiaUrl","wistiaPlaylistId","getWistiaPlaylistId","effectiveAutoplayTrigger","effectiveMuted","allowAttribute","useEffect","playlistId","playlistSrc","wistiaPlaylistsScript","async","onload","playlistDetailsScript","text","JSON","stringify","body","appendChild","attachPlaylistWistiaScript","script","attachSingleVideoWistiaScript","current","observer","IntersectionObserver","entry","isIntersecting","threshold","observe","disconnect","handlePlay","useCallback","handleMouseEnter","handleMouseLeave","thumbnailSrc","videoMarkup","fltvSrc","id","wistiaEmbedUrl","wistiaSrc","embedUrl","iframeSrc","onMouseEnter","onMouseLeave","onClick","onKeyDown","e","key","preventDefault","role","tabIndex","_chunk_AF677QN7_js__WEBPACK_IMPORTED_MODULE_0__","d_","alt","height","objectFit","sizes","targetAspectRatio","width","getStorybookDocsUrl","storyId","getStorybookDocsUrlForTier","tier","story","toLowerCase","replace","getStorybookDocsUrlForComponent","component","getStorybookDocsUrlForOrganism","organism","getStorybookDocsUrlForMolecule","molecule","getStorybookDocsUrlForAtom","atom","VARIANTS","paths","viewBox","PlayIcon","_chunk_5AEEBCQE_js__WEBPACK_IMPORTED_MODULE_0__","z","react__WEBPACK_IMPORTED_MODULE_1__","I","map","d","i","fill","CirclePlay","A","cx","cy","r","registerComponent","builder_react_es5","M$","chunk_355RE3FP","E","friendlyName","docsLink","chunk_QJ7P73DS","dq","image","chunk_BEFWWR2C","c","inputs","required","helperText","enum","label","defaultValue","advanced"],"sourceRoot":""}