1import{o as Ne}from"./rolldown-runtime-ChpBd9eV.js";import{Ar as p,Di as ke,Hr as z,Ka as Se,Ni as Le,Nr as A,Oi as te,Pa as Ce,Pi as Ie,Ri as ze,Si as O,Ti as Ae,U as H,Ur as Ue,Vi as N,Vr as Re,Wi as se,Zt as Ee,ba as f,bt as re,ct as Me,ki as ae,kr as De,tt as U,wa as R,wi as Fe,xi as $e,zi as Y,zr as q}from"./chat-page-C-flp553.js";import{ar as Be}from"./community-page-dub7UFXa.js";var o=Ne(Se(),1),e=Ce(),Ve=()=>{const[i]=Be(De),[ie,le]=(0,o.useState)([]),[oe,E]=(0,o.useState)(!1),[a,ne]=(0,o.useState)(null),[M,k]=(0,o.useState)(!1),[S,D]=(0,o.useState)(!1),[F,j]=(0,o.useState)(0),[d,L]=(0,o.useState)(0),[J,$]=(0,o.useState)(!1),[K,Z]=(0,o.useState)(null),[Pe,de]=(0,o.useState)(0),[B,v]=(0,o.useState)(null),[P,y]=(0,o.useState)(null),[ce,Q]=(0,o.useState)(!1),[m,X]=(0,o.useState)(null),[T,g]=(0,o.useState)(!1),[W,b]=(0,o.useState)(!1),G=(0,o.useRef)(),_=(0,o.useRef)(null),C=(0,o.useRef)(null),ue=7e3,[he,V]=(0,o.useState)(0),ee=async()=>{if(i)try{const t=new Date(new Date().getTime()-864e5),s=await Ae(ae(Y(p,"stories"),Ie("userId","==",i.uid),te("createdAt","desc"))),r=[];s.docs.forEach(u=>{const l=u.data(),n=l.createdAt?.toDate();n&&n<t&&l.userId===i.uid&&r.push({id:u.id,...l})});const h=r.map(async u=>{try{if(u.userId===i.uid&&(await O(N(p,"stories",u.id)),u.imageUrl))try{await q(z(A,u.imageUrl))}catch(l){console.warn("Failed to delete expired story image:",l)}}catch(l){console.error("Error deleting expired story:",l)}});await Promise.all(h),r.length>0&&(console.log(`ð§¹ Cleaned up ${r.length} expired stories`),de(u=>u+r.length))}catch(t){console.error("Error cleaning up expired stories:",t)}};(0,o.useEffect)(()=>{if(!i)return;const t=ke(ae(Y(p,"stories"),te("createdAt","desc")),s=>{const r=[],h=[],u=new Date,l=1440*60*1e3;s.docs.forEach(n=>{const c=n.data(),x=c.createdAt?.toDate();if(x){const w=u-x;if(w<l){const I=l-w;r.push({id:n.id,...c,createdAt:x,timeLeft:I,isExpiringSoon:I<7200*1e3})}else h.push({id:n.id,...c})}}),h.length>0&&h.forEach(async n=>{try{n.userId===i.uid&&(await O(N(p,"stories",n.id)),n.imageUrl&&await q(z(A,n.imageUrl)).catch(console.warn))}catch(c){console.error("Error auto-deleting expired story:",c)}}),le(r.reduce((n,c)=>{const x=n.find(w=>w.userId===c.userId);return x?(x.stories.push(c),x.stories.sort((w,I)=>I.createdAt-w.createdAt)):n.push({userId:c.userId,username:c.username,displayName:c.displayName,photoURL:c.userPhotoURL,avatar:c.userAvatar||c.userPhotoURL,stories:[c],hasStory:!0,latestStory:c,hasExpiringSoon:c.isExpiringSoon}),n},[]))});return _.current=setInterval(ee,1800*1e3),ee(),()=>{t(),_.current&&clearInterval(_.current)}},[i]),(0,o.useEffect)(()=>{if(!M||!a?.stories?.length){C.current&&cancelAnimationFrame(C.current),V(0);return}V(0);const t=Date.now();let s;const r=()=>{const h=Math.min(100,(Date.now()-t)/ue*100);V(h),h<100?(s=requestAnimationFrame(r),C.current=s):d<a.stories.length-1?(L(u=>u+1),g(!0),b(!1)):k(!1)};return s=requestAnimationFrame(r),C.current=s,()=>cancelAnimationFrame(s)},[M,a,d]);const xe=t=>{const s=t.target.files[0];if(!s||!s.type.startsWith("image/")||s.size>10*1024*1024)return;v(s);const r=new FileReader;r.onload=h=>{y(h.target.result)},r.readAsDataURL(s)},me=async()=>{if(B)try{D(!0),j(0);const t=setInterval(()=>{j(l=>l>=90?(clearInterval(t),l):l+Math.random()*10)},200),s=await Re((await Ue(z(A,`stories/${i.uid}/${Date.now()}_${B.name}`),B)).ref);clearInterval(t),j(100);const r=i.displayName||i.email?.split("@")[0]||"Anonymous",h=i.photoURL||null;let u=h;try{const l=await Fe(N(p,"users",i.uid));if(l.exists()){const n=l.data();u=n.avatar||n.photoURL||h}}catch{}await $e(Y(p,"stories"),{userId:i.uid,username:i.email?.split("@")[0]||"anonymous",displayName:r,userPhotoURL:h,userAvatar:u,imageUrl:s,createdAt:se(),expiresAt:new Date(Date.now()+1440*60*1e3),views:0,viewedBy:[]}),setTimeout(()=>{E(!1),v(null),y(null),j(0)},1e3)}catch(t){console.error("Error uploading story:",t)}finally{D(!1)}},fe=()=>{E(!1),v(null),y(null),j(0),D(!1)},pe=async t=>{if(ne(t),L(0),k(!0),g(!0),b(!1),t.userId!==i?.uid&&t.stories?.[0])try{await Le(N(p,"stories",t.stories[0].id),{views:(t.stories[0].views||0)+1,viewedBy:ze({userId:i.uid,username:i.displayName||i.email?.split("@")[0],viewedAt:se()})})}catch(s){console.error("Error tracking story view:",s)}},ge=()=>{g(!1),b(!1)},be=()=>{g(!1),b(!0)},we=async(t,s)=>{if(i)try{if(Z(t),await O(N(p,"stories",t)),s)try{await q(z(A,s))}catch(r){console.warn("Failed to delete image from storage:",r)}k(!1),$(!1)}catch(r){console.error("Error deleting story:",r)}finally{Z(null)}},je=t=>i&&t.userId===i.uid,ve=()=>{a&&a.stories&&(L((d+1)%a.stories.length),g(!0),b(!1))},ye=()=>{a&&a.stories&&(L(d===0?a.stories.length-1:d-1),g(!0),b(!1))};return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"bg-[#0d0d12] border border-white/[0.06] rounded-2xl px-4 pt-4 pb-3",children:(0,e.jsxs)("div",{className:"flex items-end gap-3 overflow-x-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:[(0,e.jsxs)(f.div,{whileHover:{scale:1.03,y:-2},whileTap:{scale:.97},onClick:()=>
1E(!0),className:"flex-shrink-0 w-[72px] sm:w-[82px] cursor-pointer group",children:[(0,e.jsxs)("div",{className:"relative w-full rounded-2xl overflow-hidden border border-white/10 group-hover:border-red-500/50 transition-colors",style:{aspectRatio:"9/14"},children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-red-950/60 via-[#0d0d12] to-slate-900"}),i?.photoURL&&(0,e.jsx)("img",{src:i.photoURL,alt:"",className:"absolute inset-0 w-full h-full object-cover opacity-20"}),(0,e.jsx)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2",children:(0,e.jsx)("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-red-500 to-[#8b0724] flex items-center justify-center shadow-lg shadow-red-950/60 group-hover:shadow-red-600/40 transition-shadow",children:(0,e.jsx)(re,{className:"w-5 h-5 text-white"})})})]}),(0,e.jsx)("p",{className:"text-center text-[10px] text-slate-400 mt-1.5 font-medium group-hover:text-white transition-colors",children:"Add Story"})]}),ie.map(t=>{const s=t.latestStory,r=s?.timeLeft||0,h=Math.floor(r/(3600*1e3)),u=Math.floor(r%(3600*1e3)/(60*1e3)),l=r<7200*1e3,n=t.userId===i?.uid,c=n?"You":t.displayName||t.username||"Trader",x=t.stories.length;return(0,e.jsxs)(f.div,{whileHover:{scale:1.03,y:-2},whileTap:{scale:.97},onClick:()=>pe(t),className:"flex-shrink-0 w-[72px] sm:w-[82px] cursor-pointer group",children:[(0,e.jsxs)("div",{className:"relative w-full rounded-2xl overflow-hidden",style:{aspectRatio:"9/14"},children:[(0,e.jsx)("img",{src:s?.imageUrl,alt:"",className:"absolute inset-0 w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"}),(0,e.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-black/10 to-transparent"}),(0,e.jsx)("div",{className:`absolute inset-0 rounded-2xl ring-2 ring-inset transition-colors ${l?"ring-orange-500":"ring-[#da0b3f]/70"}`}),(0,e.jsx)("div",{className:"absolute top-2 left-2",children:(0,e.jsx)("div",{className:`w-7 h-7 rounded-full p-[1.5px] shadow-lg ${l?"bg-orange-500":"bg-gradient-to-br from-red-400 to-[#8b0724]"}`,children:(0,e.jsx)("div",{className:"w-full h-full rounded-full overflow-hidden bg-[#0d0d12] flex items-center justify-center",children:(0,e.jsx)(H,{user:t,size:"sm",showRing:!1})})})}),x>1&&(0,e.jsx)("div",{className:"absolute top-2 right-2 bg-black/60 backdrop-blur-sm border border-white/20 text-white font-bold px-1.5 py-0.5 rounded-full",style:{fontSize:9},children:x}),l&&(0,e.jsx)("div",{className:"absolute top-8 left-1/2 -translate-x-1/2 bg-orange-500/90 text-white font-bold px-1.5 py-0.5 rounded-full",style:{fontSize:8},children:h>0?`${h}h`:`${u}m`}),(0,e.jsx)("div",{className:"absolute bottom-0 left-0 right-0 px-2 pb-2.5",children:(0,e.jsx)("p",{className:"text-white font-semibold truncate leading-tight drop-shadow-sm",style:{fontSize:10},children:c})})]}),(0,e.jsx)("p",{className:`text-center font-medium mt-1.5 truncate transition-colors ${l?"text-orange-400":"text-slate-400 group-hover:text-white"}`,style:{fontSize:10},children:n?"Your Story":`${x} ${x===1?"story":"stories"}`})]},t.userId)})]})}),(0,e.jsx)(R,{children:oe&&(0,e.jsx)("div",{className:"fixed inset-0 bg-black/70 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:(0,e.jsxs)(f.div,{initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,y:20},className:"bg-slate-900/95 backdrop-blur-xl border border-slate-700/50 rounded-2xl w-full max-w-lg shadow-2xl",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-slate-700/50",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-xl font-bold text-white",children:"Create Story"}),(0,e.jsx)("p",{className:"text-slate-400 text-sm mt-1",children:"Share your trading insights ⢠Expires in 24h"})]}),(0,e.jsx)("button",{onClick:fe,className:"p-2 hover:bg-slate-700/50 rounded-xl transition-all",children:(0,e.jsx)(U,{className:"w-5 h-5 text-slate-400"})})]}),(0,e.jsxs)("div",{className:"p-6 space-y-6",children:[P?(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"relative rounded-2xl overflow-hidden bg-slate-800 aspect-[9/16] max-h-96",children:[(0,e.jsx)("img",{src:P,alt:"Story preview",className:"w-full h-full object-cover"}),(0,e.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-black/50 via-trans
1parent to-black/30"}),(0,e.jsx)("button",{onClick:()=>{v(null),y(null)},className:"absolute top-3 right-3 p-2 bg-black/50 hover:bg-black/70 rounded-full transition-all",children:(0,e.jsx)(U,{className:"w-4 h-4 text-white"})}),(0,e.jsxs)("div",{className:"absolute bottom-4 left-4 flex items-center gap-3",children:[(0,e.jsx)(H,{user:i,size:"sm",showRing:!1}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-white text-sm font-medium",children:"Your Story"}),(0,e.jsx)("p",{className:"text-white/70 text-xs",children:"Just now"})]})]})]}),(0,e.jsxs)("div",{className:"flex gap-3",children:[(0,e.jsx)("button",{onClick:()=>{v(null),y(null)},className:"flex-1 px-4 py-3 bg-slate-700/50 hover:bg-slate-700 text-slate-300 rounded-xl transition-all font-medium",children:"Choose Different"}),(0,e.jsx)("button",{onClick:me,disabled:S,className:"flex-1 px-4 py-3 bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-500 hover:to-pink-500 text-white rounded-xl transition-all font-semibold disabled:opacity-50 disabled:cursor-not-allowed",children:S?"Sharing...":"Share Story"})]})]}):(0,e.jsxs)("div",{className:"border-2 border-dashed border-slate-600/50 rounded-2xl p-12 text-center cursor-pointer hover:border-purple-500/50 hover:bg-purple-500/5 transition-all group",onClick:()=>G.current?.click(),children:[(0,e.jsx)("div",{className:"w-16 h-16 bg-gradient-to-br from-purple-500/20 to-pink-500/20 rounded-2xl flex items-center justify-center mx-auto mb-4 group-hover:scale-105 transition-transform",children:(0,e.jsx)(re,{className:"w-8 h-8 text-purple-400"})}),(0,e.jsx)("h4",{className:"text-white font-semibold mb-2",children:"Upload a Photo"}),(0,e.jsx)("p",{className:"text-slate-400 text-sm mb-4",children:"Share your trading setup, chart analysis, or market insights"}),(0,e.jsxs)("div",{className:"inline-flex items-center gap-2 text-purple-400 text-sm font-medium",children:[(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),"Choose Photo"]})]}),(0,e.jsx)("input",{ref:G,type:"file",accept:"image/*",onChange:xe,className:"hidden"}),S&&(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,e.jsx)("span",{className:"text-slate-300",children:"Uploading story..."}),(0,e.jsxs)("span",{className:"text-purple-400 font-medium",children:[Math.round(F),"%"]})]}),(0,e.jsx)("div",{className:"w-full bg-slate-700 rounded-full h-2 overflow-hidden",children:(0,e.jsx)(f.div,{initial:{width:0},animate:{width:`${F}%`},className:"h-full bg-gradient-to-r from-purple-500 to-pink-500 rounded-full",transition:{duration:.3}})}),F===100&&(0,e.jsxs)("div",{className:"flex items-center justify-center gap-2 text-green-400 text-sm font-medium",children:[(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Story shared successfully!"]})]}),!P&&!S&&(0,e.jsxs)("div",{className:"bg-slate-800/50 rounded-xl p-4 border border-slate-700/30",children:[(0,e.jsxs)("h5",{className:"text-white font-medium mb-2 flex items-center gap-2",children:[(0,e.jsx)("svg",{className:"w-4 h-4 text-yellow-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Story Tips"]}),(0,e.jsxs)("ul",{className:"text-slate-400 text-sm space-y-1",children:[(0,e.jsx)("li",{children:"⢠Stories disappear after 24 hours"}),(0,e.jsx)("li",{children:"⢠Share your best trading setups & insights"}),(0,e.jsx)("li",{children:"⢠Max file size: 10MB"})]})]})]})]})})}),(0,e.jsx)(R,{children:M&&a&&a.stories&&(0,e.jsxs)(f.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"fixed inset-0 z-[9999] flex items-center justify-center",style:{background:"rgba(0,0,0,0.97)",paddingTop:"env(safe-area-inset-top, 0px)",paddingBottom:"env(safe-area-inset-bottom, 0px)",paddingLeft:"env(safe-area-inset-left, 0px)",paddingRight:"env(safe-area-inset-right, 0px)"},children:[(0,e.jsxs)("div",{className:"absolute inset-0 hidden sm:block overflow-hidden pointer-events-none",children:[(0,e.jsx)("img",{src:a.stories[d]?.imageUrl,alt:"",className:"w-full h-full object-cover opacity-15 blur-3xl scale-110"}),(0,e.jsx)("div",{className:"absolute inset-0 bg-black/50"})]}),(0,e.jsxs)(f.div,{initial:{opacity:0,scale:.97},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.97},transition:{duration:.22,ease:"easeOut"},className:"relative w-full h-full sm:w-auto sm:h-auto sm:rounded-3xl overflow-hidden sm:shadow-2xl sm:shadow-black/80",style:{maxWidth:"min(100vw, 420px)",maxHeight:"100dvh"},children:[(0,e.jsx)("div",{className:"absolute left-3 right-3 flex gap-1 z-20",style:{top:"calc(env(safe-area-inset-top, 0px) + 10px)"},children:a.stories.map((t,s)=>(0,e.jsx)("div",{className:"flex-1 h-[3px] rounded-full bg-white/25 overflow-hidden",children:(0,e.jsx)("div",{className:"h-full rounded-full bg-white",style:{width:s<d?"100%":s===d?`${he}%`:"0%",transition:"none"}})},s))}),(0,e.jsxs)("div",{className:"absolute left-3 right-14 flex items-center gap-2.5 z-20",style:{top:"calc(env(safe-area-inset-top, 0px) + 26px)"},children:[(0,e.jsx)("div",{className:"w-9 h-9 rounded-full bg-gradient-to-br from-red-500 to-[#8b0724] p-[1.5px] flex-shrink-0 shadow-lg",children:(0,e.jsx)("div",{className:"w-full h-full rounded-full overflow-hidden bg-[#0d0d12] flex items-center justify-center",children:(0,e.jsx)(H,{user:a,size:"sm",showRing:!1})})}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("p",{className:"text-white text-[13px] font-bold truncate leading-none mb-0.5",children:a.displayName||a.username}),(0,e.jsx)("p",{className:"text-white/50 text-[11px] leading-none",children:a.stories[d]?.createdAt?.toLocaleString([],{hour:"2-digit",minute:"2-digit",month:"short",day:"numeric"})})]})]}),(0,e.jsxs)("div",{className:"absolute right-3 flex items-center gap-2 z-30",style:{top:"calc(env(safe-area-inset-top, 0px) + 26px)"},children:[je(a.stories[d])&&(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)(f.button,{whileTap:{scale:.9},onClick:()=>$(!J),className:"w-9 h-9 bg-black/50 backdrop-blur-md rounded-full flex items-center justify-center border border-white/15 shadow-lg",children:(0,e.jsx)(Ee,{className:"w-4 h-4 text-white"})}),(0,e.jsx)(R,{children:J&&(0,e.jsxs)(f.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},className:"absolute top-11 right-0 bg-[#1a1a24]/95 backdrop-blur-xl border border-white/10 rounded-2xl py-1.5 w-40 shadow-2xl overflow-hidden",children:[(0,e.jsxs)("button",{onClick:()=>{X(a.stories[d]),Q(!0),$(!1)},className:"w-full px-4 py-2.5 text-left text-blue-400 hover:bg-blue-500/10 flex items-center gap-2.5 text-[13px] font-medium transition-colors",children:[(0,e.jsxs)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),"View Insights"]}),(0,e.jsx)("div",{className:"h-px bg-white/8 mx-3"}),(0,e.jsxs)("button",{onClick:()=>we(a.stories[d].id,a.stories[d].imageUrl),disabled:!!K,className:"w-full px-4 py-2.5 text-left text-red-400 hover:bg-red-500/10 flex items-center gap-2.5 text-[13px] font-medium transition-colors disabled:opacity-50",children:[(0,e.jsx)(Me,{className:"w-4 h-4"}),K?"Deletingâ¦":"Delete Story"]})]})})]}),(0,e.jsx)(f.button,{whileTap:{scale:.9},onClick:()=>k(!1),className:"w-9 h-9 bg-black/50 backdrop-blur-md rounded-full flex items-center justify-center border border-white/15 shadow-lg hover:bg-red-500/60 transition-colors",children:(0,e.jsx)(U,{className:"w-4 h-4 text-white",strokeWidth:2.5})})]}),a.stories.length>1&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{onClick:ye,className:"absolute left-0 top-0 w-[35%] h-full z-10 focus:outline-none","aria-label":"Previous story"}),(0,e.jsx)("button",{onClick:ve,className:"absolute right-0 top-0 w-[65%] h-full z-10 focus:outline-none","aria-label":"Next story"})]}),(0,e.jsxs)("div",{className:"w-full h-full flex items-center justify-center relative bg-black",children:[T&&(0,e.jsx)("div",{className:"absolute inset-0 bg-slate-800/50 backdrop-blur-sm flex items-center justify-center rounded-lg z-10",children:(0,e.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,e.jsx)("div",{className:"w-8 h-8 border-2 border-white/30 border-t-white rounded-full animate-spin"}),(0,e.jsx)("p",{className:"text-white/70 text-sm",children:"Loading story..."})]})}),W&&(0,e.jsx)("div",{className:"absolute inset-0 bg-slate-800/50 backdrop-blur-sm flex items-center justify-center rounded-lg z-10",children:(0,e.jsxs)("div",{className:"flex flex-col items-center gap-3 text-center",children:[(0,e.jsx)("div",{className:"w-12 h-12 bg-red-500/20 rounded-full flex items-center justify-center",children:(0,e.jsx)("svg",{className:"w-6 h-6 text-red-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-white font-medium",children:"Failed to load story"}),(0,e.jsx)("p",{className:"text-white/60 text-sm",children:"This story may have been deleted"})]}),(0,e.jsx)("button",{onClick:()=>{b(!1),g(!0)},className:"px-4 py-2 bg-white/10 hover:bg-white/20 text-white rounded-lg text-sm transition-colors",children:"Try Again"})]})}),(0,e.jsx)("img",{src:a.stories[d]?.imageUrl,alt:"Story",className:`w-full h-full object-cover transition-opacity duration-300 ${T||W?"opacity-0":"opacity-100"}`,onLoad:ge,onError:be},a.stories[d]?.id),!T&&!W&&(0,e.jsx)("div",{className:"absolute inset-0 bg-gradient-to-b from-black/55 via-trans
1parent to-black/45 pointer-events-none"})]}),a.stories.length>1&&(0,e.jsxs)("div",{className:"absolute bottom-5 right-4 z-20 bg-black/55 backdrop-blur-md text-white/90 font-semibold px-2.5 py-1 rounded-full border border-white/10",style:{fontSize:11},children:[d+1,"/",a.stories.length]}),a.stories.length>1&&d===0&&(0,e.jsx)("div",{className:"absolute bottom-5 left-4 z-20 text-white/40 bg-black/30 backdrop-blur-sm px-2.5 py-1 rounded-lg",style:{fontSize:10},children:"Tap to navigate"})]},`story-viewer-${d}`)]})}),(0,e.jsx)(R,{children:ce&&m&&(0,e.jsx)("div",{className:"fixed inset-0 bg-black/70 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:(0,e.jsxs)(f.div,{initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,y:20},className:"bg-slate-900/95 backdrop-blur-xl border border-slate-700/50 rounded-2xl w-full max-w-md shadow-2xl",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-slate-700/50",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-xl font-bold text-white",children:"Story Insights"}),(0,e.jsx)("p",{className:"text-slate-400 text-sm mt-1",children:"See who viewed your story"})]}),(0,e.jsx)("button",{onClick:()=>{Q(!1),X(null)},className:"p-2 hover:bg-slate-700/50 rounded-xl transition-all",children:(0,e.jsx)(U,{className:"w-5 h-5 text-slate-400"})})]}),(0,e.jsxs)("div",{className:"p-6",children:[(0,e.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-6",children:[(0,e.jsxs)("div",{className:"bg-slate-800/50 rounded-xl p-4 text-center",children:[(0,e.jsx)("div",{className:"text-2xl font-bold text-white mb-1",children:m.views||0}),(0,e.jsx)("div",{className:"text-slate-400 text-sm",children:"Total Views"})]}),(0,e.jsxs)("div",{className:"bg-slate-800/50 rounded-xl p-4 text-center",children:[(0,e.jsx)("div",{className:"text-2xl font-bold text-white mb-1",children:m.viewedBy?.length||0}),(0,e.jsx)("div",{className:"text-slate-400 text-sm",children:"Unique Viewers"})]})]}),(0,e.jsxs)("div",{className:"mb-6",children:[(0,e.jsx)("h4",{className:"text-white font-semibold mb-3",children:"Your Story"}),(0,e.jsxs)("div",{className:"relative rounded-xl overflow-hidden bg-slate-800 aspect-[16/9]",children:[(0,e.jsx)("img",{src:m.imageUrl,alt:"Your story",className:"w-full h-full object-cover"}),(0,e.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-black/50 via-transparent to-transparent"}),(0,e.jsx)("div",{className:"absolute bottom-3 left-3 text-white text-sm font-medium",children:m.createdAt?.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]})]}),m.viewedBy&&m.viewedBy.length>0?(0,e.jsxs)("div",{children:[(0,e.jsxs)("h4",{className:"text-white font-semibold mb-3 flex items-center gap-2",children:[(0,e.jsxs)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),"Viewers (",m.viewedBy.length,")"]}),(0,e.jsx)("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:m.viewedBy.sort((t,s)=>(s.viewedAt?.seconds||0)-(t.viewedAt?.seconds||0)).map((t,s)=>(0,e.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-slate-800/30 rounded-lg",children:[(0,e.jsx)("div",{className:"w-8 h-8 bg-gradient-to-br from-purple-500 to-pink-500 rounded-full flex items-center justify-center text-white text-sm font-bold",children:t.username?.charAt(0)?.toUpperCase()||"U"}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("p",{className:"text-white text-sm font-medium truncate",children:t.username||"Anonymous"}),(0,e.jsx)("p",{className:"text-slate-400 text-xs",children:t.viewedAt?.toDate?.()?.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})||"Recently"})]})]},s))})]}):(0,e.jsxs)("div",{className:"text-center py-8",children:[(0,e.jsx)("div",{className:"w-16 h-16 bg-slate-800/50 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,e.jsxs)("svg",{className:"w-8 h-8 text-slate-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})}),(0,e.jsx)("h4",{className:"text-white font-medium mb-2",children:"No views yet"}),(0,e.jsx)("p",{className:"text-slate-400 text-sm",children:"Your story hasn't been viewed by anyone yet"})]}),(0,e.jsxs)("div",{className:"mt-6 p-4 bg-gradient-to-r from-orange-500/10 to-red-500/10 border border-orange-500/20 rounded-xl",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-orange-400 mb-1",children:[(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,e.jsx)("span",{className:"text-sm font-medium",children:"Expires in"})]}),(0,e.jsx)("p",{className:"text-white text-sm",children:(()=>{const t=m.timeLeft||0,s=Math.floor(t/(3600*1e3)),r=Math.floor(t%(3600*1e3)/(60*1e3));return s>0?`${s} hours and ${r} minutes`:r>0?`${r} minutes`:"Less than a minute"})()})]})]})]})})})]})};export{Ve as default};
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.