PageSourceSearch

https://mtdi.kz/assets/newsItems-6b87d4aa.js

js mtdi.kz collected 2026-10-02 20:51:54 UTC 2,231 bytes, 1 lines download raw bytes

1import"./index-e410f525.js";import{a5 as c}from"./vendor-vue-61d73241.js";const r="/api/v1",n=r.replace(/\/api\/v1\/?$/,""),l=t=>{const e=(Date.now()-t.getTime())/864e5;return e<1?"today":e<7?"week":e<31?"month":"all"},p=t=>t.startsWith("/uploads/")?n+t:t,m=p,d=t=>{var a;const e=new Date(t.date),s=((a=t.images)!=null&&a.length?t.images:[t.image_url]).filter(Boolean).map(m);return{id:t.id,slug:t.slug,title:t.title,description:t.excerpt,date:e,author:t.author??"",filter:l(e),category:t.category,images:s,image:s[0],views:t.views??0,comments:t.comments??0,likes:t.likes??0}},i=c([]);fetch(`${n}/api/news?limit=100`,{headers:{Accept:"application/json"}}).then(t=>t.ok?t.json():Promise.reject(new Error(String(t.status)))).then(t=>{const e=t.data??[];e.length&&i.splice(0,i.length,...e.map(d))}).catch(()=>{});const y=async t=>{const e=await fetch(`${n}/api/news/${encodeURIComponent(t)}`,{headers:{Accept:"application/json"}});if(e.status===404)return null;if(!e.ok)throw new Error(`news/${t}: HTTP ${e.status}`);return(await e.json()).data??null},f=async t=>{const e=await fetch(`${n}/api/news/${t}/comments`,{headers:{Accept:"application/json"}});if(!e.ok)throw new Error(`news/${t}/comments: HTTP ${e.status}`);return(await e.json()).data??[]},g=async(t,e,s)=>{const a=await fetch(`${n}/api/news/${t}/comments`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({author:e,text:s})});if(!a.ok)throw new Error(`news/${t}/comments: HTTP ${a.status}`)},N=async t=>{try{const e=await fetch(`${n}/api/news/${t}/view`,{method:"POST"});return e.ok?(await e.json()).views??null:null}catch{return null}},$=async(t,e)=>{try{const s=await fetch(`${n}/api/news/${t}/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({delta:e})});return s.ok?(await s.json()).likes??null:null}catch{return null}},o="mtdi_liked_news",u=()=>{try{return JSON.parse(localStorage.getItem(o)??"[]")}catch{return[]}},k=t=>u().includes(t),S=(t,e)=>{try{const s=new Set(JSON.parse(localStorage.getItem(o)??"[]"));e?s.add(t):s.delete(t),localStorage.setItem(o,JSON.stringify([...s]))}catch{}};export{i as N,$ as a,p as b,f as c,y as f,u as g,k as i,d as m,g as p,N as r,S as s};

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.