@epic-web/workshop-app 4.12.1 → 4.12.3
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.
- package/build/client/assets/{_exerciseNumber-DN5AsSNn.js → _exerciseNumber-Ccwr4LZw.js} +2 -2
- package/build/client/assets/{_exerciseNumber-DN5AsSNn.js.map → _exerciseNumber-Ccwr4LZw.js.map} +1 -1
- package/build/client/assets/{_exerciseNumber_.finished-W3hcmvgu.js → _exerciseNumber_.finished-gEWcHsfL.js} +2 -2
- package/build/client/assets/{_exerciseNumber_.finished-W3hcmvgu.js.map → _exerciseNumber_.finished-gEWcHsfL.js.map} +1 -1
- package/build/client/assets/{_layout-qyqfsEt3.js → _layout-Bn9QhWq9.js} +2 -2
- package/build/client/assets/{_layout-qyqfsEt3.js.map → _layout-Bn9QhWq9.js.map} +1 -1
- package/build/client/assets/{_layout-CLLcE4oc.js → _layout-dHX2Hcew.js} +2 -2
- package/build/client/assets/{_layout-CLLcE4oc.js.map → _layout-dHX2Hcew.js.map} +1 -1
- package/build/client/assets/{diff-DczVYWk4.js → diff-Bd9WnUnR.js} +2 -2
- package/build/client/assets/{diff-DczVYWk4.js.map → diff-Bd9WnUnR.js.map} +1 -1
- package/build/client/assets/{diff-hpVBklM0.js → diff-CpG96hGZ.js} +2 -2
- package/build/client/assets/{diff-hpVBklM0.js.map → diff-CpG96hGZ.js.map} +1 -1
- package/build/client/assets/{epic-video--ydmGfR4.js → epic-video-DJN9_SUj.js} +2 -2
- package/build/client/assets/{epic-video--ydmGfR4.js.map → epic-video-DJN9_SUj.js.map} +1 -1
- package/build/client/assets/{finished-3FuL-PiH.js → finished-B9qjUR4B.js} +2 -2
- package/build/client/assets/{finished-3FuL-PiH.js.map → finished-B9qjUR4B.js.map} +1 -1
- package/build/client/assets/{index-DCO6tIXL.js → index-3HxjMIAS.js} +2 -2
- package/build/client/assets/{index-DCO6tIXL.js.map → index-3HxjMIAS.js.map} +1 -1
- package/build/client/assets/{index-DMhFsRrG.js → index-yEAxvbDV.js} +2 -2
- package/build/client/assets/{index-DMhFsRrG.js.map → index-yEAxvbDV.js.map} +1 -1
- package/build/client/assets/{manifest-3d1ca088.js → manifest-c6f58e89.js} +1 -1
- package/build/client/assets/{mdx-DF11h1m-.js → mdx-BENF-kTQ.js} +2 -2
- package/build/client/assets/{mdx-DF11h1m-.js.map → mdx-BENF-kTQ.js.map} +1 -1
- package/build/client/assets/{onboarding-CBm-xBhv.js → onboarding-FD1FkQuu.js} +2 -2
- package/build/client/assets/{onboarding-CBm-xBhv.js.map → onboarding-FD1FkQuu.js.map} +1 -1
- package/build/client/assets/{root-CW5sLiRQ.js → root-BoDjT72e.js} +3 -3
- package/build/client/assets/{root-CW5sLiRQ.js.map → root-BoDjT72e.js.map} +1 -1
- package/build/client/assets/{tailwind-D2vjZZFL.css → tailwind-BmwaW-Uw.css} +1 -1
- package/build/server/index.js +4 -5
- package/build/server/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as r,a as l,i as c}from"./index-Czg1ruVn.js";import{E as m}from"./index-D6ukHE4T.js";import{E as a}from"./epic-video
|
|
2
|
-
//# sourceMappingURL=_exerciseNumber-
|
|
1
|
+
import{j as r,a as l,i as c}from"./index-Czg1ruVn.js";import{E as m}from"./index-D6ukHE4T.js";import{E as a}from"./epic-video-DJN9_SUj.js";import{M as d,E as p}from"./mdx-BENF-kTQ.js";import{P as x}from"./progress-BwanvUpB.js";import{g as u}from"./misc-S5ZD98sI.js";import{g as f}from"./seo-pBpFCWsy.js";import{u as b,L as h}from"./components-wgHiPsTg.js";import"./index-yEAxvbDV.js";import"./request-info-DHtGM4FI.js";import"./tooltip-BtzSIxlB.js";import"./client-hints-DLYDs4RF.js";import"./loading-B0uKxERz.js";import"./user-CdUDQ7a8.js";import"./clsx-B-dksMZM.js";import"./progress-bar-wMXWRGq0.js";const V=({data:e,matches:o})=>{var i;const s=e==null?void 0:e.exercise.exerciseNumber.toString().padStart(2,"0"),t=(i=o.find(n=>n.id==="root"))==null?void 0:i.data;return!e||!t?[{title:"🦉 | Error"}]:f({title:`📝 | ${s}. ${e.exercise.title} | ${t==null?void 0:t.workshopTitle}`,description:`Introduction for ${s}. ${e.exercise.title}`,ogTitle:e.exercise.title,ogDescription:`Introduction for exercise ${Number(s)}`,instructor:t.instructor,requestInfo:t.requestInfo})},j={h1:()=>null};function q(){var t;const e=b(),s=`${String(((t=e.firstStep)==null?void 0:t.stepNumber)??"01").padStart(2,"0")}/${e.firstType}`;return r.jsxs("main",{className:"relative flex h-full w-full max-w-5xl flex-col justify-between border-r md:w-3/4 xl:w-2/3",children:[r.jsxs("article",{id:e.articleId,className:"shadow-on-scrollbox flex w-full flex-1 flex-col gap-12 overflow-y-scroll px-3 py-4 pt-6 scrollbar-thin scrollbar-thumb-scrollbar md:px-10 md:py-12 md:pt-16",children:[r.jsx("div",{children:r.jsx("h1",{className:"text-[clamp(3rem,6vw,7.5rem)] font-extrabold leading-none",children:e.exercise.title})}),r.jsx("div",{children:e.exercise.instructionsCode?r.jsx(a,{epicVideoInfosPromise:e.epicVideoInfosPromise,children:r.jsx("div",{className:"prose dark:prose-invert sm:prose-lg",children:r.jsx(d,{code:e.exercise.instructionsCode,components:j})})}):"No instructions yet..."})]},e.articleId),r.jsx(m,{elementQuery:`#${e.articleId}`},`scroll-${e.articleId}`),r.jsx(x,{type:"instructions",exerciseNumber:e.exerciseNumber,className:"h-14 border-t px-6"}),r.jsxs("div",{className:"flex h-16 justify-between border-b-4 border-t lg:border-b-0",children:[r.jsx("div",{}),r.jsx(p,{file:e.exerciseReadme.file,relativePath:e.exerciseReadme.relativePath}),r.jsx(h,{to:s,prefetch:"intent",className:"flex h-full items-center justify-center bg-foreground px-7 text-background",children:"Start Learning"})]})]})}function B(){const e=l();return typeof document<"u"&&console.error(e),c(e)?e.status===404?r.jsx("p",{children:"Sorry, we couldn't find that step."}):r.jsxs("p",{children:[e.status," ",e.data]}):r.jsx("p",{children:u(e)})}export{B as ErrorBoundary,q as default,V as meta};
|
|
2
|
+
//# sourceMappingURL=_exerciseNumber-Ccwr4LZw.js.map
|
package/build/client/assets/{_exerciseNumber-DN5AsSNn.js.map → _exerciseNumber-Ccwr4LZw.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_exerciseNumber-
|
|
1
|
+
{"version":3,"file":"_exerciseNumber-Ccwr4LZw.js","sources":["../../../app/routes/_app+/_exercises+/$exerciseNumber.tsx"],"sourcesContent":["import path from 'path'\nimport { invariantResponse } from '@epic-web/invariant'\nimport { ElementScrollRestoration } from '@epic-web/restore-scroll'\nimport {\n\tgetExercises,\n\tgetWorkshopRoot,\n\tgetWorkshopTitle,\n} from '@epic-web/workshop-utils/apps.server'\nimport {\n\tcombineServerTimings,\n\tgetServerTimeHeader,\n\tmakeTimings,\n\ttime,\n} from '@epic-web/workshop-utils/timing.server'\nimport {\n\tdefer,\n\ttype HeadersFunction,\n\ttype LoaderFunctionArgs,\n\ttype MetaFunction,\n} from '@remix-run/node'\nimport {\n\tLink,\n\tisRouteErrorResponse,\n\tuseLoaderData,\n\tuseRouteError,\n} from '@remix-run/react'\nimport slugify from '@sindresorhus/slugify'\nimport { EpicVideoInfoProvider } from '#app/components/epic-video.tsx'\nimport { type loader as rootLoader } from '#app/root.tsx'\nimport { EditFileOnGitHub } from '#app/routes/launch-editor.tsx'\nimport { ProgressToggle } from '#app/routes/progress.tsx'\nimport { getEpicVideoInfos } from '#app/utils/epic-api.ts'\nimport { Mdx } from '#app/utils/mdx.tsx'\nimport { getErrorMessage } from '#app/utils/misc.tsx'\nimport { getSeoMetaTags } from '#app/utils/seo.js'\n\nexport const meta: MetaFunction<typeof loader, { root: typeof rootLoader }> = ({\n\tdata,\n\tmatches,\n}) => {\n\tconst number = data?.exercise.exerciseNumber.toString().padStart(2, '0')\n\n\tconst rootData = matches.find((m) => m.id === 'root')?.data\n\tif (!data || !rootData) return [{ title: '🦉 | Error' }]\n\n\treturn getSeoMetaTags({\n\t\ttitle: `📝 | ${number}. ${data.exercise.title} | ${rootData?.workshopTitle}`,\n\t\tdescription: `Introduction for ${number}. ${data.exercise.title}`,\n\t\togTitle: data.exercise.title,\n\t\togDescription: `Introduction for exercise ${Number(number)}`,\n\t\tinstructor: rootData.instructor,\n\t\trequestInfo: rootData.requestInfo,\n\t})\n}\n\nexport async function loader({ request, params }: LoaderFunctionArgs) {\n\tconst timings = makeTimings('exerciseNumberLoader')\n\tinvariantResponse(params.exerciseNumber, 'exerciseNumber is required')\n\tconst [exercises, workshopTitle] = await Promise.all([\n\t\ttime(() => getExercises({ request, timings }), {\n\t\t\ttimings,\n\t\t\ttype: 'getExercises',\n\t\t\tdesc: 'getExercises in $exerciseNumber.tsx',\n\t\t}),\n\t\ttime(() => getWorkshopTitle(), {\n\t\t\ttimings,\n\t\t\ttype: 'getWorkshopTitle',\n\t\t\tdesc: 'getWorkshopTitle in $exerciseNumber.tsx',\n\t\t}),\n\t])\n\tconst exercise = exercises.find(\n\t\t(e) => e.exerciseNumber === Number(params.exerciseNumber),\n\t)\n\tif (!exercise) {\n\t\tthrow new Response('Not found', { status: 404 })\n\t}\n\n\tconst readmeFilepath = path.join(\n\t\tgetWorkshopRoot(),\n\t\t'exercises',\n\t\texercise.dirName,\n\t\t'README.mdx',\n\t)\n\n\tconst firstStep = exercise.steps.find(Boolean)\n\n\tconst articleId = `workshop-${slugify(workshopTitle)}-${\n\t\texercise.exerciseNumber\n\t}-instructions`\n\n\treturn defer(\n\t\t{\n\t\t\tarticleId,\n\t\t\texercise,\n\t\t\texerciseNumber: exercise.exerciseNumber,\n\t\t\texerciseReadme: {\n\t\t\t\tfile: readmeFilepath,\n\t\t\t\trelativePath: `exercises/${exercise.dirName}`,\n\t\t\t},\n\t\t\texerciseTitle: exercise.title,\n\t\t\tfirstStep,\n\t\t\tfirstType: firstStep?.problem ? 'problem' : 'solution',\n\t\t\ttitle: workshopTitle,\n\t\t\tepicVideoInfosPromise: getEpicVideoInfos(\n\t\t\t\texercise.instructionsEpicVideoEmbeds,\n\t\t\t\t{ request },\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\theaders: {\n\t\t\t\t'Server-Timing': getServerTimeHeader(timings),\n\t\t\t},\n\t\t},\n\t)\n}\n\nexport const headers: HeadersFunction = ({ loaderHeaders, parentHeaders }) => {\n\tconst headers = {\n\t\t'Cache-Control': loaderHeaders.get('Cache-Control') ?? '',\n\t\t'Server-Timing': combineServerTimings(loaderHeaders, parentHeaders),\n\t}\n\treturn headers\n}\n\nconst mdxComponents = { h1: () => null }\nexport default function ExerciseNumberRoute() {\n\tconst data = useLoaderData<typeof loader>()\n\n\tconst firstStepNumber = String(data.firstStep?.stepNumber ?? '01')\n\tconst firstStepPath = `${firstStepNumber.padStart(2, '0')}/${data.firstType}`\n\treturn (\n\t\t<main className=\"relative flex h-full w-full max-w-5xl flex-col justify-between border-r md:w-3/4 xl:w-2/3\">\n\t\t\t<article\n\t\t\t\tid={data.articleId}\n\t\t\t\tkey={data.articleId}\n\t\t\t\tclassName=\"shadow-on-scrollbox flex w-full flex-1 flex-col gap-12 overflow-y-scroll px-3 py-4 pt-6 scrollbar-thin scrollbar-thumb-scrollbar md:px-10 md:py-12 md:pt-16\"\n\t\t\t>\n\t\t\t\t<div>\n\t\t\t\t\t<h1 className=\"text-[clamp(3rem,6vw,7.5rem)] font-extrabold leading-none\">\n\t\t\t\t\t\t{data.exercise.title}\n\t\t\t\t\t</h1>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t{data.exercise.instructionsCode ? (\n\t\t\t\t\t\t<EpicVideoInfoProvider\n\t\t\t\t\t\t\tepicVideoInfosPromise={data.epicVideoInfosPromise}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"prose dark:prose-invert sm:prose-lg\">\n\t\t\t\t\t\t\t\t<Mdx\n\t\t\t\t\t\t\t\t\tcode={data.exercise.instructionsCode}\n\t\t\t\t\t\t\t\t\tcomponents={mdxComponents}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</EpicVideoInfoProvider>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t'No instructions yet...'\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</article>\n\t\t\t<ElementScrollRestoration\n\t\t\t\telementQuery={`#${data.articleId}`}\n\t\t\t\tkey={`scroll-${data.articleId}`}\n\t\t\t/>\n\t\t\t<ProgressToggle\n\t\t\t\ttype=\"instructions\"\n\t\t\t\texerciseNumber={data.exerciseNumber}\n\t\t\t\tclassName=\"h-14 border-t px-6\"\n\t\t\t/>\n\t\t\t<div className=\"flex h-16 justify-between border-b-4 border-t lg:border-b-0\">\n\t\t\t\t<div />\n\t\t\t\t<EditFileOnGitHub\n\t\t\t\t\tfile={data.exerciseReadme.file}\n\t\t\t\t\trelativePath={data.exerciseReadme.relativePath}\n\t\t\t\t/>\n\t\t\t\t<Link\n\t\t\t\t\tto={firstStepPath}\n\t\t\t\t\tprefetch=\"intent\"\n\t\t\t\t\tclassName=\"flex h-full items-center justify-center bg-foreground px-7 text-background\"\n\t\t\t\t>\n\t\t\t\t\tStart Learning\n\t\t\t\t</Link>\n\t\t\t</div>\n\t\t</main>\n\t)\n}\n\nexport function ErrorBoundary() {\n\tconst error = useRouteError()\n\n\tif (typeof document !== 'undefined') {\n\t\tconsole.error(error)\n\t}\n\n\treturn isRouteErrorResponse(error) ? (\n\t\terror.status === 404 ? (\n\t\t\t<p>Sorry, we couldn't find that step.</p>\n\t\t) : (\n\t\t\t<p>\n\t\t\t\t{error.status} {error.data}\n\t\t\t</p>\n\t\t)\n\t) : (\n\t\t<p>{getErrorMessage(error)}</p>\n\t)\n}\n"],"names":["meta","data","matches","number","exercise","exerciseNumber","toString","padStart","rootData","find","m","id","title","getSeoMetaTags","workshopTitle","description","ogTitle","ogDescription","Number","instructor","requestInfo","mdxComponents","h1","ExerciseNumberRoute","useLoaderData","firstStepPath","String","firstStep","stepNumber","firstType","jsxs","className","children","articleId","jsx","instructionsCode","EpicVideoInfoProvider","epicVideoInfosPromise","Mdx","code","components","ElementScrollRestoration","elementQuery","ProgressToggle","type","EditFileOnGitHub","file","exerciseReadme","relativePath","Link","to","prefetch","ErrorBoundary","error","useRouteError","document","console","isRouteErrorResponse","status","getErrorMessage"],"mappings":"2lBAoCO,MAAMA,EAAiEA,CAAC,CAC9EC,KAAAA,EACAC,QAAAA,CACD,IAAM,OACC,MAAAC,EAASF,GAAAA,YAAAA,EAAMG,SAASC,eAAeC,WAAWC,SAAS,EAAG,KAE9DC,GAAWN,EAAAA,EAAQO,KAAMC,GAAMA,EAAEC,KAAO,MAAM,IAAnCT,YAAAA,EAAsCD,KACnD,MAAA,CAACA,GAAQ,CAACO,EAAiB,CAAC,CAAEI,MAAO,YAAa,CAAC,EAEhDC,EAAe,CACrBD,MAAO,QAAQT,CAAM,KAAKF,EAAKG,SAASQ,KAAK,MAAMJ,GAAAA,YAAAA,EAAUM,aAAa,GAC1EC,YAAa,oBAAoBZ,CAAM,KAAKF,EAAKG,SAASQ,KAAK,GAC/DI,QAASf,EAAKG,SAASQ,MACvBK,cAAe,6BAA6BC,OAAOf,CAAM,CAAC,GAC1DgB,WAAYX,EAASW,WACrBC,YAAaZ,EAASY,WACvB,CAAC,CACF,EAuEMC,EAAgB,CAAEC,GAAIA,IAAM,IAAK,EACvC,SAAwBC,GAAsB,OAC7C,MAAMtB,EAAOuB,IAGPC,EAAgB,GADEC,SAAOzB,EAAAA,EAAK0B,YAAL1B,YAAAA,EAAgB2B,aAAc,IAAI,EACxBrB,SAAS,EAAG,GAAG,CAAC,IAAIN,EAAK4B,SAAS,GAE1E,OAAAC,EAAAA,KAAC,OAAK,CAAAC,UAAU,4FACfC,SAAA,CAAAF,EAAA,KAAC,UAAA,CACAnB,GAAIV,EAAKgC,UAETF,UAAU,8JAEVC,SAAA,CAACE,EAAA,IAAA,MAAA,CACAF,eAAC,KAAG,CAAAD,UAAU,4DACZC,SAAK/B,EAAAG,SAASQ,MAChB,CACD,CAAA,EACCsB,EAAA,IAAA,MAAA,CACCF,SAAK/B,EAAAG,SAAS+B,iBACdD,EAAAA,IAACE,EAAA,CACAC,sBAAuBpC,EAAKoC,sBAE5BL,SAAAE,EAAA,IAAC,MAAI,CAAAH,UAAU,sCACdC,SAAAE,EAAA,IAACI,EAAA,CACAC,KAAMtC,EAAKG,SAAS+B,iBACpBK,WAAYnB,EACb,EACD,CACD,CAAA,EAEA,wBAEF,CAAA,CAAA,CAAA,EAvBKpB,EAAKgC,SAwBX,EACAC,EAAAA,IAACO,EAAA,CACAC,aAAc,IAAIzC,EAAKgC,SAAS,EAAA,EAC3B,UAAUhC,EAAKgC,SAAS,EAC9B,EACAC,EAAA,IAACS,EAAA,CACAC,KAAK,eACLvC,eAAgBJ,EAAKI,eACrB0B,UAAU,oBAAA,CACX,EACAD,EAAA,KAAC,MAAI,CAAAC,UAAU,8DACdC,SAAA,CAAAE,EAAAA,IAAC,MAAI,CAAA,CAAA,EACLA,EAAA,IAACW,EAAA,CACAC,KAAM7C,EAAK8C,eAAeD,KAC1BE,aAAc/C,EAAK8C,eAAeC,YAAA,CACnC,EACAd,EAAA,IAACe,EAAA,CACAC,GAAIzB,EACJ0B,SAAS,SACTpB,UAAU,6EACVC,SAAA,gBAAA,CAED,CAAA,CACD,CAAA,CAAA,CACD,CAAA,CAEF,CAEO,SAASoB,GAAgB,CAC/B,MAAMC,EAAQC,IAEV,OAAA,OAAOC,SAAa,KACvBC,QAAQH,MAAMA,CAAK,EAGbI,EAAqBJ,CAAK,EAChCA,EAAMK,SAAW,IAChBxB,EAAA,IAAC,IAAE,CAAAF,SAAA,oCAAA,CAAkC,EAErCF,EAAA,KAAC,IACC,CAAAE,SAAA,CAAMqB,EAAAK,OAAO,IAAEL,EAAMpD,IAAA,CAAA,CACvB,EAGDiC,EAAA,IAAC,IAAG,CAAAF,SAAA2B,EAAgBN,CAAK,CAAE,CAAA,CAE7B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as r,r as n}from"./index-Czg1ruVn.js";import{E as c}from"./index-D6ukHE4T.js";import{E as a}from"./epic-video
|
|
2
|
-
//# sourceMappingURL=_exerciseNumber_.finished-
|
|
1
|
+
import{j as r,r as n}from"./index-Czg1ruVn.js";import{E as c}from"./index-D6ukHE4T.js";import{E as a}from"./epic-video-DJN9_SUj.js";import{L as m}from"./loading-B0uKxERz.js";import{N as x}from"./nav-chevrons-DaXg0NPS.js";import{M as d,E as f}from"./mdx-BENF-kTQ.js";import{P as p}from"./progress-BwanvUpB.js";import{c as u}from"./misc-S5ZD98sI.js";import{g as h}from"./seo-pBpFCWsy.js";import{u as b,L as j}from"./components-wgHiPsTg.js";import"./index-yEAxvbDV.js";import"./request-info-DHtGM4FI.js";import"./tooltip-BtzSIxlB.js";import"./client-hints-DLYDs4RF.js";import"./user-CdUDQ7a8.js";import"./clsx-B-dksMZM.js";import"./progress-bar-wMXWRGq0.js";const U=({data:e,matches:i})=>{var o;const t=e==null?void 0:e.exercise.exerciseNumber.toString().padStart(2,"0"),s=(o=i.find(l=>l.id==="root"))==null?void 0:o.data;return!e||!s?[{title:"🦉 | Error"}]:h({title:`🦉 | ${t}. ${e.exercise.title} | ${s==null?void 0:s.workshopTitle}`,description:`Elaboration for ${t}. ${e.exercise.title}`,ogTitle:`Finished: ${e.exercise.title}`,ogDescription:`Elaboration for exercise ${Number(t)}`,instructor:s.instructor,requestInfo:s.requestInfo})},g={h1:()=>null};function z(){const e=b(),i=e.exercise.exerciseNumber.toString().padStart(2,"0");return r.jsx("div",{className:"flex max-w-full flex-grow flex-col",children:r.jsxs("main",{className:"flex flex-grow flex-col sm:grid sm:h-full sm:min-h-[800px] sm:grid-cols-1 sm:grid-rows-2 md:min-h-[unset] lg:grid-cols-2 lg:grid-rows-1",children:[r.jsxs("div",{className:"relative flex flex-col sm:col-span-1 sm:row-span-1 sm:h-full lg:border-r",children:[r.jsx("h1",{className:"h-14 border-b pl-10 pr-5 text-sm font-medium leading-tight",children:r.jsx("div",{className:"flex h-14 flex-wrap items-center justify-between gap-x-2 py-2",children:r.jsxs("div",{className:"flex items-center justify-start gap-x-2",children:[r.jsx(j,{to:`/${i}`,className:"hover:underline",children:`${i}. ${e.exercise.title}`}),r.jsx("span",{children:"/"}),r.jsx("span",{children:"Elaboration"})]})})}),r.jsx("article",{className:"shadow-on-scrollbox h-full w-full max-w-none flex-1 scroll-pt-6 space-y-6 overflow-y-auto p-2 scrollbar-thin scrollbar-thumb-scrollbar sm:p-10 sm:pt-8",id:e.articleId,children:e.exercise.finishedCode?r.jsx(a,{epicVideoInfosPromise:e.epicVideoInfosPromise,children:r.jsx("div",{className:"prose dark:prose-invert sm:prose-lg",children:r.jsx(d,{code:e.exercise.finishedCode,components:g})})}):"No finished instructions yet..."}),r.jsx(c,{elementQuery:`#${e.articleId}`}),r.jsx(p,{type:"finished",exerciseNumber:e.exercise.exerciseNumber,className:"h-14 border-t px-6"}),r.jsxs("div",{className:"flex h-16 justify-between border-b-4 border-t lg:border-b-0",children:[r.jsx("div",{}),e.exerciseFinished?r.jsx(f,{file:e.exerciseFinished.file,relativePath:e.exerciseFinished.relativePath}):null,r.jsx(x,{prev:e.prevStepLink,next:e.nextStepLink})]})]}),r.jsx(N,{exerciseFormEmbedUrl:e.exerciseFormEmbedUrl,exerciseTitle:e.exercise.title})]})})}function N({exerciseFormEmbedUrl:e,exerciseTitle:i}){const[t,s]=n.useState(!1);return r.jsxs("div",{className:"relative min-h-full sm:min-h-[unset] sm:flex-shrink-0",children:[t?null:r.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:r.jsx(m,{children:r.jsxs("span",{children:["Loading ",i," Elaboration form"]})})}),r.jsx("iframe",{onLoad:()=>s(!0),onError:()=>s(!0),title:"Elaboration",src:e,className:u("absolute inset-0 flex h-full w-full transition-opacity duration-300",t?"opacity-100":"opacity-0")})]})}export{z as default,U as meta};
|
|
2
|
+
//# sourceMappingURL=_exerciseNumber_.finished-gEWcHsfL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_exerciseNumber_.finished-W3hcmvgu.js","sources":["../../../app/routes/_app+/_exercises+/$exerciseNumber_.finished.tsx"],"sourcesContent":["import path from 'path'\nimport { invariantResponse } from '@epic-web/invariant'\nimport { ElementScrollRestoration } from '@epic-web/restore-scroll'\nimport {\n\tgetAppPageRoute,\n\tgetApps,\n\tgetExercise,\n\tgetWorkshopRoot,\n\tgetWorkshopTitle,\n\tisExerciseStepApp,\n} from '@epic-web/workshop-utils/apps.server'\nimport {\n\tcombineServerTimings,\n\tgetServerTimeHeader,\n\tmakeTimings,\n} from '@epic-web/workshop-utils/timing.server'\nimport { getPkgProp } from '@epic-web/workshop-utils/utils.server'\nimport {\n\tdefer,\n\ttype HeadersFunction,\n\ttype LoaderFunctionArgs,\n\ttype MetaFunction,\n} from '@remix-run/node'\nimport { Link, useLoaderData } from '@remix-run/react'\nimport slugify from '@sindresorhus/slugify'\nimport * as React from 'react'\nimport { EpicVideoInfoProvider } from '#app/components/epic-video.tsx'\nimport { Loading } from '#app/components/loading.tsx'\nimport { NavChevrons } from '#app/components/nav-chevrons.tsx'\nimport { type loader as rootLoader } from '#app/root.tsx'\nimport { EditFileOnGitHub } from '#app/routes/launch-editor.tsx'\nimport { ProgressToggle } from '#app/routes/progress.tsx'\nimport { getEpicVideoInfos } from '#app/utils/epic-api.ts'\nimport { Mdx } from '#app/utils/mdx.tsx'\nimport { cn } from '#app/utils/misc.tsx'\nimport { getSeoMetaTags } from '#app/utils/seo.js'\n\nexport const meta: MetaFunction<typeof loader, { root: typeof rootLoader }> = ({\n\tdata,\n\tmatches,\n}) => {\n\tconst number = data?.exercise.exerciseNumber.toString().padStart(2, '0')\n\n\tconst rootData = matches.find((m) => m.id === 'root')?.data\n\tif (!data || !rootData) return [{ title: '🦉 | Error' }]\n\n\treturn getSeoMetaTags({\n\t\ttitle: `🦉 | ${number}. ${data.exercise.title} | ${rootData?.workshopTitle}`,\n\t\tdescription: `Elaboration for ${number}. ${data.exercise.title}`,\n\t\togTitle: `Finished: ${data.exercise.title}`,\n\t\togDescription: `Elaboration for exercise ${Number(number)}`,\n\t\tinstructor: rootData.instructor,\n\t\trequestInfo: rootData.requestInfo,\n\t})\n}\n\nexport async function loader({ request, params }: LoaderFunctionArgs) {\n\tconst timings = makeTimings('exerciseFinishedLoader')\n\tinvariantResponse(params.exerciseNumber, 'exerciseNumber is required')\n\tconst exercise = await getExercise(params.exerciseNumber, {\n\t\ttimings,\n\t\trequest,\n\t})\n\tif (!exercise) {\n\t\tthrow new Response('Not found', { status: 404 })\n\t}\n\tconst workshopTitle = await getWorkshopTitle()\n\tconst workshopRoot = getWorkshopRoot()\n\tconst exerciseFormTemplate = await getPkgProp(\n\t\tworkshopRoot,\n\t\t'epicshop.forms.exercise',\n\t\t`https://docs.google.com/forms/d/e/1FAIpQLSf3o9xyjQepTlOTH5Z7ZwkeSTdXh6YWI_RGc9KiyD3oUN0p6w/viewform?hl=en&embedded=true&entry.1836176234={workshopTitle}&entry.428900931={exerciseTitle}`,\n\t)\n\tconst exerciseFormEmbedUrl = exerciseFormTemplate\n\t\t.replace('{workshopTitle}', encodeURIComponent(workshopTitle))\n\t\t.replace('{exerciseTitle}', encodeURIComponent(exercise.title))\n\tconst nextExercise = await getExercise(exercise.exerciseNumber + 1, {\n\t\ttimings,\n\t\trequest,\n\t})\n\n\tconst finishedFilepath = path.join(\n\t\tgetWorkshopRoot(),\n\t\t'exercises',\n\t\texercise.dirName,\n\t\t'FINISHED.mdx',\n\t)\n\n\tconst apps = await getApps({ request, timings })\n\tconst exerciseApps = apps\n\t\t.filter(isExerciseStepApp)\n\t\t.filter((app) => app.exerciseNumber === exercise.exerciseNumber)\n\tconst prevApp = exerciseApps[exerciseApps.length - 1]\n\n\tconst articleId = `workshop-${slugify(workshopTitle)}-${\n\t\texercise.exerciseNumber\n\t}-finished`\n\n\treturn defer(\n\t\t{\n\t\t\tarticleId,\n\t\t\tworkshopTitle,\n\t\t\texercise,\n\t\t\texerciseFormEmbedUrl,\n\t\t\tepicVideoInfosPromise: getEpicVideoInfos(\n\t\t\t\texercise.finishedEpicVideoEmbeds,\n\t\t\t\t{ request },\n\t\t\t),\n\t\t\texerciseFinished: exercise.finishedCode\n\t\t\t\t? {\n\t\t\t\t\t\tfile: finishedFilepath,\n\t\t\t\t\t\trelativePath: `exercises/${exercise.dirName}/FINISHED.mdx`,\n\t\t\t\t\t}\n\t\t\t\t: null,\n\t\t\tprevStepLink: prevApp\n\t\t\t\t? {\n\t\t\t\t\t\tto: getAppPageRoute(prevApp),\n\t\t\t\t\t\t'aria-label': `${prevApp.title} (${prevApp.type})`,\n\t\t\t\t\t}\n\t\t\t\t: null,\n\t\t\tnextStepLink: nextExercise\n\t\t\t\t? {\n\t\t\t\t\t\tto: `/${nextExercise.exerciseNumber.toString().padStart(2, '0')}`,\n\t\t\t\t\t\t'aria-label': `${nextExercise.title}`,\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\tto: '/finished',\n\t\t\t\t\t\t'aria-label': 'Finished! 🎉',\n\t\t\t\t\t},\n\t\t},\n\t\t{\n\t\t\theaders: {\n\t\t\t\t'Server-Timing': getServerTimeHeader(timings),\n\t\t\t},\n\t\t},\n\t)\n}\n\nexport const headers: HeadersFunction = ({ loaderHeaders, parentHeaders }) => {\n\tconst headers = {\n\t\t'Cache-Control': loaderHeaders.get('Cache-Control') ?? '',\n\t\t'Server-Timing': combineServerTimings(loaderHeaders, parentHeaders),\n\t}\n\treturn headers\n}\n\nconst mdxComponents = { h1: () => null }\nexport default function ExerciseFinished() {\n\tconst data = useLoaderData<typeof loader>()\n\tconst exerciseNumber = data.exercise.exerciseNumber\n\t\t.toString()\n\t\t.padStart(2, '0')\n\n\treturn (\n\t\t<div className=\"flex max-w-full flex-grow flex-col\">\n\t\t\t<main className=\"flex flex-grow flex-col sm:grid sm:h-full sm:min-h-[800px] sm:grid-cols-1 sm:grid-rows-2 md:min-h-[unset] lg:grid-cols-2 lg:grid-rows-1\">\n\t\t\t\t<div className=\"relative flex flex-col sm:col-span-1 sm:row-span-1 sm:h-full lg:border-r\">\n\t\t\t\t\t<h1 className=\"h-14 border-b pl-10 pr-5 text-sm font-medium leading-tight\">\n\t\t\t\t\t\t<div className=\"flex h-14 flex-wrap items-center justify-between gap-x-2 py-2\">\n\t\t\t\t\t\t\t<div className=\"flex items-center justify-start gap-x-2\">\n\t\t\t\t\t\t\t\t<Link to={`/${exerciseNumber}`} className=\"hover:underline\">\n\t\t\t\t\t\t\t\t\t{`${exerciseNumber}. ${data.exercise.title}`}\n\t\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t\t\t<span>/</span>\n\t\t\t\t\t\t\t\t<span>Elaboration</span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</h1>\n\n\t\t\t\t\t<article\n\t\t\t\t\t\tclassName=\"shadow-on-scrollbox h-full w-full max-w-none flex-1 scroll-pt-6 space-y-6 overflow-y-auto p-2 scrollbar-thin scrollbar-thumb-scrollbar sm:p-10 sm:pt-8\"\n\t\t\t\t\t\tid={data.articleId}\n\t\t\t\t\t>\n\t\t\t\t\t\t{data.exercise.finishedCode ? (\n\t\t\t\t\t\t\t<EpicVideoInfoProvider\n\t\t\t\t\t\t\t\tepicVideoInfosPromise={data.epicVideoInfosPromise}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<div className=\"prose dark:prose-invert sm:prose-lg\">\n\t\t\t\t\t\t\t\t\t<Mdx\n\t\t\t\t\t\t\t\t\t\tcode={data.exercise.finishedCode}\n\t\t\t\t\t\t\t\t\t\tcomponents={mdxComponents}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</EpicVideoInfoProvider>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t// TODO: render a random dad joke...\n\t\t\t\t\t\t\t'No finished instructions yet...'\n\t\t\t\t\t\t)}\n\t\t\t\t\t</article>\n\t\t\t\t\t<ElementScrollRestoration elementQuery={`#${data.articleId}`} />\n\t\t\t\t\t<ProgressToggle\n\t\t\t\t\t\ttype=\"finished\"\n\t\t\t\t\t\texerciseNumber={data.exercise.exerciseNumber}\n\t\t\t\t\t\tclassName=\"h-14 border-t px-6\"\n\t\t\t\t\t/>\n\t\t\t\t\t<div className=\"flex h-16 justify-between border-b-4 border-t lg:border-b-0\">\n\t\t\t\t\t\t<div />\n\t\t\t\t\t\t{data.exerciseFinished ? (\n\t\t\t\t\t\t\t<EditFileOnGitHub\n\t\t\t\t\t\t\t\tfile={data.exerciseFinished.file}\n\t\t\t\t\t\t\t\trelativePath={data.exerciseFinished.relativePath}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t<NavChevrons prev={data.prevStepLink} next={data.nextStepLink} />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<Survey\n\t\t\t\t\texerciseFormEmbedUrl={data.exerciseFormEmbedUrl}\n\t\t\t\t\texerciseTitle={data.exercise.title}\n\t\t\t\t/>\n\t\t\t</main>\n\t\t</div>\n\t)\n}\n\nfunction Survey({\n\texerciseFormEmbedUrl,\n\texerciseTitle,\n}: {\n\texerciseFormEmbedUrl: string\n\texerciseTitle: string\n}) {\n\tconst [iframeLoaded, setIframeLoaded] = React.useState(false)\n\treturn (\n\t\t<div className=\"relative min-h-full sm:min-h-[unset] sm:flex-shrink-0\">\n\t\t\t{!iframeLoaded ? (\n\t\t\t\t<div className=\"absolute inset-0 z-10 flex items-center justify-center\">\n\t\t\t\t\t<Loading>\n\t\t\t\t\t\t<span>Loading {exerciseTitle} Elaboration form</span>\n\t\t\t\t\t</Loading>\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t<iframe\n\t\t\t\tonLoad={() => setIframeLoaded(true)}\n\t\t\t\t// show what would have shown if there is an error\n\t\t\t\tonError={() => setIframeLoaded(true)}\n\t\t\t\ttitle=\"Elaboration\"\n\t\t\t\tsrc={exerciseFormEmbedUrl}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'absolute inset-0 flex h-full w-full transition-opacity duration-300',\n\t\t\t\t\tiframeLoaded ? 'opacity-100' : 'opacity-0',\n\t\t\t\t)}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n"],"names":["meta","data","matches","number","exercise","exerciseNumber","toString","padStart","rootData","find","m","id","title","getSeoMetaTags","workshopTitle","description","ogTitle","ogDescription","Number","instructor","requestInfo","mdxComponents","h1","ExerciseFinished","useLoaderData","className","children","jsxs","jsx","Link","to","articleId","finishedCode","EpicVideoInfoProvider","epicVideoInfosPromise","Mdx","code","components","ElementScrollRestoration","elementQuery","ProgressToggle","type","exerciseFinished","EditFileOnGitHub","file","relativePath","NavChevrons","prev","prevStepLink","next","nextStepLink","Survey","exerciseFormEmbedUrl","exerciseTitle","iframeLoaded","setIframeLoaded","React","Loading","onLoad","onError","src","cn"],"mappings":"+oBAqCO,MAAMA,EAAiEA,CAAC,CAC9EC,KAAAA,EACAC,QAAAA,CACD,IAAM,OACC,MAAAC,EAASF,GAAAA,YAAAA,EAAMG,SAASC,eAAeC,WAAWC,SAAS,EAAG,KAE9DC,GAAWN,EAAAA,EAAQO,KAAMC,GAAMA,EAAEC,KAAO,MAAM,IAAnCT,YAAAA,EAAsCD,KACnD,MAAA,CAACA,GAAQ,CAACO,EAAiB,CAAC,CAAEI,MAAO,YAAa,CAAC,EAEhDC,EAAe,CACrBD,MAAO,QAAQT,CAAM,KAAKF,EAAKG,SAASQ,KAAK,MAAMJ,GAAAA,YAAAA,EAAUM,aAAa,GAC1EC,YAAa,mBAAmBZ,CAAM,KAAKF,EAAKG,SAASQ,KAAK,GAC9DI,QAAS,aAAaf,EAAKG,SAASQ,KAAK,GACzCK,cAAe,4BAA4BC,OAAOf,CAAM,CAAC,GACzDgB,WAAYX,EAASW,WACrBC,YAAaZ,EAASY,WACvB,CAAC,CACF,EA4FMC,EAAgB,CAAEC,GAAIA,IAAM,IAAK,EACvC,SAAwBC,GAAmB,CAC1C,MAAMtB,EAAOuB,IACPnB,EAAiBJ,EAAKG,SAASC,eACnCC,WACAC,SAAS,EAAG,GAAG,EAEjB,aACE,MAAI,CAAAkB,UAAU,qCACdC,SAACC,EAAA,KAAA,OAAA,CAAKF,UAAU,0IACfC,SAAA,CAACC,EAAA,KAAA,MAAA,CAAIF,UAAU,2EACdC,SAAA,CAACE,EAAA,IAAA,KAAA,CAAGH,UAAU,6DACbC,SAACE,EAAA,IAAA,MAAA,CAAIH,UAAU,gEACdC,SAAAC,EAAA,KAAC,MAAI,CAAAF,UAAU,0CACdC,SAAA,CAAAE,EAAA,IAACC,EAAK,CAAAC,GAAI,IAAIzB,CAAc,GAAIoB,UAAU,kBACxCC,SAAA,GAAGrB,CAAc,KAAKJ,EAAKG,SAASQ,KAAK,EAC3C,CAAA,EACAgB,EAAA,IAAC,QAAKF,SAAC,GAAA,CAAA,EACPE,EAAA,IAAC,QAAKF,SAAW,aAAA,CAAA,CAAA,EAClB,EACD,CACD,CAAA,EAEAE,EAAA,IAAC,UAAA,CACAH,UAAU,yJACVd,GAAIV,EAAK8B,UAERL,SAAAzB,EAAKG,SAAS4B,aACdJ,EAAAA,IAACK,EAAA,CACAC,sBAAuBjC,EAAKiC,sBAE5BR,SAAAE,EAAA,IAAC,MAAI,CAAAH,UAAU,sCACdC,SAAAE,EAAA,IAACO,EAAA,CACAC,KAAMnC,EAAKG,SAAS4B,aACpBK,WAAYhB,EACb,EACD,CAAA,CACD,EAGA,iCAAA,CAEF,QACCiB,EAAyB,CAAAC,aAAc,IAAItC,EAAK8B,SAAS,EAAI,CAAA,EAC9DH,EAAA,IAACY,EAAA,CACAC,KAAK,WACLpC,eAAgBJ,EAAKG,SAASC,eAC9BoB,UAAU,oBAAA,CACX,EACAE,EAAA,KAAC,MAAI,CAAAF,UAAU,8DACdC,SAAA,CAAAE,EAAA,IAAC,MAAI,CAAA,CAAA,EACJ3B,EAAKyC,iBACLd,EAAA,IAACe,EAAA,CACAC,KAAM3C,EAAKyC,iBAAiBE,KAC5BC,aAAc5C,EAAKyC,iBAAiBG,aACrC,EACG,WACHC,EAAY,CAAAC,KAAM9C,EAAK+C,aAAcC,KAAMhD,EAAKiD,YAAc,CAAA,CAAA,CAChE,CAAA,CAAA,CACD,CAAA,EACAtB,EAAA,IAACuB,EAAA,CACAC,qBAAsBnD,EAAKmD,qBAC3BC,cAAepD,EAAKG,SAASQ,KAAA,CAC9B,CAAA,EACD,CACD,CAAA,CAEF,CAEA,SAASuC,EAAO,CACfC,qBAAAA,EACAC,cAAAA,CACD,EAGG,CACF,KAAM,CAACC,EAAcC,CAAe,EAAIC,WAAe,EAAK,EAE3D,OAAA7B,EAAAA,KAAC,MAAI,CAAAF,UAAU,wDACbC,SAAA,CAAC4B,EAME,WALF,MAAI,CAAA7B,UAAU,yDACdC,SAACE,EAAA,IAAA6B,EAAA,CACA/B,gBAAC,OAAK,CAAAA,SAAA,CAAA,WAAS2B,EAAc,mBAAA,EAAiB,EAC/C,EACD,EAEDzB,EAAA,IAAC,SAAA,CACA8B,OAAQA,IAAMH,EAAgB,EAAI,EAElCI,QAASA,IAAMJ,EAAgB,EAAI,EACnC3C,MAAM,cACNgD,IAAKR,EACL3B,UAAWoC,EACV,sEACAP,EAAe,cAAgB,WAChC,CAAA,CACD,CAAA,CACD,CAAA,CAEF"}
|
|
1
|
+
{"version":3,"file":"_exerciseNumber_.finished-gEWcHsfL.js","sources":["../../../app/routes/_app+/_exercises+/$exerciseNumber_.finished.tsx"],"sourcesContent":["import path from 'path'\nimport { invariantResponse } from '@epic-web/invariant'\nimport { ElementScrollRestoration } from '@epic-web/restore-scroll'\nimport {\n\tgetAppPageRoute,\n\tgetApps,\n\tgetExercise,\n\tgetWorkshopRoot,\n\tgetWorkshopTitle,\n\tisExerciseStepApp,\n} from '@epic-web/workshop-utils/apps.server'\nimport {\n\tcombineServerTimings,\n\tgetServerTimeHeader,\n\tmakeTimings,\n} from '@epic-web/workshop-utils/timing.server'\nimport { getPkgProp } from '@epic-web/workshop-utils/utils.server'\nimport {\n\tdefer,\n\ttype HeadersFunction,\n\ttype LoaderFunctionArgs,\n\ttype MetaFunction,\n} from '@remix-run/node'\nimport { Link, useLoaderData } from '@remix-run/react'\nimport slugify from '@sindresorhus/slugify'\nimport * as React from 'react'\nimport { EpicVideoInfoProvider } from '#app/components/epic-video.tsx'\nimport { Loading } from '#app/components/loading.tsx'\nimport { NavChevrons } from '#app/components/nav-chevrons.tsx'\nimport { type loader as rootLoader } from '#app/root.tsx'\nimport { EditFileOnGitHub } from '#app/routes/launch-editor.tsx'\nimport { ProgressToggle } from '#app/routes/progress.tsx'\nimport { getEpicVideoInfos } from '#app/utils/epic-api.ts'\nimport { Mdx } from '#app/utils/mdx.tsx'\nimport { cn } from '#app/utils/misc.tsx'\nimport { getSeoMetaTags } from '#app/utils/seo.js'\n\nexport const meta: MetaFunction<typeof loader, { root: typeof rootLoader }> = ({\n\tdata,\n\tmatches,\n}) => {\n\tconst number = data?.exercise.exerciseNumber.toString().padStart(2, '0')\n\n\tconst rootData = matches.find((m) => m.id === 'root')?.data\n\tif (!data || !rootData) return [{ title: '🦉 | Error' }]\n\n\treturn getSeoMetaTags({\n\t\ttitle: `🦉 | ${number}. ${data.exercise.title} | ${rootData?.workshopTitle}`,\n\t\tdescription: `Elaboration for ${number}. ${data.exercise.title}`,\n\t\togTitle: `Finished: ${data.exercise.title}`,\n\t\togDescription: `Elaboration for exercise ${Number(number)}`,\n\t\tinstructor: rootData.instructor,\n\t\trequestInfo: rootData.requestInfo,\n\t})\n}\n\nexport async function loader({ request, params }: LoaderFunctionArgs) {\n\tconst timings = makeTimings('exerciseFinishedLoader')\n\tinvariantResponse(params.exerciseNumber, 'exerciseNumber is required')\n\tconst exercise = await getExercise(params.exerciseNumber, {\n\t\ttimings,\n\t\trequest,\n\t})\n\tif (!exercise) {\n\t\tthrow new Response('Not found', { status: 404 })\n\t}\n\tconst workshopTitle = await getWorkshopTitle()\n\tconst workshopRoot = getWorkshopRoot()\n\tconst exerciseFormTemplate = await getPkgProp(\n\t\tworkshopRoot,\n\t\t'epicshop.forms.exercise',\n\t\t`https://docs.google.com/forms/d/e/1FAIpQLSf3o9xyjQepTlOTH5Z7ZwkeSTdXh6YWI_RGc9KiyD3oUN0p6w/viewform?hl=en&embedded=true&entry.1836176234={workshopTitle}&entry.428900931={exerciseTitle}`,\n\t)\n\tconst exerciseFormEmbedUrl = exerciseFormTemplate\n\t\t.replace('{workshopTitle}', encodeURIComponent(workshopTitle))\n\t\t.replace('{exerciseTitle}', encodeURIComponent(exercise.title))\n\tconst nextExercise = await getExercise(exercise.exerciseNumber + 1, {\n\t\ttimings,\n\t\trequest,\n\t})\n\n\tconst finishedFilepath = path.join(\n\t\tgetWorkshopRoot(),\n\t\t'exercises',\n\t\texercise.dirName,\n\t\t'FINISHED.mdx',\n\t)\n\n\tconst apps = await getApps({ request, timings })\n\tconst exerciseApps = apps\n\t\t.filter(isExerciseStepApp)\n\t\t.filter((app) => app.exerciseNumber === exercise.exerciseNumber)\n\tconst prevApp = exerciseApps[exerciseApps.length - 1]\n\n\tconst articleId = `workshop-${slugify(workshopTitle)}-${\n\t\texercise.exerciseNumber\n\t}-finished`\n\n\treturn defer(\n\t\t{\n\t\t\tarticleId,\n\t\t\tworkshopTitle,\n\t\t\texercise,\n\t\t\texerciseFormEmbedUrl,\n\t\t\tepicVideoInfosPromise: getEpicVideoInfos(\n\t\t\t\texercise.finishedEpicVideoEmbeds,\n\t\t\t\t{ request },\n\t\t\t),\n\t\t\texerciseFinished: exercise.finishedCode\n\t\t\t\t? {\n\t\t\t\t\t\tfile: finishedFilepath,\n\t\t\t\t\t\trelativePath: `exercises/${exercise.dirName}/FINISHED.mdx`,\n\t\t\t\t\t}\n\t\t\t\t: null,\n\t\t\tprevStepLink: prevApp\n\t\t\t\t? {\n\t\t\t\t\t\tto: getAppPageRoute(prevApp),\n\t\t\t\t\t\t'aria-label': `${prevApp.title} (${prevApp.type})`,\n\t\t\t\t\t}\n\t\t\t\t: null,\n\t\t\tnextStepLink: nextExercise\n\t\t\t\t? {\n\t\t\t\t\t\tto: `/${nextExercise.exerciseNumber.toString().padStart(2, '0')}`,\n\t\t\t\t\t\t'aria-label': `${nextExercise.title}`,\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\tto: '/finished',\n\t\t\t\t\t\t'aria-label': 'Finished! 🎉',\n\t\t\t\t\t},\n\t\t},\n\t\t{\n\t\t\theaders: {\n\t\t\t\t'Server-Timing': getServerTimeHeader(timings),\n\t\t\t},\n\t\t},\n\t)\n}\n\nexport const headers: HeadersFunction = ({ loaderHeaders, parentHeaders }) => {\n\tconst headers = {\n\t\t'Cache-Control': loaderHeaders.get('Cache-Control') ?? '',\n\t\t'Server-Timing': combineServerTimings(loaderHeaders, parentHeaders),\n\t}\n\treturn headers\n}\n\nconst mdxComponents = { h1: () => null }\nexport default function ExerciseFinished() {\n\tconst data = useLoaderData<typeof loader>()\n\tconst exerciseNumber = data.exercise.exerciseNumber\n\t\t.toString()\n\t\t.padStart(2, '0')\n\n\treturn (\n\t\t<div className=\"flex max-w-full flex-grow flex-col\">\n\t\t\t<main className=\"flex flex-grow flex-col sm:grid sm:h-full sm:min-h-[800px] sm:grid-cols-1 sm:grid-rows-2 md:min-h-[unset] lg:grid-cols-2 lg:grid-rows-1\">\n\t\t\t\t<div className=\"relative flex flex-col sm:col-span-1 sm:row-span-1 sm:h-full lg:border-r\">\n\t\t\t\t\t<h1 className=\"h-14 border-b pl-10 pr-5 text-sm font-medium leading-tight\">\n\t\t\t\t\t\t<div className=\"flex h-14 flex-wrap items-center justify-between gap-x-2 py-2\">\n\t\t\t\t\t\t\t<div className=\"flex items-center justify-start gap-x-2\">\n\t\t\t\t\t\t\t\t<Link to={`/${exerciseNumber}`} className=\"hover:underline\">\n\t\t\t\t\t\t\t\t\t{`${exerciseNumber}. ${data.exercise.title}`}\n\t\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t\t\t<span>/</span>\n\t\t\t\t\t\t\t\t<span>Elaboration</span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</h1>\n\n\t\t\t\t\t<article\n\t\t\t\t\t\tclassName=\"shadow-on-scrollbox h-full w-full max-w-none flex-1 scroll-pt-6 space-y-6 overflow-y-auto p-2 scrollbar-thin scrollbar-thumb-scrollbar sm:p-10 sm:pt-8\"\n\t\t\t\t\t\tid={data.articleId}\n\t\t\t\t\t>\n\t\t\t\t\t\t{data.exercise.finishedCode ? (\n\t\t\t\t\t\t\t<EpicVideoInfoProvider\n\t\t\t\t\t\t\t\tepicVideoInfosPromise={data.epicVideoInfosPromise}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<div className=\"prose dark:prose-invert sm:prose-lg\">\n\t\t\t\t\t\t\t\t\t<Mdx\n\t\t\t\t\t\t\t\t\t\tcode={data.exercise.finishedCode}\n\t\t\t\t\t\t\t\t\t\tcomponents={mdxComponents}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</EpicVideoInfoProvider>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t// TODO: render a random dad joke...\n\t\t\t\t\t\t\t'No finished instructions yet...'\n\t\t\t\t\t\t)}\n\t\t\t\t\t</article>\n\t\t\t\t\t<ElementScrollRestoration elementQuery={`#${data.articleId}`} />\n\t\t\t\t\t<ProgressToggle\n\t\t\t\t\t\ttype=\"finished\"\n\t\t\t\t\t\texerciseNumber={data.exercise.exerciseNumber}\n\t\t\t\t\t\tclassName=\"h-14 border-t px-6\"\n\t\t\t\t\t/>\n\t\t\t\t\t<div className=\"flex h-16 justify-between border-b-4 border-t lg:border-b-0\">\n\t\t\t\t\t\t<div />\n\t\t\t\t\t\t{data.exerciseFinished ? (\n\t\t\t\t\t\t\t<EditFileOnGitHub\n\t\t\t\t\t\t\t\tfile={data.exerciseFinished.file}\n\t\t\t\t\t\t\t\trelativePath={data.exerciseFinished.relativePath}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t<NavChevrons prev={data.prevStepLink} next={data.nextStepLink} />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<Survey\n\t\t\t\t\texerciseFormEmbedUrl={data.exerciseFormEmbedUrl}\n\t\t\t\t\texerciseTitle={data.exercise.title}\n\t\t\t\t/>\n\t\t\t</main>\n\t\t</div>\n\t)\n}\n\nfunction Survey({\n\texerciseFormEmbedUrl,\n\texerciseTitle,\n}: {\n\texerciseFormEmbedUrl: string\n\texerciseTitle: string\n}) {\n\tconst [iframeLoaded, setIframeLoaded] = React.useState(false)\n\treturn (\n\t\t<div className=\"relative min-h-full sm:min-h-[unset] sm:flex-shrink-0\">\n\t\t\t{!iframeLoaded ? (\n\t\t\t\t<div className=\"absolute inset-0 z-10 flex items-center justify-center\">\n\t\t\t\t\t<Loading>\n\t\t\t\t\t\t<span>Loading {exerciseTitle} Elaboration form</span>\n\t\t\t\t\t</Loading>\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t<iframe\n\t\t\t\tonLoad={() => setIframeLoaded(true)}\n\t\t\t\t// show what would have shown if there is an error\n\t\t\t\tonError={() => setIframeLoaded(true)}\n\t\t\t\ttitle=\"Elaboration\"\n\t\t\t\tsrc={exerciseFormEmbedUrl}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'absolute inset-0 flex h-full w-full transition-opacity duration-300',\n\t\t\t\t\tiframeLoaded ? 'opacity-100' : 'opacity-0',\n\t\t\t\t)}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n"],"names":["meta","data","matches","number","exercise","exerciseNumber","toString","padStart","rootData","find","m","id","title","getSeoMetaTags","workshopTitle","description","ogTitle","ogDescription","Number","instructor","requestInfo","mdxComponents","h1","ExerciseFinished","useLoaderData","className","children","jsxs","jsx","Link","to","articleId","finishedCode","EpicVideoInfoProvider","epicVideoInfosPromise","Mdx","code","components","ElementScrollRestoration","elementQuery","ProgressToggle","type","exerciseFinished","EditFileOnGitHub","file","relativePath","NavChevrons","prev","prevStepLink","next","nextStepLink","Survey","exerciseFormEmbedUrl","exerciseTitle","iframeLoaded","setIframeLoaded","React","Loading","onLoad","onError","src","cn"],"mappings":"+oBAqCO,MAAMA,EAAiEA,CAAC,CAC9EC,KAAAA,EACAC,QAAAA,CACD,IAAM,OACC,MAAAC,EAASF,GAAAA,YAAAA,EAAMG,SAASC,eAAeC,WAAWC,SAAS,EAAG,KAE9DC,GAAWN,EAAAA,EAAQO,KAAMC,GAAMA,EAAEC,KAAO,MAAM,IAAnCT,YAAAA,EAAsCD,KACnD,MAAA,CAACA,GAAQ,CAACO,EAAiB,CAAC,CAAEI,MAAO,YAAa,CAAC,EAEhDC,EAAe,CACrBD,MAAO,QAAQT,CAAM,KAAKF,EAAKG,SAASQ,KAAK,MAAMJ,GAAAA,YAAAA,EAAUM,aAAa,GAC1EC,YAAa,mBAAmBZ,CAAM,KAAKF,EAAKG,SAASQ,KAAK,GAC9DI,QAAS,aAAaf,EAAKG,SAASQ,KAAK,GACzCK,cAAe,4BAA4BC,OAAOf,CAAM,CAAC,GACzDgB,WAAYX,EAASW,WACrBC,YAAaZ,EAASY,WACvB,CAAC,CACF,EA4FMC,EAAgB,CAAEC,GAAIA,IAAM,IAAK,EACvC,SAAwBC,GAAmB,CAC1C,MAAMtB,EAAOuB,IACPnB,EAAiBJ,EAAKG,SAASC,eACnCC,WACAC,SAAS,EAAG,GAAG,EAEjB,aACE,MAAI,CAAAkB,UAAU,qCACdC,SAACC,EAAA,KAAA,OAAA,CAAKF,UAAU,0IACfC,SAAA,CAACC,EAAA,KAAA,MAAA,CAAIF,UAAU,2EACdC,SAAA,CAACE,EAAA,IAAA,KAAA,CAAGH,UAAU,6DACbC,SAACE,EAAA,IAAA,MAAA,CAAIH,UAAU,gEACdC,SAAAC,EAAA,KAAC,MAAI,CAAAF,UAAU,0CACdC,SAAA,CAAAE,EAAA,IAACC,EAAK,CAAAC,GAAI,IAAIzB,CAAc,GAAIoB,UAAU,kBACxCC,SAAA,GAAGrB,CAAc,KAAKJ,EAAKG,SAASQ,KAAK,EAC3C,CAAA,EACAgB,EAAA,IAAC,QAAKF,SAAC,GAAA,CAAA,EACPE,EAAA,IAAC,QAAKF,SAAW,aAAA,CAAA,CAAA,EAClB,EACD,CACD,CAAA,EAEAE,EAAA,IAAC,UAAA,CACAH,UAAU,yJACVd,GAAIV,EAAK8B,UAERL,SAAAzB,EAAKG,SAAS4B,aACdJ,EAAAA,IAACK,EAAA,CACAC,sBAAuBjC,EAAKiC,sBAE5BR,SAAAE,EAAA,IAAC,MAAI,CAAAH,UAAU,sCACdC,SAAAE,EAAA,IAACO,EAAA,CACAC,KAAMnC,EAAKG,SAAS4B,aACpBK,WAAYhB,EACb,EACD,CAAA,CACD,EAGA,iCAAA,CAEF,QACCiB,EAAyB,CAAAC,aAAc,IAAItC,EAAK8B,SAAS,EAAI,CAAA,EAC9DH,EAAA,IAACY,EAAA,CACAC,KAAK,WACLpC,eAAgBJ,EAAKG,SAASC,eAC9BoB,UAAU,oBAAA,CACX,EACAE,EAAA,KAAC,MAAI,CAAAF,UAAU,8DACdC,SAAA,CAAAE,EAAA,IAAC,MAAI,CAAA,CAAA,EACJ3B,EAAKyC,iBACLd,EAAA,IAACe,EAAA,CACAC,KAAM3C,EAAKyC,iBAAiBE,KAC5BC,aAAc5C,EAAKyC,iBAAiBG,aACrC,EACG,WACHC,EAAY,CAAAC,KAAM9C,EAAK+C,aAAcC,KAAMhD,EAAKiD,YAAc,CAAA,CAAA,CAChE,CAAA,CAAA,CACD,CAAA,EACAtB,EAAA,IAACuB,EAAA,CACAC,qBAAsBnD,EAAKmD,qBAC3BC,cAAepD,EAAKG,SAASQ,KAAA,CAC9B,CAAA,EACD,CACD,CAAA,CAEF,CAEA,SAASuC,EAAO,CACfC,qBAAAA,EACAC,cAAAA,CACD,EAGG,CACF,KAAM,CAACC,EAAcC,CAAe,EAAIC,WAAe,EAAK,EAE3D,OAAA7B,EAAAA,KAAC,MAAI,CAAAF,UAAU,wDACbC,SAAA,CAAC4B,EAME,WALF,MAAI,CAAA7B,UAAU,yDACdC,SAACE,EAAA,IAAA6B,EAAA,CACA/B,gBAAC,OAAK,CAAAA,SAAA,CAAA,WAAS2B,EAAc,mBAAA,EAAiB,EAC/C,EACD,EAEDzB,EAAA,IAAC,SAAA,CACA8B,OAAQA,IAAMH,EAAgB,EAAI,EAElCI,QAASA,IAAMJ,EAAgB,EAAI,EACnC3C,MAAM,cACNgD,IAAKR,EACL3B,UAAWoC,EACV,sEACAP,EAAe,cAAgB,WAChC,CAAA,CACD,CAAA,CACD,CAAA,CAEF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as x,j as e,n as xe,k as ge,d as Rt}from"./index-Czg1ruVn.js";import{E as kt}from"./index-D6ukHE4T.js";import{c as Pe,u as $e,f as Ce,n as Ot,P as J,a as z,g as Te,b as Ee,S as G,T as It,h as fe,i as he,j as me,l as Ve,A as Ge,d as Mt,D as _t,C as Ft,m as Lt,R as At}from"./tooltip-BtzSIxlB.js";import{c as Ut,u as Ke,R as Ht,T as Bt,V as Yt,I as zt,P as Vt,C as Gt,S as Kt,a as Wt,G as qt,L as Zt,b as Jt,d as Qt,e as Xt,f as er,g as tr,A as rr,D as nr}from"./diff-hpVBklM0.js";import{c as re}from"./clsx-B-dksMZM.js";import{G as sr}from"./error-boundary-BVTbN8PZ.js";import{N as ar}from"./nav-chevrons-DaXg0NPS.js";import{M as or,L as ce,E as ir}from"./mdx-DF11h1m-.js";import{P as lr}from"./progress-BwanvUpB.js";import{I as O,u as De,a as Re,c as pe,b as ke}from"./misc-S5ZD98sI.js";import{s as Oe}from"./progress-bar-wMXWRGq0.js";import{a as K,u as W,A as We,L as ae,b as Ie,F as cr}from"./components-wgHiPsTg.js";import{g as ur}from"./seo-pBpFCWsy.js";import{L as Me}from"./loading-B0uKxERz.js";import{u as dr}from"./client-hints-DLYDs4RF.js";import{D as fr,u as hr}from"./discord-yZor-3t1.js";import{J as mr}from"./index-DjzedX4O.js";import{z as m,u as _e}from"./request-info-DHtGM4FI.js";import{B as qe}from"./button-BA3iiLRs.js";import{u as pr}from"./index-DMhFsRrG.js";import{E as xr}from"./epic-video--ydmGfR4.js";import{u as gr}from"./use-event-source-ySol3hbz.js";import{h as vr,R as jr,u as br,F as wr,P as yr}from"./index-C6ToujzV.js";import"./user-CdUDQ7a8.js";var be="rovingFocusGroup.onEntryFocus",Nr={bubbles:!1,cancelable:!0},ve="RovingFocusGroup",[we,Ze,Sr]=Ut(ve),[Pr,Je]=Pe(ve,[Sr]),[$r,Cr]=Pr(ve),Qe=x.forwardRef((t,n)=>e.jsx(we.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(we.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(Tr,{...t,ref:n})})}));Qe.displayName=ve;var Tr=x.forwardRef((t,n)=>{const{__scopeRovingFocusGroup:s,orientation:r,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:l,onEntryFocus:h,preventScrollOnEntryFocus:c=!1,...p}=t,g=x.useRef(null),y=$e(n,g),S=Ke(i),[d=null,$]=Ce({prop:o,defaultProp:u,onChange:l}),[T,j]=x.useState(!1),R=Ot(h),A=Ze(s),E=x.useRef(!1),[F,U]=x.useState(0);return x.useEffect(()=>{const k=g.current;if(k)return k.addEventListener(be,R),()=>k.removeEventListener(be,R)},[R]),e.jsx($r,{scope:s,orientation:r,dir:S,loop:a,currentTabStopId:d,onItemFocus:x.useCallback(k=>$(k),[$]),onItemShiftTab:x.useCallback(()=>j(!0),[]),onFocusableItemAdd:x.useCallback(()=>U(k=>k+1),[]),onFocusableItemRemove:x.useCallback(()=>U(k=>k-1),[]),children:e.jsx(J.div,{tabIndex:T||F===0?-1:0,"data-orientation":r,...p,ref:y,style:{outline:"none",...t.style},onMouseDown:z(t.onMouseDown,()=>{E.current=!0}),onFocus:z(t.onFocus,k=>{const B=!E.current;if(k.target===k.currentTarget&&B&&!T){const M=new CustomEvent(be,Nr);if(k.currentTarget.dispatchEvent(M),!M.defaultPrevented){const D=A().filter(f=>f.focusable),q=D.find(f=>f.active),X=D.find(f=>f.id===d),v=[q,X,...D].filter(Boolean).map(f=>f.ref.current);tt(v,c)}}E.current=!1}),onBlur:z(t.onBlur,()=>j(!1))})})}),Xe="RovingFocusGroupItem",et=x.forwardRef((t,n)=>{const{__scopeRovingFocusGroup:s,focusable:r=!0,active:a=!1,tabStopId:i,...o}=t,u=Te(),l=i||u,h=Cr(Xe,s),c=h.currentTabStopId===l,p=Ze(s),{onFocusableItemAdd:g,onFocusableItemRemove:y}=h;return x.useEffect(()=>{if(r)return g(),()=>y()},[r,g,y]),e.jsx(we.ItemSlot,{scope:s,id:l,focusable:r,active:a,children:e.jsx(J.span,{tabIndex:c?0:-1,"data-orientation":h.orientation,...o,ref:n,onMouseDown:z(t.onMouseDown,S=>{r?h.onItemFocus(l):S.preventDefault()}),onFocus:z(t.onFocus,()=>h.onItemFocus(l)),onKeyDown:z(t.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){h.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const d=Rr(S,h.orientation,h.dir);if(d!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let T=p().filter(j=>j.focusable).map(j=>j.ref.current);if(d==="last")T.reverse();else if(d==="prev"||d==="next"){d==="prev"&&T.reverse();const j=T.indexOf(S.currentTarget);T=h.loop?kr(T,j+1):T.slice(j+1)}setTimeout(()=>tt(T))}})})})});et.displayName=Xe;var Er={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Dr(t,n){return n!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Rr(t,n,s){const r=Dr(t.key,s);if(!(n==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(n==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Er[r]}function tt(t,n=!1){const s=document.activeElement;for(const r of t)if(r===s||(r.focus({preventScroll:n}),document.activeElement!==s))return}function kr(t,n){return t.map((s,r)=>t[(n+r)%t.length])}var Or=Qe,Ir=et,Fe="Tabs",[Mr,bs]=Pe(Fe,[Je]),rt=Je(),[_r,Le]=Mr(Fe),nt=x.forwardRef((t,n)=>{const{__scopeTabs:s,value:r,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:u,activationMode:l="automatic",...h}=t,c=Ke(u),[p,g]=Ce({prop:r,onChange:a,defaultProp:i});return e.jsx(_r,{scope:s,baseId:Te(),value:p,onValueChange:g,orientation:o,dir:c,activationMode:l,children:e.jsx(J.div,{dir:c,"data-orientation":o,...h,ref:n})})});nt.displayName=Fe;var st="TabsList",at=x.forwardRef((t,n)=>{const{__scopeTabs:s,loop:r=!0,...a}=t,i=Le(st,s),o=rt(s);return e.jsx(Or,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:e.jsx(J.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:n})})});at.displayName=st;var ot="TabsTrigger",it=x.forwardRef((t,n)=>{const{__scopeTabs:s,value:r,disabled:a=!1,...i}=t,o=Le(ot,s),u=rt(s),l=ut(o.baseId,r),h=dt(o.baseId,r),c=r===o.value;return e.jsx(Ir,{asChild:!0,...u,focusable:!a,active:c,children:e.jsx(J.button,{type:"button",role:"tab","aria-selected":c,"aria-controls":h,"data-state":c?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:l,...i,ref:n,onMouseDown:z(t.onMouseDown,p=>{!a&&p.button===0&&p.ctrlKey===!1?o.onValueChange(r):p.preventDefault()}),onKeyDown:z(t.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&o.onValueChange(r)}),onFocus:z(t.onFocus,()=>{const p=o.activationMode!=="manual";!c&&!a&&p&&o.onValueChange(r)})})})});it.displayName=ot;var lt="TabsContent",ct=x.forwardRef((t,n)=>{const{__scopeTabs:s,value:r,forceMount:a,children:i,...o}=t,u=Le(lt,s),l=ut(u.baseId,r),h=dt(u.baseId,r),c=r===u.value,p=x.useRef(c);return x.useEffect(()=>{const g=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(g)},[]),e.jsx(Ee,{present:a||c,children:({present:g})=>e.jsx(J.div,{"data-state":c?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":l,hidden:!g,id:h,tabIndex:0,...o,ref:n,style:{...t.style,animationDuration:p.current?"0s":void 0},children:g&&i})})});ct.displayName=lt;function ut(t,n){return`${t}-trigger-${n}`}function dt(t,n){return`${t}-content-${n}`}var Fr=nt,Lr=at,Ar=it,se=ct;function ye({appName:t,reset:n=!1,tooltipText:s,...r}){var o;const a=K(),i=e.jsx("button",{type:"submit",...r,className:re(r.className,a.state!=="idle"?"cursor-progress":null,((o=a.data)==null?void 0:o.status)==="error"?"cursor-not-allowed":null)});return e.jsxs(a.Form,{action:"/set-playground",method:"POST",className:"inline-flex items-center justify-center",children:[e.jsx("input",{type:"hidden",name:"appName",value:t}),n?e.jsx("input",{type:"hidden",name:"reset",value:"true"}):null,Oe,s?e.jsx(G,{content:s,children:i}):i]})}function Ur({playgroundAppName:t,allApps:n}){var r;const s=K();return e.jsxs(Ht,{name:"appName",value:t,onValueChange:a=>{s.submit({appName:a},{method:"POST",action:"/set-playground"})},children:[e.jsxs(Bt,{"aria-label":"Select app for playground",className:re("flex h-full w-full items-center justify-between text-left radix-placeholder:text-gray-500 focus-visible:outline-none",s.state!=="idle"?"cursor-progress":null,((r=s.data)==null?void 0:r.status)==="error"?"cursor-not-allowed":null),children:[e.jsx("span",{className:"w-80 flex-1 overflow-hidden text-ellipsis whitespace-nowrap scrollbar-thin scrollbar-thumb-scrollbar",children:e.jsx(Yt,{placeholder:"Select current app",className:"inline-block w-40 text-ellipsis"})}),e.jsx(zt,{children:e.jsx(O,{name:"TriangleDownSmall"})})]}),e.jsx(Vt,{children:e.jsxs(Gt,{position:"popper",align:"start",className:"z-20 max-h-[50vh] bg-black text-white lg:max-h-[70vh]",children:[e.jsx(Kt,{className:"flex h-5 cursor-default items-center justify-center ",children:e.jsx(O,{name:"ChevronUp"})}),e.jsx(Wt,{className:"p-3",children:e.jsxs(qt,{children:[e.jsx(Zt,{className:"px-5 pb-3 font-mono uppercase",children:"App"}),n.filter(a=>a.name!=="playground").map(a=>e.jsx(Hr,{value:a.name,children:a.displayName},a.name))]})}),e.jsx(Jt,{className:"flex h-5 cursor-default items-center justify-center ",children:e.jsx(O,{name:"ChevronDown"})})]})})]})}function Hr({value:t,children:n}){return e.jsxs(Qt,{value:t,className:"relative flex cursor-pointer select-none items-center rounded px-10 py-2 leading-none opacity-80 radix-disabled:text-red-500 radix-highlighted:opacity-100 radix-highlighted:outline-none radix-state-checked:opacity-100",children:[e.jsx(Xt,{children:n}),e.jsx(er,{className:"absolute left-0 inline-flex w-[25px] items-center justify-center",children:e.jsx(O,{name:"CheckSmall"})})]})}function Ae({appName:t}){return ENV.EPICSHOP_DEPLOYED?null:e.jsx(ye,{appName:t,tooltipText:"Playground is not set to the right app. Click to set Playground.",children:e.jsxs("span",{className:"flex items-center justify-center gap-1 text-foreground-danger hover:underline",children:[e.jsx(O,{name:"Unlinked",className:"animate-ping"})," ",e.jsx("span",{className:"uppercase",children:"Set to Playground"})]})})}var ft={exports:{}};(function(t,n){(function(s,r){t.exports=r()})(ge,function(){var s=1e3,r=6e4,a=36e5,i="millisecond",o="second",u="minute",l="hour",h="day",c="week",p="month",g="quarter",y="year",S="date",d="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,T=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,j={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var v=["th","st","nd","rd"],f=N%100;return"["+N+(v[(f-20)%10]||v[f]||v[0])+"]"}},R=function(N,v,f){var P=String(N);return!P||P.length>=v?N:""+Array(v+1-P.length).join(f)+N},A={s:R,z:function(N){var v=-N.utcOffset(),f=Math.abs(v),P=Math.floor(f/60),b=f%60;return(v<=0?"+":"-")+R(P,2,"0")+":"+R(b,2,"0")},m:function N(v,f){if(v.date()<f.date())return-N(f,v);var P=12*(f.year()-v.year())+(f.month()-v.month()),b=v.clone().add(P,p),C=f-b<0,w=v.clone().add(P+(C?-1:1),p);return+(-(P+(f-b)/(C?b-w:w-b))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:p,y,w:c,d:h,D:S,h:l,m:u,s:o,ms:i,Q:g}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},E="en",F={};F[E]=j;var U="$isDayjsObject",k=function(N){return N instanceof q||!(!N||!N[U])},B=function N(v,f,P){var b;if(!v)return E;if(typeof v=="string"){var C=v.toLowerCase();F[C]&&(b=C),f&&(F[C]=f,b=C);var w=v.split("-");if(!b&&w.length>1)return N(w[0])}else{var I=v.name;F[I]=v,b=I}return!P&&b&&(E=b),b||!P&&E},M=function(N,v){if(k(N))return N.clone();var f=typeof v=="object"?v:{};return f.date=N,f.args=arguments,new q(f)},D=A;D.l=B,D.i=k,D.w=function(N,v){return M(N,{locale:v.$L,utc:v.$u,x:v.$x,$offset:v.$offset})};var q=function(){function N(f){this.$L=B(f.locale,null,!0),this.parse(f),this.$x=this.$x||f.x||{},this[U]=!0}var v=N.prototype;return v.parse=function(f){this.$d=function(P){var b=P.date,C=P.utc;if(b===null)return new Date(NaN);if(D.u(b))return new Date;if(b instanceof Date)return new Date(b);if(typeof b=="string"&&!/Z$/i.test(b)){var w=b.match($);if(w){var I=w[2]-1||0,L=(w[7]||"0").substring(0,3);return C?new Date(Date.UTC(w[1],I,w[3]||1,w[4]||0,w[5]||0,w[6]||0,L)):new Date(w[1],I,w[3]||1,w[4]||0,w[5]||0,w[6]||0,L)}}return new Date(b)}(f),this.init()},v.init=function(){var f=this.$d;this.$y=f.getFullYear(),this.$M=f.getMonth(),this.$D=f.getDate(),this.$W=f.getDay(),this.$H=f.getHours(),this.$m=f.getMinutes(),this.$s=f.getSeconds(),this.$ms=f.getMilliseconds()},v.$utils=function(){return D},v.isValid=function(){return this.$d.toString()!==d},v.isSame=function(f,P){var b=M(f);return this.startOf(P)<=b&&b<=this.endOf(P)},v.isAfter=function(f,P){return M(f)<this.startOf(P)},v.isBefore=function(f,P){return this.endOf(P)<M(f)},v.$g=function(f,P,b){return D.u(f)?this[P]:this.set(b,f)},v.unix=function(){return Math.floor(this.valueOf()/1e3)},v.valueOf=function(){return this.$d.getTime()},v.startOf=function(f,P){var b=this,C=!!D.u(P)||P,w=D.p(f),I=function(te,Y){var Z=D.w(b.$u?Date.UTC(b.$y,Y,te):new Date(b.$y,Y,te),b);return C?Z:Z.endOf(h)},L=function(te,Y){return D.w(b.toDate()[te].apply(b.toDate("s"),(C?[0,0,0,0]:[23,59,59,999]).slice(Y)),b)},_=this.$W,H=this.$M,V=this.$D,ne="set"+(this.$u?"UTC":"");switch(w){case y:return C?I(1,0):I(31,11);case p:return C?I(1,H):I(0,H+1);case c:var ee=this.$locale().weekStart||0,ie=(_<ee?_+7:_)-ee;return I(C?V-ie:V+(6-ie),H);case h:case S:return L(ne+"Hours",0);case l:return L(ne+"Minutes",1);case u:return L(ne+"Seconds",2);case o:return L(ne+"Milliseconds",3);default:return this.clone()}},v.endOf=function(f){return this.startOf(f,!1)},v.$set=function(f,P){var b,C=D.p(f),w="set"+(this.$u?"UTC":""),I=(b={},b[h]=w+"Date",b[S]=w+"Date",b[p]=w+"Month",b[y]=w+"FullYear",b[l]=w+"Hours",b[u]=w+"Minutes",b[o]=w+"Seconds",b[i]=w+"Milliseconds",b)[C],L=C===h?this.$D+(P-this.$W):P;if(C===p||C===y){var _=this.clone().set(S,1);_.$d[I](L),_.init(),this.$d=_.set(S,Math.min(this.$D,_.daysInMonth())).$d}else I&&this.$d[I](L);return this.init(),this},v.set=function(f,P){return this.clone().$set(f,P)},v.get=function(f){return this[D.p(f)]()},v.add=function(f,P){var b,C=this;f=Number(f);var w=D.p(P),I=function(H){var V=M(C);return D.w(V.date(V.date()+Math.round(H*f)),C)};if(w===p)return this.set(p,this.$M+f);if(w===y)return this.set(y,this.$y+f);if(w===h)return I(1);if(w===c)return I(7);var L=(b={},b[u]=r,b[l]=a,b[o]=s,b)[w]||1,_=this.$d.getTime()+f*L;return D.w(_,this)},v.subtract=function(f,P){return this.add(-1*f,P)},v.format=function(f){var P=this,b=this.$locale();if(!this.isValid())return b.invalidDate||d;var C=f||"YYYY-MM-DDTHH:mm:ssZ",w=D.z(this),I=this.$H,L=this.$m,_=this.$M,H=b.weekdays,V=b.months,ne=b.meridiem,ee=function(Y,Z,le,de){return Y&&(Y[Z]||Y(P,C))||le[Z].slice(0,de)},ie=function(Y){return D.s(I%12||12,Y,"0")},te=ne||function(Y,Z,le){var de=Y<12?"AM":"PM";return le?de.toLowerCase():de};return C.replace(T,function(Y,Z){return Z||function(le){switch(le){case"YY":return String(P.$y).slice(-2);case"YYYY":return D.s(P.$y,4,"0");case"M":return _+1;case"MM":return D.s(_+1,2,"0");case"MMM":return ee(b.monthsShort,_,V,3);case"MMMM":return ee(V,_);case"D":return P.$D;case"DD":return D.s(P.$D,2,"0");case"d":return String(P.$W);case"dd":return ee(b.weekdaysMin,P.$W,H,2);case"ddd":return ee(b.weekdaysShort,P.$W,H,3);case"dddd":return H[P.$W];case"H":return String(I);case"HH":return D.s(I,2,"0");case"h":return ie(1);case"hh":return ie(2);case"a":return te(I,L,!0);case"A":return te(I,L,!1);case"m":return String(L);case"mm":return D.s(L,2,"0");case"s":return String(P.$s);case"ss":return D.s(P.$s,2,"0");case"SSS":return D.s(P.$ms,3,"0");case"Z":return w}return null}(Y)||w.replace(":","")})},v.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},v.diff=function(f,P,b){var C,w=this,I=D.p(P),L=M(f),_=(L.utcOffset()-this.utcOffset())*r,H=this-L,V=function(){return D.m(w,L)};switch(I){case y:C=V()/12;break;case p:C=V();break;case g:C=V()/3;break;case c:C=(H-_)/6048e5;break;case h:C=(H-_)/864e5;break;case l:C=H/a;break;case u:C=H/r;break;case o:C=H/s;break;default:C=H}return b?C:D.a(C)},v.daysInMonth=function(){return this.endOf(p).$D},v.$locale=function(){return F[this.$L]},v.locale=function(f,P){if(!f)return this.$L;var b=this.clone(),C=B(f,P,!0);return C&&(b.$L=C),b},v.clone=function(){return D.w(this.$d,this)},v.toDate=function(){return new Date(this.valueOf())},v.toJSON=function(){return this.isValid()?this.toISOString():null},v.toISOString=function(){return this.$d.toISOString()},v.toString=function(){return this.$d.toUTCString()},N}(),X=q.prototype;return M.prototype=X,[["$ms",i],["$s",o],["$m",u],["$H",l],["$W",h],["$M",p],["$y",y],["$D",S]].forEach(function(N){X[N[1]]=function(v){return this.$g(v,N[0],N[1])}}),M.extend=function(N,v){return N.$i||(N(v,q,M),N.$i=!0),M},M.locale=B,M.isDayjs=k,M.unix=function(N){return M(1e3*N)},M.en=F[E],M.Ls=F,M.p={},M})})(ft);var Br=ft.exports;const je=xe(Br);var ht={exports:{}};(function(t,n){(function(s,r){t.exports=r()})(ge,function(){return function(s,r,a){s=s||{};var i=r.prototype,o={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function u(h,c,p,g){return i.fromToBase(h,c,p,g)}a.en.relativeTime=o,i.fromToBase=function(h,c,p,g,y){for(var S,d,$,T=p.$locale().relativeTime||o,j=s.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],R=j.length,A=0;A<R;A+=1){var E=j[A];E.d&&(S=g?a(h).diff(p,E.d,!0):p.diff(h,E.d,!0));var F=(s.rounding||Math.round)(Math.abs(S));if($=S>0,F<=E.r||!E.r){F<=1&&A>0&&(E=j[A-1]);var U=T[E.l];y&&(F=y(""+F)),d=typeof U=="string"?U.replace("%d",F):U(F,c,E.l,$);break}}if(c)return d;var k=$?T.future:T.past;return typeof k=="function"?k(d):k.replace("%s",d)},i.to=function(h,c){return u(h,c,this,!0)},i.from=function(h,c){return u(h,c,this)};var l=function(h){return h.$u?a.utc():a()};i.toNow=function(h){return this.to(l(this),h)},i.fromNow=function(h){return this.from(l(this),h)}}})})(ht);var Yr=ht.exports;const zr=xe(Yr);var mt={exports:{}};(function(t,n){(function(s,r){t.exports=r()})(ge,function(){var s={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function(a,i,o){var u,l=function(g,y,S){S===void 0&&(S={});var d=new Date(g),$=function(T,j){j===void 0&&(j={});var R=j.timeZoneName||"short",A=T+"|"+R,E=r[A];return E||(E=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:T,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:R}),r[A]=E),E}(y,S);return $.formatToParts(d)},h=function(g,y){for(var S=l(g,y),d=[],$=0;$<S.length;$+=1){var T=S[$],j=T.type,R=T.value,A=s[j];A>=0&&(d[A]=parseInt(R,10))}var E=d[3],F=E===24?0:E,U=d[0]+"-"+d[1]+"-"+d[2]+" "+F+":"+d[4]+":"+d[5]+":000",k=+g;return(o.utc(U).valueOf()-(k-=k%1e3))/6e4},c=i.prototype;c.tz=function(g,y){g===void 0&&(g=u);var S=this.utcOffset(),d=this.toDate(),$=d.toLocaleString("en-US",{timeZone:g}),T=Math.round((d-new Date($))/1e3/60),j=o($,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(15*-Math.round(d.getTimezoneOffset()/15)-T,!0);if(y){var R=j.utcOffset();j=j.add(S-R,"minute")}return j.$x.$timezone=g,j},c.offsetName=function(g){var y=this.$x.$timezone||o.tz.guess(),S=l(this.valueOf(),y,{timeZoneName:g}).find(function(d){return d.type.toLowerCase()==="timezonename"});return S&&S.value};var p=c.startOf;c.startOf=function(g,y){if(!this.$x||!this.$x.$timezone)return p.call(this,g,y);var S=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return p.call(S,g,y).tz(this.$x.$timezone,!0)},o.tz=function(g,y,S){var d=S&&y,$=S||y||u,T=h(+o(),$);if(typeof g!="string")return o(g).tz($);var j=function(F,U,k){var B=F-60*U*1e3,M=h(B,k);if(U===M)return[B,U];var D=h(B-=60*(M-U)*1e3,k);return M===D?[B,M]:[F-60*Math.min(M,D)*1e3,Math.max(M,D)]}(o.utc(g,d).valueOf(),T,$),R=j[0],A=j[1],E=o(R).utcOffset(A);return E.$x.$timezone=$,E},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){u=g}}})})(mt);var Vr=mt.exports;const Gr=xe(Vr);var pt={exports:{}};(function(t,n){(function(s,r){t.exports=r()})(ge,function(){var s="minute",r=/[+-]\d\d(?::?\d\d)?/g,a=/([+-]|\d\d)/g;return function(i,o,u){var l=o.prototype;u.utc=function(d){var $={date:d,utc:!0,args:arguments};return new o($)},l.utc=function(d){var $=u(this.toDate(),{locale:this.$L,utc:!0});return d?$.add(this.utcOffset(),s):$},l.local=function(){return u(this.toDate(),{locale:this.$L,utc:!1})};var h=l.parse;l.parse=function(d){d.utc&&(this.$u=!0),this.$utils().u(d.$offset)||(this.$offset=d.$offset),h.call(this,d)};var c=l.init;l.init=function(){if(this.$u){var d=this.$d;this.$y=d.getUTCFullYear(),this.$M=d.getUTCMonth(),this.$D=d.getUTCDate(),this.$W=d.getUTCDay(),this.$H=d.getUTCHours(),this.$m=d.getUTCMinutes(),this.$s=d.getUTCSeconds(),this.$ms=d.getUTCMilliseconds()}else c.call(this)};var p=l.utcOffset;l.utcOffset=function(d,$){var T=this.$utils().u;if(T(d))return this.$u?0:T(this.$offset)?p.call(this):this.$offset;if(typeof d=="string"&&(d=function(E){E===void 0&&(E="");var F=E.match(r);if(!F)return null;var U=(""+F[0]).match(a)||["-",0,0],k=U[0],B=60*+U[1]+ +U[2];return B===0?0:k==="+"?B:-B}(d),d===null))return this;var j=Math.abs(d)<=16?60*d:d,R=this;if($)return R.$offset=j,R.$u=d===0,R;if(d!==0){var A=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(R=this.local().add(j+A,s)).$offset=j,R.$x.$localOffset=A}else R=this.utc();return R};var g=l.format;l.format=function(d){var $=d||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,$)},l.valueOf=function(){var d=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*d},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var y=l.toDate;l.toDate=function(d){return d==="s"&&this.$offset?u(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():y.call(this)};var S=l.diff;l.diff=function(d,$,T){if(d&&this.$u===d.$u)return S.call(this,d,$,T);var j=this.local(),R=u(d).local();return S.call(j,R,$,T)}}})})(pt);var Kr=pt.exports;const Wr=xe(Kr);je.extend(Wr);je.extend(Gr);je.extend(zr);function qr(){const t=W();return e.jsxs("div",{className:"flex h-full w-full flex-col gap-4 pt-4",children:[e.jsx("div",{className:"text-center",children:e.jsx(fr,{discordAuthUrl:t.discordAuthUrl})}),e.jsx("div",{className:"flex-1 overflow-y-scroll bg-accent pb-4 scrollbar-thin scrollbar-thumb-scrollbar",children:e.jsx(Zr,{})})]})}function Zr(){const t=W(),n=hr({discordAuthUrl:t.discordAuthUrl}),s=De();return e.jsxs("div",{className:"flex h-full flex-col items-center justify-between",children:[e.jsx(x.Suspense,{fallback:e.jsx("div",{className:"flex h-full w-full flex-col items-center justify-center",children:e.jsx(Me,{children:"Loading Discord Posts"})}),children:e.jsx(We,{resolve:t.discordPostsPromise,errorElement:e.jsx("div",{className:"text-red-500",children:"There was a problem loading the discord posts"}),children:r=>e.jsx("ul",{className:"flex w-full flex-col gap-4 p-3 xl:p-12",children:r.map(a=>e.jsx("li",{className:"rounded-xl border bg-background transition-all duration-200 focus-within:-translate-y-1 focus-within:shadow-lg hover:-translate-y-1 hover:shadow-lg",children:e.jsx(Jr,{thread:a})},a.id))})})}),e.jsx("div",{children:e.jsxs(ae,{to:s&&!n.includes("oauth")?n.replace(/^https/,"discord"):n,target:n.includes("oauth")?void 0:"_blank",rel:"noreferrer noopener",onClick:s?r=>{r.preventDefault(),window.open(r.currentTarget.href,"_blank","noreferrer noopener")}:void 0,className:"flex items-center gap-2 p-2 text-xl hover:underline",children:["Create Post ",e.jsx(O,{name:"ExternalLink"})]})})]})}function Jr({thread:t}){const n=t.reactions.filter(r=>r.count),s=dr();return e.jsx("div",{children:e.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[t.tags.length?e.jsx("div",{className:"flex gap-2",children:t.tags.map(r=>e.jsxs("div",{className:"flex items-center justify-center gap-1 rounded-full bg-accent px-2 py-1 text-sm",children:[e.jsx("span",{className:"h-3 w-3 leading-3",children:e.jsx(Ye,{name:r.emojiName,url:r.emojiUrl})}),e.jsx("span",{children:r.name})]},r.name))}):null,e.jsx("strong",{className:"text-xl font-bold",children:t.name}),e.jsxs("div",{className:"flex items-start gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[t.authorAvatarUrl?e.jsx("img",{src:t.authorAvatarUrl,alt:"",className:"h-6 w-6 rounded-full"}):null,e.jsxs("span",{children:[e.jsx("span",{className:"font-bold",style:t.authorHexAccentColor?{color:t.authorHexAccentColor}:{},children:t.authorDisplayName}),":"," "]})]}),e.jsx("span",{className:"flex-1 overflow-ellipsis text-muted-foreground",children:t.messagePreview})]})]}),t.previewImageUrl?e.jsx("img",{src:t.previewImageUrl,alt:"",className:"h-28 w-28 rounded-lg object-cover"}):null]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{children:n.length?e.jsx("ul",{className:"flex items-center gap-2",children:n.map((r,a)=>e.jsxs("li",{className:"flex items-center gap-1 rounded-md border border-blue-600 bg-blue-500/20 px-[5px] py-[0.5px] text-sm",children:[e.jsx("span",{className:"h-3 w-3 leading-3",children:e.jsx(Ye,{name:r.emojiName,url:r.emojiUrl})}),e.jsx("span",{children:r.count})]},a))}):null}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(O,{name:"Chat"})," ",t.messageCount]}),` · ${je(t.lastUpdated).tz(s.timeZone).fromNow()}`]})]}),e.jsxs("span",{className:"flex items-center gap-4",children:[e.jsx("a",{href:t.link.replace(/^https/,"discord"),children:e.jsx(O,{name:"Discord"})}),e.jsx("a",{href:t.link,target:"_blank",rel:"noreferrer noopener",children:e.jsx(O,{name:"ExternalLink"})})]})]})]})})}function Ye({name:t,url:n}){return n?e.jsx("img",{src:n,alt:t,className:"h-full w-full"}):t||null}function xt({playgroundAppName:t,problemAppName:n,isUpToDate:s,allApps:r,children:a}){const i=t===n,o=i&&s?e.jsx(O,{size:"xl",name:"Linked"}):e.jsx(O,{size:"xl",name:"Unlinked",className:"animate-pulse text-foreground-danger"});let u="Click to reset Playground.";return s||(u="Playground is out of date. Click to reset Playground."),i||(u="Playground is not set to the right app. Click to set Playground."),e.jsxs("div",{className:"flex h-full w-full flex-col justify-between",children:[e.jsxs("div",{className:"flex h-14 flex-shrink-0 items-center justify-start gap-2 border-b px-3",children:[e.jsx("div",{className:"display-alt-up",children:n?e.jsx(ye,{appName:n,tooltipText:u,children:o}):e.jsx(G,{content:"No problem app available for this step",children:e.jsx("div",{children:e.jsx(O,{name:"Question"})})})}),e.jsx("div",{className:"display-alt-down",children:t?e.jsx(ye,{appName:t,reset:!0,tooltipText:"Reset Playground",children:e.jsx("div",{className:"flex h-7 w-7 items-center justify-center",children:e.jsx(O,{name:"Refresh"})})}):e.jsx("div",{className:"h-7 w-7"})}),e.jsx(Ur,{allApps:r,playgroundAppName:t})]}),e.jsx("div",{className:"flex h-full flex-1 flex-grow items-center justify-center",children:a})]})}function Qr({name:t}){var i;const n=K(),s=(i=n.formData)==null?void 0:i.get("intent"),r=s==="stop"?"Stopping App":s==="restart"?"Restarting App":null,a=De();return e.jsxs(n.Form,{method:"POST",action:"/start",children:[Oe,e.jsx("input",{type:"hidden",name:"name",value:t}),e.jsx("button",{type:"submit",name:"intent",value:a?"restart":"stop",className:"h-full border-r px-3 py-4 font-mono text-xs uppercase leading-none",children:r||(a?"Restart App":"Stop App")})]})}function gt({port:t}){const n=K();return e.jsxs(n.Form,{method:"POST",action:"/start",children:[e.jsx("input",{type:"hidden",name:"port",value:t}),e.jsx(qe,{varient:"mono",type:"submit",name:"intent",value:"stop-port",children:n.state==="idle"?"Stop Port":"Stopping Port"})]})}function Xr({name:t}){var s;const n=K();return((s=n.data)==null?void 0:s.status)==="app-not-started"?n.data.error==="port-unavailable"?e.jsxs("div",{children:["The port is unavailable. Would you like to stop whatever is running on that port and try again?",e.jsx(gt,{port:n.data.port})]}):e.jsx("div",{children:"An unknown error has happened."}):e.jsxs(n.Form,{method:"POST",action:"/start",children:[e.jsx("input",{type:"hidden",name:"name",value:t}),n.state==="idle"?e.jsx(qe,{type:"submit",name:"intent",value:"start",varient:"mono",children:"Start App"}):e.jsx("div",{children:e.jsx(Me,{children:"Starting App"})})]})}const en=m.intersection(m.object({type:m.literal("epicshop:history-call")}),m.union([m.object({method:m.literal("pushState"),args:m.union([m.tuple([m.object({}).passthrough(),m.unknown()]),m.tuple([m.object({}).passthrough(),m.unknown(),m.string()])])}),m.object({method:m.literal("replaceState"),args:m.union([m.tuple([m.object({}).passthrough(),m.unknown()]),m.tuple([m.object({}).passthrough(),m.unknown(),m.string()])])}),m.object({method:m.literal("go"),args:m.tuple([m.number().optional()])}),m.object({method:m.literal("forward"),args:m.tuple([])}),m.object({method:m.literal("back"),args:m.tuple([])}),m.object({method:m.literal("popstate"),pathname:m.string(),delta:m.number()})])),tn=m.object({type:m.literal("epicshop:loaded"),url:m.string()}),rn=m.union([en,tn]);function ze(t,n,s){return Math.min(Math.max(t+n,0),s)}const nn=x.forwardRef(sn);function sn({name:t,port:n,portIsAvailable:s,isRunning:r,baseUrl:a,id:i,initialRoute:o},u){const l=_e();return r?e.jsx(an,{baseUrl:a,id:i,name:t,ref:u,initialRoute:o}):s===!1?e.jsxs("div",{className:"flex flex-col items-center justify-center",children:[e.jsxs("p",{className:"max-w-xs pb-5 text-center",role:"status",children:["The port for this app is unavailable. It could be that you're running it ",e.jsx("a",{href:Re({domain:l.domain,port:n}),className:"underline",children:"elsewhere"}),"?"]}),e.jsx(gt,{port:n})]}):e.jsx(Xr,{name:t})}const an=x.forwardRef(on);function on({baseUrl:t,id:n,name:s,initialRoute:r},a){const[i,o]=Ie(),u=i.get("pathname")??r,[l,h]=x.useState(0),c=n+l,p=x.useRef("new"),g=x.useRef(null),[y,S]=x.useState({history:[u],index:0}),[d,$]=x.useState(u),T=x.useRef(null),j=new URL(u,t),R=x.useRef(j);x.useEffect(()=>{R.current=j});const[A,E]=x.useState(j),F=x.useRef(n);F.current!==n&&(F.current=n,E(R.current)),x.useEffect(()=>{F.current=n}),x.useEffect(()=>{function N(v){var C;if(v.source!==((C=T.current)==null?void 0:C.contentWindow))return;const f=rn.safeParse(v.data,{path:["messageEvent","data"]});if(!f.success)return;const{data:P}=f;if(P.type==="epicshop:loaded"){S(w=>{const I=L=>ze(w.index,L,w.history.length-1);if(p.current==="back")return{...w,index:I(-1)};if(p.current==="forward")return{...w,index:I(1)};if(p.current==="new"){const L=w.history[w.index],_=new URL(P.url).pathname;if(L===_)return w;const H=[...w.history.slice(0,w.index+1),_];return{history:H,index:H.length-1}}else throw new Error("Unexpected lastDirectionRef value")});return}const{method:b}=P;S(w=>{const I=_=>ze(w.index,_,w.history.length-1),L=w.history[w.index];switch(b){case"popstate":return{...w,index:I(P.delta)};case"forward":return{...w,index:I(1)};case"back":return{...w,index:I(-1)};case"pushState":{const _=P.args[2]??L,H=[...w.history.slice(0,w.index+1),_].filter(Boolean);return{...w,history:H,index:H.length-1}}case"replaceState":{const _=P.args[2]??L;return{...w,history:[...w.history.slice(0,w.index),_,...w.history.slice(w.index+1)].filter(Boolean)}}case"go":{const[_=0]=P.args;return{...w,index:I(_)}}}})}return window.addEventListener("message",N),()=>{window.removeEventListener("message",N)}},[]);const U=x.useRef(o);x.useEffect(()=>{U.current=o},[o]);const k=y.history[y.index];x.useEffect(()=>{if(!k)return;$(k);const N=new URLSearchParams(window.location.search);k==="/"?N.delete("pathname"):N.set("pathname",k),`?${N.toString()}`!==window.location.search&&U.current(N,{replace:!0})},[k]);const B=(...N)=>{var f,P;const v=N[0];typeof v=="number"?p.current=v>0?"forward":"back":p.current="new",g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{p.current="new"},100),(P=(f=T.current)==null?void 0:f.contentWindow)==null||P.postMessage({type:"epicshop:navigate-call",params:N},"*")};function M(N=d){$(N);const v=y.history[y.index];B(N,{replace:v===N})}x.useImperativeHandle(a,()=>({handleExtrnalNavigation:M}));const D=y.index===y.history.length-1,q=y.index<=0,X=[];for(const[N,v]of i.entries())N!=="pathname"&&X.push(e.jsx("input",{type:"hidden",name:N,value:v},N));return e.jsx(It,{children:e.jsxs("div",{className:"flex h-full flex-grow flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b pl-1.5",children:[e.jsxs("div",{className:"mr-2 flex items-center justify-center gap-2 px-1",children:[e.jsxs(fe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("button",{type:"button",className:"hidden aspect-square h-full w-full items-center justify-center p-1 transition disabled:opacity-40 sm:flex",disabled:q,onClick:()=>B(-1),children:e.jsx(O,{name:"ArrowLeft","aria-hidden":"true"})})}),e.jsx(me,{children:"Go back"})]}),e.jsxs(fe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("button",{type:"button",className:"hidden aspect-square h-full w-full items-center justify-center p-1 transition disabled:opacity-40 sm:flex",disabled:D,onClick:()=>B(1),children:e.jsx(O,{name:"ArrowRight","aria-hidden":"true"})})}),e.jsx(me,{children:"Go forward"})]}),e.jsxs(fe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("button",{type:"button",className:"flex aspect-square h-full w-full items-center justify-center p-1 transition disabled:opacity-40",onClick:()=>{E(j),h(l+1),S({history:[j.pathname],index:0})},children:e.jsx(O,{name:"Refresh","aria-hidden":"true"})})}),e.jsx(me,{children:"Refresh"})]})]}),e.jsxs(cr,{method:"get",replace:!0,className:"flex flex-1 gap-2",onSubmit:()=>M(),children:[X,e.jsxs("div",{className:"flex flex-1 items-center border-x bg-background p-3 leading-none text-foreground",children:[e.jsx("a",{href:j.toString(),target:"_blank",rel:"noreferrer",children:A.host}),e.jsx("input",{"aria-label":"pathname",className:"w-full flex-1 bg-background focus-visible:outline-none",value:d,name:"pathname",onChange:N=>$(N.currentTarget.value)})]})]}),e.jsx(Qr,{name:s}),e.jsxs(fe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("a",{href:j.toString(),target:"_blank",rel:"noreferrer",className:re("flex aspect-square items-center justify-center px-3.5"),children:e.jsx(O,{name:"ExternalLink"})})}),e.jsx(me,{children:"Open in new tab"})]})]}),e.jsx("div",{className:"flex h-full w-full flex-grow dark:bg-white",children:e.jsx("iframe",{title:s,ref:T,src:A.toString(),className:"h-full w-full flex-grow bg-white"},c)})]})})}function Ne({id:t,appInfo:n,inBrowserBrowserRef:s}){const r=_e(),a=pr();if(!n)return e.jsx("p",{children:"No app here. Sorry."});const{isRunning:i,dev:o,name:u,portIsAvailable:l,title:h}=n;if(ENV.EPICSHOP_DEPLOYED&&n.stackBlitzUrl){const c=new URL(n.stackBlitzUrl);return c.searchParams.set("embed","1"),c.searchParams.set("theme",a),e.jsx(ln,{title:h,url:c.toString(),loadingContent:e.jsx(Me,{children:e.jsxs("span",{children:["Loading"," ",e.jsxs("a",{className:"underline",href:n.stackBlitzUrl,children:['"',h,'"']})]})})})}if(o.type==="script"){const c=Re({domain:r.domain,port:o.portNumber});return e.jsx(nn,{ref:s,isRunning:i,id:t??u,name:u,portIsAvailable:l,port:o.portNumber,baseUrl:c,initialRoute:o.initialRoute})}else return o.type==="browser"?e.jsxs("div",{className:"relative h-full flex-grow overflow-y-auto scrollbar-thin scrollbar-thumb-scrollbar",children:[e.jsxs("a",{href:o.pathname,target:"_blank",rel:"noreferrer",className:pe("absolute bottom-5 right-5 flex items-center justify-center rounded-full bg-gray-100 p-2.5 transition hover:bg-gray-200 dark:bg-gray-800 hover:dark:bg-gray-600"),children:[e.jsx(O,{name:"ExternalLink","aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:"Open in New Window"})]}),e.jsx("iframe",{title:h,src:o.pathname,className:"h-full w-full flex-grow bg-white"})]}):e.jsxs("p",{children:["Preview for dev type of ",e.jsx("code",{children:o.type})," not supported."]})}function ln({url:t,title:n,loadingContent:s}){const[r,a]=x.useState(!1);return e.jsxs("div",{className:"h-full w-full flex-grow",children:[r?null:e.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:s}),e.jsx("iframe",{onLoad:()=>a(!0),onError:()=>a(!0),src:t,className:pe("h-full w-full flex-grow transition-opacity duration-300",r?"opacity-100":"opacity-0"),title:n,sandbox:"allow-forms allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox"})]})}function cn({appInfo:t,inBrowserBrowserRef:n,problemAppName:s,allApps:r,isUpToDate:a}){return e.jsx(xt,{playgroundAppName:t==null?void 0:t.appName,problemAppName:s,allApps:r,isUpToDate:a,children:(t==null?void 0:t.dev.type)==="none"?e.jsxs("div",{children:[e.jsx("div",{className:"text-foreground-secondary flex h-full items-center justify-center text-2xl",children:"Non-UI playground"}),e.jsx("div",{children:e.jsxs("div",{className:"text-foreground-secondary flex flex-wrap gap-1 text-center",children:["Navigate to"," ",e.jsx(G,{content:t.fullPath,children:e.jsx("span",{className:"underline",onClick:()=>{navigator.clipboard.writeText(t.fullPath),mr.success("Copied playground path to clipboard")},children:"the playground directory"})})," ","in your editor and terminal to work on this exercise!"]})})]}):t?e.jsx(Ne,{id:t.appName,appInfo:t,inBrowserBrowserRef:n}):e.jsxs("div",{className:"flex flex-col justify-center gap-2",children:[e.jsx("p",{children:"Please set the playground first"}),s?e.jsx(Ae,{appName:s}):null]})})}function un({handleClick:t,cacheLocation:n,embeddedKey:s,appFullPath:r}){const a=K();return e.jsxs(a.Form,{action:"/update-mdx-cache",method:"POST",children:[Oe,e.jsx("input",{type:"hidden",name:"cacheLocation",value:n}),e.jsx("input",{type:"hidden",name:"embeddedKey",value:s}),e.jsx("input",{type:"hidden",name:"appFullPath",value:r}),e.jsx("button",{type:"submit",onClick:t,className:re("launch_button",a.state==="idle"?null:"cursor-progress"),children:"Cancel Warning"})]})}const vt=x.createContext(null);function dn(){const t=x.useContext(vt);if(!t)throw new Error("useStepContext must be used within a StepContext.Provider");return t}function fn({children:t,inBrowserBrowserRef:n}){return e.jsx(vt.Provider,{value:{inBrowserBrowserRef:n},children:t})}const hn={CodeFile:gn,CodeFileNotification:vn,DiffLink:Ue,PrevDiffLink:xn,NextDiffLink:pn,InlineFile:jn,LinkToApp:wn};function mn({inBrowserBrowserRef:t}){const n=W();return n.exerciseStepApp.instructionsCode?e.jsx(fn,{inBrowserBrowserRef:t,children:e.jsx(xr,{epicVideoInfosPromise:n.epicVideoInfosPromise,children:e.jsx("div",{className:"prose dark:prose-invert sm:prose-lg",children:e.jsx(or,{code:n.exerciseStepApp.instructionsCode,components:hn})})})}):null}function jt(t,n,s){const r=new URLSearchParams(t);return s===null?r.delete(n):r.set(n,s),r}function pn({app:t=0,fullPage:n=!1,children:s}){return e.jsx(Ue,{app1:t,app2:t+1,fullPage:n,children:s})}function xn({app:t=-1,fullPage:n=!1,children:s}){return e.jsx(Ue,{app1:t,app2:t+1,fullPage:n,children:s})}function Ue({app1:t=0,app2:n=1,children:s,fullPage:r=!1,to:a}){const i=W();if(!a&&!t&&!n)return e.jsx("callout-danger",{className:"notification",children:e.jsx("div",{className:"title",children:"DiffLink Error: invalid input"})});function o(c){var p;if(typeof c=="number"){const g=i.exerciseIndex+c;return(p=i.allApps[g])==null?void 0:p.name}if(!c)return null;for(const{name:g,stepName:y}of i.allApps)if(c===g||c===y)return g;return null}if(a){const c=new URLSearchParams(a);t=c.get("app1"),n=c.get("app2")}const u=o(t),l=o(n);if(!u||!l)return e.jsxs("callout-danger",{className:"notification",children:[e.jsx("div",{className:"title",children:"DiffLink Error: invalid input"}),!u&&e.jsxs("div",{children:['app1: "',t,'" is not a valid app name']}),!l&&e.jsxs("div",{children:['app2: "',n,'" is not a valid app name']})]});a||(a=`app1=${u}&app2=${l}`);const h=r?`/diff?${a}`:`?${decodeURIComponent(jt(new URLSearchParams,"preview",`diff&${a}`).toString())}`;return s||(s=e.jsxs("span",{children:["Go to Diff ",r?"":"Preview"," from: ",e.jsx("code",{children:u})," to:"," ",e.jsx("code",{children:l})]})),e.jsx(ae,{to:h,children:s})}function gn({file:t}){return e.jsxs("div",{className:"border-4 border-[#ff4545] bg-[#ff454519] p-4 text-lg",children:["Something went wrong compiling ",e.jsx("b",{children:"CodeFile"})," for file: ",e.jsx("u",{children:t})," to markdown"]})}function vn({file:t,type:n="problem",children:s,variant:r,cacheLocation:a,embeddedKey:i,...o}){const[u,l]=x.useState("visible"),c=W()[n],p=()=>{u==="visible"&&(l("collapse"),setTimeout(()=>{l("none")},400))},g=re("rounded px-4 py-1 font-mono text-sm font-semibold outline-none transition duration-300 ease-in-out",{"bg-amber-300/70 hover:bg-amber-300/40 active:bg-amber-300/50":r==="warning","bg-red-300/70 hover:bg-red-300/40 active:bg-red-300/50":r==="error"});return e.jsxs("div",{className:re("notification important h-15 relative",{"duration-400 !my-0 !h-0 !py-0 !opacity-0 transition-all ease-out":u!=="visible",hidden:u==="none"}),children:[e.jsxs("div",{className:"absolute right-3 top-3 z-50 flex gap-4",children:[c?e.jsx("div",{className:g,title:`Edit ${t}`,children:e.jsx(ce,{appFile:t,appName:c.name,...o,children:"Edit this File"})}):null,c&&r==="warning"?e.jsx("div",{className:g,title:`Remove the warning from here and from ${t} cache file`,children:e.jsx(un,{handleClick:p,cacheLocation:a,embeddedKey:i,appFullPath:c.fullPath})}):null]}),s]})}function jn({file:t,type:n="playground",children:s=e.jsx("code",{children:t}),...r}){const a=W(),i=a[n]||a[a.type],o=e.jsxs("div",{className:"launch-editor-button-wrapper flex underline underline-offset-4",children:[s," ",e.jsx("svg",{height:24,width:24,children:e.jsx("use",{href:"/icons.svg#keyboard"})})]});return ENV.EPICSHOP_DEPLOYED&&i?e.jsx("div",{className:"inline-block grow",children:e.jsx(ce,{appFile:t,appName:i.name,...r,children:o})}):i?e.jsx("div",{className:"inline-block grow",children:e.jsx(ce,{appFile:t,appName:i.name,...r,children:o})}):n==="playground"?e.jsx(G,{content:"You must 'Set to Playground' before opening a file",children:e.jsx("div",{className:"inline-block grow cursor-not-allowed",children:o})}):e.jsx(e.Fragment,{children:"children"})}function bn(t){return t==="problem"?"problem":t==="solution"?"solution":"playground"}function wn({to:t,children:n=e.jsx("code",{children:t.toString()}),...s}){var g;const[r]=Ie(),a=`?${jt(r,"pathname",t.toString()).toString()}`,i=W(),o=bn(r.get("preview")),u=_e(),l=i[o],h=(l==null?void 0:l.dev.type)==="script"?Re({domain:u.domain,port:l.dev.portNumber}):((g=i.playground)==null?void 0:g.dev.type)==="browser"?i.playground.dev.pathname:null,{inBrowserBrowserRef:c}=dn(),p=h?h.slice(0,-1)+t.toString():null;return e.jsxs("div",{className:"inline-flex items-center justify-between gap-1",children:[e.jsx(ae,{to:a,...s,className:pe(s.className,{"cursor-not-allowed":ENV.EPICSHOP_DEPLOYED}),title:ENV.EPICSHOP_DEPLOYED?"Cannot link to app in deployed version":void 0,onClick:y=>{var S,d;ENV.EPICSHOP_DEPLOYED&&y.preventDefault(),(S=s.onClick)==null||S.call(s,y),(d=c.current)==null||d.handleExtrnalNavigation(t.toString())},children:n}),p?e.jsx(G,{content:"Open in new tab",children:e.jsx("a",{href:p,target:"_blank",rel:"noreferrer",className:pe("flex aspect-square items-center justify-center",{"cursor-not-allowed":ENV.EPICSHOP_DEPLOYED}),title:ENV.EPICSHOP_DEPLOYED?"Cannot link to app in deployed version":"Open in new tab",onClick:y=>{ENV.EPICSHOP_DEPLOYED&&y.preventDefault()},children:e.jsx(O,{name:"ExternalLink"})})}):null]})}const yn=m.intersection(m.object({type:m.literal("epicshop:test-status-update"),timestamp:m.number()}),m.union([m.object({status:m.literal("pending")}),m.object({status:m.literal("pass")}),m.object({status:m.literal("fail"),error:m.string()})])),Nn=m.object({type:m.literal("epicshop:test-step-update"),status:m.literal("pass"),title:m.string(),timestamp:m.number()}),Sn=m.union([Nn,yn]);function Pn({pathname:t,testFile:n}){const s=x.useRef(null),[r,a]=x.useState(null),[i,o]=x.useState([]);x.useEffect(()=>{function c(p){var S;if(p.source!==((S=s.current)==null?void 0:S.contentWindow)||"request"in p.data)return;const g=Sn.safeParse(p.data,{path:["messageEvent","data"]});if(!g.success){console.error("Invalid message from test iframe",p.data,g.error);return}const{data:y}=g;y.type==="epicshop:test-status-update"&&(y.status==="pending"&&o([]),a(y)),y.type==="epicshop:test-step-update"&&o(d=>[...d,y])}return window.addEventListener("message",c),()=>{window.removeEventListener("message",c)}},[]);const u={pending:e.jsx(ke,{"aria-label":"Pending"}),pass:e.jsx(O,{name:"CheckSmall","aria-label":"Passed",className:"text-emerald-700"}),fail:e.jsx(O,{name:"Remove","aria-label":"Failed",className:"text-foreground-danger"}),unknown:e.jsx(O,{name:"Question","aria-label":"Unknown",className:"animate-pulse"})}[(r==null?void 0:r.status)??"unknown"],l=i.sort((c,p)=>c.timestamp-p.timestamp),h={pass:e.jsx(O,{name:"CheckSmall","aria-label":"Passed"}),fail:e.jsx(O,{name:"Remove","aria-label":"Failed"}),unknown:e.jsx(O,{name:"Question","aria-label":"Unknown",className:"animate-pulse"})};return e.jsx(e.Fragment,{children:e.jsx(tr,{className:"w-full",type:"multiple",children:e.jsx(rr,{icon:u,title:n,forceMount:!0,children:e.jsxs("div",{className:"not-prose",children:[e.jsxs("div",{className:"p-5 pt-3",children:[e.jsx("ul",{className:"",children:l.map(c=>e.jsx("li",{children:e.jsxs("div",{className:"flex items-baseline gap-2 text-emerald-700",children:[e.jsx("span",{children:h[c.status]}),e.jsx("pre",{className:"whitespace-pre-wrap",children:c.title})]})},c.timestamp+c.title))}),(r==null?void 0:r.status)==="fail"?e.jsxs("div",{className:"flex items-baseline gap-2 text-foreground-danger",children:[e.jsx("span",{children:h.fail}),e.jsx("pre",{className:"max-h-48 overflow-y-auto text-foreground-danger scrollbar-thin scrollbar-thumb-scrollbar",children:r.error})]}):null,e.jsx("iframe",{ref:s,title:n,src:t+n,className:"mt-5 min-h-[420px] w-full border bg-white"})]}),e.jsxs("div",{className:"flex border-y",children:[e.jsx("button",{onClick:()=>{var c,p;return(p=(c=s.current)==null?void 0:c.contentWindow)==null?void 0:p.location.reload()},className:"border-r p-3",children:e.jsx(O,{name:"Refresh","aria-label":"Rerun Tests"})}),e.jsx("a",{href:t+n,target:"_blank",rel:"noreferrer",className:"border-r p-3",children:e.jsx(O,{name:"ExternalLink","aria-label":"Open in New Window"})})]})]})})})})}const $n=m.union([m.object({type:m.literal("init"),exitCode:m.number().nullable().optional(),isRunning:m.boolean(),output:m.array(m.object({type:m.union([m.literal("stdout"),m.literal("stderr")]),html:m.string(),timestamp:m.number()}))}),m.object({type:m.union([m.literal("stdout"),m.literal("stderr")]),data:m.string(),timestamp:m.number()}),m.object({type:m.literal("exit"),isRunning:m.literal(!1),code:m.number().nullable()})]),Cn=m.array($n);function Tn(t,n){return n(t)}function En({name:t}){const[n,s]=x.useReducer(Tn,{version:0,isRunning:!1,exitCode:void 0,lines:[]}),{version:r,isRunning:a,exitCode:i,lines:o}=n,u=gr(`/test?${new URLSearchParams({name:t})}&v=${r}`);return x.useEffect(()=>{if(!u)return;const l=JSON.parse(u),h=Cn.safeParse(l);if(!h.success){console.error(h.error.flatten());return}for(const c of h.data)switch(c.type){case"exit":{const{isRunning:p,code:g}=c;s(y=>({...y,isRunning:p,exitCode:g}));break}case"init":{const{output:p,exitCode:g,isRunning:y}=c;s(S=>({...S,lines:p,exitCode:g,isRunning:y}));break}case"stderr":case"stdout":{const{type:p,data:g,timestamp:y}=c;s(S=>({...S,lines:[...S.lines,{type:p,html:g,timestamp:y}].sort((d,$)=>d.timestamp-$.timestamp),isRunning:!0}));break}}},[u]),e.jsxs("div",{className:"relative flex h-full w-full flex-col",children:[e.jsxs("div",{className:"flex h-12 w-full flex-shrink-0 items-center justify-between border-b",children:[e.jsxs("div",{className:"flex h-full items-center",children:[!a&&e.jsx(Dn,{name:t,onRun:()=>{s(l=>({...l,exitCode:void 0,lines:[],version:l.version+1}))}}),a?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex h-full flex-grow items-center justify-center border-r px-3.5",children:e.jsx(ke,{role:"status","aria-label":"Running Tests"})}),e.jsx(kn,{name:t})]}):null]}),!a&&i!==void 0&&e.jsx("p",{className:"pr-3.5 leading-none",children:i===0?"Tests passed":`Test failed (exit code ${String(i)})`}),!a&&i!==void 0&&e.jsx(Rn,{name:t,onClear:()=>{s(l=>({...l,exitCode:void 0,lines:[]}))}})]}),e.jsxs("div",{className:"flex h-full flex-col gap-5 p-5",children:[e.jsx("p",{className:"font-mono text-sm font-medium uppercase",children:"Test Output"}),e.jsx("pre",{className:"shadow-on-scrollbox flex-1 overflow-y-scroll scrollbar-thin scrollbar-thumb-scrollbar",children:o.map(l=>e.jsx("code",{"data-type":l.type,dangerouslySetInnerHTML:{__html:l.html}},l.timestamp))})]})]})}function Dn({name:t,onRun:n}){const s=K(),r=x.useRef(n);return x.useEffect(()=>{r.current=n},[n]),x.useEffect(()=>{var a,i;(a=s.data)!=null&&a.success&&((i=r.current)==null||i.call(r))},[s.data]),e.jsxs(s.Form,{method:"POST",action:"/test",className:"h-full",children:[e.jsx("input",{type:"hidden",name:"name",value:t}),e.jsx(G,{content:s.state==="idle"?"Run Tests":"Running Tests...",children:e.jsx("button",{type:"submit",name:"intent",value:"run",className:"flex h-full flex-grow items-center justify-center border-r px-3.5",children:s.state==="idle"?e.jsx(O,{name:"TriangleSmall"}):e.jsx(ke,{role:"status"})})})]})}function Rn({name:t,onClear:n}){const s=K(),r=x.useRef(n);return x.useEffect(()=>{r.current=n},[n]),x.useEffect(()=>{var a,i;(a=s.data)!=null&&a.success&&((i=r.current)==null||i.call(r))},[s.data]),e.jsxs(s.Form,{method:"POST",action:"/test",className:"h-full",children:[e.jsx("input",{type:"hidden",name:"name",value:t}),e.jsx(G,{content:s.state==="idle"?"Clear Tests":"Clearing Tests...",children:e.jsx("button",{type:"submit",name:"intent",value:"clear",className:"flex h-full flex-grow items-center justify-center border-l px-3.5",children:s.state==="idle"?e.jsx(O,{name:"Clear"}):e.jsx(O,{name:"Clear",className:"animate-pulse",role:"status"})})})]})}function kn({name:t,onStop:n}){const s=K(),r=x.useRef(n);return x.useEffect(()=>{r.current=n},[n]),x.useEffect(()=>{var a,i;(a=s.data)!=null&&a.success&&((i=r.current)==null||i.call(r))},[s.data]),e.jsxs(s.Form,{method:"POST",action:"/test",className:"h-full",children:[e.jsx("input",{type:"hidden",name:"name",value:t}),e.jsx(G,{content:s.state==="idle"?"Stop Tests":"Stopping Tests...",children:e.jsx("button",{type:"submit",name:"intent",value:"stop",className:"flex h-full flex-grow items-center justify-center border-r px-3.5",children:s.state==="idle"?e.jsx(O,{name:"Stop"}):e.jsx(O,{name:"Stop",className:"animate-pulse",role:"status"})})})]})}function On({appInfo:t,problemAppName:n,allApps:s,isUpToDate:r}){const[a,i]=x.useState(0);let o=e.jsx("p",{children:"No tests here. Sorry."});if((t==null?void 0:t.test.type)==="script"&&(o=e.jsx(En,{name:t.name})),(t==null?void 0:t.test.type)==="browser"){const{pathname:u}=t.test;o=e.jsxs("div",{className:"flex h-full w-full flex-grow flex-col",children:[t.test.testFiles.map(l=>e.jsx("div",{children:e.jsx(Pn,{pathname:u,testFile:l})},l)),e.jsx("div",{className:"px-3 py-[21px]",children:e.jsxs("button",{onClick:()=>i(l=>l+1),className:"flex items-center gap-2 font-mono text-sm uppercase leading-none",children:[e.jsx(O,{name:"Refresh","aria-hidden":!0})," Rerun All Tests"]})})]},a)}return e.jsx(xt,{playgroundAppName:t==null?void 0:t.appName,problemAppName:n,allApps:s,isUpToDate:r,children:o})}var He="Popover",[bt,ws]=Pe(He,[Ve]),ue=Ve(),[In,Q]=bt(He),wt=t=>{const{__scopePopover:n,children:s,open:r,defaultOpen:a,onOpenChange:i,modal:o=!1}=t,u=ue(n),l=x.useRef(null),[h,c]=x.useState(!1),[p=!1,g]=Ce({prop:r,defaultProp:a,onChange:i});return e.jsx(At,{...u,children:e.jsx(In,{scope:n,contentId:Te(),triggerRef:l,open:p,onOpenChange:g,onOpenToggle:x.useCallback(()=>g(y=>!y),[g]),hasCustomAnchor:h,onCustomAnchorAdd:x.useCallback(()=>c(!0),[]),onCustomAnchorRemove:x.useCallback(()=>c(!1),[]),modal:o,children:s})})};wt.displayName=He;var yt="PopoverAnchor",Mn=x.forwardRef((t,n)=>{const{__scopePopover:s,...r}=t,a=Q(yt,s),i=ue(s),{onCustomAnchorAdd:o,onCustomAnchorRemove:u}=a;return x.useEffect(()=>(o(),()=>u()),[o,u]),e.jsx(Ge,{...i,...r,ref:n})});Mn.displayName=yt;var Nt="PopoverTrigger",St=x.forwardRef((t,n)=>{const{__scopePopover:s,...r}=t,a=Q(Nt,s),i=ue(s),o=$e(n,a.triggerRef),u=e.jsx(J.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Et(a.open),...r,ref:o,onClick:z(t.onClick,a.onOpenToggle)});return a.hasCustomAnchor?u:e.jsx(Ge,{asChild:!0,...i,children:u})});St.displayName=Nt;var Be="PopoverPortal",[_n,Fn]=bt(Be,{forceMount:void 0}),Pt=t=>{const{__scopePopover:n,forceMount:s,children:r,container:a}=t,i=Q(Be,n);return e.jsx(_n,{scope:n,forceMount:s,children:e.jsx(Ee,{present:s||i.open,children:e.jsx(yr,{asChild:!0,container:a,children:r})})})};Pt.displayName=Be;var oe="PopoverContent",$t=x.forwardRef((t,n)=>{const s=Fn(oe,t.__scopePopover),{forceMount:r=s.forceMount,...a}=t,i=Q(oe,t.__scopePopover);return e.jsx(Ee,{present:r||i.open,children:i.modal?e.jsx(Ln,{...a,ref:n}):e.jsx(An,{...a,ref:n})})});$t.displayName=oe;var Ln=x.forwardRef((t,n)=>{const s=Q(oe,t.__scopePopover),r=x.useRef(null),a=$e(n,r),i=x.useRef(!1);return x.useEffect(()=>{const o=r.current;if(o)return vr(o)},[]),e.jsx(jr,{as:Mt,allowPinchZoom:!0,children:e.jsx(Ct,{...t,ref:a,trapFocus:s.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:z(t.onCloseAutoFocus,o=>{var u;o.preventDefault(),i.current||(u=s.triggerRef.current)==null||u.focus()}),onPointerDownOutside:z(t.onPointerDownOutside,o=>{const u=o.detail.originalEvent,l=u.button===0&&u.ctrlKey===!0,h=u.button===2||l;i.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:z(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),An=x.forwardRef((t,n)=>{const s=Q(oe,t.__scopePopover),r=x.useRef(!1),a=x.useRef(!1);return e.jsx(Ct,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,u;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(u=s.triggerRef.current)==null||u.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{var l,h;(l=t.onInteractOutside)==null||l.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((h=s.triggerRef.current)==null?void 0:h.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),Ct=x.forwardRef((t,n)=>{const{__scopePopover:s,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:h,onInteractOutside:c,...p}=t,g=Q(oe,s),y=ue(s);return br(),e.jsx(wr,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:e.jsx(_t,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:c,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:h,onDismiss:()=>g.onOpenChange(!1),children:e.jsx(Ft,{"data-state":Et(g.open),role:"dialog",id:g.contentId,...y,...p,ref:n,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Tt="PopoverClose",Un=x.forwardRef((t,n)=>{const{__scopePopover:s,...r}=t,a=Q(Tt,s);return e.jsx(J.button,{type:"button",...r,ref:n,onClick:z(t.onClick,()=>a.onOpenChange(!1))})});Un.displayName=Tt;var Hn="PopoverArrow",Bn=x.forwardRef((t,n)=>{const{__scopePopover:s,...r}=t,a=ue(s);return e.jsx(Lt,{...a,...r,ref:n})});Bn.displayName=Hn;function Et(t){return t?"open":"closed"}var Yn=wt,zn=St,Vn=Pt,Gn=$t;function Kn(){var o,u;const t=W(),[n,s]=x.useState(!1),r=x.useRef(null);function a(){s(!1)}const i=(o=t.playground)==null?void 0:o.appName;return e.jsx(e.Fragment,{children:e.jsxs(Yn,{open:n,onOpenChange:s,children:[e.jsx(zn,{asChild:!0,children:e.jsxs("button",{className:"flex h-full items-center gap-1 border-r px-6 py-3 font-mono text-sm uppercase","aria-label":"Relevant Files",children:[e.jsx(O,{name:"Files"}),"Files"]})}),e.jsx(Vn,{children:e.jsx(Gn,{ref:r,className:"slideRightContent lg:slideUpContent invert-theme z-10 select-none rounded bg-background px-9 py-8 text-foreground",align:"start",sideOffset:5,children:e.jsxs("div",{className:"launch-editor-wrapper",children:[e.jsx("strong",{className:"inline-block px-2 pb-4 font-semibold uppercase",children:"Relevant Files"}),t.problem&&((u=t.playground)==null?void 0:u.appName)!==t.problem.name?e.jsx("div",{className:"mb-2 rounded p-1 font-mono font-medium",children:e.jsx(Ae,{appName:t.problem.name})}):null,e.jsx("div",{id:"files",children:e.jsx(x.Suspense,{fallback:e.jsx(G,{content:"Loading diff",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(O,{name:"Refresh",className:"h-8 w-8 animate-spin"})})}),children:e.jsx(We,{resolve:t.diff,errorElement:e.jsx("div",{className:"text-foreground-danger",children:"Something went wrong."}),children:({diffFiles:l})=>{if(!l)return e.jsx("p",{className:"text-foreground-danger",children:"Unable to determine diff"});if(typeof l=="string")return e.jsx("p",{className:"text-foreground-danger",children:l});if(!l.length)return e.jsx("p",{children:"No files changed"});const h=i||ENV.EPICSHOP_GITHUB_ROOT?{}:{title:"You must 'Set to Playground' before opening a file",className:"not-allowed"};return e.jsxs("ul",{...h,children:[l.length>1&&!ENV.EPICSHOP_DEPLOYED?e.jsx("div",{className:"mb-2 border-b border-b-gray-50 border-opacity-50 pb-2 font-sans",children:e.jsx(ce,{appFile:l.map(c=>`${c.path},${c.line},1`),appName:"playground",onUpdate:a,children:e.jsx("p",{children:"Open All Files"})})}):null,l.map(c=>{var p;return e.jsx("li",{"data-state":c.status,children:e.jsx(ce,{appFile:`${c.path},${c.line},1`,appName:ENV.EPICSHOP_DEPLOYED?((p=t.problem)==null?void 0:p.name)??"playground":"playground",onUpdate:a,children:e.jsx("code",{children:c.path})})},c.path)})]})}})})})]})})})]})})}function Dt(t,n){var o;const s=(t==null?void 0:t.exerciseStepApp.exerciseNumber.toString().padStart(2,"0"))??"00",r=(t==null?void 0:t.exerciseStepApp.stepNumber.toString().padStart(2,"0"))??"00",a={problem:"💪",solution:"🏁"}[(t==null?void 0:t.type)??"problem"],i=((o=t==null?void 0:t[t.type])==null?void 0:o.title)??"N/A";return{emoji:a,stepNumber:r,title:i,exerciseNumber:s,exerciseTitle:(t==null?void 0:t.exerciseTitle)??"Unknown exercise",workshopTitle:n,type:(t==null?void 0:t.type)??"problem"}}const ys=({data:t,matches:n,params:s})=>{var h;const r=(h=n.find(c=>c.id==="root"))==null?void 0:h.data;if(!t||!r)return[{title:"🦉 | Error"}];const{emoji:a,stepNumber:i,title:o,exerciseNumber:u,exerciseTitle:l}=Dt(t);return ur({title:`${a} | ${i}. ${o} | ${u}. ${l} | ${r.workshopTitle}`,description:`${s.type} step for exercise ${u}. ${l}`,ogTitle:o,ogDescription:`${l} step ${Number(i)} ${s.type}`,instructor:r.instructor,requestInfo:r.requestInfo})},Se=["playground","problem","solution","tests","diff","chat"],Wn=t=>!!(t&&Se.includes(t));function qn(t,n,s){const r=new URLSearchParams(t);return s===null?r.delete(n):r.set(n,s),r}function Ns(){var p,g,y,S,d,$,T;const t=W(),[n]=Ie(),s=n.get("preview"),r=x.useRef(null),a=Dt(t),i=De(),o=Rt();function u(j){var R,A,E;if(j==="tests")return ENV.EPICSHOP_DEPLOYED||!t.playground||t.playground.test.type==="none";if(j==="problem"||j==="solution"){if(((R=t[j])==null?void 0:R.dev.type)==="none")return!0;if(ENV.EPICSHOP_DEPLOYED)return((A=t[j])==null?void 0:A.dev.type)!=="browser"&&!((E=t[j])!=null&&E.stackBlitzUrl)}return!!(j==="playground"&&ENV.EPICSHOP_DEPLOYED)}const l=Wn(s)?s:Se.find(j=>!u(j)),h=`/diff?${new URLSearchParams({app1:((p=t.problem)==null?void 0:p.name)??"",app2:((g=t.solution)==null?void 0:g.name)??""})}`;function c(j){j.altKey&&!j.ctrlKey&&!j.shiftKey&&!j.metaKey&&(j.preventDefault(),o(h))}return e.jsx("div",{className:"flex max-w-full flex-grow flex-col",children:e.jsxs("main",{className:"flex flex-grow flex-col sm:grid sm:h-full sm:min-h-[800px] sm:grid-cols-1 sm:grid-rows-2 md:min-h-[unset] lg:grid-cols-2 lg:grid-rows-1",children:[e.jsxs("div",{className:"relative flex flex-col sm:col-span-1 sm:row-span-1 sm:h-full lg:border-r",children:[e.jsx("h1",{className:"h-14 border-b pl-10 pr-5 text-sm font-medium leading-tight",children:e.jsxs("div",{className:"flex h-14 flex-wrap items-center justify-between gap-x-2 py-2",children:[e.jsxs("div",{className:"flex items-center justify-start gap-x-2 uppercase",children:[e.jsxs(ae,{to:`/${a.exerciseNumber}`,className:"hover:underline",children:[a.exerciseNumber,". ",a.exerciseTitle]}),"/",e.jsxs(ae,{to:".",className:"hover:underline",children:[a.stepNumber,". ",a.title," (",a.emoji," ",a.type,")"]})]}),t.problem&&((y=t.playground)==null?void 0:y.appName)!==t.problem.name?e.jsx("div",{className:"hidden md:block",children:e.jsx(Ae,{appName:t.problem.name})}):null]})}),e.jsx("article",{id:t.articleId,className:"shadow-on-scrollbox h-full w-full max-w-none flex-1 scroll-pt-6 space-y-6 overflow-y-auto p-2 scrollbar-thin scrollbar-thumb-scrollbar sm:p-10 sm:pt-8",children:t.exerciseStepApp.instructionsCode?e.jsx(mn,{inBrowserBrowserRef:r}):e.jsx("p",{children:"No instructions yet..."})},t.articleId),e.jsx(kt,{elementQuery:`#${t.articleId}`},`scroll-${t.articleId}`),t.type==="solution"?e.jsx(lr,{type:"step",exerciseNumber:t.exerciseStepApp.exerciseNumber,stepNumber:t.exerciseStepApp.stepNumber,className:"h-14 border-t px-6"}):null,e.jsxs("div",{className:"flex h-16 justify-between border-b-4 border-t lg:border-b-0",children:[e.jsx("div",{children:e.jsx("div",{className:"h-full",children:e.jsx(Kn,{})})}),e.jsx(ir,{appName:t.exerciseStepApp.name,relativePath:t.exerciseStepApp.relativePath}),e.jsx(ar,{prev:t.prevStepLink?{to:t.prevStepLink.to,"aria-label":"Previous Step"}:null,next:t.nextStepLink?{to:t.nextStepLink.to,"aria-label":"Next Step"}:null})]})]}),e.jsxs(Fr,{className:"relative flex flex-col overflow-y-auto sm:col-span-1 sm:row-span-1",value:l,children:[e.jsx(Lr,{className:"h-14 min-h-14 overflow-x-hidden border-b scrollbar-thin scrollbar-thumb-scrollbar",children:Se.map(j=>{const R=u(j);return e.jsx(Ar,{value:j,hidden:R,asChild:!0,children:e.jsx(ae,{id:`${j}-tab`,className:re("clip-path-button relative h-full px-6 py-4 font-mono text-sm uppercase outline-none radix-state-active:z-10 radix-state-active:bg-foreground radix-state-active:text-background radix-state-active:hover:bg-foreground/80 radix-state-active:hover:text-background/80 radix-state-inactive:hover:bg-foreground/20 radix-state-inactive:hover:text-foreground/80 focus:bg-foreground/80 focus:text-background/80",R?"hidden":"inline-block"),preventScrollReset:!0,prefetch:"intent",onClick:c,to:j==="diff"&&i?h:`?${qn(n,"preview",j==="playground"?null:j)}`,children:j})},j)})}),e.jsxs("div",{className:"relative z-10 flex min-h-96 flex-grow flex-col overflow-y-auto",children:[e.jsx(se,{value:"playground",className:"flex w-full flex-grow items-center justify-center self-start radix-state-inactive:hidden",children:e.jsx(cn,{appInfo:t.playground,problemAppName:(S=t.problem)==null?void 0:S.name,inBrowserBrowserRef:r,allApps:t.allApps,isUpToDate:((d=t.playground)==null?void 0:d.isUpToDate)??!1})}),e.jsx(se,{value:"problem",className:"flex w-full flex-grow items-center justify-center self-start radix-state-inactive:hidden",children:e.jsx(Ne,{appInfo:t.problem,inBrowserBrowserRef:r})}),e.jsx(se,{value:"solution",className:"flex w-full flex-grow items-center justify-center self-start radix-state-inactive:hidden",children:e.jsx(Ne,{appInfo:t.solution,inBrowserBrowserRef:r})}),e.jsx(se,{value:"tests",className:"flex w-full flex-grow items-start justify-center self-start overflow-hidden radix-state-inactive:hidden",children:e.jsx(On,{appInfo:t.playground,problemAppName:($=t.problem)==null?void 0:$.name,allApps:t.allApps,isUpToDate:((T=t.playground)==null?void 0:T.isUpToDate)??!1})}),e.jsx(se,{value:"diff",className:"flex h-full w-full flex-grow items-start justify-center self-start radix-state-inactive:hidden",children:e.jsx(nr,{diff:t.diff,allApps:t.allApps})}),e.jsx(se,{value:"chat",className:"flex h-full w-full flex-grow items-start justify-center self-start radix-state-inactive:hidden",children:e.jsx(qr,{})})]})]})]})})}function Ss(){return e.jsx(sr,{statusHandlers:{404:()=>e.jsx("p",{children:"Sorry, we couldn't find an app here."})}})}export{Ss as ErrorBoundary,Ns as default,ys as meta};
|
|
2
|
-
//# sourceMappingURL=_layout-
|
|
1
|
+
import{r as x,j as e,n as xe,k as ge,d as Rt}from"./index-Czg1ruVn.js";import{E as kt}from"./index-D6ukHE4T.js";import{c as Pe,u as $e,f as Ce,n as Ot,P as J,a as z,g as Te,b as Ee,S as G,T as It,h as fe,i as he,j as me,l as Ve,A as Ge,d as Mt,D as _t,C as Ft,m as Lt,R as At}from"./tooltip-BtzSIxlB.js";import{c as Ut,u as Ke,R as Ht,T as Bt,V as Yt,I as zt,P as Vt,C as Gt,S as Kt,a as Wt,G as qt,L as Zt,b as Jt,d as Qt,e as Xt,f as er,g as tr,A as rr,D as nr}from"./diff-CpG96hGZ.js";import{c as re}from"./clsx-B-dksMZM.js";import{G as sr}from"./error-boundary-BVTbN8PZ.js";import{N as ar}from"./nav-chevrons-DaXg0NPS.js";import{M as or,L as ce,E as ir}from"./mdx-BENF-kTQ.js";import{P as lr}from"./progress-BwanvUpB.js";import{I as O,u as De,a as Re,c as pe,b as ke}from"./misc-S5ZD98sI.js";import{s as Oe}from"./progress-bar-wMXWRGq0.js";import{a as K,u as W,A as We,L as ae,b as Ie,F as cr}from"./components-wgHiPsTg.js";import{g as ur}from"./seo-pBpFCWsy.js";import{L as Me}from"./loading-B0uKxERz.js";import{u as dr}from"./client-hints-DLYDs4RF.js";import{D as fr,u as hr}from"./discord-yZor-3t1.js";import{J as mr}from"./index-DjzedX4O.js";import{z as m,u as _e}from"./request-info-DHtGM4FI.js";import{B as qe}from"./button-BA3iiLRs.js";import{u as pr}from"./index-yEAxvbDV.js";import{E as xr}from"./epic-video-DJN9_SUj.js";import{u as gr}from"./use-event-source-ySol3hbz.js";import{h as vr,R as jr,u as br,F as wr,P as yr}from"./index-C6ToujzV.js";import"./user-CdUDQ7a8.js";var be="rovingFocusGroup.onEntryFocus",Nr={bubbles:!1,cancelable:!0},ve="RovingFocusGroup",[we,Ze,Sr]=Ut(ve),[Pr,Je]=Pe(ve,[Sr]),[$r,Cr]=Pr(ve),Qe=x.forwardRef((t,n)=>e.jsx(we.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(we.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(Tr,{...t,ref:n})})}));Qe.displayName=ve;var Tr=x.forwardRef((t,n)=>{const{__scopeRovingFocusGroup:s,orientation:r,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:l,onEntryFocus:h,preventScrollOnEntryFocus:c=!1,...p}=t,g=x.useRef(null),y=$e(n,g),S=Ke(i),[d=null,$]=Ce({prop:o,defaultProp:u,onChange:l}),[T,j]=x.useState(!1),R=Ot(h),A=Ze(s),E=x.useRef(!1),[F,U]=x.useState(0);return x.useEffect(()=>{const k=g.current;if(k)return k.addEventListener(be,R),()=>k.removeEventListener(be,R)},[R]),e.jsx($r,{scope:s,orientation:r,dir:S,loop:a,currentTabStopId:d,onItemFocus:x.useCallback(k=>$(k),[$]),onItemShiftTab:x.useCallback(()=>j(!0),[]),onFocusableItemAdd:x.useCallback(()=>U(k=>k+1),[]),onFocusableItemRemove:x.useCallback(()=>U(k=>k-1),[]),children:e.jsx(J.div,{tabIndex:T||F===0?-1:0,"data-orientation":r,...p,ref:y,style:{outline:"none",...t.style},onMouseDown:z(t.onMouseDown,()=>{E.current=!0}),onFocus:z(t.onFocus,k=>{const B=!E.current;if(k.target===k.currentTarget&&B&&!T){const M=new CustomEvent(be,Nr);if(k.currentTarget.dispatchEvent(M),!M.defaultPrevented){const D=A().filter(f=>f.focusable),q=D.find(f=>f.active),X=D.find(f=>f.id===d),v=[q,X,...D].filter(Boolean).map(f=>f.ref.current);tt(v,c)}}E.current=!1}),onBlur:z(t.onBlur,()=>j(!1))})})}),Xe="RovingFocusGroupItem",et=x.forwardRef((t,n)=>{const{__scopeRovingFocusGroup:s,focusable:r=!0,active:a=!1,tabStopId:i,...o}=t,u=Te(),l=i||u,h=Cr(Xe,s),c=h.currentTabStopId===l,p=Ze(s),{onFocusableItemAdd:g,onFocusableItemRemove:y}=h;return x.useEffect(()=>{if(r)return g(),()=>y()},[r,g,y]),e.jsx(we.ItemSlot,{scope:s,id:l,focusable:r,active:a,children:e.jsx(J.span,{tabIndex:c?0:-1,"data-orientation":h.orientation,...o,ref:n,onMouseDown:z(t.onMouseDown,S=>{r?h.onItemFocus(l):S.preventDefault()}),onFocus:z(t.onFocus,()=>h.onItemFocus(l)),onKeyDown:z(t.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){h.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const d=Rr(S,h.orientation,h.dir);if(d!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let T=p().filter(j=>j.focusable).map(j=>j.ref.current);if(d==="last")T.reverse();else if(d==="prev"||d==="next"){d==="prev"&&T.reverse();const j=T.indexOf(S.currentTarget);T=h.loop?kr(T,j+1):T.slice(j+1)}setTimeout(()=>tt(T))}})})})});et.displayName=Xe;var Er={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Dr(t,n){return n!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Rr(t,n,s){const r=Dr(t.key,s);if(!(n==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(n==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Er[r]}function tt(t,n=!1){const s=document.activeElement;for(const r of t)if(r===s||(r.focus({preventScroll:n}),document.activeElement!==s))return}function kr(t,n){return t.map((s,r)=>t[(n+r)%t.length])}var Or=Qe,Ir=et,Fe="Tabs",[Mr,bs]=Pe(Fe,[Je]),rt=Je(),[_r,Le]=Mr(Fe),nt=x.forwardRef((t,n)=>{const{__scopeTabs:s,value:r,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:u,activationMode:l="automatic",...h}=t,c=Ke(u),[p,g]=Ce({prop:r,onChange:a,defaultProp:i});return e.jsx(_r,{scope:s,baseId:Te(),value:p,onValueChange:g,orientation:o,dir:c,activationMode:l,children:e.jsx(J.div,{dir:c,"data-orientation":o,...h,ref:n})})});nt.displayName=Fe;var st="TabsList",at=x.forwardRef((t,n)=>{const{__scopeTabs:s,loop:r=!0,...a}=t,i=Le(st,s),o=rt(s);return e.jsx(Or,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:e.jsx(J.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:n})})});at.displayName=st;var ot="TabsTrigger",it=x.forwardRef((t,n)=>{const{__scopeTabs:s,value:r,disabled:a=!1,...i}=t,o=Le(ot,s),u=rt(s),l=ut(o.baseId,r),h=dt(o.baseId,r),c=r===o.value;return e.jsx(Ir,{asChild:!0,...u,focusable:!a,active:c,children:e.jsx(J.button,{type:"button",role:"tab","aria-selected":c,"aria-controls":h,"data-state":c?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:l,...i,ref:n,onMouseDown:z(t.onMouseDown,p=>{!a&&p.button===0&&p.ctrlKey===!1?o.onValueChange(r):p.preventDefault()}),onKeyDown:z(t.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&o.onValueChange(r)}),onFocus:z(t.onFocus,()=>{const p=o.activationMode!=="manual";!c&&!a&&p&&o.onValueChange(r)})})})});it.displayName=ot;var lt="TabsContent",ct=x.forwardRef((t,n)=>{const{__scopeTabs:s,value:r,forceMount:a,children:i,...o}=t,u=Le(lt,s),l=ut(u.baseId,r),h=dt(u.baseId,r),c=r===u.value,p=x.useRef(c);return x.useEffect(()=>{const g=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(g)},[]),e.jsx(Ee,{present:a||c,children:({present:g})=>e.jsx(J.div,{"data-state":c?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":l,hidden:!g,id:h,tabIndex:0,...o,ref:n,style:{...t.style,animationDuration:p.current?"0s":void 0},children:g&&i})})});ct.displayName=lt;function ut(t,n){return`${t}-trigger-${n}`}function dt(t,n){return`${t}-content-${n}`}var Fr=nt,Lr=at,Ar=it,se=ct;function ye({appName:t,reset:n=!1,tooltipText:s,...r}){var o;const a=K(),i=e.jsx("button",{type:"submit",...r,className:re(r.className,a.state!=="idle"?"cursor-progress":null,((o=a.data)==null?void 0:o.status)==="error"?"cursor-not-allowed":null)});return e.jsxs(a.Form,{action:"/set-playground",method:"POST",className:"inline-flex items-center justify-center",children:[e.jsx("input",{type:"hidden",name:"appName",value:t}),n?e.jsx("input",{type:"hidden",name:"reset",value:"true"}):null,Oe,s?e.jsx(G,{content:s,children:i}):i]})}function Ur({playgroundAppName:t,allApps:n}){var r;const s=K();return e.jsxs(Ht,{name:"appName",value:t,onValueChange:a=>{s.submit({appName:a},{method:"POST",action:"/set-playground"})},children:[e.jsxs(Bt,{"aria-label":"Select app for playground",className:re("flex h-full w-full items-center justify-between text-left radix-placeholder:text-gray-500 focus-visible:outline-none",s.state!=="idle"?"cursor-progress":null,((r=s.data)==null?void 0:r.status)==="error"?"cursor-not-allowed":null),children:[e.jsx("span",{className:"w-80 flex-1 overflow-hidden text-ellipsis whitespace-nowrap scrollbar-thin scrollbar-thumb-scrollbar",children:e.jsx(Yt,{placeholder:"Select current app",className:"inline-block w-40 text-ellipsis"})}),e.jsx(zt,{children:e.jsx(O,{name:"TriangleDownSmall"})})]}),e.jsx(Vt,{children:e.jsxs(Gt,{position:"popper",align:"start",className:"z-20 max-h-[50vh] bg-black text-white lg:max-h-[70vh]",children:[e.jsx(Kt,{className:"flex h-5 cursor-default items-center justify-center ",children:e.jsx(O,{name:"ChevronUp"})}),e.jsx(Wt,{className:"p-3",children:e.jsxs(qt,{children:[e.jsx(Zt,{className:"px-5 pb-3 font-mono uppercase",children:"App"}),n.filter(a=>a.name!=="playground").map(a=>e.jsx(Hr,{value:a.name,children:a.displayName},a.name))]})}),e.jsx(Jt,{className:"flex h-5 cursor-default items-center justify-center ",children:e.jsx(O,{name:"ChevronDown"})})]})})]})}function Hr({value:t,children:n}){return e.jsxs(Qt,{value:t,className:"relative flex cursor-pointer select-none items-center rounded px-10 py-2 leading-none opacity-80 radix-disabled:text-red-500 radix-highlighted:opacity-100 radix-highlighted:outline-none radix-state-checked:opacity-100",children:[e.jsx(Xt,{children:n}),e.jsx(er,{className:"absolute left-0 inline-flex w-[25px] items-center justify-center",children:e.jsx(O,{name:"CheckSmall"})})]})}function Ae({appName:t}){return ENV.EPICSHOP_DEPLOYED?null:e.jsx(ye,{appName:t,tooltipText:"Playground is not set to the right app. Click to set Playground.",children:e.jsxs("span",{className:"flex items-center justify-center gap-1 text-foreground-danger hover:underline",children:[e.jsx(O,{name:"Unlinked",className:"animate-ping"})," ",e.jsx("span",{className:"uppercase",children:"Set to Playground"})]})})}var ft={exports:{}};(function(t,n){(function(s,r){t.exports=r()})(ge,function(){var s=1e3,r=6e4,a=36e5,i="millisecond",o="second",u="minute",l="hour",h="day",c="week",p="month",g="quarter",y="year",S="date",d="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,T=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,j={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var v=["th","st","nd","rd"],f=N%100;return"["+N+(v[(f-20)%10]||v[f]||v[0])+"]"}},R=function(N,v,f){var P=String(N);return!P||P.length>=v?N:""+Array(v+1-P.length).join(f)+N},A={s:R,z:function(N){var v=-N.utcOffset(),f=Math.abs(v),P=Math.floor(f/60),b=f%60;return(v<=0?"+":"-")+R(P,2,"0")+":"+R(b,2,"0")},m:function N(v,f){if(v.date()<f.date())return-N(f,v);var P=12*(f.year()-v.year())+(f.month()-v.month()),b=v.clone().add(P,p),C=f-b<0,w=v.clone().add(P+(C?-1:1),p);return+(-(P+(f-b)/(C?b-w:w-b))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:p,y,w:c,d:h,D:S,h:l,m:u,s:o,ms:i,Q:g}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},E="en",F={};F[E]=j;var U="$isDayjsObject",k=function(N){return N instanceof q||!(!N||!N[U])},B=function N(v,f,P){var b;if(!v)return E;if(typeof v=="string"){var C=v.toLowerCase();F[C]&&(b=C),f&&(F[C]=f,b=C);var w=v.split("-");if(!b&&w.length>1)return N(w[0])}else{var I=v.name;F[I]=v,b=I}return!P&&b&&(E=b),b||!P&&E},M=function(N,v){if(k(N))return N.clone();var f=typeof v=="object"?v:{};return f.date=N,f.args=arguments,new q(f)},D=A;D.l=B,D.i=k,D.w=function(N,v){return M(N,{locale:v.$L,utc:v.$u,x:v.$x,$offset:v.$offset})};var q=function(){function N(f){this.$L=B(f.locale,null,!0),this.parse(f),this.$x=this.$x||f.x||{},this[U]=!0}var v=N.prototype;return v.parse=function(f){this.$d=function(P){var b=P.date,C=P.utc;if(b===null)return new Date(NaN);if(D.u(b))return new Date;if(b instanceof Date)return new Date(b);if(typeof b=="string"&&!/Z$/i.test(b)){var w=b.match($);if(w){var I=w[2]-1||0,L=(w[7]||"0").substring(0,3);return C?new Date(Date.UTC(w[1],I,w[3]||1,w[4]||0,w[5]||0,w[6]||0,L)):new Date(w[1],I,w[3]||1,w[4]||0,w[5]||0,w[6]||0,L)}}return new Date(b)}(f),this.init()},v.init=function(){var f=this.$d;this.$y=f.getFullYear(),this.$M=f.getMonth(),this.$D=f.getDate(),this.$W=f.getDay(),this.$H=f.getHours(),this.$m=f.getMinutes(),this.$s=f.getSeconds(),this.$ms=f.getMilliseconds()},v.$utils=function(){return D},v.isValid=function(){return this.$d.toString()!==d},v.isSame=function(f,P){var b=M(f);return this.startOf(P)<=b&&b<=this.endOf(P)},v.isAfter=function(f,P){return M(f)<this.startOf(P)},v.isBefore=function(f,P){return this.endOf(P)<M(f)},v.$g=function(f,P,b){return D.u(f)?this[P]:this.set(b,f)},v.unix=function(){return Math.floor(this.valueOf()/1e3)},v.valueOf=function(){return this.$d.getTime()},v.startOf=function(f,P){var b=this,C=!!D.u(P)||P,w=D.p(f),I=function(te,Y){var Z=D.w(b.$u?Date.UTC(b.$y,Y,te):new Date(b.$y,Y,te),b);return C?Z:Z.endOf(h)},L=function(te,Y){return D.w(b.toDate()[te].apply(b.toDate("s"),(C?[0,0,0,0]:[23,59,59,999]).slice(Y)),b)},_=this.$W,H=this.$M,V=this.$D,ne="set"+(this.$u?"UTC":"");switch(w){case y:return C?I(1,0):I(31,11);case p:return C?I(1,H):I(0,H+1);case c:var ee=this.$locale().weekStart||0,ie=(_<ee?_+7:_)-ee;return I(C?V-ie:V+(6-ie),H);case h:case S:return L(ne+"Hours",0);case l:return L(ne+"Minutes",1);case u:return L(ne+"Seconds",2);case o:return L(ne+"Milliseconds",3);default:return this.clone()}},v.endOf=function(f){return this.startOf(f,!1)},v.$set=function(f,P){var b,C=D.p(f),w="set"+(this.$u?"UTC":""),I=(b={},b[h]=w+"Date",b[S]=w+"Date",b[p]=w+"Month",b[y]=w+"FullYear",b[l]=w+"Hours",b[u]=w+"Minutes",b[o]=w+"Seconds",b[i]=w+"Milliseconds",b)[C],L=C===h?this.$D+(P-this.$W):P;if(C===p||C===y){var _=this.clone().set(S,1);_.$d[I](L),_.init(),this.$d=_.set(S,Math.min(this.$D,_.daysInMonth())).$d}else I&&this.$d[I](L);return this.init(),this},v.set=function(f,P){return this.clone().$set(f,P)},v.get=function(f){return this[D.p(f)]()},v.add=function(f,P){var b,C=this;f=Number(f);var w=D.p(P),I=function(H){var V=M(C);return D.w(V.date(V.date()+Math.round(H*f)),C)};if(w===p)return this.set(p,this.$M+f);if(w===y)return this.set(y,this.$y+f);if(w===h)return I(1);if(w===c)return I(7);var L=(b={},b[u]=r,b[l]=a,b[o]=s,b)[w]||1,_=this.$d.getTime()+f*L;return D.w(_,this)},v.subtract=function(f,P){return this.add(-1*f,P)},v.format=function(f){var P=this,b=this.$locale();if(!this.isValid())return b.invalidDate||d;var C=f||"YYYY-MM-DDTHH:mm:ssZ",w=D.z(this),I=this.$H,L=this.$m,_=this.$M,H=b.weekdays,V=b.months,ne=b.meridiem,ee=function(Y,Z,le,de){return Y&&(Y[Z]||Y(P,C))||le[Z].slice(0,de)},ie=function(Y){return D.s(I%12||12,Y,"0")},te=ne||function(Y,Z,le){var de=Y<12?"AM":"PM";return le?de.toLowerCase():de};return C.replace(T,function(Y,Z){return Z||function(le){switch(le){case"YY":return String(P.$y).slice(-2);case"YYYY":return D.s(P.$y,4,"0");case"M":return _+1;case"MM":return D.s(_+1,2,"0");case"MMM":return ee(b.monthsShort,_,V,3);case"MMMM":return ee(V,_);case"D":return P.$D;case"DD":return D.s(P.$D,2,"0");case"d":return String(P.$W);case"dd":return ee(b.weekdaysMin,P.$W,H,2);case"ddd":return ee(b.weekdaysShort,P.$W,H,3);case"dddd":return H[P.$W];case"H":return String(I);case"HH":return D.s(I,2,"0");case"h":return ie(1);case"hh":return ie(2);case"a":return te(I,L,!0);case"A":return te(I,L,!1);case"m":return String(L);case"mm":return D.s(L,2,"0");case"s":return String(P.$s);case"ss":return D.s(P.$s,2,"0");case"SSS":return D.s(P.$ms,3,"0");case"Z":return w}return null}(Y)||w.replace(":","")})},v.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},v.diff=function(f,P,b){var C,w=this,I=D.p(P),L=M(f),_=(L.utcOffset()-this.utcOffset())*r,H=this-L,V=function(){return D.m(w,L)};switch(I){case y:C=V()/12;break;case p:C=V();break;case g:C=V()/3;break;case c:C=(H-_)/6048e5;break;case h:C=(H-_)/864e5;break;case l:C=H/a;break;case u:C=H/r;break;case o:C=H/s;break;default:C=H}return b?C:D.a(C)},v.daysInMonth=function(){return this.endOf(p).$D},v.$locale=function(){return F[this.$L]},v.locale=function(f,P){if(!f)return this.$L;var b=this.clone(),C=B(f,P,!0);return C&&(b.$L=C),b},v.clone=function(){return D.w(this.$d,this)},v.toDate=function(){return new Date(this.valueOf())},v.toJSON=function(){return this.isValid()?this.toISOString():null},v.toISOString=function(){return this.$d.toISOString()},v.toString=function(){return this.$d.toUTCString()},N}(),X=q.prototype;return M.prototype=X,[["$ms",i],["$s",o],["$m",u],["$H",l],["$W",h],["$M",p],["$y",y],["$D",S]].forEach(function(N){X[N[1]]=function(v){return this.$g(v,N[0],N[1])}}),M.extend=function(N,v){return N.$i||(N(v,q,M),N.$i=!0),M},M.locale=B,M.isDayjs=k,M.unix=function(N){return M(1e3*N)},M.en=F[E],M.Ls=F,M.p={},M})})(ft);var Br=ft.exports;const je=xe(Br);var ht={exports:{}};(function(t,n){(function(s,r){t.exports=r()})(ge,function(){return function(s,r,a){s=s||{};var i=r.prototype,o={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function u(h,c,p,g){return i.fromToBase(h,c,p,g)}a.en.relativeTime=o,i.fromToBase=function(h,c,p,g,y){for(var S,d,$,T=p.$locale().relativeTime||o,j=s.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],R=j.length,A=0;A<R;A+=1){var E=j[A];E.d&&(S=g?a(h).diff(p,E.d,!0):p.diff(h,E.d,!0));var F=(s.rounding||Math.round)(Math.abs(S));if($=S>0,F<=E.r||!E.r){F<=1&&A>0&&(E=j[A-1]);var U=T[E.l];y&&(F=y(""+F)),d=typeof U=="string"?U.replace("%d",F):U(F,c,E.l,$);break}}if(c)return d;var k=$?T.future:T.past;return typeof k=="function"?k(d):k.replace("%s",d)},i.to=function(h,c){return u(h,c,this,!0)},i.from=function(h,c){return u(h,c,this)};var l=function(h){return h.$u?a.utc():a()};i.toNow=function(h){return this.to(l(this),h)},i.fromNow=function(h){return this.from(l(this),h)}}})})(ht);var Yr=ht.exports;const zr=xe(Yr);var mt={exports:{}};(function(t,n){(function(s,r){t.exports=r()})(ge,function(){var s={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function(a,i,o){var u,l=function(g,y,S){S===void 0&&(S={});var d=new Date(g),$=function(T,j){j===void 0&&(j={});var R=j.timeZoneName||"short",A=T+"|"+R,E=r[A];return E||(E=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:T,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:R}),r[A]=E),E}(y,S);return $.formatToParts(d)},h=function(g,y){for(var S=l(g,y),d=[],$=0;$<S.length;$+=1){var T=S[$],j=T.type,R=T.value,A=s[j];A>=0&&(d[A]=parseInt(R,10))}var E=d[3],F=E===24?0:E,U=d[0]+"-"+d[1]+"-"+d[2]+" "+F+":"+d[4]+":"+d[5]+":000",k=+g;return(o.utc(U).valueOf()-(k-=k%1e3))/6e4},c=i.prototype;c.tz=function(g,y){g===void 0&&(g=u);var S=this.utcOffset(),d=this.toDate(),$=d.toLocaleString("en-US",{timeZone:g}),T=Math.round((d-new Date($))/1e3/60),j=o($,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(15*-Math.round(d.getTimezoneOffset()/15)-T,!0);if(y){var R=j.utcOffset();j=j.add(S-R,"minute")}return j.$x.$timezone=g,j},c.offsetName=function(g){var y=this.$x.$timezone||o.tz.guess(),S=l(this.valueOf(),y,{timeZoneName:g}).find(function(d){return d.type.toLowerCase()==="timezonename"});return S&&S.value};var p=c.startOf;c.startOf=function(g,y){if(!this.$x||!this.$x.$timezone)return p.call(this,g,y);var S=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return p.call(S,g,y).tz(this.$x.$timezone,!0)},o.tz=function(g,y,S){var d=S&&y,$=S||y||u,T=h(+o(),$);if(typeof g!="string")return o(g).tz($);var j=function(F,U,k){var B=F-60*U*1e3,M=h(B,k);if(U===M)return[B,U];var D=h(B-=60*(M-U)*1e3,k);return M===D?[B,M]:[F-60*Math.min(M,D)*1e3,Math.max(M,D)]}(o.utc(g,d).valueOf(),T,$),R=j[0],A=j[1],E=o(R).utcOffset(A);return E.$x.$timezone=$,E},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){u=g}}})})(mt);var Vr=mt.exports;const Gr=xe(Vr);var pt={exports:{}};(function(t,n){(function(s,r){t.exports=r()})(ge,function(){var s="minute",r=/[+-]\d\d(?::?\d\d)?/g,a=/([+-]|\d\d)/g;return function(i,o,u){var l=o.prototype;u.utc=function(d){var $={date:d,utc:!0,args:arguments};return new o($)},l.utc=function(d){var $=u(this.toDate(),{locale:this.$L,utc:!0});return d?$.add(this.utcOffset(),s):$},l.local=function(){return u(this.toDate(),{locale:this.$L,utc:!1})};var h=l.parse;l.parse=function(d){d.utc&&(this.$u=!0),this.$utils().u(d.$offset)||(this.$offset=d.$offset),h.call(this,d)};var c=l.init;l.init=function(){if(this.$u){var d=this.$d;this.$y=d.getUTCFullYear(),this.$M=d.getUTCMonth(),this.$D=d.getUTCDate(),this.$W=d.getUTCDay(),this.$H=d.getUTCHours(),this.$m=d.getUTCMinutes(),this.$s=d.getUTCSeconds(),this.$ms=d.getUTCMilliseconds()}else c.call(this)};var p=l.utcOffset;l.utcOffset=function(d,$){var T=this.$utils().u;if(T(d))return this.$u?0:T(this.$offset)?p.call(this):this.$offset;if(typeof d=="string"&&(d=function(E){E===void 0&&(E="");var F=E.match(r);if(!F)return null;var U=(""+F[0]).match(a)||["-",0,0],k=U[0],B=60*+U[1]+ +U[2];return B===0?0:k==="+"?B:-B}(d),d===null))return this;var j=Math.abs(d)<=16?60*d:d,R=this;if($)return R.$offset=j,R.$u=d===0,R;if(d!==0){var A=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(R=this.local().add(j+A,s)).$offset=j,R.$x.$localOffset=A}else R=this.utc();return R};var g=l.format;l.format=function(d){var $=d||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,$)},l.valueOf=function(){var d=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*d},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var y=l.toDate;l.toDate=function(d){return d==="s"&&this.$offset?u(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():y.call(this)};var S=l.diff;l.diff=function(d,$,T){if(d&&this.$u===d.$u)return S.call(this,d,$,T);var j=this.local(),R=u(d).local();return S.call(j,R,$,T)}}})})(pt);var Kr=pt.exports;const Wr=xe(Kr);je.extend(Wr);je.extend(Gr);je.extend(zr);function qr(){const t=W();return e.jsxs("div",{className:"flex h-full w-full flex-col gap-4 pt-4",children:[e.jsx("div",{className:"text-center",children:e.jsx(fr,{discordAuthUrl:t.discordAuthUrl})}),e.jsx("div",{className:"flex-1 overflow-y-scroll bg-accent pb-4 scrollbar-thin scrollbar-thumb-scrollbar",children:e.jsx(Zr,{})})]})}function Zr(){const t=W(),n=hr({discordAuthUrl:t.discordAuthUrl}),s=De();return e.jsxs("div",{className:"flex h-full flex-col items-center justify-between",children:[e.jsx(x.Suspense,{fallback:e.jsx("div",{className:"flex h-full w-full flex-col items-center justify-center",children:e.jsx(Me,{children:"Loading Discord Posts"})}),children:e.jsx(We,{resolve:t.discordPostsPromise,errorElement:e.jsx("div",{className:"text-red-500",children:"There was a problem loading the discord posts"}),children:r=>e.jsx("ul",{className:"flex w-full flex-col gap-4 p-3 xl:p-12",children:r.map(a=>e.jsx("li",{className:"rounded-xl border bg-background transition-all duration-200 focus-within:-translate-y-1 focus-within:shadow-lg hover:-translate-y-1 hover:shadow-lg",children:e.jsx(Jr,{thread:a})},a.id))})})}),e.jsx("div",{children:e.jsxs(ae,{to:s&&!n.includes("oauth")?n.replace(/^https/,"discord"):n,target:n.includes("oauth")?void 0:"_blank",rel:"noreferrer noopener",onClick:s?r=>{r.preventDefault(),window.open(r.currentTarget.href,"_blank","noreferrer noopener")}:void 0,className:"flex items-center gap-2 p-2 text-xl hover:underline",children:["Create Post ",e.jsx(O,{name:"ExternalLink"})]})})]})}function Jr({thread:t}){const n=t.reactions.filter(r=>r.count),s=dr();return e.jsx("div",{children:e.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[t.tags.length?e.jsx("div",{className:"flex gap-2",children:t.tags.map(r=>e.jsxs("div",{className:"flex items-center justify-center gap-1 rounded-full bg-accent px-2 py-1 text-sm",children:[e.jsx("span",{className:"h-3 w-3 leading-3",children:e.jsx(Ye,{name:r.emojiName,url:r.emojiUrl})}),e.jsx("span",{children:r.name})]},r.name))}):null,e.jsx("strong",{className:"text-xl font-bold",children:t.name}),e.jsxs("div",{className:"flex items-start gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[t.authorAvatarUrl?e.jsx("img",{src:t.authorAvatarUrl,alt:"",className:"h-6 w-6 rounded-full"}):null,e.jsxs("span",{children:[e.jsx("span",{className:"font-bold",style:t.authorHexAccentColor?{color:t.authorHexAccentColor}:{},children:t.authorDisplayName}),":"," "]})]}),e.jsx("span",{className:"flex-1 overflow-ellipsis text-muted-foreground",children:t.messagePreview})]})]}),t.previewImageUrl?e.jsx("img",{src:t.previewImageUrl,alt:"",className:"h-28 w-28 rounded-lg object-cover"}):null]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{children:n.length?e.jsx("ul",{className:"flex items-center gap-2",children:n.map((r,a)=>e.jsxs("li",{className:"flex items-center gap-1 rounded-md border border-blue-600 bg-blue-500/20 px-[5px] py-[0.5px] text-sm",children:[e.jsx("span",{className:"h-3 w-3 leading-3",children:e.jsx(Ye,{name:r.emojiName,url:r.emojiUrl})}),e.jsx("span",{children:r.count})]},a))}):null}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(O,{name:"Chat"})," ",t.messageCount]}),` · ${je(t.lastUpdated).tz(s.timeZone).fromNow()}`]})]}),e.jsxs("span",{className:"flex items-center gap-4",children:[e.jsx("a",{href:t.link.replace(/^https/,"discord"),children:e.jsx(O,{name:"Discord"})}),e.jsx("a",{href:t.link,target:"_blank",rel:"noreferrer noopener",children:e.jsx(O,{name:"ExternalLink"})})]})]})]})})}function Ye({name:t,url:n}){return n?e.jsx("img",{src:n,alt:t,className:"h-full w-full"}):t||null}function xt({playgroundAppName:t,problemAppName:n,isUpToDate:s,allApps:r,children:a}){const i=t===n,o=i&&s?e.jsx(O,{size:"xl",name:"Linked"}):e.jsx(O,{size:"xl",name:"Unlinked",className:"animate-pulse text-foreground-danger"});let u="Click to reset Playground.";return s||(u="Playground is out of date. Click to reset Playground."),i||(u="Playground is not set to the right app. Click to set Playground."),e.jsxs("div",{className:"flex h-full w-full flex-col justify-between",children:[e.jsxs("div",{className:"flex h-14 flex-shrink-0 items-center justify-start gap-2 border-b px-3",children:[e.jsx("div",{className:"display-alt-up",children:n?e.jsx(ye,{appName:n,tooltipText:u,children:o}):e.jsx(G,{content:"No problem app available for this step",children:e.jsx("div",{children:e.jsx(O,{name:"Question"})})})}),e.jsx("div",{className:"display-alt-down",children:t?e.jsx(ye,{appName:t,reset:!0,tooltipText:"Reset Playground",children:e.jsx("div",{className:"flex h-7 w-7 items-center justify-center",children:e.jsx(O,{name:"Refresh"})})}):e.jsx("div",{className:"h-7 w-7"})}),e.jsx(Ur,{allApps:r,playgroundAppName:t})]}),e.jsx("div",{className:"flex h-full flex-1 flex-grow items-center justify-center",children:a})]})}function Qr({name:t}){var i;const n=K(),s=(i=n.formData)==null?void 0:i.get("intent"),r=s==="stop"?"Stopping App":s==="restart"?"Restarting App":null,a=De();return e.jsxs(n.Form,{method:"POST",action:"/start",children:[Oe,e.jsx("input",{type:"hidden",name:"name",value:t}),e.jsx("button",{type:"submit",name:"intent",value:a?"restart":"stop",className:"h-full border-r px-3 py-4 font-mono text-xs uppercase leading-none",children:r||(a?"Restart App":"Stop App")})]})}function gt({port:t}){const n=K();return e.jsxs(n.Form,{method:"POST",action:"/start",children:[e.jsx("input",{type:"hidden",name:"port",value:t}),e.jsx(qe,{varient:"mono",type:"submit",name:"intent",value:"stop-port",children:n.state==="idle"?"Stop Port":"Stopping Port"})]})}function Xr({name:t}){var s;const n=K();return((s=n.data)==null?void 0:s.status)==="app-not-started"?n.data.error==="port-unavailable"?e.jsxs("div",{children:["The port is unavailable. Would you like to stop whatever is running on that port and try again?",e.jsx(gt,{port:n.data.port})]}):e.jsx("div",{children:"An unknown error has happened."}):e.jsxs(n.Form,{method:"POST",action:"/start",children:[e.jsx("input",{type:"hidden",name:"name",value:t}),n.state==="idle"?e.jsx(qe,{type:"submit",name:"intent",value:"start",varient:"mono",children:"Start App"}):e.jsx("div",{children:e.jsx(Me,{children:"Starting App"})})]})}const en=m.intersection(m.object({type:m.literal("epicshop:history-call")}),m.union([m.object({method:m.literal("pushState"),args:m.union([m.tuple([m.object({}).passthrough(),m.unknown()]),m.tuple([m.object({}).passthrough(),m.unknown(),m.string()])])}),m.object({method:m.literal("replaceState"),args:m.union([m.tuple([m.object({}).passthrough(),m.unknown()]),m.tuple([m.object({}).passthrough(),m.unknown(),m.string()])])}),m.object({method:m.literal("go"),args:m.tuple([m.number().optional()])}),m.object({method:m.literal("forward"),args:m.tuple([])}),m.object({method:m.literal("back"),args:m.tuple([])}),m.object({method:m.literal("popstate"),pathname:m.string(),delta:m.number()})])),tn=m.object({type:m.literal("epicshop:loaded"),url:m.string()}),rn=m.union([en,tn]);function ze(t,n,s){return Math.min(Math.max(t+n,0),s)}const nn=x.forwardRef(sn);function sn({name:t,port:n,portIsAvailable:s,isRunning:r,baseUrl:a,id:i,initialRoute:o},u){const l=_e();return r?e.jsx(an,{baseUrl:a,id:i,name:t,ref:u,initialRoute:o}):s===!1?e.jsxs("div",{className:"flex flex-col items-center justify-center",children:[e.jsxs("p",{className:"max-w-xs pb-5 text-center",role:"status",children:["The port for this app is unavailable. It could be that you're running it ",e.jsx("a",{href:Re({domain:l.domain,port:n}),className:"underline",children:"elsewhere"}),"?"]}),e.jsx(gt,{port:n})]}):e.jsx(Xr,{name:t})}const an=x.forwardRef(on);function on({baseUrl:t,id:n,name:s,initialRoute:r},a){const[i,o]=Ie(),u=i.get("pathname")??r,[l,h]=x.useState(0),c=n+l,p=x.useRef("new"),g=x.useRef(null),[y,S]=x.useState({history:[u],index:0}),[d,$]=x.useState(u),T=x.useRef(null),j=new URL(u,t),R=x.useRef(j);x.useEffect(()=>{R.current=j});const[A,E]=x.useState(j),F=x.useRef(n);F.current!==n&&(F.current=n,E(R.current)),x.useEffect(()=>{F.current=n}),x.useEffect(()=>{function N(v){var C;if(v.source!==((C=T.current)==null?void 0:C.contentWindow))return;const f=rn.safeParse(v.data,{path:["messageEvent","data"]});if(!f.success)return;const{data:P}=f;if(P.type==="epicshop:loaded"){S(w=>{const I=L=>ze(w.index,L,w.history.length-1);if(p.current==="back")return{...w,index:I(-1)};if(p.current==="forward")return{...w,index:I(1)};if(p.current==="new"){const L=w.history[w.index],_=new URL(P.url).pathname;if(L===_)return w;const H=[...w.history.slice(0,w.index+1),_];return{history:H,index:H.length-1}}else throw new Error("Unexpected lastDirectionRef value")});return}const{method:b}=P;S(w=>{const I=_=>ze(w.index,_,w.history.length-1),L=w.history[w.index];switch(b){case"popstate":return{...w,index:I(P.delta)};case"forward":return{...w,index:I(1)};case"back":return{...w,index:I(-1)};case"pushState":{const _=P.args[2]??L,H=[...w.history.slice(0,w.index+1),_].filter(Boolean);return{...w,history:H,index:H.length-1}}case"replaceState":{const _=P.args[2]??L;return{...w,history:[...w.history.slice(0,w.index),_,...w.history.slice(w.index+1)].filter(Boolean)}}case"go":{const[_=0]=P.args;return{...w,index:I(_)}}}})}return window.addEventListener("message",N),()=>{window.removeEventListener("message",N)}},[]);const U=x.useRef(o);x.useEffect(()=>{U.current=o},[o]);const k=y.history[y.index];x.useEffect(()=>{if(!k)return;$(k);const N=new URLSearchParams(window.location.search);k==="/"?N.delete("pathname"):N.set("pathname",k),`?${N.toString()}`!==window.location.search&&U.current(N,{replace:!0})},[k]);const B=(...N)=>{var f,P;const v=N[0];typeof v=="number"?p.current=v>0?"forward":"back":p.current="new",g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{p.current="new"},100),(P=(f=T.current)==null?void 0:f.contentWindow)==null||P.postMessage({type:"epicshop:navigate-call",params:N},"*")};function M(N=d){$(N);const v=y.history[y.index];B(N,{replace:v===N})}x.useImperativeHandle(a,()=>({handleExtrnalNavigation:M}));const D=y.index===y.history.length-1,q=y.index<=0,X=[];for(const[N,v]of i.entries())N!=="pathname"&&X.push(e.jsx("input",{type:"hidden",name:N,value:v},N));return e.jsx(It,{children:e.jsxs("div",{className:"flex h-full flex-grow flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b pl-1.5",children:[e.jsxs("div",{className:"mr-2 flex items-center justify-center gap-2 px-1",children:[e.jsxs(fe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("button",{type:"button",className:"hidden aspect-square h-full w-full items-center justify-center p-1 transition disabled:opacity-40 sm:flex",disabled:q,onClick:()=>B(-1),children:e.jsx(O,{name:"ArrowLeft","aria-hidden":"true"})})}),e.jsx(me,{children:"Go back"})]}),e.jsxs(fe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("button",{type:"button",className:"hidden aspect-square h-full w-full items-center justify-center p-1 transition disabled:opacity-40 sm:flex",disabled:D,onClick:()=>B(1),children:e.jsx(O,{name:"ArrowRight","aria-hidden":"true"})})}),e.jsx(me,{children:"Go forward"})]}),e.jsxs(fe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("button",{type:"button",className:"flex aspect-square h-full w-full items-center justify-center p-1 transition disabled:opacity-40",onClick:()=>{E(j),h(l+1),S({history:[j.pathname],index:0})},children:e.jsx(O,{name:"Refresh","aria-hidden":"true"})})}),e.jsx(me,{children:"Refresh"})]})]}),e.jsxs(cr,{method:"get",replace:!0,className:"flex flex-1 gap-2",onSubmit:()=>M(),children:[X,e.jsxs("div",{className:"flex flex-1 items-center border-x bg-background p-3 leading-none text-foreground",children:[e.jsx("a",{href:j.toString(),target:"_blank",rel:"noreferrer",children:A.host}),e.jsx("input",{"aria-label":"pathname",className:"w-full flex-1 bg-background focus-visible:outline-none",value:d,name:"pathname",onChange:N=>$(N.currentTarget.value)})]})]}),e.jsx(Qr,{name:s}),e.jsxs(fe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("a",{href:j.toString(),target:"_blank",rel:"noreferrer",className:re("flex aspect-square items-center justify-center px-3.5"),children:e.jsx(O,{name:"ExternalLink"})})}),e.jsx(me,{children:"Open in new tab"})]})]}),e.jsx("div",{className:"flex h-full w-full flex-grow dark:bg-white",children:e.jsx("iframe",{title:s,ref:T,src:A.toString(),className:"h-full w-full flex-grow bg-white"},c)})]})})}function Ne({id:t,appInfo:n,inBrowserBrowserRef:s}){const r=_e(),a=pr();if(!n)return e.jsx("p",{children:"No app here. Sorry."});const{isRunning:i,dev:o,name:u,portIsAvailable:l,title:h}=n;if(ENV.EPICSHOP_DEPLOYED&&n.stackBlitzUrl){const c=new URL(n.stackBlitzUrl);return c.searchParams.set("embed","1"),c.searchParams.set("theme",a),e.jsx(ln,{title:h,url:c.toString(),loadingContent:e.jsx(Me,{children:e.jsxs("span",{children:["Loading"," ",e.jsxs("a",{className:"underline",href:n.stackBlitzUrl,children:['"',h,'"']})]})})})}if(o.type==="script"){const c=Re({domain:r.domain,port:o.portNumber});return e.jsx(nn,{ref:s,isRunning:i,id:t??u,name:u,portIsAvailable:l,port:o.portNumber,baseUrl:c,initialRoute:o.initialRoute})}else return o.type==="browser"?e.jsxs("div",{className:"relative h-full flex-grow overflow-y-auto scrollbar-thin scrollbar-thumb-scrollbar",children:[e.jsxs("a",{href:o.pathname,target:"_blank",rel:"noreferrer",className:pe("absolute bottom-5 right-5 flex items-center justify-center rounded-full bg-gray-100 p-2.5 transition hover:bg-gray-200 dark:bg-gray-800 hover:dark:bg-gray-600"),children:[e.jsx(O,{name:"ExternalLink","aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:"Open in New Window"})]}),e.jsx("iframe",{title:h,src:o.pathname,className:"h-full w-full flex-grow bg-white"})]}):e.jsxs("p",{children:["Preview for dev type of ",e.jsx("code",{children:o.type})," not supported."]})}function ln({url:t,title:n,loadingContent:s}){const[r,a]=x.useState(!1);return e.jsxs("div",{className:"h-full w-full flex-grow",children:[r?null:e.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:s}),e.jsx("iframe",{onLoad:()=>a(!0),onError:()=>a(!0),src:t,className:pe("h-full w-full flex-grow transition-opacity duration-300",r?"opacity-100":"opacity-0"),title:n,sandbox:"allow-forms allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox"})]})}function cn({appInfo:t,inBrowserBrowserRef:n,problemAppName:s,allApps:r,isUpToDate:a}){return e.jsx(xt,{playgroundAppName:t==null?void 0:t.appName,problemAppName:s,allApps:r,isUpToDate:a,children:(t==null?void 0:t.dev.type)==="none"?e.jsxs("div",{children:[e.jsx("div",{className:"text-foreground-secondary flex h-full items-center justify-center text-2xl",children:"Non-UI playground"}),e.jsx("div",{children:e.jsxs("div",{className:"text-foreground-secondary flex flex-wrap gap-1 text-center",children:["Navigate to"," ",e.jsx(G,{content:t.fullPath,children:e.jsx("span",{className:"underline",onClick:()=>{navigator.clipboard.writeText(t.fullPath),mr.success("Copied playground path to clipboard")},children:"the playground directory"})})," ","in your editor and terminal to work on this exercise!"]})})]}):t?e.jsx(Ne,{id:t.appName,appInfo:t,inBrowserBrowserRef:n}):e.jsxs("div",{className:"flex flex-col justify-center gap-2",children:[e.jsx("p",{children:"Please set the playground first"}),s?e.jsx(Ae,{appName:s}):null]})})}function un({handleClick:t,cacheLocation:n,embeddedKey:s,appFullPath:r}){const a=K();return e.jsxs(a.Form,{action:"/update-mdx-cache",method:"POST",children:[Oe,e.jsx("input",{type:"hidden",name:"cacheLocation",value:n}),e.jsx("input",{type:"hidden",name:"embeddedKey",value:s}),e.jsx("input",{type:"hidden",name:"appFullPath",value:r}),e.jsx("button",{type:"submit",onClick:t,className:re("launch_button",a.state==="idle"?null:"cursor-progress"),children:"Cancel Warning"})]})}const vt=x.createContext(null);function dn(){const t=x.useContext(vt);if(!t)throw new Error("useStepContext must be used within a StepContext.Provider");return t}function fn({children:t,inBrowserBrowserRef:n}){return e.jsx(vt.Provider,{value:{inBrowserBrowserRef:n},children:t})}const hn={CodeFile:gn,CodeFileNotification:vn,DiffLink:Ue,PrevDiffLink:xn,NextDiffLink:pn,InlineFile:jn,LinkToApp:wn};function mn({inBrowserBrowserRef:t}){const n=W();return n.exerciseStepApp.instructionsCode?e.jsx(fn,{inBrowserBrowserRef:t,children:e.jsx(xr,{epicVideoInfosPromise:n.epicVideoInfosPromise,children:e.jsx("div",{className:"prose dark:prose-invert sm:prose-lg",children:e.jsx(or,{code:n.exerciseStepApp.instructionsCode,components:hn})})})}):null}function jt(t,n,s){const r=new URLSearchParams(t);return s===null?r.delete(n):r.set(n,s),r}function pn({app:t=0,fullPage:n=!1,children:s}){return e.jsx(Ue,{app1:t,app2:t+1,fullPage:n,children:s})}function xn({app:t=-1,fullPage:n=!1,children:s}){return e.jsx(Ue,{app1:t,app2:t+1,fullPage:n,children:s})}function Ue({app1:t=0,app2:n=1,children:s,fullPage:r=!1,to:a}){const i=W();if(!a&&!t&&!n)return e.jsx("callout-danger",{className:"notification",children:e.jsx("div",{className:"title",children:"DiffLink Error: invalid input"})});function o(c){var p;if(typeof c=="number"){const g=i.exerciseIndex+c;return(p=i.allApps[g])==null?void 0:p.name}if(!c)return null;for(const{name:g,stepName:y}of i.allApps)if(c===g||c===y)return g;return null}if(a){const c=new URLSearchParams(a);t=c.get("app1"),n=c.get("app2")}const u=o(t),l=o(n);if(!u||!l)return e.jsxs("callout-danger",{className:"notification",children:[e.jsx("div",{className:"title",children:"DiffLink Error: invalid input"}),!u&&e.jsxs("div",{children:['app1: "',t,'" is not a valid app name']}),!l&&e.jsxs("div",{children:['app2: "',n,'" is not a valid app name']})]});a||(a=`app1=${u}&app2=${l}`);const h=r?`/diff?${a}`:`?${decodeURIComponent(jt(new URLSearchParams,"preview",`diff&${a}`).toString())}`;return s||(s=e.jsxs("span",{children:["Go to Diff ",r?"":"Preview"," from: ",e.jsx("code",{children:u})," to:"," ",e.jsx("code",{children:l})]})),e.jsx(ae,{to:h,children:s})}function gn({file:t}){return e.jsxs("div",{className:"border-4 border-[#ff4545] bg-[#ff454519] p-4 text-lg",children:["Something went wrong compiling ",e.jsx("b",{children:"CodeFile"})," for file: ",e.jsx("u",{children:t})," to markdown"]})}function vn({file:t,type:n="problem",children:s,variant:r,cacheLocation:a,embeddedKey:i,...o}){const[u,l]=x.useState("visible"),c=W()[n],p=()=>{u==="visible"&&(l("collapse"),setTimeout(()=>{l("none")},400))},g=re("rounded px-4 py-1 font-mono text-sm font-semibold outline-none transition duration-300 ease-in-out",{"bg-amber-300/70 hover:bg-amber-300/40 active:bg-amber-300/50":r==="warning","bg-red-300/70 hover:bg-red-300/40 active:bg-red-300/50":r==="error"});return e.jsxs("div",{className:re("notification important h-15 relative",{"duration-400 !my-0 !h-0 !py-0 !opacity-0 transition-all ease-out":u!=="visible",hidden:u==="none"}),children:[e.jsxs("div",{className:"absolute right-3 top-3 z-50 flex gap-4",children:[c?e.jsx("div",{className:g,title:`Edit ${t}`,children:e.jsx(ce,{appFile:t,appName:c.name,...o,children:"Edit this File"})}):null,c&&r==="warning"?e.jsx("div",{className:g,title:`Remove the warning from here and from ${t} cache file`,children:e.jsx(un,{handleClick:p,cacheLocation:a,embeddedKey:i,appFullPath:c.fullPath})}):null]}),s]})}function jn({file:t,type:n="playground",children:s=e.jsx("code",{children:t}),...r}){const a=W(),i=a[n]||a[a.type],o=e.jsxs("div",{className:"launch-editor-button-wrapper flex underline underline-offset-4",children:[s," ",e.jsx("svg",{height:24,width:24,children:e.jsx("use",{href:"/icons.svg#keyboard"})})]});return ENV.EPICSHOP_DEPLOYED&&i?e.jsx("div",{className:"inline-block grow",children:e.jsx(ce,{appFile:t,appName:i.name,...r,children:o})}):i?e.jsx("div",{className:"inline-block grow",children:e.jsx(ce,{appFile:t,appName:i.name,...r,children:o})}):n==="playground"?e.jsx(G,{content:"You must 'Set to Playground' before opening a file",children:e.jsx("div",{className:"inline-block grow cursor-not-allowed",children:o})}):e.jsx(e.Fragment,{children:"children"})}function bn(t){return t==="problem"?"problem":t==="solution"?"solution":"playground"}function wn({to:t,children:n=e.jsx("code",{children:t.toString()}),...s}){var g;const[r]=Ie(),a=`?${jt(r,"pathname",t.toString()).toString()}`,i=W(),o=bn(r.get("preview")),u=_e(),l=i[o],h=(l==null?void 0:l.dev.type)==="script"?Re({domain:u.domain,port:l.dev.portNumber}):((g=i.playground)==null?void 0:g.dev.type)==="browser"?i.playground.dev.pathname:null,{inBrowserBrowserRef:c}=dn(),p=h?h.slice(0,-1)+t.toString():null;return e.jsxs("div",{className:"inline-flex items-center justify-between gap-1",children:[e.jsx(ae,{to:a,...s,className:pe(s.className,{"cursor-not-allowed":ENV.EPICSHOP_DEPLOYED}),title:ENV.EPICSHOP_DEPLOYED?"Cannot link to app in deployed version":void 0,onClick:y=>{var S,d;ENV.EPICSHOP_DEPLOYED&&y.preventDefault(),(S=s.onClick)==null||S.call(s,y),(d=c.current)==null||d.handleExtrnalNavigation(t.toString())},children:n}),p?e.jsx(G,{content:"Open in new tab",children:e.jsx("a",{href:p,target:"_blank",rel:"noreferrer",className:pe("flex aspect-square items-center justify-center",{"cursor-not-allowed":ENV.EPICSHOP_DEPLOYED}),title:ENV.EPICSHOP_DEPLOYED?"Cannot link to app in deployed version":"Open in new tab",onClick:y=>{ENV.EPICSHOP_DEPLOYED&&y.preventDefault()},children:e.jsx(O,{name:"ExternalLink"})})}):null]})}const yn=m.intersection(m.object({type:m.literal("epicshop:test-status-update"),timestamp:m.number()}),m.union([m.object({status:m.literal("pending")}),m.object({status:m.literal("pass")}),m.object({status:m.literal("fail"),error:m.string()})])),Nn=m.object({type:m.literal("epicshop:test-step-update"),status:m.literal("pass"),title:m.string(),timestamp:m.number()}),Sn=m.union([Nn,yn]);function Pn({pathname:t,testFile:n}){const s=x.useRef(null),[r,a]=x.useState(null),[i,o]=x.useState([]);x.useEffect(()=>{function c(p){var S;if(p.source!==((S=s.current)==null?void 0:S.contentWindow)||"request"in p.data)return;const g=Sn.safeParse(p.data,{path:["messageEvent","data"]});if(!g.success){console.error("Invalid message from test iframe",p.data,g.error);return}const{data:y}=g;y.type==="epicshop:test-status-update"&&(y.status==="pending"&&o([]),a(y)),y.type==="epicshop:test-step-update"&&o(d=>[...d,y])}return window.addEventListener("message",c),()=>{window.removeEventListener("message",c)}},[]);const u={pending:e.jsx(ke,{"aria-label":"Pending"}),pass:e.jsx(O,{name:"CheckSmall","aria-label":"Passed",className:"text-emerald-700"}),fail:e.jsx(O,{name:"Remove","aria-label":"Failed",className:"text-foreground-danger"}),unknown:e.jsx(O,{name:"Question","aria-label":"Unknown",className:"animate-pulse"})}[(r==null?void 0:r.status)??"unknown"],l=i.sort((c,p)=>c.timestamp-p.timestamp),h={pass:e.jsx(O,{name:"CheckSmall","aria-label":"Passed"}),fail:e.jsx(O,{name:"Remove","aria-label":"Failed"}),unknown:e.jsx(O,{name:"Question","aria-label":"Unknown",className:"animate-pulse"})};return e.jsx(e.Fragment,{children:e.jsx(tr,{className:"w-full",type:"multiple",children:e.jsx(rr,{icon:u,title:n,forceMount:!0,children:e.jsxs("div",{className:"not-prose",children:[e.jsxs("div",{className:"p-5 pt-3",children:[e.jsx("ul",{className:"",children:l.map(c=>e.jsx("li",{children:e.jsxs("div",{className:"flex items-baseline gap-2 text-emerald-700",children:[e.jsx("span",{children:h[c.status]}),e.jsx("pre",{className:"whitespace-pre-wrap",children:c.title})]})},c.timestamp+c.title))}),(r==null?void 0:r.status)==="fail"?e.jsxs("div",{className:"flex items-baseline gap-2 text-foreground-danger",children:[e.jsx("span",{children:h.fail}),e.jsx("pre",{className:"max-h-48 overflow-y-auto text-foreground-danger scrollbar-thin scrollbar-thumb-scrollbar",children:r.error})]}):null,e.jsx("iframe",{ref:s,title:n,src:t+n,className:"mt-5 min-h-[420px] w-full border bg-white"})]}),e.jsxs("div",{className:"flex border-y",children:[e.jsx("button",{onClick:()=>{var c,p;return(p=(c=s.current)==null?void 0:c.contentWindow)==null?void 0:p.location.reload()},className:"border-r p-3",children:e.jsx(O,{name:"Refresh","aria-label":"Rerun Tests"})}),e.jsx("a",{href:t+n,target:"_blank",rel:"noreferrer",className:"border-r p-3",children:e.jsx(O,{name:"ExternalLink","aria-label":"Open in New Window"})})]})]})})})})}const $n=m.union([m.object({type:m.literal("init"),exitCode:m.number().nullable().optional(),isRunning:m.boolean(),output:m.array(m.object({type:m.union([m.literal("stdout"),m.literal("stderr")]),html:m.string(),timestamp:m.number()}))}),m.object({type:m.union([m.literal("stdout"),m.literal("stderr")]),data:m.string(),timestamp:m.number()}),m.object({type:m.literal("exit"),isRunning:m.literal(!1),code:m.number().nullable()})]),Cn=m.array($n);function Tn(t,n){return n(t)}function En({name:t}){const[n,s]=x.useReducer(Tn,{version:0,isRunning:!1,exitCode:void 0,lines:[]}),{version:r,isRunning:a,exitCode:i,lines:o}=n,u=gr(`/test?${new URLSearchParams({name:t})}&v=${r}`);return x.useEffect(()=>{if(!u)return;const l=JSON.parse(u),h=Cn.safeParse(l);if(!h.success){console.error(h.error.flatten());return}for(const c of h.data)switch(c.type){case"exit":{const{isRunning:p,code:g}=c;s(y=>({...y,isRunning:p,exitCode:g}));break}case"init":{const{output:p,exitCode:g,isRunning:y}=c;s(S=>({...S,lines:p,exitCode:g,isRunning:y}));break}case"stderr":case"stdout":{const{type:p,data:g,timestamp:y}=c;s(S=>({...S,lines:[...S.lines,{type:p,html:g,timestamp:y}].sort((d,$)=>d.timestamp-$.timestamp),isRunning:!0}));break}}},[u]),e.jsxs("div",{className:"relative flex h-full w-full flex-col",children:[e.jsxs("div",{className:"flex h-12 w-full flex-shrink-0 items-center justify-between border-b",children:[e.jsxs("div",{className:"flex h-full items-center",children:[!a&&e.jsx(Dn,{name:t,onRun:()=>{s(l=>({...l,exitCode:void 0,lines:[],version:l.version+1}))}}),a?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex h-full flex-grow items-center justify-center border-r px-3.5",children:e.jsx(ke,{role:"status","aria-label":"Running Tests"})}),e.jsx(kn,{name:t})]}):null]}),!a&&i!==void 0&&e.jsx("p",{className:"pr-3.5 leading-none",children:i===0?"Tests passed":`Test failed (exit code ${String(i)})`}),!a&&i!==void 0&&e.jsx(Rn,{name:t,onClear:()=>{s(l=>({...l,exitCode:void 0,lines:[]}))}})]}),e.jsxs("div",{className:"flex h-full flex-col gap-5 p-5",children:[e.jsx("p",{className:"font-mono text-sm font-medium uppercase",children:"Test Output"}),e.jsx("pre",{className:"shadow-on-scrollbox flex-1 overflow-y-scroll scrollbar-thin scrollbar-thumb-scrollbar",children:o.map(l=>e.jsx("code",{"data-type":l.type,dangerouslySetInnerHTML:{__html:l.html}},l.timestamp))})]})]})}function Dn({name:t,onRun:n}){const s=K(),r=x.useRef(n);return x.useEffect(()=>{r.current=n},[n]),x.useEffect(()=>{var a,i;(a=s.data)!=null&&a.success&&((i=r.current)==null||i.call(r))},[s.data]),e.jsxs(s.Form,{method:"POST",action:"/test",className:"h-full",children:[e.jsx("input",{type:"hidden",name:"name",value:t}),e.jsx(G,{content:s.state==="idle"?"Run Tests":"Running Tests...",children:e.jsx("button",{type:"submit",name:"intent",value:"run",className:"flex h-full flex-grow items-center justify-center border-r px-3.5",children:s.state==="idle"?e.jsx(O,{name:"TriangleSmall"}):e.jsx(ke,{role:"status"})})})]})}function Rn({name:t,onClear:n}){const s=K(),r=x.useRef(n);return x.useEffect(()=>{r.current=n},[n]),x.useEffect(()=>{var a,i;(a=s.data)!=null&&a.success&&((i=r.current)==null||i.call(r))},[s.data]),e.jsxs(s.Form,{method:"POST",action:"/test",className:"h-full",children:[e.jsx("input",{type:"hidden",name:"name",value:t}),e.jsx(G,{content:s.state==="idle"?"Clear Tests":"Clearing Tests...",children:e.jsx("button",{type:"submit",name:"intent",value:"clear",className:"flex h-full flex-grow items-center justify-center border-l px-3.5",children:s.state==="idle"?e.jsx(O,{name:"Clear"}):e.jsx(O,{name:"Clear",className:"animate-pulse",role:"status"})})})]})}function kn({name:t,onStop:n}){const s=K(),r=x.useRef(n);return x.useEffect(()=>{r.current=n},[n]),x.useEffect(()=>{var a,i;(a=s.data)!=null&&a.success&&((i=r.current)==null||i.call(r))},[s.data]),e.jsxs(s.Form,{method:"POST",action:"/test",className:"h-full",children:[e.jsx("input",{type:"hidden",name:"name",value:t}),e.jsx(G,{content:s.state==="idle"?"Stop Tests":"Stopping Tests...",children:e.jsx("button",{type:"submit",name:"intent",value:"stop",className:"flex h-full flex-grow items-center justify-center border-r px-3.5",children:s.state==="idle"?e.jsx(O,{name:"Stop"}):e.jsx(O,{name:"Stop",className:"animate-pulse",role:"status"})})})]})}function On({appInfo:t,problemAppName:n,allApps:s,isUpToDate:r}){const[a,i]=x.useState(0);let o=e.jsx("p",{children:"No tests here. Sorry."});if((t==null?void 0:t.test.type)==="script"&&(o=e.jsx(En,{name:t.name})),(t==null?void 0:t.test.type)==="browser"){const{pathname:u}=t.test;o=e.jsxs("div",{className:"flex h-full w-full flex-grow flex-col",children:[t.test.testFiles.map(l=>e.jsx("div",{children:e.jsx(Pn,{pathname:u,testFile:l})},l)),e.jsx("div",{className:"px-3 py-[21px]",children:e.jsxs("button",{onClick:()=>i(l=>l+1),className:"flex items-center gap-2 font-mono text-sm uppercase leading-none",children:[e.jsx(O,{name:"Refresh","aria-hidden":!0})," Rerun All Tests"]})})]},a)}return e.jsx(xt,{playgroundAppName:t==null?void 0:t.appName,problemAppName:n,allApps:s,isUpToDate:r,children:o})}var He="Popover",[bt,ws]=Pe(He,[Ve]),ue=Ve(),[In,Q]=bt(He),wt=t=>{const{__scopePopover:n,children:s,open:r,defaultOpen:a,onOpenChange:i,modal:o=!1}=t,u=ue(n),l=x.useRef(null),[h,c]=x.useState(!1),[p=!1,g]=Ce({prop:r,defaultProp:a,onChange:i});return e.jsx(At,{...u,children:e.jsx(In,{scope:n,contentId:Te(),triggerRef:l,open:p,onOpenChange:g,onOpenToggle:x.useCallback(()=>g(y=>!y),[g]),hasCustomAnchor:h,onCustomAnchorAdd:x.useCallback(()=>c(!0),[]),onCustomAnchorRemove:x.useCallback(()=>c(!1),[]),modal:o,children:s})})};wt.displayName=He;var yt="PopoverAnchor",Mn=x.forwardRef((t,n)=>{const{__scopePopover:s,...r}=t,a=Q(yt,s),i=ue(s),{onCustomAnchorAdd:o,onCustomAnchorRemove:u}=a;return x.useEffect(()=>(o(),()=>u()),[o,u]),e.jsx(Ge,{...i,...r,ref:n})});Mn.displayName=yt;var Nt="PopoverTrigger",St=x.forwardRef((t,n)=>{const{__scopePopover:s,...r}=t,a=Q(Nt,s),i=ue(s),o=$e(n,a.triggerRef),u=e.jsx(J.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Et(a.open),...r,ref:o,onClick:z(t.onClick,a.onOpenToggle)});return a.hasCustomAnchor?u:e.jsx(Ge,{asChild:!0,...i,children:u})});St.displayName=Nt;var Be="PopoverPortal",[_n,Fn]=bt(Be,{forceMount:void 0}),Pt=t=>{const{__scopePopover:n,forceMount:s,children:r,container:a}=t,i=Q(Be,n);return e.jsx(_n,{scope:n,forceMount:s,children:e.jsx(Ee,{present:s||i.open,children:e.jsx(yr,{asChild:!0,container:a,children:r})})})};Pt.displayName=Be;var oe="PopoverContent",$t=x.forwardRef((t,n)=>{const s=Fn(oe,t.__scopePopover),{forceMount:r=s.forceMount,...a}=t,i=Q(oe,t.__scopePopover);return e.jsx(Ee,{present:r||i.open,children:i.modal?e.jsx(Ln,{...a,ref:n}):e.jsx(An,{...a,ref:n})})});$t.displayName=oe;var Ln=x.forwardRef((t,n)=>{const s=Q(oe,t.__scopePopover),r=x.useRef(null),a=$e(n,r),i=x.useRef(!1);return x.useEffect(()=>{const o=r.current;if(o)return vr(o)},[]),e.jsx(jr,{as:Mt,allowPinchZoom:!0,children:e.jsx(Ct,{...t,ref:a,trapFocus:s.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:z(t.onCloseAutoFocus,o=>{var u;o.preventDefault(),i.current||(u=s.triggerRef.current)==null||u.focus()}),onPointerDownOutside:z(t.onPointerDownOutside,o=>{const u=o.detail.originalEvent,l=u.button===0&&u.ctrlKey===!0,h=u.button===2||l;i.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:z(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),An=x.forwardRef((t,n)=>{const s=Q(oe,t.__scopePopover),r=x.useRef(!1),a=x.useRef(!1);return e.jsx(Ct,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,u;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(u=s.triggerRef.current)==null||u.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{var l,h;(l=t.onInteractOutside)==null||l.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((h=s.triggerRef.current)==null?void 0:h.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),Ct=x.forwardRef((t,n)=>{const{__scopePopover:s,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:h,onInteractOutside:c,...p}=t,g=Q(oe,s),y=ue(s);return br(),e.jsx(wr,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:e.jsx(_t,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:c,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:h,onDismiss:()=>g.onOpenChange(!1),children:e.jsx(Ft,{"data-state":Et(g.open),role:"dialog",id:g.contentId,...y,...p,ref:n,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Tt="PopoverClose",Un=x.forwardRef((t,n)=>{const{__scopePopover:s,...r}=t,a=Q(Tt,s);return e.jsx(J.button,{type:"button",...r,ref:n,onClick:z(t.onClick,()=>a.onOpenChange(!1))})});Un.displayName=Tt;var Hn="PopoverArrow",Bn=x.forwardRef((t,n)=>{const{__scopePopover:s,...r}=t,a=ue(s);return e.jsx(Lt,{...a,...r,ref:n})});Bn.displayName=Hn;function Et(t){return t?"open":"closed"}var Yn=wt,zn=St,Vn=Pt,Gn=$t;function Kn(){var o,u;const t=W(),[n,s]=x.useState(!1),r=x.useRef(null);function a(){s(!1)}const i=(o=t.playground)==null?void 0:o.appName;return e.jsx(e.Fragment,{children:e.jsxs(Yn,{open:n,onOpenChange:s,children:[e.jsx(zn,{asChild:!0,children:e.jsxs("button",{className:"flex h-full items-center gap-1 border-r px-6 py-3 font-mono text-sm uppercase","aria-label":"Relevant Files",children:[e.jsx(O,{name:"Files"}),"Files"]})}),e.jsx(Vn,{children:e.jsx(Gn,{ref:r,className:"slideRightContent lg:slideUpContent invert-theme z-10 select-none rounded bg-background px-9 py-8 text-foreground",align:"start",sideOffset:5,children:e.jsxs("div",{className:"launch-editor-wrapper",children:[e.jsx("strong",{className:"inline-block px-2 pb-4 font-semibold uppercase",children:"Relevant Files"}),t.problem&&((u=t.playground)==null?void 0:u.appName)!==t.problem.name?e.jsx("div",{className:"mb-2 rounded p-1 font-mono font-medium",children:e.jsx(Ae,{appName:t.problem.name})}):null,e.jsx("div",{id:"files",children:e.jsx(x.Suspense,{fallback:e.jsx(G,{content:"Loading diff",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(O,{name:"Refresh",className:"h-8 w-8 animate-spin"})})}),children:e.jsx(We,{resolve:t.diff,errorElement:e.jsx("div",{className:"text-foreground-danger",children:"Something went wrong."}),children:({diffFiles:l})=>{if(!l)return e.jsx("p",{className:"text-foreground-danger",children:"Unable to determine diff"});if(typeof l=="string")return e.jsx("p",{className:"text-foreground-danger",children:l});if(!l.length)return e.jsx("p",{children:"No files changed"});const h=i||ENV.EPICSHOP_GITHUB_ROOT?{}:{title:"You must 'Set to Playground' before opening a file",className:"not-allowed"};return e.jsxs("ul",{...h,children:[l.length>1&&!ENV.EPICSHOP_DEPLOYED?e.jsx("div",{className:"mb-2 border-b border-b-gray-50 border-opacity-50 pb-2 font-sans",children:e.jsx(ce,{appFile:l.map(c=>`${c.path},${c.line},1`),appName:"playground",onUpdate:a,children:e.jsx("p",{children:"Open All Files"})})}):null,l.map(c=>{var p;return e.jsx("li",{"data-state":c.status,children:e.jsx(ce,{appFile:`${c.path},${c.line},1`,appName:ENV.EPICSHOP_DEPLOYED?((p=t.problem)==null?void 0:p.name)??"playground":"playground",onUpdate:a,children:e.jsx("code",{children:c.path})})},c.path)})]})}})})})]})})})]})})}function Dt(t,n){var o;const s=(t==null?void 0:t.exerciseStepApp.exerciseNumber.toString().padStart(2,"0"))??"00",r=(t==null?void 0:t.exerciseStepApp.stepNumber.toString().padStart(2,"0"))??"00",a={problem:"💪",solution:"🏁"}[(t==null?void 0:t.type)??"problem"],i=((o=t==null?void 0:t[t.type])==null?void 0:o.title)??"N/A";return{emoji:a,stepNumber:r,title:i,exerciseNumber:s,exerciseTitle:(t==null?void 0:t.exerciseTitle)??"Unknown exercise",workshopTitle:n,type:(t==null?void 0:t.type)??"problem"}}const ys=({data:t,matches:n,params:s})=>{var h;const r=(h=n.find(c=>c.id==="root"))==null?void 0:h.data;if(!t||!r)return[{title:"🦉 | Error"}];const{emoji:a,stepNumber:i,title:o,exerciseNumber:u,exerciseTitle:l}=Dt(t);return ur({title:`${a} | ${i}. ${o} | ${u}. ${l} | ${r.workshopTitle}`,description:`${s.type} step for exercise ${u}. ${l}`,ogTitle:o,ogDescription:`${l} step ${Number(i)} ${s.type}`,instructor:r.instructor,requestInfo:r.requestInfo})},Se=["playground","problem","solution","tests","diff","chat"],Wn=t=>!!(t&&Se.includes(t));function qn(t,n,s){const r=new URLSearchParams(t);return s===null?r.delete(n):r.set(n,s),r}function Ns(){var p,g,y,S,d,$,T;const t=W(),[n]=Ie(),s=n.get("preview"),r=x.useRef(null),a=Dt(t),i=De(),o=Rt();function u(j){var R,A,E;if(j==="tests")return ENV.EPICSHOP_DEPLOYED||!t.playground||t.playground.test.type==="none";if(j==="problem"||j==="solution"){if(((R=t[j])==null?void 0:R.dev.type)==="none")return!0;if(ENV.EPICSHOP_DEPLOYED)return((A=t[j])==null?void 0:A.dev.type)!=="browser"&&!((E=t[j])!=null&&E.stackBlitzUrl)}return!!(j==="playground"&&ENV.EPICSHOP_DEPLOYED)}const l=Wn(s)?s:Se.find(j=>!u(j)),h=`/diff?${new URLSearchParams({app1:((p=t.problem)==null?void 0:p.name)??"",app2:((g=t.solution)==null?void 0:g.name)??""})}`;function c(j){j.altKey&&!j.ctrlKey&&!j.shiftKey&&!j.metaKey&&(j.preventDefault(),o(h))}return e.jsx("div",{className:"flex max-w-full flex-grow flex-col",children:e.jsxs("main",{className:"flex flex-grow flex-col sm:grid sm:h-full sm:min-h-[800px] sm:grid-cols-1 sm:grid-rows-2 md:min-h-[unset] lg:grid-cols-2 lg:grid-rows-1",children:[e.jsxs("div",{className:"relative flex flex-col sm:col-span-1 sm:row-span-1 sm:h-full lg:border-r",children:[e.jsx("h1",{className:"h-14 border-b pl-10 pr-5 text-sm font-medium leading-tight",children:e.jsxs("div",{className:"flex h-14 flex-wrap items-center justify-between gap-x-2 py-2",children:[e.jsxs("div",{className:"flex items-center justify-start gap-x-2 uppercase",children:[e.jsxs(ae,{to:`/${a.exerciseNumber}`,className:"hover:underline",children:[a.exerciseNumber,". ",a.exerciseTitle]}),"/",e.jsxs(ae,{to:".",className:"hover:underline",children:[a.stepNumber,". ",a.title," (",a.emoji," ",a.type,")"]})]}),t.problem&&((y=t.playground)==null?void 0:y.appName)!==t.problem.name?e.jsx("div",{className:"hidden md:block",children:e.jsx(Ae,{appName:t.problem.name})}):null]})}),e.jsx("article",{id:t.articleId,className:"shadow-on-scrollbox h-full w-full max-w-none flex-1 scroll-pt-6 space-y-6 overflow-y-auto p-2 scrollbar-thin scrollbar-thumb-scrollbar sm:p-10 sm:pt-8",children:t.exerciseStepApp.instructionsCode?e.jsx(mn,{inBrowserBrowserRef:r}):e.jsx("p",{children:"No instructions yet..."})},t.articleId),e.jsx(kt,{elementQuery:`#${t.articleId}`},`scroll-${t.articleId}`),t.type==="solution"?e.jsx(lr,{type:"step",exerciseNumber:t.exerciseStepApp.exerciseNumber,stepNumber:t.exerciseStepApp.stepNumber,className:"h-14 border-t px-6"}):null,e.jsxs("div",{className:"flex h-16 justify-between border-b-4 border-t lg:border-b-0",children:[e.jsx("div",{children:e.jsx("div",{className:"h-full",children:e.jsx(Kn,{})})}),e.jsx(ir,{appName:t.exerciseStepApp.name,relativePath:t.exerciseStepApp.relativePath}),e.jsx(ar,{prev:t.prevStepLink?{to:t.prevStepLink.to,"aria-label":"Previous Step"}:null,next:t.nextStepLink?{to:t.nextStepLink.to,"aria-label":"Next Step"}:null})]})]}),e.jsxs(Fr,{className:"relative flex flex-col overflow-y-auto sm:col-span-1 sm:row-span-1",value:l,children:[e.jsx(Lr,{className:"h-14 min-h-14 overflow-x-hidden border-b scrollbar-thin scrollbar-thumb-scrollbar",children:Se.map(j=>{const R=u(j);return e.jsx(Ar,{value:j,hidden:R,asChild:!0,children:e.jsx(ae,{id:`${j}-tab`,className:re("clip-path-button relative h-full px-6 py-4 font-mono text-sm uppercase outline-none radix-state-active:z-10 radix-state-active:bg-foreground radix-state-active:text-background radix-state-active:hover:bg-foreground/80 radix-state-active:hover:text-background/80 radix-state-inactive:hover:bg-foreground/20 radix-state-inactive:hover:text-foreground/80 focus:bg-foreground/80 focus:text-background/80",R?"hidden":"inline-block"),preventScrollReset:!0,prefetch:"intent",onClick:c,to:j==="diff"&&i?h:`?${qn(n,"preview",j==="playground"?null:j)}`,children:j})},j)})}),e.jsxs("div",{className:"relative z-10 flex min-h-96 flex-grow flex-col overflow-y-auto",children:[e.jsx(se,{value:"playground",className:"flex w-full flex-grow items-center justify-center self-start radix-state-inactive:hidden",children:e.jsx(cn,{appInfo:t.playground,problemAppName:(S=t.problem)==null?void 0:S.name,inBrowserBrowserRef:r,allApps:t.allApps,isUpToDate:((d=t.playground)==null?void 0:d.isUpToDate)??!1})}),e.jsx(se,{value:"problem",className:"flex w-full flex-grow items-center justify-center self-start radix-state-inactive:hidden",children:e.jsx(Ne,{appInfo:t.problem,inBrowserBrowserRef:r})}),e.jsx(se,{value:"solution",className:"flex w-full flex-grow items-center justify-center self-start radix-state-inactive:hidden",children:e.jsx(Ne,{appInfo:t.solution,inBrowserBrowserRef:r})}),e.jsx(se,{value:"tests",className:"flex w-full flex-grow items-start justify-center self-start overflow-hidden radix-state-inactive:hidden",children:e.jsx(On,{appInfo:t.playground,problemAppName:($=t.problem)==null?void 0:$.name,allApps:t.allApps,isUpToDate:((T=t.playground)==null?void 0:T.isUpToDate)??!1})}),e.jsx(se,{value:"diff",className:"flex h-full w-full flex-grow items-start justify-center self-start radix-state-inactive:hidden",children:e.jsx(nr,{diff:t.diff,allApps:t.allApps})}),e.jsx(se,{value:"chat",className:"flex h-full w-full flex-grow items-start justify-center self-start radix-state-inactive:hidden",children:e.jsx(qr,{})})]})]})]})})}function Ss(){return e.jsx(sr,{statusHandlers:{404:()=>e.jsx("p",{children:"Sorry, we couldn't find an app here."})}})}export{Ss as ErrorBoundary,Ns as default,ys as meta};
|
|
2
|
+
//# sourceMappingURL=_layout-Bn9QhWq9.js.map
|