import axios from "axios";
import { resolveComponent, mergeProps, withCtx, createTextVNode, toDisplayString, useSSRContext, createVNode } from "vue";
import { ssrRenderAttrs, ssrRenderStyle, ssrRenderAttr, ssrRenderList, ssrInterpolate, ssrRenderComponent, ssrRenderClass } from "vue/server-renderer";
/* empty css               */
import { _ as _export_sfc } from "../entries/pages.mjs";
import { R as RequestOffer, M as Modules } from "./chunk-KgNpQYeb.js";
/* empty css               */
import { P as Partners } from "./chunk-CTcGLgUu.js";
import "@vue/server-renderer";
import "vue-router";
import "@vueuse/head";
import "vike/server";
/* empty css               */
/* empty css               */
import "pinia";
import "vue-i18n";
/* empty css               */
/*! src/assets/images/slider-img.svg [vike:pluginModuleBanner] */
const sliderBg = "/assets/static/slider-img.svI4Un5b.svg";
/*! src/assets/images/blur.png [vike:pluginModuleBanner] */
const _imports_0$1 = "/assets/static/blur.2jXie4wS.png";
/*! src/components/MainSlider.vue [vike:pluginModuleBanner] */
const _sfc_main$2 = {
  props: ["sliders"],
  data() {
    return {
      currentSlide: 0
    };
  },
  methods: {
    handleScrollToSection() {
      this.$emit("scroll-to-section");
    }
  },
  computed: {
    slideStyle() {
      if (this.currentSlide % 2 === 0) return {};
      return {
        backgroundImage: `url(${sliderBg})`,
        backgroundRepeat: "no-repeat",
        backgroundSize: "cover",
        backgroundPosition: "center"
      };
    }
  },
  created() {
    setInterval(() => {
      this.currentSlide = this.currentSlide < this.sliders.length - 1 ? this.currentSlide + 1 : 0;
    }, 5e3);
  }
};
function _sfc_ssrRender$2(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
  const _component_router_link = resolveComponent("router-link");
  _push(`<div${ssrRenderAttrs(mergeProps({ class: "-mt-24" }, _attrs))}><div class="slider-shell relative overflow-hidden py-14" style="${ssrRenderStyle([$options.slideStyle, { "background-color": "#EB5757" }])}">`);
  if ($data.currentSlide % 2 === 0) {
    _push(`<img class="w-full h-full absolute bottom-0"${ssrRenderAttr("src", _imports_0$1)} alt="blur background">`);
  } else {
    _push(`<!---->`);
  }
  _push(`<div class="flex transition-transform duration-700 ease-in-out w-full h-full relative" style="${ssrRenderStyle(`${_ctx.$i18n.locale === "en" ? `transform: translateX(-${$data.currentSlide * 100}%)` : `transform: translateX(${$data.currentSlide * 100}%)`}`)}"><!--[-->`);
  ssrRenderList($props.sliders, (slider, index) => {
    _push(`<div class="w-full h-full shrink-0 mt-20"><div class="grid md:grid-cols-2 grid-cols-1 gap-4 items-center h-full max-w-screen-2xl mx-auto xl:px-20 lg:px-16 md:px-12 sm:px-8 px-6"><div class="text-white md:order-1 order-2"><h1 class="lg:text-5xl sm:text-4xl text-3xl font-bold">${ssrInterpolate(slider[`title_${_ctx.$i18n.locale}`])}</h1><p class="lg:text-2xl text-xl font-light mt-4 ellipsis-2">${(slider[`content_${_ctx.$i18n.locale}`] ? slider[`content_${_ctx.$i18n.locale}`].replace(/\t/g, "    ").replace(/\r?\n/g, "<br>") : "") ?? ""}</p><div class="flex gap-4 md:mt-10 mt-8"><button class="text-snow bg-[#081639] border border-solid border-[#192F52] xl:text-xl md:text-lg font-medium rounded-md px-6 py-4 leading-5">${ssrInterpolate(_ctx.$t("Join Now"))}</button>`);
    if (slider.type === "category") {
      _push(ssrRenderComponent(_component_router_link, {
        to: { path: `/${_ctx.$i18n.locale}/sectors/${slider.category["slug_" + _ctx.$i18n.locale]}` },
        class: "text-snow bg-[#F8FAFF1A] border border-solid border-[#E1E4ED] xl:text-xl md:text-lg font-medium rounded-md p-4 leading-5"
      }, {
        default: withCtx((_, _push2, _parent2, _scopeId) => {
          if (_push2) {
            _push2(`${ssrInterpolate(_ctx.$t("Why Choose US"))}`);
          } else {
            return [
              createTextVNode(
                toDisplayString(_ctx.$t("Why Choose US")),
                1
                /* TEXT */
              )
            ];
          }
        }),
        _: 2
        /* DYNAMIC */
      }, _parent));
    } else if (slider.type === "module") {
      _push(ssrRenderComponent(_component_router_link, {
        to: { path: `/${_ctx.$i18n.locale}/modules/${slider.module["slug_" + _ctx.$i18n.locale]}` },
        class: "text-snow bg-[#F8FAFF1A] border border-solid border-[#E1E4ED] xl:text-xl md:text-lg font-medium rounded-md p-4 leading-5"
      }, {
        default: withCtx((_, _push2, _parent2, _scopeId) => {
          if (_push2) {
            _push2(`${ssrInterpolate(_ctx.$t("Why Choose US"))}`);
          } else {
            return [
              createTextVNode(
                toDisplayString(_ctx.$t("Why Choose US")),
                1
                /* TEXT */
              )
            ];
          }
        }),
        _: 2
        /* DYNAMIC */
      }, _parent));
    } else if (slider.type === "external") {
      _push(`<a${ssrRenderAttr("href", slider.link)} target="_blank" rel="noopener noreferrer" class="text-snow bg-[#F8FAFF1A] border border-solid border-[#E1E4ED] xl:text-xl md:text-lg font-medium rounded-md p-4 leading-5">${ssrInterpolate(_ctx.$t("Why Choose US"))}</a>`);
    } else {
      _push(`<!---->`);
    }
    _push(`</div></div><img${ssrRenderAttr("src", slider.image)} class="sm:h-96 w-auto m-auto md:order-2 order-1"${ssrRenderAttr("alt", slider[`title_${_ctx.$i18n.locale}`])}></div></div>`);
  });
  _push(`<!--]--></div><div class="flex gap-3 items-center justify-center mt-12 px-4 relative"><!--[-->`);
  ssrRenderList($props.sliders, (dot, index) => {
    _push(`<div><p class="${ssrRenderClass(`${index === $data.currentSlide ? "bg-amour" : "bg-arctic-dawn"} h-1 w-7 rounded-full cursor-pointer`)}"></p></div>`);
  });
  _push(`<!--]--></div></div></div>`);
}
const _sfc_setup$2 = _sfc_main$2.setup;
_sfc_main$2.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/MainSlider.vue");
  return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
};
const MainSlider = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["ssrRender", _sfc_ssrRender$2]]);
/*! src/components/Sectors.vue [vike:pluginModuleBanner] */
const _sfc_main$1 = {
  props: ["sectors"]
};
function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
  const _component_router_link = resolveComponent("router-link");
  _push(`<div${ssrRenderAttrs(_attrs)}><p class="font-bold text-legal-eagle text-3xl text-center sm:mb-10 mb-6">${ssrInterpolate(_ctx.$t("Sectors"))}</p><div class="grid sm:grid-cols-2 grid-cols-1 lg:gap-8 md:gap-6 gap-4"><!--[-->`);
  ssrRenderList($props.sectors, (sector, index) => {
    _push(`<div class="border border-solid border-[#E1E4ED] shadow rounded-lg group"><div class="relative overflow-hidden"><img${ssrRenderAttr("src", sector.image)}${ssrRenderAttr("alt", sector[`name_${_ctx.$i18n.locale}`])} class="w-full xl:h-[350px] md:h-60 h-48 object-cover rounded-lg transition-transform duration-700 group-hover:scale-110"><div class="absolute inset-0 bg-black rounded-t-lg opacity-0 group-hover:opacity-50 transition-opacity duration-700"></div></div><div class="xl:p-10 md:p-6 p-4 text-legal-eagle"><p class="font-bold sm:text-xl text-lg">${ssrInterpolate(sector[`name_${_ctx.$i18n.locale}`])}</p><p class="text-sm leading-6 md:mt-6 sm:mt-4 mt-2 ellipsis-3">${(sector[`content_${_ctx.$i18n.locale}`] ? sector[`content_${_ctx.$i18n.locale}`].replace(/\t/g, "    ").replace(/\r?\n/g, "<br>") : "") ?? ""}</p><div class="flex gap-1">`);
    _push(ssrRenderComponent(_component_router_link, {
      to: { path: `/${_ctx.$i18n.locale}/sectors/${sector["slug_" + _ctx.$i18n.locale]}` },
      class: "mt-4 bg-ambassador-blue font-medium text-white cursor-pointer flex items-center gap-1 rounded-full py-2 px-4 w-fit"
    }, {
      default: withCtx((_, _push2, _parent2, _scopeId) => {
        if (_push2) {
          _push2(`<span class="text-xs"${_scopeId}>${ssrInterpolate(_ctx.$t("Read more"))}</span><span class="material-symbols-outlined text-lg leading-none"${_scopeId}>${ssrInterpolate(_ctx.$i18n.locale === "en" ? "arrow_right_alt" : "arrow_left_alt")}</span>`);
        } else {
          return [
            createVNode(
              "span",
              { class: "text-xs" },
              toDisplayString(_ctx.$t("Read more")),
              1
              /* TEXT */
            ),
            createVNode(
              "span",
              { class: "material-symbols-outlined text-lg leading-none" },
              toDisplayString(_ctx.$i18n.locale === "en" ? "arrow_right_alt" : "arrow_left_alt"),
              1
              /* TEXT */
            )
          ];
        }
      }),
      _: 2
      /* DYNAMIC */
    }, _parent));
    _push(ssrRenderComponent(_component_router_link, {
      to: { path: `/${_ctx.$i18n.locale}/sectors/${sector["slug_" + _ctx.$i18n.locale]}`, hash: "#request-offer" },
      class: "mt-4 bg-amour font-medium text-white cursor-pointer flex items-center gap-1 rounded-full py-2 px-4 w-fit"
    }, {
      default: withCtx((_, _push2, _parent2, _scopeId) => {
        if (_push2) {
          _push2(`<span class="text-xs"${_scopeId}>${ssrInterpolate(_ctx.$t("Price quote"))}</span><span class="material-symbols-outlined text-lg leading-none"${_scopeId}>${ssrInterpolate(_ctx.$i18n.locale === "en" ? "arrow_right_alt" : "arrow_left_alt")}</span>`);
        } else {
          return [
            createVNode(
              "span",
              { class: "text-xs" },
              toDisplayString(_ctx.$t("Price quote")),
              1
              /* TEXT */
            ),
            createVNode(
              "span",
              { class: "material-symbols-outlined text-lg leading-none" },
              toDisplayString(_ctx.$i18n.locale === "en" ? "arrow_right_alt" : "arrow_left_alt"),
              1
              /* TEXT */
            )
          ];
        }
      }),
      _: 2
      /* DYNAMIC */
    }, _parent));
    _push(`</div></div></div>`);
  });
  _push(`<!--]--></div></div>`);
}
const _sfc_setup$1 = _sfc_main$1.setup;
_sfc_main$1.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/Sectors.vue");
  return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
};
const Sectors = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["ssrRender", _sfc_ssrRender$1]]);
/*! src/assets/images/robot-sm.svg [vike:pluginModuleBanner] */
const _imports_0 = "/assets/static/robot-sm.B_IhP2Uz.svg";
/*! src/assets/images/robot-lg.svg [vike:pluginModuleBanner] */
const _imports_1 = "/assets/static/robot-lg.CaVYsgBG.svg";
/*! src/views/HomePage.vue [vike:pluginModuleBanner] */
const _sfc_main = {
  data() {
    return {
      contactInfo: {},
      businessLine: {},
      sectors: [],
      modules: [],
      sliders: [],
      partners: [],
      successPartners: [],
      valueAdvantages: [],
      description: {},
      loading: false
    };
  },
  methods: {
    toAbsoluteUrl(url) {
      if (!url) return url;
      if (url.startsWith("http://") || url.startsWith("https://")) return url;
      if (url.startsWith("//")) return `https:${url}`;
      return `https://value.modern-speed.com${url.startsWith("/") ? "" : "/"}${url}`;
    },
    async loadHomePage() {
      this.loading = true;
      try {
        const response = await axios.get(`https://admin.valueerp.net/api/homePage`);
        this.sliders = response.data.data.data.map((slider) => ({
          ...slider,
          image: this.toAbsoluteUrl(slider.image)
        }));
        this.contactInfo = response.data.data.contact_us_information;
        this.partners = response.data.data.partners;
        this.successPartners = response.data.data.success_partners;
        this.businessLine = response.data.data.business_line;
        this.sectors = response.data.data.sectors_categories;
        this.modules = response.data.data.modules;
        this.valueAdvantages = response.data.data.value_advantages;
        this.description = response.data.data.request_offer_desc;
      } catch (error) {
      } finally {
        this.loading = false;
      }
    },
    scrollToRequestOfferSection() {
      const target = this.$refs.requestOffer;
      if (target) {
        target.scrollIntoView({
          behavior: "smooth",
          block: "start"
        });
      }
    }
  },
  components: {
    MainSlider,
    Modules,
    Sectors,
    RequestOffer,
    Partners
  },
  async serverPrefetch() {
    await this.loadHomePage();
  },
  created() {
    if (typeof window !== "undefined") {
      this.loadHomePage();
    }
  }
};
function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
  const _component_main_slider = resolveComponent("main-slider");
  const _component_modules = resolveComponent("modules");
  const _component_sectors = resolveComponent("sectors");
  const _component_request_offer = resolveComponent("request-offer");
  const _component_partners = resolveComponent("partners");
  _push(`<div${ssrRenderAttrs(_attrs)}><!-- Loading -->`);
  if ($data.loading) {
    _push(`<div class="fixed inset-0 h-dvh flex items-center justify-center bg-white bg-opacity-90 z-50"><div class="border-4 border-y-ambassador-blue border-x-inherit border-solid w-10 h-10 rounded-full animate-spin"></div></div>`);
  } else {
    _push(`<!---->`);
  }
  _push(ssrRenderComponent(_component_main_slider, {
    onScrollToSection: $options.scrollToRequestOfferSection,
    sliders: $data.sliders
  }, null, _parent));
  if ($data.modules.length > 0) {
    _push(ssrRenderComponent(_component_modules, {
      modules: $data.modules,
      class: "mt-20 max-w-screen-2xl mx-auto xl:px-32 lg:px-16 md:px-12 sm:px-8 px-6"
    }, null, _parent));
  } else {
    _push(`<!---->`);
  }
  if ($data.sectors.length > 0) {
    _push(ssrRenderComponent(_component_sectors, {
      sectors: $data.sectors,
      class: "mt-20 max-w-screen-2xl mx-auto xl:px-32 lg:px-16 md:px-12 sm:px-8 px-6"
    }, null, _parent));
  } else {
    _push(`<!---->`);
  }
  _push(`<div class="mt-20 pb-20">`);
  _push(ssrRenderComponent(_component_request_offer, {
    description: $data.description,
    contactInfo: $data.contactInfo
  }, null, _parent));
  _push(`</div><!-- why do you need value+ -->`);
  if ($data.valueAdvantages.length > 0) {
    _push(`<div class="mt-20 max-w-screen-2xl mx-auto xl:px-32 lg:px-16 md:px-12 sm:px-8 px-6"><div class="grid xl:grid-cols-3 sm:grid-cols-2 grid-cols-1"><div class="sm:p-6 p-4 flex items-center justify-center border-e border-solid border-[#EBEBEB]"><p class="font-medium sm:text-3xl text-2xl text-[#171717]">${ssrInterpolate(_ctx.$t("why do you need value+"))}</p></div><div class="xl:block hidden border-e border-solid border-[#EBEBEB]"></div><div class="sm:p-6 p-4 flex items-end justify-center"><img${ssrRenderAttr("src", _imports_0)} alt="robot image"><img${ssrRenderAttr("src", _imports_1)} alt="small robot image"></div><!--[-->`);
    ssrRenderList($data.valueAdvantages, (item, index) => {
      _push(`<div class="sm:p-6 p-4 border-e border-solid border-[#EBEBEB]"><div class="flex items-center gap-2 text-[#666666]"><img${ssrRenderAttr("src", item.image)} class="w-5 h-5 shrink-0"${ssrRenderAttr("alt", item[`title_${_ctx.$i18n.locale}`])}><p>${ssrInterpolate(item[`title_${_ctx.$i18n.locale}`])}</p></div><p class="mt-3 text-[#171717] sm:text-lg font-medium leading-tight">${ssrInterpolate(item[`content_${_ctx.$i18n.locale}`])}</p></div>`);
    });
    _push(`<!--]--></div></div>`);
  } else {
    _push(`<!---->`);
  }
  if ($data.partners.length > 0) {
    _push(ssrRenderComponent(_component_partners, {
      list: $data.partners,
      title: "Our Clients",
      class: "mt-20 max-w-screen-2xl mx-auto xl:px-32 lg:px-16 md:px-12 sm:px-8 px-6"
    }, null, _parent));
  } else {
    _push(`<!---->`);
  }
  _push(`<div class="mt-20 relative bg-[#030208] -mb-[10%]"><img${ssrRenderAttr("src", $data.businessLine.image)} class="max-w-screen-xl w-full mx-auto xl:px-32 lg:px-16 md:px-12" alt="business line"><div class="bg-white h-[16%] w-full absolute bottom-0"></div></div><!-- partners -->`);
  if ($data.partners.length > 0) {
    _push(`<div class="mt-20 max-w-screen-2xl mx-auto xl:px-32 lg:px-16 md:px-12 sm:px-8 px-6"><div class="relative"><p class="material-symbols-rounded absolute -top-6 ltr:-left-6 rtl:-right-6 font-thin text-[#A8A8A8] text-5xl">add</p><div class="grid xl:grid-cols-6 sm:grid-cols-4 grid-cols-2"><div class="sm:col-span-2 col-span-1 lg:p-8 sm:p-6 p-4 flex items-center justify-center border-b border-solid border-[#EBEBEB]"><p class="font-medium sm:text-3xl text-2xl text-[#171717]">${ssrInterpolate(_ctx.$t("Partners of Success"))}</p></div><!--[-->`);
    ssrRenderList($data.successPartners, (item, index) => {
      _push(`<div class="flex items-center justify-center lg:p-8 sm:p-6 p-4 border-b border-s border-solid border-[#EBEBEB]"><img${ssrRenderAttr("src", item.image)}${ssrRenderAttr("alt", `image ${item.id}`)}></div>`);
    });
    _push(`<!--]--></div><p class="material-symbols-rounded absolute -bottom-6 ltr:-right-6 rtl:-left-6 font-thin text-[#A8A8A8] text-5xl">add</p></div></div>`);
  } else {
    _push(`<!---->`);
  }
  _push(`</div>`);
}
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/views/HomePage.vue");
  return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
const HomePage = /* @__PURE__ */ _export_sfc(_sfc_main, [["ssrRender", _sfc_ssrRender]]);
export {
  HomePage as default
};
