import{c as t}from"../../_/nitro.mjs";import"node:http";import"node:https";import"nitropack/dist/runtime/plugin";import"packrup";import"vue";import"node:fs";import"node:url";import"consola/core";import"node:path";const e="https://new.khalejauto.sa/api";function slugify(t){return t?t.toString().toLowerCase().trim().replace(/\s+/g,"-").replace(/[؟,،!%&]/g,"").replace(/-+/g,"-"):""}const o=t((async()=>{const t=[];try{const o=await fetch(`${e}/cars`,{headers:{"Content-Language":"ar"}});if(o.ok){const e=(await o.json()).data||[];for(const o of e){const e=o.slug_ar||slugify(o.name||o.title),r=o.updated_at||(new Date).toISOString();e&&(t.push({loc:`/cars/${e}`,lastmod:r,changefreq:"weekly",priority:.8,_sitemap:"ar"}),t.push({loc:`/en/cars/${e}`,lastmod:r,changefreq:"weekly",priority:.8,_sitemap:"en"}))}}}catch(t){console.error("Error fetching cars for sitemap:",t)}try{const o=await fetch(`${e}/offers`,{headers:{"Content-Language":"ar"}});if(o.ok){const e=(await o.json()).data||[];for(const o of e){const e=slugify(o.title),r=o.updated_at||(new Date).toISOString();e&&(t.push({loc:`/offers/${e}`,lastmod:r,changefreq:"weekly",priority:.8,_sitemap:"ar"}),t.push({loc:`/en/offers/${e}`,lastmod:r,changefreq:"weekly",priority:.8,_sitemap:"en"}))}}}catch(t){console.error("Error fetching offers for sitemap:",t)}try{const o=await fetch(`${e}/news`,{headers:{"Content-Language":"ar"}});if(o.ok){const e=(await o.json()).data||[];for(const o of e){const e=slugify(o.title),r=o.updated_at||o.created_at||(new Date).toISOString();e&&(t.push({loc:`/blogs/${e}`,lastmod:r,changefreq:"weekly",priority:.7,_sitemap:"ar"}),t.push({loc:`/en/blogs/${e}`,lastmod:r,changefreq:"weekly",priority:.7,_sitemap:"en"}))}}}catch(t){console.error("Error fetching news for sitemap:",t)}try{const o=await fetch(`${e}/services`,{headers:{"Content-Language":"ar"}});if(o.ok){const e=(await o.json()).data||[];for(const o of e){const e=slugify(o.title),r=o.updated_at||(new Date).toISOString();e&&(t.push({loc:`/services/${e}`,lastmod:r,changefreq:"monthly",priority:.7,_sitemap:"ar"}),t.push({loc:`/en/services/${e}`,lastmod:r,changefreq:"monthly",priority:.7,_sitemap:"en"}))}}}catch(t){console.error("Error fetching services for sitemap:",t)}return t}));export{o as default};
