PageSourceSearch

https://stromsundsgratistidning.se/assets/artikel._id._slug-C5Kf89Vm.js

js stromsundsgratistidning.se collected 2026-10-04 07:15:36 UTC 11,494 bytes, 1 lines download raw bytes

1import{c as _,r as u,aN as T,j as e,X as I,aO as M,z as q,b as O,s as B,aP as h,aQ as P,aR as G,H as $,F as U,f as S,x as V}from"./index-EhlWxbWg.js";import{r as Z,L as b,A as g,T as J}from"./LiveAdSlot-DCYL96Wz.js";import{m as K,p as W}from"./use-articles-BSUotXlq.js";import{a as X}from"./sanitize-D3JA78mb.js";import{C as A,a as E}from"./chevron-right-CZf1Adt8.js";import{A as H}from"./arrow-left-BGb0suHi.js";import{M as C}from"./map-pin-By4kmnPN.js";import{U as D}from"./user-AI3lbmpy.js";import{C as Q}from"./clock-edBaNvj3.js";import"./useQuery-DmN4wyzD.js";import"./blaljus.functions-B2jSfkkX.js";import"./siren-CSiRRYH0.js";import"./AdEditor-DsKlPgG8.js";import"./select-B3pyZnxW.js";import"./index-B3-Nhsmo.js";import"./index-De3Hm83N.js";import"./loader-circle-C7FhLghT.js";import"./ImageDropzone-pHFdXv-c.js";import"./image-compress-BCpMMBkY.js";import"./plus-lMDjZTKL.js";import"./trash-2-CjWtyaik.js";const Y=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],ee=_("maximize-2",Y),te=/https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)/gi;function se(t){if(!t)return t;const r=[];let n=0;for(;n<t.length;){const a=t.indexOf("<",n);if(a===-1){r.push({type:"text",value:t.slice(n)});break}a>n&&r.push({type:"text",value:t.slice(n,a)});const l=t.indexOf(">",a);if(l===-1){r.push({type:"text",value:t.slice(n)});break}r.push({type:"tag",value:t.slice(a,l+1)}),n=l+1}let s=!1;const i=[];for(const a of r)if(a.type==="tag"){const l=a.value.toLowerCase();l.startsWith("<a ")||l==="<a>"?s=!0:l==="</a>"&&(s=!1),i.push(a.value)}else s?i.push(a.value):i.push(a.value.replace(te,l=>`<a href="${l}" target="_blank" rel="noopener noreferrer" class="text-primary hover:underline">${l}</a>`));return i.join("")}function re(t){if(!t)return[];try{const r=JSON.parse(t);return Array.isArray(r)?r:[]}catch{return[]}}function ae({images:t}){const[r,n]=u.useState(0),[s,i]=u.useState(!1);if(t.length===0)return null;const a=t[r],l=()=>n((r-1+t.length)%t.length),c=()=>n((r+1)%t.length);return u.useEffect(()=>{if(!s)return;const d=m=>{m.key==="Escape"?i(!1):m.key==="ArrowLeft"?l():m.key==="ArrowRight"&&c()};window.addEventListener("keydown",d);const o=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",d),document.body.style.overflow=o}},[s,r,t.length]),u.useEffect(()=>{if(t.length<2||typeof window>"u")return;[t[(r+1)%t.length],t[(r-1+t.length)%t.length]].forEach(o=>{if(!o?.src)return;const m=new window.Image;m.decoding="async",m.src=o.src})},[r,t]),e.jsxs(e.Fragment,{children:[e.jsxs("figure",{className:"my-6 rounded-md overflow-hidden border border-border bg-muted/30",children:[e.jsxs("div",{className:"relative aspect-[16/9] bg-muted",children:[e.jsx("img",{src:a.src,alt:a.alt??"",width:1600,height:900,loading:"eager",fetchPriority:"high",decoding:"async",className:"absolute inset-0 w-full h-full object-contain cursor-zoom-in",onClick:()=>i(!0)}),e.jsx("button",{type:"button",onClick:()=>i(!0),className:"absolute top-2 left-2 size-9 grid place-items-center rounded-full bg-background/90 border border-border hover:bg-background","aria-label":"Öppna helskärm",children:e.jsx(ee,{className:"size-4"})}),t.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:l,className:"absolute left-2 top-1/2 -translate-y-1/2 size-10 grid place-items-center rounded-full bg-background/90 border border-border hover:bg-background","aria-label":"Föregående bild",children:e.jsx(A,{className:"size-5"})}),e.jsx("button",{type:"button",onClick:c,className:"absolute right-2 top-1/2 -translate-y-1/2 size-10 grid place-items-center rounded-full bg-background/90 border border-border hover:bg-background","aria-label":"Nästa bild",children:e.jsx(E,{className:"size-5"})}),e.jsxs("div",{className:"absolute bottom-2 right-2 px-2 py-0.5 rounded bg-background/80 text-xs text-foreground",children:[r+1," / ",t.length]})]})]}),a.caption&&e.jsx("figcaption",{className:"text-sm text-muted-foreground italic px-3 py-2",children:a.caption}),t.length>1&&e.jsx("div",{className:"flex flex-wrap gap-1.5 p-2 border-t border-border",children:t.map((d,o)=>e.jsx("button",{type:"button",onClick:()=>n(o),"data-active":o===r?"true":"false",className:"size-14 rounded overflow-hidden border-2 border-transparent data-[active=true]:border-primary","aria-label":`Visa bild ${o+1}`,children:e.jsx("img",{src:d.src,alt:"",width:56,height:56,loading:"lazy",decoding:"async",className:"size-full object-cover"})},o))})]}),s&&e.jsxs("div",{className:"fixed inset-0 z-[100] bg-black/95 flex flex-col",role:"dialog","aria-modal":"true","aria-label":"Bildspel helskärm",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 text-white",children:[e.jsxs("span",{className:"text-sm opacity-80",children:[r+1," / ",t.length]}),e.jsxs("button",{type:"button",onClick:()=>i(!1),className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md bg-white/10 hover:bg-white/20 text-sm","aria-label":"Stäng helskärm (Esc)",children:[e.jsx(I,{className:"size-4"})," Stäng"]})]}),e.jsxs("div",{className:"relative flex-1 min-h-0 flex items-center justify-center px-4",children:[e.jsx("img",{src:a.src,alt:a.alt??"",loading:"eager",fetchPriority:"high",decoding:"async",className:"max-h-full max-w-full object-contain"}),t.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:l,className:"absolute left-4 top-1/2 -translate-y-1/2 size-12 grid place-items-center rounded-full bg-white/10 hover:bg-white/20 text-white","aria-label":"Föregående bild",children:e.jsx(A,{className:"size-6"})}),e.jsx("button",{type:"button",onClick:c,className:"absolute right-4 top-1/2 -translate-y-1/2 size-12 grid place-items-center rounded-full bg-white/10 hover:bg-white/20 text-white","aria-label":"Nästa bild",children:e.jsx(E,{className:"size-6"})})]})]}),a.caption&&e.jsx("div",{className:"px-6 py-4 text-center text-sm text-white/80 italic",children:a.caption})]})]})}function L({html:t,className:r}){const n=u.useRef(null),s=u.useRef([]),i=X(t);return u.useEffect(()=>{const a=n.current;return a?(s.current.forEach(c=>{try{c.unmount()}catch{}}),s.current=[],a.querySelectorAll("div[data-gallery]").forEach(c=>{const d=re(c.getAttribute("data-images"));c.innerHTML="";const o=T.createRoot(c);o.render(e.jsx(ae,{images:d})),s.current.push(o)}),()=>{const c=s.current;s.current=[],queueMicrotask(()=>
1{c.forEach(d=>{try{d.unmount()}catch{}})})}):void 0},[t]),e.jsx("div",{ref:n,className:r,dangerouslySetInnerHTML:{__html:i}})}function He(){const{id:t,slug:r}=M.useParams(),n=q(),[s,i]=u.useState(null),[a,l]=u.useState(!0),[c,d]=u.useState(null),[o]=O();u.useEffect(()=>{let w=!1;return l(!0),B.from("articles").select("*").eq("id",t).eq("published",!0).maybeSingle().then(({data:f,error:z})=>{if(!w){if(z)d(z.message);else if(!f)d("not_found");else{const p=K(f);p.body=f.body??"",p.content=p.body,i(p),Z(t)}l(!1)}}),()=>{w=!0}},[t]);function m(){window.history.length>1?n.history.back():n.navigate({to:"/"})}if(a)return e.jsx(h,{children:e.jsx("div",{className:"py-24 text-center text-muted-foreground",children:"Hämtar artikel…"})});if(c==="not_found"||!s)return e.jsx(h,{children:e.jsx(ne,{})});if(c)return e.jsx(h,{children:e.jsx(P,{message:c})});const x=W(s,o),y=x.title??s.title,j=x.excerpt??s.excerpt,N=se(x.content??s.body),F=x.isFallback;typeof document<"u"&&(document.title=`${y} — Strömsunds Gratistidning`);const{firstHalf:R,secondHalf:v}=le(N),k=G(s.image,1600,900);return e.jsxs("div",{className:"min-h-screen bg-paper",children:[e.jsx($,{}),e.jsxs("main",{className:"container mx-auto px-4 py-6 md:py-8",children:[e.jsxs("button",{onClick:m,className:"inline-flex items-center gap-1.5 eyebrow text-muted-foreground hover:text-primary transition-colors mb-4",children:[e.jsx(H,{className:"size-3.5"})," Tillbaka"]}),e.jsxs("div",{className:"grid gap-8 lg:grid-cols-3",children:[e.jsxs("article",{className:"lg:col-span-2 min-w-0",children:[e.jsxs("div",{className:"eyebrow text-primary flex flex-wrap items-center gap-2 mb-3",children:[s.breaking&&e.jsx("span",{className:"bg-primary text-primary-foreground px-1.5 py-0.5 text-[10px] rounded-sm",children:"Just nu"}),s.sponsored&&e.jsx("span",{className:"bg-sponsored text-ink px-1.5 py-0.5 text-[10px] rounded-sm",children:"Annons"}),e.jsx("span",{children:s.category}),s.ort&&e.jsxs("span",{className:"text-muted-foreground inline-flex items-center gap-1",children:[e.jsx(C,{className:"size-3"})," ",s.ort]})]}),F&&o!=="sv"&&e.jsx("div",{className:"mb-3 text-xs text-muted-foreground border border-border bg-muted/30 px-3 py-2 inline-block",children:U[o]}),e.jsx("h1",{className:"font-serif text-3xl md:text-5xl leading-tight mb-4",children:y}),j&&e.jsx("p",{className:"font-serif text-lg md:text-xl text-muted-foreground mb-6 leading-relaxed",children:j}),e.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-xs text-muted-foreground rule-top rule-bottom py-3 mb-6",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(D,{className:"size-3.5"}),s.author]}),e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(Q,{className:"size-3.5"}),s.publishedAt]}),s.ort&&e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(C,{className:"size-3.5"}),s.ort]})]}),k&&e.jsx("figure",{className:"-mx-4 md:mx-0 mb-6",children:e.jsx("img",{src:k,alt:s.title,className:"w-full aspect-[16/9] object-cover bg-muted"})}),e.jsx(L,{className:"prose prose-base md:prose-lg max-w-none prose-headings:font-serif prose-a:text-primary",html:R||N||"<p>Ingen brödtext.</p>"}),v&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"my-8",children:e.jsx(b,{slot:"article-inarticle",fallback:e.jsx(g,{size:"leaderboard"})})}),e.jsx(L,{className:"prose prose-base md:prose-lg max-w-none prose-headings:font-serif prose-a:text-primary",html:v})]}),e.jsxs("div",{className:"rule-top mt-10 pt-6 flex items-center justify-between",children:[e.jsxs("button",{onClick:m,className:"inline-flex items-center gap-1.5 eyebrow text-muted-foreground hover:text-primary transition-colors",children:[e.jsx(H,{className:"size-3.5"})," Tillbaka till flödet"]}),e.jsx(S,{to:"/",className:"eyebrow text-primary hover:underline",children:"Förstasidan →"})]}),e.jsxs("span",{className:"sr-only",children:["Slug: ",r]})]}),e.jsx("aside",{className:"min-w-0",children:e.jsxs("div",{className:"lg:sticky lg:top-24 space-y-8",children:[e.jsx(b,{slot:"sidebar-square",fallback:e.jsx(g,{size:"square"})}),e.jsx(J,{}),e.jsx(b,{slot:"sidebar-skyscraper",className:"hidden lg:block",fallback:e.jsx(g,{size:"skyscraper",className:"hidden lg:block"})})]})})]})]}),e.jsx(V,{})]})}function ne(){return e.jsxs("div",{className:"py-24 text-center",children:[e.jsx("h1",{className:"font-serif text-3xl mb-2",children:"Artikeln finns inte"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"Den kan vara borttagen eller avpublicerad."}),e.jsx(S,{to:"/",className:"eyebrow text-primary hover:underline",children:"← Till förstasidan"})]})}function le(t){if(!t)return{firstHalf:"",secondHalf:""};const r="</p>",n=Math.floor(t.length/2),s=t.indexOf(r,n);if(s===-1)return{firstHalf:t,secondHalf:""};const i=s+r.length;return i>t.length-50?{firstHalf:t,secondHalf:""}:{firstHalf:t.slice(0,i),secondHalf:t.slice(i)}}export{He as component};

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.