@commerce-blocks/sdk 2.0.0-alpha.0 → 2.0.0-alpha.1

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.
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import { signal as L, computed as N } from "@preact/signals-core";
2
- import { batch as wn, computed as On, effect as Rn, signal as kn } from "@preact/signals-core";
3
- const je = "2.0.0-alpha.0", He = {
4
- version: je
5
- }, Qe = "2026-01", Ke = "https://app.uselayers.com/api/storefront/v1", ze = 1e3, ke = 1e3, Ce = 100, Xe = 300 * ze, pe = He.version, ae = 250, B = 20, G = 250, se = 250, ie = 250, ce = 1, le = 1, Y = 1, Z = 24, ue = 1, de = 1, fe = 100, We = 20, Je = 50, Ye = 300, Ze = 50, et = "USD", tt = "en-US", nt = 1e3, we = /* @__PURE__ */ new Map();
6
- function rt(e, t) {
2
+ import { batch as wn, computed as On, effect as Cn, signal as kn } from "@preact/signals-core";
3
+ const Qe = "2.0.0-alpha.1", Ke = {
4
+ version: Qe
5
+ }, ze = "2026-01", Xe = "https://app.uselayers.com/api/storefront/v1", We = 1e3, Ce = 1e3, ke = 100, Je = 300 * We, pe = Ke.version, ae = 250, B = 20, G = 250, se = 250, ie = 250, ce = 1, le = 1, Y = 1, Z = 24, ue = 1, de = 1, fe = 100, Ye = 20, Ze = 50, et = 300, tt = 50, De = "USD", nt = "en-US", rt = 1e3, Re = /* @__PURE__ */ new Map();
6
+ function Ne(e, t) {
7
7
  const n = `${e}:${t}`;
8
- let o = we.get(n);
9
- return o || (o = new Intl.NumberFormat(tt, {
8
+ let o = Re.get(n);
9
+ return o || (o = new Intl.NumberFormat(nt, {
10
10
  style: "currency",
11
11
  currency: t
12
- }).format(e), we.set(n, o)), o;
12
+ }).format(e), Re.set(n, o)), o;
13
13
  }
14
14
  function D(e) {
15
15
  return { data: e };
@@ -91,7 +91,7 @@ function q(e) {
91
91
  input: e.input
92
92
  };
93
93
  }
94
- function C(e, t, n, o) {
94
+ function k(e, t, n, o) {
95
95
  return {
96
96
  path: e.split("."),
97
97
  field: e.split(".").pop() ?? e,
@@ -112,10 +112,10 @@ function U(e) {
112
112
  };
113
113
  }
114
114
  const ut = ["NetworkError", "ApiError", "ValidationError", "ConfigError"];
115
- function ln(e) {
115
+ function un(e) {
116
116
  return typeof e == "object" && e !== null && ut.includes(e._tag ?? "");
117
117
  }
118
- function un(e) {
118
+ function dn(e) {
119
119
  return "retryable" in e ? e.retryable : !1;
120
120
  }
121
121
  function dt(e, t) {
@@ -178,7 +178,7 @@ function Ie({
178
178
  return t && (n["Content-Type"] = "application/json"), n;
179
179
  }
180
180
  function Ee({ config: e, endpoint: t }) {
181
- const { layersBaseUrl: n = Ke } = e;
181
+ const { layersBaseUrl: n = Xe } = e;
182
182
  return `${n}${t}`;
183
183
  }
184
184
  async function x(e) {
@@ -197,18 +197,18 @@ async function x(e) {
197
197
  }
198
198
  async function ft(e) {
199
199
  const t = new URLSearchParams();
200
- for (const [s, i] of Object.entries(e.params))
201
- i != null && t.append(s, typeof i == "object" ? JSON.stringify(i) : String(i));
200
+ for (const [a, i] of Object.entries(e.params))
201
+ i != null && t.append(a, typeof i == "object" ? JSON.stringify(i) : String(i));
202
202
  const n = t.toString(), o = n ? `${e.endpoint}?${n}` : e.endpoint, r = e.config.fetch ?? fetch;
203
203
  try {
204
- const s = await r(Ee({ config: e.config, endpoint: o }), {
204
+ const a = await r(Ee({ config: e.config, endpoint: o }), {
205
205
  method: "GET",
206
206
  headers: Ie({ token: e.config.layersPublicToken }),
207
207
  signal: e.signal
208
208
  });
209
- return ye(s);
210
- } catch (s) {
211
- return v(ve(s));
209
+ return ye(a);
210
+ } catch (a) {
211
+ return v(ve(a));
212
212
  }
213
213
  }
214
214
  async function gt(e) {
@@ -229,12 +229,12 @@ function j(e, t) {
229
229
  if (!e) return null;
230
230
  const n = [];
231
231
  return e.page !== void 0 && e.page < ue && n.push(
232
- C("pagination.page", "OUT_OF_RANGE", `page must be >= ${ue}`, {
232
+ k("pagination.page", "OUT_OF_RANGE", `page must be >= ${ue}`, {
233
233
  value: e.page,
234
234
  constraints: { min: ue }
235
235
  })
236
236
  ), e.limit !== void 0 && (e.limit < de || e.limit > fe) && n.push(
237
- C(
237
+ k(
238
238
  "pagination.limit",
239
239
  "OUT_OF_RANGE",
240
240
  `limit must be between ${de} and ${fe}`,
@@ -301,13 +301,13 @@ function pt(e) {
301
301
  fetch: e.fetch
302
302
  };
303
303
  return D({
304
- browse: async (r, s) => {
304
+ browse: async (r, a) => {
305
305
  if (!r.collectionHandle)
306
306
  return v(
307
307
  q({
308
308
  operation: "browse",
309
309
  fields: [
310
- C("collectionHandle", "REQUIRED_FIELD", "collectionHandle is required")
310
+ k("collectionHandle", "REQUIRED_FIELD", "collectionHandle is required")
311
311
  ]
312
312
  })
313
313
  );
@@ -316,13 +316,13 @@ function pt(e) {
316
316
  q({
317
317
  operation: "browse",
318
318
  fields: [
319
- C("sort_order_code", "REQUIRED_FIELD", "sort_order_code is required")
319
+ k("sort_order_code", "REQUIRED_FIELD", "sort_order_code is required")
320
320
  ]
321
321
  })
322
322
  );
323
323
  const i = j(r.pagination, "browse");
324
324
  if (i) return v(i);
325
- const { collectionHandle: a, attributes: l, transformBody: c, ...g } = r;
325
+ const { collectionHandle: s, attributes: l, transformBody: c, ...g } = r;
326
326
  let d = {
327
327
  facets: e.facets.map((p) => p.code),
328
328
  attributes: t(l),
@@ -332,50 +332,50 @@ function pt(e) {
332
332
  };
333
333
  return c && (d = c(d)), x({
334
334
  config: n,
335
- endpoint: `/browse/${a}`,
335
+ endpoint: `/browse/${s}`,
336
336
  body: d,
337
- signal: s
337
+ signal: a
338
338
  });
339
339
  },
340
- predictiveSearch: async (r, s) => r ? ft({
340
+ predictiveSearch: async (r, a) => r ? ft({
341
341
  config: n,
342
342
  endpoint: "/search/complete",
343
343
  params: { query: r },
344
- signal: s
344
+ signal: a
345
345
  }) : v(
346
346
  q({
347
347
  operation: "predictiveSearch",
348
- fields: [C("query", "REQUIRED_FIELD", "query is required")]
348
+ fields: [k("query", "REQUIRED_FIELD", "query is required")]
349
349
  })
350
350
  ),
351
- prepareSearch: async (r, s) => {
351
+ prepareSearch: async (r, a) => {
352
352
  if (!r.query)
353
353
  return v(
354
354
  q({
355
355
  operation: "prepareSearch",
356
- fields: [C("query", "REQUIRED_FIELD", "query is required")]
356
+ fields: [k("query", "REQUIRED_FIELD", "query is required")]
357
357
  })
358
358
  );
359
- const { query: i, transformBody: a, ...l } = r;
359
+ const { query: i, transformBody: s, ...l } = r;
360
360
  let c = { ...l };
361
- return a && (c = a(c)), x({
361
+ return s && (c = s(c)), x({
362
362
  config: n,
363
363
  endpoint: `/search/${encodeURIComponent(i)}/prepare`,
364
364
  body: c,
365
- signal: s
365
+ signal: a
366
366
  });
367
367
  },
368
- search: async (r, s) => {
368
+ search: async (r, a) => {
369
369
  if (!r.query)
370
370
  return v(
371
371
  q({
372
372
  operation: "search",
373
- fields: [C("query", "REQUIRED_FIELD", "query is required")]
373
+ fields: [k("query", "REQUIRED_FIELD", "query is required")]
374
374
  })
375
375
  );
376
376
  const i = j(r.pagination, "search");
377
377
  if (i) return v(i);
378
- const { query: a, attributes: l, transformBody: c, ...g } = r;
378
+ const { query: s, attributes: l, transformBody: c, ...g } = r;
379
379
  let d = {
380
380
  facets: e.facets.map((p) => p.code),
381
381
  attributes: t(l),
@@ -385,55 +385,55 @@ function pt(e) {
385
385
  };
386
386
  return c && (d = c(d)), x({
387
387
  config: n,
388
- endpoint: `/search/${encodeURIComponent(a)}/execute`,
388
+ endpoint: `/search/${encodeURIComponent(s)}/execute`,
389
389
  body: d,
390
- signal: s
390
+ signal: a
391
391
  });
392
392
  },
393
- imageSearch: async (r, s) => {
393
+ imageSearch: async (r, a) => {
394
394
  if (!r.image_data && !r.image_id)
395
395
  return v(
396
396
  q({
397
397
  operation: "imageSearch",
398
398
  fields: [
399
- C("image_data", "REQUIRED_FIELD", "image_data or image_id is required")
399
+ k("image_data", "REQUIRED_FIELD", "image_data or image_id is required")
400
400
  ]
401
401
  })
402
402
  );
403
403
  const i = j(r.pagination, "imageSearch");
404
404
  if (i) return v(i);
405
- const { attributes: a, transformBody: l, ...c } = r;
405
+ const { attributes: s, transformBody: l, ...c } = r;
406
406
  let g = {
407
- attributes: t(a),
407
+ attributes: t(s),
408
408
  ...c
409
409
  };
410
410
  return l && (g = l(g)), x({
411
411
  config: n,
412
412
  endpoint: "/search/image",
413
413
  body: g,
414
- signal: s
414
+ signal: a
415
415
  });
416
416
  },
417
- uploadImage: async (r, s) => {
417
+ uploadImage: async (r, a) => {
418
418
  const i = new FormData();
419
419
  return i.append("image", r), gt({
420
420
  config: n,
421
421
  endpoint: "/images/upload",
422
422
  formData: i,
423
- signal: s
423
+ signal: a
424
424
  });
425
425
  },
426
- blocks: async (r, s) => {
426
+ blocks: async (r, a) => {
427
427
  if (!r.blockId)
428
428
  return v(
429
429
  q({
430
430
  operation: "block",
431
- fields: [C("blockId", "REQUIRED_FIELD", "blockId is required")]
431
+ fields: [k("blockId", "REQUIRED_FIELD", "blockId is required")]
432
432
  })
433
433
  );
434
434
  const i = j(r.pagination, "block");
435
435
  if (i) return v(i);
436
- const { blockId: a, attributes: l, transformBody: c, ...g } = r;
436
+ const { blockId: s, attributes: l, transformBody: c, ...g } = r;
437
437
  let d = {
438
438
  facets: e.facets.map((p) => p.code),
439
439
  attributes: t(l),
@@ -443,31 +443,31 @@ function pt(e) {
443
443
  };
444
444
  return c && (d = c(d)), x({
445
445
  config: n,
446
- endpoint: `/blocks/${a}/products`,
446
+ endpoint: `/blocks/${s}/products`,
447
447
  body: d,
448
- signal: s
448
+ signal: a
449
449
  });
450
450
  },
451
- similarProducts: async (r, s) => {
451
+ similarProducts: async (r, a) => {
452
452
  if (!r.productId)
453
453
  return v(
454
454
  q({
455
455
  operation: "similarProducts",
456
- fields: [C("productId", "REQUIRED_FIELD", "productId is required")]
456
+ fields: [k("productId", "REQUIRED_FIELD", "productId is required")]
457
457
  })
458
458
  );
459
459
  const i = j(r.pagination, "similarProducts");
460
460
  if (i) return v(i);
461
- const { productId: a, attributes: l, transformBody: c, ...g } = r;
461
+ const { productId: s, attributes: l, transformBody: c, ...g } = r;
462
462
  let d = {
463
463
  attributes: t(l),
464
464
  ...g
465
465
  };
466
466
  return c && (d = c(d)), x({
467
467
  config: n,
468
- endpoint: `/search/product/${a}`,
468
+ endpoint: `/search/product/${s}`,
469
469
  body: d,
470
- signal: s
470
+ signal: a
471
471
  });
472
472
  }
473
473
  });
@@ -477,14 +477,14 @@ const te = `
477
477
  title
478
478
  description
479
479
  }
480
- `, De = `
480
+ `, qe = `
481
481
  fragment FilterValueFields on FilterValue {
482
482
  id
483
483
  label
484
484
  count
485
485
  input
486
486
  }
487
- `, Ne = `
487
+ `, $e = `
488
488
  fragment FilterFields on Filter {
489
489
  id
490
490
  label
@@ -536,7 +536,7 @@ const te = `
536
536
  type
537
537
  }
538
538
  `;
539
- function Ae(e) {
539
+ function Pe(e) {
540
540
  return `
541
541
  fragment VariantFields on ProductVariant {
542
542
  id
@@ -552,7 +552,7 @@ function Ae(e) {
552
552
  }
553
553
  `;
554
554
  }
555
- function Te(e) {
555
+ function Ae(e) {
556
556
  const { maxImages: t, maxVariants: n, includeProductMetafields: o } = e;
557
557
  return `
558
558
  fragment ProductFields on Product {
@@ -577,7 +577,7 @@ function Te(e) {
577
577
  }
578
578
  `;
579
579
  }
580
- function qe(e) {
580
+ function Le(e) {
581
581
  return `
582
582
  fragment CollectionFields on Collection {
583
583
  id
@@ -592,7 +592,7 @@ function qe(e) {
592
592
  }
593
593
  `;
594
594
  }
595
- function $e(e) {
595
+ function Ve(e) {
596
596
  return `
597
597
  fragment PageFields on Page {
598
598
  id
@@ -617,8 +617,8 @@ function ht(e) {
617
617
  Se,
618
618
  Me,
619
619
  t || n ? z : "",
620
- Ae(n),
621
- Te(e)
620
+ Pe(n),
621
+ Ae(e)
622
622
  ].join(`
623
623
  `);
624
624
  }
@@ -628,16 +628,16 @@ function _t(e = {}) {
628
628
  maxVariants: n = G,
629
629
  productMetafields: o = [],
630
630
  variantMetafields: r = []
631
- } = e, s = o.length > 0, i = r.length > 0, a = ["$ids: [ID!]!"];
632
- return s && a.push("$productMetafields: [HasMetafieldsIdentifier!]!"), i && a.push("$variantMetafields: [HasMetafieldsIdentifier!]!"), `
631
+ } = e, a = o.length > 0, i = r.length > 0, s = ["$ids: [ID!]!"];
632
+ return a && s.push("$productMetafields: [HasMetafieldsIdentifier!]!"), i && s.push("$variantMetafields: [HasMetafieldsIdentifier!]!"), `
633
633
  ${ht({
634
634
  maxImages: t,
635
635
  maxVariants: n,
636
- includeProductMetafields: s,
636
+ includeProductMetafields: a,
637
637
  includeVariantMetafields: i
638
638
  })}
639
639
 
640
- query ProductsByIds(${a.join(", ")}) {
640
+ query ProductsByIds(${s.join(", ")}) {
641
641
  nodes(ids: $ids) {
642
642
  ... on Product {
643
643
  ...ProductFields
@@ -652,10 +652,10 @@ function vt(e = {}) {
652
652
  maxVariants: n = G,
653
653
  productMetafields: o = [],
654
654
  variantMetafields: r = [],
655
- collectionMetafields: s = [],
655
+ collectionMetafields: a = [],
656
656
  includeFilters: i = !1
657
- } = e, a = o.length > 0, l = r.length > 0, c = s.length > 0, g = a || l || c, d = ["$ids: [ID!]!", "$handle: String!"];
658
- return a && d.push("$productMetafields: [HasMetafieldsIdentifier!]!"), l && d.push("$variantMetafields: [HasMetafieldsIdentifier!]!"), c && d.push("$collectionMetafields: [HasMetafieldsIdentifier!]!"), `
657
+ } = e, s = o.length > 0, l = r.length > 0, c = a.length > 0, g = s || l || c, d = ["$ids: [ID!]!", "$handle: String!"];
658
+ return s && d.push("$productMetafields: [HasMetafieldsIdentifier!]!"), l && d.push("$variantMetafields: [HasMetafieldsIdentifier!]!"), c && d.push("$collectionMetafields: [HasMetafieldsIdentifier!]!"), `
659
659
  ${[
660
660
  ne,
661
661
  be,
@@ -664,15 +664,15 @@ function vt(e = {}) {
664
664
  Me,
665
665
  te,
666
666
  g ? z : "",
667
- i ? De : "",
668
- i ? Ne : "",
669
- Ae(l),
670
- Te({
667
+ i ? qe : "",
668
+ i ? $e : "",
669
+ Pe(l),
670
+ Ae({
671
671
  maxImages: t,
672
672
  maxVariants: n,
673
- includeProductMetafields: a
673
+ includeProductMetafields: s
674
674
  }),
675
- qe(c)
675
+ Le(c)
676
676
  ].join(`
677
677
  `)}
678
678
 
@@ -696,9 +696,9 @@ function yt(e = {}) {
696
696
  ne,
697
697
  te,
698
698
  o ? z : "",
699
- n ? De : "",
700
- n ? Ne : "",
701
- qe(o)
699
+ n ? qe : "",
700
+ n ? $e : "",
701
+ Le(o)
702
702
  ].join(`
703
703
  `)}
704
704
 
@@ -716,7 +716,7 @@ function It(e = {}) {
716
716
  ${[
717
717
  te,
718
718
  n ? z : "",
719
- $e(n)
719
+ Ve(n)
720
720
  ].join(`
721
721
  `)}
722
722
 
@@ -733,9 +733,9 @@ function Et(e = {}) {
733
733
  maxVariants: n = G,
734
734
  productMetafields: o = [],
735
735
  variantMetafields: r = [],
736
- pageMetafields: s = []
737
- } = e, i = o.length > 0, a = r.length > 0, l = s.length > 0, c = i || a || l, g = ["$ids: [ID!]!", "$handle: String!"];
738
- return i && g.push("$productMetafields: [HasMetafieldsIdentifier!]!"), a && g.push("$variantMetafields: [HasMetafieldsIdentifier!]!"), l && g.push("$pageMetafields: [HasMetafieldsIdentifier!]!"), `
736
+ pageMetafields: a = []
737
+ } = e, i = o.length > 0, s = r.length > 0, l = a.length > 0, c = i || s || l, g = ["$ids: [ID!]!", "$handle: String!"];
738
+ return i && g.push("$productMetafields: [HasMetafieldsIdentifier!]!"), s && g.push("$variantMetafields: [HasMetafieldsIdentifier!]!"), l && g.push("$pageMetafields: [HasMetafieldsIdentifier!]!"), `
739
739
  ${[
740
740
  ne,
741
741
  be,
@@ -744,13 +744,13 @@ function Et(e = {}) {
744
744
  Me,
745
745
  te,
746
746
  c ? z : "",
747
- Ae(a),
748
- Te({
747
+ Pe(s),
748
+ Ae({
749
749
  maxImages: t,
750
750
  maxVariants: n,
751
751
  includeProductMetafields: i
752
752
  }),
753
- $e(l)
753
+ Ve(l)
754
754
  ].join(`
755
755
  `)}
756
756
 
@@ -774,15 +774,15 @@ function bt({
774
774
  }) {
775
775
  const r = `https://${e}/api/${n}/graphql.json`;
776
776
  return {
777
- async request(s, { variables: i, signal: a } = {}) {
777
+ async request(a, { variables: i, signal: s } = {}) {
778
778
  const l = await o(r, {
779
779
  method: "POST",
780
780
  headers: {
781
781
  "Content-Type": "application/json",
782
782
  "X-Shopify-Storefront-Access-Token": t
783
783
  },
784
- body: JSON.stringify({ query: s, variables: i }),
785
- signal: a
784
+ body: JSON.stringify({ query: a, variables: i }),
785
+ signal: s
786
786
  });
787
787
  if (!l.ok)
788
788
  return {
@@ -819,7 +819,7 @@ function Ft(e) {
819
819
  expected: "non-empty string"
820
820
  })
821
821
  );
822
- const { storefrontApiVersion: t = Qe } = e, n = bt({
822
+ const { storefrontApiVersion: t = ze } = e, n = bt({
823
823
  shop: e.shop,
824
824
  token: e.storefrontPublicToken,
825
825
  apiVersion: t,
@@ -828,26 +828,26 @@ function Ft(e) {
828
828
  return D({
829
829
  async getProducts(r) {
830
830
  const {
831
- ids: s,
831
+ ids: a,
832
832
  productMetafields: i = [],
833
- variantMetafields: a = [],
833
+ variantMetafields: s = [],
834
834
  maxImages: l = B,
835
835
  maxVariants: c = G,
836
836
  signal: g
837
837
  } = r, d = me(r);
838
838
  if (d.length > 0)
839
839
  return v(q({ operation: "getProducts", fields: d }));
840
- if (s.length === 0)
840
+ if (a.length === 0)
841
841
  return D([]);
842
842
  const p = _t({
843
843
  maxImages: l,
844
844
  maxVariants: c,
845
845
  productMetafields: i,
846
- variantMetafields: a
847
- }), u = ge({ ids: s, maxSize: ae }), f = [];
846
+ variantMetafields: s
847
+ }), u = ge({ ids: a, maxSize: ae }), f = [];
848
848
  for (const h of u) {
849
849
  const y = { ids: h };
850
- i.length > 0 && (y.productMetafields = i), a.length > 0 && (y.variantMetafields = a);
850
+ i.length > 0 && (y.productMetafields = i), s.length > 0 && (y.variantMetafields = s);
851
851
  const E = await St({ graphqlClient: n, query: p, variables: y, signal: g });
852
852
  if (E.error)
853
853
  return E;
@@ -856,15 +856,15 @@ function Ft(e) {
856
856
  return D(f);
857
857
  },
858
858
  async getCollection(r) {
859
- const { handle: s, collectionMetafields: i = [], includeFilters: a = !1, signal: l } = r;
860
- if (!s)
859
+ const { handle: a, collectionMetafields: i = [], includeFilters: s = !1, signal: l } = r;
860
+ if (!a)
861
861
  return v(
862
862
  q({
863
863
  operation: "getCollection",
864
- fields: [C("handle", "REQUIRED_FIELD", "handle is required")]
864
+ fields: [k("handle", "REQUIRED_FIELD", "handle is required")]
865
865
  })
866
866
  );
867
- const c = yt({ collectionMetafields: i, includeFilters: a }), g = { handle: s };
867
+ const c = yt({ collectionMetafields: i, includeFilters: s }), g = { handle: a };
868
868
  i.length > 0 && (g.collectionMetafields = i);
869
869
  try {
870
870
  const { data: d, errors: p } = await n.request(c, { variables: g, signal: l });
@@ -875,7 +875,7 @@ function Ft(e) {
875
875
  $({
876
876
  code: "NOT_FOUND",
877
877
  source: "storefront",
878
- message: `Collection not found: ${s}`
878
+ message: `Collection not found: ${a}`
879
879
  })
880
880
  );
881
881
  } catch (d) {
@@ -884,9 +884,9 @@ function Ft(e) {
884
884
  },
885
885
  async getCollectionWithProducts(r) {
886
886
  const {
887
- handle: s,
887
+ handle: a,
888
888
  ids: i,
889
- productMetafields: a = [],
889
+ productMetafields: s = [],
890
890
  variantMetafields: l = [],
891
891
  collectionMetafields: c = [],
892
892
  includeFilters: g = !1,
@@ -894,7 +894,7 @@ function Ft(e) {
894
894
  maxVariants: p = G,
895
895
  signal: u
896
896
  } = r, f = me(r);
897
- if (s || f.push(C("handle", "REQUIRED_FIELD", "handle is required")), f.length > 0)
897
+ if (a || f.push(k("handle", "REQUIRED_FIELD", "handle is required")), f.length > 0)
898
898
  return v(
899
899
  q({
900
900
  operation: "getCollectionWithProducts",
@@ -904,30 +904,30 @@ function Ft(e) {
904
904
  const h = vt({
905
905
  maxImages: d,
906
906
  maxVariants: p,
907
- productMetafields: a,
907
+ productMetafields: s,
908
908
  variantMetafields: l,
909
909
  collectionMetafields: c,
910
910
  includeFilters: g
911
911
  }), y = i.length > 0 ? ge({ ids: i, maxSize: ae }) : [[]];
912
912
  let E = null;
913
913
  const M = [];
914
- for (let T = 0; T < y.length; T++) {
915
- const b = { ids: y[T], handle: s };
916
- a.length > 0 && (b.productMetafields = a), l.length > 0 && (b.variantMetafields = l), c.length > 0 && (b.collectionMetafields = c);
914
+ for (let A = 0; A < y.length; A++) {
915
+ const b = { ids: y[A], handle: a };
916
+ s.length > 0 && (b.productMetafields = s), l.length > 0 && (b.variantMetafields = l), c.length > 0 && (b.collectionMetafields = c);
917
917
  try {
918
918
  const { data: m, errors: _ } = await n.request(h, { variables: b, signal: u });
919
919
  if (_)
920
920
  return v(H(_));
921
921
  const F = m;
922
- if (T === 0 && (E = F.collection ?? null, !E))
922
+ if (A === 0 && (E = F.collection ?? null, !E))
923
923
  return v(
924
924
  $({
925
925
  code: "NOT_FOUND",
926
926
  source: "storefront",
927
- message: `Collection not found: ${s}`
927
+ message: `Collection not found: ${a}`
928
928
  })
929
929
  );
930
- const S = (F.nodes ?? []).filter((A) => A !== null);
930
+ const S = (F.nodes ?? []).filter((P) => P !== null);
931
931
  M.push(...S);
932
932
  } catch (m) {
933
933
  return v(Q(m));
@@ -936,18 +936,18 @@ function Ft(e) {
936
936
  return D({ collection: E, products: M });
937
937
  },
938
938
  async getPage(r) {
939
- const { handle: s, pageMetafields: i = [], signal: a } = r;
940
- if (!s)
939
+ const { handle: a, pageMetafields: i = [], signal: s } = r;
940
+ if (!a)
941
941
  return v(
942
942
  q({
943
943
  operation: "getPage",
944
- fields: [C("handle", "REQUIRED_FIELD", "handle is required")]
944
+ fields: [k("handle", "REQUIRED_FIELD", "handle is required")]
945
945
  })
946
946
  );
947
- const l = It({ pageMetafields: i }), c = { handle: s };
947
+ const l = It({ pageMetafields: i }), c = { handle: a };
948
948
  i.length > 0 && (c.pageMetafields = i);
949
949
  try {
950
- const { data: g, errors: d } = await n.request(l, { variables: c, signal: a });
950
+ const { data: g, errors: d } = await n.request(l, { variables: c, signal: s });
951
951
  if (d)
952
952
  return v(H(d));
953
953
  const p = g;
@@ -955,7 +955,7 @@ function Ft(e) {
955
955
  $({
956
956
  code: "NOT_FOUND",
957
957
  source: "storefront",
958
- message: `Page not found: ${s}`
958
+ message: `Page not found: ${a}`
959
959
  })
960
960
  );
961
961
  } catch (g) {
@@ -964,33 +964,33 @@ function Ft(e) {
964
964
  },
965
965
  async getPageWithProducts(r) {
966
966
  const {
967
- handle: s,
967
+ handle: a,
968
968
  ids: i,
969
- productMetafields: a = [],
969
+ productMetafields: s = [],
970
970
  variantMetafields: l = [],
971
971
  pageMetafields: c = [],
972
972
  maxImages: g = B,
973
973
  maxVariants: d = G,
974
974
  signal: p
975
975
  } = r, u = me(r);
976
- if (s || u.push(C("handle", "REQUIRED_FIELD", "handle is required")), u.length > 0)
976
+ if (a || u.push(k("handle", "REQUIRED_FIELD", "handle is required")), u.length > 0)
977
977
  return v(
978
978
  q({ operation: "getPageWithProducts", fields: u })
979
979
  );
980
980
  const f = Et({
981
981
  maxImages: g,
982
982
  maxVariants: d,
983
- productMetafields: a,
983
+ productMetafields: s,
984
984
  variantMetafields: l,
985
985
  pageMetafields: c
986
986
  }), h = i.length > 0 ? ge({ ids: i, maxSize: ae }) : [[]];
987
987
  let y = null;
988
988
  const E = [];
989
989
  for (let M = 0; M < h.length; M++) {
990
- const w = { ids: h[M], handle: s };
991
- a.length > 0 && (w.productMetafields = a), l.length > 0 && (w.variantMetafields = l), c.length > 0 && (w.pageMetafields = c);
990
+ const R = { ids: h[M], handle: a };
991
+ s.length > 0 && (R.productMetafields = s), l.length > 0 && (R.variantMetafields = l), c.length > 0 && (R.pageMetafields = c);
992
992
  try {
993
- const { data: b, errors: m } = await n.request(f, { variables: w, signal: p });
993
+ const { data: b, errors: m } = await n.request(f, { variables: R, signal: p });
994
994
  if (m)
995
995
  return v(H(m));
996
996
  const _ = b;
@@ -999,7 +999,7 @@ function Ft(e) {
999
999
  $({
1000
1000
  code: "NOT_FOUND",
1001
1001
  source: "storefront",
1002
- message: `Page not found: ${s}`
1002
+ message: `Page not found: ${a}`
1003
1003
  })
1004
1004
  );
1005
1005
  const F = (_.nodes ?? []).filter((S) => S !== null);
@@ -1015,7 +1015,7 @@ function Ft(e) {
1015
1015
  function me(e) {
1016
1016
  const t = [];
1017
1017
  e.maxImages !== void 0 && (e.maxImages < ce || e.maxImages > se) && t.push(
1018
- C(
1018
+ k(
1019
1019
  "maxImages",
1020
1020
  "OUT_OF_RANGE",
1021
1021
  `maxImages must be between ${ce} and ${se}`,
@@ -1025,7 +1025,7 @@ function me(e) {
1025
1025
  }
1026
1026
  )
1027
1027
  ), e.maxVariants !== void 0 && (e.maxVariants < le || e.maxVariants > ie) && t.push(
1028
- C(
1028
+ k(
1029
1029
  "maxVariants",
1030
1030
  "OUT_OF_RANGE",
1031
1031
  `maxVariants must be between ${le} and ${ie}`,
@@ -1037,7 +1037,7 @@ function me(e) {
1037
1037
  );
1038
1038
  for (const n of e.productMetafields ?? [])
1039
1039
  (!n.namespace || !n.key) && t.push(
1040
- C(
1040
+ k(
1041
1041
  "productMetafields",
1042
1042
  "REQUIRED_FIELD",
1043
1043
  "Metafield identifier requires both namespace and key",
@@ -1049,7 +1049,7 @@ function me(e) {
1049
1049
  );
1050
1050
  for (const n of e.variantMetafields ?? [])
1051
1051
  (!n.namespace || !n.key) && t.push(
1052
- C(
1052
+ k(
1053
1053
  "variantMetafields",
1054
1054
  "REQUIRED_FIELD",
1055
1055
  "Metafield identifier requires both namespace and key",
@@ -1068,11 +1068,11 @@ async function St({
1068
1068
  signal: o
1069
1069
  }) {
1070
1070
  try {
1071
- const { data: r, errors: s } = await e.request(t, { variables: n, signal: o });
1072
- if (s)
1073
- return v(H(s));
1071
+ const { data: r, errors: a } = await e.request(t, { variables: n, signal: o });
1072
+ if (a)
1073
+ return v(H(a));
1074
1074
  const i = (r?.nodes ?? []).filter(
1075
- (a) => a !== null
1075
+ (s) => s !== null
1076
1076
  );
1077
1077
  return D(i);
1078
1078
  } catch (r) {
@@ -1131,14 +1131,14 @@ function Q(e) {
1131
1131
  });
1132
1132
  }
1133
1133
  const Mt = "cb-sdk-store";
1134
- function At(e) {
1134
+ function Pt(e) {
1135
1135
  return typeof window > "u" || !window.localStorage ? null : {
1136
1136
  read: () => window.localStorage.getItem(e),
1137
1137
  write: (t) => window.localStorage.setItem(e, t),
1138
1138
  remove: () => window.localStorage.removeItem(e)
1139
1139
  };
1140
1140
  }
1141
- function dn(e, t) {
1141
+ function fn(e, t) {
1142
1142
  return {
1143
1143
  read() {
1144
1144
  try {
@@ -1161,33 +1161,33 @@ function dn(e, t) {
1161
1161
  }
1162
1162
  };
1163
1163
  }
1164
- function Tt(e) {
1165
- typeof requestIdleCallback == "function" ? requestIdleCallback(e, { timeout: nt }) : setTimeout(e, 0);
1164
+ function At(e) {
1165
+ typeof requestIdleCallback == "function" ? requestIdleCallback(e, { timeout: rt }) : setTimeout(e, 0);
1166
1166
  }
1167
- function Oe(e) {
1167
+ function we(e) {
1168
1168
  return [...e].sort((t, n) => n[1].timestamp - t[1].timestamp);
1169
1169
  }
1170
- function Pt({
1170
+ function Tt({
1171
1171
  storageKey: e = Mt,
1172
- maxProducts: t = ke,
1173
- maxQueries: n = Ce,
1172
+ maxProducts: t = Ce,
1173
+ maxQueries: n = ke,
1174
1174
  adapter: o
1175
1175
  } = {}) {
1176
- const r = o ?? At(e);
1177
- let s = 0;
1176
+ const r = o ?? Pt(e);
1177
+ let a = 0;
1178
1178
  return {
1179
1179
  save(i) {
1180
1180
  if (!r) return;
1181
- const a = ++s;
1182
- Tt(() => {
1183
- if (a === s)
1181
+ const s = ++a;
1182
+ At(() => {
1183
+ if (s === a)
1184
1184
  try {
1185
1185
  const l = {
1186
- products: Oe(i.products).slice(
1186
+ products: we(i.products).slice(
1187
1187
  0,
1188
1188
  t
1189
1189
  ),
1190
- queries: Oe(i.queries).slice(0, n),
1190
+ queries: we(i.queries).slice(0, n),
1191
1191
  collections: i.collections,
1192
1192
  version: pe
1193
1193
  };
@@ -1201,47 +1201,47 @@ function Pt({
1201
1201
  try {
1202
1202
  const i = r.read();
1203
1203
  if (!i) return null;
1204
- const a = JSON.parse(i);
1205
- return a.version !== pe || !Array.isArray(a.products) || !Array.isArray(a.queries) ? (r.remove(), null) : a;
1204
+ const s = JSON.parse(i);
1205
+ return s.version !== pe || !Array.isArray(s.products) || !Array.isArray(s.queries) ? (r.remove(), null) : s;
1206
1206
  } catch {
1207
1207
  return r.remove(), null;
1208
1208
  }
1209
1209
  },
1210
1210
  clear() {
1211
- s++, r?.remove();
1211
+ a++, r?.remove();
1212
1212
  }
1213
1213
  };
1214
1214
  }
1215
- function wt(e, t) {
1215
+ function Rt(e, t) {
1216
1216
  if (e.size <= t) return;
1217
- const o = [...e.entries()].sort((r, s) => r[1].timestamp - s[1].timestamp).slice(0, e.size - t);
1217
+ const o = [...e.entries()].sort((r, a) => r[1].timestamp - a[1].timestamp).slice(0, e.size - t);
1218
1218
  for (const [r] of o)
1219
1219
  e.delete(r);
1220
1220
  }
1221
- function Ot(e, t) {
1221
+ function wt(e, t) {
1222
1222
  if (e.size <= t) return;
1223
1223
  const n = [];
1224
- for (const [r, s] of e)
1225
- s.value && n.push([r, s.value.timestamp]);
1226
- n.sort((r, s) => r[1] - s[1]);
1224
+ for (const [r, a] of e)
1225
+ a.value && n.push([r, a.value.timestamp]);
1226
+ n.sort((r, a) => r[1] - a[1]);
1227
1227
  const o = n.slice(0, e.size - t);
1228
1228
  for (const [r] of o) {
1229
- const s = e.get(r);
1230
- s && (s.value = null), e.delete(r);
1229
+ const a = e.get(r);
1230
+ a && (a.value = null), e.delete(r);
1231
1231
  }
1232
1232
  }
1233
- function Rt(e = {}) {
1233
+ function Ot(e = {}) {
1234
1234
  const {
1235
- ttl: t = Xe,
1236
- maxProducts: n = ke,
1237
- maxQueries: o = Ce,
1235
+ ttl: t = Je,
1236
+ maxProducts: n = Ce,
1237
+ maxQueries: o = ke,
1238
1238
  storageKey: r,
1239
- storageAdapter: s
1240
- } = e, i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), g = Pt({
1239
+ storageAdapter: a
1240
+ } = e, i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), g = Tt({
1241
1241
  storageKey: r,
1242
1242
  maxProducts: n,
1243
1243
  maxQueries: o,
1244
- adapter: s
1244
+ adapter: a
1245
1245
  });
1246
1246
  function d(u) {
1247
1247
  return Date.now() - u > t;
@@ -1274,7 +1274,7 @@ function Rt(e = {}) {
1274
1274
  const f = Date.now(), h = Array.isArray(u) ? u : [u];
1275
1275
  for (const y of h)
1276
1276
  i.set(y.gid, { data: y, timestamp: f });
1277
- wt(i, n);
1277
+ Rt(i, n);
1278
1278
  },
1279
1279
  has(u) {
1280
1280
  const f = i.get(u);
@@ -1287,7 +1287,7 @@ function Rt(e = {}) {
1287
1287
  },
1288
1288
  set(u, f) {
1289
1289
  const h = p(u);
1290
- h.value = { data: f, timestamp: Date.now() }, Ot(c, o);
1290
+ h.value = { data: f, timestamp: Date.now() }, wt(c, o);
1291
1291
  },
1292
1292
  isExpired(u) {
1293
1293
  const f = c.get(u);
@@ -1300,13 +1300,13 @@ function Rt(e = {}) {
1300
1300
  },
1301
1301
  collections: {
1302
1302
  get(u) {
1303
- return a.get(u);
1303
+ return s.get(u);
1304
1304
  },
1305
1305
  set(u, f) {
1306
- a.set(u, { ...f, handle: u });
1306
+ s.set(u, { ...f, handle: u });
1307
1307
  },
1308
1308
  delete(u) {
1309
- a.delete(u);
1309
+ s.delete(u);
1310
1310
  }
1311
1311
  },
1312
1312
  pages: {
@@ -1326,7 +1326,7 @@ function Rt(e = {}) {
1326
1326
  d(E.timestamp) || u.push([y, E]);
1327
1327
  for (const [y, E] of c)
1328
1328
  E.value && !d(E.value.timestamp) && f.push([y, E.value]);
1329
- for (const [y, E] of a)
1329
+ for (const [y, E] of s)
1330
1330
  h.push([y, E]);
1331
1331
  g.save({ products: u, queries: f, collections: h });
1332
1332
  },
@@ -1341,123 +1341,123 @@ function Rt(e = {}) {
1341
1341
  y.value = h;
1342
1342
  }
1343
1343
  for (const [f, h] of u.collections)
1344
- a.set(f, h);
1344
+ s.set(f, h);
1345
1345
  }
1346
1346
  },
1347
1347
  clear() {
1348
1348
  i.clear();
1349
1349
  for (const u of c.values()) u.value = null;
1350
- c.clear(), a.clear(), l.clear(), g.clear();
1350
+ c.clear(), s.clear(), l.clear(), g.clear();
1351
1351
  },
1352
1352
  get stats() {
1353
1353
  return {
1354
1354
  products: i.size,
1355
1355
  queries: c.size,
1356
- collections: a.size,
1356
+ collections: s.size,
1357
1357
  pages: l.size
1358
1358
  };
1359
1359
  }
1360
1360
  };
1361
1361
  }
1362
- function Le(e, t) {
1362
+ function Ue(e, t) {
1363
1363
  return `gid://shopify/${e}/${t}`;
1364
1364
  }
1365
- function kt(e) {
1366
- return Le("Product", e);
1367
- }
1368
1365
  function Ct(e) {
1369
- return Le("ProductVariant", e);
1366
+ return Ue("Product", e);
1370
1367
  }
1371
- const Re = (e) => encodeURIComponent(e).replace(/-/g, "%2D");
1372
- function Ve({
1368
+ function kt(e) {
1369
+ return Ue("ProductVariant", e);
1370
+ }
1371
+ const Oe = (e) => encodeURIComponent(e).replace(/-/g, "%2D");
1372
+ function xe({
1373
1373
  type: e,
1374
1374
  selectedOptions: t
1375
1375
  }) {
1376
1376
  if (t.length === 0)
1377
1377
  return `${e}-`;
1378
- const n = t.map(({ name: o, value: r }) => `${Re(o)}:${Re(r)}`).join("-");
1378
+ const n = t.map(({ name: o, value: r }) => `${Oe(o)}:${Oe(r)}`).join("-");
1379
1379
  return `${e}-${n}`;
1380
1380
  }
1381
- function Ue(e) {
1381
+ function Be(e) {
1382
1382
  return e.product_id ?? e.id;
1383
1383
  }
1384
1384
  function he(e) {
1385
- return kt(Ue(e));
1385
+ return Ct(Be(e));
1386
1386
  }
1387
- function Pe(e, t = []) {
1387
+ function Te(e, t = []) {
1388
1388
  return Object.entries(e).filter(([n, o]) => o != null && !t.includes(n)).sort(([n], [o]) => n.localeCompare(o)).map(
1389
1389
  ([n, o]) => `${encodeURIComponent(n)}=${encodeURIComponent(typeof o == "object" ? JSON.stringify(o) : String(o))}`
1390
1390
  ).join("&");
1391
1391
  }
1392
1392
  function Dt(e, t = {}) {
1393
1393
  if (!e?.trim()) return;
1394
- const n = `/browse/${encodeURIComponent(e)}`, o = Pe(t, ["collectionHandle", "signal"]);
1394
+ const n = `/browse/${encodeURIComponent(e)}`, o = Te(t, ["collectionHandle", "signal"]);
1395
1395
  return o ? `${n}?${o}` : n;
1396
1396
  }
1397
1397
  function Nt(e, t = {}) {
1398
1398
  if (!e?.trim()) return;
1399
- const n = `/search/${encodeURIComponent(e)}`, o = Pe(t, ["query", "signal"]);
1399
+ const n = `/search/${encodeURIComponent(e)}`, o = Te(t, ["query", "signal"]);
1400
1400
  return o ? `${n}?${o}` : n;
1401
1401
  }
1402
1402
  function qt(e, t = {}) {
1403
1403
  if (!e?.trim()) return;
1404
- const n = `/blocks/${encodeURIComponent(e)}`, o = Pe(t, ["blockId", "signal"]);
1404
+ const n = `/blocks/${encodeURIComponent(e)}`, o = Te(t, ["blockId", "signal"]);
1405
1405
  return o ? `${n}?${o}` : n;
1406
1406
  }
1407
- var _e = /* @__PURE__ */ ((e) => (e.Equal = "eq", e.NotEqual = "not_eq", e.In = "in", e.NotIn = "not_in", e.GreaterThan = "gt", e.GreaterThanOrEqual = "gte", e.LessThan = "lt", e.LessThanOrEqual = "lte", e.Exists = "exists", e.NotExists = "not_exists", e))(_e || {}), xe = /* @__PURE__ */ ((e) => (e.And = "AND", e.Or = "OR", e))(xe || {});
1408
- function fn(e, t) {
1407
+ var _e = /* @__PURE__ */ ((e) => (e.Equal = "eq", e.NotEqual = "not_eq", e.In = "in", e.NotIn = "not_in", e.GreaterThan = "gt", e.GreaterThanOrEqual = "gte", e.LessThan = "lt", e.LessThanOrEqual = "lte", e.Exists = "exists", e.NotExists = "not_exists", e))(_e || {}), Ge = /* @__PURE__ */ ((e) => (e.And = "AND", e.Or = "OR", e))(Ge || {});
1408
+ function gn(e, t) {
1409
1409
  return { property: e, operator: "eq", values: [t] };
1410
1410
  }
1411
- function gn(e, t) {
1411
+ function mn(e, t) {
1412
1412
  return { property: e, operator: "not_eq", values: [t] };
1413
1413
  }
1414
- function mn(e, t) {
1414
+ function pn(e, t) {
1415
1415
  return { property: e, operator: "in", values: t };
1416
1416
  }
1417
- function pn(e, t) {
1417
+ function hn(e, t) {
1418
1418
  return { property: e, operator: "not_in", values: t };
1419
1419
  }
1420
- function hn(e, t) {
1420
+ function _n(e, t) {
1421
1421
  return { property: e, operator: "gt", values: [t] };
1422
1422
  }
1423
- function _n(e, t) {
1423
+ function vn(e, t) {
1424
1424
  return { property: e, operator: "gte", values: [t] };
1425
1425
  }
1426
- function vn(e, t) {
1426
+ function yn(e, t) {
1427
1427
  return { property: e, operator: "lt", values: [t] };
1428
1428
  }
1429
- function yn(e, t) {
1429
+ function In(e, t) {
1430
1430
  return { property: e, operator: "lte", values: [t] };
1431
1431
  }
1432
- function In(e) {
1432
+ function En(e) {
1433
1433
  return { property: e, operator: "exists", values: [] };
1434
1434
  }
1435
- function En(e) {
1435
+ function bn(e) {
1436
1436
  return { property: e, operator: "not_exists", values: [] };
1437
1437
  }
1438
1438
  function $t(...e) {
1439
1439
  return { conditional: "AND", expressions: e };
1440
1440
  }
1441
- function bn(...e) {
1441
+ function Fn(...e) {
1442
1442
  return { conditional: "OR", expressions: e };
1443
1443
  }
1444
1444
  function Lt(e) {
1445
1445
  return "conditional" in e;
1446
1446
  }
1447
- function Fn(e) {
1447
+ function Sn(e) {
1448
1448
  return Lt(e) ? e : $t(e);
1449
1449
  }
1450
1450
  function Vt({
1451
1451
  layers: e,
1452
- currencyCode: t = et,
1453
- formatPrice: n = rt,
1452
+ currencyCode: t = De,
1453
+ formatPrice: n = Ne,
1454
1454
  swatches: o = [],
1455
1455
  breakoutContext: r
1456
1456
  }) {
1457
- const s = Ue(e), i = he(e), a = e.title, l = e.handle ?? "", c = e.vendor ?? "", g = e.product_type ?? "", d = e.body_html ?? "", p = e.available ?? !1, u = e.is_gift_card ?? !1, f = e.tags ?? [], h = Ut(e), y = xt(e.price_range, t, n), E = Bt(e, o), M = jt(e, t, n), T = M.map((I) => I.compareAtPrice).filter((I) => I !== null), w = T.length > 0 ? {
1458
- min: T.reduce((I, k) => I.amount < k.amount ? I : k),
1459
- max: T.reduce((I, k) => I.amount > k.amount ? I : k)
1460
- } : void 0, b = e.first_or_matched_variant ? Gt(e.first_or_matched_variant) : [], m = Ve({ type: "Product", selectedOptions: b }), _ = e.metafields ?? {}, F = e.category ? {
1457
+ const a = Be(e), i = he(e), s = e.title, l = e.handle ?? "", c = e.vendor ?? "", g = e.product_type ?? "", d = e.body_html ?? "", p = e.available ?? !1, u = e.is_gift_card ?? !1, f = e.tags ?? [], h = Ut(e), y = xt(e.price_range, t, n), E = Bt(e, o), M = jt(e, t, n), A = M.map((I) => I.compareAtPrice).filter((I) => I !== null), R = A.length > 0 ? {
1458
+ min: A.reduce((I, C) => I.amount < C.amount ? I : C),
1459
+ max: A.reduce((I, C) => I.amount > C.amount ? I : C)
1460
+ } : void 0, b = e.first_or_matched_variant ? Gt(e.first_or_matched_variant) : [], m = xe({ type: "Product", selectedOptions: b }), _ = e.metafields ?? {}, F = e.category ? {
1461
1461
  id: e.category.id,
1462
1462
  name: e.category.name,
1463
1463
  fullName: e.category.full_name,
@@ -1469,21 +1469,21 @@ function Vt({
1469
1469
  alt: e.featured_media.alt ?? "",
1470
1470
  width: e.featured_media.width,
1471
1471
  height: e.featured_media.height
1472
- } : null, A = e.named_tags ? Array.isArray(e.named_tags) ? void 0 : Object.entries(e.named_tags).map(([I, k]) => ({ name: I, value: k })) : void 0, R = e.first_or_matched_variant ? M.find((I) => I.numericId === e.first_or_matched_variant.id) ?? null : null;
1473
- let O, P;
1472
+ } : null, P = e.named_tags ? Array.isArray(e.named_tags) ? void 0 : Object.entries(e.named_tags).map(([I, C]) => ({ name: I, value: C })) : void 0, O = e.first_or_matched_variant ? M.find((I) => I.numericId === e.first_or_matched_variant.id) ?? null : null;
1473
+ let w, T;
1474
1474
  if (r?.isVariantTile) {
1475
- P = r.variantId;
1476
- const I = M.find((k) => k.numericId === P);
1475
+ T = r.variantId;
1476
+ const I = M.find((C) => C.numericId === T);
1477
1477
  if (I) {
1478
- const k = new Set(r.optionCodes);
1479
- O = I.selectedOptions.filter((V) => k.has(V.name));
1478
+ const C = new Set(r.optionCodes);
1479
+ w = I.selectedOptions.filter((V) => C.has(V.name));
1480
1480
  }
1481
1481
  }
1482
1482
  return {
1483
1483
  id: m,
1484
1484
  gid: i,
1485
- numericId: s,
1486
- title: a,
1485
+ numericId: a,
1486
+ title: s,
1487
1487
  handle: l,
1488
1488
  type: g,
1489
1489
  vendor: c,
@@ -1491,7 +1491,7 @@ function Vt({
1491
1491
  availableForSale: p,
1492
1492
  images: h,
1493
1493
  priceRange: y,
1494
- compareAtPriceRange: w,
1494
+ compareAtPriceRange: R,
1495
1495
  options: E,
1496
1496
  tags: f,
1497
1497
  variants: M,
@@ -1504,14 +1504,14 @@ function Vt({
1504
1504
  publishedAt: e.published_at ?? null,
1505
1505
  updatedAt: e.updated_at ?? null,
1506
1506
  featuredMedia: S,
1507
- namedTags: A,
1507
+ namedTags: P,
1508
1508
  combinedListingParentProductId: e.combined_listing_parent_product_id ?? null,
1509
1509
  combinedListingRole: e.combined_listing_role ?? null,
1510
1510
  hasVariantsThatRequireComponents: e.has_variants_that_require_components ?? !1,
1511
1511
  originalOptions: e.original_options ?? {},
1512
- selectedVariant: R,
1513
- breakoutOptions: O,
1514
- breakoutVariantId: P
1512
+ selectedVariant: O,
1513
+ breakoutOptions: w,
1514
+ breakoutVariantId: T
1515
1515
  };
1516
1516
  }
1517
1517
  function Ut(e) {
@@ -1533,10 +1533,10 @@ function xt(e, t, n) {
1533
1533
  }
1534
1534
  function Bt(e, t) {
1535
1535
  const n = [], o = e.options ?? {};
1536
- for (const [r, s] of Object.entries(o))
1537
- for (const i of s) {
1538
- const a = t.find((l) => l.name === r && l.value === i);
1539
- n.push({ name: r, value: i, swatch: a });
1536
+ for (const [r, a] of Object.entries(o))
1537
+ for (const i of a) {
1538
+ const s = t.find((l) => l.name === r && l.value === i);
1539
+ n.push({ name: r, value: i, swatch: s });
1540
1540
  }
1541
1541
  return n;
1542
1542
  }
@@ -1549,8 +1549,8 @@ function jt(e, t, n) {
1549
1549
  function Ht(e, t, n) {
1550
1550
  const o = parseFloat(e.price), r = e.compare_at_price ? parseFloat(e.compare_at_price) : null;
1551
1551
  return {
1552
- id: Ve({ type: "ProductVariant", selectedOptions: e.selected_options }),
1553
- gid: Ct(e.id),
1552
+ id: xe({ type: "ProductVariant", selectedOptions: e.selected_options }),
1553
+ gid: kt(e.id),
1554
1554
  numericId: e.id,
1555
1555
  title: e.title,
1556
1556
  availableForSale: e.available,
@@ -1571,7 +1571,7 @@ function Ht(e, t, n) {
1571
1571
  position: 0,
1572
1572
  variantIds: [e.id]
1573
1573
  } : null,
1574
- selectedOptions: e.selected_options.map((s) => ({ name: s.name, value: s.value })),
1574
+ selectedOptions: e.selected_options.map((a) => ({ name: a.name, value: a.value })),
1575
1575
  metafields: Qt(e.metafields),
1576
1576
  inventoryLevels: e.inventory_levels ?? {},
1577
1577
  inventoryPolicy: e.inventory_policy ?? null,
@@ -1588,15 +1588,15 @@ function Qt(e) {
1588
1588
  type: t.value_type
1589
1589
  })) : [];
1590
1590
  }
1591
- function Be() {
1591
+ function je() {
1592
1592
  return typeof window < "u" && typeof window.document < "u";
1593
1593
  }
1594
- const Ge = "__COMMERCE_BLOCKS__";
1594
+ const He = "__COMMERCE_BLOCKS__";
1595
1595
  function Kt(e) {
1596
- Be() && (window[Ge] = e);
1596
+ je() && (window[He] = e);
1597
1597
  }
1598
1598
  function zt() {
1599
- if (!Be())
1599
+ if (!je())
1600
1600
  return v(
1601
1601
  U({
1602
1602
  code: "INVALID_CONFIG",
@@ -1605,7 +1605,7 @@ function zt() {
1605
1605
  expected: "browser"
1606
1606
  })
1607
1607
  );
1608
- const e = window[Ge];
1608
+ const e = window[He];
1609
1609
  return e ? D(e) : v(
1610
1610
  U({
1611
1611
  code: "MISSING_CONFIG",
@@ -1614,15 +1614,17 @@ function zt() {
1614
1614
  })
1615
1615
  );
1616
1616
  }
1617
- function Sn() {
1617
+ function Mn() {
1618
1618
  return zt().data !== void 0;
1619
1619
  }
1620
1620
  function re({
1621
1621
  products: e,
1622
1622
  raw: t,
1623
- extender: n
1623
+ extender: n,
1624
+ currencyCode: o = De,
1625
+ formatPrice: r = Ne
1624
1626
  }) {
1625
- const o = {
1627
+ const a = {
1626
1628
  products: e,
1627
1629
  totalResults: t.totalResults,
1628
1630
  totalPages: t.totalPages,
@@ -1630,34 +1632,43 @@ function re({
1630
1632
  resultsPerPage: t.resultsPerPage,
1631
1633
  facets: t.facets ?? {},
1632
1634
  facetRanges: t.facetRanges,
1635
+ priceRange: Xt(t.facetRanges, o, r),
1633
1636
  attributionToken: t.attributionToken,
1634
1637
  _workflow: t._workflow
1635
1638
  };
1636
- return n ? n(o, t) : o;
1639
+ return n ? n(a, t) : a;
1640
+ }
1641
+ function Xt(e, t, n) {
1642
+ const o = e?.["variants.price"];
1643
+ if (o)
1644
+ return {
1645
+ min: { amount: o.min, currencyCode: t, formatted: n(o.min, t) },
1646
+ max: { amount: o.max, currencyCode: t, formatted: n(o.max, t) }
1647
+ };
1637
1648
  }
1638
- function Xt({ ctx: e }) {
1639
- function t(a) {
1640
- return a.map((l) => he(l));
1649
+ function Wt({ ctx: e }) {
1650
+ function t(s) {
1651
+ return s.map((l) => he(l));
1641
1652
  }
1642
- function n(a, l) {
1643
- const c = Vt({ layers: a, ...e.mergeConfig, breakoutContext: l });
1653
+ function n(s, l) {
1654
+ const c = Vt({ layers: s, ...e.mergeConfig, breakoutContext: l });
1644
1655
  return e.config.extendProduct ? { ...e.config.extendProduct({
1645
1656
  base: c,
1646
- raw: a,
1657
+ raw: s,
1647
1658
  storefront: null
1648
1659
  }), _base: c } : c;
1649
1660
  }
1650
- function o(a, l) {
1651
- if (!(a.__typename !== "Variant" || l.length === 0))
1661
+ function o(s, l) {
1662
+ if (!(s.__typename !== "Variant" || l.length === 0))
1652
1663
  return {
1653
1664
  isVariantTile: !0,
1654
- variantId: a.variant_id,
1665
+ variantId: s.variant_id,
1655
1666
  optionCodes: l
1656
1667
  };
1657
1668
  }
1658
- function r(a, l, c) {
1669
+ function r(s, l, c) {
1659
1670
  const g = c?.variantBreakouts?.map((d) => d.optionCode) ?? [];
1660
- return a.map((d) => {
1671
+ return s.map((d) => {
1661
1672
  const p = he(d), u = o(d, g);
1662
1673
  if (!u) {
1663
1674
  const f = l.get(p);
@@ -1666,12 +1677,12 @@ function Xt({ ctx: e }) {
1666
1677
  return n(d, u);
1667
1678
  });
1668
1679
  }
1669
- function s(a) {
1670
- if (a) {
1680
+ function a(s) {
1681
+ if (s) {
1671
1682
  if (e.config.transformFilters)
1672
- return e.config.transformFilters(a);
1673
- if (e.config.filterMap && typeof a == "object" && !Array.isArray(a)) {
1674
- const l = a, c = [];
1683
+ return e.config.transformFilters(s);
1684
+ if (e.config.filterMap && typeof s == "object" && !Array.isArray(s)) {
1685
+ const l = s, c = [];
1675
1686
  for (const [g, d] of Object.entries(l)) {
1676
1687
  if (d == null) continue;
1677
1688
  const p = e.config.filterMap[g], u = typeof p == "string" ? p : p?.property ?? g, f = typeof p == "object" ? p.values : void 0, y = (Array.isArray(d) ? d : [d]).map((E) => {
@@ -1685,20 +1696,20 @@ function Xt({ ctx: e }) {
1685
1696
  });
1686
1697
  }
1687
1698
  return c.length === 0 ? void 0 : {
1688
- conditional: xe.And,
1699
+ conditional: Ge.And,
1689
1700
  expressions: c
1690
1701
  };
1691
1702
  }
1692
- return a;
1703
+ return s;
1693
1704
  }
1694
1705
  }
1695
- function i(a) {
1696
- return a.filter((l) => !l.breakoutVariantId);
1706
+ function i(s) {
1707
+ return s.filter((l) => !l.breakoutVariantId);
1697
1708
  }
1698
1709
  return {
1699
1710
  extractGids: t,
1700
1711
  buildProducts: r,
1701
- transformFilters: s,
1712
+ transformFilters: a,
1702
1713
  filterCacheableProducts: i
1703
1714
  };
1704
1715
  }
@@ -1713,20 +1724,20 @@ function K({
1713
1724
  }) {
1714
1725
  return !e && !t && !n ? (o) => o : (o) => {
1715
1726
  let r = o;
1716
- const s = t && Object.keys(t).length > 0;
1717
- if (e || s) {
1727
+ const a = t && Object.keys(t).length > 0;
1728
+ if (e || a) {
1718
1729
  const i = {};
1719
1730
  if (t)
1720
- for (const [a, l] of Object.entries(t)) {
1721
- const c = l(a);
1722
- c != null && (i[a] = c);
1731
+ for (const [s, l] of Object.entries(t)) {
1732
+ const c = l(s);
1733
+ c != null && (i[s] = c);
1723
1734
  }
1724
1735
  r = { ...r, ...e, ...i };
1725
1736
  }
1726
1737
  return n ? n(r) : r;
1727
1738
  };
1728
1739
  }
1729
- function Wt({
1740
+ function Jt({
1730
1741
  ctx: e,
1731
1742
  helpers: t
1732
1743
  }) {
@@ -1736,10 +1747,10 @@ function Wt({
1736
1747
  error: null,
1737
1748
  isFetching: !1
1738
1749
  });
1739
- let s = null, i = o ?? e.config.sorts[0]?.code;
1750
+ let a = null, i = o ?? e.config.sorts[0]?.code;
1740
1751
  return {
1741
1752
  state: r,
1742
- async execute(a = {}) {
1753
+ async execute(s = {}) {
1743
1754
  const {
1744
1755
  page: l = Y,
1745
1756
  limit: c = Z,
@@ -1751,11 +1762,11 @@ function Wt({
1751
1762
  params: h,
1752
1763
  paramDefinitions: y,
1753
1764
  transformBody: E
1754
- } = a, M = d ?? i;
1755
- i = M, s?.abort(), s = oe(p);
1756
- const T = r.value.data;
1757
- r.value = { data: T, error: null, isFetching: !0 };
1758
- const { data: w, error: b } = await e.layers.browse(
1765
+ } = s, M = d ?? i;
1766
+ i = M, a?.abort(), a = oe(p);
1767
+ const A = r.value.data;
1768
+ r.value = { data: A, error: null, isFetching: !0 };
1769
+ const { data: R, error: b } = await e.layers.browse(
1759
1770
  {
1760
1771
  collectionHandle: n,
1761
1772
  sort_order_code: M,
@@ -1764,32 +1775,34 @@ function Wt({
1764
1775
  dynamicLinking: f,
1765
1776
  transformBody: K({ params: h, paramDefinitions: y, transformBody: E })
1766
1777
  },
1767
- s.signal
1778
+ a.signal
1768
1779
  );
1769
1780
  if (b)
1770
- return r.value = { data: T, error: b, isFetching: !1 }, v(b);
1771
- const { results: m, _meta: _ } = w, F = t.extractGids(m), { cached: S } = e.store.products.getMany(F), A = new Map(S.map((I) => [I.gid, I])), R = t.buildProducts(m, A, _), O = re({
1772
- products: R,
1773
- raw: w,
1774
- extender: e.config.extendCollection
1781
+ return r.value = { data: A, error: b, isFetching: !1 }, v(b);
1782
+ const { results: m, _meta: _ } = R, F = t.extractGids(m), { cached: S } = e.store.products.getMany(F), P = new Map(S.map((I) => [I.gid, I])), O = t.buildProducts(m, P, _), w = re({
1783
+ products: O,
1784
+ raw: R,
1785
+ extender: e.config.extendCollection,
1786
+ currencyCode: e.mergeConfig.currencyCode,
1787
+ formatPrice: e.mergeConfig.formatPrice
1775
1788
  });
1776
- u && w._meta && (O._meta = w._meta);
1777
- const P = Dt(n, { sortOrderCode: M, page: l, limit: c, filters: g });
1778
- return P && e.store.queries.set(P, O), e.store.products.set(t.filterCacheableProducts(R)), e.store.collections.set(n, {
1779
- totalProducts: O.totalResults,
1780
- totalPages: O.totalPages,
1789
+ u && R._meta && (w._meta = R._meta);
1790
+ const T = Dt(n, { sortOrderCode: M, page: l, limit: c, filters: g });
1791
+ return T && e.store.queries.set(T, w), e.store.products.set(t.filterCacheableProducts(O)), e.store.collections.set(n, {
1792
+ totalProducts: w.totalResults,
1793
+ totalPages: w.totalPages,
1781
1794
  lastPageFetched: l,
1782
- facets: O.facets,
1795
+ facets: w.facets,
1783
1796
  lastFetched: Date.now()
1784
- }), r.value = { data: O, error: null, isFetching: !1 }, D(O);
1797
+ }), r.value = { data: w, error: null, isFetching: !1 }, D(w);
1785
1798
  },
1786
1799
  dispose() {
1787
- s?.abort();
1800
+ a?.abort();
1788
1801
  }
1789
1802
  };
1790
1803
  };
1791
1804
  }
1792
- function Jt({
1805
+ function Yt({
1793
1806
  ctx: e,
1794
1807
  helpers: t
1795
1808
  }) {
@@ -1802,17 +1815,17 @@ function Jt({
1802
1815
  let o = null, r;
1803
1816
  return {
1804
1817
  state: n,
1805
- async prepare(s) {
1818
+ async prepare(a) {
1806
1819
  const {
1807
1820
  query: i,
1808
- filters: a,
1821
+ filters: s,
1809
1822
  tuning: l,
1810
1823
  signal: c,
1811
1824
  dynamicLinking: g,
1812
1825
  params: d,
1813
1826
  paramDefinitions: p,
1814
1827
  transformBody: u
1815
- } = s, f = t.transformFilters(a), h = await e.layers.prepareSearch(
1828
+ } = a, f = t.transformFilters(s), h = await e.layers.prepareSearch(
1816
1829
  {
1817
1830
  query: i,
1818
1831
  filter_group: f,
@@ -1824,10 +1837,10 @@ function Jt({
1824
1837
  );
1825
1838
  return h.error ? v(h.error) : (r = h.data.search_id, D({ searchId: h.data.search_id }));
1826
1839
  },
1827
- async execute(s) {
1840
+ async execute(a) {
1828
1841
  const {
1829
1842
  query: i,
1830
- searchId: a,
1843
+ searchId: s,
1831
1844
  page: l = Y,
1832
1845
  limit: c = Z,
1833
1846
  filters: g,
@@ -1837,10 +1850,10 @@ function Jt({
1837
1850
  params: f,
1838
1851
  paramDefinitions: h,
1839
1852
  transformBody: y
1840
- } = s, E = t.transformFilters(g), M = K({ params: f, paramDefinitions: h, transformBody: y });
1853
+ } = a, E = t.transformFilters(g), M = K({ params: f, paramDefinitions: h, transformBody: y });
1841
1854
  o?.abort(), o = oe(p), n.value = { ...n.value, isFetching: !0, error: null };
1842
- let T = a ?? r;
1843
- if (r = void 0, !T) {
1855
+ let A = s ?? r;
1856
+ if (r = void 0, !A) {
1844
1857
  const I = await e.layers.prepareSearch(
1845
1858
  {
1846
1859
  query: i,
@@ -1853,13 +1866,13 @@ function Jt({
1853
1866
  );
1854
1867
  if (I.error)
1855
1868
  return n.value = { ...n.value, isFetching: !1, error: I.error }, v(I.error);
1856
- T = I.data.search_id;
1869
+ A = I.data.search_id;
1857
1870
  }
1858
- const w = We;
1871
+ const R = Ye;
1859
1872
  let b = await e.layers.search(
1860
1873
  {
1861
1874
  query: i,
1862
- search_id: T,
1875
+ search_id: A,
1863
1876
  pagination: { page: l, limit: c },
1864
1877
  filter_group: E,
1865
1878
  tuning: d,
@@ -1868,19 +1881,19 @@ function Jt({
1868
1881
  },
1869
1882
  o.signal
1870
1883
  );
1871
- for (let I = 0; I < w && b.error; I++) {
1872
- const k = b.error;
1873
- if (k._tag !== "ApiError" || k.status !== 425) break;
1874
- let V = Je;
1884
+ for (let I = 0; I < R && b.error; I++) {
1885
+ const C = b.error;
1886
+ if (C._tag !== "ApiError" || C.status !== 425) break;
1887
+ let V = Ze;
1875
1888
  try {
1876
- const X = JSON.parse(k.message);
1889
+ const X = JSON.parse(C.message);
1877
1890
  X.retry_after_ms && (V = X.retry_after_ms);
1878
1891
  } catch {
1879
1892
  }
1880
1893
  await new Promise((X) => setTimeout(X, V)), b = await e.layers.search(
1881
1894
  {
1882
1895
  query: i,
1883
- search_id: T,
1896
+ search_id: A,
1884
1897
  pagination: { page: l, limit: c },
1885
1898
  filter_group: E,
1886
1899
  tuning: d,
@@ -1892,14 +1905,16 @@ function Jt({
1892
1905
  }
1893
1906
  if (b.error)
1894
1907
  return n.value = { data: n.value.data, error: b.error, isFetching: !1 }, v(b.error);
1895
- const { results: m, _meta: _ } = b.data, F = t.extractGids(m), { cached: S } = e.store.products.getMany(F), A = new Map(S.map((I) => [I.gid, I])), R = t.buildProducts(m, A, _), O = re({
1896
- products: R,
1908
+ const { results: m, _meta: _ } = b.data, F = t.extractGids(m), { cached: S } = e.store.products.getMany(F), P = new Map(S.map((I) => [I.gid, I])), O = t.buildProducts(m, P, _), w = re({
1909
+ products: O,
1897
1910
  raw: b.data,
1898
- extender: e.config.extendSearch
1911
+ extender: e.config.extendSearch,
1912
+ currencyCode: e.mergeConfig.currencyCode,
1913
+ formatPrice: e.mergeConfig.formatPrice
1899
1914
  });
1900
- e.config.includeMeta && b.data._meta && (O._meta = b.data._meta), e.store.products.set(t.filterCacheableProducts(R));
1901
- const P = Nt(i, { page: l, limit: c, filters: g });
1902
- return P && e.store.queries.set(P, O), n.value = { data: O, error: null, isFetching: !1 }, D(O);
1915
+ e.config.includeMeta && b.data._meta && (w._meta = b.data._meta), e.store.products.set(t.filterCacheableProducts(O));
1916
+ const T = Nt(i, { page: l, limit: c, filters: g });
1917
+ return T && e.store.queries.set(T, w), n.value = { data: w, error: null, isFetching: !1 }, D(w);
1903
1918
  },
1904
1919
  dispose() {
1905
1920
  o?.abort();
@@ -1907,20 +1922,20 @@ function Jt({
1907
1922
  };
1908
1923
  };
1909
1924
  }
1910
- function Yt({
1925
+ function Zt({
1911
1926
  ctx: e,
1912
1927
  helpers: t
1913
1928
  }) {
1914
1929
  return ({ blockId: n, anchorId: o, anchorHandle: r }) => {
1915
- const s = L({
1930
+ const a = L({
1916
1931
  data: null,
1917
1932
  error: null,
1918
1933
  isFetching: !1
1919
1934
  });
1920
1935
  let i = null;
1921
1936
  return {
1922
- state: s,
1923
- async execute(a = {}) {
1937
+ state: a,
1938
+ async execute(s = {}) {
1924
1939
  const {
1925
1940
  page: l = Y,
1926
1941
  limit: c = Z,
@@ -1932,11 +1947,11 @@ function Yt({
1932
1947
  params: h,
1933
1948
  paramDefinitions: y,
1934
1949
  transformBody: E
1935
- } = a;
1950
+ } = s;
1936
1951
  i?.abort(), i = oe(d);
1937
- const M = s.value.data;
1938
- s.value = { data: M, error: null, isFetching: !0 };
1939
- const { data: T, error: w } = await e.layers.blocks(
1952
+ const M = a.value.data;
1953
+ a.value = { data: M, error: null, isFetching: !0 };
1954
+ const { data: A, error: R } = await e.layers.blocks(
1940
1955
  {
1941
1956
  blockId: n,
1942
1957
  anchor_id: o,
@@ -1950,16 +1965,18 @@ function Yt({
1950
1965
  },
1951
1966
  i.signal
1952
1967
  );
1953
- if (w)
1954
- return s.value = { data: M, error: w, isFetching: !1 }, v(w);
1955
- const { results: b, _meta: m } = T, _ = t.extractGids(b), { cached: F } = e.store.products.getMany(_), S = new Map(F.map((P) => [P.gid, P])), A = t.buildProducts(b, S, m), R = re({
1956
- products: A,
1957
- raw: T,
1958
- extender: e.config.extendBlock
1968
+ if (R)
1969
+ return a.value = { data: M, error: R, isFetching: !1 }, v(R);
1970
+ const { results: b, _meta: m } = A, _ = t.extractGids(b), { cached: F } = e.store.products.getMany(_), S = new Map(F.map((T) => [T.gid, T])), P = t.buildProducts(b, S, m), O = re({
1971
+ products: P,
1972
+ raw: A,
1973
+ extender: e.config.extendBlock,
1974
+ currencyCode: e.mergeConfig.currencyCode,
1975
+ formatPrice: e.mergeConfig.formatPrice
1959
1976
  });
1960
- e.config.includeMeta && T._meta && (R._meta = T._meta), T.block && (R.block = T.block);
1961
- const O = qt(n, { anchorId: o, anchorHandle: r, page: l, limit: c, filters: g });
1962
- return O && e.store.queries.set(O, R), e.store.products.set(t.filterCacheableProducts(A)), s.value = { data: R, error: null, isFetching: !1 }, D(R);
1977
+ e.config.includeMeta && A._meta && (O._meta = A._meta), A.block && (O.block = A.block);
1978
+ const w = qt(n, { anchorId: o, anchorHandle: r, page: l, limit: c, filters: g });
1979
+ return w && e.store.queries.set(w, O), e.store.products.set(t.filterCacheableProducts(P)), a.value = { data: O, error: null, isFetching: !1 }, D(O);
1963
1980
  },
1964
1981
  dispose() {
1965
1982
  i?.abort();
@@ -1967,7 +1984,7 @@ function Yt({
1967
1984
  };
1968
1985
  };
1969
1986
  }
1970
- function Zt(e, t) {
1987
+ function en(e, t) {
1971
1988
  let n = null;
1972
1989
  return {
1973
1990
  call(...o) {
@@ -1980,41 +1997,41 @@ function Zt(e, t) {
1980
1997
  }
1981
1998
  };
1982
1999
  }
1983
- function en({
2000
+ function tn({
1984
2001
  ctx: e
1985
2002
  }) {
1986
2003
  return (t = {}) => {
1987
- const { debounceMs: n = Ye, signal: o } = t, r = L({
2004
+ const { debounceMs: n = et, signal: o } = t, r = L({
1988
2005
  data: null,
1989
2006
  error: null,
1990
2007
  isFetching: !1
1991
2008
  });
1992
- let s = null, i = 0;
1993
- const a = /* @__PURE__ */ new Map();
2009
+ let a = null, i = 0;
2010
+ const s = /* @__PURE__ */ new Map();
1994
2011
  function l() {
1995
- c.cancel(), s?.abort(), a.clear();
2012
+ c.cancel(), a?.abort(), s.clear();
1996
2013
  }
1997
2014
  o?.addEventListener("abort", l, { once: !0 });
1998
- const c = Zt(async (g) => {
2015
+ const c = en(async (g) => {
1999
2016
  if (!g.trim()) {
2000
2017
  r.value = { data: null, error: null, isFetching: !1 };
2001
2018
  return;
2002
2019
  }
2003
- const d = g.trim().toLowerCase(), p = a.get(d);
2020
+ const d = g.trim().toLowerCase(), p = s.get(d);
2004
2021
  if (p) {
2005
2022
  r.value = { data: p, error: null, isFetching: !1 };
2006
2023
  return;
2007
2024
  }
2008
- s?.abort(), s = oe(o);
2025
+ a?.abort(), a = oe(o);
2009
2026
  const u = ++i;
2010
2027
  r.value = { ...r.value, isFetching: !0 };
2011
- const f = await e.layers.predictiveSearch(g.trim(), s.signal);
2012
- u === i && (f.error ? f.error._tag !== "NetworkError" || f.error.code !== "ABORTED" ? r.value = { data: null, error: f.error, isFetching: !1 } : r.value = { ...r.value, isFetching: !1 } : (a.set(d, f.data), a.size > Ze && a.delete(a.keys().next().value), r.value = { data: f.data, error: null, isFetching: !1 }));
2028
+ const f = await e.layers.predictiveSearch(g.trim(), a.signal);
2029
+ u === i && (f.error ? f.error._tag !== "NetworkError" || f.error.code !== "ABORTED" ? r.value = { data: null, error: f.error, isFetching: !1 } : r.value = { ...r.value, isFetching: !1 } : (s.set(d, f.data), s.size > tt && s.delete(s.keys().next().value), r.value = { data: f.data, error: null, isFetching: !1 }));
2013
2030
  }, n);
2014
2031
  return { state: r, execute: (g) => c.call(g), dispose: l };
2015
2032
  };
2016
2033
  }
2017
- function tn({
2034
+ function nn({
2018
2035
  ctx: e
2019
2036
  }) {
2020
2037
  return (t) => {
@@ -2022,17 +2039,17 @@ function tn({
2022
2039
  ids: n,
2023
2040
  meta: o,
2024
2041
  collectionMetafields: r = e.config.collectionMetafields,
2025
- pageMetafields: s = e.config.pageMetafields,
2042
+ pageMetafields: a = e.config.pageMetafields,
2026
2043
  signal: i
2027
- } = t, a = L({
2044
+ } = t, s = L({
2028
2045
  data: null,
2029
2046
  error: null,
2030
2047
  isFetching: !1
2031
2048
  });
2032
2049
  if (n.length === 0)
2033
- return a.value = { data: { products: [] }, error: null, isFetching: !1 }, a;
2050
+ return s.value = { data: { products: [] }, error: null, isFetching: !1 }, s;
2034
2051
  const l = n, { cached: c } = e.store.products.getMany(l), g = new Map(c.map((p) => [p.gid, p])), d = l.map((p) => g.get(p)).filter((p) => p != null);
2035
- return !o || !e.storefrontEnabled ? (a.value = { data: { products: d }, error: null, isFetching: !1 }, a) : (a.value = { data: null, error: null, isFetching: !0 }, (async () => {
2052
+ return !o || !e.storefrontEnabled ? (s.value = { data: { products: d }, error: null, isFetching: !1 }, s) : (s.value = { data: null, error: null, isFetching: !0 }, (async () => {
2036
2053
  let p, u;
2037
2054
  if (o.collection) {
2038
2055
  const h = await e.storefront.getCollection({
@@ -2042,7 +2059,7 @@ function tn({
2042
2059
  signal: i
2043
2060
  });
2044
2061
  if (h.error) {
2045
- a.value = { data: null, error: h.error, isFetching: !1 };
2062
+ s.value = { data: null, error: h.error, isFetching: !1 };
2046
2063
  return;
2047
2064
  }
2048
2065
  p = h.data;
@@ -2050,21 +2067,21 @@ function tn({
2050
2067
  if (o.page) {
2051
2068
  const h = await e.storefront.getPage({
2052
2069
  handle: o.page,
2053
- pageMetafields: s,
2070
+ pageMetafields: a,
2054
2071
  signal: i
2055
2072
  });
2056
2073
  if (h.error) {
2057
- a.value = { data: null, error: h.error, isFetching: !1 };
2074
+ s.value = { data: null, error: h.error, isFetching: !1 };
2058
2075
  return;
2059
2076
  }
2060
2077
  u = h.data;
2061
2078
  }
2062
2079
  const f = { products: d };
2063
- p && (f.collection = p), u && (f.page = u), a.value = { data: f, error: null, isFetching: !1 };
2064
- })(), a);
2080
+ p && (f.collection = p), u && (f.page = u), s.value = { data: f, error: null, isFetching: !1 };
2081
+ })(), s);
2065
2082
  };
2066
2083
  }
2067
- function nn({ ctx: e }) {
2084
+ function rn({ ctx: e }) {
2068
2085
  return ({
2069
2086
  image: t,
2070
2087
  signal: n
@@ -2084,7 +2101,7 @@ function nn({ ctx: e }) {
2084
2101
  })(), o;
2085
2102
  };
2086
2103
  }
2087
- function rn({
2104
+ function on({
2088
2105
  ctx: e,
2089
2106
  helpers: t
2090
2107
  }) {
@@ -2092,9 +2109,9 @@ function rn({
2092
2109
  const {
2093
2110
  imageId: o,
2094
2111
  page: r = Y,
2095
- limit: s = Z,
2112
+ limit: a = Z,
2096
2113
  filters: i,
2097
- tuning: a,
2114
+ tuning: s,
2098
2115
  signal: l,
2099
2116
  dynamicLinking: c,
2100
2117
  params: g,
@@ -2109,9 +2126,9 @@ function rn({
2109
2126
  const f = await e.layers.imageSearch(
2110
2127
  {
2111
2128
  image_id: o,
2112
- pagination: { page: r, limit: s },
2129
+ pagination: { page: r, limit: a },
2113
2130
  filter_group: t.transformFilters(i),
2114
- tuning: a,
2131
+ tuning: s,
2115
2132
  dynamicLinking: c,
2116
2133
  transformBody: K({ params: g, paramDefinitions: d, transformBody: p })
2117
2134
  },
@@ -2121,16 +2138,18 @@ function rn({
2121
2138
  u.value = { data: null, error: f.error, isFetching: !1 };
2122
2139
  return;
2123
2140
  }
2124
- const { results: h, _meta: y } = f.data, E = t.extractGids(h), { cached: M } = e.store.products.getMany(E), T = new Map(M.map((m) => [m.gid, m])), w = t.buildProducts(h, T, y), b = re({
2125
- products: w,
2141
+ const { results: h, _meta: y } = f.data, E = t.extractGids(h), { cached: M } = e.store.products.getMany(E), A = new Map(M.map((m) => [m.gid, m])), R = t.buildProducts(h, A, y), b = re({
2142
+ products: R,
2126
2143
  raw: f.data,
2127
- extender: e.config.extendSearch
2144
+ extender: e.config.extendSearch,
2145
+ currencyCode: e.mergeConfig.currencyCode,
2146
+ formatPrice: e.mergeConfig.formatPrice
2128
2147
  });
2129
- e.store.products.set(t.filterCacheableProducts(w)), u.value = { data: b, error: null, isFetching: !1 };
2148
+ e.store.products.set(t.filterCacheableProducts(R)), u.value = { data: b, error: null, isFetching: !1 };
2130
2149
  })(), u;
2131
2150
  };
2132
2151
  }
2133
- function Mn(e) {
2152
+ function Pn(e) {
2134
2153
  const t = pt({
2135
2154
  layersPublicToken: e.layersPublicToken,
2136
2155
  layersBaseUrl: e.layersBaseUrl,
@@ -2161,42 +2180,42 @@ function Mn(e) {
2161
2180
  if (c.error) return v(c.error);
2162
2181
  o = c.data, r = !0;
2163
2182
  }
2164
- const s = Rt({
2183
+ const a = Ot({
2165
2184
  maxProducts: e.cacheMaxProducts,
2166
2185
  maxQueries: e.cacheMaxEntries,
2167
2186
  ttl: e.cacheTtl,
2168
2187
  storageAdapter: e.storageAdapter
2169
2188
  });
2170
- if (e.restoreFromStorage !== !1 && s.restore(), e.initialData) {
2189
+ if (e.restoreFromStorage !== !1 && a.restore(), e.initialData) {
2171
2190
  const { products: c, queries: g, collections: d } = e.initialData;
2172
- if (c?.length && s.products.set(c), g)
2191
+ if (c?.length && a.products.set(c), g)
2173
2192
  for (const [p, u] of Object.entries(g))
2174
- s.queries.set(p, u);
2193
+ a.queries.set(p, u);
2175
2194
  if (d)
2176
2195
  for (const [p, u] of Object.entries(d))
2177
- s.collections.set(p, u);
2196
+ a.collections.set(p, u);
2178
2197
  }
2179
2198
  const i = {
2180
2199
  config: e,
2181
2200
  layers: n,
2182
2201
  storefront: o,
2183
2202
  storefrontEnabled: r,
2184
- store: s,
2203
+ store: a,
2185
2204
  mergeConfig: {
2186
2205
  currencyCode: e.currencyCode,
2187
2206
  formatPrice: e.formatPrice,
2188
2207
  swatches: e.swatches
2189
2208
  }
2190
- }, a = Xt({ ctx: i }), l = {
2209
+ }, s = Wt({ ctx: i }), l = {
2191
2210
  config: e,
2192
- store: s,
2193
- collection: Wt({ ctx: i, helpers: a }),
2194
- search: Jt({ ctx: i, helpers: a }),
2195
- blocks: Yt({ ctx: i, helpers: a }),
2196
- autocomplete: en({ ctx: i }),
2197
- storefront: tn({ ctx: i }),
2198
- uploadImage: nn({ ctx: i }),
2199
- imageSearch: rn({ ctx: i, helpers: a })
2211
+ store: a,
2212
+ collection: Jt({ ctx: i, helpers: s }),
2213
+ search: Yt({ ctx: i, helpers: s }),
2214
+ blocks: Zt({ ctx: i, helpers: s }),
2215
+ autocomplete: tn({ ctx: i }),
2216
+ storefront: nn({ ctx: i }),
2217
+ uploadImage: rn({ ctx: i }),
2218
+ imageSearch: on({ ctx: i, helpers: s })
2200
2219
  };
2201
2220
  return Kt(l), D(l);
2202
2221
  }
@@ -2205,19 +2224,19 @@ function An({
2205
2224
  selectedOptions: t = [],
2206
2225
  breakoutOptions: n
2207
2226
  }) {
2208
- const o = "_base" in e ? e._base : e, r = n ?? o.breakoutOptions ?? [], s = L(t), i = L(r), a = N(() => on(o.variants, i.value)), l = N(() => new Set(i.value.map((m) => m.name))), c = N(() => {
2209
- const m = s.value.filter((_) => !l.value.has(_.name));
2227
+ const o = "_base" in e ? e._base : e, r = n ?? o.breakoutOptions ?? [], a = L(t), i = L(r), s = N(() => an(o.variants, i.value)), l = N(() => new Set(i.value.map((m) => m.name))), c = N(() => {
2228
+ const m = a.value.filter((_) => !l.value.has(_.name));
2210
2229
  return [...i.value, ...m];
2211
2230
  }), g = N(
2212
- () => W(a.value, c.value)
2231
+ () => W(s.value, c.value)
2213
2232
  ), d = N(
2214
- () => an(a.value, o.options, l.value)
2233
+ () => sn(s.value, o.options, l.value)
2215
2234
  ), p = N(() => [...new Set(d.value.map((m) => m.name))]), u = N(() => d.value.find((_) => _.swatch)?.name ?? null), f = N(() => {
2216
2235
  const m = u.value;
2217
2236
  if (!m) return /* @__PURE__ */ new Map();
2218
2237
  const _ = /* @__PURE__ */ new Map();
2219
- for (const F of a.value) {
2220
- const S = F.selectedOptions.find((A) => A.name === m);
2238
+ for (const F of s.value) {
2239
+ const S = F.selectedOptions.find((P) => P.name === m);
2221
2240
  S && _.set(F.numericId, S.value);
2222
2241
  }
2223
2242
  return _;
@@ -2227,47 +2246,47 @@ function An({
2227
2246
  }), y = N(() => {
2228
2247
  const m = u.value, _ = h.value, F = f.value;
2229
2248
  if (!m || _.length === 0)
2230
- return [...o.images].sort((P, I) => P.position - I.position);
2231
- const S = g.value ? F.get(g.value.numericId) : null, A = /* @__PURE__ */ new Map(), R = [];
2232
- for (const P of o.images) {
2233
- if (P.variantIds.length === 0) {
2234
- R.push(P);
2249
+ return [...o.images].sort((T, I) => T.position - I.position);
2250
+ const S = g.value ? F.get(g.value.numericId) : null, P = /* @__PURE__ */ new Map(), O = [];
2251
+ for (const T of o.images) {
2252
+ if (T.variantIds.length === 0) {
2253
+ O.push(T);
2235
2254
  continue;
2236
2255
  }
2237
2256
  let I = null;
2238
- for (const k of P.variantIds) {
2239
- const V = F.get(k);
2257
+ for (const C of T.variantIds) {
2258
+ const V = F.get(C);
2240
2259
  if (V) {
2241
2260
  I = V;
2242
2261
  break;
2243
2262
  }
2244
2263
  }
2245
2264
  if (I) {
2246
- const k = A.get(I) ?? [];
2247
- k.push(P), A.set(I, k);
2265
+ const C = P.get(I) ?? [];
2266
+ C.push(T), P.set(I, C);
2248
2267
  } else
2249
- R.push(P);
2268
+ O.push(T);
2250
2269
  }
2251
- for (const P of A.values())
2252
- P.sort((I, k) => I.position - k.position);
2253
- R.sort((P, I) => P.position - I.position);
2254
- const O = [];
2255
- S && A.has(S) && O.push(...A.get(S));
2256
- for (const P of _)
2257
- P !== S && A.has(P) && O.push(...A.get(P));
2258
- return O.push(...R), O;
2270
+ for (const T of P.values())
2271
+ T.sort((I, C) => I.position - C.position);
2272
+ O.sort((T, I) => T.position - I.position);
2273
+ const w = [];
2274
+ S && P.has(S) && w.push(...P.get(S));
2275
+ for (const T of _)
2276
+ T !== S && P.has(T) && w.push(...P.get(T));
2277
+ return w.push(...O), w;
2259
2278
  }), E = N(() => {
2260
2279
  const m = g.value;
2261
2280
  if (!m?.image) return y.value;
2262
2281
  if (!u.value) return m.image ? [m.image] : y.value;
2263
2282
  const F = f.value.get(m.numericId);
2264
2283
  return F ? y.value.filter((S) => S.variantIds.length === 0 ? !1 : S.variantIds.some(
2265
- (A) => f.value.get(A) === F
2284
+ (P) => f.value.get(P) === F
2266
2285
  )) : m.image ? [m.image] : y.value;
2267
- }), M = N(() => y.value), T = N(() => {
2286
+ }), M = N(() => y.value), A = N(() => {
2268
2287
  const m = new Set(c.value.map((_) => _.name));
2269
2288
  return p.value.every((_) => m.has(_));
2270
- }), w = N(() => {
2289
+ }), R = N(() => {
2271
2290
  const m = g.value;
2272
2291
  if (!m?.image) return 0;
2273
2292
  const _ = E.value.findIndex((F) => F.url === m.image?.url);
@@ -2281,7 +2300,7 @@ function An({
2281
2300
  return {
2282
2301
  product: e,
2283
2302
  // Reactive state
2284
- variants: a,
2303
+ variants: s,
2285
2304
  selectedVariant: g,
2286
2305
  selectedOptions: c,
2287
2306
  options: d,
@@ -2289,48 +2308,48 @@ function An({
2289
2308
  swatchOptionName: u,
2290
2309
  images: E,
2291
2310
  allImages: M,
2292
- carouselIndex: w,
2293
- isSelectionComplete: T,
2311
+ carouselIndex: R,
2312
+ isSelectionComplete: A,
2294
2313
  // Actions
2295
2314
  selectOption(m, _) {
2296
- const S = s.value.filter((A) => A.name !== m).concat({ name: m, value: _ });
2297
- s.value = S;
2315
+ const S = a.value.filter((P) => P.name !== m).concat({ name: m, value: _ });
2316
+ a.value = S;
2298
2317
  },
2299
2318
  setSelectedOptions(m) {
2300
- const _ = new Set(m.map((S) => S.name)), F = s.value.filter((S) => !_.has(S.name));
2301
- s.value = [...F, ...m];
2319
+ const _ = new Set(m.map((S) => S.name)), F = a.value.filter((S) => !_.has(S.name));
2320
+ a.value = [...F, ...m];
2302
2321
  },
2303
2322
  setBreakoutOptions(m) {
2304
2323
  i.value = m;
2305
2324
  },
2306
2325
  // Queries
2307
2326
  getOptionValues(m) {
2308
- return sn(a.value, m);
2327
+ return cn(s.value, m);
2309
2328
  },
2310
2329
  getSwatches(m) {
2311
2330
  return d.value.filter((_) => _.name === m && _.swatch).map((_) => _.swatch);
2312
2331
  },
2313
2332
  getVariantByOptions(m) {
2314
2333
  const _ = [...i.value, ...m];
2315
- return W(a.value, _);
2334
+ return W(s.value, _);
2316
2335
  },
2317
2336
  getCarouselIndexForVariant: b,
2318
2337
  isOptionAvailable(m, _) {
2319
- const F = s.value.filter((R) => R.name !== m).concat({ name: m, value: _ }), S = [...i.value, ...F];
2320
- return W(a.value, S)?.availableForSale ?? !1;
2338
+ const F = a.value.filter((O) => O.name !== m).concat({ name: m, value: _ }), S = [...i.value, ...F];
2339
+ return W(s.value, S)?.availableForSale ?? !1;
2321
2340
  },
2322
2341
  isVariantAvailable(m) {
2323
2342
  return m.availableForSale;
2324
2343
  },
2325
2344
  getOptionAvailabilityStatus(m, _) {
2326
- const F = s.value.filter((R) => R.name !== m).concat({ name: m, value: _ }), S = [...i.value, ...F], A = W(a.value, S);
2327
- return A ? A.availableForSale ? "available" : A.inventoryPolicy === "CONTINUE" ? "backorderable" : "sold-out" : "unavailable";
2345
+ const F = a.value.filter((O) => O.name !== m).concat({ name: m, value: _ }), S = [...i.value, ...F], P = W(s.value, S);
2346
+ return P ? P.availableForSale ? "available" : P.inventoryPolicy === "CONTINUE" ? "backorderable" : "sold-out" : "unavailable";
2328
2347
  },
2329
2348
  dispose() {
2330
2349
  }
2331
2350
  };
2332
2351
  }
2333
- function on(e, t) {
2352
+ function an(e, t) {
2334
2353
  return t.length === 0 ? e : e.filter(
2335
2354
  (n) => t.every(
2336
2355
  (o) => n.selectedOptions.some((r) => r.name === o.name && r.value === o.value)
@@ -2344,19 +2363,19 @@ function W(e, t) {
2344
2363
  )
2345
2364
  ) ?? null;
2346
2365
  }
2347
- function an(e, t, n) {
2366
+ function sn(e, t, n) {
2348
2367
  const o = /* @__PURE__ */ new Set();
2349
2368
  for (const r of e)
2350
- for (const s of r.selectedOptions)
2351
- n.has(s.name) || o.add(`${s.name}:${s.value}`);
2369
+ for (const a of r.selectedOptions)
2370
+ n.has(a.name) || o.add(`${a.name}:${a.value}`);
2352
2371
  return t.filter(
2353
2372
  (r) => !n.has(r.name) && o.has(`${r.name}:${r.value}`)
2354
2373
  );
2355
2374
  }
2356
- function sn(e, t) {
2375
+ function cn(e, t) {
2357
2376
  const n = /* @__PURE__ */ new Set();
2358
2377
  for (const o of e) {
2359
- const r = o.selectedOptions.find((s) => s.name === t);
2378
+ const r = o.selectedOptions.find((a) => a.name === t);
2360
2379
  r && n.add(r.value);
2361
2380
  }
2362
2381
  return [...n];
@@ -2366,25 +2385,25 @@ export {
2366
2385
  wn as batch,
2367
2386
  On as computed,
2368
2387
  An as createProductCard,
2369
- Mn as createSdk,
2370
- Rn as effect,
2371
- fn as eq,
2372
- In as exists,
2373
- Fn as filter,
2388
+ Pn as createSdk,
2389
+ Cn as effect,
2390
+ gn as eq,
2391
+ En as exists,
2392
+ Sn as filter,
2374
2393
  zt as getSdk,
2375
- hn as gt,
2376
- _n as gte,
2377
- mn as inValues,
2378
- Sn as isInitialized,
2379
- un as isRetryable,
2380
- ln as isSdkError,
2381
- dn as jsonFileAdapter,
2382
- At as localStorageAdapter,
2383
- vn as lt,
2384
- yn as lte,
2385
- gn as notEq,
2386
- En as notExists,
2387
- pn as notIn,
2388
- bn as or,
2394
+ _n as gt,
2395
+ vn as gte,
2396
+ pn as inValues,
2397
+ Mn as isInitialized,
2398
+ dn as isRetryable,
2399
+ un as isSdkError,
2400
+ fn as jsonFileAdapter,
2401
+ Pt as localStorageAdapter,
2402
+ yn as lt,
2403
+ In as lte,
2404
+ mn as notEq,
2405
+ bn as notExists,
2406
+ hn as notIn,
2407
+ Fn as or,
2389
2408
  kn as signal
2390
2409
  };