00Boobs00 commited on
Commit
7355bc1
·
verified ·
1 Parent(s): b5124c7

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +729 -422
index.html CHANGED
@@ -1,499 +1,806 @@
1
  <!DOCTYPE html>
2
- <html lang="en" class="dark">
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>WANA v3 | Autonomous AI Core</title>
7
- <script src="https://cdn.tailwindcss.com"></script>
8
- <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/js/all.min.js"></script>
9
- <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@500;600;700&family=JetBrains+Mono:wght@400;700&display=swap" rel="stylesheet">
10
- <script>
11
- tailwind.config = {
12
- darkMode: 'class',
13
- theme: {
14
- extend: {
15
- fontFamily: {
16
- sans: ['Inter', 'sans-serif'],
17
- display: ['Space Grotesk', 'sans-serif'],
18
- mono: ['JetBrains Mono', 'monospace'],
19
- },
20
- colors: {
21
- 'neon-purple': '#b047ff',
22
- 'cyber-pink': '#ff2a6d',
23
- 'deep-blue': '#0d1117',
24
- 'glow-blue': '#00bfff',
25
- 'matrix-green': '#00ff41',
26
- 'void-black': '#050505',
27
- },
28
- animation: {
29
- 'pulse-fast': 'pulse 1s cubic-bezier(0.4, 0, 0.6, 1) infinite',
30
- 'float': 'float 6s ease-in-out infinite',
31
- 'scan': 'scan 2s linear infinite',
32
- },
33
- keyframes: {
34
- float: { '0%, 100%': { transform: 'translateY(0)' }, '50%': { transform: 'translateY(-10px)' } },
35
- scan: { '0%': { transform: 'translateY(-100%)' }, '100%': { transform: 'translateY(100%)' } }
36
- }
37
- }
38
- }
39
- }
40
- </script>
41
  <style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  body {
43
- background-color: #050505;
44
- background-image:
45
- radial-gradient(circle at 50% 50%, rgba(176, 71, 255, 0.05) 0%, transparent 50%),
46
- linear-gradient(0deg, rgba(255,255,255,0.02) 1px, transparent 1px),
47
- linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
48
- background-size: 100% 100%, 40px 40px, 40px 40px;
 
 
49
  }
50
-
51
- .glass-panel {
52
- background: rgba(15, 15, 25, 0.6);
53
- backdrop-filter: blur(12px);
54
- border: 1px solid rgba(176, 71, 255, 0.15);
55
- box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  }
57
 
58
- .neon-border {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  position: relative;
60
  }
61
- .neon-border::after {
 
 
 
 
 
 
62
  content: '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  position: absolute;
64
- inset: 0;
65
- border-radius: inherit;
66
- padding: 1px;
67
- background: linear-gradient(135deg, rgba(176, 71, 255, 0.5), rgba(0, 191, 255, 0.5));
68
- -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
69
- -webkit-mask-composite: xor;
70
- mask-composite: exclude;
 
 
71
  pointer-events: none;
 
 
 
 
 
 
 
 
72
  }
73
 
74
- .terminal-text {
75
- text-shadow: 0 0 2px rgba(0, 255, 65, 0.5);
 
 
 
 
 
76
  }
77
 
