(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931],{90417:function(e,t,a){Promise.resolve().then(a.bind(a,50254))},68e3:function(e,t,a){"use strict";function r(e,t){return"vibrant"===e?"dark"===t?{water:"rgba(20, 170, 255, 0.85)",waterOutline:"rgba(20, 130, 255, 0.9)",land:"rgba(20, 20, 30, 0.95)",parks:"rgba(10, 250, 150, 0.75)",roads:"rgba(255, 100, 180, 0.8)",minorRoads:"rgba(255, 180, 200, 0.7)",buildings:"rgba(200, 190, 180, 0.7)",labels:"#FF55FF",borders:"rgba(186, 85, 211, 0.8)",countries:"rgba(65, 80, 115, 0.85)"}:{water:"rgba(30, 195, 255, 0.8)",waterOutline:"rgba(20, 150, 255, 0.9)",land:"rgba(255, 250, 245, 0.9)",parks:"rgba(60, 215, 65, 0.75)",roads:"rgba(255, 105, 75, 0.8)",minorRoads:"rgba(255, 145, 110, 0.7)",buildings:"rgba(245, 190, 130, 0.7)",labels:"#4B0082",borders:"rgba(145, 70, 235, 0.7)",countries:"rgba(250, 240, 210, 0.85)"}:"pastel"===e?"dark"===t?{water:"rgba(120, 155, 185, 0.75)",waterOutline:"rgba(125, 160, 180, 0.6)",land:"rgba(45, 45, 60, 0.85)",parks:"rgba(95, 150, 95, 0.65)",roads:"rgba(155, 145, 155, 0.7)",minorRoads:"rgba(155, 155, 160, 0.6)",buildings:"rgba(125, 125, 135, 0.65)",labels:"#E0E0E0",borders:"rgba(135, 115, 115, 0.65)",countries:"rgba(70, 80, 95, 0.8)"}:{water:"rgba(170, 215, 230, 0.75)",waterOutline:"rgba(165, 210, 225, 0.65)",land:"rgba(252, 248, 240, 0.85)",parks:"rgba(165, 230, 165, 0.65)",roads:"rgba(245, 200, 195, 0.7)",minorRoads:"rgba(250, 225, 220, 0.65)",buildings:"rgba(220, 215, 210, 0.65)",labels:"#696969",borders:"rgba(195, 165, 155, 0.65)",countries:"rgba(235, 230, 220, 0.8)"}:"natural"===e?"dark"===t?{water:"rgba(75, 135, 180, 0.75)",waterOutline:"rgba(70, 120, 170, 0.8)",land:"rgba(40, 45, 50, 0.9)",parks:"rgba(65, 120, 70, 0.7)",roads:"rgba(170, 150, 130, 0.7)",minorRoads:"rgba(150, 140, 130, 0.6)",buildings:"rgba(100, 100, 105, 0.7)",labels:"#D7CCC8",borders:"rgba(130, 120, 110, 0.7)",countries:"rgba(75, 85, 90, 0.85)"}:{water:"rgba(100, 195, 225, 0.75)",waterOutline:"rgba(85, 175, 215, 0.7)",land:"rgba(245, 240, 230, 0.9)",parks:"rgba(110, 180, 100, 0.7)",roads:"rgba(225, 175, 135, 0.7)",minorRoads:"rgba(230, 190, 160, 0.65)",buildings:"rgba(200, 190, 180, 0.7)",labels:"#5D4037",borders:"rgba(160, 145, 130, 0.7)",countries:"rgba(230, 225, 210, 0.8)"}:"dark"===t?{water:"rgba(55, 135, 205, 0.8)",waterOutline:"rgba(75, 115, 195, 0.9)",land:"rgba(35, 40, 45, 0.9)",parks:"rgba(45, 150, 50, 0.75)",roads:"rgba(255, 170, 80, 0.8)",minorRoads:"rgba(235, 185, 185, 0.65)",buildings:"rgba(115, 115, 120, 0.75)",labels:"#F0F0F0",borders:"rgba(180, 180, 185, 0.8)",countries:"rgba(90, 115, 130, 0.85)"}:{water:"rgba(86, 180, 233, 0.8)",waterOutline:"rgba(65, 155, 225, 0.7)",land:"rgba(248, 245, 240, 0.9)",parks:"rgba(65, 185, 120, 0.7)",roads:"rgba(245, 155, 85, 0.75)",minorRoads:"rgba(255, 175, 145, 0.65)",buildings:"rgba(185, 180, 175, 0.7)",labels:"#333333",borders:"rgba(135, 135, 135, 0.75)",countries:"rgba(225, 215, 195, 0.8)"}}a.d(t,{KP:function(){return r}})},28634:function(e,t,a){"use strict";a.d(t,{H:function(){return h},a:function(){return x}});var r=a(57437),s=a(2265),n=a(3141),l=a(57685),i=a.n(l),o=a(50309),d=a.n(o),c=a(6021);let u="auth_data",g="/api/auth/user",m=(0,s.createContext)({isAuthenticated:!1,isVerifying:!0,username:null,firstName:null,email:null,login:()=>{},logout:()=>{},refreshAuth:async()=>{}}),x=()=>(0,s.useContext)(m),h=e=>{let{children:t}=e,[a,l]=(0,s.useState)(!1),[o,x]=(0,s.useState)(!0),[h,b]=(0,s.useState)(null),[y,p]=(0,s.useState)(null),[f,w]=(0,s.useState)(null),v=(0,s.useRef)(!1),[j]=(0,s.useState)(!1),k=(0,s.useCallback)(e=>{if(!e){(0,c.safeSetItem)(u,""),(0,c.writeToSWRCache)(g,null);return}let t={userData:e,expiresAt:Date.now()+864e5};(0,c.safeSetItem)(u,JSON.stringify(t)),(0,c.writeToSWRCache)(g,e),console.debug("Auth data cached successfully")},[]),N=(0,s.useCallback)(()=>{try{let e=(0,c.safeGetItem)(u);if(!e)return null;let t=JSON.parse(e);if(t.expiresAt&&t.expiresAt0&&void 0!==arguments[0]&&arguments[0];if(j){l(!1),b(null),p(null),w(null),x(!1);return}if(!v.current){v.current=!0,x(!0);try{console.log("Checking authentication status...");let t=null;if(!e&&(t=N())){let e=t.username||"",a=t.first_name?i()(d()(t.first_name)):null,r=t.email||null;console.log("✅ Using cached auth data for:",e),b(e),p(a),w(r),l(!0),x(!1),v.current=!1;return}let a=await (0,n.WX)();if(a){let e=a.username||"",r=a.first_name?i()(d()(a.first_name)):null,s=a.email||null;t={username:e,first_name:r,email:s},b(e),p(r),w(s),l(!0),k(t),console.log("✅ User authenticated via API:",e)}else k(null),l(!1),b(null),p(null),w(null)}catch(e){console.error("❌ Token verification failed:",e),l(!1),b(null),p(null),w(null),k(null)}finally{x(!1),v.current=!1}}},[j,N,k]),E=(0,s.useCallback)(async()=>{await C(!0)},[C]);(0,s.useEffect)(()=>{C()},[C]);let S=(0,s.useCallback)(()=>{console.log("Starting logout process"),k(null),window.location.href="/logout"},[k]),A=(0,s.useCallback)((e,t,a)=>{b(e),p(i()(d()(t))),w(a),l(!0),k({username:e,first_name:t,email:a})},[k]);return(0,r.jsxs)(m.Provider,{value:{isAuthenticated:a,isVerifying:o,username:h,firstName:y,email:f,login:A,logout:S,refreshAuth:E},children:[!o&&t," "]})}},50254:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return ee}});var r=a(57437),s=a(2265),n=a(75183),l=a(27648),i=a(28634),o=a(38704),d=a(3289),c=a(46215),u=a(6275);function g(e){return void 0===e?0:"string"==typeof e?parseFloat(e):e}var m=a(30166);let x=new Map;function h(e){if(!e)return null;for(let t of["image","country_image","city_image","image_url","thumbnail","photo"]){let a=e[t];if("string"==typeof a&&""!==a.trim())return a}return null}var b=a(80121),y=a(23818),p=a(44986),f=a(52348),w=a(66314),v=a(99342),j=a(98012),k=a(60504),N=e=>{let{results:t,isVisible:a,onResultClick:s,onClose:n}=e;if(!a||0===t.length)return null;let l=t.filter(e=>"country"===e.destinationType),i=t.filter(e=>"city"===e.destinationType),o=(e,t)=>{let a="country"===e.destinationType;return(0,r.jsxs)("button",{className:"flex items-center w-full px-3 py-2 text-left text-sm transition-colors hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md",onClick:()=>s(e),"data-testid":"search-result-".concat(e.destinationType,"-").concat(t),children:[a?(0,r.jsx)(j.Z,{className:"mr-2 h-4 w-4 flex-shrink-0 text-blue-600 dark:text-blue-400"}):(0,r.jsx)(k.Z,{className:"mr-2 h-4 w-4 flex-shrink-0 text-emerald-600 dark:text-emerald-400"}),(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("span",{className:"font-medium",children:e.name}),(0,r.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:a?"string"==typeof e.continent?e.continent:"string"==typeof e.region?e.region:"Country":"string"==typeof e.country_name?e.country_name:"City"})]})]},"".concat(e.destinationType,"-").concat(e.id,"-").concat(t))};return(0,r.jsxs)("div",{className:"absolute top-full left-0 mt-1 z-50 w-full bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 py-2 max-h-80 overflow-y-auto animate-in fade-in-50 slide-in-from-top-5 duration-200",children:[(0,r.jsxs)("div",{className:"sticky top-0 px-3 pb-2 flex justify-between items-center bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:[(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:[t.length," ",1===t.length?"result":"results"," found"]}),(0,r.jsx)("button",{onClick:n,className:"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200","aria-label":"Close search results",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),l.length>0&&(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsxs)("div",{className:"px-3 py-1 text-xs font-semibold text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-750",children:["Countries (",l.length,")"]}),(0,r.jsxs)("div",{className:"mt-1 space-y-1 px-1",children:[l.slice(0,10).map((e,t)=>o(e,t)),l.length>10&&(0,r.jsxs)("div",{className:"px-3 py-1 text-xs text-gray-500 dark:text-gray-400",children:["+ ",l.length-10," more countries..."]})]})]}),i.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"px-3 py-1 text-xs font-semibold text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-750",children:["Cities (",i.length,")"]}),(0,r.jsxs)("div",{className:"mt-1 space-y-1 px-1",children:[i.slice(0,10).map((e,t)=>o(e,t)),i.length>10&&(0,r.jsxs)("div",{className:"px-3 py-1 text-xs text-gray-500 dark:text-gray-400",children:["+ ",i.length-10," more cities..."]})]})]})]})},C=(0,s.memo)(e=>{let{activeFilter:t,setActiveFilter:a,searchQuery:n,setSearchQuery:l,onResetView:i,showLegend:o,setShowLegend:d,colorVariation:c="default",onVariationChange:u,mapInstance:g,initialMapCoordinates:m={lng:0,lat:20,zoom:1.5},filteredDestinations:x=[],onDestinationSelect:h}=e,[j,k]=(0,s.useState)(!1),[C,E]=(0,s.useState)(!1),[S,A]=(0,s.useState)(!1),[D,R]=(0,s.useState)(!1),[M,Z]=(0,s.useState)(!1);(0,s.useEffect)(()=>{let e=()=>{E(window.innerWidth<640)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),(0,s.useEffect)(()=>{""!==n.trim()?Z(!0):Z(!1)},[n]);let _=(0,s.useCallback)(e=>{l(e.target.value)},[l]),F=(0,s.useCallback)(e=>{"Escape"===e.key&&(l(""),e.currentTarget.blur(),Z(!1))},[l]),L=(0,s.useCallback)(()=>{l(""),Z(!1)},[l]),P=(0,s.useCallback)(e=>{h&&h(e),Z(!1)},[h]),T=(0,s.useCallback)(()=>{A(e=>!e),D&&R(!1)},[D]),U=(0,s.useCallback)(()=>{R(e=>!e),S&&A(!1)},[S]),Q=(0,s.useCallback)(()=>{console.debug("[MapControls] Resetting map view"),i&&i(),g&&(console.debug("[MapControls] Directly resetting map via mapInstance"),g.flyTo({center:[m.lng,m.lat],zoom:m.zoom,duration:1500,essential:!0})),l(""),Z(!1)},[i,g,m,l]);return(0,s.useEffect)(()=>{let e=e=>{(S||D)&&!e.target.closest("[data-tooltip-trigger]")&&(A(!1),R(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[S,D]),(0,r.jsx)("div",{className:"fixed top-4 left-0 right-0 mx-auto px-4 z-10 max-w-5xl","data-testid":"map-controls",children:(0,r.jsx)("div",{className:"w-full flex flex-col sm:flex-row gap-2 sm:gap-3 transition-all duration-300",children:(0,r.jsxs)("div",{className:"relative w-full bg-white/95 dark:bg-gray-800/95 backdrop-blur-sm rounded-xl shadow-xl border border-gray-200 dark:border-gray-700 flex flex-col sm:flex-row p-2 gap-2",children:[C?(0,r.jsxs)("div",{className:"relative","data-tooltip-trigger":"filter",children:[(0,r.jsxs)("button",{onClick:T,className:"h-10 w-10 flex items-center justify-center bg-gray-100 dark:bg-gray-700 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors","aria-label":"Filter options","data-testid":"filter-button",children:[(0,r.jsx)(b.Z,{className:"h-5 w-5 text-gray-700 dark:text-gray-200"}),"all"!==t&&(0,r.jsx)("span",{className:"absolute -top-1 -right-1 h-4 w-4 bg-blue-500 rounded-full border-2 border-white dark:border-gray-800"})]}),S&&(0,r.jsx)("div",{className:"absolute top-12 left-0 bg-white dark:bg-gray-800 rounded-lg shadow-lg p-2 z-20 min-w-40 border border-gray-200 dark:border-gray-700 animate-in fade-in slide-in-from-top duration-150",children:(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)("button",{onClick:()=>{a("all"),A(!1)},className:"px-3 py-2 text-sm font-medium rounded-md transition-colors text-left ".concat("all"===t?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600"),"aria-label":"Show all destinations","data-testid":"filter-all",children:"All"}),(0,r.jsx)("button",{onClick:()=>{a("country"),A(!1)},className:"px-3 py-2 text-sm font-medium rounded-md transition-colors text-left ".concat("country"===t?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600"),"aria-label":"Show only countries","data-testid":"filter-country",children:"Countries"}),(0,r.jsx)("button",{onClick:()=>{a("city"),A(!1)},className:"px-3 py-2 text-sm font-medium rounded-md transition-colors text-left ".concat("city"===t?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600"),"aria-label":"Show only cities","data-testid":"filter-city",children:"Cities"})]})})]}):(0,r.jsxs)("div",{className:"bg-gray-100 dark:bg-gray-700 rounded-lg p-1 flex space-x-1",children:[(0,r.jsx)("button",{onClick:()=>a("all"),className:"px-3 py-2 text-sm font-medium rounded-md transition-all duration-200 ".concat("all"===t?"bg-blue-600 text-white shadow-md":"text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600"),"aria-label":"Show all destinations","data-testid":"filter-all",children:"All"}),(0,r.jsx)("button",{onClick:()=>a("country"),className:"px-3 py-2 text-sm font-medium rounded-md transition-all duration-200 ".concat("country"===t?"bg-blue-600 text-white shadow-md":"text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600"),"aria-label":"Show only countries","data-testid":"filter-country",children:"Countries"}),(0,r.jsx)("button",{onClick:()=>a("city"),className:"px-3 py-2 text-sm font-medium rounded-md transition-all duration-200 ".concat("city"===t?"bg-blue-600 text-white shadow-md":"text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600"),"aria-label":"Show only cities","data-testid":"filter-city",children:"Cities"})]}),(0,r.jsxs)("div",{className:"relative flex-grow transition-all duration-300 ".concat(j?"flex-grow":""),children:[(0,r.jsxs)("div",{className:"relative h-10 flex items-center bg-gray-100 dark:bg-gray-700 rounded-lg transition-all ".concat(j?"ring-2 ring-blue-500":""),children:[(0,r.jsx)(y.Z,{className:"absolute left-3 h-4 w-4 transition-colors ".concat(j?"text-blue-500":"text-gray-400"),"aria-hidden":"true"}),(0,r.jsx)("input",{type:"text",placeholder:"Search destinations...",value:n,onChange:_,onKeyDown:F,onFocus:()=>k(!0),onBlur:()=>k(!1),className:"w-full h-full bg-transparent text-gray-700 dark:text-gray-200 rounded-md pl-9 pr-9 py-2 text-sm focus:outline-none","aria-label":"Search destinations","data-testid":"search-input"}),n&&(0,r.jsx)("button",{onClick:L,className:"absolute right-3 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 transition-colors","aria-label":"Clear search",children:(0,r.jsx)(p.Z,{className:"h-4 w-4"})})]}),(0,r.jsx)("div",{className:"relative w-full",children:(0,r.jsx)(N,{results:x,isVisible:M&&x.length>0,onResultClick:P,onClose:()=>Z(!1)})})]}),(0,r.jsxs)("div",{className:"flex space-x-2",children:[(0,r.jsxs)("div",{className:"relative","data-tooltip-trigger":"style",children:[(0,r.jsxs)("button",{onClick:U,className:"h-10 px-3 py-1 text-sm font-medium rounded-lg transition-colors flex items-center justify-center ".concat("default"!==c?"bg-blue-600 text-white shadow-md":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600"),"aria-label":"Map style options","data-testid":"style-button",children:[(0,r.jsx)(f.Z,{className:"h-4 w-4 mr-1.5","aria-hidden":"true"}),(0,r.jsx)("span",{className:C?"hidden":"inline",children:"Style"})]}),D&&(0,r.jsx)("div",{className:"absolute top-12 right-0 bg-white dark:bg-gray-800 rounded-lg shadow-lg p-2 z-20 min-w-40 border border-gray-200 dark:border-gray-700 animate-in fade-in slide-in-from-top duration-150",children:(0,r.jsx)("div",{className:"flex flex-col gap-1",children:["natural","default","vibrant","pastel"].map(e=>(0,r.jsxs)("button",{onClick:()=>{null==u||u(e),R(!1)},className:"px-3 py-2 text-sm font-medium rounded-md transition-colors text-left flex items-center ".concat(c===e?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600"),"aria-label":"".concat(e.charAt(0).toUpperCase()+e.slice(1)," map style"),children:[(0,r.jsx)("span",{className:"h-3 w-3 rounded-full mr-2 ".concat(function(e){switch(e){case"natural":return"bg-emerald-500";case"vibrant":return"bg-purple-500";case"pastel":return"bg-pink-300";default:return"bg-blue-500"}}(e))}),e.charAt(0).toUpperCase()+e.slice(1)]},e))})})]}),(0,r.jsxs)("button",{onClick:Q,className:"h-10 px-3 py-1 text-sm font-medium rounded-lg bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors flex items-center justify-center relative overflow-hidden group","aria-label":"Reset map view","data-testid":"reset-view",children:[(0,r.jsx)("span",{className:"absolute inset-0 bg-blue-500 opacity-0 group-active:opacity-10 transition-opacity"}),(0,r.jsx)(w.Z,{className:"h-4 w-4 mr-1.5 group-active:animate-spin","aria-hidden":"true"}),(0,r.jsx)("span",{className:C?"hidden":"inline",children:"Reset"})]}),(0,r.jsxs)("button",{onClick:()=>d(e=>!e),className:"h-10 px-3 py-1 text-sm font-medium rounded-lg transition-all duration-200 flex items-center justify-center ".concat(o?"bg-blue-600 text-white shadow-md":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600"),"aria-label":o?"Hide legend":"Show legend","data-testid":"toggle-legend",children:[(0,r.jsx)(v.Z,{className:"h-4 w-4 mr-1.5","aria-hidden":"true"}),(0,r.jsx)("span",{className:C?"hidden":"inline",children:"Legend"})]})]})]})})})}),E=a(33145),S=a(71791),A=a(25824),D=a(26563),R=a(81475),M=a(16994),Z=a(76848);let _={country:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAGCAYAAAD68A/GAAAA/klEQVR42mNgYGBgZEACjHCKEcZgYIRxGGGYEchihDCZoRBEMcEwCxCzQjEbELMDMQcQcwIxFxBzAzEPEPMCMR8Q8wOxABALArEQEAsDsQgQiwKxGBCLA7EEEEsCsRQQSwOxDBDLArEcEMsDsQIQKwKxEhArA7EKEKsCsRoQqwOxBhBrArEWEGsDsQ4Q6wKxHhDrA7EBEBsCsREQGwOxCRCbArEZEJsDsQUQWwKxFRBbA7ENENsCsR0Q2wOxAxA7ArETEDsDsQsQuwKxGxC7A7EHEHsCsRcQewOxDxD7ArEfEPsDcQAQBwJxEBAHA3EIEIcCcRgQhwNxBBBHAnEUAAA2HlZ7dyaYMQAAAABJRU5ErkJggg==",city:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAGCAYAAAD68A/GAAAApElEQVR42mNggAJGKGZigmImJjgDzgdiZiZmJmYWZhYWFhYWVlZWVlY2NjY2dnZ2dg4ODg5OTk5OLi4uLm5ubm4eHh4eXl5eXj4+Pj5+fn5+AQEBAUFBQUEhISEhYWFhYRERERFRUVFRMTExMXFxcXEJCQkJSUlJSSkpKSlpaWlpGRkZGVlZWVk5OTk5eXl5eQUFBQVFRUVFJSUlJWVlZWUVFRUVAAA2HlZ7dyaYMQAAAABJRU5ErkJggg=="};var F=(0,s.memo)(e=>{let{destination:t,onClose:a}=e,[n,l]=(0,s.useState)(!1);if(!t)return(0,r.jsx)("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg w-96 border border-gray-200 dark:border-gray-700 p-4 text-center","data-testid":"empty-destination-card",children:"No destination selected"});let i="country"===t.destinationType,o="city"===t.destinationType,d=["image","country_image","city_image","image_url","thumbnail","photo"].reduce((e,a)=>{if(e)return e;let r=t[a];return"string"==typeof r&&""!==r.trim()?r:null},null),c=_[t.destinationType]||_.country;return(0,r.jsxs)("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg w-96 border border-gray-200 dark:border-gray-700 transition-all duration-300 ease-in-out overflow-hidden","data-testid":"destination-card",children:[(0,r.jsxs)("div",{className:"relative h-48 w-full overflow-hidden bg-gray-100 dark:bg-gray-700",children:[d&&!n?(0,r.jsx)(E.default,{src:d,alt:"".concat(t.name," landscape"),fill:!0,sizes:"384px",priority:!0,placeholder:"blur",blurDataURL:c,className:"object-cover",onError:()=>l(!0)}):(0,r.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-200 dark:bg-gray-600",children:(0,r.jsxs)("div",{className:"flex flex-col items-center text-gray-500 dark:text-gray-400",children:[(0,r.jsx)(S.Z,{className:"w-10 h-10 mb-2"}),(0,r.jsx)("span",{className:"text-xs",children:"No image available"})]})}),(0,r.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-20 bg-gradient-to-t from-black/60 to-transparent"}),(0,r.jsx)("button",{onClick:a,className:"absolute top-2 right-2 p-1.5 rounded-full bg-black/30 text-white hover:bg-black/50 transition-colors","aria-label":"Close destination details","data-testid":"close-destination-card",children:(0,r.jsx)(p.Z,{className:"h-4 w-4"})}),(0,r.jsxs)("div",{className:"absolute bottom-3 left-3 flex items-center",children:[(0,r.jsx)("div",{className:"flex items-center justify-center h-8 w-8 rounded-full mr-2 ".concat(i?"bg-blue-500 text-white":"bg-red-500 text-white"),children:i?(0,r.jsx)(A.Z,{className:"h-4 w-4"}):(0,r.jsx)(j.Z,{className:"h-4 w-4"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-bold text-lg text-white",children:t.name}),(0,r.jsx)("p",{className:"text-xs font-medium text-gray-200",children:o?t.country_name||"":t.region||""})]})]})]}),(0,r.jsxs)("div",{className:"p-4",children:[(0,r.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300 max-h-32 overflow-y-auto pr-1 scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-gray-600 mb-4",children:t.description?(0,r.jsx)(r.Fragment,{children:t.description}):(0,r.jsx)("p",{className:"text-gray-500 italic",children:o?"".concat(t.name," is a city located in ").concat(t.country_name||"its country","."):"".concat(t.name," is a country waiting to be explored.")})}),(0,r.jsxs)("div",{className:"mt-3 text-sm text-gray-600 dark:text-gray-400 grid grid-cols-2 gap-2 mb-4",children:[void 0!==t.rating&&(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(D.Z,{className:"h-4 w-4 text-yellow-500"}),(0,r.jsx)("span",{className:"font-semibold",children:"Rating:"})," ","number"==typeof t.rating?t.rating:parseFloat(String(t.rating))||0,"★"]}),void 0!==t.recommendedStay&&(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(R.Z,{className:"h-4 w-4 text-blue-500"}),(0,r.jsx)("span",{className:"font-semibold",children:"Stay:"})," ","number"==typeof t.recommendedStay?t.recommendedStay:parseFloat(String(t.recommendedStay))||0," ","days"]}),i&&t.capital&&(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(j.Z,{className:"h-4 w-4 text-red-500"}),(0,r.jsx)("span",{className:"font-semibold",children:"Capital:"})," ",t.capital]}),i&&t.continent&&(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(A.Z,{className:"h-4 w-4 text-green-500"}),(0,r.jsx)("span",{className:"font-semibold",children:"Continent:"})," ",t.continent]}),o&&t.country_name&&(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(A.Z,{className:"h-4 w-4 text-blue-500"}),(0,r.jsx)("span",{className:"font-semibold",children:"Country:"})," ",t.country_name]}),o&&t.population&&(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(M.Z,{className:"h-4 w-4 text-purple-500"}),(0,r.jsx)("span",{className:"font-semibold",children:"Population:"})," ","number"==typeof t.population?t.population.toLocaleString():t.population]}),o&&t.region&&(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(j.Z,{className:"h-4 w-4 text-orange-500"}),(0,r.jsx)("span",{className:"font-semibold",children:"Region:"})," ",t.region]})]}),(0,r.jsxs)("a",{href:"/".concat(i?"countries":"cities","/").concat(t.slug||t.id),className:"mt-4 w-full inline-flex items-center justify-center px-4 py-3 bg-blue-600 text-white font-medium rounded-md hover:bg-blue-700 transition-colors","data-testid":"explore-destination-link",children:["Explore ",t.name,(0,r.jsx)(Z.Z,{className:"h-4 w-4 ml-1"})]})]})]})}),L=a(68e3);function P(e){let{show:t=!0,theme:a="light",colorVariation:s="natural"}=e,n=(0,L.KP)(s,a);return t?(0,r.jsxs)("div",{className:"bg-white dark:bg-gray-800 p-3 rounded-lg shadow-lg text-xs border border-gray-200 dark:border-gray-700","data-testid":"map-legend",children:[(0,r.jsx)("div",{className:"font-medium mb-2 text-gray-800 dark:text-gray-200",children:"Map Legend"}),(0,r.jsxs)("div",{className:"flex items-center mb-1.5",children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full border border-white mr-2",style:{backgroundColor:n.countries}}),(0,r.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:"Country"})]}),(0,r.jsxs)("div",{className:"flex items-center mb-1.5",children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full border border-white mr-2",style:{backgroundColor:"dark"===a?"#F28B82":"#C5221F"}}),(0,r.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:"City"})]}),(0,r.jsxs)("div",{className:"flex items-center mb-1.5",children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full border border-white mr-2",style:{backgroundColor:n.roads}}),(0,r.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:"Major Road"})]}),(0,r.jsxs)("div",{className:"flex items-center mb-1.5",children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full border border-white mr-2",style:{backgroundColor:n.water}}),(0,r.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:"Water"})]}),(0,r.jsxs)("div",{className:"flex items-center mb-1.5",children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full border border-white mr-2",style:{backgroundColor:n.parks}}),(0,r.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:"Parks & Nature"})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full border border-white mr-2",style:{backgroundColor:n.buildings}}),(0,r.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:"Buildings"})]})]}):null}var T=a(53459),U=(0,s.memo)(e=>{let{loading:t,stats:a}=e;return t?(0,r.jsxs)("div",{className:"absolute inset-0 bg-gray-200 dark:bg-gray-800 bg-opacity-75 dark:bg-opacity-75 z-30 flex flex-col items-center justify-center","data-testid":"map-loader",role:"status","aria-live":"polite",children:[(0,r.jsx)(T.Z,{className:"animate-spin h-12 w-12 text-blue-600","aria-hidden":"true"}),(0,r.jsx)("p",{className:"mt-4 text-gray-700 dark:text-gray-200 font-medium",children:"Loading destinations..."}),a&&(0,r.jsx)("div",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:a.message||"Processing ".concat(a.count||0," items")})]}):null}),Q=(0,s.memo)(e=>{let{destination:t,onClose:a}=e;return t?(0,r.jsxs)("div",{className:"fixed inset-x-0 bottom-0 z-30 bg-white dark:bg-gray-800 rounded-t-lg shadow-lg p-4 border-t border-gray-200 dark:border-gray-700 sm:hidden transform transition-transform duration-300 ease-in-out","data-testid":"mobile-destination-view",children:[(0,r.jsx)("button",{onClick:a,className:"absolute top-2 right-2 p-1 rounded-full bg-gray-100 dark:bg-gray-700 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200","aria-label":"Close destination details",children:(0,r.jsx)(p.Z,{className:"h-4 w-4"})}),(0,r.jsxs)("div",{className:"flex items-start mb-2",children:[(0,r.jsx)("div",{className:"p-2 rounded-full mr-3 ".concat("country"===t.destinationType?"bg-blue-100 dark:bg-blue-900 text-blue-600 dark:text-blue-400":"bg-red-100 dark:bg-red-900 text-red-600 dark:text-red-400"),children:(0,r.jsx)(j.Z,{className:"h-5 w-5","aria-hidden":"true"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-bold text-lg text-gray-800 dark:text-gray-100",children:t.name}),(0,r.jsx)("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"city"===t.destinationType?t.country_name:t.region||""})]})]}),t.description&&(0,r.jsx)("div",{className:"mt-3 text-sm text-gray-700 dark:text-gray-300 max-h-20 overflow-y-auto pr-1 scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-gray-600",children:t.description}),(0,r.jsxs)("a",{href:"/".concat("country"===t.destinationType?"countries":"cities","/").concat(t.slug||""),className:"mt-4 w-full inline-flex items-center justify-center px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 transition-colors","aria-label":"Explore ".concat(t.name),children:["Explore ",t.name,(0,r.jsx)(Z.Z,{className:"h-4 w-4 ml-1","aria-hidden":"true"})]})]}):null});let I=(0,m.default)(()=>Promise.all([a.e(3415),a.e(2421)]).then(a.bind(a,99956)),{loadableGenerated:{webpack:()=>[99956]},loading:()=>(0,r.jsx)(U,{loading:!0,stats:{count:0,message:"Loading map..."}}),ssr:!1}),O=(0,m.default)(()=>a.e(6057).then(a.bind(a,56057)),{loadableGenerated:{webpack:()=>[56057]},ssr:!1}),B={lng:0,lat:20,zoom:1.5};var z=(0,s.memo)(e=>{let{debug:t=!1}=e,[a,n]=(0,s.useState)(!1),[l,i]=(0,s.useState)(null),[o,d]=(0,s.useState)(null),[m,b]=(0,s.useState)("all"),[y,p]=(0,s.useState)(""),[f,w]=(0,s.useState)(!0),[v,j]=(0,s.useState)(0),[k,N]=(0,s.useState)(B),[E,S]=(0,s.useState)("default"),[A,D]=(0,s.useState)(!1),{allDestinations:R=[],filteredDestinations:M=[],loading:Z=!1,error:_=null,stats:L={validCountries:0,validCities:0,totalCountries:0,totalCities:0}}=function(e,t){let[a,r]=(0,s.useState)([]),[n,l]=(0,s.useState)(!0),[i,o]=(0,s.useState)(null),[d,m]=(0,s.useState)({totalCountries:0,totalCities:0,validCountries:0,validCities:0}),x=(0,s.useRef)(!1),h=(0,s.useRef)({activeFilter:e,searchQuery:t});x.current&&h.current.activeFilter===e&&h.current.searchQuery===t||(console.debug("[useDestinationData] Hook parameters:",{activeFilter:e,searchQuery:t}),x.current=!0,h.current={activeFilter:e,searchQuery:t}),(0,s.useEffect)(()=>{(async()=>{if(a.length>0){console.debug("[useDestinationData] Data already loaded, skipping fetch");return}console.debug("[useDestinationData] Starting data fetch");try{l(!0),o(null),console.time("fetchDestinations");let[e,t]=await Promise.all([(0,c.fetchCountries)(),(0,u.fetchCities)()]);console.timeEnd("fetchDestinations"),e.length>0&&console.debug("[useDestinationData] Sample country data:",e[0]),t.length>0&&console.debug("[useDestinationData] Sample city data:",t[0]),console.debug("[useDestinationData] Raw data fetched: ".concat(e.length," countries, ").concat(t.length," cities"));let a=e.filter(e=>{let t=g(e.latitude),a=g(e.longitude);return!isNaN(t)&&!isNaN(a)}).map(e=>{let t={...e,destinationType:"country",latitude:g(e.latitude),longitude:g(e.longitude),id:e.id||"country-".concat(Date.now()),name:e.name||"Unknown Country"};return function(e){let t=e.description||e.short_description||"",a=void 0!==e.rating?Number(e.rating):void 0,r=e.recommended_stay_length||e.recommendedStay;console.log("Processing country ".concat(e.name,":"),{hasDescription:!!t,hasRating:void 0!==a,hasRecommendedStay:void 0!==r});let s=[e.image,e.country_image,e.image_url].find(e=>"string"==typeof e&&e.trim().length>0);return{id:e.id||"country-".concat(Date.now()),name:e.name||"Unknown Country",latitude:Number(e.latitude)||0,longitude:Number(e.longitude)||0,slug:e.slug||"",region:e.region||"",country_name:e.country_name||e.name||"",continent:e.continent||"",description:t,recommendedStay:r?Number(r):void 0,capital:e.capital||"",image:s,rating:a,destinationType:"country",iso_code:"string"==typeof e.id?e.id.toUpperCase():String(e.id||"").toUpperCase(),featured:!!e.featured,currency:e.currency||"",currency_name:e.currency_name||"",food:e.food||"",culture:e.culture||"",climate:e.climate||"",travel_seasons:e.travel_seasons||"",population:e.population||""}}(t)}),s=t.filter(e=>{let t=g(e.latitude),a=g(e.longitude);return!isNaN(t)&&!isNaN(a)}).map(e=>{let t={...e,destinationType:"city",latitude:g(e.latitude),longitude:g(e.longitude),id:e.id||"city-".concat(Date.now()),name:e.name||"Unknown City"};return function(e){let t=e.description||e.short_description||"",a=void 0!==e.rating?Number(e.rating):void 0,r=e.recommended_stay_length||e.recommendedStay;console.log("Processing city ".concat(e.name,":"),{hasDescription:!!t,hasRating:void 0!==a,hasRecommendedStay:void 0!==r});let s=[e.image,e.image_url].find(e=>"string"==typeof e&&e.trim().length>0);return{id:e.id||"city-".concat(Date.now()),name:e.name||"Unknown City",latitude:Number(e.latitude)||0,longitude:Number(e.longitude)||0,slug:e.slug||"",country_name:e.country_name||"",description:t,image:s,rating:a,recommendedStay:r?Number(r):void 0,destinationType:"city",region:e.region||"",featured:!!e.featured,population:e.population||""}}(t)});a.length>0&&console.debug("[useDestinationData] Sample processed country:",a[0]),s.length>0&&console.debug("[useDestinationData] Sample processed city:",s[0]),console.log("Raw Countries:",e.map(e=>({name:e.name,latitude:e.latitude,longitude:e.longitude}))),console.log("Raw Cities:",t.map(e=>({name:e.name,latitude:e.latitude,longitude:e.longitude}))),m({totalCountries:e.length,totalCities:t.length,validCountries:a.length,validCities:s.length}),console.debug("[useDestinationData] Processed data: ".concat(a.length," countries and ").concat(s.length," cities with valid coordinates")),r([...a,...s])}catch(t){let e=t instanceof Error?t:Error(String(t));console.error("[useDestinationData] Error fetching destination data:",e),o(e)}finally{l(!1)}})()},[a.length]);let b=(0,s.useMemo)(()=>{if(!a.length)return[];console.debug("[useDestinationData] Filtering destinations with: filter=".concat(e,', search="').concat(t,'"')),console.time("filterDestinations");let r=a.filter(e=>"country"===e.destinationType),s=a.filter(e=>"city"===e.destinationType),n="city"===e?[]:r.filter(e=>""===t||e.name.toLowerCase().includes(t.toLowerCase())||e.region&&e.region.toLowerCase().includes(t.toLowerCase())),l="country"===e?[]:s.filter(e=>""===t||e.name.toLowerCase().includes(t.toLowerCase())||e.country_name&&e.country_name.toLowerCase().includes(t.toLowerCase())),i=[...n,...l].slice(0,500);return console.timeEnd("filterDestinations"),console.debug("[useDestinationData] Filtered to ".concat(i.length," destinations (").concat(n.length," countries, ").concat(l.length," cities)")),i},[a,e,t]),y=(0,s.useMemo)(()=>a.filter(e=>"country"===e.destinationType),[a]),p=(0,s.useMemo)(()=>a.filter(e=>"city"===e.destinationType),[a]);return{allDestinations:a,filteredDestinations:b,loading:n,error:i,stats:d,countries:y,cities:p}}(m,y)||{};(0,s.useEffect)(()=>{M.length&&!Z&&(D(!1),console.debug("[MapboxMap] Starting image preloading for",M.length,"destinations"),(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{priority:a=5,concurrency:r=3}=t;if(!e||0===e.length)return Promise.resolve();let s=performance.now();console.debug("[ImagePreload] Starting to preload images for ".concat(e.length," destinations"));let n=e.slice(0,a),l=e.slice(a),i=[],o=[];n.forEach(e=>{let t=h(e);t&&i.push(t)}),l.forEach(e=>{let t=h(e);t&&o.push(t)});let d=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r;return e.length?new Promise(a=>{let r=0,s=0,n=()=>{if(r>=e.length){s<=0&&a();return}if(s>=t)return;let l=e[r];r++,s++,(function(e){let t=x.get(e);return t&&Date.now()-t.timestamp<864e5?Promise.resolve():new Promise((t,a)=>{let r=new Image;r.onload=()=>{x.set(e,{success:!0,timestamp:Date.now()}),t()},r.onerror=()=>{x.set(e,{success:!1,timestamp:Date.now()}),a(Error("Failed to load image: ".concat(e)))};let s=setTimeout(()=>{a(Error("Image load timeout: ".concat(e)))},1e4);r.onload=()=>{clearTimeout(s),x.set(e,{success:!0,timestamp:Date.now()}),t()},r.onerror=()=>{clearTimeout(s),x.set(e,{success:!1,timestamp:Date.now()}),a(Error("Failed to load image: ".concat(e)))},r.src=e})})(l).catch(()=>{console.debug("[ImagePreload] Failed to preload: ".concat(l))}).finally(()=>{s--,n()}),n()};for(let a=0;a{let e=performance.now()-s;if(console.debug("[ImagePreload] Priority images preloaded in ".concat(e.toFixed(0),"ms")),o.length>0)return d(o)}).then(()=>{let e=performance.now()-s;console.debug("[ImagePreload] All images preloaded in ".concat(e.toFixed(0),"ms"))})})(M,{priority:20}).then(()=>{console.debug("[MapboxMap] Priority images preloaded successfully"),D(!0)}).catch(e=>{console.warn("[MapboxMap] Some priority images failed to preload:",e),D(!0)}))},[M,Z]);let T=(0,s.useCallback)(e=>{let t=R.find(t=>t.name===e||t.id===e);if(!t){let a=e.toLowerCase();t=R.find(e=>e.name.toLowerCase()===a||"string"==typeof e.id&&e.id.toLowerCase()===a)}return t||null},[R]),z=(0,s.useCallback)(e=>{e&&(console.debug("[MapboxMap] Destination selected from search:",e.name),d(e),l&&l.flyTo({center:[Number(e.longitude),Number(e.latitude)],zoom:"country"===e.destinationType?5:10,duration:1500,essential:!0}))},[l]),V=(0,s.useCallback)(e=>{if(!e){d(null);return}if(console.debug("[MapboxMap] Marker clicked:",e.name),e&&(void 0===e.description||void 0===e.rating)){let t=T(e.name);if(t){console.debug("[MapboxMap] Found full destination data for:",e.name),z(t);return}}z(e)},[T,z]),G=(0,s.useCallback)(e=>{console.debug("[MapboxMap] Map loaded"),n(!0),i(e)},[]),J=(0,s.useCallback)(e=>{console.debug("[MapboxMap] Markers updated, count: ".concat(e)),j(e)},[]),W=(0,s.useCallback)(()=>{console.debug("[MapboxMap] Resetting map view"),d(null),p(""),l&&l.flyTo({center:[B.lng,B.lat],zoom:B.zoom,duration:1500,essential:!0}),N(B),console.debug("[MapboxMap] Map view reset complete")},[l]),K=(0,s.useCallback)(e=>{N(e)},[]),Y=(0,s.useCallback)(e=>{console.debug("[MapboxMap] Changing map style to: ".concat(e)),S(e)},[]);return(0,s.useEffect)(()=>{console.debug("[MapboxMap] Rendering with:",{mapLoaded:a,destinationsCount:null==M?void 0:M.length,selectedDestination:null==o?void 0:o.name,activeFilter:m,searchQuery:y,colorVariation:E,imagesPreloaded:A})},[a,M,o,m,y,E,A]),(0,r.jsxs)("div",{className:"relative w-full h-[700px] rounded-xl overflow-hidden shadow-lg border border-gray-200 dark:border-gray-700",children:[(0,r.jsx)(U,{loading:Z||M.length>0&&!A,stats:{count:R.length,message:Z?"Loading ".concat(L.validCountries," countries and ").concat(L.validCities," cities"):!A&&M.length>0?"Preparing images...":"Ready"}}),_&&!Z&&(0,r.jsxs)("div",{className:"absolute inset-0 bg-red-100 dark:bg-red-900 bg-opacity-90 dark:bg-opacity-90 z-40 flex flex-col items-center justify-center p-4",children:[(0,r.jsx)("h3",{className:"text-lg font-bold text-red-700 dark:text-red-300 mb-2",children:"Error Loading Data"}),(0,r.jsx)("p",{className:"text-red-600 dark:text-red-200 max-w-md text-center",children:_.message||"An error occurred while loading destination data"}),(0,r.jsx)("button",{onClick:()=>window.location.reload(),className:"mt-4 px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 transition-colors","aria-label":"Reload page",children:"Reload Page"})]}),(0,r.jsx)(C,{activeFilter:m,setActiveFilter:b,searchQuery:y,setSearchQuery:p,onResetView:W,showLegend:f,setShowLegend:w,filteredCount:M.length,totalCount:R.length,colorVariation:E,onVariationChange:Y,mapInstance:l,initialMapCoordinates:B,filteredDestinations:M,onDestinationSelect:z}),(0,r.jsx)(I,{destinations:M,selectedDestination:o,onMarkerClick:V,onMapLoad:G,onMarkersUpdate:J,onCoordinateChange:K,className:"w-full h-full",activeFilter:m,colorVariation:E,initialCoordinates:k}),o&&(0,r.jsx)("div",{className:"absolute bottom-4 left-4 z-20 hidden sm:block",children:(0,r.jsx)(F,{destination:o,onClose:()=>d(null)})}),(0,r.jsx)(Q,{destination:o,onClose:()=>d(null)}),f&&(0,r.jsx)("div",{className:"absolute bottom-4 right-4 z-20",children:(0,r.jsx)(P,{})}),(0,r.jsxs)("div",{"aria-live":"polite",className:"sr-only",children:[o?"Selected ".concat(o.name):"",Z?"Loading map data":""]}),t&&(0,r.jsx)(O,{enabled:t,mapInstance:l,markersCount:v,destinationsData:{allDestinations:R,filteredDestinations:M},selectedDestination:o,mapCoordinates:k})]})}),V=a(2938);let G={1:4.8,2:4.9,3:4.7,4:4.6,5:4.9,6:4.8,7:4.7,8:4.5,9:4.9,10:4.8},J={1:2453,2:3768,3:1982,4:5271,5:3542,6:7839,7:4215,8:1876,9:6324,10:2951},W=async()=>(await (0,u.fetchFeaturedCities)(1,6)).map(e=>({...e,rating:G[e.id]||4.7,travelers:J[e.id]||2500}));var K=()=>{let{data:e,error:t,isLoading:a}=(0,V.ZP)("featured-cities",W,{revalidateOnFocus:!1,revalidateIfStale:!1,dedupingInterval:36e5}),s=e&&e.length>0?e:[{id:"1",name:"Kyoto",country_name:"Japan",description:"Traditional temples, gardens, and geisha districts",slug:"kyoto",travelers:J["1"],rating:G["1"],image:"/images/kyoto.jpg"},{id:"2",name:"Santorini",country_name:"Greece",description:"Stunning sunsets over white-washed buildings",slug:"santorini",travelers:J["2"],rating:G["2"],image:"/images/santorini.jpg"},{id:"3",name:"Marrakech",country_name:"Morocco",description:"Vibrant markets and rich cultural heritage",slug:"marrakech",travelers:J["3"],rating:G["3"],image:"/images/marrakech.jpg"}],i=e=>e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":e.toString();return(0,r.jsx)("section",{className:"py-20 px-4 md:px-6 relative w-full",children:(0,r.jsxs)("div",{className:"max-w-7xl mx-auto",children:[(0,r.jsxs)("div",{className:"mb-12 text-center",children:[(0,r.jsx)("h2",{className:"text-3xl md:text-4xl font-bold text-gray-900 dark:text-white mb-4 font-playfair",children:(0,r.jsx)("span",{className:"bg-gradient-to-r from-blue-600 to-blue-800 bg-clip-text text-transparent",children:"Featured Destinations"})}),(0,r.jsx)("p",{className:"text-lg text-gray-600 dark:text-gray-300 max-w-2xl mx-auto",children:"Handpicked locations loved by our travel community"})]}),a?(0,r.jsx)("div",{className:"flex justify-center items-center py-12",children:(0,r.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"})}):t?(0,r.jsx)("div",{className:"text-center text-red-500 py-6",children:"Failed to load featured destinations"}):(0,r.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:s.map((e,t)=>(0,r.jsxs)(n.E.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.5,delay:.1*t},whileHover:{y:-5,transition:{duration:.2}},className:"bg-white dark:bg-gray-800 rounded-xl shadow-lg overflow-hidden border border-gray-200 dark:border-gray-700 group",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(E.default,{src:e.image||"/images/default.jpg",alt:e.name,width:400,height:250,className:"w-full h-48 object-cover transition-transform duration-500 group-hover:scale-105"}),(0,r.jsxs)("div",{className:"absolute top-3 right-3 bg-white/90 dark:bg-gray-900/90 backdrop-blur-sm px-2 py-1 rounded-lg flex items-center",children:[(0,r.jsx)("span",{className:"text-yellow-500 mr-1",children:"★"}),(0,r.jsx)("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-200",children:e.rating})]})]}),(0,r.jsxs)("div",{className:"p-5",children:[(0,r.jsxs)("h3",{className:"text-xl font-bold text-gray-800 dark:text-white mb-2",children:[e.name,", ",e.country_name]}),(0,r.jsx)("p",{className:"text-gray-600 dark:text-gray-300 mb-4 h-12 overflow-hidden",children:e.description||"Explore the beauty and culture of ".concat(e.name)}),(0,r.jsxs)("div",{className:"flex justify-between items-center",children:[(0,r.jsxs)("span",{className:"text-sm text-gray-500 dark:text-gray-400 flex items-center",children:[(0,r.jsx)(M.Z,{className:"w-4 h-4 mr-1"}),i(e.travelers)," travelers"]}),(0,r.jsx)(l.default,{href:"/cities/".concat(encodeURIComponent(e.slug||e.name.toLowerCase())),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition-colors",children:"Explore"})]})]})]},e.id))}),(0,r.jsx)("div",{className:"mt-12 text-center",children:(0,r.jsxs)(l.default,{href:"/explore-cities",className:"inline-flex items-center px-6 py-3 bg-gradient-to-r from-blue-600 to-blue-800 text-white font-medium rounded-lg shadow-lg hover:shadow-xl transition-shadow group",children:[(0,r.jsx)("span",{children:"View all destinations"}),(0,r.jsx)(d.Z,{className:"w-5 h-5 ml-2 transform rotate-270 transition-transform group-hover:translate-x-1"})]})})]})})},Y=a(48614),H=a(99376),X=a(14123),q=a.n(X);function $(){let[e,t]=(0,s.useState)(""),[a,i]=(0,s.useState)([]),[d,c]=(0,s.useState)(!1),[g,m]=(0,s.useState)(-1),[x,h]=(0,s.useState)(!1),[b,f]=(0,s.useState)([]),[w,v]=(0,s.useState)(!1),k=(0,s.useRef)(null),N=(0,s.useRef)(null),C=(0,H.useRouter)();(0,s.useEffect)(()=>{let e=localStorage.getItem("recentSearches");if(e)try{f(JSON.parse(e).slice(0,5))}catch(e){console.error("Error loading recent searches:",e),localStorage.setItem("recentSearches",JSON.stringify([]))}},[]);let E=e=>{let t=[e,...b.filter(t=>t.id!==e.id)].slice(0,5);f(t),localStorage.setItem("recentSearches",JSON.stringify(t))},S=q()(async e=>{if(e.trim()){h(!0);try{let t=await (0,u.fetchCitiesBySearch)(e);i(t)}catch(e){console.error("Error fetching search results:",e),i([])}finally{h(!1)}}else i([])},300),A=e=>{E(e),C.push("/cities/".concat(encodeURIComponent(e.slug))),c(!1),t("")};(0,s.useEffect)(()=>{let e=e=>{k.current&&!k.current.contains(e.target)&&(c(!1),v(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let D=e=>{let{city:t,isActive:a,onClick:s}=e;return(0,r.jsxs)("div",{className:"flex items-center px-6 py-4 transition-colors border-b border-gray-100 dark:border-gray-700/50 last:border-0 cursor-pointer group ".concat(a?"bg-blue-50 dark:bg-blue-900/20":"hover:bg-gray-50 dark:hover:bg-gray-800/70"),role:"option","aria-selected":a,onClick:s,style:{display:"flex",alignItems:"center",paddingBottom:"12px"},children:[(0,r.jsx)(j.Z,{className:"w-5 h-5 mr-3 flex-shrink-0 ".concat(a?"text-blue-600":"text-gray-400 group-hover:text-blue-600"),"aria-hidden":"true"}),(0,r.jsxs)("div",{className:"flex-grow min-w-0",children:[(0,r.jsx)("div",{className:"text-gray-800 dark:text-gray-200 truncate font-medium",children:t.name}),(0,r.jsx)("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:t.country_name})]})]})};return(0,r.jsx)("div",{className:"relative max-w-full md:max-w-2xl mx-auto",ref:k,children:(0,r.jsxs)("form",{onSubmit:t=>{if(t.preventDefault(),-1!==g){let t=e?a[g]:b[g];t&&A(t)}else e.trim()&&C.push("/search?q=".concat(encodeURIComponent(e)));c(!1)},className:"group relative",role:"search","aria-label":"Destination search",children:[(0,r.jsxs)("div",{className:"flex items-center bg-white/90 dark:bg-gray-900/90 backdrop-blur-lg rounded-xl shadow-lg transition-all duration-300 border ".concat(w?"shadow-xl ring-2 ring-blue-500/50 border-blue-400 dark:border-blue-600":"hover:shadow-xl border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"),children:[(0,r.jsx)("div",{className:"pl-5 pr-3 text-gray-400",children:(0,r.jsx)(y.Z,{className:"w-5 h-5 transition-colors duration-300 ".concat(w?"text-blue-600":"text-gray-400")})}),(0,r.jsx)("input",{ref:N,type:"text",value:e,onChange:e=>{let a=e.target.value;t(a),S(a),c(!0),m(-1)},onKeyDown:t=>{if("ArrowDown"===t.key)t.preventDefault(),m(t=>t<(e?a.length:b.length)-1?t+1:0);else if("ArrowUp"===t.key)t.preventDefault(),m(t=>t>0?t-1:(e?a.length:b.length)-1);else if("Escape"===t.key){var r;c(!1),null===(r=N.current)||void 0===r||r.blur()}else if("Enter"===t.key&&-1!==g){t.preventDefault();let r=e?a[g]:b[g];r&&A(r)}},placeholder:"Where would you like to go?","aria-autocomplete":"list","aria-controls":"search-suggestions","aria-expanded":d,className:"w-full py-5 bg-transparent text-gray-700 dark:text-gray-200 placeholder-gray-400 text-lg border-none focus:ring-0 font-cabin",onFocus:()=>{c(!0),v(!0)}}),(0,r.jsx)(Y.M,{children:e&&(0,r.jsx)(n.E.button,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},type:"button",onClick:()=>{var e;t(""),i([]),m(-1),null===(e=N.current)||void 0===e||e.focus()},className:"pr-2 pl-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors","aria-label":"Clear search",children:(0,r.jsx)(p.Z,{className:"w-5 h-5"})})}),(0,r.jsx)("button",{type:"submit",className:"pr-5 pl-3 py-5 text-blue-600 hover:text-blue-800 transition-colors","aria-label":"Search for destinations",children:(0,r.jsx)(Z.Z,{className:"w-5 h-5 transform transition-transform group-hover:translate-x-1"})})]}),(0,r.jsx)(Y.M,{children:d&&(0,r.jsx)(n.E.div,{id:"search-suggestions",role:"listbox",initial:{opacity:0,height:0,y:-10},animate:{opacity:1,height:"auto",y:0},exit:{opacity:0,height:0,y:-10},transition:{duration:.2},className:"absolute top-full left-0 w-full mt-2 bg-white/95 dark:bg-gray-900/95 backdrop-blur-lg rounded-xl shadow-xl overflow-hidden border border-gray-200 dark:border-gray-700 z-20",children:(0,r.jsx)("div",{className:"max-h-96 overflow-y-auto overflow-x-hidden",children:x?(0,r.jsx)("div",{className:"px-6 py-4 text-gray-700 dark:text-gray-300",children:(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(T.Z,{className:"animate-spin h-4 w-4 text-blue-600 mr-3","aria-hidden":"true"}),(0,r.jsx)("span",{children:"Searching for destinations..."})]})}):""!==e.trim()?a.length>0?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"px-6 py-2 text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider border-b border-gray-100 dark:border-gray-800",children:"Search Results"}),a.map((e,t)=>(0,r.jsx)(l.default,{href:"/cities/".concat(encodeURIComponent(e.slug)),onMouseDown:e=>e.preventDefault(),className:"block",onClick:()=>{E(e),c(!1)},children:(0,r.jsx)(D,{city:e,index:t,isActive:t===g,onClick:()=>{E(e),c(!1),C.push("/cities/".concat(encodeURIComponent(e.slug)))}})},e.id))]}):(0,r.jsxs)("div",{className:"px-6 py-4 text-gray-700 dark:text-gray-300",children:[(0,r.jsxs)("p",{children:['No results found for "',e,'"']}),(0,r.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Try a different search term or explore popular destinations."})]}):b.length>0?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"px-6 py-2 text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider border-b border-gray-100 dark:border-gray-800",children:"Recent Searches"}),b.map((e,t)=>(0,r.jsx)(D,{city:e,index:t,isActive:t===g,onClick:()=>A(e)},e.id)),(0,r.jsx)("div",{className:"px-6 py-3 text-center text-blue-600 hover:text-blue-800 cursor-pointer font-medium border-t border-gray-100 dark:border-gray-800 text-sm hover:bg-blue-50 dark:hover:bg-blue-900/20 transition-colors",onClick:()=>C.push("/explore-cities"),children:(0,r.jsxs)("div",{className:"flex items-center justify-center",children:[(0,r.jsx)(o.Z,{className:"w-4 h-4 mr-2"}),(0,r.jsx)("span",{children:"Explore All Destinations"})]})})]}):(0,r.jsxs)("div",{className:"px-6 py-4 text-gray-700 dark:text-gray-300",children:[(0,r.jsx)("p",{children:"Start typing to search for destinations"}),(0,r.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Or explore our featured cities below"})]})})})})]})})}function ee(){let{isAuthenticated:e,username:t,firstName:c}=(0,i.a)(),[u,g]=(0,s.useState)(0),m=(0,s.useRef)(null),[x,h]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let e=()=>{g(window.scrollY)};return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)},[]),(0,s.useEffect)(()=>{"true"===new URLSearchParams(window.location.search).get("debug")&&(h(!0),console.log("Debug mode enabled via URL parameter"),Promise.resolve().then(a.bind(a,6021)).then(e=>{let{getCacheStatus:t,debugCacheState:r}=e;try{let e=r();console.log("Detailed cache status:",e),console.log("Cache status:",t()),Promise.resolve().then(a.bind(a,46215)).then(e=>{let{fetchMinimalCountries:t}=e;t().catch(()=>{})}).catch(()=>{}),Promise.resolve().then(a.bind(a,6275)).then(e=>{e.fetchFeaturedCities&&e.fetchFeaturedCities().catch(()=>{})}).catch(()=>{})}catch(e){console.error("Error getting cache debug info:",e)}}).catch(e=>{console.error("Could not load cache service:",e)}))},[]),(0,r.jsxs)("div",{className:"min-h-screen flex flex-col bg-white dark:from-gray-900 dark:to-gray-800 relative overflow-hidden",children:[(0,r.jsx)("div",{className:"absolute -top-40 -right-40 w-96 h-96 rounded-full bg-gradient-to-br from-blue-500/20 to-blue-700/30 blur-3xl",style:{transform:"translate(".concat(.05*u,"px, ").concat(-.03*u,"px)")},"aria-hidden":"true"}),(0,r.jsx)("div",{className:"absolute -bottom-20 -left-20 w-80 h-80 rounded-full bg-gradient-to-tr from-red-500/20 to-red-700/20 blur-3xl",style:{transform:"translate(".concat(-.04*u,"px, ").concat(.02*u,"px)")},"aria-hidden":"true"}),(0,r.jsx)("section",{className:"relative flex flex-col items-center justify-center min-h-screen pt-24 pb-16 px-4 md:px-6 w-full","aria-labelledby":"hero-heading",children:(0,r.jsxs)("div",{className:"max-w-5xl w-full mx-auto text-center space-y-8 z-10",children:[(0,r.jsx)(n.E.h1,{id:"hero-heading",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.8,ease:"easeOut"},className:"text-5xl md:text-6xl lg:text-7xl font-bold mb-6 font-playfair",children:(0,r.jsx)("span",{className:"bg-gradient-to-r from-blue-600 to-blue-800 bg-clip-text text-transparent",children:e?c?"Welcome back, ".concat(c,"!"):"Welcome back, ".concat(t,"!"):"Discover the World"})}),(0,r.jsx)(n.E.p,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.8,delay:.2,ease:"easeOut"},className:"text-xl md:text-2xl text-gray-700 dark:text-gray-300 font-light mb-10 max-w-2xl mx-auto leading-relaxed",children:"Discover hidden gems, explore vibrant cities, and create unforgettable journeys with our global community."}),(0,r.jsx)(n.E.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.6,delay:.4,ease:"easeOut"},children:(0,r.jsx)($,{})}),(0,r.jsx)(n.E.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.6,delay:.6},className:"mt-12",children:(0,r.jsxs)("button",{onClick:()=>{var e;null===(e=m.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},className:"inline-flex items-center text-blue-600 hover:text-blue-800 transition-colors group font-medium px-6 py-3 rounded-lg hover:bg-white/50 dark:hover:bg-gray-900/50 border border-transparent hover:border-gray-200 dark:hover:border-gray-700","aria-label":"Scroll to interactive world map",children:[(0,r.jsx)(o.Z,{className:"w-5 h-5 mr-2","aria-hidden":"true"}),(0,r.jsx)("span",{children:"Explore interactive world map"}),(0,r.jsx)(d.Z,{className:"w-5 h-5 ml-2 transition-transform group-hover:translate-y-1","aria-hidden":"true"})]})})]})}),(0,r.jsx)(K,{}),(0,r.jsxs)("section",{ref:m,id:"world-map-section",className:"py-20 bg-gray-100 dark:bg-gray-900 border-t border-gray-200 dark:border-gray-800 relative w-full","aria-labelledby":"map-heading",children:[(0,r.jsx)("div",{className:"absolute top-0 left-0 w-24 h-24 border-l-2 border-t-2 border-blue-600/30","aria-hidden":"true"}),(0,r.jsx)("div",{className:"absolute bottom-0 right-0 w-24 h-24 border-r-2 border-b-2 border-blue-600/30","aria-hidden":"true"}),(0,r.jsxs)("div",{className:"max-w-7xl mx-auto px-4 md:px-6",children:[(0,r.jsxs)("div",{className:"max-w-3xl mx-auto text-center mb-12",children:[(0,r.jsx)("h2",{id:"map-heading",className:"text-3xl md:text-4xl font-bold text-gray-900 dark:text-white mb-4 font-playfair",children:(0,r.jsx)("span",{className:"bg-gradient-to-r from-blue-600 to-blue-800 bg-clip-text text-transparent",children:"Global Adventure Map"})}),(0,r.jsx)("p",{className:"text-lg text-gray-600 dark:text-gray-300 max-w-md mx-auto leading-relaxed",children:"Click to explore destinations, view traveler insights, and plan your next adventure across our interactive map."})]}),(0,r.jsxs)(n.E.div,{initial:{opacity:0,scale:.95},whileInView:{opacity:1,scale:1},viewport:{once:!0},transition:{duration:.8,ease:"easeOut"},className:"rounded-2xl overflow-hidden shadow-2xl border-2 border-gray-200 dark:border-gray-700 bg-white/95 dark:bg-gray-800/95 backdrop-blur-lg relative",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-gradient-to-b from-white/10 to-gray-100/10 dark:from-gray-800/10 dark:to-gray-900/10 pointer-events-none","aria-hidden":"true"}),(0,r.jsx)(z,{debug:x})]})]})]}),(0,r.jsxs)("section",{className:"py-16 px-4 md:px-6 bg-gradient-to-r from-blue-600 to-blue-800 relative overflow-hidden w-full","aria-labelledby":"cta-heading",children:[(0,r.jsxs)("div",{className:"absolute top-0 left-0 w-full h-full opacity-10","aria-hidden":"true",children:[(0,r.jsx)("div",{className:"absolute -top-20 -right-20 w-96 h-96 rounded-full bg-white blur-3xl"}),(0,r.jsx)("div",{className:"absolute -bottom-40 -left-20 w-80 h-80 rounded-full bg-white blur-3xl"})]}),(0,r.jsxs)("div",{className:"max-w-5xl mx-auto text-center relative z-10",children:[(0,r.jsx)("h2",{id:"cta-heading",className:"text-3xl md:text-4xl font-bold text-white mb-6 font-playfair",children:"Ready to Begin Your Journey?"}),(0,r.jsx)("p",{className:"text-xl text-white/90 max-w-2xl mx-auto mb-8",children:"Join our community of global travelers and start creating unforgettable memories"}),(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row justify-center gap-4",children:[(0,r.jsx)(l.default,{href:"/register",className:"px-8 py-4 bg-white text-blue-600 font-bold rounded-xl shadow-lg hover:shadow-xl transition-shadow","aria-label":"Sign up and start planning your trip",children:"Start Planning"}),(0,r.jsx)(l.default,{href:"/explore-cities",className:"px-8 py-4 bg-transparent text-white border-2 border-white/50 font-bold rounded-xl hover:bg-white/10 transition-colors","aria-label":"Browse our collection of travel destinations",children:"Explore Destinations"})]})]})]})]})}},3141:function(e,t,a){"use strict";a.d(t,{WX:function(){return o},a$:function(){return c},pH:function(){return d}});var r=a(41121),s=a(43577);let n=(e,t)=>{if(e instanceof s.d7){if("ECONNABORTED"===e.code)throw Error("Connection timeout. Please check your network");if(!e.response)throw Error("Network error. Please check your connection");throw Error(e.response.data.detail||e.response.data.error||t)}throw Error(t)},l=async()=>{try{return(await r.Z.post("/auth/token/refresh/")).data}catch(e){return n(e,"Session expired. Please log in again.")}},i=0,o=async()=>{try{let e=await r.Z.get("/auth/verify/");return i=0,e.data}catch(t){var e;if(t instanceof s.d7&&(null===(e=t.response)||void 0===e?void 0:e.status)===401&&i<2)return i++,await l(),o();return n(t,"Authentication failed")}},d=async(e,t)=>{try{console.log("Sending login request with:",{username:e,password:"****"});let a=await r.Z.post("/auth/login/",{username:e,password:t});return console.log("Login response received"),a.data}catch(e){return console.error("Login error:",e),n(e,"Login failed")}},c=async(e,t,a,s,l)=>{try{return(await r.Z.post("/auth/register/",{username:e,email:t,password:a,first_name:s,last_name:l})).data}catch(e){return n(e,"Registration failed")}}}},function(e){e.O(0,[3464,5183,156,7648,3145,422,6961,6706,6215,2971,2117,1744],function(){return e(e.s=90417)}),_N_E=e.O()}]);