import{o as e,r as t,t as n}from"./jsx-runtime-BbTa8W_M-1776590214964.js";import{n as r,s as i}from"./app-CXDQ5oEH-1776590214964.js";import{t as a}from"./AdminLayout-gmPnZHB9-1776590214964.js";import{t as o}from"./globe-Dv4nSWeI-1776590214964.js";import s from"./IpLocatorTab-ChhNkmDE-1776590214964.js";import c from"./WorldRecordsTab-CUIfKiHh-1776590214964.js";var l=e(t(),1),u=n();function d({databaseStatus:e,csvStatus:t,apiSettings:n,errors:d}){let[f,p]=(0,l.useState)(`world_records`),[m,h]=(0,l.useState)([]),[g,_]=(0,l.useState)(!0),v=()=>{_(!0),i.get(`/api/locations/countries`).then(e=>{h(e.data),_(!1)}).catch(()=>_(!1))};return(0,l.useEffect)(()=>{v()},[]),(0,u.jsxs)(a,{children:[(0,u.jsx)(r,{title:`Globalization & IP`}),(0,u.jsxs)(`div`,{className:`max-w-6xl mx-auto space-y-6`,children:[(0,u.jsx)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-2`,children:(0,u.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,u.jsx)(`div`,{className:`p-2 bg-primary/10 rounded-lg shrink-0`,children:(0,u.jsx)(o,{className:`w-8 h-8 text-primary`})}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`h2`,{className:`text-2xl font-bold tracking-tight`,children:`Geo-Records & IP Manager`}),(0,u.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Manage IP databases and populate geographical records.`})]})]})}),(0,u.jsx)(`div`,{className:`w-full border-b border-border/60 overflow-x-auto no-scrollbar bg-card rounded-t-xl px-2 pt-2`,children:(0,u.jsxs)(`div`,{className:`flex w-max min-w-full space-x-6 px-4`,children:[(0,u.jsx)(`button`,{onClick:()=>p(`world_records`),className:`py-3 px-2 text-sm font-bold border-b-2 transition-all ${f===`world_records`?`border-primary text-primary`:`border-transparent text-muted-foreground hover:text-foreground`}`,children:`World Records (CSV)`}),(0,u.jsx)(`button`,{onClick:()=>p(`ip_locator`),className:`py-3 px-2 text-sm font-bold border-b-2 transition-all ${f===`ip_locator`?`border-primary text-primary`:`border-transparent text-muted-foreground hover:text-foreground`}`,children:`IP Locator (BIN)`})]})}),(0,u.jsxs)(`div`,{className:`pt-2`,children:[f===`world_records`&&(0,u.jsx)(c,{csvStatus:t,apiSettings:n,errors:d,countries:m,loadingCountries:g,fetchCountries:v}),f===`ip_locator`&&(0,u.jsx)(s,{databaseStatus:e,apiSettings:n,errors:d})]})]})]})}export{d as default};