@epic-web/workshop-app 6.71.0 → 6.71.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.
Files changed (41) hide show
  1. package/build/client/assets/{_exerciseNumber-DgMb13KP.js → _exerciseNumber-DOydVFcz.js} +2 -2
  2. package/build/client/assets/{_exerciseNumber-DgMb13KP.js.map → _exerciseNumber-DOydVFcz.js.map} +1 -1
  3. package/build/client/assets/{_exerciseNumber_.finished-DkAs61X_.js → _exerciseNumber_.finished-OYmKydkm.js} +2 -2
  4. package/build/client/assets/{_exerciseNumber_.finished-DkAs61X_.js.map → _exerciseNumber_.finished-OYmKydkm.js.map} +1 -1
  5. package/build/client/assets/{_extra-fwsy2qkP.js → _extra-DAAdPX1Q.js} +2 -2
  6. package/build/client/assets/{_extra-fwsy2qkP.js.map → _extra-DAAdPX1Q.js.map} +1 -1
  7. package/build/client/assets/_layout-61ByrjB1.js +2 -0
  8. package/build/client/assets/_layout-61ByrjB1.js.map +1 -0
  9. package/build/client/assets/{_layout-DR0LQ06M.js → _layout-CeuWC4em.js} +2 -2
  10. package/build/client/assets/{_layout-DR0LQ06M.js.map → _layout-CeuWC4em.js.map} +1 -1
  11. package/build/client/assets/{diff-DC-wn6-x.js → diff-CLewaNfR.js} +2 -2
  12. package/build/client/assets/{diff-DC-wn6-x.js.map → diff-CLewaNfR.js.map} +1 -1
  13. package/build/client/assets/{diff-BhWzqoVN.js → diff-DrdM1MAZ.js} +2 -2
  14. package/build/client/assets/{diff-BhWzqoVN.js.map → diff-DrdM1MAZ.js.map} +1 -1
  15. package/build/client/assets/{epic-video-8Hv_HMMr.js → epic-video-BO6oqwle.js} +2 -2
  16. package/build/client/assets/{epic-video-8Hv_HMMr.js.map → epic-video-BO6oqwle.js.map} +1 -1
  17. package/build/client/assets/{epic-video-D0drHmgC.js → epic-video-Ca_s42j5.js} +2 -2
  18. package/build/client/assets/{epic-video-D0drHmgC.js.map → epic-video-Ca_s42j5.js.map} +1 -1
  19. package/build/client/assets/{finished-CiVHAeSV.js → finished-CqdoWQ9b.js} +2 -2
  20. package/build/client/assets/{finished-CiVHAeSV.js.map → finished-CqdoWQ9b.js.map} +1 -1
  21. package/build/client/assets/{index-C_wcF1aP.js → index-BHfJ4hna.js} +2 -2
  22. package/build/client/assets/{index-C_wcF1aP.js.map → index-BHfJ4hna.js.map} +1 -1
  23. package/build/client/assets/{index-hhQHCvb9.js → index-BRVfMMSd.js} +2 -2
  24. package/build/client/assets/{index-hhQHCvb9.js.map → index-BRVfMMSd.js.map} +1 -1
  25. package/build/client/assets/{index-BKAVQvm5.js → index-o922xZRF.js} +2 -2
  26. package/build/client/assets/{index-BKAVQvm5.js.map → index-o922xZRF.js.map} +1 -1
  27. package/build/client/assets/{manifest-970c9ad1.js → manifest-49708768.js} +1 -1
  28. package/build/client/assets/{mdx-BzyhMqFg.js → mdx-BGwe7vvs.js} +2 -2
  29. package/build/client/assets/{mdx-BzyhMqFg.js.map → mdx-BGwe7vvs.js.map} +1 -1
  30. package/build/client/assets/{root-Bktp3RtN.js → root-BwuJUAM7.js} +2 -2
  31. package/build/client/assets/{root-Bktp3RtN.js.map → root-BwuJUAM7.js.map} +1 -1
  32. package/build/client/assets/{tailwind-B97VvnKU.css → tailwind-C1_1LEqo.css} +1 -1
  33. package/build/client/assets/{test-DtQCjBBX.js → test-CvHPFyBI.js} +2 -2
  34. package/build/client/assets/{test-DtQCjBBX.js.map → test-CvHPFyBI.js.map} +1 -1
  35. package/build/client/assets/{tests-fDISNsE-.js → tests-DlDV-wXQ.js} +2 -2
  36. package/build/client/assets/{tests-fDISNsE-.js.map → tests-DlDV-wXQ.js.map} +1 -1
  37. package/build/server/index.js +16 -10
  38. package/build/server/index.js.map +1 -1
  39. package/package.json +3 -3
  40. package/build/client/assets/_layout-BQ8VYaze.js +0 -2
  41. package/build/client/assets/_layout-BQ8VYaze.js.map +0 -1
@@ -3382,5 +3382,5 @@ media-poster-image:not([src]):not([placeholdersrc]) {
3382
3382
  >`:""}
3383
3383
  </p>`:""}
