@a-company/paradigm 3.25.2 → 3.27.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.
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ log
4
+ } from "./chunk-4NCFWYGG.js";
5
+ import "./chunk-ZXMDA7VB.js";
6
+
7
+ // src/commands/conductor.ts
8
+ import { execSync, spawn } from "child_process";
9
+ import * as fs from "fs";
10
+ import * as path from "path";
11
+ import { fileURLToPath } from "url";
12
+ import chalk from "chalk";
13
+ var __filename = fileURLToPath(import.meta.url);
14
+ var __dirname = path.dirname(__filename);
15
+ async function conductorCommand(options) {
16
+ const cmdLog = log.command("conductor");
17
+ const conductorDir = findConductorDir();
18
+ if (!conductorDir) {
19
+ cmdLog.error("Could not locate packages/conductor/");
20
+ console.log(chalk.gray(" Ensure the Paradigm monorepo is intact."));
21
+ process.exit(1);
22
+ }
23
+ const buildDir = path.join(conductorDir, ".build", "release");
24
+ const binaryPath = path.join(buildDir, "conductor");
25
+ const needsBuild = options.build || !fs.existsSync(binaryPath);
26
+ if (needsBuild) {
27
+ cmdLog.info("Building Conductor\u2026");
28
+ try {
29
+ const buildCmd = "swift build -c release";
30
+ execSync(buildCmd, {
31
+ cwd: conductorDir,
32
+ stdio: options.verbose ? "inherit" : "pipe"
33
+ });
34
+ cmdLog.success("Build complete");
35
+ } catch (error) {
36
+ cmdLog.error("Build failed");
37
+ const errMsg = error.message || "";
38
+ if (errMsg.includes("xcode-select")) {
39
+ console.log(chalk.gray(" Xcode Command Line Tools are required."));
40
+ console.log(chalk.gray(" Install with: xcode-select --install"));
41
+ } else {
42
+ console.log(chalk.gray(` ${errMsg.slice(0, 200)}`));
43
+ }
44
+ process.exit(1);
45
+ }
46
+ }
47
+ cmdLog.info("Launching Conductor\u2026");
48
+ const child = spawn(binaryPath, [], {
49
+ detached: true,
50
+ stdio: "ignore"
51
+ });
52
+ child.unref();
53
+ console.log(chalk.cyan("\n Paradigm Conductor is running."));
54
+ console.log(chalk.gray(" Look for the waveform icon in your menu bar."));
55
+ console.log(chalk.gray(" Quit via the menu bar icon or Cmd+Q.\n"));
56
+ }
57
+ function findConductorDir() {
58
+ let dir = path.resolve(__dirname, "..");
59
+ for (let i = 0; i < 5; i++) {
60
+ const candidate = path.join(dir, "packages", "conductor");
61
+ if (fs.existsSync(path.join(candidate, "Package.swift"))) {
62
+ return candidate;
63
+ }
64
+ dir = path.dirname(dir);
65
+ }
66
+ const cwdCandidate = path.join(process.cwd(), "packages", "conductor");
67
+ if (fs.existsSync(path.join(cwdCandidate, "Package.swift"))) {
68
+ return cwdCandidate;
69
+ }
70
+ return null;
71
+ }
72
+ export {
73
+ conductorCommand
74
+ };
package/dist/index.js CHANGED
@@ -747,6 +747,10 @@ sentinelCmd.command("defend [path]", { isDefault: true }).description("Launch th
747
747
  const { sentinelCommand } = await import("./sentinel-FUR3QKCJ.js");
748
748
  await sentinelCommand(path2, options);
749
749
  });
