@epic-web/workshop-app 4.10.0 → 4.11.0

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 (26) hide show
  1. package/build/client/assets/{_exerciseNumber-CfF6tJcN.js → _exerciseNumber-Dkx8NKtT.js} +2 -2
  2. package/build/client/assets/{_exerciseNumber-CfF6tJcN.js.map → _exerciseNumber-Dkx8NKtT.js.map} +1 -1
  3. package/build/client/assets/{_exerciseNumber_.finished-CykPBfYE.js → _exerciseNumber_.finished-F2R0-zEk.js} +2 -2
  4. package/build/client/assets/{_exerciseNumber_.finished-CykPBfYE.js.map → _exerciseNumber_.finished-F2R0-zEk.js.map} +1 -1
  5. package/build/client/assets/_layout-ChfAsQ5r.js +2 -0
  6. package/build/client/assets/_layout-ChfAsQ5r.js.map +1 -0
  7. package/build/client/assets/{diff-PfwTHr6-.js → diff-Bn3MiSoW.js} +2 -2
  8. package/build/client/assets/{diff-PfwTHr6-.js.map → diff-Bn3MiSoW.js.map} +1 -1
  9. package/build/client/assets/{diff-P5f7-8E4.js → diff-D_ZEQzD1.js} +2 -2
  10. package/build/client/assets/{diff-P5f7-8E4.js.map → diff-D_ZEQzD1.js.map} +1 -1
  11. package/build/client/assets/{epic-video-CYnG2ziQ.js → epic-video-zHEt2DZr.js} +2 -2
  12. package/build/client/assets/{epic-video-CYnG2ziQ.js.map → epic-video-zHEt2DZr.js.map} +1 -1
  13. package/build/client/assets/{finished-zLjWvstg.js → finished-rHvmuqsw.js} +2 -2
  14. package/build/client/assets/{finished-zLjWvstg.js.map → finished-rHvmuqsw.js.map} +1 -1
  15. package/build/client/assets/{index-BXefr1BB.js → index-CUL9cfRQ.js} +2 -2
  16. package/build/client/assets/{index-BXefr1BB.js.map → index-CUL9cfRQ.js.map} +1 -1
  17. package/build/client/assets/{manifest-902d83c3.js → manifest-ad8216cb.js} +1 -1
  18. package/build/client/assets/{mdx-CR7Me1v_.js → mdx-Cdbs0d3z.js} +2 -2
  19. package/build/client/assets/{mdx-CR7Me1v_.js.map → mdx-Cdbs0d3z.js.map} +1 -1
  20. package/build/client/assets/{onboarding-b9lcdh4n.js → onboarding-BbvoMBUW.js} +2 -2
  21. package/build/client/assets/{onboarding-b9lcdh4n.js.map → onboarding-BbvoMBUW.js.map} +1 -1
  22. package/build/server/index.js +45 -27
  23. package/build/server/index.js.map +1 -1
  24. package/package.json +3 -3
  25. package/build/client/assets/_layout-CGxjCoIB.js +0 -2
  26. package/build/client/assets/_layout-CGxjCoIB.js.map +0 -1
