1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d3b74829-8234-4855-917f-0c0e066d082b",e._sentryDebugIdIdentifier="sentry-dbid-d3b74829-8234-4855-917f-0c0e066d082b")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6395],{11724:(e,t,s)=>{s.d(t,{y:()=>r});var n=s(80549),a=s(45215);let l=async e=>{var t;let{data:s}=await a.g.post("/services/request",e);return null!=(t=null==s?void 0:s.data)?t:s},r=()=>(0,n.useMutation)({mutationFn:l})},13544:(e,t,s)=>{s.d(t,{a:()=>r});var n=s(53455),a=s(45215);let l=async e=>{var t;let{model_id:s}=e,{data:n}=await a.g.get("/services",{params:s?{model_id:s}:void 0}),l=null!=(t=null==n?void 0:n.data)?t:n;return{services:Array.isArray(null==l?void 0:l.services)?l.services:[],is_first_time_requester:!!(null==l?void 0:l.is_first_time_requester)}},r=e=>{let{enabled:t,...s}=e;return(0,n.useQuery)({queryKey:["get-services",s.model_id],queryFn:()=>l(s),refetchOnWindowFocus:!1,enabled:t,staleTime:3e4})}},16105:(e,t,s)=>{s.d(t,{A:()=>d});var n=s(95155),a=s(12115),l=s(15239),r=s(36168),i=s(80526),c=s(49599);function d(e){let{src:t,type:s,alt:d,poster:o,className:u,showPlayIcon:m,autoPlay:x,controls:f,fill:g,isActive:h=!0}=e,[v,p]=(0,a.useState)(!0),[j,b]=(0,a.useState)(!1),y=(0,a.useRef)(null),_=h&&x;(0,a.useEffect)(()=>{let e=y.current;if(e){if(!h){e.paused||e.pause(),0!==e.currentTime&&(e.currentTime=0);return}_&&e.paused&&e.play().catch(()=>{})}},[h,x,t]);let N=(0,a.useCallback)(()=>{p(e=>!e&&e)},[]);return((0,a.useEffect)(()=>{p(!0),b(!1)},[t,s]),t)?"image"===s?j?(0,n.jsx)(c.r,{className:g?"absolute inset-0":"aspect-square w-[300px]"}):g?(0,n.jsxs)("div",{className:"relative size-full",children:[v&&(0,n.jsx)("div",{className:"bg-muted absolute inset-0 animate-pulse"}),(0,n.jsx)(l.default,{src:t,alt:d||"",fill:!0,sizes:"100vw",className:(0,i.cn)("object-contain transition-opacity duration-300",v?"opacity-0":"opacity-100",u),onLoad:N,onError:()=>b(!0)})]}):(0,n.jsxs)("div",{className:"relative inline-block",children:[v&&(0,n.jsx)("div",{className:"bg-muted absolute inset-0 animate-pulse rounded"}),(0,n.jsx)(l.default,{src:t,alt:d||"",width:300,height:300,sizes:"100vw",className:(0,i.cn)("transition-opacity duration-300",v?"opacity-0":"opacity-100",u),onLoad:N,onError:()=>b(!0)})]}):g?(0,n.jsxs)("div",{className:"relative size-full overflow-hidden",children:[m&&(0,n.jsx)("div",{className:"pointer-events-none absolute inset-0 z-10 flex items-center justify-center",children:(0,n.jsx)(r.A,{className:"h-10 w-10 text-white drop-shadow-lg"})}),(0,n.jsx)("video",{ref:y,src:t,poster:o,muted:!f,playsInline:!0,autoPlay:_,controls:f,className:(0,i.cn)("absolute inset-0 h-full w-full object-cover focus-visible:border-none focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:outline-none",u)})]}):(0,n.jsxs)("div",{className:"relative inline-block",children:[m&&(0,n.jsx)("div",{className:"pointer-events-none absolute inset-0 z-10 flex items-center justify-center",children:(0,n.jsx)(r.A,{className:"h-10 w-10 text-white drop-shadow-lg"})}),(0,n.jsx)("video",{ref:y,src:t,poster:o,muted:!f,playsInline:!0,autoPlay:_,controls:f,className:(0,i.cn)("h-auto w-full focus-visible:border-none focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:outline-none",u)})]}):null}},18779:(e,t,s)=>{s.d(t,{$:()=>b});var n=s(95155),a=s(12115),l=s(65229),r=s(38975),i=s(18955),c=s(75936),d=s(63186),o=s(97003),u=s(54679),m=s(68122),x=s(7588),f=s(38966),g=s(80526),h=s(11724),v=s(13544),p=s(45014),j=s(17169);function b(e){let{open:t,modelId:s,surface:b,onClose:y}=e,_=(0,i.c)("ChatsPage"),N=(0,x.a)(),w=(0,a.useRef)(null),C=(0,f.rd)(),{openWallet:k}=(0,j.G)(),[F,A]=(0,a.useState)(null),{data:E,isPending:S}=(0,v.a)({model_id:s,enabled:t&&!!s}),L=(null==E?void 0:E.services)||[],{mutateAsync:P,isPending:D}=(0,h.y)(),R=(0,a.useCallback)(async e=>{if(e&&!D)try{await P({model_service_id:e}),(0,p.vj)({}),A(null),y()}catch(u){let e,d,o;if("object"==typeof u&&null!==u&&"response"in u){var t,s,n,a,l,r,i,c;e=(null==(s=u.response)||null==(t=s.data)?void 0:t.message)||(null==(a=u.response)||null==(n=a.data)?void 0:n.error),d=null==(r=u.response)||null==(l=r.data)?void 0:l.error,o=null==(c=u.response)||null==(i=c.data)?void 0:i.custom_code}else u instanceof Error&&(e=u.message);if("insufficient_credits"===d||"insufficient_credits"===e||1712===o){y(),N?C.push("/wallet"):k("default");return}}},[P,D,N,y,k,C]);(0,a.useEffect)(()=>{t||A(null)},[t]),(0,a.useEffect)(()=>
1{if(t&&!N)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){let t=e.target,s=w.current;!s||s.contains(t)||t.closest("#services-button")||y()}},[t,N,y]);let M=(0,n.jsxs)("div",{className:"flex min-h-0 flex-col gap-4 pb-4",children:[(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(d.A,{}),(0,n.jsx)("div",{className:"text-base font-semibold text-white",children:_("servicesPickerTitle")})]}),(0,n.jsx)("div",{className:"text-xs text-white/50",children:_("servicesPickerSubtitle")})]}),S?(0,n.jsx)("div",{className:"max-h-[284px] space-y-3 overflow-y-auto",children:[0,1,2,3].map(e=>(0,n.jsx)(m.E,{className:"h-[62px] w-full rounded-xl"},e))}):(null==L?void 0:L.length)?(0,n.jsx)("div",{className:(0,g.cn)("max-h-[284px] space-y-3 overflow-y-auto overscroll-contain","floating"===b?"h-full touch-pan-y":""),children:L.map(e=>{var t,s,a,l;let r=null!=(t=e.model_service_id)?t:e.id,i=null!=(a=null!=(s=e.customer_credits)?s:e.price)?a:0,d=null!=(l=e.description)?l:_("servicesPickerDefaultCardDescription"),o=F===r;return(0,n.jsx)(c.m,{name:e.name,description:d,credits:i,imageUrl:e.link,disabled:D,className:(0,g.cn)(o?"border-primary bg-primary/10 ring-primary/30":"",o&&D?"opacity-100":""),onClick:()=>{A(r),R(r)}},r)})}):(0,n.jsx)("div",{className:"rounded-xl border border-white/10 bg-[#0A0A0A] px-4 py-6 text-center text-sm text-white/60",children:_("servicesPickerEmpty")})]});return t?N?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"absolute inset-0 z-40 bg-black/40",onClick:y,role:"presentation","aria-hidden":!0}),(0,n.jsx)("div",{className:"absolute right-0 bottom-0 z-50 w-full",ref:w,children:(0,n.jsxs)(r.P.div,{className:"bg-background border-border relative flex max-h-[80vh] w-full flex-col overflow-hidden rounded-t-[12px] border-t px-4 pt-6",initial:{y:"100%",opacity:0}
1,animate:{y:0,opacity:1},transition:{type:"tween",duration:.25,ease:"easeOut"},children:[(0,n.jsx)(o.$,{className:"absolute top-2 right-2",variant:"ghost",size:"icon-sm",onClick:y,children:(0,n.jsx)(l.A,{width:14,height:14,className:"cursor-pointer"})}),(0,n.jsx)("div",{className:"min-h-0 flex-1 touch-pan-y overflow-y-auto overscroll-contain",children:M})]})})]}):(0,n.jsx)(u.lG,{open:t,onOpenChange:e=>e?null:y(),children:(0,n.jsxs)(u.Cf,{className:"flex max-h-[80vh]! max-w-[560px] flex-col",showCloseButton:!0,children:[(0,n.jsx)(u.c7,{children:(0,n.jsx)(u.L3,{children:_("servicesPickerDialogTitle")})}),(0,n.jsx)("div",{ref:w,className:"min-h-0 flex-1",children:M})]})}):null}},21470:(e,t,s)=>{s.d(t,{$:()=>n});let n=(0,s(25959).v)((e,t)=>({isRecording:!1,recordedVoiceNote:null,recordedVoiceNoteUrl:null,waveformLevels:Array(20).fill(5),activeVoiceNote:null,isPlaying:!1,setRecording:t=>e({isRecording:t}),setVoiceNote:(t,s)=>e({recordedVoiceNote:t,recordedVoiceNoteUrl:s}),setWaveform:t=>e({waveformLevels:t}),clearRecording:()=>{let{recordedVoiceNoteUrl:s}=t();
1s&&URL.revokeObjectURL(s),e({recordedVoiceNote:null,recordedVoiceNoteUrl:null,waveformLevels:Array(20).fill(5),isRecording:!1})},play:async s=>{let n=t().activeVoiceNote;n&&n!==s&&(n.pause(),n.currentTime=0);try{await s.play(),e({activeVoiceNote:s,isPlaying:!0})}catch(t){e({isPlaying:!1})}},pause:()=>{let s=t().activeVoiceNote;s&&(s.pause(),e({isPlaying:!1}))},stop:()=>e({activeVoiceNote:null,isPlaying:!1})}))},25216:(e,t,s)=>{s.d(t,{A:()=>l});var n=s(95155),a=s(35299);function l(){return(0,n.jsx)("div",{className:"flex justify-center",children:(0,n.jsx)(a.A,{className:"animate-spin"})})}},30988:(e,t,s)=>{s.d(t,{A:()=>y});var n=s(95155),a=s(12115),l=s(15239),r=s(20063),i=s(62692),c=s(35299),d=s(36489),o=s(18955),u=s(36809),m=s(97003),x=s(38966),f=s(9341),g=s(22511),h=s(81941),v=s(53060),p=s(21050),j=s(90412),b=s(26351);let y=e=>{let{children:t,className:s,size:y="sm",context:_="user_profile"}=e,N=(0,o.c)("UpgradeDialog"),w=(0,d.useSession)(),C=(0,u.Ym)(),k=(0,x.a8)(),F=(0,r.useSearchParams)(),A=(0,x.rd)(),E=(0,h.s)(),{processPayment:S}=(0,p.h)(),{data:L,isLoading:P}=(0,v.J)({}),D=(0,a.useCallback)(async e=>{if(f.F.trackEvent("posthog","model_profile"===_?g.n.MODEL_PROFILE_UPGRADE_CLICKED:g.n.USER_PROFILE_UPGRADE_CLICKED,{}),"unauthenticated"===w.status){let e=(0,i.getCookie)("query"),t=(0,x.Hm)({href:"/login",locale:C});window.location.assign(e?"".concat(t,"?").concat(e):t);return}if(!(null==e?void 0:e.id))return;let t=(0,b.qG)(e),s=null==L?void 0:L.findIndex(t=>t.id===e.id);void 0!==s&&-1!==s&&f.F.trackEvent("ga4","pack_click",{source:"pack-card",category:"Button",value:{position:s,pack_crud:"".concat(e.amount,"_").concat(e.credits)}});let n={id:e.id,amount:e.amount,tag:e.tag,credits:e.credits};await S({pack:n,paymentGateway:t,couponCode:void 0,pathname:k,makePaymentCall:e=>E.mutateAsync(e),redirect:e=>A.replace(e),onSuccess:()=>{},onError:e=>{console.error("Payment error:",e)}})},[w.status,L,k,C,A,F,S,E,_]),R=null==L?void 0:L.reduce((e,t)=>e?t.amount<e.amount?t:e:t,null==L?void 0:L[0]);return(0,n.jsxs)(m.$,{size:y,rounded:"full",disabled:"authenticated"===w.status&&(P||!R||E.isPending),className:"string"==typeof s?s:"bg-[linear-gradient(135deg,#F9AA00_0%,#CC5300_100%)] font-extrabold uppercase transition-transform duration-200 hover:scale-[1.02]",onClick:()=>D(R),children:[E.isPending&&(0,n.jsx)(c.A,{className:"size-3 animate-spin"}),t||(0,n.jsxs)(n.Fragment,{children:[N("upgradeToGold"),(0,n.jsx)(l.default,{src:"".concat(j.LH,"/upgrade/gold-arrow.svg"),alt:"",width:18,height:18,className:"ml-2"})]})]})}},33789:(e,t,s)=>{s.d(t,{p:()=>l});var n=s(95155);s(12115);var a=s(80526);function l(e){let{className:t,type:s,...l}=e;return(0,n.jsx)("input",{type:s,"data-slot":"input",className:(0,a.cn)("dark:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 file:text-foreground placeholder:text-muted-foreground h-9 w-full min-w-0 rounded-md bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm",t),...l})}},33928:(e,t,s)=>{s.d(t,{X:()=>i});var n=s(12115),a=s(53455),l=s(63583),r=s(35163);function i(){let{enabled:e=!1,search:t,limit:s=5}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=(0,l.A)(t,500),{data:c,isLoading:d}=(0,a.useQuery)({queryKey:["get-suggest-model-chat-list",s],queryFn:()=>(0,r.B)({limit:s,offset:0}),refetchOnWindowFocus:!1,enabled:e});return{models:(0,n.useMemo)(()=>{var e;let t=null!=(e=null==c?void 0:c.model_details)?e:[];if(!(null==i?void 0:i.trim()))return t;let s=null==i?void 0:i.toLowerCase();return t.filter(e=>{var t;return(null!=(t=e.name)?t:"").toLowerCase().includes(s)})},[null==c?void 0:c.model_details,i]),isLoading:d}}},35163:(e,t,s)=>{s.d(t,{B:()=>i,e:()=>c});var n=s(25979),a=s(34049),l=s(45215),r=s(66255);let i=async e=>{let{data:t}=await l.g.get("/model/listing-v3",{params:e});return null==t?void 0:t.data},c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(0,n.useInfiniteQuery)({queryKey:(0,r.WA)(e),queryFn:t=>{let{pageParam:s}=t;return i({...e,offset:s})},initialPageParam:t,getNextPageParam:r.LO,placeholderData:a.rX,refetchOnWindowFocus:!1,staleTime:3e4})}},42705:(e,t,s)=>{s.d(t,{A:()=>v,a:()=>h});var n=s(95155),a=s(12115),l=s(15239),r=s(71360),i=s(53511),c=s(17188),d=s(21470),o=s(90412),u=s(75545),m=s(80526);function x(e){let{levels:t,activeUntilRatio:s,className:a,activeClassName:l="bg-primary",inactiveBarClassName:r="bg-muted-foreground
1/70"}=e;return(0,n.jsx)("div",{className:(0,m.cn)("flex min-w-0 flex-1 items-center justify-center gap-0.5 overflow-hidden",a),children:t.map((e,a)=>{let i="number"==typeof s&&a/Math.max(t.length,1)<s;return(0,n.jsx)("div",{className:(0,m.cn)("w-0.75 shrink-0 rounded-full",i?l:r),style:{height:"".concat(Math.min(e,22),"px")}},a)})})}var f=s(85921);let g=e=>{let{levels:t,onPlay:s,onPause:l,onDelete:c,onSend:d,audioRef:o,mediaKey:m,sendDisabled:g}=e,[h,v]=(0,a.useState)(!1),[p,j]=(0,a.useState)(0),b=(0,a.useRef)(null);return(0,a.useEffect)(()=>{let e=o.current;if(!e)return;j(0),v(!e.paused);let t=()=>{e.duration&&Number.isFinite(e.duration)&&j(e.currentTime/e.duration)},s=()=>v(!0),n=()=>v(!1),a=()=>{v(!1),j(0)};return e.addEventListener("timeupdate",t),e.addEventListener("ended",a),e.addEventListener("play",s),e.addEventListener("pause",n),()=>{e.removeEventListener("timeupdate",t),e.removeEventListener("ended",a),e.removeEventListener("play",s),e.removeEventListener("pause",n)}},[o,m]),(0,n.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,n.jsx)(u.j,{onClick:c,className:"bg-secondary text-secondary-foreground cursor-pointer",ariaLabel:"Delete recording",children:(0,n.jsx)(r.A,{className:"size-4"})}),(0,n.jsx)(u.j,{onClick:()=>{h?(l(),v(!1)):(s(),v(!0))},className:"bg-secondary text-secondary-foreground cursor-pointer",ariaLabel:h?"Pause preview":"Play preview",children:h?(0,n.jsx)(i.A,{className:"size-4",fill:"
1currentColor"}):(0,n.jsx)(f.A,{className:"size-4"})}),(0,n.jsx)("div",{ref:b,onClick:e=>{let t=o.current,s=b.current;if(!t||!s||!t.duration)return;let n=s.getBoundingClientRect();if(!n.width)return;let a=Math.min(1,Math.max(0,(e.clientX-n.left)/n.width));t.currentTime=a*t.duration,j(a)},className:"flex h-8 min-h-8 min-w-0 flex-1 cursor-pointer items-center",role:"presentation",children:(0,n.jsx)(x,{levels:t,activeUntilRatio:p,activeClassName:"bg-rose-500",inactiveBarClassName:"bg-neutral-400/60",className:"h-full w-full"})})]})},h=e=>{if(!e||!Number.isFinite(e))return"0:00";let t=Math.floor(e/60),s=Math.floor(e%60);return"".concat(t,":").concat(s<10?"0":"").concat(s)};function v(e){let{sendVoiceMessage:t,stopRecording:s,duration:m,messageCost:f}=e,v=(0,a.useRef)(null),p=(0,d.$)(e=>e.isRecording),j=(0,d.$)(e=>e.recordedVoiceNote),b=(0,d.$)(e=>e.recordedVoiceNoteUrl),y=(0,d.$)(e=>e.waveformLevels),_=(0,d.$)(e=>e.clearRecording),N=(0,d.$)(e=>e.play),w=(0,d.$)(e=>e.pause),C=!p&&!j,k=!p&&j&&b,F=()=>{j&&(t(j),_())};return p?(0,n.jsxs)("div",{className:"bg-input/30 flex h-10 w-full items-center gap-2 rounded-md px-2 py-1",children:[(0,n.jsx)(u.j,{onClick:()=>{s(!0),_()},className:"cursor-pointer",children:(0,n.jsx)(r.A,{className:"size-4"})}),(0,n.jsx)("span",{className:"text-sm",children:h(m)}),(0,n.jsx)(x,{levels:y}),(0,n.jsx)(u.j,{onClick:()=>s(!1),className:"cursor-pointer",children:(0,n.jsx)(i.A,{className:"size-4",fill:"
1currentColor"})})]}):C?(0,n.jsx)("div",{className:"bg-input/30 flex h-10 w-full items-center justify-center rounded-md",children:(0,n.jsx)("span",{className:"text-muted-foreground text-xs",children:"Processing..."})}):k?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"bg-input/30 flex h-10 w-full items-center gap-2 rounded-md px-2 py-1",children:[(0,n.jsx)("audio",{ref:v,src:b,preload:"auto"}),(0,n.jsx)(g,{mediaKey:b,levels:y,audioRef:v,onPlay:()=>v.current&&N(v.current),onPause:()=>w(),onDelete:_,onSend:F})]}),(0,n.jsxs)(u.j,{onClick:F,className:"relative cursor-pointer",children:[(0,n.jsx)(c.A,{className:"size-6"}),f?(0,n.jsxs)("div",{className:"bg-card absolute right-1 -bottom-1 flex min-w-[29px] items-center justify-center gap-0.5 rounded-full p-px",children:[(0,n.jsx)(l.default,{src:"".concat(o.LH,"/coins.svg"),width:10,height:10,alt:"",className:"shrink-0"}),(0,n.jsx)("span",{className:"text-[10px] font-medium",children:f})]}):null]})]}):null}},61453:(e,t,s)=>{s.d(t,{D:()=>a});var n=s(95155);let a=e=>{let{className:t}=e;return(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:t,children:(0,n.jsx)("path",{d:"M16 13L21.223 16.482C21.2983 16.5321 21.3858 16.5609 21.4761 16.5652C21.5664 16.5695 21.6563 16.5493 21.736 16.5066C21.8157 16.4639 21.8824 16.4004 21.9289 16.3228C21.9754 16.2452 22 16.1565 22 16.066V7.87002C22 7.78204 21.9768 7.69562 21.9328 7.61947C21.8887 7.54332 21.8253 7.48014 21.7491 7.43632C21.6728 7.3925 21.5863 7.36958 21.4983 7.36988C21.4103 7.37017 21.324 7.39368 21.248 7.43802L16 10.5M4 6H14C15.1046 6 16 6.89543 16 8V16C16 17.1046 15.1046 18 14 18H4C2.89543 18 2 17.1046 2 16V8C2 6.89543 2.89543 6 4 6Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}},63186:(e,t,s)=>{s.d(t,{A:()=>a});var n=s(95155);function a(){return(0,n.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,n.jsx)("path",{d:"M0 16C0 7.16344 7.16344 0 16 0C24.8366 0 32 7.16344 32 16C32 24.8366 24.8366 32 16 32C7.16344 32 0 24.8366 0 16Z",fill:"url(#paint0_linear_6519_48362)"}),(0,n.jsxs)("g",{clipPath:"url(#clip0_6519_48362)",children:[(0,n.jsx)("path",{d:"M15.345 9.87239C15.3735 9.71946 15.4547 9.58133 15.5744 9.48193C15.694 9.38254 15.8447 9.32812 16.0003 9.32812C16.1559 9.32812 16.3065 9.38254 16.4262 9.48193C16.5459 9.58133 16.6271 9.71946 16.6556 9.87239L17.3563 13.5777C17.4061 13.8412 17.5341 14.0835 17.7236 14.273C17.9132 14.4626 18.1555 14.5906 18.419 14.6404L22.1243 15.3411C22.2772 15.3696 22.4154 15.4508 22.5147 15.5705C22.6141 15.6901 22.6686 15.8408 22.6686 15.9964C22.6686 16.152 22.6141 16.3026 22.5147 16.4223C22.4154 16.542 22.2772 16.6232 22.1243 16.6517L18.419 17.3524C18.1555 17.4022 17.9132 17.5302 17.7236 17.7197C17.5341 17.9093 17.4061 18.1516 17.3563 18.4151L16.6556 22.1204C16.6271 22.2733 16.5459 22.4114 16.4262 22.5108C16.3065 22.6102 16.1559 22.6647 16.0003 22.6647C15.8447 22.6647 15.694 22.6102 15.5744 22.5108C15.4547 22.4114 15.3735 22.2733 15.345 22.1204L14.6443 18.4151C14.5945 18.1516 14.4665 17.9093 14.2769 17.7197C14.0874 17.5302 13.8451 17.4022 13.5816 17.3524L9.87629 16.6517C9.72336 16.6232 9.58524 16.542 9.48584 16.4223C9.38644 16.3026 9.33203 16.152 9.33203 15.9964C9.33203 15.8408 9.38644 15.6901 9.48584 15.5705C9.58524 15.4508 9.72336 15.3696 9.87629 15.3411L13.5816 14.6404C13.8451 14.5906 14.0874 14.4626 14.2769 14.273C14.4665 14.0835 14.5945 13.8412 14.6443 13.5777L15.345 9.87239Z",stroke:"white",strokeWidth:"1.3326",strokeLinecap:"round",strokeLinejoin:"round"}),(0,n.jsx)("path",{d:"M21.332 9.33594V12.0026",stroke:"white",strokeWidth:"1.3326",strokeLinecap:"round",strokeLinejoin:"round"}),(0,n.jsx)("path",{d:"M22.6667 10.6641H20",stroke:"white",strokeWidth:"1.3326",strokeLinecap:"round",strokeLinejoin:"round"}),(0,n.jsx)("path",{d:"M10.6654 22.6667C11.4017 22.6667 11.9987 22.0697 11.9987 21.3333C11.9987 20.597 11.4017 20 10.6654 20C9.92898 20 9.33203 20.597 9.33203 21.3333C9.33203 22.0697 9.92898 22.6667 10.6654 22.6667Z",stroke:"white",strokeWidth:"1.3326",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,n.jsxs)("defs",{children:[(0,n.jsxs)("linearGradient",{id:"paint0_linear_6519_48362",x1:"0",y1:"0",x2:"32",y2:"32",gradientUnits:"userSpaceOnUse",children:[(0,n.jsx)("stop",{stopColor:"#9810FA"}),(0,n.jsx)("stop",{offset:"1",stopColor:"#C6005C"})]}),(0,n.jsx)("clipPath",{id:"clip0_6519_48362",children:(0,n.jsx)("rect",{width:"16",height:"16",fill:"white",transform:"translate(8 8)"})})]})]})}s(12115)},66255:(e,t,s)=>{function n(e){return!!(e.age||e.credits||e.language||e.category||e.following||e.is_premium||e.is_to
1p||e.is_new||e.profile_plan_purchased||e.showOffline)}function a(e,t){var s,n,a,l;let r=e.age||void 0,i=e.credits||void 0;return{limit:t,sort_field:"rating",max_age:r?Number(null==(s=r.split("-"))?void 0:s[1]):void 0,min_age:r?Number(null==(n=r.split("-"))?void 0:n[0]):void 0,max_credits:i?Number(null==(a=i.split("-"))?void 0:a[1]):void 0,min_credits:i?Number(null==(l=i.split("-"))?void 0:l[0]):void 0,language:e.language||void 0,category:e.category||void 0,is_following:e.following||void 0,is_premium:e.is_premium?1:void 0,is_top:e.is_top?1:void 0,is_new:e.is_new?1:void 0,profile_plan_purchased:e.profile_plan_purchased?1:void 0,online_status:e.showOffline?[0,1,2]:[0,1]}}function l(e){return["get-model-listing-v3",e]}function r(e){let{total_rows:t,offset:s}=e.aggregate,n=s+e.model_details.length;return n<t?n:void 0}function i(e){let t=new Set,s=[];for(let n of e)t.has(n.id)||(t.add(n.id),s.push(n));return s}s.d(t,{AI:()=>a,LO:()=>r,WA:()=>l,ar:()=>i,bD:()=>n})},75545:(e,t,s)=>{s.d(t,{j:()=>l});var n=s(95155),a=s(80526);function l(e){let{onClick:t,className:s,ariaLabel:l,children:r,type:i="button",disabled:c=!1}=e;return(0,n.jsx)("button",{type:i,onClick:t,disabled:c,"aria-label":l,className:(0,a.cn)("flex size-9 shrink-0 items-center justify-center rounded-full transition-colors",c&&"pointer-events-none opacity-50",s),children:r})}},75936:(e,t,s)=>{s.d(t,{m:()=>d,q:()=>c});var n=s(95155),a=s(15239),l=s(95740),r=s(80526),i=s(90412);let c="Request a fantasy based on your requirement.";function d(e){let{name:t,description:s,credits:c,imageUrl:d,disabled:o,onClick:u,className:m}=e,x=null==d?void 0:d.trim();return(0,n.jsxs)("button",{type:"button",className:(0,r.cn)("flex w-full cursor-pointer items-center gap-3 rounded-xl border border-white/10 bg-[#0A0A0A] px-4 py-3 text-left transition-colors","hover:bg-white/3",o?"opacity-70":"",m),disabled:o,onClick:u,children:[(0,n.jsx)("div",{className:"relative flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-white/5",children:x?(0,n.jsx)(a.default,{src:x,alt:t,width:28,height:28,className:"size-7 object-contain"}):(0,n.jsx)(l.A,{className:"size-5 text-white/70"})}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("div",{className:"truncate text-sm font-semibold text-white",children:t}),(0,n.jsx)("div",{className:"truncate text-xs text-white/50",children:s})]}),(0,n.jsxs)("div",{className:"flex shrink-0 items-center gap-1 rounded-full bg-white/5 px-3 py-1.5 text-sm text-white",children:[(0,n.jsx)(a.default,{src:"".concat(i.LH,"/coins.svg"),alt:"",width:18,height:18}),(0,n.jsx)("span",{className:"font-medium",children:c})]})]})}},86395:(e,t,s)=>{s.d(t,{ep:()=>e4,b0:()=>y,C0:()=>eJ});var n=s(95155),a=s(12115),l=s(86651),r=s(36489),i=s(18955),c=s(25216),d=s(33789),o=s(80526),u=s(9341),m=s(22511),x=s(4348),f=s(33928),g=s(52619),h=s.n(g),v=s(33884),p=s(59499);function j(e){let{className:t,label:s="Referred"}=e;return(0,n.jsx)("span",{className:(0,o.cn)("inline-flex items-center justify-center px-2 py-0.5","bg-white/2 text-[#FFB1C7]","text-[8px] font-medium","rounded-full border border-[#FFB1C7]",t),children:s})}function b(e){let{name:t,profilePic:s,isOnline:a,unreadCount:l,timestamp:r,messageType:i,messageContent:c,isFloating:d,isSelected:u,href:m,onClick:x,showMessage:f=!0,t:g,is_referred:b}=e;return(0,n.jsx)(h(),{href:m||"",onClick:x,className:(0,o.cn)("flex cursor-pointer items-center justify-between gap-1",d?"border-border/40 hover:bg-muted/10 border-b p-3":"hover:bg-muted/10 p-4",u&&"bg-muted/10"),children:(0,n.jsxs)("div",{className:"flex flex-1 items-center gap-4",children:[(0,n.jsxs)("div",{className:"relative size-12 shrink-0",children:[s?(0,n.jsxs)(v.eu,{className:"size-12",children:[(0,n.jsx)(v.BK,{src:s,alt:"",className:"object-cover"}),(0,n.jsx)(v.q5,{children:null==t?void 0:t[0]})]}):null,!!a&&(0,n.jsx)("span",{className:"absolute right-0 bottom-0 size-3 rounded-full border-2 border-black bg-green-500"})]}),(0,n.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:(0,o.cn)("max-w-40 truncate font-semibold text-[#F1F5F9]",d?"text-sm":"text-base"),children:t}),b?(0,n.jsx)(j,{}):null,l?(0,n.jsx)("span",{className:"bg-primary flex aspect-square min-w-4 items-center justify-center rounded-full px-1 py-0.5",children:(0,n.jsx)("span",{className:"text-[10px] leading-none font-medium text-[#F1F5F9]",children:l>99?"99+":l})}):null]}),r&&(0,n.jsx)("span",{className:(0,o.cn)("text-muted-foreground float-right font-medium whitespace-nowrap",d?"text-[10px]":"text-xs"),children:function(e){let t=new Date;return(0,p.ro)(e,t)?(0,p.ty)(e):(0,p.Rz)(e,t)?(0,p.F$)(e):(0,p.u2)(e)}(r)})]}),f&&i&&(0,n.jsx)("div",{className:(0,o.cn)("text-muted-foreground w-50 truncate",d?"text-xs":"text-sm"),children:function(e,t,s){var n,a,l,r,i,c,d;switch(e){case"text":return"string"==typeof t?t:null;case"image":return null!=(n=null==s?void 0:s.attachmentPreview)?n:"Attachment \uD83D\uDCF7";case"video":return null!=(a=null==s?void 0:s.videoPreview)?a:" Video \uD83C\uDFA5";case"request_gift":return null!=(l=null==s?void 0:s.giftRequestedPreview)?l:"Requested a gift \uD83C\uDF81";case"sent_gift":return null!=(r=null==s?void 0:s.giftSentPreview)?r:"Sent a gift \uD83C\uDF81";case"album":return null!=(i=null==s?void 0:s.albumSentPreview)?i:"Sent an album \uD83D\uDDBCï¸";case"service_request":return"Requested a fantasy";case"service_menu":return"Sent services menu";case"audio":return null!=(c=null==s?void 0:s.audioSentPreview)?c:"\uD83C\uDF99ï¸ Sent an audio \uD83C\uDFA4";case"call":return null!=(d=null==s?void 0:s.callPreview)?d:"Video call";default:return null}}(i,c,{attachmentPreview:g("attachmentPreview"),giftRequestedPreview:g("giftRequestedPreview"),giftSentPreview:g("giftSentPreview"),albumSentPreview:g("albumSentPreview"),audioSentPreview:g("audioSentPreview"),callPreview:g("callPreview")})})]})]})})}function y(e){var t;let{surface:s,username:g,onSelectModel:h,header:v}=e,p=(0,i.c)("ChatsPage"),{data:j}=(0,r.useSession)(),y=null==j||null==(t=j.user)?void 0:t.userName,_=(0,a.useRef)(null),N="floating"===s,{conversations:w,isLoading:C,isFetchingMore:k,hasMore:F,fetchMore:A,search:E,handleSearch:S}=(0,x.Q)(),{models:L,isLoading:P}=(0,f.X)({search:E,enabled:!C&&0===w.length}),D=!C&&0===w.length&&L.length>0?p("suggestedModels"):p("allMessages");return(0,a.useEffect)(()=>{let e=new IntersectionObserver(e=>{e[0].isIntersecting&&F&&!k&&A()},{threshold:.1});return _.current&&e.observe(_.current),()=>e.disconnect()},[F,k,A]),(0,n.jsxs)("div",{className:"flex flex-1 flex-col gap-4 md:overflow-hidden",children:[v,(0,n.jsxs)("div",{className:(0,o.cn)("flex items-center gap-2",N?"mx-3 rounded-md":"mx-4 rounded-md"),children:[(0,n.jsx)(d.p,{placeholder:p("searchMessages"),className:(0,o.cn)(N?"h-10 text-xs font-medium":"h-12"),value:E,onChange:S}),(0,n.jsx)(l.A,{className:(0,o.cn)("text-neutral-400",N?"h-4":"h-6")})]}),(0,n.jsxs)("div",{className:(0,o.cn)("flex flex-1 flex-col",N?"gap-3 md:overflow-hidden":"gap-4 pb-14 md:overflow-y-auto md:pb-0"),children:[(0,n.jsx)("div",{className:(0,o.cn)("text-muted-foreground px-2 text-sm",N?"mx-3":"mx-2"),children:D}),(0,n.jsx)("div",{className:(0,o.cn)("flex flex-1 flex-col md:overflow-x-hidden md:overflow-y-scroll"),children:C||P?(0,n.jsx)("div",{className:"flex-1",children:(0,n.jsx)(c.A,{})}):w.length>0?(0,n.jsxs)(n.Fragment,{children:[w.map(e=>{var t,s;let a=e.receiver_id===y?null!=(t=e.sender_id)?t:"":null!=(s=e.receiver_id)?s:"",l=g===e.sender_id||g===e.receiver_id;return(0,n.jsx)(b,{name:e.name,profilePic:e.profile_pic||"",isOnline:e.is_online,unreadCount:e.unread_count,timestamp:e.time_stamp,messageType:e.message_type,messageContent:e.message_content,isFloating:N,isSelected:l,href:N?"":"/chats/".concat(a),onClick:()=>{u.F.trackEvent("posthog",m.n.CHAT_LISTING_MODEL_CLICKED,{model_name:e.name,suggested_model:!1}),N&&(null==h||h(a))},is_referred:!!e.is_referred,t:p},"".concat(e.sender_id,"-").concat(e.receiver_id,"-").concat(e.time_stamp))}),F&&(0,n.jsx)("div",{ref:_,className:"flex justify-center p-4",children:k?(0,n.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,n.jsx)(c.A,{}),p("loadingMoreChats")]}):(0,n.jsx)("div",{className:"h-4"})})]}):(null==L?void 0:L.length)>0?(0,n.jsx)(n.Fragment,{children:null==L?void 0:L.map(e=>{let t=g===e.user_name;return(0,n.jsx)(b,{name:e.name,profilePic:e.link,isOnline:e.is_online,timestamp:"",isFloating:N,isSelected:t,href:N?"":"/chats/".concat(e.user_name),onClick:()=>{u.F.trackEvent("posthog",m.n.CHAT_LISTING_MODEL_CLICKED,{model_name:e.name,suggested_model:!0}),N&&(null==h||h(e.user_name))},showMessage:!1},e.user_name)})}):(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[(0,n.jsx)("div",{className:"text-sm text-[#94A3B8]",children:E?p("noChatsFoundSearch"):p("noChatsYet")}),(0,n.jsx)("div",{className:"mt-1 text-xs text-[#64748B]",children:E?p("tryDifferentSearch"):p("startConversation")})]})})]})]})}var _=s(35795),N=s(70532),w=s(30988),C=s(7588),k=s(38966),F=s(25979),A=s(31871),E=s(45215);function S(e){return["chat-history",e]}async function L(e){let{data:t}=await E.g.post("/chat/chat-history",{senderId:e.senderId,recieverId:e.receiverId,limit:e.limit,offset:e.offset,callId:e.callId}),s=null==t?void 0:t.data;return{messages:s.history,hasMore:s.aggregate.total_rows>s.aggregate.offset+s.aggregate.page_size}}
1function P(e){A.A.invalidateQueries({queryKey:S(e)})}var D=s(54768),R=s(80549);let M=()=>{let e=async e=>{let{data:t}=await E.g.post("/chat/gift",e);return null==t?void 0:t.data};return{...(0,R.useMutation)({mutationFn:t=>e(t)})}};var z=s(84674),q=s(53455);let I=async e=>{let{data:t}=await E.g.post("/referral/customer/check-free-chat",e);return null==t?void 0:t.data},T=e=>{let{enabled:t,...s}=e,n=["check-free-chat",s];return(0,q.useQuery)({queryKey:n,queryFn:()=>I(s),refetchOnWindowFocus:!1,enabled:null==t||t})};var B=s(76491),O=s(81782),$=s(45014),H=s(16901),G=s(3033),U=s(17169),K=s(92500);let V=e=>{let{className:t,children:s,onClick:a}=e;return(0,n.jsx)("div",{className:(0,o.cn)("pointer-events-auto absolute inset-0 z-30 flex flex-col backdrop-blur-[2px]",a&&"cursor-pointer",t),"aria-hidden":!a,onClick:a,children:s})};var W=s(15239),Q=s(35299),Z=s(18085),X=s(99708),Y=s(17188),J=s(8463);function ee(){return(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-copy-plus-icon lucide-copy-plus",children:[(0,n.jsx)("line",{x1:"15",x2:"15",y1:"12",y2:"18"}),(0,n.jsx)("line",{x1:"12",x2:"18",y1:"15",y2:"15"}),(0,n.jsx)("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),(0,n.jsx)("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})}var et=s(97003),es=s(28171),en=s(21470);let ea=["get-translation-status"],el=async()=>{let{data:e}=await E.g.put("/chat/translation");return null==e?void 0:e.data},er=async()=>{let{data:e}=await E.g.get("/chat/translation-status");return null==e?void 0:e.data},ei=e=>(0,q.useQuery)({queryKey:["get-translation-status"],queryFn:()=>er(),refetchOnWindowFocus:!1,initialData:e});var ec=s(23435),ed=s(90412),eo=s(59e3),eu=s(39142),em=s(75545);let ex=e=>{let{recording:t,onStart:s,onStop:a}=e;return(0,n.jsx)(em.j,{onClick:t?a:s,className:"text-white ".concat(t?"bg-primary animate-pulse":"bg-secondary hover:bg-white/5"),ariaLabel:t?"Stop recording":"Start recording",children:t?(0,n.jsx)(eo.A,{size:16}):(0,n.jsx)(eu.A,{size:18})})};var ef=s(42705),eg=s(18779),eh=s(65229),ev=s(38975),ep=s(88102),ej=s(68122);let eb=async()=>{let{data:e}=await E.g.get("/chat/gift?limit=1000&offset=0");return null==e?void 0:e.data},ey=()=>(0,q.useQuery)({queryKey:["get-chat-gifts"],queryFn:()=>eb(),refetchOnWindowFocus:!1});function e_(e){let{src:t,alt:s}=e,[l,r]=(0,a.useState)(!1);return(0,n.jsxs)("div",{className:"relative size-12",children:[!l&&(0,n.jsx)(ej.E,{className:"absolute inset-0 size-12 rounded"}),(0,n.jsx)(W.default,{src:t,alt:s,width:48,height:48,className:"transition-opacity duration-200 ".concat(l?"opacity-100":"opacity-0"),onLoad:()=>r(!0)})]})}function eN(e){let{surface:t,onClose:s,onSendGift:l}=e,r=(0,i.c)("ChatsPage"),d=(0,a.useRef)(null),{data:x,isLoading:f}=ey(),g=M(),[h,v]=(0,a.useState)(null),p=(0,a.useCallback)(e=>{e.is_enabled&&v(e.id===(null==h?void 0:h.id)?null:e)},[null==h?void 0:h.id]);return(0,a.useEffect)(()=>{function e(e){let t=e.target,n=d.current,a=document.getElementById("wallet-sheet"),l=n&&!n.contains(t)&&!t.closest("#gift-button"),r=a&&a.contains(t);l&&!r&&s()}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[s]),(0,n.jsx)("div",{className:"absolute right-0 bottom-0 z-50 w-full",ref:d,children:(0,n.jsxs)(ev.P.div,{className:"bg-background border-border relative w-full rounded-t-[12px] border-t px-4 py-6",initial:{y:"100%",opacity:0}
1,animate:{y:0,opacity:1},transition:{type:"tween",duration:.25,ease:"easeOut"},children:[(0,n.jsx)(et.$,{className:"absolute top-2 right-2",variant:"ghost",size:"icon-sm",onClick:s,children:(0,n.jsx)(eh.A,{width:14,height:14,className:"cursor-pointer"})}),(0,n.jsx)("div",{className:"mb-1 flex justify-center",children:(0,n.jsx)("span",{className:"text-primary-text text-center text-base font-semibold",children:r("selectGift")})}),(0,n.jsx)("div",{className:"mb-6 flex justify-center",children:(0,n.jsx)("span",{className:"text-center text-xs font-normal text-neutral-400",children:r("giftsOnlyWithCredits")})}),f?(0,n.jsx)(c.A,{}):(0,n.jsx)("div",{className:(0,o.cn)("mb-6 grid gap-3 overflow-y-scroll lg:gap-6","floating"===t?"max-h-[300px] grid-cols-4":"in-call"===t?"max-h-[30vh] grid-cols-4":"max-h-[30vh] grid-cols-4 lg:grid-cols-8 xl:grid-cols-10"),children:null==x?void 0:x.map(e=>(0,n.jsxs)("div",{className:(0,o.cn)("flex cursor-pointer flex-col items-center gap-1 border p-2",(null==h?void 0:h.id)===e.id?"border-primary bg-primary/10 rounded-xl":"border-transparent",e.is_enabled?"":"grayscale"),onClick:()=>p(e),children:[(0,n.jsx)(e_,{src:e.link,alt:e.name}),(0,n.jsx)("span",{className:"text-center text-xs font-semibold text-[#F1F5F9]",children:e.name}),(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,n.jsx)(W.default,{src:"".concat(ed.LH,"/coins.svg"),alt:"",width:12,height:12}),(0,n.jsx)("span",{className:"text-[10px] font-light text-[#F1F5F9]",children:e.amount})]})]},e.id))}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)(ep.U,{}),(0,n.jsx)(et.$,{disabled:!h||g.isPending,onClick:()=>{h&&(u.F.trackEvent("posthog",m.n.CHAT_GIFT_SENT,{gift_name:h.name,amount:h.amount}),l(h.id,h.link,h.amount))},children:g.isPending?(0,n.jsx)(Q.A,{className:"animate-spin"}):(0,n.jsxs)(n.Fragment,{children:[r("sendGift")," ",(0,n.jsx)(Z.A,{})]})})]})]})})}function ew(e){let{surface:t,onSend:s,onSendGift:l,isBlocked:r,isBlockedLoading:c,modelId:x,messagesCount:f,callId:g,isChatFree:h,onExpiredOpenWallet:v,sendVoiceMessage:p}=e,j=(0,i.c)("ChatsPage"),b=(0,k.rd)(),y=(0,k.a8)(),[_,w]=(0,a.useState)(""),[C,F]=(0,a.useState)(!1),[E,S]=(0,a.useState)(!1),[L,P]=(0,a.useState)(!1),D=(0,a.useRef)(0),M="in-call"===t,{data:z}=(0,ec.ny)(String(x)),q=null!=r?r:null==z?void 0:z.is_blocked,I=_.trim().length>0,{data:T}=(0,O.B7)(),{data:B}=ei(),$={...(0,R.useMutation)({mutationFn:el,onSuccess:e=>{A.A.setQueryData(ea,t=>{var s;let n=null!=(s=null==e?void 0:e.is_translation)?s:+((null==t?void 0:t.is_translation)!==1);return{...t,is_translation:n}})}})},G=function(){let e=(0,en.$)(e=>e.isRecording),t=(0,en.$)(e=>e.setRecording),s=(0,a.useRef)(null),n=(0,a.useRef)(null),l=(0,a.useRef)(null),r=(0,a.useRef)(null),i=(0,a.useRef)(null),[c,d]=(0,a.useState)(0);return(0,a.useEffect)(()=>{if(!e)return void d(0);let t=setInterval(()=>{d(e=>e+1)},1e3);return()=>clearInterval(t)},[e]),{startRecording:async()=>{try{l.current=await navigator.mediaDevices.getUserMedia({audio:!0}),s.current=new AudioContext,await s.current.audioWorklet.addModule("/audio/recorder-worklet.js");let e=s.current.createMediaStreamSource(l.current),a=new AudioWorkletNode(s.current,"recorder-processor");n.current=new Worker("/audio/mp3.worker.js"),n.current.postMessage({type:"init",data:{sampleRate:s.current.sampleRate}}),a.port.onmessage=e=>{var t;null==(t=n.current)||t.postMessage({type:"encode",data:e.data})},r.current=s.current.createAnalyser(),r.current.fftSize=64,e.connect(r.current),e.connect(a);let c=new Uint8Array(r.current.frequencyBinCount),{setWaveform:d}=en.$.getState(),o=0,u=e=>{r.current&&(e-o>50&&(r.current.getByteFrequencyData(c),d(Array.from(c.slice(0,20)).map(e=>Math.max(5,e/4))),o=e),i.current=requestAnimationFrame(u))};u(0),t(!0)}catch(e){(0,es.oR)({title:"Recording error",description:String(e),variant:"destructive"})}},stopRecording:function(){var e,t;let a=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!n.current)return;let{setVoiceNote:r}=en.$.getState();en.$.setState({isRecording:!1}),n.current.onmessage=e=>{if(e.data.cancelled)return;let t=new File([e.data.blob],"recording-".concat(Date.now(),".mp3"),{type:"audio/mp3"}),s=URL.createObjectURL(t);r(t,s)},n.current.postMessage({type:"finish",cancel:a}),null==(e=s.current)||e.close(),null==(t=l.current)||t.getTracks().forEac
1h(e=>e.stop()),i.current&&cancelAnimationFrame(i.current)},duration:c}}(),{isRecording:U,recordedVoiceNote:K,recordedVoiceNoteUrl:V}=(0,en.$)(),er=!M&&(U||!!(K&&V)),eo=!!(null==T?void 0:T.is_free_user),eu=!M&&!g&&eo&&!h,em=!g&&eo&&!h,eh=!!q,ev=(0,H.U)(e=>e.endTime),ep=eu&&null!==ev&&Date.now()<ev,ej=!!(null==B?void 0:B.is_translation),[eb,ey]=(0,J.ZA)("enableGift",J.cr),[e_,ew]=(0,J.ZA)("enableService",J.cr);(0,a.useEffect)(()=>{eb&&(F(!0),ey(null))},[eb,ey]),(0,a.useEffect)(()=>{e_&&!M&&(S(!0),ew(null))},[e_,ew,M]),(0,a.useEffect)(()=>{L&&f>D.current&&(D.current=0,P(!1))},[f,L]),(0,a.useEffect)(()=>{if(!L)return;let e=setTimeout(()=>{P(!1),D.current=0},1e4);return()=>clearTimeout(e)},[L]);let eC=(0,a.useCallback)(()=>{b.push("".concat(y,"?dialogType=upgrade"))},[y,b]),ek=(0,a.useCallback)(()=>{v?v():eC()},[v,eC]),eF=(0,a.useCallback)(()=>{if(I&&!eh){if(ep||em)return void ek();!1!==s(_.trim())&&(D.current=f,P(!0),w(""))}},[_,I,eh,s,f,ep,em,ek]),eA=(0,a.useCallback)(async(e,t,s)=>{D.current=f,P(!0),await l(e,t,s),F(!1)},[l,f]),eE=(0,a.useCallback)(async e=>{await p(e)&&(D.current=f,P(!0))},[p,f]),eS=(0,a.useCallback)(e=>{if("Enter"===e.key&&!e.shiftKey){if(e.preventDefault(),ep||em)return void ek();eF()}},[eF,ek,ep,em]),eL=(0,a.useCallback)(async()=>{if(eu)return void ek();if(!$.isPending)try{await $.mutateAsync()}catch(e){}},[$,eu,ek]);return c?null:eh?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex flex-col items-center text-center",children:[(0,n.jsxs)("div",{className:"mb-1 flex items-center gap-2",children:[q?(0,n.jsx)(W.default,{src:"".concat(ed.LH,"/chat/comment-error.png"),alt:"error",width:20,height:20}):(0,n.jsx)(N.A,{size:20,stroke:"#FF9500"}),(0,n.jsx)("span",{className:"align-middle text-xs leading-5 font-semibold text-neutral-400",children:j("chatDisabled")})]}),(0,n.jsx)("div",{className:"mb-4 max-w-75 text-center align-middle text-xs leading-5 font-bold",children:j(q?"cannotSendMessages":"waitForModel")}),(0,n.jsxs)(et.$,{disabled:L,size:"sm",className:"w-32.5!",onClick:()=>{F(!0)},children:[L?(0,n.jsx)(Q.A,{className:"animate-spin"}):null,j("sendGift")," ",(0,n.jsx)(Z.A,{})]})]}),C&&(0,n.jsx)(eN,{surface:t,onClose:()=>F(!1),onSendGift:eA})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"flex flex-col gap-1",children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[$.isPending?(0,n.jsx)(Q.A,{className:"text-muted-foreground size-6.25 animate-spin","aria-hidden":!0}):(0,n.jsx)(W.default,{src:"".concat(ed.LH,"/chat/translate-").concat(ej?"active":"deactive",".svg"),alt:"translate-status",className:(0,o.cn)("cursor-pointer",(!eo||h)&&ej?"":"grayscale"),width:25,height:25,onClick:eL}),(0,n.jsx)("div",{className:(0,o.cn)("flex flex-1 items-center gap-2 rounded-md",L&&"pointer-events-none opacity-70"),children:er?(0,n.jsx)(ef.A,{sendVoiceMessage:eE,stopRecording:G.stopRecording,duration:G.duration,messageCost:"0.5"}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"relative flex-1",children:[(0,n.jsx)(d.p,{placeholder:j(L?"sending":"startTyping"),className:(0,o.cn)("border-none bg-transparent","h-10",M?"text-base font-medium text-white":""),readOnly:L,disabled:L,value:_,onChange:e=>w(e.target.value),onKeyDown:eS,"aria-busy":L}),!I&&!L&&!ep&&!em&&!M&&(0,n.jsx)("div",{className:"absolute top-1/2 right-1.5 -translate-y-1/2",children:(0,n.jsx)(ex,{recording:U,onStart:G.startRecording,onStop:G.stopRecording})})]}),(0,n.jsx)("div",{className:(0,o.cn)("relative flex shrink-0 items-center justify-between",!L&&!ep&&!em&&["overflow-hidden transition-[width] duration-200 ease-in-out",I||M?"w-9":"w-19"]),children:L?(0,n.jsx)("div",{className:"flex size-9 items-center justify-center",children:(0,n.jsx)(Q.A,{className:"text-muted-foreground m-auto size-7 animate-spin","aria-hidden":!0})}):ep||em?(0,n.jsx)("button",{type:"button","aria-label":"Unlock chat",onClick:ek,className:"flex size-9 cursor-pointer items-center justify-center",children:(0,n.jsx)(X.A,{className:"text-muted-foreground size-5"})}):(0,n.jsxs)(n.Fragment,{children:[!M&&(0,n.jsx)("button",{id:"services-button",type:"button","aria-label":"Services",onClick:()=>
1{if(u.F.trackEvent("posthog",m.n.CHAT_FANTASY_CLICKED,{}),em)return void ek();S(!0)},className:(0,o.cn)("flex size-9 items-center justify-center transition-all duration-200 ease-in-out",I?"pointer-events-none translate-y-2 opacity-0":"translate-y-0 opacity-100",em?"cursor-not-allowed opacity-40 grayscale":"cursor-pointer"),children:(0,n.jsx)("div",{className:"text-primary size-7",children:(0,n.jsx)(ee,{})})}),(0,n.jsx)("button",{id:"gift-button",type:"button","aria-label":"Gift",onClick:()=>{if(u.F.trackEvent("posthog",m.n.CHAT_GIFT_CLICKED,{}),em)return void ek();F(!0)},className:(0,o.cn)("flex items-center justify-center transition-all duration-100 ease-in-out",I?"pointer-events-none translate-y-2 opacity-0":"translate-y-0 opacity-100",em?"cursor-not-allowed opacity-40 grayscale":"cursor-pointer"),children:(0,n.jsx)(W.default,{src:"".concat(ed.LH,"/chat/gift-stickers.svg"),alt:"",width:28,height:28,"aria-hidden":!0})}),(0,n.jsxs)("div",{onClick:em?ek:eF,className:(0,o.cn)("relative flex cursor-pointer items-center justify-center transition-all duration-200 ease-in-out",I?"translate-y-0 opacity-100":"pointer-events-none -translate-y-2 opacity-0"),children:[(0,n.jsx)(Y.A,{className:"absolute inset-y-0 right-0 m-auto"}),M?null:(0,n.jsxs)("div",{className:"bg-card absolute top-1 right-0 flex min-w-[29px] items-center justify-center gap-0.5 rounded-full p-px",children:[(0,n.jsx)(W.default,{src:"".concat(ed.LH,"/coins.svg"),width:10,height:10,alt:"",className:"shrink-0"}),(0,n.jsx)("span",{className:"text-[10px] font-medium",children:"0.5"})]})]})]})})]})})]})}),C&&(0,n.jsx)(eN,{surface:t,onClose:()=>F(!1),onSendGift:eA}),E&&!M&&(0,n.jsx)(eg.$,{open:E,modelId:x,surface:t,onClose:()=>S(!1)})]})}var eC=s(86911),ek=s(53511),eF=s(85921),eA=s(80598);let eE=e=>{let{isActive:t,isPlaying:s,onClick:a}=e;return(0,n.jsx)("button",{onClick:a,className:"bg-primary text-primary-foreground flex h-9 w-9 items-center justify-center rounded-full shadow",children:t&&s?(0,n.jsx)(ek.A,{size:16}):(0,n.jsx)(eF.A,{size:16})})},eS=e=>{let{time:t,duration:s,onSeek:a}=e;return(0,n.jsx)("input",{type:"range",min:0,max:s,value:t,onChange:e=>a(Number(e.target.value)),className:"audio-slider mt-3",style:{"--progress":s?"".concat(t/s*100,"%"):"0%"}})},eL=e=>{let{time:t,duration:s,speed:a,onSpeedChange:l,format:r}=e;return(0,n.jsxs)("div",{className:"text-muted-foreground mt-1 flex items-center justify-between text-[8px]",children:[(0,n.jsx)("span",{children:r(t)}),(0,n.jsx)("span",{children:r(s)}),(0,n.jsxs)("button",{onClick:l,className:"flex items-center gap-1 text-[10px]",children:[(0,n.jsx)(eA.A,{size:10}),a,"x"]})]})};function eP(e){let{audioUrl:t}=e,s=(0,a.useRef)(null),l=(0,en.$)(e=>e.play),r=(0,en.$)(e=>e.pause),i=(0,en.$)(e=>e.stop),c=(0,en.$)(e=>e.activeVoiceNote),d=(0,en.$)(e=>e.isPlaying),o=c===s.current,[u,m]=(0,a.useState)(0),[x,f]=(0,a.useState)(0),[g,h]=(0,a.useState)(!1),[v,p]=(0,a.useState)(1);(0,a.useEffect)(()=>{let e=s.current;if(!e)return;let t=()=>{f(e.duration||0),h(!0)},n=()=>m(e.currentTime),a=()=>{m(0),i()};return e.addEventListener("loadedmetadata",t),e.addEventListener("timeupdate",n),e.addEventListener("ended",a),()=>{e.removeEventListener("loadedmetadata",t),e.removeEventListener("timeupdate",n),e.removeEventListener("ended",a)}},[]),(0,a.useEffect)(()=>{s.current&&(s.current.playbackRate=v)},[v]);let j=async()=>{let e=s.current;e&&(o&&d?r():await l(e))};return t?(0,n.jsxs)("div",{className:"bg-muted/60 flex w-60 items-center gap-3 rounded-2xl px-3 py-1.5 shadow-sm",children:[(0,n.jsx)("audio",{ref:s,src:t,preload:"metadata"}),(0,n.jsx)("div",{className:"grid w-full gap-2",children:g?(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(eE,{isActive:o,isPlaying:d,onClick:j}),(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)(eS,{time:u,duration:x,onSeek:e=>{let t=s.current;t&&(t.currentTime=e,m(e))}}),(0,n.jsx)(eL,{time:u,duration:x,speed:v,onSpeedChange:()=>p((e=>{let t=[1,1.5,2],s=t.indexOf(e);return -1===s?1:t[(s+1)%t.length]})(v)),format:e=>{if(!e)return"0:00";let t=Math.floor(e/60),s=Math.floor(e%60);return"".concat(t,":").concat(s<10?"0":"").concat(s)}})]})]}):(0,n.jsx)(ej.E,{className:"h-10"})})]}):null}var eD=s(6407);function eR(e){let{albumData:t}=e,s=(0,a.useMemo)(()=>({id:t.id,model_id:t.model_id,model_name:t.model_name,model_user_name:t.model_user_name,name:t.name,price:t.customer_price,status:t.status,is_purchased:+(1===t.is_purchased),photo_count:t.photo_count,video_count:t.video_count,cover_image:t.cover_image,purchase_count:t.purchase_count}),[t]);return(0,n.jsx)("div",{className:"w-48",children:(0,n.jsx)(eD.a,{album:s,page:"chat"})})}var eM=s(61453);function ez(e){let{callData:t}=e,s=(0,i.c)("ChatsPage"),a="Ended"===t.status?function(e,t){let s=e.split(":").map(Number);if(3!==s.length||s.some(e=>Number.isNaN(e)))return null;let[n,a,l]=s;return 3600*n+60*a+l<=0?null:n>0?"".concat(n," ").concat(t.hr).concat(a>0?" ".concat(a," ").concat(t.min):"").trim():a>0?"".concat(a," ").concat(t.min):"".concat(l," ").concat(t.sec)}(t.duration,{hr:s("callDurationHr"),min:s("callDurationMin"),sec:s("callDurationSec")}):function(e,t){switch(e){case"Rejected":return t("callStatusRejected");case"Cancelled":return t("callStatusCancelled");case"Unanswered":return t("callStatusUnanswered")}}(t.status,s);return(0,n.jsxs)("div",{className:"bg-card flex w-fit items-center gap-3 rounded-2xl px-4 py-3",children:[(0,n.jsx)("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-xl bg-[#27272A]",children:(0,n.jsx)(eM.D,{className:"size-5 text-white"})}),(0,n.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,n.jsx)("span",{className:"text-sm font-semibold text-white",children:s("videoCallMessage")}),a?(0,n.jsx)("span",{className:"text-xs font-medium text-[#9CA3AF]",children:a}):null]})]})}function eq(e){var t,s,l;let{messageId:c,content:d,isOwn:u,gift:m,giftStatus:x,modelName:f,surface:g,onSendGift:h,callId:v}=e,p=(0,i.c)("ChatsPage"),j=M(),b="in-call"===g,{data:y}=(0,r.useSession)(),_=(null==y||null==(t=y.user)?void 0:t.role)==="customer",{data:N}=(0,$.Z6)({enabled:_}),w=_&&(null!=(s=null==N?void 0:N.paid_credits)?s:0)<(null!=(l=null==m?void 0:m.amount)?l:0),C=(0,a.useCallback)(()=>{var e;let t=Number(d);t&&!w&&h(t,null!=(e=null==m?void 0:m.link)?e:"",c,v)},[w,d,null==m?void 0:m.link,c,v,h]);return m?(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:(0,o.cn)("px-4 py-3 text-[#FFFFFFCC]",b?"text-xs font-bold":"text-sm",b?u?"rounded-2xl rounded-bl-none bg-[rgba(209,34,136,0.25)]":"rounded-2xl bg-[rgba(255,255,255,0.25)]":u?"rounded-t-lg rounded-br-none rounded-bl-lg bg-[#1E0815]":"rounded-t-lg rounded-b-none bg-[linear-gradient(89deg,#D12288_0%,#8B1D5D_100%)]"),children:p("requestedGift",{modelName:f})}),"accepted"!==x?(0,n.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,n.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,n.jsx)("div",{className:"relative aspect-square h-24",children:(0,n.jsx)(W.default,{src:m.link,alt:m.name,fill:!0,className:"object-contain"})}),(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,n.jsx)(W.default,{src:"".concat(ed.LH,"/coins.svg"),alt:"",width:12,height:12}),(0,n.jsx)("span",{className:"text-[10px] font-light text-[#F1F5F9]",children:m.amount})]})]}),(0,n.jsxs)(et.$,{variant:"outline",size:b?"sm":"default",className:"border-primary",disabled:j.isPending||w,onClick:C,children:[p("sendGift")," ",(0,n.jsx)(Y.A,{})]})]}):(0,n.jsx)("div",{className:"mt-2",children:(0,n.jsx)(et.$,{size:"sm",variant:"outline",className:"border-[#86838A] text-[#86838A]",disabled:!0,children:p("giftSent")}
1)})]}):null}var eI=s(54679),eT=s(16105);function eB(e){let{src:t,type:s,alt:a,poster:l,className:r}=e;return t?(0,n.jsxs)(eI.lG,{children:[(0,n.jsx)(eI.zM,{asChild:!0,children:(0,n.jsx)("div",{className:"relative cursor-pointer",children:(0,n.jsx)(eT.A,{src:t,type:s,alt:a,poster:l,className:r,showPlayIcon:"video"===s})})}),(0,n.jsxs)(eI.Cf,{className:"max-w-7xl border-none bg-transparent p-0 [&>button[data-slot=dialog-close]]:hidden",children:[(0,n.jsx)(eI.L3,{className:"sr-only"}),(0,n.jsx)(eI.HM,{"data-slot":"close",asChild:!0,children:(0,n.jsx)(et.$,{variant:"ghost",className:"absolute top-3 right-0 z-50 size-6 cursor-pointer rounded-lg border border-white p-1 shadow hover:bg-gray-200","aria-label":"Close",children:(0,n.jsx)(eh.A,{className:"size-6"})})}),(0,n.jsx)("div",{className:"bg-blur relative flex h-[calc(100vh-120px)] w-full items-center justify-center px-3",children:(0,n.jsx)(eT.A,{src:t,type:s,alt:a,poster:l,controls:!0,autoPlay:"video"===s,className:"object-cover"})})]})]}):null}function eO(e){let{type:t,src:s}=e;return(0,n.jsx)(eB,{src:s,type:t,className:"h-full max-h-80 w-[180px] rounded-lg"})}function e$(e){let{link:t}=e;return(0,n.jsx)("div",{className:"relative aspect-square h-24",children:(0,n.jsx)(W.default,{src:t,alt:"Gift",fill:!0,className:"object-contain"})})}function eH(e){let{content:t,username:s}=e,[,l]=(0,J.ZA)("enableService",J.cr),r=(0,a.useCallback)(()=>{l(!0)},[l]),i=(0,a.useCallback)(e=>{let t=e.trim();return t?t.endsWith("s")||t.endsWith("S")?"".concat(t,"'"):"".concat(t,"'s"):""},[]);return(0,n.jsxs)("div",{className:(0,o.cn)("w-[260px] rounded-xl bg-[linear-gradient(180deg,#A93B74_0%,#932A5F_100%)] p-3 text-[#F8EAF2]"),role:"button",tabIndex:0,onClick:r,onKeyDown:e=>"Enter"===e.key&&r(),children:[(0,n.jsx)("div",{className:"mb-3 text-sm font-medium",children:(null==t?void 0:t.trim())?t:(null==s?void 0:s.trim())?"".concat(i(s)," service menu"):"Service menu"}),(0,n.jsx)(et.$,{type:"button",onClick:e=>{e.stopPropagation(),r()},className:"h-10 w-full rounded-lg bg-white/20 text-sm font-semibold text-white hover:bg-white/25",children:"See Menu"})]})}var eG=s(37586),eU=s(79051),eK=s(61362),eV=s(78874);let eW=e=>{let{name:t,description:s,credits:l,status:r,createdAtMs:c,acceptedAtMs:d,revisionRequestedAtMs:u,acceptTimeoutSecs:m,completeTimeoutSecs:x}=e,f=(0,i.c)("ChatsPage"),[g,h]=(0,a.useState)(()=>Date.now()),[v,p]=(0,a.useState)(null);(0,a.useEffect)(()=>{if("pending"!==r&&"accepted"!==r)return;let e=setInterval(()=>h(Date.now()),1e3);return()=>clearInterval(e)},[r]),(0,a.useEffect)(()=>{"accepted"===r&&(d||p(e=>null!=e?e:Date.now()))},[d,r]);let{timerStartMs:j,timerDurationSecs:b}=(0,a.useMemo)(()=>{if(u)return{timerStartMs:u,timerDurationSecs:m};if(d||v){var e;return{timerStartMs:null!=(e=null!=d?d:v)?e:c,timerDurationSecs:x}}return{timerStartMs:c,timerDurationSecs:m}},[m,d,v,x,c,u]),y=(0,a.useMemo)(()=>Math.max(0,Math.ceil((j+1e3*b-g)/1e3)),[g,b,j]),_=("pending"===r||"accepted"===r)&&0===y?"expired":r;return(0,n.jsxs)("div",{className:"bg-card w-full rounded-2xl px-6 py-5 text-white",children:[(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[(0,n.jsx)("div",{className:"flex size-8 items-center justify-center rounded-full bg-white/5",children:(0,n.jsx)(eG.A,{className:"size-5 text-white/70"})}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("div",{className:"truncate text-sm font-semibold",children:t}),(0,n.jsx)("div",{className:"truncate text-xs text-white/50",children:s})]}),(0,n.jsxs)("div",{className:"flex shrink-0 items-center gap-2 rounded-full bg-black/30 px-2 py-1",children:[(0,n.jsx)(W.default,{src:"".concat(ed.LH,"/coins.svg"),alt:"",width:14,height:14}),(0,n.jsx)("span",{className:"text-sm font-semibold text-[#FFBA18]",children:l})]})]}),"pending"===_||"accepted"===_?(0,n.jsxs)("div",{className:"mt-4 flex justify-between gap-2",children:[(0,n.jsx)("div",{className:(0,o.cn)("flex h-[40px] w-full items-center justify-center gap-2 rounded-lg px-3 text-xs","pending"===_?"bg-[#2B2A1A] text-[#F7C948] ring-1 ring-[#6A5B1A]":"bg-[#123327] text-[#39D98A] ring-1 ring-[#1E6B4C]"),children:"pending"===_?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eU.A,{className:"size-4"}),f("serviceRequestPending")]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eK.A,{className:"size-4"}),f("serviceRequestAccepted")]})}),(0,n.jsxs)("div",{className:"flex h-[40px] w-full items-center justify-center gap-1 rounded-lg bg-black/25 px-3 text-xs text-white/70 ring-1 ring-white/10",children:[(0,n.jsx)(eU.A,{className:"size-4"}),f("serviceRequestTimeLeftPrefix")," ",(0,n.jsx)("span",{className:"text-white",children:(e=>{let t=Math.floor(e/60);return"".concat(t,":").concat(String(e%60).padStart(2,"0"))})(y)})]})]}):"rejected"===_?(0,n.jsxs)("div",{className:"mt-4",children:[(0,n.jsxs)("div",{className:"flex h-[40px] items-center justify-center gap-3 rounded-lg bg-[#2A1B1C] px-3 text-[#FF5C63] ring-1 ring-[#8B2B2F]",children:[(0,n.jsx)(eV.A,{className:"size-4"}),(0,n.jsx)("span",{className:"text-sm",children:f("serviceRequestRejected")})]}),(0,n.jsx)("div",{className:"mt-3 text-center text-xs text-white/70",children:f("serviceRequestRefundNotice")})]}):"expired"===_?(0,n.jsxs)("div",{className:"mt-4",children:[(0,n.jsx)("div",{className:"flex h-[40px] items-center justify-center rounded-lg bg-black/25 px-3 text-sm font-semibold text-white/90 ring-1 ring-white/10",children:f("serviceRequestExpired")}),(0,n.jsx)("div",{className:"mt-3 text-center text-xs text-white/70",children:f("serviceRequestRefundNotice")})]}):(0,n.jsxs)("div",{className:"mt-4",children:[(0,n.jsx)("div",{className:"flex h-[40px] items-center justify-center rounded-lg bg-black/25 px-3 text-sm font-semibold text-white/90 ring-1 ring-white/10",children:f("completed"===_?"serviceRequestCompleted":"serviceRequestCancelled")}),"cancelled"===_?(0,n.jsx)("div",{className:"mt-3 text-center text-xs text-white/70",children:f("serviceRequestRefundNotice")}):null]})]})};function eQ(e){var t,s,l;let{serviceData:r,messageTimestamp:c}=e,d=(0,a.useMemo)(()=>{var e;let t=new Date(null!=(e=r.created_at)?e:c).getTime();return Number.isNaN(t)?Date.now():t},[c,r.created_at]),o=(0,a.useMemo)(()=>
1{if(!r.accepted_at)return null;let e=new Date(r.accepted_at).getTime();return Number.isNaN(e)?null:e},[r.accepted_at]),u=(0,a.useMemo)(()=>{var e,t,s;let n=null!=(s=null!=(t=null!=(e=r.revision_requested_at)?e:r.revise_requested_at)?t:r.revision_request_at)?s:null;if(!n)return null;let a=new Date(n).getTime();return Number.isNaN(a)?null:a},[r.revision_requested_at,r.revise_requested_at,r.revision_request_at]),m=(0,i.c)("ChatsPage"),x=null!=(t=r.customer_credits)?t:0;return(0,n.jsx)(eW,{name:r.service_name,description:m("servicesPickerDefaultCardDescription"),credits:x,status:r.status,createdAtMs:d,acceptedAtMs:o,revisionRequestedAtMs:u,acceptTimeoutSecs:null!=(s=r.accept_timeout_secs)?s:300,completeTimeoutSecs:null!=(l=r.complete_timeout_secs)?l:0})}function eZ(e){let{content:t,isOwn:s,showTranslation:a,translatedContent:l,surface:r}=e,i="in-call"===r;return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:(0,o.cn)("px-4 py-3 break-words text-[#FFFFFFCC]",i?"text-xs font-bold":"text-sm",i?s?"rounded-2xl rounded-bl-none bg-[rgba(209,34,136,0.25)]":"rounded-2xl bg-[rgba(255,255,255,0.25)]":s?"rounded-t-lg rounded-br-none rounded-bl-lg bg-[#1E0815]":a?"rounded-t-lg rounded-b-none bg-[linear-gradient(89deg,#D12288_0%,#8B1D5D_100%)]":"rounded-lg rounded-bl-none bg-[linear-gradient(89deg,#D12288_0%,#8B1D5D_100%)]"),children:"string"==typeof t?t:null}),a&&l?(0,n.jsx)("div",{className:(0,o.cn)("px-4 py-3 text-[#FFFFFFCC]",i?"text-xs font-bold":"text-sm","rounded-b-lg bg-[linear-gradient(0deg,rgba(128,128,128,0.20)_0%,rgba(128,128,128,0.20)_100%),linear-gradient(89deg,rgba(209,34,136,0.10)_0%,rgba(139,29,93,0.10)_100%)]"),children:l}):null]})}function eX(e){var t;let{chat:s,modelName:l,surface:i,onSendGift:c,callId:d}=e,{data:o}=(0,r.useSession)(),{data:u}=ey(),{data:m}=ei(),x=s.sender_id===(null==o||null==(t=o.user)?void 0:t.userName),f=(0,a.useMemo)(()=>!x&&!!(null==m?void 0:m.is_translation)&&s.is_translation&&!!s.translated_message_content,[x,null==m?void 0:m.is_translation,s.is_translation,s.translated_message_content]);switch(s.message_type){case"text":return(0,n.jsx)(eZ,{content:s.message_content,isOwn:x,showTranslation:f,translatedContent:s.translated_message_content,surface:i});case"image":if(!s.link)return null;return(0,n.jsx)(eO,{type:"image",src:s.link});case"video":if(!s.link)return null;return(0,n.jsx)(eO,{type:"video",src:s.link});case"sent_gift":if(!s.link)return null;return(0,n.jsx)(e$,{link:s.link});case"request_gift":return(0,n.jsx)(eq,{messageId:s._id,content:s.message_content,isOwn:x,gift:null==u?void 0:u.find(e=>e.id===Number(s.message_content)),giftStatus:s.gift_request_status,modelName:l,surface:i,onSendGift:c,callId:d});case"album":case"album_purchased":if(!s.album_data)return null;return(0,n.jsx)(eR,{albumData:s.album_data});case"service_request":if(!s.service_data)return null;return(0,n.jsx)(eQ,{serviceData:s.service_data,messageTimestamp:s.time_stamp});case"service_menu":return(0,n.jsx)(eH,{content:s.message_content,username:l});case"audio":return(0,n.jsx)(eP,{audioUrl:s.link});case"call":if(!s.call_data)return null;return(0,n.jsx)(ez,{callData:s.call_data});default:return null}}function eY(e){var t,s,l,d,u,m;let{username:x,messages:f,isLoading:g,isFetchingOlder:h,hasOlderMessages:j,fetchOlderMessages:b,markSeen:y,surface:_,onSendGift:N,callId:w}=e,C=(0,a.useRef)(null),k=(0,a.useRef)(0),F=(0,a.useRef)(0),A=(0,a.useRef)(!0),E=(0,a.useRef)(!1),{data:S}=(0,r.useSession)(),L=null==S||null==(t=S.user)?void 0:t.userName,P=(0,i.c)("ChatsPage"),{data:D}=(0,z.T$)({userName:x,enabled:!!x}),{messages:R}=(0,eC.a)(),M="in-call"===_,q="floating"===_,I=(0,a.useMemo)(()=>{var e,t;return null==(t=R.find(e=>e.data.message.model.user_Name===x))||null==(e=t.data)?void 0:e.message},[R,x]);(0,a.useEffect)(()=>{let e=C.current;!g&&e&&A.current&&(e.scrollTop=e.scrollHeight,A.current=!1)},[g]);let T=(0,a.useCallback)(()=>{let e=C.current;e&&!h&&j&&e.scrollTop<50&&(k.current=e.scrollHeight,F.current=e.scrollTop,E.current=!0,b())},[b,h,j]);(0,a.useEffect)(()=>{let e=C.current;if(e)return e.addEventListener("scroll",T,{passive:!0}),()=>e.removeEventListener("scroll",T)},[T]),(0,a.useEffect)(()=>{let e=C.current;if(e)if(E.current&&k.current){let t=e.scrollHeight-k.current;e.scrollTop=F.current+t,E.current=!1}else e.scrollTop=e.scrollHeight},[f.length]),(0,a.useEffect)(()=>
1{if(!x||!L)return;let e=f.filter(e=>e.sender_id!==L&&!e.seen);e.length>0&&y(e)},[f,x,L,y]);let B=null==D||null==(l=D.profile_photo)||null==(s=l[0])?void 0:s.link,O=B&&"null"!==B,$="";return(0,n.jsx)("div",{className:"flex flex-1 flex-col gap-4 overflow-y-scroll px-2",ref:C,children:g?(0,n.jsx)(c.A,{}):(0,n.jsxs)(n.Fragment,{children:[j&&h&&(0,n.jsx)(c.A,{}),!w&&I?(0,n.jsx)("div",{className:"flex",children:(0,n.jsxs)("div",{className:(0,o.cn)("w-fit px-4 py-2",q?"max-w-[85%]":"lg:max-w-[45%]"),children:[(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[O?(0,n.jsxs)(v.eu,{className:"size-10",children:[(0,n.jsx)(v.BK,{src:B,alt:"",className:"object-cover"}),(0,n.jsx)(v.q5,{children:null==D||null==(d=D.name)?void 0:d[0]})]}):null,(0,n.jsx)(eX,{chat:{_id:"",id:"",message_content:"string"==typeof I.message?I.message:"",message_type:"text",time_stamp:I.sent_at,seen:!1,link:"",gift_request_status:null,is_translation:!1,sender_id:I.model.user_Name,receiver_id:null!=L?L:"",sender_type:"model",receiver_type:"customers",call_id:null},modelName:null!=(u=null==D?void 0:D.name)?u:"",surface:_,onSendGift:N,callId:w})]}),!M&&(0,n.jsx)("div",{className:"mt-1 flex justify-end",children:(0,n.jsx)("span",{className:"text-xs font-medium text-[#F1F5F966]",children:(m=I.sent_at,(0,p.ty)(m))})})]})}):null,f.map((e,t)=>{var s,l,r,i,c;let d=(l=e.time_stamp,(0,p.$$)(l)),u=d!==$;$=d;let m=e.sender_id===L,x="call"===e.message_type;return(0,n.jsxs)(a.Fragment,{children:[!M&&u?(0,n.jsx)("div",{className:"py-2 text-center text-sm font-medium text-gray-400",children:(r=e.time_stamp,i=P("today"),(0,p.ro)(r,new Date)?i:(0,p.u2)(r))}):null,(0,n.jsx)("div",{className:(0,o.cn)("flex",!M&&m?"justify-end":null),children:(0,n.jsxs)("div",{className:(0,o.cn)("w-fit px-4",q?"max-w-[85%]":"lg:max-w-[45%]",M?"":"py-2"),children:[(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[M||x||(null==D?void 0:D.user_name)!==e.sender_id||!O?null:(0,n.jsx)(W.default,{src:B,alt:"",width:40,height:40,className:"aspect-square rounded-full object-cover"}),(0,n.jsx)(eX,{chat:e,modelName:null!=(s=null==D?void 0:D.name)?s:"",surface:_,onSendGift:N,callId:w})]}),!M&&(0,n.jsx)("div",{className:(0,o.cn)("mt-1 flex",x?"justify-start":"justify-end"),children:(0,n.jsx)("span",{className:"text-xs font-medium text-[#F1F5F966]",children:(c=e.time_stamp,(0,p.ty)(c))})})]})})]},e._id||t)})]})})}function eJ(e){var t;let{username:s,surface:l,callId:d,onNewMessage:x}=e,f=(0,i.c)("ChatsPage"),g=(0,k.rd)(),h=(0,k.a8)(),v=(0,C.a)(),{openWallet:p}=(0,U.G)(),j=(0,H.U)(e=>e.initTimer),{setActiveCallId:b,enableNotification:y,setLastChatUsername:q,referralUsername:I}=(0,G.K)(),{messages:W,messagesCount:Q,isLoading:Z,isFetchingOlder:X,hasOlderMessages:Y,fetchOlderMessages:J,isBlocked:ee,isBlockedLoading:et,sendMessage:es,sendGift:en,markSeen:ea,sendVoiceMessage:el,modelDetails:er,isChatFree:ei}=function(e){var t,s,n,l,i;let{username:c,callId:d,onNewMessage:o,onInsufficientCredits:x}=e,{data:f}=(0,r.useSession)(),{socket:g}=(0,B.y)(),h=(0,a.useRef)(o);h.current=o;let v=(0,a.useRef)(x);v.current=x;let p=null!=(l=null==f||null==(t=f.user)?void 0:t.userName)?l:"",{data:j}=(0,z.T$)({userName:null!=c?c:"",enabled:!!c}),b=null==j?void 0:j.id,{data:y}=(0,O.B7)(),_=(null==y?void 0:y.is_free_user)===1,{data:N}=T({model_id:b||0,enabled:!!b&&_}),w=!!(null==N?void 0:N.can_send_free)&&!!(null==N?void 0:N.messages_remaining),C=!d&&!w,{data:k}=(0,$.Z6)({enabled:C}),q=function(e){let{senderId:t,receiverId:s,limit:n=10,callId:a,enabled:l=!0}=e,r={senderId:t,receiverId:s,limit:n,callId:a};return(0,F.useInfiniteQuery)({queryKey:S(r),queryFn:e=>{let{pageParam:t=0}=e;return L({...r,offset:t})},getNextPageParam:(e,t)=>{if(e.hasMore)return t.reduce((e,t)=>{var s,n;return e+(null!=(n=null==(s=t.messages)?void 0:s.length)?n:0)},0)},initialPageParam:0,enabled:l})}({senderId:p,receiverId:null!=c?c:"",limit:10,callId:d,enabled:!!p&&!!c}),{isBlocked:I,isBlockedLoading:H}=function(e){let{socket:t,customerId:s,modelId:n}=e,[l,r]=(0,a.useState)(null);return(0,a.useEffect)(()=>{if(!t||!s||!n)return;r(null),t.emit("blocked-status",{customer_id:s,model_id:String(n)});let e=e=>{var t;r(!!(null==e||null==(t=e.data)?void 0:t.is_blocked))},a=e=>{r(!!(null==e?void 0:e.is_blocked))};return t.on("model-blocked-status",e),t.on("blocked-status-updated",a),()=>{t.off("model-blocked-status",e),t.off("blocked-status-updated",a)}},[t,s,n]),{isBlocked:l,isBlockedLoading:null===l}}({socket:g,customerId:(null==f||null==(s=f.user)?void 0:s.id)?String(f.user.id):void 0,modelId:b}),G=(0,a.useMemo)(()=>{var e,t,s;return null!=(s=null==(t=q.data)||null==(e=t.pages)?void 0:e.flatMap(e=>e.messages).sort((e,t)=>
1new Date(e.time_stamp).getTime()-new Date(t.time_stamp).getTime()))?s:[]},[null==(n=q.data)?void 0:n.pages]),U=G.length,K=M(),V=(()=>{let e=async e=>{let t=new FormData;t.append("media",e),t.append("file","voice message");let{data:s}=await E.g.post("/chat/upload-media",t,{headers:{"Content-Type":"multipart/form-data"}});return null==s?void 0:s.data};return{...(0,R.useMutation)({mutationFn:t=>e(t)})}})(),W=(0,a.useCallback)(()=>{var e,t;return!!C&&!((null!=(t=null==k?void 0:k.credits)?t:0)>=1)&&(null==(e=v.current)||e.call(v),!0)},[C,null==k?void 0:k.credits]);(0,a.useEffect)(()=>{if(!g||!c||!p)return;let e={senderId:p,receiverId:c,limit:10,callId:d},t=t=>{if(t.sender_id===c&&t.receiver_id===p||t.sender_id===p&&t.receiver_id===c){var s;let n={id:t._id,_id:t._id,sender_id:t.sender_id,receiver_id:t.receiver_id,sender_type:t.sender_type,receiver_type:t.receiver_type,message_content:t.message_content,seen:t.seen,message_type:t.message_type,link:t.link,gift_request_status:t.gift_request_status,is_translation:t.is_translation,time_stamp:t.time_stamp,translation:t.translation,call_id:null!=d?d:null,album_data:t.album_data,service_data:t.service_data,call_data:t.call_data},a=S(e);A.A.setQueryData(a,e=>{if(!e||0===e.pages.length)return e;let t=e.pages[0];return t.messages.some(e=>e._id===n._id)?e:{...e,pages:[{...t,messages:[...t.messages,n]},...e.pages.slice(1)]}}),null==(s=h.current)||s.call(h)}(0,D.s)(p)},s=t=>{let{request_id:s,status:n,accepted_at:a,revision_requested_at:l,revise_requested_at:r,revision_request_at:i}=t;!function(e,t,s){let n=S(e);A.A.setQueryData(n,e=>{if(!e||0===e.pages.length)return e;let n=!1,a=e.pages.map(e=>{let a=!1,l=e.messages.map(e=>t(e)?(a=!0,s(e)):e);return a&&(n=!0),a?{...e,messages:l}:e});return n?{...e,pages:a}:e})}(e,e=>{var t;return"service_request"===e.message_type&&(null==(t=e.service_data)?void 0:t.request_id)===s},e=>({...e,service_data:e.service_data?{...e.service_data,status:n,...void 0!==a?{accepted_at:a}:"accepted"===n&&!e.service_data.accepted_at?{accepted_at:new Date().toISOString()}:null,...void 0!==l?{revision_requested_at:l}:null,...void 0!==r?{revise_requested_at:r}:null,...void 0!==i?{revision_request_at:i}:null}:e.service_data})),("rejected"===n||"expired"===n||"cancelled"===n)&&(0,$.vj)({})},n=()=>{var e;(0,D.s)(p),(0,$.vj)({}),c&&P({senderId:p,receiverId:c,limit:10,callId:d}),null==(e=h.current)||e.call(h)},a=e=>{(0,$.vj)({})};return g.on("chat-message",t),g.on("service-status-updated",s),g.on("album_purchased",n),g.on("message-credit-charged",a),()=>{g.off("chat-message",t),g.off("service-status-updated",s),g.off("album_purchased",n),g.off("message-credit-charged",a)}},[g,c,p,d]);let Q=(0,a.useCallback)(e=>{var t;return!(!g||!p||!c||!e.trim()||W())&&(g.emit("chat-message",{sender_id:p,receiver_id:c,message:e,message_type:"text",receiver_type:"model",sender_type:"customers",call_id:d}),u.F.trackEvent("posthog",m.n.CHAT_MESSAGE_SENT,{model_name:null!=(t=null==j?void 0:j.name)?t:c,credits_used:+!!C}),!0)},[g,p,c,d,W,null==j?void 0:j.name,C]),Z=(0,a.useCallback)(async(e,t,s)=>{if(e&&p&&c&&g)try{await K.mutateAsync({gift_id:e,model_user_name:c},{onSuccess:()=>{(0,D.s)(p),(0,$.vj)({}),s&&g.emit("update-gift-status",{message_id:s,status:"accepted"});let n={sender_id:p,receiver_id:c,message:e.toString(),message_type:"sent_gift",receiver_type:"model",sender_type:"customers",link:t,call_id:d};g.emit("chat-message",n)}})}catch(e){}},[g,p,c,d,K]),X=(0,a.useCallback)(async e=>{if(!e||!p||!c||!g||W())return!1;try{return await V.mutateAsync(e,{onSuccess:e=>{(0,D.s)(p),(0,$.vj)({});let t={sender_id:p,receiver_id:c,message:"",message_type:"audio",receiver_type:"model",sender_type:"customers",link:null==e?void 0:e.link,call_id:d};g.emit("chat-message",t)}}),!0}catch(e){return!1}},[g,p,c,d,W,V]),Y=(0,a.useCallback)(e=>{if(g&&0!==e.length){for(let t of e)g.emit("mark-messages-seen",{sender_id:t.receiver_id,receiver_id:t.sender_id});c&&P({senderId:p,receiverId:c,limit:10,callId:d})}},[g,c,p,d]);return{messages:G,messagesCount:U,isLoading:q.isLoading,isFetchingOlder:q.isFetchingNextPage,hasOlderMessages:null!=(i=q.hasNextPage)&&i,fetchOlderMessages:q.fetchNextPage,isBlocked:I,isBlockedLoading:H,sendMessage:Q,sendGift:Z,sendVoiceMessage:X,markSeen:Y,modelDetails:j,isChatFree:w}}({username:s,callId:d,onNewMessage:x,onInsufficientCredits:(0,a.useCallback)(()=>
1{if(v)return void g.push("/wallet");p("default")},[v,g,p])}),{data:ec}=(0,O.B7)(),ed=(0,H.U)(e=>e.endTime),eo=(null==ec?void 0:ec.is_free_user)===1,{data:eu,refetch:em}=T({model_id:(null==er?void 0:er.id)||0,enabled:!!(null==er?void 0:er.id)&&eo}),ex=(0,a.useRef)(!1),ef=(0,a.useCallback)(()=>{eo&&!d&&!ex.current&&s&&(ex.current=!0,j())},[d,j,eo,s]),{isActive:eg,isExpired:eh}=(0,K.A)(eo,{autoInit:!1}),ev=!d&&eo&&!(null==eu?void 0:eu.can_send_free),ep=ev&&(eg||eh&&null!==ed),ej=eo&&!d&&eg,eb=ev&&eh&&null!==ed;(0,a.useEffect)(()=>{ep&&u.F.trackEvent("posthog",m.n.CHAT_DISABLED_MODAL_SHOWN,{})},[ep]),(0,a.useEffect)(()=>(d&&b(d),s&&(!ej||(null==eu?void 0:eu.can_send_free)||I===s||y(),q(s)),()=>b(void 0)),[d,ej,s,y,null==eu?void 0:eu.can_send_free,I]);let ey=(0,a.useCallback)(()=>{if(s){if(v)return void g.push("/wallet?unlockChat=1");p("chat")}},[s,v,g,p]),e_=(0,a.useCallback)(()=>{g.push("".concat(h,"?dialogType=upgrade"))},[g,h]),eN=(0,a.useCallback)(()=>{u.F.trackEvent("posthog",m.n.CHAT_DISABLED_MODAL_UNLOCK_CLICKED,{pageName:h}),eg?ey():e_()},[eg,ey,e_]),eC=(0,a.useCallback)(async(e,t,s)=>{await en(e,t,void 0)},[en]),ek=(0,a.useCallback)(async(e,t,s)=>{await en(e,t,s)},[en]);return((0,a.useEffect)(()=>{(null==W?void 0:W.length)&&(null==er?void 0:er.id)&&em()},[W,null==er?void 0:er.id]),s)?Z||et?(0,n.jsx)("div",{className:"flex grow items-center justify-center",children:(0,n.jsx)(c.A,{})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{onPointerDownCapture:ef,onKeyDownCapture:ef,className:(0,o.cn)("flex flex-1 flex-col overflow-hidden","floating"===l?"pb-20 md:pb-0":"py-20 md:py-0"),children:[!!(null==eu?void 0:eu.can_send_free)&&(0,n.jsxs)("div",{className:"mx-auto flex items-baseline justify-center gap-2 py-4 text-[#6CDE6FCC]",children:[(0,n.jsx)(_.A,{size:13,strokeWidth:2}),(0,n.jsx)("span",{className:"align-baseline text-sm font-medium uppercase",children:f("freeChatBanner")})]}),(0,n.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[(0,n.jsx)(eY,{username:s,messages:W,isLoading:Z,isFetchingOlder:X,hasOlderMessages:Y,fetchOlderMessages:J,markSeen:ea,surface:l,onSendGift:ek,callId:d}),ep&&(0,n.jsx)(V,{onClick:eN})]})]}),(0,n.jsxs)("div",{onPointerDownCapture:ef,onKeyDownCapture:ef,className:(0,o.cn)("fixed inset-x-0 bottom-0 z-40 p-4 md:relative","in-call"!==l&&"floating"!==l&&"bg-background"),children:[eb&&"in-call"!==l&&(0,n.jsxs)("div",{className:"mb-2 flex flex-col items-center text-center",children:[(0,n.jsxs)("div",{className:"mb-1 flex items-center gap-2",children:[(0,n.jsx)(N.A,{size:20,stroke:"#FF9500"}),(0,n.jsx)("span",{className:"align-middle text-xs leading-[20px] font-semibold text-neutral-400",children:f("chatDisabled")})]}),(0,n.jsx)("div",{className:"mb-4 max-w-[300px] text-xs leading-[20px] font-bold",children:f("upgradeToGold")}),(0,n.jsx)(w.A,{size:"sm"})]}),(0,n.jsx)(ew,{surface:l,onSend:es,onSendGift:eC,sendVoiceMessage:el,isBlocked:ee,isBlockedLoading:et,modelId:null!=(t=null==er?void 0:er.id)?t:0,messagesCount:Q,callId:d,isChatFree:ei,onExpiredOpenWallet:ej?ey:void 0})]})]}):(0,n.jsxs)("div",{className:"flex size-full flex-col items-center justify-center space-y-3 text-neutral-400",children:[(0,n.jsx)("p",{className:"text-lg font-medium",children:f("selectModelToChat")}),(0,n.jsx)("p",{className:"text-sm text-neutral-500",children:f("waitingForFirstMessage")})]})}var e0=s(35626),e1=s(60890),e2=s(59176),e5=s(2886);function e4(e){var t,s,l,r,c;let{username:d,surface:u,isExpanded:m,onClose:x}=e,f=(0,i.c)("ChatsPage"),g=(0,k.rd)(),h="floating"===u,{data:p,isLoading:j}=(0,z.T$)({userName:d,enabled:!!d}),b=(null==p?void 0:p.is_visible)&&(null==p?void 0:p.id)&&(null==p?void 0:p.profile_status)==="Approved"&&(!h||m),y=(0,a.useCallback)(()=>g.push("/chats"),[g]),_=(0,a.useCallback)(()=>{g.push("/models/".concat(null==p?void 0:p.user_name))},[null==p?void 0:p.id,null==p?void 0:p.user_name,g]),N=null==p||null==(s=p.profile_photo)||null==(t=s[0])?void 0:t.link,w=N&&"null"!==N;return(0,n.jsx)("div",{className:(0,o.cn)(h?"flex-1":"bg-background fixed inset-x-0 top-0 z-39 px-4 md:relative"),children:(0,n.jsxs)("div",{className:(0,o.cn)("flex items-center justify-between gap-4",h?"":"border-0 border-b border-solid border-[rgba(255,255,255,0.10)] pt-4 pb-3"),children:[(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[!h&&(0,n.jsx)(e0.A,{className:"cursor-pointer text-neutral-400",onClick:y}
1),(0,n.jsxs)("div",{className:"flex cursor-pointer items-center gap-4",onClick:_,children:[j?(0,n.jsx)(ej.E,{className:"size-10 rounded-full"}):w?(0,n.jsxs)(v.eu,{className:"size-10",children:[(0,n.jsx)(v.BK,{src:N,alt:"",className:"object-cover"}),(0,n.jsx)(v.q5,{children:null==p||null==(l=p.name)?void 0:l[0]})]}):null,(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[j?(0,n.jsx)(ej.E,{className:"h-5 w-40"}):(0,n.jsx)("div",{className:"text-base font-semibold text-[#F1F5F9]",children:(0,e5.nx)(null==p?void 0:p.name)}),h&&!m?null:j?(0,n.jsx)(ej.E,{className:"h-3 w-40"}):(0,n.jsx)("div",{className:(0,o.cn)("text-xs font-medium",(null==p?void 0:p.is_online)?"text-[#22C55E]":"text-[#F1F5F966]"),children:f((null==p?void 0:p.is_online)?"online":"offline")})]})]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[b&&(0,n.jsx)(e2.default,{modelId:null==p?void 0:p.id,userName:d,className:"h-10 border-[#F6D365]! bg-transparent px-3 sm:h-12 sm:px-6",variant:"outline",surface:"chat",children:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(e1.A,{size:20,fill:"#E9E8EB",stroke:"#E9E8EB"}),(0,n.jsxs)("span",{className:"flex flex-col items-center gap-1",children:[(0,n.jsx)("span",{className:"text-xs leading-none font-semibold text-neutral-200",children:f("videoCall")}),(0,n.jsxs)("div",{className:"flex items-center gap-[4px]",children:[(0,n.jsx)(W.default,{src:"".concat(ed.LH,"/coins.svg"),alt:"",width:16,height:16}),(0,n.jsxs)("span",{className:"text-[10px] leading-none font-light text-neutral-200",children:[null==p||null==(c=p.video_call_prices)||null==(r=c[0])?void 0:r.credits_per_minute,"/min"]})]})]})]})}),h&&(0,n.jsx)(eh.A,{className:"cursor-pointer",onClick:x})]})]})})}},88102:(e,t,s)=>{s.d(t,{U:()=>p});var n=s(95155),a=s(12115),l=s(15239),r=s(6191),i=s(36489),c=s(18955),d=s(97003),o=s(68122),u=s(7588),m=s(38966),x=s(9341),f=s(22511),g=s(45014),h=s(17169),v=s(90412);let p=()=>{var e,t;let s=(0,c.c)("WalletDrawer"),p=(0,i.useSession)(),j=(0,u.a)(),b=(0,m.rd)(),{openWallet:y,openSuccessApplyCouponModel:_}=(0,h.G)(),{data:N,isPending:w}=(0,g.Z6)({enabled:(null==p||null==(t=p.data)||null==(e=t.user)?void 0:e.role)==="customer"}),{credits:C=0}=N||{},k=(0,a.useCallback)(()=>{x.F.trackEvent("posthog",f.n.HEADER_CLICKED,{item:"wallet"}),j?(_(null),b.push("/wallet")):y("default")},[j,y,b]);return C<=50&&C>0&&!w?(0,n.jsxs)("button",{type:"button",className:"group focus-visible:ring-ring relative inline-flex h-9 shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-md px-2.5 text-sm font-medium transition-all focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",style:{"--glow-duration":"3s"},onClick:k,children:[(0,n.jsx)("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 rounded-md",style:{background:"conic-gradient(from var(--glow-angle), hsla(40, 89%, 60%, 1), hsla(40, 58%, 35%, 1), hsla(40, 89%, 60%, 1))",animation:"glow-rotate var(--glow-duration) linear infinite"}}),(0,n.jsx)("span",{className:"bg-secondary pointer-events-none absolute inset-[2px] rounded-[6px]"}),(0,n.jsxs)("span",{className:"relative z-10 flex shrink-0 items-center gap-1.5 text-[#FFBA18] [&_svg]:text-[#FFBA18]",children:[(0,n.jsx)(l.default,{src:"".concat(v.LH,"/coins.svg"),width:20,height:20,alt:"",className:"shrink-0"}),null==C?void 0:C.toFixed(2),(0,n.jsx)(r.A,{className:"size-4 shrink-0"})]})]}):0!==C||w?(0,n.jsxs)(d.$,{variant:"secondary",onClick:k,children:[(0,n.jsx)(l.default,{src:"".concat(v.LH,"/coins.svg"),width:20,height:20,alt:""}),w?(0,n.jsx)(o.E,{className:"h-4 w-7"}):(null==C?void 0:C.toFixed(2))||0,(0,n.jsx)(r.A,{})]}):(0,n.jsxs)("button",{type:"button",className:"group focus-visible:ring-ring relative inline-flex h-9 shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-md px-2.5 text-sm font-medium transition-all focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",style:{"--glow-duration":"3s"},onClick:k,children:[(0,n.jsx)("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 rounded-md",style:{background:"conic-gradient(from var(--glow-angle), hsla(359, 100%, 65%, 1), hsla(359, 54%, 39%, 1), hsla(359, 100%, 65%, 1))",animation:"glow-rotate var(--glow-duration) linear infinite"}}),(0,n.jsx)("span",{className:"bg-secondary pointer-events-none absolute inset-[2px] rounded-[6px]"}),(0,n.jsxs)("span",{className:"text-destructive [&_svg]:text-destructive relative z-10 flex shrink-0 items-center gap-1.5",children:[(0,n.jsx)(l.default,{src:"".concat(v.LH,"/coins.svg"),width:20,height:20,alt:"",className:"shrink-0"}),s("low"),(0,n.jsx)(r.A,{className:"size-4 shrink-0"})]})]})}}}]);
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.