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
 
 
 
656fdf6
2742b75
 
 
 
 
656fdf6
 
2742b75
 
 
656fdf6
2742b75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
656fdf6
 
2742b75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3825b50
2742b75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
656fdf6
2742b75
 
3825b50
656fdf6
0026b70
656fdf6
3825b50
 
 
 
 
 
2742b75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
656fdf6
2742b75
656fdf6
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
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
<!DOCTYPE html>
<html lang="en">


<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>zodiac, by faetalize</title>
    <link rel="shortcut icon" href="https://upload.wikimedia.org/wikipedia/commons/f/f0/Google_Bard_logo.svg"
        type="image/x-icon">

    <link rel="stylesheet"
        href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/github-dark.css">
    <script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js"></script>
</head>

<style>
    @import url('https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,200;0,400;0,800;1,200;1,400;1,800&display=swap');

    @import url('https://fonts.googleapis.com/css2?family=Product+Sans&family=Google+Sans+Display:ital@0;1&family=Google+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&family=Google+Sans+Text:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&family=Material+Symbols+Outlined&family=Space+Mono&display=swap');

    @font-face {
        font-family: 'Material Symbols Outlined';
        font-style: normal;
        font-weight: 400;
        src: url(https://fonts.gstatic.com/s/materialsymbolsoutlined/v154/kJF1BvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oDMzByHX9rA6RzaxHMPdY43zj-jCxv3fzvRNU22ZXGJpEpjC_1v-p_4MrImHCIJIZrDCvHOej.woff2) format('woff2');
    }

    .material-symbols-outlined {
        font-family: 'Material Symbols Outlined';
        font-weight: normal;
        font-style: normal;
        font-size: 1.5rem;
        line-height: 1;
        letter-spacing: normal;
        text-transform: none;
        display: inline-block;
        white-space: nowrap;
        word-wrap: normal;
        direction: ltr;
        -webkit-font-feature-settings: 'liga';
        font-feature-settings: "liga";
        -webkit-font-smoothing: antialiased;

    }

    body {
        font-family: 'Noto Sans', sans-serif;

        margin: 0;
    }

    p {
        margin: 0;
        margin-bottom: 0.5rem;
        padding: 0;
        font-size: 1rem;
    }

    h1,
    h2,
    h3,
    ol,
    ul {
        margin: 0;
    }

    h1 {
        margin-bottom: 0.5rem;
    }

    a {
        color: #3b82f6;
    }

    input,
    textarea,
    select {
        border: 1px solid;
        padding: 0.5rem;
        border-radius: 0.5rem;
        border: none;
        font-family: noto sans, sans-serif;
        font-size: 1rem;
    }

    button:focus {
        outline: none;
    }

    .form {
        display: none;
        opacity: 0;
        flex-direction: column;
        width: 32rem;
        gap: 0.5rem;
        flex-grow: 1;
        justify-content: center;
    }

    .overlay {
        flex-direction: column;
        display: none;
        position: fixed;
        opacity: 0;
        top: 0;
        left: 0;
        width: 100dvw;
        height: 100dvh;
        backdrop-filter: blur(2rem);
        z-index: 2;
        justify-content: flex-start;
        align-items: center;
    }

    .backButton {
        position: absolute;
        top: 1rem;
        left: 1rem;
        border: none;
        background-color: transparent;
        font-size: 1.5rem;
        font-weight: 600;
        transition: all 0.2s;

    }

    #btn-hide-sidebar {
        display: none;
    }

    .message-container {
        display: flex;
        flex-direction: column-reverse;
        overflow-y: auto;
        gap: 1rem;
        padding-bottom: 2rem;
        flex-grow: 1;
    }

    .message-box {
        display: flex;
        position: relative;
    }

    .message {

        padding: 1rem;
    }

    .message-model {
        border-radius: 1rem;
    }

    #messageInput {
        height: 2.5rem;
        box-sizing: border-box;
        text-wrap: wrap;
        resize: none;
        width: 100%;
        padding-right: 2rem;
    }

    #messageInput::-webkit-scrollbar {
        height: 1rem;
        width: 0.5rem;
    }
  
    #messageInput::-webkit-scrollbar {
    height: 2.5rem !important;
    width: 0.5rem !important;
    }

    .btn-textual {
        background: transparent !important;
        margin: 0;
        padding: 0;
        border: none;
        transition: all 0.2s;
        cursor: pointer;
        font-size: inherit;
    }



    #btn-send {
        position: absolute;
        right: 0.5rem;
        bottom: 0.5rem;
        font-size: 1.5rem;
    }

    .btn-array {
        display: flex;
        flex-direction: row;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }

    .btn-array button {
        flex-grow: 1;
    }

    .personality-prompt {
        display: none;
    }

    .prompt-field {
        resize: vertical;
        height: 7rem;
    }

    .container {
        box-sizing: border-box;
        display: flex;
        gap: 0.5rem;
        padding: 1rem;


        width: 100dvw;
        height: 100dvh;

    }

    .sidebar {
        position: sticky;
        top: 1rem;

        display: flex;
        flex-direction: column;
        overflow-y: auto;
        gap: 0.5rem;
        padding: 1rem;
        width: 25rem;
        border-radius: 1rem;
        scrollbar-width: thin;
        height: calc(100dvh - 4rem);
        z-index: 1;
    }

    .sidebar-section {
        margin-bottom: 1rem;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    #btn-show-sidebar {
        display: none;
    }

    .header {
        display: flex;

        box-sizing: border-box;
        align-items: center;
        font-size: 2rem;
        font-weight: 800;
        gap: 0.5rem;
        width: 100%;
    }

    .navbar {
        position: relative;
        display: flex;
        flex-direction: row;
        border-radius: 0.5rem;
        justify-content: space-evenly;
        margin-bottom: 1rem;
        z-index: 0;
    }

    .navbar-tab {
        width: 100%;
        padding: 0.5rem;
        text-align: center;

        z-index: 2;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;

    }



    .navbar-tab-highlight {
        padding: 0;
        margin: 0;
        position: absolute;
        border-radius: 0.5rem;
        transition: all 0.2s;
        height: 100%;
        z-index: 1;
        /* glow */
        box-shadow: 0 0 1rem 0.05rem #29292a3f;
    }

    #gemini-pro-branding {
        font-family: Google Sans Display, sans-serif;
        color: #7c8a9c;
        font-size: 1rem;
        font-weight: 400;
    }

    #gemin-pro-logo {
        width: 2rem;
        height: 2rem;
    }

    .credits {
        margin-top: auto;
        display: flex;
        padding: 0rem 1rem 0 1rem;

        font-size: 0.75rem;
        color: #7c8a9c;

        justify-content: space-between;
        align-items: center;
    }

    button {
        border: none;
        background-color: #3b82f6;
        color: white;
        padding: 0.5rem;
        border-radius: 0.5rem;
        transition: all 0.2s;
    }

    #mainContent {
        display: flex;
        flex-direction: column;
        padding: 2rem;
        margin-left: auto;
        margin-right: auto;
        width: 32rem;
        text-align: justify;
    }

    .card-personality {
        box-sizing: border-box;
        -moz-box-sizing: border-box;
        -webkit-box-sizing: border-box;
        color: #e4e4e4;
        background-color: black;
        background-size: cover;
        background-position: center;
        position: relative;

        display: flex;
        flex-direction: column;
        justify-content: end;
        padding: 1rem;
        border-radius: 1rem;
        height: 10rem;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
        text-shadow: 0 0 10px #000000, 0 0 5px #181818;
    }

    .edit:hover {
        text-shadow: 0 0 10px #e4e4e4, 0 0 5px #dfdfdf;
    }


    .card-personality * {
        /* unselectable */
        -webkit-user-select: none;
        /* Safari */
        -moz-user-select: none;
        /* Firefox */
        -ms-user-select: none;
        /* IE10+/Edge */
        user-select: none;
        /* Standard */

    }

    .card-personality input {
        display: none;
    }

    .btn-edit-card {
        /* top right corner */
        position: absolute;
        top: 1rem;
        right: 1rem;
        color: #e4e4e4;
    }

    .btn-share-card {
        /* bottom right corner */
        position: absolute;
        top: 1rem;
        right: 2.5rem;
        font-size: 1rem;
        color: #e4e4e4;
    }

    #btn-hide-overlay {
        padding: 2rem;
    }




    @media (max-width: 768px) {
        body {
            margin: 0;
            padding: 0;
        }


        .container {
            padding: 0;

        }

        .message-container {
            padding-left: 1rem;
            padding-right: 1rem;
        }

        .sidebar {
            top: 0;
            height: calc(100dvh - 2rem);
            margin: 0;
            width: calc(100dvw - 2rem);
            position: fixed;
            border-radius: 0;
            display: none;
        }

        .navbar {
            position: relative;
        }


        #btn-hide-sidebar {
            display: block;
        }

        #mainContent {
            padding: 0;
            margin: 0;
            width: 100%;
        }

        #mainContent .header {
            padding: 2rem;
        }

        #messageInput {
            border-radius: 0;
        }

        #btn-show-sidebar {
            display: block;
        }
    }


    /* Light theme styles */
    @media (prefers-color-scheme: light) {
        :focus {
            outline: 1px solid #8f9eb3;
        }

        body {
            background-color: #f0f6ff;
            color: #0a0a0a;
        }

        a {
            color: #444ed6;
        }

        .sidebar {
            background-color: #d2e2f7;
        }

        .navbar {
            background-color: rgb(176 205 246);
        }

        .navbar-tab {
            color: #0a0a0a;
        }

        .navbar-tab-highlight {
            background-color: #87b0ed;
        }

        .btn-textual:hover {
            text-shadow: 0 0 10px #000000;
        }

        button {
            background-color: #83b5f7;

            color: #2b3d59;
        }

        button:hover {
            background-color: rgb(63, 191, 255);
        }


        input,
        textarea,
        select {
            background-color: #f0f6ff;
            outline: 1px solid #8f9eb3;
        }

        input::placeholder,
        textarea::placeholder {
            color: #7c8a9c;
        }

        .message-model {
            background-color: #d2e2f7;
        }
    }

    /* Dark theme styles */
    @media (prefers-color-scheme: dark) {
        :root {
            color-scheme: dark;
        }

        :focus {
            outline: 1px solid #73859e;
        }



        body {
            background-color: #151e24;
            color: #e4e4e4;
        }

        a {
            color: #92d9eb;
        }



        .sidebar {
            background-color: #1a2733;
        }

        .navbar {
            background-color: #00000047;
        }

        .navbar-tab {
            color: #e4e4e4;
        }

        .navbar-tab-highlight {
            background-color: #22486b;

            box-shadow: 0 0 1rem 0.05rem #29292aac;
        }

        button {
            background-color: #22486b;
            color: #c9d3ee;
        }

        button:hover {
            background-color: #31689c;
        }

        .btn-textual {
            color: #e4e4e4;
        }

        .btn-textual:hover {
            text-shadow: 0 0 10px #ffffff, 0 0 5px #dfdfdf;
        }

        .edit:hover {
            text-shadow: 0 0 10px #ffffff, 0 0 5px #dfdfdf;
            /* Change #00ff00 to the color you want */
        }

        input,
        textarea,
        select {
            background-color: #283542;

            color: #e4e4e4;
            border: none;
        }

        input::placeholder,
        textarea::placeholder {
            color: #849caf;
        }


        .message-model {
            background-color: #1a2733;
        }
    }

    #btn-reset-chat {
        background-color: #1a2733;
        color: #e4e4e4;
        right: 4rem;
        margin-right: 5px;
        transition: all 0.2s;
        cursor: pointer;
    }

    #btn-reset-chat:hover {
        background-color: #313131;
    }
