(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,28175,(e,a,l)=>{a.exports=e.r(37073)},31139,e=>{"use strict";var a=e.i(22152),l=e.i(2732),t=e.i(52313),s=e.i(28175);let r=a.default.env.NEXT_PUBLIC_API_BASE||"http://localhost:5000";function i({children:e}){let[a,i]=(0,t.useState)(!1),[n,d]=(0,t.useState)(!1),c=(0,s.usePathname)(),o="/admin/login"===c||"/admin"===c||c?.startsWith("/admin/login/");(0,t.useEffect)(()=>{let e=!1,a=e=>{try{let a=e.split(".");if(a.length<2)return!1;let l=JSON.parse(atob(a[1].replace(/-/g,"+").replace(/_/g,"/")));return l?.adminType==="super"}catch{return!1}};return(async()=>{try{let l=window.localStorage.getItem("admin_token_v1")||"";if(!l){e||d(!1);return}let t=await fetch(`${r}/api/admin/me`,{headers:{Authorization:`Bearer ${l}`},cache:"no-store"});if(t.ok){let a=await t.json().catch(()=>({}));e||d(a?.adminType==="super");return}e||d(a(l))}catch{let l=window.localStorage.getItem("admin_token_v1")||"";e||d(a(l))}})(),()=>{e=!0}},[c]);let b=(0,t.useMemo)(()=>(0,l.jsxs)("div",{className:"h-full bg-white border-r border-black/10",children:[(0,l.jsxs)("div",{className:"p-2 border-b border-black/10",children:[(0,l.jsx)("div",{className:"text-xl font-bold",children:"Admin Dashboard"}),(0,l.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Social AI Bot"})]}),(0,l.jsxs)("nav",{className:"p-3 space-y-2",children:[(0,l.jsx)("a",{href:"/admin/inbox",className:"block px-4 py-3 rounded-lg border border-black/10 hover:bg-black hover:text-white transition",children:"📥 Seller Inbox"}),(0,l.jsx)("a",{href:"/admin/sellers",className:"block px-4 py-3 rounded-lg border border-black/10 hover:bg-black hover:text-white transition",children:"👥 Create Sellers"}),(0,l.jsx)("a",{href:"/admin/api",className:"block px-4 py-3 rounded-lg border border-black/10 hover:bg-black hover:text-white transition",children:"⚙️ API Integration"}),n?(0,l.jsx)("a",{href:"/admin/admin-management",className:"block px-4 py-3 rounded-lg border border-black/10 hover:bg-black hover:text-white transition",children:"👤 Admin Management"}):null,(0,l.jsx)("a",{href:"/admin/logout",className:"block px-4 py-3 rounded-lg border border-black/10 hover:bg-black hover:text-white transition",children:"🚪 Logout"})]})]}),[n]);return o?(0,l.jsx)("div",{className:"min-h-screen bg-[#f6f6f6] flex items-center justify-center",children:(0,l.jsx)("main",{className:"w-full px-4",children:(0,l.jsx)("div",{className:"mx-auto w-full max-w-[520px]",children:e})})}):(0,l.jsxs)("div",{className:"min-h-screen bg-[#f6f6f6]",children:[(0,l.jsx)("div",{className:"md:hidden sticky top-0 z-40 border-b border-black/10 bg-white",children:(0,l.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,l.jsx)("button",{type:"button",onClick:()=>i(!0),className:"inline-flex items-center gap-2 rounded-lg border border-black/10 px-4 py-2 text-sm hover:bg-black hover:text-white transition","aria-label":"Open menu",children:"☰ Menu"}),(0,l.jsx)("div",{className:"text-sm font-semibold",children:"Admin"}),(0,l.jsx)("div",{className:"w-[64px]"})]})}),a&&(0,l.jsxs)("div",{className:"md:hidden fixed inset-0 z-50",children:[(0,l.jsx)("div",{className:"absolute inset-0 bg-black/40",onClick:()=>i(!1)}),(0,l.jsxs)("div",{className:"absolute left-0 top-0 h-full w-[82%] max-w-[340px] shadow-xl",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-black/10 bg-white",children:[(0,l.jsx)("div",{className:"text-sm font-semibold",children:"Menu"}),(0,l.jsx)("button",{type:"button",onClick:()=>i(!1),className:"rounded-lg border border-black/10 px-4 py-2 text-sm hover:bg-black hover:text-white transition",children:"✕"})]}),(0,l.jsx)("div",{className:"h-[calc(100%-52px)] overflow-y-auto",children:b})]})]}),(0,l.jsxs)("div",{className:"grid grid-cols-12",children:[(0,l.jsx)("aside",{className:"hidden md:block md:col-span-3 lg:col-span-2",children:b}),(0,l.jsx)("main",{className:"col-span-12 md:col-span-9 lg:col-span-10",children:e})]})]})}e.s(["default",()=>i])}]);