"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[558],{29558:(e,t,r)=>{r.r(t),r.d(t,{default:()=>S});var n=r(65043),a=r(46291),i=r(32386),l=r(35475),s=r(44093),o=r(22107),c=r(10202),d=r(28846),h=r(73212),g=r(99032),u=r(96148),p=r(39081),x=r(98662),f=r(33572),m=r(87139);const j=(0,r(77784).A)("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);var y=r(70067),w=r(28646),b=r(74117),_=r(70579);const z=e=>{try{if(/^https?:\/\//i.test(e))return e;if(e.startsWith("/cache")||e.startsWith("/uploads")||e.startsWith("/api/")){let n="";try{const e="http://127.0.0.1:8080".trim();e&&(n=new URL(e,"undefined"!==typeof window?window.location.origin:"http://localhost:3000").origin)}catch(t){}if(!n)try{n=new URL(a.API_URL,"undefined"!==typeof window?window.location.origin:"http://localhost:3000").origin}catch(r){}return new URL(e,n||("undefined"!==typeof window?window.location.origin:"http://localhost:3000")).toString()}return e}catch(n){return e}},S=e=>{let{zoneramaUrl:t}=e;const{t:r}=(0,b.Bd)(),[a,S]=(0,n.useState)([]),[v,U]=(0,n.useState)(!0),[k,A]=(0,n.useState)(null),E=(0,s.dU)("white","gray.800"),D=(0,s.dU)("gray.800","gray.100"),R=(0,s.dU)("gray.600","gray.300"),T=(0,s.dU)("blue.50","blue.900"),W=(0,s.dU)("blue.200","blue.700"),C=(0,s.dU)("blue.700","blue.200");return(0,n.useEffect)(()=>{(async()=>{U(!0);try{const[t,r]=await Promise.allSettled([fetch(z("/cache/prefetch/zonerama_profile.json"),{cache:"no-cache"}),fetch(z("/cache/prefetch/zonerama_albums.json"),{cache:"no-cache"})]);let n=[];if("fulfilled"===t.status&&t.value.ok){const e=await t.value.json();e&&e.input_link&&A(e.input_link),n=[...e.albums||[]]}if("fulfilled"===r.status&&r.value.ok){const e=await r.value.json(),t=(Array.isArray(e)?e:[]).filter(e=>e.id&&e.title&&!n.some(t=>t.id===e.id));n=[...n,...t]}if(!n||0===n.length)try{const e=await(0,i.Gz)();if(Array.isArray(e)&&e.length>0){const t={};e.forEach(e=>{const r=String(e.album_id||"unknown");(t[r]=t[r]||[]).push(e)});const r=Object.entries(t).map(e=>{let[t,r]=e;return{id:t,title:"Album",url:r[0].page_url||"#",date:"",photos_count:r.length,photos:r.slice(0,12).map(e=>({id:String(e.id||""),page_url:String(e.page_url||""),image_1500:String(e.src||e.local||"")}))}});n=r}}catch(e){}n.sort((e,t)=>{const r=e=>{if(!e)return new Date(0);const t=e.split(/[.\s]+/).filter(Boolean);if(3===t.length){const[e,r,n]=t;return new Date("".concat(n,"-").concat(r.padStart(2,"0"),"-").concat(e.padStart(2,"0")))}return new Date(e)};return r(t.date).getTime()-r(e.date).getTime()});const a=n.slice(0,3);S(a)}catch(t){console.error("Error loading albums:",t)}finally{U(!1)}})()},[]),v?(0,_.jsx)(o.a,{py:12,children:(0,_.jsxs)(c.T,{spacing:6,align:"stretch",children:[(0,_.jsx)(d.D,{size:"xl",children:"Galerie"}),(0,_.jsx)(h.r,{columns:{base:1,md:2,lg:3},spacing:6,children:[1,2,3].map(e=>(0,_.jsx)(g.E,{height:"300px",borderRadius:"lg"},e))})]})}):0===a.length?null:(0,_.jsx)(o.a,{py:12,children:(0,_.jsxs)(c.T,{spacing:6,align:"stretch",children:[(0,_.jsxs)(u.z,{justify:"space-between",align:"center",flexWrap:"wrap",children:[(0,_.jsxs)(c.T,{align:"start",spacing:1,children:[(0,_.jsx)(d.D,{size:"xl",color:D,id:"home-gallery-heading",children:r("homepage.gallery")}),(0,_.jsx)(p.E,{color:R,fontSize:"sm",children:r("gallery.latest_albums")})]}),(0,_.jsx)(x.$,{as:l.N_,to:"/galerie",rightIcon:(0,_.jsx)(j,{size:18}),colorScheme:"blue",variant:"outline",size:"md",children:r("nav.view_all")})]}),(0,_.jsx)(o.a,{bg:T,borderWidth:"1px",borderColor:W,borderRadius:"md",px:4,py:2,children:(0,_.jsxs)(p.E,{fontSize:"xs",color:C,children:["\xa9 Fotografie z"," ",(0,_.jsx)(p.E,{as:"a",href:t||k||"https://zonerama.com",target:"_blank",rel:"noopener noreferrer",fontWeight:"600",color:"blue.600",_hover:{textDecoration:"underline"},children:"Zonerama"})]})}),(0,_.jsx)(h.r,{columns:{base:1,md:2,lg:3},spacing:6,children:a.map(e=>{const t=e.photos&&e.photos.length>0?e.photos[0]:null;return(0,_.jsxs)(o.a,{as:l.N_,to:"/galerie/album/".concat(e.id),className:"card",bg:E,overflow:"hidden",transition:"all 0.3s",borderWidth:"1px",borderColor:(0,s.dU)("gray.200","gray.700"),_hover:{transform:"translateY(-8px)",boxShadow:"2xl",borderColor:(0,s.dU)("gray.300","gray.600")},cursor:"pointer",children:[t?(0,_.jsx)(f._,{src:t.image_1500,alt:e.title,w:"100%",h:"200px",objectFit:"cover",loading:"lazy",decoding:"async"}):(0,_.jsx)(o.a,{w:"100%",h:"200px",bg:"gray.200",display:"flex",alignItems:"center",justifyContent:"center",children:(0,_.jsx)(y.A,{size:48,color:"gray"})}),(0,_.jsxs)(c.T,{align:"stretch",p:4,spacing:2,children:[(0,_.jsx)(d.D,{size:"sm",color:D,noOfLines:2,minH:"40px",children:e.title}),(0,_.jsxs)(c.T,{spacing:2,fontSize:"xs",color:R,align:"stretch",children:[e.date&&(0,_.jsxs)(u.z,{spacing:1,children:[(0,_.jsx)(w.A,{size:14}),(0,_.jsx)(p.E,{children:e.date})]}),(0,_.jsxs)(u.z,{spacing:1,children:[(0,_.jsx)(y.A,{size:14}),(0,_.jsxs)(p.E,{children:[e.photos_count," foto"]})]})]}),void 0!==e.views_count&&e.views_count>0&&(0,_.jsxs)(m.E,{colorScheme:"purple",fontSize:"2xs",alignSelf:"flex-start",children:[e.views_count," zhl\xe9dnut\xed"]})]})]},e.id)})}),(0,_.jsx)(o.a,{textAlign:"center",pt:4,children:(0,_.jsx)(x.$,{as:l.N_,to:"/galerie",rightIcon:(0,_.jsx)(j,{size:18}),colorScheme:"blue",size:"lg",children:r("gallery.view_all_albums")})})]})})}}}]); //# sourceMappingURL=558.0464ebe3.chunk.js.map