cloudcommerce 0.26.2 → 0.26.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 (132) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/ecomplus-stores/barra-doce/functions/many/package.json +3 -3
  3. package/ecomplus-stores/barra-doce/functions/ssr/index.js +0 -1
  4. package/ecomplus-stores/barra-doce/functions/ssr/package.json +8 -8
  5. package/ecomplus-stores/barra-doce/functions/ssr/src/components/CartItem.vue +64 -0
  6. package/ecomplus-stores/barra-doce/functions/ssr/src/components/CartSidebar.vue +38 -7
  7. package/ecomplus-stores/barra-doce/functions/ssr/src/components/Prices.vue +2 -3
  8. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ShopHeader.vue +8 -4
  9. package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
  10. package/ecomplus-stores/barra-doce/package.json +2 -2
  11. package/ecomplus-stores/iluminim/functions/many/package.json +3 -3
  12. package/ecomplus-stores/iluminim/functions/ssr/package.json +8 -8
  13. package/ecomplus-stores/iluminim/functions/ssr/src/components/CartItem.vue +64 -0
  14. package/ecomplus-stores/iluminim/functions/ssr/src/components/CartSidebar.vue +37 -6
  15. package/ecomplus-stores/iluminim/functions/ssr/src/components/Prices.vue +2 -3
  16. package/ecomplus-stores/iluminim/functions/ssr/src/components/ShopHeader.vue +6 -2
  17. package/ecomplus-stores/iluminim/functions/with-apps/package.json +3 -3
  18. package/ecomplus-stores/iluminim/package.json +2 -2
  19. package/package.json +3 -3
  20. package/packages/api/package.json +1 -1
  21. package/packages/apps/affilate-program/package.json +1 -1
  22. package/packages/apps/correios/package.json +1 -1
  23. package/packages/apps/custom-payment/package.json +1 -1
  24. package/packages/apps/custom-shipping/package.json +1 -1
  25. package/packages/apps/datafrete/package.json +1 -1
  26. package/packages/apps/discounts/package.json +1 -1
  27. package/packages/apps/emails/package.json +2 -2
  28. package/packages/apps/fb-conversions/package.json +1 -1
  29. package/packages/apps/flash-courier/package.json +1 -1
  30. package/packages/apps/frenet/package.json +1 -1
  31. package/packages/apps/galaxpay/package.json +1 -1
  32. package/packages/apps/google-analytics/package.json +1 -1
  33. package/packages/apps/jadlog/package.json +1 -1
  34. package/packages/apps/loyalty-points/package.json +1 -1
  35. package/packages/apps/melhor-envio/package.json +1 -1
  36. package/packages/apps/mercadopago/package.json +1 -1
  37. package/packages/apps/pagarme/package.json +1 -1
  38. package/packages/apps/paghiper/package.json +1 -1
  39. package/packages/apps/pix/package.json +1 -1
  40. package/packages/apps/tiny-erp/package.json +1 -1
  41. package/packages/apps/webhooks/package.json +1 -1
  42. package/packages/cli/package.json +1 -1
  43. package/packages/config/package.json +1 -1
  44. package/packages/emails/package.json +1 -1
  45. package/packages/eslint/package.json +3 -3
  46. package/packages/events/package.json +1 -1
  47. package/packages/feeds/package.json +1 -1
  48. package/packages/firebase/package.json +1 -1
  49. package/packages/i18n/package.json +1 -1
  50. package/packages/modules/lib/firebase/functions-checkout/request-to-module.js +2 -2
  51. package/packages/modules/lib/firebase/functions-checkout/request-to-module.js.map +1 -1
  52. package/packages/modules/lib/firebase/functions-checkout/utils.js +21 -9
  53. package/packages/modules/lib/firebase/functions-checkout/utils.js.map +1 -1
  54. package/packages/modules/package.json +2 -2
  55. package/packages/modules/schemas/@checkout.cjs +0 -1
  56. package/packages/modules/src/firebase/functions-checkout/request-to-module.ts +2 -2
  57. package/packages/modules/src/firebase/functions-checkout/utils.ts +23 -9
  58. package/packages/passport/package.json +1 -1
  59. package/packages/ssr/package.json +2 -2
  60. package/packages/storefront/dist/client/_astro/{Carousel.926668f2.js → Carousel.0b24e2cb.js} +1 -1
  61. package/packages/storefront/dist/client/_astro/CartSidebar.2731d333.js +1 -0
  62. package/packages/storefront/dist/client/_astro/{HeroSlider.1f0524aa.js → HeroSlider.a70b2582.js} +1 -1
  63. package/packages/storefront/dist/client/_astro/{PitchBar.7407eeaf.js → PitchBar.13991988.js} +1 -1
  64. package/packages/storefront/dist/client/_astro/{Prices.562a32ab.js → Prices.cdfa346a.js} +1 -1
  65. package/packages/storefront/dist/client/_astro/{ProductShelf.763cd2ca.js → ProductShelf.619c56a5.js} +1 -1
  66. package/packages/storefront/dist/client/_astro/SearchModal.117a477d.js +1 -0
  67. package/packages/storefront/dist/client/_astro/{ShopHeader.126900a6.js → ShopHeader.2c2fded7.js} +2 -2
  68. package/packages/storefront/dist/client/_astro/_...slug_.b693913e.css +1 -0
  69. package/packages/storefront/dist/client/_astro/{_plugin-vue_export-helper.ee681fa8.js → _plugin-vue_export-helper.fc5e2f5b.js} +1 -1
  70. package/packages/storefront/dist/client/_astro/{api.a2eda23e.js → api.39f40cd8.js} +1 -1
  71. package/packages/storefront/dist/client/_astro/client.a5d2898b.js +1 -0
  72. package/packages/storefront/dist/client/_astro/{firebase-app.93857bfb.js → firebase-app.8c541cce.js} +3 -3
  73. package/packages/storefront/dist/client/_astro/{format-money.923559cc.js → format-money.86f14860.js} +1 -1
  74. package/packages/storefront/dist/client/_astro/hoisted.d90361ee.js +1 -0
  75. package/packages/storefront/dist/client/_astro/{img.ec6ba316.js → img.d4891d80.js} +1 -1
  76. package/packages/storefront/dist/client/_astro/index.33801818.js +1 -0
  77. package/packages/storefront/dist/client/_astro/{modules-info.48980668.js → modules-info.ec412b24.js} +1 -1
  78. package/packages/storefront/dist/client/_empty-middleware.mjs +3 -0
  79. package/packages/storefront/dist/client/chunks/CartSidebar.0ce1e999.mjs +382 -0
  80. package/packages/storefront/dist/client/chunks/SearchModal.f603145b.mjs +32 -0
  81. package/packages/storefront/dist/client/chunks/astro.11be33ee.mjs +1424 -0
  82. package/packages/storefront/dist/{server/chunks/pages/_...slug_.astro.fd8a229f.mjs → client/chunks/pages/_...slug_.astro.ec6517ba.mjs} +360 -274
  83. package/packages/storefront/dist/{server/chunks/pages/account.astro.3b21bff8.mjs → client/chunks/pages/account.astro.3d2605e6.mjs} +2 -10
  84. package/packages/storefront/dist/{server/chunks/pages/index.astro.dab642f5.mjs → client/chunks/pages/index.astro.8ad03206.mjs} +167 -17
  85. package/packages/storefront/dist/{server/chunks/pages/~fallback.astro.7630c0d6.mjs → client/chunks/pages/~fallback.astro.d31d20b4.mjs} +8 -20
  86. package/packages/storefront/dist/client/chunks/sharp.3f154e38.mjs +74 -0
  87. package/packages/storefront/dist/client/manifest.e39eb543.mjs +79 -0
  88. package/packages/storefront/dist/client/pages/_---slug_.astro.mjs +23 -0
  89. package/packages/storefront/dist/client/pages/app/account.astro.mjs +23 -0
  90. package/packages/storefront/dist/client/pages/app.astro.mjs +23 -0
  91. package/packages/storefront/dist/client/pages/index.astro.mjs +23 -0
  92. package/packages/storefront/dist/client/pages/~fallback.astro.mjs +23 -0
  93. package/packages/storefront/dist/client/registerSW.js +1 -0
  94. package/packages/storefront/dist/client/renderers.mjs +369 -0
  95. package/packages/storefront/dist/client/sw.js +1 -1
  96. package/packages/storefront/dist/server/chunks/{CartSidebar.2b555408.mjs → CartSidebar.cca9fdd3.mjs} +14 -24
  97. package/packages/storefront/dist/server/chunks/{SearchModal.f418e188.mjs → SearchModal.a680efae.mjs} +8 -19
  98. package/packages/storefront/dist/server/chunks/_...f7cdc954.mjs +24 -0
  99. package/packages/storefront/dist/server/chunks/account@_@astro.fa8b921b.mjs +24 -0
  100. package/packages/storefront/dist/server/chunks/{astro.bb5b7191.mjs → astro.440a2e08.mjs} +149 -1859
  101. package/packages/storefront/dist/server/chunks/image-endpoint@_@js.802bf648.mjs +24 -0
  102. package/packages/storefront/dist/server/chunks/index@_@astro.a122f091.mjs +24 -0
  103. package/packages/storefront/dist/server/chunks/index@_@astro.da98dcbe.mjs +24 -0
  104. package/packages/storefront/dist/server/chunks/pages/_...slug_.astro.08ba5973.mjs +3930 -0
  105. package/packages/storefront/dist/server/chunks/pages/account.astro.f11f26f3.mjs +15 -0
  106. package/packages/storefront/dist/server/chunks/pages/image-endpoint.js.a9374d3e.mjs +238 -0
  107. package/packages/storefront/dist/server/chunks/pages/index.astro.079f316a.mjs +1650 -0
  108. package/packages/storefront/dist/server/chunks/pages/~fallback.astro.01594623.mjs +55 -0
  109. package/packages/storefront/dist/server/chunks/sharp.52841bb4.mjs +75 -0
  110. package/packages/storefront/dist/server/chunks/~fallback@_@astro.876a97c5.mjs +24 -0
  111. package/packages/storefront/dist/server/entry.mjs +1167 -2360
  112. package/packages/storefront/dist/server/manifest.12e7a10c.mjs +561 -0
  113. package/packages/storefront/dist/server/renderers.mjs +10 -21
  114. package/packages/storefront/package.json +6 -6
  115. package/packages/storefront/src/lib/layouts/BaseHead.astro +3 -2
  116. package/packages/test-base/package.json +1 -1
  117. package/packages/types/modules/@checkout:params.d.ts +1 -1
  118. package/packages/types/package.json +1 -1
  119. package/ecomplus-stores/iluminim/.ecomplus.cd.json +0 -5
  120. package/packages/storefront/dist/client/_astro/CartSidebar.eadba34f.js +0 -1
  121. package/packages/storefront/dist/client/_astro/SearchModal.cffd4c2d.js +0 -1
  122. package/packages/storefront/dist/client/_astro/_...slug_.36cd433d.css +0 -1
  123. package/packages/storefront/dist/client/_astro/client.e6d9439a.js +0 -1
  124. package/packages/storefront/dist/client/_astro/hoisted.572313d6.js +0 -1
  125. package/packages/storefront/dist/client/_astro/index.709ac149.js +0 -1
  126. package/packages/storefront/dist/server/chunks/_...d32bcc0c.mjs +0 -35
  127. package/packages/storefront/dist/server/chunks/account@_@astro.0106855f.mjs +0 -35
  128. package/packages/storefront/dist/server/chunks/endpoint@_@js.35807882.mjs +0 -35
  129. package/packages/storefront/dist/server/chunks/index@_@astro.477f5af1.mjs +0 -35
  130. package/packages/storefront/dist/server/chunks/index@_@astro.e5a61d6e.mjs +0 -35
  131. package/packages/storefront/dist/server/chunks/pages/endpoint.js.247079ba.mjs +0 -119
  132. package/packages/storefront/dist/server/chunks/~fallback@_@astro.65227dd7.mjs +0 -35
