File size: 40,640 Bytes
6d04039
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Puter Automate - n8n-like Automation Platform</title>
    <script src="https://js.puter.com/v2/"></script>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#4f46e5',
                        secondary: '#818cf8',
                        dark: '#0f172a',
                        light: '#f8fafc'
                    }
                }
            }
        }
    </script>
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
        
        body {
            font-family: 'Inter', sans-serif;
            background-color: #f1f5f9;
            overflow-x: hidden;
        }
        
        .node {
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        }
        
        .node:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
        }
        
        .connector {
            position: absolute;
            background-color: #94a3b8;
            border-radius: 50%;
            cursor: pointer;
            z-index: 10;
        }
        
        .connector:hover {
            background-color: #4f46e5;
            transform: scale(1.2);
        }
        
        .connection-line {
            position: absolute;
            height: 2px;
            background-color: #94a3b8;
            transform-origin: 0 0;
            z-index: 1;
        }
        
        .workflow-canvas {
            min-height: 500px;
            background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
            background-size: 20px 20px;
        }
        
        .sidebar {
            transition: all 0.3s ease;
        }
        
        .sidebar.collapsed {
            width: 70px;
        }
        
        .sidebar.expanded {
            width: 280px;
        }
        
        .node-list-item {
            transition: all 0.2s ease;
        }
        
        .node-list-item:hover {
            background-color: #e2e8f0;
            transform: translateX(5px);
        }
        
        .pulse {
            animation: pulse 2s infinite;
        }
        
        @keyframes pulse {
            0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4); }
            70% { box-shadow: 0 0 0 10px rgba(79, 70, 229, 0); }
            100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
        }
        
        .workflow-item {
            transition: all 0.2s ease;
        }
        
        .workflow-item:hover {
            background-color: #e0e7ff;
        }
        
        .dragging {
            opacity: 0.7;
            transform: scale(0.95);
        }
    </style>
