(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{26224:(e,t,a)=>{"use strict";a.d(t,{default:()=>o});var s=a(95155),r=a(10848),n=a(87358);function o(){return(0,s.jsx)(r.ah,{trackPageViews:!0,gaMeasurementId:n.env.NEXT_PUBLIC_GA_MEASUREMENT_ID})}},26431:(e,t,a)=>{"use strict";a.d(t,{LanguageProvider:()=>l});var s=a(95155),r=a(12115);let n=["en","ar"];function o(e){return n.some(t=>t===e)}let i=(0,r.createContext)(void 0);function l(e){let{children:t}=e,[a,n]=function(e,t){let[a,s]=(0,r.useState)(t),[n,o]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let t=localStorage.getItem(e);if(null!==t)try{s(JSON.parse(t))}catch(e){s(t)}o(!0)},[e]),(0,r.useEffect)(()=>{n&&localStorage.setItem(e,JSON.stringify(a))},[n,e,a]),[a,s]}("locale",function(){try{let e=localStorage.getItem("locale");if(e&&o(e))return e;let[t]=navigator.language.split("-");if(o(t))return t;return"en"}catch(e){return"en"}}());return console.log(a),(0,s.jsx)(i.Provider,{value:{locale:a,setLocale:n},children:t})}},30347:()=>{},37778:(e,t,a)=>{"use strict";a.d(t,{P:()=>n});var s=a(95799),r=a(17985);let n={error:(e,t)=>{let a=r.Ay.t("".concat(e))||t||e;s.toast.error(a)},success:(e,t)=>{let a=r.Ay.t("".concat(e))||t||e;s.toast.success(a)},info:(e,t)=>{let a=r.Ay.t("".concat(e))||t||e;s.toast.info(a)},warning:(e,t)=>{let a=r.Ay.t("".concat(e))||t||e;s.toast.warning(a)}}},41226:()=>{},52865:(e,t,a)=>{"use strict";a.d(t,{default:()=>v});var s=a(95155),r=a(12115),n=a(35695),o=a(23900),i=a(91218),l=a(6874),c=a.n(l);function d(){let{t:e,i18n:t}=(0,i.Bd)("common"),a="ar"===t.language;return(0,r.useEffect)(()=>{document.getElementById("myAliceWebChat")||(()=>{var e,t;let a=document.createElement("div");a.id="myAliceWebChat";let s=document.createElement("script");s.type="text/javascript",s.async=!0,s.src="https://livechat.myalice.ai/index.js";let r=document.body.getElementsByTagName("script"),n=r[r.length-1];null==(e=n.parentNode)||e.insertBefore(s,n),null==(t=n.parentNode)||t.insertBefore(a,n),s.addEventListener("load",function(){window.MyAliceWebChat&&window.MyAliceWebChat.init({selector:"#myAliceWebChat",platformId:"26080",primaryId:"af0a0e4c960411f0abce125a9b0e29ae",token:"0591812192214fc9a14fde6e7ac3803821cbe62384c4b902"})})})()},[]),(0,s.jsx)("footer",{className:"bg-black text-white py-12",children:(0,s.jsxs)("div",{className:"max-w-6xl mx-auto px-6",children:[(0,s.jsxs)("div",{className:"flex flex-col md:flex-row flex-wrap justify-between gap-8",children:[(0,s.jsxs)("div",{className:"pr-8 mb-8 md:mb-0",children:[(0,s.jsx)("div",{className:"mb-6",children:(0,s.jsx)("img",{src:a?"/logoArabicWhite.svg":"/Agerlee word.png",alt:"Ajarlee Logo",className:"w-[168px] h-[68px] mb-6"})}),(0,s.jsx)("p",{className:"text-white text-sm leading-relaxed max-w-[335px]",children:e("auth.FooterText")})]}),(0,s.jsxs)("div",{className:"pl-4 pr-8 mb-8 md:mb-0",children:[(0,s.jsx)("h3",{className:"text-xl font-medium mb-6 text-[#EAD763]",children:e("auth.Services")}),(0,s.jsxs)("ul",{className:"space-y-1",children:[(0,s.jsx)("li",{children:(0,s.jsx)(c(),{href:"#",className:"text-white hover:text-yellow-400 transition-colors text-sm whitespace-nowrap",children:e("auth.RentCars")})}),(0,s.jsx)("li",{children:(0,s.jsx)(c(),{href:"#",className:"text-white hover:text-yellow-400 transition-colors text-sm whitespace-nowrap",children:e("auth.MyRents")})}),(0,s.jsx)("li",{children:(0,s.jsx)(c(),{href:"#",className:"text-white hover:text-yellow-400 transition-colors text-sm whitespace-nowrap",children:e("auth.OfficeApp")})})]})]}),(0,s.jsxs)("div",{className:"pl-4 pr-8 mb-8 md:mb-0",children:[(0,s.jsx)("h3",{className:"text-xl font-medium mb-6 text-[#EAD763]",children:e("auth.Support")}),(0,s.jsxs)("div",{className:"space-y-1 max-w-[242px]",children:[(0,s.jsxs)("div",{className:"text-sm",children:[(0,s.jsxs)("span",{className:"text-white",children:[e("auth.Email"),": "]}),(0,s.jsx)(c(),{href:"mailto:customerservice@ajarlee.om",className:"text-white hover:text-yellow-400 transition-colors",children:"customerservice@ajarlee.om"})]}),(0,s.jsxs)("div",{className:"text-sm",children:[(0,s.jsxs)("span",{className:"text-white",children:[e("auth.Phone"),": "]}),(0,s.jsx)(c(),{href:"https://wa.me/96878535370",target:"_blank",rel:"noopener noreferrer",className:"text-white hover:text-yellow-400 transition-colors",children:"+968 7853 5370"})]})]})]}),(0,s.jsxs)("div",{className:"pl-4",children:[(0,s.jsxs)("h3",{className:"text-xl font-medium mb-6 text-white",children:[(0,s.jsx)("span",{className:"text-[#EAD763]",children:e("auth.Download")})," ",e("auth.OurApp")]}),(0,s.jsxs)("div",{className:"space-y-3 max-w-[209px]",children:[(0,s.jsx)("a",{href:"https://onelink.to/jxjmvr",className:"block",children:(0,s.jsxs)("div",{className:"flex items-center bg-black border border-white rounded-lg p-2 hover:bg-gray-800 transition-colors",children:[(0,s.jsx)("div",{className:"flex-shrink-0 mr-3 rtl:mr-0 rtl:ml-3",children:(0,s.jsx)("img",{src:"/Playstore.png",alt:"Play Store",className:"w-6 h-6"})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0 text-left rtl:text-right",children:[(0,s.jsx)("div",{className:"text-xs text-gray-300 leading-tight",children:e("auth.GetOnIt")}),(0,s.jsx)("div",{className:"text-sm font-medium text-white leading-tight",children:e("auth.GooglePlay")})]})]})}),(0,s.jsx)("a",{href:"https://apps.apple.com/app/id6670305720",className:"block",children:(0,s.jsxs)("div",{className:"flex items-center bg-black border border-white rounded-lg p-3 hover:bg-gray-800 transition-colors",children:[(0,s.jsx)("div",{className:"flex-shrink-0 mr-3 rtl:mr-0 rtl:ml-3",children:(0,s.jsx)("img",{src:"/Apple.png",alt:"App Store",className:"w-6 h-6"})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0 text-left rtl:text-right",children:[(0,s.jsx)("div",{className:"text-xs text-gray-300 leading-tight",children:e("auth.DownloadOnThe")}),(0,s.jsx)("div",{className:"text-sm font-medium text-white leading-tight",children:e("auth.AppStore")})]})]})})]})]})]}),(0,s.jsx)("div",{className:"border-t-1 border-white mt-12 pt-8",children:(0,s.jsxs)("div",{className:"flex flex-col md:flex-row justify-between items-center",children:[(0,s.jsx)("div",{className:"text-sm text-gray-400 mb-4 md:mb-0",children:e("auth.CopyWrite")}),(0,s.jsxs)("div",{className:"flex gap-3",children:[(0,s.jsx)(c(),{href:"https://www.facebook.com/profile.php?id=61578282021371",className:"border border-white hover:bg-black p-2 rounded-full transition-colors",target:"_blank",children:(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",className:"bi bi-facebook",viewBox:"0 0 16 16",children:(0,s.jsx)("path",{d:"M16 8.049c0-4.446-3.582-8.05-8-8.05C3.58 0-.002 3.603-.002 8.05c0 4.017 2.926 7.347 6.75 7.951v-5.625h-2.03V8.05H6.75V6.275c0-2.017 1.195-3.131 3.022-3.131.876 0 1.791.157 1.791.157v1.98h-1.009c-.993 0-1.303.621-1.303 1.258v1.51h2.218l-.354 2.326H9.25V16c3.824-.604 6.75-3.934 6.75-7.951z"})})}),(0,s.jsx)(c(),{href:"https://www.instagram.com/ajarlee.om?igsh=djkxYjFpMW1uOHg3",target:"_blank",className:"border border-white hover:bg-black p-2 rounded-full transition-colors",children:(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",className:"bi bi-instagram",viewBox:"0 0 16 16",children:(0,s.jsx)("path",{d:"M8 0C5.8 0 5.555.008 4.7.048 3.837.088 3.2.24 2.675.464c-.526.225-.97.525-1.414.97-.444.444-.744.888-.97 1.414C.24 3.2.088 3.837.048 4.7.008 5.555 0 5.8 0 8s.008 2.445.048 3.3c.04.863.192 1.5.416 2.025.225.526.525.97.97 1.414.444.444.888.744 1.414.97.525.224 1.162.376 2.025.416.855.04 1.1.048 3.3.048s2.445-.008 3.3-.048c.863-.04 1.5-.192 2.025-.416.526-.225.97-.525 1.414-.97.444-.444.744-.888.97-1.414.224-.525.376-1.162.416-2.025.04-.855.048-1.1.048-3.3s-.008-2.445-.048-3.3c-.04-.863-.192-1.5-.416-2.025a3.585 3.585 0 0 0-.97-1.414A3.585 3.585 0 0 0 13.3.464C12.774.24 12.137.088 11.274.048 10.445.008 10.2 0 8 0zM8 1.44c2.162 0 2.403.008 3.25.048.737.04 1.137.176 1.4.293.35.153.6.337.864.6.263.263.447.513.6.864.117.263.253.663.293 1.4.04.847.048 1.088.048 3.25s-.008 2.403-.048 3.25c-.04.737-.176 1.137-.293 1.4a2.16 2.16 0 0 1-.6.864 2.16 2.16 0 0 1-.864.6c-.263.117-.663.253-1.4.293-.847.04-1.088.048-3.25.048s-2.403-.008-3.25-.048c-.737-.04-1.137-.176-1.4-.293a2.16 2.16 0 0 1-.864-.6 2.16 2.16 0 0 1-.6-.864c-.117-.263-.253-.663-.293-1.4C1.448 10.403 1.44 10.162 1.44 8s.008-2.403.048-3.25c.04-.737.176-1.137.293-1.4.153-.35.337-.6.6-.864.263-.263.513-.447.864-.6.263-.117.663-.253 1.4-.293C5.597 1.448 5.838 1.44 8 1.44zm0 2.88A3.68 3.68 0 1 0 8 12.96 3.68 3.68 0 0 0 8 4.32zm0 6.08a2.4 2.4 0 1 1 0-4.8 2.4 2.4 0 0 1 0 4.8zm4.8-6.48a.96.96 0 1 1-1.92 0 .96.96 0 0 1 1.92 0z"})})}),(0,s.jsx)(c(),{href:"https://www.linkedin.com/company/ajarlee/",className:"border border-white hover:bg-black p-2 rounded-full transition-colors",target:"_blank",children:(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",className:"bi bi-linkedin",viewBox:"0 0 16 16",children:(0,s.jsx)("path",{d:"M0 1.146C0 .513.526 0 1.175 0h13.65C15.474 0 16 .513 16 1.146v13.708c0 .633-.526 1.146-1.175 1.146H1.175C.526 16 0 15.487 0 14.854V1.146zm4.943 12.248V6.169H2.542v7.225h2.401zm-1.2-8.212c.837 0 1.358-.554 1.358-1.248-.015-.709-.52-1.248-1.342-1.248-.822 0-1.359.54-1.359 1.248 0 .694.521 1.248 1.327 1.248h.016zm4.908 8.212V9.359c0-.216.016-.432.08-.586.173-.431.568-.878 1.232-.878.869 0 1.216.662 1.216 1.634v3.865h2.401V9.25c0-2.22-1.184-3.252-2.764-3.252-1.274 0-1.845.7-2.165 1.193v.025h-.016a5.54 5.54 0 0 1 .016-.025V6.169h-2.4c.03.678 0 7.225 0 7.225h2.4z"})})})]})]})})]})})}var h=a(60008),m=a(82961),u=a(8594),p=a(87856),x=a(37778),f=a(17985),g=a(68834),w=a(14431);f.Ay.use(g.A).use(w.A).use(i.r9).init({fallbackLng:"en",supportedLngs:["en","ar"],ns:["common"],defaultNS:"common",interpolation:{escapeValue:!1},backend:{loadPath:"/locales/{{lng}}/{{ns}}.json"},detection:{order:["localStorage","cookie","navigator"],caches:["localStorage","cookie"],lookupLocalStorage:"i18nextLng",lookupCookie:"i18nextLng"},react:{useSuspense:!1}});var j=a(55174);function v(e){let{children:t}=e,a=(0,n.usePathname)(),l=(0,n.useSearchParams)(),c=(0,n.useRouter)(),{i18n:f}=(0,i.Bd)(),g="true"===l.get("application"),w=a.startsWith("/auth"),v=l.get("impersonation_token"),b=("/term-and-conditions"===a||"/support"===a||"/bussiness-request"===a||"/privacy"===a||"/"===a)&&g,{user:k,setUser:y}=(0,u.n)(),[N,E]=(0,r.useState)(!0),[T,A]=(0,r.useState)(!0),[C,S]=(0,r.useState)(!1),P=(0,r.useRef)(0);return((0,r.useEffect)(()=>{(async()=>{try{f.isInitialized||await new Promise(e=>{f.on("initialized",e),setTimeout(e,1e3)}),S(!0);let e=localStorage.getItem("i18nextLng")||localStorage.getItem("locale")||"en";f.language!==e&&await f.changeLanguage(e),document.documentElement.lang=f.language,document.documentElement.dir="ar"===f.language?"rtl":"ltr"}catch(e){console.error("Error initializing i18n:",e),S(!0)}})()},[f]),(0,r.useEffect)(()=>{let e=async()=>{try{let e=(0,m.parseCookies)(),t=e.accessToken;if("/"===a&&v)try{let e=await (0,j.$)("admin/validate-impersonation",{impersonation_token:v});if(e.success&&e.data){(0,m.setCookie)(null,"accessToken",e.data.accessToken,{path:"/",maxAge:86400}),(0,m.setCookie)(null,"refreshToken",e.data.refreshToken,{path:"/",maxAge:604800}),y(e.data),x.P.success("ImpersonationSuccessful","Impersonation successful!");let t=new URLSearchParams(l.toString());t.delete("impersonation_token");let s=t.toString()?"".concat(a,"?").concat(t.toString()):a;c.replace(s);return}}catch(e){console.error("Impersonation token validation failed:",e),x.P.error("FailedToValidateImpersonation","Failed to validate impersonation token")}if(e.accessToken,t&&!k){let e=await (0,p.V)("user");y(null==e?void 0:e.data)}}catch(e){console.error("Error loading user data:",e)}finally{E(!1)}};"/"!==a&&k?E(!1):e()},[a,k,y,v,c,l]),(0,r.useEffect)(()=>{let e=()=>{let e=window.scrollY;ewindow.removeEventListener("scroll",e)},[]),(0,r.useEffect)(()=>{C&&f.language&&(document.documentElement.lang=f.language,document.documentElement.dir="ar"===f.language?"rtl":"ltr")},[f.language,C]),N)?(0,s.jsx)("div",{className:"flex justify-center items-center h-screen",children:(0,s.jsx)("span",{className:"loading loading-spinner loading-lg text-primary"})}):(0,s.jsxs)(s.Fragment,{children:[!w&&!b&&T&&(0,s.jsx)("div",{className:"z-50 w-full bg-white transition-all duration-300",children:(0,s.jsx)(o.default,{})}),(0,s.jsx)("main",{dir:"ar"===f.language?"rtl":"ltr",className:w?"":"pt-0 bg-white",children:t}),!w&&!b&&(0,s.jsx)(d,{}),!w&&!b&&(0,s.jsx)(h.default,{})]})}},55174:(e,t,a)=>{"use strict";a.d(t,{$:()=>n});var s=a(37778),r=a(82961);async function n(e,t){let a=(0,r.parseCookies)(),n=a.accessToken,o=a.refreshToken,i=a.lang||"en",l=await fetch("".concat("https://api.ajarlee.om/api","/").concat(e),{method:"POST",headers:{"Content-Type":"application/json",lang:i,...n&&{Authorization:"Bearer ".concat(n)}},body:JSON.stringify(t)});if(401===l.status)try{let a=await fetch("".concat("https://api.ajarlee.om/api","/user/refresh-token"),{method:"GET",headers:{lang:i,...o&&{Authorization:"Bearer ".concat(o)}}});if(!a.ok)throw Error("Refresh token failed");let s=await a.json();if((0,r.setCookie)(null,"accessToken",s.accessToken,{path:"/",maxAge:86400}),n=s.accessToken,o=s.refreshToken,!(l=await fetch("".concat("https://api.ajarlee.om/api","/").concat(e),{method:"POST",headers:{"Content-Type":"application/json",lang:i,Authorization:"Bearer ".concat(n)},body:JSON.stringify(t)})).ok)throw Error("API request failed after refresh");return l.json()}catch(e){throw s.P.error("SessionExpired","Session expired. Please log in again."),(0,r.destroyCookie)(null,"accessToken",{path:"/"}),window.location.href="/",Error("Token refresh failed")}if(!l.ok)throw Error((await l.json()).message||"API request failed");return l.json()}},71471:(e,t,a)=>{"use strict";a.d(t,{default:()=>i});var s=a(95155),r=a(21716),n=a(26715);let o=new r.E;function i(e){let{children:t}=e;return(0,s.jsx)(n.Ht,{client:o,children:t})}},83318:(e,t,a)=>{"use strict";a.d(t,{default:()=>n});var s=a(95155),r=a(63554);function n(e){let{gtmId:t}=e;return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(r.default,{id:"gtm-script",strategy:"afterInteractive",children:"\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','".concat(t,"');\n ")})})}},87856:(e,t,a)=>{"use strict";a.d(t,{V:()=>n});var s=a(37778),r=a(82961);async function n(e,t){let a,n,o;{let e=(0,r.parseCookies)();a=e.accessToken,n=e.refreshToken,o=e.lang||"en"}let i=await fetch("".concat("https://api.ajarlee.om/api","/").concat(e),{method:"GET",headers:{"Content-Type":"application/json",lang:o,...a&&{Authorization:"Bearer ".concat(a)}},cache:"no-store"});if(401===i.status)if(n)try{let t=await fetch("".concat("https://api.ajarlee.om/api","/user/refresh-token"),{method:"GET",headers:{"Content-Type":"application/json",lang:o,Authorization:"Bearer ".concat(n)}});if(!t.ok)throw Error("Refresh token failed with status: ".concat(t.status));let s=await t.json();if((0,r.setCookie)(null,"accessToken",s.accessToken,{path:"/",maxAge:86400}),a=s.accessToken,!(i=await fetch("".concat("https://api.ajarlee.om/api","/").concat(e),{method:"GET",headers:{"Content-Type":"application/json",lang:o,Authorization:"Bearer ".concat(a)},cache:"no-store"})).ok)throw Error("API request failed after refresh with status: ".concat(i.status));return i.json()}catch(e){console.error("Token refresh failed:",e),s.P.error("SessionExpired","Session expired. Please log in again."),(0,r.destroyCookie)(null,"accessToken",{path:"/"}),(0,r.destroyCookie)(null,"refreshToken",{path:"/"}),window.location.href="/"}else{if((0,r.destroyCookie)(null,"accessToken",{path:"/"}),(0,r.destroyCookie)(null,"refreshToken",{path:"/"}),["cars/filters","filter/companies"].some(t=>e.includes(t))){let t=await fetch("".concat("https://api.ajarlee.om/api","/").concat(e),{method:"GET",headers:{"Content-Type":"application/json",lang:o},cache:"no-store"});if(t.ok)return t.json()}throw Error("Authentication required")}if(!i.ok){let t=await i.text(),a="API request failed with status: ".concat(i.status);try{a=JSON.parse(t).message||a}catch(e){a=t||a}throw console.error("API Error:",{url:e,status:i.status,message:a,isServer:!1}),Error(a)}return i.json()}},96872:(e,t,a)=>{Promise.resolve().then(a.t.bind(a,4147,23)),Promise.resolve().then(a.t.bind(a,38489,23)),Promise.resolve().then(a.bind(a,95799)),Promise.resolve().then(a.t.bind(a,66298,23)),Promise.resolve().then(a.t.bind(a,44202,23)),Promise.resolve().then(a.bind(a,52865)),Promise.resolve().then(a.t.bind(a,30347,23)),Promise.resolve().then(a.bind(a,71471)),Promise.resolve().then(a.bind(a,26224)),Promise.resolve().then(a.bind(a,83318)),Promise.resolve().then(a.bind(a,26431))}},e=>{var t=t=>e(e.s=t);e.O(0,[6685,7690,3e3,7985,9543,6874,1144,9072,5913,8441,1684,7358],()=>t(96872)),_N_E=e.O()}]);