@@ -2984,5 +2984,5 @@ media-poster-image:not([src]):not([placeholdersrc]) {
2984
2984
  </media-controller>
2985
2985
  </template>
2986
2986
  `,zf=As.createElement("template");"innerHTML"in zf&&(zf.innerHTML=KM);var zg,Xg,JT=class extends go{};JT.template=(Xg=(zg=zf.content)==null?void 0:zg.children)==null?void 0:Xg[0];lt.customElements.get("media-theme-gerwig")||lt.customElements.define("media-theme-gerwig",JT);var VM="gerwig",qi={SRC:"src",POSTER:"poster"},$={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",ACCENT_COLOR:"accent-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",DEFAULT_DURATION:"default-duration",TITLE:"title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",EXTRA_SOURCE_PARAMS:"extra-source-params",NO_VOLUME_PREF:"no-volume-pref"},Xf=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","novolumepref"];function qM(i,e){var t;return{src:!i.playbackId&&i.src,playbackId:i.playbackId,hasSrc:!!i.playbackId||!!i.src,poster:i.poster,storyboard:i.storyboard,storyboardSrc:i.getAttribute($.STORYBOARD_SRC),placeholder:i.getAttribute("placeholder"),themeTemplate:YM(i),thumbnailTime:!i.tokens.thumbnail&&i.thumbnailTime,autoplay:i.autoplay,crossOrigin:i.crossOrigin,loop:i.loop,noHotKeys:i.hasAttribute($.NOHOTKEYS),hotKeys:i.getAttribute($.HOTKEYS),muted:i.muted,paused:i.paused,preload:i.preload,envKey:i.envKey,preferCmcd:i.preferCmcd,debug:i.debug,disableTracking:i.disableTracking,disableCookies:i.disableCookies,tokens:i.tokens,beaconCollectionDomain:i.beaconCollectionDomain,maxResolution:i.maxResolution,minResolution:i.minResolution,programStartTime:i.programStartTime,programEndTime:i.programEndTime,renditionOrder:i.renditionOrder,metadata:i.metadata,playerSoftwareName:i.playerSoftwareName,playerSoftwareVersion:i.playerSoftwareVersion,startTime:i.startTime,preferPlayback:i.preferPlayback,audio:i.audio,defaultStreamType:i.defaultStreamType,targetLiveWindow:i.getAttribute(P.TARGET_LIVE_WINDOW),streamType:_p(i.getAttribute(P.STREAM_TYPE)),primaryColor:i.getAttribute($.PRIMARY_COLOR),secondaryColor:i.getAttribute($.SECONDARY_COLOR),accentColor:i.getAttribute($.ACCENT_COLOR),forwardSeekOffset:i.forwardSeekOffset,backwardSeekOffset:i.backwardSeekOffset,defaultHiddenCaptions:i.defaultHiddenCaptions,defaultDuration:i.defaultDuration,defaultShowRemainingTime:i.defaultShowRemainingTime,hideDuration:jM(i),playbackRates:i.getAttribute($.PLAYBACK_RATES),customDomain:(t=i.getAttribute(P.CUSTOM_DOMAIN))!=null?t:void 0,title:i.getAttribute($.TITLE),novolumepref:i.hasAttribute($.NO_VOLUME_PREF),...e,extraSourceParams:i.extraSourceParams}}function YM(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=lt.customElements.get(s);if(n!=null&&n.template)return n.template}}function jM(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 Qg(i){let e=i.hasAttribute($.TITLE)?{video_title:i.getAttribute($.TITLE)}:{};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 zM=Object.values(P),XM=Object.values(qi),QM=Object.values($),ZM=WT(),JM="mux-player",Zg={dialog:void 0,isDialogOpen:!1},e2={redundant_streams:!0},Rd,wd,Js,Cd,In,Yi,fs,Qf,e_,Ac,Zf,tr,hn,Jf,Jg,em,ev,tm,tv,im,iv,sv=class extends Vg{constructor(){super(),ht(this,Yi),ht(this,Qf),ht(this,Ac),ht(this,tr),ht(this,Jf),ht(this,em),ht(this,tm),ht(this,im),ht(this,Rd,!1),ht(this,wd,{}),ht(this,Js,!0),ht(this,Cd,new yM(this,"hotkeys")),ht(this,In,{...Zg,onCloseErrorDialog:()=>ze(this,Ac,Zf).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:e=>{GT(this,As.activeElement)||e.preventDefault()}}),this.attachShadow({mode:"open"}),ze(this,Qf,e_).call(this),this.isConnected&&ze(this,Yi,fs).call(this)}static get observedAttributes(){var e;return[...(e=Vg.observedAttributes)!=null?e:[],...XM,...zM,...QM]}get mediaTheme(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("media-theme")}get mediaController(){var e,t;return(t=(e=this.mediaTheme)==null?void 0:e.shadowRoot)==null?void 0:t.querySelector("media-controller")}connectedCallback(){var e;let t=(e=this.shadowRoot)==null?void 0:e.querySelector("mux-video");t&&(t.metadata=Qg(this))}attributeChangedCallback(e,t,s){switch(ze(this,Yi,fs).call(this),super.attributeChangedCallback(e,t,s),e){case $.HOTKEYS:Te(this,Cd).value=s;break;case $.THUMBNAIL_TIME:{s!=null&&this.tokens.thumbnail&&cr(fe("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case $.THUMBNAIL_TOKEN:{let{aud:r}=lo(s);s&&r!=="t"&&cr(fe("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:r}));break}case $.STORYBOARD_TOKEN:{let{aud:r}=lo(s);s&&r!=="s"&&cr(fe("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:r}));break}case P.PLAYBACK_ID:{s!=null&&s.includes("?token")&&ri(fe("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:s}));break}case P.STREAM_TYPE:s&&![_e.LIVE,_e.ON_DEMAND,_e.UNKNOWN].includes(s)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=s.includes("dvr")?Number.POSITIVE_INFINITY:0:VT({file:"invalid-stream-type.md",message:fe("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):s===_e.LIVE?this.getAttribute($.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN}[P.PLAYBACK_ID,qi.SRC,$.PLAYBACK_TOKEN].includes(e)&&t!==s&&Zi(this,In,{...Te(this,In),...Zg}),ze(this,tr,hn).call(this,{[bM(e)]:s})}get preferCmcd(){var e;return(e=this.getAttribute(P.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?jd.includes(e)?this.setAttribute(P.PREFER_CMCD,e):cr(`Invalid value for preferCmcd. Must be one of ${jd.join()}`):this.removeAttribute(P.PREFER_CMCD))}get hasPlayed(){var e,t;return(t=(e=this.mediaController)==null?void 0:e.hasAttribute(T.MEDIA_HAS_PLAYED))!=null?t:!1}get inLiveWindow(){var e;return(e=this.mediaController)==null?void 0:e.hasAttribute(T.MEDIA_TIME_IS_LIVE)}get _hls(){var e;return(e=this.media)==null?void 0:e._hls}get mux(){var e;return(e=this.media)==null?void 0:e.mux}get theme(){var e;return(e=this.getAttribute($.THEME))!=null?e:VM}set theme(e){this.setAttribute($.THEME,`${e}`)}get themeProps(){let e=this.mediaTheme;if(!e)return;let t={};for(let s of e.getAttributeNames()){if(Xf.includes(s))continue;let r=e.getAttribute(s);t[$T(s)]=r===""?!0:r}return t}set themeProps(e){var t,s;ze(this,Yi,fs).call(this);let r={...this.themeProps,...e};for(let n in r){if(Xf.includes(n))continue;let a=e==null?void 0:e[n];typeof a=="boolean"||a==null?(t=this.mediaTheme)==null||t.toggleAttribute(qf(n),!!a):(s=this.mediaTheme)==null||s.setAttribute(qf(n),a)}}get playbackId(){var e;return(e=this.getAttribute(P.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e?this.setAttribute(P.PLAYBACK_ID,e):this.removeAttribute(P.PLAYBACK_ID)}get src(){var e,t;return this.playbackId?(e=Ds(this,qi.SRC))!=null?e:void 0:(t=this.getAttribute(qi.SRC))!=null?t:void 0}set src(e){e?this.setAttribute(qi.SRC,e):this.removeAttribute(qi.SRC)}get poster(){var e;let t=this.getAttribute(qi.POSTER);if(t!=null)return t;if(this.playbackId&&!this.audio)return gM(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(e=this.thumbnailTime)!=null?e:this.startTime,programTime:this.programStartTime,token:this.tokens.thumbnail})}set poster(e){e||e===""?this.setAttribute(qi.POSTER,e):this.removeAttribute(qi.POSTER)}get storyboardSrc(){var e;return(e=this.getAttribute($.STORYBOARD_SRC))!=null?e:void 0}set storyboardSrc(e){e?this.setAttribute($.STORYBOARD_SRC,e):this.removeAttribute($.STORYBOARD_SRC)}get storyboard(){if(this.storyboardSrc&&!this.tokens.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[_e.LIVE,_e.UNKNOWN].includes(this.streamType)))return vM(this.playbackId,{customDomain:this.customDomain,token:this.tokens.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute($.AUDIO)}set audio(e){if(!e){this.removeAttribute($.AUDIO);return}this.setAttribute($.AUDIO,"")}get hotkeys(){return Te(this,Cd)}get nohotkeys(){return this.hasAttribute($.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute($.NOHOTKEYS);return}this.setAttribute($.NOHOTKEYS,"")}get thumbnailTime(){return xi(this.getAttribute($.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute($.THUMBNAIL_TIME,`${e}`)}get title(){var e;return(e=this.getAttribute($.TITLE))!=null?e:""}set title(e){e!==this.title&&(e?this.setAttribute($.TITLE,e):this.removeAttribute("title"),super.title=e)}get placeholder(){var e;return(e=Ds(this,$.PLACEHOLDER))!=null?e:""}set placeholder(e){this.setAttribute($.PLACEHOLDER,`${e}`)}get primaryColor(){var e,t;let s=this.getAttribute($.PRIMARY_COLOR);if(s!=null||this.mediaTheme&&(s=(t=(e=lt.getComputedStyle(this.mediaTheme))==null?void 0:e.getPropertyValue("--_primary-color"))==null?void 0:t.trim(),s))return s}set primaryColor(e){this.setAttribute($.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var e,t;let s=this.getAttribute($.SECONDARY_COLOR);if(s!=null||this.mediaTheme&&(s=(t=(e=lt.getComputedStyle(this.mediaTheme))==null?void 0:e.getPropertyValue("--_secondary-color"))==null?void 0:t.trim(),s))return s}set secondaryColor(e){this.setAttribute($.SECONDARY_COLOR,`${e}`)}get accentColor(){var e,t;let s=this.getAttribute($.ACCENT_COLOR);if(s!=null||this.mediaTheme&&(s=(t=(e=lt.getComputedStyle(this.mediaTheme))==null?void 0:e.getPropertyValue("--_accent-color"))==null?void 0:t.trim(),s))return s}set accentColor(e){this.setAttribute($.ACCENT_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute($.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute($.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute($.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute($.PLAYBACK_RATES))return this.getAttribute($.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,t)=>e-t)}set playbackRates(e){if(!e){this.removeAttribute($.PLAYBACK_RATES);return}this.setAttribute($.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return(e=xi(this.getAttribute($.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute($.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=xi(this.getAttribute($.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute($.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute($.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute($.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute($.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return xi(this.getAttribute($.DEFAULT_DURATION))}set defaultDuration(e){e==null?this.removeAttribute($.DEFAULT_DURATION):this.setAttribute($.DEFAULT_DURATION,`${e}`)}get playerSoftwareName(){var e;return(e=this.getAttribute(P.PLAYER_SOFTWARE_NAME))!=null?e:JM}get playerSoftwareVersion(){var e;return(e=this.getAttribute(P.PLAYER_SOFTWARE_VERSION))!=null?e:ZM}get beaconCollectionDomain(){var e;return(e=this.getAttribute(P.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(P.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(P.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var e;return(e=this.getAttribute(P.MAX_RESOLUTION))!=null?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(P.MAX_RESOLUTION,e):this.removeAttribute(P.MAX_RESOLUTION))}get minResolution(){var e;return(e=this.getAttribute(P.MIN_RESOLUTION))!=null?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(P.MIN_RESOLUTION,e):this.removeAttribute(P.MIN_RESOLUTION))}get renditionOrder(){var e;return(e=this.getAttribute(P.RENDITION_ORDER))!=null?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(P.RENDITION_ORDER,e):this.removeAttribute(P.RENDITION_ORDER))}get programStartTime(){return xi(this.getAttribute(P.PROGRAM_START_TIME))}set programStartTime(e){e==null?this.removeAttribute(P.PROGRAM_START_TIME):this.setAttribute(P.PROGRAM_START_TIME,`${e}`)}get programEndTime(){return xi(this.getAttribute(P.PROGRAM_END_TIME))}set programEndTime(e){e==null?this.removeAttribute(P.PROGRAM_END_TIME):this.setAttribute(P.PROGRAM_END_TIME,`${e}`)}get extraSourceParams(){return this.hasAttribute($.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute($.EXTRA_SOURCE_PARAMS)).entries()].reduce((e,[t,s])=>(e[t]=s,e),{}):e2}set extraSourceParams(e){e==null?this.removeAttribute($.EXTRA_SOURCE_PARAMS):this.setAttribute($.EXTRA_SOURCE_PARAMS,new URLSearchParams(e).toString())}get customDomain(){var e;return(e=this.getAttribute(P.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(P.CUSTOM_DOMAIN,e):this.removeAttribute(P.CUSTOM_DOMAIN))}get envKey(){var e;return(e=Ds(this,P.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(P.ENV_KEY,`${e}`)}get noVolumePref(){return this.hasAttribute($.NO_VOLUME_PREF)}set noVolumePref(e){e?this.setAttribute($.NO_VOLUME_PREF,""):this.removeAttribute($.NO_VOLUME_PREF)}get debug(){return Ds(this,P.DEBUG)!=null}set debug(e){e?this.setAttribute(P.DEBUG,""):this.removeAttribute(P.DEBUG)}get disableTracking(){return Ds(this,P.DISABLE_TRACKING)!=null}set disableTracking(e){this.toggleAttribute(P.DISABLE_TRACKING,!!e)}get disableCookies(){return Ds(this,P.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(P.DISABLE_COOKIES,""):this.removeAttribute(P.DISABLE_COOKIES)}get streamType(){var e,t,s;return(s=(t=this.getAttribute(P.STREAM_TYPE))!=null?t:(e=this.media)==null?void 0:e.streamType)!=null?s:_e.UNKNOWN}set streamType(e){this.setAttribute(P.STREAM_TYPE,`${e}`)}get defaultStreamType(){var e,t,s;return(s=(t=this.getAttribute($.DEFAULT_STREAM_TYPE))!=null?t:(e=this.mediaController)==null?void 0:e.getAttribute($.DEFAULT_STREAM_TYPE))!=null?s:_e.ON_DEMAND}set defaultStreamType(e){e?this.setAttribute($.DEFAULT_STREAM_TYPE,e):this.removeAttribute($.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var e,t;return this.hasAttribute($.TARGET_LIVE_WINDOW)?+this.getAttribute($.TARGET_LIVE_WINDOW):(t=(e=this.media)==null?void 0:e.targetLiveWindow)!=null?t:Number.NaN}set targetLiveWindow(e){e==this.targetLiveWindow||Number.isNaN(e)&&Number.isNaN(this.targetLiveWindow)||(e==null?this.removeAttribute($.TARGET_LIVE_WINDOW):this.setAttribute($.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e;return(e=this.media)==null?void 0:e.liveEdgeStart}get startTime(){return xi(Ds(this,P.START_TIME))}set startTime(e){this.setAttribute(P.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(P.PREFER_PLAYBACK);if(e===Ci.MSE||e===Ci.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===Ci.MSE||e===Ci.NATIVE?this.setAttribute(P.PREFER_PLAYBACK,e):this.removeAttribute(P.PREFER_PLAYBACK))}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){if(ze(this,Yi,fs).call(this),!this.media){ri("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...Qg(this),...e}}get _hlsConfig(){var e;return(e=this.media)==null?void 0:e._hlsConfig}set _hlsConfig(e){if(ze(this,Yi,fs).call(this),!this.media){ri("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=e}async addCuePoints(e){var t;if(ze(this,Yi,fs).call(this),!this.media){ri("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(t=this.media)==null?void 0:t.addCuePoints(e)}get activeCuePoint(){var e;return(e=this.media)==null?void 0:e.activeCuePoint}get cuePoints(){var e,t;return(t=(e=this.media)==null?void 0:e.cuePoints)!=null?t:[]}addChapters(e){var t;if(ze(this,Yi,fs).call(this),!this.media){ri("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(t=this.media)==null?void 0:t.addChapters(e)}get activeChapter(){var e;return(e=this.media)==null?void 0:e.activeChapter}get chapters(){var e,t;return(t=(e=this.media)==null?void 0:e.chapters)!=null?t:[]}getStartDate(){var e;return(e=this.media)==null?void 0:e.getStartDate()}get currentPdt(){var e;return(e=this.media)==null?void 0:e.currentPdt}get tokens(){let e=this.getAttribute($.PLAYBACK_TOKEN),t=this.getAttribute($.THUMBNAIL_TOKEN),s=this.getAttribute($.STORYBOARD_TOKEN);return{...Te(this,wd),...e!=null?{playback:e}:{},...t!=null?{thumbnail:t}:{},...s!=null?{storyboard:s}:{}}}set tokens(e){Zi(this,wd,e??{})}get playbackToken(){var e;return(e=this.getAttribute($.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute($.PLAYBACK_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute($.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute($.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute($.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute($.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,t,s,r){var n;let a=(n=this.media)==null?void 0:n.nativeEl;if(a)return Lm(a,e,t,s,r)}removeTextTrack(e){var t;let s=(t=this.media)==null?void 0:t.nativeEl;if(s)return oI(s,e)}get textTracks(){var e;return(e=this.media)==null?void 0:e.textTracks}};Rd=new WeakMap,wd=new WeakMap,Js=new WeakMap,Cd=new WeakMap,In=new WeakMap,Yi=new WeakSet,fs=function(){var i,e,t;if(!Te(this,Rd)){Zi(this,Rd,!0),ze(this,tr,hn).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof lt.HTMLElement))throw""}catch{ri("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof KD))throw""}catch{ri("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof DR))throw""}catch{ri("<media-controller> failed to upgrade!")}SM(this),ze(this,Jf,Jg).call(this),ze(this,em,ev).call(this),ze(this,tm,tv).call(this),Zi(this,Js,(e=(i=this.mediaController)==null?void 0:i.hasAttribute(ge.USER_INACTIVE))!=null?e:!0),ze(this,im,iv).call(this),(t=this.media)==null||t.addEventListener("streamtypechange",()=>{ze(this,tr,hn).call(this)})}},Qf=new WeakSet,e_=function(){var i,e;try{(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},Ac=new WeakSet,Zf=function(i){Object.assign(Te(this,In),i),ze(this,tr,hn).call(this)},tr=new WeakSet,hn=function(i={}){FM($M(qM(this,{...Te(this,In),...i})),this.shadowRoot)},Jf=new WeakSet,Jg=function(){let i=e=>{var t,s;if(!(e!=null&&e.startsWith("theme-")))return;let r=e.replace(/^theme-/,"");if(Xf.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)},em=new WeakSet,ev=function(){var i;let e=t=>{let{detail:s}=t;if(s instanceof Ct||(s=new Ct(s.message,s.code,s.fatal)),!(s!=null&&s.fatal)){cr(s),s.data&&cr(`${s.name} data:`,s.data);return}let{dialog:r,devlog:n}=jf(s,!window.navigator.onLine,this.playbackId,this.playbackToken);n.message&&VT(n),ri(s),s.data&&ri(`${s.name} data:`,s.data),ze(this,Ac,Zf).call(this,{isDialogOpen:!0,dialog:r})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(t={})=>{var s,r,n;if(!(((s=this.media)==null?void 0:s.error)instanceof Ct))return t;let{devlog:a}=jf((r=this.media)==null?void 0:r.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(n=this.media)==null?void 0:n.error.code,player_error_message:a.message?String(a.message):t.player_error_message,player_error_context:a.context?String(a.context):t.player_error_context}}),(i=this.media)==null||i.addEventListener("error",t=>{var s,r;let{detail:n}=t;if(!n){let{message:a,code:o}=(r=(s=this.media)==null?void 0:s.error)!=null?r:{};n=new Ct(a,o)}n!=null&&n.fatal&&this.dispatchEvent(new CustomEvent("error",{detail:n}))})},tm=new WeakSet,tv=function(){var i,e,t,s;let r=()=>ze(this,tr,hn).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)},im=new WeakSet,iv=function(){var i,e;if(!/Firefox/i.test(navigator.userAgent))return;let t,s=new WeakMap,r=()=>this.streamType===_e.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,n=(l,d,c=!1)=>{r()||Array.from(l&&l.activeCues||[]).forEach(u=>{if(!(!u.snapToLines||u.line<-5||u.line>=0&&u.line<10))if(!d||this.paused){let h=u.text.split(`
2987
- `).length,f=-3;this.streamType===_e.LIVE&&(f=-2);let m=f-h;if(u.line===m&&!c)return;s.has(u)||s.set(u,u.line),u.line=m}else setTimeout(()=>{u.line=s.get(u)||"auto"},500)})},a=()=>{var l,d;n(t,(d=(l=this.mediaController)==null?void 0:l.hasAttribute(ge.USER_INACTIVE))!=null?d:!1)},o=()=>{var l,d;let c=Array.from(((d=(l=this.mediaController)==null?void 0:l.media)==null?void 0:d.textTracks)||[]).filter(u=>["subtitles","captions"].includes(u.kind)&&u.mode==="showing")[0];c!==t&&(t==null||t.removeEventListener("cuechange",a)),t=c,t==null||t.addEventListener("cuechange",a),n(t,Te(this,Js))};o(),(i=this.textTracks)==null||i.addEventListener("change",o),(e=this.textTracks)==null||e.addEventListener("addtrack",o),this.addEventListener("userinactivechange",()=>{var l,d;let c=(d=(l=this.mediaController)==null?void 0:l.hasAttribute(ge.USER_INACTIVE))!=null?d:!0;Te(this,Js)!==c&&(Zi(this,Js,c),n(t,Te(this,Js)))})};function Ds(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}lt.customElements.get("mux-player")||(lt.customElements.define("mux-player",sv),lt.MuxPlayerElement=sv);var rv={className:"class",classname:"class",htmlFor:"for",crossOrigin:"crossorigin",viewBox:"viewBox",playsInline:"playsinline",autoPlay:"autoplay",playbackRate:"playbackrate"},t2=i=>i==null,i2=(i,e)=>t2(e)?!1:i in e,s2=i=>i.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),r2=(i,e)=>{if(!(typeof e=="boolean"&&!e)){if(i2(i,rv))return rv[i];if(typeof e!=null)return/[A-Z]/.test(i)?s2(i):i}},n2=(i,e)=>typeof i=="boolean"?"":i,a2=(i={})=>Object.entries(i).reduce((e,[t,s])=>{let r=r2(t,s);if(!r)return e;let n=n2(s);return e[r]=n,e},{}),o2=(...i)=>{let e=pt.useRef(null);return pt.useEffect(()=>{i.forEach(t=>{t&&(typeof t=="function"?t(e.current):t.current=e.current)})},[i]),e},l2=Object.prototype.hasOwnProperty,d2=(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(!l2.call(e,t[r])||!Object.is(i[t[r]],e[t[r]]))return!1;return!0},t_=(i,e,t)=>!d2(e,i[t]),c2=(i,e,t)=>{i[t]=e},u2=(i,e,t,s=c2,r=t_)=>pt.useEffect(()=>{let n=t==null?void 0:t.current;n&&r(n,e,i)&&s(n,e,i)},[t==null?void 0:t.current,e]),Wi=u2,h2=()=>{try{return"2.7.0"}catch{}return"UNKNOWN"},f2=h2(),m2=()=>f2,p2=Dd.forwardRef(({children:i,...e},t)=>Dd.createElement("mux-player",a2({...e,ref:t}),i)),ke=(i,e,t)=>pt.useEffect(()=>{let s=e==null?void 0:e.current;if(!(!s||!t))return s.addEventListener(i,t),()=>{s.removeEventListener(i,t)}},[e==null?void 0:e.current,t]),g2=(i,e)=>{let{onAbort:t,onCanPlay:s,onCanPlayThrough:r,onEmptied:n,onLoadStart:a,onLoadedData:o,onLoadedMetadata:l,onProgress:d,onDurationChange:c,onVolumeChange:u,onRateChange:h,onResize:f,onWaiting:m,onPlay:p,onPlaying:g,onTimeUpdate:v,onPause:y,onSeeking:b,onSeeked:x,onStalled:_,onSuspend:S,onEnded:A,onError:D,onCuePointChange:O,onCuePointsChange:L,onChapterChange:C,metadata:H,tokens:U,paused:Q,playbackId:q,playbackRates:Y,currentTime:oe,themeProps:ae,extraSourceParams:G,_hlsConfig:F,...re}=e;return Wi("playbackRates",Y,i),Wi("metadata",H,i),Wi("extraSourceParams",G,i),Wi("_hlsConfig",F,i),Wi("themeProps",ae,i),Wi("tokens",U,i),Wi("playbackId",q,i),Wi("paused",Q,i,(J,de)=>{de!=null&&(de?J.pause():J.play())},(J,de,Ae)=>J.hasAttribute("autoplay")&&!J.hasPlayed?!1:t_(J,de,Ae)),Wi("currentTime",oe,i,(J,de)=>{de!=null&&(J.currentTime=de)}),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,c),ke("volumechange",i,u),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,y),ke("seeking",i,b),ke("seeked",i,x),ke("stalled",i,_),ke("suspend",i,S),ke("ended",i,A),ke("error",i,D),ke("cuepointchange",i,O),ke("cuepointschange",i,L),ke("chapterchange",i,C),[re]},v2=m2(),E2="mux-player-react",b2=Dd.forwardRef((i,e)=>{let t=pt.useRef(null),s=o2(t,e),[r]=g2(t,i);return Dd.createElement(p2,{ref:s,playerSoftwareName:E2,playerSoftwareVersion:v2,...r})}),y2=b2;const T2=Gc.object({time:Gc.number(),expiresAt:Gc.string()}).transform(i=>({time:Number(i.time),expiresAt:new Date(i.expiresAt)}));function _2(){var e;const i=v_("root");return((e=i==null?void 0:i.preferences)==null?void 0:e.player)??null}const A2=["input","select","button","textarea","mux-player","summary"];function nv(i){const e=pt.useRef(i);return pt.useEffect(()=>{e.current=i},[i]),e}function S2({muxPlayerRef:i,...e}){const t=_2(),s=g_(),[r,n]=pt.useState(!1),a=`${e.playbackId}:currentTime`,[o,l]=pt.useState(0),d=nv(s),c=nv(t);pt.useEffect(()=>{if(typeof document>"u")return;const h=sessionStorage.getItem(a);if(h)try{const{time:f,expiresAt:m}=T2.parse(JSON.parse(h));if(m.getTime()<Date.now())throw new Error("Time expired");l(f)}catch{sessionStorage.removeItem(a)}},[a]),pt.useEffect(()=>{function h(f){if(!i.current)return;const m=document.activeElement,p=m instanceof HTMLElement?m.contentEditable==="true":!1;m&&!A2.includes(m.tagName.toLowerCase())&&!p&&(f.key===" "&&(f.preventDefault(),i.current.paused?i.current.play():i.current.pause()),f.key==="ArrowRight"&&(f.preventDefault(),i.current.currentTime=i.current.currentTime+(i.current.forwardSeekOffset||10)),f.key==="ArrowLeft"&&(f.preventDefault(),i.current.currentTime=i.current.currentTime-(i.current.forwardSeekOffset||10)),f.key==="f"&&!f.metaKey&&!f.ctrlKey&&(f.preventDefault(),document.fullscreenElement?document.exitFullscreen():i.current.requestFullscreen()))}return window.document.addEventListener("keydown",h),()=>{window.document.removeEventListener("keydown",h)}},[i]);const u=f_(()=>{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"}};sm(m,c.current)||d.current.submit(m,{method:"POST",action:"/video-player",encType:"application/json"})},300);return pt.useEffect(()=>{var m,p;if(!r)return;const h=(m=i.current)==null?void 0:m.textTracks;if(!h)return;const f=(p=c.current)==null?void 0:p.subtitle;if(f!=null&&f.id){const g=h.getTrackById(f.id);g&&(g.mode=f.mode??"hidden")}return h.addEventListener("change",u),()=>{h.removeEventListener("change",u)}},[r,i,c,u]),W.jsx("div",{className:"flex aspect-video flex-col",children:W.jsx(y2,{ref:i,playbackRates:[.5,.75,1,1.25,1.5,1.75,2,2.5,3,3.5,4],volume:(t==null?void 0:t.volumeRate)??1,playbackRate:(t==null?void 0:t.playbackRate)??1,thumbnailTime:o,onRateChange:u,onVolumeChange:u,streamType:"on-demand",defaultHiddenCaptions:!0,currentTime:o,onTimeUpdate:()=>{var h;return sessionStorage.setItem(a,JSON.stringify({time:(h=i.current)==null?void 0:h.currentTime,expiresAt:new Date(Date.now()+1e3*60*30).toISOString()}))},accentColor:"#427cf0",targetLiveWindow:NaN,onLoadedMetadata:()=>n(!0),...e})})}function sm(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(!sm(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(!sm(i[r],e[r]))return!1;return!0}const i_=pt.createContext(null);function iO({children:i,epicVideoInfosPromise:e}){return W.jsx(i_.Provider,{value:e,children:i})}function s_(i){let e=new URL("https://epicweb.dev");try{e=new URL(i)}catch(u){return console.error(u),"EpicWeb.dev Video"}const t=e.pathname.split("/").filter(Boolean),s=t.includes("solution");let r=t.pop();const n=["problem","solution","embed","exercise"],a=u=>u&&!n.includes(u);for(;!a(r);)r=t.pop();if(!r)return"EpicWeb.dev Video";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"],c=o.filter(Boolean).map((u,h)=>{var p;const f=u.toLowerCase(),m=d.find(g=>g.toLowerCase()===f);return m||(l.includes(f)&&h>0?f:((p=f[0])==null?void 0:p.toUpperCase())+f.slice(1))}).join(" ");return s?`${c} (🏁 solution)`:c}function x2({url:i,title:e="Video Embed",loadingContent:t=W.jsx(rm,{children:W.jsxs("span",{children:['Loading "',e,'"']})})}){const[s,r]=pt.useState(!1);return W.jsxs("div",{className:"relative aspect-video w-full flex-shrink-0 shadow-lg dark:shadow-gray-800",children:[s?null:W.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:t}),W.jsx("iframe",{onLoad:()=>r(!0),src:i,className:m_("absolute inset-0 flex h-full w-full transition-opacity duration-300",s?"opacity-100":"opacity-0"),title:e,sandbox:"allow-forms allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox",allowFullScreen:!0})]})}function r_({url:i,title:e}){return W.jsxs("a",{href:i,target:"_blank",className:"flex items-center gap-1 text-base no-underline opacity-70 transition hover:underline hover:opacity-100",rel:"noreferrer",children:[W.jsx(p_,{className:"flex-shrink-0",name:"Video",size:"lg"}),e," ",W.jsx("span",{"aria-hidden":!0,children:"↗︎"})]})}function sO({url:i,title:e=s_(i)}){const t=pt.useContext(i_),s=W.jsx("div",{children:W.jsx(r_,{url:i,title:e})});return W.jsx("div",{children:W.jsx(pt.Suspense,{fallback:W.jsxs("div",{children:[W.jsx("div",{className:"flex aspect-video w-full items-center justify-center",children:W.jsx(rm,{children:e})}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[s,W.jsx("div",{className:"h-[32px]"})]})]}),children:W.jsx(E_,{errorElement:W.jsx("div",{children:"Sorry, failed loading videos. Check the terminal output?"}),resolve:t,children:r=>{const n=r==null?void 0:r[i],a=ENV.EPICSHOP_DEPLOYED?W.jsxs("div",{children:[ENV.EPICSHOP_GITHUB_ROOT?W.jsx(vo,{to:ENV.EPICSHOP_GITHUB_ROOT,className:"underline",children:"Run locally"}):"Run locally"," for transcripts"]}):W.jsxs("div",{children:[W.jsx(vo,{to:"/login",className:"underline",children:"Login"})," for transcripts"]});if(!n)return W.jsxs("div",{children:[W.jsx(na,{url:i,title:e}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[s,a]})]});const o=n;return o.status==="success"?W.jsx(k2,{url:i,title:e,muxPlaybackId:o.muxPlaybackId,transcript:o.transcript}):o.type==="region-restricted"?W.jsxs("div",{children:[W.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:[W.jsx("div",{className:"!text-foreground-danger",children:"Error: Region Restricted"}),W.jsxs("div",{children:["We've detected you're connecting from"," ",o.requestCountry," but your license has restricted access to ",o.restrictedCountry]}),W.jsxs("div",{children:["To continue watching uninterrupted, please"," ",W.jsx("a",{href:"https://www.epicweb.dev/products/full-stack-vol-1",className:"underline",children:"upgrade your EpicWeb.dev license"})," ","to a full Pro license."]})]}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[s,W.jsxs("div",{children:[W.jsx(vo,{to:"https://www.epicweb.dev/products",className:"underline",children:"Upgrade"})," for transcripts"]})]})]}):o.statusCode===401?W.jsxs("div",{children:[W.jsx(na,{url:i,title:e}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[s,a]})]}):o.statusCode===403?W.jsxs("div",{children:[W.jsx(na,{url:i,title:e}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[s,W.jsxs("div",{children:[W.jsx(vo,{to:"https://www.epicweb.dev/products",className:"underline",children:"Upgrade"})," for transcripts"]})]})]}):o.statusCode===404?W.jsxs("div",{children:[W.jsx(na,{url:i,title:e}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[s,W.jsx("div",{children:"Transcripts not found"})]})]}):(console.error(o),W.jsxs("div",{children:[W.jsx(na,{url:i,title:e}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[s,W.jsx("div",{className:"!text-foreground-danger",children:"Unknown error (check console)"})]})]}))}})})})}function k2({url:i,title:e=s_(i),muxPlaybackId:t,transcript:s}){const r=pt.useRef(null),n=/(\d+:\d+)/g,a=[];let o,l=0;for(;o=n.exec(s);){const d=o[1];if(!n.lastIndex||!d)break;const c=o.index,u=n.lastIndex,h=s.slice(l+1,c-1);a.push(W.jsx("span",{children:h},c)),a.push(W.jsx("button",{className:"underline",onClick:f=>{r.current&&(r.current.currentTime=L2(d),r.current.play(),r.current.scrollIntoView({behavior:"smooth",inline:"center",block:"start"}),f.currentTarget.blur())},children:d},d)),l=u}return a.push(W.jsx("span",{children:s.slice(l+1,s.length)},s.length)),W.jsxs("div",{children:[W.jsx("div",{className:"shadow-lg dark:shadow-gray-800",children:W.jsx(S2,{playbackId:t,muxPlayerRef:r,title:e})}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[W.jsx(r_,{url:i,title:e}),W.jsxs("details",{children:[W.jsx("summary",{children:"Transcript"}),W.jsx("div",{className:"whitespace-pre-line rounded-md bg-accent p-2 text-accent-foreground",children:a})]})]})]})}function L2(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 na({url:i,title:e}){const t=h_();let s=new URL("https://epicweb.dev");try{s=new URL(i)}catch(r){return console.error(r),W.jsxs("div",{children:['Invalid URL: "',i,'"']})}return s.pathname=s.pathname.endsWith("/")?`${s.pathname}embed`:`${s.pathname}/embed`,s.searchParams.set("theme",t),W.jsx(x2,{url:s.toString(),title:e,loadingContent:W.jsx(rm,{children:W.jsxs("span",{children:['Loading "',W.jsx("a",{className:"underline",href:i,children:e}),'"']})})})}export{sO as D,iO as E,x2 as V};
2988
- //# sourceMappingURL=epic-video-CYnG2ziQ.js.map
2987
+ `).length,f=-3;this.streamType===_e.LIVE&&(f=-2);let m=f-h;if(u.line===m&&!c)return;s.has(u)||s.set(u,u.line),u.line=m}else setTimeout(()=>{u.line=s.get(u)||"auto"},500)})},a=()=>{var l,d;n(t,(d=(l=this.mediaController)==null?void 0:l.hasAttribute(ge.USER_INACTIVE))!=null?d:!1)},o=()=>{var l,d;let c=Array.from(((d=(l=this.mediaController)==null?void 0:l.media)==null?void 0:d.textTracks)||[]).filter(u=>["subtitles","captions"].includes(u.kind)&&u.mode==="showing")[0];c!==t&&(t==null||t.removeEventListener("cuechange",a)),t=c,t==null||t.addEventListener("cuechange",a),n(t,Te(this,Js))};o(),(i=this.textTracks)==null||i.addEventListener("change",o),(e=this.textTracks)==null||e.addEventListener("addtrack",o),this.addEventListener("userinactivechange",()=>{var l,d;let c=(d=(l=this.mediaController)==null?void 0:l.hasAttribute(ge.USER_INACTIVE))!=null?d:!0;Te(this,Js)!==c&&(Zi(this,Js,c),n(t,Te(this,Js)))})};function Ds(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}lt.customElements.get("mux-player")||(lt.customElements.define("mux-player",sv),lt.MuxPlayerElement=sv);var rv={className:"class",classname:"class",htmlFor:"for",crossOrigin:"crossorigin",viewBox:"viewBox",playsInline:"playsinline",autoPlay:"autoplay",playbackRate:"playbackrate"},t2=i=>i==null,i2=(i,e)=>t2(e)?!1:i in e,s2=i=>i.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),r2=(i,e)=>{if(!(typeof e=="boolean"&&!e)){if(i2(i,rv))return rv[i];if(typeof e!=null)return/[A-Z]/.test(i)?s2(i):i}},n2=(i,e)=>typeof i=="boolean"?"":i,a2=(i={})=>Object.entries(i).reduce((e,[t,s])=>{let r=r2(t,s);if(!r)return e;let n=n2(s);return e[r]=n,e},{}),o2=(...i)=>{let e=pt.useRef(null);return pt.useEffect(()=>{i.forEach(t=>{t&&(typeof t=="function"?t(e.current):t.current=e.current)})},[i]),e},l2=Object.prototype.hasOwnProperty,d2=(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(!l2.call(e,t[r])||!Object.is(i[t[r]],e[t[r]]))return!1;return!0},t_=(i,e,t)=>!d2(e,i[t]),c2=(i,e,t)=>{i[t]=e},u2=(i,e,t,s=c2,r=t_)=>pt.useEffect(()=>{let n=t==null?void 0:t.current;n&&r(n,e,i)&&s(n,e,i)},[t==null?void 0:t.current,e]),Wi=u2,h2=()=>{try{return"2.7.0"}catch{}return"UNKNOWN"},f2=h2(),m2=()=>f2,p2=Dd.forwardRef(({children:i,...e},t)=>Dd.createElement("mux-player",a2({...e,ref:t}),i)),ke=(i,e,t)=>pt.useEffect(()=>{let s=e==null?void 0:e.current;if(!(!s||!t))return s.addEventListener(i,t),()=>{s.removeEventListener(i,t)}},[e==null?void 0:e.current,t]),g2=(i,e)=>{let{onAbort:t,onCanPlay:s,onCanPlayThrough:r,onEmptied:n,onLoadStart:a,onLoadedData:o,onLoadedMetadata:l,onProgress:d,onDurationChange:c,onVolumeChange:u,onRateChange:h,onResize:f,onWaiting:m,onPlay:p,onPlaying:g,onTimeUpdate:v,onPause:y,onSeeking:b,onSeeked:x,onStalled:_,onSuspend:S,onEnded:A,onError:D,onCuePointChange:O,onCuePointsChange:L,onChapterChange:C,metadata:H,tokens:U,paused:Q,playbackId:q,playbackRates:Y,currentTime:oe,themeProps:ae,extraSourceParams:G,_hlsConfig:F,...re}=e;return Wi("playbackRates",Y,i),Wi("metadata",H,i),Wi("extraSourceParams",G,i),Wi("_hlsConfig",F,i),Wi("themeProps",ae,i),Wi("tokens",U,i),Wi("playbackId",q,i),Wi("paused",Q,i,(J,de)=>{de!=null&&(de?J.pause():J.play())},(J,de,Ae)=>J.hasAttribute("autoplay")&&!J.hasPlayed?!1:t_(J,de,Ae)),Wi("currentTime",oe,i,(J,de)=>{de!=null&&(J.currentTime=de)}),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,c),ke("volumechange",i,u),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,y),ke("seeking",i,b),ke("seeked",i,x),ke("stalled",i,_),ke("suspend",i,S),ke("ended",i,A),ke("error",i,D),ke("cuepointchange",i,O),ke("cuepointschange",i,L),ke("chapterchange",i,C),[re]},v2=m2(),E2="mux-player-react",b2=Dd.forwardRef((i,e)=>{let t=pt.useRef(null),s=o2(t,e),[r]=g2(t,i);return Dd.createElement(p2,{ref:s,playerSoftwareName:E2,playerSoftwareVersion:v2,...r})}),y2=b2;const T2=Gc.object({time:Gc.number(),expiresAt:Gc.string()}).transform(i=>({time:Number(i.time),expiresAt:new Date(i.expiresAt)}));function _2(){var e;const i=v_("root");return((e=i==null?void 0:i.preferences)==null?void 0:e.player)??null}const A2=["input","select","button","textarea","mux-player","summary"];function nv(i){const e=pt.useRef(i);return pt.useEffect(()=>{e.current=i},[i]),e}function S2({muxPlayerRef:i,...e}){const t=_2(),s=g_(),[r,n]=pt.useState(!1),a=`${e.playbackId}:currentTime`,[o,l]=pt.useState(0),d=nv(s),c=nv(t);pt.useEffect(()=>{if(typeof document>"u")return;const h=sessionStorage.getItem(a);if(h)try{const{time:f,expiresAt:m}=T2.parse(JSON.parse(h));if(m.getTime()<Date.now())throw new Error("Time expired");l(f)}catch{sessionStorage.removeItem(a)}},[a]),pt.useEffect(()=>{function h(f){if(!i.current)return;const m=document.activeElement,p=m instanceof HTMLElement?m.contentEditable==="true":!1;m&&!A2.includes(m.tagName.toLowerCase())&&!p&&(f.key===" "&&(f.preventDefault(),i.current.paused?i.current.play():i.current.pause()),f.key==="ArrowRight"&&(f.preventDefault(),i.current.currentTime=i.current.currentTime+(i.current.forwardSeekOffset||10)),f.key==="ArrowLeft"&&(f.preventDefault(),i.current.currentTime=i.current.currentTime-(i.current.forwardSeekOffset||10)),f.key==="f"&&!f.metaKey&&!f.ctrlKey&&(f.preventDefault(),document.fullscreenElement?document.exitFullscreen():i.current.requestFullscreen()))}return window.document.addEventListener("keydown",h),()=>{window.document.removeEventListener("keydown",h)}},[i]);const u=f_(()=>{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"}};sm(m,c.current)||d.current.submit(m,{method:"POST",action:"/video-player",encType:"application/json"})},300);return pt.useEffect(()=>{var m,p;if(!r)return;const h=(m=i.current)==null?void 0:m.textTracks;if(!h)return;const f=(p=c.current)==null?void 0:p.subtitle;if(f!=null&&f.id){const g=h.getTrackById(f.id);g&&(g.mode=f.mode??"hidden")}return h.addEventListener("change",u),()=>{h.removeEventListener("change",u)}},[r,i,c,u]),W.jsx("div",{className:"flex aspect-video flex-col",children:W.jsx(y2,{ref:i,playbackRates:[.5,.75,1,1.25,1.5,1.75,2,2.5,3,3.5,4],volume:(t==null?void 0:t.volumeRate)??1,playbackRate:(t==null?void 0:t.playbackRate)??1,thumbnailTime:o,onRateChange:u,onVolumeChange:u,streamType:"on-demand",defaultHiddenCaptions:!0,currentTime:o,onTimeUpdate:()=>{var h;return sessionStorage.setItem(a,JSON.stringify({time:(h=i.current)==null?void 0:h.currentTime,expiresAt:new Date(Date.now()+1e3*60*30).toISOString()}))},accentColor:"#427cf0",targetLiveWindow:NaN,onLoadedMetadata:()=>n(!0),...e})})}function sm(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(!sm(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(!sm(i[r],e[r]))return!1;return!0}const i_=pt.createContext(null);function iO({children:i,epicVideoInfosPromise:e}){return W.jsx(i_.Provider,{value:e,children:i})}function s_(i){let e=new URL("https://epicweb.dev");try{e=new URL(i)}catch(u){return console.error(u),"EpicWeb.dev Video"}const t=e.pathname.split("/").filter(Boolean),s=t.includes("solution");let r=t.pop();const n=["problem","solution","embed","exercise"],a=u=>u&&!n.includes(u);for(;!a(r);)r=t.pop();if(!r)return"EpicWeb.dev Video";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"],c=o.filter(Boolean).map((u,h)=>{var p;const f=u.toLowerCase(),m=d.find(g=>g.toLowerCase()===f);return m||(l.includes(f)&&h>0?f:((p=f[0])==null?void 0:p.toUpperCase())+f.slice(1))}).join(" ");return s?`${c} (🏁 solution)`:c}function x2({url:i,title:e="Video Embed",loadingContent:t=W.jsx(rm,{children:W.jsxs("span",{children:['Loading "',e,'"']})})}){const[s,r]=pt.useState(!1);return W.jsxs("div",{className:"relative aspect-video w-full flex-shrink-0 shadow-lg dark:shadow-gray-800",children:[s?null:W.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:t}),W.jsx("iframe",{onLoad:()=>r(!0),onError:()=>r(!0),src:i,className:m_("absolute inset-0 flex h-full w-full transition-opacity duration-300",s?"opacity-100":"opacity-0"),title:e,sandbox:"allow-forms allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox",allowFullScreen:!0})]})}function r_({url:i,title:e}){return W.jsxs("a",{href:i,target:"_blank",className:"flex items-center gap-1 text-base no-underline opacity-70 transition hover:underline hover:opacity-100",rel:"noreferrer",children:[W.jsx(p_,{className:"flex-shrink-0",name:"Video",size:"lg"}),e," ",W.jsx("span",{"aria-hidden":!0,children:"↗︎"})]})}function sO({url:i,title:e=s_(i)}){const t=pt.useContext(i_),s=W.jsx("div",{children:W.jsx(r_,{url:i,title:e})});return W.jsx("div",{children:W.jsx(pt.Suspense,{fallback:W.jsxs("div",{children:[W.jsx("div",{className:"flex aspect-video w-full items-center justify-center",children:W.jsx(rm,{children:e})}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[s,W.jsx("div",{className:"h-[32px]"})]})]}),children:W.jsx(E_,{errorElement:W.jsx("div",{children:"Sorry, failed loading videos. Check the terminal output?"}),resolve:t,children:r=>{const n=r==null?void 0:r[i],a=ENV.EPICSHOP_DEPLOYED?W.jsxs("div",{children:[ENV.EPICSHOP_GITHUB_ROOT?W.jsx(vo,{to:ENV.EPICSHOP_GITHUB_ROOT,className:"underline",children:"Run locally"}):"Run locally"," for transcripts"]}):W.jsxs("div",{children:[W.jsx(vo,{to:"/login",className:"underline",children:"Login"})," for transcripts"]});if(!n)return W.jsxs("div",{children:[W.jsx(na,{url:i,title:e}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[s,a]})]});const o=n;return o.status==="success"?W.jsx(k2,{url:i,title:e,muxPlaybackId:o.muxPlaybackId,transcript:o.transcript}):o.type==="region-restricted"?W.jsxs("div",{children:[W.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:[W.jsx("div",{className:"!text-foreground-danger",children:"Error: Region Restricted"}),W.jsxs("div",{children:["We've detected you're connecting from"," ",o.requestCountry," but your license has restricted access to ",o.restrictedCountry]}),W.jsxs("div",{children:["To continue watching uninterrupted, please"," ",W.jsx("a",{href:"https://www.epicweb.dev/products/full-stack-vol-1",className:"underline",children:"upgrade your EpicWeb.dev license"})," ","to a full Pro license."]})]}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[s,W.jsxs("div",{children:[W.jsx(vo,{to:"https://www.epicweb.dev/products",className:"underline",children:"Upgrade"})," for transcripts"]})]})]}):o.statusCode===401?W.jsxs("div",{children:[W.jsx(na,{url:i,title:e}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[s,a]})]}):o.statusCode===403?W.jsxs("div",{children:[W.jsx(na,{url:i,title:e}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[s,W.jsxs("div",{children:[W.jsx(vo,{to:"https://www.epicweb.dev/products",className:"underline",children:"Upgrade"})," for transcripts"]})]})]}):o.statusCode===404?W.jsxs("div",{children:[W.jsx(na,{url:i,title:e}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[s,W.jsx("div",{children:"Transcripts not found"})]})]}):(console.error(o),W.jsxs("div",{children:[W.jsx(na,{url:i,title:e}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[s,W.jsx("div",{className:"!text-foreground-danger",children:"Unknown error (check console)"})]})]}))}})})})}function k2({url:i,title:e=s_(i),muxPlaybackId:t,transcript:s}){const r=pt.useRef(null),n=/(\d+:\d+)/g,a=[];let o,l=0;for(;o=n.exec(s);){const d=o[1];if(!n.lastIndex||!d)break;const c=o.index,u=n.lastIndex,h=s.slice(l+1,c-1);a.push(W.jsx("span",{children:h},c)),a.push(W.jsx("button",{className:"underline",onClick:f=>{r.current&&(r.current.currentTime=L2(d),r.current.play(),r.current.scrollIntoView({behavior:"smooth",inline:"center",block:"start"}),f.currentTarget.blur())},children:d},d)),l=u}return a.push(W.jsx("span",{children:s.slice(l+1,s.length)},s.length)),W.jsxs("div",{children:[W.jsx("div",{className:"shadow-lg dark:shadow-gray-800",children:W.jsx(S2,{playbackId:t,muxPlayerRef:r,title:e})}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[W.jsx(r_,{url:i,title:e}),W.jsxs("details",{children:[W.jsx("summary",{children:"Transcript"}),W.jsx("div",{className:"whitespace-pre-line rounded-md bg-accent p-2 text-accent-foreground",children:a})]})]})]})}function L2(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 na({url:i,title:e}){const t=h_();let s=new URL("https://epicweb.dev");try{s=new URL(i)}catch(r){return console.error(r),W.jsxs("div",{children:['Invalid URL: "',i,'"']})}return s.pathname=s.pathname.endsWith("/")?`${s.pathname}embed`:`${s.pathname}/embed`,s.searchParams.set("theme",t),W.jsx(x2,{url:s.toString(),title:e,loadingContent:W.jsx(rm,{children:W.jsxs("span",{children:['Loading "',W.jsx("a",{className:"underline",href:i,children:e}),'"']})})})}export{sO as D,iO as E,x2 as V};
2988
+ //# sourceMappingURL=epic-video-zHEt2DZr.js.map