@epic-web/workshop-app 6.88.1 → 6.89.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/build/client/assets/{_exerciseNumber-BkoIHU4s.js → _exerciseNumber-BZvzAp9f.js} +2 -2
  2. package/build/client/assets/{_exerciseNumber-BkoIHU4s.js.map → _exerciseNumber-BZvzAp9f.js.map} +1 -1
  3. package/build/client/assets/{_exerciseNumber_.finished-BRspQYAo.js → _exerciseNumber_.finished-D5eMZ_ok.js} +2 -2
  4. package/build/client/assets/{_exerciseNumber_.finished-BRspQYAo.js.map → _exerciseNumber_.finished-D5eMZ_ok.js.map} +1 -1
  5. package/build/client/assets/{_extra-qH2jDBa4.js → _extra-Bd0-gThk.js} +2 -2
  6. package/build/client/assets/{_extra-qH2jDBa4.js.map → _extra-Bd0-gThk.js.map} +1 -1
  7. package/build/client/assets/{_layout-Bg1RFS9D.js → _layout-CbP-ZGKA.js} +2 -2
  8. package/build/client/assets/{_layout-Bg1RFS9D.js.map → _layout-CbP-ZGKA.js.map} +1 -1
  9. package/build/client/assets/{app-BH96aYJx.js → app-BTlBQWy_.js} +2 -2
  10. package/build/client/assets/{app-BH96aYJx.js.map → app-BTlBQWy_.js.map} +1 -1
  11. package/build/client/assets/{cache-5tXauWqp.js → cache-Cjjb4Th1.js} +2 -2
  12. package/build/client/assets/{cache-5tXauWqp.js.map → cache-Cjjb4Th1.js.map} +1 -1
  13. package/build/client/assets/{db-CPB2ZdAy.js → db-n83JPsm9.js} +2 -2
  14. package/build/client/assets/{db-CPB2ZdAy.js.map → db-n83JPsm9.js.map} +1 -1
  15. package/build/client/assets/{diff-BncP0Faq.js → diff-C4LoXlDb.js} +3 -3
  16. package/build/client/assets/diff-C4LoXlDb.js.map +1 -0
  17. package/build/client/assets/{diff-IVQnB3Pk.js → diff-Fut2J8f5.js} +2 -2
  18. package/build/client/assets/{diff-IVQnB3Pk.js.map → diff-Fut2J8f5.js.map} +1 -1
  19. package/build/client/assets/{finished-CYdLPdvJ.js → finished-CsRM8483.js} +2 -2
  20. package/build/client/assets/{finished-CYdLPdvJ.js.map → finished-CsRM8483.js.map} +1 -1
  21. package/build/client/assets/{index-n4CWCwSA.js → index-BnHkUMN_.js} +2 -2
  22. package/build/client/assets/{index-n4CWCwSA.js.map → index-BnHkUMN_.js.map} +1 -1
  23. package/build/client/assets/{index-CKhNevM7.js → index-Bo0DKzj5.js} +2 -2
  24. package/build/client/assets/{index-CKhNevM7.js.map → index-Bo0DKzj5.js.map} +1 -1
  25. package/build/client/assets/{index-Cb8U85TK.js → index-m9K7ACZe.js} +2 -2
  26. package/build/client/assets/{index-Cb8U85TK.js.map → index-m9K7ACZe.js.map} +1 -1
  27. package/build/client/assets/launch-editor-C-8ah8qM.js +2 -0
  28. package/build/client/assets/launch-editor-C-8ah8qM.js.map +1 -0
  29. package/build/client/assets/{manifest-d6d8ad00.js → manifest-72875289.js} +1 -1
  30. package/build/client/assets/{mdx-Bvb9XNyL.js → mdx-C3Jl4O5D.js} +2 -2
  31. package/build/client/assets/{mdx-Bvb9XNyL.js.map → mdx-C3Jl4O5D.js.map} +1 -1
  32. package/build/client/assets/{playground-CEUo0DCy.js → playground-BV2y1ifv.js} +2 -2
  33. package/build/client/assets/{playground-CEUo0DCy.js.map → playground-BV2y1ifv.js.map} +1 -1
  34. package/build/client/assets/{preview-BS9wGiJ3.js → preview-Dav9KrHN.js} +2 -2
  35. package/build/client/assets/{preview-BS9wGiJ3.js.map → preview-Dav9KrHN.js.map} +1 -1
  36. package/build/server/index.js +36 -4
  37. package/build/server/index.js.map +1 -1
  38. package/package.json +3 -3
  39. package/build/client/assets/diff-BncP0Faq.js.map +0 -1
  40. package/build/client/assets/launch-editor-C8OwTN5L.js +0 -2
  41. package/build/client/assets/launch-editor-C8OwTN5L.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{w as o,b as a,d as m,k as p}from"./chunk-JZWAC4HX-BuixXc9D.js";import{j as s}from"./jsx-runtime-C5WNSv3b.js";import{d as n,c}from"./misc-D9k_mI0z.js";import{U as f}from"./diff-BncP0Faq.js";import{N as d}from"./nav-chevrons-DUMNZcNc.js";import"./index-Bi6L2ga8.js";import"./react-error-boundary-DFNLMQmr.js";import"./tooltip-H74tOFSr.js";import"./index-B2VNpNxJ.js";import"./index-BvE6USCZ.js";import"./index-DosQrH9F.js";import"./preload-helper-BXl3LOEh.js";import"./index-DSpM0ReJ.js";import"./root-loader-DAxaiFMN.js";import"./pe-D585gnmh.js";import"./schemas-siASSt6b.js";import"./launch-editor-C8OwTN5L.js";import"./progress-bar-BCbq1CuC.js";import"./epic-video-C9q0z-QM.js";import"./loading-BjV0PtX2.js";import"./index-E_6kulJP.js";import"./online-x7UFobEJ.js";import"./format-CZ5n8p10.js";import"./user-DhjrtSbZ.js";import"./workshop-config-v_LiyFvY.js";import"./revalidation-ws-JHvxsHsY.js";const G=o(function(){const r=a(),[i]=m();new URLSearchParams(i).set("forceFresh","diff");const t=p(),e=n.useSpinDelay(t.state!=="idle",{delay:200,minDuration:200});return s.jsxs("div",{className:c("h-screen-safe relative",{"cursor-wait opacity-30":e}),children:[s.jsx("div",{className:"h-full pb-16",children:s.jsx(f,{diff:r.diff,allApps:r.allApps,userHasAccessPromise:r.userHasAccessPromise})}),s.jsx("div",{className:"bg-background fixed inset-x-0 bottom-0 z-10 flex h-16 items-center justify-end border-t",children:s.jsx("div",{className:"flex h-full items-center justify-end",children:s.jsx(d,{prev:r.prevLink,next:r.nextLink})})})]})});export{G as default};
