PageSourceSearch

https://theonlinecitizen.com/_next/static/chunks/8989.4563802f52bf49f5.js

js theonlinecitizen.com collected 2026-09-24 18:34:12 UTC 16,613 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8989],{709:(e,t,a)=>{a.d(t,{default:()=>o});var l=a(5155),n=a(2115),s=a(5704);let r="rgb(148, 13, 13)",i=s.env.NEXT_PUBLIC_LOOPS_FORM_ID||"",c="loops-form-timestamp";function o(e){let{heading:t="Weekly newsletter",buttonLabel:a="Sign up for weekly newsletter",className:s=""}=e;if(!i)return null;let[o,d]=(0,n.useState)(""),[u,m]=(0,n.useState)("idle"),[x,h]=(0,n.useState)("Oops! Something went wrong, please try again"),b=(0,n.useRef)(null);function g(){h("Too many signups, please try again in a little while"),m("error")}async function p(e){if(e.preventDefault(),"loading"===u)return;try{let e=Date.now(),t=Number(window.localStorage.getItem(c)||0);if(t&&t+6e4>e)return void g();window.localStorage.setItem(c,String(e))}catch(e){}m("loading");let t="userGroup=&mailingLists=&email="+encodeURIComponent(o);try{let e=await fetch("".concat("https://app.loops.so/api/newsletter-form","/").concat(i),{method:"POST",body:t,headers:{"Content-Type":"application/x-www-form-urlencoded"}});if(e.ok)m("success"),d("");else{let t=e.statusText;try{let a=await e.json();(null==a?void 0:a.message)&&(t=a.message)}catch(e){}h(t||"Oops! Something went wrong, please try again"),m("error")}}catch(e){if((null==e?void 0:e.message)==="Failed to fetch")return void g();h((null==e?void 0:e.message)||"Oops! Something went wrong, please try again");try{window.localStorage.setItem(c,"")}catch(e){}m("error")}}function f(){m("idle"),h("Oops! Something went wrong, please try again"),setTimeout(()=>{var e;return null==(e=b.current)?void 0:e.focus()},0)}return(0,l.jsxs)("div",{className:s,children:[t?(0,l.jsxs)("div",{className:"d-flex align-items-center gap-2 mb-2",children:[(0,l.jsx)("h4",{className:"h6 fw-bold mt-2 mb-0",children:t}),(0,l.jsx)("span",{className:"d-inline-block rounded mt-2 mb-0",style:{width:36,height:4,background:r}})]}):null,"success"===u?(0,l.jsxs)("div",{className:"d-flex flex-column align-items-center",children:[(0,l.jsx)("p",{style:{fontSize:"14px",color:"rgb(0,0,0)",margin:"0 0 8px"},children:"Thanks — you're subscribed. Look out for our week-in-review every Friday."}),(0,l.jsx)("button",{type:"button",onClick:f,style:{color:"#6b7280",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer"},children:"← Back"})]}):"error"===u?(0,l.jsxs)("div",{className:"d-flex flex-column align-items-center",children:[(0,l.jsx)("p",{style:{fontSize:"14px",color:"rgb(185, 28, 28)",margin:"0 0 8px"},children:x}),(0,l.jsx)("button",{type:"button",onClick:f,style:{color:"#6b7280",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer"},children:"← Back"})]}):(0,l.jsxs)("form",{onSubmit:p,style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"100%"},children:[(0,l.jsx)("input",{ref:b,type:"email",name:"email",value:o,onChange:e=>d(e.target.value),placeholder:"[email protected]",required:!0,style:{fontFamily:"inherit",color:"rgb(0, 0, 0)",fontSize:"14px",margin:"0 0 10px",width:"100%",maxWidth:"300px",minWidth:"100px",background:"rgb(255, 255, 255)",border:"1px solid rgb(209, 213, 219)",boxSizing:"border-box",boxShadow:"rgba(0, 0, 0, 0.05) 0px 1px 2px",borderRadius:"6px",padding:"8px 12px"}}),(0,l.jsx)("button",{type:"submit",disabled:"loading"===u,style:{background:r,fontSize:"14px",color:"rgb(255, 255, 255)",fontFamily:"inherit",display:"flex",width:"100%",maxWidth:"300px",whiteSpace:"normal",height:"38px",alignItems:"center",justifyContent:"center",padding:"9px 17px",boxShadow:"rgba(0, 0, 0, 0.05) 0px 1px 2px",borderRadius:"6px",textAlign:"center",fontWeight:500,lineHeight:"20px",border:"none",cursor:"pointer"},children:"loading"===u?"Please wait...":a})]})]})}},7878:(e,t,a)=>{a.d(t,{default:()=>d});var l=a(5155),n=a(2619),s=a.n(n),r=a(2115),i=a(709);let c="/fallback-image.jpg";async function o(){let{latest:e=8,trending:t=0,days:a=7}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},l=new URLSearchParams({latest:String(e),trending:String(t),days:String(a)}),n=await fetch("/api/sidebar?".concat(l.toString()),{cache:"no-store"});if(!n.ok)throw Error("".concat(n.status,": ").concat(await n.text()));return n.json()}function d(){let e=function(){let[e,t]=(0,r.useState)("mobile");return(0,r.useEffect)(()=>{let e=window.matchMedia("(min-width: 992px)"),a=window.matchMedia("(min-width: 1400px)"),l=()=>{a.matches?t("desktop"):e.matches?t("tablet"):t("mobile")};l();let n=e=>e.addEventListener?e.addEventListener("change",l):e.addListener(l),s=e=>e.removeEventListener?e.removeEventListener("change",l):e.removeListener(l);return n(e),n(a),()=>{s(e),s(a)}},[]),e}(),t="desktop"===e,a=t?96:80,n=t?64:52,d=t?"gap-2":"gap-1",u={...function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2;return{display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical",overflow:"hidden"}}(2),textAlign:"left",fontSize:t?"0.95rem":"0.9rem",lineHeight:t?"1.25rem":"1.15rem"}
1,[m,x]=(0,r.useState)([]),[h,b]=(0,r.useState)(!0),[g,p]=(0,r.useState)("");return((0,r.useEffect)(()=>{let t=!0;return"mobile"===e?(x([]),b(!1),p(""),()=>{}):((async()=>{try{b(!0);let e=await o({latest:8,trending:0,days:7});if(!t)return;x(Array.isArray(null==e?void 0:e.latest)?e.latest:[]),p("")}catch(e){t&&p("Failed to load sidebar.")}finally{t&&b(!1)}})(),()=>{t=!1})},[e]),"mobile"===e)?null:(0,l.jsxs)("aside",{className:"bg-white p-3 rounded",style:{paddingLeft:"10px"},children:[(0,l.jsx)("div",{className:"widget mb-30",children:(0,l.jsx)(i.default,{})}),(0,l.jsxs)("div",{className:"widget mb-30",children:[(0,l.jsxs)("div",{className:"d-flex align-items-center gap-2 mb-2",children:[(0,l.jsx)("h4",{className:"h6 fw-bold mt-2 mb-0",children:"Latest"}),(0,l.jsx)("span",{className:"d-inline-block rounded mt-2 mb-0",style:{width:t?36:28,height:4,background:"#b80004"}})]}),(0,l.jsx)("ul",{className:"list-unstyled mb-0",children:(h?Array.from({length:8}):m).map((e,t)=>e?(0,l.jsx)("li",{className:"py-2 border-bottom",children:(0,l.jsxs)(s(),{href:e.href||"/",className:"d-flex ".concat(d," text-decoration-none"),children:[(0,l.jsx)("span",{className:"rounded overflow-hidden flex-shrink-0",style:{width:a},children:(0,l.jsx)("img",{src:e.imageUrl||c,alt:e.title||"Thumb",className:"w-100",style:{height:n,objectFit:"cover"},loading:"lazy",decoding:"async",onError:e=>{e.currentTarget.src=c}})}),(0,l.jsx)("span",{className:"d-block",children:(0,l.jsx)("span",{className:"d-block text-body",style:u,children:e.title})})]})},e.id||"".concat(e.slug,"-").concat(t)):(0,l.jsx)("li",{className:"py-2 border-bottom",children:(0,l.jsxs)("div",{className:"d-flex ".concat(d),children:[(0,l.jsx)("span",{className:"rounded overflow-hidden flex-shrink-0 bg-white",style:{width:a,height:n}}),(0,l.jsx)("div",{className:"flex-grow-1",children:(0,l.jsx)("div",{className:"placeholder-glow",children:(0,l.jsx)("span",{className:"placeholder col-10"})})})]})},"sk-l-".concat(t)))})]}),g&&(0,l.jsx)("div",{className:"alert alert-warning mt-3",children:g})]})}},8989:(e,t,a)=>{a.r(t),a.d(t,{default:()=>v});var l=a(5155),n=a(8661),s=a.n(n),r=a(2619),i=a.n(r),c=a(2115),o=a(7878);let d="/fallback-image.jpg",u="#b80004",m=new Set(["opinion","opinions","editorial","editorials","letter","letters","commentary"]);async function x(e){let t=await fetch(e,{cache:"no-store"}),a=await t.json().catch(()=>({}));if(!t.ok)throw Error((null==a?void 0:a.error)||(null==a?void 0:a.message)||"HTTP ".concat(t.status));return a}function h(e){var t,a;let l=null!=(a=null!=(t=null==e?void 0:e.documentId)?t:null==e?void 0:e.document_id)?a:null==e?void 0:e.documentID;if(l)return String(l);let n=(null==e?void 0:e.origin)?String(e.origin):"unknown",s=(null==e?void 0:e.id)!=null?String(e.id):"",r=(null==e?void 0:e.slug)?String(e.slug):"";return"".concat(n,":").concat(s,":").concat(r)}function b(e){let t=new Set,a=[];for(let l of e){let e=h(l);!e||t.has(e)||(t.add(e),a.push(l))}return a}let g=new Intl.DateTimeFormat("en-GB",{timeZone:"Asia/Singapore",day:"numeric",month:"short",year:"numeric"}),p=new Date().getFullYear(),f=Array.from({length:p-2006+1},(e,t)=>p-t),j=[{value:"01",label:"January"},{value:"02",label:"February"},{value:"03",label:"March"},{value:"04",label:"April"},{value:"05",label:"May"},{value:"06",label:"June"},{value:"07",label:"July"},{value:"08",label:"August"},{value:"09",label:"September"},{value:"10",label:"October"},{value:"11",label:"November"},{value:"12",label:"December"}];function v(e){var t,a;let{slug:n,categoryName:r,showDateFilter:p=!1,yearMonth:v="",onYearMonthChange:w}=e,y=(n||"").toLowerCase().trim(),N=r||n,[k,S]=(0,c.useState)(()=>v?v.slice(0,4):""),[C,L]=(0,c.useState)(()=>v?v.slice(5,7):""),[E,I]=(0,c.useState)([]),[A,F]=(0,c.useState)(!0),[R,T]=(0,c.useState)(!1),[O,W]=(0,c.useState)(!0),[z,M]=(0,c.useState)(""),D=(0,c.useRef)(null),_=(0,c.useRef)(1),U=(0,c.useRef)(!1),B=(0,c.useRef)(!0),P=(0,c.useRef)(0),G=k&&C?"".concat(k,"-").concat(C):"";(0,c.useEffect)(()=>{null==w||w(G)},[G]),(0,c.useEffect)(()=>{v||(S(""),L(""))},[v]);let H=(0,c.useCallback)(()=>{I([]),F(!0),T(!1),W(!0),M(""),_.current=1,U.current=!1,B.current=!0,P.current=0},[]),J=(0,c.useCallback)(async()=>
1{if(!y||U.current||!B.current)return 0;if(P.current>=300)return B.current=!1,F(!1),0;U.current=!0,T(!0),M("");let e=_.current,t=P.current,a="/api/categoryposts?slug=".concat(encodeURIComponent(y),"&page=").concat(e,"&limit=").concat(6);G&&(a+="&yearMonth=".concat(encodeURIComponent(G)));try{let l=await x(a),n=Array.isArray(null==l?void 0:l.items)?l.items:[];n.length>0&&(I(e=>{let t=b([...e,...n]).slice(0,300);return P.current=t.length,t}),_.current=e+1);let s=Math.min(300,t+n.length),r=!!(null==l?void 0:l.hasMore)&&n.length>0&&s<300;return B.current=r,F(r),n.length}catch(e){return B.current=!1,F(!1),M((null==e?void 0:e.message)||"Failed to load posts."),0}finally{T(!1),U.current=!1}},[y,G]);(0,c.useEffect)(()=>{y&&(H(),(async()=>{for(let e=0;e<3&&B.current&&await J();e+=1);})())},[y,G,H,J]),(0,c.useEffect)(()=>{let e,t=D.current;if(t){if("undefined"==typeof IntersectionObserver)return void W(!1);try{(e=new IntersectionObserver(e=>{var t;(null==(t=e[0])?void 0:t.isIntersecting)&&J()},{root:null,rootMargin:"900px 0px",threshold:.01})).observe(t),W(!0)}catch(e){W(!1)}return()=>{try{null==e||e.disconnect()}catch(e){}}}},[J]);let q=(0,c.useMemo)(()=>b(E),[E]);return(0,l.jsx)("section",{className:"category-desktop py-4 px-3",children:(0,l.jsxs)("div",{style:{maxWidth:"1200px"},className:"jsx-53c41400ca15ba9e container",children:[(0,l.jsxs)("div",{className:"jsx-53c41400ca15ba9e row",children:[(0,l.jsxs)("div",{className:"jsx-53c41400ca15ba9e col-lg-8",children:[(0,l.jsx)("div",{className:"jsx-53c41400ca15ba9e d-flex justify-content-between align-items-center mb-3 border-bottom pb-2",children:(0,l.jsxs)("h2",{className:"jsx-53c41400ca15ba9e h5 mb-0",children:["Latest on ",N]})}),p&&(0,l.jsxs)("div",{className:"jsx-53c41400ca15ba9e d-flex align-items-center gap-2 mb-4 flex-wrap",children:[(0,l.jsxs)("select",{style:{width:"auto",minWidth:"90px"},value:k,onChange:e=>{S(e.target.value),L("")},"aria-label":"Filter by year",className:"jsx-53c41400ca15ba9e form-select form-select-sm",children:[(0,l.jsx)("option",{value:"",className:"jsx-53c41400ca15ba9e",children:"All years"}),f.map(e=>(0,l.jsx)("option",{value:String(e),className:"jsx-53c41400ca15ba9e",children:e},e))]}),(0,l.jsxs)("select",{style:{width:"auto",minWidth:"130px"},value:C,onChange:e=>{L(e.target.value)},disabled:!k,"aria-label":"Filter by month",className:"jsx-53c41400ca15ba9e form-select form-select-sm",children:[(0,l.jsx)("option",{value:"",className:"jsx-53c41400ca15ba9e",children:"All months"}),j.map(e=>(0,l.jsx)("option",{value:e.value,className:"jsx-53c41400ca15ba9e",children:e.label},e.value))]}),(k||C)&&(0,l.jsx)("button",{type:"button",onClick:()=>{S(""),L("")},className:"jsx-53c41400ca15ba9e btn btn-sm btn-outline-secondary",children:"Clear"}),G&&(0,l.jsxs)("span",{className:"jsx-53c41400ca15ba9e text-muted small",children:["Showing ",(null==(t=j.find(e=>e.value===C))?void 0:t.label)||""," ",k]})]}),z?(0,l.jsx)("div",{className:"jsx-53c41400ca15ba9e alert alert-warning py-2",children:z}):null,(0,l.jsx)("div",{style:{rowGap:"16px"},className:"jsx-53c41400ca15ba9e d-flex flex-column",children:q.map(e=>{var t;let a,n=h(e),s=(null==e?void 0:e.href)||"/",r=((null==e?void 0:e.categories)||[]).find(e=>m.has(String((null==e?void 0:e.slug)||"").toLowerCase())),c=((null==e?void 0:e.categories)||[]).find(e=>!m.has(String((null==e?void 0:e.slug)||"").toLowerCase()))||(null==e||null==(t=e.categories)?void 0:t[0])||{slug:"news",name:"News"},o=String((null==c?void 0:c.slug)||"news").toLowerCase(),u=(null==r?void 0:r.slug)?String(r.slug).toLowerCase():null,x=u?"/category/".concat(u):null,b=(null==e?void 0:e.title)||"",p=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:60,a=String(e||"").trim().split(/\s+/);return a[0]?a.length<=t?e:a.slice(0,t).join(" ")+"…":""}((null==e?void 0:e.Excerpt)||(null==e?void 0:e.excerpt)||"",60),f=(a=null==e?void 0:e.publishedAt)?g.format(new Date(a)):"",j=(null==e?void 0:e.imageUrl)||d;return(0,l.jsx)("article",{className:"jsx-53c41400ca15ba9e card-borderless",children:(0,l.jsxs)("div",{className:"jsx-53c41400ca15ba9e d-flex gap-3",children:[(0,l.jsx)("div",{style:{flexBasis:"260px",maxWidth:"320px"},className:"jsx-53c41400ca15ba9e flex-shrink-0",children:(0,l.jsx)(i(),{href:s,className:"d-block rounded overflow-hidden position-relative",children:(0,l.jsx)("div",{style:{aspectRatio:"16/9",background:"#f2f2f2"}
1,className:"jsx-53c41400ca15ba9e",children:(0,l.jsx)("img",{src:j,alt:b||"Article image",loading:"lazy",decoding:"async",onError:e=>{let t=e.currentTarget;"1"!==t.dataset.fallback&&(t.dataset.fallback="1",t.src=d)},className:"jsx-53c41400ca15ba9e w-100 h-100 object-fit-cover d-block"})})})}),(0,l.jsxs)("div",{className:"jsx-53c41400ca15ba9e d-flex flex-column flex-grow-1 minw-0",children:[(0,l.jsx)("h3",{className:"jsx-53c41400ca15ba9e mb-1 fw-semibold lh-sm fs-5 post-title",children:(0,l.jsx)(i(),{href:s,className:"text-decoration-none text-dark",children:b})}),p?(0,l.jsx)("p",{className:"jsx-53c41400ca15ba9e mb-2 text-muted post-excerpt",children:p}):null,(0,l.jsxs)("div",{className:"jsx-53c41400ca15ba9e d-flex flex-wrap gap-2 align-items-center text-muted small",children:[(0,l.jsx)("span",{className:"jsx-53c41400ca15ba9e",children:f}),(0,l.jsx)("span",{className:"jsx-53c41400ca15ba9e",children:"•"}),(0,l.jsx)(i(),{href:"/category/".concat(o),className:"text-decoration-none cat-link",children:String((null==c?void 0:c.name)||o||"News")}),x?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"jsx-53c41400ca15ba9e",children:"•"}),(0,l.jsx)(i(),{href:x,className:"text-decoration-none opinion-link",children:String(u||"").toUpperCase()})]}):null]})]})]})},n)})}),0===q.length&&!R&&(0,l.jsxs)("p",{className:"jsx-53c41400ca15ba9e text-muted py-4 text-center",children:["No posts found",G?" for ".concat((null==(a=j.find(e=>e.value===C))?void 0:a.label)||""," ").concat(k):"","."]}),(0,l.jsx)("div",{ref:D,style:{height:1},className:"jsx-53c41400ca15ba9e"}),!O&&A?(0,l.jsx)("div",{className:"jsx-53c41400ca15ba9e d-flex justify-content-center mt-4",children:(0,l.jsx)("button",{type:"button",disabled:R,onClick:J,className:"jsx-53c41400ca15ba9e btn btn-outline-secondary",children:R?"Loading…":"Load more"})}):null,(0,l.jsx)("div",{className:"jsx-53c41400ca15ba9e text-center text-muted small mt-3",children:R?"Loading…":!A&&q.length>0?"End of results.":null})]}),(0,l.jsx)("div",{className:"jsx-53c41400ca15ba9e col-lg-4 mt-4 mt-lg-0",children:(0,l.jsx)("div",{className:"jsx-53c41400ca15ba9e toc-sticky-sidebar",children:(0,l.jsx)(o.default,{})})})]}),(0,l.jsx)(s(),{id:"53c41400ca15ba9e",children:".minw-0.jsx-53c41400ca15ba9e{min-width:0}.card-borderless.jsx-53c41400ca15ba9e{border:0;background:transparent}.post-title.jsx-53c41400ca15ba9e{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;word-break:break-word}.post-excerpt.jsx-53c41400ca15ba9e{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.cat-link.jsx-53c41400ca15ba9e:hover{color:".concat(u,";text-decoration:underline!important}.opinion-link.jsx-53c41400ca15ba9e{color:").concat(u,";font-weight:700}.opinion-link.jsx-53c41400ca15ba9e:hover{color:").concat(u,";text-decoration:underline!important}@media(min-width:992px){.toc-sticky-sidebar.jsx-53c41400ca15ba9e{position:sticky;top:88px;align-self:flex-start}}")})]})})}}}]);

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.