1import{d as N,r as l,j as e,a as E,b as D,u as T,e as k}from"./index-DH68tAln.js";import{S as H}from"./StickyNav-H8_6vajk.js";import{E as P}from"./EndingOption3-IRV0jmz9.js";import{C as R}from"./CTAFooter-ha32_KNe.js";import{R as V}from"./RelatedCardsSection-C3jJn-7n.js";import{I as B}from"./InsightHeroVisual-B276hUDd.js";import{V as L,E as A,A as C}from"./ArticleSections-DcZ9-c54.js";import{r as F}from"./PhoneCard3D-BSowh48a.js";import{u as O,a as q}from"./use-transform-CLCFcANh.js";import{A as G}from"./AdminEditButton-B43jdBUJ.js";import{P as M}from"./PreviewOverlay-POTDuMtx.js";import{S as W}from"./Seo-B0Ymx0aN.js";import{a as $}from"./insightsCms-CBw0OD_2.js";import K from"./NotFound-D_7bTcUq.js";import{s as Q}from"./CircleNotch.es-B4W_QKyd.js";import"./logo-colour-CWjD39W9.js";import"./lazy-img-CyrZA7H1.js";import"./use-motion-value-event-Ca2dcto_.js";import"./LemonLogoReveal-BjkCRxKA.js";import"./use-in-view-Nx2FrOjK.js";import"./SectionReveal-CaY2qw1z.js";import"./LemonHighlight-2Gz00oN6.js";import"./SlideReveal-sF8jlxZN.js";import"./CTAButton-PXu4O4qR.js";import"./SectionHeading-DJiBtarw.js";import"./CardGrid-BWaWXihF.js";import"./ParallaxHeroImage-C-Z6ijrq.js";import"./ContentCardGrid-C2SOPxur.js";import"./logo-hi-mini-CjDnCEQ4.js";import"./DecorativeQuotes-Dd8otqei.js";import"./StaggeredList-DqmW7LV7.js";import"./sectionImageShape-Cw9ThbUu.js";import"./CaretRight.es-CqmqOCVe.js";import"./CalloutSection-DLqa-IzZ.js";import"./CalloutQuote-CXQOdhz7.js";import"./AnchoredConnector-Bt1uXd2V.js";import"./DashedConnector-DHAMIk5F.js";import"./cmsEmbeds-B8S3k4KZ.js";import"./resolveRelativeLayers-rz6znpKJ.js";import"./use-spring-CtAud8nD.js";import"./use-mobile-DzYdnNuQ.js";import"./Pencil.es-ophNggc8.js";import"./Eye.es-B5Vpi38_.js";import"./ActionLink-BkkqYFhs.js";function U(t){if(!t)return t;const i=/^(\d{4})-(\d{1,2})(?:-(\d{1,2}))?$/.exec(t.trim()),n=i?new Date(Number(i[1]),Number(i[2])-1,i[3]?Number(i[3]):1):new Date(t);return isNaN(n.getTime())?t:n.toLocaleDateString("en-GB",{month:"long",year:"numeric"})}const Y=({data:t,card:i,relatedCards:n=[]})=>{N();const a=(i==null?void 0:i.heroBgImage)||(i==null?void 0:i.bgImage)||t.heroImage,r=!!(i!=null&&i.bgImage)&&!t.heroVideo,p=l.useRef(null),[b,m]=l.useState(!0),[s,d]=l.useState(!0);l.useEffect(()=>{const o=p.current;if(!o)return;const u=new IntersectionObserver(([j])=>m(j.isIntersecting),{rootMargin:"-72px 0px 0px 0px",threshold:0});return u.observe(o),()=>u.disconnect()},[]),l.useEffect(()=>{if(!a||!r)return;const o=new Image;o.crossOrigin="anonymous",o.onload=()=>{try{const f=document.createElement("canvas");f.width=32,f.height=32;const x=f.getContext("2d");if(!x)return;x.drawImage(o,0,0,o.width,o.height*.25,0,0,32,32);const{data:g}=x.getImageData(0,0,32,32);let I=0;const v=g.length/4;for(let h=0;h<g.length;h+=4)I+=.2126*g[h]+.7152*g[h+1]+.0722*g[h+2];const S=I/v;d(S<140)}catch{d(!0)}},o.src=a},[a,r]);const c=l.useRef(null),{scrollYProgress:y}=O({target:c,offset:["start start","end start"]});q(y,[0,1],["0%","40%"]);const w=()=>F(t.title,t.titleHighlight,{trailingDot:!0,variant:"color"});return e.jsxs("main",{className:"bg-background text-foreground",children:[e.jsx(H,{}),t.heroVideo?e.jsx("section",{"data-tone":"white",className:"bg-background section-x py-12 md:py-16",children:e.jsx("div",{className:"max-w-5xl mx-auto",children:e.jsx(L,{videoId:t.heroVideo.videoId,title:t.heroVideo.title})})}):e.jsx(A,{sectionRef:c,sentinelRef:p,headline:w(),standfirst:t.intro,below:e.jsxs("div",{className:"flex items-center gap-3 type-body-xs text-brand-cream/50",children:[e.jsx("span",{children:U(t.date)}),t.readTime&&e.jsx("span",{className:"w-1 h-1 bg-brand-cream/30 rounded-card"}),e.jsx("span",{children:t.readTime})]}),visual:r?e.jsx(B,{mode:"live",bgImageUrl:a,layers:i==null?void 0:i.layers}):void 0}),e.jsx(C,{sections:t.sections}),e.jsx(V,{cards:n}),e.jsx(R,{heading:"What's on your mind?",highlight:"your",body:"If something here sparked an idea, let's talk. We'll help you turn it into something real.",ctaLabel:"Get in touch",ctaHref:"mailto:[email protected]?subject=Something%20on%20my%20mind"}),e.jsx(P,{})]})},Oe=()=>{var d,c;const{slug:t}=E(),[i]=D(),n=i.get("preview")??void 0,a=!!n,{data:r,isLoading:p,isError:b}=T({queryKey:["public","insight",t,n??"public"],queryFn:()=>$(t,n),enabled:!!t});if(p)return e.jsx("div",{className:"min-h-screen grid place-items-center bg-background",children:e.jsx(Q,{className:"h-6 w-6 animate-spin text-muted-foreground"})});if(b||!r)return e.jsx(K,{});const m=r.data,s=k({slug:t,title:m.title,intro:m.intro,headline:m.headline,image:r.socialImage||((d=r.card)==null?void 0:d.heroBgImage)||((c=r.card)==null?void 0:c.bgImage)||m.heroImage,tags:m.tags,date:m.date,dateModified:r.updatedAt});
1return e.jsxs(e.Fragment,{children:[e.jsx(W,{title:s.title,description:s.description,path:s.path,image:s.image,type:s.type,publishedTime:s.publishedTime,tags:s.tags,jsonLd:a?void 0:s.jsonLd,noIndex:a}),a&&e.jsx(M,{message:"Preview only â this article is unpublished and isn't indexed by search engines.",manageTo:"/admin/insights"}),e.jsx(Y,{data:r.data,card:r.card,relatedCards:r.relatedCards}),e.jsx(G,{to:`/admin/insights/${r.id}`})]})};export{Oe 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.