PageSourceSearch

https://www.spheral.ai/assets/NewsPage-J5F1FaGh.js

js spheral.ai collected 2026-10-05 15:51:27 UTC 8,803 bytes, 1 lines download raw bytes

1import{r as c,j as e}from"./react-B054aK_Y.js";import{u as oe,f as z,a as Y,i as q,b as ce,N as de,D as ue,c as me,d as pe,e as he,g as we,A as ge,m as fe}from"./index-D60IcrvY.js";/* empty css                  */import{u as xe,e as be}from"./vendor-DRfpkOi7.js";import"./react-dom-CVlumWUr.js";import"./gsap-0lJgtTtq.js";function V(s,a){const u=new Date(s);return Number.isNaN(u.getTime())?s:new Intl.DateTimeFormat(a==="it"?"it-IT":"en-GB",{year:"numeric",month:"long",day:"numeric",timeZone:"Europe/Rome"}).format(u)}function ye({block:s,lang:a}){return s.type==="p"?e.jsx("p",{className:"news-prose",children:s.text[a]}):s.type==="ul"?e.jsxs(e.Fragment,{children:[s.intro&&e.jsx("p",{className:"news-prose",children:s.intro[a]}),e.jsx("ul",{className:"news-list",children:s.items.map((u,d)=>e.jsx("li",{children:u[a]},d))})]}):e.jsx("blockquote",{className:"news-blockquote",cite:s.cite,children:s.text[a]})}const ve=()=>{var L,T,M,D;const{language:s,t:a}=oe(),u=xe(),{slug:d}=be(),[l,k]=c.useState(null),[A,v]=c.useState(null),[n,y]=c.useState(null),[$,g]=c.useState("idle"),[f,x]=c.useState(null),[N,Z]=c.useState(()=>Date.now()),[J,I]=c.useState(!1),[C,E]=c.useState(!1);c.useEffect(()=>{const t=window.setInterval(()=>Z(Date.now()),6e4);return()=>window.clearInterval(t)},[]),c.useEffect(()=>{const t=new AbortController;return(async()=>{try{const r=await z({limit:12,signal:t.signal});if(t.signal.aborted)return;k(Y(r.items,Date.now())),v(r.nextCursor),x(null)}catch{t.signal.aborted||(x(a.news_error_load),k(null))}})(),()=>t.abort()},[a.news_error_load]);const S=l??[],m=c.useMemo(()=>{if(l===null&&!d)return{kind:"pending"};if(l&&l.length===0&&!d)return{kind:"empty"};if(!d)return l?l.length===0?{kind:"empty"}:{kind:"ok",slug:l[0].slug}:{kind:"pending"};if(l&&l.some(r=>r.slug===d)){const r=l.find(b=>b.slug===d);return q(r.publishedAt,N)?{kind:"ok",slug:d}:{kind:"notYet"}}return{kind:"ok",slug:d}},[l,d,N]),p=m.kind==="ok"?m.slug:null,K=c.useCallback(t=>{u(`/news/${encodeURIComponent(t)}`)},[u]);c.useEffect(()=>{d||!l||l.length===0||u(`/news/${encodeURIComponent(l[0].slug)}`,{replace:!0})},[d,l,u]),c.useEffect(()=>{if(m.kind!=="ok"||!p){y(null),g("idle");return}const t=new AbortController;return g("loading"),(async()=>{try{const r=await ce(p,t.signal);if(t.signal.aborted)return;if(!q(r.publishedAt,N)){y(null),g("missing");return}y(r),g("ok"),x(null)}catch(r){if(t.signal.aborted)return;y(null),r instanceof de&&r.status===404?(g("missing"),x(null)):(g("idle"),x(a.news_error_load))}})(),()=>t.abort()},[m.kind,p,a.news_error_load,N]);const Q=async()=>{if(!(!A||C)){E(!0);try{const t=await z({limit:12,cursor:A});k(r=>Y([...r??[],...t.items],Date.now())),v(t.nextCursor)}catch{}finally{E(!1)}}},h=fe(),w=`${h}/news/${p??""}`,X=c.useMemo(()=>{var G,U,O,H,R,B,W;if(m.kind!=="ok"||!n||!p)return null;const t=`${n.title[s]} | Spheral`,r=n.description[s],b=(O=(U=(G=n.seo)==null?void 0:G.keywords)==null?void 0:U[s])==null?void 0:O.trim(),F=((R=(H=n.seo)==null?void 0:H.articleTags)==null?void 0:R[s])??[],o=n.image,j=(B=o==null?void 0:o.url)!=null&&B.startsWith("https://")?o.url:`${h}${ue}`,ne=(o==null?void 0:o.width)!=null?String(o.width):me,ie=(o==null?void 0:o.height)!=null?String(o.height):pe,ae=((W=o==null?void 0:o.type)==null?void 0:W.trim())||he,re=`${h}/news`,i=n.geo,P=n.updatedAt||n.publishedAt,_=[{id:"spheral-docmeta-author",name:"author",content:"Spheral AI"}];i!=null&&i.countryCode&&(i!=null&&i.regionCode)&&_.push({id:"spheral-docmeta-geo-reg",name:"geo.region",content:`${i.countryCode}-${i.regionCode}`}),i!=null&&i.placename&&_.push({id:"spheral-docmeta-geo-place",name:"geo.placename",content:i.placename}),(i==null?void 0:i.latitude)!=null&&(i==null?void 0:i.longitude)!=null&&_.push({id:"spheral-docmeta-geo-pos",name:"geo.position",content:`${i.latitude};${i.longitude}`});const le={"@context":"https://schema.org","@graph":[{"@type":"NewsArticle","@id":`${w}#article`,headline:n.title[s],description:r,datePublished:n.publishedAt,dateModified:P,inLanguage:s,url:w,mainEntityOfPage:{"@type":"WebPage","@id":w},image:[j],keywords:F.join(", "),author:{"@type":"Organization",name:"Spheral AI",url:h},publisher:{"@type":"Organization",name:"Spheral AI",url:h,logo:{"@type":"ImageObject",url:`${h}/logo.svg`}},locationCreated:i?{"@type":"Place",name:i.placename,address:{"@type":"PostalAddress",addressLocality:i.placename,addressRegion:i.regionCode,addressCountry:i.countryCode}}:void 0,isAccessibleForFree:!0,articleSection:"News"},{"@type":"BreadcrumbList","@id":`${w}#breadcrumb`,itemListElement:[{"@type":"ListItem",position:1,name:"Home",item:`${h}/`},{"@type":"ListItem",position:2,name:"News",item:re},{"@type":"ListItem",position:3,name:n.title[s],item:w}]}]};return{title:t,htmlLang:s==="it"?"it":"en",description:r,keywords:b||null,robots:"index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1",canonicalUrl:w,linkAlternates:[{id:"spheral-docmeta-href-it",rel:"alternate",href:`${h}/news/${p}`,hrefLang:"it"},{id:"spheral-docmeta-href-en",rel:"alternate",href:`${h}/news/${p}`,hrefLang:"en"},{id:"spheral-docmeta-href-xd",rel:"alternate",href:w,hrefLang:"x-default"}],openGraph:{title:n.title[s],description:r,type:"article",url:w,siteName:"Spheral",locale:s==="it"?"it_IT":"en_US",image:{url:j,secureUrl:j,width:ne,height:ie,type:ae,alt:n.title[s]}},twitter:{card:"summary_large_image",title:n.title[s],description:r,image:j},extraPropertyMetas:[{id:"spheral-docmeta-article-section",property:"article:section",content:"News"},{id:"spheral-docmeta-article-author",property:"article:author",content:"Spheral AI"},{id:"spheral-docmeta-published",property:"article:published_time",content:n.publishedAt},{id:"spheral-docmeta-modified",property:"article:modified_time",content:P}],extraNameMetas:_,articleOgTags:F,jsonLd:le}},[n,s,p,h,w,m.kind]);we(X);const ee=((M=(T=(L=n==null?void 0:n.seo)==null?void 0:L.articleTags)==null?void 0:T[s])==null?void 0:M.slice(0,2))??[],te=$==="missing",se=async()=>{const t=w;try{await navigator.clipboard.writeText(t),I(!0),window.setTimeout(()=>I(!1),2e3)}catch{I(!1)}};return e.jsx("div",{className:"legal-page news-page",children:e.jsxs("div",{className:"news-article-shell",children:[e.jsxs("button",{type:"button",className:"back-button 
1news-back",onClick:()=>u("/"),children:[e.jsx(ge,{size:16}),a.account_back_site]}),f&&e.jsx("p",{className:"news-error",children:f}),!f&&(m.kind==="pending"||$==="loading")&&e.jsx("p",{className:"news-banner is-muted",children:a.news_syncing}),!f&&m.kind==="empty"&&e.jsx("p",{className:"news-banner is-muted",children:a.news_empty}),!f&&m.kind==="notYet"&&e.jsx("p",{className:"news-banner is-warn",children:a.news_not_yet}),!f&&te&&e.jsx("p",{className:"news-banner is-warn",children:a.news_not_found}),n&&p&&m.kind==="ok"&&e.jsxs("article",{children:[e.jsxs("header",{className:"news-article-hero",children:[e.jsxs("p",{className:"news-kicker",children:[e.jsx("time",{dateTime:n.publishedAt,children:V(n.publishedAt,s)}),ee.map(t=>e.jsx("span",{children:t},t))]}),e.jsx("h1",{className:"news-article-title",children:n.title[s]}),n.subtitle&&e.jsx("p",{className:"news-article-subtitle",children:n.subtitle[s]}),e.jsx("div",{className:"news-toolbar",children:e.jsx("button",{type:"button",className:"news-share",onClick:()=>void se(),children:J?a.news_share_done:a.news_share})})]}),((D=n.image)==null?void 0:D.url)&&e.jsx("img",{className:"news-cover",src:n.image.url,alt:""}),e.jsxs("div",{className:"news-split",children:[e.jsxs("nav",{className:"news-toc","aria-label":a.news_sidebar_title,children:[e.jsx("p",{className:"news-toc-title",children:a.news_sidebar_title}),e.jsx("ul",{children:n.sections.map(t=>e.jsx("li",{children:e.jsx("a",{href:`#${t.id}`,children:t.heading[s]})},t.id))})]}),e.jsxs("div",{className:"news-article-body",children:[n.sections.map(t=>e.jsxs("section",{id:t.id,className:"news-section",children:[e.jsx("h2",{className:"news-section-title",children:t.heading[s]}),t.blocks.map((r,b)=>e.jsx(ye,{block:r,lang:s},`${t.id}-${b}`))]},t.id)),n.links&&n.links.length>0&&e.jsx("div",{className:"news-links",children:n.links.map(t=>e.jsx("a",{href:t.href,rel:"noopener noreferrer",target:"_blank",children:t.label[s]},t.href))})]})]}),S.length>1&&e.jsxs("aside",{className:"news-more","aria-label":a.news_sidebar_title,children:[e.jsx("p",{className:"news-toc-title",children:a.nav_news}),e.jsx("ul",{className:"news-more-list",children:S.filter(t=>t.slug!==p).map(t=>e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>K(t.slug),children:[e.jsx("span",{children:t.title[s]}),e.jsx("span",{className:"news-index-date",children:V(t.publishedAt,s)})]})},t.slug))}),A&&e.jsx("button",{type:"button",className:"news-share",onClick:()=>void Q(),disabled:C,children:a.news_load_more})]})]})]})})};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.