"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[298],{227:function(e,t,r){r.d(t,{j:function(){return i}});var s=r(5893),a=r(1776),n=r(7294);function i(){let[e,t]=(0,n.useState)(!1),[r,i]=(0,n.useState)(!1);return((0,n.useEffect)(()=>{t("true"===localStorage.getItem("over18"))},[]),(0,n.useEffect)(()=>{i(!0)},[]),r)?(0,s.jsxs)(a.aR,{open:!e,children:[(0,s.jsx)(a.vW,{asChild:!0,children:(0,s.jsx)("p",{})}),(0,s.jsxs)(a._T,{children:[(0,s.jsxs)(a.fY,{children:[(0,s.jsx)(a.f$,{children:"Are you over 18?"}),(0,s.jsx)(a.yT,{children:"This chatbot is intended for adults. It may contain mature content. Please confirm that you are over 18."})]}),(0,s.jsxs)(a.xo,{children:[(0,s.jsx)(a.le,{onClick:()=>{var e;null===(e=window.open("about:blank","_self"))||void 0===e||e.close()},children:"I am under 18"}),(0,s.jsx)(a.OL,{onClick:()=>{localStorage.setItem("over18","true"),t(!0)},children:"I am an adult"})]})]})]}):null}},7697:function(e,t,r){r.d(t,{Cy:function(){return w},Fm:function(){return N},X8:function(){return y}});var s=r(5893),a=r(4907),n=r(162),i=r(7420),l=r(4979),c=r(8971),o=r(2227),d=r(1163),u=r(7294),h=r(7242),x=r(1664),v=r.n(x),m=r(8834),f=r(9533),p=r(7601),g=r(1203),j=r(5675),b=r.n(j);function N(e){var t,r,o,d,x,p,g,j,b,N,w,y;let{character:C,globalContext:k,setCharacters:I,toast:P,isLast:R,newPage:Z,loading:E,setLoading:L}=e,S=(0,u.useRef)(null),[U,T]=(0,u.useState)(!1);(0,u.useEffect)(()=>{if(!R||(console.log("isLast",R,C.name),E||!(null==S?void 0:S.current)))return;let e=new IntersectionObserver(t=>{let[r]=t;R&&r.isIntersecting&&(L(!0),Z(),e.unobserve(S.current),e.disconnect())});return e.observe(S.current),()=>{(null==S?void 0:S.current)&&(e.unobserve(S.current),e.disconnect())}},[R]);let _=null==k?void 0:null===(r=k.user)||void 0===r?void 0:null===(t=r.charactersFavorited)||void 0===t?void 0:t.find(e=>e.characterId===C.id);return(0,s.jsxs)("div",{ref:S,className:"col-span-1 w-full bg-neutral-900 flex flex-col justify-center items-center rounded-xl",children:[(0,s.jsx)(v(),{href:"/characters/chat/".concat(C.id),target:"_blank",children:(0,s.jsx)("div",{className:"inline-flex flex-col rounded-b-none rounded-xl w-auto h-auto cursor-pointer overflow-hidden",children:(0,s.jsx)(m.Z,{character:C})})}),(0,s.jsxs)("div",{className:"flex flex-col gap-1 p-2 text-center break-words",children:[(0,s.jsxs)("div",{className:"flex justify-center items-center gap-3 px-4 lg:px-1",children:[(0,s.jsx)(i.Z,{onClick:()=>{a.ot.post("/characters/".concat(C.id,"/favorite")).then(e=>{I(t=>t.map(t=>t.id===C.id?e.data:t)),null==k||k.reloadUser()}).catch(e=>{P({title:"Error",description:e.response.data.error})})},className:"w-6 h-6 text-gray-500 cursor-pointer \n            ml-auto flex-shrink-0\n              ".concat(_?"fill-pink-500 stroke-none":"")}),(0,s.jsxs)("div",{className:"flex flex-col flex-shrink-0 justify-center items-center text-gray-400 text-sm",children:[(0,s.jsx)(l.Z,{onClick:()=>{a.ot.post("/characters/".concat(C.id,"/upvote")).then(e=>{I(t=>t.map(t=>t.id===C.id?e.data:t)),null==k||k.reloadUser()}).catch(e=>{P({title:"Error",description:e.response.data.error})})},className:"w-4 h-4 cursor-pointer flex-shrink-0 ".concat((null==k?void 0:null===(d=k.user)||void 0===d?void 0:null===(o=d.charactersUpvoted)||void 0===o?void 0:o.find(e=>e.characterId===C.id))&&"text-white font-bold")}),C.upvotes,(0,s.jsx)(c.Z,{className:"opacity-0 w-4 h-4 flex-shrink-0 ".concat((null==k?void 0:null===(p=k.user)||void 0===p?void 0:null===(x=p.charactersDownvoted)||void 0===x?void 0:x.find(e=>e.characterId===C.id))&&"text-white stroke-2")})]}),(0,s.jsx)(v(),{href:"/characters/chat/".concat(C.id),className:"mr-auto",children:(0,s.jsx)("h2",{className:"font-bold text-xl underline cursor-pointer select-none",children:C.name})}),(null===(g=C.user)||void 0===g?void 0:g.id)===(null==k?void 0:null===(j=k.user)||void 0===j?void 0:j.id)||(null==k?void 0:null===(b=k.user)||void 0===b?void 0:b.email)==="vcothur7@gmail.com"?(0,s.jsx)(h.ZP,{character:C,setCharacters:I,isImageRegenerating:U,setIsImageRegenerating:T}):(null==k?void 0:null===(N=k.user)||void 0===N?void 0:N.isModerator)?(0,s.jsx)(h.Kp,{character:C,setCharacters:I,isImageRegenerating:U,setIsImageRegenerating:T}):(0,s.jsx)(c.Z,{className:"flex-shrink-0 opacity-0 mt-1 w-6 h-6 text-gray-400 cursor-pointer"})]}),(0,s.jsx)("p",{className:"mt-1 text-gray-400 leading-5 select-none",children:(null==C?void 0:C.description)&&(0,n.Lb)(C.description)}),(0,s.jsx)(v(),{href:"/profile/".concat(null===(w=C.user)||void 0===w?void 0:w.id),children:(0,s.jsx)("p",{className:"text-center text-gray-500 text-sm",children:null===(y=C.user)||void 0===y?void 0:y.name})}),(0,s.jsx)("p",{className:"text-center text-gray-500 text-xs",children:C.madePublicAt?new Date(C.madePublicAt).toLocaleString():new Date(C.createdAt).toLocaleString()}),(0,s.jsxs)("p",{className:"text-center text-gray-500 text-xs",children:["Favorited by ",C.favorites," user",1!==C.favorites&&"s"]}),C.CharacterTags.length>0&&(0,s.jsx)("div",{className:"flex flex-wrap justify-center gap-3 mb-1 cursor-default",children:C.CharacterTags.map(e=>{let{tag:t}=e;return(0,s.jsx)(f.ZP,{className:(0,f.CM)(t.name),children:(0,s.jsx)("span",{children:t.name})},t.name)})})]})]},C.id)}function w(e){var t,r,n,l,x,j,b,N,w,y,C;let{character:k,globalContext:I,setCharacters:P,toast:R,isLast:Z,newPage:E,loading:L,setLoading:S}=e,U=(0,d.useRouter)(),T=(0,u.useRef)(null),[_,A]=(0,u.useState)(!1);(0,u.useEffect)(()=>{if(!Z||(console.log("isLast",Z,k.name),L||!(null==T?void 0:T.current)))return;let e=new IntersectionObserver(t=>{let[r]=t;Z&&r.isIntersecting&&(S(!0),E(),e.unobserve(T.current),e.disconnect())});return e.observe(T.current),()=>{(null==T?void 0:T.current)&&(e.unobserve(T.current),e.disconnect())}},[Z]);let D=null==I?void 0:null===(r=I.user)||void 0===r?void 0:null===(t=r.charactersFavorited)||void 0===t?void 0:t.find(e=>e.characterId===k.id);return(0,s.jsxs)("div",{ref:T,className:"col-span-1 w-full bg-neutral-900 flex flex-col justify-center items-center rounded-xl relative pb-3",children:[(0,s.jsx)(v(),{href:"/characters/chat/".concat(k.id),target:"_blank",children:(0,s.jsx)("div",{className:"flex justify-center rounded-b-none rounded-xl w-auto h-auto overflow-hidden",children:(0,s.jsx)(m.P,{character:k})})}),(0,s.jsx)("div",{className:"flex justify-center items-center mt-3",children:(0,s.jsxs)("p",{className:"text-gray-500 text-sm",children:[(0,s.jsx)("span",{className:"font-bold text-2xl text-white",children:k.points})," ","Points"]})}),(0,s.jsx)("div",{className:"flex justify-center items-center",children:(0,s.jsxs)("p",{className:"text-gray-500 text-sm",children:[(0,s.jsx)("span",{className:"font-bold text-2xl text-white",children:k.upvotes})," ","Upvotes |"," ",(0,s.jsx)("span",{className:"font-bold text-2xl text-white",children:k.favorites})," ","Favorites"]})}),(0,s.jsxs)("div",{className:"flex flex-1 justify-between mt-3 px-2 pb-2 w-full",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 p-2 pl-4 w-full break-words",children:[(0,s.jsx)(v(),{href:"/characters/chat/".concat(k.id),className:"text-gray-500 text-sm hover:text-white transition-colors duration-300",children:(0,s.jsx)("h2",{className:"font-bold text-2xl text-gray-300 hover:text-white underline underline-offset-4 transition duration-300 cursor-pointer ease-in-out",children:k.name})}),(0,s.jsx)("p",{className:"text-gray-400",children:k.description}),(0,s.jsx)(v(),{href:"/profile/".concat(k.user.id),target:"_blank",className:"text-gray-500 text-sm hover:text-white transition-colors duration-300",children:null===(n=k.user)||void 0===n?void 0:n.name}),(0,s.jsxs)("p",{className:"text-gray-500 text-xs",children:[k.madePublicAt&&!k.isPrivate&&new Date(k.madePublicAt).toLocaleString(),k.isPrivate&&"Updated at: "+new Date(k.updatedAt).toLocaleString()]})]}),(0,s.jsxs)("div",{className:"relative flex flex-col justify-start items-center gap-4 lg:gap-2 space-y-6 p-4 text-gray-500",children:[(null===(l=k.user)||void 0===l?void 0:l.id)===(null==I?void 0:null===(x=I.user)||void 0===x?void 0:x.id)&&(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(p.Z,{existingCharacter:k,isPrivate:U.asPath.includes("private")})}),(0,s.jsx)("button",{onClick:()=>{a.ot.post("/characters/".concat(k.id,"/upvote")).then(e=>{P(t=>t.map(t=>t.id===k.id?e.data:t)),null==I||I.reloadUser()}).catch(e=>{R({title:"Error",description:e.response.data.error})})},children:(0,s.jsx)(o.Z,{className:"cursor-pointer flex-shrink-0 bg-transparent border-none focus:outline-none ".concat((null==I?void 0:null===(b=I.user)||void 0===b?void 0:null===(j=b.charactersUpvoted)||void 0===j?void 0:j.find(e=>e.characterId===k.id))&&"text-white font-bold fill-white")})}),(0,s.jsx)("button",{className:"bg-transparent border-none cursor-pointer focus:outline-none",children:(0,s.jsx)(i.Z,{onClick:e=>{e.stopPropagation(),a.ot.post("/characters/".concat(k.id,"/favorite")).then(e=>{P(t=>t.map(t=>t.id===k.id?e.data:t)),null==I||I.reloadUser()}).catch(e=>{R({title:"Error",description:e.response.data.error})})},className:"w-6 h-6 text-gray-500 cursor-pointer \n            ml-auto flex-shrink-0\n              ".concat(D?"fill-pink-500 stroke-none":"")})}),(null===(N=k.user)||void 0===N?void 0:N.id)===(null==I?void 0:null===(w=I.user)||void 0===w?void 0:w.id)||g.ji.includes((null==I?void 0:null===(y=I.user)||void 0===y?void 0:y.id)||"")?(0,s.jsx)(h.ZP,{character:k,setCharacters:P,isImageRegenerating:_,setIsImageRegenerating:A}):(null==I?void 0:null===(C=I.user)||void 0===C?void 0:C.isModerator)?(0,s.jsx)(h.Kp,{character:k,setCharacters:P,isImageRegenerating:_,setIsImageRegenerating:A}):(0,s.jsx)(c.Z,{className:"flex-shrink-0 opacity-0 mt-1 w-6 h-6 text-gray-400 cursor-pointer"})]})]}),k.CharacterTags.length>0&&(0,s.jsx)("div",{className:"flex flex-wrap justify-center gap-3 mb-1 px-2 cursor-default",children:k.CharacterTags.map(e=>{let{tag:t}=e;return(0,s.jsx)(f.ZP,{className:(0,f.CM)(t.name),children:(0,s.jsx)("span",{children:t.name})},t.name)})})]},k.id)}function y(e){var t;let{character:r,globalContext:a,isPrivate:n,isLast:i,newPage:l,loading:c,setLoading:o}=e,d=(0,u.useRef)(null);return(0,u.useEffect)(()=>{if(!i||(console.log("isLast",i,r.name),c||!(null==d?void 0:d.current)))return;let e=new IntersectionObserver(t=>{let[r]=t;i&&r.isIntersecting&&(o(!0),l(),e.unobserve(d.current),e.disconnect())});return e.observe(d.current),()=>{(null==d?void 0:d.current)&&(e.unobserve(d.current),e.disconnect())}},[i]),(0,s.jsxs)("div",{ref:d,className:"relative flex justify-between items-center gap-4 border-gray-700 p-4 border-b w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4 w-full",children:[(0,s.jsx)(b(),{src:r.thumbnail||"/default.png",width:54,height:54,alt:"".concat(r.name," Thumbnail"),className:"rounded",placeholder:"blur",blurDataURL:"/default.png"}),(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsx)(v(),{href:"/characters/chat/".concat(r.id),children:(0,s.jsx)("h2",{className:"font-semibold text-md break-all",children:r.name})}),(0,s.jsxs)("p",{className:"text-gray-400 text-sm",children:["Updated: ",new Date(r.updatedAt).toLocaleDateString()]})]})]}),(0,s.jsx)("div",{className:"flex flex-col items-center gap-2 text-gray-500 hover:text-white",children:r.userId===(null==a?void 0:null===(t=a.user)||void 0===t?void 0:t.id)&&(0,s.jsx)(p.Z,{existingCharacter:r,isPrivate:n})})]},r.id)}},3814:function(e,t,r){r.d(t,{b:function(){return o}});var s=r(5893),a=r(8971),n=r(8865),i=r(1163),l=r(2425),c=r(7294);function o(){let e=(0,i.useRouter)(),{user:t}=(0,c.useContext)(l.k)||{};return(0,s.jsxs)(n.h_,{children:[(0,s.jsx)(n.$F,{asChild:!0,className:"cursor-pointer",children:(0,s.jsxs)("div",{className:"relative lg:hidden p-2 text-xl",children:[{"/characters":"Public Characters","/characters/private":"Private Characters","/characters/recent":"Recent Chats","/characters/favorite":"Favorite Characters","/rp":"RP with other users","/images/playground":"Image Playground ✨","/mods/modcentral":"ModCentral","/news-updates":"News & Updates","/tips-tricks":"Tips & Tricks"}[e.pathname]||"Characters",(0,s.jsx)(a.Z,{className:"inline-block ml-1 w-4 h-4 text-gray-400"})]})}),(0,s.jsxs)(n.AW,{className:"w-56",align:"start",side:"bottom",sideOffset:2,children:[(0,s.jsx)(n.Ju,{children:"Characters"}),(0,s.jsx)(n.VD,{}),(0,s.jsxs)(n.Qk,{children:[(0,s.jsx)(n.Xi,{onClick:()=>e.push("/characters"),className:"cursor-pointer",children:"Public Characters"}),(0,s.jsx)(n.Xi,{onClick:()=>e.push("/characters/private"),className:"cursor-pointer",children:"Private Characters"}),(0,s.jsx)(n.Xi,{onClick:()=>e.push("/characters/favorite"),className:"cursor-pointer",children:"Favorite Characters"}),(0,s.jsx)(n.Xi,{onClick:()=>e.push("/characters/recent"),className:"cursor-pointer",children:"Recent Chats"}),(0,s.jsx)(n.Xi,{onClick:()=>e.push("/images/playground"),className:"cursor-pointer",children:"Image Playground ✨"}),(null==t?void 0:t.isModerator)&&(0,s.jsx)(n.Xi,{onClick:()=>e.push("/mods/modcentral"),className:"cursor-pointer",children:"ModCentral"})]})]})]})}}}]);