1import{e as j,c as y,b as w,u as N,r as h,a1 as k,j as e,P as _,C}from"./index-D1aKNduO.js";import{P as T}from"./PageBreadCrumb-BHH2LLyg.js";import{B as $}from"./Button-cszLhf2L.js";import{u as A}from"./useCountryArchives-C0aqYhAb.js";import{L}from"./LocalizedName-uEN0nblR.js";import{S as R}from"./bell_with_checkmark-IYIrxCLi.js";import{T as S,a as B,b as E,c as x,d as I}from"./index-mkL64Lnu.js";import"./firebase-DGovvYsO.js";import"./buttonStyles-B3V8uqct.js";import"./ArchiveService-u6WPu0tO.js";const P=C.reduce((t,i)=>({...t,[i.isoCode3]:{...i,imageUrl:`/images/country/${i.isoCode2}.jpg`}}),{}),G=()=>{const{countryCode:t}=j(),i=y(),a=t?P[t.toUpperCase()]:null,{firestoreUser:n}=w(),{t:s}=N();h.useEffect(()=>{a&&k("view_country_archives",{country:a.isoCode3})},[a]);const{archives:u,loading:p}=A(t),[d,g]=h.useState(""),m=h.useMemo(()=>Array.from(new Set([...n?.memberOf??[],...n?.followedRepositories??[]])),[n?.memberOf,n?.followedRepositories]),b=h.useMemo(()=>u.filter(l=>{const o=d.toLowerCase();return l.name.toLowerCase().includes(o)||(l.city?.toLowerCase()||"").includes(o)}).sort((l,o)=>{const f=m.includes(l.id),v=m.includes(o.id);return f&&!v?-1:!f&&v?1:l.name.localeCompare(o.name)}),[u,d,m]);if(!a)return e.jsx("div",{className:"flex h-screen items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"mb-2 text-2xl font-bold text-black dark:text-white",children:s("archives.country_not_found")}),e.jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-400",children:s("archives.country_not_found_message")}),e.jsx($,{onClick:()=>i("/archives"),children:s("archives.return_to_archives")})]})});const c=s(`countries.${a.name}`,a.name);return e.jsxs(e.Fragment,{children:[e.jsx(_,{title:`Archives - ${c}`,description:`Browse genealogical archives and repositories in ${c}`}),e.jsx(T,{pageTitle:c,breadcrumbs:[{label:s("archives.archives"),path:"/archives"}]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 pt-6 pb-2.5 shadow-default dark:border-gray-800 dark:bg-white/[0.03] dark:bg-boxdark sm:px-7.5 xl:pb-1",children:[e.jsxs("div",{className:"mb-6 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-800 dark:text-white/90 ",children:s("archives.archives_in_country",{countryName:c})}),e.jsx("div",{className:"flex items-center space-x-3",children:e.jsx("img",{src:`/images/flags/${a.isoCode3}.svg`,alt:`${c} flag`,className:"h-8 w-8 rounded-full"})})]}),e.jsx("div",{className:"mb-4.5",children:e.jsx("div",{className:"relative",children:e.jsx("input",{type:"text",placeholder:s("archives.search_archives_by_name_or_location"),value:d,onChange:r=>g(r.target.value),className:"w-full rounded-lg border border-gray-300 bg-transparent py-4 pl-6 pr-10 outline-none focus:border-primary focus-visible:shadow-none dark:border-gray-700 dark:bg-gray-900 dark:text-white/90"})})}),p?e.jsx("div",{className:"flex h-60 items-center justify-center",children:e.jsx("div",{className:"h-10 w-10 animate-spin rounded-full border-4 border-solid border-primary border-t-transparent"})}):b.length===0?e.jsx("div",{className:"flex h-40 items-center justify-center",children:e.jsx("p",{className:"text-lg text-black dark:text-white",children:s(d?"archives.no_archives_found_matching_your_search":"archives.no_archives_available")})}):e.jsx("div",{className:"max-w-full overflow-x-auto",children:e.jsxs(S,{children:[e.jsx(B,{children:e.jsxs(E,{children:[e.jsx(x,{className:"min-w-[220px] py-4 px-4 font-medium text-black dark:text-white xl:pl-11",children:s("archives.name")}),e.jsx(x,{className:"min-w-[120px] py-4 px-4 font-medium text-black dark:text-white",children:s("archives.city")})]})}),e.jsx(I,{children:b.map(r=>e.jsxs("tr",{onClick:()=>i(`/archives/${t}/${r.id}`),className:"border-b border-gray-200 dark:border-gray-700 last:border-0 hover:bg-gray-50 dark:hover:bg-gray-800/50 cursor-pointer transition-colors",children:[e.jsx(x,{className:"pl-9 xl:pl-11 py-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h5",{className:"font-medium text-black dark:text-white break-words",children:e.jsx(L,{nameLocale:r.nameLocale,fallback:r.
1name})}),m.includes(r.id)&&e.jsx("div",{title:s("archives.subscribed"),children:e.jsx(R,{className:"w-4 h-4 text-brand-500"})})]})}),e.jsx(x,{className:"py-4",children:e.jsx("p",{className:"text-black dark:text-white",children:r.city||"N/A"})})]},r.id))})]})})]})]})};export{G as default};
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.