@@ -1,21 +1,15 @@
1
- import 'kleur/colors';
2
- import 'node:fs/promises';
3
- import { resolve, join } from 'node:path';
4
- import 'node:url';
5
- import 'http-cache-semantics';
6
- import 'node:os';
7
- import sizeOf from 'image-size';
8
- import 'magic-string';
9
- import mime from 'mime';
10
- import 'node:stream';
11
- import { c as createAstro, a as createComponent, r as renderTemplate, u as unescapeHTML, b as renderComponent, d as addAttribute, F as Fragment, s as spreadAttributes, e as renderSlotToString, f as renderAllHeadContent, m as maybeRenderHead, g as renderSlot } from '../astro.bb5b7191.mjs';
1
+ import { c as createAstro, a as createComponent, r as renderTemplate, u as unescapeHTML, b as renderComponent, d as addAttribute, F as Fragment, s as spreadAttributes, e as renderSlotToString, f as renderAllHeadContent, A as AstroError, E as ExpectedImage, L as LocalImageUsedWrongly, M as MissingImageDimension, U as UnsupportedImageFormat, g as ExpectedImageOptions, I as InvalidImageService, m as maybeRenderHead, h as renderSlot } from '../astro.11be33ee.mjs';
12
2
  import api from '@cloudcommerce/api';
13
3
  import { EventEmitter } from 'node:events';
14
4
  import fs from 'node:fs';
5
+ import { resolve, join } from 'node:path';
15
6
  import config from '@cloudcommerce/config';
16
7
  import { img, price, formatMoney, randomObjectId, nickname } from '@ecomplus/utils';
8
+ import 'clsx';
17
9
  import { renderSync, parse, walkSync, ELEMENT_NODE } from 'ultrahtml';
