import { defineComponent, onMounted, mergeProps, unref, withCtx, createTextVNode, toDisplayString, useSSRContext } from "vue";
import { ssrRenderAttrs, ssrRenderClass, ssrRenderList, ssrInterpolate, ssrRenderComponent, ssrRenderAttr, ssrRenderStyle } from "vue/server-renderer";
import { Link } from "@inertiajs/vue3";
import Swiper from "swiper/bundle";
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "CategoryList2",
  __ssrInlineRender: true,
  props: {
    status: {},
    component_id: {},
    data: {}
  },
  setup(__props) {
    const props = __props;
    const swiperArticleSliderContainer = () => {
      new Swiper(".swiper-smart-product-slider-" + props.component_id, {
        slidesPerView: 3,
        spaceBetween: 15,
        autoplay: {
          delay: 8e3
        },
        loop: props.data.category_list.categories != null ? props.data.category_list.categories.length > 3 ? true : false : false,
        breakpoints: {
          120: {
            slidesPerView: 1,
            spaceBetween: 15
          },
          600: {
            slidesPerView: 1,
            spaceBetween: 15
          },
          768: {
            slidesPerView: 2,
            spaceBetween: 15
          },
          992: {
            slidesPerView: 3,
            spaceBetween: 18
          }
        },
        observer: true
      });
    };
    onMounted(() => {
      swiperArticleSliderContainer();
    });
    return (_ctx, _push, _parent, _attrs) => {
      var _a, _b, _c;
      _push(`<div${ssrRenderAttrs(mergeProps({
        id: "component-" + _ctx.component_id,
        class: { "container smart-product-container": true, readonly: _ctx.status == "dev" },
        style: "margin-top:" + ((_a = _ctx.data.style) == null ? void 0 : _a.margin.top) + "px; margin-bottom:" + (((_b = _ctx.data.style) == null ? void 0 : _b.margin.bottom) != null ? (_c = _ctx.data.style) == null ? void 0 : _c.margin.bottom : 20) + "px;"
      }, _attrs))}><div class="smart-product--card"><div class="${ssrRenderClass("swiper swiper-smart-product-slider swiper-smart-product-slider-" + _ctx.component_id)}"><div class="swiper-wrapper">`);
      if (_ctx.data.category_list.categories != void 0 && _ctx.data.category_list.categories.length > 0) {
        _push(`<!--[-->`);
        ssrRenderList(_ctx.data.category_list.categories, (category) => {
          _push(`<div class="swiper-slide card"><div class="smart-product--header d-flex align-items-start justify-content-between"><div><div class="smart-product--title mb-0">${ssrInterpolate(category.title)}</div><span class="smart-product--description lts-05">${ssrInterpolate(_ctx.$t("messages.sentence.suggested_products_from_categories"))}</span></div>`);
          _push(ssrRenderComponent(unref(Link), {
            class: "text-white bg-primary badge link fs-9 shadow-primary",
            href: _ctx.route("main.products.index", { cat: category.slug })
          }, {
            default: withCtx((_, _push2, _parent2, _scopeId) => {
              if (_push2) {
                _push2(`${ssrInterpolate(_ctx.$t("messages.word.more"))}`);
              } else {
                return [
                  createTextVNode(toDisplayString(_ctx.$t("messages.word.more")), 1)
                ];
              }
            }),
            _: 2
          }, _parent));
          _push(`</div><div class="smart-product--section"><!--[-->`);
          ssrRenderList(category.products, (product) => {
            _push(`<div class="product-square card flex-grow-1"><div class="card-body d-flex flex-column el-center"><div class="product-thumbnail"><img class="product--img ms-0"${ssrRenderAttr("src", product.get_images[0]["link"])}${ssrRenderAttr("alt", product.title)} loading="lazy"></div><h3 class="product--title lts-05 mt-3 mb-2 ms-0">${ssrInterpolate(product.title)}</h3><div class="product-footer d-flex justify-content-between"><div class="d-flex flex-row align-items-end"><span class="product-rating-average">${ssrInterpolate(product.comments_info.rating == "0" ? "-" : product.comments_info.rating)} <i class="ri-star-fill"></i></span></div>`);
            if (!product.in_stock_status) {
              _push(`<div class="d-flex flex-column justify-content-end"><span class="product-price-now lts-05 fs-8">${ssrInterpolate(_ctx.$t("messages.sentence.inventory_inquiry"))}</span></div>`);
            } else if (product.inventory) {
              _push(`<!--[-->`);
              if (product.best_normal_price.discount_price != null) {
                _push(`<div class="d-flex flex-column justify-content-end"><span class="product-price-now lts-05">${ssrInterpolate(product.best_normal_price.discount_price)} <span class="unit unit-sm"></span></span></div>`);
              } else {
                _push(`<div class="d-flex flex-column justify-content-end"><span class="product-price-now lts-05">${ssrInterpolate(product.best_normal_price.price)} <span class="unit unit-sm"></span></span></div>`);
              }
              _push(`<!--]-->`);
            } else {
              _push(`<div class="d-flex flex-column justify-content-end"><span class="product-price-now lts-05 fs-8">${ssrInterpolate(_ctx.$t("messages.word.non_existent"))}</span></div>`);
            }
            _push(`</div>`);
            if (product.in_stock_status && product.inventory && product.best_normal_price.discount_price != null) {
              _push(`<div class="discount-percent bg-secondary shadow-secondary shadow-1">${ssrInterpolate(product.best_normal_price.percent)}<i class="ri-percent-fill"></i></div>`);
            } else {
              _push(`<!---->`);
            }
            _push(ssrRenderComponent(unref(Link), {
              class: "product-link",
              href: _ctx.route("main.products.show", product.slug)
            }, null, _parent));
            _push(`<ul class="product-colors"><!--[-->`);
            ssrRenderList(Array.isArray(product.unique_color) ? product.unique_color.slice(0, 6) : Object.values(product.unique_color || {}).slice(0, 6), (color, index) => {
              _push(`<li style="${ssrRenderStyle("background-color:" + color.value.color)}" data-bs-toggle="tooltip" data-bs-placement="top"${ssrRenderAttr("title", color.value.label)} class="${ssrRenderClass({ "color-is-white": color.value.color === "#ffffff" })}"></li>`);
            });
            _push(`<!--]-->`);
            if ((Array.isArray(product.unique_color) ? product.unique_color.length : Object.keys(product.unique_color || {}).length) > 6) {
              _push(`<li class="more-colors" title="مشاهده رنگ‌های بیشتر"> + </li>`);
            } else {
              _push(`<!---->`);
            }
            _push(`</ul></div></div>`);
          });
          _push(`<!--]--></div></div>`);
        });
        _push(`<!--]-->`);
      } else {
        _push(`<!--[-->`);
        ssrRenderList(new Array(4), (temp, index) => {
          _push(`<div class="${ssrRenderClass({ "swiper-slide card": true, readonly: _ctx.status == "dev" })}"><div class="smart-product--header d-flex align-items-start justify-content-between"><div><div><div class="smart-product--title sk sk-text d-inline-block">نام دسته‌بندی</div></div><span class="smart-product--description lts-05 sk sk-text-sm">محصولات پیشنهادی از دسته‌بندی</span></div><a class="text-white bg-primary badge link fs-9 shadow-primary" href="#">${ssrInterpolate(_ctx.$t("messages.word.more"))}</a></div><div class="smart-product--section"><!--[-->`);
          ssrRenderList(new Array(4), (t, i) => {
            _push(`<div class="product-square card flex-grow-1"><div class="card-body d-flex flex-column el-center"><div class="product-thumbnail"><img class="product--img ms-0" style="${ssrRenderStyle({ "height": "240px" })}"${ssrRenderAttr("src", _ctx.$page.props.appUrl + "/img/temp/pre-load-category.png")} loading="lazy"></div><h3 class="product--title lts-05 mt-3 mb-2 ms-0 sk sk-sm">لورم ایپسوم متن ساختگی با سادگی نامفهوم برای طراحان وب</h3><div class="product-footer d-flex justify-content-between"><div class="d-flex flex-row align-items-end"><span class="product-rating-average"><span class="sk ms-1">4.2</span><i class="ri-star-fill"></i></span></div><span class="product-price-now lts-05"><span class="sk sk-sm">2.500.000</span><span class="unit unit-sm"></span></span></div><div class="discount-percent bg-secondary shadow-secondary shadow-1">‌ ‌ ‌ ‌<i class="ri-percent-fill"></i></div><ul class="product-colors"><!--[-->`);
            ssrRenderList(new Array(2), (c, ci) => {
              _push(`<li style="${ssrRenderStyle({ "background-color": "#e4e4e4" })}"></li>`);
            });
            _push(`<!--]--></ul></div></div>`);
          });
          _push(`<!--]--></div></div>`);
        });
        _push(`<!--]-->`);
      }
      _push(`</div></div></div></div>`);
    };
  }
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("resources/js/Components/Main/UI/Lists/Categories/CategoryList2.vue");
  return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
export {
  _sfc_main as default
};