</head>
<body class="bg-slate-100 text-slate-800">
    <!-- Main App Container -->
    <div class="flex flex-col h-screen max-w-7xl mx-auto">
        <!-- Header -->
        <header class="bg-white shadow-sm py-4 px-6 flex items-center justify-between">
            <div class="flex items-center space-x-3">
                <div class="bg-indigo-600 text-white p-2 rounded-lg">
                    <i class="fas fa-robot text-xl"></i>
                </div>
                <h1 class="text-2xl font-bold text-slate-800">Puter<span class="text-indigo-600">Automate</span></h1>
            </div>
            
            <div class="flex items-center space-x-4">
                <button class="hidden md:flex items-center space-x-1 bg-indigo-100 hover:bg-indigo-200 text-indigo-700 px-4 py-2 rounded-lg transition">
                    <i class="fas fa-plus"></i>
                    <span>New Workflow</span>
                </button>
                <button class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg transition flex items-center">
                    <i class="fas fa-save mr-2"></i>
                    <span>Save</span>
                </button>
                <div class="w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center">
                    <i class="fas fa-user text-indigo-600"></i>
                </div>
            </div>
        </header>
        
        <!-- Main Content -->
        <div class="flex flex-1 overflow-hidden">
            <!-- Sidebar -->
            <div id="sidebar" class="sidebar expanded bg-white shadow-md flex flex-col">
                <div class="p-4 border-b">
                    <div class="flex justify-between items-center">
                        <h2 class="font-semibold text-lg">Workflows</h2>
                        <button id="toggle-sidebar" class="text-slate-500 hover:text-slate-700">
                            <i class="fas fa-chevron-left"></i>
                        </button>
                    </div>
                </div>
                
                <div class="p-4 border-b">
                    <div class="relative">
                        <input type="text" placeholder="Search workflows..." class="w-full pl-10 pr-4 py-2 rounded-lg border border-slate-300 focus:outline-none focus:ring-2 focus:ring-indigo-200">
                        <i class="fas fa-search absolute left-3 top-3 text-slate-400"></i>
                    </div>
                </div>
                
                <div class="overflow-y-auto flex-1">
                    <div class="p-4">
                        <div class="flex justify-between items-center mb-2">
                            <h3 class="text-sm font-semibold text-slate-500 uppercase tracking-wider">Recent</h3>
                            <button id="new-workflow-btn" class="text-xs bg-indigo-100 hover:bg-indigo-200 text-indigo-700 px-2 py-1 rounded">
                                <i class="fas fa-plus mr-1"></i>New
                            </button>
                        </div>
                        <div class="space-y-2">
                            <div class="workflow-item bg-indigo-50 border-l-4 border-indigo-500 p-3 rounded-r-lg">
                                <div class="flex justify-between">
                                    <span class="font-medium">Email Notification System</span>
                                    <span class="text-xs text-slate-500">Today</span>
                                </div>
                                <div class="flex items-center mt-2 text-xs text-slate-500">
                                    <i class="fas fa-circle text-green-500 mr-1"></i>
                                    <span>Active</span>
                                </div>
                            </div>
                            
                            <div class="workflow-item p-3 rounded-lg hover:bg-slate-50">
                                <div class="flex justify-between">
                                    <span class="font-medium">File Backup Automation</span>
                                    <span class="text-xs text-slate-500">Yesterday</span>
                                </div>
                                <div class="flex items-center mt-2 text-xs text-slate-500">
                                    <i class="fas fa-circle text-yellow-500 mr-1"></i>
                                    <span>Draft</span>
                                </div>
                            </div>
                            
                            <div class="workflow-item p-3 rounded-lg hover:bg-slate-50">
                                <div class="flex justify-between">
                                    <span class="font-medium">Social Media Poster</span>
                                    <span class="text-xs text-slate-500">May 12</span>
                                </div>
                                <div class="flex items-center mt-2 text-xs text-slate-500">
                                    <i class="fas fa-circle text-green-500 mr-1"></i>
                                    <span>Active</span>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="p-4 border-t">
                        <h3 class="text-sm font-semibold text-slate-500 uppercase tracking-wider mb-2">Node Library</h3>
                        <div class="space-y-2">
                            <div class="node-list-item p-3 rounded-lg cursor-move bg-white border border-slate-200 flex items-center" data-node-type="trigger">
                                <div class="w-8 h-8 rounded-full bg-indigo-100 flex items-center justify-center mr-3">
                                    <i class="fas fa-bolt text-indigo-600"></i>
                                </div>
                                <div>
                                    <div class="font-medium">Trigger</div>
                                    <div class="text-xs text-slate-500">Starts workflow execution</div>
                                </div>
                            </div>
                            <div class="node-list-item p-3 rounded-lg cursor-move bg-white border border-slate-200 flex items-center" data-node-type="action">
                                <div class="w-8 h-8 rounded-full bg-green-100 flex items-center justify-center mr-3">
                                    <i class="fas fa-cogs text-green-600"></i>
                                </div>
                                <div>
                                    <div class="font-medium">Action</div>
                                    <div class="text-xs text-slate-500">Performs an operation</div>
                                </div>
                            </div>
                            <div class="node-list-item p-3 rounded-lg cursor-move bg-white border border-slate-200 flex items-center" data-node-type="puter-file">
                                <div class="w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center mr-3">
                                    <i class="fas fa-file text-blue-600"></i>
                                </div>
                                <div>
                                    <div class="font-medium">Puter File</div>
                                    <div class="text-xs text-slate-500">File operations on Puter</div>
                                </div>
                            </div>
                            <div class="node-list-item p-3 rounded-lg cursor-move bg-white border border-slate-200 flex items-center" data-node-type="puter-ai">
                                <div class="w-8 h-8 rounded-full bg-purple-100 flex items-center justify-center mr-3">
                                    <i class="fas fa-robot text-purple-600"></i>
                                </div>
                                <div>
                                    <div class="font-medium">Puter AI</div>
                                    <div class="text-xs text-slate-500">AI capabilities via Puter</div>
                                </div>
                            </div>
                            <div class="node-list-item p-3 rounded-lg cursor-move bg-white border border-slate-200 flex items-center" data-node-type="email">
                                <div class="w-8 h-8 rounded-full bg-red-100 flex items-center justify-center mr-3">
                                    <i class="fas fa-envelope text-red-600"></i>
                                </div>
                                <div>
                                    <div class="font-medium">Email</div>
                                    <div class="text-xs text-slate-500">Send/receive emails</div>
                                </div>
                            </div>
                                </div>
                                <div>
                                    <div class="font-medium">Email Trigger</div>
                                    <div class="text-xs text-slate-500">Triggers on new emails</div>
                                </div>
                            </div>
                            
                            <div class="node-list-item p-3 rounded-lg cursor-move bg-white border border-slate-200 flex items-center">
                                <div class="w-8 h-8 rounded-full bg-green-100 flex items-center justify-center mr-3">
                                    <i class="fas fa-file-alt text-green-600"></i>
                                </div>
                                <div>
                                    <div class="font-medium">File Processor</div>
                                    <div class="text-xs text-slate-500">Processes files in directory</div>
                                </div>
                            </div>
                            
                            <div class="node-list-item p-3 rounded-lg cursor-move bg-white border border-slate-200 flex items-center">
                                <div class="w-8 h-8 rounded-full bg-purple-100 flex items-center justify-center mr-3">
                                    <i class="fas fa-database text-purple-600"></i>
                                </div>
                                <div>
                                    <div class="font-medium">Database Query</div>
                                    <div class="text-xs text-slate-500">Queries Puter database</div>
                                </div>
                            </div>
                            
                            <div class="node-list-item p-3 rounded-lg cursor-move bg-white border border-slate-200 flex items-center">
                                <div class="w-8 h-8 rounded-full bg-yellow-100 flex items-center justify-center mr-3">
                                    <i class="fas fa-bolt text-yellow-600"></i>
                                </div>
                                <div>
                                    <div class="font-medium">Webhook</div>
                                    <div class="text-xs text-slate-500">Receives HTTP requests</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- Main Workflow Area -->
            <div class="flex-1 flex flex-col overflow-hidden">
                <!-- Toolbar -->
                <div class="bg-white border-b py-3 px-4 flex items-center justify-between">
                    <div class="flex space-x-2">
                        <button class="p-2 rounded-lg hover:bg-slate-100">
                            <i class="fas fa-play text-green-600"></i>
                        </button>
                        <button class="p-2 rounded-lg hover:bg-slate-100">
                            <i class="fas fa-pause text-yellow-600"></i>
                        </button>
                        <button class="p-2 rounded-lg hover:bg-slate-100">
                            <i class="fas fa-stop text-red-600"></i>
                        </button>
                        <div class="border-l mx-2 h-6 self-center"></div>
                        <button class="p-2 rounded-lg hover:bg-slate-100">
                            <i class="fas fa-undo"></i>
                        </button>
                        <button class="p-2 rounded-lg hover:bg-slate-100">
                            <i class="fas fa-redo"></i>
                        </button>
                    </div>
                    
                    <div class="flex items-center space-x-4">
                        <div class="text-sm bg-slate-100 px-3 py-1 rounded-full">
                            <span class="text-slate-500">Status:</span>
                            <span class="text-green-600 font-medium ml-1">Active</span>
                        </div>
                        <button class="text-slate-500 hover:text-slate-700">
                            <i class="fas fa-cog"></i>
                        </button>
                    </div>
                </div>
                
                <!-- Canvas Area -->
                <div class="flex-1 overflow-auto relative workflow-canvas" id="canvas">
                    <!-- Connection lines will be drawn here -->
                    <div class="connection-line" style="width: 200px; transform: translate(200px, 150px) rotate(0deg);"></div>
                    <div class="connection-line" style="width: 150px; transform: translate(450px, 150px) rotate(0deg);"></div>
                    
                    <!-- Nodes -->
                    <div class="node absolute bg-white rounded-xl p-4 w-64" style="top: 100px; left: 150px;">
                        <div class="flex justify-between items-start">
                            <div class="flex items-center">
                                <div class="w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center mr-3">
                                    <i class="fas fa-envelope text-indigo-600"></i>
                                </div>
                                <div>
                                    <h3 class="font-bold">Email Trigger</h3>
                                    <p class="text-xs text-slate-500">When new email arrives</p>
                                </div>
                            </div>
                            <button class="text-slate-400 hover:text-slate-600">
                                <i class="fas fa-ellipsis-v"></i>
                            </button>
                        </div>
                        
                        <div class="mt-4">
                            <div class="text-xs text-slate-500 mb-1">Configuration</div>
                            <div class="bg-slate-50 p-2 rounded text-sm">
                                Folder: Inbox
                            </div>
                        </div>
                        
                        <!-- Connectors -->
                        <div class="connector" style="top: 50%; right: -10px;"></div>
                    </div>
                    
                    <div class="node absolute bg-white rounded-xl p-4 w-64" style="top: 100px; left: 450px;">
                        <div class="flex justify-between items-start">
                            <div class="flex items-center">
                                <div class="w-10 h-10 rounded-full bg-green-100 flex items-center justify-center mr-3">
                                    <i class="fas fa-file-alt text-green-600"></i>
                                </div>
                                <div>
                                    <h3 class="font-bold">File Processor</h3>
                                    <p class="text-xs text-slate-500">Process email attachments</p>
                                </div>
                            </div>
                            <button class="text-slate-400 hover:text-slate-600">
                                <i class="fas fa-ellipsis-v"></i>
                            </button>
                        </div>
                        
                        <div class="mt-4">
                            <div class="text-xs text-slate-500 mb-1">Actions</div>
                            <div class="bg-slate-50 p-2 rounded text-sm">
                                Save to: /documents/emails
                            </div>
                        </div>
                        
                        <!-- Connectors -->
                        <div class="connector" style="top: 50%; left: -10px;"></div>
                        <div class="connector" style="top: 50%; right: -10px;"></div>
                    </div>
                    
                    <div class="node absolute bg-white rounded-xl p-4 w-64" style="top: 100px; left: 750px;">
                        <div class="flex justify-between items-start">
                            <div class="flex items-center">
                                <div class="w-10 h-10 rounded-full bg-purple-100 flex items-center justify-center mr-3">
                                    <i class="fas fa-database text-purple-600"></i>
                                </div>
                                <div>
                                    <h3 class="font-bold">Database</h3>
                                    <p class="text-xs text-slate-500">Save processed data</p>
                                </div>
                            </div>
                            <button class="text-slate-400 hover:text-slate-600">
                                <i class="fas fa-ellipsis-v"></i>
                            </button>
                        </div>
                        
                        <div class="mt-4">
                            <div class="text-xs text-slate-500 mb-1">Configuration</div>
                            <div class="bg-slate-50 p-2 rounded text-sm">
                                Table: email_records
                            </div>
                        </div>
                        
                        <!-- Connectors -->
                        <div class="connector" style="top: 50%; left: -10px;"></div>
                    </div>
                    
                    <!-- Floating action button -->
                    <button class="absolute bottom-6 right-6 bg-indigo-600 text-white p-4 rounded-full shadow-lg hover:bg-indigo-700 transition pulse">
                        <i class="fas fa-plus text-xl"></i>
                    </button>
                    
                    <!-- Auth status indicator -->
                    <div id="auth-status" class="absolute top-4 right-4 bg-white rounded-lg shadow-md p-3 flex items-center">
                        <div id="auth-indicator" class="w-3 h-3 rounded-full bg-red-500 mr-2"></div>
                        <span id="auth-text" class="text-sm">Not authenticated</span>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- Status Bar -->
        <div class="bg-white border-t py-2 px-4 text-sm text-slate-500 flex justify-between">
            <div>
                <span id="workflow-name">Workflow: Email Processing</span>
                <span class="mx-2"></span>
                <span id="last-saved">Last saved: 2 minutes ago</span>
            </div>
            <div>
                <span>Puter API Status: <span id="puter-status" class="text-green-600">Checking...</span></span>
                <span class="mx-2"></span>
                <span>Powered by <a href="https://developer.puter.com" target="_blank" class="text-indigo-600 hover:underline">Puter</a></span>
            </div>
        </div>
    </div>

    <script>
        // Initialize Puter integration
        async function initPuter() {
            try {
                // Check if user is signed in
                const isSignedIn = await puter.auth.isSignedIn();
                updateAuthStatus(isSignedIn);
                
                if (!isSignedIn) {
                    // Try to sign in
                    await puter.auth.signIn();
                    updateAuthStatus(true);
                }
                
                // Update Puter status
                document.getElementById('puter-status').textContent = 'Connected';
                document.getElementById('puter-status').className = 'text-green-600';
                
                // Load workflows from Puter FS
                await loadWorkflows();
                
            } catch (error) {
                console.error('Puter initialization error:', error);
                document.getElementById('puter-status').textContent = 'Error';
                document.getElementById('puter-status').className = 'text-red-600';
            }
        }
        
        function updateAuthStatus(isSignedIn) {
            const indicator = document.getElementById('auth-indicator');
            const text = document.getElementById('auth-text');
            
            if (isSignedIn) {
                indicator.className = 'w-3 h-3 rounded-full bg-green-500 mr-2';
                text.textContent = 'Authenticated';
            } else {
                indicator.className = 'w-3 h-3 rounded-full bg-red-500 mr-2';
                text.textContent = 'Not authenticated';
            }
        }
        
        // Load workflows from Puter file system
        async function loadWorkflows() {
            try {
                // Create workflows directory if it doesn't exist
                try {
                    await puter.fs.mkdir('workflows');
                } catch (e) {
                    // Directory already exists
                }
                
                // Read workflows directory
                const workflows = await puter.fs.readdir('workflows');
                console.log('Workflows loaded:', workflows);
                
                // TODO: Update UI with loaded workflows
            } catch (error) {
                console.error('Error loading workflows:', error);
            }
        }
        
        // Save workflow to Puter file system
        async function saveWorkflow(workflowData) {
            try {
                const filename = `workflows/workflow-${Date.now()}.json`;
                await puter.fs.write(filename, JSON.stringify(workflowData, null, 2));
                console.log('Workflow saved:', filename);
                return true;
            } catch (error) {
                console.error('Error saving workflow:', error);
                return false;
            }
        }
        
        // Toggle sidebar
        document.getElementById('toggle-sidebar').addEventListener('click', function() {
            const sidebar = document.getElementById('sidebar');
            if (sidebar.classList.contains('expanded')) {
                sidebar.classList.remove('expanded');
                sidebar.classList.add('collapsed');
                this.innerHTML = '<i class="fas fa-chevron-right"></i>';
            } else {
                sidebar.classList.remove('collapsed');
                sidebar.classList.add('expanded');
                this.innerHTML = '<i class="fas fa-chevron-left"></i>';
            }
        });
        
        // New workflow button
        document.getElementById('new-workflow-btn').addEventListener('click', function() {
            // Clear canvas for new workflow
            const canvas = document.getElementById('canvas');
            canvas.innerHTML = `
                <!-- Connection lines will be drawn here -->
                <!-- Floating action button -->
                <button class="absolute bottom-6 right-6 bg-indigo-600 text-white p-4 rounded-full shadow-lg hover:bg-indigo-700 transition pulse">
                    <i class="fas fa-plus text-xl"></i>
                </button>
                
                <!-- Auth status indicator -->
                <div id="auth-status" class="absolute top-4 right-4 bg-white rounded-lg shadow-md p-3 flex items-center">
                    <div id="auth-indicator" class="w-3 h-3 rounded-full bg-red-500 mr-2"></div>
                    <span id="auth-text" class="text-sm">Not authenticated</span>
                </div>
            `;
            
            document.getElementById('workflow-name').textContent = 'Workflow: Untitled';
            document.getElementById('last-saved').textContent = 'Last saved: Never';
        });
        
        // Save button
        document.querySelector('button.bg-indigo-600').addEventListener('click', async function() {
            // Example workflow data
            const workflowData = {
                name: 'Email Processing',
                nodes: [],
                connections: [],
                createdAt: new Date().toISOString()
            };
            
            const saved = await saveWorkflow(workflowData);
            if (saved) {
                document.getElementById('last-saved').textContent = `Last saved: ${new Date().toLocaleTimeString()}`;
            }
        });
        
        // Drag and drop functionality for nodes
        document.querySelectorAll('.node-list-item').forEach(item => {
            item.addEventListener('dragstart', function(e) {
                e.dataTransfer.setData('text/plain', this.getAttribute('data-node-type'));
                this.classList.add('dragging');
            });
            
            item.addEventListener('dragend', function() {
                this.classList.remove('dragging');
            });
        });
        
        const canvas = document.getElementById('canvas');
        canvas.addEventListener('dragover', function(e) {
            e.preventDefault();
        });
        
        canvas.addEventListener('drop', function(e) {
            e.preventDefault();
            const nodeType = e.dataTransfer.getData('text/plain');
            
            // Create a new node at drop position
            const newNode = document.createElement('div');
            newNode.className = 'node absolute bg-white rounded-xl p-4 w-64';
            newNode.style.left = (e.clientX - 150) + 'px';
            newNode.style.top = (e.clientY - 100) + 'px';
            
            // Set node content based on type
            let nodeContent = '';
            let iconClass = '';
            let bgColor = '';
            
            switch(nodeType) {
                case 'trigger':
                    iconClass = 'fas fa-bolt';
                    bgColor = 'bg-indigo-100';
                    nodeContent = `
                        <div class="flex justify-between items-start">
                            <div class="flex items-center">
                                <div class="w-10 h-10 rounded-full ${bgColor} flex items-center justify-center mr-3">
                                    <i class="${iconClass} text-indigo-600"></i>
                                </div>
                                <div>
                                    <h3 class="font-bold">Trigger</h3>
                                    <p class="text-xs text-slate-500">Starts workflow</p>
                                </div>
                            </div>
                            <button class="text-slate-400 hover:text-slate-600">
                                <i class="fas fa-ellipsis-v"></i>
                            </button>
                        </div>
                        
                        <div class="mt-4">
                            <div class="text-xs text-slate-500 mb-1">Configuration</div>
                            <div class="bg-slate-50 p-2 rounded text-sm">
                                Configure trigger
                            </div>
                        </div>
                    `;
                    break;
                case 'action':
                    iconClass = 'fas fa-cogs';
                    bgColor = 'bg-green-100';
                    nodeContent = `
                        <div class="flex justify-between items-start">
                            <div class="flex items-center">
                                <div class="w-10 h-10 rounded-full ${bgColor} flex items-center justify-center mr-3">
                                    <i class="${iconClass} text-green-600"></i>
                                </div>
                                <div>
                                    <h3 class="font-bold">Action</h3>
                                    <p class="text-xs text-slate-500">Performs operation</p>
                                </div>
                            </div>
                            <button class="text-slate-400 hover:text-slate-600">
                                <i class="fas fa-ellipsis-v"></i>
                            </button>
                        </div>
                        
                        <div class="mt-4">
                            <div class="text-xs text-slate-500 mb-1">Configuration</div>
                            <div class="bg-slate-50 p-2 rounded text-sm">
                                Configure action
                            </div>
                        </div>
                    `;
                    break;
                case 'puter-file':
                    iconClass = 'fas fa-file';
                    bgColor = 'bg-blue-100';
                    nodeContent = `
                        <div class="flex justify-between items-start">
                            <div class="flex items-center">
                                <div class="w-10 h-10 rounded-full ${bgColor} flex items-center justify-center mr-3">
                                    <i class="${iconClass} text-blue-600"></i>
                                </div>
                                <div>
                                    <h3 class="font-bold">Puter File</h3>
                                    <p class="text-xs text-slate-500">File operations</p>
                                </div>
                            </div>
                            <button class="text-slate-400 hover:text-slate-600">
                                <i class="fas fa-ellipsis-v"></i>
                            </button>
                        </div>
                        
                        <div class="mt-4">
                            <div class="text-xs text-slate-500 mb-1">Configuration</div>
                            <div class="bg-slate-50 p-2 rounded text-sm">
                                Select file operation
                            </div>
                        </div>
                    `;
                    break;
                case 'puter-ai':
                    iconClass = 'fas fa-robot';
                    bgColor = 'bg-purple-100';
                    nodeContent = `
                        <div class="flex justify-between items-start">
                            <div class="flex items-center">
                                <div class="w-10 h-10 rounded-full ${bgColor} flex items-center justify-center mr-3">
                                    <i class="${iconClass} text-purple-600"></i>
                                </div>
                                <div>
                                    <h3 class="font-bold">Puter AI</h3>
                                    <p class="text-xs text-slate-500">AI capabilities</p>
                                </div>
                            </div>
                            <button class="text-slate-400 hover:text-slate-600">
                                <i class="fas fa-ellipsis-v"></i>
                            </button>
                        </div>
                        
                        <div class="mt-4">
                            <div class="text-xs text-slate-500 mb-1">Configuration</div>
                            <div class="bg-slate-50 p-2 rounded text-sm">
                                Configure AI model
                            </div>
                        </div>
                    `;
                    break;
                case 'email':
                    iconClass = 'fas fa-envelope';
                    bgColor = 'bg-red-100';
                    nodeContent = `
                        <div class="flex justify-between items-start">
                            <div class="flex items-center">
                                <div class="w-10 h-10 rounded-full ${bgColor} flex items-center justify-center mr-3">
                                    <i class="${iconClass} text-red-600"></i>
                                </div>
                                <div>
                                    <h3 class="font-bold">Email</h3>
                                    <p class="text-xs text-slate-500">Send/receive emails</p>
                                </div>
                            </div>
                            <button class="text-slate-400 hover:text-slate-600">
                                <i class="fas fa-ellipsis-v"></i>
                            </button>
                        </div>
                        
                        <div class="mt-4">
                            <div class="text-xs text-slate-500 mb-1">Configuration</div>
                            <div class="bg-slate-50 p-2 rounded text-sm">
                                Configure email settings
                            </div>
                        </div>
                    `;
                    break;
                default:
                    iconClass = 'fas fa-cog';
                    bgColor = 'bg-indigo-100';
                    nodeContent = `
                        <div class="flex justify-between items-start">
                            <div class="flex items-center">
                                <div class="w-10 h-10 rounded-full ${bgColor} flex items-center justify-center mr-3">
                                    <i class="${iconClass} text-indigo-600"></i>
                                </div>
                                <div>
                                    <h3 class="font-bold">New Node</h3>
                                    <p class="text-xs text-slate-500">Drag to configure</p>
                                </div>
                            </div>
                            <button class="text-slate-400 hover:text-slate-600">
                                <i class="fas fa-ellipsis-v"></i>
                            </button>
                        </div>
                        
                        <div class="mt-4">
                            <div class="text-xs text-slate-500 mb-1">Configuration</div>
                            <div class="bg-slate-50 p-2 rounded text-sm">
                                Click to configure
                            </div>
                        </div>
                    `;
            }
            
            // Add connectors
            nodeContent += `
                <!-- Connectors -->
                <div class="connector" style="top: 50%; left: -10px;"></div>
                <div class="connector" style="top: 50%; right: -10px;"></div>
            `;
            
            newNode.innerHTML = nodeContent;
            canvas.appendChild(newNode);
        });
        
        // Node interaction
        document.addEventListener('click', function(e) {
            // Check if clicked element is a node
            if (e.target.closest('.node')) {
                const node = e.target.closest('.node');
                
                // Remove active class from all nodes
                document.querySelectorAll('.node').forEach(n => {
                    n.classList.remove('ring-2', 'ring-indigo-500');
                });
                
                // Add active class to clicked node
                node.classList.add('ring-2', 'ring-indigo-500');
            }
        });
        
        // Workflow item interaction
        document.querySelectorAll('.workflow-item').forEach(item => {
            item.addEventListener('click', function() {
                document.querySelectorAll('.workflow-item').forEach(i => {
                    i.classList.remove('bg-indigo-50', 'border-l-4', 'border-indigo-500');
                });
                
                this.classList.add('bg-indigo-50', 'border-l-4', 'border-indigo-500');
            });
        });
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Jayreddin/jjj" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>