18
- /* empty css */import { reactive, computed, shallowRef, useSSRContext, defineComponent, inject, mergeProps, ref, watch, toRef, onMounted, onBeforeUnmount, provide, createVNode, resolveDynamicComponent, withCtx, renderSlot as renderSlot$1, resolveComponent, withDirectives, vShow, openBlock, createBlock, createCommentVNode, Fragment as Fragment$1, renderList, withModifiers, Teleport, createTextVNode, toDisplayString, defineAsyncComponent, Suspense } from 'vue';
10
+ /* empty css */import imageSize from 'image-size';
11
+ import mime from 'mime';
12
+ import { reactive, computed, shallowRef, useSSRContext, defineComponent, inject, mergeProps, ref, watch, toRef, onMounted, onBeforeUnmount, provide, createVNode, resolveDynamicComponent, withCtx, renderSlot as renderSlot$1, resolveComponent, withDirectives, vShow, openBlock, createBlock, createCommentVNode, Fragment as Fragment$1, renderList, withModifiers, Teleport, createTextVNode, toDisplayString, defineAsyncComponent, Suspense } from 'vue';
19
13
  import { useScroll, useElementHover, useDebounceFn, useTimeout, watchDebounced, promiseTimeout, watchOnce } from '@vueuse/core';
20
14
  import { ssrRenderAttrs, ssrRenderSlot, ssrRenderClass, ssrRenderVNode, ssrRenderComponent, ssrRenderStyle, ssrRenderList, ssrIncludeBooleanAttr, ssrRenderAttr, ssrRenderTeleport, ssrInterpolate, ssrRenderSuspense } from 'vue/server-renderer';
21
15
  import { Popover, PopoverButton, PopoverPanel, Menu, MenuButton, MenuItems, MenuItem } from '@headlessui/vue';
@@ -28,106 +22,31 @@ const _export_sfc = (sfc, props) => {
28
22
  return target;
29
23
  };
30
24
 
