@jarvis-security/sdk 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +10 -10
- package/dist/index.d.mts +208 -161
- package/dist/index.d.ts +208 -161
- package/dist/index.mjs +10 -10
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
'use strict';var browser=require('@simplewebauthn/browser'),react=require('react'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react');var J="jarvis_auth_user",V={};function Be(){Object.keys(V).forEach(a=>delete V[a]);try{typeof window<"u"&&window.localStorage.removeItem(J);}catch{}}function H(a="OP"){return `${a}-${Math.random().toString(36).slice(2,8).toUpperCase()}-${Date.now().toString(36).slice(-4).toUpperCase()}`}function C(a){typeof window>"u"||(a?window.localStorage.setItem(J,JSON.stringify(a)):window.localStorage.removeItem(J));}function be(){if(typeof window>"u")return null;try{let a=window.localStorage.getItem(J);return a?JSON.parse(a):null}catch{return null}}var Y=class{constructor(){this.name="MockAuthAdapter";this.listeners=new Set;this.currentUser=null;this.currentUser=be();}emit(r){this.listeners.forEach(t=>{try{t(r);}catch{}});}async register(r,t,e){if(!r||!t||!e)return {success:false,error:"All fields are required to register an operative.",errorCode:"missing-fields"};if(t.length<6)return {success:false,error:"Passkey must be at least 6 characters long.",errorCode:"weak-passkey"};if(V[r.toLowerCase()])return {success:false,error:"This email is already registered. Please switch to Sign In.",errorCode:"email-already-in-use"};let n={uid:H("REG"),email:r.toLowerCase(),fullName:e||"Operative",clearanceLevel:"Level 1",hasBiometrics:false,createdAt:new Date().toISOString()};return V[r.toLowerCase()]={passkey:t,user:n},this.currentUser={...n,lastLoginAt:new Date().toISOString()},C(this.currentUser),this.emit(this.currentUser),{success:true,user:this.currentUser}}async login(r,t){let e=r.toLowerCase(),n=V[e];if(n)return n.passkey!==t?{success:false,error:"Invalid email or passkey combination.",errorCode:"invalid-credential"}:(this.currentUser={...n.user,lastLoginAt:new Date().toISOString()},C(this.currentUser),this.emit(this.currentUser),{success:true,user:this.currentUser});if(r&&t.length>=6){let i={uid:H("MOCK"),email:e,fullName:r.split("@")[0]||"Operative",clearanceLevel:"Level 1",hasBiometrics:false,createdAt:new Date().toISOString(),lastLoginAt:new Date().toISOString()};return this.currentUser=i,C(i),this.emit(i),{success:true,user:i}}return {success:false,error:"Invalid email or passkey combination.",errorCode:"invalid-credential"}}async logout(){return this.currentUser=null,C(null),this.emit(null),{success:true}}async resetPassword(r){return r?{success:true,user:void 0}:{success:false,error:"Please enter your email address first.",errorCode:"missing-email"}}async verifyFace(r){let t=this.currentUser||{uid:H("FACE"),email:"stark@avengers.io",fullName:"Tony Stark (Facial Match)",clearanceLevel:"Level 1",hasBiometrics:true,lastLoginAt:new Date().toISOString()};return this.currentUser=t,C(t),this.emit(t),{success:true,user:t}}async verifyVoice(r){let t=this.currentUser||{uid:H("VOICE"),email:"stark@avengers.io",fullName:"Tony Stark (Voice Match)",clearanceLevel:"Level 1",hasBiometrics:true,lastLoginAt:new Date().toISOString()};return this.currentUser=t,C(t),this.emit(t),{success:true,user:t}}async verifyFingerprint(r){let t=this.currentUser||{uid:H("FP"),email:"stark@avengers.io",fullName:"Tony Stark (Fingerprint Match)",clearanceLevel:"Level 1",hasBiometrics:true,lastLoginAt:new Date().toISOString()};return this.currentUser=t,C(t),this.emit(t),{success:true,user:t}}async enrollBiometrics(r){if(!this.currentUser)return {success:false,error:"Active session required for biometric enrollment.",errorCode:"no-session"};this.currentUser={...this.currentUser,hasBiometrics:true};let t=this.currentUser.email.toLowerCase();return V[t]&&(V[t]={...V[t],user:{...V[t].user,hasBiometrics:true}}),C(this.currentUser),this.emit(this.currentUser),{success:true,user:this.currentUser}}async verifyPasskey(r){if(typeof window>"u"||!window.PublicKeyCredential)return {success:false,error:"WebAuthn / Passkey authentication is not supported in this environment.",errorCode:"passkey-not-supported"};try{let t=r??this.currentUser?.email??"",e=await fetch(`${typeof process<"u"?process.env.NEXT_PUBLIC_AUTH_API_URL??"http://localhost:8000":"http://localhost:8000"}/api/v1/auth/webauthn/options?email=${encodeURIComponent(t)}`).then(c=>c.json()),n=await browser.startAuthentication(e),i=await fetch(`${typeof process<"u"?process.env.NEXT_PUBLIC_AUTH_API_URL??"http://localhost:8000":"http://localhost:8000"}/api/v1/auth/webauthn/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).then(c=>{if(!c.ok)throw new Error(c.statusText);return c.json()});return i.success&&i.user?(this.currentUser={...i.user,lastLoginAt:new Date().toISOString()},C(this.currentUser),this.emit(this.currentUser),{success:!0,user:this.currentUser}):{success:!1,error:i.error||"Passkey verification failed on server.",errorCode:"passkey-verification-failed"}}catch(t){return {success:false,error:t.message||"Passkey authentication failed.",errorCode:"passkey-auth-error"}}}async getCurrentUser(){return this.currentUser}onAuthStateChanged(r){return this.listeners.add(r),queueMicrotask(()=>r(this.currentUser)),()=>this.listeners.delete(r)}},X=class{constructor(r){this.name="BackendAuthAdapter";this.listeners=new Set;this.currentUser=null;this.baseUrl=r||(typeof process<"u"?process.env.NEXT_PUBLIC_AUTH_API_URL??"http://localhost:8000":"http://localhost:8000"),this.currentUser=be();}emit(r){this.listeners.forEach(t=>{try{t(r);}catch{}});}async request(r,t={}){let e=await fetch(`${this.baseUrl}${r}`,{headers:{"Content-Type":"application/json",...t.headers||{}},...t});if(!e.ok){let n=await e.json().catch(()=>({detail:e.statusText}));throw new Error(n.detail||e.statusText)}return await e.json()}async register(r,t,e){try{let n=await this.request("/api/v1/auth/register",{method:"POST",body:JSON.stringify({email:r,passkey:t,full_name:e})});return n.success&&n.user&&(this.currentUser={...n.user,lastLoginAt:new Date().toISOString()},C(this.currentUser),this.emit(this.currentUser)),{success:n.success,user:n.user}}catch(n){return {success:false,error:n.message||"Registration failed"}}}async login(r,t){try{let e=await this.request("/api/v1/auth/login",{method:"POST",body:JSON.stringify({email:r,passkey:t})});return e.success&&e.user&&(this.currentUser={...e.user,lastLoginAt:new Date().toISOString()},C(this.currentUser),this.emit(this.currentUser)),{success:e.success,user:e.user}}catch(e){return {success:false,error:e.message||"Login failed"}}}async logout(){return this.currentUser=null,C(null),this.emit(null),{success:true}}async resetPassword(r){return r?{success:true}:{success:false,error:"Please enter your email address first.",errorCode:"missing-email"}}async verifyFace(r){try{let t=await this.request("/api/v1/auth/verify-face",{method:"POST",body:JSON.stringify({image_base64:r})});return t.success&&t.user&&(this.currentUser={...t.user,lastLoginAt:new Date().toISOString()},C(this.currentUser),this.emit(this.currentUser)),{success:t.success,user:t.user}}catch(t){return {success:false,error:t.message||"Facial verification failed"}}}async verifyVoice(r){try{let t=new FormData;t.append("file",r,"voice.wav");let e=await fetch(`${this.baseUrl}/api/v1/auth/verify-voice`,{method:"POST",body:t});if(!e.ok)throw new Error(e.statusText);let n=await e.json();return n.success&&n.user&&(this.currentUser={...n.user,lastLoginAt:new Date().toISOString()},C(this.currentUser),this.emit(this.currentUser)),{success:n.success,user:n.user}}catch(t){return {success:false,error:t.message||"Voice verification failed"}}}async verifyFingerprint(r){let t={uid:H("FP-BE"),email:"stark@avengers.io",fullName:"Tony Stark (Backend FP)",clearanceLevel:"Level 1",hasBiometrics:true,lastLoginAt:new Date().toISOString()};return this.currentUser=t,C(t),this.emit(t),{success:true,user:t}}async enrollBiometrics(r){return this.currentUser?(this.currentUser={...this.currentUser,hasBiometrics:true},C(this.currentUser),this.emit(this.currentUser),{success:true,user:this.currentUser}):{success:false,error:"Active session required.",errorCode:"no-session"}}async verifyPasskey(r){if(typeof window>"u"||!window.PublicKeyCredential)return {success:false,error:"WebAuthn / Passkey authentication is not supported in this environment.",errorCode:"passkey-not-supported"};try{let t=r??this.currentUser?.email??"",e=await this.request(`/api/v1/auth/webauthn/options?email=${encodeURIComponent(t)}`),n=await browser.startAuthentication(e),i=await this.request("/api/v1/auth/webauthn/verify",{method:"POST",body:JSON.stringify(n)});return i.success&&i.user?(this.currentUser={...i.user,lastLoginAt:new Date().toISOString()},C(this.currentUser),this.emit(this.currentUser),{success:!0,user:this.currentUser}):{success:!1,error:"Passkey verification failed on server.",errorCode:"passkey-verification-failed"}}catch(t){return {success:false,error:t.message||"Passkey authentication failed.",errorCode:"passkey-auth-error"}}}async getCurrentUser(){return this.currentUser}onAuthStateChanged(r){return this.listeners.add(r),queueMicrotask(()=>r(this.currentUser)),()=>this.listeners.delete(r)}};function re(a="mock",r){switch(a){case "backend":return new X(r?.baseUrl);case "firebase":return new Y;default:return new Y}}var K=class{constructor(){this.ctx=null;}ensureContext(){if(typeof window>"u")return null;if(!this.ctx){let r=window.AudioContext||window.webkitAudioContext;r&&(this.ctx=new r);}return this.ctx&&this.ctx.state==="suspended"&&this.ctx.resume().catch(()=>{}),this.ctx}playBeep(r=800,t="sine",e=.1,n=.15){let i=this.ensureContext();if(i)try{let c=i.createOscillator(),y=i.createGain();c.type=t,c.frequency.setValueAtTime(r,i.currentTime),y.gain.setValueAtTime(n,i.currentTime),y.gain.exponentialRampToValueAtTime(.001,i.currentTime+e),c.connect(y),y.connect(i.destination),c.start(),c.stop(i.currentTime+e);}catch{}}playSuccess(){this.playBeep(523.25,"triangle",.15),setTimeout(()=>this.playBeep(659.25,"triangle",.15),120),setTimeout(()=>this.playBeep(783.99,"triangle",.25),240);}playError(){this.playBeep(220,"sawtooth",.2,.2),setTimeout(()=>this.playBeep(160,"sawtooth",.3,.2),150);}unlock(){this.ensureContext();}};var fe=react.createContext(null);function _e({children:a,adapter:r="mock",adapterOptions:t}){let e=react.useMemo(()=>typeof r=="string"?re(r,t):r,[r]),n=react.useMemo(()=>{let l=e.name.toLowerCase();return l.includes("backend")?"backend":l.includes("firebase")?"firebase":"mock"},[e]),[i,c]=react.useState(null),[y,u]=react.useState("idle"),[g,d]=react.useState(null),[o,p]=react.useState(true),[P,k]=react.useState("passkey"),[I,w]=react.useState(false),[x,E]=react.useState("Greetings. System active. Enter valid credentials or register new clearance."),[F,O]=react.useState({open:false,isSuccess:true,title:"",message:""}),L=react.useMemo(()=>new K,[]),D=react.useCallback((l=800,f="sine",U=.1)=>{o&&L.playBeep(l,f,U);},[o,L]),q=react.useCallback(()=>{o&&L.playSuccess();},[o,L]),N=react.useCallback(()=>{o&&L.playError();},[o,L]),h=react.useCallback(l=>{E(l);},[]),m=react.useCallback((l,f,U)=>{O({open:true,isSuccess:l,title:f,message:U}),l?q():N();},[q,N]),z=react.useCallback(()=>{D(800,"sine",.05),O(l=>({...l,open:false}));},[D]),Ee=react.useCallback(l=>{k(l),D(700,"sine",.1),h({passkey:"Passkey entry active.",retina:"Facial scan camera matrix standby.",voice:"Voice spectral analyzer standby.",fingerprint:"Fingerprint capacitive scanner standby."}[l]);},[D,h]),Se=react.useCallback(()=>{w(l=>!l),d(null),D(900,"sine",.1),h(I?"Sign in mode active.":"Registration mode active. Submit email and passkey.");},[I,D,h]),Ie=react.useCallback(()=>{p(l=>{let f=!l;return f?(L.playBeep(1e3,"sine",.1),h("Audio sound system online.")):h("Audio sound system muted."),f});},[L,h]);react.useEffect(()=>{u("loading");let l=false,f=e.onAuthStateChanged(T=>{l||(c(T),u(T?"authenticated":"unauthenticated"));});(async()=>{try{let T=await e.getCurrentUser();if(l)return;c(T),u(T?"authenticated":"unauthenticated");}catch{if(l)return;u("unauthenticated");}})();let U=window.setTimeout(()=>{l||u(T=>T==="loading"?"unauthenticated":T);},5e3);return ()=>{l=true,window.clearTimeout(U),f();}},[e]);let Ce=react.useCallback(async(l,f)=>{u("loading"),d(null),h("Validating credentials with authentication core...");let U=await e.login(l,f);if(!U.success){d(U.error||"Authentication failed"),c(null),u("error"),N(),h(`[ERROR]: ${U.error}`),m(false,"AUTHENTICATION FAILED",U.error||"");return}c(U.user??null),u("authenticated"),m(true,"ACCESS GRANTED",`Security clearance confirmed for ${l}. Welcome back.`);},[e,h,N,m]),Re=react.useCallback(async(l,f,U)=>{u("loading"),d(null),h("Creating new operative clearance record...");let T=await e.register(l,f,U);if(!T.success){d(T.error||"Registration failed"),c(null),u("error"),N(),h(`[ERROR]: ${T.error}`),m(false,"REGISTRATION FAILED",T.error||"");return}c(T.user??null),u("authenticated"),m(true,"REGISTRATION COMPLETE",`Operative [${l}] successfully enrolled into Stark Security Database.`);},[e,h,N,m]),ke=react.useCallback(async()=>{u("loading"),await e.logout(),u("unauthenticated"),c(null),D(400,"sine",.2),h("Session terminated.");},[e,D,h]),Te=react.useCallback(async l=>{let f=await e.resetPassword(l);if(!f.success){N(),m(false,"RECOVERY ERROR",f.error||"");return}m(true,"RECOVERY DISPATCHED",`Passkey reset instructions sent to ${l}.`);},[e,N,m]),Pe=react.useCallback(async l=>{u("loading"),h("Analyzing facial geometry mesh...");let f=await e.verifyFace(l);if(!f.success){c(null),u("error"),N(),m(false,"FACIAL SCAN FAILED",f.error||"");return}c(f.user??null),u("authenticated"),m(true,"FACIAL SCAN VERIFIED","Iris vector scan matched in database.");},[e,h,N,m]),Ue=react.useCallback(async l=>{u("loading"),h("Listening for voice waveform match...");let f=await e.verifyVoice(l);if(!f.success){c(null),u("error"),N(),m(false,"VOICE VERIFICATION FAILED",f.error||"");return}c(f.user??null),u("authenticated"),m(true,"VOICE PRINT MATCHED","Voice acoustic spectrum matches Operative profile.");},[e,h,N,m]),Me=react.useCallback(async l=>{u("loading"),h("Fingerprint capacitive scan in progress...");let f=await e.verifyFingerprint(l);if(!f.success){c(null),u("error"),N(),m(false,"FINGERPRINT FAILED",f.error||"");return}c(f.user??null),u("authenticated"),m(true,"FINGERPRINT AUTHORIZED","Dermal ridge pattern verified.");},[e,h,N,m]),Oe=react.useCallback(async()=>{if(!i){N(),m(false,"ENROLLMENT FAILED","No active session. Sign in first.");return}let l=await e.enrollBiometrics(i.uid);if(!l.success){N(),m(false,"ENROLLMENT FAILED",l.error||"");return}c(f=>f&&{...f,hasBiometrics:true}),m(true,"BIOMETRIC LINKED","Device biometrics securely registered to profile.");},[e,i,N,m]),Le=react.useCallback(async()=>{u("loading"),h("Initializing WebAuthn passkey assertion...");let l=await e.verifyPasskey(i?.email);return l.success?(c(l.user??null),u("authenticated"),m(true,"PASSKEY VERIFIED","Device passkey assertion matched in database."),l):(d(l.error||"Passkey authentication failed"),u("error"),N(),m(false,"PASSKEY FAILED",l.error||""),l)},[e,i,h,N,m]),De={user:i,status:y,error:g,adapter:e,adapterName:n,audioEnabled:o,activeMethod:P,isRegisterMode:I,terminalText:x,modal:F,login:Ce,register:Re,logout:ke,resetPassword:Te,verifyFace:Pe,verifyVoice:Ue,verifyFingerprint:Me,enrollBiometrics:Oe,verifyPasskey:Le,setActiveMethod:Ee,toggleMode:Se,toggleAudio:Ie,updateTerminal:h,showModal:m,closeModal:z,playBeep:D,playSuccess:q,playError:N};return jsxRuntime.jsx(fe.Provider,{value:De,children:a})}function R(){let a=react.useContext(fe);if(!a)throw new Error("useAuth must be used within an <AuthProvider>");return a}function ae(){let{user:a,terminalText:r,playBeep:t,updateTerminal:e}=R(),[n,i]=react.useState(false),[c,y]=react.useState(36),[u,g]=react.useState("5.8 GB"),[d,o]=react.useState("00:00:00"),p=react.useRef(null);react.useEffect(()=>{let w=setInterval(()=>{y(Math.floor(Math.random()*25)+20);let x=(5.2+Math.random()*.8).toFixed(1);g(`${x} GB`);let E=new Date,F=String(E.getHours()).padStart(2,"0"),O=String(E.getMinutes()).padStart(2,"0"),L=String(E.getSeconds()).padStart(2,"0");o(`${F}:${O}:${L}`);},2e3);return ()=>clearInterval(w)},[]);let P=()=>{i(true),t(300,"triangle",.4),e("Arc Reactor energy pulse triggered."),setTimeout(()=>i(false),500);},k=a?"CONNECTED":"DISCONNECTED",I=a?"text-cyber-emerald":"text-cyber-red";return jsxRuntime.jsxs("section",{className:"flex flex-col items-center justify-center relative min-h-[300px] w-full",children:[jsxRuntime.jsxs("div",{className:"relative w-64 h-64 md:w-80 md:h-80 flex items-center justify-center cursor-pointer group select-none",onClick:P,role:"button","aria-label":"Arc Reactor pulse trigger",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 border border-cyber-cyan/20 rounded-full"}),jsxRuntime.jsx("div",{className:"absolute inset-[-10px] border border-dashed border-cyber-cyan/10 rounded-full"}),jsxRuntime.jsx("div",{className:"absolute inset-2 border-2 border-dashed border-cyber-cyan/40 rounded-full animate-spin-reverse"}),jsxRuntime.jsxs("div",{className:"absolute inset-8 border border-cyber-cyan/60 rounded-full animate-spin-slow flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"w-full h-0.5 bg-cyber-cyan/30 absolute"}),jsxRuntime.jsx("div",{className:"h-full w-0.5 bg-cyber-cyan/30 absolute"})]}),jsxRuntime.jsxs("div",{className:"absolute inset-12 border border-cyber-cyan/30 rounded-full flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"w-2 h-2 bg-cyber-cyan rounded-full absolute -top-1"}),jsxRuntime.jsx("div",{className:"w-2 h-2 bg-cyber-cyan rounded-full absolute -bottom-1"}),jsxRuntime.jsx("div",{className:"w-2 h-2 bg-cyber-cyan rounded-full absolute -left-1"}),jsxRuntime.jsx("div",{className:"w-2 h-2 bg-cyber-cyan rounded-full absolute -right-1"})]}),jsxRuntime.jsx("div",{ref:p,id:"arc-core",className:["relative w-28 h-28 md:w-36 md:h-36 rounded-full bg-cyber-cyan/10 border-2 border-cyber-cyan flex flex-col items-center justify-center shadow-cyber-glow transition-all duration-500 group-hover:scale-105",n?"scale-125 shadow-cyber-glow-strong":""].join(" "),children:jsxRuntime.jsx("div",{className:"w-16 h-16 md:w-20 md:h-20 rounded-full bg-cyber-cyan/20 border border-cyber-cyan/80 flex items-center justify-center animate-pulse-glow",children:jsxRuntime.jsx(lucideReact.Zap,{className:"w-8 h-8 text-cyber-cyan drop-shadow-[0_0_10px_#00f3ff]"})})}),jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full animate-spin-slow opacity-30 bg-[conic-gradient(from_0deg,transparent_0_300deg,rgba(0,243,255,0.4)_360deg)] pointer-events-none"}),jsxRuntime.jsxs("div",{className:"absolute -top-4 left-0 text-[10px] text-cyber-cyan/70 tracking-widest bg-cyber-bg/80 px-2 py-0.5 border border-cyber-cyan/30",children:["SYS.CPU: ",jsxRuntime.jsxs("span",{className:"font-bold",children:[c,"%"]})]}),jsxRuntime.jsxs("div",{className:"absolute -top-4 right-0 text-[10px] text-cyber-cyan/70 tracking-widest bg-cyber-bg/80 px-2 py-0.5 border border-cyber-cyan/30",children:["MEM: ",jsxRuntime.jsx("span",{className:"font-bold",children:u})]}),jsxRuntime.jsxs("div",{className:"absolute -bottom-4 left-0 text-[10px] text-cyber-cyan/70 tracking-widest bg-cyber-bg/80 px-2 py-0.5 border border-cyber-cyan/30",children:["STATUS: ",jsxRuntime.jsx("span",{className:`${I} font-bold`,children:k})]}),jsxRuntime.jsxs("div",{className:"absolute -bottom-4 right-0 text-[10px] text-cyber-cyan/70 tracking-widest bg-cyber-bg/80 px-2 py-0.5 border border-cyber-cyan/30",children:["PWR: ",jsxRuntime.jsx("span",{className:"text-cyber-cyan font-bold",children:"100%"})]})]}),jsxRuntime.jsxs("div",{className:"mt-6 text-center",children:[jsxRuntime.jsx("div",{className:"font-orbitron tracking-widest text-sm text-cyber-cyan text-glow",children:"ARC REACTOR MK VII"}),jsxRuntime.jsx("div",{className:"text-[11px] text-cyber-cyan/50 tracking-wider",children:"STARK SECURITY MATRIX // ONLINE"})]}),jsxRuntime.jsxs("div",{className:"mt-6 w-full max-w-md bg-cyber-bg/80 border border-cyber-cyan/30 p-2.5 rounded text-xs font-mono h-20 overflow-hidden relative",children:[jsxRuntime.jsxs("div",{className:"text-[10px] text-cyber-cyan/40 mb-1 border-b border-cyber-cyan/20 pb-0.5 flex justify-between",children:[jsxRuntime.jsx("span",{children:"JARVIS_SPEECH_LOG"}),jsxRuntime.jsx("span",{children:d})]}),jsxRuntime.jsxs("p",{className:"text-cyber-cyan/90 leading-tight",children:["\u201C",r,"\u201D"]})]})]})}function ne(){let{isRegisterMode:a,login:r,register:t,resetPassword:e,verifyPasskey:n,error:i,status:c,playBeep:y}=R(),[u,g]=react.useState(""),[d,o]=react.useState(""),[p,P]=react.useState(""),[k,I]=react.useState(false),[w,x]=react.useState(true),[E,F]=react.useState(null),O=c==="loading",L=async m=>{m.preventDefault(),F(null);let z=d.trim();if(!z||!p){F("Email and passkey are required.");return}if(a){if(!u.trim()){F("Full name is required for registration.");return}if(p.length<6){F("Passkey must be at least 6 characters long.");return}await t(z,p,u.trim());}else await r(z,p);},D=async m=>{m.preventDefault(),await e(d.trim());},q=()=>{I(m=>!m),y(1100,"sine",.05);},N=a?"ENROLL OPERATIVE":"AUTHENTICATE",h=E||i;return jsxRuntime.jsxs("form",{onSubmit:L,className:"space-y-4",noValidate:true,children:[a&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"jarvis-fullname",className:"block text-xs text-cyber-cyan/70 tracking-widest mb-1 uppercase",children:"Full Name / Operative ID"}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.UserCheck,{className:"w-4 h-4 absolute left-3 top-3 text-cyber-cyan/50"}),jsxRuntime.jsx("input",{id:"jarvis-fullname",type:"text",autoComplete:"name","aria-label":"Full Name",value:u,onChange:m=>g(m.target.value),placeholder:"Tony Stark",className:"w-full bg-cyber-bg/90 border border-cyber-cyan/40 rounded px-10 py-2.5 text-sm text-cyber-cyan focus:outline-none focus:border-cyber-cyan focus:ring-1 focus:ring-cyber-cyan transition-all placeholder:text-cyber-cyan/30",disabled:O})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"jarvis-email",className:"block text-xs text-cyber-cyan/70 tracking-widest mb-1 uppercase",children:"Email Address"}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Mail,{className:"w-4 h-4 absolute left-3 top-3 text-cyber-cyan/50"}),jsxRuntime.jsx("input",{id:"jarvis-email",type:"email",autoComplete:"email","aria-label":"Email Address",value:d,onChange:m=>o(m.target.value),placeholder:"stark@avengers.io",required:true,className:"w-full bg-cyber-bg/90 border border-cyber-cyan/40 rounded px-10 py-2.5 text-sm text-cyber-cyan focus:outline-none focus:border-cyber-cyan focus:ring-1 focus:ring-cyber-cyan transition-all placeholder:text-cyber-cyan/30",disabled:O})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"jarvis-passkey",className:"block text-xs text-cyber-cyan/70 tracking-widest mb-1 uppercase",children:"Passkey"}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Lock,{className:"w-4 h-4 absolute left-3 top-3 text-cyber-cyan/50"}),jsxRuntime.jsx("input",{id:"jarvis-passkey",type:k?"text":"password",autoComplete:a?"new-password":"current-password","aria-label":"Passkey",value:p,minLength:6,required:true,onChange:m=>P(m.target.value),placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",className:"w-full bg-cyber-bg/90 border border-cyber-cyan/40 rounded px-10 py-2.5 text-sm text-cyber-cyan focus:outline-none focus:border-cyber-cyan focus:ring-1 focus:ring-cyber-cyan transition-all placeholder:text-cyber-cyan/30 pr-12",disabled:O}),jsxRuntime.jsx("button",{type:"button",onClick:q,tabIndex:-1,className:"absolute right-3 top-3 text-cyber-cyan/50 hover:text-cyber-cyan transition-colors","aria-label":k?"Hide passkey":"Show passkey",children:k?jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"})})]})]}),h&&jsxRuntime.jsx("div",{role:"alert",className:"text-xs text-cyber-red bg-cyber-red/10 border border-cyber-red/40 p-2.5 rounded font-mono text-center",children:h}),jsxRuntime.jsxs("div",{className:"relative my-4",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center",children:jsxRuntime.jsx("div",{className:"w-full border-t border-cyber-cyan/30"})}),jsxRuntime.jsx("div",{className:"relative flex justify-center",children:jsxRuntime.jsx("span",{className:"px-3 text-xs text-cyber-cyan/50 bg-cyber-bg",children:"OR"})})]}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{y(900,"sine",.1),n();},disabled:O,className:"w-full bg-cyber-cyan/10 border-2 border-cyber-emerald hover:bg-cyber-cyan/30 text-cyber-emerald font-orbitron py-3 rounded tracking-widest font-bold transition-all shadow-cyber-glow flex items-center justify-center gap-2 disabled:opacity-60 disabled:cursor-not-allowed","aria-label":"Use device passkey",children:jsxRuntime.jsx("span",{children:"USE DEVICE PASSKEY"})}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center text-xs pt-1",children:[jsxRuntime.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer text-cyber-cyan/70 hover:text-cyber-cyan",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:w,onChange:m=>x(m.target.checked),className:"accent-cyber-cyan bg-cyber-bg border-cyber-cyan/40 rounded",disabled:O}),jsxRuntime.jsx("span",{children:"REMEMBER ID"})]}),jsxRuntime.jsx("a",{href:"#",onClick:D,className:"text-cyber-cyan/70 hover:text-cyber-cyan underline transition-all",children:"RECOVER ACCESS"})]}),jsxRuntime.jsx("button",{type:"submit",disabled:O,className:"w-full mt-4 bg-cyber-cyan/10 border-2 border-cyber-cyan hover:bg-cyber-cyan/30 text-cyber-cyan font-orbitron py-3 rounded tracking-widest font-bold transition-all shadow-cyber-glow hover:scale-[1.01] active:scale-[0.99] flex items-center justify-center space-x-2 disabled:opacity-60 disabled:cursor-not-allowed disabled:hover:scale-100",children:O?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Loader2,{className:"w-4 h-4 animate-spin"}),jsxRuntime.jsx("span",{children:"AUTHENTICATING..."})]}):jsxRuntime.jsx("span",{children:N})})]})}function ce(){let{verifyFace:a,playBeep:r,status:t}=R(),[e,n]=react.useState(false),[i,c]=react.useState("POSITION FACE IN FRAME"),[y,u]=react.useState(null),g=react.useRef(null),d=react.useRef(null),o=react.useRef(null);react.useEffect(()=>()=>{y&&window.clearInterval(y),g.current&&window.clearTimeout(g.current),o.current&&(o.current.getTracks().forEach(w=>w.stop()),o.current=null);},[]);let p=async()=>{if(!(typeof navigator>"u"||!navigator.mediaDevices))try{let w=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:320,height:240},audio:!1});o.current=w,d.current&&(d.current.srcObject=w,await d.current.play().catch(()=>{}));}catch{}},P=()=>{o.current&&(o.current.getTracks().forEach(w=>w.stop()),o.current=null),d.current&&(d.current.srcObject=null);},k=()=>{if(!d.current)return "";try{let w=d.current,x=document.createElement("canvas");x.width=w.videoWidth||320,x.height=w.videoHeight||240;let E=x.getContext("2d");if(E)return E.drawImage(w,0,0,x.width,x.height),x.toDataURL("image/jpeg",.6)}catch{}return ""};return jsxRuntime.jsxs("div",{className:"flex flex-col items-center space-y-4 py-2",children:[jsxRuntime.jsxs("div",{className:"relative w-48 h-48 border-2 border-cyber-cyan/50 rounded-lg overflow-hidden bg-cyber-bg/90 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(#00f3ff_1px,transparent_1px)] [background-size:12px_12px] opacity-20"}),jsxRuntime.jsx("video",{ref:d,muted:true,playsInline:true,className:"absolute inset-0 w-full h-full object-cover opacity-60"}),jsxRuntime.jsxs("div",{className:"w-32 h-32 border border-dashed border-cyber-cyan/60 rounded-full flex items-center justify-center relative z-10",children:[jsxRuntime.jsx(lucideReact.User,{className:"w-16 h-16 text-cyber-cyan/30"}),jsxRuntime.jsx("div",{className:"absolute top-4 left-6 w-1.5 h-1.5 bg-cyber-cyan rounded-full animate-ping"}),jsxRuntime.jsx("div",{className:"absolute top-8 right-8 w-1.5 h-1.5 bg-cyber-cyan rounded-full"})]}),e&&jsxRuntime.jsx("div",{className:"absolute left-0 right-0 h-0.5 bg-cyber-cyan shadow-cyber-glow-strong animate-scan-laser z-20"}),jsxRuntime.jsx("div",{className:"absolute bottom-2 text-[10px] tracking-wider text-cyber-cyan/80 bg-cyber-bg/80 px-2 py-0.5 border border-cyber-cyan/30 z-30",children:i})]}),jsxRuntime.jsx("p",{className:"text-xs text-cyber-cyan/60 text-center",children:"Optic vector scan. Interacts with device hardware biometrics when enrolled."}),jsxRuntime.jsxs("button",{type:"button",onClick:async()=>{if(e||t==="loading")return;await p(),n(true),c("SCANNING FACIAL MESH...");let w=window.setInterval(()=>{r(1400,"sine",.05);},300);u(w),g.current=window.setTimeout(async()=>{window.clearInterval(w),u(null);let x=k();P(),c("MATCH CONFIRMED - 99.8%"),await a(x),n(false),g.current=null;},2500);},disabled:e||t==="loading",className:"w-full bg-cyber-cyan/10 border border-cyber-cyan hover:bg-cyber-cyan/30 text-cyber-cyan font-orbitron py-3 rounded tracking-widest font-bold transition-all shadow-cyber-glow flex items-center justify-center gap-2 disabled:opacity-60 disabled:cursor-not-allowed",children:[jsxRuntime.jsx(lucideReact.Scan,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:e?"ANALYZING...":"INITIALIZE OPTIC SCAN"})]})]})}var at="JARVIS ACCESS AUTHORIZATION CODE SEVEN",ue=[10,14,18,14,10,7,5];function de(){let{verifyVoice:a,playBeep:r,status:t}=R(),[e,n]=react.useState(false),[i,c]=react.useState(ue),[y,u]=react.useState("LISTEN & VERIFY"),g=react.useRef(null),d=react.useRef(null),o=react.useRef(null),p=react.useRef([]);react.useEffect(()=>()=>{g.current&&window.clearInterval(g.current),d.current&&window.clearTimeout(d.current);},[]);let P=async()=>{if(e||t==="loading")return;if(n(true),u("ANALYZING FREQUENCY..."),p.current=[],typeof navigator<"u"&&navigator.mediaDevices)try{let I=await navigator.mediaDevices.getUserMedia({audio:!0}),w=window.MediaRecorder;if(w){let x=new w(I);o.current=x,x.ondataavailable=E=>{E.data&&E.data.size>0&&p.current.push(E.data);},x.start();}else I.getTracks().forEach(x=>x.stop());}catch{}let k=()=>{r(400+Math.random()*600,"sine",.05),c(()=>ue.map(()=>Math.floor(Math.random()*50)+6));};k(),g.current=window.setInterval(k,100),d.current=window.setTimeout(async()=>{g.current&&(window.clearInterval(g.current),g.current=null),c(ue);let I;if(o.current&&p.current.length>0){try{await new Promise(x=>{let E=o.current;E.onstop=()=>x(),E.stop(),E.stream&&E.stream.getTracks().forEach(F=>F.stop());});}catch{}let w=p.current[0]?.type||"audio/webm";I=new Blob(p.current,{type:w});}else I=new Blob(["jarvis-voice-sample"],{type:"audio/wav"});p.current=[],o.current=null,await a(I),n(false),u("LISTEN & VERIFY"),d.current=null;},2800);};return jsxRuntime.jsxs("div",{className:"flex flex-col items-center space-y-4 py-2",children:[jsxRuntime.jsxs("div",{className:"w-full h-32 border border-cyber-cyan/40 bg-cyber-bg/90 rounded p-3 flex flex-col items-center justify-center relative overflow-hidden",children:[jsxRuntime.jsx("div",{className:"flex items-end justify-center gap-1.5 w-full h-16",children:i.map((k,I)=>jsxRuntime.jsx("div",{className:"w-1.5 bg-cyber-cyan rounded-full transition-all duration-150",style:{height:`${k}px`,opacity:Math.max(.3,Math.min(1,k/50))}},I))}),jsxRuntime.jsxs("div",{className:"text-xs text-cyber-cyan font-mono mt-2 tracking-widest text-glow text-center",children:["PHRASE: \u201C",at,"\u201D"]})]}),jsxRuntime.jsx("p",{className:"text-xs text-cyber-cyan/60 text-center",children:"Voice print spectral verification. Speak phrase into microphone."}),jsxRuntime.jsxs("button",{type:"button",onClick:P,disabled:e||t==="loading",className:["w-full bg-cyber-cyan/10 border text-cyber-cyan font-orbitron py-3 rounded tracking-widest font-bold transition-all shadow-cyber-glow flex items-center justify-center gap-2 disabled:cursor-not-allowed",e?"border-cyber-emerald/80 bg-cyber-emerald/15 animate-pulse":"border-cyber-cyan hover:bg-cyber-cyan/30 disabled:opacity-60"].join(" "),children:[jsxRuntime.jsx(lucideReact.Mic,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:y})]})]})}function me(){let{verifyFingerprint:a,playBeep:r,status:t}=R(),[e,n]=react.useState(0),[i,c]=react.useState(false),y=react.useRef(null);react.useEffect(()=>()=>{y.current&&window.clearInterval(y.current);},[]);let u=()=>{i||t==="loading"||(c(true),r(600,"sine",.05),y.current=window.setInterval(()=>{n(p=>{let P=p+10;return r(600+P*5,"sine",.05),P>=100?(y.current&&(window.clearInterval(y.current),y.current=null),g(),100):P});},120));},g=async()=>{let p=`fp_${Date.now()}_${Math.random().toString(36).slice(2)}`;await a(p),d(false);},d=(p=true)=>{y.current&&(window.clearInterval(y.current),y.current=null),c(false),p&&n(0);},o=e/100*360;return jsxRuntime.jsxs("div",{className:"flex flex-col items-center space-y-4 py-2",children:[jsxRuntime.jsxs("div",{role:"button",tabIndex:0,onMouseDown:u,onMouseUp:()=>d(e<100),onMouseLeave:()=>d(e<100),onTouchStart:u,onTouchEnd:()=>d(e<100),onKeyDown:p=>{(p.key===" "||p.key==="Enter")&&(p.preventDefault(),u());},onKeyUp:()=>d(e<100),className:["w-36 h-36 border-2 border-dashed rounded-full flex items-center justify-center bg-cyber-bg/90 cursor-pointer relative shadow-cyber-glow transition-all select-none",i?"border-cyber-cyan scale-105":"border-cyber-cyan/50 hover:border-cyber-cyan",t==="loading"?"pointer-events-none opacity-80":""].join(" "),"aria-label":"Fingerprint pad - press and hold to scan",children:[jsxRuntime.jsx(lucideReact.Fingerprint,{className:["w-20 h-20 transition-all duration-200",i?"text-cyber-cyan scale-110":"text-cyber-cyan/60"].join(" ")}),jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full pointer-events-none",style:{background:e>0?`conic-gradient(from 0deg, rgba(0,243,255,0.9) 0deg, rgba(0,243,255,0.9) ${o}deg, transparent ${o}deg, transparent 360deg)`:"transparent",WebkitMask:"radial-gradient(transparent 58%, black 59%, black 70%, transparent 71%)",mask:"radial-gradient(transparent 58%, black 59%, black 70%, transparent 71%)",opacity:e>0?1:0}}),jsxRuntime.jsx("div",{className:"absolute inset-3 rounded-full border-2 border-t-cyber-cyan/80 border-r-cyber-cyan/40 border-b-cyber-cyan/10 border-l-cyber-cyan/40",style:{animation:i?"spin 0.8s linear infinite":"none"}})]}),jsxRuntime.jsx("div",{className:"w-36 h-1.5 bg-cyber-cyan/20 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-cyber-cyan transition-all duration-150",style:{width:`${e}%`}})}),jsxRuntime.jsx("p",{className:"text-xs text-cyber-cyan/60 text-center",children:"PRESS AND HOLD THUMBPRINT SCANNER TO VERIFY BIOMETRICS"})]})}function ht(){let{modal:a,closeModal:r}=R();return a.open?jsxRuntime.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-md p-4 animate-[fadeIn_.2s_ease-out]",role:"dialog","aria-modal":"true","aria-labelledby":"jarvis-modal-title",onClick:t=>{t.target===t.currentTarget&&r();},children:jsxRuntime.jsxs("div",{className:"cyber-panel max-w-sm w-full p-6 text-center rounded-lg space-y-4 shadow-cyber-glow-strong animate-[popIn_.25s_cubic-bezier(0.34,1.56,0.64,1)]",style:{borderColor:a.isSuccess?"rgba(0, 243, 255, 0.5)":"rgba(255, 0, 85, 0.5)"},children:[jsxRuntime.jsx("div",{className:"absolute top-[-2px] right-[-2px] w-3 h-3 border-t-2 border-r-2",style:{borderColor:a.isSuccess?"#00f3ff":"#ff0055"}}),jsxRuntime.jsx("div",{className:"absolute bottom-[-2px] left-[-2px] w-3 h-3 border-b-2 border-l-2",style:{borderColor:a.isSuccess?"#00f3ff":"#ff0055"}}),jsxRuntime.jsx("div",{className:"w-16 h-16 rounded-full mx-auto flex items-center justify-center border-2",style:{borderColor:a.isSuccess?"#00f3ff":"#ff0055",backgroundColor:a.isSuccess?"rgba(0, 243, 255, 0.2)":"rgba(255, 0, 85, 0.2)"},children:a.isSuccess?jsxRuntime.jsx(lucideReact.ShieldCheck,{className:"w-8 h-8",style:{color:"#00f3ff"}}):jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-8 h-8",style:{color:"#ff0055"}})}),jsxRuntime.jsx("h3",{id:"jarvis-modal-title",className:`font-orbitron font-bold text-xl tracking-widest ${a.isSuccess?"text-glow":"text-glow-red"}`,style:{color:a.isSuccess?"#00f3ff":"#ff0055"},children:a.title}),jsxRuntime.jsx("p",{className:"text-xs text-cyber-cyan/80 leading-relaxed font-mono",children:a.message}),jsxRuntime.jsx("button",{onClick:r,className:"w-full bg-cyber-cyan/20 border border-cyber-cyan hover:bg-cyber-cyan/40 text-cyber-cyan font-orbitron py-2.5 rounded tracking-widest transition-all",children:"CONTINUE"})]})}):null}function gt(){let{activeMethod:a,setActiveMethod:r}=R(),t=[{id:"retina",icon:jsxRuntime.jsx(lucideReact.Eye,{className:"w-5 h-5 mb-1"}),label:"FACIAL/EYE"},{id:"passkey",icon:jsxRuntime.jsx(lucideReact.Target,{className:"w-5 h-5 mb-1"}),label:"PASSKEY"},{id:"voice",icon:jsxRuntime.jsx(lucideReact.Mic,{className:"w-5 h-5 mb-1"}),label:"VOICE"}],e="flex flex-col items-center justify-center p-3 border rounded transition-all group",n="border-cyber-cyan bg-cyber-cyan/20 shadow-cyber-glow",i="border-cyber-cyan/30 bg-cyber-cyan/5 hover:bg-cyber-cyan/20";return jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3 mb-6",children:t.map(c=>{let y=a===c.id;return jsxRuntime.jsxs("button",{type:"button",id:`btn-method-${c.id}`,onClick:()=>r(c.id),className:`${e} ${y?n:i}`,"aria-pressed":y,children:[jsxRuntime.jsx("div",{className:`transition-transform ${y?"":"group-hover:scale-110"}`,children:c.icon}),jsxRuntime.jsx("span",{className:"text-[10px] tracking-wider",children:c.label})]},c.id)})})}function vt(){let{user:a,logout:r,enrollBiometrics:t,status:e}=R(),[n,i]=react.useState(false);return react.useEffect(()=>{i(typeof window<"u"&&typeof window.PublicKeyCredential<"u");},[]),a?jsxRuntime.jsxs("div",{className:"cyber-panel w-full max-w-md p-6 md:p-8 rounded-lg shadow-cyber-glow relative space-y-6 animate-[fadeIn_.3s_ease-out]",children:[jsxRuntime.jsx("div",{className:"cyber-corner-tr"}),jsxRuntime.jsx("div",{className:"cyber-corner-bl"}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center border-b border-cyber-cyan/20 pb-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"font-orbitron text-xl font-bold tracking-widest text-glow text-cyber-emerald",children:"CLEARANCE GRANTED"}),jsxRuntime.jsx("p",{className:"text-xs text-cyber-cyan/60 tracking-wider",children:"AUTHENTICATED OPERATIVE COMMAND"})]}),jsxRuntime.jsx("div",{className:"p-2 bg-cyber-emerald/10 border border-cyber-emerald/40 rounded-full text-cyber-emerald",children:jsxRuntime.jsx(lucideReact.ShieldCheck,{className:"w-6 h-6"})})]}),jsxRuntime.jsxs("div",{className:"space-y-3 font-mono text-xs bg-cyber-bg/90 p-4 border border-cyber-cyan/30 rounded",children:[jsxRuntime.jsxs("div",{className:"flex justify-between gap-2",children:[jsxRuntime.jsx("span",{className:"text-cyber-cyan/50 shrink-0",children:"OPERATIVE UID:"}),jsxRuntime.jsx("span",{className:"text-cyber-cyan font-bold truncate",children:a.uid})]}),jsxRuntime.jsxs("div",{className:"flex justify-between gap-2",children:[jsxRuntime.jsx("span",{className:"text-cyber-cyan/50 shrink-0",children:"EMAIL:"}),jsxRuntime.jsx("span",{className:"text-cyber-cyan font-bold truncate",children:a.email})]}),jsxRuntime.jsxs("div",{className:"flex justify-between gap-2",children:[jsxRuntime.jsx("span",{className:"text-cyber-cyan/50 shrink-0",children:"FULL NAME:"}),jsxRuntime.jsx("span",{className:"text-cyber-cyan font-bold truncate",children:a.fullName})]}),jsxRuntime.jsxs("div",{className:"flex justify-between gap-2",children:[jsxRuntime.jsx("span",{className:"text-cyber-cyan/50 shrink-0",children:"CLEARANCE:"}),jsxRuntime.jsx("span",{className:"text-cyber-emerald font-bold",children:a.clearanceLevel||"Level 1 - Full Access"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between gap-2",children:[jsxRuntime.jsx("span",{className:"text-cyber-cyan/50 shrink-0",children:"BIOMETRICS:"}),jsxRuntime.jsx("span",{className:a.hasBiometrics?"text-cyber-emerald font-bold":"text-cyber-cyan font-bold",children:a.hasBiometrics?"ENROLLED":"NOT ENROLLED"})]})]}),jsxRuntime.jsxs("button",{type:"button",onClick:t,disabled:e==="loading"||a.hasBiometrics,className:"w-full bg-cyber-cyan/10 border border-cyber-cyan hover:bg-cyber-cyan/20 text-cyber-cyan py-2.5 rounded font-orbitron text-xs tracking-wider transition-all flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:[jsxRuntime.jsx(lucideReact.Fingerprint,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:n?a.hasBiometrics?"BIOMETRICS ALREADY ENROLLED":"ENROLL DEVICE TOUCH ID / FACE ID":"ENROLL BIOMETRICS (SIMULATED)"})]}),jsxRuntime.jsxs("button",{type:"button",onClick:r,disabled:e==="loading",className:"w-full bg-cyber-red/10 border border-cyber-red hover:bg-cyber-red/30 text-cyber-red font-orbitron py-3 rounded tracking-widest font-bold transition-all flex items-center justify-center gap-2 disabled:opacity-60",children:[jsxRuntime.jsx(lucideReact.LogOut,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:"TERMINATE SESSION (SIGN OUT)"})]})]}):null}function wt(){let{isRegisterMode:a,toggleMode:r,activeMethod:t,setActiveMethod:e,playBeep:n}=R();return jsxRuntime.jsxs("div",{className:"cyber-panel w-full max-w-md p-6 md:p-8 rounded-lg shadow-cyber-glow relative animate-[fadeIn_.3s_ease-out]",children:[jsxRuntime.jsx("div",{className:"cyber-corner-tr"}),jsxRuntime.jsx("div",{className:"cyber-corner-bl"}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-6 border-b border-cyber-cyan/20 pb-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{id:"auth-title",className:"font-orbitron text-xl md:text-2xl font-bold tracking-widest text-glow uppercase",children:a?"REGISTER":"SIGN IN"}),jsxRuntime.jsx("p",{className:"text-xs text-cyber-cyan/60 tracking-wider",children:a?"CREATE NEW OPERATIVE CLEARANCE":"AUTHENTICATION REQUIRED"})]}),jsxRuntime.jsxs("button",{type:"button",onClick:r,className:"text-xs border border-cyber-cyan/40 hover:border-cyber-cyan bg-cyber-cyan/10 hover:bg-cyber-cyan/20 px-3 py-1.5 rounded transition-all tracking-wider flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.RefreshCw,{className:"w-3 h-3"}),jsxRuntime.jsx("span",{children:a?"SIGN IN":"REGISTER"})]})]}),jsxRuntime.jsx(gt,{}),jsxRuntime.jsxs("div",{className:"min-h-[360px]",children:[t==="passkey"&&jsxRuntime.jsx(ne,{}),t==="retina"&&jsxRuntime.jsx(ce,{}),t==="voice"&&jsxRuntime.jsx(de,{}),t==="fingerprint"&&jsxRuntime.jsx(me,{})]}),jsxRuntime.jsxs("div",{className:"mt-6 pt-4 border-t border-cyber-cyan/20 flex justify-between items-center text-xs",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{e("fingerprint"),n(700,"sine",.1);},className:"text-cyber-cyan/60 hover:text-cyber-cyan flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.Fingerprint,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"FINGERPRINT SCAN"})]}),jsxRuntime.jsxs("span",{className:"text-cyber-cyan/40 uppercase tracking-wider",children:["PROTOCOL: ",t]})]})]})}function xt(){let{user:a,audioEnabled:r,toggleAudio:t,adapterName:e}=R(),[n,i]=react.useState({time:"13:14",date:""});react.useEffect(()=>{let y=()=>{let g=new Date,d=String(g.getHours()).padStart(2,"0"),o=String(g.getMinutes()).padStart(2,"0");i({time:`${d}:${o}`,date:g.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})});};y();let u=setInterval(y,1e3);return ()=>clearInterval(u)},[]);let c=()=>{typeof document>"u"||(document.fullscreenElement?document.exitFullscreen&&document.exitFullscreen().catch(()=>{}):document.documentElement.requestFullscreen().catch(()=>{}));};return jsxRuntime.jsxs("div",{className:"min-h-screen w-screen flex flex-col justify-between p-4 md:p-8 relative overflow-x-hidden select-none",children:[jsxRuntime.jsxs("header",{className:"relative z-10 flex justify-between items-center w-full border-b border-cyber-cyan/20 pb-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 bg-cyber-cyan rounded-full animate-ping"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h1",{className:"font-orbitron font-bold text-lg md:text-xl tracking-widest text-glow flex items-center gap-2",children:["J.A.R.V.I.S.",jsxRuntime.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-cyber-cyan/10 border border-cyber-cyan/40 text-cyber-cyan",children:"PRODUCTION AUTH v10.5"})]}),jsxRuntime.jsx("p",{className:"text-xs text-cyber-cyan/60 tracking-wider",children:"REALTIME AUTHENTICATION & ENCRYPTION ENGINE"})]})]}),jsxRuntime.jsxs("div",{className:"hidden md:flex items-center space-x-8 text-xs",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("span",{className:"text-cyber-cyan/50",children:"ADAPTER:"}),jsxRuntime.jsx("span",{className:"text-cyber-emerald font-bold uppercase",children:e})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("span",{className:"text-cyber-cyan/50",children:"WEBAUTHN:"}),jsxRuntime.jsx("span",{className:"text-cyber-cyan font-bold",children:"READY"})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("span",{className:"text-cyber-cyan/50",children:"AI CORE:"}),jsxRuntime.jsx("span",{className:"text-cyber-emerald animate-pulse",children:"ONLINE"})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("button",{onClick:t,"aria-label":r?"Mute audio":"Enable audio",className:["p-2 bg-cyber-cyan/10 border border-cyber-cyan/30 hover:bg-cyber-cyan/20 text-cyber-cyan transition-all rounded",r?"":"opacity-50"].join(" "),children:r?jsxRuntime.jsx(lucideReact.Volume2,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.VolumeX,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:c,"aria-label":"Toggle fullscreen",className:"p-2 bg-cyber-cyan/10 border border-cyber-cyan/30 hover:bg-cyber-cyan/20 text-cyber-cyan transition-all rounded",children:jsxRuntime.jsx(lucideReact.Maximize,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsxs("main",{className:"relative z-10 flex-1 grid grid-cols-1 lg:grid-cols-12 gap-8 items-center my-6",children:[jsxRuntime.jsx("section",{className:"lg:col-span-6 flex flex-col items-center justify-center relative min-h-[300px]",children:jsxRuntime.jsx(ae,{})}),jsxRuntime.jsx("section",{className:"lg:col-span-6 flex justify-center",children:a?jsxRuntime.jsx(vt,{}):jsxRuntime.jsx(wt,{})})]}),jsxRuntime.jsxs("footer",{className:"relative z-10 flex flex-col md:flex-row justify-between items-center border-t border-cyber-cyan/20 pt-3 text-xs text-cyber-cyan/60 space-y-2 md:space-y-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-4",children:[jsxRuntime.jsxs("span",{children:["STARK INDUSTRIES \xA9 ",new Date().getFullYear()]}),jsxRuntime.jsx("span",{children:"\u2022"}),jsxRuntime.jsxs("span",{className:"text-cyber-emerald flex items-center gap-1",children:[jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-cyber-emerald animate-ping"})," ","SECURE AUTH NODE ACTIVE"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-6 font-mono",children:[jsxRuntime.jsx("div",{className:"text-cyber-cyan text-sm md:text-base font-bold tracking-widest text-glow",children:n.time}),jsxRuntime.jsx("div",{className:"text-cyber-cyan/50 text-xs uppercase",children:n.date})]})]}),jsxRuntime.jsx(ht,{}),jsxRuntime.jsx("style",{dangerouslySetInnerHTML:{__html:`
|
|
2
|
-
@keyframes fadeIn {
|
|
3
|
-
from { opacity: 0; }
|
|
4
|
-
to { opacity: 1; }
|
|
5
|
-
}
|
|
6
|
-
@keyframes popIn {
|
|
7
|
-
0% { opacity: 0; transform: scale(0.85); }
|
|
8
|
-
100% { opacity: 1; transform: scale(1); }
|
|
9
|
-
}
|
|
10
|
-
`}})]})}function
|
|
1
|
+
'use strict';var browser=require('@simplewebauthn/browser'),react=require('react'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react');var ue="jarvis_platform_credentials",st="J.A.R.V.I.S. Security Suite";function Ee(s){let e=s instanceof Uint8Array?s:new Uint8Array(s),r="";for(let n=0;n<e.length;n++)r+=String.fromCharCode(e[n]);return (typeof btoa<"u"?btoa(r):Buffer.from(e).toString("base64")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function nt(s){return Ee(new TextEncoder().encode(s))}function Ce(){let s=new Uint8Array(32);if(typeof crypto<"u"&&crypto.getRandomValues)crypto.getRandomValues(s);else for(let e=0;e<s.length;e++)s[e]=Math.floor(Math.random()*256);return Ee(s)}function Se(){return typeof window<"u"&&window.location?.hostname?window.location.hostname:"localhost"}async function z(){if(typeof window>"u"||!browser.browserSupportsWebAuthn())return false;try{return await browser.platformAuthenticatorIsAvailable()}catch{return false}}var H=class{read(){if(typeof window>"u")return {};try{let e=window.localStorage.getItem(ue);return e?JSON.parse(e):{}}catch{return {}}}write(e){typeof window>"u"||window.localStorage.setItem(ue,JSON.stringify(e));}save(e,r){let t=this.read();t[e.toLowerCase()]={...r,email:e.toLowerCase()},this.write(t);}get(e){return this.read()[e.toLowerCase()]??null}has(e){return !!this.get(e)}getAll(){return Object.values(this.read())}remove(e){let r=this.read();delete r[e.toLowerCase()],this.write(r);}clear(){typeof window>"u"||window.localStorage.removeItem(ue);}findByCredentialId(e){for(let r of this.getAll())if(r.credentialId===e)return r;return null}};function at(s,e=Se()){return {rp:{name:st,id:e},user:{id:nt(s.uid),name:s.email,displayName:s.fullName||s.email},challenge:Ce(),pubKeyCredParams:[{type:"public-key",alg:-7},{type:"public-key",alg:-257}],timeout:6e4,authenticatorSelection:{authenticatorAttachment:"platform",userVerification:"required",residentKey:"preferred",requireResidentKey:false},attestation:"none"}}function ot(s,e=Se()){return {challenge:Ce(),timeout:6e4,rpId:e,userVerification:"required",allowCredentials:s.map(r=>({type:"public-key",id:r}))}}var Ie={register:s=>browser.startRegistration(s),authenticate:s=>browser.startAuthentication(s)};async function de(s,e=new H,r=Ie){if(!await z())return {success:false,error:"No device biometric authenticator available. Set up Windows Hello / Touch ID, or use another method.",errorCode:"platform-biometric-unavailable"};try{let t=at(s),n=await r.register(t);return n?.id?(e.save(s.email,{email:s.email,credentialId:n.id,publicKey:n.response?.publicKey,signCount:0,transports:n.response?.transports,enrolledAt:new Date().toISOString()}),{success:!0,email:s.email,credentialId:n.id}):{success:!1,error:"Biometric enrollment returned no credential.",errorCode:"enroll-no-credential"}}catch(t){return {success:false,error:t instanceof Error?t.message:"Device biometric enrollment failed.",errorCode:"enroll-failed"}}}async function re(s,e=new H,r=Ie){if(!await z())return {success:false,error:"No device biometric authenticator available on this device.",errorCode:"platform-biometric-unavailable"};let t=s?e.get(s):null,n=t?[t.credentialId]:e.getAll().map(a=>a.credentialId);if(n.length===0)return {success:false,error:"No device biometric enrolled yet. Enroll your fingerprint / face first.",errorCode:"no-platform-credential"};try{let a=ot(n),o=await r.authenticate(a);if(!o?.id)return {success:!1,error:"Biometric assertion returned no credential.",errorCode:"auth-no-assertion"};let c=e.findByCredentialId(o.id);return c?{success:!0,email:c.email,credentialId:o.id}:{success:!1,error:"Presented biometric credential is not registered.",errorCode:"auth-unknown-credential"}}catch(a){return {success:false,error:a instanceof Error?a.message:"Device biometric verification failed.",errorCode:"auth-failed"}}}var me="jarvis_voiceprints";function it(s,e=.97){let r=new Float32Array(s.length);if(s.length===0)return r;r[0]=s[0];for(let t=1;t<s.length;t++)r[t]=s[t]-e*s[t-1];return r}function ct(s){let e=new Float32Array(s);for(let r=0;r<s;r++)e[r]=.54-.46*Math.cos(2*Math.PI*r/(s-1||1));return e}function lt(s){let e=1;for(;e<s;)e<<=1;return e}function ut(s,e){let r=s.length;if(!(r<=1)){for(let t=1,n=0;t<r;t++){let a=r>>1;for(;n&a;a>>=1)n^=a;if(n^=a,t<n){let o=s[t];s[t]=s[n],s[n]=o;let c=e[t];e[t]=e[n],e[n]=c;}}for(let t=2;t<=r;t<<=1){let n=-2*Math.PI/t,a=Math.cos(n),o=Math.sin(n);for(let c=0;c<r;c+=t){let l=1,h=0;for(let d=0;d<t/2;d++){let u=s[c+d],x=e[c+d],g=s[c+d+t/2]*l-e[c+d+t/2]*h,E=s[c+d+t/2]*h+e[c+d+t/2]*l;s[c+d]=u+g,e[c+d]=x+E,s[c+d+t/2]=u-g,e[c+d+t/2]=x-E;let A=l*a-h*o;h=l*o+h*a,l=A;}}}}}function Re(s){return 2595*Math.log10(1+s/700)}function dt(s){return 700*(Math.pow(10,s/2595)-1)}function mt(s,e,r,t=0,n){let a=n??r/2,o=Re(t),c=Re(a),l=new Float32Array(s+2);for(let g=0;g<s+2;g++)l[g]=o+(c-o)*g/(s+1);let h=l.map(g=>dt(g)),d=e/2+1,u=h.map(g=>Math.floor((e+1)*g/r)),x=[];for(let g=0;g<s;g++){let E=new Float32Array(d),A=u[g],R=u[g+1],F=u[g+2];for(let S=A;S<R;S++)R!==A&&(E[S]=(S-A)/(R-A));for(let S=R;S<F;S++)F!==R&&(E[S]=(F-S)/(F-R));x.push(E);}return x}function ft(s,e){let r=new Float32Array(e),t=s.length;for(let n=0;n<e;n++){let a=0;for(let o=0;o<t;o++)a+=s[o]*Math.cos(Math.PI*n*(2*o+1)/(2*t));r[n]=a;}return r}function yt(s,e,r={}){let t=r.frameSize??512,n=r.frameStride??256,a=r.fftSize??lt(t),o=r.numFilters??26,c=r.numCoeffs??13,l=r.lowFreq??0,h=r.highFreq??e/2;if(s.length<t)return [];let d=it(s),u=ct(t),x=mt(o,a,e,l,h),g=[];for(let E=0;E+t<=d.length;E+=n){let A=new Float32Array(a),R=new Float32Array(a);for(let y=0;y<t;y++)A[y]=d[E+y]*u[y];ut(A,R);let F=a/2+1,S=new Float32Array(F);for(let y=0;y<F;y++)S[y]=(A[y]*A[y]+R[y]*R[y])/a;let C=new Float32Array(o);for(let y=0;y<o;y++){let T=0,k=x[y];for(let b=0;b<F;b++)T+=S[b]*k[b];C[y]=Math.log(T+1e-10);}let I=ft(C,c);g.push(I);}return g}function bt(s){if(s.length===0)return new Float32Array(26);let e=s[0].length,r=new Float32Array(e),t=new Float32Array(e);for(let a of s)for(let o=0;o<e;o++)r[o]+=a[o];for(let a=0;a<e;a++)r[a]/=s.length;for(let a of s)for(let o=0;o<e;o++){let c=a[o]-r[o];t[o]+=c*c;}for(let a=0;a<e;a++)t[a]=Math.sqrt(t[a]/s.length);let n=new Float32Array(e*2);return n.set(r,0),n.set(t,e),n}function pt(s,e,r={}){let t=yt(s,e,r);return bt(t)}function ht(s,e){if(s.length!==e.length||s.length===0)return 0;let r=0,t=0,n=0;for(let a=0;a<s.length;a++)r+=s[a]*e[a],t+=s[a]*s[a],n+=e[a]*e[a];return t===0||n===0?0:r/(Math.sqrt(t)*Math.sqrt(n))}function gt(s,e){return (ht(s,e)+1)/2}async function vt(s){if(typeof window>"u")throw new Error("Audio decoding requires a browser environment.");let e=window.AudioContext||window.webkitAudioContext;if(!e)throw new Error("Web Audio API is not supported in this browser.");let r=new e;try{let t=await s.arrayBuffer(),n=await r.decodeAudioData(t),a=n.length,o=new Float32Array(a),c=Math.max(1,n.numberOfChannels);for(let l=0;l<c;l++){let h=n.getChannelData(l);for(let d=0;d<a;d++)o[d]+=h[d]/c;}return {signal:o,sampleRate:n.sampleRate}}finally{r.close().catch(()=>{});}}async function Y(s){let{signal:e,sampleRate:r}=await vt(s);return pt(e,r)}var $=class{read(){if(typeof window>"u")return {};try{let e=window.localStorage.getItem(me);return e?JSON.parse(e):{}}catch{return {}}}write(e){typeof window>"u"||window.localStorage.setItem(me,JSON.stringify(e));}enroll(e,r){let t=this.read();t[e.toLowerCase()]={email:e.toLowerCase(),voiceprint:Array.from(r),enrolledAt:new Date().toISOString()},this.write(t);}get(e){return this.read()[e.toLowerCase()]??null}has(e){return !!this.get(e)}getAll(){return Object.values(this.read())}remove(e){let r=this.read();delete r[e.toLowerCase()],this.write(r);}clear(){typeof window>"u"||window.localStorage.removeItem(me);}matchBest(e,r=.82){let t=null;for(let n of this.getAll()){let a=new Float32Array(n.voiceprint),o=gt(e,a);o>=r&&(!t||o>t.score)&&(t={email:n.email,score:o});}return t}};var se="jarvis_auth_user",_={},X=new $,K=new H;function wt(){Object.keys(_).forEach(s=>delete _[s]),X.clear(),K.clear();try{typeof window<"u"&&window.localStorage.removeItem(se);}catch{}}function fe(s="OP"){return `${s}-${Math.random().toString(36).slice(2,8).toUpperCase()}-${Date.now().toString(36).slice(-4).toUpperCase()}`}function D(s){typeof window>"u"||(s?window.localStorage.setItem(se,JSON.stringify(s)):window.localStorage.removeItem(se));}function Te(){if(typeof window>"u")return null;try{let s=window.localStorage.getItem(se);return s?JSON.parse(s):null}catch{return null}}var Z=class{constructor(){this.name="MockAuthAdapter";this.listeners=new Set;this.currentUser=null;this.currentUser=Te();}emit(e){this.listeners.forEach(r=>{try{r(e);}catch{}});}async register(e,r,t){if(!e||!r||!t)return {success:false,error:"All fields are required to register an operative.",errorCode:"missing-fields"};if(r.length<6)return {success:false,error:"Passkey must be at least 6 characters long.",errorCode:"weak-passkey"};if(_[e.toLowerCase()])return {success:false,error:"This email is already registered. Please switch to Sign In.",errorCode:"email-already-in-use"};let n={uid:fe("REG"),email:e.toLowerCase(),fullName:t||"Operative",clearanceLevel:"Level 1",hasBiometrics:false,createdAt:new Date().toISOString()};return _[e.toLowerCase()]={passkey:r,user:n},this.currentUser={...n,lastLoginAt:new Date().toISOString()},D(this.currentUser),this.emit(this.currentUser),{success:true,user:this.currentUser}}async login(e,r){let t=e.toLowerCase(),n=_[t];if(n)return n.passkey!==r?{success:false,error:"Invalid email or passkey combination.",errorCode:"invalid-credential"}:(this.currentUser={...n.user,lastLoginAt:new Date().toISOString()},D(this.currentUser),this.emit(this.currentUser),{success:true,user:this.currentUser});if(e&&r.length>=6){let a={uid:fe("MOCK"),email:t,fullName:e.split("@")[0]||"Operative",clearanceLevel:"Level 1",hasBiometrics:false,createdAt:new Date().toISOString(),lastLoginAt:new Date().toISOString()};return this.currentUser=a,D(a),this.emit(a),{success:true,user:a}}return {success:false,error:"Invalid email or passkey combination.",errorCode:"invalid-credential"}}async logout(){return this.currentUser=null,D(null),this.emit(null),{success:true}}async resetPassword(e){return e?{success:true,user:void 0}:{success:false,error:"Please enter your email address first.",errorCode:"missing-email"}}resolveUserByEmail(e){let r=e.toLowerCase(),t=_[r];return t?t.user:{uid:fe("BIO"),email:r,fullName:r.split("@")[0]||"Operative",clearanceLevel:"Level 1",hasBiometrics:true,createdAt:new Date().toISOString()}}commitUser(e){let r={...e,hasBiometrics:true,lastLoginAt:new Date().toISOString()};return this.currentUser=r,D(r),this.emit(r),r}markBiometricsEnrolled(){if(!this.currentUser)return;this.currentUser={...this.currentUser,hasBiometrics:true};let e=this.currentUser.email.toLowerCase();_[e]&&(_[e]={..._[e],user:{..._[e].user,hasBiometrics:true}}),D(this.currentUser),this.emit(this.currentUser);}async platformBiometricLogin(){let e=await re(this.currentUser?.email,K);return !e.success||!e.email?{success:false,error:e.error||"Device biometric verification failed.",errorCode:e.errorCode||"biometric-failed"}:{success:true,user:this.commitUser(this.resolveUserByEmail(e.email))}}async verifyFace(){return this.platformBiometricLogin()}async verifyVoice(e){try{let r=await Y(e),t=X.matchBest(r);return t?{success:!0,user:this.commitUser(this.resolveUserByEmail(t.email))}:{success:!1,error:"Voice did not match any enrolled operative. Re-enroll or try again.",errorCode:"voice-no-match"}}catch(r){return {success:false,error:r?.message||"Voice verification failed.",errorCode:"voice-error"}}}async verifyFingerprint(){return this.platformBiometricLogin()}async enrollBiometrics(e){if(!this.currentUser)return {success:false,error:"Active session required for biometric enrollment.",errorCode:"no-session"};let r=await de({uid:this.currentUser.uid,email:this.currentUser.email,fullName:this.currentUser.fullName},K);return r.success?(this.markBiometricsEnrolled(),{success:true,user:this.currentUser}):{success:false,error:r.error||"Device biometric enrollment failed.",errorCode:r.errorCode||"enroll-failed"}}async enrollVoice(e){if(!this.currentUser)return {success:false,error:"Active session required for voice enrollment.",errorCode:"no-session"};try{let r=await Y(e);return X.enroll(this.currentUser.email,r),this.markBiometricsEnrolled(),{success:!0,user:this.currentUser}}catch(r){return {success:false,error:r?.message||"Voice enrollment failed.",errorCode:"voice-enroll-error"}}}async verifyPasskey(e){if(typeof window>"u"||!window.PublicKeyCredential)return {success:false,error:"WebAuthn / Passkey authentication is not supported in this environment.",errorCode:"passkey-not-supported"};try{let r=e??this.currentUser?.email??"",t=await fetch(`${typeof process<"u"?process.env.NEXT_PUBLIC_AUTH_API_URL??"http://localhost:8000":"http://localhost:8000"}/api/v1/auth/webauthn/options?email=${encodeURIComponent(r)}`).then(o=>o.json()),n=await browser.startAuthentication(t),a=await fetch(`${typeof process<"u"?process.env.NEXT_PUBLIC_AUTH_API_URL??"http://localhost:8000":"http://localhost:8000"}/api/v1/auth/webauthn/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).then(o=>{if(!o.ok)throw new Error(o.statusText);return o.json()});return a.success&&a.user?(this.currentUser={...a.user,lastLoginAt:new Date().toISOString()},D(this.currentUser),this.emit(this.currentUser),{success:!0,user:this.currentUser}):{success:!1,error:a.error||"Passkey verification failed on server.",errorCode:"passkey-verification-failed"}}catch(r){return {success:false,error:r.message||"Passkey authentication failed.",errorCode:"passkey-auth-error"}}}async getCurrentUser(){return this.currentUser}onAuthStateChanged(e){return this.listeners.add(e),queueMicrotask(()=>e(this.currentUser)),()=>this.listeners.delete(e)}},ne=class{constructor(e){this.name="BackendAuthAdapter";this.listeners=new Set;this.currentUser=null;this.baseUrl=e||(typeof process<"u"?process.env.NEXT_PUBLIC_AUTH_API_URL??"http://localhost:8000":"http://localhost:8000"),this.currentUser=Te();}emit(e){this.listeners.forEach(r=>{try{r(e);}catch{}});}async request(e,r={}){let t=await fetch(`${this.baseUrl}${e}`,{headers:{"Content-Type":"application/json",...r.headers||{}},...r});if(!t.ok){let n=await t.json().catch(()=>({detail:t.statusText}));throw new Error(n.detail||t.statusText)}return await t.json()}async register(e,r,t){try{let n=await this.request("/api/v1/auth/register",{method:"POST",body:JSON.stringify({email:e,passkey:r,full_name:t})});return n.success&&n.user&&(this.currentUser={...n.user,lastLoginAt:new Date().toISOString()},D(this.currentUser),this.emit(this.currentUser)),{success:n.success,user:n.user}}catch(n){return {success:false,error:n.message||"Registration failed"}}}async login(e,r){try{let t=await this.request("/api/v1/auth/login",{method:"POST",body:JSON.stringify({email:e,passkey:r})});return t.success&&t.user&&(this.currentUser={...t.user,lastLoginAt:new Date().toISOString()},D(this.currentUser),this.emit(this.currentUser)),{success:t.success,user:t.user}}catch(t){return {success:false,error:t.message||"Login failed"}}}async logout(){return this.currentUser=null,D(null),this.emit(null),{success:true}}async resetPassword(e){return e?{success:true}:{success:false,error:"Please enter your email address first.",errorCode:"missing-email"}}async biometricLogin(e,r,t){try{let n=await this.request("/api/v1/auth/biometric-login",{method:"POST",body:JSON.stringify({email:e,method:r,credential_id:t})});return n.success&&n.user?(this.currentUser={...n.user,lastLoginAt:new Date().toISOString()},D(this.currentUser),this.emit(this.currentUser),{success:!0,user:this.currentUser}):{success:!1,error:"Biometric login was rejected by the server.",errorCode:"biometric-login-rejected"}}catch(n){return {success:false,error:n.message||"Biometric login failed"}}}async verifyFace(){let e=await re(this.currentUser?.email,K);return !e.success||!e.email?{success:false,error:e.error||"Device biometric verification failed.",errorCode:e.errorCode||"biometric-failed"}:this.biometricLogin(e.email,"face",e.credentialId)}async verifyVoice(e){try{let r=await Y(e),t=X.matchBest(r);return t?this.biometricLogin(t.email,"voice"):{success:!1,error:"Voice did not match any enrolled operative.",errorCode:"voice-no-match"}}catch(r){return {success:false,error:r?.message||"Voice verification failed.",errorCode:"voice-error"}}}async verifyFingerprint(){let e=await re(this.currentUser?.email,K);return !e.success||!e.email?{success:false,error:e.error||"Device biometric verification failed.",errorCode:e.errorCode||"biometric-failed"}:this.biometricLogin(e.email,"fingerprint",e.credentialId)}async enrollBiometrics(e){if(!this.currentUser)return {success:false,error:"Active session required.",errorCode:"no-session"};let r=await de({uid:this.currentUser.uid,email:this.currentUser.email,fullName:this.currentUser.fullName},K);if(!r.success)return {success:false,error:r.error||"Device biometric enrollment failed.",errorCode:r.errorCode||"enroll-failed"};try{await this.request("/api/v1/auth/enroll-biometric",{method:"POST",body:JSON.stringify({email:this.currentUser.email,credential_id:r.credentialId})});}catch{}return this.currentUser={...this.currentUser,hasBiometrics:true},D(this.currentUser),this.emit(this.currentUser),{success:true,user:this.currentUser}}async enrollVoice(e){if(!this.currentUser)return {success:false,error:"Active session required.",errorCode:"no-session"};try{let r=await Y(e);return X.enroll(this.currentUser.email,r),this.currentUser={...this.currentUser,hasBiometrics:!0},D(this.currentUser),this.emit(this.currentUser),{success:!0,user:this.currentUser}}catch(r){return {success:false,error:r?.message||"Voice enrollment failed.",errorCode:"voice-enroll-error"}}}async verifyPasskey(e){if(typeof window>"u"||!window.PublicKeyCredential)return {success:false,error:"WebAuthn / Passkey authentication is not supported in this environment.",errorCode:"passkey-not-supported"};try{let r=e??this.currentUser?.email??"",t=await this.request(`/api/v1/auth/webauthn/options?email=${encodeURIComponent(r)}`),n=await browser.startAuthentication(t),a=await this.request("/api/v1/auth/webauthn/verify",{method:"POST",body:JSON.stringify(n)});return a.success&&a.user?(this.currentUser={...a.user,lastLoginAt:new Date().toISOString()},D(this.currentUser),this.emit(this.currentUser),{success:!0,user:this.currentUser}):{success:!1,error:"Passkey verification failed on server.",errorCode:"passkey-verification-failed"}}catch(r){return {success:false,error:r.message||"Passkey authentication failed.",errorCode:"passkey-auth-error"}}}async getCurrentUser(){return this.currentUser}onAuthStateChanged(e){return this.listeners.add(e),queueMicrotask(()=>e(this.currentUser)),()=>this.listeners.delete(e)}};function ye(s="mock",e){switch(s){case "backend":return new ne(e?.baseUrl);case "firebase":return new Z;default:return new Z}}var Q=class{constructor(){this.ctx=null;}ensureContext(){if(typeof window>"u")return null;if(!this.ctx){let e=window.AudioContext||window.webkitAudioContext;e&&(this.ctx=new e);}return this.ctx&&this.ctx.state==="suspended"&&this.ctx.resume().catch(()=>{}),this.ctx}playBeep(e=800,r="sine",t=.1,n=.15){let a=this.ensureContext();if(a)try{let o=a.createOscillator(),c=a.createGain();o.type=r,o.frequency.setValueAtTime(e,a.currentTime),c.gain.setValueAtTime(n,a.currentTime),c.gain.exponentialRampToValueAtTime(.001,a.currentTime+t),o.connect(c),c.connect(a.destination),o.start(),o.stop(a.currentTime+t);}catch{}}playSuccess(){this.playBeep(523.25,"triangle",.15),setTimeout(()=>this.playBeep(659.25,"triangle",.15),120),setTimeout(()=>this.playBeep(783.99,"triangle",.25),240);}playError(){this.playBeep(220,"sawtooth",.2,.2),setTimeout(()=>this.playBeep(160,"sawtooth",.3,.2),150);}unlock(){this.ensureContext();}};var Ue=react.createContext(null);function Et({children:s,adapter:e="mock",adapterOptions:r}){let t=react.useMemo(()=>typeof e=="string"?ye(e,r):e,[e]),n=react.useMemo(()=>{let m=t.name.toLowerCase();return m.includes("backend")?"backend":m.includes("firebase")?"firebase":"mock"},[t]),[a,o]=react.useState(null),[c,l]=react.useState("idle"),[h,d]=react.useState(null),[u,x]=react.useState(true),[g,E]=react.useState("passkey"),[A,R]=react.useState(false),[F,S]=react.useState("Greetings. System active. Enter valid credentials or register new clearance."),[C,I]=react.useState({open:false,isSuccess:true,title:"",message:""}),y=react.useMemo(()=>new Q,[]),T=react.useCallback((m=800,w="sine",O=.1)=>{u&&y.playBeep(m,w,O);},[u,y]),k=react.useCallback(()=>{u&&y.playSuccess();},[u,y]),b=react.useCallback(()=>{u&&y.playError();},[u,y]),v=react.useCallback(m=>{S(m);},[]),f=react.useCallback((m,w,O)=>{I({open:true,isSuccess:m,title:w,message:O}),m?k():b();},[k,b]),W=react.useCallback(()=>{T(800,"sine",.05),I(m=>({...m,open:false}));},[T]),Ve=react.useCallback(m=>{E(m),T(700,"sine",.1),v({passkey:"Passkey entry active.",retina:"Facial scan camera matrix standby.",voice:"Voice spectral analyzer standby.",fingerprint:"Fingerprint capacitive scanner standby."}[m]);},[T,v]),_e=react.useCallback(()=>{R(m=>!m),d(null),T(900,"sine",.1),v(A?"Sign in mode active.":"Registration mode active. Submit email and passkey.");},[A,T,v]),je=react.useCallback(()=>{x(m=>{let w=!m;return w?(y.playBeep(1e3,"sine",.1),v("Audio sound system online.")):v("Audio sound system muted."),w});},[y,v]);react.useEffect(()=>{l("loading");let m=false,w=t.onAuthStateChanged(L=>{m||(o(L),l(L?"authenticated":"unauthenticated"));});(async()=>{try{let L=await t.getCurrentUser();if(m)return;o(L),l(L?"authenticated":"unauthenticated");}catch{if(m)return;l("unauthenticated");}})();let O=window.setTimeout(()=>{m||l(L=>L==="loading"?"unauthenticated":L);},5e3);return ()=>{m=true,window.clearTimeout(O),w();}},[t]);let He=react.useCallback(async(m,w)=>{l("loading"),d(null),v("Validating credentials with authentication core...");let O=await t.login(m,w);if(!O.success){d(O.error||"Authentication failed"),o(null),l("error"),b(),v(`[ERROR]: ${O.error}`),f(false,"AUTHENTICATION FAILED",O.error||"");return}o(O.user??null),l("authenticated"),f(true,"ACCESS GRANTED",`Security clearance confirmed for ${m}. Welcome back.`);},[t,v,b,f]),qe=react.useCallback(async(m,w,O)=>{l("loading"),d(null),v("Creating new operative clearance record...");let L=await t.register(m,w,O);if(!L.success){d(L.error||"Registration failed"),o(null),l("error"),b(),v(`[ERROR]: ${L.error}`),f(false,"REGISTRATION FAILED",L.error||"");return}o(L.user??null),l("authenticated"),f(true,"REGISTRATION COMPLETE",`Operative [${m}] successfully enrolled into Stark Security Database.`);},[t,v,b,f]),ze=react.useCallback(async()=>{l("loading"),await t.logout(),l("unauthenticated"),o(null),T(400,"sine",.2),v("Session terminated.");},[t,T,v]),$e=react.useCallback(async m=>{let w=await t.resetPassword(m);if(!w.success){b(),f(false,"RECOVERY ERROR",w.error||"");return}f(true,"RECOVERY DISPATCHED",`Passkey reset instructions sent to ${m}.`);},[t,b,f]),Ke=react.useCallback(async()=>{l("loading"),v("Requesting device face verification (Windows Hello / Face ID)...");let m=await t.verifyFace();if(!m.success){o(null),l("error"),b(),f(false,"FACIAL SCAN FAILED",m.error||"");return}o(m.user??null),l("authenticated"),f(true,"FACIAL SCAN VERIFIED","Device face biometric matched and authorized.");},[t,v,b,f]),Ge=react.useCallback(async m=>{l("loading"),v("Extracting voiceprint and matching against enrolled samples...");let w=await t.verifyVoice(m);if(!w.success){o(null),l("error"),b(),f(false,"VOICE VERIFICATION FAILED",w.error||"");return}o(w.user??null),l("authenticated"),f(true,"VOICE PRINT MATCHED","Voice acoustic spectrum matches Operative profile.");},[t,v,b,f]),Je=react.useCallback(async()=>{l("loading"),v("Touch the fingerprint sensor to verify (Windows Hello / Touch ID)...");let m=await t.verifyFingerprint();if(!m.success){o(null),l("error"),b(),f(false,"FINGERPRINT FAILED",m.error||"");return}o(m.user??null),l("authenticated"),f(true,"FINGERPRINT AUTHORIZED","Device fingerprint biometric matched and authorized.");},[t,v,b,f]),We=react.useCallback(async()=>{if(!a){b(),f(false,"ENROLLMENT FAILED","No active session. Sign in first.");return}v("Prompting device biometric enrollment (follow the OS prompt)...");let m=await t.enrollBiometrics(a.uid);if(!m.success){b(),f(false,"ENROLLMENT FAILED",m.error||"");return}o(w=>w&&{...w,hasBiometrics:true}),f(true,"BIOMETRIC LINKED","Device biometrics securely registered to profile.");},[t,a,b,f,v]),Ye=react.useCallback(async m=>{if(!a){b(),f(false,"VOICE ENROLLMENT FAILED","No active session. Sign in first.");return}v("Extracting and storing voiceprint signature...");let w=await t.enrollVoice(m);if(!w.success){b(),f(false,"VOICE ENROLLMENT FAILED",w.error||"");return}o(O=>O&&{...O,hasBiometrics:true}),f(true,"VOICEPRINT LINKED","Voice signature securely registered to profile.");},[t,a,b,f,v]),Xe=react.useCallback(async()=>{l("loading"),v("Initializing WebAuthn passkey assertion...");let m=await t.verifyPasskey(a?.email);return m.success?(o(m.user??null),l("authenticated"),f(true,"PASSKEY VERIFIED","Device passkey assertion matched in database."),m):(d(m.error||"Passkey authentication failed"),l("error"),b(),f(false,"PASSKEY FAILED",m.error||""),m)},[t,a,v,b,f]),Ze={user:a,status:c,error:h,adapter:t,adapterName:n,audioEnabled:u,activeMethod:g,isRegisterMode:A,terminalText:F,modal:C,login:He,register:qe,logout:ze,resetPassword:$e,verifyFace:Ke,verifyVoice:Ge,verifyFingerprint:Je,enrollBiometrics:We,enrollVoice:Ye,verifyPasskey:Xe,setActiveMethod:Ve,toggleMode:_e,toggleAudio:je,updateTerminal:v,showModal:f,closeModal:W,playBeep:T,playSuccess:k,playError:b};return jsxRuntime.jsx(Ue.Provider,{value:Ze,children:s})}function M(){let s=react.useContext(Ue);if(!s)throw new Error("useAuth must be used within an <AuthProvider>");return s}function pe(){let{user:s,terminalText:e,playBeep:r,updateTerminal:t}=M(),[n,a]=react.useState(false),[o,c]=react.useState(36),[l,h]=react.useState("5.8 GB"),[d,u]=react.useState("00:00:00"),x=react.useRef(null);react.useEffect(()=>{let R=setInterval(()=>{c(Math.floor(Math.random()*25)+20);let F=(5.2+Math.random()*.8).toFixed(1);h(`${F} GB`);let S=new Date,C=String(S.getHours()).padStart(2,"0"),I=String(S.getMinutes()).padStart(2,"0"),y=String(S.getSeconds()).padStart(2,"0");u(`${C}:${I}:${y}`);},2e3);return ()=>clearInterval(R)},[]);let g=()=>{a(true),r(300,"triangle",.4),t("Arc Reactor energy pulse triggered."),setTimeout(()=>a(false),500);},E=s?"CONNECTED":"DISCONNECTED",A=s?"text-cyber-emerald":"text-cyber-red";return jsxRuntime.jsxs("section",{className:"flex flex-col items-center justify-center relative min-h-[300px] w-full",children:[jsxRuntime.jsxs("div",{className:"relative w-64 h-64 md:w-80 md:h-80 flex items-center justify-center cursor-pointer group select-none",onClick:g,role:"button","aria-label":"Arc Reactor pulse trigger",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 border border-cyber-cyan/20 rounded-full"}),jsxRuntime.jsx("div",{className:"absolute inset-[-10px] border border-dashed border-cyber-cyan/10 rounded-full"}),jsxRuntime.jsx("div",{className:"absolute inset-2 border-2 border-dashed border-cyber-cyan/40 rounded-full animate-spin-reverse"}),jsxRuntime.jsxs("div",{className:"absolute inset-8 border border-cyber-cyan/60 rounded-full animate-spin-slow flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"w-full h-0.5 bg-cyber-cyan/30 absolute"}),jsxRuntime.jsx("div",{className:"h-full w-0.5 bg-cyber-cyan/30 absolute"})]}),jsxRuntime.jsxs("div",{className:"absolute inset-12 border border-cyber-cyan/30 rounded-full flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"w-2 h-2 bg-cyber-cyan rounded-full absolute -top-1"}),jsxRuntime.jsx("div",{className:"w-2 h-2 bg-cyber-cyan rounded-full absolute -bottom-1"}),jsxRuntime.jsx("div",{className:"w-2 h-2 bg-cyber-cyan rounded-full absolute -left-1"}),jsxRuntime.jsx("div",{className:"w-2 h-2 bg-cyber-cyan rounded-full absolute -right-1"})]}),jsxRuntime.jsx("div",{ref:x,id:"arc-core",className:["relative w-28 h-28 md:w-36 md:h-36 rounded-full bg-cyber-cyan/10 border-2 border-cyber-cyan flex flex-col items-center justify-center shadow-cyber-glow transition-all duration-500 group-hover:scale-105",n?"scale-125 shadow-cyber-glow-strong":""].join(" "),children:jsxRuntime.jsx("div",{className:"w-16 h-16 md:w-20 md:h-20 rounded-full bg-cyber-cyan/20 border border-cyber-cyan/80 flex items-center justify-center animate-pulse-glow",children:jsxRuntime.jsx(lucideReact.Zap,{className:"w-8 h-8 text-cyber-cyan drop-shadow-[0_0_10px_#00f3ff]"})})}),jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full animate-spin-slow opacity-30 bg-[conic-gradient(from_0deg,transparent_0_300deg,rgba(0,243,255,0.4)_360deg)] pointer-events-none"}),jsxRuntime.jsxs("div",{className:"absolute -top-4 left-0 text-[10px] text-cyber-cyan/70 tracking-widest bg-cyber-bg/80 px-2 py-0.5 border border-cyber-cyan/30",children:["SYS.CPU: ",jsxRuntime.jsxs("span",{className:"font-bold",children:[o,"%"]})]}),jsxRuntime.jsxs("div",{className:"absolute -top-4 right-0 text-[10px] text-cyber-cyan/70 tracking-widest bg-cyber-bg/80 px-2 py-0.5 border border-cyber-cyan/30",children:["MEM: ",jsxRuntime.jsx("span",{className:"font-bold",children:l})]}),jsxRuntime.jsxs("div",{className:"absolute -bottom-4 left-0 text-[10px] text-cyber-cyan/70 tracking-widest bg-cyber-bg/80 px-2 py-0.5 border border-cyber-cyan/30",children:["STATUS: ",jsxRuntime.jsx("span",{className:`${A} font-bold`,children:E})]}),jsxRuntime.jsxs("div",{className:"absolute -bottom-4 right-0 text-[10px] text-cyber-cyan/70 tracking-widest bg-cyber-bg/80 px-2 py-0.5 border border-cyber-cyan/30",children:["PWR: ",jsxRuntime.jsx("span",{className:"text-cyber-cyan font-bold",children:"100%"})]})]}),jsxRuntime.jsxs("div",{className:"mt-6 text-center",children:[jsxRuntime.jsx("div",{className:"font-orbitron tracking-widest text-sm text-cyber-cyan text-glow",children:"ARC REACTOR MK VII"}),jsxRuntime.jsx("div",{className:"text-[11px] text-cyber-cyan/50 tracking-wider",children:"STARK SECURITY MATRIX // ONLINE"})]}),jsxRuntime.jsxs("div",{className:"mt-6 w-full max-w-md bg-cyber-bg/80 border border-cyber-cyan/30 p-2.5 rounded text-xs font-mono h-20 overflow-hidden relative",children:[jsxRuntime.jsxs("div",{className:"text-[10px] text-cyber-cyan/40 mb-1 border-b border-cyber-cyan/20 pb-0.5 flex justify-between",children:[jsxRuntime.jsx("span",{children:"JARVIS_SPEECH_LOG"}),jsxRuntime.jsx("span",{children:d})]}),jsxRuntime.jsxs("p",{className:"text-cyber-cyan/90 leading-tight",children:["\u201C",e,"\u201D"]})]})]})}function he(){let{isRegisterMode:s,login:e,register:r,resetPassword:t,verifyPasskey:n,error:a,status:o,playBeep:c}=M(),[l,h]=react.useState(""),[d,u]=react.useState(""),[x,g]=react.useState(""),[E,A]=react.useState(false),[R,F]=react.useState(true),[S,C]=react.useState(null),I=o==="loading",y=async f=>{f.preventDefault(),C(null);let W=d.trim();if(!W||!x){C("Email and passkey are required.");return}if(s){if(!l.trim()){C("Full name is required for registration.");return}if(x.length<6){C("Passkey must be at least 6 characters long.");return}await r(W,x,l.trim());}else await e(W,x);},T=async f=>{f.preventDefault(),await t(d.trim());},k=()=>{A(f=>!f),c(1100,"sine",.05);},b=s?"ENROLL OPERATIVE":"AUTHENTICATE",v=S||a;return jsxRuntime.jsxs("form",{onSubmit:y,className:"space-y-4",noValidate:true,children:[s&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"jarvis-fullname",className:"block text-xs text-cyber-cyan/70 tracking-widest mb-1 uppercase",children:"Full Name / Operative ID"}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.UserCheck,{className:"w-4 h-4 absolute left-3 top-3 text-cyber-cyan/50"}),jsxRuntime.jsx("input",{id:"jarvis-fullname",type:"text",autoComplete:"name","aria-label":"Full Name",value:l,onChange:f=>h(f.target.value),placeholder:"Tony Stark",className:"w-full bg-cyber-bg/90 border border-cyber-cyan/40 rounded px-10 py-2.5 text-sm text-cyber-cyan focus:outline-none focus:border-cyber-cyan focus:ring-1 focus:ring-cyber-cyan transition-all placeholder:text-cyber-cyan/30",disabled:I})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"jarvis-email",className:"block text-xs text-cyber-cyan/70 tracking-widest mb-1 uppercase",children:"Email Address"}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Mail,{className:"w-4 h-4 absolute left-3 top-3 text-cyber-cyan/50"}),jsxRuntime.jsx("input",{id:"jarvis-email",type:"email",autoComplete:"email","aria-label":"Email Address",value:d,onChange:f=>u(f.target.value),placeholder:"stark@avengers.io",required:true,className:"w-full bg-cyber-bg/90 border border-cyber-cyan/40 rounded px-10 py-2.5 text-sm text-cyber-cyan focus:outline-none focus:border-cyber-cyan focus:ring-1 focus:ring-cyber-cyan transition-all placeholder:text-cyber-cyan/30",disabled:I})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"jarvis-passkey",className:"block text-xs text-cyber-cyan/70 tracking-widest mb-1 uppercase",children:"Passkey"}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Lock,{className:"w-4 h-4 absolute left-3 top-3 text-cyber-cyan/50"}),jsxRuntime.jsx("input",{id:"jarvis-passkey",type:E?"text":"password",autoComplete:s?"new-password":"current-password","aria-label":"Passkey",value:x,minLength:6,required:true,onChange:f=>g(f.target.value),placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",className:"w-full bg-cyber-bg/90 border border-cyber-cyan/40 rounded px-10 py-2.5 text-sm text-cyber-cyan focus:outline-none focus:border-cyber-cyan focus:ring-1 focus:ring-cyber-cyan transition-all placeholder:text-cyber-cyan/30 pr-12",disabled:I}),jsxRuntime.jsx("button",{type:"button",onClick:k,tabIndex:-1,className:"absolute right-3 top-3 text-cyber-cyan/50 hover:text-cyber-cyan transition-colors","aria-label":E?"Hide passkey":"Show passkey",children:E?jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"})})]})]}),v&&jsxRuntime.jsx("div",{role:"alert",className:"text-xs text-cyber-red bg-cyber-red/10 border border-cyber-red/40 p-2.5 rounded font-mono text-center",children:v}),jsxRuntime.jsxs("div",{className:"relative my-4",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center",children:jsxRuntime.jsx("div",{className:"w-full border-t border-cyber-cyan/30"})}),jsxRuntime.jsx("div",{className:"relative flex justify-center",children:jsxRuntime.jsx("span",{className:"px-3 text-xs text-cyber-cyan/50 bg-cyber-bg",children:"OR"})})]}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{c(900,"sine",.1),n();},disabled:I,className:"w-full bg-cyber-cyan/10 border-2 border-cyber-emerald hover:bg-cyber-cyan/30 text-cyber-emerald font-orbitron py-3 rounded tracking-widest font-bold transition-all shadow-cyber-glow flex items-center justify-center gap-2 disabled:opacity-60 disabled:cursor-not-allowed","aria-label":"Use device passkey",children:jsxRuntime.jsx("span",{children:"USE DEVICE PASSKEY"})}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center text-xs pt-1",children:[jsxRuntime.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer text-cyber-cyan/70 hover:text-cyber-cyan",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:R,onChange:f=>F(f.target.checked),className:"accent-cyber-cyan bg-cyber-bg border-cyber-cyan/40 rounded",disabled:I}),jsxRuntime.jsx("span",{children:"REMEMBER ID"})]}),jsxRuntime.jsx("a",{href:"#",onClick:T,className:"text-cyber-cyan/70 hover:text-cyber-cyan underline transition-all",children:"RECOVER ACCESS"})]}),jsxRuntime.jsx("button",{type:"submit",disabled:I,className:"w-full mt-4 bg-cyber-cyan/10 border-2 border-cyber-cyan hover:bg-cyber-cyan/30 text-cyber-cyan font-orbitron py-3 rounded tracking-widest font-bold transition-all shadow-cyber-glow hover:scale-[1.01] active:scale-[0.99] flex items-center justify-center space-x-2 disabled:opacity-60 disabled:cursor-not-allowed disabled:hover:scale-100",children:I?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Loader2,{className:"w-4 h-4 animate-spin"}),jsxRuntime.jsx("span",{children:"AUTHENTICATING..."})]}):jsxRuntime.jsx("span",{children:b})})]})}function ve(){let{verifyFace:s,playBeep:e,status:r}=M(),[t,n]=react.useState(false),[a,o]=react.useState("READY FOR FACE AUTH"),[c,l]=react.useState(null);react.useEffect(()=>{let u=false;return z().then(x=>{u||l(x);}),()=>{u=true;}},[]);let h=async()=>{t||r==="loading"||(n(true),e(1400,"sine",.05),o("VERIFYING VIA DEVICE BIOMETRIC..."),await s(),n(false),o("READY FOR FACE AUTH"));},d=t||r==="loading";return jsxRuntime.jsxs("div",{className:"flex flex-col items-center space-y-4 py-2",children:[jsxRuntime.jsxs("div",{className:"relative w-48 h-48 border-2 border-cyber-cyan/50 rounded-lg overflow-hidden bg-cyber-bg/90 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(#00f3ff_1px,transparent_1px)] [background-size:12px_12px] opacity-20"}),jsxRuntime.jsxs("div",{className:"w-32 h-32 border border-dashed border-cyber-cyan/60 rounded-full flex items-center justify-center relative z-10",children:[jsxRuntime.jsx(lucideReact.User,{className:"w-16 h-16 text-cyber-cyan/30"}),jsxRuntime.jsx("div",{className:"absolute top-4 left-6 w-1.5 h-1.5 bg-cyber-cyan rounded-full animate-ping"}),jsxRuntime.jsx("div",{className:"absolute top-8 right-8 w-1.5 h-1.5 bg-cyber-cyan rounded-full"})]}),d&&jsxRuntime.jsx("div",{className:"absolute left-0 right-0 h-0.5 bg-cyber-cyan shadow-cyber-glow-strong animate-scan-laser z-20"}),jsxRuntime.jsx("div",{className:"absolute bottom-2 text-[10px] tracking-wider text-cyber-cyan/80 bg-cyber-bg/80 px-2 py-0.5 border border-cyber-cyan/30 z-30",children:a})]}),c===false?jsxRuntime.jsxs("p",{className:"text-xs text-amber-400/80 text-center flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.ShieldAlert,{className:"w-3.5 h-3.5"}),"No device face authenticator found. Set up Windows Hello / Face ID, or use another method."]}):jsxRuntime.jsx("p",{className:"text-xs text-cyber-cyan/60 text-center",children:"Secure device face auth (Windows Hello / Face ID). Your camera is handled by the OS \u2014 no image ever leaves this device."}),jsxRuntime.jsxs("button",{type:"button",onClick:h,disabled:d||c===false,className:"w-full bg-cyber-cyan/10 border border-cyber-cyan hover:bg-cyber-cyan/30 text-cyber-cyan font-orbitron py-3 rounded tracking-widest font-bold transition-all shadow-cyber-glow flex items-center justify-center gap-2 disabled:opacity-60 disabled:cursor-not-allowed",children:[jsxRuntime.jsx(lucideReact.Scan,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:d?"VERIFYING...":"INITIALIZE FACE AUTH"})]})]})}var qt="JARVIS ACCESS AUTHORIZATION CODE SEVEN",zt=3e3,xe=[10,14,18,14,10,7,5];function ie({mode:s="verify"}){let{verifyVoice:e,enrollVoice:r,playBeep:t,playError:n,status:a}=M(),[o,c]=react.useState(false),[l,h]=react.useState(xe),[d,u]=react.useState(null),x=react.useRef(null),g=react.useRef(null),E=react.useRef(null),A=react.useRef([]),R=s==="enroll";react.useEffect(()=>()=>{x.current&&window.clearInterval(x.current),g.current&&window.clearTimeout(g.current);let C=E.current;if(C&&C.state!=="inactive"){try{C.stop();}catch{}C.stream&&C.stream.getTracks().forEach(I=>I.stop());}},[]);let F=async()=>{if(o||a==="loading")return;u(null),c(true);let C=false;if(A.current=[],typeof navigator<"u"&&navigator.mediaDevices?.getUserMedia)try{let y=await navigator.mediaDevices.getUserMedia({audio:!0}),T=window.MediaRecorder;if(T){let k=new T(y);E.current=k,k.ondataavailable=b=>{b.data&&b.data.size>0&&A.current.push(b.data);},k.start(),C=!0;}else y.getTracks().forEach(k=>k.stop());}catch{}if(!C){c(false),u("Microphone unavailable. Grant mic access and retry."),n();return}let I=()=>{t(400+Math.random()*600,"sine",.05),h(xe.map(()=>Math.floor(Math.random()*50)+6));};I(),x.current=window.setInterval(I,100),g.current=window.setTimeout(async()=>{x.current&&(window.clearInterval(x.current),x.current=null),h(xe);let y=E.current;y&&y.state!=="inactive"&&(await new Promise(b=>{y.onstop=()=>b();try{y.stop();}catch{b();}}),y.stream&&y.stream.getTracks().forEach(b=>b.stop())),E.current=null;let T=A.current[0]?.type||"audio/webm",k=new Blob(A.current,{type:T});if(A.current=[],c(false),g.current=null,k.size===0){u("No audio captured. Speak clearly into the mic and retry."),n();return}R?await r(k):await e(k);},zt);},S=o?"RECORDING...":R?"RECORD & ENROLL VOICE":"LISTEN & VERIFY";return jsxRuntime.jsxs("div",{className:"flex flex-col items-center space-y-4 py-2",children:[jsxRuntime.jsxs("div",{className:"w-full h-32 border border-cyber-cyan/40 bg-cyber-bg/90 rounded p-3 flex flex-col items-center justify-center relative overflow-hidden",children:[jsxRuntime.jsx("div",{className:"flex items-end justify-center gap-1.5 w-full h-16",children:l.map((C,I)=>jsxRuntime.jsx("div",{className:"w-1.5 bg-cyber-cyan rounded-full transition-all duration-150",style:{height:`${C}px`,opacity:Math.max(.3,Math.min(1,C/50))}},I))}),jsxRuntime.jsxs("div",{className:"text-xs text-cyber-cyan font-mono mt-2 tracking-widest text-glow text-center",children:["PHRASE: \u201C",qt,"\u201D"]})]}),d?jsxRuntime.jsxs("p",{className:"text-xs text-amber-400/80 text-center flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.ShieldAlert,{className:"w-3.5 h-3.5"}),d]}):jsxRuntime.jsx("p",{className:"text-xs text-cyber-cyan/60 text-center",children:R?"Speak the phrase to capture your voiceprint. Processed on-device.":"Speak the phrase to verify your voiceprint. Processed on-device."}),jsxRuntime.jsxs("button",{type:"button",onClick:F,disabled:o||a==="loading",className:["w-full bg-cyber-cyan/10 border text-cyber-cyan font-orbitron py-3 rounded tracking-widest font-bold transition-all shadow-cyber-glow flex items-center justify-center gap-2 disabled:cursor-not-allowed",o?"border-cyber-emerald/80 bg-cyber-emerald/15 animate-pulse":"border-cyber-cyan hover:bg-cyber-cyan/30 disabled:opacity-60"].join(" "),children:[jsxRuntime.jsx(lucideReact.Mic,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:S})]})]})}function Ae(){let{verifyFingerprint:s,playBeep:e,status:r}=M(),[t,n]=react.useState(false),[a,o]=react.useState(null);react.useEffect(()=>{let h=false;return z().then(d=>{h||o(d);}),()=>{h=true;}},[]);let c=async()=>{t||r==="loading"||(n(true),e(600,"sine",.05),await s(),n(false));},l=t||r==="loading";return jsxRuntime.jsxs("div",{className:"flex flex-col items-center space-y-4 py-2",children:[jsxRuntime.jsxs("div",{role:"button",tabIndex:0,onClick:c,onKeyDown:h=>{(h.key===" "||h.key==="Enter")&&(h.preventDefault(),c());},className:["w-36 h-36 border-2 border-dashed rounded-full flex items-center justify-center bg-cyber-bg/90 cursor-pointer relative shadow-cyber-glow transition-all select-none",l?"border-cyber-cyan scale-105":"border-cyber-cyan/50 hover:border-cyber-cyan",l||a===false?"pointer-events-none opacity-80":""].join(" "),"aria-label":"Fingerprint pad - activate to verify",children:[jsxRuntime.jsx(lucideReact.Fingerprint,{className:["w-20 h-20 transition-all duration-200",l?"text-cyber-cyan scale-110":"text-cyber-cyan/60"].join(" ")}),jsxRuntime.jsx("div",{className:"absolute inset-3 rounded-full border-2 border-t-cyber-cyan/80 border-r-cyber-cyan/40 border-b-cyber-cyan/10 border-l-cyber-cyan/40",style:{animation:l?"spin 0.8s linear infinite":"none"}})]}),a===false?jsxRuntime.jsxs("p",{className:"text-xs text-amber-400/80 text-center flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.ShieldAlert,{className:"w-3.5 h-3.5"}),"No device fingerprint authenticator found. Set up Windows Hello / Touch ID, or use another method."]}):jsxRuntime.jsx("p",{className:"text-xs text-cyber-cyan/60 text-center",children:"TAP THE SCANNER TO VERIFY VIA DEVICE FINGERPRINT (WINDOWS HELLO / TOUCH ID)"})]})}function rr(){let{modal:s,closeModal:e}=M();return s.open?jsxRuntime.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-md p-4 animate-[fadeIn_.2s_ease-out]",role:"dialog","aria-modal":"true","aria-labelledby":"jarvis-modal-title",onClick:r=>{r.target===r.currentTarget&&e();},children:jsxRuntime.jsxs("div",{className:"cyber-panel max-w-sm w-full p-6 text-center rounded-lg space-y-4 shadow-cyber-glow-strong animate-[popIn_.25s_cubic-bezier(0.34,1.56,0.64,1)]",style:{borderColor:s.isSuccess?"rgba(0, 243, 255, 0.5)":"rgba(255, 0, 85, 0.5)"},children:[jsxRuntime.jsx("div",{className:"absolute top-[-2px] right-[-2px] w-3 h-3 border-t-2 border-r-2",style:{borderColor:s.isSuccess?"#00f3ff":"#ff0055"}}),jsxRuntime.jsx("div",{className:"absolute bottom-[-2px] left-[-2px] w-3 h-3 border-b-2 border-l-2",style:{borderColor:s.isSuccess?"#00f3ff":"#ff0055"}}),jsxRuntime.jsx("div",{className:"w-16 h-16 rounded-full mx-auto flex items-center justify-center border-2",style:{borderColor:s.isSuccess?"#00f3ff":"#ff0055",backgroundColor:s.isSuccess?"rgba(0, 243, 255, 0.2)":"rgba(255, 0, 85, 0.2)"},children:s.isSuccess?jsxRuntime.jsx(lucideReact.ShieldCheck,{className:"w-8 h-8",style:{color:"#00f3ff"}}):jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-8 h-8",style:{color:"#ff0055"}})}),jsxRuntime.jsx("h3",{id:"jarvis-modal-title",className:`font-orbitron font-bold text-xl tracking-widest ${s.isSuccess?"text-glow":"text-glow-red"}`,style:{color:s.isSuccess?"#00f3ff":"#ff0055"},children:s.title}),jsxRuntime.jsx("p",{className:"text-xs text-cyber-cyan/80 leading-relaxed font-mono",children:s.message}),jsxRuntime.jsx("button",{onClick:e,className:"w-full bg-cyber-cyan/20 border border-cyber-cyan hover:bg-cyber-cyan/40 text-cyber-cyan font-orbitron py-2.5 rounded tracking-widest transition-all",children:"CONTINUE"})]})}):null}function sr(){let{activeMethod:s,setActiveMethod:e}=M(),r=[{id:"retina",icon:jsxRuntime.jsx(lucideReact.Eye,{className:"w-5 h-5 mb-1"}),label:"FACIAL/EYE"},{id:"passkey",icon:jsxRuntime.jsx(lucideReact.Target,{className:"w-5 h-5 mb-1"}),label:"PASSKEY"},{id:"voice",icon:jsxRuntime.jsx(lucideReact.Mic,{className:"w-5 h-5 mb-1"}),label:"VOICE"}],t="flex flex-col items-center justify-center p-3 border rounded transition-all group",n="border-cyber-cyan bg-cyber-cyan/20 shadow-cyber-glow",a="border-cyber-cyan/30 bg-cyber-cyan/5 hover:bg-cyber-cyan/20";return jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3 mb-6",children:r.map(o=>{let c=s===o.id;return jsxRuntime.jsxs("button",{type:"button",id:`btn-method-${o.id}`,onClick:()=>e(o.id),className:`${t} ${c?n:a}`,"aria-pressed":c,children:[jsxRuntime.jsx("div",{className:`transition-transform ${c?"":"group-hover:scale-110"}`,children:o.icon}),jsxRuntime.jsx("span",{className:"text-[10px] tracking-wider",children:o.label})]},o.id)})})}function nr(){let{user:s,logout:e,enrollBiometrics:r,status:t}=M(),[n,a]=react.useState(false),[o,c]=react.useState(false),[l,h]=react.useState(false);if(react.useEffect(()=>{s&&(c(new H().has(s.email)),h(new $().has(s.email)));},[s]),!s)return null;let d=t==="loading";return jsxRuntime.jsxs("div",{className:"cyber-panel w-full max-w-md p-6 md:p-8 rounded-lg shadow-cyber-glow relative space-y-6 animate-[fadeIn_.3s_ease-out]",children:[jsxRuntime.jsx("div",{className:"cyber-corner-tr"}),jsxRuntime.jsx("div",{className:"cyber-corner-bl"}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center border-b border-cyber-cyan/20 pb-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"font-orbitron text-xl font-bold tracking-widest text-glow text-cyber-emerald",children:"CLEARANCE GRANTED"}),jsxRuntime.jsx("p",{className:"text-xs text-cyber-cyan/60 tracking-wider",children:"AUTHENTICATED OPERATIVE COMMAND"})]}),jsxRuntime.jsx("div",{className:"p-2 bg-cyber-emerald/10 border border-cyber-emerald/40 rounded-full text-cyber-emerald",children:jsxRuntime.jsx(lucideReact.ShieldCheck,{className:"w-6 h-6"})})]}),jsxRuntime.jsxs("div",{className:"space-y-3 font-mono text-xs bg-cyber-bg/90 p-4 border border-cyber-cyan/30 rounded",children:[jsxRuntime.jsxs("div",{className:"flex justify-between gap-2",children:[jsxRuntime.jsx("span",{className:"text-cyber-cyan/50 shrink-0",children:"OPERATIVE UID:"}),jsxRuntime.jsx("span",{className:"text-cyber-cyan font-bold truncate",children:s.uid})]}),jsxRuntime.jsxs("div",{className:"flex justify-between gap-2",children:[jsxRuntime.jsx("span",{className:"text-cyber-cyan/50 shrink-0",children:"EMAIL:"}),jsxRuntime.jsx("span",{className:"text-cyber-cyan font-bold truncate",children:s.email})]}),jsxRuntime.jsxs("div",{className:"flex justify-between gap-2",children:[jsxRuntime.jsx("span",{className:"text-cyber-cyan/50 shrink-0",children:"FULL NAME:"}),jsxRuntime.jsx("span",{className:"text-cyber-cyan font-bold truncate",children:s.fullName})]}),jsxRuntime.jsxs("div",{className:"flex justify-between gap-2",children:[jsxRuntime.jsx("span",{className:"text-cyber-cyan/50 shrink-0",children:"CLEARANCE:"}),jsxRuntime.jsx("span",{className:"text-cyber-emerald font-bold",children:s.clearanceLevel||"Level 1 - Full Access"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between gap-2",children:[jsxRuntime.jsx("span",{className:"text-cyber-cyan/50 shrink-0",children:"DEVICE BIOMETRIC:"}),jsxRuntime.jsx("span",{className:o?"text-cyber-emerald font-bold":"text-cyber-cyan font-bold",children:o?"ENROLLED":"NOT ENROLLED"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between gap-2",children:[jsxRuntime.jsx("span",{className:"text-cyber-cyan/50 shrink-0",children:"VOICEPRINT:"}),jsxRuntime.jsx("span",{className:l?"text-cyber-emerald font-bold":"text-cyber-cyan font-bold",children:l?"ENROLLED":"NOT ENROLLED"})]})]}),jsxRuntime.jsxs("button",{type:"button",onClick:r,disabled:d||o,className:"w-full bg-cyber-cyan/10 border border-cyber-cyan hover:bg-cyber-cyan/20 text-cyber-cyan py-2.5 rounded font-orbitron text-xs tracking-wider transition-all flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:[jsxRuntime.jsx(lucideReact.Fingerprint,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:o?"DEVICE BIOMETRIC ENROLLED":"ENROLL DEVICE BIOMETRIC (TOUCH ID / FACE ID)"})]}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>a(u=>!u),disabled:d,className:"w-full bg-cyber-cyan/10 border border-cyber-cyan hover:bg-cyber-cyan/20 text-cyber-cyan py-2.5 rounded font-orbitron text-xs tracking-wider transition-all flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:[jsxRuntime.jsx(lucideReact.Mic,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:n?"HIDE VOICE ENROLLMENT":l?"RE-ENROLL VOICEPRINT":"ENROLL VOICEPRINT"})]}),n&&jsxRuntime.jsx(ie,{mode:"enroll"}),jsxRuntime.jsxs("button",{type:"button",onClick:e,disabled:d,className:"w-full bg-cyber-red/10 border border-cyber-red hover:bg-cyber-red/30 text-cyber-red font-orbitron py-3 rounded tracking-widest font-bold transition-all flex items-center justify-center gap-2 disabled:opacity-60",children:[jsxRuntime.jsx(lucideReact.LogOut,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:"TERMINATE SESSION (SIGN OUT)"})]})]})}function ar(){let{isRegisterMode:s,toggleMode:e,activeMethod:r,setActiveMethod:t,playBeep:n}=M();return jsxRuntime.jsxs("div",{className:"cyber-panel w-full max-w-md p-6 md:p-8 rounded-lg shadow-cyber-glow relative animate-[fadeIn_.3s_ease-out]",children:[jsxRuntime.jsx("div",{className:"cyber-corner-tr"}),jsxRuntime.jsx("div",{className:"cyber-corner-bl"}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-6 border-b border-cyber-cyan/20 pb-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{id:"auth-title",className:"font-orbitron text-xl md:text-2xl font-bold tracking-widest text-glow uppercase",children:s?"REGISTER":"SIGN IN"}),jsxRuntime.jsx("p",{className:"text-xs text-cyber-cyan/60 tracking-wider",children:s?"CREATE NEW OPERATIVE CLEARANCE":"AUTHENTICATION REQUIRED"})]}),jsxRuntime.jsxs("button",{type:"button",onClick:e,className:"text-xs border border-cyber-cyan/40 hover:border-cyber-cyan bg-cyber-cyan/10 hover:bg-cyber-cyan/20 px-3 py-1.5 rounded transition-all tracking-wider flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.RefreshCw,{className:"w-3 h-3"}),jsxRuntime.jsx("span",{children:s?"SIGN IN":"REGISTER"})]})]}),jsxRuntime.jsx(sr,{}),jsxRuntime.jsxs("div",{className:"min-h-[360px]",children:[r==="passkey"&&jsxRuntime.jsx(he,{}),r==="retina"&&jsxRuntime.jsx(ve,{}),r==="voice"&&jsxRuntime.jsx(ie,{}),r==="fingerprint"&&jsxRuntime.jsx(Ae,{})]}),jsxRuntime.jsxs("div",{className:"mt-6 pt-4 border-t border-cyber-cyan/20 flex justify-between items-center text-xs",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{t("fingerprint"),n(700,"sine",.1);},className:"text-cyber-cyan/60 hover:text-cyber-cyan flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.Fingerprint,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"FINGERPRINT SCAN"})]}),jsxRuntime.jsxs("span",{className:"text-cyber-cyan/40 uppercase tracking-wider",children:["PROTOCOL: ",r]})]})]})}function or(){let{user:s,audioEnabled:e,toggleAudio:r,adapterName:t}=M(),[n,a]=react.useState({time:"13:14",date:""});react.useEffect(()=>{let c=()=>{let h=new Date,d=String(h.getHours()).padStart(2,"0"),u=String(h.getMinutes()).padStart(2,"0");a({time:`${d}:${u}`,date:h.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})});};c();let l=setInterval(c,1e3);return ()=>clearInterval(l)},[]);let o=()=>{typeof document>"u"||(document.fullscreenElement?document.exitFullscreen&&document.exitFullscreen().catch(()=>{}):document.documentElement.requestFullscreen().catch(()=>{}));};return jsxRuntime.jsxs("div",{className:"min-h-screen w-screen flex flex-col justify-between p-4 md:p-8 relative overflow-x-hidden select-none",children:[jsxRuntime.jsxs("header",{className:"relative z-10 flex justify-between items-center w-full border-b border-cyber-cyan/20 pb-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 bg-cyber-cyan rounded-full animate-ping"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h1",{className:"font-orbitron font-bold text-lg md:text-xl tracking-widest text-glow flex items-center gap-2",children:["J.A.R.V.I.S.",jsxRuntime.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-cyber-cyan/10 border border-cyber-cyan/40 text-cyber-cyan",children:"PRODUCTION AUTH v10.5"})]}),jsxRuntime.jsx("p",{className:"text-xs text-cyber-cyan/60 tracking-wider",children:"REALTIME AUTHENTICATION & ENCRYPTION ENGINE"})]})]}),jsxRuntime.jsxs("div",{className:"hidden md:flex items-center space-x-8 text-xs",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("span",{className:"text-cyber-cyan/50",children:"ADAPTER:"}),jsxRuntime.jsx("span",{className:"text-cyber-emerald font-bold uppercase",children:t})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("span",{className:"text-cyber-cyan/50",children:"WEBAUTHN:"}),jsxRuntime.jsx("span",{className:"text-cyber-cyan font-bold",children:"READY"})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("span",{className:"text-cyber-cyan/50",children:"AI CORE:"}),jsxRuntime.jsx("span",{className:"text-cyber-emerald animate-pulse",children:"ONLINE"})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("button",{onClick:r,"aria-label":e?"Mute audio":"Enable audio",className:["p-2 bg-cyber-cyan/10 border border-cyber-cyan/30 hover:bg-cyber-cyan/20 text-cyber-cyan transition-all rounded",e?"":"opacity-50"].join(" "),children:e?jsxRuntime.jsx(lucideReact.Volume2,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.VolumeX,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:o,"aria-label":"Toggle fullscreen",className:"p-2 bg-cyber-cyan/10 border border-cyber-cyan/30 hover:bg-cyber-cyan/20 text-cyber-cyan transition-all rounded",children:jsxRuntime.jsx(lucideReact.Maximize,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsxs("main",{className:"relative z-10 flex-1 grid grid-cols-1 lg:grid-cols-12 gap-8 items-center my-6",children:[jsxRuntime.jsx("section",{className:"lg:col-span-6 flex flex-col items-center justify-center relative min-h-[300px]",children:jsxRuntime.jsx(pe,{})}),jsxRuntime.jsx("section",{className:"lg:col-span-6 flex justify-center",children:s?jsxRuntime.jsx(nr,{}):jsxRuntime.jsx(ar,{})})]}),jsxRuntime.jsxs("footer",{className:"relative z-10 flex flex-col md:flex-row justify-between items-center border-t border-cyber-cyan/20 pt-3 text-xs text-cyber-cyan/60 space-y-2 md:space-y-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-4",children:[jsxRuntime.jsxs("span",{children:["STARK INDUSTRIES \xA9 ",new Date().getFullYear()]}),jsxRuntime.jsx("span",{children:"\u2022"}),jsxRuntime.jsxs("span",{className:"text-cyber-emerald flex items-center gap-1",children:[jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full bg-cyber-emerald animate-ping"})," ","SECURE AUTH NODE ACTIVE"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-6 font-mono",children:[jsxRuntime.jsx("div",{className:"text-cyber-cyan text-sm md:text-base font-bold tracking-widest text-glow",children:n.time}),jsxRuntime.jsx("div",{className:"text-cyber-cyan/50 text-xs uppercase",children:n.date})]})]}),jsxRuntime.jsx(rr,{}),jsxRuntime.jsx("style",{dangerouslySetInnerHTML:{__html:`
|
|
2
|
+
@keyframes fadeIn {
|
|
3
|
+
from { opacity: 0; }
|
|
4
|
+
to { opacity: 1; }
|
|
5
|
+
}
|
|
6
|
+
@keyframes popIn {
|
|
7
|
+
0% { opacity: 0; transform: scale(0.85); }
|
|
8
|
+
100% { opacity: 1; transform: scale(1); }
|
|
9
|
+
}
|
|
10
|
+
`}})]})}function cr(){let s=react.useRef(null),e=react.useRef(null);return react.useEffect(()=>{let r=s.current;if(!r)return;let t=r.getContext("2d");if(!t)return;let n=0,a=0,o=[],c=()=>{n=r.width=window.innerWidth,a=r.height=window.innerHeight;};c(),window.addEventListener("resize",c);let l=Math.max(50,Math.min(100,Math.floor(n*a/24e3)));for(let d=0;d<l;d++)o.push({x:Math.random()*n,y:Math.random()*a,size:Math.random()*1.5+.5,speedX:(Math.random()-.5)*.3,speedY:(Math.random()-.5)*.3,opacity:Math.random()*.5+.2});let h=()=>{t.clearRect(0,0,n,a),t.strokeStyle="rgba(0, 243, 255, 0.035)",t.lineWidth=1;let d=40;for(let u=0;u<n;u+=d)t.beginPath(),t.moveTo(u,0),t.lineTo(u,a),t.stroke();for(let u=0;u<a;u+=d)t.beginPath(),t.moveTo(0,u),t.lineTo(n,u),t.stroke();o.forEach(u=>{u.x+=u.speedX,u.y+=u.speedY,u.x<0?u.x=n:u.x>n&&(u.x=0),u.y<0?u.y=a:u.y>a&&(u.y=0),t.fillStyle=`rgba(0, 243, 255, ${u.opacity})`,t.beginPath(),t.arc(u.x,u.y,u.size,0,Math.PI*2),t.fill();}),e.current=requestAnimationFrame(h);};return h(),()=>{e.current!=null&&cancelAnimationFrame(e.current),window.removeEventListener("resize",c);}},[]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("canvas",{ref:s,className:"fixed inset-0 z-0 pointer-events-none","aria-hidden":"true"}),jsxRuntime.jsx("div",{className:"scanlines fixed inset-0 z-0 pointer-events-none","aria-hidden":"true"})]})}exports.ArcReactorHud=pe;exports.AuthPortal=or;exports.AuthProvider=Et;exports.BackendAuthAdapter=ne;exports.CanvasBackground=cr;exports.FacialScanner=ve;exports.FingerprintPad=Ae;exports.MockAuthAdapter=Z;exports.PasskeyForm=he;exports.SoundEngine=Q;exports.VoiceScanner=ie;exports.__resetMockAdapterStateForTests=wt;exports.createAuthAdapter=ye;exports.useAuth=M;
|