3384
3384
  `}return S2(i)};function I2(i){var e,t;let s=i.theme;if(s){let r=(t=(e=i.getRootNode())==null?void 0:e.getElementById)==null?void 0:t.call(e,s);if(r&&r instanceof HTMLTemplateElement)return r;s.startsWith("media-theme-")||(s=`media-theme-${s}`);let n=zi.customElements.get(s);if(n!=null&&n.template)return n.template}}function x2(i){var e;let t=(e=i.mediaController)==null?void 0:e.querySelector("media-time-display");return t&&getComputedStyle(t).getPropertyValue("--media-duration-display-display").trim()==="none"}function xv(i){let e=i.videoTitle?{video_title:i.videoTitle}:{};return i.getAttributeNames().filter(t=>t.startsWith("metadata-")).reduce((t,s)=>{let r=i.getAttribute(s);return r!==null&&(t[s.replace(/^metadata-/,"").replace(/-/g,"_")]=r),t},e)}var L2=Object.values(C),R2=Object.values(cs),k2=Object.values(U),Lv=E_(),Rv="mux-player",kv={isDialogOpen:!1},D2={redundant_streams:!0},Ld,Rd,kd,mr,Dd,qn,Qe,$s,I_,Xf,pr,Dv,Cv,wv,Mv,C2=class extends bv{constructor(){super(),Ti(this,Qe),Ti(this,Ld),Ti(this,Rd,!1),Ti(this,kd,{}),Ti(this,mr,!0),Ti(this,Dd,new jO(this,"hotkeys")),Ti(this,qn,{...kv,onCloseErrorDialog:i=>{var e;((e=i.composedPath()[0])==null?void 0:e.localName)==="media-error-dialog"&&at(this,Qe,Xf).call(this,{isDialogOpen:!1})},onFocusInErrorDialog:i=>{var e;((e=i.composedPath()[0])==null?void 0:e.localName)==="media-error-dialog"&&(g_(this,Eu.activeElement)||i.preventDefault())}}),is(this,Ld,ap()),this.attachShadow({mode:"open"}),at(this,Qe,I_).call(this),this.isConnected&&at(this,Qe,$s).call(this)}static get NAME(){return Rv}static get VERSION(){return Lv}static get observedAttributes(){var i;return[...(i=bv.observedAttributes)!=null?i:[],...R2,...L2,...k2]}get mediaTheme(){var i;return(i=this.shadowRoot)==null?void 0:i.querySelector("media-theme")}get mediaController(){var i,e;return(e=(i=this.mediaTheme)==null?void 0:i.shadowRoot)==null?void 0:e.querySelector("media-controller")}connectedCallback(){let i=this.media;i&&(i.metadata=xv(this))}attributeChangedCallback(i,e,t){switch(at(this,Qe,$s).call(this),super.attributeChangedCallback(i,e,t),i){case U.HOTKEYS:De(this,Dd).value=t;break;case U.THUMBNAIL_TIME:{t!=null&&this.tokens.thumbnail&&ps(re("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").toString());break}case U.THUMBNAIL_TOKEN:{if(t){let s=Bn(t);if(s){let{aud:r}=s,n=Za.THUMBNAIL;r!==n&&ps(re("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:r,expectedAud:n,tokenNamePrefix:"thumbnail"}))}}break}case U.STORYBOARD_TOKEN:{if(t){let s=Bn(t);if(s){let{aud:r}=s,n=Za.STORYBOARD;r!==n&&ps(re("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:r,expectedAud:n,tokenNamePrefix:"storyboard"}))}}break}case U.DRM_TOKEN:{if(t){let s=Bn(t);if(s){let{aud:r}=s,n=Za.DRM;r!==n&&ps(re("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:r,expectedAud:n,tokenNamePrefix:"drm"}))}}break}case C.PLAYBACK_ID:{t!=null&&t.includes("?token")&&ai(re("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:t}));break}case C.STREAM_TYPE:{t&&![ke.LIVE,ke.ON_DEMAND,ke.UNKNOWN].includes(t)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=t.includes("dvr")?Number.POSITIVE_INFINITY:0:b_({file:"invalid-stream-type.md",message:re("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):t===ke.LIVE?this.getAttribute(U.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN;break}case U.FULLSCREEN_ELEMENT:{if(t!=null||t!==e){let s=Eu.getElementById(t),r=s?.querySelector("mux-player");this.mediaController&&s&&r&&(this.mediaController.fullscreenElement=s)}break}}[C.PLAYBACK_ID,cs.SRC,U.PLAYBACK_TOKEN].includes(i)&&e!==t&&is(this,qn,{...De(this,qn),...kv}),at(this,Qe,pr).call(this,{[YO(i)]:t})}async requestFullscreen(i){var e;if(!(!this.mediaController||this.mediaController.hasAttribute(_.MEDIA_IS_FULLSCREEN)))return(e=this.mediaController)==null||e.dispatchEvent(new zi.CustomEvent(z.MEDIA_ENTER_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((t,s)=>{var r;(r=this.mediaController)==null||r.addEventListener(ys.MEDIA_IS_FULLSCREEN,()=>t(),{once:!0})})}async exitFullscreen(){var i;if(!(!this.mediaController||!this.mediaController.hasAttribute(_.MEDIA_IS_FULLSCREEN)))return(i=this.mediaController)==null||i.dispatchEvent(new zi.CustomEvent(z.MEDIA_EXIT_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((e,t)=>{var s;(s=this.mediaController)==null||s.addEventListener(ys.MEDIA_IS_FULLSCREEN,()=>e(),{once:!0})})}get preferCmcd(){var i;return(i=this.getAttribute(C.PREFER_CMCD))!=null?i:void 0}set preferCmcd(i){i!==this.preferCmcd&&(i?nu.includes(i)?this.setAttribute(C.PREFER_CMCD,i):ps(`Invalid value for preferCmcd. Must be one of ${nu.join()}`):this.removeAttribute(C.PREFER_CMCD))}get hasPlayed(){var i,e;return(e=(i=this.mediaController)==null?void 0:i.hasAttribute(_.MEDIA_HAS_PLAYED))!=null?e:!1}get inLiveWindow(){var i;return(i=this.mediaController)==null?void 0:i.hasAttribute(_.MEDIA_TIME_IS_LIVE)}get _hls(){var i;return(i=this.media)==null?void 0:i._hls}get mux(){var i;return(i=this.media)==null?void 0:i.mux}get theme(){var i;return(i=this.getAttribute(U.THEME))!=null?i:_2}set theme(i){this.setAttribute(U.THEME,`${i}`)}get themeProps(){let i=this.mediaTheme;if(!i)return;let e={};for(let t of i.getAttributeNames()){if(Qf.includes(t))continue;let s=i.getAttribute(t);e[m_(t)]=s===""?!0:s}return e}set themeProps(i){var e,t;at(this,Qe,$s).call(this);let s={...this.themeProps,...i};for(let r in s){if(Qf.includes(r))continue;let n=i?.[r];typeof n=="boolean"||n==null?(e=this.mediaTheme)==null||e.toggleAttribute(jf(r),!!n):(t=this.mediaTheme)==null||t.setAttribute(jf(r),n)}}get playbackId(){var i;return(i=this.getAttribute(C.PLAYBACK_ID))!=null?i:void 0}set playbackId(i){i?this.setAttribute(C.PLAYBACK_ID,i):this.removeAttribute(C.PLAYBACK_ID)}get src(){var i,e;return this.playbackId?(i=nr(this,cs.SRC))!=null?i:void 0:(e=this.getAttribute(cs.SRC))!=null?e:void 0}set src(i){i?this.setAttribute(cs.SRC,i):this.removeAttribute(cs.SRC)}get poster(){var i;let e=this.getAttribute(cs.POSTER);if(e!=null)return e;let{tokens:t}=this;if(t.playback&&!t.thumbnail){ps("Missing expected thumbnail token. No poster image will be shown");return}if(this.playbackId&&!this.audio)return VO(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(i=this.thumbnailTime)!=null?i:this.startTime,programTime:this.programStartTime,token:t.thumbnail})}set poster(i){i||i===""?this.setAttribute(cs.POSTER,i):this.removeAttribute(cs.POSTER)}get storyboardSrc(){var i;return(i=this.getAttribute(U.STORYBOARD_SRC))!=null?i:void 0}set storyboardSrc(i){i?this.setAttribute(U.STORYBOARD_SRC,i):this.removeAttribute(U.STORYBOARD_SRC)}get storyboard(){let{tokens:i}=this;if(this.storyboardSrc&&!i.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[ke.LIVE,ke.UNKNOWN].includes(this.streamType)||i.playback&&!i.storyboard))return WO(this.playbackId,{customDomain:this.customDomain,token:i.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(U.AUDIO)}set audio(i){if(!i){this.removeAttribute(U.AUDIO);return}this.setAttribute(U.AUDIO,"")}get hotkeys(){return De(this,Dd)}get nohotkeys(){return this.hasAttribute(U.NOHOTKEYS)}set nohotkeys(i){if(!i){this.removeAttribute(U.NOHOTKEYS);return}this.setAttribute(U.NOHOTKEYS,"")}get thumbnailTime(){return qt(this.getAttribute(U.THUMBNAIL_TIME))}set thumbnailTime(i){this.setAttribute(U.THUMBNAIL_TIME,`${i}`)}get videoTitle(){var i,e;return(e=(i=this.getAttribute(U.VIDEO_TITLE))!=null?i:this.getAttribute(U.TITLE))!=null?e:""}set videoTitle(i){i!==this.videoTitle&&(i?this.setAttribute(U.VIDEO_TITLE,i):this.removeAttribute(U.VIDEO_TITLE))}get placeholder(){var i;return(i=nr(this,U.PLACEHOLDER))!=null?i:""}set placeholder(i){this.setAttribute(U.PLACEHOLDER,`${i}`)}get primaryColor(){var i,e;let t=this.getAttribute(U.PRIMARY_COLOR);if(t!=null||this.mediaTheme&&(t=(e=(i=zi.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_primary-color"))==null?void 0:e.trim(),t))return t}set primaryColor(i){this.setAttribute(U.PRIMARY_COLOR,`${i}`)}get secondaryColor(){var i,e;let t=this.getAttribute(U.SECONDARY_COLOR);if(t!=null||this.mediaTheme&&(t=(e=(i=zi.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_secondary-color"))==null?void 0:e.trim(),t))return t}set secondaryColor(i){this.setAttribute(U.SECONDARY_COLOR,`${i}`)}get accentColor(){var i,e;let t=this.getAttribute(U.ACCENT_COLOR);if(t!=null||this.mediaTheme&&(t=(e=(i=zi.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_accent-color"))==null?void 0:e.trim(),t))return t}set accentColor(i){this.setAttribute(U.ACCENT_COLOR,`${i}`)}get defaultShowRemainingTime(){return this.hasAttribute(U.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(i){i?this.setAttribute(U.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(U.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(U.PLAYBACK_RATES))return this.getAttribute(U.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(i=>Number(i)).filter(i=>!Number.isNaN(i)).sort((i,e)=>i-e)}set playbackRates(i){if(!i){this.removeAttribute(U.PLAYBACK_RATES);return}this.setAttribute(U.PLAYBACK_RATES,i.join(" "))}get forwardSeekOffset(){var i;return(i=qt(this.getAttribute(U.FORWARD_SEEK_OFFSET)))!=null?i:10}set forwardSeekOffset(i){this.setAttribute(U.FORWARD_SEEK_OFFSET,`${i}`)}get backwardSeekOffset(){var i;return(i=qt(this.getAttribute(U.BACKWARD_SEEK_OFFSET)))!=null?i:10}set backwardSeekOffset(i){this.setAttribute(U.BACKWARD_SEEK_OFFSET,`${i}`)}get defaultHiddenCaptions(){return this.hasAttribute(U.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(i){i?this.setAttribute(U.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(U.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return qt(this.getAttribute(U.DEFAULT_DURATION))}set defaultDuration(i){i==null?this.removeAttribute(U.DEFAULT_DURATION):this.setAttribute(U.DEFAULT_DURATION,`${i}`)}get playerInitTime(){return this.hasAttribute(C.PLAYER_INIT_TIME)?qt(this.getAttribute(C.PLAYER_INIT_TIME)):De(this,Ld)}set playerInitTime(i){i!=this.playerInitTime&&(i==null?this.removeAttribute(C.PLAYER_INIT_TIME):this.setAttribute(C.PLAYER_INIT_TIME,`${+i}`))}get playerSoftwareName(){var i;return(i=this.getAttribute(C.PLAYER_SOFTWARE_NAME))!=null?i:Rv}get playerSoftwareVersion(){var i;return(i=this.getAttribute(C.PLAYER_SOFTWARE_VERSION))!=null?i:Lv}get beaconCollectionDomain(){var i;return(i=this.getAttribute(C.BEACON_COLLECTION_DOMAIN))!=null?i:void 0}set beaconCollectionDomain(i){i!==this.beaconCollectionDomain&&(i?this.setAttribute(C.BEACON_COLLECTION_DOMAIN,i):this.removeAttribute(C.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var i;return(i=this.getAttribute(C.MAX_RESOLUTION))!=null?i:void 0}set maxResolution(i){i!==this.maxResolution&&(i?this.setAttribute(C.MAX_RESOLUTION,i):this.removeAttribute(C.MAX_RESOLUTION))}get minResolution(){var i;return(i=this.getAttribute(C.MIN_RESOLUTION))!=null?i:void 0}set minResolution(i){i!==this.minResolution&&(i?this.setAttribute(C.MIN_RESOLUTION,i):this.removeAttribute(C.MIN_RESOLUTION))}get maxAutoResolution(){var i;return(i=this.getAttribute(C.MAX_AUTO_RESOLUTION))!=null?i:void 0}set maxAutoResolution(i){i==null?this.removeAttribute(C.MAX_AUTO_RESOLUTION):this.setAttribute(C.MAX_AUTO_RESOLUTION,i)}get renditionOrder(){var i;return(i=this.getAttribute(C.RENDITION_ORDER))!=null?i:void 0}set renditionOrder(i){i!==this.renditionOrder&&(i?this.setAttribute(C.RENDITION_ORDER,i):this.removeAttribute(C.RENDITION_ORDER))}get programStartTime(){return qt(this.getAttribute(C.PROGRAM_START_TIME))}set programStartTime(i){i==null?this.removeAttribute(C.PROGRAM_START_TIME):this.setAttribute(C.PROGRAM_START_TIME,`${i}`)}get programEndTime(){return qt(this.getAttribute(C.PROGRAM_END_TIME))}set programEndTime(i){i==null?this.removeAttribute(C.PROGRAM_END_TIME):this.setAttribute(C.PROGRAM_END_TIME,`${i}`)}get assetStartTime(){return qt(this.getAttribute(C.ASSET_START_TIME))}set assetStartTime(i){i==null?this.removeAttribute(C.ASSET_START_TIME):this.setAttribute(C.ASSET_START_TIME,`${i}`)}get assetEndTime(){return qt(this.getAttribute(C.ASSET_END_TIME))}set assetEndTime(i){i==null?this.removeAttribute(C.ASSET_END_TIME):this.setAttribute(C.ASSET_END_TIME,`${i}`)}get extraSourceParams(){return this.hasAttribute(U.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(U.EXTRA_SOURCE_PARAMS)).entries()].reduce((i,[e,t])=>(i[e]=t,i),{}):D2}set extraSourceParams(i){i==null?this.removeAttribute(U.EXTRA_SOURCE_PARAMS):this.setAttribute(U.EXTRA_SOURCE_PARAMS,new URLSearchParams(i).toString())}get customDomain(){var i;return(i=this.getAttribute(C.CUSTOM_DOMAIN))!=null?i:void 0}set customDomain(i){i!==this.customDomain&&(i?this.setAttribute(C.CUSTOM_DOMAIN,i):this.removeAttribute(C.CUSTOM_DOMAIN))}get envKey(){var i;return(i=nr(this,C.ENV_KEY))!=null?i:void 0}set envKey(i){this.setAttribute(C.ENV_KEY,`${i}`)}get noVolumePref(){return this.hasAttribute(U.NO_VOLUME_PREF)}set noVolumePref(i){i?this.setAttribute(U.NO_VOLUME_PREF,""):this.removeAttribute(U.NO_VOLUME_PREF)}get noMutedPref(){return this.hasAttribute(U.NO_MUTED_PREF)}set noMutedPref(i){i?this.setAttribute(U.NO_MUTED_PREF,""):this.removeAttribute(U.NO_MUTED_PREF)}get debug(){return nr(this,C.DEBUG)!=null}set debug(i){i?this.setAttribute(C.DEBUG,""):this.removeAttribute(C.DEBUG)}get disableTracking(){return nr(this,C.DISABLE_TRACKING)!=null}set disableTracking(i){this.toggleAttribute(C.DISABLE_TRACKING,!!i)}get disableCookies(){return nr(this,C.DISABLE_COOKIES)!=null}set disableCookies(i){i?this.setAttribute(C.DISABLE_COOKIES,""):this.removeAttribute(C.DISABLE_COOKIES)}get streamType(){var i,e,t;return(t=(e=this.getAttribute(C.STREAM_TYPE))!=null?e:(i=this.media)==null?void 0:i.streamType)!=null?t:ke.UNKNOWN}set streamType(i){this.setAttribute(C.STREAM_TYPE,`${i}`)}get defaultStreamType(){var i,e,t;return(t=(e=this.getAttribute(U.DEFAULT_STREAM_TYPE))!=null?e:(i=this.mediaController)==null?void 0:i.getAttribute(U.DEFAULT_STREAM_TYPE))!=null?t:ke.ON_DEMAND}set defaultStreamType(i){i?this.setAttribute(U.DEFAULT_STREAM_TYPE,i):this.removeAttribute(U.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var i,e;return this.hasAttribute(U.TARGET_LIVE_WINDOW)?+this.getAttribute(U.TARGET_LIVE_WINDOW):(e=(i=this.media)==null?void 0:i.targetLiveWindow)!=null?e:Number.NaN}set targetLiveWindow(i){i==this.targetLiveWindow||Number.isNaN(i)&&Number.isNaN(this.targetLiveWindow)||(i==null?this.removeAttribute(U.TARGET_LIVE_WINDOW):this.setAttribute(U.TARGET_LIVE_WINDOW,`${+i}`))}get liveEdgeStart(){var i;return(i=this.media)==null?void 0:i.liveEdgeStart}get startTime(){return qt(nr(this,C.START_TIME))}set startTime(i){this.setAttribute(C.START_TIME,`${i}`)}get preferPlayback(){let i=this.getAttribute(C.PREFER_PLAYBACK);if(i===Zi.MSE||i===Zi.NATIVE)return i}set preferPlayback(i){i!==this.preferPlayback&&(i===Zi.MSE||i===Zi.NATIVE?this.setAttribute(C.PREFER_PLAYBACK,i):this.removeAttribute(C.PREFER_PLAYBACK))}get metadata(){var i;return(i=this.media)==null?void 0:i.metadata}set metadata(i){if(at(this,Qe,$s).call(this),!this.media){ai("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...xv(this),...i}}get _hlsConfig(){var i;return(i=this.media)==null?void 0:i._hlsConfig}set _hlsConfig(i){if(at(this,Qe,$s).call(this),!this.media){ai("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=i}async addCuePoints(i){var e;if(at(this,Qe,$s).call(this),!this.media){ai("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(e=this.media)==null?void 0:e.addCuePoints(i)}get activeCuePoint(){var i;return(i=this.media)==null?void 0:i.activeCuePoint}get cuePoints(){var i,e;return(e=(i=this.media)==null?void 0:i.cuePoints)!=null?e:[]}addChapters(i){var e;if(at(this,Qe,$s).call(this),!this.media){ai("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(e=this.media)==null?void 0:e.addChapters(i)}get activeChapter(){var i;return(i=this.media)==null?void 0:i.activeChapter}get chapters(){var i,e;return(e=(i=this.media)==null?void 0:i.chapters)!=null?e:[]}getStartDate(){var i;return(i=this.media)==null?void 0:i.getStartDate()}get currentPdt(){var i;return(i=this.media)==null?void 0:i.currentPdt}get tokens(){let i=this.getAttribute(U.PLAYBACK_TOKEN),e=this.getAttribute(U.DRM_TOKEN),t=this.getAttribute(U.THUMBNAIL_TOKEN),s=this.getAttribute(U.STORYBOARD_TOKEN);return{...De(this,kd),...i!=null?{playback:i}:{},...e!=null?{drm:e}:{},...t!=null?{thumbnail:t}:{},...s!=null?{storyboard:s}:{}}}set tokens(i){is(this,kd,i??{})}get playbackToken(){var i;return(i=this.getAttribute(U.PLAYBACK_TOKEN))!=null?i:void 0}set playbackToken(i){this.setAttribute(U.PLAYBACK_TOKEN,`${i}`)}get drmToken(){var i;return(i=this.getAttribute(U.DRM_TOKEN))!=null?i:void 0}set drmToken(i){this.setAttribute(U.DRM_TOKEN,`${i}`)}get thumbnailToken(){var i;return(i=this.getAttribute(U.THUMBNAIL_TOKEN))!=null?i:void 0}set thumbnailToken(i){this.setAttribute(U.THUMBNAIL_TOKEN,`${i}`)}get storyboardToken(){var i;return(i=this.getAttribute(U.STORYBOARD_TOKEN))!=null?i:void 0}set storyboardToken(i){this.setAttribute(U.STORYBOARD_TOKEN,`${i}`)}addTextTrack(i,e,t,s){var r;let n=(r=this.media)==null?void 0:r.nativeEl;if(n)return ip(n,i,e,t,s)}removeTextTrack(i){var e;let t=(e=this.media)==null?void 0:e.nativeEl;if(t)return lM(t,i)}get textTracks(){var i;return(i=this.media)==null?void 0:i.textTracks}get castReceiver(){var i;return(i=this.getAttribute(U.CAST_RECEIVER))!=null?i:void 0}set castReceiver(i){i!==this.castReceiver&&(i?this.setAttribute(U.CAST_RECEIVER,i):this.removeAttribute(U.CAST_RECEIVER))}get castCustomData(){var i;return(i=this.media)==null?void 0:i.castCustomData}set castCustomData(i){if(!this.media){ai("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");return}this.media.castCustomData=i}get noTooltips(){return this.hasAttribute(U.NO_TOOLTIPS)}set noTooltips(i){if(!i){this.removeAttribute(U.NO_TOOLTIPS);return}this.setAttribute(U.NO_TOOLTIPS,"")}get proudlyDisplayMuxBadge(){return this.hasAttribute(U.PROUDLY_DISPLAY_MUX_BADGE)}set proudlyDisplayMuxBadge(i){i?this.setAttribute(U.PROUDLY_DISPLAY_MUX_BADGE,""):this.removeAttribute(U.PROUDLY_DISPLAY_MUX_BADGE)}};Ld=new WeakMap,Rd=new WeakMap,kd=new WeakMap,mr=new WeakMap,Dd=new WeakMap,qn=new WeakMap,Qe=new WeakSet,$s=function(){var i,e,t,s;if(!De(this,Rd)){is(this,Rd,!0),at(this,Qe,pr).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof zi.HTMLElement))throw""}catch{ai("<media-theme> failed to upgrade!")}try{customElements.upgrade(this.media)}catch{ai("underlying media element failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof TE))throw""}catch{ai("<media-controller> failed to upgrade!")}at(this,Qe,Dv).call(this),at(this,Qe,Cv).call(this),at(this,Qe,wv).call(this),is(this,mr,(e=(i=this.mediaController)==null?void 0:i.hasAttribute(ne.USER_INACTIVE))!=null?e:!0),at(this,Qe,Mv).call(this),(t=this.media)==null||t.addEventListener("streamtypechange",()=>at(this,Qe,pr).call(this)),(s=this.media)==null||s.addEventListener("loadstart",()=>at(this,Qe,pr).call(this))}},I_=function(){var i,e;try{(i=window?.CSS)==null||i.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(e=window?.CSS)==null||e.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},Xf=function(i){Object.assign(De(this,qn),i),at(this,Qe,pr).call(this)},pr=function(i={}){u2(h2(A2(this,{...De(this,qn),...i})),this.shadowRoot)},Dv=function(){let i=e=>{var t,s;if(!(e!=null&&e.startsWith("theme-")))return;let r=e.replace(/^theme-/,"");if(Qf.includes(r))return;let n=this.getAttribute(e);n!=null?(t=this.mediaTheme)==null||t.setAttribute(r,n):(s=this.mediaTheme)==null||s.removeAttribute(r)};new MutationObserver(e=>{for(let{attributeName:t}of e)i(t)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(i)},Cv=function(){let i=e=>{var t;let s=(t=this.media)==null?void 0:t.error;if(!(s instanceof X)){let{message:n,code:a}=s??{};s=new X(n,a)}if(!(s!=null&&s.fatal)){ps(s),s.data&&ps(`${s.name} data:`,s.data);return}let r=Av(s);r.message&&b_(r),ai(s),s.data&&ai(`${s.name} data:`,s.data),at(this,Qe,Xf).call(this,{isDialogOpen:!0})};this.addEventListener("error",i),this.media&&(this.media.errorTranslator=(e={})=>{var t,s,r;if(!(((t=this.media)==null?void 0:t.error)instanceof X))return e;let n=Av((s=this.media)==null?void 0:s.error);return{player_error_code:(r=this.media)==null?void 0:r.error.code,player_error_message:n.message?String(n.message):e.player_error_message,player_error_context:n.context?String(n.context):e.player_error_context}})},wv=function(){var i,e,t,s;let r=()=>at(this,Qe,pr).call(this);(e=(i=this.media)==null?void 0:i.textTracks)==null||e.addEventListener("addtrack",r),(s=(t=this.media)==null?void 0:t.textTracks)==null||s.addEventListener("removetrack",r)},Mv=function(){var i,e;if(!/Firefox/i.test(navigator.userAgent))return;let t,s=new WeakMap,r=()=>this.streamType===ke.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,n=(l,d,u=!1)=>{r()||Array.from(l&&l.activeCues||[]).forEach(c=>{if(!(!c.snapToLines||c.line<-5||c.line>=0&&c.line<10))if(!d||this.paused){let h=c.text.split(`
