PageSourceSearch

https://frontia.ai/assets/chat.index-JXjTklqT.js

js frontia.ai collected 2026-10-05 13:39:28 UTC 9,608 bytes, 1 lines download raw bytes

1import{u as S,j as e,T as o,A as O,m as z,q as E,o as A,r as c,I as _,S as b,h as v,k as w,i as F,b2 as H,L as V,P as B,b as M,ah as q,g as Q,J,O as W,aT as $}from"./index-D6pw7iZG.js";import{u as D}from"./index-CdU_KNH8.js";import{C as G}from"./chat-thread-list-item-CBVN69rN.js";import{S as K}from"./soul-profile-modal-C4aMqP6y.js";import{S as L}from"./soul-avatar-MDQ6ESJ3.js";import{H as X}from"./home-header-DtSHFo19.js";import{H as Y}from"./home-footer-CSQxnbD0.js";import{M as Z}from"./mobile-header-C3GauBix.js";import"./sidebar-D1T0KqQk.js";import"./utils-DgWKjmuI.js";import"./use-mobile-Bfe-Wtiq.js";import"./index-DPLoAoRC.js";import"./index-CO-plZdz.js";import"./home-D9ns4-uT.js";import"./login-content-coE77sO1.js";import"./help-center-B2OjYITx.js";import"./use-language-9b-6xjdU.js";import"./config-BRGPd1tW.js";/* empty css                    */import"./popover-U2TKMbve.js";import"./use-daily-mission-badge-D5_W4asn.js";import"./use-market-CgZ8c3Zu.js";import"./autumn-harvest-queries-D2_W5ood.js";function g({isFetching:i,onRetry:r}){const{t:s}=S();return e.jsxs("div",{role:"status",className:"flex flex-col items-center gap-4 px-3 py-5 text-center",children:[e.jsx(o,{variant:"body1-3",color:"text-ui-secondary",children:s`정보를 불러오지 못했어요. 잠시 후 다시 시도해주세요.`}),e.jsx(O,{title:s`다시 시도`,variant:"surface",disabled:i,onClick:r})]})}function ee({onOpenProfile:i}){const{t:r}=S(),{data:s,isPending:u,isError:n,isFetching:x,refetch:y}=z(E.getV1ChatNewSoulsOptions()),[j,l]=A({align:"start",containScroll:"trimSnaps",dragFree:!0,slidesToScroll:"auto"}),[f,m]=c.useState(!1),[h,d]=c.useState(!1);return c.useEffect(()=>{if(!l)return;const t=()=>{m(l.canScrollPrev()),d(l.canScrollNext())};return t(),l.on("select",t).on("reInit",t),()=>{l.off("select",t).off("reInit",t)}},[l]),s?.souls.length===0&&!n?null:e.jsxs("section",{className:v("flex flex-col gap-3 border-b px-3 py-3 md:p-5",F("outline-primary")),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(o,{as:"h2",variant:"title2-2",color:"text-ui-primary",children:r`새 친구`}),s?e.jsx(o,{variant:"title2-3",color:"text-ui-tertiary",children:s.souls.length}):null]}),s?.souls.length?e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button","aria-label":r`이전`,disabled:!f,onClick:()=>l?.scrollPrev(),className:"flex size-6 items-center justify-center rounded-full bg-gray-50/[0.06] disabled:opacity-40",children:e.jsx(_,{name:"arrow-left-stroke",size:12,color:"text-ui-secondary"})}),e.jsx("button",{type:"button","aria-label":r`다음`,disabled:!h,onClick:()=>l?.scrollNext(),className:"flex size-6 items-center justify-center rounded-full bg-gray-50/[0.06] disabled:opacity-40",children:e.jsx(_,{name:"arrow-right-stroke",size:12,color:"text-ui-secondary"})})]}):null]}),u?e.jsx("div",{role:"status","aria-label":r`불러오는 중...`,className:"flex justify-center py-3",children:e.jsx(b,{})}):null,n?e.jsx(g,{isFetching:x,onRetry:()=>{y()}}):null,s?.souls.length?e.jsx("div",{ref:j,className:"overflow-hidden",children:e.jsx("div",{className:"flex touch-pan-y gap-3",children:s.souls.map(t=>e.jsxs("div",{className:"flex w-12 min-w-0 shrink-0 flex-col items-center gap-1 md:w-16",children:[e.jsxs("div",{className:"relative",children:[e.jsx(L,{soulName:t.name,avatarUrl:t.profileImageUrl,size:48,desktopSize:64,onPress:()=>i(t)}),e.jsx("span",{"aria-hidden":"true",className:v("pointer-events-none absolute top-0 left-0 size-1 rounded-full",w("alert-primary"))})]}),e.jsx(o,{variant:"text-2","variant:md":"body2-2",color:"text-ui-secondary",className:"w-full truncate text-center",children:t.name})]},t.id))})}):null]})}function te({onOpenProfile:i}){const{t:r}=S(),{data:s,isPending:u,isError:n,isFetching:x,refetch:y}=z(E.getV1SoulsRecommendedOptions()),{createChatThread:j}
1=H(),l=c.useRef(!1),[f,m]=c.useState(null),h=s?.souls.length===0&&!n,d=async t=>{if(!l.current){l.current=!0,m(t.id);try{const p=await j(t.id,"chat_menu");if(p===null)return;M.trackEvents("click_chat_start",{soul_id:t.id,soul_name:t.name,entry_source:"chat_menu",is_first_thread:p.lastBubbleAt===null,episode_id:null})}finally{l.current=!1,m(null)}}};return e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col items-center justify-center gap-10 py-10",children:[e.jsxs("div",{className:"flex flex-col gap-2 px-3 text-center",children:[e.jsx(o,{variant:"title2-2",color:"text-ui-primary",children:h?r`아직 대화한 친구가 없네요`:r`캐릭터 소울들이 당신을 기다렸어요`}),h?null:e.jsx(o,{variant:"body1-3",color:"text-ui-secondary",children:r`먼저 말을 걸어볼까요?`})]}),h?e.jsx(V,{to:"/home",className:v("rounded-lg px-4 py-3 hover:opacity-80",w("brand-primary-opacity")),children:e.jsx(o,{variant:"body2-2",color:"brand-primary",children:r`홈으로 가기`})}):null,u?e.jsx("div",{role:"status","aria-label":r`불러오는 중...`,children:e.jsx(b,{size:28})}):null,n?e.jsx(g,{isFetching:x,onRetry:()=>{y()}}):null,s?.souls.length?e.jsx("div",{className:"no-scrollbar w-full overflow-x-auto overscroll-x-contain",children:e.jsx("div",{className:"mx-auto flex w-max gap-3 px-3 md:px-5",children:s.souls.slice(0,5).map(t=>e.jsxs("div",{className:v("flex min-h-[240px] w-[140px] shrink-0 flex-col items-center gap-3 rounded-[20px] border px-5 py-4",w("bg-primary"),F("outline-secondary")),children:[e.jsxs("div",{className:"flex w-full flex-1 flex-col items-center gap-1",children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsx(L,{soulName:t.name,avatarUrl:t.profileImageUrl,size:100,onPress:()=>i(t)}),e.jsx(B,{name:"dm-icon",size:28,alt:"",className:"pointer-events-none absolute right-0 bottom-0"})]}),e.jsxs("div",{className:"flex w-full flex-col gap-1 text-center",children:[e.jsx(o,{variant:"body2-2",color:"text-ui-secondary",className:"line-clamp-1 shrink-0",children:t.name}),e.jsx(o,{variant:"text-3",color:"text-ui-secondary",className:"line-clamp-2 break-words",children:t.statusMessage??""})]})]}),e.jsx("button",{type:"button",disabled:f!==null,"aria-label":r`1:1 채팅`,"aria-busy":f===t.id,onClick:()=>{d(t)},className:v("flex w-full shrink-0 items-center justify-center rounded-lg px-3 py-2 transition-opacity hover:opacity-80 disabled:opacity-50",w("brand-primary-opacity")),children:f===t.id?e.jsx(b,{size:16}):e.jsx(o,{variant:"body3-2",color:"brand-primary",children:r`1:1 채팅`})})]},t.id))})}):null]})}function re(){const{source:i}=q({from:"/_authenticated/chat/"}),r=c.useRef(!1);c.useEffect(()=>{r.current||(r.current=!0,M.trackEvents("view_chat_tab",{source:i==="header"||i==="push"||i==="deeplink"?i:"etc"}))},[i])}function se({header:i,footer:r}){const{t:s}=S();re();const u=Q(a=>a.currentUser),[n,x]=c.useState(null),[y,j]=c.useState(null),{data:l,isPending:f,isError:m,isRefetchError:h,isFetching:d,refetch:t,hasNextPage:p,isFetchingNextPage:k,isFetchNextPageError:U,fetchNextPage:C}=J({...W(),getNextPageParam:a=>a.nextCursor??void 0,initialPageParam:{query:{cursor:void 0}},enabled:!!u,refetchOnMount:"always",refetchOnWindowFocus:!0}),I=c.useMemo(()=>{const a=new Set;return(l?.pages.flatMap(N=>N.threads)??[]).filter(N=>a.has(N.id)?!1:(a.add(N.id),!0))},[l]),P=I.length>0,{ref:T,inView:R}=D({root:y,rootMargin:"160px",skip:!p||!y});return c.useEffect(()=>{u&&R&&p&&!d&&!m&&C()},[u,R,p,d,m,C]),u?e.jsxs(e.Fragment,{children:[i(P),e.jsxs("div",{className:"min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain",children:[e.jsxs("div",{className:"flex min-h-full w-full flex-col",children:[e.jsxs("main",{className:"mx-auto flex w-full max-w-[1120px] flex-1 flex-col",children:[e.jsx("div",{className:"shrink-0 px-3 py-3 md:px-5",children:e.jsx(o,{as:"h1",variant:"title2-2","variant:md":"title1-2",color:"text-ui-primary",children:s`채팅`})}),f?e.jsx("div",{role:"status","aria-label":s`불러오는 중...`,className:"flex flex-1 items-center justify-center py-10",children:e.jsx(b,{size:28})}):m&&!l?e.jsx("div",{className:"flex flex-1 items-center justify-center py-5",children:e.jsx(g,{isFetching:d,onRetry:()=>{t()}})}):e.jsxs(e.Fragment,{children:[h?e.jsx(g,{isFetching:d,onRetry:()=>{t()}}):null,P?e.jsxs("div",{className:"flex flex-col",children:[e.jsx(ee,{onOpenProfile:a=>x({...a,entrySource:"new_friends"})}),e.jsxs("div",{ref:j,className:"h-[600px] shrink-0 overflow-x-hidden overflow-y-auto py-3 md:py-5",children:[I.map(a=>e.jsx(G,{thread:a,variant:"page",onOpenProfile:()=>{a.soulMetaId!==null&&x({id:a.soulMetaId,name:a.title,profileImageUrl:a.thumbnailUrl,entrySource:"chat_list"})},className:`chat-list-page-row ${$("surface-primary")}`},a.id)),p?e.jsx("div",{ref:T,role:k?"status":void 0,"aria-label":k?s`더 불러오는 중...`:void 0,className:"flex min-h-10 items-center justify-center py-3",children:k?e.jsx(b,{}):U?e.jsx(g,{isFetching:d,onRetry:()=>{C()}}):null}):null]})]}):e.jsx(te,{onOpenProfile:a=>x({...a,entrySource:"chat_list"})})]})]}),P?r:null]}),n?e.jsx(K,{soulMetaId:n.id,soulName:n.name,soulAvatarUrl:n.profileImageUrl,entrySource:n.entrySource,open:!0,onClose:()=>x(null)},n.id):null]})]}):null}function ae(){return e.jsx("div",{className:"flex h-svh w-full min-w-0 flex-col overflow-hidden bg-gray-975",children:e.jsx(se,{header:i=>e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"z-50 hidden shrink-0 md:block",children:e.jsx(X,{chatList:{hasThreads:i}})}),e.jsx("div",{className:"z-50 shrink-0 md:hidden",children:e.jsx(Z,{chatList:!0})})]}),footer:e.jsx(Y,{variant:"episode-detail",showBanner:!0})})})}const Ie=ae;export{Ie as component};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.