750
+ program.command("conductor").description("Launch Paradigm Conductor \u2014 multimodal mission control for Claude Code sessions").option("--build", "Force rebuild the native binary").option("-v, --verbose", "Show build output").action(async (options) => {
751
+ const { conductorCommand } = await import("./conductor-CAIY5LJA.js");
752
+ await conductorCommand(options);
753
+ });
750
754
  program.command("university").description("Launch Paradigm University - interactive learning platform & PLSAT certification").option("-p, --port <port>", "Port to run on", "3839").option("--no-open", "Don't open browser automatically").action(async (options) => {
751
755
  const { universityCommand } = await import("./university-A66BMZ4Z.js");
752
756
  await universityCommand(void 0, options);
package/dist/mcp.js CHANGED
@@ -2026,8 +2026,8 @@ function registerResources(server, getContext2) {
2026
2026
  }
2027
2027
 
2028
2028
  // ../paradigm-mcp/src/tools/index.ts
2029
- import * as os3 from "os";
2030
- import * as path28 from "path";
2029
+ import * as os4 from "os";
2030
+ import * as path29 from "path";
2031
2031
  import {
2032
2032
  ListToolsRequestSchema,
2033
2033
  CallToolRequestSchema
@@ -2791,7 +2791,7 @@ function navigateExplore(config, target, rootDir) {
2791
2791
  }
2792
2792
  if (result.paths.length === 0) {
2793
2793
  const areaSymbols = Object.entries(config.symbols).filter(
2794
- ([sym, path29]) => sym.toLowerCase().includes(targetLower) || path29.toLowerCase().includes(targetLower)
2794
+ ([sym, path30]) => sym.toLowerCase().includes(targetLower) || path30.toLowerCase().includes(targetLower)
2795
2795
  ).slice(0, 10);
2796
2796
  result.paths = [...new Set(areaSymbols.map(([, p]) => p))];
2797
2797
  result.symbols = areaSymbols.map(([s]) => s);
@@ -11289,8 +11289,8 @@ function generateRunId() {
11289
11289
  var TEMPLATE_REGEX = /\{\{([^}]+)\}\}/g;
11290
11290
  function interpolate(value, scope) {
11291
11291
  if (typeof value === "string") {
11292
- return value.replace(TEMPLATE_REGEX, (_match, path29) => {
11293
- const resolved = resolvePath(path29.trim(), scope);
11292
+ return value.replace(TEMPLATE_REGEX, (_match, path30) => {
11293
+ const resolved = resolvePath(path30.trim(), scope);
11294
11294
  return resolved !== void 0 ? String(resolved) : _match;
11295
11295
  });
11296
11296
  }
@@ -11323,8 +11323,8 @@ function resolvePath(dotPath, scope) {
11323
11323
  return void 0;
11324
11324
  }
11325
11325
  }
11326
- function deepGet(obj, path29) {
11327
- const parts = path29.split(/[.\[\]]+/).filter(Boolean);
11326
+ function deepGet(obj, path30) {
11327
+ const parts = path30.split(/[.\[\]]+/).filter(Boolean);
11328
11328
  let current = obj;
11329
11329
  for (const part of parts) {
11330
11330
  if (current == null || typeof current !== "object") return void 0;
@@ -11560,11 +11560,11 @@ async function runPersonaObject(rootDir, persona, options) {
11560
11560
  }
11561
11561
  async function runChain(rootDir, chainId, options) {
11562
11562
  const start = Date.now();
11563
- const fs25 = await import("fs");
11564
- const path29 = await import("path");
11563
+ const fs26 = await import("fs");
11564
+ const path30 = await import("path");
11565
11565
  const yaml15 = await import("js-yaml");
11566
- const chainPath = path29.join(rootDir, ".paradigm", "personas", "chains", `${chainId}.yaml`);
11567
- if (!fs25.existsSync(chainPath)) {
11566
+ const chainPath = path30.join(rootDir, ".paradigm", "personas", "chains", `${chainId}.yaml`);
11567
+ if (!fs26.existsSync(chainPath)) {
11568
11568
  return {
11569
11569
  chain_id: chainId,
11570
11570
  status: "error",
@@ -11573,7 +11573,7 @@ async function runChain(rootDir, chainId, options) {
11573
11573
  duration_ms: Date.now() - start
11574
11574
  };
11575
11575
  }
11576
- const chain = yaml15.load(fs25.readFileSync(chainPath, "utf8"));
11576
+ const chain = yaml15.load(fs26.readFileSync(chainPath, "utf8"));
11577
11577
  let permutation;
11578
11578
  if (options.permutation && chain.permutations) {
11579
11579
  permutation = chain.permutations.find((p) => p.id === options.permutation);
@@ -11677,8 +11677,8 @@ function validateInterpolation(persona) {
11677
11677
  const serialized = JSON.stringify(step);
11678
11678
  const templates = serialized.match(TEMPLATE_REGEX) || [];
11679
11679
  for (const template of templates) {
11680
- const path29 = template.replace("{{", "").replace("}}", "").trim();
11681
- const [namespace, ...rest] = path29.split(".");
11680
+ const path30 = template.replace("{{", "").replace("}}", "").trim();
11681
+ const [namespace, ...rest] = path30.split(".");
11682
11682
  const key = rest.join(".");
11683
11683
  switch (namespace) {
11684
11684
  case "fixtures":
@@ -13743,9 +13743,259 @@ async function handlePipelineTool(name, args, ctx) {
13743
13743
  }
13744
13744
  }
13745
13745
 
13746
- // ../paradigm-mcp/src/tools/fallback-grep.ts
13747
- import * as path27 from "path";
13746
+ // ../paradigm-mcp/src/tools/conductor.ts
13748
13747
  import { execSync as execSync5 } from "child_process";
13748
+
13749
+ // ../paradigm-mcp/src/utils/conductor-loader.ts
13750
+ import * as fs25 from "fs";
13751
+ import * as path27 from "path";
13752
+ import * as os3 from "os";
13753
+ var CONDUCTOR_DIR = path27.join(os3.homedir(), ".conductor");
13754
+ var SESSIONS_DIR = path27.join(CONDUCTOR_DIR, "sessions");
13755
+ function ensureSessionsDir() {
13756
+ if (!fs25.existsSync(SESSIONS_DIR)) {
13757
+ fs25.mkdirSync(SESSIONS_DIR, { recursive: true });
13758
+ }
13759
+ }
13760
+ function registerConductorSession(session) {
13761
+ ensureSessionsDir();
13762
+ const entry = {
13763
+ ...session,
13764
+ registeredAt: (/* @__PURE__ */ new Date()).toISOString()
13765
+ };
13766
+ const filePath = path27.join(SESSIONS_DIR, `${session.pid}.json`);
13767
+ fs25.writeFileSync(filePath, JSON.stringify(entry, null, 2), "utf-8");
13768
+ return entry;
13769
+ }
13770
+ function unregisterConductorSession(pid) {
13771
+ const filePath = path27.join(SESSIONS_DIR, `${pid}.json`);
13772
+ if (fs25.existsSync(filePath)) {
13773
+ fs25.unlinkSync(filePath);
13774
+ return true;
13775
+ }
13776
+ return false;
13777
+ }
13778
+ function listConductorSessions() {
13779
+ ensureSessionsDir();
13780
+ const files = fs25.readdirSync(SESSIONS_DIR).filter((f) => f.endsWith(".json"));
13781
+ const sessions = [];
13782
+ for (const file of files) {
13783
+ try {
13784
+ const content = fs25.readFileSync(path27.join(SESSIONS_DIR, file), "utf-8");
13785
+ const session = JSON.parse(content);
13786
+ sessions.push(session);
13787
+ } catch {
13788
+ }
13789
+ }
13790
+ return sessions;
13791
+ }
13792
+ function cleanStaleSessions() {
13793
+ const sessions = listConductorSessions();
13794
+ let cleaned = 0;
13795
+ for (const session of sessions) {
13796
+ if (!isProcessAlive(session.pid)) {
13797
+ unregisterConductorSession(session.pid);
13798
+ cleaned++;
13799
+ }
13800
+ }
13801
+ return cleaned;
13802
+ }
13803
+ function isProcessAlive(pid) {
13804
+ try {
13805
+ process.kill(pid, 0);
13806
+ return true;
13807
+ } catch {
13808
+ return false;
13809
+ }
13810
+ }
13811
+
13812
+ // ../paradigm-mcp/src/tools/conductor.ts
13813
+ function getConductorToolsList() {
13814
+ return [
13815
+ {
13816
+ name: "paradigm_conductor_register",
13817
+ description: 'Register this Claude Code session with Paradigm Conductor. Makes the session visible in the Conductor overlay for voice/gesture/gaze dispatch. Call this when the user says "/conduct" or wants to surface a session to Conductor. ~100 tokens.',
13818
+ inputSchema: {
13819
+ type: "object",
13820
+ properties: {
13821
+ label: {
13822
+ type: "string",
13823
+ description: 'Human-readable label for this session (e.g., "backend refactor", "auth feature")'
13824
+ },
13825
+ terminal: {
13826
+ type: "string",
13827
+ description: 'Terminal bundle ID (e.g., "com.mitchellh.ghostty"). Auto-detected if omitted.'
13828
+ }
13829
+ },
13830
+ required: []
13831
+ },
13832
+ annotations: {
13833
+ title: "Register with Conductor",
13834
+ readOnlyHint: false,
13835
+ destructiveHint: false,
13836
+ idempotentHint: true,
13837
+ openWorldHint: false
13838
+ }
13839
+ },
13840
+ {
13841
+ name: "paradigm_conductor_unregister",
13842
+ description: "Unregister this Claude Code session from Paradigm Conductor. Removes it from the Conductor overlay. Call when ending a session or when the user wants to hide from Conductor. ~50 tokens.",
13843
+ inputSchema: {
13844
+ type: "object",
13845
+ properties: {},
13846
+ required: []
13847
+ },
13848
+ annotations: {
13849
+ title: "Unregister from Conductor",
13850
+ readOnlyHint: false,
13851
+ destructiveHint: false,
13852
+ idempotentHint: true,
13853
+ openWorldHint: false
13854
+ }
13855
+ },
13856
+ {
13857
+ name: "paradigm_conductor_list",
13858
+ description: "List all Claude Code sessions currently registered with Paradigm Conductor. Shows PIDs, project dirs, and labels. ~150 tokens.",
13859
+ inputSchema: {
13860
+ type: "object",
13861
+ properties: {
13862
+ clean: {
13863
+ type: "boolean",
13864
+ description: "If true, clean up stale sessions (dead PIDs) before listing"
13865
+ }
13866
+ },
13867
+ required: []
13868
+ },
13869
+ annotations: {
13870
+ title: "List Conductor sessions",
13871
+ readOnlyHint: true,
13872
+ destructiveHint: false,
13873
+ idempotentHint: true,
13874
+ openWorldHint: false
13875
+ }
13876
+ }
13877
+ ];
13878
+ }
13879
+ async function handleConductorTool(name, args, ctx) {
13880
+ switch (name) {
13881
+ case "paradigm_conductor_register": {
13882
+ const pid = process.pid;
13883
+ const projectDir2 = ctx.projectRoot;
13884
+ let terminal = args.terminal;
13885
+ if (!terminal) {
13886
+ terminal = detectTerminalBundleId();
13887
+ }
13888
+ let branch;
13889
+ try {
13890
+ branch = execSync5("git rev-parse --abbrev-ref HEAD", {
13891
+ cwd: projectDir2,
13892
+ encoding: "utf-8",
13893
+ timeout: 3e3
13894
+ }).trim();
13895
+ } catch {
13896
+ }
13897
+ let parentPid;
13898
+ try {
13899
+ const ppid = execSync5(`ps -o ppid= -p ${pid}`, {
13900
+ encoding: "utf-8",
13901
+ timeout: 3e3
13902
+ }).trim();
13903
+ parentPid = parseInt(ppid, 10);
13904
+ if (isNaN(parentPid)) parentPid = void 0;
13905
+ } catch {
13906
+ }
13907
+ const session = registerConductorSession({
13908
+ pid,
13909
+ parentPid,
13910
+ projectDir: projectDir2,
13911
+ terminal,
13912
+ label: args.label,
13913
+ branch
13914
+ });
13915
+ const lines = [
13916
+ `\u2713 Registered with Conductor`,
13917
+ ``,
13918
+ ` PID: ${session.pid}`,
13919
+ ` Project: ${session.projectDir}`
13920
+ ];
13921
+ if (session.branch) lines.push(` Branch: ${session.branch}`);
13922
+ if (session.label) lines.push(` Label: ${session.label}`);
13923
+ if (session.terminal) lines.push(` Terminal: ${session.terminal}`);
13924
+ lines.push(` File: ~/.conductor/sessions/${session.pid}.json`);
13925
+ lines.push(``);
13926
+ lines.push(`This session is now visible in Paradigm Conductor.`);
13927
+ lines.push(`Conductor will auto-discover it via the registration file.`);
13928
+ return { text: lines.join("\n"), handled: true };
13929
+ }
13930
+ case "paradigm_conductor_unregister": {
13931
+ const pid = process.pid;
13932
+ const removed = unregisterConductorSession(pid);
13933
+ if (removed) {
13934
+ return {
13935
+ text: `\u2713 Unregistered from Conductor (PID ${pid}).
13936
+ This session is no longer visible in the Conductor overlay.`,
13937
+ handled: true
13938
+ };
13939
+ } else {
13940
+ return {
13941
+ text: `Session (PID ${pid}) was not registered with Conductor.`,
13942
+ handled: true
13943
+ };
13944
+ }
13945
+ }
13946
+ case "paradigm_conductor_list": {
13947
+ if (args.clean) {
13948
+ const cleaned = cleanStaleSessions();
13949
+ if (cleaned > 0) {
13950
+ }
13951
+ }
13952
+ const sessions = listConductorSessions();
13953
+ if (sessions.length === 0) {
13954
+ return {
13955
+ text: "No sessions registered with Conductor.\nUse paradigm_conductor_register or /conduct to register.",
13956
+ handled: true
13957
+ };
13958
+ }
13959
+ const lines = [`${sessions.length} session(s) registered with Conductor:
13960
+ `];
13961
+ for (const s of sessions) {
13962
+ const parts = [` PID ${s.pid}`];
13963
+ if (s.label) parts.push(`"${s.label}"`);
13964
+ parts.push(`\u2014 ${s.projectDir}`);
13965
+ if (s.branch) parts.push(`(${s.branch})`);
13966
+ lines.push(parts.join(" "));
13967
+ }
13968
+ if (args.clean) {
13969
+ lines.push(`
13970
+ (Stale sessions cleaned)`);
13971
+ }
13972
+ return { text: lines.join("\n"), handled: true };
13973
+ }
13974
+ default:
13975
+ return { text: "", handled: false };
13976
+ }
13977
+ }
13978
+ function detectTerminalBundleId() {
13979
+ try {
13980
+ const script = `
13981
+ tell application "System Events"
13982
+ set frontApp to first application process whose frontmost is true
13983
+ return bundle identifier of frontApp
13984
+ end tell
13985
+ `;
13986
+ const result = execSync5(`osascript -e '${script}'`, {
13987
+ encoding: "utf-8",
13988
+ timeout: 3e3
13989
+ }).trim();
13990
+ return result || void 0;
13991
+ } catch {
13992
+ return void 0;
13993
+ }
13994
+ }
13995
+
13996
+ // ../paradigm-mcp/src/tools/fallback-grep.ts
13997
+ import * as path28 from "path";
13998
+ import { execSync as execSync6 } from "child_process";
13749
13999
  function grepForReferences(rootDir, symbol, options = {}) {
13750
14000
  const { maxResults = 20 } = options;
13751
14001
  const results = [];
@@ -13759,7 +14009,7 @@ function grepForReferences(rootDir, symbol, options = {}) {
13759
14009
  let output = "";
13760
14010
  for (const cmd of grepCommands) {
13761
14011
  try {
13762
- output = execSync5(cmd, { encoding: "utf8", maxBuffer: 1024 * 1024 });
14012
+ output = execSync6(cmd, { encoding: "utf8", maxBuffer: 1024 * 1024 });
13763
14013
  if (output.trim()) break;
13764
14014
  } catch {
13765
14015
  continue;
@@ -13773,7 +14023,7 @@ function grepForReferences(rootDir, symbol, options = {}) {
13773
14023
  const match = line.match(/^(.+?):(\d+):(.*)$/);
13774
14024
  if (match) {
13775
14025
  const [, filePath, lineNum, content] = match;
13776
- const relativePath = path27.relative(rootDir, filePath);
14026
+ const relativePath = path28.relative(rootDir, filePath);
13777
14027
  let context2 = "unknown";
13778
14028
  if (relativePath.includes(".purpose") || relativePath.includes("portal.yaml")) {
13779
14029
  context2 = "purpose";
@@ -14042,6 +14292,8 @@ function registerTools(server, getContext2, reloadContext2) {
14042
14292
  ...getHeatmapToolsList(),
14043
14293
  // Pipeline tools
14044
14294
  ...getPipelineToolsList(),
14295
+ // Conductor session registration tools
14296
+ ...getConductorToolsList(),
14045
14297
  // Plugin update check
14046
14298
  {
14047
14299
  name: "paradigm_plugin_check",
@@ -14432,7 +14684,7 @@ function registerTools(server, getContext2, reloadContext2) {
14432
14684
  const symbols = getSymbolsByType(ctx.index, type);
14433
14685
  examples[type] = symbols.slice(0, 3).map((s) => s.symbol);
14434
14686
  }
14435
- const platform2 = os3.platform();
14687
+ const platform2 = os4.platform();
14436
14688
  const isWindows = platform2 === "win32";
14437
14689
  const shell = isWindows ? "PowerShell/CMD" : platform2 === "darwin" ? "zsh/bash" : "bash";
14438
14690
  let protocols;
@@ -14675,7 +14927,7 @@ Update command:
14675
14927
  const { rebuildStaticFiles: rebuildStaticFiles2 } = await import("./reindex-YG3KIXAK.js");
14676
14928
  const memberResults = [];
14677
14929
  for (const member of ctx.workspace.config.members) {
14678
- const memberAbsPath = path28.resolve(path28.dirname(ctx.workspace.workspacePath), member.path);
14930
+ const memberAbsPath = path29.resolve(path29.dirname(ctx.workspace.workspacePath), member.path);
14679
14931
  try {
14680
14932
  const result = await rebuildStaticFiles2(memberAbsPath);
14681
14933
  memberResults.push({
@@ -14890,6 +15142,15 @@ Update command:
14890
15142
  };
14891
15143
  }
14892
15144
  }
15145
+ if (name.startsWith("paradigm_conductor_")) {
15146
+ const result = await handleConductorTool(name, args, ctx);
15147
+ if (result.handled) {
15148
+ trackToolCall(result.text.length, name);
15149
+ return {
15150
+ content: [{ type: "text", text: result.text }]
15151
+ };
15152
+ }
15153
+ }
14893
15154
  if (name === "paradigm_reindex") {
14894
15155
  const reload = reloadContext2 || (async () => {
14895
15156
  });
@@ -83,5 +83,5 @@ Error generating stack: `+i.message+`
83
83
  */var Il=S,fm=cm;function dm(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var pm=typeof Object.is=="function"?Object.is:dm,hm=fm.useSyncExternalStore,mm=Il.useRef,vm=Il.useEffect,gm=Il.useMemo,ym=Il.useDebugValue;hf.useSyncExternalStoreWithSelector=function(e,t,n,r,l){var i=mm(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=gm(function(){function u(x){if(!c){if(c=!0,h=x,x=r(x),l!==void 0&&o.hasValue){var y=o.value;if(l(y,x))return m=y}return m=x}if(y=m,pm(h,x))return y;var w=r(x);return l!==void 0&&l(y,w)?(h=x,y):(h=x,m=w)}var c=!1,h,m,v=n===void 0?null:n;return[function(){return u(t())},v===null?void 0:function(){return u(v())}]},[t,n,r,l]);var s=hm(e,i[0],i[1]);return vm(function(){o.hasValue=!0,o.value=s},[s]),ym(s),s};pf.exports=hf;var xm=pf.exports;const wm=Uu(xm),gf={},{useDebugValue:Sm}=vo,{useSyncExternalStoreWithSelector:km}=wm;let Iu=!1;const Cm=e=>e;function Em(e,t=Cm,n){(gf?"production":void 0)!=="production"&&n&&!Iu&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Iu=!0);const r=km(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Sm(r),r}const Ou=e=>{(gf?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?em(e):e,n=(r,l)=>Em(t,r,l);return Object.assign(n,t),n},cs=e=>e?Ou(e):Ou,Ol=cs((e,t)=>({courses:[],courseCache:{},isLoading:!1,error:null,loadCourses:async()=>{e({isLoading:!0,error:null});try{const n=await fetch("/api/courses");if(!n.ok)throw new Error("Failed to load courses");const r=await n.json();e({courses:r.courses,isLoading:!1})}catch(n){e({error:n.message,isLoading:!1})}},loadCourse:async n=>{const r=t().courseCache[n];if(r)return r;try{const l=await fetch(`/api/courses/${n}`);if(!l.ok)return null;const i=await l.json();return e(o=>({courseCache:{...o.courseCache,[n]:i}})),i}catch{return null}}})),yf="paradigm-university-progress";function jm(){try{const e=localStorage.getItem(yf);return e?JSON.parse(e):{}}catch{return{}}}function pi(e){try{localStorage.setItem(yf,JSON.stringify(e))}catch{}}const Ml=cs((e,t)=>({progress:jm(),completeLesson:(n,r)=>{e(l=>{const i=l.progress[n]||{courseId:n,completedLessons:[],quizResults:{}};if(i.completedLessons.includes(r))return l;const o={...l.progress,[n]:{...i,completedLessons:[...i.completedLessons,r]}};return pi(o),{progress:o}})},recordQuiz:n=>{e(r=>{const l=r.progress[n.courseId]||{courseId:n.courseId,completedLessons:[],quizResults:{}},i={...r.progress,[n.courseId]:{...l,quizResults:{...l.quizResults,[n.lessonId]:n}}};return pi(i),{progress:i}})},getCourseProgress:n=>t().progress[n]||{courseId:n,completedLessons:[],quizResults:{}},isLessonCompleted:(n,r)=>{const l=t().progress[n];return l?l.completedLessons.includes(r):!1},getCoursePercentage:(n,r)=>{if(r===0)return 0;const l=t().progress[n];return l?Math.round(l.completedLessons.length/r*100):0},resetProgress:()=>{pi({}),e({progress:{}})}})),xf="paradigm-university-plsat";function Nm(){try{const e=localStorage.getItem(xf);return e?JSON.parse(e):{certificates:[],studentName:""}}catch{return{certificates:[],studentName:""}}}function Mu(e){try{localStorage.setItem(xf,JSON.stringify(e))}catch{}}const fs=cs((e,t)=>{const n=Nm();return{certificates:n.certificates,studentName:n.studentName,setStudentName:r=>{e({studentName:r});const l=t();Mu({certificates:l.certificates,studentName:r})},addCertificate:r=>{e(l=>{const i=[...l.certificates,r];return Mu({certificates:i,studentName:l.studentName}),{certificates:i}})},getLatestCertificate:()=>{const r=t().certificates;return r.length===0?null:r.reduce((l,i)=>new Date(i.date)>new Date(l.date)?i:l)},getCertificateForVersion:r=>t().certificates.find(l=>l.plsatVersion===r&&l.passed)||null,hasPassed:()=>t().certificates.some(r=>r.passed)}});function wf({percentage:e,size:t=48,strokeWidth:n=4}){const r=(t-n)/2,l=2*Math.PI*r,i=l-e/100*l;return a.jsxs("div",{className:"progress-ring",style:{width:t,height:t},children:[a.jsxs("svg",{width:t,height:t,children:[a.jsx("circle",{className:"ring-bg",cx:t/2,cy:t/2,r,fill:"none",strokeWidth:n}),a.jsx("circle",{className:"ring-fill",cx:t/2,cy:t/2,r,fill:"none",strokeWidth:n,strokeLinecap:"round",strokeDasharray:l,strokeDashoffset:i})]}),a.jsxs("span",{className:"ring-label",children:[e,"%"]})]})}function Pm(){const{courses:e,isLoading:t,loadCourses:n}=Ol(),r=Ml(i=>i.getCoursePercentage),l=fs(i=>i.hasPassed);return S.useEffect(()=>{n()},[n]),t?a.jsx("div",{className:"loading",children:"Opening the campus gates..."}):a.jsxs("div",{className:"home",children:[a.jsxs("div",{className:"home-hero",children:[a.jsx(pn,{size:140}),a.jsx("h1",{children:"Paradigm University"}),a.jsx("p",{className:"motto",children:"Universitas Paradigmatica — Lux in Codice"}),a.jsx("p",{className:"description",children:"Master the Paradigm framework through structured courses, hands-on quizzes, and the legendary PLSAT certification exam."})]}),a.jsx("div",{className:"gold-divider"}),a.jsxs("section",{className:"course-catalog",children:[a.jsx("h2",{children:"Course Catalog"}),e.map(i=>{const o=r(i.id,i.lessonCount);return a.jsxs(q,{to:`/course/${i.id}`,className:"course-card",children:[a.jsxs("div",{className:"course-card-header",children:[a.jsxs("div",{className:"course-card-title",children:[a.jsx("span",{className:"course-number",children:i.id.replace("para-","PARA ")}),a.jsx("h3",{children:i.title.replace(/^PARA \d+: /,"")})]}),a.jsx(wf,{percentage:o})]}),a.jsx("p",{className:"course-description",children:i.description}),a.jsx("div",{className:"course-topics",children:i.lessons.map(s=>a.jsx("span",{className:"course-topic-tag",children:s.title},s.id))}),a.jsxs("div",{className:"course-meta",children:[a.jsxs("span",{children:[i.lessonCount," lessons"]}),a.jsx("span",{className:"course-meta-cta",children:"Start course →"})]})]},i.id)})]}),a.jsx("div",{className:"gold-divider"}),a.jsxs("section",{children:[a.jsx("h2",{className:"mb-lg",children:"Quick Links"}),a.jsxs("div",{className:"quick-links",children:[a.jsx(q,{to:"/plsat",className:"quick-link",children:l()?"Retake the PLSAT":"Take the PLSAT"}),a.jsx(q,{to:"/reference",className:"quick-link",children:"Reference Library"}),a.jsx(q,{to:"/certificate",className:"quick-link",children:"View Certificates"}),a.jsx(q,{to:"/course/para-101",className:"quick-link",children:"Start Learning"})]})]})]})}function _m(){const{courses:e,isLoading:t,loadCourses:n}=Ol(),r=Ml(l=>l.getCoursePercentage);return S.useEffect(()=>{n()},[n]),t?a.jsx("div",{className:"loading",children:"Loading courses..."}):a.jsx("div",{className:"home",children:a.jsxs("section",{className:"course-catalog",children:[a.jsx("h2",{children:"Course Catalog"}),e.map(l=>{const i=r(l.id,l.lessonCount);return a.jsxs(q,{to:`/course/${l.id}`,className:"course-card",children:[a.jsx("span",{className:"course-number",children:l.id.replace("para-","PARA ")}),a.jsx("h3",{children:l.title.replace(/^PARA \d+: /,"")}),a.jsx("p",{className:"course-description",children:l.description}),a.jsxs("div",{className:"course-meta",children:[a.jsxs("span",{children:[l.lessonCount," lessons"]}),a.jsx(wf,{percentage:i})]})]},l.id)})]})})}function Du(e){return e.replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/\*([^*]+)\*/g,"<em>$1</em>")}function Lm(e){const t=e.trim().split(`
84
84
  `);if(t.length<2)return e;const n=o=>o.split("|").map(s=>s.trim()).filter(s=>s.length>0),r=n(t[0]),l=t.slice(2).map(n);let i="<table><thead><tr>";for(const o of r)i+=`<th>${Du(o)}</th>`;i+="</tr></thead><tbody>";for(const o of l){i+="<tr>";for(const s of o)i+=`<td>${Du(s)}</td>`;i+="</tr>"}return i+="</tbody></table>",i}function Ut(e){const t=[];let n=e.replace(/```(\w*)\n([\s\S]*?)```/g,(r,l,i)=>{const o=t.length;return t.push(`<pre><code>${i}</code></pre>`),`\0BLOCK${o}\0`});return n=n.replace(/((?:^\|.+\|\n?)+)/gm,r=>{const l=r.trim().split(`
85
85
  `);if(l.length>=3&&/^[\s-:|]+$/.test(l[1])){const i=t.length;return t.push(Lm(r)),`\0BLOCK${i}\0`}return r}),n=n.replace(/`([^`]+)`/g,"<code>$1</code>").replace(/^#### (.+)$/gm,"<h4>$1</h4>").replace(/^### (.+)$/gm,"<h3>$1</h3>").replace(/^## (.+)$/gm,"<h2>$1</h2>").replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/\*([^*]+)\*/g,"<em>$1</em>").replace(/^> (.+)$/gm,"<blockquote>$1</blockquote>").replace(/^\d+\.\s+(.+)$/gm,"<oli>$1</oli>").replace(/((?:<oli>.*<\/oli>\n?)+)/g,r=>"<ol>"+r.replace(/<\/?oli>/g,l=>l.replace("oli","li"))+"</ol>").replace(/^- (.+)$/gm,"<li>$1</li>").replace(/((?:<li>.*<\/li>\n?)+)/g,"<ul>$1</ul>").replace(/^(?!<(?:h[1-6]|ul|ol|li|p|blockquote|pre|table|thead|tbody|tr|td|th|\x00)).+$/gm,"<p>$&</p>").replace(/\n{2,}/g,`
86
- `),n=n.replace(/\x00BLOCK(\d+)\x00/g,(r,l)=>t[Number(l)]),n}function Au(){const{courseId:e,lessonId:t}=uf(),n=sf(),r=Ol(d=>d.loadCourse),[l,i]=S.useState(null),[o,s]=S.useState(null),[u,c]=S.useState(!0),{isLessonCompleted:h,completeLesson:m}=Ml();if(S.useEffect(()=>{e&&(c(!0),r(e).then(d=>{if(i(d),d&&d.lessons.length>0){const f=t?d.lessons.find(p=>p.id===t):null;f?s(f):(s(d.lessons[0]),n(`/course/${e}/${d.lessons[0].id}`,{replace:!0}))}c(!1)}))},[e,t,r,n]),u)return a.jsx("div",{className:"loading",children:"Opening the textbook..."});if(!l)return a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"Course not found"}),a.jsx("p",{children:"The requested course does not exist."}),a.jsx(q,{to:"/",className:"btn btn-primary mt-lg",children:"Return to Campus"})]});const v=o?l.lessons.findIndex(d=>d.id===o.id):0,x=()=>{o&&e&&m(e,o.id)},y=(d,f=!1)=>{s(d),n(`/course/${e}/${d.id}`),f&&window.scrollTo(0,0)},w=()=>{v<l.lessons.length-1&&y(l.lessons[v+1],!0)},N=()=>{v>0&&y(l.lessons[v-1],!0)};return a.jsxs("div",{className:"course-layout",children:[a.jsxs("aside",{className:"course-sidebar",children:[a.jsx("h2",{children:l.title}),a.jsx("nav",{className:"lesson-nav",children:l.lessons.map(d=>{const f=e?h(e,d.id):!1,p=(o==null?void 0:o.id)===d.id;let g="lesson-nav-item";return p&&(g+=" active"),f&&!p&&(g+=" completed"),a.jsx("button",{className:g,onClick:()=>y(d),children:d.title},d.id)})})]}),a.jsx("div",{className:"course-content",children:o&&a.jsxs(a.Fragment,{children:[a.jsx("h1",{children:o.title}),o.keyConcepts.length>0&&a.jsx("div",{className:"key-concepts",children:o.keyConcepts.map(d=>a.jsx("span",{className:"concept-tag",children:d},d))}),a.jsx("div",{className:"lesson-content",dangerouslySetInnerHTML:{__html:Ut(o.content)}}),a.jsxs("div",{className:"lesson-actions",children:[a.jsx("div",{children:v>0&&a.jsx("button",{className:"btn btn-secondary",onClick:N,children:"Previous"})}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[e&&!h(e,o.id)&&a.jsx("button",{className:"btn btn-secondary",onClick:x,children:"Mark Complete"}),o.quiz.length>0&&e&&a.jsx(q,{to:`/course/${e}/quiz/${o.id}`,className:"btn btn-gold",children:"Take Quiz"}),v<l.lessons.length-1&&a.jsx("button",{className:"btn btn-primary",onClick:w,children:"Next Lesson"})]})]})]})})]})}function co({number:e,question:t,scenario:n,choices:r,correct:l,explanation:i,selectedAnswer:o,onSelect:s,showResult:u,onAnswered:c,splitLayout:h}){const[m,v]=S.useState(null),[x,y]=S.useState(!1),w=s!==void 0,N=w?o||null:m,d=w?u:x,f=j=>{d&&!w||(w?s==null||s(j):(v(j),y(!0),c==null||c(j)))},p=N===l,g=Object.keys(r).sort(),E=a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"question-number",children:["Question ",e]}),n&&a.jsx("div",{className:"scenario",dangerouslySetInnerHTML:{__html:Ut(n)}}),a.jsx("div",{className:"question-text",dangerouslySetInnerHTML:{__html:Ut(t)}})]}),k=a.jsx("div",{className:"choices",children:g.map(j=>{let P="choice-btn";return N===j&&(P+=" selected"),d&&j===l&&(P+=" correct"),d&&N===j&&j!==l&&(P+=" incorrect"),a.jsxs("button",{className:P,onClick:()=>f(j),disabled:d&&!w,children:[a.jsxs("span",{className:"choice-letter",children:[j,"."]}),a.jsx("span",{dangerouslySetInnerHTML:{__html:Ut(r[j])}})]},j)})});return h?a.jsxs("div",{className:"question-card",children:[a.jsxs("div",{className:"question-split-layout",children:[a.jsx("div",{className:"question-content",children:E}),a.jsx("div",{className:"answer-choices",children:k})]}),d&&a.jsxs("div",{className:`explanation ${p?"":"wrong"}`,children:[a.jsx("strong",{children:p?"Correct!":`Incorrect. The answer is ${l}.`}),a.jsx("br",{}),a.jsx("span",{dangerouslySetInnerHTML:{__html:Ut(i)}})]})]}):a.jsxs("div",{className:"question-card",children:[E,k,d&&a.jsxs("div",{className:`explanation ${p?"":"wrong"}`,children:[a.jsx("strong",{children:p?"Correct!":`Incorrect. The answer is ${l}.`}),a.jsx("br",{}),a.jsx("span",{dangerouslySetInnerHTML:{__html:Ut(i)}})]})]})}function Tm(){const{courseId:e,lessonId:t}=uf(),n=Ol(g=>g.loadCourse),{recordQuiz:r,completeLesson:l,getCourseProgress:i}=Ml(),[o,s]=S.useState(null),[u,c]=S.useState(null),[h,m]=S.useState(!0),[v,x]=S.useState(!1),[y,w]=S.useState(0),N=e&&t?i(e).quizResults[t]:void 0;S.useEffect(()=>{e&&(m(!0),n(e).then(g=>{if(g&&t){const E=g.lessons.findIndex(k=>k.id===t);s(E>=0?g.lessons[E]:null),E>=0&&E<g.lessons.length-1&&c(g.lessons[E+1].id)}m(!1)}))},[e,t,n]);const[d,f]=S.useState({}),p=(g,E)=>{if(f(k=>({...k,[g]:E})),o){const k={...d,[g]:E};if(Object.keys(k).length===o.quiz.length){const j=o.quiz.filter(P=>k[P.id]===P.correct).length;if(w(j),x(!0),e&&t){const P={courseId:e,lessonId:t,score:j,total:o.quiz.length,answers:k,date:new Date().toISOString()};r(P),l(e,t)}}}};return h?a.jsx("div",{className:"loading",children:"Preparing your examination..."}):!o||o.quiz.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"No quiz available"}),a.jsx("p",{children:"This lesson does not have a quiz."}),a.jsx(q,{to:`/course/${e}`,className:"btn btn-primary mt-lg",children:"Back to Course"})]}):a.jsxs("div",{className:"quiz-container",children:[a.jsxs("div",{className:"quiz-header",children:[a.jsxs("h1",{children:[o.title," — Quiz"]}),a.jsx("p",{className:"quiz-progress",children:v?`Score: ${y}/${o.quiz.length} (${Math.round(y/o.quiz.length*100)}%)`:`${Object.keys(d).length}/${o.quiz.length} answered`}),N&&!v&&a.jsxs("p",{className:"text-muted mt-sm",children:["Previous best: ",N.score,"/",N.total]})]}),o.quiz.map((g,E)=>a.jsx(co,{number:E+1,question:g.question,choices:g.choices,correct:g.correct,explanation:g.explanation,onAnswered:k=>p(g.id,k)},g.id)),v&&a.jsxs("div",{className:"text-center mt-xl",children:[a.jsx("p",{className:"mb-lg",style:{fontSize:"1.25rem",fontFamily:"var(--font-serif)"},children:y===o.quiz.length?"Perfect score! Exemplary scholarship.":y>=o.quiz.length*.8?"Well done, scholar. You have demonstrated understanding.":"Review the material and try again. Persistence is the path to mastery."}),u?a.jsx(q,{to:`/course/${e}/${u}`,className:"btn btn-primary",children:"Next Lesson"}):a.jsx(q,{to:`/course/${e}`,className:"btn btn-primary",children:"Return to Course"})]})]})}function zm({totalSeconds:e,onTimeUp:t,running:n}){const[r,l]=S.useState(e),i=S.useCallback(()=>{t()},[t]);S.useEffect(()=>{if(!n)return;const h=setInterval(()=>{l(m=>m<=1?(clearInterval(h),i(),0):m-1)},1e3);return()=>clearInterval(h)},[n,i]);const o=Math.floor(r/60),s=r%60,u=r/e*100;let c="timer-display";return u<20?c+=" critical":u<40&&(c+=" warning"),a.jsxs("span",{className:c,children:[String(o).padStart(2,"0"),":",String(s).padStart(2,"0")]})}function Fu({text:e}){const t=e.split(/(```[\s\S]*?```)/g);return a.jsx("div",{className:"passage-block",children:a.jsx("div",{className:"passage-content",children:t.map((n,r)=>{if(n.startsWith("```")){const l=n.match(/^```(\w*)\n?([\s\S]*?)```$/),i=l?l[2]:n.slice(3,-3);return a.jsx("pre",{children:a.jsx("code",{children:i})},r)}return n.split(/\n\n+/).map((l,i)=>a.jsx("p",{children:l},`${r}-${i}`))})})})}function $u(e,t,n){if(!t)return null;const r=e[n];return r.passageId?t[r.passageId]??null:null}function Rm(){const[e,t]=S.useState(null),[n,r]=S.useState("intro"),[l,i]=S.useState({}),[o,s]=S.useState(0),[u,c]=S.useState(!0),[h,m]=S.useState(null),{studentName:v,setStudentName:x,addCertificate:y}=fs(),[w,N]=S.useState(v);S.useEffect(()=>{fetch("/api/plsat/3.0").then(k=>k.json()).then(k=>{t(k),c(!1)}).catch(()=>c(!1))},[]);const d=S.useCallback(()=>{if(!e)return;const k=e.questions.filter(de=>l[de.id]===de.correct).length,j=e.questions.length,P=Math.round(k/j*100),M=P>=e.passThreshold*100,z={name:w||"Anonymous Scholar",score:k,total:j,percentage:P,passed:M,plsatVersion:e.version,frameworkVersion:e.frameworkVersion,date:new Date().toISOString()};m(z),y(z),w&&x(w),r("results")},[e,l,w,y,x]),f=S.useCallback(()=>{d()},[d]),p=()=>{d()},g=()=>{i({}),s(0),r("exam")},E=S.useMemo(()=>!e||n!=="exam"?null:$u(e.questions,e.passages,o),[e,n,o]);if(u)return a.jsx("div",{className:"loading",children:"The examination board is convening..."});if(!e)return a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"PLSAT Unavailable"}),a.jsx("p",{children:"Could not load the examination. Please try again."})]});if(n==="intro")return a.jsxs("div",{className:"plsat-container",children:[a.jsxs("div",{className:"plsat-intro",children:[a.jsx(pn,{size:100}),a.jsx("h1",{children:"The PLSAT"}),a.jsx("p",{className:"plsat-subtitle",children:"Paradigm Licensure Standardized Assessment Test"}),a.jsxs("p",{className:"text-muted",children:["Version ",e.version]})]}),a.jsxs("div",{className:"plsat-rules",children:[a.jsx("h3",{children:"Examination Rules"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsxs("strong",{children:[e.questions.length," questions"]})," covering all aspects of the Paradigm framework"]}),a.jsxs("li",{children:[a.jsxs("strong",{children:[Math.floor(e.timeLimit/60)," minutes"]})," to complete the examination"]}),a.jsxs("li",{children:[a.jsxs("strong",{children:[e.passThreshold*100,"%"]})," required to pass and receive certification"]}),a.jsx("li",{children:"All questions are multiple choice (A through E)"}),a.jsx("li",{children:"Some questions reference a shared passage — read it carefully"}),a.jsx("li",{children:"You may navigate between questions freely"}),a.jsx("li",{children:"There is no penalty for guessing — answer every question"}),a.jsx("li",{children:"Your certificate will display the PLSAT version for posterity"})]})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"mb-lg",children:a.jsx("input",{type:"text",className:"name-input",placeholder:"Enter your name, scholar",value:w,onChange:k=>N(k.target.value)})}),a.jsx("button",{className:"btn btn-primary btn-lg",onClick:g,children:"Begin Examination"})]})]});if(n==="exam"){const k=e.questions[o],j=Object.keys(l).length;return a.jsxs("div",{className:"plsat-container",children:[a.jsxs("div",{className:"plsat-timer",children:[a.jsx(zm,{totalSeconds:e.timeLimit,onTimeUp:f,running:!0}),a.jsxs("span",{className:"plsat-progress-text",children:["Question ",o+1," of ",e.questions.length," | ",j," answered"]})]}),a.jsxs("div",{style:{marginTop:"var(--space-lg)"},children:[E&&a.jsx(Fu,{text:E}),a.jsx(co,{number:o+1,question:k.question,scenario:k.scenario,choices:k.choices,correct:k.correct,explanation:k.explanation,selectedAnswer:l[k.id],onSelect:P=>i(M=>({...M,[k.id]:P})),showResult:!1,splitLayout:!0})]}),a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"var(--space-lg)"},children:[a.jsx("button",{className:"btn btn-secondary",disabled:o===0,onClick:()=>s(P=>P-1),children:"Previous"}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[j===e.questions.length&&a.jsx("button",{className:"btn btn-gold",onClick:p,children:"Submit Examination"}),a.jsx("button",{className:"btn btn-primary",disabled:o===e.questions.length-1,onClick:()=>s(P=>P+1),children:"Next"})]})]}),a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",marginTop:"var(--space-xl)",justifyContent:"center"},children:e.questions.map((P,M)=>a.jsx("button",{onClick:()=>s(M),style:{width:28,height:28,borderRadius:"50%",border:M===o?"2px solid var(--burgundy)":"1px solid var(--parchment-dark)",background:l[P.id]?"var(--gold-bg)":"var(--cream)",color:"var(--ink)",fontSize:"0.6875rem",cursor:"pointer",fontWeight:M===o?600:400},children:M+1},P.id))})]})}return n==="results"&&h?a.jsx("div",{className:"plsat-container",children:a.jsxs("div",{className:"plsat-results",children:[a.jsx(pn,{size:80}),a.jsxs("div",{className:`score-display ${h.passed?"passed":"failed"}`,children:[h.percentage,"%"]}),a.jsx("p",{className:"verdict",children:h.passed?"Congratulations! You have passed the PLSAT.":"The examination board regrets to inform you that you did not pass."}),a.jsxs("p",{className:"text-muted mb-lg",children:["Score: ",h.score,"/",h.total," | PLSAT v",h.plsatVersion," | ",new Date(h.date).toLocaleDateString()]}),a.jsxs("div",{style:{display:"flex",gap:"1rem",justifyContent:"center"},children:[h.passed&&a.jsx(q,{to:"/certificate",className:"btn btn-gold btn-lg",children:"View Certificate"}),a.jsx("button",{className:"btn btn-secondary",onClick:()=>r("review"),children:"Review Answers"}),a.jsx("button",{className:"btn btn-primary",onClick:()=>r("intro"),children:h.passed?"Retake":"Try Again"})]})]})}):n==="review"?a.jsxs("div",{className:"plsat-container",children:[a.jsxs("div",{className:"quiz-header",children:[a.jsx("h1",{children:"PLSAT Review"}),a.jsx("p",{className:"quiz-progress",children:h?`Score: ${h.score}/${h.total} (${h.percentage}%)`:""})]}),e.questions.map((k,j)=>{const P=$u(e.questions,e.passages,j);return a.jsxs("div",{children:[P&&a.jsx(Fu,{text:P}),a.jsx(co,{number:j+1,question:k.question,scenario:k.scenario,choices:k.choices,correct:k.correct,explanation:k.explanation,selectedAnswer:l[k.id],onSelect:()=>{},showResult:!0,splitLayout:!0})]},k.id)}),a.jsx("div",{className:"text-center mt-xl",children:a.jsx("button",{className:"btn btn-primary",onClick:()=>r("results"),children:"Back to Results"})})]}):null}function Im(){const[e,t]=S.useState(null),[n,r]=S.useState(!0);return S.useEffect(()=>{fetch("/api/reference").then(l=>l.json()).then(l=>{t(l),r(!1)}).catch(()=>r(!1))},[]),n?a.jsx("div",{className:"loading",children:"Opening the reference library..."}):e?a.jsxs("div",{className:"reference-container",children:[a.jsx("h1",{className:"mb-lg",children:"Reference Library"}),e.sections.map(l=>a.jsxs("section",{className:"reference-section",children:[a.jsx("h2",{children:l.title}),a.jsx("div",{className:"reference-grid",children:l.cards.map(i=>a.jsxs("div",{className:"ref-card",children:[i.symbol&&a.jsx("div",{className:"ref-symbol",children:i.symbol}),a.jsx("h4",{children:i.name}),a.jsx("p",{children:i.description}),i.examples&&i.examples.length>0&&a.jsx("div",{className:"ref-examples",children:i.examples.map(o=>a.jsx("span",{className:"ref-example",children:o},o))}),i.logger&&a.jsx("p",{style:{marginTop:"0.5rem"},children:a.jsx("code",{children:i.logger})}),i.when&&a.jsx("p",{className:"text-muted",style:{fontSize:"0.8125rem",marginTop:"0.25rem"},children:a.jsx("em",{children:i.when})}),i.command&&a.jsx("p",{style:{marginTop:"0.5rem"},children:a.jsx("code",{children:i.command})}),i.steps&&i.steps.length>0&&a.jsx("ol",{style:{fontSize:"0.875rem",paddingLeft:"1.25rem",marginTop:"0.5rem"},children:i.steps.map((o,s)=>a.jsx("li",{style:{marginBottom:"0.25rem"},children:o},s))})]},i.id))})]},l.id))]}):a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"Reference library unavailable"}),a.jsx("p",{children:"Could not load reference data."})]})}function Om(){const{certificates:e}=fs(),t=e.filter(r=>r.passed),n=t.length>0?t.reduce((r,l)=>new Date(l.date)>new Date(r.date)?l:r):null;return n?a.jsxs("div",{className:"certificate-container",children:[a.jsx("div",{className:"no-print text-center mb-lg",children:a.jsx("button",{className:"btn btn-gold",onClick:()=>window.print(),children:"Print Certificate"})}),a.jsxs("div",{className:"certificate",children:[a.jsx(pn,{size:100,className:"cert-seal"}),a.jsx("h1",{children:"Paradigm University"}),a.jsx("p",{className:"cert-title",children:"Universitas Paradigmatica — Lux in Codice"}),a.jsx("div",{className:"gold-divider"}),a.jsx("p",{style:{fontSize:"0.875rem",color:"var(--ink-muted)",marginTop:"var(--space-lg)"},children:"This is to certify that"}),a.jsx("div",{className:"cert-name",children:n.name}),a.jsxs("p",{className:"cert-body",children:["has successfully completed the",a.jsx("br",{}),a.jsx("strong",{children:"Paradigm Licensure Standardized Assessment Test"}),a.jsx("br",{}),"and is hereby recognized as a certified Paradigm practitioner."]}),a.jsxs("p",{className:"cert-score",children:["Score: ",n.score,"/",n.total," (",n.percentage,"%)"]}),a.jsx("div",{className:"gold-divider"}),a.jsxs("dl",{className:"cert-meta",children:[a.jsxs("div",{children:[a.jsx("dt",{children:"PLSAT Version"}),a.jsxs("dd",{children:["v",n.plsatVersion]})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Framework Version"}),a.jsxs("dd",{children:["v",n.frameworkVersion]})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Date Issued"}),a.jsx("dd",{children:new Date(n.date).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]})]})]}),e.length>1&&a.jsxs("div",{className:"no-print mt-xl",children:[a.jsx("h3",{className:"mb-md",children:"All Attempts"}),[...e].reverse().map((r,l)=>a.jsx("div",{className:"ref-card",style:{marginBottom:"0.5rem"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("span",{children:["PLSAT v",r.plsatVersion," — ",r.score,"/",r.total," (",r.percentage,"%)",r.passed?" ✓":""]}),a.jsx("span",{className:"text-muted",children:new Date(r.date).toLocaleDateString()})]})},l))]})]}):a.jsxs("div",{className:"certificate-container",children:[a.jsxs("div",{className:"empty-state",children:[a.jsx(pn,{size:80}),a.jsx("h3",{className:"mt-lg",children:"No Certificates Yet"}),a.jsx("p",{children:"Pass the PLSAT examination to earn your Paradigm certification."}),a.jsx(q,{to:"/plsat",className:"btn btn-primary mt-lg",children:"Take the PLSAT"})]}),e.length>0&&a.jsxs("div",{className:"mt-xl",children:[a.jsx("h3",{className:"mb-md",children:"Previous Attempts"}),e.map((r,l)=>a.jsx("div",{className:"ref-card",style:{marginBottom:"0.5rem"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("span",{children:["PLSAT v",r.plsatVersion," — ",r.score,"/",r.total," (",r.percentage,"%)"]}),a.jsx("span",{className:"text-muted",children:new Date(r.date).toLocaleDateString()})]})},l))]})]})}function Mm(){return a.jsxs("div",{className:"app",children:[a.jsx(Zh,{version:"3.10.5"}),a.jsx("main",{className:"main-content",children:a.jsxs(Bh,{children:[a.jsx(We,{path:"/",element:a.jsx(Pm,{})}),a.jsx(We,{path:"/courses",element:a.jsx(_m,{})}),a.jsx(We,{path:"/course/:courseId",element:a.jsx(Au,{})}),a.jsx(We,{path:"/course/:courseId/:lessonId",element:a.jsx(Au,{})}),a.jsx(We,{path:"/course/:courseId/quiz/:lessonId",element:a.jsx(Tm,{})}),a.jsx(We,{path:"/plsat",element:a.jsx(Rm,{})}),a.jsx(We,{path:"/reference",element:a.jsx(Im,{})}),a.jsx(We,{path:"/certificate",element:a.jsx(Om,{})})]})})]})}hi.createRoot(document.getElementById("root")).render(a.jsx(vo.StrictMode,{children:a.jsx(Gh,{children:a.jsx(Mm,{})})}));
87
- //# sourceMappingURL=index-BPzqnvrg.js.map
86
+ `),n=n.replace(/\x00BLOCK(\d+)\x00/g,(r,l)=>t[Number(l)]),n}function Au(){const{courseId:e,lessonId:t}=uf(),n=sf(),r=Ol(d=>d.loadCourse),[l,i]=S.useState(null),[o,s]=S.useState(null),[u,c]=S.useState(!0),{isLessonCompleted:h,completeLesson:m}=Ml();if(S.useEffect(()=>{e&&(c(!0),r(e).then(d=>{if(i(d),d&&d.lessons.length>0){const f=t?d.lessons.find(p=>p.id===t):null;f?s(f):(s(d.lessons[0]),n(`/course/${e}/${d.lessons[0].id}`,{replace:!0}))}c(!1)}))},[e,t,r,n]),u)return a.jsx("div",{className:"loading",children:"Opening the textbook..."});if(!l)return a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"Course not found"}),a.jsx("p",{children:"The requested course does not exist."}),a.jsx(q,{to:"/",className:"btn btn-primary mt-lg",children:"Return to Campus"})]});const v=o?l.lessons.findIndex(d=>d.id===o.id):0,x=()=>{o&&e&&m(e,o.id)},y=(d,f=!1)=>{s(d),n(`/course/${e}/${d.id}`),f&&window.scrollTo(0,0)},w=()=>{v<l.lessons.length-1&&y(l.lessons[v+1],!0)},N=()=>{v>0&&y(l.lessons[v-1],!0)};return a.jsxs("div",{className:"course-layout",children:[a.jsxs("aside",{className:"course-sidebar",children:[a.jsx("h2",{children:l.title}),a.jsx("nav",{className:"lesson-nav",children:l.lessons.map(d=>{const f=e?h(e,d.id):!1,p=(o==null?void 0:o.id)===d.id;let g="lesson-nav-item";return p&&(g+=" active"),f&&!p&&(g+=" completed"),a.jsx("button",{className:g,onClick:()=>y(d),children:d.title},d.id)})})]}),a.jsx("div",{className:"course-content",children:o&&a.jsxs(a.Fragment,{children:[a.jsx("h1",{children:o.title}),o.keyConcepts.length>0&&a.jsx("div",{className:"key-concepts",children:o.keyConcepts.map(d=>a.jsx("span",{className:"concept-tag",children:d},d))}),a.jsx("div",{className:"lesson-content",dangerouslySetInnerHTML:{__html:Ut(o.content)}}),a.jsxs("div",{className:"lesson-actions",children:[a.jsx("div",{children:v>0&&a.jsx("button",{className:"btn btn-secondary",onClick:N,children:"Previous"})}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[e&&!h(e,o.id)&&a.jsx("button",{className:"btn btn-secondary",onClick:x,children:"Mark Complete"}),o.quiz.length>0&&e&&a.jsx(q,{to:`/course/${e}/quiz/${o.id}`,className:"btn btn-gold",children:"Take Quiz"}),v<l.lessons.length-1&&a.jsx("button",{className:"btn btn-primary",onClick:w,children:"Next Lesson"})]})]})]})})]})}function co({number:e,question:t,scenario:n,choices:r,correct:l,explanation:i,selectedAnswer:o,onSelect:s,showResult:u,onAnswered:c,splitLayout:h}){const[m,v]=S.useState(null),[x,y]=S.useState(!1),w=s!==void 0,N=w?o||null:m,d=w?u:x,f=j=>{d&&!w||(w?s==null||s(j):(v(j),y(!0),c==null||c(j)))},p=N===l,g=Object.keys(r).sort(),E=a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"question-number",children:["Question ",e]}),n&&a.jsx("div",{className:"scenario",dangerouslySetInnerHTML:{__html:Ut(n)}}),a.jsx("div",{className:"question-text",dangerouslySetInnerHTML:{__html:Ut(t)}})]}),k=a.jsx("div",{className:"choices",children:g.map(j=>{let P="choice-btn";return N===j&&(P+=" selected"),d&&j===l&&(P+=" correct"),d&&N===j&&j!==l&&(P+=" incorrect"),a.jsxs("button",{className:P,onClick:()=>f(j),disabled:d&&!w,children:[a.jsxs("span",{className:"choice-letter",children:[j,"."]}),a.jsx("span",{dangerouslySetInnerHTML:{__html:Ut(r[j])}})]},j)})});return h?a.jsxs("div",{className:"question-card",children:[a.jsxs("div",{className:"question-split-layout",children:[a.jsx("div",{className:"question-content",children:E}),a.jsx("div",{className:"answer-choices",children:k})]}),d&&a.jsxs("div",{className:`explanation ${p?"":"wrong"}`,children:[a.jsx("strong",{children:p?"Correct!":`Incorrect. The answer is ${l}.`}),a.jsx("br",{}),a.jsx("span",{dangerouslySetInnerHTML:{__html:Ut(i)}})]})]}):a.jsxs("div",{className:"question-card",children:[E,k,d&&a.jsxs("div",{className:`explanation ${p?"":"wrong"}`,children:[a.jsx("strong",{children:p?"Correct!":`Incorrect. The answer is ${l}.`}),a.jsx("br",{}),a.jsx("span",{dangerouslySetInnerHTML:{__html:Ut(i)}})]})]})}function Tm(){const{courseId:e,lessonId:t}=uf(),n=Ol(g=>g.loadCourse),{recordQuiz:r,completeLesson:l,getCourseProgress:i}=Ml(),[o,s]=S.useState(null),[u,c]=S.useState(null),[h,m]=S.useState(!0),[v,x]=S.useState(!1),[y,w]=S.useState(0),N=e&&t?i(e).quizResults[t]:void 0;S.useEffect(()=>{e&&(m(!0),n(e).then(g=>{if(g&&t){const E=g.lessons.findIndex(k=>k.id===t);s(E>=0?g.lessons[E]:null),E>=0&&E<g.lessons.length-1&&c(g.lessons[E+1].id)}m(!1)}))},[e,t,n]);const[d,f]=S.useState({}),p=(g,E)=>{if(f(k=>({...k,[g]:E})),o){const k={...d,[g]:E};if(Object.keys(k).length===o.quiz.length){const j=o.quiz.filter(P=>k[P.id]===P.correct).length;if(w(j),x(!0),e&&t){const P={courseId:e,lessonId:t,score:j,total:o.quiz.length,answers:k,date:new Date().toISOString()};r(P),l(e,t)}}}};return h?a.jsx("div",{className:"loading",children:"Preparing your examination..."}):!o||o.quiz.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"No quiz available"}),a.jsx("p",{children:"This lesson does not have a quiz."}),a.jsx(q,{to:`/course/${e}`,className:"btn btn-primary mt-lg",children:"Back to Course"})]}):a.jsxs("div",{className:"quiz-container",children:[a.jsxs("div",{className:"quiz-header",children:[a.jsxs("h1",{children:[o.title," — Quiz"]}),a.jsx("p",{className:"quiz-progress",children:v?`Score: ${y}/${o.quiz.length} (${Math.round(y/o.quiz.length*100)}%)`:`${Object.keys(d).length}/${o.quiz.length} answered`}),N&&!v&&a.jsxs("p",{className:"text-muted mt-sm",children:["Previous best: ",N.score,"/",N.total]})]}),o.quiz.map((g,E)=>a.jsx(co,{number:E+1,question:g.question,choices:g.choices,correct:g.correct,explanation:g.explanation,onAnswered:k=>p(g.id,k)},g.id)),v&&a.jsxs("div",{className:"text-center mt-xl",children:[a.jsx("p",{className:"mb-lg",style:{fontSize:"1.25rem",fontFamily:"var(--font-serif)"},children:y===o.quiz.length?"Perfect score! Exemplary scholarship.":y>=o.quiz.length*.8?"Well done, scholar. You have demonstrated understanding.":"Review the material and try again. Persistence is the path to mastery."}),u?a.jsx(q,{to:`/course/${e}/${u}`,className:"btn btn-primary",children:"Next Lesson"}):a.jsx(q,{to:`/course/${e}`,className:"btn btn-primary",children:"Return to Course"})]})]})}function zm({totalSeconds:e,onTimeUp:t,running:n}){const[r,l]=S.useState(e),i=S.useCallback(()=>{t()},[t]);S.useEffect(()=>{if(!n)return;const h=setInterval(()=>{l(m=>m<=1?(clearInterval(h),i(),0):m-1)},1e3);return()=>clearInterval(h)},[n,i]);const o=Math.floor(r/60),s=r%60,u=r/e*100;let c="timer-display";return u<20?c+=" critical":u<40&&(c+=" warning"),a.jsxs("span",{className:c,children:[String(o).padStart(2,"0"),":",String(s).padStart(2,"0")]})}function Fu({text:e}){const t=e.split(/(```[\s\S]*?```)/g);return a.jsx("div",{className:"passage-block",children:a.jsx("div",{className:"passage-content",children:t.map((n,r)=>{if(n.startsWith("```")){const l=n.match(/^```(\w*)\n?([\s\S]*?)```$/),i=l?l[2]:n.slice(3,-3);return a.jsx("pre",{children:a.jsx("code",{children:i})},r)}return n.split(/\n\n+/).map((l,i)=>a.jsx("p",{children:l},`${r}-${i}`))})})})}function $u(e,t,n){if(!t)return null;const r=e[n];return r.passageId?t[r.passageId]??null:null}function Rm(){const[e,t]=S.useState(null),[n,r]=S.useState("intro"),[l,i]=S.useState({}),[o,s]=S.useState(0),[u,c]=S.useState(!0),[h,m]=S.useState(null),{studentName:v,setStudentName:x,addCertificate:y}=fs(),[w,N]=S.useState(v);S.useEffect(()=>{fetch("/api/plsat/3.0").then(k=>k.json()).then(k=>{t(k),c(!1)}).catch(()=>c(!1))},[]);const d=S.useCallback(()=>{if(!e)return;const k=e.questions.filter(de=>l[de.id]===de.correct).length,j=e.questions.length,P=Math.round(k/j*100),M=P>=e.passThreshold*100,z={name:w||"Anonymous Scholar",score:k,total:j,percentage:P,passed:M,plsatVersion:e.version,frameworkVersion:e.frameworkVersion,date:new Date().toISOString()};m(z),y(z),w&&x(w),r("results")},[e,l,w,y,x]),f=S.useCallback(()=>{d()},[d]),p=()=>{d()},g=()=>{i({}),s(0),r("exam")},E=S.useMemo(()=>!e||n!=="exam"?null:$u(e.questions,e.passages,o),[e,n,o]);if(u)return a.jsx("div",{className:"loading",children:"The examination board is convening..."});if(!e)return a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"PLSAT Unavailable"}),a.jsx("p",{children:"Could not load the examination. Please try again."})]});if(n==="intro")return a.jsxs("div",{className:"plsat-container",children:[a.jsxs("div",{className:"plsat-intro",children:[a.jsx(pn,{size:100}),a.jsx("h1",{children:"The PLSAT"}),a.jsx("p",{className:"plsat-subtitle",children:"Paradigm Licensure Standardized Assessment Test"}),a.jsxs("p",{className:"text-muted",children:["Version ",e.version]})]}),a.jsxs("div",{className:"plsat-rules",children:[a.jsx("h3",{children:"Examination Rules"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsxs("strong",{children:[e.questions.length," questions"]})," covering all aspects of the Paradigm framework"]}),a.jsxs("li",{children:[a.jsxs("strong",{children:[Math.floor(e.timeLimit/60)," minutes"]})," to complete the examination"]}),a.jsxs("li",{children:[a.jsxs("strong",{children:[e.passThreshold*100,"%"]})," required to pass and receive certification"]}),a.jsx("li",{children:"All questions are multiple choice (A through E)"}),a.jsx("li",{children:"Some questions reference a shared passage — read it carefully"}),a.jsx("li",{children:"You may navigate between questions freely"}),a.jsx("li",{children:"There is no penalty for guessing — answer every question"}),a.jsx("li",{children:"Your certificate will display the PLSAT version for posterity"})]})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"mb-lg",children:a.jsx("input",{type:"text",className:"name-input",placeholder:"Enter your name, scholar",value:w,onChange:k=>N(k.target.value)})}),a.jsx("button",{className:"btn btn-primary btn-lg",onClick:g,children:"Begin Examination"})]})]});if(n==="exam"){const k=e.questions[o],j=Object.keys(l).length;return a.jsxs("div",{className:"plsat-container",children:[a.jsxs("div",{className:"plsat-timer",children:[a.jsx(zm,{totalSeconds:e.timeLimit,onTimeUp:f,running:!0}),a.jsxs("span",{className:"plsat-progress-text",children:["Question ",o+1," of ",e.questions.length," | ",j," answered"]})]}),a.jsxs("div",{style:{marginTop:"var(--space-lg)"},children:[E&&a.jsx(Fu,{text:E}),a.jsx(co,{number:o+1,question:k.question,scenario:k.scenario,choices:k.choices,correct:k.correct,explanation:k.explanation,selectedAnswer:l[k.id],onSelect:P=>i(M=>({...M,[k.id]:P})),showResult:!1,splitLayout:!0})]}),a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"var(--space-lg)"},children:[a.jsx("button",{className:"btn btn-secondary",disabled:o===0,onClick:()=>s(P=>P-1),children:"Previous"}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[j===e.questions.length&&a.jsx("button",{className:"btn btn-gold",onClick:p,children:"Submit Examination"}),a.jsx("button",{className:"btn btn-primary",disabled:o===e.questions.length-1,onClick:()=>s(P=>P+1),children:"Next"})]})]}),a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",marginTop:"var(--space-xl)",justifyContent:"center"},children:e.questions.map((P,M)=>a.jsx("button",{onClick:()=>s(M),style:{width:28,height:28,borderRadius:"50%",border:M===o?"2px solid var(--burgundy)":"1px solid var(--parchment-dark)",background:l[P.id]?"var(--gold-bg)":"var(--cream)",color:"var(--ink)",fontSize:"0.6875rem",cursor:"pointer",fontWeight:M===o?600:400},children:M+1},P.id))})]})}return n==="results"&&h?a.jsx("div",{className:"plsat-container",children:a.jsxs("div",{className:"plsat-results",children:[a.jsx(pn,{size:80}),a.jsxs("div",{className:`score-display ${h.passed?"passed":"failed"}`,children:[h.percentage,"%"]}),a.jsx("p",{className:"verdict",children:h.passed?"Congratulations! You have passed the PLSAT.":"The examination board regrets to inform you that you did not pass."}),a.jsxs("p",{className:"text-muted mb-lg",children:["Score: ",h.score,"/",h.total," | PLSAT v",h.plsatVersion," | ",new Date(h.date).toLocaleDateString()]}),a.jsxs("div",{style:{display:"flex",gap:"1rem",justifyContent:"center"},children:[h.passed&&a.jsx(q,{to:"/certificate",className:"btn btn-gold btn-lg",children:"View Certificate"}),a.jsx("button",{className:"btn btn-secondary",onClick:()=>r("review"),children:"Review Answers"}),a.jsx("button",{className:"btn btn-primary",onClick:()=>r("intro"),children:h.passed?"Retake":"Try Again"})]})]})}):n==="review"?a.jsxs("div",{className:"plsat-container",children:[a.jsxs("div",{className:"quiz-header",children:[a.jsx("h1",{children:"PLSAT Review"}),a.jsx("p",{className:"quiz-progress",children:h?`Score: ${h.score}/${h.total} (${h.percentage}%)`:""})]}),e.questions.map((k,j)=>{const P=$u(e.questions,e.passages,j);return a.jsxs("div",{children:[P&&a.jsx(Fu,{text:P}),a.jsx(co,{number:j+1,question:k.question,scenario:k.scenario,choices:k.choices,correct:k.correct,explanation:k.explanation,selectedAnswer:l[k.id],onSelect:()=>{},showResult:!0,splitLayout:!0})]},k.id)}),a.jsx("div",{className:"text-center mt-xl",children:a.jsx("button",{className:"btn btn-primary",onClick:()=>r("results"),children:"Back to Results"})})]}):null}function Im(){const[e,t]=S.useState(null),[n,r]=S.useState(!0);return S.useEffect(()=>{fetch("/api/reference").then(l=>l.json()).then(l=>{t(l),r(!1)}).catch(()=>r(!1))},[]),n?a.jsx("div",{className:"loading",children:"Opening the reference library..."}):e?a.jsxs("div",{className:"reference-container",children:[a.jsx("h1",{className:"mb-lg",children:"Reference Library"}),e.sections.map(l=>a.jsxs("section",{className:"reference-section",children:[a.jsx("h2",{children:l.title}),a.jsx("div",{className:"reference-grid",children:l.cards.map(i=>a.jsxs("div",{className:"ref-card",children:[i.symbol&&a.jsx("div",{className:"ref-symbol",children:i.symbol}),a.jsx("h4",{children:i.name}),a.jsx("p",{children:i.description}),i.examples&&i.examples.length>0&&a.jsx("div",{className:"ref-examples",children:i.examples.map(o=>a.jsx("span",{className:"ref-example",children:o},o))}),i.logger&&a.jsx("p",{style:{marginTop:"0.5rem"},children:a.jsx("code",{children:i.logger})}),i.when&&a.jsx("p",{className:"text-muted",style:{fontSize:"0.8125rem",marginTop:"0.25rem"},children:a.jsx("em",{children:i.when})}),i.command&&a.jsx("p",{style:{marginTop:"0.5rem"},children:a.jsx("code",{children:i.command})}),i.steps&&i.steps.length>0&&a.jsx("ol",{style:{fontSize:"0.875rem",paddingLeft:"1.25rem",marginTop:"0.5rem"},children:i.steps.map((o,s)=>a.jsx("li",{style:{marginBottom:"0.25rem"},children:o},s))})]},i.id))})]},l.id))]}):a.jsxs("div",{className:"empty-state",children:[a.jsx("h3",{children:"Reference library unavailable"}),a.jsx("p",{children:"Could not load reference data."})]})}function Om(){const{certificates:e}=fs(),t=e.filter(r=>r.passed),n=t.length>0?t.reduce((r,l)=>new Date(l.date)>new Date(r.date)?l:r):null;return n?a.jsxs("div",{className:"certificate-container",children:[a.jsx("div",{className:"no-print text-center mb-lg",children:a.jsx("button",{className:"btn btn-gold",onClick:()=>window.print(),children:"Print Certificate"})}),a.jsxs("div",{className:"certificate",children:[a.jsx(pn,{size:100,className:"cert-seal"}),a.jsx("h1",{children:"Paradigm University"}),a.jsx("p",{className:"cert-title",children:"Universitas Paradigmatica — Lux in Codice"}),a.jsx("div",{className:"gold-divider"}),a.jsx("p",{style:{fontSize:"0.875rem",color:"var(--ink-muted)",marginTop:"var(--space-lg)"},children:"This is to certify that"}),a.jsx("div",{className:"cert-name",children:n.name}),a.jsxs("p",{className:"cert-body",children:["has successfully completed the",a.jsx("br",{}),a.jsx("strong",{children:"Paradigm Licensure Standardized Assessment Test"}),a.jsx("br",{}),"and is hereby recognized as a certified Paradigm practitioner."]}),a.jsxs("p",{className:"cert-score",children:["Score: ",n.score,"/",n.total," (",n.percentage,"%)"]}),a.jsx("div",{className:"gold-divider"}),a.jsxs("dl",{className:"cert-meta",children:[a.jsxs("div",{children:[a.jsx("dt",{children:"PLSAT Version"}),a.jsxs("dd",{children:["v",n.plsatVersion]})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Framework Version"}),a.jsxs("dd",{children:["v",n.frameworkVersion]})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Date Issued"}),a.jsx("dd",{children:new Date(n.date).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]})]})]}),e.length>1&&a.jsxs("div",{className:"no-print mt-xl",children:[a.jsx("h3",{className:"mb-md",children:"All Attempts"}),[...e].reverse().map((r,l)=>a.jsx("div",{className:"ref-card",style:{marginBottom:"0.5rem"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("span",{children:["PLSAT v",r.plsatVersion," — ",r.score,"/",r.total," (",r.percentage,"%)",r.passed?" ✓":""]}),a.jsx("span",{className:"text-muted",children:new Date(r.date).toLocaleDateString()})]})},l))]})]}):a.jsxs("div",{className:"certificate-container",children:[a.jsxs("div",{className:"empty-state",children:[a.jsx(pn,{size:80}),a.jsx("h3",{className:"mt-lg",children:"No Certificates Yet"}),a.jsx("p",{children:"Pass the PLSAT examination to earn your Paradigm certification."}),a.jsx(q,{to:"/plsat",className:"btn btn-primary mt-lg",children:"Take the PLSAT"})]}),e.length>0&&a.jsxs("div",{className:"mt-xl",children:[a.jsx("h3",{className:"mb-md",children:"Previous Attempts"}),e.map((r,l)=>a.jsx("div",{className:"ref-card",style:{marginBottom:"0.5rem"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("span",{children:["PLSAT v",r.plsatVersion," — ",r.score,"/",r.total," (",r.percentage,"%)"]}),a.jsx("span",{className:"text-muted",children:new Date(r.date).toLocaleDateString()})]})},l))]})]})}function Mm(){return a.jsxs("div",{className:"app",children:[a.jsx(Zh,{version:"3.10.6"}),a.jsx("main",{className:"main-content",children:a.jsxs(Bh,{children:[a.jsx(We,{path:"/",element:a.jsx(Pm,{})}),a.jsx(We,{path:"/courses",element:a.jsx(_m,{})}),a.jsx(We,{path:"/course/:courseId",element:a.jsx(Au,{})}),a.jsx(We,{path:"/course/:courseId/:lessonId",element:a.jsx(Au,{})}),a.jsx(We,{path:"/course/:courseId/quiz/:lessonId",element:a.jsx(Tm,{})}),a.jsx(We,{path:"/plsat",element:a.jsx(Rm,{})}),a.jsx(We,{path:"/reference",element:a.jsx(Im,{})}),a.jsx(We,{path:"/certificate",element:a.jsx(Om,{})})]})})]})}hi.createRoot(document.getElementById("root")).render(a.jsx(vo.StrictMode,{children:a.jsx(Gh,{children:a.jsx(Mm,{})})}));
87
+ //# sourceMappingURL=index-TcsCEBMo.js.map