@epic-web/workshop-app 6.84.3 → 6.84.5

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.
@@ -1,3 +1,3 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.client-CeP10vNl.js","assets/index-Bi6L2ga8.js"])))=>i.map(i=>d[i]);
2
- import{_ as $}from"./preload-helper-BXl3LOEh.js";import{e as z,u as X,M as J,L as Z,f as V,w as ee,a as te,b as W,k as ne,O as se,P as re,Q as ie,S as oe,T as ae}from"./chunk-JZWAC4HX-0uKZ9a0b.js";import{j as o}from"./jsx-runtime-C5WNSv3b.js";import{r as f,g as ce,R as M}from"./index-Bi6L2ga8.js";import{c as _,I as q,d as le,u as ue}from"./misc-w_rthUBN.js";import{D as Q,T as de,g as fe,h as he,i as pe,C as me,a as xe,b as ge,c as ve,d as ye}from"./dialog-BaCkYFMm.js";import{c as h}from"./command-palette-B5RrTjmt.js";import{C as we}from"./client-only-CUo_KSMO.js";import{G as be}from"./error-boundary-CDP8QJH3.js";import{E as ke}from"./progress-bar-DTHojpoN.js";import{T as je,t as v}from"./index-E_6kulJP.js";import{m as Pe}from"./tooltip-DXU4r0k_.js";import{o as Ne,s as Ie,j as Se}from"./schemas-siASSt6b.js";import{u as Oe,C as Ce}from"./index-BCfhIjlz.js";import{P as Ee}from"./presence-Du0emDp8.js";import{g as Me}from"./seo-t5J-DRxw.js";import"./index-D7hprM2E.js";import"./pe-tear8uic.js";import"./index-B2VNpNxJ.js";import"./root-loader-DlSJfUY6.js";import"./online-CIe0rJXF.js";import"./coerce-f7UHRcUL.js";function De(i){return h.subscribe(i)}function L(){return h.getSnapshot()}function _e({className:i,children:e,...n}){return o.jsxs(he,{children:[o.jsx(pe,{}),o.jsx(me,{className:_("bg-background fixed top-[20vh] left-[50%] z-50 w-[min(720px,calc(100vw-2rem))] translate-x-[-50%] overflow-hidden rounded-lg border shadow-lg",i),...n,children:e})]})}function Re(){return f.useSyncExternalStore(De,L,L)}function Te(i){for(const e of i){const n=e.data;if(!n||typeof n!="object")continue;const t=n;if(Array.isArray(t.exercises)&&Array.isArray(t.extras)&&t.playground)return t}return null}function Ae({rootData:i}){const e=Re(),n=z(),t=X(),r=J(),s=f.useMemo(()=>Te(r),[r]),a=f.useMemo(()=>{const u={navigate:n,pathname:t.pathname,appLayoutData:s};return i&&(u.rootData=i),u},[n,t.pathname,s,i]);f.useEffect(()=>(h.setHost(a),()=>h.setHost(null)),[a]);const l=f.useMemo(()=>({type:"commands",placeholder:"Type a command…",query:"",selectedIndex:0}),[]),c=e.viewStack[e.viewStack.length-1]??e.viewStack[0]??l,d="promptId"in c?c.promptId:null,j=f.useRef(null),N=f.useRef(null);f.useEffect(()=>{if(!e.open)return;const u=window.setTimeout(()=>j.current?.focus(),0);return()=>window.clearTimeout(u)},[e.open,c.type,d]),f.useEffect(()=>{if(!e.open||c.type==="text"||c.type==="number")return;const u=N.current;if(!u)return;u.querySelector(`[data-command-palette-entry][data-entry-index="${c.selectedIndex}"]`)?.scrollIntoView({block:"nearest"})},[e.open,c.type,d,c.selectedIndex,c.query,e.entries.length]);const p=c.type==="commands"?"Enter to run • Backspace to close • Esc to close":c.type==="select"?"Enter to select • Backspace to go back • Esc to close":"Enter to submit • Backspace to go back • Esc to close";function S(u){u?h.open():h.close()}function w(u){if(u.key==="ArrowDown"){u.preventDefault(),h.moveSelection(1);return}if(u.key==="ArrowUp"){u.preventDefault(),h.moveSelection(-1);return}if(u.key==="Escape"){u.preventDefault(),h.close();return}if(u.key==="Backspace"&&c.query.length===0){u.preventDefault(),e.viewStack.length>1?h.back():h.close();return}u.key==="Enter"&&(u.preventDefault(),c.type==="text"||c.type==="number"?h.submitCurrentInput():h.submitSelected())}const b=c.type==="commands"?"Command Palette":"title"in c?c.title:"",m=c.type==="text"||c.type==="number"?c.description:void 0;if(!e.open)return null;let x;return o.jsx(Q,{open:e.open,onOpenChange:S,children:o.jsxs(_e,{className:"p-0",children:[o.jsx(de,{className:"sr-only",children:b}),o.jsx(fe,{className:"sr-only",children:m?`${p}. ${m}`:p}),o.jsxs("div",{className:"border-border border-b px-4 py-3",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-foreground truncate text-sm font-medium",children:b}),o.jsx("p",{className:"text-muted-foreground truncate text-xs",children:p})]}),o.jsx("kbd",{className:"border-border bg-muted text-muted-foreground shrink-0 rounded border px-1.5 py-0.5 font-mono text-[11px]",children:"Esc"})]}),o.jsxs("div",{className:"mt-3",children:[o.jsx("input",{ref:j,value:c.query,onChange:u=>h.setQuery(u.target.value),onKeyDown:w,placeholder:c.placeholder,autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",spellCheck:!1,inputMode:c.type==="number"?"numeric":"search",className:_("border-border bg-background text-foreground placeholder:text-muted-foreground w-full rounded-md border px-3 py-2 text-sm outline-none","focus-visible:ring-ring focus-visible:ring-offset-background focus-visible:ring-2 focus-visible:ring-offset-2")}),m?o.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:m}):null,e.errorMessage?o.jsx("p",{className:"text-foreground-destructive mt-2 text-xs",children:e.errorMessage}):null]})]}),o.jsx("div",{ref:N,className:"max-h-[55vh] overflow-y-auto p-1",children:c.type==="text"||c.type==="number"?o.jsxs("div",{className:"text-muted-foreground px-4 py-6 text-sm",children:["Press"," ",o.jsx("kbd",{className:"border-border bg-muted mx-1 rounded border px-1.5 py-0.5 font-mono text-[11px]",children:"Enter"})," ","to submit."]}):e.entries.length?o.jsx("ul",{className:"flex flex-col gap-0.5",children:e.entries.map((u,g)=>{const O=g===c.selectedIndex,k=u.group,I=!!k&&k!==x;return k&&(x=k),o.jsxs(f.Fragment,{children:[I?o.jsx("li",{className:"text-muted-foreground px-2 pt-2 pb-1 text-xs font-semibold",children:k}):null,o.jsx("li",{children:o.jsxs("button",{type:"button","data-command-palette-entry":!0,"data-entry-index":g,disabled:u.disabled,onMouseMove:()=>h.setSelection(g),onClick:()=>{h.setSelection(g),h.submitSelected()},className:_("flex w-full items-start justify-between gap-4 rounded-md px-3 py-2 text-left text-sm transition-colors",O?"bg-muted":"hover:bg-muted/60",u.disabled?"text-muted-foreground cursor-not-allowed opacity-70":"text-foreground"),children:[o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate font-medium",children:u.title}),u.subtitle?o.jsx("span",{className:"text-muted-foreground block truncate text-xs",children:u.subtitle}):null]}),u.shortcut?o.jsx("kbd",{className:"border-border bg-muted text-muted-foreground shrink-0 rounded border px-1.5 py-0.5 font-mono text-[11px]",children:u.shortcut}):null]})})]},u.id)})}):o.jsx("div",{className:"text-muted-foreground px-4 py-6 text-sm",children:"No results."})})]})})}var R,H;function Fe(){if(H)return R;H=1;var i={linear:function(e,n,t,r){var s=t-n;return s*e/r+n},easeInQuad:function(e,n,t,r){var s=t-n;return s*(e/=r)*e+n},easeOutQuad:function(e,n,t,r){var s=t-n;return-s*(e/=r)*(e-2)+n},easeInOutQuad:function(e,n,t,r){var s=t-n;return(e/=r/2)<1?s/2*e*e+n:-s/2*(--e*(e-2)-1)+n},easeInCubic:function(e,n,t,r){var s=t-n;return s*(e/=r)*e*e+n},easeOutCubic:function(e,n,t,r){var s=t-n;return s*((e=e/r-1)*e*e+1)+n},easeInOutCubic:function(e,n,t,r){var s=t-n;return(e/=r/2)<1?s/2*e*e*e+n:s/2*((e-=2)*e*e+2)+n},easeInQuart:function(e,n,t,r){var s=t-n;return s*(e/=r)*e*e*e+n},easeOutQuart:function(e,n,t,r){var s=t-n;return-s*((e=e/r-1)*e*e*e-1)+n},easeInOutQuart:function(e,n,t,r){var s=t-n;return(e/=r/2)<1?s/2*e*e*e*e+n:-s/2*((e-=2)*e*e*e-2)+n},easeInQuint:function(e,n,t,r){var s=t-n;return s*(e/=r)*e*e*e*e+n},easeOutQuint:function(e,n,t,r){var s=t-n;return s*((e=e/r-1)*e*e*e*e+1)+n},easeInOutQuint:function(e,n,t,r){var s=t-n;return(e/=r/2)<1?s/2*e*e*e*e*e+n:s/2*((e-=2)*e*e*e*e+2)+n},easeInSine:function(e,n,t,r){var s=t-n;return-s*Math.cos(e/r*(Math.PI/2))+s+n},easeOutSine:function(e,n,t,r){var s=t-n;return s*Math.sin(e/r*(Math.PI/2))+n},easeInOutSine:function(e,n,t,r){var s=t-n;return-s/2*(Math.cos(Math.PI*e/r)-1)+n},easeInExpo:function(e,n,t,r){var s=t-n;return e==0?n:s*Math.pow(2,10*(e/r-1))+n},easeOutExpo:function(e,n,t,r){var s=t-n;return e==r?n+s:s*(-Math.pow(2,-10*e/r)+1)+n},easeInOutExpo:function(e,n,t,r){var s=t-n;return e===0?n:e===r?n+s:(e/=r/2)<1?s/2*Math.pow(2,10*(e-1))+n:s/2*(-Math.pow(2,-10*--e)+2)+n},easeInCirc:function(e,n,t,r){var s=t-n;return-s*(Math.sqrt(1-(e/=r)*e)-1)+n},easeOutCirc:function(e,n,t,r){var s=t-n;return s*Math.sqrt(1-(e=e/r-1)*e)+n},easeInOutCirc:function(e,n,t,r){var s=t-n;return(e/=r/2)<1?-s/2*(Math.sqrt(1-e*e)-1)+n:s/2*(Math.sqrt(1-(e-=2)*e)+1)+n},easeInElastic:function(e,n,t,r){var s=t-n,a,l,c;return c=1.70158,l=0,a=s,e===0?n:(e/=r)===1?n+s:(l||(l=r*.3),a<Math.abs(s)?(a=s,c=l/4):c=l/(2*Math.PI)*Math.asin(s/a),-(a*Math.pow(2,10*(e-=1))*Math.sin((e*r-c)*(2*Math.PI)/l))+n)},easeOutElastic:function(e,n,t,r){var s=t-n,a,l,c;return c=1.70158,l=0,a=s,e===0?n:(e/=r)===1?n+s:(l||(l=r*.3),a<Math.abs(s)?(a=s,c=l/4):c=l/(2*Math.PI)*Math.asin(s/a),a*Math.pow(2,-10*e)*Math.sin((e*r-c)*(2*Math.PI)/l)+s+n)},easeInOutElastic:function(e,n,t,r){var s=t-n,a,l,c;return c=1.70158,l=0,a=s,e===0?n:(e/=r/2)===2?n+s:(l||(l=r*(.3*1.5)),a<Math.abs(s)?(a=s,c=l/4):c=l/(2*Math.PI)*Math.asin(s/a),e<1?-.5*(a*Math.pow(2,10*(e-=1))*Math.sin((e*r-c)*(2*Math.PI)/l))+n:a*Math.pow(2,-10*(e-=1))*Math.sin((e*r-c)*(2*Math.PI)/l)*.5+s+n)},easeInBack:function(e,n,t,r,s){var a=t-n;return s===void 0&&(s=1.70158),a*(e/=r)*e*((s+1)*e-s)+n},easeOutBack:function(e,n,t,r,s){var a=t-n;return s===void 0&&(s=1.70158),a*((e=e/r-1)*e*((s+1)*e+s)+1)+n},easeInOutBack:function(e,n,t,r,s){var a=t-n;return s===void 0&&(s=1.70158),(e/=r/2)<1?a/2*(e*e*(((s*=1.525)+1)*e-s))+n:a/2*((e-=2)*e*(((s*=1.525)+1)*e+s)+2)+n},easeInBounce:function(e,n,t,r){var s=t-n,a;return a=i.easeOutBounce(r-e,0,s,r),s-a+n},easeOutBounce:function(e,n,t,r){var s=t-n;return(e/=r)<1/2.75?s*(7.5625*e*e)+n:e<2/2.75?s*(7.5625*(e-=1.5/2.75)*e+.75)+n:e<2.5/2.75?s*(7.5625*(e-=2.25/2.75)*e+.9375)+n:s*(7.5625*(e-=2.625/2.75)*e+.984375)+n},easeInOutBounce:function(e,n,t,r){var s=t-n,a;return e<r/2?(a=i.easeInBounce(e*2,0,s,r),a*.5+n):(a=i.easeOutBounce(e*2-r,0,s,r),a*.5+s*.5+n)}};return R=i,R}var Be=Fe();const Ge=ce(Be);function Ue(i,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(i,t.key,t)}}function qe(i,e,n){return e&&Ue(i.prototype,e),i}function D(){return D=Object.assign||function(i){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(i[t]=n[t])}return i},D.apply(this,arguments)}function Le(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,A(i,e)}function A(i,e){return A=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t},A(i,e)}function He(i){return i*Math.PI/180}function y(i,e){return i+Math.random()*(e-i)}function Ve(i,e){return Math.floor(i+Math.random()*(e-i+1))}var E;(function(i){i[i.Circle=0]="Circle",i[i.Square=1]="Square",i[i.Strip=2]="Strip"})(E||(E={}));var P;(function(i){i[i.Positive=1]="Positive",i[i.Negative=-1]="Negative"})(P||(P={}));var We=(function(){function i(n,t,r,s){this.getOptions=t;var a=this.getOptions(),l=a.colors,c=a.initialVelocityX,d=a.initialVelocityY;this.context=n,this.x=r,this.y=s,this.w=y(5,20),this.h=y(5,20),this.radius=y(5,10),this.vx=y(-c,c),this.vy=y(-d,0),this.shape=Ve(0,2),this.angle=He(y(0,360)),this.angularSpin=y(-.2,.2),this.color=l[Math.floor(Math.random()*l.length)],this.rotateY=y(0,1),this.rotationDirection=y(0,1)?P.Positive:P.Negative}var e=i.prototype;return e.update=function(){var t=this.getOptions(),r=t.gravity,s=t.wind,a=t.friction,l=t.opacity,c=t.drawShape;this.x+=this.vx,this.y+=this.vy,this.vy+=r,this.vx+=s,this.vx*=a,this.vy*=a,this.rotateY>=1&&this.rotationDirection===P.Positive?this.rotationDirection=P.Negative:this.rotateY<=-1&&this.rotationDirection===P.Negative&&(this.rotationDirection=P.Positive);var d=.1*this.rotationDirection;if(this.rotateY+=d,this.angle+=this.angularSpin,this.context.save(),this.context.translate(this.x,this.y),this.context.rotate(this.angle),this.context.scale(1,this.rotateY),this.context.rotate(this.angle),this.context.beginPath(),this.context.fillStyle=this.color,this.context.strokeStyle=this.color,this.context.globalAlpha=l,this.context.lineCap="round",this.context.lineWidth=2,c&&typeof c=="function")c.call(this,this.context);else switch(this.shape){case E.Circle:{this.context.beginPath(),this.context.arc(0,0,this.radius,0,2*Math.PI),this.context.fill();break}case E.Square:{this.context.fillRect(-this.w/2,-this.h/2,this.w,this.h);break}case E.Strip:{this.context.fillRect(-this.w/6,-this.h/2,this.w/3,this.h);break}default:throw new Error("Unknown type in Particle.ts")}this.context.closePath(),this.context.restore()},i})(),Qe=function(e,n){var t=this;this.x=0,this.y=0,this.w=0,this.h=0,this.lastNumberOfPieces=0,this.tweenInitTime=Date.now(),this.particles=[],this.particlesGenerated=0,this.removeParticleAt=function(s){t.particles.splice(s,1)},this.getParticle=function(){var s=y(t.x,t.w+t.x),a=y(t.y,t.h+t.y);return new We(t.context,t.getOptions,s,a)},this.animate=function(){var s=t.canvas,a=t.context,l=t.particlesGenerated,c=t.lastNumberOfPieces,d=t.getOptions(),j=d.run,N=d.recycle,p=d.numberOfPieces,S=d.debug,w=d.tweenFunction,b=d.tweenDuration;if(!j)return!1;var m=t.particles.length,x=N?m:l,u=Date.now();if(x<p){c!==p&&(t.tweenInitTime=u,t.lastNumberOfPieces=p);for(var g=t.tweenInitTime,O=u-g>b?b:Math.max(0,u-g),k=w(O,x,p,b),I=Math.round(k-x),G=0;G<I;G+=1)t.particles.push(t.getParticle());t.particlesGenerated+=I}return S&&(a.font="12px sans-serif",a.fillStyle="#333",a.textAlign="right",a.fillText("Particles: "+m,s.width-10,s.height-20)),t.particles.forEach(function(C,U){C.update(),(C.y>s.height||C.y<-100||C.x>s.width+100||C.x<-100)&&(N&&x<=p?t.particles[U]=t.getParticle():t.removeParticleAt(U))}),m>0||x<p},this.canvas=e;var r=this.canvas.getContext("2d");if(!r)throw new Error("Could not get canvas context");this.context=r,this.getOptions=n},F={width:typeof window<"u"?window.innerWidth:300,height:typeof window<"u"?window.innerHeight:200,numberOfPieces:200,friction:.99,wind:0,gravity:.1,initialVelocityX:4,initialVelocityY:10,colors:["#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#2196f3","#03a9f4","#00bcd4","#009688","#4CAF50","#8BC34A","#CDDC39","#FFEB3B","#FFC107","#FF9800","#FF5722","#795548"],opacity:1,debug:!1,tweenFunction:Ge.easeInOutQuad,tweenDuration:5e3,recycle:!0,run:!0},Ye=(function(){function i(e,n){var t=this;this.setOptionsWithDefaults=function(s){var a={confettiSource:{x:0,y:0,w:t.canvas.width,h:0}};t._options=D({},a,F,s),Object.assign(t,s.confettiSource)},this.update=function(){var s=t.options,a=s.run,l=s.onConfettiComplete,c=t.canvas,d=t.context;a&&(d.fillStyle="white",d.clearRect(0,0,c.width,c.height)),t.generator.animate()?t.rafId=requestAnimationFrame(t.update):(l&&typeof l=="function"&&t.generator.particlesGenerated>0&&l.call(t,t),t._options.run=!1)},this.reset=function(){t.generator&&t.generator.particlesGenerated>0&&(t.generator.particlesGenerated=0,t.generator.particles=[],t.generator.lastNumberOfPieces=0)},this.stop=function(){t.options={run:!1},t.rafId&&(cancelAnimationFrame(t.rafId),t.rafId=void 0)},this.canvas=e;var r=this.canvas.getContext("2d");if(!r)throw new Error("Could not get canvas context");this.context=r,this.generator=new Qe(this.canvas,function(){return t.options}),this.options=n,this.update()}return qe(i,[{key:"options",get:function(){return this._options},set:function(n){var t=this._options&&this._options.run,r=this._options&&this._options.recycle;this.setOptionsWithDefaults(n),this.generator&&(Object.assign(this.generator,this.options.confettiSource),typeof n.recycle=="boolean"&&n.recycle&&r===!1&&(this.generator.lastNumberOfPieces=this.generator.particles.length)),typeof n.run=="boolean"&&n.run&&t===!1&&this.update()}}]),i})(),Y=M.createRef();function T(i){var e={},n={},t={},r=[].concat(Object.keys(F),["confettiSource","drawShape","onConfettiComplete"]),s=["canvasRef"];return Object.keys(i).forEach(function(a){var l=i[a];r.includes(a)?e[a]=l:s.includes(a)?s[a]=l:t[a]=l}),[e,t,n]}var B=(function(i){Le(e,i);function e(t){var r;return r=i.call(this,t)||this,r.canvas=M.createRef(),r.canvas=t.canvasRef||Y,r}var n=e.prototype;return n.componentDidMount=function(){if(this.canvas.current){var r=T(this.props)[0];this.confetti=new Ye(this.canvas.current,r)}},n.componentDidUpdate=function(){var r=T(this.props)[0];this.confetti&&(this.confetti.options=r)},n.componentWillUnmount=function(){this.confetti&&this.confetti.stop(),this.confetti=void 0},n.render=function(){var r=T(this.props),s=r[0],a=r[1],l=D({zIndex:2,position:"absolute",pointerEvents:"none",top:0,left:0,bottom:0,right:0},a.style);return M.createElement("canvas",Object.assign({width:s.width,height:s.height,ref:this.canvas},a,{style:l}))},e})(f.Component);B.defaultProps=D({},F);B.displayName="ConfettiReact";var Ke=M.forwardRef(function(i,e){return M.createElement(B,Object.assign({canvasRef:Y},i))});function $e({id:i}){return i?o.jsx(we,{children:()=>o.jsx(Ke,{run:!!i,recycle:!1,numberOfPieces:800,width:window.innerWidth,height:window.innerHeight},i)}):null}function ze(){return o.jsx("div",{className:"border-destructive bg-destructive fixed top-0 right-0 left-0 z-50 border-b",children:o.jsxs("div",{className:"relative w-full p-4",children:[o.jsx(Z,{to:"/workspace-structure",className:"absolute inset-0 z-10 block h-full w-full","aria-label":"Learn more about workspace structure"}),o.jsxs("div",{className:"relative z-0 container flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(q,{name:"Error",className:"text-destructive-foreground h-5 w-5"}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-destructive-foreground text-sm font-semibold",children:"Warning: Changes detected in exercises directory"}),o.jsx("p",{className:"text-destructive-foreground/80 text-xs",children:"You should typically work in the playground directory, not the exercises directory."})]})]}),o.jsxs("div",{className:"text-destructive-foreground flex items-center gap-2 text-xs",children:[o.jsx("span",{children:"Learn more"}),o.jsx(q,{name:"ArrowRight",className:"h-3 w-3"})]})]})]})})}const Xe=[{title:"Command Palette",shortcuts:[{keys:["Cmd/Ctrl","Shift","P"],description:"Open command palette"}]},{title:"Navigation",shortcuts:[{keys:["g","h"],description:"Go to home"},{keys:["g","1-9"],description:"Go to exercise (e.g., g+1 → /exercise/01)"},{keys:["g","1-9",".","1-9"],description:"Go to exercise step (e.g., g+1+.+2 → /exercise/01/02/problem)"},{keys:["g","1-9",".","f"],description:"Go to exercise finished page (e.g., g+1+.+f → /exercise/01/finished)"},{keys:["g","p"],description:"Go to previous step/page"},{keys:["g","n"],description:"Go to next step/page"},{keys:["s","p"],description:"Set playground to current exercise"},{keys:["s","p","p"],description:"Reset playground to current exercise"},{keys:["g","o"],description:"Go to exercise set in playground"},{keys:["g","a"],description:"Go to account page"},{keys:["g","d"],description:"Go to admin page"},{keys:["g","l"],description:"Go to last exercise solution"},{keys:["Escape"],description:"Close sidebar navigation (when open)"}]},{title:"Playback Controls",shortcuts:[{keys:["Space","k"],description:"Play/pause video"},{keys:["j"],description:"Seek backward 10 seconds"},{keys:["l"],description:"Seek forward 10 seconds"},{keys:["←"],description:"Seek backward 10 seconds"},{keys:["→"],description:"Seek forward 10 seconds"}]},{title:"Frame-by-Frame Navigation",shortcuts:[{keys:[","],description:"Go to previous frame (when paused)"},{keys:["."],description:"Go to next frame (when paused)"}]},{title:"Volume Control",shortcuts:[{keys:["↑"],description:"Increase volume by 10%"},{keys:["↓"],description:"Decrease volume by 10%"}]},{title:"Playback Speed",shortcuts:[{keys:["Shift",">"],description:"Increase playback speed"},{keys:["Shift","<"],description:"Decrease playback speed"}]},{title:"Fullscreen and Picture-in-Picture",shortcuts:[{keys:["f"],description:"Toggle fullscreen mode"},{keys:["i"],description:"Toggle picture-in-picture mode"}]},{title:"Captions",shortcuts:[{keys:["c"],description:"Toggle captions/subtitles"}]},{title:"Quick Seek",shortcuts:[{keys:["0-9"],description:"Seek to percentage of video (0 = 0%, 1 = 10%, ..., 9 = 90%)"}]}];function Je({open:i,onOpenChange:e}){return o.jsx(Q,{open:i,onOpenChange:e,children:o.jsxs(xe,{className:"max-h-[80vh] max-w-2xl overflow-y-auto",children:[o.jsxs(ge,{children:[o.jsx(ve,{children:"Keyboard Shortcuts"}),o.jsxs(ye,{children:["Use these keyboard shortcuts to navigate and control the video player. Press"," ",o.jsx("kbd",{className:"border-border bg-muted rounded border px-1.5 py-0.5 font-mono text-xs",children:"?"})," ","or select the question mark icon in the navigation to open this list."]})]}),o.jsx("div",{className:"space-y-6",children:Xe.map(n=>o.jsxs("div",{children:[o.jsx("h3",{className:"text-foreground mb-3 text-sm font-semibold",children:n.title}),o.jsx("div",{className:"space-y-2",children:n.shortcuts.map((t,r)=>o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx("span",{className:"text-muted-foreground flex-1 text-sm",children:t.description}),o.jsx("div",{className:"flex shrink-0 items-center gap-1",children:t.keys.map((s,a)=>o.jsxs(f.Fragment,{children:[o.jsx("kbd",{className:"border-border bg-muted rounded border px-2 py-1 font-mono text-xs",children:s}),a<t.keys.length-1&&o.jsx("span",{className:"text-muted-foreground",children:"+"})]},a))})]},r))})]},n.title))}),o.jsx("div",{className:"border-border mt-4 border-t pt-4",children:o.jsxs("p",{className:"text-muted-foreground text-xs",children:[o.jsx("strong",{children:"Note:"})," Shortcuts are ignored when focus is on interactive elements (inputs, buttons, etc.). Press"," ",o.jsx("kbd",{className:"border-border bg-muted rounded border px-1.5 py-0.5 font-mono text-xs",children:"?"})," ","to toggle this dialog."]})})]})})}function Ze({toast:i}){return o.jsxs(o.Fragment,{children:[o.jsx(je,{closeButton:!0,position:"top-center"}),i?o.jsx(et,{toast:i}):null]})}function et({toast:i}){const{id:e,type:n,title:t,description:r}=i;return f.useEffect(()=>{setTimeout(()=>{v[n](t,{id:e,description:r})},0)},[r,e,t,n]),null}function tt({repoUpdates:i}){const{updatesAvailable:e,repoUpdatesAvailable:n,dependenciesNeedInstall:t,updateNotificationId:r,diffLink:s}=i,a=V(),l=f.useRef(a);f.useEffect(()=>{l.current=a},[a]);const c=f.useRef(null),d=f.useRef(null),j=f.useRef(!1);return f.useEffect(()=>{if(e&&r){d.current&&(v.dismiss(d.current),d.current=null);const N=n?"New workshop updates available":"Dependencies out of date",p=n?o.jsxs("div",{children:[t?"Get the latest updates and reinstall dependencies by clicking the update button. ":"Get the latest updates by clicking the update button. ",s?o.jsx("a",{href:s,target:"_blank",rel:"noreferrer",className:"text-xs underline",children:"View changes"}):null]}):o.jsxs("div",{children:["Your installed packages don't match package.json. ","Click the update button to reinstall dependencies."]}),S=v.info(N,{duration:1/0,description:p,onDismiss:()=>{},action:{label:"Update",onClick:async()=>{if(d.current&&(v.dismiss(d.current),d.current=null),c.current||(c.current=v.loading("Update in progress...")),!j.current){j.current=!0;try{const{EPICSHOP_PARENT_PORT:w,EPICSHOP_PARENT_TOKEN:b}=window.ENV||{};if(!w||!b)throw new Error("Update API not available");const m=await fetch(`http://localhost:${w}/__epicshop-restart`,{method:"POST",headers:{"x-epicshop-token":b}});if(!m.ok)throw new Error(`Request to update workshop failed: ${m.statusText}`);const x=await m.json().catch(()=>({})),g=Ne({status:Se(["ok","error"]),message:Ie().optional()}).safeParse(x);if(!g.success)throw console.error("Invalid response from update API",x),new Error("Invalid response from update API");const{status:O,message:k}=g.data;if(O==="ok"){let I=!1;v.success("Workshop updated",{description:"Reloading in 2 seconds... You can reload now if you prefer.",duration:2e3,action:{label:"Reload now",onClick:()=>{I=!0,window.location.reload()}},onAutoClose:()=>{I||window.location.reload()}})}else v.error("Failed to update workshop",{description:k||"Unknown error"})}catch(w){v.error("Failed to update workshop",{description:w instanceof Error?w.message:String(w)})}finally{j.current=!1,c.current&&(v.dismiss(c.current),c.current=null)}}}},cancel:{label:"Dismiss",onClick:()=>{d.current&&(v.dismiss(d.current),d.current=null),l.current.submit({intent:"mute",id:r},{method:"post",action:"/admin/notifications"})}}});d.current=S}},[e,r,n,t,s]),null}function nt({unmutedNotifications:i}){const e=V(),n=f.useRef(e),t=f.useRef(new Set);return f.useEffect(()=>{for(const r of i)t.current.has(r.id)||(t.current.add(r.id),v.info(r.title,{id:r.id,description:o.jsxs("div",{children:[o.jsx("p",{children:r.message}),r.link&&o.jsx("a",{href:r.link,target:"_blank",className:"text-xs underline",children:"Learn more"})]}),duration:1/0,action:{label:"Dismiss",onClick:()=>{n.current.submit({intent:"mute",id:r.id},{method:"post",action:"/admin/notifications"})}}}))},[i]),null}const st="/assets/app-BUxWY8xC.css",rt="/assets/tailwind-Fa5KHifZ.css",it="unknown@example.com";function ot({user:i,userId:e}){const n=i?.id??e?.id??void 0,t=i?.email&&i.email!==it?i.email:void 0;if(!n&&!t)return null;const r={};return n&&(r.id=n),t&&(r.email=t),r}const Et=()=>[{rel:"stylesheet",href:"/neogrotesk-font.css"},{rel:"stylesheet",href:"https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,200;0,300;0,400;0,500;0,600;1,700&display=swap"},{rel:"stylesheet",href:rt},{rel:"stylesheet",href:st},{rel:"icon",href:"/favicon.ico",sizes:"48x48"},{rel:"icon",type:"image/svg+xml",href:"/favicon.svg"}],Mt=({loaderData:i})=>i?Me({instructor:i.instructor,title:i.workshopTitle,description:i.workshopSubtitle,requestInfo:i.requestInfo}):[];function K({children:i,env:e={},className:n,style:t}){return o.jsxs("html",{lang:"en",className:n,style:t,children:[o.jsxs("head",{children:[o.jsx(Ce,{}),o.jsx(re,{}),o.jsx("meta",{charSet:"utf-8"}),o.jsx("meta",{name:"viewport",content:"width=device-width,initial-scale=1"}),o.jsx(ie,{}),o.jsx("script",{dangerouslySetInnerHTML:{__html:`window.ENV = ${JSON.stringify(e)}`}})]}),o.jsxs("body",{className:"bg-background text-foreground scrollbar-thin scrollbar-thumb-scrollbar h-screen-safe",children:[i,o.jsx(oe,{}),o.jsx(ae,{})]})]})}function at(){const i=W(),e=ne(),n=le.useSpinDelay(e.state!=="idle",{delay:400,minDuration:200}),t=ue(),[r,s]=f.useState(!1),a=f.useMemo(()=>({user:i.user,userHasAccess:i.userHasAccess}),[i.user,i.userHasAccess]);f.useEffect(()=>{const c=()=>{s(d=>!d)};return window.addEventListener("toggle-keyboard-shortcuts",c),()=>{window.removeEventListener("toggle-keyboard-shortcuts",c)}},[]),f.useEffect(()=>{if(!ENV.EPICSHOP_IS_PUBLISHED)return;const c=ot({user:i.user,userId:i.userId});$(()=>import("./index.client-CeP10vNl.js"),__vite__mapDeps([0,1])).then(d=>{c?d.setUser(c):d.setUser(null)}).catch(()=>{})},[i.user,i.userId]);const l=Oe();return o.jsxs(K,{style:i.preferences?.fontSize?{fontSize:`${i.preferences?.fontSize}px`}:{},className:_("h-screen-safe antialiased",l,{"cursor-progress":n},t?"alt-down":null),env:i.ENV,children:[i.exerciseChanges&&!i.preferences?.exerciseWarning?.dismissed&&o.jsx(ze,{}),o.jsx(se,{}),o.jsx($e,{id:i.confettiId}),o.jsx(Ze,{toast:i.toast}),o.jsx(tt,{repoUpdates:i.repoUpdates}),o.jsx(ke,{}),o.jsx(nt,{unmutedNotifications:i.unmutedNotifications}),o.jsx(Ae,{rootData:a}),o.jsx(Je,{open:r,onOpenChange:s})]})}const Dt=ee(function(){const{user:e}=W();return o.jsx(Ee,{user:e,children:o.jsx(Pe,{children:o.jsx(at,{})})})}),_t=te(function(){return o.jsx(K,{className:"h-screen-safe",children:o.jsx(be,{})})});export{_t as ErrorBoundary,Dt as default,Et as links,Mt as meta};
3
- //# sourceMappingURL=root-BfDhr_Iz.js.map
2
+ import{_ as K}from"./preload-helper-BXl3LOEh.js";import{e as z,u as X,M as J,L as Z,f as H,w as ee,a as te,b as W,k as ne,O as se,P as re,Q as ie,S as oe,T as ae}from"./chunk-JZWAC4HX-0uKZ9a0b.js";import{j as o}from"./jsx-runtime-C5WNSv3b.js";import{r as f,g as ce,R as M}from"./index-Bi6L2ga8.js";import{c as _,I as q,d as le,u as ue}from"./misc-w_rthUBN.js";import{D as Y,T as de,g as fe,h as he,i as pe,C as me,a as xe,b as ge,c as ve,d as ye}from"./dialog-BaCkYFMm.js";import{c as h}from"./command-palette-B5RrTjmt.js";import{C as we}from"./client-only-CUo_KSMO.js";import{G as be}from"./error-boundary-CDP8QJH3.js";import{E as ke}from"./progress-bar-DTHojpoN.js";import{T as je,t as v}from"./index-E_6kulJP.js";import{m as Pe}from"./tooltip-DXU4r0k_.js";import{o as Ne,s as Ie,j as Se}from"./schemas-siASSt6b.js";import{u as Ce,C as Oe}from"./index-BCfhIjlz.js";import{P as Ee}from"./presence-Du0emDp8.js";import{g as Me}from"./seo-t5J-DRxw.js";import"./index-D7hprM2E.js";import"./pe-tear8uic.js";import"./index-B2VNpNxJ.js";import"./root-loader-DlSJfUY6.js";import"./online-CIe0rJXF.js";import"./coerce-f7UHRcUL.js";function De(i){return h.subscribe(i)}function L(){return h.getSnapshot()}function _e({className:i,children:e,...n}){return o.jsxs(he,{children:[o.jsx(pe,{}),o.jsx(me,{className:_("bg-background fixed top-[20vh] left-[50%] z-50 w-[min(720px,calc(100vw-2rem))] translate-x-[-50%] overflow-hidden rounded-lg border shadow-lg",i),...n,children:e})]})}function Re(){return f.useSyncExternalStore(De,L,L)}function Te(i){for(const e of i){const n=e.data;if(!n||typeof n!="object")continue;const t=n;if(Array.isArray(t.exercises)&&Array.isArray(t.extras)&&t.playground)return t}return null}function Ae({rootData:i}){const e=Re(),n=z(),t=X(),r=J(),s=f.useMemo(()=>Te(r),[r]),a=f.useMemo(()=>{const u={navigate:n,pathname:t.pathname,appLayoutData:s};return i&&(u.rootData=i),u},[n,t.pathname,s,i]);f.useEffect(()=>(h.setHost(a),()=>h.setHost(null)),[a]);const l=f.useMemo(()=>({type:"commands",placeholder:"Type a command…",query:"",selectedIndex:0}),[]),c=e.viewStack[e.viewStack.length-1]??e.viewStack[0]??l,d="promptId"in c?c.promptId:null,j=f.useRef(null),N=f.useRef(null);f.useEffect(()=>{if(!e.open)return;const u=window.setTimeout(()=>j.current?.focus(),0);return()=>window.clearTimeout(u)},[e.open,c.type,d]),f.useEffect(()=>{if(!e.open||c.type==="text"||c.type==="number")return;const u=N.current;if(!u)return;u.querySelector(`[data-command-palette-entry][data-entry-index="${c.selectedIndex}"]`)?.scrollIntoView({block:"nearest"})},[e.open,c.type,d,c.selectedIndex,c.query,e.entries.length]);const p=c.type==="commands"?"Enter to run • Backspace to close • Esc to close":c.type==="select"?"Enter to select • Backspace to go back • Esc to close":"Enter to submit • Backspace to go back • Esc to close";function S(u){u?h.open():h.close()}function w(u){if(u.key==="ArrowDown"){u.preventDefault(),h.moveSelection(1);return}if(u.key==="ArrowUp"){u.preventDefault(),h.moveSelection(-1);return}if(u.key==="Escape"){u.preventDefault(),h.close();return}if(u.key==="Backspace"&&c.query.length===0){u.preventDefault(),e.viewStack.length>1?h.back():h.close();return}u.key==="Enter"&&(u.preventDefault(),c.type==="text"||c.type==="number"?h.submitCurrentInput():h.submitSelected())}const b=c.type==="commands"?"Command Palette":"title"in c?c.title:"",m=c.type==="text"||c.type==="number"?c.description:void 0;if(!e.open)return null;let x;return o.jsx(Y,{open:e.open,onOpenChange:S,children:o.jsxs(_e,{className:"p-0",children:[o.jsx(de,{className:"sr-only",children:b}),o.jsx(fe,{className:"sr-only",children:m?`${p}. ${m}`:p}),o.jsxs("div",{className:"border-border border-b px-4 py-3",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-foreground truncate text-sm font-medium",children:b}),o.jsx("p",{className:"text-muted-foreground truncate text-xs",children:p})]}),o.jsx("kbd",{className:"border-border bg-muted text-muted-foreground shrink-0 rounded border px-1.5 py-0.5 font-mono text-[11px]",children:"Esc"})]}),o.jsxs("div",{className:"mt-3",children:[o.jsx("input",{ref:j,value:c.query,onChange:u=>h.setQuery(u.target.value),onKeyDown:w,placeholder:c.placeholder,autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",spellCheck:!1,inputMode:c.type==="number"?"numeric":"search",className:_("border-border bg-background text-foreground placeholder:text-muted-foreground w-full rounded-md border px-3 py-2 text-sm outline-none","focus-visible:ring-ring focus-visible:ring-offset-background focus-visible:ring-2 focus-visible:ring-offset-2")}),m?o.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:m}):null,e.errorMessage?o.jsx("p",{className:"text-foreground-destructive mt-2 text-xs",children:e.errorMessage}):null]})]}),o.jsx("div",{ref:N,className:"max-h-[55vh] overflow-y-auto p-1",children:c.type==="text"||c.type==="number"?o.jsxs("div",{className:"text-muted-foreground px-4 py-6 text-sm",children:["Press"," ",o.jsx("kbd",{className:"border-border bg-muted mx-1 rounded border px-1.5 py-0.5 font-mono text-[11px]",children:"Enter"})," ","to submit."]}):e.entries.length?o.jsx("ul",{className:"flex flex-col gap-0.5",children:e.entries.map((u,g)=>{const C=g===c.selectedIndex,k=u.group,I=!!k&&k!==x;return k&&(x=k),o.jsxs(f.Fragment,{children:[I?o.jsx("li",{className:"text-muted-foreground px-2 pt-2 pb-1 text-xs font-semibold",children:k}):null,o.jsx("li",{children:o.jsxs("button",{type:"button","data-command-palette-entry":!0,"data-entry-index":g,disabled:u.disabled,onMouseMove:()=>h.setSelection(g),onClick:()=>{h.setSelection(g),h.submitSelected()},className:_("flex w-full items-start justify-between gap-4 rounded-md px-3 py-2 text-left text-sm transition-colors",C?"bg-muted":"hover:bg-muted/60",u.disabled?"text-muted-foreground cursor-not-allowed opacity-70":"text-foreground"),children:[o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate font-medium",children:u.title}),u.subtitle?o.jsx("span",{className:"text-muted-foreground block truncate text-xs",children:u.subtitle}):null]}),u.shortcut?o.jsx("kbd",{className:"border-border bg-muted text-muted-foreground shrink-0 rounded border px-1.5 py-0.5 font-mono text-[11px]",children:u.shortcut}):null]})})]},u.id)})}):o.jsx("div",{className:"text-muted-foreground px-4 py-6 text-sm",children:"No results."})})]})})}var R,V;function Fe(){if(V)return R;V=1;var i={linear:function(e,n,t,r){var s=t-n;return s*e/r+n},easeInQuad:function(e,n,t,r){var s=t-n;return s*(e/=r)*e+n},easeOutQuad:function(e,n,t,r){var s=t-n;return-s*(e/=r)*(e-2)+n},easeInOutQuad:function(e,n,t,r){var s=t-n;return(e/=r/2)<1?s/2*e*e+n:-s/2*(--e*(e-2)-1)+n},easeInCubic:function(e,n,t,r){var s=t-n;return s*(e/=r)*e*e+n},easeOutCubic:function(e,n,t,r){var s=t-n;return s*((e=e/r-1)*e*e+1)+n},easeInOutCubic:function(e,n,t,r){var s=t-n;return(e/=r/2)<1?s/2*e*e*e+n:s/2*((e-=2)*e*e+2)+n},easeInQuart:function(e,n,t,r){var s=t-n;return s*(e/=r)*e*e*e+n},easeOutQuart:function(e,n,t,r){var s=t-n;return-s*((e=e/r-1)*e*e*e-1)+n},easeInOutQuart:function(e,n,t,r){var s=t-n;return(e/=r/2)<1?s/2*e*e*e*e+n:-s/2*((e-=2)*e*e*e-2)+n},easeInQuint:function(e,n,t,r){var s=t-n;return s*(e/=r)*e*e*e*e+n},easeOutQuint:function(e,n,t,r){var s=t-n;return s*((e=e/r-1)*e*e*e*e+1)+n},easeInOutQuint:function(e,n,t,r){var s=t-n;return(e/=r/2)<1?s/2*e*e*e*e*e+n:s/2*((e-=2)*e*e*e*e+2)+n},easeInSine:function(e,n,t,r){var s=t-n;return-s*Math.cos(e/r*(Math.PI/2))+s+n},easeOutSine:function(e,n,t,r){var s=t-n;return s*Math.sin(e/r*(Math.PI/2))+n},easeInOutSine:function(e,n,t,r){var s=t-n;return-s/2*(Math.cos(Math.PI*e/r)-1)+n},easeInExpo:function(e,n,t,r){var s=t-n;return e==0?n:s*Math.pow(2,10*(e/r-1))+n},easeOutExpo:function(e,n,t,r){var s=t-n;return e==r?n+s:s*(-Math.pow(2,-10*e/r)+1)+n},easeInOutExpo:function(e,n,t,r){var s=t-n;return e===0?n:e===r?n+s:(e/=r/2)<1?s/2*Math.pow(2,10*(e-1))+n:s/2*(-Math.pow(2,-10*--e)+2)+n},easeInCirc:function(e,n,t,r){var s=t-n;return-s*(Math.sqrt(1-(e/=r)*e)-1)+n},easeOutCirc:function(e,n,t,r){var s=t-n;return s*Math.sqrt(1-(e=e/r-1)*e)+n},easeInOutCirc:function(e,n,t,r){var s=t-n;return(e/=r/2)<1?-s/2*(Math.sqrt(1-e*e)-1)+n:s/2*(Math.sqrt(1-(e-=2)*e)+1)+n},easeInElastic:function(e,n,t,r){var s=t-n,a,l,c;return c=1.70158,l=0,a=s,e===0?n:(e/=r)===1?n+s:(l||(l=r*.3),a<Math.abs(s)?(a=s,c=l/4):c=l/(2*Math.PI)*Math.asin(s/a),-(a*Math.pow(2,10*(e-=1))*Math.sin((e*r-c)*(2*Math.PI)/l))+n)},easeOutElastic:function(e,n,t,r){var s=t-n,a,l,c;return c=1.70158,l=0,a=s,e===0?n:(e/=r)===1?n+s:(l||(l=r*.3),a<Math.abs(s)?(a=s,c=l/4):c=l/(2*Math.PI)*Math.asin(s/a),a*Math.pow(2,-10*e)*Math.sin((e*r-c)*(2*Math.PI)/l)+s+n)},easeInOutElastic:function(e,n,t,r){var s=t-n,a,l,c;return c=1.70158,l=0,a=s,e===0?n:(e/=r/2)===2?n+s:(l||(l=r*(.3*1.5)),a<Math.abs(s)?(a=s,c=l/4):c=l/(2*Math.PI)*Math.asin(s/a),e<1?-.5*(a*Math.pow(2,10*(e-=1))*Math.sin((e*r-c)*(2*Math.PI)/l))+n:a*Math.pow(2,-10*(e-=1))*Math.sin((e*r-c)*(2*Math.PI)/l)*.5+s+n)},easeInBack:function(e,n,t,r,s){var a=t-n;return s===void 0&&(s=1.70158),a*(e/=r)*e*((s+1)*e-s)+n},easeOutBack:function(e,n,t,r,s){var a=t-n;return s===void 0&&(s=1.70158),a*((e=e/r-1)*e*((s+1)*e+s)+1)+n},easeInOutBack:function(e,n,t,r,s){var a=t-n;return s===void 0&&(s=1.70158),(e/=r/2)<1?a/2*(e*e*(((s*=1.525)+1)*e-s))+n:a/2*((e-=2)*e*(((s*=1.525)+1)*e+s)+2)+n},easeInBounce:function(e,n,t,r){var s=t-n,a;return a=i.easeOutBounce(r-e,0,s,r),s-a+n},easeOutBounce:function(e,n,t,r){var s=t-n;return(e/=r)<1/2.75?s*(7.5625*e*e)+n:e<2/2.75?s*(7.5625*(e-=1.5/2.75)*e+.75)+n:e<2.5/2.75?s*(7.5625*(e-=2.25/2.75)*e+.9375)+n:s*(7.5625*(e-=2.625/2.75)*e+.984375)+n},easeInOutBounce:function(e,n,t,r){var s=t-n,a;return e<r/2?(a=i.easeInBounce(e*2,0,s,r),a*.5+n):(a=i.easeOutBounce(e*2-r,0,s,r),a*.5+s*.5+n)}};return R=i,R}var Be=Fe();const Ge=ce(Be);function Ue(i,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(i,t.key,t)}}function qe(i,e,n){return e&&Ue(i.prototype,e),i}function D(){return D=Object.assign||function(i){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(i[t]=n[t])}return i},D.apply(this,arguments)}function Le(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,A(i,e)}function A(i,e){return A=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t},A(i,e)}function Ve(i){return i*Math.PI/180}function y(i,e){return i+Math.random()*(e-i)}function He(i,e){return Math.floor(i+Math.random()*(e-i+1))}var E;(function(i){i[i.Circle=0]="Circle",i[i.Square=1]="Square",i[i.Strip=2]="Strip"})(E||(E={}));var P;(function(i){i[i.Positive=1]="Positive",i[i.Negative=-1]="Negative"})(P||(P={}));var We=(function(){function i(n,t,r,s){this.getOptions=t;var a=this.getOptions(),l=a.colors,c=a.initialVelocityX,d=a.initialVelocityY;this.context=n,this.x=r,this.y=s,this.w=y(5,20),this.h=y(5,20),this.radius=y(5,10),this.vx=y(-c,c),this.vy=y(-d,0),this.shape=He(0,2),this.angle=Ve(y(0,360)),this.angularSpin=y(-.2,.2),this.color=l[Math.floor(Math.random()*l.length)],this.rotateY=y(0,1),this.rotationDirection=y(0,1)?P.Positive:P.Negative}var e=i.prototype;return e.update=function(){var t=this.getOptions(),r=t.gravity,s=t.wind,a=t.friction,l=t.opacity,c=t.drawShape;this.x+=this.vx,this.y+=this.vy,this.vy+=r,this.vx+=s,this.vx*=a,this.vy*=a,this.rotateY>=1&&this.rotationDirection===P.Positive?this.rotationDirection=P.Negative:this.rotateY<=-1&&this.rotationDirection===P.Negative&&(this.rotationDirection=P.Positive);var d=.1*this.rotationDirection;if(this.rotateY+=d,this.angle+=this.angularSpin,this.context.save(),this.context.translate(this.x,this.y),this.context.rotate(this.angle),this.context.scale(1,this.rotateY),this.context.rotate(this.angle),this.context.beginPath(),this.context.fillStyle=this.color,this.context.strokeStyle=this.color,this.context.globalAlpha=l,this.context.lineCap="round",this.context.lineWidth=2,c&&typeof c=="function")c.call(this,this.context);else switch(this.shape){case E.Circle:{this.context.beginPath(),this.context.arc(0,0,this.radius,0,2*Math.PI),this.context.fill();break}case E.Square:{this.context.fillRect(-this.w/2,-this.h/2,this.w,this.h);break}case E.Strip:{this.context.fillRect(-this.w/6,-this.h/2,this.w/3,this.h);break}default:throw new Error("Unknown type in Particle.ts")}this.context.closePath(),this.context.restore()},i})(),Ye=function(e,n){var t=this;this.x=0,this.y=0,this.w=0,this.h=0,this.lastNumberOfPieces=0,this.tweenInitTime=Date.now(),this.particles=[],this.particlesGenerated=0,this.removeParticleAt=function(s){t.particles.splice(s,1)},this.getParticle=function(){var s=y(t.x,t.w+t.x),a=y(t.y,t.h+t.y);return new We(t.context,t.getOptions,s,a)},this.animate=function(){var s=t.canvas,a=t.context,l=t.particlesGenerated,c=t.lastNumberOfPieces,d=t.getOptions(),j=d.run,N=d.recycle,p=d.numberOfPieces,S=d.debug,w=d.tweenFunction,b=d.tweenDuration;if(!j)return!1;var m=t.particles.length,x=N?m:l,u=Date.now();if(x<p){c!==p&&(t.tweenInitTime=u,t.lastNumberOfPieces=p);for(var g=t.tweenInitTime,C=u-g>b?b:Math.max(0,u-g),k=w(C,x,p,b),I=Math.round(k-x),G=0;G<I;G+=1)t.particles.push(t.getParticle());t.particlesGenerated+=I}return S&&(a.font="12px sans-serif",a.fillStyle="#333",a.textAlign="right",a.fillText("Particles: "+m,s.width-10,s.height-20)),t.particles.forEach(function(O,U){O.update(),(O.y>s.height||O.y<-100||O.x>s.width+100||O.x<-100)&&(N&&x<=p?t.particles[U]=t.getParticle():t.removeParticleAt(U))}),m>0||x<p},this.canvas=e;var r=this.canvas.getContext("2d");if(!r)throw new Error("Could not get canvas context");this.context=r,this.getOptions=n},F={width:typeof window<"u"?window.innerWidth:300,height:typeof window<"u"?window.innerHeight:200,numberOfPieces:200,friction:.99,wind:0,gravity:.1,initialVelocityX:4,initialVelocityY:10,colors:["#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#2196f3","#03a9f4","#00bcd4","#009688","#4CAF50","#8BC34A","#CDDC39","#FFEB3B","#FFC107","#FF9800","#FF5722","#795548"],opacity:1,debug:!1,tweenFunction:Ge.easeInOutQuad,tweenDuration:5e3,recycle:!0,run:!0},Qe=(function(){function i(e,n){var t=this;this.setOptionsWithDefaults=function(s){var a={confettiSource:{x:0,y:0,w:t.canvas.width,h:0}};t._options=D({},a,F,s),Object.assign(t,s.confettiSource)},this.update=function(){var s=t.options,a=s.run,l=s.onConfettiComplete,c=t.canvas,d=t.context;a&&(d.fillStyle="white",d.clearRect(0,0,c.width,c.height)),t.generator.animate()?t.rafId=requestAnimationFrame(t.update):(l&&typeof l=="function"&&t.generator.particlesGenerated>0&&l.call(t,t),t._options.run=!1)},this.reset=function(){t.generator&&t.generator.particlesGenerated>0&&(t.generator.particlesGenerated=0,t.generator.particles=[],t.generator.lastNumberOfPieces=0)},this.stop=function(){t.options={run:!1},t.rafId&&(cancelAnimationFrame(t.rafId),t.rafId=void 0)},this.canvas=e;var r=this.canvas.getContext("2d");if(!r)throw new Error("Could not get canvas context");this.context=r,this.generator=new Ye(this.canvas,function(){return t.options}),this.options=n,this.update()}return qe(i,[{key:"options",get:function(){return this._options},set:function(n){var t=this._options&&this._options.run,r=this._options&&this._options.recycle;this.setOptionsWithDefaults(n),this.generator&&(Object.assign(this.generator,this.options.confettiSource),typeof n.recycle=="boolean"&&n.recycle&&r===!1&&(this.generator.lastNumberOfPieces=this.generator.particles.length)),typeof n.run=="boolean"&&n.run&&t===!1&&this.update()}}]),i})(),Q=M.createRef();function T(i){var e={},n={},t={},r=[].concat(Object.keys(F),["confettiSource","drawShape","onConfettiComplete"]),s=["canvasRef"];return Object.keys(i).forEach(function(a){var l=i[a];r.includes(a)?e[a]=l:s.includes(a)?s[a]=l:t[a]=l}),[e,t,n]}var B=(function(i){Le(e,i);function e(t){var r;return r=i.call(this,t)||this,r.canvas=M.createRef(),r.canvas=t.canvasRef||Q,r}var n=e.prototype;return n.componentDidMount=function(){if(this.canvas.current){var r=T(this.props)[0];this.confetti=new Qe(this.canvas.current,r)}},n.componentDidUpdate=function(){var r=T(this.props)[0];this.confetti&&(this.confetti.options=r)},n.componentWillUnmount=function(){this.confetti&&this.confetti.stop(),this.confetti=void 0},n.render=function(){var r=T(this.props),s=r[0],a=r[1],l=D({zIndex:2,position:"absolute",pointerEvents:"none",top:0,left:0,bottom:0,right:0},a.style);return M.createElement("canvas",Object.assign({width:s.width,height:s.height,ref:this.canvas},a,{style:l}))},e})(f.Component);B.defaultProps=D({},F);B.displayName="ConfettiReact";var $e=M.forwardRef(function(i,e){return M.createElement(B,Object.assign({canvasRef:Q},i))});function Ke({id:i}){return i?o.jsx(we,{children:()=>o.jsx($e,{run:!!i,recycle:!1,numberOfPieces:800,width:window.innerWidth,height:window.innerHeight},i)}):null}function ze(){return o.jsx("div",{className:"border-destructive bg-destructive fixed top-0 right-0 left-0 z-50 border-b",children:o.jsxs("div",{className:"relative w-full p-4",children:[o.jsx(Z,{to:"/workspace-structure",className:"absolute inset-0 z-10 block h-full w-full","aria-label":"Learn more about workspace structure"}),o.jsxs("div",{className:"relative z-0 container flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(q,{name:"Error",className:"text-destructive-foreground h-5 w-5"}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-destructive-foreground text-sm font-semibold",children:"Warning: Changes detected in exercises directory"}),o.jsx("p",{className:"text-destructive-foreground/80 text-xs",children:"You should typically work in the playground directory, not the exercises directory."})]})]}),o.jsxs("div",{className:"text-destructive-foreground flex items-center gap-2 text-xs",children:[o.jsx("span",{children:"Learn more"}),o.jsx(q,{name:"ArrowRight",className:"h-3 w-3"})]})]})]})})}const Xe=[{title:"Command Palette",shortcuts:[{keys:["Cmd/Ctrl","Shift","P"],description:"Open command palette"}]},{title:"Navigation",shortcuts:[{keys:["g","h"],description:"Go to home"},{keys:["g","1-9"],description:"Go to exercise (e.g., g+1 → /exercise/01)"},{keys:["g","1-9",".","1-9"],description:"Go to exercise step (e.g., g+1+.+2 → /exercise/01/02/problem)"},{keys:["g","1-9",".","f"],description:"Go to exercise finished page (e.g., g+1+.+f → /exercise/01/finished)"},{keys:["g","p"],description:"Go to previous step/page"},{keys:["g","n"],description:"Go to next step/page"},{keys:["s","p"],description:"Set playground to current exercise"},{keys:["s","p","p"],description:"Reset playground to current exercise"},{keys:["g","o"],description:"Go to exercise set in playground"},{keys:["g","a"],description:"Go to account page"},{keys:["g","d"],description:"Go to admin page"},{keys:["g","l"],description:"Go to last exercise solution"},{keys:["Escape"],description:"Close sidebar navigation (when open)"}]},{title:"Playback Controls",shortcuts:[{keys:["Space","k"],description:"Play/pause video"},{keys:["j"],description:"Seek backward 10 seconds"},{keys:["l"],description:"Seek forward 10 seconds"},{keys:["←"],description:"Seek backward 10 seconds"},{keys:["→"],description:"Seek forward 10 seconds"}]},{title:"Frame-by-Frame Navigation",shortcuts:[{keys:[","],description:"Go to previous frame (when paused)"},{keys:["."],description:"Go to next frame (when paused)"}]},{title:"Volume Control",shortcuts:[{keys:["↑"],description:"Increase volume by 10%"},{keys:["↓"],description:"Decrease volume by 10%"}]},{title:"Playback Speed",shortcuts:[{keys:["Shift",">"],description:"Increase playback speed"},{keys:["Shift","<"],description:"Decrease playback speed"}]},{title:"Fullscreen and Picture-in-Picture",shortcuts:[{keys:["f"],description:"Toggle fullscreen mode"},{keys:["i"],description:"Toggle picture-in-picture mode"}]},{title:"Captions",shortcuts:[{keys:["c"],description:"Toggle captions/subtitles"}]},{title:"Quick Seek",shortcuts:[{keys:["0-9"],description:"Seek to percentage of video (0 = 0%, 1 = 10%, ..., 9 = 90%)"}]}];function Je({open:i,onOpenChange:e}){return o.jsx(Y,{open:i,onOpenChange:e,children:o.jsxs(xe,{className:"max-h-[80vh] max-w-2xl overflow-y-auto",children:[o.jsxs(ge,{children:[o.jsx(ve,{children:"Keyboard Shortcuts"}),o.jsxs(ye,{children:["Use these keyboard shortcuts to navigate and control the video player. Press"," ",o.jsx("kbd",{className:"border-border bg-muted rounded border px-1.5 py-0.5 font-mono text-xs",children:"?"})," ","or select the question mark icon in the navigation to open this list."]})]}),o.jsx("div",{className:"space-y-6",children:Xe.map(n=>o.jsxs("div",{children:[o.jsx("h3",{className:"text-foreground mb-3 text-sm font-semibold",children:n.title}),o.jsx("div",{className:"space-y-2",children:n.shortcuts.map((t,r)=>o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx("span",{className:"text-muted-foreground flex-1 text-sm",children:t.description}),o.jsx("div",{className:"flex shrink-0 items-center gap-1",children:t.keys.map((s,a)=>o.jsxs(f.Fragment,{children:[o.jsx("kbd",{className:"border-border bg-muted rounded border px-2 py-1 font-mono text-xs",children:s}),a<t.keys.length-1&&o.jsx("span",{className:"text-muted-foreground",children:"+"})]},a))})]},r))})]},n.title))}),o.jsx("div",{className:"border-border mt-4 border-t pt-4",children:o.jsxs("p",{className:"text-muted-foreground text-xs",children:[o.jsx("strong",{children:"Note:"})," Shortcuts are ignored when focus is on interactive elements (inputs, buttons, etc.). Press"," ",o.jsx("kbd",{className:"border-border bg-muted rounded border px-1.5 py-0.5 font-mono text-xs",children:"?"})," ","to toggle this dialog."]})})]})})}function Ze({toast:i}){return o.jsxs(o.Fragment,{children:[o.jsx(je,{closeButton:!0,position:"top-center"}),i?o.jsx(et,{toast:i}):null]})}function et({toast:i}){const{id:e,type:n,title:t,description:r}=i;return f.useEffect(()=>{setTimeout(()=>{v[n](t,{id:e,description:r})},0)},[r,e,t,n]),null}function tt({repoUpdates:i}){const{updatesAvailable:e,repoUpdatesAvailable:n,dependenciesNeedInstall:t,updateNotificationId:r,diffLink:s}=i,a=H(),l=f.useRef(a);f.useEffect(()=>{l.current=a},[a]);const c=f.useRef(null),d=f.useRef(null),j=f.useRef(!1);return f.useEffect(()=>{if(e&&r){d.current&&(v.dismiss(d.current),d.current=null);const N=n?"New workshop updates available":"Dependencies out of date",p=n?o.jsxs("div",{children:[t?"Get the latest updates and reinstall dependencies by clicking the update button. ":"Get the latest updates by clicking the update button. ",s?o.jsx("a",{href:s,target:"_blank",rel:"noreferrer",className:"text-xs underline",children:"View changes"}):null]}):o.jsxs("div",{children:["Your installed packages don't match package.json. ","Click the update button to reinstall dependencies."]}),S=v.info(N,{duration:1/0,description:p,onDismiss:()=>{},action:{label:"Update",onClick:async()=>{if(d.current&&(v.dismiss(d.current),d.current=null),c.current||(c.current=v.loading("Update in progress...")),!j.current){j.current=!0;try{const{EPICSHOP_PARENT_PORT:w,EPICSHOP_PARENT_TOKEN:b}=window.ENV||{};if(!w||!b)throw new Error("Update API not available");const m=await fetch(`http://localhost:${w}/__epicshop-restart`,{method:"POST",headers:{"x-epicshop-token":b}});if(!m.ok)throw new Error(`Request to update workshop failed: ${m.statusText}`);const x=await m.json().catch(()=>({})),g=Ne({status:Se(["ok","error"]),message:Ie().optional()}).safeParse(x);if(!g.success)throw console.error("Invalid response from update API",x),new Error("Invalid response from update API");const{status:C,message:k}=g.data;if(C==="ok"){let I=!1;v.success("Workshop updated",{description:"Reloading in 2 seconds... You can reload now if you prefer.",duration:2e3,action:{label:"Reload now",onClick:()=>{I=!0,window.location.reload()}},onAutoClose:()=>{I||window.location.reload()}})}else v.error("Failed to update workshop",{description:k||"Unknown error"})}catch(w){v.error("Failed to update workshop",{description:w instanceof Error?w.message:String(w)})}finally{j.current=!1,c.current&&(v.dismiss(c.current),c.current=null)}}}},cancel:{label:"Dismiss",onClick:()=>{d.current&&(v.dismiss(d.current),d.current=null),l.current.submit({intent:"mute",id:r},{method:"post",action:"/admin/notifications"})}}});d.current=S}},[e,r,n,t,s]),null}function nt({unmutedNotifications:i}){const e=H(),n=f.useRef(e),t=f.useRef(new Set);return f.useEffect(()=>{for(const r of i)t.current.has(r.id)||(t.current.add(r.id),v.info(r.title,{id:r.id,description:o.jsxs("div",{children:[o.jsx("p",{children:r.message}),r.link&&o.jsx("a",{href:r.link,target:"_blank",className:"text-xs underline",children:"Learn more"})]}),duration:1/0,action:{label:"Dismiss",onClick:()=>{n.current.submit({intent:"mute",id:r.id},{method:"post",action:"/admin/notifications"})}}}))},[i]),null}const st="/assets/app-BUxWY8xC.css",rt="/assets/tailwind-C4lY7wdh.css",it="unknown@example.com";function ot({user:i,userId:e}){const n=i?.id??e?.id??void 0,t=i?.email&&i.email!==it?i.email:void 0;if(!n&&!t)return null;const r={};return n&&(r.id=n),t&&(r.email=t),r}const Et=()=>[{rel:"stylesheet",href:"/neogrotesk-font.css"},{rel:"stylesheet",href:"https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,200;0,300;0,400;0,500;0,600;1,700&display=swap"},{rel:"stylesheet",href:rt},{rel:"stylesheet",href:st},{rel:"icon",href:"/favicon.ico",sizes:"48x48"},{rel:"icon",type:"image/svg+xml",href:"/favicon.svg"}],Mt=({loaderData:i})=>i?Me({instructor:i.instructor,title:i.workshopTitle,description:i.workshopSubtitle,requestInfo:i.requestInfo}):[];function $({children:i,env:e={},className:n,style:t}){return o.jsxs("html",{lang:"en",className:n,style:t,children:[o.jsxs("head",{children:[o.jsx(Oe,{}),o.jsx(re,{}),o.jsx("meta",{charSet:"utf-8"}),o.jsx("meta",{name:"viewport",content:"width=device-width,initial-scale=1"}),o.jsx(ie,{}),o.jsx("script",{dangerouslySetInnerHTML:{__html:`window.ENV = ${JSON.stringify(e)}`}})]}),o.jsxs("body",{className:"bg-background text-foreground scrollbar-thin scrollbar-thumb-scrollbar h-screen-safe",children:[i,o.jsx(oe,{}),o.jsx(ae,{})]})]})}function at(){const i=W(),e=ne(),n=le.useSpinDelay(e.state!=="idle",{delay:400,minDuration:200}),t=ue(),[r,s]=f.useState(!1),a=f.useMemo(()=>({user:i.user,userHasAccess:i.userHasAccess}),[i.user,i.userHasAccess]);f.useEffect(()=>{const c=()=>{s(d=>!d)};return window.addEventListener("toggle-keyboard-shortcuts",c),()=>{window.removeEventListener("toggle-keyboard-shortcuts",c)}},[]),f.useEffect(()=>{if(!ENV.EPICSHOP_IS_PUBLISHED)return;const c=ot({user:i.user,userId:i.userId});K(()=>import("./index.client-CeP10vNl.js"),__vite__mapDeps([0,1])).then(d=>{c?d.setUser(c):d.setUser(null)}).catch(()=>{})},[i.user,i.userId]);const l=Ce();return o.jsxs($,{style:i.preferences?.fontSize?{fontSize:`${i.preferences?.fontSize}px`}:{},className:_("h-screen-safe antialiased",l,{"cursor-progress":n},t?"alt-down":null),env:i.ENV,children:[i.exerciseChanges&&!i.preferences?.exerciseWarning?.dismissed&&o.jsx(ze,{}),o.jsx(se,{}),o.jsx(Ke,{id:i.confettiId}),o.jsx(Ze,{toast:i.toast}),o.jsx(tt,{repoUpdates:i.repoUpdates}),o.jsx(ke,{}),o.jsx(nt,{unmutedNotifications:i.unmutedNotifications}),o.jsx(Ae,{rootData:a}),o.jsx(Je,{open:r,onOpenChange:s})]})}const Dt=ee(function(){const{user:e}=W();return o.jsx(Ee,{user:e,children:o.jsx(Pe,{children:o.jsx(at,{})})})}),_t=te(function(){return o.jsx($,{className:"h-screen-safe",children:o.jsx(be,{})})});export{_t as ErrorBoundary,Dt as default,Et as links,Mt as meta};
3
+ //# sourceMappingURL=root-DK6bFtH3.js.map