PageSourceSearch

https://www.janakkalansanomat.fi/_next/static/chunks/6363.2c1f976c5f1622ae.js

js janakkalansanomat.fi collected 2026-10-02 13:04:05 UTC 78,442 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6363],{3134:(e,t,n)=>{n.d(t,{t:()=>i});var s=n(37876),a=n(27964),o=n(69241),i=e=>{let t,n,i,r,l,m,c,d,u,f=(0,a.c)(18);f[0]!==e?({text:l,optional:r,containerClassName:t,ref:n,...i}=e,f[0]=e,f[1]=t,f[2]=n,f[3]=i,f[4]=r,f[5]=l):(t=f[1],n=f[2],i=f[3],r=f[4],l=f[5]);let h=void 0!==r&&r;return f[6]!==t?(m=(0,o.A)("_Label_157e6_1","nof-ui-subtitle-small",t),f[6]=t,f[7]=m):m=f[7],f[8]!==l?(c=(0,s.jsx)("span",{children:l}),f[8]=l,f[9]=c):c=f[9],f[10]!==h?(d=h&&(0,s.jsx)("span",{className:"_Suffix_157e6_7",children:"(vapaaehtoinen)"}),f[10]=h,f[11]=d):d=f[11],f[12]!==n||f[13]!==i||f[14]!==m||f[15]!==c||f[16]!==d?(u=(0,s.jsxs)("label",{className:m,ref:n,...i,children:[c,d]}),f[12]=n,f[13]=i,f[14]=m,f[15]=c,f[16]=d,f[17]=u):u=f[17],u}},3570:(e,t,n)=>{n.r(t),n.d(t,{ArticleCommentWidget:()=>t_,UserCommentsWidget:()=>tK});var s,a,o,i=n(14232),r=n(15039),l=n(42532),m=n(37876),c=n(62357),d=n(48294),u=n(98618),f=n(74928),h=n(81389),x=n(48167),p=n(53409),M=n(98011),g=n(74731),j=n(31672),k=n(46163),v=n(47320),b=n(70864),A=n(87485),y=n(45579),N=n(52677),C=n(87751),q=n(87618),w=n(41116),S=n(10671),W=n(93205),I=Object.defineProperty,L=(e,t,n)=>{let s;return(s="symbol"!=typeof t?t+"":t)in e?I(e,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[s]=n},R="nickname",O="realNameId",E=["UserBanned","ArticleCommentingDisabled","DuplicateNickname","GENERIC_ERROR","UserMissingRealName","UserMissingNickname"],T={UserBanned:"Kommentointisi on estetty",ArticleCommentingDisabled:"Kommentointi on suljettu",DuplicateNickname:"Nimimerkki on jo k\xe4
1yt\xf6ss\xe4",UserMissingRealName:"Ota nimi k\xe4ytt\xf6\xf6n kommentoidaksesi",UserMissingNickname:"Ota nimimerkki k\xe4ytt\xf6\xf6n kommentoidaksesi",GENERIC_ERROR:"L\xe4hett\xe4minen ep\xe4onnistui. Yrit\xe4 hetken p\xe4\xe4st\xe4 uudelleen."},F=e=>{var t;return"string"==typeof(t=e)&&t in E?T[e]:T.GENERIC_ERROR},_=e=>e?{headers:{"Content-Type":"application/json","SNDP-Authorization":e},credentials:"include"}:{headers:{"Content-Type":"application/json"},credentials:"include"},K=async(e,t,n,s,a)=>{let o="".concat(e,"/comments/").concat(t,"/abuses/categorized"),i=await fetch(o,{method:"POST",body:JSON.stringify({email:a,id:t,category:n,text:s}),headers:{"Content-Type":"application/json"}});if(i.ok)return"success";throw Error(i.statusText)},V=async(e,t,n,s,a)=>{let o,i="".concat(e,"/articles/").concat(t,"/comments").concat(n?"":"/initial","?").concat(Object.keys(o={sort:s,onlyCommentsWithRealNames:a}).map(e=>{let t=o[e];return null==t||""===t?"":"".concat(e,"=").concat(t)}).filter(e=>e.length>0).join("&")),r=await fetch(i);if(r.ok)return r.json();throw Error(r.statusText)},P=async(e,t,n,s,a)=>{let o="/users/".concat(t).concat("own"!==t&&n?"/"+encodeURIComponent(n):"","/comments"),i="".concat(e).concat(o,"?").concat("count=".concat(s)),r=_(a),l=await fetch(i,{...r});if(l.ok)return l.json();throw Error(l.statusText)},U=async e=>{if(e.ok)return!0;{let t;throw Error(!(t=await e.json()).success&&t.errorMessage in T?T[t.errorMessage]:(console.error("Something went wrong: ".concat(t.errorMessage)),T.GENERIC_ERROR))}},D=async(e,t,n,s,a,o,i,r)=>{let l=_(i);return U(await fetch("".concat(e,"/comments"),{method:"PUT",body:JSON.stringify({product:n,articleId:t,comment:s,userId:o,commentingNameSetting:a,replyTo:r}),...l}))},H=async(e,t,n,s)=>{let a="".concat(e,"/users/").concat(n.toLowerCase()),o=s?await s():void 0;return U(await fetch(a,{method:"POST",body:JSON.stringify({[n]:t}),..._(o)}))},B=async(e,t,n)=>{let s="".concat(e,"/comments/").concat(t,"/votes"),a=n?await n():void 0,o=await fetch(s,{method:"POST",body:JSON.stringify({voteType:"UpVote"}),..._(a)});if(o.ok)return(await o.json()).data;throw Error(o.statusText)},J=({title:e,message:t,className:n})=>(0,m.jsxs)("div",{className:r(n,"py-nof-16"),children:[(0,m.jsx)("div",{className:"flex justify-center",children:(0,m.jsx)(l.T,{size:56,color:void 0})}),(0,m.jsx)("p",{className:"nof-ui-title-medium text-nof-foreground-primary py-nof-16 text-center",children:e}),(0,m.jsx)("p",{className:r("nof-ui-body-medium text-nof-foreground-primary text-center",!t&&"hidden"),children:t})]}),$=(0,i.createContext)(void 0),z=({children:e,brand:t,commentRepoBaseUrl:n,articleId:s,userInfo:a,loginHandler:o,registrationHandler:i,getJwtToken:r,refreshUserInfo:l,initialCommentFormOpen:c,sendAnalyticsEvent:d,setNativeCommentingFormHandler:u,enableNestedThreads:f,enableDraftPersistence:h})=>(0,m.jsx)($.Provider,{value:{brand:t,commentRepoBaseUrl:n,articleId:s,userInfo:a,loggedIn:void 0!==a,loginHandler:o,registrationHandler:i,getJwtToken:r,refreshUserInfo:l,initialCommentFormOpen:c,sendAnalyticsEvent:d,setNativeCommentingFormHandler:u,enableNestedThreads:f,enableDraftPersistence:h},children:e}),Z=()=>{let e=(0,i.useContext)($);if(void 0===e)throw Error("useArticleCommentWidgetProps must be used within an CommentWidgetPropProvider");return e},G=(0,i.createContext)(void 0),Q=({children:e})=>{let[t,n]=(0,i.useState)({nameClaimFormOpen:!1,nameClaimFormActive:"NONE"}),[s,a]=(0,i.useState)(void 0);return(0,m.jsx)(G.Provider,{value:{formState:t,setFormState:n,inlineNameClaimCommentId:s,setInlineNameClaimCommentId:a},children:e})},Y=()=>{let e=(0,i.useContext)(G);if(void 0===e)throw Error("useFormsContext must be used within an FormContextProvider");return e},X=(e,t)=>{t.has(e.id)||t.set(e.id,e),e.parent&&X(e.parent,t)},ee=(e,t)=>e.createdAt-t.createdAt,et={oldest:ee,newest:(e,t)=>t.createdAt-e.createdAt,highestvote:(e,t)=>t.votes.totalPositiveVotes-e.votes.totalPositiveVotes},en=e=>{for(let t of e)t.replies.sort(ee),en(t.replies)},es=e=>e.reduce((e,t)=>e+1+es(t.replies),0),ea="sndp-commenting-",eo="sndp-storage-test-key",ei=()=>Math.floor(Date.now()/1e3),er=class{constructor(){L(this,"fallbackStorageItems",new Map),L(this,"length",this.fallbackStorageItems.size)}getItem(e){var t;return null!=(t=this.fallbackStorageItems.get(e))?t:null}setItem(e,t){this.fallbackStorageItems.set(e,t)}removeItem(e){this.fallbackStorageItems.delete(e)}clear(){this.fallbackStorageItems.clear()}key(e){var t;let n=this.fallbackStorageItems.keys(),s=0;for(;s<e;)n.next(),s++;return null!=(t=n.next().value)?t:null}},el=null,em=()=>{if(!("u">typeof document))throw Error("BrowserStorage must only be used in the browser");return el||(el=ec("localStorage")?localStorage:ec("sessionStorage")?sessionStorage:new er)},ec=e=>{try{return window[e].setItem(eo,eo),window[e].getItem(eo),window[e].removeItem(eo),!0}catch(e){return!1}},ed={getItem:e=>em().getItem(ea+e),setItem:(e,t)=>
1{em().setItem(ea+e,t)},removeItem:e=>{em().removeItem(ea+e)},getJSON:e=>{let t=ed.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch(e){return console.warn("Failed to parse JSON: ".concat(t)),null}},setJSON:(e,t)=>{ed.setItem(e,JSON.stringify(t))}},eu="draft",ef=e=>"object"==typeof e&&null!==e&&Number.isFinite(e.articleId)&&"string"==typeof e.value&&Number.isFinite(e.savedAt)&&(void 0===e.replyToCommentId||Number.isFinite(e.replyToCommentId)),eh=(e,t)=>e.articleId===t.articleId&&e.replyToCommentId===t.replyToCommentId,ex=e=>{let t=ed.getJSON(eu);return t?ef(t)?ei()-t.savedAt>86400||t.articleId!==e.articleId?(ed.removeItem(eu),null):eh(t,e)?t.value:null:(ed.removeItem(eu),null):null},ep=(e,t)=>{let n={...e,value:t,savedAt:ei()};try{ed.setJSON(eu,n)}catch(e){}},eM=e=>{let t=ed.getJSON(eu);if(t){if(!ef(t))return void ed.removeItem(eu);eh(t,e)&&ed.removeItem(eu)}},eg="name-choice",ej=e=>{ed.setItem(eg,e)},ek=(e,t)=>{let n=ed.getItem(eg);return n&&e.includes(n)&&eb(n,t)?n:e[0]},ev=(e,t)=>!(e||t.includes("anonymousCommenting")),eb=(e,t)=>{switch(e){case"realNameCommenting":return!!(null!=t&&t.commentingRealName);case"registeredCommenting":return!!(null!=t&&t.commentingNickName);default:return!0}},eA="voting-record",ey="NotAsked",eN="Loading",eC="Success",eq="Failure";function ew(e){return e>96?e-87:e>64?e-29:e-48}function eS(e){for(let t=0,n=e.length;t<n;++t)e[t]=(function(e){var t;let n=e.split("."),s=n[0],a=null!=(t=n[1])?t:"",o=1,i=0,r=0,l=1;45===e.charCodeAt(0)&&(i=1,l=-1);for(let e=i,t=s.length;e<t;++e)r=60*r+ew(s.charCodeAt(e));for(let e=0,t=a.length;e<t;++e)o/=60,r+=ew(a.charCodeAt(e))*o;return r*l})(e[t]).toString()}function eW(e,t){let n=[];for(let s=0,a=t.length;s<a;++s)n[s]=e[t[s]];return n}!function({zones:e,links:t}){o={},e.forEach(e=>{o[e.substring(0,e.indexOf("|"))]=e}),s=t.reduce((e,t)=>{let[n,s]=t.split("|");return e[s]=n,e},{}),a={}}({version:"2019a",zones:["Europe/Helsinki|LMT HMT EET EEST|-1D.N -1D.N -20 -30|01232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-3H0ND.N 1Iu00 OULD.N 1dA0 1xGq0 1cM0 1cM0 1cM0 1cN0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00|12e5"],links:["Europe/Helsinki|Europe/Mariehamn"]});var eI=(e,t)=>(0,c.GP)(e,t,{locale:f.fi}),eL=e=>{let t=function(e,t){let n=function(e,t){let n=function(e,t){let n=function(e,t){let{untils:n}=t;
1for(let t=0,s=n.length;t<s;++t)if(e<Number(n[t]))return t}(e,t);if(n)return{abbreviation:t.abbreviations[n],offset:t.offsets[n]}}("number"==typeof e?e:e.getTime(),t);if(!n)return;let{abbreviation:s,offset:a}=n;return{abbreviation:s,offset:a}}(e,function(e){var t;let n=null!=(t=s[e])?t:e,i=a[n];if(!i){let e,t,s,r,l,m,c,d=o[n];if(!d)throw Error('Unknown time zone "'.concat(n,'".'));i=a[n]=(t=(e=d.split("|"))[2].split(" "),s=e[3].split(""),r=e[4].split(" "),eS(t),eS(s),eS(r),function(e,t){for(let n=0;n<t;++n)e[n]=Math.round((Number(e[n-1])||0)+6e4*Number(e[n])).toString();e[t-1]="Infinity"}(r,s.length),l=e[0],m=eW(e[1].split(" "),s),c=0|e[5],{name:l,abbreviations:m,offsets:t=eW(t,s),untils:r,population:c})}return i}(t.timeZone));if(!n)return;let{offset:i}=n,r=Number(i);return r-=e.getTimezoneOffset(),new Date(e.getTime()-60*r*1e3)}(new Date(e),{timeZone:"Europe/Helsinki"});return t?(0,d.c)(t)?eI(t,"H:mm"):(0,u.e)(t)?eI(t,"d.M. H:mm"):eI(t,"d.M.y H:mm"):null},eR=({comment:e})=>{let t=e.split("<br>");return(0,m.jsx)(m.Fragment,{children:t.map((e,n)=>(0,m.jsxs)(i.Fragment,{children:[(0,m.jsx)("span",{className:"break-words",children:e}),n!==t.length-1&&(0,m.jsx)("br",{})]},n))})},eO=({children:e,comment:t})=>(0,m.jsx)("div",{className:"mb-nof-8",children:(0,m.jsxs)("div",{className:"border-blockquote pl-nof-2 py-nof-2 border-l-2",children:[e,(0,m.jsx)(eT,{comment:t})]})}),eE=({comment:e})=>e.parent?(0,m.jsx)("div",{className:"mb-nof-16",children:(0,m.jsx)(eO,{comment:e.parent,children:(0,m.jsx)(eE,{comment:e.parent})})}):null;function eT({comment:e}){let t,[n,s]=(0,i.useState)(!1),[a,o]=(0,i.useState)((t=e.comment.substring(0,150)).endsWith("<br")?t+">":t.endsWith("<b")?t+"r>":t.endsWith("<")?t+"br>":t),r=!n&&e.comment.length>150;return(0,m.jsx)("article",{className:"flex flex-col",children:(0,m.jsx)("div",{className:"relative flex",children:(0,m.jsxs)("p",{className:"nof-ui-body-medium px-nof-2 w-full overflow-hidden break-words",children:[(0,m.jsxs)("span",{className:"font-bold",children:[e.userIdentity.displayName,":"]})," ",(0,m.jsx)(eR,{comment:a}),r&&(0,m.jsxs)("button",{className:"inline",onClick:()=>{s(!0),o(e.comment)},children:["... ",(0,m.jsx)("span",{className:"font-bold",children:"N\xe4yt\xe4 lis\xe4\xe4"})]})]})})})}var eF=e=>{switch(e){case"al":return"https://www.aamulehti.fi";case"hs":return"https://www.hs.fi";case"mn":case"is":return"https://www.is.fi";case"jan":return"https://www.janakkalansanomat.fi";case"js":return"https://www.jamsanseutu.fi";case"kmv":return"https://www.kmvlehti.fi";case"ks":return"https://www.kankaanpaanseutu.fi";case"mk":return"https://www.merikarvialehti.fi";case"nu":return"https://www.nokianuutiset.fi";case"rks":return"https://www.rannikkoseutu.fi";case"sk":return"https://www.satakunnankansa.fi";case"ss":return"https://www.sydansatakunta.fi";case"suk":return"https://www.suurkeuruu.fi";case"tyr":return"https://www.tyrvaansanomat.fi";case"vs":return"https://www.valkeakoskensanomat.fi";default:return""}},e_={hs:"https://www.hs.fi/kommentit/art-2000006396703.html",al:"https://www.aamulehti.fi/info/art-2000007611645.html",jan:"https://www.janakkalansanomat.fi/info/art-2000007611755.html",js:"https://www.jamsanseutu.fi/info/art-2000007611745.html",kmv:"https://www.kmvlehti.fi/info/art-2000007611625.html",ks:"https://www.kankaanpaanseutu.fi/info/art-2000007611746.html",mk:"https://www.merikarvialehti.fi/info/art-2000007611629.html",nu:"https://www.nokianuutiset.fi/info/art-2000007611621.html",rks:"https://www.rannikkoseutu.fi/info/art-2000007611697.html",sk:"https://www.satakunnankansa.fi/info/art-2000007611733.html",ss:"https://www.sydansatakunta.fi/info/art-2000007611612.html",suk:"https://www.suurkeuruu.fi/info/art-2000007611635.html",tyr:"https://www.tyrvaansanomat.fi/info/art-2000007611618.html",vs:"https://www.valkeakoskensanomat.fi/info/art-2000007611714.html"},eK=e=>{var t;return null!=(t=e_[e])?t:"".concat(eF(e),"/kommentointiohjeet/")},eV=[{value:"DISCLOSURE_OF_PERSONAL_DATA",label:"Henkil\xf6tietojen levitt\xe4minen"},{value:"HATE_SPEECH",label:"Vihapuhe"},{value:"HARASSMENT",label:"H\xe4irint\xe4"},{value:"DISINFORMATION",label:"Disinformaatio"},{value:"SPAM",label:"Roskaposti"},{value:"INAPPROPRIATE_NICKNAME",label:"Asiaton nimimerkki"},{value:"OTHER_ILLEGAL_CONTENT",label:"Muu laiton sis\xe4lt\xf6"}],eP=({comment:e,closeAbuseReportForm:t})=>{let[n,s]=(0,i.useState)(1),[a,o]=(0,i.useState)(void 0),[r,l]=(0,i.useState)(void 0),[c,d]=(0,i.useState)(""),[u,f]=(0,i.useState)(void 0),[k,v]=(0,i.useState)(""),[b,A]=(0,i.useState)(void 0),[y,N]=(0,i.useState)(!1),[C,q]=(0,i.useState)(!1),[w,S]=(0,i.useState)(void 0),[W,I]=(0,i.useState)("idle"),{commentRepoBaseUrl:L,sendAnalyticsEvent:R,articleId:O,brand:E}=Z();(0,i.useEffect)(()=>
1{if("success"!==W)return;let e=setTimeout(t,5e3);return()=>{clearTimeout(e)}},[W,t]);let T=async()=>{let t=!1;if(0===c.length?(f("Anna perustelu."),t=!0):c.length<20&&(f("Perustelun pit\xe4\xe4 olla v\xe4hint\xe4\xe4n 20 merkki\xe4 pitk\xe4."),t=!0),0===k.length?(A("Anna s\xe4hk\xf6posti."),t=!0):/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(k)||(A("Virheellinen s\xe4hk\xf6postiosoite."),t=!0),y||(S("Hyv\xe4ksy ennen l\xe4hett\xe4mist\xe4."),t=!0),!(t||"loading"===W||!a)){I("loading");try{let t=await K(L,e.id,a,c,k);I(t),"success"===t&&R("report abuse",O,e.id)}catch(e){console.error("Sending abuse report failed",e),I("error")}}},F="error"===W?"L\xe4hett\xe4minen ep\xe4onnistui. Yrit\xe4 hetken p\xe4\xe4st\xe4 uudelleen.":null,_=e.comment.length>100,V=(()=>{if(!_||C)return e.comment;let t=e.comment.slice(0,100),n=t.lastIndexOf(" ");return(n>0?e.comment.slice(0,n):t)+"..."})();return"success"===W?(0,m.jsx)("div",{className:"bg-nof-neutral-contrast-very-low text-nof-foreground-primary border-divider-2 mt-nof-16 p-nof-12 border-t-2",children:(0,m.jsx)("p",{className:"nof-ui-subtitle-medium",children:"Kiitos! Raportoitu"})}):(0,m.jsxs)("div",{className:"bg-nof-neutral-contrast-very-low text-nof-foreground-primary border-divider-2 mt-nof-16 p-nof-12 border-t-2",children:[(0,m.jsxs)("div",{className:"mb-nof-12 flex items-center justify-between",children:[(0,m.jsx)("p",{className:"nof-ui-subtitle-medium",children:"Ilmoita asiaton viesti"}),(0,m.jsx)("button",{type:"button",onClick:t,"aria-label":"Sulje",className:"text-nof-foreground-primary",children:(0,m.jsx)(p.U,{})})]}),(0,m.jsxs)("div",{className:"border-nof-foreground-secondary mb-nof-16 pl-nof-8 border-l-2",children:[(0,m.jsx)("p",{className:"nof-ui-subtitle-xsmall",children:e.userIdentity.displayName}),(0,m.jsxs)("p",{className:"nof-ui-meta-medium mt-nof-4",children:[V,_&&!C&&(0,m.jsxs)(m.Fragment,{children:[" ",(0,m.jsx)("button",{type:"button",className:"nof-ui-meta-medium underline",onClick:()=>{q(!0)},children:"N\xe4yt\xe4 lis\xe4\xe4"})]})]})]}),1===n&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(M.z6,{label:"Ilmoituksen syy",value:a,onValueChange:e=>{let t=eV.find(t=>t.value===e);t&&(o(t.value),l(void 0))},containerClassName:"mt-nof-16 mb-nof-4",groupClassName:"pt-nof-8 pb-nof-12 flex flex-col items-start gap-nof-8",children:eV.map(({value:e,label:t})=>(0,m.jsx)(M.sx,{value:e,checked:a===e,children:t},e))}),(0,m.jsx)("p",{className:"nof-ui-body-medium mb-nof-4 text-nof-status-alert-default",style:{visibility:r?"visible":"hidden"},children:null!=r?r:"\xa0"}),(0,m.jsxs)("div",{className:"gap-nof-16 flex flex-row",children:[(0,m.jsx)(h.$n,{label:"Peruuta",variant:h.KT.Secondary,onClick:t}),(0,m.jsx)(h.$n,{label:"Seuraava",variant:h.KT.Primary,onClick:()=>{a?s(2):l("Valitse syy listalta.")}})]})]}),2===n&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(g.T,{name:"report-abuse-form",label:"Kuvaile miksi viesti on asiaton",value:c,onChange:e=>{e.target.value.length<=1e3&&d(e.target.value),e.target.value.length>0&&f(void 0)},placeholder:"Kirjoita t\xe4h\xe4n",required:!0,hideOptionalLabel:!0,rows:8}),(0,m.jsxs)("div",{className:"flex justify-between",children:[(0,m.jsx)("p",{className:"nof-ui-body-medium text-nof-status-alert-default",style:{visibility:u?"visible":"hidden"},children:null!=u?u:"\xa0"}),(0,m.jsxs)("p",{className:"nof-ui-body-medium text-nof-foreground-secondary",children:[1e3-c.length," merkki\xe4 j\xe4ljell\xe4"]})]}),(0,m.jsx)("div",{className:"mt-nof-16",children:(0,m.jsx)(j.k,{type:"email",name:"email",label:"S\xe4hk\xf6posti (ei n\xe4ytet\xe4 julkisesti)",placeholder:"Ei n\xe4ytet\xe4 julkisesti",value:k,onChange:e=>{v(e.target.value),A(void 0)},required:!0,hideOptionalLabel:!0})}),(0,m.jsx)("p",{className:"nof-ui-body-medium text-nof-status-alert-default",style:{visibility:b?"visible":"hidden",display:"flex",padding:"var(--core-dimension-100, 8px) var(--core-dimension-0, 0)",flexDirection:"column",alignItems:"flex-start",gap:"var(--core-dimension-150, 12px)",alignSelf:"stretch"},children:null!=b?b:"\xa0"}),(0,m.jsx)("div",{className:"mt-nof-8",children:(0,m.jsx)(x.S,{checked:y,onChange:e=>{N(e.target.checked),e.target.checked&&S(void 0)},label:"Vakuutan antamani tiedot oikeiksi"})}),(0,m.jsx)("p",{className:"nof-ui-body-medium text-nof-status-alert-default",style:{visibility:w?"visible":"hidden",transform:"translateY(8px)"},children:null!=w?w:"\xa0"}),(0,m.jsx)("p",{className:"nof-ui-body-medium text-nof-status-alert-default",style:{visibility:F?"visible":"hidden"},children:null!=F?F:"\xa0"}),(0,m.jsxs)("div",{className:"mt-nof-8 gap-nof-16 flex flex-row",children:[(0,m.jsx)(h.$n,{label:"Peruuta",variant:h.KT.Secondary,onClick:t}),(0,m.jsx)(h.$n,{label:"L\xe4het\xe4",variant:h.KT.Primary,onClick:()=>{T()},disabled:"loading"===W})]})]}),(0,m.jsx)("a",{href:eK(E),target:"_blank",rel:"noreferrer",className:"nof-ui-body-medium text-nof-foreground-accent mt-nof-16 flex h-4 items-center gap-[2px] underline",children:"Lue keskustelun s\xe4\xe4nn\xf6t"})]})},eU=({comment:e,className:t="nof-ui-subtitle-small"})=>(0,m.jsx)("div",{className:"".concat(t," text-nof-foreground-primary"),children:(0,m.jsx)("span",{className:"font-bold",children:e.userIdentity.displayName})}),eD=({comment:e,nameClassName:t})=>{let{brand:n}=Z(),s=((e,t)=>{switch(t.userIdentity.commentingNameSetting){case"registeredCommenting":{let n=encodeURIComponent(t.userIdentity.displayName);return"".concat(eF(e),"/kayttaja/?nickname=").concat(n)}
1case"realNameCommenting":{let n=encodeURIComponent(t.userIdentity.realNameId);return"".concat(eF(e),"/kayttaja/?realNameId=").concat(n)}default:return null}})(n,e);return s?(0,m.jsx)("a",{href:s,children:(0,m.jsx)(eU,{comment:e,className:t})}):(0,m.jsx)(eU,{comment:e,className:t})},eH=({comment:e,openAbuseReportForm:t})=>{let[n,s]=(0,i.useState)(!1),a=(0,i.useRef)(null);return(0,i.useEffect)(()=>{if(!n)return;let e=e=>{a.current&&e.target instanceof Node&&!a.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[n]),(0,m.jsxs)("div",{ref:a,className:"relative",children:[(0,m.jsx)("button",{type:"button","aria-label":"Lis\xe4\xe4 toimintoja","aria-expanded":n,"aria-haspopup":"menu",className:"text-nof-foreground-accent p-nof-4",onClick:()=>{s(e=>!e)},children:(0,m.jsx)(v.j,{})}),n&&(0,m.jsxs)("div",{className:"absolute top-full right-0 z-50 pt-[8px]",children:[(0,m.jsx)("div",{className:"absolute top-0 right-[8px] size-0 border-x-[8px] border-b-[8px] border-x-transparent",style:{borderBottomColor:"var(--nof-semantic-color-neutral-contrast-high)"}}),(0,m.jsx)("ul",{role:"menu",children:(0,m.jsx)("li",{role:"none",children:(0,m.jsxs)("button",{type:"button",role:"menuitem",className:"nof-ui-body-small bg-nof-neutral-contrast-high text-nof-foreground-inverted p-nof-16 flex h-[40px] max-w-[360px] items-center gap-[8px] rounded-none whitespace-nowrap",onClick:()=>{s(!1),t(e)},children:[(0,m.jsx)(k.i,{color:"currentColor"}),"Ilmoita asiaton viesti"]})})})]})]})},eB=({disabled:e,brand:t,onClick:n,sentVoteStatus:s,voteCount:a,userHasVoted:o})=>{let i,l=(e=>{switch(e){case"is":case"mn":return{empty:'data:image/svg+xml,<?xml version="1.0" encoding="UTF-8"?>%0A<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">%0A    <title>svgicon/thumbs-up</title>%0A    <g id="icon/thumbs-up" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">%0A        <path d="M17,3.5 C17,4.58228209 16.8039653,5.9310433 16.4148669,7.55656506 L16.3135719,7.96871729 L16.305,8 L20,8 C22.32355,8 23.0274346,10.429498 22.1116539,11.901458 L22.0291919,12.025202 L21.986,12.08 C22.1890575,12.4438842 22.2884735,12.8653202 22.2721532,13.3136951 L22.2580376,13.5074159 L22.2363939,13.664399 C22.1634731,14.1019238 21.9925684,14.5086987 21.743634,14.8561313 L21.6127566,15.0247701 L21.515,15.134 L21.5554226,15.2132613 C21.7100926,15.5399258 21.7859822,15.9132269 21.7723586,16.3082245 L21.7580376,16.5074159 L21.7363939,16.664399 C21.6634731,17.1019238 21.4925684,17.5086987 21.243634,17.8561313 L21.1127566,18.0247701 L21.084,18.056 L21.1075116,18.0919081 C21.9774426,19.4800461 21.4012545,21.72767 19.3789472,21.9772682 L19.1851193,21.9947272 L19,22 L14,22 C12.6597591,22 11.5694279,21.7088976 10.0719579,21.0679576 L9.71886153,20.9138115 L8.90543854,20.5557386 C7.87500106,20.1096572 7.54413052,20.012151 7.097724,20.0011328 L7,20 C7,20.5522847 6.55228475,21 6,21 L3,21 C2.44771525,21 2,20.5522847 2,20 L2,9 C2,8.44771525 2.44771525,8 3,8 L6,8 C6.51283584,8 6.93550716,8.38604019 6.99327227,8.88337887 L7,9 C9.00611623,9 11.8534308,5.58124683 11.9945427,3.64586695 L12,3.5 L12.0052728,3.31488074 C12.1868993,0.167853329 17,0.229559748 17,3.5 Z M14,3.5 C14,6.37106178 10.4087059,10.8178425 7.19617835,10.9945653 L7,11 L7,18 L7.12421548,18.0007574 C7.84386166,18.0100429 8.2633942,18.1098096 9.36772899,18.5773174 L9.59801848,18.6758043 L10.8339374,19.2185506 C12.0066206,19.7218427 12.8327757,19.9590672 13.7478904,19.9951095 L14,20 L19,20 C19.6666667,20 19.6666667,19 19,19 C17.7126437,19 17.6682521,17.1355529 18.8668252,17.0069704 L19,17 L19.1071271,16.9931589 C19.4548387,16.9480015 19.7055716,16.683808 19.7636061,16.335601 C19.8032612,16.0976705 19.7689039,16.0175613 19.5787643,16.0026967 L19.5,16 L19.3668252,15.9930296 C18.2110583,15.8690393 18.2110583,14.1309607 19.3668252,14.0069704 L19.5,14 L19.6071271,13.9931589 C19.9548387,13.9480015 20.2055716,13.683808 20.2636061,13.335601 C20.3032612,13.0976705 20.2689039,13.0175613 20.0787643,13.0026967 L20,13 L19.8668252,12.9930296 C18.6682521,12.8644471 18.7126437,11 20,11 C20.6296296,11 20.6646091,10.1080247 20.1049383,10.0089163 L20,10 L15,10 C14.3356211,10 13.8559571,9.36409508 14.0384761,8.72527887 C14.6818394,6.47350711 15,4.72362388 15,3.5 C15,2.83333333 14,2.83333333 14,3.5 Z M4.5,17 C3.94771525,17 3.5,17.4477153 3.5,18 C3.5,18.5522847 3.94771525,19 4.5,19 C5.05228475,19 5.5,18.5522847 5.5,18 C5.5,17.4477153 5.05228475,17 4.5,17 Z" id="Combined-Shape" fill="%23DA2027" fill-rule="nonzero"></path>%0A    </g>%0A</svg>',filled:'data:image/svg+xml,<?xml version="1.0" encoding="UTF-8"?>%0A<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">%0A    <title>svgicon/thumbs-up-filled</title>%0A    <g id="icon/thumbs-up-filled" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">%0A        <path d="M17,3.5 C17,4.58228209 16.8039653,5.9310433 16.4148669,7.55656506 L16.3135719,7.96871729 L16.305,8 L20,8 C22.32355,8 23.0274346,10.429498 22.1116539,11.901458 L22.0291919,12.025202 L21.986,12.08 C22.1890575,12.4438842 22.2884735,12.8653202 22.2721532,13.3136951 L22.2580376,13.5074159 L22.2363939,13.664399 C22.1634731,14.1019238 21.9925684,14.5086987 21.743634,14.8561313 L21.6127566,15.0247701 L21.515,15.134 L21.5554226,15.2132613 C2
11.7100926,15.5399258 21.7859822,15.9132269 21.7723586,16.3082245 L21.7580376,16.5074159 L21.7363939,16.664399 C21.6634731,17.1019238 21.4925684,17.5086987 21.243634,17.8561313 L21.1127566,18.0247701 L21.084,18.056 L21.1075116,18.0919081 C21.9774426,19.4800461 21.4012545,21.72767 19.3789472,21.9772682 L19.1851193,21.9947272 L19,22 L14,22 C12.6597591,22 11.5694279,21.7088976 10.0719579,21.0679576 L9.71886153,20.9138115 L8.90543854,20.5557386 C8.52061225,20.3891454 8.23214293,20.0830117 8,20 L7.99904805,17.8540871 C7.99836218,14.7007574 7.99819807,9.17124638 8,9 C9.83059116,8.19515935 11.8598172,5.31105701 11.9930649,3.66565887 L12,3.5 L12.0052728,3.31488074 C12.1868993,0.167853329 17,0.229559748 17,3.5 Z M6,8 C6.55228475,8 7,8.44771525 7,9 L7,20 C7,20.5522847 6.55228475,21 6,21 L3,21 C2.44771525,21 2,20.5522847 2,20 L2,9 C2,8.44771525 2.44771525,8 3,8 L6,8 Z M4.5,17 C3.94771525,17 3.5,17.4477153 3.5,18 C3.5,18.5522847 3.94771525,19 4.5,19 C5.05228475,19 5.5,18.5522847 5.5,18 C5.5,17.4477153 5.05228475,17 4.5,17 Z" id="Combined-Shape" fill="%23DA2027" fill-rule="nonzero"></path>%0A    </g>%0A</svg>'};default:return}})(t);return(0,m.jsxs)("button",{disabled:e,onClick:n,className:"nof-ui-body-small",children:[l&&(0,m.jsx)("img",{alt:"vote",className:r("mb-nof-4 mr-nof-4 inline",{disabled:s.status===eq}),style:{height:"16px"},src:(i=s.status,i===eC||i===eq?l.filled.toString():l.empty.toString())}),"hs"===t?"Hyvin argumentoitu":"Hyvin sanottu"," ",(0,m.jsxs)("span",{className:r("text-nof-foreground-accent",{"nof-ui-subtitle-xsmall":o}),children:["(",a,")"]})]})},eJ=({comment:e,quoteComment:t,userHasVoted:n,reportAbuseFormComment:s,openAbuseReportForm:a,closeAbuseReportForm:o,openModalLoginActions:r,commentingEnded:l,hideQuote:c=!1,variant:d="flat",inlineReplyFormSlot:u})=>{let{brand:f,commentRepoBaseUrl:h,getJwtToken:x,sendAnalyticsEvent:p,loggedIn:M}=Z(),[g,j]=(0,i.useState)(e.votes.totalPositiveVotes),[k,v]=(0,i.useState)(n),[b,A]=(0,i.useState)({status:ey}),y=s===e.id,N=async t=>{if(t.preventDefault(),!M)return void r();if(!k&&b.status!==eN){j(g+1),v(!0),A({status:eN});try{var n,s;let t;await B(h,e.id,x),A({status:eC,data:void 0}),n=e.id,(t=null!=(s=ed.getJSON(eA))?s:[]).includes(n)||(t.push(n),ed.setJSON(eA,t)),p("well argumented",e.articleId,e.id)}catch(e){j(g),v(!1),A({status:eq})}}};return(0,m.jsxs)("article",{className:"card"===d?"bg-nof-background-content-highlight text-nof-foreground-primary rounded-nof-medium flex flex-col overflow-hidden":"text-nof-foreground-primary py-nof-16 last-child:border-0 border-divider-1 flex flex-col border-t first:border-t-0",children:["card"===d?(0,m.jsxs)("div",{className:"p-nof-16 gap-nof-20 flex flex-col",children:[(0,m.jsxs)("div",{className:"flex items-start justify-between",children:[(0,m.jsxs)("div",{className:"gap-nof-8 flex flex-col",children:[(0,m.jsx)(eD,{comment:e,nameClassName:"nof-ui-subtitle-xsmall"}),(0,m.jsx)("p",{className:"nof-ui-body-small text-nof-foreground-secondary",children:eL(e.createdAt)})]}),(0,m.jsx)(eH,{comment:e,openAbuseReportForm:a})]}),(0,m.jsxs)("div",{className:"nof-ui-body-medium",children:[!c&&(0,m.jsx)(eE,{comment:e}),(0,m.jsx)(eR,{comment:e.comment})]}),(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)(eB,{disabled:n,onClick:N,sentVoteStatus:b,voteCount:g,brand:f,userHasVoted:k}),!l&&(0,m.jsx)("button",{className:"nof-ui-subtitle-xsmall",onClick:t,children:"Vastaa"})]}),y&&(0,m.jsx)(eP,{comment:e,closeAbuseReportForm:o})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"relative flex justify-between",children:[(0,m.jsx)(eD,{comment:e}),(0,m.jsx)(eH,{comment:e,openAbuseReportForm:a})]}),(0,m.jsx)("p",{className:"timestamp-label",children:eL(e.createdAt)}),(0,m.jsxs)("div",{className:"py-nof-16 nof-ui-body-medium",children:[!c&&(0,m.jsx)(eE,{comment:e}),(0,m.jsx)(eR,{comment:e.comment})]}),(0,m.jsxs)("div",{children:[!l&&(0,m.jsx)("button",{className:"mr-nof-16 nof-ui-subtitle-xsmall",onClick:t,children:"Vastaa viestiin"}),(0,m.jsx)(eB,{disabled:n,onClick:N,sentVoteStatus:b,voteCount:g,brand:f,userHasVoted:k})]}),y&&(0,m.jsx)(eP,{comment:e,closeAbuseReportForm:o})]}),u]})},e$=/https?:\/\/|www\./i;function ez(e){return{hasLinks:e$.test(e),hasForbiddenChars:function(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=0&&n<=8||11===n||12===n||n>=14&&n<=31||n>=127&&n<=159||n>=8203&&n<=8205||65279===n||n>=8234&&n<=8238||n>=8294&&n<=8297)return!0}let t=e.indexOf("<");for(;-1!==t;){let n=e.indexOf(">",t);if(-1===n)return!0;let s=e.substring(t,n+1);if(!/^<br\s*\/?>$/i.test(s))return!0;t=e.indexOf("<",n+1)}return!!(/&(?!amp;|lt;|gt;|quot;|#39;|nbsp;)[a-zA-Z0-9#]+;/.test(e)||RegExp("\x3c!--.*?--\x3e|\\/\\*.*?\\*\\/","s").test(e))}(e)}}var eZ=({message:e,errorRef:t})=>(0,m.jsxs)("div",{className:"my-nof-8 py-nof-8 flex items-center",style:{backgroundColor:"rgba(194, 12, 38, 0.1)"},ref:t,children:[(0,m.jsx)("span",{className:"mx-nof-8 inline-flex",children:(0,m.jsx)("img",{className:"h-16 w-16",
1src:'data:image/svg+xml,<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">%0A    <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">%0A        <g  transform="translate(-24.000000, -844.000000)" fill="%23AD0F00" fill-rule="nonzero">%0A            <g transform="translate(24.000000, 844.000000)">%0A                <path d="M8,0.666666667 C12.0500882,0.666666667 15.3333333,3.94991183 15.3333333,8 C15.3333333,12.0500882 12.0500882,15.3333333 8,15.3333333 C3.94991183,15.3333333 0.666666667,12.0500882 0.666666667,8 C0.666666667,3.94991183 3.94991183,0.666666667 8,0.666666667 Z M8,2 C4.6862915,2 2,4.6862915 2,8 C2,11.3137085 4.6862915,14 8,14 C11.3137085,14 14,11.3137085 14,8 C14,4.6862915 11.3137085,2 8,2 Z M8,10.3333333 C8.36818983,10.3333333 8.66666667,10.6318102 8.66666667,11 C8.66666667,11.3681898 8.36818983,11.6666667 8,11.6666667 C7.63181017,11.6666667 7.33333333,11.3681898 7.33333333,11 C7.33333333,10.6318102 7.63181017,10.3333333 8,10.3333333 Z M8,4.33333333 C8.34189056,4.33333333 8.62367144,4.55852344 8.66218151,4.84863768 L8.66666667,4.91666667 L8.66666667,8.41666667 C8.66666667,8.73883277 8.36818983,9 8,9 C7.65810944,9 7.37632856,8.77480989 7.33781849,8.48469566 L7.33333333,8.41666667 L7.33333333,4.91666667 C7.33333333,4.59450056 7.63181017,4.33333333 8,4.33333333 Z"></path>%0A            </g>%0A        </g>%0A    </g>%0A</svg>'.toString(),alt:""})}),(0,m.jsx)("span",{className:"nof-ui-body-medium text-nof-foreground-primary text-nof-status-alert-default",children:e})]}),eG=({message:e})=>e&&Object.values(T).includes(e)?(0,m.jsx)(eZ,{message:e}):(0,m.jsx)(eZ,{message:T.GENERIC_ERROR}),eQ=({maxLength:e,currentLength:t})=>(0,m.jsxs)("span",{className:"nof-ui-body-small text-nof-foreground-secondary self-end",children:[Math.max(e-t,0)," merkki\xe4 j\xe4ljell\xe4"]}),eY=({onChangeHandler:e,textAreaValue:t,maxLength:n,rows:s,placeholder:a,required:o,name:l,labelText:c,hideLabelVisually:d,className:u})=>{let f=(0,i.useId)();return(0,m.jsxs)("div",{className:r("flex flex-col",u),children:[(0,m.jsx)("label",{htmlFor:f,className:r("nof-ui-subtitle-small",{"sr-only":d}),children:c}),(0,m.jsx)("textarea",{id:f,className:"form__input form__text-input--textarea",name:l,rows:s,onChange:t=>{e(t.currentTarget.value)},value:t,placeholder:a,maxLength:n,required:o})]})},eX=({sentCommentStatus:e,successRef:t})=>{let{brand:n}=Z();return(0,m.jsx)("div",{ref:t,className:"text-nof-foreground-primary",children:e.status===eC&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("h3",{className:"nof-ui-subtitle-medium mb-nof-8",children:"Kiitos kommentistasi!"}),(0,m.jsx)("p",{className:"nof-ui-body-medium mb-nof-16",children:(e=>{switch(e){case"hs":case"is":case"mn":return"Kiitos, kun osallistut keskusteluun. Kommenttisi on nyt tarkastettavana. Kommentteja julkaistaan sit\xe4 mukaa, kun toimitus ehtii niit\xe4 tarkastaa. Kommentteja tarkastetaan arkisin kello 7–24 ja viikonloppuisin kello 8–24.";default:return"Kiitos, kun osallistut keskusteluun. Kommenttisi on nyt tarkastettavana. Kommentteja julkaistaan sit\xe4 mukaa, kun toimitus ehtii niit\xe4 tarkastaa."}})(n)})]})})},e0=({namingSchemes:e,replyToComment:t,onClose:n,onSent:s})=>{let{brand:a,articleId:o,commentRepoBaseUrl:r,userInfo:l,getJwtToken:c,sendAnalyticsEvent:d,enableDraftPersistence:u}=Z(),f=(0,i.useMemo)(()=>({articleId:o,replyToCommentId:t.id}),[o,t.id]),[p,M]=(0,i.useState)(""),g=(0,i.useRef)(void 0);(0,i.useEffect)(()=>{var e;let t=g.current,n=!t||t.articleId!==f.articleId||t.replyToCommentId!==f.replyToCommentId;g.current=f,u&&n&&M((null!=(e=ex(f))?e:"").slice(0,1500))},[f,u]);let[j,k]=(0,i.useState)(!1),[v,b]=(0,i.useState)({}),[A,N]=(0,i.useState)(void 0),[C]=(0,i.useState)(()=>{let t=ek(e);return t&&ej(t),t}),[q,w]=(0,i.useState)({status:ey}),[S,W]=(0,i.useState)({hasLinks:!1,hasForbiddenChars:!1}
1),[I,L]=(0,i.useState)(!1),R=(0,i.useRef)(!0),O=(0,i.useRef)(null),E=(0,i.useRef)(null);(0,i.useEffect)(()=>(R.current=!0,()=>{R.current=!1}),[]);let T=(()=>{switch(C){case"anonymousCommenting":return"Anonyymi";case"registeredCommenting":return null==l?void 0:l.commentingNickName;case"realNameCommenting":return null==l?void 0:l.commentingRealName;default:return}})();return q.status===eC?(0,m.jsxs)("div",{className:"bg-nof-neutral-contrast-low gap-nof-8 p-nof-16 flex flex-col",children:[(0,m.jsx)(eX,{sentCommentStatus:q,successRef:O}),(0,m.jsx)("div",{children:(0,m.jsx)(h.$n,{label:"Sulje",variant:h.KT.Secondary,onClick:s,type:"button"})})]}):(0,m.jsxs)("form",{className:"bg-nof-neutral-contrast-low gap-nof-8 p-nof-16 flex flex-col",onSubmit:e=>{if(e.preventDefault(),(null==l?void 0:l.userBanned)===!0)return;let n=eb(C,l);if(!(p.trim().length>0&&p.length<=1500&&j&&n)||q.status===eN)return void b({instructionsNotRead:!j,chosenNameInvalid:!n});if(!I){let e=ez(p);if(e.hasLinks||e.hasForbiddenChars){W(e),L(!0);return}}w({status:eN});let s=e=>{D(r,o,a,p,C,null==l?void 0:l.accountIdEncoded,e,t.id).then(()=>{u&&eM(f),R.current&&(d("comment sent",o),w({status:eC,data:"ok"}))}).catch(e=>{R.current&&(N(F(e instanceof Error?e.message:"string"==typeof e?e:void 0)),w({status:eq}))})};c?c().then(s).catch(()=>{R.current&&(N("GENERIC_ERROR"),w({status:eq}))}):s()},children:[T&&(0,m.jsxs)("p",{className:"nof-ui-body-small text-nof-foreground-primary",children:["Kommenttisi n\xe4kyy nimell\xe4 ",(0,m.jsx)("span",{className:"font-bold",children:T})]}),(0,m.jsx)(eY,{rows:3,onChangeHandler:e=>{M(e),u&&ep(f,e),L(!1),W({hasLinks:!1,hasForbiddenChars:!1})},textAreaValue:p,placeholder:"Kirjoita kommenttisi t\xe4h\xe4n",maxLength:1500,required:!0,labelText:"Kirjoita kommenttisi t\xe4h\xe4n",hideLabelVisually:!0}),(0,m.jsx)(eQ,{maxLength:1500,currentLength:p.length}),(0,m.jsx)(x.S,{checked:j,onChange:e=>{k(e.target.checked),b(e=>({...e,instructionsNotRead:!1}))},label:(0,m.jsxs)("span",{className:"nof-ui-body-small",children:["Olen lukenut"," ",(0,m.jsx)(y.b,{text:"kommentointiohjeet",external:!0,containerClassName:"nof-ui-body-small",href:eK(a)})]})}),q.status===eq&&(0,m.jsx)(eG,{message:A}),v.chosenNameInvalid&&(0,m.jsx)(eZ,{message:"Ota ".concat("realNameCommenting"===C?"nimi":"nimimerkki"," k\xe4ytt\xf6\xf6n l\xe4hett\xe4\xe4ksesi kommentin")}),v.instructionsNotRead&&(0,m.jsx)(eZ,{message:"Sinun t\xe4ytyy lukea kommentointiohjeet ennen kommentoimista"}),S.hasLinks&&(0,m.jsx)(eZ,{message:"Linkit eiv\xe4t ole sallittuja",errorRef:E}),S.hasForbiddenChars&&(0,m.jsx)(eZ,{message:"Kommenttisi sis\xe4lt\xe4\xe4 kiellettyj\xe4 erikoismerkkej\xe4",errorRef:E}),(0,m.jsxs)("div",{className:"gap-nof-8 pt-nof-8 flex flex-row",children:[(0,m.jsx)(h.$n,{label:"Peruuta",variant:h.KT.Secondary,onClick:()=>{u&&eM(f),n()},type:"button"}),(0,m.jsx)(h.$n,{label:"L\xe4het\xe4 kommentti",variant:h.KT.Primary,type:"submit"})]})]})};function e1({label:e,state:t,type:n,onClick:s}){return(0,m.jsx)(h.$n,{variant:h.KT.Primary,onClick:s,type:n,label:e,loading:t===eN,loadingLabel:""})}var e2=({type:e,labelText:t,name:n,placeholder:s,onChangeHandler:a,textInputValue:o,required:i,maxLength:r})=>(0,m.jsx)("div",{children:(0,m.jsxs)("label",{className:"nof-ui-subtitle-small flex flex-col",children:[t,(0,m.jsx)("input",{className:"form__input form__text-input",name:n,type:e,placeholder:s,value:o,onChange:e=>{a(e.currentTarget.value)},required:i,maxLength:r})]})}),e3=(e,t,n,s,a,o,i,r)=>{e.preventDefault(),a({status:eN}),H(s,n,t,r).then(()=>{i(n,!0).then(()=>{o(),a({status:eC,data:"ok"})})}).catch(e=>{a({status:eq,data:e instanceof Error?e.message:"Unknown error"})})},e6=({onSuccess:e,onCancel:t})=>{let{setFormState:n}=Y(),{commentRepoBaseUrl:s,getJwtToken:a,refreshUserInfo:o,userInfo:r}=Z(),[l,c]=(0,i.useState)({status:ey}),d=()=>{e?e():n({nameClaimFormOpen:!1,nameClaimFormActive:"NONE"})},u=null!=r&&r.userFirstName&&r.userLastName?"".concat(r.userFirstName," ").concat(r.userLastName):"",[f,x]=(0,i.useState)(u);return(0,m.jsxs)("form",{onSubmit:e=>{e3(e,"realName",f,s,c,d,o,a)},className:"py-nof-16 text-nof-foreground-primary flex flex-col",action:"",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("h3",{className:"nof-ui-subtitle-medium pb-nof-8",children:"Vahvista oikea nimesi, niin voit kommentoida omalla nimell\xe4si"}),(0,m.jsx)("p",{className:"nof-ui-body-medium pb-nof-16",children:"Osaa jutuista voi kommentoida vain omalla nimell\xe4, osaa my\xf6s nimimerkill\xe4. Voit valita artikkelikohtaisesti n\xe4kyyk\xf6 kommentti nimell\xe4si vai nimimerkill\xe4si. Kannustamme lukijoitamme kirjoittamaan kommentteja omalla nimell\xe4\xe4n, samaan tapaan kuin HS:n mielipideosastolla."})]}),(0,m.jsx)(e2,{onChangeHandler:x,placeholder:"Etunimi Sukunimi",labelText:"Oikea nimesi",textInputValue:f}),(0,m.jsxs)("div",{className:"nof-ui-body-medium py-nof-16",children:[(0,m.jsxs)("p",{className:"mt-nof-8 pb-nof-4",children:[(0,m.jsx)("mark",{children:"Nimen pit\xe4\xe4 t\xe4sm\xe4t\xe4 viralliseen etu- ja sukunimeesi."})," Tarkistamme nimet, emmek\xe4 hyv\xe4ksy esimerkiksi lempinimi\xe4 tai pelkk\xe4\xe4 etu- tai sukunime\xe4."]}),(0,m.jsx)("p",{children:(0,m.jsx)("mark",{children:"Virheellinen nimi johtaa kommentoinnin estoon."})}),(0,m.jsx)("p",{className:"mt-nof-8",children:"Jos tilauksesi on HS Digi+, voit jakaa tilauksesi kolmelle perheenj\xe4senelle, jolloin saatte omat k\xe4ytt\xe4j\xe4tilit ja voitte kommentoida omilla nimill\xe4nne. Digilukuoikeuksia voit jakaa Hesarin asiakaspalvelukanavassa Oma Sanomassa."})]}),l.status===eq&&(0,m.jsx)(eG,{message:l.data}),(0,m.jsxs)("div",{className:"mt-nof-16 flex",children:[(0,m.jsx)("div",{className:"mr-nof-16",children:(0,m.jsx)(h.$n,{variant:h.KT.Secondary,onClick:()=>
1{t?t():n({nameClaimFormOpen:!1,nameClaimFormActive:"NONE"})},label:"Peruuta"})}),(0,m.jsx)(e1,{type:"submit",state:l.status,label:"Vahvista nimi"})]})]})},e8=({onChange:e,sentNameClaimStatus:t,closeNicknameForm:n})=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"text-nof-foreground-primary",children:[(0,m.jsx)("h3",{className:"nof-ui-subtitle-medium pt-nof-2 pb-nof-8",children:"Valitse pysyv\xe4 nimimerkki ja liity keskusteluun"}),(0,m.jsx)("p",{className:"text-nof-foreground-primary py-nof-4",children:"Valitse nimimerkkisi huolella. T\xe4ll\xe4 nimimerkill\xe4 tulet tulevaisuudessa kirjoittamaan kaikki kommenttisi."})]}),(0,m.jsx)(e2,{type:"text",name:"name-claim",labelText:"Nimimerkki",placeholder:"T\xe4m\xe4 nimi n\xe4kyy julkisesti",onChangeHandler:e,maxLength:100}),t.status===eq&&(0,m.jsx)(eG,{message:t.data}),(0,m.jsxs)("div",{className:"xs:flex mt-nof-16 flex-none",children:[(0,m.jsx)("div",{className:"mr-nof-16 mb-nof-16 xs:mb-nof-0",children:(0,m.jsx)(h.$n,{variant:h.KT.Secondary,onClick:n,label:"Peruuta"})}),(0,m.jsx)(e1,{type:"submit",state:t.status,label:"Vahvista nimimerkki"})]})]}),e5=({setCommentFormOpen:e,onSuccess:t,onCancel:n})=>{let[s,a]=(0,i.useState)({status:ey}),[o,r]=(0,i.useState)(""),{setFormState:l}=Y(),{commentRepoBaseUrl:c,refreshUserInfo:d,getJwtToken:u}=Z(),f=()=>{t?t():(e(!0),l({nameClaimFormOpen:!1,nameClaimFormActive:"NONE"}))};return(0,m.jsx)("form",{className:"py-nof-16 flex flex-col",onSubmit:e=>{e3(e,"nickname",o,c,a,f,d,u)},children:(0,m.jsx)(e8,{onChange:r,sentNameClaimStatus:s,closeNicknameForm:()=>{n?n():l({nameClaimFormOpen:!1,nameClaimFormActive:"NONE"})}})})},e7=({isOpen:e,repliesCount:t,ariaControls:n,onClick:s,buttonRef:a})=>(0,m.jsxs)("button",{ref:a,"aria-expanded":e,"aria-controls":n,className:"nof-ui-body-small mt-nof-12 pl-nof-12 gap-nof-8 flex items-center",onClick:s,children:[e?"Sulje vastaukset (".concat(t,")"):"N\xe4yt\xe4 vastaukset (".concat(t,")"),e?(0,m.jsx)(A.K,{color:"currentColor",size:16}):(0,m.jsx)(b.Z,{color:"currentColor",size:16})]}),e9=({node:e,quoteComment:t,namingSchemes:n,savedUpVotes:s,depth:a=0,...o})=>{var r;let l=s.includes(e.id),[c,d]=(0,i.useState)(!1),[u,f]=(0,i.useState)(!1),[h,x]=(0,i.useState)(!1),p=(0,i.useRef)(null),M=es(e.replies),{userInfo:g,loggedIn:j,sendAnalyticsEvent:k}=Z(),{inlineNameClaimCommentId:v,setInlineNameClaimCommentId:b}=Y();(0,i.useEffect)(()=>()=>{b(t=>t===e.id?void 0:t)},[e.id,b]);let A=null!=(r=o.commentingEnded)&&r||a>=3,y=ev(j,n),N=(()=>{if(h)return"reply";if(v!==e.id)return"closed";let t=n[0];return"realNameCommenting"===t?"claimRealName":"registeredCommenting"===t?"claimNickname":"closed"})(),C=(0,i.useCallback)(()=>{A||y||null!=g&&g.userBanned?t(e)():eb(n[0],g)?x(!0):b(e.id)},[t,e,A,y,g,n,b]);return(0,m.jsxs)("div",{className:"comment-thread",children:[(0,m.jsx)(eJ,{comment:e,quoteComment:C,hideQuote:a>0,variant:"card",...o,userHasVoted:l,commentingEnded:A,inlineReplyFormSlot:"reply"===N?(0,m.jsx)(e0,{namingSchemes:n,replyToComment:e,onClose:()=>{x(!1)},onSent:()=>{x(!1)}}):"claimRealName"===N?(0,m.jsx)("div",{className:"bg-nof-background-content-highlight px-nof-16 pb-nof-16",children:(0,m.jsx)(e6,{onSuccess:()=>{b(void 0),x(!0)},onCancel:()=>{b(void 0)}})}):"claimNickname"===N?(0,m.jsx)("div",{className:"bg-nof-background-content-highlight px-nof-16 pb-nof-16",children:(0,m.jsx)(e5,{onSuccess:()=>{b(void 0),x(!0)},onCancel:()=>{b(void 0)}})}):void 0}),e.replies.length>0&&(0,m.jsx)(e7,{isOpen:c,repliesCount:M,ariaControls:"replies-".concat(e.id),buttonRef:p,onClick:()=>{let e=!c;d(e),f(!0),k(e?"reply show":"reply hide")}}),(0,m.jsx)("div",{id:"replies-".concat(e.id),hidden:!c,className:"border-nof-neutral-contrast-low mt-nof-12 pl-nof-12 gap-nof-16 flex flex-col border-l-2",role:"group","aria-label":"Vastaukset",children:u&&e.replies.map(e=>(0,m.jsx)(e9,{node:e,quoteComment:t,namingSchemes:n,savedUpVotes:s,depth:a+1,...o},e.id))}),c&&(0,m.jsx)(e7,{isOpen:c,repliesCount:M,ariaControls:"replies-".concat(e.id),onClick:()=>{var e;d(!1),null==(e=p.current)||e.focus(),k("reply hide")}})]})},e4=(0,i.forwardRef)(function(e,t){let n=(0,i.useCallback)(()=>{t&&"current"in t&&t.current&&t.current.scrollIntoView({block:"center"})},[t]);return(0,i.useEffect)(()=>{n()},[n]),null}),te=({namingSchemes:e,currentValue:t,setter:n}
1)=>{let{setFormState:s}=Y(),{loggedIn:a,userInfo:o}=Z(),{commentingNickName:i,commentingRealName:l}=null!=o?o:{};return(0,m.jsxs)(M.z6,{label:"Valitse mill\xe4 kirjoitat kommenttisi",value:t,onValueChange:n,groupClassName:"mb-nof-16",children:[e.includes("realNameCommenting")&&a&&(0,m.jsxs)(M.sx,{value:"realNameCommenting",containerClassName:"mb-nof-8",checked:"realNameCommenting"===t,children:[null!=l?l:"Etunimi Sukunimi",(0,m.jsx)("button",{onClick:()=>{s({nameClaimFormOpen:!0,nameClaimFormActive:"realName"})},style:{textDecoration:"underline"},type:"button",className:r("ml-nof-8",{hidden:!!l}),children:"Ota nimi k\xe4ytt\xf6\xf6n"})]}),e.includes("anonymousCommenting")&&(0,m.jsx)(M.sx,{value:"anonymousCommenting",containerClassName:"mb-nof-8",checked:"anonymousCommenting"===t,children:"Anonyymi"}),e.includes("registeredCommenting")&&a&&(0,m.jsxs)(M.sx,{value:"registeredCommenting",containerClassName:"mb-nof-8",checked:"registeredCommenting"===t,children:[i?"Nimimerkki: ".concat(i):"Nimimerkki",(0,m.jsx)("button",{onClick:()=>{s({nameClaimFormOpen:!0,nameClaimFormActive:"nickname"})},style:{textDecoration:"underline"},type:"button",className:r("ml-nof-8",{hidden:!!i}),children:"Ota nimimerkki k\xe4ytt\xf6\xf6n"})]})]})},tt=({namingSchemes:e,chosenNamingScheme:t,setChosenNamingScheme:n,isQuotingComment:s})=>{let{userInfo:a}=Z(),{commentingNickName:o,commentingRealName:i}=null!=a?a:{};return e.length>1?(0,m.jsx)(te,{namingSchemes:e,currentValue:t,setter:n}):(0,m.jsxs)("div",{className:"text-nof-foreground-primary",children:[(0,m.jsx)("h3",{className:"nof-ui-subtitle-medium mt-nof-8",children:s?"Vastaa viestiin":"Uusi kommentti"}),(0,m.jsxs)("p",{className:"text-nof-foreground-primary mt-nof-16",children:["Kommenttisi n\xe4kyy"," ","realNameCommenting"===t?"nimell\xe4":"nimimerkill\xe4"," ",(0,m.jsx)("span",{className:"font-bold",children:(()=>{switch(t){case"anonymousCommenting":return"Anonyymi";case"registeredCommenting":return o;case"realNameCommenting":return i;default:return}})()})]})]})},tn=({quotedComment:e,namingSchemes:t})=>(0,m.jsx)(m.Fragment,{children:e&&(0,m.jsxs)("div",{className:"nof-ui-body-medium text-nof-foreground-primary",children:[t.length>1&&(0,m.jsx)("p",{className:"mt-nof-16",children:"Vastaat toisen k\xe4ytt\xe4j\xe4n kommenttiin"}),(0,m.jsx)("div",{className:"border-nof-foreground-primary pl-nof-8 mt-nof-16 border-l-2",children:(0,m.jsx)(eT,{comment:e})})]})}),ts=({commentingEnded:e,commentingTemporarilyDisabled:t})=>(0,m.jsxs)("div",{className:"text-nof-foreground-primary",children:[e&&(0,m.jsxs)("div",{children:[(0,m.jsx)("h3",{className:"nof-ui-subtitle-medium mb-nof-8",children:"Artikkelia ei voi en\xe4\xe4 kommentoida."}),(0,m.jsx)("p",{className:"nof-ui-body-medium",children:"Artikkeleita voi kommentoida vain rajatun aikaa julkaisusta. Kommentointi on suljettu."})]}),t&&(0,m.jsxs)("div",{children:[(0,m.jsx)("h3",{className:"nof-ui-subtitle-medium mb-nof-8",children:"Artikkelia ei voi t\xe4ll\xe4 hetkell\xe4 kommentoida"}),(0,m.jsx)("p",{className:"nof-ui-body-medium",children:"Kommenttien tarkistuksessa on ruuhkaa, joten t\xe4m\xe4n artikkelin kommentointi on toistaiseksi suljettu. Kokeile my\xf6hemmin uudestaan."})]})]}),ta=({instructionsRead:e,setInstructionsRead:t})=>{let{brand:n}=Z();return(0,m.jsxs)("div",{className:"mt-nof-16",children:[(0,m.jsxs)("ul",{className:"nof-ui-body-small text-nof-foreground-primary ml-[22px] list-disc",children:[(0,m.jsx)("li",{children:"Lue juttu ja kommentoi vain sen aihetta."}),(0,m.jsx)("li",{children:"Perustele n\xe4kemyksesi."}),(0,m.jsx)("li",{children:"Varmista, ett\xe4 esitt\xe4m\xe4si tiedot pit\xe4v\xe4t paikkansa."}),(0,m.jsx)("li",{children:"Ole kohtelias ja rakentava."}),(0,m.jsx)("li",{children:"\xc4l\xe4 n\xe4lvi, ivaa, leimaa tai v\xe4\xe4ristele."}),(0,m.jsx)("li",{children:"Tekstisi voidaan julkaista my\xf6s muissa Sanoman medioissa."})]}),(0,m.jsxs)("div",{className:"my-nof-16",children:[(0,m.jsx)(y.b,{text:"Luethan my\xf6s pidemm\xe4t kommentointiohjeet ennen kommentoimista",external:!0,href:eK(n)})," "]}),(0,m.jsx)("div",{className:"my-nof-8",children:(0,m.jsx)(x.S,{checked:e,onChange:e=>{t(e.target.checked)},label:"Olen lukenut kommentointiohjeet"})})]})},to=({brand:e})=>(0,m.jsxs)("div",{className:"text-nof-foreground-primary",children:[(0,m.jsx)("h3",{className:"nof-ui-subtitle-medium mb-nof-8",children:"Kommentointisi on estetty."}),(0,m.jsxs)("p",{className:"nof-ui-body-medium",children:["Syyn\xe4 t\xe4h\xe4n voi olla kommentointiohjeiden rikkominen tai puutteelliset nimitiedot. Katso lis\xe4tietoja"," ",(0,m.jsx)("a",{style:{textDecoration:"underline"},href:eK(e),children:"kommentointiohjeista"}),"."]})]}),ti=({namingSchemes:e,commentFormOpen:t,setCommentFormOpen:n,commentingEnded:s,quotedComment:a,setQuotedComment:o,textAreaValue:r,setTextAreaValue:l,setCommentFormOrNameClaimFormOpen:c,closeAbuseReportForm:d,abuseReportFormComment:u,commentFormRef:f,commentingTemporarilyDisabled:x})=>{let[p,M]=(0,i.useState)(!1),[g,j]=(0,i.useState)({}),[k,v]=(0,i.useState)({hasLinks:!1,hasForbiddenChars:!1}),[b,A]=(0,i.useState)(!1),[y,N]=(0,i.useState)(void 0),[C,q]=(0,i.useState)(ek(e)),[w,S]=(0,i.useState)({status:ey}),[W,I]=(0,i.useState)(!1),{brand:L,articleId:R,commentRepoBaseUrl:O,userInfo:E,getJwtToken:T,sendAnalyticsEvent:_,enableDraftPersistence:K}=Z(),V=(0,i.useRef)(null),P=(0,i.useRef)(null);(0,i.useEffect)(()=>{C&&ej(C)},[C]),(0,i.useEffect)(()=>{u&&S({status:ey})},[u]);let U=()=>{o(void 0),l(""),n(!1),K&&eM({articleId:R})};return(0,m.jsxs)("div",{className:"py-nof-16",ref:f,children:[!t||s||x?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(eX,{sentCommentStatus:w,successRef:V}),(0,m.jsx)(ts,{commentingEnded:s,commentingTemporarilyDisabled:x}),W&&(0,m.jsx)(to,{brand:L}),!W&&!s&&!x&&(0,m.jsx)(h.$n,{variant:h.KT.Primary,label:"Kirjoita kommentti",onClick:()=>{null!=E&&E.userBanned?I(!0):(c(),d(),_("write",R),S({status:ey}))}})]}):(0,m.jsxs)("form",{onSubmit:e=>{((e,t)=>
1{e.preventDefault();let n=e=>{D(O,R,L,t,C,null==E?void 0:E.accountIdEncoded,e,null==a?void 0:a.id).then(()=>{S({status:eC,data:"ok"}),_("comment sent",R),U()}).catch(e=>{console.error("Sending comment failed"),N(F("string"==typeof e?e:"Unknown error")),S({status:eq})})};if(t.length>0&&t.length<=1500&&p&&eb(C,E)&&w.status!==eN){if(!b){let e=ez(t);if(e.hasLinks||e.hasForbiddenChars){v(e),A(!0);return}}S({status:eN}),T?T().then(e=>{n(e)}).catch(()=>{console.error("Could not get JWT token"),S({status:eq})}):n()}else j(e=>({...e,instructionsNotRead:!p,chosenNameInvalid:!eb(C,E)}))})(e,r)},children:[(0,m.jsx)(tt,{namingSchemes:e,chosenNamingScheme:C,setChosenNamingScheme:e=>{q(e),eb(e,E)&&j(e=>({...e,chosenNameInvalid:!1}))},isQuotingComment:!!a}),(0,m.jsx)(tn,{quotedComment:a,namingSchemes:e}),(0,m.jsxs)("div",{className:"mt-nof-24 flex flex-col",children:[(0,m.jsx)(eY,{rows:5,onChangeHandler:e=>{l(e),K&&ep({articleId:R},e),A(!1),v({hasLinks:!1,hasForbiddenChars:!1})},textAreaValue:r,placeholder:"Kirjoita kommenttisi t\xe4h\xe4n",maxLength:1500,required:!0,labelText:"Kirjoita kommenttisi t\xe4h\xe4n",hideLabelVisually:!0}),(0,m.jsx)(eQ,{maxLength:1500,currentLength:r.length}),(0,m.jsx)(ta,{instructionsRead:p,setInstructionsRead:e=>{M(e),j(e=>({...e,instructionsNotRead:!1}))}}),w.status===eq&&(0,m.jsx)(eG,{message:y}),g.chosenNameInvalid&&(0,m.jsx)(eZ,{message:"Ota ".concat("realNameCommenting"===C?"nimi":"nimimerkki"," k\xe4ytt\xf6\xf6n l\xe4hett\xe4\xe4ksesi kommentin"),errorRef:P}),g.instructionsNotRead&&(0,m.jsx)(eZ,{message:"Sinun t\xe4ytyy lukea kommentointiohjeet ennen kommentoimista",errorRef:P}),k.hasLinks&&(0,m.jsx)(eZ,{message:"Linkit eiv\xe4t ole sallittuja",errorRef:P}),k.hasForbiddenChars&&(0,m.jsx)(eZ,{message:"Kommenttisi sis\xe4lt\xe4\xe4 kiellettyj\xe4 erikoismerkkej\xe4",errorRef:P}),(0,m.jsxs)("div",{className:"mt-nof-8",children:[(0,m.jsx)(eX,{sentCommentStatus:w,successRef:V}),(0,m.jsxs)("div",{className:"flex flex-row",children:[(0,m.jsx)("div",{className:"mr-nof-16",children:(0,m.jsx)(h.$n,{label:"Peruuta",variant:h.KT.Secondary,onClick:U})}),(0,m.jsx)(h.$n,{label:"L\xe4het\xe4 kommentti",variant:h.KT.Primary,type:"submit"})]})]})]})]}),(0,m.jsx)(e4,{ref:w.status===eC?V:P,commentFormRef:f})]})},tr="sort-option",tl=["newest","oldest","highestvote"],tm=e=>{switch(e){case"oldest":return"Vanhin ensin";case"newest":return"Uusin ensin";case"highestvote":return"Suosituin ensin"}},tc=({sortOrder:e,setFetchAll:t,setSortOrder:n,onSort:s})=>{let[a,o]=(0,i.useState)(!1),r=(0,i.useRef)(null),l=(0,i.useRef)(null),c=(0,i.useId)();(0,i.useEffect)(()=>{if(!a)return;let e=e=>{r.current&&e.target instanceof Node&&!r.current.contains(e.target)&&o(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[a]);let d=e=>{var a;ed.setItem(tr,e),t(!0),n(e),s(e,tm(e)),o(!1),null==(a=l.current)||a.focus()};return(0,m.jsxs)("div",{ref:r,className:"relative w-full sm:inline-block sm:w-auto",children:[(0,m.jsx)(h.$n,{ref:l,variant:h.KT.Text,label:"J\xe4rjest\xe4: ".concat(tm(e)),icon:a?(0,m.jsx)(q.b,{}):(0,m.jsx)(C.O,{}),onClick:()=>{o(e=>!e)},"aria-expanded":a,"aria-haspopup":"listbox","aria-controls":a?c:void 0}),a&&(0,m.jsx)("ul",{id:c,role:"listbox","aria-label":"J\xe4rjest\xe4 kommentit",className:"border-nof-neutral-contrast-default rounded-nof-small bg-nof-grayscale-100 absolute right-0 z-50 mt-1 w-full overflow-hidden border sm:w-auto sm:min-w-[327px]",style:{boxShadow:"0px 4px 8px 0px rgba(25,25,25,0.15), 0px 1px 3px 0px rgba(25,25,25,0.2)"},children:tl.map(t=>(0,m.jsx)("li",{role:"option","aria-selected":t===e,className:"bg-nof-grayscale-100 hover:bg-nof-neutral-contrast-very-low p-nof-8 flex cursor-pointer items-start",onClick:()=>{d(t)},onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),d(t))},tabIndex:0,children:(0,m.jsxs)("div",{className:"nof-ui-body-medium text-nof-foreground-primary gap-nof-8 px-nof-25 flex items-center",children:[(0,m.jsx)("span",{className:"flex shrink-0 items-center",style:{visibility:t===e?"visible":"hidden"},children:(0,m.jsx)(N.S,{})}
1),tm(t)]})},t))})]})},td=({visible:e,sortOrder:t,setFetchAll:n,setSortOrder:s,onSort:a})=>e?(0,m.jsx)(tc,{sortOrder:t,setFetchAll:n,setSortOrder:s,onSort:a}):null,tu=({className:e,height:t,width:n,iconUrl:s,title:a})=>(0,m.jsx)("span",{title:a,role:"presentation",className:r(e,"block","bg-center","bg-no-repeat","bg-contain","commenting-ui__icon"),children:(0,m.jsx)("style",{children:"\n        span.commenting-ui__icon {\n          width: ".concat(n,"px;\n          height: ").concat(t,"px;\n          background-image: url('").concat(s,"');\n        }\n      ")})}),tf=()=>{let{loginHandler:e,registrationHandler:t,brand:n}=Z();return(0,m.jsxs)("div",{className:"py-nof-16",children:[(0,m.jsx)("p",{className:"ui-title-20 mb-nof-8","data-ab":"login-to-comment-title",children:"Kirjaudu sis\xe4\xe4n osallistuaksesi keskusteluun"}),(0,m.jsx)("p",{className:"nof-ui-body-medium text-nof-foreground-primary mb-nof-16",children:"hs"===n?"Luo tunnus tai kirjaudu sis\xe4\xe4n, jotta voit kommentoida ja arvioida muiden kommentteja. Kirjautuneena saat k\xe4ytt\xf6\xf6si my\xf6s artikkelin tallennuksen ja aiheiden seuraamisen.":"Luo tunnus tai kirjaudu sis\xe4\xe4n, jotta voit kommentoida ja arvioida muiden kommentteja."}),(0,m.jsxs)("div",{className:"flex flex-row",children:[(0,m.jsx)(h.$n,{containerClassName:"mr-nof-16",label:"Luo tili",variant:h.KT.Secondary,onClick:t}),(0,m.jsx)(h.$n,{label:"Kirjaudu sis\xe4\xe4n",variant:h.KT.Primary,onClick:e})]})]})},th=({isOpen:e,closeModal:t})=>{let{loginHandler:n,registrationHandler:s}=Z();return(0,i.useEffect)(()=>{w.setAppElement("#__next")},[]),(0,m.jsxs)(w,{isOpen:e,onRequestClose:t,overlayClassName:"fixed flex justify-center items-center w-full h-full top-0 left-0 lg:pr-sideAdOffset",className:r("border-0","rounded-lg","shadow-lg","bg-nof-background-wallpaper-default","outline-hidden","focus:outline-hidden","p-nof-16","nof-ui-body-medium text-nof-foreground-primary","absolute","xl:relative","xl:right-sideAdOffset","w-full","sm:w-minSiteWidth","sm:box-content"),closeTimeoutMS:300,children:[(0,m.jsxs)("div",{className:"space-between mb-nof-8 flex",children:[(0,m.jsx)("h2",{className:"ui-title-20",children:"Kirjaudu ensin sis\xe4\xe4n"}),(0,m.jsx)(tx,{closeModal:t})]}),(0,m.jsx)("p",{className:"nof-ui-body-medium text-nof-foreground-primary mb-nof-16",children:"Sinun t\xe4ytyy kirjautua sis\xe4\xe4n, jotta voit arvioida kommentteja tai vastata muille."}),(0,m.jsxs)("div",{className:"flex flex-row",children:[(0,m.jsx)(h.$n,{containerClassName:"mr-nof-16",label:"Luo tili",variant:h.KT.Secondary,onClick:s}),(0,m.jsx)(h.$n,{label:"Kirjaudu sis\xe4\xe4n",variant:h.KT.Primary,onClick:n})]}),(0,m.jsx)("style",{children:"\n      .ReactModal__Overlay {\n        opacity: 0;\n        animation: pop-up 1000ms;\n      }\n\n      @keyframes pop-up {\n        0% {\n          transform: scale(0.5, 0.5);\n        }\n        50% {\n          transform: scale(1.1, 1.1);\n        }\n        100% {\n          transform: scale(1, 1);\n        }\n      }\n      \n      .ReactModal__Overlay--after-open{\n          opacity: 1;\n      }\n      \n      .ReactModal__Overlay--before-close{\n          opacity: 0;\n      }\n      "})]})},tx=({closeModal:e})=>(0,m.jsx)("button",{className:"float-right ml-auto border-0 bg-transparent text-3xl leading-none font-semibold text-black opacity-5 outline-hidden focus:outline-hidden",onClick:e,type:"button",title:"Sulje","aria-label":"Sulje",children:(0,m.jsx)(tu,{iconUrl:'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path style="fill: %23999999" d="M950.079 1024L512 585.91 73.926 1024 0 950.09 438.079 512 0 73.94 73.926 0 512 438.059 950.079 0 1024 73.94 585.921 512 1024 950.09 950.079 1024z"/></svg>'.toString(),width:24,height:24})}),tp=({realNameOnly:e,setRealNameOnly:t,namingSchemes:n})=>!n.includes("realNameCommenting")||n.length<=1?null:(0,m.jsx)("div",{className:"py-nof-16 flex items-center",children:(0,m.jsx)(S.d,{checked:e,onCheckedChange:()=>{t(!e)},id:"realNameOnly",label:"N\xe4yt\xe4 vain nimell\xe4 kirjoittavat"})}),tM=()=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"spinner relative inline-block",children:(0,m.jsx)("div",{className:"h-full w-full rounded-full border-2 border-white"})}),(0,m.jsx)("style",{children:"\n        .spinner {\n          width: 24px;\n          height: 24px;\n        }\n        .spinner > div {\n          animation: spin 1.2s infinite;\n          border-color: grey transparent transparent transparent;\n        }\n        @keyframes spin {\n          0% {\n            transform: rotate(0deg);\n          }\n          100% {\n            transform: rotate(360deg);\n          }\n        }\n      "})]}),tg=({totalComments:e,loading:t,rightSlot:n})=>(0,m.jsxs)("div",{className:"pb-nof-16 gap-nof-12 flex flex-col sm:flex-row sm:items-center sm:justify-between",children:[(0,m.jsxs)("h2",{className:"nof-component-list-heading-l text-nof-foreground-primary",children:["Kommentit ",e>0&&(0,m.jsxs)("span",{children:["(",e,")"]})]}),(0,m.jsxs)("div",{className:"gap-nof-8 flex items-center",children:[t&&(0,m.jsx)(tj,{}),n]})]}),tj=()=>{let[e,t]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{let e=setTimeout(()=>{t(!0)},1e3);return()=>{clearTimeout(e)}},[]),e?(0,m.jsx)(tM,{}):null},tk=({borderBottom:e=!0,infoMessageTypes:t})=>(0,m.jsx)("div",{className:"text-nof-foreground-primary",children:t.map(n=>{switch(n){case"commentingEnded":return(0,m.jsxs)(tv,{borderBottom:e,children:[(0,m.jsx)("span",{className:"nof-ui-subtitle-medium",children:"Artikkelin kommentointi ei ole k\xe4yt\xf6ss\xe4."}),(0,m.jsx)("br",{}),(0,m.jsx)("span",{className:"nof-ui-body-medium",children:"Kommentointiaika on p\xe4\xe4ttynyt."})]},n);case"anonymousCommenting":return(0,m.jsx)(tv,{borderBottom:e,children:"T\xe4t\xe4 artikkelia voit poikkeuksellisesti kommentoida anonyymisti."},n);
1case"realNameCommenting":return 1===t.length?(0,m.jsxs)(tv,{borderBottom:e,children:["T\xe4t\xe4 artikkelia voit kommentoida vain omalla nimell\xe4."," ",(0,m.jsx)("a",{style:{textDecoration:"underline"},href:"https://www.hs.fi/kotimaa/art-2000006105996.html",children:"Lue lis\xe4\xe4"})]},n):null;case"commentsNotVisible":return(0,m.jsx)(tv,{borderBottom:e,children:"T\xe4t\xe4 artikkelia ei ole mahdollista kommentoida."},n);default:return null}})}),tv=({children:e,borderBottom:t})=>(0,m.jsxs)("div",{className:r("text-nof-foreground-primary border-divider-1 py-nof-16 flex items-center",{"border-b":t}),children:[(0,m.jsx)(W.e,{className:"text-nof-foreground-primary"}),(0,m.jsx)("span",{className:"nof-ui-body-medium text-nof-foreground-primary ml-nof-8",children:e})]}),tb=()=>(0,m.jsxs)("div",{className:"p-nof-16 pb-nof-0 border-divider-1 border-b",children:[(0,m.jsx)("div",{className:"border-divider-1 mb-nof-16 border-b",children:(0,m.jsx)(tg,{loading:!1,totalComments:0})}),(0,m.jsx)(tk,{infoMessageTypes:["commentsNotVisible"],borderBottom:!1})]}),tA=({visible:e,showMore:t})=>e?(0,m.jsx)("div",{className:"border-divider-1 pb-nof-16 flex items-center justify-center border-b align-middle",children:(0,m.jsx)(h.$n,{"data-ab":"show-more-comments",variant:h.KT.Text,label:"N\xe4yt\xe4 lis\xe4\xe4",onClick:t,icon:(0,m.jsx)(b.Z,{})})}):null,ty=({active:e,setCommentFormOpen:t})=>{switch(e){case"nickname":return(0,m.jsx)(e5,{setCommentFormOpen:t});case"realName":return(0,m.jsx)(e6,{});default:return null}},tN=({commentData:e,loading:t,sortOrder:n,realNameOnly:s,setFetchAll:a,setSortOrder:o,setRealNameOnly:l})=>{var c;let{formState:d,setFormState:u}=Y(),{initialCommentFormOpen:f,loggedIn:h,userInfo:x,sendAnalyticsEvent:p,articleId:M,setNativeCommentingFormHandler:g,brand:j,enableNestedThreads:k,enableDraftPersistence:v}=Z(),[b,A]=(0,i.useState)(Math.min(e.comments.length,50)),[y,N]=(0,i.useState)(n),[C,q]=(0,i.useState)(!1),[w,S]=(0,i.useState)(void 0),[W,I]=(0,i.useState)(void 0),[L,R]=(0,i.useState)(""),[O,E]=(0,i.useState)(void 0),T=(0,i.useRef)(null),[F,_]=(0,i.useState)(!1),[K,V]=(0,i.useState)(!1),{totalComments:P,comments:U,article:D}=e,H=D.commentingSettings,{commentingEnded:B}=D;y!==n&&(N(n),A(50));let $=(0,i.useMemo)(()=>k?((e,t="oldest")=>{var n;let s=new Map;for(let t of e)s.set(t.id,t);for(let t of e)t.parent&&X(t.parent,s);let a=new Map,o=[];for(let e of s.values())a.set(e.id,{...e,replies:[]});for(let e of s.values()){let t=a.get(e.id);t&&(void 0!==e.parentId&&a.has(e.parentId)?null==(n=a.get(e.parentId))||n.replies.push(t):o.push(t))}return o.sort(et[t]),en(o),o})(U,n):[],[k,U,n]),z=ev(h,H),G=null!=(c=ed.getJSON(eA))?c:[],Q=k?$.length>b||P>U.length:P>b,ee=(0,i.useCallback)(()=>{let e=e=>{u({nameClaimFormOpen:e,nameClaimFormActive:"nickname"})},t=e=>{u({nameClaimFormOpen:e,nameClaimFormActive:"realName"})};e(!1),t(!1),H.includes("anonymousCommenting")?q(!0):H.includes("registeredCommenting")?H.includes("realNameCommenting")?null!=x&&x.commentingNickName||null!=x&&x.commentingRealName?q(!0):e(!0):null!=x&&x.commentingNickName?q(!0):e(!0):null!=x&&x.commentingRealName?q(!0):t(!0)},[H,u,x]),es=e=>()=>{null!=x&&x.userBanned&&V(!0),D.commentingEnded||(z?er():(ee(),S(e),k?I(e.id):ea(),p("reply",e.articleId,e.id)))},ea=()=>{var e;return null==(e=T.current)?void 0:e.scrollIntoView()},eo=e=>{E(e.id)},ei=()=>{E(void 0)},er=()=>{_(!0)};(0,i.useEffect)(()=>{void 0!==W&&ea()},[W]);let el=(0,i.useRef)(void 0);return(0,i.useEffect)(()=>{var e;let t=el.current!==M;el.current=M,v&&t&&R((null!=(e=ex({articleId:M}))?e:"").slice(0,1500))},[M,v]),(0,i.useEffect)(()=>{f&&!z&&(ee(),ea()),void 0!==g&&g(()=>{ee(),ea()})},[f,g,z,ee]),D.commentingVisible?(0,m.jsxs)("div",{className:"border-divider-1 border-b",children:[(0,m.jsx)("div",{className:"p-nof-16 pb-nof-0",children:(0,m.jsx)(tg,{loading:t,totalComments:P,rightSlot:(0,m.jsx)(td,{visible:P>0,sortOrder:n,setFetchAll:a,setSortOrder:o,onSort:(e,t)=>{p("order by",t)}})})}),(0,m.jsxs)("div",{className:"px-nof-16",children:[(0,m.jsx)(tp,{namingSchemes:H,realNameOnly:s,setRealNameOnly:l}),(0,m.jsx)(tk,{infoMessageTypes:H,borderBottom:!1}),0===P&&!B&&(0,m.jsx)(J,{title:"Ei viel\xe4 kommentteja",message:"Ole ensimm\xe4inen ja kerro ajatuksesi.",className:r("border-divider-2","border-b")}),k?$.length>0&&(0,m.jsx)("div",{className:"gap-nof-24 flex flex-col",children:$.slice(0,b).map(e=>(0,m.jsx)(e9,{node:e,quoteComment:es,namingSchemes:H,savedUpVotes:G,reportAbuseFormComment:O,openAbuseReportForm:eo,closeAbuseReportForm:ei,openModalLoginActions:er,commentingEnded:B},e.id))}):U.slice(0,b).map(e=>(0,m.jsx)(eJ,{comment:e,quoteComment:es(e),userHasVoted:G.includes(e.id),reportAbuseFormComment:O,openAbuseReportForm:eo,closeAbuseReportForm:ei,openModalLoginActions:er,commentingEnded:B},e.id)),(0,m.jsx)(tA,{visible:Q,showMore:()=>{a(!0),A(b+50),p("show more",M)}}),z&&!B?(0,m.jsx)(tf,{}):d.nameClaimFormOpen?(0,m.jsx)(ty,{active:d.nameClaimFormActive,setCommentFormOpen:q}):K?(0,m.jsx)(to,{brand:j}
1):(0,m.jsx)(ti,{namingSchemes:H,commentFormOpen:k?C||!!W:C,setCommentFormOpen:k?e=>{q(e),e||(I(void 0),S(void 0))}:q,commentingEnded:D.commentingEnded,quotedComment:w,setQuotedComment:S,textAreaValue:L,setTextAreaValue:R,setCommentFormOrNameClaimFormOpen:ee,abuseReportFormComment:O,closeAbuseReportForm:ei,commentFormRef:T,commentingTemporarilyDisabled:e.commentingTemporarilyDisabled}),(0,m.jsx)(th,{isOpen:F,closeModal:()=>{_(!1)}})]})]}):(0,m.jsx)(tb,{})};function tC({remoteData:e,success:t,notAsked:n,loading:s,failure:a}){switch(e.status){case ey:return n();case eN:return s();case eq:return a();case eC:return t(e.data);default:return null}}var tq=(0,i.createContext)(void 0),tw=({children:e,brand:t,commentRepoBasePath:n,getJwtToken:s})=>{let a,o,i,{userCommentsUseCase:r,userId:l}=(o=(a=new URLSearchParams(window.location.search)).get(R),i=a.get(O),o?{userCommentsUseCase:R,userId:o}:i?{userCommentsUseCase:O,userId:i}:{userCommentsUseCase:"own",userId:void 0});return(0,m.jsx)(tq.Provider,{value:{brand:t,commentRepoBasePath:n,getJwtToken:s,userCommentsUseCase:r,userId:l},children:e})},tS=()=>{let e=(0,i.useContext)(tq);if(void 0===e)throw Error("useUserCommentsWidgetProps must be used within an UserCommentsWidgetPropProvider");return e},tW=({userName:e})=>{let{userCommentsUseCase:t}=tS();return(0,m.jsx)("div",{className:"pb-nof-8 flex flex-row justify-between",children:(0,m.jsx)("h2",{className:"section-heading-20",children:tI(t,e)})})},tI=(e,t)=>"own"===e?"":t?"Kommentit ".concat(t):"Kommentit",tL=({title:e,url:t})=>e&&t?(0,m.jsx)("a",{href:t,children:(0,m.jsx)("span",{className:"nof-component-list-heading-s text-nof-foreground-primary font-bold",children:e})}):null,tR=({userComment:e})=>(0,m.jsxs)("article",{className:"p-nof-16 bg-nof-background-content-default border-divider-1 flex flex-col border-t first-of-type:border-t-0",children:[(0,m.jsx)("div",{className:"relative flex justify-start",children:(0,m.jsx)(tL,{title:e.articleTitle,url:e.articleUrl})}),(0,m.jsx)("div",{className:"pt-nof-16 pb-nof-4 relative flex justify-start",children:(0,m.jsx)(eU,{comment:e})}),(0,m.jsx)("p",{className:"timestamp-label",children:eL(e.createdAt)}),(0,m.jsxs)("div",{className:"pt-nof-16 nof-ui-body-medium text-nof-foreground-primary",children:[(0,m.jsx)(eE,{comment:e}),(0,m.jsx)(eR,{comment:e.comment})]})]}),tO=({userCommentsData:e,userCommentsCount:t,showMore:n})=>0===e.count?(0,m.jsx)(J,{title:"Et ole viel\xe4 kommentoinut yht\xe4\xe4n juttua",className:"p-nof-16 text-nof-foreground-primary mx-auto flex w-full flex-col",message:"Juttujen kommentointi l\xf6ytyy artikkelisivujen lopusta."}):(0,m.jsxs)(m.Fragment,{children:[e.list.map(e=>(0,m.jsx)(tR,{userComment:e},e.id)),(0,m.jsx)(tA,{visible:t<e.totalCount,showMore:n})]}),tE=()=>{var e;let{commentRepoBasePath:t,userCommentsUseCase:n,userId:s,getJwtToken:a}=tS(),[o,r]=(0,i.useState)({status:ey}),[l,c]=(0,i.useState)(50),[d,u]=i.useState(!1),[f,h]=i.useState(void 0);(0,i.useEffect)(()=>{u(!0),"own"===n&&a().then(e=>{h(e)}).catch(()=>{console.error("Could not get JWT token")}),(s||f)&&(r(e=>({...e,status:eN})),P(t,n,s,l,f).then(e=>{r({status:eC,data:e})}).catch(()=>{r(e=>({...e,status:eq}))}))},[t,l,n,s,f,a]);let x=(0,i.useCallback)(()=>{c(l+50)},[c,l]);return d?(0,m.jsxs)("div",{className:"px-nof-16",children:[(0,m.jsx)(tW,{userName:null==(e=o.data)?void 0:e.data.userName}),(0,m.jsx)(tC,{remoteData:o,notAsked:()=>(0,m.jsx)(J,{title:"Ei kommentteja",message:"Kirjaudu sis\xe4\xe4n n\xe4hd\xe4ksesi omat kommentit."}),loading:()=>o.data?(0,m.jsx)(tO,{userCommentsData:o.data.data,userCommentsCount:l,showMore:x}):null,success:e=>(0,m.jsx)(tO,{userCommentsData:e.data,userCommentsCount:l,showMore:x}),failure:()=>(0,m.jsx)(J,{title:"Ei kommentteja",message:"Kommenttien haussa tapahtui virhe."})})]}):null},tT=()=>(0,m.jsx)("div",{children:"Not Asked"}),tF=()=>(0,m.jsx)("div",{className:"p-nof-16 text-nof-foreground-primary",children:"Kommenttien haussa tapahtui virhe. Yrit\xe4 hetken p\xe4\xe4st\xe4 uudelleen"}),t_=({commentRepoBaseUrl:e,articleId:t,brand:n,userInfo:s,loginHandler:a,registrationHandler:o,getJwtToken:r,refreshUserInfo:l,initialCommentFormOpen:c,loadAllComments:d,sendAnalyticsEvent:u,setNativeCommentingFormHandler:f,enableNestedThreads:h,enableDraftPersistence:x})=>{var p;let[M,g]=(0,i.useState)({status:ey}),j=null!=(p=ed.getItem(tr))?p:"newest",[k,v]=(0,i.useState)(null!=d&&d),[b,A]=(0,i.useState)(j),[y,N]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{g(e=>({...e,status:eN})),V(e,t,k,b,y).then(e=>{g({status:eC,data:e})}).catch(()=>{console.error("Error fetching comments"),g(e=>({...e,status:eq}))})},[e,t,b,y,k]),(0,m.jsx)(z,{brand:n,articleId:t,commentRepoBaseUrl:e,userInfo:s,loginHandler:a,registrationHandler:o,getJwtToken:r,refreshUserInfo:l,initialCommentFormOpen:c,sendAnalyticsEvent:u,setNativeCommentingFormHandler:f,enableNestedThreads:h,enableDraftPersistence:x,children:(0,m.jsx)(Q,{children:(0,m.jsx)(tC,{remoteData:M,notAsked:()=>(0,m.jsx)(tT,{}),loading:()=>M.data?(0,m.jsx)(tN,{commentData:M.data,loading:!0,sortOrder:b,realNameOnly:y,setFetchAll:v,setSortOrder:A,setRealNameOnly:N}):(0,m.jsx)("div",{className:"p-nof-16 nof-component-list-heading-l text-nof-foreground-primary",children:"Kommentit"}),success:e=>(0,m.jsx)(tN,{commentData:e,loading:!1,sortOrder:b,realNameOnly:y,setFetchAll:v,setSortOrder:A,setRealNameOnly:N}),failure:()=>(0,m.jsx)(tF,{})})})})},tK=({commentRepoBasePath:e,brand:t,getJwtToken:n})=>(0,m.jsx)(tw,{brand:t,commentRepoBasePath:e,getJwtToken:n,children:(0,m.jsx)(tE,{})})}
1,48167:(e,t,n)=>{n.d(t,{S:()=>l});var s=n(52677),a=n(37876),o=n(27964),i=n(69241);var r=n(14232),l=e=>{let t,n,l,m,c,d,u,f,h,x,p,M,g,j,k,v,b=(0,o.c)(39);b[0]!==e?({checked:t,error:n,id:l,label:m,ref:c,...d}=e,b[0]=e,b[1]=t,b[2]=n,b[3]=l,b[4]=m,b[5]=c,b[6]=d):(t=b[1],n=b[2],l=b[3],m=b[4],c=b[5],d=b[6]);let A=(0,r.useId)(),y=null!=l?l:A,N="checkbox-error-".concat(y),C=n&&!t&&"_WrapperWithGap_okh0q_7";b[7]!==C?(u=(0,i.$)("_Wrapper_okh0q_1",C,"nof-ui-body-medium"),b[7]=C,b[8]=u):u=b[8];let q=!!n;b[9]!==N||b[10]!==y||b[11]!==c||b[12]!==d||b[13]!==q?(f=(0,a.jsx)("input",{className:"_Input_okh0q_36","aria-describedby":N,"aria-invalid":q,id:y,ref:c,type:"checkbox",...d}),b[9]=N,b[10]=y,b[11]=c,b[12]=d,b[13]=q,b[14]=f):f=b[14];let w=n&&!t&&"_IconWrapperError_okh0q_31";return b[15]!==w?(h=(0,i.$)("_IconWrapper_okh0q_15",w),b[15]=w,b[16]=h):h=b[16],b[17]!==t?(x=t&&(0,a.jsx)(s.S,{className:"_CheckmarkIcon_okh0q_74"}),b[17]=t,b[18]=x):x=b[18],b[19]!==h||b[20]!==x?(p=(0,a.jsx)("div",{className:h,children:x}),b[19]=h,b[20]=x,b[21]=p):p=b[21],b[22]!==y||b[23]!==m?(M=(0,a.jsx)("label",{className:"_Label_okh0q_65",htmlFor:y,children:m}),b[22]=y,b[23]=m,b[24]=M):M=b[24],b[25]!==f||b[26]!==p||b[27]!==M?(g=(0,a.jsxs)("div",{className:"_Element_okh0q_11",children:[f,p,M]}),b[25]=f,b[26]=p,b[27]=M,b[28]=g):g=b[28],b[29]!==t||b[30]!==n||b[31]!==N?(j=n&&!t&&(0,a.jsx)("p",{className:"_ErrorMessage_okh0q_82",id:N,children:n}),b[29]=t,b[30]=n,b[31]=N,b[32]=j):j=b[32],b[33]!==j?(k=(0,a.jsx)("div",{className:"_Error_okh0q_78",role:"alert",children:j}),b[33]=j,b[34]=k):k=b[34],b[35]!==g||b[36]!==k||b[37]!==u?(v=(0,a.jsxs)("div",{className:u,children:[g,k]}),b[35]=g,b[36]=k,b[37]=u,b[38]=v):v=b[38],v}},74731:(e,t,n)=>{n.d(t,{T:()=>r});var s=n(83903),a=n(37876),o=n(69241),i=n(14232),r=e=>{let{id:t,name:n,label:r,placeholder:l,maxLength:m,value:c,onChange:d,readOnly:u,error:f,activated:h,textareaClassName:x,helperText:p,required:M=!0,hideOptionalLabel:g=!1,ref:j=(0,i.createRef)(),...k}=e,v=(0,i.useId)(),b=null!=t?t:v;return(0,a.jsx)(s.t,{id:b,label:r,error:f,helperText:p,isTextarea:!0,value:c,maxLength:m,required:M,hideOptionalLabel:g,inputRef:j,children:(0,a.jsx)("textarea",{ref:j,id:b,name:n,value:c,onChange:d,placeholder:l,maxLength:m,className:(0,o.A)("_Textarea_30c5v_1","nof-ui-body-medium",{[String("_Activated_30c5v_38")]:!!c||h,[String("_Error_30c5v_14")]:!!f},x),readOnly:u,"aria-readonly":u,"aria-invalid":!!f,"data-testid":"textarea",required:M,...k})})};r.displayName="Textarea"}}]);

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.