@builder.io/sdk-react-nextjs 0.7.2 → 0.7.4

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 (42) hide show
  1. package/lib/browser/USE_CLIENT_BUNDLE-6b3887b7.js +711 -0
  2. package/lib/browser/USE_CLIENT_BUNDLE-f95a196a.cjs +23 -0
  3. package/lib/{edge/USE_SERVER_BUNDLE-e0effb0f.js → browser/USE_SERVER_BUNDLE-b314d0f7.js} +1 -1
  4. package/lib/{edge/USE_SERVER_BUNDLE-ea7c665e.cjs → browser/USE_SERVER_BUNDLE-eed7792a.cjs} +1 -1
  5. package/lib/browser/{bundle-fc27d227.cjs → bundle-df55c296.cjs} +111 -19
  6. package/lib/browser/{bundle-6f6b7d63.js → bundle-fc3e7377.js} +528 -514
  7. package/lib/browser/index.cjs +1 -1
  8. package/lib/browser/index.mjs +3 -3
  9. package/lib/edge/USE_CLIENT_BUNDLE-44225d7a.cjs +23 -0
  10. package/lib/edge/USE_CLIENT_BUNDLE-a32e462e.js +711 -0
  11. package/lib/{node/USE_SERVER_BUNDLE-787d0ec8.js → edge/USE_SERVER_BUNDLE-2c9d1a5d.js} +1 -1
  12. package/lib/{node/USE_SERVER_BUNDLE-842e66c9.cjs → edge/USE_SERVER_BUNDLE-e5ab43ec.cjs} +1 -1
  13. package/lib/edge/bundle-38f08fa1.cjs +188 -0
  14. package/lib/edge/{bundle-213a8bf7.js → bundle-bef73246.js} +1516 -1502
  15. package/lib/edge/index.cjs +1 -1
  16. package/lib/edge/index.mjs +3 -3
  17. package/lib/node/USE_CLIENT_BUNDLE-539be307.cjs +23 -0
  18. package/lib/node/USE_CLIENT_BUNDLE-a5c6399c.js +711 -0
  19. package/lib/{browser/USE_SERVER_BUNDLE-ea1618f4.js → node/USE_SERVER_BUNDLE-21bf3ffc.js} +1 -1
  20. package/lib/{browser/USE_SERVER_BUNDLE-4341bf5c.cjs → node/USE_SERVER_BUNDLE-7f4ba7e9.cjs} +1 -1
  21. package/lib/node/{bundle-fb3490a6.js → bundle-74479d5d.js} +297 -283
  22. package/lib/node/{bundle-df78531d.cjs → bundle-f7863fb3.cjs} +110 -18
  23. package/lib/node/index.cjs +1 -1
  24. package/lib/node/index.mjs +3 -3
  25. package/package.json +8 -1
  26. package/types/cjs/blocks/video/video.d.ts +4 -0
  27. package/types/cjs/components/content/content.types.d.ts +0 -4
  28. package/types/cjs/components/content-variants/helpers.d.ts +3 -3
  29. package/types/cjs/components/content-variants/inlined-fns.d.ts +14 -0
  30. package/types/cjs/constants/sdk-version.d.ts +1 -1
  31. package/types/esm/blocks/video/video.d.ts +4 -0
  32. package/types/esm/components/content/content.types.d.ts +0 -4
  33. package/types/esm/components/content-variants/helpers.d.ts +3 -3
  34. package/types/esm/components/content-variants/inlined-fns.d.ts +14 -0
  35. package/types/esm/constants/sdk-version.d.ts +1 -1
  36. package/lib/browser/USE_CLIENT_BUNDLE-0e3e24e7.js +0 -657
  37. package/lib/browser/USE_CLIENT_BUNDLE-727780ee.cjs +0 -23
  38. package/lib/edge/USE_CLIENT_BUNDLE-372b4c60.js +0 -657
  39. package/lib/edge/USE_CLIENT_BUNDLE-f1bfb292.cjs +0 -23
  40. package/lib/edge/bundle-0fb39c43.cjs +0 -96
  41. package/lib/node/USE_CLIENT_BUNDLE-bdbc178a.cjs +0 -23
  42. package/lib/node/USE_CLIENT_BUNDLE-c6d9e08c.js +0 -657
@@ -1,7 +1,7 @@
1
1
  import { LRUCache } from "lru-cache";
2
2
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
3
3
  import { createElement } from "react";
4
- import { I as InteractiveElement, B as BlockWrapper, a as BlocksWrapper, b as Button, C as CustomCode, E as Embed, F as FragmentComponent, c as Image, d as ImgComponent, S as SectionComponent, V as Video, e as EnableEditor } from "./USE_CLIENT_BUNDLE-c6d9e08c.js";
4
+ import { I as InteractiveElement, B as BlockWrapper, a as BlocksWrapper, b as Button, C as CustomCode, E as Embed, F as FragmentComponent, c as Image, d as ImgComponent, S as SectionComponent, V as Video, e as EnableEditor } from "./USE_CLIENT_BUNDLE-a5c6399c.js";
5
5
  import "next/navigation";
6
6
  function getBlockComponentOptions(e) {
7
7
  var t;
@@ -86,15 +86,15 @@ const getLocation = () => {
86
86
  builder: t,
87
87
  context: n,
88
88
  event: o,
89
- localState: r,
90
- rootSetState: i,
89
+ localState: i,
90
+ rootSetState: r,
91
91
  rootState: a
92
92
  }) => {
93
93
  const s = getFunctionArguments({
94
94
  builder: t,
95
95
  context: n,
96
96
  event: o,
97
- state: flattenState(a, r, i)
97
+ state: flattenState(a, i, r)
98
98
  });
99
99
  return new Function(...s.map(([c]) => c), e)(...s.map(([, c]) => c));
100
100
  };