2
- //# sourceMappingURL=diff-IVQnB3Pk.js.map
1
+ import{w as o,b as a,d as m,k as p}from"./chunk-JZWAC4HX-BuixXc9D.js";import{j as s}from"./jsx-runtime-C5WNSv3b.js";import{d as n,c}from"./misc-D9k_mI0z.js";import{U as f}from"./diff-C4LoXlDb.js";import{N as d}from"./nav-chevrons-DUMNZcNc.js";import"./index-Bi6L2ga8.js";import"./react-error-boundary-DFNLMQmr.js";import"./tooltip-H74tOFSr.js";import"./index-B2VNpNxJ.js";import"./index-BvE6USCZ.js";import"./index-DosQrH9F.js";import"./preload-helper-BXl3LOEh.js";import"./index-DSpM0ReJ.js";import"./root-loader-DAxaiFMN.js";import"./pe-D585gnmh.js";import"./schemas-siASSt6b.js";import"./launch-editor-C-8ah8qM.js";import"./progress-bar-BCbq1CuC.js";import"./epic-video-C9q0z-QM.js";import"./loading-BjV0PtX2.js";import"./index-E_6kulJP.js";import"./online-x7UFobEJ.js";import"./format-CZ5n8p10.js";import"./user-DhjrtSbZ.js";import"./workshop-config-v_LiyFvY.js";import"./revalidation-ws-JHvxsHsY.js";const G=o(function(){const r=a(),[i]=m();new URLSearchParams(i).set("forceFresh","diff");const t=p(),e=n.useSpinDelay(t.state!=="idle",{delay:200,minDuration:200});return s.jsxs("div",{className:c("h-screen-safe relative",{"cursor-wait opacity-30":e}),children:[s.jsx("div",{className:"h-full pb-16",children:s.jsx(f,{diff:r.diff,allApps:r.allApps,userHasAccessPromise:r.userHasAccessPromise})}),s.jsx("div",{className:"bg-background fixed inset-x-0 bottom-0 z-10 flex h-16 items-center justify-end border-t",children:s.jsx("div",{className:"flex h-full items-center justify-end",children:s.jsx(d,{prev:r.prevLink,next:r.nextLink})})})]})});export{G as default};
2
+ //# sourceMappingURL=diff-Fut2J8f5.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"diff-IVQnB3Pk.js","sources":["../../../app/routes/diff.tsx"],"sourcesContent":["import { type Route } from './+types/diff'\nimport {\n\tgetAppByName,\n\tgetAppDisplayName,\n\tgetApps,\n\tisExerciseStepApp,\n} from '@epic-web/workshop-utils/apps.server'\nimport { getDiffPatch } from '@epic-web/workshop-utils/diff.server'\nimport { userHasAccessToWorkshop } from '@epic-web/workshop-utils/epic-api.server'\nimport { makeTimings } from '@epic-web/workshop-utils/timing.server'\nimport { useLoaderData, useNavigation, useSearchParams } from 'react-router'\nimport { useSpinDelay } from 'spin-delay'\nimport { Diff } from '#app/components/diff.tsx'\nimport { NavChevrons } from '#app/components/nav-chevrons.tsx'\nimport { cn } from '#app/utils/misc.tsx'\n\nexport async function loader({ request }: Route.LoaderArgs) {\n\tconst reqUrl = new URL(request.url)\n\tconst searchParams = reqUrl.searchParams\n\tconst timings = makeTimings('diffLoader')\n\tconst cacheOptions = { request, timings }\n\tconst allAppsFull = await getApps()\n\tconst app1Name = reqUrl.searchParams.get('app1')\n\tconst app2Name = reqUrl.searchParams.get('app2')\n\n\tconst usingDefaultApp1 = !app1Name\n\n\t// defaults to first problem app\n\tconst app1 = app1Name\n\t\t? await getAppByName(app1Name)\n\t\t: allAppsFull.filter(isExerciseStepApp).at(0)\n\n\t// defaults to last exercise step app\n\tconst app2 = app2Name\n\t\t? await getAppByName(app2Name)\n\t\t: allAppsFull.filter(isExerciseStepApp).at(-1)\n\n\tasync function getDiffProp() {\n\t\tif (!app1 || !app2) {\n\t\t\treturn {\n\t\t\t\tapp1: app1?.name,\n\t\t\t\tapp2: app2?.name,\n\t\t\t\tdiffPatch: null,\n\t\t\t}\n\t\t}\n\t\tconst diffPatch = await getDiffPatch(app1, app2, {\n\t\t\t...cacheOptions,\n\t\t\tforceFresh: searchParams.get('forceFresh') === 'diff',\n\t\t}).catch((e) => {\n\t\t\tconsole.error(e)\n\t\t\treturn null\n\t\t})\n\t\treturn {\n\t\t\tapp1: app1.name,\n\t\t\tapp2: app2.name,\n\t\t\tdiffPatch,\n\t\t}\n\t}\n\n\tconst allApps = allAppsFull\n\t\t.filter((a, i, ar) => ar.findIndex((b) => a.name === b.name) === i)\n\t\t.map((a) => ({\n\t\t\tdisplayName: getAppDisplayName(a, allAppsFull),\n\t\t\tname: a.name,\n\t\t\ttitle: a.title,\n\t\t\ttype: a.type,\n\t\t}))\n\n\tconst diff = getDiffProp()\n\tconst app1Index = allApps.findIndex((a) => a.name === app1?.name)\n\tconst prevApp1Index = usingDefaultApp1\n\t\t? allApps.length - 2\n\t\t: app1Index === 0\n\t\t\t? -2\n\t\t\t: app1Index - 1\n\tconst prevApp2Index = prevApp1Index + 1\n\tconst nextApp1Index = usingDefaultApp1\n\t\t? 0\n\t\t: app1Index + 1 < allApps.length\n\t\t\t? app1Index + 1\n\t\t\t: -2\n\tconst nextApp2Index = nextApp1Index + 1\n\tconst prevApp1 = allAppsFull[prevApp1Index]?.name\n\tconst prevApp2 = allAppsFull[prevApp2Index]?.name\n\tconst nextApp1 = allAppsFull[nextApp1Index]?.name\n\tconst nextApp2 = allAppsFull[nextApp2Index]?.name\n\tconst prevSearchParams = new URLSearchParams(reqUrl.searchParams)\n\tprevSearchParams.set('app1', prevApp1 ?? '')\n\tprevSearchParams.set('app2', prevApp2 ?? '')\n\tconst nextSearchParams = new URLSearchParams(reqUrl.searchParams)\n\tnextSearchParams.set('app1', nextApp1 ?? '')\n\tnextSearchParams.set('app2', nextApp2 ?? '')\n\treturn {\n\t\tuserHasAccessPromise: userHasAccessToWorkshop({ request, timings }),\n\t\tallApps,\n\t\tdiff,\n\t\tprevLink:\n\t\t\tprevApp1 && prevApp2\n\t\t\t\t? { to: `/diff?${prevSearchParams}`, 'aria-label': 'Previous App' }\n\t\t\t\t: { to: '/diff' },\n\t\tnextLink:\n\t\t\tnextApp1 && nextApp2\n\t\t\t\t? { to: `/diff?${nextSearchParams}`, 'aria-label': 'Next App' }\n\t\t\t\t: { to: '/diff' },\n\t}\n}\n\nexport default function DiffViewer() {\n\tconst data = useLoaderData<typeof loader>()\n\tconst [params] = useSearchParams()\n\tconst paramsWithForcedRefresh = new URLSearchParams(params)\n\tparamsWithForcedRefresh.set('forceFresh', 'diff')\n\tconst navigation = useNavigation()\n\tconst isNavigating = useSpinDelay(navigation.state !== 'idle', {\n\t\tdelay: 200,\n\t\tminDuration: 200,\n\t})\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cn('h-screen-safe relative', {\n\t\t\t\t'cursor-wait opacity-30': isNavigating,\n\t\t\t})}\n\t\t>\n\t\t\t<div className=\"h-full pb-16\">\n\t\t\t\t<Diff\n\t\t\t\t\tdiff={data.diff}\n\t\t\t\t\tallApps={data.allApps}\n\t\t\t\t\tuserHasAccessPromise={data.userHasAccessPromise}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div className=\"bg-background fixed inset-x-0 bottom-0 z-10 flex h-16 items-center justify-end border-t\">\n\t\t\t\t<div className=\"flex h-full items-center justify-end\">\n\t\t\t\t\t<NavChevrons prev={data.prevLink} next={data.nextLink} />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"names":["diff","_UNSAFE_withComponentProps","data","useLoaderData","params","useSearchParams","URLSearchParams","set","navigation","useNavigation","isNavigating","useSpinDelay","state","delay","minDuration","jsxs","className","cn","children","jsx","Diff","allApps","userHasAccessPromise","NavChevrons","prev","prevLink","next","nextLink"],"mappings":"y4BA2GA,MAAAA,EAAAC,EAAA,UAAqC,CACpC,MAAMC,EAAOC,EAAA,EACP,CAACC,CAAM,EAAIC,EAAA,EACe,IAAIC,gBAAgBF,CAAM,EAClCG,IAAI,aAAc,MAAM,EAChD,MAAMC,EAAaC,EAAA,EACbC,EAAeC,EAAAA,aAAaH,EAAWI,QAAU,OAAQ,CAC9DC,MAAO,IACPC,YAAa,GACd,CAAC,EAED,OACCC,EAAAA,KAAC,MAAA,CACAC,UAAWC,EAAG,yBAA0B,CACvC,yBAA0BP,CAC3B,CAAC,EAEDQ,SAAA,CAAAC,EAAAA,IAAC,MAAA,CAAIH,UAAU,eACdE,SAAAC,EAAAA,IAACC,EAAA,CACApB,KAAME,EAAKF,KACXqB,QAASnB,EAAKmB,QACdC,qBAAsBpB,EAAKoB,qBAC5B,CAAA,CACD,QACC,MAAA,CAAIN,UAAU,0FACdE,SAAAC,EAAAA,IAAC,OAAIH,UAAU,uCACdE,SAAAC,EAAAA,IAACI,EAAA,CAAYC,KAAMtB,EAAKuB,SAAUC,KAAMxB,EAAKyB,SAAU,EACxD,CAAA,CACD,CAAA,CAAA,CACD,CAEF,CAAA"}
1
+ {"version":3,"file":"diff-Fut2J8f5.js","sources":["../../../app/routes/diff.tsx"],"sourcesContent":["import { type Route } from './+types/diff'\nimport {\n\tgetAppByName,\n\tgetAppDisplayName,\n\tgetApps,\n\tisExerciseStepApp,\n} from '@epic-web/workshop-utils/apps.server'\nimport { getDiffPatch } from '@epic-web/workshop-utils/diff.server'\nimport { userHasAccessToWorkshop } from '@epic-web/workshop-utils/epic-api.server'\nimport { makeTimings } from '@epic-web/workshop-utils/timing.server'\nimport { useLoaderData, useNavigation, useSearchParams } from 'react-router'\nimport { useSpinDelay } from 'spin-delay'\nimport { Diff } from '#app/components/diff.tsx'\nimport { NavChevrons } from '#app/components/nav-chevrons.tsx'\nimport { cn } from '#app/utils/misc.tsx'\n\nexport async function loader({ request }: Route.LoaderArgs) {\n\tconst reqUrl = new URL(request.url)\n\tconst searchParams = reqUrl.searchParams\n\tconst timings = makeTimings('diffLoader')\n\tconst cacheOptions = { request, timings }\n\tconst allAppsFull = await getApps()\n\tconst app1Name = reqUrl.searchParams.get('app1')\n\tconst app2Name = reqUrl.searchParams.get('app2')\n\n\tconst usingDefaultApp1 = !app1Name\n\n\t// defaults to first problem app\n\tconst app1 = app1Name\n\t\t? await getAppByName(app1Name)\n\t\t: allAppsFull.filter(isExerciseStepApp).at(0)\n\n\t// defaults to last exercise step app\n\tconst app2 = app2Name\n\t\t? await getAppByName(app2Name)\n\t\t: allAppsFull.filter(isExerciseStepApp).at(-1)\n\n\tasync function getDiffProp() {\n\t\tif (!app1 || !app2) {\n\t\t\treturn {\n\t\t\t\tapp1: app1?.name,\n\t\t\t\tapp2: app2?.name,\n\t\t\t\tdiffPatch: null,\n\t\t\t}\n\t\t}\n\t\tconst diffPatch = await getDiffPatch(app1, app2, {\n\t\t\t...cacheOptions,\n\t\t\tforceFresh: searchParams.get('forceFresh') === 'diff',\n\t\t}).catch((e) => {\n\t\t\tconsole.error(e)\n\t\t\treturn null\n\t\t})\n\t\treturn {\n\t\t\tapp1: app1.name,\n\t\t\tapp2: app2.name,\n\t\t\tdiffPatch,\n\t\t}\n\t}\n\n\tconst allApps = allAppsFull\n\t\t.filter((a, i, ar) => ar.findIndex((b) => a.name === b.name) === i)\n\t\t.map((a) => ({\n\t\t\tdisplayName: getAppDisplayName(a, allAppsFull),\n\t\t\tname: a.name,\n\t\t\ttitle: a.title,\n\t\t\ttype: a.type,\n\t\t}))\n\n\tconst diff = getDiffProp()\n\tconst app1Index = allApps.findIndex((a) => a.name === app1?.name)\n\tconst prevApp1Index = usingDefaultApp1\n\t\t? allApps.length - 2\n\t\t: app1Index === 0\n\t\t\t? -2\n\t\t\t: app1Index - 1\n\tconst prevApp2Index = prevApp1Index + 1\n\tconst nextApp1Index = usingDefaultApp1\n\t\t? 0\n\t\t: app1Index + 1 < allApps.length\n\t\t\t? app1Index + 1\n\t\t\t: -2\n\tconst nextApp2Index = nextApp1Index + 1\n\tconst prevApp1 = allAppsFull[prevApp1Index]?.name\n\tconst prevApp2 = allAppsFull[prevApp2Index]?.name\n\tconst nextApp1 = allAppsFull[nextApp1Index]?.name\n\tconst nextApp2 = allAppsFull[nextApp2Index]?.name\n\tconst prevSearchParams = new URLSearchParams(reqUrl.searchParams)\n\tprevSearchParams.set('app1', prevApp1 ?? '')\n\tprevSearchParams.set('app2', prevApp2 ?? '')\n\tconst nextSearchParams = new URLSearchParams(reqUrl.searchParams)\n\tnextSearchParams.set('app1', nextApp1 ?? '')\n\tnextSearchParams.set('app2', nextApp2 ?? '')\n\treturn {\n\t\tuserHasAccessPromise: userHasAccessToWorkshop({ request, timings }),\n\t\tallApps,\n\t\tdiff,\n\t\tprevLink:\n\t\t\tprevApp1 && prevApp2\n\t\t\t\t? { to: `/diff?${prevSearchParams}`, 'aria-label': 'Previous App' }\n\t\t\t\t: { to: '/diff' },\n\t\tnextLink:\n\t\t\tnextApp1 && nextApp2\n\t\t\t\t? { to: `/diff?${nextSearchParams}`, 'aria-label': 'Next App' }\n\t\t\t\t: { to: '/diff' },\n\t}\n}\n\nexport default function DiffViewer() {\n\tconst data = useLoaderData<typeof loader>()\n\tconst [params] = useSearchParams()\n\tconst paramsWithForcedRefresh = new URLSearchParams(params)\n\tparamsWithForcedRefresh.set('forceFresh', 'diff')\n\tconst navigation = useNavigation()\n\tconst isNavigating = useSpinDelay(navigation.state !== 'idle', {\n\t\tdelay: 200,\n\t\tminDuration: 200,\n\t})\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cn('h-screen-safe relative', {\n\t\t\t\t'cursor-wait opacity-30': isNavigating,\n\t\t\t})}\n\t\t>\n\t\t\t<div className=\"h-full pb-16\">\n\t\t\t\t<Diff\n\t\t\t\t\tdiff={data.diff}\n\t\t\t\t\tallApps={data.allApps}\n\t\t\t\t\tuserHasAccessPromise={data.userHasAccessPromise}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div className=\"bg-background fixed inset-x-0 bottom-0 z-10 flex h-16 items-center justify-end border-t\">\n\t\t\t\t<div className=\"flex h-full items-center justify-end\">\n\t\t\t\t\t<NavChevrons prev={data.prevLink} next={data.nextLink} />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"names":["diff","_UNSAFE_withComponentProps","data","useLoaderData","params","useSearchParams","URLSearchParams","set","navigation","useNavigation","isNavigating","useSpinDelay","state","delay","minDuration","jsxs","className","cn","children","jsx","Diff","allApps","userHasAccessPromise","NavChevrons","prev","prevLink","next","nextLink"],"mappings":"y4BA2GA,MAAAA,EAAAC,EAAA,UAAqC,CACpC,MAAMC,EAAOC,EAAA,EACP,CAACC,CAAM,EAAIC,EAAA,EACe,IAAIC,gBAAgBF,CAAM,EAClCG,IAAI,aAAc,MAAM,EAChD,MAAMC,EAAaC,EAAA,EACbC,EAAeC,EAAAA,aAAaH,EAAWI,QAAU,OAAQ,CAC9DC,MAAO,IACPC,YAAa,GACd,CAAC,EAED,OACCC,EAAAA,KAAC,MAAA,CACAC,UAAWC,EAAG,yBAA0B,CACvC,yBAA0BP,CAC3B,CAAC,EAEDQ,SAAA,CAAAC,EAAAA,IAAC,MAAA,CAAIH,UAAU,eACdE,SAAAC,EAAAA,IAACC,EAAA,CACApB,KAAME,EAAKF,KACXqB,QAASnB,EAAKmB,QACdC,qBAAsBpB,EAAKoB,qBAC5B,CAAA,CACD,QACC,MAAA,CAAIN,UAAU,0FACdE,SAAAC,EAAAA,IAAC,OAAIH,UAAU,uCACdE,SAAAC,EAAAA,IAACI,EAAA,CAAYC,KAAMtB,EAAKuB,SAAUC,KAAMxB,EAAKyB,SAAU,EACxD,CAAA,CACD,CAAA,CAAA,CACD,CAEF,CAAA"}
@@ -1,2 +1,2 @@
1
- import{w as n,L as l}from"./chunk-JZWAC4HX-BuixXc9D.js";import{j as e}from"./jsx-runtime-C5WNSv3b.js";import{E as a}from"./index-3PqfcnMA.js";import{r as c}from"./index-Bi6L2ga8.js";import{E as m}from"./epic-video-C9q0z-QM.js";import{I as d,c as p}from"./misc-D9k_mI0z.js";import{L as f}from"./loading-BjV0PtX2.js";import{N as h}from"./nav-chevrons-DUMNZcNc.js";import{R as x}from"./retrieval-practice-ZEACmMc2.js";import{u}from"./revalidation-ws-JHvxsHsY.js";import{M as j}from"./mdx-Bvb9XNyL.js";import{u as b}from"./online-x7UFobEJ.js";import{g}from"./root-loader-DAxaiFMN.js";import{g as v}from"./seo-t5J-DRxw.js";import{E as w}from"./launch-editor-C8OwTN5L.js";import{P as N}from"./progress-BvO_W5nB.js";import{u as k}from"./index-DSpM0ReJ.js";import"./index-E_6kulJP.js";import"./index-B2VNpNxJ.js";import"./schemas-siASSt6b.js";import"./tooltip-H74tOFSr.js";import"./format-CZ5n8p10.js";import"./user-DhjrtSbZ.js";import"./workshop-config-v_LiyFvY.js";import"./preload-helper-BXl3LOEh.js";import"./progress-bar-BCbq1CuC.js";import"./pe-D585gnmh.js";const ee={getSitemapEntries:()=>[{route:"/finished"}]},se=({matches:r})=>{const s=g(r);return s?v({title:`🎉 ${s?.workshopTitle}`,description:`Elaboration for ${s?.workshopTitle}`,ogTitle:`Finished ${s?.workshopTitle}`,ogDescription:"You finished! Time to submit feedback.",instructor:s.instructor,requestInfo:s.requestInfo}):[]},E={h1:()=>null},re=n(function({loaderData:s}){return u({watchPaths:["./exercises/FINISHED.mdx"]}),e.jsx("div",{className:"flex h-full grow flex-col",children:e.jsxs("main",{className:"grid h-full grow grid-cols-1 grid-rows-2 lg:grid-cols-2 lg:grid-rows-1",children:[e.jsxs("div",{className:"relative col-span-1 row-span-1 flex h-full flex-col lg:border-r",children:[e.jsx("h1",{className:"h-14 border-b pr-5 pl-10 text-sm leading-none font-medium uppercase",children:e.jsx("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",children:[e.jsx(l,{to:"/",className:"hover:underline",children:s.workshopTitle}),e.jsx("span",{children:"/"}),e.jsx("span",{children:"Elaboration"})]})})}),e.jsxs("article",{className:"shadow-on-scrollbox scrollbar-thin scrollbar-thumb-scrollbar h-full w-full max-w-none flex-1 scroll-pt-6 space-y-6 overflow-y-auto p-2 sm:p-10 sm:pt-8",id:s.articleId,children:[s.finishedCode?e.jsx(m,{epicVideoInfosPromise:s.epicVideoInfosPromise,children:e.jsx("div",{className:"prose dark:prose-invert sm:prose-lg",children:e.jsx(j,{code:s.finishedCode,components:E})})}):"No finished instructions yet...",e.jsx(x,{})]}),e.jsx(a,{elementQuery:`#${s.articleId}`}),e.jsx(N,{type:"workshop-finished",className:"h-14 border-t px-6"}),e.jsxs("div",{className:"@container flex h-16 justify-between border-t border-b-4 lg:border-b-0",children:[e.jsx("div",{}),s.workshopFinished.status==="success"?e.jsx(w,{file:s.workshopFinished.file,relativePath:s.workshopFinished.relativePath}):null,e.jsx(h,{prev:s.prevStepLink,next:{to:"/"}})]})]}),e.jsx(y,{workshopTitle:s.workshopTitle,workshopFormEmbedUrl:s.workshopFormEmbedUrl})]})})});function y({workshopTitle:r,workshopFormEmbedUrl:s}){const t=k(),[o,i]=c.useState(!1);return b()?e.jsxs("div",{className:"relative shrink-0",children:[o?null:e.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:e.jsx(f,{children:e.jsxs("span",{children:["Loading ",r," Elaboration form"]})})}),e.jsx("iframe",{onLoad:()=>i(!0),onError:()=>i(!0),title:"Elaboration",src:s,className:p("absolute inset-0 flex h-full w-full transition-opacity duration-300",o?"opacity-100":"opacity-0"),style:{colorScheme:t}})]}):e.jsx("div",{className:"relative shrink-0",children:e.jsx("div",{className:"text-foreground-destructive absolute inset-0 z-10 flex items-center justify-center",children:e.jsx(d,{name:"WifiNoConnection",size:"xl",children:e.jsxs("span",{children:["Unable to load the ",e.jsx("a",{href:s,className:"underline",children:`${r} feedback form`})," when offline"]})})})})}export{re as default,ee as handle,se as meta};
2
- //# sourceMappingURL=finished-CYdLPdvJ.js.map
1
+ import{w as n,L as l}from"./chunk-JZWAC4HX-BuixXc9D.js";import{j as e}from"./jsx-runtime-C5WNSv3b.js";import{E as a}from"./index-3PqfcnMA.js";import{r as c}from"./index-Bi6L2ga8.js";import{E as m}from"./epic-video-C9q0z-QM.js";import{I as d,c as p}from"./misc-D9k_mI0z.js";import{L as f}from"./loading-BjV0PtX2.js";import{N as h}from"./nav-chevrons-DUMNZcNc.js";import{R as x}from"./retrieval-practice-ZEACmMc2.js";import{u}from"./revalidation-ws-JHvxsHsY.js";import{M as j}from"./mdx-C3Jl4O5D.js";import{u as b}from"./online-x7UFobEJ.js";import{g}from"./root-loader-DAxaiFMN.js";import{g as v}from"./seo-t5J-DRxw.js";import{E as w}from"./launch-editor-C-8ah8qM.js";import{P as N}from"./progress-BvO_W5nB.js";import{u as k}from"./index-DSpM0ReJ.js";import"./index-E_6kulJP.js";import"./index-B2VNpNxJ.js";import"./schemas-siASSt6b.js";import"./tooltip-H74tOFSr.js";import"./format-CZ5n8p10.js";import"./user-DhjrtSbZ.js";import"./workshop-config-v_LiyFvY.js";import"./preload-helper-BXl3LOEh.js";import"./progress-bar-BCbq1CuC.js";import"./pe-D585gnmh.js";const ee={getSitemapEntries:()=>[{route:"/finished"}]},se=({matches:r})=>{const s=g(r);return s?v({title:`🎉 ${s?.workshopTitle}`,description:`Elaboration for ${s?.workshopTitle}`,ogTitle:`Finished ${s?.workshopTitle}`,ogDescription:"You finished! Time to submit feedback.",instructor:s.instructor,requestInfo:s.requestInfo}):[]},E={h1:()=>null},re=n(function({loaderData:s}){return u({watchPaths:["./exercises/FINISHED.mdx"]}),e.jsx("div",{className:"flex h-full grow flex-col",children:e.jsxs("main",{className:"grid h-full grow grid-cols-1 grid-rows-2 lg:grid-cols-2 lg:grid-rows-1",children:[e.jsxs("div",{className:"relative col-span-1 row-span-1 flex h-full flex-col lg:border-r",children:[e.jsx("h1",{className:"h-14 border-b pr-5 pl-10 text-sm leading-none font-medium uppercase",children:e.jsx("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",children:[e.jsx(l,{to:"/",className:"hover:underline",children:s.workshopTitle}),e.jsx("span",{children:"/"}),e.jsx("span",{children:"Elaboration"})]})})}),e.jsxs("article",{className:"shadow-on-scrollbox scrollbar-thin scrollbar-thumb-scrollbar h-full w-full max-w-none flex-1 scroll-pt-6 space-y-6 overflow-y-auto p-2 sm:p-10 sm:pt-8",id:s.articleId,children:[s.finishedCode?e.jsx(m,{epicVideoInfosPromise:s.epicVideoInfosPromise,children:e.jsx("div",{className:"prose dark:prose-invert sm:prose-lg",children:e.jsx(j,{code:s.finishedCode,components:E})})}):"No finished instructions yet...",e.jsx(x,{})]}),e.jsx(a,{elementQuery:`#${s.articleId}`}),e.jsx(N,{type:"workshop-finished",className:"h-14 border-t px-6"}),e.jsxs("div",{className:"@container flex h-16 justify-between border-t border-b-4 lg:border-b-0",children:[e.jsx("div",{}),s.workshopFinished.status==="success"?e.jsx(w,{file:s.workshopFinished.file,relativePath:s.workshopFinished.relativePath}):null,e.jsx(h,{prev:s.prevStepLink,next:{to:"/"}})]})]}),e.jsx(y,{workshopTitle:s.workshopTitle,workshopFormEmbedUrl:s.workshopFormEmbedUrl})]})})});function y({workshopTitle:r,workshopFormEmbedUrl:s}){const t=k(),[o,i]=c.useState(!1);return b()?e.jsxs("div",{className:"relative shrink-0",children:[o?null:e.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:e.jsx(f,{children:e.jsxs("span",{children:["Loading ",r," Elaboration form"]})})}),e.jsx("iframe",{onLoad:()=>i(!0),onError:()=>i(!0),title:"Elaboration",src:s,className:p("absolute inset-0 flex h-full w-full transition-opacity duration-300",o?"opacity-100":"opacity-0"),style:{colorScheme:t}})]}):e.jsx("div",{className:"relative shrink-0",children:e.jsx("div",{className:"text-foreground-destructive absolute inset-0 z-10 flex items-center justify-center",children:e.jsx(d,{name:"WifiNoConnection",size:"xl",children:e.jsxs("span",{children:["Unable to load the ",e.jsx("a",{href:s,className:"underline",children:`${r} feedback form`})," when offline"]})})})})}export{re as default,ee as handle,se as meta};
2
+ //# sourceMappingURL=finished-CsRM8483.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"finished-CYdLPdvJ.js","sources":["../../../app/routes/_app+/finished.tsx"],"sourcesContent":["import { ElementScrollRestoration } from '@epic-web/restore-scroll'\nimport {\n\tgetExercises,\n\tgetWorkshopFinished,\n} from '@epic-web/workshop-utils/apps.server'\nimport { getWorkshopConfig } from '@epic-web/workshop-utils/config.server'\nimport { getEpicVideoInfos } from '@epic-web/workshop-utils/epic-api.server'\nimport {\n\tcombineServerTimings,\n\tgetServerTimeHeader,\n\tmakeTimings,\n\ttime,\n} from '@epic-web/workshop-utils/timing.server'\nimport { type SEOHandle } from '@nasa-gcn/remix-seo'\nimport slugify from '@sindresorhus/slugify'\nimport * as React from 'react'\nimport { data, type HeadersFunction, Link } from 'react-router'\nimport { EpicVideoInfoProvider } from '#app/components/epic-video.tsx'\nimport { Icon } from '#app/components/icons.tsx'\nimport { Loading } from '#app/components/loading.tsx'\nimport { NavChevrons } from '#app/components/nav-chevrons.tsx'\nimport { RetrievalPractice } from '#app/components/retrieval-practice.tsx'\nimport { useRevalidationWS } from '#app/components/revalidation-ws.tsx'\nimport { Mdx } from '#app/utils/mdx.tsx'\nimport { cn } from '#app/utils/misc.tsx'\nimport { useIsOnline } from '#app/utils/online.ts'\nimport { getRootMatchLoaderData } from '#app/utils/root-loader.ts'\nimport { getSeoMetaTags } from '#app/utils/seo.ts'\nimport { EditFileOnGitHub } from '../launch-editor.tsx'\nimport { ProgressToggle } from '../progress.tsx'\nimport { useTheme } from '../theme/index.tsx'\nimport { type Route } from './+types/finished.tsx'\n\nexport const handle: SEOHandle = {\n\tgetSitemapEntries: () => [{ route: '/finished' }],\n}\n\nexport const meta: Route.MetaFunction = ({ matches }) => {\n\tconst rootData = getRootMatchLoaderData(matches)\n\tif (!rootData) return []\n\n\treturn getSeoMetaTags({\n\t\ttitle: `🎉 ${rootData?.workshopTitle}`,\n\t\tdescription: `Elaboration for ${rootData?.workshopTitle}`,\n\t\togTitle: `Finished ${rootData?.workshopTitle}`,\n\t\togDescription: `You finished! Time to submit feedback.`,\n\t\tinstructor: rootData.instructor,\n\t\trequestInfo: rootData.requestInfo,\n\t})\n}\n\nexport async function loader({ request }: Route.LoaderArgs) {\n\tconst timings = makeTimings('finishedLoader')\n\tconst exercises = await getExercises({ request, timings })\n\tconst compiledFinished = await time(() => getWorkshopFinished({ request }), {\n\t\ttimings,\n\t\ttype: 'compileMdx',\n\t\tdesc: 'compileMdx in finished',\n\t})\n\n\tconst lastExercises = exercises[exercises.length - 1]\n\tconst workshopConfig = getWorkshopConfig()\n\tconst workshopTitle = workshopConfig.title\n\tconst workshopFormTemplate = workshopConfig.forms.workshop\n\tconst workshopFormEmbedUrl = workshopFormTemplate.replace(\n\t\t'{workshopTitle}',\n\t\tencodeURIComponent(workshopTitle),\n\t)\n\treturn data(\n\t\t{\n\t\t\tarticleId: `workshop-${slugify(workshopTitle)}-finished`,\n\t\t\tworkshopTitle,\n\t\t\tworkshopFormEmbedUrl,\n\t\t\tfinishedCode:\n\t\t\t\tcompiledFinished.compiled.status === 'success'\n\t\t\t\t\t? compiledFinished.compiled.code\n\t\t\t\t\t: null,\n\t\t\tepicVideoInfosPromise:\n\t\t\t\tcompiledFinished.compiled.status === 'success'\n\t\t\t\t\t? getEpicVideoInfos(compiledFinished.compiled.epicVideoEmbeds, {\n\t\t\t\t\t\t\trequest,\n\t\t\t\t\t\t})\n\t\t\t\t\t: null,\n\t\t\tworkshopFinished: {\n\t\t\t\tstatus: compiledFinished.compiled.status,\n\t\t\t\tfile: compiledFinished.file,\n\t\t\t\trelativePath: compiledFinished.relativePath,\n\t\t\t},\n\t\t\tprevStepLink: lastExercises\n\t\t\t\t? {\n\t\t\t\t\t\tto: `/${lastExercises.exerciseNumber}/finished`,\n\t\t\t\t\t}\n\t\t\t\t: null,\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 }\n\nexport default function ExerciseFinished({\n\tloaderData: data,\n}: Route.ComponentProps) {\n\tuseRevalidationWS({ watchPaths: ['./exercises/FINISHED.mdx'] })\n\treturn (\n\t\t<div className=\"flex h-full grow flex-col\">\n\t\t\t<main className=\"grid h-full grow grid-cols-1 grid-rows-2 lg:grid-cols-2 lg:grid-rows-1\">\n\t\t\t\t<div className=\"relative col-span-1 row-span-1 flex h-full flex-col lg:border-r\">\n\t\t\t\t\t<h1 className=\"h-14 border-b pr-5 pl-10 text-sm leading-none font-medium uppercase\">\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=\"/\" className=\"hover:underline\">\n\t\t\t\t\t\t\t\t\t{data.workshopTitle}\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\t\t\t\t\t<article\n\t\t\t\t\t\tclassName=\"shadow-on-scrollbox scrollbar-thin scrollbar-thumb-scrollbar h-full w-full max-w-none flex-1 scroll-pt-6 space-y-6 overflow-y-auto p-2 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.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 code={data.finishedCode} components={mdxComponents} />\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\t<RetrievalPractice />\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=\"workshop-finished\"\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=\"@container flex h-16 justify-between border-t border-b-4 lg:border-b-0\">\n\t\t\t\t\t\t<div />\n\t\t\t\t\t\t{data.workshopFinished.status === 'success' ? (\n\t\t\t\t\t\t\t<EditFileOnGitHub\n\t\t\t\t\t\t\t\tfile={data.workshopFinished.file}\n\t\t\t\t\t\t\t\trelativePath={data.workshopFinished.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={{ to: '/' }} />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<Survey\n\t\t\t\t\tworkshopTitle={data.workshopTitle}\n\t\t\t\t\tworkshopFormEmbedUrl={data.workshopFormEmbedUrl}\n\t\t\t\t/>\n\t\t\t</main>\n\t\t</div>\n\t)\n}\n\nfunction Survey({\n\tworkshopTitle,\n\tworkshopFormEmbedUrl,\n}: {\n\tworkshopTitle: string\n\tworkshopFormEmbedUrl: string\n}) {\n\tconst theme = useTheme()\n\tconst [iframeLoaded, setIframeLoaded] = React.useState(false)\n\tconst isOnline = useIsOnline()\n\tif (!isOnline) {\n\t\treturn (\n\t\t\t<div className=\"relative shrink-0\">\n\t\t\t\t<div className=\"text-foreground-destructive absolute inset-0 z-10 flex items-center justify-center\">\n\t\t\t\t\t<Icon name=\"WifiNoConnection\" size=\"xl\">\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{'Unable to load the '}\n\t\t\t\t\t\t\t<a href={workshopFormEmbedUrl} className=\"underline\">\n\t\t\t\t\t\t\t\t{`${workshopTitle} feedback form`}\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t{' when offline'}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</Icon>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t)\n\t}\n\treturn (\n\t\t<div className=\"relative 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 {workshopTitle} 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={workshopFormEmbedUrl}\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\tstyle={{ colorScheme: theme }}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n"],"names":["handle","getSitemapEntries","route","meta","matches","rootData","getRootMatchLoaderData","getSeoMetaTags","title","workshopTitle","description","ogTitle","ogDescription","instructor","requestInfo","mdxComponents","h1","finished","_UNSAFE_withComponentProps","loaderData","data","useRevalidationWS","watchPaths","className","children","jsxs","jsx","Link","to","id","articleId","finishedCode","EpicVideoInfoProvider","epicVideoInfosPromise","Mdx","code","components","RetrievalPractice","ElementScrollRestoration","elementQuery","ProgressToggle","type","workshopFinished","status","EditFileOnGitHub","file","relativePath","NavChevrons","prev","prevStepLink","next","Survey","workshopFormEmbedUrl","theme","useTheme","iframeLoaded","setIframeLoaded","React","useIsOnline","Loading","onLoad","onError","src","cn","style","colorScheme","Icon","name","size","href"],"mappings":"giCAiCO,MAAMA,GAAoB,CAChCC,kBAAmBA,IAAM,CAAC,CAAEC,MAAO,YAAa,CACjD,EAEaC,GAA2BA,CAAC,CAAEC,QAAAA,CAAQ,IAAM,CACxD,MAAMC,EAAWC,EAAuBF,CAAO,EAC/C,OAAKC,EAEEE,EAAe,CACrBC,MAAO,MAAMH,GAAUI,aAAa,GACpCC,YAAa,mBAAmBL,GAAUI,aAAa,GACvDE,QAAS,YAAYN,GAAUI,aAAa,GAC5CG,cAAe,yCACfC,WAAYR,EAASQ,WACrBC,YAAaT,EAASS,WACvB,CAAC,EATqB,CAAA,CAUvB,EA6DMC,EAAgB,CAAEC,GAAIA,IAAM,IAAK,EAEvCC,GAAAC,EAAA,SAAyC,CACxCC,WAAYC,CACb,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JpB,EAAAA,IAACqB,GAAYC,KAAM5B,EAAK6B,aAAcC,KAAM,CAAEtB,GAAI,GAAI,CAAA,CAAG,CAAA,CAAA,CAC1D,CAAA,CAAA,CACD,EACAF,EAAAA,IAACyB,EAAA,CACA1C,cAAeW,EAAKX,cACpB2C,qBAAsBhC,EAAKgC,oBAAA,CAC5B,CAAA,EACD,CAAA,CACD,CAEF,CAAA,EAEA,SAASD,EAAO,CACf1C,cAAAA,EACA2C,qBAAAA,CACD,EAGG,CACF,MAAMC,EAAQC,EAAA,EACR,CAACC,EAAcC,CAAe,EAAIC,EAAAA,SAAe,EAAK,EAE5D,OADiBC,EAAA,EAmBhBjC,EAAAA,KAAC,MAAA,CAAIF,UAAU,oBACbC,SAAA,CAAC+B,EAME,WALF,MAAA,CAAIhC,UAAU,yDACdC,SAAAE,EAAAA,IAACiC,EAAA,CACAnC,gBAAC,OAAA,CAAKA,SAAA,CAAA,WAASf,EAAc,mBAAA,EAAiB,EAC/C,EACD,EAEDiB,EAAAA,IAAC,SAAA,CACAkC,OAAQA,IAAMJ,EAAgB,EAAI,EAElCK,QAASA,IAAML,EAAgB,EAAI,EACnChD,MAAM,cACNsD,IAAKV,EACL7B,UAAWwC,EACV,sEACAR,EAAe,cAAgB,WAChC,EACAS,MAAO,CAAEC,YAAaZ,CAAM,CAAA,CAC7B,CAAA,CAAA,CACD,EApCC3B,EAAAA,IAAC,MAAA,CAAIH,UAAU,oBACdC,eAAC,MAAA,CAAID,UAAU,qFACdC,SAAAE,EAAAA,IAACwC,GAAKC,KAAK,mBAAmBC,KAAK,KAClC5C,gBAAC,OAAA,CACCA,SAAA,CAAA,sBACDE,EAAAA,IAAC,KAAE2C,KAAMjB,EAAsB7B,UAAU,YACvCC,SAAA,GAAGf,CAAa,iBAClB,EACC,eAAA,EACF,EACD,EACD,CAAA,CACD,CA0BH"}
1
+ {"version":3,"file":"finished-CsRM8483.js","sources":["../../../app/routes/_app+/finished.tsx"],"sourcesContent":["import { ElementScrollRestoration } from '@epic-web/restore-scroll'\nimport {\n\tgetExercises,\n\tgetWorkshopFinished,\n} from '@epic-web/workshop-utils/apps.server'\nimport { getWorkshopConfig } from '@epic-web/workshop-utils/config.server'\nimport { getEpicVideoInfos } from '@epic-web/workshop-utils/epic-api.server'\nimport {\n\tcombineServerTimings,\n\tgetServerTimeHeader,\n\tmakeTimings,\n\ttime,\n} from '@epic-web/workshop-utils/timing.server'\nimport { type SEOHandle } from '@nasa-gcn/remix-seo'\nimport slugify from '@sindresorhus/slugify'\nimport * as React from 'react'\nimport { data, type HeadersFunction, Link } from 'react-router'\nimport { EpicVideoInfoProvider } from '#app/components/epic-video.tsx'\nimport { Icon } from '#app/components/icons.tsx'\nimport { Loading } from '#app/components/loading.tsx'\nimport { NavChevrons } from '#app/components/nav-chevrons.tsx'\nimport { RetrievalPractice } from '#app/components/retrieval-practice.tsx'\nimport { useRevalidationWS } from '#app/components/revalidation-ws.tsx'\nimport { Mdx } from '#app/utils/mdx.tsx'\nimport { cn } from '#app/utils/misc.tsx'\nimport { useIsOnline } from '#app/utils/online.ts'\nimport { getRootMatchLoaderData } from '#app/utils/root-loader.ts'\nimport { getSeoMetaTags } from '#app/utils/seo.ts'\nimport { EditFileOnGitHub } from '../launch-editor.tsx'\nimport { ProgressToggle } from '../progress.tsx'\nimport { useTheme } from '../theme/index.tsx'\nimport { type Route } from './+types/finished.tsx'\n\nexport const handle: SEOHandle = {\n\tgetSitemapEntries: () => [{ route: '/finished' }],\n}\n\nexport const meta: Route.MetaFunction = ({ matches }) => {\n\tconst rootData = getRootMatchLoaderData(matches)\n\tif (!rootData) return []\n\n\treturn getSeoMetaTags({\n\t\ttitle: `🎉 ${rootData?.workshopTitle}`,\n\t\tdescription: `Elaboration for ${rootData?.workshopTitle}`,\n\t\togTitle: `Finished ${rootData?.workshopTitle}`,\n\t\togDescription: `You finished! Time to submit feedback.`,\n\t\tinstructor: rootData.instructor,\n\t\trequestInfo: rootData.requestInfo,\n\t})\n}\n\nexport async function loader({ request }: Route.LoaderArgs) {\n\tconst timings = makeTimings('finishedLoader')\n\tconst exercises = await getExercises({ request, timings })\n\tconst compiledFinished = await time(() => getWorkshopFinished({ request }), {\n\t\ttimings,\n\t\ttype: 'compileMdx',\n\t\tdesc: 'compileMdx in finished',\n\t})\n\n\tconst lastExercises = exercises[exercises.length - 1]\n\tconst workshopConfig = getWorkshopConfig()\n\tconst workshopTitle = workshopConfig.title\n\tconst workshopFormTemplate = workshopConfig.forms.workshop\n\tconst workshopFormEmbedUrl = workshopFormTemplate.replace(\n\t\t'{workshopTitle}',\n\t\tencodeURIComponent(workshopTitle),\n\t)\n\treturn data(\n\t\t{\n\t\t\tarticleId: `workshop-${slugify(workshopTitle)}-finished`,\n\t\t\tworkshopTitle,\n\t\t\tworkshopFormEmbedUrl,\n\t\t\tfinishedCode:\n\t\t\t\tcompiledFinished.compiled.status === 'success'\n\t\t\t\t\t? compiledFinished.compiled.code\n\t\t\t\t\t: null,\n\t\t\tepicVideoInfosPromise:\n\t\t\t\tcompiledFinished.compiled.status === 'success'\n\t\t\t\t\t? getEpicVideoInfos(compiledFinished.compiled.epicVideoEmbeds, {\n\t\t\t\t\t\t\trequest,\n\t\t\t\t\t\t})\n\t\t\t\t\t: null,\n\t\t\tworkshopFinished: {\n\t\t\t\tstatus: compiledFinished.compiled.status,\n\t\t\t\tfile: compiledFinished.file,\n\t\t\t\trelativePath: compiledFinished.relativePath,\n\t\t\t},\n\t\t\tprevStepLink: lastExercises\n\t\t\t\t? {\n\t\t\t\t\t\tto: `/${lastExercises.exerciseNumber}/finished`,\n\t\t\t\t\t}\n\t\t\t\t: null,\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 }\n\nexport default function ExerciseFinished({\n\tloaderData: data,\n}: Route.ComponentProps) {\n\tuseRevalidationWS({ watchPaths: ['./exercises/FINISHED.mdx'] })\n\treturn (\n\t\t<div className=\"flex h-full grow flex-col\">\n\t\t\t<main className=\"grid h-full grow grid-cols-1 grid-rows-2 lg:grid-cols-2 lg:grid-rows-1\">\n\t\t\t\t<div className=\"relative col-span-1 row-span-1 flex h-full flex-col lg:border-r\">\n\t\t\t\t\t<h1 className=\"h-14 border-b pr-5 pl-10 text-sm leading-none font-medium uppercase\">\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=\"/\" className=\"hover:underline\">\n\t\t\t\t\t\t\t\t\t{data.workshopTitle}\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\t\t\t\t\t<article\n\t\t\t\t\t\tclassName=\"shadow-on-scrollbox scrollbar-thin scrollbar-thumb-scrollbar h-full w-full max-w-none flex-1 scroll-pt-6 space-y-6 overflow-y-auto p-2 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.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 code={data.finishedCode} components={mdxComponents} />\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\t<RetrievalPractice />\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=\"workshop-finished\"\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=\"@container flex h-16 justify-between border-t border-b-4 lg:border-b-0\">\n\t\t\t\t\t\t<div />\n\t\t\t\t\t\t{data.workshopFinished.status === 'success' ? (\n\t\t\t\t\t\t\t<EditFileOnGitHub\n\t\t\t\t\t\t\t\tfile={data.workshopFinished.file}\n\t\t\t\t\t\t\t\trelativePath={data.workshopFinished.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={{ to: '/' }} />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<Survey\n\t\t\t\t\tworkshopTitle={data.workshopTitle}\n\t\t\t\t\tworkshopFormEmbedUrl={data.workshopFormEmbedUrl}\n\t\t\t\t/>\n\t\t\t</main>\n\t\t</div>\n\t)\n}\n\nfunction Survey({\n\tworkshopTitle,\n\tworkshopFormEmbedUrl,\n}: {\n\tworkshopTitle: string\n\tworkshopFormEmbedUrl: string\n}) {\n\tconst theme = useTheme()\n\tconst [iframeLoaded, setIframeLoaded] = React.useState(false)\n\tconst isOnline = useIsOnline()\n\tif (!isOnline) {\n\t\treturn (\n\t\t\t<div className=\"relative shrink-0\">\n\t\t\t\t<div className=\"text-foreground-destructive absolute inset-0 z-10 flex items-center justify-center\">\n\t\t\t\t\t<Icon name=\"WifiNoConnection\" size=\"xl\">\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{'Unable to load the '}\n\t\t\t\t\t\t\t<a href={workshopFormEmbedUrl} className=\"underline\">\n\t\t\t\t\t\t\t\t{`${workshopTitle} feedback form`}\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t{' when offline'}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</Icon>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t)\n\t}\n\treturn (\n\t\t<div className=\"relative 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 {workshopTitle} 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={workshopFormEmbedUrl}\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\tstyle={{ colorScheme: theme }}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n"],"names":["handle","getSitemapEntries","route","meta","matches","rootData","getRootMatchLoaderData","getSeoMetaTags","title","workshopTitle","description","ogTitle","ogDescription","instructor","requestInfo","mdxComponents","h1","finished","_UNSAFE_withComponentProps","loaderData","data","useRevalidationWS","watchPaths","className","children","jsxs","jsx","Link","to","id","articleId","finishedCode","EpicVideoInfoProvider","epicVideoInfosPromise","Mdx","code","components","RetrievalPractice","ElementScrollRestoration","elementQuery","ProgressToggle","type","workshopFinished","status","EditFileOnGitHub","file","relativePath","NavChevrons","prev","prevStepLink","next","Survey","workshopFormEmbedUrl","theme","useTheme","iframeLoaded","setIframeLoaded","React","useIsOnline","Loading","onLoad","onError","src","cn","style","color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EACL7B,UAAWwC,EACV,sEACAR,EAAe,cAAgB,WAChC,EACAS,MAAO,CAAEC,YAAaZ,CAAM,CAAA,CAC7B,CAAA,CAAA,CACD,EApCC3B,EAAAA,IAAC,MAAA,CAAIH,UAAU,oBACdC,eAAC,MAAA,CAAID,UAAU,qFACdC,SAAAE,EAAAA,IAACwC,GAAKC,KAAK,mBAAmBC,KAAK,KAClC5C,gBAAC,OAAA,CACCA,SAAA,CAAA,sBACDE,EAAAA,IAAC,KAAE2C,KAAMjB,EAAsB7B,UAAU,YACvCC,SAAA,GAAGf,CAAa,iBAClB,EACC,eAAA,EACF,EACD,EACD,CAAA,CACD,CA0BH"}
@@ -1,2 +1,2 @@
1
- import{w as j,a as E,c as A,d as C,e as N}from"./chunk-JZWAC4HX-BuixXc9D.js";import{j as r}from"./jsx-runtime-C5WNSv3b.js";import{g as T,R as H,P as U,C as t,a as b,D as B}from"./playground-CEUo0DCy.js";import{U as I}from"./diff-BncP0Faq.js";import{G as R}from"./error-boundary-DCY9a5Cj.js";import{u as S}from"./workshop-config-v_LiyFvY.js";import{u as O}from"./misc-D9k_mI0z.js";import{P as a}from"./preview-BS9wGiJ3.js";import{T as k}from"./tests-CVRqL4gt.js";import"./index-Bi6L2ga8.js";import"./loading-BjV0PtX2.js";import"./index-DSpM0ReJ.js";import"./tooltip-H74tOFSr.js";import"./index-B2VNpNxJ.js";import"./root-loader-DAxaiFMN.js";import"./pe-D585gnmh.js";import"./schemas-siASSt6b.js";import"./discord-CVgNwZp4.js";import"./user-DhjrtSbZ.js";import"./online-x7UFobEJ.js";import"./index-BvE6USCZ.js";import"./index-DosQrH9F.js";import"./status-indicator-C6DiLYL5.js";import"./index-E_6kulJP.js";import"./set-playground-CvYErpku.js";import"./button-B_EAwzD_.js";import"./onboarding-indicator-Csno1yMz.js";import"./progress-bar-BCbq1CuC.js";import"./dialog-DXBBGJQ6.js";import"./playground-window-BM8PCQz7.js";import"./react-error-boundary-DFNLMQmr.js";import"./preload-helper-BXl3LOEh.js";import"./launch-editor-C8OwTN5L.js";import"./epic-video-C9q0z-QM.js";import"./format-CZ5n8p10.js";import"./revalidation-ws-JHvxsHsY.js";import"./mdx-Bvb9XNyL.js";import"./popover-Dh41LPal.js";import"./index-ywSltzcE.js";const l=["playground","problem","solution","tests","diff","chat"],L=n=>!!(n&&l.includes(n)),Es=j(function({loaderData:e}){const{inBrowserBrowserRef:p}=A(),d=S(),[u]=C(),m=u.get("preview"),h=O(),x=N();function f(s){if(s==="tests")return ENV.EPICSHOP_DEPLOYED||!e.playground||e.playground.test.type==="none";if(s==="problem"||s==="solution"){if(e[s]?.dev.type==="none")return!0;if(ENV.EPICSHOP_DEPLOYED){const i=e[s]?.dev.type;return i!=="browser"&&i!=="export"&&!e[s]?.stackBlitzUrl}}return s==="playground"&&ENV.EPICSHOP_DEPLOYED?!0:s==="chat"?!d.product.discordChannelId:!1}function w(s){if(s==="tests"){if(!e.playground)return null;const{isTestRunning:i,testExitCode:o}=e.playground;return i?"running":o===0?"passed":o!==null&&o!==0?"failed":null}return(s==="problem"||s==="solution"||s==="playground")&&(s==="playground"?e.playground:e[s])?.isRunning?"running":null}const y=L(m)?m:l.find(s=>!f(s)),c=`/diff?${new URLSearchParams({app1:e.problem?.name??"",app2:e.solution?.name??""})}`;function g(s){s.altKey&&!s.ctrlKey&&!s.shiftKey&&!s.metaKey&&(s.preventDefault(),x(c))}const v=l.map(s=>{const i=f(s),o=w(s),P=s==="diff"&&h?c:`?${T(u,s,"playground")}`;return{id:s,label:s,hidden:i,status:o,to:P,onClick:s==="diff"?g:void 0}});return r.jsxs(H,{className:"relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden sm:col-span-1 sm:row-span-1",value:y,children:[r.jsx(U,{tabs:v}),r.jsxs("div",{className:"relative z-10 flex min-h-0 flex-1 flex-col overflow-hidden",children:[r.jsx(t,{value:"playground",className:"radix-state-inactive:hidden flex min-h-0 w-full grow basis-0 items-stretch justify-center self-start",forceMount:!0,children:r.jsx(b,{appInfo:e.playground,problemAppName:e.problem?.name,inBrowserBrowserRef:p,allApps:e.allApps,isUpToDate:e.playground?.isUpToDate??!1})}),r.jsx(t,{value:"problem",className:"radix-state-inactive:hidden flex min-h-0 w-full grow basis-0 items-stretch justify-center self-start",forceMount:!0,children:r.jsx(a,{appInfo:e.problem,inBrowserBrowserRef:p})}),r.jsx(t,{value:"solution",className:"radix-state-inactive:hidden flex min-h-0 w-full grow basis-0 items-stretch justify-center self-start",forceMount:!0,children:r.jsx(a,{appInfo:e.solution,inBrowserBrowserRef:p})}),r.jsx(t,{value:"tests",className:"radix-state-inactive:hidden flex min-h-0 w-full grow basis-0 items-stretch justify-center self-start overflow-hidden",children:r.jsx(k,{appInfo:e.playground,problemAppName:e.problem?.name,allApps:e.allApps,isUpToDate:e.playground?.isUpToDate??!1,userHasAccessPromise:e.userHasAccessPromise})}),r.jsx(t,{value:"diff",className:"radix-state-inactive:hidden flex h-full min-h-0 w-full grow basis-0 items-stretch justify-center self-start",children:r.jsx(I,{diff:e.diff,allApps:e.allApps,userHasAccessPromise:e.userHasAccessPromise})}),r.jsx(t,{value:"chat",className:"radix-state-inactive:hidden flex h-full min-h-0 w-full grow basis-0 items-stretch justify-center self-start",children:r.jsx(B,{discordPostsPromise:e.discordPostsPromise})})]})]})}),As=E(function(){return r.jsx(R,{statusHandlers:{404:()=>r.jsx("p",{children:"Sorry, we couldn't find an app here."})}})});export{As as ErrorBoundary,Es as default};
2
- //# sourceMappingURL=index-n4CWCwSA.js.map
1
+ import{w as j,a as E,c as A,d as C,e as N}from"./chunk-JZWAC4HX-BuixXc9D.js";import{j as r}from"./jsx-runtime-C5WNSv3b.js";import{g as T,R as H,P as U,C as t,a as b,D as B}from"./playground-BV2y1ifv.js";import{U as I}from"./diff-C4LoXlDb.js";import{G as R}from"./error-boundary-DCY9a5Cj.js";import{u as S}from"./workshop-config-v_LiyFvY.js";import{u as O}from"./misc-D9k_mI0z.js";import{P as a}from"./preview-Dav9KrHN.js";import{T as k}from"./tests-CVRqL4gt.js";import"./index-Bi6L2ga8.js";import"./loading-BjV0PtX2.js";import"./index-DSpM0ReJ.js";import"./tooltip-H74tOFSr.js";import"./index-B2VNpNxJ.js";import"./root-loader-DAxaiFMN.js";import"./pe-D585gnmh.js";import"./schemas-siASSt6b.js";import"./discord-CVgNwZp4.js";import"./user-DhjrtSbZ.js";import"./online-x7UFobEJ.js";import"./index-BvE6USCZ.js";import"./index-DosQrH9F.js";import"./status-indicator-C6DiLYL5.js";import"./index-E_6kulJP.js";import"./set-playground-CvYErpku.js";import"./button-B_EAwzD_.js";import"./onboarding-indicator-Csno1yMz.js";import"./progress-bar-BCbq1CuC.js";import"./dialog-DXBBGJQ6.js";import"./playground-window-BM8PCQz7.js";import"./react-error-boundary-DFNLMQmr.js";import"./preload-helper-BXl3LOEh.js";import"./launch-editor-C-8ah8qM.js";import"./epic-video-C9q0z-QM.js";import"./format-CZ5n8p10.js";import"./revalidation-ws-JHvxsHsY.js";import"./mdx-C3Jl4O5D.js";import"./popover-Dh41LPal.js";import"./index-ywSltzcE.js";const l=["playground","problem","solution","tests","diff","chat"],L=n=>!!(n&&l.includes(n)),Es=j(function({loaderData:e}){const{inBrowserBrowserRef:p}=A(),d=S(),[u]=C(),m=u.get("preview"),h=O(),x=N();function f(s){if(s==="tests")return ENV.EPICSHOP_DEPLOYED||!e.playground||e.playground.test.type==="none";if(s==="problem"||s==="solution"){if(e[s]?.dev.type==="none")return!0;if(ENV.EPICSHOP_DEPLOYED){const i=e[s]?.dev.type;return i!=="browser"&&i!=="export"&&!e[s]?.stackBlitzUrl}}return s==="playground"&&ENV.EPICSHOP_DEPLOYED?!0:s==="chat"?!d.product.discordChannelId:!1}function w(s){if(s==="tests"){if(!e.playground)return null;const{isTestRunning:i,testExitCode:o}=e.playground;return i?"running":o===0?"passed":o!==null&&o!==0?"failed":null}return(s==="problem"||s==="solution"||s==="playground")&&(s==="playground"?e.playground:e[s])?.isRunning?"running":null}const y=L(m)?m:l.find(s=>!f(s)),c=`/diff?${new URLSearchParams({app1:e.problem?.name??"",app2:e.solution?.name??""})}`;function g(s){s.altKey&&!s.ctrlKey&&!s.shiftKey&&!s.metaKey&&(s.preventDefault(),x(c))}const v=l.map(s=>{const i=f(s),o=w(s),P=s==="diff"&&h?c:`?${T(u,s,"playground")}`;return{id:s,label:s,hidden:i,status:o,to:P,onClick:s==="diff"?g:void 0}});return r.jsxs(H,{className:"relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden sm:col-span-1 sm:row-span-1",value:y,children:[r.jsx(U,{tabs:v}),r.jsxs("div",{className:"relative z-10 flex min-h-0 flex-1 flex-col overflow-hidden",children:[r.jsx(t,{value:"playground",className:"radix-state-inactive:hidden flex min-h-0 w-full grow basis-0 items-stretch justify-center self-start",forceMount:!0,children:r.jsx(b,{appInfo:e.playground,problemAppName:e.problem?.name,inBrowserBrowserRef:p,allApps:e.allApps,isUpToDate:e.playground?.isUpToDate??!1})}),r.jsx(t,{value:"problem",className:"radix-state-inactive:hidden flex min-h-0 w-full grow basis-0 items-stretch justify-center self-start",forceMount:!0,children:r.jsx(a,{appInfo:e.problem,inBrowserBrowserRef:p})}),r.jsx(t,{value:"solution",className:"radix-state-inactive:hidden flex min-h-0 w-full grow basis-0 items-stretch justify-center self-start",forceMount:!0,children:r.jsx(a,{appInfo:e.solution,inBrowserBrowserRef:p})}),r.jsx(t,{value:"tests",className:"radix-state-inactive:hidden flex min-h-0 w-full grow basis-0 items-stretch justify-center self-start overflow-hidden",children:r.jsx(k,{appInfo:e.playground,problemAppName:e.problem?.name,allApps:e.allApps,isUpToDate:e.playground?.isUpToDate??!1,userHasAccessPromise:e.userHasAccessPromise})}),r.jsx(t,{value:"diff",className:"radix-state-inactive:hidden flex h-full min-h-0 w-full grow basis-0 items-stretch justify-center self-start",children:r.jsx(I,{diff:e.diff,allApps:e.allApps,userHasAccessPromise:e.userHasAccessPromise})}),r.jsx(t,{value:"chat",className:"radix-state-inactive:hidden flex h-full min-h-0 w-full grow basis-0 items-stretch justify-center self-start",children:r.jsx(B,{discordPostsPromise:e.discordPostsPromise})})]})]})}),As=E(function(){return r.jsx(R,{statusHandlers:{404:()=>r.jsx("p",{children:"Sorry, we couldn't find an app here."})}})});export{As as ErrorBoundary,Es as default};
2
+ //# sourceMappingURL=index-BnHkUMN_.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-n4CWCwSA.js","sources":["../../../app/routes/_app+/exercise+/$exerciseNumber_.$stepNumber.$type+/index.tsx"],"sourcesContent":["import { type Route } from './+types/index'\nimport {\n\tgetAppByName,\n\tgetAppDisplayName,\n\tgetApps,\n\tgetExerciseApp,\n\tisExerciseStepApp,\n\tisPlaygroundApp,\n\trequireExerciseApp,\n\ttype App,\n\ttype ExerciseStepApp,\n} from '@epic-web/workshop-utils/apps.server'\nimport { getDiffPatch } from '@epic-web/workshop-utils/diff.server'\nimport { userHasAccessToExerciseStep } from '@epic-web/workshop-utils/epic-api.server'\nimport {\n\tcombineServerTimings,\n\tgetServerTimeHeader,\n\tmakeTimings,\n} from '@epic-web/workshop-utils/timing.server'\nimport * as Tabs from '@radix-ui/react-tabs'\nimport * as React from 'react'\nimport {\n\tuseNavigate,\n\tuseSearchParams,\n\tdata,\n\tredirect,\n\ttype HeadersFunction,\n\tuseOutletContext,\n} from 'react-router'\nimport { Diff } from '#app/components/diff.tsx'\nimport { DiscordChat } from '#app/components/discord-chat.tsx'\nimport { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'\nimport { type InBrowserBrowserRef } from '#app/components/in-browser-browser.tsx'\nimport {\n\tgetPreviewSearchParams,\n\tPreviewTabsList,\n} from '#app/components/preview-tabs.tsx'\nimport { useWorkshopConfig } from '#app/components/workshop-config.tsx'\nimport { fetchDiscordPosts } from '#app/utils/discord.server.ts'\nimport { useAltDown } from '#app/utils/misc.tsx'\nimport { Playground } from './__shared/playground.tsx'\nimport { Preview } from './__shared/preview.tsx'\nimport { Tests } from './__shared/tests.tsx'\nimport { getAppRunningState, getTestState } from './__shared/utils.tsx'\n\nexport async function loader({ request, params }: Route.LoaderArgs) {\n\tconst timings = makeTimings('exerciseStepTypeIndexLoader')\n\tconst searchParams = new URL(request.url).searchParams\n\tconst cacheOptions = { request, timings }\n\n\tconst [exerciseStepApp, allAppsFull, problemApp, solutionApp] =\n\t\tawait Promise.all([\n\t\t\trequireExerciseApp(params, cacheOptions),\n\t\t\tgetApps(cacheOptions),\n\t\t\tgetExerciseApp({ ...params, type: 'problem' }, cacheOptions),\n\t\t\tgetExerciseApp({ ...params, type: 'solution' }, cacheOptions),\n\t\t])\n\n\tconst playgroundApp = allAppsFull.find(isPlaygroundApp)\n\tconst reqUrl = new URL(request.url)\n\n\tconst pathnameParam = reqUrl.searchParams.get('pathname')\n\tif (pathnameParam === '' || pathnameParam === '/') {\n\t\treqUrl.searchParams.delete('pathname')\n\t\tthrow redirect(reqUrl.toString())\n\t}\n\n\tconst app1Name = reqUrl.searchParams.get('app1')\n\tconst app2Name = reqUrl.searchParams.get('app2')\n\tconst app1 = app1Name\n\t\t? await getAppByName(app1Name)\n\t\t: playgroundApp || problemApp\n\tconst app2 = app2Name ? await getAppByName(app2Name) : solutionApp\n\n\tfunction getStepId(a: ExerciseStepApp) {\n\t\treturn (\n\t\t\ta.exerciseNumber * 1000 +\n\t\t\ta.stepNumber * 10 +\n\t\t\t(a.type === 'problem' ? 0 : 1)\n\t\t)\n\t}\n\n\tfunction getStepNameAndId(a: App) {\n\t\tif (isExerciseStepApp(a)) {\n\t\t\tconst exerciseNumberStr = String(a.exerciseNumber).padStart(2, '0')\n\t\t\tconst stepNumberStr = String(a.stepNumber).padStart(2, '0')\n\n\t\t\treturn {\n\t\t\t\tstepName: `${exerciseNumberStr}/${stepNumberStr}.${a.type}`,\n\t\t\t\tstepId: getStepId(a),\n\t\t\t}\n\t\t}\n\t\treturn { stepName: '', stepId: -1 }\n\t}\n\n\tconst allApps = allAppsFull\n\t\t.filter((a, i, ar) => ar.findIndex((b) => a.name === b.name) === i)\n\t\t.map((a) => ({\n\t\t\tdisplayName: getAppDisplayName(a, allAppsFull),\n\t\t\tname: a.name,\n\t\t\ttitle: a.title,\n\t\t\ttype: a.type,\n\t\t\t...getStepNameAndId(a),\n\t\t}))\n\n\tallApps.sort((a, b) => {\n\t\t// order them by their stepId\n\t\tif (a.stepId > 0 && b.stepId > 0) return a.stepId - b.stepId\n\n\t\t// non-step apps should come after step apps\n\t\tif (a.stepId > 0) return -1\n\t\tif (b.stepId > 0) return 1\n\n\t\treturn 0\n\t})\n\n\tasync function getDiffProp() {\n\t\tif (!app1 || !app2) {\n\t\t\treturn {\n\t\t\t\tapp1: app1?.name,\n\t\t\t\tapp2: app2?.name,\n\t\t\t\tdiffPatch: null,\n\t\t\t}\n\t\t}\n\t\tconst diffPatch = await getDiffPatch(app1, app2, {\n\t\t\t...cacheOptions,\n\t\t\tforceFresh: searchParams.get('forceFresh') === 'diff',\n\t\t}).catch((e) => {\n\t\t\tconsole.error(e)\n\t\t\treturn null\n\t\t})\n\t\treturn {\n\t\t\tapp1: app1.name,\n\t\t\tapp2: app2.name,\n\t\t\tdiffPatch,\n\t\t}\n\t}\n\n\treturn data(\n\t\t{\n\t\t\ttype: params.type as 'problem' | 'solution',\n\t\t\texerciseStepApp,\n\t\t\tallApps,\n\t\t\t// defer this promise so that we don't block the response from being sent\n\t\t\tdiscordPostsPromise: fetchDiscordPosts({ request }),\n\t\t\tuserHasAccessPromise: userHasAccessToExerciseStep({\n\t\t\t\texerciseNumber: Number(params.exerciseNumber),\n\t\t\t\tstepNumber: Number(params.stepNumber),\n\t\t\t\trequest,\n\t\t\t\ttimings,\n\t\t\t}),\n\t\t\tplayground: playgroundApp\n\t\t\t\t? ({\n\t\t\t\t\t\ttype: 'playground',\n\t\t\t\t\t\tfullPath: playgroundApp.fullPath,\n\t\t\t\t\t\tdev: playgroundApp.dev,\n\t\t\t\t\t\ttest: playgroundApp.test,\n\t\t\t\t\t\ttitle: playgroundApp.title,\n\t\t\t\t\t\tname: playgroundApp.name,\n\t\t\t\t\t\tappName: playgroundApp.appName,\n\t\t\t\t\t\tisUpToDate: playgroundApp.isUpToDate,\n\t\t\t\t\t\tstackBlitzUrl: playgroundApp.stackBlitzUrl,\n\t\t\t\t\t\t...(await getAppRunningState(playgroundApp)),\n\t\t\t\t\t\t...getTestState(playgroundApp),\n\t\t\t\t\t} as const)\n\t\t\t\t: null,\n\t\t\tproblem: problemApp\n\t\t\t\t? ({\n\t\t\t\t\t\ttype: 'problem',\n\t\t\t\t\t\tfullPath: problemApp.fullPath,\n\t\t\t\t\t\tdev: problemApp.dev,\n\t\t\t\t\t\ttest: problemApp.test,\n\t\t\t\t\t\ttitle: problemApp.title,\n\t\t\t\t\t\tname: problemApp.name,\n\t\t\t\t\t\tstackBlitzUrl: problemApp.stackBlitzUrl,\n\t\t\t\t\t\t...(await getAppRunningState(problemApp)),\n\t\t\t\t\t} as const)\n\t\t\t\t: null,\n\t\t\tsolution: solutionApp\n\t\t\t\t? ({\n\t\t\t\t\t\ttype: 'solution',\n\t\t\t\t\t\tfullPath: solutionApp.fullPath,\n\t\t\t\t\t\tdev: solutionApp.dev,\n\t\t\t\t\t\ttest: solutionApp.test,\n\t\t\t\t\t\ttitle: solutionApp.title,\n\t\t\t\t\t\tname: solutionApp.name,\n\t\t\t\t\t\tstackBlitzUrl: solutionApp.stackBlitzUrl,\n\t\t\t\t\t\t...(await getAppRunningState(solutionApp)),\n\t\t\t\t\t} as const)\n\t\t\t\t: null,\n\t\t\tdiff: getDiffProp(),\n\t\t} as const,\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'Server-Timing': combineServerTimings(loaderHeaders, parentHeaders),\n\t}\n\treturn headers\n}\n\nconst tabs = [\n\t'playground',\n\t'problem',\n\t'solution',\n\t'tests',\n\t'diff',\n\t'chat',\n] as const\nconst isValidPreview = (s: string | null): s is (typeof tabs)[number] =>\n\tBoolean(s && tabs.includes(s as (typeof tabs)[number]))\n\nexport default function ExercisePartRoute({\n\tloaderData,\n}: Route.ComponentProps) {\n\tconst { inBrowserBrowserRef } = useOutletContext<{\n\t\tinBrowserBrowserRef: React.RefObject<InBrowserBrowserRef | null>\n\t}>()\n\tconst workshopConfig = useWorkshopConfig()\n\tconst [searchParams] = useSearchParams()\n\n\tconst preview = searchParams.get('preview')\n\n\tconst altDown = useAltDown()\n\tconst navigate = useNavigate()\n\n\tfunction shouldHideTab(tab: (typeof tabs)[number]) {\n\t\tif (tab === 'tests') {\n\t\t\treturn (\n\t\t\t\tENV.EPICSHOP_DEPLOYED ||\n\t\t\t\t!loaderData.playground ||\n\t\t\t\tloaderData.playground.test.type === 'none'\n\t\t\t)\n\t\t}\n\t\tif (tab === 'problem' || tab === 'solution') {\n\t\t\tif (loaderData[tab]?.dev.type === 'none') return true\n\t\t\tif (ENV.EPICSHOP_DEPLOYED) {\n\t\t\t\tconst devType = loaderData[tab]?.dev.type\n\t\t\t\treturn (\n\t\t\t\t\tdevType !== 'browser' &&\n\t\t\t\t\tdevType !== 'export' &&\n\t\t\t\t\t!loaderData[tab]?.stackBlitzUrl\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t\tif (tab === 'playground' && ENV.EPICSHOP_DEPLOYED) return true\n\n\t\tif (tab === 'chat') {\n\t\t\treturn !workshopConfig.product.discordChannelId\n\t\t}\n\t\treturn false\n\t}\n\n\tfunction getTabStatus(\n\t\ttab: (typeof tabs)[number],\n\t): 'running' | 'passed' | 'failed' | null {\n\t\tif (tab === 'tests') {\n\t\t\tif (!loaderData.playground) return null\n\t\t\tconst { isTestRunning, testExitCode } = loaderData.playground\n\t\t\tif (isTestRunning) return 'running'\n\t\t\tif (testExitCode === 0) return 'passed'\n\t\t\tif (testExitCode !== null && testExitCode !== 0) return 'failed'\n\t\t\treturn null\n\t\t}\n\t\tif (tab === 'problem' || tab === 'solution' || tab === 'playground') {\n\t\t\tconst appData =\n\t\t\t\ttab === 'playground' ? loaderData.playground : loaderData[tab]\n\t\t\tif (appData?.isRunning) return 'running'\n\t\t}\n\t\treturn null\n\t}\n\n\tconst activeTab = isValidPreview(preview)\n\t\t? preview\n\t\t: tabs.find((t) => !shouldHideTab(t))\n\n\t// when alt is held down, the diff tab should open to the full-page diff view\n\t// between the problem and solution (this is more for the instructor than the student)\n\tconst altDiffUrl = `/diff?${new URLSearchParams({\n\t\tapp1: loaderData.problem?.name ?? '',\n\t\tapp2: loaderData.solution?.name ?? '',\n\t})}`\n\n\tfunction handleDiffTabClick(event: React.MouseEvent<HTMLAnchorElement>) {\n\t\tif (event.altKey && !event.ctrlKey && !event.shiftKey && !event.metaKey) {\n\t\t\tevent.preventDefault()\n\t\t\tvoid navigate(altDiffUrl)\n\t\t}\n\t}\n\n\tconst previewTabs = tabs.map((tab) => {\n\t\tconst hidden = shouldHideTab(tab)\n\t\tconst status = getTabStatus(tab)\n\t\tconst to =\n\t\t\ttab === 'diff' && altDown\n\t\t\t\t? altDiffUrl\n\t\t\t\t: `?${getPreviewSearchParams(searchParams, tab, 'playground')}`\n\t\treturn {\n\t\t\tid: tab,\n\t\t\tlabel: tab,\n\t\t\thidden,\n\t\t\tstatus,\n\t\t\tto,\n\t\t\tonClick: tab === 'diff' ? handleDiffTabClick : undefined,\n\t\t}\n\t})\n\n\treturn (\n\t\t<Tabs.Root\n\t\t\tclassName=\"relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden sm:col-span-1 sm:row-span-1\"\n\t\t\tvalue={activeTab}\n\t\t\t// intentionally no onValueChange here because the Link will trigger the\n\t\t\t// change.\n\t\t>\n\t\t\t<PreviewTabsList tabs={previewTabs} />\n\t\t\t<div className=\"relative z-10 flex min-h-0 flex-1 flex-col overflow-hidden\">\n\t\t\t\t<Tabs.Content\n\t\t\t\t\tvalue=\"playground\"\n\t\t\t\t\tclassName=\"radix-state-inactive:hidden flex min-h-0 w-full grow basis-0 items-stretch justify-center self-start\"\n\t\t\t\t\tforceMount\n\t\t\t\t>\n\t\t\t\t\t<Playground\n\t\t\t\t\t\tappInfo={loaderData.playground}\n\t\t\t\t\t\tproblemAppName={loaderData.problem?.name}\n\t\t\t\t\t\tinBrowserBrowserRef={inBrowserBrowserRef}\n\t\t\t\t\t\tallApps={loaderData.allApps}\n\t\t\t\t\t\tisUpToDate={loaderData.playground?.isUpToDate ?? false}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Content>\n\t\t\t\t<Tabs.Content\n\t\t\t\t\tvalue=\"problem\"\n\t\t\t\t\tclassName=\"radix-state-inactive:hidden flex min-h-0 w-full grow basis-0 items-stretch justify-center self-start\"\n\t\t\t\t\tforceMount\n\t\t\t\t>\n\t\t\t\t\t<Preview\n\t\t\t\t\t\tappInfo={loaderData.problem}\n\t\t\t\t\t\tinBrowserBrowserRef={inBrowserBrowserRef}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Content>\n\t\t\t\t<Tabs.Content\n\t\t\t\t\tvalue=\"solution\"\n\t\t\t\t\tclassName=\"radix-state-inactive:hidden flex min-h-0 w-full grow basis-0 items-stretch justify-center self-start\"\n\t\t\t\t\tforceMount\n\t\t\t\t>\n\t\t\t\t\t<Preview\n\t\t\t\t\t\tappInfo={loaderData.solution}\n\t\t\t\t\t\tinBrowserBrowserRef={inBrowserBrowserRef}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Content>\n\t\t\t\t<Tabs.Content\n\t\t\t\t\tvalue=\"tests\"\n\t\t\t\t\tclassName=\"radix-state-inactive:hidden flex min-h-0 w-full grow basis-0 items-stretch justify-center self-start overflow-hidden\"\n\t\t\t\t>\n\t\t\t\t\t<Tests\n\t\t\t\t\t\tappInfo={loaderData.playground}\n\t\t\t\t\t\tproblemAppName={loaderData.problem?.name}\n\t\t\t\t\t\tallApps={loaderData.allApps}\n\t\t\t\t\t\tisUpToDate={loaderData.playground?.isUpToDate ?? false}\n\t\t\t\t\t\tuserHasAccessPromise={loaderData.userHasAccessPromise}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Content>\n\t\t\t\t<Tabs.Content\n\t\t\t\t\tvalue=\"diff\"\n\t\t\t\t\tclassName=\"radix-state-inactive:hidden flex h-full min-h-0 w-full grow basis-0 items-stretch justify-center self-start\"\n\t\t\t\t>\n\t\t\t\t\t<Diff\n\t\t\t\t\t\tdiff={loaderData.diff}\n\t\t\t\t\t\tallApps={loaderData.allApps}\n\t\t\t\t\t\tuserHasAccessPromise={loaderData.userHasAccessPromise}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Content>\n\t\t\t\t<Tabs.Content\n\t\t\t\t\tvalue=\"chat\"\n\t\t\t\t\tclassName=\"radix-state-inactive:hidden flex h-full min-h-0 w-full grow basis-0 items-stretch justify-center self-start\"\n\t\t\t\t>\n\t\t\t\t\t<DiscordChat discordPostsPromise={loaderData.discordPostsPromise} />\n\t\t\t\t</Tabs.Content>\n\t\t\t</div>\n\t\t</Tabs.Root>\n\t)\n}\n\nexport function ErrorBoundary() {\n\treturn (\n\t\t<GeneralErrorBoundary\n\t\t\tstatusHandlers={{\n\t\t\t\t404: () => <p>Sorry, we couldn't find an app here.</p>,\n\t\t\t}}\n\t\t/>\n\t)\n}\n"],"names":["tabs","isValidPreview","s","Boolean","includes","index","_UNSAFE_withComponentProps","loaderData","inBrowserBrowserRef","useOutletContext","workshopConfig","useWorkshopConfig","searchParams","useSearchParams","preview","get","altDown","useAltDown","navigate","useNavigate","shouldHideTab","tab","ENV","EPICSHOP_DEPLOYED","playground","test","type","dev","devType","stackBlitzUrl","product","discordChannelId","getTabStatus","isTestRunning","testExitCode","isRunning","activeTab","find","t","altDiffUrl","URLSearchParams","app1","problem","name","app2","solution","handleDiffTabClick","event","altKey","ctrlKey","shiftKey","metaKey","preventDefault","previewTabs","map","hidden","status","to","getPreviewSearchParams","id","label","onClick","jsxs","Tabs","className","value","children","jsx","PreviewTabsList","forceMount","Playground","appInfo","problemAppName","allApps","isUpToDate","Preview","Tests","userHasAccessPromise","Diff","diff","DiscordChat","discordPostsPromise","ErrorBoundary","_UNSAFE_withErrorBoundaryProps","GeneralErrorBoundary","statusHandlers"],"mappings":"y4CA+MA,MAAMA,EAAO,CACZ,aACA,UACA,WACA,QACA,OACA,MAAA,EAEKC,EAAkBC,GACvBC,GAAQD,GAAKF,EAAKI,SAASF,CAA0B,GAEtDG,GAAAC,EAAA,SAA0C,CACzCC,WAAAA,CACD,EAAyB,CACxB,KAAM,CAAEC,oBAAAA,GAAwBC,EAAA,EAG1BC,EAAiBC,EAAA,EACjB,CAACC,CAAY,EAAIC,EAAA,EAEjBC,EAAUF,EAAaG,IAAI,SAAS,EAEpCC,EAAUC,EAAA,EACVC,EAAWC,EAAA,EAEjB,SAASC,EAAcC,EAA4B,CAClD,GAAIA,IAAQ,QACX,OACCC,IAAIC,mBACJ,CAAChB,EAAWiB,YACZjB,EAAWiB,WAAWC,KAAKC,OAAS,OAGtC,GAAIL,IAAQ,WAAaA,IAAQ,WAAY,CAC5C,GAAId,EAAWc,CAAG,GAAGM,IAAID,OAAS,OAAQ,MAAO,GACjD,GAAIJ,IAAIC,kBAAmB,CAC1B,MAAMK,EAAUrB,EAAWc,CAAG,GAAGM,IAAID,KACrC,OACCE,IAAY,WACZA,IAAY,UACZ,CAACrB,EAAWc,CAAG,GAAGQ,aAEpB,CACD,CACA,OAAIR,IAAQ,cAAgBC,IAAIC,kBAA0B,GAEtDF,IAAQ,OACJ,CAACX,EAAeoB,QAAQC,iBAEzB,EACR,CAEA,SAASC,EACRX,EACyC,CACzC,GAAIA,IAAQ,QAAS,CACpB,GAAI,CAACd,EAAWiB,WAAY,OAAO,KACnC,KAAM,CAAES,cAAAA,EAAeC,aAAAA,GAAiB3B,EAAWiB,WACnD,OAAIS,EAAsB,UACtBC,IAAiB,EAAU,SAC3BA,IAAiB,MAAQA,IAAiB,EAAU,SACjD,IACR,CACA,OAAIb,IAAQ,WAAaA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EAAAA,IAACJ,EAAA,CACAE,MAAM,UACND,UAAU,uGACVK,WAAU,GAEVH,SAAAC,EAAAA,IAACQ,EAAA,CACAJ,QAAShE,EAAWmC,QACpBlC,oBAAAA,EACD,EACD,EACA2D,EAAAA,IAACJ,EAAA,CACAE,MAAM,WACND,UAAU,uGACVK,WAAU,GAEVH,SAAAC,EAAAA,IAACQ,EAAA,CACAJ,QAAShE,EAAWsC,SACpBrC,oBAAAA,EACD,EACD,EACA2D,EAAAA,IAACJ,EAAA,CACAE,MAAM,QACND,UAAU,uHAEVE,SAAAC,EAAAA,IAACS,EAAA,CACAL,QAAShE,EAAWiB,WACpBgD,eAAgBjE,EAAWmC,SAASC,KACpC8B,QAASlE,EAAWkE,QACpBC,WAAYnE,EAAWiB,YAAYkD,YAAc,GACjDG,qBAAsBtE,EAAWsE,qBAClC,EACD,EACAV,EAAAA,IAACJ,EAAA,CACAE,MAAM,OACND,UAAU,8GAEVE,SAAAC,EAAAA,IAACW,EAAA,CACAC,KAAMxE,EAAWwE,KACjBN,QAASlE,EAAWkE,QACpBI,qBAAsBtE,EAAWsE,qBAClC,EACD,EACAV,EAAAA,IAACJ,EAAA,CACAE,MAAM,OACND,UAAU,8GAEVE,SAAAC,EAAAA,IAACa,EAAA,CAAYC,oBAAqB1E,EAAW0E,oBAAqB,CAAA,CACnE,CAAA,CAAA,CACD,CAAA,CAAA,CACD,CAEF,CAAA,EAEOC,GAAAC,EAAA,UAAyB,CAC/B,OACChB,EAAAA,IAACiB,EAAA,CACAC,eAAgB,CACf,IAAK,IAAMlB,EAAAA,IAAC,IAAA,CAAED,SAAA,uCAAoC,CACnD,CAAA,CACD,CAEF,CAAA"}
1
+ {"version":3,"file":"index-BnHkUMN_.js","sources":["../../../app/routes/_app+/exercise+/$exerciseNumber_.$stepNumber.$type+/index.tsx"],"sourcesContent":["import { type Route } from './+types/index'\nimport {\n\tgetAppByName,\n\tgetAppDisplayName,\n\tgetApps,\n\tgetExerciseApp,\n\tisExerciseStepApp,\n\tisPlaygroundApp,\n\trequireExerciseApp,\n\ttype App,\n\ttype ExerciseStepApp,\n} from '@epic-web/workshop-utils/apps.server'\nimport { getDiffPatch } from '@epic-web/workshop-utils/diff.server'\nimport { userHasAccessToExerciseStep } from '@epic-web/workshop-utils/epic-api.server'\nimport {\n\tcombineServerTimings,\n\tgetServerTimeHeader,\n\tmakeTimings,\n} from '@epic-web/workshop-utils/timing.server'\nimport * as Tabs from '@radix-ui/react-tabs'\nimport * as React from 'react'\nimport {\n\tuseNavigate,\n\tuseSearchParams,\n\tdata,\n\tredirect,\n\ttype HeadersFunction,\n\tuseOutletContext,\n} from 'react-router'\nimport { Diff } from '#app/components/diff.tsx'\nimport { DiscordChat } from '#app/components/discord-chat.tsx'\nimport { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'\nimport { type InBrowserBrowserRef } from '#app/components/in-browser-browser.tsx'\nimport {\n\tgetPreviewSearchParams,\n\tPreviewTabsList,\n} from '#app/components/preview-tabs.tsx'\nimport { useWorkshopConfig } from '#app/components/workshop-config.tsx'\nimport { fetchDiscordPosts } from '#app/utils/discord.server.ts'\nimport { useAltDown } from '#app/utils/misc.tsx'\nimport { Playground } from './__shared/playground.tsx'\nimport { Preview } from './__shared/preview.tsx'\nimport { Tests } from './__shared/tests.tsx'\nimport { getAppRunningState, getTestState } from './__shared/utils.tsx'\n\nexport async function loader({ request, params }: Route.LoaderArgs) {\n\tconst timings = makeTimings('exerciseStepTypeIndexLoader')\n\tconst searchParams = new URL(request.url).searchParams\n\tconst cacheOptions = { request, timings }\n\n\tconst [exerciseStepApp, allAppsFull, problemApp, solutionApp] =\n\t\tawait Promise.all([\n\t\t\trequireExerciseApp(params, cacheOptions),\n\t\t\tgetApps(cacheOptions),\n\t\t\tgetExerciseApp({ ...params, type: 'problem' }, cacheOptions),\n\t\t\tgetExerciseApp({ ...params, type: 'solution' }, cacheOptions),\n\t\t])\n\n\tconst playgroundApp = allAppsFull.find(isPlaygroundApp)\n\tconst reqUrl = new URL(request.url)\n\n\tconst pathnameParam = reqUrl.searchParams.get('pathname')\n\tif (pathnameParam === '' || pathnameParam === '/') {\n\t\treqUrl.searchParams.delete('pathname')\n\t\tthrow redirect(reqUrl.toString())\n\t}\n\n\tconst app1Name = reqUrl.searchParams.get('app1')\n\tconst app2Name = reqUrl.searchParams.get('app2')\n\tconst app1 = app1Name\n\t\t? await getAppByName(app1Name)\n\t\t: playgroundApp || problemApp\n\tconst app2 = app2Name ? await getAppByName(app2Name) : solutionApp\n\n\tfunction getStepId(a: ExerciseStepApp) {\n\t\treturn (\n\t\t\ta.exerciseNumber * 1000 +\n\t\t\ta.stepNumber * 10 +\n\t\t\t(a.type === 'problem' ? 0 : 1)\n\t\t)\n\t}\n\n\tfunction getStepNameAndId(a: App) {\n\t\tif (isExerciseStepApp(a)) {\n\t\t\tconst exerciseNumberStr = String(a.exerciseNumber).padStart(2, '0')\n\t\t\tconst stepNumberStr = String(a.stepNumber).padStart(2, '0')\n\n\t\t\treturn {\n\t\t\t\tstepName: `${exerciseNumberStr}/${stepNumberStr}.${a.type}`,\n\t\t\t\tstepId: getStepId(a),\n\t\t\t}\n\t\t}\n\t\treturn { stepName: '', stepId: -1 }\n\t}\n\n\tconst allApps = allAppsFull\n\t\t.filter((a, i, ar) => ar.findIndex((b) => a.name === b.name) === i)\n\t\t.map((a) => ({\n\t\t\tdisplayName: getAppDisplayName(a, allAppsFull),\n\t\t\tname: a.name,\n\t\t\ttitle: a.title,\n\t\t\ttype: a.type,\n\t\t\t...getStepNameAndId(a),\n\t\t}))\n\n\tallApps.sort((a, b) => {\n\t\t// order them by their stepId\n\t\tif (a.stepId > 0 && b.stepId > 0) return a.stepId - b.stepId\n\n\t\t// non-step apps should come after step apps\n\t\tif (a.stepId > 0) return -1\n\t\tif (b.stepId > 0) return 1\n\n\t\treturn 0\n\t})\n\n\tasync function getDiffProp() {\n\t\tif (!app1 || !app2) {\n\t\t\treturn {\n\t\t\t\tapp1: app1?.name,\n\t\t\t\tapp2: app2?.name,\n\t\t\t\tdiffPatch: null,\n\t\t\t}\n\t\t}\n\t\tconst diffPatch = await getDiffPatch(app1, app2, {\n\t\t\t...cacheOptions,\n\t\t\tforceFresh: searchParams.get('forceFresh') === 'diff',\n\t\t}).catch((e) => {\n\t\t\tconsole.error(e)\n\t\t\treturn null\n\t\t})\n\t\treturn {\n\t\t\tapp1: app1.name,\n\t\t\tapp2: app2.name,\n\t\t\tdiffPatch,\n\t\t}\n\t}\n\n\treturn data(\n\t\t{\n\t\t\ttype: params.type as 'problem' | 'solution',\n\t\t\texerciseStepApp,\n\t\t\tallApps,\n\t\t\t// defer this promise so that we don't block the response from being sent\n\t\t\tdiscordPostsPromise: fetchDiscordPosts({ request }),\n\t\t\tuserHasAccessPromise: userHasAccessToExerciseStep({\n\t\t\t\texerciseNumber: Number(params.exerciseNumber),\n\t\t\t\tstepNumber: Number(params.stepNumber),\n\t\t\t\trequest,\n\t\t\t\ttimings,\n\t\t\t}),\n\t\t\tplayground: playgroundApp\n\t\t\t\t? ({\n\t\t\t\t\t\ttype: 'playground',\n\t\t\t\t\t\tfullPath: playgroundApp.fullPath,\n\t\t\t\t\t\tdev: playgroundApp.dev,\n\t\t\t\t\t\ttest: playgroundApp.test,\n\t\t\t\t\t\ttitle: playgroundApp.title,\n\t\t\t\t\t\tname: playgroundApp.name,\n\t\t\t\t\t\tappName: playgroundApp.appName,\n\t\t\t\t\t\tisUpToDate: playgroundApp.isUpToDate,\n\t\t\t\t\t\tstackBlitzUrl: playgroundApp.stackBlitzUrl,\n\t\t\t\t\t\t...(await getAppRunningState(playgroundApp)),\n\t\t\t\t\t\t...getTestState(playgroundApp),\n\t\t\t\t\t} as const)\n\t\t\t\t: null,\n\t\t\tproblem: problemApp\n\t\t\t\t? ({\n\t\t\t\t\t\ttype: 'problem',\n\t\t\t\t\t\tfullPath: problemApp.fullPath,\n\t\t\t\t\t\tdev: problemApp.dev,\n\t\t\t\t\t\ttest: problemApp.test,\n\t\t\t\t\t\ttitle: problemApp.title,\n\t\t\t\t\t\tname: problemApp.name,\n\t\t\t\t\t\tstackBlitzUrl: problemApp.stackBlitzUrl,\n\t\t\t\t\t\t...(await getAppRunningState(problemApp)),\n\t\t\t\t\t} as const)\n\t\t\t\t: null,\n\t\t\tsolution: solutionApp\n\t\t\t\t? ({\n\t\t\t\t\t\ttype: 'solution',\n\t\t\t\t\t\tfullPath: solutionApp.fullPath,\n\t\t\t\t\t\tdev: solutionApp.dev,\n\t\t\t\t\t\ttest: solutionApp.test,\n\t\t\t\t\t\ttitle: solutionApp.title,\n\t\t\t\t\t\tname: solutionApp.name,\n\t\t\t\t\t\tstackBlitzUrl: solutionApp.stackBlitzUrl,\n\t\t\t\t\t\t...(await getAppRunningState(solutionApp)),\n\t\t\t\t\t} as const)\n\t\t\t\t: null,\n\t\t\tdiff: getDiffProp(),\n\t\t} as const,\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'Server-Timing': combineServerTimings(loaderHeaders, parentHeaders),\n\t}\n\treturn headers\n}\n\nconst tabs = [\n\t'playground',\n\t'problem',\n\t'solution',\n\t'tests',\n\t'diff',\n\t'chat',\n] as const\nconst isValidPreview = (s: string | null): s is (typeof tabs)[number] =>\n\tBoolean(s && tabs.includes(s as (typeof tabs)[number]))\n\nexport default function ExercisePartRoute({\n\tloaderData,\n}: Route.ComponentProps) {\n\tconst { inBrowserBrowserRef } = useOutletContext<{\n\t\tinBrowserBrowserRef: React.RefObject<InBrowserBrowserRef | null>\n\t}>()\n\tconst workshopConfig = useWorkshopConfig()\n\tconst [searchParams] = useSearchParams()\n\n\tconst preview = searchParams.get('preview')\n\n\tconst altDown = useAltDown()\n\tconst navigate = useNavigate()\n\n\tfunction shouldHideTab(tab: (typeof tabs)[number]) {\n\t\tif (tab === 'tests') {\n\t\t\treturn (\n\t\t\t\tENV.EPICSHOP_DEPLOYED ||\n\t\t\t\t!loaderData.playground ||\n\t\t\t\tloaderData.playground.test.type === 'none'\n\t\t\t)\n\t\t}\n\t\tif (tab === 'problem' || tab === 'solution') {\n\t\t\tif (loaderData[tab]?.dev.type === 'none') return true\n\t\t\tif (ENV.EPICSHOP_DEPLOYED) {\n\t\t\t\tconst devType = loaderData[tab]?.dev.type\n\t\t\t\treturn (\n\t\t\t\t\tdevType !== 'browser' &&\n\t\t\t\t\tdevType !== 'export' &&\n\t\t\t\t\t!loaderData[tab]?.stackBlitzUrl\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t\tif (tab === 'playground' && ENV.EPICSHOP_DEPLOYED) return true\n\n\t\tif (tab === 'chat') {\n\t\t\treturn !workshopConfig.product.discordChannelId\n\t\t}\n\t\treturn false\n\t}\n\n\tfunction getTabStatus(\n\t\ttab: (typeof tabs)[number],\n\t): 'running' | 'passed' | 'failed' | null {\n\t\tif (tab === 'tests') {\n\t\t\tif (!loaderData.playground) return null\n\t\t\tconst { isTestRunning, testExitCode } = loaderData.playground\n\t\t\tif (isTestRunning) return 'running'\n\t\t\tif (testExitCode === 0) return 'passed'\n\t\t\tif (testExitCode !== null && testExitCode !== 0) return 'failed'\n\t\t\treturn null\n\t\t}\n\t\tif (tab === 'problem' || tab === 'solution' || tab === 'playground') {\n\t\t\tconst appData =\n\t\t\t\ttab === 'playground' ? loaderData.playground : loaderData[tab]\n\t\t\tif (appData?.isRunning) return 'running'\n\t\t}\n\t\treturn null\n\t}\n\n\tconst activeTab = isValidPreview(preview)\n\t\t? preview\n\t\t: tabs.find((t) => !shouldHideTab(t))\n\n\t// when alt is held down, the diff tab should open to the full-page diff view\n\t// between the problem and solution (this is more for the instructor than the student)\n\tconst altDiffUrl = `/diff?${new URLSearchParams({\n\t\tapp1: loaderData.problem?.name ?? '',\n\t\tapp2: loaderData.solution?.name ?? '',\n\t})}`\n\n\tfunction handleDiffTabClick(event: React.MouseEvent<HTMLAnchorElement>) {\n\t\tif (event.altKey && !event.ctrlKey && !event.shiftKey && !event.metaKey) {\n\t\t\tevent.preventDefault()\n\t\t\tvoid navigate(altDiffUrl)\n\t\t}\n\t}\n\n\tconst previewTabs = tabs.map((tab) => {\n\t\tconst hidden = shouldHideTab(tab)\n\t\tconst status = getTabStatus(tab)\n\t\tconst to =\n\t\t\ttab === 'diff' && altDown\n\t\t\t\t? altDiffUrl\n\t\t\t\t: `?${getPreviewSearchParams(searchParams, tab, 'playground')}`\n\t\treturn {\n\t\t\tid: tab,\n\t\t\tlabel: tab,\n\t\t\thidden,\n\t\t\tstatus,\n\t\t\tto,\n\t\t\tonClick: tab === 'diff' ? handleDiffTabClick : undefined,\n\t\t}\n\t})\n\n\treturn (\n\t\t<Tabs.Root\n\t\t\tclassName=\"relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden sm:col-span-1 sm:row-span-1\"\n\t\t\tvalue={activeTab}\n\t\t\t// intentionally no onValueChange here because the Link will trigger the\n\t\t\t// change.\n\t\t>\n\t\t\t<PreviewTabsList tabs={previewTabs} />\n\t\t\t<div className=\"relative z-10 flex min-h-0 flex-1 flex-col overflow-hidden\">\n\t\t\t\t<Tabs.Content\n\t\t\t\t\tvalue=\"playground\"\n\t\t\t\t\tclassName=\"radix-state-inactive:hidden flex min-h-0 w-full grow basis-0 items-stretch justify-center self-start\"\n\t\t\t\t\tforceMount\n\t\t\t\t>\n\t\t\t\t\t<Playground\n\t\t\t\t\t\tappInfo={loaderData.playground}\n\t\t\t\t\t\tproblemAppName={loaderData.problem?.name}\n\t\t\t\t\t\tinBrowserBrowserRef={inBrowserBrowserRef}\n\t\t\t\t\t\tallApps={loaderData.allApps}\n\t\t\t\t\t\tisUpToDate={loaderData.playground?.isUpToDate ?? false}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Content>\n\t\t\t\t<Tabs.Content\n\t\t\t\t\tvalue=\"problem\"\n\t\t\t\t\tclassName=\"radix-state-inactive:hidden flex min-h-0 w-full grow basis-0 items-stretch justify-center self-start\"\n\t\t\t\t\tforceMount\n\t\t\t\t>\n\t\t\t\t\t<Preview\n\t\t\t\t\t\tappInfo={loaderData.problem}\n\t\t\t\t\t\tinBrowserBrowserRef={inBrowserBrowserRef}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Content>\n\t\t\t\t<Tabs.Content\n\t\t\t\t\tvalue=\"solution\"\n\t\t\t\t\tclassName=\"radix-state-inactive:hidden flex min-h-0 w-full grow basis-0 items-stretch justify-center self-start\"\n\t\t\t\t\tforceMount\n\t\t\t\t>\n\t\t\t\t\t<Preview\n\t\t\t\t\t\tappInfo={loaderData.solution}\n\t\t\t\t\t\tinBrowserBrowserRef={inBrowserBrowserRef}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Content>\n\t\t\t\t<Tabs.Content\n\t\t\t\t\tvalue=\"tests\"\n\t\t\t\t\tclassName=\"radix-state-inactive:hidden flex min-h-0 w-full grow basis-0 items-stretch justify-center self-start overflow-hidden\"\n\t\t\t\t>\n\t\t\t\t\t<Tests\n\t\t\t\t\t\tappInfo={loaderData.playground}\n\t\t\t\t\t\tproblemAppName={loaderData.problem?.name}\n\t\t\t\t\t\tallApps={loaderData.allApps}\n\t\t\t\t\t\tisUpToDate={loaderData.playground?.isUpToDate ?? false}\n\t\t\t\t\t\tuserHasAccessPromise={loaderData.userHasAccessPromise}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Content>\n\t\t\t\t<Tabs.Content\n\t\t\t\t\tvalue=\"diff\"\n\t\t\t\t\tclassName=\"radix-state-inactive:hidden flex h-full min-h-0 w-full grow basis-0 items-stretch justify-center self-start\"\n\t\t\t\t>\n\t\t\t\t\t<Diff\n\t\t\t\t\t\tdiff={loaderData.diff}\n\t\t\t\t\t\tallApps={loaderData.allApps}\n\t\t\t\t\t\tuserHasAccessPromise={loaderData.userHasAccessPromise}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Content>\n\t\t\t\t<Tabs.Content\n\t\t\t\t\tvalue=\"chat\"\n\t\t\t\t\tclassName=\"radix-state-inactive:hidden flex h-full min-h-0 w-full grow basis-0 items-stretch justify-center self-start\"\n\t\t\t\t>\n\t\t\t\t\t<DiscordChat discordPostsPromise={loaderData.discordPostsPromise} />\n\t\t\t\t</Tabs.Content>\n\t\t\t</div>\n\t\t</Tabs.Root>\n\t)\n}\n\nexport function ErrorBoundary() {\n\treturn (\n\t\t<GeneralErrorBoundary\n\t\t\tstatusHandlers={{\n\t\t\t\t404: () => <p>Sorry, we couldn't find an app here.</p>,\n\t\t\t}}\n\t\t/>\n\t)\n}\n"],"names":["tabs","isValidPreview","s","Boolean","includes","index","_UNSAFE_withComponentProps","loaderData","inBrowserBrowserRef","useOutletContext","workshopConfig","useWorkshopConfig","searchParams","useSearchParams","preview","get","altDown","useAltDown","navigate","useNavigate","shouldHideTab","tab","ENV","EPICSHOP_DEPLOYED","playground","test","type","dev","devType","stackBlitzUrl","product","discordChannelId","getTabStatus","isTestRunning","testExitCode","isRunning","activeTab","find","t","altDiffUrl","URLSearchParams","app1","problem","name","app2","solution","handleDiffTabClick","event","altKey","ctrlKey","shiftKey","metaKey","preventDefault","previewTabs","map","hidden","status","to","getPreviewSearchParams","id","label","onClick","jsxs","Tabs","className","value","children","jsx","PreviewTabsList","forceMount","Playground","appInfo","problemAppName","allApps","isUpToDate","Preview","Tests","userHasAccessPromise","Diff","diff","DiscordChat","discordPostsPromise","ErrorBoundary","_UNSAFE_withErrorBoundaryProps","GeneralErrorBoundary","statusHandlers"],"mappings":"y4CA+MA,MAAMA,EAAO,CACZ,aACA,UACA,WACA,QACA,OACA,MAAA,EAEKC,EAAkBC,GACvBC,GAAQD,GAAKF,EAAKI,SAASF,CAA0B,GAEtDG,GAAAC,EAAA,SAA0C,CACzCC,WAAAA,CACD,EAAyB,CACxB,KAAM,CAAEC,oBAAAA,GAAwBC,EAAA,EAG1BC,EAAiBC,EAAA,EACjB,CAACC,CAAY,EAAIC,EAAA,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EAAWmC,SAASC,KACpC8B,QAASlE,EAAWkE,QACpBC,WAAYnE,EAAWiB,YAAYkD,YAAc,GACjDG,qBAAsBtE,EAAWsE,qBAClC,EACD,EACAV,EAAAA,IAACJ,EAAA,CACAE,MAAM,OACND,UAAU,8GAEVE,SAAAC,EAAAA,IAACW,EAAA,CACAC,KAAMxE,EAAWwE,KACjBN,QAASlE,EAAWkE,QACpBI,qBAAsBtE,EAAWsE,qBAClC,EACD,EACAV,EAAAA,IAACJ,EAAA,CACAE,MAAM,OACND,UAAU,8GAEVE,SAAAC,EAAAA,IAACa,EAAA,CAAYC,oBAAqB1E,EAAW0E,oBAAqB,CAAA,CACnE,CAAA,CAAA,CACD,CAAA,CAAA,CACD,CAEF,CAAA,EAEOC,GAAAC,EAAA,UAAyB,CAC/B,OACChB,EAAAA,IAACiB,EAAA,CACAC,eAAgB,CACf,IAAK,IAAMlB,EAAAA,IAAC,IAAA,CAAED,SAAA,uCAAoC,CACnD,CAAA,CACD,CAEF,CAAA"}
@@ -1,2 +1,2 @@
1
- import{w as s,a,b as i,L as l}from"./chunk-JZWAC4HX-BuixXc9D.js";import{j as e}from"./jsx-runtime-C5WNSv3b.js";import{E as n}from"./index-3PqfcnMA.js";import{E as m}from"./epic-video-C9q0z-QM.js";import{G as d}from"./error-boundary-DCY9a5Cj.js";import{u as c}from"./revalidation-ws-JHvxsHsY.js";import{E as x}from"./launch-editor-C8OwTN5L.js";import{M as p}from"./mdx-Bvb9XNyL.js";import{c as f}from"./misc-D9k_mI0z.js";import{g as u}from"./root-loader-DAxaiFMN.js";import{g as h}from"./seo-t5J-DRxw.js";import"./index-Bi6L2ga8.js";import"./loading-BjV0PtX2.js";import"./index-DSpM0ReJ.js";import"./tooltip-H74tOFSr.js";import"./index-B2VNpNxJ.js";import"./pe-D585gnmh.js";import"./schemas-siASSt6b.js";import"./index-E_6kulJP.js";import"./online-x7UFobEJ.js";import"./format-CZ5n8p10.js";import"./user-DhjrtSbZ.js";import"./workshop-config-v_LiyFvY.js";import"./preload-helper-BXl3LOEh.js";import"./progress-bar-BCbq1CuC.js";const Q=o=>{const r=o.data,t=u(o.matches);return!r||!t?[{title:"🦉 | Error"}]:h({title:`📚 | ${r.title} | ${t.workshopTitle}`,description:`Extras for ${t.workshopTitle}`,ogTitle:r.title,ogDescription:`Extras for ${t.workshopTitle}`,instructor:t.instructor,requestInfo:t.requestInfo})};function j({extra:o}){return e.jsx("li",{children:e.jsxs(l,{className:f("relative flex items-center gap-4 px-4 py-3 text-lg font-semibold transition","hover:bg-muted/60 focus:bg-muted/60"),prefetch:"intent",to:o.dirName,children:[e.jsx("span",{className:"text-muted-foreground text-xs font-normal tabular-nums",children:"•"}),e.jsx("span",{className:"truncate",children:o.title})]})})}const v={h1:()=>null},W=s(function(){const r=i();return c({watchPaths:["./extra","./example","./examples"]}),e.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:[e.jsxs("article",{id:r.articleId,className:"shadow-on-scrollbox scrollbar-thin scrollbar-thumb-scrollbar flex w-full flex-1 flex-col gap-12 overflow-y-scroll px-3 py-4 pt-6 md:px-10 md:py-12 md:pt-16",children:[e.jsx("div",{children:e.jsx("h1",{className:"text-[clamp(3rem,6vw,7.5rem)] leading-none font-extrabold",children:r.title})}),e.jsx("div",{children:r.extrasReadme.compiled.status==="success"&&r.extrasReadme.compiled.code?e.jsx(m,{epicVideoInfosPromise:r.epicVideoInfosPromise,children:e.jsx("div",{className:"prose dark:prose-invert sm:prose-lg",children:e.jsx(p,{code:r.extrasReadme.compiled.code,components:v})})}):r.extrasReadme.compiled.status==="error"?e.jsxs("div",{className:"text-foreground-destructive",children:["There was an error:",e.jsx("pre",{children:r.extrasReadme.compiled.error})]}):"No extras overview yet..."}),e.jsxs("div",{className:"pt-6",children:[e.jsx("h2",{className:"pb-4 font-mono text-xs font-semibold uppercase",children:"Extras"}),r.extras.length?e.jsx("ul",{className:"divide-border dark:divide-border/50 flex flex-col divide-y",children:r.extras.map(t=>e.jsx(j,{extra:t},t.dirName))}):e.jsx("p",{className:"text-muted-foreground",children:"No extras yet. Add one to get started."})]})]}),e.jsx(n,{elementQuery:`#${r.articleId}`}),e.jsx("div",{className:"@container flex h-16 justify-center border-t",children:e.jsx(x,{file:r.extrasReadme.file,relativePath:r.extrasReadme.relativePath})})]})}),z=a(function(){return e.jsx(d,{})});export{z as ErrorBoundary,W as default,Q as meta};
2
- //# sourceMappingURL=index-CKhNevM7.js.map
1
+ import{w as s,a,b as i,L as l}from"./chunk-JZWAC4HX-BuixXc9D.js";import{j as e}from"./jsx-runtime-C5WNSv3b.js";import{E as n}from"./index-3PqfcnMA.js";import{E as m}from"./epic-video-C9q0z-QM.js";import{G as d}from"./error-boundary-DCY9a5Cj.js";import{u as c}from"./revalidation-ws-JHvxsHsY.js";import{E as x}from"./launch-editor-C-8ah8qM.js";import{M as p}from"./mdx-C3Jl4O5D.js";import{c as f}from"./misc-D9k_mI0z.js";import{g as u}from"./root-loader-DAxaiFMN.js";import{g as h}from"./seo-t5J-DRxw.js";import"./index-Bi6L2ga8.js";import"./loading-BjV0PtX2.js";import"./index-DSpM0ReJ.js";import"./tooltip-H74tOFSr.js";import"./index-B2VNpNxJ.js";import"./pe-D585gnmh.js";import"./schemas-siASSt6b.js";import"./index-E_6kulJP.js";import"./online-x7UFobEJ.js";import"./format-CZ5n8p10.js";import"./user-DhjrtSbZ.js";import"./workshop-config-v_LiyFvY.js";import"./preload-helper-BXl3LOEh.js";import"./progress-bar-BCbq1CuC.js";const Q=o=>{const r=o.data,t=u(o.matches);return!r||!t?[{title:"🦉 | Error"}]:h({title:`📚 | ${r.title} | ${t.workshopTitle}`,description:`Extras for ${t.workshopTitle}`,ogTitle:r.title,ogDescription:`Extras for ${t.workshopTitle}`,instructor:t.instructor,requestInfo:t.requestInfo})};function j({extra:o}){return e.jsx("li",{children:e.jsxs(l,{className:f("relative flex items-center gap-4 px-4 py-3 text-lg font-semibold transition","hover:bg-muted/60 focus:bg-muted/60"),prefetch:"intent",to:o.dirName,children:[e.jsx("span",{className:"text-muted-foreground text-xs font-normal tabular-nums",children:"•"}),e.jsx("span",{className:"truncate",children:o.title})]})})}const v={h1:()=>null},W=s(function(){const r=i();return c({watchPaths:["./extra","./example","./examples"]}),e.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:[e.jsxs("article",{id:r.articleId,className:"shadow-on-scrollbox scrollbar-thin scrollbar-thumb-scrollbar flex w-full flex-1 flex-col gap-12 overflow-y-scroll px-3 py-4 pt-6 md:px-10 md:py-12 md:pt-16",children:[e.jsx("div",{children:e.jsx("h1",{className:"text-[clamp(3rem,6vw,7.5rem)] leading-none font-extrabold",children:r.title})}),e.jsx("div",{children:r.extrasReadme.compiled.status==="success"&&r.extrasReadme.compiled.code?e.jsx(m,{epicVideoInfosPromise:r.epicVideoInfosPromise,children:e.jsx("div",{className:"prose dark:prose-invert sm:prose-lg",children:e.jsx(p,{code:r.extrasReadme.compiled.code,components:v})})}):r.extrasReadme.compiled.status==="error"?e.jsxs("div",{className:"text-foreground-destructive",children:["There was an error:",e.jsx("pre",{children:r.extrasReadme.compiled.error})]}):"No extras overview yet..."}),e.jsxs("div",{className:"pt-6",children:[e.jsx("h2",{className:"pb-4 font-mono text-xs font-semibold uppercase",children:"Extras"}),r.extras.length?e.jsx("ul",{className:"divide-border dark:divide-border/50 flex flex-col divide-y",children:r.extras.map(t=>e.jsx(j,{extra:t},t.dirName))}):e.jsx("p",{className:"text-muted-foreground",children:"No extras yet. Add one to get started."})]})]}),e.jsx(n,{elementQuery:`#${r.articleId}`}),e.jsx("div",{className:"@container flex h-16 justify-center border-t",children:e.jsx(x,{file:r.extrasReadme.file,relativePath:r.extrasReadme.relativePath})})]})}),z=a(function(){return e.jsx(d,{})});export{z as ErrorBoundary,W as default,Q as meta};
2
+ //# sourceMappingURL=index-Bo0DKzj5.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-CKhNevM7.js","sources":["../../../app/routes/_app+/extra+/index.tsx"],"sourcesContent":["import { type Route } from './+types/index'\nimport { ElementScrollRestoration } from '@epic-web/restore-scroll'\nimport {\n\tgetApps,\n\tgetExtrasInstructions,\n\tisExtraApp,\n} from '@epic-web/workshop-utils/apps.server'\nimport { getWorkshopConfig } from '@epic-web/workshop-utils/config.server'\nimport { getEpicVideoInfos } from '@epic-web/workshop-utils/epic-api.server'\nimport {\n\tcombineServerTimings,\n\tgetServerTimeHeader,\n\tmakeTimings,\n\ttime,\n} from '@epic-web/workshop-utils/timing.server'\nimport slugify from '@sindresorhus/slugify'\nimport { data, type HeadersFunction, Link, useLoaderData } from 'react-router'\nimport { EpicVideoInfoProvider } from '#app/components/epic-video.tsx'\nimport { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'\nimport { useRevalidationWS } from '#app/components/revalidation-ws.tsx'\nimport { EditFileOnGitHub } from '#app/routes/launch-editor.tsx'\nimport { Mdx } from '#app/utils/mdx.tsx'\nimport { cn } from '#app/utils/misc.tsx'\nimport { getRootMatchLoaderData } from '#app/utils/root-loader.ts'\nimport { getSeoMetaTags } from '#app/utils/seo.ts'\n\nexport const meta: Route.MetaFunction = (args) => {\n\tconst loaderData = args.data\n\tconst rootData = getRootMatchLoaderData(args.matches)\n\tif (!loaderData || !rootData) return [{ title: '🦉 | Error' }]\n\n\treturn getSeoMetaTags({\n\t\ttitle: `📚 | ${loaderData.title} | ${rootData.workshopTitle}`,\n\t\tdescription: `Extras for ${rootData.workshopTitle}`,\n\t\togTitle: loaderData.title,\n\t\togDescription: `Extras for ${rootData.workshopTitle}`,\n\t\tinstructor: rootData.instructor,\n\t\trequestInfo: rootData.requestInfo,\n\t})\n}\n\nexport async function loader({ request }: Route.LoaderArgs) {\n\tconst timings = makeTimings('extrasIndexLoader')\n\tconst { title: workshopTitle } = getWorkshopConfig()\n\tconst [extrasReadme, apps] = await Promise.all([\n\t\ttime(() => getExtrasInstructions({ request }), {\n\t\t\ttimings,\n\t\t\ttype: 'compileMdx',\n\t\t\tdesc: 'compileMdx in extras index',\n\t\t}),\n\t\ttime(() => getApps({ request, timings }), {\n\t\t\ttimings,\n\t\t\ttype: 'getApps',\n\t\t\tdesc: 'getApps in extras index',\n\t\t}),\n\t])\n\n\tconst extras = apps\n\t\t.filter(isExtraApp)\n\t\t.sort((a, b) =>\n\t\t\ta.title.localeCompare(b.title, undefined, {\n\t\t\t\tnumeric: true,\n\t\t\t\tsensitivity: 'base',\n\t\t\t}),\n\t\t)\n\t\t.map((extra) => ({\n\t\t\tdirName: extra.dirName,\n\t\t\ttitle: extra.title,\n\t\t}))\n\n\tconst title =\n\t\textrasReadme.compiled.status === 'success'\n\t\t\t? (extrasReadme.compiled.title ?? 'Extras')\n\t\t\t: 'Extras'\n\n\treturn data(\n\t\t{\n\t\t\tarticleId: `workshop-${slugify(workshopTitle)}-extras`,\n\t\t\ttitle,\n\t\t\textras,\n\t\t\textrasReadme,\n\t\t\tepicVideoInfosPromise:\n\t\t\t\textrasReadme.compiled.status === 'success'\n\t\t\t\t\t? getEpicVideoInfos(extrasReadme.compiled.epicVideoEmbeds, {\n\t\t\t\t\t\t\trequest,\n\t\t\t\t\t\t})\n\t\t\t\t\t: null,\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\nfunction ExtraListItem({\n\textra,\n}: {\n\textra: { dirName: string; title: string }\n}) {\n\treturn (\n\t\t<li>\n\t\t\t<Link\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'relative flex items-center gap-4 px-4 py-3 text-lg font-semibold transition',\n\t\t\t\t\t'hover:bg-muted/60 focus:bg-muted/60',\n\t\t\t\t)}\n\t\t\t\tprefetch=\"intent\"\n\t\t\t\tto={extra.dirName}\n\t\t\t>\n\t\t\t\t<span className=\"text-muted-foreground text-xs font-normal tabular-nums\">\n\t\t\t\t\t•\n\t\t\t\t</span>\n\t\t\t\t<span className=\"truncate\">{extra.title}</span>\n\t\t\t</Link>\n\t\t</li>\n\t)\n}\n\nconst mdxComponents = { h1: () => null }\n\nexport default function ExtrasIndex() {\n\tconst data = useLoaderData<typeof loader>()\n\tuseRevalidationWS({ watchPaths: ['./extra', './example', './examples'] })\n\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\tclassName=\"shadow-on-scrollbox scrollbar-thin scrollbar-thumb-scrollbar flex w-full flex-1 flex-col gap-12 overflow-y-scroll px-3 py-4 pt-6 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)] leading-none font-extrabold\">\n\t\t\t\t\t\t{data.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.extrasReadme.compiled.status === 'success' &&\n\t\t\t\t\tdata.extrasReadme.compiled.code ? (\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.extrasReadme.compiled.code}\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) : data.extrasReadme.compiled.status === 'error' ? (\n\t\t\t\t\t\t<div className=\"text-foreground-destructive\">\n\t\t\t\t\t\t\tThere was an error:\n\t\t\t\t\t\t\t<pre>{data.extrasReadme.compiled.error}</pre>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t'No extras overview yet...'\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t\t<div className=\"pt-6\">\n\t\t\t\t\t<h2 className=\"pb-4 font-mono text-xs font-semibold uppercase\">\n\t\t\t\t\t\tExtras\n\t\t\t\t\t</h2>\n\t\t\t\t\t{data.extras.length ? (\n\t\t\t\t\t\t<ul className=\"divide-border dark:divide-border/50 flex flex-col divide-y\">\n\t\t\t\t\t\t\t{data.extras.map((extra) => (\n\t\t\t\t\t\t\t\t<ExtraListItem key={extra.dirName} extra={extra} />\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<p className=\"text-muted-foreground\">\n\t\t\t\t\t\t\tNo extras yet. Add one to get started.\n\t\t\t\t\t\t</p>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</article>\n\t\t\t<ElementScrollRestoration elementQuery={`#${data.articleId}`} />\n\t\t\t<div className=\"@container flex h-16 justify-center border-t\">\n\t\t\t\t<EditFileOnGitHub\n\t\t\t\t\tfile={data.extrasReadme.file}\n\t\t\t\t\trelativePath={data.extrasReadme.relativePath}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</main>\n\t)\n}\n\nexport function ErrorBoundary() {\n\treturn <GeneralErrorBoundary />\n}\n"],"names":["meta","args","loaderData","data","rootData","getRootMatchLoaderData","matches","title","getSeoMetaTags","workshopTitle","description","ogTitle","ogDescription","instructor","requestInfo","ExtraListItem","extra","children","jsxs","Link","className","cn","prefetch","to","dirName","jsx","mdxComponents","h1","index","_UNSAFE_withComponentProps","useLoaderData","useRevalidationWS","watchPaths","id","articleId","extrasReadme","compiled","status","code","EpicVideoInfoProvider","epicVideoInfosPromise","Mdx","components","error","extras","length","map","ElementScrollRestoration","elementQuery","EditFileOnGitHub","file","relativePath","ErrorBoundary","_UNSAFE_withErrorBoundaryProps","GeneralErrorBoundary"],"mappings":"85BA0BO,MAAMA,EAA4BC,GAAS,CACjD,MAAMC,EAAaD,EAAKE,KAClBC,EAAWC,EAAuBJ,EAAKK,OAAO,EACpD,MAAI,CAACJ,GAAc,CAACE,EAAiB,CAAC,CAAEG,MAAO,YAAa,CAAC,EAEtDC,EAAe,CACrBD,MAAO,QAAQL,EAAWK,KAAK,MAAMH,EAASK,aAAa,GAC3DC,YAAa,cAAcN,EAASK,aAAa,GACjDE,QAAST,EAAWK,MACpBK,cAAe,cAAcR,EAASK,aAAa,GACnDI,WAAYT,EAASS,WACrBC,YAAaV,EAASU,WACvB,CAAC,CACF,EAiEA,SAASC,EAAc,CACtBC,MAAAA,CACD,EAEG,CACF,aACE,KAAA,CACAC,SAAAC,EAAAA,KAACC,EAAA,CACAC,UAAWC,EACV,8EACA,qCACD,EACAC,SAAS,SACTC,GAAIP,EAAMQ,QAEVP,SAAA,CAAAQ,EAAAA,IAAC,OAAA,CAAKL,UAAU,yDAAyDH,SAAA,GAAA,CAEzE,EACAQ,EAAAA,IAAC,OAAA,CAAKL,UAAU,WAAYH,WAAMV,KAAA,CAAM,CAAA,EACzC,CAAA,CACD,CAEF,CAEA,MAAMmB,EAAgB,CAAEC,GAAIA,IAAM,IAAK,EAEvCC,EAAAC,EAAA,UAAsC,CACrC,MAAM1B,EAAO2B,EAAA,EACbC,OAAAA,EAAkB,CAAEC,WAAY,CAAC,UAAW,YAAa,YAAY,CAAE,CAAC,EAGvEd,EAAAA,KAAC,OAAA,CAAKE,UAAU,4FACfH,SAAA,CAAAC,EAAAA,KAAC,UAAA,CACAe,GAAI9B,EAAK+B,UACTd,UAAU,8JAEVH,SAAA,CAAAQ,EAAAA,IAAC,MAAA,CACAR,eAAC,KAAA,CAAGG,UAAU,4DACZH,SAAAd,EAAKI,MACP,CAAA,CACD,EACAkB,EA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"version":3,"file":"index-Bo0DKzj5.js","sources":["../../../app/routes/_app+/extra+/index.tsx"],"sourcesContent":["import { type Route } from './+types/index'\nimport { ElementScrollRestoration } from '@epic-web/restore-scroll'\nimport {\n\tgetApps,\n\tgetExtrasInstructions,\n\tisExtraApp,\n} from '@epic-web/workshop-utils/apps.server'\nimport { getWorkshopConfig } from '@epic-web/workshop-utils/config.server'\nimport { getEpicVideoInfos } from '@epic-web/workshop-utils/epic-api.server'\nimport {\n\tcombineServerTimings,\n\tgetServerTimeHeader,\n\tmakeTimings,\n\ttime,\n} from '@epic-web/workshop-utils/timing.server'\nimport slugify from '@sindresorhus/slugify'\nimport { data, type HeadersFunction, Link, useLoaderData } from 'react-router'\nimport { EpicVideoInfoProvider } from '#app/components/epic-video.tsx'\nimport { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'\nimport { useRevalidationWS } from '#app/components/revalidation-ws.tsx'\nimport { EditFileOnGitHub } from '#app/routes/launch-editor.tsx'\nimport { Mdx } from '#app/utils/mdx.tsx'\nimport { cn } from '#app/utils/misc.tsx'\nimport { getRootMatchLoaderData } from '#app/utils/root-loader.ts'\nimport { getSeoMetaTags } from '#app/utils/seo.ts'\n\nexport const meta: Route.MetaFunction = (args) => {\n\tconst loaderData = args.data\n\tconst rootData = getRootMatchLoaderData(args.matches)\n\tif (!loaderData || !rootData) return [{ title: '🦉 | Error' }]\n\n\treturn getSeoMetaTags({\n\t\ttitle: `📚 | ${loaderData.title} | ${rootData.workshopTitle}`,\n\t\tdescription: `Extras for ${rootData.workshopTitle}`,\n\t\togTitle: loaderData.title,\n\t\togDescription: `Extras for ${rootData.workshopTitle}`,\n\t\tinstructor: rootData.instructor,\n\t\trequestInfo: rootData.requestInfo,\n\t})\n}\n\nexport async function loader({ request }: Route.LoaderArgs) {\n\tconst timings = makeTimings('extrasIndexLoader')\n\tconst { title: workshopTitle } = getWorkshopConfig()\n\tconst [extrasReadme, apps] = await Promise.all([\n\t\ttime(() => getExtrasInstructions({ request }), {\n\t\t\ttimings,\n\t\t\ttype: 'compileMdx',\n\t\t\tdesc: 'compileMdx in extras index',\n\t\t}),\n\t\ttime(() => getApps({ request, timings }), {\n\t\t\ttimings,\n\t\t\ttype: 'getApps',\n\t\t\tdesc: 'getApps in extras index',\n\t\t}),\n\t])\n\n\tconst extras = apps\n\t\t.filter(isExtraApp)\n\t\t.sort((a, b) =>\n\t\t\ta.title.localeCompare(b.title, undefined, {\n\t\t\t\tnumeric: true,\n\t\t\t\tsensitivity: 'base',\n\t\t\t}),\n\t\t)\n\t\t.map((extra) => ({\n\t\t\tdirName: extra.dirName,\n\t\t\ttitle: extra.title,\n\t\t}))\n\n\tconst title =\n\t\textrasReadme.compiled.status === 'success'\n\t\t\t? (extrasReadme.compiled.title ?? 'Extras')\n\t\t\t: 'Extras'\n\n\treturn data(\n\t\t{\n\t\t\tarticleId: `workshop-${slugify(workshopTitle)}-extras`,\n\t\t\ttitle,\n\t\t\textras,\n\t\t\textrasReadme,\n\t\t\tepicVideoInfosPromise:\n\t\t\t\textrasReadme.compiled.status === 'success'\n\t\t\t\t\t? getEpicVideoInfos(extrasReadme.compiled.epicVideoEmbeds, {\n\t\t\t\t\t\t\trequest,\n\t\t\t\t\t\t})\n\t\t\t\t\t: null,\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\nfunction ExtraListItem({\n\textra,\n}: {\n\textra: { dirName: string; title: string }\n}) {\n\treturn (\n\t\t<li>\n\t\t\t<Link\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'relative flex items-center gap-4 px-4 py-3 text-lg font-semibold transition',\n\t\t\t\t\t'hover:bg-muted/60 focus:bg-muted/60',\n\t\t\t\t)}\n\t\t\t\tprefetch=\"intent\"\n\t\t\t\tto={extra.dirName}\n\t\t\t>\n\t\t\t\t<span className=\"text-muted-foreground text-xs font-normal tabular-nums\">\n\t\t\t\t\t•\n\t\t\t\t</span>\n\t\t\t\t<span className=\"truncate\">{extra.title}</span>\n\t\t\t</Link>\n\t\t</li>\n\t)\n}\n\nconst mdxComponents = { h1: () => null }\n\nexport default function ExtrasIndex() {\n\tconst data = useLoaderData<typeof loader>()\n\tuseRevalidationWS({ watchPaths: ['./extra', './example', './examples'] })\n\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\tclassName=\"shadow-on-scrollbox scrollbar-thin scrollbar-thumb-scrollbar flex w-full flex-1 flex-col gap-12 overflow-y-scroll px-3 py-4 pt-6 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)] leading-none font-extrabold\">\n\t\t\t\t\t\t{data.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.extrasReadme.compiled.status === 'success' &&\n\t\t\t\t\tdata.extrasReadme.compiled.code ? (\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.extrasReadme.compiled.code}\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) : data.extrasReadme.compiled.status === 'error' ? (\n\t\t\t\t\t\t<div className=\"text-foreground-destructive\">\n\t\t\t\t\t\t\tThere was an error:\n\t\t\t\t\t\t\t<pre>{data.extrasReadme.compiled.error}</pre>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t'No extras overview yet...'\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t\t<div className=\"pt-6\">\n\t\t\t\t\t<h2 className=\"pb-4 font-mono text-xs font-semibold uppercase\">\n\t\t\t\t\t\tExtras\n\t\t\t\t\t</h2>\n\t\t\t\t\t{data.extras.length ? (\n\t\t\t\t\t\t<ul className=\"divide-border dark:divide-border/50 flex flex-col divide-y\">\n\t\t\t\t\t\t\t{data.extras.map((extra) => (\n\t\t\t\t\t\t\t\t<ExtraListItem key={extra.dirName} extra={extra} />\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<p className=\"text-muted-foreground\">\n\t\t\t\t\t\t\tNo extras yet. Add one to get started.\n\t\t\t\t\t\t</p>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</article>\n\t\t\t<ElementScrollRestoration elementQuery={`#${data.articleId}`} />\n\t\t\t<div className=\"@container flex h-16 justify-center border-t\">\n\t\t\t\t<EditFileOnGitHub\n\t\t\t\t\tfile={data.extrasReadme.file}\n\t\t\t\t\trelativePath={data.extrasReadme.relativePath}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</main>\n\t)\n}\n\nexport function ErrorBoundary() {\n\treturn <GeneralErrorBoundary />\n}\n"],"names":["meta","args","loaderData","data","rootData","getRootMatchLoaderData","matches","title","getSeoMetaTags","workshopTitle","description","ogTitle","ogDescription","instructor","requestInfo","ExtraListItem","extra","children","jsxs","Link","className","cn","prefetch","to","dirName","jsx","mdxComponents","h1","index","_UNSAFE_withComponentProps","useLoaderData","useRevalidationWS","watchPaths","id","articleId","extrasReadme","compiled","status","code","EpicVideoInfoProvider","epicVideoInfosPromise","Mdx","components","error","extras","length","map","ElementScrollRestoration","elementQuery","EditFileOnGitHub","file","relativePath","ErrorBoundary","_UNSAFE_withErrorBoundaryProps","GeneralErrorBoundary"],"mappings":"85BA0BO,MAAMA,EAA4BC,GAAS,CACjD,MAAMC,EAAaD,EAAKE,KAClBC,EAAWC,EAAuBJ,EAAKK,OAAO,EACpD,MAAI,CAACJ,GAAc,CAACE,EAAiB,CAAC,CAAEG,MAAO,YAAa,CAAC,EAEtDC,EAAe,CACrBD,MAAO,QAAQL,EAAWK,KAAK,MAAMH,EAASK,aAAa,GAC3DC,YAAa,cAAcN,EAASK,aAAa,GACjDE,QAAST,EAAWK,MACpBK,cAAe,cAAcR,EAASK,aAAa,GACnDI,WAAYT,EAASS,WACrBC,YAAaV,EAASU,WACvB,CAAC,CACF,EAiEA,SAASC,EAAc,CACtBC,MAAAA,CACD,EAEG,CACF,aACE,KAAA,CACAC,SAAAC,EAAAA,KAACC,EAAA,CACAC,UAAWC,EACV,8EACA,qCACD,EACAC,SAAS,SACTC,GAAIP,EAAMQ,QAEVP,SAAA,CAAAQ,EAAAA,IAAC,OAAA,CAAKL,UAAU,yDAAyDH,SAAA,GAAA,CAEzE,EACAQ,EAAAA,IAAC,OAAA,CAAKL,UAAU,WAAYH,WAAMV,KAAA,CAAM,CAAA,EACzC,CAAA,CACD,CAEF,CAEA,MAAMmB,EAAgB,CAAEC,GAAIA,IAAM,IAAK,EAEvCC,EAAAC,EAAA,UAAsC,CACrC,MAAM1B,EAAO2B,EAAA,EACbC,OAAAA,EAAkB,CAAEC,WAAY,CAAC,UAAW,YAAa,YAAY,CAAE,CAAC,EAGvEd,EAAAA,KAAC,OAAA,CAAKE,UAAU,4FACfH,SAAA,CAAAC,EAAAA,KAAC,UAAA,CACAe,GAAI9B,EAAK+B,UACTd,UAAU,8JAEVH,SAAA,CAAAQ,EAAAA,IAAC,MAAA,CACAR,eAAC,KAAA,CAAGG,UAAU,4DACZH,SAAAd,EAAKI,MACP,CAAA,CAC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AA"}
@@ -1,2 +1,2 @@
1
- import{w as l,a as m,L as n}from"./chunk-JZWAC4HX-BuixXc9D.js";import{j as e}from"./jsx-runtime-C5WNSv3b.js";import{E as a}from"./index-3PqfcnMA.js";import{E as c}from"./epic-video-C9q0z-QM.js";import{G as p}from"./error-boundary-DCY9a5Cj.js";import{E as d}from"./launch-editor-C8OwTN5L.js";import{M as x}from"./mdx-Bvb9XNyL.js";import{c as f}from"./misc-D9k_mI0z.js";import{P as h,u}from"./progress-BvO_W5nB.js";import"./index-Bi6L2ga8.js";import"./loading-BjV0PtX2.js";import"./index-DSpM0ReJ.js";import"./tooltip-H74tOFSr.js";import"./index-B2VNpNxJ.js";import"./root-loader-DAxaiFMN.js";import"./pe-D585gnmh.js";import"./schemas-siASSt6b.js";import"./index-E_6kulJP.js";import"./online-x7UFobEJ.js";import"./format-CZ5n8p10.js";import"./user-DhjrtSbZ.js";import"./workshop-config-v_LiyFvY.js";import"./preload-helper-BXl3LOEh.js";import"./progress-bar-BCbq1CuC.js";function b({index:o,exercise:r}){const s=u(r.exerciseNumber);return e.jsx("li",{children:e.jsxs(n,{className:f("hover:bg-muted/60 relative flex items-center gap-4 px-4 py-3 text-lg font-semibold transition after:absolute after:right-10 after:-translate-x-2 after:opacity-0 after:transition after:content-['→'] hover:after:translate-x-0 hover:after:opacity-100",s),to:`${r.exerciseNumber.toString().padStart(2,"0")}`,"data-keyboard-action":o===0?"g+n":void 0,children:[e.jsx("span",{className:"text-xs font-normal tabular-nums opacity-50",children:r.exerciseNumber}),e.jsx("span",{children:r.title})]})},r.exerciseNumber)}const j={h1:()=>null},q=l(function({loaderData:r}){const s=e.jsxs("ul",{className:"divide-border dark:divide-border/50 flex flex-col divide-y",children:[e.jsx("strong",{className:"px-10 pb-3 font-mono text-xs uppercase",children:"Exercises"}),r.exercises.map((t,i)=>e.jsx(b,{index:i,exercise:t},t.exerciseNumber))]});return e.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:[e.jsxs("article",{id:r.articleId,className:"shadow-on-scrollbox scrollbar-thin scrollbar-thumb-scrollbar flex w-full flex-1 flex-col gap-12 overflow-y-scroll px-3 py-4 pt-6 md:px-10 md:py-12 md:pt-16",children:[e.jsx("div",{children:e.jsx("h1",{className:"px-10 text-[clamp(3rem,6vw,7.5rem)] leading-none font-extrabold",children:r.title})}),e.jsxs("div",{className:"w-full max-w-none scroll-pt-6 border-t px-3 pt-3 md:px-10 md:pt-8",children:[e.jsx("h2",{className:"pb-5 font-mono text-xs font-semibold uppercase",children:"Intro"}),r.workshopReadme.compiled.status==="success"&&r.workshopReadme.compiled.code?e.jsx(c,{epicVideoInfosPromise:r.epicVideoInfosPromise,children:e.jsx("div",{className:"prose dark:prose-invert sm:prose-lg",children:e.jsx(x,{code:r.workshopReadme.compiled.code,components:j})})}):r.workshopReadme.compiled.status==="error"?e.jsxs("div",{className:"text-foreground-destructive",children:["There was an error:",e.jsx("pre",{children:r.workshopReadme.compiled.error})]}):"No instructions yet..."]}),e.jsx("div",{className:"pt-10 pb-5",children:r.workshopReadme.compiled.status==="success"&&r.workshopReadme.compiled.code&&r.workshopReadme.compiled.code.length>500?s:null})]}),e.jsx(a,{elementQuery:`#${r.articleId}`}),e.jsx(h,{type:"workshop-instructions",className:"h-14 border-t px-6"}),e.jsx("div",{className:"@container flex h-16 justify-center border-t",children:e.jsx(d,{file:r.workshopReadme.file,relativePath:r.workshopReadme.relativePath})})]})}),z=m(function(){return e.jsx(p,{})});export{z as ErrorBoundary,q as default};
2
- //# sourceMappingURL=index-Cb8U85TK.js.map
1
+ import{w as l,a as m,L as n}from"./chunk-JZWAC4HX-BuixXc9D.js";import{j as e}from"./jsx-runtime-C5WNSv3b.js";import{E as a}from"./index-3PqfcnMA.js";import{E as c}from"./epic-video-C9q0z-QM.js";import{G as p}from"./error-boundary-DCY9a5Cj.js";import{E as d}from"./launch-editor-C-8ah8qM.js";import{M as x}from"./mdx-C3Jl4O5D.js";import{c as f}from"./misc-D9k_mI0z.js";import{P as h,u}from"./progress-BvO_W5nB.js";import"./index-Bi6L2ga8.js";import"./loading-BjV0PtX2.js";import"./index-DSpM0ReJ.js";import"./tooltip-H74tOFSr.js";import"./index-B2VNpNxJ.js";import"./root-loader-DAxaiFMN.js";import"./pe-D585gnmh.js";import"./schemas-siASSt6b.js";import"./index-E_6kulJP.js";import"./online-x7UFobEJ.js";import"./format-CZ5n8p10.js";import"./user-DhjrtSbZ.js";import"./workshop-config-v_LiyFvY.js";import"./preload-helper-BXl3LOEh.js";import"./progress-bar-BCbq1CuC.js";function b({index:o,exercise:r}){const s=u(r.exerciseNumber);return e.jsx("li",{children:e.jsxs(n,{className:f("hover:bg-muted/60 relative flex items-center gap-4 px-4 py-3 text-lg font-semibold transition after:absolute after:right-10 after:-translate-x-2 after:opacity-0 after:transition after:content-['→'] hover:after:translate-x-0 hover:after:opacity-100",s),to:`${r.exerciseNumber.toString().padStart(2,"0")}`,"data-keyboard-action":o===0?"g+n":void 0,children:[e.jsx("span",{className:"text-xs font-normal tabular-nums opacity-50",children:r.exerciseNumber}),e.jsx("span",{children:r.title})]})},r.exerciseNumber)}const j={h1:()=>null},q=l(function({loaderData:r}){const s=e.jsxs("ul",{className:"divide-border dark:divide-border/50 flex flex-col divide-y",children:[e.jsx("strong",{className:"px-10 pb-3 font-mono text-xs uppercase",children:"Exercises"}),r.exercises.map((t,i)=>e.jsx(b,{index:i,exercise:t},t.exerciseNumber))]});return e.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:[e.jsxs("article",{id:r.articleId,className:"shadow-on-scrollbox scrollbar-thin scrollbar-thumb-scrollbar flex w-full flex-1 flex-col gap-12 overflow-y-scroll px-3 py-4 pt-6 md:px-10 md:py-12 md:pt-16",children:[e.jsx("div",{children:e.jsx("h1",{className:"px-10 text-[clamp(3rem,6vw,7.5rem)] leading-none font-extrabold",children:r.title})}),e.jsxs("div",{className:"w-full max-w-none scroll-pt-6 border-t px-3 pt-3 md:px-10 md:pt-8",children:[e.jsx("h2",{className:"pb-5 font-mono text-xs font-semibold uppercase",children:"Intro"}),r.workshopReadme.compiled.status==="success"&&r.workshopReadme.compiled.code?e.jsx(c,{epicVideoInfosPromise:r.epicVideoInfosPromise,children:e.jsx("div",{className:"prose dark:prose-invert sm:prose-lg",children:e.jsx(x,{code:r.workshopReadme.compiled.code,components:j})})}):r.workshopReadme.compiled.status==="error"?e.jsxs("div",{className:"text-foreground-destructive",children:["There was an error:",e.jsx("pre",{children:r.workshopReadme.compiled.error})]}):"No instructions yet..."]}),e.jsx("div",{className:"pt-10 pb-5",children:r.workshopReadme.compiled.status==="success"&&r.workshopReadme.compiled.code&&r.workshopReadme.compiled.code.length>500?s:null})]}),e.jsx(a,{elementQuery:`#${r.articleId}`}),e.jsx(h,{type:"workshop-instructions",className:"h-14 border-t px-6"}),e.jsx("div",{className:"@container flex h-16 justify-center border-t",children:e.jsx(d,{file:r.workshopReadme.file,relativePath:r.workshopReadme.relativePath})})]})}),z=m(function(){return e.jsx(p,{})});export{z as ErrorBoundary,q as default};
2
+ //# sourceMappingURL=index-m9K7ACZe.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-Cb8U85TK.js","sources":["../../../app/routes/_app+/index.tsx"],"sourcesContent":["import { ElementScrollRestoration } from '@epic-web/restore-scroll'\nimport {\n\tgetExercises,\n\tgetWorkshopInstructions,\n} from '@epic-web/workshop-utils/apps.server'\nimport { getWorkshopConfig } from '@epic-web/workshop-utils/config.server'\nimport { getEpicVideoInfos } from '@epic-web/workshop-utils/epic-api.server'\nimport {\n\tcombineServerTimings,\n\tgetServerTimeHeader,\n\tmakeTimings,\n\ttime,\n} from '@epic-web/workshop-utils/timing.server'\nimport slugify from '@sindresorhus/slugify'\nimport { data, type HeadersFunction, Link } from 'react-router'\nimport { EpicVideoInfoProvider } from '#app/components/epic-video.tsx'\nimport { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'\nimport { EditFileOnGitHub } from '#app/routes/launch-editor.tsx'\nimport { Mdx } from '#app/utils/mdx.tsx'\nimport { cn } from '#app/utils/misc.tsx'\nimport { ProgressToggle, useExerciseProgressClassName } from '../progress.tsx'\nimport { type Route } from './+types/index.tsx'\n\nexport async function loader({ request }: Route.LoaderArgs) {\n\tconst timings = makeTimings('indexLoader')\n\tconst { title } = getWorkshopConfig()\n\tconst [exercises, workshopReadme] = await Promise.all([\n\t\ttime(() => getExercises({ request, timings }), {\n\t\t\ttimings,\n\t\t\ttype: 'getExercises',\n\t\t\tdesc: 'getExercises in index',\n\t\t}),\n\t\ttime(() => getWorkshopInstructions({ request }), {\n\t\t\ttimings,\n\t\t\ttype: 'compileMdx',\n\t\t\tdesc: 'compileMdx in index',\n\t\t}),\n\t])\n\n\treturn data(\n\t\t{\n\t\t\tarticleId: `workshop-${slugify(title)}-instructions`,\n\t\t\ttitle:\n\t\t\t\tworkshopReadme.compiled.status === 'success'\n\t\t\t\t\t? workshopReadme.compiled.title\n\t\t\t\t\t: title,\n\t\t\texercises: exercises.map((e) => ({\n\t\t\t\texerciseNumber: e.exerciseNumber,\n\t\t\t\ttitle: e.title,\n\t\t\t})),\n\t\t\tworkshopReadme,\n\t\t\tepicVideoInfosPromise:\n\t\t\t\tworkshopReadme.compiled.status === 'success'\n\t\t\t\t\t? getEpicVideoInfos(workshopReadme.compiled.epicVideoEmbeds, {\n\t\t\t\t\t\t\trequest,\n\t\t\t\t\t\t})\n\t\t\t\t\t: null,\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\nfunction ExerciseListItem({\n\tindex,\n\texercise,\n}: {\n\tindex: number\n\texercise: Awaited<Route.ComponentProps['loaderData']>['exercises'][number]\n}) {\n\tconst progressClassName = useExerciseProgressClassName(\n\t\texercise.exerciseNumber,\n\t)\n\treturn (\n\t\t<li key={exercise.exerciseNumber}>\n\t\t\t<Link\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"hover:bg-muted/60 relative flex items-center gap-4 px-4 py-3 text-lg font-semibold transition after:absolute after:right-10 after:-translate-x-2 after:opacity-0 after:transition after:content-['→'] hover:after:translate-x-0 hover:after:opacity-100\",\n\t\t\t\t\tprogressClassName,\n\t\t\t\t)}\n\t\t\t\tto={`${exercise.exerciseNumber.toString().padStart(2, '0')}`}\n\t\t\t\tdata-keyboard-action={index === 0 ? 'g+n' : undefined}\n\t\t\t>\n\t\t\t\t<span className=\"text-xs font-normal tabular-nums opacity-50\">\n\t\t\t\t\t{exercise.exerciseNumber}\n\t\t\t\t</span>\n\t\t\t\t<span>{exercise.title}</span>\n\t\t\t</Link>\n\t\t</li>\n\t)\n}\n\nconst mdxComponents = { h1: () => null }\n\nexport default function Index({ loaderData: data }: Route.ComponentProps) {\n\tconst exerciseLinks = (\n\t\t<ul className=\"divide-border dark:divide-border/50 flex flex-col divide-y\">\n\t\t\t<strong className=\"px-10 pb-3 font-mono text-xs uppercase\">\n\t\t\t\tExercises\n\t\t\t</strong>\n\t\t\t{data.exercises.map((exercise, index) => (\n\t\t\t\t<ExerciseListItem\n\t\t\t\t\tkey={exercise.exerciseNumber}\n\t\t\t\t\tindex={index}\n\t\t\t\t\texercise={exercise}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</ul>\n\t)\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\tclassName=\"shadow-on-scrollbox scrollbar-thin scrollbar-thumb-scrollbar flex w-full flex-1 flex-col gap-12 overflow-y-scroll px-3 py-4 pt-6 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=\"px-10 text-[clamp(3rem,6vw,7.5rem)] leading-none font-extrabold\">\n\t\t\t\t\t\t{data.title}\n\t\t\t\t\t</h1>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"w-full max-w-none scroll-pt-6 border-t px-3 pt-3 md:px-10 md:pt-8\">\n\t\t\t\t\t<h2 className=\"pb-5 font-mono text-xs font-semibold uppercase\">\n\t\t\t\t\t\tIntro\n\t\t\t\t\t</h2>\n\t\t\t\t\t{data.workshopReadme.compiled.status === 'success' &&\n\t\t\t\t\tdata.workshopReadme.compiled.code ? (\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.workshopReadme.compiled.code}\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) : data.workshopReadme.compiled.status === 'error' ? (\n\t\t\t\t\t\t<div className=\"text-foreground-destructive\">\n\t\t\t\t\t\t\tThere was an error:\n\t\t\t\t\t\t\t<pre>{data.workshopReadme.compiled.error}</pre>\n\t\t\t\t\t\t</div>\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\t<div className=\"pt-10 pb-5\">\n\t\t\t\t\t{data.workshopReadme.compiled.status === 'success' &&\n\t\t\t\t\tdata.workshopReadme.compiled.code &&\n\t\t\t\t\tdata.workshopReadme.compiled.code.length > 500\n\t\t\t\t\t\t? exerciseLinks\n\t\t\t\t\t\t: null}\n\t\t\t\t</div>\n\t\t\t</article>\n\t\t\t<ElementScrollRestoration elementQuery={`#${data.articleId}`} />\n\t\t\t<ProgressToggle\n\t\t\t\ttype=\"workshop-instructions\"\n\t\t\t\tclassName=\"h-14 border-t px-6\"\n\t\t\t/>\n\t\t\t<div className=\"@container flex h-16 justify-center border-t\">\n\t\t\t\t<EditFileOnGitHub\n\t\t\t\t\tfile={data.workshopReadme.file}\n\t\t\t\t\trelativePath={data.workshopReadme.relativePath}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</main>\n\t)\n}\n\nexport function ErrorBoundary() {\n\treturn <GeneralErrorBoundary />\n}\n"],"names":["ExerciseListItem","index","exercise","progressClassName","useExerciseProgressClassName","exerciseNumber","children","jsxs","Link","className","cn","to","toString","padStart","jsx","title","mdxComponents","h1","_UNSAFE_withComponentProps","loaderData","data","exerciseLinks","exercises","map","id","articleId","workshopReadme","compiled","status","code","EpicVideoInfoProvider","epicVideoInfosPromise","Mdx","components","error","length","ElementScrollRestoration","elementQuery","ProgressToggle","type","EditFileOnGitHub","file","relativePath","ErrorBoundary","_UNSAFE_withErrorBoundaryProps","GeneralErrorBoundary"],"mappings":"q2BA0EA,SAASA,EAAiB,CACzBC,MAAAA,EACAC,SAAAA,CACD,EAGG,CACF,MAAMC,EAAoBC,EACzBF,EAASG,cACV,EACA,aACE,KAAA,CACAC,SAAAC,EAAAA,KAACC,EAAA,CACAC,UAAWC,EACV,0PACAP,CACD,EACAQ,GAAI,GAAGT,EAASG,eAAeO,WAAWC,SAAS,EAAG,GAAG,CAAC,GAC1D,uBAAsBZ,IAAU,EAAI,MAAQ,OAE5CK,SAAA,CAAAQ,EAAAA,IAAC,OAAA,CAAKL,UAAU,8CACdH,SAAAJ,EAASG,cAAA,CACX,EACAS,EAAAA,IAAC,OAAA,CAAMR,SAAAJ,EAASa,KAAA,CAAM,CAAA,EACvB,CAAA,EAbQb,EAASG,cAclB,CAEF,CAEA,MAAMW,EAAgB,CAAEC,GAAIA,IAAM,IAAK,EAEvChB,EAAAiB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MAC7BT,EAAKM,eAAeC,SAASE,KAAKM,OAAS,IACxCd,EACA,IAAA,CACJ,CAAA,CAAA,CACD,QACCe,EAAA,CAAyBC,aAAc,IAAIjB,EAAKK,SAAS,EAAA,CAAI,EAC9DX,EAAAA,IAACwB,EAAA,CACAC,KAAK,wBACL9B,UAAU,oBAAA,CACX,EACAK,EAAAA,IAAC,MAAA,CAAIL,UAAU,+CACdH,SAAAQ,EAAAA,IAAC0B,EAAA,CACAC,KAAMrB,EAAKM,eAAee,KAC1BC,aAActB,EAAKM,eAAegB,aACnC,CAAA,CACD,CAAA,CAAA,CACD,CAEF,CAAA,EAEOC,EAAAC,EAAA,UAAyB,CAC/B,aAAQC,EAAA,EAAqB,CAC9B,CAAA"}
1
+ {"version":3,"file":"index-m9K7ACZe.js","sources":["../../../app/routes/_app+/index.tsx"],"sourcesContent":["import { ElementScrollRestoration } from '@epic-web/restore-scroll'\nimport {\n\tgetExercises,\n\tgetWorkshopInstructions,\n} from '@epic-web/workshop-utils/apps.server'\nimport { getWorkshopConfig } from '@epic-web/workshop-utils/config.server'\nimport { getEpicVideoInfos } from '@epic-web/workshop-utils/epic-api.server'\nimport {\n\tcombineServerTimings,\n\tgetServerTimeHeader,\n\tmakeTimings,\n\ttime,\n} from '@epic-web/workshop-utils/timing.server'\nimport slugify from '@sindresorhus/slugify'\nimport { data, type HeadersFunction, Link } from 'react-router'\nimport { EpicVideoInfoProvider } from '#app/components/epic-video.tsx'\nimport { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'\nimport { EditFileOnGitHub } from '#app/routes/launch-editor.tsx'\nimport { Mdx } from '#app/utils/mdx.tsx'\nimport { cn } from '#app/utils/misc.tsx'\nimport { ProgressToggle, useExerciseProgressClassName } from '../progress.tsx'\nimport { type Route } from './+types/index.tsx'\n\nexport async function loader({ request }: Route.LoaderArgs) {\n\tconst timings = makeTimings('indexLoader')\n\tconst { title } = getWorkshopConfig()\n\tconst [exercises, workshopReadme] = await Promise.all([\n\t\ttime(() => getExercises({ request, timings }), {\n\t\t\ttimings,\n\t\t\ttype: 'getExercises',\n\t\t\tdesc: 'getExercises in index',\n\t\t}),\n\t\ttime(() => getWorkshopInstructions({ request }), {\n\t\t\ttimings,\n\t\t\ttype: 'compileMdx',\n\t\t\tdesc: 'compileMdx in index',\n\t\t}),\n\t])\n\n\treturn data(\n\t\t{\n\t\t\tarticleId: `workshop-${slugify(title)}-instructions`,\n\t\t\ttitle:\n\t\t\t\tworkshopReadme.compiled.status === 'success'\n\t\t\t\t\t? workshopReadme.compiled.title\n\t\t\t\t\t: title,\n\t\t\texercises: exercises.map((e) => ({\n\t\t\t\texerciseNumber: e.exerciseNumber,\n\t\t\t\ttitle: e.title,\n\t\t\t})),\n\t\t\tworkshopReadme,\n\t\t\tepicVideoInfosPromise:\n\t\t\t\tworkshopReadme.compiled.status === 'success'\n\t\t\t\t\t? getEpicVideoInfos(workshopReadme.compiled.epicVideoEmbeds, {\n\t\t\t\t\t\t\trequest,\n\t\t\t\t\t\t})\n\t\t\t\t\t: null,\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\nfunction ExerciseListItem({\n\tindex,\n\texercise,\n}: {\n\tindex: number\n\texercise: Awaited<Route.ComponentProps['loaderData']>['exercises'][number]\n}) {\n\tconst progressClassName = useExerciseProgressClassName(\n\t\texercise.exerciseNumber,\n\t)\n\treturn (\n\t\t<li key={exercise.exerciseNumber}>\n\t\t\t<Link\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"hover:bg-muted/60 relative flex items-center gap-4 px-4 py-3 text-lg font-semibold transition after:absolute after:right-10 after:-translate-x-2 after:opacity-0 after:transition after:content-['→'] hover:after:translate-x-0 hover:after:opacity-100\",\n\t\t\t\t\tprogressClassName,\n\t\t\t\t)}\n\t\t\t\tto={`${exercise.exerciseNumber.toString().padStart(2, '0')}`}\n\t\t\t\tdata-keyboard-action={index === 0 ? 'g+n' : undefined}\n\t\t\t>\n\t\t\t\t<span className=\"text-xs font-normal tabular-nums opacity-50\">\n\t\t\t\t\t{exercise.exerciseNumber}\n\t\t\t\t</span>\n\t\t\t\t<span>{exercise.title}</span>\n\t\t\t</Link>\n\t\t</li>\n\t)\n}\n\nconst mdxComponents = { h1: () => null }\n\nexport default function Index({ loaderData: data }: Route.ComponentProps) {\n\tconst exerciseLinks = (\n\t\t<ul className=\"divide-border dark:divide-border/50 flex flex-col divide-y\">\n\t\t\t<strong className=\"px-10 pb-3 font-mono text-xs uppercase\">\n\t\t\t\tExercises\n\t\t\t</strong>\n\t\t\t{data.exercises.map((exercise, index) => (\n\t\t\t\t<ExerciseListItem\n\t\t\t\t\tkey={exercise.exerciseNumber}\n\t\t\t\t\tindex={index}\n\t\t\t\t\texercise={exercise}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</ul>\n\t)\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\tclassName=\"shadow-on-scrollbox scrollbar-thin scrollbar-thumb-scrollbar flex w-full flex-1 flex-col gap-12 overflow-y-scroll px-3 py-4 pt-6 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=\"px-10 text-[clamp(3rem,6vw,7.5rem)] leading-none font-extrabold\">\n\t\t\t\t\t\t{data.title}\n\t\t\t\t\t</h1>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"w-full max-w-none scroll-pt-6 border-t px-3 pt-3 md:px-10 md:pt-8\">\n\t\t\t\t\t<h2 className=\"pb-5 font-mono text-xs font-semibold uppercase\">\n\t\t\t\t\t\tIntro\n\t\t\t\t\t</h2>\n\t\t\t\t\t{data.workshopReadme.compiled.status === 'success' &&\n\t\t\t\t\tdata.workshopReadme.compiled.code ? (\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.workshopReadme.compiled.code}\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) : data.workshopReadme.compiled.status === 'error' ? (\n\t\t\t\t\t\t<div className=\"text-foreground-destructive\">\n\t\t\t\t\t\t\tThere was an error:\n\t\t\t\t\t\t\t<pre>{data.workshopReadme.compiled.error}</pre>\n\t\t\t\t\t\t</div>\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\t<div className=\"pt-10 pb-5\">\n\t\t\t\t\t{data.workshopReadme.compiled.status === 'success' &&\n\t\t\t\t\tdata.workshopReadme.compiled.code &&\n\t\t\t\t\tdata.workshopReadme.compiled.code.length > 500\n\t\t\t\t\t\t? exerciseLinks\n\t\t\t\t\t\t: null}\n\t\t\t\t</div>\n\t\t\t</article>\n\t\t\t<ElementScrollRestoration elementQuery={`#${data.articleId}`} />\n\t\t\t<ProgressToggle\n\t\t\t\ttype=\"workshop-instructions\"\n\t\t\t\tclassName=\"h-14 border-t px-6\"\n\t\t\t/>\n\t\t\t<div className=\"@container flex h-16 justify-center border-t\">\n\t\t\t\t<EditFileOnGitHub\n\t\t\t\t\tfile={data.workshopReadme.file}\n\t\t\t\t\trelativePath={data.workshopReadme.relativePath}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</main>\n\t)\n}\n\nexport function ErrorBoundary() {\n\treturn <GeneralErrorBoundary />\n}\n"],"names":["ExerciseListItem","index","exercise","progressClassName","useExerciseProgressClassName","exerciseNumber","children","jsxs","Link","className","cn","to","toString","padStart","jsx","title","mdxComponents","h1","_UNSAFE_withComponentProps","loaderData","data","exerciseLinks","exercises","map","id","articleId","workshopReadme","compiled","status","code","EpicVideoInfoProvider","epicVideoInfosPromise","Mdx","components","error","length","ElementScrollRestoration","elementQuery","ProgressToggle","type","EditFileOnGitHub","file","relativePath","ErrorBoundary","_UNSAFE_withErrorBoundaryProps","GeneralErrorBoundary"],"mappings":"q2BA0EA,SAASA,EAAiB,CACzBC,MAAAA,EACAC,SAAAA,CACD,EAGG,CACF,MAAMC,EAAoBC,EACzBF,EAASG,cACV,EACA,aACE,KAAA,CACAC,SAAAC,EAAAA,KAACC,EAAA,CACAC,UAAWC,EACV,0PACAP,CACD,EACAQ,GAAI,GAAGT,EAASG,eAAeO,WAAWC,SAAS,EAAG,GAAG,CAAC,GAC1D,uBAAsBZ,IAAU,EAAI,MAAQ,OAE5CK,SAAA,CAAAQ,EAAAA,IAAC,OAAA,CAAKL,UAAU,8CACdH,SAAAJ,EAASG,cAAA,CACX,EACAS,EAAAA,IAAC,OAAA,CAAMR,SAAAJ,EAASa,KAAA,CAAM,CAAA,EACvB,CAAA,EAbQb,EAASG,cAclB,CAEF,CAEA,MAAMW,EAAgB,CAAEC,GAAIA,IAAM,IAAK,EAEvChB,EAAAiB,EAAA,SAA8B,CAAEC,WAAYC,CAAK,EAAyB,CACzE,MAAMC,EACLd,EAAAA,KAAC,KAAA,CAAGE,UAAU,6DACbH,SAAA,CAAAQ,EAAAA,IAAC,SAAA,CAAOL,UAAU,yCAAyCH,SAAA,WAAA,CAE3D,EACCc,EAAKE,UAAUC,IAAI,CAACrB,EAAUD,IAC9Ba,EAAAA,IAACd,EAAA,CAEAC,MAAAA,EACAC,SAAAA,CAAA,EAFKA,E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AC,KAAMrB,EAAKM,eAAee,KAC1BC,aAActB,EAAKM,eAAegB,aACnC,CAAA,CACD,CAAA,CAAA,CACD,CAEF,CAAA,EAEOC,EAAAC,EAAA,UAAyB,CAC/B,aAAQC,EAAA,EAAqB,CAC9B,CAAA"}
@@ -0,0 +1,2 @@
1
+ import{j as e}from"./jsx-runtime-C5WNSv3b.js";import{r as P}from"./index-Bi6L2ga8.js";import{L as N,f as O}from"./chunk-JZWAC4HX-BuixXc9D.js";import{s as _}from"./progress-bar-BCbq1CuC.js";import{c as y}from"./misc-D9k_mI0z.js";import{u as v}from"./pe-D585gnmh.js";import{a as g,b as F}from"./root-loader-DAxaiFMN.js";function j(s){const t=O();return P.useEffect(()=>{t.state==="idle"&&t.data!=null&&s?.("fetcher-done")},[t,s]),t}function I({className:s,file:t,appFile:a,appName:c,syncTo:n,line:p,column:d,children:l,onUpdate:o}){const r=j(o),x=v(),m=i=>{if(!n||!i.altKey||!i.metaKey)return;i.preventDefault();const f=i.currentTarget.form;if(!f)return;const b=new FormData(f);b.set("skipOpenAfterSync","true"),r.submit(b,{method:"POST",action:"/launch-editor"})};if(!t&&!a)return console.error('LaunchEditor: requires either "file" or "appFile" prop.'),null;const h=typeof a=="string"?[a]:a,E=t?"file":"appFile",u=n?.file?"file":n?.appFile?"appFile":"";return e.jsxs(r.Form,{action:"/launch-editor",method:"POST",className:"flex items-center",children:[x,_,e.jsx("input",{type:"hidden",name:"line",value:typeof p=="number"?p:void 0}),e.jsx("input",{type:"hidden",name:"column",value:d}),e.jsx("input",{type:"hidden",name:"type",value:E}),e.jsx("input",{type:"hidden",name:"file",value:t}),e.jsx("input",{type:"hidden",name:"appName",value:c}),h?.map(i=>e.jsx("input",{type:"hidden",name:"appFile",value:i},i)),n?e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"hidden",name:"syncTo.type",value:u}),e.jsx("input",{type:"hidden",name:"syncTo.file",value:n.file}),e.jsx("input",{type:"hidden",name:"syncTo.appName",value:n.appName}),e.jsx("input",{type:"hidden",name:"syncTo.appFile",value:n.appFile})]}):null,e.jsx("button",{type:"submit",onClick:m,className:y("launch_button",r.state==="idle"?null:"cursor-progress",r.data?.status==="error"?"cursor-not-allowed":null,s),children:l})]})}function L({className:s,file:t,appFile:a,appName:c,line:n,children:p}){const d=g(),l=F();if(Array.isArray(a))return e.jsx("div",{children:"Cannot open more than one file"});if(t){const u=f=>f.replace(/\\/g,"/"),i=ENV.EPICSHOP_GITHUB_ROOT.replace("/tree/","/blob/");return e.jsx("a",{className:"launch_button no-underline!",href:u(t).replace(u(ENV.EPICSHOP_CONTEXT_CWD),i)+(n?`#L${n}`:""),rel:"noreferrer",target:"_blank",children:p})}const o=d.find(u=>u.name===c),r=ENV.EPICSHOP_GITHUB_ROOT.replace("/tree/","/blob/"),[x,m]=a?a.split(","):["",""],h=n||(m?Number(m):void 0),E=[...o?.relativePath.split(l.separator)??[],x].join("/");return e.jsx("a",{className:y("launch_button no-underline!",s),href:`${r}/${E}${h?`#L${h}`:""}`,rel:"noreferrer",target:"_blank",children:p})}function G({appFile:s="README.mdx",appName:t,file:a,relativePath:c}){const n=j(),p=l=>{if(!l.altKey||ENV.EPICSHOP_DEPLOYED)return;l.preventDefault();const o=new FormData,r=a?"file":"appFile";o.append(r,a??s),o.append("type",r),t&&o.append("appName",t),n.submit(o,{method:"POST",action:"/launch-editor"})},d=ENV.EPICSHOP_GITHUB_ROOT.replace(/\/tree\/|\/blob\//,"/edit/");return e.jsxs(N,{className:"self-center font-mono text-sm",onClick:p,target:"_blank",to:`${d}/${c}`.replace(/\\/g,"/"),children:[e.jsx("span",{className:"@min-[720px]:hidden",children:"Edit"}),e.jsx("span",{className:"hidden @min-[720px]:block @min-[900px]:hidden",children:"Edit on GitHub"}),e.jsx("span",{className:"hidden @min-[900px]:block",children:"Edit this page on GitHub"})]})}const $=ENV.EPICSHOP_DEPLOYED?L:I;export{G as E,$ as L};
2
+ //# sourceMappingURL=launch-editor-C-8ah8qM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launch-editor-C-8ah8qM.js","sources":["../../../app/routes/launch-editor.tsx"],"sourcesContent":["import { type Route } from './+types/launch-editor'\nimport path from 'path'\nimport { getAppByName } from '@epic-web/workshop-utils/apps.server'\nimport { launchEditor } from '@epic-web/workshop-utils/launch-editor.server'\nimport fsExtra from 'fs-extra'\nimport { type MouseEvent, useEffect } from 'react'\nimport { Link, useFetcher } from 'react-router'\nimport { z, type ZodTypeAny } from 'zod'\nimport { showProgressBarField } from '#app/components/progress-bar.tsx'\nimport { cn, ensureUndeployed } from '#app/utils/misc.tsx'\nimport { dataWithPE, usePERedirectInput } from '#app/utils/pe.tsx'\nimport { useApps, useRequestInfo } from '#app/utils/root-loader.ts'\nimport { createToastHeaders } from '#app/utils/toast.server.ts'\n\nfunction getFileDescriptorSchema<AppFile extends ZodTypeAny>(appFile: AppFile) {\n\treturn z.union([\n\t\tz.object({\n\t\t\ttype: z.literal('file'),\n\t\t\tfile: z.string(),\n\t\t}),\n\t\tz.object({\n\t\t\ttype: z.literal('appFile'),\n\t\t\tappFile,\n\t\t\tappName: z.string(),\n\t\t}),\n\t])\n}\n\nconst LaunchSchema = z.intersection(\n\tz.object({\n\t\tline: z.coerce.number().optional(),\n\t\tcolumn: z.coerce.number().optional(),\n\t\tsyncTo: getFileDescriptorSchema(z.string()).optional(),\n\t}),\n\tgetFileDescriptorSchema(z.array(z.string())),\n)\n\nexport async function action({ request }: Route.ActionArgs) {\n\tensureUndeployed()\n\tconst formData = await request.formData()\n\tconst skipOpenAfterSync = formData.get('skipOpenAfterSync') === 'true'\n\tconst appFileValues = formData\n\t\t.getAll('appFile')\n\t\t.filter((value): value is string => typeof value === 'string')\n\tconst syncToAppFileValues = formData\n\t\t.getAll('syncTo.appFile')\n\t\t.filter((value): value is string => typeof value === 'string')\n\tif (syncToAppFileValues.length > 1) {\n\t\tthrow new Response('Expected a single syncTo.appFile value', {\n\t\t\tstatus: 400,\n\t\t})\n\t}\n\tconst syncTo = {\n\t\ttype: formData.get('syncTo.type') ?? undefined,\n\t\tfile: formData.get('syncTo.file') ?? undefined,\n\t\tworkshopFile: formData.get('syncTo.workshopFile') ?? undefined,\n\t\tappFile: syncToAppFileValues[0] ?? undefined,\n\t\tappName: formData.get('syncTo.appName') ?? undefined,\n\t}\n\tconst syncToIsProvided = Object.values(syncTo).some((v) =>\n\t\tArray.isArray(v) ? v.length : v,\n\t)\n\tconst rawData = {\n\t\ttype: formData.get('type'),\n\t\tfile: formData.get('file'),\n\t\tworkshopFile: formData.get('workshopFile'),\n\t\tappFile: appFileValues,\n\t\tappName: formData.get('appName'),\n\t\tline: formData.get('line') ?? undefined,\n\t\tcolumn: formData.get('column') ?? undefined,\n\t\tsyncTo: syncToIsProvided\n\t\t\t? {\n\t\t\t\t\ttype: formData.get('syncTo.type'),\n\t\t\t\t\tfile: formData.get('syncTo.file'),\n\t\t\t\t\tworkshopFile: formData.get('syncTo.workshopFile'),\n\t\t\t\t\tappFile: syncToAppFileValues[0] ?? undefined,\n\t\t\t\t\tappName: formData.get('syncTo.appName'),\n\t\t\t\t}\n\t\t\t: undefined,\n\t}\n\tconst parsedForm = LaunchSchema.safeParse(rawData)\n\tif (!parsedForm.success) {\n\t\tthrow parsedForm.error\n\t}\n\tconst form = parsedForm.data\n\n\tasync function getFiles(\n\t\tfileDescriptor:\n\t\t\t| ({ line?: number; colum?: number } & {\n\t\t\t\t\ttype: 'file'\n\t\t\t\t\tfile: string\n\t\t\t\t\tappName?: never\n\t\t\t\t\tappFile?: never\n\t\t\t })\n\t\t\t| {\n\t\t\t\t\ttype: 'appFile'\n\t\t\t\t\tfile?: never\n\t\t\t\t\tappName: string\n\t\t\t\t\tappFile: string | Array<string>\n\t\t\t },\n\t): Promise<Array<{ filepath: string; line?: number; column?: number }>> {\n\t\tif (fileDescriptor.type === 'file') {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tfilepath: fileDescriptor.file,\n\t\t\t\t\tline: fileDescriptor.line,\n\t\t\t\t\tcolumn: fileDescriptor.colum,\n\t\t\t\t},\n\t\t\t]\n\t\t} else {\n\t\t\tconst fileDescriptorApp = await getAppByName(fileDescriptor.appName)\n\t\t\tif (!fileDescriptorApp) {\n\t\t\t\tthrow new Response(`App \"${fileDescriptor.appName}\" Not found`, {\n\t\t\t\t\tstatus: 404,\n\t\t\t\t})\n\t\t\t}\n\t\t\tconst appFile = Array.isArray(fileDescriptor.appFile)\n\t\t\t\t? fileDescriptor.appFile\n\t\t\t\t: [fileDescriptor.appFile]\n\t\t\treturn appFile.map((file) => {\n\t\t\t\tconst [filePath, line = '1', column = '1'] = file.split(',')\n\t\t\t\tif (!filePath) {\n\t\t\t\t\tthrow new Response(\n\t\t\t\t\t\t`appFile missing file path: ${fileDescriptor.appFile}`,\n\t\t\t\t\t\t{ status: 400 },\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tfilepath: path.join(fileDescriptorApp.fullPath, filePath),\n\t\t\t\t\tline: Number(line),\n\t\t\t\t\tcolumn: Number(column),\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}\n\n\tconst filesToOpen = await getFiles(form)\n\tconst hasSyncTarget = 'syncTo' in form && Boolean(form.syncTo)\n\tif (hasSyncTarget && form.syncTo) {\n\t\tconst originFiles = await getFiles(form.syncTo)\n\t\tfor (let index = 0; index < originFiles.length; index++) {\n\t\t\tconst originFile = originFiles[index]\n\t\t\tif (!originFile) continue\n\t\t\tconst destFile = filesToOpen[index]\n\t\t\tif (!destFile) {\n\t\t\t\tthrow new Response(\n\t\t\t\t\t`Trying to sync to a file that does not appear at index ${index}`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tawait fsExtra.ensureDir(path.dirname(destFile.filepath))\n\t\t\tawait fsExtra.promises.copyFile(originFile.filepath, destFile.filepath)\n\t\t}\n\t}\n\tif (hasSyncTarget && skipOpenAfterSync) {\n\t\treturn dataWithPE(request, formData, { status: 'success' } as const)\n\t}\n\tconst results: Array<\n\t\t{ status: 'success' } | { status: 'error'; message: string }\n\t> = []\n\tfor (const file of filesToOpen) {\n\t\tresults.push(await launchEditor(file.filepath, file.line, file.column))\n\t}\n\n\tif (results.every((r) => r.status === 'success')) {\n\t\treturn dataWithPE(request, formData, { status: 'success' } as const)\n\t} else {\n\t\tconst messages = results\n\t\t\t.map((r, index, array) =>\n\t\t\t\tr.status === 'error'\n\t\t\t\t\t? array.length > 1\n\t\t\t\t\t\t? `${index}. ${r.message}`\n\t\t\t\t\t\t: r.message\n\t\t\t\t\t: null,\n\t\t\t)\n\t\t\t.filter(Boolean)\n\t\t\t.join('\\n')\n\t\tconsole.error('Launch editor error:', messages)\n\t\treturn dataWithPE(\n\t\t\trequest,\n\t\t\tformData,\n\t\t\t{ status: 'error', message: messages } as const,\n\t\t\t{\n\t\t\t\theaders: await createToastHeaders({\n\t\t\t\t\ttype: 'error',\n\t\t\t\t\ttitle: 'Launch Editor Error',\n\t\t\t\t\tdescription: messages,\n\t\t\t\t}),\n\t\t\t},\n\t\t)\n\t}\n}\n\ntype FileDescriptorProps<AppFile> =\n\t| {\n\t\t\tfile: string\n\t\t\tappFile?: never\n\t\t\tappName?: never\n\t }\n\t| {\n\t\t\tfile?: never\n\t\t\tappFile: AppFile\n\t\t\tappName: string\n\t }\n\ntype LaunchEditorProps = {\n\tclassName?: string\n\tline?: number\n\tcolumn?: number\n\tsyncTo?: FileDescriptorProps<string>\n\tchildren: React.ReactNode\n\tonUpdate?: (state: string) => void\n} & FileDescriptorProps<string | string[]>\n\nfunction useLaunchFetcher(onUpdate?: ((state: string) => void) | undefined) {\n\tconst fetcher = useFetcher<typeof action>()\n\n\tuseEffect(() => {\n\t\tif (fetcher.state === 'idle' && fetcher.data != null) {\n\t\t\tonUpdate?.('fetcher-done')\n\t\t}\n\t}, [fetcher, onUpdate])\n\n\treturn fetcher\n}\n\nfunction LaunchEditorImpl({\n\tclassName,\n\tfile,\n\tappFile,\n\tappName,\n\tsyncTo,\n\tline,\n\tcolumn,\n\tchildren,\n\tonUpdate,\n}: LaunchEditorProps) {\n\tconst fetcher = useLaunchFetcher(onUpdate)\n\tconst peRedirectInput = usePERedirectInput()\n\tconst handleSubmitButtonClick = (event: MouseEvent<HTMLButtonElement>) => {\n\t\tif (!syncTo || !event.altKey || !event.metaKey) return\n\t\tevent.preventDefault()\n\t\tconst form = event.currentTarget.form\n\t\tif (!form) return\n\t\tconst formData = new FormData(form)\n\t\tformData.set('skipOpenAfterSync', 'true')\n\t\tvoid fetcher.submit(formData, { method: 'POST', action: '/launch-editor' })\n\t}\n\n\tif (!file && !appFile) {\n\t\tconsole.error('LaunchEditor: requires either \"file\" or \"appFile\" prop.')\n\t\treturn null\n\t}\n\tconst fileList = typeof appFile === 'string' ? [appFile] : appFile\n\tconst type = file ? 'file' : 'appFile'\n\tconst syncToType = syncTo?.file ? 'file' : syncTo?.appFile ? 'appFile' : ''\n\n\treturn (\n\t\t<fetcher.Form\n\t\t\taction=\"/launch-editor\"\n\t\t\tmethod=\"POST\"\n\t\t\tclassName=\"flex items-center\"\n\t\t>\n\t\t\t{peRedirectInput}\n\t\t\t{showProgressBarField}\n\t\t\t<input\n\t\t\t\ttype=\"hidden\"\n\t\t\t\tname=\"line\"\n\t\t\t\tvalue={typeof line === 'number' ? line : undefined}\n\t\t\t/>\n\t\t\t<input type=\"hidden\" name=\"column\" value={column} />\n\t\t\t<input type=\"hidden\" name=\"type\" value={type} />\n\t\t\t<input type=\"hidden\" name=\"file\" value={file} />\n\t\t\t<input type=\"hidden\" name=\"appName\" value={appName} />\n\t\t\t{fileList?.map((file) => (\n\t\t\t\t<input type=\"hidden\" name=\"appFile\" key={file} value={file} />\n\t\t\t))}\n\t\t\t{syncTo ? (\n\t\t\t\t<>\n\t\t\t\t\t<input type=\"hidden\" name=\"syncTo.type\" value={syncToType} />\n\t\t\t\t\t<input type=\"hidden\" name=\"syncTo.file\" value={syncTo.file} />\n\t\t\t\t\t<input type=\"hidden\" name=\"syncTo.appName\" value={syncTo.appName} />\n\t\t\t\t\t<input type=\"hidden\" name=\"syncTo.appFile\" value={syncTo.appFile} />\n\t\t\t\t</>\n\t\t\t) : null}\n\t\t\t<button\n\t\t\t\ttype=\"submit\"\n\t\t\t\tonClick={handleSubmitButtonClick}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'launch_button',\n\t\t\t\t\tfetcher.state === 'idle' ? null : 'cursor-progress',\n\t\t\t\t\tfetcher.data?.status === 'error' ? 'cursor-not-allowed' : null,\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</button>\n\t\t</fetcher.Form>\n\t)\n}\n\nfunction LaunchGitHub({\n\tclassName,\n\tfile,\n\tappFile,\n\tappName,\n\tline,\n\tchildren,\n}: LaunchEditorProps) {\n\tconst apps = useApps()\n\tconst requestInfo = useRequestInfo()\n\tif (Array.isArray(appFile)) {\n\t\treturn <div>Cannot open more than one file</div>\n\t}\n\tif (file) {\n\t\tconst safePath = (s: string) => s.replace(/\\\\/g, '/')\n\t\t// Convert tree to blob for individual files\n\t\tconst githubFileRoot = ENV.EPICSHOP_GITHUB_ROOT.replace('/tree/', '/blob/')\n\t\treturn (\n\t\t\t<a\n\t\t\t\tclassName=\"launch_button no-underline!\"\n\t\t\t\thref={\n\t\t\t\t\tsafePath(file).replace(\n\t\t\t\t\t\tsafePath(ENV.EPICSHOP_CONTEXT_CWD),\n\t\t\t\t\t\tgithubFileRoot,\n\t\t\t\t\t) + (line ? `#L${line}` : '')\n\t\t\t\t}\n\t\t\t\trel=\"noreferrer\"\n\t\t\t\ttarget=\"_blank\"\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</a>\n\t\t)\n\t}\n\tconst app = apps.find((a) => a.name === appName)\n\t// Convert tree to blob for individual files\n\tconst githubFileRoot = ENV.EPICSHOP_GITHUB_ROOT.replace('/tree/', '/blob/')\n\n\t// Parse appFile to extract filename and line number (format: \"filename,line,column\")\n\tconst [filename, appFileLine] = appFile ? appFile.split(',') : ['', '']\n\tconst lineNumber = line || (appFileLine ? Number(appFileLine) : undefined)\n\n\tconst path = [\n\t\t...(app?.relativePath.split(requestInfo.separator) ?? []),\n\t\tfilename,\n\t].join('/')\n\treturn (\n\t\t<a\n\t\t\tclassName={cn('launch_button no-underline!', className)}\n\t\t\thref={`${githubFileRoot}/${path}${lineNumber ? `#L${lineNumber}` : ''}`}\n\t\t\trel=\"noreferrer\"\n\t\t\ttarget=\"_blank\"\n\t\t>\n\t\t\t{children}\n\t\t</a>\n\t)\n}\n\nexport function EditFileOnGitHub({\n\tappFile = 'README.mdx',\n\tappName,\n\tfile,\n\trelativePath,\n}: {\n\tappFile?: string\n\trelativePath: string\n} & (\n\t| {\n\t\t\tfile: string\n\t\t\tappName?: never\n\t }\n\t| {\n\t\t\tfile?: never\n\t\t\tappName: string\n\t }\n)) {\n\tconst fetcher = useLaunchFetcher()\n\n\tconst handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {\n\t\tif (!e.altKey || ENV.EPICSHOP_DEPLOYED) return\n\t\te.preventDefault()\n\t\tconst formData = new FormData()\n\t\tconst type = file ? 'file' : 'appFile'\n\t\tformData.append(type, file ?? appFile)\n\t\tformData.append('type', type)\n\t\tif (appName) {\n\t\t\tformData.append('appName', appName)\n\t\t}\n\t\tvoid fetcher.submit(formData, { method: 'POST', action: '/launch-editor' })\n\t}\n\n\tconst githubPath = ENV.EPICSHOP_GITHUB_ROOT.replace(\n\t\t/\\/tree\\/|\\/blob\\//,\n\t\t'/edit/',\n\t)\n\n\treturn (\n\t\t<Link\n\t\t\tclassName=\"self-center font-mono text-sm\"\n\t\t\tonClick={handleClick}\n\t\t\ttarget=\"_blank\"\n\t\t\tto={`${githubPath}/${relativePath}`.replace(/\\\\/g, '/')}\n\t\t>\n\t\t\t<span className=\"@min-[720px]:hidden\">Edit</span>\n\t\t\t<span className=\"hidden @min-[720px]:block @min-[900px]:hidden\">\n\t\t\t\tEdit on GitHub\n\t\t\t</span>\n\t\t\t<span className=\"hidden @min-[900px]:block\">\n\t\t\t\tEdit this page on GitHub\n\t\t\t</span>\n\t\t</Link>\n\t)\n}\n\nexport const LaunchEditor = ENV.EPICSHOP_DEPLOYED\n\t? LaunchGitHub\n\t: LaunchEditorImpl\n"],"names":["useLaunchFetcher","onUpdate","fetcher","useFetcher","useEffect","state","data","LaunchEditorImpl","className","file","appFile","appName","syncTo","line","column","children","peRedirectInput","usePERedirectInput","handleSubmitButtonClick","event","altKey","metaKey","preventDefault","form","currentTarget","formData","FormData","set","submit","method","action","console","error","fileList","type","syncToType","jsxs","Form","showProgressBarField","jsx","name","value","map","Fragment","onClick","cn","status","LaunchGitHub","apps","useApps","requestInfo","useRequestInfo","Array","isArray","safePath","s","replace","githubFileRoot","ENV","EPICSHOP_GITHUB_ROOT","href","EPICSHOP_CONTEXT_CWD","rel","target","app","find","a","filename","appFileLine","split","lineNumber","Number","path","relativePath","separator","join","EditFileOnGitHub","handleClick","e","EPICSHOP_DEPLOYED","append","githubPath","Link","to","LaunchEditor"],"mappings":"8TAqNA,SAASA,EAAiBC,EAAkD,CAC3E,MAAMC,EAAUC,EAAA,EAEhBC,OAAAA,EAAAA,UAAU,IAAM,CACXF,EAAQG,QAAU,QAAUH,EAAQI,MAAQ,MAC/CL,IAAW,cAAc,CAE3B,EAAG,CAACC,EAASD,CAAQ,CAAC,EAEfC,CACR,CAEA,SAASK,EAAiB,CACzBC,UAAAA,EACAC,KAAAA,EACAC,QAAAA,EACAC,QAAAA,EACAC,OAAAA,EACAC,KAAAA,EACAC,OAAAA,EACAC,SAAAA,EACAd,SAAAA,CACD,EAAsB,CACrB,MAAMC,EAAUF,EAAiBC,CAAQ,EACnCe,EAAkBC,EAAA,EAClBC,EAA2BC,GAAyC,CACzE,GAAI,CAACP,GAAU,CAACO,EAAMC,QAAU,CAACD,EAAME,QAAS,OAChDF,EAAMG,eAAA,EACN,MAAMC,EAAOJ,EAAMK,cAAcD,KACjC,GAAI,CAACA,EAAM,OACX,MAA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