File size: 38,356 Bytes
f9fa6a6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI Image Prompt Generator</title>
    <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">
    <style>
        .flavor-tag {
            transition: all 0.2s ease;
        }
        .flavor-tag:hover {
            transform: scale(1.05);
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        }
        .flavor-tag.selected {
            background-color: #4f46e5;
            color: white;
        }
        .prompt-history-item {
            transition: all 0.2s ease;
        }
        .prompt-history-item:hover {
            background-color: #f3f4f6;
        }
        .nsfw-field {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease-out;
        }
        .nsfw-field.visible {
            max-height: 200px;
        }
        .autocomplete-items {
            position: absolute;
            border: 1px solid #d4d4d4;
            border-bottom: none;
            border-top: none;
            z-index: 99;
            top: 100%;
            left: 0;
            right: 0;
            background-color: white;
            max-height: 200px;
            overflow-y: auto;
        }
        .autocomplete-items div {
            padding: 10px;
            cursor: pointer;
            background-color: #fff;
            border-bottom: 1px solid #d4d4d4;
        }
        .autocomplete-items div:hover {
            background-color: #e9e9e9;
        }
        .autocomplete-active {
            background-color: #4f46e5 !important;
            color: #ffffff;
        }
    </style>
</head>
<body class="bg-gray-100 min-h-screen">
    <div class="container mx-auto px-4 py-8">
        <div class="max-w-6xl mx-auto">
            <h1 class="text-4xl font-bold text-center text-indigo-800 mb-2">AI Image Prompt Generator</h1>
            <p class="text-center text-gray-600 mb-8">Create detailed prompts for AI image generation</p>
            
            <div class="bg-white rounded-xl shadow-lg p-6 mb-8">
                <!-- Theme Presets -->
                <div class="mb-8">
                    <h2 class="text-xl font-semibold mb-4 text-gray-800">Theme Presets</h2>
                    <div class="flex flex-wrap gap-3">
                        <button onclick="applyTheme('rockstar')" class="px-4 py-2 bg-black text-white rounded-full hover:bg-gray-800 transition flex items-center gap-2">
                            <i class="fas fa-guitar"></i> Rockstar
                        </button>
                        <button onclick="applyTheme('vintage')" class="px-4 py-2 bg-amber-600 text-white rounded-full hover:bg-amber-700 transition flex items-center gap-2">
                            <i class="fas fa-camera-retro"></i> Vintage
                        </button>
                        <button onclick="applyTheme('fun')" class="px-4 py-2 bg-pink-500 text-white rounded-full hover:bg-pink-600 transition flex items-center gap-2">
                            <i class="fas fa-laugh-squint"></i> Fun
                        </button>
                        <button onclick="applyTheme('erotic')" class="px-4 py-2 bg-red-500 text-white rounded-full hover:bg-red-600 transition flex items-center gap-2">
                            <i class="fas fa-heart"></i> Erotic
                        </button>
                        <button onclick="applyTheme('surreal')" class="px-4 py-2 bg-purple-500 text-white rounded-full hover:bg-purple-600 transition flex items-center gap-2">
                            <i class="fas fa-moon"></i> Surreal
                        </button>
                    </div>
                </div>
                
                <!-- Main Form -->
                <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
                    <div class="autocomplete">
                        <label class="block text-gray-700 mb-2">Main Subject</label>
                        <input type="text" id="mainSubject" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500" placeholder="e.g., McKayla Maroney and Emma Watson" autocomplete="off">
                    </div>
                    <div>
                        <label class="block text-gray-700 mb-2">Style and Appearance</label>
                        <input type="text" id="styleAppearance" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500" placeholder="e.g., watercolor, surreal twist">
                    </div>
                    <div>
                        <label class="block text-gray-700 mb-2">Character Description</label>
                        <input type="text" id="characterDesc" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500" placeholder="e.g., as an interdimensional traveler, body made of stars">
                    </div>
                    <div>
                        <label class="block text-gray-700 mb-2">Scene Details</label>
                        <input type="text" id="sceneDetails" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500" placeholder="e.g., ancient temple ruins, golden hour lighting">
                    </div>
                    <div>
                        <label class="block text-gray-700 mb-2">Technical Settings</label>
                        <input type="text" id="techSettings" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500" placeholder="e.g., --ar 3:2 --ISO 800 --aperture f/2.2">
                    </div>
                    <div>
                        <label class="block text-gray-700 mb-2">Artist / Photographer</label>
                        <input type="text" id="artistPhotog" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500" placeholder="e.g., Greg Rutkowski, Artgerm">
                    </div>
                </div>
                
                <!-- NSFW Toggle -->
                <div class="mb-6">
                    <label class="inline-flex items-center cursor-pointer">
                        <input type="checkbox" id="nsfwToggle" class="sr-only peer" onclick="toggleNsfwField()">
                        <div class="relative w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-red-500"></div>
                        <span class="ms-3 text-sm font-medium text-gray-700">NSFW Content</span>
                    </label>
                    <div id="nsfwField" class="nsfw-field mt-3">
                        <label class="block text-gray-700 mb-2">NSFW Details</label>
                        <input type="text" id="nsfwDetails" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500" placeholder="e.g., ((stockings and garters:1.4)), ((strategic shadows:1.3))">
                    </div>
                </div>
                
                <!-- Flavor Tags -->
                <div class="mb-8">
                    <h2 class="text-xl font-semibold mb-4 text-gray-800">Flavor Tags</h2>
                    <div class="flex flex-wrap gap-2">
                        <span onclick="toggleTag(this)" class="flavor-tag px-3 py-1 bg-gray-200 rounded-full text-sm cursor-pointer">voluptuous curves</span>
                        <span onclick="toggleTag(this)" class="flavor-tag px-3 py-1 bg-gray-200 rounded-full text-sm cursor-pointer">cosmic energy</span>
                        <span onclick="toggleTag(this)" class="flavor-tag px-3 py-1 bg-gray-200 rounded-full text-sm cursor-pointer">dreamlike quality</span>
                        <span onclick="toggleTag(this)" class="flavor-tag px-3 py-1 bg-gray-200 rounded-full text-sm cursor-pointer">otherworldly beauty</span>
                        <span onclick="toggleTag(this)" class="flavor-tag px-3 py-1 bg-gray-200 rounded-full text-sm cursor-pointer">golden hoop earrings</span>
                        <span onclick="toggleTag(this)" class="flavor-tag px-3 py-1 bg-gray-200 rounded-full text-sm cursor-pointer">salt-weathered skin</span>
                        <span onclick="toggleTag(this)" class="flavor-tag px-3 py-1 bg-gray-200 rounded-full text-sm cursor-pointer">vines creeping</span>
                        <span onclick="toggleTag(this)" class="flavor-tag px-3 py-1 bg-gray-200 rounded-full text-sm cursor-pointer">ethereal glow</span>
                        <span onclick="toggleTag(this)" class="flavor-tag px-3 py-1 bg-gray-200 rounded-full text-sm cursor-pointer">dynamic pose</span>
                        <span onclick="toggleTag(this)" class="flavor-tag px-3 py-1 bg-gray-200 rounded-full text-sm cursor-pointer">cinematic lighting</span>
                    </div>
                </div>
                
                <!-- Action Buttons -->
                <div class="flex flex-wrap gap-4 justify-center mb-6">
                    <button onclick="generatePrompt()" class="px-6 py-3 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition flex items-center gap-2">
                        <i class="fas fa-magic"></i> Generate Prompt
                    </button>
                    <button onclick="surpriseMe()" class="px-6 py-3 bg-green-600 text-white rounded-lg hover:bg-green-700 transition flex items-center gap-2">
                        <i class="fas fa-surprise"></i> Surprise Me!
                    </button>
                    <button onclick="copyToClipboard()" class="px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition flex items-center gap-2">
                        <i class="fas fa-copy"></i> Copy Prompt
                    </button>
                    <button onclick="clearForm()" class="px-6 py-3 bg-gray-600 text-white rounded-lg hover:bg-gray-700 transition flex items-center gap-2">
                        <i class="fas fa-broom"></i> Clear All
                    </button>
                </div>
                
                <!-- Generated Prompt -->
                <div class="mb-8">
                    <h2 class="text-xl font-semibold mb-4 text-gray-800">Generated Prompt</h2>
                    <div id="generatedPrompt" class="bg-gray-50 p-4 rounded-lg border border-gray-200 min-h-24 whitespace-pre-wrap"></div>
                </div>
            </div>
            
            <!-- Prompt History -->
            <div class="bg-white rounded-xl shadow-lg p-6">
                <h2 class="text-xl font-semibold mb-4 text-gray-800">Prompt History (Last 5)</h2>
                <div id="promptHistory" class="space-y-3">
                    <!-- History items will be added here -->
                </div>
            </div>
        </div>
    </div>

    <script>
        // Store the last 5 generated prompts
        let promptHistory = [];
        let selectedTags = [];
        
        // Celebrity names for autocomplete
        const celebrityNames = [
            "Cherie Currie", "Candice Night", "Aimee Ann Duffy", "Agnetha Fältskog", "Lita Ford", 
            "Nina Gordon", "Sass Jordan", "Jan Kuehnemund", "Avril Lavigne", "Taylor Momsen", 
            "Stevie Nicks", "Emily Osment", "Orianthi Panagaris", "Doro Pesch", "Liz Phair", 
            "Michelle Phillips", "Suzi Quatro", "Otep Shamaya", "Gwen Stefani", "Joss Stone", 
            "Bonnie Tyler", "Gen Vincent", "Sandy West", "Torry Castellano", "Nancy Wilson", 
            "Mrs. Butterworth", "Aimee Lou Wood", "Angie Everhart", "Alexandra Daddario", 
            "Anna Kendrick", "Amber Heard", "April Bowlby", "Alice Eve", "Angelina Jolie", 
            "Alyson Hannigan", "Amy Adams", "Amanda Bynes", "Amy Smart", "Alison Brie", 
            "Ali Larter", "Anna Friel", "Andie MacDowell", "Anya Taylor-Joy", "Amanda Seyfried", 
            "Alexis Bledel", "Amanda Peet", "Bryce Dallas Howard", "Brittany Murphy", 
            "Brie Larson", "Bella Thorne", "Brooke Shields", "Betty Gilpin", "Barbara Palvin", 
            "Barbara Hershey", "Britt Ekland", "Barbi Benton", "Blake Lively", "Courteney Cox", 
            "Candice Cameron", "Chloë Grace Moretz", "Carmen Electra", "Cara Delevingne", 
            "Cameron Diaz", "Christina Applegate", "Cindy Crawford", "Dana Plato", 
            "Drew Barrymore", "Danielle Fishel", "Dakota Fanning", "Dakota Johnson", 
            "Demi Moore", "Elizabeth Banks", "Elisha Cuthbert", "Emma Watson", 
            "Evan Rachel Wood", "Elle Macpherson", "Elaine Irwin", "Elizabeth Berkley", 
            "Elizabeth Shue", "Emmy Rossum", "Emilia Clarke", "Emma Roberts", "Emma Stone", 
            "Elle Fanning", "Elizabeth Montgomery", "Gwen Stefani", "Gillian Anderson", 
            "Geena Davis", "Grace Phipps", "Giorga Whigham", "Gillian Jacobs", "Gal Gadot", 
            "Hailee Steinfeld", "Heather Thomas", "Helena Mattsson", "Halle Berry", 
            "Heather Locklear", "Isla Fisher", "Jennifer Aniston", "Justine Bateman", 
            "Jenna Fischer", "Jodi Foster", "Jenna Elfman", "Jessica Chastain", 
            "Jennifer Morrison", "Jenna Coleman", "Julia Roberts", "Jennifer Connelly", 
            "Julie Andrews", "Juliette Lewis", "Jennifer Tilly", "Julia Louis-Dreyfus", 
            "Jennifer Lawrence", "Janet Jackson", "Jessica Alba", "Jaime Pressly", 
            "Jessica Simpson", "Julia Stiles", "Keira Knightley", "Kate Mara", 
            "Katey Sagal", "Kate Upton", "Kathy Ireland", "Kaya Scodelario", 
            "Kirsten Dunst", "Kat Dennings", "Kristen Stewart", "Kate Beckinsale", 
            "Kaley Cuoco", "Kelly Lebrock", "Katheryn Winnick", "Katie Holmes", 
            "Kirstie Alley", "Leanna Decker", "Lisa Allison", "Lucy Lawless", 
            "Leelee Sobieski", "Lucy Hale", "Lori Loughlin", "Lake Bell", "Liv Tyler", 
            "Lindsay Lohan", "Lily Aldridge", "Lily Collins", "Lea Thompson", 
            "Leah Remini", "Michelle Mylett", "Margot Robbie", "Mischa Barton", 
            "Melanie Lynskey", "Milly Alcock", "Minka Kelly", "Melissa Fumero", 
            "Michelle Pfeiffer", "Mila Kunis", "Mia Sara", "Milla Jovovich", 
            "Markie Post", "Megyn Kelly", "Michelle Monaghan", "Mary Elizabeth Ellis", 
            "Marisa Tomei", "McKayla Maroney", "Natalie Zea", "Natalie Dormer", 
            "Natalia Dyer", "Nicole Kidman", "Nathalie Emmanuel", "Natalie Portman", 
            "Pamela Anderson", "Patricia Heaton", "Rachel McAdams", "Rashida Jones", 
            "Robin Givens", "Reese Witherspoon", "Sofia Vergara", "Stephanie Beatriz", 
            "Sharon Stone", "Sydney Sweeney", "Shakira", "Sheryl Crow", 
            "Sandra Bullock", "Scarlett Johansson", "Taylor Swift", 
            "Tiffani Amber Thiessen", "Wendy O Williams", "Winona Ryder", 
            "Holly Madison", "Bridget Marquardt", "Kendra Wilkinson", 
            "Kristina Shannon", "Karissa Shannon", "Abella Danger", 
            "Nicole Aniston", "Mia Malkova", "Riley Reid", "Mia Khalifa", 
            "Lena Anderson", "Lena Paul", "Heather Harmon"
        ];

        // Initialize autocomplete
        function autocomplete(inp, arr) {
            let currentFocus;
            
            inp.addEventListener("input", function(e) {
                let val = this.value;
                closeAllLists();
                if (!val) { return false; }
                currentFocus = -1;
                
                const list = document.createElement("DIV");
                list.setAttribute("id", this.id + "autocomplete-list");
                list.setAttribute("class", "autocomplete-items");
                this.parentNode.appendChild(list);
                
                for (let i = 0; i < arr.length; i++) {
                    if (arr[i].toUpperCase().includes(val.toUpperCase())) {
                        const item = document.createElement("DIV");
                        item.innerHTML = "<strong>" + arr[i].substr(0, val.length) + "</strong>";
                        item.innerHTML += arr[i].substr(val.length);
                        item.innerHTML += "<input type='hidden' value='" + arr[i] + "'>";
                        
                        item.addEventListener("click", function(e) {
                            inp.value = this.getElementsByTagName("input")[0].value;
                            closeAllLists();
                        });
                        list.appendChild(item);
                    }
                }
            });
            
            inp.addEventListener("keydown", function(e) {
                let x = document.getElementById(this.id + "autocomplete-list");
                if (x) x = x.getElementsByTagName("div");
                if (e.keyCode == 40) { // Down
                    currentFocus++;
                    addActive(x);
                } else if (e.keyCode == 38) { // Up
                    currentFocus--;
                    addActive(x);
                } else if (e.keyCode == 13) { // Enter
                    e.preventDefault();
                    if (currentFocus > -1) {
                        if (x) x[currentFocus].click();
                    }
                }
            });
            
            function addActive(x) {
                if (!x) return false;
                removeActive(x);
                if (currentFocus >= x.length) currentFocus = 0;
                if (currentFocus < 0) currentFocus = (x.length - 1);
                x[currentFocus].classList.add("autocomplete-active");
            }
            
            function removeActive(x) {
                for (let i = 0; i < x.length; i++) {
                    x[i].classList.remove("autocomplete-active");
                }
            }
            
            function closeAllLists(elmnt) {
                const x = document.getElementsByClassName("autocomplete-items");
                for (let i = 0; i < x.length; i++) {
                    if (elmnt != x[i] && elmnt != inp) {
                        x[i].parentNode.removeChild(x[i]);
                    }
                }
            }
            
            document.addEventListener("click", function(e) {
                closeAllLists(e.target);
            });
        }
        
        // Initialize autocomplete on mainSubject input
        document.addEventListener("DOMContentLoaded", function() {
            autocomplete(document.getElementById("mainSubject"), celebrityNames);
        });
        
        // Toggle NSFW field visibility
        function toggleNsfwField() {
            const nsfwField = document.getElementById('nsfwField');
            nsfwField.classList.toggle('visible');
            if (nsfwField.classList.contains('visible')) {
                nsfwField.style.maxHeight = nsfwField.scrollHeight + 'px';
            } else {
                nsfwField.style.maxHeight = '0';
            }
        }
        
        // Toggle flavor tag selection
        function toggleTag(element) {
            element.classList.toggle('selected');
            const tagText = element.textContent.trim();
            
            if (element.classList.contains('selected')) {
                if (!selectedTags.includes(tagText)) {
                    selectedTags.push(tagText);
                }
            } else {
                selectedTags = selectedTags.filter(tag => tag !== tagText);
            }
        }
        
        // Generate the final prompt
        function generatePrompt() {
            const mainSubject = document.getElementById('mainSubject').value;
            const styleAppearance = document.getElementById('styleAppearance').value;
            const characterDesc = document.getElementById('characterDesc').value;
            const sceneDetails = document.getElementById('sceneDetails').value;
            const techSettings = document.getElementById('techSettings').value;
            const artistPhotog = document.getElementById('artistPhotog').value;
            const nsfwDetails = document.getElementById('nsfwToggle').checked ? document.getElementById('nsfwDetails').value : '';
            
            // Build the prompt parts
            let promptParts = [
                "score_9, score_8_up, score_7_up",
                `"${mainSubject}"`,
                styleAppearance,
                characterDesc,
                ...selectedTags,
                sceneDetails
            ];
            
            // Add NSFW details if enabled
            if (nsfwDetails) {
                promptParts.push(nsfwDetails);
            }
            
            // Add artist and technical settings
            if (artistPhotog) {
                promptParts.push(artistPhotog);
            }
            if (techSettings) {
                promptParts.push(techSettings);
            }
            
            // Filter out empty parts and join with commas
            const fullPrompt = promptParts.filter(part => part.trim() !== '').join(', ');
            
            // Display the generated prompt
            document.getElementById('generatedPrompt').textContent = fullPrompt;
            
            // Add to history
            addToHistory(fullPrompt);
        }
        
        // Add prompt to history (max 5 items)
        function addToHistory(prompt) {
            promptHistory.unshift(prompt);
            if (promptHistory.length > 5) {
                promptHistory.pop();
            }
            
            // Update history display
            const historyContainer = document.getElementById('promptHistory');
            historyContainer.innerHTML = '';
            
            promptHistory.forEach((item, index) => {
                const historyItem = document.createElement('div');
                historyItem.className = 'prompt-history-item bg-gray-50 p-3 rounded-lg border border-gray-200 cursor-pointer hover:shadow-sm';
                historyItem.innerHTML = `
                    <div class="flex justify-between items-start">
                        <div class="text-sm text-gray-600">#${index + 1}</div>
                        <button onclick="copyHistoryItem(${index})" class="text-gray-400 hover:text-indigo-600">
                            <i class="fas fa-copy"></i>
                        </button>
                    </div>
                    <div class="text-gray-800 mt-1 text-sm whitespace-pre-wrap">${item}</div>
                `;
                historyItem.onclick = () => {
                    document.getElementById('generatedPrompt').textContent = item;
                };
                historyContainer.appendChild(historyItem);
            });
        }
        
        // Copy history item to main prompt
        function copyHistoryItem(index) {
            event.stopPropagation();
            document.getElementById('generatedPrompt').textContent = promptHistory[index];
        }
        
        // Copy generated prompt to clipboard
        function copyToClipboard() {
            const prompt = document.getElementById('generatedPrompt').textContent;
            if (prompt.trim()) {
                navigator.clipboard.writeText(prompt).then(() => {
                    alert('Prompt copied to clipboard!');
                });
            } else {
                alert('No prompt to copy!');
            }
        }
        
        // Clear all form fields
        function clearForm() {
            document.getElementById('mainSubject').value = '';
            document.getElementById('styleAppearance').value = '';
            document.getElementById('characterDesc').value = '';
            document.getElementById('sceneDetails').value = '';
            document.getElementById('techSettings').value = '';
            document.getElementById('artistPhotog').value = '';
            document.getElementById('nsfwDetails').value = '';
            document.getElementById('nsfwToggle').checked = false;
            toggleNsfwField();
            
            // Clear selected tags
            selectedTags = [];
            document.querySelectorAll('.flavor-tag').forEach(tag => {
                tag.classList.remove('selected');
            });
            
            document.getElementById('generatedPrompt').textContent = '';
        }
        
        // Apply theme presets
        function applyTheme(theme) {
            const isNsfw = document.getElementById('nsfwToggle').checked;
            
            const themes = {
                rockstar: {
                    mainSubject: "Lead singer of a rock band",
                    styleAppearance: "high contrast, dramatic lighting, leather jacket",
                    characterDesc: "wild hair, intense gaze, microphone in hand",
                    sceneDetails: "concert stage, smoke machines, laser lights",
                    techSettings: "--ar 16:9 --ISO 1600 --aperture f/1.8",
                    artistPhotog: "Annie Leibovitz, Mick Rock",
                    nsfwDetails: isNsfw ? "((sweaty skin:1.2)), ((ripped shirt:1.3))" : ""
                },
                vintage: {
                    mainSubject: "1950s couple",
                    styleAppearance: "Kodachrome film, faded colors, grainy texture",
                    characterDesc: "retro fashion, classic hairstyles, nostalgic expression",
                    sceneDetails: "diner booth, jukebox in background, neon sign",
                    techSettings: "--ar 4:3 --v 5",
                    artistPhotog: "Saul Leiter, Vivian Maier",
                    nsfwDetails: isNsfw ? "((rolled up sleeves:1.1)), ((lipstick mark on cheek:1.2))" : ""
                },
                fun: {
                    mainSubject: "Group of friends at a carnival",
                    styleAppearance: "bright colors, pop art style, comic book aesthetic",
                    characterDesc: "laughing, cotton candy, oversized sunglasses",
                    sceneDetails: "ferris wheel in background, balloon animals, confetti",
                    techSettings: "--ar 1:1 --q 2",
                    artistPhotog: "Takashi Murakami, Yayoi Kusama",
                    nsfwDetails: isNsfw ? "((silly faces:1.1)), ((food fight:1.3))" : ""
                },
                erotic: {
                    mainSubject: "Seductive figure in lingerie",
                    styleAppearance: "soft focus, chiaroscuro lighting, sensual",
                    characterDesc: "alluring gaze, elegant pose, flawless skin",
                    sceneDetails: "luxury bedroom, silk sheets, candlelight",
                    techSettings: "--ar 9:16 --style 4b",
                    artistPhotog: "Helmut Newton, Ellen von Unwerth",
                    nsfwDetails: isNsfw ? "((strategic shadows:1.4)), ((pearl necklace:1.3)), ((stockings:1.5))" : ""
                },
                surreal: {
                    mainSubject: "Floating figure in space",
                    styleAppearance: "dreamlike, impossible perspective, vibrant colors",
                    characterDesc: "body made of constellations, third eye, elongated limbs",
                    sceneDetails: "surreal landscape, floating islands, giant clock",
                    techSettings: "--ar 3:2 --chaos 20",
                    artistPhotog: "Salvador Dalí, René Magritte",
                    nsfwDetails: isNsfw ? "((translucent skin:1.2)), ((cosmic energy flowing:1.4))" : ""
                }
            };
            
            const selectedTheme = themes[theme];
            
            document.getElementById('mainSubject').value = selectedTheme.mainSubject;
            document.getElementById('styleAppearance').value = selectedTheme.styleAppearance;
            document.getElementById('characterDesc').value = selectedTheme.characterDesc;
            document.getElementById('sceneDetails').value = selectedTheme.sceneDetails;
            document.getElementById('techSettings').value = selectedTheme.techSettings;
            document.getElementById('artistPhotog').value = selectedTheme.artistPhotog;
            
            if (isNsfw) {
                document.getElementById('nsfwDetails').value = selectedTheme.nsfwDetails;
            }
            
            // Update flavor tags based on theme
            selectedTags = [];
            document.querySelectorAll('.flavor-tag').forEach(tag => {
                tag.classList.remove('selected');
            });
            
            // Add some theme-appropriate flavor tags
            const themeTags = {
                rockstar: ["voluptuous curves", "dynamic pose", "golden hoop earrings"],
                vintage: ["salt-weathered skin", "ethereal glow", "vines creeping"],
                fun: ["dreamlike quality", "cinematic lighting"],
                erotic: ["voluptuous curves", "golden hoop earrings"],
                surreal: ["cosmic energy", "otherworldly beauty", "dreamlike quality"]
            };
            
            themeTags[theme].forEach(tagText => {
                const tags = document.querySelectorAll('.flavor-tag');
                for (let tag of tags) {
                    if (tag.textContent.trim() === tagText) {
                        tag.classList.add('selected');
                        selectedTags.push(tagText);
                        break;
                    }
                }
            });
        }
        
        // Surprise me! - Randomly fill all fields
        function surpriseMe() {
            const isNsfw = document.getElementById('nsfwToggle').checked;
            
            // Random subjects
            const subjects = [
                "Mysterious woman in a red dress",
                "Cyberpunk hacker",
                "Ancient warrior queen",
                "Steampunk inventor",
                "Elven archer",
                "Space explorer",
                "Underwater mermaid",
                "Post-apocalyptic survivor",
                "Time traveler",
                "Magical girl",
                // Add some random celebrity names
                celebrityNames[Math.floor(Math.random() * celebrityNames.length)],
                celebrityNames[Math.floor(Math.random() * celebrityNames.length)],
                celebrityNames[Math.floor(Math.random() * celebrityNames.length)]
            ];
            
            // Random styles
            const styles = [
                "watercolor painting",
                "hyperrealistic photography",
                "anime style",
                "oil painting",
                "digital art",
                "pencil sketch",
                "3D render",
                "low poly",
                "impressionist",
                "surrealist"
            ];
            
            // Random character descriptions
            const charDescs = [
                "with glowing tattoos",
                "wearing a futuristic visor",
                "surrounded by floating objects",
                "with heterochromatic eyes",
                "as a celestial being",
                "with mechanical limbs",
                "drenched in golden light",
                "with an aura of mystery",
                "as a mythical creature",
                "with an ancient artifact"
            ];
            
            // Random scene details
            const sceneDetails = [
                "ancient ruins at sunset",
                "neon-lit city streets",
                "floating islands in the sky",
                "undersea coral palace",
                "desert wasteland",
                "enchanted forest",
                "space station interior",
                "Victorian era ballroom",
                "post-apocalyptic cityscape",
                "magical academy library"
            ];
            
            // Updated Random technical settings with new options
            const techSettings = [
                "dslr, soft lighting, high quality, film grain",
                "Fujifilm XT3, cinematic lighting, gloomy, dark",
                "dimmed, RAW photo, vignette photography, slate atmosphere",
                "more details, intricate texture, 16k, highly detailed hair",
                "(photorealistic), bright floodlights in background, raining",
                "night time, soft focus, 55mm lens, f/2.8",
                "insanely detailed, highest quality, cinematic film still",
                "cinematic lighting, vibrant, --style expressive",
                "amateur candid photography, evocative pose, 4k",
                "sharp focus, masterpiece, award winning photo",
                "cinestill 800, (hyperrealism:1.2), (8K UHD:1.2)",
                "(photorealistic:1.2), shot with hasselblad H6D",
                "20 megapixel, canon eos r3, nikon d850",
                "film stock photograph, 4 kodak portra 400",
                "camera f1.6 lens, (dramatic lighting)",
                "lifelike texture, highly detailed skin",
                "--ar 16:9 --ISO 400",
                "--ar 4:3 --v 5",
                "--ar 1:1 --q 2",
                "--ar 9:16 --style 4b",
                "--ar 3:2 --chaos 20",
                "--ar 2:3 --stylize 1000",
                "--ar 5:4 --seed 1234",
                "--ar 7:5 --tile",
                "--ar 21:9 --testp",
                "--ar 3:4 --upbeta"
            ];
            
            // Random artists
            const artists = [
                "Greg Rutkowski",
                "Artgerm",
                "Alphonse Mucha",
                "H.R. Giger",
                "Zdzisław Beksiński",
                "Moebius",
                "Yoshitaka Amano",
                "Frank Frazetta",
                "Boris Vallejo",
                "Julie Bell"
            ];
            
            // Random NSFW details
            const nsfwDetails = [
                "((stockings and garters:1.4))",
                "((strategic shadows:1.3))",
                "((pearl necklace between breasts:1.2))",
                "((silk robe slipping off:1.3))",
                "((wet fabric clinging:1.4))",
                "((biting lower lip:1.2))",
                "((back arch:1.3))",
                "((thigh highs:1.4))",
                "((corset laces:1.3))",
                "((choker necklace:1.2))"
            ];
            
            // Random flavor tags
            const allFlavorTags = [
                "voluptuous curves",
                "cosmic energy",
                "dreamlike quality",
                "otherworldly beauty",
                "golden hoop earrings",
                "salt-weathered skin",
                "vines creeping",
                "ethereal glow",
                "dynamic pose",
                "cinematic lighting",
                "mysterious aura",
                "futuristic aesthetic",
                "ancient wisdom",
                "magical essence",
                "technological marvel"
            ];
            
            // Select random items
            const randomSubject = subjects[Math.floor(Math.random() * subjects.length)];
            const randomStyle = styles[Math.floor(Math.random() * styles.length)];
            const randomCharDesc = charDescs[Math.floor(Math.random() * charDescs.length)];
            const randomScene = sceneDetails[Math.floor(Math.random() * sceneDetails.length)];
            const randomTech = techSettings[Math.floor(Math.random() * techSettings.length)];
            const randomArtist = artists[Math.floor(Math.random() * artists.length)];
            const randomNsfw = isNsfw ? nsfwDetails[Math.floor(Math.random() * nsfwDetails.length)] + ", " + nsfwDetails[Math.floor(Math.random() * nsfwDetails.length)] : '';
            
            // Select 3-5 random flavor tags
            selectedTags = [];
            const numTags = 3 + Math.floor(Math.random() * 3);
            const shuffledTags = [...allFlavorTags].sort(() => 0.5 - Math.random());
            selectedTags = shuffledTags.slice(0, numTags);
            
            // Update form fields
            document.getElementById('mainSubject').value = randomSubject;
            document.getElementById('styleAppearance').value = randomStyle;
            document.getElementById('characterDesc').value = randomCharDesc;
            document.getElementById('sceneDetails').value = randomScene;
            document.getElementById('techSettings').value = randomTech;
            document.getElementById('artistPhotog').value = randomArtist;
            
            if (isNsfw) {
                document.getElementById('nsfwDetails').value = randomNsfw;
            }
            
            // Update flavor tag UI
            document.querySelectorAll('.flavor-tag').forEach(tag => {
                tag.classList.remove('selected');
                if (selectedTags.includes(tag.textContent.trim())) {
                    tag.classList.add('selected');
                }
            });
            
            // Generate the prompt immediately
            generatePrompt();
        }
    </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=Scartxx/text-to-image-prompt-generator" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>