cloudcommerce 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/package.json +10 -10
  3. package/packages/api/package.json +1 -1
  4. package/packages/apps/correios/package.json +2 -2
  5. package/packages/apps/custom-payment/package.json +1 -1
  6. package/packages/apps/custom-shipping/package.json +1 -1
  7. package/packages/apps/datafrete/package.json +2 -2
  8. package/packages/apps/discounts/package.json +1 -1
  9. package/packages/apps/emails/package.json +1 -1
  10. package/packages/apps/fb-conversions/package.json +1 -1
  11. package/packages/apps/frenet/package.json +2 -2
  12. package/packages/apps/galaxpay/package.json +2 -2
  13. package/packages/apps/google-analytics/package.json +2 -2
  14. package/packages/apps/infinitepay/package.json +2 -2
  15. package/packages/apps/jadlog/package.json +2 -2
  16. package/packages/apps/loyalty-points/package.json +1 -1
  17. package/packages/apps/melhor-envio/package.json +2 -2
  18. package/packages/apps/mercadopago/package.json +2 -2
  19. package/packages/apps/pagarme/package.json +2 -2
  20. package/packages/apps/paghiper/package.json +2 -2
  21. package/packages/apps/pix/package.json +2 -2
  22. package/packages/apps/tiny-erp/package.json +2 -2
  23. package/packages/apps/webhooks/package.json +2 -2
  24. package/packages/cli/package.json +2 -2
  25. package/packages/config/package.json +1 -1
  26. package/packages/emails/package.json +3 -3
  27. package/packages/events/package.json +1 -1
  28. package/packages/firebase/package.json +1 -1
  29. package/packages/i18n/package.json +1 -1
  30. package/packages/modules/package.json +3 -3
  31. package/packages/passport/package.json +1 -1
  32. package/packages/ssr/package.json +5 -5
  33. package/packages/storefront/dist/client/_astro/{PitchBar.457658a3.js → PitchBar.5ced676e.js} +1 -1
  34. package/packages/storefront/dist/client/_astro/{Prices.a1302bf9.js → Prices.2bd87845.js} +1 -1
  35. package/packages/storefront/dist/client/_astro/{ProductCard.1a45764a.js → ProductCard.48f0f5ba.js} +1 -1
  36. package/packages/storefront/dist/client/_astro/ShopHeader.05d64cc8.js +4 -0
  37. package/packages/storefront/dist/client/_astro/_...slug_.a594715c.css +1 -0
  38. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.43eaff51.js +1 -0
  39. package/packages/storefront/dist/client/_astro/{client.b854166f.js → client.79615b8a.js} +1 -1
  40. package/packages/storefront/dist/client/_astro/{format-money.6f464cee.js → format-money.060d67ef.js} +1 -1
  41. package/packages/storefront/dist/client/_astro/{index.a500792d.js → index.3243538d.js} +1 -1
  42. package/packages/storefront/dist/client/_astro/{modules-info.80ae4e30.js → modules-info.01f8d523.js} +1 -1
  43. package/packages/storefront/dist/client/_astro/{runtime-dom.esm-bundler.acde10ec.js → runtime-dom.esm-bundler.cb4db78a.js} +1 -1
  44. package/packages/storefront/dist/client/fallback/index.html +5 -5
  45. package/packages/storefront/dist/client/sw.js +1 -1
  46. package/packages/storefront/dist/server/chunks/{astro.7d9d5f6e.mjs → astro.a9f695c0.mjs} +16 -3
  47. package/packages/storefront/dist/server/chunks/pages/{all.e0f284c9.mjs → all.f15e2c35.mjs} +550 -68
  48. package/packages/storefront/dist/server/chunks/{prerender.9f6cbb00.mjs → prerender.2527d85d.mjs} +0 -0
  49. package/packages/storefront/dist/server/entry.mjs +6 -5
  50. package/packages/storefront/package.json +10 -10
  51. package/packages/storefront/src/lib/composables/use-shop-header-submenu.ts +53 -0
  52. package/packages/storefront/src/lib/composables/use-shop-header.ts +55 -7
  53. package/packages/storefront/src/lib/layouts/PagesHeader.astro +3 -0
  54. package/packages/storefront/src/lib/ssr-context.ts +4 -2
  55. package/packages/storefront/src/lib/state/use-storage.ts +10 -1
  56. package/packages/types/package.json +1 -1
  57. package/packages/storefront/dist/client/_astro/ShopHeader.0a6766ac.js +0 -1
  58. package/packages/storefront/dist/client/_astro/_...slug_.6721f699.css +0 -1
  59. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.6da04e63.js +0 -1
@@ -9,7 +9,7 @@ import 'node:os';
9
9
  import sizeOf from 'image-size';
10
10
  import 'magic-string';
11
11
  import 'node:stream';
12
- import { c as createAstro, a as createComponent, r as renderTemplate, b as addAttribute, u as unescapeHTML, m as maybeRenderHead, d as renderSlot, e as renderComponent, f as renderHead, F as Fragment, s as spreadAttributes } from '../astro.7d9d5f6e.mjs';
12
+ import { c as createAstro, a as createComponent, r as renderTemplate, b as addAttribute, u as unescapeHTML, m as maybeRenderHead, d as renderSlot, e as renderComponent, f as renderHead, F as Fragment, s as spreadAttributes } from '../astro.a9f695c0.mjs';
13
13
  import api from '@cloudcommerce/api';
14
14
  import { reactive, computed, defineComponent, inject, useSSRContext, mergeProps, ref, watch, toRef, onMounted, onBeforeUnmount, provide, createVNode, resolveDynamicComponent, withCtx, renderSlot as renderSlot$1, withDirectives, vShow, openBlock, createBlock, createCommentVNode, Fragment as Fragment$1, renderList, resolveComponent, withModifiers, Teleport, toDisplayString, createTextVNode } from 'vue';
15
15
  import { img, price, formatMoney, nickname, onPromotion } from '@ecomplus/utils';
@@ -19,6 +19,7 @@ import fs, { readFileSync } from 'node:fs';
19
19
  import config from '@cloudcommerce/config';
20
20
  import { resolve as resolve$1 } from 'path';
21
21
  /* empty css */import { useScroll, useElementHover, useDebounceFn, useTimeout, promiseTimeout } from '@vueuse/core';
22
+ import { Popover, PopoverButton, PopoverPanel } from '@headlessui/vue';
22
23
 