@@ -102,11 +102,11 @@ function flattenState(e, t, n) {
102
102
  if (e === t)
103
103
  throw new Error("rootState === localState");
104
104
  return new Proxy(e, {
105
- get: (o, r) => t && r in t ? t[r] : e[r],
106
- set: (o, r, i) => {
107
- if (t && r in t)
105
+ get: (o, i) => t && i in t ? t[i] : e[i],
106
+ set: (o, i, r) => {
107
+ if (t && i in t)
108
108
  throw new Error("Writing to local state is not allowed as it is read-only.");
109
- return e[r] = i, n == null || n(e), !0;
109
+ return e[i] = r, n == null || n(e), !0;
110
110
  }
111
111
  });
112
112
  }
@@ -114,7 +114,7 @@ const fastClone = (e) => JSON.parse(JSON.stringify(e)), set = (e, t, n) => {
114
114
  if (Object(e) !== e)
115
115
  return e;
116
116
  const o = Array.isArray(t) ? t : t.toString().match(/[^.[\]]+/g);
117
- return o.slice(0, -1).reduce((r, i, a) => Object(r[i]) === r[i] ? r[i] : r[i] = Math.abs(Number(o[a + 1])) >> 0 === +o[a + 1] ? [] : {}, e)[o[o.length - 1]] = n, e;
117
+ return o.slice(0, -1).reduce((i, r, a) => Object(i[r]) === i[r] ? i[r] : i[r] = Math.abs(Number(o[a + 1])) >> 0 === +o[a + 1] ? [] : {}, e)[o[o.length - 1]] = n, e;
118
118
  }, noop = () => null;
119
119
  let safeDynamicRequire = noop;
120
120
  try {
@@ -174,13 +174,13 @@ output;
174
174
  builder: t,
175
175
  context: n,
176
176
  event: o,
177
- localState: r,
178
- rootSetState: i,
177
+ localState: i,
178
+ rootSetState: r,
179
179
  rootState: a
180
180
  }) => {
181
181
  const s = fastClone({
182
182
  ...a,
183
- ...r
183
+ ...i
184
184
  }), c = getFunctionArguments({
185
185
  builder: t,
186
186
  context: n,
@@ -190,7 +190,7 @@ output;
190
190
  m.setSync("global", m.derefInto()), m.setSync("log", function(...l) {
191
191
  console.log(...l);
192
192
  }), m.setSync(BUILDER_SET_STATE_NAME, function(l, f) {
193
- set(a, l, f), i == null || i(a);
193
+ set(a, l, f), r == null || r(a);
194
194
  }), c.forEach(([l, f]) => {
195
195
  const d = typeof f == "object" ? new ivm.Reference(
196
196
  // workaround: methods with default values for arguments is not being cloned over
@@ -201,10 +201,10 @@ output;
201
201
  ) : null;
202
202
  m.setSync(getSyncValName(l), d);
203
203
  }), m.setSync(INJECTED_IVM_GLOBAL, ivm);
204
- const h = processCode({
204
+ const g = processCode({
205
205
  code: e,
206
206
  args: c
207
- }), p = u.evalSync(h);
207
+ }), p = u.evalSync(g);
208
208
  try {
209
209
  return JSON.parse(p);
210
210
  } catch {
@@ -216,8 +216,8 @@ function evaluate({
216
216
  context: t,
217
217
  localState: n,
218
218
  rootState: o,
219
- rootSetState: r,
220
- event: i,
219
+ rootSetState: i,
220
+ event: r,
221
221
  isExpression: a = !0
222
222
  }) {
223
223
  if (e === "") {
@@ -230,8 +230,8 @@ function evaluate({
230
230
  }),
231
231
  builder: getBuilderGlobals(),
232
232
  context: t,
233
- event: i,
234
- rootSetState: r,
233
+ event: r,
234
+ rootSetState: i,
235
235
  rootState: o,
236
236
  localState: n
237
237
  };
@@ -252,17 +252,17 @@ const evaluateBindings = ({
252
252
  context: t,
253
253
  localState: n,
254
254
  rootState: o,
255
- rootSetState: r
255
+ rootSetState: i
256
256
  }) => {
257
257
  if (!e.bindings)
258
258
  return e;
259
- const i = fastClone(e), a = {
260
- ...i,
259
+ const r = fastClone(e), a = {
260
+ ...r,
261
261
  properties: {
262
- ...i.properties
262
+ ...r.properties
263
263
  },
264
264
  actions: {
265
- ...i.actions
265
+ ...r.actions
266
266
  }
267
267
  };
268
268
  for (const s in e.bindings) {
@@ -270,7 +270,7 @@ const evaluateBindings = ({
270
270
  code: c,
271
271
  localState: n,
272
272
  rootState: o,
273
- rootSetState: r,
273
+ rootSetState: i,
274
274
  context: t
275
275
  });
276
276
  set(a, s, u);
@@ -282,15 +282,15 @@ function getProcessedBlock({
282
282
  context: t,
283
283
  shouldEvaluateBindings: n,
284
284
  localState: o,
285
- rootState: r,
286
- rootSetState: i
285
+ rootState: i,
286
+ rootSetState: r
287
287
  }) {
288
288
  const a = e;
289
289
  return n ? evaluateBindings({
290
290
  block: a,
291
291
  localState: o,
292
- rootState: r,
293
- rootSetState: i,
292
+ rootState: i,
293
+ rootSetState: r,
294
294
  context: t
295
295
  }) : a;
296
296
  }
@@ -299,20 +299,20 @@ const EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img",
299
299
  context: t,
300
300
  registeredComponents: n
301
301
  }) => {
302
- var i;
303
- const o = (i = getProcessedBlock({
302
+ var r;
303
+ const o = (r = getProcessedBlock({
304
304
  block: e,
305
305
  localState: t.localState,
306
306
  rootState: t.rootState,
307
307
  rootSetState: t.rootSetState,
308
308
  context: t.context,
309
309
  shouldEvaluateBindings: !1
310
- }).component) == null ? void 0 : i.name;
310
+ }).component) == null ? void 0 : r.name;
311
311
  if (!o)
312
312
  return null;
313
- const r = n[o];
314
- if (r)
315
- return r;
313
+ const i = n[o];
314
+ if (i)
315
+ return i;
316
316
  console.warn(`
317
317
  Could not find a registered component named "${o}".
318
318
  If you registered it, is the file that registered it imported by the file that needs to render it?`);
@@ -326,17 +326,17 @@ const EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img",
326
326
  } = e;
327
327
  if (!(n != null && n.collection))
328
328
  return;
329
- const r = evaluate({
329
+ const i = evaluate({
330
330
  code: n.collection,
331
331
  localState: t.localState,
332
332
  rootState: t.rootState,
333
333
  rootSetState: t.rootSetState,
334
334
  context: t.context
335
335
  });
336
- if (!Array.isArray(r))
336
+ if (!Array.isArray(i))
337
337
  return;
338
- const i = n.collection.split(".").pop(), a = n.itemName || (i ? i + "Item" : "item");
339
- return r.map((c, u) => ({
338
+ const r = n.collection.split(".").pop(), a = n.itemName || (r ? r + "Item" : "item");
339
+ return i.map((c, u) => ({
340
340
  context: {
341
341
  ...t,
342
342
  localState: {
@@ -378,18 +378,18 @@ const EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img",
378
378
  min: o,
379
379
  default: o + 1
380
380
  };
381
- const r = n.small.max + 1;
381
+ const i = n.small.max + 1;
382
382
  n.medium = {
383
383
  max: t,
384
- min: r,
385
- default: r + 1
384
+ min: i,
385
+ default: i + 1
386
386
  };
387
- const i = n.medium.max + 1;
387
+ const r = n.medium.max + 1;
388
388
  return n.large = {
389
389
  max: 2e3,
390
390
  // TODO: decide upper limit
391
- min: i,
392
- default: i + 1
391
+ min: r,
392
+ default: r + 1
393
393
  }, n;
394
394
  }, camelToKebabCase = (e) => e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase(), checkIsDefined = (e) => e != null, convertStyleMapToCSSArray = (e) => Object.entries(e).map(([n, o]) => {
395
395
  if (typeof o == "string")
@@ -412,7 +412,7 @@ function InlinedStyles(e) {
412
412
  }
413
413
  function BlockStyles(e) {
414
414
  const t = function() {
415
- const r = getProcessedBlock({
415
+ const i = getProcessedBlock({
416
416
  block: e.block,
417
417
  localState: e.context.localState,
418
418
  rootState: e.context.rootState,
@@ -420,33 +420,33 @@ function BlockStyles(e) {
420
420
  context: e.context.context,
421
421
  shouldEvaluateBindings: !0
422
422
  });
423
- return checkIsDefined(r.hide) ? !r.hide : checkIsDefined(r.show) ? r.show : !0;
423
+ return checkIsDefined(i.hide) ? !i.hide : checkIsDefined(i.show) ? i.show : !0;
424
424
  }, n = function() {
425
425
  var d;
426
- const r = getProcessedBlock({
426
+ const i = getProcessedBlock({
427
427
  block: e.block,
428
428
  localState: e.context.localState,
429
429
  rootState: e.context.rootState,
430
430
  rootSetState: e.context.rootSetState,
431
431
  context: e.context.context,
432
432
  shouldEvaluateBindings: !0
433
- }), i = r.responsiveStyles, a = e.context.content, s = getSizesForBreakpoints(
433
+ }), r = i.responsiveStyles, a = e.context.content, s = getSizesForBreakpoints(
434
434
  ((d = a == null ? void 0 : a.meta) == null ? void 0 : d.breakpoints) || {}
435
- ), c = i == null ? void 0 : i.large, u = i == null ? void 0 : i.medium, m = i == null ? void 0 : i.small, h = r.id;
436
- if (!h)
435
+ ), c = r == null ? void 0 : r.large, u = r == null ? void 0 : r.medium, m = r == null ? void 0 : r.small, g = i.id;
436
+ if (!g)
437
437
  return "";
438
438
  const p = c ? createCssClass({
439
- className: h,
439
+ className: g,
440
440
  styles: c
441
441
  }) : "", l = u ? createCssClass({
442
- className: h,
442
+ className: g,
443
443
  styles: u,
444
444
  mediaQuery: getMaxWidthQueryForSize(
445
445
  "medium",
446
446
  s
447
447
  )
448
448
  }) : "", f = m ? createCssClass({
449
- className: h,
449
+ className: g,
450
450
  styles: m,
451
451
  mediaQuery: getMaxWidthQueryForSize(
452
452
  "small",
@@ -474,19 +474,19 @@ function getBlockActions(e) {
474
474
  for (const o in n) {
475
475
  if (!n.hasOwnProperty(o))
476
476
  continue;
477
- const r = n[o];
478
- let i = getEventHandlerName(o);
477
+ const i = n[o];
478
+ let r = getEventHandlerName(o);
479
479
  if (e.stripPrefix)
480
480
  switch (TARGET) {
481
481
  case "vue2":
482
482
  case "vue3":
483
- i = i.replace("v-on:", "");
483
+ r = r.replace("v-on:", "");
484
484
  break;
485
485
  case "svelte":
486
- i = i.replace("on:", "");
486
+ r = r.replace("on:", "");
487
487
  break;
488
488
  }
489
- t[i] = createEventHandler(r, e);
489
+ t[r] = createEventHandler(i, e);
490
490
  }
491
491
  return t;
492
492
  }
@@ -529,10 +529,10 @@ const getWrapperProps = ({
529
529
  builderBlock: t,
530
530
  context: n,
531
531
  componentRef: o,
532
- includeBlockProps: r,
533
- isInteractive: i,
532
+ includeBlockProps: i,
533
+ isInteractive: r,
534
534
  contextValue: a
535
- }) => i ? {
535
+ }) => r ? {
536
536
  Wrapper: o,
537
537
  block: t,
538
538
  context: n,
@@ -543,7 +543,7 @@ const getWrapperProps = ({
543
543
  * If `noWrap` is set to `true`, then the block's props/attributes are provided to the
544
544
  * component itself directly. Otherwise, they are provided to the wrapper element.
545
545
  */
546
- ...r ? {
546
+ ...i ? {
547
547
  attributes: getBlockProperties({
548
548
  block: t,
549
549
  context: a
@@ -566,22 +566,22 @@ function ComponentRef(e) {
566
566
  contextValue: e.context
567
567
  }),
568
568
  children: [
569
- (n = e.blockChildren) == null ? void 0 : n.map((r) => /* @__PURE__ */ jsx(
569
+ (n = e.blockChildren) == null ? void 0 : n.map((i) => /* @__PURE__ */ jsx(
570
570
  Block,
571
571
  {
572
- block: r,
572
+ block: i,
573
573
  context: e.context,
574
574
  registeredComponents: e.registeredComponents
575
575
  },
576
- "block-" + r.id
576
+ "block-" + i.id
577
577
  )),
578
- (o = e.blockChildren) == null ? void 0 : o.map((r) => /* @__PURE__ */ jsx(
578
+ (o = e.blockChildren) == null ? void 0 : o.map((i) => /* @__PURE__ */ jsx(
579
579
  BlockStyles,
580
580
  {
581
- block: r,
581
+ block: i,
582
582
  context: e.context
583
583
  },
584
- "block-style-" + r.id
584
+ "block-style-" + i.id
585
585
  ))
586
586
  ]
587
587
  }
@@ -599,7 +599,7 @@ function RepeatedBlock(e) {
599
599
  );
600
600
  }
601
601
  function Block(e) {
602
- var u, m, h, p;
602
+ var u, m, g, p;
603
603
  const t = function() {
604
604
  return getComponent({
605
605
  block: e.block,
@@ -620,15 +620,15 @@ function Block(e) {
620
620
  context: e.context.context,
621
621
  shouldEvaluateBindings: !0
622
622
  });
623
- }, r = function() {
624
- return e.block.tagName || "div";
625
623
  }, i = function() {
624
+ return e.block.tagName || "div";
625
+ }, r = function() {
626
626
  return "hide" in o() ? !o().hide : "show" in o() ? o().show : !0;
627
627
  }, a = function() {
628
628
  var d;
629
629
  return !((d = t()) != null && d.component) && !n() ? o().children ?? [] : [];
630
630
  }, s = function() {
631
- var f, d, b, y, g;
631
+ var f, d, b, y, h;
632
632
  return {
633
633
  blockChildren: o().children ?? [],
634
634
  componentRef: (f = t()) == null ? void 0 : f.component,
@@ -643,10 +643,10 @@ function Block(e) {
643
643
  registeredComponents: e.registeredComponents,
644
644
  builderBlock: o(),
645
645
  includeBlockProps: ((y = t()) == null ? void 0 : y.noWrap) === !0,
646
- isInteractive: !((g = t()) != null && g.isRSC)
646
+ isInteractive: !((h = t()) != null && h.isRSC)
647
647
  };
648
648
  }, c = e.context;
649
- return /* @__PURE__ */ jsx(Fragment, { children: i() ? /* @__PURE__ */ jsx(Fragment, { children: (u = t()) != null && u.noWrap ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
649
+ return /* @__PURE__ */ jsx(Fragment, { children: r() ? /* @__PURE__ */ jsx(Fragment, { children: (u = t()) != null && u.noWrap ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
650
650
  ComponentRef,
651
651
  {
652
652
  componentRef: s().componentRef,
@@ -659,16 +659,16 @@ function Block(e) {
659
659
  isInteractive: s().isInteractive
660
660
  }
661
661
  ) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
662
- isEmptyHtmlElement(r()) ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
662
+ isEmptyHtmlElement(i()) ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
663
663
  BlockWrapper,
664
664
  {
665
- Wrapper: r(),
665
+ Wrapper: i(),
666
666
  block: o(),
667
667
  context: e.context,
668
668
  hasChildren: !1
669
669
  }
670
670
  ) }) : null,
671
- !isEmptyHtmlElement(r()) && n() ? /* @__PURE__ */ jsx(Fragment, { children: (m = n()) == null ? void 0 : m.map((l, f) => /* @__PURE__ */ jsx(
671
+ !isEmptyHtmlElement(i()) && n() ? /* @__PURE__ */ jsx(Fragment, { children: (m = n()) == null ? void 0 : m.map((l, f) => /* @__PURE__ */ jsx(
672
672
  RepeatedBlock,
673
673
  {
674
674
  repeatContext: l.context,
@@ -677,10 +677,10 @@ function Block(e) {
677
677
  },
678
678
  f
679
679
  )) }) : null,
680
- !isEmptyHtmlElement(r()) && !n() ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
680
+ !isEmptyHtmlElement(i()) && !n() ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
681
681
  BlockWrapper,
682
682
  {
683
- Wrapper: r(),
683
+ Wrapper: i(),
684
684
  block: o(),
685
685
  context: e.context,
686
686
  hasChildren: !0,
@@ -698,7 +698,7 @@ function Block(e) {
698
698
  isInteractive: s().isInteractive
699
699
  }
700
700
  ),
701
- (h = a()) == null ? void 0 : h.map((l) => /* @__PURE__ */ jsx(
701
+ (g = a()) == null ? void 0 : g.map((l) => /* @__PURE__ */ jsx(
702
702
  Block,
703
703
  {
704
704
  block: l,
@@ -753,12 +753,12 @@ function Blocks(e) {
753
753
  }
754
754
  function Columns(e) {
755
755
  var l;
756
- const t = typeof e.space == "number" ? e.space || 0 : 20, n = e.columns || [], o = e.stackColumnsAt || "tablet", r = function(d) {
756
+ const t = typeof e.space == "number" ? e.space || 0 : 20, n = e.columns || [], o = e.stackColumnsAt || "tablet", i = function(d) {
757
757
  var b;
758
758
  return ((b = n[d]) == null ? void 0 : b.width) || 100 / n.length;
759
- }, i = function(d) {
759
+ }, r = function(d) {
760
760
  const b = t * (n.length - 1) / n.length;
761
- return `calc(${r(d)}% - ${b}px)`;
761
+ return `calc(${i(d)}% - ${b}px)`;
762
762
  }, a = function({
763
763
  stackedStyle: d,
764
764
  desktopStyle: b
@@ -778,35 +778,35 @@ function Columns(e) {
778
778
  })
779
779
  };
780
780
  }, m = function(d) {
781
- const b = d === 0 ? 0 : t, y = i(d), g = `${b}px`, k = "100%", x = 0;
781
+ const b = d === 0 ? 0 : t, y = r(d), h = `${b}px`, v = "100%", x = 0;
782
782
  return {
783
783
  width: y,
784
- ["marginLeft"]: g,
784
+ ["marginLeft"]: h,
785
785
  "--column-width-mobile": s({
786
- stackedStyle: k,
786
+ stackedStyle: v,
787
787
  desktopStyle: y
788
788
  }),
789
789
  "--column-margin-left-mobile": s({
790
790
  stackedStyle: x,
791
- desktopStyle: g
791
+ desktopStyle: h
792
792
  }),
793
793
  "--column-width-tablet": a({
794
- stackedStyle: k,
794
+ stackedStyle: v,
795
795
  desktopStyle: y
796
796
  }),
797
797
  "--column-margin-left-tablet": a({
798
798
  stackedStyle: x,
799
- desktopStyle: g
799
+ desktopStyle: h
800
800
  })
801
801
  };
802
- }, h = function(d) {
803
- var y, g;
802
+ }, g = function(d) {
803
+ var y, h;
804
804
  return getSizesForBreakpoints(
805
- ((g = (y = e.builderContext.content) == null ? void 0 : y.meta) == null ? void 0 : g.breakpoints) || {}
805
+ ((h = (y = e.builderContext.content) == null ? void 0 : y.meta) == null ? void 0 : h.breakpoints) || {}
806
806
  )[d].max;
807
807
  }, p = function() {
808
808
  return `
809
- @media (max-width: ${h("medium")}px) {
809
+ @media (max-width: ${g("medium")}px) {
810
810
  .${e.builderBlock.id}-breakpoints {
811
811
  flex-direction: var(--flex-dir-tablet);
812
812
  align-items: stretch;
@@ -818,7 +818,7 @@ function Columns(e) {
818
818
  }
819
819
  }
820
820
 
821
- @media (max-width: ${h("small")}px) {
821
+ @media (max-width: ${g("small")}px) {
822
822
  .${e.builderBlock.id}-breakpoints {
823
823
  flex-direction: var(--flex-dir);
824
824
  align-items: stretch;
@@ -877,8 +877,8 @@ function removeProtocol(e) {
877
877
  return e.replace(/http(s)?:/, "");
878
878
  }
879
879
  function updateQueryParam(e = "", t, n) {
880
- const o = new RegExp("([?&])" + t + "=.*?(&|$)", "i"), r = e.indexOf("?") !== -1 ? "&" : "?";
881
- return e.match(o) ? e.replace(o, "$1" + t + "=" + encodeURIComponent(n) + "$2") : e + r + t + "=" + encodeURIComponent(n);
880
+ const o = new RegExp("([?&])" + t + "=.*?(&|$)", "i"), i = e.indexOf("?") !== -1 ? "&" : "?";
881
+ return e.match(o) ? e.replace(o, "$1" + t + "=" + encodeURIComponent(n) + "$2") : e + i + t + "=" + encodeURIComponent(n);
882
882
  }
883
883
  function getShopifyImageUrl(e, t) {
884
884
  if (!e || !(e != null && e.match(/cdn\.shopify\.com/)) || !t)
@@ -887,8 +887,8 @@ function getShopifyImageUrl(e, t) {
887
887
  return removeProtocol(e);
888
888
  const n = e.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);
889
889
  if (n) {
890
- const o = e.split(n[0]), r = n[3], i = t.match("x") ? t : `${t}x`;
891
- return removeProtocol(`${o[0]}_${i}${r}`);
890
+ const o = e.split(n[0]), i = n[3], r = t.match("x") ? t : `${t}x`;
891
+ return removeProtocol(`${o[0]}_${r}${i}`);
892
892
  }
893
893
  return null;
894
894
  }
@@ -899,7 +899,7 @@ function getSrcSet(e) {
899
899
  if (e.match(/builder\.io/)) {
900
900
  let n = e;
901
901
  const o = Number(e.split("?width=")[1]);
902
- return isNaN(o) || (n = `${n} ${o}w`), t.filter((r) => r !== o).map((r) => `${updateQueryParam(e, "width", r)} ${r}w`).concat([n]).join(", ");
902
+ return isNaN(o) || (n = `${n} ${o}w`), t.filter((i) => i !== o).map((i) => `${updateQueryParam(e, "width", i)} ${i}w`).concat([n]).join(", ");
903
903
  }
904
904
  return e.match(/cdn\.shopify\.com/) ? t.map((n) => [getShopifyImageUrl(e, `${n}x${n}`), n]).filter(([n]) => !!n).map(([n, o]) => `${n} ${o}w`).concat([e]).join(", ") : e;
905
905
  }
@@ -924,7 +924,7 @@ const getTopLevelDomain = (e) => {
924
924
  value: t,
925
925
  expires: n
926
926
  }) => {
927
- const r = (isBrowser() ? location.protocol === "https:" : !0) ? SECURE_CONFIG : [[]], i = n ? [["expires", n.toUTCString()]] : [[]], a = [[e, t], ...i, ["path", "/"], ["domain", getTopLevelDomain(window.location.hostname)], ...r];
927
+ const i = (isBrowser() ? location.protocol === "https:" : !0) ? SECURE_CONFIG : [[]], r = n ? [["expires", n.toUTCString()]] : [[]], a = [[e, t], ...r, ["path", "/"], ["domain", getTopLevelDomain(window.location.hostname)], ...i];
928
928
  return stringifyCookie(a);
929
929
  }, setCookie = async ({
930
930
  name: e,
@@ -935,14 +935,14 @@ const getTopLevelDomain = (e) => {
935
935
  try {
936
936
  if (!o)
937
937
  return;
938
- const r = createCookieString({
938
+ const i = createCookieString({
939
939
  name: e,
940
940
  value: t,
941
941
  expires: n
942
942
  });
943
- document.cookie = r;
944
- } catch (r) {
945
- logger.warn("[COOKIE] SET error: ", (r == null ? void 0 : r.message) || r);
943
+ document.cookie = i;
944
+ } catch (i) {
945
+ logger.warn("[COOKIE] SET error: ", (i == null ? void 0 : i.message) || i);
946
946
  }
947
947
  }, BUILDER_STORE_PREFIX = "builder.tests", getContentTestKey = (e) => `${BUILDER_STORE_PREFIX}.${e}`, getContentVariationCookie = ({
948
948
  contentId: e
@@ -965,13 +965,13 @@ const getTopLevelDomain = (e) => {
965
965
  id: e,
966
966
  variations: t
967
967
  }) => {
968
- var r;
968
+ var i;
969
969
  let n = 0;
970
970
  const o = Math.random();
971
- for (const i in t) {
972
- const a = (r = t[i]) == null ? void 0 : r.testRatio;
971
+ for (const r in t) {
972
+ const a = (i = t[r]) == null ? void 0 : i.testRatio;
973
973
  if (n += a, o < n)
974
- return i;
974
+ return r;
975
975
  }
976
976
  return e;
977
977
  }, getAndSetVariantId = (e) => {
@@ -1030,13 +1030,13 @@ const getTopLevelDomain = (e) => {
1030
1030
  }) || getAndSetVariantId({
1031
1031
  variations: e.variations,
1032
1032
  id: e.id
1033
- }), r = getTestFields({
1033
+ }), i = getTestFields({
1034
1034
  item: e,
1035
1035
  testGroupId: o
1036
1036
  });
1037
1037
  return {
1038
1038
  ...e,
1039
- ...r
1039
+ ...i
1040
1040
  };
1041
1041
  }, getDefaultCanTrack = (e) => checkIsDefined(e) ? e : !0, componentInfo$a = {
1042
1042
  name: "Core:Button",
@@ -1250,7 +1250,7 @@ const getTopLevelDomain = (e) => {
1250
1250
  });
1251
1251
  }
1252
1252
  const n = e.get("columns");
1253
- Array.isArray(n) && n.find((r) => r.get("width")) && (n.find((i) => !i.get("width")) || n.reduce((s, c) => s + c.get("width"), 0) !== 100) && t();
1253
+ Array.isArray(n) && n.find((i) => i.get("width")) && (n.find((r) => !r.get("width")) || n.reduce((s, c) => s + c.get("width"), 0) !== 100) && t();
1254
1254
  }
1255
1255
  }, {
1256
1256
  name: "space",
@@ -1348,26 +1348,26 @@ const getTopLevelDomain = (e) => {
1348
1348
  function n(a, s = 6e4) {
1349
1349
  return new Promise((c, u) => {
1350
1350
  const m = document.createElement("img");
1351
- let h = !1;
1351
+ let g = !1;
1352
1352
  m.onload = () => {
1353
- h = !0, c(m);
1353
+ g = !0, c(m);
1354
1354
  }, m.addEventListener("error", (p) => {
1355
1355
  console.warn("Image load failed", p.error), u(p.error);
1356
1356
  }), m.src = a, setTimeout(() => {
1357
- h || u(new Error("Image load timed out"));
1357
+ g || u(new Error("Image load timed out"));
1358
1358
  }, s);
1359
1359
  });
1360
1360
  }
1361
1361
  function o(a) {
1362
1362
  return Math.round(a * 1e3) / 1e3;
1363
1363
  }
1364
- const r = e.get("image"), i = e.get("aspectRatio");
1365
- if (fetch(r).then((a) => a.blob()).then((a) => {
1364
+ const i = e.get("image"), r = e.get("aspectRatio");
1365
+ if (fetch(i).then((a) => a.blob()).then((a) => {
1366
1366
  a.type.includes("svg") && e.set("noWebp", !0);
1367
- }), r && (!i || i === 0.7041))
1368
- return n(r).then((a) => {
1367
+ }), i && (!r || r === 0.7041))
1368
+ return n(i).then((a) => {
1369
1369
  const s = e.get("aspectRatio");
1370
- e.get("image") === r && (!s || s === 0.7041) && a.width && a.height && (e.set("aspectRatio", o(a.height / a.width)), e.set("height", a.height), e.set("width", a.width));
1370
+ e.get("image") === i && (!s || s === 0.7041) && a.width && a.height && (e.set("aspectRatio", o(a.height / a.width)), e.set("height", a.height), e.set("width", a.width));
1371
1371
  });
1372
1372
  }
1373
1373
  }, {
@@ -1668,108 +1668,125 @@ const componentInfo = {
1668
1668
  ...t
1669
1669
  }) => ({
1670
1670
  ...fastClone(t),
1671
- inputs: e == null ? void 0 : e.map((n) => Object.entries(n).reduce((o, [r, i]) => ({
1671
+ inputs: e == null ? void 0 : e.map((n) => Object.entries(n).reduce((o, [i, r]) => ({
1672
1672
  ...o,
1673
- [r]: serializeValue(i)
1673
+ [i]: serializeValue(r)
1674
1674
  }), {}))
1675
- }), getVariants = (e) => Object.values((e == null ? void 0 : e.variations) || {}).map((t) => ({
1676
- ...t,
1677
- testVariationId: t.id,
1678
- id: e == null ? void 0 : e.id
1679
- })), checkShouldRunVariants = ({
1680
- canTrack: e,
1681
- content: t
1682
- }) => !(!(getVariants(t).length > 0) || !e || isBrowser());
1683
- function bldrAbTest(e, t, n) {
1684
- var a;
1685
- function o() {
1686
- function s(f, d, b) {
1687
- let y = "";
1688
- if (b) {
1689
- const g = /* @__PURE__ */ new Date();
1690
- g.setTime(g.getTime() + b * 24 * 60 * 60 * 1e3), y = "; expires=" + g.toUTCString();
1675
+ }), UPDATE_COOKIES_AND_STYLES_SCRIPT = `function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
1676
+ function getAndSetVariantId() {
1677
+ function setCookie(name, value, days) {
1678
+ let expires = '';
1679
+ if (days) {
1680
+ const date = new Date();
1681
+ date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
1682
+ expires = '; expires=' + date.toUTCString();
1691
1683
  }
1692
- document.cookie = f + "=" + (d || "") + y + "; path=/; Secure; SameSite=None";
1684
+ document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';
1693
1685
  }
1694
- function c(f) {
1695
- const d = f + "=", b = document.cookie.split(";");
1696
- for (let y = 0; y < b.length; y++) {
1697
- let g = b[y];
1698
- for (; g.charAt(0) === " "; )
1699
- g = g.substring(1, g.length);
1700
- if (g.indexOf(d) === 0)
1701
- return g.substring(d.length, g.length);
1686
+ function getCookie(name) {
1687
+ const nameEQ = name + '=';
1688
+ const ca = document.cookie.split(';');
1689
+ for (let i = 0; i < ca.length; i++) {
1690
+ let c = ca[i];
1691
+ while (c.charAt(0) === ' ') c = c.substring(1, c.length);
1692
+ if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
1702
1693
  }
1703
1694
  return null;
1704
1695
  }
1705
- const u = `builder.tests.${e}`, m = c(u), h = t.map((f) => f.id).concat(e);
1706
- if (m && h.includes(m))
1707
- return m;
1708
- let p = 0;
1709
- const l = Math.random();
1710
- for (let f = 0; f < t.length; f++) {
1711
- const d = t[f], b = d.testRatio;
1712
- if (p += b, l < p)
1713
- return s(u, d.id), d.id;
1696
+ const cookieName = \`builder.tests.\${contentId}\`;
1697
+ const variantInCookie = getCookie(cookieName);
1698
+ const availableIDs = variants.map(vr => vr.id).concat(contentId);
1699
+ if (variantInCookie && availableIDs.includes(variantInCookie)) {
1700
+ return variantInCookie;
1714
1701
  }
1715
- return s(u, e), e;
1702
+ let n = 0;
1703
+ const random = Math.random();
1704
+ for (let i = 0; i < variants.length; i++) {
1705
+ const variant = variants[i];
1706
+ const testRatio = variant.testRatio;
1707
+ n += testRatio;
1708
+ if (random < n) {
1709
+ setCookie(cookieName, variant.id);
1710
+ return variant.id;
1711
+ }
1712
+ }
1713
+ setCookie(cookieName, contentId);
1714
+ return contentId;
1716
1715
  }
1717
- const r = o(), i = (a = document.currentScript) == null ? void 0 : a.previousElementSibling;
1718
- if (n) {
1719
- i.remove();
1720
- const s = document.currentScript;
1721
- s == null || s.remove();
1716
+ const winningVariantId = getAndSetVariantId();
1717
+ const styleEl = document.currentScript?.previousElementSibling;
1718
+ if (isHydrationTarget) {
1719
+ styleEl.remove();
1720
+ const thisScriptEl = document.currentScript;
1721
+ thisScriptEl?.remove();
1722
1722
  } else {
1723
- const s = t.concat({
1724
- id: e
1725
- }).filter((c) => c.id !== r).map((c) => `.variant-${c.id} { display: none; }
1726
- `).join("");
1727
- i.innerHTML = s;
1723
+ const newStyleStr = variants.concat({
1724
+ id: contentId
1725
+ }).filter(variant => variant.id !== winningVariantId).map(value => {
1726
+ return \`.variant-\${value.id} { display: none; }
1727
+ \`;
1728
+ }).join('');
1729
+ styleEl.innerHTML = newStyleStr;
1728
1730
  }
1729
- }
1730
- function bldrCntntScrpt(e, t, n) {
1731
- var c;
1732
- if (!navigator.cookieEnabled)
1731
+ }`, UPDATE_VARIANT_VISIBILITY_SCRIPT = `function updateVariantVisibility(variantContentId, defaultContentId, isHydrationTarget) {
1732
+ if (!navigator.cookieEnabled) {
1733
1733
  return;
1734
- function o(u) {
1735
- const m = u + "=", h = document.cookie.split(";");
1736
- for (let p = 0; p < h.length; p++) {
1737
- let l = h[p];
1738
- for (; l.charAt(0) === " "; )
1739
- l = l.substring(1, l.length);
1740
- if (l.indexOf(m) === 0)
1741
- return l.substring(m.length, l.length);
1734
+ }
1735
+ function getCookie(name) {
1736
+ const nameEQ = name + '=';
1737
+ const ca = document.cookie.split(';');
1738
+ for (let i = 0; i < ca.length; i++) {
1739
+ let c = ca[i];
1740
+ while (c.charAt(0) === ' ') c = c.substring(1, c.length);
1741
+ if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
1742
1742
  }
1743
1743
  return null;
1744
1744
  }
1745
- const r = `builder.tests.${t}`, i = o(r), a = (c = document.currentScript) == null ? void 0 : c.parentElement, s = e === t;
1746
- if (i === e) {
1747
- if (s)
1748
- return;
1749
- a == null || a.removeAttribute("hidden"), a == null || a.removeAttribute("aria-hidden");
1750
- } else {
1751
- s && (n ? a == null || a.remove() : (a == null || a.setAttribute("hidden", "true"), a == null || a.setAttribute("aria-hidden", "true")));
1752
- return;
1745
+ const cookieName = \`builder.tests.\${defaultContentId}\`;
1746
+ const winningVariant = getCookie(cookieName);
1747
+ const parentDiv = document.currentScript?.parentElement;
1748
+ const isDefaultContent = variantContentId === defaultContentId;
1749
+ const isWinningVariant = winningVariant === variantContentId;
1750
+ if (isWinningVariant && !isDefaultContent) {
1751
+ parentDiv?.removeAttribute('hidden');
1752
+ parentDiv?.removeAttribute('aria-hidden');
1753
+ } else if (!isWinningVariant && isDefaultContent) {
1754
+ parentDiv?.setAttribute('hidden', 'true');
1755
+ parentDiv?.setAttribute('aria-hidden', 'true');
1753
1756
  }
1754
- }
1755
- const getIsHydrationTarget = (e) => e === "react" || e === "reactNative", isHydrationTarget = getIsHydrationTarget(TARGET), AB_TEST_FN_NAME = "builderIoAbTest", CONTENT_FN_NAME = "builderIoRenderContent", getScriptString = () => {
1756
- const e = bldrAbTest.toString().replace(/\s+/g, " "), t = bldrCntntScrpt.toString().replace(/\s+/g, " ");
1757
- return `
1758
- window.${AB_TEST_FN_NAME} = ${e}
1759
- window.${CONTENT_FN_NAME} = ${t}
1760
- `;
1761
- }, getVariantsScriptString = (e, t) => `
1762
- window.${AB_TEST_FN_NAME}("${t}",${JSON.stringify(e)}, ${isHydrationTarget})`, getRenderContentScriptString = ({
1757
+ if (isHydrationTarget) {
1758
+ if (!isWinningVariant) {
1759
+ parentDiv?.remove();
1760
+ }
1761
+ const thisScriptEl = document.currentScript;
1762
+ thisScriptEl?.remove();
1763
+ }
1764
+ return;
1765
+ }`, UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest", UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "builderIoRenderContent", getVariants = (e) => Object.values((e == null ? void 0 : e.variations) || {}).map((t) => ({
1766
+ ...t,
1767
+ testVariationId: t.id,
1768
+ id: e == null ? void 0 : e.id
1769
+ })), checkShouldRenderVariants = ({
1770
+ canTrack: e,
1771
+ content: t
1772
+ }) => !(!(getVariants(t).length > 0) || !e || isBrowser()), getIsHydrationTarget = (e) => e === "react" || e === "reactNative", isHydrationTarget = getIsHydrationTarget(TARGET), getScriptString = () => `
1773
+ window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
1774
+ window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
1775
+ `, getUpdateCookieAndStylesScript = (e, t) => `
1776
+ window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
1777
+ "${t}",${JSON.stringify(e)}, ${isHydrationTarget}
1778
+ )`, getUpdateVariantVisibilityScript = ({
1763
1779
  contentId: e,
1764
1780
  variationId: t
1765
- }) => `
1766
- window.${CONTENT_FN_NAME}("${t}", "${e}", ${isHydrationTarget})`;
1781
+ }) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
1782
+ "${t}", "${e}", ${isHydrationTarget}
1783
+ )`;
1767
1784
  function InlinedScript(e) {
1768
1785
  return /* @__PURE__ */ jsx(
1769
1786
  "script",
1770
1787
  {
1771
1788
  dangerouslySetInnerHTML: { __html: e.scriptStr },
1772
- id: e.id
1789
+ id: e.id || ""
1773
1790
  }
1774
1791
  );
1775
1792
  }
@@ -1801,14 +1818,14 @@ function getFetch() {
1801
1818
  }
1802
1819
  const fetch$1 = getFetch();
1803
1820
  function flatten(e, t = null, n = ".") {
1804
- return Object.keys(e).reduce((o, r) => {
1805
- const i = e[r], a = [t, r].filter(Boolean).join(n);
1806
- return [typeof i == "object", i !== null, !(Array.isArray(i) && i.length === 0)].every(Boolean) ? {
1821
+ return Object.keys(e).reduce((o, i) => {
1822
+ const r = e[i], a = [t, i].filter(Boolean).join(n);
1823
+ return [typeof r == "object", r !== null, !(Array.isArray(r) && r.length === 0)].every(Boolean) ? {
1807
1824
  ...o,
1808
- ...flatten(i, a, n)
1825
+ ...flatten(r, a, n)
1809
1826
  } : {
1810
1827
  ...o,
1811
- [a]: i
1828
+ [a]: r
1812
1829
  };
1813
1830
  }, {});
1814
1831
  }
@@ -1823,8 +1840,8 @@ const DEFAULT_API_VERSION = "v3", BUILDER_SEARCHPARAMS_PREFIX = "builder.", BUIL
1823
1840
  const t = normalizeSearchParams(e), n = {};
1824
1841
  return Object.keys(t).forEach((o) => {
1825
1842
  if (o.startsWith(BUILDER_SEARCHPARAMS_PREFIX)) {
1826
- const r = o.replace(BUILDER_SEARCHPARAMS_PREFIX, "").replace(BUILDER_OPTIONS_PREFIX, "");
1827
- n[r] = t[o];
1843
+ const i = o.replace(BUILDER_SEARCHPARAMS_PREFIX, "").replace(BUILDER_OPTIONS_PREFIX, "");
1844
+ n[i] = t[o];
1828
1845
  }
1829
1846
  }), n;
1830
1847
  }, getBuilderSearchParamsFromWindow = () => {
@@ -1839,14 +1856,14 @@ const DEFAULT_API_VERSION = "v3", BUILDER_SEARCHPARAMS_PREFIX = "builder.", BUIL
1839
1856
  const {
1840
1857
  limit: n = 30,
1841
1858
  userAttributes: o,
1842
- query: r,
1843
- model: i,
1859
+ query: i,
1860
+ model: r,
1844
1861
  apiKey: a,
1845
1862
  includeRefs: s = !0,
1846
1863
  enrich: c,
1847
1864
  locale: u,
1848
1865
  apiVersion: m = DEFAULT_API_VERSION,
1849
- fields: h,
1866
+ fields: g,
1850
1867
  omit: p,
1851
1868
  offset: l,
1852
1869
  cacheSeconds: f,
@@ -1859,28 +1876,28 @@ const DEFAULT_API_VERSION = "v3", BUILDER_SEARCHPARAMS_PREFIX = "builder.", BUIL
1859
1876
  if (!["v2", "v3"].includes(m))
1860
1877
  throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${m}'`);
1861
1878
  (e.limit === void 0 || e.limit > 1) && !("noTraverse" in e) && (t = !0);
1862
- const g = new URL(`https://cdn.builder.io/api/${m}/content/${i}?apiKey=${a}&limit=${n}&noTraverse=${t}&includeRefs=${s}${u ? `&locale=${u}` : ""}${c ? `&enrich=${c}` : ""}`);
1863
- if (g.searchParams.set("omit", p || "meta.componentsUsed"), h && g.searchParams.set("fields", h), Number.isFinite(l) && l > -1 && g.searchParams.set("offset", String(Math.floor(l))), typeof y == "boolean" && g.searchParams.set("includeUnpublished", String(y)), f && isPositiveNumber(f) && g.searchParams.set("cacheSeconds", String(f)), d && isPositiveNumber(d) && g.searchParams.set("staleCacheSeconds", String(d)), b) {
1879
+ const h = new URL(`https://cdn.builder.io/api/${m}/content/${r}?apiKey=${a}&limit=${n}&noTraverse=${t}&includeRefs=${s}${u ? `&locale=${u}` : ""}${c ? `&enrich=${c}` : ""}`);
1880
+ if (h.searchParams.set("omit", p || "meta.componentsUsed"), g && h.searchParams.set("fields", g), Number.isFinite(l) && l > -1 && h.searchParams.set("offset", String(Math.floor(l))), typeof y == "boolean" && h.searchParams.set("includeUnpublished", String(y)), f && isPositiveNumber(f) && h.searchParams.set("cacheSeconds", String(f)), d && isPositiveNumber(d) && h.searchParams.set("staleCacheSeconds", String(d)), b) {
1864
1881
  const S = flatten({
1865
1882
  sort: b
1866
1883
  });
1867
1884
  for (const C in S)
1868
- g.searchParams.set(C, JSON.stringify(S[C]));
1885
+ h.searchParams.set(C, JSON.stringify(S[C]));
1869
1886
  }
1870
- const k = {
1887
+ const v = {
1871
1888
  ...getBuilderSearchParamsFromWindow(),
1872
1889
  ...normalizeSearchParams(e.options || {})
1873
- }, x = flatten(k);
1890
+ }, x = flatten(v);
1874
1891
  for (const S in x)
1875
- g.searchParams.set(S, String(x[S]));
1876
- if (o && g.searchParams.set("userAttributes", JSON.stringify(o)), r) {
1892
+ h.searchParams.set(S, String(x[S]));
1893
+ if (o && h.searchParams.set("userAttributes", JSON.stringify(o)), i) {
1877
1894
  const S = flatten({
1878
- query: r
1895
+ query: i
1879
1896
  });
1880
1897
  for (const C in S)
1881
- g.searchParams.set(C, JSON.stringify(S[C]));
1898
+ h.searchParams.set(C, JSON.stringify(S[C]));
1882
1899
  }
1883
- return g;
1900
+ return h;
1884
1901
  }, checkContentHasResults = (e) => "results" in e;
1885
1902
  async function fetchOneEntry(e) {
1886
1903
  const t = await fetchEntries({
@@ -1895,25 +1912,25 @@ const getContent = fetchOneEntry, _fetchContent = async (e) => {
1895
1912
  }, _processContentResult = async (e, t, n = generateContentUrl(e)) => {
1896
1913
  const o = getDefaultCanTrack(e.canTrack);
1897
1914
  if (n.search.includes("preview=")) {
1898
- const i = [];
1915
+ const r = [];
1899
1916
  for (const a of t.results) {
1900
1917
  const s = getPreviewContent(n.searchParams);
1901
- i.push(s || a);
1918
+ r.push(s || a);
1902
1919
  }
1903
- t.results = i;
1920
+ t.results = r;
1904
1921
  }
1905
1922
  if (!o || !(isBrowser() || TARGET === "reactNative"))
1906
1923
  return t;
1907
1924
  try {
1908
- const i = [];
1925
+ const r = [];
1909
1926
  for (const a of t.results)
1910
- i.push(await handleABTesting({
1927
+ r.push(await handleABTesting({
1911
1928
  item: a,
1912
1929
  canTrack: o
1913
1930
  }));
1914
- t.results = i;
1915
- } catch (i) {
1916
- logger.error("Could not process A/B tests. ", i);
1931
+ t.results = r;
1932
+ } catch (r) {
1933
+ logger.error("Could not process A/B tests. ", r);
1917
1934
  }
1918
1935
  return t;
1919
1936
  };
@@ -1986,8 +2003,8 @@ const SESSION_LOCAL_STORAGE_KEY = "builderSessionId", getSessionId = async ({
1986
2003
  var o;
1987
2004
  try {
1988
2005
  t && ((o = getLocalStorage()) == null || o.setItem(e, n));
1989
- } catch (r) {
1990
- console.debug("[LocalStorage] SET error: ", r);
2006
+ } catch (i) {
2007
+ console.debug("[LocalStorage] SET error: ", i);
1991
2008
  }
1992
2009
  }, VISITOR_LOCAL_STORAGE_KEY = "builderVisitorId", getVisitorId = ({
1993
2010
  canTrack: e
@@ -2036,11 +2053,11 @@ const SESSION_LOCAL_STORAGE_KEY = "builderSessionId", getSessionId = async ({
2036
2053
  canTrack: t,
2037
2054
  apiKey: n,
2038
2055
  metadata: o,
2039
- ...r
2056
+ ...i
2040
2057
  }) => ({
2041
2058
  type: e,
2042
2059
  data: {
2043
- ...r,
2060
+ ...i,
2044
2061
  metadata: {
2045
2062
  url: location.href,
2046
2063
  ...o
@@ -2096,9 +2113,9 @@ const findParentElement = (e, t, n = !0) => {
2096
2113
  event: e,
2097
2114
  target: t
2098
2115
  }) => {
2099
- const n = t.getBoundingClientRect(), o = e.clientX - n.left, r = e.clientY - n.top, i = round(o / n.width), a = round(r / n.height);
2116
+ const n = t.getBoundingClientRect(), o = e.clientX - n.left, i = e.clientY - n.top, r = round(o / n.width), a = round(i / n.height);
2100
2117
  return {
2101
- x: i,
2118
+ x: r,
2102
2119
  y: a
2103
2120
  };
2104
2121
  }, getInteractionPropertiesForEvent = (e) => {
@@ -2117,7 +2134,7 @@ const findParentElement = (e, t, n = !0) => {
2117
2134
  builderElementIndex: n && o ? [].slice.call(document.getElementsByClassName(o)).indexOf(n) : void 0
2118
2135
  }
2119
2136
  };
2120
- }, SDK_VERSION = "0.7.2", registry = {};
2137
+ }, SDK_VERSION = "0.7.4", registry = {};
2121
2138
  function register(e, t) {
2122
2139
  let n = registry[e];
2123
2140
  if (n || (n = registry[e] = []), n.push(t), isBrowser()) {
@@ -2130,8 +2147,8 @@ function register(e, t) {
2130
2147
  };
2131
2148
  try {
2132
2149
  parent.postMessage(o, "*"), parent !== window && window.postMessage(o, "*");
2133
- } catch (r) {
2134
- console.debug("Could not postmessage", r);
2150
+ } catch (i) {
2151
+ console.debug("Could not postmessage", i);
2135
2152
  }
2136
2153
  }
2137
2154
  }
@@ -2180,22 +2197,22 @@ const setupBrowserForEditing = (e = {}) => {
2180
2197
  }, "*"), window.addEventListener("message", ({
2181
2198
  data: o
2182
2199
  }) => {
2183
- var r, i;
2200
+ var i, r;
2184
2201
  if (o != null && o.type)
2185
2202
  switch (o.type) {
2186
2203
  case "builder.evaluate": {
2187
2204
  const a = o.data.text, s = o.data.arguments || [], c = o.data.id, u = new Function(a);
2188
- let m, h = null;
2205
+ let m, g = null;
2189
2206
  try {
2190
2207
  m = u.apply(null, s);
2191
2208
  } catch (p) {
2192
- h = p;
2209
+ g = p;
2193
2210
  }
2194
- h ? (r = window.parent) == null || r.postMessage({
2211
+ g ? (i = window.parent) == null || i.postMessage({
2195
2212
  type: "builder.evaluateError",
2196
2213
  data: {
2197
2214
  id: c,
2198
- error: h.message
2215
+ error: g.message
2199
2216
  }
2200
2217
  }, "*") : m && typeof m.then == "function" ? m.then((p) => {
2201
2218
  var l;
@@ -2206,7 +2223,7 @@ const setupBrowserForEditing = (e = {}) => {
2206
2223
  result: p
2207
2224
  }
2208
2225
  }, "*");
2209
- }).catch(console.error) : (i = window.parent) == null || i.postMessage({
2226
+ }).catch(console.error) : (r = window.parent) == null || r.postMessage({
2210
2227
  type: "builder.evaluateResult",
2211
2228
  data: {
2212
2229
  result: m,
@@ -2218,10 +2235,10 @@ const setupBrowserForEditing = (e = {}) => {
2218
2235
  }
2219
2236
  })));
2220
2237
  }, getCssFromFont = (e) => {
2221
- var i;
2222
- const t = e.family + (e.kind && !e.kind.includes("#") ? ", " + e.kind : ""), n = t.split(",")[0], o = e.fileUrl ?? ((i = e == null ? void 0 : e.files) == null ? void 0 : i.regular);
2223
- let r = "";
2224
- if (o && t && n && (r += `
2238
+ var r;
2239
+ const t = e.family + (e.kind && !e.kind.includes("#") ? ", " + e.kind : ""), n = t.split(",")[0], o = e.fileUrl ?? ((r = e == null ? void 0 : e.files) == null ? void 0 : r.regular);
2240
+ let i = "";
2241
+ if (o && t && n && (i += `
2225
2242
  @font-face {
2226
2243
  font-family: "${t}";
2227
2244
  src: local("${n}"), url('${o}') format('woff2');
@@ -2233,7 +2250,7 @@ font-weight: 400;
2233
2250
  if (!(String(Number(a)) === a))
2234
2251
  continue;
2235
2252
  const c = e.files[a];
2236
- c && c !== o && (r += `
2253
+ c && c !== o && (i += `
2237
2254
  @font-face {
2238
2255
  font-family: "${t}";
2239
2256
  src: url('${c}') format('woff2');
@@ -2242,7 +2259,7 @@ font-weight: ${a};
2242
2259
  }
2243
2260
  `.trim());
2244
2261
  }
2245
- return r;
2262
+ return i;
2246
2263
  }, getFontCss = ({
2247
2264
  customFonts: e
2248
2265
  }) => {
@@ -2282,13 +2299,13 @@ const getContextStateInitialValue = ({
2282
2299
  data: t,
2283
2300
  locale: n
2284
2301
  }) => {
2285
- var i, a, s;
2302
+ var r, a, s;
2286
2303
  const o = {};
2287
- (a = (i = e == null ? void 0 : e.data) == null ? void 0 : i.inputs) == null || a.forEach((c) => {
2304
+ (a = (r = e == null ? void 0 : e.data) == null ? void 0 : r.inputs) == null || a.forEach((c) => {
2288
2305
  var u;
2289
2306
  c.name && c.defaultValue !== void 0 && ((u = e == null ? void 0 : e.data) != null && u.state) && e.data.state[c.name] === void 0 && (o[c.name] = c.defaultValue);
2290
2307
  });
2291
- const r = {
2308
+ const i = {
2292
2309
  ...(s = e == null ? void 0 : e.data) == null ? void 0 : s.state,
2293
2310
  ...t,
2294
2311
  ...n ? {
@@ -2297,7 +2314,7 @@ const getContextStateInitialValue = ({
2297
2314
  };
2298
2315
  return {
2299
2316
  ...o,
2300
- ...r
2317
+ ...i
2301
2318
  };
2302
2319
  }, getContentInitialValue = ({
2303
2320
  content: e,
@@ -2311,12 +2328,12 @@ const getContextStateInitialValue = ({
2311
2328
  meta: e == null ? void 0 : e.meta
2312
2329
  } : void 0;
2313
2330
  function ContentComponent(e) {
2314
- var r, i, a, s, c, u, m, h, p;
2315
- const t = getRenderContentScriptString({
2331
+ var i, r, a, s, c, u, m, g, p;
2332
+ const t = getUpdateVariantVisibilityScript({
2316
2333
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
2317
- variationId: (r = e.content) == null ? void 0 : r.testVariationId,
2334
+ variationId: (i = e.content) == null ? void 0 : i.testVariationId,
2318
2335
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
2319
- contentId: (i = e.content) == null ? void 0 : i.id
2336
+ contentId: (r = e.content) == null ? void 0 : r.id
2320
2337
  }), n = [
2321
2338
  ...getDefaultRegisteredComponents(),
2322
2339
  // While this `components` object is deprecated, we must maintain support for it.
@@ -2379,7 +2396,6 @@ function ContentComponent(e) {
2379
2396
  locale: e.locale,
2380
2397
  includeRefs: e.includeRefs,
2381
2398
  enrich: e.enrich,
2382
- classNameProp: e.classNameProp,
2383
2399
  showContent: e.showContent,
2384
2400
  builderContextSignal: o,
2385
2401
  children: [
@@ -2395,7 +2411,7 @@ function ContentComponent(e) {
2395
2411
  /* @__PURE__ */ jsx(
2396
2412
  Blocks,
2397
2413
  {
2398
- blocks: (p = (h = o.content) == null ? void 0 : h.data) == null ? void 0 : p.blocks,
2414
+ blocks: (p = (g = o.content) == null ? void 0 : g.data) == null ? void 0 : p.blocks,
2399
2415
  context: o,
2400
2416
  registeredComponents: n
2401
2417
  }
@@ -2405,26 +2421,26 @@ function ContentComponent(e) {
2405
2421
  );
2406
2422
  }
2407
2423
  function ContentVariants(e) {
2408
- var i, a, s;
2409
- const t = checkShouldRunVariants({
2424
+ var r, a;
2425
+ const t = checkShouldRenderVariants({
2410
2426
  canTrack: getDefaultCanTrack(e.canTrack),
2411
2427
  content: e.content
2412
2428
  }), n = function() {
2413
- var u;
2414
- return getVariantsScriptString(
2415
- getVariants(e.content).map((m) => ({
2416
- id: m.testVariationId,
2417
- testRatio: m.testRatio
2429
+ var c;
2430
+ return getUpdateCookieAndStylesScript(
2431
+ getVariants(e.content).map((u) => ({
2432
+ id: u.testVariationId,
2433
+ testRatio: u.testRatio
2418
2434
  })),
2419
- ((u = e.content) == null ? void 0 : u.id) || ""
2435
+ ((c = e.content) == null ? void 0 : c.id) || ""
2420
2436
  );
2421
2437
  }, o = function() {
2422
- return getVariants(e.content).map((u) => `.variant-${u.testVariationId} { display: none; } `).join("");
2423
- }, r = function() {
2424
- var u;
2438
+ return getVariants(e.content).map((c) => `.variant-${c.testVariationId} { display: none; } `).join("");
2439
+ }, i = function() {
2440
+ var c;
2425
2441
  return t ? {
2426
2442
  ...e.content,
2427
- testVariationId: (u = e.content) == null ? void 0 : u.id
2443
+ testVariationId: (c = e.content) == null ? void 0 : c.id
2428
2444
  } : handleABTestingSync({
2429
2445
  item: e.content,
2430
2446
  canTrack: getDefaultCanTrack(e.canTrack)
@@ -2436,17 +2452,16 @@ function ContentVariants(e) {
2436
2452
  /* @__PURE__ */ jsx(
2437
2453
  InlinedStyles,
2438
2454
  {
2439
- id: `variants-styles-${(i = e.content) == null ? void 0 : i.id}`,
2455
+ id: `variants-styles-${(r = e.content) == null ? void 0 : r.id}`,
2440
2456
  styles: o()
2441
2457
  }
2442
2458
  ),
2443
2459
  /* @__PURE__ */ jsx(InlinedScript, { scriptStr: n() }),
2444
- (a = getVariants(e.content)) == null ? void 0 : a.map((c) => /* @__PURE__ */ jsx(
2460
+ (a = getVariants(e.content)) == null ? void 0 : a.map((s) => /* @__PURE__ */ jsx(
2445
2461
  ContentComponent,
2446
2462
  {
2447
- content: c,
2463
+ content: s,
2448
2464
  showContent: !1,
2449
- classNameProp: void 0,
2450
2465
  model: e.model,
2451
2466
  data: e.data,
2452
2467
  context: e.context,
@@ -2459,14 +2474,13 @@ function ContentVariants(e) {
2459
2474
  enrich: e.enrich,
2460
2475
  isSsrAbTest: t
2461
2476
  },
2462
- c.testVariationId
2477
+ s.testVariationId
2463
2478
  ))
2464
2479
  ] }) : null,
2465
2480
  /* @__PURE__ */ jsx(
2466
2481
  ContentComponent,
2467
2482
  {
2468
- content: r(),
2469
- classNameProp: `variant-${(s = e.content) == null ? void 0 : s.id}`,
2483
+ content: i(),
2470
2484
  showContent: !0,
2471
2485
  model: e.model,
2472
2486
  data: e.data,
@@ -2503,7 +2517,7 @@ const fetchSymbolContent = async ({
2503
2517
  });
2504
2518
  };
2505
2519
  async function Symbol$1(e) {
2506
- var o, r, i, a;
2520
+ var o, i, r, a;
2507
2521
  const t = function() {
2508
2522
  var c, u;
2509
2523
  return [
@@ -2525,9 +2539,9 @@ async function Symbol$1(e) {
2525
2539
  context: e.builderContext.context,
2526
2540
  customComponents: Object.values(e.builderComponents),
2527
2541
  data: {
2528
- ...(r = e.symbol) == null ? void 0 : r.data,
2542
+ ...(i = e.symbol) == null ? void 0 : i.data,
2529
2543
  ...e.builderContext.localState,
2530
- ...(i = n == null ? void 0 : n.data) == null ? void 0 : i.state
2544
+ ...(r = n == null ? void 0 : n.data) == null ? void 0 : r.state
2531
2545
  },
2532
2546
  model: (a = e.symbol) == null ? void 0 : a.model,
2533
2547
  content: n
@@ -2546,8 +2560,8 @@ function setEditorSettings(e) {
2546
2560
  }
2547
2561
  }
2548
2562
  const fetchBuilderProps = async (e) => {
2549
- var o, r, i;
2550
- const t = e.path || ((o = e.url) == null ? void 0 : o.pathname) || ((r = e.userAttributes) == null ? void 0 : r.urlPath), n = {
2563
+ var o, i, r;
2564
+ const t = e.path || ((o = e.url) == null ? void 0 : o.pathname) || ((i = e.userAttributes) == null ? void 0 : i.urlPath), n = {
2551
2565
  ...e,
2552
2566
  apiKey: e.apiKey,
2553
2567
  model: e.model || "page",
@@ -2557,7 +2571,7 @@ const fetchBuilderProps = async (e) => {
2557
2571
  urlPath: t
2558
2572
  } : {}
2559
2573
  },
2560
- options: getBuilderSearchParams(e.searchParams || ((i = e.url) == null ? void 0 : i.searchParams) || e.options)
2574
+ options: getBuilderSearchParams(e.searchParams || ((r = e.url) == null ? void 0 : r.searchParams) || e.options)
2561
2575
  };
2562
2576
  return {
2563
2577
  apiKey: n.apiKey,