@principal-ai/logo-component 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,85 @@
1
+ import React from "react";
2
+ export const ForksLogo = ({ width = 150, height = 150, color = "currentColor", particleColor, opacity = 0.9, }) => {
3
+ const finalParticleColor = particleColor || color;
4
+ return (React.createElement("svg", { width: width, height: height, viewBox: "0 0 200 200", xmlns: "http://www.w3.org/2000/svg", style: { opacity } },
5
+ React.createElement("defs", null,
6
+ React.createElement("radialGradient", { id: "sphereGlowForks", cx: "50%", cy: "50%", r: "50%" },
7
+ React.createElement("stop", { offset: "0%", style: { stopColor: color, stopOpacity: 0.3 } }),
8
+ React.createElement("stop", { offset: "100%", style: { stopColor: color, stopOpacity: 0 } })),
9
+ React.createElement("radialGradient", { id: "centerPulseForks", cx: "50%", cy: "50%", r: "50%" },
10
+ React.createElement("stop", { offset: "0%", style: { stopColor: color, stopOpacity: 0.8 } },
11
+ React.createElement("animate", { attributeName: "stop-opacity", values: "0.8;0.3;0.8", dur: "2s", repeatCount: "indefinite" })),
12
+ React.createElement("stop", { offset: "100%", style: { stopColor: color, stopOpacity: 0 } }))),
13
+ React.createElement("circle", { cx: "100", cy: "100", r: "80", fill: "url(#sphereGlowForks)", opacity: "0.5" }),
14
+ React.createElement("circle", { r: "2.5", fill: finalParticleColor, cx: "167", cy: "100", opacity: "0" },
15
+ React.createElement("animateMotion", { dur: "8s", repeatCount: "indefinite", begin: "1s", path: "M 0,0 A 67,27 0 1,0 -134,0 A 67,27 0 1,0 0,0" }),
16
+ React.createElement("animate", { attributeName: "opacity", values: "0;1;0.5;0;0", keyTimes: "0;0.2;0.4;0.5;1", dur: "8s", begin: "1s", repeatCount: "indefinite" })),
17
+ React.createElement("circle", { r: "2.5", fill: finalParticleColor, cx: "167", cy: "100", opacity: "0" },
18
+ React.createElement("animateMotion", { dur: "8s", repeatCount: "indefinite", begin: "2s", path: "M 0,0 A 67,40 0 1,0 -134,0 A 67,40 0 1,0 0,0" }),
19
+ React.createElement("animate", { attributeName: "opacity", values: "0;1;0.5;0;0", keyTimes: "0;0.2;0.4;0.5;1", dur: "8s", begin: "2s", repeatCount: "indefinite" })),
20
+ React.createElement("circle", { r: "2.5", fill: finalParticleColor, cx: "167", cy: "100", opacity: "0" },
21
+ React.createElement("animateMotion", { dur: "8s", repeatCount: "indefinite", begin: "3s", path: "M 0,0 A 67,53 0 1,0 -134,0 A 67,53 0 1,0 0,0" }),
22
+ React.createElement("animate", { attributeName: "opacity", values: "0;1;0.5;0;0", keyTimes: "0;0.2;0.4;0.5;1", dur: "8s", begin: "3s", repeatCount: "indefinite" })),
23
+ React.createElement("circle", { r: "2.5", fill: finalParticleColor, cx: "100", cy: "167", opacity: "0" },
24
+ React.createElement("animateMotion", { dur: "8s", repeatCount: "indefinite", begin: "1.5s", path: "M 0,0 A 27,67 0 1,0 0,-134 A 27,67 0 1,0 0,0" }),
25
+ React.createElement("animate", { attributeName: "opacity", values: "0;1;0.5;0;0", keyTimes: "0;0.2;0.4;0.5;1", dur: "8s", begin: "1.5s", repeatCount: "indefinite" })),
26
+ React.createElement("circle", { r: "2.5", fill: finalParticleColor, cx: "100", cy: "167", opacity: "0" },
27
+ React.createElement("animateMotion", { dur: "8s", repeatCount: "indefinite", begin: "2.5s", path: "M 0,0 A 40,67 0 1,0 0,-134 A 40,67 0 1,0 0,0" }),
28
+ React.createElement("animate", { attributeName: "opacity", values: "0;1;0.5;0;0", keyTimes: "0;0.2;0.4;0.5;1", dur: "8s", begin: "2.5s", repeatCount: "indefinite" })),
29
+ React.createElement("circle", { r: "2.5", fill: finalParticleColor, cx: "100", cy: "167", opacity: "0" },
30
+ React.createElement("animateMotion", { dur: "8s", repeatCount: "indefinite", begin: "3.5s", path: "M 0,0 A 53,67 0 1,0 0,-134 A 53,67 0 1,0 0,0" }),
31
+ React.createElement("animate", { attributeName: "opacity", values: "0;1;0.5;0;0", keyTimes: "0;0.2;0.4;0.5;1", dur: "8s", begin: "3.5s", repeatCount: "indefinite" })),
32
+ React.createElement("circle", { cx: "93", cy: "85", r: "2", fill: finalParticleColor, opacity: "0.9" }),
33
+ React.createElement("circle", { cx: "93", cy: "90", r: "2", fill: finalParticleColor, opacity: "0.9" }),
34
+ React.createElement("circle", { cx: "93", cy: "95", r: "2", fill: finalParticleColor, opacity: "0.9" }),
35
+ React.createElement("circle", { cx: "93", cy: "100", r: "2", fill: finalParticleColor, opacity: "0.9" }),
36
+ React.createElement("circle", { cx: "93", cy: "105", r: "2", fill: finalParticleColor, opacity: "0.9" }),
37
+ React.createElement("circle", { cx: "93", cy: "110", r: "2", fill: finalParticleColor, opacity: "0.9" }),
38
+ React.createElement("circle", { cx: "93", cy: "115", r: "2", fill: finalParticleColor, opacity: "0.9" }),
39
+ React.createElement("circle", { cx: "98", cy: "85", r: "2", fill: finalParticleColor, opacity: "0.9" }),
40
+ React.createElement("circle", { cx: "103", cy: "85", r: "2", fill: finalParticleColor, opacity: "0.9" }),
41
+ React.createElement("circle", { cx: "108", cy: "85", r: "2", fill: finalParticleColor, opacity: "0.9" }),
42
+ React.createElement("circle", { cx: "98", cy: "100", r: "2", fill: finalParticleColor, opacity: "0.9" }),
43
+ React.createElement("circle", { cx: "103", cy: "100", r: "2", fill: finalParticleColor, opacity: "0.9" }),
44
+ React.createElement("circle", { cx: "100", cy: "100", r: "67", fill: "none", stroke: color, strokeWidth: "1.5", opacity: "0.9" }),
45
+ React.createElement("path", { d: "M 33,100 A 67,13 0 0,1 73,88.1", fill: "none", stroke: color, strokeWidth: "1", opacity: "0.7" }),
46
+ React.createElement("path", { d: "M 127,88.1 A 67,13 0 0,1 167,100", fill: "none", stroke: color, strokeWidth: "1", opacity: "0.7" }),
47
+ React.createElement("path", { d: "M 33,100 A 67,13 0 0,0 73,111.9", fill: "none", stroke: color, strokeWidth: "1", opacity: "0.7" }),
48
+ React.createElement("path", { d: "M 127,111.9 A 67,13 0 0,0 167,100", fill: "none", stroke: color, strokeWidth: "1", opacity: "0.7" }),
49
+ React.createElement("ellipse", { cx: "100", cy: "100", rx: "67", ry: "27", fill: "none", stroke: color, strokeWidth: "1", opacity: "0.7" }),
50
+ React.createElement("ellipse", { cx: "100", cy: "100", rx: "67", ry: "40", fill: "none", stroke: color, strokeWidth: "1", opacity: "0.7" }),
51
+ React.createElement("ellipse", { cx: "100", cy: "100", rx: "67", ry: "53", fill: "none", stroke: color, strokeWidth: "1", opacity: "0.7" }),
52
+ React.createElement("path", { d: "M 100,33 A 13,67 0 0,0 87,73", fill: "none", stroke: color, strokeWidth: "1", opacity: "0.7" }),
53
+ React.createElement("path", { d: "M 113,73 A 13,67 0 0,0 100,33", fill: "none", stroke: color, strokeWidth: "1", opacity: "0.7" }),
54
+ React.createElement("path", { d: "M 100,167 A 13,67 0 0,1 87,127", fill: "none", stroke: color, strokeWidth: "1", opacity: "0.7" }),
55
+ React.createElement("path", { d: "M 113,127 A 13,67 0 0,1 100,167", fill: "none", stroke: color, strokeWidth: "1", opacity: "0.7" }),
56
+ React.createElement("ellipse", { cx: "100", cy: "100", rx: "27", ry: "67", fill: "none", stroke: color, strokeWidth: "1", opacity: "0.7" }),
57
+ React.createElement("ellipse", { cx: "100", cy: "100", rx: "40", ry: "67", fill: "none", stroke: color, strokeWidth: "1", opacity: "0.7" }),
58
+ React.createElement("ellipse", { cx: "100", cy: "100", rx: "53", ry: "67", fill: "none", stroke: color, strokeWidth: "1", opacity: "0.7" }),
59
+ React.createElement("ellipse", { cx: "100", cy: "100", rx: "67", ry: "33", fill: "none", stroke: color, strokeWidth: "1", opacity: "0.6", transform: "rotate(30 100 100)" }),
60
+ React.createElement("ellipse", { cx: "100", cy: "100", rx: "67", ry: "33", fill: "none", stroke: color, strokeWidth: "1", opacity: "0.6", transform: "rotate(60 100 100)" }),
61
+ React.createElement("ellipse", { cx: "100", cy: "100", rx: "67", ry: "33", fill: "none", stroke: color, strokeWidth: "1", opacity: "0.6", transform: "rotate(120 100 100)" }),
62
+ React.createElement("ellipse", { cx: "100", cy: "100", rx: "67", ry: "33", fill: "none", stroke: color, strokeWidth: "1", opacity: "0.6", transform: "rotate(150 100 100)" }),
63
+ React.createElement("line", { x1: "33", y1: "100", x2: "73", y2: "100", stroke: color, strokeWidth: "1.5", opacity: "0.8" }),
64
+ React.createElement("line", { x1: "127", y1: "100", x2: "167", y2: "100", stroke: color, strokeWidth: "1.5", opacity: "0.8" }),
65
+ React.createElement("line", { x1: "100", y1: "33", x2: "100", y2: "73", stroke: color, strokeWidth: "1.5", opacity: "0.8" }),
66
+ React.createElement("line", { x1: "100", y1: "127", x2: "100", y2: "167", stroke: color, strokeWidth: "1.5", opacity: "0.8" }),
67
+ React.createElement("circle", { r: "2.5", fill: finalParticleColor, cx: "167", cy: "100", opacity: "0" },
68
+ React.createElement("animateMotion", { dur: "8s", repeatCount: "indefinite", begin: "1s", path: "M 0,0 A 67,27 0 1,0 -134,0 A 67,27 0 1,0 0,0" }),
69
+ React.createElement("animate", { attributeName: "opacity", values: "0;0;0.5;1;1;0.5;0", keyTimes: "0;0.5;0.6;0.75;0.9;0.95;1", dur: "8s", begin: "1s", repeatCount: "indefinite" })),
70
+ React.createElement("circle", { r: "2.5", fill: finalParticleColor, cx: "167", cy: "100", opacity: "0" },
71
+ React.createElement("animateMotion", { dur: "8s", repeatCount: "indefinite", begin: "2s", path: "M 0,0 A 67,40 0 1,0 -134,0 A 67,40 0 1,0 0,0" }),
72
+ React.createElement("animate", { attributeName: "opacity", values: "0;0;0.5;1;1;0.5;0", keyTimes: "0;0.5;0.6;0.75;0.9;0.95;1", dur: "8s", begin: "2s", repeatCount: "indefinite" })),
73
+ React.createElement("circle", { r: "2.5", fill: finalParticleColor, cx: "167", cy: "100", opacity: "0" },
74
+ React.createElement("animateMotion", { dur: "8s", repeatCount: "indefinite", begin: "3s", path: "M 0,0 A 67,53 0 1,0 -134,0 A 67,53 0 1,0 0,0" }),
75
+ React.createElement("animate", { attributeName: "opacity", values: "0;0;0.5;1;1;0.5;0", keyTimes: "0;0.5;0.6;0.75;0.9;0.95;1", dur: "8s", begin: "3s", repeatCount: "indefinite" })),
76
+ React.createElement("circle", { r: "2.5", fill: finalParticleColor, cx: "100", cy: "167", opacity: "0" },
77
+ React.createElement("animateMotion", { dur: "8s", repeatCount: "indefinite", begin: "1.5s", path: "M 0,0 A 27,67 0 1,0 0,-134 A 27,67 0 1,0 0,0" }),
78
+ React.createElement("animate", { attributeName: "opacity", values: "0;0;0.5;1;1;0.5;0", keyTimes: "0;0.5;0.6;0.75;0.9;0.95;1", dur: "8s", begin: "1.5s", repeatCount: "indefinite" })),
79
+ React.createElement("circle", { r: "2.5", fill: finalParticleColor, cx: "100", cy: "167", opacity: "0" },
80
+ React.createElement("animateMotion", { dur: "8s", repeatCount: "indefinite", begin: "2.5s", path: "M 0,0 A 40,67 0 1,0 0,-134 A 40,67 0 1,0 0,0" }),
81
+ React.createElement("animate", { attributeName: "opacity", values: "0;0;0.5;1;1;0.5;0", keyTimes: "0;0.5;0.6;0.75;0.9;0.95;1", dur: "8s", begin: "2.5s", repeatCount: "indefinite" })),
82
+ React.createElement("circle", { r: "2.5", fill: finalParticleColor, cx: "100", cy: "167", opacity: "0" },
83
+ React.createElement("animateMotion", { dur: "8s", repeatCount: "indefinite", begin: "3.5s", path: "M 0,0 A 53,67 0 1,0 0,-134 A 53,67 0 1,0 0,0" }),
84
+ React.createElement("animate", { attributeName: "opacity", values: "0;0;0.5;1;1;0.5;0", keyTimes: "0;0.5;0.6;0.75;0.9;0.95;1", dur: "8s", begin: "3.5s", repeatCount: "indefinite" }))));
85
+ };
package/dist/esm/Logo.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  export const Logo = ({ width = 150, height = 150, color = "currentColor", particleColor, opacity = 0.9, }) => {
3
3
  const finalParticleColor = particleColor || color;
4
- return (React.createElement("svg", { width: width, height: height, viewBox: "0 0 200 200", xmlns: "http://www.w3.org/2000/svg", style: { opacity } },
4
+ return (React.createElement("svg", { width: width, height: height, viewBox: "30 30 140 140", xmlns: "http://www.w3.org/2000/svg", style: { opacity } },
5
5
  React.createElement("defs", null,
6
6
  React.createElement("radialGradient", { id: "sphereGlow", cx: "50%", cy: "50%", r: "50%" },
7
7
  React.createElement("stop", { offset: "0%", style: { stopColor: color, stopOpacity: 0.3 } }),
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ export const LogoSmall = ({ width = 32, height = 32, color = "currentColor", particleColor, opacity = 0.9, }) => {
3
+ const finalParticleColor = particleColor || color;
4
+ return (React.createElement("svg", { width: width, height: height, viewBox: "30 30 140 140", xmlns: "http://www.w3.org/2000/svg", style: { opacity } },
5
+ React.createElement("circle", { cx: "100", cy: "100", r: "67", fill: "none", stroke: color, strokeWidth: "2", opacity: "0.9" }),
6
+ React.createElement("ellipse", { cx: "100", cy: "100", rx: "67", ry: "40", fill: "none", stroke: color, strokeWidth: "1.5", opacity: "0.6" }),
7
+ React.createElement("ellipse", { cx: "100", cy: "100", rx: "40", ry: "67", fill: "none", stroke: color, strokeWidth: "1.5", opacity: "0.6" }),
8
+ React.createElement("ellipse", { cx: "100", cy: "100", rx: "67", ry: "40", fill: "none", stroke: color, strokeWidth: "1.5", opacity: "0.6", transform: "rotate(45 100 100)" }),
9
+ React.createElement("ellipse", { cx: "100", cy: "100", rx: "67", ry: "40", fill: "none", stroke: color, strokeWidth: "1.5", opacity: "0.6", transform: "rotate(-45 100 100)" }),
10
+ React.createElement("circle", { cx: "90", cy: "80", r: "3.5", fill: finalParticleColor, opacity: "0.95" }),
11
+ React.createElement("circle", { cx: "90", cy: "88", r: "3.5", fill: finalParticleColor, opacity: "0.95" }),
12
+ React.createElement("circle", { cx: "90", cy: "96", r: "3.5", fill: finalParticleColor, opacity: "0.95" }),
13
+ React.createElement("circle", { cx: "90", cy: "104", r: "3.5", fill: finalParticleColor, opacity: "0.95" }),
14
+ React.createElement("circle", { cx: "90", cy: "112", r: "3.5", fill: finalParticleColor, opacity: "0.95" }),
15
+ React.createElement("circle", { cx: "90", cy: "120", r: "3.5", fill: finalParticleColor, opacity: "0.95" }),
16
+ React.createElement("circle", { cx: "98", cy: "80", r: "3.5", fill: finalParticleColor, opacity: "0.95" }),
17
+ React.createElement("circle", { cx: "106", cy: "80", r: "3.5", fill: finalParticleColor, opacity: "0.95" }),
18
+ React.createElement("circle", { cx: "114", cy: "88", r: "3.5", fill: finalParticleColor, opacity: "0.95" }),
19
+ React.createElement("circle", { cx: "114", cy: "96", r: "3.5", fill: finalParticleColor, opacity: "0.95" }),
20
+ React.createElement("circle", { cx: "106", cy: "104", r: "3.5", fill: finalParticleColor, opacity: "0.95" }),
21
+ React.createElement("circle", { cx: "98", cy: "104", r: "3.5", fill: finalParticleColor, opacity: "0.95" })));
22
+ };
@@ -0,0 +1,339 @@
1
+ import React, { useMemo, useState, useEffect } from "react";
2
+ import { MazeGenerator } from "./utils/mazeGenerator";
3
+ export const MazeDemo = ({ width = 450, height = 620, mazeColor = "#6366f1", errorColor = "#ef4444", searchColor = "#f59e0b", solutionColor = "#10b981", mazeSeed = 42, }) => {
4
+ // Maze configuration
5
+ const gridSize = 10;
6
+ const cellSize = 30;
7
+ const padding = 50;
8
+ const mazeWidth = gridSize * cellSize;
9
+ const mazeHeight = gridSize * cellSize;
10
+ const mazeX = (width - mazeWidth) / 2;
11
+ // Key positions
12
+ const startCol = 0;
13
+ const startRow = 0;
14
+ const destCol = 9;
15
+ const destRow = 9;
16
+ // State
17
+ const [revealedCells, setRevealedCells] = useState([]);
18
+ const [directionHint, setDirectionHint] = useState("");
19
+ const [timeCost, setTimeCost] = useState(0);
20
+ const [clickCost, setClickCost] = useState(0);
21
+ const [blockageFound, setBlockageFound] = useState(false);
22
+ const [startTime, setStartTime] = useState(null);
23
+ const [started, setStarted] = useState(false);
24
+ const [currentSeed, setCurrentSeed] = useState(() => Math.floor(Math.random() * 10000));
25
+ const [blockageInjected, setBlockageInjected] = useState(false);
26
+ const [deployed, setDeployed] = useState(false);
27
+ const [mode, setMode] = useState('initial');
28
+ // Total incident cost
29
+ const incidentCost = timeCost + clickCost;
30
+ // Update currentSeed when mazeSeed prop changes
31
+ useEffect(() => {
32
+ setCurrentSeed(mazeSeed);
33
+ }, [mazeSeed]);
34
+ // Increment time cost
35
+ useEffect(() => {
36
+ if (blockageFound || !startTime || !started)
37
+ return;
38
+ const interval = setInterval(() => {
39
+ setTimeCost(prev => prev + 1);
40
+ }, 10);
41
+ return () => clearInterval(interval);
42
+ }, [blockageFound, startTime, started]);
43
+ // Generate maze
44
+ const { horizontalWalls, verticalWalls, blockageWall, actualBlockageCol, actualBlockageRow } = useMemo(() => {
45
+ let seed = currentSeed;
46
+ const seededRandom = () => {
47
+ seed = (seed * 9301 + 49297) % 233280;
48
+ return seed / 233280;
49
+ };
50
+ const originalRandom = Math.random;
51
+ Math.random = seededRandom;
52
+ const generator = new MazeGenerator(gridSize, gridSize);
53
+ generator.generate(startRow, startCol);
54
+ let blockCell = { row: 5, col: 5 };
55
+ let direction = 'east';
56
+ let blockageWall = null;
57
+ if (blockageInjected) {
58
+ const path = generator.findPath(startRow, startCol, destRow, destCol);
59
+ if (path.length > 2) {
60
+ const middleStart = Math.floor(path.length * 0.3);
61
+ const middleEnd = Math.floor(path.length * 0.7);
62
+ const blockIndex = Math.floor(seededRandom() * (middleEnd - middleStart)) + middleStart;
63
+ blockCell = path[blockIndex];
64
+ if (blockIndex < path.length - 1) {
65
+ const nextCell = path[blockIndex + 1];
66
+ const rowDiff = nextCell.row - blockCell.row;
67
+ const colDiff = nextCell.col - blockCell.col;
68
+ if (rowDiff === 1)
69
+ direction = 'south';
70
+ else if (rowDiff === -1)
71
+ direction = 'north';
72
+ else if (colDiff === 1)
73
+ direction = 'east';
74
+ else if (colDiff === -1)
75
+ direction = 'west';
76
+ }
77
+ }
78
+ generator.addBlockage(blockCell.row, blockCell.col, direction);
79
+ }
80
+ const walls = generator.getWalls();
81
+ if (blockageInjected) {
82
+ if (direction === 'east' || direction === 'west') {
83
+ const targetCol = direction === 'east' ? blockCell.col + 1 : blockCell.col;
84
+ const targetRow = blockCell.row;
85
+ const wallSegment = walls.vertical.find(wall => {
86
+ const [col, row1, , row2] = wall;
87
+ return col === targetCol && row1 <= targetRow && row2 > targetRow;
88
+ });
89
+ if (wallSegment) {
90
+ const [col, row1, , row2] = wallSegment;
91
+ blockageWall = { type: 'vertical', col, row1, row2 };
92
+ }
93
+ }
94
+ else {
95
+ const targetRow = direction === 'south' ? blockCell.row + 1 : blockCell.row;
96
+ const targetCol = blockCell.col;
97
+ const wallSegment = walls.horizontal.find(wall => {
98
+ const [col1, row, col2] = wall;
99
+ return row === targetRow && col1 <= targetCol && col2 > targetCol;
100
+ });
101
+ if (wallSegment) {
102
+ const [col1, row, col2] = wallSegment;
103
+ blockageWall = { type: 'horizontal', row, col1, col2 };
104
+ }
105
+ }
106
+ }
107
+ Math.random = originalRandom;
108
+ return {
109
+ horizontalWalls: walls.horizontal,
110
+ verticalWalls: walls.vertical,
111
+ blockageWall,
112
+ actualBlockageCol: blockCell.col,
113
+ actualBlockageRow: blockCell.row,
114
+ };
115
+ }, [currentSeed, blockageInjected]);
116
+ // Handlers
117
+ const handleModeSelect = (selectedMode) => {
118
+ setMode(selectedMode);
119
+ };
120
+ const handleDeploy = () => {
121
+ setDeployed(true);
122
+ setTimeout(() => {
123
+ setBlockageInjected(true);
124
+ setStarted(true);
125
+ setStartTime(Date.now());
126
+ }, 3000);
127
+ };
128
+ const handleTryPrincipal = () => {
129
+ setMode('principal');
130
+ setRevealedCells([]);
131
+ setDirectionHint("");
132
+ setBlockageFound(false);
133
+ setTimeCost(0);
134
+ setClickCost(0);
135
+ setStartTime(null);
136
+ setStarted(false);
137
+ setDeployed(false);
138
+ setBlockageInjected(false); // Principal mode still needs to deploy first
139
+ };
140
+ const handleTryAgain = () => {
141
+ setRevealedCells([]);
142
+ setDirectionHint("");
143
+ setBlockageFound(false);
144
+ setTimeCost(0);
145
+ setClickCost(0);
146
+ setStartTime(null);
147
+ setStarted(false);
148
+ setBlockageInjected(false);
149
+ setDeployed(false);
150
+ setMode('initial');
151
+ setCurrentSeed(Math.floor(Math.random() * 10000));
152
+ };
153
+ const handleCellClick = (col, row) => {
154
+ if (blockageFound || !started)
155
+ return;
156
+ // In principal mode, only allow clicking the blockage cell
157
+ if (mode === 'principal') {
158
+ const isBlockageCell = col === actualBlockageCol && row === actualBlockageRow;
159
+ if (isBlockageCell) {
160
+ setDirectionHint("🎯 Blockage Found!");
161
+ setBlockageFound(true);
162
+ }
163
+ return;
164
+ }
165
+ const alreadyRevealed = revealedCells.some(cell => cell.col === col && cell.row === row);
166
+ if (alreadyRevealed)
167
+ return;
168
+ setClickCost(prev => prev + 500);
169
+ setRevealedCells([...revealedCells, { col, row }]);
170
+ const isBlockageCell = col === actualBlockageCol && row === actualBlockageRow;
171
+ if (isBlockageCell) {
172
+ setDirectionHint("🎯 Blockage Found!");
173
+ setBlockageFound(true);
174
+ const cellsToReveal = [...revealedCells];
175
+ for (let r = 0; r < gridSize; r++) {
176
+ for (let c = 0; c < gridSize; c++) {
177
+ const distance = Math.abs(actualBlockageCol - c) + Math.abs(actualBlockageRow - r);
178
+ if (distance <= 3) {
179
+ const alreadyInList = cellsToReveal.some(cell => cell.col === c && cell.row === r);
180
+ if (!alreadyInList) {
181
+ cellsToReveal.push({ col: c, row: r });
182
+ }
183
+ }
184
+ }
185
+ }
186
+ setRevealedCells(cellsToReveal);
187
+ }
188
+ else {
189
+ const colDiff = actualBlockageCol - col;
190
+ const rowDiff = actualBlockageRow - row;
191
+ let direction = "";
192
+ if (Math.abs(rowDiff) > 1) {
193
+ direction += rowDiff > 0 ? "↓ " : "↑ ";
194
+ }
195
+ if (Math.abs(colDiff) > 1) {
196
+ direction += colDiff > 0 ? "→" : "←";
197
+ }
198
+ const distance = Math.abs(colDiff) + Math.abs(rowDiff);
199
+ let proximity = "";
200
+ if (distance <= 2)
201
+ proximity = "Very close!";
202
+ else if (distance <= 4)
203
+ proximity = "Getting warmer...";
204
+ else if (distance <= 6)
205
+ proximity = "Still far...";
206
+ else
207
+ proximity = "Cold...";
208
+ setDirectionHint(`${direction} ${proximity}`);
209
+ }
210
+ };
211
+ // Render maze
212
+ const renderMaze = (showBlockage, opacity = 1) => {
213
+ const elements = [];
214
+ elements.push(React.createElement("rect", { key: "background", x: mazeX, y: padding, width: mazeWidth, height: mazeHeight, fill: "none", stroke: mazeColor, strokeWidth: "3", opacity: 0.3 * opacity }));
215
+ const isBlockageWall = (type, wall) => {
216
+ if (!showBlockage || !blockageWall)
217
+ return false;
218
+ if (type === 'vertical') {
219
+ const [x, y1, , y2] = wall;
220
+ return (blockageWall.type === 'vertical' &&
221
+ x === blockageWall.col &&
222
+ y1 === blockageWall.row1 &&
223
+ y2 === blockageWall.row2);
224
+ }
225
+ else if (type === 'horizontal') {
226
+ const [x1, y, x2] = wall;
227
+ return (blockageWall.type === 'horizontal' &&
228
+ y === blockageWall.row &&
229
+ x1 === blockageWall.col1 &&
230
+ x2 === blockageWall.col2);
231
+ }
232
+ return false;
233
+ };
234
+ horizontalWalls.forEach((wall, idx) => {
235
+ const [x1, y, x2] = wall;
236
+ const isBlockage = isBlockageWall('horizontal', wall);
237
+ elements.push(React.createElement("line", { key: `h-wall-${idx}`, x1: mazeX + x1 * cellSize, y1: padding + y * cellSize, x2: mazeX + x2 * cellSize, y2: padding + y * cellSize, stroke: isBlockage ? errorColor : mazeColor, strokeWidth: isBlockage ? 4 : 2.5, strokeLinecap: "round", opacity: opacity }, isBlockage && showBlockage && (React.createElement("animate", { attributeName: "stroke-width", values: "4;6;4", dur: "1.5s", repeatCount: "indefinite" }))));
238
+ });
239
+ verticalWalls.forEach((wall, idx) => {
240
+ const [x, y1, , y2] = wall;
241
+ const isBlockage = isBlockageWall('vertical', wall);
242
+ elements.push(React.createElement("line", { key: `v-wall-${idx}`, x1: mazeX + x * cellSize, y1: padding + y1 * cellSize, x2: mazeX + x * cellSize, y2: padding + y2 * cellSize, stroke: isBlockage ? errorColor : mazeColor, strokeWidth: isBlockage ? 4 : 2.5, strokeLinecap: "round", opacity: opacity }, isBlockage && showBlockage && (React.createElement("animate", { attributeName: "stroke-width", values: "4;6;4", dur: "1.5s", repeatCount: "indefinite" }))));
243
+ });
244
+ for (let row = 0; row <= gridSize; row++) {
245
+ elements.push(React.createElement("line", { key: `grid-h-${row}`, x1: mazeX, y1: padding + row * cellSize, x2: mazeX + mazeWidth, y2: padding + row * cellSize, stroke: mazeColor, strokeWidth: "0.5", opacity: 0.15 * opacity }));
246
+ }
247
+ for (let col = 0; col <= gridSize; col++) {
248
+ elements.push(React.createElement("line", { key: `grid-v-${col}`, x1: mazeX + col * cellSize, y1: padding, x2: mazeX + col * cellSize, y2: padding + mazeHeight, stroke: mazeColor, strokeWidth: "0.5", opacity: 0.15 * opacity }));
249
+ }
250
+ return elements;
251
+ };
252
+ const getTitle = () => {
253
+ if (mode === 'principal')
254
+ return "With Principal";
255
+ if (mode === 'agentic')
256
+ return "With Agentic Coding";
257
+ if (mode === 'no-agentic')
258
+ return "Without Agentic Coding";
259
+ return "Choose Your Approach";
260
+ };
261
+ const getSubtitle = () => {
262
+ if (mode === 'principal')
263
+ return "Full visibility - See everything";
264
+ if (started)
265
+ return "Find the blockage";
266
+ if (deployed)
267
+ return "Running smoothly...";
268
+ return "How will you handle production?";
269
+ };
270
+ const showCover = mode === 'agentic' || (deployed && mode === 'no-agentic');
271
+ const coverOpacity = 1; // Always full opacity for the cover
272
+ const mazeOpacity = 1; // Maze always at full opacity, cover handles visibility
273
+ return (React.createElement("svg", { width: width, height: height, xmlns: "http://www.w3.org/2000/svg" },
274
+ React.createElement("text", { x: width / 2, y: 25, textAnchor: "middle", fill: mazeColor, fontSize: "16", fontWeight: "bold" }, getTitle()),
275
+ React.createElement("text", { x: width / 2, y: 40, textAnchor: "middle", fill: mazeColor, fontSize: "11", opacity: "0.6" }, getSubtitle()),
276
+ mode !== 'initial' && (React.createElement(React.Fragment, null,
277
+ React.createElement("g", null, renderMaze(mode === 'principal' || blockageFound, mazeOpacity)),
278
+ React.createElement("circle", { cx: mazeX + (startCol + 0.5) * cellSize, cy: padding + (startRow + 0.5) * cellSize, r: "5", fill: searchColor }),
279
+ React.createElement("text", { x: mazeX - 5, y: padding - 5, textAnchor: "end", fontSize: "10", fill: searchColor, fontWeight: "bold" }, "START"),
280
+ React.createElement("g", null,
281
+ React.createElement("circle", { cx: mazeX + (destCol + 0.5) * cellSize, cy: padding + (destRow + 0.5) * cellSize, r: "8", fill: "none", stroke: mazeColor, strokeWidth: "1.5", opacity: "0.5" }),
282
+ React.createElement("circle", { cx: mazeX + (destCol + 0.5) * cellSize, cy: padding + (destRow + 0.5) * cellSize, r: "5", fill: "none", stroke: mazeColor, strokeWidth: "1.5", opacity: "0.6" }),
283
+ React.createElement("circle", { cx: mazeX + (destCol + 0.5) * cellSize, cy: padding + (destRow + 0.5) * cellSize, r: "2", fill: mazeColor, opacity: "0.7" })),
284
+ React.createElement("text", { x: mazeX + mazeWidth + 5, y: padding + mazeHeight + 15, textAnchor: "start", fontSize: "9", fill: mazeColor, fontWeight: "bold" }, "DEST"))),
285
+ showCover && (React.createElement(React.Fragment, null,
286
+ React.createElement("defs", null,
287
+ React.createElement("mask", { id: "mazeCoverMask" },
288
+ React.createElement("rect", { x: mazeX, y: padding, width: mazeWidth, height: mazeHeight, fill: "white" }),
289
+ revealedCells.map((cell, idx) => (React.createElement("rect", { key: idx, x: mazeX + cell.col * cellSize, y: padding + cell.row * cellSize, width: cellSize, height: cellSize, fill: "black" }))))),
290
+ React.createElement("g", null,
291
+ React.createElement("rect", { x: mazeX, y: padding, width: mazeWidth, height: mazeHeight, fill: "#2a2a2a", opacity: coverOpacity, mask: "url(#mazeCoverMask)" }),
292
+ React.createElement("rect", { x: mazeX, y: padding, width: mazeWidth, height: mazeHeight, fill: "none", stroke: mazeColor, strokeWidth: "3", opacity: "0.4" }),
293
+ started && revealedCells.length === 0 && (React.createElement("g", null,
294
+ React.createElement("rect", { x: mazeX + mazeWidth / 2 - 130, y: padding + mazeHeight / 2 - 40, width: 260, height: 80, fill: "#000000", opacity: "0.7", rx: "8", pointerEvents: "none" }),
295
+ React.createElement("text", { x: mazeX + mazeWidth / 2, y: padding + mazeHeight / 2 - 15, textAnchor: "middle", fontSize: "18", fill: errorColor, fontWeight: "bold", pointerEvents: "none" }, "\uD83D\uDEA8 INCIDENT ALERT"),
296
+ React.createElement("text", { x: mazeX + mazeWidth / 2, y: padding + mazeHeight / 2 + 10, textAnchor: "middle", fontSize: "13", fill: "#ffffff", fontWeight: "normal", pointerEvents: "none" }, "It's 3:00 AM - Find the blockage!"))),
297
+ started && revealedCells.length > 0 && directionHint && (React.createElement("g", null,
298
+ React.createElement("rect", { x: mazeX + mazeWidth / 2 - 100, y: padding + mazeHeight / 2 - 25, width: 200, height: 40, fill: "#000000", opacity: "0.7", rx: "6", pointerEvents: "none" }),
299
+ React.createElement("text", { x: mazeX + mazeWidth / 2, y: padding + mazeHeight / 2, textAnchor: "middle", fontSize: "16", fill: "#ffffff", fontWeight: "bold", pointerEvents: "none" }, directionHint)))))),
300
+ started && (React.createElement("g", null, Array.from({ length: gridSize }).map((_, row) => Array.from({ length: gridSize }).map((_, col) => (React.createElement("rect", { key: `cell-${row}-${col}`, x: mazeX + col * cellSize, y: padding + row * cellSize, width: cellSize, height: cellSize, fill: "transparent", stroke: "none", style: { cursor: 'pointer' }, onClick: () => handleCellClick(col, row), onMouseEnter: (e) => {
301
+ e.currentTarget.setAttribute('fill', searchColor);
302
+ e.currentTarget.setAttribute('opacity', '0.1');
303
+ }, onMouseLeave: (e) => {
304
+ e.currentTarget.setAttribute('fill', 'transparent');
305
+ e.currentTarget.setAttribute('opacity', '1');
306
+ } })))))),
307
+ mode === 'initial' && (React.createElement("g", null,
308
+ React.createElement("g", { style: { cursor: 'pointer' }, onClick: () => handleModeSelect('no-agentic') },
309
+ React.createElement("rect", { x: mazeX + mazeWidth / 2 - 130, y: padding + mazeHeight + 25, width: 120, height: 40, fill: searchColor, rx: "6" }),
310
+ React.createElement("text", { x: mazeX + mazeWidth / 2 - 70, y: padding + mazeHeight + 52, textAnchor: "middle", fontSize: "12", fill: "#ffffff", fontWeight: "bold", pointerEvents: "none" }, "No Agentic")),
311
+ React.createElement("g", { style: { cursor: 'pointer' }, onClick: () => handleModeSelect('agentic') },
312
+ React.createElement("rect", { x: mazeX + mazeWidth / 2 + 10, y: padding + mazeHeight + 25, width: 120, height: 40, fill: mazeColor, rx: "6" }),
313
+ React.createElement("text", { x: mazeX + mazeWidth / 2 + 70, y: padding + mazeHeight + 52, textAnchor: "middle", fontSize: "12", fill: "#ffffff", fontWeight: "bold", pointerEvents: "none" }, "Agentic Coding")))),
314
+ (mode === 'no-agentic' || mode === 'agentic' || mode === 'principal') && !deployed && (React.createElement("g", null,
315
+ React.createElement("g", { style: { cursor: 'pointer' }, onClick: handleDeploy },
316
+ React.createElement("rect", { x: mazeX + mazeWidth / 2 - 60, y: padding + mazeHeight + 25, width: 120, height: 40, fill: searchColor, rx: "6" }),
317
+ React.createElement("text", { x: mazeX + mazeWidth / 2, y: padding + mazeHeight + 52, textAnchor: "middle", fontSize: "16", fill: "#ffffff", fontWeight: "bold", pointerEvents: "none" }, "DEPLOY")))),
318
+ deployed && !started && (React.createElement("g", null,
319
+ React.createElement("rect", { x: mazeX, y: padding + mazeHeight + 20, width: mazeWidth, height: 35, fill: solutionColor, opacity: "0.9", rx: "4" }),
320
+ React.createElement("text", { x: mazeX + mazeWidth / 2, y: padding + mazeHeight + 35, textAnchor: "middle", fontSize: "11", fill: "#ffffff", fontWeight: "normal" }, "\u2713 Deployment Successful"),
321
+ React.createElement("text", { x: mazeX + mazeWidth / 2, y: padding + mazeHeight + 50, textAnchor: "middle", fontSize: "14", fill: "#ffffff", fontWeight: "bold" }, "All systems operational"))),
322
+ started && (React.createElement("g", null,
323
+ React.createElement("rect", { x: mazeX, y: padding + mazeHeight + 20, width: mazeWidth, height: 35, fill: blockageFound ? solutionColor : errorColor, opacity: "0.9", rx: "4" }),
324
+ React.createElement("text", { x: mazeX + mazeWidth / 2, y: padding + mazeHeight + 35, textAnchor: "middle", fontSize: "11", fill: "#ffffff", fontWeight: "normal" }, blockageFound ? "Incident Resolved!" : "Incident Cost"),
325
+ React.createElement("text", { x: mazeX + mazeWidth / 2, y: padding + mazeHeight + 50, textAnchor: "middle", fontSize: "18", fill: "#ffffff", fontWeight: "bold" },
326
+ "$",
327
+ incidentCost.toLocaleString()))),
328
+ started && blockageFound && mode !== 'principal' && (React.createElement("g", null,
329
+ React.createElement("g", { style: { cursor: 'pointer' }, onClick: handleTryAgain },
330
+ React.createElement("rect", { x: mazeX + mazeWidth / 2 - 130, y: padding + mazeHeight + 65, width: 120, height: 25, fill: mazeColor, opacity: "0.2", rx: "4" }),
331
+ React.createElement("text", { x: mazeX + mazeWidth / 2 - 70, y: padding + mazeHeight + 82, textAnchor: "middle", fontSize: "10", fill: mazeColor, fontWeight: "bold", pointerEvents: "none" }, "Try Again")),
332
+ React.createElement("g", { style: { cursor: 'pointer' }, onClick: handleTryPrincipal },
333
+ React.createElement("rect", { x: mazeX + mazeWidth / 2 + 10, y: padding + mazeHeight + 65, width: 120, height: 25, fill: solutionColor, opacity: "0.8", rx: "4" }),
334
+ React.createElement("text", { x: mazeX + mazeWidth / 2 + 70, y: padding + mazeHeight + 82, textAnchor: "middle", fontSize: "10", fill: "#ffffff", fontWeight: "bold", pointerEvents: "none" }, "Try with Principal")))),
335
+ mode === 'principal' && blockageFound && (React.createElement("g", null,
336
+ React.createElement("g", { style: { cursor: 'pointer' }, onClick: handleTryAgain },
337
+ React.createElement("rect", { x: mazeX + mazeWidth / 2 - 60, y: padding + mazeHeight + 65, width: 120, height: 25, fill: mazeColor, opacity: "0.3", rx: "4" }),
338
+ React.createElement("text", { x: mazeX + mazeWidth / 2, y: padding + mazeHeight + 82, textAnchor: "middle", fontSize: "10", fill: mazeColor, fontWeight: "bold", pointerEvents: "none" }, "Try Again"))))));
339
+ };