mindexec-ai 0.2.385
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +354 -0
- package/codex-runtime.js +1339 -0
- package/launch-bridge.cjs +236 -0
- package/package.json +77 -0
- package/port-guard.cjs +232 -0
- package/remote-fast/osx-arm64/mindexec-remote-fast +0 -0
- package/remote-fast/osx-arm64/mindexec-remote-fast.deps.json +24 -0
- package/remote-fast/osx-arm64/mindexec-remote-fast.dll +0 -0
- package/remote-fast/osx-arm64/mindexec-remote-fast.runtimeconfig.json +13 -0
- package/remote-fast/osx-x64/mindexec-remote-fast +0 -0
- package/remote-fast/osx-x64/mindexec-remote-fast.deps.json +24 -0
- package/remote-fast/osx-x64/mindexec-remote-fast.dll +0 -0
- package/remote-fast/osx-x64/mindexec-remote-fast.runtimeconfig.json +13 -0
- package/remote-fast/win-x64/mindexec-remote-fast.deps.json +24 -0
- package/remote-fast/win-x64/mindexec-remote-fast.dll +0 -0
- package/remote-fast/win-x64/mindexec-remote-fast.exe +0 -0
- package/remote-fast/win-x64/mindexec-remote-fast.runtimeconfig.json +20 -0
- package/remote-hub.js +3106 -0
- package/scripts/auth-session-smoke.mjs +262 -0
- package/scripts/remote-agent-managed-smoke.mjs +291 -0
- package/scripts/remote-agent-package-smoke.mjs +64 -0
- package/scripts/remote-agent-ws-smoke.mjs +202 -0
- package/scripts/remote-fast-live-rate-smoke.mjs +355 -0
- package/scripts/remote-fast-mdm-browser-smoke.mjs +476 -0
- package/scripts/remote-fleet-render-smoke.mjs +1491 -0
- package/scripts/remote-frame-ws-smoke.mjs +234 -0
- package/scripts/remote-http-smoke.mjs +592 -0
- package/scripts/remote-hub-identity-smoke.mjs +146 -0
- package/scripts/remote-hub-scale-smoke.mjs +124 -0
- package/scripts/remote-hub-smoke.mjs +631 -0
- package/scripts/remote-input-ws-smoke.mjs +263 -0
- package/scripts/remote-registry-follower-smoke.mjs +752 -0
- package/scripts/setup-tree-sitter-grammars.mjs +80 -0
- package/server.js +15709 -0
- package/start-bridge.bat +32 -0
- package/start-bridge.sh +81 -0
- package/tree-sitter-grammars/README.md +18 -0
- package/tree-sitter-grammars/tree-sitter-c_sharp.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-go.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-java.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-javascript.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-python.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-rust.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-tsx.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-typescript.wasm +0 -0
- package/wwwroot/_headers +73 -0
- package/wwwroot/_redirects +1 -0
- package/wwwroot/appsettings.json +83 -0
- package/wwwroot/assets/AdminDashboardPage-B2vz2Px9.css +1 -0
- package/wwwroot/assets/AdminDashboardPage-DnuCHywn.js +1 -0
- package/wwwroot/assets/AppSidebar-DU2OgSiv.js +2 -0
- package/wwwroot/assets/AuthPages-BrH6kRcv.css +1 -0
- package/wwwroot/assets/AuthPages-Dgezl7Vj.js +1 -0
- package/wwwroot/assets/CodePage-7kgZlB3O.js +87 -0
- package/wwwroot/assets/CodePage-Bncc352E.css +1 -0
- package/wwwroot/assets/CompanyCorePage-ChBnq1ve.css +1 -0
- package/wwwroot/assets/CompanyCorePage-CzIZIIU_.js +13 -0
- package/wwwroot/assets/ExecutionModePage-B-etp_mc.js +18 -0
- package/wwwroot/assets/ExecutionModePage-TLuld9l3.css +1 -0
- package/wwwroot/assets/LaunchLeadCapture-Bx9LM0IX.js +1 -0
- package/wwwroot/assets/LaunchLeadCapture-CiRI1shz.css +1 -0
- package/wwwroot/assets/MarketingHome-BsyerRpe.js +1 -0
- package/wwwroot/assets/MarketingHome-DPzaYzA_.css +1 -0
- package/wwwroot/assets/MindCanvas-DtqOZnoW.css +1 -0
- package/wwwroot/assets/MindCanvas-zEDXzaxW.js +49 -0
- package/wwwroot/assets/PlanMasterPage-CJ36rep-.css +1 -0
- package/wwwroot/assets/PlanMasterPage-NZ_mPvaE.js +4 -0
- package/wwwroot/assets/PricingPage-Cg_0i_ZR.css +1 -0
- package/wwwroot/assets/PricingPage-Ylrn8l2g.js +1 -0
- package/wwwroot/assets/ToolPages-3M2KqA9k.js +28 -0
- package/wwwroot/assets/ToolPages-DIB187pZ.css +1 -0
- package/wwwroot/assets/YouTubeSearchPage-COv1oAA7.js +4 -0
- package/wwwroot/assets/YouTubeSearchPage-IPPa_BIH.css +1 -0
- package/wwwroot/assets/app-runtime-xD2Z3NdN.js +1 -0
- package/wwwroot/assets/canvas-runtime-BbicBcOj.js +44 -0
- package/wwwroot/assets/code-agent-runtime-B5PPZd1t.js +74 -0
- package/wwwroot/assets/executionModeSettings-NJqurj-o.js +1 -0
- package/wwwroot/assets/index-CQMKCp-t.js +2 -0
- package/wwwroot/assets/index-yNpEK-gp.css +1 -0
- package/wwwroot/assets/marketingTools-DN_rnHeB.js +4 -0
- package/wwwroot/assets/mindCanvasSearchWorker-BzPMsHOB.js +1 -0
- package/wwwroot/assets/mindexecution-mindcanvas.png +0 -0
- package/wwwroot/assets/mindexecution-prod-home-current.png +0 -0
- package/wwwroot/assets/mindexecution-prod-pricing-current.png +0 -0
- package/wwwroot/assets/pricingCheckoutShell-O-DnwmbU.js +1 -0
- package/wwwroot/assets/productionAdapterConfig-C5jfk6oG.js +1 -0
- package/wwwroot/assets/runtimeSettingsPersistenceProjection-BoNWmYjU.js +1 -0
- package/wwwroot/assets/storage-TM3YrWaj.js +1 -0
- package/wwwroot/assets/supabaseAuthAdapter-DA43DeSY.js +44 -0
- package/wwwroot/assets/toolHandoff-D5e5f7t5.js +4 -0
- package/wwwroot/assets/vendor-icons-DE3gIReG.js +681 -0
- package/wwwroot/assets/vendor-msgpack-BE8aAsr3.js +1 -0
- package/wwwroot/assets/vendor-react-BXzpOyCS.js +40 -0
- package/wwwroot/favicon.svg +7 -0
- package/wwwroot/index.html +22 -0
- package/wwwroot/manifest.webmanifest +19 -0
- package/wwwroot/robots.txt +4 -0
- package/wwwroot/service-worker.js +7 -0
- package/wwwroot/sitemap.xml +39 -0
package/start-bridge.bat
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
@echo off
|
|
2
|
+
setlocal EnableExtensions EnableDelayedExpansion
|
|
3
|
+
|
|
4
|
+
echo ================================
|
|
5
|
+
echo MindExec Local Bridge
|
|
6
|
+
echo ================================
|
|
7
|
+
echo.
|
|
8
|
+
|
|
9
|
+
cd /d "%~dp0"
|
|
10
|
+
|
|
11
|
+
if "%WORKSPACE_PATH%"=="" (
|
|
12
|
+
for %%I in ("%~dp0..") do set "WORKSPACE_PATH=%%~fI"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
if "%BRIDGE_PORT%"=="" (
|
|
16
|
+
set "BRIDGE_PORT=5147"
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
if not exist "node_modules" (
|
|
20
|
+
echo Installing dependencies...
|
|
21
|
+
npm install
|
|
22
|
+
echo.
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
echo Starting bridge server...
|
|
26
|
+
echo Workspace: %WORKSPACE_PATH%
|
|
27
|
+
echo Port: %BRIDGE_PORT%
|
|
28
|
+
echo.
|
|
29
|
+
node launch-bridge.cjs
|
|
30
|
+
|
|
31
|
+
pause
|
|
32
|
+
goto :eof
|
package/start-bridge.sh
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
|
|
5
|
+
cd "$SCRIPT_DIR"
|
|
6
|
+
|
|
7
|
+
echo "================================"
|
|
8
|
+
echo "MindExec Local Bridge"
|
|
9
|
+
echo "================================"
|
|
10
|
+
echo
|
|
11
|
+
|
|
12
|
+
if ! command -v node >/dev/null 2>&1; then
|
|
13
|
+
echo "Node.js is required. Install Node.js 20+ and try again."
|
|
14
|
+
exit 1
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
if ! command -v npm >/dev/null 2>&1; then
|
|
18
|
+
echo "npm is required. Install Node.js/npm and try again."
|
|
19
|
+
exit 1
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
normalize_dir_path() {
|
|
23
|
+
local target="${1:-}"
|
|
24
|
+
if [[ -n "$target" && -d "$target" ]]; then
|
|
25
|
+
(cd "$target" && pwd -P)
|
|
26
|
+
else
|
|
27
|
+
printf '%s' "$target"
|
|
28
|
+
fi
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
WORKSPACE_PATH="${WORKSPACE_PATH:-$(cd "$SCRIPT_DIR/.." && pwd -P)}"
|
|
32
|
+
WORKSPACE_PATH="$(normalize_dir_path "$WORKSPACE_PATH")"
|
|
33
|
+
BRIDGE_PORT="${BRIDGE_PORT:-5147}"
|
|
34
|
+
RUNTIME_MARKER_FILE=".bridge-runtime"
|
|
35
|
+
CURRENT_RUNTIME="$(node -p "process.platform + '-' + process.arch")"
|
|
36
|
+
|
|
37
|
+
ensure_dependencies() {
|
|
38
|
+
local needs_install="false"
|
|
39
|
+
local reason=""
|
|
40
|
+
|
|
41
|
+
if [[ ! -d "node_modules" ]]; then
|
|
42
|
+
needs_install="true"
|
|
43
|
+
reason="node_modules not found"
|
|
44
|
+
elif [[ ! -f "$RUNTIME_MARKER_FILE" ]]; then
|
|
45
|
+
needs_install="true"
|
|
46
|
+
reason="runtime marker missing"
|
|
47
|
+
else
|
|
48
|
+
local recorded_runtime
|
|
49
|
+
recorded_runtime="$(tr -d '\r\n' < "$RUNTIME_MARKER_FILE" 2>/dev/null || true)"
|
|
50
|
+
if [[ "$recorded_runtime" != "$CURRENT_RUNTIME" ]]; then
|
|
51
|
+
needs_install="true"
|
|
52
|
+
reason="runtime changed (${recorded_runtime:-unknown} -> $CURRENT_RUNTIME)"
|
|
53
|
+
fi
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
if [[ "$needs_install" != "true" ]]; then
|
|
57
|
+
return
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
echo "Installing bridge dependencies..."
|
|
61
|
+
if [[ -n "$reason" ]]; then
|
|
62
|
+
echo "Reason: $reason"
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
rm -rf node_modules
|
|
66
|
+
npm install
|
|
67
|
+
printf '%s\n' "$CURRENT_RUNTIME" > "$RUNTIME_MARKER_FILE"
|
|
68
|
+
echo
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
ensure_dependencies
|
|
72
|
+
|
|
73
|
+
echo "Starting bridge server..."
|
|
74
|
+
echo "Workspace: $WORKSPACE_PATH"
|
|
75
|
+
echo "Port: $BRIDGE_PORT"
|
|
76
|
+
echo
|
|
77
|
+
|
|
78
|
+
export WORKSPACE_PATH
|
|
79
|
+
export BRIDGE_PORT
|
|
80
|
+
|
|
81
|
+
node launch-bridge.cjs
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Tree-sitter WASM Grammars
|
|
2
|
+
|
|
3
|
+
Put language grammar `.wasm` files in this folder.
|
|
4
|
+
|
|
5
|
+
Expected filenames used by `server.js`:
|
|
6
|
+
|
|
7
|
+
- `tree-sitter-javascript.wasm`
|
|
8
|
+
- `tree-sitter-typescript.wasm`
|
|
9
|
+
- `tree-sitter-tsx.wasm`
|
|
10
|
+
- `tree-sitter-c_sharp.wasm`
|
|
11
|
+
- `tree-sitter-python.wasm`
|
|
12
|
+
- `tree-sitter-java.wasm`
|
|
13
|
+
- `tree-sitter-go.wasm`
|
|
14
|
+
- `tree-sitter-rust.wasm`
|
|
15
|
+
|
|
16
|
+
Run `npm run setup:grammars` in `LocalBridge/` to copy these files automatically from `tree-sitter-wasms`.
|
|
17
|
+
|
|
18
|
+
If a grammar is missing, the bridge falls back to lightweight regex parsing for that language.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/wwwroot/_headers
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/
|
|
2
|
+
Cache-Control: no-store
|
|
3
|
+
|
|
4
|
+
/index.html
|
|
5
|
+
Cache-Control: no-store
|
|
6
|
+
|
|
7
|
+
/mindcanvas
|
|
8
|
+
Cache-Control: no-store
|
|
9
|
+
|
|
10
|
+
/mindmap
|
|
11
|
+
Cache-Control: no-store
|
|
12
|
+
|
|
13
|
+
/planmaster
|
|
14
|
+
Cache-Control: no-store
|
|
15
|
+
|
|
16
|
+
/planagent
|
|
17
|
+
Cache-Control: no-store
|
|
18
|
+
|
|
19
|
+
/pricing
|
|
20
|
+
Cache-Control: no-store
|
|
21
|
+
|
|
22
|
+
/login
|
|
23
|
+
Cache-Control: no-store
|
|
24
|
+
|
|
25
|
+
/forgot-password
|
|
26
|
+
Cache-Control: no-store
|
|
27
|
+
|
|
28
|
+
/reset-password
|
|
29
|
+
Cache-Control: no-store
|
|
30
|
+
|
|
31
|
+
/tools
|
|
32
|
+
Cache-Control: no-store
|
|
33
|
+
|
|
34
|
+
/youtube
|
|
35
|
+
Cache-Control: no-store
|
|
36
|
+
|
|
37
|
+
/code
|
|
38
|
+
Cache-Control: no-store
|
|
39
|
+
|
|
40
|
+
/agent
|
|
41
|
+
Cache-Control: no-store
|
|
42
|
+
|
|
43
|
+
/execution-mode
|
|
44
|
+
Cache-Control: no-store
|
|
45
|
+
|
|
46
|
+
/not-found
|
|
47
|
+
Cache-Control: no-store
|
|
48
|
+
|
|
49
|
+
/company-core
|
|
50
|
+
Cache-Control: no-store
|
|
51
|
+
|
|
52
|
+
/admin/dashboard
|
|
53
|
+
Cache-Control: no-store
|
|
54
|
+
|
|
55
|
+
/manifest.webmanifest
|
|
56
|
+
Cache-Control: public, max-age=3600
|
|
57
|
+
|
|
58
|
+
/robots.txt
|
|
59
|
+
Cache-Control: public, max-age=3600
|
|
60
|
+
|
|
61
|
+
/sitemap.xml
|
|
62
|
+
Cache-Control: public, max-age=3600
|
|
63
|
+
|
|
64
|
+
/service-worker.js
|
|
65
|
+
Cache-Control: no-store
|
|
66
|
+
|
|
67
|
+
/assets/*
|
|
68
|
+
Cache-Control: public, max-age=31536000, immutable
|
|
69
|
+
|
|
70
|
+
/*
|
|
71
|
+
X-Content-Type-Options: nosniff
|
|
72
|
+
Referrer-Policy: strict-origin-when-cross-origin
|
|
73
|
+
Permissions-Policy: local-network-access=(self), local-network=(self), loopback-network=(self)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* /index.html 200
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"OpenRouter": {
|
|
3
|
+
"ApiKey": ""
|
|
4
|
+
},
|
|
5
|
+
"Execution": {
|
|
6
|
+
"Mode": "Concept",
|
|
7
|
+
"Model": "openai/gpt-4o-mini"
|
|
8
|
+
},
|
|
9
|
+
"Supabase": {
|
|
10
|
+
"Url": "https://otbyfkjxrkngvjziawki.supabase.co",
|
|
11
|
+
"Key": "sb_publishable_NpUs0RDJH2YnllsqTKO6TQ_1jTdSsNQ"
|
|
12
|
+
},
|
|
13
|
+
"Bridge": {
|
|
14
|
+
"Url": "",
|
|
15
|
+
"FallbackPort": 5148,
|
|
16
|
+
"AllowHostedLocalFallback": false
|
|
17
|
+
},
|
|
18
|
+
"ProjectStorage": {
|
|
19
|
+
"Mode": "LocalOnly",
|
|
20
|
+
"CloudProjectsEnabled": false
|
|
21
|
+
},
|
|
22
|
+
"CloudflareR2": {
|
|
23
|
+
"ProxyUrl": "https://r2-auth-proxy.lovecrdm.workers.dev",
|
|
24
|
+
"PublicBaseUrl": "https://r2-auth-proxy.lovecrdm.workers.dev/public",
|
|
25
|
+
"PrivateSignUrl": "https://r2-auth-proxy.lovecrdm.workers.dev/sign",
|
|
26
|
+
"PrivateBatchSignUrl": "https://r2-auth-proxy.lovecrdm.workers.dev/sign-batch",
|
|
27
|
+
"PrivateUrlTtlSeconds": 900
|
|
28
|
+
},
|
|
29
|
+
"CloudflareWebCapture": {
|
|
30
|
+
"EndpointUrl": "https://web-capture-worker.lovecrdm.workers.dev/capture",
|
|
31
|
+
"RequestTimeoutMs": 45000
|
|
32
|
+
},
|
|
33
|
+
"Payments": {
|
|
34
|
+
"Provider": "dodo"
|
|
35
|
+
},
|
|
36
|
+
"DodoPayments": {
|
|
37
|
+
"DefaultProductId": "",
|
|
38
|
+
"StandardPriceId": "dodo_pro_monthly_v1",
|
|
39
|
+
"EarlyPriceId": "dodo_pro_monthly_v1",
|
|
40
|
+
"LtdPriceId": "dodo_ltd_launch_v1",
|
|
41
|
+
"ReturnUrl": "https://mindexec.pages.dev/pricing",
|
|
42
|
+
"Environment": "test_mode"
|
|
43
|
+
},
|
|
44
|
+
"Paddle": {
|
|
45
|
+
"ClientToken": "",
|
|
46
|
+
"ProMonthlyPriceId": ""
|
|
47
|
+
},
|
|
48
|
+
"ProductProfile": {
|
|
49
|
+
"VariantKey": "platform",
|
|
50
|
+
"Slug": "mindexec",
|
|
51
|
+
"BrandName": "MindExec",
|
|
52
|
+
"ProductName": "MindCanvas",
|
|
53
|
+
"AppTitle": "MindExec",
|
|
54
|
+
"WorkspaceNounSingular": "canvas",
|
|
55
|
+
"WorkspaceNounPlural": "canvases",
|
|
56
|
+
"SignInTitle": "Welcome Back",
|
|
57
|
+
"SignUpTitle": "Create Account",
|
|
58
|
+
"SignInSubtitle": "Sign in to access your MindCanvas workspace.",
|
|
59
|
+
"SignUpSubtitle": "Sign up to start organizing your ideas on a visual canvas.",
|
|
60
|
+
"PrimaryCheckoutProvider": "dodo",
|
|
61
|
+
"CanonicalHost": "mindexec.pages.dev",
|
|
62
|
+
"DodoCatalog": {
|
|
63
|
+
"StandardPriceId": "dodo_pro_monthly_v1",
|
|
64
|
+
"EarlyPriceId": "dodo_pro_monthly_v1",
|
|
65
|
+
"LtdPriceId": "dodo_ltd_launch_v1"
|
|
66
|
+
},
|
|
67
|
+
"MarketingTool": {
|
|
68
|
+
"Enabled": false,
|
|
69
|
+
"HideAppChrome": true,
|
|
70
|
+
"AllowMindCanvasRoute": false,
|
|
71
|
+
"HomeRoute": "/",
|
|
72
|
+
"ToolKey": "",
|
|
73
|
+
"HeroEyebrow": "Free local tool",
|
|
74
|
+
"HeroTitle": "",
|
|
75
|
+
"HeroSubtitle": "",
|
|
76
|
+
"PrimaryCtaText": "Open MindCanvas",
|
|
77
|
+
"PrimaryCtaHref": "https://mindexec.pages.dev/mindcanvas",
|
|
78
|
+
"SecondaryCtaText": "",
|
|
79
|
+
"SecondaryCtaHref": "",
|
|
80
|
+
"PrivacyNote": "Runs locally in your browser. No login. No database storage."
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.admin-hero{display:flex;align-items:flex-end;justify-content:space-between;gap:24px;padding-top:10px}.admin-hero h1{margin:12px 0 0;max-width:860px;font-size:clamp(38px,5vw,62px);line-height:1;font-weight:920;letter-spacing:0}.admin-hero p{max-width:780px;margin:18px 0 0;color:var(--copy);font-size:17px;line-height:1.75}.admin-hero-actions{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:10px}.admin-badge,.admin-note{display:inline-flex;align-items:center;min-height:28px;padding:0 10px;border:1px solid rgba(203,213,225,.78);border-radius:999px;color:#475569;background:#fff;font-size:12px;font-weight:800}.admin-badge--hold{color:#92400e;border-color:#f59e0b57;background:#fffbeb}.admin-status-strip{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:22px}.admin-status-pill{min-width:0;padding:13px 14px;border:1px solid rgba(203,213,225,.78);border-radius:9px;background:#ffffffe0}.admin-status-pill span,.admin-kpi-card span{display:block;color:#64748b;font-size:12px;font-weight:780}.admin-status-pill strong{display:block;margin-top:5px;color:#0f172a;overflow-wrap:anywhere}.admin-alert{display:flex;align-items:flex-start;gap:10px;margin-top:14px;padding:14px 16px;border:1px solid rgba(245,158,11,.34);border-radius:9px;color:#92400e;background:#fffbebf0}.admin-alert div{display:grid;gap:4px}.admin-alert span{color:#78350f;line-height:1.45}.admin-tabs{display:flex;flex-wrap:wrap;gap:8px;margin-top:18px}.admin-tabs button{min-height:38px;display:inline-flex;align-items:center;gap:7px;padding:0 12px;border:1px solid rgba(203,213,225,.82);border-radius:9px;color:#475569;background:#fff;cursor:pointer;font-weight:800}.admin-tabs button.is-active{color:#fff;border-color:#0f172a;background:#0f172a}.admin-kpi-grid,.admin-panel-grid{display:grid;gap:14px;margin-top:18px}.admin-kpi-grid{grid-template-columns:repeat(5,minmax(0,1fr))}.admin-panel-grid--two{grid-template-columns:repeat(2,minmax(0,1fr))}.admin-panel-grid--three{grid-template-columns:repeat(3,minmax(0,1fr))}.admin-kpi-card,.admin-panel{min-width:0;border:1px solid rgba(203,213,225,.82);border-radius:9px;background:#ffffffe6;box-shadow:var(--soft-shadow)}.admin-kpi-card{min-height:92px;display:grid;align-content:center;gap:8px;padding:14px}.admin-kpi-card strong{color:#0f172a;font-size:24px;line-height:1.08;overflow-wrap:anywhere}.admin-kpi-card--ok{border-color:#10b9814d}.admin-kpi-card--warn{border-color:#f59e0b57}.admin-kpi-card--danger{border-color:#f871715c}.admin-panel{padding:18px}.admin-panel--compact{padding:16px}.admin-panel-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:14px}.admin-panel h2{margin:0;color:#0f172a;font-size:18px}.admin-metric-list,.admin-funnel-list{display:grid;gap:9px}.admin-metric-row{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:34px;padding:8px 10px;border-radius:9px;background:#f8fafc}.admin-metric-row span{color:#64748b;font-size:13px;font-weight:720}.admin-metric-row strong{color:#0f172a;text-align:right;overflow-wrap:anywhere}.admin-metric-row--ok strong{color:#047857}.admin-metric-row--warn strong{color:#b45309}.admin-metric-row--danger strong{color:#b91c1c}.admin-mini-chart{height:230px;display:grid;grid-template-columns:repeat(14,minmax(0,1fr));gap:7px;align-items:end;padding-top:8px}.admin-bar-item{min-width:0;height:100%;display:grid;grid-template-rows:1fr auto auto;gap:5px;align-items:end;color:#64748b;font-size:11px;text-align:center}.admin-bar{width:100%;min-height:8px;border-radius:6px 6px 0 0;background:linear-gradient(180deg,#0f766e,#38bdf8)}.admin-bar-item b{color:#334155;font-size:11px}.admin-settings-panel{display:grid;gap:12px}.admin-settings-panel label{display:grid;gap:7px;color:#475569;font-size:12px;font-weight:830;text-transform:uppercase;letter-spacing:.06em}.admin-settings-panel input,.admin-settings-panel select,.admin-search-row input{width:100%;min-height:42px;border:1px solid rgba(148,163,184,.46);border-radius:9px;padding:10px 12px;color:#0f172a;background:#fff;outline:none}.admin-danger-button{color:#b91c1c}.admin-table-wrap{width:100%;overflow-x:auto}.admin-table{width:100%;border-collapse:collapse;min-width:560px}.admin-table th,.admin-table td{padding:10px 12px;border-bottom:1px solid rgba(226,232,240,.95);text-align:left;white-space:nowrap}.admin-table th{color:#64748b;font-size:12px;text-transform:uppercase;letter-spacing:.06em}.admin-table td{color:#334155;font-size:13px}.admin-release-readiness{display:grid;gap:14px;margin-top:18px}.admin-release-readiness>.admin-panel-head{align-items:center;margin-bottom:0;padding:18px;border:1px solid rgba(203,213,225,.82);border-radius:9px;background:#ffffffe6;box-shadow:var(--soft-shadow)}.admin-release-summary{max-width:780px;margin:8px 0 0;color:#64748b;line-height:1.55}.admin-release-grid{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(320px,.9fr);gap:14px}.admin-release-command-list,.admin-release-blocker-list{display:grid;gap:10px}.admin-release-command-list code,.admin-release-blocker code,.admin-release-proof-command code{display:block;padding:8px 10px;border:1px solid rgba(203,213,225,.82);border-radius:8px;color:#334155;background:#f8fafc;font-size:12px;white-space:normal;overflow-wrap:anywhere}.admin-release-blocker{display:grid;grid-template-columns:minmax(0,1fr) minmax(240px,.58fr);gap:14px;align-items:start;padding:14px;border:1px solid rgba(203,213,225,.82);border-radius:9px;background:#ffffffe6;box-shadow:var(--soft-shadow)}.admin-release-blocker>div{display:grid;gap:7px;min-width:0}.admin-release-blocker strong{color:#0f172a}.admin-release-blocker span{color:#64748b;line-height:1.45}.admin-release-state{justify-self:start;padding:4px 8px;border-radius:999px;color:#92400e;background:#fffbeb;font-size:12px;font-weight:820}.admin-release-proof-command-list{grid-column:1 / -1;display:grid;gap:8px}.admin-release-proof-command{min-width:0;display:grid;grid-template-columns:minmax(140px,.34fr) minmax(0,1fr) auto;gap:8px;align-items:center;padding:9px;border:1px solid rgba(226,232,240,.92);border-radius:8px;background:#f8fafcd1}.admin-release-proof-command>span{min-width:0;overflow:hidden;color:#334155;font-size:12px;font-weight:820;text-overflow:ellipsis;white-space:nowrap}.admin-release-proof-command code{padding:6px 8px;background:#fff;font-size:11px}.admin-release-proof-command__badges{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:4px}.admin-release-proof-command__badges span{min-height:22px;display:inline-flex;align-items:center;padding:0 7px;border-radius:999px;color:#475569;background:#fff;border:1px solid rgba(203,213,225,.82);font-size:10px;font-weight:820;line-height:1}.admin-search-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px}.admin-empty{margin-top:14px;padding:16px;border:1px dashed rgba(148,163,184,.5);border-radius:9px;color:#64748b;background:#f8fafc}.admin-user-card{display:grid;gap:12px;margin-top:14px;padding:14px;border:1px solid rgba(203,213,225,.82);border-radius:9px;background:#fff}.admin-user-card>span{color:#64748b}.admin-funnel-row{display:grid;gap:8px}.admin-funnel-row>div:first-child{display:flex;align-items:center;justify-content:space-between;gap:10px}.admin-funnel-row span{color:#64748b;font-size:13px}.admin-progress-track{height:9px;border-radius:999px;background:#e2e8f0;overflow:hidden}.admin-progress-fill{height:100%;border-radius:inherit;background:linear-gradient(90deg,#2563eb,#0f766e)}@media(max-width:960px){.admin-status-strip,.admin-kpi-grid,.admin-panel-grid--two,.admin-panel-grid--three,.admin-release-grid,.admin-release-blocker,.admin-release-proof-command,.admin-search-row{grid-template-columns:1fr}.admin-release-proof-command__badges{justify-content:flex-start}.admin-hero,.admin-panel-head{align-items:stretch;flex-direction:column}}@media(max-width:640px){.admin-dashboard-page>*{width:min(100%,calc(100% - 20px))}.admin-hero h1{font-size:36px;line-height:1.04}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as E,j as e}from"./vendor-react-BXzpOyCS.js";import{a as U}from"./index-CQMKCp-t.js";import{r as te}from"./productionAdapterConfig-C5jfk6oG.js";import{R as d}from"./app-runtime-xD2Z3NdN.js";import{getSupabaseBrowserClient as re}from"./supabaseAuthAdapter-DA43DeSY.js";import{an as _e,R as ge,D as Ee,b0 as Se,aQ as De,b1 as ye,P as we,aH as xe,b2 as Ae,j as Ce,q as Ie,W as Ne,b3 as Re,c as je,b4 as ke,e as Oe,aA as Pe}from"./vendor-icons-DE3gIReG.js";import"./canvas-runtime-BbicBcOj.js";const Le=!1,Me="hold-release",Te=[{id:"cloud-auth-billing",label:"Secure cloud/auth/billing adapter closure",uiLabel:"Cloud/auth/billing adapter",state:"blocked-live-proof",requiredProof:["Dodo checkout live smoke with fresh Supabase session","Supabase provider read-only smoke with fresh session","Supabase provider write/admin mutation smoke with explicit admin values","Original launch proof supabaseLeakedPasswordProtection remains required as artifact-backed security proof","Original launch proof bolaIdorNegativeGate remains required as artifact-backed 20-user authorization proof","Original launch proof activeEditorHttpGate remains required as artifact-backed active editor load proof","Original launch proof dodoSignedSmoke remains required as signed webhook proof","Original launch proof dodoCheckoutDisabled remains required as fail-closed checkout proof","Original launch proof dodoSandboxWebhook remains required as real sandbox webhook proof","Original launch proof deploymentHardening.webCaptureWorkerSsrfRedirectGuard remains required as capture hardening proof","Original launch proof deploymentHardening.uploadFileSizeValidation remains required as upload hardening proof","Original launch proof deploymentHardening.dodoWebhookReplayGuard remains required as webhook replay hardening proof"],uiProof:"Dodo checkout, Supabase read-only, cloud write, and admin mutation proof need fresh provider inputs.",requiredInputs:["VITE_MINDEXEC_SUPABASE_URL","VITE_MINDEXEC_SUPABASE_PUBLISHABLE_KEY","VITE_MINDEXEC_DODO_CHECKOUT_FUNCTION_URL","MINDEXEC_SUPABASE_PROVIDER_SESSION_JSON","MINDEXEC_DODO_CHECKOUT_LIVE_CONFIRM","MINDEXEC_SUPABASE_PROVIDER_LIVE_CONFIRM","MINDEXEC_SUPABASE_PROVIDER_WRITE_CONFIRM","MINDEXEC_SUPABASE_PROVIDER_ADMIN_MUTATION_CONFIRM","MINDEXEC_SUPABASE_PROVIDER_ADMIN_PRICE_STAGE","MINDEXEC_SUPABASE_PROVIDER_ADMIN_LTD_LIMIT","MINDEXEC_ORIGINAL_LAUNCH_PROOF_JSON"],uiCommand:"npm run verify:release-blocker-preflight",proofCommands:[{label:"Dodo checkout live smoke",command:"npm run verify:dodo-checkout-live-smoke",mode:"opt-in-live-proof",liveCall:!0,hostAffecting:!1,defaultGate:!1,requiredInputs:["VITE_MINDEXEC_SUPABASE_URL","VITE_MINDEXEC_SUPABASE_PUBLISHABLE_KEY","VITE_MINDEXEC_DODO_CHECKOUT_FUNCTION_URL","MINDEXEC_SUPABASE_PROVIDER_SESSION_JSON","MINDEXEC_DODO_CHECKOUT_LIVE_CONFIRM"]},{label:"Supabase provider read-only smoke",command:"npm run verify:supabase-provider-live-smoke",mode:"opt-in-live-proof",liveCall:!0,hostAffecting:!1,defaultGate:!1,requiredInputs:["VITE_MINDEXEC_SUPABASE_URL","VITE_MINDEXEC_SUPABASE_PUBLISHABLE_KEY","MINDEXEC_SUPABASE_PROVIDER_SESSION_JSON","MINDEXEC_SUPABASE_PROVIDER_LIVE_CONFIRM"]},{label:"Supabase provider write/admin mutation smoke",command:"npm run verify:supabase-provider-write-smoke",mode:"opt-in-live-proof",liveCall:!0,hostAffecting:!1,defaultGate:!1,requiredInputs:["VITE_MINDEXEC_SUPABASE_URL","VITE_MINDEXEC_SUPABASE_PUBLISHABLE_KEY","MINDEXEC_SUPABASE_PROVIDER_SESSION_JSON","MINDEXEC_SUPABASE_PROVIDER_WRITE_CONFIRM","MINDEXEC_SUPABASE_PROVIDER_ADMIN_MUTATION_CONFIRM","MINDEXEC_SUPABASE_PROVIDER_ADMIN_PRICE_STAGE","MINDEXEC_SUPABASE_PROVIDER_ADMIN_LTD_LIMIT"]},{label:"Original launch proof artifacts",command:"npm run verify:original-launch-proof-artifacts",mode:"opt-in-proof-file",liveCall:!1,hostAffecting:!1,defaultGate:!1,requiredInputs:["MINDEXEC_ORIGINAL_LAUNCH_PROOF_JSON"]}]},{id:"agent-webresearch-codemaster",label:"Agent execution and WebResearch adapter closure",uiLabel:"Agent and CodeMaster provider depth",state:"blocked-provider-depth",requiredProof:["Real provider-backed diff/apply proof stays bounded to disposable workspace evidence","Cloud execution adapter proof avoids deploy, publish, billing, and unsafe file mutations","Concept embedding live proof keeps the provider API key server-side and opt-in only"],uiProof:"Live provider diff/apply and cloud execution proof remain opt-in and bounded.",requiredInputs:["MINDEXEC_CODEX_LIVE_READONLY_CONFIRM","MINDEXEC_CODEX_LIVE_TEMP_WRITE_CONFIRM","MINDEXEC_CODEX_LIVE_PROJECT_WRITE_CONFIRM","MINDEXEC_CODEMASTER_CLOUD_EXECUTION_PROOF_JSON","MINDEXEC_CONCEPT_EMBED_LIVE_CONFIRM","MINDEXEC_CONCEPT_EMBED_API_KEY"],uiCommand:"npm run verify:codemaster-codex-live-project-write-smoke",proofCommands:[{label:"Codex live read-only provider smoke",command:"npm run verify:codemaster-codex-live-readonly-smoke",mode:"opt-in-live-proof",liveCall:!0,hostAffecting:!1,defaultGate:!1,requiredInputs:["MINDEXEC_CODEX_LIVE_READONLY_CONFIRM"]},{label:"Codex live temp-write provider smoke",command:"npm run verify:codemaster-codex-live-temp-write-smoke",mode:"opt-in-live-proof",liveCall:!0,hostAffecting:!1,defaultGate:!1,requiredInputs:["MINDEXEC_CODEX_LIVE_TEMP_WRITE_CONFIRM"]},{label:"Codex live project-write provider smoke",command:"npm run verify:codemaster-codex-live-project-write-smoke",mode:"opt-in-live-proof",liveCall:!0,hostAffecting:!1,defaultGate:!1,requiredInputs:["MINDEXEC_CODEX_LIVE_PROJECT_WRITE_CONFIRM"]},{label:"CodeMaster cloud execution adapter proof",command:"npm run verify:codemaster-cloud-execution-adapter-proof",mode:"opt-in-proof-file",liveCall:!1,hostAffecting:!1,defaultGate:!1,requiredInputs:["MINDEXEC_CODEMASTER_CLOUD_EXECUTION_PROOF_JSON"]},{label:"Concept embedding live provider smoke",command:"npm run verify:concept-embedding-live-smoke",mode:"opt-in-live-proof",liveCall:!0,hostAffecting:!1,defaultGate:!1,requiredInputs:["MINDEXEC_CONCEPT_EMBED_LIVE_CONFIRM","MINDEXEC_CONCEPT_EMBED_API_KEY"]}]},{id:"mindcanvas-ai-media-provider",label:"MindCanvas AI media provider closure",uiLabel:"MindCanvas AI media provider",state:"blocked-provider-proof",requiredProof:["Provider-backed image generation proof from the MindCanvas node workflow","Provider-backed video generation proof from the MindCanvas node workflow","No raw provider secrets appear in browser storage, docs, logs, or release artifacts"],uiProof:"Image and video generation need sanitized provider proof from the node workflow.",requiredInputs:["MINDEXEC_MEDIA_PROVIDER_LIVE_CONFIRM","MINDEXEC_MEDIA_PROVIDER_PROOF_JSON"],uiCommand:"npm run verify:mindcanvas-media-provider-proof",proofCommands:[{label:"MindCanvas AI media provider proof",command:"npm run verify:mindcanvas-media-provider-proof",mode:"opt-in-proof-file",liveCall:!1,hostAffecting:!1,defaultGate:!1,requiredInputs:["MINDEXEC_MEDIA_PROVIDER_LIVE_CONFIRM","MINDEXEC_MEDIA_PROVIDER_PROOF_JSON"]}]},{id:"remote-fast-os-input",label:"RemoteFast opt-in OS-input smoke",uiLabel:"RemoteFast host OS input",state:"blocked-operator-confirmation",requiredProof:["Bounded pointer/key smoke against the host with cursor restore evidence"],uiProof:"Pointer/key smoke affects the host and must stay explicitly confirmed.",requiredInputs:["MINDEXEC_REMOTE_FAST_OS_INPUT_CONFIRM"],uiCommand:"npm run verify:remote-monitor-remote-fast-os-input-smoke",proofCommands:[{label:"RemoteFast bounded host OS-input smoke",command:"npm run verify:remote-monitor-remote-fast-os-input-smoke",mode:"opt-in-host-proof",liveCall:!1,hostAffecting:!0,defaultGate:!1,requiredInputs:["MINDEXEC_REMOTE_FAST_OS_INPUT_CONFIRM"]}]},{id:"release-approval",label:"Cloudflare/npm release approval",uiLabel:"Cloudflare/npm approval",state:"hold-release",requiredProof:["Green local gates after live proofs","Reviewed release notes","Explicit user approval before Cloudflare deploy or npm publish","Original `ref/~MindExec` launch proof manifest parity reviewed before release approval"],uiProof:"Deploy and npm publish require a reviewed proof packet and explicit user approval.",requiredInputs:["manual user approval"],uiCommand:"npm run verify:release-proof-packet",proofCommands:[{label:"Cloudflare Pages release pass",command:"manual-release-pass:cloudflare-pages",mode:"manual-release-approval",liveCall:!0,hostAffecting:!1,defaultGate:!1,requiredInputs:["manual user approval"]},{label:"npm package release pass",command:"manual-release-pass:npm-package",mode:"manual-release-approval",liveCall:!0,hostAffecting:!1,defaultGate:!1,requiredInputs:["manual user approval"]}]}],H={releaseReady:Le,releasePosture:Me,blockers:Te},ne="admin-dashboard-data";function v(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function D(t){return Array.isArray(t)?t:[]}function f(t,a=""){return typeof t=="string"&&t.trim()?t.trim():a}function F(t,a=0){const r=typeof t=="number"?t:Number(t);return Number.isFinite(r)?r:a}function T(t,a=0){return Math.round(F(t,a))}function u(t){return T(t).toLocaleString()}function j(t){return`$${F(t).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`}function L(t){return`${F(t).toFixed(1)}%`}function V(t){return`${u(t)}P`}function se(t){const a=f(t);if(!a)return"--/--";const r=new Date(a);return Number.isNaN(r.getTime())?a.slice(0,5):`${String(r.getUTCMonth()+1).padStart(2,"0")}/${String(r.getUTCDate()).padStart(2,"0")}`}function Ue(t){const a=f(t).toLowerCase();if(/(failed|error|suspended|revoked|high|danger|blocked)/.test(a))return"danger";if(/(pending|review|grace|warn|manual|locked)/.test(a))return"warn";if(/(active|ok|processed|healthy|paid|closed|enforced)/.test(a))return"ok"}function _(t,a,r="-"){for(const n of a){const s=t[n];if(s!=null&&String(s).trim())return String(s)}return r}function Y(t,a){return t.map(r=>{const n=v(r),s=a.find(c=>n[c]!==void 0)??a[0];return{label:se(n.date??n.day??n.created_at),value:Math.max(0,F(n[s]))}})}function Fe(t){const a=v(t),r=v(a.launch_overview),n=v(a.billing_control),s=v(a.credit_totals),c=v(a.refund_rate),h=Y(D(a.daily_signups),["count","signup_count"]),l=Y(D(a.daily_revenue),["revenue","amount"]),y=D(a.referrers).map(b=>{const i=v(b);return[_(i,["referrer"],"direct"),u(i.visit_count??i.count)]}),O=D(a.countries).map(b=>{const i=v(b);return[_(i,["country"],"--"),u(i.visit_count??i.count),u(i.unique_users)]}),A=D(a.heavy_users).map(b=>{const i=v(b);return[_(i,["email","user_email","display_name"],"unknown"),`${u(i.boards_count??i.board_count)} boards`]}),C=D(a.entitlements).map(b=>{const i=v(b);return[_(i,["email","user_email"],"unknown"),_(i,["plan_key","plan","normalized_plan_key"],"free"),_(i,["status","entitlement_status"],"active"),_(i,["ends_at","current_period_end","renews_at"],"-")]}),I=D(a.refunds).map(b=>{const i=v(b);return[_(i,["email","user_email"],"unknown"),j(i.amount),_(i,["risk","revocation_status"],"review"),_(i,["review_status","status"],"open")]}),P=D(a.credit_ledger).map(b=>{const i=v(b);return[se(i.created_at),_(i,["email","user_email","reason"],"unknown"),V(i.delta??i.amount??i.credit_delta),_(i,["reason","event_type","source"],"-")]}),N=D(a.feature_limits).map(b=>{const i=v(b);return[_(i,["feature","feature_key"],"Feature"),_(i,["free_limit","free"],"-"),_(i,["pro_limit","pro","limit_value"],"-"),_(i,["status","entitlement_status"],"enforced")]}),R=D(a.user_funnel).map(b=>{const i=v(b);return{label:_(i,["stage","label"],"Stage"),count:T(i.count??i.user_count),rate:F(i.rate??i.conversion_rate)}});return{source:"supabase-admin-dashboard-data",fetchedAt:f(a.fetched_at,new Date().toISOString()),billingMode:f(r.billing_mode??n.billing_mode,"DODO_LIVE"),currency:f(r.currency_code??n.currency_code,"USD"),usdPerPoint:f(r.usd_per_point,"0.0002"),overviewKpis:[{label:"DAU",value:u(r.dau),tone:"ok"},{label:"WAU",value:u(r.wau),tone:"ok"},{label:"Activation",value:L(r.activation_rate),tone:"ok"},{label:"AI usage",value:L(r.ai_usage_rate),tone:"ok"},{label:"Paid conversion",value:L(r.paid_conversion_rate),tone:"warn"},{label:"D1 retention",value:L(r.d1_retention_rate),tone:"warn"},{label:"D7 retention",value:L(r.d7_retention_rate),tone:"warn"},{label:"Avg points / user",value:V(r.avg_points_spent_per_user)},{label:"AI cost estimate",value:j(r.ai_cost_estimate_usd)},{label:"Gross margin estimate",value:j(r.gross_margin_estimate_usd),tone:"ok"}],billingKpis:[{label:"Billing mode",value:f(n.billing_mode??r.billing_mode,"DODO_LIVE"),tone:"ok"},{label:"Webhook received 24h",value:u(n.webhook_received_24h??r.webhook_received_24h),tone:"ok"},{label:"Webhook failed 24h",value:u(n.webhook_failures_24h??r.webhook_failures_24h),tone:"warn"},{label:"Pending events",value:u(n.pending_events),tone:"warn"},{label:"Active Pro users",value:u(n.pro_active_users??n.active_entitlements),tone:"ok"},{label:"Manual reviews",value:u(n.manual_reviews),tone:"warn"},{label:"Locked boards",value:u(n.locked_boards),tone:"warn"},{label:"Create blocked today",value:u(n.create_blocked_today)}],operatingHealth:[{label:"Signups today",value:u(r.signups_today),tone:"ok"},{label:"Active users today",value:u(r.active_users_today),tone:"ok"},{label:"Points spent users",value:u(r.points_spent_users)},{label:"AI failures 24h",value:u(r.ai_failures_24h),tone:Ue(r.ai_failures_24h)??"warn"},{label:"Save failures 24h",value:u(r.save_failures_24h),tone:"ok"},{label:"Webhook failures 24h",value:u(r.webhook_failures_24h),tone:"warn"}],revenueBand:[{label:"Revenue today",value:j(r.revenue_today),tone:"ok"},{label:"7 day revenue",value:j(r.revenue_7_days),tone:"ok"},{label:"30 day revenue",value:j(r.revenue_30_days)},{label:"Total revenue",value:j(r.total_revenue)},{label:"Paid users",value:u(r.paid_users)},{label:"Wallet liability",value:V(r.total_credit_balance??s.total_credit_balance),tone:"warn"}],signupTrend:h,revenueTrend:l,referrerRows:y,countryRows:O,heavyUserRows:A,entitlementRows:C,webhookRows:[["24h received","payment/provider","processed",u(n.webhook_received_24h??r.webhook_received_24h)],["24h failed","payment/provider","manual-review",u(n.webhook_failures_24h??r.webhook_failures_24h)],["Refund rate","refunds","watch",L(c.refund_rate??c.rate)]],refundRows:I,creditRows:P,featureLimitRows:N,funnelRows:R,auditRows:[]}}async function W(t){var y,O,A,C;const a=te(t);if(!a.adminData.canAttempt)throw d.emit("adminDashboard.provider.skipped",{mode:a.adminData.mode}),new Error(`Secure admin data adapter is not ready: ${a.adminData.mode}`);const r=re(t);if(!r)throw d.emit("adminDashboard.provider.skipped",{mode:"config-missing"}),new Error("Supabase browser client is not available for admin data.");const{data:n,error:s}=await r.auth.getSession();if(s||!((y=n.session)!=null&&y.access_token))throw d.emit("adminDashboard.provider.sessionMissing",{message:(s==null?void 0:s.message)??"missing-session"}),new Error("Secure admin data requires a Supabase-authenticated session.");const{data:c,error:h}=await r.auth.getUser(),l=(O=c.user)==null?void 0:O.id;if(h||!l)throw d.emit("adminDashboard.provider.sessionMissing",{message:(h==null?void 0:h.message)??"missing-user"}),new Error("Secure admin data requires a verified Supabase user.");return{config:a,accessToken:n.session.access_token,userId:l,email:((C=(A=c.user)==null?void 0:A.email)==null?void 0:C.toLowerCase())??""}}async function X(t,a){await W(t);const r=re(t);if(!r)throw new Error("Supabase browser client is not available for admin data.");const{data:n,error:s}=await r.functions.invoke(ne,{body:a});if(s)throw d.emit("adminDashboard.provider.failed",{operation:f(a.action,"summary"),message:s.message}),s;if(n!=null&&n.error){const c=f(n.message??n.error,"admin-dashboard-data failed");throw d.emit("adminDashboard.provider.failed",{operation:f(a.action,"summary"),message:c}),new Error(c)}return n??{}}async function Be(t){d.emit("adminDashboard.provider.summary.requested",{functionName:ne});const a=await X(t,{action:"summary"}),r=Fe(a.summary);return d.emit("adminDashboard.provider.summary.loaded",{source:r.source,overviewMetrics:r.overviewKpis.length,signupPoints:r.signupTrend.length}),r}async function Xe(t,a){if(d.emit("adminDashboard.provider.userSearch.requested",{hasQuery:!!a.trim()}),!a.trim())return null;const r=await X(t,{action:"user-search",query:a}),n=v(r.user);if(!Object.keys(n).length)return d.emit("adminDashboard.provider.userSearch.loaded",{found:!1}),null;const s=v(n.profile),c=v(n.board_stats),h=v(n.activity),l=D(n.timeline),y={email:f(s.email,"unknown"),plan:f(s.plan_type,"Free"),boards:T(c.boards_count??c.board_count),points:T(s.credits_balance??h.credit_balance??h.points_balance),country:f(s.country,"--"),lastSeen:f(s.last_seen_at,f(s.created_at,"unknown")),timelineCount:l.length};return d.emit("adminDashboard.provider.userSearch.loaded",{found:!0,boards:y.boards}),y}async function Ve(t,a,r){const n=await W(t);d.emit("adminDashboard.provider.settings.requested",{priceStage:a,ltdLimit:r});const s=await X(t,{action:"save-settings",price_stage:a,ltd_limit:r}),c={mode:n.config.adminData.mode,canAttempt:!0,priceStage:f(s.price_stage,a),ltdLimit:T(s.ltd_limit,r),updatedAt:f(s.updated_at,new Date().toISOString())};return d.emit("adminDashboard.provider.settings.saved",{priceStage:c.priceStage,ltdLimit:c.ltdLimit}),c}async function qe(t,a){const r=await W(t);d.emit("adminDashboard.provider.emergencyClose.requested",{ltdLimit:a});const n=await X(t,{action:"emergency-close",price_stage:"CLOSED",ltd_limit:a}),s={mode:r.config.adminData.mode,canAttempt:!0,priceStage:f(n.price_stage,"CLOSED"),ltdLimit:T(n.ltd_limit,a),updatedAt:f(n.updated_at,new Date().toISOString())};return d.emit("adminDashboard.provider.emergencyClose.staged",{priceStage:s.priceStage,ltdLimit:s.ltdLimit}),s}const K="mindexec.react.admin.dashboard.v1",$e=["STANDARD","EARLY","LTD","CLOSED"],k={priceStage:"EARLY",ltdLimit:100,lastAction:"Admin dashboard restored as a local React shell.",updatedAtUtc:""};function Ge(){return te(U())}const He=[{key:"overview",label:"Overview",icon:Se},{key:"billing",label:"Billing Control",icon:De},{key:"entitlements",label:"Entitlements",icon:ye},{key:"dodo",label:"Dodo Events",icon:we},{key:"refunds",label:"Refunds",icon:xe},{key:"credits",label:"Credits",icon:Ae},{key:"limits",label:"Feature Limits",icon:Ce},{key:"funnel",label:"User Funnel",icon:Ie},{key:"explorer",label:"User Explorer",icon:Ne},{key:"release",label:"Release Readiness",icon:Re},{key:"audit",label:"Audit Log",icon:je}],We=[{label:"06/08",value:2},{label:"06/09",value:4},{label:"06/10",value:5},{label:"06/11",value:8},{label:"06/12",value:7},{label:"06/13",value:13},{label:"06/14",value:11},{label:"06/15",value:16},{label:"06/16",value:19},{label:"06/17",value:18},{label:"06/18",value:23},{label:"06/19",value:26},{label:"06/20",value:31},{label:"06/21",value:34}],Ke=[{label:"06/08",value:0},{label:"06/09",value:12},{label:"06/10",value:18},{label:"06/11",value:12},{label:"06/12",value:29},{label:"06/13",value:41},{label:"06/14",value:38},{label:"06/15",value:49},{label:"06/16",value:64},{label:"06/17",value:72},{label:"06/18",value:81},{label:"06/19",value:94},{label:"06/20",value:108},{label:"06/21",value:124}],G=[{email:"maya@buildloop.ai",plan:"Pro",boards:18,points:1240,country:"US",lastSeen:"today"},{email:"kenji@solo-studio.jp",plan:"Early",boards:9,points:640,country:"JP",lastSeen:"today"},{email:"linh@vietlaunch.dev",plan:"Free",boards:5,points:120,country:"VN",lastSeen:"yesterday"},{email:"alex@indieops.co",plan:"LTD",boards:32,points:2840,country:"SG",lastSeen:"2d ago"}],Je=[{label:"DAU",value:"128",tone:"ok"},{label:"WAU",value:"614",tone:"ok"},{label:"Activation",value:"41.8%",tone:"ok"},{label:"AI usage",value:"63.2%",tone:"ok"},{label:"Paid conversion",value:"4.6%",tone:"warn"},{label:"D1 retention",value:"38.1%",tone:"warn"},{label:"D7 retention",value:"22.7%",tone:"warn"},{label:"Avg points / user",value:"318P"},{label:"AI cost estimate",value:"$74.82"},{label:"Gross margin estimate",value:"$418.10",tone:"ok"}],ze=[{label:"Billing mode",value:"DODO_LIVE_GATED",tone:"warn"},{label:"Webhook received 24h",value:"19",tone:"ok"},{label:"Webhook failed 24h",value:"1",tone:"warn"},{label:"Pending events",value:"3",tone:"warn"},{label:"Active Pro users",value:"28",tone:"ok"},{label:"Manual reviews",value:"2",tone:"warn"},{label:"Locked boards",value:"6",tone:"warn"},{label:"Create blocked today",value:"14"}],ie=[["06/21 18:41","admin@mindexec.local","Changed price stage draft to EARLY"],["06/21 16:10","system","Dodo webhook replay queued"],["06/20 23:55","admin@mindexec.local","Raised LTD capacity review flag"],["06/20 19:20","system","Credit ledger reconciliation completed"]],Ye=[["evt_4912","payment.succeeded","processed","$12.00 USD"],["evt_4911","subscription.created","processed","Pro monthly"],["evt_4910","payment.failed","manual-review","$12.00 USD"],["evt_4909","refund.requested","pending","$24.00 USD"]],Qe=[{label:"Visitor",count:1280,rate:100},{label:"Signup",count:214,rate:16.7},{label:"First board",count:132,rate:61.7},{label:"AI run",count:83,rate:62.8},{label:"Pricing visit",count:44,rate:53},{label:"Paid",count:11,rate:25}],Q=String(H.releaseReady),q=H.releasePosture,Ze=H.blockers.map(t=>{var a;return{id:t.id,label:t.uiLabel||t.label,state:t.state,proof:t.uiProof||t.requiredProof.join(" "),command:t.uiCommand||((a=t.proofCommands[0])==null?void 0:a.command)||"npm run verify:release-blocker-preflight",proofCommands:t.proofCommands.map(r=>({label:r.label,command:r.command,mode:r.mode,liveCall:r.liveCall,hostAffecting:r.hostAffecting,defaultGate:r.defaultGate,requiredInputs:r.requiredInputs}))}}),ea={source:"local",fetchedAt:"",billingMode:"DODO_LIVE_GATED",currency:"USD",usdPerPoint:"0.0002",overviewKpis:Je,billingKpis:ze,operatingHealth:[{label:"Signups today",value:"34",tone:"ok"},{label:"Active users today",value:"128",tone:"ok"},{label:"Points spent users",value:"77"},{label:"AI failures 24h",value:"2",tone:"warn"},{label:"Save failures 24h",value:"0",tone:"ok"},{label:"Webhook failures 24h",value:"1",tone:"warn"}],revenueBand:[{label:"Revenue today",value:"$124.00",tone:"ok"},{label:"7 day revenue",value:"$530.00",tone:"ok"},{label:"30 day revenue",value:"$1,870.00"},{label:"Total revenue",value:"$4,418.00"},{label:"Paid users",value:"28"},{label:"Wallet liability",value:"184,200P",tone:"warn"}],signupTrend:We,revenueTrend:Ke,referrerRows:[["direct","312"],["x.com","128"],["reddit","84"],["youtube","62"]],countryRows:[["US","41%"],["JP","18%"],["SG","11%"],["VN","8%"]],heavyUserRows:G.slice(0,4).map(t=>[t.email.split("@")[0],`${t.boards} boards`]),entitlementRows:G.map(t=>[t.email,t.plan,t.plan==="Free"?"free":"active",t.plan==="Free"?"-":"2026-07-21"]),webhookRows:Ye,refundRows:[["maya@buildloop.ai","$12.00","low","closed"],["alex@indieops.co","$24.00","medium","open"],["unknown@blocked.test","$12.00","high","manual review"]],creditRows:[["18:41","maya@buildloop.ai","+1000P","monthly grant"],["18:20","kenji@solo-studio.jp","-120P","AI task"],["17:52","alex@indieops.co","-280P","image generation"]],featureLimitRows:[["Cloud boards","3","Unlimited","enforced"],["AI runs / month","20","1000","enforced"],["Image uploads","100MB","10GB","watching"],["Private boards","0","Unlimited","enforced"]],funnelRows:Qe,auditRows:ie};function aa(t,a){const r=Math.max(...a.map(n=>n.value),1);return Math.max(8,Math.round(t/r*100))}function ta(t){return t?`admin-kpi-card--${t}`:""}function $(t){return t.map(a=>({label:a[0]??"-",value:a[1]??"-"}))}function ra(t){return"timelineCount"in t?t.timelineCount:9}function oe(t){const a=typeof t=="number"?t:Number(t);return Number.isFinite(a)?Math.max(0,Math.min(1e4,Math.round(a))):k.ltdLimit}function le(t){if(!t||typeof t!="object")return k;const a=t,r=$e.includes(a.priceStage)?String(a.priceStage):k.priceStage,n=typeof a.lastAction=="string"&&a.lastAction.trim()?a.lastAction.slice(0,240):k.lastAction,s=typeof a.updatedAtUtc=="string"?a.updatedAtUtc:"";return{priceStage:r,ltdLimit:oe(a.ltdLimit),lastAction:n,updatedAtUtc:s}}function na(){if(typeof window>"u")return k;try{const t=window.localStorage.getItem(K),a=t?le(JSON.parse(t)):k;return d.emit("adminDashboard.localDraft.loaded",{source:t?"stored":"default",priceStage:a.priceStage,ltdLimit:a.ltdLimit}),a}catch(t){return d.emit("adminDashboard.localDraft.failed",{operation:"load",message:t instanceof Error?t.message:String(t)}),k}}function Z(t,a){const r=le({...t,updatedAtUtc:new Date().toISOString()});if(typeof window>"u")return r;try{window.localStorage.setItem(K,JSON.stringify(r)),d.emit("adminDashboard.localDraft.saved",{source:a,priceStage:r.priceStage,ltdLimit:r.ltdLimit})}catch(n){d.emit("adminDashboard.localDraft.failed",{operation:"save",source:a,message:n instanceof Error?n.message:String(n)})}return r}function ha(){const[t]=E.useState(na),[a,r]=E.useState("overview"),[n,s]=E.useState(!1),c=E.useMemo(()=>Ge(),[]),h=c.adminData.canAttempt,[l,y]=E.useState(ea),[O,A]=E.useState(null),[C,I]=E.useState(t.priceStage),[P,N]=E.useState(t.ltdLimit),[R,b]=E.useState(""),[i,de]=E.useState(""),[ce,g]=E.useState(t.lastAction),[ue,J]=E.useState(()=>new Date),me=E.useMemo(()=>{if(!i.trim())return null;const o=i.trim().toLowerCase();return G.find(m=>m.email.toLowerCase().includes(o))||null},[i]),w=l.source==="supabase-admin-dashboard-data"?O:me,pe=o=>{r(o),d.emit("adminDashboard.tab",{key:o})},fe=async()=>{if(s(!0),d.emit("adminDashboard.refresh"),h){try{const o=await Be(U());y(o),J(new Date(o.fetchedAt)),g("Secure Supabase admin snapshot refreshed.")}catch(o){const m=o instanceof Error?o.message:String(o);d.emit("adminDashboard.provider.refreshFailed",{message:m}),g(`Secure admin snapshot failed: ${m}. Local snapshot remains visible.`)}finally{s(!1)}return}window.setTimeout(()=>{J(new Date),g("Local admin snapshot refreshed. Wire Supabase read adapters before treating it as live production data."),s(!1)},260)},he=async o=>{o.preventDefault();const m=`Saved local settings draft: ${C}, LTD ${P}.`,p=Z({priceStage:C,ltdLimit:P,lastAction:m},"settings.form");if(d.emit("adminDashboard.settings.saved",{priceStage:p.priceStage,ltdLimit:p.ltdLimit}),I(p.priceStage),N(p.ltdLimit),g(p.lastAction),!!h)try{const S=await Ve(U(),p.priceStage,p.ltdLimit);I(S.priceStage),N(S.ltdLimit),g(`Secure admin settings saved: ${S.priceStage}, LTD ${S.ltdLimit}.`)}catch(S){const z=S instanceof Error?S.message:String(S);d.emit("adminDashboard.provider.settingsFailed",{message:z}),g(`Local settings draft saved, but secure provider save failed: ${z}`)}},ve=async()=>{const m=Z({priceStage:"CLOSED",ltdLimit:P,lastAction:"Emergency close staged locally. Real billing closure requires a secure admin adapter."},"emergency.close");if(d.emit("adminDashboard.emergency.closed",{priceStage:m.priceStage,ltdLimit:m.ltdLimit}),I(m.priceStage),N(m.ltdLimit),g(m.lastAction),!!h)try{const p=await qe(U(),m.ltdLimit);I(p.priceStage),N(p.ltdLimit),g(`Secure emergency close staged through admin provider: ${p.priceStage}, LTD ${p.ltdLimit}.`)}catch(p){const S=p instanceof Error?p.message:String(p);d.emit("adminDashboard.provider.emergencyFailed",{message:S}),g(`Emergency close staged locally, but secure provider close failed: ${S}`)}},be=async o=>{if(o.preventDefault(),de(R),d.emit("adminDashboard.user.search",{hasQuery:!!R.trim()}),!R.trim()){A(null),g("User explorer query cleared.");return}if(!h){g("User explorer searched local sample data.");return}try{const m=await Xe(U(),R);A(m),g(m?"User explorer loaded secure provider data.":"No secure provider user matched that query.")}catch(m){const p=m instanceof Error?m.message:String(m);d.emit("adminDashboard.provider.userSearchFailed",{message:p}),A(null),g(`Secure user explorer failed: ${p}`)}};return e.jsxs("div",{className:"page admin-dashboard-page","data-testid":"admin-dashboard-shell","data-admin-storage-key":K,"data-production-adapter-state":c.overallState,"data-admin-provider-mode":c.adminData.mode,"data-admin-provider-ready":c.adminData.canAttempt?"true":"false","data-client-secret-blocked":c.forbiddenClientSecretKeys.length>0?"true":"false",children:[e.jsxs("section",{className:"admin-hero",children:[e.jsxs("div",{children:[e.jsx("div",{className:"eyebrow",children:"Operations Console"}),e.jsx("h1",{children:"MindExec Admin Dashboard"}),e.jsx("p",{children:"React port of the original admin plugin: revenue, billing control, credits, limits, funnel, user explorer, and audit surfaces without loading the Blazor plugin runtime."})]}),e.jsxs("div",{className:"admin-hero-actions",children:[e.jsx("span",{className:"admin-badge","data-testid":"admin-dashboard-mode",children:h?"supabase-admin-provider":"local-admin-shell"}),e.jsxs("button",{className:"btn btn-secondary",type:"button",onClick:fe,disabled:n,"data-testid":"admin-refresh",children:[n?e.jsx(_e,{size:16,className:"spin-icon"}):e.jsx(ge,{size:16}),"Refresh"]})]})]}),e.jsxs("section",{className:"admin-status-strip","data-testid":"admin-status-strip",children:[e.jsx(B,{label:"Billing mode",value:l.billingMode}),e.jsx(B,{label:"Currency",value:l.currency}),e.jsx(B,{label:"USD / point",value:l.usdPerPoint}),e.jsx(B,{label:"Updated",value:ue.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),e.jsxs("section",{className:"admin-alert admin-alert--warning",children:[e.jsx(Ee,{size:18}),e.jsxs("div",{children:[e.jsx("strong",{children:h?"Secure admin provider ready":"Local React shell only"}),e.jsx("span",{"data-testid":"admin-last-action",children:ce})]})]}),e.jsx("nav",{className:"admin-tabs","aria-label":"Admin dashboard tabs","data-testid":"admin-tabs",children:He.map(o=>{const m=o.icon;return e.jsxs("button",{className:a===o.key?"is-active":"",type:"button",onClick:()=>pe(o.key),"data-testid":`admin-tab-${o.key}`,"data-admin-tab":o.key,children:[e.jsx(m,{size:16}),e.jsx("span",{children:o.label})]},o.key)})}),a==="overview"&&e.jsxs(e.Fragment,{children:[e.jsx(ee,{metrics:l.overviewKpis}),e.jsxs("section",{className:"admin-panel-grid admin-panel-grid--two",children:[e.jsx(x,{title:"Operating Health",metrics:l.operatingHealth}),e.jsx(x,{title:"Revenue Band",metrics:l.revenueBand})]}),e.jsxs("section",{className:"admin-panel-grid admin-panel-grid--two",children:[e.jsx(ae,{title:"Daily Signups",points:l.signupTrend}),e.jsx(ae,{title:"Daily Revenue",points:l.revenueTrend,money:!0})]}),e.jsxs("section",{className:"admin-panel-grid admin-panel-grid--three",children:[e.jsx(x,{title:"Top Referrers",metrics:$(l.referrerRows),compact:!0}),e.jsx(x,{title:"Countries",metrics:$(l.countryRows),compact:!0}),e.jsx(x,{title:"Heavy Users",metrics:$(l.heavyUserRows),compact:!0})]})]}),a==="billing"&&e.jsxs(e.Fragment,{children:[e.jsx(ee,{metrics:l.billingKpis}),e.jsxs("section",{className:"admin-panel-grid admin-panel-grid--three",children:[e.jsx(x,{title:"Webhook Status",metrics:[{label:"24h received",value:"19",tone:"ok"},{label:"24h failed",value:"1",tone:"warn"},{label:"Pending",value:"3",tone:"warn"},{label:"Last success",value:"18:41"}]}),e.jsx(x,{title:"Entitlement State",metrics:[{label:"Active",value:"28",tone:"ok"},{label:"Grace",value:"3",tone:"warn"},{label:"Suspended",value:"2",tone:"danger"},{label:"Revoked",value:"1"}]}),e.jsxs("form",{className:"admin-panel admin-settings-panel",onSubmit:he,"data-testid":"admin-settings-form",children:[e.jsxs("div",{className:"admin-panel-head",children:[e.jsx("h2",{children:"Price Controls"}),e.jsxs("button",{className:"btn btn-primary",type:"submit","data-testid":"admin-save-settings",children:[e.jsx(ke,{size:15}),"Save draft"]})]}),e.jsxs("label",{children:["Price stage",e.jsxs("select",{value:C,onChange:o=>I(o.target.value),"data-testid":"admin-price-stage",children:[e.jsx("option",{value:"STANDARD",children:"STANDARD"}),e.jsx("option",{value:"EARLY",children:"EARLY"}),e.jsx("option",{value:"LTD",children:"LTD"}),e.jsx("option",{value:"CLOSED",children:"CLOSED"})]})]}),e.jsxs("label",{children:["LTD limit",e.jsx("input",{type:"number",min:"0",value:P,onChange:o=>N(oe(o.target.value)),"data-testid":"admin-ltd-limit"})]}),e.jsxs("button",{className:"btn btn-secondary admin-danger-button",type:"button",onClick:ve,"data-testid":"admin-emergency-close",children:[e.jsx(Oe,{size:15}),"Stage emergency close"]})]})]})]}),a==="entitlements"&&e.jsx(M,{title:"Entitlements",columns:["User","Plan","Status","Renews"],rows:l.entitlementRows}),a==="dodo"&&e.jsx(M,{title:"Dodo Webhook Events",columns:["Event","Type","Status","Amount"],rows:l.webhookRows}),a==="refunds"&&e.jsx(M,{title:"Refund Reviews",columns:["User","Amount","Risk","Status"],rows:[...l.refundRows]}),a==="credits"&&e.jsx(M,{title:"Credit Ledger",columns:["Time","User","Delta","Reason"],rows:l.creditRows}),a==="limits"&&e.jsx(M,{title:"Feature Limits",columns:["Feature","Free","Pro","Status"],rows:l.featureLimitRows}),a==="funnel"&&e.jsx(ia,{rows:l.funnelRows}),a==="explorer"&&e.jsxs("section",{className:"admin-panel",children:[e.jsxs("div",{className:"admin-panel-head",children:[e.jsx("h2",{children:"User Explorer"}),e.jsx("span",{className:"admin-note",children:h?"Secure provider data":"Local sample data"})]}),e.jsxs("form",{className:"admin-search-row",onSubmit:be,"data-testid":"admin-user-search-form",children:[e.jsx("input",{"aria-label":"Search user",value:R,onChange:o=>b(o.target.value),placeholder:"email, domain, or segment","data-testid":"admin-user-query"}),e.jsxs("button",{className:"btn btn-primary",type:"submit","data-testid":"admin-user-search",children:[e.jsx(Pe,{size:15}),"Search"]})]}),i&&!w&&e.jsx("div",{className:"admin-empty","data-testid":"admin-user-empty",children:h?"No secure provider user matched that query.":"No local sample user matched that query."}),w&&e.jsxs("div",{className:"admin-user-card","data-testid":"admin-user-card",children:[e.jsx("strong",{children:w.email}),e.jsxs("span",{children:[w.plan," / ",w.country," / last seen ",w.lastSeen]}),e.jsx(x,{title:"User Snapshot",compact:!0,metrics:[{label:"Boards",value:String(w.boards)},{label:"Points",value:`${w.points}P`},{label:"Timeline",value:`${ra(w)} events`}]})]})]}),a==="release"&&e.jsx(sa,{blockers:Ze}),a==="audit"&&e.jsxs("section",{className:"admin-panel-grid admin-panel-grid--two",children:[e.jsx(oa,{}),e.jsx(M,{title:"Recent Setting Changes",columns:["Time","Admin","Action"],rows:l.auditRows.length?l.auditRows:ie,compact:!0})]})]})}function sa({blockers:t}){return e.jsxs("section",{className:"admin-release-readiness","data-testid":"admin-release-readiness-panel","data-release-ready":Q,"data-release-posture":q,"data-release-blocker-count":t.length,children:[e.jsxs("div",{className:"admin-panel-head",children:[e.jsxs("div",{children:[e.jsx("h2",{children:"Release Readiness"}),e.jsx("p",{className:"admin-release-summary",children:"Local gates are green enough for RC work, but release remains held until live proofs and explicit approval are complete."})]}),e.jsx("span",{className:"admin-badge admin-badge--hold","data-testid":"admin-release-posture",children:q})]}),e.jsxs("div",{className:"admin-release-grid",children:[e.jsx(x,{title:"Local RC State",compact:!0,metrics:[{label:"Release ready",value:Q,tone:"warn"},{label:"Posture",value:q,tone:"warn"},{label:"Blockers",value:String(t.length),tone:"warn"},{label:"Default deploy/publish",value:"blocked",tone:"ok"}]}),e.jsxs("article",{className:"admin-panel admin-panel--compact",children:[e.jsx("div",{className:"admin-panel-head",children:e.jsx("h2",{children:"Proof Packet"})}),e.jsxs("div",{className:"admin-release-command-list",children:[e.jsx("code",{children:"npm run verify:release-blocker-preflight"}),e.jsx("code",{children:"npm run verify:release-proof-packet"}),e.jsx("code",{children:"npm run check"}),e.jsx("code",{children:"npm run build"})]})]})]}),e.jsx("div",{className:"admin-release-blocker-list","data-testid":"admin-release-blocker-list",children:t.map(a=>e.jsxs("article",{className:"admin-release-blocker","data-testid":"admin-release-blocker","data-release-blocker-id":a.id,"data-release-blocker-state":a.state,children:[e.jsxs("div",{children:[e.jsx("strong",{children:a.label}),e.jsx("span",{children:a.proof})]}),e.jsxs("div",{children:[e.jsx("span",{className:"admin-release-state",children:a.state}),e.jsx("code",{children:a.command})]}),e.jsx("div",{className:"admin-release-proof-command-list","data-testid":"admin-release-proof-command-list","data-release-blocker-id":a.id,"data-release-proof-command-count":a.proofCommands.length,children:a.proofCommands.map(r=>e.jsxs("div",{className:"admin-release-proof-command","data-testid":"admin-release-proof-command","data-release-proof-command-mode":r.mode,"data-release-proof-command-live-call":String(r.liveCall),"data-release-proof-command-host-affecting":String(r.hostAffecting),"data-release-proof-command-default-gate":String(r.defaultGate),children:[e.jsx("span",{children:r.label}),e.jsx("code",{children:r.command}),e.jsxs("div",{className:"admin-release-proof-command__badges",children:[e.jsx("span",{children:r.mode}),e.jsx("span",{children:r.liveCall?"live":"local"}),e.jsx("span",{children:r.hostAffecting?"host-affecting":"host-safe"}),e.jsx("span",{children:r.defaultGate?"default-gate":"manual-only"})]})]},`${a.id}:${r.command}`))})]},a.id))})]})}function B({label:t,value:a}){return e.jsxs("div",{className:"admin-status-pill",children:[e.jsx("span",{children:t}),e.jsx("strong",{children:a})]})}function ee({metrics:t}){return e.jsx("section",{className:"admin-kpi-grid",children:t.map(a=>e.jsxs("article",{className:`admin-kpi-card ${ta(a.tone)}`,children:[e.jsx("span",{children:a.label}),e.jsx("strong",{children:a.value})]},a.label))})}function x({title:t,metrics:a,compact:r}){return e.jsxs("article",{className:`admin-panel ${r?"admin-panel--compact":""}`,children:[e.jsx("div",{className:"admin-panel-head",children:e.jsx("h2",{children:t})}),e.jsx("div",{className:"admin-metric-list",children:a.map(n=>e.jsxs("div",{className:`admin-metric-row ${n.tone?`admin-metric-row--${n.tone}`:""}`,children:[e.jsx("span",{children:n.label}),e.jsx("strong",{children:n.value})]},n.label))})]})}function ae({title:t,points:a,money:r}){return e.jsxs("article",{className:"admin-panel",children:[e.jsxs("div",{className:"admin-panel-head",children:[e.jsx("h2",{children:t}),e.jsx("span",{className:"admin-note",children:"Last 14 days"})]}),e.jsx("div",{className:"admin-mini-chart",children:a.map(n=>e.jsxs("div",{className:"admin-bar-item",children:[e.jsx("div",{className:"admin-bar",style:{height:`${aa(n.value,a)}%`}}),e.jsx("span",{children:n.label.slice(3)}),e.jsx("b",{children:r?`$${n.value}`:n.value})]},n.label))})]})}function M({title:t,columns:a,rows:r,compact:n}){return e.jsxs("section",{className:`admin-panel ${n?"admin-panel--compact":""}`,children:[e.jsx("div",{className:"admin-panel-head",children:e.jsx("h2",{children:t})}),e.jsx("div",{className:"admin-table-wrap",children:e.jsxs("table",{className:"admin-table",children:[e.jsx("thead",{children:e.jsx("tr",{children:a.map(s=>e.jsx("th",{children:s},s))})}),e.jsx("tbody",{children:r.map(s=>e.jsx("tr",{children:s.map(c=>e.jsx("td",{children:c},c))},s.join("|")))})]})})]})}function ia({rows:t}){return e.jsxs("section",{className:"admin-panel",children:[e.jsxs("div",{className:"admin-panel-head",children:[e.jsx("h2",{children:"User Funnel"}),e.jsx("span",{className:"admin-note",children:"30 day sample"})]}),e.jsx("div",{className:"admin-funnel-list",children:t.map(a=>e.jsxs("div",{className:"admin-funnel-row",children:[e.jsxs("div",{children:[e.jsx("strong",{children:a.label}),e.jsxs("span",{children:[a.count.toLocaleString()," users / ",a.rate,"%"]})]}),e.jsx("div",{className:"admin-progress-track",children:e.jsx("div",{className:"admin-progress-fill",style:{width:`${Math.min(100,a.rate)}%`}})})]},a.label))})]})}function oa(){const t=[["Paid users",28,100],["D7 retention",22,35],["AI failure rate",2,1]];return e.jsxs("article",{className:"admin-panel",children:[e.jsx("div",{className:"admin-panel-head",children:e.jsx("h2",{children:"Goal Progress"})}),e.jsx("div",{className:"admin-funnel-list",children:t.map(([a,r,n])=>{const s=a==="AI failure rate"?Math.max(8,100-Math.min(100,r/10*100)):Math.min(100,r/n*100);return e.jsxs("div",{className:"admin-funnel-row",children:[e.jsxs("div",{children:[e.jsx("strong",{children:a}),e.jsxs("span",{children:[r," / ",n]})]}),e.jsx("div",{className:"admin-progress-track",children:e.jsx("div",{className:"admin-progress-fill",style:{width:`${s}%`}})})]},a)})})]})}export{ha as AdminDashboardPage};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/supabaseAuthAdapter-DA43DeSY.js","assets/productionAdapterConfig-C5jfk6oG.js","assets/canvas-runtime-BbicBcOj.js","assets/vendor-react-BXzpOyCS.js","assets/app-runtime-xD2Z3NdN.js","assets/vendor-icons-DE3gIReG.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{g as C,A as N,a as p,_ as L,s as q,c as U}from"./index-CQMKCp-t.js";import{r as o,j as e,a as V}from"./vendor-react-BXzpOyCS.js";import{r as Y}from"./productionAdapterConfig-C5jfk6oG.js";import{R as b}from"./app-runtime-xD2Z3NdN.js";import{b2 as K,aQ as M,b9 as W,ba as x,ap as Q,aE as J,bb as X,a3 as Z,bc as ee,a_ as ne,b8 as se,b0 as ae,bd as te}from"./vendor-icons-DE3gIReG.js";const ie=[{id:"/",label:"Home",description:"MindExec product surface",icon:J},{id:"/mindcanvas",label:"MindCanvas",description:"AI execution canvas",icon:X},{id:"/planmaster",label:"PlanMaster",description:"Execution planning board",icon:Z},{id:"/tools",label:"Tools",description:"Free browser utilities",icon:ee},{id:"/youtube",label:"YouTube",description:"Video capture to canvas",icon:ne},{id:"/code",label:"Code",description:"CodeGraph workspace preview",icon:se},{id:"/pricing",label:"Pricing",description:"USD paid path",icon:M},{id:"/company-core",label:"Company Core",description:"Business operating view",icon:ae},{id:"/login",label:"Login",description:"Google sign-in shell",icon:x}];function P(a){return typeof a=="number"?`${a.toLocaleString()}P`:"Pending"}function oe(a){var d;const c=(a||"").trim();return c?(d=c[0])==null?void 0:d.toUpperCase():"M"}function re(a){return a==="supabase-provider-session"?"Supabase OAuth":a==="supabase-callback-shell"?"OAuth callback shell":a==="manual-google-shell"?"Local Google shell":"Local shell"}function ce(a){return a?a.source==="manual-google-shell"?{availablePoints:0,reservedPoints:0,mode:"Local/BYOK",description:"Local shell, BYOK, and offline work stay outside managed cloud credits."}:{availablePoints:null,reservedPoints:null,mode:"Cloud wallet",description:"Credit wallet sync is reserved for the hosted paid adapter."}:{availablePoints:null,reservedPoints:null,mode:"Sign in required",description:"Sign in to sync managed AI credits for hosted workflows."}}function ve({route:a,navigate:c,canvasActions:d=[]}){const O=d.length>0,[s,h]=o.useState(()=>C()),[l,u]=o.useState(!1),[f,j]=o.useState(!1),w=o.useRef(null),A=o.useRef(null),v=o.useMemo(()=>ce(s),[s]);o.useEffect(()=>{const n=()=>h(C());return window.addEventListener(N,n),window.addEventListener("storage",n),()=>{window.removeEventListener(N,n),window.removeEventListener("storage",n)}},[]),o.useEffect(()=>{if((s==null?void 0:s.source)==="supabase-provider-session"||!Y(p()).auth.canAttempt)return;let t=!1;return(async()=>{try{const{loadSupabaseAuthSession:r,loadSupabaseAuthSessionFromLocalBridge:m,syncSupabaseAuthSessionToLocalBridge:z}=await L(async()=>{const{loadSupabaseAuthSession:F,loadSupabaseAuthSessionFromLocalBridge:G,syncSupabaseAuthSessionToLocalBridge:H}=await import("./supabaseAuthAdapter-DA43DeSY.js");return{loadSupabaseAuthSession:F,loadSupabaseAuthSessionFromLocalBridge:G,syncSupabaseAuthSessionToLocalBridge:H}},__vite__mapDeps([0,1,2,3,4,5]));let g=await r(p());if(g.session||(g=await m(p(),"sidebar-local-bridge-session-restore")),t||!g.session)return;const D=q({...g.session,source:"supabase-provider-session"});h(D),await z(p(),"sidebar-provider-session-restore")}catch(r){b.emit("auth.accountMenu.providerRestore.warning",{message:r instanceof Error?r.message:String(r)})}})(),()=>{t=!0}},[s==null?void 0:s.source]),o.useEffect(()=>{if(!l)return;const n=i=>{var r,m;i.target instanceof Node&&((r=w.current)!=null&&r.contains(i.target)||(m=A.current)!=null&&m.contains(i.target)||u(!1))},t=i=>{i.key==="Escape"&&u(!1)};return window.addEventListener("pointerdown",n,!0),window.addEventListener("keydown",t),()=>{window.removeEventListener("pointerdown",n,!0),window.removeEventListener("keydown",t)}},[l]);const k=s?te:x,S=s?`Account: signed in as ${s.email}`:"Account: sign in with Google",_=a==="/login"||!!s,I=(s==null?void 0:s.email)??"Sign in required",R=s?re(s.source):"Not connected",y=n=>{u(!1),c(n)},B=()=>{u(n=>{const t=!n;return b.emit("auth.accountMenu.toggled",{open:t,signedIn:!!s,source:(s==null?void 0:s.source)??"none"}),t})},T=s?e.jsxs("div",{className:"account-popover-credit","data-testid":"sidebar-account-credits",children:[e.jsxs("div",{className:"account-popover-credit-title",children:[e.jsx(K,{size:15}),e.jsx("span",{children:"AI Credits"})]}),e.jsx("strong",{"data-testid":"sidebar-account-credit-available",children:P(v.availablePoints)}),e.jsx("p",{children:v.description}),e.jsxs("div",{className:"account-popover-credit-grid",children:[e.jsxs("div",{children:[e.jsx("span",{children:"Reserved"}),e.jsx("b",{"data-testid":"sidebar-account-credit-reserved",children:P(v.reservedPoints)})]}),e.jsxs("div",{children:[e.jsx("span",{children:"Mode"}),e.jsx("b",{children:v.mode})]})]})]}):null,$=async()=>{if(!f){j(!0),b.emit("auth.accountMenu.signOut.requested",{source:(s==null?void 0:s.source)??"none"});try{const{signOutSupabaseAuthSession:n}=await L(async()=>{const{signOutSupabaseAuthSession:t}=await import("./supabaseAuthAdapter-DA43DeSY.js");return{signOutSupabaseAuthSession:t}},__vite__mapDeps([0,1,2,3,4,5]));await n(p(),"sidebar-account-menu")}catch(n){b.emit("auth.accountMenu.signOut.warning",{message:n instanceof Error?n.message:String(n)})}U(),h(null),u(!1),j(!1),b.emit("auth.accountMenu.signOut.completed"),c("/")}},E=l?e.jsxs("div",{className:"sidebar-account-popover",role:"dialog","aria-label":"Account","data-testid":"sidebar-account-menu",ref:A,children:[e.jsxs("div",{className:"account-popover-head",children:[e.jsx("div",{className:"account-popover-avatar","aria-hidden":"true",children:oe(s==null?void 0:s.email)}),e.jsxs("div",{className:"account-popover-title",children:[e.jsx("span",{children:"Account"}),e.jsx("strong",{"data-testid":"sidebar-account-email",children:I}),e.jsx("small",{children:R})]})]}),T,e.jsxs("div",{className:"account-popover-actions",children:[e.jsxs("button",{className:"account-popover-action",type:"button","data-testid":"sidebar-account-pricing",onClick:()=>y("/pricing"),children:[e.jsx(M,{size:16}),e.jsx("span",{children:"Credit plans"})]}),s?e.jsxs("button",{className:"account-popover-action account-popover-action--danger",type:"button","data-testid":"sidebar-account-sign-out",disabled:f,onClick:$,children:[e.jsx(W,{size:16}),e.jsx("span",{children:f?"Signing out ...":"Sign out"})]}):e.jsxs("button",{className:"account-popover-action account-popover-action--primary",type:"button","data-testid":"sidebar-account-sign-in",onClick:()=>y("/login"),children:[e.jsx(x,{size:16}),e.jsx("span",{children:"Continue with Google"})]})]})]}):null;return e.jsxs("aside",{className:"app-sidebar","aria-label":"MindExec navigation",children:[e.jsx("button",{className:"sidebar-brand",type:"button",title:"Open MindCanvas","aria-label":"Open MindCanvas",onClick:()=>c("/mindcanvas"),children:e.jsx(Q,{size:22})}),e.jsx("div",{className:"sidebar-divider"}),e.jsx("nav",{className:"sidebar-nav",children:ie.slice(1,8).map(n=>{const t=n.icon,i=n.id===a||n.id==="/mindcanvas"&&a==="/mindmap"||n.id==="/planmaster"&&a==="/planagent"||n.id==="/tools"&&a.startsWith("/tools/")||n.id==="/"&&a==="/";return e.jsx("button",{type:"button",className:`sidebar-icon ${i?"is-active":""}`,title:`${n.label}: ${n.description}`,"aria-label":n.label,"aria-current":i?"page":void 0,onClick:()=>c(n.id),children:e.jsx(t,{size:21})},n.id)})}),e.jsx("div",{className:"sidebar-spacer"}),O&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"sidebar-divider sidebar-divider--context"}),e.jsx("nav",{className:"sidebar-nav sidebar-nav--context","aria-label":"MindCanvas quick actions",children:d.map(n=>{const t=n.icon;return e.jsx("button",{type:"button",className:`sidebar-icon sidebar-icon--context ${n.active?"is-active":""}`,title:`${n.label}: ${n.description}`,"aria-label":n.label,"aria-pressed":n.active?"true":void 0,"data-testid":n.testId,onClick:n.onClick,children:e.jsx(t,{size:20})},n.id)})})]}),e.jsxs("div",{className:"sidebar-account-wrap",ref:w,children:[e.jsx("button",{className:`sidebar-icon ${_?"is-active":""}`,type:"button",title:S,"aria-label":S,"aria-haspopup":"dialog","aria-expanded":l,"data-testid":"sidebar-account","data-auth-session-active":s?"true":"false","data-auth-session-source":(s==null?void 0:s.source)??"none",onClick:B,children:e.jsx(k,{size:20})}),l&&(typeof document<"u"?V.createPortal(E,document.body):E)]})]})}export{ve as AppSidebar};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.auth-page{min-height:100vh;display:grid;place-items:center;padding-left:56px;background:radial-gradient(circle at 50% 0%,rgba(37,99,235,.16),transparent 42%),radial-gradient(circle at 82% 72%,rgba(15,23,42,.08),transparent 36%),#f1f5f9b8}.auth-scrim{position:fixed;top:0;right:0;bottom:0;left:0;background:transparent;cursor:default}.auth-card{position:relative;z-index:1;width:min(440px,calc(100vw - 96px));padding:32px;border:1px solid rgba(226,232,240,.95);border-radius:30px;background:#fffffff7;box-shadow:0 30px 80px #0f172a2e,0 12px 28px #0f172a1a;text-align:center}.auth-close{position:absolute;top:16px;right:16px;width:34px;height:34px;border-radius:999px;color:#64748b;background:#f8fafc;cursor:pointer}.auth-close,.auth-back,.auth-action-strip button,.auth-icon-button{display:inline-flex;align-items:center;justify-content:center}.auth-back{width:fit-content;gap:8px;margin-bottom:16px;padding:8px 10px;border-radius:9px;color:#475569;background:#f8fafc;cursor:pointer;font-size:13px;font-weight:820}.auth-logo{display:inline-flex;align-items:center;gap:12px;margin-bottom:20px;font-size:24px}.auth-logo svg{width:48px;height:48px;padding:12px;border-radius:14px;color:#fff;background:linear-gradient(135deg,#0f172a,#2563eb);box-shadow:0 14px 30px #2563eb47}.auth-card h1{margin:0 0 10px;font-size:28px;line-height:1.1}.auth-card p{color:#64748b;line-height:1.6}.auth-mark{width:64px;height:64px;display:inline-flex;align-items:center;justify-content:center;margin-bottom:18px;border-radius:16px;color:#2563eb;background:#dbeafe}.auth-mark--amber{color:#b45309;background:#fef3c7}.auth-mark--success{color:#047857;background:#d1fae5}.google-button{width:100%;min-height:56px;display:inline-flex;align-items:center;justify-content:center;gap:12px;margin-top:18px;border:1px solid #cbd5e1;border-radius:14px;color:#111827;background:#fff;cursor:pointer;font-weight:850}.google-g{color:#4285f4;font-weight:920}.auth-note{margin-bottom:0;font-size:12px}.auth-action-strip{display:flex;justify-content:center;gap:10px;margin-top:14px}.auth-action-strip button{min-height:34px;padding:0 10px;border:1px solid rgba(203,213,225,.82);border-radius:9px;color:#334155;background:#fff;cursor:pointer;font-size:13px;font-weight:760}.auth-action-strip button:disabled{opacity:.55;cursor:not-allowed}.auth-form{display:grid;gap:16px;margin-top:20px;text-align:left}.auth-form label{display:grid;gap:7px;color:#334155;font-size:14px;font-weight:780}.auth-input-wrap{position:relative;display:flex;align-items:center}.auth-input-wrap>svg{position:absolute;left:13px;color:#64748b;pointer-events:none}.auth-input-wrap input{width:100%;min-height:48px;padding:0 46px 0 42px;border:1px solid rgba(148,163,184,.48);border-radius:9px;color:#0f172a;background:#fff}.auth-input-wrap input:focus{outline:none;border-color:#2563ebb8;box-shadow:0 0 0 4px #2563eb1a}.auth-icon-button{position:absolute;right:8px;width:32px;height:32px;border-radius:9px;color:#64748b;background:#f1f5f9;cursor:pointer}.auth-submit{width:100%;margin-top:4px}.auth-inline-error{margin-top:14px;padding:12px;border:1px solid #fecaca;border-radius:9px;color:#b91c1c;background:#fef2f2;font-size:13px;font-weight:760;text-align:left}.auth-success-panel{display:grid;justify-items:center;gap:10px;margin-top:18px;padding:18px;border:1px solid rgba(16,185,129,.24);border-radius:9px;color:#047857;background:#ecfdf5}.auth-success-panel span{color:#475569;font-size:13px;line-height:1.5}.auth-requirement{color:#94a3b8;font-size:12px;font-weight:760}.auth-requirement.is-met{color:#047857}.auth-requirement.is-error{color:#b91c1c}@media(max-width:640px){.auth-page{padding-left:48px}.auth-card{width:min(440px,calc(100vw - 68px));padding:26px 20px;border-radius:18px}.auth-action-strip{flex-direction:column}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r,j as e}from"./vendor-react-BXzpOyCS.js";import{g as C,a as b,s as q,b as K,p as F,c as R,d as G}from"./index-CQMKCp-t.js";import{p as L,P as U}from"./pricingCheckoutShell-O-DnwmbU.js";import{r as O}from"./productionAdapterConfig-C5jfk6oG.js";import{R as w}from"./app-runtime-xD2Z3NdN.js";import{syncSupabaseAuthSessionToLocalBridge as T,loadSupabaseAuthSession as _,loadSupabaseAuthSessionFromLocalBridge as D,buildSupabaseAuthRedirectUrl as I,startSupabaseGoogleOAuth as H,signOutSupabaseAuthSession as Y,requestSupabasePasswordReset as V,updateSupabasePassword as W}from"./supabaseAuthAdapter-DA43DeSY.js";import{X,ak as J,ab as Q,aR as z,ad as $,f as Z,aS as k,K as B,aT as ee,a7 as te}from"./vendor-icons-DE3gIReG.js";import"./canvas-runtime-BbicBcOj.js";function se(o){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.trim())}function S(){return O(b())}function P(o,a,c=!1){return o.source==="supabase-provider-session"?a?`Google sign-in is active for ${o.email}. Return to pricing to continue checkout.`:`Google sign-in is active for ${o.email}.`:c?a?"A local auth shell exists, but secure Google sign-in is required before checkout can continue.":"A local auth shell exists, but secure Google sign-in is required before MindCanvas can sync remote services.":a?"A local Google auth shell is active. Return to pricing to continue checkout.":"A local Google auth shell is already active for this browser."}function M(o,a){return a?`Local Google auth shell ready for ${o}. Return to pricing to continue the gated checkout.`:`Local Google auth shell ready for ${o}. Secure Supabase OAuth can replace this adapter later.`}function de({navigate:o}){const[a,c]=r.useState(!1),[t,h]=r.useState(()=>C()),[i]=r.useState(()=>L()),l=r.useMemo(()=>S(),[]),[x,u]=r.useState(()=>{const s=C(),n=L();return s?P(s,!!n,S().auth.canAttempt):n?"Sign in to continue MindCanvas Pro checkout. Payment remains gated until the secure adapter is connected.":"Use your Google account to sync cloud projects. No password to create or remember."});r.useEffect(()=>{if((t==null?void 0:t.source)==="supabase-provider-session"||!l.auth.canAttempt)return;let s=!1;return(async()=>{try{let d=await _(b());if(d.session||(d=await D(b(),"login-local-bridge-session-restore")),s||!d.session)return;const E=q({...d.session,source:"supabase-provider-session"});h(E),u(P(E,!!i,l.auth.canAttempt))}catch(d){w.emit("auth.supabase.sessionRestore.uiFailed",{message:d instanceof Error?d.message:String(d)})}})(),()=>{s=!0}},[i,l.auth.canAttempt,t==null?void 0:t.source]),r.useEffect(()=>{(t==null?void 0:t.source)!=="supabase-provider-session"||!l.auth.canAttempt||T(b(),"login-existing-session")},[l.auth.canAttempt,t==null?void 0:t.email,t==null?void 0:t.source]);const m=()=>{const s=C();if(s)return h(s),u(P(s,!!i,l.auth.canAttempt)),s;const n=G();return h(n),u(M(n.email,!!i)),n},g=async()=>{const s=m();s.source==="supabase-provider-session"&&await T(b(),"login-continue");const n={hasCheckoutIntent:!!i,signedIn:!!s,sessionSource:s.source};i?w.emit("auth.returnToPricing",n):w.emit("auth.continueMindCanvas",n),o(i?"/pricing":"/mindcanvas")},f=()=>{const s=G();h(s),u(M(s.email,!!i)),c(!1),window.setTimeout(()=>{g()},240)},p=async()=>{c(!0);const s=await F();if(O(s).auth.canAttempt)try{const d=I("/login",i?"/pricing":"/mindcanvas");u("Opening secure Google sign-in..."),(t==null?void 0:t.source)!=="supabase-provider-session"&&(R(),h(null)),await H(s,d);return}catch(d){u(`Secure Google sign-in failed: ${d instanceof Error?d.message:String(d)}`),c(!1);return}window.setTimeout(()=>{f()},550)},j=!!(t&&(!l.auth.canAttempt||t.source==="supabase-provider-session")),y=j?i?"Continue checkout":"Continue to MindCanvas":a?"Opening Google...":"Continue with Google",v=j?g:p,A=async()=>{c(!0),u("Signing out...");let s="";try{await Y(b(),"login-sign-out")}catch(n){s=n instanceof Error?n.message:String(n),w.emit("auth.signOut.uiFailed",{message:s})}R(),h(null),u(s?`Signed out locally. Provider sign-out warning: ${s}`:i?"Signed out. Choose another Google account to continue checkout.":"Signed out. Choose another Google account to continue."),c(!1)};return e.jsxs(N,{page:"login",children:[e.jsx("button",{className:"auth-close",type:"button",title:"Close",onClick:()=>o("/mindcanvas"),"data-testid":"auth-close",children:e.jsx(X,{size:16})}),e.jsxs("div",{className:"auth-logo",children:[e.jsx(J,{size:24}),e.jsx("strong",{children:"MindExec"})]}),e.jsx("h1",{children:"Sign in with Google"}),e.jsx("p",{"data-testid":"auth-message",children:x}),e.jsxs("button",{className:"google-button",type:"button",disabled:a,onClick:v,"data-testid":"auth-google-shell",children:[e.jsx("span",{className:"google-g",children:"G"}),y]}),e.jsxs("div",{className:"auth-action-strip",children:[t&&i&&e.jsx("button",{type:"button",onClick:()=>void g(),"data-testid":"auth-return-pricing",children:"Return to pricing"}),t&&e.jsx("button",{type:"button",disabled:a,onClick:()=>void A(),"data-testid":"auth-sign-out",children:"Sign out"}),e.jsx("button",{type:"button",onClick:()=>o("/forgot-password"),"data-testid":"auth-forgot-password",children:"Forgot password"}),e.jsx("button",{type:"button",onClick:()=>o("/pricing"),"data-testid":"auth-view-pricing",children:"View pricing"})]}),e.jsx("p",{className:"auth-note",children:l.auth.canAttempt?"Secure Supabase OAuth is connected for this browser build.":"The React port keeps this as a local auth shell until the secure Supabase OAuth adapter is connected."})]})}function he({navigate:o}){const[a,c]=r.useState(""),[t,h]=r.useState(!1),[i,l]=r.useState(""),[x,u]=r.useState(!1),m=r.useMemo(()=>S(),[]),g=async f=>{if(f.preventDefault(),!se(a)){l("Enter a valid email address.");return}if(h(!0),l(""),m.passwordReset.canAttempt){try{const p=I("/reset-password","/login");await V(b(),a,p),u(!0),h(!1),w.emit("auth.reset.requested",{emailDomain:a.split("@")[1]||"",provider:"supabase"})}catch(p){l(p instanceof Error?p.message:String(p)),h(!1)}return}window.setTimeout(()=>{u(!0),h(!1),w.emit("auth.reset.requested",{emailDomain:a.split("@")[1]||""})},450)};return e.jsxs(N,{page:"forgot-password",children:[e.jsxs("button",{className:"auth-back",type:"button",onClick:()=>o("/login"),"data-testid":"forgot-back-login",children:[e.jsx(Q,{size:16}),"Sign in"]}),e.jsx("div",{className:"auth-mark auth-mark--amber",children:e.jsx(z,{size:28})}),e.jsx("h1",{children:"Forgot password?"}),e.jsx("p",{children:"No worries. Enter your email and the React auth shell will walk through the reset flow."}),i&&e.jsx("div",{className:"auth-inline-error","data-testid":"forgot-error",children:i}),x?e.jsxs("div",{className:"auth-success-panel","data-testid":"forgot-success",children:[e.jsx($,{size:32}),e.jsx("strong",{children:"Check your email"}),e.jsxs("span",{children:["Reset instructions were prepared for ",a,"."]}),e.jsx("button",{className:"btn btn-primary",type:"button",onClick:()=>o("/reset-password"),"data-testid":"forgot-continue-reset",children:"Continue to reset"})]}):e.jsxs("form",{className:"auth-form",onSubmit:g,"data-testid":"forgot-password-form",children:[e.jsxs("label",{children:[e.jsx("span",{children:"Email Address"}),e.jsxs("div",{className:"auth-input-wrap",children:[e.jsx(z,{size:18}),e.jsx("input",{value:a,onChange:f=>c(f.target.value),type:"email",placeholder:"you@example.com","data-testid":"forgot-email"})]})]}),e.jsxs("button",{className:"btn btn-primary auth-submit",type:"submit",disabled:t,"data-testid":"forgot-submit",children:[e.jsx(Z,{size:16}),t?"Sending...":"Send Reset Link"]})]})]})}function pe({navigate:o}){const[a,c]=r.useState(""),[t,h]=r.useState(""),[i,l]=r.useState(!1),[x,u]=r.useState(!1),[m,g]=r.useState(!1),[f,p]=r.useState(""),j=r.useMemo(()=>S(),[]),y=r.useMemo(()=>a.length>=6&&a===t,[t,a]),v=t.length>0&&t!==a,A=async s=>{if(s.preventDefault(),a.length<6){p("Password must be at least 6 characters.");return}if(a!==t){p("Passwords do not match.");return}if(u(!0),p(""),j.passwordReset.canAttempt){try{await W(b(),a),g(!0),u(!1),w.emit("auth.password.updated",{provider:"supabase"})}catch(n){p(n instanceof Error?n.message:String(n)),u(!1)}return}window.setTimeout(()=>{g(!0),u(!1),w.emit("auth.password.updated",{localShell:!0})},520)};return e.jsxs(N,{page:"reset-password",children:[e.jsx("div",{className:`auth-mark ${m?"auth-mark--success":""}`,children:m?e.jsx($,{size:30}):e.jsx(k,{size:30})}),e.jsx("h1",{children:m?"Password reset!":"Reset password"}),e.jsx("p",{"data-testid":"reset-message",children:m?"Your local auth shell accepted the new password state.":"Enter a new password and confirm it below."}),f&&e.jsx("div",{className:"auth-inline-error","data-testid":"reset-error",children:f}),m?e.jsxs("button",{className:"btn btn-primary auth-submit",type:"button",onClick:()=>o("/login"),"data-testid":"reset-login",children:[e.jsx(B,{size:16}),"Sign In"]}):e.jsxs("form",{className:"auth-form",onSubmit:A,"data-testid":"reset-password-form",children:[e.jsxs("label",{children:[e.jsx("span",{children:"New Password"}),e.jsxs("div",{className:"auth-input-wrap",children:[e.jsx(k,{size:18}),e.jsx("input",{value:a,onChange:s=>c(s.target.value),type:i?"text":"password",placeholder:"Enter new password","data-testid":"reset-password-input"}),e.jsx("button",{type:"button",className:"auth-icon-button",title:"Toggle password visibility",onClick:()=>l(s=>!s),"data-testid":"reset-toggle-visibility",children:i?e.jsx(ee,{size:17}):e.jsx(te,{size:17})})]}),e.jsx("span",{className:`auth-requirement ${a.length>=6?"is-met":""}`,children:"At least 6 characters"})]}),e.jsxs("label",{children:[e.jsx("span",{children:"Confirm Password"}),e.jsxs("div",{className:"auth-input-wrap",children:[e.jsx(k,{size:18}),e.jsx("input",{value:t,onChange:s=>h(s.target.value),type:"password",placeholder:"Confirm new password","data-testid":"reset-confirm-input"})]}),t&&e.jsx("span",{className:`auth-requirement ${v?"is-error":"is-met"}`,children:v?"Passwords do not match":"Passwords match"})]}),e.jsxs("button",{className:"btn btn-primary auth-submit",type:"submit",disabled:!y||x,"data-testid":"reset-submit",children:[e.jsx(B,{size:16}),x?"Updating...":"Update Password"]})]})]})}function N({children:o,page:a}){const c=S();return e.jsxs("div",{className:"auth-page","data-testid":"auth-shell","data-auth-page":a,"data-auth-storage-key":K,"data-pricing-checkout-intent-key":U,"data-production-adapter-state":c.overallState,"data-auth-provider-mode":c.auth.mode,"data-auth-provider-ready":c.auth.canAttempt?"true":"false","data-client-secret-blocked":c.forbiddenClientSecretKeys.length>0?"true":"false",children:[e.jsx("div",{className:"auth-scrim"}),e.jsx("section",{className:"auth-card",children:o})]})}export{he as ForgotPasswordPage,de as LoginPage,pe as ResetPasswordPage};
|