31
- function isOutputFormat(value) {
32
- return ["avif", "jpeg", "jpg", "png", "webp", "svg"].includes(value);
25
+ function removeTrailingForwardSlash(path) {
26
+ return path.endsWith("/") ? path.slice(0, path.length - 1) : path;
33
27
  }
34
- function isOutputFormatSupportsAlpha(value) {
35
- return ["avif", "png", "webp"].includes(value);
28
+ function removeLeadingForwardSlash(path) {
29
+ return path.startsWith("/") ? path.substring(1) : path;
36
30
  }
37
- function isAspectRatioString(value) {
38
- return /^\d*:\d*$/.test(value);
31
+ function trimSlashes(path) {
32
+ return path.replace(/^\/|\/$/g, "");
39
33
  }
40
- function parseAspectRatio(aspectRatio) {
41
- if (!aspectRatio) {
42
- return void 0;
43
- }
44
- if (typeof aspectRatio === "number") {
45
- return aspectRatio;
46
- } else {
47
- const [width, height] = aspectRatio.split(":");
48
- return parseInt(width) / parseInt(height);
49
- }
50
- }
51
- function isSSRService(service) {
52
- return "transform" in service;
34
+ function isString(path) {
35
+ return typeof path === "string" || path instanceof String;
53
36
  }
54
- class BaseSSRService {
55
- async getImageAttributes(transform) {
56
- const { width, height, src, format, quality, aspectRatio, ...rest } = transform;
57
- return {
58
- ...rest,
59
- width,
60
- height
61
- };
62
- }
63
- serializeTransform(transform) {
64
- const searchParams = new URLSearchParams();
65
- if (transform.quality) {
66
- searchParams.append("q", transform.quality.toString());
67
- }
68
- if (transform.format) {
69
- searchParams.append("f", transform.format);
70
- }
71
- if (transform.width) {
72
- searchParams.append("w", transform.width.toString());
73
- }
74
- if (transform.height) {
75
- searchParams.append("h", transform.height.toString());
76
- }
77
- if (transform.aspectRatio) {
78
- searchParams.append("ar", transform.aspectRatio.toString());
79
- }
80
- if (transform.fit) {
81
- searchParams.append("fit", transform.fit);
82
- }
83
- if (transform.background) {
84
- searchParams.append("bg", transform.background);
85
- }
86
- if (transform.position) {
87
- searchParams.append("p", encodeURI(transform.position));
88
- }
89
- searchParams.append("href", transform.src);
90
- return { searchParams };
91
- }
92
- parseTransform(searchParams) {
93
- if (!searchParams.has("href")) {
94
- return void 0;
95
- }
96
- let transform = { src: searchParams.get("href") };
97
- if (searchParams.has("q")) {
98
- transform.quality = parseInt(searchParams.get("q"));
99
- }
100
- if (searchParams.has("f")) {
101
- const format = searchParams.get("f");
102
- if (isOutputFormat(format)) {
103
- transform.format = format;
104
- }
105
- }
106
- if (searchParams.has("w")) {
107
- transform.width = parseInt(searchParams.get("w"));
108
- }
109
- if (searchParams.has("h")) {
110
- transform.height = parseInt(searchParams.get("h"));
111
- }
112
- if (searchParams.has("ar")) {
113
- const ratio = searchParams.get("ar");
114
- if (isAspectRatioString(ratio)) {
115
- transform.aspectRatio = ratio;
116
- } else {
117
- transform.aspectRatio = parseFloat(ratio);
118
- }
119
- }
120
- if (searchParams.has("fit")) {
121
- transform.fit = searchParams.get("fit");
122
- }
123
- if (searchParams.has("p")) {
124
- transform.position = decodeURI(searchParams.get("p"));
125
- }
126
- if (searchParams.has("bg")) {
127
- transform.background = searchParams.get("bg");
37
+ function joinPaths(...paths) {
38
+ return paths.filter(isString).map((path, i) => {
39
+ if (i === 0) {
40
+ return removeTrailingForwardSlash(path);
41
+ } else if (i === paths.length - 1) {
42
+ return removeLeadingForwardSlash(path);
43
+ } else {
44
+ return trimSlashes(path);
128
45
  }
129
- return transform;
130
- }
46
+ }).join("/");
47
+ }
48
+ function isRemotePath(src) {
49
+ return /^(http|ftp|https|ws):?\/\//.test(src) || src.startsWith("data:");
131
50
  }
132
51
 
133
52
  global.__storefrontCMS = (fs, resolvePath) => {
@@ -152,7 +71,9 @@ global.__storefrontCMS = (fs, resolvePath) => {
152
71
  const dirColl = resolvePath(dirContent, filename);
153
72
  return new Promise((resolve) => {
154
73
  const slugs = fs.existsSync(dirColl)
155
- ? fs.readdirSync(dirColl).map((file) => file.replace('.json', ''))
74
+ ? fs.readdirSync(dirColl)
75
+ .filter((file) => file.charAt(0) !== '.')
76
+ .map((file) => file.replace(/\.[^.]{0,5}$/, ''))
156
77
  : [];
157
78
  resolve(slugs);
158
79
  });
@@ -265,7 +186,7 @@ const _getConfig = () => {
265
186
  };
266
187
  };
267
188
 
268
- const emitter = new EventEmitter();
189
+ const emitter$1 = new EventEmitter();
269
190
  const getConfig = _getConfig;
270
191
  if (!globalThis.$apiMergeConfig) {
271
192
  globalThis.$apiMergeConfig = {
@@ -280,7 +201,7 @@ if (!globalThis.$storefront) {
280
201
  globalThis.$storefront = {
281
202
  settings: {},
282
203
  onLoad(callback) {
283
- emitter.once("load", callback);
204
+ emitter$1.once("load", callback);
284
205
  },
285
206
  data: {}
286
207
  };
@@ -411,7 +332,7 @@ const loadRouteContext = async (Astro, {
411
332
  isPreview
412
333
  };
413
334
  Astro.locals.routeContext = routeContext;
414
- emitter.emit("load", routeContext);
335
+ emitter$1.emit("load", routeContext);
415
336
  return routeContext;
416
337
  };
417
338
 
@@ -449,7 +370,7 @@ const $$BaseHead = createComponent(async ($$result, $$props, $$slots) => {
449
370
  }
450
371
  const apiDoc = apiContext.doc;
451
372
  const state = apiDoc || cmsContent || {};
452
- const title = state.meta_title || state.name || state.title || Astro2.props.title || settings.name;
373
+ const title = state.meta_title || state.name || state.title || settings.name;
453
374
  const description = state.meta_description || state.short_description || settings.description;
454
375
  const favicon = settings.icon ? getIconUrl(32) : "/favicon.ico";
455
376
  const shortcutIcon = settings.icon ? getIconUrl(192) : null;
@@ -524,7 +445,7 @@ window.$isCmsPreview = true;`;
524
445
  url: `https://${domain}/`,
525
446
  logo: `https://${domain}${settings.logo}`
526
447
  });
527
- return renderTemplate(_a$2 || (_a$2 = __template$2(['<meta charset="UTF-8">\n<meta name="viewport" content="width=device-width">\n<meta name="theme-color"', '>\n<link rel="icon" type="image/png"', ' sizes="32x32">\n', "\n<title>", '</title>\n<meta name="description"', '>\n<meta name="author"', '>\n<meta name="generator"', '>\n<link rel="canonical"', ">\n", '\n<meta name="apple-mobile-web-app-capable" content="yes">\n<meta name="apple-mobile-web-app-status-bar-style" content="default">\n<meta property="og:site_name"', '>\n<meta property="og:url"', '>\n<meta property="og:title"', '>\n<meta property="og:description"', '>\n<meta property="og:type" content="website">\n<meta property="og:locale"', ">\n", "\n", '\n<meta name="twitter:card" content="summary">\n', '\n<meta name="ecom-store-id"', ">\n\n", "\n", "\n\n<script>", '<\/script>\n<script type="application/ld+json">', "<\/script>"])), addAttribute(primaryColor, "content"), addAttribute(favicon, "href"), shortcutIcon && renderTemplate`<link rel="icon" type="image/png"${addAttribute(shortcutIcon, "href")} sizes="192x192">`, title, addAttribute(description, "content"), addAttribute(settings.name, "content"), addAttribute(Astro2.generator, "content"), addAttribute(canonicalUrl, "href"), shortcutIcon && renderTemplate`<link rel="apple-touch-icon"${addAttribute(shortcutIcon, "href")}>`, addAttribute(settings.name, "content"), addAttribute(canonicalUrl, "content"), addAttribute(title, "content"), addAttribute(description, "content"), addAttribute(ogLocale, "content"), ogImage && renderTemplate`<meta property="og:image"${addAttribute(ogImage, "content")}>`, metatagsContent?.fb_app_id && renderTemplate`<meta property="fb:app_id"${addAttribute(metatagsContent.fb_app_id, "content")}>`, metatagsContent?.twitter_username && renderTemplate`<meta name="twitter:site"${addAttribute(metatagsContent.twitter_username, "content")}>`, addAttribute(String(storeId), "content"), pwaInfo && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`${unescapeHTML(pwaInfo.webManifest.linkTag)}` })}`, !pwaInfo && !false && renderTemplate`<link rel="manifest" href="/manifest.webmanifest">`, unescapeHTML(inlineClientJS), unescapeHTML(inlineJSONLd));
448
+ return renderTemplate(_a$2 || (_a$2 = __template$2(['<meta charset="UTF-8">\n<meta name="viewport" content="width=device-width">\n<meta name="theme-color"', '>\n<link rel="icon" type="image/png"', ' sizes="32x32">\n', "\n<title>", '</title>\n<meta name="description"', '>\n<meta name="author"', '>\n<meta name="generator"', '>\n<link rel="canonical"', ">\n", '\n<meta name="apple-mobile-web-app-capable" content="yes">\n<meta name="apple-mobile-web-app-status-bar-style" content="default">\n<meta property="og:site_name"', '>\n<meta property="og:url"', '>\n<meta property="og:title"', '>\n<meta property="og:description"', '>\n<meta property="og:type" content="website">\n<meta property="og:locale"', ">\n", "\n", '\n<meta name="twitter:card" content="summary">\n', '\n<meta name="ecom-store-id"', ">\n\n\n", "\n", "\n\n<script>", '<\/script>\n<script type="application/ld+json">', "<\/script>"])), addAttribute(primaryColor, "content"), addAttribute(favicon, "href"), shortcutIcon && renderTemplate`<link rel="icon" type="image/png"${addAttribute(shortcutIcon, "href")} sizes="192x192">`, title, addAttribute(description, "content"), addAttribute(settings.name, "content"), addAttribute(Astro2.generator, "content"), addAttribute(canonicalUrl, "href"), shortcutIcon && renderTemplate`<link rel="apple-touch-icon"${addAttribute(shortcutIcon, "href")}>`, addAttribute(settings.name, "content"), addAttribute(canonicalUrl, "content"), addAttribute(title, "content"), addAttribute(description, "content"), addAttribute(ogLocale, "content"), ogImage && renderTemplate`<meta property="og:image"${addAttribute(ogImage, "content")}>`, metatagsContent?.fb_app_id && renderTemplate`<meta property="fb:app_id"${addAttribute(metatagsContent.fb_app_id, "content")}>`, metatagsContent?.twitter_username && renderTemplate`<meta name="twitter:site"${addAttribute(metatagsContent.twitter_username, "content")}>`, addAttribute(String(storeId), "content"), pwaInfo && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`${unescapeHTML(pwaInfo.webManifest.linkTag)}` })}`, !pwaInfo && !false && renderTemplate`<link rel="manifest" href="/manifest.webmanifest">`, unescapeHTML(inlineClientJS), unescapeHTML(inlineJSONLd));
528
449
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseHead.astro", void 0);
529
450
 
530
451
  function has(value) {
@@ -663,193 +584,335 @@ const Head = createComponent({
663
584
  }
664
585
  });
665
586
 
666
- function isRemoteImage(src) {
667
- return /^(https?:)?\/\//.test(src);
587
+ const VALID_SUPPORTED_FORMATS = [
588
+ "jpeg",
589
+ "jpg",
590
+ "png",
591
+ "tiff",
592
+ "webp",
593
+ "gif",
594
+ "svg"
595
+ ];
596
+
597
+ function matchPattern(url, remotePattern) {
598
+ return matchProtocol(url, remotePattern.protocol) && matchHostname(url, remotePattern.hostname, true) && matchPort(url, remotePattern.port) && matchPathname(url, remotePattern.pathname, true);
668
599
  }
669
- function removeQueryString(src) {
670
- const index = src.lastIndexOf("?");
671
- return index > 0 ? src.substring(0, index) : src;
600
+ function matchPort(url, port) {
601
+ return !port || port === url.port;
672
602
  }
673
- function extname(src) {
674
- const base = basename(src);
675
- const index = base.lastIndexOf(".");
676
- if (index <= 0) {
677
- return "";
603
+ function matchProtocol(url, protocol) {
604
+ return !protocol || protocol === url.protocol.slice(0, -1);
605
+ }
606
+ function matchHostname(url, hostname, allowWildcard) {
607
+ if (!hostname) {
608
+ return true;
609
+ } else if (!allowWildcard || !hostname.startsWith("*")) {
610
+ return hostname === url.hostname;
611
+ } else if (hostname.startsWith("**.")) {
612
+ const slicedHostname = hostname.slice(2);
613
+ return slicedHostname !== url.hostname && url.hostname.endsWith(slicedHostname);
614
+ } else if (hostname.startsWith("*.")) {
615
+ const slicedHostname = hostname.slice(1);
616
+ const additionalSubdomains = url.hostname.replace(slicedHostname, "").split(".").filter(Boolean);
617
+ return additionalSubdomains.length === 1;
678
618
  }
679
- return base.substring(index);
619
+ return false;
680
620
  }
681
- function basename(src) {
682
- return removeQueryString(src.replace(/^.*[\\\/]/, ""));
621
+ function matchPathname(url, pathname, allowWildcard) {
622
+ if (!pathname) {
623
+ return true;
624
+ } else if (!allowWildcard || !pathname.endsWith("*")) {
625
+ return pathname === url.pathname;
626
+ } else if (pathname.endsWith("/**")) {
627
+ const slicedPathname = pathname.slice(0, -2);
628
+ return slicedPathname !== url.pathname && url.pathname.startsWith(slicedPathname);
629
+ } else if (pathname.endsWith("/*")) {
630
+ const slicedPathname = pathname.slice(0, -1);
631
+ const additionalPathChunks = url.pathname.replace(slicedPathname, "").split("/").filter(Boolean);
632
+ return additionalPathChunks.length === 1;
633
+ }
634
+ return false;
683
635
  }
684
636
 
685
- function resolveSize(transform) {
686
- if (transform.width && transform.height) {
687
- return transform;
688
- }
689
- if (!transform.width && !transform.height) {
690
- throw new Error(`"width" and "height" cannot both be undefined`);
691
- }
692
- if (!transform.aspectRatio) {
693
- throw new Error(
694
- `"aspectRatio" must be included if only "${transform.width ? "width" : "height"}" is provided`
695
- );
637
+ function isESMImportedImage(src) {
638
+ return typeof src === "object";
639
+ }
640
+ function isRemoteAllowed(src, {
641
+ domains = [],
642
+ remotePatterns = []
643
+ }) {
644
+ if (!isRemotePath(src))
645
+ return false;
646
+ const url = new URL(src);
647
+ return domains.some((domain) => matchHostname(url, domain)) || remotePatterns.some((remotePattern) => matchPattern(url, remotePattern));
648
+ }
649
+
650
+ function isLocalService(service) {
651
+ if (!service) {
652
+ return false;
696
653
  }
697
- let aspectRatio;
698
- if (typeof transform.aspectRatio === "number") {
699
- aspectRatio = transform.aspectRatio;
700
- } else {
701
- const [width, height] = transform.aspectRatio.split(":");
702
- aspectRatio = Number.parseInt(width) / Number.parseInt(height);
654
+ return "transform" in service;
655
+ }
656
+ function parseQuality(quality) {
657
+ let result = parseInt(quality);
658
+ if (Number.isNaN(result)) {
659
+ return quality;
703
660
  }
704
- if (transform.width) {
661
+ return result;
662
+ }
663
+ const baseService = {
664
+ validateOptions(options) {
665
+ if (!options.src || typeof options.src !== "string" && typeof options.src !== "object") {
666
+ throw new AstroError({
667
+ ...ExpectedImage,
668
+ message: ExpectedImage.message(JSON.stringify(options.src))
669
+ });
670
+ }
671
+ if (!isESMImportedImage(options.src)) {
672
+ if (options.src.startsWith("/@fs/")) {
673
+ throw new AstroError({
674
+ ...LocalImageUsedWrongly,
675
+ message: LocalImageUsedWrongly.message(options.src)
676
+ });
677
+ }
678
+ let missingDimension;
679
+ if (!options.width && !options.height) {
680
+ missingDimension = "both";
681
+ } else if (!options.width && options.height) {
682
+ missingDimension = "width";
683
+ } else if (options.width && !options.height) {
684
+ missingDimension = "height";
685
+ }
686
+ if (missingDimension) {
687
+ throw new AstroError({
688
+ ...MissingImageDimension,
689
+ message: MissingImageDimension.message(missingDimension, options.src)
690
+ });
691
+ }
692
+ } else {
693
+ if (!VALID_SUPPORTED_FORMATS.includes(options.src.format)) {
694
+ throw new AstroError({
695
+ ...UnsupportedImageFormat,
696
+ message: UnsupportedImageFormat.message(
697
+ options.src.format,
698
+ options.src.src,
699
+ VALID_SUPPORTED_FORMATS
700
+ )
701
+ });
702
+ }
703
+ if (options.src.format === "svg") {
704
+ options.format = "svg";
705
+ }
706
+ }
707
+ if (!options.format) {
708
+ options.format = "webp";
709
+ }
710
+ return options;
711
+ },
712
+ getHTMLAttributes(options) {
713
+ let targetWidth = options.width;
714
+ let targetHeight = options.height;
715
+ if (isESMImportedImage(options.src)) {
716
+ const aspectRatio = options.src.width / options.src.height;
717
+ if (targetHeight && !targetWidth) {
718
+ targetWidth = Math.round(targetHeight * aspectRatio);
719
+ } else if (targetWidth && !targetHeight) {
720
+ targetHeight = Math.round(targetWidth / aspectRatio);
721
+ } else if (!targetWidth && !targetHeight) {
722
+ targetWidth = options.src.width;
723
+ targetHeight = options.src.height;
724
+ }
725
+ }
726
+ const { src, width, height, format, quality, ...attributes } = options;
705
727
  return {
706
- ...transform,
707
- width: transform.width,
708
- height: Math.round(transform.width / aspectRatio)
728
+ ...attributes,
729
+ width: targetWidth,
730
+ height: targetHeight,
731
+ loading: attributes.loading ?? "lazy",
732
+ decoding: attributes.decoding ?? "async"
709
733
  };
710
- } else if (transform.height) {
711
- return {
712
- ...transform,
713
- width: Math.round(transform.height * aspectRatio),
714
- height: transform.height
734
+ },
735
+ getURL(options, imageConfig) {
736
+ const searchParams = new URLSearchParams();
737
+ if (isESMImportedImage(options.src)) {
738
+ searchParams.append("href", options.src.src);
739
+ } else if (isRemoteAllowed(options.src, imageConfig)) {
740
+ searchParams.append("href", options.src);
741
+ } else {
742
+ return options.src;
743
+ }
744
+ const params = {
745
+ w: "width",
746
+ h: "height",
747
+ q: "quality",
748
+ f: "format"
749
+ };
750
+ Object.entries(params).forEach(([param, key]) => {
751
+ options[key] && searchParams.append(param, options[key].toString());
752
+ });
753
+ const imageEndpoint = joinPaths("/", "/_image");
754
+ return `${imageEndpoint}?${searchParams}`;
755
+ },
756
+ parseURL(url) {
757
+ const params = url.searchParams;
758
+ if (!params.has("href")) {
759
+ return void 0;
760
+ }
761
+ const transform = {
762
+ src: params.get("href"),
763
+ width: params.has("w") ? parseInt(params.get("w")) : void 0,
764
+ height: params.has("h") ? parseInt(params.get("h")) : void 0,
765
+ format: params.get("f"),
766
+ quality: params.get("q")
715
767
  };
768
+ return transform;
716
769
  }
717
- return transform;
770
+ };
771
+
772
+ /* eslint-disable */
773
+ function isRemoteImage(src) {
774
+ return typeof src === "string";
718
775
  }
719
- async function resolveTransform(input) {
720
- if (typeof input.src === "string") {
721
- return resolveSize(input);
722
- }
723
- const metadata = "then" in input.src ? (await input.src).default : input.src;
724
- let { width, height, aspectRatio, background, format = metadata.format, ...rest } = input;
725
- if (!width && !height) {
726
- width = metadata.width;
727
- height = metadata.height;
728
- } else if (width) {
729
- let ratio = parseAspectRatio(aspectRatio) || metadata.width / metadata.height;
730
- height = height || Math.round(width / ratio);
731
- } else if (height) {
732
- let ratio = parseAspectRatio(aspectRatio) || metadata.width / metadata.height;
733
- width = width || Math.round(height * ratio);
776
+ async function getConfiguredImageService() {
777
+ if (!globalThis?.astroAsset?.imageService) {
778
+ const { default: service } = await import(
779
+ // @ts-expect-error
780
+ '../sharp.3f154e38.mjs'
781
+ ).catch((e) => {
782
+ const error = new AstroError(InvalidImageService);
783
+ error.cause = e;
784
+ throw error;
785
+ });
786
+ if (!globalThis.astroAsset)
787
+ globalThis.astroAsset = {};
788
+ globalThis.astroAsset.imageService = service;
789
+ return service;
734
790
  }
735
- return {
736
- ...rest,
737
- src: metadata.src,
738
- width,
739
- height,
740
- aspectRatio,
741
- format,
742
- background
743
- };
791
+ return globalThis.astroAsset.imageService;
744
792
  }
745
- async function getImage(transform) {
746
- var _a, _b, _c;
747
- if (!transform.src) {
748
- throw new Error("[@astrojs/image] `src` is required");
749
- }
750
- let loader = (_a = globalThis.astroImage) == null ? void 0 : _a.loader;
751
- if (!loader) {
752
- const { default: mod } = await import('./endpoint.js.247079ba.mjs').then(n => n.s).catch(() => {
753
- throw new Error(
754
- "[@astrojs/image] Builtin image loader not found. (Did you remember to add the integration to your Astro config?)"
755
- );
793
+ async function getImage(options, imageConfig) {
794
+ if (!options || typeof options !== "object") {
795
+ throw new AstroError({
796
+ ...ExpectedImageOptions,
797
+ message: ExpectedImageOptions.message(JSON.stringify(options))
756
798
  });
757
- loader = mod;
758
- globalThis.astroImage = globalThis.astroImage || {};
759
- globalThis.astroImage.loader = loader;
760
- }
761
- const resolved = await resolveTransform(transform);
762
- const attributes = await loader.getImageAttributes(resolved);
763
- const isDev = (_b = (Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true,"SSR":true,"SITE":"https://ecom2-demo.web.app","ASSETS_PREFIX":undefined},{SSR:true,}))) == null ? void 0 : _b.DEV;
764
- const isLocalImage = !isRemoteImage(resolved.src);
765
- const _loader = isDev && isLocalImage ? globalThis.astroImage.defaultLoader : loader;
766
- if (!_loader) {
767
- throw new Error("@astrojs/image: loader not found!");
768
- }
769
- const { searchParams } = isSSRService(_loader) ? _loader.serializeTransform(resolved) : globalThis.astroImage.defaultLoader.serializeTransform(resolved);
770
- const imgSrc = !isLocalImage && resolved.src.startsWith("//") ? `https:${resolved.src}` : resolved.src;
771
- let src;
772
- if (/^[\/\\]?@astroimage/.test(imgSrc)) {
773
- src = `${imgSrc}?${searchParams.toString()}`;
774
- } else {
775
- searchParams.set("href", imgSrc);
776
- src = `/_image?${searchParams.toString()}`;
777
799
  }
778
- if ((_c = globalThis.astroImage) == null ? void 0 : _c.addStaticImage) {
779
- src = globalThis.astroImage.addStaticImage(resolved);
800
+ const service = await getConfiguredImageService();
801
+ const resolvedOptions = {
802
+ ...options,
803
+ src: typeof options.src === "object" && "then" in options.src ? (await options.src).default : options.src
804
+ };
805
+ const validatedOptions = service.validateOptions ? await service.validateOptions(resolvedOptions, imageConfig) : resolvedOptions;
806
+ let imageURL = await service.getURL(validatedOptions, imageConfig);
807
+ if (isLocalService(service) && globalThis.astroAsset.addStaticImage && // If `getURL` returned the same URL as the user provided, it means the service doesn't need to do anything
808
+ !(isRemoteImage(validatedOptions.src) && imageURL === validatedOptions.src)) {
809
+ imageURL = globalThis.astroAsset.addStaticImage(validatedOptions);
780
810
  }
781
811
  return {
782
- ...attributes,
783
- src
812
+ rawOptions: resolvedOptions,
813
+ options: validatedOptions,
814
+ src: imageURL,
815
+ attributes: service.getHTMLAttributes !== void 0 ? service.getHTMLAttributes(validatedOptions, imageConfig) : {}
784
816
  };
785
817
  }
786
818
 
819
+ function removeQueryString(src) {
820
+ const index = src.lastIndexOf("?");
821
+ return index > 0 ? src.substring(0, index) : src;
822
+ }
823
+ function basename(src) {
824
+ return removeQueryString(src.replace(/^.*[\\\/]/, ""));
825
+ }
826
+ const extname = (src) => {
827
+ const base = basename(src);
828
+ const index = base.lastIndexOf(".");
829
+ if (index <= 0) {
830
+ return "";
831
+ }
832
+ return base.substring(index);
833
+ };
834
+ function parseAspectRatio(aspectRatio) {
835
+ if (!aspectRatio) {
836
+ return void 0;
837
+ }
838
+ if (typeof aspectRatio === "number") {
839
+ return aspectRatio;
840
+ }
841
+ const [width, height] = aspectRatio.split(":");
842
+ return parseInt(width, 10) / parseInt(height, 10);
843
+ }
787
844
  async function resolveAspectRatio({ src, aspectRatio }) {
788
845
  if (typeof src === "string") {
789
846
  return parseAspectRatio(aspectRatio);
790
- } else {
791
- const metadata = "then" in src ? (await src).default : src;
792
- return parseAspectRatio(aspectRatio) || metadata.width / metadata.height;
793
847
  }
848
+ throw new Error('Custom (faster) `Picture.runtime.astro` works only with string ("remote") src');
794
849
  }
795
850
  async function resolveFormats({ src, formats }) {
796
851
  const unique = new Set(formats);
797
852
  if (typeof src === "string") {
798
853
  unique.add(extname(src).replace(".", ""));
799
854
  } else {
800
- const metadata = "then" in src ? (await src).default : src;
801
- unique.add(extname(metadata.src).replace(".", ""));
855
+ throw new Error("Custom `Picture.ssr.astro` works only with string src");
802
856
  }
803
857
  return Array.from(unique).filter(Boolean);
804
858
  }
805
- async function getPicture(params) {
806
- const { src, alt, widths, fit, position, background } = params;
807
- if (!src) {
808
- throw new Error("[@astrojs/image] `src` is required");
809
- }
810
- if (!widths || !Array.isArray(widths)) {
811
- throw new Error("[@astrojs/image] at least one `width` is required. ex: `widths={[100]}`");
812
- }
813
- const aspectRatio = await resolveAspectRatio(params);
814
- if (!aspectRatio) {
815
- throw new Error("`aspectRatio` must be provided for remote images");
816
- }
817
- const allFormats = await resolveFormats(params);
818
- const lastFormat = allFormats[allFormats.length - 1];
819
- const maxWidth = Math.max(...widths);
820
- let image;
821
- async function getSource(format) {
822
- const imgs = await Promise.all(
823
- widths.map(async (width) => {
824
- var _a;
825
- const img = await getImage({
826
- src,
827
- alt,
828
- format,
829
- width,
830
- fit,
831
- position,
832
- background,
833
- aspectRatio
834
- });
835
- if (format === lastFormat && width === maxWidth) {
836
- image = img;
837
- }
838
- return `${(_a = img.src) == null ? void 0 : _a.replaceAll(" ", encodeURI)} ${width}w`;
839
- })
840
- );
859
+ const createPictureGetter = (getImage) => {
860
+ return async (params) => {
861
+ const {
862
+ src,
863
+ alt,
864
+ widths,
865
+ fit,
866
+ position,
867
+ background
868
+ } = params;
869
+ if (!src) {
870
+ throw new Error("[@astrojs/image] `src` is required");
871
+ }
872
+ if (!widths || !Array.isArray(widths)) {
873
+ throw new Error("[@astrojs/image] at least one `width` is required. ex: `widths={[100]}`");
874
+ }
875
+ const aspectRatio = await resolveAspectRatio(params);
876
+ if (!aspectRatio) {
877
+ throw new Error("`aspectRatio` must be provided for remote images");
878
+ }
879
+ const allFormats = await resolveFormats(params);
880
+ const lastFormat = allFormats[allFormats.length - 1];
881
+ const maxWidth = Math.max(...widths);
882
+ let image;
883
+ async function getSource(format) {
884
+ const imgs = await Promise.all(
885
+ widths.map(async (width) => {
886
+ const img = await getImage({
887
+ src,
888
+ alt,
889
+ format,
890
+ width,
891
+ height: width / aspectRatio,
892
+ fit,
893
+ position,
894
+ background,
895
+ aspectRatio
896
+ });
897
+ if (format === lastFormat && width === maxWidth) {
898
+ image = img;
899
+ }
900
+ return `${img.src} ${width}w`;
901
+ })
902
+ );
903
+ return {
904
+ type: mime.getType(format) || format,
905
+ srcset: imgs.join(",")
906
+ };
907
+ }
908
+ const sources = await Promise.all(allFormats.map((format) => getSource(format)));
841
909
  return {
842
- type: mime.getType(format) || format,
843
- srcset: imgs.join(",")
910
+ sources,
911
+ // @ts-ignore
912
+ image
844
913
  };
845
- }
846
- const sources = await Promise.all(allFormats.map((format) => getSource(format)));
847
- return {
848
- sources,
849
- // @ts-expect-error image will always be defined
850
- image
851
914
  };
852
- }
915
+ };
853
916
 
854
917
  const getAspectRatio = (src, tryImageSize) => {
855
918
  if (typeof src === "string") {
@@ -997,7 +1060,7 @@ const $$Picture = createComponent(async ($$result, $$props, $$slots) => {
997
1060
  const Astro2 = $$result.createAstro($$Astro$7, $$props, $$slots);
998
1061
  Astro2.self = $$Picture;
999
1062
  const deployRand = ({}).DEPLOY_RAND;
1000
- const versionSuffix = ({}).BUILD_OUTPUT !== "static" && deployRand ? `&V=${deployRand}` : "";
1063
+ const versionSuffix = process.env.BUILD_OUTPUT !== "static" && deployRand ? `&V=${deployRand}` : "";
1001
1064
  const getImageFilepath = (src) => {
1002
1065
  return resolve(process.env.STOREFRONT_BASE_DIR, `public${src}`);
1003
1066
  };
@@ -1005,7 +1068,7 @@ const $$Picture = createComponent(async ($$result, $$props, $$slots) => {
1005
1068
  let dimensions = {};
1006
1069
  if (typeof src === "string" && src.startsWith("/")) {
1007
1070
  try {
1008
- dimensions = sizeOf(getImageFilepath(src));
1071
+ dimensions = imageSize(getImageFilepath(src));
1009
1072
  } catch (e) {
1010
1073
  dimensions = {};
1011
1074
  }
@@ -1020,7 +1083,14 @@ const $$Picture = createComponent(async ($$result, $$props, $$slots) => {
1020
1083
  } = await useSSRPicture({
1021
1084
  ...Astro2.props,
1022
1085
  tryImageSize,
1023
- getPicture
1086
+ getPicture: createPictureGetter(async (imageOptions) => {
1087
+ const {
1088
+ options,
1089
+ src,
1090
+ attributes: { width, height }
1091
+ } = await getImage(imageOptions);
1092
+ return { src, width, height };
1093
+ })
1024
1094
  });
1025
1095
  if (imgAttrs) {
1026
1096
  imgAttrs.src += versionSuffix;
@@ -1286,9 +1356,21 @@ const usePageHeader = async ({ routeContext, listedCategoryFields }) => {
1286
1356
  };
1287
1357
  };
1288
1358
 
1289
- const useSharedData = ({ field, value }) => {
1290
- global.$storefront.data[field] = value;
1359
+ const emitter = new EventEmitter();
1360
+ const useSharedData = async ({ field, value }) => {
1361
+ const $data = global.$storefront.data;
1362
+ if (value) {
1363
+ $data[field] = value;
1364
+ emitter.emit(field, value);
1365
+ } else if ($data[field]) {
1366
+ value = $data[field];
1367
+ } else {
1368
+ value = await new Promise((resolve) => {
1369
+ emitter.once(field, resolve);
1370
+ });
1371
+ }
1291
1372
  return {
1373
+ value,
1292
1374
  inlineClientJS: `
1293
1375
  window.$storefront.data['${field}'] = ${JSON.stringify(value)};`
1294
1376
  };
@@ -3564,8 +3646,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3564
3646
  setup(__props, { expose: __expose }) {
3565
3647
  __expose();
3566
3648
  const props = __props;
3567
- const SearchModal = defineAsyncComponent(() => import('../SearchModal.f418e188.mjs'));
3568
- const CartSidebar = defineAsyncComponent(() => import('../CartSidebar.2b555408.mjs'));
3649
+ const SearchModal = defineAsyncComponent(() => import('../SearchModal.f603145b.mjs'));
3650
+ const CartSidebar = defineAsyncComponent(() => import('../CartSidebar.0ce1e999.mjs'));
3569
3651
  const header = ref(null);
3570
3652
  const {
3571
3653
  isSticky,
@@ -3589,8 +3671,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3589
3671
  onMounted(() => {
3590
3672
  isMounted.value = true;
3591
3673
  watch(totalItems, (newTotalItems, prevTotalItems) => {
3592
- if (typeof prevTotalItems === "number" && prevTotalItems < newTotalItems) {
3593
- isCartOpen.value = true;
3674
+ if (typeof prevTotalItems === "number") {
3675
+ if (prevTotalItems < newTotalItems) {
3676
+ isCartOpen.value = true;
3677
+ } else if (prevTotalItems && !newTotalItems) {
3678
+ isCartOpen.value = false;
3679
+ }
3594
3680
  }
3595
3681
  delayedTotalItems.value = newTotalItems;
3596
3682
  }, { immediate: true });
@@ -3608,7 +3694,7 @@ function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $op
3608
3694
  $setup.isSticky && !$setup.isSidenavOpen ? "bg-white/80" : "bg-white",
3609
3695
  $setup.isSticky ? "backdrop-blur-md shadow py-2 md:py-3" : "py-3 sm:py-4 md:py-5"
3610
3696
  ]]
3611
- }, _attrs))}><div class="container 2xl:max-w-7xl mx-auto px-1 lg:pr-3 lg:pl-5 xl:pr-7 xl:pl-9 2xl:pr-0 2xl:pl-2 flex md:grid grid-flow-col grid-cols-3 lg:grid-cols-none lg:auto-cols-max justify-between items-center"><div class="basis-1/4 lg:hidden"><button class="px-2 my-1"${ssrRenderAttr("aria-label", "Abrir/fechar menu")}><i class="${ssrRenderClass([$setup.isSidenavOpen ? "i-close" : "i-bars-3-bottom-left", "text-base-500 text-3xl"])}"></i></button></div>`);
3697
+ }, _attrs))}><div class="w-screen lg:w-[calc(100vw-1rem)] xl:max-w-[82rem] 2xl:max-w-[85rem] mx-auto px-1 sm:pl-2 sm:pr-2.5 lg:px-1 flex md:grid grid-flow-col grid-cols-3 lg:grid-cols-none lg:auto-cols-max justify-between items-center"><div class="basis-1/4 lg:hidden"><button class="px-2 my-1"${ssrRenderAttr("aria-label", "Abrir/fechar menu")}><i class="${ssrRenderClass([$setup.isSidenavOpen ? "i-close" : "i-bars-3-bottom-left", "text-base-500 text-3xl"])}"></i></button></div>`);
3612
3698
  ssrRenderSlot(_ctx.$slots, "logo", {}, null, _push, _parent);
3613
3699
  _push(ssrRenderComponent($setup["ShopHeaderMenu"], mergeProps({ class: "hidden lg:block" }, { inlineMenuTrees: $setup.inlineMenuTrees }), null, _parent));
3614
3700
  _push(`<div class="basis-1/4 px-2 flex justify-end items-center gap-3 lg:gap-4 text-base-800"><button${ssrRenderAttr("aria-label", "Buscar produtos")}><i class="i-magnifying-glass w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button>`);
@@ -3778,7 +3864,7 @@ const $$PageHeader = createComponent(async ($$result, $$props, $$slots) => {
3778
3864
  pitchBar,
3779
3865
  shopHeader: { categories, ...shopHeader }
3780
3866
  } = await usePageHeader({ routeContext });
3781
- const { inlineClientJS } = useSharedData({
3867
+ const { inlineClientJS } = await useSharedData({
3782
3868
  field: "categories",
3783
3869
  value: categories?.map(({ _id, ...c }) => c)
3784
3870
  });
@@ -3848,4 +3934,4 @@ const ____slug_ = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty(
3848
3934
  url: $$url
3849
3935
  }, Symbol.toStringTag, { value: 'Module' }));
3850
3936
 
3851
- export { $$Picture as $, BaseSSRService as B, Carousel as C, SocialNetworkLink as S, _export_sfc as _, CarouselControl as a, availableExtraDiscount as b, installmentsOption as c, discountOption as d, addProductToCart as e, loadRouteContext as f, $$BaseHead as g, $$PageHeader as h, isOutputFormatSupportsAlpha as i, $$Base as j, parseProduct as k, loyaltyPointsPrograms as l, freeShippingFromValue as m, shoppingCart as n, ____slug_ as o, parseShippingPhrase as p, removeCartItem as r, socialNetworks as s, totalItems as t, useId as u };
3937
+ export { $$Picture as $, Carousel as C, SocialNetworkLink as S, _export_sfc as _, CarouselControl as a, availableExtraDiscount as b, addProductToCart as c, discountOption as d, loadRouteContext as e, filterMainCategories as f, $$BaseHead as g, $$PageHeader as h, installmentsOption as i, $$Base as j, parseProduct as k, loyaltyPointsPrograms as l, useId as m, freeShippingFromValue as n, shoppingCart as o, parseShippingPhrase as p, baseService as q, removeCartItem as r, socialNetworks as s, totalItems as t, useSharedData as u, parseQuality as v, ____slug_ as w };