1import{u as F,j as e}from"./index-CiCw9Duq.js";import{r as m}from"./vendor-i18n-BBu7i065.js";import{u as P}from"./use-document-meta-RQbJsPUf.js";import{u as q}from"./vendor-react-BL5zx_iT.js";import{A as H,a9 as O,a6 as T,_ as R,N as B,ad as S,aJ as U,aF as D,bt as Y,bu as G,bv as v,bw as J,bx as K,by as C,bz as _,bA as Q}from"./vendor-ui-Ct1FBp4w.js";import"./vendor-solana-BIelvPCZ.js";import"./vendor-supabase-DbyvBBOg.js";function $(t){return t.startsWith("/api/image-proxy")||t.startsWith("/.netlify/functions/image-proxy")}function z(t){return $(t)?t:`/api/image-proxy?url=${encodeURIComponent(t)}`}const V=[/\bpro[-\s]?(trans|transgender|gay|lesbian|lgbtq?\+?)\b/i,/\btransgender\b/i,/\btrans\s+(woman|women|man|men|kid|kids|child|children|youth|teen|teens|rights|athlete|athletes)\b/i,/\bnon[-\s]?binary\b/i,/\bgender[-\s]?(identity|affirming|transition|fluid|queer)\b/i,/\bdrag\s+(queen|queens|show|shows|brunch|story\s*hour)\b/i,/\bgay\s+(pride|rights|marriage|wedding|couple|couples|community|icon)\b/i,/\blesbian\s+(pride|rights|couple|couples|community|icon)\b/i,/\blgbtq?\+?\b/i,/\bpride\s+(month|parade|flag|festival)\b/i,/\bqueer\b/i];function X(t){const s=`${t.title||""} ${t.description||""}`;return V.some(r=>r.test(s))}function A(t){return t.filter(s=>!X(s))}const Z=[{key:"all",label:"For You"},{key:"crypto",label:"Crypto"},{key:"stocks",label:"Stocks"},{key:"tech",label:"Tech"},{key:"entertainment",label:"Entertainment"},{key:"sports",label:"Sports"},{key:"science",label:"Science"}];function M(t){if(!t)return"";const s=new Date(t);if(isNaN(s.getTime()))return"";const a=new Date().getTime()-s.getTime(),l=Math.floor(a/6e4),o=Math.floor(a/36e5),d=Math.floor(a/864e5);return l<1?"just now":l<60?`${l}m ago`:o<24?`${o}h ago`:d<7?`${d}
1d ago`:s.toLocaleDateString("en-US",{month:"short",day:"numeric",year:d>365?"numeric":void 0})}function L(t,s){return t===0?{label:s?"Clear":"Clear night",Icon:s?Y:G}:t===1||t===2?{label:"Partly cloudy",Icon:v}:t===3?{label:"Overcast",Icon:v}:t===45||t===48?{label:"Fog",Icon:J}:t>=51&&t<=57?{label:"Drizzle",Icon:K}:t>=61&&t<=67?{label:"Rain",Icon:C}:t>=71&&t<=77?{label:"Snow",Icon:_}:t>=80&&t<=82?{label:"Rain showers",Icon:C}:t===85||t===86?{label:"Snow showers",Icon:_}:t>=95?{label:"Thunderstorm",Icon:Q}:{label:"â",Icon:v}}const I="lf_weather_v1",E=1800*1e3;async function ee(t,s){const r=`https://api.open-meteo.com/v1/forecast?latitude=${t}&longitude=${s}¤t=temperature_2m,apparent_temperature,weather_code,is_day&timezone=auto&temperature_unit=fahrenheit`,a=await fetch(r,{signal:AbortSignal.timeout(1e4)});if(!a.ok)throw new Error("weather_failed");const l=await a.json(),o=l?.current||{},d=String(l?.timezone||"").split("/").pop()?.replace(/_/g," ")||"Your area";return{temp:Math.round(Number(o.temperature_2m)),feels:Math.round(Number(o.apparent_temperature)),code:Number(o.weather_code),isDay:o.is_day===1,place:d}}function te({isLight:t}){const[s,r]=m.useState("idle"),[a,l]=m.useState(null),o=m.useCallback(()=>{if(typeof navigator>"u"||!navigator.geolocation){r("error");return}r(x=>a?x:"loading"),navigator.geolocation.getCurrentPosition(async x=>{try{const u=await ee(x.coords.latitude,x.coords.longitude);l(u),r("ok");try{localStorage.setItem(I,JSON.stringify({ts:Date.now(),wx:u}))}catch{}}catch{r(u=>a?"ok":"error")}},()=>r(x=>a?"ok":"denied"),{enableHighAccuracy:!1,timeout:9e3,maximumAge:E})},[a]);m.useEffect(()=>{try{const u=localStorage.getItem(I);if(u){const w=JSON.parse(u);w?.wx&&Date.now()-(w.ts||0)<E&&(l(w.wx),r("ok"))}}catch{}const x=navigator;x?.permissions?.query&&x.permissions.query({name:"geolocation"}).then(u=>{u.state==="granted"&&o()}).catch(()=>{})},[]);const d=`px-4 sm:px-6 py-2.5 border-b ${t?"border-gray-100":"border-white/[0.06]"}`;if(!a&&(s==="idle"||s==="denied"||s==="error"))return e.jsx("div",{className:d,children:e.jsxs("button",{onClick:o,className:`inline-flex items-center gap-2 text-[13px] font-medium rounded-full px-3 py-1.5 transition-colors ${t?"text-sky-600 hover:bg-sky-50":"text-sky-400 hover:bg-sky-500/10"}`,children:[e.jsx(S,{className:"w-4 h-4"}),s==="denied"?"Location off â tap to retry":"Show local weather"]})});if(!a&&s==="loading")return e.jsxs("div",{className:`${d} flex items-center gap-2`,children:[e.jsx(R,{className:`w-4 h-4 animate-spin ${t?"text-gray-300":"text-white/20"}`}),e.jsx("span",{className:`text-[13px] ${t?"text-gray-400":"text-white/30"}`,children:"Getting local weatherâ¦"})]});if(!a)return null;const c=L(a.code,a.isDay),j=c.Icon;return e.jsxs("div",{className:`${d} flex items-center gap-3`,children:[e.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0 ${t?"bg-sky-50 text-sky-600":"bg-sky-500/10 text-sky-400"}`,children:e.jsx(j,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsxs("span",{className:`text-lg font-bold ${t?"text-gray-900":"text-white"}`,children:[a.temp,"°F"]}),e.jsx("span",{className:`text-[13px] truncate ${t?"text-gray-500":"text-white/50"}`,children:c.label})]}),e.jsxs("div",{className:`flex items-center gap-1 text-xs ${t?"text-gray-400":"text-white/35"}`,children:[e.jsx(S,{className:"w-3 h-3 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:a.place}),e.jsxs("span",{className:"flex-shrink-0",children:["· feels ",a.feels,"°"]})]})]}),e.jsx("button",{onClick:o,className:`w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 transition-colors ${t?"text-gray-400 hover:bg-gray-100":"text-white/40 hover:bg-white/[0.06]"} ${s==="loading"?"opacity-50":""}`,title:"Refresh weather","aria-label":"Refresh weather",children:e.jsx(T,{className:`w-4 h-4 ${s==="loading"?"animate-spin":""}`})})]})}function me(){P({title:"News â creator economy & crypto headlines",description:"Daily creator-economy and crypto news curated for LimitlessFlo creators and $SPITCOIN holders.",canonical:"https://www.limitlessflo.com/news"});const t=q(),[s,r]=m.useState([]),[a,l]=m.useState(!0),[o,d]=m.useState(!1),[c,j]=m.useState("all"),[x,u]=m.useState({}),{theme:w}=F(),n=w==="light",N=m.useCallback(async(i,y=!1)=>
1{if(!y&&x[i]&&x[i].length>0){r(x[i]),l(!1);return}y?d(!0):l(!0);try{const k=[`/api/trending-news?category=${i}`,`/.netlify/functions/trending-news?category=${i}`];for(const g of k)try{const f=await fetch(g,{signal:AbortSignal.timeout(15e3)});if(f.ok){const b=await f.json();if(b.articles&&b.articles.length>0){const h=A(b.articles.map(p=>({...p,image:p.image&&typeof p.image=="string"?p.image.startsWith("//")?"https:"+p.image:p.image.replace(/^http:\/\//i,"https://"):p.image})));r(h),u(p=>({...p,[i]:h}));return}}}catch(f){console.warn("News: endpoint failed",g,f);continue}if(i==="all"||i==="tech")try{const g=await fetch("https://hn.algolia.com/api/v1/search?tags=front_page&hitsPerPage=10",{signal:AbortSignal.timeout(8e3)});if(g.ok){const f=await g.json();if(f.hits&&f.hits.length>0){const b=A(f.hits.map(h=>({title:h.title||h.story_title||"",description:h.story_text||h.comment_text||"",url:h.url||`https://news.ycombinator.com/item?id=${h.objectID}`,image:void 0,source:"Hacker News",publishedAt:h.created_at||"",category:"tech"})));r(b),u(h=>({...h,[i]:b}));return}}}catch(g){console.warn("News: HackerNews fallback failed",g)}r([])}catch(k){console.error("Error fetching news:",k)}finally{l(!1),d(!1)}},[x]);m.useEffect(()=>{N(c)},[c]);const W=i=>{j(i)};return e.jsxs("div",{className:`min-h-screen flex flex-col relative ${n?"bg-gray-100":"bg-[#1a1a1a]"}`,children:[e.jsx("div",{className:`absolute inset-0 pointer-events-none ${n?"opacity-[0.04]":"opacity-[0.025]"}`,style:{backgroundImage:`radial-gradient(circle, ${n?"#000":"#fff"} 0.5px, transparent 0.5px)`,backgroundSize:"20px 20px"}}),e.jsx("div",{className:"relative flex-1 flex justify-center px-3 sm:px-4 py-4 sm:py-6",children:e.jsxs("div",{className:`w-full rounded-2xl border overflow-hidden animate-in fade-in duration-300 ${n?"bg-white border-gray-200 shadow-xl":"bg-black border-white/[0.12] shadow-2xl shadow-black/60"}`,style:{maxWidth:1280},children:[e.jsxs("div",{className:`sticky top-0 z-40 ${n?"bg-white/90 backdrop-blur-2xl":"bg-black/90 backdrop-blur-2xl"}`,children:[e.jsxs("div",{className:"flex items-center px-4 sm:px-6 h-14",children:[e.jsx("button",{onClick:()=>t(-1),className:`w-9 h-9 rounded-full flex items-center justify-center transition-all ${n?"text-gray-500 hover:bg-gray-100":"text-white/50 hover:bg-white/[0.06]"}`,children:e.jsx(H,{className:"w-[18px] h-[18px]"})}),e.jsxs("div",{className:"flex-1 flex items-center justify-center gap-2",children:[e.jsx(O,{className:`w-4 h-4 ${n?"text-gray-400":"text-white/50"}`}),e.jsx("h1",{className:`text-[15px] font-bold tracking-tight ${n?"text-gray-900":"text-white"}`,children:"Explore"})]}),e.jsx("button",{onClick:()=>N(c,!0),disabled:o,className:`w-9 h-9 rounded-full flex items-center justify-center transition-all ${n?"text-gray-400 hover:bg-gray-100":"text-white/50 hover:bg-white/[0.06]"} ${o?"opacity-50":""}`,title:"Refresh",children:e.jsx(T,{className:`w-[18px] h-[18px] ${o?"animate-spin":""}`})})]}),e.jsx("div",{className:`flex overflow-x-auto scrollbar-hide border-b ${n?"border-gray-200/60":"border-white/[0.06]"}`,children:Z.map(i=>e.jsxs("button",{onClick:()=>W(i.key),className:`relative flex-shrink-0 px-4 sm:px-5 py-3 text-[13px] font-semibold transition-colors whitespace-nowrap ${c===i.key?n?"text-gray-900":"text-white":n?"text-gray-400 hover:text-gray-600 hover:bg-gray-50":"text-white/40 hover:text-white/70 hover:bg-white/[0.03]"}`,children:[i.label,c===i.key&&e.jsx("div",{className:`absolute bottom-0 left-1/2 -translate-x-1/2 w-12 h-[3px] rounded-full ${n?"bg-sky-500":"bg-sky-400"}`})]},i.key))})]}),e.jsx(te,{isLight:n}),a?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20",children:[e.jsx(R,{className:`w-8 h-8 animate-spin mb-3 ${n?"text-gray-300":"text-white/20"}`}),e.jsxs("p",{className:`text-sm ${n?"text-gray-400":"text-white/30"}`,children:["Loading ",c==="all"?"stories":c," news..."]})]}):s.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20",children:[e.jsx(B,{className:`w-10 h-10 mb-3 ${n?"text-gray-300":"text-white/20"}`}),e.jsxs("p",{className:`text-sm ${n?"text-gray-500":"text-white/40"}`,children:["No ",c==="all"?"":c+" ","articles available right now"]}),e.jsx("button",{onClick:()=>N(c,!0),className:"mt-3 px-4 py-2 text-sm text-sky-400 hover:bg-sky-400/10 rounded-full transition-colors",children:"Try again"})]}):e.jsxs(e.Fragment,{children:[e.jsx(se,{article:s[0],isLight:n}),s.length>
11&&e.jsx("div",{className:`divide-y ${n?"divide-gray-100":"divide-white/[0.06]"}`,children:s.slice(1).map((i,y)=>e.jsx(ae,{article:i,isLight:n},y))})]})]})})]})}function se({article:t,isLight:s}){const[r,a]=m.useState(t.image?z(t.image):null),l=()=>{r&&r.startsWith("/api/image-proxy")&&t.image&&!$(t.image)?a(t.image):a(null)};return e.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:`block border-b transition-colors group ${s?"border-gray-100 hover:bg-gray-50/50":"border-white/[0.06] hover:bg-white/[0.015]"}`,children:[r&&e.jsx("div",{className:"w-full h-[200px] sm:h-[260px] overflow-hidden",children:e.jsx("img",{src:r,alt:"",loading:"eager",className:"w-full h-full object-cover group-hover:scale-[1.02] transition-transform duration-500",onError:l})}),e.jsxs("div",{className:"px-4 sm:px-6 py-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2.5 gap-y-1 mb-3",children:[e.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] font-bold uppercase tracking-wider px-2 py-0.5 rounded flex-shrink-0 whitespace-nowrap ${s?"bg-sky-100 text-sky-600":"bg-sky-500/15 text-sky-400"}`,children:[e.jsx(U,{className:"w-3 h-3"}),"Trending"]}),t.source&&e.jsx("span",{className:`text-xs font-medium truncate max-w-[160px] ${s?"text-gray-400":"text-white/35"}`,children:t.source}),t.publishedAt&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`text-xs flex-shrink-0 ${s?"text-gray-300":"text-white/20"}`,children:"·"}),e.jsx("span",{className:`text-xs whitespace-nowrap flex-shrink-0 ${s?"text-gray-400":"text-white/35"}`,children:M(t.publishedAt)})]})]}),e.jsx("h2",{className:`text-lg sm:text-xl font-bold leading-snug mb-2 group-hover:text-sky-400 transition-colors ${s?"text-gray-900":"text-white"}`,children:t.title}),t.description&&e.jsx("p",{className:`text-sm leading-relaxed line-clamp-3 mb-3 ${s?"text-gray-500":"text-white/50"}`,children:t.description}),e.jsxs("div",{className:`inline-flex items-center gap-1.5 text-xs font-semibold ${s?"text-sky-600":"text-sky-400"}`,children:[e.jsx(D,{className:"w-3.5 h-3.5"}),"Read full article"]})]})]})}function ae({article:t,isLight:s}){const[r,a]=m.useState(t.image?z(t.image):null),l=()=>{r&&r.startsWith("/api/image-proxy")&&t.image&&!$(t.image)?a(t.image):a(null)};return e.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:`block px-4 sm:px-6 py-4 transition-colors ${s?"hover:bg-gray-50":"hover:bg-white/[0.02]"}`,children:e.jsxs("div",{className:"flex gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs mb-1.5 ${s?"text-gray-400":"text-white/35"}`,children:[t.source&&e.jsx("span",{className:"font-medium truncate max-w-[140px] sm:max-w-[180px]",children:t.source}),t.source&&t.publishedAt&&e.jsx("span",{className:"flex-shrink-0",children:"·"}),t.publishedAt&&e.jsx("span",{className:"whitespace-nowrap flex-shrink-0",children:M(t.publishedAt)}),t.category&&t.category!=="all"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"flex-shrink-0",children:"·"}),e.jsx("span",{className:`capitalize whitespace-nowrap flex-shrink-0 ${s?"text-sky-600":"text-sky-400/70"}`,children:t.category})]})]}),e.jsx("h2",{className:`text-[14px] sm:text-[15px] font-bold leading-snug mb-1.5 break-words ${s?"text-gray-900":"text-white"}`,children:t.title}),t.description&&e.jsx("p",{className:`text-[13px] sm:text-sm leading-relaxed line-clamp-2 break-words ${s?"text-gray-500":"text-white/50"}`,children:t.description}),e.jsxs("div",{className:`flex items-center gap-1 mt-2 text-xs font-medium ${s?"text-sky-600":"text-sky-400"}`,children:[e.jsx(D,{className:"w-3 h-3 flex-shrink-0"}),e.jsx("span",{className:"whitespace-nowrap",children:"Read full article"})]})]}),r&&e.jsx("div",{className:"w-20 h-16 sm:w-[120px] sm:h-[80px] rounded-xl overflow-hidden flex-shrink-0 self-start sm:self-center",children:e.jsx("img",{src:r,alt:"",loading:"lazy",className:"w-full h-full object-cover",onError:l})})]})})}export{me 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.