diff --git a/.env.example b/.env.example new file mode 100644 index 0000000000000000000000000000000000000000..a05cf7da1bfe23f89a1142563528c859cb68f3a6 --- /dev/null +++ b/.env.example @@ -0,0 +1,47 @@ +# AlgoSpaced-DSA-Review — Environment Variables Template +# Copy this file to .env and fill in your actual credentials. +# Do NOT commit .env with real secrets to version control. + +# ========================================== +# 1. Multi-Provider AI Keys (Spaced Repetition & Reviews) +# ========================================== +# Primary AI Provider: Google Gemini +GEMINI_API_KEY=your_gemini_api_key_here + +# Fallback AI Provider 1: Groq (Llama 3.3 / Qwen) +GROQ_API_KEY=your_groq_api_key_here + +# Fallback AI Provider 2: OpenRouter +OPENROUTER_API_KEY=your_openrouter_api_key_here + +# ========================================== +# 2. Firebase Public Client Configuration (Auth & UI) +# ========================================== +FIREBASE_API_KEY=your_firebase_api_key_here +FIREBASE_AUTH_DOMAIN=your-app.firebaseapp.com +FIREBASE_PROJECT_ID=your-project-id +FIREBASE_STORAGE_BUCKET=your-project-id.appspot.com +FIREBASE_MESSAGING_SENDER_ID=your_sender_id +FIREBASE_APP_ID=your_app_id +FIREBASE_MEASUREMENT_ID=your_measurement_id + +# ========================================== +# 3. Google Cloud / Firebase Admin Service Accounts (Backend Firestore & Storage) +# ========================================== +# Path to service account JSON file (relative to root or absolute) +FIREBASE_CREDENTIALS_PATH=firebase-credentials.json + +# Optional: Raw JSON string alternative for cloud container deployments (e.g. Hugging Face Spaces) +# FIREBASE_SERVICE_ACCOUNT_JSON={"type": "service_account", ...} + +# ========================================== +# 4. Google Drive & Docs Sync Integration (Problem Dual-Write) +# ========================================== +# Path to Google Cloud Service Account credentials with Drive / Docs API access +GCP_CREDENTIALS_PATH=gcp-credentials.json +GDRIVE_FOLDER_ID=your_google_drive_folder_id_here + +# ========================================== +# 5. Server Runtime +# ========================================== +PORT=8000 diff --git a/.gitignore b/.gitignore index f94e36ecb45fc4fcd59fd5ccd4aedf12b45e1931..b7bf18705dcf4273e5b805b433b8bcf74dc8a5b2 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ __pycache__/ *.pyo *.pyd +.pytest_cache/ # Local SQLite databases and logs *.db scratch/ @@ -19,6 +20,8 @@ sandbox.db sync.log debug_cookies.txt debug_db.txt +data/companion_telemetry*.json +companion_telemetry*.json .ruff_cache/ # Node dependencies @@ -26,7 +29,7 @@ node_modules/ algospaced-ui/node_modules/ # Local configuration and secrets -.streamlit/secrets.toml +.streamlit/ .env .env.local .env.*.local diff --git a/.python-version b/.python-version index 6324d401a069f4020efcf0ff07442724b52f47c2..9b8fe2fbb8568ac60fa11a56ed0e7c3334fd23b0 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -3.14 +3.14.8 diff --git a/.streamlit/secrets.toml.example b/.streamlit/secrets.toml.example deleted file mode 100644 index 7a13dd67dc10c0976f2f44c3bf328ae8de109562..0000000000000000000000000000000000000000 --- a/.streamlit/secrets.toml.example +++ /dev/null @@ -1,17 +0,0 @@ -# .streamlit/secrets.toml - -GEMINI_API_KEY = "your_gemini_api_key_here" -GDRIVE_FOLDER_ID = "your_gdrive_folder_id_here" - -# Contents of your google-credentials.json -[gcp_service_account] -type = "service_account" -project_id = "..." -private_key_id = "..." -private_key = "..." -client_email = "..." -client_id = "..." -auth_uri = "https://accounts.google.com/o/oauth2/auth" -token_uri = "https://oauth2.googleapis.com/token" -auth_provider_x509_cert_url = "https://www.googleapis.com/oauth2/v1/certs" -client_x509_cert_url = "..." diff --git a/ai_cache.py b/ai_cache.py index 0242d8b8914b2b5bdb03b2e4c8085557ee59c7b4..6e87c7a290be83011d05d21bfeb959438d556a9c 100644 --- a/ai_cache.py +++ b/ai_cache.py @@ -222,4 +222,3 @@ def set_leetcode_intuition(slug_or_title: str, data: dict[str, Any]): async def set_leetcode_intuition_async(slug_or_title: str, data: dict[str, Any]): slug = normalize_slug(slug_or_title) await set_cached_item_async(f"leetcode_intuition_{slug}", data, ttl_seconds=86400 * 90) - diff --git a/ai_provider.py b/ai_provider.py index 9d88a68b002c620e47e2c09ff5629a6efe1525aa..22abbd6a38901028be5126c4a4688eef1382cf53 100644 --- a/ai_provider.py +++ b/ai_provider.py @@ -535,8 +535,12 @@ async def call_gemini_async( return parts[0].get("text", "") else: err_text = resp.text[:300] - last_err = RuntimeError(f"Gemini {model_name} HTTP {resp.status_code}: {err_text}") - logger.warning(f"Gemini async REST model {model_name} returned {resp.status_code}: {err_text}") + last_err = RuntimeError( + f"Gemini {model_name} HTTP {resp.status_code}: {err_text}" + ) + logger.warning( + f"Gemini async REST model {model_name} returned {resp.status_code}: {err_text}" + ) except Exception as e: last_err = e continue @@ -639,8 +643,12 @@ async def call_groq_async( return content else: err_text = resp.text[:300] - last_err = RuntimeError(f"Groq {model_name} HTTP {resp.status_code}: {err_text}") - logger.warning(f"Groq async model {model_name} returned {resp.status_code}: {err_text}") + last_err = RuntimeError( + f"Groq {model_name} HTTP {resp.status_code}: {err_text}" + ) + logger.warning( + f"Groq async model {model_name} returned {resp.status_code}: {err_text}" + ) except Exception as e: last_err = e logger.warning(f"Groq async model {model_name} failed: {e}") @@ -697,8 +705,12 @@ async def call_openrouter_async( return content else: err_text = resp.text[:300] - last_err = RuntimeError(f"OpenRouter {model_name} HTTP {resp.status_code}: {err_text}") - logger.warning(f"OpenRouter async model {model_name} returned {resp.status_code}: {err_text}") + last_err = RuntimeError( + f"OpenRouter {model_name} HTTP {resp.status_code}: {err_text}" + ) + logger.warning( + f"OpenRouter async model {model_name} returned {resp.status_code}: {err_text}" + ) except Exception as e: last_err = e logger.warning(f"OpenRouter async model {model_name} failed: {e}") diff --git a/algospaced-ui/.gitignore b/algospaced-ui/.gitignore index 234f2f1beb6f684af9f47861d3a04652e31f23e4..944cfe806618c19115aa332f840fd3adb1539bd5 100644 --- a/algospaced-ui/.gitignore +++ b/algospaced-ui/.gitignore @@ -10,6 +10,13 @@ lerna-debug.log* node_modules *.local +# Environment variables +.env +.env.local +.env.*.local +.env.production +.env.development + # Editor directories and files .vscode/* !.vscode/extensions.json diff --git a/algospaced-ui/dist/assets/Auth-B-5KpNfK.js b/algospaced-ui/dist/assets/Auth-B-5KpNfK.js deleted file mode 100644 index 1067f6baf69c79095828bc97f324b72d56475f46..0000000000000000000000000000000000000000 --- a/algospaced-ui/dist/assets/Auth-B-5KpNfK.js +++ /dev/null @@ -1 +0,0 @@ -import{r as e}from"./rolldown-runtime-hePW80VL.js";import{A as t,Lt as n,Tt as r,U as i,V as a,q as o,s,x as c,yt as l,zt as u}from"./vendor-react-qmUj3JUi.js";import{t as d}from"./firebaseClient-G7klkuBb.js";var f=e(u(),1),p=n();function m(){let[e,n]=(0,f.useState)(!1),[u,m]=(0,f.useState)(``),[h,g]=(0,f.useState)(``),[_,v]=(0,f.useState)(``),[y,b]=(0,f.useState)(!1),[x,S]=(0,f.useState)(!1),[C,w]=(0,f.useState)(null),T=h.length>=8,E=/[A-Z]/.test(h),D=/[a-z]/.test(h),O=/[0-9]/.test(h),k=/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?~`]/.test(h),A=h.length>0&&h===_,j=T&&E&&D&&O&&k;return(0,p.jsxs)(`div`,{className:`fixed inset-0 w-full h-full max-h-[100dvh] overflow-y-auto overscroll-contain custom-scrollbar flex flex-col items-center px-3 pt-3 pb-8 sm:px-4 sm:py-6 md:p-8 relative isolate selection:bg-highlight-pink selection:text-white`,children:[(0,p.jsx)(`div`,{className:`fixed inset-0 w-full h-full bg-cover bg-center z-0 saturate-150 contrast-125 pointer-events-none`,style:{backgroundImage:`url('/wallpapers/default.webp')`}}),(0,p.jsxs)(`div`,{className:`w-full max-w-md bg-paper-white border-[4px] border-ink-black window-shadow z-10 flex flex-col overflow-hidden shadow-[inset_2px_2px_0px_rgba(255,255,255,0.8)] relative my-auto shrink-0`,children:[(0,p.jsx)(`div`,{className:`bg-[#0ea5e9] border-b-[4px] border-ink-black px-3 sm:px-4 py-2 sm:py-2.5 flex justify-between items-center text-ink-black select-none`,children:(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`material-symbols-outlined select-none text-base sm:text-xl`,style:{fontVariationSettings:`'FILL' 1`},children:`sports_esports`}),(0,p.jsx)(`span`,{className:`font-window-title text-xs sm:text-base font-bold tracking-wide`,children:`System_Setup.exe`})]})}),(0,p.jsxs)(`div`,{className:`p-4 sm:p-6 bg-[#fdf8e1] flex-1 flex flex-col`,children:[typeof window<`u`&&window.self!==window.top&&(0,p.jsxs)(`div`,{className:`mb-4 sm:mb-5 p-3 sm:p-3.5 border-[3px] border-[#ea580c] bg-[#ffedd5] text-[#9a3412] text-xs font-bold font-arcade leading-relaxed shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[`⚠️ RUNNING INSIDE IFRAME`,(0,p.jsx)(`p`,{className:`mt-1 font-sans text-[11px] font-normal text-ink-black normal-case leading-normal`,children:`If Google Sign-In popup is restricted inside Hugging Face wrapper, open the standalone link below:`}),(0,p.jsx)(`a`,{href:`https://iamfebin-algospaced-dsa.hf.space/`,target:`_top`,className:`mt-2.5 inline-block w-full text-center bg-[#ea580c] hover:bg-[#c2410c] text-white border-[2.5px] border-ink-black py-1.5 px-3 rounded-lg font-window-title text-xs font-bold transition-all shadow-[1.5px_1.5px_0px_rgba(0,0,0,1)] active:translate-y-0.5 active:shadow-none`,children:`OPEN FULLSCREEN / DIRECT SITE`})]}),(0,p.jsxs)(`div`,{className:`flex flex-col items-center mb-4 sm:mb-6`,children:[(0,p.jsx)(`div`,{className:`w-12 h-12 sm:w-16 sm:h-16 bg-paper-white border-[3px] border-ink-black flex items-center justify-center gadget-shadow shadow-[inset_2px_2px_0px_rgba(255,255,255,0.8)] mb-2.5 sm:mb-4`,children:(0,p.jsx)(c,{className:`w-7 h-7 sm:w-9 sm:h-9 text-primary`})}),(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`h2`,{className:`text-2xl sm:text-3xl font-extrabold tracking-tight text-ink-black font-headline-md leading-none m-0`,children:`AlgoSpaced`}),(0,p.jsx)(`span`,{className:`text-[9px] sm:text-[10px] font-arcade bg-[#facc15] text-ink-black font-extrabold px-1.5 sm:px-2 py-0.5 border-[2px] border-ink-black shadow-[2px_2px_0px_0px_#1E293B] uppercase rotate-[-3deg]`,children:`BETA`})]}),(0,p.jsx)(`p`,{className:`text-[10px] sm:text-xs font-arcade text-trash-gray mt-1.5 sm:mt-2 tracking-wide uppercase text-center`,children:`Spaced Repetition for DSA`})]}),(0,p.jsxs)(`div`,{className:`flex gap-2 mb-4 sm:mb-6 font-arcade text-[9px] sm:text-[10px]`,children:[(0,p.jsx)(`button`,{onClick:()=>{n(!1),w(null)},className:`flex-1 py-2 sm:py-2.5 border-[3px] border-ink-black cursor-pointer font-bold tracking-wider outline-none transition-all shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:shadow-none active:translate-y-0.5 ${e?`bg-white text-slate-700 hover:bg-surface-container`:`bg-secondary-container text-ink-black translate-y-0.5 shadow-[1px_1px_0px_0px_rgba(30,41,59,1)]`}`,children:`SIGN IN`}),(0,p.jsx)(`button`,{onClick:()=>{n(!0),w(null)},className:`flex-1 py-2 sm:py-2.5 border-[3px] border-ink-black cursor-pointer font-bold tracking-wider outline-none transition-all shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:shadow-none active:translate-y-0.5 ${e?`bg-secondary-container text-ink-black translate-y-0.5 shadow-[1px_1px_0px_0px_rgba(30,41,59,1)]`:`bg-white text-slate-700 hover:bg-surface-container`}`,children:`CREATE ACCOUNT`})]}),C&&(0,p.jsxs)(`div`,{className:`mb-4 sm:mb-6 p-3 sm:p-4 border-[3px] border-ink-black text-xs font-arcade leading-relaxed ${C.type===`error`?`bg-red-100 border-red-500 text-error shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`:C.type===`unverified`?`bg-amber-100 border-amber-500 text-amber-900 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`:`bg-emerald-100 border-emerald-500 text-emerald-700 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`}`,children:[(0,p.jsx)(`p`,{children:C.text}),C.type===`unverified`&&(0,p.jsxs)(`button`,{type:`button`,onClick:async()=>{if(!u.trim()||!h){w({type:`error`,text:`Please enter your email and password above to resend the verification link.`});return}try{S(!0),await d.resendVerificationEmail(u.trim(),h),w({type:`success`,text:`Verification email resent to ${u.trim()}! Please check your inbox and spam folder.`})}catch(e){w({type:`error`,text:e.message||`Failed to resend verification email. Check your credentials.`})}finally{S(!1)}},disabled:x,className:`mt-3 w-full bg-amber-500 hover:bg-amber-600 text-white font-window-title text-xs font-bold py-2 px-3 border-[2px] border-ink-black rounded flex items-center justify-center gap-2 cursor-pointer shadow-[2px_2px_0px_0px_rgba(0,0,0,1)] active:translate-y-0.5 active:shadow-none uppercase disabled:opacity-50`,children:[(0,p.jsx)(t,{className:`w-3.5 h-3.5 ${x?`animate-spin`:``}`}),x?`SENDING LINK...`:`RESEND VERIFICATION EMAIL`]})]}),(0,p.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault(),b(!0),w(null);let r=u.trim();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r)){w({type:`error`,text:`Please enter a valid email address.`}),b(!1);return}if(e){if(!j){w({type:`error`,text:`Password does not meet the security criteria. Please check the requirements below.`}),b(!1);return}if(h!==_){w({type:`error`,text:`Passwords do not match. Please re-enter.`}),b(!1);return}try{await d.signUpWithEmail(r,h),w({type:`success`,text:`Registration successful! A verification link has been sent to your email. Please verify your email before logging in.`}),n(!1),g(``),v(``)}catch(e){let t=e,n=t.message||`An error occurred during registration.`;t.code===`auth/email-already-in-use`?n=`This email address is already registered. Please sign in instead.`:t.code===`auth/invalid-email`?n=`The email address format is invalid.`:t.code===`auth/weak-password`&&(n=`Firebase requires a stronger password.`),w({type:`error`,text:n})}finally{b(!1)}}else try{await d.signInWithEmail(r,h)}catch(e){let t=e;if(t.code===`auth/email-not-verified`)w({type:`unverified`,text:`Your email address is not verified yet. Please check your inbox for the activation link.`});else{let e=t.message||`An error occurred during sign in.`;t.code===`auth/invalid-credential`||t.code===`auth/user-not-found`||t.code===`auth/wrong-password`?e=`Invalid email or password. Please check your credentials.`:t.code===`auth/too-many-requests`&&(e=`Access temporarily locked due to many failed attempts. Try again later or reset password.`),w({type:`error`,text:e})}}finally{b(!1)}},className:`space-y-3 sm:space-y-4`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{htmlFor:`auth-email`,className:`block text-[11px] sm:text-xs font-bold text-ink-black uppercase tracking-wider mb-1.5 sm:mb-2 font-headline-md`,children:`Email Address`}),(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(a,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 sm:w-4 sm:h-4 text-ink-black`}),(0,p.jsx)(`input`,{id:`auth-email`,type:`email`,required:!0,value:u,onChange:e=>m(e.target.value),placeholder:`name@arcade.com`,"aria-label":`Email Address`,className:`w-full bg-white border-[3px] border-ink-black rounded-lg py-2 sm:py-2.5 pl-9 sm:pl-10 pr-3 sm:pr-4 text-ink-black placeholder-trash-gray focus:outline-none focus:bg-white text-xs sm:text-sm font-code-mono shadow-[inset_2px_2px_0px_rgba(0,0,0,0.1)]`})]})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{htmlFor:`auth-password`,className:`block text-[11px] sm:text-xs font-bold text-ink-black uppercase tracking-wider mb-1.5 sm:mb-2 font-headline-md`,children:`Password`}),(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(i,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 sm:w-4 sm:h-4 text-ink-black`}),(0,p.jsx)(`input`,{id:`auth-password`,type:`password`,required:!0,value:h,onChange:e=>g(e.target.value),placeholder:`••••••••`,"aria-label":`Password`,className:`w-full bg-white border-[3px] border-ink-black rounded-lg py-2 sm:py-2.5 pl-9 sm:pl-10 pr-3 sm:pr-4 text-ink-black placeholder-trash-gray focus:outline-none focus:bg-white text-xs sm:text-sm font-code-mono shadow-[inset_2px_2px_0px_rgba(0,0,0,0.1)]`})]})]}),e&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{htmlFor:`auth-confirm-password`,className:`block text-[11px] sm:text-xs font-bold text-ink-black uppercase tracking-wider mb-1.5 sm:mb-2 font-headline-md`,children:`Confirm Password`}),(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(o,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 sm:w-4 sm:h-4 text-ink-black`}),(0,p.jsx)(`input`,{id:`auth-confirm-password`,type:`password`,required:!0,value:_,onChange:e=>v(e.target.value),placeholder:`••••••••`,"aria-label":`Confirm Password`,className:`w-full bg-white border-[3px] border-ink-black rounded-lg py-2 sm:py-2.5 pl-9 sm:pl-10 pr-3 sm:pr-4 text-ink-black placeholder-trash-gray focus:outline-none focus:bg-white text-xs sm:text-sm font-code-mono shadow-[inset_2px_2px_0px_rgba(0,0,0,0.1)]`})]})]}),(0,p.jsxs)(`div`,{className:`p-2.5 sm:p-3 bg-white border-[2px] border-ink-black rounded-lg text-[9px] sm:text-[10px] font-code-mono space-y-1 shadow-[inset_1px_1px_0px_rgba(0,0,0,0.05)]`,children:[(0,p.jsx)(`div`,{className:`font-bold font-arcade uppercase text-[8px] sm:text-[9px] text-trash-gray mb-1 sm:mb-1.5`,children:`Password Security Requirements:`}),(0,p.jsxs)(`div`,{className:`flex items-center gap-1.5 ${T?`text-emerald-700 font-bold`:`text-slate-500`}`,children:[T?(0,p.jsx)(l,{className:`w-3 h-3 text-emerald-600 shrink-0 stroke-[3]`}):(0,p.jsx)(s,{className:`w-3 h-3 text-slate-400 shrink-0`}),(0,p.jsx)(`span`,{children:`Minimum 8 characters`})]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-1.5 ${E&&D?`text-emerald-700 font-bold`:`text-slate-500`}`,children:[E&&D?(0,p.jsx)(l,{className:`w-3 h-3 text-emerald-600 shrink-0 stroke-[3]`}):(0,p.jsx)(s,{className:`w-3 h-3 text-slate-400 shrink-0`}),(0,p.jsx)(`span`,{children:`Uppercase & lowercase letters (A-Z, a-z)`})]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-1.5 ${O?`text-emerald-700 font-bold`:`text-slate-500`}`,children:[O?(0,p.jsx)(l,{className:`w-3 h-3 text-emerald-600 shrink-0 stroke-[3]`}):(0,p.jsx)(s,{className:`w-3 h-3 text-slate-400 shrink-0`}),(0,p.jsx)(`span`,{children:`At least 1 number (0-9)`})]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-1.5 ${k?`text-emerald-700 font-bold`:`text-slate-500`}`,children:[k?(0,p.jsx)(l,{className:`w-3 h-3 text-emerald-600 shrink-0 stroke-[3]`}):(0,p.jsx)(s,{className:`w-3 h-3 text-slate-400 shrink-0`}),(0,p.jsx)(`span`,{children:`At least 1 special character (!@#$%^&*...)`})]}),_.length>0&&(0,p.jsxs)(`div`,{className:`flex items-center gap-1.5 ${A?`text-emerald-700 font-bold`:`text-red-600 font-bold`}`,children:[A?(0,p.jsx)(l,{className:`w-3 h-3 text-emerald-600 shrink-0 stroke-[3]`}):(0,p.jsx)(s,{className:`w-3 h-3 text-red-500 shrink-0 stroke-[3]`}),(0,p.jsx)(`span`,{children:A?`Passwords match`:`Passwords do not match`})]})]})]}),(0,p.jsxs)(`button`,{type:`submit`,disabled:y||e&&(!j||!A),className:`w-full bg-[#ffcc00] hover:bg-yellow-400 border-[3px] sm:border-[4px] border-ink-black rounded-xl py-2.5 sm:py-3.5 font-window-title text-sm sm:text-base text-ink-black arcade-btn cursor-pointer disabled:opacity-50 flex items-center justify-center gap-2 uppercase font-bold tracking-wide transition-all shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none`,children:[y?`PROCESSING...`:e?`CREATE ACCOUNT`:`SIGN IN`,!y&&(0,p.jsx)(r,{className:`w-4 h-4 stroke-[3px]`})]})]}),(0,p.jsxs)(`div`,{className:`relative my-3.5 sm:my-5 select-none`,children:[(0,p.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,p.jsx)(`div`,{className:`w-full border-t-[3px] border-ink-black border-dashed`})}),(0,p.jsx)(`div`,{className:`relative flex justify-center text-[9px] sm:text-[10px] uppercase font-arcade`,children:(0,p.jsx)(`span`,{className:`bg-[#fdf8e1] px-2 sm:px-3 text-trash-gray font-bold`,children:`OR CONTINUE WITH`})})]}),(0,p.jsxs)(`button`,{onClick:async()=>{try{b(!0),w(null),await d.signInWithGoogle()}catch(e){w({type:`error`,text:e.message||`Google Sign-In failed to initialize`}),b(!1)}},disabled:y,className:`w-full bg-white hover:bg-slate-100 border-[3px] border-ink-black text-ink-black font-bold py-2.5 sm:py-3 px-3 sm:px-4 rounded-xl flex items-center justify-center gap-2.5 sm:gap-3 transition-all text-[11px] sm:text-xs cursor-pointer shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none`,children:[(0,p.jsxs)(`svg`,{className:`w-4 h-4 shrink-0`,viewBox:`0 0 24 24`,fill:`currentColor`,children:[(0,p.jsx)(`path`,{d:`M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z`,fill:`#4285F4`}),(0,p.jsx)(`path`,{d:`M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z`,fill:`#34A853`}),(0,p.jsx)(`path`,{d:`M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.06H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.94l2.85-2.22.81-.63z`,fill:`#FBBC05`}),(0,p.jsx)(`path`,{d:`M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.06l3.66 2.84c.87-2.6 3.3-4.52 6.16-4.52z`,fill:`#EA4335`})]}),`SIGN IN WITH GOOGLE`]}),(0,p.jsxs)(`button`,{onClick:()=>{d.enterSandbox()},disabled:y,className:`mt-2.5 sm:mt-3 w-full bg-[#10b981] hover:bg-emerald-600 text-white font-window-title py-2.5 sm:py-3 px-3 sm:px-4 border-[3px] border-ink-black rounded-xl flex items-center justify-center gap-2 cursor-pointer shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none uppercase font-bold text-[11px] sm:text-xs`,children:[(0,p.jsx)(`span`,{className:`material-symbols-outlined text-sm font-bold`,children:`sports_esports`}),`Enter Sandbox Mode (No Login)`]})]})]})]})}export{m as default}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/Auth-D-vQqxx2.js b/algospaced-ui/dist/assets/Auth-D-vQqxx2.js new file mode 100644 index 0000000000000000000000000000000000000000..8f221384d56abc39d9e146926bc3b112a0fc1d3f --- /dev/null +++ b/algospaced-ui/dist/assets/Auth-D-vQqxx2.js @@ -0,0 +1 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{B as t,H as n,K as r,Lt as i,b as a,k as o,o as s,vt as c,wt as l,zt as u}from"./vendor-react-q-oOktF_.js";import{t as d}from"./firebaseClient-G7klkuBb.js";var f=e(u(),1),p=i();function m(){let[e,i]=(0,f.useState)(!1),[u,m]=(0,f.useState)(``),[h,g]=(0,f.useState)(``),[_,v]=(0,f.useState)(``),[y,b]=(0,f.useState)(!1),[x,S]=(0,f.useState)(!1),[C,w]=(0,f.useState)(null),T=h.length>=8,E=/[A-Z]/.test(h),D=/[a-z]/.test(h),O=/[0-9]/.test(h),k=/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?~`]/.test(h),A=h.length>0&&h===_,j=T&&E&&D&&O&&k;return(0,p.jsxs)(`div`,{className:`fixed inset-0 w-full h-full max-h-[100dvh] overflow-y-auto overscroll-contain custom-scrollbar flex flex-col items-center px-3 pt-3 pb-8 sm:px-4 sm:py-6 md:p-8 relative isolate selection:bg-highlight-pink selection:text-white`,children:[(0,p.jsx)(`div`,{className:`fixed inset-0 w-full h-full bg-cover bg-center z-0 saturate-150 contrast-125 pointer-events-none`,style:{backgroundImage:`url('/wallpapers/default.webp')`}}),(0,p.jsxs)(`div`,{className:`w-full max-w-md bg-paper-white border-[4px] border-ink-black window-shadow z-10 flex flex-col overflow-hidden shadow-[inset_2px_2px_0px_rgba(255,255,255,0.8)] relative my-auto shrink-0`,children:[(0,p.jsx)(`div`,{className:`bg-[#0ea5e9] border-b-[4px] border-ink-black px-3 sm:px-4 py-2 sm:py-2.5 flex justify-between items-center text-ink-black select-none`,children:(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`material-symbols-outlined select-none text-base sm:text-xl`,style:{fontVariationSettings:`'FILL' 1`},children:`sports_esports`}),(0,p.jsx)(`span`,{className:`font-window-title text-xs sm:text-base font-bold tracking-wide`,children:`System_Setup.exe`})]})}),(0,p.jsxs)(`div`,{className:`p-4 sm:p-6 bg-[#fdf8e1] flex-1 flex flex-col`,children:[typeof window<`u`&&window.self!==window.top&&(0,p.jsxs)(`div`,{className:`mb-4 sm:mb-5 p-3 sm:p-3.5 border-[3px] border-[#ea580c] bg-[#ffedd5] text-[#9a3412] text-xs font-bold font-arcade leading-relaxed shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[`⚠️ RUNNING INSIDE IFRAME`,(0,p.jsx)(`p`,{className:`mt-1 font-sans text-[11px] font-normal text-ink-black normal-case leading-normal`,children:`If Google Sign-In popup is restricted inside Hugging Face wrapper, open the standalone link below:`}),(0,p.jsx)(`a`,{href:`https://iamfebin-algospaced-dsa.hf.space/`,target:`_top`,className:`mt-2.5 inline-block w-full text-center bg-[#ea580c] hover:bg-[#c2410c] text-white border-[2.5px] border-ink-black py-1.5 px-3 rounded-lg font-window-title text-xs font-bold transition-all shadow-[1.5px_1.5px_0px_rgba(0,0,0,1)] active:translate-y-0.5 active:shadow-none`,children:`OPEN FULLSCREEN / DIRECT SITE`})]}),(0,p.jsxs)(`div`,{className:`flex flex-col items-center mb-4 sm:mb-6`,children:[(0,p.jsx)(`div`,{className:`w-12 h-12 sm:w-16 sm:h-16 bg-paper-white border-[3px] border-ink-black flex items-center justify-center gadget-shadow shadow-[inset_2px_2px_0px_rgba(255,255,255,0.8)] mb-2.5 sm:mb-4`,children:(0,p.jsx)(a,{className:`w-7 h-7 sm:w-9 sm:h-9 text-primary`})}),(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`h2`,{className:`text-2xl sm:text-3xl font-extrabold tracking-tight text-ink-black font-headline-md leading-none m-0`,children:`AlgoSpaced`}),(0,p.jsx)(`span`,{className:`text-[9px] sm:text-[10px] font-arcade bg-[#facc15] text-ink-black font-extrabold px-1.5 sm:px-2 py-0.5 border-[2px] border-ink-black shadow-[2px_2px_0px_0px_#1E293B] uppercase rotate-[-3deg]`,children:`BETA`})]}),(0,p.jsx)(`p`,{className:`text-[10px] sm:text-xs font-arcade text-trash-gray mt-1.5 sm:mt-2 tracking-wide uppercase text-center`,children:`Spaced Repetition for DSA`})]}),(0,p.jsxs)(`div`,{className:`flex gap-2 mb-4 sm:mb-6 font-arcade text-[9px] sm:text-[10px]`,children:[(0,p.jsx)(`button`,{onClick:()=>{i(!1),w(null)},className:`flex-1 py-2 sm:py-2.5 border-[3px] border-ink-black cursor-pointer font-bold tracking-wider outline-none transition-all shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:shadow-none active:translate-y-0.5 ${e?`bg-white text-slate-700 hover:bg-surface-container`:`bg-secondary-container text-ink-black translate-y-0.5 shadow-[1px_1px_0px_0px_rgba(30,41,59,1)]`}`,children:`SIGN IN`}),(0,p.jsx)(`button`,{onClick:()=>{i(!0),w(null)},className:`flex-1 py-2 sm:py-2.5 border-[3px] border-ink-black cursor-pointer font-bold tracking-wider outline-none transition-all shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:shadow-none active:translate-y-0.5 ${e?`bg-secondary-container text-ink-black translate-y-0.5 shadow-[1px_1px_0px_0px_rgba(30,41,59,1)]`:`bg-white text-slate-700 hover:bg-surface-container`}`,children:`CREATE ACCOUNT`})]}),C&&(0,p.jsxs)(`div`,{className:`mb-4 sm:mb-6 p-3 sm:p-4 border-[3px] border-ink-black text-xs font-arcade leading-relaxed ${C.type===`error`?`bg-red-100 border-red-500 text-error shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`:C.type===`unverified`?`bg-amber-100 border-amber-500 text-amber-900 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`:`bg-emerald-100 border-emerald-500 text-emerald-700 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`}`,children:[(0,p.jsx)(`p`,{children:C.text}),C.type===`unverified`&&(0,p.jsxs)(`button`,{type:`button`,onClick:async()=>{if(!u.trim()||!h){w({type:`error`,text:`Please enter your email and password above to resend the verification link.`});return}try{S(!0),await d.resendVerificationEmail(u.trim(),h),w({type:`success`,text:`Verification email resent to ${u.trim()}! Please check your inbox and spam folder.`})}catch(e){w({type:`error`,text:e.message||`Failed to resend verification email. Check your credentials.`})}finally{S(!1)}},disabled:x,className:`mt-3 w-full bg-amber-500 hover:bg-amber-600 text-white font-window-title text-xs font-bold py-2 px-3 border-[2px] border-ink-black rounded flex items-center justify-center gap-2 cursor-pointer shadow-[2px_2px_0px_0px_rgba(0,0,0,1)] active:translate-y-0.5 active:shadow-none uppercase disabled:opacity-50`,children:[(0,p.jsx)(o,{className:`w-3.5 h-3.5 ${x?`animate-spin`:``}`}),x?`SENDING LINK...`:`RESEND VERIFICATION EMAIL`]})]}),(0,p.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault(),b(!0),w(null);let n=u.trim();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)){w({type:`error`,text:`Please enter a valid email address.`}),b(!1);return}if(e){if(!j){w({type:`error`,text:`Password does not meet the security criteria. Please check the requirements below.`}),b(!1);return}if(h!==_){w({type:`error`,text:`Passwords do not match. Please re-enter.`}),b(!1);return}try{await d.signUpWithEmail(n,h),w({type:`success`,text:`Registration successful! A verification link has been sent to your email. Please verify your email before logging in.`}),i(!1),g(``),v(``)}catch(e){let t=e,n=t.message||`An error occurred during registration.`;t.code===`auth/email-already-in-use`?n=`This email address is already registered. Please sign in instead.`:t.code===`auth/invalid-email`?n=`The email address format is invalid.`:t.code===`auth/weak-password`&&(n=`Firebase requires a stronger password.`),w({type:`error`,text:n})}finally{b(!1)}}else try{await d.signInWithEmail(n,h)}catch(e){let t=e;if(t.code===`auth/email-not-verified`)w({type:`unverified`,text:`Your email address is not verified yet. Please check your inbox for the activation link.`});else{let e=t.message||`An error occurred during sign in.`;t.code===`auth/invalid-credential`||t.code===`auth/user-not-found`||t.code===`auth/wrong-password`?e=`Invalid email or password. Please check your credentials.`:t.code===`auth/too-many-requests`&&(e=`Access temporarily locked due to many failed attempts. Try again later or reset password.`),w({type:`error`,text:e})}}finally{b(!1)}},className:`space-y-3 sm:space-y-4`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{htmlFor:`auth-email`,className:`block text-[11px] sm:text-xs font-bold text-ink-black uppercase tracking-wider mb-1.5 sm:mb-2 font-headline-md`,children:`Email Address`}),(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(t,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 sm:w-4 sm:h-4 text-ink-black`}),(0,p.jsx)(`input`,{id:`auth-email`,type:`email`,required:!0,value:u,onChange:e=>m(e.target.value),placeholder:`name@arcade.com`,"aria-label":`Email Address`,className:`w-full bg-white border-[3px] border-ink-black rounded-lg py-2 sm:py-2.5 pl-9 sm:pl-10 pr-3 sm:pr-4 text-ink-black placeholder-trash-gray focus:outline-none focus:bg-white text-xs sm:text-sm font-code-mono shadow-[inset_2px_2px_0px_rgba(0,0,0,0.1)]`})]})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{htmlFor:`auth-password`,className:`block text-[11px] sm:text-xs font-bold text-ink-black uppercase tracking-wider mb-1.5 sm:mb-2 font-headline-md`,children:`Password`}),(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(n,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 sm:w-4 sm:h-4 text-ink-black`}),(0,p.jsx)(`input`,{id:`auth-password`,type:`password`,required:!0,value:h,onChange:e=>g(e.target.value),placeholder:`••••••••`,"aria-label":`Password`,className:`w-full bg-white border-[3px] border-ink-black rounded-lg py-2 sm:py-2.5 pl-9 sm:pl-10 pr-3 sm:pr-4 text-ink-black placeholder-trash-gray focus:outline-none focus:bg-white text-xs sm:text-sm font-code-mono shadow-[inset_2px_2px_0px_rgba(0,0,0,0.1)]`})]})]}),e&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{htmlFor:`auth-confirm-password`,className:`block text-[11px] sm:text-xs font-bold text-ink-black uppercase tracking-wider mb-1.5 sm:mb-2 font-headline-md`,children:`Confirm Password`}),(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(r,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 sm:w-4 sm:h-4 text-ink-black`}),(0,p.jsx)(`input`,{id:`auth-confirm-password`,type:`password`,required:!0,value:_,onChange:e=>v(e.target.value),placeholder:`••••••••`,"aria-label":`Confirm Password`,className:`w-full bg-white border-[3px] border-ink-black rounded-lg py-2 sm:py-2.5 pl-9 sm:pl-10 pr-3 sm:pr-4 text-ink-black placeholder-trash-gray focus:outline-none focus:bg-white text-xs sm:text-sm font-code-mono shadow-[inset_2px_2px_0px_rgba(0,0,0,0.1)]`})]})]}),(0,p.jsxs)(`div`,{className:`p-2.5 sm:p-3 bg-white border-[2px] border-ink-black rounded-lg text-[9px] sm:text-[10px] font-code-mono space-y-1 shadow-[inset_1px_1px_0px_rgba(0,0,0,0.05)]`,children:[(0,p.jsx)(`div`,{className:`font-bold font-arcade uppercase text-[8px] sm:text-[9px] text-trash-gray mb-1 sm:mb-1.5`,children:`Password Security Requirements:`}),(0,p.jsxs)(`div`,{className:`flex items-center gap-1.5 ${T?`text-emerald-700 font-bold`:`text-slate-500`}`,children:[T?(0,p.jsx)(c,{className:`w-3 h-3 text-emerald-600 shrink-0 stroke-[3]`}):(0,p.jsx)(s,{className:`w-3 h-3 text-slate-400 shrink-0`}),(0,p.jsx)(`span`,{children:`Minimum 8 characters`})]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-1.5 ${E&&D?`text-emerald-700 font-bold`:`text-slate-500`}`,children:[E&&D?(0,p.jsx)(c,{className:`w-3 h-3 text-emerald-600 shrink-0 stroke-[3]`}):(0,p.jsx)(s,{className:`w-3 h-3 text-slate-400 shrink-0`}),(0,p.jsx)(`span`,{children:`Uppercase & lowercase letters (A-Z, a-z)`})]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-1.5 ${O?`text-emerald-700 font-bold`:`text-slate-500`}`,children:[O?(0,p.jsx)(c,{className:`w-3 h-3 text-emerald-600 shrink-0 stroke-[3]`}):(0,p.jsx)(s,{className:`w-3 h-3 text-slate-400 shrink-0`}),(0,p.jsx)(`span`,{children:`At least 1 number (0-9)`})]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-1.5 ${k?`text-emerald-700 font-bold`:`text-slate-500`}`,children:[k?(0,p.jsx)(c,{className:`w-3 h-3 text-emerald-600 shrink-0 stroke-[3]`}):(0,p.jsx)(s,{className:`w-3 h-3 text-slate-400 shrink-0`}),(0,p.jsx)(`span`,{children:`At least 1 special character (!@#$%^&*...)`})]}),_.length>0&&(0,p.jsxs)(`div`,{className:`flex items-center gap-1.5 ${A?`text-emerald-700 font-bold`:`text-red-600 font-bold`}`,children:[A?(0,p.jsx)(c,{className:`w-3 h-3 text-emerald-600 shrink-0 stroke-[3]`}):(0,p.jsx)(s,{className:`w-3 h-3 text-red-500 shrink-0 stroke-[3]`}),(0,p.jsx)(`span`,{children:A?`Passwords match`:`Passwords do not match`})]})]})]}),(0,p.jsxs)(`button`,{type:`submit`,disabled:y||e&&(!j||!A),className:`w-full bg-[#ffcc00] hover:bg-yellow-400 border-[3px] sm:border-[4px] border-ink-black rounded-xl py-2.5 sm:py-3.5 font-window-title text-sm sm:text-base text-ink-black arcade-btn cursor-pointer disabled:opacity-50 flex items-center justify-center gap-2 uppercase font-bold tracking-wide transition-all shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none`,children:[y?`PROCESSING...`:e?`CREATE ACCOUNT`:`SIGN IN`,!y&&(0,p.jsx)(l,{className:`w-4 h-4 stroke-[3px]`})]})]}),(0,p.jsxs)(`div`,{className:`relative my-3.5 sm:my-5 select-none`,children:[(0,p.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,p.jsx)(`div`,{className:`w-full border-t-[3px] border-ink-black border-dashed`})}),(0,p.jsx)(`div`,{className:`relative flex justify-center text-[9px] sm:text-[10px] uppercase font-arcade`,children:(0,p.jsx)(`span`,{className:`bg-[#fdf8e1] px-2 sm:px-3 text-trash-gray font-bold`,children:`OR CONTINUE WITH`})})]}),(0,p.jsxs)(`button`,{onClick:async()=>{try{b(!0),w(null),await d.signInWithGoogle()}catch(e){w({type:`error`,text:e.message||`Google Sign-In failed to initialize`}),b(!1)}},disabled:y,className:`w-full bg-white hover:bg-slate-100 border-[3px] border-ink-black text-ink-black font-bold py-2.5 sm:py-3 px-3 sm:px-4 rounded-xl flex items-center justify-center gap-2.5 sm:gap-3 transition-all text-[11px] sm:text-xs cursor-pointer shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none`,children:[(0,p.jsxs)(`svg`,{className:`w-4 h-4 shrink-0`,viewBox:`0 0 24 24`,fill:`currentColor`,children:[(0,p.jsx)(`path`,{d:`M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z`,fill:`#4285F4`}),(0,p.jsx)(`path`,{d:`M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z`,fill:`#34A853`}),(0,p.jsx)(`path`,{d:`M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.06H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.94l2.85-2.22.81-.63z`,fill:`#FBBC05`}),(0,p.jsx)(`path`,{d:`M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.06l3.66 2.84c.87-2.6 3.3-4.52 6.16-4.52z`,fill:`#EA4335`})]}),`SIGN IN WITH GOOGLE`]}),(0,p.jsxs)(`button`,{onClick:()=>{d.enterSandbox()},disabled:y,className:`mt-2.5 sm:mt-3 w-full bg-[#10b981] hover:bg-emerald-600 text-white font-window-title py-2.5 sm:py-3 px-3 sm:px-4 border-[3px] border-ink-black rounded-xl flex items-center justify-center gap-2 cursor-pointer shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none uppercase font-bold text-[11px] sm:text-xs`,children:[(0,p.jsx)(`span`,{className:`material-symbols-outlined text-sm font-bold`,children:`sports_esports`}),`Enter Sandbox Mode (No Login)`]})]})]})]})}export{m as default}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/CreateProblemForm-C2nCqjgj.js b/algospaced-ui/dist/assets/CreateProblemForm-BBCKyUaK.js similarity index 99% rename from algospaced-ui/dist/assets/CreateProblemForm-C2nCqjgj.js rename to algospaced-ui/dist/assets/CreateProblemForm-BBCKyUaK.js index 80ba80e6b433ac774116a473b9c840adc829dc3b..fa50f629f3b623438c22e9bb17a06b94e30057bd 100644 --- a/algospaced-ui/dist/assets/CreateProblemForm-C2nCqjgj.js +++ b/algospaced-ui/dist/assets/CreateProblemForm-BBCKyUaK.js @@ -1,4 +1,4 @@ -import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Lt as t,zt as n}from"./vendor-react-qmUj3JUi.js";import{r}from"./firebaseClient-G7klkuBb.js";var i=e(n(),1),a=t(),o=[`Arrays & Hashing`,`Two Pointers`,`Sliding Window`,`Stack`,`Binary Search`,`Linked List`,`Trees`,`Tries`,`Heap / Priority Queue`,`Backtracking`,`Graphs`,`Advanced Graphs`,`1-D Dynamic Programming`,`2-D Dynamic Programming`,`Greedy`,`Intervals`,`Math & Geometry`,`Bit Manipulation`];function s(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`sol-${crypto.randomUUID()}`:`sol-${Date.now()}`}function c({onClose:e,onSuccess:t,initialProblem:n,mode:c=n?`edit`:`create`}){let l=c===`edit`||!!n,[u,d]=(0,i.useState)(`form`),[f,p]=(0,i.useState)(``),[ee,m]=(0,i.useState)(!1),[h,g]=(0,i.useState)(()=>{if(n?.name)return n.name;try{let e=localStorage.getItem(`algospaced_prefill_draft`);if(e)return JSON.parse(e).name||``}catch{}return``}),[_,v]=(0,i.useState)(()=>n?.problem_number!==void 0&&n?.problem_number!==null?n.problem_number:``),[y,b]=(0,i.useState)(()=>{if(n?.pattern)return n.pattern;try{let e=localStorage.getItem(`algospaced_prefill_draft`);if(e)return JSON.parse(e).pattern||``}catch{}return`Arrays & Hashing`}),[x,S]=(0,i.useState)(()=>n?.difficulty===`Easy`||n?.difficulty===`Medium`||n?.difficulty===`Hard`?n.difficulty:`Medium`),[C,w]=(0,i.useState)(()=>n?.optimal_time||`O(N)`),[T,E]=(0,i.useState)(()=>n?.optimal_space||`O(1)`),[D,O]=(0,i.useState)(()=>n?.description||``),[k,A]=(0,i.useState)(()=>n?.examples&&Array.isArray(n.examples)&&n.examples.length>0?n.examples.map(e=>typeof e==`string`?{input:e,output:``,explanation:``}:{input:String(e?.input??``),output:String(e?.output??``),explanation:e?.explanation||``}):[{input:``,output:``,explanation:``}]),[j,M]=(0,i.useState)(()=>n?.constraints?Array.isArray(n.constraints)?n.constraints.join(` +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Lt as t,zt as n}from"./vendor-react-q-oOktF_.js";import{r}from"./firebaseClient-G7klkuBb.js";var i=e(n(),1),a=t(),o=[`Arrays & Hashing`,`Two Pointers`,`Sliding Window`,`Stack`,`Binary Search`,`Linked List`,`Trees`,`Tries`,`Heap / Priority Queue`,`Backtracking`,`Graphs`,`Advanced Graphs`,`1-D Dynamic Programming`,`2-D Dynamic Programming`,`Greedy`,`Intervals`,`Math & Geometry`,`Bit Manipulation`];function s(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`sol-${crypto.randomUUID()}`:`sol-${Date.now()}`}function c({onClose:e,onSuccess:t,initialProblem:n,mode:c=n?`edit`:`create`}){let l=c===`edit`||!!n,[u,d]=(0,i.useState)(`form`),[f,p]=(0,i.useState)(``),[ee,m]=(0,i.useState)(!1),[h,g]=(0,i.useState)(()=>{if(n?.name)return n.name;try{let e=localStorage.getItem(`algospaced_prefill_draft`);if(e)return JSON.parse(e).name||``}catch{}return``}),[_,v]=(0,i.useState)(()=>n?.problem_number!==void 0&&n?.problem_number!==null?n.problem_number:``),[y,b]=(0,i.useState)(()=>{if(n?.pattern)return n.pattern;try{let e=localStorage.getItem(`algospaced_prefill_draft`);if(e)return JSON.parse(e).pattern||``}catch{}return`Arrays & Hashing`}),[x,S]=(0,i.useState)(()=>n?.difficulty===`Easy`||n?.difficulty===`Medium`||n?.difficulty===`Hard`?n.difficulty:`Medium`),[C,w]=(0,i.useState)(()=>n?.optimal_time||`O(N)`),[T,E]=(0,i.useState)(()=>n?.optimal_space||`O(1)`),[D,O]=(0,i.useState)(()=>n?.description||``),[k,A]=(0,i.useState)(()=>n?.examples&&Array.isArray(n.examples)&&n.examples.length>0?n.examples.map(e=>typeof e==`string`?{input:e,output:``,explanation:``}:{input:String(e?.input??``),output:String(e?.output??``),explanation:e?.explanation||``}):[{input:``,output:``,explanation:``}]),[j,M]=(0,i.useState)(()=>n?.constraints?Array.isArray(n.constraints)?n.constraints.join(` `):String(n.constraints):``),[te,ne]=(0,i.useState)(()=>n?.how_to_solve||``),[N,P]=(0,i.useState)(()=>{if(n?.reference_code)return n.reference_code;try{let e=localStorage.getItem(`algospaced_prefill_draft`);if(e)return JSON.parse(e).code||``}catch{}return``}),[F,I]=(0,i.useState)(()=>{if(n?.solutions&&Array.isArray(n.solutions)&&n.solutions.length>0)return n.solutions.map((e,t)=>({id:e.id||`sol-${t+1}`,name:e.name||`Method ${t+1}`,pattern:e.pattern||n.pattern||`Arrays & Hashing`,time_complexity:e.time_complexity||n.optimal_time||`O(N)`,space_complexity:e.space_complexity||n.optimal_space||`O(1)`,code:e.code||``,explanation:e.explanation||``,is_optimal:e.is_optimal??t===0}));let e=n?.reference_code||``,t=n?.pattern||`Arrays & Hashing`;try{let n=localStorage.getItem(`algospaced_prefill_draft`);if(n){let r=JSON.parse(n);r.code&&!e&&(e=r.code),r.pattern&&!t&&(t=r.pattern)}}catch{}return[{id:`sol-1`,name:`Optimal Method`,pattern:t,time_complexity:n?.optimal_time||`O(N)`,space_complexity:n?.optimal_space||`O(1)`,code:e,explanation:n?.how_to_solve||``,is_optimal:!0}]}),[L,R]=(0,i.useState)(0),z=F[L]||F[0]||{id:`sol-1`,name:`Method 1`,pattern:`Arrays & Hashing`,time_complexity:`O(N)`,space_complexity:`O(1)`,code:``,explanation:``,is_optimal:!0},B=e=>{I(t=>{let n=[...t],r=L{t!==r&&(e.is_optimal=!1)}),n[r].time_complexity&&w(n[r].time_complexity),n[r].space_complexity&&E(n[r].space_complexity),n[r].pattern&&b(n[r].pattern)),n})},re=()=>{let e=F.length+1,t={id:s(),name:`Method ${e}`,pattern:y||`Arrays & Hashing`,time_complexity:`O(N)`,space_complexity:`O(1)`,code:``,explanation:``,is_optimal:F.length===0};I(e=>[...e,t]),R(F.length)},ie=e=>{F.length<=1||(I(t=>{let n=t.filter((t,n)=>n!==e);return n.some(e=>e.is_optimal)||(n[0].is_optimal=!0),n}),L>=F.length-1&&R(Math.max(0,F.length-2)))},[V,ae]=(0,i.useState)(!0),[H,U]=(0,i.useState)(``),[W,G]=(0,i.useState)(``),[K,q]=(0,i.useState)(!1),[J,Y]=(0,i.useState)(!1),[X,Z]=(0,i.useState)(!1),[oe,se]=(0,i.useState)(!1);i.useEffect(()=>{l||localStorage.removeItem(`algospaced_prefill_draft`)},[l]);let Q=async()=>{let{data:{session:e}}=await r.auth.getSession(),t=e?e.access_token:`sandbox`,n=localStorage.getItem(`algospaced_custom_api_key`)||localStorage.getItem(`sandbox_gemini_api_key`)||``,i=localStorage.getItem(`algospaced_custom_ai_provider`)||`default`,a={"Content-Type":`application/json`,Authorization:`Bearer ${t}`};return i&&i!=="default"&&n&&n.trim()&&(a[`x-custom-api-key`]=n.trim(),a[`x-gemini-api-key`]=n.trim(),a[`x-ai-provider`]=i),a},ce=async()=>{if(f.trim()){m(!0),U(``);try{let e=await Q(),t=await fetch(`/api/explorer/problems/fetch-leetcode`,{method:`POST`,headers:e,body:JSON.stringify({query:f.trim()})});if(t.ok){let e=await t.json();e.problem_number!==void 0&&e.problem_number!==null&&v(e.problem_number),e.title&&g(e.title),e.difficulty&&S(e.difficulty),e.pattern&&b(e.pattern),e.optimal_time&&w(e.optimal_time),e.optimal_space&&E(e.optimal_space),e.description&&O(e.description),e.how_to_solve&&ne(e.how_to_solve),e.starter_code&&!N.trim()&&P(e.starter_code),I(t=>{let n=[...t],r={...n[L]};return e.pattern&&(r.pattern=e.pattern),e.optimal_time&&(r.time_complexity=e.optimal_time),e.optimal_space&&(r.space_complexity=e.optimal_space),e.how_to_solve&&(r.explanation=e.how_to_solve),e.starter_code&&!r.code?.trim()&&(r.code=e.starter_code),n[L]=r,n}),Array.isArray(e.examples)&&e.examples.length>0&&A(e.examples),Array.isArray(e.constraints)?M(e.constraints.join(` `)):typeof e.constraints==`string`&&M(e.constraints)}else{let e=await t.json();U(e.detail||`Failed to fetch LeetCode problem data.`)}}catch{U(`Fetch request failed due to connection error.`)}finally{m(!1)}}},le=async()=>{let e=z.code||N;if(h.trim()||e.trim()){se(!0),U(``);try{let t=await Q(),n=await fetch(`/api/explorer/problems/prefill`,{method:`POST`,headers:t,body:JSON.stringify({name:h,code:e})});if(n.ok){let t=await n.json();t.problem_number!==void 0&&t.problem_number!==null&&v(t.problem_number),t.title&&!h&&g(t.title),t.pattern&&b(t.pattern),t.difficulty&&S(t.difficulty),t.optimal_time&&w(t.optimal_time),t.optimal_space&&E(t.optimal_space),t.description&&O(t.description),t.reference_code&&!e.trim()&&P(t.reference_code),I(e=>{let n=[...e],r={...n[L]};return t.pattern&&(r.pattern=t.pattern),t.optimal_time&&(r.time_complexity=t.optimal_time),t.optimal_space&&(r.space_complexity=t.optimal_space),t.reference_code&&!r.code?.trim()&&(r.code=t.reference_code),n[L]=r,n})}else{let e=await n.json();U(e.detail||`Prefill failed.`)}}catch{U(`Prefill request failed due to connection error.`)}finally{se(!1)}}},ue=async()=>{let e=z.code||N;if(!h.trim()&&!e.trim()){U(`Please enter a problem name or code first.`);return}Y(!0),U(``);try{let t=await Q(),n=await fetch(`/api/explorer/problems/assist-field`,{method:`POST`,headers:t,body:JSON.stringify({field:`intuition`,title:h,code:e,description:D})});if(n.ok){let e=await n.json();e.how_to_solve&&(ne(e.how_to_solve),B({explanation:e.how_to_solve}))}else{let e=await n.json();U(e.detail||`Failed to generate intuition.`)}}catch{U(`Intuition generator failed due to connection error.`)}finally{Y(!1)}},de=async()=>{let e=z.code||N;if(!e.trim()){U(`Please enter some Python code to format.`);return}Z(!0),U(``);try{let t=await Q(),n=await fetch(`/api/explorer/problems/assist-field`,{method:`POST`,headers:t,body:JSON.stringify({field:`comments`,title:h,code:e})});if(n.ok){let e=await n.json();e.formatted_code&&(P(e.formatted_code),B({code:e.formatted_code}))}else{let e=await n.json();U(e.detail||`Failed to format code.`)}}catch{U(`Code formatter failed due to connection error.`)}finally{Z(!1)}},fe=async r=>{if(r.preventDefault(),!h.trim()){U(`Problem name cannot be empty`);return}q(!0),U(``),G(``);try{let r=await Q(),i=j.split(` `).map(e=>e.trim()).filter(Boolean),a=F.find(e=>e.is_optimal)||F[0],o=a?.pattern||y.trim()||`General`,s=a?.code||N,c=a?.explanation||te,u=C||a?.time_complexity||`O(N)`,d=T||a?.space_complexity||`O(1)`,f;if(l&&n){let e=n.id||(n.problem_number?String(n.problem_number):``)||h.trim();f=await fetch(`/api/explorer/problems/${encodeURIComponent(e)}`,{method:`PUT`,headers:r,body:JSON.stringify({name:h.trim(),pattern:o,difficulty:x,reference_code:s,description:D,problem_number:_===``?null:Number(_),optimal_time:u,optimal_space:d,examples:k.filter(e=>e.input.trim()||e.output.trim()),constraints:i,how_to_solve:c,solutions:F})})}else f=await fetch(`/api/explorer/problems/create`,{method:`POST`,headers:r,body:JSON.stringify({name:h.trim(),pattern:o,difficulty:x,reference_code:s,description:D,problem_number:_===``?null:Number(_),optimal_time:u,optimal_space:d,examples:k.filter(e=>e.input.trim()||e.output.trim()),constraints:i,how_to_solve:c,sync_to_gdoc:V,solutions:F})});let p=await f.json();f.ok&&(p.success||p.problem_id)?(G(l?`Problem updated successfully!`:`Problem saved and synced successfully!`),setTimeout(()=>{t(),e()},1e3)):U(p.detail||(l?`Failed to update problem.`:`Failed to create problem.`))}catch{U(`Connection timed out.`)}finally{q(!1)}},pe=()=>{A([...k,{input:``,output:``,explanation:``}])},me=e=>{k.length<=1||A(k.filter((t,n)=>n!==e))},$=(e,t,n)=>{let r=[...k];r[e]={...r[e],[t]:n},A(r)};return(0,a.jsxs)(`form`,{onSubmit:fe,className:`flex flex-col h-full bg-[#fdf8e1] text-ink-black font-sans overflow-hidden`,children:[(0,a.jsxs)(`div`,{className:`bg-[#f0e6c8] p-2.5 border-b-2 border-ink-black flex flex-col gap-2 shrink-0`,children:[(0,a.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,a.jsx)(`span`,{className:`font-arcade text-xs text-primary-purple`,children:`✦`}),(0,a.jsx)(`h2`,{className:`text-xs font-bold font-arcade tracking-tight uppercase`,children:l?`Edit Problem Specification`:`Problem & Note Studio`}),l&&(0,a.jsx)(`span`,{className:`text-[9px] bg-primary-purple/10 text-primary-purple font-mono px-1.5 py-0.5 rounded border border-primary-purple/30 font-bold`,children:`EDIT MODE`})]}),(0,a.jsxs)(`div`,{className:`flex border-2 border-ink-black bg-white rounded overflow-hidden shadow-[1px_1px_0px_#1E293B]`,children:[(0,a.jsx)(`button`,{type:`button`,onClick:()=>d(`form`),className:`px-3 py-1 text-[10px] font-bold uppercase transition-colors ${u===`form`?`bg-primary-purple text-white`:`hover:bg-slate-100`}`,children:`✏️ Editor`}),(0,a.jsx)(`button`,{type:`button`,onClick:()=>d(`preview`),className:`px-3 py-1 text-[10px] font-bold uppercase transition-colors ${u===`preview`?`bg-primary-purple text-white`:`hover:bg-slate-100`}`,children:`📄 Doc Preview`})]})]}),(0,a.jsxs)(`div`,{className:`flex gap-1.5 items-center`,children:[(0,a.jsx)(`input`,{type:`text`,value:f,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),ce())},placeholder:`Paste LeetCode URL (e.g. https://leetcode.com/problems/two-sum/) or Title...`,className:`flex-1 bg-white border-2 border-ink-black px-2 py-1 text-xs outline-none focus:ring-1 focus:ring-primary-purple font-medium`}),(0,a.jsxs)(`button`,{type:`button`,onClick:ce,disabled:ee||!f.trim(),className:`bg-[#ffe24c] hover:bg-yellow-300 disabled:opacity-50 text-ink-black font-arcade text-[9px] font-bold px-2.5 py-1.5 border-2 border-ink-black shadow-[1px_1px_0px_#1E293B] active:translate-y-0.5 cursor-pointer flex items-center gap-1 shrink-0`,children:[(0,a.jsx)(`span`,{children:`⚡`}),` `,ee?`FETCHING...`:`FETCH LEETCODE`]})]})]}),H&&(0,a.jsxs)(`div`,{className:`mx-3 mt-2 p-2 border-2 border-red-500 bg-red-50 text-red-800 text-[11px] font-mono leading-relaxed shrink-0`,children:[`⚠️ `,H]}),W&&(0,a.jsxs)(`div`,{className:`mx-3 mt-2 p-2 border-2 border-green-500 bg-green-50 text-green-800 text-[11px] font-mono leading-relaxed shrink-0`,children:[`✅ `,W]}),(0,a.jsx)(`div`,{className:`flex-1 overflow-y-auto custom-scrollbar p-3 space-y-3`,children:u===`form`?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(`div`,{className:`grid grid-cols-12 gap-2`,children:[(0,a.jsxs)(`div`,{className:`col-span-3 flex flex-col gap-1`,children:[(0,a.jsx)(`label`,{className:`text-[10px] font-bold text-slate-600 uppercase`,children:`Problem #:`}),(0,a.jsx)(`input`,{type:`number`,value:_,onChange:e=>v(e.target.value===``?``:Number(e.target.value)),placeholder:`e.g. 1`,className:`bg-white border-2 border-ink-black p-1.5 text-xs outline-none focus:ring-1 focus:ring-primary-purple font-bold`})]}),(0,a.jsxs)(`div`,{className:`col-span-6 flex flex-col gap-1`,children:[(0,a.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,a.jsx)(`label`,{className:`text-[10px] font-bold text-slate-600 uppercase`,children:`Title:`}),(0,a.jsxs)(`button`,{type:`button`,onClick:le,disabled:oe||!h.trim()&&!z.code?.trim(),className:`text-[8px] font-arcade font-bold px-1.5 py-0.5 border border-ink-black bg-[#ffe24c] hover:bg-yellow-300 disabled:opacity-50 flex items-center gap-1 cursor-pointer`,children:[(0,a.jsx)(`span`,{children:`✦`}),` `,oe?`...`:`AUTO-FILL`]})]}),(0,a.jsx)(`input`,{type:`text`,required:!0,value:h,onChange:e=>g(e.target.value),placeholder:`e.g. Two Sum`,className:`bg-white border-2 border-ink-black p-1.5 text-xs outline-none focus:ring-1 focus:ring-primary-purple font-bold`})]}),(0,a.jsxs)(`div`,{className:`col-span-3 flex flex-col gap-1`,children:[(0,a.jsx)(`label`,{className:`text-[10px] font-bold text-slate-600 uppercase`,children:`Difficulty:`}),(0,a.jsxs)(`select`,{value:x,onChange:e=>S(e.target.value),className:`border-2 border-ink-black p-1.5 text-xs font-bold outline-none cursor-pointer ${x===`Easy`?`bg-emerald-100 text-emerald-900`:x===`Medium`?`bg-amber-100 text-amber-900`:`bg-rose-100 text-rose-900`}`,children:[(0,a.jsx)(`option`,{value:`Easy`,children:`Easy`}),(0,a.jsx)(`option`,{value:`Medium`,children:`Medium`}),(0,a.jsx)(`option`,{value:`Hard`,children:`Hard`})]})]})]}),(0,a.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 bg-[#f6edd2] p-2 border-2 border-ink-black rounded`,children:[(0,a.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,a.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,a.jsxs)(`label`,{className:`text-[10px] font-bold text-slate-700 uppercase flex items-center gap-1`,children:[(0,a.jsx)(`span`,{children:`⏱️`}),` Target Optimal Time:`]}),(0,a.jsx)(`span`,{className:`text-[8px] font-mono text-slate-500`,children:`(hidden behind spoiler on review)`})]}),(0,a.jsx)(`input`,{type:`text`,value:C,onChange:e=>w(e.target.value),placeholder:`e.g. O(N)`,className:`bg-white border-2 border-ink-black p-1.5 text-xs outline-none focus:ring-1 focus:ring-primary-purple font-mono font-bold`})]}),(0,a.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,a.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,a.jsxs)(`label`,{className:`text-[10px] font-bold text-slate-700 uppercase flex items-center gap-1`,children:[(0,a.jsx)(`span`,{children:`📦`}),` Target Optimal Space:`]}),(0,a.jsx)(`span`,{className:`text-[8px] font-mono text-slate-500`,children:`(hidden behind spoiler on review)`})]}),(0,a.jsx)(`input`,{type:`text`,value:T,onChange:e=>E(e.target.value),placeholder:`e.g. O(1)`,className:`bg-white border-2 border-ink-black p-1.5 text-xs outline-none focus:ring-1 focus:ring-primary-purple font-mono font-bold`})]})]}),(0,a.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,a.jsx)(`label`,{className:`text-[10px] font-bold text-slate-600 uppercase`,children:`Problem Description:`}),(0,a.jsx)(`textarea`,{value:D,onChange:e=>O(e.target.value),placeholder:`Given an array of integers nums and an integer target...`,className:`bg-white border-2 border-ink-black p-2 text-xs outline-none focus:ring-1 focus:ring-primary-purple font-sans h-20 resize-y leading-relaxed`})]}),(0,a.jsxs)(`div`,{className:`flex flex-col gap-1.5 bg-[#f6edd2] p-2.5 border-2 border-ink-black rounded`,children:[(0,a.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,a.jsxs)(`label`,{className:`text-[10px] font-bold text-slate-700 uppercase flex items-center gap-1`,children:[(0,a.jsx)(`span`,{children:`🧪`}),` Examples (`,k.length,`)`]}),(0,a.jsx)(`button`,{type:`button`,onClick:pe,className:`text-[9px] font-bold px-2 py-0.5 border border-ink-black bg-white hover:bg-slate-100 cursor-pointer shadow-[1px_1px_0px_#1E293B]`,children:`+ Add Example`})]}),k.map((e,t)=>(0,a.jsxs)(`div`,{className:`bg-white border border-ink-black p-2 space-y-1.5 rounded relative text-xs`,children:[(0,a.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,a.jsxs)(`span`,{className:`font-bold text-[10px] text-slate-500`,children:[`Example `,t+1,`:`]}),k.length>1&&(0,a.jsx)(`button`,{type:`button`,onClick:()=>me(t),className:`text-[10px] text-red-600 hover:text-red-800 font-bold cursor-pointer`,children:`✕`})]}),(0,a.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,a.jsx)(`input`,{type:`text`,value:e.input,onChange:e=>$(t,`input`,e.target.value),placeholder:`Input: nums = [2,7,11,15], target = 9`,className:`bg-slate-50 border border-slate-300 p-1 text-[11px] font-mono outline-none`}),(0,a.jsx)(`input`,{type:`text`,value:e.output,onChange:e=>$(t,`output`,e.target.value),placeholder:`Output: [0,1]`,className:`bg-slate-50 border border-slate-300 p-1 text-[11px] font-mono outline-none`})]}),(0,a.jsx)(`input`,{type:`text`,value:e.explanation||``,onChange:e=>$(t,`explanation`,e.target.value),placeholder:`Explanation (Optional): Because nums[0] + nums[1] == 9, we return [0, 1].`,className:`bg-slate-50 border border-slate-300 p-1 text-[11px] outline-none w-full`})]},t))]}),(0,a.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,a.jsx)(`label`,{className:`text-[10px] font-bold text-slate-600 uppercase`,children:`Constraints (1 per line):`}),(0,a.jsx)(`textarea`,{value:j,onChange:e=>M(e.target.value),placeholder:`2 <= nums.length <= 10^4 diff --git a/algospaced-ui/dist/assets/FileExplorer-BX57bI-L.js b/algospaced-ui/dist/assets/FileExplorer-cjfRJjsw.js similarity index 99% rename from algospaced-ui/dist/assets/FileExplorer-BX57bI-L.js rename to algospaced-ui/dist/assets/FileExplorer-cjfRJjsw.js index ef068f7d4ca3a94b004f0d40783fd8b226fe468d..0f809fdb850934e00b0fe8113c063d4df9370947 100644 --- a/algospaced-ui/dist/assets/FileExplorer-BX57bI-L.js +++ b/algospaced-ui/dist/assets/FileExplorer-cjfRJjsw.js @@ -1,3 +1,3 @@ -import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Lt as t,zt as n}from"./vendor-react-qmUj3JUi.js";import{r}from"./firebaseClient-G7klkuBb.js";var i=e(n(),1),a=t(),o=[{name:`Retro Arcade Grid.img`,url:`/wallpapers/default.webp`,desc:`Default AlgoSpaced purple grid and pixel theme background.`},{name:`Classic Board Logo.img`,url:`/icons/computer.webp`,desc:`System info and arcade machine diagram wallpaper.`},{name:`Terminal Console Icon.img`,url:`/icons/terminal.webp`,desc:`Dark retro CRT terminal screen layout.`},{name:`Synthwave Sunset Grid.img`,url:`https://images.unsplash.com/photo-1550745165-9bc0b252726f?q=80&w=1000&auto=format&fit=crop`,desc:`Glowing neon grids and vector mountains styling.`},{name:`Matrix Code Rain.img`,url:`https://images.unsplash.com/photo-1526374965328-7f61d4dc18c5?q=80&w=1000&auto=format&fit=crop`,desc:`Falling green digital characters rain.`}];function s({onSetWallpaper:e,activeWallpaperUrl:t,onOpenCreateProblem:n,onOpenQueue:s,onOpenJourney:c,refreshTrigger:l}){let[u,d]=(0,i.useState)([`C:`]),[f,p]=(0,i.useState)([]),[m,h]=(0,i.useState)(!0),[g,_]=(0,i.useState)(null),v=i.useMemo(()=>{let e=[...o],t=localStorage.getItem(`customWallpaperUrl`),n=localStorage.getItem(`customWallpaperName`)||`Custom Wallpaper.img`;return t&&(e.some(e=>e.url===t)||e.push({name:n,url:t,desc:`User uploaded custom background wallpaper.`})),e},[t]),[y,ee]=(0,i.useState)(``),[b,te]=(0,i.useState)(`All`),[x,S]=(0,i.useState)(`All`),[C,w]=(0,i.useState)(!1),[ne,T]=(0,i.useState)(!1),[E,D]=(0,i.useState)(!1),[O,k]=(0,i.useState)(``),[A,j]=(0,i.useState)(``),re=async e=>{let t=e.target.files;if(!t||t.length===0)return;let n=t[0];e.target.value=``,D(!0),k(``),j(``);try{let{data:{session:e}}=await r.auth.getSession(),t=e?e.access_token:`sandbox`,i=new FormData;i.append(`file`,n);let a=await fetch(`/api/explorer/import`,{method:`POST`,headers:{Authorization:`Bearer ${t}`},body:i}),o=await a.json();a.ok?(j(o.message||`Problems imported successfully!`),setTimeout(()=>{q()},500),setTimeout(()=>{T(!1),j(``)},2e3)):k(o.detail||`Import failed. Verify the file format.`)}catch{k(`Import failed due to a network error.`)}finally{D(!1)}},[M,N]=(0,i.useState)(null),[P,F]=(0,i.useState)(`description`),[I,L]=(0,i.useState)(!1),[R,z]=(0,i.useState)(``),[B,V]=(0,i.useState)(``),[H,U]=(0,i.useState)(!1),[W,G]=(0,i.useState)(!1),[ie,K]=(0,i.useState)(!1),q=async()=>{h(!0);try{let{data:{session:e}}=await r.auth.getSession();if(!e)return;let t=await fetch(`/api/explorer/problems`,{headers:{Authorization:`Bearer ${e.access_token}`}});if(t.ok){let e=await t.json();p(e)}}catch(e){console.error(`Failed to fetch explorer files:`,e)}finally{h(!1)}};(0,i.useEffect)(()=>{q()},[l]);let J=e=>{d([`C:`,e]),_(null)},ae=()=>{u.length>1&&(d([`C:`]),_(null))},oe=async()=>{try{let{data:{session:e}}=await r.auth.getSession();if(!e)return;let t=await fetch(`/api/explorer/export`,{headers:{Authorization:`Bearer ${e.access_token}`}});if(t.ok){let e=await t.blob(),n=window.URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=`algospaced_solutions.zip`,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(n)}}catch(e){console.error(`Failed to download solutions ZIP:`,e)}},se=async()=>{if(M){U(!0),G(!1);try{let{data:{session:e}}=await r.auth.getSession();if(!e)return;if((await fetch(`/api/explorer/problems/${M.id}`,{method:`PUT`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${e.access_token}`},body:JSON.stringify({name:M.name,pattern:M.pattern,difficulty:M.difficulty,reference_code:R,description:B})})).ok){G(!0),L(!1);let e=f.map(e=>e.id===M.id?{...e,reference_code:R,description:B}:e);p(e),N({...M,reference_code:R,description:B}),setTimeout(()=>G(!1),2e3)}}catch(e){console.error(`Failed to update solution code:`,e)}finally{U(!1)}}},ce=e=>{e.preventDefault(),w(!0)},le=()=>{w(!1)},ue=async e=>{e.preventDefault(),w(!1);let t=e.dataTransfer.files;if(t.length>0){let e=t[0];if(e.name.endsWith(`.py`))try{let t=await e.text(),r=e.name.replace(`.py`,``).replace(/_/g,` `).replace(/-/g,` `),i=`General`,a=`Medium`,o=t.match(/#\s*Pattern:\s*(.+)/i);o&&(i=o[1].trim());let s=t.match(/#\s*Difficulty:\s*(.+)/i);if(s){let e=s[1].trim();[`Easy`,`Medium`,`Hard`].includes(e)&&(a=e)}let c=t.split(` +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Lt as t,zt as n}from"./vendor-react-q-oOktF_.js";import{r}from"./firebaseClient-G7klkuBb.js";var i=e(n(),1),a=t(),o=[{name:`Retro Arcade Grid.img`,url:`/wallpapers/default.webp`,desc:`Default AlgoSpaced purple grid and pixel theme background.`},{name:`Classic Board Logo.img`,url:`/icons/computer.webp`,desc:`System info and arcade machine diagram wallpaper.`},{name:`Terminal Console Icon.img`,url:`/icons/terminal.webp`,desc:`Dark retro CRT terminal screen layout.`},{name:`Synthwave Sunset Grid.img`,url:`https://images.unsplash.com/photo-1550745165-9bc0b252726f?q=80&w=1000&auto=format&fit=crop`,desc:`Glowing neon grids and vector mountains styling.`},{name:`Matrix Code Rain.img`,url:`https://images.unsplash.com/photo-1526374965328-7f61d4dc18c5?q=80&w=1000&auto=format&fit=crop`,desc:`Falling green digital characters rain.`}];function s({onSetWallpaper:e,activeWallpaperUrl:t,onOpenCreateProblem:n,onOpenQueue:s,onOpenJourney:c,refreshTrigger:l}){let[u,d]=(0,i.useState)([`C:`]),[f,p]=(0,i.useState)([]),[m,h]=(0,i.useState)(!0),[g,_]=(0,i.useState)(null),v=i.useMemo(()=>{let e=[...o],t=localStorage.getItem(`customWallpaperUrl`),n=localStorage.getItem(`customWallpaperName`)||`Custom Wallpaper.img`;return t&&(e.some(e=>e.url===t)||e.push({name:n,url:t,desc:`User uploaded custom background wallpaper.`})),e},[t]),[y,ee]=(0,i.useState)(``),[b,te]=(0,i.useState)(`All`),[x,S]=(0,i.useState)(`All`),[C,w]=(0,i.useState)(!1),[ne,T]=(0,i.useState)(!1),[E,D]=(0,i.useState)(!1),[O,k]=(0,i.useState)(``),[A,j]=(0,i.useState)(``),re=async e=>{let t=e.target.files;if(!t||t.length===0)return;let n=t[0];e.target.value=``,D(!0),k(``),j(``);try{let{data:{session:e}}=await r.auth.getSession(),t=e?e.access_token:`sandbox`,i=new FormData;i.append(`file`,n);let a=await fetch(`/api/explorer/import`,{method:`POST`,headers:{Authorization:`Bearer ${t}`},body:i}),o=await a.json();a.ok?(j(o.message||`Problems imported successfully!`),setTimeout(()=>{q()},500),setTimeout(()=>{T(!1),j(``)},2e3)):k(o.detail||`Import failed. Verify the file format.`)}catch{k(`Import failed due to a network error.`)}finally{D(!1)}},[M,N]=(0,i.useState)(null),[P,F]=(0,i.useState)(`description`),[I,L]=(0,i.useState)(!1),[R,z]=(0,i.useState)(``),[B,V]=(0,i.useState)(``),[H,U]=(0,i.useState)(!1),[W,G]=(0,i.useState)(!1),[ie,K]=(0,i.useState)(!1),q=async()=>{h(!0);try{let{data:{session:e}}=await r.auth.getSession();if(!e)return;let t=await fetch(`/api/explorer/problems`,{headers:{Authorization:`Bearer ${e.access_token}`}});if(t.ok){let e=await t.json();p(e)}}catch(e){console.error(`Failed to fetch explorer files:`,e)}finally{h(!1)}};(0,i.useEffect)(()=>{q()},[l]);let J=e=>{d([`C:`,e]),_(null)},ae=()=>{u.length>1&&(d([`C:`]),_(null))},oe=async()=>{try{let{data:{session:e}}=await r.auth.getSession();if(!e)return;let t=await fetch(`/api/explorer/export`,{headers:{Authorization:`Bearer ${e.access_token}`}});if(t.ok){let e=await t.blob(),n=window.URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=`algospaced_solutions.zip`,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(n)}}catch(e){console.error(`Failed to download solutions ZIP:`,e)}},se=async()=>{if(M){U(!0),G(!1);try{let{data:{session:e}}=await r.auth.getSession();if(!e)return;if((await fetch(`/api/explorer/problems/${M.id}`,{method:`PUT`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${e.access_token}`},body:JSON.stringify({name:M.name,pattern:M.pattern,difficulty:M.difficulty,reference_code:R,description:B})})).ok){G(!0),L(!1);let e=f.map(e=>e.id===M.id?{...e,reference_code:R,description:B}:e);p(e),N({...M,reference_code:R,description:B}),setTimeout(()=>G(!1),2e3)}}catch(e){console.error(`Failed to update solution code:`,e)}finally{U(!1)}}},ce=e=>{e.preventDefault(),w(!0)},le=()=>{w(!1)},ue=async e=>{e.preventDefault(),w(!1);let t=e.dataTransfer.files;if(t.length>0){let e=t[0];if(e.name.endsWith(`.py`))try{let t=await e.text(),r=e.name.replace(`.py`,``).replace(/_/g,` `).replace(/-/g,` `),i=`General`,a=`Medium`,o=t.match(/#\s*Pattern:\s*(.+)/i);o&&(i=o[1].trim());let s=t.match(/#\s*Difficulty:\s*(.+)/i);if(s){let e=s[1].trim();[`Easy`,`Medium`,`Hard`].includes(e)&&(a=e)}let c=t.split(` `),l=[];for(let e of c){let t=e.trim();if(t.startsWith(`#`)){if(t.match(/#\s*(Pattern|Difficulty|Problem|Description):/i))continue;l.push(t.replace(/^#\s*/,``))}else if(t!==``)break}let u=l.join(` `).trim();localStorage.setItem(`algospaced_prefill_draft`,JSON.stringify({name:r,pattern:i,difficulty:a,code:t,description:u})),n&&n()}catch(e){console.error(`Failed to parse uploaded script:`,e)}}},de=e=>{navigator.clipboard.writeText(e),K(!0),setTimeout(()=>K(!1),2e3)},Y=u.length>1?u[1]:`root`,X=f.length,fe=f.filter(e=>e.reference_code&&e.reference_code.trim()).length,Z=X>0?Math.round(fe/X*100):0,Q={1:0,2:0,3:0,4:0,5:0};f.forEach(e=>{if(e.box_level!==null&&e.box_level!==void 0){let t=e.box_level;t>=1&&t<=5&&Q[t]++}});let pe=Array.from(new Set(f.map(e=>e.pattern).filter(Boolean))),$=f.filter(e=>{let t=e.name.toLowerCase().includes(y.toLowerCase()),n=b===`All`||e.difficulty===b,r=x===`All`||e.pattern===x;return t&&n&&r});return(0,a.jsxs)(`div`,{className:`w-full h-full bg-paper-white text-ink-black flex flex-col overflow-hidden text-xs md:text-sm font-sans select-none`,children:[(0,a.jsxs)(`div`,{className:`bg-slate-200 border-b-[3px] border-ink-black p-2 flex items-center justify-between shrink-0`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-2 flex-1`,children:[(0,a.jsx)(`button`,{onClick:ae,disabled:u.length===1,className:`w-7 h-7 bg-white border-2 border-ink-black flex items-center justify-center hover:bg-slate-100 disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer active:translate-y-0.5`,title:`Up One Folder`,children:(0,a.jsx)(`span`,{className:`material-symbols-outlined text-[16px] font-bold`,children:`arrow_upward`})}),(0,a.jsx)(`div`,{className:`bg-white border-2 border-ink-black px-3 py-1 font-mono text-[10px] flex-1 max-w-[280px] truncate`,children:u.join(`\\`)})]}),(0,a.jsxs)(`div`,{className:`flex gap-3 text-[10px] font-bold pr-2 font-mono items-center`,children:[Y===`Database_Codes`&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(`button`,{onClick:()=>n&&n(),className:`text-blue-700 hover:underline cursor-pointer flex items-center gap-0.5`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-[12px] font-bold`,children:`add_box`}),`NEW FILE`]}),(0,a.jsx)(`span`,{className:`text-slate-400`,children:`|`}),(0,a.jsxs)(`button`,{onClick:()=>T(!0),className:`text-indigo-700 hover:underline cursor-pointer flex items-center gap-0.5`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-[12px] font-bold`,children:`upload`}),`IMPORT (.CSV / .DB)`]}),(0,a.jsx)(`span`,{className:`text-slate-400`,children:`|`}),(0,a.jsxs)(`button`,{onClick:oe,className:`text-purple-700 hover:underline cursor-pointer flex items-center gap-0.5`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-[12px] font-bold`,children:`downloadzip`}),`BACKUP (.ZIP)`]}),(0,a.jsx)(`span`,{className:`text-slate-400`,children:`|`})]}),(0,a.jsx)(`span`,{className:`text-slate-500`,children:Y===`root`?`2 Folder(s)`:Y===`Database_Codes`?`${$.length} of ${f.length} item(s)`:`${v.length} image(s)`})]})]}),(0,a.jsxs)(`div`,{className:`flex-1 flex overflow-hidden`,children:[(0,a.jsxs)(`aside`,{className:`w-1/3 border-r-[3px] border-ink-black bg-[#fdf8e1] p-3 overflow-y-auto custom-scrollbar flex flex-col gap-4 shrink-0`,children:[(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`span`,{className:`text-[9px] font-arcade text-slate-500 block uppercase mb-1.5`,children:`Folders`}),(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsxs)(`button`,{onClick:()=>d([`C:`]),className:`w-full text-left p-1.5 flex items-center gap-1.5 font-semibold border-2 border-transparent hover:bg-slate-100 rounded ${u.length===1?`bg-white border-ink-black`:``}`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-[#855400] text-sm`,style:{fontVariationSettings:`'FILL' 1`},children:`desktop_windows`}),(0,a.jsx)(`span`,{children:`C: (Root)`})]}),(0,a.jsxs)(`div`,{className:`pl-4 space-y-1`,children:[(0,a.jsxs)(`button`,{onClick:()=>J(`Database_Codes`),className:`w-full text-left p-1.5 flex items-center gap-1.5 font-semibold border-2 border-transparent hover:bg-slate-100 rounded ${Y===`Database_Codes`?`bg-white border-ink-black`:``}`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-yellow-600 text-sm`,style:{fontVariationSettings:`'FILL' 1`},children:`folder`}),(0,a.jsx)(`span`,{className:`truncate`,children:`Database_Codes`})]}),(0,a.jsxs)(`button`,{onClick:()=>J(`Wallpapers`),className:`w-full text-left p-1.5 flex items-center gap-1.5 font-semibold border-2 border-transparent hover:bg-slate-100 rounded ${Y===`Wallpapers`?`bg-white border-ink-black`:``}`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-yellow-600 text-sm`,style:{fontVariationSettings:`'FILL' 1`},children:`folder`}),(0,a.jsx)(`span`,{className:`truncate`,children:`Wallpapers`})]})]})]})]}),(0,a.jsxs)(`div`,{className:`border-t-2 border-dashed border-slate-300 pt-3`,children:[(0,a.jsx)(`span`,{className:`text-[9px] font-arcade text-slate-500 block uppercase mb-2`,children:`System Statistics`}),(0,a.jsxs)(`div`,{className:`space-y-3 font-sans text-[11px] font-bold text-slate-700`,children:[(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(0,a.jsxs)(`div`,{className:`flex justify-between text-[10px]`,children:[(0,a.jsx)(`span`,{children:`CODE COMPLETION:`}),(0,a.jsxs)(`span`,{className:`font-mono text-emerald-600`,children:[Z,`%`]})]}),(0,a.jsx)(`div`,{className:`w-full h-4 bg-white border-2 border-ink-black overflow-hidden relative`,children:(0,a.jsx)(`div`,{style:{width:`${Z}%`},className:`h-full bg-emerald-500 border-r-2 border-ink-black transition-all duration-500`})})]}),(0,a.jsxs)(`div`,{className:`space-y-1.5 mt-2`,children:[(0,a.jsx)(`span`,{className:`text-[9px] uppercase text-slate-500 block`,children:`Leitner Distribution:`}),[1,2,3,4,5].map(e=>{let t=Q[e],n=Math.max(...Object.values(Q),1),r=Math.max(8,Math.round(t/n*100));return(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,a.jsxs)(`span`,{className:`w-9 font-mono text-[10px] text-slate-400`,children:[`Box `,e,`:`]}),(0,a.jsx)(`div`,{className:`flex-1 h-3 bg-white border border-ink-black overflow-hidden relative`,children:(0,a.jsx)(`div`,{style:{width:`${r}%`},className:`h-full bg-[#0ea5e9] border-r border-ink-black transition-all`})}),(0,a.jsx)(`span`,{className:`w-4 text-right font-mono text-[10px] text-slate-600`,children:t})]},e)})]})]})]})]}),(0,a.jsxs)(`main`,{onDragOver:ce,onDragLeave:le,onDrop:ue,className:`flex-1 bg-white p-4 overflow-y-auto custom-scrollbar flex flex-col relative transition-all ${C?`bg-blue-50 border-4 border-dashed border-blue-500 m-2`:``}`,children:[C&&(0,a.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center text-blue-800 bg-white/80 pointer-events-none select-none z-[10] gap-2 font-sans font-bold`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-5xl animate-bounce`,children:`upload_file`}),(0,a.jsx)(`div`,{className:`text-sm`,children:`DROP SOLUTIONS PYTHON SCRIPT (.PY) HERE`}),(0,a.jsx)(`p`,{className:`text-[10px] text-slate-400`,children:`Will load and parse file metadata for import`})]}),m?(0,a.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center font-arcade text-[8px] animate-pulse`,children:`READING SYSTEM DISK...`}):(0,a.jsxs)(a.Fragment,{children:[Y===`Database_Codes`&&(0,a.jsxs)(`div`,{className:`mb-4 bg-slate-50 border-[2px] border-ink-black p-2 flex flex-col gap-2 shrink-0 select-none`,children:[(0,a.jsx)(`div`,{className:`flex gap-2`,children:(0,a.jsxs)(`div`,{className:`flex-1 bg-white border border-slate-300 rounded px-2 py-1 flex items-center gap-1`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-slate-400 text-sm`,children:`search`}),(0,a.jsx)(`input`,{type:`text`,value:y,onChange:e=>ee(e.target.value),className:`w-full bg-transparent outline-none border-none p-0 text-[11px] focus:ring-0 font-sans`,placeholder:`Search codes by name...`})]})}),(0,a.jsxs)(`div`,{className:`flex gap-3 text-[10px] font-bold text-slate-600`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,a.jsx)(`span`,{children:`Diff:`}),(0,a.jsxs)(`select`,{value:b,onChange:e=>te(e.target.value),className:`bg-white border border-slate-300 p-0.5 text-[9px] rounded font-sans cursor-pointer focus:ring-1 outline-none`,children:[(0,a.jsx)(`option`,{value:`All`,children:`All`}),(0,a.jsx)(`option`,{value:`Easy`,children:`Easy`}),(0,a.jsx)(`option`,{value:`Medium`,children:`Medium`}),(0,a.jsx)(`option`,{value:`Hard`,children:`Hard`})]})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1 flex-1`,children:[(0,a.jsx)(`span`,{children:`Pattern:`}),(0,a.jsxs)(`select`,{value:x,onChange:e=>S(e.target.value),className:`bg-white border border-slate-300 p-0.5 text-[9px] rounded font-sans cursor-pointer max-w-[120px] focus:ring-1 outline-none truncate`,children:[(0,a.jsx)(`option`,{value:`All`,children:`All`}),pe.map(e=>(0,a.jsx)(`option`,{value:e,children:e},e))]})]})]})]}),Y===`root`&&(0,a.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,a.jsxs)(`div`,{onDoubleClick:()=>s&&s(),onClick:()=>_(`queue_app`),className:`flex flex-col items-center justify-center p-3 border-[3px] border-transparent hover:bg-slate-50 cursor-pointer rounded select-none ${g===`queue_app`?`bg-green-50 border-dashed border-ink-black`:``}`,children:[(0,a.jsx)(`div`,{className:`w-12 h-12 bg-grass-green border-2 border-ink-black flex items-center justify-center shadow-[2px_2px_0px_0px_#1E293B]`,children:(0,a.jsx)(`span`,{className:`material-symbols-outlined text-3xl text-ink-black`,style:{fontVariationSettings:`'FILL' 1`},children:`view_list`})}),(0,a.jsx)(`span`,{className:`font-bold text-center mt-2 text-xs`,children:`Daily_Queue.exe`}),(0,a.jsx)(`span`,{className:`text-[9px] text-slate-400 mt-0.5`,children:`Spaced Repetition Review`})]}),(0,a.jsxs)(`div`,{onDoubleClick:()=>c&&c(),onClick:()=>_(`journey_app`),className:`flex flex-col items-center justify-center p-3 border-[3px] border-transparent hover:bg-slate-50 cursor-pointer rounded select-none ${g===`journey_app`?`bg-blue-50 border-dashed border-ink-black`:``}`,children:[(0,a.jsx)(`div`,{className:`w-12 h-12 bg-[#0ea5e9] border-2 border-ink-black flex items-center justify-center shadow-[2px_2px_0px_0px_#1E293B]`,children:(0,a.jsx)(`span`,{className:`material-symbols-outlined text-3xl text-white`,style:{fontVariationSettings:`'FILL' 1`},children:`route`})}),(0,a.jsx)(`span`,{className:`font-bold text-center mt-2 text-xs`,children:`Journey_Path.exe`}),(0,a.jsx)(`span`,{className:`text-[9px] text-slate-400 mt-0.5`,children:`NeetCode 150 Road`})]}),(0,a.jsxs)(`div`,{onDoubleClick:()=>J(`Database_Codes`),onClick:()=>_(`codes`),className:`flex flex-col items-center justify-center p-3 border-[3px] border-transparent hover:bg-slate-50 cursor-pointer rounded select-none ${g===`codes`?`bg-yellow-50 border-dashed border-ink-black`:``}`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-5xl text-yellow-500`,style:{fontVariationSettings:`'FILL' 1`},children:`folder`}),(0,a.jsx)(`span`,{className:`font-bold text-center mt-2 text-xs`,children:`Database_Codes`}),(0,a.jsx)(`span`,{className:`text-[9px] text-slate-400 mt-0.5`,children:`Synced solution files`})]}),(0,a.jsxs)(`div`,{onDoubleClick:()=>J(`Wallpapers`),onClick:()=>_(`wallpapers`),className:`flex flex-col items-center justify-center p-3 border-[3px] border-transparent hover:bg-slate-50 cursor-pointer rounded select-none ${g===`wallpapers`?`bg-yellow-50 border-dashed border-ink-black`:``}`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-5xl text-yellow-500`,style:{fontVariationSettings:`'FILL' 1`},children:`folder`}),(0,a.jsx)(`span`,{className:`font-bold text-center mt-2 text-xs`,children:`Wallpapers`}),(0,a.jsx)(`span`,{className:`text-[9px] text-slate-400 mt-0.5`,children:`Desktop wallpaper images`})]})]}),Y===`Database_Codes`&&($.length===0?(0,a.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center text-center text-slate-400 p-6 italic select-none`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-3xl mb-1`,children:`drafts`}),`No matching files found. Drag and drop a .py script to upload/create!`]}):(0,a.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:$.map(e=>{let t=`${e.name.replace(/\s+/g,`_`)}.py`,n=g===e.id;return(0,a.jsxs)(`div`,{onClick:()=>_(e.id),onDoubleClick:()=>{N(e),z(e.reference_code||``),V(e.description||``),F(`description`),L(!1)},className:`flex flex-col items-center p-2 border-[3px] border-transparent hover:bg-slate-50 cursor-pointer rounded select-none text-center ${n?`bg-yellow-50 border-dashed border-ink-black`:``}`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-3xl text-emerald-600`,children:`article`}),(0,a.jsx)(`span`,{className:`font-bold text-[10px] truncate w-full mt-1.5 leading-tight`,children:t}),(0,a.jsx)(`span`,{className:`text-[8px] text-slate-400 font-bold uppercase mt-0.5`,children:e.difficulty})]},e.id)})})),Y===`Wallpapers`&&(0,a.jsx)(`div`,{className:`grid grid-cols-2 gap-3 select-none`,children:v.map(n=>{let r=g===n.name,i=t===n.url;return(0,a.jsxs)(`div`,{onClick:()=>_(n.name),className:`border-[3px] p-2 flex flex-col cursor-pointer bg-slate-50 relative hover:bg-slate-100 ${r?`border-ink-black bg-yellow-50 shadow-[2px_2px_0_0_#1E293B]`:`border-slate-300`}`,children:[(0,a.jsxs)(`div`,{className:`aspect-video w-full border border-slate-300 overflow-hidden bg-black shrink-0 relative`,children:[(0,a.jsx)(`img`,{src:n.url,alt:n.name,className:`w-full h-full object-cover select-none`}),i&&(0,a.jsx)(`div`,{className:`absolute top-1 right-1 bg-green-500 text-white rounded-full w-5 h-5 flex items-center justify-center border border-white`,title:`Active Wallpaper`,children:(0,a.jsx)(`span`,{className:`material-symbols-outlined text-[12px] font-extrabold`,children:`check`})})]}),(0,a.jsx)(`span`,{className:`font-bold text-[10px] mt-1.5 truncate`,children:n.name}),(0,a.jsx)(`p`,{className:`text-[8px] text-slate-400 font-sans leading-tight mt-0.5 line-clamp-2`,children:n.desc}),r&&(0,a.jsx)(`button`,{onClick:t=>{t.stopPropagation(),e(n.url),localStorage.setItem(`desktopWallpaperUrl`,n.url)},className:`mt-2 w-full py-1 bg-highlight-pink text-white border-2 border-ink-black font-window-title font-bold text-[9px] hover:bg-pink-400 shadow-[1px_1px_0px_rgba(0,0,0,1)] active:translate-y-0.5 active:shadow-none transition-all text-center cursor-pointer`,children:`APPLY BACKGROUND`})]},n.name)})})]})]})]}),M&&(0,a.jsx)(`div`,{className:`absolute inset-0 bg-black/60 z-[999] flex items-center justify-center p-4`,children:(0,a.jsxs)(`div`,{className:`w-[90%] h-[90%] bg-paper-white border-[4px] border-ink-black shadow-[6px_6px_0px_0px_#1E293B] flex flex-col overflow-hidden animate-scale-up text-ink-black`,children:[(0,a.jsxs)(`div`,{className:`bg-emerald-600 text-white p-2 border-b-[3px] border-ink-black flex justify-between items-center shrink-0 select-none`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-sm`,children:`article`}),(0,a.jsxs)(`span`,{className:`font-window-title font-bold text-xs`,children:[M.name.replace(/\s+/g,`_`),`.py`]})]}),(0,a.jsx)(`button`,{onClick:()=>N(null),className:`bg-white text-ink-black border-[2px] border-ink-black w-5 h-5 flex items-center justify-center font-bold hover:bg-red-500 hover:text-white cursor-pointer`,children:`X`})]}),(0,a.jsxs)(`div`,{className:`bg-slate-200 border-b-2 border-ink-black flex shrink-0 select-none`,children:[(0,a.jsx)(`button`,{onClick:()=>F(`description`),className:`px-4 py-2 border-r-2 border-ink-black font-bold text-[11px] cursor-pointer ${P===`description`?`bg-white translate-y-[2px]`:`bg-slate-300 hover:bg-slate-100`}`,children:`PROBLEM DESCRIPTION`}),(0,a.jsx)(`button`,{onClick:()=>F(`code`),className:`px-4 py-2 border-r-2 border-ink-black font-bold text-[11px] cursor-pointer ${P===`code`?`bg-white translate-y-[2px]`:`bg-slate-300 hover:bg-slate-100`}`,children:`CODE VIEW & EDIT`}),(0,a.jsx)(`button`,{onClick:()=>F(`properties`),className:`px-4 py-2 border-r-2 border-ink-black font-bold text-[11px] cursor-pointer ${P===`properties`?`bg-white translate-y-[2px]`:`bg-slate-300 hover:bg-slate-100`}`,children:`LEITNER PROPERTIES`})]}),P===`description`&&(0,a.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden bg-slate-900 relative`,children:[I?(0,a.jsx)(`textarea`,{value:B,onChange:e=>V(e.target.value),className:`flex-1 w-full bg-slate-950 text-[#4ADE80] font-mono p-4 outline-none border-none text-xs leading-relaxed resize-none custom-scrollbar`,placeholder:`Enter problem description / question body here...`,spellCheck:`false`}):(0,a.jsx)(`div`,{className:`flex-1 p-4 bg-slate-900 text-[#4ADE80] font-sans text-xs leading-relaxed overflow-y-auto custom-scrollbar select-text`,children:(0,a.jsx)(`div`,{className:`whitespace-pre-wrap font-semibold`,children:M.description||`No description provided for this problem.`})}),I&&(0,a.jsx)(`div`,{className:`absolute top-2 right-2 bg-yellow-400 text-ink-black border border-ink-black px-2 py-0.5 text-[9px] font-bold select-none animate-pulse`,children:`EDIT MODE ACTIVE`})]}),P===`code`&&(0,a.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden bg-slate-900 relative`,children:[I?(0,a.jsx)(`textarea`,{value:R,onChange:e=>z(e.target.value),className:`flex-1 w-full bg-slate-950 text-[#4ADE80] font-mono p-4 outline-none border-none text-xs leading-relaxed resize-none custom-scrollbar`,spellCheck:`false`}):(0,a.jsx)(`textarea`,{readOnly:!0,value:M.reference_code||`# Write your solution here.`,className:`flex-1 w-full bg-slate-900 text-[#4ADE80] font-mono p-4 outline-none border-none text-xs leading-relaxed resize-none custom-scrollbar`,spellCheck:`false`}),I&&(0,a.jsx)(`div`,{className:`absolute top-2 right-2 bg-yellow-400 text-ink-black border border-ink-black px-2 py-0.5 text-[9px] font-bold select-none animate-pulse`,children:`EDIT MODE ACTIVE`})]}),P===`properties`&&(0,a.jsxs)(`div`,{className:`flex-1 p-6 overflow-y-auto custom-scrollbar bg-slate-50 font-sans leading-relaxed select-text flex flex-col gap-4`,children:[(0,a.jsx)(`h3`,{className:`font-arcade text-[10px] border-b border-slate-300 pb-1 text-slate-500`,children:`Card Diagnostics`}),(0,a.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,a.jsxs)(`div`,{className:`border-[3px] border-ink-black bg-white p-3 space-y-2`,children:[(0,a.jsx)(`span`,{className:`text-[9px] font-arcade text-[#0ea5e9] block`,children:`Scheduling Status`}),(0,a.jsxs)(`div`,{children:[`Leitner Combo Box: `,(0,a.jsx)(`span`,{className:`font-mono font-bold text-lg text-sky-600`,children:M.box_level||`N/A (Box 1)`})]}),(0,a.jsxs)(`div`,{children:[`Next Review Date: `,(0,a.jsx)(`span`,{className:`font-mono text-xs font-semibold`,children:M.next_review?new Date(M.next_review).toLocaleString():`N/A (Due)`})]}),(0,a.jsxs)(`div`,{children:[`Last Reviewed: `,(0,a.jsx)(`span`,{className:`font-mono text-xs font-semibold`,children:M.last_reviewed?new Date(M.last_reviewed).toLocaleDateString():`Never`})]})]}),(0,a.jsxs)(`div`,{className:`border-[3px] border-ink-black bg-white p-3 space-y-2`,children:[(0,a.jsx)(`span`,{className:`text-[9px] font-arcade text-emerald-600 block`,children:`Performance History`}),(0,a.jsxs)(`div`,{children:[`Total Attempts: `,(0,a.jsx)(`span`,{className:`font-mono font-bold text-sm`,children:M.total_attempts})]}),(0,a.jsxs)(`div`,{children:[`Times Correct: `,(0,a.jsx)(`span`,{className:`font-mono font-bold text-sm text-green-600`,children:M.times_correct})]}),(0,a.jsxs)(`div`,{children:[`Success Ratio: `,(0,a.jsx)(`span`,{className:`font-mono font-bold text-sm text-purple-700`,children:M.total_attempts>0?`${Math.round(M.times_correct/M.total_attempts*100)}%`:`0%`})]})]})]}),(0,a.jsxs)(`div`,{className:`border-[3px] border-ink-black bg-white p-3 space-y-1.5 text-xs font-semibold`,children:[(0,a.jsx)(`span`,{className:`text-[9px] font-arcade text-slate-400 block`,children:`Properties`}),(0,a.jsxs)(`div`,{children:[`File ID: `,(0,a.jsx)(`span`,{className:`font-mono text-[10px] text-slate-500`,children:M.id})]}),(0,a.jsxs)(`div`,{children:[`Logical Pattern: `,(0,a.jsx)(`span`,{className:`text-blue-600`,children:M.pattern})]}),(0,a.jsxs)(`div`,{children:[`Difficulty Tag: `,(0,a.jsx)(`span`,{className:`uppercase`,children:M.difficulty})]})]})]}),(0,a.jsxs)(`div`,{className:`p-3 bg-slate-100 border-t-[3px] border-ink-black flex justify-between items-center shrink-0 select-none`,children:[(0,a.jsx)(`div`,{children:W&&(0,a.jsx)(`span`,{className:`text-green-600 font-bold text-xs animate-pulse`,children:`✓ Solution saved!`})}),(0,a.jsxs)(`div`,{className:`flex gap-2`,children:[(P===`code`||P===`description`)&&(I?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`button`,{onClick:()=>{z(M.reference_code||``),V(M.description||``),L(!1)},className:`px-3 py-1.5 bg-white hover:bg-slate-50 text-ink-black border-2 border-ink-black font-bold text-xs cursor-pointer`,children:`CANCEL`}),(0,a.jsx)(`button`,{disabled:H,onClick:se,className:`px-3 py-1.5 bg-[#4ADE80] hover:bg-emerald-400 text-ink-black border-2 border-ink-black font-bold text-xs cursor-pointer shadow-[2px_2px_0px_rgba(0,0,0,1)] active:translate-y-0.5 active:shadow-none`,children:H?`SAVING...`:`SAVE CHANGES`})]}):(0,a.jsxs)(`button`,{onClick:()=>L(!0),className:`px-3 py-1.5 bg-yellow-400 hover:bg-yellow-300 text-ink-black border-2 border-ink-black font-bold text-xs cursor-pointer shadow-[2px_2px_0px_rgba(0,0,0,1)] active:translate-y-0.5 active:shadow-none flex items-center gap-1`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-sm`,children:`edit`}),`EDIT FILE`]})),(0,a.jsxs)(`button`,{onClick:()=>de(I?R:M.reference_code),className:`px-3 py-1.5 bg-[#ffcc00] hover:bg-yellow-300 text-ink-black border-2 border-ink-black font-bold text-xs shadow-[2px_2px_0px_rgba(0,0,0,1)] active:translate-y-0.5 active:shadow-none cursor-pointer flex items-center gap-1`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-sm`,children:`content_copy`}),ie?`COPIED!`:`COPY CODE`]}),(0,a.jsx)(`button`,{onClick:()=>N(null),className:`px-3 py-1.5 bg-white hover:bg-slate-50 text-ink-black border-2 border-ink-black font-bold text-xs shadow-[2px_2px_0px_rgba(0,0,0,1)] active:translate-y-0.5 active:shadow-none cursor-pointer`,children:`CLOSE`})]})]})]})}),ne&&(0,a.jsx)(`div`,{className:`absolute inset-0 bg-black/60 z-[999] flex items-center justify-center p-4 select-none`,children:(0,a.jsxs)(`div`,{className:`w-[80%] max-w-[400px] bg-paper-white border-[4px] border-ink-black shadow-[6px_6px_0px_0px_#1E293B] flex flex-col overflow-hidden animate-scale-up text-ink-black font-sans`,children:[(0,a.jsxs)(`div`,{className:`bg-indigo-700 text-white p-2.5 border-b-[3px] border-ink-black flex justify-between items-center font-bold`,children:[(0,a.jsx)(`span`,{className:`font-window-title text-xs`,children:`IMPORT PROBLEMS`}),(0,a.jsx)(`button`,{onClick:()=>{T(!1),k(``),j(``)},className:`bg-white text-ink-black border-[2px] border-ink-black w-5 h-5 flex items-center justify-center font-bold hover:bg-red-500 hover:text-white cursor-pointer`,children:`X`})]}),(0,a.jsxs)(`div`,{className:`p-6 space-y-4`,children:[O&&(0,a.jsx)(`div`,{className:`p-2 border-2 border-red-500 bg-red-50 text-red-800 text-[10px] font-mono leading-relaxed`,children:O}),A&&(0,a.jsx)(`div`,{className:`p-2 border-2 border-green-500 bg-green-50 text-green-800 text-[10px] font-mono leading-relaxed`,children:A}),(0,a.jsxs)(`div`,{className:`flex flex-col items-center justify-center border-4 border-dashed border-ink-black p-6 relative ${E?`bg-indigo-50 cursor-wait`:`bg-slate-50 hover:bg-slate-100 cursor-pointer`}`,children:[E?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-4xl text-indigo-700 mb-2 animate-bounce`,children:`cloud_upload`}),(0,a.jsx)(`span`,{className:`text-xs font-bold text-indigo-800 text-center`,children:`UPLOADING & PROCESSING...`}),(0,a.jsx)(`span`,{className:`text-[9px] text-indigo-600 mt-1 uppercase font-semibold text-center`,children:`Please wait, this might take a moment`})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-4xl text-indigo-700 mb-2`,children:`upload_file`}),(0,a.jsx)(`span`,{className:`text-xs font-bold text-ink-black text-center`,children:`SELECT A CSV OR SQLite (.DB) FILE`}),(0,a.jsx)(`span`,{className:`text-[9px] text-slate-400 mt-1 uppercase font-semibold text-center`,children:`Imports problems & solution notes`})]}),(0,a.jsx)(`input`,{type:`file`,accept:`.csv,.db`,disabled:E,onChange:re,className:`absolute inset-0 opacity-0 cursor-pointer w-full h-full disabled:cursor-wait`})]}),(0,a.jsxs)(`div`,{className:`text-[9px] text-slate-400 font-medium leading-normal space-y-1 font-sans`,children:[(0,a.jsxs)(`p`,{children:[`• `,(0,a.jsx)(`b`,{children:`CSV File:`}),` Must have a `,(0,a.jsx)(`code`,{children:`name`}),` column. Optional: `,(0,a.jsx)(`code`,{children:`problem_number`}),`, `,(0,a.jsx)(`code`,{children:`pattern`}),`, `,(0,a.jsx)(`code`,{children:`difficulty`}),`, `,(0,a.jsx)(`code`,{children:`optimal_time`}),`, `,(0,a.jsx)(`code`,{children:`optimal_space`}),`, `,(0,a.jsx)(`code`,{children:`reference_code`}),`, `,(0,a.jsx)(`code`,{children:`description`}),`.`]}),(0,a.jsxs)(`p`,{children:[`• `,(0,a.jsx)(`b`,{children:`SQLite DB File:`}),` Must be a standard database backup containing a `,(0,a.jsx)(`code`,{children:`problems`}),` table matching AlgoSpaced design.`]})]})]})]})})]})}export{s as default}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/GitHubSyncWindow-6b8RBof4.js b/algospaced-ui/dist/assets/GitHubSyncWindow-6b8RBof4.js new file mode 100644 index 0000000000000000000000000000000000000000..c07fe0f1c4b13ac957b98205cc909427ba2ec679 --- /dev/null +++ b/algospaced-ui/dist/assets/GitHubSyncWindow-6b8RBof4.js @@ -0,0 +1 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,J as n,Lt as r,Q as i,V as a,X as o,Y as s,a as c,dt as l,et as u,k as d,ot as f,pt as p,vt as m,zt as h}from"./vendor-react-q-oOktF_.js";import{a as g,c as _,i as v,l as y,n as b,o as x,r as S,s as C,t as w}from"./githubSyncService-DQdE4J2L.js";var T=e(h(),1),E=r(),D=({onClose:e,currentProblem:r})=>{let[h,D]=(0,T.useState)(()=>S()),[O,k]=(0,T.useState)(()=>v()),[A,j]=(0,T.useState)(``),[M,N]=(0,T.useState)(!1),[P,F]=(0,T.useState)(!1),[I,L]=(0,T.useState)(!1),[R,z]=(0,T.useState)(!1),[B,V]=(0,T.useState)(!1),[H,U]=(0,T.useState)(!1),[W,G]=(0,T.useState)(!1),[K,q]=(0,T.useState)(null),J=!!(h.token&&(h.username||O?.login));(0,T.useEffect)(()=>{h.token&&!O&&y(h.token).then(e=>{e.valid&&e.user&&(k(e.user),C({username:e.user.login},e.user))})},[h.token,O]);let Y=async()=>{L(!0),q(null);try{let{token:e,user:t}=await b();k(t);let n=S();D(n);try{await g(e,n.repoName,n.isPrivate)}catch{}q({type:`success`,text:`Connected successfully to GitHub as @${t.login}!`,linkUrl:t.html_url})}catch(e){q({type:`error`,text:e.message||`GitHub OAuth authorization failed.`})}finally{L(!1)}},X=async()=>{let e=A.trim();if(!e){q({type:`error`,text:`Please enter a valid GitHub token.`});return}z(!0),q(null);try{let t=await y(e);if(t.valid&&t.user){k(t.user),C({token:e,username:t.user.login},t.user),D(S());try{await g(e,h.repoName,h.isPrivate)}catch{}j(``),N(!1),q({type:`success`,text:`Verified and connected as @${t.user.login}!`,linkUrl:t.user.html_url})}else q({type:`error`,text:t.error||`Token verification failed. Please check permissions.`})}catch(e){q({type:`error`,text:e.message||`Failed to connect with token.`})}finally{z(!1)}},Z=async()=>{if(h.token){V(!0),q(null);try{let e=await g(h.token,h.repoName,h.isPrivate);C({repoName:h.repoName}),q({type:`success`,text:e.created?`Created new repository ${e.full_name} on GitHub!`:`Connected to existing repository ${e.full_name}!`,linkUrl:e.html_url})}catch(e){q({type:`error`,text:e.message||`Failed to initialize repository.`})}finally{V(!1)}}},Q=async()=>{if(h.token&&h.repoName){U(!0),q(null);try{let e=await _(h.token,h.repoName,h.branch);q({type:`success`,text:e.message||`Synced ${e.synced_count} solutions to ${h.repoName}!`,linkUrl:e.repo_url})}catch(e){q({type:`error`,text:e.message||`Batch sync failed.`})}finally{U(!1)}}},$=async()=>{if(!r||!h.token)return;let e=r.code||r.reference_code;if(!e||!e.trim()){q({type:`error`,text:`Current problem has no code to push. Write or save code first!`});return}G(!0),q(null);try{let t={token:h.token,repo:h.repoName,branch:h.branch,problem_number:r.problem_number,problem_name:r.name||`Algorithm Problem`,difficulty:r.difficulty||`Medium`,pattern:r.pattern||`Algorithms`,optimal_time:r.optimal_time||`O(N)`,optimal_space:r.optimal_space||`O(1)`,description:r.description||``,code:e},n=await x(t);q({type:`success`,text:`Committed ${r.name} to GitHub!`,linkUrl:n.html_url})}catch(e){q({type:`error`,text:e.message||`Failed to push current solution.`})}finally{G(!1)}},ee=e=>{C({autoCommit:e}),D(t=>({...t,autoCommit:e})),q({type:`info`,text:e?`Auto-commit ENABLED: Solutions will sync automatically on submission.`:`Auto-commit DISABLED: You can still push manually any time.`})};return(0,E.jsxs)(`div`,{className:`w-full h-full bg-[#fdf8e1] p-4 sm:p-6 flex flex-col justify-between select-none font-sans text-ink-black overflow-y-auto custom-scrollbar`,children:[(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between border-b-[3px] border-ink-black pb-3`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`w-9 h-9 bg-ink-black rounded border-2 border-ink-black flex items-center justify-center text-white shadow-[2px_2px_0px_0px_rgba(0,0,0,0.15)]`,children:(0,E.jsx)(`svg`,{className:`w-5 h-5 fill-white`,viewBox:`0 0 19 19`,children:(0,E.jsx)(`path`,{fillRule:`evenodd`,d:`M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844`,clipRule:`evenodd`})})}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h3`,{className:`font-headline-md font-bold text-sm uppercase m-0 flex items-center gap-2`,children:`GitHub Solutions Station`}),(0,E.jsx)(`p`,{className:`text-[11px] text-trash-gray font-semibold m-0`,children:`Sync algorithm solutions & auto-commit to your personal portfolio repository`})]})]}),(0,E.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,E.jsx)(`span`,{className:`px-2.5 py-1 text-[9px] font-bold font-arcade uppercase border-2 border-ink-black ${J?`bg-emerald-300 text-emerald-950`:`bg-amber-200 text-amber-950`}`,children:J?`CONNECTED`:`DISCONNECTED`})})]}),J?(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[O?.avatar_url?(0,E.jsx)(`img`,{src:O.avatar_url,alt:O.login,className:`w-10 h-10 rounded-full border-2 border-ink-black shadow-[1px_1px_0px_0px_#1E293B]`}):(0,E.jsx)(`div`,{className:`w-10 h-10 bg-slate-200 rounded-full border-2 border-ink-black flex items-center justify-center font-bold`,children:`GH`}),(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,E.jsx)(`span`,{className:`font-bold text-xs text-ink-black`,children:O?.name||O?.login||h.username}),(0,E.jsxs)(`span`,{className:`text-[10px] text-trash-gray font-mono`,children:[`(@`,O?.login||h.username,`)`]})]}),(0,E.jsxs)(`div`,{className:`text-[11px] text-slate-600 font-medium flex items-center gap-1 mt-0.5`,children:[(0,E.jsx)(o,{className:`w-3.5 h-3.5 text-blue-600 shrink-0`}),(0,E.jsxs)(`span`,{className:`font-semibold text-ink-black`,children:[h.username||O?.login,`/`,h.repoName]}),(0,E.jsxs)(`span`,{className:`text-slate-400`,children:[`(`,h.branch,`)`]})]})]})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsxs)(`a`,{href:`https://github.com/${h.username||O?.login}/${h.repoName}`,target:`_blank`,rel:`noopener noreferrer`,className:`px-3 py-1.5 bg-slate-50 hover:bg-slate-100 border-2 border-ink-black text-xs font-bold text-ink-black flex items-center gap-1 shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none no-underline cursor-pointer`,children:[(0,E.jsx)(u,{className:`w-3.5 h-3.5`}),(0,E.jsx)(`span`,{children:`View Repo`})]}),(0,E.jsxs)(`button`,{onClick:()=>{window.confirm(`Disconnect your GitHub account from AlgoSpaced?`)&&(w(),D(S()),k(null),q({type:`info`,text:`Disconnected from GitHub.`}))},className:`px-3 py-1.5 bg-white hover:bg-rose-50 border-2 border-rose-300 text-rose-700 text-xs font-bold flex items-center gap-1 cursor-pointer transition-all`,title:`Disconnect GitHub`,children:[(0,E.jsx)(a,{className:`w-3 h-3`}),(0,E.jsx)(`span`,{children:`Disconnect`})]})]})]}),(0,E.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] space-y-3`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2 border-slate-200`,children:[(0,E.jsxs)(`span`,{className:`font-headline-md font-bold text-xs uppercase text-ink-black flex items-center gap-1.5`,children:[(0,E.jsx)(s,{className:`w-3.5 h-3.5 text-ink-black`}),`Target Repository & Branch`]}),(0,E.jsxs)(`button`,{onClick:Z,disabled:B,className:`px-2.5 py-1 bg-yellow-100 hover:bg-yellow-200 border border-ink-black text-[10px] font-bold text-ink-black flex items-center gap-1 cursor-pointer disabled:opacity-50 shadow-[1px_1px_0px_0px_#1E293B]`,children:[B?(0,E.jsx)(d,{className:`w-3 h-3 animate-spin`}):(0,E.jsx)(m,{className:`w-3 h-3 text-emerald-700`}),(0,E.jsx)(`span`,{children:`Verify / Init Repo`})]})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`block text-[10px] font-bold text-trash-gray uppercase mb-1`,children:`Repository Name`}),(0,E.jsx)(`input`,{type:`text`,value:h.repoName,onChange:e=>{let t=e.target.value;D(e=>({...e,repoName:t})),C({repoName:t})},placeholder:`algospaced-solutions`,className:`w-full bg-slate-50 border-2 border-ink-black rounded py-1.5 px-2.5 text-xs font-mono font-medium focus:outline-none focus:bg-white`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`block text-[10px] font-bold text-trash-gray uppercase mb-1`,children:`Branch Name`}),(0,E.jsx)(`input`,{type:`text`,value:h.branch,onChange:e=>{let t=e.target.value;D(e=>({...e,branch:t})),C({branch:t})},placeholder:`main`,className:`w-full bg-slate-50 border-2 border-ink-black rounded py-1.5 px-2.5 text-xs font-mono font-medium focus:outline-none focus:bg-white`})]})]}),(0,E.jsxs)(`div`,{className:`pt-2 border-t border-slate-100 flex items-center justify-between`,children:[(0,E.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,E.jsx)(c,{className:`w-4 h-4 text-amber-500 shrink-0 mt-0.5`}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`span`,{className:`text-xs font-bold text-ink-black block`,children:`Auto-commit on every submission`}),(0,E.jsx)(`span`,{className:`text-[10px] text-trash-gray font-medium`,children:`Automatically push code to your repo when grading a review card or saving a solution.`})]})]}),(0,E.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer select-none`,children:[(0,E.jsx)(`input`,{type:`checkbox`,checked:h.autoCommit,onChange:e=>ee(e.target.checked),className:`sr-only peer`}),(0,E.jsx)(`div`,{className:`w-9 h-5 bg-slate-300 peer-focus:outline-none border-2 border-ink-black rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-2 after:border-ink-black after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-emerald-500`})]})]})]}),(0,E.jsxs)(`div`,{className:`bg-[#fffdf0] border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] space-y-3`,children:[(0,E.jsxs)(`span`,{className:`font-headline-md font-bold text-xs uppercase text-ink-black flex items-center gap-1.5`,children:[(0,E.jsx)(f,{className:`w-3.5 h-3.5 text-ink-black`}),`Manual Push & Sync Operations`]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,E.jsxs)(`button`,{onClick:$,disabled:W||!r,className:`p-3 bg-white hover:bg-emerald-50 border-2 border-ink-black text-left flex flex-col justify-between gap-1 shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer transition-all disabled:opacity-50`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,E.jsxs)(`span`,{className:`font-bold text-xs text-ink-black font-headline-md flex items-center gap-1.5`,children:[W?(0,E.jsx)(d,{className:`w-3.5 h-3.5 animate-spin text-emerald-600`}):(0,E.jsx)(n,{className:`w-3.5 h-3.5 text-emerald-600`}),`Push Active Problem`]}),r?.problem_number&&(0,E.jsxs)(`span`,{className:`text-[9px] font-mono px-1.5 py-0.5 bg-emerald-100 text-emerald-800 rounded font-bold`,children:[`#`,r.problem_number]})]}),(0,E.jsx)(`span`,{className:`text-[10px] text-slate-500 line-clamp-1`,children:r?.name||`No active problem open in review`})]}),(0,E.jsxs)(`button`,{onClick:Q,disabled:H,className:`p-3 bg-[#ffe24c] hover:bg-yellow-300 border-2 border-ink-black text-left flex flex-col justify-between gap-1 shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer transition-all disabled:opacity-50`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,E.jsxs)(`span`,{className:`font-bold text-xs text-ink-black font-headline-md flex items-center gap-1.5`,children:[H?(0,E.jsx)(d,{className:`w-3.5 h-3.5 animate-spin text-ink-black`}):(0,E.jsx)(o,{className:`w-3.5 h-3.5 text-ink-black`}),`Sync Entire Library`]}),(0,E.jsx)(`span`,{className:`text-[8px] font-arcade uppercase font-bold bg-white px-1.5 py-0.5 border border-ink-black`,children:`BATCH`})]}),(0,E.jsx)(`span`,{className:`text-[10px] text-slate-700`,children:`Push all solved problems + generate root README index`})]})]})]})]}):(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-5 sm:p-6 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] text-center space-y-4`,children:[(0,E.jsxs)(`div`,{className:`max-w-md mx-auto space-y-2`,children:[(0,E.jsx)(`h4`,{className:`font-headline-md font-bold text-sm uppercase text-ink-black m-0`,children:`Connect Your GitHub Account`}),(0,E.jsx)(`p`,{className:`text-xs text-trash-gray font-medium leading-relaxed m-0`,children:`Sync all your DSA solutions directly to your GitHub repository. Commit automatically on review completion or push anytime with 1-click.`})]}),(0,E.jsxs)(`div`,{className:`pt-2 flex flex-col items-center`,children:[(0,E.jsx)(`button`,{onClick:Y,disabled:I,className:`w-full sm:w-auto px-6 py-3 bg-[#24292e] hover:bg-black text-white font-bold text-xs uppercase font-headline-md border-[3px] border-ink-black shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none flex items-center justify-center gap-2.5 transition-all cursor-pointer disabled:opacity-50`,children:I?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(d,{className:`w-4 h-4 animate-spin text-yellow-300`}),(0,E.jsx)(`span`,{children:`AUTHORIZING WITH GITHUB...`})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`svg`,{className:`w-4 h-4 fill-white`,viewBox:`0 0 19 19`,children:(0,E.jsx)(`path`,{fillRule:`evenodd`,d:`M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844`,clipRule:`evenodd`})}),(0,E.jsx)(`span`,{children:`CONNECT WITH GITHUB (1-CLICK)`})]})}),(0,E.jsxs)(`span`,{className:`text-[10px] text-trash-gray mt-2`,children:[`Direct 1-click OAuth (works for guest and signed-in users). Requests `,(0,E.jsx)(`code`,{children:`repo`}),` access.`]})]})]}),(0,E.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)]`,children:[(0,E.jsxs)(`button`,{type:`button`,onClick:()=>N(!M),className:`w-full flex items-center justify-between text-left text-xs font-bold text-ink-black font-headline-md uppercase cursor-pointer bg-transparent border-0 p-0`,children:[(0,E.jsx)(`span`,{children:`Or connect via Personal Access Token (PAT)`}),(0,E.jsx)(`span`,{className:`text-slate-500`,children:M?`▲ Hide`:`▼ Show`})]}),M&&(0,E.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-slate-200 space-y-3`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,E.jsx)(`span`,{className:`font-semibold text-slate-700`,children:`Personal Access Token:`}),(0,E.jsxs)(`a`,{href:`https://github.com/settings/tokens/new?scopes=repo&description=AlgoSpaced%20Solutions%20Sync`,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-600 hover:text-blue-800 font-bold flex items-center gap-1 no-underline text-[10px]`,children:[(0,E.jsx)(`span`,{children:`Generate token with repo scope`}),(0,E.jsx)(u,{className:`w-3 h-3`})]})]}),(0,E.jsxs)(`div`,{className:`relative`,children:[(0,E.jsx)(`input`,{type:P?`text`:`password`,value:A,onChange:e=>j(e.target.value),placeholder:`ghp_... or github_pat_...`,className:`w-full bg-slate-50 border-2 border-ink-black rounded py-2 pl-3 pr-9 text-xs font-mono focus:outline-none focus:bg-white`}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>F(!P),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-slate-400 hover:text-ink-black cursor-pointer bg-transparent border-0 p-1`,children:P?(0,E.jsx)(t,{className:`w-3.5 h-3.5`}):(0,E.jsx)(i,{className:`w-3.5 h-3.5`})})]}),(0,E.jsx)(`button`,{onClick:X,disabled:R||!A.trim(),className:`px-4 py-2 bg-[#ffe24c] hover:bg-yellow-300 text-ink-black font-bold text-xs uppercase border-2 border-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer disabled:opacity-50 flex items-center gap-1.5`,children:R?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(d,{className:`w-3.5 h-3.5 animate-spin`}),(0,E.jsx)(`span`,{children:`VERIFYING TOKEN...`})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(m,{className:`w-3.5 h-3.5`}),(0,E.jsx)(`span`,{children:`SAVE & CONNECT TOKEN`})]})})]})]})]}),K&&(0,E.jsxs)(`div`,{className:`p-3 border-[2px] border-ink-black text-xs font-semibold rounded flex items-center justify-between gap-2 ${K.type===`success`?`bg-emerald-100 text-emerald-900 border-emerald-600`:K.type===`error`?`bg-rose-100 text-rose-900 border-rose-600`:`bg-sky-100 text-sky-900 border-sky-600`}`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[K.type===`success`?(0,E.jsx)(l,{className:`w-4 h-4 shrink-0`}):(0,E.jsx)(p,{className:`w-4 h-4 shrink-0`}),(0,E.jsx)(`span`,{children:K.text})]}),K.linkUrl&&(0,E.jsxs)(`a`,{href:K.linkUrl,target:`_blank`,rel:`noopener noreferrer`,className:`px-2 py-0.5 bg-white border border-ink-black text-[10px] font-bold text-ink-black hover:bg-slate-50 no-underline shrink-0 flex items-center gap-1`,children:[(0,E.jsx)(`span`,{children:`Open`}),(0,E.jsx)(u,{className:`w-3 h-3`})]})]})]}),(0,E.jsx)(`div`,{className:`pt-4 border-t border-slate-300 flex justify-end`,children:(0,E.jsx)(`button`,{onClick:e,className:`px-4 py-2 bg-white hover:bg-slate-100 border-[2px] border-ink-black text-xs font-bold text-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer uppercase`,children:`CLOSE`})})]})};export{D as GitHubSyncWindow,D as default}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/GitHubSyncWindow-D0t6e3o3.js b/algospaced-ui/dist/assets/GitHubSyncWindow-D0t6e3o3.js deleted file mode 100644 index 50c9dacd788de565cff12f3268e22b62e16b9bf6..0000000000000000000000000000000000000000 --- a/algospaced-ui/dist/assets/GitHubSyncWindow-D0t6e3o3.js +++ /dev/null @@ -1 +0,0 @@ -import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,A as n,H as r,Lt as i,X as a,Y as o,Z as s,et as c,ft as l,mt as u,o as d,st as f,tt as p,yt as m,zt as h}from"./vendor-react-qmUj3JUi.js";import{a as g,c as _,i as v,l as y,n as b,o as x,r as S,s as C,t as w}from"./githubSyncService-DQdE4J2L.js";var T=e(h(),1),E=i(),D=({onClose:e,currentProblem:i})=>{let[h,D]=(0,T.useState)(()=>S()),[O,k]=(0,T.useState)(()=>v()),[A,j]=(0,T.useState)(``),[M,N]=(0,T.useState)(!1),[P,F]=(0,T.useState)(!1),[I,L]=(0,T.useState)(!1),[R,z]=(0,T.useState)(!1),[B,V]=(0,T.useState)(!1),[H,U]=(0,T.useState)(!1),[W,G]=(0,T.useState)(!1),[K,q]=(0,T.useState)(null),J=!!(h.token&&(h.username||O?.login));(0,T.useEffect)(()=>{h.token&&!O&&y(h.token).then(e=>{e.valid&&e.user&&(k(e.user),C({username:e.user.login},e.user))})},[h.token,O]);let Y=async()=>{L(!0),q(null);try{let{token:e,user:t}=await b();k(t);let n=S();D(n);try{await g(e,n.repoName,n.isPrivate)}catch{}q({type:`success`,text:`Connected successfully to GitHub as @${t.login}!`,linkUrl:t.html_url})}catch(e){q({type:`error`,text:e.message||`GitHub OAuth authorization failed.`})}finally{L(!1)}},X=async()=>{let e=A.trim();if(!e){q({type:`error`,text:`Please enter a valid GitHub token.`});return}z(!0),q(null);try{let t=await y(e);if(t.valid&&t.user){k(t.user),C({token:e,username:t.user.login},t.user),D(S());try{await g(e,h.repoName,h.isPrivate)}catch{}j(``),N(!1),q({type:`success`,text:`Verified and connected as @${t.user.login}!`,linkUrl:t.user.html_url})}else q({type:`error`,text:t.error||`Token verification failed. Please check permissions.`})}catch(e){q({type:`error`,text:e.message||`Failed to connect with token.`})}finally{z(!1)}},Z=async()=>{if(h.token){V(!0),q(null);try{let e=await g(h.token,h.repoName,h.isPrivate);C({repoName:h.repoName}),q({type:`success`,text:e.created?`Created new repository ${e.full_name} on GitHub!`:`Connected to existing repository ${e.full_name}!`,linkUrl:e.html_url})}catch(e){q({type:`error`,text:e.message||`Failed to initialize repository.`})}finally{V(!1)}}},Q=async()=>{if(h.token&&h.repoName){U(!0),q(null);try{let e=await _(h.token,h.repoName,h.branch);q({type:`success`,text:e.message||`Synced ${e.synced_count} solutions to ${h.repoName}!`,linkUrl:e.repo_url})}catch(e){q({type:`error`,text:e.message||`Batch sync failed.`})}finally{U(!1)}}},$=async()=>{if(!i||!h.token)return;let e=i.code||i.reference_code;if(!e||!e.trim()){q({type:`error`,text:`Current problem has no code to push. Write or save code first!`});return}G(!0),q(null);try{let t={token:h.token,repo:h.repoName,branch:h.branch,problem_number:i.problem_number,problem_name:i.name||`Algorithm Problem`,difficulty:i.difficulty||`Medium`,pattern:i.pattern||`Algorithms`,optimal_time:i.optimal_time||`O(N)`,optimal_space:i.optimal_space||`O(1)`,description:i.description||``,code:e},n=await x(t);q({type:`success`,text:`Committed ${i.name} to GitHub!`,linkUrl:n.html_url})}catch(e){q({type:`error`,text:e.message||`Failed to push current solution.`})}finally{G(!1)}},ee=e=>{C({autoCommit:e}),D(t=>({...t,autoCommit:e})),q({type:`info`,text:e?`Auto-commit ENABLED: Solutions will sync automatically on submission.`:`Auto-commit DISABLED: You can still push manually any time.`})};return(0,E.jsxs)(`div`,{className:`w-full h-full bg-[#fdf8e1] p-4 sm:p-6 flex flex-col justify-between select-none font-sans text-ink-black overflow-y-auto custom-scrollbar`,children:[(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between border-b-[3px] border-ink-black pb-3`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`w-9 h-9 bg-ink-black rounded border-2 border-ink-black flex items-center justify-center text-white shadow-[2px_2px_0px_0px_rgba(0,0,0,0.15)]`,children:(0,E.jsx)(`svg`,{className:`w-5 h-5 fill-white`,viewBox:`0 0 19 19`,children:(0,E.jsx)(`path`,{fillRule:`evenodd`,d:`M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844`,clipRule:`evenodd`})})}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h3`,{className:`font-headline-md font-bold text-sm uppercase m-0 flex items-center gap-2`,children:`GitHub Solutions Station`}),(0,E.jsx)(`p`,{className:`text-[11px] text-trash-gray font-semibold m-0`,children:`Sync algorithm solutions & auto-commit to your personal portfolio repository`})]})]}),(0,E.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,E.jsx)(`span`,{className:`px-2.5 py-1 text-[9px] font-bold font-arcade uppercase border-2 border-ink-black ${J?`bg-emerald-300 text-emerald-950`:`bg-amber-200 text-amber-950`}`,children:J?`CONNECTED`:`DISCONNECTED`})})]}),J?(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[O?.avatar_url?(0,E.jsx)(`img`,{src:O.avatar_url,alt:O.login,className:`w-10 h-10 rounded-full border-2 border-ink-black shadow-[1px_1px_0px_0px_#1E293B]`}):(0,E.jsx)(`div`,{className:`w-10 h-10 bg-slate-200 rounded-full border-2 border-ink-black flex items-center justify-center font-bold`,children:`GH`}),(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,E.jsx)(`span`,{className:`font-bold text-xs text-ink-black`,children:O?.name||O?.login||h.username}),(0,E.jsxs)(`span`,{className:`text-[10px] text-trash-gray font-mono`,children:[`(@`,O?.login||h.username,`)`]})]}),(0,E.jsxs)(`div`,{className:`text-[11px] text-slate-600 font-medium flex items-center gap-1 mt-0.5`,children:[(0,E.jsx)(s,{className:`w-3.5 h-3.5 text-blue-600 shrink-0`}),(0,E.jsxs)(`span`,{className:`font-semibold text-ink-black`,children:[h.username||O?.login,`/`,h.repoName]}),(0,E.jsxs)(`span`,{className:`text-slate-400`,children:[`(`,h.branch,`)`]})]})]})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsxs)(`a`,{href:`https://github.com/${h.username||O?.login}/${h.repoName}`,target:`_blank`,rel:`noopener noreferrer`,className:`px-3 py-1.5 bg-slate-50 hover:bg-slate-100 border-2 border-ink-black text-xs font-bold text-ink-black flex items-center gap-1 shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none no-underline cursor-pointer`,children:[(0,E.jsx)(p,{className:`w-3.5 h-3.5`}),(0,E.jsx)(`span`,{children:`View Repo`})]}),(0,E.jsxs)(`button`,{onClick:()=>{window.confirm(`Disconnect your GitHub account from AlgoSpaced?`)&&(w(),D(S()),k(null),q({type:`info`,text:`Disconnected from GitHub.`}))},className:`px-3 py-1.5 bg-white hover:bg-rose-50 border-2 border-rose-300 text-rose-700 text-xs font-bold flex items-center gap-1 cursor-pointer transition-all`,title:`Disconnect GitHub`,children:[(0,E.jsx)(r,{className:`w-3 h-3`}),(0,E.jsx)(`span`,{children:`Disconnect`})]})]})]}),(0,E.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] space-y-3`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2 border-slate-200`,children:[(0,E.jsxs)(`span`,{className:`font-headline-md font-bold text-xs uppercase text-ink-black flex items-center gap-1.5`,children:[(0,E.jsx)(a,{className:`w-3.5 h-3.5 text-ink-black`}),`Target Repository & Branch`]}),(0,E.jsxs)(`button`,{onClick:Z,disabled:B,className:`px-2.5 py-1 bg-yellow-100 hover:bg-yellow-200 border border-ink-black text-[10px] font-bold text-ink-black flex items-center gap-1 cursor-pointer disabled:opacity-50 shadow-[1px_1px_0px_0px_#1E293B]`,children:[B?(0,E.jsx)(n,{className:`w-3 h-3 animate-spin`}):(0,E.jsx)(m,{className:`w-3 h-3 text-emerald-700`}),(0,E.jsx)(`span`,{children:`Verify / Init Repo`})]})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`block text-[10px] font-bold text-trash-gray uppercase mb-1`,children:`Repository Name`}),(0,E.jsx)(`input`,{type:`text`,value:h.repoName,onChange:e=>{let t=e.target.value;D(e=>({...e,repoName:t})),C({repoName:t})},placeholder:`algospaced-solutions`,className:`w-full bg-slate-50 border-2 border-ink-black rounded py-1.5 px-2.5 text-xs font-mono font-medium focus:outline-none focus:bg-white`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`block text-[10px] font-bold text-trash-gray uppercase mb-1`,children:`Branch Name`}),(0,E.jsx)(`input`,{type:`text`,value:h.branch,onChange:e=>{let t=e.target.value;D(e=>({...e,branch:t})),C({branch:t})},placeholder:`main`,className:`w-full bg-slate-50 border-2 border-ink-black rounded py-1.5 px-2.5 text-xs font-mono font-medium focus:outline-none focus:bg-white`})]})]}),(0,E.jsxs)(`div`,{className:`pt-2 border-t border-slate-100 flex items-center justify-between`,children:[(0,E.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,E.jsx)(d,{className:`w-4 h-4 text-amber-500 shrink-0 mt-0.5`}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`span`,{className:`text-xs font-bold text-ink-black block`,children:`Auto-commit on every submission`}),(0,E.jsx)(`span`,{className:`text-[10px] text-trash-gray font-medium`,children:`Automatically push code to your repo when grading a review card or saving a solution.`})]})]}),(0,E.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer select-none`,children:[(0,E.jsx)(`input`,{type:`checkbox`,checked:h.autoCommit,onChange:e=>ee(e.target.checked),className:`sr-only peer`}),(0,E.jsx)(`div`,{className:`w-9 h-5 bg-slate-300 peer-focus:outline-none border-2 border-ink-black rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-2 after:border-ink-black after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-emerald-500`})]})]})]}),(0,E.jsxs)(`div`,{className:`bg-[#fffdf0] border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] space-y-3`,children:[(0,E.jsxs)(`span`,{className:`font-headline-md font-bold text-xs uppercase text-ink-black flex items-center gap-1.5`,children:[(0,E.jsx)(f,{className:`w-3.5 h-3.5 text-ink-black`}),`Manual Push & Sync Operations`]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,E.jsxs)(`button`,{onClick:$,disabled:W||!i,className:`p-3 bg-white hover:bg-emerald-50 border-2 border-ink-black text-left flex flex-col justify-between gap-1 shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer transition-all disabled:opacity-50`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,E.jsxs)(`span`,{className:`font-bold text-xs text-ink-black font-headline-md flex items-center gap-1.5`,children:[W?(0,E.jsx)(n,{className:`w-3.5 h-3.5 animate-spin text-emerald-600`}):(0,E.jsx)(o,{className:`w-3.5 h-3.5 text-emerald-600`}),`Push Active Problem`]}),i?.problem_number&&(0,E.jsxs)(`span`,{className:`text-[9px] font-mono px-1.5 py-0.5 bg-emerald-100 text-emerald-800 rounded font-bold`,children:[`#`,i.problem_number]})]}),(0,E.jsx)(`span`,{className:`text-[10px] text-slate-500 line-clamp-1`,children:i?.name||`No active problem open in review`})]}),(0,E.jsxs)(`button`,{onClick:Q,disabled:H,className:`p-3 bg-[#ffe24c] hover:bg-yellow-300 border-2 border-ink-black text-left flex flex-col justify-between gap-1 shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer transition-all disabled:opacity-50`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,E.jsxs)(`span`,{className:`font-bold text-xs text-ink-black font-headline-md flex items-center gap-1.5`,children:[H?(0,E.jsx)(n,{className:`w-3.5 h-3.5 animate-spin text-ink-black`}):(0,E.jsx)(s,{className:`w-3.5 h-3.5 text-ink-black`}),`Sync Entire Library`]}),(0,E.jsx)(`span`,{className:`text-[8px] font-arcade uppercase font-bold bg-white px-1.5 py-0.5 border border-ink-black`,children:`BATCH`})]}),(0,E.jsx)(`span`,{className:`text-[10px] text-slate-700`,children:`Push all solved problems + generate root README index`})]})]})]})]}):(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-5 sm:p-6 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] text-center space-y-4`,children:[(0,E.jsxs)(`div`,{className:`max-w-md mx-auto space-y-2`,children:[(0,E.jsx)(`h4`,{className:`font-headline-md font-bold text-sm uppercase text-ink-black m-0`,children:`Connect Your GitHub Account`}),(0,E.jsx)(`p`,{className:`text-xs text-trash-gray font-medium leading-relaxed m-0`,children:`Sync all your DSA solutions directly to your GitHub repository. Commit automatically on review completion or push anytime with 1-click.`})]}),(0,E.jsxs)(`div`,{className:`pt-2 flex flex-col items-center`,children:[(0,E.jsx)(`button`,{onClick:Y,disabled:I,className:`w-full sm:w-auto px-6 py-3 bg-[#24292e] hover:bg-black text-white font-bold text-xs uppercase font-headline-md border-[3px] border-ink-black shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none flex items-center justify-center gap-2.5 transition-all cursor-pointer disabled:opacity-50`,children:I?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(n,{className:`w-4 h-4 animate-spin text-yellow-300`}),(0,E.jsx)(`span`,{children:`AUTHORIZING WITH GITHUB...`})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`svg`,{className:`w-4 h-4 fill-white`,viewBox:`0 0 19 19`,children:(0,E.jsx)(`path`,{fillRule:`evenodd`,d:`M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844`,clipRule:`evenodd`})}),(0,E.jsx)(`span`,{children:`CONNECT WITH GITHUB (1-CLICK)`})]})}),(0,E.jsxs)(`span`,{className:`text-[10px] text-trash-gray mt-2`,children:[`Direct 1-click OAuth (works for guest and signed-in users). Requests `,(0,E.jsx)(`code`,{children:`repo`}),` access.`]})]})]}),(0,E.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)]`,children:[(0,E.jsxs)(`button`,{type:`button`,onClick:()=>N(!M),className:`w-full flex items-center justify-between text-left text-xs font-bold text-ink-black font-headline-md uppercase cursor-pointer bg-transparent border-0 p-0`,children:[(0,E.jsx)(`span`,{children:`Or connect via Personal Access Token (PAT)`}),(0,E.jsx)(`span`,{className:`text-slate-500`,children:M?`▲ Hide`:`▼ Show`})]}),M&&(0,E.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-slate-200 space-y-3`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,E.jsx)(`span`,{className:`font-semibold text-slate-700`,children:`Personal Access Token:`}),(0,E.jsxs)(`a`,{href:`https://github.com/settings/tokens/new?scopes=repo&description=AlgoSpaced%20Solutions%20Sync`,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-600 hover:text-blue-800 font-bold flex items-center gap-1 no-underline text-[10px]`,children:[(0,E.jsx)(`span`,{children:`Generate token with repo scope`}),(0,E.jsx)(p,{className:`w-3 h-3`})]})]}),(0,E.jsxs)(`div`,{className:`relative`,children:[(0,E.jsx)(`input`,{type:P?`text`:`password`,value:A,onChange:e=>j(e.target.value),placeholder:`ghp_... or github_pat_...`,className:`w-full bg-slate-50 border-2 border-ink-black rounded py-2 pl-3 pr-9 text-xs font-mono focus:outline-none focus:bg-white`}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>F(!P),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-slate-400 hover:text-ink-black cursor-pointer bg-transparent border-0 p-1`,children:P?(0,E.jsx)(c,{className:`w-3.5 h-3.5`}):(0,E.jsx)(t,{className:`w-3.5 h-3.5`})})]}),(0,E.jsx)(`button`,{onClick:X,disabled:R||!A.trim(),className:`px-4 py-2 bg-[#ffe24c] hover:bg-yellow-300 text-ink-black font-bold text-xs uppercase border-2 border-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer disabled:opacity-50 flex items-center gap-1.5`,children:R?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(n,{className:`w-3.5 h-3.5 animate-spin`}),(0,E.jsx)(`span`,{children:`VERIFYING TOKEN...`})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(m,{className:`w-3.5 h-3.5`}),(0,E.jsx)(`span`,{children:`SAVE & CONNECT TOKEN`})]})})]})]})]}),K&&(0,E.jsxs)(`div`,{className:`p-3 border-[2px] border-ink-black text-xs font-semibold rounded flex items-center justify-between gap-2 ${K.type===`success`?`bg-emerald-100 text-emerald-900 border-emerald-600`:K.type===`error`?`bg-rose-100 text-rose-900 border-rose-600`:`bg-sky-100 text-sky-900 border-sky-600`}`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[K.type===`success`?(0,E.jsx)(l,{className:`w-4 h-4 shrink-0`}):(0,E.jsx)(u,{className:`w-4 h-4 shrink-0`}),(0,E.jsx)(`span`,{children:K.text})]}),K.linkUrl&&(0,E.jsxs)(`a`,{href:K.linkUrl,target:`_blank`,rel:`noopener noreferrer`,className:`px-2 py-0.5 bg-white border border-ink-black text-[10px] font-bold text-ink-black hover:bg-slate-50 no-underline shrink-0 flex items-center gap-1`,children:[(0,E.jsx)(`span`,{children:`Open`}),(0,E.jsx)(p,{className:`w-3 h-3`})]})]})]}),(0,E.jsx)(`div`,{className:`pt-4 border-t border-slate-300 flex justify-end`,children:(0,E.jsx)(`button`,{onClick:e,className:`px-4 py-2 bg-white hover:bg-slate-100 border-[2px] border-ink-black text-xs font-bold text-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer uppercase`,children:`CLOSE`})})]})};export{D as GitHubSyncWindow,D as default}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/JourneyPath-C_DuHGaN.js b/algospaced-ui/dist/assets/JourneyPath-C_DuHGaN.js new file mode 100644 index 0000000000000000000000000000000000000000..ab0f51bf5b13c2438ec60c5b3a046b1e33d1d72e --- /dev/null +++ b/algospaced-ui/dist/assets/JourneyPath-C_DuHGaN.js @@ -0,0 +1,65 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{C as t,Ct as n,D as r,E as i,L as a,Lt as o,P as s,R as c,S as l,U as u,W as d,Z as f,_t as p,a as m,c as h,ct as g,dt as _,et as v,ft as y,gt as b,h as x,ht as S,i as C,k as w,l as T,lt as E,m as D,mt as O,o as k,p as A,q as j,r as M,rt as N,s as ee,v as te,vt as ne,y as re,z as ie,zt as P}from"./vendor-react-q-oOktF_.js";import{r as F}from"./firebaseClient-G7klkuBb.js";import{a as ae,c as oe,o as I}from"./index-Bcgsshpk.js";import{t as se}from"./confetti.module-Uxh4CK4s.js";var L=e(P(),1),R=2600,z=1500,B=[{tMax:.15,name:`The Whispering Coast & Lowlands`,biome:`coast`},{tMax:.32,name:`The Elderwood Deep Forest`,biome:`forest`},{tMax:.48,name:`River Elden & The Twin Fords`,biome:`river`},{tMax:.68,name:`The Dragon Tooth Mountains & Passes`,biome:`mountain`},{tMax:.83,name:`The Misty Glade & Highland Woods`,biome:`forest`},{tMax:.93,name:`The Roaring Gorge & Cataracts`,biome:`river`},{tMax:1,name:`The Sunstone Peaks & Ancient Citadel`,biome:`ancient_ruins`}],V=[`Pencil marks still visible from the cartographer’s first survey.`,`A calm breeze sweeps through the grass, carrying the scent of pine.`,`Wooden planks creak underfoot as the river roars below.`,`Craggy pencil hatchings reveal steep, unforgiving granite slopes.`,`Ancient roots break through the worn gravel pathway.`,`The sound of rushing water echoes across the canyon walls.`,`A solitary stone marker inscribed with early explorer symbols.`,`Golden light filters softly through the sketched canopy.`,`Distant mountain ridges frame the expanding horizon.`,`A tranquil haven where wanderers rest before the mountain climb.`];function ce(e=[],t={}){let n=[],r=e.length>0?e.length:150,i=[{t:0,x:220,y:1320,elev:10},{t:.08,x:380,y:1140,elev:45},{t:.16,x:580,y:980,elev:120},{t:.24,x:820,y:1120,elev:90},{t:.32,x:940,y:860,elev:180},{t:.4,x:720,y:640,elev:320},{t:.48,x:1050,y:520,elev:580},{t:.56,x:1320,y:720,elev:890},{t:.64,x:1540,y:480,elev:1250},{t:.72,x:1780,y:680,elev:920},{t:.8,x:1980,y:920,elev:460},{t:.88,x:2220,y:760,elev:750},{t:.94,x:2180,y:480,elev:1180},{t:1,x:2420,y:240,elev:1620}];for(let a=0;a1?a/(r-1):0,s=0;for(;so<=e.tMax)||B[B.length-1],D=e.length>0?e[a]:a+1,O=t[D]||(D<0?`Custom Challenge ${a+1}`:`LeetCode #${D}`),k=V[a%V.length];n.push({id:D,sequenceIndex:a,x,y:S,name:O,biome:E.biome,regionName:E.name,elevation:Math.max(10,T),lore:k})}return n}var H=[{id:`wm-bg1`,x:380,y:310,size:70,height:85,ridgeShift:-4,hasSnow:!1,layer:0,elevation:840,rangeName:`Western Crags`},{id:`wm-bg2`,x:490,y:280,size:85,height:105,ridgeShift:6,hasSnow:!0,layer:0,elevation:1120,name:`Peak of the North Wind`,rangeName:`Western Crags`},{id:`wm-bg3`,x:620,y:300,size:75,height:95,ridgeShift:-3,hasSnow:!1,layer:0,elevation:960,rangeName:`Western Crags`},{id:`wm-bg4`,x:730,y:320,size:65,height:80,ridgeShift:4,hasSnow:!1,layer:0,elevation:780,rangeName:`Western Crags`},{id:`m1`,x:430,y:375,size:80,height:105,ridgeShift:5,hasSnow:!0,elevation:1240,name:`Crag of the Mist`,rangeName:`Western Crags`},{id:`m2`,x:530,y:345,size:95,height:125,ridgeShift:-7,hasSnow:!0,elevation:1480,name:`Peak of Solitude`,rangeName:`Western Crags`},{id:`m3`,x:630,y:365,size:85,height:110,ridgeShift:3,hasSnow:!0,elevation:1310,name:`Shadowhorn`,rangeName:`Western Crags`},{id:`m4`,x:720,y:385,size:70,height:90,ridgeShift:-4,hasSnow:!1,elevation:990,rangeName:`Western Crags`},{id:`m5`,x:370,y:430,size:55,height:65,ridgeShift:4,hasSnow:!1,layer:2,elevation:620,rangeName:`Western Crags`},{id:`m6`,x:470,y:425,size:68,height:80,ridgeShift:-3,hasSnow:!1,layer:2,elevation:760,name:`Gullwing Bluff`,rangeName:`Western Crags`},{id:`m6b`,x:575,y:420,size:72,height:88,ridgeShift:3,hasSnow:!1,layer:2,elevation:850,rangeName:`Western Crags`},{id:`m6c`,x:670,y:435,size:58,height:70,ridgeShift:-2,hasSnow:!1,layer:2,elevation:680,rangeName:`Western Crags`},{id:`dt-bg1`,x:1130,y:260,size:90,height:120,ridgeShift:-6,hasSnow:!0,layer:0,elevation:1850,rangeName:`Dragon's Tooth Range`},{id:`dt-bg2`,x:1250,y:225,size:115,height:150,ridgeShift:8,hasSnow:!0,layer:0,elevation:2180,name:`Crown of the North`,rangeName:`Dragon's Tooth Range`},{id:`dt-bg3`,x:1380,y:210,size:130,height:175,ridgeShift:-10,hasSnow:!0,layer:0,elevation:2450,name:`Apex of Clouds`,rangeName:`Dragon's Tooth Range`},{id:`dt-bg4`,x:1510,y:240,size:110,height:145,ridgeShift:7,hasSnow:!0,layer:0,elevation:2020,rangeName:`Dragon's Tooth Range`},{id:`dt-bg5`,x:1640,y:280,size:90,height:115,ridgeShift:-5,hasSnow:!0,layer:0,elevation:1690,rangeName:`Dragon's Tooth Range`},{id:`m7`,x:1190,y:325,size:105,height:140,ridgeShift:-8,hasSnow:!0,elevation:1980,name:`The Dragon's Crest`,rangeName:`Dragon's Tooth Range`},{id:`m8`,x:1310,y:295,size:125,height:165,ridgeShift:10,hasSnow:!0,elevation:2360,name:`Frostcrag Pinnacle`,rangeName:`Dragon's Tooth Range`},{id:`m9`,x:1435,y:320,size:115,height:150,ridgeShift:-6,hasSnow:!0,elevation:2120,name:`Thunderhorn Peak`,rangeName:`Dragon's Tooth Range`},{id:`m10`,x:1560,y:355,size:98,height:125,ridgeShift:7,hasSnow:!0,elevation:1780,name:`Screaming Ridge`,rangeName:`Dragon's Tooth Range`},{id:`m10b`,x:1680,y:375,size:85,height:105,ridgeShift:-4,hasSnow:!1,elevation:1420,rangeName:`Dragon's Tooth Range`},{id:`m11`,x:1260,y:415,size:90,height:115,ridgeShift:-5,hasSnow:!0,elevation:1560,name:`Ironhorn Needle`,rangeName:`Dragon's Tooth Range`},{id:`m12`,x:1375,y:405,size:100,height:130,ridgeShift:6,hasSnow:!0,elevation:1720,name:`Shadowcrevasse Crag`,rangeName:`Dragon's Tooth Range`},{id:`m13`,x:1490,y:440,size:88,height:110,ridgeShift:-4,hasSnow:!0,elevation:1490,rangeName:`Dragon's Tooth Range`},{id:`m14`,x:1610,y:435,size:82,height:100,ridgeShift:5,hasSnow:!1,elevation:1320,rangeName:`Dragon's Tooth Range`},{id:`m15`,x:1160,y:590,size:80,height:100,ridgeShift:5,hasSnow:!1,elevation:1180,name:`Wanderer's Bluff`,rangeName:`Mid-Pass Gorge`},{id:`m16`,x:1390,y:610,size:90,height:115,ridgeShift:-6,hasSnow:!0,elevation:1390,name:`Eagle Eye Ridge`,rangeName:`Mid-Pass Gorge`},{id:`m17`,x:1510,y:585,size:95,height:120,ridgeShift:5,hasSnow:!0,elevation:1520,name:`Razorback Spine`,rangeName:`Mid-Pass Gorge`},{id:`m18`,x:1630,y:565,size:85,height:105,ridgeShift:-4,hasSnow:!1,elevation:1280,rangeName:`Mid-Pass Gorge`},{id:`m18b`,x:1740,y:580,size:75,height:90,ridgeShift:3,hasSnow:!1,elevation:1050,rangeName:`Mid-Pass Gorge`},{id:`es-bg1`,x:1980,y:310,size:88,height:115,ridgeShift:-5,hasSnow:!0,layer:0,elevation:1650,rangeName:`Sunstone Highlands`},{id:`es-bg2`,x:2110,y:245,size:105,height:140,ridgeShift:6,hasSnow:!0,layer:0,elevation:1980,name:`Sun Pillar`,rangeName:`Sunstone Highlands`},{id:`es-bg3`,x:2260,y:160,size:135,height:180,ridgeShift:-8,hasSnow:!0,layer:0,elevation:2580,name:`Crown of the Heavens`,rangeName:`Sunstone Highlands`},{id:`es-bg4`,x:2410,y:210,size:115,height:150,ridgeShift:7,hasSnow:!0,layer:0,elevation:2240,rangeName:`Sunstone Highlands`},{id:`m19`,x:2040,y:375,size:98,height:128,ridgeShift:6,hasSnow:!0,elevation:1720,name:`Sunstone Spire`,rangeName:`Sunstone Highlands`},{id:`m20`,x:2170,y:315,size:115,height:150,ridgeShift:-7,hasSnow:!0,elevation:2080,name:`Sanctuary Peak`,rangeName:`Sunstone Highlands`},{id:`m21`,x:2310,y:220,size:130,height:170,ridgeShift:8,hasSnow:!0,elevation:2390,name:`Pinnacle of the Ancients`,rangeName:`Sunstone Highlands`},{id:`m22`,x:2440,y:360,size:90,height:115,ridgeShift:-5,hasSnow:!0,elevation:1610,name:`Falcon Perch`,rangeName:`Sunstone Highlands`},{id:`m23`,x:2260,y:405,size:82,height:98,ridgeShift:4,hasSnow:!1,elevation:1250,name:`Altar Crag`,rangeName:`Sunstone Highlands`},{id:`m24`,x:2380,y:420,size:76,height:88,ridgeShift:-3,hasSnow:!1,elevation:1120,rangeName:`Sunstone Highlands`},{id:`m25`,x:2140,y:450,size:70,height:80,ridgeShift:3,hasSnow:!1,elevation:980,rangeName:`Sunstone Highlands`}],U=[{id:`river-elden`,name:`River Elden`,d:`M 1340,290 C 1310,380 1260,460 1210,540 C 1140,640 1020,700 960,820 C 900,940 930,1060 880,1180 C 840,1280 760,1360 690,1480`,width:14,hasBridges:[{x:945,y:855,angle:-35},{x:890,y:1160,angle:25}]},{id:`river-silver`,name:`Silver Meander`,d:`M 580,410 C 650,490 730,550 780,660 C 830,760 910,810 960,820`,width:8,hasBridges:[{x:740,y:620,angle:45}]},{id:`river-cataract`,name:`Highland Torrent`,d:`M 2150,320 C 2100,450 2050,600 2020,760 C 1990,920 1920,1050 1840,1180 C 1760,1310 1710,1420 1660,1500`,width:11,hasBridges:[{x:2010,y:810,angle:-20}]}],W=[{id:`f1`,name:`The Whispering Pines`,cx:580,cy:1040,rx:230,ry:160,treeCount:42,trees:G(580,1040,210,140,42,`pines`)},{id:`f2`,name:`Elderwood Deep`,cx:820,cy:1140,rx:250,ry:180,treeCount:52,trees:G(820,1140,230,160,52,`oaks`)},{id:`f3`,name:`Mistwood Valley`,cx:860,cy:620,rx:190,ry:140,treeCount:36,trees:G(860,620,170,120,36,`willows`)},{id:`f4`,name:`Highland Spruces`,cx:1760,cy:740,rx:210,ry:155,treeCount:38,trees:G(1760,740,190,135,38,`highland_spruce`)},{id:`f5`,name:`Verdant Basin`,cx:1960,cy:980,rx:200,ry:150,treeCount:38,trees:G(1960,980,180,130,38,`mixed`)},{id:`f6`,name:`Shadowglen Copse`,cx:390,cy:690,rx:140,ry:100,treeCount:22,trees:G(390,690,120,80,22,`pines`)},{id:`f7`,name:`Sunstone Grove`,cx:2360,cy:580,rx:150,ry:110,treeCount:24,trees:G(2360,580,130,90,24,`mixed`)}];function G(e,t,n,r,i,a){let o=[];for(let s=0;s{setTimeout(()=>{if(!this.ctx)return;let t=this.ctx.currentTime,n=this.ctx.createOscillator(),r=this.ctx.createGain();n.type=`sine`,n.frequency.setValueAtTime(e,t),r.gain.setValueAtTime(.001,t),r.gain.linearRampToValueAtTime(.15,t+.05),r.gain.exponentialRampToValueAtTime(1e-4,t+1.2),n.connect(r),r.connect(this.ctx.destination),n.start(t),n.stop(t+1.3)},t*120)}))}},Y=o();function X(e){let t=Math.sin(e*12.9898+78.233)*43758.5453;return t-Math.floor(t)}var ue=({mountain:e,theme:t})=>{let n=t.id!==`parchment`,r=t.pencilColor,i=t.pencilShade,{id:a,x:o,y:s,size:c,height:l,ridgeShift:u=0,hasSnow:d=l>95}=e,f=(0,L.useMemo)(()=>{let e=0;for(let t=0;t.65?l*.04:0;f.push({x:Math.round(o+u),y:Math.round(s+d)})}let p=[];for(let r=1;r<=6;r++){let a=r/6,o=t+(i-t)*a,s=n+l*a,u=(X(e+r*43)-.48)*(c*.14)*Math.sin(a*Math.PI),d=X(e+r*59)>.65?l*.04:0;p.push({x:Math.round(o+u),y:Math.round(s+d)})}let m=[{x:t,y:n}];for(let r=1;r<=7;r++){let i=r/7,a=t+(o+u*.25+(X(e+101)-.5)*(c*.15)-t)*i**1.2,s=n+l*i,d=Math.sin(i*Math.PI*2.2+X(e+113))*(c*.1);m.push({x:Math.round(a+d),y:Math.round(s)})}let h=[],g=m[Math.min(m.length-1,2)];if(g){let t=o+c*.55+(X(e+201)-.5)*15,n=s-l*.12,r=(g.x+t)/2+12,i=(g.y+n)/2-6;h.push({d:`M ${g.x},${g.y} Q ${r},${i} ${t},${n}`,side:`right`})}let _=m[Math.min(m.length-1,5)];if(_){let t=o+c*.85+(X(e+209)-.5)*15,n=s,r=(_.x+t)/2+10,i=(_.y+n)/2-4;h.push({d:`M ${_.x},${_.y} Q ${r},${i} ${t},${n}`,side:`right`})}let v=m[Math.min(m.length-1,3)];if(v){let t=o-c*.6+(X(e+301)-.5)*15,n=s-l*.15,r=(v.x+t)/2-10,i=(v.y+n)/2-5;h.push({d:`M ${v.x},${v.y} Q ${r},${i} ${t},${n}`,side:`left`})}let y=[],b=Math.max(14,Math.round(l/4.8));for(let r=1;r<=b;r++){let a=r/(b+1),o=m[Math.min(m.length-1,Math.max(0,Math.round(a*(m.length-1))))],s=n+l*a,c=p[Math.min(p.length-1,Math.max(0,Math.round(a*(p.length-1))))]||{x:t+(i-t)*a,y:s},u=o.x+(c.x-o.x)*.08,d=s+(X(e+r*71)-.5)*3,f=r%3==0?.92:r%2==0?.75:.6,h=u+(c.x-u)*f,g=d+((s-n)*.22+(c.y-s)*.35)+(X(e+r*83)-.5)*4;y.push({x1:Math.round(u),y1:Math.round(d),x2:Math.round(h),y2:Math.round(g),width:r<4?.9:1.25,opacity:r<3?.6:.85}),r>4&&r%2==0&&y.push({x1:Math.round(u+(h-u)*.3),y1:Math.round(d+(g-d)*.3),x2:Math.round(u+(h-u)*.75),y2:Math.round(d+(g-d)*.15),width:.75,opacity:.55})}let x=[],S=Math.max(4,Math.round(l/18));for(let i=1;i<=S;i++){let a=(i+.3)/(S+1),o=n+l*a,s=m[Math.min(m.length-1,Math.round(a*(m.length-1)))],c=f[Math.min(f.length-1,Math.round(a*(f.length-1)))]||{x:t-(t-r)*a,y:o},u=s.x-(s.x-c.x)*.25,d=o+2,p=s.x-(s.x-c.x)*(.6+X(e+i*97)*.3),h=o+8+X(e+i*103)*6,g=(u+p)/2-4,_=(d+h)/2+3;if(x.push({d:`M ${Math.round(u)},${Math.round(d)} Q ${Math.round(g)},${Math.round(_)} ${Math.round(p)},${Math.round(h)}`,width:.9}),i%2==1){let e=u-6,t=d+3;x.push({d:`M ${Math.round(e)},${Math.round(t)} L ${Math.round(e-8)},${Math.round(t+10)}`,width:.75})}}let C=``,w=``;if(d){let e=n+l*.32,a=t-(t-r)*.32,o=t+(i-t)*.32,s=m[Math.min(m.length-1,2)]||{x:t,y:e},c={x:t-(t-r)*.16,y:e-4},u={x:t-(t-r)*.26,y:e+6},d={x:t+(i-t)*.14,y:e+3},h={x:t+(i-t)*.24,y:e-2};C=`M ${t},${n} + L ${f[1].x},${f[1].y} + L ${a},${e} + Q ${u.x},${u.y} ${c.x},${c.y} + L ${s.x},${s.y} + Q ${d.x},${d.y} ${h.x},${h.y} + L ${o},${e} + L ${p[1].x},${p[1].y} + Z`,w=`M ${t},${n} + L ${s.x},${s.y} + Q ${d.x},${d.y} ${h.x},${h.y} + L ${o},${e} + L ${p[1].x},${p[1].y} + Z`}let T=[],E=[],D=Math.round(c/8);for(let t=0;tt===0?`M ${e.x},${e.y}`:`L ${e.x},${e.y}`).join(` `),k=p.map(e=>`L ${e.x},${e.y}`).join(` `),A=m.map((e,t)=>t===0?`M ${e.x},${e.y}`:`L ${e.x},${e.y}`).join(` `),j=`${O} ${k} Z`,M=p[p.length-1];return{peakX:t,peakY:n,leftX:r,rightX:i,fullPerimeterPath:j,shadedFacePath:`${A} L ${M.x},${M.y} ${p.slice().reverse().map(e=>`L ${e.x},${e.y}`).join(` `)} Z`,ridgePathStr:A,spurs:h,hachures:y,westStrata:x,snowCapPath:C,snowShadePath:w,screeStipples:T,screeLines:E}},[a,o,s,c,l,u,d]),p=n?`#231d17`:`#ded1b4`,m=n?`#1c1712`:`#cdbe9e`,h=n?`#ddd4c5`:`#fcfbf7`,g=n?`#a89c89`:`#e4d8c3`;return(0,Y.jsxs)(`g`,{id:`mountain-${a}`,className:`realistic-mountain-group transition-all duration-300 select-none`,children:[(0,Y.jsx)(`path`,{d:f.fullPerimeterPath,fill:p,stroke:r,strokeWidth:`1.8`,strokeLinejoin:`round`,strokeLinecap:`round`}),(0,Y.jsx)(`path`,{d:f.shadedFacePath,fill:m,opacity:n?.7:.55}),d&&f.snowCapPath&&(0,Y.jsxs)(`g`,{id:`snowcap-${a}`,children:[(0,Y.jsx)(`path`,{d:f.snowCapPath,fill:h,stroke:r,strokeWidth:`1.1`,strokeLinejoin:`round`,opacity:n?.85:.95}),f.snowShadePath&&(0,Y.jsx)(`path`,{d:f.snowShadePath,fill:g,opacity:.65})]}),(0,Y.jsx)(`g`,{id:`strata-${a}`,stroke:r,strokeLinecap:`round`,opacity:n?.65:.75,children:f.westStrata.map((e,t)=>(0,Y.jsx)(`path`,{d:e.d,fill:`none`,strokeWidth:e.width},t))}),(0,Y.jsx)(`g`,{id:`hachures-${a}`,stroke:i,strokeLinecap:`round`,children:f.hachures.map((e,t)=>(0,Y.jsx)(`line`,{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,strokeWidth:e.width,opacity:e.opacity},t))}),(0,Y.jsx)(`g`,{id:`spurs-${a}`,children:f.spurs.map((e,t)=>(0,Y.jsx)(`path`,{d:e.d,fill:`none`,stroke:e.side===`right`?r:i,strokeWidth:e.side===`right`?1.6:1.2,strokeLinecap:`round`,opacity:.85},t))}),(0,Y.jsx)(`path`,{d:f.ridgePathStr,fill:`none`,stroke:r,strokeWidth:`2.4`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,Y.jsxs)(`g`,{id:`scree-${a}`,fill:r,stroke:i,opacity:n?.45:.6,children:[f.screeStipples.map((e,t)=>(0,Y.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r},t)),f.screeLines.map((e,t)=>(0,Y.jsx)(`line`,{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,strokeWidth:`0.8`,strokeLinecap:`round`},t))]})]})},de=({tree:e,theme:t})=>{let{x:n,y:r,scale:i=1,type:a=`pine`}=e,o=t.id!==`parchment`,s=t.pencilColor,c=t.pencilShade,l=o?`#1e281c`:`#d8d4bf`,u=o?`#242a1e`:`#ded6bf`,d=o?`#2e251d`:`#cca98a`,f=o?`#1f2920`:`#d5dcc2`,p=o?`#293222`:`#e2dbcb`;return(0,Y.jsx)(`g`,{id:`tree-${n}-${r}`,className:`realistic-tree`,children:(()=>{switch(a){case`pine`:case`spruce`:{let e=a===`spruce`?14:17,t=a===`spruce`?32:28;return(0,Y.jsxs)(`g`,{transform:`translate(${n}, ${r}) scale(${i})`,children:[(0,Y.jsx)(`ellipse`,{cx:`1`,cy:`2`,rx:e*.75,ry:`3`,fill:s,opacity:o?.25:.2}),(0,Y.jsx)(`path`,{d:`M -1.8,2 L -1,-6 L 1,-6 L 1.8,2 Z`,fill:d,stroke:s,strokeWidth:`1.1`,strokeLinejoin:`round`}),(0,Y.jsx)(`path`,{d:`M 0,-10 + Q ${e*.55},-7 ${e*.95},-3 + Q ${e*.6},0 0, -2 + Q ${-e*.6},0 ${-e*.95},-3 + Q ${-e*.55},-7 0,-10 Z`,fill:l,stroke:s,strokeWidth:`1.2`,strokeLinejoin:`round`}),(0,Y.jsx)(`path`,{d:`M 1,-6 Q ${e*.5},-4 ${e*.85},-3 Q ${e*.4},-1 0,-2 Z`,fill:s,opacity:o?.4:.3}),(0,Y.jsx)(`line`,{x1:`2`,y1:`-7`,x2:e*.75,y2:`-4`,stroke:c,strokeWidth:`0.8`}),(0,Y.jsx)(`line`,{x1:`1`,y1:`-4`,x2:e*.65,y2:`-2`,stroke:c,strokeWidth:`0.8`}),(0,Y.jsx)(`path`,{d:`M 0,-18 + Q ${e*.45},-15 ${e*.8},-11 + Q ${e*.5},-8 0, -10 + Q ${-e*.5},-8 ${-e*.8},-11 + Q ${-e*.45},-15 0,-18 Z`,fill:l,stroke:s,strokeWidth:`1.2`,strokeLinejoin:`round`}),(0,Y.jsx)(`path`,{d:`M 1,-14 Q ${e*.45},-12 ${e*.7},-11 Q ${e*.35},-9 0,-10 Z`,fill:s,opacity:o?.4:.3}),(0,Y.jsx)(`line`,{x1:`1`,y1:`-15`,x2:e*.6,y2:`-12`,stroke:c,strokeWidth:`0.8`}),(0,Y.jsx)(`path`,{d:`M 0,-25 + Q ${e*.35},-22 ${e*.55},-18 + Q ${e*.3},-16 0, -17 + Q ${-e*.3},-16 ${-e*.55},-18 + Q ${-e*.35},-22 0,-25 Z`,fill:l,stroke:s,strokeWidth:`1.1`,strokeLinejoin:`round`}),(0,Y.jsx)(`path`,{d:`M 0,-${t} L ${e*.35},-${t-9} Q 0,-${t-8} -${e*.35},-${t-9} Z`,fill:l,stroke:s,strokeWidth:`1.1`,strokeLinejoin:`round`}),(0,Y.jsx)(`path`,{d:`M 0,-${t} L ${e*.35},-${t-9} Q 0,-${t-8} 0,-${t-9} Z`,fill:s,opacity:o?.4:.35}),(0,Y.jsx)(`path`,{d:`M -5,1 L -3,3 M 3,2 L 5,0 M -1,3 L 0,1`,stroke:s,strokeWidth:`0.8`,strokeLinecap:`round`})]})}case`ancient_oak`:case`oak`:{let e=a===`ancient_oak`,t=e?22:18,l=e?24:20;return(0,Y.jsxs)(`g`,{transform:`translate(${n}, ${r}) scale(${i})`,children:[(0,Y.jsx)(`ellipse`,{cx:`2`,cy:`2`,rx:t*.8,ry:`4`,fill:s,opacity:o?.3:.22}),(0,Y.jsx)(`path`,{d:`M -4,2 Q -3,-4 -2,-8 Q -6,-12 -8,-14 M 4,2 Q 3,-4 2,-8 Q 6,-12 9,-13 M -1,-8 L 0,-15`,fill:`none`,stroke:s,strokeWidth:`1.8`,strokeLinecap:`round`}),(0,Y.jsx)(`path`,{d:`M -3.5,2 L -1.5,-8 L 1.5,-8 L 3.5,2 Z`,fill:d,stroke:s,strokeWidth:`1`}),(0,Y.jsx)(`line`,{x1:`-0.8`,y1:`0`,x2:`-0.8`,y2:`-6`,stroke:c,strokeWidth:`0.75`}),(0,Y.jsx)(`line`,{x1:`0.8`,y1:`1`,x2:`0.8`,y2:`-5`,stroke:c,strokeWidth:`0.75`}),(0,Y.jsx)(`ellipse`,{cx:`6`,cy:`-14`,rx:t*.45,ry:l*.4,fill:s,opacity:.25}),(0,Y.jsx)(`ellipse`,{cx:`2`,cy:`-8`,rx:t*.55,ry:l*.35,fill:s,opacity:.25}),(0,Y.jsx)(`path`,{d:`M -${t*.85},-10 + C -${t*1.05},-16 -${t*.8},-23 -${t*.45},-24 + C -${t*.25},-30 ${t*.35},-31 ${t*.65},-25 + C ${t*1.05},-24 ${t*1.15},-16 ${t*.9},-10 + C ${t*1.05},-4 ${t*.65},0 0,-1 + C -${t*.55},0 -${t*.95},-4 -${t*.85},-10 Z`,fill:u,stroke:s,strokeWidth:`1.35`,strokeLinejoin:`round`}),(0,Y.jsx)(`path`,{d:`M -${t*.5},-18 Q -${t*.2},-24 ${t*.2},-22 Q ${t*.45},-18 ${t*.3},-14`,fill:`none`,stroke:s,strokeWidth:`1`}),(0,Y.jsx)(`path`,{d:`M 1,-12 Q ${t*.5},-15 ${t*.8},-9 Q ${t*.45},-4 1,-6`,fill:s,opacity:o?.35:.28}),(0,Y.jsx)(`path`,{d:`M -${t*.65},-10 Q -${t*.3},-13 -${t*.1},-8`,fill:`none`,stroke:s,strokeWidth:`1`}),(0,Y.jsx)(`line`,{x1:t*.15,y1:`-17`,x2:t*.55,y2:`-14`,stroke:c,strokeWidth:`0.8`}),(0,Y.jsx)(`line`,{x1:t*.25,y1:`-12`,x2:t*.7,y2:`-9`,stroke:c,strokeWidth:`0.8`}),(0,Y.jsx)(`line`,{x1:t*.1,y1:`-7`,x2:t*.55,y2:`-4`,stroke:c,strokeWidth:`0.8`}),(0,Y.jsx)(`path`,{d:`M -6,1 L -3,2 M 3,2 L 6,1 M -2,3 L -1,1 M 2,3 L 1,1`,stroke:s,strokeWidth:`0.9`,strokeLinecap:`round`})]})}case`willow`:return(0,Y.jsxs)(`g`,{transform:`translate(${n}, ${r}) scale(${i})`,children:[(0,Y.jsx)(`ellipse`,{cx:`1`,cy:`2`,rx:14.4,ry:`3.5`,fill:s,opacity:o?.28:.2}),(0,Y.jsx)(`path`,{d:`M -3,2 Q -1,-4 -2,-9 Q -5,-14 -7,-17 M 3,2 Q 2,-4 3,-9 Q 5,-14 8,-16`,fill:`none`,stroke:s,strokeWidth:`1.6`,strokeLinecap:`round`}),(0,Y.jsx)(`path`,{d:`M -2.5,2 L -1.5,-9 L 2,-9 L 2.5,2 Z`,fill:d,stroke:s,strokeWidth:`0.9`}),(0,Y.jsx)(`path`,{d:`M -${18*.85},-12 + C -${18*.95},-20 -9,-27 0,-26 + C 9,-27 ${18*.95},-20 ${18*.85},-12 + C ${18*.6},-7 0,-8 -${18*.85},-12 Z`,fill:f,stroke:s,strokeWidth:`1.2`,strokeLinejoin:`round`}),(0,Y.jsx)(`path`,{d:`M -13.5,-12 Q -${18*.85},-4 -12.6,0 M -9.9,-14 Q -${18*.65},-3 -8.1,1 M -6.3,-15 Q -8.1,-1 -4.5,2`,fill:`none`,stroke:s,strokeWidth:`1.1`,strokeLinecap:`round`}),(0,Y.jsx)(`path`,{d:`M -${18*.15},-16 Q -${18*.15},-2 0,1 M 1.8,-16 Q ${18*.15},-3 3.6,0`,fill:`none`,stroke:s,strokeWidth:`1.1`,strokeLinecap:`round`}),(0,Y.jsx)(`path`,{d:`M 6.3,-15 Q 9,-2 7.2,2 M ${18*.6},-14 Q 13.5,-2 ${18*.65},1 M ${18*.78},-12 Q 16.2,-3 14.4,0`,fill:`none`,stroke:s,strokeWidth:`1.2`,strokeLinecap:`round`}),(0,Y.jsx)(`path`,{d:`M 1,-23 Q ${18*.6},-20 13.5,-12 Q 7.2,-10 0,-14 Z`,fill:s,opacity:o?.35:.25}),(0,Y.jsx)(`path`,{d:`M -7,2 Q -5,-2 -4,0 M -5,2 Q -3,-3 -2,0 M 4,2 Q 6,-2 7,0 M 6,2 Q 8,-1 9,1`,stroke:s,strokeWidth:`0.8`,fill:`none`})]});default:return(0,Y.jsxs)(`g`,{transform:`translate(${n}, ${r}) scale(${i})`,children:[(0,Y.jsx)(`ellipse`,{cx:`1`,cy:`2`,rx:12*.6,ry:`3`,fill:s,opacity:.25}),(0,Y.jsx)(`path`,{d:`M -1.2,2 L -0.6,-16 L 0.6,-16 L 1.2,2 Z`,fill:d,stroke:s,strokeWidth:`1`}),(0,Y.jsx)(`line`,{x1:`-1`,y1:`-4`,x2:`0`,y2:`-4`,stroke:s,strokeWidth:`0.9`}),(0,Y.jsx)(`line`,{x1:`0`,y1:`-8`,x2:`1`,y2:`-8`,stroke:s,strokeWidth:`0.9`}),(0,Y.jsx)(`line`,{x1:`-0.8`,y1:`-12`,x2:`0.2`,y2:`-12`,stroke:s,strokeWidth:`0.9`}),(0,Y.jsx)(`path`,{d:`M 0,-26 + C ${12*.7},-22 ${12*.8},-10.4 5.4,-5.2 + C 0,-3.9 -5.4,-5.2 -${12*.8},-10.4 + C -${12*.8},-10.4 -${12*.7},-22 0,-26 Z`,fill:p,stroke:s,strokeWidth:`1.2`,strokeLinejoin:`round`}),(0,Y.jsx)(`path`,{d:`M 0,-26 C ${12*.7},-22 ${12*.8},-10.4 5.4,-5.2 C 0,-3.9 0,-10.4 0,-26 Z`,fill:s,opacity:o?.35:.25}),(0,Y.jsx)(`line`,{x1:`1`,y1:`-16`,x2:12*.55,y2:`-13`,stroke:c,strokeWidth:`0.8`}),(0,Y.jsx)(`line`,{x1:`1`,y1:`-10`,x2:6,y2:`-7`,stroke:c,strokeWidth:`0.8`}),(0,Y.jsx)(`line`,{x1:`-3`,y1:`2`,x2:`-1`,y2:`0`,stroke:s,strokeWidth:`0.8`}),(0,Y.jsx)(`line`,{x1:`2`,y1:`2`,x2:`4`,y2:`0`,stroke:s,strokeWidth:`0.8`})]})}})()})},fe=({river:e,theme:t,showLabels:n})=>{let r=t.id!==`parchment`,i=t.pencilColor,a=t.riverColor,o=(0,L.useMemo)(()=>e.id===`river-elden`?{riverPoly:`M 1340,290 + C 1318,375 1272,455 1222,535 + C 1152,635 1032,695 972,815 + C 910,935 942,1055 892,1175 + C 850,1275 770,1355 695,1480 + L 670,1480 + C 745,1355 825,1275 865,1175 + C 915,1055 885,935 945,815 + C 1005,695 1125,635 1195,535 + C 1245,455 1295,375 1335,290 + Z`,leftBank:`M 1335,290 C 1295,375 1245,455 1195,535 C 1125,635 1005,695 945,815 C 885,935 915,1055 865,1175 C 825,1275 745,1355 670,1480`,rightBank:`M 1345,290 C 1320,375 1275,455 1225,535 C 1155,635 1035,695 975,815 C 915,935 945,1055 895,1175 C 855,1275 775,1355 700,1480`,labelPos:{x:1040,y:980,rot:-55},islands:[{cx:960,cy:960,rx:14,ry:7,angle:-45,name:`Elden Ait`},{cx:770,cy:1330,rx:18,ry:8,angle:-50,name:`Otter Shoal`}],waterfall:{x:1215,y:540,width:32,height:24,angle:-38,name:`The Elden Cascades`},rapids:[{x:1140,y:660,angle:-40},{x:920,y:1020,angle:60}],sandbars:[{cx:995,cy:750,rx:12,ry:5,angle:30},{cx:900,cy:1110,rx:14,ry:6,angle:-25}],bridges:e.hasBridges||[{x:945,y:855,angle:-35,type:`stone_arch`,name:`Highbridge`},{x:890,y:1160,angle:25,type:`timber_trestle`,name:`Lower Toll Bridge`}]}:e.id===`river-silver`?{riverPoly:`M 580,410 + C 650,488 730,548 780,658 + C 830,758 910,808 960,818 + L 960,824 + C 908,814 828,764 778,664 + C 728,554 648,494 578,414 + Z`,leftBank:`M 578,412 C 648,492 728,552 778,662 C 828,762 908,812 958,822`,rightBank:`M 582,408 C 652,488 732,548 782,658 C 832,758 912,808 962,818`,labelPos:{x:740,y:710,rot:35},islands:[{cx:710,cy:535,rx:10,ry:5,angle:35,name:`Willow Islet`}],waterfall:{x:620,y:450,width:22,height:18,angle:45,name:`Silver Falls`},rapids:[{x:810,y:710,angle:50}],sandbars:[{cx:755,cy:610,rx:9,ry:4,angle:40}],bridges:e.hasBridges||[{x:740,y:620,angle:45,type:`stone_arch`,name:`Silver Arch`}]}:{riverPoly:`M 2150,320 + C 2100,450 2050,600 2020,760 + C 1990,920 1920,1050 1840,1180 + C 1760,1310 1710,1420 1660,1500 + L 1640,1500 + C 1690,1420 1740,1310 1820,1180 + C 1900,1050 1970,920 2000,760 + C 2030,600 2080,450 2130,320 + Z`,leftBank:`M 2130,320 C 2080,450 2030,600 2000,760 C 1970,920 1900,1050 1820,1180 C 1740,1310 1690,1420 1640,1500`,rightBank:`M 2150,320 C 2100,450 2050,600 2020,760 C 1990,920 1920,1050 1840,1180 C 1760,1310 1710,1420 1660,1500`,labelPos:{x:1920,y:1080,rot:-65},islands:[{cx:1890,cy:1100,rx:12,ry:6,angle:-60,name:`Crag Islet`}],waterfall:{x:2070,y:520,width:28,height:22,angle:-30,name:`The Great Cataract`},rapids:[{x:1980,y:880,angle:-65}],sandbars:[{cx:1950,cy:980,rx:11,ry:5,angle:-55}],bridges:e.hasBridges||[{x:2010,y:810,angle:-20,type:`stone_arch`,name:`Highland Span`}]},[e.id,e.hasBridges]),s=a,c=r?`#3d3425`:`#e6dcbf`,l=r?`#263422`:`#d2d8ba`;return(0,Y.jsxs)(`g`,{id:`realistic-${e.id}`,className:`realistic-river-group select-none`,children:[(0,Y.jsx)(`path`,{d:o.riverPoly,fill:s,opacity:.88}),(0,Y.jsx)(`path`,{d:o.leftBank,fill:`none`,stroke:i,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,Y.jsx)(`path`,{d:o.rightBank,fill:`none`,stroke:i,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,Y.jsx)(`path`,{d:o.leftBank,fill:`none`,stroke:r?`#e0d2bd`:`#ffffff`,strokeWidth:`0.8`,strokeDasharray:`14 18 8 22`,opacity:.65,transform:`translate(-2, -1)`}),(0,Y.jsx)(`path`,{d:o.rightBank,fill:`none`,stroke:r?`#e0d2bd`:`#ffffff`,strokeWidth:`0.8`,strokeDasharray:`16 20 10 24`,opacity:.65,transform:`translate(2, 1)`}),(0,Y.jsx)(`path`,{d:e.d,fill:`none`,stroke:r?`#5a4632`:`#7d6952`,strokeWidth:`1.2`,strokeDasharray:`24 32 14 36`,strokeLinecap:`round`,opacity:.7}),(0,Y.jsx)(`path`,{d:e.d,fill:`none`,stroke:r?`#e8dcbe`:`#ffffff`,strokeWidth:`0.8`,strokeDasharray:`10 40 18 35`,strokeLinecap:`round`,opacity:.6,transform:`translate(1.5, -1)`}),o.sandbars.map((e,t)=>(0,Y.jsxs)(`g`,{transform:`translate(${e.cx}, ${e.cy}) rotate(${e.angle})`,children:[(0,Y.jsx)(`ellipse`,{cx:`0`,cy:`0`,rx:e.rx,ry:e.ry,fill:c,stroke:i,strokeWidth:`1`}),(0,Y.jsx)(`circle`,{cx:`-3`,cy:`-1`,r:`0.6`,fill:i}),(0,Y.jsx)(`circle`,{cx:`2`,cy:`1`,r:`0.7`,fill:i}),(0,Y.jsx)(`circle`,{cx:`0`,cy:`0`,r:`0.5`,fill:i})]},t)),o.rapids.map((e,t)=>(0,Y.jsxs)(`g`,{transform:`translate(${e.x}, ${e.y}) rotate(${e.angle})`,children:[(0,Y.jsx)(`path`,{d:`M -12,-6 Q -6,-8 0,-6 Q 6,-4 12,-6 M -10,0 Q -4,-2 2,0 Q 8,2 10,0 M -8,6 Q -2,4 4,6`,fill:`none`,stroke:r?`#f4eedd`:`#ffffff`,strokeWidth:`1.4`,strokeLinecap:`round`,opacity:.9}),(0,Y.jsx)(`circle`,{cx:`-5`,cy:`-2`,r:`1.8`,fill:r?`#2e251b`:`#6b5742`,stroke:i,strokeWidth:`0.8`}),(0,Y.jsx)(`circle`,{cx:`6`,cy:`3`,r:`1.5`,fill:r?`#2e251b`:`#6b5742`,stroke:i,strokeWidth:`0.8`})]},t)),o.islands.map((e,a)=>(0,Y.jsxs)(`g`,{transform:`translate(${e.cx}, ${e.cy}) rotate(${e.angle})`,children:[(0,Y.jsx)(`ellipse`,{cx:`0`,cy:`0`,rx:e.rx,ry:e.ry,fill:l,stroke:i,strokeWidth:`1.4`}),(0,Y.jsx)(`path`,{d:`M -${e.rx},0 Q -${e.rx+8},-2 -${e.rx+14},0 Q -${e.rx+8},2 -${e.rx},0`,fill:c,stroke:i,strokeWidth:`0.9`}),(0,Y.jsx)(`g`,{transform:`scale(${e.rx>15?.6:.45})`,children:(0,Y.jsx)(de,{tree:{x:0,y:-1,scale:.65,type:`willow`,seed:a*99+42},theme:t})}),n&&e.name&&e.rx>13&&(0,Y.jsx)(`text`,{x:`0`,y:e.ry+10,textAnchor:`middle`,fill:r?`#d4bfa1`:`#57422f`,className:`font-garamond italic text-[10px] font-semibold select-none`,children:e.name})]},a)),o.waterfall&&(0,Y.jsxs)(`g`,{id:`waterfall-${e.id}`,transform:`translate(${o.waterfall.x}, ${o.waterfall.y}) rotate(${o.waterfall.angle})`,children:[(0,Y.jsx)(`rect`,{x:-o.waterfall.width/2,y:`-4`,width:o.waterfall.width,height:`6`,rx:`2`,fill:r?`#2e251b`:`#6b5742`,stroke:i,strokeWidth:`1.4`}),(0,Y.jsxs)(`g`,{stroke:r?`#f4eedd`:`#ffffff`,strokeWidth:`1.2`,opacity:.95,children:[(0,Y.jsx)(`line`,{x1:-o.waterfall.width*.4,y1:`2`,x2:-o.waterfall.width*.4,y2:o.waterfall.height}),(0,Y.jsx)(`line`,{x1:-o.waterfall.width*.2,y1:`2`,x2:-o.waterfall.width*.2,y2:o.waterfall.height+2,strokeWidth:`1.5`}),(0,Y.jsx)(`line`,{x1:`0`,y1:`2`,x2:`0`,y2:o.waterfall.height+3,strokeWidth:`1.6`}),(0,Y.jsx)(`line`,{x1:o.waterfall.width*.2,y1:`2`,x2:o.waterfall.width*.2,y2:o.waterfall.height+2,strokeWidth:`1.5`}),(0,Y.jsx)(`line`,{x1:o.waterfall.width*.4,y1:`2`,x2:o.waterfall.width*.4,y2:o.waterfall.height})]}),(0,Y.jsx)(`ellipse`,{cx:`0`,cy:o.waterfall.height+4,rx:o.waterfall.width*.65,ry:`6`,fill:`none`,stroke:r?`#f4eedd`:`#ffffff`,strokeWidth:`1.2`,strokeDasharray:`4 3 6 2`,opacity:.9}),n&&o.waterfall.name&&(0,Y.jsxs)(`text`,{x:`0`,y:-10,textAnchor:`middle`,fill:r?`#e4caa0`:`#4a3420`,className:`font-cinzel text-[11px] font-bold tracking-wider select-none drop-shadow-sm`,children:[`❖ `,o.waterfall.name,` ❖`]})]}),o.bridges.map((t,a)=>(0,Y.jsxs)(`g`,{id:`bridge-${e.id}-${a}`,transform:`translate(${t.x}, ${t.y}) rotate(${t.angle})`,children:[(0,Y.jsx)(`rect`,{x:`-24`,y:`-10`,width:`8`,height:`20`,rx:`1`,fill:r?`#2e251b`:`#9c876b`,stroke:i,strokeWidth:`1.2`}),(0,Y.jsx)(`rect`,{x:`16`,y:`-10`,width:`8`,height:`20`,rx:`1`,fill:r?`#2e251b`:`#9c876b`,stroke:i,strokeWidth:`1.2`}),(0,Y.jsx)(`rect`,{x:`-20`,y:`-8`,width:`40`,height:`16`,rx:`2`,fill:r?`#3d3126`:`#d8c7a8`,stroke:i,strokeWidth:`1.8`}),(0,Y.jsx)(`line`,{x1:`-20`,y1:`-8`,x2:`20`,y2:`-8`,stroke:i,strokeWidth:`1.4`}),(0,Y.jsx)(`line`,{x1:`-20`,y1:`8`,x2:`20`,y2:`8`,stroke:i,strokeWidth:`1.4`}),(0,Y.jsx)(`line`,{x1:`-12`,y1:`-8`,x2:`-12`,y2:`8`,stroke:i,strokeWidth:`1`}),(0,Y.jsx)(`line`,{x1:`-6`,y1:`-8`,x2:`-6`,y2:`8`,stroke:i,strokeWidth:`1.1`}),(0,Y.jsx)(`line`,{x1:`0`,y1:`-8`,x2:`0`,y2:`8`,stroke:i,strokeWidth:`1.5`}),(0,Y.jsx)(`line`,{x1:`6`,y1:`-8`,x2:`6`,y2:`8`,stroke:i,strokeWidth:`1.1`}),(0,Y.jsx)(`line`,{x1:`12`,y1:`-8`,x2:`12`,y2:`8`,stroke:i,strokeWidth:`1`}),(0,Y.jsx)(`path`,{d:`M 0,-8 L -4,-13 L 4,-13 Z`,fill:r?`#2e251b`:`#9c876b`,stroke:i,strokeWidth:`1`}),(0,Y.jsx)(`path`,{d:`M -6,-14 Q 0,-18 6,-14`,fill:`none`,stroke:r?`#f4eedd`:`#ffffff`,strokeWidth:`0.8`,opacity:.8}),n&&t.name&&(0,Y.jsx)(`text`,{x:`0`,y:`18`,textAnchor:`middle`,fill:r?`#d4bfa1`:`#4a3726`,className:`font-garamond italic text-[10px] font-semibold select-none`,children:t.name})]},a)),n&&(0,Y.jsxs)(`text`,{x:o.labelPos.x,y:o.labelPos.y,fill:r?`#e4caa0`:`#4a3420`,className:`font-cinzel italic text-[15px] font-bold tracking-widest select-none drop-shadow-sm`,opacity:.9,transform:`rotate(${o.labelPos.rot} ${o.labelPos.x} ${o.labelPos.y})`,children:[`~ `,e.name,` ~`]})]})},pe=({forest:e,theme:t,showLabels:n})=>{let r=t.id!==`parchment`,i=t.pencilColor,a=t.pencilShade,{id:o,name:s,cx:c,cy:l,rx:u,ry:d,trees:f}=e,p=(0,L.useMemo)(()=>[...f].sort((e,t)=>e.y-t.y),[f]),m=(0,L.useMemo)(()=>{let e=[],t=[],n=[],r=c*13+l*19;for(let i=0;i<6;i++){let a=(i*1.8+r*.1)%(Math.PI*2),o=c+u*.7*Math.cos(a),s=l+d*.7*Math.sin(a);i%2==0?e.push({x:Math.round(o),y:Math.round(s),rx:5+i%3*2,ry:3+i%2*1.5,angle:i*35%60-30}):t.push({x:Math.round(o),y:Math.round(s),length:12+i%4*3,angle:i*45%90-45}),n.push({x:Math.round(c+Math.cos(a+.5)*(u*.5)),y:Math.round(l+Math.sin(a+.5)*(d*.5))})}return{boulders:e,fallenLogs:t,fernClusters:n}},[c,l,u,d]),h=(0,L.useMemo)(()=>{let e=[];for(let t=0;t<16;t++){let n=t/16*Math.PI*2,r=1+Math.sin(n*4+c*.05)*.08+Math.cos(n*3+l*.05)*.06,i=c+u*r*Math.cos(n),a=l+d*r*Math.sin(n);e.push({x:Math.round(i),y:Math.round(a)})}return e.map((e,t)=>t===0?`M ${e.x},${e.y}`:`L ${e.x},${e.y}`).join(` `)+` Z`},[c,l,u,d]);return(0,Y.jsxs)(`g`,{id:`forest-zone-${o}`,className:`realistic-forest-group select-none`,children:[(0,Y.jsx)(`path`,{d:h,fill:r?`rgba(32, 42, 26, 0.35)`:`rgba(195, 208, 175, 0.22)`,stroke:a,strokeWidth:`0.85`,strokeDasharray:`5 7 2 7`,opacity:.8}),(0,Y.jsx)(`g`,{id:`boulders-${o}`,stroke:i,strokeWidth:`1`,children:m.boulders.map((e,t)=>(0,Y.jsxs)(`g`,{transform:`translate(${e.x}, ${e.y}) rotate(${e.angle})`,children:[(0,Y.jsx)(`ellipse`,{cx:`0`,cy:`0`,rx:e.rx,ry:e.ry,fill:r?`#2b241c`:`#c4b69c`}),(0,Y.jsx)(`path`,{d:`M 0,-${e.ry} Q ${e.rx*.6},0 0,${e.ry} Q ${e.rx*.2},0 0,-${e.ry}`,fill:i,opacity:.3})]},t))}),(0,Y.jsx)(`g`,{id:`logs-${o}`,stroke:i,strokeWidth:`1.2`,children:m.fallenLogs.map((e,t)=>(0,Y.jsxs)(`g`,{transform:`translate(${e.x}, ${e.y}) rotate(${e.angle})`,children:[(0,Y.jsx)(`line`,{x1:-e.length/2,y1:`0`,x2:e.length/2,y2:`0`,strokeLinecap:`round`,strokeWidth:`2.2`}),(0,Y.jsx)(`circle`,{cx:-e.length/2,cy:`0`,r:`1.2`,fill:i}),(0,Y.jsx)(`circle`,{cx:`2`,cy:`-1.5`,r:`0.8`,fill:r?`#d4bfa1`:`#f0e6d2`})]},t))}),(0,Y.jsx)(`g`,{id:`ferns-${o}`,stroke:a,strokeWidth:`0.8`,fill:`none`,children:m.fernClusters.map((e,t)=>(0,Y.jsx)(`g`,{transform:`translate(${e.x}, ${e.y})`,children:(0,Y.jsx)(`path`,{d:`M 0,0 Q -4,-5 -7,-4 M 0,0 Q -2,-7 -2,-10 M 0,0 Q 3,-6 6,-4`})},t))}),(0,Y.jsx)(`g`,{id:`trees-${o}`,children:p.map((e,n)=>(0,Y.jsx)(de,{tree:e,theme:t},n))}),n&&s&&(0,Y.jsxs)(`g`,{transform:`translate(${c}, ${l-d-12})`,children:[(0,Y.jsx)(`rect`,{x:`-90`,y:`-14`,width:`180`,height:`18`,rx:`3`,fill:r?`#1a1510`:`#f2e8d3`,stroke:a,strokeWidth:`0.75`,opacity:.85}),(0,Y.jsxs)(`text`,{x:`0`,y:`0`,textAnchor:`middle`,fill:r?`#d8c2a3`:`#453525`,className:`font-garamond italic font-bold text-[13px] tracking-widest select-none drop-shadow-sm`,children:[`❖ `,s,` ❖`]})]})]})},me=({theme:e,showLabels:t,finalNode:n})=>{let r=e.id!==`parchment`,i=e.pencilColor,a=e.pencilShade,o=e.riverColor,s=(0,L.useMemo)(()=>[...H].sort((e,t)=>{let n=e.layer??1,r=t.layer??1;return n===r?e.y-t.y:n-r}),[]);return(0,Y.jsxs)(`g`,{id:`terrain-layer`,className:`select-none pointer-events-none`,children:[(0,Y.jsxs)(`g`,{id:`rhumb-lines`,opacity:r?.08:.12,stroke:i,strokeWidth:`0.8`,strokeDasharray:`6 8`,children:[(0,Y.jsx)(`line`,{x1:`0`,y1:`0`,x2:`2600`,y2:`1500`}),(0,Y.jsx)(`line`,{x1:`0`,y1:`1500`,x2:`2600`,y2:`0`}),(0,Y.jsx)(`line`,{x1:`1300`,y1:`0`,x2:`1300`,y2:`1500`}),(0,Y.jsx)(`line`,{x1:`0`,y1:`750`,x2:`2600`,y2:`750`}),(0,Y.jsx)(`circle`,{cx:`500`,cy:`400`,r:`300`,fill:`none`,strokeWidth:`0.5`}),(0,Y.jsx)(`circle`,{cx:`2100`,cy:`1100`,r:`350`,fill:`none`,strokeWidth:`0.5`}),(0,Y.jsx)(`circle`,{cx:`1300`,cy:`750`,r:`450`,fill:`none`,strokeWidth:`0.6`,strokeDasharray:`3 6`})]}),(0,Y.jsxs)(`g`,{id:`coastlines`,stroke:i,children:[(0,Y.jsx)(`path`,{d:`M 0,1180 Q 140,1220 200,1320 T 320,1500`,fill:`none`,strokeWidth:`2.5`,strokeLinecap:`round`}),(0,Y.jsx)(`path`,{d:`M 0,1200 Q 150,1240 215,1340 T 340,1500`,fill:`none`,strokeWidth:`1.2`,strokeDasharray:`12 8 4 8`,opacity:.65}),(0,Y.jsx)(`path`,{d:`M 0,1225 Q 160,1265 230,1365 T 365,1500`,fill:`none`,strokeWidth:`0.8`,strokeDasharray:`6 10`,opacity:.4}),(0,Y.jsxs)(`g`,{id:`islands`,strokeWidth:`1.5`,children:[(0,Y.jsx)(`path`,{d:`M 80,1390 Q 110,1370 140,1395 Q 120,1420 80,1390 Z`,fill:r?`#231d17`:`#e6d8be`}),(0,Y.jsx)(`path`,{d:`M 160,1440 Q 185,1425 210,1445 Q 190,1465 160,1440 Z`,fill:r?`#231d17`:`#e6d8be`}),(0,Y.jsx)(`line`,{x1:`105`,y1:`1385`,x2:`110`,y2:`1375`,strokeWidth:`1`}),(0,Y.jsx)(`line`,{x1:`115`,y1:`1388`,x2:`122`,y2:`1378`,strokeWidth:`1`})]})]}),(0,Y.jsx)(`g`,{id:`rivers-layer`,children:U.map(n=>(0,Y.jsx)(fe,{river:n,theme:e,showLabels:t},n.id))}),(0,Y.jsx)(`g`,{id:`forests-layer`,children:W.map(n=>(0,Y.jsx)(pe,{forest:n,theme:e,showLabels:t},n.id))}),(0,Y.jsxs)(`g`,{id:`mountains-layer`,children:[(0,Y.jsxs)(`g`,{id:`distant-mountain-ridgelines`,opacity:r?.35:.45,stroke:a,fill:`none`,children:[(0,Y.jsx)(`path`,{d:`M 330,330 Q 380,290 440,310 T 540,280 T 650,300 T 760,330`,strokeWidth:`1.2`,strokeDasharray:`4 4`}),(0,Y.jsx)(`path`,{d:`M 1080,270 Q 1190,210 1310,195 T 1450,220 T 1580,245 T 1720,290`,strokeWidth:`1.4`,strokeDasharray:`5 4`}),(0,Y.jsx)(`path`,{d:`M 1940,320 Q 2060,240 2200,180 T 2350,150 T 2480,230`,strokeWidth:`1.4`,strokeDasharray:`5 4`})]}),(0,Y.jsxs)(`g`,{id:`alpine-tarns`,children:[(0,Y.jsxs)(`g`,{id:`tarn-dragons-eye`,children:[(0,Y.jsx)(`ellipse`,{cx:`1350`,cy:`365`,rx:`22`,ry:`12`,fill:o,stroke:i,strokeWidth:`1.4`,opacity:.9}),(0,Y.jsx)(`path`,{d:`M 1335,363 Q 1350,361 1365,363 M 1340,367 Q 1350,369 1360,367`,stroke:r?`#e0d2bd`:`#ffffff`,strokeWidth:`0.8`,fill:`none`,opacity:.7}),(0,Y.jsx)(`path`,{d:`M 1350,377 Q 1345,395 1335,410 T 1320,430`,fill:`none`,stroke:o,strokeWidth:`2`,strokeDasharray:`3 2`,opacity:.8}),t&&(0,Y.jsx)(`text`,{x:`1350`,y:`350`,textAnchor:`middle`,fill:r?`#c5b597`:`#57422f`,className:`font-garamond italic text-[11px] font-semibold select-none`,children:`Dragon's Eye Tarn`})]}),(0,Y.jsxs)(`g`,{id:`tarn-sunstone`,children:[(0,Y.jsx)(`ellipse`,{cx:`2210`,cy:`275`,rx:`18`,ry:`10`,fill:o,stroke:i,strokeWidth:`1.3`,opacity:.9}),(0,Y.jsx)(`path`,{d:`M 2198,274 Q 2210,272 2222,274`,stroke:r?`#e0d2bd`:`#ffffff`,strokeWidth:`0.75`,fill:`none`,opacity:.7})]}),(0,Y.jsx)(`g`,{id:`tarn-mistwood`,children:(0,Y.jsx)(`ellipse`,{cx:`585`,cy:`395`,rx:`16`,ry:`9`,fill:o,stroke:i,strokeWidth:`1.2`,opacity:.9})})]}),s.map(t=>(0,Y.jsx)(ue,{mountain:t,theme:e},t.id)),t&&(0,Y.jsxs)(`g`,{id:`mountain-range-banners`,className:`select-none pointer-events-none`,children:[(0,Y.jsx)(`text`,{x:`1380`,y:`180`,textAnchor:`middle`,fill:r?`#e4caa0`:`#4a3420`,className:`font-cinzel-dec font-bold text-[18px] tracking-widest drop-shadow-sm`,opacity:.9,children:`❖ THE DRAGON TOOTH MOUNTAINS ❖`}),(0,Y.jsx)(`text`,{x:`530`,y:`255`,textAnchor:`middle`,fill:r?`#d0b996`:`#523c28`,className:`font-cinzel font-bold text-[14px] tracking-widest`,opacity:.85,children:`~ THE WESTERN CRAGS ~`}),(0,Y.jsx)(`text`,{x:`2260`,y:`135`,textAnchor:`middle`,fill:r?`#e4caa0`:`#4a3420`,className:`font-cinzel-dec font-bold text-[16px] tracking-widest drop-shadow-sm`,opacity:.9,children:`❖ SUNSTONE CITADEL PEAKS ❖`})]})]}),(0,Y.jsxs)(`g`,{id:`sea-monsters`,opacity:r?.7:.85,children:[(0,Y.jsxs)(`g`,{transform:`translate(140, 1260) scale(0.85)`,stroke:i,fill:`none`,children:[(0,Y.jsx)(`path`,{d:`M 10,20 Q 30,-15 50,20 Q 70,-20 90,20 Q 110,-10 125,20`,strokeWidth:`2.2`,strokeLinecap:`round`}),(0,Y.jsx)(`path`,{d:`M 10,20 Q -5,10 0,-5 Q 10,-15 18,-5 Q 12,5 10,20 Z`,strokeWidth:`2`,fill:r?`#231e18`:`#e0d3b6`}),(0,Y.jsx)(`circle`,{cx:`6`,cy:`-6`,r:`1.5`,fill:i}),(0,Y.jsx)(`path`,{d:`M -2,-4 L -10,-7 L -7,-3`,strokeWidth:`1.2`,strokeLinecap:`round`}),(0,Y.jsx)(`line`,{x1:`30`,y1:`-8`,x2:`33`,y2:`-18`,strokeWidth:`1.5`}),(0,Y.jsx)(`line`,{x1:`70`,y1:`-12`,x2:`73`,y2:`-22`,strokeWidth:`1.5`}),(0,Y.jsx)(`line`,{x1:`108`,y1:`-4`,x2:`111`,y2:`-14`,strokeWidth:`1.5`}),(0,Y.jsx)(`path`,{d:`M -15,22 Q 30,28 70,22 Q 110,28 145,22`,strokeWidth:`1.2`,strokeDasharray:`4 6`}),t&&(0,Y.jsx)(`text`,{x:`70`,y:`44`,textAnchor:`middle`,fill:r?`#a89476`:`#6b543b`,className:`font-garamond italic text-[12px]`,children:`"Hic Sunt Dracones"`})]}),(0,Y.jsxs)(`g`,{transform:`translate(360, 1420) scale(0.65)`,stroke:i,fill:`none`,children:[(0,Y.jsx)(`path`,{d:`M -30,10 Q 0,16 35,10 Q 40,0 30,-5 L -35,-5 Q -40,0 -30,10 Z`,strokeWidth:`1.8`,fill:r?`#2a221b`:`#ded1b4`}),(0,Y.jsx)(`line`,{x1:`-15`,y1:`-5`,x2:`-15`,y2:`-45`,strokeWidth:`1.8`}),(0,Y.jsx)(`line`,{x1:`10`,y1:`-5`,x2:`10`,y2:`-52`,strokeWidth:`1.8`}),(0,Y.jsx)(`line`,{x1:`28`,y1:`-5`,x2:`28`,y2:`-36`,strokeWidth:`1.4`}),(0,Y.jsx)(`path`,{d:`M -28,-38 Q -15,-44 -2,-38 Q -15,-26 -28,-38 Z`,strokeWidth:`1.3`,fill:r?`#3d3429`:`#f0e6ce`}),(0,Y.jsx)(`path`,{d:`M -4,-44 Q 10,-50 24,-44 Q 10,-32 -4,-44 Z`,strokeWidth:`1.3`,fill:r?`#3d3429`:`#f0e6ce`}),(0,Y.jsx)(`path`,{d:`M -4,-28 Q 10,-34 24,-28 Q 10,-18 -4,-28 Z`,strokeWidth:`1.3`,fill:r?`#3d3429`:`#f0e6ce`}),(0,Y.jsx)(`line`,{x1:`-15`,y1:`-45`,x2:`-35`,y2:`-5`,strokeWidth:`0.8`,strokeDasharray:`3 3`}),(0,Y.jsx)(`line`,{x1:`10`,y1:`-52`,x2:`-20`,y2:`-5`,strokeWidth:`0.8`,strokeDasharray:`3 3`}),(0,Y.jsx)(`line`,{x1:`10`,y1:`-52`,x2:`35`,y2:`-5`,strokeWidth:`0.8`,strokeDasharray:`3 3`}),(0,Y.jsx)(`line`,{x1:`-48`,y1:`12`,x2:`-20`,y2:`12`,strokeWidth:`1`,strokeDasharray:`3 5`})]})]}),(0,Y.jsxs)(`g`,{transform:`translate(2360, 1180)`,id:`compass-rose`,children:[(0,Y.jsx)(`circle`,{cx:`0`,cy:`0`,r:`75`,fill:r?`rgba(30,25,20,0.85)`:`rgba(245,236,215,0.85)`,stroke:i,strokeWidth:`2`}),(0,Y.jsx)(`circle`,{cx:`0`,cy:`0`,r:`66`,fill:`none`,stroke:i,strokeWidth:`1`,strokeDasharray:`2 4`}),(0,Y.jsx)(`circle`,{cx:`0`,cy:`0`,r:`48`,fill:`none`,stroke:i,strokeWidth:`1.2`}),(0,Y.jsx)(`polygon`,{points:`0,-72 6,-20 0,0`,fill:i}),(0,Y.jsx)(`polygon`,{points:`0,-72 -6,-20 0,0`,fill:r?`#4a3f33`:`#cebe9f`,stroke:i,strokeWidth:`1`}),(0,Y.jsx)(`polygon`,{points:`0,72 -6,20 0,0`,fill:i}),(0,Y.jsx)(`polygon`,{points:`0,72 6,20 0,0`,fill:r?`#4a3f33`:`#cebe9f`,stroke:i,strokeWidth:`1`}),(0,Y.jsx)(`polygon`,{points:`72,0 20,6 0,0`,fill:i}),(0,Y.jsx)(`polygon`,{points:`72,0 20,-6 0,0`,fill:r?`#4a3f33`:`#cebe9f`,stroke:i,strokeWidth:`1`}),(0,Y.jsx)(`polygon`,{points:`-72,0 -20,-6 0,0`,fill:i}),(0,Y.jsx)(`polygon`,{points:`-72,0 -20,6 0,0`,fill:r?`#4a3f33`:`#cebe9f`,stroke:i,strokeWidth:`1`}),(0,Y.jsx)(`polygon`,{points:`45,-45 14,-5 0,0`,fill:i}),(0,Y.jsx)(`polygon`,{points:`45,-45 5,-14 0,0`,fill:r?`#4a3f33`:`#cebe9f`,stroke:i,strokeWidth:`0.8`}),(0,Y.jsx)(`polygon`,{points:`-45,-45 -5,-14 0,0`,fill:i}),(0,Y.jsx)(`polygon`,{points:`-45,-45 -14,-5 0,0`,fill:r?`#4a3f33`:`#cebe9f`,stroke:i,strokeWidth:`0.8`}),(0,Y.jsx)(`polygon`,{points:`45,45 5,14 0,0`,fill:i}),(0,Y.jsx)(`polygon`,{points:`45,45 14,5 0,0`,fill:r?`#4a3f33`:`#cebe9f`,stroke:i,strokeWidth:`0.8`}),(0,Y.jsx)(`polygon`,{points:`-45,45 -14,5 0,0`,fill:i}),(0,Y.jsx)(`polygon`,{points:`-45,45 -5,14 0,0`,fill:r?`#4a3f33`:`#cebe9f`,stroke:i,strokeWidth:`0.8`}),(0,Y.jsx)(`circle`,{cx:`0`,cy:`0`,r:`7`,fill:r?`#d4af37`:`#99732d`,stroke:i,strokeWidth:`1.5`}),(0,Y.jsx)(`text`,{x:`0`,y:`-80`,textAnchor:`middle`,fill:r?`#f4d27a`:`#852e18`,className:`font-cinzel-dec font-bold text-[18px]`,children:`N`}),(0,Y.jsx)(`text`,{x:`0`,y:`94`,textAnchor:`middle`,fill:r?`#d4caa9`:`#3d2e1e`,className:`font-cinzel font-bold text-[14px]`,children:`S`}),(0,Y.jsx)(`text`,{x:`88`,y:`5`,textAnchor:`middle`,fill:r?`#d4caa9`:`#3d2e1e`,className:`font-cinzel font-bold text-[14px]`,children:`E`}),(0,Y.jsx)(`text`,{x:`-88`,y:`5`,textAnchor:`middle`,fill:r?`#d4caa9`:`#3d2e1e`,className:`font-cinzel font-bold text-[14px]`,children:`W`})]}),(0,Y.jsxs)(`g`,{transform:`translate(820, 120)`,id:`map-cartouche`,children:[(0,Y.jsx)(`rect`,{x:`-220`,y:`-45`,width:`440`,height:`85`,rx:`6`,fill:r?`#231e17`:`#f5ebd3`,stroke:i,strokeWidth:`2.5`}),(0,Y.jsx)(`rect`,{x:`-214`,y:`-39`,width:`428`,height:`73`,rx:`4`,fill:`none`,stroke:i,strokeWidth:`1`,strokeDasharray:`4 2`}),(0,Y.jsx)(`path`,{d:`M -210,-30 Q -195,-30 -195,-15 M 210,-30 Q 195,-30 195,-15`,stroke:i,strokeWidth:`1.2`,fill:`none`}),(0,Y.jsx)(`path`,{d:`M -210,25 Q -195,25 -195,10 M 210,25 Q 195,25 195,10`,stroke:i,strokeWidth:`1.2`,fill:`none`}),(0,Y.jsx)(`text`,{x:`0`,y:`-12`,textAnchor:`middle`,fill:r?`#f4d27a`:`#5a2211`,className:`font-cinzel-dec font-bold text-[22px] tracking-widest`,children:`THE EXPEDITION TRAIL`}),(0,Y.jsx)(`text`,{x:`0`,y:`15`,textAnchor:`middle`,fill:r?`#d2c2a5`:`#5c4530`,className:`font-garamond italic font-semibold text-[14px] tracking-wide`,children:`Path to the tower.`})]}),n&&(0,Y.jsxs)(`g`,{id:`huge-stone-tower`,transform:`translate(${n.x}, ${n.y})`,children:[(0,Y.jsx)(`path`,{d:`M -65,10 Q 0,25 65,10 L 55,-10 Q 0,5 -55,-10 Z`,fill:r?`#1e1a14`:`#d2c4a7`,stroke:i,strokeWidth:`2.5`,strokeLinejoin:`round`}),(0,Y.jsx)(`path`,{d:`M -50,-10 L -32,-190 L 32,-190 L 50,-10 Z`,fill:r?`#231e17`:`#e6d7bc`,stroke:i,strokeWidth:`2.5`,strokeLinejoin:`round`}),(0,Y.jsx)(`path`,{d:`M -47,-30 Q 0,-20 47,-30 M -43,-70 Q 0,-60 43,-70 M -39,-110 Q 0,-100 39,-110 M -35,-150 Q 0,-140 35,-150`,fill:`none`,stroke:a,strokeWidth:`1.5`,strokeDasharray:`12 6`,opacity:`0.8`}),(0,Y.jsxs)(`g`,{stroke:a,strokeWidth:`1.2`,opacity:`0.75`,strokeLinecap:`round`,children:[(0,Y.jsx)(`line`,{x1:`-48`,y1:`-20`,x2:`-25`,y2:`-30`}),(0,Y.jsx)(`line`,{x1:`-47`,y1:`-40`,x2:`-24`,y2:`-50`}),(0,Y.jsx)(`line`,{x1:`-45`,y1:`-60`,x2:`-22`,y2:`-70`}),(0,Y.jsx)(`line`,{x1:`-44`,y1:`-80`,x2:`-21`,y2:`-90`}),(0,Y.jsx)(`line`,{x1:`-42`,y1:`-100`,x2:`-19`,y2:`-110`}),(0,Y.jsx)(`line`,{x1:`-41`,y1:`-120`,x2:`-18`,y2:`-130`}),(0,Y.jsx)(`line`,{x1:`-39`,y1:`-140`,x2:`-16`,y2:`-150`}),(0,Y.jsx)(`line`,{x1:`-38`,y1:`-160`,x2:`-15`,y2:`-170`}),(0,Y.jsx)(`line`,{x1:`-36`,y1:`-180`,x2:`-13`,y2:`-190`})]}),(0,Y.jsx)(`path`,{d:`M -18,0 L -18,-35 C -18,-55 18,-55 18,-35 L 18,0 Z`,fill:r?`#0f0c09`:`#33271c`,stroke:i,strokeWidth:`2.5`}),(0,Y.jsx)(`rect`,{x:`-6`,y:`-80`,width:`12`,height:`25`,rx:`5`,fill:r?`#0f0c09`:`#33271c`,stroke:i,strokeWidth:`1.5`}),(0,Y.jsx)(`rect`,{x:`-22`,y:`-130`,width:`8`,height:`20`,rx:`3`,fill:r?`#0f0c09`:`#33271c`,stroke:i,strokeWidth:`1.5`}),(0,Y.jsx)(`rect`,{x:`14`,y:`-130`,width:`8`,height:`20`,rx:`3`,fill:r?`#0f0c09`:`#33271c`,stroke:i,strokeWidth:`1.5`}),(0,Y.jsx)(`rect`,{x:`-6`,y:`-170`,width:`12`,height:`25`,rx:`5`,fill:r?`#0f0c09`:`#33271c`,stroke:i,strokeWidth:`1.5`}),(0,Y.jsx)(`path`,{d:`M -36,-190 L -36,-210 L -21,-210 L -21,-190 L -6,-190 L -6,-210 L 9,-210 L 9,-190 L 24,-190 L 24,-210 L 39,-210 L 39,-190 Z`,fill:r?`#1e1a14`:`#d2c4a7`,stroke:i,strokeWidth:`2.5`,strokeLinejoin:`round`}),(0,Y.jsx)(`path`,{d:`M -45,-40 L -30,-30 L -25,-45 L -10,-40 M 35,-150 L 25,-140 L 30,-120`,fill:`none`,stroke:i,strokeWidth:`1.5`}),(0,Y.jsx)(`path`,{d:`M 50,-10 Q 40,-30 45,-50 T 35,-80 T 42,-110 T 30,-130`,fill:`none`,stroke:r?`#3a4a2c`:`#5a6b42`,strokeWidth:`2.5`,strokeLinecap:`round`}),(0,Y.jsx)(`path`,{d:`M -50,-15 Q -40,-25 -45,-45 T -35,-75`,fill:`none`,stroke:r?`#3a4a2c`:`#5a6b42`,strokeWidth:`2`,strokeLinecap:`round`}),t&&(0,Y.jsx)(`text`,{x:`0`,y:`-235`,textAnchor:`middle`,fill:r?`#e0caa9`:`#3d2e1e`,className:`font-cinzel text-[16px] font-bold tracking-widest select-none drop-shadow-sm`,children:`THE ANCIENT CITADEL`})]})]})},he=({theme:e,showGrid:t})=>{let n=e.id!==`parchment`,r=e.pencilColor,i=n?`#2e261f`:`#3d2f21`;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`defs`,{children:[(0,Y.jsxs)(`filter`,{id:`goldenGlow`,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:[(0,Y.jsx)(`feGaussianBlur`,{in:`SourceGraphic`,stdDeviation:`4`,result:`blur1`}),(0,Y.jsx)(`feGaussianBlur`,{in:`SourceGraphic`,stdDeviation:`10`,result:`blur2`}),(0,Y.jsx)(`feGaussianBlur`,{in:`SourceGraphic`,stdDeviation:`22`,result:`blur3`}),(0,Y.jsx)(`feColorMatrix`,{in:`blur3`,type:`matrix`,values:`\r + 1 0 0 0 1\r + 0 0.8 0 0 0.7\r + 0 0 0.2 0 0\r + 0 0 0 1.8 0`,result:`coloredBlur`}),(0,Y.jsxs)(`feMerge`,{children:[(0,Y.jsx)(`feMergeNode`,{in:`coloredBlur`}),(0,Y.jsx)(`feMergeNode`,{in:`blur2`}),(0,Y.jsx)(`feMergeNode`,{in:`blur1`}),(0,Y.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]}),(0,Y.jsxs)(`filter`,{id:`nodeGlow`,x:`-100%`,y:`-100%`,width:`300%`,height:`300%`,children:[(0,Y.jsx)(`feGaussianBlur`,{in:`SourceGraphic`,stdDeviation:`6`,result:`blur`}),(0,Y.jsxs)(`feMerge`,{children:[(0,Y.jsx)(`feMergeNode`,{in:`blur`}),(0,Y.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]}),(0,Y.jsxs)(`linearGradient`,{id:`goldPathGradient`,x1:`0%`,y1:`0%`,x2:`100%`,y2:`100%`,children:[(0,Y.jsx)(`stop`,{offset:`0%`,stopColor:`#f59e0b`,stopOpacity:`0.95`}),(0,Y.jsx)(`stop`,{offset:`50%`,stopColor:`#fbbf24`,stopOpacity:`1`}),(0,Y.jsx)(`stop`,{offset:`100%`,stopColor:`#fef08a`,stopOpacity:`1`})]}),(0,Y.jsxs)(`radialGradient`,{id:`beaconGlow`,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,Y.jsx)(`stop`,{offset:`0%`,stopColor:`#fffbeb`,stopOpacity:`1`}),(0,Y.jsx)(`stop`,{offset:`40%`,stopColor:`#f59e0b`,stopOpacity:`0.8`}),(0,Y.jsx)(`stop`,{offset:`75%`,stopColor:`#d97706`,stopOpacity:`0.3`}),(0,Y.jsx)(`stop`,{offset:`100%`,stopColor:`#b45309`,stopOpacity:`0`})]})]}),t&&(0,Y.jsxs)(`g`,{id:`grid-lines`,stroke:r,strokeWidth:`0.6`,strokeDasharray:`3 7`,opacity:n?.15:.22,children:[Array.from({length:13}).map((e,t)=>{let n=(t+1)*200;return(0,Y.jsx)(`line`,{x1:n,y1:`0`,x2:n,y2:1500},`gx-${t}`)}),Array.from({length:7}).map((e,t)=>{let n=(t+1)*200;return(0,Y.jsx)(`line`,{x1:`0`,y1:n,x2:2600,y2:n},`gy-${t}`)})]}),(0,Y.jsxs)(`g`,{id:`map-border`,pointerEvents:`none`,children:[(0,Y.jsx)(`rect`,{x:`12`,y:`12`,width:R-24,height:z-24,fill:`none`,stroke:r,strokeWidth:`6`}),(0,Y.jsx)(`rect`,{x:`20`,y:`20`,width:R-40,height:`14`,fill:n?`#231e17`:`#eee2ca`,stroke:r,strokeWidth:`1.5`}),(0,Y.jsx)(`rect`,{x:`20`,y:z-34,width:R-40,height:`14`,fill:n?`#231e17`:`#eee2ca`,stroke:r,strokeWidth:`1.5`}),(0,Y.jsx)(`rect`,{x:`20`,y:`20`,width:`14`,height:z-40,fill:n?`#231e17`:`#eee2ca`,stroke:r,strokeWidth:`1.5`}),(0,Y.jsx)(`rect`,{x:R-34,y:`20`,width:`14`,height:z-40,fill:n?`#231e17`:`#eee2ca`,stroke:r,strokeWidth:`1.5`}),Array.from({length:32}).map((e,t)=>{if(t%2==0)return null;let n=(R-40)/32;return(0,Y.jsxs)(L.Fragment,{children:[(0,Y.jsx)(`rect`,{x:20+t*n,y:`20`,width:n,height:`14`,fill:i}),(0,Y.jsx)(`rect`,{x:20+t*n,y:z-34,width:n,height:`14`,fill:i})]},`ruler-h-${t}`)}),(0,Y.jsx)(`rect`,{x:`38`,y:`38`,width:R-76,height:z-76,fill:`none`,stroke:r,strokeWidth:`2`}),(0,Y.jsxs)(`g`,{transform:`translate(38, 38)`,stroke:r,strokeWidth:`1.6`,fill:`none`,children:[(0,Y.jsx)(`path`,{d:`M 0,0 L 45,0 C 25,25 25,25 0,45 Z`,fill:n?`#2f271f`:`#e6d7bc`}),(0,Y.jsx)(`circle`,{cx:`20`,cy:`20`,r:`4`,fill:r}),(0,Y.jsx)(`line`,{x1:`0`,y1:`0`,x2:`40`,y2:`40`})]}),(0,Y.jsxs)(`g`,{transform:`translate(${R-38}, 38)`,stroke:r,strokeWidth:`1.6`,fill:`none`,children:[(0,Y.jsx)(`path`,{d:`M 0,0 L -45,0 C -25,25 -25,25 0,45 Z`,fill:n?`#2f271f`:`#e6d7bc`}),(0,Y.jsx)(`circle`,{cx:`-20`,cy:`20`,r:`4`,fill:r}),(0,Y.jsx)(`line`,{x1:`0`,y1:`0`,x2:`-40`,y2:`40`})]}),(0,Y.jsxs)(`g`,{transform:`translate(38, ${z-38})`,stroke:r,strokeWidth:`1.6`,fill:`none`,children:[(0,Y.jsx)(`path`,{d:`M 0,0 L 45,0 C 25,-25 25,-25 0,-45 Z`,fill:n?`#2f271f`:`#e6d7bc`}),(0,Y.jsx)(`circle`,{cx:`20`,cy:`-20`,r:`4`,fill:r}),(0,Y.jsx)(`line`,{x1:`0`,y1:`0`,x2:`40`,y2:`-40`})]}),(0,Y.jsxs)(`g`,{transform:`translate(${R-38}, ${z-38})`,stroke:r,strokeWidth:`1.6`,fill:`none`,children:[(0,Y.jsx)(`path`,{d:`M 0,0 L -45,0 C -25,-25 -25,-25 0,-45 Z`,fill:n?`#2f271f`:`#e6d7bc`}),(0,Y.jsx)(`circle`,{cx:`-20`,cy:`-20`,r:`4`,fill:r}),(0,Y.jsx)(`line`,{x1:`0`,y1:`0`,x2:`-40`,y2:`-40`})]}),(0,Y.jsxs)(`g`,{transform:`translate(480, 1445)`,stroke:r,children:[(0,Y.jsx)(`rect`,{x:`0`,y:`0`,width:`180`,height:`8`,fill:`none`,strokeWidth:`1.2`}),(0,Y.jsx)(`rect`,{x:`0`,y:`0`,width:`45`,height:`8`,fill:r}),(0,Y.jsx)(`rect`,{x:`90`,y:`0`,width:`45`,height:`8`,fill:r}),(0,Y.jsx)(`text`,{x:`0`,y:`-5`,textAnchor:`middle`,fill:n?`#d4c2a5`:`#4d3926`,className:`font-garamond text-[12px] font-bold`,children:`0`}),(0,Y.jsx)(`text`,{x:`45`,y:`-5`,textAnchor:`middle`,fill:n?`#d4c2a5`:`#4d3926`,className:`font-garamond text-[12px] font-bold`,children:`25`}),(0,Y.jsx)(`text`,{x:`90`,y:`-5`,textAnchor:`middle`,fill:n?`#d4c2a5`:`#4d3926`,className:`font-garamond text-[12px] font-bold`,children:`50`}),(0,Y.jsx)(`text`,{x:`180`,y:`-5`,textAnchor:`middle`,fill:n?`#d4c2a5`:`#4d3926`,className:`font-garamond text-[12px] font-bold`,children:`100 Leagues`})]})]})]})},ge=({nodes:e,activeNodeIndex:t,completions:n,theme:r,showNodeNumbers:i,onNodeClick:a,hoveredNodeIndex:o,setHoveredNodeIndex:s})=>{let c=e.reduce((e,t,r)=>n.has(t.id)?Math.max(e,r):e,-1),l=Math.max(t,c),u=K(e),d=q(e,l),f=t>=0&&t0&&d&&(0,Y.jsxs)(`g`,{id:`lit-path`,children:[(0,Y.jsx)(`path`,{d,fill:`none`,stroke:`#f59e0b`,strokeWidth:`14`,strokeLinecap:`round`,strokeLinejoin:`round`,opacity:.35,filter:`url(#goldenGlow)`}),(0,Y.jsx)(`path`,{d,fill:`none`,stroke:`url(#goldPathGradient)`,strokeWidth:`6`,strokeLinecap:`round`,strokeLinejoin:`round`,filter:`url(#goldenGlow)`}),(0,Y.jsx)(`path`,{d,fill:`none`,stroke:`#fffbeb`,strokeWidth:`2.4`,strokeLinecap:`round`,strokeLinejoin:`round`,opacity:.95})]}),(0,Y.jsx)(`g`,{id:`nodes-collection`,children:e.map((c,u)=>{let d=n.has(c.id),f=u<=l||d,p=u===t,m=o===u,h=(u+1)%25==0||u===0||u===e.length-1;return(0,Y.jsxs)(`g`,{id:`node-${c.id}`,transform:`translate(${c.x}, ${c.y})`,className:`cursor-pointer transition-transform duration-200`,onClick:e=>{e.stopPropagation(),a(u)},onMouseEnter:()=>s(u),onMouseLeave:()=>s(null),children:[(0,Y.jsx)(`circle`,{cx:`0`,cy:`0`,r:`18`,fill:`transparent`}),!f&&!d&&(0,Y.jsxs)(`g`,{children:[(0,Y.jsx)(`circle`,{cx:`1`,cy:`1.5`,r:h?6.5:4.5,fill:r.pencilShade,opacity:.4}),(0,Y.jsx)(`circle`,{cx:`0`,cy:`0`,r:h?6:4,fill:r.id===`parchment`?`#f0e5ce`:`#28221b`,stroke:r.pencilColor,strokeWidth:h?2:1.4}),h&&(0,Y.jsx)(`circle`,{cx:`0`,cy:`0`,r:`2`,fill:r.pencilColor})]}),f&&!p&&(0,Y.jsxs)(`g`,{filter:`url(#nodeGlow)`,children:[(0,Y.jsx)(`circle`,{cx:`0`,cy:`0`,r:h?10:7,fill:d?`#10b981`:`#f59e0b`,opacity:.4}),(0,Y.jsx)(`circle`,{cx:`0`,cy:`0`,r:h?7:5,fill:d?`#34d399`:`#fbbf24`,stroke:`#fffbeb`,strokeWidth:`1.6`}),(0,Y.jsx)(`circle`,{cx:`0`,cy:`0`,r:h?2.5:1.8,fill:`#ffffff`})]}),p&&(0,Y.jsxs)(`g`,{id:`active-node-beacon`,children:[(0,Y.jsx)(`circle`,{cx:`0`,cy:`0`,r:`12`,fill:`none`,stroke:`#f59e0b`,strokeWidth:`2.5`,className:`beacon-wave`}),(0,Y.jsx)(`circle`,{cx:`0`,cy:`0`,r:`12`,fill:`none`,stroke:`#fbbf24`,strokeWidth:`2`,className:`beacon-wave-delayed`}),(0,Y.jsx)(`circle`,{cx:`0`,cy:`0`,r:`20`,fill:`url(#beaconGlow)`}),(0,Y.jsx)(`circle`,{cx:`0`,cy:`0`,r:`9.5`,fill:d?`#10b981`:`#f59e0b`,stroke:`#ffffff`,strokeWidth:`2.4`,filter:`url(#goldenGlow)`}),(0,Y.jsx)(`circle`,{cx:`0`,cy:`0`,r:`4.5`,fill:`#ffffff`}),(0,Y.jsxs)(`g`,{transform:`translate(0, -18)`,children:[(0,Y.jsx)(`line`,{x1:`0`,y1:`0`,x2:`0`,y2:`10`,stroke:`#f59e0b`,strokeWidth:`2.2`}),(0,Y.jsx)(`polygon`,{points:`0,-10 7,-4 0,2 -7,-4`,fill:d?`#10b981`:`#ef4444`,stroke:`#ffffff`,strokeWidth:`1.5`,filter:`url(#nodeGlow)`}),(0,Y.jsx)(`circle`,{cx:`0`,cy:`-4`,r:`2`,fill:`#ffffff`})]})]}),m&&!p&&(0,Y.jsx)(`circle`,{cx:`0`,cy:`0`,r:`13`,fill:`none`,stroke:`#f59e0b`,strokeWidth:`2`,strokeDasharray:`3 3`}),(i||h||m)&&(0,Y.jsx)(`text`,{x:`0`,y:h?-13:-10,textAnchor:`middle`,fill:d?`#059669`:f?`#d97706`:r.pencilColor,className:`font-pencil font-bold select-none ${h?`text-[13px]`:`text-[10px]`}`,opacity:f?1:.75,children:c.id<0?`P${u+1}`:c.id})]},c.id)})}),f&&(0,Y.jsxs)(`g`,{transform:`translate(${f.x}, ${f.y-42})`,className:`pointer-events-none select-none transition-all duration-300`,children:[(0,Y.jsx)(`rect`,{x:`-80`,y:`-24`,width:`160`,height:`32`,rx:`6`,fill:r.id===`parchment`?`#2a221b`:`#14120f`,stroke:`#f59e0b`,strokeWidth:`1.8`,filter:`url(#nodeGlow)`}),(0,Y.jsx)(`polygon`,{points:`-6,8 6,8 0,14`,fill:r.id===`parchment`?`#2a221b`:`#14120f`,stroke:`#f59e0b`,strokeWidth:`1.8`}),(0,Y.jsxs)(`text`,{x:`0`,y:`-8`,textAnchor:`middle`,fill:`#fef08a`,className:`font-cinzel font-bold text-[12px] tracking-wider`,children:[`NODE `,f.sequenceIndex+1,` / `,e.length]}),(0,Y.jsx)(`text`,{x:`0`,y:`4`,textAnchor:`middle`,fill:`#ffffff`,className:`font-garamond italic font-semibold text-[11px]`,children:f.name.length>20?f.name.substring(0,18)+`…`:f.name})]})]})},_e=({nodes:e,activeNodeIndex:t,completions:n,theme:r,showLabels:i,showGrid:a,showNodeNumbers:o,autoCenterOnActive:s,onNodeClick:c,hoveredNodeIndex:l,setHoveredNodeIndex:u,transform:d,setTransform:f})=>{let p=(0,L.useRef)(null),m=(0,L.useRef)(!1),h=(0,L.useRef)({x:0,y:0}),g=(0,L.useRef)(null),_=(0,L.useRef)(null),[v,y]=(0,L.useState)(!1),b=(0,L.useRef)(d);b.current=d;let x=(0,L.useCallback)(t=>{if(!p.current||t<0||t>=e.length)return;let n=e[t],{clientWidth:r,clientHeight:i}=p.current,a=b.current.scale,o=Math.max(a,.9);f({x:r/2-n.x*o,y:i/2-n.y*o,scale:o})},[e,f]);(0,L.useEffect)(()=>{s&&t>=0&&x(t)},[t,s,x]),(0,L.useEffect)(()=>{if(p.current&&(!s||t<0)){let{clientWidth:e,clientHeight:t}=p.current,n=e/R,r=t/z,i=Math.min(n,r)*.9;f({x:(e-R*i)/2,y:(t-z*i)/2,scale:Math.max(i,.08)})}},[f,s,t]);let S=e=>{if(e.preventDefault(),!p.current)return;y(!0),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>y(!1),140);let t=p.current.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=e.deltaY<0?1.15:.85,a=Math.min(Math.max(d.scale*i,.08),3.5);f({x:n-(n-d.x)/d.scale*a,y:r-(r-d.y)/d.scale*a,scale:a})},C=e=>{e.button===0&&(m.current=!0,y(!0),h.current={x:e.clientX-d.x,y:e.clientY-d.y})},w=e=>{m.current&&f(t=>({...t,x:e.clientX-h.current.x,y:e.clientY-h.current.y}))},T=()=>{m.current=!1,y(!1)},E=e=>{if(y(!0),e.touches.length===1)m.current=!0,h.current={x:e.touches[0].clientX-d.x,y:e.touches[0].clientY-d.y};else if(e.touches.length===2){m.current=!1;let t=e.touches[0].clientX-e.touches[1].clientX,n=e.touches[0].clientY-e.touches[1].clientY;g.current=Math.hypot(t,n)}},D=e=>{if(e.touches.length===1&&m.current)f(t=>({...t,x:e.touches[0].clientX-h.current.x,y:e.touches[0].clientY-h.current.y}));else if(e.touches.length===2&&g.current&&p.current){let t=e.touches[0].clientX-e.touches[1].clientX,n=e.touches[0].clientY-e.touches[1].clientY,r=Math.hypot(t,n),i=r/g.current;g.current=r;let a=p.current.getBoundingClientRect(),o=(e.touches[0].clientX+e.touches[1].clientX)/2-a.left,s=(e.touches[0].clientY+e.touches[1].clientY)/2-a.top;f(e=>{let t=Math.min(Math.max(e.scale*i,.08),3.5);return{scale:t,x:o-(o-e.x)/e.scale*t,y:s-(s-e.y)/e.scale*t}})}},O=()=>{m.current=!1,g.current=null,y(!1)},k=r.id!==`parchment`;return(0,Y.jsxs)(`div`,{id:`pencil-map-container`,ref:p,className:`relative w-full h-full overflow-hidden canvas-interactive select-none ${k?`parchment-dark-bg`:`parchment-bg`}`,onWheel:S,onMouseDown:C,onMouseMove:w,onMouseUp:T,onMouseLeave:T,onTouchStart:E,onTouchMove:D,onTouchEnd:O,children:[(0,Y.jsx)(`div`,{className:`absolute inset-0 pointer-events-none z-10 ${k?`map-dark-vignette`:`map-vignette`}`}),(0,Y.jsxs)(`svg`,{id:`pencil-map-svg`,viewBox:`0 0 ${R} ${z}`,width:R,height:z,style:{transform:`translate(${d.x}px, ${d.y}px) scale(${d.scale})`,transformOrigin:`0 0`,transition:v?`none`:`transform 0.4s cubic-bezier(0.16, 1, 0.3, 1)`},className:`absolute top-0 left-0`,children:[(0,Y.jsx)(he,{theme:r,showGrid:a}),(0,Y.jsx)(me,{theme:r,showLabels:i,finalNode:e[e.length-1]}),(0,Y.jsx)(ge,{nodes:e,activeNodeIndex:t,completions:n,theme:r,showNodeNumbers:o,onNodeClick:c,hoveredNodeIndex:l,setHoveredNodeIndex:u})]})]})},ve=({theme:e,soundEnabled:t,autoCenterOnActive:n,showLabels:r,showGrid:o,showNodeNumbers:c,tracks:l,activeTrack:u,onTrackChange:f,onToggleSound:p,onToggleAutoCenter:m,onToggleLabels:g,onToggleGrid:_,onToggleNodeNumbers:v,onToggleTheme:y,onZoomIn:b,onZoomOut:x,onResetZoom:S,onCenterActiveNode:w})=>{let T=e.id!==`parchment`;return(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-1 text-xs select-none`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[l&&l.length>0&&f&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 bg-black/30 backdrop-blur-md px-2.5 py-1.5 rounded-xl border border-black/20 shadow-md`,children:[(0,Y.jsx)(i,{className:`w-3.5 h-3.5 text-amber-500`}),(0,Y.jsx)(`span`,{className:`font-cinzel text-[10px] font-bold tracking-wider text-amber-600 dark:text-amber-400 uppercase hidden sm:inline`,children:`Track:`}),(0,Y.jsx)(`select`,{value:u,onChange:e=>f(e.target.value),className:`bg-transparent border-none text-xs font-cinzel font-bold text-amber-700 dark:text-amber-300 cursor-pointer focus:outline-none`,children:l.map(e=>(0,Y.jsx)(`option`,{value:e.id,className:`bg-stone-900 text-stone-200`,children:e.name},e.id))})]}),(0,Y.jsxs)(`button`,{id:`toggle-sound-btn`,onClick:p,title:t?`Mute Audio`:`Enable Audio`,className:`flex items-center gap-1 px-2.5 py-1.5 rounded-xl border backdrop-blur-md shadow-md transition-all cursor-pointer ${t?`bg-amber-500/20 border-amber-500/50 text-amber-600 dark:text-amber-400`:`bg-black/20 border-black/10 text-stone-500`}`,children:[t?(0,Y.jsx)(h,{className:`w-3.5 h-3.5`}):(0,Y.jsx)(ee,{className:`w-3.5 h-3.5`}),(0,Y.jsx)(`span`,{className:`font-garamond font-semibold hidden sm:inline`,children:`Audio`})]}),(0,Y.jsxs)(`button`,{id:`toggle-autocenter-btn`,onClick:m,title:`Auto-Center on Active Node`,className:`flex items-center gap-1 px-2.5 py-1.5 rounded-xl border backdrop-blur-md shadow-md transition-all cursor-pointer ${n?`bg-amber-500/20 border-amber-500/50 text-amber-600 dark:text-amber-400`:`bg-black/20 border-black/10 text-stone-500`}`,children:[(0,Y.jsx)(N,{className:`w-3.5 h-3.5`}),(0,Y.jsx)(`span`,{className:`font-garamond font-semibold hidden sm:inline`,children:`Auto-Track`})]}),(0,Y.jsxs)(`button`,{id:`toggle-labels-btn`,onClick:g,title:`Toggle Geographical Labels`,className:`flex items-center gap-1 px-2.5 py-1.5 rounded-xl border backdrop-blur-md shadow-md transition-all cursor-pointer ${r?`bg-amber-500/20 border-amber-500/50 text-amber-600 dark:text-amber-400`:`bg-black/20 border-black/10 text-stone-500`}`,children:[(0,Y.jsx)(d,{className:`w-3.5 h-3.5`}),(0,Y.jsx)(`span`,{className:`font-garamond font-semibold hidden sm:inline`,children:`Labels`})]}),(0,Y.jsx)(`button`,{id:`toggle-grid-btn`,onClick:_,title:`Toggle Coordinate Grid`,className:`px-2.5 py-1.5 rounded-xl border backdrop-blur-md shadow-md font-garamond font-semibold transition-all cursor-pointer ${o?`bg-amber-500/20 border-amber-500/50 text-amber-600 dark:text-amber-400`:`bg-black/20 border-black/10 text-stone-500`}`,children:`Grid`}),(0,Y.jsx)(`button`,{id:`toggle-numbers-btn`,onClick:v,title:`Toggle All Node Numbers`,className:`px-2.5 py-1.5 rounded-xl border backdrop-blur-md shadow-md font-garamond font-semibold transition-all cursor-pointer ${c?`bg-amber-500/20 border-amber-500/50 text-amber-600 dark:text-amber-400`:`bg-black/20 border-black/10 text-stone-500`}`,children:`#s`}),(0,Y.jsxs)(`button`,{id:`toggle-theme-btn`,onClick:y,title:`Switch Map Lighting Style`,className:`flex items-center gap-1 px-2.5 py-1.5 rounded-xl border backdrop-blur-md shadow-md transition-all cursor-pointer ${T?`bg-amber-500/20 border-amber-500/50 text-amber-300`:`bg-amber-900/10 border-amber-900/20 text-amber-900`}`,children:[T?(0,Y.jsx)(D,{className:`w-3.5 h-3.5`}):(0,Y.jsx)(s,{className:`w-3.5 h-3.5`}),(0,Y.jsx)(`span`,{className:`font-garamond font-semibold hidden sm:inline`,children:T?`Day`:`Night`})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 bg-black/30 backdrop-blur-md p-1 rounded-xl border border-black/20 shadow-md`,children:[(0,Y.jsx)(`button`,{id:`zoom-in-btn`,onClick:b,title:`Zoom In`,className:`p-1.5 rounded-lg hover:bg-white/10 text-stone-300 cursor-pointer`,children:(0,Y.jsx)(C,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{id:`zoom-out-btn`,onClick:x,title:`Zoom Out`,className:`p-1.5 rounded-lg hover:bg-white/10 text-stone-300 cursor-pointer`,children:(0,Y.jsx)(M,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{id:`center-active-btn`,onClick:w,title:`Focus Active Node`,className:`p-1.5 rounded-lg hover:bg-white/10 text-stone-300 cursor-pointer`,children:(0,Y.jsx)(N,{className:`w-4 h-4 text-amber-400`})}),(0,Y.jsx)(`button`,{id:`reset-zoom-btn`,onClick:S,title:`Fit Entire Map`,className:`p-1.5 rounded-lg hover:bg-white/10 text-stone-300 cursor-pointer`,children:(0,Y.jsx)(a,{className:`w-4 h-4`})})]})]})},ye=({node:e,activeNodeIndex:t,totalNodes:n,theme:r,onAdvance:i,onRetreat:a,details:o,modalLoading:s,isCompleted:c,toggleLoading:u,onToggleCompletion:d,onSelectProblemForReview:f})=>{let[p,h]=(0,L.useState)(!1),[g,_]=(0,L.useState)(!1);if(!e)return null;let C=r.id!==`parchment`,T=o.length>0,D=I(e.id);return(0,Y.jsxs)(`div`,{id:`node-detail-card`,className:`relative p-4 rounded-2xl border-2 shadow-2xl backdrop-blur-md transition-all duration-300 max-h-[calc(100vh-180px)] overflow-y-auto custom-scrollbar select-none ${C?`bg-[#1c1813]/95 border-[#594634] text-[#f2e6d5]`:`bg-[#fbf5e8]/98 border-[#cbb38e] text-[#2c1d11]`}`,children:[(0,Y.jsx)(`div`,{className:`absolute top-2 left-2 w-2.5 h-2.5 border-t-2 border-l-2 border-amber-600/70 pointer-events-none`}),(0,Y.jsx)(`div`,{className:`absolute top-2 right-2 w-2.5 h-2.5 border-t-2 border-r-2 border-amber-600/70 pointer-events-none`}),(0,Y.jsx)(`div`,{className:`absolute bottom-2 left-2 w-2.5 h-2.5 border-b-2 border-l-2 border-amber-600/70 pointer-events-none`}),(0,Y.jsx)(`div`,{className:`absolute bottom-2 right-2 w-2.5 h-2.5 border-b-2 border-r-2 border-amber-600/70 pointer-events-none`}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b pb-2 mb-3 ${C?`border-amber-900/40`:`border-amber-900/15`}`,children:[(0,Y.jsxs)(`span`,{className:`font-cinzel text-xs font-bold tracking-wider uppercase ${C?`text-amber-400`:`text-amber-800`}`,children:[`Node `,t+1,` / `,n]}),c&&(0,Y.jsx)(`span`,{className:`text-[10px] font-cinzel font-bold px-2 py-0.5 rounded border ${C?`bg-emerald-500/20 text-emerald-400 border-emerald-500/40`:`bg-emerald-600/15 text-emerald-800 border-emerald-600/30`}`,children:`✓ Solved`})]}),s?(0,Y.jsxs)(`div`,{className:`py-6 flex flex-col items-center justify-center gap-2`,children:[(0,Y.jsx)(w,{className:`w-5 h-5 text-amber-500 animate-spin`}),(0,Y.jsx)(`span`,{className:`text-[10px] font-cinzel font-bold opacity-75 uppercase`,children:`Loading Problem Details...`})]}):T?(0,Y.jsx)(`div`,{className:`space-y-3.5`,children:o.map(t=>(0,Y.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex justify-between items-start gap-2`,children:[(0,Y.jsxs)(`h3`,{className:`font-bold font-headline-md text-base leading-snug m-0 ${C?`text-[#fef3c7]`:`text-[#1c120c]`}`,children:[e.id>0?`${e.id}. `:``,t.name]}),(0,Y.jsx)(`span`,{className:`text-[9px] font-cinzel font-bold px-2 py-0.5 rounded border shrink-0 ${t.difficulty===`Easy`?C?`bg-emerald-950/90 text-emerald-300 border-emerald-500/40`:`bg-emerald-100 text-emerald-900 border-emerald-400`:t.difficulty===`Medium`?C?`bg-amber-950/90 text-amber-300 border-amber-500/40`:`bg-amber-100 text-amber-900 border-amber-400`:C?`bg-rose-950/90 text-rose-300 border-rose-500/40`:`bg-rose-100 text-rose-900 border-rose-400`}`,children:t.difficulty?.toUpperCase()||`MEDIUM`})]}),(0,Y.jsxs)(`div`,{className:`text-xs font-garamond font-semibold ${C?`text-amber-300`:`text-amber-900`}`,children:[`Pattern: `,(0,Y.jsx)(`span`,{className:`italic font-bold`,children:t.pattern||`General`})]}),(0,Y.jsxs)(`div`,{className:`flex gap-4 text-xs font-semibold ${C?`text-stone-300`:`text-stone-800`}`,children:[(0,Y.jsxs)(`div`,{children:[`Time:`,` `,(0,Y.jsx)(`code`,{className:`px-1.5 py-0.5 rounded font-mono text-[11px] font-bold ${C?`bg-black/50 text-emerald-300`:`bg-amber-950/10 text-emerald-800`}`,children:t.optimal_time||`O(N)`})]}),(0,Y.jsxs)(`div`,{children:[`Space:`,` `,(0,Y.jsx)(`code`,{className:`px-1.5 py-0.5 rounded font-mono text-[11px] font-bold ${C?`bg-black/50 text-emerald-300`:`bg-amber-950/10 text-emerald-800`}`,children:t.optimal_space||`O(1)`})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2 pt-1 border-t ${C?`border-amber-900/30`:`border-amber-900/10`}`,children:[t.google_doc_url&&(0,Y.jsxs)(`a`,{href:t.google_doc_url,target:`_blank`,rel:`noreferrer`,className:`flex-1 flex items-center justify-center gap-1.5 py-2 px-2.5 rounded-xl border text-xs font-cinzel font-semibold transition-all cursor-pointer text-center ${C?`border-amber-500/30 bg-amber-500/10 hover:bg-amber-500/20 text-amber-200`:`border-amber-900/20 bg-amber-900/5 hover:bg-amber-900/10 text-amber-900`}`,children:[(0,Y.jsx)(v,{className:`w-3.5 h-3.5`}),(0,Y.jsx)(`span`,{children:`Google Doc`})]}),(0,Y.jsxs)(`button`,{onClick:()=>f(t.id),className:`flex-1 flex items-center justify-center gap-1.5 py-2 px-2.5 rounded-xl bg-amber-600 hover:bg-amber-500 text-white text-xs font-cinzel font-bold shadow transition-all active:scale-95 cursor-pointer text-center`,children:[(0,Y.jsx)(x,{className:`w-3.5 h-3.5`}),(0,Y.jsx)(`span`,{children:`Review Problem`})]})]})]},t.id))}):D?(0,Y.jsxs)(`div`,{className:`space-y-3.5`,children:[(0,Y.jsxs)(`div`,{className:`flex justify-between items-start gap-2`,children:[(0,Y.jsxs)(`h3`,{className:`font-bold font-headline-md text-base leading-snug m-0 ${C?`text-[#fef3c7]`:`text-[#1c120c]`}`,children:[`LC #`,D.problem_number,`. `,D.name]}),(0,Y.jsx)(`span`,{className:`text-[9px] font-cinzel font-bold px-2 py-0.5 rounded border shrink-0 ${D.difficulty===`Easy`?C?`bg-emerald-950/90 text-emerald-300 border-emerald-500/40`:`bg-emerald-100 text-emerald-900 border-emerald-400`:D.difficulty===`Medium`?C?`bg-amber-950/90 text-amber-300 border-amber-500/40`:`bg-amber-100 text-amber-900 border-amber-400`:C?`bg-rose-950/90 text-rose-300 border-rose-500/40`:`bg-rose-100 text-rose-900 border-rose-400`}`,children:D.difficulty?.toUpperCase()||`MEDIUM`})]}),(0,Y.jsxs)(`div`,{className:`text-xs font-garamond font-semibold ${C?`text-amber-300`:`text-amber-900`}`,children:[`Pattern: `,(0,Y.jsx)(`span`,{className:`italic font-bold`,children:D.pattern})]}),(0,Y.jsxs)(`div`,{className:`flex gap-4 text-xs font-semibold ${C?`text-stone-300`:`text-stone-800`}`,children:[(0,Y.jsxs)(`div`,{children:[`Time:`,` `,(0,Y.jsx)(`code`,{className:`px-1.5 py-0.5 rounded font-mono text-[11px] font-bold ${C?`bg-black/50 text-emerald-300`:`bg-amber-950/10 text-emerald-800`}`,children:D.time_complexity})]}),(0,Y.jsxs)(`div`,{children:[`Space:`,` `,(0,Y.jsx)(`code`,{className:`px-1.5 py-0.5 rounded font-mono text-[11px] font-bold ${C?`bg-black/50 text-emerald-300`:`bg-amber-950/10 text-emerald-800`}`,children:D.space_complexity})]})]}),D.description&&(0,Y.jsx)(`div`,{className:`p-2.5 rounded-xl border text-xs leading-relaxed ${C?`bg-[#252019] border-[#5a4836] text-stone-200`:`bg-white/80 border-[#cbb38e] text-stone-800`}`,children:D.description}),(0,Y.jsxs)(`div`,{className:`space-y-2 pt-1 border-t border-amber-900/20`,children:[(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(`button`,{onClick:async()=>{if(D&&!p){h(!0);try{await oe(D),_(!0),c||d(e.id),setTimeout(()=>_(!1),3e3)}catch(e){console.error(`Failed to activate problem:`,e)}finally{h(!1)}}},disabled:p,className:`flex-1 flex items-center justify-center gap-1.5 py-2 px-2.5 rounded-xl border text-xs font-cinzel font-bold shadow-sm transition-all active:scale-95 cursor-pointer disabled:opacity-50 ${g?`bg-emerald-600 text-white border-emerald-400`:C?`bg-amber-500/15 border-amber-500/40 hover:bg-amber-500/25 text-amber-300`:`bg-amber-900/10 border-amber-900/30 hover:bg-amber-900/20 text-amber-900`}`,children:[p?(0,Y.jsx)(w,{className:`w-3.5 h-3.5 animate-spin`}):g?(0,Y.jsx)(ne,{className:`w-3.5 h-3.5`}):(0,Y.jsx)(m,{className:`w-3.5 h-3.5 text-amber-500`}),(0,Y.jsx)(`span`,{children:g?`Added to Box 1!`:`Learned Today`})]}),(0,Y.jsxs)(`button`,{onClick:async()=>{if(D&&!p){h(!0);try{let t=await oe(D);c||d(e.id),f(t.problem_id)}catch(e){console.error(`Failed to launch problem:`,e)}finally{h(!1)}}},disabled:p,className:`flex-1 flex items-center justify-center gap-1.5 py-2 px-2.5 rounded-xl bg-amber-600 hover:bg-amber-500 text-white text-xs font-cinzel font-bold shadow transition-all active:scale-95 cursor-pointer disabled:opacity-50`,children:[(0,Y.jsx)(x,{className:`w-3.5 h-3.5`}),(0,Y.jsx)(`span`,{children:`Solve / Review`})]})]}),(0,Y.jsxs)(`a`,{href:D.leetcode_url,target:`_blank`,rel:`noreferrer`,className:`w-full flex items-center justify-center gap-1.5 p-1.5 rounded-xl border text-[11px] font-garamond font-semibold transition-all cursor-pointer ${C?`border-amber-500/20 hover:bg-amber-500/10 text-stone-300`:`border-amber-900/20 hover:bg-amber-900/5 text-stone-800`}`,children:[(0,Y.jsx)(v,{className:`w-3 h-3 text-emerald-500`}),(0,Y.jsx)(`span`,{children:`Open on LeetCode.com`})]})]})]}):(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`h3`,{className:`font-bold font-headline-md text-base leading-snug m-0 ${C?`text-[#fef3c7]`:`text-[#1c120c]`}`,children:e.name})}),(0,Y.jsxs)(`div`,{className:`p-3 rounded-xl border space-y-2 text-xs ${C?`bg-[#252019] border-[#5a4836] text-stone-200`:`bg-white/90 border-[#cbb38e] text-stone-800`}`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Y.jsx)(j,{className:`w-4 h-4 text-amber-500 shrink-0 mt-0.5`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h4`,{className:`font-bold text-xs m-0`,children:`No Local Note Synced`}),(0,Y.jsxs)(`p`,{className:`text-[10px] opacity-75 mt-0.5 leading-normal`,children:[`Sync Google Drive or create a note for problem #`,e.id,`.`]})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-1.5 pt-1 border-t ${C?`border-amber-900/20`:`border-amber-900/10`}`,children:[(0,Y.jsx)(`a`,{href:`https://leetcode.com/problemset/?search=${e.id}`,target:`_blank`,rel:`noreferrer`,className:`w-full flex items-center justify-between p-1.5 rounded-lg border text-[11px] font-garamond font-semibold transition-all cursor-pointer ${C?`border-amber-500/20 hover:bg-amber-500/10 text-stone-200`:`border-amber-900/20 hover:bg-amber-900/5 text-stone-800`}`,children:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(v,{className:`w-3 h-3 text-emerald-500`}),`Search LeetCode #`,e.id]})}),(0,Y.jsx)(`a`,{href:`https://www.google.com/search?q=leetcode+${e.id}`,target:`_blank`,rel:`noreferrer`,className:`w-full flex items-center justify-between p-1.5 rounded-lg border text-[11px] font-garamond font-semibold transition-all cursor-pointer ${C?`border-amber-500/20 hover:bg-amber-500/10 text-stone-200`:`border-amber-900/20 hover:bg-amber-900/5 text-stone-800`}`,children:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(l,{className:`w-3 h-3 text-amber-500`}),`Search Google Solution`]})})]})]})]}),(0,Y.jsx)(`div`,{className:`pt-3 mt-3 border-t ${C?`border-amber-900/40`:`border-amber-900/15`}`,children:(0,Y.jsx)(`button`,{onClick:()=>d(e.id),disabled:u,className:`w-full py-2.5 rounded-xl font-cinzel text-xs font-bold tracking-wider uppercase flex items-center justify-center gap-2 cursor-pointer transition-all border shadow-sm active:scale-95 disabled:opacity-50 ${c?C?`bg-rose-500/15 border-rose-500/40 text-rose-400 hover:bg-rose-500/25`:`bg-rose-600/10 border-rose-600/30 text-rose-800 hover:bg-rose-600/20`:C?`bg-emerald-500/15 border-emerald-500/40 text-emerald-400 hover:bg-emerald-500/25`:`bg-emerald-600/10 border-emerald-600/30 text-emerald-800 hover:bg-emerald-600/20`}`,children:c?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(E,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{children:`Unmark As Completed`})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(y,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{children:`Mark As Completed`})]})})}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pt-2.5 mt-2.5 border-t ${C?`border-amber-900/40`:`border-amber-900/15`}`,children:[(0,Y.jsxs)(`button`,{onClick:a,disabled:t<=0,className:`flex items-center gap-1 text-[11px] font-cinzel font-semibold px-2.5 py-1.5 rounded-lg border transition-all disabled:opacity-30 cursor-pointer ${C?`border-amber-500/30 hover:bg-amber-500/10 text-stone-200`:`border-amber-900/20 hover:bg-amber-900/5 text-stone-800`}`,children:[(0,Y.jsx)(b,{className:`w-3 h-3`}),(0,Y.jsx)(`span`,{children:`Prev`})]}),(0,Y.jsxs)(`span`,{className:`text-[10px] font-garamond italic font-semibold ${C?`text-stone-400`:`text-stone-600`}`,children:[`Waypoint `,t+1]}),(0,Y.jsxs)(`button`,{onClick:i,disabled:t>=n-1,className:`flex items-center gap-1 text-[11px] font-cinzel font-semibold px-2.5 py-1.5 rounded-lg bg-amber-600 hover:bg-amber-500 text-white transition-all disabled:opacity-30 cursor-pointer shadow`,children:[(0,Y.jsx)(`span`,{children:`Next`}),(0,Y.jsx)(S,{className:`w-3 h-3`})]})]})]})},be=({isOpen:e,onClose:t,nodes:n,theme:i,onReset:a})=>{if(!e)return null;let o=i.id!==`parchment`,s=n.length;return(0,Y.jsx)(`div`,{className:`fixed inset-0 z-[120] flex items-center justify-center p-4 bg-black/70 backdrop-blur-sm animate-fade-in select-none`,children:(0,Y.jsxs)(`div`,{id:`expedition-complete-modal`,className:`relative w-full max-w-lg p-6 rounded-2xl border-2 shadow-2xl transition-all ${o?`bg-[#1c1813] border-[#594634] text-[#f2e6d5]`:`bg-[#f7efe0] border-[#c8b28f] text-[#332415]`}`,children:[(0,Y.jsx)(`button`,{onClick:t,className:`absolute top-4 right-4 p-1.5 rounded-lg opacity-60 hover:opacity-100 hover:bg-black/10 cursor-pointer`,children:(0,Y.jsx)(k,{className:`w-5 h-5`})}),(0,Y.jsxs)(`div`,{className:`text-center mb-6`,children:[(0,Y.jsx)(`div`,{className:`inline-flex p-3 rounded-2xl bg-amber-500/20 border border-amber-500/40 text-amber-500 mb-3 shadow-lg shadow-amber-500/20`,children:(0,Y.jsx)(T,{className:`w-10 h-10 animate-bounce`})}),(0,Y.jsx)(`h2`,{className:`font-cinzel-dec font-bold text-2xl md:text-3xl text-amber-600 dark:text-amber-400`,children:`Expedition Completed!`}),(0,Y.jsxs)(`p`,{className:`font-garamond italic text-sm md:text-base opacity-80 mt-1`,children:[`All `,s,` Waypoints and the entire ancient trail are now fully illuminated.`]})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 mb-6`,children:[(0,Y.jsxs)(`div`,{className:`p-3 rounded-xl bg-amber-500/10 border border-amber-900/15 text-center`,children:[(0,Y.jsx)(`span`,{className:`block font-cinzel font-bold text-xl text-amber-600 dark:text-amber-300`,children:s}),(0,Y.jsx)(`span`,{className:`font-garamond text-xs opacity-75`,children:`Nodes Solved`})]}),(0,Y.jsxs)(`div`,{className:`p-3 rounded-xl bg-amber-500/10 border border-amber-900/15 text-center`,children:[(0,Y.jsx)(`span`,{className:`block font-cinzel font-bold text-xl text-amber-600 dark:text-amber-300`,children:`7`}),(0,Y.jsx)(`span`,{className:`font-garamond text-xs opacity-75`,children:`Biomes Crossed`})]}),(0,Y.jsxs)(`div`,{className:`p-3 rounded-xl bg-amber-500/10 border border-amber-900/15 text-center`,children:[(0,Y.jsx)(`span`,{className:`block font-cinzel font-bold text-xl text-amber-600 dark:text-amber-300`,children:`1,620m`}),(0,Y.jsx)(`span`,{className:`font-garamond text-xs opacity-75`,children:`Peak Citadel`})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-2 mb-6 max-h-48 overflow-y-auto custom-scrollbar pr-1`,children:[n.length>0&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-garamond`,children:[(0,Y.jsx)(_,{className:`w-4 h-4 text-emerald-500 flex-shrink-0`}),(0,Y.jsx)(`span`,{className:`font-bold`,children:`Waypoint 1:`}),(0,Y.jsx)(`span`,{children:n[0].name})]}),n.length>25&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-garamond`,children:[(0,Y.jsx)(_,{className:`w-4 h-4 text-emerald-500 flex-shrink-0`}),(0,Y.jsx)(`span`,{className:`font-bold`,children:`Waypoint 25:`}),(0,Y.jsx)(`span`,{children:n[24].name})]}),n.length>50&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-garamond`,children:[(0,Y.jsx)(_,{className:`w-4 h-4 text-emerald-500 flex-shrink-0`}),(0,Y.jsx)(`span`,{className:`font-bold`,children:`Waypoint 50:`}),(0,Y.jsx)(`span`,{children:n[49].name})]}),n.length>75&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-garamond`,children:[(0,Y.jsx)(_,{className:`w-4 h-4 text-emerald-500 flex-shrink-0`}),(0,Y.jsx)(`span`,{className:`font-bold`,children:`Waypoint 75:`}),(0,Y.jsx)(`span`,{children:n[74].name})]}),n.length>0&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-garamond`,children:[(0,Y.jsx)(_,{className:`w-4 h-4 text-emerald-500 flex-shrink-0`}),(0,Y.jsx)(`span`,{className:`font-bold`,children:`Final Milestone:`}),(0,Y.jsx)(`span`,{className:`text-amber-600 dark:text-amber-300 font-bold`,children:n[n.length-1].name})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`button`,{onClick:()=>{a(),t()},className:`flex-1 flex items-center justify-center gap-1.5 py-2.5 px-4 rounded-xl border border-stone-400 dark:border-stone-700 font-cinzel font-semibold text-xs transition-all hover:bg-stone-500/10 cursor-pointer`,children:[(0,Y.jsx)(r,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{children:`Retrace From Start`})]}),(0,Y.jsxs)(`button`,{onClick:t,className:`flex-1 flex items-center justify-center gap-1.5 py-2.5 px-4 rounded-xl bg-amber-600 hover:bg-amber-500 text-white font-cinzel font-bold text-xs shadow-lg transition-all cursor-pointer`,children:[(0,Y.jsx)(te,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{children:`Admire Map`})]})]})]})})},xe=``,Se=({nodes:e,activeNodeIndex:t,setActiveNodeIndex:r,completions:a,theme:o,onToggleCompletion:s,onSelectProblemForReview:c,onSwitchToMap:u,tracks:d,activeTrack:m,onTrackChange:h})=>{let y=o.id!==`parchment`,[b,S]=(0,L.useState)(``),[C,T]=(0,L.useState)(`all`),[E,D]=(0,L.useState)(`all`),[j,M]=(0,L.useState)(`all`),[N,ee]=(0,L.useState)(`sequence`),[te,ne]=(0,L.useState)(null),[P,se]=(0,L.useState)(null),R=(0,L.useRef)(null),z=(0,L.useMemo)(()=>{let t=new Set;return e.forEach(e=>{let n=I(e.id);n?.pattern&&t.add(n.pattern)}),t.size===0&&ae().forEach(e=>t.add(e)),Array.from(t)},[e]),B=e.length,V=(0,L.useMemo)(()=>e.filter(e=>a.has(e.id)).length,[e,a]),ce=B>0?Math.round(V/B*100):0,H=(0,L.useMemo)(()=>{let t=b.trim().toLowerCase(),n=t.replace(/^#/,``);return e.filter(e=>{let r=a.has(e.id);if(C===`solved`&&!r||C===`unsolved`&&r)return!1;let i=I(e.id);if(E!==`all`&&i?.pattern!==E||j!==`all`&&i?.difficulty!==j)return!1;if(t){let r=String(e.id).includes(n),a=String(e.sequenceIndex+1)===n,o=e.name.toLowerCase().includes(t),s=i?.pattern?.toLowerCase().includes(t)??!1,c=i?.difficulty?.toLowerCase().includes(t)??!1;if(!r&&!a&&!o&&!s&&!c)return!1}return!0}).sort((e,t)=>{switch(N){case`number_asc`:return e.id-t.id;case`number_desc`:return t.id-e.id;case`name`:return e.name.localeCompare(t.name);default:return e.sequenceIndex-t.sequenceIndex}})},[e,a,C,E,j,b,N]),U=async e=>{if(P===null){se(e.id);try{let{data:{session:t}}=await F.auth.getSession(),n={Authorization:`Bearer ${t?t.access_token:`sandbox`}`},r=await fetch(`${xe}/api/reviews/problems/${e.id}`,{headers:n});if(r.ok){let e=await r.json().catch(()=>[]);if(Array.isArray(e)&&e.length>0&&e[0]?.id){c(e[0].id);return}}let i=I(e.id);if(i){let e=await oe(i);if(e?.problem_id){c(e.problem_id);return}}c(String(e.id))}catch(t){console.error(`Failed to prepare problem for review:`,t),c(String(e.id))}finally{se(null)}}};return(0,L.useEffect)(()=>{if(t>=0&&!b&&C===`all`&&E===`all`&&j===`all`){let e=setTimeout(()=>{let e=document.getElementById(`problem-item-${t}`);e&&e.scrollIntoView({behavior:`auto`,block:`center`})},80);return()=>clearTimeout(e)}},[t,b,C,E,j]),(0,Y.jsxs)(`div`,{className:`relative w-full h-full flex flex-col overflow-hidden select-none transition-colors duration-300 ${y?`parchment-dark-bg text-[#f4ebd9]`:`parchment-bg text-[#2c2014]`}`,children:[(0,Y.jsx)(`div`,{className:`absolute inset-0 pointer-events-none z-10 ${y?`map-dark-vignette`:`map-vignette`}`}),(0,Y.jsx)(`div`,{className:`relative z-20 px-4 pt-16 pb-3 border-b backdrop-blur-md transition-colors ${y?`bg-[#1a1612]/90 border-[#4a392b]`:`bg-[#f7efe0]/90 border-[#c8b28f]`}`,children:(0,Y.jsxs)(`div`,{className:`max-w-6xl mx-auto space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2.5 items-stretch sm:items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`relative flex-1`,children:[(0,Y.jsx)(`div`,{className:`absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none`,children:(0,Y.jsx)(l,{className:`w-4 h-4 text-amber-600 dark:text-amber-400`})}),(0,Y.jsx)(`input`,{id:`journey-search-input`,type:`text`,value:b,onChange:e=>S(e.target.value),placeholder:`Search problem title, #number, or pattern (e.g. 1, Two Sum, Two Pointers)...`,className:`w-full pl-9 pr-8 py-2 rounded-xl text-xs md:text-sm font-garamond font-semibold border-2 shadow-inner focus:outline-none transition-all ${y?`bg-[#231e18] border-[#5a4836] text-[#f4ebd9] placeholder-stone-500 focus:border-amber-500/70`:`bg-[#fcf7ee] border-[#cfbc9c] text-[#2c2014] placeholder-stone-500 focus:border-amber-700/60`}`}),b&&(0,Y.jsx)(`button`,{onClick:()=>S(``),title:`Clear search`,className:`absolute inset-y-0 right-0 pr-2.5 flex items-center text-stone-400 hover:text-amber-600 cursor-pointer`,children:(0,Y.jsx)(k,{className:`w-4 h-4`})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[d&&d.length>0&&h&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-xl border text-xs font-cinzel font-bold shadow-sm ${y?`bg-[#231e18] border-[#5a4836] text-amber-300`:`bg-[#fcf7ee] border-[#cfbc9c] text-amber-900`}`,children:[(0,Y.jsx)(i,{className:`w-3.5 h-3.5 text-amber-500 shrink-0`}),(0,Y.jsx)(`span`,{className:`text-[10px] uppercase opacity-75 hidden md:inline`,children:`Track:`}),(0,Y.jsx)(`select`,{value:m,onChange:e=>h(e.target.value),className:`bg-transparent border-none text-xs font-cinzel font-bold cursor-pointer focus:outline-none`,children:d.map(e=>(0,Y.jsx)(`option`,{value:e.id,className:`bg-stone-900 text-stone-200`,children:e.name},e.id))})]}),(0,Y.jsxs)(`button`,{onClick:()=>{let e=document.getElementById(`problem-item-${t}`);e&&(e.scrollIntoView({behavior:`smooth`,block:`center`}),J.playPencilScratch())},title:`Scroll to active problem in list`,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-xl border text-xs font-cinzel font-bold transition-all shadow-sm active:scale-95 cursor-pointer ${y?`bg-amber-500/20 border-amber-500/40 text-amber-300 hover:bg-amber-500/30`:`bg-amber-600/15 border-amber-600/30 text-amber-900 hover:bg-amber-600/25`}`,children:[(0,Y.jsx)(A,{className:`w-3.5 h-3.5 text-amber-500`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:`Current Problem`}),(0,Y.jsxs)(`span`,{className:`font-mono text-[11px]`,children:[`#`,t+1]})]})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2.5 pt-1 text-xs`,children:[(0,Y.jsx)(`div`,{className:`flex items-center gap-1`,children:[`all`,`solved`,`unsolved`].map(e=>{let t=C===e,n=e===`all`?B:e===`solved`?V:B-V;return(0,Y.jsxs)(`button`,{onClick:()=>T(e),className:`px-2.5 py-1 rounded-lg font-cinzel text-xs font-bold capitalize transition-all cursor-pointer border ${t?`bg-amber-600 border-amber-500 text-white shadow-sm`:y?`bg-[#231e18] border-[#4a392b] text-stone-400 hover:text-stone-200`:`bg-[#fcf7ee] border-[#cfbc9c] text-stone-600 hover:text-stone-900`}`,children:[e,` `,(0,Y.jsxs)(`span`,{className:`text-[10px] opacity-80`,children:[`(`,n,`)`]})]},e)})}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1 rounded-lg border text-xs font-garamond font-semibold ${y?`bg-[#231e18] border-[#4a392b] text-stone-300`:`bg-[#fcf7ee] border-[#cfbc9c] text-stone-800`}`,children:[(0,Y.jsx)(re,{className:`w-3 h-3 text-amber-500`}),(0,Y.jsx)(`span`,{className:`text-[10px] font-cinzel uppercase opacity-75`,children:`Pattern:`}),(0,Y.jsxs)(`select`,{value:E,onChange:e=>D(e.target.value),className:`bg-transparent border-none text-xs font-garamond font-bold cursor-pointer focus:outline-none max-w-[150px] truncate`,children:[(0,Y.jsxs)(`option`,{value:`all`,className:`bg-stone-900 text-stone-200`,children:[`All Patterns (`,z.length,`)`]}),z.map(e=>(0,Y.jsx)(`option`,{value:e,className:`bg-stone-900 text-stone-200`,children:e},e))]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1 rounded-lg border text-xs font-garamond font-semibold ${y?`bg-[#231e18] border-[#4a392b] text-stone-300`:`bg-[#fcf7ee] border-[#cfbc9c] text-stone-800`}`,children:[(0,Y.jsx)(`span`,{className:`text-[10px] font-cinzel uppercase opacity-75`,children:`Diff:`}),(0,Y.jsxs)(`select`,{value:j,onChange:e=>M(e.target.value),className:`bg-transparent border-none text-xs font-garamond font-bold cursor-pointer focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:`all`,className:`bg-stone-900 text-stone-200`,children:`All`}),(0,Y.jsx)(`option`,{value:`Easy`,className:`bg-stone-900 text-stone-200`,children:`Easy`}),(0,Y.jsx)(`option`,{value:`Medium`,className:`bg-stone-900 text-stone-200`,children:`Medium`}),(0,Y.jsx)(`option`,{value:`Hard`,className:`bg-stone-900 text-stone-200`,children:`Hard`})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1 rounded-lg border text-xs font-garamond font-semibold ${y?`bg-[#231e18] border-[#4a392b] text-stone-300`:`bg-[#fcf7ee] border-[#cfbc9c] text-stone-800`}`,children:[(0,Y.jsx)(n,{className:`w-3 h-3 text-amber-500`}),(0,Y.jsx)(`span`,{className:`text-[10px] font-cinzel uppercase opacity-75`,children:`Sort:`}),(0,Y.jsxs)(`select`,{value:N,onChange:e=>ee(e.target.value),className:`bg-transparent border-none text-xs font-garamond font-bold cursor-pointer focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:`sequence`,className:`bg-stone-900 text-stone-200`,children:`Track Sequence`}),(0,Y.jsx)(`option`,{value:`number_asc`,className:`bg-stone-900 text-stone-200`,children:`Problem # (Asc)`}),(0,Y.jsx)(`option`,{value:`number_desc`,className:`bg-stone-900 text-stone-200`,children:`Problem # (Desc)`}),(0,Y.jsx)(`option`,{value:`name`,className:`bg-stone-900 text-stone-200`,children:`Title (A-Z)`})]})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`font-garamond italic text-xs opacity-80`,children:[`Showing `,H.length,` of `,B]}),(0,Y.jsx)(`div`,{className:`w-20 sm:w-28 h-2 rounded-full bg-black/20 overflow-hidden border border-amber-900/20`,children:(0,Y.jsx)(`div`,{className:`h-full bg-gradient-to-r from-amber-500 to-emerald-500 transition-all duration-500`,style:{width:`${ce}%`}})}),(0,Y.jsxs)(`span`,{className:`font-cinzel text-[10px] font-bold text-emerald-600 dark:text-emerald-400`,children:[ce,`%`]})]})]})]})}),(0,Y.jsx)(`div`,{ref:R,className:`relative z-20 flex-1 overflow-y-auto px-4 py-4 custom-scrollbar`,children:(0,Y.jsx)(`div`,{className:`max-w-6xl mx-auto space-y-2.5 pb-8`,children:H.length===0?(0,Y.jsxs)(`div`,{className:`p-10 text-center rounded-2xl border-2 border-dashed my-8 transition-colors ${y?`border-amber-900/40 bg-[#1e1914]/60 text-stone-400`:`border-amber-900/20 bg-[#f9f2e3]/80 text-stone-600`}`,children:[(0,Y.jsx)(f,{className:`w-10 h-10 mx-auto mb-3 text-amber-500 opacity-60`}),(0,Y.jsx)(`h3`,{className:`font-cinzel font-bold text-base text-amber-700 dark:text-amber-400 mb-1`,children:`No Problems Found`}),(0,Y.jsxs)(`p`,{className:`font-garamond italic text-sm max-w-md mx-auto mb-4`,children:[`No problems matched "`,b||`the current filter settings`,`". Try adjusting your search keywords or filter criteria.`]}),(b||C!==`all`||E!==`all`||j!==`all`)&&(0,Y.jsx)(`button`,{onClick:()=>{S(``),T(`all`),D(`all`),M(`all`)},className:`px-4 py-1.5 rounded-xl bg-amber-600 hover:bg-amber-500 text-white font-cinzel text-xs font-bold transition-all shadow cursor-pointer`,children:`Clear All Filters`})]}):H.map(e=>{let n=a.has(e.id),i=e.sequenceIndex===t,o=te===e.id,c=I(e.id),l=c?.difficulty,d=c?.pattern;return(0,Y.jsxs)(`div`,{id:`problem-item-${e.sequenceIndex}`,className:`group relative rounded-xl border-2 transition-all duration-200 shadow-md ${i?y?`bg-[#2c2217] border-amber-500/80 shadow-amber-500/20 shadow-lg ring-1 ring-amber-500/40`:`bg-[#fffaf0] border-amber-700 shadow-amber-700/20 shadow-lg ring-1 ring-amber-700/30`:y?`bg-[#1f1a14]/90 border-[#4a392b] hover:border-amber-600/50 hover:bg-[#251f18]`:`bg-[#fcf8ef]/95 border-[#c8b28f] hover:border-amber-700/60 hover:bg-[#fcf5e6]`}`,children:[i&&(0,Y.jsxs)(`div`,{className:`absolute -top-2.5 left-4 px-2 py-0.5 rounded-md bg-amber-600 text-white font-cinzel text-[9px] font-bold tracking-wider uppercase flex items-center gap-1 shadow`,children:[(0,Y.jsx)(A,{className:`w-2.5 h-2.5 text-amber-200`}),`Current Problem`]}),(0,Y.jsxs)(`div`,{className:`p-3 sm:p-3.5 flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start sm:items-center gap-3 min-w-0 flex-1`,children:[(0,Y.jsx)(`button`,{onClick:()=>{s(e.id)},title:n?`Mark as Unsolved`:`Mark as Solved`,className:`mt-0.5 sm:mt-0 p-1 rounded-lg hover:bg-black/10 dark:hover:bg-white/10 transition-colors cursor-pointer shrink-0`,children:n?(0,Y.jsx)(_,{className:`w-5 h-5 text-emerald-500 transition-transform active:scale-125`}):(0,Y.jsx)(g,{className:`w-5 h-5 text-stone-400 hover:text-amber-600 transition-colors`})}),(0,Y.jsxs)(`div`,{className:`px-2 py-1 rounded-lg border font-cinzel text-[11px] font-bold text-center shrink-0 min-w-[54px] ${i?`bg-amber-500/20 border-amber-500 text-amber-500`:y?`bg-black/30 border-[#4a392b] text-stone-400`:`bg-amber-900/5 border-[#c8b28f] text-stone-600`}`,children:[(0,Y.jsx)(`span`,{className:`text-[9px] block uppercase opacity-75 leading-none`,children:`Seq`}),(0,Y.jsxs)(`span`,{children:[`#`,e.sequenceIndex+1]})]}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,Y.jsx)(`span`,{className:`px-1.5 py-0.5 rounded font-mono text-[10px] font-bold ${y?`bg-[#2d251d] text-amber-400 border border-amber-900/50`:`bg-amber-900/10 text-amber-900 border border-amber-900/20`}`,children:e.id>0?`LC #${e.id}`:`Custom`}),l&&(0,Y.jsx)(`span`,{className:`px-1.5 py-0.5 rounded font-cinzel text-[9px] font-bold uppercase tracking-wider border ${l===`Easy`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/30`:l===`Medium`?`bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/30`:`bg-rose-500/10 text-rose-600 dark:text-rose-400 border-rose-500/30`}`,children:l}),d&&(0,Y.jsx)(`span`,{className:`px-1.5 py-0.5 rounded font-cinzel text-[9px] font-medium border ${y?`bg-purple-950/30 text-purple-300 border-purple-800/40`:`bg-purple-50 text-purple-800 border-purple-200`}`,children:d}),(0,Y.jsx)(`h4`,{onClick:()=>{r(e.sequenceIndex),J.playNodeLightUp(e.sequenceIndex,B)},className:`font-garamond font-bold text-sm sm:text-base leading-tight truncate cursor-pointer hover:underline ${i?`text-amber-700 dark:text-amber-300 font-bold`:y?`text-stone-200 hover:text-amber-300`:`text-stone-900 hover:text-amber-800`}`,children:e.name}),n&&(0,Y.jsx)(`span`,{className:`text-[9px] font-cinzel font-bold px-1.5 py-0.5 rounded bg-emerald-500/15 text-emerald-600 dark:text-emerald-400 border border-emerald-500/30`,children:`✓ Solved`})]}),(c?.time_complexity||c?.space_complexity)&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap mt-1 text-[11px] font-mono`,children:[c.time_complexity&&(0,Y.jsxs)(`span`,{className:`opacity-80`,children:[`Time:`,` `,(0,Y.jsx)(`span`,{className:`text-amber-600 dark:text-amber-400 font-semibold`,children:c.time_complexity})]}),c.space_complexity&&(0,Y.jsxs)(`span`,{className:`opacity-80`,children:[`Space:`,` `,(0,Y.jsx)(`span`,{className:`text-purple-600 dark:text-purple-400 font-semibold`,children:c.space_complexity})]})]})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 self-end sm:self-center pl-10 sm:pl-0`,children:[(0,Y.jsxs)(`button`,{onClick:()=>{r(e.sequenceIndex),J.playNodeLightUp(e.sequenceIndex,B),u(e.sequenceIndex)},title:`View Problem on Hand-Drawn Map`,className:`flex items-center gap-1 px-2.5 py-1.5 rounded-lg border text-xs font-cinzel font-bold transition-all shadow-sm active:scale-95 cursor-pointer ${y?`bg-amber-500/15 border-amber-500/40 text-amber-300 hover:bg-amber-500/25`:`bg-amber-700/10 border-amber-700/30 text-amber-900 hover:bg-amber-700/20`}`,children:[(0,Y.jsx)(ie,{className:`w-3.5 h-3.5 text-amber-500`}),(0,Y.jsx)(`span`,{className:`hidden md:inline`,children:`Map`})]}),(0,Y.jsxs)(`button`,{onClick:()=>U(e),disabled:P===e.id,title:`Launch Spaced Repetition Review for this problem`,className:`flex items-center gap-1 px-2.5 py-1.5 rounded-lg bg-amber-600 hover:bg-amber-500 disabled:opacity-50 text-white text-xs font-cinzel font-bold shadow-sm transition-all active:scale-95 cursor-pointer`,children:[P===e.id?(0,Y.jsx)(w,{className:`w-3.5 h-3.5 animate-spin`}):(0,Y.jsx)(x,{className:`w-3.5 h-3.5`}),(0,Y.jsx)(`span`,{className:`hidden md:inline`,children:P===e.id?`Loading...`:`Review`})]}),(0,Y.jsx)(`a`,{href:c?.leetcode_url||(e.id>0?`https://leetcode.com/problemset/?search=${e.id}`:`https://www.google.com/search?q=${encodeURIComponent(e.name)}`),target:`_blank`,rel:`noreferrer`,title:`Open Problem on LeetCode`,className:`p-1.5 rounded-lg border transition-all cursor-pointer ${y?`border-stone-700 text-stone-400 hover:text-stone-200 hover:bg-white/5`:`border-stone-300 text-stone-600 hover:text-stone-900 hover:bg-black/5`}`,children:(0,Y.jsx)(v,{className:`w-3.5 h-3.5`})}),(0,Y.jsx)(`button`,{onClick:()=>{ne(o?null:e.id),o||r(e.sequenceIndex)},title:o?`Hide Problem Details`:`View Problem Details`,className:`p-1.5 rounded-lg border transition-all cursor-pointer ${o?`bg-amber-600/20 border-amber-500 text-amber-500`:y?`border-stone-700 text-stone-400 hover:text-stone-200`:`border-stone-300 text-stone-600 hover:text-stone-900`}`,children:o?(0,Y.jsx)(O,{className:`w-3.5 h-3.5`}):(0,Y.jsx)(p,{className:`w-3.5 h-3.5`})})]})]}),o&&(0,Y.jsx)(`div`,{className:`px-4 py-3 border-t text-xs font-garamond animate-fade-in ${y?`border-amber-900/40 bg-black/20 text-stone-300`:`border-amber-900/15 bg-amber-950/5 text-stone-700`}`,children:(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[c?.description?(0,Y.jsxs)(`div`,{className:`p-3 rounded border border-amber-900/20 bg-amber-900/5 dark:bg-black/30 font-sans text-xs sm:text-[13px] leading-relaxed whitespace-pre-line text-stone-700 dark:text-stone-300`,children:[(0,Y.jsx)(`div`,{className:`font-cinzel font-bold text-amber-600 dark:text-amber-400 text-[10px] uppercase mb-1 tracking-wider`,children:`Canonical Problem Description`}),c.description]}):(0,Y.jsx)(`p`,{className:`italic text-stone-500`,children:`Review this problem in CodeStudio to access the full starter code, test suites, and review queue.`}),c?.examples&&c.examples.length>0&&(0,Y.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Y.jsx)(`div`,{className:`font-cinzel font-bold text-amber-600 dark:text-amber-400 text-[10px] uppercase tracking-wider`,children:`Examples`}),(0,Y.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2`,children:c.examples.map((e,t)=>(0,Y.jsxs)(`div`,{className:`p-2.5 rounded border border-stone-300/40 dark:border-stone-700/50 bg-black/5 dark:bg-black/30 font-mono text-[11px] space-y-1`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-stone-500`,children:`Input: `}),(0,Y.jsx)(`span`,{className:`font-semibold text-amber-700 dark:text-amber-300`,children:e.input})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-stone-500`,children:`Output: `}),(0,Y.jsx)(`span`,{className:`font-semibold text-emerald-600 dark:text-emerald-400`,children:e.output})]}),e.explanation&&(0,Y.jsx)(`div`,{className:`text-[10px] text-stone-500 italic font-sans pt-0.5`,children:e.explanation})]},t))})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-4 text-[11px] pt-1 opacity-85 flex-wrap border-t border-stone-400/20 dark:border-stone-700/30`,children:[d&&(0,Y.jsxs)(`span`,{children:[`Pattern: `,(0,Y.jsx)(`strong`,{className:`font-cinzel text-amber-600 dark:text-amber-400`,children:d})]}),l&&(0,Y.jsxs)(`span`,{children:[`Difficulty: `,(0,Y.jsx)(`strong`,{children:l})]}),c?.time_complexity&&(0,Y.jsxs)(`span`,{children:[`Time: `,(0,Y.jsx)(`strong`,{className:`font-mono text-amber-600 dark:text-amber-400`,children:c.time_complexity})]}),c?.space_complexity&&(0,Y.jsxs)(`span`,{children:[`Space: `,(0,Y.jsx)(`strong`,{className:`font-mono text-purple-600 dark:text-purple-400`,children:c.space_complexity})]}),c?.constraints&&c.constraints.length>0&&(0,Y.jsxs)(`span`,{children:[`Constraints: `,(0,Y.jsx)(`strong`,{className:`font-mono text-[10px]`,children:c.constraints.join(` • `)})]})]})]})})]},e.id)})})})]})},Z=``;async function Q(e,t){if(!e.ok||!(e.headers.get(`content-type`)||``).includes(`application/json`))return t;try{return await e.json()}catch{return t}}function $({onSelectProblemForReview:e}){let[n,r]=(0,L.useState)(new Set),[i,a]=(0,L.useState)({}),[o,s]=(0,L.useState)([]),[l,d]=(0,L.useState)([]),[f,p]=(0,L.useState)(()=>localStorage.getItem(`algospaced_active_track`)||`leetcode-150`),[m,h]=(0,L.useState)(!0),[g,_]=(0,L.useState)(0),[v,y]=(0,L.useState)(null),[b,x]=(0,L.useState)([]),[S,C]=(0,L.useState)(!1),[T,E]=(0,L.useState)(!1),[D,O]=(0,L.useState)(`parchment`),[k,A]=(0,L.useState)(`map`),[j,M]=(0,L.useState)(!0),[ee,te]=(0,L.useState)(!0),[ne,re]=(0,L.useState)(!0),[ie,P]=(0,L.useState)(!1),[ae,oe]=(0,L.useState)(!1),[I,B]=(0,L.useState)(!1),[V,H]=(0,L.useState)(!0),U=le[D]||le.parchment,[W,G]=(0,L.useState)({x:0,y:0,scale:.5}),K=(0,L.useMemo)(()=>ce(o,i),[o,i]),q=K.length,X=g>=0&&g{J.setEnabled(j)},[j]);let ue=async()=>{try{let{data:{session:e}}=await F.auth.getSession(),t={Authorization:`Bearer ${e?e.access_token:`sandbox`}`},n=localStorage.getItem(`algospaced_active_track`)||`leetcode-150`,[i,o,c,l]=await Promise.all([fetch(`${Z}/api/journey-progress`,{headers:t}),fetch(`${Z}/api/journey-progress/titles`,{headers:t}),fetch(`${Z}/api/journey-progress/sequences`,{headers:t}),fetch(`${Z}/api/journey-progress/sequence/${n}`,{headers:t})]),[u,f,p,m]=await Promise.all([Q(i,[]),Q(o,{}),Q(c,[]),Q(l,[])]),h=new Set(u);r(h),a(f),d(p),s(m);let g=m.findIndex(e=>!h.has(e));_(g>=0?g:0)}catch(e){console.error(`Error fetching journey data:`,e)}finally{h(!1)}};(0,L.useEffect)(()=>{ue()},[]);let de=(0,L.useCallback)(async e=>{x([]),C(!0);try{let{data:{session:t}}=await F.auth.getSession(),n=t?t.access_token:`sandbox`,r=await Q(await fetch(`${Z}/api/reviews/problems/${e}`,{headers:{Authorization:`Bearer ${n}`}}),[]);x(r)}catch(e){console.error(`Error fetching problem details:`,e)}finally{C(!1)}},[]);(0,L.useEffect)(()=>{X&&de(X.id)},[X?.id,de]);let fe=async e=>{h(!0),p(e),localStorage.setItem(`algospaced_active_track`,e);try{let{data:{session:t}}=await F.auth.getSession(),r={Authorization:`Bearer ${t?t.access_token:`sandbox`}`},i=await Q(await fetch(`${Z}/api/journey-progress/sequence/${e}`,{headers:r}),[]);if(i.length>0){s(i);let e=i.findIndex(e=>!n.has(e));_(e>=0?e:0)}}catch(e){console.error(`Error switching track:`,e)}finally{h(!1)}},pe=(0,L.useCallback)(()=>{_(e=>{if(e{_(e=>e>0?(J.playPencilScratch(),e-1):0)},[]),he=(0,L.useCallback)(e=>{let t=Math.max(0,Math.min(q-1,e));_(t),J.playNodeLightUp(t,q),t===q-1&&J.playVictoryChime()},[q]),ge=(0,L.useCallback)(()=>{_(0),J.playPencilScratch()},[]),xe=async e=>{E(!0);try{let{data:{session:t}}=await F.auth.getSession(),i=t?t.access_token:`sandbox`;if((await fetch(`${Z}/api/journey-progress/toggle`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${i}`},body:JSON.stringify({problem_number:e})})).ok){let t=new Set(n);t.has(e)?(t.delete(e),J.playPencilScratch()):(t.add(e),J.playNodeLightUp(g,q),o.every(e=>t.has(e))&&(J.playVictoryChime(),se({particleCount:130,spread:85,origin:{y:.6},colors:[`#10b981`,`#34d399`,`#f59e0b`,`#ffffff`]}),B(!0))),r(t)}}catch(e){console.error(`Error toggling progress:`,e)}finally{E(!1)}};(0,L.useEffect)(()=>{let e=e=>{let t=e.target;[`INPUT`,`TEXTAREA`,`SELECT`].includes(t?.tagName)||t?.isContentEditable||k===`map`&&(e.code===`Space`||e.code===`ArrowRight`||e.code===`ArrowDown`?(e.preventDefault(),pe()):e.code===`ArrowLeft`||e.code===`ArrowUp`?(e.preventDefault(),me()):e.code===`KeyR`&&(e.preventDefault(),ge()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[pe,me,ge,k]);let $=(0,L.useRef)(null),Ce=(0,L.useCallback)(()=>{let e=$.current?.clientWidth||window.innerWidth,t=$.current?.clientHeight||window.innerHeight,n=e/2,r=t/2;G(e=>{let t=Math.min(e.scale*1.25,3.5);return{scale:t,x:n-(n-e.x)/e.scale*t,y:r-(r-e.y)/e.scale*t}})},[]),we=(0,L.useCallback)(()=>{let e=$.current?.clientWidth||window.innerWidth,t=$.current?.clientHeight||window.innerHeight,n=e/2,r=t/2;G(e=>{let t=Math.max(e.scale*.8,.08);return{scale:t,x:n-(n-e.x)/e.scale*t,y:r-(r-e.y)/e.scale*t}})},[]),Te=(0,L.useCallback)(()=>{let e=$.current?.clientWidth||window.innerWidth,t=$.current?.clientHeight||window.innerHeight,n=e/R,r=t/z,i=Math.min(n,r)*.9;G({x:(e-R*i)/2,y:(t-z*i)/2,scale:i})},[]),Ee=(0,L.useCallback)(()=>{if(!X)return;let e=$.current?.clientWidth||window.innerWidth,t=$.current?.clientHeight||window.innerHeight,n=Math.max(W.scale,.95);G({x:e/2-X.x*n,y:t/2-X.y*n,scale:n})},[X,W.scale]),De=(0,L.useCallback)(e=>{if(A(`map`),typeof e==`number`&&e>=0&&eA(`map`),title:`Hand-Drawn Cartography Map`,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg font-cinzel text-xs font-bold transition-all cursor-pointer ${k===`map`?`bg-amber-600 text-white shadow-sm`:Oe?`text-stone-400 hover:text-stone-200`:`text-stone-600 hover:text-stone-900`}`,children:[(0,Y.jsx)(c,{className:`w-3.5 h-3.5`}),(0,Y.jsx)(`span`,{children:`Map`})]}),(0,Y.jsxs)(`button`,{id:`view-mode-list-btn`,onClick:()=>A(`list`),title:`Problem List View`,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg font-cinzel text-xs font-bold transition-all cursor-pointer ${k===`list`?`bg-amber-600 text-white shadow-sm`:Oe?`text-stone-400 hover:text-stone-200`:`text-stone-600 hover:text-stone-900`}`,children:[(0,Y.jsx)(u,{className:`w-3.5 h-3.5`}),(0,Y.jsx)(`span`,{children:`List`})]})]}),k===`map`&&(0,Y.jsxs)(`button`,{id:`toggle-journal-btn`,onClick:()=>H(e=>!e),title:`Toggle Explorer Field Notes Journal`,className:`flex items-center gap-1.5 px-3 py-2 rounded-xl border-2 shadow-lg backdrop-blur-md font-cinzel text-xs font-bold transition-all cursor-pointer ${V?`bg-amber-600 border-amber-400 text-white`:Oe?`bg-[#1a1612]/90 border-[#4a392b] text-[#e2d5c2]`:`bg-[#f7efe0]/95 border-[#c8b28f] text-[#332415]`}`,children:[(0,Y.jsx)(t,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:`Journal`})]})]})]}),k===`map`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`main`,{ref:$,className:`relative flex-1 w-full h-full`,children:[(0,Y.jsx)(_e,{nodes:K,activeNodeIndex:g,completions:n,theme:U,showLabels:ne,showGrid:ie,showNodeNumbers:ae,autoCenterOnActive:ee,onNodeClick:he,hoveredNodeIndex:v,setHoveredNodeIndex:y,transform:W,setTransform:G}),V&&(0,Y.jsx)(`aside`,{className:`absolute top-16 left-2.5 z-30 w-72 md:w-84 pointer-events-auto transition-all animate-fade-in`,children:(0,Y.jsx)(ye,{node:X,activeNodeIndex:g,totalNodes:q,theme:U,onAdvance:pe,onRetreat:me,details:b,modalLoading:S,isCompleted:X?n.has(X.id):!1,toggleLoading:T,onToggleCompletion:xe,onSelectProblemForReview:e})})]}),(0,Y.jsx)(`footer`,{className:`absolute bottom-2.5 left-2.5 right-2.5 z-30 pointer-events-auto max-w-5xl mx-auto w-[calc(100%-1.25rem)]`,children:(0,Y.jsx)(ve,{theme:U,soundEnabled:j,autoCenterOnActive:ee,showLabels:ne,showGrid:ie,showNodeNumbers:ae,tracks:l,activeTrack:f,onTrackChange:fe,onToggleSound:()=>M(e=>!e),onToggleAutoCenter:()=>te(e=>!e),onToggleLabels:()=>re(e=>!e),onToggleGrid:()=>P(e=>!e),onToggleNodeNumbers:()=>oe(e=>!e),onToggleTheme:()=>O(e=>e===`parchment`?`dark_parchment`:`parchment`),onZoomIn:Ce,onZoomOut:we,onResetZoom:Te,onCenterActiveNode:Ee})})]}):(0,Y.jsx)(`main`,{className:`relative flex-1 w-full h-full overflow-hidden`,children:(0,Y.jsx)(Se,{nodes:K,activeNodeIndex:g,setActiveNodeIndex:_,completions:n,theme:U,onToggleCompletion:xe,onSelectProblemForReview:e,onSwitchToMap:De,tracks:l,activeTrack:f,onTrackChange:fe,onToggleTheme:()=>O(e=>e===`parchment`?`dark_parchment`:`parchment`)})}),(0,Y.jsx)(be,{isOpen:I,onClose:()=>B(!1),nodes:K,theme:U,onReset:ge})]})}export{$ as default}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/JourneyPath-DO-UXRtH.js b/algospaced-ui/dist/assets/JourneyPath-DO-UXRtH.js deleted file mode 100644 index 6e320ad264248acc4fcd0047c18ed89eec0299e8..0000000000000000000000000000000000000000 --- a/algospaced-ui/dist/assets/JourneyPath-DO-UXRtH.js +++ /dev/null @@ -1,65 +0,0 @@ -import{r as e}from"./rolldown-runtime-hePW80VL.js";import{A as t,B as n,C as r,D as i,F as a,G as o,J as s,Lt as c,O as l,Q as u,R as d,W as f,_t as p,a as m,b as h,c as g,ft as _,g as v,gt as y,h as b,ht as x,i as S,it as C,l as w,lt as T,m as E,o as D,pt as O,s as k,tt as A,u as j,ut as M,vt as ee,w as te,wt as ne,y as re,yt as ie,z as ae,zt as N}from"./vendor-react-qmUj3JUi.js";import{r as P}from"./firebaseClient-G7klkuBb.js";import{a as oe,c as se,o as F}from"./index-DYMSjoUb.js";import{t as ce}from"./confetti.module-Uxh4CK4s.js";var I=e(N(),1),L=2600,R=1500,z=[{tMax:.15,name:`The Whispering Coast & Lowlands`,biome:`coast`},{tMax:.32,name:`The Elderwood Deep Forest`,biome:`forest`},{tMax:.48,name:`River Elden & The Twin Fords`,biome:`river`},{tMax:.68,name:`The Dragon Tooth Mountains & Passes`,biome:`mountain`},{tMax:.83,name:`The Misty Glade & Highland Woods`,biome:`forest`},{tMax:.93,name:`The Roaring Gorge & Cataracts`,biome:`river`},{tMax:1,name:`The Sunstone Peaks & Ancient Citadel`,biome:`ancient_ruins`}],B=[`Pencil marks still visible from the cartographer’s first survey.`,`A calm breeze sweeps through the grass, carrying the scent of pine.`,`Wooden planks creak underfoot as the river roars below.`,`Craggy pencil hatchings reveal steep, unforgiving granite slopes.`,`Ancient roots break through the worn gravel pathway.`,`The sound of rushing water echoes across the canyon walls.`,`A solitary stone marker inscribed with early explorer symbols.`,`Golden light filters softly through the sketched canopy.`,`Distant mountain ridges frame the expanding horizon.`,`A tranquil haven where wanderers rest before the mountain climb.`];function le(e=[],t={}){let n=[],r=e.length>0?e.length:150,i=[{t:0,x:220,y:1320,elev:10},{t:.08,x:380,y:1140,elev:45},{t:.16,x:580,y:980,elev:120},{t:.24,x:820,y:1120,elev:90},{t:.32,x:940,y:860,elev:180},{t:.4,x:720,y:640,elev:320},{t:.48,x:1050,y:520,elev:580},{t:.56,x:1320,y:720,elev:890},{t:.64,x:1540,y:480,elev:1250},{t:.72,x:1780,y:680,elev:920},{t:.8,x:1980,y:920,elev:460},{t:.88,x:2220,y:760,elev:750},{t:.94,x:2180,y:480,elev:1180},{t:1,x:2420,y:240,elev:1620}];for(let a=0;a1?a/(r-1):0,s=0;for(;so<=e.tMax)||z[z.length-1],D=e.length>0?e[a]:a+1,O=t[D]||(D<0?`Custom Challenge ${a+1}`:`LeetCode #${D}`),k=B[a%B.length];n.push({id:D,sequenceIndex:a,x,y:S,name:O,biome:E.biome,regionName:E.name,elevation:Math.max(10,T),lore:k})}return n}var V=[{id:`wm-bg1`,x:380,y:310,size:70,height:85,ridgeShift:-4,hasSnow:!1,layer:0,elevation:840,rangeName:`Western Crags`},{id:`wm-bg2`,x:490,y:280,size:85,height:105,ridgeShift:6,hasSnow:!0,layer:0,elevation:1120,name:`Peak of the North Wind`,rangeName:`Western Crags`},{id:`wm-bg3`,x:620,y:300,size:75,height:95,ridgeShift:-3,hasSnow:!1,layer:0,elevation:960,rangeName:`Western Crags`},{id:`wm-bg4`,x:730,y:320,size:65,height:80,ridgeShift:4,hasSnow:!1,layer:0,elevation:780,rangeName:`Western Crags`},{id:`m1`,x:430,y:375,size:80,height:105,ridgeShift:5,hasSnow:!0,elevation:1240,name:`Crag of the Mist`,rangeName:`Western Crags`},{id:`m2`,x:530,y:345,size:95,height:125,ridgeShift:-7,hasSnow:!0,elevation:1480,name:`Peak of Solitude`,rangeName:`Western Crags`},{id:`m3`,x:630,y:365,size:85,height:110,ridgeShift:3,hasSnow:!0,elevation:1310,name:`Shadowhorn`,rangeName:`Western Crags`},{id:`m4`,x:720,y:385,size:70,height:90,ridgeShift:-4,hasSnow:!1,elevation:990,rangeName:`Western Crags`},{id:`m5`,x:370,y:430,size:55,height:65,ridgeShift:4,hasSnow:!1,layer:2,elevation:620,rangeName:`Western Crags`},{id:`m6`,x:470,y:425,size:68,height:80,ridgeShift:-3,hasSnow:!1,layer:2,elevation:760,name:`Gullwing Bluff`,rangeName:`Western Crags`},{id:`m6b`,x:575,y:420,size:72,height:88,ridgeShift:3,hasSnow:!1,layer:2,elevation:850,rangeName:`Western Crags`},{id:`m6c`,x:670,y:435,size:58,height:70,ridgeShift:-2,hasSnow:!1,layer:2,elevation:680,rangeName:`Western Crags`},{id:`dt-bg1`,x:1130,y:260,size:90,height:120,ridgeShift:-6,hasSnow:!0,layer:0,elevation:1850,rangeName:`Dragon's Tooth Range`},{id:`dt-bg2`,x:1250,y:225,size:115,height:150,ridgeShift:8,hasSnow:!0,layer:0,elevation:2180,name:`Crown of the North`,rangeName:`Dragon's Tooth Range`},{id:`dt-bg3`,x:1380,y:210,size:130,height:175,ridgeShift:-10,hasSnow:!0,layer:0,elevation:2450,name:`Apex of Clouds`,rangeName:`Dragon's Tooth Range`},{id:`dt-bg4`,x:1510,y:240,size:110,height:145,ridgeShift:7,hasSnow:!0,layer:0,elevation:2020,rangeName:`Dragon's Tooth Range`},{id:`dt-bg5`,x:1640,y:280,size:90,height:115,ridgeShift:-5,hasSnow:!0,layer:0,elevation:1690,rangeName:`Dragon's Tooth Range`},{id:`m7`,x:1190,y:325,size:105,height:140,ridgeShift:-8,hasSnow:!0,elevation:1980,name:`The Dragon's Crest`,rangeName:`Dragon's Tooth Range`},{id:`m8`,x:1310,y:295,size:125,height:165,ridgeShift:10,hasSnow:!0,elevation:2360,name:`Frostcrag Pinnacle`,rangeName:`Dragon's Tooth Range`},{id:`m9`,x:1435,y:320,size:115,height:150,ridgeShift:-6,hasSnow:!0,elevation:2120,name:`Thunderhorn Peak`,rangeName:`Dragon's Tooth Range`},{id:`m10`,x:1560,y:355,size:98,height:125,ridgeShift:7,hasSnow:!0,elevation:1780,name:`Screaming Ridge`,rangeName:`Dragon's Tooth Range`},{id:`m10b`,x:1680,y:375,size:85,height:105,ridgeShift:-4,hasSnow:!1,elevation:1420,rangeName:`Dragon's Tooth Range`},{id:`m11`,x:1260,y:415,size:90,height:115,ridgeShift:-5,hasSnow:!0,elevation:1560,name:`Ironhorn Needle`,rangeName:`Dragon's Tooth Range`},{id:`m12`,x:1375,y:405,size:100,height:130,ridgeShift:6,hasSnow:!0,elevation:1720,name:`Shadowcrevasse Crag`,rangeName:`Dragon's Tooth Range`},{id:`m13`,x:1490,y:440,size:88,height:110,ridgeShift:-4,hasSnow:!0,elevation:1490,rangeName:`Dragon's Tooth Range`},{id:`m14`,x:1610,y:435,size:82,height:100,ridgeShift:5,hasSnow:!1,elevation:1320,rangeName:`Dragon's Tooth Range`},{id:`m15`,x:1160,y:590,size:80,height:100,ridgeShift:5,hasSnow:!1,elevation:1180,name:`Wanderer's Bluff`,rangeName:`Mid-Pass Gorge`},{id:`m16`,x:1390,y:610,size:90,height:115,ridgeShift:-6,hasSnow:!0,elevation:1390,name:`Eagle Eye Ridge`,rangeName:`Mid-Pass Gorge`},{id:`m17`,x:1510,y:585,size:95,height:120,ridgeShift:5,hasSnow:!0,elevation:1520,name:`Razorback Spine`,rangeName:`Mid-Pass Gorge`},{id:`m18`,x:1630,y:565,size:85,height:105,ridgeShift:-4,hasSnow:!1,elevation:1280,rangeName:`Mid-Pass Gorge`},{id:`m18b`,x:1740,y:580,size:75,height:90,ridgeShift:3,hasSnow:!1,elevation:1050,rangeName:`Mid-Pass Gorge`},{id:`es-bg1`,x:1980,y:310,size:88,height:115,ridgeShift:-5,hasSnow:!0,layer:0,elevation:1650,rangeName:`Sunstone Highlands`},{id:`es-bg2`,x:2110,y:245,size:105,height:140,ridgeShift:6,hasSnow:!0,layer:0,elevation:1980,name:`Sun Pillar`,rangeName:`Sunstone Highlands`},{id:`es-bg3`,x:2260,y:160,size:135,height:180,ridgeShift:-8,hasSnow:!0,layer:0,elevation:2580,name:`Crown of the Heavens`,rangeName:`Sunstone Highlands`},{id:`es-bg4`,x:2410,y:210,size:115,height:150,ridgeShift:7,hasSnow:!0,layer:0,elevation:2240,rangeName:`Sunstone Highlands`},{id:`m19`,x:2040,y:375,size:98,height:128,ridgeShift:6,hasSnow:!0,elevation:1720,name:`Sunstone Spire`,rangeName:`Sunstone Highlands`},{id:`m20`,x:2170,y:315,size:115,height:150,ridgeShift:-7,hasSnow:!0,elevation:2080,name:`Sanctuary Peak`,rangeName:`Sunstone Highlands`},{id:`m21`,x:2310,y:220,size:130,height:170,ridgeShift:8,hasSnow:!0,elevation:2390,name:`Pinnacle of the Ancients`,rangeName:`Sunstone Highlands`},{id:`m22`,x:2440,y:360,size:90,height:115,ridgeShift:-5,hasSnow:!0,elevation:1610,name:`Falcon Perch`,rangeName:`Sunstone Highlands`},{id:`m23`,x:2260,y:405,size:82,height:98,ridgeShift:4,hasSnow:!1,elevation:1250,name:`Altar Crag`,rangeName:`Sunstone Highlands`},{id:`m24`,x:2380,y:420,size:76,height:88,ridgeShift:-3,hasSnow:!1,elevation:1120,rangeName:`Sunstone Highlands`},{id:`m25`,x:2140,y:450,size:70,height:80,ridgeShift:3,hasSnow:!1,elevation:980,rangeName:`Sunstone Highlands`}],H=[{id:`river-elden`,name:`River Elden`,d:`M 1340,290 C 1310,380 1260,460 1210,540 C 1140,640 1020,700 960,820 C 900,940 930,1060 880,1180 C 840,1280 760,1360 690,1480`,width:14,hasBridges:[{x:945,y:855,angle:-35},{x:890,y:1160,angle:25}]},{id:`river-silver`,name:`Silver Meander`,d:`M 580,410 C 650,490 730,550 780,660 C 830,760 910,810 960,820`,width:8,hasBridges:[{x:740,y:620,angle:45}]},{id:`river-cataract`,name:`Highland Torrent`,d:`M 2150,320 C 2100,450 2050,600 2020,760 C 1990,920 1920,1050 1840,1180 C 1760,1310 1710,1420 1660,1500`,width:11,hasBridges:[{x:2010,y:810,angle:-20}]}],U=[{id:`f1`,name:`The Whispering Pines`,cx:580,cy:1040,rx:230,ry:160,treeCount:42,trees:W(580,1040,210,140,42,`pines`)},{id:`f2`,name:`Elderwood Deep`,cx:820,cy:1140,rx:250,ry:180,treeCount:52,trees:W(820,1140,230,160,52,`oaks`)},{id:`f3`,name:`Mistwood Valley`,cx:860,cy:620,rx:190,ry:140,treeCount:36,trees:W(860,620,170,120,36,`willows`)},{id:`f4`,name:`Highland Spruces`,cx:1760,cy:740,rx:210,ry:155,treeCount:38,trees:W(1760,740,190,135,38,`highland_spruce`)},{id:`f5`,name:`Verdant Basin`,cx:1960,cy:980,rx:200,ry:150,treeCount:38,trees:W(1960,980,180,130,38,`mixed`)},{id:`f6`,name:`Shadowglen Copse`,cx:390,cy:690,rx:140,ry:100,treeCount:22,trees:W(390,690,120,80,22,`pines`)},{id:`f7`,name:`Sunstone Grove`,cx:2360,cy:580,rx:150,ry:110,treeCount:24,trees:W(2360,580,130,90,24,`mixed`)}];function W(e,t,n,r,i,a){let o=[];for(let s=0;s{setTimeout(()=>{if(!this.ctx)return;let t=this.ctx.currentTime,n=this.ctx.createOscillator(),r=this.ctx.createGain();n.type=`sine`,n.frequency.setValueAtTime(e,t),r.gain.setValueAtTime(.001,t),r.gain.linearRampToValueAtTime(.15,t+.05),r.gain.exponentialRampToValueAtTime(1e-4,t+1.2),n.connect(r),r.connect(this.ctx.destination),n.start(t),n.stop(t+1.3)},t*120)}))}},J=c();function Y(e){let t=Math.sin(e*12.9898+78.233)*43758.5453;return t-Math.floor(t)}var de=({mountain:e,theme:t})=>{let n=t.id!==`parchment`,r=t.pencilColor,i=t.pencilShade,{id:a,x:o,y:s,size:c,height:l,ridgeShift:u=0,hasSnow:d=l>95}=e,f=(0,I.useMemo)(()=>{let e=0;for(let t=0;t.65?l*.04:0;f.push({x:Math.round(o+u),y:Math.round(s+d)})}let p=[];for(let r=1;r<=6;r++){let a=r/6,o=t+(i-t)*a,s=n+l*a,u=(Y(e+r*43)-.48)*(c*.14)*Math.sin(a*Math.PI),d=Y(e+r*59)>.65?l*.04:0;p.push({x:Math.round(o+u),y:Math.round(s+d)})}let m=[{x:t,y:n}];for(let r=1;r<=7;r++){let i=r/7,a=t+(o+u*.25+(Y(e+101)-.5)*(c*.15)-t)*i**1.2,s=n+l*i,d=Math.sin(i*Math.PI*2.2+Y(e+113))*(c*.1);m.push({x:Math.round(a+d),y:Math.round(s)})}let h=[],g=m[Math.min(m.length-1,2)];if(g){let t=o+c*.55+(Y(e+201)-.5)*15,n=s-l*.12,r=(g.x+t)/2+12,i=(g.y+n)/2-6;h.push({d:`M ${g.x},${g.y} Q ${r},${i} ${t},${n}`,side:`right`})}let _=m[Math.min(m.length-1,5)];if(_){let t=o+c*.85+(Y(e+209)-.5)*15,n=s,r=(_.x+t)/2+10,i=(_.y+n)/2-4;h.push({d:`M ${_.x},${_.y} Q ${r},${i} ${t},${n}`,side:`right`})}let v=m[Math.min(m.length-1,3)];if(v){let t=o-c*.6+(Y(e+301)-.5)*15,n=s-l*.15,r=(v.x+t)/2-10,i=(v.y+n)/2-5;h.push({d:`M ${v.x},${v.y} Q ${r},${i} ${t},${n}`,side:`left`})}let y=[],b=Math.max(14,Math.round(l/4.8));for(let r=1;r<=b;r++){let a=r/(b+1),o=m[Math.min(m.length-1,Math.max(0,Math.round(a*(m.length-1))))],s=n+l*a,c=p[Math.min(p.length-1,Math.max(0,Math.round(a*(p.length-1))))]||{x:t+(i-t)*a,y:s},u=o.x+(c.x-o.x)*.08,d=s+(Y(e+r*71)-.5)*3,f=r%3==0?.92:r%2==0?.75:.6,h=u+(c.x-u)*f,g=d+((s-n)*.22+(c.y-s)*.35)+(Y(e+r*83)-.5)*4;y.push({x1:Math.round(u),y1:Math.round(d),x2:Math.round(h),y2:Math.round(g),width:r<4?.9:1.25,opacity:r<3?.6:.85}),r>4&&r%2==0&&y.push({x1:Math.round(u+(h-u)*.3),y1:Math.round(d+(g-d)*.3),x2:Math.round(u+(h-u)*.75),y2:Math.round(d+(g-d)*.15),width:.75,opacity:.55})}let x=[],S=Math.max(4,Math.round(l/18));for(let i=1;i<=S;i++){let a=(i+.3)/(S+1),o=n+l*a,s=m[Math.min(m.length-1,Math.round(a*(m.length-1)))],c=f[Math.min(f.length-1,Math.round(a*(f.length-1)))]||{x:t-(t-r)*a,y:o},u=s.x-(s.x-c.x)*.25,d=o+2,p=s.x-(s.x-c.x)*(.6+Y(e+i*97)*.3),h=o+8+Y(e+i*103)*6,g=(u+p)/2-4,_=(d+h)/2+3;if(x.push({d:`M ${Math.round(u)},${Math.round(d)} Q ${Math.round(g)},${Math.round(_)} ${Math.round(p)},${Math.round(h)}`,width:.9}),i%2==1){let e=u-6,t=d+3;x.push({d:`M ${Math.round(e)},${Math.round(t)} L ${Math.round(e-8)},${Math.round(t+10)}`,width:.75})}}let C=``,w=``;if(d){let e=n+l*.32,a=t-(t-r)*.32,o=t+(i-t)*.32,s=m[Math.min(m.length-1,2)]||{x:t,y:e},c={x:t-(t-r)*.16,y:e-4},u={x:t-(t-r)*.26,y:e+6},d={x:t+(i-t)*.14,y:e+3},h={x:t+(i-t)*.24,y:e-2};C=`M ${t},${n} - L ${f[1].x},${f[1].y} - L ${a},${e} - Q ${u.x},${u.y} ${c.x},${c.y} - L ${s.x},${s.y} - Q ${d.x},${d.y} ${h.x},${h.y} - L ${o},${e} - L ${p[1].x},${p[1].y} - Z`,w=`M ${t},${n} - L ${s.x},${s.y} - Q ${d.x},${d.y} ${h.x},${h.y} - L ${o},${e} - L ${p[1].x},${p[1].y} - Z`}let T=[],E=[],D=Math.round(c/8);for(let t=0;tt===0?`M ${e.x},${e.y}`:`L ${e.x},${e.y}`).join(` `),k=p.map(e=>`L ${e.x},${e.y}`).join(` `),A=m.map((e,t)=>t===0?`M ${e.x},${e.y}`:`L ${e.x},${e.y}`).join(` `),j=`${O} ${k} Z`,M=p[p.length-1];return{peakX:t,peakY:n,leftX:r,rightX:i,fullPerimeterPath:j,shadedFacePath:`${A} L ${M.x},${M.y} ${p.slice().reverse().map(e=>`L ${e.x},${e.y}`).join(` `)} Z`,ridgePathStr:A,spurs:h,hachures:y,westStrata:x,snowCapPath:C,snowShadePath:w,screeStipples:T,screeLines:E}},[a,o,s,c,l,u,d]),p=n?`#231d17`:`#ded1b4`,m=n?`#1c1712`:`#cdbe9e`,h=n?`#ddd4c5`:`#fcfbf7`,g=n?`#a89c89`:`#e4d8c3`;return(0,J.jsxs)(`g`,{id:`mountain-${a}`,className:`realistic-mountain-group transition-all duration-300 select-none`,children:[(0,J.jsx)(`path`,{d:f.fullPerimeterPath,fill:p,stroke:r,strokeWidth:`1.8`,strokeLinejoin:`round`,strokeLinecap:`round`}),(0,J.jsx)(`path`,{d:f.shadedFacePath,fill:m,opacity:n?.7:.55}),d&&f.snowCapPath&&(0,J.jsxs)(`g`,{id:`snowcap-${a}`,children:[(0,J.jsx)(`path`,{d:f.snowCapPath,fill:h,stroke:r,strokeWidth:`1.1`,strokeLinejoin:`round`,opacity:n?.85:.95}),f.snowShadePath&&(0,J.jsx)(`path`,{d:f.snowShadePath,fill:g,opacity:.65})]}),(0,J.jsx)(`g`,{id:`strata-${a}`,stroke:r,strokeLinecap:`round`,opacity:n?.65:.75,children:f.westStrata.map((e,t)=>(0,J.jsx)(`path`,{d:e.d,fill:`none`,strokeWidth:e.width},t))}),(0,J.jsx)(`g`,{id:`hachures-${a}`,stroke:i,strokeLinecap:`round`,children:f.hachures.map((e,t)=>(0,J.jsx)(`line`,{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,strokeWidth:e.width,opacity:e.opacity},t))}),(0,J.jsx)(`g`,{id:`spurs-${a}`,children:f.spurs.map((e,t)=>(0,J.jsx)(`path`,{d:e.d,fill:`none`,stroke:e.side===`right`?r:i,strokeWidth:e.side===`right`?1.6:1.2,strokeLinecap:`round`,opacity:.85},t))}),(0,J.jsx)(`path`,{d:f.ridgePathStr,fill:`none`,stroke:r,strokeWidth:`2.4`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,J.jsxs)(`g`,{id:`scree-${a}`,fill:r,stroke:i,opacity:n?.45:.6,children:[f.screeStipples.map((e,t)=>(0,J.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r},t)),f.screeLines.map((e,t)=>(0,J.jsx)(`line`,{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,strokeWidth:`0.8`,strokeLinecap:`round`},t))]})]})},fe=({tree:e,theme:t})=>{let{x:n,y:r,scale:i=1,type:a=`pine`}=e,o=t.id!==`parchment`,s=t.pencilColor,c=t.pencilShade,l=o?`#1e281c`:`#d8d4bf`,u=o?`#242a1e`:`#ded6bf`,d=o?`#2e251d`:`#cca98a`,f=o?`#1f2920`:`#d5dcc2`,p=o?`#293222`:`#e2dbcb`;return(0,J.jsx)(`g`,{id:`tree-${n}-${r}`,className:`realistic-tree`,children:(()=>{switch(a){case`pine`:case`spruce`:{let e=a===`spruce`?14:17,t=a===`spruce`?32:28;return(0,J.jsxs)(`g`,{transform:`translate(${n}, ${r}) scale(${i})`,children:[(0,J.jsx)(`ellipse`,{cx:`1`,cy:`2`,rx:e*.75,ry:`3`,fill:s,opacity:o?.25:.2}),(0,J.jsx)(`path`,{d:`M -1.8,2 L -1,-6 L 1,-6 L 1.8,2 Z`,fill:d,stroke:s,strokeWidth:`1.1`,strokeLinejoin:`round`}),(0,J.jsx)(`path`,{d:`M 0,-10 - Q ${e*.55},-7 ${e*.95},-3 - Q ${e*.6},0 0, -2 - Q ${-e*.6},0 ${-e*.95},-3 - Q ${-e*.55},-7 0,-10 Z`,fill:l,stroke:s,strokeWidth:`1.2`,strokeLinejoin:`round`}),(0,J.jsx)(`path`,{d:`M 1,-6 Q ${e*.5},-4 ${e*.85},-3 Q ${e*.4},-1 0,-2 Z`,fill:s,opacity:o?.4:.3}),(0,J.jsx)(`line`,{x1:`2`,y1:`-7`,x2:e*.75,y2:`-4`,stroke:c,strokeWidth:`0.8`}),(0,J.jsx)(`line`,{x1:`1`,y1:`-4`,x2:e*.65,y2:`-2`,stroke:c,strokeWidth:`0.8`}),(0,J.jsx)(`path`,{d:`M 0,-18 - Q ${e*.45},-15 ${e*.8},-11 - Q ${e*.5},-8 0, -10 - Q ${-e*.5},-8 ${-e*.8},-11 - Q ${-e*.45},-15 0,-18 Z`,fill:l,stroke:s,strokeWidth:`1.2`,strokeLinejoin:`round`}),(0,J.jsx)(`path`,{d:`M 1,-14 Q ${e*.45},-12 ${e*.7},-11 Q ${e*.35},-9 0,-10 Z`,fill:s,opacity:o?.4:.3}),(0,J.jsx)(`line`,{x1:`1`,y1:`-15`,x2:e*.6,y2:`-12`,stroke:c,strokeWidth:`0.8`}),(0,J.jsx)(`path`,{d:`M 0,-25 - Q ${e*.35},-22 ${e*.55},-18 - Q ${e*.3},-16 0, -17 - Q ${-e*.3},-16 ${-e*.55},-18 - Q ${-e*.35},-22 0,-25 Z`,fill:l,stroke:s,strokeWidth:`1.1`,strokeLinejoin:`round`}),(0,J.jsx)(`path`,{d:`M 0,-${t} L ${e*.35},-${t-9} Q 0,-${t-8} -${e*.35},-${t-9} Z`,fill:l,stroke:s,strokeWidth:`1.1`,strokeLinejoin:`round`}),(0,J.jsx)(`path`,{d:`M 0,-${t} L ${e*.35},-${t-9} Q 0,-${t-8} 0,-${t-9} Z`,fill:s,opacity:o?.4:.35}),(0,J.jsx)(`path`,{d:`M -5,1 L -3,3 M 3,2 L 5,0 M -1,3 L 0,1`,stroke:s,strokeWidth:`0.8`,strokeLinecap:`round`})]})}case`ancient_oak`:case`oak`:{let e=a===`ancient_oak`,t=e?22:18,l=e?24:20;return(0,J.jsxs)(`g`,{transform:`translate(${n}, ${r}) scale(${i})`,children:[(0,J.jsx)(`ellipse`,{cx:`2`,cy:`2`,rx:t*.8,ry:`4`,fill:s,opacity:o?.3:.22}),(0,J.jsx)(`path`,{d:`M -4,2 Q -3,-4 -2,-8 Q -6,-12 -8,-14 M 4,2 Q 3,-4 2,-8 Q 6,-12 9,-13 M -1,-8 L 0,-15`,fill:`none`,stroke:s,strokeWidth:`1.8`,strokeLinecap:`round`}),(0,J.jsx)(`path`,{d:`M -3.5,2 L -1.5,-8 L 1.5,-8 L 3.5,2 Z`,fill:d,stroke:s,strokeWidth:`1`}),(0,J.jsx)(`line`,{x1:`-0.8`,y1:`0`,x2:`-0.8`,y2:`-6`,stroke:c,strokeWidth:`0.75`}),(0,J.jsx)(`line`,{x1:`0.8`,y1:`1`,x2:`0.8`,y2:`-5`,stroke:c,strokeWidth:`0.75`}),(0,J.jsx)(`ellipse`,{cx:`6`,cy:`-14`,rx:t*.45,ry:l*.4,fill:s,opacity:.25}),(0,J.jsx)(`ellipse`,{cx:`2`,cy:`-8`,rx:t*.55,ry:l*.35,fill:s,opacity:.25}),(0,J.jsx)(`path`,{d:`M -${t*.85},-10 - C -${t*1.05},-16 -${t*.8},-23 -${t*.45},-24 - C -${t*.25},-30 ${t*.35},-31 ${t*.65},-25 - C ${t*1.05},-24 ${t*1.15},-16 ${t*.9},-10 - C ${t*1.05},-4 ${t*.65},0 0,-1 - C -${t*.55},0 -${t*.95},-4 -${t*.85},-10 Z`,fill:u,stroke:s,strokeWidth:`1.35`,strokeLinejoin:`round`}),(0,J.jsx)(`path`,{d:`M -${t*.5},-18 Q -${t*.2},-24 ${t*.2},-22 Q ${t*.45},-18 ${t*.3},-14`,fill:`none`,stroke:s,strokeWidth:`1`}),(0,J.jsx)(`path`,{d:`M 1,-12 Q ${t*.5},-15 ${t*.8},-9 Q ${t*.45},-4 1,-6`,fill:s,opacity:o?.35:.28}),(0,J.jsx)(`path`,{d:`M -${t*.65},-10 Q -${t*.3},-13 -${t*.1},-8`,fill:`none`,stroke:s,strokeWidth:`1`}),(0,J.jsx)(`line`,{x1:t*.15,y1:`-17`,x2:t*.55,y2:`-14`,stroke:c,strokeWidth:`0.8`}),(0,J.jsx)(`line`,{x1:t*.25,y1:`-12`,x2:t*.7,y2:`-9`,stroke:c,strokeWidth:`0.8`}),(0,J.jsx)(`line`,{x1:t*.1,y1:`-7`,x2:t*.55,y2:`-4`,stroke:c,strokeWidth:`0.8`}),(0,J.jsx)(`path`,{d:`M -6,1 L -3,2 M 3,2 L 6,1 M -2,3 L -1,1 M 2,3 L 1,1`,stroke:s,strokeWidth:`0.9`,strokeLinecap:`round`})]})}case`willow`:return(0,J.jsxs)(`g`,{transform:`translate(${n}, ${r}) scale(${i})`,children:[(0,J.jsx)(`ellipse`,{cx:`1`,cy:`2`,rx:14.4,ry:`3.5`,fill:s,opacity:o?.28:.2}),(0,J.jsx)(`path`,{d:`M -3,2 Q -1,-4 -2,-9 Q -5,-14 -7,-17 M 3,2 Q 2,-4 3,-9 Q 5,-14 8,-16`,fill:`none`,stroke:s,strokeWidth:`1.6`,strokeLinecap:`round`}),(0,J.jsx)(`path`,{d:`M -2.5,2 L -1.5,-9 L 2,-9 L 2.5,2 Z`,fill:d,stroke:s,strokeWidth:`0.9`}),(0,J.jsx)(`path`,{d:`M -${18*.85},-12 - C -${18*.95},-20 -9,-27 0,-26 - C 9,-27 ${18*.95},-20 ${18*.85},-12 - C ${18*.6},-7 0,-8 -${18*.85},-12 Z`,fill:f,stroke:s,strokeWidth:`1.2`,strokeLinejoin:`round`}),(0,J.jsx)(`path`,{d:`M -13.5,-12 Q -${18*.85},-4 -12.6,0 M -9.9,-14 Q -${18*.65},-3 -8.1,1 M -6.3,-15 Q -8.1,-1 -4.5,2`,fill:`none`,stroke:s,strokeWidth:`1.1`,strokeLinecap:`round`}),(0,J.jsx)(`path`,{d:`M -${18*.15},-16 Q -${18*.15},-2 0,1 M 1.8,-16 Q ${18*.15},-3 3.6,0`,fill:`none`,stroke:s,strokeWidth:`1.1`,strokeLinecap:`round`}),(0,J.jsx)(`path`,{d:`M 6.3,-15 Q 9,-2 7.2,2 M ${18*.6},-14 Q 13.5,-2 ${18*.65},1 M ${18*.78},-12 Q 16.2,-3 14.4,0`,fill:`none`,stroke:s,strokeWidth:`1.2`,strokeLinecap:`round`}),(0,J.jsx)(`path`,{d:`M 1,-23 Q ${18*.6},-20 13.5,-12 Q 7.2,-10 0,-14 Z`,fill:s,opacity:o?.35:.25}),(0,J.jsx)(`path`,{d:`M -7,2 Q -5,-2 -4,0 M -5,2 Q -3,-3 -2,0 M 4,2 Q 6,-2 7,0 M 6,2 Q 8,-1 9,1`,stroke:s,strokeWidth:`0.8`,fill:`none`})]});default:return(0,J.jsxs)(`g`,{transform:`translate(${n}, ${r}) scale(${i})`,children:[(0,J.jsx)(`ellipse`,{cx:`1`,cy:`2`,rx:12*.6,ry:`3`,fill:s,opacity:.25}),(0,J.jsx)(`path`,{d:`M -1.2,2 L -0.6,-16 L 0.6,-16 L 1.2,2 Z`,fill:d,stroke:s,strokeWidth:`1`}),(0,J.jsx)(`line`,{x1:`-1`,y1:`-4`,x2:`0`,y2:`-4`,stroke:s,strokeWidth:`0.9`}),(0,J.jsx)(`line`,{x1:`0`,y1:`-8`,x2:`1`,y2:`-8`,stroke:s,strokeWidth:`0.9`}),(0,J.jsx)(`line`,{x1:`-0.8`,y1:`-12`,x2:`0.2`,y2:`-12`,stroke:s,strokeWidth:`0.9`}),(0,J.jsx)(`path`,{d:`M 0,-26 - C ${12*.7},-22 ${12*.8},-10.4 5.4,-5.2 - C 0,-3.9 -5.4,-5.2 -${12*.8},-10.4 - C -${12*.8},-10.4 -${12*.7},-22 0,-26 Z`,fill:p,stroke:s,strokeWidth:`1.2`,strokeLinejoin:`round`}),(0,J.jsx)(`path`,{d:`M 0,-26 C ${12*.7},-22 ${12*.8},-10.4 5.4,-5.2 C 0,-3.9 0,-10.4 0,-26 Z`,fill:s,opacity:o?.35:.25}),(0,J.jsx)(`line`,{x1:`1`,y1:`-16`,x2:12*.55,y2:`-13`,stroke:c,strokeWidth:`0.8`}),(0,J.jsx)(`line`,{x1:`1`,y1:`-10`,x2:6,y2:`-7`,stroke:c,strokeWidth:`0.8`}),(0,J.jsx)(`line`,{x1:`-3`,y1:`2`,x2:`-1`,y2:`0`,stroke:s,strokeWidth:`0.8`}),(0,J.jsx)(`line`,{x1:`2`,y1:`2`,x2:`4`,y2:`0`,stroke:s,strokeWidth:`0.8`})]})}})()})},pe=({river:e,theme:t,showLabels:n})=>{let r=t.id!==`parchment`,i=t.pencilColor,a=t.riverColor,o=(0,I.useMemo)(()=>e.id===`river-elden`?{riverPoly:`M 1340,290 - C 1318,375 1272,455 1222,535 - C 1152,635 1032,695 972,815 - C 910,935 942,1055 892,1175 - C 850,1275 770,1355 695,1480 - L 670,1480 - C 745,1355 825,1275 865,1175 - C 915,1055 885,935 945,815 - C 1005,695 1125,635 1195,535 - C 1245,455 1295,375 1335,290 - Z`,leftBank:`M 1335,290 C 1295,375 1245,455 1195,535 C 1125,635 1005,695 945,815 C 885,935 915,1055 865,1175 C 825,1275 745,1355 670,1480`,rightBank:`M 1345,290 C 1320,375 1275,455 1225,535 C 1155,635 1035,695 975,815 C 915,935 945,1055 895,1175 C 855,1275 775,1355 700,1480`,labelPos:{x:1040,y:980,rot:-55},islands:[{cx:960,cy:960,rx:14,ry:7,angle:-45,name:`Elden Ait`},{cx:770,cy:1330,rx:18,ry:8,angle:-50,name:`Otter Shoal`}],waterfall:{x:1215,y:540,width:32,height:24,angle:-38,name:`The Elden Cascades`},rapids:[{x:1140,y:660,angle:-40},{x:920,y:1020,angle:60}],sandbars:[{cx:995,cy:750,rx:12,ry:5,angle:30},{cx:900,cy:1110,rx:14,ry:6,angle:-25}],bridges:e.hasBridges||[{x:945,y:855,angle:-35,type:`stone_arch`,name:`Highbridge`},{x:890,y:1160,angle:25,type:`timber_trestle`,name:`Lower Toll Bridge`}]}:e.id===`river-silver`?{riverPoly:`M 580,410 - C 650,488 730,548 780,658 - C 830,758 910,808 960,818 - L 960,824 - C 908,814 828,764 778,664 - C 728,554 648,494 578,414 - Z`,leftBank:`M 578,412 C 648,492 728,552 778,662 C 828,762 908,812 958,822`,rightBank:`M 582,408 C 652,488 732,548 782,658 C 832,758 912,808 962,818`,labelPos:{x:740,y:710,rot:35},islands:[{cx:710,cy:535,rx:10,ry:5,angle:35,name:`Willow Islet`}],waterfall:{x:620,y:450,width:22,height:18,angle:45,name:`Silver Falls`},rapids:[{x:810,y:710,angle:50}],sandbars:[{cx:755,cy:610,rx:9,ry:4,angle:40}],bridges:e.hasBridges||[{x:740,y:620,angle:45,type:`stone_arch`,name:`Silver Arch`}]}:{riverPoly:`M 2150,320 - C 2100,450 2050,600 2020,760 - C 1990,920 1920,1050 1840,1180 - C 1760,1310 1710,1420 1660,1500 - L 1640,1500 - C 1690,1420 1740,1310 1820,1180 - C 1900,1050 1970,920 2000,760 - C 2030,600 2080,450 2130,320 - Z`,leftBank:`M 2130,320 C 2080,450 2030,600 2000,760 C 1970,920 1900,1050 1820,1180 C 1740,1310 1690,1420 1640,1500`,rightBank:`M 2150,320 C 2100,450 2050,600 2020,760 C 1990,920 1920,1050 1840,1180 C 1760,1310 1710,1420 1660,1500`,labelPos:{x:1920,y:1080,rot:-65},islands:[{cx:1890,cy:1100,rx:12,ry:6,angle:-60,name:`Crag Islet`}],waterfall:{x:2070,y:520,width:28,height:22,angle:-30,name:`The Great Cataract`},rapids:[{x:1980,y:880,angle:-65}],sandbars:[{cx:1950,cy:980,rx:11,ry:5,angle:-55}],bridges:e.hasBridges||[{x:2010,y:810,angle:-20,type:`stone_arch`,name:`Highland Span`}]},[e.id,e.hasBridges]),s=a,c=r?`#3d3425`:`#e6dcbf`,l=r?`#263422`:`#d2d8ba`;return(0,J.jsxs)(`g`,{id:`realistic-${e.id}`,className:`realistic-river-group select-none`,children:[(0,J.jsx)(`path`,{d:o.riverPoly,fill:s,opacity:.88}),(0,J.jsx)(`path`,{d:o.leftBank,fill:`none`,stroke:i,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,J.jsx)(`path`,{d:o.rightBank,fill:`none`,stroke:i,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,J.jsx)(`path`,{d:o.leftBank,fill:`none`,stroke:r?`#e0d2bd`:`#ffffff`,strokeWidth:`0.8`,strokeDasharray:`14 18 8 22`,opacity:.65,transform:`translate(-2, -1)`}),(0,J.jsx)(`path`,{d:o.rightBank,fill:`none`,stroke:r?`#e0d2bd`:`#ffffff`,strokeWidth:`0.8`,strokeDasharray:`16 20 10 24`,opacity:.65,transform:`translate(2, 1)`}),(0,J.jsx)(`path`,{d:e.d,fill:`none`,stroke:r?`#5a4632`:`#7d6952`,strokeWidth:`1.2`,strokeDasharray:`24 32 14 36`,strokeLinecap:`round`,opacity:.7}),(0,J.jsx)(`path`,{d:e.d,fill:`none`,stroke:r?`#e8dcbe`:`#ffffff`,strokeWidth:`0.8`,strokeDasharray:`10 40 18 35`,strokeLinecap:`round`,opacity:.6,transform:`translate(1.5, -1)`}),o.sandbars.map((e,t)=>(0,J.jsxs)(`g`,{transform:`translate(${e.cx}, ${e.cy}) rotate(${e.angle})`,children:[(0,J.jsx)(`ellipse`,{cx:`0`,cy:`0`,rx:e.rx,ry:e.ry,fill:c,stroke:i,strokeWidth:`1`}),(0,J.jsx)(`circle`,{cx:`-3`,cy:`-1`,r:`0.6`,fill:i}),(0,J.jsx)(`circle`,{cx:`2`,cy:`1`,r:`0.7`,fill:i}),(0,J.jsx)(`circle`,{cx:`0`,cy:`0`,r:`0.5`,fill:i})]},t)),o.rapids.map((e,t)=>(0,J.jsxs)(`g`,{transform:`translate(${e.x}, ${e.y}) rotate(${e.angle})`,children:[(0,J.jsx)(`path`,{d:`M -12,-6 Q -6,-8 0,-6 Q 6,-4 12,-6 M -10,0 Q -4,-2 2,0 Q 8,2 10,0 M -8,6 Q -2,4 4,6`,fill:`none`,stroke:r?`#f4eedd`:`#ffffff`,strokeWidth:`1.4`,strokeLinecap:`round`,opacity:.9}),(0,J.jsx)(`circle`,{cx:`-5`,cy:`-2`,r:`1.8`,fill:r?`#2e251b`:`#6b5742`,stroke:i,strokeWidth:`0.8`}),(0,J.jsx)(`circle`,{cx:`6`,cy:`3`,r:`1.5`,fill:r?`#2e251b`:`#6b5742`,stroke:i,strokeWidth:`0.8`})]},t)),o.islands.map((e,a)=>(0,J.jsxs)(`g`,{transform:`translate(${e.cx}, ${e.cy}) rotate(${e.angle})`,children:[(0,J.jsx)(`ellipse`,{cx:`0`,cy:`0`,rx:e.rx,ry:e.ry,fill:l,stroke:i,strokeWidth:`1.4`}),(0,J.jsx)(`path`,{d:`M -${e.rx},0 Q -${e.rx+8},-2 -${e.rx+14},0 Q -${e.rx+8},2 -${e.rx},0`,fill:c,stroke:i,strokeWidth:`0.9`}),(0,J.jsx)(`g`,{transform:`scale(${e.rx>15?.6:.45})`,children:(0,J.jsx)(fe,{tree:{x:0,y:-1,scale:.65,type:`willow`,seed:a*99+42},theme:t})}),n&&e.name&&e.rx>13&&(0,J.jsx)(`text`,{x:`0`,y:e.ry+10,textAnchor:`middle`,fill:r?`#d4bfa1`:`#57422f`,className:`font-garamond italic text-[10px] font-semibold select-none`,children:e.name})]},a)),o.waterfall&&(0,J.jsxs)(`g`,{id:`waterfall-${e.id}`,transform:`translate(${o.waterfall.x}, ${o.waterfall.y}) rotate(${o.waterfall.angle})`,children:[(0,J.jsx)(`rect`,{x:-o.waterfall.width/2,y:`-4`,width:o.waterfall.width,height:`6`,rx:`2`,fill:r?`#2e251b`:`#6b5742`,stroke:i,strokeWidth:`1.4`}),(0,J.jsxs)(`g`,{stroke:r?`#f4eedd`:`#ffffff`,strokeWidth:`1.2`,opacity:.95,children:[(0,J.jsx)(`line`,{x1:-o.waterfall.width*.4,y1:`2`,x2:-o.waterfall.width*.4,y2:o.waterfall.height}),(0,J.jsx)(`line`,{x1:-o.waterfall.width*.2,y1:`2`,x2:-o.waterfall.width*.2,y2:o.waterfall.height+2,strokeWidth:`1.5`}),(0,J.jsx)(`line`,{x1:`0`,y1:`2`,x2:`0`,y2:o.waterfall.height+3,strokeWidth:`1.6`}),(0,J.jsx)(`line`,{x1:o.waterfall.width*.2,y1:`2`,x2:o.waterfall.width*.2,y2:o.waterfall.height+2,strokeWidth:`1.5`}),(0,J.jsx)(`line`,{x1:o.waterfall.width*.4,y1:`2`,x2:o.waterfall.width*.4,y2:o.waterfall.height})]}),(0,J.jsx)(`ellipse`,{cx:`0`,cy:o.waterfall.height+4,rx:o.waterfall.width*.65,ry:`6`,fill:`none`,stroke:r?`#f4eedd`:`#ffffff`,strokeWidth:`1.2`,strokeDasharray:`4 3 6 2`,opacity:.9}),n&&o.waterfall.name&&(0,J.jsxs)(`text`,{x:`0`,y:-10,textAnchor:`middle`,fill:r?`#e4caa0`:`#4a3420`,className:`font-cinzel text-[11px] font-bold tracking-wider select-none drop-shadow-sm`,children:[`❖ `,o.waterfall.name,` ❖`]})]}),o.bridges.map((t,a)=>(0,J.jsxs)(`g`,{id:`bridge-${e.id}-${a}`,transform:`translate(${t.x}, ${t.y}) rotate(${t.angle})`,children:[(0,J.jsx)(`rect`,{x:`-24`,y:`-10`,width:`8`,height:`20`,rx:`1`,fill:r?`#2e251b`:`#9c876b`,stroke:i,strokeWidth:`1.2`}),(0,J.jsx)(`rect`,{x:`16`,y:`-10`,width:`8`,height:`20`,rx:`1`,fill:r?`#2e251b`:`#9c876b`,stroke:i,strokeWidth:`1.2`}),(0,J.jsx)(`rect`,{x:`-20`,y:`-8`,width:`40`,height:`16`,rx:`2`,fill:r?`#3d3126`:`#d8c7a8`,stroke:i,strokeWidth:`1.8`}),(0,J.jsx)(`line`,{x1:`-20`,y1:`-8`,x2:`20`,y2:`-8`,stroke:i,strokeWidth:`1.4`}),(0,J.jsx)(`line`,{x1:`-20`,y1:`8`,x2:`20`,y2:`8`,stroke:i,strokeWidth:`1.4`}),(0,J.jsx)(`line`,{x1:`-12`,y1:`-8`,x2:`-12`,y2:`8`,stroke:i,strokeWidth:`1`}),(0,J.jsx)(`line`,{x1:`-6`,y1:`-8`,x2:`-6`,y2:`8`,stroke:i,strokeWidth:`1.1`}),(0,J.jsx)(`line`,{x1:`0`,y1:`-8`,x2:`0`,y2:`8`,stroke:i,strokeWidth:`1.5`}),(0,J.jsx)(`line`,{x1:`6`,y1:`-8`,x2:`6`,y2:`8`,stroke:i,strokeWidth:`1.1`}),(0,J.jsx)(`line`,{x1:`12`,y1:`-8`,x2:`12`,y2:`8`,stroke:i,strokeWidth:`1`}),(0,J.jsx)(`path`,{d:`M 0,-8 L -4,-13 L 4,-13 Z`,fill:r?`#2e251b`:`#9c876b`,stroke:i,strokeWidth:`1`}),(0,J.jsx)(`path`,{d:`M -6,-14 Q 0,-18 6,-14`,fill:`none`,stroke:r?`#f4eedd`:`#ffffff`,strokeWidth:`0.8`,opacity:.8}),n&&t.name&&(0,J.jsx)(`text`,{x:`0`,y:`18`,textAnchor:`middle`,fill:r?`#d4bfa1`:`#4a3726`,className:`font-garamond italic text-[10px] font-semibold select-none`,children:t.name})]},a)),n&&(0,J.jsxs)(`text`,{x:o.labelPos.x,y:o.labelPos.y,fill:r?`#e4caa0`:`#4a3420`,className:`font-cinzel italic text-[15px] font-bold tracking-widest select-none drop-shadow-sm`,opacity:.9,transform:`rotate(${o.labelPos.rot} ${o.labelPos.x} ${o.labelPos.y})`,children:[`~ `,e.name,` ~`]})]})},me=({forest:e,theme:t,showLabels:n})=>{let r=t.id!==`parchment`,i=t.pencilColor,a=t.pencilShade,{id:o,name:s,cx:c,cy:l,rx:u,ry:d,trees:f}=e,p=(0,I.useMemo)(()=>[...f].sort((e,t)=>e.y-t.y),[f]),m=(0,I.useMemo)(()=>{let e=[],t=[],n=[],r=c*13+l*19;for(let i=0;i<6;i++){let a=(i*1.8+r*.1)%(Math.PI*2),o=c+u*.7*Math.cos(a),s=l+d*.7*Math.sin(a);i%2==0?e.push({x:Math.round(o),y:Math.round(s),rx:5+i%3*2,ry:3+i%2*1.5,angle:i*35%60-30}):t.push({x:Math.round(o),y:Math.round(s),length:12+i%4*3,angle:i*45%90-45}),n.push({x:Math.round(c+Math.cos(a+.5)*(u*.5)),y:Math.round(l+Math.sin(a+.5)*(d*.5))})}return{boulders:e,fallenLogs:t,fernClusters:n}},[c,l,u,d]),h=(0,I.useMemo)(()=>{let e=[];for(let t=0;t<16;t++){let n=t/16*Math.PI*2,r=1+Math.sin(n*4+c*.05)*.08+Math.cos(n*3+l*.05)*.06,i=c+u*r*Math.cos(n),a=l+d*r*Math.sin(n);e.push({x:Math.round(i),y:Math.round(a)})}return e.map((e,t)=>t===0?`M ${e.x},${e.y}`:`L ${e.x},${e.y}`).join(` `)+` Z`},[c,l,u,d]);return(0,J.jsxs)(`g`,{id:`forest-zone-${o}`,className:`realistic-forest-group select-none`,children:[(0,J.jsx)(`path`,{d:h,fill:r?`rgba(32, 42, 26, 0.35)`:`rgba(195, 208, 175, 0.22)`,stroke:a,strokeWidth:`0.85`,strokeDasharray:`5 7 2 7`,opacity:.8}),(0,J.jsx)(`g`,{id:`boulders-${o}`,stroke:i,strokeWidth:`1`,children:m.boulders.map((e,t)=>(0,J.jsxs)(`g`,{transform:`translate(${e.x}, ${e.y}) rotate(${e.angle})`,children:[(0,J.jsx)(`ellipse`,{cx:`0`,cy:`0`,rx:e.rx,ry:e.ry,fill:r?`#2b241c`:`#c4b69c`}),(0,J.jsx)(`path`,{d:`M 0,-${e.ry} Q ${e.rx*.6},0 0,${e.ry} Q ${e.rx*.2},0 0,-${e.ry}`,fill:i,opacity:.3})]},t))}),(0,J.jsx)(`g`,{id:`logs-${o}`,stroke:i,strokeWidth:`1.2`,children:m.fallenLogs.map((e,t)=>(0,J.jsxs)(`g`,{transform:`translate(${e.x}, ${e.y}) rotate(${e.angle})`,children:[(0,J.jsx)(`line`,{x1:-e.length/2,y1:`0`,x2:e.length/2,y2:`0`,strokeLinecap:`round`,strokeWidth:`2.2`}),(0,J.jsx)(`circle`,{cx:-e.length/2,cy:`0`,r:`1.2`,fill:i}),(0,J.jsx)(`circle`,{cx:`2`,cy:`-1.5`,r:`0.8`,fill:r?`#d4bfa1`:`#f0e6d2`})]},t))}),(0,J.jsx)(`g`,{id:`ferns-${o}`,stroke:a,strokeWidth:`0.8`,fill:`none`,children:m.fernClusters.map((e,t)=>(0,J.jsx)(`g`,{transform:`translate(${e.x}, ${e.y})`,children:(0,J.jsx)(`path`,{d:`M 0,0 Q -4,-5 -7,-4 M 0,0 Q -2,-7 -2,-10 M 0,0 Q 3,-6 6,-4`})},t))}),(0,J.jsx)(`g`,{id:`trees-${o}`,children:p.map((e,n)=>(0,J.jsx)(fe,{tree:e,theme:t},n))}),n&&s&&(0,J.jsxs)(`g`,{transform:`translate(${c}, ${l-d-12})`,children:[(0,J.jsx)(`rect`,{x:`-90`,y:`-14`,width:`180`,height:`18`,rx:`3`,fill:r?`#1a1510`:`#f2e8d3`,stroke:a,strokeWidth:`0.75`,opacity:.85}),(0,J.jsxs)(`text`,{x:`0`,y:`0`,textAnchor:`middle`,fill:r?`#d8c2a3`:`#453525`,className:`font-garamond italic font-bold text-[13px] tracking-widest select-none drop-shadow-sm`,children:[`❖ `,s,` ❖`]})]})]})},he=({theme:e,showLabels:t,finalNode:n})=>{let r=e.id!==`parchment`,i=e.pencilColor,a=e.pencilShade,o=e.riverColor,s=(0,I.useMemo)(()=>[...V].sort((e,t)=>{let n=e.layer??1,r=t.layer??1;return n===r?e.y-t.y:n-r}),[]);return(0,J.jsxs)(`g`,{id:`terrain-layer`,className:`select-none pointer-events-none`,children:[(0,J.jsxs)(`g`,{id:`rhumb-lines`,opacity:r?.08:.12,stroke:i,strokeWidth:`0.8`,strokeDasharray:`6 8`,children:[(0,J.jsx)(`line`,{x1:`0`,y1:`0`,x2:`2600`,y2:`1500`}),(0,J.jsx)(`line`,{x1:`0`,y1:`1500`,x2:`2600`,y2:`0`}),(0,J.jsx)(`line`,{x1:`1300`,y1:`0`,x2:`1300`,y2:`1500`}),(0,J.jsx)(`line`,{x1:`0`,y1:`750`,x2:`2600`,y2:`750`}),(0,J.jsx)(`circle`,{cx:`500`,cy:`400`,r:`300`,fill:`none`,strokeWidth:`0.5`}),(0,J.jsx)(`circle`,{cx:`2100`,cy:`1100`,r:`350`,fill:`none`,strokeWidth:`0.5`}),(0,J.jsx)(`circle`,{cx:`1300`,cy:`750`,r:`450`,fill:`none`,strokeWidth:`0.6`,strokeDasharray:`3 6`})]}),(0,J.jsxs)(`g`,{id:`coastlines`,stroke:i,children:[(0,J.jsx)(`path`,{d:`M 0,1180 Q 140,1220 200,1320 T 320,1500`,fill:`none`,strokeWidth:`2.5`,strokeLinecap:`round`}),(0,J.jsx)(`path`,{d:`M 0,1200 Q 150,1240 215,1340 T 340,1500`,fill:`none`,strokeWidth:`1.2`,strokeDasharray:`12 8 4 8`,opacity:.65}),(0,J.jsx)(`path`,{d:`M 0,1225 Q 160,1265 230,1365 T 365,1500`,fill:`none`,strokeWidth:`0.8`,strokeDasharray:`6 10`,opacity:.4}),(0,J.jsxs)(`g`,{id:`islands`,strokeWidth:`1.5`,children:[(0,J.jsx)(`path`,{d:`M 80,1390 Q 110,1370 140,1395 Q 120,1420 80,1390 Z`,fill:r?`#231d17`:`#e6d8be`}),(0,J.jsx)(`path`,{d:`M 160,1440 Q 185,1425 210,1445 Q 190,1465 160,1440 Z`,fill:r?`#231d17`:`#e6d8be`}),(0,J.jsx)(`line`,{x1:`105`,y1:`1385`,x2:`110`,y2:`1375`,strokeWidth:`1`}),(0,J.jsx)(`line`,{x1:`115`,y1:`1388`,x2:`122`,y2:`1378`,strokeWidth:`1`})]})]}),(0,J.jsx)(`g`,{id:`rivers-layer`,children:H.map(n=>(0,J.jsx)(pe,{river:n,theme:e,showLabels:t},n.id))}),(0,J.jsx)(`g`,{id:`forests-layer`,children:U.map(n=>(0,J.jsx)(me,{forest:n,theme:e,showLabels:t},n.id))}),(0,J.jsxs)(`g`,{id:`mountains-layer`,children:[(0,J.jsxs)(`g`,{id:`distant-mountain-ridgelines`,opacity:r?.35:.45,stroke:a,fill:`none`,children:[(0,J.jsx)(`path`,{d:`M 330,330 Q 380,290 440,310 T 540,280 T 650,300 T 760,330`,strokeWidth:`1.2`,strokeDasharray:`4 4`}),(0,J.jsx)(`path`,{d:`M 1080,270 Q 1190,210 1310,195 T 1450,220 T 1580,245 T 1720,290`,strokeWidth:`1.4`,strokeDasharray:`5 4`}),(0,J.jsx)(`path`,{d:`M 1940,320 Q 2060,240 2200,180 T 2350,150 T 2480,230`,strokeWidth:`1.4`,strokeDasharray:`5 4`})]}),(0,J.jsxs)(`g`,{id:`alpine-tarns`,children:[(0,J.jsxs)(`g`,{id:`tarn-dragons-eye`,children:[(0,J.jsx)(`ellipse`,{cx:`1350`,cy:`365`,rx:`22`,ry:`12`,fill:o,stroke:i,strokeWidth:`1.4`,opacity:.9}),(0,J.jsx)(`path`,{d:`M 1335,363 Q 1350,361 1365,363 M 1340,367 Q 1350,369 1360,367`,stroke:r?`#e0d2bd`:`#ffffff`,strokeWidth:`0.8`,fill:`none`,opacity:.7}),(0,J.jsx)(`path`,{d:`M 1350,377 Q 1345,395 1335,410 T 1320,430`,fill:`none`,stroke:o,strokeWidth:`2`,strokeDasharray:`3 2`,opacity:.8}),t&&(0,J.jsx)(`text`,{x:`1350`,y:`350`,textAnchor:`middle`,fill:r?`#c5b597`:`#57422f`,className:`font-garamond italic text-[11px] font-semibold select-none`,children:`Dragon's Eye Tarn`})]}),(0,J.jsxs)(`g`,{id:`tarn-sunstone`,children:[(0,J.jsx)(`ellipse`,{cx:`2210`,cy:`275`,rx:`18`,ry:`10`,fill:o,stroke:i,strokeWidth:`1.3`,opacity:.9}),(0,J.jsx)(`path`,{d:`M 2198,274 Q 2210,272 2222,274`,stroke:r?`#e0d2bd`:`#ffffff`,strokeWidth:`0.75`,fill:`none`,opacity:.7})]}),(0,J.jsx)(`g`,{id:`tarn-mistwood`,children:(0,J.jsx)(`ellipse`,{cx:`585`,cy:`395`,rx:`16`,ry:`9`,fill:o,stroke:i,strokeWidth:`1.2`,opacity:.9})})]}),s.map(t=>(0,J.jsx)(de,{mountain:t,theme:e},t.id)),t&&(0,J.jsxs)(`g`,{id:`mountain-range-banners`,className:`select-none pointer-events-none`,children:[(0,J.jsx)(`text`,{x:`1380`,y:`180`,textAnchor:`middle`,fill:r?`#e4caa0`:`#4a3420`,className:`font-cinzel-dec font-bold text-[18px] tracking-widest drop-shadow-sm`,opacity:.9,children:`❖ THE DRAGON TOOTH MOUNTAINS ❖`}),(0,J.jsx)(`text`,{x:`530`,y:`255`,textAnchor:`middle`,fill:r?`#d0b996`:`#523c28`,className:`font-cinzel font-bold text-[14px] tracking-widest`,opacity:.85,children:`~ THE WESTERN CRAGS ~`}),(0,J.jsx)(`text`,{x:`2260`,y:`135`,textAnchor:`middle`,fill:r?`#e4caa0`:`#4a3420`,className:`font-cinzel-dec font-bold text-[16px] tracking-widest drop-shadow-sm`,opacity:.9,children:`❖ SUNSTONE CITADEL PEAKS ❖`})]})]}),(0,J.jsxs)(`g`,{id:`sea-monsters`,opacity:r?.7:.85,children:[(0,J.jsxs)(`g`,{transform:`translate(140, 1260) scale(0.85)`,stroke:i,fill:`none`,children:[(0,J.jsx)(`path`,{d:`M 10,20 Q 30,-15 50,20 Q 70,-20 90,20 Q 110,-10 125,20`,strokeWidth:`2.2`,strokeLinecap:`round`}),(0,J.jsx)(`path`,{d:`M 10,20 Q -5,10 0,-5 Q 10,-15 18,-5 Q 12,5 10,20 Z`,strokeWidth:`2`,fill:r?`#231e18`:`#e0d3b6`}),(0,J.jsx)(`circle`,{cx:`6`,cy:`-6`,r:`1.5`,fill:i}),(0,J.jsx)(`path`,{d:`M -2,-4 L -10,-7 L -7,-3`,strokeWidth:`1.2`,strokeLinecap:`round`}),(0,J.jsx)(`line`,{x1:`30`,y1:`-8`,x2:`33`,y2:`-18`,strokeWidth:`1.5`}),(0,J.jsx)(`line`,{x1:`70`,y1:`-12`,x2:`73`,y2:`-22`,strokeWidth:`1.5`}),(0,J.jsx)(`line`,{x1:`108`,y1:`-4`,x2:`111`,y2:`-14`,strokeWidth:`1.5`}),(0,J.jsx)(`path`,{d:`M -15,22 Q 30,28 70,22 Q 110,28 145,22`,strokeWidth:`1.2`,strokeDasharray:`4 6`}),t&&(0,J.jsx)(`text`,{x:`70`,y:`44`,textAnchor:`middle`,fill:r?`#a89476`:`#6b543b`,className:`font-garamond italic text-[12px]`,children:`"Hic Sunt Dracones"`})]}),(0,J.jsxs)(`g`,{transform:`translate(360, 1420) scale(0.65)`,stroke:i,fill:`none`,children:[(0,J.jsx)(`path`,{d:`M -30,10 Q 0,16 35,10 Q 40,0 30,-5 L -35,-5 Q -40,0 -30,10 Z`,strokeWidth:`1.8`,fill:r?`#2a221b`:`#ded1b4`}),(0,J.jsx)(`line`,{x1:`-15`,y1:`-5`,x2:`-15`,y2:`-45`,strokeWidth:`1.8`}),(0,J.jsx)(`line`,{x1:`10`,y1:`-5`,x2:`10`,y2:`-52`,strokeWidth:`1.8`}),(0,J.jsx)(`line`,{x1:`28`,y1:`-5`,x2:`28`,y2:`-36`,strokeWidth:`1.4`}),(0,J.jsx)(`path`,{d:`M -28,-38 Q -15,-44 -2,-38 Q -15,-26 -28,-38 Z`,strokeWidth:`1.3`,fill:r?`#3d3429`:`#f0e6ce`}),(0,J.jsx)(`path`,{d:`M -4,-44 Q 10,-50 24,-44 Q 10,-32 -4,-44 Z`,strokeWidth:`1.3`,fill:r?`#3d3429`:`#f0e6ce`}),(0,J.jsx)(`path`,{d:`M -4,-28 Q 10,-34 24,-28 Q 10,-18 -4,-28 Z`,strokeWidth:`1.3`,fill:r?`#3d3429`:`#f0e6ce`}),(0,J.jsx)(`line`,{x1:`-15`,y1:`-45`,x2:`-35`,y2:`-5`,strokeWidth:`0.8`,strokeDasharray:`3 3`}),(0,J.jsx)(`line`,{x1:`10`,y1:`-52`,x2:`-20`,y2:`-5`,strokeWidth:`0.8`,strokeDasharray:`3 3`}),(0,J.jsx)(`line`,{x1:`10`,y1:`-52`,x2:`35`,y2:`-5`,strokeWidth:`0.8`,strokeDasharray:`3 3`}),(0,J.jsx)(`line`,{x1:`-48`,y1:`12`,x2:`-20`,y2:`12`,strokeWidth:`1`,strokeDasharray:`3 5`})]})]}),(0,J.jsxs)(`g`,{transform:`translate(2360, 1180)`,id:`compass-rose`,children:[(0,J.jsx)(`circle`,{cx:`0`,cy:`0`,r:`75`,fill:r?`rgba(30,25,20,0.85)`:`rgba(245,236,215,0.85)`,stroke:i,strokeWidth:`2`}),(0,J.jsx)(`circle`,{cx:`0`,cy:`0`,r:`66`,fill:`none`,stroke:i,strokeWidth:`1`,strokeDasharray:`2 4`}),(0,J.jsx)(`circle`,{cx:`0`,cy:`0`,r:`48`,fill:`none`,stroke:i,strokeWidth:`1.2`}),(0,J.jsx)(`polygon`,{points:`0,-72 6,-20 0,0`,fill:i}),(0,J.jsx)(`polygon`,{points:`0,-72 -6,-20 0,0`,fill:r?`#4a3f33`:`#cebe9f`,stroke:i,strokeWidth:`1`}),(0,J.jsx)(`polygon`,{points:`0,72 -6,20 0,0`,fill:i}),(0,J.jsx)(`polygon`,{points:`0,72 6,20 0,0`,fill:r?`#4a3f33`:`#cebe9f`,stroke:i,strokeWidth:`1`}),(0,J.jsx)(`polygon`,{points:`72,0 20,6 0,0`,fill:i}),(0,J.jsx)(`polygon`,{points:`72,0 20,-6 0,0`,fill:r?`#4a3f33`:`#cebe9f`,stroke:i,strokeWidth:`1`}),(0,J.jsx)(`polygon`,{points:`-72,0 -20,-6 0,0`,fill:i}),(0,J.jsx)(`polygon`,{points:`-72,0 -20,6 0,0`,fill:r?`#4a3f33`:`#cebe9f`,stroke:i,strokeWidth:`1`}),(0,J.jsx)(`polygon`,{points:`45,-45 14,-5 0,0`,fill:i}),(0,J.jsx)(`polygon`,{points:`45,-45 5,-14 0,0`,fill:r?`#4a3f33`:`#cebe9f`,stroke:i,strokeWidth:`0.8`}),(0,J.jsx)(`polygon`,{points:`-45,-45 -5,-14 0,0`,fill:i}),(0,J.jsx)(`polygon`,{points:`-45,-45 -14,-5 0,0`,fill:r?`#4a3f33`:`#cebe9f`,stroke:i,strokeWidth:`0.8`}),(0,J.jsx)(`polygon`,{points:`45,45 5,14 0,0`,fill:i}),(0,J.jsx)(`polygon`,{points:`45,45 14,5 0,0`,fill:r?`#4a3f33`:`#cebe9f`,stroke:i,strokeWidth:`0.8`}),(0,J.jsx)(`polygon`,{points:`-45,45 -14,5 0,0`,fill:i}),(0,J.jsx)(`polygon`,{points:`-45,45 -5,14 0,0`,fill:r?`#4a3f33`:`#cebe9f`,stroke:i,strokeWidth:`0.8`}),(0,J.jsx)(`circle`,{cx:`0`,cy:`0`,r:`7`,fill:r?`#d4af37`:`#99732d`,stroke:i,strokeWidth:`1.5`}),(0,J.jsx)(`text`,{x:`0`,y:`-80`,textAnchor:`middle`,fill:r?`#f4d27a`:`#852e18`,className:`font-cinzel-dec font-bold text-[18px]`,children:`N`}),(0,J.jsx)(`text`,{x:`0`,y:`94`,textAnchor:`middle`,fill:r?`#d4caa9`:`#3d2e1e`,className:`font-cinzel font-bold text-[14px]`,children:`S`}),(0,J.jsx)(`text`,{x:`88`,y:`5`,textAnchor:`middle`,fill:r?`#d4caa9`:`#3d2e1e`,className:`font-cinzel font-bold text-[14px]`,children:`E`}),(0,J.jsx)(`text`,{x:`-88`,y:`5`,textAnchor:`middle`,fill:r?`#d4caa9`:`#3d2e1e`,className:`font-cinzel font-bold text-[14px]`,children:`W`})]}),(0,J.jsxs)(`g`,{transform:`translate(820, 120)`,id:`map-cartouche`,children:[(0,J.jsx)(`rect`,{x:`-220`,y:`-45`,width:`440`,height:`85`,rx:`6`,fill:r?`#231e17`:`#f5ebd3`,stroke:i,strokeWidth:`2.5`}),(0,J.jsx)(`rect`,{x:`-214`,y:`-39`,width:`428`,height:`73`,rx:`4`,fill:`none`,stroke:i,strokeWidth:`1`,strokeDasharray:`4 2`}),(0,J.jsx)(`path`,{d:`M -210,-30 Q -195,-30 -195,-15 M 210,-30 Q 195,-30 195,-15`,stroke:i,strokeWidth:`1.2`,fill:`none`}),(0,J.jsx)(`path`,{d:`M -210,25 Q -195,25 -195,10 M 210,25 Q 195,25 195,10`,stroke:i,strokeWidth:`1.2`,fill:`none`}),(0,J.jsx)(`text`,{x:`0`,y:`-12`,textAnchor:`middle`,fill:r?`#f4d27a`:`#5a2211`,className:`font-cinzel-dec font-bold text-[22px] tracking-widest`,children:`THE EXPEDITION TRAIL`}),(0,J.jsx)(`text`,{x:`0`,y:`15`,textAnchor:`middle`,fill:r?`#d2c2a5`:`#5c4530`,className:`font-garamond italic font-semibold text-[14px] tracking-wide`,children:`Path to the tower.`})]}),n&&(0,J.jsxs)(`g`,{id:`huge-stone-tower`,transform:`translate(${n.x}, ${n.y})`,children:[(0,J.jsx)(`path`,{d:`M -65,10 Q 0,25 65,10 L 55,-10 Q 0,5 -55,-10 Z`,fill:r?`#1e1a14`:`#d2c4a7`,stroke:i,strokeWidth:`2.5`,strokeLinejoin:`round`}),(0,J.jsx)(`path`,{d:`M -50,-10 L -32,-190 L 32,-190 L 50,-10 Z`,fill:r?`#231e17`:`#e6d7bc`,stroke:i,strokeWidth:`2.5`,strokeLinejoin:`round`}),(0,J.jsx)(`path`,{d:`M -47,-30 Q 0,-20 47,-30 M -43,-70 Q 0,-60 43,-70 M -39,-110 Q 0,-100 39,-110 M -35,-150 Q 0,-140 35,-150`,fill:`none`,stroke:a,strokeWidth:`1.5`,strokeDasharray:`12 6`,opacity:`0.8`}),(0,J.jsxs)(`g`,{stroke:a,strokeWidth:`1.2`,opacity:`0.75`,strokeLinecap:`round`,children:[(0,J.jsx)(`line`,{x1:`-48`,y1:`-20`,x2:`-25`,y2:`-30`}),(0,J.jsx)(`line`,{x1:`-47`,y1:`-40`,x2:`-24`,y2:`-50`}),(0,J.jsx)(`line`,{x1:`-45`,y1:`-60`,x2:`-22`,y2:`-70`}),(0,J.jsx)(`line`,{x1:`-44`,y1:`-80`,x2:`-21`,y2:`-90`}),(0,J.jsx)(`line`,{x1:`-42`,y1:`-100`,x2:`-19`,y2:`-110`}),(0,J.jsx)(`line`,{x1:`-41`,y1:`-120`,x2:`-18`,y2:`-130`}),(0,J.jsx)(`line`,{x1:`-39`,y1:`-140`,x2:`-16`,y2:`-150`}),(0,J.jsx)(`line`,{x1:`-38`,y1:`-160`,x2:`-15`,y2:`-170`}),(0,J.jsx)(`line`,{x1:`-36`,y1:`-180`,x2:`-13`,y2:`-190`})]}),(0,J.jsx)(`path`,{d:`M -18,0 L -18,-35 C -18,-55 18,-55 18,-35 L 18,0 Z`,fill:r?`#0f0c09`:`#33271c`,stroke:i,strokeWidth:`2.5`}),(0,J.jsx)(`rect`,{x:`-6`,y:`-80`,width:`12`,height:`25`,rx:`5`,fill:r?`#0f0c09`:`#33271c`,stroke:i,strokeWidth:`1.5`}),(0,J.jsx)(`rect`,{x:`-22`,y:`-130`,width:`8`,height:`20`,rx:`3`,fill:r?`#0f0c09`:`#33271c`,stroke:i,strokeWidth:`1.5`}),(0,J.jsx)(`rect`,{x:`14`,y:`-130`,width:`8`,height:`20`,rx:`3`,fill:r?`#0f0c09`:`#33271c`,stroke:i,strokeWidth:`1.5`}),(0,J.jsx)(`rect`,{x:`-6`,y:`-170`,width:`12`,height:`25`,rx:`5`,fill:r?`#0f0c09`:`#33271c`,stroke:i,strokeWidth:`1.5`}),(0,J.jsx)(`path`,{d:`M -36,-190 L -36,-210 L -21,-210 L -21,-190 L -6,-190 L -6,-210 L 9,-210 L 9,-190 L 24,-190 L 24,-210 L 39,-210 L 39,-190 Z`,fill:r?`#1e1a14`:`#d2c4a7`,stroke:i,strokeWidth:`2.5`,strokeLinejoin:`round`}),(0,J.jsx)(`path`,{d:`M -45,-40 L -30,-30 L -25,-45 L -10,-40 M 35,-150 L 25,-140 L 30,-120`,fill:`none`,stroke:i,strokeWidth:`1.5`}),(0,J.jsx)(`path`,{d:`M 50,-10 Q 40,-30 45,-50 T 35,-80 T 42,-110 T 30,-130`,fill:`none`,stroke:r?`#3a4a2c`:`#5a6b42`,strokeWidth:`2.5`,strokeLinecap:`round`}),(0,J.jsx)(`path`,{d:`M -50,-15 Q -40,-25 -45,-45 T -35,-75`,fill:`none`,stroke:r?`#3a4a2c`:`#5a6b42`,strokeWidth:`2`,strokeLinecap:`round`}),t&&(0,J.jsx)(`text`,{x:`0`,y:`-235`,textAnchor:`middle`,fill:r?`#e0caa9`:`#3d2e1e`,className:`font-cinzel text-[16px] font-bold tracking-widest select-none drop-shadow-sm`,children:`THE ANCIENT CITADEL`})]})]})},ge=({theme:e,showGrid:t})=>{let n=e.id!==`parchment`,r=e.pencilColor,i=n?`#2e261f`:`#3d2f21`;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`defs`,{children:[(0,J.jsxs)(`filter`,{id:`goldenGlow`,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:[(0,J.jsx)(`feGaussianBlur`,{in:`SourceGraphic`,stdDeviation:`4`,result:`blur1`}),(0,J.jsx)(`feGaussianBlur`,{in:`SourceGraphic`,stdDeviation:`10`,result:`blur2`}),(0,J.jsx)(`feGaussianBlur`,{in:`SourceGraphic`,stdDeviation:`22`,result:`blur3`}),(0,J.jsx)(`feColorMatrix`,{in:`blur3`,type:`matrix`,values:`\r - 1 0 0 0 1\r - 0 0.8 0 0 0.7\r - 0 0 0.2 0 0\r - 0 0 0 1.8 0`,result:`coloredBlur`}),(0,J.jsxs)(`feMerge`,{children:[(0,J.jsx)(`feMergeNode`,{in:`coloredBlur`}),(0,J.jsx)(`feMergeNode`,{in:`blur2`}),(0,J.jsx)(`feMergeNode`,{in:`blur1`}),(0,J.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]}),(0,J.jsxs)(`filter`,{id:`nodeGlow`,x:`-100%`,y:`-100%`,width:`300%`,height:`300%`,children:[(0,J.jsx)(`feGaussianBlur`,{in:`SourceGraphic`,stdDeviation:`6`,result:`blur`}),(0,J.jsxs)(`feMerge`,{children:[(0,J.jsx)(`feMergeNode`,{in:`blur`}),(0,J.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]}),(0,J.jsxs)(`linearGradient`,{id:`goldPathGradient`,x1:`0%`,y1:`0%`,x2:`100%`,y2:`100%`,children:[(0,J.jsx)(`stop`,{offset:`0%`,stopColor:`#f59e0b`,stopOpacity:`0.95`}),(0,J.jsx)(`stop`,{offset:`50%`,stopColor:`#fbbf24`,stopOpacity:`1`}),(0,J.jsx)(`stop`,{offset:`100%`,stopColor:`#fef08a`,stopOpacity:`1`})]}),(0,J.jsxs)(`radialGradient`,{id:`beaconGlow`,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,J.jsx)(`stop`,{offset:`0%`,stopColor:`#fffbeb`,stopOpacity:`1`}),(0,J.jsx)(`stop`,{offset:`40%`,stopColor:`#f59e0b`,stopOpacity:`0.8`}),(0,J.jsx)(`stop`,{offset:`75%`,stopColor:`#d97706`,stopOpacity:`0.3`}),(0,J.jsx)(`stop`,{offset:`100%`,stopColor:`#b45309`,stopOpacity:`0`})]})]}),t&&(0,J.jsxs)(`g`,{id:`grid-lines`,stroke:r,strokeWidth:`0.6`,strokeDasharray:`3 7`,opacity:n?.15:.22,children:[Array.from({length:13}).map((e,t)=>{let n=(t+1)*200;return(0,J.jsx)(`line`,{x1:n,y1:`0`,x2:n,y2:1500},`gx-${t}`)}),Array.from({length:7}).map((e,t)=>{let n=(t+1)*200;return(0,J.jsx)(`line`,{x1:`0`,y1:n,x2:2600,y2:n},`gy-${t}`)})]}),(0,J.jsxs)(`g`,{id:`map-border`,pointerEvents:`none`,children:[(0,J.jsx)(`rect`,{x:`12`,y:`12`,width:L-24,height:R-24,fill:`none`,stroke:r,strokeWidth:`6`}),(0,J.jsx)(`rect`,{x:`20`,y:`20`,width:L-40,height:`14`,fill:n?`#231e17`:`#eee2ca`,stroke:r,strokeWidth:`1.5`}),(0,J.jsx)(`rect`,{x:`20`,y:R-34,width:L-40,height:`14`,fill:n?`#231e17`:`#eee2ca`,stroke:r,strokeWidth:`1.5`}),(0,J.jsx)(`rect`,{x:`20`,y:`20`,width:`14`,height:R-40,fill:n?`#231e17`:`#eee2ca`,stroke:r,strokeWidth:`1.5`}),(0,J.jsx)(`rect`,{x:L-34,y:`20`,width:`14`,height:R-40,fill:n?`#231e17`:`#eee2ca`,stroke:r,strokeWidth:`1.5`}),Array.from({length:32}).map((e,t)=>{if(t%2==0)return null;let n=(L-40)/32;return(0,J.jsxs)(I.Fragment,{children:[(0,J.jsx)(`rect`,{x:20+t*n,y:`20`,width:n,height:`14`,fill:i}),(0,J.jsx)(`rect`,{x:20+t*n,y:R-34,width:n,height:`14`,fill:i})]},`ruler-h-${t}`)}),(0,J.jsx)(`rect`,{x:`38`,y:`38`,width:L-76,height:R-76,fill:`none`,stroke:r,strokeWidth:`2`}),(0,J.jsxs)(`g`,{transform:`translate(38, 38)`,stroke:r,strokeWidth:`1.6`,fill:`none`,children:[(0,J.jsx)(`path`,{d:`M 0,0 L 45,0 C 25,25 25,25 0,45 Z`,fill:n?`#2f271f`:`#e6d7bc`}),(0,J.jsx)(`circle`,{cx:`20`,cy:`20`,r:`4`,fill:r}),(0,J.jsx)(`line`,{x1:`0`,y1:`0`,x2:`40`,y2:`40`})]}),(0,J.jsxs)(`g`,{transform:`translate(${L-38}, 38)`,stroke:r,strokeWidth:`1.6`,fill:`none`,children:[(0,J.jsx)(`path`,{d:`M 0,0 L -45,0 C -25,25 -25,25 0,45 Z`,fill:n?`#2f271f`:`#e6d7bc`}),(0,J.jsx)(`circle`,{cx:`-20`,cy:`20`,r:`4`,fill:r}),(0,J.jsx)(`line`,{x1:`0`,y1:`0`,x2:`-40`,y2:`40`})]}),(0,J.jsxs)(`g`,{transform:`translate(38, ${R-38})`,stroke:r,strokeWidth:`1.6`,fill:`none`,children:[(0,J.jsx)(`path`,{d:`M 0,0 L 45,0 C 25,-25 25,-25 0,-45 Z`,fill:n?`#2f271f`:`#e6d7bc`}),(0,J.jsx)(`circle`,{cx:`20`,cy:`-20`,r:`4`,fill:r}),(0,J.jsx)(`line`,{x1:`0`,y1:`0`,x2:`40`,y2:`-40`})]}),(0,J.jsxs)(`g`,{transform:`translate(${L-38}, ${R-38})`,stroke:r,strokeWidth:`1.6`,fill:`none`,children:[(0,J.jsx)(`path`,{d:`M 0,0 L -45,0 C -25,-25 -25,-25 0,-45 Z`,fill:n?`#2f271f`:`#e6d7bc`}),(0,J.jsx)(`circle`,{cx:`-20`,cy:`-20`,r:`4`,fill:r}),(0,J.jsx)(`line`,{x1:`0`,y1:`0`,x2:`-40`,y2:`-40`})]}),(0,J.jsxs)(`g`,{transform:`translate(480, 1445)`,stroke:r,children:[(0,J.jsx)(`rect`,{x:`0`,y:`0`,width:`180`,height:`8`,fill:`none`,strokeWidth:`1.2`}),(0,J.jsx)(`rect`,{x:`0`,y:`0`,width:`45`,height:`8`,fill:r}),(0,J.jsx)(`rect`,{x:`90`,y:`0`,width:`45`,height:`8`,fill:r}),(0,J.jsx)(`text`,{x:`0`,y:`-5`,textAnchor:`middle`,fill:n?`#d4c2a5`:`#4d3926`,className:`font-garamond text-[12px] font-bold`,children:`0`}),(0,J.jsx)(`text`,{x:`45`,y:`-5`,textAnchor:`middle`,fill:n?`#d4c2a5`:`#4d3926`,className:`font-garamond text-[12px] font-bold`,children:`25`}),(0,J.jsx)(`text`,{x:`90`,y:`-5`,textAnchor:`middle`,fill:n?`#d4c2a5`:`#4d3926`,className:`font-garamond text-[12px] font-bold`,children:`50`}),(0,J.jsx)(`text`,{x:`180`,y:`-5`,textAnchor:`middle`,fill:n?`#d4c2a5`:`#4d3926`,className:`font-garamond text-[12px] font-bold`,children:`100 Leagues`})]})]})]})},_e=({nodes:e,activeNodeIndex:t,completions:n,theme:r,showNodeNumbers:i,onNodeClick:a,hoveredNodeIndex:o,setHoveredNodeIndex:s})=>{let c=e.reduce((e,t,r)=>n.has(t.id)?Math.max(e,r):e,-1),l=Math.max(t,c),u=G(e),d=K(e,l),f=t>=0&&t0&&d&&(0,J.jsxs)(`g`,{id:`lit-path`,children:[(0,J.jsx)(`path`,{d,fill:`none`,stroke:`#f59e0b`,strokeWidth:`14`,strokeLinecap:`round`,strokeLinejoin:`round`,opacity:.35,filter:`url(#goldenGlow)`}),(0,J.jsx)(`path`,{d,fill:`none`,stroke:`url(#goldPathGradient)`,strokeWidth:`6`,strokeLinecap:`round`,strokeLinejoin:`round`,filter:`url(#goldenGlow)`}),(0,J.jsx)(`path`,{d,fill:`none`,stroke:`#fffbeb`,strokeWidth:`2.4`,strokeLinecap:`round`,strokeLinejoin:`round`,opacity:.95})]}),(0,J.jsx)(`g`,{id:`nodes-collection`,children:e.map((c,u)=>{let d=n.has(c.id),f=u<=l||d,p=u===t,m=o===u,h=(u+1)%25==0||u===0||u===e.length-1;return(0,J.jsxs)(`g`,{id:`node-${c.id}`,transform:`translate(${c.x}, ${c.y})`,className:`cursor-pointer transition-transform duration-200`,onClick:e=>{e.stopPropagation(),a(u)},onMouseEnter:()=>s(u),onMouseLeave:()=>s(null),children:[(0,J.jsx)(`circle`,{cx:`0`,cy:`0`,r:`18`,fill:`transparent`}),!f&&!d&&(0,J.jsxs)(`g`,{children:[(0,J.jsx)(`circle`,{cx:`1`,cy:`1.5`,r:h?6.5:4.5,fill:r.pencilShade,opacity:.4}),(0,J.jsx)(`circle`,{cx:`0`,cy:`0`,r:h?6:4,fill:r.id===`parchment`?`#f0e5ce`:`#28221b`,stroke:r.pencilColor,strokeWidth:h?2:1.4}),h&&(0,J.jsx)(`circle`,{cx:`0`,cy:`0`,r:`2`,fill:r.pencilColor})]}),f&&!p&&(0,J.jsxs)(`g`,{filter:`url(#nodeGlow)`,children:[(0,J.jsx)(`circle`,{cx:`0`,cy:`0`,r:h?10:7,fill:d?`#10b981`:`#f59e0b`,opacity:.4}),(0,J.jsx)(`circle`,{cx:`0`,cy:`0`,r:h?7:5,fill:d?`#34d399`:`#fbbf24`,stroke:`#fffbeb`,strokeWidth:`1.6`}),(0,J.jsx)(`circle`,{cx:`0`,cy:`0`,r:h?2.5:1.8,fill:`#ffffff`})]}),p&&(0,J.jsxs)(`g`,{id:`active-node-beacon`,children:[(0,J.jsx)(`circle`,{cx:`0`,cy:`0`,r:`12`,fill:`none`,stroke:`#f59e0b`,strokeWidth:`2.5`,className:`beacon-wave`}),(0,J.jsx)(`circle`,{cx:`0`,cy:`0`,r:`12`,fill:`none`,stroke:`#fbbf24`,strokeWidth:`2`,className:`beacon-wave-delayed`}),(0,J.jsx)(`circle`,{cx:`0`,cy:`0`,r:`20`,fill:`url(#beaconGlow)`}),(0,J.jsx)(`circle`,{cx:`0`,cy:`0`,r:`9.5`,fill:d?`#10b981`:`#f59e0b`,stroke:`#ffffff`,strokeWidth:`2.4`,filter:`url(#goldenGlow)`}),(0,J.jsx)(`circle`,{cx:`0`,cy:`0`,r:`4.5`,fill:`#ffffff`}),(0,J.jsxs)(`g`,{transform:`translate(0, -18)`,children:[(0,J.jsx)(`line`,{x1:`0`,y1:`0`,x2:`0`,y2:`10`,stroke:`#f59e0b`,strokeWidth:`2.2`}),(0,J.jsx)(`polygon`,{points:`0,-10 7,-4 0,2 -7,-4`,fill:d?`#10b981`:`#ef4444`,stroke:`#ffffff`,strokeWidth:`1.5`,filter:`url(#nodeGlow)`}),(0,J.jsx)(`circle`,{cx:`0`,cy:`-4`,r:`2`,fill:`#ffffff`})]})]}),m&&!p&&(0,J.jsx)(`circle`,{cx:`0`,cy:`0`,r:`13`,fill:`none`,stroke:`#f59e0b`,strokeWidth:`2`,strokeDasharray:`3 3`}),(i||h||m)&&(0,J.jsx)(`text`,{x:`0`,y:h?-13:-10,textAnchor:`middle`,fill:d?`#059669`:f?`#d97706`:r.pencilColor,className:`font-pencil font-bold select-none ${h?`text-[13px]`:`text-[10px]`}`,opacity:f?1:.75,children:c.id<0?`P${u+1}`:c.id})]},c.id)})}),f&&(0,J.jsxs)(`g`,{transform:`translate(${f.x}, ${f.y-42})`,className:`pointer-events-none select-none transition-all duration-300`,children:[(0,J.jsx)(`rect`,{x:`-80`,y:`-24`,width:`160`,height:`32`,rx:`6`,fill:r.id===`parchment`?`#2a221b`:`#14120f`,stroke:`#f59e0b`,strokeWidth:`1.8`,filter:`url(#nodeGlow)`}),(0,J.jsx)(`polygon`,{points:`-6,8 6,8 0,14`,fill:r.id===`parchment`?`#2a221b`:`#14120f`,stroke:`#f59e0b`,strokeWidth:`1.8`}),(0,J.jsxs)(`text`,{x:`0`,y:`-8`,textAnchor:`middle`,fill:`#fef08a`,className:`font-cinzel font-bold text-[12px] tracking-wider`,children:[`NODE `,f.sequenceIndex+1,` / `,e.length]}),(0,J.jsx)(`text`,{x:`0`,y:`4`,textAnchor:`middle`,fill:`#ffffff`,className:`font-garamond italic font-semibold text-[11px]`,children:f.name.length>20?f.name.substring(0,18)+`…`:f.name})]})]})},ve=({nodes:e,activeNodeIndex:t,completions:n,theme:r,showLabels:i,showGrid:a,showNodeNumbers:o,autoCenterOnActive:s,onNodeClick:c,hoveredNodeIndex:l,setHoveredNodeIndex:u,transform:d,setTransform:f})=>{let p=(0,I.useRef)(null),m=(0,I.useRef)(!1),h=(0,I.useRef)({x:0,y:0}),g=(0,I.useRef)(null),_=(0,I.useRef)(null),[v,y]=(0,I.useState)(!1),b=(0,I.useRef)(d);b.current=d;let x=(0,I.useCallback)(t=>{if(!p.current||t<0||t>=e.length)return;let n=e[t],{clientWidth:r,clientHeight:i}=p.current,a=b.current.scale,o=Math.max(a,.9);f({x:r/2-n.x*o,y:i/2-n.y*o,scale:o})},[e,f]);(0,I.useEffect)(()=>{s&&t>=0&&x(t)},[t,s,x]),(0,I.useEffect)(()=>{if(p.current&&(!s||t<0)){let{clientWidth:e,clientHeight:t}=p.current,n=e/L,r=t/R,i=Math.min(n,r)*.9;f({x:(e-L*i)/2,y:(t-R*i)/2,scale:Math.max(i,.08)})}},[f,s,t]);let S=e=>{if(e.preventDefault(),!p.current)return;y(!0),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>y(!1),140);let t=p.current.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=e.deltaY<0?1.15:.85,a=Math.min(Math.max(d.scale*i,.08),3.5);f({x:n-(n-d.x)/d.scale*a,y:r-(r-d.y)/d.scale*a,scale:a})},C=e=>{e.button===0&&(m.current=!0,y(!0),h.current={x:e.clientX-d.x,y:e.clientY-d.y})},w=e=>{m.current&&f(t=>({...t,x:e.clientX-h.current.x,y:e.clientY-h.current.y}))},T=()=>{m.current=!1,y(!1)},E=e=>{if(y(!0),e.touches.length===1)m.current=!0,h.current={x:e.touches[0].clientX-d.x,y:e.touches[0].clientY-d.y};else if(e.touches.length===2){m.current=!1;let t=e.touches[0].clientX-e.touches[1].clientX,n=e.touches[0].clientY-e.touches[1].clientY;g.current=Math.hypot(t,n)}},D=e=>{if(e.touches.length===1&&m.current)f(t=>({...t,x:e.touches[0].clientX-h.current.x,y:e.touches[0].clientY-h.current.y}));else if(e.touches.length===2&&g.current&&p.current){let t=e.touches[0].clientX-e.touches[1].clientX,n=e.touches[0].clientY-e.touches[1].clientY,r=Math.hypot(t,n),i=r/g.current;g.current=r;let a=p.current.getBoundingClientRect(),o=(e.touches[0].clientX+e.touches[1].clientX)/2-a.left,s=(e.touches[0].clientY+e.touches[1].clientY)/2-a.top;f(e=>{let t=Math.min(Math.max(e.scale*i,.08),3.5);return{scale:t,x:o-(o-e.x)/e.scale*t,y:s-(s-e.y)/e.scale*t}})}},O=()=>{m.current=!1,g.current=null,y(!1)},k=r.id!==`parchment`;return(0,J.jsxs)(`div`,{id:`pencil-map-container`,ref:p,className:`relative w-full h-full overflow-hidden canvas-interactive select-none ${k?`parchment-dark-bg`:`parchment-bg`}`,onWheel:S,onMouseDown:C,onMouseMove:w,onMouseUp:T,onMouseLeave:T,onTouchStart:E,onTouchMove:D,onTouchEnd:O,children:[(0,J.jsx)(`div`,{className:`absolute inset-0 pointer-events-none z-10 ${k?`map-dark-vignette`:`map-vignette`}`}),(0,J.jsxs)(`svg`,{id:`pencil-map-svg`,viewBox:`0 0 ${L} ${R}`,width:L,height:R,style:{transform:`translate(${d.x}px, ${d.y}px) scale(${d.scale})`,transformOrigin:`0 0`,transition:v?`none`:`transform 0.4s cubic-bezier(0.16, 1, 0.3, 1)`},className:`absolute top-0 left-0`,children:[(0,J.jsx)(ge,{theme:r,showGrid:a}),(0,J.jsx)(he,{theme:r,showLabels:i,finalNode:e[e.length-1]}),(0,J.jsx)(_e,{nodes:e,activeNodeIndex:t,completions:n,theme:r,showNodeNumbers:o,onNodeClick:c,hoveredNodeIndex:l,setHoveredNodeIndex:u})]})]})},ye=({theme:e,soundEnabled:t,autoCenterOnActive:n,showLabels:r,showGrid:s,showNodeNumbers:c,tracks:l,activeTrack:u,onTrackChange:f,onToggleSound:p,onToggleAutoCenter:h,onToggleLabels:_,onToggleGrid:v,onToggleNodeNumbers:y,onToggleTheme:x,onZoomIn:T,onZoomOut:E,onResetZoom:D,onCenterActiveNode:O})=>{let k=e.id!==`parchment`;return(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-1 text-xs select-none`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[l&&l.length>0&&f&&(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5 bg-black/30 backdrop-blur-md px-2.5 py-1.5 rounded-xl border border-black/20 shadow-md`,children:[(0,J.jsx)(i,{className:`w-3.5 h-3.5 text-amber-500`}),(0,J.jsx)(`span`,{className:`font-cinzel text-[10px] font-bold tracking-wider text-amber-600 dark:text-amber-400 uppercase hidden sm:inline`,children:`Track:`}),(0,J.jsx)(`select`,{value:u,onChange:e=>f(e.target.value),className:`bg-transparent border-none text-xs font-cinzel font-bold text-amber-700 dark:text-amber-300 cursor-pointer focus:outline-none`,children:l.map(e=>(0,J.jsx)(`option`,{value:e.id,className:`bg-stone-900 text-stone-200`,children:e.name},e.id))})]}),(0,J.jsxs)(`button`,{id:`toggle-sound-btn`,onClick:p,title:t?`Mute Audio`:`Enable Audio`,className:`flex items-center gap-1 px-2.5 py-1.5 rounded-xl border backdrop-blur-md shadow-md transition-all cursor-pointer ${t?`bg-amber-500/20 border-amber-500/50 text-amber-600 dark:text-amber-400`:`bg-black/20 border-black/10 text-stone-500`}`,children:[t?(0,J.jsx)(w,{className:`w-3.5 h-3.5`}):(0,J.jsx)(g,{className:`w-3.5 h-3.5`}),(0,J.jsx)(`span`,{className:`font-garamond font-semibold hidden sm:inline`,children:`Audio`})]}),(0,J.jsxs)(`button`,{id:`toggle-autocenter-btn`,onClick:h,title:`Auto-Center on Active Node`,className:`flex items-center gap-1 px-2.5 py-1.5 rounded-xl border backdrop-blur-md shadow-md transition-all cursor-pointer ${n?`bg-amber-500/20 border-amber-500/50 text-amber-600 dark:text-amber-400`:`bg-black/20 border-black/10 text-stone-500`}`,children:[(0,J.jsx)(C,{className:`w-3.5 h-3.5`}),(0,J.jsx)(`span`,{className:`font-garamond font-semibold hidden sm:inline`,children:`Auto-Track`})]}),(0,J.jsxs)(`button`,{id:`toggle-labels-btn`,onClick:_,title:`Toggle Geographical Labels`,className:`flex items-center gap-1 px-2.5 py-1.5 rounded-xl border backdrop-blur-md shadow-md transition-all cursor-pointer ${r?`bg-amber-500/20 border-amber-500/50 text-amber-600 dark:text-amber-400`:`bg-black/20 border-black/10 text-stone-500`}`,children:[(0,J.jsx)(o,{className:`w-3.5 h-3.5`}),(0,J.jsx)(`span`,{className:`font-garamond font-semibold hidden sm:inline`,children:`Labels`})]}),(0,J.jsx)(`button`,{id:`toggle-grid-btn`,onClick:v,title:`Toggle Coordinate Grid`,className:`px-2.5 py-1.5 rounded-xl border backdrop-blur-md shadow-md font-garamond font-semibold transition-all cursor-pointer ${s?`bg-amber-500/20 border-amber-500/50 text-amber-600 dark:text-amber-400`:`bg-black/20 border-black/10 text-stone-500`}`,children:`Grid`}),(0,J.jsx)(`button`,{id:`toggle-numbers-btn`,onClick:y,title:`Toggle All Node Numbers`,className:`px-2.5 py-1.5 rounded-xl border backdrop-blur-md shadow-md font-garamond font-semibold transition-all cursor-pointer ${c?`bg-amber-500/20 border-amber-500/50 text-amber-600 dark:text-amber-400`:`bg-black/20 border-black/10 text-stone-500`}`,children:`#s`}),(0,J.jsxs)(`button`,{id:`toggle-theme-btn`,onClick:x,title:`Switch Map Lighting Style`,className:`flex items-center gap-1 px-2.5 py-1.5 rounded-xl border backdrop-blur-md shadow-md transition-all cursor-pointer ${k?`bg-amber-500/20 border-amber-500/50 text-amber-300`:`bg-amber-900/10 border-amber-900/20 text-amber-900`}`,children:[k?(0,J.jsx)(b,{className:`w-3.5 h-3.5`}):(0,J.jsx)(a,{className:`w-3.5 h-3.5`}),(0,J.jsx)(`span`,{className:`font-garamond font-semibold hidden sm:inline`,children:k?`Day`:`Night`})]})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1 bg-black/30 backdrop-blur-md p-1 rounded-xl border border-black/20 shadow-md`,children:[(0,J.jsx)(`button`,{id:`zoom-in-btn`,onClick:T,title:`Zoom In`,className:`p-1.5 rounded-lg hover:bg-white/10 text-stone-300 cursor-pointer`,children:(0,J.jsx)(m,{className:`w-4 h-4`})}),(0,J.jsx)(`button`,{id:`zoom-out-btn`,onClick:E,title:`Zoom Out`,className:`p-1.5 rounded-lg hover:bg-white/10 text-stone-300 cursor-pointer`,children:(0,J.jsx)(S,{className:`w-4 h-4`})}),(0,J.jsx)(`button`,{id:`center-active-btn`,onClick:O,title:`Focus Active Node`,className:`p-1.5 rounded-lg hover:bg-white/10 text-stone-300 cursor-pointer`,children:(0,J.jsx)(C,{className:`w-4 h-4 text-amber-400`})}),(0,J.jsx)(`button`,{id:`reset-zoom-btn`,onClick:D,title:`Fit Entire Map`,className:`p-1.5 rounded-lg hover:bg-white/10 text-stone-300 cursor-pointer`,children:(0,J.jsx)(d,{className:`w-4 h-4`})})]})]})},be=({node:e,activeNodeIndex:n,totalNodes:i,theme:a,onAdvance:o,onRetreat:c,details:l,modalLoading:u,isCompleted:d,toggleLoading:f,onToggleCompletion:m,onSelectProblemForReview:h})=>{let[g,_]=(0,I.useState)(!1),[b,x]=(0,I.useState)(!1);if(!e)return null;let S=a.id!==`parchment`,C=l.length>0,w=F(e.id);return(0,J.jsxs)(`div`,{id:`node-detail-card`,className:`relative p-4 rounded-2xl border-2 shadow-2xl backdrop-blur-md transition-all duration-300 max-h-[calc(100vh-180px)] overflow-y-auto custom-scrollbar select-none ${S?`bg-[#1c1813]/95 border-[#594634] text-[#f2e6d5]`:`bg-[#fbf5e8]/98 border-[#cbb38e] text-[#2c1d11]`}`,children:[(0,J.jsx)(`div`,{className:`absolute top-2 left-2 w-2.5 h-2.5 border-t-2 border-l-2 border-amber-600/70 pointer-events-none`}),(0,J.jsx)(`div`,{className:`absolute top-2 right-2 w-2.5 h-2.5 border-t-2 border-r-2 border-amber-600/70 pointer-events-none`}),(0,J.jsx)(`div`,{className:`absolute bottom-2 left-2 w-2.5 h-2.5 border-b-2 border-l-2 border-amber-600/70 pointer-events-none`}),(0,J.jsx)(`div`,{className:`absolute bottom-2 right-2 w-2.5 h-2.5 border-b-2 border-r-2 border-amber-600/70 pointer-events-none`}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b pb-2 mb-3 ${S?`border-amber-900/40`:`border-amber-900/15`}`,children:[(0,J.jsxs)(`span`,{className:`font-cinzel text-xs font-bold tracking-wider uppercase ${S?`text-amber-400`:`text-amber-800`}`,children:[`Node `,n+1,` / `,i]}),d&&(0,J.jsx)(`span`,{className:`text-[10px] font-cinzel font-bold px-2 py-0.5 rounded border ${S?`bg-emerald-500/20 text-emerald-400 border-emerald-500/40`:`bg-emerald-600/15 text-emerald-800 border-emerald-600/30`}`,children:`✓ Solved`})]}),u?(0,J.jsxs)(`div`,{className:`py-6 flex flex-col items-center justify-center gap-2`,children:[(0,J.jsx)(t,{className:`w-5 h-5 text-amber-500 animate-spin`}),(0,J.jsx)(`span`,{className:`text-[10px] font-cinzel font-bold opacity-75 uppercase`,children:`Loading Problem Details...`})]}):C?(0,J.jsx)(`div`,{className:`space-y-3.5`,children:l.map(t=>(0,J.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,J.jsxs)(`div`,{className:`flex justify-between items-start gap-2`,children:[(0,J.jsxs)(`h3`,{className:`font-bold font-headline-md text-base leading-snug m-0 ${S?`text-[#fef3c7]`:`text-[#1c120c]`}`,children:[e.id>0?`${e.id}. `:``,t.name]}),(0,J.jsx)(`span`,{className:`text-[9px] font-cinzel font-bold px-2 py-0.5 rounded border shrink-0 ${t.difficulty===`Easy`?S?`bg-emerald-950/90 text-emerald-300 border-emerald-500/40`:`bg-emerald-100 text-emerald-900 border-emerald-400`:t.difficulty===`Medium`?S?`bg-amber-950/90 text-amber-300 border-amber-500/40`:`bg-amber-100 text-amber-900 border-amber-400`:S?`bg-rose-950/90 text-rose-300 border-rose-500/40`:`bg-rose-100 text-rose-900 border-rose-400`}`,children:t.difficulty?.toUpperCase()||`MEDIUM`})]}),(0,J.jsxs)(`div`,{className:`text-xs font-garamond font-semibold ${S?`text-amber-300`:`text-amber-900`}`,children:[`Pattern: `,(0,J.jsx)(`span`,{className:`italic font-bold`,children:t.pattern||`General`})]}),(0,J.jsxs)(`div`,{className:`flex gap-4 text-xs font-semibold ${S?`text-stone-300`:`text-stone-800`}`,children:[(0,J.jsxs)(`div`,{children:[`Time:`,` `,(0,J.jsx)(`code`,{className:`px-1.5 py-0.5 rounded font-mono text-[11px] font-bold ${S?`bg-black/50 text-emerald-300`:`bg-amber-950/10 text-emerald-800`}`,children:t.optimal_time||`O(N)`})]}),(0,J.jsxs)(`div`,{children:[`Space:`,` `,(0,J.jsx)(`code`,{className:`px-1.5 py-0.5 rounded font-mono text-[11px] font-bold ${S?`bg-black/50 text-emerald-300`:`bg-amber-950/10 text-emerald-800`}`,children:t.optimal_space||`O(1)`})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2 pt-1 border-t ${S?`border-amber-900/30`:`border-amber-900/10`}`,children:[t.google_doc_url&&(0,J.jsxs)(`a`,{href:t.google_doc_url,target:`_blank`,rel:`noreferrer`,className:`flex-1 flex items-center justify-center gap-1.5 py-2 px-2.5 rounded-xl border text-xs font-cinzel font-semibold transition-all cursor-pointer text-center ${S?`border-amber-500/30 bg-amber-500/10 hover:bg-amber-500/20 text-amber-200`:`border-amber-900/20 bg-amber-900/5 hover:bg-amber-900/10 text-amber-900`}`,children:[(0,J.jsx)(A,{className:`w-3.5 h-3.5`}),(0,J.jsx)(`span`,{children:`Google Doc`})]}),(0,J.jsxs)(`button`,{onClick:()=>h(t.id),className:`flex-1 flex items-center justify-center gap-1.5 py-2 px-2.5 rounded-xl bg-amber-600 hover:bg-amber-500 text-white text-xs font-cinzel font-bold shadow transition-all active:scale-95 cursor-pointer text-center`,children:[(0,J.jsx)(v,{className:`w-3.5 h-3.5`}),(0,J.jsx)(`span`,{children:`Review Problem`})]})]})]},t.id))}):w?(0,J.jsxs)(`div`,{className:`space-y-3.5`,children:[(0,J.jsxs)(`div`,{className:`flex justify-between items-start gap-2`,children:[(0,J.jsxs)(`h3`,{className:`font-bold font-headline-md text-base leading-snug m-0 ${S?`text-[#fef3c7]`:`text-[#1c120c]`}`,children:[`LC #`,w.problem_number,`. `,w.name]}),(0,J.jsx)(`span`,{className:`text-[9px] font-cinzel font-bold px-2 py-0.5 rounded border shrink-0 ${w.difficulty===`Easy`?S?`bg-emerald-950/90 text-emerald-300 border-emerald-500/40`:`bg-emerald-100 text-emerald-900 border-emerald-400`:w.difficulty===`Medium`?S?`bg-amber-950/90 text-amber-300 border-amber-500/40`:`bg-amber-100 text-amber-900 border-amber-400`:S?`bg-rose-950/90 text-rose-300 border-rose-500/40`:`bg-rose-100 text-rose-900 border-rose-400`}`,children:w.difficulty?.toUpperCase()||`MEDIUM`})]}),(0,J.jsxs)(`div`,{className:`text-xs font-garamond font-semibold ${S?`text-amber-300`:`text-amber-900`}`,children:[`Pattern: `,(0,J.jsx)(`span`,{className:`italic font-bold`,children:w.pattern})]}),(0,J.jsxs)(`div`,{className:`flex gap-4 text-xs font-semibold ${S?`text-stone-300`:`text-stone-800`}`,children:[(0,J.jsxs)(`div`,{children:[`Time:`,` `,(0,J.jsx)(`code`,{className:`px-1.5 py-0.5 rounded font-mono text-[11px] font-bold ${S?`bg-black/50 text-emerald-300`:`bg-amber-950/10 text-emerald-800`}`,children:w.time_complexity})]}),(0,J.jsxs)(`div`,{children:[`Space:`,` `,(0,J.jsx)(`code`,{className:`px-1.5 py-0.5 rounded font-mono text-[11px] font-bold ${S?`bg-black/50 text-emerald-300`:`bg-amber-950/10 text-emerald-800`}`,children:w.space_complexity})]})]}),w.description&&(0,J.jsx)(`div`,{className:`p-2.5 rounded-xl border text-xs leading-relaxed ${S?`bg-[#252019] border-[#5a4836] text-stone-200`:`bg-white/80 border-[#cbb38e] text-stone-800`}`,children:w.description}),(0,J.jsxs)(`div`,{className:`space-y-2 pt-1 border-t border-amber-900/20`,children:[(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsxs)(`button`,{onClick:async()=>{if(w&&!g){_(!0);try{await se(w),x(!0),d||m(e.id),setTimeout(()=>x(!1),3e3)}catch(e){console.error(`Failed to activate problem:`,e)}finally{_(!1)}}},disabled:g,className:`flex-1 flex items-center justify-center gap-1.5 py-2 px-2.5 rounded-xl border text-xs font-cinzel font-bold shadow-sm transition-all active:scale-95 cursor-pointer disabled:opacity-50 ${b?`bg-emerald-600 text-white border-emerald-400`:S?`bg-amber-500/15 border-amber-500/40 hover:bg-amber-500/25 text-amber-300`:`bg-amber-900/10 border-amber-900/30 hover:bg-amber-900/20 text-amber-900`}`,children:[g?(0,J.jsx)(t,{className:`w-3.5 h-3.5 animate-spin`}):b?(0,J.jsx)(ie,{className:`w-3.5 h-3.5`}):(0,J.jsx)(D,{className:`w-3.5 h-3.5 text-amber-500`}),(0,J.jsx)(`span`,{children:b?`Added to Box 1!`:`Learned Today`})]}),(0,J.jsxs)(`button`,{onClick:async()=>{if(w&&!g){_(!0);try{let t=await se(w);d||m(e.id),h(t.problem_id)}catch(e){console.error(`Failed to launch problem:`,e)}finally{_(!1)}}},disabled:g,className:`flex-1 flex items-center justify-center gap-1.5 py-2 px-2.5 rounded-xl bg-amber-600 hover:bg-amber-500 text-white text-xs font-cinzel font-bold shadow transition-all active:scale-95 cursor-pointer disabled:opacity-50`,children:[(0,J.jsx)(v,{className:`w-3.5 h-3.5`}),(0,J.jsx)(`span`,{children:`Solve / Review`})]})]}),(0,J.jsxs)(`a`,{href:w.leetcode_url,target:`_blank`,rel:`noreferrer`,className:`w-full flex items-center justify-center gap-1.5 p-1.5 rounded-xl border text-[11px] font-garamond font-semibold transition-all cursor-pointer ${S?`border-amber-500/20 hover:bg-amber-500/10 text-stone-300`:`border-amber-900/20 hover:bg-amber-900/5 text-stone-800`}`,children:[(0,J.jsx)(A,{className:`w-3 h-3 text-emerald-500`}),(0,J.jsx)(`span`,{children:`Open on LeetCode.com`})]})]})]}):(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h3`,{className:`font-bold font-headline-md text-base leading-snug m-0 ${S?`text-[#fef3c7]`:`text-[#1c120c]`}`,children:e.name})}),(0,J.jsxs)(`div`,{className:`p-3 rounded-xl border space-y-2 text-xs ${S?`bg-[#252019] border-[#5a4836] text-stone-200`:`bg-white/90 border-[#cbb38e] text-stone-800`}`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,J.jsx)(s,{className:`w-4 h-4 text-amber-500 shrink-0 mt-0.5`}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h4`,{className:`font-bold text-xs m-0`,children:`No Local Note Synced`}),(0,J.jsxs)(`p`,{className:`text-[10px] opacity-75 mt-0.5 leading-normal`,children:[`Sync Google Drive or create a note for problem #`,e.id,`.`]})]})]}),(0,J.jsxs)(`div`,{className:`space-y-1.5 pt-1 border-t ${S?`border-amber-900/20`:`border-amber-900/10`}`,children:[(0,J.jsx)(`a`,{href:`https://leetcode.com/problemset/?search=${e.id}`,target:`_blank`,rel:`noreferrer`,className:`w-full flex items-center justify-between p-1.5 rounded-lg border text-[11px] font-garamond font-semibold transition-all cursor-pointer ${S?`border-amber-500/20 hover:bg-amber-500/10 text-stone-200`:`border-amber-900/20 hover:bg-amber-900/5 text-stone-800`}`,children:(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(A,{className:`w-3 h-3 text-emerald-500`}),`Search LeetCode #`,e.id]})}),(0,J.jsx)(`a`,{href:`https://www.google.com/search?q=leetcode+${e.id}`,target:`_blank`,rel:`noreferrer`,className:`w-full flex items-center justify-between p-1.5 rounded-lg border text-[11px] font-garamond font-semibold transition-all cursor-pointer ${S?`border-amber-500/20 hover:bg-amber-500/10 text-stone-200`:`border-amber-900/20 hover:bg-amber-900/5 text-stone-800`}`,children:(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(r,{className:`w-3 h-3 text-amber-500`}),`Search Google Solution`]})})]})]})]}),(0,J.jsx)(`div`,{className:`pt-3 mt-3 border-t ${S?`border-amber-900/40`:`border-amber-900/15`}`,children:(0,J.jsx)(`button`,{onClick:()=>m(e.id),disabled:f,className:`w-full py-2.5 rounded-xl font-cinzel text-xs font-bold tracking-wider uppercase flex items-center justify-center gap-2 cursor-pointer transition-all border shadow-sm active:scale-95 disabled:opacity-50 ${d?S?`bg-rose-500/15 border-rose-500/40 text-rose-400 hover:bg-rose-500/25`:`bg-rose-600/10 border-rose-600/30 text-rose-800 hover:bg-rose-600/20`:S?`bg-emerald-500/15 border-emerald-500/40 text-emerald-400 hover:bg-emerald-500/25`:`bg-emerald-600/10 border-emerald-600/30 text-emerald-800 hover:bg-emerald-600/20`}`,children:d?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(M,{className:`w-4 h-4`}),(0,J.jsx)(`span`,{children:`Unmark As Completed`})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(O,{className:`w-4 h-4`}),(0,J.jsx)(`span`,{children:`Mark As Completed`})]})})}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pt-2.5 mt-2.5 border-t ${S?`border-amber-900/40`:`border-amber-900/15`}`,children:[(0,J.jsxs)(`button`,{onClick:c,disabled:n<=0,className:`flex items-center gap-1 text-[11px] font-cinzel font-semibold px-2.5 py-1.5 rounded-lg border transition-all disabled:opacity-30 cursor-pointer ${S?`border-amber-500/30 hover:bg-amber-500/10 text-stone-200`:`border-amber-900/20 hover:bg-amber-900/5 text-stone-800`}`,children:[(0,J.jsx)(p,{className:`w-3 h-3`}),(0,J.jsx)(`span`,{children:`Prev`})]}),(0,J.jsxs)(`span`,{className:`text-[10px] font-garamond italic font-semibold ${S?`text-stone-400`:`text-stone-600`}`,children:[`Waypoint `,n+1]}),(0,J.jsxs)(`button`,{onClick:o,disabled:n>=i-1,className:`flex items-center gap-1 text-[11px] font-cinzel font-semibold px-2.5 py-1.5 rounded-lg bg-amber-600 hover:bg-amber-500 text-white transition-all disabled:opacity-30 cursor-pointer shadow`,children:[(0,J.jsx)(`span`,{children:`Next`}),(0,J.jsx)(y,{className:`w-3 h-3`})]})]})]})},xe=({isOpen:e,onClose:t,nodes:n,theme:r,onReset:i})=>{if(!e)return null;let a=r.id!==`parchment`,o=n.length;return(0,J.jsx)(`div`,{className:`fixed inset-0 z-[120] flex items-center justify-center p-4 bg-black/70 backdrop-blur-sm animate-fade-in select-none`,children:(0,J.jsxs)(`div`,{id:`expedition-complete-modal`,className:`relative w-full max-w-lg p-6 rounded-2xl border-2 shadow-2xl transition-all ${a?`bg-[#1c1813] border-[#594634] text-[#f2e6d5]`:`bg-[#f7efe0] border-[#c8b28f] text-[#332415]`}`,children:[(0,J.jsx)(`button`,{onClick:t,className:`absolute top-4 right-4 p-1.5 rounded-lg opacity-60 hover:opacity-100 hover:bg-black/10 cursor-pointer`,children:(0,J.jsx)(k,{className:`w-5 h-5`})}),(0,J.jsxs)(`div`,{className:`text-center mb-6`,children:[(0,J.jsx)(`div`,{className:`inline-flex p-3 rounded-2xl bg-amber-500/20 border border-amber-500/40 text-amber-500 mb-3 shadow-lg shadow-amber-500/20`,children:(0,J.jsx)(j,{className:`w-10 h-10 animate-bounce`})}),(0,J.jsx)(`h2`,{className:`font-cinzel-dec font-bold text-2xl md:text-3xl text-amber-600 dark:text-amber-400`,children:`Expedition Completed!`}),(0,J.jsxs)(`p`,{className:`font-garamond italic text-sm md:text-base opacity-80 mt-1`,children:[`All `,o,` Waypoints and the entire ancient trail are now fully illuminated.`]})]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 mb-6`,children:[(0,J.jsxs)(`div`,{className:`p-3 rounded-xl bg-amber-500/10 border border-amber-900/15 text-center`,children:[(0,J.jsx)(`span`,{className:`block font-cinzel font-bold text-xl text-amber-600 dark:text-amber-300`,children:o}),(0,J.jsx)(`span`,{className:`font-garamond text-xs opacity-75`,children:`Nodes Solved`})]}),(0,J.jsxs)(`div`,{className:`p-3 rounded-xl bg-amber-500/10 border border-amber-900/15 text-center`,children:[(0,J.jsx)(`span`,{className:`block font-cinzel font-bold text-xl text-amber-600 dark:text-amber-300`,children:`7`}),(0,J.jsx)(`span`,{className:`font-garamond text-xs opacity-75`,children:`Biomes Crossed`})]}),(0,J.jsxs)(`div`,{className:`p-3 rounded-xl bg-amber-500/10 border border-amber-900/15 text-center`,children:[(0,J.jsx)(`span`,{className:`block font-cinzel font-bold text-xl text-amber-600 dark:text-amber-300`,children:`1,620m`}),(0,J.jsx)(`span`,{className:`font-garamond text-xs opacity-75`,children:`Peak Citadel`})]})]}),(0,J.jsxs)(`div`,{className:`space-y-2 mb-6 max-h-48 overflow-y-auto custom-scrollbar pr-1`,children:[n.length>0&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-garamond`,children:[(0,J.jsx)(_,{className:`w-4 h-4 text-emerald-500 flex-shrink-0`}),(0,J.jsx)(`span`,{className:`font-bold`,children:`Waypoint 1:`}),(0,J.jsx)(`span`,{children:n[0].name})]}),n.length>25&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-garamond`,children:[(0,J.jsx)(_,{className:`w-4 h-4 text-emerald-500 flex-shrink-0`}),(0,J.jsx)(`span`,{className:`font-bold`,children:`Waypoint 25:`}),(0,J.jsx)(`span`,{children:n[24].name})]}),n.length>50&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-garamond`,children:[(0,J.jsx)(_,{className:`w-4 h-4 text-emerald-500 flex-shrink-0`}),(0,J.jsx)(`span`,{className:`font-bold`,children:`Waypoint 50:`}),(0,J.jsx)(`span`,{children:n[49].name})]}),n.length>75&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-garamond`,children:[(0,J.jsx)(_,{className:`w-4 h-4 text-emerald-500 flex-shrink-0`}),(0,J.jsx)(`span`,{className:`font-bold`,children:`Waypoint 75:`}),(0,J.jsx)(`span`,{children:n[74].name})]}),n.length>0&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-garamond`,children:[(0,J.jsx)(_,{className:`w-4 h-4 text-emerald-500 flex-shrink-0`}),(0,J.jsx)(`span`,{className:`font-bold`,children:`Final Milestone:`}),(0,J.jsx)(`span`,{className:`text-amber-600 dark:text-amber-300 font-bold`,children:n[n.length-1].name})]})]}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`button`,{onClick:()=>{i(),t()},className:`flex-1 flex items-center justify-center gap-1.5 py-2.5 px-4 rounded-xl border border-stone-400 dark:border-stone-700 font-cinzel font-semibold text-xs transition-all hover:bg-stone-500/10 cursor-pointer`,children:[(0,J.jsx)(l,{className:`w-4 h-4`}),(0,J.jsx)(`span`,{children:`Retrace From Start`})]}),(0,J.jsxs)(`button`,{onClick:t,className:`flex-1 flex items-center justify-center gap-1.5 py-2.5 px-4 rounded-xl bg-amber-600 hover:bg-amber-500 text-white font-cinzel font-bold text-xs shadow-lg transition-all cursor-pointer`,children:[(0,J.jsx)(re,{className:`w-4 h-4`}),(0,J.jsx)(`span`,{children:`Admire Map`})]})]})]})})},Se=``,Ce=({nodes:e,activeNodeIndex:a,setActiveNodeIndex:o,completions:s,theme:c,onToggleCompletion:l,onSelectProblemForReview:d,onSwitchToMap:f,tracks:p,activeTrack:m,onTrackChange:g})=>{let y=c.id!==`parchment`,[b,S]=(0,I.useState)(``),[C,w]=(0,I.useState)(`all`),[D,O]=(0,I.useState)(`all`),[j,M]=(0,I.useState)(`all`),[te,re]=(0,I.useState)(`sequence`),[ie,ae]=(0,I.useState)(null),[N,ce]=(0,I.useState)(null),L=(0,I.useRef)(null),R=(0,I.useMemo)(()=>{let t=new Set;return e.forEach(e=>{let n=F(e.id);n?.pattern&&t.add(n.pattern)}),t.size===0&&oe().forEach(e=>t.add(e)),Array.from(t)},[e]),z=e.length,B=(0,I.useMemo)(()=>e.filter(e=>s.has(e.id)).length,[e,s]),le=z>0?Math.round(B/z*100):0,V=(0,I.useMemo)(()=>{let t=b.trim().toLowerCase(),n=t.replace(/^#/,``);return e.filter(e=>{let r=s.has(e.id);if(C===`solved`&&!r||C===`unsolved`&&r)return!1;let i=F(e.id);if(D!==`all`&&i?.pattern!==D||j!==`all`&&i?.difficulty!==j)return!1;if(t){let r=String(e.id).includes(n),a=String(e.sequenceIndex+1)===n,o=e.name.toLowerCase().includes(t),s=i?.pattern?.toLowerCase().includes(t)??!1,c=i?.difficulty?.toLowerCase().includes(t)??!1;if(!r&&!a&&!o&&!s&&!c)return!1}return!0}).sort((e,t)=>{switch(te){case`number_asc`:return e.id-t.id;case`number_desc`:return t.id-e.id;case`name`:return e.name.localeCompare(t.name);default:return e.sequenceIndex-t.sequenceIndex}})},[e,s,C,D,j,b,te]),H=async e=>{if(N===null){ce(e.id);try{let{data:{session:t}}=await P.auth.getSession(),n={Authorization:`Bearer ${t?t.access_token:`sandbox`}`},r=await fetch(`${Se}/api/reviews/problems/${e.id}`,{headers:n});if(r.ok){let e=await r.json().catch(()=>[]);if(Array.isArray(e)&&e.length>0&&e[0]?.id){d(e[0].id);return}}let i=F(e.id);if(i){let e=await se(i);if(e?.problem_id){d(e.problem_id);return}}d(String(e.id))}catch(t){console.error(`Failed to prepare problem for review:`,t),d(String(e.id))}finally{ce(null)}}};return(0,I.useEffect)(()=>{if(a>=0&&!b&&C===`all`&&D===`all`&&j===`all`){let e=setTimeout(()=>{let e=document.getElementById(`problem-item-${a}`);e&&e.scrollIntoView({behavior:`auto`,block:`center`})},80);return()=>clearTimeout(e)}},[a,b,C,D,j]),(0,J.jsxs)(`div`,{className:`relative w-full h-full flex flex-col overflow-hidden select-none transition-colors duration-300 ${y?`parchment-dark-bg text-[#f4ebd9]`:`parchment-bg text-[#2c2014]`}`,children:[(0,J.jsx)(`div`,{className:`absolute inset-0 pointer-events-none z-10 ${y?`map-dark-vignette`:`map-vignette`}`}),(0,J.jsx)(`div`,{className:`relative z-20 px-4 pt-16 pb-3 border-b backdrop-blur-md transition-colors ${y?`bg-[#1a1612]/90 border-[#4a392b]`:`bg-[#f7efe0]/90 border-[#c8b28f]`}`,children:(0,J.jsxs)(`div`,{className:`max-w-6xl mx-auto space-y-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2.5 items-stretch sm:items-center justify-between`,children:[(0,J.jsxs)(`div`,{className:`relative flex-1`,children:[(0,J.jsx)(`div`,{className:`absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none`,children:(0,J.jsx)(r,{className:`w-4 h-4 text-amber-600 dark:text-amber-400`})}),(0,J.jsx)(`input`,{id:`journey-search-input`,type:`text`,value:b,onChange:e=>S(e.target.value),placeholder:`Search problem title, #number, or pattern (e.g. 1, Two Sum, Two Pointers)...`,className:`w-full pl-9 pr-8 py-2 rounded-xl text-xs md:text-sm font-garamond font-semibold border-2 shadow-inner focus:outline-none transition-all ${y?`bg-[#231e18] border-[#5a4836] text-[#f4ebd9] placeholder-stone-500 focus:border-amber-500/70`:`bg-[#fcf7ee] border-[#cfbc9c] text-[#2c2014] placeholder-stone-500 focus:border-amber-700/60`}`}),b&&(0,J.jsx)(`button`,{onClick:()=>S(``),title:`Clear search`,className:`absolute inset-y-0 right-0 pr-2.5 flex items-center text-stone-400 hover:text-amber-600 cursor-pointer`,children:(0,J.jsx)(k,{className:`w-4 h-4`})})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[p&&p.length>0&&g&&(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-xl border text-xs font-cinzel font-bold shadow-sm ${y?`bg-[#231e18] border-[#5a4836] text-amber-300`:`bg-[#fcf7ee] border-[#cfbc9c] text-amber-900`}`,children:[(0,J.jsx)(i,{className:`w-3.5 h-3.5 text-amber-500 shrink-0`}),(0,J.jsx)(`span`,{className:`text-[10px] uppercase opacity-75 hidden md:inline`,children:`Track:`}),(0,J.jsx)(`select`,{value:m,onChange:e=>g(e.target.value),className:`bg-transparent border-none text-xs font-cinzel font-bold cursor-pointer focus:outline-none`,children:p.map(e=>(0,J.jsx)(`option`,{value:e.id,className:`bg-stone-900 text-stone-200`,children:e.name},e.id))})]}),(0,J.jsxs)(`button`,{onClick:()=>{let e=document.getElementById(`problem-item-${a}`);e&&(e.scrollIntoView({behavior:`smooth`,block:`center`}),q.playPencilScratch())},title:`Scroll to active problem in list`,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-xl border text-xs font-cinzel font-bold transition-all shadow-sm active:scale-95 cursor-pointer ${y?`bg-amber-500/20 border-amber-500/40 text-amber-300 hover:bg-amber-500/30`:`bg-amber-600/15 border-amber-600/30 text-amber-900 hover:bg-amber-600/25`}`,children:[(0,J.jsx)(E,{className:`w-3.5 h-3.5 text-amber-500`}),(0,J.jsx)(`span`,{className:`hidden sm:inline`,children:`Current Problem`}),(0,J.jsxs)(`span`,{className:`font-mono text-[11px]`,children:[`#`,a+1]})]})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2.5 pt-1 text-xs`,children:[(0,J.jsx)(`div`,{className:`flex items-center gap-1`,children:[`all`,`solved`,`unsolved`].map(e=>{let t=C===e,n=e===`all`?z:e===`solved`?B:z-B;return(0,J.jsxs)(`button`,{onClick:()=>w(e),className:`px-2.5 py-1 rounded-lg font-cinzel text-xs font-bold capitalize transition-all cursor-pointer border ${t?`bg-amber-600 border-amber-500 text-white shadow-sm`:y?`bg-[#231e18] border-[#4a392b] text-stone-400 hover:text-stone-200`:`bg-[#fcf7ee] border-[#cfbc9c] text-stone-600 hover:text-stone-900`}`,children:[e,` `,(0,J.jsxs)(`span`,{className:`text-[10px] opacity-80`,children:[`(`,n,`)`]})]},e)})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1 rounded-lg border text-xs font-garamond font-semibold ${y?`bg-[#231e18] border-[#4a392b] text-stone-300`:`bg-[#fcf7ee] border-[#cfbc9c] text-stone-800`}`,children:[(0,J.jsx)(h,{className:`w-3 h-3 text-amber-500`}),(0,J.jsx)(`span`,{className:`text-[10px] font-cinzel uppercase opacity-75`,children:`Pattern:`}),(0,J.jsxs)(`select`,{value:D,onChange:e=>O(e.target.value),className:`bg-transparent border-none text-xs font-garamond font-bold cursor-pointer focus:outline-none max-w-[150px] truncate`,children:[(0,J.jsxs)(`option`,{value:`all`,className:`bg-stone-900 text-stone-200`,children:[`All Patterns (`,R.length,`)`]}),R.map(e=>(0,J.jsx)(`option`,{value:e,className:`bg-stone-900 text-stone-200`,children:e},e))]})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1 rounded-lg border text-xs font-garamond font-semibold ${y?`bg-[#231e18] border-[#4a392b] text-stone-300`:`bg-[#fcf7ee] border-[#cfbc9c] text-stone-800`}`,children:[(0,J.jsx)(`span`,{className:`text-[10px] font-cinzel uppercase opacity-75`,children:`Diff:`}),(0,J.jsxs)(`select`,{value:j,onChange:e=>M(e.target.value),className:`bg-transparent border-none text-xs font-garamond font-bold cursor-pointer focus:outline-none`,children:[(0,J.jsx)(`option`,{value:`all`,className:`bg-stone-900 text-stone-200`,children:`All`}),(0,J.jsx)(`option`,{value:`Easy`,className:`bg-stone-900 text-stone-200`,children:`Easy`}),(0,J.jsx)(`option`,{value:`Medium`,className:`bg-stone-900 text-stone-200`,children:`Medium`}),(0,J.jsx)(`option`,{value:`Hard`,className:`bg-stone-900 text-stone-200`,children:`Hard`})]})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1 rounded-lg border text-xs font-garamond font-semibold ${y?`bg-[#231e18] border-[#4a392b] text-stone-300`:`bg-[#fcf7ee] border-[#cfbc9c] text-stone-800`}`,children:[(0,J.jsx)(ne,{className:`w-3 h-3 text-amber-500`}),(0,J.jsx)(`span`,{className:`text-[10px] font-cinzel uppercase opacity-75`,children:`Sort:`}),(0,J.jsxs)(`select`,{value:te,onChange:e=>re(e.target.value),className:`bg-transparent border-none text-xs font-garamond font-bold cursor-pointer focus:outline-none`,children:[(0,J.jsx)(`option`,{value:`sequence`,className:`bg-stone-900 text-stone-200`,children:`Track Sequence`}),(0,J.jsx)(`option`,{value:`number_asc`,className:`bg-stone-900 text-stone-200`,children:`Problem # (Asc)`}),(0,J.jsx)(`option`,{value:`number_desc`,className:`bg-stone-900 text-stone-200`,children:`Problem # (Desc)`}),(0,J.jsx)(`option`,{value:`name`,className:`bg-stone-900 text-stone-200`,children:`Title (A-Z)`})]})]})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`font-garamond italic text-xs opacity-80`,children:[`Showing `,V.length,` of `,z]}),(0,J.jsx)(`div`,{className:`w-20 sm:w-28 h-2 rounded-full bg-black/20 overflow-hidden border border-amber-900/20`,children:(0,J.jsx)(`div`,{className:`h-full bg-gradient-to-r from-amber-500 to-emerald-500 transition-all duration-500`,style:{width:`${le}%`}})}),(0,J.jsxs)(`span`,{className:`font-cinzel text-[10px] font-bold text-emerald-600 dark:text-emerald-400`,children:[le,`%`]})]})]})]})}),(0,J.jsx)(`div`,{ref:L,className:`relative z-20 flex-1 overflow-y-auto px-4 py-4 custom-scrollbar`,children:(0,J.jsx)(`div`,{className:`max-w-6xl mx-auto space-y-2.5 pb-8`,children:V.length===0?(0,J.jsxs)(`div`,{className:`p-10 text-center rounded-2xl border-2 border-dashed my-8 transition-colors ${y?`border-amber-900/40 bg-[#1e1914]/60 text-stone-400`:`border-amber-900/20 bg-[#f9f2e3]/80 text-stone-600`}`,children:[(0,J.jsx)(u,{className:`w-10 h-10 mx-auto mb-3 text-amber-500 opacity-60`}),(0,J.jsx)(`h3`,{className:`font-cinzel font-bold text-base text-amber-700 dark:text-amber-400 mb-1`,children:`No Problems Found`}),(0,J.jsxs)(`p`,{className:`font-garamond italic text-sm max-w-md mx-auto mb-4`,children:[`No problems matched "`,b||`the current filter settings`,`". Try adjusting your search keywords or filter criteria.`]}),(b||C!==`all`||D!==`all`||j!==`all`)&&(0,J.jsx)(`button`,{onClick:()=>{S(``),w(`all`),O(`all`),M(`all`)},className:`px-4 py-1.5 rounded-xl bg-amber-600 hover:bg-amber-500 text-white font-cinzel text-xs font-bold transition-all shadow cursor-pointer`,children:`Clear All Filters`})]}):V.map(e=>{let r=s.has(e.id),i=e.sequenceIndex===a,c=ie===e.id,u=F(e.id),d=u?.difficulty,p=u?.pattern;return(0,J.jsxs)(`div`,{id:`problem-item-${e.sequenceIndex}`,className:`group relative rounded-xl border-2 transition-all duration-200 shadow-md ${i?y?`bg-[#2c2217] border-amber-500/80 shadow-amber-500/20 shadow-lg ring-1 ring-amber-500/40`:`bg-[#fffaf0] border-amber-700 shadow-amber-700/20 shadow-lg ring-1 ring-amber-700/30`:y?`bg-[#1f1a14]/90 border-[#4a392b] hover:border-amber-600/50 hover:bg-[#251f18]`:`bg-[#fcf8ef]/95 border-[#c8b28f] hover:border-amber-700/60 hover:bg-[#fcf5e6]`}`,children:[i&&(0,J.jsxs)(`div`,{className:`absolute -top-2.5 left-4 px-2 py-0.5 rounded-md bg-amber-600 text-white font-cinzel text-[9px] font-bold tracking-wider uppercase flex items-center gap-1 shadow`,children:[(0,J.jsx)(E,{className:`w-2.5 h-2.5 text-amber-200`}),`Current Problem`]}),(0,J.jsxs)(`div`,{className:`p-3 sm:p-3.5 flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-start sm:items-center gap-3 min-w-0 flex-1`,children:[(0,J.jsx)(`button`,{onClick:()=>{l(e.id)},title:r?`Mark as Unsolved`:`Mark as Solved`,className:`mt-0.5 sm:mt-0 p-1 rounded-lg hover:bg-black/10 dark:hover:bg-white/10 transition-colors cursor-pointer shrink-0`,children:r?(0,J.jsx)(_,{className:`w-5 h-5 text-emerald-500 transition-transform active:scale-125`}):(0,J.jsx)(T,{className:`w-5 h-5 text-stone-400 hover:text-amber-600 transition-colors`})}),(0,J.jsxs)(`div`,{className:`px-2 py-1 rounded-lg border font-cinzel text-[11px] font-bold text-center shrink-0 min-w-[54px] ${i?`bg-amber-500/20 border-amber-500 text-amber-500`:y?`bg-black/30 border-[#4a392b] text-stone-400`:`bg-amber-900/5 border-[#c8b28f] text-stone-600`}`,children:[(0,J.jsx)(`span`,{className:`text-[9px] block uppercase opacity-75 leading-none`,children:`Seq`}),(0,J.jsxs)(`span`,{children:[`#`,e.sequenceIndex+1]})]}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,J.jsx)(`span`,{className:`px-1.5 py-0.5 rounded font-mono text-[10px] font-bold ${y?`bg-[#2d251d] text-amber-400 border border-amber-900/50`:`bg-amber-900/10 text-amber-900 border border-amber-900/20`}`,children:e.id>0?`LC #${e.id}`:`Custom`}),d&&(0,J.jsx)(`span`,{className:`px-1.5 py-0.5 rounded font-cinzel text-[9px] font-bold uppercase tracking-wider border ${d===`Easy`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/30`:d===`Medium`?`bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/30`:`bg-rose-500/10 text-rose-600 dark:text-rose-400 border-rose-500/30`}`,children:d}),p&&(0,J.jsx)(`span`,{className:`px-1.5 py-0.5 rounded font-cinzel text-[9px] font-medium border ${y?`bg-purple-950/30 text-purple-300 border-purple-800/40`:`bg-purple-50 text-purple-800 border-purple-200`}`,children:p}),(0,J.jsx)(`h4`,{onClick:()=>{o(e.sequenceIndex),q.playNodeLightUp(e.sequenceIndex,z)},className:`font-garamond font-bold text-sm sm:text-base leading-tight truncate cursor-pointer hover:underline ${i?`text-amber-700 dark:text-amber-300 font-bold`:y?`text-stone-200 hover:text-amber-300`:`text-stone-900 hover:text-amber-800`}`,children:e.name}),r&&(0,J.jsx)(`span`,{className:`text-[9px] font-cinzel font-bold px-1.5 py-0.5 rounded bg-emerald-500/15 text-emerald-600 dark:text-emerald-400 border border-emerald-500/30`,children:`✓ Solved`})]}),(u?.time_complexity||u?.space_complexity)&&(0,J.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap mt-1 text-[11px] font-mono`,children:[u.time_complexity&&(0,J.jsxs)(`span`,{className:`opacity-80`,children:[`Time:`,` `,(0,J.jsx)(`span`,{className:`text-amber-600 dark:text-amber-400 font-semibold`,children:u.time_complexity})]}),u.space_complexity&&(0,J.jsxs)(`span`,{className:`opacity-80`,children:[`Space:`,` `,(0,J.jsx)(`span`,{className:`text-purple-600 dark:text-purple-400 font-semibold`,children:u.space_complexity})]})]})]})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 self-end sm:self-center pl-10 sm:pl-0`,children:[(0,J.jsxs)(`button`,{onClick:()=>{o(e.sequenceIndex),q.playNodeLightUp(e.sequenceIndex,z),f(e.sequenceIndex)},title:`View Problem on Hand-Drawn Map`,className:`flex items-center gap-1 px-2.5 py-1.5 rounded-lg border text-xs font-cinzel font-bold transition-all shadow-sm active:scale-95 cursor-pointer ${y?`bg-amber-500/15 border-amber-500/40 text-amber-300 hover:bg-amber-500/25`:`bg-amber-700/10 border-amber-700/30 text-amber-900 hover:bg-amber-700/20`}`,children:[(0,J.jsx)(n,{className:`w-3.5 h-3.5 text-amber-500`}),(0,J.jsx)(`span`,{className:`hidden md:inline`,children:`Map`})]}),(0,J.jsxs)(`button`,{onClick:()=>H(e),disabled:N===e.id,title:`Launch Spaced Repetition Review for this problem`,className:`flex items-center gap-1 px-2.5 py-1.5 rounded-lg bg-amber-600 hover:bg-amber-500 disabled:opacity-50 text-white text-xs font-cinzel font-bold shadow-sm transition-all active:scale-95 cursor-pointer`,children:[N===e.id?(0,J.jsx)(t,{className:`w-3.5 h-3.5 animate-spin`}):(0,J.jsx)(v,{className:`w-3.5 h-3.5`}),(0,J.jsx)(`span`,{className:`hidden md:inline`,children:N===e.id?`Loading...`:`Review`})]}),(0,J.jsx)(`a`,{href:u?.leetcode_url||(e.id>0?`https://leetcode.com/problemset/?search=${e.id}`:`https://www.google.com/search?q=${encodeURIComponent(e.name)}`),target:`_blank`,rel:`noreferrer`,title:`Open Problem on LeetCode`,className:`p-1.5 rounded-lg border transition-all cursor-pointer ${y?`border-stone-700 text-stone-400 hover:text-stone-200 hover:bg-white/5`:`border-stone-300 text-stone-600 hover:text-stone-900 hover:bg-black/5`}`,children:(0,J.jsx)(A,{className:`w-3.5 h-3.5`})}),(0,J.jsx)(`button`,{onClick:()=>{ae(c?null:e.id),c||o(e.sequenceIndex)},title:c?`Hide Problem Details`:`View Problem Details`,className:`p-1.5 rounded-lg border transition-all cursor-pointer ${c?`bg-amber-600/20 border-amber-500 text-amber-500`:y?`border-stone-700 text-stone-400 hover:text-stone-200`:`border-stone-300 text-stone-600 hover:text-stone-900`}`,children:c?(0,J.jsx)(x,{className:`w-3.5 h-3.5`}):(0,J.jsx)(ee,{className:`w-3.5 h-3.5`})})]})]}),c&&(0,J.jsx)(`div`,{className:`px-4 py-3 border-t text-xs font-garamond animate-fade-in ${y?`border-amber-900/40 bg-black/20 text-stone-300`:`border-amber-900/15 bg-amber-950/5 text-stone-700`}`,children:(0,J.jsxs)(`div`,{className:`space-y-3`,children:[u?.description?(0,J.jsxs)(`div`,{className:`p-3 rounded border border-amber-900/20 bg-amber-900/5 dark:bg-black/30 font-sans text-xs sm:text-[13px] leading-relaxed whitespace-pre-line text-stone-700 dark:text-stone-300`,children:[(0,J.jsx)(`div`,{className:`font-cinzel font-bold text-amber-600 dark:text-amber-400 text-[10px] uppercase mb-1 tracking-wider`,children:`Canonical Problem Description`}),u.description]}):(0,J.jsx)(`p`,{className:`italic text-stone-500`,children:`Review this problem in CodeStudio to access the full starter code, test suites, and review queue.`}),u?.examples&&u.examples.length>0&&(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`div`,{className:`font-cinzel font-bold text-amber-600 dark:text-amber-400 text-[10px] uppercase tracking-wider`,children:`Examples`}),(0,J.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2`,children:u.examples.map((e,t)=>(0,J.jsxs)(`div`,{className:`p-2.5 rounded border border-stone-300/40 dark:border-stone-700/50 bg-black/5 dark:bg-black/30 font-mono text-[11px] space-y-1`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`span`,{className:`text-stone-500`,children:`Input: `}),(0,J.jsx)(`span`,{className:`font-semibold text-amber-700 dark:text-amber-300`,children:e.input})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`span`,{className:`text-stone-500`,children:`Output: `}),(0,J.jsx)(`span`,{className:`font-semibold text-emerald-600 dark:text-emerald-400`,children:e.output})]}),e.explanation&&(0,J.jsx)(`div`,{className:`text-[10px] text-stone-500 italic font-sans pt-0.5`,children:e.explanation})]},t))})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-4 text-[11px] pt-1 opacity-85 flex-wrap border-t border-stone-400/20 dark:border-stone-700/30`,children:[p&&(0,J.jsxs)(`span`,{children:[`Pattern: `,(0,J.jsx)(`strong`,{className:`font-cinzel text-amber-600 dark:text-amber-400`,children:p})]}),d&&(0,J.jsxs)(`span`,{children:[`Difficulty: `,(0,J.jsx)(`strong`,{children:d})]}),u?.time_complexity&&(0,J.jsxs)(`span`,{children:[`Time: `,(0,J.jsx)(`strong`,{className:`font-mono text-amber-600 dark:text-amber-400`,children:u.time_complexity})]}),u?.space_complexity&&(0,J.jsxs)(`span`,{children:[`Space: `,(0,J.jsx)(`strong`,{className:`font-mono text-purple-600 dark:text-purple-400`,children:u.space_complexity})]}),u?.constraints&&u.constraints.length>0&&(0,J.jsxs)(`span`,{children:[`Constraints: `,(0,J.jsx)(`strong`,{className:`font-mono text-[10px]`,children:u.constraints.join(` • `)})]})]})]})})]},e.id)})})})]})},X=``;async function Z(e,t){if(!e.ok||!(e.headers.get(`content-type`)||``).includes(`application/json`))return t;try{return await e.json()}catch{return t}}function Q({onSelectProblemForReview:e}){let[n,r]=(0,I.useState)(new Set),[i,a]=(0,I.useState)({}),[o,s]=(0,I.useState)([]),[c,l]=(0,I.useState)([]),[u,d]=(0,I.useState)(()=>localStorage.getItem(`algospaced_active_track`)||`leetcode-150`),[p,m]=(0,I.useState)(!0),[h,g]=(0,I.useState)(0),[_,v]=(0,I.useState)(null),[y,b]=(0,I.useState)([]),[x,S]=(0,I.useState)(!1),[w,T]=(0,I.useState)(!1),[E,D]=(0,I.useState)(`parchment`),[O,k]=(0,I.useState)(`map`),[A,j]=(0,I.useState)(!0),[M,ee]=(0,I.useState)(!0),[ne,re]=(0,I.useState)(!0),[ie,N]=(0,I.useState)(!1),[oe,se]=(0,I.useState)(!1),[F,z]=(0,I.useState)(!1),[B,V]=(0,I.useState)(!0),H=ue[E]||ue.parchment,[U,W]=(0,I.useState)({x:0,y:0,scale:.5}),G=(0,I.useMemo)(()=>le(o,i),[o,i]),K=G.length,Y=h>=0&&h{q.setEnabled(A)},[A]);let de=async()=>{try{let{data:{session:e}}=await P.auth.getSession(),t={Authorization:`Bearer ${e?e.access_token:`sandbox`}`},n=localStorage.getItem(`algospaced_active_track`)||`leetcode-150`,[i,o,c,u]=await Promise.all([fetch(`${X}/api/journey-progress`,{headers:t}),fetch(`${X}/api/journey-progress/titles`,{headers:t}),fetch(`${X}/api/journey-progress/sequences`,{headers:t}),fetch(`${X}/api/journey-progress/sequence/${n}`,{headers:t})]),[d,f,p,m]=await Promise.all([Z(i,[]),Z(o,{}),Z(c,[]),Z(u,[])]),h=new Set(d);r(h),a(f),l(p),s(m);let _=m.findIndex(e=>!h.has(e));g(_>=0?_:0)}catch(e){console.error(`Error fetching journey data:`,e)}finally{m(!1)}};(0,I.useEffect)(()=>{de()},[]);let fe=(0,I.useCallback)(async e=>{b([]),S(!0);try{let{data:{session:t}}=await P.auth.getSession(),n=t?t.access_token:`sandbox`,r=await Z(await fetch(`${X}/api/reviews/problems/${e}`,{headers:{Authorization:`Bearer ${n}`}}),[]);b(r)}catch(e){console.error(`Error fetching problem details:`,e)}finally{S(!1)}},[]);(0,I.useEffect)(()=>{Y&&fe(Y.id)},[Y?.id,fe]);let pe=async e=>{m(!0),d(e),localStorage.setItem(`algospaced_active_track`,e);try{let{data:{session:t}}=await P.auth.getSession(),r={Authorization:`Bearer ${t?t.access_token:`sandbox`}`},i=await Z(await fetch(`${X}/api/journey-progress/sequence/${e}`,{headers:r}),[]);if(i.length>0){s(i);let e=i.findIndex(e=>!n.has(e));g(e>=0?e:0)}}catch(e){console.error(`Error switching track:`,e)}finally{m(!1)}},me=(0,I.useCallback)(()=>{g(e=>{if(e{g(e=>e>0?(q.playPencilScratch(),e-1):0)},[]),ge=(0,I.useCallback)(e=>{let t=Math.max(0,Math.min(K-1,e));g(t),q.playNodeLightUp(t,K),t===K-1&&q.playVictoryChime()},[K]),_e=(0,I.useCallback)(()=>{g(0),q.playPencilScratch()},[]),Se=async e=>{T(!0);try{let{data:{session:t}}=await P.auth.getSession(),i=t?t.access_token:`sandbox`;if((await fetch(`${X}/api/journey-progress/toggle`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${i}`},body:JSON.stringify({problem_number:e})})).ok){let t=new Set(n);t.has(e)?(t.delete(e),q.playPencilScratch()):(t.add(e),q.playNodeLightUp(h,K),o.every(e=>t.has(e))&&(q.playVictoryChime(),ce({particleCount:130,spread:85,origin:{y:.6},colors:[`#10b981`,`#34d399`,`#f59e0b`,`#ffffff`]}),z(!0))),r(t)}}catch(e){console.error(`Error toggling progress:`,e)}finally{T(!1)}};(0,I.useEffect)(()=>{let e=e=>{let t=e.target;[`INPUT`,`TEXTAREA`,`SELECT`].includes(t?.tagName)||t?.isContentEditable||O===`map`&&(e.code===`Space`||e.code===`ArrowRight`||e.code===`ArrowDown`?(e.preventDefault(),me()):e.code===`ArrowLeft`||e.code===`ArrowUp`?(e.preventDefault(),he()):e.code===`KeyR`&&(e.preventDefault(),_e()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[me,he,_e,O]);let Q=(0,I.useRef)(null),we=(0,I.useCallback)(()=>{let e=Q.current?.clientWidth||window.innerWidth,t=Q.current?.clientHeight||window.innerHeight,n=e/2,r=t/2;W(e=>{let t=Math.min(e.scale*1.25,3.5);return{scale:t,x:n-(n-e.x)/e.scale*t,y:r-(r-e.y)/e.scale*t}})},[]),Te=(0,I.useCallback)(()=>{let e=Q.current?.clientWidth||window.innerWidth,t=Q.current?.clientHeight||window.innerHeight,n=e/2,r=t/2;W(e=>{let t=Math.max(e.scale*.8,.08);return{scale:t,x:n-(n-e.x)/e.scale*t,y:r-(r-e.y)/e.scale*t}})},[]),Ee=(0,I.useCallback)(()=>{let e=Q.current?.clientWidth||window.innerWidth,t=Q.current?.clientHeight||window.innerHeight,n=e/L,r=t/R,i=Math.min(n,r)*.9;W({x:(e-L*i)/2,y:(t-R*i)/2,scale:i})},[]),De=(0,I.useCallback)(()=>{if(!Y)return;let e=Q.current?.clientWidth||window.innerWidth,t=Q.current?.clientHeight||window.innerHeight,n=Math.max(U.scale,.95);W({x:e/2-Y.x*n,y:t/2-Y.y*n,scale:n})},[Y,U.scale]),Oe=(0,I.useCallback)(e=>{if(k(`map`),typeof e==`number`&&e>=0&&ek(`map`),title:`Hand-Drawn Cartography Map`,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg font-cinzel text-xs font-bold transition-all cursor-pointer ${O===`map`?`bg-amber-600 text-white shadow-sm`:$?`text-stone-400 hover:text-stone-200`:`text-stone-600 hover:text-stone-900`}`,children:[(0,J.jsx)(ae,{className:`w-3.5 h-3.5`}),(0,J.jsx)(`span`,{children:`Map`})]}),(0,J.jsxs)(`button`,{id:`view-mode-list-btn`,onClick:()=>k(`list`),title:`Problem List View`,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg font-cinzel text-xs font-bold transition-all cursor-pointer ${O===`list`?`bg-amber-600 text-white shadow-sm`:$?`text-stone-400 hover:text-stone-200`:`text-stone-600 hover:text-stone-900`}`,children:[(0,J.jsx)(f,{className:`w-3.5 h-3.5`}),(0,J.jsx)(`span`,{children:`List`})]})]}),O===`map`&&(0,J.jsxs)(`button`,{id:`toggle-journal-btn`,onClick:()=>V(e=>!e),title:`Toggle Explorer Field Notes Journal`,className:`flex items-center gap-1.5 px-3 py-2 rounded-xl border-2 shadow-lg backdrop-blur-md font-cinzel text-xs font-bold transition-all cursor-pointer ${B?`bg-amber-600 border-amber-400 text-white`:$?`bg-[#1a1612]/90 border-[#4a392b] text-[#e2d5c2]`:`bg-[#f7efe0]/95 border-[#c8b28f] text-[#332415]`}`,children:[(0,J.jsx)(te,{className:`w-4 h-4`}),(0,J.jsx)(`span`,{className:`hidden sm:inline`,children:`Journal`})]})]})]}),O===`map`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`main`,{ref:Q,className:`relative flex-1 w-full h-full`,children:[(0,J.jsx)(ve,{nodes:G,activeNodeIndex:h,completions:n,theme:H,showLabels:ne,showGrid:ie,showNodeNumbers:oe,autoCenterOnActive:M,onNodeClick:ge,hoveredNodeIndex:_,setHoveredNodeIndex:v,transform:U,setTransform:W}),B&&(0,J.jsx)(`aside`,{className:`absolute top-16 left-2.5 z-30 w-72 md:w-84 pointer-events-auto transition-all animate-fade-in`,children:(0,J.jsx)(be,{node:Y,activeNodeIndex:h,totalNodes:K,theme:H,onAdvance:me,onRetreat:he,details:y,modalLoading:x,isCompleted:Y?n.has(Y.id):!1,toggleLoading:w,onToggleCompletion:Se,onSelectProblemForReview:e})})]}),(0,J.jsx)(`footer`,{className:`absolute bottom-2.5 left-2.5 right-2.5 z-30 pointer-events-auto max-w-5xl mx-auto w-[calc(100%-1.25rem)]`,children:(0,J.jsx)(ye,{theme:H,soundEnabled:A,autoCenterOnActive:M,showLabels:ne,showGrid:ie,showNodeNumbers:oe,tracks:c,activeTrack:u,onTrackChange:pe,onToggleSound:()=>j(e=>!e),onToggleAutoCenter:()=>ee(e=>!e),onToggleLabels:()=>re(e=>!e),onToggleGrid:()=>N(e=>!e),onToggleNodeNumbers:()=>se(e=>!e),onToggleTheme:()=>D(e=>e===`parchment`?`dark_parchment`:`parchment`),onZoomIn:we,onZoomOut:Te,onResetZoom:Ee,onCenterActiveNode:De})})]}):(0,J.jsx)(`main`,{className:`relative flex-1 w-full h-full overflow-hidden`,children:(0,J.jsx)(Ce,{nodes:G,activeNodeIndex:h,setActiveNodeIndex:g,completions:n,theme:H,onToggleCompletion:Se,onSelectProblemForReview:e,onSwitchToMap:Oe,tracks:c,activeTrack:u,onTrackChange:pe,onToggleTheme:()=>D(e=>e===`parchment`?`dark_parchment`:`parchment`)})}),(0,J.jsx)(xe,{isOpen:F,onClose:()=>z(!1),nodes:G,theme:H,onReset:_e})]})}export{Q as default}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/KatexRenderer-DnoTdlgI.js b/algospaced-ui/dist/assets/KatexRenderer-S2ExKuPO.js similarity index 88% rename from algospaced-ui/dist/assets/KatexRenderer-DnoTdlgI.js rename to algospaced-ui/dist/assets/KatexRenderer-S2ExKuPO.js index 813435b00c1998e3d32b5cb0b926cf3708192089..effdbfd6fd894adb9b61b2b8b70a918fce191b70 100644 --- a/algospaced-ui/dist/assets/KatexRenderer-DnoTdlgI.js +++ b/algospaced-ui/dist/assets/KatexRenderer-S2ExKuPO.js @@ -1 +1 @@ -import"./rolldown-runtime-hePW80VL.js";import{Lt as e,zt as t}from"./vendor-react-qmUj3JUi.js";import{t as n}from"./vendor-katex-Balf574a.js";t();var r=e(),i=({math:e,displayMode:t=!1,className:i=``})=>{let a=``;try{a=n.renderToString(e.trim(),{displayMode:t,throwOnError:!1,output:`html`})}catch{a=`${e.replace(/&/g,`&`).replace(//g,`>`)}`}return(0,r.jsx)(`span`,{className:i,dangerouslySetInnerHTML:{__html:a}})};export{i as KatexRenderer,i as default}; \ No newline at end of file +import"./rolldown-runtime-hePW80VL.js";import{Lt as e,zt as t}from"./vendor-react-q-oOktF_.js";import{t as n}from"./vendor-katex-Balf574a.js";t();var r=e(),i=({math:e,displayMode:t=!1,className:i=``})=>{let a=``;try{a=n.renderToString(e.trim(),{displayMode:t,throwOnError:!1,output:`html`})}catch{a=`${e.replace(/&/g,`&`).replace(//g,`>`)}`}return(0,r.jsx)(`span`,{className:i,dangerouslySetInnerHTML:{__html:a}})};export{i as KatexRenderer,i as default}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/MarkdownRenderer-CC5nUs7-.js b/algospaced-ui/dist/assets/MarkdownRenderer-cD9l7avV.js similarity index 95% rename from algospaced-ui/dist/assets/MarkdownRenderer-CC5nUs7-.js rename to algospaced-ui/dist/assets/MarkdownRenderer-cD9l7avV.js index d97b5363101fd516a5a32e913e4c87e95b50f431..4cd769037dbe3241b37615243fb6e3edddc09af3 100644 --- a/algospaced-ui/dist/assets/MarkdownRenderer-CC5nUs7-.js +++ b/algospaced-ui/dist/assets/MarkdownRenderer-cD9l7avV.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KatexRenderer-DnoTdlgI.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-react-qmUj3JUi.js","assets/vendor-codemirror-By0wlJeM.js","assets/vendor-katex-Balf574a.js","assets/vendor-katex-DtkCqjBQ.css"])))=>i.map(i=>d[i]); -import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Lt as t,zt as n}from"./vendor-react-qmUj3JUi.js";import{t as r}from"./index-DYMSjoUb.js";var i=e(n(),1),a=t(),o=(0,i.lazy)(()=>r(()=>import(`./KatexRenderer-DnoTdlgI.js`),__vite__mapDeps([0,1,2,3,4,5])));function s(e){return e?e.split(/(\$\$[\s\S]*?\$\$|\\\[[\s\S]*?\\\]|\\\([\s\S]*?\\\)|\$(?:\\\$|[^$\n])+?\$|`[^`\n]+`|\*\*[^*\n]+\*\*|__[^_\n]+__|(?{if(!e)return null;if(e.startsWith(`$$`)&&e.endsWith(`$$`)&&e.length>=4){let n=e.slice(2,-2);return n.trim()?(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(`span`,{className:`font-mono text-xs opacity-75`,children:n}),children:(0,a.jsx)(o,{math:n,displayMode:!0,className:`inline-block my-1 px-1 overflow-x-auto align-middle`})},t):e}if(e.startsWith(`\\[`)&&e.endsWith(`\\]`)&&e.length>=4){let n=e.slice(2,-2);return n.trim()?(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(`span`,{className:`font-mono text-xs opacity-75`,children:n}),children:(0,a.jsx)(o,{math:n,displayMode:!0,className:`inline-block my-1 px-1 overflow-x-auto align-middle`})},t):e}if(e.startsWith(`\\(`)&&e.endsWith(`\\)`)&&e.length>=4){let n=e.slice(2,-2);return n.trim()?(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(`span`,{className:`font-mono text-xs opacity-75`,children:n}),children:(0,a.jsx)(o,{math:n,displayMode:!1,className:`inline-katex px-0.5 align-baseline`})},t):e}if(e.startsWith(`$`)&&e.endsWith(`$`)&&e.length>=2){let n=e.slice(1,-1);return n.trim()?(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(`span`,{className:`font-mono text-xs opacity-75`,children:n}),children:(0,a.jsx)(o,{math:n,displayMode:!1,className:`inline-katex px-0.5 align-baseline`})},t):e}if(e.startsWith("`")&&e.endsWith("`")&&e.length>=2)return(0,a.jsx)(`code`,{className:`bg-[#1E293B] text-[#4ADE80] px-1.5 py-0.5 rounded text-[11px] font-mono border border-ink-black shadow-[1px_1px_0px_0px_#000]`,children:e.slice(1,-1)},t);if(e.startsWith(`**`)&&e.endsWith(`**`)&&e.length>=4||e.startsWith(`__`)&&e.endsWith(`__`)&&e.length>=4)return(0,a.jsx)(`strong`,{className:`text-ink-black font-extrabold`,children:s(e.slice(2,-2))},t);if(e.startsWith(`*`)&&e.endsWith(`*`)&&e.length>=2||e.startsWith(`_`)&&e.endsWith(`_`)&&e.length>=2)return(0,a.jsx)(`em`,{className:`italic text-slate-800`,children:s(e.slice(1,-1))},t);let n=e.match(/^\[([^\]]+)\]\(([^)]+)\)$/);return n?(0,a.jsx)(`a`,{href:n[2],target:`_blank`,rel:`noopener noreferrer`,className:`text-primary underline hover:text-primary/80 font-bold`,children:n[1]},t):e}):[]}var c=(0,i.lazy)(()=>r(()=>import(`./KatexRenderer-DnoTdlgI.js`),__vite__mapDeps([0,1,2,3,4,5]))),l=({content:e,className:t=``})=>{if(!e)return null;let n=e.split(/(```[\s\S]*?```|\$\$[\s\S]*?\$\$|\\\[[\s\S]*?\\\])/g);return(0,a.jsx)(`div`,{className:`markdown-content space-y-2.5 text-ink-black text-xs leading-relaxed font-sans ${t}`,children:n.map((e,t)=>{if(!e)return null;let n=e.trim();if(n.startsWith("```")&&n.endsWith("```")&&n.length>=6){let e=n.indexOf(` +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KatexRenderer-S2ExKuPO.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-react-q-oOktF_.js","assets/vendor-codemirror-By0wlJeM.js","assets/vendor-katex-Balf574a.js","assets/vendor-katex-DtkCqjBQ.css"])))=>i.map(i=>d[i]); +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Lt as t,zt as n}from"./vendor-react-q-oOktF_.js";import{t as r}from"./index-Bcgsshpk.js";var i=e(n(),1),a=t(),o=(0,i.lazy)(()=>r(()=>import(`./KatexRenderer-S2ExKuPO.js`),__vite__mapDeps([0,1,2,3,4,5])));function s(e){return e?e.split(/(\$\$[\s\S]*?\$\$|\\\[[\s\S]*?\\\]|\\\([\s\S]*?\\\)|\$(?:\\\$|[^$\n])+?\$|`[^`\n]+`|\*\*[^*\n]+\*\*|__[^_\n]+__|(?{if(!e)return null;if(e.startsWith(`$$`)&&e.endsWith(`$$`)&&e.length>=4){let n=e.slice(2,-2);return n.trim()?(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(`span`,{className:`font-mono text-xs opacity-75`,children:n}),children:(0,a.jsx)(o,{math:n,displayMode:!0,className:`inline-block my-1 px-1 overflow-x-auto align-middle`})},t):e}if(e.startsWith(`\\[`)&&e.endsWith(`\\]`)&&e.length>=4){let n=e.slice(2,-2);return n.trim()?(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(`span`,{className:`font-mono text-xs opacity-75`,children:n}),children:(0,a.jsx)(o,{math:n,displayMode:!0,className:`inline-block my-1 px-1 overflow-x-auto align-middle`})},t):e}if(e.startsWith(`\\(`)&&e.endsWith(`\\)`)&&e.length>=4){let n=e.slice(2,-2);return n.trim()?(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(`span`,{className:`font-mono text-xs opacity-75`,children:n}),children:(0,a.jsx)(o,{math:n,displayMode:!1,className:`inline-katex px-0.5 align-baseline`})},t):e}if(e.startsWith(`$`)&&e.endsWith(`$`)&&e.length>=2){let n=e.slice(1,-1);return n.trim()?(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(`span`,{className:`font-mono text-xs opacity-75`,children:n}),children:(0,a.jsx)(o,{math:n,displayMode:!1,className:`inline-katex px-0.5 align-baseline`})},t):e}if(e.startsWith("`")&&e.endsWith("`")&&e.length>=2)return(0,a.jsx)(`code`,{className:`bg-[#1E293B] text-[#4ADE80] px-1.5 py-0.5 rounded text-[11px] font-mono border border-ink-black shadow-[1px_1px_0px_0px_#000]`,children:e.slice(1,-1)},t);if(e.startsWith(`**`)&&e.endsWith(`**`)&&e.length>=4||e.startsWith(`__`)&&e.endsWith(`__`)&&e.length>=4)return(0,a.jsx)(`strong`,{className:`text-ink-black font-extrabold`,children:s(e.slice(2,-2))},t);if(e.startsWith(`*`)&&e.endsWith(`*`)&&e.length>=2||e.startsWith(`_`)&&e.endsWith(`_`)&&e.length>=2)return(0,a.jsx)(`em`,{className:`italic text-slate-800`,children:s(e.slice(1,-1))},t);let n=e.match(/^\[([^\]]+)\]\(([^)]+)\)$/);return n?(0,a.jsx)(`a`,{href:n[2],target:`_blank`,rel:`noopener noreferrer`,className:`text-primary underline hover:text-primary/80 font-bold`,children:n[1]},t):e}):[]}var c=(0,i.lazy)(()=>r(()=>import(`./KatexRenderer-S2ExKuPO.js`),__vite__mapDeps([0,1,2,3,4,5]))),l=({content:e,className:t=``})=>{if(!e)return null;let n=e.split(/(```[\s\S]*?```|\$\$[\s\S]*?\$\$|\\\[[\s\S]*?\\\])/g);return(0,a.jsx)(`div`,{className:`markdown-content space-y-2.5 text-ink-black text-xs leading-relaxed font-sans ${t}`,children:n.map((e,t)=>{if(!e)return null;let n=e.trim();if(n.startsWith("```")&&n.endsWith("```")&&n.length>=6){let e=n.indexOf(` `),r=e===-1?``:n.slice(3,e).trim(),i=e===-1?n.slice(3,-3).trim():n.slice(e+1,-3).trimEnd();return(0,a.jsxs)(`div`,{className:`my-3 rounded-md overflow-hidden border-[2px] border-ink-black shadow-[3px_3px_0px_0px_#1E293B] bg-[#1E293B]`,children:[r&&(0,a.jsxs)(`div`,{className:`bg-slate-800 text-slate-400 px-3 py-1 text-[9px] font-arcade uppercase tracking-wider border-b border-slate-700 flex justify-between items-center`,children:[(0,a.jsx)(`span`,{children:r}),(0,a.jsx)(`span`,{className:`text-[8px] opacity-70`,children:`SNIPPET`})]}),(0,a.jsx)(`pre`,{className:`p-3 overflow-x-auto font-mono text-[11px] text-[#4ADE80] leading-relaxed custom-scrollbar selection:bg-[#4ADE80] selection:text-[#1E293B]`,children:(0,a.jsx)(`code`,{children:i})})]},`code-${t}`)}if(n.startsWith(`$$`)&&n.endsWith(`$$`)&&n.length>=4||n.startsWith(`\\[`)&&n.endsWith(`\\]`)&&n.length>=4){let e=n.slice(2,-2);return(0,a.jsx)(`div`,{className:`my-3 p-3 bg-slate-50 border-2 border-ink-black rounded overflow-x-auto text-center shadow-[2px_2px_0px_0px_rgba(30,41,59,0.3)] custom-scrollbar`,children:(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(`span`,{className:`font-mono text-xs opacity-75`,children:e}),children:(0,a.jsx)(c,{math:e,displayMode:!0})})},`math-${t}`)}let r=e.split(` `),o=[],l=0;for(;l=2){let t=e[0].slice(1,-1).split(`|`).map(e=>e.trim()),n=e.slice(2).map(e=>e.slice(1,-1).split(`|`).map(e=>e.trim()));o.push((0,a.jsx)(`div`,{className:`my-3 overflow-x-auto border-2 border-ink-black rounded shadow-[2px_2px_0px_0px_#1E293B]`,children:(0,a.jsxs)(`table`,{className:`w-full text-left border-collapse text-xs`,children:[(0,a.jsx)(`thead`,{children:(0,a.jsx)(`tr`,{className:`bg-slate-200 border-b-2 border-ink-black`,children:t.map((e,t)=>(0,a.jsx)(`th`,{className:`p-2 font-bold font-headline-md border-r last:border-r-0 border-ink-black`,children:s(e)},t))})}),(0,a.jsx)(`tbody`,{children:n.map((e,t)=>(0,a.jsx)(`tr`,{className:`border-b border-slate-300 last:border-b-0 ${t%2==1?`bg-slate-50`:`bg-white`}`,children:e.map((e,t)=>(0,a.jsx)(`td`,{className:`p-2 border-r last:border-r-0 border-slate-200 font-medium`,children:s(e)},t))},t))})]})},`table-${i}`));continue}}if(n.startsWith(`#### `)){o.push((0,a.jsx)(`h4`,{className:`text-xs font-bold text-ink-black mt-3 mb-1 font-headline-md`,children:s(n.substring(5))},i)),l++;continue}if(n.startsWith(`### `)){o.push((0,a.jsxs)(`h3`,{className:`text-xs font-bold text-primary mt-4 mb-1.5 uppercase font-arcade tracking-wide flex items-center gap-1.5`,children:[(0,a.jsx)(`span`,{className:`w-2 h-2 bg-primary inline-block rounded-xs`}),s(n.substring(4))]},i)),l++;continue}if(n.startsWith(`## `)){o.push((0,a.jsx)(`h2`,{className:`text-sm font-extrabold text-ink-black mt-4 mb-2 font-headline-md border-b-2 border-ink-black pb-1`,children:s(n.substring(3))},i)),l++;continue}if(n.startsWith(`# `)){o.push((0,a.jsx)(`h1`,{className:`text-base font-black text-ink-black mt-5 mb-2 font-headline-md`,children:s(n.substring(2))},i)),l++;continue}if(n===`---`||n===`***`||n===`___`){o.push((0,a.jsx)(`hr`,{className:`my-3 border-t-2 border-dashed border-slate-300`},i)),l++;continue}if(e.trim().startsWith(`>`)){o.push((0,a.jsx)(`blockquote`,{className:`border-l-4 border-primary pl-3 py-1 my-2 bg-slate-50 italic text-slate-700`,children:s(e.trim().substring(1).trim())},i)),l++;continue}if(n.startsWith(`- `)||n.startsWith(`* `)||n.startsWith(`+ `)){let t=e.search(/\S/)>=2?`pl-6`:`pl-2`;o.push((0,a.jsxs)(`div`,{className:`flex items-start gap-2 my-1 ${t}`,children:[(0,a.jsx)(`span`,{className:`text-primary font-bold mt-0.5 shrink-0`,children:`•`}),(0,a.jsx)(`div`,{className:`text-ink-black leading-relaxed flex-1 font-medium`,children:s(n.substring(2))})]},i)),l++;continue}let c=n.match(/^(\d+)\.\s+(.*)$/);if(c){let t=e.search(/\S/)>=2?`pl-6`:`pl-2`;o.push((0,a.jsxs)(`div`,{className:`flex items-start gap-2 my-1 ${t}`,children:[(0,a.jsx)(`span`,{className:`text-primary font-arcade text-[9px] font-bold mt-1 shrink-0 px-1 py-0.2 bg-slate-100 border border-ink-black rounded-xs`,children:c[1]}),(0,a.jsx)(`div`,{className:`text-ink-black leading-relaxed flex-1 font-medium`,children:s(c[2])})]},i)),l++;continue}o.push((0,a.jsx)(`p`,{className:`text-ink-black my-1 font-medium leading-relaxed`,children:s(e)},i)),l++}return(0,a.jsx)(i.Fragment,{children:o},`block-${t}`)})})};export{s as n,l as t}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/MySQLPlayground-CA-QZxQM.js b/algospaced-ui/dist/assets/MySQLPlayground-qSCaW6n7.js similarity index 99% rename from algospaced-ui/dist/assets/MySQLPlayground-CA-QZxQM.js rename to algospaced-ui/dist/assets/MySQLPlayground-qSCaW6n7.js index 18e4e862ebe8e61bdac3553296ca8ac016ddd723..5c6526bb4ceee9905b753e3416f904ff55376fec 100644 --- a/algospaced-ui/dist/assets/MySQLPlayground-CA-QZxQM.js +++ b/algospaced-ui/dist/assets/MySQLPlayground-qSCaW6n7.js @@ -1 +1 @@ -import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Lt as t,zt as n}from"./vendor-react-qmUj3JUi.js";import{r}from"./firebaseClient-G7klkuBb.js";var i=e(n(),1),a=t();function o(){let[e,t]=(0,i.useState)(null),[n,o]=(0,i.useState)(``),[s,c]=(0,i.useState)(!1),[l,u]=(0,i.useState)(!0),[d,f]=(0,i.useState)(``),[p,m]=(0,i.useState)(null),h=async()=>{u(!0),f(``);try{let{data:{session:e}}=await r.auth.getSession();if(!e){f(`Unauthenticated session`);return}let n=await fetch(`/api/challenges/mysql/status`,{headers:{Authorization:`Bearer ${e.access_token}`}});if(n.ok){let e=await n.json();e.active?t(e):t(null)}else f(`Failed to fetch playground status.`)}catch{f(`Connection timed out.`)}finally{u(!1)}},g=async(e=!1)=>{u(!0),f(``),m(null);try{let{data:{session:n}}=await r.auth.getSession();if(!n){f(`Unauthenticated session`);return}let i=await fetch(`/api/challenges/mysql/init${e?`?refresh=true`:``}`,{method:`POST`,headers:{Authorization:`Bearer ${n.access_token}`}});if(i.ok){let e=await i.json();t({active:!0,title:e.title,objective:e.objective,points:e.points,schema:e.schema,challenge_type:e.challenge_type,completed:!1,total_score:e.total_score})}else f(`Failed to initialize mock database playground.`)}catch{f(`Server connection error.`)}finally{u(!1)}};return(0,i.useEffect)(()=>{h()},[]),l?(0,a.jsxs)(`div`,{className:`w-full h-full bg-paper-white p-6 flex flex-col items-center justify-center font-arcade text-[10px]`,children:[(0,a.jsx)(`div`,{className:`animate-bounce mb-2`,children:`INITIALIZING SQL PLAYGROUND...`}),(0,a.jsx)(`div`,{className:`w-48 h-4 bg-white border-[3px] border-ink-black overflow-hidden relative`,children:(0,a.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-[#0ea5e9] w-1/2 animate-pulse border-r-2 border-ink-black`})})]}):e?(0,a.jsx)(`div`,{className:`w-full h-full bg-paper-white text-ink-black flex flex-col overflow-hidden text-xs md:text-sm`,children:(0,a.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 custom-scrollbar flex flex-col gap-4`,children:[(0,a.jsxs)(`div`,{className:`flex justify-between items-center bg-slate-100 border-[3px] border-ink-black p-3 shrink-0`,children:[(0,a.jsxs)(`div`,{className:`flex gap-2`,children:[(0,a.jsx)(`span`,{className:`bg-blue-100 text-blue-800 px-2 py-0.5 border-2 border-ink-black font-bold text-[9px] uppercase`,children:e.challenge_type}),(0,a.jsxs)(`span`,{className:`bg-yellow-100 text-yellow-800 px-2 py-0.5 border-2 border-ink-black font-bold text-[9px]`,children:[`+`,e.points,` PTS`]}),e.completed?(0,a.jsx)(`span`,{className:`bg-emerald-500 text-white px-2 py-0.5 border-2 border-ink-black font-bold text-[9px]`,children:`SOLVED`}):(0,a.jsx)(`span`,{className:`bg-rose-500 text-white px-2 py-0.5 border-2 border-ink-black font-bold text-[9px]`,children:`UNSOLVED`})]}),(0,a.jsxs)(`div`,{className:`font-arcade text-[8px] text-sky-700 font-bold bg-white border-2 border-ink-black px-2 py-0.5 shadow-[1px_1px_0_0_#1E293B]`,children:[`SCORE: `,e.total_score]})]}),(0,a.jsxs)(`div`,{className:`border-[3px] border-yellow-400 bg-yellow-50 p-3 rounded font-sans leading-relaxed text-xs`,children:[(0,a.jsx)(`h4`,{className:`font-arcade text-[9px] text-yellow-800 mb-1`,children:`PROBLEM`}),(0,a.jsx)(`p`,{className:`font-bold text-slate-800`,children:e.objective})]}),(0,a.jsxs)(`div`,{className:`border-[3px] border-ink-black bg-white p-3`,children:[(0,a.jsxs)(`div`,{className:`font-bold text-[10px] border-b border-slate-300 pb-1 mb-2 flex items-center gap-1.5`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-sm`,children:`schema`}),(0,a.jsx)(`span`,{children:`SCHEMA EXPLORER (MOCK INSTANCE)`})]}),(0,a.jsx)(`div`,{className:`grid grid-cols-2 gap-3 max-h-[140px] overflow-y-auto custom-scrollbar font-mono text-[10px]`,children:Object.entries(e.schema).map(([e,t])=>(0,a.jsxs)(`div`,{className:`border border-slate-300 p-2 bg-slate-50`,children:[(0,a.jsxs)(`div`,{className:`font-bold text-blue-700 border-b border-slate-200 pb-0.5 mb-1 flex items-center gap-1`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-[12px]`,children:`table_chart`}),e]}),(0,a.jsx)(`ul`,{className:`space-y-0.5 text-slate-600 text-[9px]`,children:t.map((e,t)=>(0,a.jsxs)(`li`,{className:`flex justify-between`,children:[(0,a.jsx)(`span`,{children:e.name}),(0,a.jsx)(`span`,{className:`text-slate-400 italic text-[8px]`,children:e.type})]},t))})]},e))})]}),(0,a.jsxs)(`div`,{className:`flex flex-col min-h-[120px]`,children:[(0,a.jsxs)(`div`,{className:`font-bold text-[10px] mb-1 tracking-wide uppercase flex items-center gap-1`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-sm text-sky-600`,children:`terminal`}),(0,a.jsx)(`span`,{children:`Enter SQL Query:`})]}),(0,a.jsx)(`textarea`,{value:n,onChange:e=>o(e.target.value),className:`flex-1 w-full bg-slate-900 text-[#4ADE80] font-mono p-3 border-[3px] border-ink-black rounded outline-none focus:ring-2 focus:ring-sky-500 text-xs leading-relaxed resize-none`,placeholder:`SELECT * FROM customers WHERE score > 100;`,spellCheck:`false`})]}),(0,a.jsxs)(`div`,{className:`flex gap-3`,children:[(0,a.jsx)(`button`,{onClick:()=>g(!0),className:`flex-1 bg-white hover:bg-slate-100 text-ink-black border-[3px] border-ink-black font-bold font-window-title text-xs py-2 shadow-[3px_3px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none cursor-pointer`,children:`NEW PROBLEM`}),(0,a.jsx)(`button`,{disabled:s,onClick:async()=>{if(n.trim()){c(!0),f(``),m(null);try{let{data:{session:e}}=await r.auth.getSession();if(!e){f(`Unauthenticated session`);return}let i=await fetch(`/api/challenges/mysql/query`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${e.access_token}`},body:JSON.stringify({query:n})});if(i.ok){let e=await i.json();e.success?(m({columns:e.columns,rows:e.rows,rowsAffected:e.rows_affected,isCorrect:e.is_correct}),e.is_correct&&t(t=>t?{...t,completed:!0,total_score:e.total_score}:null),e.schema&&t(t=>t?{...t,schema:e.schema}:null)):f(e.error)}else f(`Database server query failure.`)}catch{f(`Query connection lost.`)}finally{c(!1)}}},className:`flex-[2] bg-highlight-pink text-white font-window-title font-bold py-2 border-[3px] border-ink-black shadow-[3px_3px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none hover:bg-pink-400 transition-all disabled:opacity-50 cursor-pointer text-center text-xs`,children:s?`EXECUTING SQL...`:`EXECUTE SQL QUERY`})]}),d&&(0,a.jsxs)(`div`,{className:`border-[3px] border-red-500 bg-red-50 text-red-800 p-3 font-mono text-xs whitespace-pre-wrap`,children:[(0,a.jsx)(`div`,{className:`font-bold mb-1`,children:`SQL RUNTIME / SYNTAX ERROR:`}),d]}),p&&(0,a.jsxs)(`div`,{className:`border-[3px] border-ink-black bg-white p-3 flex flex-col`,children:[(0,a.jsxs)(`div`,{className:`font-bold text-[10px] border-b border-slate-300 pb-1 mb-2 flex justify-between items-center`,children:[(0,a.jsx)(`span`,{children:`QUERY OUTPUT BUFFER`}),p.isCorrect&&(0,a.jsx)(`span`,{className:`text-green-600 font-bold animate-bounce text-[9px]`,children:`✓ ACCEPTED!`})]}),(0,a.jsxs)(`div`,{className:`text-[9px] text-slate-500 mb-2 font-mono`,children:[`Rows Affected: `,p.rowsAffected,` | Total Returned: `,p.rows.length]}),p.rows.length>0?(0,a.jsx)(`div`,{className:`overflow-x-auto border border-slate-300 max-h-[180px] custom-scrollbar`,children:(0,a.jsxs)(`table`,{className:`border-collapse w-full font-mono text-[9px] min-w-full`,children:[(0,a.jsx)(`thead`,{children:(0,a.jsx)(`tr`,{className:`bg-slate-100 border-b border-slate-300`,children:p.columns.map((e,t)=>(0,a.jsx)(`th`,{className:`border-r border-slate-300 p-1.5 text-left font-bold text-slate-700`,children:e},t))})}),(0,a.jsx)(`tbody`,{className:`divide-y divide-slate-200`,children:p.rows.map((e,t)=>(0,a.jsx)(`tr`,{className:`hover:bg-slate-50`,children:p.columns.map((t,n)=>(0,a.jsx)(`td`,{className:`border-r border-slate-200 p-1.5 text-slate-800 whitespace-nowrap`,children:e[t]===null?(0,a.jsx)(`span`,{className:`text-slate-300 italic`,children:`NULL`}):String(e[t])},n))},t))})]})}):(0,a.jsx)(`div`,{className:`p-3 border border-dashed border-slate-300 text-center text-slate-400 italic font-sans text-xs`,children:`Query executed successfully. Result set is empty (or modification completed).`})]})]})}):(0,a.jsxs)(`div`,{className:`w-full h-full bg-paper-white p-6 flex flex-col justify-between items-center text-center text-ink-black text-xs md:text-sm font-sans select-none`,children:[(0,a.jsxs)(`div`,{className:`flex-1 flex flex-col justify-center items-center gap-4`,children:[(0,a.jsx)(`div`,{className:`w-16 h-16 bg-white border-[3px] border-ink-black flex items-center justify-center shadow-[4px_4px_0_0_#1E293B]`,children:(0,a.jsx)(`span`,{className:`material-symbols-outlined text-4xl text-[#0ea5e9]`,style:{fontVariationSettings:`'FILL' 1`},children:`database`})}),(0,a.jsx)(`h3`,{className:`font-headline-md font-bold text-lg`,children:`Interactive MySQL Playground`}),(0,a.jsx)(`p`,{className:`max-w-md text-slate-600 leading-relaxed font-semibold`,children:`Practice SQL queries against realistic schema tables. Includes full support for:`}),(0,a.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2 font-mono text-[10px] text-slate-700 font-bold uppercase mt-1`,children:[(0,a.jsx)(`span`,{className:`bg-blue-100 border border-blue-400 px-2 py-0.5`,children:`SELECT / JOIN`}),(0,a.jsx)(`span`,{className:`bg-emerald-100 border border-emerald-400 px-2 py-0.5`,children:`UPDATE / DELETE`}),(0,a.jsx)(`span`,{className:`bg-purple-100 border border-purple-400 px-2 py-0.5`,children:`WINDOW FUNCTIONS`})]})]}),(0,a.jsx)(`div`,{className:`w-full border-t border-slate-200 pt-4 flex flex-col gap-2 shrink-0`,children:(0,a.jsx)(`button`,{onClick:()=>g(!1),className:`w-full py-2.5 bg-[#0ea5e9] hover:bg-sky-400 text-white font-window-title font-bold text-xs uppercase border-[3px] border-ink-black shadow-[4px_4px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer text-center`,children:`CREATE NEW DATABASE`})})]})}export{o as default}; \ No newline at end of file +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Lt as t,zt as n}from"./vendor-react-q-oOktF_.js";import{r}from"./firebaseClient-G7klkuBb.js";var i=e(n(),1),a=t();function o(){let[e,t]=(0,i.useState)(null),[n,o]=(0,i.useState)(``),[s,c]=(0,i.useState)(!1),[l,u]=(0,i.useState)(!0),[d,f]=(0,i.useState)(``),[p,m]=(0,i.useState)(null),h=async()=>{u(!0),f(``);try{let{data:{session:e}}=await r.auth.getSession();if(!e){f(`Unauthenticated session`);return}let n=await fetch(`/api/challenges/mysql/status`,{headers:{Authorization:`Bearer ${e.access_token}`}});if(n.ok){let e=await n.json();e.active?t(e):t(null)}else f(`Failed to fetch playground status.`)}catch{f(`Connection timed out.`)}finally{u(!1)}},g=async(e=!1)=>{u(!0),f(``),m(null);try{let{data:{session:n}}=await r.auth.getSession();if(!n){f(`Unauthenticated session`);return}let i=await fetch(`/api/challenges/mysql/init${e?`?refresh=true`:``}`,{method:`POST`,headers:{Authorization:`Bearer ${n.access_token}`}});if(i.ok){let e=await i.json();t({active:!0,title:e.title,objective:e.objective,points:e.points,schema:e.schema,challenge_type:e.challenge_type,completed:!1,total_score:e.total_score})}else f(`Failed to initialize mock database playground.`)}catch{f(`Server connection error.`)}finally{u(!1)}};return(0,i.useEffect)(()=>{h()},[]),l?(0,a.jsxs)(`div`,{className:`w-full h-full bg-paper-white p-6 flex flex-col items-center justify-center font-arcade text-[10px]`,children:[(0,a.jsx)(`div`,{className:`animate-bounce mb-2`,children:`INITIALIZING SQL PLAYGROUND...`}),(0,a.jsx)(`div`,{className:`w-48 h-4 bg-white border-[3px] border-ink-black overflow-hidden relative`,children:(0,a.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-[#0ea5e9] w-1/2 animate-pulse border-r-2 border-ink-black`})})]}):e?(0,a.jsx)(`div`,{className:`w-full h-full bg-paper-white text-ink-black flex flex-col overflow-hidden text-xs md:text-sm`,children:(0,a.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 custom-scrollbar flex flex-col gap-4`,children:[(0,a.jsxs)(`div`,{className:`flex justify-between items-center bg-slate-100 border-[3px] border-ink-black p-3 shrink-0`,children:[(0,a.jsxs)(`div`,{className:`flex gap-2`,children:[(0,a.jsx)(`span`,{className:`bg-blue-100 text-blue-800 px-2 py-0.5 border-2 border-ink-black font-bold text-[9px] uppercase`,children:e.challenge_type}),(0,a.jsxs)(`span`,{className:`bg-yellow-100 text-yellow-800 px-2 py-0.5 border-2 border-ink-black font-bold text-[9px]`,children:[`+`,e.points,` PTS`]}),e.completed?(0,a.jsx)(`span`,{className:`bg-emerald-500 text-white px-2 py-0.5 border-2 border-ink-black font-bold text-[9px]`,children:`SOLVED`}):(0,a.jsx)(`span`,{className:`bg-rose-500 text-white px-2 py-0.5 border-2 border-ink-black font-bold text-[9px]`,children:`UNSOLVED`})]}),(0,a.jsxs)(`div`,{className:`font-arcade text-[8px] text-sky-700 font-bold bg-white border-2 border-ink-black px-2 py-0.5 shadow-[1px_1px_0_0_#1E293B]`,children:[`SCORE: `,e.total_score]})]}),(0,a.jsxs)(`div`,{className:`border-[3px] border-yellow-400 bg-yellow-50 p-3 rounded font-sans leading-relaxed text-xs`,children:[(0,a.jsx)(`h4`,{className:`font-arcade text-[9px] text-yellow-800 mb-1`,children:`PROBLEM`}),(0,a.jsx)(`p`,{className:`font-bold text-slate-800`,children:e.objective})]}),(0,a.jsxs)(`div`,{className:`border-[3px] border-ink-black bg-white p-3`,children:[(0,a.jsxs)(`div`,{className:`font-bold text-[10px] border-b border-slate-300 pb-1 mb-2 flex items-center gap-1.5`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-sm`,children:`schema`}),(0,a.jsx)(`span`,{children:`SCHEMA EXPLORER (MOCK INSTANCE)`})]}),(0,a.jsx)(`div`,{className:`grid grid-cols-2 gap-3 max-h-[140px] overflow-y-auto custom-scrollbar font-mono text-[10px]`,children:Object.entries(e.schema).map(([e,t])=>(0,a.jsxs)(`div`,{className:`border border-slate-300 p-2 bg-slate-50`,children:[(0,a.jsxs)(`div`,{className:`font-bold text-blue-700 border-b border-slate-200 pb-0.5 mb-1 flex items-center gap-1`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-[12px]`,children:`table_chart`}),e]}),(0,a.jsx)(`ul`,{className:`space-y-0.5 text-slate-600 text-[9px]`,children:t.map((e,t)=>(0,a.jsxs)(`li`,{className:`flex justify-between`,children:[(0,a.jsx)(`span`,{children:e.name}),(0,a.jsx)(`span`,{className:`text-slate-400 italic text-[8px]`,children:e.type})]},t))})]},e))})]}),(0,a.jsxs)(`div`,{className:`flex flex-col min-h-[120px]`,children:[(0,a.jsxs)(`div`,{className:`font-bold text-[10px] mb-1 tracking-wide uppercase flex items-center gap-1`,children:[(0,a.jsx)(`span`,{className:`material-symbols-outlined text-sm text-sky-600`,children:`terminal`}),(0,a.jsx)(`span`,{children:`Enter SQL Query:`})]}),(0,a.jsx)(`textarea`,{value:n,onChange:e=>o(e.target.value),className:`flex-1 w-full bg-slate-900 text-[#4ADE80] font-mono p-3 border-[3px] border-ink-black rounded outline-none focus:ring-2 focus:ring-sky-500 text-xs leading-relaxed resize-none`,placeholder:`SELECT * FROM customers WHERE score > 100;`,spellCheck:`false`})]}),(0,a.jsxs)(`div`,{className:`flex gap-3`,children:[(0,a.jsx)(`button`,{onClick:()=>g(!0),className:`flex-1 bg-white hover:bg-slate-100 text-ink-black border-[3px] border-ink-black font-bold font-window-title text-xs py-2 shadow-[3px_3px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none cursor-pointer`,children:`NEW PROBLEM`}),(0,a.jsx)(`button`,{disabled:s,onClick:async()=>{if(n.trim()){c(!0),f(``),m(null);try{let{data:{session:e}}=await r.auth.getSession();if(!e){f(`Unauthenticated session`);return}let i=await fetch(`/api/challenges/mysql/query`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${e.access_token}`},body:JSON.stringify({query:n})});if(i.ok){let e=await i.json();e.success?(m({columns:e.columns,rows:e.rows,rowsAffected:e.rows_affected,isCorrect:e.is_correct}),e.is_correct&&t(t=>t?{...t,completed:!0,total_score:e.total_score}:null),e.schema&&t(t=>t?{...t,schema:e.schema}:null)):f(e.error)}else f(`Database server query failure.`)}catch{f(`Query connection lost.`)}finally{c(!1)}}},className:`flex-[2] bg-highlight-pink text-white font-window-title font-bold py-2 border-[3px] border-ink-black shadow-[3px_3px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none hover:bg-pink-400 transition-all disabled:opacity-50 cursor-pointer text-center text-xs`,children:s?`EXECUTING SQL...`:`EXECUTE SQL QUERY`})]}),d&&(0,a.jsxs)(`div`,{className:`border-[3px] border-red-500 bg-red-50 text-red-800 p-3 font-mono text-xs whitespace-pre-wrap`,children:[(0,a.jsx)(`div`,{className:`font-bold mb-1`,children:`SQL RUNTIME / SYNTAX ERROR:`}),d]}),p&&(0,a.jsxs)(`div`,{className:`border-[3px] border-ink-black bg-white p-3 flex flex-col`,children:[(0,a.jsxs)(`div`,{className:`font-bold text-[10px] border-b border-slate-300 pb-1 mb-2 flex justify-between items-center`,children:[(0,a.jsx)(`span`,{children:`QUERY OUTPUT BUFFER`}),p.isCorrect&&(0,a.jsx)(`span`,{className:`text-green-600 font-bold animate-bounce text-[9px]`,children:`✓ ACCEPTED!`})]}),(0,a.jsxs)(`div`,{className:`text-[9px] text-slate-500 mb-2 font-mono`,children:[`Rows Affected: `,p.rowsAffected,` | Total Returned: `,p.rows.length]}),p.rows.length>0?(0,a.jsx)(`div`,{className:`overflow-x-auto border border-slate-300 max-h-[180px] custom-scrollbar`,children:(0,a.jsxs)(`table`,{className:`border-collapse w-full font-mono text-[9px] min-w-full`,children:[(0,a.jsx)(`thead`,{children:(0,a.jsx)(`tr`,{className:`bg-slate-100 border-b border-slate-300`,children:p.columns.map((e,t)=>(0,a.jsx)(`th`,{className:`border-r border-slate-300 p-1.5 text-left font-bold text-slate-700`,children:e},t))})}),(0,a.jsx)(`tbody`,{className:`divide-y divide-slate-200`,children:p.rows.map((e,t)=>(0,a.jsx)(`tr`,{className:`hover:bg-slate-50`,children:p.columns.map((t,n)=>(0,a.jsx)(`td`,{className:`border-r border-slate-200 p-1.5 text-slate-800 whitespace-nowrap`,children:e[t]===null?(0,a.jsx)(`span`,{className:`text-slate-300 italic`,children:`NULL`}):String(e[t])},n))},t))})]})}):(0,a.jsx)(`div`,{className:`p-3 border border-dashed border-slate-300 text-center text-slate-400 italic font-sans text-xs`,children:`Query executed successfully. Result set is empty (or modification completed).`})]})]})}):(0,a.jsxs)(`div`,{className:`w-full h-full bg-paper-white p-6 flex flex-col justify-between items-center text-center text-ink-black text-xs md:text-sm font-sans select-none`,children:[(0,a.jsxs)(`div`,{className:`flex-1 flex flex-col justify-center items-center gap-4`,children:[(0,a.jsx)(`div`,{className:`w-16 h-16 bg-white border-[3px] border-ink-black flex items-center justify-center shadow-[4px_4px_0_0_#1E293B]`,children:(0,a.jsx)(`span`,{className:`material-symbols-outlined text-4xl text-[#0ea5e9]`,style:{fontVariationSettings:`'FILL' 1`},children:`database`})}),(0,a.jsx)(`h3`,{className:`font-headline-md font-bold text-lg`,children:`Interactive MySQL Playground`}),(0,a.jsx)(`p`,{className:`max-w-md text-slate-600 leading-relaxed font-semibold`,children:`Practice SQL queries against realistic schema tables. Includes full support for:`}),(0,a.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2 font-mono text-[10px] text-slate-700 font-bold uppercase mt-1`,children:[(0,a.jsx)(`span`,{className:`bg-blue-100 border border-blue-400 px-2 py-0.5`,children:`SELECT / JOIN`}),(0,a.jsx)(`span`,{className:`bg-emerald-100 border border-emerald-400 px-2 py-0.5`,children:`UPDATE / DELETE`}),(0,a.jsx)(`span`,{className:`bg-purple-100 border border-purple-400 px-2 py-0.5`,children:`WINDOW FUNCTIONS`})]})]}),(0,a.jsx)(`div`,{className:`w-full border-t border-slate-200 pt-4 flex flex-col gap-2 shrink-0`,children:(0,a.jsx)(`button`,{onClick:()=>g(!1),className:`w-full py-2.5 bg-[#0ea5e9] hover:bg-sky-400 text-white font-window-title font-bold text-xs uppercase border-[3px] border-ink-black shadow-[4px_4px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer text-center`,children:`CREATE NEW DATABASE`})})]})}export{o as default}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/OnboardingModal-hhKaj0In.js b/algospaced-ui/dist/assets/OnboardingModal-D_uUP3Nd.js similarity index 90% rename from algospaced-ui/dist/assets/OnboardingModal-hhKaj0In.js rename to algospaced-ui/dist/assets/OnboardingModal-D_uUP3Nd.js index ab4992bc975c177e52435fc38a32b7df1cca837f..ccb2dadfa7b1819e6dc56fbbd02662e8e8452202 100644 --- a/algospaced-ui/dist/assets/OnboardingModal-hhKaj0In.js +++ b/algospaced-ui/dist/assets/OnboardingModal-D_uUP3Nd.js @@ -1 +1 @@ -import{r as e}from"./rolldown-runtime-hePW80VL.js";import{A as t,C as n,Et as r,Lt as i,St as a,_ as o,ft as s,ht as c,it as l,o as u,s as d,v as f,vt as p,y as m,yt as h,zt as g}from"./vendor-react-qmUj3JUi.js";import{a as _,i as v,l as y,o as b}from"./index-DYMSjoUb.js";var x=e(g(),1),S=i(),C=[217,242,1,49,20];function w({isOpen:e,onClose:i,onCompleted:g,userId:w}){let[T,E]=(0,x.useState)(`welcome`),[D,O]=(0,x.useState)(new Set),[k,A]=(0,x.useState)(``),[j,M]=(0,x.useState)(`ALL`),[N,P]=(0,x.useState)({}),[F,I]=(0,x.useState)(!1),[L,R]=(0,x.useState)(null),[z,B]=(0,x.useState)(null),V=()=>`algospaced_onboarding_done_${w===`sandbox-user-id`?`sandbox`:w||`sandbox`}`;(0,x.useEffect)(()=>{if(e){let e=localStorage.getItem(V());E(e?`checklist`:`welcome`),B(null),R(null)}},[e,w]);let H=(0,x.useMemo)(()=>v(),[]),U=(0,x.useMemo)(()=>_(),[]),W=(0,x.useMemo)(()=>{let e=k.trim().toLowerCase();return H.filter(t=>j!==`ALL`&&t.pattern!==j?!1:!e||t.name.toLowerCase().includes(e)||t.problem_number.toString().includes(e)||t.pattern.toLowerCase().includes(e)||t.difficulty.toLowerCase().includes(e))},[H,k,j]),G=(0,x.useMemo)(()=>{let e=new Map;for(let t of W){let n=e.get(t.pattern)||[];n.push(t),e.set(t.pattern,n)}return e},[W]);if(!e)return null;let K=()=>{localStorage.setItem(V(),`true`)},q=async()=>{I(!0),B(null),R(`Enrolling 5 foundational starter problems...`);try{let e=C.map(e=>b(e)).filter(e=>e!==void 0);await y(e),K(),R(`All 5 starter problems enrolled into Box 1!`),setTimeout(()=>{g(),i()},700)}catch(e){console.error(`Failed to start from scratch:`,e),B(e instanceof Error?e.message:`Failed to enroll starter problems`),I(!1)}},J=e=>{O(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Y=e=>{let t=H.filter(t=>t.pattern===e),n=t.every(e=>D.has(e.problem_number));O(e=>{let r=new Set(e);for(let e of t)n?r.delete(e.problem_number):r.add(e.problem_number);return r})},X=e=>{O(t=>{let n=new Set(t);for(let t of H)t.difficulty===e&&n.add(t.problem_number);return n})},Z=()=>{O(new Set(H.map(e=>e.problem_number)))},Q=()=>{O(new Set)},$=e=>{P(t=>({...t,[e]:!t[e]}))};return(0,S.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/75 backdrop-blur-sm p-3 sm:p-6 overflow-y-auto`,children:(0,S.jsxs)(`div`,{className:`w-full max-w-4xl max-h-[92vh] bg-paper-white border-[4px] border-ink-black gadget-shadow flex flex-col relative overflow-hidden text-ink-black`,children:[(0,S.jsxs)(`div`,{className:`h-10 bg-gradient-to-r from-amber-400 via-amber-300 to-grass-green border-b-[3px] border-ink-black px-4 flex items-center justify-between shrink-0`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`w-3 h-3 rounded-full bg-rose-500 border border-ink-black`}),(0,S.jsx)(`span`,{className:`w-3 h-3 rounded-full bg-amber-500 border border-ink-black`}),(0,S.jsx)(`span`,{className:`w-3 h-3 rounded-full bg-emerald-500 border border-ink-black`}),(0,S.jsxs)(`span`,{className:`font-arcade text-[11px] font-bold tracking-wider text-ink-black uppercase ml-2 flex items-center gap-1.5`,children:[(0,S.jsx)(l,{className:`w-4 h-4 text-amber-900`}),`GET STARTED`]})]}),(0,S.jsx)(`button`,{onClick:()=>{K(),i()},disabled:F,className:`p-1 hover:bg-black/10 rounded transition-colors text-ink-black cursor-pointer border-0`,title:`Dismiss for now`,children:(0,S.jsx)(d,{className:`w-4 h-4`})})]}),T===`welcome`&&(0,S.jsxs)(`div`,{className:`p-6 sm:p-10 space-y-8 overflow-y-auto custom-scrollbar text-center`,children:[(0,S.jsxs)(`div`,{className:`space-y-3`,children:[(0,S.jsxs)(`div`,{className:`inline-flex items-center gap-2 px-3 py-1 bg-amber-100 border-2 border-ink-black font-arcade text-[10px] font-bold text-amber-900 uppercase`,children:[(0,S.jsx)(m,{className:`w-3.5 h-3.5 text-amber-700`}),`WELCOME TO ALGOSPACED`]}),(0,S.jsx)(`h1`,{className:`font-headline-md text-2xl sm:text-4xl font-extrabold text-ink-black tracking-tight`,children:`How would you like to begin your journey?`}),(0,S.jsx)(`p`,{className:`font-sans text-xs sm:text-sm text-trash-gray max-w-xl mx-auto leading-relaxed font-semibold`,children:`AlgoSpaced uses a 5-box Leitner spaced repetition engine. Choose how to seed your active practice cards.`})]}),(0,S.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6 max-w-2xl mx-auto text-left`,children:[(0,S.jsxs)(`div`,{className:`p-5 sm:p-6 bg-gradient-to-br from-emerald-50 to-emerald-100/60 border-[3px] border-ink-black gadget-shadow hover:translate-y-[-2px] transition-all flex flex-col justify-between space-y-4`,children:[(0,S.jsxs)(`div`,{className:`space-y-3`,children:[(0,S.jsx)(`div`,{className:`w-12 h-12 bg-grass-green border-2 border-ink-black rounded-xl flex items-center justify-center shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:(0,S.jsx)(a,{className:`w-6 h-6 text-ink-black stroke-[2.5]`})}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`span`,{className:`font-arcade text-[8px] font-bold text-emerald-800 uppercase tracking-wide`,children:`RECOMMENDED FOR BEGINNERS`}),(0,S.jsx)(`h2`,{className:`font-headline-md text-lg sm:text-xl font-bold text-ink-black mt-0.5`,children:`🌱 Start From Scratch`})]}),(0,S.jsx)(`p`,{className:`font-sans text-xs text-trash-gray leading-relaxed font-semibold`,children:`Begin with the 5 foundational starter problems: Contains Duplicate, Valid Anagram, Two Sum, Group Anagrams, and Valid Parentheses.`})]}),(0,S.jsx)(`button`,{onClick:q,disabled:F,className:`w-full py-3 bg-grass-green hover:bg-emerald-400 text-ink-black font-arcade text-[10px] font-bold border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer flex items-center justify-center gap-2 disabled:opacity-50`,children:F?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(t,{className:`w-4 h-4 animate-spin`}),(0,S.jsx)(`span`,{children:`INITIALIZING...`})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(h,{className:`w-4 h-4 stroke-[3]`}),(0,S.jsx)(`span`,{children:`START FRESH (5 PROBLEMS)`})]})})]}),(0,S.jsxs)(`div`,{className:`p-5 sm:p-6 bg-gradient-to-br from-amber-50 to-orange-100/60 border-[3px] border-ink-black gadget-shadow hover:translate-y-[-2px] transition-all flex flex-col justify-between space-y-4`,children:[(0,S.jsxs)(`div`,{className:`space-y-3`,children:[(0,S.jsx)(`div`,{className:`w-12 h-12 bg-amber-400 border-2 border-ink-black rounded-xl flex items-center justify-center shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:(0,S.jsx)(u,{className:`w-6 h-6 text-ink-black stroke-[2.5]`})}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`span`,{className:`font-arcade text-[8px] font-bold text-amber-800 uppercase tracking-wide`,children:`IF YOU'VE ALREADY SOLVED SOME PROBLEMS ELSEWHERE`}),(0,S.jsx)(`h2`,{className:`font-headline-md text-lg sm:text-xl font-bold text-ink-black mt-0.5`,children:`⚡ Fast-Track Checklist`})]}),(0,S.jsx)(`p`,{className:`font-sans text-xs text-trash-gray leading-relaxed font-semibold`,children:`Already solved some problems? Check off problems you've already solved elsewhere to seed your review queue and update your progress.`})]}),(0,S.jsxs)(`button`,{onClick:()=>E(`checklist`),disabled:F,className:`w-full py-3 bg-amber-400 hover:bg-amber-300 text-ink-black font-arcade text-[10px] font-bold border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer flex items-center justify-center gap-2`,children:[(0,S.jsx)(`span`,{children:`SELECT WHAT I KNOW (150 POOL)`}),(0,S.jsx)(r,{className:`w-4 h-4 rotate-180`})]})]})]}),L&&(0,S.jsx)(`p`,{className:`font-arcade text-[10px] text-emerald-700 font-bold animate-pulse`,children:L}),z&&(0,S.jsx)(`p`,{className:`font-arcade text-[10px] text-rose-600 font-bold`,children:z})]}),T===`checklist`&&(0,S.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:[(0,S.jsxs)(`div`,{className:`p-3 sm:p-4 bg-amber-50/60 border-b-[2px] border-ink-black shrink-0 space-y-3`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsxs)(`button`,{onClick:()=>E(`welcome`),className:`px-2.5 py-1.5 bg-paper-white hover:bg-slate-100 border-2 border-ink-black font-arcade text-[9px] font-bold text-ink-black flex items-center gap-1 cursor-pointer transition-colors shadow-[1px_1px_0px_0px_rgba(30,41,59,1)]`,children:[(0,S.jsx)(r,{className:`w-3.5 h-3.5`}),`BACK`]}),(0,S.jsx)(`h2`,{className:`font-headline-md text-base sm:text-lg font-bold text-ink-black`,children:`Fast-Track Catalog Checklist`})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 bg-paper-white border-2 border-ink-black p-1.5 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,S.jsx)(`span`,{className:`font-arcade text-[8px] font-bold text-trash-gray px-1 uppercase`,children:`FSRS STATE:`}),(0,S.jsx)(`span`,{className:`px-2 py-1 font-arcade text-[9px] font-bold bg-amber-400 text-ink-black border border-ink-black`,children:`ALL START AS 'NEW'`})]})]}),(0,S.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2 items-center justify-between`,children:[(0,S.jsxs)(`div`,{className:`relative w-full sm:w-72`,children:[(0,S.jsx)(n,{className:`w-3.5 h-3.5 text-trash-gray absolute left-3 top-1/2 -translate-y-1/2`}),(0,S.jsx)(`input`,{type:`text`,value:k,onChange:e=>A(e.target.value),placeholder:`Search by title, number, or pattern...`,"aria-label":`Search problems by title, number, or pattern`,className:`w-full pl-8 pr-3 py-1.5 bg-paper-white border-2 border-ink-black font-sans text-xs text-ink-black font-medium outline-none focus:bg-amber-50`}),k&&(0,S.jsx)(`button`,{onClick:()=>A(``),"aria-label":`Clear search`,className:`absolute right-2 top-1/2 -translate-y-1/2 text-trash-gray hover:text-ink-black p-0.5 cursor-pointer`,children:(0,S.jsx)(d,{className:`w-3 h-3`})})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap w-full sm:w-auto justify-end`,children:[(0,S.jsx)(`button`,{onClick:()=>X(`Easy`),className:`px-2 py-1 bg-emerald-100 hover:bg-emerald-200 border border-emerald-800 text-emerald-900 font-arcade text-[8px] font-bold cursor-pointer transition-colors`,children:`+ ALL EASY`}),(0,S.jsx)(`button`,{onClick:()=>X(`Medium`),className:`px-2 py-1 bg-amber-100 hover:bg-amber-200 border border-amber-800 text-amber-900 font-arcade text-[8px] font-bold cursor-pointer transition-colors`,children:`+ ALL MEDIUM`}),(0,S.jsx)(`button`,{onClick:Z,className:`px-2 py-1 bg-purple-100 hover:bg-purple-200 border border-purple-800 text-purple-900 font-arcade text-[8px] font-bold cursor-pointer transition-colors`,children:`SELECT ALL (150)`}),(0,S.jsx)(`button`,{onClick:Q,className:`px-2 py-1 bg-slate-100 hover:bg-slate-200 border border-slate-700 text-slate-800 font-arcade text-[8px] font-bold cursor-pointer transition-colors`,children:`CLEAR`})]})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 overflow-x-auto custom-scrollbar pb-1 text-[8px] font-arcade font-bold`,children:[(0,S.jsxs)(`button`,{onClick:()=>M(`ALL`),className:`px-2 py-0.5 border cursor-pointer shrink-0 transition-colors ${j===`ALL`?`bg-ink-black text-amber-300 border-ink-black`:`bg-paper-white text-trash-gray border-slate-300 hover:text-ink-black`}`,children:[`ALL PATTERNS (`,H.length,`)`]}),U.map(e=>{let t=H.filter(t=>t.pattern===e).length;return(0,S.jsxs)(`button`,{onClick:()=>M(e),className:`px-2 py-0.5 border cursor-pointer shrink-0 transition-colors ${j===e?`bg-ink-black text-amber-300 border-ink-black`:`bg-paper-white text-trash-gray border-slate-300 hover:text-ink-black`}`,children:[e.toUpperCase(),` (`,t,`)`]},e)})]})]}),(0,S.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 sm:p-6 custom-scrollbar space-y-4 bg-slate-50/50`,children:[Array.from(G.entries()).map(([e,t])=>{let n=t.filter(e=>D.has(e.problem_number)).length,r=n===t.length,i=N[e]!==!1;return(0,S.jsxs)(`div`,{className:`bg-paper-white border-2 border-ink-black gadget-shadow overflow-hidden`,children:[(0,S.jsxs)(`div`,{className:`px-3.5 py-2.5 bg-gradient-to-r from-amber-100 to-amber-50 border-b-2 border-ink-black flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`button`,{onClick:()=>$(e),className:`p-1 hover:bg-black/10 rounded cursor-pointer transition-colors text-ink-black`,children:i?(0,S.jsx)(c,{className:`w-3.5 h-3.5`}):(0,S.jsx)(p,{className:`w-3.5 h-3.5`})}),(0,S.jsx)(`span`,{className:`font-headline-md text-xs sm:text-sm font-bold text-ink-black`,children:e}),(0,S.jsxs)(`span`,{className:`font-arcade text-[8px] font-bold px-1.5 py-0.5 rounded bg-amber-900/10 text-amber-900 border border-amber-900/20`,children:[n,` / `,t.length,` selected`]})]}),(0,S.jsx)(`button`,{onClick:()=>Y(e),className:`px-2 py-1 font-arcade text-[8px] font-bold border border-ink-black bg-paper-white hover:bg-amber-200 transition-colors cursor-pointer flex items-center gap-1 shadow-[1px_1px_0px_0px_rgba(30,41,59,1)]`,children:r?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(f,{className:`w-3 h-3 text-emerald-600`}),(0,S.jsx)(`span`,{children:`DESELECT ALL`})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(o,{className:`w-3 h-3 text-slate-500`}),(0,S.jsx)(`span`,{children:`SELECT ALL`})]})})]}),i&&(0,S.jsx)(`div`,{className:`p-3 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2`,children:t.map(e=>{let t=D.has(e.problem_number);return(0,S.jsxs)(`div`,{onClick:()=>J(e.problem_number),className:`p-2.5 border-2 transition-all cursor-pointer select-none flex items-start gap-2.5 ${t?`bg-amber-50/80 border-amber-600 shadow-[2px_2px_0px_0px_#d97706]`:`bg-paper-white border-slate-300 hover:border-ink-black`}`,children:[(0,S.jsx)(`div`,{className:`mt-0.5 shrink-0`,children:t?(0,S.jsx)(f,{className:`w-4 h-4 text-emerald-600 stroke-[2.5]`}):(0,S.jsx)(o,{className:`w-4 h-4 text-slate-400 stroke-[2]`})}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsxs)(`span`,{className:`font-mono text-[9px] font-bold text-trash-gray`,children:[`#`,e.problem_number]}),(0,S.jsx)(`span`,{className:`px-1.5 py-0.2 rounded font-arcade text-[7px] font-bold uppercase text-white ${e.difficulty===`Easy`?`bg-emerald-600`:e.difficulty===`Medium`?`bg-amber-600`:`bg-rose-600`}`,children:e.difficulty})]}),(0,S.jsx)(`h3`,{className:`font-headline-md text-xs font-bold text-ink-black truncate mt-0.5`,children:e.name}),(0,S.jsxs)(`div`,{className:`text-[10px] font-code-mono text-slate-500 truncate mt-0.5`,children:[`T: `,e.time_complexity,` | S: `,e.space_complexity]})]})]},e.problem_number)})})]},e)}),G.size===0&&(0,S.jsxs)(`div`,{className:`p-8 text-center bg-paper-white border-2 border-dashed border-slate-300 text-trash-gray space-y-2`,children:[(0,S.jsx)(n,{className:`w-8 h-8 mx-auto text-slate-400`}),(0,S.jsx)(`p`,{className:`font-arcade text-xs font-bold`,children:`NO MATCHING PROBLEMS FOUND`}),(0,S.jsx)(`p`,{className:`text-xs font-sans`,children:`Try searching another keyword or clearing filters.`})]})]}),(0,S.jsxs)(`div`,{className:`p-3 sm:p-4 bg-paper-white border-t-[3px] border-ink-black shrink-0 flex flex-col sm:flex-row items-center justify-between gap-3 shadow-[0px_-4px_10px_rgba(0,0,0,0.05)]`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`div`,{className:`w-7 h-7 rounded-lg bg-emerald-100 border border-emerald-800 flex items-center justify-center`,children:(0,S.jsx)(s,{className:`w-4 h-4 text-emerald-700`})}),(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`span`,{className:`font-arcade text-[10px] font-bold text-ink-black`,children:[D.size,` of `,H.length,` PROBLEMS SELECTED`]}),(0,S.jsx)(`div`,{className:`font-sans text-[11px] text-trash-gray font-semibold`,children:`Target: FSRS (New)`})]})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 w-full sm:w-auto justify-end`,children:[z&&(0,S.jsx)(`span`,{className:`font-arcade text-[9px] text-rose-600 font-bold mr-2 truncate`,children:z}),(0,S.jsx)(`button`,{onClick:async()=>{if(D.size!==0){I(!0),B(null),R(`Enrolling ${D.size} problems into FSRS...`);try{let e=H.filter(e=>D.has(e.problem_number));await y(e),K(),R(`Successfully enrolled ${e.length} problems!`),setTimeout(()=>{g(),i()},700)}catch(e){console.error(`Failed to batch activate:`,e),B(e instanceof Error?e.message:`Failed to enroll problems`),I(!1)}}},disabled:D.size===0||F,className:`w-full sm:w-auto px-6 py-2.5 bg-gradient-to-r from-amber-400 to-grass-green hover:from-amber-300 hover:to-emerald-400 text-ink-black font-arcade text-[10px] font-bold border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer flex items-center justify-center gap-2 disabled:opacity-40 disabled:cursor-not-allowed`,children:F?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(t,{className:`w-3.5 h-3.5 animate-spin`}),(0,S.jsx)(`span`,{children:`ENROLLING...`})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(u,{className:`w-3.5 h-3.5 text-amber-900`}),(0,S.jsxs)(`span`,{children:[`ENROLL `,D.size,` PROBLEMS (FSRS)`]})]})})]})]})]})]})})}export{w as default}; \ No newline at end of file +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Lt as t,S as n,Tt as r,_ as i,_t as a,a as o,dt as s,g as c,k as l,mt as u,o as d,rt as f,v as p,vt as m,xt as h,zt as g}from"./vendor-react-q-oOktF_.js";import{a as _,i as v,l as y,o as b}from"./index-Bcgsshpk.js";var x=e(g(),1),S=t(),C=[217,242,1,49,20];function w({isOpen:e,onClose:t,onCompleted:g,userId:w}){let[T,E]=(0,x.useState)(`welcome`),[D,O]=(0,x.useState)(new Set),[k,A]=(0,x.useState)(``),[j,M]=(0,x.useState)(`ALL`),[N,P]=(0,x.useState)({}),[F,I]=(0,x.useState)(!1),[L,R]=(0,x.useState)(null),[z,B]=(0,x.useState)(null),V=()=>`algospaced_onboarding_done_${w===`sandbox-user-id`?`sandbox`:w||`sandbox`}`;(0,x.useEffect)(()=>{if(e){let e=localStorage.getItem(V());E(e?`checklist`:`welcome`),B(null),R(null)}},[e,w]);let H=(0,x.useMemo)(()=>v(),[]),U=(0,x.useMemo)(()=>_(),[]),W=(0,x.useMemo)(()=>{let e=k.trim().toLowerCase();return H.filter(t=>j!==`ALL`&&t.pattern!==j?!1:!e||t.name.toLowerCase().includes(e)||t.problem_number.toString().includes(e)||t.pattern.toLowerCase().includes(e)||t.difficulty.toLowerCase().includes(e))},[H,k,j]),G=(0,x.useMemo)(()=>{let e=new Map;for(let t of W){let n=e.get(t.pattern)||[];n.push(t),e.set(t.pattern,n)}return e},[W]);if(!e)return null;let K=()=>{localStorage.setItem(V(),`true`)},q=async()=>{I(!0),B(null),R(`Enrolling 5 foundational starter problems...`);try{let e=C.map(e=>b(e)).filter(e=>e!==void 0);await y(e),K(),R(`All 5 starter problems enrolled into Box 1!`),setTimeout(()=>{g(),t()},700)}catch(e){console.error(`Failed to start from scratch:`,e),B(e instanceof Error?e.message:`Failed to enroll starter problems`),I(!1)}},J=e=>{O(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Y=e=>{let t=H.filter(t=>t.pattern===e),n=t.every(e=>D.has(e.problem_number));O(e=>{let r=new Set(e);for(let e of t)n?r.delete(e.problem_number):r.add(e.problem_number);return r})},X=e=>{O(t=>{let n=new Set(t);for(let t of H)t.difficulty===e&&n.add(t.problem_number);return n})},Z=()=>{O(new Set(H.map(e=>e.problem_number)))},Q=()=>{O(new Set)},$=e=>{P(t=>({...t,[e]:!t[e]}))};return(0,S.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/75 backdrop-blur-sm p-3 sm:p-6 overflow-y-auto`,children:(0,S.jsxs)(`div`,{className:`w-full max-w-4xl max-h-[92vh] bg-paper-white border-[4px] border-ink-black gadget-shadow flex flex-col relative overflow-hidden text-ink-black`,children:[(0,S.jsxs)(`div`,{className:`h-10 bg-gradient-to-r from-amber-400 via-amber-300 to-grass-green border-b-[3px] border-ink-black px-4 flex items-center justify-between shrink-0`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`w-3 h-3 rounded-full bg-rose-500 border border-ink-black`}),(0,S.jsx)(`span`,{className:`w-3 h-3 rounded-full bg-amber-500 border border-ink-black`}),(0,S.jsx)(`span`,{className:`w-3 h-3 rounded-full bg-emerald-500 border border-ink-black`}),(0,S.jsxs)(`span`,{className:`font-arcade text-[11px] font-bold tracking-wider text-ink-black uppercase ml-2 flex items-center gap-1.5`,children:[(0,S.jsx)(f,{className:`w-4 h-4 text-amber-900`}),`GET STARTED`]})]}),(0,S.jsx)(`button`,{onClick:()=>{K(),t()},disabled:F,className:`p-1 hover:bg-black/10 rounded transition-colors text-ink-black cursor-pointer border-0`,title:`Dismiss for now`,children:(0,S.jsx)(d,{className:`w-4 h-4`})})]}),T===`welcome`&&(0,S.jsxs)(`div`,{className:`p-6 sm:p-10 space-y-8 overflow-y-auto custom-scrollbar text-center`,children:[(0,S.jsxs)(`div`,{className:`space-y-3`,children:[(0,S.jsxs)(`div`,{className:`inline-flex items-center gap-2 px-3 py-1 bg-amber-100 border-2 border-ink-black font-arcade text-[10px] font-bold text-amber-900 uppercase`,children:[(0,S.jsx)(p,{className:`w-3.5 h-3.5 text-amber-700`}),`WELCOME TO ALGOSPACED`]}),(0,S.jsx)(`h1`,{className:`font-headline-md text-2xl sm:text-4xl font-extrabold text-ink-black tracking-tight`,children:`How would you like to begin your journey?`}),(0,S.jsx)(`p`,{className:`font-sans text-xs sm:text-sm text-trash-gray max-w-xl mx-auto leading-relaxed font-semibold`,children:`AlgoSpaced uses a 5-box Leitner spaced repetition engine. Choose how to seed your active practice cards.`})]}),(0,S.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6 max-w-2xl mx-auto text-left`,children:[(0,S.jsxs)(`div`,{className:`p-5 sm:p-6 bg-gradient-to-br from-emerald-50 to-emerald-100/60 border-[3px] border-ink-black gadget-shadow hover:translate-y-[-2px] transition-all flex flex-col justify-between space-y-4`,children:[(0,S.jsxs)(`div`,{className:`space-y-3`,children:[(0,S.jsx)(`div`,{className:`w-12 h-12 bg-grass-green border-2 border-ink-black rounded-xl flex items-center justify-center shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:(0,S.jsx)(h,{className:`w-6 h-6 text-ink-black stroke-[2.5]`})}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`span`,{className:`font-arcade text-[8px] font-bold text-emerald-800 uppercase tracking-wide`,children:`RECOMMENDED FOR BEGINNERS`}),(0,S.jsx)(`h2`,{className:`font-headline-md text-lg sm:text-xl font-bold text-ink-black mt-0.5`,children:`🌱 Start From Scratch`})]}),(0,S.jsx)(`p`,{className:`font-sans text-xs text-trash-gray leading-relaxed font-semibold`,children:`Begin with the 5 foundational starter problems: Contains Duplicate, Valid Anagram, Two Sum, Group Anagrams, and Valid Parentheses.`})]}),(0,S.jsx)(`button`,{onClick:q,disabled:F,className:`w-full py-3 bg-grass-green hover:bg-emerald-400 text-ink-black font-arcade text-[10px] font-bold border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer flex items-center justify-center gap-2 disabled:opacity-50`,children:F?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(l,{className:`w-4 h-4 animate-spin`}),(0,S.jsx)(`span`,{children:`INITIALIZING...`})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(m,{className:`w-4 h-4 stroke-[3]`}),(0,S.jsx)(`span`,{children:`START FRESH (5 PROBLEMS)`})]})})]}),(0,S.jsxs)(`div`,{className:`p-5 sm:p-6 bg-gradient-to-br from-amber-50 to-orange-100/60 border-[3px] border-ink-black gadget-shadow hover:translate-y-[-2px] transition-all flex flex-col justify-between space-y-4`,children:[(0,S.jsxs)(`div`,{className:`space-y-3`,children:[(0,S.jsx)(`div`,{className:`w-12 h-12 bg-amber-400 border-2 border-ink-black rounded-xl flex items-center justify-center shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:(0,S.jsx)(o,{className:`w-6 h-6 text-ink-black stroke-[2.5]`})}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`span`,{className:`font-arcade text-[8px] font-bold text-amber-800 uppercase tracking-wide`,children:`IF YOU'VE ALREADY SOLVED SOME PROBLEMS ELSEWHERE`}),(0,S.jsx)(`h2`,{className:`font-headline-md text-lg sm:text-xl font-bold text-ink-black mt-0.5`,children:`⚡ Fast-Track Checklist`})]}),(0,S.jsx)(`p`,{className:`font-sans text-xs text-trash-gray leading-relaxed font-semibold`,children:`Already solved some problems? Check off problems you've already solved elsewhere to seed your review queue and update your progress.`})]}),(0,S.jsxs)(`button`,{onClick:()=>E(`checklist`),disabled:F,className:`w-full py-3 bg-amber-400 hover:bg-amber-300 text-ink-black font-arcade text-[10px] font-bold border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer flex items-center justify-center gap-2`,children:[(0,S.jsx)(`span`,{children:`SELECT WHAT I KNOW (150 POOL)`}),(0,S.jsx)(r,{className:`w-4 h-4 rotate-180`})]})]})]}),L&&(0,S.jsx)(`p`,{className:`font-arcade text-[10px] text-emerald-700 font-bold animate-pulse`,children:L}),z&&(0,S.jsx)(`p`,{className:`font-arcade text-[10px] text-rose-600 font-bold`,children:z})]}),T===`checklist`&&(0,S.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:[(0,S.jsxs)(`div`,{className:`p-3 sm:p-4 bg-amber-50/60 border-b-[2px] border-ink-black shrink-0 space-y-3`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsxs)(`button`,{onClick:()=>E(`welcome`),className:`px-2.5 py-1.5 bg-paper-white hover:bg-slate-100 border-2 border-ink-black font-arcade text-[9px] font-bold text-ink-black flex items-center gap-1 cursor-pointer transition-colors shadow-[1px_1px_0px_0px_rgba(30,41,59,1)]`,children:[(0,S.jsx)(r,{className:`w-3.5 h-3.5`}),`BACK`]}),(0,S.jsx)(`h2`,{className:`font-headline-md text-base sm:text-lg font-bold text-ink-black`,children:`Fast-Track Catalog Checklist`})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 bg-paper-white border-2 border-ink-black p-1.5 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,S.jsx)(`span`,{className:`font-arcade text-[8px] font-bold text-trash-gray px-1 uppercase`,children:`FSRS STATE:`}),(0,S.jsx)(`span`,{className:`px-2 py-1 font-arcade text-[9px] font-bold bg-amber-400 text-ink-black border border-ink-black`,children:`ALL START AS 'NEW'`})]})]}),(0,S.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2 items-center justify-between`,children:[(0,S.jsxs)(`div`,{className:`relative w-full sm:w-72`,children:[(0,S.jsx)(n,{className:`w-3.5 h-3.5 text-trash-gray absolute left-3 top-1/2 -translate-y-1/2`}),(0,S.jsx)(`input`,{type:`text`,value:k,onChange:e=>A(e.target.value),placeholder:`Search by title, number, or pattern...`,"aria-label":`Search problems by title, number, or pattern`,className:`w-full pl-8 pr-3 py-1.5 bg-paper-white border-2 border-ink-black font-sans text-xs text-ink-black font-medium outline-none focus:bg-amber-50`}),k&&(0,S.jsx)(`button`,{onClick:()=>A(``),"aria-label":`Clear search`,className:`absolute right-2 top-1/2 -translate-y-1/2 text-trash-gray hover:text-ink-black p-0.5 cursor-pointer`,children:(0,S.jsx)(d,{className:`w-3 h-3`})})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap w-full sm:w-auto justify-end`,children:[(0,S.jsx)(`button`,{onClick:()=>X(`Easy`),className:`px-2 py-1 bg-emerald-100 hover:bg-emerald-200 border border-emerald-800 text-emerald-900 font-arcade text-[8px] font-bold cursor-pointer transition-colors`,children:`+ ALL EASY`}),(0,S.jsx)(`button`,{onClick:()=>X(`Medium`),className:`px-2 py-1 bg-amber-100 hover:bg-amber-200 border border-amber-800 text-amber-900 font-arcade text-[8px] font-bold cursor-pointer transition-colors`,children:`+ ALL MEDIUM`}),(0,S.jsx)(`button`,{onClick:Z,className:`px-2 py-1 bg-purple-100 hover:bg-purple-200 border border-purple-800 text-purple-900 font-arcade text-[8px] font-bold cursor-pointer transition-colors`,children:`SELECT ALL (150)`}),(0,S.jsx)(`button`,{onClick:Q,className:`px-2 py-1 bg-slate-100 hover:bg-slate-200 border border-slate-700 text-slate-800 font-arcade text-[8px] font-bold cursor-pointer transition-colors`,children:`CLEAR`})]})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 overflow-x-auto custom-scrollbar pb-1 text-[8px] font-arcade font-bold`,children:[(0,S.jsxs)(`button`,{onClick:()=>M(`ALL`),className:`px-2 py-0.5 border cursor-pointer shrink-0 transition-colors ${j===`ALL`?`bg-ink-black text-amber-300 border-ink-black`:`bg-paper-white text-trash-gray border-slate-300 hover:text-ink-black`}`,children:[`ALL PATTERNS (`,H.length,`)`]}),U.map(e=>{let t=H.filter(t=>t.pattern===e).length;return(0,S.jsxs)(`button`,{onClick:()=>M(e),className:`px-2 py-0.5 border cursor-pointer shrink-0 transition-colors ${j===e?`bg-ink-black text-amber-300 border-ink-black`:`bg-paper-white text-trash-gray border-slate-300 hover:text-ink-black`}`,children:[e.toUpperCase(),` (`,t,`)`]},e)})]})]}),(0,S.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 sm:p-6 custom-scrollbar space-y-4 bg-slate-50/50`,children:[Array.from(G.entries()).map(([e,t])=>{let n=t.filter(e=>D.has(e.problem_number)).length,r=n===t.length,o=N[e]!==!1;return(0,S.jsxs)(`div`,{className:`bg-paper-white border-2 border-ink-black gadget-shadow overflow-hidden`,children:[(0,S.jsxs)(`div`,{className:`px-3.5 py-2.5 bg-gradient-to-r from-amber-100 to-amber-50 border-b-2 border-ink-black flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`button`,{onClick:()=>$(e),className:`p-1 hover:bg-black/10 rounded cursor-pointer transition-colors text-ink-black`,children:o?(0,S.jsx)(u,{className:`w-3.5 h-3.5`}):(0,S.jsx)(a,{className:`w-3.5 h-3.5`})}),(0,S.jsx)(`span`,{className:`font-headline-md text-xs sm:text-sm font-bold text-ink-black`,children:e}),(0,S.jsxs)(`span`,{className:`font-arcade text-[8px] font-bold px-1.5 py-0.5 rounded bg-amber-900/10 text-amber-900 border border-amber-900/20`,children:[n,` / `,t.length,` selected`]})]}),(0,S.jsx)(`button`,{onClick:()=>Y(e),className:`px-2 py-1 font-arcade text-[8px] font-bold border border-ink-black bg-paper-white hover:bg-amber-200 transition-colors cursor-pointer flex items-center gap-1 shadow-[1px_1px_0px_0px_rgba(30,41,59,1)]`,children:r?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(i,{className:`w-3 h-3 text-emerald-600`}),(0,S.jsx)(`span`,{children:`DESELECT ALL`})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(c,{className:`w-3 h-3 text-slate-500`}),(0,S.jsx)(`span`,{children:`SELECT ALL`})]})})]}),o&&(0,S.jsx)(`div`,{className:`p-3 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2`,children:t.map(e=>{let t=D.has(e.problem_number);return(0,S.jsxs)(`div`,{onClick:()=>J(e.problem_number),className:`p-2.5 border-2 transition-all cursor-pointer select-none flex items-start gap-2.5 ${t?`bg-amber-50/80 border-amber-600 shadow-[2px_2px_0px_0px_#d97706]`:`bg-paper-white border-slate-300 hover:border-ink-black`}`,children:[(0,S.jsx)(`div`,{className:`mt-0.5 shrink-0`,children:t?(0,S.jsx)(i,{className:`w-4 h-4 text-emerald-600 stroke-[2.5]`}):(0,S.jsx)(c,{className:`w-4 h-4 text-slate-400 stroke-[2]`})}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsxs)(`span`,{className:`font-mono text-[9px] font-bold text-trash-gray`,children:[`#`,e.problem_number]}),(0,S.jsx)(`span`,{className:`px-1.5 py-0.2 rounded font-arcade text-[7px] font-bold uppercase text-white ${e.difficulty===`Easy`?`bg-emerald-600`:e.difficulty===`Medium`?`bg-amber-600`:`bg-rose-600`}`,children:e.difficulty})]}),(0,S.jsx)(`h3`,{className:`font-headline-md text-xs font-bold text-ink-black truncate mt-0.5`,children:e.name}),(0,S.jsxs)(`div`,{className:`text-[10px] font-code-mono text-slate-500 truncate mt-0.5`,children:[`T: `,e.time_complexity,` | S: `,e.space_complexity]})]})]},e.problem_number)})})]},e)}),G.size===0&&(0,S.jsxs)(`div`,{className:`p-8 text-center bg-paper-white border-2 border-dashed border-slate-300 text-trash-gray space-y-2`,children:[(0,S.jsx)(n,{className:`w-8 h-8 mx-auto text-slate-400`}),(0,S.jsx)(`p`,{className:`font-arcade text-xs font-bold`,children:`NO MATCHING PROBLEMS FOUND`}),(0,S.jsx)(`p`,{className:`text-xs font-sans`,children:`Try searching another keyword or clearing filters.`})]})]}),(0,S.jsxs)(`div`,{className:`p-3 sm:p-4 bg-paper-white border-t-[3px] border-ink-black shrink-0 flex flex-col sm:flex-row items-center justify-between gap-3 shadow-[0px_-4px_10px_rgba(0,0,0,0.05)]`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`div`,{className:`w-7 h-7 rounded-lg bg-emerald-100 border border-emerald-800 flex items-center justify-center`,children:(0,S.jsx)(s,{className:`w-4 h-4 text-emerald-700`})}),(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`span`,{className:`font-arcade text-[10px] font-bold text-ink-black`,children:[D.size,` of `,H.length,` PROBLEMS SELECTED`]}),(0,S.jsx)(`div`,{className:`font-sans text-[11px] text-trash-gray font-semibold`,children:`Target: FSRS (New)`})]})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 w-full sm:w-auto justify-end`,children:[z&&(0,S.jsx)(`span`,{className:`font-arcade text-[9px] text-rose-600 font-bold mr-2 truncate`,children:z}),(0,S.jsx)(`button`,{onClick:async()=>{if(D.size!==0){I(!0),B(null),R(`Enrolling ${D.size} problems into FSRS...`);try{let e=H.filter(e=>D.has(e.problem_number));await y(e),K(),R(`Successfully enrolled ${e.length} problems!`),setTimeout(()=>{g(),t()},700)}catch(e){console.error(`Failed to batch activate:`,e),B(e instanceof Error?e.message:`Failed to enroll problems`),I(!1)}}},disabled:D.size===0||F,className:`w-full sm:w-auto px-6 py-2.5 bg-gradient-to-r from-amber-400 to-grass-green hover:from-amber-300 hover:to-emerald-400 text-ink-black font-arcade text-[10px] font-bold border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer flex items-center justify-center gap-2 disabled:opacity-40 disabled:cursor-not-allowed`,children:F?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(l,{className:`w-3.5 h-3.5 animate-spin`}),(0,S.jsx)(`span`,{children:`ENROLLING...`})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(o,{className:`w-3.5 h-3.5 text-amber-900`}),(0,S.jsxs)(`span`,{children:[`ENROLL `,D.size,` PROBLEMS (FSRS)`]})]})})]})]})]})]})})}export{w as default}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/PrincessChamber-BkGsNxLj.js b/algospaced-ui/dist/assets/PrincessChamber-BkGsNxLj.js new file mode 100644 index 0000000000000000000000000000000000000000..b29e873f156bba54d1617e3a9c31ce453572b38a --- /dev/null +++ b/algospaced-ui/dist/assets/PrincessChamber-BkGsNxLj.js @@ -0,0 +1 @@ +import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{D as n,F as r,H as i,Lt as a,O as o,a as s,c,dt as l,f as u,o as d,s as f,st as p,v as m,w as h,x as g,xt as _,yt as v,zt as y}from"./vendor-react-q-oOktF_.js";import{C as b,S as x,_ as S,b as C,g as w,v as T,x as E,y as D}from"./index-Bcgsshpk.js";var O=t(y(),1),k={1:{particleType:`pollen`,particleCount:16,particleColors:[`#FDE047`,`#FEF08A`,`#86EFAC`],gradientBg:`from-[#FFFDF0] via-[#FFF9E6] to-[#FEF3C7]`,glowColor:`rgba(251, 191, 36, 0.3)`,badgeLabel:`🌾 Plains Breeze`},2:{particleType:`leaves`,particleCount:18,particleColors:[`#86EFAC`,`#4ADE80`,`#22C55E`,`#A7F3D0`],gradientBg:`from-[#F0FDF4] via-[#DCFCE7] to-[#FEF9C3]`,glowColor:`rgba(34, 197, 94, 0.3)`,badgeLabel:`🍃 Whispering Leaves`},3:{particleType:`spores`,particleCount:22,particleColors:[`#67E8F9`,`#38BDF8`,`#818CF8`,`#C084FC`],gradientBg:`from-[#F0F9FF] via-[#E0F2FE] to-[#EDE9FE]`,glowColor:`rgba(56, 189, 248, 0.35)`,badgeLabel:`✨ Crystal Spores`},4:{particleType:`snow`,particleCount:28,particleColors:[`#FFFFFF`,`#E0F2FE`,`#BAE6FD`],gradientBg:`from-[#F8FAFC] via-[#F1F5F9] to-[#E2E8F0]`,glowColor:`rgba(186, 230, 253, 0.4)`,badgeLabel:`❄️ Alpine Snowfall`},5:{particleType:`runes`,particleCount:20,particleColors:[`#E879F9`,`#C084FC`,`#A855F7`,`#F472B6`],gradientBg:`from-[#FAF5FF] via-[#F3E8FF] to-[#FCE7F3]`,glowColor:`rgba(192, 132, 252, 0.4)`,badgeLabel:`🔮 Arcane Runes`},6:{particleType:`stardust`,particleCount:35,particleColors:[`#FDE047`,`#F59E0B`,`#E11D48`,`#818CF8`],gradientBg:`from-[#FFFBEB] via-[#FEF3C7] to-[#FFE4E6]`,glowColor:`rgba(245, 158, 11, 0.5)`,badgeLabel:`👑 Spire Gates`}};function A(e){return e<=30?k[1]:e<=60?k[2]:e<=90?k[3]:e<=120?k[4]:e<150?k[5]:k[6]}var j=a();function M({emotion:e,floor:t,rhythm:n,activity:r,isLoading:i=!1,className:a=``,onClick:o}){let s=T[e]||T.smiling_warmly,c=(0,O.useMemo)(()=>A(t),[t]),l=(0,O.useMemo)(()=>{switch(n){case`dawn`:return`from-amber-400/30 via-yellow-300/20 to-transparent`;case`dusk`:return`from-orange-500/30 via-purple-500/20 to-transparent`;case`night`:return`from-indigo-600/30 via-blue-500/20 to-transparent`;default:return`from-amber-300/25 via-sky-300/20 to-transparent`}},[n]);return(0,j.jsxs)(`div`,{onClick:o,className:`relative flex flex-col items-center justify-end select-none pointer-events-auto transition-transform ${a}`,children:[(0,j.jsx)(`div`,{className:`absolute -inset-10 overflow-hidden pointer-events-none z-0`,children:Array.from({length:Math.min(16,c.particleCount)}).map((e,t)=>{let n=c.particleColors[t%c.particleColors.length],r=`${t*17%100}%`,i=`${7+t%5*2}s`,a=`${t*.8%4}s`,o=c.particleType===`leaves`||c.particleType===`runes`?`w-2 h-2`:`w-1.5 h-1.5`;return(0,j.jsx)(`span`,{className:`absolute rounded-full opacity-60 animate-pulse ${o}`,style:{backgroundColor:n,left:r,top:`${t*21%90}%`,boxShadow:`0 0 10px ${n}`,animationDuration:i,animationDelay:a}},t)})}),(0,j.jsx)(`div`,{className:`absolute bottom-4 inset-x-0 h-48 sm:h-72 md:h-96 bg-radial ${l} blur-2xl opacity-70 pointer-events-none z-0`}),(0,j.jsxs)(`div`,{className:`relative z-10 flex flex-col items-start justify-end`,children:[r&&(0,j.jsx)(`div`,{className:`mb-2 max-w-[120px] sm:max-w-xs text-center pointer-events-none animate-in fade-in duration-300`,children:(0,j.jsxs)(`span`,{className:`text-[9px] sm:text-[10px] font-mono font-medium text-[#bfe1ff] bg-[#101e2e]/85 px-2 sm:px-2.5 py-0.5 rounded-full border border-[#3e6080]/70 shadow-md inline-flex items-center gap-1 sm:gap-1.5 backdrop-blur-xs`,children:[(0,j.jsx)(`span`,{className:`text-amber-400`,children:`🏰`}),(0,j.jsx)(`span`,{className:`truncate`,children:r})]})}),(0,j.jsx)(`div`,{className:`relative h-[28vh] sm:h-[40vh] md:h-[46vh] lg:h-[50vh] max-h-[220px] sm:max-h-[380px] md:max-h-[460px] lg:max-h-[500px] min-h-[160px] sm:min-h-[240px] md:min-h-[300px] w-auto max-w-[110px] sm:max-w-[200px] md:max-w-[270px] lg:max-w-[320px] flex items-end justify-end`,children:(0,j.jsx)(`img`,{src:s.imagePath,alt:s.label,loading:`eager`,className:`h-full w-auto max-h-[85vh] object-contain object-bottom-left drop-shadow-[0_16px_32px_rgba(0,0,0,0.55)] transition-all duration-300 ${i?`scale-[1.02] filter brightness-110 saturate-125`:`scale-100`}`,onError:e=>{let t=e.currentTarget;t.src.endsWith(`/sprites/princess/smiling_warmly.webp`)?t.src.endsWith(`/sprites/princess/neutral.webp`)||(t.src=`/sprites/princess/neutral.webp`):t.src=`/sprites/princess/smiling_warmly.webp`}})})]})]})}var N=[`I solved a tough task today!`,`I'm feeling stuck on something.`,`Just need a breather.`],P={backgroundColor:`rgba(20, 36, 54, 0.94)`,boxShadow:`0 0 0 2px #0a1420, inset 0 0 0 3px #4c7396, inset 1px 1px 0 4px #8db7dc, inset -1px -1px 0 4px #1a2c3f, inset 0 0 0 5px #0c1724, 0 10px 28px rgba(0, 0, 0, 0.75)`};function F({characterName:e,text:t,isStreaming:n=!1,isLoading:i=!1,choices:a,toolCalls:s,onSelectChoice:l,onSendMessage:u,onTypingStatusChange:p,currentFloor:g,bondTier:_,satchelCount:y=0,isMuted:b=!1,onToggleMute:x,onOpenProgress:S,onOpenSatchel:C,onOpenHistory:w,onMinimize:T,onClose:E,className:D=``}){let[k,A]=(0,O.useState)(``),[M,F]=(0,O.useState)(!1),[I,L]=(0,O.useState)(0),[R,z]=(0,O.useState)(``),[B,V]=(0,O.useState)(!1),H=(0,O.useRef)(t),U=(0,O.useRef)(!1),W=(0,O.useRef)(null),G=(0,O.useRef)(null),K=n||M;(0,O.useEffect)(()=>{p?.(K)},[K,p]);let q=(0,O.useMemo)(()=>Array.isArray(a)&&a.length>0?a.slice(0,4):N,[a]),J=I{if(n){W.current&&=(clearInterval(W.current),null),U.current=!0,H.current=t;return}if(U.current){U.current=!1,H.current=t,W.current&&=(clearInterval(W.current),null);return}if(t!==H.current&&!i){if(H.current=t,!t){W.current&&=(clearInterval(W.current),null);return}W.current&&clearInterval(W.current);let e=0,n=setInterval(()=>{e++,A(t.slice(0,e)),F(!0),e>=t.length&&(clearInterval(n),W.current=null,F(!1))},20);return W.current=n,()=>{clearInterval(n),W.current=null,F(!1)}}},[t,i,n]);let X=(0,O.useCallback)(()=>{W.current&&=(clearInterval(W.current),null),F(!1)},[]),Z=()=>{let e=R.trim();!e||i||n||(u(e),z(``))};return(0,O.useEffect)(()=>{let e=e=>{if(e.key===`Escape`&&E){e.preventDefault(),E();return}if(!B){if(e.key>=`1`&&e.key<=String(q.length)){let t=parseInt(e.key,10)-1;q[t]&&!i&&!n&&(e.preventDefault(),l(q[t]));return}if(e.key===`ArrowUp`){e.preventDefault(),L(e=>(e-1+q.length)%q.length);return}if(e.key===`ArrowDown`){e.preventDefault(),L(e=>(e+1)%q.length);return}if(e.key===`Enter`){!i&&!n&&q[J]&&(e.preventDefault(),l(q[J]));return}e.key===` `&&K&&(e.preventDefault(),X())}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[B,q,J,i,n,K,l,X,E]),(0,j.jsxs)(`div`,{className:`relative flex flex-col gap-2 w-full ${D}`,children:[(0,j.jsxs)(`div`,{onClick:X,className:`relative w-full rounded-md sm:rounded-lg text-white pt-3.5 pb-3.5 pr-3.5 pl-8 sm:pt-5 sm:pb-5 sm:pr-5 sm:pl-14 md:pl-16 lg:pl-18 flex flex-col gap-2.5 backdrop-blur-md transition-all select-none cursor-pointer`,style:P,children:[(0,j.jsxs)(`div`,{className:`absolute -top-7 right-1 flex items-center gap-1 sm:gap-1.5 z-30`,onClick:e=>e.stopPropagation(),children:[S&&(0,j.jsxs)(`button`,{type:`button`,onClick:S,className:`px-2 py-0.5 bg-[#101e2e]/90 hover:bg-[#1f3750] border border-[#3e6080]/80 hover:border-[#67b1ec] rounded text-[10px] sm:text-[11px] font-mono font-bold text-[#8cb4db] hover:text-white transition-all cursor-pointer flex items-center gap-1 shadow-md`,title:`Spire Tower Road (Floor Progress)`,children:[(0,j.jsx)(v,{className:`w-3 h-3 text-amber-400`}),(0,j.jsxs)(`span`,{children:[g,`/150 LC`]})]}),C&&(0,j.jsxs)(`button`,{type:`button`,onClick:C,className:`px-2 py-0.5 bg-[#101e2e]/90 hover:bg-[#1f3750] border border-[#3e6080]/80 hover:border-[#67b1ec] rounded text-[10px] sm:text-[11px] font-mono font-bold text-[#8cb4db] hover:text-white transition-all cursor-pointer flex items-center gap-1 shadow-md`,title:`Open Royal Satchel`,children:[(0,j.jsx)(h,{className:`w-3 h-3 text-amber-400`}),(0,j.jsx)(`span`,{className:`hidden sm:inline`,children:`Satchel`}),y>0&&(0,j.jsxs)(`span`,{className:`text-[9px] text-[#f3cb65]`,children:[`(`,y,`)`]})]}),w&&(0,j.jsxs)(`button`,{type:`button`,onClick:w,className:`px-2 py-0.5 bg-[#101e2e]/90 hover:bg-[#1f3750] border border-[#3e6080]/80 hover:border-[#67b1ec] rounded text-[10px] sm:text-[11px] font-mono font-bold text-[#8cb4db] hover:text-white transition-all cursor-pointer flex items-center gap-1 shadow-md`,title:`Dialogue Transcript`,children:[(0,j.jsx)(o,{className:`w-3 h-3 text-[#8cb4db]`}),(0,j.jsx)(`span`,{className:`hidden sm:inline`,children:`Log`})]}),x&&(0,j.jsx)(`button`,{type:`button`,onClick:x,className:`p-1 bg-[#101e2e]/90 hover:bg-[#1f3750] border border-[#3e6080]/80 hover:border-[#67b1ec] rounded text-[#8cb4db] hover:text-white transition-all cursor-pointer shadow-md`,title:b?`Unmute Audio`:`Mute Audio`,children:b?(0,j.jsx)(f,{className:`w-3 h-3`}):(0,j.jsx)(c,{className:`w-3 h-3`})}),T&&(0,j.jsx)(`button`,{type:`button`,onClick:T,className:`p-1 bg-[#101e2e]/90 hover:bg-[#1f3750] border border-[#3e6080]/80 hover:border-[#67b1ec] rounded text-[#8cb4db] hover:text-white transition-all cursor-pointer shadow-md`,title:`Minimize to Taskbar`,children:(0,j.jsx)(r,{className:`w-3 h-3`})}),E&&(0,j.jsx)(`button`,{type:`button`,onClick:E,className:`p-1 bg-[#101e2e]/90 hover:bg-rose-900/70 border border-[#3e6080]/80 hover:border-rose-400 rounded text-[#8cb4db] hover:text-rose-200 transition-all cursor-pointer shadow-md`,title:`Leave Parlor (Esc)`,children:(0,j.jsx)(d,{className:`w-3 h-3`})})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(`span`,{className:`font-mono text-sm sm:text-base font-bold text-[#f3cb65] tracking-wide drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]`,children:[`-`,e||`Princess Aurelia`,`-`]}),_&&(0,j.jsx)(`span`,{className:`hidden md:inline-block text-[9px] font-mono text-[#8cb4db] bg-[#101d2c]/80 border border-[#3e6080]/60 px-1.5 py-0.2 rounded uppercase tracking-wider`,children:_})]}),(0,j.jsxs)(`div`,{className:`min-h-[48px] sm:min-h-[54px] flex flex-col justify-start`,children:[i?(0,j.jsxs)(`div`,{className:`flex items-center gap-2 py-1 text-xs sm:text-sm font-mono text-[#8cb4db]`,children:[(0,j.jsx)(`span`,{className:`inline-block w-2 h-2 bg-[#f3cb65] rounded-full animate-ping`}),(0,j.jsxs)(`span`,{children:[e||`Princess Aurelia`,` is attuning the crystal relay...`]})]}):(0,j.jsxs)(`div`,{className:`font-mono text-xs sm:text-sm md:text-[15px] leading-relaxed text-[#e6edf4] select-text`,children:[(e=>e.split(/(\*[^*]+\*)/g).map((e,t)=>e.startsWith(`*`)&&e.endsWith(`*`)?(0,j.jsx)(`span`,{className:`text-[#f3cb65] italic font-semibold mr-1 inline-block`,children:e},t):(0,j.jsx)(`span`,{children:e},t)))(Y),K&&(0,j.jsx)(`span`,{className:`inline-block w-1.5 h-3.5 bg-[#f3cb65] ml-1 animate-pulse align-middle`})]}),s&&s.length>0&&!i&&(0,j.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 select-none`,children:s.map((e,t)=>(0,j.jsxs)(`span`,{className:`px-2 py-0.5 rounded bg-[#102438] border border-[#44729b] text-[10px] font-mono font-bold text-[#bfe1ff] flex items-center gap-1`,children:[(0,j.jsx)(m,{className:`w-2.5 h-2.5 text-[#f3cb65]`}),(0,j.jsxs)(`span`,{children:[`Enchantment: `,e.name]})]},t))})]}),(0,j.jsx)(`div`,{className:`flex flex-col gap-1 pt-1`,onClick:e=>e.stopPropagation(),children:q.map((e,t)=>{let r=t+1,a=J===t;return(0,j.jsxs)(`button`,{type:`button`,disabled:i||n,onClick:()=>l(e),onMouseEnter:()=>L(t),className:`w-full sm:max-w-[90%] md:max-w-[85%] text-left flex items-center gap-2 px-2.5 py-1 rounded-xs sm:rounded-sm transition-all select-none font-mono text-xs sm:text-sm disabled:opacity-40 disabled:cursor-not-allowed ${a&&!i&&!n?`bg-[#1c3e61]/80 border border-[#4883b6]/80 shadow-[0_0_12px_rgba(72,131,182,0.25)] cursor-pointer`:`border border-transparent hover:bg-[#1c3e61]/35 cursor-pointer`}`,children:[(0,j.jsxs)(`span`,{className:`font-bold shrink-0 ${a?`text-[#e2ecf7]`:`text-[#b4c8dc]`}`,children:[r,`.`]}),(0,j.jsxs)(`span`,{className:`truncate font-medium ${a?`text-[#f3cb65]`:`text-[#dde7f2]`}`,children:[`[`,e,`]`]})]},t)})})]}),(0,j.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),Z()},onClick:e=>e.stopPropagation(),className:`w-full rounded-md sm:rounded-lg text-white py-2 sm:py-2.5 pr-3 sm:pr-4 pl-8 sm:pl-14 md:pl-16 lg:pl-18 flex items-center gap-2 backdrop-blur-md transition-all select-none`,style:P,children:[(0,j.jsx)(`span`,{className:`font-mono text-sm sm:text-base font-bold text-[#e2ecf7] select-none pl-0.5 shrink-0`,children:`>`}),(0,j.jsxs)(`div`,{className:`flex-1 flex items-center bg-[#101e2e]/90 border border-[#3b5d7d] rounded px-2.5 py-1 focus-within:border-[#67b1ec] focus-within:ring-1 focus-within:ring-[#67b1ec]/40 shadow-inner`,children:[(0,j.jsx)(`span`,{className:`text-[#f3cb65] font-mono text-xs sm:text-sm select-none mr-1.5 shrink-0`,children:`[`}),(0,j.jsx)(`input`,{ref:G,type:`text`,value:R,onChange:e=>z(e.target.value),onFocus:()=>V(!0),onBlur:()=>V(!1),disabled:i||n,placeholder:`Speak with ${e||`Princess Aurelia`}...`,className:`flex-1 bg-transparent border-none text-[#e2ecf7] placeholder-[#f3cb65]/70 font-mono text-xs sm:text-sm focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed`}),(0,j.jsx)(`span`,{className:`text-[#f3cb65] font-mono text-xs sm:text-sm select-none ml-1.5 shrink-0`,children:`]`})]}),(0,j.jsxs)(`button`,{type:`submit`,disabled:i||n||!R.trim(),className:`bg-[#34597b] hover:bg-[#3f6990] active:bg-[#2b4c6e] disabled:opacity-40 disabled:cursor-not-allowed border border-[#5c8cb5] hover:border-[#8db7dc] rounded px-3 sm:px-4 py-1 text-xs sm:text-sm font-mono font-bold text-white transition-all cursor-pointer shadow-md select-none shrink-0 flex items-center`,children:[(0,j.jsx)(`span`,{className:`text-[#f3cb65]`,children:`[`}),(0,j.jsx)(`span`,{className:`text-white px-1`,children:`Send`}),(0,j.jsx)(`span`,{className:`text-[#f3cb65]`,children:`]`})]})]})]})}function I({currentFloor:e,onClose:t}){let n=b(e),r=Math.min(100,Math.round(e/150*100));return(0,j.jsx)(`div`,{className:`absolute inset-0 z-50 bg-ink-black/40 backdrop-blur-xs flex items-center justify-center p-3 sm:p-4 animate-in fade-in duration-200 select-none`,onClick:t,children:(0,j.jsxs)(`div`,{className:`bg-[#FFFDF0] border-[3px] border-ink-black rounded-xl p-4 sm:p-5 max-w-md w-full shadow-[6px_6px_0px_0px_#1E293B] flex flex-col gap-3.5`,onClick:e=>e.stopPropagation(),children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between border-b-[2px] border-ink-black pb-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(v,{className:`w-5 h-5 text-indigo-600`}),(0,j.jsx)(`h4`,{className:`font-headline-md font-bold text-sm text-ink-black m-0`,children:`Journey to the Big-O Spire`})]}),(0,j.jsx)(`button`,{type:`button`,onClick:t,className:`p-1 hover:bg-slate-200 rounded text-slate-700 cursor-pointer`,title:`Close`,children:(0,j.jsx)(d,{className:`w-4 h-4`})})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-xs font-bold font-headline-md`,children:[(0,j.jsx)(`span`,{children:`Path Progress:`}),(0,j.jsxs)(`span`,{className:`font-arcade bg-indigo-100 text-indigo-900 px-2 py-0.5 rounded border border-indigo-300`,children:[e,` / 150 Leagues`]})]}),(0,j.jsx)(`div`,{className:`w-full bg-slate-200 h-4 border-[2px] border-ink-black rounded-full overflow-hidden p-0.5`,children:(0,j.jsx)(`div`,{className:`bg-gradient-to-r from-amber-400 via-yellow-400 to-emerald-400 h-full rounded-full transition-all duration-500`,style:{width:`${r}%`}})}),(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-trash-gray font-medium`,children:[(0,j.jsxs)(`span`,{children:[`Progress: `,(0,j.jsxs)(`strong`,{children:[r,`%`]})]}),(0,j.jsxs)(`span`,{children:[`Distance to Tower: `,(0,j.jsxs)(`strong`,{children:[Math.max(0,150-e),` leagues`]})]})]})]}),(0,j.jsxs)(`div`,{className:`bg-white border-[2px] border-ink-black rounded-lg p-3 shadow-[2px_2px_0px_0px_#1E293B] flex flex-col gap-1`,children:[(0,j.jsx)(`div`,{className:`text-[10px] font-bold uppercase text-amber-700 tracking-wider`,children:`Current Realm:`}),(0,j.jsx)(`div`,{className:`font-bold text-xs text-ink-black`,children:n.title}),(0,j.jsx)(`p`,{className:`text-[11px] text-slate-600 m-0 leading-relaxed font-medium`,children:n.description}),(0,j.jsxs)(`div`,{className:`text-[10px] text-amber-900 bg-amber-50 p-1.5 rounded border border-amber-200 italic mt-1`,children:[`📜 `,n.bgLore]})]}),(0,j.jsx)(`div`,{className:`flex items-center justify-between gap-1 text-center`,children:[{floor:30,label:`Arrays`},{floor:60,label:`Pointers`},{floor:90,label:`Trees`},{floor:120,label:`Heaps`},{floor:150,label:`Spire`}].map(t=>{let n=e>=t.floor;return(0,j.jsxs)(`div`,{className:`flex-1 p-1.5 rounded border text-[10px] flex flex-col items-center ${n?`bg-emerald-100 border-emerald-600 text-emerald-900 font-bold`:`bg-slate-100 border-slate-300 text-slate-500`}`,children:[(0,j.jsx)(`span`,{children:n?`✓`:t.floor}),(0,j.jsx)(`span`,{className:`text-[9px] truncate w-full`,children:t.label})]},t.floor)})}),(0,j.jsx)(`div`,{className:`flex items-center justify-end border-t border-slate-200 pt-2 mt-1`,children:(0,j.jsx)(`button`,{type:`button`,onClick:t,className:`px-4 py-1.5 bg-white hover:bg-slate-100 border-[1.5px] border-ink-black rounded font-bold text-xs text-ink-black cursor-pointer shadow-xs active:translate-y-0.5`,children:`Done`})})]})})}function L({unlockedLetters:e,spireChronicles:t,currentFloor:n,heroCodex:r,episodicEvents:a,recentToolTelemetry:o,onRemoveCodexItem:c,onClose:f}){let[v,y]=(0,O.useState)(`letters`),[b,S]=(0,O.useState)(e[e.length-1]||null);return(0,j.jsx)(`div`,{className:`absolute inset-0 z-50 bg-ink-black/50 backdrop-blur-xs flex items-center justify-center p-3 sm:p-4 animate-in fade-in duration-200 select-none`,onClick:f,children:(0,j.jsxs)(`div`,{className:`bg-[#FFFDF0] border-[3px] border-ink-black rounded-xl max-w-lg w-full h-[85%] max-h-[560px] shadow-[6px_6px_0px_0px_#1E293B] flex flex-col overflow-hidden`,onClick:e=>e.stopPropagation(),children:[(0,j.jsxs)(`div`,{className:`bg-white border-b-[2px] border-ink-black px-4 py-2.5 flex items-center justify-between shrink-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(h,{className:`w-5 h-5 text-amber-700`}),(0,j.jsx)(`h4`,{className:`font-headline-md font-bold text-sm text-ink-black m-0`,children:`The Royal Satchel`})]}),(0,j.jsx)(`button`,{type:`button`,onClick:f,className:`p-1 hover:bg-slate-200 rounded text-slate-700 cursor-pointer`,title:`Close`,children:(0,j.jsx)(d,{className:`w-4 h-4`})})]}),(0,j.jsxs)(`div`,{className:`flex border-b-2 border-ink-black bg-amber-100/70 shrink-0`,children:[(0,j.jsxs)(`button`,{type:`button`,onClick:()=>y(`letters`),className:`flex-1 py-2 text-xs font-bold font-headline-md flex items-center justify-center gap-1.5 transition-colors cursor-pointer border-r border-ink-black/20 ${v===`letters`?`bg-[#FFFDF0] text-amber-950 border-b-2 border-b-[#FFFDF0] -mb-[2px]`:`text-slate-600 hover:bg-amber-200/50`}`,children:[(0,j.jsx)(h,{className:`w-3.5 h-3.5`}),(0,j.jsxs)(`span`,{children:[`Missives (`,e.length,`/5)`]})]}),(0,j.jsxs)(`button`,{type:`button`,onClick:()=>y(`diary`),className:`flex-1 py-2 text-xs font-bold font-headline-md flex items-center justify-center gap-1.5 transition-colors cursor-pointer border-r border-ink-black/20 ${v===`diary`?`bg-[#FFFDF0] text-amber-950 border-b-2 border-b-[#FFFDF0] -mb-[2px]`:`text-slate-600 hover:bg-amber-200/50`}`,children:[(0,j.jsx)(_,{className:`w-3.5 h-3.5`}),(0,j.jsxs)(`span`,{children:[`Chronicles (`,t.length,`)`]})]}),(0,j.jsxs)(`button`,{type:`button`,onClick:()=>y(`codex`),className:`flex-1 py-2 text-xs font-bold font-headline-md flex items-center justify-center gap-1.5 transition-colors cursor-pointer ${v===`codex`?`bg-[#FFFDF0] text-amber-950 border-b-2 border-b-[#FFFDF0] -mb-[2px]`:`text-slate-600 hover:bg-amber-200/50`}`,children:[(0,j.jsx)(m,{className:`w-3.5 h-3.5 text-amber-700`}),(0,j.jsx)(`span`,{children:`Codex`})]})]}),(0,j.jsxs)(`div`,{className:`flex-1 p-3 sm:p-4 overflow-y-auto custom-scrollbar flex flex-col gap-3 min-h-0`,children:[v===`letters`&&(0,j.jsxs)(`div`,{className:`flex flex-col gap-3 flex-1`,children:[(0,j.jsx)(`div`,{className:`flex items-center gap-1.5 overflow-x-auto pb-1`,children:[30,60,90,120,150].map(e=>{let t=x[e],r=n>=e,a=b?.floor===e;return(0,j.jsxs)(`button`,{type:`button`,disabled:!r,onClick:()=>r&&S(t),className:`px-3 py-1 rounded-full text-[11px] font-bold border-[1.5px] border-ink-black flex items-center gap-1 shrink-0 transition-all cursor-pointer ${r?a?`bg-[#FFE24C] text-ink-black shadow-[1.5px_1.5px_0px_0px_#1E293B]`:`bg-white hover:bg-amber-100 text-slate-800`:`opacity-40 bg-slate-200 text-slate-500 cursor-not-allowed`}`,children:[r?(0,j.jsx)(`span`,{children:`📜`}):(0,j.jsx)(i,{className:`w-3 h-3`}),(0,j.jsxs)(`span`,{children:[`League `,e]})]},e)})}),b?(0,j.jsxs)(`div`,{className:`bg-[#FFF9E6] border-[2px] border-amber-900/40 rounded-lg p-4 shadow-sm flex-1 overflow-y-auto custom-scrollbar flex flex-col select-text`,children:[(0,j.jsxs)(`div`,{className:`border-b border-amber-800/20 pb-2 mb-3 flex items-center justify-between`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`text-[10px] font-bold text-amber-800 uppercase tracking-wider`,children:[b.chapterTitle,` • League `,b.floor]}),(0,j.jsx)(`h5`,{className:`font-headline-md font-bold text-sm text-amber-950 m-0`,children:b.title})]}),(0,j.jsx)(`span`,{className:`text-xl`,children:`🪶`})]}),(0,j.jsx)(`p`,{className:`text-xs sm:text-[13px] text-amber-950 font-serif leading-relaxed whitespace-pre-wrap flex-1 italic`,children:b.letterText})]}):(0,j.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center text-center p-6 text-slate-500`,children:[(0,j.jsx)(i,{className:`w-8 h-8 mb-2 text-slate-400`}),(0,j.jsx)(`p`,{className:`text-xs font-medium`,children:`Conquer 30 LeetCode problems along the path to receive your first Royal Missive from Aurelia.`})]})]}),v===`diary`&&(0,j.jsx)(`div`,{className:`flex flex-col gap-2.5 flex-1`,children:t.length>0?t.map(e=>(0,j.jsxs)(`div`,{className:`p-3 bg-white border-[1.5px] border-ink-black rounded-lg shadow-xs flex flex-col gap-1 select-text`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] text-amber-800 font-bold border-b border-slate-100 pb-1`,children:[(0,j.jsxs)(`span`,{children:[`League `,e.floor,` along the Path`]}),(0,j.jsx)(`span`,{children:new Date(e.timestamp).toLocaleDateString()})]}),(0,j.jsxs)(`p`,{className:`text-xs text-ink-black font-medium leading-relaxed m-0 italic font-serif`,children:[`“`,e.text,`”`]})]},e.id)):(0,j.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center text-center p-6 text-slate-500`,children:[(0,j.jsx)(_,{className:`w-8 h-8 mb-2 text-slate-400`}),(0,j.jsx)(`p`,{className:`text-xs font-medium`,children:`Aurelia records entries in her Spire Chronicles autonomously as you chat, rest, and cross chapter milestones.`})]})}),v===`codex`&&(0,j.jsxs)(`div`,{className:`flex flex-col gap-3 flex-1 select-text`,children:[(0,j.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between border-b border-slate-100 pb-1.5`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(m,{className:`w-4 h-4 text-amber-600`}),(0,j.jsx)(`h5`,{className:`font-headline-md font-bold text-xs text-ink-black m-0`,children:`Hero Codex (MemGPT & Mem0 Core Memory)`})]}),(0,j.jsx)(`span`,{className:`text-[10px] text-slate-400 font-mono`,children:`Cognitive Sync`})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2 text-xs`,children:[(0,j.jsxs)(`div`,{className:`bg-[#FFFDF0] border border-amber-900/20 rounded p-2`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-bold text-slate-500 uppercase tracking-wider block`,children:`Hero Alias`}),(0,j.jsx)(`span`,{className:`font-bold text-ink-black text-xs`,children:r?.heroName||`Champion`})]}),(0,j.jsxs)(`div`,{className:`bg-[#FFFDF0] border border-amber-900/20 rounded p-2`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-bold text-slate-500 uppercase tracking-wider block`,children:`Target Goal`}),(0,j.jsx)(`span`,{className:`font-bold text-amber-900 text-xs`,children:r?.targetGoal||`None shared yet (mention to Aurelia!)`})]})]}),r?.preferredLanguage&&(0,j.jsxs)(`div`,{className:`bg-[#FFFDF0] border border-amber-900/20 rounded p-2 text-xs`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-bold text-slate-500 uppercase tracking-wider block`,children:`Weapon of Choice (Language)`}),(0,j.jsx)(`span`,{className:`font-bold text-ink-black`,children:r.preferredLanguage})]})]}),(0,j.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-bold text-emerald-800`,children:[(0,j.jsx)(l,{className:`w-3.5 h-3.5`}),(0,j.jsxs)(`span`,{children:[`Mastered Patterns (`,r?.strengths?.length||0,`)`]})]}),r?.strengths&&r.strengths.length>0?(0,j.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.strengths.map(e=>(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-[11px] font-bold bg-emerald-50 text-emerald-800 border border-emerald-300`,children:[e,c&&(0,j.jsx)(`button`,{type:`button`,onClick:()=>c(`strengths`,e),className:`hover:text-red-600 ml-0.5 cursor-pointer`,title:`Forget strength`,children:(0,j.jsx)(d,{className:`w-3 h-3`})})]},e))}):(0,j.jsx)(`p`,{className:`text-[11px] text-slate-400 italic m-0`,children:`Aurelia will note topics you conquer during your practice.`})]}),(0,j.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-bold text-rose-800`,children:[(0,j.jsx)(g,{className:`w-3.5 h-3.5`}),(0,j.jsxs)(`span`,{children:[`Nemesis Patterns (`,r?.nemesisPatterns?.length||0,`)`]})]}),r?.nemesisPatterns&&r.nemesisPatterns.length>0?(0,j.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.nemesisPatterns.map(e=>(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-[11px] font-bold bg-rose-50 text-rose-800 border border-rose-300`,children:[e,c&&(0,j.jsx)(`button`,{type:`button`,onClick:()=>c(`nemesisPatterns`,e),className:`hover:text-red-700 ml-0.5 cursor-pointer`,title:`Forget nemesis`,children:(0,j.jsx)(d,{className:`w-3 h-3`})})]},e))}):(0,j.jsx)(`p`,{className:`text-[11px] text-slate-400 italic m-0`,children:`Aurelia tracks patterns that give you trouble to help you prepare targeted drills.`})]}),(0,j.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,j.jsx)(`div`,{className:`text-xs font-bold text-slate-800`,children:(0,j.jsxs)(`span`,{children:[`Personal Notes & Shared Lore (`,r?.personalNotes?.length||0,`)`]})}),r?.personalNotes&&r.personalNotes.length>0?(0,j.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:r.personalNotes.map(e=>(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-2 p-2 bg-slate-50 border border-slate-200 rounded text-[11px] text-slate-700`,children:[(0,j.jsxs)(`span`,{children:[`• `,e]}),c&&(0,j.jsx)(`button`,{type:`button`,onClick:()=>c(`personalNotes`,e),className:`text-slate-400 hover:text-red-600 shrink-0 cursor-pointer p-0.5`,title:`Forget note`,children:(0,j.jsx)(u,{className:`w-3 h-3`})})]},e))}):(0,j.jsx)(`p`,{className:`text-[11px] text-slate-400 italic m-0`,children:`Share your background or routine with Aurelia and she will hold it in her memory.`})]}),a&&a.length>0&&(0,j.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between border-b border-slate-100 pb-1`,children:[(0,j.jsx)(`span`,{className:`text-xs font-bold text-slate-800`,children:`Episodic Memory Chain (EM-LLM)`}),(0,j.jsxs)(`span`,{className:`text-[10px] text-slate-400 font-mono`,children:[a.length,` events`]})]}),(0,j.jsx)(`div`,{className:`flex flex-col gap-2 max-h-40 overflow-y-auto custom-scrollbar`,children:a.slice(0,8).map(e=>(0,j.jsxs)(`div`,{className:`text-[11px] p-2 bg-[#FFFDF0] border border-amber-900/15 rounded flex flex-col gap-0.5`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`span`,{className:`font-bold text-ink-black uppercase text-[9px] px-1.5 py-0.5 bg-amber-200/60 rounded`,children:e.eventType.replace(`_`,` `)}),(0,j.jsx)(`span`,{className:`text-[10px] text-slate-400`,children:new Date(e.timestamp).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})})]}),(0,j.jsx)(`div`,{className:`font-bold text-slate-800 mt-0.5`,children:e.title}),(0,j.jsx)(`div`,{className:`text-slate-600 text-[10px]`,children:e.description})]},e.id))})]}),(0,j.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between border-b border-slate-100 pb-1`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-bold text-indigo-900`,children:[(0,j.jsx)(s,{className:`w-3.5 h-3.5 text-amber-500`}),(0,j.jsx)(`span`,{children:`Autonomous Enchantment Telemetry`})]}),(0,j.jsxs)(`span`,{className:`text-[10px] text-slate-400 font-mono`,children:[o?.length||0,` executed`]})]}),o&&o.length>0?(0,j.jsx)(`div`,{className:`flex flex-col gap-1.5 max-h-36 overflow-y-auto custom-scrollbar`,children:o.slice(0,10).map((e,t)=>(0,j.jsxs)(`div`,{className:`text-[11px] p-2 bg-indigo-50/50 border border-indigo-100 rounded flex items-center justify-between gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex flex-col min-w-0`,children:[(0,j.jsxs)(`span`,{className:`font-bold text-indigo-950 font-mono text-[10px] truncate`,children:[e.tool_name,`()`]}),e.args&&Object.keys(e.args).length>0&&(0,j.jsx)(`span`,{className:`text-[9px] text-slate-500 truncate`,children:JSON.stringify(e.args).slice(0,50)})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[e.execution_time_ms!==void 0&&(0,j.jsxs)(`span`,{className:`text-[9px] text-slate-400 flex items-center gap-0.5 font-mono`,children:[(0,j.jsx)(p,{className:`w-2.5 h-2.5`}),e.execution_time_ms,`ms`]}),(0,j.jsx)(`span`,{className:`px-1.5 py-0.2 text-[9px] font-bold rounded ${e.success?`bg-emerald-100 text-emerald-800`:`bg-rose-100 text-rose-800`}`,children:e.success?`SUCCESS`:`ERR`})]})]},t))}):(0,j.jsx)(`p`,{className:`text-[11px] text-slate-400 italic m-0`,children:`No autonomous enchantments executed yet in this session.`})]})]})]}),(0,j.jsx)(`div`,{className:`bg-white border-t border-slate-200 px-4 py-2 flex items-center justify-end shrink-0`,children:(0,j.jsx)(`button`,{type:`button`,onClick:f,className:`px-4 py-1.5 bg-white hover:bg-slate-100 border-[1.5px] border-ink-black rounded font-bold text-xs text-ink-black cursor-pointer shadow-xs active:translate-y-0.5`,children:`Close`})})]})})}var R=e({default:()=>z});function z({onClose:e,onMinimize:t,isActive:r=!0,onFocus:i,zIndex:a}){let s=E(),[c,l]=(0,O.useState)(w()),[u,f]=(0,O.useState)(!1),[p,m]=(0,O.useState)(!1),[h,g]=(0,O.useState)(!1);(0,O.useEffect)(()=>{C.syncWithBackend(),C.triggerProactiveGreeting()},[]);let _=(0,O.useCallback)(()=>{e?e():D.getState().closeWindow(`companion`)},[e]),v=(0,O.useCallback)(()=>{t?t():D.getState().minimizeWindow(`companion`)},[t]),y=(0,O.useCallback)(()=>{i?i():D.getState().setActiveWindow(`companion`)},[i]),b=(0,O.useCallback)(()=>{let e=!c;l(e),S(e)},[c]),x=(0,O.useCallback)(()=>{window.confirm(`Clear conversation transcript with Princess Aurelia?`)&&C.clearTranscript()},[]),T=(0,O.useCallback)(e=>{C.setIsTyping(e)},[]),k=(0,O.useMemo)(()=>[...s.transcript].reverse().find(e=>e.sender===`princess`)||s.transcript[0],[s.transcript]),A=`Welcome back to the Spire Tower Parlor. How is your day going today? Are you making progress, or could you use a hand?`,N=k?k.isStreaming?k.text:k.text||(s.isLoading?``:A):A,P=(0,O.useMemo)(()=>k?.choiceSuggestions&&k.choiceSuggestions.length>0?k.choiceSuggestions:[...s.transcript].reverse().find(e=>e.sender===`princess`&&e.choiceSuggestions&&e.choiceSuggestions.length>0)?.choiceSuggestions,[k,s.transcript]);return(0,j.jsxs)(`div`,{onClick:y,className:`fixed inset-x-0 top-0 bottom-[40px] select-none pointer-events-none overflow-hidden font-sans`,style:{zIndex:a??(r?40:30)},children:[(0,j.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 h-44 bg-gradient-to-t from-slate-950/35 via-slate-900/10 to-transparent pointer-events-none z-0`}),(0,j.jsxs)(`div`,{className:`relative w-full h-full flex flex-col justify-end pointer-events-none pb-2 sm:pb-3 px-2 sm:px-4 md:px-8`,children:[(0,j.jsxs)(`div`,{className:`relative w-full max-w-5xl lg:max-w-6xl mx-auto flex items-end justify-start pointer-events-none`,children:[(0,j.jsx)(`div`,{className:`relative z-30 shrink-0 pointer-events-auto -mr-6 sm:-mr-10 md:-mr-12 lg:-mr-14`,children:(0,j.jsx)(M,{emotion:s.activeEmotion,floor:s.currentFloor,rhythm:s.currentRhythm,activity:s.currentActivity,isLoading:s.isLoading,onClick:y})}),(0,j.jsx)(`div`,{className:`relative z-20 flex-1 min-w-0 pointer-events-auto mb-1`,children:(0,j.jsx)(F,{characterName:s.companionSettings.name||`Princess Aurelia`,emotion:s.activeEmotion,text:N,isStreaming:k?.isStreaming,isLoading:s.isLoading,choices:P,toolCalls:k?.toolCalls,onSelectChoice:e=>C.sendMessage(e),onSendMessage:e=>C.sendMessage(e),onTypingStatusChange:T,currentFloor:s.currentFloor,bondTier:s.bondTier,satchelCount:s.unlockedLetters.length,isMuted:c,onToggleMute:b,onOpenProgress:()=>f(!0),onOpenSatchel:()=>m(!0),onOpenHistory:()=>g(!0),onMinimize:v,onClose:_})})]}),(0,j.jsxs)(`div`,{className:`absolute bottom-1 right-3.5 pointer-events-none z-30 hidden md:flex flex-col items-center gap-0.5 opacity-65 select-none`,children:[(0,j.jsx)(`svg`,{className:`w-8 h-8 text-[#9cbcdb] drop-shadow-[0_0_6px_rgba(156,188,219,0.5)] rotate-6`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,j.jsx)(`path`,{d:`M12 2 C12 7.8 7.8 12 2 12 C7.8 12 12 16.2 12 22 C12 16.2 16.2 12 22 12 C16.2 12 12 7.8 12 2 Z`})}),(0,j.jsxs)(`div`,{className:`font-mono text-[9px] text-[#7ba4c8] tracking-tight leading-tight text-center`,children:[(0,j.jsx)(`div`,{children:`AlgoSpaced (Beta)`}),(0,j.jsx)(`div`,{children:`Build Jun24 preview`})]})]})]}),u&&(0,j.jsx)(`div`,{className:`pointer-events-auto`,children:(0,j.jsx)(I,{currentFloor:s.currentFloor,totalSolved:s.totalSolved,onClose:()=>f(!1)})}),p&&(0,j.jsx)(`div`,{className:`pointer-events-auto`,children:(0,j.jsx)(L,{unlockedLetters:s.unlockedLetters,spireChronicles:s.spireChronicles,currentFloor:s.currentFloor,heroCodex:s.heroCodex,episodicEvents:s.episodicEvents,recentToolTelemetry:s.recentToolTelemetry,onRemoveCodexItem:C.removeCodexItem,onClose:()=>m(!1)})}),h&&(0,j.jsx)(`div`,{className:`fixed inset-0 z-50 bg-black/60 backdrop-blur-xs flex items-center justify-center p-3 sm:p-4 animate-in fade-in duration-200 pointer-events-auto`,onClick:()=>g(!1),children:(0,j.jsxs)(`div`,{className:`bg-[#142335] border-[3px] border-[#5a80a2] rounded-xl max-w-lg w-full h-[80%] max-h-[520px] shadow-[0_16px_40px_rgba(0,0,0,0.85)] flex flex-col overflow-hidden text-white`,onClick:e=>e.stopPropagation(),style:{boxShadow:`inset 0 0 0 1px #0a1420, inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 16px 40px rgba(0, 0, 0, 0.85)`},children:[(0,j.jsxs)(`div`,{className:`bg-[#101b2a] border-b border-[#304f6f] px-4 py-2.5 flex items-center justify-between shrink-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(o,{className:`w-4 h-4 text-[#67b1ec]`}),(0,j.jsxs)(`h4`,{className:`font-mono font-bold text-xs sm:text-sm text-[#e6f0fa] m-0`,children:[`Dialogue Transcript (`,s.transcript.length,` turns)`]})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsxs)(`button`,{type:`button`,onClick:x,className:`px-2 py-0.5 bg-rose-950/60 hover:bg-rose-900 border border-rose-700/60 rounded text-[11px] font-mono font-bold text-rose-300 hover:text-white flex items-center gap-1 cursor-pointer mr-1 transition-colors`,title:`Clear Chat History`,children:[(0,j.jsx)(n,{className:`w-3 h-3`}),(0,j.jsx)(`span`,{children:`Clear`})]}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>g(!1),className:`p-1 hover:bg-[#203a55] rounded text-[#8cb4db] hover:text-white cursor-pointer transition-colors`,title:`Close`,children:(0,j.jsx)(d,{className:`w-4 h-4`})})]})]}),(0,j.jsx)(`div`,{className:`flex-1 p-3 sm:p-4 overflow-y-auto custom-scrollbar flex flex-col gap-2.5 bg-[#0e1824]/90`,children:s.transcript.map((e,t)=>(0,j.jsxs)(`div`,{className:`p-2.5 rounded-lg border font-mono text-xs max-w-[90%] shadow-md ${e.sender===`princess`?`bg-[#182c42] border-[#3e6080] text-[#e6f0fa] self-start`:`bg-[#214365] border-[#5a8bb9] text-white self-end`}`,children:[(0,j.jsx)(`div`,{className:`text-[10px] font-bold mb-1 text-[#f6d267]`,children:e.sender===`princess`?s.companionSettings.name:`Hero`}),(0,j.jsx)(`p`,{className:`font-medium m-0 leading-relaxed whitespace-pre-wrap select-text`,children:e.text})]},e.id||t))})]})})]})}export{R as t}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/PrincessChamber-IJaaUuL1.js b/algospaced-ui/dist/assets/PrincessChamber-IJaaUuL1.js deleted file mode 100644 index 45ac5e215786041f4027fe5cb98d001e049410a6..0000000000000000000000000000000000000000 --- a/algospaced-ui/dist/assets/PrincessChamber-IJaaUuL1.js +++ /dev/null @@ -1 +0,0 @@ -import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{I as n,Lt as r,O as i,S as a,St as o,T as s,U as c,bt as l,c as u,ct as d,ft as f,k as p,l as m,o as h,p as g,s as _,y as v,zt as y}from"./vendor-react-qmUj3JUi.js";import{C as b,S as x,_ as S,b as C,d as w,v as T,x as E,y as D}from"./index-DYMSjoUb.js";var O=t(y(),1),k={1:{particleType:`pollen`,particleCount:16,particleColors:[`#FDE047`,`#FEF08A`,`#86EFAC`],gradientBg:`from-[#FFFDF0] via-[#FFF9E6] to-[#FEF3C7]`,glowColor:`rgba(251, 191, 36, 0.3)`,badgeLabel:`🌾 Plains Breeze`},2:{particleType:`leaves`,particleCount:18,particleColors:[`#86EFAC`,`#4ADE80`,`#22C55E`,`#A7F3D0`],gradientBg:`from-[#F0FDF4] via-[#DCFCE7] to-[#FEF9C3]`,glowColor:`rgba(34, 197, 94, 0.3)`,badgeLabel:`🍃 Whispering Leaves`},3:{particleType:`spores`,particleCount:22,particleColors:[`#67E8F9`,`#38BDF8`,`#818CF8`,`#C084FC`],gradientBg:`from-[#F0F9FF] via-[#E0F2FE] to-[#EDE9FE]`,glowColor:`rgba(56, 189, 248, 0.35)`,badgeLabel:`✨ Crystal Spores`},4:{particleType:`snow`,particleCount:28,particleColors:[`#FFFFFF`,`#E0F2FE`,`#BAE6FD`],gradientBg:`from-[#F8FAFC] via-[#F1F5F9] to-[#E2E8F0]`,glowColor:`rgba(186, 230, 253, 0.4)`,badgeLabel:`❄️ Alpine Snowfall`},5:{particleType:`runes`,particleCount:20,particleColors:[`#E879F9`,`#C084FC`,`#A855F7`,`#F472B6`],gradientBg:`from-[#FAF5FF] via-[#F3E8FF] to-[#FCE7F3]`,glowColor:`rgba(192, 132, 252, 0.4)`,badgeLabel:`🔮 Arcane Runes`},6:{particleType:`stardust`,particleCount:35,particleColors:[`#FDE047`,`#F59E0B`,`#E11D48`,`#818CF8`],gradientBg:`from-[#FFFBEB] via-[#FEF3C7] to-[#FFE4E6]`,glowColor:`rgba(245, 158, 11, 0.5)`,badgeLabel:`👑 Spire Gates`}};function A(e){return e<=30?k[1]:e<=60?k[2]:e<=90?k[3]:e<=120?k[4]:e<150?k[5]:k[6]}var j=r();function M({emotion:e,floor:t,rhythm:n,activity:r,isLoading:i=!1,className:a=``,onClick:o}){let s=D[e]||D.smiling_warmly,c=(0,O.useMemo)(()=>A(t),[t]),l=(0,O.useMemo)(()=>{switch(n){case`dawn`:return`from-amber-400/30 via-yellow-300/20 to-transparent`;case`dusk`:return`from-orange-500/30 via-purple-500/20 to-transparent`;case`night`:return`from-indigo-600/30 via-blue-500/20 to-transparent`;default:return`from-amber-300/25 via-sky-300/20 to-transparent`}},[n]);return(0,j.jsxs)(`div`,{onClick:o,className:`relative flex flex-col items-center justify-end select-none pointer-events-auto transition-transform ${a}`,children:[(0,j.jsx)(`div`,{className:`absolute -inset-10 overflow-hidden pointer-events-none z-0`,children:Array.from({length:Math.min(16,c.particleCount)}).map((e,t)=>{let n=c.particleColors[t%c.particleColors.length],r=`${t*17%100}%`,i=`${7+t%5*2}s`,a=`${t*.8%4}s`,o=c.particleType===`leaves`||c.particleType===`runes`?`w-2 h-2`:`w-1.5 h-1.5`;return(0,j.jsx)(`span`,{className:`absolute rounded-full opacity-60 animate-pulse ${o}`,style:{backgroundColor:n,left:r,top:`${t*21%90}%`,boxShadow:`0 0 10px ${n}`,animationDuration:i,animationDelay:a}},t)})}),(0,j.jsx)(`div`,{className:`absolute bottom-4 inset-x-0 h-48 sm:h-72 md:h-96 bg-radial ${l} blur-2xl opacity-70 pointer-events-none z-0`}),(0,j.jsxs)(`div`,{className:`relative z-10 flex flex-col items-start justify-end`,children:[r&&(0,j.jsx)(`div`,{className:`mb-2 max-w-[120px] sm:max-w-xs text-center pointer-events-none animate-in fade-in duration-300`,children:(0,j.jsxs)(`span`,{className:`text-[9px] sm:text-[10px] font-mono font-medium text-[#bfe1ff] bg-[#101e2e]/85 px-2 sm:px-2.5 py-0.5 rounded-full border border-[#3e6080]/70 shadow-md inline-flex items-center gap-1 sm:gap-1.5 backdrop-blur-xs`,children:[(0,j.jsx)(`span`,{className:`text-amber-400`,children:`🏰`}),(0,j.jsx)(`span`,{className:`truncate`,children:r})]})}),(0,j.jsx)(`div`,{className:`relative h-[28vh] sm:h-[40vh] md:h-[46vh] lg:h-[50vh] max-h-[220px] sm:max-h-[380px] md:max-h-[460px] lg:max-h-[500px] min-h-[160px] sm:min-h-[240px] md:min-h-[300px] w-auto max-w-[110px] sm:max-w-[200px] md:max-w-[270px] lg:max-w-[320px] flex items-end justify-end`,children:(0,j.jsx)(`img`,{src:s.imagePath,alt:s.label,loading:`eager`,className:`h-full w-auto max-h-[85vh] object-contain object-bottom-left drop-shadow-[0_16px_32px_rgba(0,0,0,0.55)] transition-all duration-300 ${i?`scale-[1.02] filter brightness-110 saturate-125`:`scale-100`}`,onError:e=>{let t=e.currentTarget;t.src.endsWith(`/sprites/princess/smiling_warmly.webp`)?t.src.endsWith(`/sprites/princess/neutral.webp`)||(t.src=`/sprites/princess/neutral.webp`):t.src=`/sprites/princess/smiling_warmly.webp`}})})]})]})}var N=[`I solved a tough task today!`,`I'm feeling stuck on something.`,`Just need a breather.`],P={backgroundColor:`rgba(20, 36, 54, 0.94)`,boxShadow:`0 0 0 2px #0a1420, inset 0 0 0 3px #4c7396, inset 1px 1px 0 4px #8db7dc, inset -1px -1px 0 4px #1a2c3f, inset 0 0 0 5px #0c1724, 0 10px 28px rgba(0, 0, 0, 0.75)`};function F({characterName:e,text:t,isStreaming:r=!1,isLoading:i=!1,choices:a,toolCalls:o,onSelectChoice:c,onSendMessage:d,onTypingStatusChange:f,currentFloor:h,bondTier:g,satchelCount:y=0,isMuted:b=!1,onToggleMute:x,onOpenProgress:S,onOpenSatchel:C,onOpenHistory:w,onMinimize:T,onClose:E,className:D=``}){let[k,A]=(0,O.useState)(``),[M,F]=(0,O.useState)(!1),[I,L]=(0,O.useState)(0),[R,z]=(0,O.useState)(``),[B,V]=(0,O.useState)(!1),H=(0,O.useRef)(t),U=(0,O.useRef)(!1),W=(0,O.useRef)(null),G=(0,O.useRef)(null),K=r||M;(0,O.useEffect)(()=>{f?.(K)},[K,f]);let q=(0,O.useMemo)(()=>Array.isArray(a)&&a.length>0?a.slice(0,4):N,[a]),J=I{if(r){W.current&&=(clearInterval(W.current),null),U.current=!0,H.current=t;return}if(U.current){U.current=!1,H.current=t,W.current&&=(clearInterval(W.current),null);return}if(t!==H.current&&!i){if(H.current=t,!t){W.current&&=(clearInterval(W.current),null);return}W.current&&clearInterval(W.current);let e=0,n=setInterval(()=>{e++,A(t.slice(0,e)),F(!0),e>=t.length&&(clearInterval(n),W.current=null,F(!1))},20);return W.current=n,()=>{clearInterval(n),W.current=null,F(!1)}}},[t,i,r]);let X=(0,O.useCallback)(()=>{W.current&&=(clearInterval(W.current),null),F(!1)},[]),Z=()=>{let e=R.trim();!e||i||r||(d(e),z(``))};return(0,O.useEffect)(()=>{let e=e=>{if(e.key===`Escape`&&E){e.preventDefault(),E();return}if(!B){if(e.key>=`1`&&e.key<=String(q.length)){let t=parseInt(e.key,10)-1;q[t]&&!i&&!r&&(e.preventDefault(),c(q[t]));return}if(e.key===`ArrowUp`){e.preventDefault(),L(e=>(e-1+q.length)%q.length);return}if(e.key===`ArrowDown`){e.preventDefault(),L(e=>(e+1)%q.length);return}if(e.key===`Enter`){!i&&!r&&q[J]&&(e.preventDefault(),c(q[J]));return}e.key===` `&&K&&(e.preventDefault(),X())}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[B,q,J,i,r,K,c,X,E]),(0,j.jsxs)(`div`,{className:`relative flex flex-col gap-2 w-full ${D}`,children:[(0,j.jsxs)(`div`,{onClick:X,className:`relative w-full rounded-md sm:rounded-lg text-white pt-3.5 pb-3.5 pr-3.5 pl-8 sm:pt-5 sm:pb-5 sm:pr-5 sm:pl-14 md:pl-16 lg:pl-18 flex flex-col gap-2.5 backdrop-blur-md transition-all select-none cursor-pointer`,style:P,children:[(0,j.jsxs)(`div`,{className:`absolute -top-7 right-1 flex items-center gap-1 sm:gap-1.5 z-30`,onClick:e=>e.stopPropagation(),children:[S&&(0,j.jsxs)(`button`,{type:`button`,onClick:S,className:`px-2 py-0.5 bg-[#101e2e]/90 hover:bg-[#1f3750] border border-[#3e6080]/80 hover:border-[#67b1ec] rounded text-[10px] sm:text-[11px] font-mono font-bold text-[#8cb4db] hover:text-white transition-all cursor-pointer flex items-center gap-1 shadow-md`,title:`Spire Tower Road (Floor Progress)`,children:[(0,j.jsx)(l,{className:`w-3 h-3 text-amber-400`}),(0,j.jsxs)(`span`,{children:[h,`/150 LC`]})]}),C&&(0,j.jsxs)(`button`,{type:`button`,onClick:C,className:`px-2 py-0.5 bg-[#101e2e]/90 hover:bg-[#1f3750] border border-[#3e6080]/80 hover:border-[#67b1ec] rounded text-[10px] sm:text-[11px] font-mono font-bold text-[#8cb4db] hover:text-white transition-all cursor-pointer flex items-center gap-1 shadow-md`,title:`Open Royal Satchel`,children:[(0,j.jsx)(s,{className:`w-3 h-3 text-amber-400`}),(0,j.jsx)(`span`,{className:`hidden sm:inline`,children:`Satchel`}),y>0&&(0,j.jsxs)(`span`,{className:`text-[9px] text-[#f3cb65]`,children:[`(`,y,`)`]})]}),w&&(0,j.jsxs)(`button`,{type:`button`,onClick:w,className:`px-2 py-0.5 bg-[#101e2e]/90 hover:bg-[#1f3750] border border-[#3e6080]/80 hover:border-[#67b1ec] rounded text-[10px] sm:text-[11px] font-mono font-bold text-[#8cb4db] hover:text-white transition-all cursor-pointer flex items-center gap-1 shadow-md`,title:`Dialogue Transcript`,children:[(0,j.jsx)(p,{className:`w-3 h-3 text-[#8cb4db]`}),(0,j.jsx)(`span`,{className:`hidden sm:inline`,children:`Log`})]}),x&&(0,j.jsx)(`button`,{type:`button`,onClick:x,className:`p-1 bg-[#101e2e]/90 hover:bg-[#1f3750] border border-[#3e6080]/80 hover:border-[#67b1ec] rounded text-[#8cb4db] hover:text-white transition-all cursor-pointer shadow-md`,title:b?`Unmute Audio`:`Mute Audio`,children:b?(0,j.jsx)(u,{className:`w-3 h-3`}):(0,j.jsx)(m,{className:`w-3 h-3`})}),T&&(0,j.jsx)(`button`,{type:`button`,onClick:T,className:`p-1 bg-[#101e2e]/90 hover:bg-[#1f3750] border border-[#3e6080]/80 hover:border-[#67b1ec] rounded text-[#8cb4db] hover:text-white transition-all cursor-pointer shadow-md`,title:`Minimize to Taskbar`,children:(0,j.jsx)(n,{className:`w-3 h-3`})}),E&&(0,j.jsx)(`button`,{type:`button`,onClick:E,className:`p-1 bg-[#101e2e]/90 hover:bg-rose-900/70 border border-[#3e6080]/80 hover:border-rose-400 rounded text-[#8cb4db] hover:text-rose-200 transition-all cursor-pointer shadow-md`,title:`Leave Parlor (Esc)`,children:(0,j.jsx)(_,{className:`w-3 h-3`})})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(`span`,{className:`font-mono text-sm sm:text-base font-bold text-[#f3cb65] tracking-wide drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]`,children:[`-`,e||`Princess Aurelia`,`-`]}),g&&(0,j.jsx)(`span`,{className:`hidden md:inline-block text-[9px] font-mono text-[#8cb4db] bg-[#101d2c]/80 border border-[#3e6080]/60 px-1.5 py-0.2 rounded uppercase tracking-wider`,children:g})]}),(0,j.jsxs)(`div`,{className:`min-h-[48px] sm:min-h-[54px] flex flex-col justify-start`,children:[i?(0,j.jsxs)(`div`,{className:`flex items-center gap-2 py-1 text-xs sm:text-sm font-mono text-[#8cb4db]`,children:[(0,j.jsx)(`span`,{className:`inline-block w-2 h-2 bg-[#f3cb65] rounded-full animate-ping`}),(0,j.jsxs)(`span`,{children:[e||`Princess Aurelia`,` is attuning the crystal relay...`]})]}):(0,j.jsxs)(`div`,{className:`font-mono text-xs sm:text-sm md:text-[15px] leading-relaxed text-[#e6edf4] select-text`,children:[(e=>e.split(/(\*[^*]+\*)/g).map((e,t)=>e.startsWith(`*`)&&e.endsWith(`*`)?(0,j.jsx)(`span`,{className:`text-[#f3cb65] italic font-semibold mr-1 inline-block`,children:e},t):(0,j.jsx)(`span`,{children:e},t)))(Y),K&&(0,j.jsx)(`span`,{className:`inline-block w-1.5 h-3.5 bg-[#f3cb65] ml-1 animate-pulse align-middle`})]}),o&&o.length>0&&!i&&(0,j.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 select-none`,children:o.map((e,t)=>(0,j.jsxs)(`span`,{className:`px-2 py-0.5 rounded bg-[#102438] border border-[#44729b] text-[10px] font-mono font-bold text-[#bfe1ff] flex items-center gap-1`,children:[(0,j.jsx)(v,{className:`w-2.5 h-2.5 text-[#f3cb65]`}),(0,j.jsxs)(`span`,{children:[`Enchantment: `,e.name]})]},t))})]}),(0,j.jsx)(`div`,{className:`flex flex-col gap-1 pt-1`,onClick:e=>e.stopPropagation(),children:q.map((e,t)=>{let n=t+1,a=J===t;return(0,j.jsxs)(`button`,{type:`button`,disabled:i||r,onClick:()=>c(e),onMouseEnter:()=>L(t),className:`w-full sm:max-w-[90%] md:max-w-[85%] text-left flex items-center gap-2 px-2.5 py-1 rounded-xs sm:rounded-sm transition-all select-none font-mono text-xs sm:text-sm disabled:opacity-40 disabled:cursor-not-allowed ${a&&!i&&!r?`bg-[#1c3e61]/80 border border-[#4883b6]/80 shadow-[0_0_12px_rgba(72,131,182,0.25)] cursor-pointer`:`border border-transparent hover:bg-[#1c3e61]/35 cursor-pointer`}`,children:[(0,j.jsxs)(`span`,{className:`font-bold shrink-0 ${a?`text-[#e2ecf7]`:`text-[#b4c8dc]`}`,children:[n,`.`]}),(0,j.jsxs)(`span`,{className:`truncate font-medium ${a?`text-[#f3cb65]`:`text-[#dde7f2]`}`,children:[`[`,e,`]`]})]},t)})})]}),(0,j.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),Z()},onClick:e=>e.stopPropagation(),className:`w-full rounded-md sm:rounded-lg text-white py-2 sm:py-2.5 pr-3 sm:pr-4 pl-8 sm:pl-14 md:pl-16 lg:pl-18 flex items-center gap-2 backdrop-blur-md transition-all select-none`,style:P,children:[(0,j.jsx)(`span`,{className:`font-mono text-sm sm:text-base font-bold text-[#e2ecf7] select-none pl-0.5 shrink-0`,children:`>`}),(0,j.jsxs)(`div`,{className:`flex-1 flex items-center bg-[#101e2e]/90 border border-[#3b5d7d] rounded px-2.5 py-1 focus-within:border-[#67b1ec] focus-within:ring-1 focus-within:ring-[#67b1ec]/40 shadow-inner`,children:[(0,j.jsx)(`span`,{className:`text-[#f3cb65] font-mono text-xs sm:text-sm select-none mr-1.5 shrink-0`,children:`[`}),(0,j.jsx)(`input`,{ref:G,type:`text`,value:R,onChange:e=>z(e.target.value),onFocus:()=>V(!0),onBlur:()=>V(!1),disabled:i||r,placeholder:`Speak with ${e||`Princess Aurelia`}...`,className:`flex-1 bg-transparent border-none text-[#e2ecf7] placeholder-[#f3cb65]/70 font-mono text-xs sm:text-sm focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed`}),(0,j.jsx)(`span`,{className:`text-[#f3cb65] font-mono text-xs sm:text-sm select-none ml-1.5 shrink-0`,children:`]`})]}),(0,j.jsxs)(`button`,{type:`submit`,disabled:i||r||!R.trim(),className:`bg-[#34597b] hover:bg-[#3f6990] active:bg-[#2b4c6e] disabled:opacity-40 disabled:cursor-not-allowed border border-[#5c8cb5] hover:border-[#8db7dc] rounded px-3 sm:px-4 py-1 text-xs sm:text-sm font-mono font-bold text-white transition-all cursor-pointer shadow-md select-none shrink-0 flex items-center`,children:[(0,j.jsx)(`span`,{className:`text-[#f3cb65]`,children:`[`}),(0,j.jsx)(`span`,{className:`text-white px-1`,children:`Send`}),(0,j.jsx)(`span`,{className:`text-[#f3cb65]`,children:`]`})]})]})]})}function I({currentFloor:e,onClose:t}){let n=b(e),r=Math.min(100,Math.round(e/150*100));return(0,j.jsx)(`div`,{className:`absolute inset-0 z-50 bg-ink-black/40 backdrop-blur-xs flex items-center justify-center p-3 sm:p-4 animate-in fade-in duration-200 select-none`,onClick:t,children:(0,j.jsxs)(`div`,{className:`bg-[#FFFDF0] border-[3px] border-ink-black rounded-xl p-4 sm:p-5 max-w-md w-full shadow-[6px_6px_0px_0px_#1E293B] flex flex-col gap-3.5`,onClick:e=>e.stopPropagation(),children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between border-b-[2px] border-ink-black pb-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(l,{className:`w-5 h-5 text-indigo-600`}),(0,j.jsx)(`h4`,{className:`font-headline-md font-bold text-sm text-ink-black m-0`,children:`Journey to the Big-O Spire`})]}),(0,j.jsx)(`button`,{type:`button`,onClick:t,className:`p-1 hover:bg-slate-200 rounded text-slate-700 cursor-pointer`,title:`Close`,children:(0,j.jsx)(_,{className:`w-4 h-4`})})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-xs font-bold font-headline-md`,children:[(0,j.jsx)(`span`,{children:`Path Progress:`}),(0,j.jsxs)(`span`,{className:`font-arcade bg-indigo-100 text-indigo-900 px-2 py-0.5 rounded border border-indigo-300`,children:[e,` / 150 Leagues`]})]}),(0,j.jsx)(`div`,{className:`w-full bg-slate-200 h-4 border-[2px] border-ink-black rounded-full overflow-hidden p-0.5`,children:(0,j.jsx)(`div`,{className:`bg-gradient-to-r from-amber-400 via-yellow-400 to-emerald-400 h-full rounded-full transition-all duration-500`,style:{width:`${r}%`}})}),(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-trash-gray font-medium`,children:[(0,j.jsxs)(`span`,{children:[`Progress: `,(0,j.jsxs)(`strong`,{children:[r,`%`]})]}),(0,j.jsxs)(`span`,{children:[`Distance to Tower: `,(0,j.jsxs)(`strong`,{children:[Math.max(0,150-e),` leagues`]})]})]})]}),(0,j.jsxs)(`div`,{className:`bg-white border-[2px] border-ink-black rounded-lg p-3 shadow-[2px_2px_0px_0px_#1E293B] flex flex-col gap-1`,children:[(0,j.jsx)(`div`,{className:`text-[10px] font-bold uppercase text-amber-700 tracking-wider`,children:`Current Realm:`}),(0,j.jsx)(`div`,{className:`font-bold text-xs text-ink-black`,children:n.title}),(0,j.jsx)(`p`,{className:`text-[11px] text-slate-600 m-0 leading-relaxed font-medium`,children:n.description}),(0,j.jsxs)(`div`,{className:`text-[10px] text-amber-900 bg-amber-50 p-1.5 rounded border border-amber-200 italic mt-1`,children:[`📜 `,n.bgLore]})]}),(0,j.jsx)(`div`,{className:`flex items-center justify-between gap-1 text-center`,children:[{floor:30,label:`Arrays`},{floor:60,label:`Pointers`},{floor:90,label:`Trees`},{floor:120,label:`Heaps`},{floor:150,label:`Spire`}].map(t=>{let n=e>=t.floor;return(0,j.jsxs)(`div`,{className:`flex-1 p-1.5 rounded border text-[10px] flex flex-col items-center ${n?`bg-emerald-100 border-emerald-600 text-emerald-900 font-bold`:`bg-slate-100 border-slate-300 text-slate-500`}`,children:[(0,j.jsx)(`span`,{children:n?`✓`:t.floor}),(0,j.jsx)(`span`,{className:`text-[9px] truncate w-full`,children:t.label})]},t.floor)})}),(0,j.jsx)(`div`,{className:`flex items-center justify-end border-t border-slate-200 pt-2 mt-1`,children:(0,j.jsx)(`button`,{type:`button`,onClick:t,className:`px-4 py-1.5 bg-white hover:bg-slate-100 border-[1.5px] border-ink-black rounded font-bold text-xs text-ink-black cursor-pointer shadow-xs active:translate-y-0.5`,children:`Done`})})]})})}function L({unlockedLetters:e,spireChronicles:t,currentFloor:n,heroCodex:r,episodicEvents:i,recentToolTelemetry:l,onRemoveCodexItem:u,onClose:p}){let[m,y]=(0,O.useState)(`letters`),[b,S]=(0,O.useState)(e[e.length-1]||null);return(0,j.jsx)(`div`,{className:`absolute inset-0 z-50 bg-ink-black/50 backdrop-blur-xs flex items-center justify-center p-3 sm:p-4 animate-in fade-in duration-200 select-none`,onClick:p,children:(0,j.jsxs)(`div`,{className:`bg-[#FFFDF0] border-[3px] border-ink-black rounded-xl max-w-lg w-full h-[85%] max-h-[560px] shadow-[6px_6px_0px_0px_#1E293B] flex flex-col overflow-hidden`,onClick:e=>e.stopPropagation(),children:[(0,j.jsxs)(`div`,{className:`bg-white border-b-[2px] border-ink-black px-4 py-2.5 flex items-center justify-between shrink-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(s,{className:`w-5 h-5 text-amber-700`}),(0,j.jsx)(`h4`,{className:`font-headline-md font-bold text-sm text-ink-black m-0`,children:`The Royal Satchel`})]}),(0,j.jsx)(`button`,{type:`button`,onClick:p,className:`p-1 hover:bg-slate-200 rounded text-slate-700 cursor-pointer`,title:`Close`,children:(0,j.jsx)(_,{className:`w-4 h-4`})})]}),(0,j.jsxs)(`div`,{className:`flex border-b-2 border-ink-black bg-amber-100/70 shrink-0`,children:[(0,j.jsxs)(`button`,{type:`button`,onClick:()=>y(`letters`),className:`flex-1 py-2 text-xs font-bold font-headline-md flex items-center justify-center gap-1.5 transition-colors cursor-pointer border-r border-ink-black/20 ${m===`letters`?`bg-[#FFFDF0] text-amber-950 border-b-2 border-b-[#FFFDF0] -mb-[2px]`:`text-slate-600 hover:bg-amber-200/50`}`,children:[(0,j.jsx)(s,{className:`w-3.5 h-3.5`}),(0,j.jsxs)(`span`,{children:[`Missives (`,e.length,`/5)`]})]}),(0,j.jsxs)(`button`,{type:`button`,onClick:()=>y(`diary`),className:`flex-1 py-2 text-xs font-bold font-headline-md flex items-center justify-center gap-1.5 transition-colors cursor-pointer border-r border-ink-black/20 ${m===`diary`?`bg-[#FFFDF0] text-amber-950 border-b-2 border-b-[#FFFDF0] -mb-[2px]`:`text-slate-600 hover:bg-amber-200/50`}`,children:[(0,j.jsx)(o,{className:`w-3.5 h-3.5`}),(0,j.jsxs)(`span`,{children:[`Chronicles (`,t.length,`)`]})]}),(0,j.jsxs)(`button`,{type:`button`,onClick:()=>y(`codex`),className:`flex-1 py-2 text-xs font-bold font-headline-md flex items-center justify-center gap-1.5 transition-colors cursor-pointer ${m===`codex`?`bg-[#FFFDF0] text-amber-950 border-b-2 border-b-[#FFFDF0] -mb-[2px]`:`text-slate-600 hover:bg-amber-200/50`}`,children:[(0,j.jsx)(v,{className:`w-3.5 h-3.5 text-amber-700`}),(0,j.jsx)(`span`,{children:`Codex`})]})]}),(0,j.jsxs)(`div`,{className:`flex-1 p-3 sm:p-4 overflow-y-auto custom-scrollbar flex flex-col gap-3 min-h-0`,children:[m===`letters`&&(0,j.jsxs)(`div`,{className:`flex flex-col gap-3 flex-1`,children:[(0,j.jsx)(`div`,{className:`flex items-center gap-1.5 overflow-x-auto pb-1`,children:[30,60,90,120,150].map(e=>{let t=x[e],r=n>=e,i=b?.floor===e;return(0,j.jsxs)(`button`,{type:`button`,disabled:!r,onClick:()=>r&&S(t),className:`px-3 py-1 rounded-full text-[11px] font-bold border-[1.5px] border-ink-black flex items-center gap-1 shrink-0 transition-all cursor-pointer ${r?i?`bg-[#FFE24C] text-ink-black shadow-[1.5px_1.5px_0px_0px_#1E293B]`:`bg-white hover:bg-amber-100 text-slate-800`:`opacity-40 bg-slate-200 text-slate-500 cursor-not-allowed`}`,children:[r?(0,j.jsx)(`span`,{children:`📜`}):(0,j.jsx)(c,{className:`w-3 h-3`}),(0,j.jsxs)(`span`,{children:[`League `,e]})]},e)})}),b?(0,j.jsxs)(`div`,{className:`bg-[#FFF9E6] border-[2px] border-amber-900/40 rounded-lg p-4 shadow-sm flex-1 overflow-y-auto custom-scrollbar flex flex-col select-text`,children:[(0,j.jsxs)(`div`,{className:`border-b border-amber-800/20 pb-2 mb-3 flex items-center justify-between`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`text-[10px] font-bold text-amber-800 uppercase tracking-wider`,children:[b.chapterTitle,` • League `,b.floor]}),(0,j.jsx)(`h5`,{className:`font-headline-md font-bold text-sm text-amber-950 m-0`,children:b.title})]}),(0,j.jsx)(`span`,{className:`text-xl`,children:`🪶`})]}),(0,j.jsx)(`p`,{className:`text-xs sm:text-[13px] text-amber-950 font-serif leading-relaxed whitespace-pre-wrap flex-1 italic`,children:b.letterText})]}):(0,j.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center text-center p-6 text-slate-500`,children:[(0,j.jsx)(c,{className:`w-8 h-8 mb-2 text-slate-400`}),(0,j.jsx)(`p`,{className:`text-xs font-medium`,children:`Conquer 30 LeetCode problems along the path to receive your first Royal Missive from Aurelia.`})]})]}),m===`diary`&&(0,j.jsx)(`div`,{className:`flex flex-col gap-2.5 flex-1`,children:t.length>0?t.map(e=>(0,j.jsxs)(`div`,{className:`p-3 bg-white border-[1.5px] border-ink-black rounded-lg shadow-xs flex flex-col gap-1 select-text`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] text-amber-800 font-bold border-b border-slate-100 pb-1`,children:[(0,j.jsxs)(`span`,{children:[`League `,e.floor,` along the Path`]}),(0,j.jsx)(`span`,{children:new Date(e.timestamp).toLocaleDateString()})]}),(0,j.jsxs)(`p`,{className:`text-xs text-ink-black font-medium leading-relaxed m-0 italic font-serif`,children:[`“`,e.text,`”`]})]},e.id)):(0,j.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center text-center p-6 text-slate-500`,children:[(0,j.jsx)(o,{className:`w-8 h-8 mb-2 text-slate-400`}),(0,j.jsx)(`p`,{className:`text-xs font-medium`,children:`Aurelia records entries in her Spire Chronicles autonomously as you chat, rest, and cross chapter milestones.`})]})}),m===`codex`&&(0,j.jsxs)(`div`,{className:`flex flex-col gap-3 flex-1 select-text`,children:[(0,j.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between border-b border-slate-100 pb-1.5`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(v,{className:`w-4 h-4 text-amber-600`}),(0,j.jsx)(`h5`,{className:`font-headline-md font-bold text-xs text-ink-black m-0`,children:`Hero Codex (MemGPT & Mem0 Core Memory)`})]}),(0,j.jsx)(`span`,{className:`text-[10px] text-slate-400 font-mono`,children:`Cognitive Sync`})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2 text-xs`,children:[(0,j.jsxs)(`div`,{className:`bg-[#FFFDF0] border border-amber-900/20 rounded p-2`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-bold text-slate-500 uppercase tracking-wider block`,children:`Hero Alias`}),(0,j.jsx)(`span`,{className:`font-bold text-ink-black text-xs`,children:r?.heroName||`Champion`})]}),(0,j.jsxs)(`div`,{className:`bg-[#FFFDF0] border border-amber-900/20 rounded p-2`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-bold text-slate-500 uppercase tracking-wider block`,children:`Target Goal`}),(0,j.jsx)(`span`,{className:`font-bold text-amber-900 text-xs`,children:r?.targetGoal||`None shared yet (mention to Aurelia!)`})]})]}),r?.preferredLanguage&&(0,j.jsxs)(`div`,{className:`bg-[#FFFDF0] border border-amber-900/20 rounded p-2 text-xs`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-bold text-slate-500 uppercase tracking-wider block`,children:`Weapon of Choice (Language)`}),(0,j.jsx)(`span`,{className:`font-bold text-ink-black`,children:r.preferredLanguage})]})]}),(0,j.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-bold text-emerald-800`,children:[(0,j.jsx)(f,{className:`w-3.5 h-3.5`}),(0,j.jsxs)(`span`,{children:[`Mastered Patterns (`,r?.strengths?.length||0,`)`]})]}),r?.strengths&&r.strengths.length>0?(0,j.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.strengths.map(e=>(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-[11px] font-bold bg-emerald-50 text-emerald-800 border border-emerald-300`,children:[e,u&&(0,j.jsx)(`button`,{type:`button`,onClick:()=>u(`strengths`,e),className:`hover:text-red-600 ml-0.5 cursor-pointer`,title:`Forget strength`,children:(0,j.jsx)(_,{className:`w-3 h-3`})})]},e))}):(0,j.jsx)(`p`,{className:`text-[11px] text-slate-400 italic m-0`,children:`Aurelia will note topics you conquer during your practice.`})]}),(0,j.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-bold text-rose-800`,children:[(0,j.jsx)(a,{className:`w-3.5 h-3.5`}),(0,j.jsxs)(`span`,{children:[`Nemesis Patterns (`,r?.nemesisPatterns?.length||0,`)`]})]}),r?.nemesisPatterns&&r.nemesisPatterns.length>0?(0,j.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.nemesisPatterns.map(e=>(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-[11px] font-bold bg-rose-50 text-rose-800 border border-rose-300`,children:[e,u&&(0,j.jsx)(`button`,{type:`button`,onClick:()=>u(`nemesisPatterns`,e),className:`hover:text-red-700 ml-0.5 cursor-pointer`,title:`Forget nemesis`,children:(0,j.jsx)(_,{className:`w-3 h-3`})})]},e))}):(0,j.jsx)(`p`,{className:`text-[11px] text-slate-400 italic m-0`,children:`Aurelia tracks patterns that give you trouble to help you prepare targeted drills.`})]}),(0,j.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,j.jsx)(`div`,{className:`text-xs font-bold text-slate-800`,children:(0,j.jsxs)(`span`,{children:[`Personal Notes & Shared Lore (`,r?.personalNotes?.length||0,`)`]})}),r?.personalNotes&&r.personalNotes.length>0?(0,j.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:r.personalNotes.map(e=>(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-2 p-2 bg-slate-50 border border-slate-200 rounded text-[11px] text-slate-700`,children:[(0,j.jsxs)(`span`,{children:[`• `,e]}),u&&(0,j.jsx)(`button`,{type:`button`,onClick:()=>u(`personalNotes`,e),className:`text-slate-400 hover:text-red-600 shrink-0 cursor-pointer p-0.5`,title:`Forget note`,children:(0,j.jsx)(g,{className:`w-3 h-3`})})]},e))}):(0,j.jsx)(`p`,{className:`text-[11px] text-slate-400 italic m-0`,children:`Share your background or routine with Aurelia and she will hold it in her memory.`})]}),i&&i.length>0&&(0,j.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between border-b border-slate-100 pb-1`,children:[(0,j.jsx)(`span`,{className:`text-xs font-bold text-slate-800`,children:`Episodic Memory Chain (EM-LLM)`}),(0,j.jsxs)(`span`,{className:`text-[10px] text-slate-400 font-mono`,children:[i.length,` events`]})]}),(0,j.jsx)(`div`,{className:`flex flex-col gap-2 max-h-40 overflow-y-auto custom-scrollbar`,children:i.slice(0,8).map(e=>(0,j.jsxs)(`div`,{className:`text-[11px] p-2 bg-[#FFFDF0] border border-amber-900/15 rounded flex flex-col gap-0.5`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`span`,{className:`font-bold text-ink-black uppercase text-[9px] px-1.5 py-0.5 bg-amber-200/60 rounded`,children:e.eventType.replace(`_`,` `)}),(0,j.jsx)(`span`,{className:`text-[10px] text-slate-400`,children:new Date(e.timestamp).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})})]}),(0,j.jsx)(`div`,{className:`font-bold text-slate-800 mt-0.5`,children:e.title}),(0,j.jsx)(`div`,{className:`text-slate-600 text-[10px]`,children:e.description})]},e.id))})]}),(0,j.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between border-b border-slate-100 pb-1`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-bold text-indigo-900`,children:[(0,j.jsx)(h,{className:`w-3.5 h-3.5 text-amber-500`}),(0,j.jsx)(`span`,{children:`Autonomous Enchantment Telemetry`})]}),(0,j.jsxs)(`span`,{className:`text-[10px] text-slate-400 font-mono`,children:[l?.length||0,` executed`]})]}),l&&l.length>0?(0,j.jsx)(`div`,{className:`flex flex-col gap-1.5 max-h-36 overflow-y-auto custom-scrollbar`,children:l.slice(0,10).map((e,t)=>(0,j.jsxs)(`div`,{className:`text-[11px] p-2 bg-indigo-50/50 border border-indigo-100 rounded flex items-center justify-between gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex flex-col min-w-0`,children:[(0,j.jsxs)(`span`,{className:`font-bold text-indigo-950 font-mono text-[10px] truncate`,children:[e.tool_name,`()`]}),e.args&&Object.keys(e.args).length>0&&(0,j.jsx)(`span`,{className:`text-[9px] text-slate-500 truncate`,children:JSON.stringify(e.args).slice(0,50)})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[e.execution_time_ms!==void 0&&(0,j.jsxs)(`span`,{className:`text-[9px] text-slate-400 flex items-center gap-0.5 font-mono`,children:[(0,j.jsx)(d,{className:`w-2.5 h-2.5`}),e.execution_time_ms,`ms`]}),(0,j.jsx)(`span`,{className:`px-1.5 py-0.2 text-[9px] font-bold rounded ${e.success?`bg-emerald-100 text-emerald-800`:`bg-rose-100 text-rose-800`}`,children:e.success?`SUCCESS`:`ERR`})]})]},t))}):(0,j.jsx)(`p`,{className:`text-[11px] text-slate-400 italic m-0`,children:`No autonomous enchantments executed yet in this session.`})]})]})]}),(0,j.jsx)(`div`,{className:`bg-white border-t border-slate-200 px-4 py-2 flex items-center justify-end shrink-0`,children:(0,j.jsx)(`button`,{type:`button`,onClick:p,className:`px-4 py-1.5 bg-white hover:bg-slate-100 border-[1.5px] border-ink-black rounded font-bold text-xs text-ink-black cursor-pointer shadow-xs active:translate-y-0.5`,children:`Close`})})]})})}var R=e({default:()=>z});function z({onClose:e,onMinimize:t,isActive:n=!0,onFocus:r,zIndex:a}){let o=E(),[s,c]=(0,O.useState)(S()),[l,u]=(0,O.useState)(!1),[d,f]=(0,O.useState)(!1),[m,h]=(0,O.useState)(!1);(0,O.useEffect)(()=>{C.syncWithBackend(),C.triggerProactiveGreeting()},[]);let g=(0,O.useCallback)(()=>{e?e():w.getState().closeWindow(`companion`)},[e]),v=(0,O.useCallback)(()=>{t?t():w.getState().minimizeWindow(`companion`)},[t]),y=(0,O.useCallback)(()=>{r?r():w.getState().setActiveWindow(`companion`)},[r]),b=(0,O.useCallback)(()=>{let e=!s;c(e),T(e)},[s]),x=(0,O.useCallback)(()=>{window.confirm(`Clear conversation transcript with Princess Aurelia?`)&&C.clearTranscript()},[]),D=(0,O.useCallback)(e=>{C.setIsTyping(e)},[]),k=(0,O.useMemo)(()=>[...o.transcript].reverse().find(e=>e.sender===`princess`)||o.transcript[0],[o.transcript]),A=`Welcome back to the Spire Tower Parlor. How is your day going today? Are you making progress, or could you use a hand?`,N=k?k.isStreaming?k.text:k.text||(o.isLoading?``:A):A,P=(0,O.useMemo)(()=>k?.choiceSuggestions&&k.choiceSuggestions.length>0?k.choiceSuggestions:[...o.transcript].reverse().find(e=>e.sender===`princess`&&e.choiceSuggestions&&e.choiceSuggestions.length>0)?.choiceSuggestions,[k,o.transcript]);return(0,j.jsxs)(`div`,{onClick:y,className:`fixed inset-x-0 top-0 bottom-[40px] select-none pointer-events-none overflow-hidden font-sans`,style:{zIndex:a??(n?40:30)},children:[(0,j.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 h-44 bg-gradient-to-t from-slate-950/35 via-slate-900/10 to-transparent pointer-events-none z-0`}),(0,j.jsxs)(`div`,{className:`relative w-full h-full flex flex-col justify-end pointer-events-none pb-2 sm:pb-3 px-2 sm:px-4 md:px-8`,children:[(0,j.jsxs)(`div`,{className:`relative w-full max-w-5xl lg:max-w-6xl mx-auto flex items-end justify-start pointer-events-none`,children:[(0,j.jsx)(`div`,{className:`relative z-30 shrink-0 pointer-events-auto -mr-6 sm:-mr-10 md:-mr-12 lg:-mr-14`,children:(0,j.jsx)(M,{emotion:o.activeEmotion,floor:o.currentFloor,rhythm:o.currentRhythm,activity:o.currentActivity,isLoading:o.isLoading,onClick:y})}),(0,j.jsx)(`div`,{className:`relative z-20 flex-1 min-w-0 pointer-events-auto mb-1`,children:(0,j.jsx)(F,{characterName:o.companionSettings.name||`Princess Aurelia`,emotion:o.activeEmotion,text:N,isStreaming:k?.isStreaming,isLoading:o.isLoading,choices:P,toolCalls:k?.toolCalls,onSelectChoice:e=>C.sendMessage(e),onSendMessage:e=>C.sendMessage(e),onTypingStatusChange:D,currentFloor:o.currentFloor,bondTier:o.bondTier,satchelCount:o.unlockedLetters.length,isMuted:s,onToggleMute:b,onOpenProgress:()=>u(!0),onOpenSatchel:()=>f(!0),onOpenHistory:()=>h(!0),onMinimize:v,onClose:g})})]}),(0,j.jsxs)(`div`,{className:`absolute bottom-1 right-3.5 pointer-events-none z-30 hidden md:flex flex-col items-center gap-0.5 opacity-65 select-none`,children:[(0,j.jsx)(`svg`,{className:`w-8 h-8 text-[#9cbcdb] drop-shadow-[0_0_6px_rgba(156,188,219,0.5)] rotate-6`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,j.jsx)(`path`,{d:`M12 2 C12 7.8 7.8 12 2 12 C7.8 12 12 16.2 12 22 C12 16.2 16.2 12 22 12 C16.2 12 12 7.8 12 2 Z`})}),(0,j.jsxs)(`div`,{className:`font-mono text-[9px] text-[#7ba4c8] tracking-tight leading-tight text-center`,children:[(0,j.jsx)(`div`,{children:`AlgoSpaced (Beta)`}),(0,j.jsx)(`div`,{children:`Build Jun24 preview`})]})]})]}),l&&(0,j.jsx)(`div`,{className:`pointer-events-auto`,children:(0,j.jsx)(I,{currentFloor:o.currentFloor,totalSolved:o.totalSolved,onClose:()=>u(!1)})}),d&&(0,j.jsx)(`div`,{className:`pointer-events-auto`,children:(0,j.jsx)(L,{unlockedLetters:o.unlockedLetters,spireChronicles:o.spireChronicles,currentFloor:o.currentFloor,heroCodex:o.heroCodex,episodicEvents:o.episodicEvents,recentToolTelemetry:o.recentToolTelemetry,onRemoveCodexItem:C.removeCodexItem,onClose:()=>f(!1)})}),m&&(0,j.jsx)(`div`,{className:`fixed inset-0 z-50 bg-black/60 backdrop-blur-xs flex items-center justify-center p-3 sm:p-4 animate-in fade-in duration-200 pointer-events-auto`,onClick:()=>h(!1),children:(0,j.jsxs)(`div`,{className:`bg-[#142335] border-[3px] border-[#5a80a2] rounded-xl max-w-lg w-full h-[80%] max-h-[520px] shadow-[0_16px_40px_rgba(0,0,0,0.85)] flex flex-col overflow-hidden text-white`,onClick:e=>e.stopPropagation(),style:{boxShadow:`inset 0 0 0 1px #0a1420, inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 16px 40px rgba(0, 0, 0, 0.85)`},children:[(0,j.jsxs)(`div`,{className:`bg-[#101b2a] border-b border-[#304f6f] px-4 py-2.5 flex items-center justify-between shrink-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(p,{className:`w-4 h-4 text-[#67b1ec]`}),(0,j.jsxs)(`h4`,{className:`font-mono font-bold text-xs sm:text-sm text-[#e6f0fa] m-0`,children:[`Dialogue Transcript (`,o.transcript.length,` turns)`]})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsxs)(`button`,{type:`button`,onClick:x,className:`px-2 py-0.5 bg-rose-950/60 hover:bg-rose-900 border border-rose-700/60 rounded text-[11px] font-mono font-bold text-rose-300 hover:text-white flex items-center gap-1 cursor-pointer mr-1 transition-colors`,title:`Clear Chat History`,children:[(0,j.jsx)(i,{className:`w-3 h-3`}),(0,j.jsx)(`span`,{children:`Clear`})]}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>h(!1),className:`p-1 hover:bg-[#203a55] rounded text-[#8cb4db] hover:text-white cursor-pointer transition-colors`,title:`Close`,children:(0,j.jsx)(_,{className:`w-4 h-4`})})]})]}),(0,j.jsx)(`div`,{className:`flex-1 p-3 sm:p-4 overflow-y-auto custom-scrollbar flex flex-col gap-2.5 bg-[#0e1824]/90`,children:o.transcript.map((e,t)=>(0,j.jsxs)(`div`,{className:`p-2.5 rounded-lg border font-mono text-xs max-w-[90%] shadow-md ${e.sender===`princess`?`bg-[#182c42] border-[#3e6080] text-[#e6f0fa] self-start`:`bg-[#214365] border-[#5a8bb9] text-white self-end`}`,children:[(0,j.jsx)(`div`,{className:`text-[10px] font-bold mb-1 text-[#f6d267]`,children:e.sender===`princess`?o.companionSettings.name:`Hero`}),(0,j.jsx)(`p`,{className:`font-medium m-0 leading-relaxed whitespace-pre-wrap select-text`,children:e.text})]},e.id||t))})]})})]})}export{R as t}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/ProblemSpecPanel-Df-cRYRz.js b/algospaced-ui/dist/assets/ProblemSpecPanel-MCUtP8V_.js similarity index 56% rename from algospaced-ui/dist/assets/ProblemSpecPanel-Df-cRYRz.js rename to algospaced-ui/dist/assets/ProblemSpecPanel-MCUtP8V_.js index 5f1250d15a29c84fad4631a987d0444bc0fc465f..ff43f1a14ea3e47bb4b8970b59ff153a4525f98a 100644 --- a/algospaced-ui/dist/assets/ProblemSpecPanel-Df-cRYRz.js +++ b/algospaced-ui/dist/assets/ProblemSpecPanel-MCUtP8V_.js @@ -1,4 +1,4 @@ -import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,A as n,G as ee,Lt as r,N as i,Q as a,St as o,U as te,d as s,et as ne,f as c,ft as re,j as ie,o as l,ot as ae,p as oe,rt as u,s as se,xt as ce,y as d,zt as f}from"./vendor-react-qmUj3JUi.js";import{u as p}from"./index-DYMSjoUb.js";import{n as m,t as h}from"./MarkdownRenderer-CC5nUs7-.js";import{n as le}from"./ReviewQueue-C250a4ib.js";var g=e(f(),1),_=r(),ue=[`Arrays & Hashing`,`Two Pointers`,`Sliding Window`,`Stack`,`Binary Search`,`Linked List`,`Trees`,`Tries`,`Heap / Priority Queue`,`Backtracking`,`Graphs`,`Advanced Graphs`,`1-D Dynamic Programming`,`2-D Dynamic Programming`,`Greedy`,`Intervals`,`Math & Geometry`,`Bit Manipulation`];function v(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`sol-${crypto.randomUUID()}`:`sol-${Date.now()}`}var y=({leftTab:e,onSelectLeftTab:r,mobileView:f,isNarrow:y=!1,problem:b,parsed:x,userSolution:de,officialSolution:fe,effectiveReferenceCode:pe,copiedSnippet:S,onCopyText:C,saveRefError:w,aiSolutionLoading:T,aiSolutionError:E,onFetchAiSolution:D,explainLoading:O,explainError:k,explanationText:A,onExplainCode:me,activeReview:j,onUpdateSolutions:M})=>{let[N,P]=(0,g.useState)(!1),[F,I]=(0,g.useState)(()=>b.id||b.name),[L,R]=(0,g.useState)(0),[z,B]=(0,g.useState)(!1),[V,H]=(0,g.useState)(null),[U,W]=(0,g.useState)({name:``,pattern:`Arrays & Hashing`,time_complexity:`O(N)`,space_complexity:`O(1)`,code:``,explanation:``,is_optimal:!1}),[G,K]=(0,g.useState)(!1),[q,J]=(0,g.useState)(null),Y=b.id||b.name;F!==Y&&(I(Y),P(!1),R(0),B(!1),H(null),J(null));let X=le(b,fe,de),Z=L{if(q){let e=setTimeout(()=>J(null),3500);return()=>clearTimeout(e)}},[q]);let he=async()=>{if(!U.name.trim()){J({type:`error`,message:`Solution name cannot be empty.`});return}if(!U.code.trim()){J({type:`error`,message:`Solution code cannot be empty.`});return}K(!0),J(null);try{let e;if(V)e=X.map(e=>e.id===V?{...e,name:U.name.trim(),pattern:U.pattern.trim()||`General Algorithm`,time_complexity:U.time_complexity.trim()||`O(N)`,space_complexity:U.space_complexity.trim()||`O(1)`,code:U.code,explanation:U.explanation.trim(),is_optimal:U.is_optimal}:U.is_optimal&&e.id!==V?{...e,is_optimal:!1}:e);else{let t={id:v(),name:U.name.trim(),pattern:U.pattern.trim()||`General Algorithm`,time_complexity:U.time_complexity.trim()||`O(N)`,space_complexity:U.space_complexity.trim()||`O(1)`,code:U.code,explanation:U.explanation.trim(),is_optimal:U.is_optimal||X.length===0};e=t.is_optimal?[...X.map(e=>({...e,is_optimal:!1})),t]:[...X,t]}let t=e.find(e=>e.is_optimal)||e[0];b.id&&await p(b.id,e,t?.time_complexity,t?.space_complexity,b),M?.(e),J({type:`success`,message:V?`Solution updated successfully!`:`New solution added to problem dossier!`}),B(!1),H(null),R(V?Z:e.length-1)}catch(e){let t=e instanceof Error?e.message:`Failed to save solution.`;J({type:`error`,message:t})}finally{K(!1)}},ge=async e=>{if(X.length<=1){J({type:`error`,message:`Problem must have at least one solution.`});return}if(window.confirm(`Are you sure you want to remove this solution?`)){K(!0);try{let t=X.filter(t=>t.id!==e);!t.some(e=>e.is_optimal)&&t.length>0&&(t[0].is_optimal=!0);let n=t.find(e=>e.is_optimal)||t[0];b.id&&await p(b.id,t,n?.time_complexity,n?.space_complexity,b),M?.(t),R(0),J({type:`success`,message:`Solution removed successfully.`})}catch(e){let t=e instanceof Error?e.message:`Failed to delete solution.`;J({type:`error`,message:t})}finally{K(!1)}}},$=e=>`cursor-pointer font-arcade text-[7.5px] min-[400px]:text-[8px] sm:text-[8.5px] transition-all flex items-center justify-center gap-1 sm:gap-1.5 focus:outline-none focus-visible:ring-2 focus-visible:ring-ink-black select-none whitespace-nowrap shrink-0 ${e?`h-10 px-2 sm:px-2.5 bg-paper-white text-ink-black font-extrabold border-t-2 border-x-2 border-b-0 border-ink-black relative z-10 -mb-[2px] pb-[10px] shadow-[0_-2px_0_0_rgba(30,41,59,0.06)] after:content-[''] after:absolute after:-bottom-[2px] after:left-0 after:right-0 after:h-[2.5px] after:bg-paper-white after:z-10`:`h-9 px-2 sm:px-2.5 bg-[#e8e4da] text-slate-700 hover:bg-[#efece3] hover:text-ink-black font-bold border-2 border-ink-black relative z-0 mb-0`}`;return(0,_.jsxs)(`div`,{className:`w-full ${y?`flex flex-1`:`lg:w-[49%] flex`} flex-col bg-paper-white border-b-[3px] lg:border-b-0 ${y?``:`lg:border-r-[3px]`} border-ink-black overflow-hidden ${y&&f!==`spec`&&f!==`ref`?`hidden`:`flex`}`,children:[(0,_.jsxs)(`div`,{className:`shrink-0 bg-[#f4f1ea] border-b-2 border-ink-black px-1.5 sm:px-2.5 pt-2 flex items-end gap-1 relative z-10 overflow-x-auto no-scrollbar`,children:[(0,_.jsxs)(`button`,{onClick:()=>r(`spec`),className:$(e===`spec`),children:[(0,_.jsx)(a,{className:`w-3 h-3 text-purple-700 shrink-0`}),(0,_.jsx)(`span`,{children:y?`SPEC`:`SPECIFICATIONS`})]}),(0,_.jsxs)(`button`,{onClick:()=>r(`ref`),className:$(e===`ref`),children:[(0,_.jsx)(ae,{className:`w-3 h-3 text-blue-700 shrink-0`}),(0,_.jsx)(`span`,{children:y?`SOL (${X.length})`:`SOLUTIONS (${X.length})`})]}),(0,_.jsxs)(`button`,{onClick:()=>r(`leitner`),className:$(e===`leitner`),children:[(0,_.jsx)(c,{className:`w-3 h-3 text-emerald-700 shrink-0`}),(0,_.jsx)(`span`,{className:`whitespace-nowrap`,children:y?`FSRS`:`FSRS STATS`})]})]}),(0,_.jsxs)(`div`,{className:`flex-1 overflow-y-auto no-scrollbar p-4 sm:p-5 space-y-4`,children:[e===`spec`&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{className:`p-4 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] space-y-3.5`,children:[(0,_.jsx)(`div`,{children:(0,_.jsx)(`h2`,{className:`text-base sm:text-lg font-extrabold text-ink-black font-headline-md leading-tight m-0 select-text`,children:b.name||`Algorithm Problem`})}),x.description&&(0,_.jsxs)(`div`,{className:`pt-3.5 border-t border-slate-200`,children:[(0,_.jsxs)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold mb-2 flex items-center gap-1`,children:[(0,_.jsx)(o,{className:`w-3 h-3 text-primary`}),`PROBLEM DESCRIPTION`]}),(0,_.jsx)(`div`,{className:`font-sans text-xs sm:text-[13px] text-slate-800 leading-relaxed space-y-2 font-medium`,children:x.description.split(` -`).map((e,t)=>e.trim()?(0,_.jsx)(`p`,{className:`m-0 leading-relaxed whitespace-pre-wrap select-text`,children:m(e)},t):(0,_.jsx)(`div`,{className:`h-1.5`},t))})]}),x.examples.length>0&&(0,_.jsxs)(`div`,{className:`pt-3.5 border-t border-slate-200 space-y-2.5`,children:[(0,_.jsxs)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold flex items-center gap-1.5`,children:[(0,_.jsx)(l,{className:`w-3 h-3 text-amber-500`}),`EXAMPLES (`,x.examples.length,`)`]}),(0,_.jsx)(`div`,{className:`space-y-2.5`,children:x.examples.map((e,t)=>(0,_.jsxs)(`div`,{className:`p-3 bg-slate-50 border border-slate-200 space-y-2 text-xs`,children:[(0,_.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,_.jsxs)(`span`,{className:`font-arcade text-[9px] font-bold text-primary`,children:[`EXAMPLE `,t+1]}),e.input&&(0,_.jsxs)(`button`,{onClick:()=>C(e.input,`ex-${t}`),className:`px-2 py-0.5 bg-white hover:bg-slate-100 border border-ink-black text-[9px] font-arcade text-ink-black flex items-center gap-1 cursor-pointer`,title:`Copy input data`,children:[(0,_.jsx)(u,{className:`w-2.5 h-2.5`}),S===`ex-${t}`?`COPIED!`:`COPY`]})]}),e.input&&(0,_.jsxs)(`div`,{className:`space-y-1`,children:[(0,_.jsx)(`span`,{className:`text-[9px] font-arcade text-trash-gray font-bold uppercase block`,children:`Input:`}),(0,_.jsx)(`div`,{className:`bg-[#1E293B] text-[#4ADE80] font-code-mono p-2 border border-ink-black text-[11px] break-all select-text`,children:e.input})]}),e.output&&(0,_.jsxs)(`div`,{className:`space-y-1`,children:[(0,_.jsx)(`span`,{className:`text-[9px] font-arcade text-trash-gray font-bold uppercase block`,children:`Output:`}),(0,_.jsx)(`div`,{className:`bg-[#1E293B] text-[#4ADE80] font-code-mono p-2 border border-ink-black text-[11px] break-all select-text`,children:e.output})]}),e.explanation&&(0,_.jsxs)(`div`,{className:`text-[11px] font-sans text-slate-600 bg-white p-2 border border-slate-200`,children:[(0,_.jsx)(`span`,{className:`font-bold text-slate-700`,children:`Explanation: `}),m(e.explanation)]})]},t))})]}),x.constraints.length>0&&(0,_.jsxs)(`div`,{className:`pt-3.5 border-t border-slate-200`,children:[(0,_.jsx)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold mb-2`,children:`CONSTRAINTS`}),(0,_.jsx)(`ul`,{className:`space-y-1.5 list-none m-0 p-0`,children:x.constraints.map((e,t)=>(0,_.jsxs)(`li`,{className:`flex items-start gap-2 text-xs`,children:[(0,_.jsx)(`span`,{className:`text-primary font-bold select-none`,children:`•`}),(0,_.jsx)(`code`,{className:`bg-slate-100 text-ink-black font-code-mono px-2 py-0.5 border border-slate-300 text-[11px] select-text`,children:e})]},t))})]})]}),N?(0,_.jsxs)(`div`,{className:`p-3 bg-amber-50 border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] flex flex-wrap items-center justify-between gap-2`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,_.jsx)(l,{className:`w-4 h-4 text-amber-600 shrink-0`}),(0,_.jsx)(`span`,{className:`font-arcade text-[9px] font-bold text-ink-black tracking-wide uppercase`,children:`OPTIMAL TARGET:`}),(0,_.jsxs)(`code`,{className:`bg-[#1E293B] text-[#4ADE80] font-code-mono px-2 py-0.5 text-[11px] border border-ink-black font-bold`,children:[`T: `,b.optimal_time||`O(N)`]}),(0,_.jsxs)(`code`,{className:`bg-[#1E293B] text-[#4ADE80] font-code-mono px-2 py-0.5 text-[11px] border border-ink-black font-bold`,children:[`S: `,b.optimal_space||`O(1)`]})]}),(0,_.jsxs)(`button`,{type:`button`,onClick:()=>P(!1),className:`px-2 py-0.5 bg-white hover:bg-slate-100 border border-ink-black font-arcade text-[8px] text-trash-gray hover:text-ink-black cursor-pointer flex items-center gap-1`,title:`Conceal target complexity`,children:[(0,_.jsx)(ne,{className:`w-2.5 h-2.5`}),(0,_.jsx)(`span`,{children:`HIDE`})]})]}):(0,_.jsxs)(`div`,{className:`p-3 bg-amber-50/70 border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] flex items-center justify-between gap-2`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(te,{className:`w-4 h-4 text-amber-700 shrink-0`}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`span`,{className:`font-arcade text-[9px] font-bold text-ink-black tracking-wide uppercase block`,children:`OPTIMAL COMPLEXITY TARGET`}),(0,_.jsx)(`span`,{className:`text-[10px] font-sans text-slate-600 font-semibold`,children:`Hidden to test active recall before coding`})]})]}),(0,_.jsxs)(`button`,{type:`button`,onClick:()=>P(!0),className:`px-2.5 py-1 bg-white hover:bg-amber-100 border-2 border-ink-black font-arcade text-[8.5px] font-bold text-ink-black shadow-[1.5px_1.5px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer flex items-center gap-1.5 shrink-0`,title:`Click to reveal target time and space complexity`,children:[(0,_.jsx)(t,{className:`w-3 h-3 text-amber-700`}),(0,_.jsx)(`span`,{children:`REVEAL TARGET`})]})]})]}),e===`ref`&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[q&&(0,_.jsxs)(`div`,{className:`p-2.5 border-2 border-ink-black text-xs font-bold flex items-center justify-between shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] ${q.type===`success`?`bg-emerald-100 text-emerald-900 border-emerald-700`:`bg-rose-100 text-rose-900 border-rose-700`}`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[q.type===`success`?(0,_.jsx)(re,{className:`w-4 h-4 text-emerald-700 shrink-0`}):(0,_.jsx)(s,{className:`w-4 h-4 text-rose-700 shrink-0`}),(0,_.jsx)(`span`,{children:q.message})]}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>J(null),className:`text-slate-600 hover:text-ink-black cursor-pointer`,children:(0,_.jsx)(se,{className:`w-3.5 h-3.5`})})]}),(0,_.jsxs)(`div`,{className:`flex items-center gap-1 p-1 bg-slate-200/90 border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] overflow-x-auto no-scrollbar`,children:[X.map((e,t)=>(0,_.jsxs)(`button`,{type:`button`,onClick:()=>{R(t),B(!1),H(null)},className:`py-1 px-2 rounded-full font-arcade text-[8px] font-bold flex items-center justify-center gap-1 border-2 border-ink-black transition-all cursor-pointer whitespace-nowrap shrink-0 ${Z===t&&!z&&!V?`bg-sky-600 text-white shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] -translate-y-0.5`:`bg-white text-ink-black hover:bg-sky-50 shadow-none`}`,title:e.name?`${e.name} (${e.pattern||`Algorithm`})`:`Solution ${t+1}`,children:[e.is_optimal?(0,_.jsx)(d,{className:`w-3 h-3 text-amber-300`}):(0,_.jsx)(o,{className:`w-3 h-3`}),(0,_.jsx)(`span`,{children:`Sol ${t+1}`}),e.is_optimal&&(0,_.jsx)(`span`,{className:`text-[6.5px] px-1 py-0.2 bg-amber-300 text-ink-black border border-ink-black font-extrabold rounded-full tracking-tight`,children:`OPTIMAL`})]},e.id||t)),(0,_.jsx)(`button`,{type:`button`,onClick:()=>{B(!0),H(null),W({name:`Method ${X.length+1}`,pattern:`Arrays & Hashing`,time_complexity:`O(N)`,space_complexity:`O(1)`,code:``,explanation:``,is_optimal:!1})},className:`h-6 w-6 rounded-full font-arcade text-[9px] font-bold flex items-center justify-center border-2 border-ink-black cursor-pointer shrink-0 active:translate-y-0.5 transition-all shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] ${z?`bg-emerald-600 text-white`:`bg-amber-300 text-ink-black hover:bg-amber-200`}`,title:`Add another solution / method for this problem`,"aria-label":`Add Solution`,children:(0,_.jsx)(ie,{className:`w-3 h-3 stroke-[2.5]`})})]}),z||V?(0,_.jsxs)(`div`,{className:`p-4 bg-white border-2 border-ink-black shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] space-y-3.5`,children:[(0,_.jsxs)(`div`,{className:`flex items-center justify-between pb-2 border-b-2 border-dashed border-ink-black`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(i,{className:`w-4 h-4 text-purple-700`}),(0,_.jsx)(`span`,{className:`font-arcade text-[10px] font-bold text-ink-black uppercase`,children:V?`EDIT SOLUTION`:`ADD NEW SOLUTION / METHOD`})]}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>{B(!1),H(null)},className:`text-xs font-arcade text-trash-gray hover:text-rose-600 cursor-pointer font-bold`,children:`CANCEL`})]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,_.jsxs)(`div`,{className:`space-y-1`,children:[(0,_.jsx)(`label`,{className:`font-arcade text-[8.5px] font-bold text-trash-gray uppercase block`,children:`Solution / Method Name`}),(0,_.jsx)(`input`,{type:`text`,value:U.name,onChange:e=>W({...U,name:e.target.value}),placeholder:`e.g. One-Pass Hash Map, Two Pointers`,className:`w-full p-2 border-2 border-ink-black text-xs font-bold bg-[#fdf8e1] focus:outline-none focus:bg-white`})]}),(0,_.jsxs)(`div`,{className:`space-y-1`,children:[(0,_.jsx)(`label`,{className:`font-arcade text-[8.5px] font-bold text-trash-gray uppercase block`,children:`Pattern / Strategy`}),(0,_.jsx)(`select`,{value:U.pattern,onChange:e=>W({...U,pattern:e.target.value}),className:`w-full p-2 border-2 border-ink-black text-xs font-bold bg-[#fdf8e1] focus:outline-none focus:bg-white`,children:ue.map(e=>(0,_.jsx)(`option`,{value:e,children:e},e))})]}),(0,_.jsxs)(`div`,{className:`space-y-1`,children:[(0,_.jsx)(`label`,{className:`font-arcade text-[8.5px] font-bold text-trash-gray uppercase block`,children:`Time Complexity`}),(0,_.jsx)(`input`,{type:`text`,value:U.time_complexity,onChange:e=>W({...U,time_complexity:e.target.value}),placeholder:`e.g. O(N), O(N log N), O(N^2)`,className:`w-full p-2 border-2 border-ink-black text-xs font-code-mono font-bold bg-[#fdf8e1] focus:outline-none focus:bg-white`})]}),(0,_.jsxs)(`div`,{className:`space-y-1`,children:[(0,_.jsx)(`label`,{className:`font-arcade text-[8.5px] font-bold text-trash-gray uppercase block`,children:`Space Complexity`}),(0,_.jsx)(`input`,{type:`text`,value:U.space_complexity,onChange:e=>W({...U,space_complexity:e.target.value}),placeholder:`e.g. O(1), O(N)`,className:`w-full p-2 border-2 border-ink-black text-xs font-code-mono font-bold bg-[#fdf8e1] focus:outline-none focus:bg-white`})]})]}),(0,_.jsxs)(`div`,{className:`space-y-1`,children:[(0,_.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,_.jsx)(`label`,{className:`font-arcade text-[8.5px] font-bold text-trash-gray uppercase`,children:`Python Reference Code`}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>W({...U,code:pe}),className:`text-[8.5px] font-arcade text-sky-700 hover:underline cursor-pointer`,children:`Paste Current Code`})]}),(0,_.jsx)(`textarea`,{rows:8,value:U.code,onChange:e=>W({...U,code:e.target.value}),placeholder:`class Solution: +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,A as n,H as ee,Lt as r,M as i,Q as te,W as ne,Z as re,a,at as ie,bt as ae,d as o,dt as oe,f as se,k as s,nt as c,o as ce,u as l,v as u,xt as d,zt as f}from"./vendor-react-q-oOktF_.js";import{u as p}from"./index-Bcgsshpk.js";import{n as m,t as h}from"./MarkdownRenderer-cD9l7avV.js";import{n as le}from"./ReviewQueue-DRECcJtJ.js";var g=e(f(),1),_=r(),ue=[`Arrays & Hashing`,`Two Pointers`,`Sliding Window`,`Stack`,`Binary Search`,`Linked List`,`Trees`,`Tries`,`Heap / Priority Queue`,`Backtracking`,`Graphs`,`Advanced Graphs`,`1-D Dynamic Programming`,`2-D Dynamic Programming`,`Greedy`,`Intervals`,`Math & Geometry`,`Bit Manipulation`];function v(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`sol-${crypto.randomUUID()}`:`sol-${Date.now()}`}var y=({leftTab:e,onSelectLeftTab:r,mobileView:f,isNarrow:y=!1,problem:b,parsed:x,userSolution:de,officialSolution:fe,effectiveReferenceCode:S,copiedSnippet:C,onCopyText:w,saveRefError:T,aiSolutionLoading:E,aiSolutionError:D,onFetchAiSolution:O,explainLoading:k,explainError:A,explanationText:j,onExplainCode:pe,activeReview:M,onUpdateSolutions:N})=>{let[me,P]=(0,g.useState)(!1),[F,I]=(0,g.useState)(()=>b.id||b.name),[L,R]=(0,g.useState)(0),[z,B]=(0,g.useState)(!1),[V,H]=(0,g.useState)(null),[U,W]=(0,g.useState)({name:``,pattern:`Arrays & Hashing`,time_complexity:`O(N)`,space_complexity:`O(1)`,code:``,explanation:``,is_optimal:!1}),[G,K]=(0,g.useState)(!1),[q,J]=(0,g.useState)(null),Y=b.id||b.name;F!==Y&&(I(Y),P(!1),R(0),B(!1),H(null),J(null));let X=le(b,fe,de),Z=L{if(q){let e=setTimeout(()=>J(null),3500);return()=>clearTimeout(e)}},[q]);let he=async()=>{if(!U.name.trim()){J({type:`error`,message:`Solution name cannot be empty.`});return}if(!U.code.trim()){J({type:`error`,message:`Solution code cannot be empty.`});return}K(!0),J(null);try{let e;if(V)e=X.map(e=>e.id===V?{...e,name:U.name.trim(),pattern:U.pattern.trim()||`General Algorithm`,time_complexity:U.time_complexity.trim()||`O(N)`,space_complexity:U.space_complexity.trim()||`O(1)`,code:U.code,explanation:U.explanation.trim(),is_optimal:U.is_optimal}:U.is_optimal&&e.id!==V?{...e,is_optimal:!1}:e);else{let t={id:v(),name:U.name.trim(),pattern:U.pattern.trim()||`General Algorithm`,time_complexity:U.time_complexity.trim()||`O(N)`,space_complexity:U.space_complexity.trim()||`O(1)`,code:U.code,explanation:U.explanation.trim(),is_optimal:U.is_optimal||X.length===0};e=t.is_optimal?[...X.map(e=>({...e,is_optimal:!1})),t]:[...X,t]}let t=e.find(e=>e.is_optimal)||e[0];b.id&&await p(b.id,e,t?.time_complexity,t?.space_complexity,b),N?.(e),J({type:`success`,message:V?`Solution updated successfully!`:`New solution added to problem dossier!`}),B(!1),H(null),R(V?Z:e.length-1)}catch(e){let t=e instanceof Error?e.message:`Failed to save solution.`;J({type:`error`,message:t})}finally{K(!1)}},ge=async e=>{if(X.length<=1){J({type:`error`,message:`Problem must have at least one solution.`});return}if(window.confirm(`Are you sure you want to remove this solution?`)){K(!0);try{let t=X.filter(t=>t.id!==e);!t.some(e=>e.is_optimal)&&t.length>0&&(t[0].is_optimal=!0);let n=t.find(e=>e.is_optimal)||t[0];b.id&&await p(b.id,t,n?.time_complexity,n?.space_complexity,b),N?.(t),R(0),J({type:`success`,message:`Solution removed successfully.`})}catch(e){let t=e instanceof Error?e.message:`Failed to delete solution.`;J({type:`error`,message:t})}finally{K(!1)}}},$=e=>`cursor-pointer font-arcade text-[7.5px] min-[400px]:text-[8px] sm:text-[8.5px] transition-all flex items-center justify-center gap-1 sm:gap-1.5 focus:outline-none focus-visible:ring-2 focus-visible:ring-ink-black select-none whitespace-nowrap shrink-0 ${e?`h-10 px-2 sm:px-2.5 bg-paper-white text-ink-black font-extrabold border-t-2 border-x-2 border-b-0 border-ink-black relative z-10 -mb-[2px] pb-[10px] shadow-[0_-2px_0_0_rgba(30,41,59,0.06)] after:content-[''] after:absolute after:-bottom-[2px] after:left-0 after:right-0 after:h-[2.5px] after:bg-paper-white after:z-10`:`h-9 px-2 sm:px-2.5 bg-[#e8e4da] text-slate-700 hover:bg-[#efece3] hover:text-ink-black font-bold border-2 border-ink-black relative z-0 mb-0`}`;return(0,_.jsxs)(`div`,{className:`w-full ${y?`flex flex-1`:`lg:w-[49%] flex`} flex-col bg-paper-white border-b-[3px] lg:border-b-0 ${y?``:`lg:border-r-[3px]`} border-ink-black overflow-hidden ${y&&f!==`spec`&&f!==`ref`?`hidden`:`flex`}`,children:[(0,_.jsxs)(`div`,{className:`shrink-0 bg-[#f4f1ea] border-b-2 border-ink-black px-1.5 sm:px-2.5 pt-2 flex items-end gap-1 relative z-10 overflow-x-auto no-scrollbar`,children:[(0,_.jsxs)(`button`,{onClick:()=>r(`spec`),className:$(e===`spec`),children:[(0,_.jsx)(re,{className:`w-3 h-3 text-purple-700 shrink-0`}),(0,_.jsx)(`span`,{children:y?`SPEC`:`SPECIFICATIONS`})]}),(0,_.jsxs)(`button`,{onClick:()=>r(`ref`),className:$(e===`ref`),children:[(0,_.jsx)(ie,{className:`w-3 h-3 text-blue-700 shrink-0`}),(0,_.jsx)(`span`,{children:y?`SOL (${X.length})`:`SOLUTIONS (${X.length})`})]}),(0,_.jsxs)(`button`,{onClick:()=>r(`leitner`),className:$(e===`leitner`),children:[(0,_.jsx)(o,{className:`w-3 h-3 text-emerald-700 shrink-0`}),(0,_.jsx)(`span`,{className:`whitespace-nowrap`,children:y?`FSRS`:`FSRS STATS`})]})]}),(0,_.jsxs)(`div`,{className:`flex-1 overflow-y-auto no-scrollbar p-4 sm:p-5 space-y-4`,children:[e===`spec`&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{className:`p-4 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] space-y-3.5`,children:[(0,_.jsx)(`div`,{children:(0,_.jsx)(`h2`,{className:`text-base sm:text-lg font-extrabold text-ink-black font-headline-md leading-tight m-0 select-text`,children:b.name||`Algorithm Problem`})}),x.description&&(0,_.jsxs)(`div`,{className:`pt-3.5 border-t border-slate-200`,children:[(0,_.jsxs)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold mb-2 flex items-center gap-1`,children:[(0,_.jsx)(d,{className:`w-3 h-3 text-primary`}),`PROBLEM DESCRIPTION`]}),(0,_.jsx)(`div`,{className:`font-sans text-xs sm:text-[13px] text-slate-800 leading-relaxed space-y-2 font-medium`,children:x.description.split(` +`).map((e,t)=>e.trim()?(0,_.jsx)(`p`,{className:`m-0 leading-relaxed whitespace-pre-wrap select-text`,children:m(e)},t):(0,_.jsx)(`div`,{className:`h-1.5`},t))})]}),x.examples.length>0&&(0,_.jsxs)(`div`,{className:`pt-3.5 border-t border-slate-200 space-y-2.5`,children:[(0,_.jsxs)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold flex items-center gap-1.5`,children:[(0,_.jsx)(a,{className:`w-3 h-3 text-amber-500`}),`EXAMPLES (`,x.examples.length,`)`]}),(0,_.jsx)(`div`,{className:`space-y-2.5`,children:x.examples.map((e,t)=>(0,_.jsxs)(`div`,{className:`p-3 bg-slate-50 border border-slate-200 space-y-2 text-xs`,children:[(0,_.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,_.jsxs)(`span`,{className:`font-arcade text-[9px] font-bold text-primary`,children:[`EXAMPLE `,t+1]}),e.input&&(0,_.jsxs)(`button`,{onClick:()=>w(e.input,`ex-${t}`),className:`px-2 py-0.5 bg-white hover:bg-slate-100 border border-ink-black text-[9px] font-arcade text-ink-black flex items-center gap-1 cursor-pointer`,title:`Copy input data`,children:[(0,_.jsx)(c,{className:`w-2.5 h-2.5`}),C===`ex-${t}`?`COPIED!`:`COPY`]})]}),e.input&&(0,_.jsxs)(`div`,{className:`space-y-1`,children:[(0,_.jsx)(`span`,{className:`text-[9px] font-arcade text-trash-gray font-bold uppercase block`,children:`Input:`}),(0,_.jsx)(`div`,{className:`bg-[#1E293B] text-[#4ADE80] font-code-mono p-2 border border-ink-black text-[11px] break-all select-text`,children:e.input})]}),e.output&&(0,_.jsxs)(`div`,{className:`space-y-1`,children:[(0,_.jsx)(`span`,{className:`text-[9px] font-arcade text-trash-gray font-bold uppercase block`,children:`Output:`}),(0,_.jsx)(`div`,{className:`bg-[#1E293B] text-[#4ADE80] font-code-mono p-2 border border-ink-black text-[11px] break-all select-text`,children:e.output})]}),e.explanation&&(0,_.jsxs)(`div`,{className:`text-[11px] font-sans text-slate-600 bg-white p-2 border border-slate-200`,children:[(0,_.jsx)(`span`,{className:`font-bold text-slate-700`,children:`Explanation: `}),m(e.explanation)]})]},t))})]}),x.constraints.length>0&&(0,_.jsxs)(`div`,{className:`pt-3.5 border-t border-slate-200`,children:[(0,_.jsx)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold mb-2`,children:`CONSTRAINTS`}),(0,_.jsx)(`ul`,{className:`space-y-1.5 list-none m-0 p-0`,children:x.constraints.map((e,t)=>(0,_.jsxs)(`li`,{className:`flex items-start gap-2 text-xs`,children:[(0,_.jsx)(`span`,{className:`text-primary font-bold select-none`,children:`•`}),(0,_.jsx)(`code`,{className:`bg-slate-100 text-ink-black font-code-mono px-2 py-0.5 border border-slate-300 text-[11px] select-text`,children:e})]},t))})]})]}),me?(0,_.jsxs)(`div`,{className:`p-3 bg-amber-50 border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] flex flex-wrap items-center justify-between gap-2`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,_.jsx)(a,{className:`w-4 h-4 text-amber-600 shrink-0`}),(0,_.jsx)(`span`,{className:`font-arcade text-[9px] font-bold text-ink-black tracking-wide uppercase`,children:`OPTIMAL TARGET:`}),(0,_.jsxs)(`code`,{className:`bg-[#1E293B] text-[#4ADE80] font-code-mono px-2 py-0.5 text-[11px] border border-ink-black font-bold`,children:[`T: `,b.optimal_time||`O(N)`]}),(0,_.jsxs)(`code`,{className:`bg-[#1E293B] text-[#4ADE80] font-code-mono px-2 py-0.5 text-[11px] border border-ink-black font-bold`,children:[`S: `,b.optimal_space||`O(1)`]})]}),(0,_.jsxs)(`button`,{type:`button`,onClick:()=>P(!1),className:`px-2 py-0.5 bg-white hover:bg-slate-100 border border-ink-black font-arcade text-[8px] text-trash-gray hover:text-ink-black cursor-pointer flex items-center gap-1`,title:`Conceal target complexity`,children:[(0,_.jsx)(t,{className:`w-2.5 h-2.5`}),(0,_.jsx)(`span`,{children:`HIDE`})]})]}):(0,_.jsxs)(`div`,{className:`p-3 bg-amber-50/70 border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] flex items-center justify-between gap-2`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(ee,{className:`w-4 h-4 text-amber-700 shrink-0`}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`span`,{className:`font-arcade text-[9px] font-bold text-ink-black tracking-wide uppercase block`,children:`OPTIMAL COMPLEXITY TARGET`}),(0,_.jsx)(`span`,{className:`text-[10px] font-sans text-slate-600 font-semibold`,children:`Hidden to test active recall before coding`})]})]}),(0,_.jsxs)(`button`,{type:`button`,onClick:()=>P(!0),className:`px-2.5 py-1 bg-white hover:bg-amber-100 border-2 border-ink-black font-arcade text-[8.5px] font-bold text-ink-black shadow-[1.5px_1.5px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer flex items-center gap-1.5 shrink-0`,title:`Click to reveal target time and space complexity`,children:[(0,_.jsx)(te,{className:`w-3 h-3 text-amber-700`}),(0,_.jsx)(`span`,{children:`REVEAL TARGET`})]})]})]}),e===`ref`&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[q&&(0,_.jsxs)(`div`,{className:`p-2.5 border-2 border-ink-black text-xs font-bold flex items-center justify-between shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] ${q.type===`success`?`bg-emerald-100 text-emerald-900 border-emerald-700`:`bg-rose-100 text-rose-900 border-rose-700`}`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[q.type===`success`?(0,_.jsx)(oe,{className:`w-4 h-4 text-emerald-700 shrink-0`}):(0,_.jsx)(l,{className:`w-4 h-4 text-rose-700 shrink-0`}),(0,_.jsx)(`span`,{children:q.message})]}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>J(null),className:`text-slate-600 hover:text-ink-black cursor-pointer`,children:(0,_.jsx)(ce,{className:`w-3.5 h-3.5`})})]}),(0,_.jsxs)(`div`,{className:`flex items-center gap-1 p-1 bg-slate-200/90 border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] overflow-x-auto no-scrollbar`,children:[X.map((e,t)=>(0,_.jsxs)(`button`,{type:`button`,onClick:()=>{R(t),B(!1),H(null)},className:`py-1 px-2 rounded-full font-arcade text-[8px] font-bold flex items-center justify-center gap-1 border-2 border-ink-black transition-all cursor-pointer whitespace-nowrap shrink-0 ${Z===t&&!z&&!V?`bg-sky-600 text-white shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] -translate-y-0.5`:`bg-white text-ink-black hover:bg-sky-50 shadow-none`}`,title:e.name?`${e.name} (${e.pattern||`Algorithm`})`:`Solution ${t+1}`,children:[e.is_optimal?(0,_.jsx)(u,{className:`w-3 h-3 text-amber-300`}):(0,_.jsx)(d,{className:`w-3 h-3`}),(0,_.jsx)(`span`,{children:`Sol ${t+1}`}),e.is_optimal&&(0,_.jsx)(`span`,{className:`text-[6.5px] px-1 py-0.2 bg-amber-300 text-ink-black border border-ink-black font-extrabold rounded-full tracking-tight`,children:`OPTIMAL`})]},e.id||t)),(0,_.jsx)(`button`,{type:`button`,onClick:()=>{B(!0),H(null),W({name:`Method ${X.length+1}`,pattern:`Arrays & Hashing`,time_complexity:`O(N)`,space_complexity:`O(1)`,code:``,explanation:``,is_optimal:!1})},className:`h-6 w-6 rounded-full font-arcade text-[9px] font-bold flex items-center justify-center border-2 border-ink-black cursor-pointer shrink-0 active:translate-y-0.5 transition-all shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] ${z?`bg-emerald-600 text-white`:`bg-amber-300 text-ink-black hover:bg-amber-200`}`,title:`Add another solution / method for this problem`,"aria-label":`Add Solution`,children:(0,_.jsx)(n,{className:`w-3 h-3 stroke-[2.5]`})})]}),z||V?(0,_.jsxs)(`div`,{className:`p-4 bg-white border-2 border-ink-black shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] space-y-3.5`,children:[(0,_.jsxs)(`div`,{className:`flex items-center justify-between pb-2 border-b-2 border-dashed border-ink-black`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(i,{className:`w-4 h-4 text-purple-700`}),(0,_.jsx)(`span`,{className:`font-arcade text-[10px] font-bold text-ink-black uppercase`,children:V?`EDIT SOLUTION`:`ADD NEW SOLUTION / METHOD`})]}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>{B(!1),H(null)},className:`text-xs font-arcade text-trash-gray hover:text-rose-600 cursor-pointer font-bold`,children:`CANCEL`})]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,_.jsxs)(`div`,{className:`space-y-1`,children:[(0,_.jsx)(`label`,{className:`font-arcade text-[8.5px] font-bold text-trash-gray uppercase block`,children:`Solution / Method Name`}),(0,_.jsx)(`input`,{type:`text`,value:U.name,onChange:e=>W({...U,name:e.target.value}),placeholder:`e.g. One-Pass Hash Map, Two Pointers`,className:`w-full p-2 border-2 border-ink-black text-xs font-bold bg-[#fdf8e1] focus:outline-none focus:bg-white`})]}),(0,_.jsxs)(`div`,{className:`space-y-1`,children:[(0,_.jsx)(`label`,{className:`font-arcade text-[8.5px] font-bold text-trash-gray uppercase block`,children:`Pattern / Strategy`}),(0,_.jsx)(`select`,{value:U.pattern,onChange:e=>W({...U,pattern:e.target.value}),className:`w-full p-2 border-2 border-ink-black text-xs font-bold bg-[#fdf8e1] focus:outline-none focus:bg-white`,children:ue.map(e=>(0,_.jsx)(`option`,{value:e,children:e},e))})]}),(0,_.jsxs)(`div`,{className:`space-y-1`,children:[(0,_.jsx)(`label`,{className:`font-arcade text-[8.5px] font-bold text-trash-gray uppercase block`,children:`Time Complexity`}),(0,_.jsx)(`input`,{type:`text`,value:U.time_complexity,onChange:e=>W({...U,time_complexity:e.target.value}),placeholder:`e.g. O(N), O(N log N), O(N^2)`,className:`w-full p-2 border-2 border-ink-black text-xs font-code-mono font-bold bg-[#fdf8e1] focus:outline-none focus:bg-white`})]}),(0,_.jsxs)(`div`,{className:`space-y-1`,children:[(0,_.jsx)(`label`,{className:`font-arcade text-[8.5px] font-bold text-trash-gray uppercase block`,children:`Space Complexity`}),(0,_.jsx)(`input`,{type:`text`,value:U.space_complexity,onChange:e=>W({...U,space_complexity:e.target.value}),placeholder:`e.g. O(1), O(N)`,className:`w-full p-2 border-2 border-ink-black text-xs font-code-mono font-bold bg-[#fdf8e1] focus:outline-none focus:bg-white`})]})]}),(0,_.jsxs)(`div`,{className:`space-y-1`,children:[(0,_.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,_.jsx)(`label`,{className:`font-arcade text-[8.5px] font-bold text-trash-gray uppercase`,children:`Python Reference Code`}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>W({...U,code:S}),className:`text-[8.5px] font-arcade text-sky-700 hover:underline cursor-pointer`,children:`Paste Current Code`})]}),(0,_.jsx)(`textarea`,{rows:8,value:U.code,onChange:e=>W({...U,code:e.target.value}),placeholder:`class Solution: def solve(self, nums): - ...`,className:`w-full p-2.5 border-2 border-ink-black bg-[#1E293B] text-[#4ADE80] font-code-mono text-xs focus:outline-none no-scrollbar`})]}),(0,_.jsxs)(`div`,{className:`space-y-1`,children:[(0,_.jsx)(`label`,{className:`font-arcade text-[8.5px] font-bold text-trash-gray uppercase block`,children:`Intuition / How to Solve (Optional)`}),(0,_.jsx)(`textarea`,{rows:3,value:U.explanation,onChange:e=>W({...U,explanation:e.target.value}),placeholder:`Key insight, trade-offs, and state tracking notes...`,className:`w-full p-2 border-2 border-ink-black text-xs bg-[#fdf8e1] focus:outline-none focus:bg-white no-scrollbar`})]}),(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`input`,{type:`checkbox`,id:`is_optimal_solution`,checked:U.is_optimal,onChange:e=>W({...U,is_optimal:e.target.checked}),className:`w-4 h-4 border-2 border-ink-black rounded cursor-pointer accent-emerald-600`}),(0,_.jsx)(`label`,{htmlFor:`is_optimal_solution`,className:`font-arcade text-[9px] font-bold text-ink-black cursor-pointer`,children:`SET AS OPTIMAL / PRIMARY APPROACH FOR THIS PROBLEM`})]}),(0,_.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-2 border-t-2 border-dashed border-ink-black`,children:[(0,_.jsx)(`button`,{type:`button`,onClick:()=>{B(!1),H(null)},className:`px-3 py-1.5 bg-slate-100 hover:bg-slate-200 border-2 border-ink-black font-arcade text-[9px] font-bold text-ink-black cursor-pointer`,children:`CANCEL`}),(0,_.jsxs)(`button`,{type:`button`,disabled:G,onClick:he,className:`px-4 py-1.5 bg-emerald-500 hover:bg-emerald-400 border-2 border-ink-black font-arcade text-[9px] font-bold text-white shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer disabled:opacity-50 flex items-center gap-1.5`,children:[G&&(0,_.jsx)(n,{className:`w-3 h-3 animate-spin`}),(0,_.jsx)(`span`,{children:V?`UPDATE SOLUTION`:`SAVE SOLUTION`})]})]})]}):Q?(0,_.jsxs)(`div`,{className:`space-y-3.5`,children:[(0,_.jsxs)(`div`,{className:`p-4 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] space-y-3.5`,children:[(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 pb-3 border-b border-slate-200`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap min-w-0`,children:[(0,_.jsx)(`h3`,{className:`font-headline-md font-extrabold text-sm sm:text-base text-ink-black m-0 select-text break-words`,children:Q.name||`Solution ${Z+1}`}),Q.is_optimal&&(0,_.jsx)(`span`,{className:`px-2 py-0.5 bg-amber-300 border border-ink-black font-arcade text-[8px] font-bold text-ink-black shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] shrink-0`,children:`★ OPTIMAL`})]}),(0,_.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap sm:ml-auto`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,_.jsx)(`span`,{className:`font-arcade text-[8px] text-trash-gray uppercase`,children:`Pattern:`}),(0,_.jsx)(`span`,{className:`px-2 py-0.5 bg-purple-50 border border-purple-300 font-arcade text-[8.5px] text-purple-800 font-bold`,children:Q.pattern||`General Algorithm`})]}),(0,_.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,_.jsxs)(`code`,{className:`bg-[#1E293B] text-[#4ADE80] font-code-mono px-1.5 py-0.5 text-[11px] border border-ink-black font-bold`,children:[`T: `,Q.time_complexity||`O(N)`]}),(0,_.jsxs)(`code`,{className:`bg-[#1E293B] text-[#4ADE80] font-code-mono px-1.5 py-0.5 text-[11px] border border-ink-black font-bold`,children:[`S: `,Q.space_complexity||`O(1)`]})]}),(0,_.jsxs)(`div`,{className:`flex items-center gap-1 ml-auto`,children:[(0,_.jsxs)(`button`,{type:`button`,onClick:()=>{H(Q.id),B(!1),W({name:Q.name,pattern:Q.pattern,time_complexity:Q.time_complexity,space_complexity:Q.space_complexity,code:Q.code,explanation:Q.explanation||``,is_optimal:!!Q.is_optimal})},className:`px-2 py-1 bg-white hover:bg-slate-100 border border-ink-black text-ink-black font-arcade text-[8px] font-bold flex items-center gap-1 cursor-pointer`,title:`Edit this solution`,children:[(0,_.jsx)(i,{className:`w-3 h-3 text-slate-700`}),(0,_.jsx)(`span`,{className:`hidden sm:inline`,children:`EDIT`})]}),X.length>1&&(0,_.jsx)(`button`,{type:`button`,onClick:()=>ge(Q.id),className:`px-1.5 py-1 bg-white hover:bg-rose-50 border border-ink-black text-rose-700 font-arcade text-[8px] font-bold flex items-center gap-1 cursor-pointer`,title:`Delete this solution`,children:(0,_.jsx)(oe,{className:`w-3 h-3`})})]})]})]}),Q.code?(0,_.jsxs)(`div`,{className:`border border-ink-black bg-[#0f172a] overflow-hidden`,children:[(0,_.jsxs)(`div`,{className:`bg-[#1e293b] px-2.5 sm:px-3 py-1.5 border-b border-ink-black flex items-center justify-between gap-1.5 flex-wrap min-w-0`,children:[(0,_.jsx)(`span`,{className:`font-arcade text-[8px] text-slate-300 font-bold uppercase truncate min-w-0 flex-1`,children:y?`PYTHON 3`:`PYTHON 3 IMPLEMENTATION`}),(0,_.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,_.jsxs)(`button`,{type:`button`,onClick:()=>me(Q.code,Q.pattern,Q.time_complexity,Q.space_complexity),disabled:O,className:`px-2 py-0.5 bg-purple-50 hover:bg-purple-100 text-purple-800 border border-ink-black text-[9px] font-arcade font-bold flex items-center gap-1 cursor-pointer shrink-0 disabled:opacity-50 active:translate-y-0.5 transition-all`,title:`Explain this solution with AI`,children:[O?(0,_.jsx)(n,{className:`w-2.5 h-2.5 animate-spin text-purple-700`}):(0,_.jsx)(d,{className:`w-2.5 h-2.5 text-purple-600`}),(0,_.jsx)(`span`,{children:`Explain✦`})]}),(0,_.jsxs)(`button`,{onClick:()=>C(Q.code,`sol-${Q.id}`),className:`px-2 py-0.5 bg-white hover:bg-slate-100 text-ink-black border border-ink-black text-[9px] font-arcade font-bold flex items-center gap-1 cursor-pointer shrink-0 active:translate-y-0.5 transition-all`,title:`Copy solution code`,children:[(0,_.jsx)(u,{className:`w-2.5 h-2.5`}),S===`sol-${Q.id}`?`COPIED!`:`COPY`]})]})]}),(0,_.jsx)(`div`,{className:`p-3 text-xs overflow-x-auto max-h-80 no-scrollbar`,children:(0,_.jsx)(`pre`,{className:`font-code-mono text-[#4ADE80] text-[11px] leading-relaxed select-text m-0`,children:(0,_.jsx)(`code`,{children:Q.code})})})]}):(0,_.jsxs)(`div`,{className:`p-4 bg-amber-50 border border-dashed border-amber-300 text-center space-y-3`,children:[(0,_.jsx)(`p`,{className:`text-xs font-sans text-stone-700`,children:`No code implementation archived for this solution yet.`}),(0,_.jsx)(`button`,{onClick:D,disabled:T,className:`px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white font-arcade text-[9px] font-bold border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer inline-flex items-center gap-2 disabled:opacity-50`,children:T?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(n,{className:`w-3.5 h-3.5 animate-spin`}),(0,_.jsx)(`span`,{children:`Generating solution...`})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(d,{className:`w-3.5 h-3.5 text-amber-300`}),(0,_.jsx)(`span`,{children:`Generate solution`})]})}),E&&(0,_.jsx)(`div`,{className:`text-xs text-rose-600 font-medium`,children:E})]}),Q.explanation&&(0,_.jsxs)(`div`,{className:`pt-3.5 border-t border-slate-200 space-y-1.5 select-text`,children:[(0,_.jsx)(`span`,{className:`font-arcade text-[8.5px] text-trash-gray uppercase font-bold block`,children:`SOLUTION INTUITION & STRATEGY:`}),(0,_.jsx)(h,{content:Q.explanation})]})]}),Q.code&&(0,_.jsxs)(`div`,{className:`space-y-3`,children:[k&&(0,_.jsx)(`div`,{className:`p-3 border-2 border-rose-500 bg-rose-50 text-rose-800 text-xs font-semibold`,children:k}),A&&(0,_.jsxs)(`div`,{className:`p-4 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] space-y-2 select-text`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-1.5 pb-2 border-b-2 border-dashed border-ink-black`,children:[(0,_.jsx)(ce,{className:`w-4 h-4 text-purple-600`}),(0,_.jsxs)(`span`,{className:`font-arcade text-[9px] font-bold text-ink-black uppercase`,children:[`Gemini Code Breakdown (`,Q.name,`)`]})]}),(0,_.jsx)(`div`,{className:`max-h-96 overflow-y-auto no-scrollbar pt-1 select-text`,children:(0,_.jsx)(h,{content:A})})]})]})]}):null,w&&(0,_.jsxs)(`div`,{className:`p-2.5 border-2 border-rose-500 bg-rose-50 text-rose-800 text-xs font-bold flex items-center gap-2 shadow-[2px_2px_0px_0px_rgba(244,63,94,1)]`,children:[(0,_.jsx)(s,{className:`w-4 h-4 text-rose-600 shrink-0`}),(0,_.jsx)(`div`,{className:`flex-1`,children:w})]})]}),e===`leitner`&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{className:`p-4 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] space-y-3`,children:[(0,_.jsxs)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold flex items-center gap-1.5`,children:[(0,_.jsx)(ee,{className:`w-3 h-3 text-purple-600`}),`SPACED REPETITION PROGRESSION`]}),(0,_.jsx)(`div`,{className:`space-y-2`,children:[{state:0,label:`NEW`,color:`#3b82f6`},{state:1,label:`LEARNING`,color:`#f59e0b`},{state:2,label:`REVIEW`,color:`#10b981`},{state:3,label:`RELEARNING`,color:`#ef4444`}].map(e=>{let t=(j.fsrs_state??0)===e.state;return(0,_.jsxs)(`div`,{className:`p-2.5 border-2 border-ink-black flex items-center justify-between transition-all ${t?`bg-amber-100 shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] translate-x-1 font-bold`:`bg-slate-50 opacity-70`}`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`span`,{className:`w-5 h-5 border border-ink-black flex items-center justify-center font-arcade text-[9px] text-white font-bold`,style:{backgroundColor:e.color},children:e.state}),(0,_.jsx)(`span`,{className:`font-arcade text-[9px] text-ink-black`,children:e.label})]}),(0,_.jsx)(`div`,{className:`flex items-center gap-2`,children:t&&(0,_.jsx)(`span`,{className:`px-1.5 py-0.5 bg-emerald-500 text-white font-arcade text-[7px] border border-ink-black font-bold`,children:`CURRENT`})})]},e.state)})})]}),(0,_.jsxs)(`div`,{className:`p-4 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] space-y-3`,children:[(0,_.jsxs)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold flex items-center gap-1.5`,children:[(0,_.jsx)(c,{className:`w-3 h-3 text-emerald-600`}),`PERFORMANCE METRICS`]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,_.jsxs)(`div`,{className:`p-2.5 bg-slate-50 border border-ink-black`,children:[(0,_.jsx)(`span`,{className:`font-arcade text-[8px] text-trash-gray block uppercase`,children:`Total Reviews`}),(0,_.jsx)(`span`,{className:`font-headline-md text-lg font-bold text-ink-black`,children:j.total_attempts||0})]}),(0,_.jsxs)(`div`,{className:`p-2.5 bg-slate-50 border border-ink-black`,children:[(0,_.jsx)(`span`,{className:`font-arcade text-[8px] text-trash-gray block uppercase`,children:`Correct Recall`}),(0,_.jsx)(`span`,{className:`font-headline-md text-lg font-bold text-emerald-600`,children:j.times_correct||0})]})]}),(0,_.jsxs)(`div`,{className:`text-xs font-sans text-slate-600 pt-1`,children:[`Next Due Date:`,` `,(0,_.jsx)(`span`,{className:`font-code-mono font-bold text-ink-black`,children:j.next_review?new Date(j.next_review).toLocaleDateString():`Today`})]})]})]})]})]})};export{y as ProblemSpecPanel}; \ No newline at end of file + ...`,className:`w-full p-2.5 border-2 border-ink-black bg-[#1E293B] text-[#4ADE80] font-code-mono text-xs focus:outline-none no-scrollbar`})]}),(0,_.jsxs)(`div`,{className:`space-y-1`,children:[(0,_.jsx)(`label`,{className:`font-arcade text-[8.5px] font-bold text-trash-gray uppercase block`,children:`Intuition / How to Solve (Optional)`}),(0,_.jsx)(`textarea`,{rows:3,value:U.explanation,onChange:e=>W({...U,explanation:e.target.value}),placeholder:`Key insight, trade-offs, and state tracking notes...`,className:`w-full p-2 border-2 border-ink-black text-xs bg-[#fdf8e1] focus:outline-none focus:bg-white no-scrollbar`})]}),(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`input`,{type:`checkbox`,id:`is_optimal_solution`,checked:U.is_optimal,onChange:e=>W({...U,is_optimal:e.target.checked}),className:`w-4 h-4 border-2 border-ink-black rounded cursor-pointer accent-emerald-600`}),(0,_.jsx)(`label`,{htmlFor:`is_optimal_solution`,className:`font-arcade text-[9px] font-bold text-ink-black cursor-pointer`,children:`SET AS OPTIMAL / PRIMARY APPROACH FOR THIS PROBLEM`})]}),(0,_.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-2 border-t-2 border-dashed border-ink-black`,children:[(0,_.jsx)(`button`,{type:`button`,onClick:()=>{B(!1),H(null)},className:`px-3 py-1.5 bg-slate-100 hover:bg-slate-200 border-2 border-ink-black font-arcade text-[9px] font-bold text-ink-black cursor-pointer`,children:`CANCEL`}),(0,_.jsxs)(`button`,{type:`button`,disabled:G,onClick:he,className:`px-4 py-1.5 bg-emerald-500 hover:bg-emerald-400 border-2 border-ink-black font-arcade text-[9px] font-bold text-white shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer disabled:opacity-50 flex items-center gap-1.5`,children:[G&&(0,_.jsx)(s,{className:`w-3 h-3 animate-spin`}),(0,_.jsx)(`span`,{children:V?`UPDATE SOLUTION`:`SAVE SOLUTION`})]})]})]}):Q?(0,_.jsxs)(`div`,{className:`space-y-3.5`,children:[(0,_.jsxs)(`div`,{className:`p-4 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] space-y-3.5`,children:[(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 pb-3 border-b border-slate-200`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap min-w-0`,children:[(0,_.jsx)(`h3`,{className:`font-headline-md font-extrabold text-sm sm:text-base text-ink-black m-0 select-text break-words`,children:Q.name||`Solution ${Z+1}`}),Q.is_optimal&&(0,_.jsx)(`span`,{className:`px-2 py-0.5 bg-amber-300 border border-ink-black font-arcade text-[8px] font-bold text-ink-black shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] shrink-0`,children:`★ OPTIMAL`})]}),(0,_.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap sm:ml-auto`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,_.jsx)(`span`,{className:`font-arcade text-[8px] text-trash-gray uppercase`,children:`Pattern:`}),(0,_.jsx)(`span`,{className:`px-2 py-0.5 bg-purple-50 border border-purple-300 font-arcade text-[8.5px] text-purple-800 font-bold`,children:Q.pattern||`General Algorithm`})]}),(0,_.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,_.jsxs)(`code`,{className:`bg-[#1E293B] text-[#4ADE80] font-code-mono px-1.5 py-0.5 text-[11px] border border-ink-black font-bold`,children:[`T: `,Q.time_complexity||`O(N)`]}),(0,_.jsxs)(`code`,{className:`bg-[#1E293B] text-[#4ADE80] font-code-mono px-1.5 py-0.5 text-[11px] border border-ink-black font-bold`,children:[`S: `,Q.space_complexity||`O(1)`]})]}),(0,_.jsxs)(`div`,{className:`flex items-center gap-1 ml-auto`,children:[(0,_.jsxs)(`button`,{type:`button`,onClick:()=>{H(Q.id),B(!1),W({name:Q.name,pattern:Q.pattern,time_complexity:Q.time_complexity,space_complexity:Q.space_complexity,code:Q.code,explanation:Q.explanation||``,is_optimal:!!Q.is_optimal})},className:`px-2 py-1 bg-white hover:bg-slate-100 border border-ink-black text-ink-black font-arcade text-[8px] font-bold flex items-center gap-1 cursor-pointer`,title:`Edit this solution`,children:[(0,_.jsx)(i,{className:`w-3 h-3 text-slate-700`}),(0,_.jsx)(`span`,{className:`hidden sm:inline`,children:`EDIT`})]}),X.length>1&&(0,_.jsx)(`button`,{type:`button`,onClick:()=>ge(Q.id),className:`px-1.5 py-1 bg-white hover:bg-rose-50 border border-ink-black text-rose-700 font-arcade text-[8px] font-bold flex items-center gap-1 cursor-pointer`,title:`Delete this solution`,children:(0,_.jsx)(se,{className:`w-3 h-3`})})]})]})]}),Q.code?(0,_.jsxs)(`div`,{className:`border border-ink-black bg-[#0f172a] overflow-hidden`,children:[(0,_.jsxs)(`div`,{className:`bg-[#1e293b] px-2.5 sm:px-3 py-1.5 border-b border-ink-black flex items-center justify-between gap-1.5 flex-wrap min-w-0`,children:[(0,_.jsx)(`span`,{className:`font-arcade text-[8px] text-slate-300 font-bold uppercase truncate min-w-0 flex-1`,children:y?`PYTHON 3`:`PYTHON 3 IMPLEMENTATION`}),(0,_.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,_.jsxs)(`button`,{type:`button`,onClick:()=>pe(Q.code,Q.pattern,Q.time_complexity,Q.space_complexity),disabled:k,className:`px-2 py-0.5 bg-purple-50 hover:bg-purple-100 text-purple-800 border border-ink-black text-[9px] font-arcade font-bold flex items-center gap-1 cursor-pointer shrink-0 disabled:opacity-50 active:translate-y-0.5 transition-all`,title:`Explain this solution with AI`,children:[k?(0,_.jsx)(s,{className:`w-2.5 h-2.5 animate-spin text-purple-700`}):(0,_.jsx)(u,{className:`w-2.5 h-2.5 text-purple-600`}),(0,_.jsx)(`span`,{children:`Explain✦`})]}),(0,_.jsxs)(`button`,{onClick:()=>w(Q.code,`sol-${Q.id}`),className:`px-2 py-0.5 bg-white hover:bg-slate-100 text-ink-black border border-ink-black text-[9px] font-arcade font-bold flex items-center gap-1 cursor-pointer shrink-0 active:translate-y-0.5 transition-all`,title:`Copy solution code`,children:[(0,_.jsx)(c,{className:`w-2.5 h-2.5`}),C===`sol-${Q.id}`?`COPIED!`:`COPY`]})]})]}),(0,_.jsx)(`div`,{className:`p-3 text-xs overflow-x-auto max-h-80 no-scrollbar`,children:(0,_.jsx)(`pre`,{className:`font-code-mono text-[#4ADE80] text-[11px] leading-relaxed select-text m-0`,children:(0,_.jsx)(`code`,{children:Q.code})})})]}):(0,_.jsxs)(`div`,{className:`p-4 bg-amber-50 border border-dashed border-amber-300 text-center space-y-3`,children:[(0,_.jsx)(`p`,{className:`text-xs font-sans text-stone-700`,children:`No code implementation archived for this solution yet.`}),(0,_.jsx)(`button`,{onClick:O,disabled:E,className:`px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white font-arcade text-[9px] font-bold border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer inline-flex items-center gap-2 disabled:opacity-50`,children:E?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(s,{className:`w-3.5 h-3.5 animate-spin`}),(0,_.jsx)(`span`,{children:`Generating solution...`})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(u,{className:`w-3.5 h-3.5 text-amber-300`}),(0,_.jsx)(`span`,{children:`Generate solution`})]})}),D&&(0,_.jsx)(`div`,{className:`text-xs text-rose-600 font-medium`,children:D})]}),Q.explanation&&(0,_.jsxs)(`div`,{className:`pt-3.5 border-t border-slate-200 space-y-1.5 select-text`,children:[(0,_.jsx)(`span`,{className:`font-arcade text-[8.5px] text-trash-gray uppercase font-bold block`,children:`SOLUTION INTUITION & STRATEGY:`}),(0,_.jsx)(h,{content:Q.explanation})]})]}),Q.code&&(0,_.jsxs)(`div`,{className:`space-y-3`,children:[A&&(0,_.jsx)(`div`,{className:`p-3 border-2 border-rose-500 bg-rose-50 text-rose-800 text-xs font-semibold`,children:A}),j&&(0,_.jsxs)(`div`,{className:`p-4 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] space-y-2 select-text`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-1.5 pb-2 border-b-2 border-dashed border-ink-black`,children:[(0,_.jsx)(ae,{className:`w-4 h-4 text-purple-600`}),(0,_.jsxs)(`span`,{className:`font-arcade text-[9px] font-bold text-ink-black uppercase`,children:[`Gemini Code Breakdown (`,Q.name,`)`]})]}),(0,_.jsx)(`div`,{className:`max-h-96 overflow-y-auto no-scrollbar pt-1 select-text`,children:(0,_.jsx)(h,{content:j})})]})]})]}):null,T&&(0,_.jsxs)(`div`,{className:`p-2.5 border-2 border-rose-500 bg-rose-50 text-rose-800 text-xs font-bold flex items-center gap-2 shadow-[2px_2px_0px_0px_rgba(244,63,94,1)]`,children:[(0,_.jsx)(l,{className:`w-4 h-4 text-rose-600 shrink-0`}),(0,_.jsx)(`div`,{className:`flex-1`,children:T})]})]}),e===`leitner`&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{className:`p-4 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] space-y-3`,children:[(0,_.jsxs)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold flex items-center gap-1.5`,children:[(0,_.jsx)(ne,{className:`w-3 h-3 text-purple-600`}),`SPACED REPETITION PROGRESSION`]}),(0,_.jsx)(`div`,{className:`space-y-2`,children:[{state:0,label:`NEW`,color:`#3b82f6`},{state:1,label:`LEARNING`,color:`#f59e0b`},{state:2,label:`REVIEW`,color:`#10b981`},{state:3,label:`RELEARNING`,color:`#ef4444`}].map(e=>{let t=(M.fsrs_state??0)===e.state;return(0,_.jsxs)(`div`,{className:`p-2.5 border-2 border-ink-black flex items-center justify-between transition-all ${t?`bg-amber-100 shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] translate-x-1 font-bold`:`bg-slate-50 opacity-70`}`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`span`,{className:`w-5 h-5 border border-ink-black flex items-center justify-center font-arcade text-[9px] text-white font-bold`,style:{backgroundColor:e.color},children:e.state}),(0,_.jsx)(`span`,{className:`font-arcade text-[9px] text-ink-black`,children:e.label})]}),(0,_.jsx)(`div`,{className:`flex items-center gap-2`,children:t&&(0,_.jsx)(`span`,{className:`px-1.5 py-0.5 bg-emerald-500 text-white font-arcade text-[7px] border border-ink-black font-bold`,children:`CURRENT`})})]},e.state)})})]}),(0,_.jsxs)(`div`,{className:`p-4 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] space-y-3`,children:[(0,_.jsxs)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold flex items-center gap-1.5`,children:[(0,_.jsx)(o,{className:`w-3 h-3 text-emerald-600`}),`PERFORMANCE METRICS`]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,_.jsxs)(`div`,{className:`p-2.5 bg-slate-50 border border-ink-black`,children:[(0,_.jsx)(`span`,{className:`font-arcade text-[8px] text-trash-gray block uppercase`,children:`Total Reviews`}),(0,_.jsx)(`span`,{className:`font-headline-md text-lg font-bold text-ink-black`,children:M.total_attempts||0})]}),(0,_.jsxs)(`div`,{className:`p-2.5 bg-slate-50 border border-ink-black`,children:[(0,_.jsx)(`span`,{className:`font-arcade text-[8px] text-trash-gray block uppercase`,children:`Correct Recall`}),(0,_.jsx)(`span`,{className:`font-headline-md text-lg font-bold text-emerald-600`,children:M.times_correct||0})]})]}),(0,_.jsxs)(`div`,{className:`text-xs font-sans text-slate-600 pt-1`,children:[`Next Due Date:`,` `,(0,_.jsx)(`span`,{className:`font-code-mono font-bold text-ink-black`,children:M.next_review?new Date(M.next_review).toLocaleDateString():`Today`})]})]})]})]})]})};export{y as ProblemSpecPanel}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/PythonChallenge-BUhtEPkm.js b/algospaced-ui/dist/assets/PythonChallenge-Bh_sBh6Y.js similarity index 97% rename from algospaced-ui/dist/assets/PythonChallenge-BUhtEPkm.js rename to algospaced-ui/dist/assets/PythonChallenge-Bh_sBh6Y.js index 0ad8f3324030b9f16f747ededc503daf6a4ad48c..7a21e810dea3849adac683885f904ac42458d1b0 100644 --- a/algospaced-ui/dist/assets/PythonChallenge-BUhtEPkm.js +++ b/algospaced-ui/dist/assets/PythonChallenge-Bh_sBh6Y.js @@ -1 +1 @@ -import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Lt as t,zt as n}from"./vendor-react-qmUj3JUi.js";import{r}from"./firebaseClient-G7klkuBb.js";import{t as i}from"./MarkdownRenderer-CC5nUs7-.js";var a=e(n(),1),o=t();function s(){let[e,t]=(0,a.useState)(null),[n,s]=(0,a.useState)(``),[c,l]=(0,a.useState)(!1),[u,d]=(0,a.useState)([]),[f,p]=(0,a.useState)(``),[m,h]=(0,a.useState)(!0),[g,_]=(0,a.useState)(0),v=async()=>{h(!0),p(``);try{let{data:{session:e}}=await r.auth.getSession();if(!e){p(`Unauthenticated session`);return}let n=await fetch(`/api/challenges/python/daily`,{headers:{Authorization:`Bearer ${e.access_token}`}});if(n.ok){let e=await n.json();t(e),s(e.starter_code),_(e.total_score)}else p(`Failed to load challenge from server.`)}catch{p(`Connection timed out.`)}finally{h(!1)}};return(0,a.useEffect)(()=>{v()},[]),m?(0,o.jsxs)(`div`,{className:`w-full h-full bg-paper-white p-6 flex flex-col items-center justify-center font-arcade text-[10px]`,children:[(0,o.jsx)(`div`,{className:`animate-bounce mb-2`,children:`LOADING CHALLENGE...`}),(0,o.jsx)(`div`,{className:`w-48 h-4 bg-white border-[3px] border-ink-black overflow-hidden relative`,children:(0,o.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-[#9d4edd] w-2/3 animate-pulse border-r-2 border-ink-black`})})]}):e?(0,o.jsx)(`div`,{className:`w-full h-full bg-paper-white text-ink-black flex flex-col overflow-hidden text-xs md:text-sm`,children:(0,o.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 custom-scrollbar flex flex-col gap-4`,children:[(0,o.jsxs)(`div`,{className:`flex justify-between items-center bg-slate-100 border-[3px] border-ink-black p-3`,children:[(0,o.jsxs)(`div`,{className:`flex gap-2`,children:[(0,o.jsx)(`span`,{className:`px-2 py-0.5 border-2 border-ink-black font-bold uppercase text-[9px] ${e.difficulty===`Easy`?`bg-green-200 text-green-800`:e.difficulty===`Medium`?`bg-yellow-200 text-yellow-800`:`bg-red-200 text-red-800`}`,children:e.difficulty}),(0,o.jsxs)(`span`,{className:`bg-blue-100 text-blue-800 px-2 py-0.5 border-2 border-ink-black font-bold text-[9px]`,children:[`+`,e.points,` PTS`]}),e.completed?(0,o.jsx)(`span`,{className:`bg-emerald-500 text-white px-2 py-0.5 border-2 border-ink-black font-bold text-[9px]`,children:`COMPLETED`}):(0,o.jsx)(`span`,{className:`bg-rose-500 text-white px-2 py-0.5 border-2 border-ink-black font-bold text-[9px]`,children:`INCOMPLETE`})]}),(0,o.jsxs)(`div`,{className:`font-arcade text-[8px] text-purple-700 font-bold bg-white border-2 border-ink-black px-2 py-0.5 shadow-[1px_1px_0_0_#1E293B]`,children:[`TOTAL SCORE: `,g]})]}),(0,o.jsxs)(`div`,{className:`border-2 border-ink-black bg-slate-50 p-3 rounded font-sans leading-relaxed text-xs`,children:[(0,o.jsxs)(`h3`,{className:`font-bold border-b border-slate-300 pb-1 mb-2 uppercase tracking-wide text-primary-purple flex items-center gap-1`,children:[(0,o.jsx)(`span`,{className:`material-symbols-outlined text-sm`,children:`description`}),`Problem: `,e.title]}),(0,o.jsx)(i,{content:e.description})]}),(0,o.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-[220px]`,children:[(0,o.jsxs)(`div`,{className:`flex justify-between items-center mb-1`,children:[(0,o.jsxs)(`span`,{className:`font-bold text-[10px] tracking-wide uppercase flex items-center gap-1`,children:[(0,o.jsx)(`span`,{className:`material-symbols-outlined text-sm text-purple-600`,children:`code`}),`Write Python Solution:`]}),(0,o.jsx)(`button`,{onClick:()=>s(e.starter_code),className:`text-[9px] underline text-blue-600 hover:text-blue-800 cursor-pointer font-sans`,children:`Reset Starter Code`})]}),(0,o.jsx)(`textarea`,{value:n,onChange:e=>s(e.target.value),className:`flex-1 w-full bg-slate-900 text-[#4ADE80] font-mono p-3 border-[3px] border-ink-black rounded outline-none focus:ring-2 focus:ring-primary-purple text-xs leading-relaxed resize-none`,placeholder:`# Write your python code here`,spellCheck:`false`})]}),(0,o.jsx)(`div`,{className:`shrink-0`,children:(0,o.jsx)(`button`,{disabled:c,onClick:async()=>{l(!0),p(``),d([]);try{let{data:{session:e}}=await r.auth.getSession();if(!e){p(`Unauthenticated session`);return}let i=await fetch(`/api/challenges/python/submit`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${e.access_token}`},body:JSON.stringify({code:n})});if(i.ok){let e=await i.json();e.success?(d(e.results),e.all_passed&&(_(e.total_score),t(e=>e?{...e,completed:!0}:null))):p(e.error)}else p(`Submission failed at server host.`)}catch{p(`Network connection lost.`)}finally{l(!1)}},className:`w-full bg-highlight-pink text-white font-window-title font-bold py-2 px-4 border-[3px] border-ink-black shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none hover:bg-pink-400 transition-all disabled:opacity-50 cursor-pointer text-center text-xs`,children:c?`EXECUTING TEST CASES...`:`SUBMIT SOLUTION`})}),f&&(0,o.jsxs)(`div`,{className:`border-[3px] border-red-500 bg-red-50 text-red-800 p-3 font-mono text-xs whitespace-pre-wrap`,children:[(0,o.jsx)(`div`,{className:`font-bold mb-1`,children:`COMPILER / RUNTIME ERROR:`}),f]}),u.length>0&&(0,o.jsxs)(`div`,{className:`border-[3px] border-ink-black bg-slate-100 p-3`,children:[(0,o.jsx)(`div`,{className:`font-bold text-[10px] border-b border-slate-300 pb-1 mb-2 uppercase`,children:`Test Case Executions:`}),(0,o.jsx)(`div`,{className:`space-y-1.5 font-mono text-xs`,children:u.map((e,t)=>(0,o.jsxs)(`div`,{className:`flex flex-col p-2 border border-slate-300 bg-white`,children:[(0,o.jsxs)(`div`,{className:`flex justify-between`,children:[(0,o.jsxs)(`span`,{className:`font-bold`,children:[`Test Case `,t+1,`:`]}),(0,o.jsx)(`span`,{className:`font-bold uppercase ${e.status===`passed`?`text-green-600`:`text-red-600`}`,children:e.status})]}),(0,o.jsxs)(`div`,{className:`text-[10px] text-slate-500 mt-1`,children:[(0,o.jsxs)(`div`,{children:[`Input: `,JSON.stringify(e.input)]}),e.status===`passed`&&(0,o.jsxs)(`div`,{children:[`Output: `,JSON.stringify(e.got)]}),e.status===`failed`&&(0,o.jsxs)(`div`,{className:`text-red-700`,children:[`Expected: `,JSON.stringify(e.expected),` | Got: `,JSON.stringify(e.got)]}),e.status===`error`&&(0,o.jsxs)(`div`,{className:`text-red-700 font-semibold`,children:[`Error: `,e.error]})]})]},t))})]})]})}):(0,o.jsxs)(`div`,{className:`w-full h-full bg-paper-white p-6 flex flex-col items-center justify-center font-sans text-center gap-3`,children:[(0,o.jsx)(`span`,{className:`material-symbols-outlined text-red-500 text-4xl`,children:`error`}),(0,o.jsx)(`div`,{className:`font-bold text-ink-black text-sm`,children:f||`No active challenge found.`}),(0,o.jsx)(`button`,{onClick:v,className:`px-3 py-1.5 bg-yellow-400 hover:bg-yellow-300 border-[3px] border-ink-black text-xs font-bold font-window-title cursor-pointer shadow-[2px_2px_0px_rgba(0,0,0,1)] active:translate-y-0.5 active:shadow-none`,children:`RETRY`})]})}export{s as default}; \ No newline at end of file +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Lt as t,zt as n}from"./vendor-react-q-oOktF_.js";import{r}from"./firebaseClient-G7klkuBb.js";import{t as i}from"./MarkdownRenderer-cD9l7avV.js";var a=e(n(),1),o=t();function s(){let[e,t]=(0,a.useState)(null),[n,s]=(0,a.useState)(``),[c,l]=(0,a.useState)(!1),[u,d]=(0,a.useState)([]),[f,p]=(0,a.useState)(``),[m,h]=(0,a.useState)(!0),[g,_]=(0,a.useState)(0),v=async()=>{h(!0),p(``);try{let{data:{session:e}}=await r.auth.getSession();if(!e){p(`Unauthenticated session`);return}let n=await fetch(`/api/challenges/python/daily`,{headers:{Authorization:`Bearer ${e.access_token}`}});if(n.ok){let e=await n.json();t(e),s(e.starter_code),_(e.total_score)}else p(`Failed to load challenge from server.`)}catch{p(`Connection timed out.`)}finally{h(!1)}};return(0,a.useEffect)(()=>{v()},[]),m?(0,o.jsxs)(`div`,{className:`w-full h-full bg-paper-white p-6 flex flex-col items-center justify-center font-arcade text-[10px]`,children:[(0,o.jsx)(`div`,{className:`animate-bounce mb-2`,children:`LOADING CHALLENGE...`}),(0,o.jsx)(`div`,{className:`w-48 h-4 bg-white border-[3px] border-ink-black overflow-hidden relative`,children:(0,o.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-[#9d4edd] w-2/3 animate-pulse border-r-2 border-ink-black`})})]}):e?(0,o.jsx)(`div`,{className:`w-full h-full bg-paper-white text-ink-black flex flex-col overflow-hidden text-xs md:text-sm`,children:(0,o.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 custom-scrollbar flex flex-col gap-4`,children:[(0,o.jsxs)(`div`,{className:`flex justify-between items-center bg-slate-100 border-[3px] border-ink-black p-3`,children:[(0,o.jsxs)(`div`,{className:`flex gap-2`,children:[(0,o.jsx)(`span`,{className:`px-2 py-0.5 border-2 border-ink-black font-bold uppercase text-[9px] ${e.difficulty===`Easy`?`bg-green-200 text-green-800`:e.difficulty===`Medium`?`bg-yellow-200 text-yellow-800`:`bg-red-200 text-red-800`}`,children:e.difficulty}),(0,o.jsxs)(`span`,{className:`bg-blue-100 text-blue-800 px-2 py-0.5 border-2 border-ink-black font-bold text-[9px]`,children:[`+`,e.points,` PTS`]}),e.completed?(0,o.jsx)(`span`,{className:`bg-emerald-500 text-white px-2 py-0.5 border-2 border-ink-black font-bold text-[9px]`,children:`COMPLETED`}):(0,o.jsx)(`span`,{className:`bg-rose-500 text-white px-2 py-0.5 border-2 border-ink-black font-bold text-[9px]`,children:`INCOMPLETE`})]}),(0,o.jsxs)(`div`,{className:`font-arcade text-[8px] text-purple-700 font-bold bg-white border-2 border-ink-black px-2 py-0.5 shadow-[1px_1px_0_0_#1E293B]`,children:[`TOTAL SCORE: `,g]})]}),(0,o.jsxs)(`div`,{className:`border-2 border-ink-black bg-slate-50 p-3 rounded font-sans leading-relaxed text-xs`,children:[(0,o.jsxs)(`h3`,{className:`font-bold border-b border-slate-300 pb-1 mb-2 uppercase tracking-wide text-primary-purple flex items-center gap-1`,children:[(0,o.jsx)(`span`,{className:`material-symbols-outlined text-sm`,children:`description`}),`Problem: `,e.title]}),(0,o.jsx)(i,{content:e.description})]}),(0,o.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-[220px]`,children:[(0,o.jsxs)(`div`,{className:`flex justify-between items-center mb-1`,children:[(0,o.jsxs)(`span`,{className:`font-bold text-[10px] tracking-wide uppercase flex items-center gap-1`,children:[(0,o.jsx)(`span`,{className:`material-symbols-outlined text-sm text-purple-600`,children:`code`}),`Write Python Solution:`]}),(0,o.jsx)(`button`,{onClick:()=>s(e.starter_code),className:`text-[9px] underline text-blue-600 hover:text-blue-800 cursor-pointer font-sans`,children:`Reset Starter Code`})]}),(0,o.jsx)(`textarea`,{value:n,onChange:e=>s(e.target.value),className:`flex-1 w-full bg-slate-900 text-[#4ADE80] font-mono p-3 border-[3px] border-ink-black rounded outline-none focus:ring-2 focus:ring-primary-purple text-xs leading-relaxed resize-none`,placeholder:`# Write your python code here`,spellCheck:`false`})]}),(0,o.jsx)(`div`,{className:`shrink-0`,children:(0,o.jsx)(`button`,{disabled:c,onClick:async()=>{l(!0),p(``),d([]);try{let{data:{session:e}}=await r.auth.getSession();if(!e){p(`Unauthenticated session`);return}let i=await fetch(`/api/challenges/python/submit`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${e.access_token}`},body:JSON.stringify({code:n})});if(i.ok){let e=await i.json();e.success?(d(e.results),e.all_passed&&(_(e.total_score),t(e=>e?{...e,completed:!0}:null))):p(e.error)}else p(`Submission failed at server host.`)}catch{p(`Network connection lost.`)}finally{l(!1)}},className:`w-full bg-highlight-pink text-white font-window-title font-bold py-2 px-4 border-[3px] border-ink-black shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none hover:bg-pink-400 transition-all disabled:opacity-50 cursor-pointer text-center text-xs`,children:c?`EXECUTING TEST CASES...`:`SUBMIT SOLUTION`})}),f&&(0,o.jsxs)(`div`,{className:`border-[3px] border-red-500 bg-red-50 text-red-800 p-3 font-mono text-xs whitespace-pre-wrap`,children:[(0,o.jsx)(`div`,{className:`font-bold mb-1`,children:`COMPILER / RUNTIME ERROR:`}),f]}),u.length>0&&(0,o.jsxs)(`div`,{className:`border-[3px] border-ink-black bg-slate-100 p-3`,children:[(0,o.jsx)(`div`,{className:`font-bold text-[10px] border-b border-slate-300 pb-1 mb-2 uppercase`,children:`Test Case Executions:`}),(0,o.jsx)(`div`,{className:`space-y-1.5 font-mono text-xs`,children:u.map((e,t)=>(0,o.jsxs)(`div`,{className:`flex flex-col p-2 border border-slate-300 bg-white`,children:[(0,o.jsxs)(`div`,{className:`flex justify-between`,children:[(0,o.jsxs)(`span`,{className:`font-bold`,children:[`Test Case `,t+1,`:`]}),(0,o.jsx)(`span`,{className:`font-bold uppercase ${e.status===`passed`?`text-green-600`:`text-red-600`}`,children:e.status})]}),(0,o.jsxs)(`div`,{className:`text-[10px] text-slate-500 mt-1`,children:[(0,o.jsxs)(`div`,{children:[`Input: `,JSON.stringify(e.input)]}),e.status===`passed`&&(0,o.jsxs)(`div`,{children:[`Output: `,JSON.stringify(e.got)]}),e.status===`failed`&&(0,o.jsxs)(`div`,{className:`text-red-700`,children:[`Expected: `,JSON.stringify(e.expected),` | Got: `,JSON.stringify(e.got)]}),e.status===`error`&&(0,o.jsxs)(`div`,{className:`text-red-700 font-semibold`,children:[`Error: `,e.error]})]})]},t))})]})]})}):(0,o.jsxs)(`div`,{className:`w-full h-full bg-paper-white p-6 flex flex-col items-center justify-center font-sans text-center gap-3`,children:[(0,o.jsx)(`span`,{className:`material-symbols-outlined text-red-500 text-4xl`,children:`error`}),(0,o.jsx)(`div`,{className:`font-bold text-ink-black text-sm`,children:f||`No active challenge found.`}),(0,o.jsx)(`button`,{onClick:v,className:`px-3 py-1.5 bg-yellow-400 hover:bg-yellow-300 border-[3px] border-ink-black text-xs font-bold font-window-title cursor-pointer shadow-[2px_2px_0px_rgba(0,0,0,1)] active:translate-y-0.5 active:shadow-none`,children:`RETRY`})]})}export{s as default}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/ReviewQueue-C250a4ib.js b/algospaced-ui/dist/assets/ReviewQueue-C250a4ib.js deleted file mode 100644 index e0c4d9dfec59c30e6ef8561d74ad1c9856474f82..0000000000000000000000000000000000000000 --- a/algospaced-ui/dist/assets/ReviewQueue-C250a4ib.js +++ /dev/null @@ -1,5 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProblemSpecPanel-Df-cRYRz.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-react-qmUj3JUi.js","assets/vendor-codemirror-By0wlJeM.js","assets/index-DYMSjoUb.js","assets/firebaseClient-G7klkuBb.js","assets/vendor-firebase-DSIO3PIf.js","assets/vendor-ui-ZXcm-2wU.js","assets/index-supjX07i.css","assets/MarkdownRenderer-CC5nUs7-.js"])))=>i.map(i=>d[i]); -import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{A as n,Ct as r,E as i,J as a,Lt as o,M as s,N as c,O as l,Q as u,St as d,Z as f,d as p,dt as m,ft as h,gt as g,it as _,o as v,ot as y,p as b,t as ee,tt as x,u as S,ut as C,vt as w,y as T,yt as E,zt as D}from"./vendor-react-qmUj3JUi.js";import{r as O}from"./firebaseClient-G7klkuBb.js";import{b as k,c as A,n as j,o as M,r as N,s as P,t as te}from"./index-DYMSjoUb.js";import{o as F,r as I}from"./githubSyncService-DQdE4J2L.js";import{t as L}from"./confetti.module-Uxh4CK4s.js";import R from"./OnboardingModal-hhKaj0In.js";import"./MarkdownRenderer-CC5nUs7-.js";import"./PrincessChamber-IJaaUuL1.js";import{A as z,C as ne,I as B,S as V,p as H,t as re,x as ie,y as ae}from"./vendor-codemirror-By0wlJeM.js";var U=t(D(),1),W=o();function oe(e){if(!e)return{description:``,examples:[],constraints:[]};let t=e.description||``,n=[],r=[];if(Array.isArray(e.examples)&&e.examples.length>0&&(n=e.examples.map(e=>typeof e==`string`?{input:e,output:``}:{input:e?.input||``,output:e?.output||``,explanation:e?.explanation||``})),Array.isArray(e.constraints)&&e.constraints.length>0?r=e.constraints.map(e=>String(e).replace(/^[\u2022\-*]\s*/,``).trim()).filter(Boolean):typeof e.constraints==`string`&&e.constraints.trim()&&(r=e.constraints.split(` -`).map(e=>e.replace(/^[\u2022\-*]\s*/,``).trim()).filter(Boolean)),n.length===0||r.length===0){let e=t.search(/\bExample\s*\d*:/i),i=t.search(/\bConstraints\s*:/i),a=-1;if(e!==-1&&i!==-1?a=Math.min(e,i):e===-1?i!==-1&&(a=i):a=e,a!==-1){let e=t.substring(0,a).trim(),i=t.substring(a),o=i,s=``,c=i.search(/\bConstraints\s*:/i);if(c!==-1&&(o=i.substring(0,c).trim(),s=i.substring(c).replace(/\bConstraints\s*:/i,``).trim()),n.length===0&&o){let e=/\bExample\s*(\d*)\s*:/gi,t=[],r;for(;(r=e.exec(o))!==null;)t.push({index:r.index,text:r[0]});for(let e=0;ee.replace(/^[\u2022\-*]\s*/,``).trim()).filter(Boolean)),(n.length>0||r.length>0)&&(t=e)}}return{description:t,examples:n,constraints:r}}function se(e,t,n,r){let i=e=>!e||/^Method\s*\d*$/i.test(e.trim())||e.trim().toLowerCase()===`standard`,a=(e||t||`Algorithm Problem`).trim(),o=null;if(t&&a.toLowerCase().startsWith(t.toLowerCase())){let e=a.slice(t.length).trim();if(a=t,e){let t=e.match(/^[-\s]*Method\s*(\d+)\s*\((.+)\)$/i);if(t){let e=parseInt(t[1],10),n=t[2].trim();i(n)?e>1&&(o=`Method ${e}`):o=n}else{let t=e.match(/^[-\s]*Method\s*(\d+)/i);if(t){let e=parseInt(t[1],10);e>1&&(o=`Method ${e}`)}else{let t=e.match(/^[-\s]*\((.+)\)$/);if(t){let e=t[1].trim();i(e)||(o=e)}else{let t=e.match(/^[-\s]+([^-]+)$/);t&&!i(t[1])&&(o=t[1].trim())}}}}}else{let e=a.match(/^(.*?)\s*-\s*Method\s*(\d+)\s*\((.+)\)$/i);if(e){a=e[1].trim();let t=parseInt(e[2],10),n=e[3].trim();i(n)?t>1&&(o=`Method ${t}`):o=n}else{let e=a.match(/^(.*?)\s*-\s*Method\s*(\d+)$/i);if(e){a=e[1].trim();let t=parseInt(e[2],10);t>1&&(o=`Method ${t}`)}else{let e=a.match(/^(.*?)\s*\(\s*Method\s*(\d+)\s*\)$/i);if(e){a=e[1].trim();let t=parseInt(e[2],10);t>1&&(o=`Method ${t}`)}}}}let s=`General Algorithm`;return i(n)?i(r)?o&&!i(o)&&(s=o):s=r.trim():s=n.trim(),{cleanTitle:a,approachVariant:o,pattern:s}}function ce(e,t,n){if(!e)return[];if(Array.isArray(e.solutions)&&e.solutions.length>0)return e.solutions;let r=[],i=t||e.reference_code||``,a=e.pattern||`General Algorithm`,o=e.optimal_time||`O(N)`,s=e.optimal_space||`O(1)`;return(i||a)&&r.push({id:`sol-1`,name:e.approach_variant||`Optimal Solution`,pattern:a,time_complexity:o,space_complexity:s,code:i,explanation:e.how_to_solve||``,is_optimal:!0}),n&&n.trim()&&n.trim()!==i.trim()&&r.push({id:`sol-2`,name:`Personal Solution`,pattern:a,time_complexity:o,space_complexity:s,code:n,is_optimal:!1}),r}function le({overrideProblemId:e,refreshTrigger:t,onClearOverride:n,onOpenOnboarding:r,setIsOnboardingOpen:i}){let[a,o]=(0,U.useState)([]),[s,c]=(0,U.useState)(!0),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(null),[p,m]=(0,U.useState)(null),[h,g]=(0,U.useState)(``),[_,v]=(0,U.useState)(null),[y,b]=(0,U.useState)(!1),[ee,x]=(0,U.useState)(void 0),S=(0,U.useRef)(!1),C=(0,U.useRef)(r),w=(0,U.useRef)(i),T=(0,U.useRef)(n),E=(0,U.useRef)(!1);(0,U.useEffect)(()=>{C.current=r,w.current=i,T.current=n});let D=(0,U.useCallback)(()=>{C.current?C.current():w.current&&w.current(!0)},[]),j=(0,U.useCallback)(async(t=!0)=>{t?(c(!0),m(null),g(``),S.current=!1):m(null);try{let{data:{session:n}}=await O.auth.getSession(),r=n?n.access_token:`sandbox`;n?.user?.id&&x(n.user.id);let i={Authorization:`Bearer ${r}`},a=await fetch(`/api/reviews/due`,{headers:i}),s=a.ok?await a.json():[];if(Array.isArray(s)||(s=[]),e){let t=String(e).trim().toLowerCase(),n=s.findIndex(e=>{let n=e.problems;return!!(e.problem_id&&String(e.problem_id).trim().toLowerCase()===t||n?.id&&String(n.id).trim().toLowerCase()===t||n?.problem_number!==void 0&&n?.problem_number!==null&&String(n.problem_number)===t||n?.name&&n.name.trim().toLowerCase()===t)});if(n>0){let[e]=s.splice(n,1);s.unshift(e)}else if(n===-1){let t=null,n=await fetch(`/api/reviews/problems/id/${e}`,{headers:i});if(n.ok){let e=await n.json();Array.isArray(e)&&e.length>0&&(t=e[0])}if(!t){let n=/^\d+$/.test(e),r=N(n?parseInt(e,10):void 0,e);if(r)try{let e=await A(r);if(e?.problem_id){let n=await fetch(`/api/reviews/problems/id/${e.problem_id}`,{headers:i});if(n.ok){let e=await n.json();Array.isArray(e)&&e.length>0&&(t=e[0])}}}catch(e){console.error(`Failed to auto-activate problem for override review:`,e)}}t&&s.unshift(t)}}o(s);let c=n?.user?.id,l=c===`sandbox-user-id`||!c?`sandbox`:c;if(!localStorage.getItem(`algospaced_onboarding_done_${l}`)&&!e&&D(),s&&s.length>0){if(t){let e=s[0],t=e.problems,n=t?.problem_number??(/^\d+$/.test(e?.problem_id||``)?parseInt(e.problem_id,10):void 0),r=N(n,t?.id||e?.problem_id,t?.name)?.starter_code||t?.starter_code||``;g(r)}}else try{let e=await fetch(`/api/journey-progress`,{headers:i});if(e.ok){let t=await e.json();v(P(new Set(t))??null)}else v(P(new Set)??null)}catch{v(P(new Set)??null)}}catch(e){console.error(`Error fetching review queue:`,e)}finally{c(!1)}},[e,D]);(0,U.useEffect)(()=>{if(E.current){E.current=!1;return}let e=!1,t=setTimeout(()=>{e||j(!0)},0);return()=>{e=!0,clearTimeout(t)}},[j,t]),(0,U.useEffect)(()=>{if(!s&&a.length===0&&!e&&!S.current){S.current=!0;try{L({particleCount:90,spread:70,origin:{y:.6}})}catch{}}},[s,a.length,e]);let M=(0,U.useCallback)(async t=>{if(a.length===0||l)return;let n=a[0];if(!n||!n.id)return;u(!0),f(t),m(null);let r=[...a];try{let{data:{session:i}}=await O.auth.getSession(),a=i?i.access_token:`sandbox`,s=await fetch(`/api/reviews/complete`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${a}`},body:JSON.stringify({review_id:n.id,fsrs_state:n.fsrs_state??0,fsrs_stability:n.fsrs_stability??0,fsrs_difficulty:n.fsrs_difficulty??0,fsrs_elapsed_days:n.fsrs_elapsed_days??0,fsrs_scheduled_days:n.fsrs_scheduled_days??0,fsrs_reps:n.fsrs_reps??0,fsrs_lapses:n.fsrs_lapses??0,last_reviewed:n.last_reviewed,rating:t})});if(s.ok){let r=n?.problems?.name||``,i=n?.problems?.pattern||``,a=`Correct`;a=t===1?`Incorrect`:t===2?`Mixed`:`Correct`,k.addReviewEvent(a,r,i).catch(()=>{});let s=I(),c=h.trim()||n?.problems?.reference_code||``;s.token&&s.repoName&&s.autoCommit&&c&&F({token:s.token,repo:s.repoName,branch:s.branch,problem_number:n?.problems?.problem_number,problem_name:r||`Algorithm Problem`,pattern:i||`Algorithms`,difficulty:n?.problems?.difficulty||`Medium`,optimal_time:n?.problems?.optimal_time||`O(N)`,optimal_space:n?.problems?.optimal_space||`O(1)`,description:n?.problems?.description||``,code:c}).catch(e=>{console.warn(`GitHub background auto-commit failed:`,e)}),e&&T.current&&(E.current=!0,T.current()),o(e=>{let t=e.slice(1);if(t.length>0){let e=t[0],n=e.problems,r=n?.problem_number??(/^\d+$/.test(e?.problem_id||``)?parseInt(e.problem_id,10):void 0),i=N(r,n?.id||e?.problem_id,n?.name)?.starter_code||n?.starter_code||``;g(i)}else g(``);return t}),j(!1)}else{let e=await s.json().catch(()=>({}));m(e.detail||`Server returned error (${s.status}). Please try again.`),o(r)}}catch(e){console.error(`Error logging review completion:`,e);let t=e instanceof Error?e.message:`Network connection failed while logging review.`;m(t),o(r)}finally{u(!1),f(null)}},[a,l,e,j,h]),te=(0,U.useCallback)(async()=>{if(_&&!y){b(!0);try{await A(_),await j()}catch(e){console.error(`Failed to activate next milestone:`,e)}finally{b(!1)}}},[_,y,j]),R=(0,U.useCallback)(()=>{let e=a[0],t=e?.problems,n=t?.problem_number??(/^\d+$/.test(e?.problem_id||``)?parseInt(e.problem_id,10):void 0),r=N(n,t?.id||e?.problem_id,t?.name)?.starter_code||t?.starter_code||``;g(r)},[a]);return{reviews:a,setReviews:o,loading:s,submitting:l,submittingRating:d,gradeError:p,setGradeError:m,code:h,setCode:g,nextMilestone:_,activatingMilestone:y,currentUserId:ee,fetchQueue:j,handleGrade:M,handleSelectCard:(0,U.useCallback)(t=>{if(t<=0||t>=a.length||l)return;e&&T.current&&(E.current=!0,T.current());let n=a[t];if(!n)return;let r=n.problems,i=r?.problem_number??(/^\d+$/.test(n?.problem_id||``)?parseInt(n.problem_id,10):void 0),s=N(i,r?.id||n?.problem_id,r?.name)?.starter_code||r?.starter_code||``;g(s),o(e=>{let t=e.findIndex(e=>e.id&&e.id===n.id||e===n);return t<=0?e:[e[t],...e.slice(0,t),...e.slice(t+1)]})},[a,l,e]),handleActivateNextMilestone:te,handleResetStarterCode:R}}function ue(){return{sandboxRunning:j(e=>e.sandboxRunning),sandboxResults:j(e=>e.sandboxResults),sandboxError:j(e=>e.sandboxError),savingReference:j(e=>e.savingReference),savedRefSuccess:j(e=>e.savedRefSuccess),saveRefError:j(e=>e.saveRefError),handleRunSandbox:j(e=>e.handleRunSandbox),handleSaveReference:j(e=>e.handleSaveReference),resetSandbox:j(e=>e.resetSandbox)}}function de(){return{aiLoading:j(e=>e.aiLoading),aiResult:j(e=>e.aiResult),aiError:j(e=>e.aiError),explainLoading:j(e=>e.explainLoading),explanationText:j(e=>e.explanationText),explainError:j(e=>e.explainError),aiSolutionLoading:j(e=>e.aiSolutionLoading),aiSolutionError:j(e=>e.aiSolutionError),handleAiEvaluation:j(e=>e.handleAiEvaluation),handleExplainCode:j(e=>e.handleExplainCode),handleFetchAiSolution:j(e=>e.handleFetchAiSolution),resetAiState:j(e=>e.resetAiState)}}var fe=({problem:e,totalInQueue:t,reviews:n=[],onSelectCard:r,onOpenCreateProblem:i,onOpenEditProblem:a})=>{let[o,l]=(0,U.useState)(!1),u=(0,U.useRef)(null);(0,U.useEffect)(()=>{let e=e=>{u.current&&!u.current.contains(e.target)&&l(!1)},t=e=>{e.key===`Escape`&&l(!1)};return o&&(document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t)),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[o]);let d=e.problem_number?`https://leetcode.com/problemset/all/?search=${e.problem_number}`:`https://leetcode.com/problemset/all/?search=${encodeURIComponent(e.name||``)}`;return(0,W.jsxs)(`div`,{className:`shrink-0 bg-paper-white border-b-[3px] border-ink-black px-2.5 sm:px-4 py-2 flex flex-wrap items-center justify-between gap-2 shadow-[0_2px_0_0_rgba(30,41,59,0.05)] relative z-40`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 sm:gap-2 flex-wrap min-w-0`,children:[(0,W.jsxs)(`div`,{className:`relative shrink-0`,ref:u,children:[(0,W.jsxs)(`button`,{onClick:()=>l(e=>!e),className:`h-7 inline-flex items-center gap-1.5 px-2 sm:px-2.5 bg-amber-300 hover:bg-amber-200 border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer shrink-0`,title:`Click to view all cards due in today's queue`,children:[(0,W.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-emerald-500 animate-ping shrink-0`}),(0,W.jsx)(`span`,{className:`font-arcade text-[8px] sm:text-[9px] font-bold text-ink-black tracking-wide whitespace-nowrap`,children:`CARD 1 OF ${t}`}),t>1&&(0,W.jsx)(w,{className:`w-3 h-3 text-ink-black transition-transform shrink-0 ${o?`rotate-180`:``}`})]}),o&&n.length>0&&(0,W.jsxs)(`div`,{className:`absolute top-9 left-0 z-50 w-64 min-[400px]:w-72 sm:w-80 bg-paper-white border-[3px] border-ink-black gadget-shadow p-3 space-y-2 max-w-[calc(100vw-32px)]`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between border-b-2 border-ink-black pb-1.5 font-arcade text-[9px] font-bold text-ink-black`,children:[(0,W.jsx)(`span`,{children:`DAILY QUEUE (${n.length} CARDS)`}),(0,W.jsx)(`button`,{onClick:()=>l(!1),className:`px-1 hover:text-rose-600 font-bold cursor-pointer`,title:`Close`,children:`✕`})]}),(0,W.jsx)(`div`,{className:`text-[7.5px] font-arcade text-trash-gray uppercase -mt-0.5`,children:`Click any card to solve it now:`}),(0,W.jsx)(`div`,{className:`max-h-60 overflow-y-auto no-scrollbar space-y-1.5 pr-1`,children:n.map((e,t)=>{let n=e.problems,i=n?.problem_number,a=i==null?void 0:M(i),{cleanTitle:o,approachVariant:c}=se(n?.name||``,a?.name),u=c?`${o} (${c})`:o,d=t===0,f=n?.difficulty,p=f?f.toUpperCase():`EASY`,m=f===`Easy`?`bg-emerald-600 text-white`:f===`Medium`?`bg-amber-400 text-ink-black`:`bg-rose-600 text-white`;return(0,W.jsxs)(`button`,{type:`button`,onClick:()=>{d||r?.(t),l(!1)},className:`group w-full text-left p-2 border-2 border-ink-black text-xs flex items-center justify-between gap-2 cursor-pointer transition-all duration-150 select-none ${d?`bg-amber-100 font-bold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`:`bg-white hover:bg-amber-50 hover:translate-x-0.5 active:translate-y-0.5 active:shadow-none shadow-[2px_2px_0px_0px_rgba(30,41,59,0.25)]`}`,title:d?`Currently active card`:`Jump to #${t+1}: ${u}`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 truncate min-w-0`,children:[(0,W.jsxs)(`span`,{className:`font-arcade text-[9px] text-trash-gray shrink-0`,children:[`#`,t+1]}),i!=null&&(0,W.jsxs)(`span`,{className:`font-arcade text-[8px] font-bold px-1 py-0.2 bg-amber-300 border border-ink-black shrink-0`,children:[`LC #`,i]}),(0,W.jsx)(`span`,{className:`truncate`,children:u})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[d?(0,W.jsx)(`span`,{className:`text-[7.5px] font-arcade font-extrabold px-1 py-0.5 bg-amber-300 text-ink-black border border-ink-black shrink-0`,children:`NOW`}):(0,W.jsx)(s,{className:`w-2.5 h-2.5 fill-ink-black text-ink-black opacity-0 group-hover:opacity-100 transition-opacity shrink-0`}),(0,W.jsx)(`span`,{className:`text-[8px] font-arcade font-bold px-1.5 py-0.5 border border-ink-black shrink-0 ${m}`,children:p})]})]},e.id||t)})})]})]}),e.problem_number!==void 0&&e.problem_number!==null&&(0,W.jsx)(`span`,{className:`h-7 inline-flex items-center px-2 font-arcade text-[8px] sm:text-[9px] font-bold bg-amber-200 border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] text-ink-black shrink-0 select-none whitespace-nowrap`,children:e.problem_number>0?`LC #${e.problem_number}`:`CUSTOM`}),(0,W.jsx)(`span`,{className:`h-7 inline-flex items-center px-2 font-arcade text-[8px] sm:text-[9px] font-bold border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] shrink-0 select-none whitespace-nowrap ${e.difficulty===`Easy`?`bg-emerald-600 text-white`:e.difficulty===`Medium`?`bg-amber-400 text-ink-black`:`bg-rose-600 text-white`}`,children:e.difficulty?e.difficulty.toUpperCase():`EASY`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 sm:gap-2 shrink-0 flex-wrap justify-end`,children:[(0,W.jsxs)(`button`,{onClick:i,className:`h-7 inline-flex items-center gap-1 px-2 sm:px-2.5 bg-white hover:bg-purple-50 border-2 border-ink-black text-ink-black text-[8px] sm:text-[9px] font-arcade font-bold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer shrink-0`,title:`Create or Import Problem`,children:[(0,W.jsx)(m,{className:`w-3 h-3 text-purple-600 shrink-0`}),(0,W.jsx)(`span`,{className:`hidden min-[480px]:inline`,children:`ADD`})]}),a&&(0,W.jsxs)(`button`,{onClick:a,className:`h-7 inline-flex items-center gap-1 px-2 sm:px-2.5 bg-white hover:bg-emerald-50 border-2 border-ink-black text-ink-black text-[8px] sm:text-[9px] font-arcade font-bold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer shrink-0`,title:`Edit Problem Specification`,children:[(0,W.jsx)(c,{className:`w-3 h-3 text-emerald-600 shrink-0`}),(0,W.jsx)(`span`,{className:`hidden min-[480px]:inline`,children:`EDIT`})]}),e.google_doc_url&&(0,W.jsxs)(`a`,{href:e.google_doc_url,target:`_blank`,rel:`noreferrer`,className:`h-7 inline-flex items-center gap-1 px-2 sm:px-2.5 bg-white hover:bg-slate-100 border-2 border-ink-black text-ink-black text-[8px] sm:text-[9px] font-arcade font-bold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer shrink-0`,title:`Open Google Doc Notes`,children:[(0,W.jsx)(`span`,{children:`DOC`}),(0,W.jsx)(x,{className:`w-2.5 h-2.5 text-primary shrink-0`})]}),(0,W.jsxs)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,className:`h-7 inline-flex items-center gap-1 px-2 sm:px-2.5 bg-white hover:bg-slate-100 border-2 border-ink-black text-ink-black text-[8px] sm:text-[9px] font-arcade font-bold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer shrink-0`,title:`Search LeetCode`,children:[(0,W.jsx)(`span`,{children:`LC`}),(0,W.jsx)(x,{className:`w-2.5 h-2.5 text-amber-600 shrink-0`})]})]})]})},pe=ie.mark({class:`cm-indent-dot cm-indent-dot-primary`}),me=ie.mark({class:`cm-indent-dot cm-indent-dot-secondary`});function G(e){let t=new B;for(let{from:n,to:r}of e.visibleRanges){let i=n;for(;ie.decorations}),ge=V.theme({"&":{backgroundColor:`#0c111d`,color:`#f1f5f9`,height:`100%`,fontSize:`13px`,fontFamily:`var(--font-code, "JetBrains Mono", "Fira Code", monospace)`},".cm-scroller":{overflow:`auto`,fontFamily:`inherit`,lineHeight:`1.65`},".cm-content":{caretColor:`#4ade80`,padding:`12px 0`},"&.cm-focused .cm-cursor":{borderLeftColor:`#4ade80`,borderLeftWidth:`2px`,filter:`drop-shadow(0 0 5px rgba(74, 222, 128, 0.8))`},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:`rgba(56, 189, 248, 0.25) !important`},".cm-gutters":{backgroundColor:`#070a12`,color:`#475569`,borderRight:`2px solid #1e293b`,paddingRight:`6px`,userSelect:`none`},".cm-activeLineGutter":{backgroundColor:`#131b2e`,color:`#38bdf8`,fontWeight:`700`},".cm-activeLine, &.cm-focused .cm-activeLine":{backgroundColor:`#0f172a !important`},".cm-line":{padding:`0 10px`},".cm-indent-dot":{position:`relative`,display:`inline-block`},".cm-indent-dot::before":{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,pointerEvents:`none`,userSelect:`none`,lineHeight:`0`,fontFamily:`monospace`},".cm-indent-dot-primary::before":{content:`"•"`,color:`#38bdf8`,fontSize:`9px`,opacity:`0.85`},".cm-indent-dot-secondary::before":{content:`"·"`,color:`#64748b`,fontSize:`11px`,opacity:`0.5`},"&.cm-focused .cm-matchingBracket, .cm-matchingBracket":{backgroundColor:`rgba(74, 222, 128, 0.2)`,outline:`1px solid #4ade80`,borderRadius:`2px`,color:`#86efac !important`},".cm-placeholder":{color:`#64748b`,fontStyle:`italic`},".cm-scroller::-webkit-scrollbar":{width:`6px`,height:`6px`},".cm-scroller::-webkit-scrollbar-track":{backgroundColor:`#070a12`},".cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:`#1e293b`,borderRadius:`3px`,border:`1px solid #334155`},".cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:`#38bdf8`}}),K=[re(),ae.of(` `),z.of([H]),he,ge,V.contentAttributes.of({"aria-label":`Python Code Editor`})],_e=[{id:`python`,name:`Python`,version:`3.14`}],ve=({className:e=`w-3.5 h-3.5`})=>(0,W.jsxs)(`svg`,{viewBox:`0 0 128 128`,className:e,xmlns:`http://www.w3.org/2000/svg`,children:[(0,W.jsx)(`path`,{d:`M63.454 4.018c-14.775 0-23.774 6.425-23.774 18.775v13.626h24.168v3.424H30.082C17.518 39.843 8 47.962 8 63.673c0 15.65 8.358 23.486 21.056 23.486h11.905v-16.89c0-13.064 11.233-24.113 24.331-24.113h23.773V32.793c0-11.83-9.988-19.775-23.773-19.775H63.454v-9zm-9.845 7.426a3.84 3.84 0 0 1 3.86 3.84 3.84 3.84 0 0 1-3.86 3.841 3.84 3.84 0 0 1-3.86-3.84 3.84 3.84 0 0 1 3.86-3.841z`,fill:`#387eb8`}),(0,W.jsx)(`path`,{d:`M64.546 123.982c14.775 0 23.774-6.425 23.774-18.775V91.581H64.152v-3.424h33.766c12.564 0 22.082-8.119 22.082-23.83 0-15.65-8.358-23.486-21.056-23.486H87.04v16.89c0 13.064-11.234 24.113-24.332 24.113H38.934v13.363c0 11.83 9.989 19.775 23.774 19.775h1.838v9zm9.845-7.426a3.84 3.84 0 0 1-3.86-3.84 3.84 3.84 0 0 1 3.86-3.841 3.84 3.84 0 0 1 3.86 3.84 3.84 3.84 0 0 1-3.86 3.841z`,fill:`#ffe052`})]}),ye=({mobileView:e,isNarrow:t=!1,isAutocompleteEnabled:o,onToggleAutocomplete:c,onResetStarterCode:u,code:d,onChangeCode:m,sandboxRunning:g,sandboxError:_,sandboxResults:v,onRunSandbox:y,savingReference:S,savedRefSuccess:D,saveRefError:O,onSaveReference:k,aiLoading:A,aiError:j,aiResult:M,onAiEvaluation:N,optimalTime:P,optimalSpace:te,onPushToGitHub:F,pushingToGitHub:I,githubPushedUrl:L,githubPushError:R})=>{let[z,ne]=(0,U.useState)(`python`),[B,V]=(0,U.useState)(!1),H=(0,U.useRef)(null);(0,U.useEffect)(()=>{let e=e=>{H.current&&!H.current.contains(e.target)&&V(!1)},t=e=>{e.key===`Escape`&&V(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[]);let re=_e.find(e=>e.id===z)??_e[0];return(0,W.jsxs)(`div`,{className:`w-full ${t?`flex flex-1`:`lg:w-[51%] flex`} flex-col bg-[#fffdfa] overflow-y-auto no-scrollbar ${t&&e!==`code`?`hidden`:`flex`}`,children:[(0,W.jsxs)(`div`,{className:`shrink-0 bg-[#f7f5ed] border-b-2 border-ink-black p-2 sm:px-3 flex flex-wrap items-center justify-between gap-1.5 sm:gap-2`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 sm:gap-2 flex-wrap`,children:[(0,W.jsxs)(`div`,{className:`relative`,ref:H,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>V(e=>!e),className:`h-7 px-2.5 bg-white hover:bg-slate-100 border-2 border-ink-black shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none flex items-center gap-1.5 font-arcade text-[9px] font-bold text-ink-black cursor-pointer transition-all select-none`,title:`Select programming language`,"aria-expanded":B,"aria-haspopup":`listbox`,children:[(0,W.jsx)(ve,{className:`w-3.5 h-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:re.name}),(0,W.jsx)(w,{className:`w-3 h-3 text-ink-black transition-transform duration-150 ${B?`rotate-180`:``}`})]}),B&&(0,W.jsxs)(`div`,{className:`absolute top-full mt-1.5 left-0 z-50 w-52 bg-paper-white border-[3px] border-ink-black gadget-shadow p-1.5 space-y-1`,role:`listbox`,children:[(0,W.jsx)(`div`,{className:`px-2 py-1 text-[8px] font-arcade font-bold text-trash-gray uppercase border-b border-slate-200`,children:`SELECT LANGUAGE`}),_e.map(e=>{let t=z===e.id;return(0,W.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t,onClick:()=>{ne(e.id),V(!1)},className:`w-full flex items-center justify-between px-2.5 py-1.5 border-2 border-ink-black text-left transition-all cursor-pointer ${t?`bg-amber-200 shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] font-bold text-ink-black`:`bg-white hover:bg-slate-100 text-slate-800`}`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 font-arcade text-[9px]`,children:[(0,W.jsx)(ve,{className:`w-3.5 h-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:e.name})]}),(0,W.jsxs)(`span`,{className:`font-mono text-[8px] font-bold px-1.5 py-0.5 bg-white border border-ink-black text-slate-700 shadow-[1px_1px_0px_0px_rgba(30,41,59,0.3)]`,children:[`v`,e.version]})]},e.id)})]})]}),(0,W.jsx)(`div`,{className:`h-4 w-[2px] bg-slate-300 mx-0.5 hidden sm:block`}),(0,W.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 cursor-pointer select-none`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>c(e.target.checked),className:`sr-only peer`,"aria-label":`Toggle code editor autocompletion`}),(0,W.jsx)(`div`,{className:`relative w-7 h-3.5 bg-slate-300 border border-ink-black rounded-full peer peer-checked:bg-grass-green transition-all after:content-[''] after:absolute after:top-[1px] after:left-[2px] after:bg-white after:border after:border-ink-black after:rounded-full after:h-2 after:w-2 after:transition-all peer-checked:after:translate-x-3`}),(0,W.jsx)(`span`,{className:`text-[7.5px] min-[400px]:text-[8px] font-arcade font-bold text-trash-gray peer-checked:text-ink-black whitespace-nowrap`,children:`AUTOCOMPLETE`})]})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 sm:gap-2`,children:[(0,W.jsx)(`button`,{onClick:u,className:`w-7 h-7 bg-white hover:bg-slate-100 border-2 border-ink-black shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none text-ink-black flex items-center justify-center cursor-pointer transition-all`,title:`Reset to starter code`,"aria-label":`Reset to starter code`,children:(0,W.jsx)(l,{className:`w-3.5 h-3.5`})}),(0,W.jsx)(`button`,{onClick:()=>m(``),className:`w-7 h-7 bg-white hover:bg-rose-50 border-2 border-ink-black shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none text-rose-700 flex items-center justify-center cursor-pointer transition-all`,title:`Clear editor`,"aria-label":`Clear editor`,children:(0,W.jsx)(b,{className:`w-3.5 h-3.5 text-rose-600`})}),k&&(0,W.jsx)(`button`,{onClick:k,disabled:S||!d.trim(),className:`w-7 h-7 border-2 border-ink-black shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none flex items-center justify-center cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed transition-all ${D?`bg-emerald-600 hover:bg-emerald-500 text-white`:`bg-amber-400 hover:bg-amber-300 text-ink-black`}`,title:S?`Saving solution to personal database...`:D?`Saved to personal database!`:`Overwrite saved solution with studio code`,"aria-label":`Overwrite saved solution with studio code`,children:S?(0,W.jsx)(n,{className:`w-3.5 h-3.5 animate-spin text-ink-black`}):D?(0,W.jsx)(h,{className:`w-3.5 h-3.5 text-white`}):(0,W.jsx)(i,{className:`w-3.5 h-3.5 text-ink-black`})}),F&&(0,W.jsx)(`button`,{onClick:F,disabled:I||!d.trim(),className:`w-7 h-7 bg-[#24292e] hover:bg-black border-2 border-ink-black shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none text-white flex items-center justify-center cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed transition-all`,title:I?`Pushing to GitHub...`:`Push solution to GitHub repository`,"aria-label":`Push to GitHub`,children:I?(0,W.jsx)(n,{className:`w-3.5 h-3.5 animate-spin text-yellow-300`}):(0,W.jsx)(f,{className:`w-3.5 h-3.5 text-yellow-300`})})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 sm:gap-2`,children:[(0,W.jsx)(`button`,{onClick:y,disabled:g||!d.trim(),className:`w-7 h-7 bg-emerald-600 hover:bg-emerald-500 border-2 border-ink-black shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none text-white flex items-center justify-center cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed transition-all`,title:g?`Running sandbox tests...`:`Run tests in local sandbox`,"aria-label":`Run tests`,children:g?(0,W.jsx)(n,{className:`w-3.5 h-3.5 animate-spin`}):(0,W.jsx)(s,{className:`w-3.5 h-3.5 fill-white text-white ml-0.5`})}),(0,W.jsx)(`button`,{onClick:N,disabled:A||!d.trim(),className:`w-7 h-7 bg-purple-600 hover:bg-purple-500 border-2 border-ink-black shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none text-white flex items-center justify-center cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed transition-all`,title:A?`Evaluating code with Gemini...`:`Gemini Eval (AI code review & complexity)`,"aria-label":`Gemini Eval`,children:A?(0,W.jsx)(n,{className:`w-3.5 h-3.5 animate-spin`}):(0,W.jsx)(T,{className:`w-3.5 h-3.5 text-amber-300`})})]})]}),(0,W.jsxs)(`div`,{className:`p-4 sm:p-5 flex-1 flex flex-col space-y-4`,children:[(0,W.jsx)(`div`,{className:`flex-1 flex flex-col min-h-[300px] sm:min-h-[360px] border-[3px] border-ink-black shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] bg-[#0c111d] overflow-hidden`,children:(0,W.jsx)(`div`,{className:`flex-1 overflow-hidden relative`,children:(0,W.jsx)(ee,{value:d,onChange:m,placeholder:`def solve(nums): - # Write your solution from memory here...`,height:`100%`,theme:`dark`,extensions:K,basicSetup:{autocompletion:o,lineNumbers:!0,foldGutter:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0},className:`w-full h-full text-xs font-code-mono`})})}),D&&(0,W.jsxs)(`div`,{className:`p-3 bg-[#f0fdf4] border-2 border-emerald-600 text-emerald-950 text-xs font-semibold flex items-center gap-2 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,W.jsx)(h,{className:`w-4 h-4 text-emerald-600 shrink-0`}),(0,W.jsx)(`span`,{children:`Successfully saved studio code as your personal reference solution!`})]}),O&&(0,W.jsxs)(`div`,{className:`p-3 bg-rose-50 border-2 border-rose-500 text-rose-800 text-xs font-semibold flex items-center gap-2 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,W.jsx)(p,{className:`w-4 h-4 text-rose-600 shrink-0`}),(0,W.jsx)(`span`,{children:O})]}),L&&(0,W.jsxs)(`div`,{className:`p-3 bg-[#f0fdf4] border-2 border-emerald-600 text-emerald-950 text-xs font-semibold flex items-center justify-between shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(h,{className:`w-4 h-4 text-emerald-600 shrink-0`}),(0,W.jsx)(`span`,{children:`Successfully pushed solution to your GitHub repository!`})]}),(0,W.jsxs)(`a`,{href:L,target:`_blank`,rel:`noopener noreferrer`,className:`text-[11px] font-bold text-blue-700 hover:text-blue-900 underline flex items-center gap-1`,children:[(0,W.jsx)(`span`,{children:`View on GitHub`}),(0,W.jsx)(x,{className:`w-3 h-3`})]})]}),R&&(0,W.jsxs)(`div`,{className:`p-3 bg-rose-50 border-2 border-rose-500 text-rose-800 text-xs font-semibold flex items-center gap-2 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,W.jsx)(p,{className:`w-4 h-4 text-rose-600 shrink-0`}),(0,W.jsx)(`span`,{children:R})]}),g&&(0,W.jsxs)(`div`,{className:`p-3 border-2 border-ink-black bg-emerald-50 shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] flex items-center gap-3 animate-pulse`,children:[(0,W.jsx)(n,{className:`w-5 h-5 text-emerald-600 animate-spin shrink-0`}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h4`,{className:`font-arcade text-[9px] font-bold text-ink-black uppercase`,children:`Running...`}),(0,W.jsx)(`p`,{className:`font-sans text-[11px] text-trash-gray font-semibold mt-0.5`,children:`Executing against test cases...`})]})]}),_&&(0,W.jsxs)(`div`,{className:`p-3 border-2 border-rose-500 bg-rose-50 text-rose-800 text-xs font-semibold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] flex items-center gap-2`,children:[(0,W.jsx)(p,{className:`w-4 h-4 text-rose-600 shrink-0`}),(0,W.jsx)(`span`,{children:_})]}),v&&(0,W.jsxs)(`div`,{className:`border-[3px] border-ink-black p-4 sm:p-5 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] space-y-3.5 ${v.status===`passed`?`bg-[#f0fdf4]`:`bg-[#fff1f2]`}`,children:[(0,W.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-2 pb-2.5 border-b-2 border-dashed border-ink-black`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,W.jsx)(`div`,{className:`w-8 h-8 border-2 border-ink-black flex items-center justify-center font-bold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] ${v.status===`passed`?`bg-grass-green text-ink-black`:`bg-rose-500 text-white`}`,children:v.status===`passed`?(0,W.jsx)(E,{className:`w-5 h-5 stroke-[3]`}):(0,W.jsx)(p,{className:`w-4 h-4`})}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`font-arcade text-[10px] font-bold text-ink-black flex items-center gap-1.5 uppercase`,children:v.status===`passed`?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{children:`ALL TESTS PASSED`}),(0,W.jsx)(h,{className:`w-3.5 h-3.5 text-emerald-600 inline`})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{children:v.status===`error`?`EXECUTION ERROR`:`TESTS FAILED`}),(0,W.jsx)(C,{className:`w-3.5 h-3.5 text-rose-600 inline`})]})}),(0,W.jsxs)(`div`,{className:`font-sans text-[11px] text-slate-600 font-semibold`,children:[v.passed_count??0,` of `,v.total_tests??0,` test cases passed (`,(v.duration_ms??0).toFixed(1),`ms)`]})]})]}),v.status===`passed`&&(0,W.jsxs)(`button`,{onClick:k,disabled:S,className:`px-3 py-1.5 bg-white hover:bg-emerald-100 border-2 border-ink-black text-ink-black font-arcade text-[8px] font-bold flex items-center gap-1.5 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer shrink-0 disabled:opacity-50`,children:[S?(0,W.jsx)(n,{className:`w-3 h-3 animate-spin`}):D?(0,W.jsx)(h,{className:`w-3.5 h-3.5 text-emerald-600`}):(0,W.jsx)(i,{className:`w-3.5 h-3.5 text-blue-600`}),(0,W.jsx)(`span`,{children:D?`SAVED TO DB!`:`SAVE AS OFFICIAL SOLUTION`})]})]}),O&&(0,W.jsx)(`div`,{className:`p-2 border border-rose-500 bg-rose-100 text-rose-800 text-[11px] font-semibold`,children:O}),v.results&&v.results.length>0&&(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(`span`,{className:`font-arcade text-[8px] text-trash-gray uppercase font-bold block`,children:`TEST CASE BREAKDOWN:`}),(0,W.jsx)(`div`,{className:`space-y-1.5 max-h-56 overflow-y-auto custom-scrollbar`,children:v.results.map((e,t)=>(0,W.jsxs)(`div`,{className:`p-2.5 border-2 border-ink-black text-xs font-mono shadow-[2px_2px_0px_0px_rgba(30,41,59,0.3)] ${e.passed?`bg-white`:`bg-rose-50`}`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between font-arcade text-[8px] mb-1`,children:[(0,W.jsxs)(`span`,{className:`font-bold text-ink-black`,children:[`CASE #`,t+1]}),(0,W.jsx)(`span`,{className:e.passed?`text-emerald-700 font-bold`:`text-rose-700 font-bold`,children:e.passed?`✓ PASSED`:`✗ FAILED`})]}),(0,W.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-1.5 text-[10px]`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{className:`text-slate-500 block`,children:`Input:`}),(0,W.jsx)(`span`,{className:`font-code-mono text-ink-black font-semibold break-all`,children:JSON.stringify(e.input)})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{className:`text-slate-500 block`,children:`Expected:`}),(0,W.jsx)(`span`,{className:`font-code-mono text-emerald-700 font-semibold break-all`,children:JSON.stringify(e.expected)})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{className:`text-slate-500 block`,children:`Output:`}),(0,W.jsx)(`span`,{className:`font-code-mono font-semibold break-all ${e.passed?`text-emerald-700`:`text-rose-700`}`,children:e.output===void 0?`None`:JSON.stringify(e.output)})]})]}),e.error&&(0,W.jsx)(`div`,{className:`mt-1.5 p-1.5 bg-rose-100 text-rose-900 text-[10px] font-mono border border-rose-300 break-all`,children:e.error})]},t))})]}),v.error&&(0,W.jsx)(`div`,{className:`p-3 bg-[#1E293B] text-rose-400 font-code-mono text-[11px] border-2 border-ink-black overflow-x-auto whitespace-pre-wrap select-text`,children:v.error}),v.status===`passed`&&(0,W.jsx)(`div`,{className:`p-2 bg-emerald-100/70 border border-emerald-300 text-emerald-900 text-xs flex items-center justify-between`,children:(0,W.jsx)(`span`,{className:`font-sans font-medium`,children:`✨ All unit tests passed. Rate your recall below.`})})]}),A&&(0,W.jsxs)(`div`,{className:`p-4 border-2 border-ink-black bg-amber-50 shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] flex items-center gap-3 animate-pulse`,children:[(0,W.jsx)(n,{className:`w-6 h-6 text-purple-600 animate-spin shrink-0`}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h4`,{className:`font-arcade text-[9px] font-bold text-ink-black uppercase`,children:`ANALYZING...`}),(0,W.jsx)(`p`,{className:`font-sans text-[11px] text-trash-gray font-semibold mt-0.5`,children:`Checking edge cases, bounds, and Big-O efficiency against optimal constraints...`})]})]}),j&&(0,W.jsx)(`div`,{className:`p-3 border-2 border-rose-500 bg-rose-50 text-rose-800 text-xs font-semibold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:j}),M&&(0,W.jsxs)(`div`,{className:`border-[3px] border-ink-black bg-[#fefce8] p-4 sm:p-5 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] space-y-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between pb-3 border-b-2 border-dashed border-ink-black`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(`div`,{className:`w-9 h-9 border-2 border-ink-black flex items-center justify-center font-bold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] ${M.is_correct?`bg-grass-green text-ink-black`:`bg-rose-500 text-white`}`,children:M.is_correct?(0,W.jsx)(E,{className:`w-5 h-5 stroke-[3]`}):(0,W.jsx)(r,{className:`w-5 h-5`})}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{className:`font-arcade text-[10px] font-bold text-ink-black flex items-center gap-1.5`,children:M.is_correct?(0,W.jsxs)(W.Fragment,{children:[`STATUS: PASSED`,(0,W.jsx)(h,{className:`w-3.5 h-3.5 text-emerald-600 inline`})]}):(0,W.jsxs)(W.Fragment,{children:[`STATUS: FAILED`,(0,W.jsx)(C,{className:`w-3.5 h-3.5 text-rose-600 inline`})]})}),(0,W.jsx)(`span`,{className:`font-sans text-[11px] text-slate-600 font-semibold`,children:M.is_correct?`Algorithm matches expected logic and patterns.`:`Bugs or edge-case failures detected.`})]})]}),(0,W.jsx)(`span`,{className:`font-arcade text-[9px] px-2 py-1 border-2 border-ink-black uppercase font-bold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] ${M.is_correct?`bg-emerald-100 text-emerald-800`:`bg-rose-100 text-rose-800`}`,children:M.is_correct?`CORRECT`:`INCORRECT`})]}),(0,W.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,W.jsxs)(`div`,{className:`p-2.5 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,W.jsx)(`span`,{className:`font-arcade text-[8px] text-trash-gray block uppercase font-bold`,children:`Time Complexity`}),(0,W.jsxs)(`div`,{className:`flex items-baseline gap-2 mt-1`,children:[(0,W.jsx)(`span`,{className:`font-code-mono text-xs font-bold text-ink-black`,children:M.detected_complexity?.time||`N/A`}),(0,W.jsxs)(`span`,{className:`text-[10px] font-sans text-slate-500 font-semibold`,children:[`(Target: `,P||`O(N)`,`)`]})]})]}),(0,W.jsxs)(`div`,{className:`p-2.5 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,W.jsx)(`span`,{className:`font-arcade text-[8px] text-trash-gray block uppercase font-bold`,children:`Space Complexity`}),(0,W.jsxs)(`div`,{className:`flex items-baseline gap-2 mt-1`,children:[(0,W.jsx)(`span`,{className:`font-code-mono text-xs font-bold text-ink-black`,children:M.detected_complexity?.space||`N/A`}),(0,W.jsxs)(`span`,{className:`text-[10px] font-sans text-slate-500 font-semibold`,children:[`(Target: `,te||`O(1)`,`)`]})]})]})]}),M.bugs&&M.bugs.length>0&&(0,W.jsxs)(`div`,{className:`p-3 bg-white border-2 border-ink-black space-y-1.5 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,W.jsxs)(`span`,{className:`font-arcade text-[8px] text-rose-600 uppercase font-bold block flex items-center gap-1`,children:[(0,W.jsx)(p,{className:`w-3 h-3 text-rose-500`}),`TRACES & EDGE CASE ISSUES:`]}),(0,W.jsx)(`ul`,{className:`list-disc list-inside text-xs text-slate-800 space-y-1 font-semibold pl-1`,children:M.bugs.map((e,t)=>(0,W.jsx)(`li`,{className:`leading-relaxed select-text`,children:e},t))})]}),M.key_suggestion&&(0,W.jsxs)(`div`,{className:`p-3 bg-amber-50 border-2 border-ink-black space-y-1 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,W.jsxs)(`span`,{className:`font-arcade text-[8px] text-amber-700 uppercase font-bold block flex items-center gap-1`,children:[(0,W.jsx)(T,{className:`w-3 h-3 text-amber-500`}),`TIP:`]}),(0,W.jsx)(`p`,{className:`text-xs text-slate-800 font-medium leading-relaxed m-0 select-text`,children:M.key_suggestion})]}),(0,W.jsxs)(`div`,{className:`p-2.5 bg-white border-2 border-dashed border-ink-black flex items-center justify-between`,children:[(0,W.jsxs)(`span`,{className:`text-xs font-bold text-ink-black flex items-center gap-1.5`,children:[(0,W.jsx)(a,{className:`w-4 h-4 text-primary`}),`Recommendation:`]}),(0,W.jsx)(`span`,{className:`font-arcade text-[9px] font-bold text-purple-700`,children:M.is_correct?`Rate your recall below.`:`Review issues and rate recall below.`})]})]})]})]})},be=({gradeError:e,onDismissGradeError:t,submitting:r,submittingRating:i,onGrade:a})=>(0,W.jsx)(`div`,{className:`shrink-0 bg-[#f8f5eb] border-t-[3px] border-ink-black p-2 sm:p-3 flex flex-col items-stretch gap-1.5 sm:gap-2 shadow-[0_-3px_0_0_rgba(30,41,59,0.08)]`,children:(0,W.jsxs)(`div`,{className:`w-full flex flex-col`,children:[e&&(0,W.jsxs)(`div`,{className:`p-2.5 mb-2 bg-red-100 border-2 border-red-500 text-red-800 text-xs font-semibold shadow-[2px_2px_0px_0px_#1E293B] flex items-center justify-between`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(p,{className:`w-4 h-4 text-red-600 shrink-0`}),e]}),(0,W.jsx)(`button`,{onClick:t,className:`text-red-900 font-bold hover:underline cursor-pointer ml-2 text-xs`,children:`Dismiss`})]}),(0,W.jsxs)(`div`,{className:`flex gap-1.5 sm:gap-2.5 w-full`,children:[(0,W.jsx)(`button`,{onClick:()=>a(1),disabled:r,className:`flex-1 min-w-0 bg-[#dc2626] hover:bg-[#b91c1c] border-2 sm:border-[3px] border-ink-black py-2 sm:py-2.5 px-1 sm:px-2 arcade-btn cursor-pointer disabled:opacity-60 text-white flex flex-col items-center justify-center font-bold transition-all select-none`,title:`Press 1 on keyboard`,children:i===1?(0,W.jsx)(`div`,{className:`flex items-center gap-1.5 font-arcade text-[10px]`,children:(0,W.jsx)(n,{className:`w-3.5 h-3.5 animate-spin`})}):(0,W.jsxs)(`div`,{className:`flex items-center gap-1 font-headline-md text-[10px] min-[400px]:text-xs sm:text-sm font-extrabold tracking-wide uppercase truncate`,children:[(0,W.jsx)(`span`,{className:`font-arcade text-[8px] sm:text-[9px] px-1 py-0.5 bg-black/20 rounded shrink-0`,children:`1`}),(0,W.jsx)(`span`,{className:`truncate`,children:`Again`})]})}),(0,W.jsx)(`button`,{onClick:()=>a(2),disabled:r,className:`flex-1 min-w-0 bg-[#ff9933] hover:bg-[#ff8000] border-2 sm:border-[3px] border-ink-black py-2 sm:py-2.5 px-1 sm:px-2 arcade-btn cursor-pointer disabled:opacity-60 text-ink-black flex flex-col items-center justify-center font-bold transition-all select-none`,title:`Press 2 on keyboard`,children:i===2?(0,W.jsx)(`div`,{className:`flex items-center gap-1.5 font-arcade text-[10px]`,children:(0,W.jsx)(n,{className:`w-3.5 h-3.5 animate-spin text-ink-black`})}):(0,W.jsxs)(`div`,{className:`flex items-center gap-1 font-headline-md text-[10px] min-[400px]:text-xs sm:text-sm font-extrabold tracking-wide uppercase truncate`,children:[(0,W.jsx)(`span`,{className:`font-arcade text-[8px] sm:text-[9px] px-1 py-0.5 bg-black/10 rounded shrink-0`,children:`2`}),(0,W.jsx)(`span`,{className:`truncate`,children:`Hard`})]})}),(0,W.jsx)(`button`,{onClick:()=>a(3),disabled:r,className:`flex-1 min-w-0 bg-[#4ade80] hover:bg-[#22c55e] border-2 sm:border-[3px] border-ink-black py-2 sm:py-2.5 px-1 sm:px-2 arcade-btn cursor-pointer disabled:opacity-60 text-ink-black flex flex-col items-center justify-center font-bold transition-all select-none`,title:`Press 3 on keyboard`,children:i===3?(0,W.jsx)(`div`,{className:`flex items-center gap-1.5 font-arcade text-[10px]`,children:(0,W.jsx)(n,{className:`w-3.5 h-3.5 animate-spin text-ink-black`})}):(0,W.jsxs)(`div`,{className:`flex items-center gap-1 font-headline-md text-[10px] min-[400px]:text-xs sm:text-sm font-extrabold tracking-wide uppercase truncate`,children:[(0,W.jsx)(`span`,{className:`font-arcade text-[8px] sm:text-[9px] px-1 py-0.5 bg-black/10 rounded shrink-0`,children:`3`}),(0,W.jsx)(`span`,{className:`truncate`,children:`Good`})]})}),(0,W.jsx)(`button`,{onClick:()=>a(4),disabled:r,className:`flex-1 min-w-0 bg-[#60a5fa] hover:bg-[#3b82f6] border-2 sm:border-[3px] border-ink-black py-2 sm:py-2.5 px-1 sm:px-2 arcade-btn cursor-pointer disabled:opacity-60 text-ink-black flex flex-col items-center justify-center font-bold transition-all select-none`,title:`Press 4 on keyboard`,children:i===4?(0,W.jsx)(`div`,{className:`flex items-center gap-1.5 font-arcade text-[10px]`,children:(0,W.jsx)(n,{className:`w-3.5 h-3.5 animate-spin text-ink-black`})}):(0,W.jsxs)(`div`,{className:`flex items-center gap-1 font-headline-md text-[10px] min-[400px]:text-xs sm:text-sm font-extrabold tracking-wide uppercase truncate`,children:[(0,W.jsx)(`span`,{className:`font-arcade text-[8px] sm:text-[9px] px-1 py-0.5 bg-black/10 rounded shrink-0`,children:`4`}),(0,W.jsx)(`span`,{className:`truncate`,children:`Easy`})]})})]})]})}),xe=({nextMilestone:e,activatingMilestone:t,onActivateNextMilestone:r,onOpenOnboarding:i,onOpenJourney:a,onOpenCreateProblem:o,onOpenWindow:s,overrideProblemId:c,onClearOverride:u,hasCustomOnboardingModal:f,isOnboardingOpen:p,onCloseOnboarding:h,onCompletedOnboarding:y,currentUserId:b})=>(0,W.jsx)(`div`,{className:`w-full h-full flex items-center justify-center bg-[#fdf8e1] p-6 overflow-y-auto custom-scrollbar`,children:(0,W.jsxs)(`div`,{className:`w-full max-w-lg bg-paper-white border-[4px] border-ink-black gadget-shadow p-6 sm:p-8 relative overflow-hidden text-center space-y-6`,children:[(0,W.jsx)(`div`,{className:`absolute top-0 left-0 right-0 h-3 bg-gradient-to-r from-grass-green via-amber-300 to-highlight-pink`}),(0,W.jsxs)(`div`,{className:`relative inline-block mt-2`,children:[(0,W.jsx)(`div`,{className:`w-20 h-20 bg-amber-300 border-[3px] border-ink-black rounded-2xl flex items-center justify-center mx-auto gadget-shadow rotate-[-3deg] hover:rotate-0 transition-transform`,children:(0,W.jsx)(S,{className:`w-10 h-10 text-ink-black stroke-[2.5]`})}),(0,W.jsx)(`div`,{className:`absolute -bottom-2 -right-2 bg-grass-green border-2 border-ink-black px-2 py-0.5 font-arcade text-[8px] text-ink-black font-bold uppercase shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:`100% DONE`})]}),(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2.5 py-1 bg-emerald-100 border-2 border-ink-black text-emerald-800 font-arcade text-[9px] font-bold`,children:[(0,W.jsx)(E,{className:`w-3 h-3 stroke-[3]`}),` ALL CARDS COMPLETED FOR TODAY`]}),(0,W.jsx)(`h2`,{className:`text-2xl sm:text-3xl font-extrabold text-ink-black font-headline-md tracking-tight`,children:`You're all caught up for today. Keep it up.`}),(0,W.jsx)(`p`,{className:`text-xs sm:text-sm font-sans text-trash-gray max-w-md mx-auto leading-relaxed font-semibold`,children:`All reviews for today are finished. Next reviews are scheduled for tomorrow.`})]}),e&&(0,W.jsxs)(`div`,{className:`p-4 sm:p-5 bg-gradient-to-br from-amber-50 to-orange-50 border-[3px] border-ink-black gadget-shadow text-left space-y-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`span`,{className:`font-arcade text-[9px] font-bold text-amber-800 uppercase tracking-wider flex items-center gap-1.5`,children:[(0,W.jsx)(_,{className:`w-3.5 h-3.5 text-amber-600`}),`NEXT UNEXPLORED MILESTONE`]}),(0,W.jsxs)(`span`,{className:`font-mono text-[10px] font-bold px-2 py-0.5 rounded bg-amber-900/10 text-amber-900 border border-amber-900/20`,children:[`LC #`,e.problem_number]})]}),(0,W.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`h3`,{className:`font-headline-md text-base sm:text-lg font-bold text-ink-black truncate`,children:e.name}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2 mt-1 flex-wrap`,children:[(0,W.jsx)(`span`,{className:`px-2 py-0.5 rounded font-arcade text-[8px] font-bold uppercase text-white ${e.difficulty===`Easy`?`bg-emerald-600`:e.difficulty===`Medium`?`bg-amber-600`:`bg-rose-600`}`,children:e.difficulty}),(0,W.jsx)(`span`,{className:`px-2 py-0.5 rounded font-arcade text-[8px] bg-purple-100 text-purple-800 border border-purple-300 font-bold`,children:e.pattern}),(0,W.jsxs)(`span`,{className:`text-[11px] font-code-mono text-slate-600`,children:[`T: `,e.time_complexity,` | S: `,e.space_complexity]})]})]}),(0,W.jsx)(`button`,{onClick:r,disabled:t,className:`px-4 py-2.5 bg-grass-green hover:bg-emerald-400 text-ink-black font-arcade text-[9px] font-bold border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer shrink-0 flex items-center justify-center gap-1.5 disabled:opacity-50`,children:t?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(n,{className:`w-3.5 h-3.5 animate-spin`}),(0,W.jsx)(`span`,{children:`ACTIVATING...`})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(T,{className:`w-3.5 h-3.5 text-amber-700`}),(0,W.jsx)(`span`,{children:`ACTIVATE & REVIEW NOW`})]})})]})]}),(0,W.jsxs)(`div`,{className:`p-4 sm:p-5 bg-gradient-to-r from-amber-100 via-amber-200 to-yellow-100 border-[3px] border-ink-black gadget-shadow text-left flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`space-y-1`,children:[(0,W.jsxs)(`span`,{className:`font-arcade text-[9px] font-bold text-amber-900 uppercase flex items-center gap-1.5`,children:[(0,W.jsx)(v,{className:`w-3.5 h-3.5 text-amber-700`}),`FAST-TRACK EXPEDITION ENROLLMENT`]}),(0,W.jsx)(`h3`,{className:`font-headline-md text-base sm:text-lg font-bold text-ink-black`,children:`Already Solved Problems Elsewhere?`}),(0,W.jsx)(`p`,{className:`font-sans text-xs text-trash-gray font-semibold max-w-md`,children:`Check off problems you've already solved elsewhere to seed your review queue.`})]}),(0,W.jsxs)(`button`,{onClick:i,className:`px-4 py-2.5 bg-amber-400 hover:bg-amber-300 text-ink-black font-arcade text-[9px] font-bold border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer shrink-0 flex items-center gap-1.5`,children:[(0,W.jsx)(v,{className:`w-3.5 h-3.5 text-amber-900`}),(0,W.jsx)(`span`,{children:`OPEN 150-PROBLEM CHECKLIST`})]})]}),(0,W.jsxs)(`div`,{className:`border-t-[3px] border-dashed border-ink-black pt-5 space-y-3`,children:[(0,W.jsx)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold text-left`,children:`CONTINUE PRACTICING:`}),(0,W.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2.5`,children:[(0,W.jsxs)(`button`,{onClick:a,className:`p-3 bg-amber-100 hover:bg-amber-200 border-[3px] border-ink-black text-left flex flex-col justify-between gadget-shadow active:translate-y-1 active:shadow-none transition-all cursor-pointer`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(_,{className:`w-4 h-4 text-amber-600`}),(0,W.jsx)(g,{className:`w-3 h-3 text-ink-black`})]}),(0,W.jsxs)(`div`,{className:`mt-2`,children:[(0,W.jsx)(`div`,{className:`font-arcade text-[8px] font-bold text-ink-black uppercase`,children:`Journey Trail`}),(0,W.jsx)(`div`,{className:`font-sans text-[10px] text-trash-gray font-semibold`,children:`150 Curated nodes`})]})]}),(0,W.jsxs)(`button`,{onClick:o,className:`p-3 bg-purple-100 hover:bg-purple-200 border-[3px] border-ink-black text-left flex flex-col justify-between gadget-shadow active:translate-y-1 active:shadow-none transition-all cursor-pointer`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(m,{className:`w-4 h-4 text-purple-700`}),(0,W.jsx)(g,{className:`w-3 h-3 text-ink-black`})]}),(0,W.jsxs)(`div`,{className:`mt-2`,children:[(0,W.jsx)(`div`,{className:`font-arcade text-[8px] font-bold text-ink-black uppercase`,children:`Add Problem`}),(0,W.jsx)(`div`,{className:`font-sans text-[10px] text-trash-gray font-semibold`,children:`New LeetCode entry`})]})]}),(0,W.jsxs)(`button`,{onClick:()=>s?.(`companion`),className:`p-3 bg-yellow-100 hover:bg-yellow-200 border-[3px] border-ink-black text-left flex flex-col justify-between gadget-shadow active:translate-y-1 active:shadow-none transition-all cursor-pointer`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`span`,{className:`material-symbols-outlined text-amber-600 text-lg`,children:`castle`}),(0,W.jsx)(g,{className:`w-3 h-3 text-ink-black`})]}),(0,W.jsxs)(`div`,{className:`mt-2`,children:[(0,W.jsx)(`div`,{className:`font-arcade text-[8px] font-bold text-ink-black uppercase`,children:`Princess Tower`}),(0,W.jsx)(`div`,{className:`font-sans text-[10px] text-trash-gray font-semibold`,children:`Visit Aurelia`})]})]}),(0,W.jsxs)(`button`,{onClick:()=>s?.(`computer`),className:`p-3 bg-cyan-100 hover:bg-cyan-200 border-[3px] border-ink-black text-left flex flex-col justify-between gadget-shadow active:translate-y-1 active:shadow-none transition-all cursor-pointer`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(d,{className:`w-4 h-4 text-cyan-700`}),(0,W.jsx)(g,{className:`w-3 h-3 text-ink-black`})]}),(0,W.jsxs)(`div`,{className:`mt-2`,children:[(0,W.jsx)(`div`,{className:`font-arcade text-[8px] font-bold text-ink-black uppercase`,children:`File Explorer`}),(0,W.jsx)(`div`,{className:`font-sans text-[10px] text-trash-gray font-semibold`,children:`Browse all files`})]})]})]})]}),c&&u&&(0,W.jsxs)(`button`,{onClick:u,className:`mt-3 bg-white hover:bg-slate-100 border-[3px] border-ink-black text-ink-black font-bold px-4 py-2 text-xs uppercase tracking-wide shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer inline-flex items-center gap-2`,children:[(0,W.jsx)(l,{className:`w-3.5 h-3.5`}),` Return to Scheduled Queue`]}),!f&&(0,W.jsx)(R,{isOpen:p,onClose:h,onCompleted:y,userId:b})]})}),Se=e({default:()=>we}),Ce=(0,U.lazy)(()=>te(()=>import(`./ProblemSpecPanel-Df-cRYRz.js`).then(e=>({default:e.ProblemSpecPanel})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])));function we({overrideProblemId:e,onClearOverride:t,onOpenWindow:r,onOpenJourney:i,onOpenCreateProblem:a,onOpenEditProblem:o,onOpenOnboarding:s,refreshTrigger:c}){let[l,f]=(0,U.useState)(null),p=l!==null&&l<780,[m,h]=(0,U.useState)(`spec`),[g,_]=(0,U.useState)(`spec`),[v,b]=(0,U.useState)(null),ee=(0,U.useCallback)(e=>{e&&(f(e.clientWidth),new ResizeObserver(e=>{for(let t of e)f(t.contentRect.width)}).observe(e))},[]),[x,S]=(0,U.useState)(!1),[C,w]=(0,U.useState)(()=>localStorage.getItem(`isAutocompleteEnabled`)!==`false`),{reviews:T,setReviews:E,loading:D,submitting:O,submittingRating:k,gradeError:A,setGradeError:j,code:M,setCode:P,nextMilestone:te,activatingMilestone:L,currentUserId:z,fetchQueue:ne,handleGrade:B,handleSelectCard:V,handleActivateNextMilestone:H,handleResetStarterCode:re}=le({overrideProblemId:e,refreshTrigger:c,onClearOverride:t,onOpenOnboarding:s,setIsOnboardingOpen:S}),{sandboxRunning:ie,sandboxResults:ae,sandboxError:ce,savingReference:pe,savedRefSuccess:me,saveRefError:G,handleRunSandbox:he,handleSaveReference:ge,resetSandbox:K}=ue(),{aiLoading:_e,aiResult:ve,aiError:Se,explainLoading:we,explanationText:Te,explainError:Ee,aiSolutionLoading:De,aiSolutionError:Oe,handleAiEvaluation:ke,handleExplainCode:Ae,handleFetchAiSolution:je,resetAiState:q}=de(),[Me,Ne]=(0,U.useState)(!1),[Pe,Fe]=(0,U.useState)(null),[Ie,J]=(0,U.useState)(null),Le=(0,U.useCallback)(async()=>{if(T.length===0)return;let e=T[0]?.problems||{},t=M.trim()||e.reference_code||``;if(!t){J(`Please write or save code before pushing to GitHub.`),setTimeout(()=>J(null),4e3);return}let n=I();if(!n.token){r&&r(`github`);return}Ne(!0),J(null),Fe(null);try{let r=await F({token:n.token,repo:n.repoName,branch:n.branch,problem_number:e.problem_number,problem_name:e.name||`Algorithm Problem`,pattern:e.pattern||`Algorithms`,difficulty:e.difficulty||`Medium`,optimal_time:e.optimal_time||`O(N)`,optimal_space:e.optimal_space||`O(1)`,description:e.description||``,code:t});Fe(r.html_url),setTimeout(()=>Fe(null),8e3)}catch(e){J(e.message||`Failed to push solution to GitHub.`),setTimeout(()=>J(null),5e3)}finally{Ne(!1)}},[T,M,r]),Re=T[0]?.id||T[0]?.problem_id,ze=(0,U.useRef)(void 0);(0,U.useEffect)(()=>{Re&&ze.current!==Re&&(ze.current=Re,q(),K())},[Re,q,K]);let Y=(0,U.useCallback)(e=>{q(),K(),B(e)},[B,q,K]),Be=(0,U.useCallback)(e=>{q(),K(),V(e)},[V,q,K]);(0,U.useEffect)(()=>{let e=e=>{let t=e.target;t?.closest(`.cm-editor`)||t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable||T.length===0||O||(e.key===`1`?(e.preventDefault(),Y(1)):e.key===`2`?(e.preventDefault(),Y(2)):e.key===`3`?(e.preventDefault(),Y(3)):e.key===`4`&&(e.preventDefault(),Y(4)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Y,T.length,O]);let Ve=(e,t)=>{navigator.clipboard.writeText(e),b(t),setTimeout(()=>b(null),1800)},He=(0,U.useCallback)(()=>{i?i():r?.(`journey`)},[i,r]),Ue=(0,U.useCallback)(()=>{a?a():r?.(`createProblem`)},[a,r]),We=(0,U.useCallback)(()=>{s?s():S(!0)},[s]),Ge=(0,U.useCallback)(e=>{E(t=>{if(t.length===0)return t;let n=[...t],r=n[0];return r&&r.problems&&(r.problems={...r.problems,solutions:e}),n})},[E]);if(D)return(0,W.jsx)(`div`,{className:`w-full h-full flex items-center justify-center bg-[#fdf8e1] text-ink-black`,children:(0,W.jsxs)(`div`,{className:`flex flex-col items-center gap-4 p-8 bg-paper-white border-[3px] border-ink-black gadget-shadow text-center max-w-xs`,children:[(0,W.jsx)(`div`,{className:`w-12 h-12 bg-amber-200 border-2 border-ink-black flex items-center justify-center animate-spin`,children:(0,W.jsx)(n,{className:`w-6 h-6 text-ink-black`})}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{className:`font-arcade text-xs text-ink-black uppercase tracking-wider font-bold`,children:`LOADING QUEUE`}),(0,W.jsx)(`p`,{className:`font-sans text-[11px] text-trash-gray mt-1 font-semibold`,children:`Fetching scheduled FSRS review cards...`})]})]})});if(T.length===0)return(0,W.jsx)(xe,{nextMilestone:te,activatingMilestone:L,onActivateNextMilestone:H,onOpenOnboarding:We,onOpenJourney:He,onOpenCreateProblem:Ue,onOpenWindow:r,overrideProblemId:e,onClearOverride:t,hasCustomOnboardingModal:!!s,isOnboardingOpen:x,onCloseOnboarding:()=>S(!1),onCompletedOnboarding:ne,currentUserId:z});let X=T[0],Z=X?.problems,Ke=Z?.problem_number??(/^\d+$/.test(X?.problem_id||``)?parseInt(X.problem_id,10):void 0),Q=N(Ke,Z?.id||X?.problem_id,Z?.name),{cleanTitle:qe,approachVariant:Je,pattern:Ye}=se(Z?.name,Q?.name,Z?.pattern,Q?.pattern),$={...Q,...Z,id:Z?.id||Q?.id||X?.problem_id,name:qe,problem_number:Z?.problem_number??Q?.problem_number,pattern:Ye,approach_variant:Je,difficulty:Z?.difficulty||Q?.difficulty||`Medium`,reference_code:Z?.reference_code||Q?.reference_solution||``,starter_code:Q?.starter_code||Z?.starter_code||``,description:Z?.description||Q?.description||``,optimal_time:Z?.optimal_time||Q?.time_complexity||`O(N)`,optimal_space:Z?.optimal_space||Q?.space_complexity||`O(1)`,examples:Z?.examples&&Z.examples.length>0?Z.examples:Q?.examples,constraints:Z?.constraints||Q?.constraints,how_to_solve:Z?.how_to_solve||``,solutions:Z?.solutions&&Z.solutions.length>0?Z.solutions:Q?.solutions},Xe=oe({...Q,...$,examples:$.examples&&$.examples.length>0?$.examples:Q?.examples,constraints:$.constraints&&(Array.isArray($.constraints)?$.constraints.length>0:$.constraints)?$.constraints:Q?.constraints}),Ze=Q?.reference_solution||``,Qe=Z?.reference_code||``,$e=Qe&&(!Ze||Qe.trim()!==Ze.trim())?Qe:``,et=$e||Ze||Qe||``;return(0,W.jsxs)(`div`,{ref:ee,className:`w-full h-full bg-[#fdf8e1] flex flex-col overflow-hidden select-none`,children:[(0,W.jsx)(fe,{problem:$,totalInQueue:T.length,reviews:T,overrideProblemId:e,onSelectCard:Be,onOpenCreateProblem:Ue,onOpenEditProblem:()=>{o?o($):r?.(`editProblem`)}}),(0,W.jsxs)(`div`,{className:`${p?`flex`:`hidden`} shrink-0 bg-amber-100 border-b-[3px] border-ink-black px-2.5 sm:px-3 py-1.5 gap-1.5 sm:gap-2 overflow-x-auto no-scrollbar`,children:[(0,W.jsxs)(`button`,{onClick:()=>{_(`spec`),h(`spec`)},className:`px-2.5 sm:px-3 py-1 text-[9px] font-arcade font-bold border-2 border-ink-black transition-all cursor-pointer flex items-center gap-1.5 whitespace-nowrap ${g===`spec`?`bg-paper-white translate-y-0.5 shadow-none text-ink-black`:`bg-white shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] text-trash-gray`}`,children:[(0,W.jsx)(u,{className:`w-3 h-3 shrink-0`}),(0,W.jsx)(`span`,{children:`SPEC`})]}),(0,W.jsxs)(`button`,{onClick:()=>_(`code`),className:`px-2.5 sm:px-3 py-1 text-[9px] font-arcade font-bold border-2 border-ink-black transition-all cursor-pointer flex items-center gap-1.5 whitespace-nowrap ${g===`code`?`bg-paper-white translate-y-0.5 shadow-none text-ink-black`:`bg-white shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] text-trash-gray`}`,children:[(0,W.jsx)(y,{className:`w-3 h-3 shrink-0`}),(0,W.jsx)(`span`,{children:`CODE STUDIO`})]}),(0,W.jsxs)(`button`,{onClick:()=>{_(`ref`),h(`ref`)},className:`px-2.5 sm:px-3 py-1 text-[9px] font-arcade font-bold border-2 border-ink-black transition-all cursor-pointer flex items-center gap-1.5 whitespace-nowrap ${g===`ref`?`bg-paper-white translate-y-0.5 shadow-none text-ink-black`:`bg-white shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] text-trash-gray`}`,children:[(0,W.jsx)(d,{className:`w-3 h-3 shrink-0`}),(0,W.jsx)(`span`,{children:`SOLUTION`})]})]}),(0,W.jsxs)(`div`,{className:`flex-1 flex ${p?`flex-col`:`flex-row`} overflow-hidden min-h-0`,children:[(0,W.jsx)(U.Suspense,{fallback:(0,W.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center p-8 bg-paper-white ${p?`h-64`:`border-r-[4px] border-ink-black`} font-sans text-xs text-trash-gray select-none`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2 font-arcade text-[10px] text-ink-black`,children:[(0,W.jsx)(n,{className:`w-4 h-4 animate-spin text-[#0ea5e9]`}),(0,W.jsx)(`span`,{children:`Loading Problem Spec...`})]})}),children:(0,W.jsx)(Ce,{leftTab:m,onSelectLeftTab:e=>{h(e),e===`ref`?_(`ref`):e===`spec`&&_(`spec`)},mobileView:g,isNarrow:p,problem:$,parsed:Xe,userSolution:$e,officialSolution:Ze,effectiveReferenceCode:et,copiedSnippet:v,onCopyText:Ve,saveRefError:G,aiSolutionLoading:De,aiSolutionError:Oe,onFetchAiSolution:()=>je(X,e=>{E(t=>t.map((t,n)=>n===0?{...t,problems:{...$||{},...t.problems||{},reference_code:e}}:t))}),explainLoading:we,explainError:Ee,explanationText:Te,onExplainCode:(e,t,n,r)=>Ae(X,e,t,n,r),activeReview:X,onUpdateSolutions:Ge,onEditProblem:()=>{o?o($):r?.(`editProblem`)}})}),(0,W.jsx)(ye,{mobileView:g,isNarrow:p,isAutocompleteEnabled:C,onToggleAutocomplete:e=>{w(e),localStorage.setItem(`isAutocompleteEnabled`,String(e))},onResetStarterCode:re,code:M,onChangeCode:P,sandboxRunning:ie,sandboxError:ce,sandboxResults:ae,onRunSandbox:()=>he(X,M),savingReference:pe,savedRefSuccess:me,saveRefError:G,onSaveReference:()=>ge(X,M,(e,t)=>{E(n=>n.map((n,r)=>r===0?{...n,problem_id:t||n.problem_id,problems:{...$||{},...n.problems||{},id:t||n.problems?.id||n.problem_id,reference_code:e}}:n))}),aiLoading:_e,aiError:Se,aiResult:ve,onAiEvaluation:()=>ke(X,M),optimalTime:$.optimal_time||`O(N)`,optimalSpace:$.optimal_space||`O(1)`,onPushToGitHub:Le,pushingToGitHub:Me,githubPushedUrl:Pe,githubPushError:Ie})]}),(0,W.jsx)(be,{gradeError:A,onDismissGradeError:()=>j(null),submitting:O,submittingRating:k,onGrade:Y}),!s&&(0,W.jsx)(R,{isOpen:x,onClose:()=>S(!1),onCompleted:ne,userId:z})]})}export{we as default,ce as n,Se as t}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/ReviewQueue-DRECcJtJ.js b/algospaced-ui/dist/assets/ReviewQueue-DRECcJtJ.js new file mode 100644 index 0000000000000000000000000000000000000000..58a3795329bfe5eeac058678316720f93ab7a8d5 --- /dev/null +++ b/algospaced-ui/dist/assets/ReviewQueue-DRECcJtJ.js @@ -0,0 +1,5 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProblemSpecPanel-MCUtP8V_.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-react-q-oOktF_.js","assets/vendor-codemirror-By0wlJeM.js","assets/index-Bcgsshpk.js","assets/firebaseClient-G7klkuBb.js","assets/vendor-firebase-DSIO3PIf.js","assets/vendor-ui-ZXcm-2wU.js","assets/index-supjX07i.css","assets/MarkdownRenderer-cD9l7avV.js"])))=>i.map(i=>d[i]); +import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{D as n,Lt as r,M as i,St as a,T as o,X as s,Z as c,_t as l,a as u,at as d,dt as f,et as p,f as m,ht as h,j as g,k as _,l as v,lt as y,q as ee,rt as b,t as x,u as S,ut as C,v as w,vt as T,xt as E,zt as D}from"./vendor-react-q-oOktF_.js";import{r as O}from"./firebaseClient-G7klkuBb.js";import{b as k,c as A,n as j,o as M,r as N,s as P,t as F}from"./index-Bcgsshpk.js";import{o as I,r as L}from"./githubSyncService-DQdE4J2L.js";import{t as R}from"./confetti.module-Uxh4CK4s.js";import z from"./OnboardingModal-D_uUP3Nd.js";import"./MarkdownRenderer-cD9l7avV.js";import"./PrincessChamber-BkGsNxLj.js";import{A as B,C as te,I as V,S as H,p as U,t as ne,x as re,y as ie}from"./vendor-codemirror-By0wlJeM.js";var W=t(D(),1),G=r();function ae(e){if(!e)return{description:``,examples:[],constraints:[]};let t=e.description||``,n=[],r=[];if(Array.isArray(e.examples)&&e.examples.length>0&&(n=e.examples.map(e=>typeof e==`string`?{input:e,output:``}:{input:e?.input||``,output:e?.output||``,explanation:e?.explanation||``})),Array.isArray(e.constraints)&&e.constraints.length>0?r=e.constraints.map(e=>String(e).replace(/^[\u2022\-*]\s*/,``).trim()).filter(Boolean):typeof e.constraints==`string`&&e.constraints.trim()&&(r=e.constraints.split(` +`).map(e=>e.replace(/^[\u2022\-*]\s*/,``).trim()).filter(Boolean)),n.length===0||r.length===0){let e=t.search(/\bExample\s*\d*:/i),i=t.search(/\bConstraints\s*:/i),a=-1;if(e!==-1&&i!==-1?a=Math.min(e,i):e===-1?i!==-1&&(a=i):a=e,a!==-1){let e=t.substring(0,a).trim(),i=t.substring(a),o=i,s=``,c=i.search(/\bConstraints\s*:/i);if(c!==-1&&(o=i.substring(0,c).trim(),s=i.substring(c).replace(/\bConstraints\s*:/i,``).trim()),n.length===0&&o){let e=/\bExample\s*(\d*)\s*:/gi,t=[],r;for(;(r=e.exec(o))!==null;)t.push({index:r.index,text:r[0]});for(let e=0;ee.replace(/^[\u2022\-*]\s*/,``).trim()).filter(Boolean)),(n.length>0||r.length>0)&&(t=e)}}return{description:t,examples:n,constraints:r}}function oe(e,t,n,r){let i=e=>!e||/^Method\s*\d*$/i.test(e.trim())||e.trim().toLowerCase()===`standard`,a=(e||t||`Algorithm Problem`).trim(),o=null;if(t&&a.toLowerCase().startsWith(t.toLowerCase())){let e=a.slice(t.length).trim();if(a=t,e){let t=e.match(/^[-\s]*Method\s*(\d+)\s*\((.+)\)$/i);if(t){let e=parseInt(t[1],10),n=t[2].trim();i(n)?e>1&&(o=`Method ${e}`):o=n}else{let t=e.match(/^[-\s]*Method\s*(\d+)/i);if(t){let e=parseInt(t[1],10);e>1&&(o=`Method ${e}`)}else{let t=e.match(/^[-\s]*\((.+)\)$/);if(t){let e=t[1].trim();i(e)||(o=e)}else{let t=e.match(/^[-\s]+([^-]+)$/);t&&!i(t[1])&&(o=t[1].trim())}}}}}else{let e=a.match(/^(.*?)\s*-\s*Method\s*(\d+)\s*\((.+)\)$/i);if(e){a=e[1].trim();let t=parseInt(e[2],10),n=e[3].trim();i(n)?t>1&&(o=`Method ${t}`):o=n}else{let e=a.match(/^(.*?)\s*-\s*Method\s*(\d+)$/i);if(e){a=e[1].trim();let t=parseInt(e[2],10);t>1&&(o=`Method ${t}`)}else{let e=a.match(/^(.*?)\s*\(\s*Method\s*(\d+)\s*\)$/i);if(e){a=e[1].trim();let t=parseInt(e[2],10);t>1&&(o=`Method ${t}`)}}}}let s=`General Algorithm`;return i(n)?i(r)?o&&!i(o)&&(s=o):s=r.trim():s=n.trim(),{cleanTitle:a,approachVariant:o,pattern:s}}function se(e,t,n){if(!e)return[];if(Array.isArray(e.solutions)&&e.solutions.length>0)return e.solutions;let r=[],i=t||e.reference_code||``,a=e.pattern||`General Algorithm`,o=e.optimal_time||`O(N)`,s=e.optimal_space||`O(1)`;return(i||a)&&r.push({id:`sol-1`,name:e.approach_variant||`Optimal Solution`,pattern:a,time_complexity:o,space_complexity:s,code:i,explanation:e.how_to_solve||``,is_optimal:!0}),n&&n.trim()&&n.trim()!==i.trim()&&r.push({id:`sol-2`,name:`Personal Solution`,pattern:a,time_complexity:o,space_complexity:s,code:n,is_optimal:!1}),r}function ce({overrideProblemId:e,refreshTrigger:t,onClearOverride:n,onOpenOnboarding:r,setIsOnboardingOpen:i}){let[a,o]=(0,W.useState)([]),[s,c]=(0,W.useState)(!0),[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(null),[p,m]=(0,W.useState)(null),[h,g]=(0,W.useState)(``),[_,v]=(0,W.useState)(null),[y,ee]=(0,W.useState)(!1),[b,x]=(0,W.useState)(void 0),S=(0,W.useRef)(!1),C=(0,W.useRef)(r),w=(0,W.useRef)(i),T=(0,W.useRef)(n),E=(0,W.useRef)(!1);(0,W.useEffect)(()=>{C.current=r,w.current=i,T.current=n});let D=(0,W.useCallback)(()=>{C.current?C.current():w.current&&w.current(!0)},[]),j=(0,W.useCallback)(async(t=!0)=>{t?(c(!0),m(null),g(``),S.current=!1):m(null);try{let{data:{session:n}}=await O.auth.getSession(),r=n?n.access_token:`sandbox`;n?.user?.id&&x(n.user.id);let i={Authorization:`Bearer ${r}`},a=await fetch(`/api/reviews/due`,{headers:i}),s=a.ok?await a.json():[];if(Array.isArray(s)||(s=[]),e){let t=String(e).trim().toLowerCase(),n=s.findIndex(e=>{let n=e.problems;return!!(e.problem_id&&String(e.problem_id).trim().toLowerCase()===t||n?.id&&String(n.id).trim().toLowerCase()===t||n?.problem_number!==void 0&&n?.problem_number!==null&&String(n.problem_number)===t||n?.name&&n.name.trim().toLowerCase()===t)});if(n>0){let[e]=s.splice(n,1);s.unshift(e)}else if(n===-1){let t=null,n=await fetch(`/api/reviews/problems/id/${e}`,{headers:i});if(n.ok){let e=await n.json();Array.isArray(e)&&e.length>0&&(t=e[0])}if(!t){let n=/^\d+$/.test(e),r=N(n?parseInt(e,10):void 0,e);if(r)try{let e=await A(r);if(e?.problem_id){let n=await fetch(`/api/reviews/problems/id/${e.problem_id}`,{headers:i});if(n.ok){let e=await n.json();Array.isArray(e)&&e.length>0&&(t=e[0])}}}catch(e){console.error(`Failed to auto-activate problem for override review:`,e)}}t&&s.unshift(t)}}o(s);let c=n?.user?.id,l=c===`sandbox-user-id`||!c?`sandbox`:c;if(!localStorage.getItem(`algospaced_onboarding_done_${l}`)&&!e&&D(),s&&s.length>0){if(t){let e=s[0],t=e.problems,n=t?.problem_number??(/^\d+$/.test(e?.problem_id||``)?parseInt(e.problem_id,10):void 0),r=N(n,t?.id||e?.problem_id,t?.name)?.starter_code||t?.starter_code||``;g(r)}}else try{let e=await fetch(`/api/journey-progress`,{headers:i});if(e.ok){let t=await e.json();v(P(new Set(t))??null)}else v(P(new Set)??null)}catch{v(P(new Set)??null)}}catch(e){console.error(`Error fetching review queue:`,e)}finally{c(!1)}},[e,D]);(0,W.useEffect)(()=>{if(E.current){E.current=!1;return}let e=!1,t=setTimeout(()=>{e||j(!0)},0);return()=>{e=!0,clearTimeout(t)}},[j,t]),(0,W.useEffect)(()=>{if(!s&&a.length===0&&!e&&!S.current){S.current=!0;try{R({particleCount:90,spread:70,origin:{y:.6}})}catch{}}},[s,a.length,e]);let M=(0,W.useCallback)(async t=>{if(a.length===0||l)return;let n=a[0];if(!n||!n.id)return;u(!0),f(t),m(null);let r=[...a];try{let{data:{session:i}}=await O.auth.getSession(),a=i?i.access_token:`sandbox`,s=await fetch(`/api/reviews/complete`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${a}`},body:JSON.stringify({review_id:n.id,fsrs_state:n.fsrs_state??0,fsrs_stability:n.fsrs_stability??0,fsrs_difficulty:n.fsrs_difficulty??0,fsrs_elapsed_days:n.fsrs_elapsed_days??0,fsrs_scheduled_days:n.fsrs_scheduled_days??0,fsrs_reps:n.fsrs_reps??0,fsrs_lapses:n.fsrs_lapses??0,last_reviewed:n.last_reviewed,rating:t})});if(s.ok){let r=n?.problems?.name||``,i=n?.problems?.pattern||``,a=`Correct`;a=t===1?`Incorrect`:t===2?`Mixed`:`Correct`,k.addReviewEvent(a,r,i).catch(()=>{});let s=L(),c=h.trim()||n?.problems?.reference_code||``;s.token&&s.repoName&&s.autoCommit&&c&&I({token:s.token,repo:s.repoName,branch:s.branch,problem_number:n?.problems?.problem_number,problem_name:r||`Algorithm Problem`,pattern:i||`Algorithms`,difficulty:n?.problems?.difficulty||`Medium`,optimal_time:n?.problems?.optimal_time||`O(N)`,optimal_space:n?.problems?.optimal_space||`O(1)`,description:n?.problems?.description||``,code:c}).catch(e=>{console.warn(`GitHub background auto-commit failed:`,e)}),e&&T.current&&(E.current=!0,T.current()),o(e=>{let t=e.slice(1);if(t.length>0){let e=t[0],n=e.problems,r=n?.problem_number??(/^\d+$/.test(e?.problem_id||``)?parseInt(e.problem_id,10):void 0),i=N(r,n?.id||e?.problem_id,n?.name)?.starter_code||n?.starter_code||``;g(i)}else g(``);return t}),j(!1)}else{let e=await s.json().catch(()=>({}));m(e.detail||`Server returned error (${s.status}). Please try again.`),o(r)}}catch(e){console.error(`Error logging review completion:`,e);let t=e instanceof Error?e.message:`Network connection failed while logging review.`;m(t),o(r)}finally{u(!1),f(null)}},[a,l,e,j,h]),F=(0,W.useCallback)(async()=>{if(_&&!y){ee(!0);try{await A(_),await j()}catch(e){console.error(`Failed to activate next milestone:`,e)}finally{ee(!1)}}},[_,y,j]),z=(0,W.useCallback)(()=>{let e=a[0],t=e?.problems,n=t?.problem_number??(/^\d+$/.test(e?.problem_id||``)?parseInt(e.problem_id,10):void 0),r=N(n,t?.id||e?.problem_id,t?.name)?.starter_code||t?.starter_code||``;g(r)},[a]);return{reviews:a,setReviews:o,loading:s,submitting:l,submittingRating:d,gradeError:p,setGradeError:m,code:h,setCode:g,nextMilestone:_,activatingMilestone:y,currentUserId:b,fetchQueue:j,handleGrade:M,handleSelectCard:(0,W.useCallback)(t=>{if(t<=0||t>=a.length||l)return;e&&T.current&&(E.current=!0,T.current());let n=a[t];if(!n)return;let r=n.problems,i=r?.problem_number??(/^\d+$/.test(n?.problem_id||``)?parseInt(n.problem_id,10):void 0),s=N(i,r?.id||n?.problem_id,r?.name)?.starter_code||r?.starter_code||``;g(s),o(e=>{let t=e.findIndex(e=>e.id&&e.id===n.id||e===n);return t<=0?e:[e[t],...e.slice(0,t),...e.slice(t+1)]})},[a,l,e]),handleActivateNextMilestone:F,handleResetStarterCode:z}}function le(){return{sandboxRunning:j(e=>e.sandboxRunning),sandboxResults:j(e=>e.sandboxResults),sandboxError:j(e=>e.sandboxError),savingReference:j(e=>e.savingReference),savedRefSuccess:j(e=>e.savedRefSuccess),saveRefError:j(e=>e.saveRefError),handleRunSandbox:j(e=>e.handleRunSandbox),handleSaveReference:j(e=>e.handleSaveReference),resetSandbox:j(e=>e.resetSandbox)}}function ue(){return{aiLoading:j(e=>e.aiLoading),aiResult:j(e=>e.aiResult),aiError:j(e=>e.aiError),explainLoading:j(e=>e.explainLoading),explanationText:j(e=>e.explanationText),explainError:j(e=>e.explainError),aiSolutionLoading:j(e=>e.aiSolutionLoading),aiSolutionError:j(e=>e.aiSolutionError),handleAiEvaluation:j(e=>e.handleAiEvaluation),handleExplainCode:j(e=>e.handleExplainCode),handleFetchAiSolution:j(e=>e.handleFetchAiSolution),resetAiState:j(e=>e.resetAiState)}}var de=({problem:e,totalInQueue:t,reviews:n=[],onSelectCard:r,onOpenCreateProblem:a,onOpenEditProblem:o})=>{let[s,c]=(0,W.useState)(!1),u=(0,W.useRef)(null);(0,W.useEffect)(()=>{let e=e=>{u.current&&!u.current.contains(e.target)&&c(!1)},t=e=>{e.key===`Escape`&&c(!1)};return s&&(document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t)),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[s]);let d=e.problem_number?`https://leetcode.com/problemset/all/?search=${e.problem_number}`:`https://leetcode.com/problemset/all/?search=${encodeURIComponent(e.name||``)}`;return(0,G.jsxs)(`div`,{className:`shrink-0 bg-paper-white border-b-[3px] border-ink-black px-2.5 sm:px-4 py-2 flex flex-wrap items-center justify-between gap-2 shadow-[0_2px_0_0_rgba(30,41,59,0.05)] relative z-40`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 sm:gap-2 flex-wrap min-w-0`,children:[(0,G.jsxs)(`div`,{className:`relative shrink-0`,ref:u,children:[(0,G.jsxs)(`button`,{onClick:()=>c(e=>!e),className:`h-7 inline-flex items-center gap-1.5 px-2 sm:px-2.5 bg-amber-300 hover:bg-amber-200 border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer shrink-0`,title:`Click to view all cards due in today's queue`,children:[(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-emerald-500 animate-ping shrink-0`}),(0,G.jsx)(`span`,{className:`font-arcade text-[8px] sm:text-[9px] font-bold text-ink-black tracking-wide whitespace-nowrap`,children:`CARD 1 OF ${t}`}),t>1&&(0,G.jsx)(l,{className:`w-3 h-3 text-ink-black transition-transform shrink-0 ${s?`rotate-180`:``}`})]}),s&&n.length>0&&(0,G.jsxs)(`div`,{className:`absolute top-9 left-0 z-50 w-64 min-[400px]:w-72 sm:w-80 bg-paper-white border-[3px] border-ink-black gadget-shadow p-3 space-y-2 max-w-[calc(100vw-32px)]`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-b-2 border-ink-black pb-1.5 font-arcade text-[9px] font-bold text-ink-black`,children:[(0,G.jsx)(`span`,{children:`DAILY QUEUE (${n.length} CARDS)`}),(0,G.jsx)(`button`,{onClick:()=>c(!1),className:`px-1 hover:text-rose-600 font-bold cursor-pointer`,title:`Close`,children:`✕`})]}),(0,G.jsx)(`div`,{className:`text-[7.5px] font-arcade text-trash-gray uppercase -mt-0.5`,children:`Click any card to solve it now:`}),(0,G.jsx)(`div`,{className:`max-h-60 overflow-y-auto no-scrollbar space-y-1.5 pr-1`,children:n.map((e,t)=>{let n=e.problems,i=n?.problem_number,a=i==null?void 0:M(i),{cleanTitle:o,approachVariant:s}=oe(n?.name||``,a?.name),l=s?`${o} (${s})`:o,u=t===0,d=n?.difficulty,f=d?d.toUpperCase():`EASY`,p=d===`Easy`?`bg-emerald-600 text-white`:d===`Medium`?`bg-amber-400 text-ink-black`:`bg-rose-600 text-white`;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>{u||r?.(t),c(!1)},className:`group w-full text-left p-2 border-2 border-ink-black text-xs flex items-center justify-between gap-2 cursor-pointer transition-all duration-150 select-none ${u?`bg-amber-100 font-bold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`:`bg-white hover:bg-amber-50 hover:translate-x-0.5 active:translate-y-0.5 active:shadow-none shadow-[2px_2px_0px_0px_rgba(30,41,59,0.25)]`}`,title:u?`Currently active card`:`Jump to #${t+1}: ${l}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 truncate min-w-0`,children:[(0,G.jsxs)(`span`,{className:`font-arcade text-[9px] text-trash-gray shrink-0`,children:[`#`,t+1]}),i!=null&&(0,G.jsxs)(`span`,{className:`font-arcade text-[8px] font-bold px-1 py-0.2 bg-amber-300 border border-ink-black shrink-0`,children:[`LC #`,i]}),(0,G.jsx)(`span`,{className:`truncate`,children:l})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[u?(0,G.jsx)(`span`,{className:`text-[7.5px] font-arcade font-extrabold px-1 py-0.5 bg-amber-300 text-ink-black border border-ink-black shrink-0`,children:`NOW`}):(0,G.jsx)(g,{className:`w-2.5 h-2.5 fill-ink-black text-ink-black opacity-0 group-hover:opacity-100 transition-opacity shrink-0`}),(0,G.jsx)(`span`,{className:`text-[8px] font-arcade font-bold px-1.5 py-0.5 border border-ink-black shrink-0 ${p}`,children:f})]})]},e.id||t)})})]})]}),e.problem_number!==void 0&&e.problem_number!==null&&(0,G.jsx)(`span`,{className:`h-7 inline-flex items-center px-2 font-arcade text-[8px] sm:text-[9px] font-bold bg-amber-200 border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] text-ink-black shrink-0 select-none whitespace-nowrap`,children:e.problem_number>0?`LC #${e.problem_number}`:`CUSTOM`}),(0,G.jsx)(`span`,{className:`h-7 inline-flex items-center px-2 font-arcade text-[8px] sm:text-[9px] font-bold border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] shrink-0 select-none whitespace-nowrap ${e.difficulty===`Easy`?`bg-emerald-600 text-white`:e.difficulty===`Medium`?`bg-amber-400 text-ink-black`:`bg-rose-600 text-white`}`,children:e.difficulty?e.difficulty.toUpperCase():`EASY`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 sm:gap-2 shrink-0 flex-wrap justify-end`,children:[(0,G.jsxs)(`button`,{onClick:a,className:`h-7 inline-flex items-center gap-1 px-2 sm:px-2.5 bg-white hover:bg-purple-50 border-2 border-ink-black text-ink-black text-[8px] sm:text-[9px] font-arcade font-bold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer shrink-0`,title:`Create or Import Problem`,children:[(0,G.jsx)(C,{className:`w-3 h-3 text-purple-600 shrink-0`}),(0,G.jsx)(`span`,{className:`hidden min-[480px]:inline`,children:`ADD`})]}),o&&(0,G.jsxs)(`button`,{onClick:o,className:`h-7 inline-flex items-center gap-1 px-2 sm:px-2.5 bg-white hover:bg-emerald-50 border-2 border-ink-black text-ink-black text-[8px] sm:text-[9px] font-arcade font-bold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer shrink-0`,title:`Edit Problem Specification`,children:[(0,G.jsx)(i,{className:`w-3 h-3 text-emerald-600 shrink-0`}),(0,G.jsx)(`span`,{className:`hidden min-[480px]:inline`,children:`EDIT`})]}),e.google_doc_url&&(0,G.jsxs)(`a`,{href:e.google_doc_url,target:`_blank`,rel:`noreferrer`,className:`h-7 inline-flex items-center gap-1 px-2 sm:px-2.5 bg-white hover:bg-slate-100 border-2 border-ink-black text-ink-black text-[8px] sm:text-[9px] font-arcade font-bold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer shrink-0`,title:`Open Google Doc Notes`,children:[(0,G.jsx)(`span`,{children:`DOC`}),(0,G.jsx)(p,{className:`w-2.5 h-2.5 text-primary shrink-0`})]}),(0,G.jsxs)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,className:`h-7 inline-flex items-center gap-1 px-2 sm:px-2.5 bg-white hover:bg-slate-100 border-2 border-ink-black text-ink-black text-[8px] sm:text-[9px] font-arcade font-bold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer shrink-0`,title:`Search LeetCode`,children:[(0,G.jsx)(`span`,{children:`LC`}),(0,G.jsx)(p,{className:`w-2.5 h-2.5 text-amber-600 shrink-0`})]})]})]})},fe=re.mark({class:`cm-indent-dot cm-indent-dot-primary`}),pe=re.mark({class:`cm-indent-dot cm-indent-dot-secondary`});function me(e){let t=new V;for(let{from:n,to:r}of e.visibleRanges){let i=n;for(;ie.decorations}),ge=H.theme({"&":{backgroundColor:`#0c111d`,color:`#f1f5f9`,height:`100%`,fontSize:`13px`,fontFamily:`var(--font-code, "JetBrains Mono", "Fira Code", monospace)`},".cm-scroller":{overflow:`auto`,fontFamily:`inherit`,lineHeight:`1.65`},".cm-content":{caretColor:`#4ade80`,padding:`12px 0`},"&.cm-focused .cm-cursor":{borderLeftColor:`#4ade80`,borderLeftWidth:`2px`,filter:`drop-shadow(0 0 5px rgba(74, 222, 128, 0.8))`},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:`rgba(56, 189, 248, 0.25) !important`},".cm-gutters":{backgroundColor:`#070a12`,color:`#475569`,borderRight:`2px solid #1e293b`,paddingRight:`6px`,userSelect:`none`},".cm-activeLineGutter":{backgroundColor:`#131b2e`,color:`#38bdf8`,fontWeight:`700`},".cm-activeLine, &.cm-focused .cm-activeLine":{backgroundColor:`#0f172a !important`},".cm-line":{padding:`0 10px`},".cm-indent-dot":{position:`relative`,display:`inline-block`},".cm-indent-dot::before":{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,pointerEvents:`none`,userSelect:`none`,lineHeight:`0`,fontFamily:`monospace`},".cm-indent-dot-primary::before":{content:`"•"`,color:`#38bdf8`,fontSize:`9px`,opacity:`0.85`},".cm-indent-dot-secondary::before":{content:`"·"`,color:`#64748b`,fontSize:`11px`,opacity:`0.5`},"&.cm-focused .cm-matchingBracket, .cm-matchingBracket":{backgroundColor:`rgba(74, 222, 128, 0.2)`,outline:`1px solid #4ade80`,borderRadius:`2px`,color:`#86efac !important`},".cm-placeholder":{color:`#64748b`,fontStyle:`italic`},".cm-scroller::-webkit-scrollbar":{width:`6px`,height:`6px`},".cm-scroller::-webkit-scrollbar-track":{backgroundColor:`#070a12`},".cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:`#1e293b`,borderRadius:`3px`,border:`1px solid #334155`},".cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:`#38bdf8`}}),K=[ne(),ie.of(` `),B.of([U]),he,ge,H.contentAttributes.of({"aria-label":`Python Code Editor`})],_e=[{id:`python`,name:`Python`,version:`3.14`}],ve=({className:e=`w-3.5 h-3.5`})=>(0,G.jsxs)(`svg`,{viewBox:`0 0 128 128`,className:e,xmlns:`http://www.w3.org/2000/svg`,children:[(0,G.jsx)(`path`,{d:`M63.454 4.018c-14.775 0-23.774 6.425-23.774 18.775v13.626h24.168v3.424H30.082C17.518 39.843 8 47.962 8 63.673c0 15.65 8.358 23.486 21.056 23.486h11.905v-16.89c0-13.064 11.233-24.113 24.331-24.113h23.773V32.793c0-11.83-9.988-19.775-23.773-19.775H63.454v-9zm-9.845 7.426a3.84 3.84 0 0 1 3.86 3.84 3.84 3.84 0 0 1-3.86 3.841 3.84 3.84 0 0 1-3.86-3.84 3.84 3.84 0 0 1 3.86-3.841z`,fill:`#387eb8`}),(0,G.jsx)(`path`,{d:`M64.546 123.982c14.775 0 23.774-6.425 23.774-18.775V91.581H64.152v-3.424h33.766c12.564 0 22.082-8.119 22.082-23.83 0-15.65-8.358-23.486-21.056-23.486H87.04v16.89c0 13.064-11.234 24.113-24.332 24.113H38.934v13.363c0 11.83 9.989 19.775 23.774 19.775h1.838v9zm9.845-7.426a3.84 3.84 0 0 1-3.86-3.84 3.84 3.84 0 0 1 3.86-3.841 3.84 3.84 0 0 1 3.86 3.84 3.84 3.84 0 0 1-3.86 3.841z`,fill:`#ffe052`})]}),ye=({mobileView:e,isNarrow:t=!1,isAutocompleteEnabled:r,onToggleAutocomplete:i,onResetStarterCode:c,code:u,onChangeCode:d,sandboxRunning:h,sandboxError:v,sandboxResults:b,onRunSandbox:C,savingReference:E,savedRefSuccess:D,saveRefError:O,onSaveReference:k,aiLoading:A,aiError:j,aiResult:M,onAiEvaluation:N,optimalTime:P,optimalSpace:F,onPushToGitHub:I,pushingToGitHub:L,githubPushedUrl:R,githubPushError:z})=>{let[B,te]=(0,W.useState)(`python`),[V,H]=(0,W.useState)(!1),U=(0,W.useRef)(null);(0,W.useEffect)(()=>{let e=e=>{U.current&&!U.current.contains(e.target)&&H(!1)},t=e=>{e.key===`Escape`&&H(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[]);let ne=_e.find(e=>e.id===B)??_e[0];return(0,G.jsxs)(`div`,{className:`w-full ${t?`flex flex-1`:`lg:w-[51%] flex`} flex-col bg-[#fffdfa] overflow-y-auto no-scrollbar ${t&&e!==`code`?`hidden`:`flex`}`,children:[(0,G.jsxs)(`div`,{className:`shrink-0 bg-[#f7f5ed] border-b-2 border-ink-black p-2 sm:px-3 flex flex-wrap items-center justify-between gap-1.5 sm:gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 sm:gap-2 flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`relative`,ref:U,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>H(e=>!e),className:`h-7 px-2.5 bg-white hover:bg-slate-100 border-2 border-ink-black shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none flex items-center gap-1.5 font-arcade text-[9px] font-bold text-ink-black cursor-pointer transition-all select-none`,title:`Select programming language`,"aria-expanded":V,"aria-haspopup":`listbox`,children:[(0,G.jsx)(ve,{className:`w-3.5 h-3.5 shrink-0`}),(0,G.jsx)(`span`,{children:ne.name}),(0,G.jsx)(l,{className:`w-3 h-3 text-ink-black transition-transform duration-150 ${V?`rotate-180`:``}`})]}),V&&(0,G.jsxs)(`div`,{className:`absolute top-full mt-1.5 left-0 z-50 w-52 bg-paper-white border-[3px] border-ink-black gadget-shadow p-1.5 space-y-1`,role:`listbox`,children:[(0,G.jsx)(`div`,{className:`px-2 py-1 text-[8px] font-arcade font-bold text-trash-gray uppercase border-b border-slate-200`,children:`SELECT LANGUAGE`}),_e.map(e=>{let t=B===e.id;return(0,G.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t,onClick:()=>{te(e.id),H(!1)},className:`w-full flex items-center justify-between px-2.5 py-1.5 border-2 border-ink-black text-left transition-all cursor-pointer ${t?`bg-amber-200 shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] font-bold text-ink-black`:`bg-white hover:bg-slate-100 text-slate-800`}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 font-arcade text-[9px]`,children:[(0,G.jsx)(ve,{className:`w-3.5 h-3.5 shrink-0`}),(0,G.jsx)(`span`,{children:e.name})]}),(0,G.jsxs)(`span`,{className:`font-mono text-[8px] font-bold px-1.5 py-0.5 bg-white border border-ink-black text-slate-700 shadow-[1px_1px_0px_0px_rgba(30,41,59,0.3)]`,children:[`v`,e.version]})]},e.id)})]})]}),(0,G.jsx)(`div`,{className:`h-4 w-[2px] bg-slate-300 mx-0.5 hidden sm:block`}),(0,G.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 cursor-pointer select-none`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:r,onChange:e=>i(e.target.checked),className:`sr-only peer`,"aria-label":`Toggle code editor autocompletion`}),(0,G.jsx)(`div`,{className:`relative w-7 h-3.5 bg-slate-300 border border-ink-black rounded-full peer peer-checked:bg-grass-green transition-all after:content-[''] after:absolute after:top-[1px] after:left-[2px] after:bg-white after:border after:border-ink-black after:rounded-full after:h-2 after:w-2 after:transition-all peer-checked:after:translate-x-3`}),(0,G.jsx)(`span`,{className:`text-[7.5px] min-[400px]:text-[8px] font-arcade font-bold text-trash-gray peer-checked:text-ink-black whitespace-nowrap`,children:`AUTOCOMPLETE`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 sm:gap-2`,children:[(0,G.jsx)(`button`,{onClick:c,className:`w-7 h-7 bg-white hover:bg-slate-100 border-2 border-ink-black shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none text-ink-black flex items-center justify-center cursor-pointer transition-all`,title:`Reset to starter code`,"aria-label":`Reset to starter code`,children:(0,G.jsx)(n,{className:`w-3.5 h-3.5`})}),(0,G.jsx)(`button`,{onClick:()=>d(``),className:`w-7 h-7 bg-white hover:bg-rose-50 border-2 border-ink-black shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none text-rose-700 flex items-center justify-center cursor-pointer transition-all`,title:`Clear editor`,"aria-label":`Clear editor`,children:(0,G.jsx)(m,{className:`w-3.5 h-3.5 text-rose-600`})}),k&&(0,G.jsx)(`button`,{onClick:k,disabled:E||!u.trim(),className:`w-7 h-7 border-2 border-ink-black shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none flex items-center justify-center cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed transition-all ${D?`bg-emerald-600 hover:bg-emerald-500 text-white`:`bg-amber-400 hover:bg-amber-300 text-ink-black`}`,title:E?`Saving solution to personal database...`:D?`Saved to personal database!`:`Overwrite saved solution with studio code`,"aria-label":`Overwrite saved solution with studio code`,children:E?(0,G.jsx)(_,{className:`w-3.5 h-3.5 animate-spin text-ink-black`}):D?(0,G.jsx)(f,{className:`w-3.5 h-3.5 text-white`}):(0,G.jsx)(o,{className:`w-3.5 h-3.5 text-ink-black`})}),I&&(0,G.jsx)(`button`,{onClick:I,disabled:L||!u.trim(),className:`w-7 h-7 bg-[#24292e] hover:bg-black border-2 border-ink-black shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none text-white flex items-center justify-center cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed transition-all`,title:L?`Pushing to GitHub...`:`Push solution to GitHub repository`,"aria-label":`Push to GitHub`,children:L?(0,G.jsx)(_,{className:`w-3.5 h-3.5 animate-spin text-yellow-300`}):(0,G.jsx)(s,{className:`w-3.5 h-3.5 text-yellow-300`})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 sm:gap-2`,children:[(0,G.jsx)(`button`,{onClick:C,disabled:h||!u.trim(),className:`w-7 h-7 bg-emerald-600 hover:bg-emerald-500 border-2 border-ink-black shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none text-white flex items-center justify-center cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed transition-all`,title:h?`Running sandbox tests...`:`Run tests in local sandbox`,"aria-label":`Run tests`,children:h?(0,G.jsx)(_,{className:`w-3.5 h-3.5 animate-spin`}):(0,G.jsx)(g,{className:`w-3.5 h-3.5 fill-white text-white ml-0.5`})}),(0,G.jsx)(`button`,{onClick:N,disabled:A||!u.trim(),className:`w-7 h-7 bg-purple-600 hover:bg-purple-500 border-2 border-ink-black shadow-[1px_1px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none text-white flex items-center justify-center cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed transition-all`,title:A?`Evaluating code with Gemini...`:`Gemini Eval (AI code review & complexity)`,"aria-label":`Gemini Eval`,children:A?(0,G.jsx)(_,{className:`w-3.5 h-3.5 animate-spin`}):(0,G.jsx)(w,{className:`w-3.5 h-3.5 text-amber-300`})})]})]}),(0,G.jsxs)(`div`,{className:`p-4 sm:p-5 flex-1 flex flex-col space-y-4`,children:[(0,G.jsx)(`div`,{className:`flex-1 flex flex-col min-h-[300px] sm:min-h-[360px] border-[3px] border-ink-black shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] bg-[#0c111d] overflow-hidden`,children:(0,G.jsx)(`div`,{className:`flex-1 overflow-hidden relative`,children:(0,G.jsx)(x,{value:u,onChange:d,placeholder:`def solve(nums): + # Write your solution from memory here...`,height:`100%`,theme:`dark`,extensions:K,basicSetup:{autocompletion:r,lineNumbers:!0,foldGutter:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0},className:`w-full h-full text-xs font-code-mono`})})}),D&&(0,G.jsxs)(`div`,{className:`p-3 bg-[#f0fdf4] border-2 border-emerald-600 text-emerald-950 text-xs font-semibold flex items-center gap-2 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,G.jsx)(f,{className:`w-4 h-4 text-emerald-600 shrink-0`}),(0,G.jsx)(`span`,{children:`Successfully saved studio code as your personal reference solution!`})]}),O&&(0,G.jsxs)(`div`,{className:`p-3 bg-rose-50 border-2 border-rose-500 text-rose-800 text-xs font-semibold flex items-center gap-2 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,G.jsx)(S,{className:`w-4 h-4 text-rose-600 shrink-0`}),(0,G.jsx)(`span`,{children:O})]}),R&&(0,G.jsxs)(`div`,{className:`p-3 bg-[#f0fdf4] border-2 border-emerald-600 text-emerald-950 text-xs font-semibold flex items-center justify-between shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(f,{className:`w-4 h-4 text-emerald-600 shrink-0`}),(0,G.jsx)(`span`,{children:`Successfully pushed solution to your GitHub repository!`})]}),(0,G.jsxs)(`a`,{href:R,target:`_blank`,rel:`noopener noreferrer`,className:`text-[11px] font-bold text-blue-700 hover:text-blue-900 underline flex items-center gap-1`,children:[(0,G.jsx)(`span`,{children:`View on GitHub`}),(0,G.jsx)(p,{className:`w-3 h-3`})]})]}),z&&(0,G.jsxs)(`div`,{className:`p-3 bg-rose-50 border-2 border-rose-500 text-rose-800 text-xs font-semibold flex items-center gap-2 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,G.jsx)(S,{className:`w-4 h-4 text-rose-600 shrink-0`}),(0,G.jsx)(`span`,{children:z})]}),h&&(0,G.jsxs)(`div`,{className:`p-3 border-2 border-ink-black bg-emerald-50 shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] flex items-center gap-3 animate-pulse`,children:[(0,G.jsx)(_,{className:`w-5 h-5 text-emerald-600 animate-spin shrink-0`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`font-arcade text-[9px] font-bold text-ink-black uppercase`,children:`Running...`}),(0,G.jsx)(`p`,{className:`font-sans text-[11px] text-trash-gray font-semibold mt-0.5`,children:`Executing against test cases...`})]})]}),v&&(0,G.jsxs)(`div`,{className:`p-3 border-2 border-rose-500 bg-rose-50 text-rose-800 text-xs font-semibold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] flex items-center gap-2`,children:[(0,G.jsx)(S,{className:`w-4 h-4 text-rose-600 shrink-0`}),(0,G.jsx)(`span`,{children:v})]}),b&&(0,G.jsxs)(`div`,{className:`border-[3px] border-ink-black p-4 sm:p-5 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] space-y-3.5 ${b.status===`passed`?`bg-[#f0fdf4]`:`bg-[#fff1f2]`}`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-2 pb-2.5 border-b-2 border-dashed border-ink-black`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,G.jsx)(`div`,{className:`w-8 h-8 border-2 border-ink-black flex items-center justify-center font-bold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] ${b.status===`passed`?`bg-grass-green text-ink-black`:`bg-rose-500 text-white`}`,children:b.status===`passed`?(0,G.jsx)(T,{className:`w-5 h-5 stroke-[3]`}):(0,G.jsx)(S,{className:`w-4 h-4`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-arcade text-[10px] font-bold text-ink-black flex items-center gap-1.5 uppercase`,children:b.status===`passed`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{children:`ALL TESTS PASSED`}),(0,G.jsx)(f,{className:`w-3.5 h-3.5 text-emerald-600 inline`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{children:b.status===`error`?`EXECUTION ERROR`:`TESTS FAILED`}),(0,G.jsx)(y,{className:`w-3.5 h-3.5 text-rose-600 inline`})]})}),(0,G.jsxs)(`div`,{className:`font-sans text-[11px] text-slate-600 font-semibold`,children:[b.passed_count??0,` of `,b.total_tests??0,` test cases passed (`,(b.duration_ms??0).toFixed(1),`ms)`]})]})]}),b.status===`passed`&&(0,G.jsxs)(`button`,{onClick:k,disabled:E,className:`px-3 py-1.5 bg-white hover:bg-emerald-100 border-2 border-ink-black text-ink-black font-arcade text-[8px] font-bold flex items-center gap-1.5 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer shrink-0 disabled:opacity-50`,children:[E?(0,G.jsx)(_,{className:`w-3 h-3 animate-spin`}):D?(0,G.jsx)(f,{className:`w-3.5 h-3.5 text-emerald-600`}):(0,G.jsx)(o,{className:`w-3.5 h-3.5 text-blue-600`}),(0,G.jsx)(`span`,{children:D?`SAVED TO DB!`:`SAVE AS OFFICIAL SOLUTION`})]})]}),O&&(0,G.jsx)(`div`,{className:`p-2 border border-rose-500 bg-rose-100 text-rose-800 text-[11px] font-semibold`,children:O}),b.results&&b.results.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`span`,{className:`font-arcade text-[8px] text-trash-gray uppercase font-bold block`,children:`TEST CASE BREAKDOWN:`}),(0,G.jsx)(`div`,{className:`space-y-1.5 max-h-56 overflow-y-auto custom-scrollbar`,children:b.results.map((e,t)=>(0,G.jsxs)(`div`,{className:`p-2.5 border-2 border-ink-black text-xs font-mono shadow-[2px_2px_0px_0px_rgba(30,41,59,0.3)] ${e.passed?`bg-white`:`bg-rose-50`}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between font-arcade text-[8px] mb-1`,children:[(0,G.jsxs)(`span`,{className:`font-bold text-ink-black`,children:[`CASE #`,t+1]}),(0,G.jsx)(`span`,{className:e.passed?`text-emerald-700 font-bold`:`text-rose-700 font-bold`,children:e.passed?`✓ PASSED`:`✗ FAILED`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-1.5 text-[10px]`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-slate-500 block`,children:`Input:`}),(0,G.jsx)(`span`,{className:`font-code-mono text-ink-black font-semibold break-all`,children:JSON.stringify(e.input)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-slate-500 block`,children:`Expected:`}),(0,G.jsx)(`span`,{className:`font-code-mono text-emerald-700 font-semibold break-all`,children:JSON.stringify(e.expected)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-slate-500 block`,children:`Output:`}),(0,G.jsx)(`span`,{className:`font-code-mono font-semibold break-all ${e.passed?`text-emerald-700`:`text-rose-700`}`,children:e.output===void 0?`None`:JSON.stringify(e.output)})]})]}),e.error&&(0,G.jsx)(`div`,{className:`mt-1.5 p-1.5 bg-rose-100 text-rose-900 text-[10px] font-mono border border-rose-300 break-all`,children:e.error})]},t))})]}),b.error&&(0,G.jsx)(`div`,{className:`p-3 bg-[#1E293B] text-rose-400 font-code-mono text-[11px] border-2 border-ink-black overflow-x-auto whitespace-pre-wrap select-text`,children:b.error}),b.status===`passed`&&(0,G.jsx)(`div`,{className:`p-2 bg-emerald-100/70 border border-emerald-300 text-emerald-900 text-xs flex items-center justify-between`,children:(0,G.jsx)(`span`,{className:`font-sans font-medium`,children:`✨ All unit tests passed. Rate your recall below.`})})]}),A&&(0,G.jsxs)(`div`,{className:`p-4 border-2 border-ink-black bg-amber-50 shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] flex items-center gap-3 animate-pulse`,children:[(0,G.jsx)(_,{className:`w-6 h-6 text-purple-600 animate-spin shrink-0`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`font-arcade text-[9px] font-bold text-ink-black uppercase`,children:`ANALYZING...`}),(0,G.jsx)(`p`,{className:`font-sans text-[11px] text-trash-gray font-semibold mt-0.5`,children:`Checking edge cases, bounds, and Big-O efficiency against optimal constraints...`})]})]}),j&&(0,G.jsx)(`div`,{className:`p-3 border-2 border-rose-500 bg-rose-50 text-rose-800 text-xs font-semibold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:j}),M&&(0,G.jsxs)(`div`,{className:`border-[3px] border-ink-black bg-[#fefce8] p-4 sm:p-5 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between pb-3 border-b-2 border-dashed border-ink-black`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-9 h-9 border-2 border-ink-black flex items-center justify-center font-bold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] ${M.is_correct?`bg-grass-green text-ink-black`:`bg-rose-500 text-white`}`,children:M.is_correct?(0,G.jsx)(T,{className:`w-5 h-5 stroke-[3]`}):(0,G.jsx)(a,{className:`w-5 h-5`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`font-arcade text-[10px] font-bold text-ink-black flex items-center gap-1.5`,children:M.is_correct?(0,G.jsxs)(G.Fragment,{children:[`STATUS: PASSED`,(0,G.jsx)(f,{className:`w-3.5 h-3.5 text-emerald-600 inline`})]}):(0,G.jsxs)(G.Fragment,{children:[`STATUS: FAILED`,(0,G.jsx)(y,{className:`w-3.5 h-3.5 text-rose-600 inline`})]})}),(0,G.jsx)(`span`,{className:`font-sans text-[11px] text-slate-600 font-semibold`,children:M.is_correct?`Algorithm matches expected logic and patterns.`:`Bugs or edge-case failures detected.`})]})]}),(0,G.jsx)(`span`,{className:`font-arcade text-[9px] px-2 py-1 border-2 border-ink-black uppercase font-bold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] ${M.is_correct?`bg-emerald-100 text-emerald-800`:`bg-rose-100 text-rose-800`}`,children:M.is_correct?`CORRECT`:`INCORRECT`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,G.jsxs)(`div`,{className:`p-2.5 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,G.jsx)(`span`,{className:`font-arcade text-[8px] text-trash-gray block uppercase font-bold`,children:`Time Complexity`}),(0,G.jsxs)(`div`,{className:`flex items-baseline gap-2 mt-1`,children:[(0,G.jsx)(`span`,{className:`font-code-mono text-xs font-bold text-ink-black`,children:M.detected_complexity?.time||`N/A`}),(0,G.jsxs)(`span`,{className:`text-[10px] font-sans text-slate-500 font-semibold`,children:[`(Target: `,P||`O(N)`,`)`]})]})]}),(0,G.jsxs)(`div`,{className:`p-2.5 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,G.jsx)(`span`,{className:`font-arcade text-[8px] text-trash-gray block uppercase font-bold`,children:`Space Complexity`}),(0,G.jsxs)(`div`,{className:`flex items-baseline gap-2 mt-1`,children:[(0,G.jsx)(`span`,{className:`font-code-mono text-xs font-bold text-ink-black`,children:M.detected_complexity?.space||`N/A`}),(0,G.jsxs)(`span`,{className:`text-[10px] font-sans text-slate-500 font-semibold`,children:[`(Target: `,F||`O(1)`,`)`]})]})]})]}),M.bugs&&M.bugs.length>0&&(0,G.jsxs)(`div`,{className:`p-3 bg-white border-2 border-ink-black space-y-1.5 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,G.jsxs)(`span`,{className:`font-arcade text-[8px] text-rose-600 uppercase font-bold block flex items-center gap-1`,children:[(0,G.jsx)(S,{className:`w-3 h-3 text-rose-500`}),`TRACES & EDGE CASE ISSUES:`]}),(0,G.jsx)(`ul`,{className:`list-disc list-inside text-xs text-slate-800 space-y-1 font-semibold pl-1`,children:M.bugs.map((e,t)=>(0,G.jsx)(`li`,{className:`leading-relaxed select-text`,children:e},t))})]}),M.key_suggestion&&(0,G.jsxs)(`div`,{className:`p-3 bg-amber-50 border-2 border-ink-black space-y-1 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,G.jsxs)(`span`,{className:`font-arcade text-[8px] text-amber-700 uppercase font-bold block flex items-center gap-1`,children:[(0,G.jsx)(w,{className:`w-3 h-3 text-amber-500`}),`TIP:`]}),(0,G.jsx)(`p`,{className:`text-xs text-slate-800 font-medium leading-relaxed m-0 select-text`,children:M.key_suggestion})]}),(0,G.jsxs)(`div`,{className:`p-2.5 bg-white border-2 border-dashed border-ink-black flex items-center justify-between`,children:[(0,G.jsxs)(`span`,{className:`text-xs font-bold text-ink-black flex items-center gap-1.5`,children:[(0,G.jsx)(ee,{className:`w-4 h-4 text-primary`}),`Recommendation:`]}),(0,G.jsx)(`span`,{className:`font-arcade text-[9px] font-bold text-purple-700`,children:M.is_correct?`Rate your recall below.`:`Review issues and rate recall below.`})]})]})]})]})},be=({gradeError:e,onDismissGradeError:t,submitting:n,submittingRating:r,onGrade:i})=>(0,G.jsx)(`div`,{className:`shrink-0 bg-[#f8f5eb] border-t-[3px] border-ink-black p-2 sm:p-3 flex flex-col items-stretch gap-1.5 sm:gap-2 shadow-[0_-3px_0_0_rgba(30,41,59,0.08)]`,children:(0,G.jsxs)(`div`,{className:`w-full flex flex-col`,children:[e&&(0,G.jsxs)(`div`,{className:`p-2.5 mb-2 bg-red-100 border-2 border-red-500 text-red-800 text-xs font-semibold shadow-[2px_2px_0px_0px_#1E293B] flex items-center justify-between`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(S,{className:`w-4 h-4 text-red-600 shrink-0`}),e]}),(0,G.jsx)(`button`,{onClick:t,className:`text-red-900 font-bold hover:underline cursor-pointer ml-2 text-xs`,children:`Dismiss`})]}),(0,G.jsxs)(`div`,{className:`flex gap-1.5 sm:gap-2.5 w-full`,children:[(0,G.jsx)(`button`,{onClick:()=>i(1),disabled:n,className:`flex-1 min-w-0 bg-[#dc2626] hover:bg-[#b91c1c] border-2 sm:border-[3px] border-ink-black py-2 sm:py-2.5 px-1 sm:px-2 arcade-btn cursor-pointer disabled:opacity-60 text-white flex flex-col items-center justify-center font-bold transition-all select-none`,title:`Press 1 on keyboard`,children:r===1?(0,G.jsx)(`div`,{className:`flex items-center gap-1.5 font-arcade text-[10px]`,children:(0,G.jsx)(_,{className:`w-3.5 h-3.5 animate-spin`})}):(0,G.jsxs)(`div`,{className:`flex items-center gap-1 font-headline-md text-[10px] min-[400px]:text-xs sm:text-sm font-extrabold tracking-wide uppercase truncate`,children:[(0,G.jsx)(`span`,{className:`font-arcade text-[8px] sm:text-[9px] px-1 py-0.5 bg-black/20 rounded shrink-0`,children:`1`}),(0,G.jsx)(`span`,{className:`truncate`,children:`Again`})]})}),(0,G.jsx)(`button`,{onClick:()=>i(2),disabled:n,className:`flex-1 min-w-0 bg-[#ff9933] hover:bg-[#ff8000] border-2 sm:border-[3px] border-ink-black py-2 sm:py-2.5 px-1 sm:px-2 arcade-btn cursor-pointer disabled:opacity-60 text-ink-black flex flex-col items-center justify-center font-bold transition-all select-none`,title:`Press 2 on keyboard`,children:r===2?(0,G.jsx)(`div`,{className:`flex items-center gap-1.5 font-arcade text-[10px]`,children:(0,G.jsx)(_,{className:`w-3.5 h-3.5 animate-spin text-ink-black`})}):(0,G.jsxs)(`div`,{className:`flex items-center gap-1 font-headline-md text-[10px] min-[400px]:text-xs sm:text-sm font-extrabold tracking-wide uppercase truncate`,children:[(0,G.jsx)(`span`,{className:`font-arcade text-[8px] sm:text-[9px] px-1 py-0.5 bg-black/10 rounded shrink-0`,children:`2`}),(0,G.jsx)(`span`,{className:`truncate`,children:`Hard`})]})}),(0,G.jsx)(`button`,{onClick:()=>i(3),disabled:n,className:`flex-1 min-w-0 bg-[#4ade80] hover:bg-[#22c55e] border-2 sm:border-[3px] border-ink-black py-2 sm:py-2.5 px-1 sm:px-2 arcade-btn cursor-pointer disabled:opacity-60 text-ink-black flex flex-col items-center justify-center font-bold transition-all select-none`,title:`Press 3 on keyboard`,children:r===3?(0,G.jsx)(`div`,{className:`flex items-center gap-1.5 font-arcade text-[10px]`,children:(0,G.jsx)(_,{className:`w-3.5 h-3.5 animate-spin text-ink-black`})}):(0,G.jsxs)(`div`,{className:`flex items-center gap-1 font-headline-md text-[10px] min-[400px]:text-xs sm:text-sm font-extrabold tracking-wide uppercase truncate`,children:[(0,G.jsx)(`span`,{className:`font-arcade text-[8px] sm:text-[9px] px-1 py-0.5 bg-black/10 rounded shrink-0`,children:`3`}),(0,G.jsx)(`span`,{className:`truncate`,children:`Good`})]})}),(0,G.jsx)(`button`,{onClick:()=>i(4),disabled:n,className:`flex-1 min-w-0 bg-[#60a5fa] hover:bg-[#3b82f6] border-2 sm:border-[3px] border-ink-black py-2 sm:py-2.5 px-1 sm:px-2 arcade-btn cursor-pointer disabled:opacity-60 text-ink-black flex flex-col items-center justify-center font-bold transition-all select-none`,title:`Press 4 on keyboard`,children:r===4?(0,G.jsx)(`div`,{className:`flex items-center gap-1.5 font-arcade text-[10px]`,children:(0,G.jsx)(_,{className:`w-3.5 h-3.5 animate-spin text-ink-black`})}):(0,G.jsxs)(`div`,{className:`flex items-center gap-1 font-headline-md text-[10px] min-[400px]:text-xs sm:text-sm font-extrabold tracking-wide uppercase truncate`,children:[(0,G.jsx)(`span`,{className:`font-arcade text-[8px] sm:text-[9px] px-1 py-0.5 bg-black/10 rounded shrink-0`,children:`4`}),(0,G.jsx)(`span`,{className:`truncate`,children:`Easy`})]})})]})]})}),xe=({nextMilestone:e,activatingMilestone:t,onActivateNextMilestone:r,onOpenOnboarding:i,onOpenJourney:a,onOpenCreateProblem:o,onOpenWindow:s,overrideProblemId:c,onClearOverride:l,hasCustomOnboardingModal:d,isOnboardingOpen:f,onCloseOnboarding:p,onCompletedOnboarding:m,currentUserId:g})=>(0,G.jsx)(`div`,{className:`w-full h-full flex items-center justify-center bg-[#fdf8e1] p-6 overflow-y-auto custom-scrollbar`,children:(0,G.jsxs)(`div`,{className:`w-full max-w-lg bg-paper-white border-[4px] border-ink-black gadget-shadow p-6 sm:p-8 relative overflow-hidden text-center space-y-6`,children:[(0,G.jsx)(`div`,{className:`absolute top-0 left-0 right-0 h-3 bg-gradient-to-r from-grass-green via-amber-300 to-highlight-pink`}),(0,G.jsxs)(`div`,{className:`relative inline-block mt-2`,children:[(0,G.jsx)(`div`,{className:`w-20 h-20 bg-amber-300 border-[3px] border-ink-black rounded-2xl flex items-center justify-center mx-auto gadget-shadow rotate-[-3deg] hover:rotate-0 transition-transform`,children:(0,G.jsx)(v,{className:`w-10 h-10 text-ink-black stroke-[2.5]`})}),(0,G.jsx)(`div`,{className:`absolute -bottom-2 -right-2 bg-grass-green border-2 border-ink-black px-2 py-0.5 font-arcade text-[8px] text-ink-black font-bold uppercase shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:`100% DONE`})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2.5 py-1 bg-emerald-100 border-2 border-ink-black text-emerald-800 font-arcade text-[9px] font-bold`,children:[(0,G.jsx)(T,{className:`w-3 h-3 stroke-[3]`}),` ALL CARDS COMPLETED FOR TODAY`]}),(0,G.jsx)(`h2`,{className:`text-2xl sm:text-3xl font-extrabold text-ink-black font-headline-md tracking-tight`,children:`You're all caught up for today. Keep it up.`}),(0,G.jsx)(`p`,{className:`text-xs sm:text-sm font-sans text-trash-gray max-w-md mx-auto leading-relaxed font-semibold`,children:`All reviews for today are finished. Next reviews are scheduled for tomorrow.`})]}),e&&(0,G.jsxs)(`div`,{className:`p-4 sm:p-5 bg-gradient-to-br from-amber-50 to-orange-50 border-[3px] border-ink-black gadget-shadow text-left space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`span`,{className:`font-arcade text-[9px] font-bold text-amber-800 uppercase tracking-wider flex items-center gap-1.5`,children:[(0,G.jsx)(b,{className:`w-3.5 h-3.5 text-amber-600`}),`NEXT UNEXPLORED MILESTONE`]}),(0,G.jsxs)(`span`,{className:`font-mono text-[10px] font-bold px-2 py-0.5 rounded bg-amber-900/10 text-amber-900 border border-amber-900/20`,children:[`LC #`,e.problem_number]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`h3`,{className:`font-headline-md text-base sm:text-lg font-bold text-ink-black truncate`,children:e.name}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mt-1 flex-wrap`,children:[(0,G.jsx)(`span`,{className:`px-2 py-0.5 rounded font-arcade text-[8px] font-bold uppercase text-white ${e.difficulty===`Easy`?`bg-emerald-600`:e.difficulty===`Medium`?`bg-amber-600`:`bg-rose-600`}`,children:e.difficulty}),(0,G.jsx)(`span`,{className:`px-2 py-0.5 rounded font-arcade text-[8px] bg-purple-100 text-purple-800 border border-purple-300 font-bold`,children:e.pattern}),(0,G.jsxs)(`span`,{className:`text-[11px] font-code-mono text-slate-600`,children:[`T: `,e.time_complexity,` | S: `,e.space_complexity]})]})]}),(0,G.jsx)(`button`,{onClick:r,disabled:t,className:`px-4 py-2.5 bg-grass-green hover:bg-emerald-400 text-ink-black font-arcade text-[9px] font-bold border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer shrink-0 flex items-center justify-center gap-1.5 disabled:opacity-50`,children:t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(_,{className:`w-3.5 h-3.5 animate-spin`}),(0,G.jsx)(`span`,{children:`ACTIVATING...`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(w,{className:`w-3.5 h-3.5 text-amber-700`}),(0,G.jsx)(`span`,{children:`ACTIVATE & REVIEW NOW`})]})})]})]}),(0,G.jsxs)(`div`,{className:`p-4 sm:p-5 bg-gradient-to-r from-amber-100 via-amber-200 to-yellow-100 border-[3px] border-ink-black gadget-shadow text-left flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`span`,{className:`font-arcade text-[9px] font-bold text-amber-900 uppercase flex items-center gap-1.5`,children:[(0,G.jsx)(u,{className:`w-3.5 h-3.5 text-amber-700`}),`FAST-TRACK EXPEDITION ENROLLMENT`]}),(0,G.jsx)(`h3`,{className:`font-headline-md text-base sm:text-lg font-bold text-ink-black`,children:`Already Solved Problems Elsewhere?`}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-trash-gray font-semibold max-w-md`,children:`Check off problems you've already solved elsewhere to seed your review queue.`})]}),(0,G.jsxs)(`button`,{onClick:i,className:`px-4 py-2.5 bg-amber-400 hover:bg-amber-300 text-ink-black font-arcade text-[9px] font-bold border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer shrink-0 flex items-center gap-1.5`,children:[(0,G.jsx)(u,{className:`w-3.5 h-3.5 text-amber-900`}),(0,G.jsx)(`span`,{children:`OPEN 150-PROBLEM CHECKLIST`})]})]}),(0,G.jsxs)(`div`,{className:`border-t-[3px] border-dashed border-ink-black pt-5 space-y-3`,children:[(0,G.jsx)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold text-left`,children:`CONTINUE PRACTICING:`}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2.5`,children:[(0,G.jsxs)(`button`,{onClick:a,className:`p-3 bg-amber-100 hover:bg-amber-200 border-[3px] border-ink-black text-left flex flex-col justify-between gadget-shadow active:translate-y-1 active:shadow-none transition-all cursor-pointer`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(b,{className:`w-4 h-4 text-amber-600`}),(0,G.jsx)(h,{className:`w-3 h-3 text-ink-black`})]}),(0,G.jsxs)(`div`,{className:`mt-2`,children:[(0,G.jsx)(`div`,{className:`font-arcade text-[8px] font-bold text-ink-black uppercase`,children:`Journey Trail`}),(0,G.jsx)(`div`,{className:`font-sans text-[10px] text-trash-gray font-semibold`,children:`150 Curated nodes`})]})]}),(0,G.jsxs)(`button`,{onClick:o,className:`p-3 bg-purple-100 hover:bg-purple-200 border-[3px] border-ink-black text-left flex flex-col justify-between gadget-shadow active:translate-y-1 active:shadow-none transition-all cursor-pointer`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(C,{className:`w-4 h-4 text-purple-700`}),(0,G.jsx)(h,{className:`w-3 h-3 text-ink-black`})]}),(0,G.jsxs)(`div`,{className:`mt-2`,children:[(0,G.jsx)(`div`,{className:`font-arcade text-[8px] font-bold text-ink-black uppercase`,children:`Add Problem`}),(0,G.jsx)(`div`,{className:`font-sans text-[10px] text-trash-gray font-semibold`,children:`New LeetCode entry`})]})]}),(0,G.jsxs)(`button`,{onClick:()=>s?.(`companion`),className:`p-3 bg-yellow-100 hover:bg-yellow-200 border-[3px] border-ink-black text-left flex flex-col justify-between gadget-shadow active:translate-y-1 active:shadow-none transition-all cursor-pointer`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`material-symbols-outlined text-amber-600 text-lg`,children:`castle`}),(0,G.jsx)(h,{className:`w-3 h-3 text-ink-black`})]}),(0,G.jsxs)(`div`,{className:`mt-2`,children:[(0,G.jsx)(`div`,{className:`font-arcade text-[8px] font-bold text-ink-black uppercase`,children:`Princess Tower`}),(0,G.jsx)(`div`,{className:`font-sans text-[10px] text-trash-gray font-semibold`,children:`Visit Aurelia`})]})]}),(0,G.jsxs)(`button`,{onClick:()=>s?.(`computer`),className:`p-3 bg-cyan-100 hover:bg-cyan-200 border-[3px] border-ink-black text-left flex flex-col justify-between gadget-shadow active:translate-y-1 active:shadow-none transition-all cursor-pointer`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(E,{className:`w-4 h-4 text-cyan-700`}),(0,G.jsx)(h,{className:`w-3 h-3 text-ink-black`})]}),(0,G.jsxs)(`div`,{className:`mt-2`,children:[(0,G.jsx)(`div`,{className:`font-arcade text-[8px] font-bold text-ink-black uppercase`,children:`File Explorer`}),(0,G.jsx)(`div`,{className:`font-sans text-[10px] text-trash-gray font-semibold`,children:`Browse all files`})]})]})]})]}),c&&l&&(0,G.jsxs)(`button`,{onClick:l,className:`mt-3 bg-white hover:bg-slate-100 border-[3px] border-ink-black text-ink-black font-bold px-4 py-2 text-xs uppercase tracking-wide shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer inline-flex items-center gap-2`,children:[(0,G.jsx)(n,{className:`w-3.5 h-3.5`}),` Return to Scheduled Queue`]}),!d&&(0,G.jsx)(z,{isOpen:f,onClose:p,onCompleted:m,userId:g})]})}),Se=e({default:()=>we}),Ce=(0,W.lazy)(()=>F(()=>import(`./ProblemSpecPanel-MCUtP8V_.js`).then(e=>({default:e.ProblemSpecPanel})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])));function we({overrideProblemId:e,onClearOverride:t,onOpenWindow:n,onOpenJourney:r,onOpenCreateProblem:i,onOpenEditProblem:a,onOpenOnboarding:o,refreshTrigger:s}){let[l,u]=(0,W.useState)(null),f=l!==null&&l<780,[p,m]=(0,W.useState)(`spec`),[h,g]=(0,W.useState)(`spec`),[v,y]=(0,W.useState)(null),ee=(0,W.useCallback)(e=>{e&&(u(e.clientWidth),new ResizeObserver(e=>{for(let t of e)u(t.contentRect.width)}).observe(e))},[]),[b,x]=(0,W.useState)(!1),[S,C]=(0,W.useState)(()=>localStorage.getItem(`isAutocompleteEnabled`)!==`false`),{reviews:w,setReviews:T,loading:D,submitting:O,submittingRating:k,gradeError:A,setGradeError:j,code:M,setCode:P,nextMilestone:F,activatingMilestone:R,currentUserId:B,fetchQueue:te,handleGrade:V,handleSelectCard:H,handleActivateNextMilestone:U,handleResetStarterCode:ne}=ce({overrideProblemId:e,refreshTrigger:s,onClearOverride:t,onOpenOnboarding:o,setIsOnboardingOpen:x}),{sandboxRunning:re,sandboxResults:ie,sandboxError:se,savingReference:fe,savedRefSuccess:pe,saveRefError:me,handleRunSandbox:he,handleSaveReference:ge,resetSandbox:K}=le(),{aiLoading:_e,aiResult:ve,aiError:Se,explainLoading:we,explanationText:Te,explainError:Ee,aiSolutionLoading:De,aiSolutionError:Oe,handleAiEvaluation:ke,handleExplainCode:Ae,handleFetchAiSolution:je,resetAiState:q}=ue(),[Me,Ne]=(0,W.useState)(!1),[Pe,Fe]=(0,W.useState)(null),[Ie,J]=(0,W.useState)(null),Le=(0,W.useCallback)(async()=>{if(w.length===0)return;let e=w[0]?.problems||{},t=M.trim()||e.reference_code||``;if(!t){J(`Please write or save code before pushing to GitHub.`),setTimeout(()=>J(null),4e3);return}let r=L();if(!r.token){n&&n(`github`);return}Ne(!0),J(null),Fe(null);try{let n=await I({token:r.token,repo:r.repoName,branch:r.branch,problem_number:e.problem_number,problem_name:e.name||`Algorithm Problem`,pattern:e.pattern||`Algorithms`,difficulty:e.difficulty||`Medium`,optimal_time:e.optimal_time||`O(N)`,optimal_space:e.optimal_space||`O(1)`,description:e.description||``,code:t});Fe(n.html_url),setTimeout(()=>Fe(null),8e3)}catch(e){J(e.message||`Failed to push solution to GitHub.`),setTimeout(()=>J(null),5e3)}finally{Ne(!1)}},[w,M,n]),Re=w[0]?.id||w[0]?.problem_id,ze=(0,W.useRef)(void 0);(0,W.useEffect)(()=>{Re&&ze.current!==Re&&(ze.current=Re,q(),K())},[Re,q,K]);let Y=(0,W.useCallback)(e=>{q(),K(),V(e)},[V,q,K]),Be=(0,W.useCallback)(e=>{q(),K(),H(e)},[H,q,K]);(0,W.useEffect)(()=>{let e=e=>{let t=e.target;t?.closest(`.cm-editor`)||t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable||w.length===0||O||(e.key===`1`?(e.preventDefault(),Y(1)):e.key===`2`?(e.preventDefault(),Y(2)):e.key===`3`?(e.preventDefault(),Y(3)):e.key===`4`&&(e.preventDefault(),Y(4)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Y,w.length,O]);let Ve=(e,t)=>{navigator.clipboard.writeText(e),y(t),setTimeout(()=>y(null),1800)},He=(0,W.useCallback)(()=>{r?r():n?.(`journey`)},[r,n]),Ue=(0,W.useCallback)(()=>{i?i():n?.(`createProblem`)},[i,n]),We=(0,W.useCallback)(()=>{o?o():x(!0)},[o]),Ge=(0,W.useCallback)(e=>{T(t=>{if(t.length===0)return t;let n=[...t],r=n[0];return r&&r.problems&&(r.problems={...r.problems,solutions:e}),n})},[T]);if(D)return(0,G.jsx)(`div`,{className:`w-full h-full flex items-center justify-center bg-[#fdf8e1] text-ink-black`,children:(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-4 p-8 bg-paper-white border-[3px] border-ink-black gadget-shadow text-center max-w-xs`,children:[(0,G.jsx)(`div`,{className:`w-12 h-12 bg-amber-200 border-2 border-ink-black flex items-center justify-center animate-spin`,children:(0,G.jsx)(_,{className:`w-6 h-6 text-ink-black`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-arcade text-xs text-ink-black uppercase tracking-wider font-bold`,children:`LOADING QUEUE`}),(0,G.jsx)(`p`,{className:`font-sans text-[11px] text-trash-gray mt-1 font-semibold`,children:`Fetching scheduled FSRS review cards...`})]})]})});if(w.length===0)return(0,G.jsx)(xe,{nextMilestone:F,activatingMilestone:R,onActivateNextMilestone:U,onOpenOnboarding:We,onOpenJourney:He,onOpenCreateProblem:Ue,onOpenWindow:n,overrideProblemId:e,onClearOverride:t,hasCustomOnboardingModal:!!o,isOnboardingOpen:b,onCloseOnboarding:()=>x(!1),onCompletedOnboarding:te,currentUserId:B});let X=w[0],Z=X?.problems,Ke=Z?.problem_number??(/^\d+$/.test(X?.problem_id||``)?parseInt(X.problem_id,10):void 0),Q=N(Ke,Z?.id||X?.problem_id,Z?.name),{cleanTitle:qe,approachVariant:Je,pattern:Ye}=oe(Z?.name,Q?.name,Z?.pattern,Q?.pattern),$={...Q,...Z,id:Z?.id||Q?.id||X?.problem_id,name:qe,problem_number:Z?.problem_number??Q?.problem_number,pattern:Ye,approach_variant:Je,difficulty:Z?.difficulty||Q?.difficulty||`Medium`,reference_code:Z?.reference_code||Q?.reference_solution||``,starter_code:Q?.starter_code||Z?.starter_code||``,description:Z?.description||Q?.description||``,optimal_time:Z?.optimal_time||Q?.time_complexity||`O(N)`,optimal_space:Z?.optimal_space||Q?.space_complexity||`O(1)`,examples:Z?.examples&&Z.examples.length>0?Z.examples:Q?.examples,constraints:Z?.constraints||Q?.constraints,how_to_solve:Z?.how_to_solve||``,solutions:Z?.solutions&&Z.solutions.length>0?Z.solutions:Q?.solutions},Xe=ae({...Q,...$,examples:$.examples&&$.examples.length>0?$.examples:Q?.examples,constraints:$.constraints&&(Array.isArray($.constraints)?$.constraints.length>0:$.constraints)?$.constraints:Q?.constraints}),Ze=Q?.reference_solution||``,Qe=Z?.reference_code||``,$e=Qe&&(!Ze||Qe.trim()!==Ze.trim())?Qe:``,et=$e||Ze||Qe||``;return(0,G.jsxs)(`div`,{ref:ee,className:`w-full h-full bg-[#fdf8e1] flex flex-col overflow-hidden select-none`,children:[(0,G.jsx)(de,{problem:$,totalInQueue:w.length,reviews:w,overrideProblemId:e,onSelectCard:Be,onOpenCreateProblem:Ue,onOpenEditProblem:()=>{a?a($):n?.(`editProblem`)}}),(0,G.jsxs)(`div`,{className:`${f?`flex`:`hidden`} shrink-0 bg-amber-100 border-b-[3px] border-ink-black px-2.5 sm:px-3 py-1.5 gap-1.5 sm:gap-2 overflow-x-auto no-scrollbar`,children:[(0,G.jsxs)(`button`,{onClick:()=>{g(`spec`),m(`spec`)},className:`px-2.5 sm:px-3 py-1 text-[9px] font-arcade font-bold border-2 border-ink-black transition-all cursor-pointer flex items-center gap-1.5 whitespace-nowrap ${h===`spec`?`bg-paper-white translate-y-0.5 shadow-none text-ink-black`:`bg-white shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] text-trash-gray`}`,children:[(0,G.jsx)(c,{className:`w-3 h-3 shrink-0`}),(0,G.jsx)(`span`,{children:`SPEC`})]}),(0,G.jsxs)(`button`,{onClick:()=>g(`code`),className:`px-2.5 sm:px-3 py-1 text-[9px] font-arcade font-bold border-2 border-ink-black transition-all cursor-pointer flex items-center gap-1.5 whitespace-nowrap ${h===`code`?`bg-paper-white translate-y-0.5 shadow-none text-ink-black`:`bg-white shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] text-trash-gray`}`,children:[(0,G.jsx)(d,{className:`w-3 h-3 shrink-0`}),(0,G.jsx)(`span`,{children:`CODE STUDIO`})]}),(0,G.jsxs)(`button`,{onClick:()=>{g(`ref`),m(`ref`)},className:`px-2.5 sm:px-3 py-1 text-[9px] font-arcade font-bold border-2 border-ink-black transition-all cursor-pointer flex items-center gap-1.5 whitespace-nowrap ${h===`ref`?`bg-paper-white translate-y-0.5 shadow-none text-ink-black`:`bg-white shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] text-trash-gray`}`,children:[(0,G.jsx)(E,{className:`w-3 h-3 shrink-0`}),(0,G.jsx)(`span`,{children:`SOLUTION`})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 flex ${f?`flex-col`:`flex-row`} overflow-hidden min-h-0`,children:[(0,G.jsx)(W.Suspense,{fallback:(0,G.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center p-8 bg-paper-white ${f?`h-64`:`border-r-[4px] border-ink-black`} font-sans text-xs text-trash-gray select-none`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2 font-arcade text-[10px] text-ink-black`,children:[(0,G.jsx)(_,{className:`w-4 h-4 animate-spin text-[#0ea5e9]`}),(0,G.jsx)(`span`,{children:`Loading Problem Spec...`})]})}),children:(0,G.jsx)(Ce,{leftTab:p,onSelectLeftTab:e=>{m(e),e===`ref`?g(`ref`):e===`spec`&&g(`spec`)},mobileView:h,isNarrow:f,problem:$,parsed:Xe,userSolution:$e,officialSolution:Ze,effectiveReferenceCode:et,copiedSnippet:v,onCopyText:Ve,saveRefError:me,aiSolutionLoading:De,aiSolutionError:Oe,onFetchAiSolution:()=>je(X,e=>{T(t=>t.map((t,n)=>n===0?{...t,problems:{...$||{},...t.problems||{},reference_code:e}}:t))}),explainLoading:we,explainError:Ee,explanationText:Te,onExplainCode:(e,t,n,r)=>Ae(X,e,t,n,r),activeReview:X,onUpdateSolutions:Ge,onEditProblem:()=>{a?a($):n?.(`editProblem`)}})}),(0,G.jsx)(ye,{mobileView:h,isNarrow:f,isAutocompleteEnabled:S,onToggleAutocomplete:e=>{C(e),localStorage.setItem(`isAutocompleteEnabled`,String(e))},onResetStarterCode:ne,code:M,onChangeCode:P,sandboxRunning:re,sandboxError:se,sandboxResults:ie,onRunSandbox:()=>he(X,M),savingReference:fe,savedRefSuccess:pe,saveRefError:me,onSaveReference:()=>ge(X,M,(e,t)=>{T(n=>n.map((n,r)=>r===0?{...n,problem_id:t||n.problem_id,problems:{...$||{},...n.problems||{},id:t||n.problems?.id||n.problem_id,reference_code:e}}:n))}),aiLoading:_e,aiError:Se,aiResult:ve,onAiEvaluation:()=>ke(X,M),optimalTime:$.optimal_time||`O(N)`,optimalSpace:$.optimal_space||`O(1)`,onPushToGitHub:Le,pushingToGitHub:Me,githubPushedUrl:Pe,githubPushError:Ie})]}),(0,G.jsx)(be,{gradeError:A,onDismissGradeError:()=>j(null),submitting:O,submittingRating:k,onGrade:Y}),!o&&(0,G.jsx)(z,{isOpen:b,onClose:()=>x(!1),onCompleted:te,userId:B})]})}export{we as default,se as n,Se as t}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/Settings-BFJ9GDP5.js b/algospaced-ui/dist/assets/Settings-BFJ9GDP5.js new file mode 100644 index 0000000000000000000000000000000000000000..9c7f1e1e532c4db061ca35bf15b40501c982f07e --- /dev/null +++ b/algospaced-ui/dist/assets/Settings-BFJ9GDP5.js @@ -0,0 +1 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,D as n,G as r,Lt as i,Q as ee,T as a,X as o,a as s,b as c,dt as l,et as u,it as d,k as f,pt as p,q as m,tt as h,u as g,v as _,zt as v}from"./vendor-react-q-oOktF_.js";import{_ as te,d as y,f as ne,h as b,m as x,p as S}from"./index-Bcgsshpk.js";import{a as C,i as w,n as T,r as E,s as re,t as D}from"./githubSyncService-DQdE4J2L.js";var O=e(v(),1),k=i(),A=[{id:`default`,name:`Default`,desc:`Subject to Availability`},{id:`groq`,name:`Groq`,badge:`Fastest`,desc:`Llama 3.3 & Qwen`,keyPrefix:`gsk_...`,portalUrl:`https://console.groq.com/keys`},{id:`gemini`,name:`Google Gemini`,desc:`Gemini 2.5 / 3.5`,keyPrefix:`AIzaSy...`,portalUrl:`https://aistudio.google.com/app/apikey`},{id:`openrouter`,name:`OpenRouter`,desc:`Multi-Provider`,keyPrefix:`sk-or-v1-...`,portalUrl:`https://openrouter.ai/keys`}];function j(){let[e,i]=(0,O.useState)(()=>localStorage.getItem(`algospaced_custom_ai_provider`)||`default`),[v,j]=(0,O.useState)(()=>localStorage.getItem(`algospaced_custom_api_key`)||localStorage.getItem(`sandbox_gemini_api_key`)||``),[M,N]=(0,O.useState)(!1),[P,F]=(0,O.useState)(null),[I,L]=(0,O.useState)(()=>y()),[R,z]=(0,O.useState)(null),[B,V]=(0,O.useState)(()=>ne().currentFloor),[H,U]=(0,O.useState)(()=>E()),[W,G]=(0,O.useState)(()=>w()),[K,q]=(0,O.useState)(!1),[J,Y]=(0,O.useState)(null),X=!!(H.token&&(H.username||W?.login)),Z=!!(v.trim()&&e!=="default"),Q=e!=="default"&&!v.trim(),$=A.find(t=>t.id===e),ie=e=>{i(e),localStorage.setItem(`algospaced_custom_ai_provider`,e),F(e==="default"?{type:`info`,text:`Switched to Server Default (Shared Pool).`}:{type:`info`,text:`Switched to ${e.toUpperCase()}.`}),setTimeout(()=>F(null),3e3)},ae=()=>{let t=v.trim();if(!t){F({type:`error`,text:`Please enter an API key for ${e.toUpperCase()}.`}),setTimeout(()=>F(null),3e3);return}localStorage.setItem(`algospaced_custom_api_key`,t),localStorage.setItem(`sandbox_gemini_api_key`,t),localStorage.setItem(`algospaced_custom_ai_provider`,e),F({type:`success`,text:`${e.toUpperCase()} API key saved successfully.`}),setTimeout(()=>F(null),3e3)},oe=()=>{localStorage.removeItem(`algospaced_custom_api_key`),localStorage.removeItem(`sandbox_gemini_api_key`),j(``),F({type:`info`,text:`Cleared custom API key.`}),setTimeout(()=>F(null),3e3)},se=()=>{localStorage.removeItem(`algospaced_custom_api_key`),localStorage.removeItem(`sandbox_gemini_api_key`),localStorage.setItem(`algospaced_custom_ai_provider`,`default`),j(``),i(`default`),F({type:`info`,text:`Reset to Server Default provider.`}),setTimeout(()=>F(null),3e3)},ce=()=>{x(I),z({type:`success`,text:`Princess Companion settings saved!`}),setTimeout(()=>z(null),3e3)},le=()=>{L(b),x(b),z({type:`info`,text:`Reset companion to default settings.`}),setTimeout(()=>z(null),3e3)},ue=()=>{if(window.confirm(`Are you sure you want to reset your Spire Journey progress back to 0 problems?`)){let e=S();V(e.currentFloor),z({type:`info`,text:`Spire journey progress reset to 0 problems.`}),setTimeout(()=>z(null),3e3)}},de=async()=>{q(!0),Y(null);try{let{token:e,user:t}=await T();G(t);let n=E();U(n);try{await C(e,n.repoName,n.isPrivate)}catch{}Y({type:`success`,text:`Connected to GitHub as @${t.login}!`}),setTimeout(()=>Y(null),4e3)}catch(e){Y({type:`error`,text:e.message||`GitHub connection failed.`}),setTimeout(()=>Y(null),5e3)}finally{q(!1)}},fe=()=>{D(),U(E()),G(null),Y({type:`info`,text:`Disconnected from GitHub.`}),setTimeout(()=>Y(null),3e3)},pe=e=>{re({autoCommit:e}),U(t=>({...t,autoCommit:e})),Y({type:`info`,text:e?`Auto-commit enabled for review submissions.`:`Auto-commit disabled.`}),setTimeout(()=>Y(null),3e3)};return(0,k.jsxs)(`div`,{className:`w-full h-full bg-[#fdf8e1] p-5 sm:p-6 flex flex-col gap-4 select-none font-sans text-ink-black overflow-y-auto custom-scrollbar`,children:[(0,k.jsxs)(`div`,{className:`flex flex-col gap-0.5 border-b-[3px] border-ink-black pb-2.5`,children:[(0,k.jsxs)(`h3`,{className:`font-headline-md font-bold text-sm m-0 flex items-center gap-2 tracking-wide`,children:[(0,k.jsx)(r,{className:`w-4 h-4 text-ink-black`}),`API & AI Configuration`]}),(0,k.jsx)(`p`,{className:`text-[11px] text-trash-gray font-medium m-0`,children:`Configure your AI model provider..`})]}),(0,k.jsx)(`div`,{className:`px-4 py-3 border-[3px] border-ink-black shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] transition-all ${Z?`bg-emerald-50`:Q?`bg-rose-50`:`bg-amber-50/70`}`,children:(0,k.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[Z?(0,k.jsx)(s,{className:`w-4 h-4 text-emerald-600 shrink-0`}):Q?(0,k.jsx)(p,{className:`w-4 h-4 text-rose-600 shrink-0`}):(0,k.jsx)(h,{className:`w-4 h-4 text-amber-600 shrink-0`}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`text-xs font-bold font-headline-md text-ink-black flex items-center gap-1.5`,children:(0,k.jsxs)(`span`,{children:[`Active:`,` `,Z?`${e.toUpperCase()} (Custom Key)`:Q?`${e.toUpperCase()} (Key Required)`:`Default`]})}),(0,k.jsx)(`div`,{className:`text-[10px] text-trash-gray font-medium`,children:Z?`Requests are routed directly through your personal API key.`:Q?`Enter your API key below to activate this provider.`:`Using basic, free built-in developer keys with auto-failover.`})]})]}),(0,k.jsx)(`span`,{className:`px-2 py-0.5 text-[9px] font-bold font-arcade uppercase border-2 border-ink-black shrink-0 ${Z?`bg-emerald-300 text-emerald-950`:Q?`bg-rose-300 text-rose-950`:`bg-amber-200 text-amber-950`}`,children:Z?`ACTIVE`:Q?`NEEDS KEY`:`LIMITED`})]})}),(0,k.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 sm:p-5 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col gap-4`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsxs)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider mb-2 font-headline-md flex items-center gap-1.5`,children:[(0,k.jsx)(h,{className:`w-3.5 h-3.5 text-ink-black`}),`Select Provider`]}),(0,k.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:A.map(t=>{let n=e===t.id;return(0,k.jsxs)(`button`,{type:`button`,onClick:()=>ie(t.id),className:`p-2.5 border-[2px] text-left transition-all cursor-pointer flex flex-col justify-between rounded ${n?`border-ink-black bg-[#ffe24c] shadow-[2px_2px_0px_0px_#1E293B] font-bold`:`border-slate-300 bg-slate-50 hover:bg-slate-100 text-slate-700`}`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,k.jsx)(`span`,{className:`text-xs font-bold font-headline-md`,children:t.name}),t.badge&&(0,k.jsx)(`span`,{className:`text-[8px] font-bold uppercase px-1 py-0.2 bg-orange-100 text-orange-700 rounded border border-orange-300`,children:t.badge})]}),(0,k.jsx)(`span`,{className:`text-[9px] mt-1 text-slate-600 leading-tight block`,children:t.desc})]},t.id)})})]}),e==="default"?(0,k.jsxs)(`div`,{className:`p-3.5 bg-slate-50 border border-slate-200 rounded flex items-start gap-3`,children:[(0,k.jsx)(g,{className:`w-4 h-4 text-amber-500 shrink-0 mt-0.5`}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-1 text-xs text-slate-700`,children:[(0,k.jsxs)(`span`,{className:`font-bold text-ink-black`,children:[`Shared Quotas (`,(0,k.jsx)(`i`,{children:`limited`}),`)`]}),(0,k.jsx)(`p`,{className:`text-[11px] text-trash-gray m-0 leading-relaxed`,children:`Powered by shared, basic developer keys. Because limits are shared with everyone, requests may fail. Use your own provider keys above for stable performance.`})]})]}):(0,k.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,k.jsxs)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider font-headline-md flex items-center gap-1.5`,children:[(0,k.jsx)(r,{className:`w-3.5 h-3.5 text-ink-black`}),$?.name,` API Key`]}),$?.portalUrl&&(0,k.jsxs)(`a`,{href:$.portalUrl,target:`_blank`,rel:`noopener noreferrer`,className:`text-[10px] text-sky-600 hover:text-sky-800 font-medium flex items-center gap-1 no-underline`,children:[(0,k.jsx)(`span`,{children:`Get API Key`}),(0,k.jsx)(u,{className:`w-3 h-3`})]})]}),(0,k.jsxs)(`div`,{className:`relative`,children:[(0,k.jsx)(`input`,{type:M?`text`:`password`,value:v,onChange:e=>j(e.target.value),placeholder:`Enter ${$?.keyPrefix||`API Key`}`,className:`w-full bg-white border-[2px] border-ink-black rounded py-2 pl-3 pr-9 text-ink-black placeholder-slate-400 focus:outline-none focus:border-sky-600 text-xs font-code-mono`}),(0,k.jsx)(`button`,{type:`button`,onClick:()=>N(!M),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-trash-gray hover:text-ink-black cursor-pointer bg-transparent border-0 outline-none p-1`,title:M?`Hide API key`:`Show API key`,children:M?(0,k.jsx)(t,{className:`w-3.5 h-3.5`}):(0,k.jsx)(ee,{className:`w-3.5 h-3.5`})})]}),(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-trash-gray font-medium`,children:[(0,k.jsx)(c,{className:`w-3.5 h-3.5 text-emerald-600 shrink-0`}),(0,k.jsx)(`span`,{children:`Stored locally in your browser. Sent directly via request headers.`})]}),(0,k.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,k.jsxs)(`button`,{onClick:ae,className:`flex-1 flex items-center justify-center gap-1.5 py-2 border-[2px] border-ink-black bg-[#ffe24c] hover:bg-yellow-300 text-xs font-bold text-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer rounded uppercase`,children:[(0,k.jsx)(a,{className:`w-3.5 h-3.5`}),`Save Key`]}),v&&(0,k.jsx)(`button`,{onClick:oe,className:`px-3 py-2 border-[2px] border-slate-300 bg-white hover:bg-slate-50 text-xs font-bold text-slate-700 hover:text-rose-600 shadow-[2px_2px_0px_0px_rgba(0,0,0,0.05)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer rounded uppercase`,children:`Clear Key`})]})]}),P&&(0,k.jsxs)(`div`,{className:`p-2.5 border-[2px] border-ink-black text-xs font-medium rounded flex items-center gap-2 ${P.type===`success`?`bg-emerald-100 border-emerald-600 text-emerald-900`:P.type===`error`?`bg-rose-100 border-rose-600 text-rose-900`:`bg-sky-100 border-sky-600 text-sky-900`}`,children:[P.type===`success`?(0,k.jsx)(l,{className:`w-3.5 h-3.5 shrink-0`}):P.type===`error`?(0,k.jsx)(p,{className:`w-3.5 h-3.5 shrink-0`}):(0,k.jsx)(m,{className:`w-3.5 h-3.5 shrink-0`}),P.text]}),e!=="default"&&(0,k.jsx)(`div`,{className:`pt-2 border-t border-slate-200 flex justify-end`,children:(0,k.jsxs)(`button`,{onClick:se,className:`flex items-center gap-1.5 py-1.5 px-3 border border-slate-300 bg-slate-50 hover:bg-slate-100 text-[11px] font-bold text-slate-600 hover:text-ink-black transition-all cursor-pointer rounded`,children:[(0,k.jsx)(n,{className:`w-3 h-3 text-slate-500`}),`Reset to Server Default`]})})]}),(0,k.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 sm:p-5 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col gap-4`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between border-b-[2px] border-ink-black pb-3`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,k.jsx)(`div`,{className:`w-8 h-8 rounded bg-[#24292e] border-[2px] border-ink-black flex items-center justify-center text-white shadow-[1px_1px_0px_0px_#1E293B]`,children:(0,k.jsx)(o,{className:`w-4 h-4 text-white`})}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h4`,{className:`font-headline-md font-bold text-xs uppercase text-ink-black m-0 flex items-center gap-2`,children:`GitHub Solutions Sync & Auto-Commit`}),(0,k.jsx)(`p`,{className:`text-[10px] text-trash-gray font-medium m-0`,children:`Sync solutions to personal GitHub repository and commit automatically on submission`})]})]}),(0,k.jsx)(`span`,{className:`px-2 py-0.5 text-[9px] font-bold font-arcade uppercase border-2 border-ink-black shrink-0 ${X?`bg-emerald-300 text-emerald-950`:`bg-slate-200 text-slate-800`}`,children:X?`CONNECTED`:`DISCONNECTED`})]}),X?(0,k.jsxs)(`div`,{className:`space-y-3`,children:[(0,k.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-2 p-3 bg-slate-50 border border-slate-200 rounded`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[W?.avatar_url&&(0,k.jsx)(`img`,{src:W.avatar_url,alt:W.login,className:`w-7 h-7 rounded-full border border-ink-black`}),(0,k.jsxs)(`div`,{children:[(0,k.jsxs)(`span`,{className:`text-xs font-bold text-ink-black`,children:[`@`,W?.login||H.username]}),(0,k.jsxs)(`span`,{className:`text-[11px] text-slate-600 font-mono block`,children:[H.username,`/`,H.repoName,` (`,H.branch,`)`]})]})]}),(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsxs)(`a`,{href:`https://github.com/${H.username}/${H.repoName}`,target:`_blank`,rel:`noopener noreferrer`,className:`px-2.5 py-1 text-[11px] font-bold bg-white hover:bg-slate-100 text-ink-black border border-slate-300 rounded no-underline flex items-center gap-1 cursor-pointer`,children:[(0,k.jsx)(u,{className:`w-3 h-3`}),(0,k.jsx)(`span`,{children:`View Repo`})]}),(0,k.jsx)(`button`,{type:`button`,onClick:fe,className:`px-2.5 py-1 text-[11px] font-bold bg-white hover:bg-rose-50 text-rose-700 border border-rose-300 rounded cursor-pointer`,children:`Disconnect`})]})]}),(0,k.jsxs)(`label`,{className:`flex items-center gap-2.5 p-2.5 bg-emerald-50/50 border border-emerald-300 rounded cursor-pointer`,children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:H.autoCommit,onChange:e=>pe(e.target.checked),className:`w-4 h-4 accent-emerald-600 cursor-pointer`}),(0,k.jsxs)(`div`,{className:`text-xs`,children:[(0,k.jsx)(`span`,{className:`font-bold text-ink-black block`,children:`Auto-commit on every submission`}),(0,k.jsxs)(`span`,{className:`text-[10px] text-trash-gray`,children:[`Automatically pushes your code to `,H.repoName,` whenever you grade a review card.`]})]})]})]}):(0,k.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 p-3.5 bg-slate-50 border border-slate-200 rounded`,children:[(0,k.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,k.jsx)(`span`,{className:`text-xs font-bold text-ink-black block`,children:`Connect your GitHub Account (1-Click OAuth)`}),(0,k.jsx)(`p`,{className:`text-[11px] text-trash-gray m-0`,children:`Grant repository access to automatically sync your DSA problem solutions as you study.`})]}),(0,k.jsx)(`button`,{type:`button`,onClick:de,disabled:K,className:`px-4 py-2 bg-[#24292e] hover:bg-black text-white text-xs font-bold uppercase rounded border-2 border-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none flex items-center gap-2 shrink-0 cursor-pointer disabled:opacity-50`,children:K?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(f,{className:`w-3.5 h-3.5 animate-spin`}),(0,k.jsx)(`span`,{children:`CONNECTING...`})]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(o,{className:`w-3.5 h-3.5 text-yellow-300`}),(0,k.jsx)(`span`,{children:`CONNECT GITHUB`})]})})]}),J&&(0,k.jsxs)(`div`,{className:`p-2.5 border-[2px] border-ink-black text-xs font-medium rounded flex items-center gap-2 ${J.type===`success`?`bg-emerald-100 border-emerald-600 text-emerald-900`:J.type===`error`?`bg-rose-100 border-rose-600 text-rose-900`:`bg-sky-100 border-sky-600 text-sky-900`}`,children:[J.type===`success`?(0,k.jsx)(l,{className:`w-3.5 h-3.5 shrink-0`}):J.type===`error`?(0,k.jsx)(p,{className:`w-3.5 h-3.5 shrink-0`}):(0,k.jsx)(m,{className:`w-3.5 h-3.5 shrink-0`}),J.text]})]}),(0,k.jsxs)(`div`,{className:`bg-[#FFFDF0] border-[3px] border-ink-black p-4 sm:p-5 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col gap-4`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between border-b-[2px] border-ink-black pb-3`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(`div`,{className:`w-7 h-7 rounded bg-[#FFE24C] border-[2px] border-ink-black flex items-center justify-center shadow-[1px_1px_0px_0px_#1E293B]`,children:(0,k.jsx)(_,{className:`w-4 h-4 text-ink-black`})}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h4`,{className:`font-headline-md font-bold text-xs uppercase text-ink-black m-0`,children:`Princess AI Companion & RPG Settings`}),(0,k.jsx)(`p`,{className:`text-[10px] text-trash-gray font-medium m-0`,children:`Trapped Princess Persona, Study Break Timer & 8-bit RPG Audio`})]})]}),(0,k.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,k.jsx)(`span`,{className:`text-[11px] font-bold text-ink-black font-headline-md uppercase`,children:I.enabled?`Enabled`:`Disabled`}),(0,k.jsx)(`input`,{type:`checkbox`,checked:I.enabled,onChange:e=>L(t=>({...t,enabled:e.target.checked})),className:`w-4 h-4 accent-amber-500 cursor-pointer`})]})]}),(0,k.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,k.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,k.jsx)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider font-headline-md`,children:`Companion Name`}),(0,k.jsx)(`input`,{type:`text`,value:I.name,onChange:e=>L(t=>({...t,name:e.target.value})),placeholder:`e.g. Princess Aurelia`,className:`bg-white border-[2px] border-ink-black rounded py-2 px-3 text-ink-black text-xs font-sans font-medium focus:outline-none focus:border-amber-600`})]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,k.jsxs)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider font-headline-md flex items-center gap-1`,children:[(0,k.jsx)(d,{className:`w-3.5 h-3.5 text-amber-700`}),`Study Break Reminder`]}),(0,k.jsxs)(`select`,{value:I.breakIntervalMinutes,onChange:e=>L(t=>({...t,breakIntervalMinutes:Number(e.target.value)})),className:`bg-white border-[2px] border-ink-black rounded py-2 px-3 text-ink-black text-xs font-sans font-medium focus:outline-none focus:border-amber-600 cursor-pointer`,children:[(0,k.jsx)(`option`,{value:25,children:`Every 25 Minutes (Classic Pomodoro)`}),(0,k.jsx)(`option`,{value:45,children:`Every 45 Minutes`}),(0,k.jsx)(`option`,{value:60,children:`Every 60 Minutes`}),(0,k.jsx)(`option`,{value:0,children:`Disabled (No automatic break popups)`})]})]})]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,k.jsx)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider font-headline-md`,children:`Princess Backstory & Persona Prompt`}),(0,k.jsx)(`textarea`,{rows:2,value:I.backstory,onChange:e=>L(t=>({...t,backstory:e.target.value})),placeholder:`Describe her background, tone, and connection to your DSA studies...`,className:`bg-white border-[2px] border-ink-black rounded p-2.5 text-ink-black text-xs font-sans font-medium focus:outline-none focus:border-amber-600 resize-y`})]}),(0,k.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1`,children:[(0,k.jsxs)(`label`,{className:`flex items-center gap-2.5 p-2.5 bg-white border border-slate-300 rounded cursor-pointer hover:border-ink-black transition-all`,children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:I.soundEnabled,onChange:e=>{let t=e.target.checked;L(e=>({...e,soundEnabled:t})),te(!t)},className:`w-4 h-4 accent-amber-500 cursor-pointer`}),(0,k.jsxs)(`div`,{className:`text-xs`,children:[(0,k.jsx)(`span`,{className:`font-bold text-ink-black block`,children:`8-bit Sound Effects`}),(0,k.jsx)(`span`,{className:`text-[10px] text-trash-gray`,children:`Audio chimes & fanfare`})]})]}),(0,k.jsxs)(`label`,{className:`flex items-center gap-2.5 p-2.5 bg-white border border-slate-300 rounded cursor-pointer hover:border-ink-black transition-all`,children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:I.autoPopupEnabled,onChange:e=>L(t=>({...t,autoPopupEnabled:e.target.checked})),className:`w-4 h-4 accent-amber-500 cursor-pointer`}),(0,k.jsxs)(`div`,{className:`text-xs`,children:[(0,k.jsx)(`span`,{className:`font-bold text-ink-black block`,children:`Spontaneous RPG Popups`}),(0,k.jsx)(`span`,{className:`text-[10px] text-trash-gray`,children:`Speech bubbles for breaks & milestones`})]})]})]}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 pt-2 border-t border-slate-200`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsxs)(`button`,{type:`button`,onClick:ce,className:`flex items-center gap-1.5 py-2 px-4 border-[2px] border-ink-black bg-[#ffe24c] hover:bg-yellow-300 text-xs font-bold text-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer rounded uppercase`,children:[(0,k.jsx)(a,{className:`w-3.5 h-3.5`}),`Save Companion Settings`]}),(0,k.jsx)(`button`,{type:`button`,onClick:le,className:`py-2 px-3 border border-slate-300 bg-white hover:bg-slate-50 text-xs font-bold text-slate-700 transition-all cursor-pointer rounded`,children:`Default Persona`})]}),(0,k.jsxs)(`button`,{type:`button`,onClick:ue,className:`flex items-center gap-1 py-1.5 px-3 border border-rose-300 bg-rose-50 hover:bg-rose-100 text-rose-700 text-[11px] font-bold transition-all cursor-pointer rounded`,children:[(0,k.jsx)(n,{className:`w-3 h-3 text-rose-500`}),(0,k.jsxs)(`span`,{children:[`Reset Journey (`,B,`/150 LC)`]})]})]}),R&&(0,k.jsxs)(`div`,{className:`p-2.5 border-[2px] border-ink-black text-xs font-medium rounded flex items-center gap-2 ${R.type===`success`?`bg-emerald-100 border-emerald-600 text-emerald-900`:`bg-sky-100 border-sky-600 text-sky-900`}`,children:[(0,k.jsx)(l,{className:`w-3.5 h-3.5 shrink-0`}),R.text]})]}),(0,k.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col gap-2.5`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,k.jsx)(m,{className:`w-3.5 h-3.5 text-[#0ea5e9]`}),(0,k.jsx)(`h4`,{className:`text-xs font-bold uppercase font-headline-md m-0`,children:`Get Free API Keys`})]}),(0,k.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-2 text-[10px]`,children:[(0,k.jsxs)(`a`,{href:`https://console.groq.com/keys`,target:`_blank`,rel:`noopener noreferrer`,className:`p-2.5 border border-slate-200 hover:border-ink-black hover:bg-slate-50 rounded flex flex-col justify-between gap-1 transition-all no-underline text-inherit cursor-pointer`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between font-bold text-ink-black`,children:[(0,k.jsx)(`span`,{children:`Groq Cloud`}),(0,k.jsx)(u,{className:`w-3 h-3 text-slate-400`})]}),(0,k.jsx)(`p`,{className:`m-0 text-trash-gray leading-normal`,children:`Fast inference with generous free rate limits.`})]}),(0,k.jsxs)(`a`,{href:`https://aistudio.google.com/app/apikey`,target:`_blank`,rel:`noopener noreferrer`,className:`p-2.5 border border-slate-200 hover:border-ink-black hover:bg-slate-50 rounded flex flex-col justify-between gap-1 transition-all no-underline text-inherit cursor-pointer`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between font-bold text-ink-black`,children:[(0,k.jsx)(`span`,{children:`Google AI Studio`}),(0,k.jsx)(u,{className:`w-3 h-3 text-slate-400`})]}),(0,k.jsx)(`p`,{className:`m-0 text-trash-gray leading-normal`,children:`Free Gemini Flash API quota.`})]}),(0,k.jsxs)(`a`,{href:`https://openrouter.ai/keys`,target:`_blank`,rel:`noopener noreferrer`,className:`p-2.5 border border-slate-200 hover:border-ink-black hover:bg-slate-50 rounded flex flex-col justify-between gap-1 transition-all no-underline text-inherit cursor-pointer`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between font-bold text-ink-black`,children:[(0,k.jsx)(`span`,{children:`OpenRouter`}),(0,k.jsx)(u,{className:`w-3 h-3 text-slate-400`})]}),(0,k.jsx)(`p`,{className:`m-0 text-trash-gray leading-normal`,children:`Unified API for open-weights models.`})]})]})]})]})}export{j as default}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/Settings-mOsQagfT.js b/algospaced-ui/dist/assets/Settings-mOsQagfT.js deleted file mode 100644 index 8f419d2fa2981752052e73fbae4bd515eea35e5e..0000000000000000000000000000000000000000 --- a/algospaced-ui/dist/assets/Settings-mOsQagfT.js +++ /dev/null @@ -1 +0,0 @@ -import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,A as n,E as r,J as i,K as a,Lt as o,O as s,Z as c,at as l,d as u,et as d,ft as f,mt as p,nt as m,o as h,tt as g,x as _,y as v,zt as y}from"./vendor-react-qmUj3JUi.js";import{f as ee,g as b,h as x,m as S,p as C,v as w}from"./index-DYMSjoUb.js";import{a as te,i as ne,n as T,r as E,s as re,t as D}from"./githubSyncService-DQdE4J2L.js";var O=e(y(),1),k=o(),A=[{id:`default`,name:`Default`,desc:`Subject to Availability`},{id:`groq`,name:`Groq`,badge:`Fastest`,desc:`Llama 3.3 & Qwen`,keyPrefix:`gsk_...`,portalUrl:`https://console.groq.com/keys`},{id:`gemini`,name:`Google Gemini`,desc:`Gemini 2.5 / 3.5`,keyPrefix:`AIzaSy...`,portalUrl:`https://aistudio.google.com/app/apikey`},{id:`openrouter`,name:`OpenRouter`,desc:`Multi-Provider`,keyPrefix:`sk-or-v1-...`,portalUrl:`https://openrouter.ai/keys`}];function j(){let[e,o]=(0,O.useState)(()=>localStorage.getItem(`algospaced_custom_ai_provider`)||`default`),[y,j]=(0,O.useState)(()=>localStorage.getItem(`algospaced_custom_api_key`)||localStorage.getItem(`sandbox_gemini_api_key`)||``),[M,N]=(0,O.useState)(!1),[P,F]=(0,O.useState)(null),[I,L]=(0,O.useState)(()=>ee()),[R,z]=(0,O.useState)(null),[B,V]=(0,O.useState)(()=>C().currentFloor),[H,U]=(0,O.useState)(()=>E()),[W,G]=(0,O.useState)(()=>ne()),[K,q]=(0,O.useState)(!1),[J,Y]=(0,O.useState)(null),X=!!(H.token&&(H.username||W?.login)),Z=!!(y.trim()&&e!=="default"),Q=e!=="default"&&!y.trim(),$=A.find(t=>t.id===e),ie=e=>{o(e),localStorage.setItem(`algospaced_custom_ai_provider`,e),F(e==="default"?{type:`info`,text:`Switched to Server Default (Shared Pool).`}:{type:`info`,text:`Switched to ${e.toUpperCase()}.`}),setTimeout(()=>F(null),3e3)},ae=()=>{let t=y.trim();if(!t){F({type:`error`,text:`Please enter an API key for ${e.toUpperCase()}.`}),setTimeout(()=>F(null),3e3);return}localStorage.setItem(`algospaced_custom_api_key`,t),localStorage.setItem(`sandbox_gemini_api_key`,t),localStorage.setItem(`algospaced_custom_ai_provider`,e),F({type:`success`,text:`${e.toUpperCase()} API key saved successfully.`}),setTimeout(()=>F(null),3e3)},oe=()=>{localStorage.removeItem(`algospaced_custom_api_key`),localStorage.removeItem(`sandbox_gemini_api_key`),j(``),F({type:`info`,text:`Cleared custom API key.`}),setTimeout(()=>F(null),3e3)},se=()=>{localStorage.removeItem(`algospaced_custom_api_key`),localStorage.removeItem(`sandbox_gemini_api_key`),localStorage.setItem(`algospaced_custom_ai_provider`,`default`),j(``),o(`default`),F({type:`info`,text:`Reset to Server Default provider.`}),setTimeout(()=>F(null),3e3)},ce=()=>{x(I),z({type:`success`,text:`Princess Companion settings saved!`}),setTimeout(()=>z(null),3e3)},le=()=>{L(b),x(b),z({type:`info`,text:`Reset companion to default settings.`}),setTimeout(()=>z(null),3e3)},ue=()=>{if(window.confirm(`Are you sure you want to reset your Spire Journey progress back to 0 problems?`)){let e=S();V(e.currentFloor),z({type:`info`,text:`Spire journey progress reset to 0 problems.`}),setTimeout(()=>z(null),3e3)}},de=async()=>{q(!0),Y(null);try{let{token:e,user:t}=await T();G(t);let n=E();U(n);try{await te(e,n.repoName,n.isPrivate)}catch{}Y({type:`success`,text:`Connected to GitHub as @${t.login}!`}),setTimeout(()=>Y(null),4e3)}catch(e){Y({type:`error`,text:e.message||`GitHub connection failed.`}),setTimeout(()=>Y(null),5e3)}finally{q(!1)}},fe=()=>{D(),U(E()),G(null),Y({type:`info`,text:`Disconnected from GitHub.`}),setTimeout(()=>Y(null),3e3)},pe=e=>{re({autoCommit:e}),U(t=>({...t,autoCommit:e})),Y({type:`info`,text:e?`Auto-commit enabled for review submissions.`:`Auto-commit disabled.`}),setTimeout(()=>Y(null),3e3)};return(0,k.jsxs)(`div`,{className:`w-full h-full bg-[#fdf8e1] p-5 sm:p-6 flex flex-col gap-4 select-none font-sans text-ink-black overflow-y-auto custom-scrollbar`,children:[(0,k.jsxs)(`div`,{className:`flex flex-col gap-0.5 border-b-[3px] border-ink-black pb-2.5`,children:[(0,k.jsxs)(`h3`,{className:`font-headline-md font-bold text-sm m-0 flex items-center gap-2 tracking-wide`,children:[(0,k.jsx)(a,{className:`w-4 h-4 text-ink-black`}),`API & AI Configuration`]}),(0,k.jsx)(`p`,{className:`text-[11px] text-trash-gray font-medium m-0`,children:`Configure your AI model provider..`})]}),(0,k.jsx)(`div`,{className:`px-4 py-3 border-[3px] border-ink-black shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] transition-all ${Z?`bg-emerald-50`:Q?`bg-rose-50`:`bg-amber-50/70`}`,children:(0,k.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[Z?(0,k.jsx)(h,{className:`w-4 h-4 text-emerald-600 shrink-0`}):Q?(0,k.jsx)(p,{className:`w-4 h-4 text-rose-600 shrink-0`}):(0,k.jsx)(m,{className:`w-4 h-4 text-amber-600 shrink-0`}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`text-xs font-bold font-headline-md text-ink-black flex items-center gap-1.5`,children:(0,k.jsxs)(`span`,{children:[`Active:`,` `,Z?`${e.toUpperCase()} (Custom Key)`:Q?`${e.toUpperCase()} (Key Required)`:`Default`]})}),(0,k.jsx)(`div`,{className:`text-[10px] text-trash-gray font-medium`,children:Z?`Requests are routed directly through your personal API key.`:Q?`Enter your API key below to activate this provider.`:`Using basic, free built-in developer keys with auto-failover.`})]})]}),(0,k.jsx)(`span`,{className:`px-2 py-0.5 text-[9px] font-bold font-arcade uppercase border-2 border-ink-black shrink-0 ${Z?`bg-emerald-300 text-emerald-950`:Q?`bg-rose-300 text-rose-950`:`bg-amber-200 text-amber-950`}`,children:Z?`ACTIVE`:Q?`NEEDS KEY`:`LIMITED`})]})}),(0,k.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 sm:p-5 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col gap-4`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsxs)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider mb-2 font-headline-md flex items-center gap-1.5`,children:[(0,k.jsx)(m,{className:`w-3.5 h-3.5 text-ink-black`}),`Select Provider`]}),(0,k.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:A.map(t=>{let n=e===t.id;return(0,k.jsxs)(`button`,{type:`button`,onClick:()=>ie(t.id),className:`p-2.5 border-[2px] text-left transition-all cursor-pointer flex flex-col justify-between rounded ${n?`border-ink-black bg-[#ffe24c] shadow-[2px_2px_0px_0px_#1E293B] font-bold`:`border-slate-300 bg-slate-50 hover:bg-slate-100 text-slate-700`}`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,k.jsx)(`span`,{className:`text-xs font-bold font-headline-md`,children:t.name}),t.badge&&(0,k.jsx)(`span`,{className:`text-[8px] font-bold uppercase px-1 py-0.2 bg-orange-100 text-orange-700 rounded border border-orange-300`,children:t.badge})]}),(0,k.jsx)(`span`,{className:`text-[9px] mt-1 text-slate-600 leading-tight block`,children:t.desc})]},t.id)})})]}),e==="default"?(0,k.jsxs)(`div`,{className:`p-3.5 bg-slate-50 border border-slate-200 rounded flex items-start gap-3`,children:[(0,k.jsx)(u,{className:`w-4 h-4 text-amber-500 shrink-0 mt-0.5`}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-1 text-xs text-slate-700`,children:[(0,k.jsxs)(`span`,{className:`font-bold text-ink-black`,children:[`Shared Quotas (`,(0,k.jsx)(`i`,{children:`limited`}),`)`]}),(0,k.jsx)(`p`,{className:`text-[11px] text-trash-gray m-0 leading-relaxed`,children:`Powered by shared, basic developer keys. Because limits are shared with everyone, requests may fail. Use your own provider keys above for stable performance.`})]})]}):(0,k.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,k.jsxs)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider font-headline-md flex items-center gap-1.5`,children:[(0,k.jsx)(a,{className:`w-3.5 h-3.5 text-ink-black`}),$?.name,` API Key`]}),$?.portalUrl&&(0,k.jsxs)(`a`,{href:$.portalUrl,target:`_blank`,rel:`noopener noreferrer`,className:`text-[10px] text-sky-600 hover:text-sky-800 font-medium flex items-center gap-1 no-underline`,children:[(0,k.jsx)(`span`,{children:`Get API Key`}),(0,k.jsx)(g,{className:`w-3 h-3`})]})]}),(0,k.jsxs)(`div`,{className:`relative`,children:[(0,k.jsx)(`input`,{type:M?`text`:`password`,value:y,onChange:e=>j(e.target.value),placeholder:`Enter ${$?.keyPrefix||`API Key`}`,className:`w-full bg-white border-[2px] border-ink-black rounded py-2 pl-3 pr-9 text-ink-black placeholder-slate-400 focus:outline-none focus:border-sky-600 text-xs font-code-mono`}),(0,k.jsx)(`button`,{type:`button`,onClick:()=>N(!M),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-trash-gray hover:text-ink-black cursor-pointer bg-transparent border-0 outline-none p-1`,title:M?`Hide API key`:`Show API key`,children:M?(0,k.jsx)(d,{className:`w-3.5 h-3.5`}):(0,k.jsx)(t,{className:`w-3.5 h-3.5`})})]}),(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-trash-gray font-medium`,children:[(0,k.jsx)(_,{className:`w-3.5 h-3.5 text-emerald-600 shrink-0`}),(0,k.jsx)(`span`,{children:`Stored locally in your browser. Sent directly via request headers.`})]}),(0,k.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,k.jsxs)(`button`,{onClick:ae,className:`flex-1 flex items-center justify-center gap-1.5 py-2 border-[2px] border-ink-black bg-[#ffe24c] hover:bg-yellow-300 text-xs font-bold text-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer rounded uppercase`,children:[(0,k.jsx)(r,{className:`w-3.5 h-3.5`}),`Save Key`]}),y&&(0,k.jsx)(`button`,{onClick:oe,className:`px-3 py-2 border-[2px] border-slate-300 bg-white hover:bg-slate-50 text-xs font-bold text-slate-700 hover:text-rose-600 shadow-[2px_2px_0px_0px_rgba(0,0,0,0.05)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer rounded uppercase`,children:`Clear Key`})]})]}),P&&(0,k.jsxs)(`div`,{className:`p-2.5 border-[2px] border-ink-black text-xs font-medium rounded flex items-center gap-2 ${P.type===`success`?`bg-emerald-100 border-emerald-600 text-emerald-900`:P.type===`error`?`bg-rose-100 border-rose-600 text-rose-900`:`bg-sky-100 border-sky-600 text-sky-900`}`,children:[P.type===`success`?(0,k.jsx)(f,{className:`w-3.5 h-3.5 shrink-0`}):P.type===`error`?(0,k.jsx)(p,{className:`w-3.5 h-3.5 shrink-0`}):(0,k.jsx)(i,{className:`w-3.5 h-3.5 shrink-0`}),P.text]}),e!=="default"&&(0,k.jsx)(`div`,{className:`pt-2 border-t border-slate-200 flex justify-end`,children:(0,k.jsxs)(`button`,{onClick:se,className:`flex items-center gap-1.5 py-1.5 px-3 border border-slate-300 bg-slate-50 hover:bg-slate-100 text-[11px] font-bold text-slate-600 hover:text-ink-black transition-all cursor-pointer rounded`,children:[(0,k.jsx)(s,{className:`w-3 h-3 text-slate-500`}),`Reset to Server Default`]})})]}),(0,k.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 sm:p-5 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col gap-4`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between border-b-[2px] border-ink-black pb-3`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,k.jsx)(`div`,{className:`w-8 h-8 rounded bg-[#24292e] border-[2px] border-ink-black flex items-center justify-center text-white shadow-[1px_1px_0px_0px_#1E293B]`,children:(0,k.jsx)(c,{className:`w-4 h-4 text-white`})}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h4`,{className:`font-headline-md font-bold text-xs uppercase text-ink-black m-0 flex items-center gap-2`,children:`GitHub Solutions Sync & Auto-Commit`}),(0,k.jsx)(`p`,{className:`text-[10px] text-trash-gray font-medium m-0`,children:`Sync solutions to personal GitHub repository and commit automatically on submission`})]})]}),(0,k.jsx)(`span`,{className:`px-2 py-0.5 text-[9px] font-bold font-arcade uppercase border-2 border-ink-black shrink-0 ${X?`bg-emerald-300 text-emerald-950`:`bg-slate-200 text-slate-800`}`,children:X?`CONNECTED`:`DISCONNECTED`})]}),X?(0,k.jsxs)(`div`,{className:`space-y-3`,children:[(0,k.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-2 p-3 bg-slate-50 border border-slate-200 rounded`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[W?.avatar_url&&(0,k.jsx)(`img`,{src:W.avatar_url,alt:W.login,className:`w-7 h-7 rounded-full border border-ink-black`}),(0,k.jsxs)(`div`,{children:[(0,k.jsxs)(`span`,{className:`text-xs font-bold text-ink-black`,children:[`@`,W?.login||H.username]}),(0,k.jsxs)(`span`,{className:`text-[11px] text-slate-600 font-mono block`,children:[H.username,`/`,H.repoName,` (`,H.branch,`)`]})]})]}),(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsxs)(`a`,{href:`https://github.com/${H.username}/${H.repoName}`,target:`_blank`,rel:`noopener noreferrer`,className:`px-2.5 py-1 text-[11px] font-bold bg-white hover:bg-slate-100 text-ink-black border border-slate-300 rounded no-underline flex items-center gap-1 cursor-pointer`,children:[(0,k.jsx)(g,{className:`w-3 h-3`}),(0,k.jsx)(`span`,{children:`View Repo`})]}),(0,k.jsx)(`button`,{type:`button`,onClick:fe,className:`px-2.5 py-1 text-[11px] font-bold bg-white hover:bg-rose-50 text-rose-700 border border-rose-300 rounded cursor-pointer`,children:`Disconnect`})]})]}),(0,k.jsxs)(`label`,{className:`flex items-center gap-2.5 p-2.5 bg-emerald-50/50 border border-emerald-300 rounded cursor-pointer`,children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:H.autoCommit,onChange:e=>pe(e.target.checked),className:`w-4 h-4 accent-emerald-600 cursor-pointer`}),(0,k.jsxs)(`div`,{className:`text-xs`,children:[(0,k.jsx)(`span`,{className:`font-bold text-ink-black block`,children:`Auto-commit on every submission`}),(0,k.jsxs)(`span`,{className:`text-[10px] text-trash-gray`,children:[`Automatically pushes your code to `,H.repoName,` whenever you grade a review card.`]})]})]})]}):(0,k.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 p-3.5 bg-slate-50 border border-slate-200 rounded`,children:[(0,k.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,k.jsx)(`span`,{className:`text-xs font-bold text-ink-black block`,children:`Connect your GitHub Account (1-Click OAuth)`}),(0,k.jsx)(`p`,{className:`text-[11px] text-trash-gray m-0`,children:`Grant repository access to automatically sync your DSA problem solutions as you study.`})]}),(0,k.jsx)(`button`,{type:`button`,onClick:de,disabled:K,className:`px-4 py-2 bg-[#24292e] hover:bg-black text-white text-xs font-bold uppercase rounded border-2 border-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none flex items-center gap-2 shrink-0 cursor-pointer disabled:opacity-50`,children:K?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(n,{className:`w-3.5 h-3.5 animate-spin`}),(0,k.jsx)(`span`,{children:`CONNECTING...`})]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(c,{className:`w-3.5 h-3.5 text-yellow-300`}),(0,k.jsx)(`span`,{children:`CONNECT GITHUB`})]})})]}),J&&(0,k.jsxs)(`div`,{className:`p-2.5 border-[2px] border-ink-black text-xs font-medium rounded flex items-center gap-2 ${J.type===`success`?`bg-emerald-100 border-emerald-600 text-emerald-900`:J.type===`error`?`bg-rose-100 border-rose-600 text-rose-900`:`bg-sky-100 border-sky-600 text-sky-900`}`,children:[J.type===`success`?(0,k.jsx)(f,{className:`w-3.5 h-3.5 shrink-0`}):J.type===`error`?(0,k.jsx)(p,{className:`w-3.5 h-3.5 shrink-0`}):(0,k.jsx)(i,{className:`w-3.5 h-3.5 shrink-0`}),J.text]})]}),(0,k.jsxs)(`div`,{className:`bg-[#FFFDF0] border-[3px] border-ink-black p-4 sm:p-5 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col gap-4`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between border-b-[2px] border-ink-black pb-3`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(`div`,{className:`w-7 h-7 rounded bg-[#FFE24C] border-[2px] border-ink-black flex items-center justify-center shadow-[1px_1px_0px_0px_#1E293B]`,children:(0,k.jsx)(v,{className:`w-4 h-4 text-ink-black`})}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h4`,{className:`font-headline-md font-bold text-xs uppercase text-ink-black m-0`,children:`Princess AI Companion & RPG Settings`}),(0,k.jsx)(`p`,{className:`text-[10px] text-trash-gray font-medium m-0`,children:`Trapped Princess Persona, Study Break Timer & 8-bit RPG Audio`})]})]}),(0,k.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,k.jsx)(`span`,{className:`text-[11px] font-bold text-ink-black font-headline-md uppercase`,children:I.enabled?`Enabled`:`Disabled`}),(0,k.jsx)(`input`,{type:`checkbox`,checked:I.enabled,onChange:e=>L(t=>({...t,enabled:e.target.checked})),className:`w-4 h-4 accent-amber-500 cursor-pointer`})]})]}),(0,k.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,k.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,k.jsx)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider font-headline-md`,children:`Companion Name`}),(0,k.jsx)(`input`,{type:`text`,value:I.name,onChange:e=>L(t=>({...t,name:e.target.value})),placeholder:`e.g. Princess Aurelia`,className:`bg-white border-[2px] border-ink-black rounded py-2 px-3 text-ink-black text-xs font-sans font-medium focus:outline-none focus:border-amber-600`})]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,k.jsxs)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider font-headline-md flex items-center gap-1`,children:[(0,k.jsx)(l,{className:`w-3.5 h-3.5 text-amber-700`}),`Study Break Reminder`]}),(0,k.jsxs)(`select`,{value:I.breakIntervalMinutes,onChange:e=>L(t=>({...t,breakIntervalMinutes:Number(e.target.value)})),className:`bg-white border-[2px] border-ink-black rounded py-2 px-3 text-ink-black text-xs font-sans font-medium focus:outline-none focus:border-amber-600 cursor-pointer`,children:[(0,k.jsx)(`option`,{value:25,children:`Every 25 Minutes (Classic Pomodoro)`}),(0,k.jsx)(`option`,{value:45,children:`Every 45 Minutes`}),(0,k.jsx)(`option`,{value:60,children:`Every 60 Minutes`}),(0,k.jsx)(`option`,{value:0,children:`Disabled (No automatic break popups)`})]})]})]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,k.jsx)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider font-headline-md`,children:`Princess Backstory & Persona Prompt`}),(0,k.jsx)(`textarea`,{rows:2,value:I.backstory,onChange:e=>L(t=>({...t,backstory:e.target.value})),placeholder:`Describe her background, tone, and connection to your DSA studies...`,className:`bg-white border-[2px] border-ink-black rounded p-2.5 text-ink-black text-xs font-sans font-medium focus:outline-none focus:border-amber-600 resize-y`})]}),(0,k.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1`,children:[(0,k.jsxs)(`label`,{className:`flex items-center gap-2.5 p-2.5 bg-white border border-slate-300 rounded cursor-pointer hover:border-ink-black transition-all`,children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:I.soundEnabled,onChange:e=>{let t=e.target.checked;L(e=>({...e,soundEnabled:t})),w(!t)},className:`w-4 h-4 accent-amber-500 cursor-pointer`}),(0,k.jsxs)(`div`,{className:`text-xs`,children:[(0,k.jsx)(`span`,{className:`font-bold text-ink-black block`,children:`8-bit Sound Effects`}),(0,k.jsx)(`span`,{className:`text-[10px] text-trash-gray`,children:`Audio chimes & fanfare`})]})]}),(0,k.jsxs)(`label`,{className:`flex items-center gap-2.5 p-2.5 bg-white border border-slate-300 rounded cursor-pointer hover:border-ink-black transition-all`,children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:I.autoPopupEnabled,onChange:e=>L(t=>({...t,autoPopupEnabled:e.target.checked})),className:`w-4 h-4 accent-amber-500 cursor-pointer`}),(0,k.jsxs)(`div`,{className:`text-xs`,children:[(0,k.jsx)(`span`,{className:`font-bold text-ink-black block`,children:`Spontaneous RPG Popups`}),(0,k.jsx)(`span`,{className:`text-[10px] text-trash-gray`,children:`Speech bubbles for breaks & milestones`})]})]})]}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 pt-2 border-t border-slate-200`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsxs)(`button`,{type:`button`,onClick:ce,className:`flex items-center gap-1.5 py-2 px-4 border-[2px] border-ink-black bg-[#ffe24c] hover:bg-yellow-300 text-xs font-bold text-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer rounded uppercase`,children:[(0,k.jsx)(r,{className:`w-3.5 h-3.5`}),`Save Companion Settings`]}),(0,k.jsx)(`button`,{type:`button`,onClick:le,className:`py-2 px-3 border border-slate-300 bg-white hover:bg-slate-50 text-xs font-bold text-slate-700 transition-all cursor-pointer rounded`,children:`Default Persona`})]}),(0,k.jsxs)(`button`,{type:`button`,onClick:ue,className:`flex items-center gap-1 py-1.5 px-3 border border-rose-300 bg-rose-50 hover:bg-rose-100 text-rose-700 text-[11px] font-bold transition-all cursor-pointer rounded`,children:[(0,k.jsx)(s,{className:`w-3 h-3 text-rose-500`}),(0,k.jsxs)(`span`,{children:[`Reset Journey (`,B,`/150 LC)`]})]})]}),R&&(0,k.jsxs)(`div`,{className:`p-2.5 border-[2px] border-ink-black text-xs font-medium rounded flex items-center gap-2 ${R.type===`success`?`bg-emerald-100 border-emerald-600 text-emerald-900`:`bg-sky-100 border-sky-600 text-sky-900`}`,children:[(0,k.jsx)(f,{className:`w-3.5 h-3.5 shrink-0`}),R.text]})]}),(0,k.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col gap-2.5`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,k.jsx)(i,{className:`w-3.5 h-3.5 text-[#0ea5e9]`}),(0,k.jsx)(`h4`,{className:`text-xs font-bold uppercase font-headline-md m-0`,children:`Get Free API Keys`})]}),(0,k.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-2 text-[10px]`,children:[(0,k.jsxs)(`a`,{href:`https://console.groq.com/keys`,target:`_blank`,rel:`noopener noreferrer`,className:`p-2.5 border border-slate-200 hover:border-ink-black hover:bg-slate-50 rounded flex flex-col justify-between gap-1 transition-all no-underline text-inherit cursor-pointer`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between font-bold text-ink-black`,children:[(0,k.jsx)(`span`,{children:`Groq Cloud`}),(0,k.jsx)(g,{className:`w-3 h-3 text-slate-400`})]}),(0,k.jsx)(`p`,{className:`m-0 text-trash-gray leading-normal`,children:`Fast inference with generous free rate limits.`})]}),(0,k.jsxs)(`a`,{href:`https://aistudio.google.com/app/apikey`,target:`_blank`,rel:`noopener noreferrer`,className:`p-2.5 border border-slate-200 hover:border-ink-black hover:bg-slate-50 rounded flex flex-col justify-between gap-1 transition-all no-underline text-inherit cursor-pointer`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between font-bold text-ink-black`,children:[(0,k.jsx)(`span`,{children:`Google AI Studio`}),(0,k.jsx)(g,{className:`w-3 h-3 text-slate-400`})]}),(0,k.jsx)(`p`,{className:`m-0 text-trash-gray leading-normal`,children:`Free Gemini Flash API quota.`})]}),(0,k.jsxs)(`a`,{href:`https://openrouter.ai/keys`,target:`_blank`,rel:`noopener noreferrer`,className:`p-2.5 border border-slate-200 hover:border-ink-black hover:bg-slate-50 rounded flex flex-col justify-between gap-1 transition-all no-underline text-inherit cursor-pointer`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between font-bold text-ink-black`,children:[(0,k.jsx)(`span`,{children:`OpenRouter`}),(0,k.jsx)(g,{className:`w-3 h-3 text-slate-400`})]}),(0,k.jsx)(`p`,{className:`m-0 text-trash-gray leading-normal`,children:`Unified API for open-weights models.`})]})]})]})]})}export{j as default}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/TerminalEmulator-DUo8J_0j.js b/algospaced-ui/dist/assets/TerminalEmulator-UawIgOps.js similarity index 98% rename from algospaced-ui/dist/assets/TerminalEmulator-DUo8J_0j.js rename to algospaced-ui/dist/assets/TerminalEmulator-UawIgOps.js index c825f05e5ea8700c73d84a7ba1eb440a2e60f14a..4c05f1607fc4c5789fbe56eb999d0c810885cc0f 100644 --- a/algospaced-ui/dist/assets/TerminalEmulator-DUo8J_0j.js +++ b/algospaced-ui/dist/assets/TerminalEmulator-UawIgOps.js @@ -1 +1 @@ -import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Lt as t,zt as n}from"./vendor-react-qmUj3JUi.js";import{r}from"./firebaseClient-G7klkuBb.js";import{n as i}from"./index-DYMSjoUb.js";var a=e(n(),1),o=t();function s(e,t){if(e.length===0||t.length===0)return[`Empty result set.`];let n={};e.forEach(e=>{n[e]=e.length}),t.forEach(t=>{e.forEach(e=>{let r=t[e]!==null&&t[e]!==void 0?String(t[e]):`NULL`;r.length>(n[e]||0)&&(n[e]=r.length)})});let r=`+`+e.map(e=>`-`.repeat(n[e]+2)).join(`+`)+`+`,i=[r,`|`+e.map(e=>` ${e.padEnd(n[e])} `).join(`|`)+`|`,r];return t.forEach(t=>{let r=`|`+e.map(e=>` ${(t[e]!==null&&t[e]!==void 0?String(t[e]):`NULL`).padEnd(n[e])} `).join(`|`)+`|`;i.push(r)}),i.push(r),i}function c({onOpenWindow:e,onClose:t}){let[n,c]=(0,a.useState)([`AlgoSpaced OS [Version 1.0.24-beta]`,`(c) Retro Arcade Systems. All rights reserved.`,``,`Type "help" for a list of available commands.`,``]),[l,u]=(0,a.useState)(``),d=(0,a.useRef)(null);(0,a.useEffect)(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[n]);let f=e=>{let t=e.trim(),n=/[^\s"']+|"([^"]*)"|'([^']*)'/g,r=[],i;for(;(i=n.exec(t))!==null;)r.push(i[1]||i[2]||i[0]);return{command:r[0]?.toLowerCase()||``,args:r.slice(1)}},p=async n=>{let a=n.trim();if(a===``){c(e=>[...e,`$`]);return}let{command:o,args:l}=f(a),u=[`$ ${a}`];switch(o){case`help`:u.push(`Available commands:`,` help - Display this documentation`,` ps - Inspect OS process table (PIDs & task states)`,` streak - Retrieve your active Leitner combo streak metrics`,` sync - Run google drive file import sync`,` reviews - Fetch Leetcode numbers due for daily review`,` python play - Open Daily Python Challenge window`,` sql play - Open Interactive SQL Playground window`,` db init - Initialize SQL session and open playground window`,` db status - Check active SQL session objectives`,` db query [Q] - Execute query and format results inside CLI`,` open - Open window (usage: open queue | journey | system | python | db)`,` clear - Clear terminal buffer`,` exit - Close the terminal shell`);break;case`ps`:case`top`:{let e=Object.values(i.getState().processes);if(e.length===0)u.push(`No background processes currently in table.`);else{u.push(`AlgoSpaced OS Process Table:`);let t=s([`PID`,`APP`,`STATUS`,`NAME`],e.map(e=>({PID:e.pid.substring(0,16),APP:e.appId,STATUS:e.status.toUpperCase(),NAME:e.title.substring(0,24)})));u.push(...t)}break}case`clear`:c([]);return;case`exit`:u.push(`Closing terminal session...`),setTimeout(()=>{t()},500);break;case`open`:{let t=l[0]?.toLowerCase();t===`queue`||t===`daily`||t===`reviews`?(e(`queue`),u.push(`Launching Daily Queue window...`)):t===`journey`||t===`path`||t===`map`?(e(`journey`),u.push(`Launching Journey Path window...`)):t===`system`||t===`computer`||t===`sys`?(e(`computer`),u.push(`Launching System Information window...`)):t===`python`||t===`challenge`?(e(`python`),u.push(`Launching Daily Python Challenge window...`)):t===`db`||t===`mysql`||t===`sql`?(e(`mysql`),u.push(`Launching MySQL Playground window...`)):u.push(`Usage: open [queue | journey | system | python | db]`);break}case`streak`:u.push(`Connecting to streak.sys database...`);try{let{data:{session:e}}=await r.auth.getSession();if(!e){u.push(`Error: Unauthenticated session`);break}let t=await fetch(`/api/streak`,{headers:{Authorization:`Bearer ${e.access_token}`}});if(t.ok){let e=await t.json();u.push(`Database Response:`,` Active Streak: ${e.current_streak} days`,` Max Combo: ${e.longest_streak} days`,` Last Activity: ${e.last_active_date?new Date(e.last_active_date).toLocaleDateString():`N/A`}`)}else u.push(`Error: Failed to query database endpoint`)}catch{u.push(`Error: Connection timed out`)}break;case`sync`:u.push(`Initializing Google Drive synchronization sync.exe...`);try{let{data:{session:e}}=await r.auth.getSession();if(!e){u.push(`Error: Unauthenticated session`);break}let t=await fetch(`/api/sync`,{method:`POST`,headers:{Authorization:`Bearer ${e.access_token}`}});if(t.ok){let e=await t.json();u.push(`Sync Result: ${e.message}`)}else u.push(`Error: Sync command failed at backend host`)}catch{u.push(`Error: Cloud host unreachable`)}break;case`reviews`:u.push(`Querying leitner_cards partition...`);try{let{data:{session:e}}=await r.auth.getSession();if(!e){u.push(`Error: Unauthenticated session`);break}let t=await fetch(`/api/reviews/due`,{headers:{Authorization:`Bearer ${e.access_token}`}});if(t.ok){let e=await t.json();e.length===0?u.push(`Queue status: CLEAR! 0 cards due.`):u.push(`Queue status: ${e.length} card(s) due:`,...e.map(e=>` - LeetCode ${e.problems?.problem_number??`?`}: ${e.problems?.name??`Unknown`} (Box ${e.box_level??1})`))}else u.push(`Error: Failed to fetch due items`)}catch{u.push(`Error: Database connection lost`)}break;case`python`:l[0]?.toLowerCase()===`play`?(u.push(`Launching Daily Python Challenge window...`),e(`python`)):u.push(`Usage: python play`);break;case`sql`:case`mysql`:case`db`:{let t=l[0]?.toLowerCase();if(t===`play`)u.push(`Launching MySQL Playground window...`),e(`mysql`);else if(t===`init`){u.push(`Initializing MySQL Playground and launching window...`),e(`mysql`);try{let{data:{session:e}}=await r.auth.getSession();if(!e){u.push(`Error: Unauthenticated session`);break}let t=await fetch(`/api/challenges/mysql/init?refresh=true`,{method:`POST`,headers:{Authorization:`Bearer ${e.access_token}`}});if(t.ok){let e=await t.json();u.push(`Database Session Created: "${e.title}"`,`Objective: ${e.objective}`)}else u.push(`Error: Failed to initialize DB session on backend host.`)}catch{u.push(`Error: Server connection lost.`)}}else if(t===`status`){u.push(`Fetching SQL playground status...`),e(`mysql`);try{let{data:{session:e}}=await r.auth.getSession();if(!e){u.push(`Error: Unauthenticated session`);break}let t=await fetch(`/api/challenges/mysql/status`,{headers:{Authorization:`Bearer ${e.access_token}`}});if(t.ok){let e=await t.json();e.active?u.push(`Active SQL Challenge: "${e.title}"`,`Objective: ${e.objective}`,`Status: ${e.completed?`COMPLETED (Done)`:`IN PROGRESS`}`):u.push(e.message)}else u.push(`Error: Failed to fetch DB status.`)}catch{u.push(`Error: Server timed out.`)}}else if(t===`query`){let t=a.toLowerCase().indexOf(`query`),n=t===-1?``:a.substring(t+5).trim().replace(/^["']|["']$/g,``);if(!n){u.push(`Usage: db query [SQL Statement] - Remember to wrap query in double quotes.`);break}u.push(`Running query: ${n}`),e(`mysql`);try{let{data:{session:e}}=await r.auth.getSession();if(!e){u.push(`Error: Unauthenticated session`);break}let t=await fetch(`/api/challenges/mysql/query`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${e.access_token}`},body:JSON.stringify({query:n})});if(t.ok){let e=await t.json();e.success?(u.push(`Query OK. Affected ${e.rows_affected} rows.`,...s(e.columns,e.rows)),e.is_correct&&u.push(`OBJECTIVE ACHIEVED! Congratulations.`)):u.push(`SQL Error: ${e.error}`)}else u.push(`Error: SQL execution failed.`)}catch{u.push(`Error: Database server unreachable.`)}}else u.push(`Usage: sql play | db init | db status | db query "SELECT..."`);break}default:u.push(`Command not recognized: "${o}". Type "help" for a list of available actions.`)}c(e=>[...e,...u,``])};return(0,o.jsxs)(`div`,{className:`w-full h-full bg-[#1E293B] text-[#4ADE80] font-code-mono p-4 flex flex-col overflow-hidden text-xs md:text-sm select-text`,children:[(0,o.jsx)(`div`,{ref:d,className:`flex-1 overflow-y-auto mb-2 custom-scrollbar space-y-1`,children:n.map((e,t)=>(0,o.jsx)(`div`,{className:`whitespace-pre-wrap leading-relaxed min-h-[1.2em]`,children:e},t))}),(0,o.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),p(l),u(``)},className:`flex items-center gap-1.5 border-t border-slate-700 pt-2 shrink-0 select-none`,children:[(0,o.jsx)(`span`,{className:`font-bold text-[#ffcc00]`,children:`$`}),(0,o.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),className:`flex-1 bg-transparent text-[#4ADE80] outline-none border-none p-0 focus:ring-0 font-code-mono text-xs md:text-sm`,autoFocus:!0,placeholder:`Type command...`})]})]})}export{c as default}; \ No newline at end of file +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Lt as t,zt as n}from"./vendor-react-q-oOktF_.js";import{r}from"./firebaseClient-G7klkuBb.js";import{n as i}from"./index-Bcgsshpk.js";var a=e(n(),1),o=t();function s(e,t){if(e.length===0||t.length===0)return[`Empty result set.`];let n={};e.forEach(e=>{n[e]=e.length}),t.forEach(t=>{e.forEach(e=>{let r=t[e]!==null&&t[e]!==void 0?String(t[e]):`NULL`;r.length>(n[e]||0)&&(n[e]=r.length)})});let r=`+`+e.map(e=>`-`.repeat(n[e]+2)).join(`+`)+`+`,i=[r,`|`+e.map(e=>` ${e.padEnd(n[e])} `).join(`|`)+`|`,r];return t.forEach(t=>{let r=`|`+e.map(e=>` ${(t[e]!==null&&t[e]!==void 0?String(t[e]):`NULL`).padEnd(n[e])} `).join(`|`)+`|`;i.push(r)}),i.push(r),i}function c({onOpenWindow:e,onClose:t}){let[n,c]=(0,a.useState)([`AlgoSpaced OS [Version 1.0.24-beta]`,`(c) Retro Arcade Systems. All rights reserved.`,``,`Type "help" for a list of available commands.`,``]),[l,u]=(0,a.useState)(``),d=(0,a.useRef)(null);(0,a.useEffect)(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[n]);let f=e=>{let t=e.trim(),n=/[^\s"']+|"([^"]*)"|'([^']*)'/g,r=[],i;for(;(i=n.exec(t))!==null;)r.push(i[1]||i[2]||i[0]);return{command:r[0]?.toLowerCase()||``,args:r.slice(1)}},p=async n=>{let a=n.trim();if(a===``){c(e=>[...e,`$`]);return}let{command:o,args:l}=f(a),u=[`$ ${a}`];switch(o){case`help`:u.push(`Available commands:`,` help - Display this documentation`,` ps - Inspect OS process table (PIDs & task states)`,` streak - Retrieve your active Leitner combo streak metrics`,` sync - Run google drive file import sync`,` reviews - Fetch Leetcode numbers due for daily review`,` python play - Open Daily Python Challenge window`,` sql play - Open Interactive SQL Playground window`,` db init - Initialize SQL session and open playground window`,` db status - Check active SQL session objectives`,` db query [Q] - Execute query and format results inside CLI`,` open - Open window (usage: open queue | journey | system | python | db)`,` clear - Clear terminal buffer`,` exit - Close the terminal shell`);break;case`ps`:case`top`:{let e=Object.values(i.getState().processes);if(e.length===0)u.push(`No background processes currently in table.`);else{u.push(`AlgoSpaced OS Process Table:`);let t=s([`PID`,`APP`,`STATUS`,`NAME`],e.map(e=>({PID:e.pid.substring(0,16),APP:e.appId,STATUS:e.status.toUpperCase(),NAME:e.title.substring(0,24)})));u.push(...t)}break}case`clear`:c([]);return;case`exit`:u.push(`Closing terminal session...`),setTimeout(()=>{t()},500);break;case`open`:{let t=l[0]?.toLowerCase();t===`queue`||t===`daily`||t===`reviews`?(e(`queue`),u.push(`Launching Daily Queue window...`)):t===`journey`||t===`path`||t===`map`?(e(`journey`),u.push(`Launching Journey Path window...`)):t===`system`||t===`computer`||t===`sys`?(e(`computer`),u.push(`Launching System Information window...`)):t===`python`||t===`challenge`?(e(`python`),u.push(`Launching Daily Python Challenge window...`)):t===`db`||t===`mysql`||t===`sql`?(e(`mysql`),u.push(`Launching MySQL Playground window...`)):u.push(`Usage: open [queue | journey | system | python | db]`);break}case`streak`:u.push(`Connecting to streak.sys database...`);try{let{data:{session:e}}=await r.auth.getSession();if(!e){u.push(`Error: Unauthenticated session`);break}let t=await fetch(`/api/streak`,{headers:{Authorization:`Bearer ${e.access_token}`}});if(t.ok){let e=await t.json();u.push(`Database Response:`,` Active Streak: ${e.current_streak} days`,` Max Combo: ${e.longest_streak} days`,` Last Activity: ${e.last_active_date?new Date(e.last_active_date).toLocaleDateString():`N/A`}`)}else u.push(`Error: Failed to query database endpoint`)}catch{u.push(`Error: Connection timed out`)}break;case`sync`:u.push(`Initializing Google Drive synchronization sync.exe...`);try{let{data:{session:e}}=await r.auth.getSession();if(!e){u.push(`Error: Unauthenticated session`);break}let t=await fetch(`/api/sync`,{method:`POST`,headers:{Authorization:`Bearer ${e.access_token}`}});if(t.ok){let e=await t.json();u.push(`Sync Result: ${e.message}`)}else u.push(`Error: Sync command failed at backend host`)}catch{u.push(`Error: Cloud host unreachable`)}break;case`reviews`:u.push(`Querying leitner_cards partition...`);try{let{data:{session:e}}=await r.auth.getSession();if(!e){u.push(`Error: Unauthenticated session`);break}let t=await fetch(`/api/reviews/due`,{headers:{Authorization:`Bearer ${e.access_token}`}});if(t.ok){let e=await t.json();e.length===0?u.push(`Queue status: CLEAR! 0 cards due.`):u.push(`Queue status: ${e.length} card(s) due:`,...e.map(e=>` - LeetCode ${e.problems?.problem_number??`?`}: ${e.problems?.name??`Unknown`} (Box ${e.box_level??1})`))}else u.push(`Error: Failed to fetch due items`)}catch{u.push(`Error: Database connection lost`)}break;case`python`:l[0]?.toLowerCase()===`play`?(u.push(`Launching Daily Python Challenge window...`),e(`python`)):u.push(`Usage: python play`);break;case`sql`:case`mysql`:case`db`:{let t=l[0]?.toLowerCase();if(t===`play`)u.push(`Launching MySQL Playground window...`),e(`mysql`);else if(t===`init`){u.push(`Initializing MySQL Playground and launching window...`),e(`mysql`);try{let{data:{session:e}}=await r.auth.getSession();if(!e){u.push(`Error: Unauthenticated session`);break}let t=await fetch(`/api/challenges/mysql/init?refresh=true`,{method:`POST`,headers:{Authorization:`Bearer ${e.access_token}`}});if(t.ok){let e=await t.json();u.push(`Database Session Created: "${e.title}"`,`Objective: ${e.objective}`)}else u.push(`Error: Failed to initialize DB session on backend host.`)}catch{u.push(`Error: Server connection lost.`)}}else if(t===`status`){u.push(`Fetching SQL playground status...`),e(`mysql`);try{let{data:{session:e}}=await r.auth.getSession();if(!e){u.push(`Error: Unauthenticated session`);break}let t=await fetch(`/api/challenges/mysql/status`,{headers:{Authorization:`Bearer ${e.access_token}`}});if(t.ok){let e=await t.json();e.active?u.push(`Active SQL Challenge: "${e.title}"`,`Objective: ${e.objective}`,`Status: ${e.completed?`COMPLETED (Done)`:`IN PROGRESS`}`):u.push(e.message)}else u.push(`Error: Failed to fetch DB status.`)}catch{u.push(`Error: Server timed out.`)}}else if(t===`query`){let t=a.toLowerCase().indexOf(`query`),n=t===-1?``:a.substring(t+5).trim().replace(/^["']|["']$/g,``);if(!n){u.push(`Usage: db query [SQL Statement] - Remember to wrap query in double quotes.`);break}u.push(`Running query: ${n}`),e(`mysql`);try{let{data:{session:e}}=await r.auth.getSession();if(!e){u.push(`Error: Unauthenticated session`);break}let t=await fetch(`/api/challenges/mysql/query`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${e.access_token}`},body:JSON.stringify({query:n})});if(t.ok){let e=await t.json();e.success?(u.push(`Query OK. Affected ${e.rows_affected} rows.`,...s(e.columns,e.rows)),e.is_correct&&u.push(`OBJECTIVE ACHIEVED! Congratulations.`)):u.push(`SQL Error: ${e.error}`)}else u.push(`Error: SQL execution failed.`)}catch{u.push(`Error: Database server unreachable.`)}}else u.push(`Usage: sql play | db init | db status | db query "SELECT..."`);break}default:u.push(`Command not recognized: "${o}". Type "help" for a list of available actions.`)}c(e=>[...e,...u,``])};return(0,o.jsxs)(`div`,{className:`w-full h-full bg-[#1E293B] text-[#4ADE80] font-code-mono p-4 flex flex-col overflow-hidden text-xs md:text-sm select-text`,children:[(0,o.jsx)(`div`,{ref:d,className:`flex-1 overflow-y-auto mb-2 custom-scrollbar space-y-1`,children:n.map((e,t)=>(0,o.jsx)(`div`,{className:`whitespace-pre-wrap leading-relaxed min-h-[1.2em]`,children:e},t))}),(0,o.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),p(l),u(``)},className:`flex items-center gap-1.5 border-t border-slate-700 pt-2 shrink-0 select-none`,children:[(0,o.jsx)(`span`,{className:`font-bold text-[#ffcc00]`,children:`$`}),(0,o.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),className:`flex-1 bg-transparent text-[#4ADE80] outline-none border-none p-0 focus:ring-0 font-code-mono text-xs md:text-sm`,autoFocus:!0,placeholder:`Type command...`})]})]})}export{c as default}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/index-DYMSjoUb.js b/algospaced-ui/dist/assets/index-Bcgsshpk.js similarity index 67% rename from algospaced-ui/dist/assets/index-DYMSjoUb.js rename to algospaced-ui/dist/assets/index-Bcgsshpk.js index 9755cc029e06303143d4aad6a94be4504faf483c..ace93bd6e73e812505029eaeddb50f5f9b0ff003 100644 --- a/algospaced-ui/dist/assets/index-DYMSjoUb.js +++ b/algospaced-ui/dist/assets/index-Bcgsshpk.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ReviewQueue-C250a4ib.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-react-qmUj3JUi.js","assets/vendor-codemirror-By0wlJeM.js","assets/firebaseClient-G7klkuBb.js","assets/vendor-firebase-DSIO3PIf.js","assets/githubSyncService-DQdE4J2L.js","assets/confetti.module-Uxh4CK4s.js","assets/OnboardingModal-hhKaj0In.js","assets/MarkdownRenderer-CC5nUs7-.js","assets/PrincessChamber-IJaaUuL1.js","assets/JourneyPath-DO-UXRtH.js","assets/TerminalEmulator-DUo8J_0j.js","assets/PythonChallenge-BUhtEPkm.js","assets/MySQLPlayground-CA-QZxQM.js","assets/FileExplorer-BX57bI-L.js","assets/Settings-mOsQagfT.js","assets/CreateProblemForm-C2nCqjgj.js","assets/GitHubSyncWindow-D0t6e3o3.js","assets/Auth-B-5KpNfK.js"])))=>i.map(i=>d[i]); -import{r as e}from"./rolldown-runtime-hePW80VL.js";import{At as t,Dt as n,Ft as r,It as i,L as a,Lt as o,Mt as s,Nt as c,O as l,Ot as u,P as d,Pt as f,Rt as p,at as m,c as h,d as g,gt as _,jt as v,kt as y,l as b,n as x,p as S,r as C,s as w,y as T,zt as E}from"./vendor-react-qmUj3JUi.js";import{n as D,r as O}from"./firebaseClient-G7klkuBb.js";import{t as k}from"./vendor-ui-ZXcm-2wU.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var A=e(E(),1),j=p(),M=o(),N=`algospaced_desktop_icon_positions_v2`,P=96,F=105,I=24,L=60,R=112,z=108,B=e=>{let t={},n=e.filter(e=>!e.hidden),r=typeof window<`u`?window.innerHeight-100:700,i=I,a=L;return n.forEach(e=>{a+F>r&&a>L&&(i+=z,a=L),t[e.id]={x:i,y:a},a+=R}),t},V=(e,t)=>{let n=B(t);if(!e||typeof e!=`object`)return n;let r={},i=new Set,a=(e,t)=>`${Math.round(e/50)},${Math.round(t/50)}`;return[...t].sort((e,t)=>e.id===`queue`?-1:+(t.id===`queue`)).forEach(t=>{let o=e[t.id];if(o&&Number.isFinite(o.x)&&Number.isFinite(o.y)){let e=a(o.x,o.y);if(!i.has(e)){r[t.id]={x:Math.max(8,o.x),y:Math.max(48,o.y)},i.add(e);return}}let s=n[t.id]||{x:I,y:L},c=s.x,l=s.y;for(;i.has(a(c,l));)l+=R,typeof window<`u`&&l+F>window.innerHeight-100&&(c+=z,l=L);r[t.id]={x:c,y:l},i.add(a(c,l))}),r},H=(0,A.forwardRef)(({icons:e,isMobile:t=!1,onContextMenu:n},r)=>{let[i,a]=(0,A.useState)(()=>{try{let t=localStorage.getItem(N);if(t){let n=JSON.parse(t);if(n&&typeof n==`object`)return V(n,e)}}catch(e){console.error(`Error loading icon positions:`,e)}return B(e)}),[o,s]=(0,A.useState)(null),[c,l]=(0,A.useState)(null),u=(0,A.useRef)({startX:0,startY:0,initialIconX:0,initialIconY:0,hasMoved:!1,pointerId:null});(0,A.useEffect)(()=>{let t=()=>{a(t=>{let n=V(t,e),r=!1,i=Math.max(100,window.innerWidth-P),a=Math.max(100,window.innerHeight-120);if(e.forEach(e=>{let t=n[e.id];if(t){let o=Math.max(8,Math.min(t.x,i)),s=Math.max(48,Math.min(t.y,a));(o!==t.x||s!==t.y)&&(n[e.id]={x:o,y:s},r=!0)}}),r||JSON.stringify(n)!==JSON.stringify(t))try{localStorage.setItem(N,JSON.stringify(n))}catch{}return n})};return t(),window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t)},[e]),(0,A.useImperativeHandle)(r,()=>({autoArrange:()=>{let t=B(e);a(t);try{localStorage.setItem(N,JSON.stringify(t))}catch{}},resetLayout:()=>{localStorage.removeItem(N),localStorage.removeItem(`algospaced_desktop_icon_positions_v1`);let t=B(e);a(t)}})),(0,A.useEffect)(()=>{let e=e=>{e.target.closest(`.desktop-icon-unit`)||s(null)};return window.addEventListener(`pointerdown`,e),()=>window.removeEventListener(`pointerdown`,e)},[]);let d=(t,n)=>{if(t.button!==0&&t.pointerType===`mouse`)return;t.stopPropagation();let r=B(e)[n.id]||{x:I,y:L},a=i[n.id],o=a&&Number.isFinite(a.x)&&Number.isFinite(a.y)?a:r;u.current={startX:t.clientX,startY:t.clientY,initialIconX:o.x,initialIconY:o.y,hasMoved:!1,pointerId:t.pointerId},l(n.id);try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}},f=e=>{if(!c)return;let{startX:t,startY:n,initialIconX:r,initialIconY:i,hasMoved:o}=u.current,s=e.clientX-t,l=e.clientY-n;if(!o&&Math.hypot(s,l)>6&&(u.current.hasMoved=!0),u.current.hasMoved){let e=Math.max(100,window.innerWidth-P),t=Math.max(100,window.innerHeight-110),n=Math.max(8,Math.min(r+s,e)),o=Math.max(48,Math.min(i+l,t));a(e=>({...e,[c]:{x:n,y:o}}))}},p=(e,t)=>{if(c!==t.id)return;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}let{hasMoved:n}=u.current;if(n)try{localStorage.setItem(N,JSON.stringify(i))}catch{}else s(t.id),t.action();l(null)},m=e=>{e.action()},h=e.filter(e=>!e.hidden);return(0,M.jsx)(`div`,{className:`absolute inset-0 pointer-events-none z-10 select-none overflow-hidden`,onContextMenu:n,children:h.map(t=>{let n=B(e),r=i[t.id],a=r&&Number.isFinite(r.x)&&Number.isFinite(r.y)?r:n[t.id]||{x:I,y:L},s=o===t.id,l=c===t.id;return(0,M.jsxs)(`div`,{id:`desktop-icon-${t.id}`,style:{transform:`translate3d(${a.x}px, ${a.y}px, 0)`,touchAction:`none`},onPointerDown:e=>d(e,t),onPointerMove:f,onPointerUp:e=>p(e,t),onPointerCancel:e=>p(e,t),onDoubleClick:()=>m(t),className:`desktop-icon-unit absolute top-0 left-0 w-[96px] flex flex-col items-center justify-center gap-1.5 p-2 pointer-events-auto cursor-grab active:cursor-grabbing group transition-transform duration-75 ${l?`z-30 scale-105 opacity-90`:`z-10`}`,children:[(0,M.jsx)(`div`,{className:`w-16 h-16 bg-paper-white border-[3px] flex items-center justify-center transition-all ${s?`border-[#0ea5e9] bg-[#dbeafe] shadow-[4px_4px_0px_0px_#0ea5e9] ring-2 ring-[#0ea5e9]`:`border-ink-black gadget-shadow group-hover:bg-secondary-container shadow-[inset_2px_2px_0px_rgba(255,255,255,0.8)]`} ${t.iconImg?`p-1 overflow-hidden`:``}`,children:t.iconImg?(0,M.jsx)(`img`,{alt:typeof t.label==`string`?t.label:t.id,className:`w-full h-full object-cover pointer-events-none select-none`,src:t.iconImg,draggable:!1}):(0,M.jsx)(`span`,{className:`material-symbols-outlined text-4xl select-none text-ink-black`,style:{fontVariationSettings:`'FILL' 1`},children:t.icon||`apps`})}),(0,M.jsx)(`span`,{className:`font-icon-label text-[9px] px-1.5 py-1 border-[2px] text-center leading-tight uppercase transition-all select-none ${s?`bg-[#0ea5e9] text-white border-ink-black shadow-[2px_2px_0px_0px_#1E293B]`:`bg-ink-black text-white border-ink-black`}`,style:{boxShadow:s?`2px 2px 0px 0px #1E293B`:`2px 2px 0px 0px ${t.badgeShadowColor||`#fde047`}`},children:t.label})]},t.id)})})});function U({x:e,y:t,isOpen:a,onClose:o,onAutoArrange:l,onResetLayout:d,onChangeWallpaper:p,onOpenWindow:m,onTriggerSync:h,onToggleFullscreen:g,isFullscreen:_}){let b=(0,A.useMemo)(()=>({getBoundingClientRect:()=>({x:e,y:t,top:t,left:e,bottom:t,right:e,width:0,height:0})}),[e,t]),{refs:{setReference:x,setFloating:S},floatingStyles:C,context:w}=y({open:a,onOpenChange:e=>{e||o()},placement:`bottom-start`,middleware:[f(2),c({padding:12}),r({padding:12})],whileElementsMounted:i});(0,A.useEffect)(()=>{x(b)},[b,x]);let T=u(w,{outsidePress:!0,escapeKey:!0}),E=s(w,{role:`menu`}),{getFloatingProps:D}=v([T,E]);return a?(0,M.jsx)(n,{children:(0,M.jsxs)(`div`,{ref:S,style:C,...D(),className:`z-[100] w-56 bg-paper-white border-[3px] border-ink-black gadget-shadow py-1.5 flex flex-col select-none text-ink-black animate-fade-in shadow-[4px_4px_0px_0px_#1E293B]`,children:[(0,M.jsxs)(`div`,{className:`px-3 py-1 bg-[#0ea5e9] text-white border-b-2 border-ink-black flex items-center justify-between mb-1 -mt-1.5 -mx-0`,children:[(0,M.jsx)(`span`,{className:`font-window-title text-[11px] font-bold tracking-wider uppercase`,children:`Desktop Options`}),(0,M.jsx)(`span`,{className:`material-symbols-outlined text-xs`,children:`desktop_windows`})]}),(0,M.jsxs)(`button`,{onClick:()=>{l(),o()},className:`px-3 py-1.5 hover:bg-[#fde047] hover:text-ink-black flex items-center gap-2 text-xs font-bold transition-colors text-left cursor-pointer`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-base`,children:`grid_view`}),`Auto Arrange Icons`]}),(0,M.jsxs)(`button`,{onClick:()=>{d(),o()},className:`px-3 py-1.5 hover:bg-[#fde047] hover:text-ink-black flex items-center gap-2 text-xs font-bold transition-colors text-left cursor-pointer`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-base`,children:`restart_alt`}),`Reset Icon Layout`]}),(0,M.jsx)(`div`,{className:`h-[2px] bg-ink-black/20 my-1 mx-2`}),(0,M.jsxs)(`button`,{onClick:()=>{p(),o()},className:`px-3 py-1.5 hover:bg-[#39ff14] hover:text-ink-black flex items-center gap-2 text-xs font-bold transition-colors text-left cursor-pointer`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-base`,children:`wallpaper`}),`Change Wallpaper...`]}),(0,M.jsxs)(`button`,{onClick:()=>{g(),o()},className:`px-3 py-1.5 hover:bg-[#39ff14] hover:text-ink-black flex items-center gap-2 text-xs font-bold transition-colors text-left cursor-pointer`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-base`,children:_?`fullscreen_exit`:`fullscreen`}),_?`Exit Fullscreen`:`Enter Fullscreen`]}),(0,M.jsx)(`div`,{className:`h-[2px] bg-ink-black/20 my-1 mx-2`}),(0,M.jsxs)(`button`,{onClick:()=>{m(`queue`),o()},className:`px-3 py-1.5 hover:bg-[#4cc9f0] hover:text-ink-black flex items-center gap-2 text-xs font-bold transition-colors text-left cursor-pointer`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-base`,children:`view_list`}),`Daily Queue`]}),(0,M.jsxs)(`button`,{onClick:()=>{m(`terminal`),o()},className:`px-3 py-1.5 hover:bg-[#4cc9f0] hover:text-ink-black flex items-center gap-2 text-xs font-bold transition-colors text-left cursor-pointer`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-base`,children:`terminal`}),`Terminal Emulator`]}),(0,M.jsxs)(`button`,{onClick:()=>{m(`computer`),o()},className:`px-3 py-1.5 hover:bg-[#4cc9f0] hover:text-ink-black flex items-center gap-2 text-xs font-bold transition-colors text-left cursor-pointer`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-base`,children:`folder`}),`My Computer`]}),(0,M.jsx)(`div`,{className:`h-[2px] bg-ink-black/20 my-1 mx-2`}),(0,M.jsxs)(`button`,{onClick:()=>{h(),o()},className:`px-3 py-1.5 hover:bg-[#f72585] hover:text-white flex items-center gap-2 text-xs font-bold transition-colors text-left cursor-pointer`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-base`,children:`cloud_sync`}),`Sync with Drive`]})]})}):null}var W=[{floorRange:[1,30],title:`The Plains of Arrays & Strings`,description:`Rolling green meadows and ancient cobblestone roads where foundational endurance is forged.`,bgLore:`Looking out towards the distant horizon, the silhouette of the Big-O Spire pierces the clouds.`},{floorRange:[31,60],title:`The Whispering Forest of Pointers`,description:`Winding paths through dense emerald groves where two pointers navigate labyrinthine trails.`,bgLore:`Aurelia’s beacon shines above the canopy, guiding your compass through tangled groves.`},{floorRange:[61,90],title:`The Grand Caverns of Trees & Graphs`,description:`Bioluminescent caves with branching crystal arches and subterranean passes.`,bgLore:`Halfway to the tower! Her voice echoes with hope over the enchanted royal crystal relay.`},{floorRange:[91,120],title:`The High Mountain Passes of Heaps & Backtracking`,description:`Perilous alpine ridges and snowy peaks overlooking the deep Spire valley.`,bgLore:`From the highest ridge, the base of the Spire is in sight through the swirling mountain mist!`},{floorRange:[121,149],title:`The Enchanted Valley of Dynamic Programming`,description:`Shimmering mystical grounds where optimal decisions bridge the final moat.`,bgLore:`The final leagues! The Spire looms directly ahead, its ancient runic wards trembling.`},{floorRange:[150,150],title:`The Gates of the Big-O Spire`,description:`Standing at the threshold of the grand obsidian gates to shatter the seal and free Aurelia!`,bgLore:`150 algorithmic leagues conquered! You have completed the grand journey and reached the Spire!`}];function G(e){return W.find(t=>e>=t.floorRange[0]&&e<=t.floorRange[1])||W[0]}var K={30:{id:`letter-30`,floor:30,chapterTitle:`The Plains of Arrays & Strings`,title:`A Courier from the Open Plains`,letterText:`My Dearest Champion, +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ReviewQueue-DRECcJtJ.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-react-q-oOktF_.js","assets/vendor-codemirror-By0wlJeM.js","assets/firebaseClient-G7klkuBb.js","assets/vendor-firebase-DSIO3PIf.js","assets/githubSyncService-DQdE4J2L.js","assets/confetti.module-Uxh4CK4s.js","assets/OnboardingModal-D_uUP3Nd.js","assets/MarkdownRenderer-cD9l7avV.js","assets/PrincessChamber-BkGsNxLj.js","assets/JourneyPath-C_DuHGaN.js","assets/TerminalEmulator-UawIgOps.js","assets/PythonChallenge-Bh_sBh6Y.js","assets/MySQLPlayground-qSCaW6n7.js","assets/FileExplorer-cjfRJjsw.js","assets/Settings-BFJ9GDP5.js","assets/CreateProblemForm-BBCKyUaK.js","assets/GitHubSyncWindow-6b8RBof4.js","assets/Auth-D-vQqxx2.js"])))=>i.map(i=>d[i]); +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{At as t,D as n,Dt as r,Et as i,Ft as a,I as o,It as s,Lt as c,Mt as l,N as u,Nt as d,Ot as f,Pt as p,Rt as m,c as h,f as g,ht as _,it as v,jt as y,kt as b,n as x,o as S,s as C,u as w,v as T,zt as E}from"./vendor-react-q-oOktF_.js";import{n as D,r as O}from"./firebaseClient-G7klkuBb.js";import{t as k}from"./vendor-ui-ZXcm-2wU.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var A=e(E(),1),j=m(),M=c(),N=`algospaced_desktop_icon_positions_v2`,P=96,F=105,I=24,L=60,R=112,z=108,B=e=>{let t={},n=e.filter(e=>!e.hidden),r=typeof window<`u`?window.innerHeight-100:700,i=I,a=L;return n.forEach(e=>{a+F>r&&a>L&&(i+=z,a=L),t[e.id]={x:i,y:a},a+=R}),t},V=(e,t)=>{let n=B(t);if(!e||typeof e!=`object`)return n;let r={},i=new Set,a=(e,t)=>`${Math.round(e/50)},${Math.round(t/50)}`;return[...t].sort((e,t)=>e.id===`queue`?-1:+(t.id===`queue`)).forEach(t=>{let o=e[t.id];if(o&&Number.isFinite(o.x)&&Number.isFinite(o.y)){let e=a(o.x,o.y);if(!i.has(e)){r[t.id]={x:Math.max(8,o.x),y:Math.max(48,o.y)},i.add(e);return}}let s=n[t.id]||{x:I,y:L},c=s.x,l=s.y;for(;i.has(a(c,l));)l+=R,typeof window<`u`&&l+F>window.innerHeight-100&&(c+=z,l=L);r[t.id]={x:c,y:l},i.add(a(c,l))}),r},ee=(0,A.forwardRef)(({icons:e,isMobile:t=!1,onContextMenu:n},r)=>{let[i,a]=(0,A.useState)(()=>{try{let t=localStorage.getItem(N);if(t){let n=JSON.parse(t);if(n&&typeof n==`object`)return V(n,e)}}catch(e){console.error(`Error loading icon positions:`,e)}return B(e)}),[o,s]=(0,A.useState)(null),[c,l]=(0,A.useState)(null),u=(0,A.useRef)({startX:0,startY:0,initialIconX:0,initialIconY:0,hasMoved:!1,pointerId:null});(0,A.useEffect)(()=>{let t=()=>{a(t=>{let n=V(t,e),r=!1,i=Math.max(100,window.innerWidth-P),a=Math.max(100,window.innerHeight-120);if(e.forEach(e=>{let t=n[e.id];if(t){let o=Math.max(8,Math.min(t.x,i)),s=Math.max(48,Math.min(t.y,a));(o!==t.x||s!==t.y)&&(n[e.id]={x:o,y:s},r=!0)}}),r||JSON.stringify(n)!==JSON.stringify(t))try{localStorage.setItem(N,JSON.stringify(n))}catch{}return n})};return t(),window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t)},[e]),(0,A.useImperativeHandle)(r,()=>({autoArrange:()=>{let t=B(e);a(t);try{localStorage.setItem(N,JSON.stringify(t))}catch{}},resetLayout:()=>{localStorage.removeItem(N),localStorage.removeItem(`algospaced_desktop_icon_positions_v1`);let t=B(e);a(t)}})),(0,A.useEffect)(()=>{let e=e=>{e.target.closest(`.desktop-icon-unit`)||s(null)};return window.addEventListener(`pointerdown`,e),()=>window.removeEventListener(`pointerdown`,e)},[]);let d=(t,n)=>{if(t.button!==0&&t.pointerType===`mouse`)return;t.stopPropagation();let r=B(e)[n.id]||{x:I,y:L},a=i[n.id],o=a&&Number.isFinite(a.x)&&Number.isFinite(a.y)?a:r;u.current={startX:t.clientX,startY:t.clientY,initialIconX:o.x,initialIconY:o.y,hasMoved:!1,pointerId:t.pointerId},l(n.id);try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}},f=e=>{if(!c)return;let{startX:t,startY:n,initialIconX:r,initialIconY:i,hasMoved:o}=u.current,s=e.clientX-t,l=e.clientY-n;if(!o&&Math.hypot(s,l)>6&&(u.current.hasMoved=!0),u.current.hasMoved){let e=Math.max(100,window.innerWidth-P),t=Math.max(100,window.innerHeight-110),n=Math.max(8,Math.min(r+s,e)),o=Math.max(48,Math.min(i+l,t));a(e=>({...e,[c]:{x:n,y:o}}))}},p=(e,t)=>{if(c!==t.id)return;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}let{hasMoved:n}=u.current;if(n)try{localStorage.setItem(N,JSON.stringify(i))}catch{}else s(t.id),t.action();l(null)},m=e=>{e.action()},h=e.filter(e=>!e.hidden);return(0,M.jsx)(`div`,{className:`absolute inset-0 pointer-events-none z-10 select-none overflow-hidden`,onContextMenu:n,children:h.map(t=>{let n=B(e),r=i[t.id],a=r&&Number.isFinite(r.x)&&Number.isFinite(r.y)?r:n[t.id]||{x:I,y:L},s=o===t.id,l=c===t.id;return(0,M.jsxs)(`div`,{id:`desktop-icon-${t.id}`,style:{transform:`translate3d(${a.x}px, ${a.y}px, 0)`,touchAction:`none`},onPointerDown:e=>d(e,t),onPointerMove:f,onPointerUp:e=>p(e,t),onPointerCancel:e=>p(e,t),onDoubleClick:()=>m(t),className:`desktop-icon-unit absolute top-0 left-0 w-[96px] flex flex-col items-center justify-center gap-1.5 p-2 pointer-events-auto cursor-grab active:cursor-grabbing group transition-transform duration-75 ${l?`z-30 scale-105 opacity-90`:`z-10`}`,children:[(0,M.jsx)(`div`,{className:`w-16 h-16 bg-paper-white border-[3px] flex items-center justify-center transition-all ${s?`border-[#0ea5e9] bg-[#dbeafe] shadow-[4px_4px_0px_0px_#0ea5e9] ring-2 ring-[#0ea5e9]`:`border-ink-black gadget-shadow group-hover:bg-secondary-container shadow-[inset_2px_2px_0px_rgba(255,255,255,0.8)]`} ${t.iconImg?`p-1 overflow-hidden`:``}`,children:t.iconImg?(0,M.jsx)(`img`,{alt:typeof t.label==`string`?t.label:t.id,className:`w-full h-full object-cover pointer-events-none select-none`,src:t.iconImg,draggable:!1}):(0,M.jsx)(`span`,{className:`material-symbols-outlined text-4xl select-none text-ink-black`,style:{fontVariationSettings:`'FILL' 1`},children:t.icon||`apps`})}),(0,M.jsx)(`span`,{className:`font-icon-label text-[9px] px-1.5 py-1 border-[2px] text-center leading-tight uppercase transition-all select-none ${s?`bg-[#0ea5e9] text-white border-ink-black shadow-[2px_2px_0px_0px_#1E293B]`:`bg-ink-black text-white border-ink-black`}`,style:{boxShadow:s?`2px 2px 0px 0px #1E293B`:`2px 2px 0px 0px ${t.badgeShadowColor||`#fde047`}`},children:t.label})]},t.id)})})});function H({x:e,y:t,isOpen:n,onClose:i,onAutoArrange:o,onResetLayout:c,onChangeWallpaper:u,onOpenWindow:m,onTriggerSync:h,onToggleFullscreen:g,isFullscreen:_}){let v=(0,A.useMemo)(()=>({getBoundingClientRect:()=>({x:e,y:t,top:t,left:e,bottom:t,right:e,width:0,height:0})}),[e,t]),{refs:{setReference:x,setFloating:S},floatingStyles:C,context:w}=b({open:n,onOpenChange:e=>{e||i()},placement:`bottom-start`,middleware:[p(2),d({padding:12}),a({padding:12})],whileElementsMounted:s});(0,A.useEffect)(()=>{x(v)},[v,x]);let T=f(w,{outsidePress:!0,escapeKey:!0}),E=l(w,{role:`menu`}),{getFloatingProps:D}=y([T,E]);return n?(0,M.jsx)(r,{children:(0,M.jsxs)(`div`,{ref:S,style:C,...D(),className:`z-[100] w-56 bg-paper-white border-[3px] border-ink-black gadget-shadow py-1.5 flex flex-col select-none text-ink-black animate-fade-in shadow-[4px_4px_0px_0px_#1E293B]`,children:[(0,M.jsxs)(`div`,{className:`px-3 py-1 bg-[#0ea5e9] text-white border-b-2 border-ink-black flex items-center justify-between mb-1 -mt-1.5 -mx-0`,children:[(0,M.jsx)(`span`,{className:`font-window-title text-[11px] font-bold tracking-wider uppercase`,children:`Desktop Options`}),(0,M.jsx)(`span`,{className:`material-symbols-outlined text-xs`,children:`desktop_windows`})]}),(0,M.jsxs)(`button`,{onClick:()=>{o(),i()},className:`px-3 py-1.5 hover:bg-[#fde047] hover:text-ink-black flex items-center gap-2 text-xs font-bold transition-colors text-left cursor-pointer`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-base`,children:`grid_view`}),`Auto Arrange Icons`]}),(0,M.jsxs)(`button`,{onClick:()=>{c(),i()},className:`px-3 py-1.5 hover:bg-[#fde047] hover:text-ink-black flex items-center gap-2 text-xs font-bold transition-colors text-left cursor-pointer`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-base`,children:`restart_alt`}),`Reset Icon Layout`]}),(0,M.jsx)(`div`,{className:`h-[2px] bg-ink-black/20 my-1 mx-2`}),(0,M.jsxs)(`button`,{onClick:()=>{u(),i()},className:`px-3 py-1.5 hover:bg-[#39ff14] hover:text-ink-black flex items-center gap-2 text-xs font-bold transition-colors text-left cursor-pointer`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-base`,children:`wallpaper`}),`Change Wallpaper...`]}),(0,M.jsxs)(`button`,{onClick:()=>{g(),i()},className:`px-3 py-1.5 hover:bg-[#39ff14] hover:text-ink-black flex items-center gap-2 text-xs font-bold transition-colors text-left cursor-pointer`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-base`,children:_?`fullscreen_exit`:`fullscreen`}),_?`Exit Fullscreen`:`Enter Fullscreen`]}),(0,M.jsx)(`div`,{className:`h-[2px] bg-ink-black/20 my-1 mx-2`}),(0,M.jsxs)(`button`,{onClick:()=>{m(`queue`),i()},className:`px-3 py-1.5 hover:bg-[#4cc9f0] hover:text-ink-black flex items-center gap-2 text-xs font-bold transition-colors text-left cursor-pointer`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-base`,children:`view_list`}),`Daily Queue`]}),(0,M.jsxs)(`button`,{onClick:()=>{m(`terminal`),i()},className:`px-3 py-1.5 hover:bg-[#4cc9f0] hover:text-ink-black flex items-center gap-2 text-xs font-bold transition-colors text-left cursor-pointer`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-base`,children:`terminal`}),`Terminal Emulator`]}),(0,M.jsxs)(`button`,{onClick:()=>{m(`computer`),i()},className:`px-3 py-1.5 hover:bg-[#4cc9f0] hover:text-ink-black flex items-center gap-2 text-xs font-bold transition-colors text-left cursor-pointer`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-base`,children:`folder`}),`My Computer`]}),(0,M.jsx)(`div`,{className:`h-[2px] bg-ink-black/20 my-1 mx-2`}),(0,M.jsxs)(`button`,{onClick:()=>{h(),i()},className:`px-3 py-1.5 hover:bg-[#f72585] hover:text-white flex items-center gap-2 text-xs font-bold transition-colors text-left cursor-pointer`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-base`,children:`cloud_sync`}),`Sync with Drive`]})]})}):null}var U=[{floorRange:[1,30],title:`The Plains of Arrays & Strings`,description:`Rolling green meadows and ancient cobblestone roads where foundational endurance is forged.`,bgLore:`Looking out towards the distant horizon, the silhouette of the Big-O Spire pierces the clouds.`},{floorRange:[31,60],title:`The Whispering Forest of Pointers`,description:`Winding paths through dense emerald groves where two pointers navigate labyrinthine trails.`,bgLore:`Aurelia’s beacon shines above the canopy, guiding your compass through tangled groves.`},{floorRange:[61,90],title:`The Grand Caverns of Trees & Graphs`,description:`Bioluminescent caves with branching crystal arches and subterranean passes.`,bgLore:`Halfway to the tower! Her voice echoes with hope over the enchanted royal crystal relay.`},{floorRange:[91,120],title:`The High Mountain Passes of Heaps & Backtracking`,description:`Perilous alpine ridges and snowy peaks overlooking the deep Spire valley.`,bgLore:`From the highest ridge, the base of the Spire is in sight through the swirling mountain mist!`},{floorRange:[121,149],title:`The Enchanted Valley of Dynamic Programming`,description:`Shimmering mystical grounds where optimal decisions bridge the final moat.`,bgLore:`The final leagues! The Spire looms directly ahead, its ancient runic wards trembling.`},{floorRange:[150,150],title:`The Gates of the Big-O Spire`,description:`Standing at the threshold of the grand obsidian gates to shatter the seal and free Aurelia!`,bgLore:`150 algorithmic leagues conquered! You have completed the grand journey and reached the Spire!`}];function W(e){return U.find(t=>e>=t.floorRange[0]&&e<=t.floorRange[1])||U[0]}var G={30:{id:`letter-30`,floor:30,chapterTitle:`The Plains of Arrays & Strings`,title:`A Courier from the Open Plains`,letterText:`My Dearest Champion, From the highest window of the Spire, I watched your travel banner cross the border stones of the open plains. Thirty leagues conquered! @@ -46,10 +46,10 @@ You did not just conquer a list of problems—you demonstrated the rarest virtue The tower is open. Step through the archway, hero—let us walk out into the sunlight together. Free at last, -Aurelia`}},q={problem_correct:[{text:`Yes! Nicely done. Getting a stubborn problem to pass cleanly always feels so satisfying.`,emotion:`excited_expression`},{text:`Look at that—another one down! You’re really finding your rhythm today.`,emotion:`smiling_warmly`},{text:`Awesome job! Step by step, you’re steadily working your way through all of these.`,emotion:`smiling_warmly`}],problem_incorrect:[{text:`Hey, don’t sweat it. Even seasoned engineers stumble on test cases constantly. We can always look at the edge cases again.`,emotion:`concerned`},{text:`Take a breath. Getting stuck isn’t failing—it’s literally just your brain building the intuition for the next time.`,emotion:`thinking_expression`},{text:`Ugh, those hidden edge cases can be ruthless. Give your mind a minute to clear, then come back to it with fresh eyes.`,emotion:`smiling_warmly`}],break_reminder:[{text:`Hey, you’ve been at this for a while. Go grab some water and stretch your shoulders for five minutes—trust me, you’ve earned it.`,emotion:`concerned`},{text:`Quick check-in: how are your eyes feeling? Step away from the screen for just a few minutes.`,emotion:`smiling_warmly`}],idle_chat:[{text:`Hey! Thanks for stopping by to chat. How’s your headspace today?`,emotion:`smiling_warmly`},{text:`Whenever the whole 150-problem journey feels overwhelming, just remember: you only ever have to solve the one in front of you.`,emotion:`thinking_expression`}]};async function ee(e){let t=localStorage.getItem(`algospaced_custom_api_key`)||localStorage.getItem(`sandbox_gemini_api_key`)||``,n=localStorage.getItem(`algospaced_custom_ai_provider`)||`default`;try{let{data:{session:r}}=await O.auth.getSession(),i={"Content-Type":`application/json`,Authorization:`Bearer ${r?.access_token||`sandbox`}`};t.trim()&&n!=="default"&&(i[`x-custom-api-key`]=t.trim(),i[`x-gemini-api-key`]=t.trim(),i[`x-ai-provider`]=n);let a=e.messages.map(e=>({sender:e.sender,text:e.text,emotion:e.emotion})),o={princess_name:e.princess_name||`Princess Aurelia`,user_message:e.user_message,current_floor:e.current_floor,streak_days:e.streak_days||0,hero_name:e.hero_name||`Champion`,target_goal:e.target_goal||``,bond_tier:e.bond_tier||`Acquaintance`,current_rhythm:e.current_rhythm||`day`,hero_codex:e.hero_codex,episodic_memories:e.episodic_memories,messages:a},s=await fetch(`/api/companion/chat`,{method:`POST`,headers:i,body:JSON.stringify(o)});if(s.ok){let e=await s.json();if(e.text)return{text:e.text,emotion:e.emotion||`smiling_warmly`,tool_calls:Array.isArray(e.tool_calls)?e.tool_calls:[],choice_suggestions:Array.isArray(e.choice_suggestions)?e.choice_suggestions:[],provider_used:e.provider_used||`Spire Agent`}}}catch(e){console.warn(`[CompanionAPI] Backend endpoint unreachable, falling back to offline grimoire:`,e)}let r=q.idle_chat,i=r[Math.floor(Math.random()*r.length)];return{text:i.text,emotion:i.emotion,tool_calls:[],choice_suggestions:[`Tell me about the Spire`,`Can we take a rest by the fire?`],provider_used:`Offline Script`}}async function te(e,t){let n=localStorage.getItem(`algospaced_custom_api_key`)||localStorage.getItem(`sandbox_gemini_api_key`)||``,r=localStorage.getItem(`algospaced_custom_ai_provider`)||`default`;try{let{data:{session:i}}=await O.auth.getSession(),a={"Content-Type":`application/json`,Authorization:`Bearer ${i?.access_token||`sandbox`}`};n.trim()&&r!=="default"&&(a[`x-custom-api-key`]=n.trim(),a[`x-gemini-api-key`]=n.trim(),a[`x-ai-provider`]=r);let o=e.messages.map(e=>({sender:e.sender,text:e.text,emotion:e.emotion})),s={princess_name:e.princess_name||`Princess Aurelia`,user_message:e.user_message,current_floor:e.current_floor,streak_days:e.streak_days||0,hero_name:e.hero_name||`Champion`,target_goal:e.target_goal||``,bond_tier:e.bond_tier||`Acquaintance`,current_rhythm:e.current_rhythm||`day`,hero_codex:e.hero_codex,episodic_memories:e.episodic_memories,messages:o},c=await fetch(`/api/companion/chat/stream`,{method:`POST`,headers:a,body:JSON.stringify(s)});if(!c.ok||!c.body)throw Error(`Streaming failed with status ${c.status}`);let l=c.body.getReader(),u=new TextDecoder(`utf-8`),d=``,f=!1;for(;;){let{done:e,value:n}=await l.read();if(e)break;d+=u.decode(n,{stream:!0});let r=d.split(` +Aurelia`}},K={problem_correct:[{text:`Yes! Nicely done. Getting a stubborn problem to pass cleanly always feels so satisfying.`,emotion:`excited_expression`},{text:`Look at that—another one down! You’re really finding your rhythm today.`,emotion:`smiling_warmly`},{text:`Awesome job! Step by step, you’re steadily working your way through all of these.`,emotion:`smiling_warmly`}],problem_incorrect:[{text:`Hey, don’t sweat it. Even seasoned engineers stumble on test cases constantly. We can always look at the edge cases again.`,emotion:`concerned`},{text:`Take a breath. Getting stuck isn’t failing—it’s literally just your brain building the intuition for the next time.`,emotion:`thinking_expression`},{text:`Ugh, those hidden edge cases can be ruthless. Give your mind a minute to clear, then come back to it with fresh eyes.`,emotion:`smiling_warmly`}],break_reminder:[{text:`Hey, you’ve been at this for a while. Go grab some water and stretch your shoulders for five minutes—trust me, you’ve earned it.`,emotion:`concerned`},{text:`Quick check-in: how are your eyes feeling? Step away from the screen for just a few minutes.`,emotion:`smiling_warmly`}],idle_chat:[{text:`Hey! Thanks for stopping by to chat. How’s your headspace today?`,emotion:`smiling_warmly`},{text:`Whenever the whole 150-problem journey feels overwhelming, just remember: you only ever have to solve the one in front of you.`,emotion:`thinking_expression`}]};async function te(e){let t=localStorage.getItem(`algospaced_custom_api_key`)||localStorage.getItem(`sandbox_gemini_api_key`)||``,n=localStorage.getItem(`algospaced_custom_ai_provider`)||`default`;try{let{data:{session:r}}=await O.auth.getSession(),i={"Content-Type":`application/json`,Authorization:`Bearer ${r?.access_token||`sandbox`}`};t.trim()&&n!=="default"&&(i[`x-custom-api-key`]=t.trim(),i[`x-gemini-api-key`]=t.trim(),i[`x-ai-provider`]=n);let a=e.messages.map(e=>({sender:e.sender,text:e.text,emotion:e.emotion})),o={princess_name:e.princess_name||`Princess Aurelia`,user_message:e.user_message,current_floor:e.current_floor,streak_days:e.streak_days||0,hero_name:e.hero_name||`Champion`,target_goal:e.target_goal||``,bond_tier:e.bond_tier||`Acquaintance`,current_rhythm:e.current_rhythm||`day`,hero_codex:e.hero_codex,episodic_memories:e.episodic_memories,messages:a},s=await fetch(`/api/companion/chat`,{method:`POST`,headers:i,body:JSON.stringify(o)});if(s.ok){let e=await s.json();if(e.text)return{text:e.text,emotion:e.emotion||`smiling_warmly`,tool_calls:Array.isArray(e.tool_calls)?e.tool_calls:[],choice_suggestions:Array.isArray(e.choice_suggestions)?e.choice_suggestions:[],provider_used:e.provider_used||`Spire Agent`}}}catch(e){console.warn(`[CompanionAPI] Backend endpoint unreachable, falling back to offline grimoire:`,e)}let r=K.idle_chat,i=r[Math.floor(Math.random()*r.length)];return{text:i.text,emotion:i.emotion,tool_calls:[],choice_suggestions:[`Tell me about the Spire`,`Can we take a rest by the fire?`],provider_used:`Offline Script`}}async function ne(e,t){let n=localStorage.getItem(`algospaced_custom_api_key`)||localStorage.getItem(`sandbox_gemini_api_key`)||``,r=localStorage.getItem(`algospaced_custom_ai_provider`)||`default`;try{let{data:{session:i}}=await O.auth.getSession(),a={"Content-Type":`application/json`,Authorization:`Bearer ${i?.access_token||`sandbox`}`};n.trim()&&r!=="default"&&(a[`x-custom-api-key`]=n.trim(),a[`x-gemini-api-key`]=n.trim(),a[`x-ai-provider`]=r);let o=e.messages.map(e=>({sender:e.sender,text:e.text,emotion:e.emotion})),s={princess_name:e.princess_name||`Princess Aurelia`,user_message:e.user_message,current_floor:e.current_floor,streak_days:e.streak_days||0,hero_name:e.hero_name||`Champion`,target_goal:e.target_goal||``,bond_tier:e.bond_tier||`Acquaintance`,current_rhythm:e.current_rhythm||`day`,hero_codex:e.hero_codex,episodic_memories:e.episodic_memories,messages:o},c=await fetch(`/api/companion/chat/stream`,{method:`POST`,headers:a,body:JSON.stringify(s)});if(!c.ok||!c.body)throw Error(`Streaming failed with status ${c.status}`);let l=c.body.getReader(),u=new TextDecoder(`utf-8`),d=``,f=!1;for(;;){let{done:e,value:n}=await l.read();if(e)break;d+=u.decode(n,{stream:!0});let r=d.split(` `);d=r.pop()||``;for(let e of r){if(!e.trim())continue;let n=`message`,r=``,i=e.split(` -`);for(let e of i)e.startsWith(`event:`)?n=e.replace(`event:`,``).trim():e.startsWith(`data:`)&&(r=e.replace(`data:`,``).trim());if(n===`text_delta`&&r)try{let e=JSON.parse(r);e.delta&&t.onDelta(e.delta)}catch(e){console.warn(`[CompanionAPI] Failed to parse delta:`,e)}else if(n===`done`&&r)try{let e=JSON.parse(r);f=!0,t.onDone({text:e.text||``,emotion:e.emotion||`smiling_warmly`,tool_calls:Array.isArray(e.tool_calls)?e.tool_calls:[],choice_suggestions:Array.isArray(e.choice_suggestions)?e.choice_suggestions:[],provider_used:e.provider_used||`Spire Agent Stream`})}catch(e){console.warn(`[CompanionAPI] Failed to parse done payload:`,e)}else if(n===`error`&&r){f=!0;try{let e=JSON.parse(r);t.onDone({text:e.text||`Stay strong, champion!`,emotion:e.emotion||`smiling_warmly`,tool_calls:[],choice_suggestions:e.choice_suggestions||[],provider_used:`fallback`})}catch(e){console.warn(`[CompanionAPI] Error event parse failed:`,e)}}}}if(!f){let n=await ee(e);t.onDone(n)}}catch(n){console.warn(`[CompanionAPI] Stream error, falling back to standard API:`,n);try{let n=await ee(e);t.onDone(n)}catch(e){t.onError?.(e)}}}async function ne(e){try{let{data:{session:t}}=await O.auth.getSession(),n=t?.access_token||`sandbox`;await fetch(`/api/companion/telemetry`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${n}`},body:JSON.stringify({...e,source:`client`,timestamp:e.timestamp||Date.now()/1e3})})}catch{}}var re={open_app_window:e=>{let t=String(e.window_id||e.windowId||`queue`).toLowerCase(),n=t;return[`reviewer`,`code_reviewer`,`ai`,`grimoire`].includes(t)?n=`queue`:[`map`,`path`,`trail`].includes(t)?n=`journey`:[`files`,`explorer`,`system`].includes(t)&&(n=`computer`),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`companion:open_window`,{detail:{windowId:n}})),{toolName:`open_app_window`,success:!0,message:`Summoned window: ${n}`,data:{windowId:n}}},set_study_timer:e=>{let t=Math.max(1,Math.min(120,Number(e.minutes||10)));return typeof window<`u`&&window.dispatchEvent(new CustomEvent(`companion:start_timer`,{detail:{minutes:t}})),{toolName:`set_study_timer`,success:!0,message:`Set tower countdown hourglass for ${t} minutes.`,data:{minutes:t}}},play_ambient_sound:e=>{let t=String(e.soundscape||`campfire`).toLowerCase();return typeof window<`u`&&window.dispatchEvent(new CustomEvent(`companion:play_soundscape`,{detail:{soundscape:t}})),{toolName:`play_ambient_sound`,success:!0,message:`Kindled ambient soundscape: ${t}.`,data:{soundscape:t}}},bookmark_for_spaced_review:e=>{let t=String(e.problem_name||e.problemName||`Unspecified Problem`),n=String(e.reason||`Flagged by Princess Aurelia for reinforcement`);return typeof window<`u`&&window.dispatchEvent(new CustomEvent(`companion:bookmark_problem`,{detail:{problemName:t,reason:n}})),{toolName:`bookmark_for_spaced_review`,success:!0,message:`Marked "${t}" in the royal grimoire for priority review.`,data:{problemName:t,reason:n}}},write_spire_diary:e=>{let t=String(e.entry||e.text||``).trim();return t?(typeof window<`u`&&window.dispatchEvent(new CustomEvent(`companion:write_diary`,{detail:{text:t}})),{toolName:`write_spire_diary`,success:!0,message:`Recorded observation into the Spire Chronicles.`,data:{text:t}}):{toolName:`write_spire_diary`,success:!1,message:`Empty diary entry provided.`}},update_hero_codex:e=>{let t=String(e.key||``).trim(),n=String(e.value||``).trim();return!t||!n?{toolName:`update_hero_codex`,success:!1,message:`Missing key or value for hero codex update.`}:(typeof window<`u`&&window.dispatchEvent(new CustomEvent(`companion:update_codex`,{detail:{key:t,value:n}})),{toolName:`update_hero_codex`,success:!0,message:`Updated Hero Codex: ${t} -> ${n}`,data:{key:t,value:n}})},record_episodic_event:e=>{let t=String(e.eventType||e.event_type||`session_summary`),n=String(e.title||`Event`).trim(),r=String(e.description||``).trim(),i=e.relatedPattern||e.related_pattern?String(e.relatedPattern||e.related_pattern):void 0;return typeof window<`u`&&window.dispatchEvent(new CustomEvent(`companion:record_event`,{detail:{eventType:t,title:n,description:r,relatedPattern:i}})),{toolName:`record_episodic_event`,success:!0,message:`Recorded episodic memory: ${n}`,data:{eventType:t,title:n,description:r,relatedPattern:i}}}};async function ie(e){let t=re[e.name],n=typeof performance<`u`?performance.now():Date.now();if(!t){console.warn(`[AgentTools] No handler registered for tool: ${e.name}`);let t={toolName:e.name,success:!1,message:`Unknown enchantment: ${e.name}`,durationMs:0};return ne({tool_name:e.name,args:e.args,success:!1,error:t.message,execution_time_ms:0}),t}try{let r=await t(e.args||{}),i=typeof performance<`u`?performance.now():Date.now(),a=Math.round(i-n),o={...r,durationMs:a};return ne({tool_name:e.name,args:e.args,success:o.success,error:o.success?void 0:o.message,execution_time_ms:a}),o}catch(t){console.error(`[AgentTools] Error executing ${e.name}:`,t);let r=typeof performance<`u`?performance.now():Date.now(),i=Math.round(r-n),a={toolName:e.name,success:!1,message:t?.message||`Tool execution encountered an error.`,durationMs:i};return ne({tool_name:e.name,args:e.args,success:!1,error:a.message,execution_time_ms:i}),a}}var ae={dawn:{state:`dawn`,label:`Morning Sunbreak`,hourRange:[6,12],activity:`Sipping warm mountain tea and watching the sunrise over the valley`,lightingClass:`from-amber-100/90 via-yellow-50/80 to-amber-200/50`,defaultEmotion:`smiling_warmly`,greetings:[`Morning! The sunrise looks pretty incredible from up here today. How are you feeling—ready to solve a few problems, or still waiting for your coffee to kick in?`,`Hey, good morning! Did you get some good rest? Don’t rush into the hardest problems right away—let’s ease in with a warmup.`,`Good morning! It’s really quiet and peaceful right now. Honestly the best time to get some focused thinking done before the rest of the world wakes up.`]},day:{state:`day`,label:`High Sun`,hourRange:[12,18],activity:`Reviewing architectural scrolls in the tower library`,lightingClass:`from-sky-100/80 via-amber-50/70 to-yellow-100/60`,defaultEmotion:`neutral`,greetings:[`Hey, welcome back! How’s your focus holding up today? Remember to step back and take a breath if your eyes start feeling tired.`,`Hey there! I was just organizing some notes in the tower library. What problem pattern are we working through right now?`,`Good to see you! Remember, steady consistency beats frantic cramming every single time. One clean solution at a time.`]},dusk:{state:`dusk`,label:`Twilight & Beacon Fire`,hourRange:[18,22],activity:`Lighting lanterns along the stone balcony as the sun sets`,lightingClass:`from-orange-100/90 via-purple-100/60 to-amber-200/70`,defaultEmotion:`smiling_warmly`,greetings:[`Evening! You’ve put in solid effort today. How are you feeling—ready to wrap things up, or finishing one last review?`,`Hey, the sun is setting over the valley. It’s so easy to lose track of time when deep in code. Make sure you stretch your neck and shoulders a bit.`,`Good evening! How did today’s practice go? Even getting through one tricky problem is real, meaningful progress.`]},night:{state:`night`,label:`Midnight Candlelight`,hourRange:[22,6],activity:`Listening to the quiet wind outside by soft candlelight`,lightingClass:`from-indigo-950/80 via-slate-900/90 to-amber-950/40 text-amber-100`,defaultEmotion:`concerned`,greetings:[`Hey... it’s getting really late. Are you okay? Late-night debugging usually just turns simple typos into monsters—promise me you’ll head to sleep soon.`,`Midnight already? I’m always glad to talk with you, but coding while exhausted will just burn you out. Take it easy tonight, okay?`,`Still awake? Don’t push yourself past your limit. Your brain actually reorganizes problem solutions while you sleep—go rest up for tomorrow.`]}};function oe(e=new Date){let t=e.getHours();return t>=6&&t<12?`dawn`:t>=12&&t<18?`day`:t>=18&&t<22?`dusk`:`night`}function se(e=new Date){return ae[oe(e)]}function ce(e=`Champion`){let t=se(),n=t.greetings;return{text:(n[Math.floor(Math.random()*n.length)]||n[0]).replace(/\{hero\}/g,e||`Champion`),emotion:t.defaultEmotion,rhythm:t.state}}function le(e,t=`Champion`){return{text:`Hey, ${t}... ${e} misses in a row is almost always mental fatigue, not a lack of ability. Step away from the screen for just five minutes, grab a drink of water, and let your head clear. You’ll see the solution much faster once you reset.`,emotion:`concerned`}}var ue=`algospaced_companion_state_v2`,de={enabled:!0,name:`Princess Aurelia`,backstory:`Princess Aurelia is a noble, intelligent, and deeply caring scholar-princess trapped inside the Spire of Big-O Complexity. You are her champion traveling the 150 leagues of the royal road to break her magical seals.`,breakIntervalMinutes:25,soundEnabled:!0,autoPopupEnabled:!0},fe={heroName:`Champion`,targetGoal:``,preferredLanguage:`Python`,strengths:[],nemesisPatterns:[],personalNotes:[],lastUpdated:Date.now()};function pe(e,t,n){let r={...e,lastUpdated:Date.now()},i=n.trim();if(!i)return e;switch(t){case`heroName`:r.heroName=i;break;case`targetGoal`:r.targetGoal=i;break;case`preferredLanguage`:r.preferredLanguage=i;break;case`strengths`:r.strengths.includes(i)||(r.strengths=[...r.strengths,i].slice(-10));break;case`nemesisPatterns`:r.nemesisPatterns.includes(i)||(r.nemesisPatterns=[...r.nemesisPatterns,i].slice(-10));break;case`personalNotes`:{let e=r.personalNotes.findIndex(e=>e.toLowerCase().includes(i.toLowerCase().slice(0,15)));e>=0?r.personalNotes[e]=i:r.personalNotes=[...r.personalNotes,i].slice(-15);break}default:r.personalNotes.includes(i)||(r.personalNotes=[...r.personalNotes,i].slice(-15))}return r}function me(e,t,n,r=3){if(!e||e.length===0)return[];let i=(t+` `+(n||``)).toLowerCase(),a=e.map((e,t)=>{let r=0,a=(e.title+` `+e.description+` `+(e.relatedPattern||``)).toLowerCase();n&&e.relatedPattern&&e.relatedPattern.toLowerCase()===n.toLowerCase()&&(r+=5);let o=i.split(/\s+/).filter(e=>e.length>3);for(let e of o)a.includes(e)&&(r+=2);let s=(Date.now()-e.timestamp)/864e5;return r+=Math.max(0,3-s*.3),e.eventType===`breakthrough`&&(r+=2),e.eventType===`fatigue_episode`&&(r+=2),{event:e,index:t,score:r}});a.sort((e,t)=>t.score-e.score);let o=a.slice(0,2),s=new Set,c=[];for(let t of o)if(!(t.score<=.5)&&(s.has(t.event.id)||(s.add(t.event.id),c.push(`[${t.event.eventType.toUpperCase()}] ${t.event.title}: ${t.event.description}`)),t.event.contiguousEventId)){let n=e.find(e=>e.id===t.event.contiguousEventId);n&&!s.has(n.id)&&c.length=50?`Soulbound Confidante`:e>=10?`Trusted Ally`:`Acquaintance`}function ge(){let e=se(),t={id:`turn-init`,sender:`princess`,text:`Hey! I’m Aurelia. It gets pretty quiet up here in the tower, so I’m really glad you stopped by. How are you holding up with your coding practice today?`,emotion:`smiling_warmly`,timestamp:Date.now(),provider:`Spire Relay`};try{let n=localStorage.getItem(ue);if(n){let r=JSON.parse(n),i=Array.isArray(r.transcript)&&r.transcript.length>0?r.transcript:[t],a=i.filter(e=>e.sender===`user`).length;return{transcript:i,activeEmotion:r.activeEmotion||e.defaultEmotion,isTyping:!1,isLoading:!1,heroProfile:r.heroProfile||{heroName:`Champion`,targetGoal:``},heroCodex:r.heroCodex||{...fe,heroName:r.heroProfile?.heroName||`Champion`,targetGoal:r.heroProfile?.targetGoal||``},episodicEvents:Array.isArray(r.episodicEvents)?r.episodicEvents:[],journeyLog:Array.isArray(r.journeyLog)?r.journeyLog:[],currentFloor:Number(r.currentFloor||0),maxFloor:150,totalSolved:Number(r.totalSolved||r.currentFloor||0),unlockedMilestones:Array.isArray(r.unlockedMilestones)?r.unlockedMilestones:[0],unlockedLetters:Array.isArray(r.unlockedLetters)?r.unlockedLetters:[],spireChronicles:Array.isArray(r.spireChronicles)?r.spireChronicles:[],bondTier:he(a),currentRhythm:e.state,currentActivity:e.activity,companionSettings:{...de,...r.companionSettings||{}},consecutiveFailures:0,recentToolTelemetry:Array.isArray(r.recentToolTelemetry)?r.recentToolTelemetry:[]}}}catch(e){console.warn(`[CompanionStore] Failed to load from localStorage:`,e)}return{transcript:[t],activeEmotion:e.defaultEmotion,isTyping:!1,isLoading:!1,heroProfile:{heroName:`Champion`,targetGoal:``},heroCodex:fe,episodicEvents:[],journeyLog:[],currentFloor:0,maxFloor:150,totalSolved:0,unlockedMilestones:[0],unlockedLetters:[],spireChronicles:[],bondTier:`Acquaintance`,currentRhythm:e.state,currentActivity:e.activity,companionSettings:de,consecutiveFailures:0,recentToolTelemetry:[]}}var J=ge(),_e=new Set;function ve(){try{let e={transcript:J.transcript.slice(-60),activeEmotion:J.activeEmotion,heroProfile:J.heroProfile,heroCodex:J.heroCodex,episodicEvents:J.episodicEvents.slice(-40),journeyLog:J.journeyLog.slice(-50),currentFloor:J.currentFloor,totalSolved:J.totalSolved,unlockedMilestones:J.unlockedMilestones,unlockedLetters:J.unlockedLetters,spireChronicles:J.spireChronicles.slice(-30),companionSettings:J.companionSettings,recentToolTelemetry:(J.recentToolTelemetry||[]).slice(-30)};localStorage.setItem(ue,JSON.stringify(e))}catch(e){console.error(`[CompanionStore] Save error:`,e)}_e.forEach(e=>e())}function Y(e){J={...J,...e},ve()}var X={getState:()=>J,subscribe:e=>(_e.add(e),()=>_e.delete(e)),setEmotion:e=>{Y({activeEmotion:e})},setIsTyping:e=>{J.isTyping!==e&&Y({isTyping:e})},updateProfile:e=>{Y({heroProfile:{...J.heroProfile,...e}})},updateCodex:(e,t)=>{let n=pe(J.heroCodex,e,t);Y({heroCodex:n,heroProfile:{...J.heroProfile,heroName:n.heroName,targetGoal:n.targetGoal,preferredLanguage:n.preferredLanguage}})},removeCodexItem:(e,t)=>{let n=(J.heroCodex[e]||[]).filter(e=>e!==t);Y({heroCodex:{...J.heroCodex,[e]:n,lastUpdated:Date.now()}})},recordEpisodicEvent:e=>{let t=J.episodicEvents[0];Y({episodicEvents:[{id:`ev-${Date.now()}`,timestamp:Date.now(),...e,contiguousEventId:e.contiguousEventId||t?.id},...J.episodicEvents].slice(0,40)})},updateSettings:e=>{Y({companionSettings:{...J.companionSettings,...e}})},executeTool:async e=>{let t=await ie(e);return e.name===`write_spire_diary`&&t.success&&t.data?.text?X.addDiaryEntry(t.data.text):e.name===`update_hero_codex`&&t.success&&t.data?.key&&t.data?.value?X.updateCodex(t.data.key,t.data.value):e.name===`record_episodic_event`&&t.success&&t.data&&X.recordEpisodicEvent({eventType:t.data.eventType||`session_summary`,title:t.data.title||`Event`,description:t.data.description||``,relatedPattern:t.data.relatedPattern,emotionalTone:J.activeEmotion}),Y({recentToolTelemetry:[{tool_name:e.name,args:e.args,success:t.success,execution_time_ms:t.durationMs||0,hero_name:J.heroCodex.heroName||`Champion`,source:`client`,error:t.success?void 0:t.message,timestamp:Date.now()/1e3},...J.recentToolTelemetry||[]].slice(0,30)}),t},addDiaryEntry:e=>{Y({spireChronicles:[{id:`diary-${Date.now()}`,timestamp:Date.now(),floor:J.currentFloor,text:e},...J.spireChronicles]})},sendMessage:async e=>{let t=e.trim();if(!t||J.isLoading)return;let n={id:`user-${Date.now()}`,sender:`user`,text:t,timestamp:Date.now()},r=[...J.transcript,n],i=r.filter(e=>e.sender===`user`).length,a=he(i),o=`princess-${Date.now()}`,s={id:o,sender:`princess`,text:``,emotion:`thinking_expression`,timestamp:Date.now(),isStreaming:!0,provider:`Spire Agent Stream`};Y({transcript:[...r,s],isLoading:!0,isTyping:!0,activeEmotion:`thinking_expression`,bondTier:a});try{let e=se(),n=me(J.episodicEvents,t),i=``;await te({princess_name:J.companionSettings.name,user_message:t,current_floor:J.currentFloor,streak_days:0,hero_name:J.heroCodex.heroName||J.heroProfile.heroName||`Champion`,target_goal:J.heroCodex.targetGoal||J.heroProfile.targetGoal,bond_tier:a,current_rhythm:e.state,hero_codex:J.heroCodex,episodic_memories:n,messages:r.slice(-10)},{onDelta:e=>{i+=e,Y({transcript:J.transcript.map(e=>e.id===o?{...e,text:i,isStreaming:!0}:e),isLoading:!1,isTyping:!0})},onDone:e=>{if(Array.isArray(e.tool_calls))for(let t of e.tool_calls)X.executeTool(t);let t=e.text||i||`I believe in you, champion!`;Y({transcript:J.transcript.map(n=>n.id===o?{...n,text:t,emotion:e.emotion,toolCalls:e.tool_calls,choiceSuggestions:e.choice_suggestions,provider:e.provider_used||`Spire Agent Stream`,isStreaming:!1}:n),activeEmotion:e.emotion,isLoading:!1,isTyping:!1})},onError:e=>{console.warn(`[CompanionStore] Stream failed, using fallback:`,e);let t=q.idle_chat,n=t[Math.floor(Math.random()*t.length)];Y({transcript:J.transcript.map(e=>e.id===o?{...e,text:n.text,emotion:n.emotion,provider:`Offline Script`,isStreaming:!1}:e),activeEmotion:n.emotion,isLoading:!1,isTyping:!1})}})}catch(e){console.error(`[CompanionStore] Send message error:`,e);let t=q.idle_chat,n=t[Math.floor(Math.random()*t.length)],r={id:o,sender:`princess`,text:n.text,emotion:n.emotion,timestamp:Date.now(),provider:`Offline Script`,isStreaming:!1};Y({transcript:J.transcript.map(e=>e.id===o?r:e),activeEmotion:n.emotion,isLoading:!1,isTyping:!1})}},addReviewEvent:async(e,t=`a problem`,n=``)=>{let r=e===`Correct`,i=J.currentFloor,a=J.totalSolved,o=[...J.unlockedMilestones],s=[...J.unlockedLetters],c=J.consecutiveFailures,l=r?0:c+1,u=!1,d=0;if(r&&J.currentFloor=e&&!o.includes(e)){o.push(e),u=!0,d=e;let t=K[e];t&&!s.some(t=>t.floor===e)&&s.push({...t,unlockedAt:Date.now()})}}let f={id:`ep-${Date.now()}`,timestamp:Date.now(),type:r?`victory`:`struggle`,summary:`${r?`Mastered`:`Faced`} ${t} (${n||`DSA`}) - Graded ${e}`,floor:i};if(Y({currentFloor:i,totalSolved:a,unlockedMilestones:o,unlockedLetters:s,consecutiveFailures:l,journeyLog:[f,...J.journeyLog]}),u&&X.recordEpisodicEvent({eventType:`milestone`,title:`Passed League ${d}`,description:`Advanced past League ${d} on the road to the Spire of Big-O! Unlocked a royal missive from Aurelia.`,relatedPattern:n,emotionalTone:`excited_expression`}),r&&c>=2){let e=J.episodicEvents.find(e=>e.eventType===`fatigue_episode`||n&&e.relatedPattern?.toLowerCase()===n.toLowerCase());X.recordEpisodicEvent({eventType:`breakthrough`,title:`Breakthrough: ${t}`,description:`Broke through previous hurdles to solve ${t}${n?` (${n})`:``} flawlessly!`,relatedPattern:n,emotionalTone:`excited_expression`,contiguousEventId:e?.id})}if(l>=3){X.recordEpisodicEvent({eventType:`fatigue_episode`,title:`Fatigue: ${n||t}`,description:`Encountered 3 consecutive review struggles, most recently on ${t}${n?` (${n})`:``}. Aurelia intervened with rest advice.`,relatedPattern:n,emotionalTone:`concerned`});let e=le(l,J.heroProfile.heroName),r={id:`fatigue-${Date.now()}`,sender:`princess`,text:e.text,emotion:e.emotion,timestamp:Date.now(),provider:`Fatigue Watchdog`};Y({transcript:[...J.transcript,r],activeEmotion:e.emotion});return}let p=se(),m=q[r?`problem_correct`:`problem_incorrect`],h=m[Math.floor(Math.random()*m.length)],g={id:`rev-${Date.now()}`,sender:`princess`,text:h.text,emotion:h.emotion,timestamp:Date.now(),provider:`Journey Log`};Y({transcript:[...J.transcript,g],activeEmotion:h.emotion,currentRhythm:p.state,currentActivity:p.activity})},triggerProactiveGreeting:()=>{let e=se();Y({currentRhythm:e.state,currentActivity:e.activity});let t=J.transcript[J.transcript.length-1],n=Date.now();if(t&&n-t.timestamp<18e5)return;let r=ce(J.heroProfile.heroName||`Champion`),i={id:`proactive-${n}`,sender:`princess`,text:r.text,emotion:r.emotion,timestamp:n,provider:`Tower Rhythm`};Y({transcript:[...J.transcript,i],activeEmotion:r.emotion})},clearTranscript:()=>{Y({transcript:[{id:`init-${Date.now()}`,sender:`princess`,text:`The slate is refreshed, champion! How may I accompany your algorithmic journey right now?`,emotion:`smiling_warmly`,timestamp:Date.now(),provider:`Spire Relay`}],activeEmotion:`smiling_warmly`})},syncWithBackend:async()=>{try{let{data:{session:e}}=await O.auth.getSession(),t={Authorization:`Bearer ${e?e.access_token:`sandbox`}`},n=await fetch(`/api/journey-progress`,{headers:t});if(n.ok){let e=await n.json(),t=Array.isArray(e)?e.length:0,r=Math.min(150,t),i=[30,60,90,120,150],a=[0],o=[...J.unlockedLetters];i.forEach(e=>{if(r>=e){a.push(e);let t=K[e];t&&!o.some(t=>t.floor===e)&&o.push({...t,unlockedAt:Date.now()})}}),Y({currentFloor:r,totalSolved:t,unlockedMilestones:a,unlockedLetters:o})}}catch(e){console.warn(`[CompanionStore] Sync with backend journey failed:`,e)}}};function ye(){return(0,A.useSyncExternalStore)(X.subscribe,X.getState,X.getState)}var be={neutral:{id:`neutral`,label:`Calm`,imagePath:`/sprites/princess/neutral.webp`},smiling_warmly:{id:`smiling_warmly`,label:`Smiling Warmly`,imagePath:`/sprites/princess/smiling_warmly.webp`},excited_expression:{id:`excited_expression`,label:`Excited`,imagePath:`/sprites/princess/excited_expression.webp`},thinking_expression:{id:`thinking_expression`,label:`Thinking`,imagePath:`/sprites/princess/thinking_expression.webp`},concerned:{id:`concerned`,label:`Concerned`,imagePath:`/sprites/princess/concerned.webp`},fear:{id:`fear`,label:`Startled`,imagePath:`/sprites/princess/fear.webp`},sad_expression:{id:`sad_expression`,label:`Melancholy`,imagePath:`/sprites/princess/sad_expression.webp`}},xe=null;function Se(){if(typeof window>`u`)return null;if(!xe){let e=window,t=window.AudioContext||e.webkitAudioContext;t&&(xe=new t)}return xe&&xe.state===`suspended`&&xe.resume().catch(()=>{}),xe}function Ce(){try{return localStorage.getItem(`companion_sound_enabled`)===`false`}catch{return!1}}function we(e){try{localStorage.setItem(`companion_sound_enabled`,e?`false`:`true`)}catch{}}function Te(){if(Ce())return;let e=Se();if(e)try{let t=[523.25,659.25,783.99,1046.5],n=e.currentTime;t.forEach((t,r)=>{let i=e.createOscillator(),a=e.createGain();i.type=`sine`,i.frequency.setValueAtTime(t,n+r*.06),a.gain.setValueAtTime(.06,n+r*.06),a.gain.exponentialRampToValueAtTime(.001,n+r*.06+.18),i.connect(a),a.connect(e.destination),i.start(n+r*.06),i.stop(n+r*.06+.2)})}catch{}}function Ee(){if(Ce())return;let e=Se();if(e)try{let t=[440,554.37,659.25,880],n=e.currentTime;t.forEach((t,r)=>{let i=e.createOscillator(),a=e.createGain();i.type=`triangle`,i.frequency.setValueAtTime(t,n+r*.09),a.gain.setValueAtTime(.07,n+r*.09),a.gain.exponentialRampToValueAtTime(1e-4,n+r*.09+.35),i.connect(a),a.connect(e.destination),i.start(n+r*.09),i.stop(n+r*.09+.4)})}catch{}}function De({onOpenCompanionWindow:e}){let t=ye(),[n,r]=(0,A.useState)(!1),[i,o]=(0,A.useState)(``),[s,c]=(0,A.useState)(!1),[l,u]=(0,A.useState)(Ce()),d=(0,A.useRef)(null),f=(0,A.useRef)(null),p=(0,A.useRef)(``);if((0,A.useEffect)(()=>{let e=t.transcript[t.transcript.length-1];if(e&&e.sender===`princess`&&t.companionSettings.enabled&&t.companionSettings.autoPopupEnabled&&e.id!==p.current&&(e.id.startsWith(`rev-`)||e.id.startsWith(`fatigue-`)||e.id.startsWith(`proactive-`))){p.current=e.id,r(!0),Te(),o(``),c(!0);let t=0;d.current&&clearInterval(d.current),d.current=setInterval(()=>{t{r(!1)},8e3))},24)}},[t.transcript,t.companionSettings.enabled,t.companionSettings.autoPopupEnabled]),!n)return null;let m=t.transcript[t.transcript.length-1],g=be[t.activeEmotion]||be.smiling_warmly,v=G(t.currentFloor);return(0,M.jsx)(`div`,{className:`fixed bottom-14 right-3 sm:right-6 z-[9990] max-w-[480px] w-[calc(100vw-24px)] transition-all animate-in fade-in slide-in-from-bottom-5 duration-300 select-none`,onClick:()=>{s&&m&&(d.current&&clearInterval(d.current),o(m.text),c(!1))},children:(0,M.jsxs)(`div`,{className:`relative bg-[#FFFDF0] border-[3px] border-ink-black rounded-lg shadow-[6px_6px_0px_0px_#1E293B] overflow-hidden flex flex-col font-sans`,children:[(0,M.jsxs)(`div`,{className:`bg-[#FFE24C] border-b-[3px] border-ink-black px-3 py-1.5 flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,M.jsxs)(`span`,{className:`text-xs font-bold font-headline-md text-ink-black tracking-wide truncate flex items-center gap-1`,children:[(0,M.jsx)(T,{className:`w-3.5 h-3.5 text-amber-600 shrink-0`}),t.companionSettings.name||`Princess Aurelia`]}),(0,M.jsxs)(`span`,{className:`bg-ink-black text-[#FFE24C] text-[9px] font-bold font-arcade px-1.5 py-0.5 rounded shrink-0`,children:[t.currentFloor,`/150 LC`]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation();let t=!l;u(t),we(t)},className:`p-1 hover:bg-black/10 rounded text-ink-black cursor-pointer border-0 bg-transparent`,title:l?`Unmute Audio`:`Mute Audio`,children:l?(0,M.jsx)(h,{className:`w-3.5 h-3.5`}):(0,M.jsx)(b,{className:`w-3.5 h-3.5`})}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>r(!1),className:`p-1 hover:bg-rose-500 hover:text-white rounded text-ink-black cursor-pointer border-0 bg-transparent`,title:`Dismiss`,children:(0,M.jsx)(w,{className:`w-3.5 h-3.5`})})]})]}),(0,M.jsxs)(`div`,{className:`p-3 sm:p-4 flex gap-3 sm:gap-4 items-start`,children:[(0,M.jsx)(`div`,{className:`relative shrink-0 flex flex-col items-center`,children:(0,M.jsxs)(`div`,{className:`w-16 h-20 sm:w-20 sm:h-24 bg-gradient-to-b from-amber-100 to-amber-200 border-[2px] border-ink-black rounded overflow-hidden shadow-[2px_2px_0px_0px_#1E293B] relative group flex items-center justify-center`,children:[(0,M.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center text-amber-700/40 pointer-events-none select-none`,children:[(0,M.jsx)(T,{className:`w-6 h-6 animate-pulse`}),(0,M.jsx)(`span`,{className:`font-arcade text-[8px] mt-1`,children:`Aurelia`})]}),(0,M.jsx)(`img`,{src:g.imagePath,alt:g.label,loading:`eager`,className:`w-full h-full object-cover object-top relative z-10`,onError:e=>{let t=e.currentTarget;t.src.endsWith(`/sprites/princess/neutral.webp`)?t.style.display=`none`:t.src=`/sprites/princess/neutral.webp`}}),(0,M.jsx)(`div`,{className:`absolute bottom-0 inset-x-0 bg-ink-black/80 text-[8px] text-amber-200 text-center py-0.5 font-bold uppercase tracking-wider z-20`,children:g.label})]})}),(0,M.jsxs)(`div`,{className:`flex-1 flex flex-col justify-between min-h-[85px]`,children:[(0,M.jsxs)(`div`,{className:`relative bg-white border-[2px] border-ink-black rounded p-2.5 shadow-xs min-h-[60px]`,children:[(0,M.jsx)(`div`,{className:`absolute -left-[7px] top-4 w-3 h-3 bg-white border-l-[2px] border-b-[2px] border-ink-black rotate-45`}),(0,M.jsxs)(`p`,{className:`text-xs sm:text-[13px] text-ink-black font-medium leading-relaxed m-0 whitespace-pre-wrap`,children:[i,s&&(0,M.jsx)(`span`,{className:`inline-block w-1.5 h-3.5 bg-amber-500 ml-0.5 animate-pulse align-middle`})]})]}),(0,M.jsxs)(`div`,{className:`text-[10px] text-trash-gray font-medium mt-1.5 flex items-center justify-between`,children:[(0,M.jsxs)(`span`,{className:`truncate`,children:[`🗺️ `,v.title]}),s&&(0,M.jsx)(`span`,{className:`text-[9px] text-amber-700 font-bold animate-pulse shrink-0`,children:`Speaking...`})]})]})]}),(0,M.jsxs)(`div`,{className:`px-3 pb-3 pt-1 flex flex-wrap items-center justify-end gap-2 border-t border-amber-200/60 bg-amber-50/40`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>{e(),r(!1)},className:`flex items-center gap-1 px-2.5 py-1 bg-[#FFE24C] hover:bg-yellow-300 text-ink-black border-[2px] border-ink-black rounded text-[11px] font-bold shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer`,children:[(0,M.jsx)(a,{className:`w-3 h-3`}),(0,M.jsx)(`span`,{children:`Talk to Her`}),(0,M.jsx)(_,{className:`w-3 h-3`})]}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>r(!1),className:`px-2.5 py-1 bg-white hover:bg-slate-100 text-slate-700 border-[2px] border-slate-300 rounded text-[11px] font-bold active:translate-y-0.5 transition-all cursor-pointer`,children:`Dismiss`})]})]})})}var Oe={neutral:{id:`neutral`,label:`Calm`,imagePath:`/sprites/princess/neutral.webp`},smiling_warmly:{id:`smiling_warmly`,label:`Smiling Warmly`,imagePath:`/sprites/princess/smiling_warmly.webp`},excited_expression:{id:`excited_expression`,label:`Excited`,imagePath:`/sprites/princess/excited_expression.webp`},thinking_expression:{id:`thinking_expression`,label:`Thinking`,imagePath:`/sprites/princess/thinking_expression.webp`},concerned:{id:`concerned`,label:`Concerned`,imagePath:`/sprites/princess/concerned.webp`},fear:{id:`fear`,label:`Startled`,imagePath:`/sprites/princess/fear.webp`},sad_expression:{id:`sad_expression`,label:`Melancholy`,imagePath:`/sprites/princess/sad_expression.webp`}},ke={enabled:!0,name:`Princess Aurelia`,backstory:`Princess Aurelia is trapped in the high Spire of Big-O Complexity. You are a brave traveler journeying across the kingdom. By mastering all 150 LeetCode problems along the royal road, you will reach the tower gates and break her magical seal!`,breakIntervalMinutes:25,soundEnabled:!0,autoPopupEnabled:!0},Ae=[{floorRange:[1,30],title:`The Plains of Arrays & Strings`,description:`Rolling green meadows and ancient cobblestone roads where the journey begins.`,bgLore:`Looking out towards the distant horizon, the silhouette of the Spire pierces the clouds.`},{floorRange:[31,60],title:`The Whispering Forest of Pointers`,description:`Winding paths through dense groves where two pointers guide your compass.`,bgLore:`Aurelia’s magical beacon shines above the treetops, guiding your footsteps along the trail.`},{floorRange:[61,90],title:`The Grand Caverns of Trees & Graphs`,description:`Bioluminescent caves with branching crystal arches and subterranean passes.`,bgLore:`Halfway to the tower! Her voice echoes with hope over the enchanted royal relay.`},{floorRange:[91,120],title:`The High Mountain Passes of Heaps & Backtracking`,description:`Perilous alpine ridges and snowy peaks overlooking the Spire valley.`,bgLore:`From the highest ridge, the base of the Spire is in sight through the mountain mist!`},{floorRange:[121,149],title:`The Enchanted Valley of Dynamic Programming`,description:`Shimmering mystical grounds where optimal solutions bridge the final moat.`,bgLore:`The final leagues! The Spire looms directly ahead, its ancient runic wards trembling.`},{floorRange:[150,150],title:`The Gates of the Big-O Spire`,description:`Standing at the threshold of the grand tower gates to break the seal and free Aurelia!`,bgLore:`150 algorithms conquered! You have completed the grand journey and reached the Spire!`}],je={break_reminder:[{id:`br-1`,text:`Brave traveler! You have traveled many leagues today. Even the swiftest steeds rest by the campfire—shall we pause for a stretch and some water?`,emotion:`concerned`,context:`break_reminder`},{id:`br-2`,text:`I can see your progress across the plains from my tower window! Please rest your eyes for a moment; a clear mind travels swiftest.`,emotion:`smiling_warmly`,context:`break_reminder`},{id:`br-3`,text:`The evening winds carry word of your relentless march. Take 5 minutes to rest—I will keep watch from the Spire beacon!`,emotion:`thinking_expression`,context:`break_reminder`},{id:`br-4`,text:`Do not exhaust yourself on the road, my hero! Pacing is the secret to enduring a 150-problem expedition. Let us take a short pause.`,emotion:`concerned`,context:`break_reminder`}],problem_correct:[{id:`pc-1`,text:`Magnificent! You conquered that obstacle and advanced another league closer to my tower!`,emotion:`excited_expression`,context:`problem_correct`},{id:`pc-2`,text:`A flawless solution! With every problem you master, the distance between us grows shorter.`,emotion:`smiling_warmly`,context:`problem_correct`},{id:`pc-3`,text:`Incredible speed and elegance! I felt the Spire beacon flare with light as you crossed another milestone!`,emotion:`excited_expression`,context:`problem_correct`},{id:`pc-4`,text:`You handled that algorithm with true mastery. Step by step, league by league, you are approaching the Spire gates!`,emotion:`smiling_warmly`,context:`problem_correct`}],problem_incorrect:[{id:`pi-1`,text:`Do not despair, noble traveler! The road to the Spire has rough terrain. Review the edge cases and let us push forward!`,emotion:`concerned`,context:`problem_incorrect`},{id:`pi-2`,text:`Every wrong turn on the map teaches you the true layout of the land. Let us examine the test case together.`,emotion:`thinking_expression`,context:`problem_incorrect`},{id:`pi-3`,text:`Stay steadfast! I believe in your courage and intellect. Take a breath—we will conquer this pass together!`,emotion:`smiling_warmly`,context:`problem_incorrect`},{id:`pi-4`,text:`A challenging problem! But overcoming difficult obstacles is what makes a legendary hero. Keep your head high!`,emotion:`neutral`,context:`problem_incorrect`}],streak_milestone:[{id:`sm-1`,text:`A glorious travel streak! Your daily dedication across the realms is inspiring. The Spire bells chime in your honor!`,emotion:`excited_expression`,context:`streak_milestone`},{id:`sm-2`,text:`Look at that continuous march! Consistency is the true magic that brings you across all 150 leagues to the tower.`,emotion:`smiling_warmly`,context:`streak_milestone`}],study_start:[{id:`ss-1`,text:`Welcome back to the trail, brave adventurer! Which algorithmic territories shall we cross today on our way to the Spire?`,emotion:`smiling_warmly`,context:`study_start`},{id:`ss-2`,text:`I saw the dust of your travel carriage on the horizon! Ready to conquer today’s review queue and draw closer to the tower?`,emotion:`excited_expression`,context:`study_start`}],idle_motivation:[{id:`im-1`,text:`Whenever the trail seems daunting, break the problem into smaller sub-problems. Every step counts toward the 150 milestone!`,emotion:`thinking_expression`,context:`idle_motivation`},{id:`im-2`,text:`I am watching over your journey and cheering you on! Your quest brings hope to this entire realm.`,emotion:`smiling_warmly`,context:`idle_motivation`},{id:`im-3`,text:`150 problems is a grand quest, but you have the intellect and heart to reach the Spire gates!`,emotion:`neutral`,context:`idle_motivation`}],tower_milestone:[{id:`tm-1`,text:`You have crossed the Plains of Arrays! 30 problems mastered—the first realm is behind us!`,emotion:`excited_expression`,context:`tower_milestone`,floorRequirement:30},{id:`tm-2`,text:`You emerged from the Whispering Forest! 60 problems solved—I can see your banner waving near the foothills!`,emotion:`excited_expression`,context:`tower_milestone`,floorRequirement:60},{id:`tm-3`,text:`Through the Grand Caverns! 90 problems conquered—more than halfway to the Spire!`,emotion:`smiling_warmly`,context:`tower_milestone`,floorRequirement:90},{id:`tm-4`,text:`You crested the High Mountain Passes! 120 problems conquered—the Spire valley is right before you!`,emotion:`excited_expression`,context:`tower_milestone`,floorRequirement:120},{id:`tm-5`,text:`YOU HAVE REACHED THE SPIRE GATES! All 150 LeetCode problems conquered! The grand seals shatter—freedom at last, my legendary champion!`,emotion:`excited_expression`,context:`tower_milestone`,floorRequirement:150}],chat_response:[]},Me=`companion_settings`,Ne=`tower_progress`;function Pe(){try{let e=localStorage.getItem(Me);return e?{...ke,...JSON.parse(e)}:ke}catch{return ke}}function Fe(e){try{localStorage.setItem(Me,JSON.stringify(e))}catch(e){console.error(`Failed to save companion settings:`,e)}}function Ie(){try{let e=localStorage.getItem(Ne);return e?JSON.parse(e):{currentFloor:0,maxFloor:150,totalSolved:0,unlockedMilestones:[0]}}catch{return{currentFloor:0,maxFloor:150,totalSolved:0,unlockedMilestones:[0]}}}function Le(e){try{localStorage.setItem(Ne,JSON.stringify(e))}catch(e){console.error(`Failed to save tower progress:`,e)}}function Re(){let e={currentFloor:0,maxFloor:150,totalSolved:0,unlockedMilestones:[0]};return Le(e),e}async function ze(){try{let{data:{session:e}}=await O.auth.getSession(),t={Authorization:`Bearer ${e?e.access_token:`sandbox`}`},n=await fetch(`/api/journey-progress`,{headers:t});if(n.ok){let e=await n.json(),t=Array.isArray(e)?e.length:0,r=Math.min(150,t),i=[30,60,90,120,150],a=[0];i.forEach(e=>{r>=e&&a.push(e)});let o={currentFloor:r,maxFloor:150,totalSolved:t,unlockedMilestones:a};return Le(o),o}}catch(e){console.error(`Failed to sync companion progress with backend journey:`,e)}return Ie()}function Be(e){return Ae.find(t=>e>=t.floorRange[0]&&e<=t.floorRange[1])||Ae[0]}function Ve(e,t){let n=je[e]||je.idle_motivation;if(t&&e===`tower_milestone`){let e=n.find(e=>e.floorRequirement===t);if(e)return e}return n[Math.floor(Math.random()*n.length)]||n[0]}function He({event:e,onClose:t,onOpenCompanionWindow:n}){let[r,i]=(0,A.useState)(``),[o,s]=(0,A.useState)(!1),[c,l]=(0,A.useState)(Ce()),[u,d]=(0,A.useState)(Ie()),f=Pe(),p=(0,A.useRef)(null),g=(0,A.useRef)(null);if((0,A.useEffect)(()=>{d(Ie())},[e]),(0,A.useEffect)(()=>{if(!e){i(``),s(!1);return}Te();let n=e.text;i(``),s(!0);let r=0;return p.current&&clearInterval(p.current),p.current=setInterval(()=>{r0&&(g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{t()},e.autoCloseDelay)))},28),()=>{p.current&&clearInterval(p.current),g.current&&clearTimeout(g.current)}},[e]),!e||!f.enabled)return null;let v=Oe[e.emotion]||Oe.smiling_warmly,y=Be(u.currentFloor),x=e=>{e.stopPropagation();let t=!c;l(t),we(t)},S=()=>{o&&e&&(p.current&&clearInterval(p.current),i(e.text),s(!1))},C=e.context===`break_reminder`;return(0,M.jsx)(`div`,{className:`fixed bottom-14 right-3 sm:right-6 z-[9990] max-w-[480px] w-[calc(100vw-24px)] transition-all animate-in fade-in slide-in-from-bottom-5 duration-300 select-none`,onClick:S,children:(0,M.jsxs)(`div`,{className:`relative bg-[#FFFDF0] border-[3px] border-ink-black rounded-lg shadow-[6px_6px_0px_0px_#1E293B] overflow-hidden flex flex-col font-sans`,children:[(0,M.jsxs)(`div`,{className:`bg-[#FFE24C] border-b-[3px] border-ink-black px-3 py-1.5 flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,M.jsxs)(`span`,{className:`text-xs font-bold font-headline-md text-ink-black tracking-wide truncate flex items-center gap-1`,children:[(0,M.jsx)(T,{className:`w-3.5 h-3.5 text-amber-600 shrink-0`}),f.name||`Princess Aurelia`]}),(0,M.jsxs)(`span`,{className:`bg-ink-black text-[#FFE24C] text-[9px] font-bold font-arcade px-1.5 py-0.5 rounded shrink-0`,children:[u.currentFloor,`/150 LC`]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:x,className:`p-1 hover:bg-black/10 rounded text-ink-black cursor-pointer transition-colors border-0 bg-transparent`,title:c?`Unmute Audio`:`Mute Audio`,children:c?(0,M.jsx)(h,{className:`w-3.5 h-3.5`}):(0,M.jsx)(b,{className:`w-3.5 h-3.5`})}),(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`p-1 hover:bg-rose-500 hover:text-white rounded text-ink-black cursor-pointer transition-colors border-0 bg-transparent`,title:`Dismiss Dialogue`,children:(0,M.jsx)(w,{className:`w-3.5 h-3.5`})})]})]}),(0,M.jsxs)(`div`,{className:`p-3 sm:p-4 flex gap-3 sm:gap-4 items-start`,children:[(0,M.jsx)(`div`,{className:`relative shrink-0 flex flex-col items-center`,children:(0,M.jsxs)(`div`,{className:`w-16 h-20 sm:w-20 sm:h-24 bg-gradient-to-b from-amber-100 to-amber-200 border-[2px] border-ink-black rounded overflow-hidden shadow-[2px_2px_0px_0px_#1E293B] relative group flex items-center justify-center`,children:[(0,M.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center text-amber-700/40 pointer-events-none select-none`,children:[(0,M.jsx)(T,{className:`w-6 h-6 animate-pulse`}),(0,M.jsx)(`span`,{className:`font-arcade text-[8px] mt-1`,children:`Aurelia`})]}),(0,M.jsx)(`img`,{src:v.imagePath,alt:v.label,loading:`eager`,className:`w-full h-full object-cover object-top transition-transform duration-300 group-hover:scale-105 relative z-10`,onError:e=>{let t=e.currentTarget;t.src.endsWith(`/sprites/princess/neutral.webp`)?t.style.display=`none`:t.src=`/sprites/princess/neutral.webp`}}),(0,M.jsx)(`div`,{className:`absolute bottom-0 inset-x-0 bg-ink-black/80 text-[8px] text-amber-200 text-center py-0.5 font-bold uppercase tracking-wider backdrop-blur-xs z-20`,children:v.label})]})}),(0,M.jsxs)(`div`,{className:`flex-1 flex flex-col justify-between min-h-[90px]`,children:[(0,M.jsxs)(`div`,{className:`relative bg-white border-[2px] border-ink-black rounded p-2.5 shadow-[2px_2px_0px_0px_rgba(0,0,0,0.06)] min-h-[64px]`,children:[(0,M.jsx)(`div`,{className:`absolute -left-[7px] top-4 w-3 h-3 bg-white border-l-[2px] border-b-[2px] border-ink-black rotate-45`}),(0,M.jsxs)(`p`,{className:`text-xs sm:text-[13px] text-ink-black font-medium leading-relaxed m-0 whitespace-pre-wrap`,children:[r,o&&(0,M.jsx)(`span`,{className:`inline-block w-1.5 h-3.5 bg-amber-500 ml-0.5 animate-pulse align-middle`})]})]}),(0,M.jsxs)(`div`,{className:`text-[10px] text-trash-gray font-medium mt-1.5 flex items-center justify-between`,children:[(0,M.jsx)(`span`,{className:`truncate flex items-center gap-1`,children:(0,M.jsxs)(`span`,{children:[`🗺️ `,y.title]})}),o&&(0,M.jsx)(`span`,{className:`text-[9px] text-amber-700 font-bold animate-pulse shrink-0`,children:`Speaking...`})]})]})]}),(0,M.jsxs)(`div`,{className:`px-3 pb-3 pt-1 flex flex-wrap items-center justify-end gap-2 border-t border-amber-200/60 bg-amber-50/40`,children:[C&&(0,M.jsxs)(`button`,{type:`button`,onClick:()=>{t()},className:`flex items-center gap-1 px-2.5 py-1 bg-emerald-500 hover:bg-emerald-600 text-white border-[2px] border-ink-black rounded text-[11px] font-bold shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer`,children:[(0,M.jsx)(m,{className:`w-3 h-3`}),(0,M.jsx)(`span`,{children:`Take a Break`})]}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>{n(),t()},className:`flex items-center gap-1 px-2.5 py-1 bg-[#FFE24C] hover:bg-yellow-300 text-ink-black border-[2px] border-ink-black rounded text-[11px] font-bold shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer`,children:[(0,M.jsx)(a,{className:`w-3 h-3`}),(0,M.jsx)(`span`,{children:`Talk to Her`}),(0,M.jsx)(_,{className:`w-3 h-3`})]}),(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`px-2.5 py-1 bg-white hover:bg-slate-100 text-slate-700 border-[2px] border-slate-300 rounded text-[11px] font-bold active:translate-y-0.5 transition-all cursor-pointer`,children:`Dismiss`})]})]})})}var Ue={queue:{isOpen:!0,isMinimized:!1},journey:{isOpen:!1,isMinimized:!1},terminal:{isOpen:!1,isMinimized:!1},computer:{isOpen:!1,isMinimized:!1},sync:{isOpen:!1,isMinimized:!1},github:{isOpen:!1,isMinimized:!1},python:{isOpen:!1,isMinimized:!1},mysql:{isOpen:!1,isMinimized:!1},settings:{isOpen:!1,isMinimized:!1},createProblem:{isOpen:!1,isMinimized:!1},editProblem:{isOpen:!1,isMinimized:!1},companion:{isOpen:!1,isMinimized:!1}},Z=C()(k((e,t)=>({windows:Ue,activeWindow:`queue`,windowZIndexes:{queue:40},maxZIndex:40,windowPositions:{},windowSizes:{},maximizedWindows:{},overrideProblemId:null,editingProblem:null,refreshExplorerTrigger:0,openWindow:n=>{let r=n,i=t().maxZIndex+1;e(e=>({windows:{...e.windows,[r]:{isOpen:!0,isMinimized:!1}},activeWindow:n,maxZIndex:i,windowZIndexes:{...e.windowZIndexes,[n]:i}}))},closeWindow:t=>{let n=t;e(e=>{let r=e.windows[n]||{isOpen:!1,isMinimized:!1},i={...e.windows,[n]:{...r,isOpen:!1}},a=e.activeWindow;if(e.activeWindow===t){let t=Object.entries(i).filter(([,e])=>e.isOpen&&!e.isMinimized).sort((t,n)=>(e.windowZIndexes[n[0]]||0)-(e.windowZIndexes[t[0]]||0));a=t.length>0?t[0][0]:``}return{windows:i,activeWindow:a}})},minimizeWindow:t=>{let n=t;e(e=>{let r=e.windows[n]||{isOpen:!0,isMinimized:!1},i={...e.windows,[n]:{...r,isMinimized:!0}},a=e.activeWindow;if(e.activeWindow===t){let n=Object.entries(i).filter(([e,n])=>n.isOpen&&!n.isMinimized&&e!==t).sort((t,n)=>(e.windowZIndexes[n[0]]||0)-(e.windowZIndexes[t[0]]||0));a=n.length>0?n[0][0]:``}return{windows:i,activeWindow:a}})},toggleWindowMinimize:e=>{let n=e,r=t(),i=r.windows[n]||{isOpen:!1,isMinimized:!1};i.isMinimized||!i.isOpen?t().openWindow(e):r.activeWindow===e?t().minimizeWindow(e):t().focusWindow(e)},focusWindow:n=>{let r=t();if(r.activeWindow===n)return;let i=r.maxZIndex+1;e({activeWindow:n,maxZIndex:i,windowZIndexes:{...r.windowZIndexes,[n]:i}})},setActiveWindow:e=>{t().focusWindow(e)},updateWindowPosition:(t,n,r)=>{e(e=>({windowPositions:{...e.windowPositions,[t]:{x:n,y:r}}}))},updateWindowSize:(t,n,r)=>{e(e=>({windowSizes:{...e.windowSizes,[t]:{width:n,height:r}}}))},toggleMaximize:t=>{e(e=>({maximizedWindows:{...e.maximizedWindows,[t]:!e.maximizedWindows[t]}}))},resetWindowBounds:t=>{e(e=>{let n={...e.windowPositions};delete n[t];let r={...e.windowSizes};delete r[t];let i={...e.maximizedWindows};return delete i[t],{windowPositions:n,windowSizes:r,maximizedWindows:i}})},setOverrideProblemId:t=>{e({overrideProblemId:t})},setEditingProblem:t=>{e({editingProblem:t})},openEditProblem:n=>{e({editingProblem:n}),t().openWindow(`editProblem`)},handleSelectProblemForReview:n=>{e({overrideProblemId:n}),t().openWindow(`queue`)},triggerRefreshExplorer:()=>{e(e=>({refreshExplorerTrigger:e.refreshExplorerTrigger+1}))},isAnyWindowOpen:()=>{let e=t();return Object.values(e.windows).some(e=>e.isOpen&&!e.isMinimized)}}),{name:`algospaced_os_state`,partialize:e=>({windows:e.windows,windowPositions:e.windowPositions,windowSizes:e.windowSizes,maximizedWindows:e.maximizedWindows}),merge:(e,t)=>{let n=e;return{...t,windows:{...t.windows,...n?.windows||{}},windowPositions:n?.windowPositions||t.windowPositions,windowSizes:n?.windowSizes||t.windowSizes,maximizedWindows:n?.maximizedWindows||t.maximizedWindows}}}));function We(e){let t=Z(e=>e.windows),n=Z(e=>e.activeWindow),r=Z(e=>e.overrideProblemId),i=Z(e=>e.editingProblem),a=Z(e=>e.refreshExplorerTrigger),o=(0,A.useCallback)(t=>{Z.getState().openWindow(t),e&&e()},[e]),s=(0,A.useCallback)(e=>{Z.getState().closeWindow(e)},[]),c=(0,A.useCallback)(e=>{Z.getState().minimizeWindow(e)},[]),l=(0,A.useCallback)(e=>{Z.getState().toggleWindowMinimize(e)},[]);return{windows:t,activeWindow:n,setActiveWindow:(0,A.useCallback)(e=>{Z.getState().setActiveWindow(e)},[]),overrideProblemId:r,setOverrideProblemId:(0,A.useCallback)(e=>{Z.getState().setOverrideProblemId(e)},[]),editingProblem:i,setEditingProblem:(0,A.useCallback)(e=>{Z.getState().setEditingProblem(e)},[]),openEditProblem:(0,A.useCallback)(e=>{Z.getState().openEditProblem(e)},[]),refreshExplorerTrigger:a,openWindow:o,closeWindow:s,minimizeWindow:c,toggleWindowMinimize:l,handleSelectProblemForReview:(0,A.useCallback)(e=>{Z.getState().handleSelectProblemForReview(e)},[]),triggerRefreshExplorer:(0,A.useCallback)(()=>{Z.getState().triggerRefreshExplorer()},[]),isAnyWindowOpen:(0,A.useMemo)(()=>Object.values(t).some(e=>e.isOpen&&!e.isMinimized),[t])}}function Ge(e,t){let[n,r]=(0,A.useState)(``),[i,a]=(0,A.useState)(null),[o,s]=(0,A.useState)(!1),[c,l]=(0,A.useState)(!1),[u,d]=(0,A.useState)(!1),[f,p]=(0,A.useState)(null);(0,A.useEffect)(()=>{let e=()=>{let e=new Date,t=e.getHours(),n=e.getMinutes(),i=t>=12?`PM`:`AM`;t%=12,t||=12;let a=n<10?`0`+n:String(n);r(`${t}:${a} ${i}`)};e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[]);let m=(0,A.useCallback)(async()=>{try{let{data:{session:e}}=await O.auth.getSession();if(!e)return;let t=await fetch(`/api/streak`,{headers:{Authorization:`Bearer ${e.access_token}`}});if(t.ok){let e=await t.json();a(e)}}catch(e){console.error(`Error fetching streak:`,e)}},[]);return(0,A.useEffect)(()=>{if(e){let e=setTimeout(()=>{m()},0);return ze(),()=>clearTimeout(e)}},[e,m]),(0,A.useEffect)(()=>{let e=()=>{s(window.innerWidth<768)};return e(),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},[]),(0,A.useEffect)(()=>{let e=()=>{l(!!document.fullscreenElement)};return document.addEventListener(`fullscreenchange`,e),()=>{document.removeEventListener(`fullscreenchange`,e)}},[]),(0,A.useEffect)(()=>{let e=e=>{e.ctrlKey&&e.preventDefault()},t=e=>{e.ctrlKey&&(e.key===`=`||e.key===`-`||e.key===`0`||e.key===`+`||e.code===`NumpadAdd`||e.code===`NumpadSubtract`)&&e.preventDefault()},n=e=>{e.touches.length>1&&e.preventDefault()};return document.addEventListener(`wheel`,e,{passive:!1}),document.addEventListener(`keydown`,t),document.addEventListener(`touchmove`,n,{passive:!1}),()=>{document.removeEventListener(`wheel`,e),document.removeEventListener(`keydown`,t),document.removeEventListener(`touchmove`,n)}},[]),{time:n,streak:i,fetchStreak:m,isMobile:o,isFullscreen:c,toggleFullscreen:(0,A.useCallback)(()=>{document.fullscreenElement?document.exitFullscreen().catch(e=>{console.error(`Error exiting fullscreen: ${e.message}`)}):document.documentElement.requestFullscreen().catch(e=>{console.error(`Error enabling fullscreen: ${e.message}`)})},[]),syncing:u,syncResult:f,triggerSync:(0,A.useCallback)(async()=>{t&&t(),d(!0),p(null);try{let{data:{session:e}}=await O.auth.getSession();if(!e)return;let t=await fetch(`/api/sync`,{method:`POST`,headers:{Authorization:`Bearer ${e.access_token}`}});if(t.ok){let e=await t.json();p(e.message||`Synchronization successfully completed!`),m(),ze()}else p(`Sync operation failed at server host.`)}catch{p(`Cloud synchronization server unreachable.`)}finally{d(!1)}},[t,m])}}var Ke=`/wallpapers/default.webp`;function qe(){let[e,t]=(0,A.useState)(()=>{let e=localStorage.getItem(`desktopWallpaperUrl`);return!e||e.includes(`lh3.googleusercontent.com`)?(localStorage.setItem(`desktopWallpaperUrl`,Ke),Ke):e}),n=(0,A.useCallback)(e=>{let n=new FileReader;n.onload=n=>{let r=new Image;r.onload=()=>{let i=document.createElement(`canvas`),a=r.width,o=r.height,s=1920,c=1080;(a>s||o>c)&&(a/o>s/c?(o=Math.round(o*s/a),a=s):(a=Math.round(a*c/o),o=c)),i.width=a,i.height=o;let l=i.getContext(`2d`);if(l){l.drawImage(r,0,0,a,o);try{let n=i.toDataURL(`image/jpeg`,.7);t(n),localStorage.setItem(`desktopWallpaperUrl`,n),localStorage.setItem(`customWallpaperUrl`,n),localStorage.setItem(`customWallpaperName`,e.name)}catch(e){console.error(`Failed to save compressed image to localStorage:`,e);let r=n.target?.result;t(r)}}else{let r=n.target?.result;t(r);try{localStorage.setItem(`desktopWallpaperUrl`,r),localStorage.setItem(`customWallpaperUrl`,r),localStorage.setItem(`customWallpaperName`,e.name)}catch(e){console.error(`Failed to save raw image to localStorage:`,e)}}},r.src=n.target?.result},n.readAsDataURL(e)},[]);return{wallpaperUrl:e,setWallpaperUrl:t,compressAndSaveWallpaper:n,handleWallpaperChange:(0,A.useCallback)((e,t)=>{t&&t();let r=e.target.files?.[0];r&&n(r)},[n])}}function Je(e,t){let[n,r]=(0,A.useState)(null);return(0,A.useEffect)(()=>{if(e){let e=Pe();if(e.enabled&&e.autoPopupEnabled){let e=setTimeout(()=>{let e=Ve(`study_start`);r({text:e.text,emotion:e.emotion,title:`✨ Welcome, Noble Hero!`,context:`study_start`,autoCloseDelay:7e3})},2500);return()=>clearTimeout(e)}}},[e]),(0,A.useEffect)(()=>{let e=e=>{let t=e;t.detail&&r(t.detail)},n=e=>{let n=e;n.detail?.windowId&&t(n.detail.windowId)};window.addEventListener(`companion:dialogue`,e),window.addEventListener(`companion:open_window`,n);let i=Date.now(),a=setInterval(()=>{let e=Pe();if(!(!e.enabled||!e.autoPopupEnabled||!e.breakIntervalMinutes||e.breakIntervalMinutes<=0)&&(Date.now()-i)/6e4>=e.breakIntervalMinutes){i=Date.now(),Ee();let e=Ve(`break_reminder`);r({text:e.text,emotion:e.emotion,title:`☕ Time for a Royal Pause`,context:`break_reminder`,autoCloseDelay:12e3})}},3e4);return()=>{window.removeEventListener(`companion:dialogue`,e),window.removeEventListener(`companion:open_window`,n),clearInterval(a)}},[t]),{companionDialogueEvent:n,setCompanionDialogueEvent:r}}var Ye=({isMobile:e,username:t,streak:n})=>e?null:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`absolute top-desktop-margin right-desktop-margin w-64 bg-paper-white border-[3px] border-ink-black gadget-shadow z-20 overflow-hidden flex flex-col shadow-[inset_2px_2px_0px_rgba(255,255,255,0.8)] select-none`,children:[(0,M.jsx)(`div`,{className:`bg-[#0ea5e9] border-b-[3px] border-ink-black px-3 py-1 flex justify-between items-center text-ink-black`,children:(0,M.jsx)(`span`,{className:`font-window-title text-xs font-bold tracking-wide`,children:`Profile.sys`})}),(0,M.jsxs)(`div`,{className:`p-3 flex items-center gap-3 bg-[#fdf8e1]`,children:[(0,M.jsx)(`div`,{className:`w-12 h-12 border-[3px] border-ink-black overflow-hidden bg-primary-fixed-dim shadow-[2px_2px_0_0_#1E293B] shrink-0`,children:(0,M.jsx)(`img`,{alt:`Profile Avatar`,className:`w-full h-full object-cover`,src:`/icons/avatar.webp`})}),(0,M.jsxs)(`div`,{className:`overflow-hidden`,children:[(0,M.jsx)(`div`,{className:`font-headline-md text-sm font-bold text-ink-black truncate`,children:t}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1 text-red-700 mt-1 select-none font-bold`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-sm`,style:{fontVariationSettings:`'FILL' 1`},children:`local_fire_department`}),(0,M.jsxs)(`span`,{className:`font-arcade text-[7px]`,children:[n?.current_streak??0,` DAY STREAK`]})]})]})]})]}),(0,M.jsxs)(`div`,{className:`fixed bottom-16 right-5 pointer-events-none select-none text-right z-10 flex flex-col items-end leading-tight text-white/50 drop-shadow-[0_1px_2px_rgba(0,0,0,0.85)]`,children:[(0,M.jsx)(`span`,{className:`text-[13px] font-medium tracking-tight`,children:`AlgoSpaced (Beta)`}),(0,M.jsx)(`span`,{className:`text-[11px] font-normal text-white/40 mt-0.5`,children:`Build 1.0.24-preview`})]})]});async function Xe(){try{let{data:{session:e}}=await O.auth.getSession();return e?e.access_token:`sandbox`}catch{return`sandbox`}}async function Ze(e){let t=await Xe(),n=await fetch(`/api/reviews/activate`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t}`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({detail:`Failed to activate problem`}));throw Error(e.detail||`Failed to activate problem`)}return n.json()}async function Qe(e){return Ze({problem_number:e.problem_number,name:e.name,pattern:e.pattern,difficulty:e.difficulty,time_complexity:e.time_complexity,space_complexity:e.space_complexity,description:e.description,starter_code:e.starter_code,reference_solution:e.reference_solution,examples:e.examples,constraints:e.constraints,leetcode_url:e.leetcode_url})}async function $e(e,t,n){let r=await Xe(),i=typeof n==`number`?{problem_number:n}:n||{},a=await fetch(`/api/reviews/save-reference`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${r}`},body:JSON.stringify({problem_id:e||void 0,code:t,...i})});if(!a.ok){let e=await a.json().catch(()=>({detail:`Failed to save reference solution`}));throw Error(e.detail||`Failed to save reference solution`)}return a.json()}async function et(e,t,n,r,i){let a=await Xe(),o=t.find(e=>e.is_optimal)||t[0],s={name:i?.name||`Problem`,pattern:o?.pattern||i?.pattern||`General`,difficulty:i?.difficulty||`Medium`,reference_code:o?.code||i?.reference_code||``,description:i?.description||``,problem_number:i?.problem_number??null,optimal_time:n||o?.time_complexity||i?.optimal_time||`O(N)`,optimal_space:r||o?.space_complexity||i?.optimal_space||`O(1)`,examples:i?.examples,constraints:i?.constraints,how_to_solve:i?.how_to_solve||``,solutions:t},c=await fetch(`/api/explorer/problems/${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${a}`},body:JSON.stringify(s)});if(!c.ok){let e=await c.json().catch(()=>({detail:`Failed to update problem solutions`}));throw Error(e.detail||`Failed to update problem solutions`)}return c.json()}async function tt(e){let t=await Xe(),n=await fetch(`/api/reviews/ai-solution`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t}`},body:JSON.stringify({problem_id:e.problemId,problem_number:e.problemNumber,problem_name:e.problemName,pattern:e.pattern})});if(!n.ok){let e=await n.json().catch(()=>({detail:`Failed to fetch solution`}));throw Error(e.detail||`Failed to fetch solution`)}return n.json()}async function nt(e,t,n=4,r,i){let a=await Xe(),o=await fetch(`/api/reviews/test-run`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${a}`},body:JSON.stringify({code:e,test_cases:t,timeout:n,starter_code:r,problem_name:i})});return o.ok?o.json():{success:!1,error:(await o.json().catch(()=>({detail:`Execution service error`}))).detail||`Execution service error`}}async function rt(e){let t=await Xe(),n={problems:e.map(e=>({problem_number:e.problem_number,name:e.name,pattern:e.pattern,difficulty:e.difficulty,time_complexity:e.time_complexity,space_complexity:e.space_complexity,description:e.description,starter_code:e.starter_code,reference_solution:e.reference_solution,examples:e.examples,constraints:e.constraints,leetcode_url:e.leetcode_url}))},r=await fetch(`/api/reviews/activate-batch`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t}`},body:JSON.stringify(n)});if(!r.ok){let e=await r.json().catch(()=>({detail:`Failed to batch activate problems`}));throw Error(e.detail||`Failed to batch activate problems`)}return r.json()}var it=[{id:`nc-217`,problem_number:217,name:`Contains Duplicate`,pattern:`Arrays & Hashing`,difficulty:`Easy`,time_complexity:`O(N)`,space_complexity:`O(N)`,starter_code:`class Solution: +`);for(let e of i)e.startsWith(`event:`)?n=e.replace(`event:`,``).trim():e.startsWith(`data:`)&&(r=e.replace(`data:`,``).trim());if(n===`text_delta`&&r)try{let e=JSON.parse(r);e.delta&&t.onDelta(e.delta)}catch(e){console.warn(`[CompanionAPI] Failed to parse delta:`,e)}else if(n===`done`&&r)try{let e=JSON.parse(r);f=!0,t.onDone({text:e.text||``,emotion:e.emotion||`smiling_warmly`,tool_calls:Array.isArray(e.tool_calls)?e.tool_calls:[],choice_suggestions:Array.isArray(e.choice_suggestions)?e.choice_suggestions:[],provider_used:e.provider_used||`Spire Agent Stream`})}catch(e){console.warn(`[CompanionAPI] Failed to parse done payload:`,e)}else if(n===`error`&&r){f=!0;try{let e=JSON.parse(r);t.onDone({text:e.text||`Stay strong, champion!`,emotion:e.emotion||`smiling_warmly`,tool_calls:[],choice_suggestions:e.choice_suggestions||[],provider_used:`fallback`})}catch(e){console.warn(`[CompanionAPI] Error event parse failed:`,e)}}}}if(!f){let n=await te(e);t.onDone(n)}}catch(n){console.warn(`[CompanionAPI] Stream error, falling back to standard API:`,n);try{let n=await te(e);t.onDone(n)}catch(e){t.onError?.(e)}}}async function re(e){try{let{data:{session:t}}=await O.auth.getSession(),n=t?.access_token||`sandbox`;await fetch(`/api/companion/telemetry`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${n}`},body:JSON.stringify({...e,source:`client`,timestamp:e.timestamp||Date.now()/1e3})})}catch{}}var ie={open_app_window:e=>{let t=String(e.window_id||e.windowId||`queue`).toLowerCase(),n=t;return[`reviewer`,`code_reviewer`,`ai`,`grimoire`].includes(t)?n=`queue`:[`map`,`path`,`trail`].includes(t)?n=`journey`:[`files`,`explorer`,`system`].includes(t)&&(n=`computer`),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`companion:open_window`,{detail:{windowId:n}})),{toolName:`open_app_window`,success:!0,message:`Summoned window: ${n}`,data:{windowId:n}}},set_study_timer:e=>{let t=Math.max(1,Math.min(120,Number(e.minutes||10)));return typeof window<`u`&&window.dispatchEvent(new CustomEvent(`companion:start_timer`,{detail:{minutes:t}})),{toolName:`set_study_timer`,success:!0,message:`Set tower countdown hourglass for ${t} minutes.`,data:{minutes:t}}},play_ambient_sound:e=>{let t=String(e.soundscape||`campfire`).toLowerCase();return typeof window<`u`&&window.dispatchEvent(new CustomEvent(`companion:play_soundscape`,{detail:{soundscape:t}})),{toolName:`play_ambient_sound`,success:!0,message:`Kindled ambient soundscape: ${t}.`,data:{soundscape:t}}},bookmark_for_spaced_review:e=>{let t=String(e.problem_name||e.problemName||`Unspecified Problem`),n=String(e.reason||`Flagged by Princess Aurelia for reinforcement`);return typeof window<`u`&&window.dispatchEvent(new CustomEvent(`companion:bookmark_problem`,{detail:{problemName:t,reason:n}})),{toolName:`bookmark_for_spaced_review`,success:!0,message:`Marked "${t}" in the royal grimoire for priority review.`,data:{problemName:t,reason:n}}},write_spire_diary:e=>{let t=String(e.entry||e.text||``).trim();return t?(typeof window<`u`&&window.dispatchEvent(new CustomEvent(`companion:write_diary`,{detail:{text:t}})),{toolName:`write_spire_diary`,success:!0,message:`Recorded observation into the Spire Chronicles.`,data:{text:t}}):{toolName:`write_spire_diary`,success:!1,message:`Empty diary entry provided.`}},update_hero_codex:e=>{let t=String(e.key||``).trim(),n=String(e.value||``).trim();return!t||!n?{toolName:`update_hero_codex`,success:!1,message:`Missing key or value for hero codex update.`}:(typeof window<`u`&&window.dispatchEvent(new CustomEvent(`companion:update_codex`,{detail:{key:t,value:n}})),{toolName:`update_hero_codex`,success:!0,message:`Updated Hero Codex: ${t} -> ${n}`,data:{key:t,value:n}})},record_episodic_event:e=>{let t=String(e.eventType||e.event_type||`session_summary`),n=String(e.title||`Event`).trim(),r=String(e.description||``).trim(),i=e.relatedPattern||e.related_pattern?String(e.relatedPattern||e.related_pattern):void 0;return typeof window<`u`&&window.dispatchEvent(new CustomEvent(`companion:record_event`,{detail:{eventType:t,title:n,description:r,relatedPattern:i}})),{toolName:`record_episodic_event`,success:!0,message:`Recorded episodic memory: ${n}`,data:{eventType:t,title:n,description:r,relatedPattern:i}}}};async function ae(e){let t=ie[e.name],n=typeof performance<`u`?performance.now():Date.now();if(!t){console.warn(`[AgentTools] No handler registered for tool: ${e.name}`);let t={toolName:e.name,success:!1,message:`Unknown enchantment: ${e.name}`,durationMs:0};return re({tool_name:e.name,args:e.args,success:!1,error:t.message,execution_time_ms:0}),t}try{let r=await t(e.args||{}),i=typeof performance<`u`?performance.now():Date.now(),a=Math.round(i-n),o={...r,durationMs:a};return re({tool_name:e.name,args:e.args,success:o.success,error:o.success?void 0:o.message,execution_time_ms:a}),o}catch(t){console.error(`[AgentTools] Error executing ${e.name}:`,t);let r=typeof performance<`u`?performance.now():Date.now(),i=Math.round(r-n),a={toolName:e.name,success:!1,message:t?.message||`Tool execution encountered an error.`,durationMs:i};return re({tool_name:e.name,args:e.args,success:!1,error:a.message,execution_time_ms:i}),a}}var oe={dawn:{state:`dawn`,label:`Morning Sunbreak`,hourRange:[6,12],activity:`Sipping warm mountain tea and watching the sunrise over the valley`,lightingClass:`from-amber-100/90 via-yellow-50/80 to-amber-200/50`,defaultEmotion:`smiling_warmly`,greetings:[`Morning! The sunrise looks pretty incredible from up here today. How are you feeling—ready to solve a few problems, or still waiting for your coffee to kick in?`,`Hey, good morning! Did you get some good rest? Don’t rush into the hardest problems right away—let’s ease in with a warmup.`,`Good morning! It’s really quiet and peaceful right now. Honestly the best time to get some focused thinking done before the rest of the world wakes up.`]},day:{state:`day`,label:`High Sun`,hourRange:[12,18],activity:`Reviewing architectural scrolls in the tower library`,lightingClass:`from-sky-100/80 via-amber-50/70 to-yellow-100/60`,defaultEmotion:`neutral`,greetings:[`Hey, welcome back! How’s your focus holding up today? Remember to step back and take a breath if your eyes start feeling tired.`,`Hey there! I was just organizing some notes in the tower library. What problem pattern are we working through right now?`,`Good to see you! Remember, steady consistency beats frantic cramming every single time. One clean solution at a time.`]},dusk:{state:`dusk`,label:`Twilight & Beacon Fire`,hourRange:[18,22],activity:`Lighting lanterns along the stone balcony as the sun sets`,lightingClass:`from-orange-100/90 via-purple-100/60 to-amber-200/70`,defaultEmotion:`smiling_warmly`,greetings:[`Evening! You’ve put in solid effort today. How are you feeling—ready to wrap things up, or finishing one last review?`,`Hey, the sun is setting over the valley. It’s so easy to lose track of time when deep in code. Make sure you stretch your neck and shoulders a bit.`,`Good evening! How did today’s practice go? Even getting through one tricky problem is real, meaningful progress.`]},night:{state:`night`,label:`Midnight Candlelight`,hourRange:[22,6],activity:`Listening to the quiet wind outside by soft candlelight`,lightingClass:`from-indigo-950/80 via-slate-900/90 to-amber-950/40 text-amber-100`,defaultEmotion:`concerned`,greetings:[`Hey... it’s getting really late. Are you okay? Late-night debugging usually just turns simple typos into monsters—promise me you’ll head to sleep soon.`,`Midnight already? I’m always glad to talk with you, but coding while exhausted will just burn you out. Take it easy tonight, okay?`,`Still awake? Don’t push yourself past your limit. Your brain actually reorganizes problem solutions while you sleep—go rest up for tomorrow.`]}};function se(e=new Date){let t=e.getHours();return t>=6&&t<12?`dawn`:t>=12&&t<18?`day`:t>=18&&t<22?`dusk`:`night`}function ce(e=new Date){return oe[se(e)]}function le(e=`Champion`){let t=ce(),n=t.greetings;return{text:(n[Math.floor(Math.random()*n.length)]||n[0]).replace(/\{hero\}/g,e||`Champion`),emotion:t.defaultEmotion,rhythm:t.state}}function ue(e,t=`Champion`){return{text:`Hey, ${t}... ${e} misses in a row is almost always mental fatigue, not a lack of ability. Step away from the screen for just five minutes, grab a drink of water, and let your head clear. You’ll see the solution much faster once you reset.`,emotion:`concerned`}}var de=`algospaced_companion_state_v2`,fe={enabled:!0,name:`Princess Aurelia`,backstory:`Princess Aurelia is a noble, intelligent, and deeply caring scholar-princess trapped inside the Spire of Big-O Complexity. You are her champion traveling the 150 leagues of the royal road to break her magical seals.`,breakIntervalMinutes:25,soundEnabled:!0,autoPopupEnabled:!0},pe={heroName:`Champion`,targetGoal:``,preferredLanguage:`Python`,strengths:[],nemesisPatterns:[],personalNotes:[],lastUpdated:Date.now()};function me(e,t,n){let r={...e,lastUpdated:Date.now()},i=n.trim();if(!i)return e;switch(t){case`heroName`:r.heroName=i;break;case`targetGoal`:r.targetGoal=i;break;case`preferredLanguage`:r.preferredLanguage=i;break;case`strengths`:r.strengths.includes(i)||(r.strengths=[...r.strengths,i].slice(-10));break;case`nemesisPatterns`:r.nemesisPatterns.includes(i)||(r.nemesisPatterns=[...r.nemesisPatterns,i].slice(-10));break;case`personalNotes`:{let e=r.personalNotes.findIndex(e=>e.toLowerCase().includes(i.toLowerCase().slice(0,15)));e>=0?r.personalNotes[e]=i:r.personalNotes=[...r.personalNotes,i].slice(-15);break}default:r.personalNotes.includes(i)||(r.personalNotes=[...r.personalNotes,i].slice(-15))}return r}function he(e,t,n,r=3){if(!e||e.length===0)return[];let i=(t+` `+(n||``)).toLowerCase(),a=e.map((e,t)=>{let r=0,a=(e.title+` `+e.description+` `+(e.relatedPattern||``)).toLowerCase();n&&e.relatedPattern&&e.relatedPattern.toLowerCase()===n.toLowerCase()&&(r+=5);let o=i.split(/\s+/).filter(e=>e.length>3);for(let e of o)a.includes(e)&&(r+=2);let s=(Date.now()-e.timestamp)/864e5;return r+=Math.max(0,3-s*.3),e.eventType===`breakthrough`&&(r+=2),e.eventType===`fatigue_episode`&&(r+=2),{event:e,index:t,score:r}});a.sort((e,t)=>t.score-e.score);let o=a.slice(0,2),s=new Set,c=[];for(let t of o)if(!(t.score<=.5)&&(s.has(t.event.id)||(s.add(t.event.id),c.push(`[${t.event.eventType.toUpperCase()}] ${t.event.title}: ${t.event.description}`)),t.event.contiguousEventId)){let n=e.find(e=>e.id===t.event.contiguousEventId);n&&!s.has(n.id)&&c.length=50?`Soulbound Confidante`:e>=10?`Trusted Ally`:`Acquaintance`}function _e(){let e=ce(),t={id:`turn-init`,sender:`princess`,text:`Hey! I’m Aurelia. It gets pretty quiet up here in the tower, so I’m really glad you stopped by. How are you holding up with your coding practice today?`,emotion:`smiling_warmly`,timestamp:Date.now(),provider:`Spire Relay`};try{let n=localStorage.getItem(de);if(n){let r=JSON.parse(n),i=Array.isArray(r.transcript)&&r.transcript.length>0?r.transcript:[t],a=i.filter(e=>e.sender===`user`).length;return{transcript:i,activeEmotion:r.activeEmotion||e.defaultEmotion,isTyping:!1,isLoading:!1,heroProfile:r.heroProfile||{heroName:`Champion`,targetGoal:``},heroCodex:r.heroCodex||{...pe,heroName:r.heroProfile?.heroName||`Champion`,targetGoal:r.heroProfile?.targetGoal||``},episodicEvents:Array.isArray(r.episodicEvents)?r.episodicEvents:[],journeyLog:Array.isArray(r.journeyLog)?r.journeyLog:[],currentFloor:Number(r.currentFloor||0),maxFloor:150,totalSolved:Number(r.totalSolved||r.currentFloor||0),unlockedMilestones:Array.isArray(r.unlockedMilestones)?r.unlockedMilestones:[0],unlockedLetters:Array.isArray(r.unlockedLetters)?r.unlockedLetters:[],spireChronicles:Array.isArray(r.spireChronicles)?r.spireChronicles:[],bondTier:ge(a),currentRhythm:e.state,currentActivity:e.activity,companionSettings:{...fe,...r.companionSettings||{}},consecutiveFailures:0,recentToolTelemetry:Array.isArray(r.recentToolTelemetry)?r.recentToolTelemetry:[]}}}catch(e){console.warn(`[CompanionStore] Failed to load from localStorage:`,e)}return{transcript:[t],activeEmotion:e.defaultEmotion,isTyping:!1,isLoading:!1,heroProfile:{heroName:`Champion`,targetGoal:``},heroCodex:pe,episodicEvents:[],journeyLog:[],currentFloor:0,maxFloor:150,totalSolved:0,unlockedMilestones:[0],unlockedLetters:[],spireChronicles:[],bondTier:`Acquaintance`,currentRhythm:e.state,currentActivity:e.activity,companionSettings:fe,consecutiveFailures:0,recentToolTelemetry:[]}}var q=_e(),ve=new Set;function ye(){try{let e={transcript:q.transcript.slice(-60),activeEmotion:q.activeEmotion,heroProfile:q.heroProfile,heroCodex:q.heroCodex,episodicEvents:q.episodicEvents.slice(-40),journeyLog:q.journeyLog.slice(-50),currentFloor:q.currentFloor,totalSolved:q.totalSolved,unlockedMilestones:q.unlockedMilestones,unlockedLetters:q.unlockedLetters,spireChronicles:q.spireChronicles.slice(-30),companionSettings:q.companionSettings,recentToolTelemetry:(q.recentToolTelemetry||[]).slice(-30)};localStorage.setItem(de,JSON.stringify(e))}catch(e){console.error(`[CompanionStore] Save error:`,e)}ve.forEach(e=>e())}function J(e){q={...q,...e},ye()}var Y={getState:()=>q,subscribe:e=>(ve.add(e),()=>ve.delete(e)),setEmotion:e=>{J({activeEmotion:e})},setIsTyping:e=>{q.isTyping!==e&&J({isTyping:e})},updateProfile:e=>{J({heroProfile:{...q.heroProfile,...e}})},updateCodex:(e,t)=>{let n=me(q.heroCodex,e,t);J({heroCodex:n,heroProfile:{...q.heroProfile,heroName:n.heroName,targetGoal:n.targetGoal,preferredLanguage:n.preferredLanguage}})},removeCodexItem:(e,t)=>{let n=(q.heroCodex[e]||[]).filter(e=>e!==t);J({heroCodex:{...q.heroCodex,[e]:n,lastUpdated:Date.now()}})},recordEpisodicEvent:e=>{let t=q.episodicEvents[0];J({episodicEvents:[{id:`ev-${Date.now()}`,timestamp:Date.now(),...e,contiguousEventId:e.contiguousEventId||t?.id},...q.episodicEvents].slice(0,40)})},updateSettings:e=>{J({companionSettings:{...q.companionSettings,...e}})},executeTool:async e=>{let t=await ae(e);return e.name===`write_spire_diary`&&t.success&&t.data?.text?Y.addDiaryEntry(t.data.text):e.name===`update_hero_codex`&&t.success&&t.data?.key&&t.data?.value?Y.updateCodex(t.data.key,t.data.value):e.name===`record_episodic_event`&&t.success&&t.data&&Y.recordEpisodicEvent({eventType:t.data.eventType||`session_summary`,title:t.data.title||`Event`,description:t.data.description||``,relatedPattern:t.data.relatedPattern,emotionalTone:q.activeEmotion}),J({recentToolTelemetry:[{tool_name:e.name,args:e.args,success:t.success,execution_time_ms:t.durationMs||0,hero_name:q.heroCodex.heroName||`Champion`,source:`client`,error:t.success?void 0:t.message,timestamp:Date.now()/1e3},...q.recentToolTelemetry||[]].slice(0,30)}),t},addDiaryEntry:e=>{J({spireChronicles:[{id:`diary-${Date.now()}`,timestamp:Date.now(),floor:q.currentFloor,text:e},...q.spireChronicles]})},sendMessage:async e=>{let t=e.trim();if(!t||q.isLoading)return;let n={id:`user-${Date.now()}`,sender:`user`,text:t,timestamp:Date.now()},r=[...q.transcript,n],i=r.filter(e=>e.sender===`user`).length,a=ge(i),o=`princess-${Date.now()}`,s={id:o,sender:`princess`,text:``,emotion:`thinking_expression`,timestamp:Date.now(),isStreaming:!0,provider:`Spire Agent Stream`};J({transcript:[...r,s],isLoading:!0,isTyping:!0,activeEmotion:`thinking_expression`,bondTier:a});try{let e=ce(),n=he(q.episodicEvents,t),i=``;await ne({princess_name:q.companionSettings.name,user_message:t,current_floor:q.currentFloor,streak_days:0,hero_name:q.heroCodex.heroName||q.heroProfile.heroName||`Champion`,target_goal:q.heroCodex.targetGoal||q.heroProfile.targetGoal,bond_tier:a,current_rhythm:e.state,hero_codex:q.heroCodex,episodic_memories:n,messages:r.slice(-10)},{onDelta:e=>{i+=e,J({transcript:q.transcript.map(e=>e.id===o?{...e,text:i,isStreaming:!0}:e),isLoading:!1,isTyping:!0})},onDone:e=>{if(Array.isArray(e.tool_calls))for(let t of e.tool_calls)Y.executeTool(t);let t=e.text||i||`I believe in you, champion!`;J({transcript:q.transcript.map(n=>n.id===o?{...n,text:t,emotion:e.emotion,toolCalls:e.tool_calls,choiceSuggestions:e.choice_suggestions,provider:e.provider_used||`Spire Agent Stream`,isStreaming:!1}:n),activeEmotion:e.emotion,isLoading:!1,isTyping:!1})},onError:e=>{console.warn(`[CompanionStore] Stream failed, using fallback:`,e);let t=K.idle_chat,n=t[Math.floor(Math.random()*t.length)];J({transcript:q.transcript.map(e=>e.id===o?{...e,text:n.text,emotion:n.emotion,provider:`Offline Script`,isStreaming:!1}:e),activeEmotion:n.emotion,isLoading:!1,isTyping:!1})}})}catch(e){console.error(`[CompanionStore] Send message error:`,e);let t=K.idle_chat,n=t[Math.floor(Math.random()*t.length)],r={id:o,sender:`princess`,text:n.text,emotion:n.emotion,timestamp:Date.now(),provider:`Offline Script`,isStreaming:!1};J({transcript:q.transcript.map(e=>e.id===o?r:e),activeEmotion:n.emotion,isLoading:!1,isTyping:!1})}},addReviewEvent:async(e,t=`a problem`,n=``)=>{let r=e===`Correct`,i=q.currentFloor,a=q.totalSolved,o=[...q.unlockedMilestones],s=[...q.unlockedLetters],c=q.consecutiveFailures,l=r?0:c+1,u=!1,d=0;if(r&&q.currentFloor=e&&!o.includes(e)){o.push(e),u=!0,d=e;let t=G[e];t&&!s.some(t=>t.floor===e)&&s.push({...t,unlockedAt:Date.now()})}}let f={id:`ep-${Date.now()}`,timestamp:Date.now(),type:r?`victory`:`struggle`,summary:`${r?`Mastered`:`Faced`} ${t} (${n||`DSA`}) - Graded ${e}`,floor:i};if(J({currentFloor:i,totalSolved:a,unlockedMilestones:o,unlockedLetters:s,consecutiveFailures:l,journeyLog:[f,...q.journeyLog]}),u&&Y.recordEpisodicEvent({eventType:`milestone`,title:`Passed League ${d}`,description:`Advanced past League ${d} on the road to the Spire of Big-O! Unlocked a royal missive from Aurelia.`,relatedPattern:n,emotionalTone:`excited_expression`}),r&&c>=2){let e=q.episodicEvents.find(e=>e.eventType===`fatigue_episode`||n&&e.relatedPattern?.toLowerCase()===n.toLowerCase());Y.recordEpisodicEvent({eventType:`breakthrough`,title:`Breakthrough: ${t}`,description:`Broke through previous hurdles to solve ${t}${n?` (${n})`:``} flawlessly!`,relatedPattern:n,emotionalTone:`excited_expression`,contiguousEventId:e?.id})}if(l>=3){Y.recordEpisodicEvent({eventType:`fatigue_episode`,title:`Fatigue: ${n||t}`,description:`Encountered 3 consecutive review struggles, most recently on ${t}${n?` (${n})`:``}. Aurelia intervened with rest advice.`,relatedPattern:n,emotionalTone:`concerned`});let e=ue(l,q.heroProfile.heroName),r={id:`fatigue-${Date.now()}`,sender:`princess`,text:e.text,emotion:e.emotion,timestamp:Date.now(),provider:`Fatigue Watchdog`};J({transcript:[...q.transcript,r],activeEmotion:e.emotion});return}let p=ce(),m=K[r?`problem_correct`:`problem_incorrect`],h=m[Math.floor(Math.random()*m.length)],g={id:`rev-${Date.now()}`,sender:`princess`,text:h.text,emotion:h.emotion,timestamp:Date.now(),provider:`Journey Log`};J({transcript:[...q.transcript,g],activeEmotion:h.emotion,currentRhythm:p.state,currentActivity:p.activity})},triggerProactiveGreeting:()=>{let e=ce();J({currentRhythm:e.state,currentActivity:e.activity});let t=q.transcript[q.transcript.length-1],n=Date.now();if(t&&n-t.timestamp<18e5)return;let r=le(q.heroProfile.heroName||`Champion`),i={id:`proactive-${n}`,sender:`princess`,text:r.text,emotion:r.emotion,timestamp:n,provider:`Tower Rhythm`};J({transcript:[...q.transcript,i],activeEmotion:r.emotion})},clearTranscript:()=>{J({transcript:[{id:`init-${Date.now()}`,sender:`princess`,text:`The slate is refreshed, champion! How may I accompany your algorithmic journey right now?`,emotion:`smiling_warmly`,timestamp:Date.now(),provider:`Spire Relay`}],activeEmotion:`smiling_warmly`})},syncWithBackend:async()=>{try{let{data:{session:e}}=await O.auth.getSession(),t={Authorization:`Bearer ${e?e.access_token:`sandbox`}`},n=await fetch(`/api/journey-progress`,{headers:t});if(n.ok){let e=await n.json(),t=Array.isArray(e)?e.length:0,r=Math.min(150,t),i=[30,60,90,120,150],a=[0],o=[...q.unlockedLetters];i.forEach(e=>{if(r>=e){a.push(e);let t=G[e];t&&!o.some(t=>t.floor===e)&&o.push({...t,unlockedAt:Date.now()})}}),J({currentFloor:r,totalSolved:t,unlockedMilestones:a,unlockedLetters:o})}}catch(e){console.warn(`[CompanionStore] Sync with backend journey failed:`,e)}}};function be(){return(0,A.useSyncExternalStore)(Y.subscribe,Y.getState,Y.getState)}var xe={queue:{isOpen:!0,isMinimized:!1},journey:{isOpen:!1,isMinimized:!1},terminal:{isOpen:!1,isMinimized:!1},computer:{isOpen:!1,isMinimized:!1},sync:{isOpen:!1,isMinimized:!1},github:{isOpen:!1,isMinimized:!1},python:{isOpen:!1,isMinimized:!1},mysql:{isOpen:!1,isMinimized:!1},settings:{isOpen:!1,isMinimized:!1},createProblem:{isOpen:!1,isMinimized:!1},editProblem:{isOpen:!1,isMinimized:!1},companion:{isOpen:!1,isMinimized:!1}},X=i()(k((e,t)=>({windows:xe,activeWindow:`queue`,windowZIndexes:{queue:40},maxZIndex:40,windowPositions:{},windowSizes:{},maximizedWindows:{},overrideProblemId:null,editingProblem:null,refreshExplorerTrigger:0,openWindow:n=>{let r=n,i=t().maxZIndex+1;e(e=>({windows:{...e.windows,[r]:{isOpen:!0,isMinimized:!1}},activeWindow:n,maxZIndex:i,windowZIndexes:{...e.windowZIndexes,[n]:i}}))},closeWindow:t=>{let n=t;e(e=>{let r=e.windows[n]||{isOpen:!1,isMinimized:!1},i={...e.windows,[n]:{...r,isOpen:!1}},a=e.activeWindow;if(e.activeWindow===t){let t=Object.entries(i).filter(([,e])=>e.isOpen&&!e.isMinimized).sort((t,n)=>(e.windowZIndexes[n[0]]||0)-(e.windowZIndexes[t[0]]||0));a=t.length>0?t[0][0]:``}return{windows:i,activeWindow:a}})},minimizeWindow:t=>{let n=t;e(e=>{let r=e.windows[n]||{isOpen:!0,isMinimized:!1},i={...e.windows,[n]:{...r,isMinimized:!0}},a=e.activeWindow;if(e.activeWindow===t){let n=Object.entries(i).filter(([e,n])=>n.isOpen&&!n.isMinimized&&e!==t).sort((t,n)=>(e.windowZIndexes[n[0]]||0)-(e.windowZIndexes[t[0]]||0));a=n.length>0?n[0][0]:``}return{windows:i,activeWindow:a}})},toggleWindowMinimize:e=>{let n=e,r=t(),i=r.windows[n]||{isOpen:!1,isMinimized:!1};i.isMinimized||!i.isOpen?t().openWindow(e):r.activeWindow===e?t().minimizeWindow(e):t().focusWindow(e)},focusWindow:n=>{let r=t();if(r.activeWindow===n)return;let i=r.maxZIndex+1;e({activeWindow:n,maxZIndex:i,windowZIndexes:{...r.windowZIndexes,[n]:i}})},setActiveWindow:e=>{t().focusWindow(e)},updateWindowPosition:(t,n,r)=>{e(e=>({windowPositions:{...e.windowPositions,[t]:{x:n,y:r}}}))},updateWindowSize:(t,n,r)=>{e(e=>({windowSizes:{...e.windowSizes,[t]:{width:n,height:r}}}))},toggleMaximize:t=>{e(e=>({maximizedWindows:{...e.maximizedWindows,[t]:!e.maximizedWindows[t]}}))},resetWindowBounds:t=>{e(e=>{let n={...e.windowPositions};delete n[t];let r={...e.windowSizes};delete r[t];let i={...e.maximizedWindows};return delete i[t],{windowPositions:n,windowSizes:r,maximizedWindows:i}})},setOverrideProblemId:t=>{e({overrideProblemId:t})},setEditingProblem:t=>{e({editingProblem:t})},openEditProblem:n=>{e({editingProblem:n}),t().openWindow(`editProblem`)},handleSelectProblemForReview:n=>{e({overrideProblemId:n}),t().openWindow(`queue`)},triggerRefreshExplorer:()=>{e(e=>({refreshExplorerTrigger:e.refreshExplorerTrigger+1}))},isAnyWindowOpen:()=>{let e=t();return Object.values(e.windows).some(e=>e.isOpen&&!e.isMinimized)}}),{name:`algospaced_os_state`,partialize:e=>({windows:e.windows,windowPositions:e.windowPositions,windowSizes:e.windowSizes,maximizedWindows:e.maximizedWindows}),merge:(e,t)=>{let n=e;return{...t,windows:{...t.windows,...n?.windows||{}},windowPositions:n?.windowPositions||t.windowPositions,windowSizes:n?.windowSizes||t.windowSizes,maximizedWindows:n?.maximizedWindows||t.maximizedWindows}}})),Se={neutral:{id:`neutral`,label:`Calm`,imagePath:`/sprites/princess/neutral.webp`},smiling_warmly:{id:`smiling_warmly`,label:`Smiling Warmly`,imagePath:`/sprites/princess/smiling_warmly.webp`},excited_expression:{id:`excited_expression`,label:`Excited`,imagePath:`/sprites/princess/excited_expression.webp`},thinking_expression:{id:`thinking_expression`,label:`Thinking`,imagePath:`/sprites/princess/thinking_expression.webp`},concerned:{id:`concerned`,label:`Concerned`,imagePath:`/sprites/princess/concerned.webp`},fear:{id:`fear`,label:`Startled`,imagePath:`/sprites/princess/fear.webp`},sad_expression:{id:`sad_expression`,label:`Melancholy`,imagePath:`/sprites/princess/sad_expression.webp`}},Z=null;function Ce(){if(typeof window>`u`)return null;if(!Z){let e=window,t=window.AudioContext||e.webkitAudioContext;t&&(Z=new t)}return Z&&Z.state===`suspended`&&Z.resume().catch(()=>{}),Z}function we(){try{return localStorage.getItem(`companion_sound_enabled`)===`false`}catch{return!1}}function Te(e){try{localStorage.setItem(`companion_sound_enabled`,e?`false`:`true`)}catch{}}function Ee(){if(we())return;let e=Ce();if(e)try{let t=[523.25,659.25,783.99,1046.5],n=e.currentTime;t.forEach((t,r)=>{let i=e.createOscillator(),a=e.createGain();i.type=`sine`,i.frequency.setValueAtTime(t,n+r*.06),a.gain.setValueAtTime(.06,n+r*.06),a.gain.exponentialRampToValueAtTime(.001,n+r*.06+.18),i.connect(a),a.connect(e.destination),i.start(n+r*.06),i.stop(n+r*.06+.2)})}catch{}}function De(){if(we())return;let e=Ce();if(e)try{let t=[440,554.37,659.25,880],n=e.currentTime;t.forEach((t,r)=>{let i=e.createOscillator(),a=e.createGain();i.type=`triangle`,i.frequency.setValueAtTime(t,n+r*.09),a.gain.setValueAtTime(.07,n+r*.09),a.gain.exponentialRampToValueAtTime(1e-4,n+r*.09+.35),i.connect(a),a.connect(e.destination),i.start(n+r*.09),i.stop(n+r*.09+.4)})}catch{}}function Oe({onOpenCompanionWindow:e}){let t=be(),n=X(e=>!!e.windows.companion?.isOpen&&!e.windows.companion?.isMinimized),[r,i]=(0,A.useState)(!1),[a,s]=(0,A.useState)(``),[c,l]=(0,A.useState)(!1),[u,d]=(0,A.useState)(we()),f=(0,A.useRef)(null),p=(0,A.useRef)(null),m=(0,A.useRef)(``);if((0,A.useEffect)(()=>{if(n){f.current&&clearInterval(f.current),p.current&&clearTimeout(p.current);let e=setTimeout(()=>{i(!1)},0);return()=>clearTimeout(e)}},[n]),(0,A.useEffect)(()=>{let e=t.transcript[t.transcript.length-1];if(e&&e.sender===`princess`&&t.companionSettings.enabled&&t.companionSettings.autoPopupEnabled){if(n){m.current=e.id;return}if(e.id!==m.current&&(e.id.startsWith(`rev-`)||e.id.startsWith(`fatigue-`))){m.current=e.id,i(!0),Ee(),s(``),l(!0);let t=0;f.current&&clearInterval(f.current),f.current=setInterval(()=>{t{i(!1)},8e3))},24)}}},[t.transcript,t.companionSettings.enabled,t.companionSettings.autoPopupEnabled,n]),!r||n)return null;let g=t.transcript[t.transcript.length-1],v=Se[t.activeEmotion]||Se.smiling_warmly,y=W(t.currentFloor);return(0,M.jsx)(`div`,{className:`fixed bottom-14 right-3 sm:right-6 z-[9990] max-w-[480px] w-[calc(100vw-24px)] transition-all animate-in fade-in slide-in-from-bottom-5 duration-300 select-none`,onClick:()=>{c&&g&&(f.current&&clearInterval(f.current),s(g.text),l(!1))},children:(0,M.jsxs)(`div`,{className:`relative bg-[#FFFDF0] border-[3px] border-ink-black rounded-lg shadow-[6px_6px_0px_0px_#1E293B] overflow-hidden flex flex-col font-sans`,children:[(0,M.jsxs)(`div`,{className:`bg-[#FFE24C] border-b-[3px] border-ink-black px-3 py-1.5 flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,M.jsxs)(`span`,{className:`text-xs font-bold font-headline-md text-ink-black tracking-wide truncate flex items-center gap-1`,children:[(0,M.jsx)(T,{className:`w-3.5 h-3.5 text-amber-600 shrink-0`}),t.companionSettings.name||`Princess Aurelia`]}),(0,M.jsxs)(`span`,{className:`bg-ink-black text-[#FFE24C] text-[9px] font-bold font-arcade px-1.5 py-0.5 rounded shrink-0`,children:[t.currentFloor,`/150 LC`]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation();let t=!u;d(t),Te(t)},className:`p-1 hover:bg-black/10 rounded text-ink-black cursor-pointer border-0 bg-transparent`,title:u?`Unmute Audio`:`Mute Audio`,children:u?(0,M.jsx)(C,{className:`w-3.5 h-3.5`}):(0,M.jsx)(h,{className:`w-3.5 h-3.5`})}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>i(!1),className:`p-1 hover:bg-rose-500 hover:text-white rounded text-ink-black cursor-pointer border-0 bg-transparent`,title:`Dismiss`,children:(0,M.jsx)(S,{className:`w-3.5 h-3.5`})})]})]}),(0,M.jsxs)(`div`,{className:`p-3 sm:p-4 flex gap-3 sm:gap-4 items-start`,children:[(0,M.jsx)(`div`,{className:`relative shrink-0 flex flex-col items-center`,children:(0,M.jsxs)(`div`,{className:`w-16 h-20 sm:w-20 sm:h-24 bg-gradient-to-b from-amber-100 to-amber-200 border-[2px] border-ink-black rounded overflow-hidden shadow-[2px_2px_0px_0px_#1E293B] relative group flex items-center justify-center`,children:[(0,M.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center text-amber-700/40 pointer-events-none select-none`,children:[(0,M.jsx)(T,{className:`w-6 h-6 animate-pulse`}),(0,M.jsx)(`span`,{className:`font-arcade text-[8px] mt-1`,children:`Aurelia`})]}),(0,M.jsx)(`img`,{src:v.imagePath,alt:v.label,loading:`eager`,className:`w-full h-full object-cover object-top relative z-10`,onError:e=>{let t=e.currentTarget;t.src.endsWith(`/sprites/princess/neutral.webp`)?t.style.display=`none`:t.src=`/sprites/princess/neutral.webp`}}),(0,M.jsx)(`div`,{className:`absolute bottom-0 inset-x-0 bg-ink-black/80 text-[8px] text-amber-200 text-center py-0.5 font-bold uppercase tracking-wider z-20`,children:v.label})]})}),(0,M.jsxs)(`div`,{className:`flex-1 flex flex-col justify-between min-h-[85px]`,children:[(0,M.jsxs)(`div`,{className:`relative bg-white border-[2px] border-ink-black rounded p-2.5 shadow-xs min-h-[60px]`,children:[(0,M.jsx)(`div`,{className:`absolute -left-[7px] top-4 w-3 h-3 bg-white border-l-[2px] border-b-[2px] border-ink-black rotate-45`}),(0,M.jsxs)(`p`,{className:`text-xs sm:text-[13px] text-ink-black font-medium leading-relaxed m-0 whitespace-pre-wrap`,children:[a,c&&(0,M.jsx)(`span`,{className:`inline-block w-1.5 h-3.5 bg-amber-500 ml-0.5 animate-pulse align-middle`})]})]}),(0,M.jsxs)(`div`,{className:`text-[10px] text-trash-gray font-medium mt-1.5 flex items-center justify-between`,children:[(0,M.jsxs)(`span`,{className:`truncate`,children:[`🗺️ `,y.title]}),c&&(0,M.jsx)(`span`,{className:`text-[9px] text-amber-700 font-bold animate-pulse shrink-0`,children:`Speaking...`})]})]})]}),(0,M.jsxs)(`div`,{className:`px-3 pb-3 pt-1 flex flex-wrap items-center justify-end gap-2 border-t border-amber-200/60 bg-amber-50/40`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>{e(),i(!1)},className:`flex items-center gap-1 px-2.5 py-1 bg-[#FFE24C] hover:bg-yellow-300 text-ink-black border-[2px] border-ink-black rounded text-[11px] font-bold shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer`,children:[(0,M.jsx)(o,{className:`w-3 h-3`}),(0,M.jsx)(`span`,{children:`Talk to Her`}),(0,M.jsx)(_,{className:`w-3 h-3`})]}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>i(!1),className:`px-2.5 py-1 bg-white hover:bg-slate-100 text-slate-700 border-[2px] border-slate-300 rounded text-[11px] font-bold active:translate-y-0.5 transition-all cursor-pointer`,children:`Dismiss`})]})]})})}var ke={neutral:{id:`neutral`,label:`Calm`,imagePath:`/sprites/princess/neutral.webp`},smiling_warmly:{id:`smiling_warmly`,label:`Smiling Warmly`,imagePath:`/sprites/princess/smiling_warmly.webp`},excited_expression:{id:`excited_expression`,label:`Excited`,imagePath:`/sprites/princess/excited_expression.webp`},thinking_expression:{id:`thinking_expression`,label:`Thinking`,imagePath:`/sprites/princess/thinking_expression.webp`},concerned:{id:`concerned`,label:`Concerned`,imagePath:`/sprites/princess/concerned.webp`},fear:{id:`fear`,label:`Startled`,imagePath:`/sprites/princess/fear.webp`},sad_expression:{id:`sad_expression`,label:`Melancholy`,imagePath:`/sprites/princess/sad_expression.webp`}},Ae={enabled:!0,name:`Princess Aurelia`,backstory:`Princess Aurelia is trapped in the high Spire of Big-O Complexity. You are a brave traveler journeying across the kingdom. By mastering all 150 LeetCode problems along the royal road, you will reach the tower gates and break her magical seal!`,breakIntervalMinutes:25,soundEnabled:!0,autoPopupEnabled:!0},je=[{floorRange:[1,30],title:`The Plains of Arrays & Strings`,description:`Rolling green meadows and ancient cobblestone roads where the journey begins.`,bgLore:`Looking out towards the distant horizon, the silhouette of the Spire pierces the clouds.`},{floorRange:[31,60],title:`The Whispering Forest of Pointers`,description:`Winding paths through dense groves where two pointers guide your compass.`,bgLore:`Aurelia’s magical beacon shines above the treetops, guiding your footsteps along the trail.`},{floorRange:[61,90],title:`The Grand Caverns of Trees & Graphs`,description:`Bioluminescent caves with branching crystal arches and subterranean passes.`,bgLore:`Halfway to the tower! Her voice echoes with hope over the enchanted royal relay.`},{floorRange:[91,120],title:`The High Mountain Passes of Heaps & Backtracking`,description:`Perilous alpine ridges and snowy peaks overlooking the Spire valley.`,bgLore:`From the highest ridge, the base of the Spire is in sight through the mountain mist!`},{floorRange:[121,149],title:`The Enchanted Valley of Dynamic Programming`,description:`Shimmering mystical grounds where optimal solutions bridge the final moat.`,bgLore:`The final leagues! The Spire looms directly ahead, its ancient runic wards trembling.`},{floorRange:[150,150],title:`The Gates of the Big-O Spire`,description:`Standing at the threshold of the grand tower gates to break the seal and free Aurelia!`,bgLore:`150 algorithms conquered! You have completed the grand journey and reached the Spire!`}],Me={break_reminder:[{id:`br-1`,text:`Brave traveler! You have traveled many leagues today. Even the swiftest steeds rest by the campfire—shall we pause for a stretch and some water?`,emotion:`concerned`,context:`break_reminder`},{id:`br-2`,text:`I can see your progress across the plains from my tower window! Please rest your eyes for a moment; a clear mind travels swiftest.`,emotion:`smiling_warmly`,context:`break_reminder`},{id:`br-3`,text:`The evening winds carry word of your relentless march. Take 5 minutes to rest—I will keep watch from the Spire beacon!`,emotion:`thinking_expression`,context:`break_reminder`},{id:`br-4`,text:`Do not exhaust yourself on the road, my hero! Pacing is the secret to enduring a 150-problem expedition. Let us take a short pause.`,emotion:`concerned`,context:`break_reminder`}],problem_correct:[{id:`pc-1`,text:`Magnificent! You conquered that obstacle and advanced another league closer to my tower!`,emotion:`excited_expression`,context:`problem_correct`},{id:`pc-2`,text:`A flawless solution! With every problem you master, the distance between us grows shorter.`,emotion:`smiling_warmly`,context:`problem_correct`},{id:`pc-3`,text:`Incredible speed and elegance! I felt the Spire beacon flare with light as you crossed another milestone!`,emotion:`excited_expression`,context:`problem_correct`},{id:`pc-4`,text:`You handled that algorithm with true mastery. Step by step, league by league, you are approaching the Spire gates!`,emotion:`smiling_warmly`,context:`problem_correct`}],problem_incorrect:[{id:`pi-1`,text:`Do not despair, noble traveler! The road to the Spire has rough terrain. Review the edge cases and let us push forward!`,emotion:`concerned`,context:`problem_incorrect`},{id:`pi-2`,text:`Every wrong turn on the map teaches you the true layout of the land. Let us examine the test case together.`,emotion:`thinking_expression`,context:`problem_incorrect`},{id:`pi-3`,text:`Stay steadfast! I believe in your courage and intellect. Take a breath—we will conquer this pass together!`,emotion:`smiling_warmly`,context:`problem_incorrect`},{id:`pi-4`,text:`A challenging problem! But overcoming difficult obstacles is what makes a legendary hero. Keep your head high!`,emotion:`neutral`,context:`problem_incorrect`}],streak_milestone:[{id:`sm-1`,text:`A glorious travel streak! Your daily dedication across the realms is inspiring. The Spire bells chime in your honor!`,emotion:`excited_expression`,context:`streak_milestone`},{id:`sm-2`,text:`Look at that continuous march! Consistency is the true magic that brings you across all 150 leagues to the tower.`,emotion:`smiling_warmly`,context:`streak_milestone`}],study_start:[{id:`ss-1`,text:`Welcome back to the trail, brave adventurer! Which algorithmic territories shall we cross today on our way to the Spire?`,emotion:`smiling_warmly`,context:`study_start`},{id:`ss-2`,text:`I saw the dust of your travel carriage on the horizon! Ready to conquer today’s review queue and draw closer to the tower?`,emotion:`excited_expression`,context:`study_start`}],idle_motivation:[{id:`im-1`,text:`Whenever the trail seems daunting, break the problem into smaller sub-problems. Every step counts toward the 150 milestone!`,emotion:`thinking_expression`,context:`idle_motivation`},{id:`im-2`,text:`I am watching over your journey and cheering you on! Your quest brings hope to this entire realm.`,emotion:`smiling_warmly`,context:`idle_motivation`},{id:`im-3`,text:`150 problems is a grand quest, but you have the intellect and heart to reach the Spire gates!`,emotion:`neutral`,context:`idle_motivation`}],tower_milestone:[{id:`tm-1`,text:`You have crossed the Plains of Arrays! 30 problems mastered—the first realm is behind us!`,emotion:`excited_expression`,context:`tower_milestone`,floorRequirement:30},{id:`tm-2`,text:`You emerged from the Whispering Forest! 60 problems solved—I can see your banner waving near the foothills!`,emotion:`excited_expression`,context:`tower_milestone`,floorRequirement:60},{id:`tm-3`,text:`Through the Grand Caverns! 90 problems conquered—more than halfway to the Spire!`,emotion:`smiling_warmly`,context:`tower_milestone`,floorRequirement:90},{id:`tm-4`,text:`You crested the High Mountain Passes! 120 problems conquered—the Spire valley is right before you!`,emotion:`excited_expression`,context:`tower_milestone`,floorRequirement:120},{id:`tm-5`,text:`YOU HAVE REACHED THE SPIRE GATES! All 150 LeetCode problems conquered! The grand seals shatter—freedom at last, my legendary champion!`,emotion:`excited_expression`,context:`tower_milestone`,floorRequirement:150}],chat_response:[]},Ne=`companion_settings`,Pe=`tower_progress`;function Fe(){try{let e=localStorage.getItem(Ne);return e?{...Ae,...JSON.parse(e)}:Ae}catch{return Ae}}function Ie(e){try{localStorage.setItem(Ne,JSON.stringify(e))}catch(e){console.error(`Failed to save companion settings:`,e)}}function Le(){try{let e=localStorage.getItem(Pe);return e?JSON.parse(e):{currentFloor:0,maxFloor:150,totalSolved:0,unlockedMilestones:[0]}}catch{return{currentFloor:0,maxFloor:150,totalSolved:0,unlockedMilestones:[0]}}}function Re(e){try{localStorage.setItem(Pe,JSON.stringify(e))}catch(e){console.error(`Failed to save tower progress:`,e)}}function ze(){let e={currentFloor:0,maxFloor:150,totalSolved:0,unlockedMilestones:[0]};return Re(e),e}async function Be(){try{let{data:{session:e}}=await O.auth.getSession(),t={Authorization:`Bearer ${e?e.access_token:`sandbox`}`},n=await fetch(`/api/journey-progress`,{headers:t});if(n.ok){let e=await n.json(),t=Array.isArray(e)?e.length:0,r=Math.min(150,t),i=[30,60,90,120,150],a=[0];i.forEach(e=>{r>=e&&a.push(e)});let o={currentFloor:r,maxFloor:150,totalSolved:t,unlockedMilestones:a};return Re(o),o}}catch(e){console.error(`Failed to sync companion progress with backend journey:`,e)}return Le()}function Ve(e){return je.find(t=>e>=t.floorRange[0]&&e<=t.floorRange[1])||je[0]}function He(e,t){let n=Me[e]||Me.idle_motivation;if(t&&e===`tower_milestone`){let e=n.find(e=>e.floorRequirement===t);if(e)return e}return n[Math.floor(Math.random()*n.length)]||n[0]}function Ue({event:e,onClose:t,onOpenCompanionWindow:n}){let r=X(e=>!!e.windows.companion?.isOpen&&!e.windows.companion?.isMinimized),[i,a]=(0,A.useState)(``),[s,c]=(0,A.useState)(!1),[l,u]=(0,A.useState)(we()),[d,f]=(0,A.useState)(Le()),p=Fe(),m=(0,A.useRef)(null),g=(0,A.useRef)(null);if((0,A.useEffect)(()=>{if(r&&e){let e=setTimeout(()=>{t()},0);return()=>clearTimeout(e)}},[r,e,t]),(0,A.useEffect)(()=>{f(Le())},[e]),(0,A.useEffect)(()=>{if(!e){a(``),c(!1);return}Ee();let n=e.text;a(``),c(!0);let r=0;return m.current&&clearInterval(m.current),m.current=setInterval(()=>{r0&&(g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{t()},e.autoCloseDelay)))},28),()=>{m.current&&clearInterval(m.current),g.current&&clearTimeout(g.current)}},[e]),!e||!p.enabled||r)return null;let y=ke[e.emotion]||ke.smiling_warmly,b=Ve(d.currentFloor),x=e=>{e.stopPropagation();let t=!l;u(t),Te(t)},w=()=>{s&&e&&(m.current&&clearInterval(m.current),a(e.text),c(!1))},E=e.context===`break_reminder`;return(0,M.jsx)(`div`,{className:`fixed bottom-14 right-3 sm:right-6 z-[9990] max-w-[480px] w-[calc(100vw-24px)] transition-all animate-in fade-in slide-in-from-bottom-5 duration-300 select-none`,onClick:w,children:(0,M.jsxs)(`div`,{className:`relative bg-[#FFFDF0] border-[3px] border-ink-black rounded-lg shadow-[6px_6px_0px_0px_#1E293B] overflow-hidden flex flex-col font-sans`,children:[(0,M.jsxs)(`div`,{className:`bg-[#FFE24C] border-b-[3px] border-ink-black px-3 py-1.5 flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,M.jsxs)(`span`,{className:`text-xs font-bold font-headline-md text-ink-black tracking-wide truncate flex items-center gap-1`,children:[(0,M.jsx)(T,{className:`w-3.5 h-3.5 text-amber-600 shrink-0`}),p.name||`Princess Aurelia`]}),(0,M.jsxs)(`span`,{className:`bg-ink-black text-[#FFE24C] text-[9px] font-bold font-arcade px-1.5 py-0.5 rounded shrink-0`,children:[d.currentFloor,`/150 LC`]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:x,className:`p-1 hover:bg-black/10 rounded text-ink-black cursor-pointer transition-colors border-0 bg-transparent`,title:l?`Unmute Audio`:`Mute Audio`,children:l?(0,M.jsx)(C,{className:`w-3.5 h-3.5`}):(0,M.jsx)(h,{className:`w-3.5 h-3.5`})}),(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`p-1 hover:bg-rose-500 hover:text-white rounded text-ink-black cursor-pointer transition-colors border-0 bg-transparent`,title:`Dismiss Dialogue`,children:(0,M.jsx)(S,{className:`w-3.5 h-3.5`})})]})]}),(0,M.jsxs)(`div`,{className:`p-3 sm:p-4 flex gap-3 sm:gap-4 items-start`,children:[(0,M.jsx)(`div`,{className:`relative shrink-0 flex flex-col items-center`,children:(0,M.jsxs)(`div`,{className:`w-16 h-20 sm:w-20 sm:h-24 bg-gradient-to-b from-amber-100 to-amber-200 border-[2px] border-ink-black rounded overflow-hidden shadow-[2px_2px_0px_0px_#1E293B] relative group flex items-center justify-center`,children:[(0,M.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center text-amber-700/40 pointer-events-none select-none`,children:[(0,M.jsx)(T,{className:`w-6 h-6 animate-pulse`}),(0,M.jsx)(`span`,{className:`font-arcade text-[8px] mt-1`,children:`Aurelia`})]}),(0,M.jsx)(`img`,{src:y.imagePath,alt:y.label,loading:`eager`,className:`w-full h-full object-cover object-top transition-transform duration-300 group-hover:scale-105 relative z-10`,onError:e=>{let t=e.currentTarget;t.src.endsWith(`/sprites/princess/neutral.webp`)?t.style.display=`none`:t.src=`/sprites/princess/neutral.webp`}}),(0,M.jsx)(`div`,{className:`absolute bottom-0 inset-x-0 bg-ink-black/80 text-[8px] text-amber-200 text-center py-0.5 font-bold uppercase tracking-wider backdrop-blur-xs z-20`,children:y.label})]})}),(0,M.jsxs)(`div`,{className:`flex-1 flex flex-col justify-between min-h-[90px]`,children:[(0,M.jsxs)(`div`,{className:`relative bg-white border-[2px] border-ink-black rounded p-2.5 shadow-[2px_2px_0px_0px_rgba(0,0,0,0.06)] min-h-[64px]`,children:[(0,M.jsx)(`div`,{className:`absolute -left-[7px] top-4 w-3 h-3 bg-white border-l-[2px] border-b-[2px] border-ink-black rotate-45`}),(0,M.jsxs)(`p`,{className:`text-xs sm:text-[13px] text-ink-black font-medium leading-relaxed m-0 whitespace-pre-wrap`,children:[i,s&&(0,M.jsx)(`span`,{className:`inline-block w-1.5 h-3.5 bg-amber-500 ml-0.5 animate-pulse align-middle`})]})]}),(0,M.jsxs)(`div`,{className:`text-[10px] text-trash-gray font-medium mt-1.5 flex items-center justify-between`,children:[(0,M.jsx)(`span`,{className:`truncate flex items-center gap-1`,children:(0,M.jsxs)(`span`,{children:[`🗺️ `,b.title]})}),s&&(0,M.jsx)(`span`,{className:`text-[9px] text-amber-700 font-bold animate-pulse shrink-0`,children:`Speaking...`})]})]})]}),(0,M.jsxs)(`div`,{className:`px-3 pb-3 pt-1 flex flex-wrap items-center justify-end gap-2 border-t border-amber-200/60 bg-amber-50/40`,children:[E&&(0,M.jsxs)(`button`,{type:`button`,onClick:()=>{t()},className:`flex items-center gap-1 px-2.5 py-1 bg-emerald-500 hover:bg-emerald-600 text-white border-[2px] border-ink-black rounded text-[11px] font-bold shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer`,children:[(0,M.jsx)(v,{className:`w-3 h-3`}),(0,M.jsx)(`span`,{children:`Take a Break`})]}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>{n(),t()},className:`flex items-center gap-1 px-2.5 py-1 bg-[#FFE24C] hover:bg-yellow-300 text-ink-black border-[2px] border-ink-black rounded text-[11px] font-bold shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer`,children:[(0,M.jsx)(o,{className:`w-3 h-3`}),(0,M.jsx)(`span`,{children:`Talk to Her`}),(0,M.jsx)(_,{className:`w-3 h-3`})]}),(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`px-2.5 py-1 bg-white hover:bg-slate-100 text-slate-700 border-[2px] border-slate-300 rounded text-[11px] font-bold active:translate-y-0.5 transition-all cursor-pointer`,children:`Dismiss`})]})]})})}function We(e){let t=X(e=>e.windows),n=X(e=>e.activeWindow),r=X(e=>e.overrideProblemId),i=X(e=>e.editingProblem),a=X(e=>e.refreshExplorerTrigger),o=(0,A.useCallback)(t=>{X.getState().openWindow(t),e&&e()},[e]),s=(0,A.useCallback)(e=>{X.getState().closeWindow(e)},[]),c=(0,A.useCallback)(e=>{X.getState().minimizeWindow(e)},[]),l=(0,A.useCallback)(e=>{X.getState().toggleWindowMinimize(e)},[]);return{windows:t,activeWindow:n,setActiveWindow:(0,A.useCallback)(e=>{X.getState().setActiveWindow(e)},[]),overrideProblemId:r,setOverrideProblemId:(0,A.useCallback)(e=>{X.getState().setOverrideProblemId(e)},[]),editingProblem:i,setEditingProblem:(0,A.useCallback)(e=>{X.getState().setEditingProblem(e)},[]),openEditProblem:(0,A.useCallback)(e=>{X.getState().openEditProblem(e)},[]),refreshExplorerTrigger:a,openWindow:o,closeWindow:s,minimizeWindow:c,toggleWindowMinimize:l,handleSelectProblemForReview:(0,A.useCallback)(e=>{X.getState().handleSelectProblemForReview(e)},[]),triggerRefreshExplorer:(0,A.useCallback)(()=>{X.getState().triggerRefreshExplorer()},[]),isAnyWindowOpen:(0,A.useMemo)(()=>Object.values(t).some(e=>e.isOpen&&!e.isMinimized),[t])}}function Ge(e,t){let[n,r]=(0,A.useState)(``),[i,a]=(0,A.useState)(null),[o,s]=(0,A.useState)(!1),[c,l]=(0,A.useState)(!1),[u,d]=(0,A.useState)(!1),[f,p]=(0,A.useState)(null);(0,A.useEffect)(()=>{let e=()=>{let e=new Date,t=e.getHours(),n=e.getMinutes(),i=t>=12?`PM`:`AM`;t%=12,t||=12;let a=n<10?`0`+n:String(n);r(`${t}:${a} ${i}`)};e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[]);let m=(0,A.useCallback)(async()=>{try{let{data:{session:e}}=await O.auth.getSession();if(!e)return;let t=await fetch(`/api/streak`,{headers:{Authorization:`Bearer ${e.access_token}`}});if(t.ok){let e=await t.json();a(e)}}catch(e){console.error(`Error fetching streak:`,e)}},[]);return(0,A.useEffect)(()=>{if(e){let e=setTimeout(()=>{m()},0);return Be(),()=>clearTimeout(e)}},[e,m]),(0,A.useEffect)(()=>{let e=()=>{s(window.innerWidth<768)};return e(),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},[]),(0,A.useEffect)(()=>{let e=()=>{l(!!document.fullscreenElement)};return document.addEventListener(`fullscreenchange`,e),()=>{document.removeEventListener(`fullscreenchange`,e)}},[]),(0,A.useEffect)(()=>{let e=e=>{e.ctrlKey&&e.preventDefault()},t=e=>{e.ctrlKey&&(e.key===`=`||e.key===`-`||e.key===`0`||e.key===`+`||e.code===`NumpadAdd`||e.code===`NumpadSubtract`)&&e.preventDefault()},n=e=>{e.touches.length>1&&e.preventDefault()};return document.addEventListener(`wheel`,e,{passive:!1}),document.addEventListener(`keydown`,t),document.addEventListener(`touchmove`,n,{passive:!1}),()=>{document.removeEventListener(`wheel`,e),document.removeEventListener(`keydown`,t),document.removeEventListener(`touchmove`,n)}},[]),{time:n,streak:i,fetchStreak:m,isMobile:o,isFullscreen:c,toggleFullscreen:(0,A.useCallback)(()=>{document.fullscreenElement?document.exitFullscreen().catch(e=>{console.error(`Error exiting fullscreen: ${e.message}`)}):document.documentElement.requestFullscreen().catch(e=>{console.error(`Error enabling fullscreen: ${e.message}`)})},[]),syncing:u,syncResult:f,triggerSync:(0,A.useCallback)(async()=>{t&&t(),d(!0),p(null);try{let{data:{session:e}}=await O.auth.getSession();if(!e)return;let t=await fetch(`/api/sync`,{method:`POST`,headers:{Authorization:`Bearer ${e.access_token}`}});if(t.ok){let e=await t.json();p(e.message||`Synchronization successfully completed!`),m(),Be()}else p(`Sync operation failed at server host.`)}catch{p(`Cloud synchronization server unreachable.`)}finally{d(!1)}},[t,m])}}var Ke=`/wallpapers/default.webp`;function qe(){let[e,t]=(0,A.useState)(()=>{let e=localStorage.getItem(`desktopWallpaperUrl`);return!e||e.includes(`lh3.googleusercontent.com`)?(localStorage.setItem(`desktopWallpaperUrl`,Ke),Ke):e}),n=(0,A.useCallback)(e=>{let n=new FileReader;n.onload=n=>{let r=new Image;r.onload=()=>{let i=document.createElement(`canvas`),a=r.width,o=r.height,s=1920,c=1080;(a>s||o>c)&&(a/o>s/c?(o=Math.round(o*s/a),a=s):(a=Math.round(a*c/o),o=c)),i.width=a,i.height=o;let l=i.getContext(`2d`);if(l){l.drawImage(r,0,0,a,o);try{let n=i.toDataURL(`image/jpeg`,.7);t(n),localStorage.setItem(`desktopWallpaperUrl`,n),localStorage.setItem(`customWallpaperUrl`,n),localStorage.setItem(`customWallpaperName`,e.name)}catch(e){console.error(`Failed to save compressed image to localStorage:`,e);let r=n.target?.result;t(r)}}else{let r=n.target?.result;t(r);try{localStorage.setItem(`desktopWallpaperUrl`,r),localStorage.setItem(`customWallpaperUrl`,r),localStorage.setItem(`customWallpaperName`,e.name)}catch(e){console.error(`Failed to save raw image to localStorage:`,e)}}},r.src=n.target?.result},n.readAsDataURL(e)},[]);return{wallpaperUrl:e,setWallpaperUrl:t,compressAndSaveWallpaper:n,handleWallpaperChange:(0,A.useCallback)((e,t)=>{t&&t();let r=e.target.files?.[0];r&&n(r)},[n])}}function Je(e,t){let[n,r]=(0,A.useState)(null);return(0,A.useEffect)(()=>{if(e){let e=Fe();if(e.enabled&&e.autoPopupEnabled){let e=setTimeout(()=>{let e=He(`study_start`);r({text:e.text,emotion:e.emotion,title:`✨ Welcome, Noble Hero!`,context:`study_start`,autoCloseDelay:7e3})},2500);return()=>clearTimeout(e)}}},[e]),(0,A.useEffect)(()=>{let e=e=>{let t=e;t.detail&&r(t.detail)},n=e=>{let n=e;n.detail?.windowId&&t(n.detail.windowId)};window.addEventListener(`companion:dialogue`,e),window.addEventListener(`companion:open_window`,n);let i=Date.now(),a=setInterval(()=>{let e=Fe();if(!(!e.enabled||!e.autoPopupEnabled||!e.breakIntervalMinutes||e.breakIntervalMinutes<=0)&&(Date.now()-i)/6e4>=e.breakIntervalMinutes){i=Date.now(),De();let e=He(`break_reminder`);r({text:e.text,emotion:e.emotion,title:`☕ Time for a Royal Pause`,context:`break_reminder`,autoCloseDelay:12e3})}},3e4);return()=>{window.removeEventListener(`companion:dialogue`,e),window.removeEventListener(`companion:open_window`,n),clearInterval(a)}},[t]),{companionDialogueEvent:n,setCompanionDialogueEvent:r}}var Ye=({isMobile:e,username:t,streak:n})=>e?null:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`absolute top-desktop-margin right-desktop-margin w-64 bg-paper-white border-[3px] border-ink-black gadget-shadow z-20 overflow-hidden flex flex-col shadow-[inset_2px_2px_0px_rgba(255,255,255,0.8)] select-none`,children:[(0,M.jsx)(`div`,{className:`bg-[#0ea5e9] border-b-[3px] border-ink-black px-3 py-1 flex justify-between items-center text-ink-black`,children:(0,M.jsx)(`span`,{className:`font-window-title text-xs font-bold tracking-wide`,children:`Profile.sys`})}),(0,M.jsxs)(`div`,{className:`p-3 flex items-center gap-3 bg-[#fdf8e1]`,children:[(0,M.jsx)(`div`,{className:`w-12 h-12 border-[3px] border-ink-black overflow-hidden bg-primary-fixed-dim shadow-[2px_2px_0_0_#1E293B] shrink-0`,children:(0,M.jsx)(`img`,{alt:`Profile Avatar`,className:`w-full h-full object-cover`,src:`/icons/avatar.webp`})}),(0,M.jsxs)(`div`,{className:`overflow-hidden`,children:[(0,M.jsx)(`div`,{className:`font-headline-md text-sm font-bold text-ink-black truncate`,children:t}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1 text-red-700 mt-1 select-none font-bold`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-sm`,style:{fontVariationSettings:`'FILL' 1`},children:`local_fire_department`}),(0,M.jsxs)(`span`,{className:`font-arcade text-[7px]`,children:[n?.current_streak??0,` DAY STREAK`]})]})]})]})]}),(0,M.jsxs)(`div`,{className:`fixed bottom-16 right-5 pointer-events-none select-none text-right z-10 flex flex-col items-end leading-tight text-white/50 drop-shadow-[0_1px_2px_rgba(0,0,0,0.85)]`,children:[(0,M.jsx)(`span`,{className:`text-[13px] font-medium tracking-tight`,children:`AlgoSpaced (Beta)`}),(0,M.jsx)(`span`,{className:`text-[11px] font-normal text-white/40 mt-0.5`,children:`Build 0.0.5-preview`})]})]});async function Xe(){try{let{data:{session:e}}=await O.auth.getSession();return e?e.access_token:`sandbox`}catch{return`sandbox`}}async function Ze(e){let t=await Xe(),n=await fetch(`/api/reviews/activate`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t}`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({detail:`Failed to activate problem`}));throw Error(e.detail||`Failed to activate problem`)}return n.json()}async function Qe(e){return Ze({problem_number:e.problem_number,name:e.name,pattern:e.pattern,difficulty:e.difficulty,time_complexity:e.time_complexity,space_complexity:e.space_complexity,description:e.description,starter_code:e.starter_code,reference_solution:e.reference_solution,examples:e.examples,constraints:e.constraints,leetcode_url:e.leetcode_url})}async function $e(e,t,n){let r=await Xe(),i=typeof n==`number`?{problem_number:n}:n||{},a=await fetch(`/api/reviews/save-reference`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${r}`},body:JSON.stringify({problem_id:e||void 0,code:t,...i})});if(!a.ok){let e=await a.json().catch(()=>({detail:`Failed to save reference solution`}));throw Error(e.detail||`Failed to save reference solution`)}return a.json()}async function et(e,t,n,r,i){let a=await Xe(),o=t.find(e=>e.is_optimal)||t[0],s={name:i?.name||`Problem`,pattern:o?.pattern||i?.pattern||`General`,difficulty:i?.difficulty||`Medium`,reference_code:o?.code||i?.reference_code||``,description:i?.description||``,problem_number:i?.problem_number??null,optimal_time:n||o?.time_complexity||i?.optimal_time||`O(N)`,optimal_space:r||o?.space_complexity||i?.optimal_space||`O(1)`,examples:i?.examples,constraints:i?.constraints,how_to_solve:i?.how_to_solve||``,solutions:t},c=await fetch(`/api/explorer/problems/${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${a}`},body:JSON.stringify(s)});if(!c.ok){let e=await c.json().catch(()=>({detail:`Failed to update problem solutions`}));throw Error(e.detail||`Failed to update problem solutions`)}return c.json()}async function tt(e){let t=await Xe(),n=await fetch(`/api/reviews/ai-solution`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t}`},body:JSON.stringify({problem_id:e.problemId,problem_number:e.problemNumber,problem_name:e.problemName,pattern:e.pattern})});if(!n.ok){let e=await n.json().catch(()=>({detail:`Failed to fetch solution`}));throw Error(e.detail||`Failed to fetch solution`)}return n.json()}async function nt(e,t,n=4,r,i){let a=await Xe(),o=await fetch(`/api/reviews/test-run`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${a}`},body:JSON.stringify({code:e,test_cases:t,timeout:n,starter_code:r,problem_name:i})});return o.ok?o.json():{success:!1,error:(await o.json().catch(()=>({detail:`Execution service error`}))).detail||`Execution service error`}}async function rt(e){let t=await Xe(),n={problems:e.map(e=>({problem_number:e.problem_number,name:e.name,pattern:e.pattern,difficulty:e.difficulty,time_complexity:e.time_complexity,space_complexity:e.space_complexity,description:e.description,starter_code:e.starter_code,reference_solution:e.reference_solution,examples:e.examples,constraints:e.constraints,leetcode_url:e.leetcode_url}))},r=await fetch(`/api/reviews/activate-batch`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t}`},body:JSON.stringify(n)});if(!r.ok){let e=await r.json().catch(()=>({detail:`Failed to batch activate problems`}));throw Error(e.detail||`Failed to batch activate problems`)}return r.json()}var it=[{id:`nc-217`,problem_number:217,name:`Contains Duplicate`,pattern:`Arrays & Hashing`,difficulty:`Easy`,time_complexity:`O(N)`,space_complexity:`O(N)`,starter_code:`class Solution: def containsDuplicate(self, nums: list[int]) -> bool: pass`,description:`Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.`,examples:[{input:`nums = [1,2,3,1]`,output:`true`},{input:`nums = [1,2,3,4]`,output:`false`}],constraints:[`1 <= nums.length <= 10^5`,`-10^9 <= nums[i] <= 10^9`],leetcode_url:`https://leetcode.com/problems/contains-duplicate/`,reference_solution:`class Solution: def containsDuplicate(self, nums: list[int]) -> bool: @@ -2349,4 +2349,4 @@ class DetectSquares: sign = -1 if x < 0 else 1 x = abs(x) res = int(str(x)[::-1]) * sign - return res if -2**31 <= res <= 2**31 - 1 else 0`}],at=new Map,ot=new Map,st=new Map;for(let e of it){at.set(e.problem_number,e),ot.set(e.id,e);let t=st.get(e.pattern)||[];t.push(e),st.set(e.pattern,t)}function ct(e){if(e==null)return;let t=typeof e==`string`?parseInt(e,10):e;if(!isNaN(t))return at.get(t)}function lt(e){if(!e)return;let t=ot.get(e);if(t)return t;if(/^\d+$/.test(e))return at.get(parseInt(e,10));let n=e.replace(/^prob-/,``).toLowerCase().replace(/[^a-z0-9]+/g,``);for(let e of it)if(e.name.toLowerCase().replace(/[^a-z0-9]+/g,``)===n||e.id.toLowerCase().replace(/[^a-z0-9]+/g,``)===n)return e}function ut(e){if(!e)return;let t=e.toLowerCase().replace(/\s*-\s*method.*$/i,``).replace(/[^a-z0-9]+/g,``);for(let e of it)if(e.name.toLowerCase().replace(/[^a-z0-9]+/g,``)===t)return e}function dt(e,t,n){if(e!=null){let t=ct(e);if(t)return t}if(t){let e=lt(t);if(e)return e}if(n){let e=ut(n);if(e)return e}}function ft(){return it}function pt(){return Array.from(st.keys())}function mt(e,t){if(t&&t.length>0){for(let n of t)if(!e.has(n)){let e=at.get(n);if(e)return e}}for(let t of it)if(!e.has(t.problem_number))return t}var ht=C((e,t)=>({processes:{},sandboxRunning:!1,sandboxResults:null,sandboxError:null,savingReference:!1,savedRefSuccess:!1,saveRefError:null,aiLoading:!1,aiResult:null,aiError:null,explainLoading:!1,explanationText:null,explainError:null,aiSolutionLoading:!1,aiSolutionError:null,registerProcess:(t,n)=>{let r=`${t}-${Date.now().toString(36)}-${Math.random().toString(36).substring(2,6)}`,i={pid:r,appId:t,title:n,status:`running`,startedAt:Date.now()};return e(e=>({processes:{...e.processes,[r]:i}})),r},updateProcessStatus:(t,n,r,i)=>{e(e=>{let a=e.processes[t];return a?{processes:{...e.processes,[t]:{...a,status:n,error:r===void 0?a.error:r,data:i===void 0?a.data:i,completedAt:n===`success`||n===`error`?Date.now():a.completedAt}}}:e})},removeProcess:t=>{e(e=>{let n={...e.processes};return delete n[t],{processes:n}})},clearFinishedProcesses:()=>{e(e=>{let t={};return Object.entries(e.processes).forEach(([e,n])=>{n.status===`running`&&(t[e]=n)}),{processes:t}})},handleRunSandbox:async(n,r)=>{if(!n||!r.trim()||t().sandboxRunning)return;let i=n.problems,a=dt(i?.problem_number,i?.id||``,i?.name),o=(i?.examples&&i.examples.length>0?i.examples:a?.examples||[]).map(e=>typeof e==`string`?{input:e,expected:``}:{input:e?.input??``,expected:e?.output??``}),s=a?.starter_code||i?.starter_code,c=i?.name||a?.name||`Problem`,l=t().registerProcess(`sandbox-runner`,`PyTest: ${c}`);e({sandboxRunning:!0,sandboxResults:null,sandboxError:null,savedRefSuccess:!1});try{let n=await nt(r,o,4,s,c);e({sandboxResults:n}),t().updateProcessStatus(l,`success`,null,n)}catch(n){let r=n instanceof Error?n.message:`Execution failed`;e({sandboxError:r}),t().updateProcessStatus(l,`error`,r)}finally{e({sandboxRunning:!1})}},handleSaveReference:async(n,r,i)=>{if(!n||!r.trim()||t().savingReference)return;let a=n.problems,o=a?.id||n.problem_id;if(!o&&!a?.problem_number)return;let s=a?.problem_number??(typeof n.problem_id==`number`?n.problem_id:/^\d+$/.test(n.problem_id||``)?parseInt(n.problem_id,10):void 0),c=dt(s,o||n.problem_id,a?.name),l=a?.constraints??c?.constraints,u=Array.isArray(l)?l:l?[String(l)]:[],d=a?.examples&&a.examples.length>0?a.examples:c?.examples,f=d?d.map(e=>typeof e==`string`?{input:e,output:``}:{input:String(e?.input??``),output:String(e?.output??``),explanation:e?.explanation}):[],p=a?.name||c?.name||`Problem`,m={problem_number:s??c?.problem_number,problem_name:p,pattern:a?.pattern||c?.pattern,difficulty:a?.difficulty||c?.difficulty,optimal_time:a?.optimal_time||c?.time_complexity,optimal_space:a?.optimal_space||c?.space_complexity,description:a?.description||c?.description,starter_code:c?.starter_code||a?.starter_code,examples:f,constraints:u},h=t().registerProcess(`sandbox-runner`,`Save Ref: ${p}`);e({savingReference:!0,saveRefError:null});try{let n=await $e(o,r,m);e({savedRefSuccess:!0}),t().updateProcessStatus(h,`success`,null,n),i&&i(r,n.problem_id),setTimeout(()=>e({savedRefSuccess:!1}),3500)}catch(n){let r=n instanceof Error?n.message:`Failed to save solution`;e({saveRefError:r}),t().updateProcessStatus(h,`error`,r)}finally{e({savingReference:!1})}},resetSandbox:()=>{let n=t();(n.sandboxResults!==null||n.sandboxError!==null||n.savedRefSuccess||n.saveRefError!==null)&&e({sandboxResults:null,sandboxError:null,savedRefSuccess:!1,saveRefError:null})},handleAiEvaluation:async(n,r)=>{if(!n||!r.trim()||t().aiLoading)return;let i=n.problems,a=i?.name||`Problem`,o=t().registerProcess(`ai-evaluator`,`AI Review: ${a}`);e({aiLoading:!0,aiResult:null,aiError:null});try{let{data:{session:n}}=await O.auth.getSession(),a=n?n.access_token:`sandbox`,s=await fetch(`/api/reviews/evaluate`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${a}`},body:JSON.stringify({problem_name:i.name,pattern:i.pattern,optimal_time:i.optimal_time,optimal_space:i.optimal_space,code:r})});if(s.ok){let n=await s.json();e({aiResult:n}),t().updateProcessStatus(o,`success`,null,n)}else{let n=(await s.json().catch(()=>({}))).detail||`Failed to analyze code.`;e({aiError:n}),t().updateProcessStatus(o,`error`,n)}}catch{let n=`Connection to evaluation server failed.`;e({aiError:n}),t().updateProcessStatus(o,`error`,n)}finally{e({aiLoading:!1})}},handleExplainCode:async(n,r,i,a,o)=>{if(!n||t().explainLoading)return;let s=n.problems;if(!s)return;let c=s.problem_number?ct(s.problem_number):lt(s.id||``),l=r||s.reference_code||c?.reference_solution;if(!l)return;let u=s.name||`Problem`,d=t().registerProcess(`ai-explainer`,`AI Explain: ${u}`);e({explainLoading:!0,explanationText:null,explainError:null});try{let{data:{session:n}}=await O.auth.getSession(),r=n?n.access_token:`sandbox`,u=await fetch(`/api/reviews/explain`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${r}`},body:JSON.stringify({problem_number:s.problem_number||c?.problem_number,method:i||s.pattern||c?.pattern,code:l,problem_name:s.name,optimal_time:a||s.optimal_time||c?.time_complexity,optimal_space:o||s.optimal_space||c?.space_complexity})});if(u.ok){let n=await u.json();e({explanationText:n.explanation}),t().updateProcessStatus(d,`success`,null,n)}else{let n=(await u.json().catch(()=>({}))).detail||`Failed to generate code explanation.`;e({explainError:n}),t().updateProcessStatus(d,`error`,n)}}catch{let n=`Connection to explanation server failed.`;e({explainError:n}),t().updateProcessStatus(d,`error`,n)}finally{e({explainLoading:!1})}},handleFetchAiSolution:async(n,r)=>{if(!n||t().aiSolutionLoading)return;let i=n.problems,a=i?.id||n.problem_id,o=i?.problem_number?ct(i.problem_number):lt(i?.id||``),s=i?.name||`Problem`,c=t().registerProcess(`ai-solution`,`Solution: ${s}`);e({aiSolutionLoading:!0,aiSolutionError:null});try{let e=await tt({problemId:a,problemNumber:i?.problem_number||o?.problem_number,problemName:i?.name,pattern:i?.pattern||o?.pattern});e.solution&&r&&r(e.solution),t().updateProcessStatus(c,`success`,null,e)}catch(n){let r=n instanceof Error?n.message:`Failed to retrieve AI Grimoire solution`;e({aiSolutionError:r}),t().updateProcessStatus(c,`error`,r)}finally{e({aiSolutionLoading:!1})}},resetAiState:()=>{let n=t();(n.aiResult!==null||n.aiError!==null||n.explanationText!==null||n.explainError!==null||n.aiSolutionError!==null)&&e({aiResult:null,aiError:null,explanationText:null,explainError:null,aiSolutionError:null})},getActiveProcesses:()=>Object.values(t().processes).filter(e=>e.status===`running`),hasRunningProcesses:()=>Object.values(t().processes).some(e=>e.status===`running`)})),gt=({id:e,title:a,shortTitle:o,icon:l,isOpen:d,isMinimized:p,isActive:m,isMobile:h,color:g,onToggle:_})=>{let[b,x]=(0,A.useState)(!1),S=Z(e=>e.closeWindow),C=Z(e=>e.focusWindow),w=Z(e=>e.minimizeWindow),{refs:{setReference:T,setFloating:E},floatingStyles:D,context:O}=y({open:b&&!h,onOpenChange:x,placement:`top`,middleware:[f(10),c({padding:8}),r({padding:8})],whileElementsMounted:i}),k=t(O,{delay:{open:350,close:150},restMs:120,enabled:!h}),j=u(O),N=s(O,{role:`tooltip`}),{getReferenceProps:P,getFloatingProps:F}=v([k,j,N]);return d?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`button`,{ref:T,...P(),onClick:()=>{x(!1),_(e)},className:`h-full ${h?`px-2 text-[10px] gap-1`:`px-4 text-xs gap-2`} border-r-[4px] border-ink-black font-bold font-window-title cursor-pointer transition-all shadow-[inset_0px_3px_0px_rgba(255,255,255,0.8)] text-ink-black ${m&&!p?`bg-paper-white font-extrabold translate-y-[2px]`:`bg-surface-variant hover:bg-white/40`}`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-sm font-bold`,style:g&&m?{color:g}:void 0,children:l}),(0,M.jsx)(`span`,{style:g&&m?{color:g}:void 0,children:h?o:a})]}),b&&!h&&(0,M.jsx)(n,{children:(0,M.jsxs)(`div`,{ref:E,style:D,...F(),className:`z-[90] w-64 bg-paper-white border-[3px] border-ink-black shadow-[4px_4px_0px_0px_#1E293B] flex flex-col p-3 select-none animate-fade-in pointer-events-auto`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b-2 border-ink-black/20 pb-1.5 mb-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-base`,style:g?{color:g}:void 0,children:l}),(0,M.jsx)(`span`,{className:`font-window-title text-xs font-bold text-ink-black truncate max-w-[140px]`,children:a})]}),(0,M.jsx)(`span`,{className:`font-arcade text-[8px] font-bold px-1.5 py-0.5 border border-ink-black ${m&&!p?`bg-[#39ff14] text-ink-black`:p?`bg-amber-200 text-amber-900`:`bg-slate-200 text-slate-700`}`,children:m&&!p?`ACTIVE`:p?`MINIMIZED`:`BACKGROUND`})]}),(0,M.jsxs)(`div`,{className:`w-full h-20 bg-slate-900 border-2 border-ink-black mb-2.5 flex flex-col items-center justify-center p-2 relative overflow-hidden group`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 opacity-15 pointer-events-none bg-[radial-gradient(#39ff14_1px,transparent_1px)] [background-size:8px_8px]`}),(0,M.jsx)(`span`,{className:`material-symbols-outlined text-3xl text-emerald-400 opacity-60 mb-1`,children:l}),(0,M.jsx)(`span`,{className:`font-arcade text-[8px] text-emerald-300 tracking-wider`,children:`ALGOSPACED VIEWPORT`})]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-1.5 pt-1 border-t border-ink-black/20`,children:[(0,M.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),x(!1),C(e)},className:`flex-1 py-1 px-2 bg-emerald-100 hover:bg-emerald-200 border-2 border-ink-black text-ink-black font-window-title text-[10px] font-bold flex items-center justify-center gap-1 transition-colors cursor-pointer`,title:`Bring to front`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-xs`,children:`open_in_full`}),`Focus`]}),(0,M.jsx)(`button`,{onClick:t=>{t.stopPropagation(),x(!1),w(e)},className:`py-1 px-2 bg-amber-100 hover:bg-amber-200 border-2 border-ink-black text-ink-black font-window-title text-[10px] font-bold flex items-center justify-center transition-colors cursor-pointer`,title:`Minimize window`,children:(0,M.jsx)(`span`,{className:`material-symbols-outlined text-xs`,children:`minimize`})}),(0,M.jsx)(`button`,{onClick:t=>{t.stopPropagation(),x(!1),S(e)},className:`py-1 px-2 bg-rose-100 hover:bg-rose-200 border-2 border-ink-black text-rose-700 font-window-title text-[10px] font-bold flex items-center justify-center transition-colors cursor-pointer`,title:`Close window`,children:(0,M.jsx)(`span`,{className:`material-symbols-outlined text-xs`,children:`close`})})]})]})})]}):null},_t=({isOpen:e,onOpenChange:t,children:a})=>{let o=ht(e=>e.processes),l=Object.values(o).filter(e=>e.status===`running`),d=Z(e=>e.openWindow),{refs:{setReference:p,setFloating:m},floatingStyles:h,context:g}=y({open:e,onOpenChange:t,placement:`top-end`,middleware:[f(10),c({padding:10}),r({padding:10})],whileElementsMounted:i}),_=u(g,{outsidePress:!0,escapeKey:!0}),b=s(g,{role:`dialog`}),{getReferenceProps:x,getFloatingProps:S}=v([_,b]);return(0,M.jsxs)(M.Fragment,{children:[a(p,x()),e&&(0,M.jsx)(n,{children:(0,M.jsxs)(`div`,{ref:m,style:h,...S(),className:`z-[90] w-80 bg-paper-white border-[3px] border-ink-black shadow-[6px_6px_0px_0px_#1E293B] flex flex-col p-3 select-none animate-fade-in`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b-2 border-ink-black pb-2 mb-2 bg-[#0284c7] text-white px-2 py-1 -mx-3 -mt-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-sm animate-spin`,children:`autorenew`}),(0,M.jsx)(`span`,{className:`font-arcade text-[9px] font-bold tracking-wider`,children:`PROCESS MONITOR`})]}),(0,M.jsxs)(`span`,{className:`font-arcade text-[8px] font-bold bg-[#facc15] text-ink-black px-1.5 py-0.5 border border-ink-black`,children:[l.length,` ACTIVE`]})]}),(0,M.jsx)(`div`,{className:`flex flex-col gap-2 max-h-56 overflow-y-auto custom-scrollbar my-1`,children:l.length===0?(0,M.jsx)(`div`,{className:`text-center py-4 text-xs font-window-title text-slate-500 font-bold`,children:`No background processes running`}):l.map(e=>(0,M.jsxs)(`div`,{className:`p-2 border-2 border-ink-black bg-slate-50 flex flex-col gap-1 shadow-[2px_2px_0_0_#1E293B]`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`span`,{className:`font-window-title text-xs font-bold text-ink-black truncate max-w-[170px]`,children:e.title}),(0,M.jsx)(`span`,{className:`font-arcade text-[7px] font-extrabold bg-[#39ff14] text-ink-black px-1 py-0.2 border border-ink-black`,children:`RUNNING`})]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between font-arcade text-[8px] text-slate-500`,children:[(0,M.jsxs)(`span`,{children:[`TYPE: `,e.appId.toUpperCase()]}),(0,M.jsxs)(`span`,{children:[`PID: `,e.pid.slice(-6)]})]})]},e.pid))}),(0,M.jsxs)(`div`,{className:`pt-2 border-t-2 border-ink-black/20 flex items-center justify-between gap-2 mt-1`,children:[(0,M.jsxs)(`button`,{onClick:()=>{t(!1),d(`terminal`)},className:`flex-1 py-1 px-2 bg-[#39ff14] hover:bg-[#28e007] border-2 border-ink-black text-ink-black font-window-title text-[11px] font-bold flex items-center justify-center gap-1.5 transition-colors cursor-pointer`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-xs`,children:`terminal`}),`Open Terminal (ps)`]}),(0,M.jsx)(`button`,{onClick:()=>t(!1),className:`py-1 px-2.5 bg-slate-200 hover:bg-slate-300 border-2 border-ink-black text-ink-black font-window-title text-[11px] font-bold transition-colors cursor-pointer`,children:`Close`})]})]})})]})},vt=A.forwardRef(({isOpen:e,onOpenWindow:t,onOpenOnboarding:n,onTriggerSync:r,onSignOut:i,style:a,className:o,...s},c)=>e?(0,M.jsxs)(`div`,{ref:c,onClick:e=>e.stopPropagation(),id:`start-menu`,style:a,...s,className:`w-64 bg-white border-[3px] border-ink-black shadow-[6px_6px_0px_0px_#1E293B] flex flex-col p-4 z-[90] select-none ${a?``:`absolute bottom-14 left-0 ml-2 mb-2`} ${o||``}`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b-[2px] border-ink-black pb-2 mb-3`,children:[(0,M.jsx)(`span`,{className:`font-arcade text-[9px] font-bold text-ink-black tracking-wider`,children:`ALGOSPACED OS`}),(0,M.jsx)(`span`,{className:`font-arcade text-[7px] font-extrabold bg-[#facc15] text-ink-black px-1.5 py-0.5 border-[1.5px] border-ink-black shadow-[1.5px_1.5px_0_0_#1E293B]`,children:`BETA`})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2.5 font-window-title text-base font-bold`,children:[(0,M.jsxs)(`button`,{onClick:()=>t(`queue`),className:`w-full text-left hover:bg-secondary-container px-3 py-1.5 border-2 border-transparent hover:border-ink-black transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg`,style:{fontVariationSettings:`'FILL' 1`},children:`view_list`}),`Daily Queue`]}),(0,M.jsxs)(`button`,{onClick:()=>t(`journey`),className:`w-full text-left hover:bg-secondary-container px-3 py-1.5 border-2 border-transparent hover:border-ink-black transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg`,style:{fontVariationSettings:`'FILL' 1`},children:`route`}),`Journey Path`]}),(0,M.jsxs)(`button`,{onClick:n,className:`w-full text-left hover:bg-amber-100 px-3 py-1.5 border-2 border-transparent hover:border-ink-black transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg text-amber-600`,style:{fontVariationSettings:`'FILL' 1`},children:`bolt`}),`Fast-Track Checklist`]}),(0,M.jsxs)(`button`,{onClick:r,className:`w-full text-left hover:bg-secondary-container px-3 py-1.5 border-2 border-transparent hover:border-ink-black transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg`,style:{fontVariationSettings:`'FILL' 1`},children:`cloud_sync`}),`Drive Sync`]}),(0,M.jsxs)(`button`,{onClick:()=>t(`github`),className:`w-full text-left hover:bg-slate-100 px-3 py-1.5 border-2 border-transparent hover:border-ink-black transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg text-slate-800`,style:{fontVariationSettings:`'FILL' 1`},children:`code`}),`GitHub Solutions`]}),(0,M.jsxs)(`button`,{onClick:()=>t(`terminal`),className:`w-full text-left hover:bg-secondary-container px-3 py-1.5 border-2 border-transparent hover:border-ink-black transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg`,style:{fontVariationSettings:`'FILL' 1`},children:`terminal`}),`Terminal`]}),(0,M.jsxs)(`button`,{onClick:()=>t(`computer`),className:`w-full text-left hover:bg-secondary-container px-3 py-1.5 border-2 border-transparent hover:border-ink-black transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg`,style:{fontVariationSettings:`'FILL' 1`},children:`desktop_windows`}),`My Computer`]}),(0,M.jsxs)(`button`,{onClick:()=>t(`companion`),className:`w-full text-left hover:bg-[#ffe24c]/40 px-3 py-1.5 border-2 border-transparent hover:border-[#f59e0b] transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg text-[#f59e0b]`,style:{fontVariationSettings:`'FILL' 1`},children:`castle`}),`Auri`]}),(0,M.jsxs)(`button`,{onClick:()=>t(`python`),className:`w-full text-left hover:bg-secondary-container px-3 py-1.5 border-2 border-transparent hover:border-ink-black transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg`,style:{fontVariationSettings:`'FILL' 1`},children:`sports_esports`}),`Python Challenge`]}),(0,M.jsxs)(`button`,{onClick:()=>t(`mysql`),className:`w-full text-left hover:bg-secondary-container px-3 py-1.5 border-2 border-transparent hover:border-ink-black transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg`,style:{fontVariationSettings:`'FILL' 1`},children:`database`}),`MySQL Playground`]}),(0,M.jsxs)(`button`,{onClick:()=>t(`settings`),className:`w-full text-left hover:bg-[#10b981]/25 px-3 py-1.5 border-2 border-transparent hover:border-[#10b981] transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg text-[#10b981]`,style:{fontVariationSettings:`'FILL' 1`},children:`key`}),`API Configuration`]})]}),(0,M.jsx)(`div`,{className:`mt-4 flex justify-end border-t-[3px] border-ink-black pt-4 select-none`,children:(0,M.jsx)(`button`,{onClick:i,className:`bg-highlight-pink text-white font-window-title px-4 py-2.5 border-[3px] border-ink-black shadow-[3px_3px_0px_0px_#1E293B] active:translate-y-0.5 active:translate-x-0.5 active:shadow-none hover:bg-rose-600 transition-all cursor-pointer font-bold uppercase text-xs`,children:`Shut Down`})})]}):null);vt.displayName=`DesktopStartMenu`;var yt=[{id:`queue`,title:`Daily Queue`,shortTitle:`Queue`,icon:`view_list`},{id:`journey`,title:`Journey Path`,shortTitle:`Journey`,icon:`route`},{id:`terminal`,title:`Terminal`,shortTitle:`Terminal`,icon:`terminal`},{id:`sync`,title:`Drive Sync`,shortTitle:`Sync`,icon:`cloud_sync`},{id:`computer`,title:`My Computer`,shortTitle:`Comp`,icon:`desktop_windows`},{id:`createProblem`,title:`Create Problem`,shortTitle:`New File`,icon:`note_add`},{id:`editProblem`,title:`Edit Problem`,shortTitle:`Edit`,icon:`edit_note`,color:`#059669`},{id:`python`,title:`Python Challenge`,shortTitle:`Python`,icon:`sports_esports`},{id:`mysql`,title:`MySQL Playground`,shortTitle:`SQL`,icon:`database`},{id:`companion`,title:`Auri`,shortTitle:`Auri`,icon:`castle`,color:`#d97706`},{id:`settings`,title:`API Config`,shortTitle:`API`,icon:`key`,color:`#10b981`}],bt=({isStartOpen:e,onToggleStart:t,onCloseStart:a,isMobile:o,windows:l,activeWindow:d,onToggleWindow:p,time:m,onOpenWindow:h,onOpenOnboarding:g,onTriggerSync:_,onSignOut:b})=>{let x=Z(e=>e.windows),S=Z(e=>e.activeWindow),C=Z(e=>e.toggleWindowMinimize),w=Z(e=>e.openWindow),T=ht(e=>e.processes),E=A.useMemo(()=>Object.values(T).filter(e=>e.status===`running`),[T]),D=l??x,O=d??S,k=p??C,[j,N]=(0,A.useState)(!1),P=e??j,F=()=>{a&&a(),N(!1)},I=()=>{P?F():(t&&t(),N(!0))},{refs:{setReference:L,setFloating:R},floatingStyles:z,context:B}=y({open:P,onOpenChange:e=>{e||F()},placement:`top-start`,middleware:[f(10),c({padding:8}),r({padding:8})],whileElementsMounted:i}),V=u(B,{outsidePress:!0,escapeKey:!0}),H=s(B,{role:`menu`}),{getReferenceProps:U,getFloatingProps:W}=v([V,H]),[G,K]=(0,A.useState)(!1);return(0,M.jsxs)(`div`,{onClick:F,className:`fixed bottom-0 left-0 w-full z-50 flex items-center justify-between h-14 border-t-[4px] border-ink-black bg-[#0ea5e9] px-0 select-none shadow-[0_-4px_0_0_rgba(30,41,59,0.1)]`,children:[(0,M.jsxs)(`div`,{className:`flex items-center h-full overflow-x-auto custom-scrollbar`,children:[(0,M.jsxs)(`button`,{ref:L,...U(),onClick:e=>{e.stopPropagation(),I()},className:`h-full ${o?`px-3`:`px-6`} flex items-center gap-2 border-r-[4px] border-ink-black bg-[#39ff14] text-ink-black hover:bg-[#28e007] active:bg-[#1fb304] transition-colors shadow-[inset_-3px_-3px_0px_rgba(0,0,0,0.2),inset_3px_3px_0px_rgba(255,255,255,0.5)] font-bold cursor-pointer`,title:`Start Menu`,"aria-label":`Start Menu`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-2xl font-bold`,style:{fontVariationSettings:`'FILL' 1`},children:`sports_esports`}),(0,M.jsx)(`span`,{className:`font-display-lg ${o?`text-sm`:`text-lg`} italic tracking-wide`,children:`Start`})]}),P&&(0,M.jsx)(n,{children:(0,M.jsx)(vt,{ref:R,style:z,...W(),isOpen:P,onOpenWindow:e=>{F(),h?h(e):w(e)},onOpenOnboarding:()=>{F(),g?.()},onTriggerSync:()=>{F(),_?.()},onSignOut:()=>{F(),b?.()}})}),yt.map(e=>{let t=D[e.id];return t?.isOpen?(0,M.jsx)(gt,{id:e.id,title:e.title,shortTitle:e.shortTitle,icon:e.icon,color:e.color,isOpen:t.isOpen,isMinimized:t.isMinimized,isActive:O===e.id,isMobile:o,onToggle:k},e.id):null})]}),(0,M.jsxs)(`div`,{className:`flex items-center h-full border-l-[4px] border-ink-black bg-[#0369a1] text-white px-3 md:px-4 gap-3 md:gap-4 shadow-[inset_3px_3px_0px_rgba(0,0,0,0.2)]`,children:[(0,M.jsx)(_t,{isOpen:G,onOpenChange:K,children:(e,t)=>E.length>0?(0,M.jsxs)(`div`,{ref:e,...t,onClick:e=>{e.stopPropagation(),K(e=>!e)},title:`Active background processes: ${E.map(e=>e.title).join(`, `)} (click to inspect)`,className:`flex items-center gap-1.5 bg-[#facc15] text-ink-black px-2 py-0.5 border-2 border-ink-black font-arcade text-[8px] font-bold shadow-[1px_1px_0px_0px_#1E293B] animate-pulse select-none cursor-pointer hover:bg-yellow-300`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-[12px] animate-spin`,children:`autorenew`}),(0,M.jsxs)(`span`,{children:[E.length,` PROC`]})]}):null}),(0,M.jsx)(`span`,{className:`material-symbols-outlined cursor-pointer select-none text-lg hover:text-cyan-200 transition-colors`,title:`Sound: ON`,children:`volume_up`}),(0,M.jsx)(`span`,{className:`material-symbols-outlined cursor-pointer select-none text-lg hover:text-cyan-200 transition-colors`,title:`Online`,children:`network_wifi`}),(0,M.jsx)(`div`,{className:`font-arcade text-[9px] font-bold flex flex-col items-center leading-none justify-center select-none pt-0.5 cursor-default`,title:`System Time`,children:(0,M.jsx)(`span`,{children:m})})]})]})},xt=({isMobile:e,isAnyWindowOpen:t,username:n,streak:r,onToggleWindow:i,onTriggerSync:a})=>!e||t?null:(0,M.jsxs)(`div`,{className:`w-full h-[calc(100vh-56px)] overflow-y-auto custom-scrollbar p-6 pb-24 flex flex-col gap-6 z-10 relative`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col select-none border-b-[3px] border-dashed border-ink-black pb-4 min-h-[88px] justify-center shrink-0`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5 h-4`,children:[(0,M.jsx)(`span`,{className:`text-[9px] font-arcade text-trash-gray font-bold uppercase tracking-wider`,children:`AlgoSpaced OS v1.0`}),(0,M.jsx)(`span`,{className:`text-[7px] font-arcade bg-[#facc15] text-ink-black font-extrabold px-1.5 py-0.5 border-[1.5px] border-ink-black shadow-[1px_1px_0px_0px_#1E293B]`,children:`BETA`})]}),(0,M.jsx)(`h1`,{className:`text-4xl font-extrabold font-headline-md text-ink-black uppercase tracking-tight mt-1 h-10 leading-10`,children:`start`})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,M.jsxs)(`div`,{className:`col-span-2 bg-[#fdf8e1] border-[3px] border-ink-black p-4 flex items-center gap-4 gadget-shadow shadow-[inset_2px_2px_0px_rgba(255,255,255,0.8)]`,children:[(0,M.jsx)(`div`,{className:`w-12 h-12 border-[3px] border-ink-black overflow-hidden bg-primary-fixed-dim shadow-[2px_2px_0_0_#1E293B] shrink-0`,children:(0,M.jsx)(`img`,{alt:`Profile Avatar`,width:48,height:48,className:`w-full h-full object-cover`,src:`/icons/avatar.webp`})}),(0,M.jsxs)(`div`,{className:`overflow-hidden`,children:[(0,M.jsx)(`div`,{className:`font-headline-md text-sm font-bold text-ink-black truncate`,children:n}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1 text-red-700 mt-1 select-none font-bold`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-sm`,style:{fontVariationSettings:`'FILL' 1`},children:`local_fire_department`}),(0,M.jsxs)(`span`,{className:`font-arcade text-[7px]`,children:[r?.current_streak??0,` DAY STREAK`]})]})]})]}),(0,M.jsxs)(`button`,{onClick:()=>i(`queue`),className:`bg-grass-green text-ink-black border-[3px] border-ink-black p-4 flex flex-col justify-between aspect-square gadget-shadow active:translate-y-1 active:translate-x-1 active:shadow-none select-none text-left cursor-pointer transition-all`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-3xl align-top`,style:{fontVariationSettings:`'FILL' 1`},children:`view_list`}),(0,M.jsxs)(`span`,{className:`font-arcade text-[8px] font-bold tracking-tight uppercase leading-tight`,children:[`DAILY`,(0,M.jsx)(`br`,{}),`QUEUE`]})]}),(0,M.jsxs)(`button`,{onClick:()=>i(`journey`),className:`bg-[#0ea5e9] text-ink-black border-[3px] border-ink-black p-4 flex flex-col justify-between aspect-square gadget-shadow active:translate-y-1 active:translate-x-1 active:shadow-none select-none text-left cursor-pointer transition-all`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-3xl align-top`,style:{fontVariationSettings:`'FILL' 1`},children:`route`}),(0,M.jsxs)(`span`,{className:`font-arcade text-[8px] font-bold tracking-tight uppercase leading-tight`,children:[`JOURNEY`,(0,M.jsx)(`br`,{}),`PATH`]})]}),(0,M.jsxs)(`button`,{onClick:()=>i(`computer`),className:`bg-paper-white text-ink-black border-[3px] border-ink-black p-4 flex flex-col justify-between aspect-square gadget-shadow active:translate-y-1 active:translate-x-1 active:shadow-none select-none text-left cursor-pointer transition-all`,children:[(0,M.jsx)(`img`,{alt:`My Computer`,width:40,height:40,className:`w-10 h-10 object-cover border-2 border-ink-black bg-white`,src:`/icons/computer.webp`}),(0,M.jsx)(`span`,{className:`font-arcade text-[8px] font-bold tracking-tight uppercase leading-tight`,children:`MY COMP`})]}),(0,M.jsxs)(`button`,{onClick:()=>i(`terminal`),className:`bg-[#1e293b] text-[#39ff14] border-[3px] border-ink-black p-4 flex flex-col justify-between aspect-square gadget-shadow active:translate-y-1 active:translate-x-1 active:shadow-none select-none text-left cursor-pointer transition-all`,children:[(0,M.jsx)(`img`,{alt:`Terminal`,width:40,height:40,className:`w-10 h-10 object-cover border-2 border-ink-black bg-white`,src:`/icons/terminal.webp`}),(0,M.jsx)(`span`,{className:`font-arcade text-[8px] text-[#39ff14] font-bold tracking-tight uppercase leading-tight`,children:`TERMINAL`})]}),(0,M.jsxs)(`button`,{onClick:()=>i(`python`),className:`bg-[#9d4edd] text-white border-[3px] border-ink-black p-4 flex flex-col justify-between aspect-square gadget-shadow active:translate-y-1 active:translate-x-1 active:shadow-none select-none text-left cursor-pointer transition-all`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-3xl align-top`,style:{fontVariationSettings:`'FILL' 1`},children:`sports_esports`}),(0,M.jsxs)(`span`,{className:`font-arcade text-[8px] font-bold tracking-tight uppercase leading-tight`,children:[`PYTHON`,(0,M.jsx)(`br`,{}),`PLAY`]})]}),(0,M.jsxs)(`button`,{onClick:()=>i(`mysql`),className:`bg-[#ffcc00] text-ink-black border-[3px] border-ink-black p-4 flex flex-col justify-between aspect-square gadget-shadow active:translate-y-1 active:translate-x-1 active:shadow-none select-none text-left cursor-pointer transition-all`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-3xl align-top`,style:{fontVariationSettings:`'FILL' 1`},children:`database`}),(0,M.jsxs)(`span`,{className:`font-arcade text-[8px] font-bold tracking-tight uppercase leading-tight`,children:[`MYSQL`,(0,M.jsx)(`br`,{}),`PLAY`]})]}),(0,M.jsxs)(`button`,{onClick:()=>i(`companion`),className:`bg-[#f59e0b] hover:bg-amber-600 text-ink-black border-[3px] border-ink-black p-4 flex flex-col justify-between aspect-square gadget-shadow active:translate-y-1 active:translate-x-1 active:shadow-none select-none text-left cursor-pointer transition-all`,children:[(0,M.jsx)(`img`,{alt:`Auri`,width:40,height:40,className:`w-10 h-10 object-cover object-top border-2 border-ink-black bg-amber-100 rounded`,src:`/sprites/princess/smiling_warmly.webp`}),(0,M.jsx)(`span`,{className:`font-arcade text-[8px] font-bold tracking-tight uppercase leading-tight`,children:`AURI`})]}),(0,M.jsxs)(`button`,{onClick:()=>i(`settings`),className:`bg-[#059669] hover:bg-emerald-700 text-white border-[3px] border-ink-black p-4 flex flex-col justify-between aspect-square gadget-shadow active:translate-y-1 active:translate-x-1 active:shadow-none select-none text-left cursor-pointer transition-all`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-3xl align-top`,style:{fontVariationSettings:`'FILL' 1`},children:`key`}),(0,M.jsx)(`span`,{className:`font-arcade text-[8px] font-bold tracking-tight uppercase leading-tight`,children:`API CONFIG`})]}),(0,M.jsxs)(`button`,{onClick:a,className:`col-span-2 bg-[#ffe24c] hover:bg-yellow-300 text-ink-black border-[3px] border-ink-black p-4 flex items-center justify-between gadget-shadow active:translate-y-1 active:translate-x-1 active:shadow-none select-none text-left cursor-pointer transition-all`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-3xl`,style:{fontVariationSettings:`'FILL' 1`},children:`cloud_sync`}),(0,M.jsx)(`span`,{className:`font-arcade text-[8px] font-bold tracking-tight uppercase`,children:`DRIVE NOTES SYNC`})]}),(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg`,children:`chevron_right`})]})]})]}),St=class extends A.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[WindowErrorBoundary] Error caught in window "${this.props.windowId}":`,e,t)}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?(0,M.jsx)(`div`,{className:`w-full h-full p-6 bg-[#0f172a] text-white flex flex-col items-center justify-center font-sans select-none overflow-auto`,children:(0,M.jsxs)(`div`,{className:`max-w-md w-full bg-[#1e293b] border-[3px] border-rose-500 rounded-lg p-5 shadow-[6px_6px_0px_0px_rgba(0,0,0,0.5)] flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-rose-400 font-headline-md font-bold text-sm border-b border-slate-700 pb-2.5`,children:[(0,M.jsx)(g,{className:`w-5 h-5 shrink-0`}),(0,M.jsxs)(`span`,{children:[`SYSTEM INTERRUPT: `,this.props.windowTitle||this.props.windowId]})]}),(0,M.jsx)(`div`,{className:`bg-[#0b0f19] border border-slate-800 rounded p-3 font-mono text-[11px] text-rose-300 leading-relaxed max-h-32 overflow-y-auto custom-scrollbar`,children:this.state.error?.message||`An unexpected runtime error occurred.`}),(0,M.jsx)(`p`,{className:`text-[11px] text-slate-400 leading-relaxed`,children:`The window process encountered a recoverable fault. You can restart this window module without losing your desktop session.`}),(0,M.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-2 border-t border-slate-700`,children:[this.props.onClose&&(0,M.jsxs)(`button`,{type:`button`,onClick:this.props.onClose,className:`px-3 py-1.5 bg-slate-700 hover:bg-slate-600 text-white rounded text-xs font-bold transition-all flex items-center gap-1.5 cursor-pointer`,children:[(0,M.jsx)(w,{className:`w-3.5 h-3.5`}),(0,M.jsx)(`span`,{children:`Close Window`})]}),(0,M.jsxs)(`button`,{type:`button`,onClick:this.handleReset,className:`px-3 py-1.5 bg-rose-600 hover:bg-rose-500 text-white rounded text-xs font-bold transition-all shadow-[2px_2px_0px_0px_#000] active:translate-y-0.5 active:shadow-none flex items-center gap-1.5 cursor-pointer`,children:[(0,M.jsx)(l,{className:`w-3.5 h-3.5`}),(0,M.jsx)(`span`,{children:`Restart Module`})]})]})]})}):this.props.children}},Ct=e=>{if(!e||!e.startsWith(`#`))return!1;if(e.toLowerCase()===`#0ea5e9`)return!0;let t=e.replace(`#`,``);if(t.length===3){let e=parseInt(t[0]+t[0],16),n=parseInt(t[1]+t[1],16),r=parseInt(t[2]+t[2],16);return .299*e+.587*n+.114*r>135}if(t.length===6){let e=parseInt(t.slice(0,2),16),n=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16);return .299*e+.587*n+.114*r>135}return!1};function Q({id:e,title:t,isOpen:n,isMinimized:r,onClose:i,onMinimize:a,activeWindow:o,setActiveWindow:s,children:c,icon:l=`terminal`,defaultWidth:u=`700px`,defaultHeight:d=`600px`,minWidth:f=380,minHeight:p=280,defaultX:m,defaultY:h,titleBarColor:g=`#0ea5e9`,isMobile:_=!1}){let v=e=>{let t=parseInt(e,10);return isNaN(t)?500:t},y=Z(t=>t.windowZIndexes[e]),b=Z(e=>e.activeWindow),S=Z(e=>e.closeWindow),C=Z(e=>e.minimizeWindow),w=Z(e=>e.focusWindow),T=Z(t=>!!t.maximizedWindows[e]),E=(o??b)===e,D=y??(E?40:30),O=!_&&T,k=i??(()=>S(e)),j=a??(()=>C(e)),N=(0,A.useCallback)(()=>{s?s(e):w(e)},[e,s,w]),P=(0,A.useCallback)(t=>{t?.stopPropagation(),Z.getState().toggleMaximize(e)},[e]),[F,I]=(0,A.useState)(()=>Z.getState().windowPositions[e]||(m===void 0&&h===void 0?{x:Math.floor(Math.random()*40)-20,y:Math.floor(Math.random()*40)-20}:{x:m??0,y:h??0})),[L,R]=(0,A.useState)(()=>Z.getState().windowSizes[e]||{width:v(u),height:v(d)}),[z,B]=(0,A.useState)(!1),[V,H]=(0,A.useState)(!1),U=(0,A.useRef)(F),W=(0,A.useRef)(L),G=(0,A.useRef)(null);(0,A.useEffect)(()=>{U.current=F},[F]),(0,A.useEffect)(()=>{W.current=L},[L]);let K=(0,A.useCallback)((e,t,n,r)=>{if(typeof window>`u`)return{x:e,y:t};let i=window.innerWidth/2,a=window.innerHeight/2,o=n/2,s=r/2,c=-a+s,l=Math.max(c,a+s-80),u=-i-o+80,d=i+o-80;return{x:Math.min(Math.max(e,u),d),y:Math.min(Math.max(t,c),l)}},[]),q=x(({offset:[t,n],first:r,last:i,event:a,cancel:o})=>{let s=a.target;if(s?.closest(`.window-control-btn`)||s?.closest(`.window-resize-handle`)){o();return}r&&(N(),B(!0));let c=K(t,n,W.current.width,W.current.height);U.current=c,G.current&&(G.current.style.transform=`translate3d(calc(-50% + ${c.x}px), calc(-50% + ${c.y}px), 0)`),i&&(B(!1),I(c),Z.getState().updateWindowPosition(e,c.x,c.y))},{from:()=>[U.current.x,U.current.y],pointer:{capture:!0},enabled:!_&&!O,eventOptions:{passive:!1}}),ee=x(({offset:[t,n],first:r,last:i,event:a})=>{a.stopPropagation(),r&&(N(),H(!0));let o=Math.max(f,t),s=Math.max(p,n);W.current={width:o,height:s},G.current&&(G.current.style.width=`${o}px`,G.current.style.height=`${s}px`),i&&(H(!1),R(W.current),Z.getState().updateWindowSize(e,W.current.width,W.current.height))},{from:()=>[W.current.width,W.current.height],pointer:{capture:!0},enabled:!_&&!O,eventOptions:{passive:!1}});return n?(0,M.jsxs)(`div`,{ref:G,onMouseDown:N,style:_?{zIndex:D,display:r?`none`:`flex`}:O?{width:`100vw`,height:`calc(100vh - 56px)`,top:0,left:0,transform:`none`,zIndex:D,display:r?`none`:`flex`}:{width:`${L.width}px`,height:`${L.height}px`,transform:`translate3d(calc(-50% + ${F.x}px), calc(-50% + ${F.y}px), 0)`,zIndex:D,display:r?`none`:`flex`,willChange:z||V?`transform, width, height`:`auto`},className:`absolute bg-paper-white border-[4px] flex flex-col overflow-hidden window-shadow ${z||V?`transition-none`:`transition-all duration-150`} ${_?`top-0 left-0 w-full h-[calc(100vh-56px)] max-w-none max-h-none border-t-0 border-x-0`:O?`top-0 left-0 max-w-none max-h-none border-ink-black`:`top-1/2 left-1/2 max-w-[98vw] max-h-[90vh] border-ink-black`} ${E?`border-ink-black shadow-[8px_8px_0px_0px_rgba(30,41,59,1)]`:`border-ink-black opacity-95 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)]`}`,children:[(0,M.jsxs)(`div`,{...q(),onDoubleClick:_?void 0:P,style:{backgroundColor:g},className:`border-b-[4px] border-ink-black px-4 py-2 flex justify-between items-center ${Ct(g)?`text-ink-black`:`text-white`} shrink-0 select-none touch-none ${_||O?`cursor-default`:z?`cursor-grabbing`:`cursor-grab`}`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 pointer-events-none`,children:[l&&(0,M.jsx)(`span`,{className:`material-symbols-outlined select-none`,style:{fontVariationSettings:`'FILL' 1`},children:l}),(0,M.jsx)(`span`,{className:`font-window-title text-sm md:text-base font-bold tracking-wide select-none`,children:t})]}),(0,M.jsxs)(`div`,{className:`flex gap-1.5`,onPointerDown:e=>e.stopPropagation(),children:[!_&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{onClick:e=>{e.stopPropagation(),j()},className:`window-control-btn w-7 h-7 bg-white text-ink-black border-[3px] border-ink-black flex items-center justify-center hover:bg-yellow-300 active:translate-y-0.5 active:translate-x-0.5 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:shadow-none transition-all cursor-pointer`,title:`Minimize`,"aria-label":`Minimize`,children:(0,M.jsx)(`span`,{className:`material-symbols-outlined text-[14px] font-bold`,children:`minimize`})}),(0,M.jsx)(`button`,{onClick:e=>{e.stopPropagation(),P(e)},className:`window-control-btn w-7 h-7 bg-white text-ink-black border-[3px] border-ink-black flex items-center justify-center hover:bg-yellow-300 active:translate-y-0.5 active:translate-x-0.5 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:shadow-none transition-all cursor-pointer`,title:O?`Restore`:`Maximize`,"aria-label":O?`Restore`:`Maximize`,children:(0,M.jsx)(`span`,{className:`material-symbols-outlined text-[14px] font-bold`,children:O?`filter_none`:`crop_square`})})]}),(0,M.jsx)(`button`,{onClick:e=>{e.stopPropagation(),k()},className:`window-control-btn w-7 h-7 bg-rose-600 text-white border-[3px] border-ink-black flex items-center justify-center hover:bg-rose-700 active:translate-y-0.5 active:translate-x-0.5 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:shadow-none transition-all cursor-pointer`,title:`Close`,"aria-label":`Close`,children:(0,M.jsx)(`span`,{className:`material-symbols-outlined text-[14px] font-bold`,children:`close`})})]})]}),(0,M.jsx)(`div`,{className:`flex-1 overflow-hidden relative bg-paper-white flex flex-col ${z||V?`pointer-events-none select-none`:``}`,children:(0,M.jsx)(St,{windowId:e,windowTitle:t,onClose:k,children:c})}),!_&&!O&&(0,M.jsx)(`div`,{...ee(),className:`window-resize-handle absolute bottom-0 right-0 w-5 h-5 cursor-se-resize flex items-end justify-end p-0.5 select-none z-[50] touch-none`,title:`Resize Window`,children:(0,M.jsxs)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,className:`text-ink-black opacity-60`,children:[(0,M.jsx)(`line`,{x1:`8`,y1:`2`,x2:`2`,y2:`8`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,M.jsx)(`line`,{x1:`8`,y1:`5`,x2:`5`,y2:`8`,stroke:`currentColor`,strokeWidth:`1.5`})]})})]}):null}var wt=`modulepreload`,Tt=function(e){return`/`+e},Et={},$=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Tt(t,n),t=s(t),t in Et)return;Et[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:wt,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Dt=(0,A.lazy)(()=>$(()=>import(`./ReviewQueue-C250a4ib.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]))),Ot=(0,A.lazy)(()=>$(()=>import(`./JourneyPath-DO-UXRtH.js`),__vite__mapDeps([11,1,2,3,4,5,7]))),kt=(0,A.lazy)(()=>$(()=>import(`./TerminalEmulator-DUo8J_0j.js`),__vite__mapDeps([12,1,2,3,4,5]))),At=(0,A.lazy)(()=>$(()=>import(`./PythonChallenge-BUhtEPkm.js`),__vite__mapDeps([13,1,2,3,4,5,9]))),jt=(0,A.lazy)(()=>$(()=>import(`./MySQLPlayground-CA-QZxQM.js`),__vite__mapDeps([14,1,2,3,4,5]))),Mt=(0,A.lazy)(()=>$(()=>import(`./FileExplorer-BX57bI-L.js`),__vite__mapDeps([15,1,2,3,4,5]))),Nt=(0,A.lazy)(()=>$(()=>import(`./Settings-mOsQagfT.js`),__vite__mapDeps([16,1,2,3,6,4,5]))),Pt=(0,A.lazy)(()=>$(()=>import(`./CreateProblemForm-C2nCqjgj.js`),__vite__mapDeps([17,1,2,3,4,5]))),Ft=(0,A.lazy)(()=>$(()=>import(`./PrincessChamber-IJaaUuL1.js`).then(e=>e.t),__vite__mapDeps([10,1,2,3]))),It=(0,A.lazy)(()=>$(()=>import(`./GitHubSyncWindow-D0t6e3o3.js`),__vite__mapDeps([18,1,2,3,6,4,5]))),Lt=({windows:e,activeWindow:t,setActiveWindow:n,isMobile:r,openWindow:i,closeWindow:a,minimizeWindow:o,overrideProblemId:s,setOverrideProblemId:c,editingProblem:l,openEditProblem:u,handleSelectProblemForReview:d,refreshExplorerTrigger:f,triggerRefreshExplorer:p,setIsOnboardingOpen:m,wallpaperUrl:h,setWallpaperUrl:g,syncing:_,syncResult:v,triggerSync:y})=>{let b=Z(e=>e.windows),x=Z(e=>e.activeWindow),S=Z(e=>e.setActiveWindow),C=Z(e=>e.openWindow),w=Z(e=>e.closeWindow),T=Z(e=>e.minimizeWindow),E=Z(e=>e.overrideProblemId),D=Z(e=>e.setOverrideProblemId),O=Z(e=>e.editingProblem),k=Z(e=>e.openEditProblem),j=Z(e=>e.handleSelectProblemForReview),N=Z(e=>e.refreshExplorerTrigger),P=Z(e=>e.triggerRefreshExplorer),F=e??b,I=t??x,L=n??S,R=i??C,z=a??w,B=o??T,V=s===void 0?E:s,H=c??D,U=l===void 0?O:l,W=u??k,G=d??j,K=f??N,q=p??P,ee=(0,A.useCallback)(()=>H(null),[H]),te=(0,A.useCallback)(()=>R(`journey`),[R]),ne=(0,A.useCallback)(()=>R(`createProblem`),[R]),re=(0,A.useCallback)(()=>m(!0),[m]);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Q,{id:`queue`,title:`Daily Queue.exe`,icon:`terminal`,isOpen:F.queue.isOpen,isMinimized:F.queue.isMinimized,onClose:()=>z(`queue`),onMinimize:()=>B(`queue`),activeWindow:I,setActiveWindow:L,defaultWidth:`980px`,defaultHeight:`680px`,minWidth:440,minHeight:360,isMobile:r,children:(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`p-6 font-arcade text-xs text-trash-gray uppercase animate-pulse`,children:`Loading ReviewQueue.exe...`}),children:(0,M.jsx)(Dt,{overrideProblemId:V,onClearOverride:ee,onOpenWindow:R,onOpenJourney:te,onOpenCreateProblem:ne,onOpenEditProblem:W,onOpenOnboarding:re,refreshTrigger:K})})}),(0,M.jsx)(Q,{id:`journey`,title:`Journey_Path.exe`,icon:`route`,isOpen:F.journey.isOpen,isMinimized:F.journey.isMinimized,onClose:()=>z(`journey`),onMinimize:()=>B(`journey`),activeWindow:I,setActiveWindow:L,defaultWidth:`980px`,defaultHeight:`680px`,isMobile:r,children:(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`p-6 font-arcade text-xs text-trash-gray uppercase animate-pulse`,children:`Loading JourneyPath.exe...`}),children:(0,M.jsx)(Ot,{onSelectProblemForReview:G})})}),(0,M.jsx)(Q,{id:`terminal`,title:`Arcade Terminal.com`,icon:`terminal`,isOpen:F.terminal.isOpen,isMinimized:F.terminal.isMinimized,onClose:()=>z(`terminal`),onMinimize:()=>B(`terminal`),activeWindow:I,setActiveWindow:L,defaultWidth:`640px`,defaultHeight:`450px`,titleBarColor:`#1e293b`,isMobile:r,children:(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`p-6 font-arcade text-xs text-trash-gray uppercase animate-pulse`,children:`Loading Terminal.exe...`}),children:(0,M.jsx)(kt,{onOpenWindow:R,onClose:()=>z(`terminal`)})})}),(0,M.jsx)(Q,{id:`sync`,title:`Drive_Sync.sys`,icon:`cloud_sync`,isOpen:F.sync.isOpen,isMinimized:F.sync.isMinimized,onClose:()=>z(`sync`),onMinimize:()=>B(`sync`),activeWindow:I,setActiveWindow:L,defaultWidth:`480px`,defaultHeight:`320px`,titleBarColor:`#855400`,isMobile:r,children:(0,M.jsxs)(`div`,{className:`w-full h-full bg-[#fdf8e1] p-6 flex flex-col justify-between`,children:[(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3 border-b-2 border-dashed border-ink-black pb-3`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-4xl text-[#855400] animate-bounce`,children:`cloud_sync`}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h4`,{className:`font-arcade text-[10px] font-bold text-ink-black`,children:`DRIVE NOTES SYNCHRONIZATION`}),(0,M.jsx)(`span`,{className:`text-[8px] font-arcade text-trash-gray font-bold uppercase mt-1 block`,children:`Importing LeetCode sheets`})]})]}),_?(0,M.jsxs)(`div`,{className:`space-y-3 py-2`,children:[(0,M.jsx)(`span`,{className:`text-[9px] font-arcade text-ink-black font-bold block animate-pulse`,children:`SYNC PROCESS RUNNING...`}),(0,M.jsx)(`div`,{className:`w-full h-6 bg-white border-[3px] border-ink-black relative overflow-hidden select-none`,children:(0,M.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-[#ffe24c] border-r-2 border-ink-black w-[75%] animate-pulse`})}),(0,M.jsx)(`p`,{className:`text-[9px] font-sans text-trash-gray leading-normal font-semibold`,children:`Connecting to Supabase partition, requesting Google Drive manifest, indexing note items...`})]}):(0,M.jsx)(`div`,{className:`p-3 bg-white border-[3px] border-ink-black text-xs font-semibold text-ink-black leading-relaxed shadow-[2px_2px_0px_0px_#1E293B]`,children:v||`Idle. Ready to synchronize Leitner box data logs from Sheets drive storage.`})]}),(0,M.jsxs)(`div`,{className:`flex gap-3 justify-end pt-4 border-t border-slate-200`,children:[(0,M.jsx)(`button`,{onClick:()=>z(`sync`),className:`px-4 py-2 bg-white hover:bg-slate-100 text-ink-black border-[3px] border-ink-black font-bold text-xs shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer`,children:`CLOSE`}),(0,M.jsx)(`button`,{onClick:y,disabled:_,className:`px-4 py-2 bg-[#ffcc00] hover:bg-yellow-300 text-ink-black border-[3px] border-ink-black font-bold text-xs shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none disabled:opacity-50 cursor-pointer`,children:_?`SYNCING...`:`SYNC NOW`})]})]})}),(0,M.jsx)(Q,{id:`github`,title:`GitHub_Sync.exe`,icon:`terminal`,isOpen:F.github?.isOpen??!1,isMinimized:F.github?.isMinimized??!1,onClose:()=>z(`github`),onMinimize:()=>B(`github`),activeWindow:I,setActiveWindow:L,defaultWidth:`620px`,defaultHeight:`520px`,titleBarColor:`#24292e`,isMobile:r,children:(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`p-6 font-arcade text-xs text-trash-gray uppercase animate-pulse`,children:`Loading GitHub_Sync.exe...`}),children:(0,M.jsx)(It,{onClose:()=>z(`github`)})})}),(0,M.jsx)(Q,{id:`computer`,title:`File Explorer`,icon:`desktop_windows`,isOpen:F.computer.isOpen,isMinimized:F.computer.isMinimized,onClose:()=>z(`computer`),onMinimize:()=>B(`computer`),activeWindow:I,setActiveWindow:L,defaultWidth:`640px`,defaultHeight:`480px`,titleBarColor:`#006686`,isMobile:r,children:(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`p-6 font-arcade text-xs text-trash-gray uppercase animate-pulse`,children:`Loading FileExplorer.exe...`}),children:(0,M.jsx)(Mt,{onSetWallpaper:g,activeWallpaperUrl:h,onOpenCreateProblem:()=>R(`createProblem`),onOpenQueue:()=>R(`queue`),onOpenJourney:()=>R(`journey`),refreshTrigger:K})})}),F.createProblem?.isOpen&&(0,M.jsx)(Q,{id:`createProblem`,title:`Create Problem`,icon:`note_add`,isOpen:F.createProblem.isOpen,isMinimized:F.createProblem.isMinimized,onClose:()=>z(`createProblem`),onMinimize:()=>B(`createProblem`),activeWindow:I,setActiveWindow:L,defaultWidth:`640px`,defaultHeight:`700px`,titleBarColor:`#a855f7`,isMobile:r,children:(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`p-6 font-arcade text-xs text-trash-gray uppercase animate-pulse`,children:`Loading CreateForm.exe...`}),children:(0,M.jsx)(Pt,{onClose:()=>z(`createProblem`),onSuccess:()=>{q(),R(`queue`)}})})}),F.editProblem?.isOpen&&(0,M.jsx)(Q,{id:`editProblem`,title:U?`Edit Problem: #${U.problem_number??`—`} ${U.name}`:`Edit Problem`,icon:`edit_note`,isOpen:F.editProblem.isOpen,isMinimized:F.editProblem.isMinimized,onClose:()=>z(`editProblem`),onMinimize:()=>B(`editProblem`),activeWindow:I,setActiveWindow:L,defaultWidth:`760px`,defaultHeight:`720px`,defaultX:30,defaultY:25,titleBarColor:`#059669`,isMobile:r,children:(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`p-6 font-arcade text-xs text-trash-gray uppercase animate-pulse`,children:`Loading EditProblem.exe...`}),children:(0,M.jsx)(Pt,{mode:`edit`,initialProblem:U,onClose:()=>z(`editProblem`),onSuccess:()=>{z(`editProblem`),q(),R(`queue`)}},U?.id||(U?.problem_number===void 0?`edit-problem`:String(U.problem_number)))})}),(0,M.jsx)(Q,{id:`python`,title:`Python Challenge`,icon:`sports_esports`,isOpen:F.python.isOpen,isMinimized:F.python.isMinimized,onClose:()=>z(`python`),onMinimize:()=>B(`python`),activeWindow:I,setActiveWindow:L,defaultWidth:`620px`,defaultHeight:`580px`,titleBarColor:`#9d4edd`,isMobile:r,children:(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`p-6 font-arcade text-xs text-trash-gray uppercase animate-pulse`,children:`Loading PythonChallenge.exe...`}),children:(0,M.jsx)(At,{})})}),(0,M.jsx)(Q,{id:`mysql`,title:`MySQL Playground`,icon:`database`,isOpen:F.mysql.isOpen,isMinimized:F.mysql.isMinimized,onClose:()=>z(`mysql`),onMinimize:()=>B(`mysql`),activeWindow:I,setActiveWindow:L,defaultWidth:`660px`,defaultHeight:`580px`,titleBarColor:`#0ea5e9`,isMobile:r,children:(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`p-6 font-arcade text-xs text-trash-gray uppercase animate-pulse`,children:`Loading MySQLPlayground.exe...`}),children:(0,M.jsx)(jt,{})})}),(0,M.jsx)(Q,{id:`settings`,title:`API Configuration`,icon:`key`,isOpen:F.settings?.isOpen,isMinimized:F.settings?.isMinimized,onClose:()=>z(`settings`),onMinimize:()=>B(`settings`),activeWindow:I,setActiveWindow:L,defaultWidth:`520px`,defaultHeight:`460px`,titleBarColor:`#10b981`,isMobile:r,children:(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`p-6 font-arcade text-xs text-trash-gray uppercase animate-pulse`,children:`Loading APIConfig.exe...`}),children:(0,M.jsx)(Nt,{})})}),F.companion?.isOpen&&!F.companion.isMinimized&&(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`fixed bottom-16 right-8 font-mono text-xs text-amber-300 bg-slate-900/90 p-4 border-2 border-slate-700 rounded z-40 animate-pulse`,children:`Entering the Spire Tower Parlor...`}),children:(0,M.jsx)(Ft,{onClose:()=>z(`companion`),onMinimize:()=>B(`companion`),isActive:I===`companion`,onFocus:()=>L(`companion`),isMobile:r})})]})},Rt=(0,A.lazy)(()=>$(()=>import(`./Auth-B-5KpNfK.js`),__vite__mapDeps([19,1,2,3,4,5]))),zt=(0,A.lazy)(()=>$(()=>import(`./OnboardingModal-hhKaj0In.js`),__vite__mapDeps([8,1,2,3])));function Bt(){let[e,t]=(0,A.useState)(null),[n,r]=(0,A.useState)(!0),[i,a]=(0,A.useState)(!1),[o,s]=(0,A.useState)(!1),c=(0,A.useRef)(null),[l,u]=(0,A.useState)({visible:!1,x:0,y:0}),{openWindow:d,toggleWindowMinimize:f,triggerRefreshExplorer:p,isAnyWindowOpen:m}=We((0,A.useCallback)(()=>s(!1),[])),{time:h,streak:g,isMobile:_,isFullscreen:v,toggleFullscreen:y,syncing:b,syncResult:x,triggerSync:S}=Ge(e,()=>d(`sync`)),{wallpaperUrl:C,setWallpaperUrl:w,handleWallpaperChange:T}=qe(),{companionDialogueEvent:E,setCompanionDialogueEvent:D}=Je(e,d);(0,A.useEffect)(()=>{O.auth.getSession().then(({data:{session:e}})=>{t(e?.user??null),r(!1)});let{data:{subscription:e}}=O.auth.onAuthStateChange((e,n)=>{t(n?.user??null),r(!1)});return()=>{e.unsubscribe()}},[]),(0,A.useEffect)(()=>{if(!n){let e=document.getElementById(`app-loader`);e&&e.remove()}},[n]),(0,A.useEffect)(()=>{if(!n&&e){let t=e.id,n=t===`sandbox-user-id`||!t?`sandbox`:t;if(!localStorage.getItem(`algospaced_onboarding_done_${n}`)){let e=setTimeout(()=>{a(!0)},0);return()=>clearTimeout(e)}}},[n,e]);let k=e=>{let t=e.target;t.closest(`.window-shadow`)||t.closest(`button`)||t.closest(`input`)||t.closest(`textarea`)||t.closest(`details`)||t.closest(`#start-menu`)||(e.preventDefault(),u({visible:!0,x:e.clientX,y:e.clientY}))},j=()=>{l.visible&&u(e=>({...e,visible:!1}))},N=()=>{j(),y()},P=async()=>{s(!1),await O.auth.signOut()},F=e?.email?e.email.split(`@`)[0]:`Player_One`,I=(0,A.useMemo)(()=>[{id:`queue`,label:(0,M.jsxs)(M.Fragment,{children:[`DAILY`,(0,M.jsx)(`br`,{}),`QUEUE`]}),icon:`view_list`,badgeShadowColor:`#fde047`,action:()=>d(`queue`)},{id:`journey`,label:(0,M.jsxs)(M.Fragment,{children:[`JOURNEY`,(0,M.jsx)(`br`,{}),`PATH`]}),icon:`route`,badgeShadowColor:`#fde047`,action:()=>d(`journey`)},{id:`sync`,label:(0,M.jsxs)(M.Fragment,{children:[`DRIVE`,(0,M.jsx)(`br`,{}),`SYNC`]}),icon:`cloud_sync`,badgeShadowColor:`#fde047`,action:S},{id:`github`,label:(0,M.jsxs)(M.Fragment,{children:[`GITHUB`,(0,M.jsx)(`br`,{}),`SYNC`]}),icon:`code`,badgeShadowColor:`#24292e`,action:()=>d(`github`)},{id:`computer`,label:(0,M.jsxs)(M.Fragment,{children:[`MY`,(0,M.jsx)(`br`,{}),`COMP`]}),iconImg:`/icons/computer.webp`,badgeShadowColor:`#fde047`,action:()=>d(`computer`)},{id:`terminal`,label:`TERMINAL`,iconImg:`/icons/terminal.webp`,badgeShadowColor:`#fde047`,action:()=>d(`terminal`)},{id:`python`,label:(0,M.jsxs)(M.Fragment,{children:[`PYTHON`,(0,M.jsx)(`br`,{}),`CHALLENGE`]}),icon:`sports_esports`,badgeShadowColor:`#4cc9f0`,action:()=>d(`python`)},{id:`mysql`,label:(0,M.jsxs)(M.Fragment,{children:[`MYSQL`,(0,M.jsx)(`br`,{}),`PLAYGROUND`]}),icon:`database`,badgeShadowColor:`#f72585`,action:()=>d(`mysql`)},{id:`companion`,label:`Auri`,iconImg:`/sprites/princess/smiling_warmly.webp`,badgeShadowColor:`#fde047`,action:()=>d(`companion`)},{id:`settings`,label:(0,M.jsx)(M.Fragment,{children:`API CONFIG`}),icon:`key`,badgeShadowColor:`#10b981`,action:()=>d(`settings`)}],[d,S]);return n?null:e?(0,M.jsxs)(`main`,{role:`main`,"aria-label":`Desktop Workspace`,onContextMenu:k,onClick:j,className:`w-screen h-screen m-0 p-0 relative isolate font-sans text-ink-black overflow-hidden select-none`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 w-full h-full bg-cover bg-center z-0 pointer-events-none saturate-150 contrast-125 transition-all duration-300`,style:{backgroundImage:`url('${C}')`}}),!_&&(0,M.jsx)(H,{ref:c,icons:I,isMobile:_,onContextMenu:k}),(0,M.jsx)(Ye,{isMobile:_,username:F,streak:g}),(0,M.jsx)(xt,{isMobile:_,isAnyWindowOpen:m,username:F,streak:g,onToggleWindow:f,onTriggerSync:S}),(0,M.jsx)(Lt,{isMobile:_,setIsOnboardingOpen:a,wallpaperUrl:C,setWallpaperUrl:w,syncing:b,syncResult:x,triggerSync:S}),(0,M.jsx)(bt,{isStartOpen:o,onToggleStart:()=>s(e=>!e),onCloseStart:()=>s(!1),onOpenWindow:d,onOpenOnboarding:()=>{s(!1),a(!0)},onTriggerSync:S,onSignOut:P,isMobile:_,time:h}),(0,M.jsx)(He,{event:E,onClose:()=>D(null),onOpenCompanionWindow:()=>d(`companion`)}),(0,M.jsx)(De,{onOpenCompanionWindow:()=>d(`companion`)}),i&&(0,M.jsx)(A.Suspense,{fallback:null,children:(0,M.jsx)(zt,{isOpen:i,onClose:()=>a(!1),onCompleted:p,userId:e?.id||`sandbox`})}),(0,M.jsx)(U,{isOpen:l.visible,x:l.x,y:l.y,onClose:j,onAutoArrange:()=>c.current?.autoArrange(),onResetLayout:()=>c.current?.resetLayout(),onChangeWallpaper:()=>document.getElementById(`wallpaper-input`)?.click(),onOpenWindow:d,onTriggerSync:S,onToggleFullscreen:N,isFullscreen:v}),(0,M.jsx)(`input`,{type:`file`,id:`wallpaper-input`,"aria-label":`Upload custom desktop wallpaper`,accept:`image/*`,onChange:e=>T(e,j),className:`hidden`})]}):(0,M.jsx)(A.Suspense,{fallback:null,children:(0,M.jsx)(Rt,{})})}var Vt=class extends A.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[RootErrorBoundary] Fatal system error caught at OS root:`,e,t)}handleReboot=()=>{window.location.reload()};handleHardReset=()=>{try{localStorage.clear(),sessionStorage.clear()}catch{}window.location.reload()};render(){return this.state.hasError?(0,M.jsxs)(`div`,{className:`fixed inset-0 z-[99999] bg-[#030712] text-white flex flex-col items-center justify-center p-6 font-mono select-none overflow-auto`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 pointer-events-none bg-[radial-gradient(ellipse_at_center,transparent_0%,rgba(0,0,0,0.4)_100%)]`}),(0,M.jsxs)(`div`,{className:`relative max-w-xl w-full bg-[#0b0f19] border-[3px] border-rose-500 rounded-lg p-6 shadow-[8px_8px_0px_0px_rgba(244,63,94,0.3)] flex flex-col gap-5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3 text-rose-400 border-b border-rose-950 pb-3`,children:[(0,M.jsx)(`div`,{className:`p-2 bg-rose-500/10 rounded border border-rose-500/30`,children:(0,M.jsx)(d,{className:`w-6 h-6 text-rose-500 animate-pulse`})}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-sm font-bold tracking-wider uppercase text-rose-300 font-arcade`,children:`ALGOSPACED_RECOVERY_CONSOLE`}),(0,M.jsx)(`p`,{className:`text-[10px] text-rose-400/75 mt-0.5`,children:`STOP: 0x000000D1 • DESKTOP_THREAD_EXCEPTION`})]})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(`span`,{className:`text-[11px] text-slate-400 uppercase font-semibold tracking-wider block`,children:`Fault Trace:`}),(0,M.jsx)(`div`,{className:`bg-[#020617] border border-slate-800 rounded p-3 text-[11px] text-rose-300 font-mono leading-relaxed max-h-36 overflow-y-auto custom-scrollbar break-all`,children:this.state.error?.message||`A fatal system exception was trapped by the OS kernel.`})]}),(0,M.jsx)(`p`,{className:`text-xs text-slate-300 leading-relaxed`,children:`A recoverable exception occurred in the primary desktop shell. Your local data and progress records are safely preserved in storage.`}),(0,M.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-stretch sm:items-center justify-end gap-3 pt-3 border-t border-slate-800`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:this.handleHardReset,className:`px-4 py-2 bg-slate-800 hover:bg-slate-700 text-slate-300 rounded text-xs font-bold transition-all border border-slate-700 flex items-center justify-center gap-2 cursor-pointer`,title:`Clears cached session data and resets workspace state`,children:[(0,M.jsx)(S,{className:`w-3.5 h-3.5 text-slate-400`}),(0,M.jsx)(`span`,{children:`Reset Cache & Reboot`})]}),(0,M.jsxs)(`button`,{type:`button`,onClick:this.handleReboot,className:`px-4 py-2 bg-rose-600 hover:bg-rose-500 text-white rounded text-xs font-bold transition-all shadow-[2px_2px_0px_0px_#000] active:translate-y-0.5 active:shadow-none flex items-center justify-center gap-2 cursor-pointer`,children:[(0,M.jsx)(l,{className:`w-3.5 h-3.5`}),(0,M.jsx)(`span`,{children:`Reboot AlgoSpaced OS`})]})]})]})]}):this.props.children}},Ht=window.fetch;window.fetch=async(e,t)=>{let n=localStorage.getItem(`algospaced_custom_api_key`)||localStorage.getItem(`sandbox_gemini_api_key`),r=localStorage.getItem(`algospaced_custom_ai_provider`)||`default`;if(r&&r!=="default"&&n&&n.trim()){let i=typeof e==`string`?e:`url`in e?e.url:e.toString();if(i&&i.includes(`/api/`)){let i=t?{...t}:{},a=new Headers(i.headers||{});return a.set(`X-Custom-API-Key`,n.trim()),a.set(`X-Gemini-API-Key`,n.trim()),a.set(`X-AI-Provider`,r),i.headers=a,Ht(e,i)}}return Ht(e,t)};async function Ut(){try{let e=await fetch(`/api/config`);if(!e.ok)throw Error(`Failed to load runtime configuration`);let t=await e.json();D(t)}catch(e){console.warn(`Failed to load runtime config from API, falling back to build environment:`,e),D({apiKey:``,authDomain:`algospaced-dsa.firebaseapp.com`,projectId:`algospaced-dsa`,storageBucket:`algospaced-dsa.firebasestorage.app`,messagingSenderId:`1039270308844`,appId:`1:1039270308844:web:6499e8813a9f7926f7aec9`,measurementId:`G-K33PLR1N8E`})}(0,j.createRoot)(document.getElementById(`root`)).render((0,M.jsx)(A.StrictMode,{children:(0,M.jsx)(Vt,{children:(0,M.jsx)(Bt,{})})}))}Ut();export{G as C,K as S,Ce as _,pt as a,X as b,Qe as c,Z as d,Pe as f,ke as g,Fe as h,ft as i,rt as l,Re as m,ht as n,ct as o,Ie as p,dt as r,mt as s,$ as t,et as u,we as v,ye as x,be as y}; \ No newline at end of file + return res if -2**31 <= res <= 2**31 - 1 else 0`}],at=new Map,ot=new Map,st=new Map;for(let e of it){at.set(e.problem_number,e),ot.set(e.id,e);let t=st.get(e.pattern)||[];t.push(e),st.set(e.pattern,t)}function ct(e){if(e==null)return;let t=typeof e==`string`?parseInt(e,10):e;if(!isNaN(t))return at.get(t)}function lt(e){if(!e)return;let t=ot.get(e);if(t)return t;if(/^\d+$/.test(e))return at.get(parseInt(e,10));let n=e.replace(/^prob-/,``).toLowerCase().replace(/[^a-z0-9]+/g,``);for(let e of it)if(e.name.toLowerCase().replace(/[^a-z0-9]+/g,``)===n||e.id.toLowerCase().replace(/[^a-z0-9]+/g,``)===n)return e}function ut(e){if(!e)return;let t=e.toLowerCase().replace(/\s*-\s*method.*$/i,``).replace(/[^a-z0-9]+/g,``);for(let e of it)if(e.name.toLowerCase().replace(/[^a-z0-9]+/g,``)===t)return e}function dt(e,t,n){if(e!=null){let t=ct(e);if(t)return t}if(t){let e=lt(t);if(e)return e}if(n){let e=ut(n);if(e)return e}}function ft(){return it}function pt(){return Array.from(st.keys())}function mt(e,t){if(t&&t.length>0){for(let n of t)if(!e.has(n)){let e=at.get(n);if(e)return e}}for(let t of it)if(!e.has(t.problem_number))return t}var ht=i((e,t)=>({processes:{},sandboxRunning:!1,sandboxResults:null,sandboxError:null,savingReference:!1,savedRefSuccess:!1,saveRefError:null,aiLoading:!1,aiResult:null,aiError:null,explainLoading:!1,explanationText:null,explainError:null,aiSolutionLoading:!1,aiSolutionError:null,registerProcess:(t,n)=>{let r=`${t}-${Date.now().toString(36)}-${Math.random().toString(36).substring(2,6)}`,i={pid:r,appId:t,title:n,status:`running`,startedAt:Date.now()};return e(e=>({processes:{...e.processes,[r]:i}})),r},updateProcessStatus:(t,n,r,i)=>{e(e=>{let a=e.processes[t];return a?{processes:{...e.processes,[t]:{...a,status:n,error:r===void 0?a.error:r,data:i===void 0?a.data:i,completedAt:n===`success`||n===`error`?Date.now():a.completedAt}}}:e})},removeProcess:t=>{e(e=>{let n={...e.processes};return delete n[t],{processes:n}})},clearFinishedProcesses:()=>{e(e=>{let t={};return Object.entries(e.processes).forEach(([e,n])=>{n.status===`running`&&(t[e]=n)}),{processes:t}})},handleRunSandbox:async(n,r)=>{if(!n||!r.trim()||t().sandboxRunning)return;let i=n.problems,a=dt(i?.problem_number,i?.id||``,i?.name),o=(i?.examples&&i.examples.length>0?i.examples:a?.examples||[]).map(e=>typeof e==`string`?{input:e,expected:``}:{input:e?.input??``,expected:e?.output??``}),s=a?.starter_code||i?.starter_code,c=i?.name||a?.name||`Problem`,l=t().registerProcess(`sandbox-runner`,`PyTest: ${c}`);e({sandboxRunning:!0,sandboxResults:null,sandboxError:null,savedRefSuccess:!1});try{let n=await nt(r,o,4,s,c);e({sandboxResults:n}),t().updateProcessStatus(l,`success`,null,n)}catch(n){let r=n instanceof Error?n.message:`Execution failed`;e({sandboxError:r}),t().updateProcessStatus(l,`error`,r)}finally{e({sandboxRunning:!1})}},handleSaveReference:async(n,r,i)=>{if(!n||!r.trim()||t().savingReference)return;let a=n.problems,o=a?.id||n.problem_id;if(!o&&!a?.problem_number)return;let s=a?.problem_number??(typeof n.problem_id==`number`?n.problem_id:/^\d+$/.test(n.problem_id||``)?parseInt(n.problem_id,10):void 0),c=dt(s,o||n.problem_id,a?.name),l=a?.constraints??c?.constraints,u=Array.isArray(l)?l:l?[String(l)]:[],d=a?.examples&&a.examples.length>0?a.examples:c?.examples,f=d?d.map(e=>typeof e==`string`?{input:e,output:``}:{input:String(e?.input??``),output:String(e?.output??``),explanation:e?.explanation}):[],p=a?.name||c?.name||`Problem`,m={problem_number:s??c?.problem_number,problem_name:p,pattern:a?.pattern||c?.pattern,difficulty:a?.difficulty||c?.difficulty,optimal_time:a?.optimal_time||c?.time_complexity,optimal_space:a?.optimal_space||c?.space_complexity,description:a?.description||c?.description,starter_code:c?.starter_code||a?.starter_code,examples:f,constraints:u},h=t().registerProcess(`sandbox-runner`,`Save Ref: ${p}`);e({savingReference:!0,saveRefError:null});try{let n=await $e(o,r,m);e({savedRefSuccess:!0}),t().updateProcessStatus(h,`success`,null,n),i&&i(r,n.problem_id),setTimeout(()=>e({savedRefSuccess:!1}),3500)}catch(n){let r=n instanceof Error?n.message:`Failed to save solution`;e({saveRefError:r}),t().updateProcessStatus(h,`error`,r)}finally{e({savingReference:!1})}},resetSandbox:()=>{let n=t();(n.sandboxResults!==null||n.sandboxError!==null||n.savedRefSuccess||n.saveRefError!==null)&&e({sandboxResults:null,sandboxError:null,savedRefSuccess:!1,saveRefError:null})},handleAiEvaluation:async(n,r)=>{if(!n||!r.trim()||t().aiLoading)return;let i=n.problems,a=i?.name||`Problem`,o=t().registerProcess(`ai-evaluator`,`AI Review: ${a}`);e({aiLoading:!0,aiResult:null,aiError:null});try{let{data:{session:n}}=await O.auth.getSession(),a=n?n.access_token:`sandbox`,s=await fetch(`/api/reviews/evaluate`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${a}`},body:JSON.stringify({problem_name:i.name,pattern:i.pattern,optimal_time:i.optimal_time,optimal_space:i.optimal_space,code:r})});if(s.ok){let n=await s.json();e({aiResult:n}),t().updateProcessStatus(o,`success`,null,n)}else{let n=(await s.json().catch(()=>({}))).detail||`Failed to analyze code.`;e({aiError:n}),t().updateProcessStatus(o,`error`,n)}}catch{let n=`Connection to evaluation server failed.`;e({aiError:n}),t().updateProcessStatus(o,`error`,n)}finally{e({aiLoading:!1})}},handleExplainCode:async(n,r,i,a,o)=>{if(!n||t().explainLoading)return;let s=n.problems;if(!s)return;let c=s.problem_number?ct(s.problem_number):lt(s.id||``),l=r||s.reference_code||c?.reference_solution;if(!l)return;let u=s.name||`Problem`,d=t().registerProcess(`ai-explainer`,`AI Explain: ${u}`);e({explainLoading:!0,explanationText:null,explainError:null});try{let{data:{session:n}}=await O.auth.getSession(),r=n?n.access_token:`sandbox`,u=await fetch(`/api/reviews/explain`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${r}`},body:JSON.stringify({problem_number:s.problem_number||c?.problem_number,method:i||s.pattern||c?.pattern,code:l,problem_name:s.name,optimal_time:a||s.optimal_time||c?.time_complexity,optimal_space:o||s.optimal_space||c?.space_complexity})});if(u.ok){let n=await u.json();e({explanationText:n.explanation}),t().updateProcessStatus(d,`success`,null,n)}else{let n=(await u.json().catch(()=>({}))).detail||`Failed to generate code explanation.`;e({explainError:n}),t().updateProcessStatus(d,`error`,n)}}catch{let n=`Connection to explanation server failed.`;e({explainError:n}),t().updateProcessStatus(d,`error`,n)}finally{e({explainLoading:!1})}},handleFetchAiSolution:async(n,r)=>{if(!n||t().aiSolutionLoading)return;let i=n.problems,a=i?.id||n.problem_id,o=i?.problem_number?ct(i.problem_number):lt(i?.id||``),s=i?.name||`Problem`,c=t().registerProcess(`ai-solution`,`Solution: ${s}`);e({aiSolutionLoading:!0,aiSolutionError:null});try{let e=await tt({problemId:a,problemNumber:i?.problem_number||o?.problem_number,problemName:i?.name,pattern:i?.pattern||o?.pattern});e.solution&&r&&r(e.solution),t().updateProcessStatus(c,`success`,null,e)}catch(n){let r=n instanceof Error?n.message:`Failed to retrieve AI Grimoire solution`;e({aiSolutionError:r}),t().updateProcessStatus(c,`error`,r)}finally{e({aiSolutionLoading:!1})}},resetAiState:()=>{let n=t();(n.aiResult!==null||n.aiError!==null||n.explanationText!==null||n.explainError!==null||n.aiSolutionError!==null)&&e({aiResult:null,aiError:null,explanationText:null,explainError:null,aiSolutionError:null})},getActiveProcesses:()=>Object.values(t().processes).filter(e=>e.status===`running`),hasRunningProcesses:()=>Object.values(t().processes).some(e=>e.status===`running`)})),gt=({id:e,title:n,shortTitle:i,icon:o,isOpen:c,isMinimized:u,isActive:m,isMobile:h,color:g,onToggle:_})=>{let[v,x]=(0,A.useState)(!1),S=X(e=>e.closeWindow),C=X(e=>e.focusWindow),w=X(e=>e.minimizeWindow),{refs:{setReference:T,setFloating:E},floatingStyles:D,context:O}=b({open:v&&!h,onOpenChange:x,placement:`top`,middleware:[p(10),d({padding:8}),a({padding:8})],whileElementsMounted:s}),k=t(O,{delay:{open:350,close:150},restMs:120,enabled:!h}),j=f(O),N=l(O,{role:`tooltip`}),{getReferenceProps:P,getFloatingProps:F}=y([k,j,N]);return c?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`button`,{ref:T,...P(),onClick:()=>{x(!1),_(e)},className:`h-full ${h?`px-2 text-[10px] gap-1`:`px-4 text-xs gap-2`} border-r-[4px] border-ink-black font-bold font-window-title cursor-pointer transition-all shadow-[inset_0px_3px_0px_rgba(255,255,255,0.8)] text-ink-black ${m&&!u?`bg-paper-white font-extrabold translate-y-[2px]`:`bg-surface-variant hover:bg-white/40`}`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-sm font-bold`,style:g&&m?{color:g}:void 0,children:o}),(0,M.jsx)(`span`,{style:g&&m?{color:g}:void 0,children:h?i:n})]}),v&&!h&&(0,M.jsx)(r,{children:(0,M.jsxs)(`div`,{ref:E,style:D,...F(),className:`z-[90] w-64 bg-paper-white border-[3px] border-ink-black shadow-[4px_4px_0px_0px_#1E293B] flex flex-col p-3 select-none animate-fade-in pointer-events-auto`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b-2 border-ink-black/20 pb-1.5 mb-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-base`,style:g?{color:g}:void 0,children:o}),(0,M.jsx)(`span`,{className:`font-window-title text-xs font-bold text-ink-black truncate max-w-[140px]`,children:n})]}),(0,M.jsx)(`span`,{className:`font-arcade text-[8px] font-bold px-1.5 py-0.5 border border-ink-black ${m&&!u?`bg-[#39ff14] text-ink-black`:u?`bg-amber-200 text-amber-900`:`bg-slate-200 text-slate-700`}`,children:m&&!u?`ACTIVE`:u?`MINIMIZED`:`BACKGROUND`})]}),(0,M.jsxs)(`div`,{className:`w-full h-20 bg-slate-900 border-2 border-ink-black mb-2.5 flex flex-col items-center justify-center p-2 relative overflow-hidden group`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 opacity-15 pointer-events-none bg-[radial-gradient(#39ff14_1px,transparent_1px)] [background-size:8px_8px]`}),(0,M.jsx)(`span`,{className:`material-symbols-outlined text-3xl text-emerald-400 opacity-60 mb-1`,children:o}),(0,M.jsx)(`span`,{className:`font-arcade text-[8px] text-emerald-300 tracking-wider`,children:`ALGOSPACED VIEWPORT`})]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-1.5 pt-1 border-t border-ink-black/20`,children:[(0,M.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),x(!1),C(e)},className:`flex-1 py-1 px-2 bg-emerald-100 hover:bg-emerald-200 border-2 border-ink-black text-ink-black font-window-title text-[10px] font-bold flex items-center justify-center gap-1 transition-colors cursor-pointer`,title:`Bring to front`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-xs`,children:`open_in_full`}),`Focus`]}),(0,M.jsx)(`button`,{onClick:t=>{t.stopPropagation(),x(!1),w(e)},className:`py-1 px-2 bg-amber-100 hover:bg-amber-200 border-2 border-ink-black text-ink-black font-window-title text-[10px] font-bold flex items-center justify-center transition-colors cursor-pointer`,title:`Minimize window`,children:(0,M.jsx)(`span`,{className:`material-symbols-outlined text-xs`,children:`minimize`})}),(0,M.jsx)(`button`,{onClick:t=>{t.stopPropagation(),x(!1),S(e)},className:`py-1 px-2 bg-rose-100 hover:bg-rose-200 border-2 border-ink-black text-rose-700 font-window-title text-[10px] font-bold flex items-center justify-center transition-colors cursor-pointer`,title:`Close window`,children:(0,M.jsx)(`span`,{className:`material-symbols-outlined text-xs`,children:`close`})})]})]})})]}):null},_t=({isOpen:e,onOpenChange:t,children:n})=>{let i=ht(e=>e.processes),o=Object.values(i).filter(e=>e.status===`running`),c=X(e=>e.openWindow),{refs:{setReference:u,setFloating:m},floatingStyles:h,context:g}=b({open:e,onOpenChange:t,placement:`top-end`,middleware:[p(10),d({padding:10}),a({padding:10})],whileElementsMounted:s}),_=f(g,{outsidePress:!0,escapeKey:!0}),v=l(g,{role:`dialog`}),{getReferenceProps:x,getFloatingProps:S}=y([_,v]);return(0,M.jsxs)(M.Fragment,{children:[n(u,x()),e&&(0,M.jsx)(r,{children:(0,M.jsxs)(`div`,{ref:m,style:h,...S(),className:`z-[90] w-80 bg-paper-white border-[3px] border-ink-black shadow-[6px_6px_0px_0px_#1E293B] flex flex-col p-3 select-none animate-fade-in`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b-2 border-ink-black pb-2 mb-2 bg-[#0284c7] text-white px-2 py-1 -mx-3 -mt-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-sm animate-spin`,children:`autorenew`}),(0,M.jsx)(`span`,{className:`font-arcade text-[9px] font-bold tracking-wider`,children:`PROCESS MONITOR`})]}),(0,M.jsxs)(`span`,{className:`font-arcade text-[8px] font-bold bg-[#facc15] text-ink-black px-1.5 py-0.5 border border-ink-black`,children:[o.length,` ACTIVE`]})]}),(0,M.jsx)(`div`,{className:`flex flex-col gap-2 max-h-56 overflow-y-auto custom-scrollbar my-1`,children:o.length===0?(0,M.jsx)(`div`,{className:`text-center py-4 text-xs font-window-title text-slate-500 font-bold`,children:`No background processes running`}):o.map(e=>(0,M.jsxs)(`div`,{className:`p-2 border-2 border-ink-black bg-slate-50 flex flex-col gap-1 shadow-[2px_2px_0_0_#1E293B]`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`span`,{className:`font-window-title text-xs font-bold text-ink-black truncate max-w-[170px]`,children:e.title}),(0,M.jsx)(`span`,{className:`font-arcade text-[7px] font-extrabold bg-[#39ff14] text-ink-black px-1 py-0.2 border border-ink-black`,children:`RUNNING`})]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between font-arcade text-[8px] text-slate-500`,children:[(0,M.jsxs)(`span`,{children:[`TYPE: `,e.appId.toUpperCase()]}),(0,M.jsxs)(`span`,{children:[`PID: `,e.pid.slice(-6)]})]})]},e.pid))}),(0,M.jsxs)(`div`,{className:`pt-2 border-t-2 border-ink-black/20 flex items-center justify-between gap-2 mt-1`,children:[(0,M.jsxs)(`button`,{onClick:()=>{t(!1),c(`terminal`)},className:`flex-1 py-1 px-2 bg-[#39ff14] hover:bg-[#28e007] border-2 border-ink-black text-ink-black font-window-title text-[11px] font-bold flex items-center justify-center gap-1.5 transition-colors cursor-pointer`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-xs`,children:`terminal`}),`Open Terminal (ps)`]}),(0,M.jsx)(`button`,{onClick:()=>t(!1),className:`py-1 px-2.5 bg-slate-200 hover:bg-slate-300 border-2 border-ink-black text-ink-black font-window-title text-[11px] font-bold transition-colors cursor-pointer`,children:`Close`})]})]})})]})},vt=A.forwardRef(({isOpen:e,onOpenWindow:t,onOpenOnboarding:n,onTriggerSync:r,onSignOut:i,style:a,className:o,...s},c)=>e?(0,M.jsxs)(`div`,{ref:c,onClick:e=>e.stopPropagation(),id:`start-menu`,style:a,...s,className:`w-64 bg-white border-[3px] border-ink-black shadow-[6px_6px_0px_0px_#1E293B] flex flex-col p-4 z-[90] select-none ${a?``:`absolute bottom-14 left-0 ml-2 mb-2`} ${o||``}`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b-[2px] border-ink-black pb-2 mb-3`,children:[(0,M.jsx)(`span`,{className:`font-arcade text-[9px] font-bold text-ink-black tracking-wider`,children:`ALGOSPACED OS`}),(0,M.jsx)(`span`,{className:`font-arcade text-[7px] font-extrabold bg-[#facc15] text-ink-black px-1.5 py-0.5 border-[1.5px] border-ink-black shadow-[1.5px_1.5px_0_0_#1E293B]`,children:`BETA`})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2.5 font-window-title text-base font-bold`,children:[(0,M.jsxs)(`button`,{onClick:()=>t(`queue`),className:`w-full text-left hover:bg-secondary-container px-3 py-1.5 border-2 border-transparent hover:border-ink-black transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg`,style:{fontVariationSettings:`'FILL' 1`},children:`view_list`}),`Daily Queue`]}),(0,M.jsxs)(`button`,{onClick:()=>t(`journey`),className:`w-full text-left hover:bg-secondary-container px-3 py-1.5 border-2 border-transparent hover:border-ink-black transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg`,style:{fontVariationSettings:`'FILL' 1`},children:`route`}),`Journey Path`]}),(0,M.jsxs)(`button`,{onClick:n,className:`w-full text-left hover:bg-amber-100 px-3 py-1.5 border-2 border-transparent hover:border-ink-black transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg text-amber-600`,style:{fontVariationSettings:`'FILL' 1`},children:`bolt`}),`Fast-Track Checklist`]}),(0,M.jsxs)(`button`,{onClick:r,className:`w-full text-left hover:bg-secondary-container px-3 py-1.5 border-2 border-transparent hover:border-ink-black transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg`,style:{fontVariationSettings:`'FILL' 1`},children:`cloud_sync`}),`Drive Sync`]}),(0,M.jsxs)(`button`,{onClick:()=>t(`github`),className:`w-full text-left hover:bg-slate-100 px-3 py-1.5 border-2 border-transparent hover:border-ink-black transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg text-slate-800`,style:{fontVariationSettings:`'FILL' 1`},children:`code`}),`GitHub Solutions`]}),(0,M.jsxs)(`button`,{onClick:()=>t(`terminal`),className:`w-full text-left hover:bg-secondary-container px-3 py-1.5 border-2 border-transparent hover:border-ink-black transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg`,style:{fontVariationSettings:`'FILL' 1`},children:`terminal`}),`Terminal`]}),(0,M.jsxs)(`button`,{onClick:()=>t(`computer`),className:`w-full text-left hover:bg-secondary-container px-3 py-1.5 border-2 border-transparent hover:border-ink-black transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg`,style:{fontVariationSettings:`'FILL' 1`},children:`desktop_windows`}),`My Computer`]}),(0,M.jsxs)(`button`,{onClick:()=>t(`companion`),className:`w-full text-left hover:bg-[#ffe24c]/40 px-3 py-1.5 border-2 border-transparent hover:border-[#f59e0b] transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg text-[#f59e0b]`,style:{fontVariationSettings:`'FILL' 1`},children:`castle`}),`Auri`]}),(0,M.jsxs)(`button`,{onClick:()=>t(`python`),className:`w-full text-left hover:bg-secondary-container px-3 py-1.5 border-2 border-transparent hover:border-ink-black transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg`,style:{fontVariationSettings:`'FILL' 1`},children:`sports_esports`}),`Python Challenge`]}),(0,M.jsxs)(`button`,{onClick:()=>t(`mysql`),className:`w-full text-left hover:bg-secondary-container px-3 py-1.5 border-2 border-transparent hover:border-ink-black transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg`,style:{fontVariationSettings:`'FILL' 1`},children:`database`}),`MySQL Playground`]}),(0,M.jsxs)(`button`,{onClick:()=>t(`settings`),className:`w-full text-left hover:bg-[#10b981]/25 px-3 py-1.5 border-2 border-transparent hover:border-[#10b981] transition-colors cursor-pointer flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg text-[#10b981]`,style:{fontVariationSettings:`'FILL' 1`},children:`key`}),`API Configuration`]})]}),(0,M.jsx)(`div`,{className:`mt-4 flex justify-end border-t-[3px] border-ink-black pt-4 select-none`,children:(0,M.jsx)(`button`,{onClick:i,className:`bg-highlight-pink text-white font-window-title px-4 py-2.5 border-[3px] border-ink-black shadow-[3px_3px_0px_0px_#1E293B] active:translate-y-0.5 active:translate-x-0.5 active:shadow-none hover:bg-rose-600 transition-all cursor-pointer font-bold uppercase text-xs`,children:`Shut Down`})})]}):null);vt.displayName=`DesktopStartMenu`;var yt=[{id:`queue`,title:`Daily Queue`,shortTitle:`Queue`,icon:`view_list`},{id:`journey`,title:`Journey Path`,shortTitle:`Journey`,icon:`route`},{id:`terminal`,title:`Terminal`,shortTitle:`Terminal`,icon:`terminal`},{id:`sync`,title:`Drive Sync`,shortTitle:`Sync`,icon:`cloud_sync`},{id:`computer`,title:`My Computer`,shortTitle:`Comp`,icon:`desktop_windows`},{id:`createProblem`,title:`Create Problem`,shortTitle:`New File`,icon:`note_add`},{id:`editProblem`,title:`Edit Problem`,shortTitle:`Edit`,icon:`edit_note`,color:`#059669`},{id:`python`,title:`Python Challenge`,shortTitle:`Python`,icon:`sports_esports`},{id:`mysql`,title:`MySQL Playground`,shortTitle:`SQL`,icon:`database`},{id:`companion`,title:`Auri`,shortTitle:`Auri`,icon:`castle`,color:`#d97706`},{id:`settings`,title:`API Config`,shortTitle:`API`,icon:`key`,color:`#10b981`}],bt=({isStartOpen:e,onToggleStart:t,onCloseStart:n,isMobile:i,windows:o,activeWindow:c,onToggleWindow:u,time:m,onOpenWindow:h,onOpenOnboarding:g,onTriggerSync:_,onSignOut:v})=>{let x=X(e=>e.windows),S=X(e=>e.activeWindow),C=X(e=>e.toggleWindowMinimize),w=X(e=>e.openWindow),T=ht(e=>e.processes),E=A.useMemo(()=>Object.values(T).filter(e=>e.status===`running`),[T]),D=o??x,O=c??S,k=u??C,[j,N]=(0,A.useState)(!1),P=e??j,F=()=>{n&&n(),N(!1)},I=()=>{P?F():(t&&t(),N(!0))},{refs:{setReference:L,setFloating:R},floatingStyles:z,context:B}=b({open:P,onOpenChange:e=>{e||F()},placement:`top-start`,middleware:[p(10),d({padding:8}),a({padding:8})],whileElementsMounted:s}),V=f(B,{outsidePress:!0,escapeKey:!0}),ee=l(B,{role:`menu`}),{getReferenceProps:H,getFloatingProps:U}=y([V,ee]),[W,G]=(0,A.useState)(!1);return(0,M.jsxs)(`div`,{onClick:F,className:`fixed bottom-0 left-0 w-full z-50 flex items-center justify-between h-14 border-t-[4px] border-ink-black bg-[#0ea5e9] px-0 select-none shadow-[0_-4px_0_0_rgba(30,41,59,0.1)]`,children:[(0,M.jsxs)(`div`,{className:`flex items-center h-full overflow-x-auto custom-scrollbar`,children:[(0,M.jsxs)(`button`,{ref:L,...H(),onClick:e=>{e.stopPropagation(),I()},className:`h-full ${i?`px-3`:`px-6`} flex items-center gap-2 border-r-[4px] border-ink-black bg-[#39ff14] text-ink-black hover:bg-[#28e007] active:bg-[#1fb304] transition-colors shadow-[inset_-3px_-3px_0px_rgba(0,0,0,0.2),inset_3px_3px_0px_rgba(255,255,255,0.5)] font-bold cursor-pointer`,title:`Start Menu`,"aria-label":`Start Menu`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-2xl font-bold`,style:{fontVariationSettings:`'FILL' 1`},children:`sports_esports`}),(0,M.jsx)(`span`,{className:`font-display-lg ${i?`text-sm`:`text-lg`} italic tracking-wide`,children:`Start`})]}),P&&(0,M.jsx)(r,{children:(0,M.jsx)(vt,{ref:R,style:z,...U(),isOpen:P,onOpenWindow:e=>{F(),h?h(e):w(e)},onOpenOnboarding:()=>{F(),g?.()},onTriggerSync:()=>{F(),_?.()},onSignOut:()=>{F(),v?.()}})}),yt.map(e=>{let t=D[e.id];return t?.isOpen?(0,M.jsx)(gt,{id:e.id,title:e.title,shortTitle:e.shortTitle,icon:e.icon,color:e.color,isOpen:t.isOpen,isMinimized:t.isMinimized,isActive:O===e.id,isMobile:i,onToggle:k},e.id):null})]}),(0,M.jsxs)(`div`,{className:`flex items-center h-full border-l-[4px] border-ink-black bg-[#0369a1] text-white px-3 md:px-4 gap-3 md:gap-4 shadow-[inset_3px_3px_0px_rgba(0,0,0,0.2)]`,children:[(0,M.jsx)(_t,{isOpen:W,onOpenChange:G,children:(e,t)=>E.length>0?(0,M.jsxs)(`div`,{ref:e,...t,onClick:e=>{e.stopPropagation(),G(e=>!e)},title:`Active background processes: ${E.map(e=>e.title).join(`, `)} (click to inspect)`,className:`flex items-center gap-1.5 bg-[#facc15] text-ink-black px-2 py-0.5 border-2 border-ink-black font-arcade text-[8px] font-bold shadow-[1px_1px_0px_0px_#1E293B] animate-pulse select-none cursor-pointer hover:bg-yellow-300`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-[12px] animate-spin`,children:`autorenew`}),(0,M.jsxs)(`span`,{children:[E.length,` PROC`]})]}):null}),(0,M.jsx)(`span`,{className:`material-symbols-outlined cursor-pointer select-none text-lg hover:text-cyan-200 transition-colors`,title:`Sound: ON`,children:`volume_up`}),(0,M.jsx)(`span`,{className:`material-symbols-outlined cursor-pointer select-none text-lg hover:text-cyan-200 transition-colors`,title:`Online`,children:`network_wifi`}),(0,M.jsx)(`div`,{className:`font-arcade text-[9px] font-bold flex flex-col items-center leading-none justify-center select-none pt-0.5 cursor-default`,title:`System Time`,children:(0,M.jsx)(`span`,{children:m})})]})]})},xt=({isMobile:e,isAnyWindowOpen:t,username:n,streak:r,onToggleWindow:i,onTriggerSync:a})=>!e||t?null:(0,M.jsxs)(`div`,{className:`w-full h-[calc(100vh-56px)] overflow-y-auto custom-scrollbar p-6 pb-24 flex flex-col gap-6 z-10 relative`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col select-none border-b-[3px] border-dashed border-ink-black pb-4 min-h-[88px] justify-center shrink-0`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5 h-4`,children:[(0,M.jsx)(`span`,{className:`text-[9px] font-arcade text-trash-gray font-bold uppercase tracking-wider`,children:`AlgoSpaced OS v1.0`}),(0,M.jsx)(`span`,{className:`text-[7px] font-arcade bg-[#facc15] text-ink-black font-extrabold px-1.5 py-0.5 border-[1.5px] border-ink-black shadow-[1px_1px_0px_0px_#1E293B]`,children:`BETA`})]}),(0,M.jsx)(`h1`,{className:`text-4xl font-extrabold font-headline-md text-ink-black uppercase tracking-tight mt-1 h-10 leading-10`,children:`start`})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,M.jsxs)(`div`,{className:`col-span-2 bg-[#fdf8e1] border-[3px] border-ink-black p-4 flex items-center gap-4 gadget-shadow shadow-[inset_2px_2px_0px_rgba(255,255,255,0.8)]`,children:[(0,M.jsx)(`div`,{className:`w-12 h-12 border-[3px] border-ink-black overflow-hidden bg-primary-fixed-dim shadow-[2px_2px_0_0_#1E293B] shrink-0`,children:(0,M.jsx)(`img`,{alt:`Profile Avatar`,width:48,height:48,className:`w-full h-full object-cover`,src:`/icons/avatar.webp`})}),(0,M.jsxs)(`div`,{className:`overflow-hidden`,children:[(0,M.jsx)(`div`,{className:`font-headline-md text-sm font-bold text-ink-black truncate`,children:n}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1 text-red-700 mt-1 select-none font-bold`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-sm`,style:{fontVariationSettings:`'FILL' 1`},children:`local_fire_department`}),(0,M.jsxs)(`span`,{className:`font-arcade text-[7px]`,children:[r?.current_streak??0,` DAY STREAK`]})]})]})]}),(0,M.jsxs)(`button`,{onClick:()=>i(`queue`),className:`bg-grass-green text-ink-black border-[3px] border-ink-black p-4 flex flex-col justify-between aspect-square gadget-shadow active:translate-y-1 active:translate-x-1 active:shadow-none select-none text-left cursor-pointer transition-all`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-3xl align-top`,style:{fontVariationSettings:`'FILL' 1`},children:`view_list`}),(0,M.jsxs)(`span`,{className:`font-arcade text-[8px] font-bold tracking-tight uppercase leading-tight`,children:[`DAILY`,(0,M.jsx)(`br`,{}),`QUEUE`]})]}),(0,M.jsxs)(`button`,{onClick:()=>i(`journey`),className:`bg-[#0ea5e9] text-ink-black border-[3px] border-ink-black p-4 flex flex-col justify-between aspect-square gadget-shadow active:translate-y-1 active:translate-x-1 active:shadow-none select-none text-left cursor-pointer transition-all`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-3xl align-top`,style:{fontVariationSettings:`'FILL' 1`},children:`route`}),(0,M.jsxs)(`span`,{className:`font-arcade text-[8px] font-bold tracking-tight uppercase leading-tight`,children:[`JOURNEY`,(0,M.jsx)(`br`,{}),`PATH`]})]}),(0,M.jsxs)(`button`,{onClick:()=>i(`computer`),className:`bg-paper-white text-ink-black border-[3px] border-ink-black p-4 flex flex-col justify-between aspect-square gadget-shadow active:translate-y-1 active:translate-x-1 active:shadow-none select-none text-left cursor-pointer transition-all`,children:[(0,M.jsx)(`img`,{alt:`My Computer`,width:40,height:40,className:`w-10 h-10 object-cover border-2 border-ink-black bg-white`,src:`/icons/computer.webp`}),(0,M.jsx)(`span`,{className:`font-arcade text-[8px] font-bold tracking-tight uppercase leading-tight`,children:`MY COMP`})]}),(0,M.jsxs)(`button`,{onClick:()=>i(`terminal`),className:`bg-[#1e293b] text-[#39ff14] border-[3px] border-ink-black p-4 flex flex-col justify-between aspect-square gadget-shadow active:translate-y-1 active:translate-x-1 active:shadow-none select-none text-left cursor-pointer transition-all`,children:[(0,M.jsx)(`img`,{alt:`Terminal`,width:40,height:40,className:`w-10 h-10 object-cover border-2 border-ink-black bg-white`,src:`/icons/terminal.webp`}),(0,M.jsx)(`span`,{className:`font-arcade text-[8px] text-[#39ff14] font-bold tracking-tight uppercase leading-tight`,children:`TERMINAL`})]}),(0,M.jsxs)(`button`,{onClick:()=>i(`python`),className:`bg-[#9d4edd] text-white border-[3px] border-ink-black p-4 flex flex-col justify-between aspect-square gadget-shadow active:translate-y-1 active:translate-x-1 active:shadow-none select-none text-left cursor-pointer transition-all`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-3xl align-top`,style:{fontVariationSettings:`'FILL' 1`},children:`sports_esports`}),(0,M.jsxs)(`span`,{className:`font-arcade text-[8px] font-bold tracking-tight uppercase leading-tight`,children:[`PYTHON`,(0,M.jsx)(`br`,{}),`PLAY`]})]}),(0,M.jsxs)(`button`,{onClick:()=>i(`mysql`),className:`bg-[#ffcc00] text-ink-black border-[3px] border-ink-black p-4 flex flex-col justify-between aspect-square gadget-shadow active:translate-y-1 active:translate-x-1 active:shadow-none select-none text-left cursor-pointer transition-all`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-3xl align-top`,style:{fontVariationSettings:`'FILL' 1`},children:`database`}),(0,M.jsxs)(`span`,{className:`font-arcade text-[8px] font-bold tracking-tight uppercase leading-tight`,children:[`MYSQL`,(0,M.jsx)(`br`,{}),`PLAY`]})]}),(0,M.jsxs)(`button`,{onClick:()=>i(`companion`),className:`bg-[#f59e0b] hover:bg-amber-600 text-ink-black border-[3px] border-ink-black p-4 flex flex-col justify-between aspect-square gadget-shadow active:translate-y-1 active:translate-x-1 active:shadow-none select-none text-left cursor-pointer transition-all`,children:[(0,M.jsx)(`img`,{alt:`Auri`,width:40,height:40,className:`w-10 h-10 object-cover object-top border-2 border-ink-black bg-amber-100 rounded`,src:`/sprites/princess/smiling_warmly.webp`}),(0,M.jsx)(`span`,{className:`font-arcade text-[8px] font-bold tracking-tight uppercase leading-tight`,children:`AURI`})]}),(0,M.jsxs)(`button`,{onClick:()=>i(`settings`),className:`bg-[#059669] hover:bg-emerald-700 text-white border-[3px] border-ink-black p-4 flex flex-col justify-between aspect-square gadget-shadow active:translate-y-1 active:translate-x-1 active:shadow-none select-none text-left cursor-pointer transition-all`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-3xl align-top`,style:{fontVariationSettings:`'FILL' 1`},children:`key`}),(0,M.jsx)(`span`,{className:`font-arcade text-[8px] font-bold tracking-tight uppercase leading-tight`,children:`API CONFIG`})]}),(0,M.jsxs)(`button`,{onClick:a,className:`col-span-2 bg-[#ffe24c] hover:bg-yellow-300 text-ink-black border-[3px] border-ink-black p-4 flex items-center justify-between gadget-shadow active:translate-y-1 active:translate-x-1 active:shadow-none select-none text-left cursor-pointer transition-all`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-3xl`,style:{fontVariationSettings:`'FILL' 1`},children:`cloud_sync`}),(0,M.jsx)(`span`,{className:`font-arcade text-[8px] font-bold tracking-tight uppercase`,children:`DRIVE NOTES SYNC`})]}),(0,M.jsx)(`span`,{className:`material-symbols-outlined text-lg`,children:`chevron_right`})]})]})]}),St=class extends A.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[WindowErrorBoundary] Error caught in window "${this.props.windowId}":`,e,t)}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?(0,M.jsx)(`div`,{className:`w-full h-full p-6 bg-[#0f172a] text-white flex flex-col items-center justify-center font-sans select-none overflow-auto`,children:(0,M.jsxs)(`div`,{className:`max-w-md w-full bg-[#1e293b] border-[3px] border-rose-500 rounded-lg p-5 shadow-[6px_6px_0px_0px_rgba(0,0,0,0.5)] flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-rose-400 font-headline-md font-bold text-sm border-b border-slate-700 pb-2.5`,children:[(0,M.jsx)(w,{className:`w-5 h-5 shrink-0`}),(0,M.jsxs)(`span`,{children:[`SYSTEM INTERRUPT: `,this.props.windowTitle||this.props.windowId]})]}),(0,M.jsx)(`div`,{className:`bg-[#0b0f19] border border-slate-800 rounded p-3 font-mono text-[11px] text-rose-300 leading-relaxed max-h-32 overflow-y-auto custom-scrollbar`,children:this.state.error?.message||`An unexpected runtime error occurred.`}),(0,M.jsx)(`p`,{className:`text-[11px] text-slate-400 leading-relaxed`,children:`The window process encountered a recoverable fault. You can restart this window module without losing your desktop session.`}),(0,M.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-2 border-t border-slate-700`,children:[this.props.onClose&&(0,M.jsxs)(`button`,{type:`button`,onClick:this.props.onClose,className:`px-3 py-1.5 bg-slate-700 hover:bg-slate-600 text-white rounded text-xs font-bold transition-all flex items-center gap-1.5 cursor-pointer`,children:[(0,M.jsx)(S,{className:`w-3.5 h-3.5`}),(0,M.jsx)(`span`,{children:`Close Window`})]}),(0,M.jsxs)(`button`,{type:`button`,onClick:this.handleReset,className:`px-3 py-1.5 bg-rose-600 hover:bg-rose-500 text-white rounded text-xs font-bold transition-all shadow-[2px_2px_0px_0px_#000] active:translate-y-0.5 active:shadow-none flex items-center gap-1.5 cursor-pointer`,children:[(0,M.jsx)(n,{className:`w-3.5 h-3.5`}),(0,M.jsx)(`span`,{children:`Restart Module`})]})]})]})}):this.props.children}},Ct=e=>{if(!e||!e.startsWith(`#`))return!1;if(e.toLowerCase()===`#0ea5e9`)return!0;let t=e.replace(`#`,``);if(t.length===3){let e=parseInt(t[0]+t[0],16),n=parseInt(t[1]+t[1],16),r=parseInt(t[2]+t[2],16);return .299*e+.587*n+.114*r>135}if(t.length===6){let e=parseInt(t.slice(0,2),16),n=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16);return .299*e+.587*n+.114*r>135}return!1};function Q({id:e,title:t,isOpen:n,isMinimized:r,onClose:i,onMinimize:a,activeWindow:o,setActiveWindow:s,children:c,icon:l=`terminal`,defaultWidth:u=`700px`,defaultHeight:d=`600px`,minWidth:f=380,minHeight:p=280,defaultX:m,defaultY:h,titleBarColor:g=`#0ea5e9`,isMobile:_=!1}){let v=e=>{let t=parseInt(e,10);return isNaN(t)?500:t},y=X(t=>t.windowZIndexes[e]),b=X(e=>e.activeWindow),S=X(e=>e.closeWindow),C=X(e=>e.minimizeWindow),w=X(e=>e.focusWindow),T=X(t=>!!t.maximizedWindows[e]),E=(o??b)===e,D=y??(E?40:30),O=!_&&T,k=i??(()=>S(e)),j=a??(()=>C(e)),N=(0,A.useCallback)(()=>{s?s(e):w(e)},[e,s,w]),P=(0,A.useCallback)(t=>{t?.stopPropagation(),X.getState().toggleMaximize(e)},[e]),[F,I]=(0,A.useState)(()=>X.getState().windowPositions[e]||(m===void 0&&h===void 0?{x:Math.floor(Math.random()*40)-20,y:Math.floor(Math.random()*40)-20}:{x:m??0,y:h??0})),[L,R]=(0,A.useState)(()=>X.getState().windowSizes[e]||{width:v(u),height:v(d)}),[z,B]=(0,A.useState)(!1),[V,ee]=(0,A.useState)(!1),H=(0,A.useRef)(F),U=(0,A.useRef)(L),W=(0,A.useRef)(null);(0,A.useEffect)(()=>{H.current=F},[F]),(0,A.useEffect)(()=>{U.current=L},[L]);let G=(0,A.useCallback)((e,t,n,r)=>{if(typeof window>`u`)return{x:e,y:t};let i=window.innerWidth/2,a=window.innerHeight/2,o=n/2,s=r/2,c=-a+s,l=Math.max(c,a+s-80),u=-i-o+80,d=i+o-80;return{x:Math.min(Math.max(e,u),d),y:Math.min(Math.max(t,c),l)}},[]),K=x(({offset:[t,n],first:r,last:i,event:a,cancel:o})=>{let s=a.target;if(s?.closest(`.window-control-btn`)||s?.closest(`.window-resize-handle`)){o();return}r&&(N(),B(!0));let c=G(t,n,U.current.width,U.current.height);H.current=c,W.current&&(W.current.style.transform=`translate3d(calc(-50% + ${c.x}px), calc(-50% + ${c.y}px), 0)`),i&&(B(!1),I(c),X.getState().updateWindowPosition(e,c.x,c.y))},{from:()=>[H.current.x,H.current.y],pointer:{capture:!0},enabled:!_&&!O,eventOptions:{passive:!1}}),te=x(({offset:[t,n],first:r,last:i,event:a})=>{a.stopPropagation(),r&&(N(),ee(!0));let o=Math.max(f,t),s=Math.max(p,n);U.current={width:o,height:s},W.current&&(W.current.style.width=`${o}px`,W.current.style.height=`${s}px`),i&&(ee(!1),R(U.current),X.getState().updateWindowSize(e,U.current.width,U.current.height))},{from:()=>[U.current.width,U.current.height],pointer:{capture:!0},enabled:!_&&!O,eventOptions:{passive:!1}});return n?(0,M.jsxs)(`div`,{ref:W,onMouseDown:N,style:_?{zIndex:D,display:r?`none`:`flex`}:O?{width:`100vw`,height:`calc(100vh - 56px)`,top:0,left:0,transform:`none`,zIndex:D,display:r?`none`:`flex`}:{width:`${L.width}px`,height:`${L.height}px`,transform:`translate3d(calc(-50% + ${F.x}px), calc(-50% + ${F.y}px), 0)`,zIndex:D,display:r?`none`:`flex`,willChange:z||V?`transform, width, height`:`auto`},className:`absolute bg-paper-white border-[4px] flex flex-col overflow-hidden window-shadow ${z||V?`transition-none`:`transition-all duration-150`} ${_?`top-0 left-0 w-full h-[calc(100vh-56px)] max-w-none max-h-none border-t-0 border-x-0`:O?`top-0 left-0 max-w-none max-h-none border-ink-black`:`top-1/2 left-1/2 max-w-[98vw] max-h-[90vh] border-ink-black`} ${E?`border-ink-black shadow-[8px_8px_0px_0px_rgba(30,41,59,1)]`:`border-ink-black opacity-95 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)]`}`,children:[(0,M.jsxs)(`div`,{...K(),onDoubleClick:_?void 0:P,style:{backgroundColor:g},className:`border-b-[4px] border-ink-black px-4 py-2 flex justify-between items-center ${Ct(g)?`text-ink-black`:`text-white`} shrink-0 select-none touch-none ${_||O?`cursor-default`:z?`cursor-grabbing`:`cursor-grab`}`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 pointer-events-none`,children:[l&&(0,M.jsx)(`span`,{className:`material-symbols-outlined select-none`,style:{fontVariationSettings:`'FILL' 1`},children:l}),(0,M.jsx)(`span`,{className:`font-window-title text-sm md:text-base font-bold tracking-wide select-none`,children:t})]}),(0,M.jsxs)(`div`,{className:`flex gap-1.5`,onPointerDown:e=>e.stopPropagation(),children:[!_&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{onClick:e=>{e.stopPropagation(),j()},className:`window-control-btn w-7 h-7 bg-white text-ink-black border-[3px] border-ink-black flex items-center justify-center hover:bg-yellow-300 active:translate-y-0.5 active:translate-x-0.5 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:shadow-none transition-all cursor-pointer`,title:`Minimize`,"aria-label":`Minimize`,children:(0,M.jsx)(`span`,{className:`material-symbols-outlined text-[14px] font-bold`,children:`minimize`})}),(0,M.jsx)(`button`,{onClick:e=>{e.stopPropagation(),P(e)},className:`window-control-btn w-7 h-7 bg-white text-ink-black border-[3px] border-ink-black flex items-center justify-center hover:bg-yellow-300 active:translate-y-0.5 active:translate-x-0.5 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:shadow-none transition-all cursor-pointer`,title:O?`Restore`:`Maximize`,"aria-label":O?`Restore`:`Maximize`,children:(0,M.jsx)(`span`,{className:`material-symbols-outlined text-[14px] font-bold`,children:O?`filter_none`:`crop_square`})})]}),(0,M.jsx)(`button`,{onClick:e=>{e.stopPropagation(),k()},className:`window-control-btn w-7 h-7 bg-rose-600 text-white border-[3px] border-ink-black flex items-center justify-center hover:bg-rose-700 active:translate-y-0.5 active:translate-x-0.5 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:shadow-none transition-all cursor-pointer`,title:`Close`,"aria-label":`Close`,children:(0,M.jsx)(`span`,{className:`material-symbols-outlined text-[14px] font-bold`,children:`close`})})]})]}),(0,M.jsx)(`div`,{className:`flex-1 overflow-hidden relative bg-paper-white flex flex-col ${z||V?`pointer-events-none select-none`:``}`,children:(0,M.jsx)(St,{windowId:e,windowTitle:t,onClose:k,children:c})}),!_&&!O&&(0,M.jsx)(`div`,{...te(),className:`window-resize-handle absolute bottom-0 right-0 w-5 h-5 cursor-se-resize flex items-end justify-end p-0.5 select-none z-[50] touch-none`,title:`Resize Window`,children:(0,M.jsxs)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,className:`text-ink-black opacity-60`,children:[(0,M.jsx)(`line`,{x1:`8`,y1:`2`,x2:`2`,y2:`8`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,M.jsx)(`line`,{x1:`8`,y1:`5`,x2:`5`,y2:`8`,stroke:`currentColor`,strokeWidth:`1.5`})]})})]}):null}var wt=`modulepreload`,Tt=function(e){return`/`+e},Et={},$=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Tt(t,n),t=s(t),t in Et)return;Et[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:wt,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Dt=(0,A.lazy)(()=>$(()=>import(`./ReviewQueue-DRECcJtJ.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]))),Ot=(0,A.lazy)(()=>$(()=>import(`./JourneyPath-C_DuHGaN.js`),__vite__mapDeps([11,1,2,3,4,5,7]))),kt=(0,A.lazy)(()=>$(()=>import(`./TerminalEmulator-UawIgOps.js`),__vite__mapDeps([12,1,2,3,4,5]))),At=(0,A.lazy)(()=>$(()=>import(`./PythonChallenge-Bh_sBh6Y.js`),__vite__mapDeps([13,1,2,3,4,5,9]))),jt=(0,A.lazy)(()=>$(()=>import(`./MySQLPlayground-qSCaW6n7.js`),__vite__mapDeps([14,1,2,3,4,5]))),Mt=(0,A.lazy)(()=>$(()=>import(`./FileExplorer-cjfRJjsw.js`),__vite__mapDeps([15,1,2,3,4,5]))),Nt=(0,A.lazy)(()=>$(()=>import(`./Settings-BFJ9GDP5.js`),__vite__mapDeps([16,1,2,3,6,4,5]))),Pt=(0,A.lazy)(()=>$(()=>import(`./CreateProblemForm-BBCKyUaK.js`),__vite__mapDeps([17,1,2,3,4,5]))),Ft=(0,A.lazy)(()=>$(()=>import(`./PrincessChamber-BkGsNxLj.js`).then(e=>e.t),__vite__mapDeps([10,1,2,3]))),It=(0,A.lazy)(()=>$(()=>import(`./GitHubSyncWindow-6b8RBof4.js`),__vite__mapDeps([18,1,2,3,6,4,5]))),Lt=({windows:e,activeWindow:t,setActiveWindow:n,isMobile:r,openWindow:i,closeWindow:a,minimizeWindow:o,overrideProblemId:s,setOverrideProblemId:c,editingProblem:l,openEditProblem:u,handleSelectProblemForReview:d,refreshExplorerTrigger:f,triggerRefreshExplorer:p,setIsOnboardingOpen:m,wallpaperUrl:h,setWallpaperUrl:g,syncing:_,syncResult:v,triggerSync:y})=>{let b=X(e=>e.windows),x=X(e=>e.activeWindow),S=X(e=>e.setActiveWindow),C=X(e=>e.openWindow),w=X(e=>e.closeWindow),T=X(e=>e.minimizeWindow),E=X(e=>e.overrideProblemId),D=X(e=>e.setOverrideProblemId),O=X(e=>e.editingProblem),k=X(e=>e.openEditProblem),j=X(e=>e.handleSelectProblemForReview),N=X(e=>e.refreshExplorerTrigger),P=X(e=>e.triggerRefreshExplorer),F=e??b,I=t??x,L=n??S,R=i??C,z=a??w,B=o??T,V=s===void 0?E:s,ee=c??D,H=l===void 0?O:l,U=u??k,W=d??j,G=f??N,K=p??P,te=(0,A.useCallback)(()=>ee(null),[ee]),ne=(0,A.useCallback)(()=>R(`journey`),[R]),re=(0,A.useCallback)(()=>R(`createProblem`),[R]),ie=(0,A.useCallback)(()=>m(!0),[m]);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Q,{id:`queue`,title:`Daily Queue.exe`,icon:`terminal`,isOpen:F.queue.isOpen,isMinimized:F.queue.isMinimized,onClose:()=>z(`queue`),onMinimize:()=>B(`queue`),activeWindow:I,setActiveWindow:L,defaultWidth:`980px`,defaultHeight:`680px`,minWidth:440,minHeight:360,isMobile:r,children:(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`p-6 font-arcade text-xs text-trash-gray uppercase animate-pulse`,children:`Loading ReviewQueue.exe...`}),children:(0,M.jsx)(Dt,{overrideProblemId:V,onClearOverride:te,onOpenWindow:R,onOpenJourney:ne,onOpenCreateProblem:re,onOpenEditProblem:U,onOpenOnboarding:ie,refreshTrigger:G})})}),(0,M.jsx)(Q,{id:`journey`,title:`Journey_Path.exe`,icon:`route`,isOpen:F.journey.isOpen,isMinimized:F.journey.isMinimized,onClose:()=>z(`journey`),onMinimize:()=>B(`journey`),activeWindow:I,setActiveWindow:L,defaultWidth:`980px`,defaultHeight:`680px`,isMobile:r,children:(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`p-6 font-arcade text-xs text-trash-gray uppercase animate-pulse`,children:`Loading JourneyPath.exe...`}),children:(0,M.jsx)(Ot,{onSelectProblemForReview:W})})}),(0,M.jsx)(Q,{id:`terminal`,title:`Arcade Terminal.com`,icon:`terminal`,isOpen:F.terminal.isOpen,isMinimized:F.terminal.isMinimized,onClose:()=>z(`terminal`),onMinimize:()=>B(`terminal`),activeWindow:I,setActiveWindow:L,defaultWidth:`640px`,defaultHeight:`450px`,titleBarColor:`#1e293b`,isMobile:r,children:(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`p-6 font-arcade text-xs text-trash-gray uppercase animate-pulse`,children:`Loading Terminal.exe...`}),children:(0,M.jsx)(kt,{onOpenWindow:R,onClose:()=>z(`terminal`)})})}),(0,M.jsx)(Q,{id:`sync`,title:`Drive_Sync.sys`,icon:`cloud_sync`,isOpen:F.sync.isOpen,isMinimized:F.sync.isMinimized,onClose:()=>z(`sync`),onMinimize:()=>B(`sync`),activeWindow:I,setActiveWindow:L,defaultWidth:`480px`,defaultHeight:`320px`,titleBarColor:`#855400`,isMobile:r,children:(0,M.jsxs)(`div`,{className:`w-full h-full bg-[#fdf8e1] p-6 flex flex-col justify-between`,children:[(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3 border-b-2 border-dashed border-ink-black pb-3`,children:[(0,M.jsx)(`span`,{className:`material-symbols-outlined text-4xl text-[#855400] animate-bounce`,children:`cloud_sync`}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h4`,{className:`font-arcade text-[10px] font-bold text-ink-black`,children:`DRIVE NOTES SYNCHRONIZATION`}),(0,M.jsx)(`span`,{className:`text-[8px] font-arcade text-trash-gray font-bold uppercase mt-1 block`,children:`Importing LeetCode sheets`})]})]}),_?(0,M.jsxs)(`div`,{className:`space-y-3 py-2`,children:[(0,M.jsx)(`span`,{className:`text-[9px] font-arcade text-ink-black font-bold block animate-pulse`,children:`SYNC PROCESS RUNNING...`}),(0,M.jsx)(`div`,{className:`w-full h-6 bg-white border-[3px] border-ink-black relative overflow-hidden select-none`,children:(0,M.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-[#ffe24c] border-r-2 border-ink-black w-[75%] animate-pulse`})}),(0,M.jsx)(`p`,{className:`text-[9px] font-sans text-trash-gray leading-normal font-semibold`,children:`Connecting to Supabase partition, requesting Google Drive manifest, indexing note items...`})]}):(0,M.jsx)(`div`,{className:`p-3 bg-white border-[3px] border-ink-black text-xs font-semibold text-ink-black leading-relaxed shadow-[2px_2px_0px_0px_#1E293B]`,children:v||`Idle. Ready to synchronize Leitner box data logs from Sheets drive storage.`})]}),(0,M.jsxs)(`div`,{className:`flex gap-3 justify-end pt-4 border-t border-slate-200`,children:[(0,M.jsx)(`button`,{onClick:()=>z(`sync`),className:`px-4 py-2 bg-white hover:bg-slate-100 text-ink-black border-[3px] border-ink-black font-bold text-xs shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer`,children:`CLOSE`}),(0,M.jsx)(`button`,{onClick:y,disabled:_,className:`px-4 py-2 bg-[#ffcc00] hover:bg-yellow-300 text-ink-black border-[3px] border-ink-black font-bold text-xs shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none disabled:opacity-50 cursor-pointer`,children:_?`SYNCING...`:`SYNC NOW`})]})]})}),(0,M.jsx)(Q,{id:`github`,title:`GitHub_Sync.exe`,icon:`terminal`,isOpen:F.github?.isOpen??!1,isMinimized:F.github?.isMinimized??!1,onClose:()=>z(`github`),onMinimize:()=>B(`github`),activeWindow:I,setActiveWindow:L,defaultWidth:`620px`,defaultHeight:`520px`,titleBarColor:`#24292e`,isMobile:r,children:(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`p-6 font-arcade text-xs text-trash-gray uppercase animate-pulse`,children:`Loading GitHub_Sync.exe...`}),children:(0,M.jsx)(It,{onClose:()=>z(`github`)})})}),(0,M.jsx)(Q,{id:`computer`,title:`File Explorer`,icon:`desktop_windows`,isOpen:F.computer.isOpen,isMinimized:F.computer.isMinimized,onClose:()=>z(`computer`),onMinimize:()=>B(`computer`),activeWindow:I,setActiveWindow:L,defaultWidth:`640px`,defaultHeight:`480px`,titleBarColor:`#006686`,isMobile:r,children:(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`p-6 font-arcade text-xs text-trash-gray uppercase animate-pulse`,children:`Loading FileExplorer.exe...`}),children:(0,M.jsx)(Mt,{onSetWallpaper:g,activeWallpaperUrl:h,onOpenCreateProblem:()=>R(`createProblem`),onOpenQueue:()=>R(`queue`),onOpenJourney:()=>R(`journey`),refreshTrigger:G})})}),F.createProblem?.isOpen&&(0,M.jsx)(Q,{id:`createProblem`,title:`Create Problem`,icon:`note_add`,isOpen:F.createProblem.isOpen,isMinimized:F.createProblem.isMinimized,onClose:()=>z(`createProblem`),onMinimize:()=>B(`createProblem`),activeWindow:I,setActiveWindow:L,defaultWidth:`640px`,defaultHeight:`700px`,titleBarColor:`#a855f7`,isMobile:r,children:(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`p-6 font-arcade text-xs text-trash-gray uppercase animate-pulse`,children:`Loading CreateForm.exe...`}),children:(0,M.jsx)(Pt,{onClose:()=>z(`createProblem`),onSuccess:()=>{K(),R(`queue`)}})})}),F.editProblem?.isOpen&&(0,M.jsx)(Q,{id:`editProblem`,title:H?`Edit Problem: #${H.problem_number??`—`} ${H.name}`:`Edit Problem`,icon:`edit_note`,isOpen:F.editProblem.isOpen,isMinimized:F.editProblem.isMinimized,onClose:()=>z(`editProblem`),onMinimize:()=>B(`editProblem`),activeWindow:I,setActiveWindow:L,defaultWidth:`760px`,defaultHeight:`720px`,defaultX:30,defaultY:25,titleBarColor:`#059669`,isMobile:r,children:(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`p-6 font-arcade text-xs text-trash-gray uppercase animate-pulse`,children:`Loading EditProblem.exe...`}),children:(0,M.jsx)(Pt,{mode:`edit`,initialProblem:H,onClose:()=>z(`editProblem`),onSuccess:()=>{z(`editProblem`),K(),R(`queue`)}},H?.id||(H?.problem_number===void 0?`edit-problem`:String(H.problem_number)))})}),(0,M.jsx)(Q,{id:`python`,title:`Python Challenge`,icon:`sports_esports`,isOpen:F.python.isOpen,isMinimized:F.python.isMinimized,onClose:()=>z(`python`),onMinimize:()=>B(`python`),activeWindow:I,setActiveWindow:L,defaultWidth:`620px`,defaultHeight:`580px`,titleBarColor:`#9d4edd`,isMobile:r,children:(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`p-6 font-arcade text-xs text-trash-gray uppercase animate-pulse`,children:`Loading PythonChallenge.exe...`}),children:(0,M.jsx)(At,{})})}),(0,M.jsx)(Q,{id:`mysql`,title:`MySQL Playground`,icon:`database`,isOpen:F.mysql.isOpen,isMinimized:F.mysql.isMinimized,onClose:()=>z(`mysql`),onMinimize:()=>B(`mysql`),activeWindow:I,setActiveWindow:L,defaultWidth:`660px`,defaultHeight:`580px`,titleBarColor:`#0ea5e9`,isMobile:r,children:(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`p-6 font-arcade text-xs text-trash-gray uppercase animate-pulse`,children:`Loading MySQLPlayground.exe...`}),children:(0,M.jsx)(jt,{})})}),(0,M.jsx)(Q,{id:`settings`,title:`API Configuration`,icon:`key`,isOpen:F.settings?.isOpen,isMinimized:F.settings?.isMinimized,onClose:()=>z(`settings`),onMinimize:()=>B(`settings`),activeWindow:I,setActiveWindow:L,defaultWidth:`520px`,defaultHeight:`460px`,titleBarColor:`#10b981`,isMobile:r,children:(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`p-6 font-arcade text-xs text-trash-gray uppercase animate-pulse`,children:`Loading APIConfig.exe...`}),children:(0,M.jsx)(Nt,{})})}),F.companion?.isOpen&&!F.companion.isMinimized&&(0,M.jsx)(A.Suspense,{fallback:(0,M.jsx)(`div`,{className:`fixed bottom-16 right-8 font-mono text-xs text-amber-300 bg-slate-900/90 p-4 border-2 border-slate-700 rounded z-40 animate-pulse`,children:`Entering the Spire Tower Parlor...`}),children:(0,M.jsx)(Ft,{onClose:()=>z(`companion`),onMinimize:()=>B(`companion`),isActive:I===`companion`,onFocus:()=>L(`companion`),isMobile:r})})]})},Rt=(0,A.lazy)(()=>$(()=>import(`./Auth-D-vQqxx2.js`),__vite__mapDeps([19,1,2,3,4,5]))),zt=(0,A.lazy)(()=>$(()=>import(`./OnboardingModal-D_uUP3Nd.js`),__vite__mapDeps([8,1,2,3])));function Bt(){let[e,t]=(0,A.useState)(null),[n,r]=(0,A.useState)(!0),[i,a]=(0,A.useState)(!1),[o,s]=(0,A.useState)(!1),c=(0,A.useRef)(null),[l,u]=(0,A.useState)({visible:!1,x:0,y:0}),{openWindow:d,toggleWindowMinimize:f,triggerRefreshExplorer:p,isAnyWindowOpen:m}=We((0,A.useCallback)(()=>s(!1),[])),{time:h,streak:g,isMobile:_,isFullscreen:v,toggleFullscreen:y,syncing:b,syncResult:x,triggerSync:S}=Ge(e,()=>d(`sync`)),{wallpaperUrl:C,setWallpaperUrl:w,handleWallpaperChange:T}=qe(),{companionDialogueEvent:E,setCompanionDialogueEvent:D}=Je(e,d);(0,A.useEffect)(()=>{O.auth.getSession().then(({data:{session:e}})=>{t(e?.user??null),r(!1)});let{data:{subscription:e}}=O.auth.onAuthStateChange((e,n)=>{t(n?.user??null),r(!1)});return()=>{e.unsubscribe()}},[]),(0,A.useEffect)(()=>{if(!n){let e=document.getElementById(`app-loader`);e&&e.remove()}},[n]),(0,A.useEffect)(()=>{if(!n&&e){let t=e.id,n=t===`sandbox-user-id`||!t?`sandbox`:t;if(!localStorage.getItem(`algospaced_onboarding_done_${n}`)){let e=setTimeout(()=>{a(!0)},0);return()=>clearTimeout(e)}}},[n,e]);let k=e=>{let t=e.target;t.closest(`.window-shadow`)||t.closest(`button`)||t.closest(`input`)||t.closest(`textarea`)||t.closest(`details`)||t.closest(`#start-menu`)||(e.preventDefault(),u({visible:!0,x:e.clientX,y:e.clientY}))},j=()=>{l.visible&&u(e=>({...e,visible:!1}))},N=()=>{j(),y()},P=async()=>{s(!1),await O.auth.signOut()},F=e?.email?e.email.split(`@`)[0]:`Player_One`,I=(0,A.useMemo)(()=>[{id:`queue`,label:(0,M.jsxs)(M.Fragment,{children:[`DAILY`,(0,M.jsx)(`br`,{}),`QUEUE`]}),icon:`view_list`,badgeShadowColor:`#fde047`,action:()=>d(`queue`)},{id:`journey`,label:(0,M.jsxs)(M.Fragment,{children:[`JOURNEY`,(0,M.jsx)(`br`,{}),`PATH`]}),icon:`route`,badgeShadowColor:`#fde047`,action:()=>d(`journey`)},{id:`sync`,label:(0,M.jsxs)(M.Fragment,{children:[`DRIVE`,(0,M.jsx)(`br`,{}),`SYNC`]}),icon:`cloud_sync`,badgeShadowColor:`#fde047`,action:S},{id:`github`,label:(0,M.jsxs)(M.Fragment,{children:[`GITHUB`,(0,M.jsx)(`br`,{}),`SYNC`]}),icon:`code`,badgeShadowColor:`#24292e`,action:()=>d(`github`)},{id:`computer`,label:(0,M.jsxs)(M.Fragment,{children:[`MY`,(0,M.jsx)(`br`,{}),`COMP`]}),iconImg:`/icons/computer.webp`,badgeShadowColor:`#fde047`,action:()=>d(`computer`)},{id:`terminal`,label:`TERMINAL`,iconImg:`/icons/terminal.webp`,badgeShadowColor:`#fde047`,action:()=>d(`terminal`)},{id:`python`,label:(0,M.jsxs)(M.Fragment,{children:[`PYTHON`,(0,M.jsx)(`br`,{}),`CHALLENGE`]}),icon:`sports_esports`,badgeShadowColor:`#4cc9f0`,action:()=>d(`python`)},{id:`mysql`,label:(0,M.jsxs)(M.Fragment,{children:[`MYSQL`,(0,M.jsx)(`br`,{}),`PLAYGROUND`]}),icon:`database`,badgeShadowColor:`#f72585`,action:()=>d(`mysql`)},{id:`companion`,label:`Auri`,iconImg:`/sprites/princess/smiling_warmly.webp`,badgeShadowColor:`#fde047`,action:()=>d(`companion`)},{id:`settings`,label:(0,M.jsx)(M.Fragment,{children:`API CONFIG`}),icon:`key`,badgeShadowColor:`#10b981`,action:()=>d(`settings`)}],[d,S]);return n?null:e?(0,M.jsxs)(`main`,{role:`main`,"aria-label":`Desktop Workspace`,onContextMenu:k,onClick:j,className:`w-screen h-screen m-0 p-0 relative isolate font-sans text-ink-black overflow-hidden select-none`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 w-full h-full bg-cover bg-center z-0 pointer-events-none saturate-150 contrast-125 transition-all duration-300`,style:{backgroundImage:`url('${C}')`}}),!_&&(0,M.jsx)(ee,{ref:c,icons:I,isMobile:_,onContextMenu:k}),(0,M.jsx)(Ye,{isMobile:_,username:F,streak:g}),(0,M.jsx)(xt,{isMobile:_,isAnyWindowOpen:m,username:F,streak:g,onToggleWindow:f,onTriggerSync:S}),(0,M.jsx)(Lt,{isMobile:_,setIsOnboardingOpen:a,wallpaperUrl:C,setWallpaperUrl:w,syncing:b,syncResult:x,triggerSync:S}),(0,M.jsx)(bt,{isStartOpen:o,onToggleStart:()=>s(e=>!e),onCloseStart:()=>s(!1),onOpenWindow:d,onOpenOnboarding:()=>{s(!1),a(!0)},onTriggerSync:S,onSignOut:P,isMobile:_,time:h}),(0,M.jsx)(Ue,{event:E,onClose:()=>D(null),onOpenCompanionWindow:()=>d(`companion`)}),(0,M.jsx)(Oe,{onOpenCompanionWindow:()=>d(`companion`)}),i&&(0,M.jsx)(A.Suspense,{fallback:null,children:(0,M.jsx)(zt,{isOpen:i,onClose:()=>a(!1),onCompleted:p,userId:e?.id||`sandbox`})}),(0,M.jsx)(H,{isOpen:l.visible,x:l.x,y:l.y,onClose:j,onAutoArrange:()=>c.current?.autoArrange(),onResetLayout:()=>c.current?.resetLayout(),onChangeWallpaper:()=>document.getElementById(`wallpaper-input`)?.click(),onOpenWindow:d,onTriggerSync:S,onToggleFullscreen:N,isFullscreen:v}),(0,M.jsx)(`input`,{type:`file`,id:`wallpaper-input`,"aria-label":`Upload custom desktop wallpaper`,accept:`image/*`,onChange:e=>T(e,j),className:`hidden`})]}):(0,M.jsx)(A.Suspense,{fallback:null,children:(0,M.jsx)(Rt,{})})}var Vt=class extends A.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[RootErrorBoundary] Fatal system error caught at OS root:`,e,t)}handleReboot=()=>{window.location.reload()};handleHardReset=()=>{try{localStorage.clear(),sessionStorage.clear()}catch{}window.location.reload()};render(){return this.state.hasError?(0,M.jsxs)(`div`,{className:`fixed inset-0 z-[99999] bg-[#030712] text-white flex flex-col items-center justify-center p-6 font-mono select-none overflow-auto`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 pointer-events-none bg-[radial-gradient(ellipse_at_center,transparent_0%,rgba(0,0,0,0.4)_100%)]`}),(0,M.jsxs)(`div`,{className:`relative max-w-xl w-full bg-[#0b0f19] border-[3px] border-rose-500 rounded-lg p-6 shadow-[8px_8px_0px_0px_rgba(244,63,94,0.3)] flex flex-col gap-5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3 text-rose-400 border-b border-rose-950 pb-3`,children:[(0,M.jsx)(`div`,{className:`p-2 bg-rose-500/10 rounded border border-rose-500/30`,children:(0,M.jsx)(u,{className:`w-6 h-6 text-rose-500 animate-pulse`})}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-sm font-bold tracking-wider uppercase text-rose-300 font-arcade`,children:`ALGOSPACED_RECOVERY_CONSOLE`}),(0,M.jsx)(`p`,{className:`text-[10px] text-rose-400/75 mt-0.5`,children:`STOP: 0x000000D1 • DESKTOP_THREAD_EXCEPTION`})]})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(`span`,{className:`text-[11px] text-slate-400 uppercase font-semibold tracking-wider block`,children:`Fault Trace:`}),(0,M.jsx)(`div`,{className:`bg-[#020617] border border-slate-800 rounded p-3 text-[11px] text-rose-300 font-mono leading-relaxed max-h-36 overflow-y-auto custom-scrollbar break-all`,children:this.state.error?.message||`A fatal system exception was trapped by the OS kernel.`})]}),(0,M.jsx)(`p`,{className:`text-xs text-slate-300 leading-relaxed`,children:`A recoverable exception occurred in the primary desktop shell. Your local data and progress records are safely preserved in storage.`}),(0,M.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-stretch sm:items-center justify-end gap-3 pt-3 border-t border-slate-800`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:this.handleHardReset,className:`px-4 py-2 bg-slate-800 hover:bg-slate-700 text-slate-300 rounded text-xs font-bold transition-all border border-slate-700 flex items-center justify-center gap-2 cursor-pointer`,title:`Clears cached session data and resets workspace state`,children:[(0,M.jsx)(g,{className:`w-3.5 h-3.5 text-slate-400`}),(0,M.jsx)(`span`,{children:`Reset Cache & Reboot`})]}),(0,M.jsxs)(`button`,{type:`button`,onClick:this.handleReboot,className:`px-4 py-2 bg-rose-600 hover:bg-rose-500 text-white rounded text-xs font-bold transition-all shadow-[2px_2px_0px_0px_#000] active:translate-y-0.5 active:shadow-none flex items-center justify-center gap-2 cursor-pointer`,children:[(0,M.jsx)(n,{className:`w-3.5 h-3.5`}),(0,M.jsx)(`span`,{children:`Reboot AlgoSpaced OS`})]})]})]})]}):this.props.children}},Ht=window.fetch;window.fetch=async(e,t)=>{let n=localStorage.getItem(`algospaced_custom_api_key`)||localStorage.getItem(`sandbox_gemini_api_key`),r=localStorage.getItem(`algospaced_custom_ai_provider`)||`default`;if(r&&r!=="default"&&n&&n.trim()){let i=typeof e==`string`?e:`url`in e?e.url:e.toString();if(i&&i.includes(`/api/`)){let i=t?{...t}:{},a=new Headers(i.headers||{});return a.set(`X-Custom-API-Key`,n.trim()),a.set(`X-Gemini-API-Key`,n.trim()),a.set(`X-AI-Provider`,r),i.headers=a,Ht(e,i)}}return Ht(e,t)};async function Ut(){try{let e=await fetch(`/api/config`);if(!e.ok)throw Error(`Failed to load runtime configuration`);let t=await e.json();D(t)}catch(e){console.warn(`Failed to load runtime config from API, falling back to build environment:`,e),D({apiKey:``,authDomain:`algospaced-dsa.firebaseapp.com`,projectId:`algospaced-dsa`,storageBucket:`algospaced-dsa.firebasestorage.app`,messagingSenderId:`1039270308844`,appId:`1:1039270308844:web:6499e8813a9f7926f7aec9`,measurementId:`G-K33PLR1N8E`})}(0,j.createRoot)(document.getElementById(`root`)).render((0,M.jsx)(A.StrictMode,{children:(0,M.jsx)(Vt,{children:(0,M.jsx)(Bt,{})})}))}Ut();export{W as C,G as S,Te as _,pt as a,Y as b,Qe as c,Fe as d,Le as f,we as g,Ae as h,ft as i,rt as l,Ie as m,ht as n,ct as o,ze as p,dt as r,mt as s,$ as t,et as u,Se as v,be as x,X as y}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/vendor-react-q-oOktF_.js b/algospaced-ui/dist/assets/vendor-react-q-oOktF_.js new file mode 100644 index 0000000000000000000000000000000000000000..5fd235640ff175e08aba2597253de0b692278051 --- /dev/null +++ b/algospaced-ui/dist/assets/vendor-react-q-oOktF_.js @@ -0,0 +1,9 @@ +import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{A as n,D as r,E as i,F as a,L as o,M as s,N as c,O as l,P as u,S as d,T as f,_ as p,a as m,b as h,c as g,d as _,f as v,g as y,h as b,i as x,j as S,k as C,l as w,m as T,n as E,o as ee,p as D,r as O,s as te,u as ne,v as re,w as k,y as A}from"./vendor-codemirror-By0wlJeM.js";var ie=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ee(e,t){return E(e.type,t,e.props)}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var te=/\/+/g;function ne(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function re(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function k(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,k(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ne(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(te,`$&/`)+`/`),k(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=ee(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(te,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=ie()})),oe=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,D());else{var t=n(l);t!==null&&ne(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-Tt&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ne(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?D():S=!1}}}var D;if(typeof y==`function`)D=function(){y(ee)};else if(typeof MessageChannel<`u`){var O=new MessageChannel,te=O.port2;O.port1.onmessage=ee,D=function(){te.postMessage(null)}}else D=function(){_(ee,0)};function ne(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ne(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,D()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),se=t(((e,t)=>{t.exports=oe()})),ce=t((e=>{var t=ae();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=ce()})),ue=t((e=>{var t=se(),n=ae(),r=le();function i(e){var t=`https://react.dev/errors/`+e;if(1ce||(e.current=oe[ce],oe[ce]=null,ce--)}function j(e,t){ce++,oe[ce]=e.current,e.current=t}var fe=ue(null),M=ue(null),pe=ue(null),me=ue(null);function he(e,t){switch(j(pe,t),j(M,e),j(fe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}de(fe),j(fe,e)}function N(){de(fe),de(M),de(pe)}function ge(e){e.memoizedState!==null&&j(me,e);var t=fe.current,n=Hd(t,e.type);t!==n&&(j(M,e),j(fe,n))}function P(e){M.current===e&&(de(fe),de(M)),me.current===e&&(de(me),Qf._currentValue=ie)}var _e,ve;function ye(e){if(_e===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_e=t&&t[1]||``,ve=-1)`:-1i||c[r]!==l[i]){var u=` +`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{be=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ye(n):``}function Se(e,t){switch(e.tag){case 26:case 27:case 5:return ye(e.type);case 16:return ye(`Lazy`);case 13:return e.child!==t&&t!==null?ye(`Suspense Fallback`):ye(`Suspense`);case 19:return ye(`SuspenseList`);case 0:case 15:return xe(e.type,!1);case 11:return xe(e.type.render,!1);case 1:return xe(e.type,!0);case 31:return ye(`Activity`);default:return``}}function Ce(e){try{var t=``,n=null;do t+=Se(e,n),n=e,e=e.return;while(e);return t}catch(e){return` +Error generating stack: `+e.message+` +`+e.stack}}var we=Object.prototype.hasOwnProperty,Te=t.unstable_scheduleCallback,Ee=t.unstable_cancelCallback,De=t.unstable_shouldYield,Oe=t.unstable_requestPaint,ke=t.unstable_now,Ae=t.unstable_getCurrentPriorityLevel,je=t.unstable_ImmediatePriority,Me=t.unstable_UserBlockingPriority,Ne=t.unstable_NormalPriority,Pe=t.unstable_LowPriority,Fe=t.unstable_IdlePriority,Ie=t.log,Le=t.unstable_setDisableYieldValue,Re=null,ze=null;function Be(e){if(typeof Ie==`function`&&Le(e),ze&&typeof ze.setStrictMode==`function`)try{ze.setStrictMode(Re,e)}catch{}}var Ve=Math.clz32?Math.clz32:We,He=Math.log,Ue=Math.LN2;function We(e){return e>>>=0,e===0?32:31-(He(e)/Ue|0)|0}var Ge=256,Ke=262144,qe=4194304;function Je(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ye(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Je(n))):i=Je(o):i=Je(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Je(n))):i=Je(o)):i=Je(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Xe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ze(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Qe(){var e=qe;return qe<<=1,!(qe&62914560)&&(qe=4194304),e}function $e(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function et(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function tt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),mn=!1;if(pn)try{var hn={};Object.defineProperty(hn,"passive",{get:function(){mn=!0}}),window.addEventListener(`test`,hn,hn),window.removeEventListener(`test`,hn,hn)}catch{mn=!1}var gn=null,_n=null,vn=null;function yn(){if(vn)return vn;var e,t=_n,n=t.length,r,i=`value`in gn?gn.value:gn.textContent,a=i.length;for(e=0;e=Zn),er=` `,tr=!1;function nr(e,t){switch(e){case`keyup`:return Yn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function rr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var ir=!1;function ar(e,t){switch(e){case`compositionend`:return rr(t);case`keypress`:return t.which===32?(tr=!0,er):null;case`textInput`:return e=t.data,e===er&&tr?null:e;default:return null}}function or(e,t){if(ir)return e===`compositionend`||!Xn&&nr(e,t)?(e=yn(),vn=_n=gn=null,ir=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Or(n)}}function Ar(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ar(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function jr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Bt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Bt(e.document)}return t}function Mr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Nr=pn&&`documentMode`in document&&11>=document.documentMode,Pr=null,Fr=null,Ir=null,Lr=!1;function Rr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Lr||Pr==null||Pr!==Bt(r)||(r=Pr,`selectionStart`in r&&Mr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ir&&Dr(Ir,r)||(Ir=r,r=Ed(Fr,`onSelect`),0>=o,i-=o,ki=1<<32-Ve(t)+i|n<m?(h=d,d=null):h=d.sibling;var g=p(i,d,s[m],c);if(g===null){d===null&&(d=h);break}e&&d&&g.alternate===null&&t(i,d),a=o(g,a,m),u===null?l=g:u.sibling=g,u=g,d=h}if(m===s.length)return n(i,d),L&&ji(i,m),l;if(d===null){for(;mh?(g=m,m=null):g=m.sibling;var y=p(a,m,v.value,l);if(y===null){m===null&&(m=g);break}e&&m&&y.alternate===null&&t(a,m),s=o(y,s,h),d===null?u=y:d.sibling=y,d=y,m=g}if(v.done)return n(a,m),L&&ji(a,h),u;if(m===null){for(;!v.done;h++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return L&&ji(a,h),u}for(m=r(m);!v.done;h++,v=c.next())v=_(m,a,h,v.value,l),v!==null&&(e&&v.alternate!==null&&m.delete(v.key===null?h:v.key),s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return e&&m.forEach(function(e){return t(a,e)}),L&&ji(a,h),u}function x(e,r,o,c){if(typeof o==`object`&&o&&o.type===g&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===g){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===T&&Aa(l)===r.type){n(e,r.sibling),c=a(r,o.props),La(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===g?(c=gi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=hi(o.type,o.key,o.props,null,e.mode,c),La(c,o),c.return=e,e=c)}return s(e);case h:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=yi(o,e.mode,c),c.return=e,e=c}return s(e);case T:return o=Aa(o),x(e,r,o,c)}if(re(o))return v(e,r,o,c);if(O(o)){if(l=O(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return x(e,r,Ia(o),c);if(o.$$typeof===b)return x(e,r,ia(e,o),c);Ra(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=_i(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Fa=0;var i=x(e,t,n,r);return Pa=null,i}catch(t){if(t===wa||t===Ea)throw t;var a=F(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ba=za(!0),Va=za(!1),R=!1;function Ha(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ua(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Wa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ga(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,G&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=li(e),ci(e,null,n),t}return ai(e,r,t,n),li(e)}function Ka(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,rt(e,n)}}function qa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ja=!1;function Ya(){if(Ja){var e=ha;if(e!==null)throw e}}function Xa(e,t,n,r){Ja=!1;var i=e.updateQueue;R=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(J&p)===p:(r&p)===p){p!==0&&p===ma&&(Ja=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:R=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Gl|=o,e.lanes=o,e.memoizedState=d}}function Za(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Qa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=k.T,s={};k.T=s,Fs(e,!1,t,n);try{var c=i(),l=k.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ps(e,t,va(c,r),pu(e)):Ps(e,t,r,pu(e))}catch(n){Ps(e,t,{then:function(){},status:`rejected`,reason:n},pu())}finally{A.p=a,o!==null&&s.types!==null&&(o.types=s.types),k.T=o}}function ws(){}function Ts(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Es(e).queue;Cs(e,a,t,ie,n===null?ws:function(){return Ds(e),n(r)})}function Es(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:ie},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ds(e){var t=Es(e);t.next===null&&(t=e.alternate.memoizedState),Ps(e,t.next.queue,{},pu())}function Os(){return ra(Qf)}function ks(){return H().memoizedState}function As(){return H().memoizedState}function js(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=pu();e=Wa(n);var r=Ga(t,e,n);r!==null&&(hu(r,t,n),Ka(r,t,n)),t={cache:ua()},e.payload=t;return}t=t.return}}function Ms(e,t,n){var r=pu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Is(e)?Ls(t,n):(n=oi(e,t,n,r),n!==null&&(hu(n,e,r),Rs(n,t,r)))}function Ns(e,t,n){Ps(e,t,n,pu())}function Ps(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Is(e))Ls(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Er(s,o))return ai(e,t,i,0),K===null&&ii(),!1}catch{}if(n=oi(e,t,i,r),n!==null)return hu(n,e,r),Rs(n,t,r),!0}return!1}function Fs(e,t,n,r){if(r={lane:2,revertLane:dd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Is(e)){if(t)throw Error(i(479))}else t=oi(e,n,r,2),t!==null&&hu(t,e,2)}function Is(e){var t=e.alternate;return e===z||t!==null&&t===z}function Ls(e,t){_o=go=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Rs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,rt(e,n)}}var zs={readContext:ra,use:Po,useCallback:V,useContext:V,useEffect:V,useImperativeHandle:V,useLayoutEffect:V,useInsertionEffect:V,useMemo:V,useReducer:V,useRef:V,useState:V,useDebugValue:V,useDeferredValue:V,useTransition:V,useSyncExternalStore:V,useId:V,useHostTransitionStatus:V,useFormState:V,useActionState:V,useOptimistic:V,useMemoCache:V,useCacheRefresh:V};zs.useEffectEvent=V;var Bs={readContext:ra,use:Po,useCallback:function(e,t){return jo().memoizedState=[e,t===void 0?null:t],e},useContext:ra,useEffect:us,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),cs(4194308,4,gs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return cs(4194308,4,e,t)},useInsertionEffect:function(e,t){cs(4,2,e,t)},useMemo:function(e,t){var n=jo();t=t===void 0?null:t;var r=e();if(vo){Be(!0);try{e()}finally{Be(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=jo();if(n!==void 0){var i=n(t);if(vo){Be(!0);try{n(t)}finally{Be(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ms.bind(null,z,e),[r.memoizedState,e]},useRef:function(e){var t=jo();return e={current:e},t.memoizedState=e},useState:function(e){e=Ko(e);var t=e.queue,n=Ns.bind(null,z,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:vs,useDeferredValue:function(e,t){return xs(jo(),e,t)},useTransition:function(){var e=Ko(!1);return e=Cs.bind(null,z,e.queue,!0,!1),jo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=z,a=jo();if(L){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),K===null)throw Error(i(349));J&127||Vo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,us(Uo.bind(null,r,o,e),[e]),r.flags|=2048,os(9,{destroy:void 0},Ho.bind(null,r,o,n,t),null),n},useId:function(){var e=jo(),t=K.identifierPrefix;if(L){var n=Ai,r=ki;n=(r&~(1<<32-Ve(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=yo++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[ut]=t,o[dt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Pd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Pc(t)}}return U(t),Fc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=pe.current,Ui(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ii,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[ut]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Md(e.nodeValue,n)),e||Bi(t,!0)}else e=Bd(e).createTextNode(r),e[ut]=t,t.stateNode=e}return U(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ui(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[ut]=t}else Wi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;U(t),e=!1}else n=Gi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(uo(t),t):(uo(t),null);if(t.flags&128)throw Error(i(558))}return U(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Ui(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[ut]=t}else Wi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;U(t),a=!1}else a=Gi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(uo(t),t):(uo(t),null)}return uo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Lc(t,t.updateQueue),U(t),null);case 4:return N(),e===null&&Sd(t.stateNode.containerInfo),U(t),null;case 10:return Zi(t.type),U(t),null;case 19:if(de(fo),r=t.memoizedState,r===null)return U(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Rc(r,!1);else{if(X!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=po(e),o!==null){for(t.flags|=128,Rc(r,!1),e=o.updateQueue,t.updateQueue=e,Lc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)mi(n,e),n=n.sibling;return j(fo,fo.current&1|2),L&&ji(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ke()>tu&&(t.flags|=128,a=!0,Rc(r,!1),t.lanes=4194304)}}else{if(!a){if(e=po(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Lc(t,e),Rc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!L)return U(t),null}else 2*ke()-r.renderingStartTime>tu&&n!==536870912&&(t.flags|=128,a=!0,Rc(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(U(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ke(),e.sibling=null,n=fo.current,j(fo,a?n&1|2:n&1),L&&ji(t,r.treeForkCount),e);case 22:case 23:return uo(t),ro(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(U(t),t.subtreeFlags&6&&(t.flags|=8192)):U(t),n=t.updateQueue,n!==null&&Lc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&de(ba),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Zi(la),U(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Bc(e,t){switch(Pi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Zi(la),N(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return P(t),null;case 31:if(t.memoizedState!==null){if(uo(t),t.alternate===null)throw Error(i(340));Wi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(uo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Wi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return de(fo),null;case 4:return N(),null;case 10:return Zi(t.type),null;case 22:case 23:return uo(t),ro(),e!==null&&de(ba),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Zi(la),null;case 25:return null;default:return null}}function Vc(e,t){switch(Pi(t),t.tag){case 3:Zi(la),N();break;case 26:case 27:case 5:P(t);break;case 4:N();break;case 31:t.memoizedState!==null&&uo(t);break;case 13:uo(t);break;case 19:de(fo);break;case 10:Zi(t.type);break;case 22:case 23:uo(t),ro(),e!==null&&de(ba);break;case 24:Zi(la)}}function Hc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Z(t,t.return,e)}}function Uc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Z(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Z(t,t.return,e)}}function Wc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Qa(t,n)}catch(t){Z(e,e.return,t)}}}function Gc(e,t,n){n.props=qs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Z(e,t,n)}}function Kc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Z(e,t,n)}}function qc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Z(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Z(e,t,n)}else n.current=null}}function Jc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Z(e,e.return,t)}}function Yc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[dt]=t}catch(t){Z(e,e.return,t)}}function Xc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Zc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Xc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=rn));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Qc(e,t,n),e=e.sibling;e!==null;)Qc(e,t,n),e=e.sibling}function $c(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for($c(e,t,n),e=e.sibling;e!==null;)$c(e,t,n),e=e.sibling}function el(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[ut]=e,t[dt]=n}catch(t){Z(e,e.return,t)}}var tl=!1,nl=!1,rl=!1,il=typeof WeakSet==`function`?WeakSet:Set,al=null;function ol(e,t){if(e=e.containerInfo,Rd=sp,e=jr(e),Mr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,al=t;al!==null;)if(t=al,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,al=e;else for(;al!==null;){switch(t=al,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Pd(o,r,n),o[ut]=e,Ct(o),r=o;break a;case`link`:var s=Vf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=kr(s,h),v=kr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,k.T=null,n=lu,lu=null;var o=au,s=su;if(iu=0,ou=au=null,su=0,G&6)throw Error(i(331));var c=G;if(G|=4,Fl(o.current),Dl(o,o.current,s,n),G=c,id(0,!1),ze&&typeof ze.onPostCommitFiberRoot==`function`)try{ze.onPostCommitFiberRoot(Re,o)}catch{}return!0}finally{A.p=a,k.T=r,Vu(e,t)}}function Wu(e,t,n){t=xi(n,t),t=$s(e.stateNode,t,2),e=Ga(e,t,2),e!==null&&(et(e,2),rd(e))}function Z(e,t,n){if(e.tag===3)Wu(e,e,n);else for(;t!==null;){if(t.tag===3){Wu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ru===null||!ru.has(r))){e=xi(n,e),n=ec(2),r=Ga(t,n,2),r!==null&&(tc(n,r,t,e),et(r,2),rd(r));break}}t=t.return}}function Gu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new zl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Ul=!0,i.add(n),e=Ku.bind(null,e,t,n),t.then(e,e))}function Ku(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,K===e&&(J&n)===n&&(X===4||X===3&&(J&62914560)===J&&300>ke()-$l?!(G&2)&&Su(e,0):ql|=n,Yl===J&&(Yl=0)),rd(e)}function qu(e,t){t===0&&(t=Qe()),e=si(e,t),e!==null&&(et(e,t),rd(e))}function Ju(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),qu(e,n)}function Yu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),qu(e,n)}function Xu(e,t){return Te(e,t)}var Zu=null,Qu=null,$u=!1,ed=!1,td=!1,nd=0;function rd(e){e!==Qu&&e.next===null&&(Qu===null?Zu=Qu=e:Qu=Qu.next=e),ed=!0,$u||($u=!0,ud())}function id(e,t){if(!td&&ed){td=!0;do for(var n=!1,r=Zu;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ve(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,ld(r,a))}else a=J,a=Ye(r,r===K?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Xe(r,a)||(n=!0,ld(r,a))}r=r.next}while(n);td=!1}}function ad(){od()}function od(){ed=$u=!1;var e=0;nd!==0&&Gd()&&(e=nd);for(var t=ke(),n=null,r=Zu;r!==null;){var i=r.next,a=sd(r,t);a===0?(r.next=null,n===null?Zu=i:n.next=i,i===null&&(Qu=n)):(n=r,(e!==0||a&3)&&(ed=!0)),r=i}iu!==0&&iu!==5||id(e,!1),nd!==0&&(nd=0)}function sd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Ht(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),Ct(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Ht(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Ht(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Ht(n.imageSizes)+`"]`)):i+=`[href="`+Ht(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),Ct(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Ht(r)+`"][href="`+Ht(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),Ct(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=St(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);Ct(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=St(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=f({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),Ct(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=St(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),Ct(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var a=(a=pe.current)?gf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=St(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=St(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=St(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Af(e){return`href="`+Ht(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),Ct(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Ht(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Ht(n.href)+`"]`);if(r)return t.instance=r,Ct(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Ct(r),Pd(r,`style`,a),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Af(n.href);var o=e.querySelector(jf(a));if(o)return t.state.loading|=4,t.instance=o,Ct(o),o;r=Mf(n),(a=mf.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),Ct(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(a=e.querySelector(Ff(o)))?(t.instance=a,Ct(a),a):(r=n,(a=mf.get(o))&&(r=f({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Ct(a),Pd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Ct(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),Ct(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=ue()})),j=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),fe=t(((e,t)=>{t.exports=j()})),M=e(ae(),1);function pe(){return typeof window<`u`}function me(e){return ge(e)?(e.nodeName||``).toLowerCase():`#document`}function he(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function N(e){return((ge(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ge(e){return pe()?e instanceof Node||e instanceof he(e).Node:!1}function P(e){return pe()?e instanceof Element||e instanceof he(e).Element:!1}function _e(e){return pe()?e instanceof HTMLElement||e instanceof he(e).HTMLElement:!1}function ve(e){return!pe()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof he(e).ShadowRoot}function ye(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Ae(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function be(e){return/^(table|td|th)$/.test(me(e))}function xe(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Se=/transform|translate|scale|rotate|perspective|filter/,Ce=/paint|layout|strict|content/,we=e=>!!e&&e!==`none`,Te;function Ee(e){let t=P(e)?Ae(e):e;return we(t.transform)||we(t.translate)||we(t.scale)||we(t.rotate)||we(t.perspective)||!Oe()&&(we(t.backdropFilter)||we(t.filter))||Se.test(t.willChange||``)||Ce.test(t.contain||``)}function De(e){let t=Me(e);for(;_e(t)&&!ke(t);){if(Ee(t))return t;if(xe(t))return null;t=Me(t)}return null}function Oe(){return Te??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Te}function ke(e){return/^(html|body|#document)$/.test(me(e))}function Ae(e){return he(e).getComputedStyle(e)}function je(e){return P(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Me(e){if(me(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ve(e)&&e.host||N(e);return ve(t)?t.host:t}function Ne(e){let t=Me(e);return ke(t)?(e.ownerDocument||e).body:_e(t)&&ye(t)?t:Ne(t)}function Pe(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ne(e),i=r===e.ownerDocument?.body,a=he(r);if(i){let e=Fe(a);return t.concat(a,a.visualViewport||[],ye(r)?r:[],e&&n?Pe(e):[])}return t.concat(r,Pe(r,[],n))}function Fe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Ie=Math.min,Le=Math.max,Re=Math.round,ze=Math.floor,Be=e=>({x:e,y:e}),Ve={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function He(e,t,n){return Le(e,Ie(t,n))}function Ue(e,t){return typeof e==`function`?e(t):e}function We(e){return e.split(`-`)[0]}function Ge(e){return e.split(`-`)[1]}function Ke(e){return e===`x`?`y`:`x`}function qe(e){return e===`y`?`height`:`width`}function Je(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ye(e){return Ke(Je(e))}function Xe(e,t,n){n===void 0&&(n=!1);let r=Ge(e),i=Ye(e),a=qe(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=at(o)),[o,at(o)]}function Ze(e){let t=at(e);return[Qe(e),t,Qe(t)]}function Qe(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var $e=[`left`,`right`],et=[`right`,`left`],tt=[`top`,`bottom`],nt=[`bottom`,`top`];function rt(e,t,n){switch(e){case`top`:case`bottom`:return n?t?et:$e:t?$e:et;case`left`:case`right`:return t?tt:nt;default:return[]}}function it(e,t,n,r){let i=Ge(e),a=rt(We(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Qe)))),a}function at(e){let t=We(e);return Ve[t]+e.slice(t.length)}function ot(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function st(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ot(e)}function ct(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}var lt=[`input:not([inert]):not([inert] *)`,`select:not([inert]):not([inert] *)`,`textarea:not([inert]):not([inert] *)`,`a[href]:not([inert]):not([inert] *)`,`area[href]:not([inert]):not([inert] *)`,`button:not([inert]):not([inert] *)`,`[tabindex]:not(slot):not([inert]):not([inert] *)`,`audio[controls]:not([inert]):not([inert] *)`,`video[controls]:not([inert]):not([inert] *)`,`[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)`,`details>summary:first-of-type:not([inert]):not([inert] *)`,`details:not([inert]):not([inert] *)`].join(`,`),ut=typeof Element>`u`,dt=ut?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ft=!ut&&Element.prototype.getRootNode?function(e){return e?.getRootNode?.call(e)}:function(e){return e?.ownerDocument},pt=function(e,t){t===void 0&&(t=!0);var n=e?.getAttribute?.call(e,`inert`);return n===``||n===`true`||t&&e&&(typeof e.closest==`function`?e.closest(`[inert]`):pt(e.parentNode))},mt=function(e){var t=e?.getAttribute?.call(e,`contenteditable`);return t===``||t===`true`},ht=function(e,t,n){if(pt(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(lt));return t&&dt.call(e,lt)&&r.unshift(e),r=r.filter(n),r},gt=function(e,t,n){for(var r=[],i=Array.from(e);i.length;){var a=i.shift();if(!pt(a,!1)){if(a.tagName===`SLOT`){var o=a.assignedElements(),s=gt(o.length?o:a.children,!0,n);n.flatten?r.push.apply(r,s):r.push({scopeParent:a,candidates:s})}else{dt.call(a,lt)&&n.filter(a)&&(t||!e.includes(a))&&r.push(a);var c=a.shadowRoot||typeof n.getShadowRoot==`function`&&n.getShadowRoot(a),l=!pt(c,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(a));if(c&&l){var u=gt(c===!0?a.children:c.children,!0,n);n.flatten?r.push.apply(r,u):r.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}}return r},_t=function(e){return!isNaN(parseInt(e.getAttribute(`tabindex`),10))},vt=function(e){if(!e)throw Error(`No node provided`);return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||mt(e))&&!_t(e)?0:e.tabIndex},yt=function(e,t){var n=vt(e);return n<0&&t&&!_t(e)?0:n},bt=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},xt=function(e){return e.tagName===`INPUT`},St=function(e){return xt(e)&&e.type===`hidden`},Ct=function(e){return e.tagName===`DETAILS`&&Array.prototype.slice.apply(e.children).some(function(e){return e.tagName===`SUMMARY`})},wt=function(e,t){for(var n=0;nsummary:first-of-type`)?e.parentElement:e;if(dt.call(a,`details:not([open]) *`))return!0;if(!n||n===`full`||n===`full-native`||n===`legacy-full`){if(typeof r==`function`){for(var o=e;e;){var s=e.parentElement,c=ft(e);if(s&&!s.shadowRoot&&r(s)===!0)return kt(e);e=e.assignedSlot?e.assignedSlot:!s&&c!==e.ownerDocument?c.host:s}e=o}if(Ot(e))return!e.getClientRects().length;if(n!==`legacy-full`)return!0}else if(n===`non-zero-area`)return kt(e);return!1},jt=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName===`FIELDSET`&&t.disabled){for(var n=0;n=0)},Ft=function(e){var t=[],n=[];return e.forEach(function(e,r){var i=!!e.scopeParent,a=i?e.scopeParent:e,o=yt(a,i),s=i?Ft(e.candidates):a;o===0?i?t.push.apply(t,s):t.push(a):n.push({documentOrder:r,tabIndex:o,item:e,isScope:i,content:s})}),n.sort(bt).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},It=function(e,t){return t||={},Ft(t.getShadowRoot?gt([e],t.includeContainer,{filter:Nt.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Pt}):ht(e,t.includeContainer,Nt.bind(null,t)))};function Lt(){return/apple/i.test(navigator.vendor)}var Rt=`data-floating-ui-focusable`;function zt(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function Bt(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&ve(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Vt(e){return`composedPath`in e?e.composedPath()[0]:e.target}function Ht(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function Ut(e){return e.matches(`html,body`)}function Wt(e){return e?.ownerDocument||document}function Gt(e){return e?e.hasAttribute(Rt)?e:e.querySelector(`[`+Rt+`]`)||e:null}function Kt(e,t,n){return n===void 0&&(n=!0),e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...Kt(e,t.id,n)])}function qt(e){return`nativeEvent`in e}function Jt(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}var Yt=typeof document<`u`?M.useLayoutEffect:function(){},Xt={...M};function Zt(e){let t=M.useRef(e);return Yt(()=>{t.current=e}),t}var Qt=Xt.useInsertionEffect||(e=>e());function $t(e){let t=M.useRef(()=>{});return Qt(()=>{t.current=e}),M.useCallback(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}var en=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver==`function`&&ResizeObserver.toString().includes(`[native code]`)?`full`:`none`});function tn(e,t){let n=It(e,en()),r=n.length;if(r===0)return;let i=zt(Wt(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function nn(e){return tn(Wt(e).body,1)||e}function rn(e){return tn(Wt(e).body,-1)||e}function an(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Bt(n,r)}function on(e){It(e,en()).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function sn(e){e.querySelectorAll(`[data-tabindex]`).forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var cn=e(le(),1),ln=fe();function un(e,t,n){let{reference:r,floating:i}=e,a=Je(t),o=Ye(t),s=qe(o),c=We(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Ge(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function dn(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Ue(t,e),p=st(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=ct(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=ct(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var fn=50,pn=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:dn},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=un(l,r,c),f=r,p=0,m={};for(let n=0;ne<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Je(t)||T.every(e=>Je(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Je(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},hn=new Set([`left`,`top`]);async function gn(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=We(n),s=Ge(n),c=Je(n)===`y`,l=hn.has(o)?-1:1,u=a&&c?-1:1,d=Ue(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var _n=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await gn(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},vn=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Ue(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Je(i),p=Ke(f),m=u[p],h=u[f],g=(e,t)=>He(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}};function yn(e){let t=Ae(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=_e(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Re(n)!==a||Re(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function bn(e){return P(e)?e:e.contextElement}function xn(e){let t=bn(e);if(!_e(t))return Be(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=yn(t),o=(a?Re(n.width):n.width)/r,s=(a?Re(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Sn=Be(0);function Cn(e){let t=he(e);return!Oe()||!t.visualViewport?Sn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function wn(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===he(e)}function Tn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=bn(e),o=Be(1);t&&(r?P(r)&&(o=xn(r)):o=xn(e));let s=wn(a,n,r)?Cn(a):Be(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=he(a),t=P(r)?he(r):r,n=e,i=Fe(n);for(;i&&t!==n;){let e=xn(i),t=i.getBoundingClientRect(),r=Ae(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=he(i),i=Fe(n)}}return ct({width:u,height:d,x:c,y:l})}function En(e,t){let n=je(e).scrollLeft;return t?t.left+n:Tn(N(e)).left+n}function Dn(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-En(e,n),y:n.top+t.scrollTop}}function On(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=N(r),s=t?xe(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Be(1),u=Be(0),d=_e(r);if((d||!a)&&((me(r)!==`body`||ye(o))&&(c=je(r)),d)){let e=Tn(r);l=xn(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Dn(o,c):Be(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function kn(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function An(e){let t=je(e),n=e.ownerDocument.body,r=Le(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Le(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+En(e),o=-t.scrollTop;return Ae(n).direction===`rtl`&&(a+=Le(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var jn=25;function Mn(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=he(e),a=N(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Oe()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(En(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=jn&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Nn(e,t){let n=Tn(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=xn(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Pn(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Mn(e,n,t);else if(t===`document`)r=An(N(e));else if(P(t))r=Nn(t,n);else{let n=Cn(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ct(r)}function Fn(e,t){let n=t.get(e);if(n)return n;let r=Pe(e,[],!1).filter(e=>P(e)&&me(e)!==`body`),i=null,a=Ae(e).position===`fixed`,o=a?Me(e):e;for(;P(o)&&!ke(o);){let e=Ae(o),t=Ee(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Me(o)}return t.set(e,r),r}function In(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?xe(t)?[]:Fn(t,this._c):[].concat(n),r],o=Pn(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=he(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function qn(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=bn(e),u=i||a?[...l?Pe(l):[],...t?Pe(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Kn(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Tn(e):null;c&&g();function g(){let t=Tn(e);h&&!Gn(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Jn=_n,Yn=vn,Xn=mn,Zn=(e,t,n)=>{let r=new Map,i=n??{},a={...Wn,...i.platform,_c:r};return pn(e,t,{...i,platform:a})},Qn=typeof document<`u`?M.useLayoutEffect:function(){};function $n(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!$n(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!$n(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function er(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function tr(e,t){let n=er(e);return Math.round(t*n)/n}function nr(e){let t=M.useRef(e);return Qn(()=>{t.current=e}),t}function rr(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=M.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=M.useState(r);$n(f,r)||p(r);let[m,h]=M.useState(null),[g,_]=M.useState(null),v=M.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=M.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=M.useRef(null),C=M.useRef(null),w=M.useRef(u),T=c!=null,E=nr(c),ee=nr(i),D=nr(l),O=M.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};ee.current&&(e.platform=ee.current),Zn(S.current,C.current,e).then(e=>{let t={...e,isPositioned:D.current!==!1};te.current&&!$n(w.current,t)&&(w.current=t,cn.flushSync(()=>{d(t)}))})},[f,t,n,ee,D]);Qn(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let te=M.useRef(!1);Qn(()=>(te.current=!0,()=>{te.current=!1}),[]),Qn(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,O);O()}},[b,x,O,E,T]);let ne=M.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),re=M.useMemo(()=>({reference:b,floating:x}),[b,x]),k=M.useMemo(()=>{let e={position:n,left:0,top:0};if(!re.floating)return e;let t=tr(re.floating,u.x),r=tr(re.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...er(re.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,re.floating,u.x,u.y]);return M.useMemo(()=>({...u,update:O,refs:ne,elements:re,floatingStyles:k}),[u,O,ne,re,k])}var ir=(e,t)=>{let n=Jn(e);return{name:n.name,fn:n.fn,options:[e,t]}},ar=(e,t)=>{let n=Yn(e);return{name:n.name,fn:n.fn,options:[e,t]}},or=(e,t)=>{let n=Xn(e);return{name:n.name,fn:n.fn,options:[e,t]}},sr=`data-floating-ui-focusable`,cr=`active`,lr=`selected`,ur=`ArrowLeft`,dr=`ArrowRight`,fr=`ArrowUp`,pr=`ArrowDown`,mr=[ur,dr],hr=[fr,pr];[...mr,...hr];var gr={...M},_r=!1,vr=0,yr=()=>`floating-ui-`+Math.random().toString(36).slice(2,6)+vr++;function br(){let[e,t]=M.useState(()=>_r?yr():void 0);return Yt(()=>{e??t(yr())},[]),M.useEffect(()=>{_r=!0},[]),e}var xr=gr.useId||br;function Sr(){let e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}var Cr=M.createContext(null),wr=M.createContext(null),Tr=()=>M.useContext(Cr)?.id||null,Er=()=>M.useContext(wr);function Dr(e){return`data-floating-ui-`+e}function Or(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}var kr=Dr(`safe-polygon`);function Ar(e,t,n){if(n&&!Jt(n))return 0;if(typeof e==`number`)return e;if(typeof e==`function`){let n=e();return typeof n==`number`?n:n?.[t]}return e?.[t]}function jr(e){return typeof e==`function`?e():e}function Mr(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,dataRef:i,events:a,elements:o}=e,{enabled:s=!0,delay:c=0,handleClose:l=null,mouseOnly:u=!1,restMs:d=0,move:f=!0}=t,p=Er(),m=Tr(),h=Zt(l),g=Zt(c),_=Zt(n),v=Zt(d),y=M.useRef(),b=M.useRef(-1),x=M.useRef(),S=M.useRef(-1),C=M.useRef(!0),w=M.useRef(!1),T=M.useRef(()=>{}),E=M.useRef(!1),ee=$t(()=>{let e=i.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`});M.useEffect(()=>{if(!s)return;function e(e){let{open:t}=e;t||(Or(b),Or(S),C.current=!0,E.current=!1)}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[s,a]),M.useEffect(()=>{if(!s||!h.current||!n)return;function e(e){ee()&&r(!1,e,`hover`)}let t=Wt(o.floating).documentElement;return t.addEventListener(`mouseleave`,e),()=>{t.removeEventListener(`mouseleave`,e)}},[o.floating,n,r,s,h,ee]);let D=M.useCallback(function(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=`hover`);let i=Ar(g.current,`close`,y.current);i&&!x.current?(Or(b),b.current=window.setTimeout(()=>r(!1,e,n),i)):t&&(Or(b),r(!1,e,n))},[g,r]),O=$t(()=>{T.current(),x.current=void 0}),te=$t(()=>{if(w.current){let e=Wt(o.floating).body;e.style.pointerEvents=``,e.removeAttribute(kr),w.current=!1}}),ne=$t(()=>i.current.openEvent?[`click`,`mousedown`].includes(i.current.openEvent.type):!1);M.useEffect(()=>{if(!s)return;function e(e){if(Or(b),C.current=!1,u&&!Jt(y.current)||jr(v.current)>0&&!Ar(g.current,`open`))return;let t=Ar(g.current,`open`,y.current);t?b.current=window.setTimeout(()=>{_.current||r(!0,e,`hover`)},t):n||r(!0,e,`hover`)}function t(e){if(ne()){te();return}T.current();let t=Wt(o.floating);if(Or(S),E.current=!1,h.current&&i.current.floatingContext){n||Or(b),x.current=h.current({...i.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){te(),O(),ne()||D(e,!0,`safe-polygon`)}});let r=x.current;t.addEventListener(`mousemove`,r),T.current=()=>{t.removeEventListener(`mousemove`,r)};return}(y.current!==`touch`||!Bt(o.floating,e.relatedTarget))&&D(e)}function a(e){ne()||i.current.floatingContext&&(h.current==null||h.current({...i.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){te(),O(),ne()||D(e)}})(e))}function c(){Or(b)}function l(e){ne()||D(e,!1)}if(P(o.domReference)){let r=o.domReference,i=o.floating;return n&&r.addEventListener(`mouseleave`,a),f&&r.addEventListener(`mousemove`,e,{once:!0}),r.addEventListener(`mouseenter`,e),r.addEventListener(`mouseleave`,t),i&&(i.addEventListener(`mouseleave`,a),i.addEventListener(`mouseenter`,c),i.addEventListener(`mouseleave`,l)),()=>{n&&r.removeEventListener(`mouseleave`,a),f&&r.removeEventListener(`mousemove`,e),r.removeEventListener(`mouseenter`,e),r.removeEventListener(`mouseleave`,t),i&&(i.removeEventListener(`mouseleave`,a),i.removeEventListener(`mouseenter`,c),i.removeEventListener(`mouseleave`,l))}}},[o,s,e,u,f,D,O,te,r,n,_,p,g,h,i,ne,v]),Yt(()=>{var e;if(s&&n&&(e=h.current)!=null&&(e=e.__options)!=null&&e.blockPointerEvents&&ee()){w.current=!0;let e=o.floating;if(P(o.domReference)&&e){var t;let n=Wt(o.floating).body;n.setAttribute(kr,``);let r=o.domReference,i=p==null||(t=p.nodesRef.current.find(e=>e.id===m))==null||(t=t.context)==null?void 0:t.elements.floating;return i&&(i.style.pointerEvents=``),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,e.style.pointerEvents=`auto`,()=>{n.style.pointerEvents=``,r.style.pointerEvents=``,e.style.pointerEvents=``}}}},[s,n,m,o,p,h,ee]),Yt(()=>{n||(y.current=void 0,E.current=!1,O(),te())},[n,O,te]),M.useEffect(()=>()=>{O(),Or(b),Or(S),te()},[s,o.domReference,O,te]);let re=M.useMemo(()=>{function e(e){y.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e;function i(){!C.current&&!_.current&&r(!0,t,`hover`)}(!u||Jt(y.current))&&(n||jr(v.current)===0||E.current&&e.movementX**2+e.movementY**2<2||(Or(S),y.current===`touch`?i():(E.current=!0,S.current=window.setTimeout(i,jr(v.current)))))}}},[u,r,n,_,v]);return M.useMemo(()=>s?{reference:re}:{},[s,re])}var Nr={border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`fixed`,whiteSpace:`nowrap`,width:`1px`,top:0,left:0},Pr=M.forwardRef(function(e,t){let[n,r]=M.useState();Yt(()=>{Lt()&&r(`button`)},[]);let i={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[Dr(`focus-guard`)]:``,style:Nr};return(0,ln.jsx)(`span`,{...e,...i})}),Fr={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},Ir=M.createContext(null),Lr=Dr(`portal`);function Rr(e){e===void 0&&(e={});let{id:t,root:n}=e,r=xr(),i=Br(),[a,o]=M.useState(null),s=M.useRef(null);return Yt(()=>()=>{a?.remove(),queueMicrotask(()=>{s.current=null})},[a]),Yt(()=>{if(!r||s.current)return;let e=t?document.getElementById(t):null;if(!e)return;let n=document.createElement(`div`);n.id=r,n.setAttribute(Lr,``),e.appendChild(n),s.current=n,o(n)},[t,r]),Yt(()=>{if(n===null||!r||s.current)return;let e=n||i?.portalNode;e&&!ge(e)&&(e=e.current),e||=document.body;let a=null;t&&(a=document.createElement(`div`),a.id=t,e.appendChild(a));let c=document.createElement(`div`);c.id=r,c.setAttribute(Lr,``),e=a||e,e.appendChild(c),s.current=c,o(c)},[t,n,r,i]),a}function zr(e){let{children:t,id:n,root:r,preserveTabOrder:i=!0}=e,a=Rr({id:n,root:r}),[o,s]=M.useState(null),c=M.useRef(null),l=M.useRef(null),u=M.useRef(null),d=M.useRef(null),f=o?.modal,p=o?.open,m=!!o&&!o.modal&&o.open&&i&&!!(r||a);return M.useEffect(()=>{if(!a||!i||f)return;function e(e){a&&an(e)&&(e.type===`focusin`?sn:on)(a)}return a.addEventListener(`focusin`,e,!0),a.addEventListener(`focusout`,e,!0),()=>{a.removeEventListener(`focusin`,e,!0),a.removeEventListener(`focusout`,e,!0)}},[a,i,f]),M.useEffect(()=>{a&&(p||sn(a))},[p,a]),(0,ln.jsxs)(Ir.Provider,{value:M.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:l,beforeInsideRef:u,afterInsideRef:d,portalNode:a,setFocusManagerState:s}),[i,a]),children:[m&&a&&(0,ln.jsx)(Pr,{"data-type":`outside`,ref:c,onFocus:e=>{if(an(e,a)){var t;(t=u.current)==null||t.focus()}else rn(o?o.domReference:null)?.focus()}}),m&&a&&(0,ln.jsx)(`span`,{"aria-owns":a.id,style:Fr}),a&&cn.createPortal(t,a),m&&a&&(0,ln.jsx)(Pr,{"data-type":`outside`,ref:l,onFocus:e=>{if(an(e,a)){var t;(t=d.current)==null||t.focus()}else nn(o?o.domReference:null)?.focus(),o!=null&&o.closeOnFocusOut&&o?.onOpenChange(!1,e.nativeEvent,`focus-out`)}})]})}var Br=()=>M.useContext(Ir),Vr={pointerdown:`onPointerDown`,mousedown:`onMouseDown`,click:`onClick`},Hr={pointerdown:`onPointerDownCapture`,mousedown:`onMouseDownCapture`,click:`onClickCapture`},Ur=e=>({escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0});function Wr(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,elements:i,dataRef:a}=e,{enabled:o=!0,escapeKey:s=!0,outsidePress:c=!0,outsidePressEvent:l=`pointerdown`,referencePress:u=!1,referencePressEvent:d=`pointerdown`,ancestorScroll:f=!1,bubbles:p,capture:m}=t,h=Er(),g=$t(typeof c==`function`?c:()=>!1),_=typeof c==`function`?g:c,v=M.useRef(!1),{escapeKey:y,outsidePress:b}=Ur(p),{escapeKey:x,outsidePress:S}=Ur(m),C=M.useRef(!1),w=$t(e=>{if(!n||!o||!s||e.key!==`Escape`||C.current)return;let t=a.current.floatingContext?.nodeId,i=h?Kt(h.nodesRef.current,t):[];if(!y&&(e.stopPropagation(),i.length>0)){let e=!0;if(i.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__escapeKeyBubbles){e=!1;return}}),!e)return}r(!1,qt(e)?e.nativeEvent:e,`escape-key`)}),T=$t(e=>{var t;let n=()=>{var t;w(e),(t=Vt(e))==null||t.removeEventListener(`keydown`,n)};(t=Vt(e))==null||t.addEventListener(`keydown`,n)}),E=$t(e=>{let t=a.current.insideReactTree;a.current.insideReactTree=!1;let n=v.current;if(v.current=!1,l===`click`&&n||t||typeof _==`function`&&!_(e))return;let o=Vt(e),s=`[`+Dr(`inert`)+`]`,c=Wt(i.floating).querySelectorAll(s),u=P(o)?o:null;for(;u&&!ke(u);){let e=Me(u);if(ke(e)||!P(e))break;u=e}if(c.length&&P(o)&&!Ut(o)&&!Bt(o,i.floating)&&Array.from(c).every(e=>!Bt(u,e)))return;if(_e(o)&&O){let t=ke(o),n=Ae(o),r=/auto|scroll/,i=t||r.test(n.overflowX),a=t||r.test(n.overflowY),s=i&&o.clientWidth>0&&o.scrollWidth>o.clientWidth,c=a&&o.clientHeight>0&&o.scrollHeight>o.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=o.offsetWidth-o.clientWidth:e.offsetX>o.clientWidth),d=s&&e.offsetY>o.clientHeight;if(u||d)return}let d=a.current.floatingContext?.nodeId,f=h&&Kt(h.nodesRef.current,d).some(t=>Ht(e,t.context?.elements.floating));if(Ht(e,i.floating)||Ht(e,i.domReference)||f)return;let p=h?Kt(h.nodesRef.current,d):[];if(p.length>0){let e=!0;if(p.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__outsidePressBubbles){e=!1;return}}),!e)return}r(!1,e,`outside-press`)}),ee=$t(e=>{var t;let n=()=>{var t;E(e),(t=Vt(e))==null||t.removeEventListener(l,n)};(t=Vt(e))==null||t.addEventListener(l,n)});M.useEffect(()=>{if(!n||!o)return;a.current.__escapeKeyBubbles=y,a.current.__outsidePressBubbles=b;let e=-1;function t(e){r(!1,e,`ancestor-scroll`)}function c(){window.clearTimeout(e),C.current=!0}function u(){e=window.setTimeout(()=>{C.current=!1},Oe()?5:0)}let d=Wt(i.floating);s&&(d.addEventListener(`keydown`,x?T:w,x),d.addEventListener(`compositionstart`,c),d.addEventListener(`compositionend`,u)),_&&d.addEventListener(l,S?ee:E,S);let p=[];return f&&(P(i.domReference)&&(p=Pe(i.domReference)),P(i.floating)&&(p=p.concat(Pe(i.floating))),!P(i.reference)&&i.reference&&i.reference.contextElement&&(p=p.concat(Pe(i.reference.contextElement)))),p=p.filter(e=>e!==d.defaultView?.visualViewport),p.forEach(e=>{e.addEventListener(`scroll`,t)}),()=>{s&&(d.removeEventListener(`keydown`,x?T:w,x),d.removeEventListener(`compositionstart`,c),d.removeEventListener(`compositionend`,u)),_&&d.removeEventListener(l,S?ee:E,S),p.forEach(e=>{e.removeEventListener(`scroll`,t)}),window.clearTimeout(e)}},[a,i,s,_,l,n,r,f,o,y,b,w,x,T,E,S,ee]),M.useEffect(()=>{a.current.insideReactTree=!1},[a,_,l]);let D=M.useMemo(()=>({onKeyDown:w,...u&&{[Vr[d]]:e=>{r(!1,e.nativeEvent,`reference-press`)},...d!==`click`&&{onClick(e){r(!1,e.nativeEvent,`reference-press`)}}}}),[w,r,u,d]),O=M.useMemo(()=>{function e(e){e.button===0&&(v.current=!0)}return{onKeyDown:w,onMouseDown:e,onMouseUp:e,[Hr[l]]:()=>{a.current.insideReactTree=!0}}},[w,l,a]);return M.useMemo(()=>o?{reference:D,floating:O}:{},[o,D,O])}function Gr(e){let{open:t=!1,onOpenChange:n,elements:r}=e,i=xr(),a=M.useRef({}),[o]=M.useState(()=>Sr()),s=Tr()!=null,[c,l]=M.useState(r.reference),u=$t((e,t,r)=>{a.current.openEvent=e?t:void 0,o.emit(`openchange`,{open:e,event:t,reason:r,nested:s}),n?.(e,t,r)}),d=M.useMemo(()=>({setPositionReference:l}),[]),f=M.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return M.useMemo(()=>({dataRef:a,open:t,onOpenChange:u,elements:f,events:o,floatingId:i,refs:d}),[t,u,f,o,i,d])}function Kr(e){let{elements:t,...n}=e===void 0?{}:e,{nodeId:r}=n,i=Gr({...n,elements:{reference:t?.reference??null,floating:t?.floating??null}}),a=n.rootContext||i,o=a.elements,[s,c]=M.useState(null),[l,u]=M.useState(null),d=o?.domReference||s,f=M.useRef(null),p=Er();Yt(()=>{d&&(f.current=d)},[d]);let m=rr({...n,elements:{...o,...l&&{reference:l}}}),h=M.useCallback(e=>{let t=P(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),m.refs.setReference(t)},[m.refs]),g=M.useCallback(e=>{(P(e)||e===null)&&(f.current=e,c(e)),(P(m.refs.reference.current)||m.refs.reference.current===null||e!==null&&!P(e))&&m.refs.setReference(e)},[m.refs]),_=M.useMemo(()=>({...m.refs,setReference:g,setPositionReference:h,domReference:f}),[m.refs,g,h]),v=M.useMemo(()=>({...m.elements,domReference:d}),[m.elements,d]),y=M.useMemo(()=>({...m,...a,refs:_,elements:v,nodeId:r}),[m,_,v,r,a]);return Yt(()=>{a.dataRef.current.floatingContext=y;let e=p?.nodesRef.current.find(e=>e.id===r);e&&(e.context=y)}),M.useMemo(()=>({...m,context:y,refs:_,elements:v}),[m,_,v,y])}function qr(e,t,n){let r=new Map,i=n===`item`,a=e;if(i&&e){let{[cr]:t,[lr]:n,...r}=e;a=r}return{...n===`floating`&&{tabIndex:-1,[sr]:``},...a,...t.map(t=>{let r=t?t[n]:null;return typeof r==`function`?e?r(e):null:r}).concat(e).reduce((e,t)=>(t&&Object.entries(t).forEach(t=>{let[n,a]=t;if(!(i&&[cr,lr].includes(n))){if(n.indexOf(`on`)===0){if(r.has(n)||r.set(n,[]),typeof a==`function`){var o;(o=r.get(n))==null||o.push(a),e[n]=function(){var e=[...arguments];return r.get(n)?.map(t=>t(...e)).find(e=>e!==void 0)}}}else e[n]=a}}),e),{})}}function Jr(e){e===void 0&&(e=[]);let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=M.useCallback(t=>qr(t,e,`reference`),t),a=M.useCallback(t=>qr(t,e,`floating`),n),o=M.useCallback(t=>qr(t,e,`item`),r);return M.useMemo(()=>({getReferenceProps:i,getFloatingProps:a,getItemProps:o}),[i,a,o])}var Yr=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function Xr(e,t){t===void 0&&(t={});let{open:n,elements:r,floatingId:i}=e,{enabled:a=!0,role:o=`dialog`}=t,s=xr(),c=r.domReference?.id||s,l=M.useMemo(()=>Gt(r.floating)?.id||i,[r.floating,i]),u=Yr.get(o)??o,d=Tr()!=null,f=M.useMemo(()=>u===`tooltip`||o===`label`?{[`aria-`+(o===`label`?`labelledby`:`describedby`)]:n?l:void 0}:{"aria-expanded":n?`true`:`false`,"aria-haspopup":u===`alertdialog`?`dialog`:u,"aria-controls":n?l:void 0,...u===`listbox`&&{role:`combobox`},...u===`menu`&&{id:c},...u===`menu`&&d&&{role:`menuitem`},...o===`select`&&{"aria-autocomplete":`none`},...o===`combobox`&&{"aria-autocomplete":`list`}},[u,l,d,n,c,o]),p=M.useMemo(()=>{let e={id:l,...u&&{role:u}};return u===`tooltip`||o===`label`?e:{...e,...u===`menu`&&{"aria-labelledby":c}}},[u,l,c,o]),m=M.useCallback(e=>{let{active:t,selected:n}=e,r={role:`option`,...t&&{id:l+`-fui-option`}};switch(o){case`select`:case`combobox`:return{...r,"aria-selected":n}}return{}},[l,o]);return M.useMemo(()=>a?{reference:f,floating:p,item:m}:{},[a,f,p,m])}var Zr=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},Qr=(e=>e?Zr(e):Zr),$r=e=>e;function ei(e,t=$r){let n=M.useSyncExternalStore(e.subscribe,M.useCallback(()=>t(e.getState()),[e,t]),M.useCallback(()=>t(e.getInitialState()),[e,t]));return M.useDebugValue(n),n}var ti=e=>{let t=Qr(e),n=e=>ei(t,e);return Object.assign(n,t),n},ni=(e=>e?ti(e):ti),ri=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ii=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),ai=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),oi=e=>{let t=ai(e);return t.charAt(0).toUpperCase()+t.slice(1)},si={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ci=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},li=(0,M.createContext)({}),ui=()=>(0,M.useContext)(li),di=(0,M.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=ui()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,M.createElement)(`svg`,{ref:c,...si,width:t??l??si.width,height:t??l??si.height,stroke:e??f,strokeWidth:m,className:ri(`lucide`,p,i),...!a&&!ci(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,M.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),F=(e,t)=>{let n=(0,M.forwardRef)(({className:n,...r},i)=>(0,M.createElement)(di,{ref:i,iconNode:t,className:ri(`lucide-${ii(oi(e))}`,`lucide-${e}`,n),...r}));return n.displayName=oi(e),n},fi=F(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),pi=F(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),mi=F(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),hi=F(`award`,[[`path`,{d:`m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526`,key:`1yiouv`}],[`circle`,{cx:`12`,cy:`8`,r:`6`,key:`1vp47v`}]]),gi=F(`book-open`,[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]),_i=F(`brain-circuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),vi=F(`castle`,[[`path`,{d:`M10 5V3`,key:`1y54qe`}],[`path`,{d:`M14 5V3`,key:`m6isi`}],[`path`,{d:`M15 21v-3a3 3 0 0 0-6 0v3`,key:`lbp5hj`}],[`path`,{d:`M18 3v8`,key:`2ollhf`}],[`path`,{d:`M18 5H6`,key:`98imr9`}],[`path`,{d:`M22 11H2`,key:`1lmjae`}],[`path`,{d:`M22 9v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9`,key:`1rly83`}],[`path`,{d:`M6 3v8`,key:`csox7g`}]]),yi=F(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),bi=F(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),xi=F(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Si=F(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Ci=F(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),wi=F(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Ti=F(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Ei=F(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]]),Di=F(`circle-plus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),Oi=F(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),ki=F(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ai=F(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),ji=F(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),Mi=F(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Ni=F(`coffee`,[[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M14 2v2`,key:`6buw04`}],[`path`,{d:`M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1`,key:`pwadti`}],[`path`,{d:`M6 2v2`,key:`colzsn`}]]),Pi=F(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),Fi=F(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Ii=F(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),I=F(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),L=F(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Li=F(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ri=F(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),zi=F(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),Bi=F(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Vi=F(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),Hi=F(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Ui=F(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Wi=F(`key`,[[`path`,{d:`m2 21 9.6-9.6`,key:`9l79m3`}],[`path`,{d:`m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19`,key:`fw8biw`}],[`circle`,{cx:`15.5`,cy:`7.5`,r:`5.5`,key:`4wxmhb`}]]),Gi=F(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Ki=F(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),qi=F(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Ji=F(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),Yi=F(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),Xi=F(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),Zi=F(`map`,[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]),Qi=F(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),$i=F(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),ea=F(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),ta=F(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),na=F(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),ra=F(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),ia=F(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),aa=F(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),oa=F(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),sa=F(`rotate-ccw-clock`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),ca=F(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),la=F(`route`,[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]),ua=F(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),da=F(`scroll`,[[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),fa=F(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),pa=F(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ma=F(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),ha=F(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ga=F(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),_a=F(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),va=F(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),ya=F(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),ba=F(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),xa=F(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Sa=F(`target`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),Ca=F(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),wa=F(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),Ta=F(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Ea=F(`trophy`,[[`path`,{d:`M10 14.66V17a1 1 0 0 1-1 1 2 2 0 0 0-2 2v2`,key:`pwuv1l`}],[`path`,{d:`M14 14.66V17a1 1 0 0 0 1 1 2 2 0 0 1 2 2v2`,key:`1y54w1`}],[`path`,{d:`M17.916 10H19.5A2.5 2.5 0 0 0 22 7.5V5a1 1 0 0 0-1-1h-3`,key:`e30mpu`}],[`path`,{d:`M4 22h16`,key:`57wxv0`}],[`path`,{d:`M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z`,key:`1mhfuq`}],[`path`,{d:`M6.084 10H4.5A2.5 2.5 0 0 1 2 7.5V5a1 1 0 0 1 1-1h3`,key:`i0yafy`}]]),Da=F(`volume-2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),Oa=F(`volume-x`,[[`path`,{d:`M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z`,key:`1p7khw`}],[`path`,{d:`m16.5 14.5 5-5`,key:`cul3yw`}],[`path`,{d:`m16.5 9.5 5 5`,key:`1akey5`}]]),ka=F(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Aa=F(`zap`,[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]),ja=F(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),Ma=F(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]);function Na(e,t,n){return Math.max(t,Math.min(e,n))}var Pa={toVector(e,t){return e===void 0&&(e=t),Array.isArray(e)?e:[e,e]},add(e,t){return[e[0]+t[0],e[1]+t[1]]},sub(e,t){return[e[0]-t[0],e[1]-t[1]]},addTo(e,t){e[0]+=t[0],e[1]+=t[1]},subTo(e,t){e[0]-=t[0],e[1]-=t[1]}};function Fa(e,t,n){return t===0||Math.abs(t)===1/0?e**(n*5):e*t*n/(t+n*e)}function Ia(e,t,n,r=.15){return r===0?Na(e,t,n):en?+Fa(e-n,n-t,r)+n:e}function La(e,[t,n],[r,i]){let[[a,o],[s,c]]=e;return[Ia(t,a,o,r),Ia(n,s,c,i)]}function Ra(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function za(e){var t=Ra(e,`string`);return typeof t==`symbol`?t:String(t)}function Ba(e,t,n){return t=za(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Va(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function R(e){for(var t=1;t{var n,r;return t.target===e.currentTarget||((n=e.currentTarget)==null||(r=n.contains)==null?void 0:r.call(n,t.target))})}function $a(e){return e.type===`touchend`||e.type===`touchcancel`?e.changedTouches:e.targetTouches}function eo(e){return Xa(e)?$a(e)[0]:e}function to(e){return Qa(e).map(e=>e.identifier)}function no(e){let t=eo(e);return Xa(e)?t.identifier:t.pointerId}function ro(e){let t=eo(e);return[t.clientX,t.clientY]}function io(e){let t={};if(`buttons`in e&&(t.buttons=e.buttons),`shiftKey`in e){let{shiftKey:n,altKey:r,metaKey:i,ctrlKey:a}=e;Object.assign(t,{shiftKey:n,altKey:r,metaKey:i,ctrlKey:a})}return t}function ao(e,...t){return typeof e==`function`?e(...t):e}function oo(){}function so(...e){return e.length===0?oo:e.length===1?e[0]:function(){let t;for(let n of e)t=n.apply(this,arguments)||t;return t}}function co(e,t){return Object.assign({},t,e||{})}var lo=32,uo=class{constructor(e,t,n){this.ctrl=e,this.args=t,this.key=n,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){let{state:e,shared:t,ingKey:n,args:r}=this;t[n]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=r,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){let t=this.state,n=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=n.from?ao(n.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){let t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){let e=this.state;e._initial=e._values,e.initial=e.values}compute(e){let{state:t,config:n,shared:r}=this;t.args=this.args;let i=0;if(e&&(t.event=e,n.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,r.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,r.locked=!!document.pointerLockElement,Object.assign(r,io(e)),r.down=r.pressed=r.buttons%2==1||r.touches>0,i=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){let e=t._delta.map(Math.abs);Pa.addTo(t._distance,e)}this.axisIntent&&this.axisIntent(e);let[a,o]=t._movement,[s,c]=n.threshold,{_step:l,values:u}=t;if(n.hasCustomTransform?(l[0]===!1&&(l[0]=Math.abs(a)>=s&&u[0]),l[1]===!1&&(l[1]=Math.abs(o)>=c&&u[1])):(l[0]===!1&&(l[0]=Math.abs(a)>=s&&Math.sign(a)*s),l[1]===!1&&(l[1]=Math.abs(o)>=c&&Math.sign(o)*c)),t.intentional=l[0]!==!1||l[1]!==!1,!t.intentional)return;let d=[0,0];if(n.hasCustomTransform){let[e,t]=u;d[0]=l[0]===!1?0:e-l[0],d[1]=l[1]===!1?0:t-l[1]}else d[0]=l[0]===!1?0:a-l[0],d[1]=l[1]===!1?0:o-l[1];this.restrictToAxis&&!t._blocked&&this.restrictToAxis(d);let f=t.offset,p=t._active&&!t._blocked||t.active;p&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=r[this.ingKey]=t._active,e&&(t.first&&(`bounds`in n&&(t._bounds=ao(n.bounds,t)),this.setup&&this.setup()),t.movement=d,this.computeOffset()));let[m,h]=t.offset,[[g,_],[v,y]]=t._bounds;t.overflow=[m_),hy)],t._movementBound[0]=t.overflow[0]?t._movementBound[0]===!1?t._movement[0]:t._movementBound[0]:!1,t._movementBound[1]=t.overflow[1]?t._movementBound[1]===!1?t._movement[1]:t._movementBound[1]:!1;let b=t._active&&n.rubberband||[0,0];if(t.offset=La(t._bounds,t.offset,b),t.delta=Pa.sub(t.offset,f),this.computeMovement(),p&&(!t.last||i>lo)){t.delta=Pa.sub(t.offset,f);let e=t.delta.map(Math.abs);Pa.addTo(t.distance,e),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&i>0&&(t.velocity=[e[0]/i,e[1]/i],t.timeDelta=i)}}emit(){let e=this.state,t=this.shared,n=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!n.triggerAllEvents)return;let r=this.handler(R(R(R({},t),e),{},{[this.aliasKey]:e.values}));r!==void 0&&(e.memo=r)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}};function fo([e,t],n){let r=Math.abs(e),i=Math.abs(t);if(r>i&&r>n)return`x`;if(i>r&&i>n)return`y`}var po=class extends uo{constructor(...e){super(...e),Ba(this,`aliasKey`,`xy`)}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=Pa.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=Pa.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){let t=this.state,n=this.config;if(!t.axis&&e){let r=typeof n.axisThreshold==`object`?n.axisThreshold[Za(e)]:n.axisThreshold;t.axis=fo(t._movement,r)}t._blocked=(n.lockDirection||!!n.axis)&&!t.axis||!!n.axis&&n.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case`x`:e[1]=0;break;case`y`:e[0]=0}}},mo=e=>e,z=.15,B={enabled(e=!0){return e},eventOptions(e,t,n){return R(R({},n.shared.eventOptions),e)},preventDefault(e=!1){return e},triggerAllEvents(e=!1){return e},rubberband(e=0){switch(e){case!0:return[z,z];case!1:return[0,0];default:return Pa.toVector(e)}},from(e){if(typeof e==`function`)return e;if(e!=null)return Pa.toVector(e)},transform(e,t,n){let r=e||n.shared.transform;return this.hasCustomTransform=!!r,r||mo},threshold(e){return Pa.toVector(e,0)}},ho=0,go=R(R({},B),{},{axis(e,t,{axis:n}){if(this.lockDirection=n===`lock`,!this.lockDirection)return n},axisThreshold(e=ho){return e},bounds(e={}){if(typeof e==`function`)return t=>go.bounds(e(t));if(`current`in e)return()=>e.current;if(typeof HTMLElement==`function`&&e instanceof HTMLElement)return e;let{left:t=-1/0,right:n=1/0,top:r=-1/0,bottom:i=1/0}=e;return[[t,n],[r,i]]}}),_o={ArrowRight:(e,t=1)=>[e*t,0],ArrowLeft:(e,t=1)=>[-1*e*t,0],ArrowUp:(e,t=1)=>[0,-1*e*t],ArrowDown:(e,t=1)=>[0,e*t]},vo=class extends po{constructor(...e){super(...e),Ba(this,`ingKey`,`dragging`)}reset(){super.reset();let e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){let e=this.state;if(e._bounds instanceof HTMLElement){let t=e._bounds.getBoundingClientRect(),n=e.currentTarget.getBoundingClientRect(),r={left:t.left-n.left+e.offset[0],right:t.right-n.right+e.offset[0],top:t.top-n.top+e.offset[1],bottom:t.bottom-n.bottom+e.offset[1]};e._bounds=go.bounds(r)}}cancel(){let e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){let t=this.config,n=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;let r=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(r&&r.size>1&&n._pointerActive)&&(this.start(e),this.setupPointer(e),n._pointerId=no(e),n._pointerActive=!0,this.computeValues(ro(e)),this.computeInitial(),t.preventScrollAxis&&Za(e)!==`mouse`?(n._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){let t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){let t=this.state,n=this.config;if(!t._pointerActive)return;let r=no(e);if(t._pointerId!==void 0&&r!==t._pointerId)return;let i=ro(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=Pa.sub(i,t._values),this.computeValues(i)),Pa.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove(`dragDelay`),t.active=!1,this.startPointerDrag(e);return}if(n.preventScrollAxis&&!t._preventScroll){if(t.axis){if(t.axis===n.preventScrollAxis||n.preventScrollAxis===`xy`){t._active=!1,this.clean();return}this.timeoutStore.remove(`startPointerDrag`),this.startPointerDrag(e);return}return}this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}let t=this.state,n=this.config;if(!t._active||!t._pointerActive)return;let r=no(e);if(t._pointerId!==void 0&&r!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);let[i,a]=t._distance;if(t.tap=i<=n.tapsThreshold&&a<=n.tapsThreshold,t.tap&&n.filterTaps)t._force=!0;else{let[e,r]=t._delta,[i,a]=t._movement,[o,s]=n.swipe.velocity,[c,l]=n.swipe.distance,u=n.swipe.duration;if(t.elapsedTimeo&&Math.abs(i)>c&&(t.swipe[0]=Math.sign(e)),u>s&&Math.abs(a)>l&&(t.swipe[1]=Math.sign(r))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){let t=this.config,n=t.device;t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,n,`change`,this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,n,`end`,this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,n,`cancel`,this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,yo(e);let t=this.eventStore.add(this.sharedConfig.window,`touch`,`change`,this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,`touch`,`end`,t),this.eventStore.add(this.sharedConfig.window,`touch`,`cancel`,t),this.timeoutStore.add(`startPointerDrag`,this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add(`dragDelay`,()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){let t=_o[e.key];if(t){let n=this.state,r=e.shiftKey?10:e.altKey?.1:1;this.start(e),n._delta=t(this.config.keyboardDisplacement,r),n._keyboardActive=!0,Pa.addTo(n._movement,n._delta),this.compute(e),this.emit()}}keyUp(e){e.key in _o&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){let t=this.config.device;e(t,`start`,this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,`change`,this.pointerMove.bind(this)),e(t,`end`,this.pointerUp.bind(this)),e(t,`cancel`,this.pointerUp.bind(this)),e(`lostPointerCapture`,``,this.pointerUp.bind(this))),this.config.keys&&(e(`key`,`down`,this.keyDown.bind(this)),e(`key`,`up`,this.keyUp.bind(this))),this.config.filterTaps&&e(`click`,``,this.pointerClick.bind(this),{capture:!0,passive:!1})}};function yo(e){`persist`in e&&typeof e.persist==`function`&&e.persist()}var bo=typeof window<`u`&&window.document&&window.document.createElement;function xo(){return bo&&`ontouchstart`in window}function So(){return xo()||bo&&window.navigator.maxTouchPoints>1}function V(){return bo&&`onpointerdown`in window}function Co(){return bo&&`exitPointerLock`in window.document}function wo(){try{return`constructor`in GestureEvent}catch{return!1}}var To={isBrowser:bo,gesture:wo(),touch:xo(),touchscreen:So(),pointer:V(),pointerLock:Co()},Eo=250,Do=180,Oo=.5,ko=50,Ao=250,jo=10,H={mouse:0,touch:0,pen:8},Mo=R(R({},go),{},{device(e,t,{pointer:{touch:n=!1,lock:r=!1,mouse:i=!1}={}}){return this.pointerLock=r&&To.pointerLock,To.touch&&n?`touch`:this.pointerLock?`mouse`:To.pointer&&!i?`pointer`:To.touch?`touch`:`mouse`},preventScrollAxis(e,t,{preventScroll:n}){if(this.preventScrollDelay=typeof n==`number`?n:n||n===void 0&&e?Eo:void 0,To.touchscreen&&n!==!1)return e||(n===void 0?void 0:`y`)},pointerCapture(e,t,{pointer:{capture:n=!0,buttons:r=1,keys:i=!0}={}}){return this.pointerButtons=r,this.keys=i,!this.pointerLock&&this.device===`pointer`&&n},threshold(e,t,{filterTaps:n=!1,tapsThreshold:r=3,axis:i=void 0}){let a=Pa.toVector(e,n?r:+!!i);return this.filterTaps=n,this.tapsThreshold=r,a},swipe({velocity:e=Oo,distance:t=ko,duration:n=Ao}={}){return{velocity:this.transform(Pa.toVector(e)),distance:this.transform(Pa.toVector(t)),duration:n}},delay(e=0){switch(e){case!0:return Do;case!1:return 0;default:return e}},axisThreshold(e){return e?R(R({},H),e):H},keyboardDisplacement(e=jo){return e}});R(R({},B),{},{device(e,t,{shared:n,pointer:{touch:r=!1}={}}){if(n.target&&!To.touch&&To.gesture)return`gesture`;if(To.touch&&r)return`touch`;if(To.touchscreen){if(To.pointer)return`pointer`;if(To.touch)return`touch`}},bounds(e,t,{scaleBounds:n={},angleBounds:r={}}){let i=e=>{let t=co(ao(n,e),{min:-1/0,max:1/0});return[t.min,t.max]},a=e=>{let t=co(ao(r,e),{min:-1/0,max:1/0});return[t.min,t.max]};return typeof n!=`function`&&typeof r!=`function`?[i(),a()]:e=>[i(e),a(e)]},threshold(e,t,n){return this.lockDirection=n.axis===`lock`,Pa.toVector(e,this.lockDirection?[.1,3]:0)},modifierKey(e){return e===void 0?`ctrlKey`:e},pinchOnWheel(e=!0){return e}}),R(R({},go),{},{mouseOnly:(e=!0)=>e}),R(R({},go),{},{mouseOnly:(e=!0)=>e});var No=new Map,Po=new Map;function Fo(e){No.set(e.key,e.engine),Po.set(e.key,e.resolver)}var Io={key:`drag`,engine:vo,resolver:Mo};function Lo(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a=0)&&(n[i]=e[i]);return n}function Ro(e,t){if(e==null)return{};var n=Lo(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var zo={target(e){if(e)return()=>`current`in e?e.current:e},enabled(e=!0){return e},window(e=To.isBrowser?window:void 0){return e},eventOptions({passive:e=!0,capture:t=!1}={}){return{passive:e,capture:t}},transform(e){return e}},Bo=[`target`,`eventOptions`,`window`,`enabled`,`transform`];function Vo(e={},t){let n={};for(let[r,i]of Object.entries(t))switch(typeof i){case`function`:n[r]=i.call(n,e[r],r,e);break;case`object`:n[r]=Vo(e[r],i);break;case`boolean`:i&&(n[r]=e[r])}return n}function Ho(e,t,n={}){let r=e,{target:i,eventOptions:a,window:o,enabled:s,transform:c}=r,l=Ro(r,Bo);if(n.shared=Vo({target:i,eventOptions:a,window:o,enabled:s,transform:c},zo),t){let e=Po.get(t);n[t]=Vo(R({shared:n.shared},l),e)}else for(let e in l){let t=Po.get(e);t&&(n[e]=Vo(R({shared:n.shared},l[e]),t))}return n}var Uo=class{constructor(e,t){Ba(this,`_listeners`,new Set),this._ctrl=e,this._gestureKey=t}add(e,t,n,r,i){let a=this._listeners,o=Ya(t,n),s=R(R({},this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{}),i);e.addEventListener(o,r,s);let c=()=>{e.removeEventListener(o,r,s),a.delete(c)};return a.add(c),c}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}},Wo=class{constructor(){Ba(this,`_timeouts`,new Map)}add(e,t,n=140,...r){this.remove(e),this._timeouts.set(e,window.setTimeout(t,n,...r))}remove(e){let t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}},Go=class{constructor(e){Ba(this,`gestures`,new Set),Ba(this,`_targetEventStore`,new Uo(this)),Ba(this,`gestureEventStores`,{}),Ba(this,`gestureTimeoutStores`,{}),Ba(this,`handlers`,{}),Ba(this,`config`,{}),Ba(this,`pointerIds`,new Set),Ba(this,`touchIds`,new Set),Ba(this,`state`,{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),qo(this,e)}setEventIds(e){if(Xa(e))return this.touchIds=new Set(to(e)),this.touchIds;if(`pointerId`in e)return e.type===`pointerup`||e.type===`pointercancel`?this.pointerIds.delete(e.pointerId):e.type===`pointerdown`&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=Ho(e,t,this.config)}clean(){this._targetEventStore.clean();for(let e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){let t=this.config.shared,n={},r;if(!(t.target&&(r=t.target(),!r))){if(t.enabled){for(let t of this.gestures){let i=this.config[t],a=Jo(n,i.eventOptions,!!r);i.enabled&&new(No.get(t))(this,e,t).bind(a)}let i=Jo(n,t.eventOptions,!!r);for(let t in this.nativeHandlers)i(t,``,n=>this.nativeHandlers[t](R(R({},this.state.shared),{},{event:n,args:e})),void 0,!0)}for(let e in n)n[e]=so(...n[e]);if(!r)return n;for(let e in n){let{device:t,capture:i,passive:a}=Ja(e);this._targetEventStore.add(r,t,``,n[e],{capture:i,passive:a})}}}};function Ko(e,t){e.gestures.add(t),e.gestureEventStores[t]=new Uo(e,t),e.gestureTimeoutStores[t]=new Wo}function qo(e,t){t.drag&&Ko(e,`drag`),t.wheel&&Ko(e,`wheel`),t.scroll&&Ko(e,`scroll`),t.move&&Ko(e,`move`),t.pinch&&Ko(e,`pinch`),t.hover&&Ko(e,`hover`)}var Jo=(e,t,n)=>(r,i,a,o={},s=!1)=>{let c=o.capture??t.capture,l=o.passive??t.passive,u=s?r:Ka(r,i,c);n&&l&&(u+=`Passive`),e[u]=e[u]||[],e[u].push(a)};function Yo(e,t={},n,r){let i=M.useMemo(()=>new Go(e),[]);if(i.applyHandlers(e,r),i.applyConfig(t,n),M.useEffect(i.effect.bind(i)),M.useEffect(()=>i.clean.bind(i),[]),t.target===void 0)return i.bind.bind(i)}function Xo(e,t){return Fo(Io),Yo({drag:e},t||{},`drag`)}function Zo(){return Zo=Object.assign?Object.assign.bind():function(e){for(var t=1;t({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(e=>!e.empty)}),rs=class{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(e=>{try{e()}catch(e){console.error(`TimeoutLatch callback error:`,e)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}},is=class{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}},as=null,os=()=>typeof window>`u`?new is:(as||=new is,as),ss=d.theme({"& .cm-scroller":{height:`100% !important`}}),cs=null,ls=null;function us(e,t,n,r,i,a){if(!e&&!t&&!n&&!r&&!i&&!a)return null;var o=JSON.stringify({height:e,minHeight:t,maxHeight:n,width:r,minWidth:i,maxWidth:a});return o===cs?ls:(cs=o,ls=d.theme({"&":{height:e,minHeight:t,maxHeight:n,width:r,minWidth:i,maxWidth:a}}),ls)}var ds=u.define(),fs=200,ps=[];function ms(e){var t=e.value,n=e.selection,r=e.onChange,i=e.onStatistics,s=e.onCreateEditor,c=e.onUpdate,l=e.extensions,u=l===void 0?ps:l,f=e.autoFocus,p=e.theme,m=p===void 0?`light`:p,h=e.height,g=h===void 0?null:h,_=e.minHeight,v=_===void 0?null:_,y=e.maxHeight,b=y===void 0?null:y,x=e.width,S=x===void 0?null:x,C=e.minWidth,w=C===void 0?null:C,T=e.maxWidth,E=T===void 0?null:T,ee=e.placeholder,D=ee===void 0?``:ee,O=e.editable,te=O===void 0||O,ne=e.readOnly,re=ne!==void 0&&ne,k=e.indentWithTab,A=k===void 0||k,ie=e.basicSetup,ae=ie===void 0||ie,oe=e.root,se=e.initialState,ce=(0,M.useState)(),le=ce[0],ue=ce[1],de=(0,M.useState)(),j=de[0],fe=de[1],pe=(0,M.useState)(),me=pe[0],he=pe[1],N=(0,M.useState)(()=>({current:null}))[0],ge=(0,M.useState)(()=>({current:null}))[0],P=us(g,v,b,S,w,E),_e=d.updateListener.of(e=>{e.docChanged&&typeof r==`function`&&!e.transactions.some(e=>e.annotation(ds))&&(N.current?N.current.reset():(N.current=new rs(()=>{if(ge.current){var e=ge.current;ge.current=null,e()}N.current=null},fs),os().add(N.current)),r(e.state.doc.toString(),e)),i&&i(ns(e))}),ve=ts({theme:m,editable:te,readOnly:re,placeholder:D,indentWithTab:A,basicSetup:ae}),ye=[_e,...P?[P]:[],ss,...ve];return c&&typeof c==`function`&&ye.push(d.updateListener.of(c)),ye=ye.concat(u),(0,M.useLayoutEffect)(()=>{if(le&&!me){var e={doc:t,selection:n,extensions:ye},r=se?a.fromJSON(se.json,e,se.fields):a.create(e);if(he(r),!j){var i=new d({state:r,parent:le,root:oe});fe(i),s&&s(i,r)}}return()=>{j&&(he(void 0),fe(void 0))}},[le,me]),(0,M.useEffect)(()=>{e.container&&ue(e.container)},[e.container]),(0,M.useEffect)(()=>()=>{j&&(j.destroy(),fe(void 0)),N.current&&=(N.current.cancel(),null)},[j]),(0,M.useEffect)(()=>{f&&j&&j.focus()},[f,j]),(0,M.useEffect)(()=>{j&&j.dispatch({effects:o.reconfigure.of(ye)})},[m,u,g,v,b,S,w,E,D,te,re,A,ae,r,c]),(0,M.useEffect)(()=>{if(t!==void 0){var e=j?j.state.doc.toString():``;if(j&&t!==e){var n=N.current&&!N.current.isDone,r=()=>{j&&t!==j.state.doc.toString()&&j.dispatch({changes:{from:0,to:j.state.doc.toString().length,insert:t||``},annotations:[ds.of(!0)]})};n?ge.current=r:r()}}},[t,j]),{state:me,setState:he,view:j,setView:fe,container:le,setContainer:ue}}var hs=[`className`,`value`,`selection`,`extensions`,`onChange`,`onStatistics`,`onCreateEditor`,`onUpdate`,`autoFocus`,`theme`,`height`,`minHeight`,`maxHeight`,`width`,`minWidth`,`maxWidth`,`basicSetup`,`placeholder`,`indentWithTab`,`editable`,`readOnly`,`root`,`initialState`],gs=(0,M.forwardRef)((e,t)=>{var n=e.className,r=e.value,i=r===void 0?``:r,a=e.selection,o=e.extensions,s=o===void 0?[]:o,c=e.onChange,l=e.onStatistics,u=e.onCreateEditor,d=e.onUpdate,f=e.autoFocus,p=e.theme,m=p===void 0?`light`:p,h=e.height,g=e.minHeight,_=e.maxHeight,v=e.width,y=e.minWidth,b=e.maxWidth,x=e.basicSetup,S=e.placeholder,C=e.indentWithTab,w=e.editable,T=e.readOnly,E=e.root,ee=e.initialState,D=Qo(e,hs),O=(0,M.useRef)(null),te=ms({root:E,value:i,autoFocus:f,theme:m,height:h,minHeight:g,maxHeight:_,width:v,minWidth:y,maxWidth:b,basicSetup:x,placeholder:S,indentWithTab:C,editable:w,readOnly:T,selection:a,onChange:c,onStatistics:l,onCreateEditor:u,onUpdate:d,extensions:s,initialState:ee}),ne=te.state,re=te.view,k=te.container,A=te.setContainer;(0,M.useImperativeHandle)(t,()=>({editor:O.current,state:ne,view:re}),[O,k,ne,re]);var ie=(0,M.useCallback)(e=>{O.current=e,A(e)},[A]);if(typeof i!=`string`)throw Error(`value must be typeof string but got `+typeof i);var ae=typeof m==`string`?`cm-theme-`+m:`cm-theme`;return(0,ln.jsx)(`div`,Zo({ref:ie,className:``+ae+(n?` `+n:``)},D))});gs.displayName=`CodeMirror`;export{L as $,aa as A,Mr as At,Yi as B,fa as C,mi as Ct,ca as D,zr as Dt,la as E,ni as Et,ea as F,ar as Ft,Wi as G,qi as H,$i as I,qn as It,Vi as J,Ui as K,Qi as L,fe as Lt,ra as M,Xr as Mt,na as N,or as Nt,sa as O,Wr as Ot,ta as P,ir as Pt,Li as Q,Zi as R,de as Rt,pa as S,hi as St,ua as T,fi as Tt,Ki as U,Ji as V,Gi as W,zi as X,Bi as Y,Ri as Z,va as _,bi as _t,Aa as a,Mi as at,ha as b,_i as bt,Da as c,ki as ct,wa as d,Ei as dt,I as et,Ca as f,Ti as ft,ya as g,xi as gt,ba as h,Si as ht,ja as i,Ni as it,ia as j,Jr as jt,oa as k,Kr as kt,Ea as l,Oi as lt,xa as m,Ci as mt,Xo as n,Fi as nt,ka as o,ji as ot,Sa as p,wi as pt,Hi as q,Ma as r,Pi as rt,Oa as s,Ai as st,gs as t,Ii as tt,Ta as u,Di as ut,_a as v,yi as vt,da as w,pi as wt,ma as x,gi as xt,ga as y,vi as yt,Xi as z,ae as zt}; \ No newline at end of file diff --git a/algospaced-ui/dist/assets/vendor-react-qmUj3JUi.js b/algospaced-ui/dist/assets/vendor-react-qmUj3JUi.js deleted file mode 100644 index 9b02a73e45c17587777c4da135b4b790f59f235f..0000000000000000000000000000000000000000 --- a/algospaced-ui/dist/assets/vendor-react-qmUj3JUi.js +++ /dev/null @@ -1,9 +0,0 @@ -import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{A as n,D as r,E as i,F as a,L as o,M as s,N as c,O as l,P as u,S as d,T as f,_ as p,a as m,b as h,c as g,d as _,f as v,g as y,h as b,i as x,j as S,k as C,l as w,m as T,n as E,o as ee,p as D,r as O,s as te,u as ne,v as re,w as k,y as A}from"./vendor-codemirror-By0wlJeM.js";var ie=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ee(e,t){return E(e.type,t,e.props)}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var te=/\/+/g;function ne(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function re(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function k(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,k(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ne(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(te,`$&/`)+`/`),k(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=ee(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(te,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=ie()})),oe=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,D());else{var t=n(l);t!==null&&ne(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-Tt&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ne(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?D():S=!1}}}var D;if(typeof y==`function`)D=function(){y(ee)};else if(typeof MessageChannel<`u`){var O=new MessageChannel,te=O.port2;O.port1.onmessage=ee,D=function(){te.postMessage(null)}}else D=function(){_(ee,0)};function ne(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ne(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,D()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),se=t(((e,t)=>{t.exports=oe()})),ce=t((e=>{var t=ae();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=ce()})),ue=t((e=>{var t=se(),n=ae(),r=le();function i(e){var t=`https://react.dev/errors/`+e;if(1ce||(e.current=oe[ce],oe[ce]=null,ce--)}function j(e,t){ce++,oe[ce]=e.current,e.current=t}var fe=ue(null),M=ue(null),pe=ue(null),me=ue(null);function he(e,t){switch(j(pe,t),j(M,e),j(fe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}de(fe),j(fe,e)}function N(){de(fe),de(M),de(pe)}function ge(e){e.memoizedState!==null&&j(me,e);var t=fe.current,n=Hd(t,e.type);t!==n&&(j(M,e),j(fe,n))}function P(e){M.current===e&&(de(fe),de(M)),me.current===e&&(de(me),Qf._currentValue=ie)}var _e,ve;function ye(e){if(_e===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_e=t&&t[1]||``,ve=-1)`:-1i||c[r]!==l[i]){var u=` -`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{be=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ye(n):``}function Se(e,t){switch(e.tag){case 26:case 27:case 5:return ye(e.type);case 16:return ye(`Lazy`);case 13:return e.child!==t&&t!==null?ye(`Suspense Fallback`):ye(`Suspense`);case 19:return ye(`SuspenseList`);case 0:case 15:return xe(e.type,!1);case 11:return xe(e.type.render,!1);case 1:return xe(e.type,!0);case 31:return ye(`Activity`);default:return``}}function Ce(e){try{var t=``,n=null;do t+=Se(e,n),n=e,e=e.return;while(e);return t}catch(e){return` -Error generating stack: `+e.message+` -`+e.stack}}var we=Object.prototype.hasOwnProperty,Te=t.unstable_scheduleCallback,Ee=t.unstable_cancelCallback,De=t.unstable_shouldYield,Oe=t.unstable_requestPaint,ke=t.unstable_now,Ae=t.unstable_getCurrentPriorityLevel,je=t.unstable_ImmediatePriority,Me=t.unstable_UserBlockingPriority,Ne=t.unstable_NormalPriority,Pe=t.unstable_LowPriority,Fe=t.unstable_IdlePriority,Ie=t.log,Le=t.unstable_setDisableYieldValue,Re=null,ze=null;function Be(e){if(typeof Ie==`function`&&Le(e),ze&&typeof ze.setStrictMode==`function`)try{ze.setStrictMode(Re,e)}catch{}}var Ve=Math.clz32?Math.clz32:We,He=Math.log,Ue=Math.LN2;function We(e){return e>>>=0,e===0?32:31-(He(e)/Ue|0)|0}var Ge=256,Ke=262144,qe=4194304;function Je(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ye(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Je(n))):i=Je(o):i=Je(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Je(n))):i=Je(o)):i=Je(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Xe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ze(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Qe(){var e=qe;return qe<<=1,!(qe&62914560)&&(qe=4194304),e}function $e(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function et(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function tt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),mn=!1;if(pn)try{var hn={};Object.defineProperty(hn,"passive",{get:function(){mn=!0}}),window.addEventListener(`test`,hn,hn),window.removeEventListener(`test`,hn,hn)}catch{mn=!1}var gn=null,_n=null,vn=null;function yn(){if(vn)return vn;var e,t=_n,n=t.length,r,i=`value`in gn?gn.value:gn.textContent,a=i.length;for(e=0;e=Zn),er=` `,tr=!1;function nr(e,t){switch(e){case`keyup`:return Yn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function rr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var ir=!1;function ar(e,t){switch(e){case`compositionend`:return rr(t);case`keypress`:return t.which===32?(tr=!0,er):null;case`textInput`:return e=t.data,e===er&&tr?null:e;default:return null}}function or(e,t){if(ir)return e===`compositionend`||!Xn&&nr(e,t)?(e=yn(),vn=_n=gn=null,ir=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Or(n)}}function Ar(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ar(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function jr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Bt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Bt(e.document)}return t}function Mr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Nr=pn&&`documentMode`in document&&11>=document.documentMode,Pr=null,Fr=null,Ir=null,Lr=!1;function Rr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Lr||Pr==null||Pr!==Bt(r)||(r=Pr,`selectionStart`in r&&Mr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ir&&Dr(Ir,r)||(Ir=r,r=Ed(Fr,`onSelect`),0>=o,i-=o,ki=1<<32-Ve(t)+i|n<m?(h=d,d=null):h=d.sibling;var g=p(i,d,s[m],c);if(g===null){d===null&&(d=h);break}e&&d&&g.alternate===null&&t(i,d),a=o(g,a,m),u===null?l=g:u.sibling=g,u=g,d=h}if(m===s.length)return n(i,d),L&&ji(i,m),l;if(d===null){for(;mh?(g=m,m=null):g=m.sibling;var y=p(a,m,v.value,l);if(y===null){m===null&&(m=g);break}e&&m&&y.alternate===null&&t(a,m),s=o(y,s,h),d===null?u=y:d.sibling=y,d=y,m=g}if(v.done)return n(a,m),L&&ji(a,h),u;if(m===null){for(;!v.done;h++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return L&&ji(a,h),u}for(m=r(m);!v.done;h++,v=c.next())v=_(m,a,h,v.value,l),v!==null&&(e&&v.alternate!==null&&m.delete(v.key===null?h:v.key),s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return e&&m.forEach(function(e){return t(a,e)}),L&&ji(a,h),u}function x(e,r,o,c){if(typeof o==`object`&&o&&o.type===g&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===g){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===T&&Aa(l)===r.type){n(e,r.sibling),c=a(r,o.props),Ia(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===g?(c=gi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=hi(o.type,o.key,o.props,null,e.mode,c),Ia(c,o),c.return=e,e=c)}return s(e);case h:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=yi(o,e.mode,c),c.return=e,e=c}return s(e);case T:return o=Aa(o),x(e,r,o,c)}if(re(o))return v(e,r,o,c);if(O(o)){if(l=O(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return x(e,r,Fa(o),c);if(o.$$typeof===b)return x(e,r,ia(e,o),c);La(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=_i(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Pa=0;var i=x(e,t,n,r);return R=null,i}catch(t){if(t===wa||t===Ea)throw t;var a=di(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var za=Ra(!0),Ba=Ra(!1),z=!1;function Va(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ha(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ua(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Wa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,K&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ci(e),si(e,null,n),t}return ai(e,r,t,n),ci(e)}function Ga(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,rt(e,n)}}function Ka(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var qa=!1;function Ja(){if(qa){var e=ha;if(e!==null)throw e}}function Ya(e,t,n,r){qa=!1;var i=e.updateQueue;z=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(Y&p)===p:(r&p)===p){p!==0&&p===ma&&(qa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:z=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Gl|=o,e.lanes=o,e.memoizedState=d}}function Xa(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Za(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=k.T,s={};k.T=s,Ps(e,!1,t,n);try{var c=i(),l=k.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ns(e,t,va(c,r),pu(e)):Ns(e,t,r,pu(e))}catch(n){Ns(e,t,{then:function(){},status:`rejected`,reason:n},pu())}finally{A.p=a,o!==null&&s.types!==null&&(o.types=s.types),k.T=o}}function Cs(){}function ws(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Ts(e).queue;Ss(e,a,t,ie,n===null?Cs:function(){return Es(e),n(r)})}function Ts(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fo,lastRenderedState:ie},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Es(e){var t=Ts(e);t.next===null&&(t=e.alternate.memoizedState),Ns(e,t.next.queue,{},pu())}function Ds(){return ra(Qf)}function Os(){return U().memoizedState}function ks(){return U().memoizedState}function As(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=pu();e=Ua(n);var r=Wa(t,e,n);r!==null&&(hu(r,t,n),Ga(r,t,n)),t={cache:ua()},e.payload=t;return}t=t.return}}function js(e,t,n){var r=pu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Fs(e)?Is(t,n):(n=F(e,t,n,r),n!==null&&(hu(n,e,r),Ls(n,t,r)))}function Ms(e,t,n){Ns(e,t,n,pu())}function Ns(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Fs(e))Is(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Er(s,o))return ai(e,t,i,0),q===null&&ii(),!1}catch{}if(n=F(e,t,i,r),n!==null)return hu(n,e,r),Ls(n,t,r),!0}return!1}function Ps(e,t,n,r){if(r={lane:2,revertLane:dd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Fs(e)){if(t)throw Error(i(479))}else t=F(e,n,r,2),t!==null&&hu(t,e,2)}function Fs(e){var t=e.alternate;return e===B||t!==null&&t===B}function Is(e,t){go=ho=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ls(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,rt(e,n)}}var Rs={readContext:ra,use:No,useCallback:H,useContext:H,useEffect:H,useImperativeHandle:H,useLayoutEffect:H,useInsertionEffect:H,useMemo:H,useReducer:H,useRef:H,useState:H,useDebugValue:H,useDeferredValue:H,useTransition:H,useSyncExternalStore:H,useId:H,useHostTransitionStatus:H,useFormState:H,useActionState:H,useOptimistic:H,useMemoCache:H,useCacheRefresh:H};Rs.useEffectEvent=H;var zs={readContext:ra,use:No,useCallback:function(e,t){return Ao().memoizedState=[e,t===void 0?null:t],e},useContext:ra,useEffect:ls,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ss(4194308,4,hs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ss(4194308,4,e,t)},useInsertionEffect:function(e,t){ss(4,2,e,t)},useMemo:function(e,t){var n=Ao();t=t===void 0?null:t;var r=e();if(_o){Be(!0);try{e()}finally{Be(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Ao();if(n!==void 0){var i=n(t);if(_o){Be(!0);try{n(t)}finally{Be(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=js.bind(null,B,e),[r.memoizedState,e]},useRef:function(e){var t=Ao();return e={current:e},t.memoizedState=e},useState:function(e){e=Go(e);var t=e.queue,n=Ms.bind(null,B,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:_s,useDeferredValue:function(e,t){return bs(Ao(),e,t)},useTransition:function(){var e=Go(!1);return e=Ss.bind(null,B,e.queue,!0,!1),Ao().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=B,a=Ao();if(L){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),q===null)throw Error(i(349));Y&127||Bo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ls(Ho.bind(null,r,o,e),[e]),r.flags|=2048,as(9,{destroy:void 0},Vo.bind(null,r,o,n,t),null),n},useId:function(){var e=Ao(),t=q.identifierPrefix;if(L){var n=Ai,r=ki;n=(r&~(1<<32-Ve(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=vo++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[ut]=t,o[dt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Pd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Nc(t)}}return W(t),Pc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Nc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=pe.current,Ui(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ii,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[ut]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Md(e.nodeValue,n)),e||Bi(t,!0)}else e=Bd(e).createTextNode(r),e[ut]=t,t.stateNode=e}return W(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ui(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[ut]=t}else Wi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;W(t),e=!1}else n=Gi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(lo(t),t):(lo(t),null);if(t.flags&128)throw Error(i(558))}return W(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Ui(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[ut]=t}else Wi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;W(t),a=!1}else a=Gi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(lo(t),t):(lo(t),null)}return lo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Ic(t,t.updateQueue),W(t),null);case 4:return N(),e===null&&Sd(t.stateNode.containerInfo),W(t),null;case 10:return Zi(t.type),W(t),null;case 19:if(de(uo),r=t.memoizedState,r===null)return W(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Lc(r,!1);else{if(Wl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=fo(e),o!==null){for(t.flags|=128,Lc(r,!1),e=o.updateQueue,t.updateQueue=e,Ic(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)mi(n,e),n=n.sibling;return j(uo,uo.current&1|2),L&&ji(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ke()>tu&&(t.flags|=128,a=!0,Lc(r,!1),t.lanes=4194304)}}else{if(!a){if(e=fo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Ic(t,e),Lc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!L)return W(t),null}else 2*ke()-r.renderingStartTime>tu&&n!==536870912&&(t.flags|=128,a=!0,Lc(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(W(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ke(),e.sibling=null,n=uo.current,j(uo,a?n&1|2:n&1),L&&ji(t,r.treeForkCount),e);case 22:case 23:return lo(t),no(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(W(t),t.subtreeFlags&6&&(t.flags|=8192)):W(t),n=t.updateQueue,n!==null&&Ic(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&de(ba),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Zi(la),W(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function zc(e,t){switch(Pi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Zi(la),N(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return P(t),null;case 31:if(t.memoizedState!==null){if(lo(t),t.alternate===null)throw Error(i(340));Wi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(lo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Wi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return de(uo),null;case 4:return N(),null;case 10:return Zi(t.type),null;case 22:case 23:return lo(t),no(),e!==null&&de(ba),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Zi(la),null;case 25:return null;default:return null}}function Bc(e,t){switch(Pi(t),t.tag){case 3:Zi(la),N();break;case 26:case 27:case 5:P(t);break;case 4:N();break;case 31:t.memoizedState!==null&&lo(t);break;case 13:lo(t);break;case 19:de(uo);break;case 10:Zi(t.type);break;case 22:case 23:lo(t),no(),e!==null&&de(ba);break;case 24:Zi(la)}}function Vc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Z(t,t.return,e)}}function Hc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Z(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Z(t,t.return,e)}}function Uc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Za(t,n)}catch(t){Z(e,e.return,t)}}}function Wc(e,t,n){n.props=Ks(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Z(e,t,n)}}function Gc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Z(e,t,n)}}function Kc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Z(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Z(e,t,n)}else n.current=null}}function qc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Z(e,e.return,t)}}function Jc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[dt]=t}catch(t){Z(e,e.return,t)}}function Yc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Xc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Yc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Zc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=rn));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Zc(e,t,n),e=e.sibling;e!==null;)Zc(e,t,n),e=e.sibling}function Qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Qc(e,t,n),e=e.sibling;e!==null;)Qc(e,t,n),e=e.sibling}function $c(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[ut]=e,t[dt]=n}catch(t){Z(e,e.return,t)}}var el=!1,tl=!1,nl=!1,rl=typeof WeakSet==`function`?WeakSet:Set,il=null;function al(e,t){if(e=e.containerInfo,Rd=sp,e=jr(e),Mr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,il=t;il!==null;)if(t=il,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,il=e;else for(;il!==null;){switch(t=il,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Pd(o,r,n),o[ut]=e,Ct(o),r=o;break a;case`link`:var s=Vf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=kr(s,h),v=kr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,k.T=null,n=lu,lu=null;var o=au,s=su;if(iu=0,ou=au=null,su=0,K&6)throw Error(i(331));var c=K;if(K|=4,Pl(o.current),El(o,o.current,s,n),K=c,id(0,!1),ze&&typeof ze.onPostCommitFiberRoot==`function`)try{ze.onPostCommitFiberRoot(Re,o)}catch{}return!0}finally{A.p=a,k.T=r,Vu(e,t)}}function Wu(e,t,n){t=xi(n,t),t=Qs(e.stateNode,t,2),e=Wa(e,t,2),e!==null&&(et(e,2),rd(e))}function Z(e,t,n){if(e.tag===3)Wu(e,e,n);else for(;t!==null;){if(t.tag===3){Wu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ru===null||!ru.has(r))){e=xi(n,e),n=$s(2),r=Wa(t,n,2),r!==null&&(ec(n,r,t,e),et(r,2),rd(r));break}}t=t.return}}function Gu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Rl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Hl=!0,i.add(n),e=Ku.bind(null,e,t,n),t.then(e,e))}function Ku(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,q===e&&(Y&n)===n&&(Wl===4||Wl===3&&(Y&62914560)===Y&&300>ke()-$l?!(K&2)&&Su(e,0):ql|=n,Yl===Y&&(Yl=0)),rd(e)}function qu(e,t){t===0&&(t=Qe()),e=oi(e,t),e!==null&&(et(e,t),rd(e))}function Ju(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),qu(e,n)}function Yu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),qu(e,n)}function Xu(e,t){return Te(e,t)}var Zu=null,Qu=null,$u=!1,ed=!1,td=!1,nd=0;function rd(e){e!==Qu&&e.next===null&&(Qu===null?Zu=Qu=e:Qu=Qu.next=e),ed=!0,$u||($u=!0,ud())}function id(e,t){if(!td&&ed){td=!0;do for(var n=!1,r=Zu;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ve(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,ld(r,a))}else a=Y,a=Ye(r,r===q?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Xe(r,a)||(n=!0,ld(r,a))}r=r.next}while(n);td=!1}}function ad(){od()}function od(){ed=$u=!1;var e=0;nd!==0&&Gd()&&(e=nd);for(var t=ke(),n=null,r=Zu;r!==null;){var i=r.next,a=sd(r,t);a===0?(r.next=null,n===null?Zu=i:n.next=i,i===null&&(Qu=n)):(n=r,(e!==0||a&3)&&(ed=!0)),r=i}iu!==0&&iu!==5||id(e,!1),nd!==0&&(nd=0)}function sd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Ht(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),Ct(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Ht(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Ht(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Ht(n.imageSizes)+`"]`)):i+=`[href="`+Ht(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),Ct(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Ht(r)+`"][href="`+Ht(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),Ct(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=St(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);Ct(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=St(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=f({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),Ct(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=St(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),Ct(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var a=(a=pe.current)?gf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=St(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=St(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=St(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Af(e){return`href="`+Ht(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),Ct(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Ht(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Ht(n.href)+`"]`);if(r)return t.instance=r,Ct(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Ct(r),Pd(r,`style`,a),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Af(n.href);var o=e.querySelector(jf(a));if(o)return t.state.loading|=4,t.instance=o,Ct(o),o;r=Mf(n),(a=mf.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),Ct(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(a=e.querySelector(Ff(o)))?(t.instance=a,Ct(a),a):(r=n,(a=mf.get(o))&&(r=f({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Ct(a),Pd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Ct(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),Ct(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=ue()})),j=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),fe=t(((e,t)=>{t.exports=j()})),M=e(ae(),1);function pe(){return typeof window<`u`}function me(e){return ge(e)?(e.nodeName||``).toLowerCase():`#document`}function he(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function N(e){return((ge(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ge(e){return pe()?e instanceof Node||e instanceof he(e).Node:!1}function P(e){return pe()?e instanceof Element||e instanceof he(e).Element:!1}function _e(e){return pe()?e instanceof HTMLElement||e instanceof he(e).HTMLElement:!1}function ve(e){return!pe()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof he(e).ShadowRoot}function ye(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Ae(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function be(e){return/^(table|td|th)$/.test(me(e))}function xe(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Se=/transform|translate|scale|rotate|perspective|filter/,Ce=/paint|layout|strict|content/,we=e=>!!e&&e!==`none`,Te;function Ee(e){let t=P(e)?Ae(e):e;return we(t.transform)||we(t.translate)||we(t.scale)||we(t.rotate)||we(t.perspective)||!Oe()&&(we(t.backdropFilter)||we(t.filter))||Se.test(t.willChange||``)||Ce.test(t.contain||``)}function De(e){let t=Me(e);for(;_e(t)&&!ke(t);){if(Ee(t))return t;if(xe(t))return null;t=Me(t)}return null}function Oe(){return Te??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Te}function ke(e){return/^(html|body|#document)$/.test(me(e))}function Ae(e){return he(e).getComputedStyle(e)}function je(e){return P(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Me(e){if(me(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ve(e)&&e.host||N(e);return ve(t)?t.host:t}function Ne(e){let t=Me(e);return ke(t)?(e.ownerDocument||e).body:_e(t)&&ye(t)?t:Ne(t)}function Pe(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ne(e),i=r===e.ownerDocument?.body,a=he(r);if(i){let e=Fe(a);return t.concat(a,a.visualViewport||[],ye(r)?r:[],e&&n?Pe(e):[])}return t.concat(r,Pe(r,[],n))}function Fe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Ie=Math.min,Le=Math.max,Re=Math.round,ze=Math.floor,Be=e=>({x:e,y:e}),Ve={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function He(e,t,n){return Le(e,Ie(t,n))}function Ue(e,t){return typeof e==`function`?e(t):e}function We(e){return e.split(`-`)[0]}function Ge(e){return e.split(`-`)[1]}function Ke(e){return e===`x`?`y`:`x`}function qe(e){return e===`y`?`height`:`width`}function Je(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ye(e){return Ke(Je(e))}function Xe(e,t,n){n===void 0&&(n=!1);let r=Ge(e),i=Ye(e),a=qe(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=at(o)),[o,at(o)]}function Ze(e){let t=at(e);return[Qe(e),t,Qe(t)]}function Qe(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var $e=[`left`,`right`],et=[`right`,`left`],tt=[`top`,`bottom`],nt=[`bottom`,`top`];function rt(e,t,n){switch(e){case`top`:case`bottom`:return n?t?et:$e:t?$e:et;case`left`:case`right`:return t?tt:nt;default:return[]}}function it(e,t,n,r){let i=Ge(e),a=rt(We(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Qe)))),a}function at(e){let t=We(e);return Ve[t]+e.slice(t.length)}function ot(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function st(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ot(e)}function ct(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}var lt=[`input:not([inert]):not([inert] *)`,`select:not([inert]):not([inert] *)`,`textarea:not([inert]):not([inert] *)`,`a[href]:not([inert]):not([inert] *)`,`area[href]:not([inert]):not([inert] *)`,`button:not([inert]):not([inert] *)`,`[tabindex]:not(slot):not([inert]):not([inert] *)`,`audio[controls]:not([inert]):not([inert] *)`,`video[controls]:not([inert]):not([inert] *)`,`[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)`,`details>summary:first-of-type:not([inert]):not([inert] *)`,`details:not([inert]):not([inert] *)`].join(`,`),ut=typeof Element>`u`,dt=ut?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ft=!ut&&Element.prototype.getRootNode?function(e){return e?.getRootNode?.call(e)}:function(e){return e?.ownerDocument},pt=function(e,t){t===void 0&&(t=!0);var n=e?.getAttribute?.call(e,`inert`);return n===``||n===`true`||t&&e&&(typeof e.closest==`function`?e.closest(`[inert]`):pt(e.parentNode))},mt=function(e){var t=e?.getAttribute?.call(e,`contenteditable`);return t===``||t===`true`},ht=function(e,t,n){if(pt(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(lt));return t&&dt.call(e,lt)&&r.unshift(e),r=r.filter(n),r},gt=function(e,t,n){for(var r=[],i=Array.from(e);i.length;){var a=i.shift();if(!pt(a,!1)){if(a.tagName===`SLOT`){var o=a.assignedElements(),s=gt(o.length?o:a.children,!0,n);n.flatten?r.push.apply(r,s):r.push({scopeParent:a,candidates:s})}else{dt.call(a,lt)&&n.filter(a)&&(t||!e.includes(a))&&r.push(a);var c=a.shadowRoot||typeof n.getShadowRoot==`function`&&n.getShadowRoot(a),l=!pt(c,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(a));if(c&&l){var u=gt(c===!0?a.children:c.children,!0,n);n.flatten?r.push.apply(r,u):r.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}}return r},_t=function(e){return!isNaN(parseInt(e.getAttribute(`tabindex`),10))},vt=function(e){if(!e)throw Error(`No node provided`);return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||mt(e))&&!_t(e)?0:e.tabIndex},yt=function(e,t){var n=vt(e);return n<0&&t&&!_t(e)?0:n},bt=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},xt=function(e){return e.tagName===`INPUT`},St=function(e){return xt(e)&&e.type===`hidden`},Ct=function(e){return e.tagName===`DETAILS`&&Array.prototype.slice.apply(e.children).some(function(e){return e.tagName===`SUMMARY`})},wt=function(e,t){for(var n=0;nsummary:first-of-type`)?e.parentElement:e;if(dt.call(a,`details:not([open]) *`))return!0;if(!n||n===`full`||n===`full-native`||n===`legacy-full`){if(typeof r==`function`){for(var o=e;e;){var s=e.parentElement,c=ft(e);if(s&&!s.shadowRoot&&r(s)===!0)return kt(e);e=e.assignedSlot?e.assignedSlot:!s&&c!==e.ownerDocument?c.host:s}e=o}if(Ot(e))return!e.getClientRects().length;if(n!==`legacy-full`)return!0}else if(n===`non-zero-area`)return kt(e);return!1},jt=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName===`FIELDSET`&&t.disabled){for(var n=0;n=0)},Ft=function(e){var t=[],n=[];return e.forEach(function(e,r){var i=!!e.scopeParent,a=i?e.scopeParent:e,o=yt(a,i),s=i?Ft(e.candidates):a;o===0?i?t.push.apply(t,s):t.push(a):n.push({documentOrder:r,tabIndex:o,item:e,isScope:i,content:s})}),n.sort(bt).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},It=function(e,t){return t||={},Ft(t.getShadowRoot?gt([e],t.includeContainer,{filter:Nt.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Pt}):ht(e,t.includeContainer,Nt.bind(null,t)))};function Lt(){return/apple/i.test(navigator.vendor)}var Rt=`data-floating-ui-focusable`;function zt(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function Bt(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&ve(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Vt(e){return`composedPath`in e?e.composedPath()[0]:e.target}function Ht(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function Ut(e){return e.matches(`html,body`)}function Wt(e){return e?.ownerDocument||document}function Gt(e){return e?e.hasAttribute(Rt)?e:e.querySelector(`[`+Rt+`]`)||e:null}function Kt(e,t,n){return n===void 0&&(n=!0),e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...Kt(e,t.id,n)])}function qt(e){return`nativeEvent`in e}function Jt(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}var Yt=typeof document<`u`?M.useLayoutEffect:function(){},Xt={...M};function Zt(e){let t=M.useRef(e);return Yt(()=>{t.current=e}),t}var Qt=Xt.useInsertionEffect||(e=>e());function $t(e){let t=M.useRef(()=>{});return Qt(()=>{t.current=e}),M.useCallback(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}var en=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver==`function`&&ResizeObserver.toString().includes(`[native code]`)?`full`:`none`});function tn(e,t){let n=It(e,en()),r=n.length;if(r===0)return;let i=zt(Wt(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function nn(e){return tn(Wt(e).body,1)||e}function rn(e){return tn(Wt(e).body,-1)||e}function an(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Bt(n,r)}function on(e){It(e,en()).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function sn(e){e.querySelectorAll(`[data-tabindex]`).forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var cn=e(le(),1),ln=fe();function un(e,t,n){let{reference:r,floating:i}=e,a=Je(t),o=Ye(t),s=qe(o),c=We(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Ge(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function dn(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Ue(t,e),p=st(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=ct(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=ct(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var fn=50,pn=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:dn},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=un(l,r,c),f=r,p=0,m={};for(let n=0;ne<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Je(t)||T.every(e=>Je(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Je(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},hn=new Set([`left`,`top`]);async function gn(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=We(n),s=Ge(n),c=Je(n)===`y`,l=hn.has(o)?-1:1,u=a&&c?-1:1,d=Ue(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var _n=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await gn(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},vn=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Ue(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Je(i),p=Ke(f),m=u[p],h=u[f],g=(e,t)=>He(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}};function yn(e){let t=Ae(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=_e(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Re(n)!==a||Re(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function bn(e){return P(e)?e:e.contextElement}function xn(e){let t=bn(e);if(!_e(t))return Be(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=yn(t),o=(a?Re(n.width):n.width)/r,s=(a?Re(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Sn=Be(0);function Cn(e){let t=he(e);return!Oe()||!t.visualViewport?Sn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function wn(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===he(e)}function Tn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=bn(e),o=Be(1);t&&(r?P(r)&&(o=xn(r)):o=xn(e));let s=wn(a,n,r)?Cn(a):Be(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=he(a),t=P(r)?he(r):r,n=e,i=Fe(n);for(;i&&t!==n;){let e=xn(i),t=i.getBoundingClientRect(),r=Ae(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=he(i),i=Fe(n)}}return ct({width:u,height:d,x:c,y:l})}function En(e,t){let n=je(e).scrollLeft;return t?t.left+n:Tn(N(e)).left+n}function Dn(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-En(e,n),y:n.top+t.scrollTop}}function On(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=N(r),s=t?xe(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Be(1),u=Be(0),d=_e(r);if((d||!a)&&((me(r)!==`body`||ye(o))&&(c=je(r)),d)){let e=Tn(r);l=xn(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Dn(o,c):Be(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function kn(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function An(e){let t=je(e),n=e.ownerDocument.body,r=Le(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Le(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+En(e),o=-t.scrollTop;return Ae(n).direction===`rtl`&&(a+=Le(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var jn=25;function Mn(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=he(e),a=N(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Oe()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(En(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=jn&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Nn(e,t){let n=Tn(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=xn(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Pn(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Mn(e,n,t);else if(t===`document`)r=An(N(e));else if(P(t))r=Nn(t,n);else{let n=Cn(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ct(r)}function Fn(e,t){let n=t.get(e);if(n)return n;let r=Pe(e,[],!1).filter(e=>P(e)&&me(e)!==`body`),i=null,a=Ae(e).position===`fixed`,o=a?Me(e):e;for(;P(o)&&!ke(o);){let e=Ae(o),t=Ee(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Me(o)}return t.set(e,r),r}function In(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?xe(t)?[]:Fn(t,this._c):[].concat(n),r],o=Pn(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=he(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function qn(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=bn(e),u=i||a?[...l?Pe(l):[],...t?Pe(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Kn(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Tn(e):null;c&&g();function g(){let t=Tn(e);h&&!Gn(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Jn=_n,Yn=vn,Xn=mn,Zn=(e,t,n)=>{let r=new Map,i=n??{},a={...Wn,...i.platform,_c:r};return pn(e,t,{...i,platform:a})},Qn=typeof document<`u`?M.useLayoutEffect:function(){};function $n(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!$n(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!$n(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function er(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function tr(e,t){let n=er(e);return Math.round(t*n)/n}function nr(e){let t=M.useRef(e);return Qn(()=>{t.current=e}),t}function rr(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=M.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=M.useState(r);$n(f,r)||p(r);let[m,h]=M.useState(null),[g,_]=M.useState(null),v=M.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=M.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=M.useRef(null),C=M.useRef(null),w=M.useRef(u),T=c!=null,E=nr(c),ee=nr(i),D=nr(l),O=M.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};ee.current&&(e.platform=ee.current),Zn(S.current,C.current,e).then(e=>{let t={...e,isPositioned:D.current!==!1};te.current&&!$n(w.current,t)&&(w.current=t,cn.flushSync(()=>{d(t)}))})},[f,t,n,ee,D]);Qn(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let te=M.useRef(!1);Qn(()=>(te.current=!0,()=>{te.current=!1}),[]),Qn(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,O);O()}},[b,x,O,E,T]);let ne=M.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),re=M.useMemo(()=>({reference:b,floating:x}),[b,x]),k=M.useMemo(()=>{let e={position:n,left:0,top:0};if(!re.floating)return e;let t=tr(re.floating,u.x),r=tr(re.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...er(re.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,re.floating,u.x,u.y]);return M.useMemo(()=>({...u,update:O,refs:ne,elements:re,floatingStyles:k}),[u,O,ne,re,k])}var ir=(e,t)=>{let n=Jn(e);return{name:n.name,fn:n.fn,options:[e,t]}},ar=(e,t)=>{let n=Yn(e);return{name:n.name,fn:n.fn,options:[e,t]}},or=(e,t)=>{let n=Xn(e);return{name:n.name,fn:n.fn,options:[e,t]}},sr=`data-floating-ui-focusable`,cr=`active`,lr=`selected`,ur=`ArrowLeft`,dr=`ArrowRight`,fr=`ArrowUp`,pr=`ArrowDown`,mr=[ur,dr],hr=[fr,pr];[...mr,...hr];var gr={...M},_r=!1,vr=0,yr=()=>`floating-ui-`+Math.random().toString(36).slice(2,6)+vr++;function br(){let[e,t]=M.useState(()=>_r?yr():void 0);return Yt(()=>{e??t(yr())},[]),M.useEffect(()=>{_r=!0},[]),e}var xr=gr.useId||br;function Sr(){let e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}var Cr=M.createContext(null),wr=M.createContext(null),Tr=()=>M.useContext(Cr)?.id||null,Er=()=>M.useContext(wr);function Dr(e){return`data-floating-ui-`+e}function Or(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}var kr=Dr(`safe-polygon`);function Ar(e,t,n){if(n&&!Jt(n))return 0;if(typeof e==`number`)return e;if(typeof e==`function`){let n=e();return typeof n==`number`?n:n?.[t]}return e?.[t]}function jr(e){return typeof e==`function`?e():e}function Mr(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,dataRef:i,events:a,elements:o}=e,{enabled:s=!0,delay:c=0,handleClose:l=null,mouseOnly:u=!1,restMs:d=0,move:f=!0}=t,p=Er(),m=Tr(),h=Zt(l),g=Zt(c),_=Zt(n),v=Zt(d),y=M.useRef(),b=M.useRef(-1),x=M.useRef(),S=M.useRef(-1),C=M.useRef(!0),w=M.useRef(!1),T=M.useRef(()=>{}),E=M.useRef(!1),ee=$t(()=>{let e=i.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`});M.useEffect(()=>{if(!s)return;function e(e){let{open:t}=e;t||(Or(b),Or(S),C.current=!0,E.current=!1)}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[s,a]),M.useEffect(()=>{if(!s||!h.current||!n)return;function e(e){ee()&&r(!1,e,`hover`)}let t=Wt(o.floating).documentElement;return t.addEventListener(`mouseleave`,e),()=>{t.removeEventListener(`mouseleave`,e)}},[o.floating,n,r,s,h,ee]);let D=M.useCallback(function(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=`hover`);let i=Ar(g.current,`close`,y.current);i&&!x.current?(Or(b),b.current=window.setTimeout(()=>r(!1,e,n),i)):t&&(Or(b),r(!1,e,n))},[g,r]),O=$t(()=>{T.current(),x.current=void 0}),te=$t(()=>{if(w.current){let e=Wt(o.floating).body;e.style.pointerEvents=``,e.removeAttribute(kr),w.current=!1}}),ne=$t(()=>i.current.openEvent?[`click`,`mousedown`].includes(i.current.openEvent.type):!1);M.useEffect(()=>{if(!s)return;function e(e){if(Or(b),C.current=!1,u&&!Jt(y.current)||jr(v.current)>0&&!Ar(g.current,`open`))return;let t=Ar(g.current,`open`,y.current);t?b.current=window.setTimeout(()=>{_.current||r(!0,e,`hover`)},t):n||r(!0,e,`hover`)}function t(e){if(ne()){te();return}T.current();let t=Wt(o.floating);if(Or(S),E.current=!1,h.current&&i.current.floatingContext){n||Or(b),x.current=h.current({...i.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){te(),O(),ne()||D(e,!0,`safe-polygon`)}});let r=x.current;t.addEventListener(`mousemove`,r),T.current=()=>{t.removeEventListener(`mousemove`,r)};return}(y.current!==`touch`||!Bt(o.floating,e.relatedTarget))&&D(e)}function a(e){ne()||i.current.floatingContext&&(h.current==null||h.current({...i.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){te(),O(),ne()||D(e)}})(e))}function c(){Or(b)}function l(e){ne()||D(e,!1)}if(P(o.domReference)){let r=o.domReference,i=o.floating;return n&&r.addEventListener(`mouseleave`,a),f&&r.addEventListener(`mousemove`,e,{once:!0}),r.addEventListener(`mouseenter`,e),r.addEventListener(`mouseleave`,t),i&&(i.addEventListener(`mouseleave`,a),i.addEventListener(`mouseenter`,c),i.addEventListener(`mouseleave`,l)),()=>{n&&r.removeEventListener(`mouseleave`,a),f&&r.removeEventListener(`mousemove`,e),r.removeEventListener(`mouseenter`,e),r.removeEventListener(`mouseleave`,t),i&&(i.removeEventListener(`mouseleave`,a),i.removeEventListener(`mouseenter`,c),i.removeEventListener(`mouseleave`,l))}}},[o,s,e,u,f,D,O,te,r,n,_,p,g,h,i,ne,v]),Yt(()=>{var e;if(s&&n&&(e=h.current)!=null&&(e=e.__options)!=null&&e.blockPointerEvents&&ee()){w.current=!0;let e=o.floating;if(P(o.domReference)&&e){var t;let n=Wt(o.floating).body;n.setAttribute(kr,``);let r=o.domReference,i=p==null||(t=p.nodesRef.current.find(e=>e.id===m))==null||(t=t.context)==null?void 0:t.elements.floating;return i&&(i.style.pointerEvents=``),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,e.style.pointerEvents=`auto`,()=>{n.style.pointerEvents=``,r.style.pointerEvents=``,e.style.pointerEvents=``}}}},[s,n,m,o,p,h,ee]),Yt(()=>{n||(y.current=void 0,E.current=!1,O(),te())},[n,O,te]),M.useEffect(()=>()=>{O(),Or(b),Or(S),te()},[s,o.domReference,O,te]);let re=M.useMemo(()=>{function e(e){y.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e;function i(){!C.current&&!_.current&&r(!0,t,`hover`)}(!u||Jt(y.current))&&(n||jr(v.current)===0||E.current&&e.movementX**2+e.movementY**2<2||(Or(S),y.current===`touch`?i():(E.current=!0,S.current=window.setTimeout(i,jr(v.current)))))}}},[u,r,n,_,v]);return M.useMemo(()=>s?{reference:re}:{},[s,re])}var Nr={border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`fixed`,whiteSpace:`nowrap`,width:`1px`,top:0,left:0},Pr=M.forwardRef(function(e,t){let[n,r]=M.useState();Yt(()=>{Lt()&&r(`button`)},[]);let i={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[Dr(`focus-guard`)]:``,style:Nr};return(0,ln.jsx)(`span`,{...e,...i})}),Fr={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},Ir=M.createContext(null),Lr=Dr(`portal`);function Rr(e){e===void 0&&(e={});let{id:t,root:n}=e,r=xr(),i=Br(),[a,o]=M.useState(null),s=M.useRef(null);return Yt(()=>()=>{a?.remove(),queueMicrotask(()=>{s.current=null})},[a]),Yt(()=>{if(!r||s.current)return;let e=t?document.getElementById(t):null;if(!e)return;let n=document.createElement(`div`);n.id=r,n.setAttribute(Lr,``),e.appendChild(n),s.current=n,o(n)},[t,r]),Yt(()=>{if(n===null||!r||s.current)return;let e=n||i?.portalNode;e&&!ge(e)&&(e=e.current),e||=document.body;let a=null;t&&(a=document.createElement(`div`),a.id=t,e.appendChild(a));let c=document.createElement(`div`);c.id=r,c.setAttribute(Lr,``),e=a||e,e.appendChild(c),s.current=c,o(c)},[t,n,r,i]),a}function zr(e){let{children:t,id:n,root:r,preserveTabOrder:i=!0}=e,a=Rr({id:n,root:r}),[o,s]=M.useState(null),c=M.useRef(null),l=M.useRef(null),u=M.useRef(null),d=M.useRef(null),f=o?.modal,p=o?.open,m=!!o&&!o.modal&&o.open&&i&&!!(r||a);return M.useEffect(()=>{if(!a||!i||f)return;function e(e){a&&an(e)&&(e.type===`focusin`?sn:on)(a)}return a.addEventListener(`focusin`,e,!0),a.addEventListener(`focusout`,e,!0),()=>{a.removeEventListener(`focusin`,e,!0),a.removeEventListener(`focusout`,e,!0)}},[a,i,f]),M.useEffect(()=>{a&&(p||sn(a))},[p,a]),(0,ln.jsxs)(Ir.Provider,{value:M.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:l,beforeInsideRef:u,afterInsideRef:d,portalNode:a,setFocusManagerState:s}),[i,a]),children:[m&&a&&(0,ln.jsx)(Pr,{"data-type":`outside`,ref:c,onFocus:e=>{if(an(e,a)){var t;(t=u.current)==null||t.focus()}else rn(o?o.domReference:null)?.focus()}}),m&&a&&(0,ln.jsx)(`span`,{"aria-owns":a.id,style:Fr}),a&&cn.createPortal(t,a),m&&a&&(0,ln.jsx)(Pr,{"data-type":`outside`,ref:l,onFocus:e=>{if(an(e,a)){var t;(t=d.current)==null||t.focus()}else nn(o?o.domReference:null)?.focus(),o!=null&&o.closeOnFocusOut&&o?.onOpenChange(!1,e.nativeEvent,`focus-out`)}})]})}var Br=()=>M.useContext(Ir),Vr={pointerdown:`onPointerDown`,mousedown:`onMouseDown`,click:`onClick`},Hr={pointerdown:`onPointerDownCapture`,mousedown:`onMouseDownCapture`,click:`onClickCapture`},Ur=e=>({escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0});function Wr(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,elements:i,dataRef:a}=e,{enabled:o=!0,escapeKey:s=!0,outsidePress:c=!0,outsidePressEvent:l=`pointerdown`,referencePress:u=!1,referencePressEvent:d=`pointerdown`,ancestorScroll:f=!1,bubbles:p,capture:m}=t,h=Er(),g=$t(typeof c==`function`?c:()=>!1),_=typeof c==`function`?g:c,v=M.useRef(!1),{escapeKey:y,outsidePress:b}=Ur(p),{escapeKey:x,outsidePress:S}=Ur(m),C=M.useRef(!1),w=$t(e=>{if(!n||!o||!s||e.key!==`Escape`||C.current)return;let t=a.current.floatingContext?.nodeId,i=h?Kt(h.nodesRef.current,t):[];if(!y&&(e.stopPropagation(),i.length>0)){let e=!0;if(i.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__escapeKeyBubbles){e=!1;return}}),!e)return}r(!1,qt(e)?e.nativeEvent:e,`escape-key`)}),T=$t(e=>{var t;let n=()=>{var t;w(e),(t=Vt(e))==null||t.removeEventListener(`keydown`,n)};(t=Vt(e))==null||t.addEventListener(`keydown`,n)}),E=$t(e=>{let t=a.current.insideReactTree;a.current.insideReactTree=!1;let n=v.current;if(v.current=!1,l===`click`&&n||t||typeof _==`function`&&!_(e))return;let o=Vt(e),s=`[`+Dr(`inert`)+`]`,c=Wt(i.floating).querySelectorAll(s),u=P(o)?o:null;for(;u&&!ke(u);){let e=Me(u);if(ke(e)||!P(e))break;u=e}if(c.length&&P(o)&&!Ut(o)&&!Bt(o,i.floating)&&Array.from(c).every(e=>!Bt(u,e)))return;if(_e(o)&&O){let t=ke(o),n=Ae(o),r=/auto|scroll/,i=t||r.test(n.overflowX),a=t||r.test(n.overflowY),s=i&&o.clientWidth>0&&o.scrollWidth>o.clientWidth,c=a&&o.clientHeight>0&&o.scrollHeight>o.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=o.offsetWidth-o.clientWidth:e.offsetX>o.clientWidth),d=s&&e.offsetY>o.clientHeight;if(u||d)return}let d=a.current.floatingContext?.nodeId,f=h&&Kt(h.nodesRef.current,d).some(t=>Ht(e,t.context?.elements.floating));if(Ht(e,i.floating)||Ht(e,i.domReference)||f)return;let p=h?Kt(h.nodesRef.current,d):[];if(p.length>0){let e=!0;if(p.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__outsidePressBubbles){e=!1;return}}),!e)return}r(!1,e,`outside-press`)}),ee=$t(e=>{var t;let n=()=>{var t;E(e),(t=Vt(e))==null||t.removeEventListener(l,n)};(t=Vt(e))==null||t.addEventListener(l,n)});M.useEffect(()=>{if(!n||!o)return;a.current.__escapeKeyBubbles=y,a.current.__outsidePressBubbles=b;let e=-1;function t(e){r(!1,e,`ancestor-scroll`)}function c(){window.clearTimeout(e),C.current=!0}function u(){e=window.setTimeout(()=>{C.current=!1},Oe()?5:0)}let d=Wt(i.floating);s&&(d.addEventListener(`keydown`,x?T:w,x),d.addEventListener(`compositionstart`,c),d.addEventListener(`compositionend`,u)),_&&d.addEventListener(l,S?ee:E,S);let p=[];return f&&(P(i.domReference)&&(p=Pe(i.domReference)),P(i.floating)&&(p=p.concat(Pe(i.floating))),!P(i.reference)&&i.reference&&i.reference.contextElement&&(p=p.concat(Pe(i.reference.contextElement)))),p=p.filter(e=>e!==d.defaultView?.visualViewport),p.forEach(e=>{e.addEventListener(`scroll`,t)}),()=>{s&&(d.removeEventListener(`keydown`,x?T:w,x),d.removeEventListener(`compositionstart`,c),d.removeEventListener(`compositionend`,u)),_&&d.removeEventListener(l,S?ee:E,S),p.forEach(e=>{e.removeEventListener(`scroll`,t)}),window.clearTimeout(e)}},[a,i,s,_,l,n,r,f,o,y,b,w,x,T,E,S,ee]),M.useEffect(()=>{a.current.insideReactTree=!1},[a,_,l]);let D=M.useMemo(()=>({onKeyDown:w,...u&&{[Vr[d]]:e=>{r(!1,e.nativeEvent,`reference-press`)},...d!==`click`&&{onClick(e){r(!1,e.nativeEvent,`reference-press`)}}}}),[w,r,u,d]),O=M.useMemo(()=>{function e(e){e.button===0&&(v.current=!0)}return{onKeyDown:w,onMouseDown:e,onMouseUp:e,[Hr[l]]:()=>{a.current.insideReactTree=!0}}},[w,l,a]);return M.useMemo(()=>o?{reference:D,floating:O}:{},[o,D,O])}function Gr(e){let{open:t=!1,onOpenChange:n,elements:r}=e,i=xr(),a=M.useRef({}),[o]=M.useState(()=>Sr()),s=Tr()!=null,[c,l]=M.useState(r.reference),u=$t((e,t,r)=>{a.current.openEvent=e?t:void 0,o.emit(`openchange`,{open:e,event:t,reason:r,nested:s}),n?.(e,t,r)}),d=M.useMemo(()=>({setPositionReference:l}),[]),f=M.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return M.useMemo(()=>({dataRef:a,open:t,onOpenChange:u,elements:f,events:o,floatingId:i,refs:d}),[t,u,f,o,i,d])}function Kr(e){let{elements:t,...n}=e===void 0?{}:e,{nodeId:r}=n,i=Gr({...n,elements:{reference:t?.reference??null,floating:t?.floating??null}}),a=n.rootContext||i,o=a.elements,[s,c]=M.useState(null),[l,u]=M.useState(null),d=o?.domReference||s,f=M.useRef(null),p=Er();Yt(()=>{d&&(f.current=d)},[d]);let m=rr({...n,elements:{...o,...l&&{reference:l}}}),h=M.useCallback(e=>{let t=P(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),m.refs.setReference(t)},[m.refs]),g=M.useCallback(e=>{(P(e)||e===null)&&(f.current=e,c(e)),(P(m.refs.reference.current)||m.refs.reference.current===null||e!==null&&!P(e))&&m.refs.setReference(e)},[m.refs]),_=M.useMemo(()=>({...m.refs,setReference:g,setPositionReference:h,domReference:f}),[m.refs,g,h]),v=M.useMemo(()=>({...m.elements,domReference:d}),[m.elements,d]),y=M.useMemo(()=>({...m,...a,refs:_,elements:v,nodeId:r}),[m,_,v,r,a]);return Yt(()=>{a.dataRef.current.floatingContext=y;let e=p?.nodesRef.current.find(e=>e.id===r);e&&(e.context=y)}),M.useMemo(()=>({...m,context:y,refs:_,elements:v}),[m,_,v,y])}function qr(e,t,n){let r=new Map,i=n===`item`,a=e;if(i&&e){let{[cr]:t,[lr]:n,...r}=e;a=r}return{...n===`floating`&&{tabIndex:-1,[sr]:``},...a,...t.map(t=>{let r=t?t[n]:null;return typeof r==`function`?e?r(e):null:r}).concat(e).reduce((e,t)=>(t&&Object.entries(t).forEach(t=>{let[n,a]=t;if(!(i&&[cr,lr].includes(n))){if(n.indexOf(`on`)===0){if(r.has(n)||r.set(n,[]),typeof a==`function`){var o;(o=r.get(n))==null||o.push(a),e[n]=function(){var e=[...arguments];return r.get(n)?.map(t=>t(...e)).find(e=>e!==void 0)}}}else e[n]=a}}),e),{})}}function Jr(e){e===void 0&&(e=[]);let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=M.useCallback(t=>qr(t,e,`reference`),t),a=M.useCallback(t=>qr(t,e,`floating`),n),o=M.useCallback(t=>qr(t,e,`item`),r);return M.useMemo(()=>({getReferenceProps:i,getFloatingProps:a,getItemProps:o}),[i,a,o])}var Yr=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function Xr(e,t){t===void 0&&(t={});let{open:n,elements:r,floatingId:i}=e,{enabled:a=!0,role:o=`dialog`}=t,s=xr(),c=r.domReference?.id||s,l=M.useMemo(()=>Gt(r.floating)?.id||i,[r.floating,i]),u=Yr.get(o)??o,d=Tr()!=null,f=M.useMemo(()=>u===`tooltip`||o===`label`?{[`aria-`+(o===`label`?`labelledby`:`describedby`)]:n?l:void 0}:{"aria-expanded":n?`true`:`false`,"aria-haspopup":u===`alertdialog`?`dialog`:u,"aria-controls":n?l:void 0,...u===`listbox`&&{role:`combobox`},...u===`menu`&&{id:c},...u===`menu`&&d&&{role:`menuitem`},...o===`select`&&{"aria-autocomplete":`none`},...o===`combobox`&&{"aria-autocomplete":`list`}},[u,l,d,n,c,o]),p=M.useMemo(()=>{let e={id:l,...u&&{role:u}};return u===`tooltip`||o===`label`?e:{...e,...u===`menu`&&{"aria-labelledby":c}}},[u,l,c,o]),m=M.useCallback(e=>{let{active:t,selected:n}=e,r={role:`option`,...t&&{id:l+`-fui-option`}};switch(o){case`select`:case`combobox`:return{...r,"aria-selected":n}}return{}},[l,o]);return M.useMemo(()=>a?{reference:f,floating:p,item:m}:{},[a,f,p,m])}var Zr=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Qr=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),$r=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),ei=e=>{let t=$r(e);return t.charAt(0).toUpperCase()+t.slice(1)},ti={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ni=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ri=(0,M.createContext)({}),ii=()=>(0,M.useContext)(ri),ai=(0,M.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=ii()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,M.createElement)(`svg`,{ref:c,...ti,width:t??l??ti.width,height:t??l??ti.height,stroke:e??f,strokeWidth:m,className:Zr(`lucide`,p,i),...!a&&!ni(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,M.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),F=(e,t)=>{let n=(0,M.forwardRef)(({className:n,...r},i)=>(0,M.createElement)(ai,{ref:i,iconNode:t,className:Zr(`lucide-${Qr(ei(e))}`,`lucide-${e}`,n),...r}));return n.displayName=ei(e),n},oi=F(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),si=F(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),ci=F(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),li=F(`award`,[[`path`,{d:`m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526`,key:`1yiouv`}],[`circle`,{cx:`12`,cy:`8`,r:`6`,key:`1vp47v`}]]),ui=F(`book-open`,[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]),di=F(`brain-circuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),fi=F(`castle`,[[`path`,{d:`M10 5V3`,key:`1y54qe`}],[`path`,{d:`M14 5V3`,key:`m6isi`}],[`path`,{d:`M15 21v-3a3 3 0 0 0-6 0v3`,key:`lbp5hj`}],[`path`,{d:`M18 3v8`,key:`2ollhf`}],[`path`,{d:`M18 5H6`,key:`98imr9`}],[`path`,{d:`M22 11H2`,key:`1lmjae`}],[`path`,{d:`M22 9v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9`,key:`1rly83`}],[`path`,{d:`M6 3v8`,key:`csox7g`}]]),pi=F(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),mi=F(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),hi=F(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),gi=F(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),_i=F(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),vi=F(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),yi=F(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),bi=F(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]]),xi=F(`circle-plus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),Si=F(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Ci=F(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),wi=F(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Ti=F(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),Ei=F(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Di=F(`coffee`,[[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M14 2v2`,key:`6buw04`}],[`path`,{d:`M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1`,key:`pwadti`}],[`path`,{d:`M6 2v2`,key:`colzsn`}]]),Oi=F(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),ki=F(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Ai=F(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),ji=F(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Mi=F(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ni=F(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Pi=F(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Fi=F(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),Ii=F(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),I=F(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),L=F(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Li=F(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Ri=F(`key`,[[`path`,{d:`m2 21 9.6-9.6`,key:`9l79m3`}],[`path`,{d:`m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19`,key:`fw8biw`}],[`circle`,{cx:`15.5`,cy:`7.5`,r:`5.5`,key:`4wxmhb`}]]),zi=F(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Bi=F(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),Vi=F(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Hi=F(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),Ui=F(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),Wi=F(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),Gi=F(`map`,[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]),Ki=F(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),qi=F(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Ji=F(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Yi=F(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Xi=F(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),Zi=F(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Qi=F(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),$i=F(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),ea=F(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),ta=F(`rotate-ccw-clock`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),na=F(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),ra=F(`route`,[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]),ia=F(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),aa=F(`scroll`,[[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),oa=F(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),sa=F(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ca=F(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),la=F(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ua=F(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),da=F(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),fa=F(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),pa=F(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),ma=F(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),ha=F(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),ga=F(`target`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),_a=F(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),va=F(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),ya=F(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ba=F(`trophy`,[[`path`,{d:`M10 14.66V17a1 1 0 0 1-1 1 2 2 0 0 0-2 2v2`,key:`pwuv1l`}],[`path`,{d:`M14 14.66V17a1 1 0 0 0 1 1 2 2 0 0 1 2 2v2`,key:`1y54w1`}],[`path`,{d:`M17.916 10H19.5A2.5 2.5 0 0 0 22 7.5V5a1 1 0 0 0-1-1h-3`,key:`e30mpu`}],[`path`,{d:`M4 22h16`,key:`57wxv0`}],[`path`,{d:`M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z`,key:`1mhfuq`}],[`path`,{d:`M6.084 10H4.5A2.5 2.5 0 0 1 2 7.5V5a1 1 0 0 1 1-1h3`,key:`i0yafy`}]]),xa=F(`volume-2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),Sa=F(`volume-x`,[[`path`,{d:`M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z`,key:`1p7khw`}],[`path`,{d:`m16.5 14.5 5-5`,key:`cul3yw`}],[`path`,{d:`m16.5 9.5 5 5`,key:`1akey5`}]]),Ca=F(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),wa=F(`zap`,[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]),Ta=F(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),Ea=F(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),Da=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},Oa=(e=>e?Da(e):Da),ka=e=>e;function Aa(e,t=ka){let n=M.useSyncExternalStore(e.subscribe,M.useCallback(()=>t(e.getState()),[e,t]),M.useCallback(()=>t(e.getInitialState()),[e,t]));return M.useDebugValue(n),n}var ja=e=>{let t=Oa(e),n=e=>Aa(t,e);return Object.assign(n,t),n},Ma=(e=>e?ja(e):ja);function Na(e,t,n){return Math.max(t,Math.min(e,n))}var R={toVector(e,t){return e===void 0&&(e=t),Array.isArray(e)?e:[e,e]},add(e,t){return[e[0]+t[0],e[1]+t[1]]},sub(e,t){return[e[0]-t[0],e[1]-t[1]]},addTo(e,t){e[0]+=t[0],e[1]+=t[1]},subTo(e,t){e[0]-=t[0],e[1]-=t[1]}};function Pa(e,t,n){return t===0||Math.abs(t)===1/0?e**(n*5):e*t*n/(t+n*e)}function Fa(e,t,n,r=.15){return r===0?Na(e,t,n):en?+Pa(e-n,n-t,r)+n:e}function Ia(e,[t,n],[r,i]){let[[a,o],[s,c]]=e;return[Fa(t,a,o,r),Fa(n,s,c,i)]}function La(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ra(e){var t=La(e,`string`);return typeof t==`symbol`?t:String(t)}function za(e,t,n){return t=Ra(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ba(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function z(e){for(var t=1;t{var n,r;return t.target===e.currentTarget||((n=e.currentTarget)==null||(r=n.contains)==null?void 0:r.call(n,t.target))})}function Qa(e){return e.type===`touchend`||e.type===`touchcancel`?e.changedTouches:e.targetTouches}function $a(e){return Ya(e)?Qa(e)[0]:e}function eo(e){return Za(e).map(e=>e.identifier)}function to(e){let t=$a(e);return Ya(e)?t.identifier:t.pointerId}function no(e){let t=$a(e);return[t.clientX,t.clientY]}function ro(e){let t={};if(`buttons`in e&&(t.buttons=e.buttons),`shiftKey`in e){let{shiftKey:n,altKey:r,metaKey:i,ctrlKey:a}=e;Object.assign(t,{shiftKey:n,altKey:r,metaKey:i,ctrlKey:a})}return t}function io(e,...t){return typeof e==`function`?e(...t):e}function ao(){}function oo(...e){return e.length===0?ao:e.length===1?e[0]:function(){let t;for(let n of e)t=n.apply(this,arguments)||t;return t}}function so(e,t){return Object.assign({},t,e||{})}var co=32,lo=class{constructor(e,t,n){this.ctrl=e,this.args=t,this.key=n,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){let{state:e,shared:t,ingKey:n,args:r}=this;t[n]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=r,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){let t=this.state,n=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=n.from?io(n.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){let t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){let e=this.state;e._initial=e._values,e.initial=e.values}compute(e){let{state:t,config:n,shared:r}=this;t.args=this.args;let i=0;if(e&&(t.event=e,n.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,r.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,r.locked=!!document.pointerLockElement,Object.assign(r,ro(e)),r.down=r.pressed=r.buttons%2==1||r.touches>0,i=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){let e=t._delta.map(Math.abs);R.addTo(t._distance,e)}this.axisIntent&&this.axisIntent(e);let[a,o]=t._movement,[s,c]=n.threshold,{_step:l,values:u}=t;if(n.hasCustomTransform?(l[0]===!1&&(l[0]=Math.abs(a)>=s&&u[0]),l[1]===!1&&(l[1]=Math.abs(o)>=c&&u[1])):(l[0]===!1&&(l[0]=Math.abs(a)>=s&&Math.sign(a)*s),l[1]===!1&&(l[1]=Math.abs(o)>=c&&Math.sign(o)*c)),t.intentional=l[0]!==!1||l[1]!==!1,!t.intentional)return;let d=[0,0];if(n.hasCustomTransform){let[e,t]=u;d[0]=l[0]===!1?0:e-l[0],d[1]=l[1]===!1?0:t-l[1]}else d[0]=l[0]===!1?0:a-l[0],d[1]=l[1]===!1?0:o-l[1];this.restrictToAxis&&!t._blocked&&this.restrictToAxis(d);let f=t.offset,p=t._active&&!t._blocked||t.active;p&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=r[this.ingKey]=t._active,e&&(t.first&&(`bounds`in n&&(t._bounds=io(n.bounds,t)),this.setup&&this.setup()),t.movement=d,this.computeOffset()));let[m,h]=t.offset,[[g,_],[v,y]]=t._bounds;t.overflow=[m_),hy)],t._movementBound[0]=t.overflow[0]?t._movementBound[0]===!1?t._movement[0]:t._movementBound[0]:!1,t._movementBound[1]=t.overflow[1]?t._movementBound[1]===!1?t._movement[1]:t._movementBound[1]:!1;let b=t._active&&n.rubberband||[0,0];if(t.offset=Ia(t._bounds,t.offset,b),t.delta=R.sub(t.offset,f),this.computeMovement(),p&&(!t.last||i>co)){t.delta=R.sub(t.offset,f);let e=t.delta.map(Math.abs);R.addTo(t.distance,e),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&i>0&&(t.velocity=[e[0]/i,e[1]/i],t.timeDelta=i)}}emit(){let e=this.state,t=this.shared,n=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!n.triggerAllEvents)return;let r=this.handler(z(z(z({},t),e),{},{[this.aliasKey]:e.values}));r!==void 0&&(e.memo=r)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}};function uo([e,t],n){let r=Math.abs(e),i=Math.abs(t);if(r>i&&r>n)return`x`;if(i>r&&i>n)return`y`}var fo=class extends lo{constructor(...e){super(...e),za(this,`aliasKey`,`xy`)}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=R.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=R.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){let t=this.state,n=this.config;if(!t.axis&&e){let r=typeof n.axisThreshold==`object`?n.axisThreshold[Xa(e)]:n.axisThreshold;t.axis=uo(t._movement,r)}t._blocked=(n.lockDirection||!!n.axis)&&!t.axis||!!n.axis&&n.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case`x`:e[1]=0;break;case`y`:e[0]=0}}},po=e=>e,B=.15,V={enabled(e=!0){return e},eventOptions(e,t,n){return z(z({},n.shared.eventOptions),e)},preventDefault(e=!1){return e},triggerAllEvents(e=!1){return e},rubberband(e=0){switch(e){case!0:return[B,B];case!1:return[0,0];default:return R.toVector(e)}},from(e){if(typeof e==`function`)return e;if(e!=null)return R.toVector(e)},transform(e,t,n){let r=e||n.shared.transform;return this.hasCustomTransform=!!r,r||po},threshold(e){return R.toVector(e,0)}},mo=0,ho=z(z({},V),{},{axis(e,t,{axis:n}){if(this.lockDirection=n===`lock`,!this.lockDirection)return n},axisThreshold(e=mo){return e},bounds(e={}){if(typeof e==`function`)return t=>ho.bounds(e(t));if(`current`in e)return()=>e.current;if(typeof HTMLElement==`function`&&e instanceof HTMLElement)return e;let{left:t=-1/0,right:n=1/0,top:r=-1/0,bottom:i=1/0}=e;return[[t,n],[r,i]]}}),go={ArrowRight:(e,t=1)=>[e*t,0],ArrowLeft:(e,t=1)=>[-1*e*t,0],ArrowUp:(e,t=1)=>[0,-1*e*t],ArrowDown:(e,t=1)=>[0,e*t]},_o=class extends fo{constructor(...e){super(...e),za(this,`ingKey`,`dragging`)}reset(){super.reset();let e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){let e=this.state;if(e._bounds instanceof HTMLElement){let t=e._bounds.getBoundingClientRect(),n=e.currentTarget.getBoundingClientRect(),r={left:t.left-n.left+e.offset[0],right:t.right-n.right+e.offset[0],top:t.top-n.top+e.offset[1],bottom:t.bottom-n.bottom+e.offset[1]};e._bounds=ho.bounds(r)}}cancel(){let e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){let t=this.config,n=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;let r=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(r&&r.size>1&&n._pointerActive)&&(this.start(e),this.setupPointer(e),n._pointerId=to(e),n._pointerActive=!0,this.computeValues(no(e)),this.computeInitial(),t.preventScrollAxis&&Xa(e)!==`mouse`?(n._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){let t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){let t=this.state,n=this.config;if(!t._pointerActive)return;let r=to(e);if(t._pointerId!==void 0&&r!==t._pointerId)return;let i=no(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=R.sub(i,t._values),this.computeValues(i)),R.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove(`dragDelay`),t.active=!1,this.startPointerDrag(e);return}if(n.preventScrollAxis&&!t._preventScroll){if(t.axis){if(t.axis===n.preventScrollAxis||n.preventScrollAxis===`xy`){t._active=!1,this.clean();return}this.timeoutStore.remove(`startPointerDrag`),this.startPointerDrag(e);return}return}this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}let t=this.state,n=this.config;if(!t._active||!t._pointerActive)return;let r=to(e);if(t._pointerId!==void 0&&r!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);let[i,a]=t._distance;if(t.tap=i<=n.tapsThreshold&&a<=n.tapsThreshold,t.tap&&n.filterTaps)t._force=!0;else{let[e,r]=t._delta,[i,a]=t._movement,[o,s]=n.swipe.velocity,[c,l]=n.swipe.distance,u=n.swipe.duration;if(t.elapsedTimeo&&Math.abs(i)>c&&(t.swipe[0]=Math.sign(e)),u>s&&Math.abs(a)>l&&(t.swipe[1]=Math.sign(r))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){let t=this.config,n=t.device;t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,n,`change`,this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,n,`end`,this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,n,`cancel`,this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,vo(e);let t=this.eventStore.add(this.sharedConfig.window,`touch`,`change`,this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,`touch`,`end`,t),this.eventStore.add(this.sharedConfig.window,`touch`,`cancel`,t),this.timeoutStore.add(`startPointerDrag`,this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add(`dragDelay`,()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){let t=go[e.key];if(t){let n=this.state,r=e.shiftKey?10:e.altKey?.1:1;this.start(e),n._delta=t(this.config.keyboardDisplacement,r),n._keyboardActive=!0,R.addTo(n._movement,n._delta),this.compute(e),this.emit()}}keyUp(e){e.key in go&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){let t=this.config.device;e(t,`start`,this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,`change`,this.pointerMove.bind(this)),e(t,`end`,this.pointerUp.bind(this)),e(t,`cancel`,this.pointerUp.bind(this)),e(`lostPointerCapture`,``,this.pointerUp.bind(this))),this.config.keys&&(e(`key`,`down`,this.keyDown.bind(this)),e(`key`,`up`,this.keyUp.bind(this))),this.config.filterTaps&&e(`click`,``,this.pointerClick.bind(this),{capture:!0,passive:!1})}};function vo(e){`persist`in e&&typeof e.persist==`function`&&e.persist()}var yo=typeof window<`u`&&window.document&&window.document.createElement;function bo(){return yo&&`ontouchstart`in window}function xo(){return bo()||yo&&window.navigator.maxTouchPoints>1}function H(){return yo&&`onpointerdown`in window}function So(){return yo&&`exitPointerLock`in window.document}function Co(){try{return`constructor`in GestureEvent}catch{return!1}}var wo={isBrowser:yo,gesture:Co(),touch:bo(),touchscreen:xo(),pointer:H(),pointerLock:So()},To=250,Eo=180,Do=.5,Oo=50,ko=250,Ao=10,U={mouse:0,touch:0,pen:8},jo=z(z({},ho),{},{device(e,t,{pointer:{touch:n=!1,lock:r=!1,mouse:i=!1}={}}){return this.pointerLock=r&&wo.pointerLock,wo.touch&&n?`touch`:this.pointerLock?`mouse`:wo.pointer&&!i?`pointer`:wo.touch?`touch`:`mouse`},preventScrollAxis(e,t,{preventScroll:n}){if(this.preventScrollDelay=typeof n==`number`?n:n||n===void 0&&e?To:void 0,wo.touchscreen&&n!==!1)return e||(n===void 0?void 0:`y`)},pointerCapture(e,t,{pointer:{capture:n=!0,buttons:r=1,keys:i=!0}={}}){return this.pointerButtons=r,this.keys=i,!this.pointerLock&&this.device===`pointer`&&n},threshold(e,t,{filterTaps:n=!1,tapsThreshold:r=3,axis:i=void 0}){let a=R.toVector(e,n?r:+!!i);return this.filterTaps=n,this.tapsThreshold=r,a},swipe({velocity:e=Do,distance:t=Oo,duration:n=ko}={}){return{velocity:this.transform(R.toVector(e)),distance:this.transform(R.toVector(t)),duration:n}},delay(e=0){switch(e){case!0:return Eo;case!1:return 0;default:return e}},axisThreshold(e){return e?z(z({},U),e):U},keyboardDisplacement(e=Ao){return e}});z(z({},V),{},{device(e,t,{shared:n,pointer:{touch:r=!1}={}}){if(n.target&&!wo.touch&&wo.gesture)return`gesture`;if(wo.touch&&r)return`touch`;if(wo.touchscreen){if(wo.pointer)return`pointer`;if(wo.touch)return`touch`}},bounds(e,t,{scaleBounds:n={},angleBounds:r={}}){let i=e=>{let t=so(io(n,e),{min:-1/0,max:1/0});return[t.min,t.max]},a=e=>{let t=so(io(r,e),{min:-1/0,max:1/0});return[t.min,t.max]};return typeof n!=`function`&&typeof r!=`function`?[i(),a()]:e=>[i(e),a(e)]},threshold(e,t,n){return this.lockDirection=n.axis===`lock`,R.toVector(e,this.lockDirection?[.1,3]:0)},modifierKey(e){return e===void 0?`ctrlKey`:e},pinchOnWheel(e=!0){return e}}),z(z({},ho),{},{mouseOnly:(e=!0)=>e}),z(z({},ho),{},{mouseOnly:(e=!0)=>e});var Mo=new Map,No=new Map;function Po(e){Mo.set(e.key,e.engine),No.set(e.key,e.resolver)}var Fo={key:`drag`,engine:_o,resolver:jo};function Io(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a=0)&&(n[i]=e[i]);return n}function Lo(e,t){if(e==null)return{};var n=Io(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var Ro={target(e){if(e)return()=>`current`in e?e.current:e},enabled(e=!0){return e},window(e=wo.isBrowser?window:void 0){return e},eventOptions({passive:e=!0,capture:t=!1}={}){return{passive:e,capture:t}},transform(e){return e}},zo=[`target`,`eventOptions`,`window`,`enabled`,`transform`];function Bo(e={},t){let n={};for(let[r,i]of Object.entries(t))switch(typeof i){case`function`:n[r]=i.call(n,e[r],r,e);break;case`object`:n[r]=Bo(e[r],i);break;case`boolean`:i&&(n[r]=e[r])}return n}function Vo(e,t,n={}){let r=e,{target:i,eventOptions:a,window:o,enabled:s,transform:c}=r,l=Lo(r,zo);if(n.shared=Bo({target:i,eventOptions:a,window:o,enabled:s,transform:c},Ro),t){let e=No.get(t);n[t]=Bo(z({shared:n.shared},l),e)}else for(let e in l){let t=No.get(e);t&&(n[e]=Bo(z({shared:n.shared},l[e]),t))}return n}var Ho=class{constructor(e,t){za(this,`_listeners`,new Set),this._ctrl=e,this._gestureKey=t}add(e,t,n,r,i){let a=this._listeners,o=Ja(t,n),s=z(z({},this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{}),i);e.addEventListener(o,r,s);let c=()=>{e.removeEventListener(o,r,s),a.delete(c)};return a.add(c),c}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}},Uo=class{constructor(){za(this,`_timeouts`,new Map)}add(e,t,n=140,...r){this.remove(e),this._timeouts.set(e,window.setTimeout(t,n,...r))}remove(e){let t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}},Wo=class{constructor(e){za(this,`gestures`,new Set),za(this,`_targetEventStore`,new Ho(this)),za(this,`gestureEventStores`,{}),za(this,`gestureTimeoutStores`,{}),za(this,`handlers`,{}),za(this,`config`,{}),za(this,`pointerIds`,new Set),za(this,`touchIds`,new Set),za(this,`state`,{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),Ko(this,e)}setEventIds(e){if(Ya(e))return this.touchIds=new Set(eo(e)),this.touchIds;if(`pointerId`in e)return e.type===`pointerup`||e.type===`pointercancel`?this.pointerIds.delete(e.pointerId):e.type===`pointerdown`&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=Vo(e,t,this.config)}clean(){this._targetEventStore.clean();for(let e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){let t=this.config.shared,n={},r;if(!(t.target&&(r=t.target(),!r))){if(t.enabled){for(let t of this.gestures){let i=this.config[t],a=qo(n,i.eventOptions,!!r);i.enabled&&new(Mo.get(t))(this,e,t).bind(a)}let i=qo(n,t.eventOptions,!!r);for(let t in this.nativeHandlers)i(t,``,n=>this.nativeHandlers[t](z(z({},this.state.shared),{},{event:n,args:e})),void 0,!0)}for(let e in n)n[e]=oo(...n[e]);if(!r)return n;for(let e in n){let{device:t,capture:i,passive:a}=qa(e);this._targetEventStore.add(r,t,``,n[e],{capture:i,passive:a})}}}};function Go(e,t){e.gestures.add(t),e.gestureEventStores[t]=new Ho(e,t),e.gestureTimeoutStores[t]=new Uo}function Ko(e,t){t.drag&&Go(e,`drag`),t.wheel&&Go(e,`wheel`),t.scroll&&Go(e,`scroll`),t.move&&Go(e,`move`),t.pinch&&Go(e,`pinch`),t.hover&&Go(e,`hover`)}var qo=(e,t,n)=>(r,i,a,o={},s=!1)=>{let c=o.capture??t.capture,l=o.passive??t.passive,u=s?r:Ga(r,i,c);n&&l&&(u+=`Passive`),e[u]=e[u]||[],e[u].push(a)};function Jo(e,t={},n,r){let i=M.useMemo(()=>new Wo(e),[]);if(i.applyHandlers(e,r),i.applyConfig(t,n),M.useEffect(i.effect.bind(i)),M.useEffect(()=>i.clean.bind(i),[]),t.target===void 0)return i.bind.bind(i)}function Yo(e,t){return Po(Fo),Jo({drag:e},t||{},`drag`)}function Xo(){return Xo=Object.assign?Object.assign.bind():function(e){for(var t=1;t({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(e=>!e.empty)}),ns=class{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(e=>{try{e()}catch(e){console.error(`TimeoutLatch callback error:`,e)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}},rs=class{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}},is=null,as=()=>typeof window>`u`?new rs:(is||=new rs,is),os=d.theme({"& .cm-scroller":{height:`100% !important`}}),ss=null,cs=null;function ls(e,t,n,r,i,a){if(!e&&!t&&!n&&!r&&!i&&!a)return null;var o=JSON.stringify({height:e,minHeight:t,maxHeight:n,width:r,minWidth:i,maxWidth:a});return o===ss?cs:(ss=o,cs=d.theme({"&":{height:e,minHeight:t,maxHeight:n,width:r,minWidth:i,maxWidth:a}}),cs)}var us=u.define(),ds=200,fs=[];function ps(e){var t=e.value,n=e.selection,r=e.onChange,i=e.onStatistics,s=e.onCreateEditor,c=e.onUpdate,l=e.extensions,u=l===void 0?fs:l,f=e.autoFocus,p=e.theme,m=p===void 0?`light`:p,h=e.height,g=h===void 0?null:h,_=e.minHeight,v=_===void 0?null:_,y=e.maxHeight,b=y===void 0?null:y,x=e.width,S=x===void 0?null:x,C=e.minWidth,w=C===void 0?null:C,T=e.maxWidth,E=T===void 0?null:T,ee=e.placeholder,D=ee===void 0?``:ee,O=e.editable,te=O===void 0||O,ne=e.readOnly,re=ne!==void 0&&ne,k=e.indentWithTab,A=k===void 0||k,ie=e.basicSetup,ae=ie===void 0||ie,oe=e.root,se=e.initialState,ce=(0,M.useState)(),le=ce[0],ue=ce[1],de=(0,M.useState)(),j=de[0],fe=de[1],pe=(0,M.useState)(),me=pe[0],he=pe[1],N=(0,M.useState)(()=>({current:null}))[0],ge=(0,M.useState)(()=>({current:null}))[0],P=ls(g,v,b,S,w,E),_e=d.updateListener.of(e=>{e.docChanged&&typeof r==`function`&&!e.transactions.some(e=>e.annotation(us))&&(N.current?N.current.reset():(N.current=new ns(()=>{if(ge.current){var e=ge.current;ge.current=null,e()}N.current=null},ds),as().add(N.current)),r(e.state.doc.toString(),e)),i&&i(ts(e))}),ve=es({theme:m,editable:te,readOnly:re,placeholder:D,indentWithTab:A,basicSetup:ae}),ye=[_e,...P?[P]:[],os,...ve];return c&&typeof c==`function`&&ye.push(d.updateListener.of(c)),ye=ye.concat(u),(0,M.useLayoutEffect)(()=>{if(le&&!me){var e={doc:t,selection:n,extensions:ye},r=se?a.fromJSON(se.json,e,se.fields):a.create(e);if(he(r),!j){var i=new d({state:r,parent:le,root:oe});fe(i),s&&s(i,r)}}return()=>{j&&(he(void 0),fe(void 0))}},[le,me]),(0,M.useEffect)(()=>{e.container&&ue(e.container)},[e.container]),(0,M.useEffect)(()=>()=>{j&&(j.destroy(),fe(void 0)),N.current&&=(N.current.cancel(),null)},[j]),(0,M.useEffect)(()=>{f&&j&&j.focus()},[f,j]),(0,M.useEffect)(()=>{j&&j.dispatch({effects:o.reconfigure.of(ye)})},[m,u,g,v,b,S,w,E,D,te,re,A,ae,r,c]),(0,M.useEffect)(()=>{if(t!==void 0){var e=j?j.state.doc.toString():``;if(j&&t!==e){var n=N.current&&!N.current.isDone,r=()=>{j&&t!==j.state.doc.toString()&&j.dispatch({changes:{from:0,to:j.state.doc.toString().length,insert:t||``},annotations:[us.of(!0)]})};n?ge.current=r:r()}}},[t,j]),{state:me,setState:he,view:j,setView:fe,container:le,setContainer:ue}}var ms=[`className`,`value`,`selection`,`extensions`,`onChange`,`onStatistics`,`onCreateEditor`,`onUpdate`,`autoFocus`,`theme`,`height`,`minHeight`,`maxHeight`,`width`,`minWidth`,`maxWidth`,`basicSetup`,`placeholder`,`indentWithTab`,`editable`,`readOnly`,`root`,`initialState`],hs=(0,M.forwardRef)((e,t)=>{var n=e.className,r=e.value,i=r===void 0?``:r,a=e.selection,o=e.extensions,s=o===void 0?[]:o,c=e.onChange,l=e.onStatistics,u=e.onCreateEditor,d=e.onUpdate,f=e.autoFocus,p=e.theme,m=p===void 0?`light`:p,h=e.height,g=e.minHeight,_=e.maxHeight,v=e.width,y=e.minWidth,b=e.maxWidth,x=e.basicSetup,S=e.placeholder,C=e.indentWithTab,w=e.editable,T=e.readOnly,E=e.root,ee=e.initialState,D=Zo(e,ms),O=(0,M.useRef)(null),te=ps({root:E,value:i,autoFocus:f,theme:m,height:h,minHeight:g,maxHeight:_,width:v,minWidth:y,maxWidth:b,basicSetup:x,placeholder:S,indentWithTab:C,editable:w,readOnly:T,selection:a,onChange:c,onStatistics:l,onCreateEditor:u,onUpdate:d,extensions:s,initialState:ee}),ne=te.state,re=te.view,k=te.container,A=te.setContainer;(0,M.useImperativeHandle)(t,()=>({editor:O.current,state:ne,view:re}),[O,k,ne,re]);var ie=(0,M.useCallback)(e=>{O.current=e,A(e)},[A]);if(typeof i!=`string`)throw Error(`value must be typeof string but got `+typeof i);var ae=typeof m==`string`?`cm-theme-`+m:`cm-theme`;return(0,ln.jsx)(`div`,Xo({ref:ie,className:``+ae+(n?` `+n:``)},D))});hs.displayName=`CodeMirror`;export{Ni as $,ea as A,Mr as At,Wi as B,sa as C,li as Ct,ra as D,zr as Dt,ia as E,oi as Et,Yi as F,ar as Ft,zi as G,Hi as H,Ji as I,qn as It,L as J,Ri as K,qi as L,fe as Lt,Qi as M,Xr as Mt,Zi as N,or as Nt,na as O,Wr as Ot,Xi as P,ir as Pt,Pi as Q,Ki as R,de as Rt,ca as S,ui as St,aa as T,si as Tt,Vi as U,Ui as V,Bi as W,Ii as X,I as Y,Fi as Z,pa as _,hi as _t,Ta as a,Di as at,ua as b,fi as bt,Sa as c,wi as ct,ya as d,xi as dt,Mi as et,va as f,bi as ft,ma as g,gi as gt,ha as h,_i as ht,Ea as i,Oi as it,$i as j,Jr as jt,ta as k,Kr as kt,xa as l,Ci as lt,ga as m,vi as mt,Yo as n,Ai as nt,wa as o,Ei as ot,_a as p,yi as pt,Li as q,Ma as r,ki as rt,Ca as s,Ti as st,hs as t,ji as tt,ba as u,Si as ut,fa as v,mi as vt,oa as w,ci as wt,la as x,di as xt,da as y,pi as yt,Gi as z,ae as zt}; \ No newline at end of file diff --git a/algospaced-ui/dist/index.html b/algospaced-ui/dist/index.html index ac11f056ecbac98c8026527b53a3592a423fe3b5..b187aa32734d4175970f01aef39553ce181e35c9 100644 --- a/algospaced-ui/dist/index.html +++ b/algospaced-ui/dist/index.html @@ -21,10 +21,10 @@ rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&family=Bricolage+Grotesque:opsz,wght@12..96,700;12..96,800&family=Be+Vietnam+Pro:wght@500;700&family=Courier+Prime:wght@400;700&family=Press+Start+2P&family=Cinzel:wght@500;700;900&family=Cinzel+Decorative:wght@700;900&family=EB+Garamond:ital,wght@0,400;0,600;1,400;1,600&family=Kalam:wght@400;700&display=swap" /> - + - + diff --git a/algospaced-ui/dist/sw.js b/algospaced-ui/dist/sw.js index 4b426bf18919442fae40e7ed43906d0cae5ad157..a819bbb1e08cedacede8aaa1f80d8e20ff7ed8fd 100644 --- a/algospaced-ui/dist/sw.js +++ b/algospaced-ui/dist/sw.js @@ -1 +1 @@ -if(!self.define){let s,e={};const l=(l,r)=>(l=new URL(l+".js",r).href,e[l]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=l,s.onload=e,document.head.appendChild(s)}else s=l,importScripts(l),e()}).then(()=>{let s=e[l];if(!s)throw new Error(`Module ${l} didn’t register its module`);return s}));self.define=(r,n)=>{const i=s||("document"in self?document.currentScript.src:"")||location.href;if(e[i])return;let u={};const o=s=>l(s,i),t={module:{uri:i},exports:u,require:o};e[i]=Promise.all(r.map(s=>t[s]||o(s))).then(s=>(n(...s),u))}}define(["./workbox-9c191d2f"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"loader.css",revision:"fe561cfc0908978c7b17dcf5d0ce1075"},{url:"loader-init.js",revision:"3d0342fa97370ec97880bb98818cd608"},{url:"index.html",revision:"010de35215c32ceb299a2a3156cb5e1b"},{url:"assets/vendor-ui-ZXcm-2wU.js",revision:null},{url:"assets/vendor-react-qmUj3JUi.js",revision:null},{url:"assets/vendor-katex-DtkCqjBQ.css",revision:null},{url:"assets/vendor-katex-Balf574a.js",revision:null},{url:"assets/vendor-firebase-DSIO3PIf.js",revision:null},{url:"assets/vendor-codemirror-By0wlJeM.js",revision:null},{url:"assets/TerminalEmulator-DUo8J_0j.js",revision:null},{url:"assets/Settings-mOsQagfT.js",revision:null},{url:"assets/rolldown-runtime-hePW80VL.js",revision:null},{url:"assets/ReviewQueue-C250a4ib.js",revision:null},{url:"assets/PythonChallenge-BUhtEPkm.js",revision:null},{url:"assets/ProblemSpecPanel-Df-cRYRz.js",revision:null},{url:"assets/PrincessChamber-IJaaUuL1.js",revision:null},{url:"assets/OnboardingModal-hhKaj0In.js",revision:null},{url:"assets/MySQLPlayground-CA-QZxQM.js",revision:null},{url:"assets/MarkdownRenderer-CC5nUs7-.js",revision:null},{url:"assets/KatexRenderer-DnoTdlgI.js",revision:null},{url:"assets/JourneyPath-DO-UXRtH.js",revision:null},{url:"assets/index-supjX07i.css",revision:null},{url:"assets/index-DYMSjoUb.js",revision:null},{url:"assets/GitHubSyncWindow-D0t6e3o3.js",revision:null},{url:"assets/githubSyncService-DQdE4J2L.js",revision:null},{url:"assets/firebaseClient-G7klkuBb.js",revision:null},{url:"assets/FileExplorer-BX57bI-L.js",revision:null},{url:"assets/CreateProblemForm-C2nCqjgj.js",revision:null},{url:"assets/confetti.module-Uxh4CK4s.js",revision:null},{url:"assets/Auth-B-5KpNfK.js",revision:null},{url:"manifest.webmanifest",revision:"7c8ff056d2e188c868d851bcb349e28e"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html")))}); +if(!self.define){let s,e={};const l=(l,r)=>(l=new URL(l+".js",r).href,e[l]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=l,s.onload=e,document.head.appendChild(s)}else s=l,importScripts(l),e()}).then(()=>{let s=e[l];if(!s)throw new Error(`Module ${l} didn’t register its module`);return s}));self.define=(r,n)=>{const i=s||("document"in self?document.currentScript.src:"")||location.href;if(e[i])return;let u={};const o=s=>l(s,i),t={module:{uri:i},exports:u,require:o};e[i]=Promise.all(r.map(s=>t[s]||o(s))).then(s=>(n(...s),u))}}define(["./workbox-9c191d2f"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"loader.css",revision:"fe561cfc0908978c7b17dcf5d0ce1075"},{url:"loader-init.js",revision:"3d0342fa97370ec97880bb98818cd608"},{url:"index.html",revision:"2de2821bb3c7ef79174d78f29e262012"},{url:"assets/vendor-ui-ZXcm-2wU.js",revision:null},{url:"assets/vendor-react-q-oOktF_.js",revision:null},{url:"assets/vendor-katex-DtkCqjBQ.css",revision:null},{url:"assets/vendor-katex-Balf574a.js",revision:null},{url:"assets/vendor-firebase-DSIO3PIf.js",revision:null},{url:"assets/vendor-codemirror-By0wlJeM.js",revision:null},{url:"assets/TerminalEmulator-UawIgOps.js",revision:null},{url:"assets/Settings-BFJ9GDP5.js",revision:null},{url:"assets/rolldown-runtime-hePW80VL.js",revision:null},{url:"assets/ReviewQueue-DRECcJtJ.js",revision:null},{url:"assets/PythonChallenge-Bh_sBh6Y.js",revision:null},{url:"assets/ProblemSpecPanel-MCUtP8V_.js",revision:null},{url:"assets/PrincessChamber-BkGsNxLj.js",revision:null},{url:"assets/OnboardingModal-D_uUP3Nd.js",revision:null},{url:"assets/MySQLPlayground-qSCaW6n7.js",revision:null},{url:"assets/MarkdownRenderer-cD9l7avV.js",revision:null},{url:"assets/KatexRenderer-S2ExKuPO.js",revision:null},{url:"assets/JourneyPath-C_DuHGaN.js",revision:null},{url:"assets/index-supjX07i.css",revision:null},{url:"assets/index-Bcgsshpk.js",revision:null},{url:"assets/GitHubSyncWindow-6b8RBof4.js",revision:null},{url:"assets/githubSyncService-DQdE4J2L.js",revision:null},{url:"assets/firebaseClient-G7klkuBb.js",revision:null},{url:"assets/FileExplorer-cjfRJjsw.js",revision:null},{url:"assets/CreateProblemForm-BBCKyUaK.js",revision:null},{url:"assets/confetti.module-Uxh4CK4s.js",revision:null},{url:"assets/Auth-D-vQqxx2.js",revision:null},{url:"manifest.webmanifest",revision:"7c8ff056d2e188c868d851bcb349e28e"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html")))}); diff --git a/algospaced-ui/src/components/PrincessDialoguePopup.tsx b/algospaced-ui/src/components/PrincessDialoguePopup.tsx index 1ba3d136f7434fa8e580a47b89d91d4724772cb3..1805d3a44d23d0f74cb66c8975b3ba451817873f 100644 --- a/algospaced-ui/src/components/PrincessDialoguePopup.tsx +++ b/algospaced-ui/src/components/PrincessDialoguePopup.tsx @@ -5,6 +5,7 @@ import { type TowerProgress, PRINCESS_EMOTIONS, } from '../data/companionData'; +import { useOSStore } from '../stores/useOSStore'; import { getCurrentChapter, getCompanionSettings, @@ -44,6 +45,9 @@ export default function PrincessDialoguePopup({ onClose, onOpenCompanionWindow, }: PrincessDialoguePopupProps) { + const isCompanionOpen = useOSStore( + (s) => !!s.windows.companion?.isOpen && !s.windows.companion?.isMinimized + ); const [displayedText, setDisplayedText] = useState(''); const [isTyping, setIsTyping] = useState(false); const [muted, setMuted] = useState(isAudioMuted()); @@ -52,6 +56,16 @@ export default function PrincessDialoguePopup({ const timerRef = useRef | null>(null); const autoCloseRef = useRef | null>(null); + // If companion window opens, dismiss any active popup dialogue + useEffect(() => { + if (isCompanionOpen && event) { + const timer = setTimeout(() => { + onClose(); + }, 0); + return () => clearTimeout(timer); + } + }, [isCompanionOpen, event, onClose]); + useEffect(() => { setProgress(getTowerProgress()); }, [event]); @@ -98,7 +112,7 @@ export default function PrincessDialoguePopup({ }; }, [event]); - if (!event || !settings.enabled) return null; + if (!event || !settings.enabled || isCompanionOpen) return null; const currentEmotionMeta = PRINCESS_EMOTIONS[event.emotion] || PRINCESS_EMOTIONS.smiling_warmly; diff --git a/algospaced-ui/src/components/desktop/DesktopGadget.tsx b/algospaced-ui/src/components/desktop/DesktopGadget.tsx index 1c8b6e0b2d6a32136f613bf38d9ebafd368ceb32..ddaa66d7ec4e917723f03d011ce69d67183b5a8f 100644 --- a/algospaced-ui/src/components/desktop/DesktopGadget.tsx +++ b/algospaced-ui/src/components/desktop/DesktopGadget.tsx @@ -44,7 +44,7 @@ export const DesktopGadget: React.FC = ({ {/* Beta Watermark (Windows Evaluation Copy style above taskbar clock) */}
AlgoSpaced (Beta) - Build 1.0.24-preview + Build 0.0.5-preview
); diff --git a/algospaced-ui/src/features/companion/components/PrincessToast.tsx b/algospaced-ui/src/features/companion/components/PrincessToast.tsx index fdd4b761533f64f212f7b53d86d3ec4b766bda8d..012459cbd1700065ff611fa147b2f03977b75938 100644 --- a/algospaced-ui/src/features/companion/components/PrincessToast.tsx +++ b/algospaced-ui/src/features/companion/components/PrincessToast.tsx @@ -1,6 +1,7 @@ import { useEffect, useState, useRef } from 'react'; import type React from 'react'; import { useCompanionStore } from '../store/useCompanionStore'; +import { useOSStore } from '../../../stores/useOSStore'; import { PRINCESS_EMOTIONS } from '../types'; import { getCurrentChapter } from '../data/companionLore'; import { @@ -23,6 +24,9 @@ interface PrincessToastProps { export default function PrincessToast({ onOpenCompanionWindow }: PrincessToastProps) { const store = useCompanionStore(); + const isCompanionOpen = useOSStore( + (s) => !!s.windows.companion?.isOpen && !s.windows.companion?.isMinimized + ); const [visible, setVisible] = useState(false); const [displayedText, setDisplayedText] = useState(''); const [isTyping, setIsTyping] = useState(false); @@ -31,6 +35,18 @@ export default function PrincessToast({ onOpenCompanionWindow }: PrincessToastPr const autoCloseRef = useRef | null>(null); const lastTurnIdRef = useRef(''); + // If companion chamber opens, clear timers and dismiss toast + useEffect(() => { + if (isCompanionOpen) { + if (timerRef.current) clearInterval(timerRef.current); + if (autoCloseRef.current) clearTimeout(autoCloseRef.current); + const timer = setTimeout(() => { + setVisible(false); + }, 0); + return () => clearTimeout(timer); + } + }, [isCompanionOpen]); + // Watch transcript for new turns from princess triggered by review events or break reminders useEffect(() => { const lastTurn = store.transcript[store.transcript.length - 1]; @@ -38,8 +54,14 @@ export default function PrincessToast({ onOpenCompanionWindow }: PrincessToastPr return; } - // Only popup for new turns that are reactions or system events - if (lastTurn.id !== lastTurnIdRef.current && (lastTurn.id.startsWith('rev-') || lastTurn.id.startsWith('fatigue-') || lastTurn.id.startsWith('proactive-'))) { + // If companion window is already open and not minimized, suppress toast HUD + if (isCompanionOpen) { + lastTurnIdRef.current = lastTurn.id; + return; + } + + // Only popup for new turns that are reactions or system events outside the open chamber + if (lastTurn.id !== lastTurnIdRef.current && (lastTurn.id.startsWith('rev-') || lastTurn.id.startsWith('fatigue-'))) { lastTurnIdRef.current = lastTurn.id; setVisible(true); playPopupChime(); @@ -66,9 +88,9 @@ export default function PrincessToast({ onOpenCompanionWindow }: PrincessToastPr } }, 24); } - }, [store.transcript, store.companionSettings.enabled, store.companionSettings.autoPopupEnabled]); + }, [store.transcript, store.companionSettings.enabled, store.companionSettings.autoPopupEnabled, isCompanionOpen]); - if (!visible) return null; + if (!visible || isCompanionOpen) return null; const lastTurn = store.transcript[store.transcript.length - 1]; const emotionMeta = PRINCESS_EMOTIONS[store.activeEmotion] || PRINCESS_EMOTIONS.smiling_warmly; diff --git a/core/__init__.py b/core/__init__.py index a9453acdf7584ec74a74766308c8a684c2b93f5f..97b780f38556aa4df3379ed439eb91264c6c2a2e 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -1 +1,23 @@ """Core shared utilities and dependencies for AlgoSpaced.""" + +import uuid + + +def uuid_str() -> str: + """Generates a UUID string using Python 3.14's native uuid.uuid7() (RFC 9562). + + Falls back to uuid.uuid4() if running in pre-3.14 environments. + """ + uuid_func = getattr(uuid, "uuid7", uuid.uuid4) + return str(uuid_func()) + + +def uuid_hex_short(length: int = 8) -> str: + """Generates a short hex identifier from a UUID (UUIDv7 in Python 3.14+, UUIDv4 fallback). + + Extracts from the random suffix to prevent collisions across sub-minute calls. + """ + if length <= 0: + return "" + uuid_func = getattr(uuid, "uuid7", uuid.uuid4) + return uuid_func().hex[-min(length, 32) :] diff --git a/core/auth.py b/core/auth.py index 610d5ef1da32d4ba09fc501f1216bc0a70d8b23e..820d876baef8593324d40dae73e92487e9896df4 100644 --- a/core/auth.py +++ b/core/auth.py @@ -5,7 +5,7 @@ from firebase_admin import auth as firebase_auth import sandbox_db -Client = Any +type Client = Any class UserSession: diff --git a/core/problem_utils.py b/core/problem_utils.py index d9cb6cfb49897ae9ef021d4be4c0682eeafd133f..5adb97dd7749a405dddc3a6dc82458f6c90ec04e 100644 --- a/core/problem_utils.py +++ b/core/problem_utils.py @@ -29,18 +29,22 @@ def extract_starter_code(reference_code: str) -> str: leading_comments.append(line) else: break - elif stripped.startswith("class ") or stripped.startswith("def "): + elif ( + stripped.startswith("class ") + or stripped.startswith("def ") + or stripped.startswith("type ") + ): break try: tree = ast.parse(reference_code) - # Keep only ClassDef, FunctionDef, and AsyncFunctionDef to prevent leaking top-level state - defs = [ - n - for n in tree.body - if isinstance(n, (ast.ClassDef, ast.FunctionDef, ast.AsyncFunctionDef)) - ] + # Keep ClassDef, FunctionDef, AsyncFunctionDef, and modern TypeAlias (PEP 695) + allowed_types = [ast.ClassDef, ast.FunctionDef, ast.AsyncFunctionDef] + if hasattr(ast, "TypeAlias"): + allowed_types.append(ast.TypeAlias) + + defs = [n for n in tree.body if isinstance(n, tuple(allowed_types))] if not defs: return "def solve():\n pass\n" @@ -65,7 +69,7 @@ def extract_starter_code(reference_code: str) -> str: starter_lines = [] for line in lines: stripped = line.strip() - if stripped.startswith("class "): + if stripped.startswith("class ") or stripped.startswith("type "): starter_lines.append(line) elif stripped.startswith("def "): starter_lines.append(line) diff --git a/data/companion_telemetry.json b/data/companion_telemetry.json deleted file mode 100644 index 09225c7433a5ed6484b0b8f4e2aaab6a3e6fbc8f..0000000000000000000000000000000000000000 --- a/data/companion_telemetry.json +++ /dev/null @@ -1,422 +0,0 @@ -[ - { - "tool_name": "set_study_timer", - "args": { - "minutes": 15 - }, - "success": true, - "execution_time_ms": 12.5, - "hero_name": "Febin", - "source": "client", - "error": null, - "timestamp": 1788689107.1985588 - }, - { - "tool_name": "set_study_timer", - "args": { - "minutes": 15 - }, - "success": true, - "execution_time_ms": 12.5, - "hero_name": "Febin", - "source": "client", - "error": null, - "timestamp": 1788689132.0702274 - }, - { - "tool_name": "set_study_timer", - "args": { - "minutes": 10 - }, - "success": true, - "hero_name": "Febin", - "source": "server_proposed", - "timestamp": 1788689138.6659875 - }, - { - "tool_name": "play_ambient_sound", - "args": { - "soundscape": "campfire" - }, - "success": true, - "hero_name": "Febin", - "source": "server_proposed", - "timestamp": 1788689138.6665707 - }, - { - "tool_name": "record_episodic_event", - "args": { - "eventType": "personal_share", - "title": "Disturbed by a spider", - "description": "Champion expressed sadness, then mentioned seeing a spider, asking if it was big. This seemed to contribute to their discomfort.", - "relatedPattern": "environmental_distraction" - }, - "success": true, - "hero_name": "Champion", - "source": "server_proposed", - "timestamp": 1791558769.2295122 - }, - { - "tool_name": "record_episodic_event", - "args": { - "eventType": "personal_share", - "title": "Disturbed by a spider", - "description": "Champion expressed sadness, then mentioned seeing a spider, asking if it was big. This seemed to contribute to their discomfort.", - "relatedPattern": "environmental_distraction" - }, - "success": true, - "execution_time_ms": 0.0, - "hero_name": "Champion", - "source": "client", - "error": null, - "timestamp": 1791558769.233 - }, - { - "tool_name": "record_episodic_event", - "args": { - "eventType": "personal_share", - "title": "Disturbed by a spider", - "description": "Champion expressed sadness, then mentioned seeing a spider, asking if it was big. This seemed to contribute to their discomfort.", - "relatedPattern": "discomfort_from_environment" - }, - "success": true, - "hero_name": "Champion", - "source": "server_proposed", - "timestamp": 1791558795.1189067 - }, - { - "tool_name": "record_episodic_event", - "args": { - "eventType": "personal_share", - "title": "Disturbed by a spider", - "description": "Champion expressed sadness, then mentioned seeing a spider, asking if it was big. This seemed to contribute to their discomfort.", - "relatedPattern": "discomfort_from_environment" - }, - "success": true, - "execution_time_ms": 0.0, - "hero_name": "Champion", - "source": "client", - "error": null, - "timestamp": 1791558795.121 - }, - { - "tool_name": "record_episodic_event", - "args": { - "eventType": "personal_share", - "title": "Chose to chat over timed break", - "description": "Champion opted for a moment of free-form conversation instead of a structured 5-minute break." - }, - "success": true, - "hero_name": "Champion", - "source": "server_proposed", - "timestamp": 1791558812.4477842 - }, - { - "tool_name": "record_episodic_event", - "args": { - "eventType": "personal_share", - "title": "Chose to chat over timed break", - "description": "Champion opted for a moment of free-form conversation instead of a structured 5-minute break." - }, - "success": true, - "execution_time_ms": 0.0, - "hero_name": "Champion", - "source": "client", - "error": null, - "timestamp": 1791558812.45 - }, - { - "tool_name": "record_episodic_event", - "args": { - "eventType": "personal_share", - "title": "Champion expresses fear", - "description": "Champion directly stated 'be scared' after earlier mentioning a spider and sadness. Seems to be feeling generally uneasy or fearful.", - "relatedPattern": "" - }, - "success": true, - "hero_name": "Champion", - "source": "server_proposed", - "timestamp": 1791558861.7550862 - }, - { - "tool_name": "write_spire_diary", - "args": { - "entry": "Champion confessed to feeling scared; need to offer comfort." - }, - "success": true, - "hero_name": "Champion", - "source": "server_proposed", - "timestamp": 1791558861.755788 - }, - { - "tool_name": "record_episodic_event", - "args": { - "eventType": "personal_share", - "title": "Champion expresses fear", - "description": "Champion directly stated 'be scared' after earlier mentioning a spider and sadness. Seems to be feeling generally uneasy or fearful.", - "relatedPattern": "" - }, - "success": true, - "execution_time_ms": 0.0, - "hero_name": "Champion", - "source": "client", - "error": null, - "timestamp": 1791558861.757 - }, - { - "tool_name": "write_spire_diary", - "args": { - "entry": "Champion confessed to feeling scared; need to offer comfort." - }, - "success": true, - "execution_time_ms": 0.0, - "hero_name": "Champion", - "source": "client", - "error": null, - "timestamp": 1791558861.758 - }, - { - "tool_name": "record_episodic_event", - "args": { - "eventType": "breakthrough", - "title": "Conquered a tough task", - "description": "Champion successfully solved a challenging problem after expressing fear earlier.", - "relatedPattern": "overcame fear/difficulty" - }, - "success": true, - "hero_name": "Champion", - "source": "server_proposed", - "timestamp": 1791563225.3743153 - }, - { - "tool_name": "record_episodic_event", - "args": { - "eventType": "breakthrough", - "title": "Conquered a tough task", - "description": "Champion successfully solved a challenging problem after expressing fear earlier.", - "relatedPattern": "overcame fear/difficulty" - }, - "success": true, - "execution_time_ms": 1.0, - "hero_name": "Champion", - "source": "client", - "error": null, - "timestamp": 1791563225.377 - }, - { - "tool_name": "record_episodic_event", - "args": { - "eventType": "breakthrough", - "title": "Tackled a tough problem", - "description": "Champion successfully solved a challenging problem after expressing fear earlier.", - "relatedPattern": "" - }, - "success": true, - "hero_name": "Champion", - "source": "server_proposed", - "timestamp": 1791563246.3450916 - }, - { - "tool_name": "record_episodic_event", - "args": { - "eventType": "breakthrough", - "title": "Tackled a tough problem", - "description": "Champion successfully solved a challenging problem after expressing fear earlier.", - "relatedPattern": "" - }, - "success": true, - "execution_time_ms": 0.0, - "hero_name": "Champion", - "source": "client", - "error": null, - "timestamp": 1791563246.348 - }, - { - "tool_name": "open_app_window", - "args": { - "window_id": "reviewer" - }, - "success": true, - "hero_name": "Champion", - "source": "server_proposed", - "timestamp": 1791563364.8702972 - }, - { - "tool_name": "record_episodic_event", - "args": { - "eventType": "breakthrough", - "title": "Problem Details Inquiry", - "description": "Champion asked for more details on a problem they solved, showing continued engagement even after solving it.", - "relatedPattern": "deep_dive_curiosity" - }, - "success": true, - "hero_name": "Champion", - "source": "server_proposed", - "timestamp": 1791563364.8715653 - }, - { - "tool_name": "open_app_window", - "args": { - "window_id": "reviewer" - }, - "success": true, - "execution_time_ms": 5.0, - "hero_name": "Champion", - "source": "client", - "error": null, - "timestamp": 1791563364.878 - }, - { - "tool_name": "record_episodic_event", - "args": { - "eventType": "breakthrough", - "title": "Problem Details Inquiry", - "description": "Champion asked for more details on a problem they solved, showing continued engagement even after solving it.", - "relatedPattern": "deep_dive_curiosity" - }, - "success": true, - "execution_time_ms": 5.0, - "hero_name": "Champion", - "source": "client", - "error": null, - "timestamp": 1791563364.879 - }, - { - "tool_name": "record_episodic_event", - "args": { - "eventType": "personal_share", - "title": "Champion's concern for Aurelia's well-being", - "description": "Champion expressed concern that Aurelia must eat, showing care for her.", - "relatedPattern": "" - }, - "success": true, - "hero_name": "Champion", - "source": "server_proposed", - "timestamp": 1791563442.1888142 - }, - { - "tool_name": "write_spire_diary", - "args": { - "entry": "Champion showed concern for my well-being today, a truly kind gesture." - }, - "success": true, - "hero_name": "Champion", - "source": "server_proposed", - "timestamp": 1791563442.1897433 - }, - { - "tool_name": "record_episodic_event", - "args": { - "eventType": "personal_share", - "title": "Champion's concern for Aurelia's well-being", - "description": "Champion expressed concern that Aurelia must eat, showing care for her.", - "relatedPattern": "" - }, - "success": true, - "execution_time_ms": 0.0, - "hero_name": "Champion", - "source": "client", - "error": null, - "timestamp": 1791563442.192 - }, - { - "tool_name": "write_spire_diary", - "args": { - "entry": "Champion showed concern for my well-being today, a truly kind gesture." - }, - "success": true, - "execution_time_ms": 0.0, - "hero_name": "Champion", - "source": "client", - "error": null, - "timestamp": 1791563442.193 - }, - { - "tool_name": "record_episodic_event", - "args": { - "eventType": "personal_share", - "title": "Won a bet", - "description": "Champion shared that they won a bet today, indicating good personal fortune outside of their studies." - }, - "success": true, - "hero_name": "Champion", - "source": "server_proposed", - "timestamp": 1791563475.6878104 - }, - { - "tool_name": "record_episodic_event", - "args": { - "eventType": "personal_share", - "title": "Won a bet", - "description": "Champion shared that they won a bet today, indicating good personal fortune outside of their studies." - }, - "success": true, - "execution_time_ms": 0.0, - "hero_name": "Champion", - "source": "client", - "error": null, - "timestamp": 1791563475.69 - }, - { - "tool_name": "record_episodic_event", - "args": { - "eventType": "breakthrough", - "title": "Tough Task Conquered", - "description": "Champion conquered a tough problem and feels accomplished." - }, - "success": true, - "hero_name": "Champion", - "source": "server_proposed", - "timestamp": 1791608213.0370414 - }, - { - "tool_name": "record_episodic_event", - "args": { - "eventType": "breakthrough", - "title": "Tough Task Conquered", - "description": "Champion conquered a tough problem and feels accomplished." - }, - "success": true, - "execution_time_ms": 0.0, - "hero_name": "Champion", - "source": "client", - "error": null, - "timestamp": 1791608213.049 - }, - { - "tool_name": "hint_requested", - "args": { - "test": "async_val" - }, - "success": true, - "execution_time_ms": null, - "hero_name": "Champion", - "source": "client", - "error": null, - "timestamp": 1791630917.0461233 - }, - { - "tool_name": "hint_requested", - "args": { - "test": "async_val" - }, - "success": true, - "execution_time_ms": null, - "hero_name": "Champion", - "source": "client", - "error": null, - "timestamp": 1791638114.6923687 - }, - { - "tool_name": "hint_requested", - "args": { - "test": "async_val" - }, - "success": true, - "execution_time_ms": null, - "hero_name": "Champion", - "source": "client", - "error": null, - "timestamp": 1791638560.2518651 - } -] \ No newline at end of file diff --git a/db.py b/db.py index 16209ef78a95351ec57f8c3c5e42b400ded636a2..2639188a62fa241d1b4b3cabbf24e6abdb272bd0 100644 --- a/db.py +++ b/db.py @@ -1,19 +1,15 @@ import json import os -import uuid from datetime import UTC, datetime +from pathlib import Path from typing import Any -try: - import streamlit as st -except ImportError: - st = None - import firebase_admin from firebase_admin import credentials, firestore from google.cloud.firestore_v1.base_query import FieldFilter import cache +from core import uuid_str _firestore_client = None @@ -34,15 +30,15 @@ def init_firebase(): # 1. Try explicit FIREBASE_CREDENTIALS_PATH or candidate files in project cred = None - root_dir = os.path.dirname(os.path.abspath(__file__)) + root_dir = Path(__file__).resolve().parent candidate_files = [ os.environ.get("FIREBASE_CREDENTIALS_PATH"), - os.path.join(root_dir, "firebase-credentials.json"), - os.path.join(root_dir, "firebase-credentials.json.json"), - os.path.join(root_dir, "serviceAccountKey.json"), + str(root_dir / "firebase-credentials.json"), + str(root_dir / "firebase-credentials.json.json"), + str(root_dir / "serviceAccountKey.json"), ] for c_path in candidate_files: - if c_path and os.path.exists(c_path): + if c_path and Path(c_path).exists(): try: cred = credentials.Certificate(c_path) break @@ -52,25 +48,6 @@ def init_firebase(): # 2. Try FIREBASE_SERVICE_ACCOUNT_JSON env var (raw JSON string) if not cred: service_account_json = os.environ.get("FIREBASE_SERVICE_ACCOUNT_JSON") - if not service_account_json: - try: - if hasattr(st, "secrets") and st.secrets: - service_account_json = st.secrets.get("FIREBASE_SERVICE_ACCOUNT_JSON") - except Exception: - pass - - if not service_account_json: - try: - import toml - - secrets_path = os.path.join( - os.path.dirname(os.path.abspath(__file__)), ".streamlit", "secrets.toml" - ) - if os.path.exists(secrets_path): - sec = toml.load(secrets_path) - service_account_json = sec.get("FIREBASE_SERVICE_ACCOUNT_JSON") - except Exception: - pass if service_account_json: if isinstance(service_account_json, str): @@ -169,8 +146,8 @@ def get_mock_client(client_or_user_id: Any): def log_trace(message: str): try: - log_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "sync.log") - with open(log_path, "a", encoding="utf-8") as f: + log_path = Path(__file__).resolve().parent / "sync.log" + with log_path.open("a", encoding="utf-8") as f: f.write(f"[{datetime.now(UTC).isoformat()}] {message}\n") except Exception: pass @@ -377,7 +354,7 @@ def insert_problem(problem_data: dict, client_or_user_id=None): if not db: return None - prob_id = problem_data.get("id") or str(uuid.uuid4()) + prob_id = problem_data.get("id") or uuid_str() problem_data["id"] = prob_id problem_data["user_id"] = user_id if "created_at" not in problem_data: @@ -478,7 +455,7 @@ def insert_review(review_data: dict, client_or_user_id=None): if not db: return None - rev_id = review_data.get("id") or str(uuid.uuid4()) + rev_id = review_data.get("id") or uuid_str() review_data["id"] = rev_id review_data["user_id"] = user_id if "last_reviewed" not in review_data: @@ -1052,7 +1029,7 @@ def add_challenge_history( if not db: return None - hist_id = str(uuid.uuid4()) + hist_id = uuid_str() history_data = { "id": hist_id, "user_id": user_id, diff --git a/gdoc_writer.py b/gdoc_writer.py index 380c01f11f08cf74af5fabd583fc78d7079073ef..0bc02bf43cd742863741c8164f7e056e1be0681a 100644 --- a/gdoc_writer.py +++ b/gdoc_writer.py @@ -59,6 +59,9 @@ PYTHON_KEYWORDS = { "while", "with", "yield", + "match", + "case", + "type", "self", "int", "str", diff --git a/gdrive_sync.py b/gdrive_sync.py index a9c2a4f11fdbbad3928641797025a8ec51ad1632..c23b4967c64c480a8870782c5550ecb9887a9de8 100644 --- a/gdrive_sync.py +++ b/gdrive_sync.py @@ -1,9 +1,5 @@ import re -try: - import streamlit as st -except ImportError: - st = None from google.oauth2 import service_account from googleapiclient.discovery import build @@ -56,26 +52,6 @@ def get_secret(key): pass return env_val - try: - # Try Streamlit secrets first - if hasattr(st, "secrets") and st.secrets and key in st.secrets: - return st.secrets[key] - except Exception: - pass - - # Fallback to loading from toml directly - import toml - - try: - secrets_path = os.path.join( - os.path.dirname(os.path.abspath(__file__)), ".streamlit", "secrets.toml" - ) - if os.path.exists(secrets_path): - data = toml.load(secrets_path) - if key in data: - return data[key] - except Exception: - pass return None @@ -290,14 +266,14 @@ def sync_gdrive(client=None): try: creds = get_credentials() except KeyError: - return "GCP credentials not found in secrets.toml" + return "GCP credentials not found in environment or credentials file" drive_service = build("drive", "v3", credentials=creds) docs_service = build("docs", "v1", credentials=creds) folder_id = get_secret("GDRIVE_FOLDER_ID") if not folder_id: - return "GDRIVE_FOLDER_ID not found in secrets.toml" + return "GDRIVE_FOLDER_ID not found in environment variables" query = f"'{folder_id}' in parents and mimeType='application/vnd.google-apps.document' and trashed=false" results = drive_service.files().list(q=query, fields="nextPageToken, files(id, name)").execute() diff --git a/main.py b/main.py index 9ab290b46b82722b7e5dd0ae24b553279c086ade..5c0d44740ee5096c16a7c32d7586840862b4b1ff 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,6 @@ import logging import mimetypes -import os +from pathlib import Path from fastapi import FastAPI, HTTPException, Request from fastapi.middleware.cors import CORSMiddleware @@ -130,22 +130,22 @@ async def add_cache_control_headers(request: Request, call_next): # Serve static files from Vite frontend in production -frontend_dist = os.path.join(os.path.dirname(__file__), "algospaced-ui", "dist") -if os.path.exists(frontend_dist): - assets_dir = os.path.join(frontend_dist, "assets") - if os.path.exists(assets_dir): +frontend_dist = Path(__file__).resolve().parent / "algospaced-ui" / "dist" +if frontend_dist.exists(): + assets_dir = frontend_dist / "assets" + if assets_dir.exists(): app.mount("/assets", ImmutableStaticFiles(directory=assets_dir), name="assets") - sprites_dir = os.path.join(frontend_dist, "sprites") - if os.path.exists(sprites_dir): + sprites_dir = frontend_dist / "sprites" + if sprites_dir.exists(): app.mount("/sprites", ImmutableStaticFiles(directory=sprites_dir), name="sprites") - icons_dir = os.path.join(frontend_dist, "icons") - if os.path.exists(icons_dir): + icons_dir = frontend_dist / "icons" + if icons_dir.exists(): app.mount("/icons", ImmutableStaticFiles(directory=icons_dir), name="icons") - wallpapers_dir = os.path.join(frontend_dist, "wallpapers") - if os.path.exists(wallpapers_dir): + wallpapers_dir = frontend_dist / "wallpapers" + if wallpapers_dir.exists(): app.mount( "/wallpapers", ImmutableStaticFiles(directory=wallpapers_dir), @@ -154,8 +154,8 @@ if os.path.exists(frontend_dist): @app.get("/", include_in_schema=False) def serve_root(): - index_file = os.path.join(frontend_dist, "index.html") - if os.path.exists(index_file): + index_file = frontend_dist / "index.html" + if index_file.exists(): return FileResponse( index_file, headers={"Cache-Control": "no-cache, no-store, must-revalidate"}, @@ -169,8 +169,8 @@ if os.path.exists(frontend_dist): raise HTTPException(status_code=404, detail="API endpoint not found") # Check if direct static file exists in dist (e.g. manifest, sw.js, favicon) - direct_file = os.path.join(frontend_dist, fallback_path) - if os.path.isfile(direct_file): + direct_file = frontend_dist / fallback_path + if direct_file.is_file(): headers = {} if fallback_path.startswith("assets/") or any( fallback_path.endswith(ext) for ext in STATIC_CACHE_EXTENSIONS @@ -182,8 +182,8 @@ if os.path.exists(frontend_dist): headers["Cache-Control"] = "public, max-age=86400" return FileResponse(direct_file, headers=headers) - index_file = os.path.join(frontend_dist, "index.html") - if os.path.exists(index_file): + index_file = frontend_dist / "index.html" + if index_file.exists(): return FileResponse( index_file, headers={"Cache-Control": "no-cache, no-store, must-revalidate"}, diff --git a/pyproject.toml b/pyproject.toml index 0d22402cef76a2d845a0496eee380adc670510c3..fae7574a90afc0492b72de09f0168aba21757ebb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ readme = "README.md" authors = [ { name = "iamfebin" } ] -requires-python = ">=3.14" +requires-python = ">=3.14.8" dependencies = [ "fastapi>=0.110.0", "firebase-admin>=6.5.0", @@ -21,7 +21,6 @@ dependencies = [ "python-dotenv>=1.2.4", "python-multipart>=0.0.9", "redis>=5.0.4", - "toml>=0.10.2", "uvicorn>=0.29.0", "watchfiles>=1.2.0", ] @@ -30,7 +29,7 @@ dependencies = [ algospaced-dsa-review = "algospaced_dsa_review:main" [build-system] -requires = ["uv_build>=0.12.9,<0.13.0"] +requires = ["uv_build>=0.12.9,<0.14.0"] build-backend = "uv_build" [dependency-groups] diff --git a/routers/challenges.py b/routers/challenges.py index 47535968eb9cdc9fa5132a8545dfd12da9ef1173..9870f86767a3d8d678f95a75c45cb8fea89b7c2c 100644 --- a/routers/challenges.py +++ b/routers/challenges.py @@ -221,6 +221,7 @@ async def get_mysql_status( schema = {} try: + def _get_schema(): conn = sql_playground.get_connection(user_id) try: @@ -267,7 +268,9 @@ async def run_mysql_query(req: SQLQueryRequest, client: Client = Depends(get_aut if cached_challenge and isinstance(cached_challenge, dict) and "title" in cached_challenge: ACTIVE_SQL_CHALLENGES[user_id] = cached_challenge else: - raise HTTPException(status_code=400, detail="No active SQL session. Type 'db init' first.") + raise HTTPException( + status_code=400, detail="No active SQL session. Type 'db init' first." + ) challenge = ACTIVE_SQL_CHALLENGES[user_id] diff --git a/routers/companion.py b/routers/companion.py index cb3e5a08a4d4a41b55515c3c47fc5e16d1822629..6d348334282dfb1a64190330ac1e7678bde6ad1b 100644 --- a/routers/companion.py +++ b/routers/companion.py @@ -6,6 +6,7 @@ import re import threading import time from collections import defaultdict +from pathlib import Path from fastapi import APIRouter, Depends, Header, Request from fastapi.responses import StreamingResponse @@ -65,8 +66,8 @@ class CompanionTelemetryEvent(BaseModel): CompanionTelemetryEvent.model_rebuild() -ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -TELEMETRY_FILE = os.path.join(ROOT_DIR, "data", "companion_telemetry.json") +ROOT_DIR = Path(__file__).resolve().parent.parent +TELEMETRY_FILE = ROOT_DIR / "data" / "companion_telemetry.json" _telemetry_lock = threading.Lock() _telemetry_events: list[dict] = [] @@ -74,8 +75,9 @@ _telemetry_events: list[dict] = [] def _load_telemetry(): global _telemetry_events try: - if os.path.exists(TELEMETRY_FILE): - with open(TELEMETRY_FILE, encoding="utf-8") as f: + telemetry_path = Path(TELEMETRY_FILE) + if telemetry_path.exists(): + with telemetry_path.open(encoding="utf-8") as f: data = json.load(f) if isinstance(data, list): _telemetry_events = data[-500:] @@ -94,19 +96,18 @@ _has_pending_save = False def _write_telemetry_disk(events_snapshot: list[dict]): temp_file = None try: - dir_name = os.path.dirname(TELEMETRY_FILE) - os.makedirs(dir_name, exist_ok=True) - temp_file = os.path.join( - dir_name, f"companion_telemetry_{os.getpid()}_{threading.get_ident()}.tmp" - ) - with open(temp_file, "w", encoding="utf-8") as f: + telemetry_path = Path(TELEMETRY_FILE) + dir_name = telemetry_path.parent + dir_name.mkdir(parents=True, exist_ok=True) + temp_file = dir_name / f"companion_telemetry_{os.getpid()}_{threading.get_ident()}.tmp" + with temp_file.open("w", encoding="utf-8") as f: json.dump(events_snapshot, f, indent=2) - os.replace(temp_file, TELEMETRY_FILE) + temp_file.replace(telemetry_path) except Exception as e: logger.warning(f"Failed to save telemetry logs: {e}") - if temp_file and os.path.exists(temp_file): + if temp_file and temp_file.exists(): try: - os.unlink(temp_file) + temp_file.unlink() except Exception: pass diff --git a/routers/config.py b/routers/config.py index 0cf98de533b07d845e41fc3b9ff992cac2faa52f..64588335c2dde72d9565658b5a1ae54b277adef6 100644 --- a/routers/config.py +++ b/routers/config.py @@ -1,6 +1,5 @@ import os -import toml from fastapi import APIRouter router = APIRouter(tags=["config"]) @@ -8,7 +7,7 @@ router = APIRouter(tags=["config"]) @router.get("/api/config") def get_public_config(): - config = { + return { "apiKey": os.environ.get("FIREBASE_API_KEY", ""), "authDomain": os.environ.get("FIREBASE_AUTH_DOMAIN", ""), "projectId": os.environ.get("FIREBASE_PROJECT_ID", ""), @@ -17,18 +16,3 @@ def get_public_config(): "appId": os.environ.get("FIREBASE_APP_ID", ""), "measurementId": os.environ.get("FIREBASE_MEASUREMENT_ID", ""), } - - if not config["apiKey"] or not config["projectId"]: - try: - root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - secrets_path = os.path.join(root_dir, ".streamlit", "secrets.toml") - if os.path.exists(secrets_path): - sec = toml.load(secrets_path) - for k in list(config.keys()): - if not config[k]: - env_key = f"FIREBASE_{k.upper()}" - config[k] = sec.get(env_key) or sec.get(k) or "" - except Exception: - pass - - return config diff --git a/routers/explorer.py b/routers/explorer.py index 4cd64b78dd88349fa7d083d0b572c6672ccab4aa..60ebf3c3f54786c5acf2892d4d67154dda91b6b8 100644 --- a/routers/explorer.py +++ b/routers/explorer.py @@ -349,16 +349,24 @@ def update_explorer_problem( @router.get("/api/explorer/export") -async def export_solutions_zip(client: Client = Depends(get_auth_session)): +async def export_solutions_zip( + compression: str = "deflate", + client: Client = Depends(get_auth_session), +): user_id = await asyncio.to_thread(db.get_current_user_id, client) if not user_id: raise HTTPException(status_code=401, detail="Authentication failed") try: + def _generate_zip() -> io.BytesIO: problems = db.get_all_problems(client) zip_buffer = io.BytesIO() - with zipfile.ZipFile(zip_buffer, "w", zipfile.ZIP_DEFLATED) as zip_file: + is_zstd = compression.lower() in ("zstd", "zstandard") and hasattr( + zipfile, "ZIP_ZSTANDARD" + ) + compress_type = zipfile.ZIP_ZSTANDARD if is_zstd else zipfile.ZIP_DEFLATED + with zipfile.ZipFile(zip_buffer, "w", compress_type) as zip_file: for p in problems: name = p.get("name", "Unnamed_Problem") pattern = p.get("pattern", "General") @@ -386,7 +394,12 @@ async def export_solutions_zip(client: Client = Depends(get_auth_session)): zip_buffer = await asyncio.to_thread(_generate_zip) - headers = {"Content-Disposition": "attachment; filename=algospaced_solutions.zip"} + filename = ( + "algospaced_solutions_zstd.zip" + if compression.lower() in ("zstd", "zstandard") + else "algospaced_solutions.zip" + ) + headers = {"Content-Disposition": f"attachment; filename={filename}"} return StreamingResponse(zip_buffer, media_type="application/zip", headers=headers) except Exception as e: raise HTTPException(status_code=500, detail=str(e)) @@ -402,6 +415,7 @@ async def import_problems(file: UploadFile = File(...), client: Client = Depends try: contents = await file.read() if filename.lower().endswith(".csv"): + def _import_csv() -> int: decoded = contents.decode("utf-8-sig", errors="replace") @@ -457,7 +471,12 @@ async def import_problems(file: UploadFile = File(...), client: Client = Depends "python solution", ): field_mapping["reference_code"] = col - elif col_lower in ("description", "notes", "doc description", "doc_description"): + elif col_lower in ( + "description", + "notes", + "doc description", + "doc_description", + ): field_mapping["description"] = col imported_count = 0 @@ -479,12 +498,16 @@ async def import_problems(file: UploadFile = File(...), client: Client = Depends except ValueError: problem_number = None - pattern = row.get(field_mapping.get("pattern", "pattern"), "").strip() or "General" + pattern = ( + row.get(field_mapping.get("pattern", "pattern"), "").strip() or "General" + ) difficulty = ( - row.get(field_mapping.get("difficulty", "difficulty"), "").strip() or "Medium" + row.get(field_mapping.get("difficulty", "difficulty"), "").strip() + or "Medium" ) optimal_time = ( - row.get(field_mapping.get("optimal_time", "optimal_time"), "").strip() or "O(N)" + row.get(field_mapping.get("optimal_time", "optimal_time"), "").strip() + or "O(N)" ) optimal_space = ( row.get(field_mapping.get("optimal_space", "optimal_space"), "").strip() @@ -548,6 +571,7 @@ async def import_problems(file: UploadFile = File(...), client: Client = Depends return {"message": f"Successfully imported {count} problems from CSV."} elif filename.lower().endswith(".db"): + def _import_sqlite() -> int: with tempfile.NamedTemporaryFile(suffix=".db", delete=False) as tmp: tmp.write(contents) @@ -586,7 +610,8 @@ async def import_problems(file: UploadFile = File(...), client: Client = Depends if old_id: try: temp_cursor.execute( - "SELECT * FROM user_reviews WHERE problem_id = ?", (old_id,) + "SELECT * FROM user_reviews WHERE problem_id = ?", + (old_id,), ) rev_row = temp_cursor.fetchone() if rev_row: diff --git a/routers/github_sync.py b/routers/github_sync.py index d455170c630d24e49e419a9fb356d0b0fa7d051e..6a293d2cc702b99aa025a5409b41c526ac058d9c 100644 --- a/routers/github_sync.py +++ b/routers/github_sync.py @@ -90,7 +90,9 @@ async def github_api_request_async( # If github_api_request is patched in test suites, delegate to it if isinstance(github_api_request, Mock) or hasattr(github_api_request, "assert_called"): - return await asyncio.to_thread(github_api_request, endpoint, token, method=method, data=data) + return await asyncio.to_thread( + github_api_request, endpoint, token, method=method, data=data + ) url = f"{GITHUB_API_BASE}{endpoint}" if endpoint.startswith("/") else endpoint headers = { @@ -140,7 +142,9 @@ def get_file_sha(owner: str, repo: str, path: str, branch: str, token: str) -> s return None -async def get_file_sha_async(owner: str, repo: str, path: str, branch: str, token: str) -> str | None: +async def get_file_sha_async( + owner: str, repo: str, path: str, branch: str, token: str +) -> str | None: """Returns SHA of existing file in GitHub repository or None if 404 (async).""" status, res = await github_api_request_async( f"/repos/{owner}/{repo}/contents/{path}?ref={branch}", @@ -726,9 +730,7 @@ async def init_github_repo(req: InitRepoRequest): owner = user_res.get("login") # 2. Check if repository already exists - status, repo_res = await github_api_request_async( - f"/repos/{owner}/{repo_name}", token - ) + status, repo_res = await github_api_request_async(f"/repos/{owner}/{repo_name}", token) if status == 200: return { "success": True, diff --git a/routers/reviews.py b/routers/reviews.py index 70adbafd6a91e4b0609e742099906921131ba2c2..c6f66ac42ee352596bab641f2f00778638f1b725 100644 --- a/routers/reviews.py +++ b/routers/reviews.py @@ -1,7 +1,6 @@ import asyncio import json import re -import uuid from datetime import UTC, datetime from typing import Any @@ -14,6 +13,7 @@ import db import llm_reviewer import sandbox import srs_logic +from core import uuid_hex_short from core.auth import Client, get_auth_session from core.limiter import check_burst_rate_limit from core.problem_utils import ( @@ -495,7 +495,7 @@ def save_reference_solution(req: SaveReferenceRequest, client: Client = Depends( break if not matched: new_sol = { - "id": req.solution_id or f"sol-{uuid.uuid4().hex[:8]}", + "id": req.solution_id or f"sol-{uuid_hex_short()}", "name": req.solution_name or "Personal Solution", "pattern": req.pattern or existing_problem.get("pattern") @@ -537,7 +537,7 @@ def save_reference_solution(req: SaveReferenceRequest, client: Client = Depends( elif req.solution_name: prob_data["solutions"] = [ { - "id": req.solution_id or f"sol-{uuid.uuid4().hex[:8]}", + "id": req.solution_id or f"sol-{uuid_hex_short()}", "name": req.solution_name, "pattern": req.pattern or "General Algorithm", "time_complexity": req.time_complexity or req.optimal_time or "O(N)", @@ -595,6 +595,7 @@ async def get_or_generate_solution( prob_id = req.problem_id prob = None if prob_id: + def _fetch_prob_by_id(): p = db.get_problem(prob_id, client) if p and ( @@ -607,6 +608,7 @@ async def get_or_generate_solution( prob = await asyncio.to_thread(_fetch_prob_by_id) elif req.problem_number is not None: + def _fetch_prob_by_num(): probs = db.get_problems_by_number(req.problem_number, client) user_probs = [p for p in probs if p.get("user_id") == user_id] diff --git a/ruff.toml b/ruff.toml index 3ce877fd270f2810bb814ecbb04068fc0a07661a..9fd9dac3271d8902491529ce134a44ccd3bc5b63 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,5 +1,5 @@ # Ruff configuration file for AlgoSpaced-DSA-Review backend -target-version = "py313" +target-version = "py314" line-length = 100 exclude = [ "scripts", diff --git a/sandbox.py b/sandbox.py index f568cedb68d92364aa673ff7bef1ab4780cd863b..d60ef9a4597e4b8c8a31fa130ffdf6edd2a5799e 100644 --- a/sandbox.py +++ b/sandbox.py @@ -15,6 +15,10 @@ from collections import defaultdict, deque, Counter import copy import re import inspect +try: + import annotationlib +except ImportError: + annotationlib = None from typing import List, Dict, Set, Tuple, Optional, Any, Union true = True @@ -286,12 +290,36 @@ def run_tests(): sig = None params = [] param_names = [] + func_annotations = {} + fmt = getattr(annotationlib.Format, "FORWARDREF", None) if annotationlib is not None else None + if annotationlib is not None: + try: + func_annotations = annotationlib.get_annotations(func, format=fmt) if fmt else annotationlib.get_annotations(func) + except Exception: + try: + func_annotations = annotationlib.get_annotations(func) + except Exception: + pass + elif hasattr(inspect, "get_annotations"): + try: + func_annotations = inspect.get_annotations(func) + except Exception: + pass + try: - sig = inspect.signature(func) + if fmt is not None: + sig = inspect.signature(func, annotation_format=fmt) + else: + sig = inspect.signature(func) params = [p for p in sig.parameters.values() if p.kind in (p.POSITIONAL_ONLY, p.POSITIONAL_OR_KEYWORD) and p.name != 'self'] param_names = [p.name for p in params] except Exception: - pass + try: + sig = inspect.signature(func) + params = [p for p in sig.parameters.values() if p.kind in (p.POSITIONAL_ONLY, p.POSITIONAL_OR_KEYWORD) and p.name != 'self'] + param_names = [p.name for p in params] + except Exception: + pass for idx, tc in enumerate(test_cases): raw_input = tc.get("input", []) @@ -340,7 +368,7 @@ def run_tests(): # Convert ListNode / TreeNode arguments where applicable for i, arg in enumerate(call_args): p_name = param_names[i] if i < len(param_names) else '' - p_anno = str(params[i].annotation) if i < len(params) else '' + p_anno = str(func_annotations.get(p_name, params[i].annotation if i < len(params) else '')) if isinstance(arg, (list, tuple)): if 'ListNode' in p_anno or p_name.lower() in ('head', 'list1', 'list2', 'l1', 'l2', 'node'): call_args[i] = list_to_linked_list(arg) @@ -414,7 +442,7 @@ def run_python_sandbox( # Try Docker execution try: - # Run python:3.11-slim container with stdin, no network, 128MB memory, 0.5 CPU + # Run python:3.14-slim container with stdin, no network, 128MB memory, 0.5 CPU # On Windows, we pipe the script directly to python via stdin to avoid path mounts cmd = [ "docker", @@ -427,7 +455,7 @@ def run_python_sandbox( "128m", "--cpus", "0.5", - "python:3.11-slim", + "python:3.14-slim", "python", ] @@ -461,7 +489,7 @@ def run_python_sandbox( "sandbox_type": "docker", } - except (subprocess.TimeoutExpired, TimeoutError): + except subprocess.TimeoutExpired, TimeoutError: # Clean up process try: proc.kill() diff --git a/sandbox_db.py b/sandbox_db.py index 60d1029fe6ae6f3d929344f7215fb4cb5af58595..acb188cbe859bbbc405c8baee03b3a22d80dc1b9 100644 --- a/sandbox_db.py +++ b/sandbox_db.py @@ -1,15 +1,16 @@ import json -import os import sqlite3 -import uuid from datetime import UTC, datetime +from pathlib import Path -DB_FOLDER = os.path.join(os.path.dirname(os.path.abspath(__file__)), "scratch") -DB_PATH = os.path.join(DB_FOLDER, "sandbox.db") +from core import uuid_str + +DB_FOLDER = Path(__file__).resolve().parent / "scratch" +DB_PATH = DB_FOLDER / "sandbox.db" def init_db(): - os.makedirs(DB_FOLDER, exist_ok=True) + DB_FOLDER.mkdir(parents=True, exist_ok=True) conn = sqlite3.connect(DB_PATH) cursor = conn.cursor() @@ -465,7 +466,7 @@ class QueryBuilder: for row_data in data_list: # Auto generate UUID if not exists or None if "id" in row_data and row_data["id"] is None: - row_data["id"] = str(uuid.uuid4()) + row_data["id"] = uuid_str() elif ( self.table_name in ( @@ -476,7 +477,7 @@ class QueryBuilder: ) and "id" not in row_data ): - row_data["id"] = str(uuid.uuid4()) + row_data["id"] = uuid_str() row_copy = dict(row_data) for k, v in row_copy.items(): @@ -542,7 +543,7 @@ class QueryBuilder: row_data = self.op_data if not isinstance(self.op_data, list) else self.op_data[0] if self.table_name == "user_journey_progress": if "id" not in row_data: - row_data["id"] = str(uuid.uuid4()) + row_data["id"] = uuid_str() columns = list(row_data.keys()) placeholders = ", ".join(["?"] * len(columns)) query = f""" diff --git a/scripts/quality_gate.py b/scripts/quality_gate.py index 76f7636b806bf4f901b11a393b6301fcf1171c26..f3cdf4b256b444926d73c8bf1007ea5c13e10137 100644 --- a/scripts/quality_gate.py +++ b/scripts/quality_gate.py @@ -11,7 +11,6 @@ Exit codes: 1 - One or more quality gates failed. """ -import os import re import subprocess import sys diff --git a/srs_logic.py b/srs_logic.py index 58f88fb8912ee9511ad3fd96d7b206f929a55539..700c8f00c07be99e6fcec321bef0adcb6b30f1af 100644 --- a/srs_logic.py +++ b/srs_logic.py @@ -1,4 +1,4 @@ -from datetime import UTC, datetime +from datetime import UTC, date, datetime from fsrs import Card, Rating, Scheduler, State @@ -55,6 +55,21 @@ def process_fsrs_review(card_data: dict, rating_val: int) -> tuple[dict, datetim return updated_fields, new_card.due +def _parse_streak_date(raw_date) -> date | None: + """Parses date string or object using Python 3.14 native date.strptime with ISO support.""" + if not raw_date: + return None + if isinstance(raw_date, datetime): + return raw_date.date() + if isinstance(raw_date, date): + return raw_date + try: + clean_date_str = str(raw_date).split("T")[0].split(" ")[0].strip() + return date.strptime(clean_date_str, "%Y-%m-%d") + except ValueError, TypeError: + return None + + def lazy_check_streak(streak_data): """ Evaluates streak on Login (lazy checking). @@ -65,7 +80,9 @@ def lazy_check_streak(streak_data): now = datetime.now(UTC) current_date = now.date() - last_active_date = datetime.strptime(streak_data["last_active_date"], "%Y-%m-%d").date() + last_active_date = _parse_streak_date(streak_data["last_active_date"]) + if not last_active_date: + return streak_data delta = (current_date - last_active_date).days @@ -81,14 +98,15 @@ def increment_streak(streak_data): now = datetime.now(UTC) current_date = now.date() - last_active = streak_data.get("last_active_date") - if last_active: - last_active_date = datetime.strptime(last_active, "%Y-%m-%d").date() + last_active_raw = streak_data.get("last_active_date") + last_active_date = _parse_streak_date(last_active_raw) + + if last_active_date is not None: delta = (current_date - last_active_date).days else: - delta = 2 # force increment for first time + delta = 2 # force increment for first time or unparseable date - if delta == 1 or last_active is None: + if delta == 1 or last_active_raw is None or last_active_date is None: streak_data["current_streak"] += 1 streak_data["longest_streak"] = max( streak_data["longest_streak"], streak_data["current_streak"] diff --git a/tests/integration/test_security_headers.py b/tests/integration/test_security_headers.py index d3610a6be40eaf5014f2d8ec5917c4470af3e48a..2429e852b52dd1219df289ae50c389d1a36cafaa 100644 --- a/tests/integration/test_security_headers.py +++ b/tests/integration/test_security_headers.py @@ -39,8 +39,12 @@ def test_csp_script_src_excludes_unsafe_inline_and_unsafe_eval(): (d.strip() for d in csp.split(";") if d.strip().startswith("script-src")), "" ) assert script_directive, "script-src directive must exist in CSP" - assert "'unsafe-eval'" not in script_directive, "'unsafe-eval' must not be present in script-src" - assert "'unsafe-inline'" not in script_directive, "'unsafe-inline' must not be present in script-src" + assert "'unsafe-eval'" not in script_directive, ( + "'unsafe-eval' must not be present in script-src" + ) + assert "'unsafe-inline'" not in script_directive, ( + "'unsafe-inline' must not be present in script-src" + ) assert "'unsafe-eval'" not in csp, "'unsafe-eval' must not be present anywhere in CSP" @@ -54,7 +58,6 @@ def test_csp_style_src_allows_unsafe_inline_for_runtime_styling(): assert "'unsafe-inline'" in style_directive - def test_build_csp_header_meta_tag_variant(): """Verify that frame-ancestors and form-action are excluded for HTML meta tags.""" meta_csp = build_csp_header(include_frame_ancestors=False, include_form_action=False) diff --git a/tests/unit/test_async_services.py b/tests/unit/test_async_services.py index f3b7a0d9cbbd36b8d3943df69075546dacbe3d49..0a43737afeaabce56725e3c23e2cc69bb38c867c 100644 --- a/tests/unit/test_async_services.py +++ b/tests/unit/test_async_services.py @@ -100,7 +100,10 @@ async def test_stream_ai_content_async_prevents_duplicate_on_partial_failure(): with ( patch("ai_provider.get_secret", return_value="fake_server_key"), patch("ai_provider.stream_gemini_async", side_effect=failing_stream), - patch("ai_provider.generate_ai_content_async", new=AsyncMock(return_value=("Full Fallback Text", "fallback"))) as mock_gen, + patch( + "ai_provider.generate_ai_content_async", + new=AsyncMock(return_value=("Full Fallback Text", "fallback")), + ) as mock_gen, ): chunks = [] async for chunk, _prov in ai_provider.stream_ai_content_async( @@ -117,12 +120,16 @@ async def test_stream_ai_content_async_prevents_duplicate_on_partial_failure(): @pytest.mark.asyncio async def test_call_groq_async_success_and_error_handling(): """Verify call_groq_async returns content on 200 and surfaces HTTP status errors on failure.""" + # 1. Success case def handler_success(request: httpx.Request) -> httpx.Response: return httpx.Response(200, json={"choices": [{"message": {"content": "Groq Response"}}]}) mock_transport = MockTransport(handler_success) - with patch("httpx.AsyncClient", side_effect=lambda *args, **kwargs: _real_async_client(transport=mock_transport)): + with patch( + "httpx.AsyncClient", + side_effect=lambda *args, **kwargs: _real_async_client(transport=mock_transport), + ): res = await ai_provider.call_groq_async("test_key", "system", "user") assert res == "Groq Response" @@ -131,7 +138,10 @@ async def test_call_groq_async_success_and_error_handling(): return httpx.Response(429, text="Rate limit exceeded: 30 requests per minute") mock_transport_err = MockTransport(handler_rate_limited) - with patch("httpx.AsyncClient", side_effect=lambda *args, **kwargs: _real_async_client(transport=mock_transport_err)): + with patch( + "httpx.AsyncClient", + side_effect=lambda *args, **kwargs: _real_async_client(transport=mock_transport_err), + ): with pytest.raises(RuntimeError) as exc_info: await ai_provider.call_groq_async("test_key", "system", "user") assert "429" in str(exc_info.value) @@ -141,11 +151,17 @@ async def test_call_groq_async_success_and_error_handling(): @pytest.mark.asyncio async def test_call_openrouter_async_success_and_error_handling(): """Verify call_openrouter_async returns content on 200 and surfaces HTTP status errors on failure.""" + def handler_success(request: httpx.Request) -> httpx.Response: - return httpx.Response(200, json={"choices": [{"message": {"content": "OpenRouter Response"}}]}) + return httpx.Response( + 200, json={"choices": [{"message": {"content": "OpenRouter Response"}}]} + ) mock_transport = MockTransport(handler_success) - with patch("httpx.AsyncClient", side_effect=lambda *args, **kwargs: _real_async_client(transport=mock_transport)): + with patch( + "httpx.AsyncClient", + side_effect=lambda *args, **kwargs: _real_async_client(transport=mock_transport), + ): res = await ai_provider.call_openrouter_async("test_key", "system", "user") assert res == "OpenRouter Response" @@ -153,7 +169,10 @@ async def test_call_openrouter_async_success_and_error_handling(): return httpx.Response(401, text="Invalid API key provided") mock_transport_err = MockTransport(handler_auth_error) - with patch("httpx.AsyncClient", side_effect=lambda *args, **kwargs: _real_async_client(transport=mock_transport_err)): + with patch( + "httpx.AsyncClient", + side_effect=lambda *args, **kwargs: _real_async_client(transport=mock_transport_err), + ): with pytest.raises(RuntimeError) as exc_info: await ai_provider.call_openrouter_async("test_key", "system", "user") assert "401" in str(exc_info.value) @@ -297,6 +316,7 @@ async def test_ai_cache_async_helpers(): @pytest.mark.asyncio async def test_github_api_request_and_commit_async(): """Verify github_api_request_async and commit_file_to_github_async work via httpx mock.""" + def gh_handler(request: httpx.Request) -> httpx.Response: url_str = str(request.url) if "/user" in url_str: @@ -314,7 +334,10 @@ async def test_github_api_request_and_commit_async(): return httpx.Response(404, json={"message": "Not found"}) mock_transport = MockTransport(gh_handler) - with patch("httpx.AsyncClient", side_effect=lambda *args, **kwargs: _real_async_client(transport=mock_transport)): + with patch( + "httpx.AsyncClient", + side_effect=lambda *args, **kwargs: _real_async_client(transport=mock_transport), + ): status, user_res = await github_api_request_async("/user", "fake_token") assert status == 200 assert user_res["login"] == "octocat" diff --git a/tests/unit/test_hybrid_endpoints.py b/tests/unit/test_hybrid_endpoints.py index aed65b26a2a5b7ef69c60984e17a9ee20156ac24..cca4ad179d7692f6878223f127a4ec7e49a01e28 100644 --- a/tests/unit/test_hybrid_endpoints.py +++ b/tests/unit/test_hybrid_endpoints.py @@ -111,6 +111,23 @@ class TestHybridExplorerEndpoints: assert len(namelist) > 0 assert any(name.endswith(".py") for name in namelist) + def test_export_solutions_zip_zstandard(self): + """Verify GET /api/explorer/export?compression=zstd creates valid Zstandard-compressed zip.""" + res = client.get("/api/explorer/export?compression=zstd", headers=AUTH_HEADERS) + assert res.status_code == 200 + assert res.headers["content-type"] == "application/zip" + assert "algospaced_solutions_zstd.zip" in res.headers.get("content-disposition", "") + + zip_bytes = io.BytesIO(res.content) + with zipfile.ZipFile(zip_bytes, "r") as zf: + namelist = zf.namelist() + assert len(namelist) > 0 + for name in namelist: + info = zf.getinfo(name) + assert info.compress_type == zipfile.ZIP_ZSTANDARD + content = zf.read(name) + assert len(content) > 0 + def test_import_problems_csv(self): """Verify POST /api/explorer/import with CSV payload.""" csv_content = ( diff --git a/tests/unit/test_srs_logic.py b/tests/unit/test_srs_logic.py index 481c24704f254d91f73db98f90c3415a3ac0a62b..097bd0ba73fae339a068b6cc5f309b22c783f96d 100644 --- a/tests/unit/test_srs_logic.py +++ b/tests/unit/test_srs_logic.py @@ -91,3 +91,43 @@ class TestStreakLogic: result = increment_streak(streak) assert result["current_streak"] == 1 assert result["longest_streak"] == 8 + + def test_lazy_check_streak_with_iso_datetime_and_timezone(self): + """ISO timestamp string with 'T' and 'Z' should parse safely without crashing.""" + yesterday_iso = (datetime.now(UTC) - timedelta(days=1)).strftime("%Y-%m-%dT%H:%M:%SZ") + streak = {"current_streak": 5, "longest_streak": 10, "last_active_date": yesterday_iso} + result = lazy_check_streak(streak) + assert result["current_streak"] == 5 + + three_days_ago_iso = (datetime.now(UTC) - timedelta(days=3)).strftime( + "%Y-%m-%dT%H:%M:%S+00:00" + ) + streak = {"current_streak": 5, "longest_streak": 10, "last_active_date": three_days_ago_iso} + result = lazy_check_streak(streak) + assert result["current_streak"] == 0 + + def test_lazy_check_streak_with_datetime_object(self): + """Datetime instance should be handled gracefully.""" + yesterday_dt = datetime.now(UTC) - timedelta(days=1) + streak = {"current_streak": 7, "longest_streak": 12, "last_active_date": yesterday_dt} + result = lazy_check_streak(streak) + assert result["current_streak"] == 7 + + def test_lazy_check_streak_corrupted_date_graceful(self): + """Corrupted or unparseable date should not crash the application.""" + streak = { + "current_streak": 3, + "longest_streak": 5, + "last_active_date": "invalid-date-format", + } + result = lazy_check_streak(streak) + assert result["current_streak"] == 3 + + def test_increment_streak_with_iso_timestamp(self): + """Practicing when last_active was an ISO timestamp correctly increments streak.""" + yesterday_iso = (datetime.now(UTC) - timedelta(days=1)).strftime("%Y-%m-%dT23:59:59Z") + streak = {"current_streak": 4, "longest_streak": 4, "last_active_date": yesterday_iso} + result = increment_streak(streak) + assert result["current_streak"] == 5 + assert result["longest_streak"] == 5 + assert result["last_active_date"] == datetime.now(UTC).date().isoformat() diff --git a/uv.lock b/uv.lock index 96d48acda65cf69694f462b464cb311d78e61049..35fd42db225e9144ad8b54ac70e1327a69473236 100644 --- a/uv.lock +++ b/uv.lock @@ -1,6 +1,6 @@ version = 1 -revision = 3 -requires-python = ">=3.14" +revision = 5 +requires-python = ">=3.14.8" resolution-markers = [ "sys_platform == 'win32'", "sys_platform == 'emscripten'", @@ -25,7 +25,6 @@ dependencies = [ { name = "python-dotenv" }, { name = "python-multipart" }, { name = "redis" }, - { name = "toml" }, { name = "uvicorn" }, { name = "watchfiles" }, ] @@ -53,7 +52,6 @@ requires-dist = [ { name = "python-dotenv", specifier = ">=1.2.4" }, { name = "python-multipart", specifier = ">=0.0.9" }, { name = "redis", specifier = ">=5.0.4" }, - { name = "toml", specifier = ">=0.10.2" }, { name = "uvicorn", specifier = ">=0.29.0" }, { name = "watchfiles", specifier = ">=1.2.0" }, ] @@ -1195,15 +1193,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/d7/c1/eb8f9debc45d3b7918a32ab756658a0904732f75e555402972246b0b8e71/tenacity-9.1.4-py3-none-any.whl", hash = "sha256:6095a360c919085f28c6527de529e76a06ad89b23659fa881ae0649b867a9d55", size = 28926, upload-time = "2026-02-07T10:45:32.24Z" }, ] -[[package]] -name = "toml" -version = "0.10.2" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/be/ba/1f744cdc819428fc6b5084ec34d9b30660f6f9daaf70eead706e3203ec3c/toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f", size = 22253, upload-time = "2020-11-01T01:40:22.204Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/44/6f/7120676b6d73228c96e17f1f794d8ab046fc910d781c8d151120c3f1569e/toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b", size = 16588, upload-time = "2020-11-01T01:40:20.672Z" }, -] - [[package]] name = "typing-extensions" version = "4.16.0"