78
- /* Custom Scrollbar */
79
- ::-webkit-scrollbar { width: 6px; }
80
- ::-webkit-scrollbar-track { background: #0d1117; }
81
- ::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
82
- ::-webkit-scrollbar-thumb:hover { background: #b047ff; }
 
 
 
 
 
 
 
83
 
84
- .vector-node {
85
- transition: all 0.5s ease;
 
 
 
 
 
 
 
 
 
 
86
  }
87
- .vector-node:hover {
88
- background-color: #b047ff;
89
- box-shadow: 0 0 10px #b047ff;
 
90
  }
91
 
92
- .status-dot {
93
- box-shadow: 0 0 8px currentColor;
 
 
 
 
 
 
 
 
 
94
  }
95
  </style>
96
  </head>
97
- <body class="text-gray-200 min-h-screen flex flex-col">
98
 
99
  <!-- Header -->
100
- <header class="border-b border-gray-800 bg-black/80 backdrop-blur-md sticky top-0 z-50">
101
- <div class="container mx-auto px-6 py-4 flex justify-between items-center">
102
- <div class="flex items-center gap-3">
103
- <div class="w-10 h-10 rounded bg-gradient-to-br from-neon-purple to-cyber-pink flex items-center justify-center shadow-lg shadow-purple-500/20">
104
- <i class="fas fa-network-wired text-white"></i>
105
- </div>
106
- <div>
107
- <h1 class="text-2xl font-bold tracking-tight text-white">WANA <span class="text-neon-purple text-sm font-mono">v3.0.OS</span></h1>
108
- <p class="text-xs text-gray-500 font-mono">AUTONOMOUS ENGINE CORE</p>
109
- </div>
110
- </div>
111
-
112
- <div class="flex items-center gap-6">
113
- <a href="https://huggingface.co/spaces/00Boobs00/wana" target="_blank" class="text-sm text-gray-400 hover:text-white transition flex items-center gap-2">
114
- <i class="fas fa-cube"></i> HF Space
115
- </a>
116
- <div class="flex items-center gap-2 px-3 py-1 rounded-full bg-green-900/30 border border-green-500/30 text-green-400 text-xs font-mono">
117
- <div class="w-2 h-2 rounded-full bg-green-500 status-dot animate-pulse"></div>
118
- <span>SYSTEM ONLINE</span>
119
- </div>
120
- <!-- Built with AnyCoder -->
121
- <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="text-xs text-gray-600 hover:text-neon-purple transition border border-gray-800 px-2 py-1 rounded">
122
- Built with <span class="font-semibold">anycoder</span>
123
- </a>
124
- </div>
125
  </div>
126
  </header>
127
 
128
- <!-- Main Dashboard Grid -->
129
- <main class="flex-1 container mx-auto px-6 py-8 grid grid-cols-1 lg:grid-cols-12 gap-6">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
- <!-- LEFT COLUMN: System & Permissions -->
132
- <section class="lg:col-span-3 space-y-6">
133
 
134
- <!-- User Role Card -->
135
- <div class="glass-panel rounded-xl p-6 neon-border">
136
- <div class="flex justify-between items-start mb-4">
137
- <h2 class="text-lg font-display font-bold text-white">Access Control</h2>
138
- <i class="fas fa-shield-alt text-neon-purple"></i>
139
  </div>
140
-
141
- <div class="space-y-4">
142
- <div>
143
- <label class="text-xs text-gray-500 uppercase tracking-wider">Current Role</label>
144
- <div class="mt-1 flex items-center gap-2">
145
- <select id="role-selector" class="bg-black border border-gray-700 text-white text-sm rounded p-2 w-full focus:border-neon-purple outline-none transition">
146
- <option value="user">User (Standard)</option>
147
- <option value="creator">Creator (LoRA+)</option>
148
- <option value="admin" selected>Admin (Root)</option>
149
- </select>
150
- </div>
151
- </div>
152
-
153
- <div class="pt-4 border-t border-gray-800">
154
- <label class="text-xs text-gray-500 uppercase tracking-wider mb-2 block">Permissions</label>
155
- <div id="permissions-list" class="space-y-2 text-xs font-mono">
156
- <!-- Injected by JS -->
157
- </div>
158
- </div>
159
  </div>
160
  </div>
161
 
162
- <!-- System Health -->
163
- <div class="glass-panel rounded-xl p-6 neon-border">
164
- <div class="flex justify-between items-start mb-4">
165
- <h2 class="text-lg font-display font-bold text-white">Core Metrics</h2>
166
- <i class="fas fa-microchip text-cyber-pink"></i>
167
- </div>
168
 
169
- <div class="space-y-4">
170
- <div>
171
- <div class="flex justify-between text-xs mb-1">
172
- <span class="text-gray-400">CPU Load</span>
173
- <span id="cpu-val" class="text-glow-blue">12%</span>
174
  </div>
175
- <div class="w-full bg-gray-800 rounded-full h-1.5">
176
- <div id="cpu-bar" class="bg-glow-blue h-1.5 rounded-full transition-all duration-500" style="width: 12%"></div>
 
177
  </div>
178
  </div>
179
- <div>
180
- <div class="flex justify-between text-xs mb-1">
181
- <span class="text-gray-400">Vector Memory</span>
182
- <span id="mem-val" class="text-neon-purple">48.2 MB</span>
 
 
 
 
 
 
 
 
 
 
183
  </div>
184
- <div class="w-full bg-gray-800 rounded-full h-1.5">
185
- <div class="bg-neon-purple h-1.5 rounded-full transition-all duration-500" style="width: 65%"></div>
 
186
  </div>
187
  </div>
188
- <div>
189
- <div class="flex justify-between text-xs mb-1">
190
- <span class="text-gray-400">Autonomy Loop</span>
191
- <span class="text-matrix-green">ACTIVE</span>
192
- </div>
193
- <div class="flex items-center gap-2 mt-2">
194
- <div class="h-2 w-2 rounded-full bg-matrix-green animate-pulse"></div>
195
- <span class="text-xs text-gray-400 font-mono">Uptime: <span id="uptime">04:22:11</span></span>
196
  </div>
 
 
 
 
 
197
  </div>
198
  </div>
199
  </div>
200
 
201
- <!-- Data Persistence -->
202
- <div class="glass-panel rounded-xl p-6 neon-border bg-black/40">
203
- <h3 class="text-sm font-bold text-gray-300 mb-3 flex items-center gap-2">
204
- <i class="fas fa-database text-gray-500"></i> Persistent Index
205
- </h3>
206
- <div class="text-xs text-gray-500 mb-2">data/memory.faiss</div>
207
- <button onclick="saveMemory()" class="w-full border border-gray-700 hover:border-neon-purple hover:text-neon-purple text-gray-300 text-xs py-2 rounded transition">
208
- <i class="fas fa-save mr-1"></i> Force Checkpoint
209
  </button>
210
  </div>
 
211
  </section>
 
212
 
213
- <!-- CENTER COLUMN: Agent Orchestration & Tasking -->
214
- <section class="lg:col-span-6 flex flex-col gap-6">
215
-
216
- <!-- Autonomous Engine Status -->
217
- <div class="glass-panel rounded-xl p-1 neon-border flex-1">
218
- <div class="bg-gray-900/50 rounded-t-xl px-4 py-2 border-b border-gray-800 flex justify-between items-center">
219
- <h2 class="text-sm font-bold text-glow-blue font-mono"><i class="fas fa-circle text-xs mr-2 animate-pulse"></i> AGENT ORCHESTRATION LAYER</h2>
220
- <div class="flex gap-2">
221
- <span class="text-[10px] px-2 py-0.5 rounded bg-gray-800 text-gray-400">PID: 8821</span>
222
- </div>
223
- </div>
224
-
225
- <div class="p-6 grid grid-cols-1 md:grid-cols-3 gap-4 h-full">
226
-
227
- <!-- Planner Agent -->
228
- <div class="bg-black/40 border border-gray-800 rounded-lg p-4 relative overflow-hidden group hover:border-neon-purple transition">
229
- <div class="absolute top-0 right-0 p-2 opacity-10 group-hover:opacity-100 transition"><i class="fas fa-chess-knight text-6xl text-neon-purple"></i></div>
230
- <div class="flex items-center gap-3 mb-3">
231
- <div class="w-8 h-8 rounded bg-neon-purple/20 text-neon-purple flex items-center justify-center"><i class="fas fa-chess"></i></div>
232
- <h3 class="font-bold text-sm">Planner</h3>
233
- </div>
234
- <p class="text-xs text-gray-400 mb-3">Task deconstruction & strategy formation.</p>
235
- <div class="flex justify-between items-center text-xs">
236
- <span class="text-gray-500">Status: <span class="text-neon-purple" id="planner-status">IDLE</span></span>
237
- <div class="w-2 h-2 rounded-full bg-gray-600" id="planner-dot"></div>
238
- </div>
239
- </div>
240
 
241
- <!-- Creative Agent -->
242
- <div class="bg-black/40 border border-gray-800 rounded-lg p-4 relative overflow-hidden group hover:border-cyber-pink transition">
243
- <div class="absolute top-0 right-0 p-2 opacity-10 group-hover:opacity-100 transition"><i class="fas fa-brain text-6xl text-cyber-pink"></i></div>
244
- <div class="flex items-center gap-3 mb-3">
245
- <div class="w-8 h-8 rounded bg-cyber-pink/20 text-cyber-pink flex items-center justify-center"><i class="fas fa-palette"></i></div>
246
- <h3 class="font-bold text-sm">Creative</h3>
247
- </div>
248
- <p class="text-xs text-gray-400 mb-3">Contextual reasoning & prompt injection.</p>
249
- <div class="flex justify-between items-center text-xs">
250
- <span class="text-gray-500">Status: <span class="text-cyber-pink" id="creative-status">STANDBY</span></span>
251
- <div class="w-2 h-2 rounded-full bg-gray-600" id="creative-dot"></div>
252
- </div>
253
- </div>
254
 
255
- <!-- Memory Agent -->
256
- <div class="bg-black/40 border border-gray-800 rounded-lg p-4 relative overflow-hidden group hover:border-matrix-green transition">
257
- <div class="absolute top-0 right-0 p-2 opacity-10 group-hover:opacity-100 transition"><i class="fas fa-memory text-6xl text-matrix-green"></i></div>
258
- <div class="flex items-center gap-3 mb-3">
259
- <div class="w-8 h-8 rounded bg-matrix-green/20 text-matrix-green flex items-center justify-center"><i class="fas fa-database"></i></div>
260
- <h3 class="font-bold text-sm">Memory</h3>
261
- </div>
262
- <p class="text-xs text-gray-400 mb-3">Vector curation & semantic storage.</p>
263
- <div class="flex justify-between items-center text-xs">
264
- <span class="text-gray-500">Status: <span class="text-matrix-green" id="memory-status">WRITING</span></span>
265
- <div class="w-2 h-2 rounded-full bg-matrix-green animate-pulse" id="memory-dot"></div>
266
- </div>
267
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
268
 
269
- </div>
270
 
271
- <!-- Active Task Stream -->
272
- <div class="bg-black border-t border-gray-800 p-4 font-mono text-xs h-48 overflow-y-auto custom-scrollbar" id="agent-log">
273
- <div class="text-gray-500 mb-1">-- System Boot Sequence Initialized --</div>
274
- <div class="text-neon-purple mb-1">[10:00:01] Planner: Loaded role permissions (Admin)</div>
275
- <div class="text-glow-blue mb-1">[10:00:02] Creative: Context window reset (4096 tokens)</div>
276
- <div class="text-matrix-green mb-1">[10:00:03] Memory: Loaded persistent index from /data/memory.faiss</div>
277
- </div>
278
- </div>
279
 
280
- <!-- Generation Input -->
281
- <div class="glass-panel rounded-xl p-6 neon-border">
282
- <h2 class="text-lg font-display font-bold text-white mb-4">Initiate Generation Cycle</h2>
283
- <div class="relative">
284
- <textarea class="w-full bg-gray-900/50 border border-gray-700 rounded-lg p-4 text-sm text-gray-200 focus:border-neon-purple focus:ring-1 focus:ring-neon-purple outline-none h-24 resize-none font-mono" placeholder="Enter system directive..."></textarea>
285
- <div class="absolute bottom-3 right-3 flex gap-2">
286
- <button class="bg-gray-800 hover:bg-gray-700 text-xs px-3 py-1 rounded text-gray-300 transition"><i class="fas fa-paperclip"></i></button>
287
- <button class="bg-neon-purple hover:bg-purple-600 text-white text-xs px-4 py-1 rounded font-bold transition shadow-lg shadow-purple-900/50">
288
- <i class="fas fa-play mr-1"></i> EXECUTE
289
- </button>
290
- </div>
291
- </div>
292
- </div>
293
- </section>
294
 
295
- <!-- RIGHT COLUMN: Vector Memory Vis & Config -->
296
- <section class="lg:col-span-3 space-y-6">
297
-
298
- <!-- Vector Visualizer -->
299
- <div class="glass-panel rounded-xl p-4 neon-border h-80 flex flex-col">
300
- <div class="flex justify-between items-center mb-2">
301
- <h3 class="text-xs font-bold text-gray-400 uppercase tracking-widest">Semantic Space</h3>
302
- <div class="flex gap-1">
303
- <div class="w-2 h-2 rounded-full bg-neon-purple"></div>
304
- <div class="w-2 h-2 rounded-full bg-cyber-pink"></div>
305
- <div class="w-2 h-2 rounded-full bg-matrix-green"></div>
306
- </div>
307
- </div>
308
- <!-- The Grid -->
309
- <div class="flex-1 grid grid-cols-6 gap-1 opacity-60" id="vector-grid">
310
- <!-- Generated by JS -->
311
- </div>
312
- <div class="mt-2 text-[10px] text-center text-gray-600 font-mono">FAISS INDEX VISUALIZATION</div>
313
- </div>
314
 
315
- <!-- Tool Registry -->
316
- <div class="glass-panel rounded-xl p-6 neon-border">
317
- <h2 class="text-sm font-bold text-white mb-4 flex items-center gap-2">
318
- <i class="fas fa-tools text-gray-500"></i> Tool Registry
319
- </h2>
320
- <div class="space-y-2">
321
- <div class="flex justify-between items-center p-2 rounded bg-black/40 border border-gray-800 text-xs">
322
- <span class="text-gray-300">generate_video</span>
323
- <span class="text-matrix-green">READY</span>
324
- </div>
325
- <div class="flex justify-between items-center p-2 rounded bg-black/40 border border-gray-800 text-xs">
326
- <span class="text-gray-300">load_lora</span>
327
- <span class="text-matrix-green">READY</span>
328
- </div>
329
- <div class="flex justify-between items-center p-2 rounded bg-black/40 border border-gray-800 text-xs">
330
- <span class="text-gray-300">stream_context</span>
331
- <span class="text-yellow-500">BUSY</span>
332
- </div>
333
- </div>
334
- </div>
335
 
336
- <!-- Engine Config -->
337
- <div class="glass-panel rounded-xl p-6 neon-border">
338
- <h2 class="text-sm font-bold text-white mb-4">Runtime Config</h2>
339
- <div class="space-y-3 text-xs">
340
- <div class="flex justify-between">
341
- <span class="text-gray-500">Base Model</span>
342
- <span class="font-mono text-neon-purple">Qwen-72B</span>
343
- </div>
344
- <div class="flex justify-between">
345
- <span class="text-gray-500">LoRA Mode</span>
346
- <span class="font-mono text-cyber-pink">Hot-Swap</span>
347
- </div>
348
- <div class="flex justify-between">
349
- <span class="text-gray-500">Log Level</span>
350
- <span class="font-mono text-gray-300">DEBUG</span>
351
- </div>
352
- </div>
353
- </div>
354
 
355
- </section>
356
- </main>
 
357
 
358
- <footer class="border-t border-gray-800 bg-black py-6 mt-auto">
359
- <div class="container mx-auto px-6 text-center">
360
- <p class="text-xs text-gray-600 font-mono">
361
- WANA v3.0 SYSTEM CORE // ENCRYPTED CONNECTION // <span class="text-neon-purple">VECTORS: 4096</span>
362
- </p>
363
- </div>
364
- </footer>
 
 
 
 
 
 
 
 
 
 
 
 
365
 
366
- <!-- Logic Script -->
367
- <script>
368
- // --- 1. Role & Permission System ---
369
- const roles = {
370
- 'user': ['generate', 'view'],
371
- 'creator': ['generate', 'memory_write', 'lora_swap', 'view'],
372
- 'admin': ['generate', 'memory_write', 'lora_swap', 'autonomy', 'config', 'view', 'delete']
373
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
374
 
375
- const roleSelector = document.getElementById('role-selector');
376
- const permList = document.getElementById('permissions-list');
377
 
378
- function updatePermissions() {
379
- const role = roleSelector.value;
380
- const perms = roles[role];
381
- permList.innerHTML = perms.map(p => `
382
- <div class="flex items-center gap-2 text-gray-400">
383
- <i class="fas fa-check text-neon-purple text-[10px]"></i>
384
- <span class="uppercase">${p}</span>
385
- </div>
386
- `).join('');
 
 
387
 
388
- // Visual feedback
389
- addLog(`Security: Permissions loaded for role '${role.toUpperCase()}'`);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
390
  }
391
 
392
- roleSelector.addEventListener('change', updatePermissions);
393
- updatePermissions(); // Init
 
 
 
 
 
 
394
 
395
- // --- 2. Vector Grid Visualizer ---
396
- const vectorGrid = document.getElementById('vector-grid');
397
- const colors = ['bg-neon-purple', 'bg-cyber-pink', 'bg-matrix-green', 'bg-glow-blue', 'bg-gray-600'];
398
-
399
- for(let i=0; i<36; i++) {
400
- const div = document.createElement('div');
401
- // Randomize visual state
402
- const colorClass = colors[Math.floor(Math.random() * colors.length)];
403
- div.className = `rounded-sm ${colorClass} vector-node opacity-40`;
404
- if(Math.random() > 0.7) div.classList.add('opacity-80');
405
- vectorGrid.appendChild(div);
406
- }
407
-
408
- // --- 3. System Simulation (The "Brain") ---
409
- const logs = document.getElementById('agent-log');
410
- const plannerStatus = document.getElementById('planner-status');
411
- const creativeStatus = document.getElementById('creative-status');
412
- const memoryStatus = document.getElementById('memory-status');
413
-
414
- function addLog(text) {
415
- const time = new Date().toLocaleTimeString('en-US', {hour12: false});
416
- const div = document.createElement('div');
417
- // Color coding based on text
418
- let colorClass = 'text-gray-300';
419
- if(text.includes('Planner')) colorClass = 'text-neon-purple';
420
- if(text.includes('Creative')) colorClass = 'text-cyber-pink';
421
- if(text.includes('Memory')) colorClass = 'text-matrix-green';
422
- if(text.includes('Error')) colorClass = 'text-red-500';
423
-
424
- div.className = `${colorClass} mb-1`;
425
- div.innerHTML = `<span class="opacity-50 mr-2">[${time}]</span> ${text}`;
426
- logs.appendChild(div);
427
- logs.scrollTop = logs.scrollHeight;
428
- }
429
-
430
- function simulateCycle() {
431
- const actions = [
432
- () => {
433
- plannerStatus.innerText = "PROCESSING";
434
- document.getElementById('planner-dot').className = "w-2 h-2 rounded-full bg-neon-purple animate-pulse";
435
- addLog("Planner: Analyzing goal vector...");
436
- setTimeout(() => {
437
- plannerStatus.innerText = "IDLE";
438
- document.getElementById('planner-dot').className = "w-2 h-2 rounded-full bg-gray-600";
439
- }, 2000);
440
- },
441
- () => {
442
- creativeStatus.innerText = "GENERATING";
443
- document.getElementById('creative-dot').className = "w-2 h-2 rounded-full bg-cyber-pink animate-pulse";
444
- addLog("Creative: Injecting style parameters...");
445
- setTimeout(() => {
446
- creativeStatus.innerText = "STANDBY";
447
- document.getElementById('creative-dot').className = "w-2 h-2 rounded-full bg-gray-600";
448
- }, 2500);
449
- },
450
- () => {
451
- memoryStatus.innerText = "INDEXING";
452
- addLog("Memory: Compressing vector trajectory...");
453
- setTimeout(() => {
454
- memoryStatus.innerText = "STORED";
455
- setTimeout(() => memoryStatus.innerText = "WRITING", 1000);
456
- }, 1500);
457
- }
458
- ];
459
-
460
- // Run random actions
461
- if(Math.random() > 0.5) actions[Math.floor(Math.random()*actions.length)]();
462
-
463
- // Update CPU/Mem
464
- const cpu = 10 + Math.floor(Math.random() * 20);
465
- document.getElementById('cpu-val').innerText = cpu + "%";
466
- document.getElementById('cpu-bar').style.width = cpu + "%";
467
- }
468
-
469
- setInterval(simulateCycle, 3000);
470
-
471
- // --- 4. Memory Checkpoint ---
472
- function saveMemory() {
473
- const btn = event.target;
474
- const originalText = btn.innerHTML;
475
- btn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> SAVING...';
476
- addLog("System: Initiating manual memory checkpoint...");
477
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
478
  setTimeout(() => {
479
- btn.innerHTML = originalText;
480
- addLog("System: Vector index saved to disk.");
481
- // Flash effect on grid
482
- vectorGrid.style.opacity = "1";
483
- setTimeout(() => vectorGrid.style.opacity = "0.6", 500);
484
- }, 1500);
 
 
 
 
 
 
 
 
 
 
 
485
  }
486
 
487
- // --- 5. Uptime Counter ---
488
- let seconds = 15131; // Fake start time
489
- setInterval(() => {
490
- seconds++;
491
- const h = Math.floor(seconds / 3600).toString().padStart(2, '0');
492
- const m = Math.floor((seconds % 3600) / 60).toString().padStart(2, '0');
493
- const s = (seconds % 60).toString().padStart(2, '0');
494
- document.getElementById('uptime').innerText = `${h}:${m}:${s}`;
495
- }, 1000);
496
 
 
 
 
 
497
  </script>
498
  </body>
499
  </html>
 
1
  <!DOCTYPE html>
2
+ <html lang="en">
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>FlowEdit | Review, Revise, Update</title>
7
+ <!-- Importing a nice font -->
8
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
9
+ <!-- Importing Icons -->
10
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
11
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  <style>
13
+ :root {
14
+ /* Color Palette - Modern & Clean */
15
+ --primary: #4F46E5;
16
+ --primary-hover: #4338ca;
17
+ --secondary: #ec4899;
18
+ --success: #10b981;
19
+ --warning: #f59e0b;
20
+ --danger: #ef4444;
21
+ --background: #f3f4f6;
22
+ --surface: #ffffff;
23
+ --text-main: #1f2937;
24
+ --text-muted: #6b7280;
25
+ --border: #e5e7eb;
26
+ --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
27
+ --radius: 12px;
28
+ --transition: all 0.3s ease;
29
+ }
30
+
31
+ /* Dark Mode Variables */
32
+ [data-theme="dark"] {
33
+ --background: #111827;
34
+ --surface: #1f2937;
35
+ --text-main: #f9fafb;
36
+ --text-muted: #9ca3af;
37
+ --border: #374151;
38
+ --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
39
+ }
40
+
41
+ * {
42
+ box-sizing: border-box;
43
+ margin: 0;
44
+ padding: 0;
45
+ }
46
+
47
  body {
48
+ font-family: 'Inter', sans-serif;
49
+ background-color: var(--background);
50
+ color: var(--text-main);
51
+ height: 100vh;
52
+ display: flex;
53
+ flex-direction: column;
54
+ transition: background-color 0.3s ease, color 0.3s ease;
55
+ overflow: hidden; /* App-like feel */
56
  }
57
+
58
+ /* --- Header --- */
59
+ header {
60
+ background-color: var(--surface);
61
+ border-bottom: 1px solid var(--border);
62
+ padding: 0.75rem 1.5rem;
63
+ display: flex;
64
+ justify-content: space-between;
65
+ align-items: center;
66
+ z-index: 10;
67
+ }
68
+
69
+ .logo {
70
+ font-weight: 700;
71
+ font-size: 1.25rem;
72
+ color: var(--primary);
73
+ display: flex;
74
+ align-items: center;
75
+ gap: 0.5rem;
76
+ }
77
+
78
+ .header-actions {
79
+ display: flex;
80
+ align-items: center;
81
+ gap: 1rem;
82
+ }
83
+
84
+ .anycoder-link {
85
+ font-size: 0.85rem;
86
+ color: var(--text-muted);
87
+ text-decoration: none;
88
+ transition: color 0.2s;
89
+ }
90
+ .anycoder-link:hover {
91
+ color: var(--primary);
92
+ }
93
+
94
+ .btn-icon {
95
+ background: none;
96
+ border: none;
97
+ color: var(--text-main);
98
+ font-size: 1.1rem;
99
+ cursor: pointer;
100
+ padding: 0.5rem;
101
+ border-radius: 50%;
102
+ transition: var(--transition);
103
+ }
104
+ .btn-icon:hover {
105
+ background-color: var(--background);
106
+ color: var(--primary);
107
+ }
108
+
109
+ /* --- Main Layout --- */
110
+ main {
111
+ display: flex;
112
+ flex: 1;
113
+ overflow: hidden;
114
+ }
115
+
116
+ /* --- Sidebar (History) --- */
117
+ aside {
118
+ width: 280px;
119
+ background-color: var(--surface);
120
+ border-right: 1px solid var(--border);
121
+ display: flex;
122
+ flex-direction: column;
123
+ transition: transform 0.3s ease;
124
+ }
125
+
126
+ .sidebar-header {
127
+ padding: 1rem;
128
+ border-bottom: 1px solid var(--border);
129
+ font-weight: 600;
130
+ color: var(--text-muted);
131
+ font-size: 0.85rem;
132
+ text-transform: uppercase;
133
+ letter-spacing: 0.05em;
134
+ display: flex;
135
+ justify-content: space-between;
136
+ align-items: center;
137
+ }
138
+
139
+ .history-list {
140
+ flex: 1;
141
+ overflow-y: auto;
142
+ padding: 0.5rem;
143
+ }
144
+
145
+ .history-item {
146
+ padding: 0.75rem;
147
+ margin-bottom: 0.5rem;
148
+ background-color: var(--background);
149
+ border-radius: 8px;
150
+ cursor: pointer;
151
+ transition: var(--transition);
152
+ border: 1px solid transparent;
153
+ }
154
+
155
+ .history-item:hover, .history-item.active {
156
+ border-color: var(--primary);
157
+ background-color: var(--surface);
158
+ box-shadow: var(--shadow);
159
+ }
160
+
161
+ .history-item h4 {
162
+ font-size: 0.9rem;
163
+ margin-bottom: 0.25rem;
164
+ color: var(--text-main);
165
+ }
166
+
167
+ .history-item p {
168
+ font-size: 0.75rem;
169
+ color: var(--text-muted);
170
+ white-space: nowrap;
171
+ overflow: hidden;
172
+ text-overflow: ellipsis;
173
  }
174
 
175
+ .status-badge {
176
+ display: inline-block;
177
+ font-size: 0.7rem;
178
+ padding: 2px 6px;
179
+ border-radius: 4px;
180
+ margin-top: 4px;
181
+ font-weight: 500;
182
+ }
183
+ .status-draft { background: #e5e7eb; color: #374151; }
184
+ .status-reviewed { background: #dbeafe; color: #1e40af; }
185
+ .status-updated { background: #d1fae5; color: #065f46; }
186
+
187
+ /* --- Workspace --- */
188
+ .workspace {
189
+ flex: 1;
190
+ display: flex;
191
+ flex-direction: column;
192
+ padding: 1.5rem;
193
+ gap: 1.5rem;
194
+ overflow-y: auto;
195
+ position: relative;
196
+ }
197
+
198
+ /* Workflow Steps Indicator */
199
+ .workflow-steps {
200
+ display: flex;
201
+ justify-content: center;
202
+ margin-bottom: 1rem;
203
+ }
204
+
205
+ .step {
206
+ display: flex;
207
+ align-items: center;
208
+ gap: 0.5rem;
209
+ color: var(--text-muted);
210
+ font-size: 0.9rem;
211
  position: relative;
212
  }
213
+
214
+ .step.active {
215
+ color: var(--primary);
216
+ font-weight: 600;
217
+ }
218
+
219
+ .step::after {
220
  content: '';
221
+ display: block;
222
+ width: 50px;
223
+ height: 2px;
224
+ background: var(--border);
225
+ margin-left: 0.5rem;
226
+ }
227
+ .step:last-child::after { display: none; }
228
+ .step.active::after { background: var(--primary); }
229
+
230
+ /* Editor Grid */
231
+ .editor-grid {
232
+ display: grid;
233
+ grid-template-columns: 1fr 1fr;
234
+ gap: 1.5rem;
235
+ flex: 1;
236
+ min-height: 0; /* Important for scroll */
237
+ }
238
+
239
+ .panel {
240
+ background-color: var(--surface);
241
+ border-radius: var(--radius);
242
+ border: 1px solid var(--border);
243
+ box-shadow: var(--shadow);
244
+ display: flex;
245
+ flex-direction: column;
246
+ overflow: hidden;
247
+ }
248
+
249
+ .panel-header {
250
+ padding: 1rem;
251
+ border-bottom: 1px solid var(--border);
252
+ display: flex;
253
+ justify-content: space-between;
254
+ align-items: center;
255
+ background: rgba(255,255,255,0.02);
256
+ }
257
+
258
+ .panel-title {
259
+ font-weight: 600;
260
+ display: flex;
261
+ align-items: center;
262
+ gap: 0.5rem;
263
+ }
264
+
265
+ .panel-tools button {
266
+ background: none;
267
+ border: 1px solid var(--border);
268
+ padding: 4px 8px;
269
+ border-radius: 6px;
270
+ cursor: pointer;
271
+ color: var(--text-muted);
272
+ font-size: 0.8rem;
273
+ transition: var(--transition);
274
+ }
275
+ .panel-tools button:hover {
276
+ border-color: var(--primary);
277
+ color: var(--primary);
278
+ }
279
+
280
+ .textarea-container {
281
+ flex: 1;
282
+ position: relative;
283
+ }
284
+
285
+ textarea {
286
+ width: 100%;
287
+ height: 100%;
288
+ border: none;
289
+ resize: none;
290
+ padding: 1rem;
291
+ font-family: 'Inter', monospace; /* Monospace for code/precise editing */
292
+ font-size: 0.95rem;
293
+ line-height: 1.6;
294
+ background-color: transparent;
295
+ color: var(--text-main);
296
+ outline: none;
297
+ }
298
+
299
+ /* Stats Bar */
300
+ .stats-bar {
301
+ padding: 0.5rem 1rem;
302
+ background-color: var(--background);
303
+ border-top: 1px solid var(--border);
304
+ font-size: 0.75rem;
305
+ color: var(--text-muted);
306
+ display: flex;
307
+ justify-content: space-between;
308
+ }
309
+
310
+ /* Action Bar */
311
+ .action-bar {
312
+ display: flex;
313
+ justify-content: flex-end;
314
+ gap: 1rem;
315
+ padding-top: 0.5rem;
316
+ }
317
+
318
+ .btn {
319
+ padding: 0.75rem 1.5rem;
320
+ border-radius: 8px;
321
+ border: none;
322
+ font-weight: 500;
323
+ cursor: pointer;
324
+ transition: var(--transition);
325
+ display: flex;
326
+ align-items: center;
327
+ gap: 0.5rem;
328
+ }
329
+
330
+ .btn-primary {
331
+ background-color: var(--primary);
332
+ color: white;
333
+ }
334
+ .btn-primary:hover {
335
+ background-color: var(--primary-hover);
336
+ transform: translateY(-1px);
337
+ }
338
+
339
+ .btn-secondary {
340
+ background-color: var(--surface);
341
+ border: 1px solid var(--border);
342
+ color: var(--text-main);
343
+ }
344
+ .btn-secondary:hover {
345
+ background-color: var(--background);
346
+ border-color: var(--text-muted);
347
+ }
348
+
349
+ .btn-success {
350
+ background-color: var(--success);
351
+ color: white;
352
+ }
353
+ .btn-success:hover {
354
+ background-color: #059669;
355
+ }
356
+
357
+ /* Loading Overlay */
358
+ .loading-overlay {
359
  position: absolute;
360
+ top: 0; left: 0; right: 0; bottom: 0;
361
+ background: rgba(255,255,255,0.8);
362
+ backdrop-filter: blur(2px);
363
+ display: flex;
364
+ flex-direction: column;
365
+ justify-content: center;
366
+ align-items: center;
367
+ z-index: 5;
368
+ opacity: 0;
369
  pointer-events: none;
370
+ transition: opacity 0.3s;
371
+ }
372
+ [data-theme="dark"] .loading-overlay {
373
+ background: rgba(31, 41, 55, 0.8);
374
+ }
375
+ .loading-overlay.active {
376
+ opacity: 1;
377
+ pointer-events: all;
378
  }
379
 
380
+ .spinner {
381
+ width: 40px;
382
+ height: 40px;
383
+ border: 4px solid var(--border);
384
+ border-top-color: var(--primary);
385
+ border-radius: 50%;
386
+ animation: spin 1s linear infinite;
387
  }
388
 
389
+ @keyframes spin { to { transform: rotate(360deg); } }
390
+
391
+ /* Toast Notifications */
392
+ .toast-container {
393
+ position: fixed;
394
+ bottom: 2rem;
395
+ right: 2rem;
396
+ display: flex;
397
+ flex-direction: column;
398
+ gap: 0.5rem;
399
+ z-index: 100;
400
+ }
401
 
402
+ .toast {
403
+ background-color: var(--surface);
404
+ color: var(--text-main);
405
+ padding: 1rem;
406
+ border-radius: 8px;
407
+ box-shadow: var(--shadow);
408
+ border-left: 4px solid var(--primary);
409
+ min-width: 300px;
410
+ display: flex;
411
+ align-items: center;
412
+ justify-content: space-between;
413
+ animation: slideIn 0.3s ease forwards;
414
  }
415
+
416
+ @keyframes slideIn {
417
+ from { transform: translateX(100%); opacity: 0; }
418
+ to { transform: translateX(0); opacity: 1; }
419
  }
420
 
421
+ /* Responsive Design */
422
+ @media (max-width: 900px) {
423
+ .editor-grid {
424
+ grid-template-columns: 1fr;
425
+ }
426
+ aside {
427
+ display: none; /* Hide sidebar on mobile for simplicity */
428
+ }
429
+ .workspace {
430
+ padding: 1rem;
431
+ }
432
  }
433
  </style>
434
  </head>
435
+ <body>
436
 
437
  <!-- Header -->
438
+ <header>
439
+ <div class="logo">
440
+ <i class="fa-solid fa-layer-group"></i> FlowEdit
441
+ </div>
442
+ <div class="header-actions">
443
+ <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="anycoder-link">
444
+ Built with anycoder <i class="fa-solid fa-arrow-up-right-from-square" style="font-size: 0.7em;"></i>
445
+ </a>
446
+ <button class="btn-icon" id="themeToggle" title="Toggle Theme">
447
+ <i class="fa-solid fa-moon"></i>
448
+ </button>
449
+ <button class="btn-icon" title="Settings">
450
+ <i class="fa-solid fa-gear"></i>
451
+ </button>
 
 
 
 
 
 
 
 
 
 
 
452
  </div>
453
  </header>
454
 
455
+ <!-- Main Content -->
456
+ <main>
457
+ <!-- Sidebar -->
458
+ <aside>
459
+ <div class="sidebar-header">
460
+ <span>History</span>
461
+ <button class="btn-icon" style="font-size: 0.8rem; padding: 2px;" onclick="clearHistory()">
462
+ <i class="fa-solid fa-trash"></i>
463
+ </button>
464
+ </div>
465
+ <div class="history-list" id="historyList">
466
+ <!-- Items injected by JS -->
467
+ <div style="padding: 1rem; text-align: center; color: var(--text-muted); font-size: 0.85rem;">
468
+ No history yet.
469
+ </div>
470
+ </div>
471
+ </aside>
472
 
473
+ <!-- Workspace -->
474
+ <section class="workspace">
475
 
476
+ <!-- Workflow Indicators -->
477
+ <div class="workflow-steps">
478
+ <div class="step active" id="step1">
479
+ <i class="fa-solid fa-pen-nib"></i> Input
 
480
  </div>
481
+ <div class="step" id="step2">
482
+ <i class="fa-solid fa-magnifying-glass-chart"></i> Review
483
+ </div>
484
+ <div class="step" id="step3">
485
+ <i class="fa-solid fa-rotate"></i> Update
 
 
 
 
 
 
 
 
 
 
 
 
 
 
486
  </div>
487
  </div>
488
 
489
+ <!-- Editors -->
490
+ <div class="editor-grid">
 
 
 
 
491
 
492
+ <!-- Source Panel -->
493
+ <div class="panel">
494
+ <div class="panel-header">
495
+ <div class="panel-title">
496
+ <i class="fa-regular fa-file-lines"></i> Original Content
497
  </div>
498
+ <div class="panel-tools">
499
+ <button onclick="pasteContent()" title="Paste from Clipboard"><i class="fa-solid fa-paste"></i></button>
500
+ <button onclick="clearContent('source')" title="Clear"><i class="fa-solid fa-eraser"></i></button>
501
  </div>
502
  </div>
503
+ <div class="textarea-container">
504
+ <textarea id="sourceText" placeholder="Paste your text or code here to begin the review process..."></textarea>
505
+ </div>
506
+ <div class="stats-bar">
507
+ <span id="sourceWords">0 words</span>
508
+ <span id="sourceChars">0 chars</span>
509
+ </div>
510
+ </div>
511
+
512
+ <!-- Revised Panel -->
513
+ <div class="panel">
514
+ <div class="panel-header">
515
+ <div class="panel-title">
516
+ <i class="fa-solid fa-wand-magic-sparkles"></i> Revised Version
517
  </div>
518
+ <div class="panel-tools">
519
+ <button onclick="copySourceToRevised()" title="Copy Source to Revised"><i class="fa-solid fa-arrow-right"></i></button>
520
+ <button onclick="clearContent('revised')" title="Clear"><i class="fa-solid fa-eraser"></i></button>
521
  </div>
522
  </div>
523
+ <div class="textarea-container">
524
+ <!-- Loading Overlay inside Revised panel -->
525
+ <div class="loading-overlay" id="loadingOverlay">
526
+ <div class="spinner"></div>
527
+ <p style="margin-top: 10px; font-weight: 500;">Analyzing text...</p>
 
 
 
528
  </div>
529
+ <textarea id="revisedText" placeholder="Review and edit the content here..."></textarea>
530
+ </div>
531
+ <div class="stats-bar">
532
+ <span id="revisedWords">0 words</span>
533
+ <span id="revisedChars">0 chars</span>
534
  </div>
535
  </div>
536
  </div>
537
 
538
+ <!-- Actions -->
539
+ <div class="action-bar">
540
+ <button class="btn btn-secondary" id="analyzeBtn" onclick="analyzeContent()">
541
+ <i class="fa-solid fa-magnifying-glass"></i> Analyze & Review
542
+ </button>
543
+ <button class="btn btn-primary" id="updateBtn" onclick="saveUpdate()" disabled>
544
+ <i class="fa-solid fa-floppy-disk"></i> Save Update
 
545
  </button>
546
  </div>
547
+
548
  </section>
549
+ </main>
550
 
551
+ <!-- Toast Container -->
552
+ <div class="toast-container" id="toastContainer"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
553
 
554
+ <script>
555
+ // --- State Management ---
556
+ const state = {
557
+ history: [],
558
+ currentId: null,
559
+ status: 'draft' // draft, reviewed, updated
560
+ };
 
 
 
 
 
 
561
 
562
+ // --- DOM Elements ---
563
+ const sourceText = document.getElementById('sourceText');
564
+ const revisedText = document.getElementById('revisedText');
565
+ const sourceWords = document.getElementById('sourceWords');
566
+ const sourceChars = document.getElementById('sourceChars');
567
+ const revisedWords = document.getElementById('revisedWords');
568
+ const revisedChars = document.getElementById('revisedChars');
569
+ const historyList = document.getElementById('historyList');
570
+ const loadingOverlay = document.getElementById('loadingOverlay');
571
+ const updateBtn = document.getElementById('updateBtn');
572
+ const analyzeBtn = document.getElementById('analyzeBtn');
573
+ const themeToggle = document.getElementById('themeToggle');
574
+
575
+ // --- Initialization ---
576
+ document.addEventListener('DOMContentLoaded', () => {
577
+ loadHistory();
578
+ setupEventListeners();
579
+ checkTheme();
580
+ });
581
+
582
+ function setupEventListeners() {
583
+ // Real-time stats update
584
+ sourceText.addEventListener('input', () => updateStats(sourceText, sourceWords, sourceChars));
585
+ revisedText.addEventListener('input', () => {
586
+ updateStats(revisedText, revisedWords, revisedChars);
587
+ // Enable update button if there is content
588
+ updateBtn.disabled = revisedText.value.trim().length === 0;
589
+ });
590
+
591
+ // Theme Toggle
592
+ themeToggle.addEventListener('click', toggleTheme);
593
+ }
594
 
595
+ // --- Core Functions ---
596
 
597
+ function updateStats(textarea, wordEl, charEl) {
598
+ const text = textarea.value;
599
+ charEl.innerText = `${text.length} chars`;
600
+ const words = text.trim() === '' ? 0 : text.trim().split(/\s+/).length;
601
+ wordEl.innerText = `${words} words`;
602
+ }
 
 
603
 
604
+ function copySourceToRevised() {
605
+ revisedText.value = sourceText.value;
606
+ updateStats(revisedText, revisedWords, revisedChars);
607
+ updateBtn.disabled = revisedText.value.trim().length === 0;
608
+ showToast('Content copied to revision panel', 'info');
609
+ }
 
 
 
 
 
 
 
 
610
 
611
+ function clearContent(type) {
612
+ if(type === 'source') {
613
+ sourceText.value = '';
614
+ updateStats(sourceText, sourceWords, sourceChars);
615
+ } else {
616
+ revisedText.value = '';
617
+ updateStats(revisedText, revisedWords, revisedChars);
618
+ updateBtn.disabled = true;
619
+ }
620
+ }
 
 
 
 
 
 
 
 
 
621
 
622
+ async function pasteContent() {
623
+ try {
624
+ const text = await navigator.clipboard.readText();
625
+ sourceText.value = text;
626
+ updateStats(sourceText, sourceWords, sourceChars);
627
+ showToast('Pasted from clipboard', 'success');
628
+ } catch (err) {
629
+ showToast('Failed to read clipboard', 'error');
630
+ }
631
+ }
 
 
 
 
 
 
 
 
 
 
632
 
633
+ // --- Workflow: Analyze (Simulated) ---
634
+ function analyzeContent() {
635
+ if (!sourceText.value.trim()) {
636
+ showToast('Please enter content to analyze first.', 'error');
637
+ return;
638
+ }
 
 
 
 
 
 
 
 
 
 
 
 
639
 
640
+ // UI Feedback
641
+ loadingOverlay.classList.add('active');
642
+ analyzeBtn.disabled = true;
643
 
644
+ // Simulate AI Analysis delay
645
+ setTimeout(() => {
646
+ loadingOverlay.classList.remove('active');
647
+ analyzeBtn.disabled = false;
648
+
649
+ // Move "Reviewed" content to revised area
650
+ // In a real app, this would be the result of an AI model
651
+ revisedText.value = sourceText.value;
652
+ updateStats(revisedText, revisedWords, revisedChars);
653
+ updateBtn.disabled = false;
654
+
655
+ // Update Workflow Steps UI
656
+ document.getElementById('step1').classList.remove('active');
657
+ document.getElementById('step2').classList.add('active');
658
+
659
+ showToast('Analysis complete. Content ready for revision.', 'success');
660
+ scrollToBottom();
661
+ }, 1500);
662
+ }
663
 
664
+ // --- Workflow: Save Update ---
665
+ function saveUpdate() {
666
+ if (!revisedText.value.trim()) return;
667
+
668
+ const newEntry = {
669
+ id: Date.now(),
670
+ date: new Date().toLocaleString(),
671
+ original: sourceText.value,
672
+ revised: revisedText.value,
673
+ status: 'Updated',
674
+ preview: revisedText.value.substring(0, 50) + '...'
675
+ };
676
+
677
+ state.history.unshift(newEntry);
678
+ localStorage.setItem('flowEditHistory', JSON.stringify(state.history));
679
+
680
+ renderHistory();
681
+
682
+ // Reset Workspace
683
+ sourceText.value = '';
684
+ revisedText.value = '';
685
+ updateStats(sourceText, sourceWords, sourceChars);
686
+ updateStats(revisedText, revisedWords, revisedChars);
687
+ updateBtn.disabled = true;
688
+
689
+ // Reset Workflow Steps
690
+ document.getElementById('step2').classList.remove('active');
691
+ document.getElementById('step3').classList.add('active');
692
+ setTimeout(() => {
693
+ document.getElementById('step3').classList.remove('active');
694
+ document.getElementById('step1').classList.add('active');
695
+ }, 2000);
696
 
697
+ showToast('Update saved successfully!', 'success');
698
+ }
699
 
700
+ // --- History Management ---
701
+ function loadHistory() {
702
+ const saved = localStorage.getItem('flowEditHistory');
703
+ if (saved) {
704
+ state.history = JSON.parse(saved);
705
+ renderHistory();
706
+ }
707
+ }
708
+
709
+ function renderHistory() {
710
+ historyList.innerHTML = '';
711
 
712
+ if (state.history.length === 0) {
713
+ historyList.innerHTML = '<div style="padding: 1rem; text-align: center; color: var(--text-muted); font-size: 0.85rem;">No history yet.</div>';
714
+ return;
715
+ }
716
+
717
+ state.history.forEach(item => {
718
+ const div = document.createElement('div');
719
+ div.className = 'history-item';
720
+ div.innerHTML = `
721
+ <h4>${item.date}</h4>
722
+ <p>${item.preview}</p>
723
+ <span class="status-badge status-updated">${item.status}</span>
724
+ `;
725
+ div.onclick = () => loadHistoryItem(item);
726
+ historyList.appendChild(div);
727
+ });
728
+ }
729
+
730
+ function loadHistoryItem(item) {
731
+ // Allow users to restore previous items to the editor
732
+ if(confirm('Load this item back into the editor?')) {
733
+ sourceText.value = item.original;
734
+ revisedText.value = item.revised;
735
+ updateStats(sourceText, sourceWords, sourceChars);
736
+ updateStats(revisedText, revisedWords, revisedChars);
737
+ updateBtn.disabled = false;
738
+ showToast('Item loaded', 'info');
739
+ }
740
  }
741
 
742
+ function clearHistory() {
743
+ if(confirm('Are you sure you want to clear all history?')) {
744
+ state.history = [];
745
+ localStorage.removeItem('flowEditHistory');
746
+ renderHistory();
747
+ showToast('History cleared', 'info');
748
+ }
749
+ }
750
 
751
+ // --- Utilities ---
752
+ function showToast(message, type = 'info') {
753
+ const toast = document.createElement('div');
754
+ toast.className = 'toast';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
755
 
756
+ let icon = 'fa-info-circle';
757
+ let color = 'var(--primary)';
758
+
759
+ if (type === 'success') { icon = 'fa-check-circle'; color = 'var(--success)'; }
760
+ if (type === 'error') { icon = 'fa-exclamation-circle'; color = 'var(--danger)'; }
761
+
762
+ toast.style.borderLeftColor = color;
763
+ toast.innerHTML = `
764
+ <div style="display:flex; align-items:center; gap:10px;">
765
+ <i class="fa-solid ${icon}" style="color:${color}"></i>
766
+ <span>${message}</span>
767
+ </div>
768
+ <i class="fa-solid fa-xmark" style="cursor:pointer; opacity:0.6;" onclick="this.parentElement.remove()"></i>
769
+ `;
770
+
771
+ document.getElementById('toastContainer').appendChild(toast);
772
+
773
+ // Auto remove
774
  setTimeout(() => {
775
+ toast.style.opacity = '0';
776
+ toast.style.transform = 'translateX(100%)';
777
+ setTimeout(() => toast.remove(), 300);
778
+ }, 3000);
779
+ }
780
+
781
+ function toggleTheme() {
782
+ const body = document.body;
783
+ const icon = themeToggle.querySelector('i');
784
+
785
+ if (body.getAttribute('data-theme') === 'dark') {
786
+ body.removeAttribute('data-theme');
787
+ icon.className = 'fa-solid fa-moon';
788
+ } else {
789
+ body.setAttribute('data-theme', 'dark');
790
+ icon.className = 'fa-solid fa-sun';
791
+ }
792
  }
793
 
794
+ function checkTheme() {
795
+ if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
796
+ toggleTheme();
797
+ }
798
+ }
 
 
 
 
799
 
800
+ function scrollToBottom() {
801
+ const textarea = document.querySelector('.editor-grid');
802
+ textarea.scrollIntoView({ behavior: 'smooth' });
803
+ }
804
  </script>
805
  </body>
806
  </html>