3385
- `).length,f=-3;this.streamType===ke.LIVE&&(f=-2);let m=f-h;if(c.line===m&&!u)return;s.has(c)||s.set(c,c.line),c.line=m}else setTimeout(()=>{c.line=s.get(c)||"auto"},500)})},a=()=>{var l,d;n(t,(d=(l=this.mediaController)==null?void 0:l.hasAttribute(ne.USER_INACTIVE))!=null?d:!1)},o=()=>{var l,d;let u=Array.from(((d=(l=this.mediaController)==null?void 0:l.media)==null?void 0:d.textTracks)||[]).filter(c=>["subtitles","captions"].includes(c.kind)&&c.mode==="showing")[0];u!==t&&t?.removeEventListener("cuechange",a),t=u,t?.addEventListener("cuechange",a),n(t,De(this,mr))};o(),(i=this.textTracks)==null||i.addEventListener("change",o),(e=this.textTracks)==null||e.addEventListener("addtrack",o),this.addEventListener("userinactivechange",()=>{var l,d;let u=(d=(l=this.mediaController)==null?void 0:l.hasAttribute(ne.USER_INACTIVE))!=null?d:!0;De(this,mr)!==u&&(is(this,mr,u),n(t,De(this,mr)))})};function nr(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}var Pv=C2,x_=class{addEventListener(){}removeEventListener(){}dispatchEvent(i){return!0}};if(typeof DocumentFragment>"u"){class i extends x_{}globalThis.DocumentFragment=i}var w2=class extends x_{},M2={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(w2)}},P2={customElements:M2},O2=typeof window>"u"||typeof globalThis.customElements>"u",eh=O2?P2:globalThis;eh.customElements.get("mux-player")||(eh.customElements.define("mux-player",Pv),eh.MuxPlayerElement=Pv);var L_=parseInt(ve.version)>=19,Ov={className:"class",classname:"class",htmlFor:"for",crossOrigin:"crossorigin",viewBox:"viewBox",playsInline:"playsinline",autoPlay:"autoplay",playbackRate:"playbackrate"},N2=i=>i==null,U2=(i,e)=>N2(e)?!1:i in e,$2=i=>i.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),F2=(i,e)=>{if(!(!L_&&typeof e=="boolean"&&!e)){if(U2(i,Ov))return Ov[i];if(typeof e<"u")return/[A-Z]/.test(i)?$2(i):i}},B2=(i,e)=>!L_&&typeof i=="boolean"?"":i,H2=(i={})=>{let{ref:e,...t}=i;return Object.entries(t).reduce((s,[r,n])=>{let a=F2(r,n);if(!a)return s;let o=B2(n);return s[a]=o,s},{})};function Nv(i,e){if(typeof i=="function")return i(e);i!=null&&(i.current=e)}function G2(...i){return e=>{let t=!1,s=i.map(r=>{let n=Nv(r,e);return!t&&typeof n=="function"&&(t=!0),n});if(t)return()=>{for(let r=0;r<s.length;r++){let n=s[r];typeof n=="function"?n():Nv(i[r],null)}}}}function K2(...i){return Se.useCallback(G2(...i),i)}var V2=Object.prototype.hasOwnProperty,W2=(i,e)=>{if(Object.is(i,e))return!0;if(typeof i!="object"||i===null||typeof e!="object"||e===null)return!1;if(Array.isArray(i))return!Array.isArray(e)||i.length!==e.length?!1:i.some((r,n)=>e[n]===r);let t=Object.keys(i),s=Object.keys(e);if(t.length!==s.length)return!1;for(let r=0;r<t.length;r++)if(!V2.call(e,t[r])||!Object.is(i[t[r]],e[t[r]]))return!1;return!0},R_=(i,e,t)=>!W2(e,i[t]),q2=(i,e,t)=>{i[t]=e},Y2=(i,e,t,s=q2,r=R_)=>Se.useEffect(()=>{let n=t?.current;n&&r(n,e,i)&&s(n,e,i)},[t?.current,e]),wi=Y2,j2=()=>{try{return"3.10.2"}catch{}return"UNKNOWN"},z2=j2(),Q2=()=>z2,Ke=(i,e,t)=>Se.useEffect(()=>{let s=e?.current;if(!s||!t)return;let r=i,n=t;return s.addEventListener(r,n),()=>{s.removeEventListener(r,n)}},[e?.current,t,i]),X2=ve.forwardRef(({children:i,...e},t)=>ve.createElement("mux-player",{suppressHydrationWarning:!0,...H2(e),ref:t},i)),Z2=(i,e)=>{let{onAbort:t,onCanPlay:s,onCanPlayThrough:r,onEmptied:n,onLoadStart:a,onLoadedData:o,onLoadedMetadata:l,onProgress:d,onDurationChange:u,onVolumeChange:c,onRateChange:h,onResize:f,onWaiting:m,onPlay:p,onPlaying:g,onTimeUpdate:v,onPause:b,onSeeking:E,onSeeked:T,onStalled:A,onSuspend:x,onEnded:S,onError:L,onCuePointChange:R,onChapterChange:I,metadata:M,tokens:B,paused:W,playbackId:j,playbackRates:K,currentTime:F,themeProps:Y,extraSourceParams:P,castCustomData:G,_hlsConfig:Z,...$}=e;return wi("tokens",B,i),wi("playbackId",j,i),wi("playbackRates",K,i),wi("metadata",M,i),wi("extraSourceParams",P,i),wi("_hlsConfig",Z,i),wi("themeProps",Y,i),wi("castCustomData",G,i),wi("paused",W,i,(H,se)=>{se!=null&&(se?H.pause():H.play())},(H,se,ge)=>H.hasAttribute("autoplay")&&!H.hasPlayed?!1:R_(H,se,ge)),wi("currentTime",F,i,(H,se)=>{se!=null&&(H.currentTime=se)}),Ke("abort",i,t),Ke("canplay",i,s),Ke("canplaythrough",i,r),Ke("emptied",i,n),Ke("loadstart",i,a),Ke("loadeddata",i,o),Ke("loadedmetadata",i,l),Ke("progress",i,d),Ke("durationchange",i,u),Ke("volumechange",i,c),Ke("ratechange",i,h),Ke("resize",i,f),Ke("waiting",i,m),Ke("play",i,p),Ke("playing",i,g),Ke("timeupdate",i,v),Ke("pause",i,b),Ke("seeking",i,E),Ke("seeked",i,T),Ke("stalled",i,A),Ke("suspend",i,x),Ke("ended",i,S),Ke("error",i,L),Ke("cuepointchange",i,R),Ke("chapterchange",i,I),[$]},J2=Q2(),eN="mux-player-react",tN=ve.forwardRef((i,e)=>{var t;let s=Se.useRef(null),r=K2(s,e),[n]=Z2(s,i),[a]=Se.useState((t=i.playerInitTime)!=null?t:ap());return ve.createElement(X2,{ref:r,defaultHiddenCaptions:i.defaultHiddenCaptions,playerSoftwareName:eN,playerSoftwareVersion:J2,playerInitTime:a,...n})}),iN=tN;const sN=U_({time:F_(),expiresAt:$_()}).transform(i=>({time:Number(i.time),expiresAt:new Date(i.expiresAt)}));function k_(){const i=Gv(),t=M_().find(s=>s.formAction==="/video-player");if(t&&t.state!=="idle"){const s=t.json;if(s)return{...i.preferences?.player,...s}}return i.preferences?.player??null}function Uv(i){const e=Se.useRef(i);return Se.useEffect(()=>{e.current=i},[i]),e}function rN({muxPlayerRef:i,...e}){const t=k_(),s=Bv(),[r,n]=Se.useState(!1),a=`${e.playbackId}:currentTime`,[o,l]=Se.useState(0),d=Uv(s),u=Uv(t);Se.useEffect(()=>{if(typeof document>"u")return;const h=sessionStorage.getItem(a);if(h)try{const{time:f,expiresAt:m}=sN.parse(JSON.parse(h));if(m.getTime()<Date.now())throw new Error("Time expired");l(f)}catch{sessionStorage.removeItem(a)}},[a]);const c=N_(()=>{const h=i.current;if(!h)return;const f=Array.from(h.textTracks??[]).find(p=>p.kind==="subtitles"),m={playbackRate:h.playbackRate,volumeRate:h.volume,subtitle:f?{id:f.id,mode:f.mode}:{id:null,mode:"disabled"}};Zf(m,u.current)||d.current.submit(m,{method:"POST",action:"/video-player",encType:"application/json"})},300);return Se.useEffect(()=>{if(!r)return;const h=i.current?.textTracks;if(!h)return;const f=setTimeout(()=>{const m=u.current?.subtitle;if(m?.id)try{const p=h.getTrackById(m.id);p&&(p.mode=m.mode??"hidden")}catch(p){console.warn("Failed to restore subtitle preferences:",p)}},100);return h.addEventListener("change",c),()=>{clearTimeout(f),h.removeEventListener("change",c)}},[r,i,u,c]),N.jsx("div",{className:"flex aspect-video flex-col",children:N.jsx(iN,{ref:i,playbackRates:[.5,.75,.8,.9,1,1.25,1.5,1.75,2,2.5,3,3.5,4],volume:t?.volumeRate??1,playbackRate:t?.playbackRate??1,thumbnailTime:o,onRateChange:c,onVolumeChange:c,streamType:"on-demand",defaultHiddenCaptions:!0,currentTime:o,onTimeUpdate:()=>sessionStorage.setItem(a,JSON.stringify({time:i.current?.currentTime,expiresAt:new Date(Date.now()+1e3*60*30).toISOString()})),accentColor:"#427cf0",targetLiveWindow:NaN,minResolution:nN(t?.minResolution),maxResolution:aN(t?.maxResolution),onLoadedMetadata:()=>n(!0),...e})})}function Zf(i,e){if(i===e)return!0;if(typeof i!=typeof e||typeof i!="object"||typeof e!="object"||i===null||e===null||Array.isArray(i)!==Array.isArray(e))return!1;if(Array.isArray(i)&&Array.isArray(e)){if(i.length!==e.length)return!1;for(let r=0;r<i.length;r++)if(!Zf(i[r],e[r]))return!1;return!0}const t=Object.keys(i),s=Object.keys(e);if(t.length!==s.length)return!1;for(const r of t)if(!Zf(i[r],e[r]))return!1;return!0}function nN(i){if(i)return i<=480?Xr.noLessThan480p:i<=540?Xr.noLessThan540p:i<=720?Xr.noLessThan720p:i<=1080?Xr.noLessThan1080p:i<=1440?Xr.noLessThan1440p:Xr.noLessThan2160p}function aN(i){if(i)return i<=720?ol.upTo720p:i<=1080?ol.upTo1080p:i<=1440?ol.upTo1440p:ol.upTo2160p}function oN({progress:i,size:e=16,strokeWidth:t=2,className:s}){const r=i===void 0,n=(e-t)/2,a=2*Math.PI*n,o=e/2,l=i!==void 0?Math.min(100,Math.max(0,i)):0,d=a-l/100*a;return N.jsxs("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,className:th(r&&"animate-spin","text-current",s),role:"progressbar","aria-valuenow":r?void 0:l,"aria-valuemin":0,"aria-valuemax":100,"aria-label":r?"Downloading...":`Download progress: ${l}%`,children:[N.jsx("circle",{cx:o,cy:o,r:n,fill:"none",stroke:"currentColor",strokeWidth:t,opacity:.25}),N.jsx("circle",{cx:o,cy:o,r:n,fill:"none",stroke:"currentColor",strokeWidth:t,strokeLinecap:"round",strokeDasharray:a,strokeDashoffset:r?a*.75:d,transform:`rotate(-90 ${o} ${o})`,className:th(!r&&"transition-[stroke-dashoffset] duration-300 ease-out")})]})}function lN(i){return N.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",...i,children:N.jsx("path",{fill:"currentColor",d:"M10 2a1 1 0 0 1 1 1v7.59l2.3-2.3a1 1 0 1 1 1.4 1.42l-4 4a1 1 0 0 1-1.4 0l-4-4a1 1 0 1 1 1.4-1.42l2.3 2.3V3a1 1 0 0 1 1-1Zm-6 12a1 1 0 0 1 1 1v1h10v-1a1 1 0 1 1 2 0v2a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1Z"})})}function dN(i){return N.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...i,children:[N.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M6.75 7.75L7.59115 17.4233C7.68102 18.4568 8.54622 19.25 9.58363 19.25H14.4164C15.4538 19.25 16.319 18.4568 16.4088 17.4233L17.25 7.75"}),N.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M9.75 7.5V6.75C9.75 5.64543 10.6454 4.75 11.75 4.75H12.25C13.3546 4.75 14.25 5.64543 14.25 6.75V7.5"}),N.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M5 7.75H19"})]})}function uN({isAvailable:i,isBusy:e=!1,downloadProgress:t,onDownload:s,onDelete:r}){const n=e&&!i,a=n,o=i?"Delete offline video":n?t!==void 0?`Downloading: ${Math.round(t)}%`:"Downloading...":"Download offline video",l=i?r:s,d=i?"text-foreground-destructive hover:bg-foreground-destructive/10":"text-foreground hover:bg-muted";return N.jsx(B_,{content:o,children:N.jsx("button",{type:"button",onClick:l,disabled:e,className:`${d} inline-flex h-7 w-7 items-center justify-center rounded disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":o,children:a?N.jsx(oN,{progress:t,size:16,strokeWidth:2,className:"h-4 w-4"}):i?N.jsx(dN,{className:"h-4 w-4"}):N.jsx(lN,{className:"h-4 w-4"})})})}const D_=Se.createContext(null),$v={best:"best available",high:"high",medium:"medium",low:"low"};function cN(i){return i==="high"||i==="medium"||i==="low"?$v[i]:$v.best}function hN(i,e){const[t,s]=Se.useState(!1),[r,n]=Se.useState(!1),a=`/resources/offline-videos/${encodeURIComponent(i)}`;return Se.useEffect(()=>{if(typeof window>"u")return;s(!1),n(!1);const o=new AbortController;let l=!0;return fetch(a,{method:"HEAD",signal:o.signal}).then(d=>{l&&s(d.ok)}).catch(()=>{l&&s(!1)}).finally(()=>{l&&n(!0)}),()=>{l=!1,o.abort()}},[a,e]),{available:t,checked:r,offlineUrl:a}}function fN(){return N.jsx("div",{className:"relative aspect-video w-full shrink-0 shadow-lg",children:N.jsx("div",{className:"not-prose text-foreground-destructive absolute inset-0 z-10 flex items-center justify-center p-8",children:N.jsx(Jf,{name:"WifiNoConnection",size:"xl",children:N.jsxs("span",{children:["Offline video not available. Download offline videos in"," ",N.jsx(Ln,{to:"/preferences",className:"underline",children:"Preferences"}),"."]})})})})}function n3({children:i,epicVideoInfosPromise:e}){return N.jsx(D_.Provider,{value:e,children:i})}function C_(i){let e=new URL("https://epicweb.dev");try{e=new URL(i)}catch(c){return console.error(c),"Epic Video"}const t=e.pathname.split("/").filter(Boolean),s=t.includes("solution");let r=t.pop();const n=["problem","solution","embed","exercise"],a=c=>c&&!n.includes(c);for(;!a(r);)r=t.pop();if(!r)return"Epic Video";r=r.replace(/~[^ ]*$/,"");const o=r.split("-"),l=["the","a","an","and","but","or","for","nor","on","at","to","from","by","of","in","with","as","npm","git","ssh","cli"],d=["OAuth","UI","UX","API","CSS","HTML","JS","TS","SVG","AI","CSRF","CORS","HTTP","HTTPS","URL","URI","DB","SQL","JSON","YAML","YML","useActionData","useAsyncError","useAsyncValue","useBeforeUnload","useFetcher","useFetchers","useFormAction","useHref","useLoaderData","useLocation","useMatches","useNavigate","useNavigation","useNavigationType","useOutlet","useOutletContext","useParams","useResolvedPath","useRevalidator","useRouteError","useRouteLoaderData","useSearchParams","useSubmit","useCallback","useContext","useDebugValue","useDeferredValue","useEffect","useId","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useReducer","useRef","useState","useSyncExternalStore","useTransition","useForm","useFieldset","useFieldList","useEventSource","useHydrated","useAuthenticityToken","useShouldHydrate","useGlobalNavigationState","useLocales","useDelegatedAnchors","useDebounceFetcher","useFetcherType"],u=o.filter(Boolean).map((c,h)=>{const f=c.toLowerCase(),m=d.find(p=>p.toLowerCase()===f);return m||(l.includes(f)&&h>0?f:f[0]?.toUpperCase()+f.slice(1))}).join(" ");return s?`${u} (🏁 solution)`:u}function mN({url:i,title:e="Video Embed",loadingContent:t=N.jsx(yu,{children:N.jsxs("span",{children:['Loading "',e,'"']})})}){const s=Hv(),[r,n]=Se.useState(!1);return Kv()?N.jsxs("div",{className:"relative aspect-video w-full shrink-0 shadow-lg",children:[r?null:N.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center p-8",children:t}),N.jsx("iframe",{onLoad:()=>n(!0),onError:()=>n(!0),src:i,className:th("absolute inset-0 flex h-full w-full transition-opacity duration-300",r?"opacity-100":"opacity-0"),title:e,sandbox:"allow-forms allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox",allowFullScreen:!0,style:{colorScheme:s}})]}):N.jsx("div",{className:"relative aspect-video w-full shrink-0 shadow-lg",children:N.jsx("div",{className:"not-prose text-foreground-destructive absolute inset-0 z-10 flex items-center justify-center p-8",children:N.jsx(Jf,{name:"WifiNoConnection",size:"xl",children:N.jsxs("span",{children:["Unable to load the video ",N.jsx("a",{href:i,className:"underline",children:`"${e??i}"`})," when offline"]})})})})}function w_({url:i,title:e,duration:t,durationEstimate:s,actions:r}){return N.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-base",children:[r?N.jsx("span",{className:"flex items-center gap-1",children:r}):null,t?N.jsx("span",{className:"opacity-70",children:Fv(t)}):s?N.jsxs("span",{className:"opacity-70",children:["~",Fv(s)]}):null,N.jsxs("a",{href:i,target:"_blank",className:"flex items-center gap-1 no-underline opacity-70 transition hover:underline hover:opacity-100",rel:"noreferrer",children:[N.jsx(Jf,{className:"shrink-0",name:"Video",size:"lg"}),e," ",N.jsx("span",{"aria-hidden":!0,children:"↗︎"})]})]})}function a3({url:i,title:e}){const t=e??C_(i),{product:{host:s,displayName:r}}=G_(),n=H_(),a=Se.useContext(D_),o=N.jsx(w_,{url:i,title:t});return N.jsx("div",{children:N.jsx(Se.Suspense,{fallback:N.jsxs("div",{children:[N.jsx("div",{className:"flex aspect-video w-full items-center justify-center",children:N.jsx(yu,{children:t})}),N.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[o,N.jsx("div",{className:"h-[32px]"})]})]}),children:N.jsx(P_,{errorElement:N.jsx("div",{children:"Sorry, failed loading videos. Check the terminal output?"}),resolve:a,children:l=>{const d=l?.[i],u=ENV.EPICSHOP_DEPLOYED?N.jsxs("div",{children:[N.jsx(Ln,{to:ENV.EPICSHOP_GITHUB_REPO,className:"underline",children:"Run locally"})," for transcripts"]}):N.jsxs("div",{children:[N.jsx(Ln,{to:"/login",className:"underline",children:n?"Upgrade":"Login"})," for transcripts"]});if(!d)return N.jsxs("div",{children:[N.jsx(Ea,{url:i,title:t}),N.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[o,u]})]});const c=d;return c.status==="success"?N.jsx(pN,{url:i,title:e??c.title??t,muxPlaybackId:c.muxPlaybackId,transcript:c.transcript,duration:c.duration,durationEstimate:c.durationEstimate}):c.type==="region-restricted"?N.jsxs("div",{children:[N.jsxs("div",{className:"flex aspect-video min-h-full min-w-full flex-col items-center justify-start gap-2 overflow-y-scroll border-2 p-4 lg:justify-center lg:gap-4 lg:text-xl",children:[N.jsx("div",{className:"!text-foreground-destructive",children:"Error: Region Restricted"}),N.jsxs("div",{children:["We've detected you're connecting from"," ",c.requestCountry," but your license has restricted access to ",c.restrictedCountry]}),N.jsxs("div",{children:["To continue watching uninterrupted, please"," ",N.jsxs("a",{href:`https://${s}/products`,className:"underline",children:["upgrade your ",r," license"]})," ","to a full Pro license."]})]}),N.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[o,N.jsxs("div",{children:[N.jsx(Ln,{to:`https://${s}/products`,className:"underline",children:"Upgrade"})," for transcripts"]})]})]}):c.statusCode===401?N.jsxs("div",{children:[N.jsx(Ea,{url:i,title:t}),N.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[o,u]})]}):c.statusCode===403?N.jsxs("div",{children:[N.jsx(Ea,{url:i,title:t}),N.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[o,N.jsxs("div",{children:[N.jsx(Ln,{to:`https://${s}/products`,className:"underline",children:"Upgrade"})," for transcripts"]})]})]}):c.statusCode===404?N.jsxs("div",{children:[N.jsx(Ea,{url:i,title:t}),N.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[o,N.jsx("div",{children:"Transcripts not found"})]})]}):(console.error(c),N.jsxs("div",{children:[N.jsx(Ea,{url:i,title:t}),N.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[o,N.jsx("div",{className:"!text-foreground-destructive",children:"Unknown error (check console)"})]})]}))}})})})}function pN({url:i,title:e=C_(i),muxPlaybackId:t,transcript:s,duration:r,durationEstimate:n}){const a=Se.useRef(null),o=Se.useRef(null),l=Kv(),d=k_(),u=Gv(),c=cN(u.preferences?.offlineVideo?.downloadResolution),[h,f]=Se.useState(0),m=hN(t,h),p=m.available,g=Bv(),v=g.state!=="idle",[b,E]=Se.useState(void 0),T=v&&!m.available,A=O_(`/resources/offline-video-progress/${encodeURIComponent(t)}`,{enabled:T});Se.useEffect(()=>{if(A)try{const P=JSON.parse(A);if(P.status==="complete"||P.status==="error"){E(void 0);return}if(P.totalBytes&&P.totalBytes>0){const G=P.bytesDownloaded/P.totalBytes*100;E(G)}else E(void 0)}catch{}},[A]),Se.useEffect(()=>{T||E(void 0)},[T]);const x=`${t}:currentTime`,[S,L]=Se.useState(null),R=/(\d+:\d+)/g,I=[];let M,B=0;for(;M=R.exec(s);){const P=M[1];if(!R.lastIndex||!P)break;const G=M.index,Z=R.lastIndex,$=s.slice(B+1,G-1);I.push(N.jsx("span",{children:$},`span-${G}`)),I.push(N.jsx("button",{className:"underline",onClick:H=>{const se=o.current??a.current;if(se){se.currentTime=gN(P);try{se.play().catch(()=>{})}catch{}se.scrollIntoView({behavior:"smooth",inline:"center",block:"start"}),H.currentTarget.blur()}},children:P},`button-${G}`)),B=Z}I.push(N.jsx("span",{children:s.slice(B+1,s.length)},s.length)),Se.useEffect(()=>{o.current&&(typeof d?.playbackRate=="number"&&(o.current.playbackRate=d.playbackRate),typeof d?.volumeRate=="number"&&(o.current.volume=d.volumeRate))},[d?.playbackRate,d?.volumeRate,p]),Se.useEffect(()=>{if(!p||typeof document>"u")return;const P=sessionStorage.getItem(x);if(!P){L(null);return}try{const G=JSON.parse(P),Z=G.expiresAt?new Date(G.expiresAt).getTime():0;if(typeof G.time!="number"||Number.isNaN(G.time)||!Z||Z<Date.now())throw new Error("Time expired");L(G.time)}catch{sessionStorage.removeItem(x),L(null)}},[x,p]),Se.useEffect(()=>{if(!p)return;const P=o.current;if(!P||S==null)return;const G=()=>{const Z=Number.isFinite(P.duration)?P.duration:0,$=Z?Math.min(S,Math.max(Z-1,0)):S;$>0&&(P.currentTime=$)};if(P.readyState>=1){G();return}return P.addEventListener("loadedmetadata",G),()=>{P.removeEventListener("loadedmetadata",G)}},[S,p]);const W=Se.useCallback(()=>{if(typeof document>"u")return;const P=o.current;if(!P)return;const G=Number.isFinite(P.duration)?P.duration:0;if(G&&G-P.currentTime<=1){sessionStorage.removeItem(x);return}sessionStorage.setItem(x,JSON.stringify({time:P.currentTime,expiresAt:new Date(Date.now()+1e3*60*30).toISOString()}))},[x]);Se.useEffect(()=>{g.state==="idle"&&g.data?.status&&f(P=>P+1)},[g.state,g.data]),Se.useEffect(()=>{if(g.state!=="idle")return;const P=g.data;if(!P||P.action!=="download"||P.status!=="error")return;const G=P.message??"Offline video download failed. Check the terminal logs.";$p.error("Offline video download failed",{description:G})},[g.state,g.data]);const j=Se.useCallback(()=>{$p.success(`Download of ${e} has started (${c} quality).`,{description:N.jsxs("span",{children:["Go to"," ",N.jsx(Ln,{className:"underline",to:"/preferences",children:"Preferences"})," ","to download all workshop videos at once."]})}),g.submit({intent:"download-video",playbackId:t,title:e,url:i},{method:"post",action:"/resources/offline-videos"})},[t,g,e,i,c]),K=Se.useCallback(()=>{g.submit({intent:"delete-video",playbackId:t},{method:"post",action:"/resources/offline-videos"})},[t,g]),F=Se.useCallback(P=>{P&&P.setAttribute("seekoffset","10")},[]),Y=N.jsx(uN,{isAvailable:m.available,isBusy:v,downloadProgress:b,onDownload:j,onDelete:K});return N.jsxs("div",{children:[N.jsx("div",{className:"shadow-lg",children:p?N.jsx("div",{className:"not-prose flex aspect-video w-full items-center justify-center bg-black",children:N.jsxs(gI,{tabIndex:0,"aria-label":`${e} video player`,onPointerDown:P=>{P.currentTarget.focus()},className:"focus-visible:ring-ring flex h-full w-full flex-col justify-end outline-none focus-visible:ring-2 focus-visible:ring-offset-2",style:{"--media-primary-color":"hsl(var(--background))","--media-text-color":"hsl(var(--background))","--media-secondary-color":"transparent","--media-control-background":"transparent","--media-control-hover-background":"hsl(var(--background) / 0.18)","--media-control-height":"18px","--media-range-padding":"2px","--media-time-range-hover-height":"18px","--media-time-range-hover-bottom":"-4px","--media-range-track-height":"3px","--media-range-thumb-height":"8px","--media-range-thumb-width":"8px","--media-range-track-background":"hsl(var(--background) / 0.35)","--media-range-track-pointer-background":"hsl(var(--background) / 0.85)"},children:[N.jsx("video",{ref:o,slot:"media","aria-label":e,className:"h-full w-full",playsInline:!0,preload:"metadata",src:m.offlineUrl,onTimeUpdate:W}),N.jsxs("div",{className:"bg-foreground/40 text-background w-full space-y-1 px-3 pt-1 pb-1.5 text-sm leading-none backdrop-blur select-none",children:[N.jsx(xI,{className:"w-full"}),N.jsxs(vI,{className:"w-full items-center gap-3",children:[N.jsxs("div",{className:"flex items-center gap-3",children:[N.jsx(_I,{}),N.jsx(AI,{ref:F,seekOffset:10}),N.jsx(SI,{ref:F,seekOffset:10}),N.jsx(II,{showDuration:!0,className:"text-background text-xs tabular-nums"}),N.jsx(yI,{}),N.jsx(LI,{className:"w-24"})]}),N.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[N.jsx(TI,{className:"text-background text-xs",rates:[.5,.75,.8,.9,1,1.25,1.5,1.75,2,2.5,3,3.5,4]}),N.jsx(bI,{}),N.jsx(EI,{})]})]})]})]})}):!l&&m.checked?N.jsx(fN,{}):l?N.jsx(rN,{playbackId:t,muxPlayerRef:a,title:e}):N.jsx("div",{className:"flex aspect-video w-full items-center justify-center",children:N.jsx(yu,{children:"Checking offline videos..."})})}),N.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[N.jsx(w_,{url:i,title:e,duration:r,durationEstimate:n,actions:Y}),N.jsxs("details",{children:[N.jsx("summary",{children:"Transcript"}),N.jsx("div",{className:"bg-accent text-accent-foreground rounded-md p-2 whitespace-pre-line",children:I})]})]})]})}function gN(i){const e=i.split(":");let t=0,s=1;for(;e.length>0;)t+=s*parseInt(e.pop()??"0",10),s*=60;return t}function Fv(i){const e=Math.floor(i/3600),t=Math.floor(i%3600/60),s=Math.floor(i%60);return e>0?`${e}:${t.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`:`${t}:${s.toString().padStart(2,"0")}`}function Ea({url:i,title:e}){const t=Hv();let s=new URL("https://epicweb.dev");try{s=new URL(i)}catch(r){return console.error(r),N.jsxs("div",{children:['Invalid URL: "',i,'"']})}return s.pathname=s.pathname.endsWith("/")?`${s.pathname}embed`:`${s.pathname}/embed`,s.searchParams.set("theme",t),s.host==="www.epicai.pro"&&!s.pathname.startsWith("/workshops/")&&(s.pathname=`/posts/${s.pathname}`),N.jsx(mN,{url:s.toString(),title:e,loadingContent:N.jsx(yu,{children:N.jsxs("span",{children:['Loading "',N.jsx("a",{className:"underline",href:i,children:e}),'"']})})})}export{a3 as D,n3 as E,mN as V};
3386
- //# sourceMappingURL=epic-video-D0drHmgC.js.map
3385
+ `).length,f=-3;this.streamType===ke.LIVE&&(f=-2);let m=f-h;if(c.line===m&&!u)return;s.has(c)||s.set(c,c.line),c.line=m}else setTimeout(()=>{c.line=s.get(c)||"auto"},500)})},a=()=>{var l,d;n(t,(d=(l=this.mediaController)==null?void 0:l.hasAttribute(ne.USER_INACTIVE))!=null?d:!1)},o=()=>{var l,d;let u=Array.from(((d=(l=this.mediaController)==null?void 0:l.media)==null?void 0:d.textTracks)||[]).filter(c=>["subtitles","captions"].includes(c.kind)&&c.mode==="showing")[0];u!==t&&t?.removeEventListener("cuechange",a),t=u,t?.addEventListener("cuechange",a),n(t,De(this,mr))};o(),(i=this.textTracks)==null||i.addEventListener("change",o),(e=this.textTracks)==null||e.addEventListener("addtrack",o),this.addEventListener("userinactivechange",()=>{var l,d;let u=(d=(l=this.mediaController)==null?void 0:l.hasAttribute(ne.USER_INACTIVE))!=null?d:!0;De(this,mr)!==u&&(is(this,mr,u),n(t,De(this,mr)))})};function nr(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}var Pv=C2,x_=class{addEventListener(){}removeEventListener(){}dispatchEvent(i){return!0}};if(typeof DocumentFragment>"u"){class i extends x_{}globalThis.DocumentFragment=i}var w2=class extends x_{},M2={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(w2)}},P2={customElements:M2},O2=typeof window>"u"||typeof globalThis.customElements>"u",eh=O2?P2:globalThis;eh.customElements.get("mux-player")||(eh.customElements.define("mux-player",Pv),eh.MuxPlayerElement=Pv);var L_=parseInt(ve.version)>=19,Ov={className:"class",classname:"class",htmlFor:"for",crossOrigin:"crossorigin",viewBox:"viewBox",playsInline:"playsinline",autoPlay:"autoplay",playbackRate:"playbackrate"},N2=i=>i==null,U2=(i,e)=>N2(e)?!1:i in e,$2=i=>i.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),F2=(i,e)=>{if(!(!L_&&typeof e=="boolean"&&!e)){if(U2(i,Ov))return Ov[i];if(typeof e<"u")return/[A-Z]/.test(i)?$2(i):i}},B2=(i,e)=>!L_&&typeof i=="boolean"?"":i,H2=(i={})=>{let{ref:e,...t}=i;return Object.entries(t).reduce((s,[r,n])=>{let a=F2(r,n);if(!a)return s;let o=B2(n);return s[a]=o,s},{})};function Nv(i,e){if(typeof i=="function")return i(e);i!=null&&(i.current=e)}function G2(...i){return e=>{let t=!1,s=i.map(r=>{let n=Nv(r,e);return!t&&typeof n=="function"&&(t=!0),n});if(t)return()=>{for(let r=0;r<s.length;r++){let n=s[r];typeof n=="function"?n():Nv(i[r],null)}}}}function K2(...i){return Se.useCallback(G2(...i),i)}var V2=Object.prototype.hasOwnProperty,W2=(i,e)=>{if(Object.is(i,e))return!0;if(typeof i!="object"||i===null||typeof e!="object"||e===null)return!1;if(Array.isArray(i))return!Array.isArray(e)||i.length!==e.length?!1:i.some((r,n)=>e[n]===r);let t=Object.keys(i),s=Object.keys(e);if(t.length!==s.length)return!1;for(let r=0;r<t.length;r++)if(!V2.call(e,t[r])||!Object.is(i[t[r]],e[t[r]]))return!1;return!0},R_=(i,e,t)=>!W2(e,i[t]),q2=(i,e,t)=>{i[t]=e},Y2=(i,e,t,s=q2,r=R_)=>Se.useEffect(()=>{let n=t?.current;n&&r(n,e,i)&&s(n,e,i)},[t?.current,e]),wi=Y2,j2=()=>{try{return"3.10.2"}catch{}return"UNKNOWN"},z2=j2(),Q2=()=>z2,Ke=(i,e,t)=>Se.useEffect(()=>{let s=e?.current;if(!s||!t)return;let r=i,n=t;return s.addEventListener(r,n),()=>{s.removeEventListener(r,n)}},[e?.current,t,i]),X2=ve.forwardRef(({children:i,...e},t)=>ve.createElement("mux-player",{suppressHydrationWarning:!0,...H2(e),ref:t},i)),Z2=(i,e)=>{let{onAbort:t,onCanPlay:s,onCanPlayThrough:r,onEmptied:n,onLoadStart:a,onLoadedData:o,onLoadedMetadata:l,onProgress:d,onDurationChange:u,onVolumeChange:c,onRateChange:h,onResize:f,onWaiting:m,onPlay:p,onPlaying:g,onTimeUpdate:v,onPause:b,onSeeking:E,onSeeked:T,onStalled:A,onSuspend:x,onEnded:S,onError:L,onCuePointChange:R,onChapterChange:I,metadata:M,tokens:B,paused:W,playbackId:j,playbackRates:K,currentTime:F,themeProps:Y,extraSourceParams:P,castCustomData:G,_hlsConfig:Z,...$}=e;return wi("tokens",B,i),wi("playbackId",j,i),wi("playbackRates",K,i),wi("metadata",M,i),wi("extraSourceParams",P,i),wi("_hlsConfig",Z,i),wi("themeProps",Y,i),wi("castCustomData",G,i),wi("paused",W,i,(H,se)=>{se!=null&&(se?H.pause():H.play())},(H,se,ge)=>H.hasAttribute("autoplay")&&!H.hasPlayed?!1:R_(H,se,ge)),wi("currentTime",F,i,(H,se)=>{se!=null&&(H.currentTime=se)}),Ke("abort",i,t),Ke("canplay",i,s),Ke("canplaythrough",i,r),Ke("emptied",i,n),Ke("loadstart",i,a),Ke("loadeddata",i,o),Ke("loadedmetadata",i,l),Ke("progress",i,d),Ke("durationchange",i,u),Ke("volumechange",i,c),Ke("ratechange",i,h),Ke("resize",i,f),Ke("waiting",i,m),Ke("play",i,p),Ke("playing",i,g),Ke("timeupdate",i,v),Ke("pause",i,b),Ke("seeking",i,E),Ke("seeked",i,T),Ke("stalled",i,A),Ke("suspend",i,x),Ke("ended",i,S),Ke("error",i,L),Ke("cuepointchange",i,R),Ke("chapterchange",i,I),[$]},J2=Q2(),eN="mux-player-react",tN=ve.forwardRef((i,e)=>{var t;let s=Se.useRef(null),r=K2(s,e),[n]=Z2(s,i),[a]=Se.useState((t=i.playerInitTime)!=null?t:ap());return ve.createElement(X2,{ref:r,defaultHiddenCaptions:i.defaultHiddenCaptions,playerSoftwareName:eN,playerSoftwareVersion:J2,playerInitTime:a,...n})}),iN=tN;const sN=U_({time:F_(),expiresAt:$_()}).transform(i=>({time:Number(i.time),expiresAt:new Date(i.expiresAt)}));function k_(){const i=Gv(),t=M_().find(s=>s.formAction==="/video-player");if(t&&t.state!=="idle"){const s=t.json;if(s)return{...i.preferences?.player,...s}}return i.preferences?.player??null}function Uv(i){const e=Se.useRef(i);return Se.useEffect(()=>{e.current=i},[i]),e}function rN({muxPlayerRef:i,...e}){const t=k_(),s=Bv(),[r,n]=Se.useState(!1),a=`${e.playbackId}:currentTime`,[o,l]=Se.useState(0),d=Uv(s),u=Uv(t);Se.useEffect(()=>{if(typeof document>"u")return;const h=sessionStorage.getItem(a);if(h)try{const{time:f,expiresAt:m}=sN.parse(JSON.parse(h));if(m.getTime()<Date.now())throw new Error("Time expired");l(f)}catch{sessionStorage.removeItem(a)}},[a]);const c=N_(()=>{const h=i.current;if(!h)return;const f=Array.from(h.textTracks??[]).find(p=>p.kind==="subtitles"),m={playbackRate:h.playbackRate,volumeRate:h.volume,subtitle:f?{id:f.id,mode:f.mode}:{id:null,mode:"disabled"}};Zf(m,u.current)||d.current.submit(m,{method:"POST",action:"/video-player",encType:"application/json"})},300);return Se.useEffect(()=>{if(!r)return;const h=i.current?.textTracks;if(!h)return;const f=setTimeout(()=>{const m=u.current?.subtitle;if(m?.id)try{const p=h.getTrackById(m.id);p&&(p.mode=m.mode??"hidden")}catch(p){console.warn("Failed to restore subtitle preferences:",p)}},100);return h.addEventListener("change",c),()=>{clearTimeout(f),h.removeEventListener("change",c)}},[r,i,u,c]),N.jsx("div",{className:"flex aspect-video flex-col",children:N.jsx(iN,{ref:i,playbackRates:[.5,.75,.8,.9,1,1.25,1.5,1.75,2,2.5,3,3.5,4],volume:t?.volumeRate??1,playbackRate:t?.playbackRate??1,thumbnailTime:o,onRateChange:c,onVolumeChange:c,streamType:"on-demand",defaultHiddenCaptions:!0,currentTime:o,onTimeUpdate:()=>sessionStorage.setItem(a,JSON.stringify({time:i.current?.currentTime,expiresAt:new Date(Date.now()+1e3*60*30).toISOString()})),accentColor:"#427cf0",targetLiveWindow:NaN,minResolution:nN(t?.minResolution),maxResolution:aN(t?.maxResolution),onLoadedMetadata:()=>n(!0),...e})})}function Zf(i,e){if(i===e)return!0;if(typeof i!=typeof e||typeof i!="object"||typeof e!="object"||i===null||e===null||Array.isArray(i)!==Array.isArray(e))return!1;if(Array.isArray(i)&&Array.isArray(e)){if(i.length!==e.length)return!1;for(let r=0;r<i.length;r++)if(!Zf(i[r],e[r]))return!1;return!0}const t=Object.keys(i),s=Object.keys(e);if(t.length!==s.length)return!1;for(const r of t)if(!Zf(i[r],e[r]))return!1;return!0}function nN(i){if(i)return i<=480?Xr.noLessThan480p:i<=540?Xr.noLessThan540p:i<=720?Xr.noLessThan720p:i<=1080?Xr.noLessThan1080p:i<=1440?Xr.noLessThan1440p:Xr.noLessThan2160p}function aN(i){if(i)return i<=720?ol.upTo720p:i<=1080?ol.upTo1080p:i<=1440?ol.upTo1440p:ol.upTo2160p}function oN({progress:i,size:e=16,strokeWidth:t=2,className:s}){const r=i===void 0,n=(e-t)/2,a=2*Math.PI*n,o=e/2,l=i!==void 0?Math.min(100,Math.max(0,i)):0,d=a-l/100*a;return N.jsxs("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,className:th(r&&"animate-spin","text-current",s),role:"progressbar","aria-valuenow":r?void 0:l,"aria-valuemin":0,"aria-valuemax":100,"aria-label":r?"Downloading...":`Download progress: ${l}%`,children:[N.jsx("circle",{cx:o,cy:o,r:n,fill:"none",stroke:"currentColor",strokeWidth:t,opacity:.25}),N.jsx("circle",{cx:o,cy:o,r:n,fill:"none",stroke:"currentColor",strokeWidth:t,strokeLinecap:"round",strokeDasharray:a,strokeDashoffset:r?a*.75:d,transform:`rotate(-90 ${o} ${o})`,className:th(!r&&"transition-[stroke-dashoffset] duration-300 ease-out")})]})}function lN(i){return N.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",...i,children:N.jsx("path",{fill:"currentColor",d:"M10 2a1 1 0 0 1 1 1v7.59l2.3-2.3a1 1 0 1 1 1.4 1.42l-4 4a1 1 0 0 1-1.4 0l-4-4a1 1 0 1 1 1.4-1.42l2.3 2.3V3a1 1 0 0 1 1-1Zm-6 12a1 1 0 0 1 1 1v1h10v-1a1 1 0 1 1 2 0v2a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1Z"})})}function dN(i){return N.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...i,children:[N.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M6.75 7.75L7.59115 17.4233C7.68102 18.4568 8.54622 19.25 9.58363 19.25H14.4164C15.4538 19.25 16.319 18.4568 16.4088 17.4233L17.25 7.75"}),N.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M9.75 7.5V6.75C9.75 5.64543 10.6454 4.75 11.75 4.75H12.25C13.3546 4.75 14.25 5.64543 14.25 6.75V7.5"}),N.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M5 7.75H19"})]})}function uN({isAvailable:i,isBusy:e=!1,downloadProgress:t,onDownload:s,onDelete:r}){const n=e&&!i,a=n,o=i?"Delete offline video":n?t!==void 0?`Downloading: ${Math.round(t)}%`:"Downloading...":"Download offline video",l=i?r:s,d=i?"text-foreground-destructive hover:bg-foreground-destructive/10":"text-foreground hover:bg-muted";return N.jsx(B_,{content:o,children:N.jsx("button",{type:"button",onClick:l,disabled:e,className:`${d} inline-flex h-7 w-7 items-center justify-center rounded disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":o,children:a?N.jsx(oN,{progress:t,size:16,strokeWidth:2,className:"h-4 w-4"}):i?N.jsx(dN,{className:"h-4 w-4"}):N.jsx(lN,{className:"h-4 w-4"})})})}const D_=Se.createContext(null),$v={best:"best available",high:"high",medium:"medium",low:"low"};function cN(i){return i==="high"||i==="medium"||i==="low"?$v[i]:$v.best}function hN(i,e){const[t,s]=Se.useState(!1),[r,n]=Se.useState(!1),a=`/resources/offline-videos/${encodeURIComponent(i)}`;return Se.useEffect(()=>{if(typeof window>"u")return;s(!1),n(!1);const o=new AbortController;let l=!0;return fetch(a,{method:"HEAD",signal:o.signal}).then(d=>{l&&s(d.ok)}).catch(()=>{l&&s(!1)}).finally(()=>{l&&n(!0)}),()=>{l=!1,o.abort()}},[a,e]),{available:t,checked:r,offlineUrl:a}}function fN(){return N.jsx("div",{className:"relative aspect-video w-full shrink-0 shadow-lg",children:N.jsx("div",{className:"text-foreground-destructive absolute inset-0 z-10 flex items-center justify-center p-8",children:N.jsx(Jf,{name:"WifiNoConnection",size:"xl",children:N.jsxs("span",{children:["Offline video not available. Download offline videos in"," ",N.jsx(Ln,{to:"/preferences",className:"underline",children:"Preferences"}),"."]})})})})}function n3({children:i,epicVideoInfosPromise:e}){return N.jsx(D_.Provider,{value:e,children:i})}function C_(i){let e=new URL("https://epicweb.dev");try{e=new URL(i)}catch(c){return console.error(c),"Epic Video"}const t=e.pathname.split("/").filter(Boolean),s=t.includes("solution");let r=t.pop();const n=["problem","solution","embed","exercise"],a=c=>c&&!n.includes(c);for(;!a(r);)r=t.pop();if(!r)return"Epic Video";r=r.replace(/~[^ ]*$/,"");const o=r.split("-"),l=["the","a","an","and","but","or","for","nor","on","at","to","from","by","of","in","with","as","npm","git","ssh","cli"],d=["OAuth","UI","UX","API","CSS","HTML","JS","TS","SVG","AI","CSRF","CORS","HTTP","HTTPS","URL","URI","DB","SQL","JSON","YAML","YML","useActionData","useAsyncError","useAsyncValue","useBeforeUnload","useFetcher","useFetchers","useFormAction","useHref","useLoaderData","useLocation","useMatches","useNavigate","useNavigation","useNavigationType","useOutlet","useOutletContext","useParams","useResolvedPath","useRevalidator","useRouteError","useRouteLoaderData","useSearchParams","useSubmit","useCallback","useContext","useDebugValue","useDeferredValue","useEffect","useId","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useReducer","useRef","useState","useSyncExternalStore","useTransition","useForm","useFieldset","useFieldList","useEventSource","useHydrated","useAuthenticityToken","useShouldHydrate","useGlobalNavigationState","useLocales","useDelegatedAnchors","useDebounceFetcher","useFetcherType"],u=o.filter(Boolean).map((c,h)=>{const f=c.toLowerCase(),m=d.find(p=>p.toLowerCase()===f);return m||(l.includes(f)&&h>0?f:f[0]?.toUpperCase()+f.slice(1))}).join(" ");return s?`${u} (🏁 solution)`:u}function mN({url:i,title:e="Video Embed",loadingContent:t=N.jsx(yu,{children:N.jsxs("span",{children:['Loading "',e,'"']})})}){const s=Hv(),[r,n]=Se.useState(!1);return Kv()?N.jsxs("div",{className:"relative aspect-video w-full shrink-0 shadow-lg",children:[r?null:N.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center p-8",children:t}),N.jsx("iframe",{onLoad:()=>n(!0),onError:()=>n(!0),src:i,className:th("absolute inset-0 flex h-full w-full transition-opacity duration-300",r?"opacity-100":"opacity-0"),title:e,sandbox:"allow-forms allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox",allowFullScreen:!0,style:{colorScheme:s}})]}):N.jsx("div",{className:"not-prose relative aspect-video w-full shrink-0 shadow-lg",children:N.jsx("div",{className:"text-foreground-destructive absolute inset-0 z-10 flex items-center justify-center p-8",children:N.jsx(Jf,{name:"WifiNoConnection",size:"xl",children:N.jsxs("span",{children:["Unable to load the video ",N.jsx("a",{href:i,className:"underline",children:`"${e??i}"`})," when offline"]})})})})}function w_({url:i,title:e,duration:t,durationEstimate:s,actions:r}){return N.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-base",children:[r?N.jsx("span",{className:"flex items-center gap-1",children:r}):null,t?N.jsx("span",{className:"opacity-70",children:Fv(t)}):s?N.jsxs("span",{className:"opacity-70",children:["~",Fv(s)]}):null,N.jsxs("a",{href:i,target:"_blank",className:"flex items-center gap-1 no-underline opacity-70 transition hover:underline hover:opacity-100",rel:"noreferrer",children:[N.jsx(Jf,{className:"shrink-0",name:"Video",size:"lg"}),e," ",N.jsx("span",{"aria-hidden":!0,children:"↗︎"})]})]})}function a3({url:i,title:e}){const t=e??C_(i),{product:{host:s,displayName:r}}=G_(),n=H_(),a=Se.useContext(D_),o=N.jsx(w_,{url:i,title:t});return N.jsx("div",{className:"not-prose",children:N.jsx(Se.Suspense,{fallback:N.jsxs("div",{children:[N.jsx("div",{className:"flex aspect-video w-full items-center justify-center",children:N.jsx(yu,{children:t})}),N.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[o,N.jsx("div",{className:"h-[32px]"})]})]}),children:N.jsx(P_,{errorElement:N.jsx("div",{children:"Sorry, failed loading videos. Check the terminal output?"}),resolve:a,children:l=>{const d=l?.[i],u=ENV.EPICSHOP_DEPLOYED?N.jsxs("div",{children:[N.jsx(Ln,{to:ENV.EPICSHOP_GITHUB_REPO,className:"underline",children:"Run locally"})," for transcripts"]}):N.jsxs("div",{children:[N.jsx(Ln,{to:"/login",className:"underline",children:n?"Upgrade":"Login"})," for transcripts"]});if(!d)return N.jsxs("div",{children:[N.jsx(Ea,{url:i,title:t}),N.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[o,u]})]});const c=d;return c.status==="success"?N.jsx(pN,{url:i,title:e??c.title??t,muxPlaybackId:c.muxPlaybackId,transcript:c.transcript,duration:c.duration,durationEstimate:c.durationEstimate}):c.type==="region-restricted"?N.jsxs("div",{children:[N.jsxs("div",{className:"flex aspect-video min-h-full min-w-full flex-col items-center justify-start gap-2 overflow-y-scroll border-2 p-4 lg:justify-center lg:gap-4 lg:text-xl",children:[N.jsx("div",{className:"text-foreground-destructive",children:"Error: Region Restricted"}),N.jsxs("div",{children:["We've detected you're connecting from"," ",c.requestCountry," but your license has restricted access to ",c.restrictedCountry]}),N.jsxs("div",{children:["To continue watching uninterrupted, please"," ",N.jsxs("a",{href:`https://${s}/products`,className:"underline",children:["upgrade your ",r," license"]})," ","to a full Pro license."]})]}),N.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[o,N.jsxs("div",{children:[N.jsx(Ln,{to:`https://${s}/products`,className:"underline",children:"Upgrade"})," for transcripts"]})]})]}):c.statusCode===401?N.jsxs("div",{children:[N.jsx(Ea,{url:i,title:t}),N.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[o,u]})]}):c.statusCode===403?N.jsxs("div",{children:[N.jsx(Ea,{url:i,title:t}),N.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[o,N.jsxs("div",{children:[N.jsx(Ln,{to:`https://${s}/products`,className:"underline",children:"Upgrade"})," for transcripts"]})]})]}):c.statusCode===404?N.jsxs("div",{children:[N.jsx(Ea,{url:i,title:t}),N.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[o,N.jsx("div",{children:"Transcripts not found"})]})]}):(console.error(c),N.jsxs("div",{children:[N.jsx(Ea,{url:i,title:t}),N.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[o,N.jsx("div",{className:"text-foreground-destructive",children:"Unknown error (check console)"})]})]}))}})})})}function pN({url:i,title:e=C_(i),muxPlaybackId:t,transcript:s,duration:r,durationEstimate:n}){const a=Se.useRef(null),o=Se.useRef(null),l=Kv(),d=k_(),u=Gv(),c=cN(u.preferences?.offlineVideo?.downloadResolution),[h,f]=Se.useState(0),m=hN(t,h),p=m.available,g=Bv(),v=g.state!=="idle",[b,E]=Se.useState(void 0),T=v&&!m.available,A=O_(`/resources/offline-video-progress/${encodeURIComponent(t)}`,{enabled:T});Se.useEffect(()=>{if(A)try{const P=JSON.parse(A);if(P.status==="complete"||P.status==="error"){E(void 0);return}if(P.totalBytes&&P.totalBytes>0){const G=P.bytesDownloaded/P.totalBytes*100;E(G)}else E(void 0)}catch{}},[A]),Se.useEffect(()=>{T||E(void 0)},[T]);const x=`${t}:currentTime`,[S,L]=Se.useState(null),R=/(\d+:\d+)/g,I=[];let M,B=0;for(;M=R.exec(s);){const P=M[1];if(!R.lastIndex||!P)break;const G=M.index,Z=R.lastIndex,$=s.slice(B+1,G-1);I.push(N.jsx("span",{children:$},`span-${G}`)),I.push(N.jsx("button",{className:"underline",onClick:H=>{const se=o.current??a.current;if(se){se.currentTime=gN(P);try{se.play().catch(()=>{})}catch{}se.scrollIntoView({behavior:"smooth",inline:"center",block:"start"}),H.currentTarget.blur()}},children:P},`button-${G}`)),B=Z}I.push(N.jsx("span",{children:s.slice(B+1,s.length)},s.length)),Se.useEffect(()=>{o.current&&(typeof d?.playbackRate=="number"&&(o.current.playbackRate=d.playbackRate),typeof d?.volumeRate=="number"&&(o.current.volume=d.volumeRate))},[d?.playbackRate,d?.volumeRate,p]),Se.useEffect(()=>{if(!p||typeof document>"u")return;const P=sessionStorage.getItem(x);if(!P){L(null);return}try{const G=JSON.parse(P),Z=G.expiresAt?new Date(G.expiresAt).getTime():0;if(typeof G.time!="number"||Number.isNaN(G.time)||!Z||Z<Date.now())throw new Error("Time expired");L(G.time)}catch{sessionStorage.removeItem(x),L(null)}},[x,p]),Se.useEffect(()=>{if(!p)return;const P=o.current;if(!P||S==null)return;const G=()=>{const Z=Number.isFinite(P.duration)?P.duration:0,$=Z?Math.min(S,Math.max(Z-1,0)):S;$>0&&(P.currentTime=$)};if(P.readyState>=1){G();return}return P.addEventListener("loadedmetadata",G),()=>{P.removeEventListener("loadedmetadata",G)}},[S,p]);const W=Se.useCallback(()=>{if(typeof document>"u")return;const P=o.current;if(!P)return;const G=Number.isFinite(P.duration)?P.duration:0;if(G&&G-P.currentTime<=1){sessionStorage.removeItem(x);return}sessionStorage.setItem(x,JSON.stringify({time:P.currentTime,expiresAt:new Date(Date.now()+1e3*60*30).toISOString()}))},[x]);Se.useEffect(()=>{g.state==="idle"&&g.data?.status&&f(P=>P+1)},[g.state,g.data]),Se.useEffect(()=>{if(g.state!=="idle")return;const P=g.data;if(!P||P.action!=="download"||P.status!=="error")return;const G=P.message??"Offline video download failed. Check the terminal logs.";$p.error("Offline video download failed",{description:G})},[g.state,g.data]);const j=Se.useCallback(()=>{$p.success(`Download of ${e} has started (${c} quality).`,{description:N.jsxs("span",{children:["Go to"," ",N.jsx(Ln,{className:"underline",to:"/preferences",children:"Preferences"})," ","to download all workshop videos at once."]})}),g.submit({intent:"download-video",playbackId:t,title:e,url:i},{method:"post",action:"/resources/offline-videos"})},[t,g,e,i,c]),K=Se.useCallback(()=>{g.submit({intent:"delete-video",playbackId:t},{method:"post",action:"/resources/offline-videos"})},[t,g]),F=Se.useCallback(P=>{P&&P.setAttribute("seekoffset","10")},[]),Y=N.jsx(uN,{isAvailable:m.available,isBusy:v,downloadProgress:b,onDownload:j,onDelete:K});return N.jsxs("div",{children:[N.jsx("div",{className:"shadow-lg",children:p?N.jsx("div",{className:"flex aspect-video w-full items-center justify-center bg-black",children:N.jsxs(gI,{tabIndex:0,"aria-label":`${e} video player`,onPointerDown:P=>{P.currentTarget.focus()},className:"focus-visible:ring-ring flex h-full w-full flex-col justify-end outline-none focus-visible:ring-2 focus-visible:ring-offset-2",style:{"--media-primary-color":"hsl(var(--background))","--media-text-color":"hsl(var(--background))","--media-secondary-color":"transparent","--media-control-background":"transparent","--media-control-hover-background":"hsl(var(--background) / 0.18)","--media-control-height":"18px","--media-range-padding":"2px","--media-time-range-hover-height":"18px","--media-time-range-hover-bottom":"-4px","--media-range-track-height":"3px","--media-range-thumb-height":"8px","--media-range-thumb-width":"8px","--media-range-track-background":"hsl(var(--background) / 0.35)","--media-range-track-pointer-background":"hsl(var(--background) / 0.85)"},children:[N.jsx("video",{ref:o,slot:"media","aria-label":e,className:"h-full w-full",playsInline:!0,preload:"metadata",src:m.offlineUrl,onTimeUpdate:W}),N.jsxs("div",{className:"bg-foreground/40 text-background w-full space-y-1 px-3 pt-1 pb-1.5 text-sm leading-none backdrop-blur select-none",children:[N.jsx(xI,{className:"w-full"}),N.jsxs(vI,{className:"w-full items-center gap-3",children:[N.jsxs("div",{className:"flex items-center gap-3",children:[N.jsx(_I,{}),N.jsx(AI,{ref:F,seekOffset:10}),N.jsx(SI,{ref:F,seekOffset:10}),N.jsx(II,{showDuration:!0,className:"text-background text-xs tabular-nums"}),N.jsx(yI,{}),N.jsx(LI,{className:"w-24"})]}),N.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[N.jsx(TI,{className:"text-background text-xs",rates:[.5,.75,.8,.9,1,1.25,1.5,1.75,2,2.5,3,3.5,4]}),N.jsx(bI,{}),N.jsx(EI,{})]})]})]})]})}):!l&&m.checked?N.jsx(fN,{}):l?N.jsx(rN,{playbackId:t,muxPlayerRef:a,title:e}):N.jsx("div",{className:"flex aspect-video w-full items-center justify-center",children:N.jsx(yu,{children:"Checking offline videos..."})})}),N.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[N.jsx(w_,{url:i,title:e,duration:r,durationEstimate:n,actions:Y}),N.jsxs("details",{children:[N.jsx("summary",{children:"Transcript"}),N.jsx("div",{className:"bg-accent text-accent-foreground rounded-md p-2 whitespace-pre-line",children:I})]})]})]})}function gN(i){const e=i.split(":");let t=0,s=1;for(;e.length>0;)t+=s*parseInt(e.pop()??"0",10),s*=60;return t}function Fv(i){const e=Math.floor(i/3600),t=Math.floor(i%3600/60),s=Math.floor(i%60);return e>0?`${e}:${t.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`:`${t}:${s.toString().padStart(2,"0")}`}function Ea({url:i,title:e}){const t=Hv();let s=new URL("https://epicweb.dev");try{s=new URL(i)}catch(r){return console.error(r),N.jsxs("div",{children:['Invalid URL: "',i,'"']})}return s.pathname=s.pathname.endsWith("/")?`${s.pathname}embed`:`${s.pathname}/embed`,s.searchParams.set("theme",t),s.host==="www.epicai.pro"&&!s.pathname.startsWith("/workshops/")&&(s.pathname=`/posts/${s.pathname}`),N.jsx(mN,{url:s.toString(),title:e,loadingContent:N.jsx(yu,{children:N.jsxs("span",{children:['Loading "',N.jsx("a",{className:"underline",href:i,children:e}),'"']})})})}export{a3 as D,n3 as E,mN as V};
3386
+ //# sourceMappingURL=epic-video-Ca_s42j5.js.map