1import{n as e}from"./rolldown-runtime.20260815092527.js";var t=e({api:()=>l,clearAuth:()=>o,default:()=>l,getToken:()=>r,getUser:()=>i,isLoggedIn:()=>s,setAuth:()=>a}),n=`/api`;function r(){return localStorage.getItem(`token`)}function i(){try{return JSON.parse(localStorage.getItem(`user`)||`null`)}catch{return null}}function a(e,t){localStorage.setItem(`token`,e),localStorage.setItem(`user`,JSON.stringify(t))}function o(){localStorage.removeItem(`token`),localStorage.removeItem(`user`)}function s(){return!!r()}async function c(e,t={}){let i=r(),a={"Content-Type":`application/json`,...t.headers};i&&(a.Authorization=`Bearer ${i}`);let s=await fetch(`${n}${e}`,{...t,headers:a});if(s.status===401)throw o(),window.location.href=`/dang-nhap`,Error(`Phiên ÄÄng nháºp hết hạn`);if(s.status===403){let e=await s.json().catch(()=>({}));throw e.error&&e.error.includes(`tạm ngưng`)?(o(),window.location.href=`/dang-nhap?banned=1`,Error(e.error)):Error(e.error||`Không có quyá»n truy cáºp`)}let c=await s.json();if(!s.ok)throw Error(c.error||`Lá»i không xác Äá»nh`);return c}var l={get:e=>c(e),post:(e,t)=>c(e,{method:`POST`,body:JSON.stringify(t)}),put:(e,t)=>c(e,{method:`PUT`,body:JSON.stringify(t)}),delete:e=>c(e,{method:`DELETE`})};export{s as a,i,t as n,a as o,o as r,l as t};
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.