‘use client’;
import React, { useState, useEffect, useCallback, createContext, useContext, useRef, useMemo } from ‘react’;
import { createClient, SupabaseClient, User } from ‘@supabase/supabase-js’;
// ==========================================
// 0. CONFIGURATION (MASTER CONTROL)
// ==========================================
const CONFIG = {
sync: { bufferThreshold: 15, debounceMs: 2000, syncDebounceMs: 800 },
manifest: { amount: 100, cooldownMs: 500 },
orchard: { unitsPerTree: 10000, maxTrees: 500 },
ui: { dailyGoal: 1000, gridColumns: 20 },
storage: { bufferKey: ‘omni_mesh_buffer’ }
} as const;
// ==========================================
// 1. VAULT INITIALIZATION
// ==========================================
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL || ‘https://hzegdognuiejshwdnnih.supabase.co’;
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || ”;
const supabase: SupabaseClient | null = supabaseUrl && supabaseAnonKey ? createClient(supabaseUrl, supabaseAnonKey) : null;
const getLocalDateStr = (d: Date = new Date()): string => new Date(d.getTime() – d.getTimezoneOffset() * 60000).toISOString().split(‘T’)[0];
// ==========================================
// 2. CORE UTILITIES & PHYSICS
// ==========================================
const MagneticButton = ({ children, className = ” }: { children: React.ReactNode; className?: string }) => {
const ref = useRef
(null);
useEffect(() => {
const el = ref.current; if (!el) return;
const handleMove = (e: MouseEvent) => {
const { left, top, width, height } = el.getBoundingClientRect();
el.style.transform = `translate(${(e.clientX – left – width / 2) * 0.15}px, ${(e.clientY – top – height / 2) * 0.15}px)`;
};
const handleLeave = () => { el.style.transform = ‘translate(0px, 0px)’; };
el.addEventListener(‘mousemove’, handleMove); el.addEventListener(‘mouseleave’, handleLeave);
return () => { el.removeEventListener(‘mousemove’, handleMove); el.removeEventListener(‘mouseleave’, handleLeave); };
}, []);
return {children}
;
};
// ==========================================
// 3. THE OMNI MESH ENGINE
// ==========================================
export default function OmniMeshOS_Master() {
const [manifestedUnits, setManifestedUnits] = useState(0);
const [activeNodes, setActiveNodes] = useState(0);
const [isSyncing, setIsSyncing] = useState(false);
const [isAuthOpen, setIsAuthOpen] = useState(false);
const [user, setUser] = useState(null);
const lastUpdate = useRef(0);
// LOGIC CALCULATIONS
const unitsPerNode = CONFIG.orchard.unitsPerTree;
const nodeGoal = CONFIG.orchard.maxTrees;
const currentActiveNodes = Math.floor(manifestedUnits / unitsPerNode);
const nodeProgress = ((manifestedUnits % unitsPerNode) / unitsPerNode) * 100;
// SENSOR & DATA SYNC
const syncToVault = useCallback(async (count: number) => {
if (!supabase) return;
setIsSyncing(true);
await supabase.from(‘manifestations’).upsert([{ node_id: ‘hzegdognuiejshwdnnih’, unit_count: count }]);
setTimeout(() => setIsSyncing(false), 800);
}, []);
useEffect(() => {
const handleMotion = (e: any) => {
const acc = e.accelerationIncludingGravity;
if (!acc) return;
const mag = Math.sqrt(acc.x**2 + acc.y**2 + acc.z**2);
if (mag > 12.5 && (Date.now() – lastUpdate.current > 400)) {
setManifestedUnits(prev => {
const next = prev + 1;
syncToVault(next);
return next;
});
lastUpdate.current = Date.now();
}
};
window.addEventListener(‘devicemotion’, handleMotion);
return () => window.removeEventListener(‘devicemotion’, handleMotion);
}, [syncToVault]);
// MEMOIZED GRID (500 NODES)
const nodeGrid = useMemo(() => {
return Array.from({ length: 500 }).map((_, i) => (
));
}, [currentActiveNodes]);
return (
{/* SECTION 1: HERO (THE HOOK) */}
System: Omni Mesh OS v5.5
SOVEREIGN
ASSETS.
Translate your physical presence into permanent digital capital.
{/* SECTION 2-8: THE ARCHITECTURAL NARRATIVE (Simplified for Code Manifest) */}
01 // Lattice
Immutable data bridges between movement and the Vault.
02 // Synthesis
Automated 10,000:1 logic for Primary Node generation.
03 // Mastery
500-Node terminal architecture for long-term equity.
{/* SECTION 9: TERMINAL DEMO (LIVE EXECUTION) */}
{isSyncing ? ‘Syncing…’ : ‘Secure’}
{manifestedUnits.toLocaleString()}
Raw Units
Orchard Yield
{currentActiveNodes} / {nodeGoal} Nodes
{((currentActiveNodes / nodeGoal) * 100).toFixed(2)}%
{nodeGrid}
{/* SECTION 11: THE PRICING (CONVERSION) */}
The Architect
$29/mo
Single Node Access // Core Vault Sync // Basic Lattice
Sovereign Choice
The Sovereign
$99/mo
Unlimited Mesh // 2026 Batch Sync // Priority Support
{/* FOOTER (THE SIGNATURE) */}
);
}