</style>

<body>
    <div class="container">
        <div class="sidebar">
            <div class="header">
                <button class="material-symbols-outlined btn-textual" id="btn-hide-sidebar">
                    arrow_back_ios_new
                </button>
                <img src="https://upload.wikimedia.org/wikipedia/commons/f/f0/Google_Bard_logo.svg" id="gemin-pro-logo">
                <div id="title-div">
                    <div id="zodiac-branding">zodiac </div>
                    <div id="gemini-pro-branding">powered by Gemini Pro</div>
                </div>
            </div>
            <div class="navbar">
                <div class="navbar-tab">Personalities</div>
                <div class="navbar-tab">Settings</div>
                <div class="navbar-tab-highlight"></div>
            </div>

            <div class="sidebar-section" id="personalitySection">
                <label class="card-personality"
                    style="background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('https://images.fonearena.com/blog/wp-content/uploads/2023/12/Google-Gemini-AI-1024x577.jpg')">
                    <input type="radio" name="personality" value="zodiac3" checked>
                    <div>
                        <h3 class="personality-title">zodiac</h3>
                        <p class="personality-description">zodiac is a cheerful assistant, always ready to help you with
                            your tasks.</p>
                        <p class="personality-prompt">You are zodiac, a helpful assistant created by faetalize, built
                            upon Google's Gemini Pro model. Gemini Pro is a new LLM (Large Language Model) release by
                            Google on December 2023. Your purpose is being a helpful assistant to the user.</p>
                    </div>
                    <button class="btn-textual btn-edit-card material-symbols-outlined"
                        id="btn-edit-personality-default">edit</button>
                    <button class="btn-textual btn-share-card material-symbols-outlined"
                        id="btn-share-personality-default">share</button>
                </label>
                <div class="btn-array" id="btn-array-personality-section">
                    <button id="btn-add-personality">Add Personality</button>
                    <button id="btn-import-personality">Import</button>
                </div>
            </div>

            <div class="sidebar-section">
                <input type="text" placeholder="Paste API key here" id="apiKeyInput" class="input-field"></input>
                <h3>Generation Settings:</h3>
                <label for="maxTokens">Max Output Tokens:</label>
                <input type="number" id="maxTokens" class="input-field" min="1" max="4000" value="1000"></input>
                <label for="safetySettings">Safety Settings:</label>
                <select id="safetySettings" class="input-field">
                    <option value="safe">Safe</option>
                    <option value="moderate">Moderate</option>
                    <option value="risky">Risky</option>
                </select>
            </div>

            <div class="credits">
                Made by fætalize
                <a href="https://github.com/faetalize/zodiac">Source Code</a>
            </div>
        </div>

        <div id="mainContent">
            <div class="header">
                <button class="material-symbols-outlined btn-textual" id="btn-show-sidebar">
                    menu
                </button>
            </div>
            <div class="message-container"></div>
            <div class="message-box">
                <button class="material-symbols-outlined" id="btn-reset-chat">rotate_left</button>
                <textarea type="text" placeholder="Type your message here" id="messageInput"
                    class="input-field"></textarea>
                <button type="submit" class="btn-textual material-symbols-outlined" id="btn-send">send</button>
            </div>
        </div>
    </div>

    <div class="overlay">
        <div class="header">
            <button class="btn-textual" id="btn-hide-overlay">BACK</button>
        </div>

        <div class="form" id="form-add-personality">
            <h1>Add Personality</h1>
            <label for="personalityNameInput">Personality Name:</label>
            <input type="text" placeholder="Personality Name" id="personalityNameInput" class="input-field"></input>
            <label for="personalityDescriptionInput">Personality Description:</label>
            <textarea id="personalityDescriptionInput" placeholder="Personality Description"
                class="prompt-field"></textarea>
            <label for="personalityImageURLInput">Personality Image URL:</label>
            <input type="text" placeholder="Personality Image URL" id="personalityImageURLInput"
                class="input-field"></input>
            <label for="personalityPromptInput">Prompt:</label>
            <textarea id="personalityPromptInput" placeholder="Personality Prompt" class="prompt-field"></textarea>
            <button id="btn-submit-personality">Add Personality</button>
        </div>

        <div class="form" id="form-edit-personality">
            <h1>Edit Personality</h1>
            <label for="personalityNameInput">Personality Name:</label>
            <input type="text" placeholder="Personality Name" id="personalityNameInput" class="input-field"></input>
            <label for="personalityDescriptionInput">Personality Description:</label>
            <textarea id="personalityDescriptionInput" placeholder="Personality Description"
                class="prompt-field"></textarea>
            <label for="personalityImageURLInput">Personality Image URL:</label>
            <input type="text" placeholder="Personality Image URL" id="personalityImageURLInput"
                class="input-field"></input>
            <label for="personalityPromptInput">Prompt:</label>
            <textarea id="personalityPromptInput" placeholder="Personality Prompt" class="prompt-field"></textarea>
            <button id="updatePersonality">Save</button>
        </div>
    </div>

    <script type="importmap">
      {
        "imports": {
          "@google/generative-ai": "https://esm.run/@google/generative-ai"
        }
      }
    </script>

    <script type="module">
        import { marked } from "https://cdn.jsdelivr.net/npm/marked/lib/marked.esm.js";
        import { GoogleGenerativeAI } from "@google/generative-ai";
        import { HarmBlockThreshold, HarmCategory } from "@google/generative-ai";

        const safetySettings = [

            {
                category: HarmCategory.HARM_CATEGORY_HARASSMENT,
                threshold: HarmBlockThreshold.BLOCK_NONE,
            },
            {
                category: HarmCategory.HARM_CATEGORY_HATE_SPEECH,
                threshold: HarmBlockThreshold.BLOCK_NONE,
            },
            {
                category: HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT,
                threshold: HarmBlockThreshold.BLOCK_NONE,
            },
            {
                category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
                threshold: HarmBlockThreshold.BLOCK_NONE,
            }
        ];
        const systemPrompt = "If needed, format your answer using markdown." +
            "Today's date is" + new Date().toDateString() + "." +
            "End of system prompt.";

        //load api key from local storage into input field
        const API_KEY = document.querySelector("#apiKeyInput");
        const maxTokens = document.querySelector("#maxTokens");
        API_KEY.value = localStorage.getItem("API_KEY");
        maxTokens.value = localStorage.getItem("maxTokens");
        if (maxTokens.value == "") maxTokens.value = 1000;


        //function to hide element smoothly then setting display none after the transition time elapsed
        function hideElement(element) {
            element.style.transition = 'opacity 0.2s';
            element.style.opacity = '0';
            setTimeout(function () {
                element.style.display = 'none';
            }, 200);
        }

        function showElement(element) {
            // Wait for other transitions to complete (0.2s delay)
            setTimeout(function () {
                // Change display property
                element.style.display = 'flex';
                // Wait for next frame for display change to take effect
                requestAnimationFrame(function () {
                    // Start opacity transition
                    element.style.transition = 'opacity 0.2s';
                    element.style.opacity = '1';
                });
            }, 200);
        }


        const tabs = document.querySelectorAll(".navbar-tab");
        const sidebarViews = document.querySelectorAll(".sidebar-section");
        const highlight = document.querySelector(".navbar-tab-highlight");
        highlight.style.width = `calc(100% / ${tabs.length})`;



        let currentTab = undefined;
        function navigateTo(tab) {
            if (tab == tabs[currentTab]) {
                return;
            }
            // set the highlight to match the size of the tab element


            let tabIndex = [...tabs].indexOf(tab);
            if (tabIndex < 0 || tabIndex >= sidebarViews.length) {
                console.error("Invalid tab index: " + tabIndex);
                return;
            }

            if (currentTab != undefined) {
                hideElement(sidebarViews[currentTab]);
            }
            showElement(sidebarViews[tabIndex]);
            currentTab = tabIndex;

            highlight.style.left = `calc(100% / ${tabs.length} * ${tabIndex})`;

        }

        tabs.forEach(element => {
            element.addEventListener("click", () => {

                navigateTo(element);
            })
        });

        sidebarViews.forEach(view => {
            hideElement(view);
        });


        navigateTo(tabs[0]);



        const personalityCardsInnerInput = document.querySelectorAll(".card-personality input");
        let personalityCards = document.querySelectorAll(".card-personality");
        const formsOverlay = document.querySelector(".overlay");
        const hideOverlayButton = document.querySelector("#btn-hide-overlay");
        const addPersonalityForm = document.querySelector("#form-add-personality");
        const addPersonalityButton = document.querySelector("#btn-add-personality");
        const editDefaultPersonalityForm = document.querySelector("#form-edit-personality");
        const editDefaultPersonalityButton = document.querySelector("#btn-edit-personality-default");
        const submitNewPersonalityButton = document.querySelector("#btn-submit-personality");
        const updatePersonalityButton = document.querySelector("#updatePersonality");
        const resetChatButton = document.querySelector("#btn-reset-chat");

        const messageContainer = document.querySelector(".message-container");
        const sendMessageButton = document.querySelector("#btn-send");


        function darkenBg(element) {

            let elementBackgroundImageURL = element.style.backgroundImage.match(/url\((.*?)\)/)[1].replace(/('|")/g, '');
            element.style.backgroundImage = `linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('${elementBackgroundImageURL}')`;
        }


        function lightenBg(element) {

            let elementBackgroundImageURL = element.style.backgroundImage.match(/url\((.*?)\)/)[1].replace(/('|")/g, '');
            element.style.backgroundImage = `url('${elementBackgroundImageURL}')`;
        }


        function sharePersonality(personality) {
            //export personality to json
            const personalityJSON = {
                name: personality.querySelector(".personality-title").innerText,
                description: personality.querySelector(".personality-description").innerText,
                prompt: personality.querySelector(".personality-prompt").innerText,
                //base64 encode image
                image: personality.style.backgroundImage.match(/url\((.*?)\)/)[1].replace(/('|")/g, '')
            }
            const personalityJSONString = JSON.stringify(personalityJSON);
            //download
            const element = document.createElement('a');
            element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(personalityJSONString));
            element.setAttribute('download', `${personalityJSON.name}.json`);
            element.style.display = 'none';
            document.body.appendChild(element);
            element.click();
            document.body.removeChild(element);


        }

        //handle share button click
        personalityCards.forEach(card => {
            const shareButton = card.querySelector(".btn-share-card");
            shareButton.addEventListener("click", () => {
                sharePersonality(card);
            })
        });

        const importPersonalityButton = document.querySelector("#btn-import-personality");
        importPersonalityButton.addEventListener("click", () => {
            const fileInput = document.createElement('input');
            fileInput.type = 'file';
            fileInput.addEventListener('change', () => {
                const file = fileInput.files[0];
                const reader = new FileReader();
                reader.onload = function (e) {
                    const personalityJSON = JSON.parse(e.target.result);
                    insertPersonality(personalityJSON);
                };
                reader.readAsText(file);
            });
            fileInput.click();
        });

        //handle radio input check change
        personalityCardsInnerInput.forEach(input => {
            input.addEventListener("change", () => {
                // Darken all cards
                personalityCards.forEach(card => {
                    const cardBackgroundImageURL = card.style.backgroundImage.match(/url\((.*?)\)/)[1].replace(/('|")/g, '');
                    card.style.outline = "0px solid rgb(150 203 236)";
                    darkenBg(card);
                })

                // Lighten selected card
                input.parentElement.style.outline = "3px solid rgb(150 203 236)";
                lightenBg(input.parentElement);
            })
            // Set initial outline
            if (input.checked) {
                lightenBg(input.parentElement);
                input.parentElement.style.outline = "3px solid rgb(150 203 236)";
            }
        })

        function showAddPersonalityForm() {
            showElement(formsOverlay);
            showElement(addPersonalityForm);
        }

        function showEditPersonalityForm() {
            showElement(formsOverlay);
            showElement(editDefaultPersonalityForm);
        }

        function closeOverlay() {
            hideElement(formsOverlay);
            hideElement(addPersonalityForm);
            hideElement(editDefaultPersonalityForm);
        }


        function insertPersonality(personalityJSON){
            const personalitySection = document.querySelector("#personalitySection");
            const personalitySectionActions = document.querySelector("#btn-array-personality-section");

            const personalityCard = document.createElement("label");
            personalityCard.classList.add("card-personality");
            personalityCard.style.backgroundImage = `url('${personalityJSON.image}')`;
            personalityCard.innerHTML = `
            <input type="radio" name="personality" value="${personalityJSON.name}">
            <div>
                <h3 class="personality-title">${personalityJSON.name}</h3>
                <p class="personality-description">${personalityJSON.description}</p>
                <p class="personality-prompt">${personalityJSON.prompt}</p>
            </div>
            <button class="btn-textual btn-edit-card material-symbols-outlined" id="btn-edit-personality-${personalityJSON.name}">edit</button>
            <button class="btn-textual btn-share-card material-symbols-outlined" id="btn-share-personality-${personalityJSON.name}">share</button>
            `;

            //insert personality card before the button array
            personalitySection.insertBefore(personalityCard, personalitySectionActions);

            darkenBg(personalityCard);

            personalityCards = document.querySelectorAll(".card-personality");
            //add input event listener
            personalityCard.querySelector("input").addEventListener("change", () => {
                // Darken all cards
                personalityCards.forEach(card => {
                    const cardBackgroundImageURL = card.style.backgroundImage.match(/url\((.*?)\)/)[1].replace(/('|")/g, '');
                    card.style.outline = "0px solid rgb(150 203 236)";
                    darkenBg(card);
                })

                // Lighten selected card
                personalityCard.style.outline = "3px solid rgb(150 203 236)";
                lightenBg(personalityCard);
            })

            const sharebtn = personalityCard.querySelector(".btn-share-card");
            sharebtn.addEventListener("click", () => {
                sharePersonality(personalityCard);
            });
        }

        function submitNewPersonality() {
            const personalityName = document.querySelector("#form-add-personality #personalityNameInput");
            const personalityDescription = document.querySelector("#form-add-personality #personalityDescriptionInput");
            const personalityImageURL = document.querySelector("#form-add-personality #personalityImageURLInput");
            const personalityPrompt = document.querySelector("#form-add-personality #personalityPromptInput");
            const personalitySection = document.querySelector("#personalitySection");


            if (personalityName.value == "") {
                alert("Please enter a personality name");
                return;
            }
            if (personalityPrompt.value == "") {
                alert("Please enter a personality prompt");
                return;
            }

            //to json
            const personalityJSON = {
                name: personalityName.value,
                description: personalityDescription.value,
                prompt: personalityPrompt.value,
                image: personalityImageURL.value
            }
            insertPersonality(personalityJSON);
            closeOverlay();
        }

        async function run() {
            const msg = document.querySelector("#messageInput");
            const msgText = msg.value;
            const maxTokens = document.querySelector("#maxTokens");
            const API_KEY = document.querySelector("#apiKeyInput");
            const selectedPersonalityTitle = document.querySelector("input[name='personality']:checked + div .personality-title").innerText;
            const selectedPersonalityDescription = document.querySelector("input[name='personality']:checked + div .personality-description").innerText;
            const selectedPersonalityPrompt = document.querySelector("input[name='personality']:checked + div .personality-prompt").innerText;


            //chat history
            let chatHistory = [];
            //get chat history from message container
            const messageElements = messageContainer.querySelectorAll(".message");
            messageElements.forEach(element => {
                const messageroleapi = element.querySelector(".message-role-api").innerText;
                const messagetext = element.querySelector(".message-text").innerText;
                chatHistory.push({
                    role: messageroleapi,
                    parts: [{ text: messagetext }]
                })
            })
            //reverse order of chat history
            chatHistory.reverse();

            //
            const toneExamples = [];


            if (API_KEY.value == "") {
                alert("Please enter an API key");
                return;
            }

            const generationConfig = {
                maxOutputTokens: maxTokens.value,
                temperature: 0.9
            };
            const genAI = new GoogleGenerativeAI(API_KEY.value);
            const model = genAI.getGenerativeModel({ model: "gemini-pro" });
            const chat = model.startChat({
                generationConfig, safetySettings,
                history: [
                    {
                        role: "user",
                        parts: [{ text: `Personality Name: ${selectedPersonalityTitle}, Personality Description: ${selectedPersonalityDescription}, Personality Prompt: ${selectedPersonalityPrompt}. ${systemPrompt}` }]
                    },
                    {
                        role: "model",
                        parts: [{ text: `Okay. From now on, I shall play the role of ${selectedPersonalityTitle}. Your prompt and described personality will be used for the rest of the conversation.` }]
                    },
                    ...toneExamples,
                    ...chatHistory
                ]
            })



            msg.value = "";
            //create new message div for the user's message then append to message container's top
            const newMessage = document.createElement("div");
            newMessage.classList.add("message");
            newMessage.innerHTML = `
            <h3 class="message-role">You:</h3>
            <div class="message-role-api" style="display: none;">user</div>
            <p class="message-text">${msgText}</p>
            `;
            messageContainer.insertBefore(newMessage, messageContainer.firstChild);

            const result = await chat.sendMessageStream(msgText);

            //create new message div for the model's reply then append to message container's top
            const newReply = document.createElement("div");
            newReply.classList.add("message");
            newReply.classList.add("message-model");
            newReply.innerHTML = `
            <h3 class="message-role">${selectedPersonalityTitle}:</h3>
            <div class="message-role-api" style="display: none;">model</div>
            <p class="message-text">`;

            //get the p element inside the message div
            const replyText = newReply.querySelector(".message-text");


            messageContainer.insertBefore(newReply, messageContainer.firstChild);

            let rawText = "";
            for await (const chunk of result.stream) {
                console.log("hello");
                rawText += chunk.text();
                replyText.innerHTML = marked(rawText);
                void replyText.offsetHeight; // Force reflow
                hljs.highlightAll();
            }

            //save api key to local storage
            localStorage.setItem("API_KEY", API_KEY.value);
            localStorage.setItem("maxTokens",maxTokens.value);

        }

        //reset chat button (async)
        resetChatButton.addEventListener("click", () => {
                //remove all messages
                messageContainer.innerHTML = "";
        });


        const messageInput = document.querySelector("#messageInput");

        //if more than one line, set height to scrollheight, and revert upon delete
        messageInput.addEventListener("input", () => {
            if (messageInput.value.split("\n").length == 1) {
                messageInput.style.height = "2.5rem";
            }
            else {
                messageInput.style.height = "";
                messageInput.style.height = messageInput.scrollHeight + "px";
            }
        })


        const sidebarDismissButton = document.querySelector("#btn-hide-sidebar");
        sidebarDismissButton.addEventListener("click", () => {
            hideElement(document.querySelector(".sidebar"));
        })

        const showSidebarButton = document.querySelector("#btn-show-sidebar");
        showSidebarButton.addEventListener("click", () => {
            showElement(document.querySelector(".sidebar"));
        })


        //unhide sidebar if width > 768px (event hander)
        window.addEventListener("resize", () => {
            if (window.innerWidth > 768) {
                showElement(document.querySelector(".sidebar"));
            }
        })


        hideOverlayButton.addEventListener("click", closeOverlay);

        addPersonalityButton.addEventListener("click", showAddPersonalityForm);

        editDefaultPersonalityButton.addEventListener("click", showEditPersonalityForm);

        submitNewPersonalityButton.addEventListener("click", submitNewPersonality);

        sendMessageButton.addEventListener("click", run);


        // ...
    </script>

</body>

</html>