23
24
  const _export_sfc = (sfc, props) => {
24
25
  const target = sfc.__vccOpts || sfc;
@@ -29,7 +30,7 @@ const _export_sfc = (sfc, props) => {
29
30
  };
30
31
 
31
32
  function isOutputFormat(value) {
32
- return ["avif", "jpeg", "jpg", "png", "webp"].includes(value);
33
+ return ["avif", "jpeg", "jpg", "png", "webp", "svg"].includes(value);
33
34
  }
34
35
  function isOutputFormatSupportsAlpha(value) {
35
36
  return ["avif", "png", "webp"].includes(value);
@@ -132,6 +133,12 @@ class BaseSSRService {
132
133
 
133
134
  class SharpService extends BaseSSRService {
134
135
  async transform(inputBuffer, transform) {
136
+ if (transform.format === "svg") {
137
+ return {
138
+ data: inputBuffer,
139
+ format: transform.format
140
+ };
141
+ }
135
142
  const sharpImage = sharp$1(inputBuffer, { failOnError: false, pages: -1 });
136
143
  sharpImage.rotate();
137
144
  if (transform.width || transform.height) {
@@ -304,7 +311,7 @@ const getCMS = () => {
304
311
  };
305
312
 
306
313
  const _getConfig = () => {
307
- const { VITE_ECOM_STORE_ID } = (Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true},{ECOM_STORE_ID:process.env.ECOM_STORE_ID,})) || process.env;
314
+ const { VITE_ECOM_STORE_ID } = (Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true,"SITE":"\"https://ecom2-002.web.app\"","SSR":true},{ECOM_STORE_ID:process.env.ECOM_STORE_ID,})) || process.env;
308
315
  if (VITE_ECOM_STORE_ID) {
309
316
  config.set({ storeId: Number(VITE_ECOM_STORE_ID) });
310
317
  }
@@ -353,7 +360,9 @@ const _getConfig = () => {
353
360
  const emitter = new EventEmitter();
354
361
  const getConfig = _getConfig;
355
362
  if (!globalThis.api_prefetch_endpoints) {
356
- globalThis.api_prefetch_endpoints = ["categories"];
363
+ globalThis.api_prefetch_endpoints = [
364
+ "categories?fields=_id,name,slug,parent,icon,pictures.0"
365
+ ];
357
366
  }
358
367
  if (!globalThis.storefront) {
359
368
  globalThis.storefront = {
@@ -409,7 +418,7 @@ const loadPageContext = async (Astro, {
409
418
  apiState[`${apiResource}/${apiDoc._id}`] = apiDoc;
410
419
  }
411
420
  prefetchResponses.forEach(({ config: { endpoint }, data }) => {
412
- apiState[endpoint] = data.result || data;
421
+ apiState[endpoint.replace(/\?.*$/, "")] = data.result || data;
413
422
  });
414
423
  } catch (err) {
415
424
  const error = err;
@@ -560,7 +569,7 @@ async function getImage$1(transform) {
560
569
  }
561
570
  const resolved = await resolveTransform(transform);
562
571
  const attributes = await loader.getImageAttributes(resolved);
563
- const isDev = (_b = (Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true},{SSR:true,}))) == null ? void 0 : _b.DEV;
572
+ const isDev = (_b = (Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true,"SITE":"\"https://ecom2-002.web.app\"","SSR":true},{SSR:true,}))) == null ? void 0 : _b.DEV;
564
573
  const isLocalImage = !isRemoteImage(resolved.src);
565
574
  const _loader = isDev && isLocalImage ? globalThis.astroImage.defaultLoader : loader;
566
575
  if (!_loader) {
@@ -652,7 +661,7 @@ async function getPicture(params) {
652
661
  const tryImageSize = (src) => {
653
662
  let dimensions = {};
654
663
  if (typeof src === "string" && src.startsWith("/")) {
655
- const { STOREFRONT_BASE_DIR } = Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true}, { STOREFRONT_BASE_DIR: process.env.STOREFRONT_BASE_DIR });
664
+ const { STOREFRONT_BASE_DIR } = Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true,"SITE":"\"https://ecom2-002.web.app\"","SSR":true}, { STOREFRONT_BASE_DIR: process.env.STOREFRONT_BASE_DIR });
656
665
  try {
657
666
  dimensions = sizeOf(resolve$1(STOREFRONT_BASE_DIR, `public${src}`));
658
667
  } catch (e) {
@@ -1052,7 +1061,7 @@ const usePitchBar = (props) => {
1052
1061
 
1053
1062
  const carouselKey = Symbol("carousel");
1054
1063
 
1055
- const _sfc_main$a = defineComponent({
1064
+ const _sfc_main$c = defineComponent({
1056
1065
  __name: "CarouselControl",
1057
1066
  props: {
1058
1067
  direction: { default: 1 }
@@ -1065,7 +1074,7 @@ const _sfc_main$a = defineComponent({
1065
1074
  return __returned__;
1066
1075
  }
1067
1076
  });
1068
- function _sfc_ssrRender$a(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1077
+ function _sfc_ssrRender$c(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1069
1078
  _push(`<button${ssrRenderAttrs(mergeProps({
1070
1079
  type: "button",
1071
1080
  "aria-label": $props.direction > 0 ? "Pr\xF3ximo" : "Anterior",
@@ -1076,15 +1085,15 @@ function _sfc_ssrRender$a(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1076
1085
  }, _push, _parent);
1077
1086
  _push(`</button>`);
1078
1087
  }
1079
- const _sfc_setup$a = _sfc_main$a.setup;
1080
- _sfc_main$a.setup = (props, ctx) => {
1088
+ const _sfc_setup$c = _sfc_main$c.setup;
1089
+ _sfc_main$c.setup = (props, ctx) => {
1081
1090
  const ssrContext = useSSRContext();
1082
1091
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/CarouselControl.vue");
1083
- return _sfc_setup$a ? _sfc_setup$a(props, ctx) : void 0;
1092
+ return _sfc_setup$c ? _sfc_setup$c(props, ctx) : void 0;
1084
1093
  };
1085
- const CarouselControl = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["ssrRender", _sfc_ssrRender$a]]);
1094
+ const CarouselControl = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["ssrRender", _sfc_ssrRender$c]]);
1086
1095
 
1087
- const _sfc_main$9 = defineComponent({
1096
+ const _sfc_main$b = defineComponent({
1088
1097
  __name: "Carousel",
1089
1098
  props: {
1090
1099
  as: { default: "ul" },
@@ -1221,7 +1230,7 @@ const _sfc_main$9 = defineComponent({
1221
1230
  return __returned__;
1222
1231
  }
1223
1232
  });
1224
- function _sfc_ssrRender$9(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1233
+ function _sfc_ssrRender$b(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1225
1234
  _push(`<div${ssrRenderAttrs(mergeProps({
1226
1235
  ref: "carousel",
1227
1236
  "data-carousel": ""
@@ -1275,15 +1284,15 @@ function _sfc_ssrRender$9(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1275
1284
  }, _push, _parent);
1276
1285
  _push(`</div>`);
1277
1286
  }
1278
- const _sfc_setup$9 = _sfc_main$9.setup;
1279
- _sfc_main$9.setup = (props, ctx) => {
1287
+ const _sfc_setup$b = _sfc_main$b.setup;
1288
+ _sfc_main$b.setup = (props, ctx) => {
1280
1289
  const ssrContext = useSSRContext();
1281
1290
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/Carousel.vue");
1282
- return _sfc_setup$9 ? _sfc_setup$9(props, ctx) : void 0;
1291
+ return _sfc_setup$b ? _sfc_setup$b(props, ctx) : void 0;
1283
1292
  };
1284
- const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["ssrRender", _sfc_ssrRender$9]]);
1293
+ const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["ssrRender", _sfc_ssrRender$b]]);
1285
1294
 
1286
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1295
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
1287
1296
  __name: "PitchBar",
1288
1297
  props: {
1289
1298
  slides: null
@@ -1300,7 +1309,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1300
1309
  return __returned__;
1301
1310
  }
1302
1311
  });
1303
- function _sfc_ssrRender$8(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1312
+ function _sfc_ssrRender$a(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1304
1313
  _push(`<div${ssrRenderAttrs(mergeProps({ class: "bg-base-100 relative z-1" }, _attrs))}><div class="container md:w-2/3 mx-auto px-3 py-1">`);
1305
1314
  _push(ssrRenderComponent($setup["Carousel"], {
1306
1315
  autoplay: $setup.countValidSlides > 1 ? 7e3 : null
@@ -1387,13 +1396,13 @@ function _sfc_ssrRender$8(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1387
1396
  }, _parent));
1388
1397
  _push(`</div></div>`);
1389
1398
  }
1390
- const _sfc_setup$8 = _sfc_main$8.setup;
1391
- _sfc_main$8.setup = (props, ctx) => {
1399
+ const _sfc_setup$a = _sfc_main$a.setup;
1400
+ _sfc_main$a.setup = (props, ctx) => {
1392
1401
  const ssrContext = useSSRContext();
1393
1402
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/PitchBar.vue");
1394
- return _sfc_setup$8 ? _sfc_setup$8(props, ctx) : void 0;
1403
+ return _sfc_setup$a ? _sfc_setup$a(props, ctx) : void 0;
1395
1404
  };
1396
- const PitchBar = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["ssrRender", _sfc_ssrRender$8]]);
1405
+ const PitchBar = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["ssrRender", _sfc_ssrRender$a]]);
1397
1406
 
1398
1407
  const useStickyHeader = (props) => {
1399
1408
  const {
@@ -1437,21 +1446,49 @@ const useStickyHeader = (props) => {
1437
1446
  };
1438
1447
  };
1439
1448
 
1440
- const filterMainCategories = (categories) => {
1441
- return categories.filter(({ slug, parent }) => {
1449
+ const filterMainCategories = (categories, featuredSlugs) => {
1450
+ const mainCategories = categories.filter(({ slug, parent }) => {
1442
1451
  return slug && !parent;
1443
1452
  });
1453
+ if (featuredSlugs?.length) {
1454
+ mainCategories.sort((a, b) => {
1455
+ const indexA = featuredSlugs.indexOf(a.slug);
1456
+ const indexB = featuredSlugs.indexOf(b.slug);
1457
+ if (indexA > -1) {
1458
+ if (indexB === -1 || indexA < indexB)
1459
+ return -1;
1460
+ return 1;
1461
+ }
1462
+ if (indexB > -1)
1463
+ return 1;
1464
+ return 0;
1465
+ });
1466
+ }
1467
+ return mainCategories;
1444
1468
  };
1445
- const filterSubcategories = (categories, parentCategory) => {
1446
- return categories.filter(({ slug, parent }) => {
1469
+ const filterSubcategories = (categories, parentCategory, isAlphabeticalSort = false) => {
1470
+ const subcategories = categories.filter(({ slug, parent }) => {
1447
1471
  if (slug && parent) {
1448
1472
  return parent._id === parentCategory._id || parent.slug && parent.slug === parentCategory.slug;
1449
1473
  }
1450
1474
  return false;
1451
1475
  });
1476
+ if (isAlphabeticalSort) {
1477
+ subcategories.sort((a, b) => {
1478
+ if (a.name < b.name)
1479
+ return -1;
1480
+ return 1;
1481
+ });
1482
+ }
1483
+ return subcategories;
1452
1484
  };
1453
- const useShopHeader = (props) => {
1454
- const { header } = props;
1485
+ const useShopHeader = ({
1486
+ header,
1487
+ categories,
1488
+ menuCategorySlugs,
1489
+ menuRandomCategories = 7,
1490
+ isAlphabeticalSortSubmenu
1491
+ }) => {
1455
1492
  const {
1456
1493
  isSticky,
1457
1494
  staticHeight,
@@ -1460,9 +1497,13 @@ const useShopHeader = (props) => {
1460
1497
  const positionY = computed(() => {
1461
1498
  return isSticky.value ? header.value.offsetHeight : staticY.value;
1462
1499
  });
1463
- const mainCategories = filterMainCategories(props.categories);
1500
+ const mainCategories = filterMainCategories(categories, menuCategorySlugs);
1464
1501
  const getSubcategories = (parentCategory) => {
1465
- return filterSubcategories(props.categories, parentCategory);
1502
+ return filterSubcategories(
1503
+ categories,
1504
+ parentCategory,
1505
+ !!isAlphabeticalSortSubmenu
1506
+ );
1466
1507
  };
1467
1508
  const getCategoryTree = (parentCategory) => {
1468
1509
  return {
@@ -1473,6 +1514,17 @@ const useShopHeader = (props) => {
1473
1514
  };
1474
1515
  };
1475
1516
  const categoryTrees = mainCategories.map(getCategoryTree);
1517
+ let countRandom = 0;
1518
+ const inlineMenuTrees = categoryTrees.filter(({ slug }) => {
1519
+ if (menuCategorySlugs?.includes(slug)) {
1520
+ return true;
1521
+ }
1522
+ if (countRandom < menuRandomCategories) {
1523
+ countRandom += 1;
1524
+ return true;
1525
+ }
1526
+ return false;
1527
+ });
1476
1528
  const isSidenavOpen = ref(false);
1477
1529
  return {
1478
1530
  isSticky,
@@ -1483,11 +1535,12 @@ const useShopHeader = (props) => {
1483
1535
  getSubcategories,
1484
1536
  getCategoryTree,
1485
1537
  categoryTrees,
1538
+ inlineMenuTrees,
1486
1539
  isSidenavOpen
1487
1540
  };
1488
1541
  };
1489
1542
 
1490
- const _sfc_main$7 = defineComponent({
1543
+ const _sfc_main$9 = defineComponent({
1491
1544
  __name: "Drawer",
1492
1545
  props: {
1493
1546
  modelValue: { type: Boolean, default: false },
@@ -1549,7 +1602,7 @@ const _sfc_main$7 = defineComponent({
1549
1602
  return __returned__;
1550
1603
  }
1551
1604
  });
1552
- function _sfc_ssrRender$7(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1605
+ function _sfc_ssrRender$9(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1553
1606
  const _component_Fade = resolveComponent("Fade");
1554
1607
  _push(ssrRenderComponent(_component_Fade, mergeProps({
1555
1608
  slide: $setup.slideTo,
@@ -1646,15 +1699,18 @@ function _sfc_ssrRender$7(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1646
1699
  _: 3
1647
1700
  }, _parent));
1648
1701
  }
1649
- const _sfc_setup$7 = _sfc_main$7.setup;
1650
- _sfc_main$7.setup = (props, ctx) => {
1702
+ const _sfc_setup$9 = _sfc_main$9.setup;
1703
+ _sfc_main$9.setup = (props, ctx) => {
1651
1704
  const ssrContext = useSSRContext();
1652
1705
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/Drawer.vue");
1653
- return _sfc_setup$7 ? _sfc_setup$7(props, ctx) : void 0;
1706
+ return _sfc_setup$9 ? _sfc_setup$9(props, ctx) : void 0;
1654
1707
  };
1655
- const Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["ssrRender", _sfc_ssrRender$7]]);
1708
+ const Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["ssrRender", _sfc_ssrRender$9]]);
1656
1709
 
1657
- const useStorage = (key, initialValue, storage = localStorage) => {
1710
+ const useStorage = (key, initialValue, storage = globalThis.localStorage) => {
1711
+ if (!storage) {
1712
+ return reactive(initialValue);
1713
+ }
1658
1714
  let persistedValue;
1659
1715
  const sessionJson = storage.getItem(key);
1660
1716
  if (sessionJson) {
@@ -1737,7 +1793,7 @@ userAgent.includes("Safari") && !userAgent.includes("Chrome");
1737
1793
  const isIOS = /iPad|iPhone|iPod/.test(userAgent) && !window.MSStream;
1738
1794
  const isMobile = isIOS || /Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
1739
1795
 
1740
- const _sfc_main$6 = defineComponent({
1796
+ const _sfc_main$8 = defineComponent({
1741
1797
  __name: "SocialNetworkIcon",
1742
1798
  props: {
1743
1799
  as: { default: "i" },
@@ -1771,18 +1827,18 @@ const _sfc_main$6 = defineComponent({
1771
1827
  return __returned__;
1772
1828
  }
1773
1829
  });
1774
- function _sfc_ssrRender$6(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1830
+ function _sfc_ssrRender$8(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1775
1831
  ssrRenderVNode(_push, createVNode(resolveDynamicComponent($props.as), mergeProps({ class: $setup.iconClassName }, _attrs), null), _parent);
1776
1832
  }
1777
- const _sfc_setup$6 = _sfc_main$6.setup;
1778
- _sfc_main$6.setup = (props, ctx) => {
1833
+ const _sfc_setup$8 = _sfc_main$8.setup;
1834
+ _sfc_main$8.setup = (props, ctx) => {
1779
1835
  const ssrContext = useSSRContext();
1780
1836
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/SocialNetworkIcon.vue");
1781
- return _sfc_setup$6 ? _sfc_setup$6(props, ctx) : void 0;
1837
+ return _sfc_setup$8 ? _sfc_setup$8(props, ctx) : void 0;
1782
1838
  };
1783
- const SocialNetworkIcon = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["ssrRender", _sfc_ssrRender$6]]);
1839
+ const SocialNetworkIcon = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["ssrRender", _sfc_ssrRender$8]]);
1784
1840
 
1785
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1841
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1786
1842
  __name: "SocialNetworkLink",
1787
1843
  props: {
1788
1844
  network: null,
@@ -1808,7 +1864,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1808
1864
  return __returned__;
1809
1865
  }
1810
1866
  });
1811
- function _sfc_ssrRender$5(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1867
+ function _sfc_ssrRender$7(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1812
1868
  const _component_ALink = resolveComponent("ALink");
1813
1869
  _push(ssrRenderComponent(_component_ALink, mergeProps({ href: $setup.fixedHref }, _attrs), {
1814
1870
  default: withCtx((_, _push2, _parent2, _scopeId) => {
@@ -1829,15 +1885,15 @@ function _sfc_ssrRender$5(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1829
1885
  _: 3
1830
1886
  }, _parent));
1831
1887
  }
1832
- const _sfc_setup$5 = _sfc_main$5.setup;
1833
- _sfc_main$5.setup = (props, ctx) => {
1888
+ const _sfc_setup$7 = _sfc_main$7.setup;
1889
+ _sfc_main$7.setup = (props, ctx) => {
1834
1890
  const ssrContext = useSSRContext();
1835
1891
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/SocialNetworkLink.vue");
1836
- return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
1892
+ return _sfc_setup$7 ? _sfc_setup$7(props, ctx) : void 0;
1837
1893
  };
1838
- const SocialNetworkLink = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["ssrRender", _sfc_ssrRender$5]]);
1894
+ const SocialNetworkLink = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["ssrRender", _sfc_ssrRender$7]]);
1839
1895
 
1840
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1896
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1841
1897
  __name: "ShopSidenavCategory",
1842
1898
  props: {
1843
1899
  categoryTree: null
@@ -1860,13 +1916,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1860
1916
  return __returned__;
1861
1917
  }
1862
1918
  });
1863
- function _sfc_ssrRender$4(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1919
+ function _sfc_ssrRender$6(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1864
1920
  const _component_ShopSidenavCategory = resolveComponent("ShopSidenavCategory", true);
1865
1921
  _push(`<li${ssrRenderAttrs(mergeProps({ class: "text-lg text-base-800" }, _attrs))}>`);
1866
1922
  if ($props.categoryTree.subcategories.length) {
1867
1923
  _push(`<details class="bg-white overflow-y-auto overflow-x-hidden z-10 open:absolute open:top-0 open:left-0 open:w-full open:h-full"><summary class="${ssrRenderClass([$setup.isOpen ? "bg-base-100" : null, "cursor-pointer list-none px-6 py-3 active:bg-base-100 transition-colors"])}"><i class="${ssrRenderClass(!$setup.isOpen ? "i-arrow-right float-right mb-0 mt-1 text-xl text-base-500" : "i-arrow-left text-lg")}"></i>`);
1868
1924
  if (!$setup.isOpen && $props.categoryTree.icon) {
1869
- _push(`<img loading="lazy"${ssrRenderAttr("src", $props.categoryTree.icon.url)} class="w-auto h-5 inline mr-3">`);
1925
+ _push(`<img loading="lazy"${ssrRenderAttr("src", $props.categoryTree.icon.url)}${ssrRenderAttr("alt", $props.categoryTree.icon.alt)} class="w-auto h-5 inline mr-3">`);
1870
1926
  } else {
1871
1927
  _push(`<!---->`);
1872
1928
  }
@@ -1889,15 +1945,15 @@ function _sfc_ssrRender$4(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1889
1945
  }
1890
1946
  _push(`</li>`);
1891
1947
  }
1892
- const _sfc_setup$4 = _sfc_main$4.setup;
1893
- _sfc_main$4.setup = (props, ctx) => {
1948
+ const _sfc_setup$6 = _sfc_main$6.setup;
1949
+ _sfc_main$6.setup = (props, ctx) => {
1894
1950
  const ssrContext = useSSRContext();
1895
1951
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopSidenavCategory.vue");
1896
- return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
1952
+ return _sfc_setup$6 ? _sfc_setup$6(props, ctx) : void 0;
1897
1953
  };
1898
- const ShopSidenavCategory = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["ssrRender", _sfc_ssrRender$4]]);
1954
+ const ShopSidenavCategory = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["ssrRender", _sfc_ssrRender$6]]);
1899
1955
 
1900
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1956
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1901
1957
  __name: "ShopSidenav",
1902
1958
  props: {
1903
1959
  categoryTrees: null
@@ -1918,7 +1974,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1918
1974
  return __returned__;
1919
1975
  }
1920
1976
  });
1921
- function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1977
+ function _sfc_ssrRender$5(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1922
1978
  _push(`<aside${ssrRenderAttrs(mergeProps({ class: "flex flex-col h-full" }, _attrs))}><nav class="py-4 grow"><ul class="relative h-full"><!--[-->`);
1923
1979
  ssrRenderList($props.categoryTrees, (categoryTree) => {
1924
1980
  _push(ssrRenderComponent($setup["ShopSidenavCategory"], {
@@ -1943,18 +1999,439 @@ function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1943
1999
  });
1944
2000
  _push(`<!--]--></ul></footer></aside>`);
1945
2001
  }
2002
+ const _sfc_setup$5 = _sfc_main$5.setup;
2003
+ _sfc_main$5.setup = (props, ctx) => {
2004
+ const ssrContext = useSSRContext();
2005
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopSidenav.vue");
2006
+ return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
2007
+ };
2008
+ const ShopSidenav = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["ssrRender", _sfc_ssrRender$5]]);
2009
+
2010
+ const useShopHeaderSubmenu = (props) => {
2011
+ const categoryPicture = computed(() => props.categoryTree.pictures?.[0]);
2012
+ const subcategoriesWithChild = computed(() => {
2013
+ return props.categoryTree.subcategories.filter(({ subcategories }) => subcategories.length);
2014
+ });
2015
+ const maxMenuCols = computed(() => {
2016
+ let _maxMenuCols = subcategoriesWithChild.value.length;
2017
+ if (categoryPicture.value) {
2018
+ _maxMenuCols += 1;
2019
+ }
2020
+ if (subcategoriesWithChild.value.length < props.categoryTree.subcategories.length) {
2021
+ _maxMenuCols += 1;
2022
+ }
2023
+ return _maxMenuCols;
2024
+ });
2025
+ const isMegaMenu = computed(() => {
2026
+ return (props.megaMenuMaxCols || 7) >= maxMenuCols.value;
2027
+ });
2028
+ const subcategoryLinks = computed(() => {
2029
+ return isMegaMenu.value ? props.categoryTree.subcategories.filter(({ subcategories }) => !subcategories.length) : props.categoryTree.subcategories;
2030
+ });
2031
+ const subcategoryCols = computed(() => {
2032
+ return isMegaMenu.value ? props.categoryTree.subcategories.filter(({ subcategories }) => subcategories.length) : props.categoryTree.subcategories;
2033
+ });
2034
+ const countMenuCols = computed(() => {
2035
+ if (isMegaMenu.value)
2036
+ return maxMenuCols.value;
2037
+ return categoryPicture.value ? 2 : 1;
2038
+ });
2039
+ return {
2040
+ categoryPicture,
2041
+ isMegaMenu,
2042
+ subcategoryLinks,
2043
+ subcategoryCols,
2044
+ countMenuCols
2045
+ };
2046
+ };
2047
+
2048
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2049
+ __name: "ShopHeaderSubmenu",
2050
+ props: {
2051
+ categoryTree: null
2052
+ },
2053
+ setup(__props, { expose }) {
2054
+ expose();
2055
+ const props = __props;
2056
+ const {
2057
+ categoryPicture,
2058
+ subcategoryLinks,
2059
+ subcategoryCols,
2060
+ countMenuCols
2061
+ } = useShopHeaderSubmenu(props);
2062
+ const __returned__ = { props, categoryPicture, subcategoryLinks, subcategoryCols, countMenuCols, get Popover() {
2063
+ return Popover;
2064
+ }, get PopoverButton() {
2065
+ return PopoverButton;
2066
+ }, get PopoverPanel() {
2067
+ return PopoverPanel;
2068
+ } };
2069
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
2070
+ return __returned__;
2071
+ }
2072
+ });
2073
+ function _sfc_ssrRender$4(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2074
+ const _component_Fade = resolveComponent("Fade");
2075
+ _push(ssrRenderComponent($setup["Popover"], _attrs, {
2076
+ default: withCtx(({ open }, _push2, _parent2, _scopeId) => {
2077
+ if (_push2) {
2078
+ _push2(ssrRenderComponent($setup["PopoverButton"], { class: "outline-none" }, {
2079
+ default: withCtx((_, _push3, _parent3, _scopeId2) => {
2080
+ if (_push3) {
2081
+ ssrRenderSlot(_ctx.$slots, "button", { open }, null, _push3, _parent3, _scopeId2);
2082
+ } else {
2083
+ return [
2084
+ renderSlot$1(_ctx.$slots, "button", { open })
2085
+ ];
2086
+ }
2087
+ }),
2088
+ _: 2
2089
+ }, _parent2, _scopeId));
2090
+ _push2(`<div class="relative"${_scopeId}>`);
2091
+ _push2(ssrRenderComponent(_component_Fade, null, {
2092
+ default: withCtx((_, _push3, _parent3, _scopeId2) => {
2093
+ if (_push3) {
2094
+ _push3(ssrRenderComponent($setup["PopoverPanel"], {
2095
+ class: ["absolute z-20 top-3 left-1/2 -translate-x-1/2 !transform px-6 py-4 rounded-md shadow bg-white text-base text-base-700", $setup.countMenuCols === 1 ? "w-60" : $setup.countMenuCols === 2 ? `w-screen ${$setup.categoryPicture ? "max-w-lg" : "max-w-sm"}` : $setup.countMenuCols === 3 ? `w-screen ${$setup.categoryPicture ? "max-w-xl" : "max-w-md"}` : $setup.countMenuCols < 6 ? "w-screen max-w-3xl" : "w-screen max-w-5xl"]
2096
+ }, {
2097
+ default: withCtx((_2, _push4, _parent4, _scopeId3) => {
2098
+ if (_push4) {
2099
+ _push4(`<div class="flex gap-6 w-full"${_scopeId3}>`);
2100
+ if ($setup.subcategoryLinks.length) {
2101
+ _push4(`<ul class="flex-1"${_scopeId3}><!--[-->`);
2102
+ ssrRenderList($setup.subcategoryLinks, (subcategory, i) => {
2103
+ _push4(`<li class="${ssrRenderClass($setup.subcategoryLinks.length > 10 ? "text-sm mb-1" : "mb-2")}"${_scopeId3}><a${ssrRenderAttr("href", `/${subcategory.slug}`)} class="hover:text-primary"${_scopeId3}><h3${_scopeId3}>${ssrInterpolate(subcategory.name)}</h3></a></li>`);
2104
+ });
2105
+ _push4(`<!--]--></ul>`);
2106
+ } else {
2107
+ _push4(`<!---->`);
2108
+ }
2109
+ _push4(`<!--[-->`);
2110
+ ssrRenderList($setup.subcategoryCols, (subcategory, i) => {
2111
+ _push4(`<div class="flex-1"${_scopeId3}><a${ssrRenderAttr("href", `/${subcategory.slug}`)} class="hover:text-primary"${_scopeId3}><h3${_scopeId3}>${ssrInterpolate(subcategory.name)}</h3></a><ul class="text-sm text-base-600 mt-1 mb-1.5"${_scopeId3}><!--[-->`);
2112
+ ssrRenderList(subcategory.subcategories, (nestedSubcategory, ii) => {
2113
+ _push4(`<li class="mb-0.5"${_scopeId3}><a${ssrRenderAttr("href", `/${nestedSubcategory.slug}`)} class="hover:text-primary hover:underline"${_scopeId3}><h3${_scopeId3}>${ssrInterpolate(nestedSubcategory.name)}</h3></a></li>`);
2114
+ });
2115
+ _push4(`<!--]--></ul></div>`);
2116
+ });
2117
+ _push4(`<!--]-->`);
2118
+ if ($setup.categoryPicture) {
2119
+ _push4(`<div class="${ssrRenderClass($setup.countMenuCols === 2 ? "basis-1/2" : $setup.countMenuCols < 5 ? "basis-2/5" : "basis-1/3")}"${_scopeId3}><img loading="lazy"${ssrRenderAttr("src", $setup.categoryPicture.url)}${ssrRenderAttr("alt", $setup.categoryPicture.alt || $props.categoryTree.name)} class="ml-auto rounded"${_scopeId3}></div>`);
2120
+ } else {
2121
+ _push4(`<!---->`);
2122
+ }
2123
+ _push4(`</div><a${ssrRenderAttr("href", `/${$props.categoryTree.slug}`)} class="block mt-1 text-xs text-base-600 leading-snug underline"${_scopeId3}>${ssrInterpolate("Ver toda a categoria $1".replace("$1", $props.categoryTree.name))}</a>`);
2124
+ } else {
2125
+ return [
2126
+ createVNode("div", { class: "flex gap-6 w-full" }, [
2127
+ $setup.subcategoryLinks.length ? (openBlock(), createBlock("ul", {
2128
+ key: 0,
2129
+ class: "flex-1"
2130
+ }, [
2131
+ (openBlock(true), createBlock(Fragment$1, null, renderList($setup.subcategoryLinks, (subcategory, i) => {
2132
+ return openBlock(), createBlock("li", {
2133
+ key: `link-${i}`,
2134
+ class: $setup.subcategoryLinks.length > 10 ? "text-sm mb-1" : "mb-2"
2135
+ }, [
2136
+ createVNode("a", {
2137
+ href: `/${subcategory.slug}`,
2138
+ class: "hover:text-primary"
2139
+ }, [
2140
+ createVNode("h3", null, toDisplayString(subcategory.name), 1)
2141
+ ], 8, ["href"])
2142
+ ], 2);
2143
+ }), 128))
2144
+ ])) : createCommentVNode("", true),
2145
+ (openBlock(true), createBlock(Fragment$1, null, renderList($setup.subcategoryCols, (subcategory, i) => {
2146
+ return openBlock(), createBlock("div", {
2147
+ key: subcategory._id,
2148
+ class: "flex-1"
2149
+ }, [
2150
+ createVNode("a", {
2151
+ href: `/${subcategory.slug}`,
2152
+ class: "hover:text-primary"
2153
+ }, [
2154
+ createVNode("h3", null, toDisplayString(subcategory.name), 1)
2155
+ ], 8, ["href"]),
2156
+ createVNode("ul", { class: "text-sm text-base-600 mt-1 mb-1.5" }, [
2157
+ (openBlock(true), createBlock(Fragment$1, null, renderList(subcategory.subcategories, (nestedSubcategory, ii) => {
2158
+ return openBlock(), createBlock("li", {
2159
+ key: `${i}-${ii}`,
2160
+ class: "mb-0.5"
2161
+ }, [
2162
+ createVNode("a", {
2163
+ href: `/${nestedSubcategory.slug}`,
2164
+ class: "hover:text-primary hover:underline"
2165
+ }, [
2166
+ createVNode("h3", null, toDisplayString(nestedSubcategory.name), 1)
2167
+ ], 8, ["href"])
2168
+ ]);
2169
+ }), 128))
2170
+ ])
2171
+ ]);
2172
+ }), 128)),
2173
+ $setup.categoryPicture ? (openBlock(), createBlock("div", {
2174
+ key: 1,
2175
+ class: $setup.countMenuCols === 2 ? "basis-1/2" : $setup.countMenuCols < 5 ? "basis-2/5" : "basis-1/3"
2176
+ }, [
2177
+ createVNode("img", {
2178
+ loading: "lazy",
2179
+ src: $setup.categoryPicture.url,
2180
+ alt: $setup.categoryPicture.alt || $props.categoryTree.name,
2181
+ class: "ml-auto rounded"
2182
+ }, null, 8, ["src", "alt"])
2183
+ ], 2)) : createCommentVNode("", true)
2184
+ ]),
2185
+ createVNode("a", {
2186
+ href: `/${$props.categoryTree.slug}`,
2187
+ class: "block mt-1 text-xs text-base-600 leading-snug underline"
2188
+ }, toDisplayString("Ver toda a categoria $1".replace("$1", $props.categoryTree.name)), 9, ["href"])
2189
+ ];
2190
+ }
2191
+ }),
2192
+ _: 2
2193
+ }, _parent3, _scopeId2));
2194
+ } else {
2195
+ return [
2196
+ createVNode($setup["PopoverPanel"], {
2197
+ class: ["absolute z-20 top-3 left-1/2 -translate-x-1/2 !transform px-6 py-4 rounded-md shadow bg-white text-base text-base-700", $setup.countMenuCols === 1 ? "w-60" : $setup.countMenuCols === 2 ? `w-screen ${$setup.categoryPicture ? "max-w-lg" : "max-w-sm"}` : $setup.countMenuCols === 3 ? `w-screen ${$setup.categoryPicture ? "max-w-xl" : "max-w-md"}` : $setup.countMenuCols < 6 ? "w-screen max-w-3xl" : "w-screen max-w-5xl"]
2198
+ }, {
2199
+ default: withCtx(() => [
2200
+ createVNode("div", { class: "flex gap-6 w-full" }, [
2201
+ $setup.subcategoryLinks.length ? (openBlock(), createBlock("ul", {
2202
+ key: 0,
2203
+ class: "flex-1"
2204
+ }, [
2205
+ (openBlock(true), createBlock(Fragment$1, null, renderList($setup.subcategoryLinks, (subcategory, i) => {
2206
+ return openBlock(), createBlock("li", {
2207
+ key: `link-${i}`,
2208
+ class: $setup.subcategoryLinks.length > 10 ? "text-sm mb-1" : "mb-2"
2209
+ }, [
2210
+ createVNode("a", {
2211
+ href: `/${subcategory.slug}`,
2212
+ class: "hover:text-primary"
2213
+ }, [
2214
+ createVNode("h3", null, toDisplayString(subcategory.name), 1)
2215
+ ], 8, ["href"])
2216
+ ], 2);
2217
+ }), 128))
2218
+ ])) : createCommentVNode("", true),
2219
+ (openBlock(true), createBlock(Fragment$1, null, renderList($setup.subcategoryCols, (subcategory, i) => {
2220
+ return openBlock(), createBlock("div", {
2221
+ key: subcategory._id,
2222
+ class: "flex-1"
2223
+ }, [
2224
+ createVNode("a", {
2225
+ href: `/${subcategory.slug}`,
2226
+ class: "hover:text-primary"
2227
+ }, [
2228
+ createVNode("h3", null, toDisplayString(subcategory.name), 1)
2229
+ ], 8, ["href"]),
2230
+ createVNode("ul", { class: "text-sm text-base-600 mt-1 mb-1.5" }, [
2231
+ (openBlock(true), createBlock(Fragment$1, null, renderList(subcategory.subcategories, (nestedSubcategory, ii) => {
2232
+ return openBlock(), createBlock("li", {
2233
+ key: `${i}-${ii}`,
2234
+ class: "mb-0.5"
2235
+ }, [
2236
+ createVNode("a", {
2237
+ href: `/${nestedSubcategory.slug}`,
2238
+ class: "hover:text-primary hover:underline"
2239
+ }, [
2240
+ createVNode("h3", null, toDisplayString(nestedSubcategory.name), 1)
2241
+ ], 8, ["href"])
2242
+ ]);
2243
+ }), 128))
2244
+ ])
2245
+ ]);
2246
+ }), 128)),
2247
+ $setup.categoryPicture ? (openBlock(), createBlock("div", {
2248
+ key: 1,
2249
+ class: $setup.countMenuCols === 2 ? "basis-1/2" : $setup.countMenuCols < 5 ? "basis-2/5" : "basis-1/3"
2250
+ }, [
2251
+ createVNode("img", {
2252
+ loading: "lazy",
2253
+ src: $setup.categoryPicture.url,
2254
+ alt: $setup.categoryPicture.alt || $props.categoryTree.name,
2255
+ class: "ml-auto rounded"
2256
+ }, null, 8, ["src", "alt"])
2257
+ ], 2)) : createCommentVNode("", true)
2258
+ ]),
2259
+ createVNode("a", {
2260
+ href: `/${$props.categoryTree.slug}`,
2261
+ class: "block mt-1 text-xs text-base-600 leading-snug underline"
2262
+ }, toDisplayString("Ver toda a categoria $1".replace("$1", $props.categoryTree.name)), 9, ["href"])
2263
+ ]),
2264
+ _: 1
2265
+ }, 8, ["class"])
2266
+ ];
2267
+ }
2268
+ }),
2269
+ _: 2
2270
+ }, _parent2, _scopeId));
2271
+ _push2(`</div>`);
2272
+ } else {
2273
+ return [
2274
+ createVNode($setup["PopoverButton"], { class: "outline-none" }, {
2275
+ default: withCtx(() => [
2276
+ renderSlot$1(_ctx.$slots, "button", { open })
2277
+ ]),
2278
+ _: 2
2279
+ }, 1024),
2280
+ createVNode("div", { class: "relative" }, [
2281
+ createVNode(_component_Fade, null, {
2282
+ default: withCtx(() => [
2283
+ createVNode($setup["PopoverPanel"], {
2284
+ class: ["absolute z-20 top-3 left-1/2 -translate-x-1/2 !transform px-6 py-4 rounded-md shadow bg-white text-base text-base-700", $setup.countMenuCols === 1 ? "w-60" : $setup.countMenuCols === 2 ? `w-screen ${$setup.categoryPicture ? "max-w-lg" : "max-w-sm"}` : $setup.countMenuCols === 3 ? `w-screen ${$setup.categoryPicture ? "max-w-xl" : "max-w-md"}` : $setup.countMenuCols < 6 ? "w-screen max-w-3xl" : "w-screen max-w-5xl"]
2285
+ }, {
2286
+ default: withCtx(() => [
2287
+ createVNode("div", { class: "flex gap-6 w-full" }, [
2288
+ $setup.subcategoryLinks.length ? (openBlock(), createBlock("ul", {
2289
+ key: 0,
2290
+ class: "flex-1"
2291
+ }, [
2292
+ (openBlock(true), createBlock(Fragment$1, null, renderList($setup.subcategoryLinks, (subcategory, i) => {
2293
+ return openBlock(), createBlock("li", {
2294
+ key: `link-${i}`,
2295
+ class: $setup.subcategoryLinks.length > 10 ? "text-sm mb-1" : "mb-2"
2296
+ }, [
2297
+ createVNode("a", {
2298
+ href: `/${subcategory.slug}`,
2299
+ class: "hover:text-primary"
2300
+ }, [
2301
+ createVNode("h3", null, toDisplayString(subcategory.name), 1)
2302
+ ], 8, ["href"])
2303
+ ], 2);
2304
+ }), 128))
2305
+ ])) : createCommentVNode("", true),
2306
+ (openBlock(true), createBlock(Fragment$1, null, renderList($setup.subcategoryCols, (subcategory, i) => {
2307
+ return openBlock(), createBlock("div", {
2308
+ key: subcategory._id,
2309
+ class: "flex-1"
2310
+ }, [
2311
+ createVNode("a", {
2312
+ href: `/${subcategory.slug}`,
2313
+ class: "hover:text-primary"
2314
+ }, [
2315
+ createVNode("h3", null, toDisplayString(subcategory.name), 1)
2316
+ ], 8, ["href"]),
2317
+ createVNode("ul", { class: "text-sm text-base-600 mt-1 mb-1.5" }, [
2318
+ (openBlock(true), createBlock(Fragment$1, null, renderList(subcategory.subcategories, (nestedSubcategory, ii) => {
2319
+ return openBlock(), createBlock("li", {
2320
+ key: `${i}-${ii}`,
2321
+ class: "mb-0.5"
2322
+ }, [
2323
+ createVNode("a", {
2324
+ href: `/${nestedSubcategory.slug}`,
2325
+ class: "hover:text-primary hover:underline"
2326
+ }, [
2327
+ createVNode("h3", null, toDisplayString(nestedSubcategory.name), 1)
2328
+ ], 8, ["href"])
2329
+ ]);
2330
+ }), 128))
2331
+ ])
2332
+ ]);
2333
+ }), 128)),
2334
+ $setup.categoryPicture ? (openBlock(), createBlock("div", {
2335
+ key: 1,
2336
+ class: $setup.countMenuCols === 2 ? "basis-1/2" : $setup.countMenuCols < 5 ? "basis-2/5" : "basis-1/3"
2337
+ }, [
2338
+ createVNode("img", {
2339
+ loading: "lazy",
2340
+ src: $setup.categoryPicture.url,
2341
+ alt: $setup.categoryPicture.alt || $props.categoryTree.name,
2342
+ class: "ml-auto rounded"
2343
+ }, null, 8, ["src", "alt"])
2344
+ ], 2)) : createCommentVNode("", true)
2345
+ ]),
2346
+ createVNode("a", {
2347
+ href: `/${$props.categoryTree.slug}`,
2348
+ class: "block mt-1 text-xs text-base-600 leading-snug underline"
2349
+ }, toDisplayString("Ver toda a categoria $1".replace("$1", $props.categoryTree.name)), 9, ["href"])
2350
+ ]),
2351
+ _: 1
2352
+ }, 8, ["class"])
2353
+ ]),
2354
+ _: 1
2355
+ })
2356
+ ])
2357
+ ];
2358
+ }
2359
+ }),
2360
+ _: 3
2361
+ }, _parent));
2362
+ }
2363
+ const _sfc_setup$4 = _sfc_main$4.setup;
2364
+ _sfc_main$4.setup = (props, ctx) => {
2365
+ const ssrContext = useSSRContext();
2366
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopHeaderSubmenu.vue");
2367
+ return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
2368
+ };
2369
+ const ShopHeaderSubmenu = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["ssrRender", _sfc_ssrRender$4]]);
2370
+
2371
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2372
+ __name: "ShopHeaderMenu",
2373
+ props: {
2374
+ inlineMenuTrees: null
2375
+ },
2376
+ setup(__props, { expose }) {
2377
+ expose();
2378
+ const __returned__ = { ShopHeaderSubmenu };
2379
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
2380
+ return __returned__;
2381
+ }
2382
+ });
2383
+ function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2384
+ _push(`<nav${ssrRenderAttrs(_attrs)}><ul class="${ssrRenderClass([$props.inlineMenuTrees.length < 7 ? "text-base" : "text-sm", "flex gap-4 xl:gap-5 text-base-700"])}"><!--[-->`);
2385
+ ssrRenderList($props.inlineMenuTrees, (categoryTree, i) => {
2386
+ _push(`<li>`);
2387
+ if (categoryTree.subcategories.length) {
2388
+ _push(ssrRenderComponent($setup["ShopHeaderSubmenu"], { "category-tree": categoryTree }, {
2389
+ button: withCtx(({ open }, _push2, _parent2, _scopeId) => {
2390
+ if (_push2) {
2391
+ _push2(`<span class="hover:text-primary group"${_scopeId}><h3 class="${ssrRenderClass([[
2392
+ $props.inlineMenuTrees.length < 7 ? "decoration-2" : null,
2393
+ open ? "underline" : null
2394
+ ], "group-hover:underline inline"])}"${_scopeId}>${ssrInterpolate(categoryTree.name)}</h3><i class="${ssrRenderClass([open ? "i-chevron-up" : "i-chevron-down", "text-base-400 group-hover:text-primary-subtle ml-1"])}"${_scopeId}></i></span>`);
2395
+ } else {
2396
+ return [
2397
+ createVNode("span", { class: "hover:text-primary group" }, [
2398
+ createVNode("h3", {
2399
+ class: ["group-hover:underline inline", [
2400
+ $props.inlineMenuTrees.length < 7 ? "decoration-2" : null,
2401
+ open ? "underline" : null
2402
+ ]]
2403
+ }, toDisplayString(categoryTree.name), 3),
2404
+ createVNode("i", {
2405
+ class: ["text-base-400 group-hover:text-primary-subtle ml-1", open ? "i-chevron-up" : "i-chevron-down"]
2406
+ }, null, 2)
2407
+ ])
2408
+ ];
2409
+ }
2410
+ }),
2411
+ _: 2
2412
+ }, _parent));
2413
+ } else {
2414
+ _push(`<a${ssrRenderAttr("href", `/${categoryTree.slug}`)} class="hover:text-primary hover:underline decoration-2"><h3 class="inline">${ssrInterpolate(categoryTree.name)}</h3></a>`);
2415
+ }
2416
+ _push(`</li>`);
2417
+ });
2418
+ _push(`<!--]--></ul></nav>`);
2419
+ }
1946
2420
  const _sfc_setup$3 = _sfc_main$3.setup;
1947
2421
  _sfc_main$3.setup = (props, ctx) => {
1948
2422
  const ssrContext = useSSRContext();
1949
- (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopSidenav.vue");
2423
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopHeaderMenu.vue");
1950
2424
  return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
1951
2425
  };
1952
- const ShopSidenav = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["ssrRender", _sfc_ssrRender$3]]);
2426
+ const ShopHeaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["ssrRender", _sfc_ssrRender$3]]);
1953
2427
 
1954
2428
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1955
2429
  __name: "ShopHeader",
1956
2430
  props: {
1957
- categories: null
2431
+ categories: null,
2432
+ menuCategorySlugs: null,
2433
+ menuRandomCategories: null,
2434
+ isAlphabeticalSortSubmenu: { type: Boolean }
1958
2435
  },
1959
2436
  setup(__props, { expose }) {
1960
2437
  expose();
@@ -1964,9 +2441,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1964
2441
  isSticky,
1965
2442
  positionY,
1966
2443
  categoryTrees,
2444
+ inlineMenuTrees,
1967
2445
  isSidenavOpen
1968
2446
  } = useShopHeader({ ...props, header });
1969
- const __returned__ = { props, header, isSticky, positionY, categoryTrees, isSidenavOpen, Drawer, ShopSidenav };
2447
+ const __returned__ = { props, header, isSticky, positionY, categoryTrees, inlineMenuTrees, isSidenavOpen, Drawer, ShopSidenav, ShopHeaderMenu };
1970
2448
  Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
1971
2449
  return __returned__;
1972
2450
  }
@@ -1978,9 +2456,10 @@ function _sfc_ssrRender$2(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1978
2456
  $setup.isSticky && !$setup.isSidenavOpen ? "bg-white/80" : "bg-white",
1979
2457
  $setup.isSticky ? "backdrop-blur-md shadow py-2 md:py-3" : "py-3 sm:py-4 md:py-5"
1980
2458
  ]]
1981
- }, _attrs))}><div class="container lg:max-w-7xl mx-auto px-1 lg:pl-3 grid grid-flow-col grid-cols-3 justify-between items-center md:grid-cols-none md:auto-cols-max"><div class="md:hidden"><button class="px-2 my-1"${ssrRenderAttr("aria-label", "Abrir/fechar menu")}><i class="${ssrRenderClass([$setup.isSidenavOpen ? "i-close" : "i-menu", "text-base-500 text-3xl"])}"></i></button></div>`);
2459
+ }, _attrs))}><div class="container lg:max-w-7xl mx-auto px-1 lg:pl-3 grid grid-flow-col grid-cols-3 justify-between items-center lg:grid-cols-none lg:auto-cols-max"><div class="lg:hidden"><button class="px-2 my-1"${ssrRenderAttr("aria-label", "Abrir/fechar menu")}><i class="${ssrRenderClass([$setup.isSidenavOpen ? "i-close" : "i-menu", "text-base-500 text-3xl"])}"></i></button></div>`);
1982
2460
  ssrRenderSlot(_ctx.$slots, "logo", {}, null, _push, _parent);
1983
- _push(`<nav class="hidden md:block"></nav><div class="px-2 flex justify-end items-center gap-3 lg:gap-4 text-base-800"><button${ssrRenderAttr("aria-label", "Buscar produtos")}><i class="i-search w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button><button class="hidden sm:block"${ssrRenderAttr("aria-label", "Minha conta")}><i class="i-account w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button><button${ssrRenderAttr("aria-label", "Abrir carrinho")}><i class="i-shopping-cart w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button></div></div>`);
2461
+ _push(ssrRenderComponent($setup["ShopHeaderMenu"], mergeProps({ class: "hidden lg:block" }, { inlineMenuTrees: $setup.inlineMenuTrees }), null, _parent));
2462
+ _push(`<div class="px-2 flex justify-end items-center gap-3 lg:gap-4 text-base-800"><button${ssrRenderAttr("aria-label", "Buscar produtos")}><i class="i-search w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button><button class="hidden sm:block"${ssrRenderAttr("aria-label", "Minha conta")}><i class="i-account w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button><button${ssrRenderAttr("aria-label", "Abrir carrinho")}><i class="i-shopping-cart w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button></div></div>`);
1984
2463
  _push(ssrRenderComponent($setup["Drawer"], {
1985
2464
  modelValue: $setup.isSidenavOpen,
1986
2465
  "onUpdate:modelValue": ($event) => $setup.isSidenavOpen = $event,
@@ -2027,7 +2506,10 @@ const $$PagesHeader = createComponent(async ($$result, $$props, $$slots) => {
2027
2506
  pitchBar.slides = cmsHeader.pitch_bar;
2028
2507
  }
2029
2508
  const shopHeader = {
2030
- categories: apiState.categories
2509
+ categories: apiState.categories,
2510
+ menuCategorySlugs: cmsHeader.inline_menu_categories?.featured,
2511
+ menuRandomCategories: cmsHeader.inline_menu_categories?.random,
2512
+ isAlphabeticalSortSubmenu: cmsHeader.alphabetical_sort_submenu
2031
2513
  };
2032
2514
  const LogoHeading = Astro2.props.logoHeading || (isHomepage ? "h1" : "h2");
2033
2515
  return renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`${renderSlot($$result2, $$slots["pitch-bar"], renderTemplate`