@builder.io/sdk-qwik 0.5.9 → 0.6.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.
Files changed (36) hide show
  1. package/README.md +0 -4
  2. package/lib/browser/index.qwik.cjs +4270 -0
  3. package/lib/browser/index.qwik.mjs +4270 -0
  4. package/lib/edge/index.qwik.cjs +7474 -0
  5. package/lib/edge/index.qwik.mjs +7474 -0
  6. package/lib/index.qwik.cjs +1492 -211
  7. package/lib/index.qwik.mjs +1493 -212
  8. package/lib/node/index.qwik.cjs +4270 -0
  9. package/lib/node/index.qwik.mjs +4270 -0
  10. package/package.json +83 -13
  11. package/types/components/blocks/deopt.d.ts +4 -0
  12. package/types/constants/sdk-version.d.ts +1 -1
  13. package/types/functions/evaluate/edge-runtime/edge-runtime.d.ts +2 -0
  14. package/types/functions/evaluate/edge-runtime/index.d.ts +1 -0
  15. package/types/functions/evaluate/helpers.d.ts +1 -1
  16. package/types/functions/evaluate/placeholder-runtime.d.ts +2 -0
  17. package/types/functions/fetch-builder-props.d.ts +2 -1
  18. package/types/functions/get-content/index.d.ts +4 -5
  19. package/types/functions/is-edge-runtime.d.ts +4 -0
  20. package/types/src/components/blocks/deopt.d.ts +4 -0
  21. package/types/src/constants/sdk-version.d.ts +1 -1
  22. package/types/src/functions/deopt.d.ts +4 -0
  23. package/types/src/functions/evaluate/edge-runtime/edge-runtime.d.ts +2 -0
  24. package/types/src/functions/evaluate/edge-runtime/index.d.ts +1 -0
  25. package/types/src/functions/evaluate/non-node-runtime/index.d.ts +1 -1
  26. package/types/src/functions/fetch-builder-props.d.ts +2 -1
  27. package/types/src/functions/get-content/index.d.ts +4 -5
  28. package/types/src/functions/is-edge-runtime.d.ts +4 -0
  29. package/types/src/index-helpers/blocks-exports.d.ts +2 -2
  30. package/types/functions/evaluate/types.d.ts +0 -11
  31. package/types/functions/if-target.d.ts +0 -7
  32. package/types/src/functions/evaluate/node-runtime/node-runtime.d.ts +0 -2
  33. package/types/src/functions/evaluate/types.d.ts +0 -11
  34. package/types/src/functions/if-target.d.ts +0 -7
  35. /package/types/functions/evaluate/{acorn-interpreter.d.ts → edge-runtime/acorn-interpreter.d.ts} +0 -0
  36. /package/types/src/functions/evaluate/{acorn-interpreter.d.ts → edge-runtime/acorn-interpreter.d.ts} +0 -0
@@ -0,0 +1,4270 @@
1
+ import { componentQrl, inlinedQrl, useStylesScopedQrl, _jsxC, _jsxS, _fnSignal, createContextId, _jsxQ, _jsxBranch, useStore, useComputedQrl, useLexicalScope, _IMMUTABLE, Slot, useContextProvider, _wrapProp, useContext, createElement, Fragment as Fragment$1, useSignal, useTaskQrl, useVisibleTaskQrl } from "@builder.io/qwik";
2
+ import { Fragment } from "@builder.io/qwik/jsx-runtime";
3
+ const Button = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
4
+ useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$3, "Button_component_useStylesScoped_a1JZ0Q0Q2Oc"));
5
+ return /* @__PURE__ */ _jsxC(Fragment, {
6
+ children: props.link ? /* @__PURE__ */ _jsxS("a", {
7
+ ...props.attributes,
8
+ children: _fnSignal((p0) => p0.text, [
9
+ props
10
+ ], "p0.text")
11
+ }, {
12
+ href: _fnSignal((p0) => p0.link, [
13
+ props
14
+ ], "p0.link"),
15
+ role: "button",
16
+ target: _fnSignal((p0) => p0.openLinkInNewTab ? "_blank" : void 0, [
17
+ props
18
+ ], 'p0.openLinkInNewTab?"_blank":undefined')
19
+ }, 0, "jc_0") : /* @__PURE__ */ _jsxS("button", {
20
+ ...props.attributes,
21
+ children: _fnSignal((p0) => p0.text, [
22
+ props
23
+ ], "p0.text")
24
+ }, {
25
+ class: _fnSignal((p0) => p0.attributes.class + " button-Button", [
26
+ props
27
+ ], 'p0.attributes.class+" button-Button"'),
28
+ style: _fnSignal((p0) => p0.attributes.style, [
29
+ props
30
+ ], "p0.attributes.style")
31
+ }, 0, null)
32
+ }, 1, "jc_1");
33
+ }, "Button_component_gJoMUICXoUQ"));
34
+ const STYLES$3 = `
35
+ .button-Button {
36
+ all: unset;
37
+ }
38
+ `;
39
+ const builderContext = createContextId("Builder");
40
+ const ComponentsContext = createContextId("Components");
41
+ function getBlockComponentOptions(block) {
42
+ var _a;
43
+ return {
44
+ ...(_a = block.component) == null ? void 0 : _a.options,
45
+ ...block.options,
46
+ /**
47
+ * Our built-in components frequently make use of the block, so we provide all of it under `builderBlock`
48
+ */
49
+ builderBlock: block
50
+ };
51
+ }
52
+ const MSG_PREFIX = "[Builder.io]: ";
53
+ const logger = {
54
+ log: (...message) => console.log(MSG_PREFIX, ...message),
55
+ error: (...message) => console.error(MSG_PREFIX, ...message),
56
+ warn: (...message) => console.warn(MSG_PREFIX, ...message),
57
+ debug: (...message) => console.debug(MSG_PREFIX, ...message)
58
+ };
59
+ function isBrowser() {
60
+ return typeof window !== "undefined" && typeof document !== "undefined";
61
+ }
62
+ const TARGET = "qwik";
63
+ function isIframe() {
64
+ return isBrowser() && window.self !== window.top;
65
+ }
66
+ function isEditing() {
67
+ return isIframe() && window.location.search.indexOf("builder.frameEditing=") !== -1;
68
+ }
69
+ const getLocation = () => {
70
+ if (isBrowser()) {
71
+ const parsedLocation = new URL(location.href);
72
+ if (parsedLocation.pathname === "")
73
+ parsedLocation.pathname = "/";
74
+ return parsedLocation;
75
+ } else {
76
+ console.warn("Cannot get location for tracking in non-browser environment");
77
+ return null;
78
+ }
79
+ };
80
+ const getUserAgent = () => typeof navigator === "object" && navigator.userAgent || "";
81
+ const getUserAttributes = () => {
82
+ const userAgent = getUserAgent();
83
+ const isMobile = {
84
+ Android() {
85
+ return userAgent.match(/Android/i);
86
+ },
87
+ BlackBerry() {
88
+ return userAgent.match(/BlackBerry/i);
89
+ },
90
+ iOS() {
91
+ return userAgent.match(/iPhone|iPod/i);
92
+ },
93
+ Opera() {
94
+ return userAgent.match(/Opera Mini/i);
95
+ },
96
+ Windows() {
97
+ return userAgent.match(/IEMobile/i) || userAgent.match(/WPDesktop/i);
98
+ },
99
+ any() {
100
+ return isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows() || TARGET === "reactNative";
101
+ }
102
+ };
103
+ const isTablet = userAgent.match(/Tablet|iPad/i);
104
+ const url = getLocation();
105
+ return {
106
+ urlPath: url == null ? void 0 : url.pathname,
107
+ host: (url == null ? void 0 : url.host) || (url == null ? void 0 : url.hostname),
108
+ device: isTablet ? "tablet" : isMobile.any() ? "mobile" : "desktop"
109
+ };
110
+ };
111
+ const getFunctionArguments = ({ builder, context, event, state }) => {
112
+ return Object.entries({
113
+ state,
114
+ Builder: builder,
115
+ // legacy
116
+ builder,
117
+ context,
118
+ event
119
+ });
120
+ };
121
+ const runInBrowser = ({ code, builder, context, event, localState, rootSetState, rootState }) => {
122
+ const functionArgs = getFunctionArguments({
123
+ builder,
124
+ context,
125
+ event,
126
+ state: flattenState(rootState, localState, rootSetState)
127
+ });
128
+ return new Function(...functionArgs.map(([name]) => name), code)(...functionArgs.map(([, value]) => value));
129
+ };
130
+ function flattenState(rootState, localState, rootSetState) {
131
+ if (rootState === localState)
132
+ throw new Error("rootState === localState");
133
+ return new Proxy(rootState, {
134
+ get: (_, prop) => {
135
+ if (localState && prop in localState)
136
+ return localState[prop];
137
+ return rootState[prop];
138
+ },
139
+ set: (_, prop, value) => {
140
+ if (localState && prop in localState)
141
+ throw new Error("Writing to local state is not allowed as it is read-only.");
142
+ rootState[prop] = value;
143
+ rootSetState == null ? void 0 : rootSetState(rootState);
144
+ return true;
145
+ }
146
+ });
147
+ }
148
+ function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression = true }) {
149
+ if (code === "") {
150
+ logger.warn("Skipping evaluation of empty code block.");
151
+ return;
152
+ }
153
+ const builder = {
154
+ isEditing: isEditing(),
155
+ isBrowser: isBrowser(),
156
+ isServer: !isBrowser(),
157
+ getUserAttributes: () => getUserAttributes()
158
+ };
159
+ const useReturn = (
160
+ // we disable this for cases where we definitely don't want a return
161
+ isExpression && !(code.includes(";") || code.includes(" return ") || code.trim().startsWith("return "))
162
+ );
163
+ const useCode = useReturn ? `return (${code});` : code;
164
+ const args = {
165
+ code: useCode,
166
+ builder,
167
+ context,
168
+ event,
169
+ rootSetState,
170
+ rootState,
171
+ localState
172
+ };
173
+ try {
174
+ return runInBrowser(args);
175
+ } catch (e) {
176
+ logger.error("Failed code evaluation: " + e.message, {
177
+ code
178
+ });
179
+ return void 0;
180
+ }
181
+ }
182
+ const fastClone = (obj) => JSON.parse(JSON.stringify(obj));
183
+ const set = (obj, _path, value) => {
184
+ if (Object(obj) !== obj)
185
+ return obj;
186
+ const path = Array.isArray(_path) ? _path : _path.toString().match(/[^.[\]]+/g);
187
+ path.slice(0, -1).reduce((a, c, i) => Object(a[c]) === a[c] ? a[c] : a[c] = Math.abs(Number(path[i + 1])) >> 0 === +path[i + 1] ? [] : {}, obj)[path[path.length - 1]] = value;
188
+ return obj;
189
+ };
190
+ function transformBlock(block) {
191
+ return block;
192
+ }
193
+ const evaluateBindings = ({ block, context, localState, rootState, rootSetState }) => {
194
+ if (!block.bindings)
195
+ return block;
196
+ const copy = fastClone(block);
197
+ const copied = {
198
+ ...copy,
199
+ properties: {
200
+ ...copy.properties
201
+ },
202
+ actions: {
203
+ ...copy.actions
204
+ }
205
+ };
206
+ for (const binding in block.bindings) {
207
+ const expression = block.bindings[binding];
208
+ const value = evaluate({
209
+ code: expression,
210
+ localState,
211
+ rootState,
212
+ rootSetState,
213
+ context
214
+ });
215
+ set(copied, binding, value);
216
+ }
217
+ return copied;
218
+ };
219
+ function getProcessedBlock({ block, context, shouldEvaluateBindings, localState, rootState, rootSetState }) {
220
+ const transformedBlock = transformBlock(block);
221
+ if (shouldEvaluateBindings)
222
+ return evaluateBindings({
223
+ block: transformedBlock,
224
+ localState,
225
+ rootState,
226
+ rootSetState,
227
+ context
228
+ });
229
+ else
230
+ return transformedBlock;
231
+ }
232
+ const EMPTY_HTML_ELEMENTS = [
233
+ "area",
234
+ "base",
235
+ "br",
236
+ "col",
237
+ "embed",
238
+ "hr",
239
+ "img",
240
+ "input",
241
+ "keygen",
242
+ "link",
243
+ "meta",
244
+ "param",
245
+ "source",
246
+ "track",
247
+ "wbr"
248
+ ];
249
+ const isEmptyHtmlElement = (tagName) => {
250
+ return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase());
251
+ };
252
+ const getComponent = ({ block, context, registeredComponents }) => {
253
+ var _a;
254
+ const componentName = (_a = getProcessedBlock({
255
+ block,
256
+ localState: context.localState,
257
+ rootState: context.rootState,
258
+ rootSetState: context.rootSetState,
259
+ context: context.context,
260
+ shouldEvaluateBindings: false
261
+ }).component) == null ? void 0 : _a.name;
262
+ if (!componentName)
263
+ return null;
264
+ const ref = registeredComponents[componentName];
265
+ if (!ref) {
266
+ console.warn(`
267
+ Could not find a registered component named "${componentName}".
268
+ If you registered it, is the file that registered it imported by the file that needs to render it?`);
269
+ return void 0;
270
+ } else
271
+ return ref;
272
+ };
273
+ const getRepeatItemData = ({ block, context }) => {
274
+ const { repeat, ...blockWithoutRepeat } = block;
275
+ if (!(repeat == null ? void 0 : repeat.collection))
276
+ return void 0;
277
+ const itemsArray = evaluate({
278
+ code: repeat.collection,
279
+ localState: context.localState,
280
+ rootState: context.rootState,
281
+ rootSetState: context.rootSetState,
282
+ context: context.context
283
+ });
284
+ if (!Array.isArray(itemsArray))
285
+ return void 0;
286
+ const collectionName = repeat.collection.split(".").pop();
287
+ const itemNameToUse = repeat.itemName || (collectionName ? collectionName + "Item" : "item");
288
+ const repeatArray = itemsArray.map((item, index) => ({
289
+ context: {
290
+ ...context,
291
+ localState: {
292
+ ...context.localState,
293
+ $index: index,
294
+ $item: item,
295
+ [itemNameToUse]: item,
296
+ [`$${itemNameToUse}Index`]: index
297
+ }
298
+ },
299
+ block: blockWithoutRepeat
300
+ }));
301
+ return repeatArray;
302
+ };
303
+ const SIZES = {
304
+ small: {
305
+ min: 320,
306
+ default: 321,
307
+ max: 640
308
+ },
309
+ medium: {
310
+ min: 641,
311
+ default: 642,
312
+ max: 991
313
+ },
314
+ large: {
315
+ min: 990,
316
+ default: 991,
317
+ max: 1200
318
+ }
319
+ };
320
+ const getMaxWidthQueryForSize = (size, sizeValues = SIZES) => `@media (max-width: ${sizeValues[size].max}px)`;
321
+ const getSizesForBreakpoints = ({ small, medium }) => {
322
+ const newSizes = fastClone(SIZES);
323
+ if (!small || !medium)
324
+ return newSizes;
325
+ const smallMin = Math.floor(small / 2);
326
+ newSizes.small = {
327
+ max: small,
328
+ min: smallMin,
329
+ default: smallMin + 1
330
+ };
331
+ const mediumMin = newSizes.small.max + 1;
332
+ newSizes.medium = {
333
+ max: medium,
334
+ min: mediumMin,
335
+ default: mediumMin + 1
336
+ };
337
+ const largeMin = newSizes.medium.max + 1;
338
+ newSizes.large = {
339
+ max: 2e3,
340
+ // TODO: decide upper limit
341
+ min: largeMin,
342
+ default: largeMin + 1
343
+ };
344
+ return newSizes;
345
+ };
346
+ const camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
347
+ const checkIsDefined = (maybeT) => maybeT !== null && maybeT !== void 0;
348
+ const convertStyleMapToCSSArray = (style) => {
349
+ const cssProps = Object.entries(style).map(([key, value]) => {
350
+ if (typeof value === "string")
351
+ return `${camelToKebabCase(key)}: ${value};`;
352
+ else
353
+ return void 0;
354
+ });
355
+ return cssProps.filter(checkIsDefined);
356
+ };
357
+ const convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
358
+ const createCssClass = ({ mediaQuery, className, styles }) => {
359
+ const cssClass = `.${className} {
360
+ ${convertStyleMapToCSS(styles)}
361
+ }`;
362
+ if (mediaQuery)
363
+ return `${mediaQuery} {
364
+ ${cssClass}
365
+ }`;
366
+ else
367
+ return cssClass;
368
+ };
369
+ const InlinedStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
370
+ return /* @__PURE__ */ _jsxQ("style", null, {
371
+ dangerouslySetInnerHTML: _fnSignal((p0) => p0.styles, [
372
+ props
373
+ ], "p0.styles"),
374
+ id: _fnSignal((p0) => p0.id, [
375
+ props
376
+ ], "p0.id")
377
+ }, null, 3, "NG_0");
378
+ }, "InlinedStyles_component_IOsg46hMexk"));
379
+ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
380
+ _jsxBranch();
381
+ const state = useStore({
382
+ processedBlock: getProcessedBlock({
383
+ block: props.block,
384
+ localState: props.context.localState,
385
+ rootState: props.context.rootState,
386
+ rootSetState: props.context.rootSetState,
387
+ context: props.context.context,
388
+ shouldEvaluateBindings: true
389
+ })
390
+ });
391
+ const canShowBlock = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
392
+ const [state2] = useLexicalScope();
393
+ if (checkIsDefined(state2.processedBlock.hide))
394
+ return !state2.processedBlock.hide;
395
+ if (checkIsDefined(state2.processedBlock.show))
396
+ return state2.processedBlock.show;
397
+ return true;
398
+ }, "BlockStyles_component_canShowBlock_useComputed_YHoS9Lak9z4", [
399
+ state
400
+ ]));
401
+ const css = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
402
+ var _a;
403
+ const [props2, state2] = useLexicalScope();
404
+ const styles = state2.processedBlock.responsiveStyles;
405
+ const content = props2.context.content;
406
+ const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(((_a = content == null ? void 0 : content.meta) == null ? void 0 : _a.breakpoints) || {});
407
+ const largeStyles = styles == null ? void 0 : styles.large;
408
+ const mediumStyles = styles == null ? void 0 : styles.medium;
409
+ const smallStyles = styles == null ? void 0 : styles.small;
410
+ const className = state2.processedBlock.id;
411
+ if (!className)
412
+ return "";
413
+ const largeStylesClass = largeStyles ? createCssClass({
414
+ className,
415
+ styles: largeStyles
416
+ }) : "";
417
+ const mediumStylesClass = mediumStyles ? createCssClass({
418
+ className,
419
+ styles: mediumStyles,
420
+ mediaQuery: getMaxWidthQueryForSize("medium", sizesWithUpdatedBreakpoints)
421
+ }) : "";
422
+ const smallStylesClass = smallStyles ? createCssClass({
423
+ className,
424
+ styles: smallStyles,
425
+ mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
426
+ }) : "";
427
+ return [
428
+ largeStylesClass,
429
+ mediumStylesClass,
430
+ smallStylesClass
431
+ ].join(" ");
432
+ }, "BlockStyles_component_css_useComputed_b9Ru8qTcNik", [
433
+ props,
434
+ state
435
+ ]));
436
+ return /* @__PURE__ */ _jsxC(Fragment, {
437
+ children: css.value && canShowBlock.value ? /* @__PURE__ */ _jsxC(InlinedStyles, {
438
+ get styles() {
439
+ return css.value;
440
+ },
441
+ [_IMMUTABLE]: {
442
+ styles: _fnSignal((p0) => p0.value, [
443
+ css
444
+ ], "p0.value")
445
+ }
446
+ }, 3, "8B_0") : null
447
+ }, 1, "8B_1");
448
+ }, "BlockStyles_component_0lZeirBI638"));
449
+ function capitalizeFirstLetter(string) {
450
+ return string.charAt(0).toUpperCase() + string.slice(1);
451
+ }
452
+ const getEventHandlerName = (key) => `on${capitalizeFirstLetter(key)}$`;
453
+ function createEventHandler(value, options) {
454
+ return /* @__PURE__ */ inlinedQrl((event) => {
455
+ const [options2, value2] = useLexicalScope();
456
+ return evaluate({
457
+ code: value2,
458
+ context: options2.context,
459
+ localState: options2.localState,
460
+ rootState: options2.rootState,
461
+ rootSetState: options2.rootSetState,
462
+ event
463
+ });
464
+ }, "createEventHandler_7wCAiJVliNE", [
465
+ options,
466
+ value
467
+ ]);
468
+ }
469
+ function getBlockActions(options) {
470
+ const obj = {};
471
+ const optionActions = options.block.actions ?? {};
472
+ for (const key in optionActions) {
473
+ if (!optionActions.hasOwnProperty(key))
474
+ continue;
475
+ const value = optionActions[key];
476
+ let eventHandlerName = getEventHandlerName(key);
477
+ if (options.stripPrefix)
478
+ switch (TARGET) {
479
+ case "vue2":
480
+ case "vue3":
481
+ eventHandlerName = eventHandlerName.replace("v-on:", "");
482
+ break;
483
+ case "svelte":
484
+ eventHandlerName = eventHandlerName.replace("on:", "");
485
+ break;
486
+ }
487
+ obj[eventHandlerName] = createEventHandler(value, options);
488
+ }
489
+ return obj;
490
+ }
491
+ function transformBlockProperties(properties) {
492
+ return properties;
493
+ }
494
+ const extractRelevantRootBlockProperties = (block) => {
495
+ return {
496
+ href: block.href
497
+ };
498
+ };
499
+ function getBlockProperties({ block, context }) {
500
+ var _a;
501
+ const properties = {
502
+ ...extractRelevantRootBlockProperties(block),
503
+ ...block.properties,
504
+ "builder-id": block.id,
505
+ style: block.style ? getStyleAttribute(block.style) : void 0,
506
+ class: [
507
+ block.id,
508
+ "builder-block",
509
+ block.class,
510
+ (_a = block.properties) == null ? void 0 : _a.class
511
+ ].filter(Boolean).join(" ")
512
+ };
513
+ return transformBlockProperties(properties);
514
+ }
515
+ function getStyleAttribute(style) {
516
+ switch (TARGET) {
517
+ case "svelte":
518
+ case "vue2":
519
+ case "vue3":
520
+ case "solid":
521
+ return convertStyleMapToCSSArray(style).join(" ");
522
+ case "qwik":
523
+ case "reactNative":
524
+ case "react":
525
+ case "rsc":
526
+ return style;
527
+ }
528
+ }
529
+ const BlockWrapper = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
530
+ _jsxBranch();
531
+ return /* @__PURE__ */ _jsxC(Fragment, {
532
+ children: props.hasChildren ? /* @__PURE__ */ _jsxC(props.Wrapper, {
533
+ ...getBlockProperties({
534
+ block: props.block,
535
+ context: props.context
536
+ }),
537
+ ...getBlockActions({
538
+ block: props.block,
539
+ rootState: props.context.rootState,
540
+ rootSetState: props.context.rootSetState,
541
+ localState: props.context.localState,
542
+ context: props.context.context,
543
+ stripPrefix: true
544
+ }),
545
+ children: /* @__PURE__ */ _jsxC(Slot, null, 3, "87_0")
546
+ }, 0, "87_1") : /* @__PURE__ */ _jsxC(props.Wrapper, {
547
+ ...getBlockProperties({
548
+ block: props.block,
549
+ context: props.context
550
+ }),
551
+ ...getBlockActions({
552
+ block: props.block,
553
+ rootState: props.context.rootState,
554
+ rootSetState: props.context.rootSetState,
555
+ localState: props.context.localState,
556
+ context: props.context.context,
557
+ stripPrefix: true
558
+ })
559
+ }, 0, "87_2")
560
+ }, 1, "87_3");
561
+ }, "BlockWrapper_component_kOI0j0aW8Nw"));
562
+ const InteractiveElement = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
563
+ return /* @__PURE__ */ _jsxC(props.Wrapper, {
564
+ ...props.wrapperProps,
565
+ attributes: {
566
+ ...getBlockProperties({
567
+ block: props.block,
568
+ context: props.context
569
+ }),
570
+ ...getBlockActions({
571
+ block: props.block,
572
+ rootState: props.context.rootState,
573
+ rootSetState: props.context.rootSetState,
574
+ localState: props.context.localState,
575
+ context: props.context.context
576
+ })
577
+ },
578
+ children: /* @__PURE__ */ _jsxC(Slot, null, 3, "q0_0")
579
+ }, 0, "q0_1");
580
+ }, "InteractiveElement_component_0UqfJpjhn0g"));
581
+ const getWrapperProps = ({ componentOptions, builderBlock, context, componentRef, includeBlockProps, isInteractive, contextValue }) => {
582
+ const interactiveElementProps = {
583
+ Wrapper: componentRef,
584
+ block: builderBlock,
585
+ context,
586
+ wrapperProps: componentOptions
587
+ };
588
+ return isInteractive ? interactiveElementProps : {
589
+ ...componentOptions,
590
+ /**
591
+ * If `noWrap` is set to `true`, then the block's props/attributes are provided to the
592
+ * component itself directly. Otherwise, they are provided to the wrapper element.
593
+ */
594
+ ...includeBlockProps ? {
595
+ attributes: getBlockProperties({
596
+ block: builderBlock,
597
+ context: contextValue
598
+ })
599
+ } : {}
600
+ };
601
+ };
602
+ const ComponentRef = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
603
+ const state = useStore({
604
+ Wrapper: props.isInteractive ? InteractiveElement : props.componentRef
605
+ });
606
+ return /* @__PURE__ */ _jsxC(Fragment, {
607
+ children: props.componentRef ? /* @__PURE__ */ _jsxC(state.Wrapper, {
608
+ ...getWrapperProps({
609
+ componentOptions: props.componentOptions,
610
+ builderBlock: props.builderBlock,
611
+ context: props.context,
612
+ componentRef: props.componentRef,
613
+ includeBlockProps: props.includeBlockProps,
614
+ isInteractive: props.isInteractive,
615
+ contextValue: props.context
616
+ }),
617
+ children: [
618
+ (props.blockChildren || []).map((child) => {
619
+ return /* @__PURE__ */ _jsxC(Block, {
620
+ block: child,
621
+ get context() {
622
+ return props.context;
623
+ },
624
+ get registeredComponents() {
625
+ return props.registeredComponents;
626
+ },
627
+ [_IMMUTABLE]: {
628
+ context: _fnSignal((p0) => p0.context, [
629
+ props
630
+ ], "p0.context"),
631
+ registeredComponents: _fnSignal((p0) => p0.registeredComponents, [
632
+ props
633
+ ], "p0.registeredComponents")
634
+ }
635
+ }, 3, "block-" + child.id);
636
+ }),
637
+ (props.blockChildren || []).map((child) => {
638
+ return /* @__PURE__ */ _jsxC(BlockStyles, {
639
+ block: child,
640
+ get context() {
641
+ return props.context;
642
+ },
643
+ [_IMMUTABLE]: {
644
+ context: _fnSignal((p0) => p0.context, [
645
+ props
646
+ ], "p0.context")
647
+ }
648
+ }, 3, "block-style-" + child.id);
649
+ })
650
+ ]
651
+ }, 0, "z6_0") : null
652
+ }, 1, "z6_1");
653
+ }, "ComponentRef_component_tFQoBV6UFdc"));
654
+ const RepeatedBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
655
+ const state = useStore({
656
+ store: props.repeatContext
657
+ });
658
+ useContextProvider(builderContext, state.store);
659
+ return /* @__PURE__ */ _jsxC(Block, {
660
+ get block() {
661
+ return props.block;
662
+ },
663
+ get context() {
664
+ return state.store;
665
+ },
666
+ get registeredComponents() {
667
+ return props.registeredComponents;
668
+ },
669
+ [_IMMUTABLE]: {
670
+ block: _fnSignal((p0) => p0.block, [
671
+ props
672
+ ], "p0.block"),
673
+ context: _fnSignal((p0) => p0.store, [
674
+ state
675
+ ], "p0.store"),
676
+ registeredComponents: _fnSignal((p0) => p0.registeredComponents, [
677
+ props
678
+ ], "p0.registeredComponents")
679
+ }
680
+ }, 3, "GO_0");
681
+ }, "RepeatedBlock_component_JK1l2jKcfwA"));
682
+ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
683
+ var _a;
684
+ _jsxBranch();
685
+ const state = useStore({
686
+ childrenContext: props.context
687
+ });
688
+ const blockComponent = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
689
+ const [props2] = useLexicalScope();
690
+ return getComponent({
691
+ block: props2.block,
692
+ context: props2.context,
693
+ registeredComponents: props2.registeredComponents
694
+ });
695
+ }, "Block_component_blockComponent_useComputed_83sGy9Xlsi0", [
696
+ props
697
+ ]));
698
+ const repeatItem = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
699
+ const [props2] = useLexicalScope();
700
+ return getRepeatItemData({
701
+ block: props2.block,
702
+ context: props2.context
703
+ });
704
+ }, "Block_component_repeatItem_useComputed_j31Y3wFqSCM", [
705
+ props
706
+ ]));
707
+ const processedBlock = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
708
+ const [props2, repeatItem2] = useLexicalScope();
709
+ return repeatItem2.value ? props2.block : getProcessedBlock({
710
+ block: props2.block,
711
+ localState: props2.context.localState,
712
+ rootState: props2.context.rootState,
713
+ rootSetState: props2.context.rootSetState,
714
+ context: props2.context.context,
715
+ shouldEvaluateBindings: true
716
+ });
717
+ }, "Block_component_processedBlock_useComputed_ESKw0l5FcBc", [
718
+ props,
719
+ repeatItem
720
+ ]));
721
+ const Tag = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
722
+ const [props2] = useLexicalScope();
723
+ return props2.block.tagName || "div";
724
+ }, "Block_component_Tag_useComputed_eQnDgbcBW2A", [
725
+ props
726
+ ]));
727
+ const canShowBlock = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
728
+ const [processedBlock2] = useLexicalScope();
729
+ if ("hide" in processedBlock2.value)
730
+ return !processedBlock2.value.hide;
731
+ if ("show" in processedBlock2.value)
732
+ return processedBlock2.value.show;
733
+ return true;
734
+ }, "Block_component_canShowBlock_useComputed_NJEFz8ICF08", [
735
+ processedBlock
736
+ ]));
737
+ const childrenWithoutParentComponent = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
738
+ var _a2;
739
+ const [blockComponent2, processedBlock2, repeatItem2] = useLexicalScope();
740
+ const shouldRenderChildrenOutsideRef = !((_a2 = blockComponent2.value) == null ? void 0 : _a2.component) && !repeatItem2.value;
741
+ return shouldRenderChildrenOutsideRef ? processedBlock2.value.children ?? [] : [];
742
+ }, "Block_component_childrenWithoutParentComponent_useComputed_0WENYGElWnc", [
743
+ blockComponent,
744
+ processedBlock,
745
+ repeatItem
746
+ ]));
747
+ const componentRefProps = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
748
+ var _a2, _b, _c, _d, _e;
749
+ const [blockComponent2, processedBlock2, props2, state2] = useLexicalScope();
750
+ return {
751
+ blockChildren: processedBlock2.value.children ?? [],
752
+ componentRef: (_a2 = blockComponent2.value) == null ? void 0 : _a2.component,
753
+ componentOptions: {
754
+ ...getBlockComponentOptions(processedBlock2.value),
755
+ builderContext: props2.context,
756
+ ...((_b = blockComponent2.value) == null ? void 0 : _b.name) === "Symbol" || ((_c = blockComponent2.value) == null ? void 0 : _c.name) === "Columns" ? {
757
+ builderComponents: props2.registeredComponents
758
+ } : {}
759
+ },
760
+ context: state2.childrenContext,
761
+ registeredComponents: props2.registeredComponents,
762
+ builderBlock: processedBlock2.value,
763
+ includeBlockProps: ((_d = blockComponent2.value) == null ? void 0 : _d.noWrap) === true,
764
+ isInteractive: !((_e = blockComponent2.value) == null ? void 0 : _e.isRSC)
765
+ };
766
+ }, "Block_component_componentRefProps_useComputed_Ikbl8VO04ho", [
767
+ blockComponent,
768
+ processedBlock,
769
+ props,
770
+ state
771
+ ]));
772
+ return /* @__PURE__ */ _jsxC(Fragment, {
773
+ children: canShowBlock.value ? !((_a = blockComponent.value) == null ? void 0 : _a.noWrap) ? /* @__PURE__ */ _jsxC(Fragment, {
774
+ children: [
775
+ isEmptyHtmlElement(Tag.value) ? /* @__PURE__ */ _jsxC(BlockWrapper, {
776
+ get Wrapper() {
777
+ return Tag.value;
778
+ },
779
+ get block() {
780
+ return processedBlock.value;
781
+ },
782
+ get context() {
783
+ return props.context;
784
+ },
785
+ hasChildren: false,
786
+ [_IMMUTABLE]: {
787
+ Wrapper: _fnSignal((p0) => p0.value, [
788
+ Tag
789
+ ], "p0.value"),
790
+ block: _fnSignal((p0) => p0.value, [
791
+ processedBlock
792
+ ], "p0.value"),
793
+ context: _fnSignal((p0) => p0.context, [
794
+ props
795
+ ], "p0.context"),
796
+ hasChildren: _IMMUTABLE
797
+ }
798
+ }, 3, "jN_0") : null,
799
+ !isEmptyHtmlElement(Tag.value) && repeatItem.value ? (repeatItem.value || []).map((data, index) => {
800
+ return /* @__PURE__ */ _jsxC(RepeatedBlock, {
801
+ get repeatContext() {
802
+ return data.context;
803
+ },
804
+ get block() {
805
+ return data.block;
806
+ },
807
+ get registeredComponents() {
808
+ return props.registeredComponents;
809
+ },
810
+ [_IMMUTABLE]: {
811
+ block: _wrapProp(data, "block"),
812
+ registeredComponents: _fnSignal((p0) => p0.registeredComponents, [
813
+ props
814
+ ], "p0.registeredComponents"),
815
+ repeatContext: _wrapProp(data, "context")
816
+ }
817
+ }, 3, index);
818
+ }) : null,
819
+ !isEmptyHtmlElement(Tag.value) && !repeatItem.value ? /* @__PURE__ */ _jsxC(BlockWrapper, {
820
+ get Wrapper() {
821
+ return Tag.value;
822
+ },
823
+ get block() {
824
+ return processedBlock.value;
825
+ },
826
+ get context() {
827
+ return props.context;
828
+ },
829
+ children: [
830
+ /* @__PURE__ */ _jsxC(ComponentRef, {
831
+ ...componentRefProps.value
832
+ }, 0, "jN_1"),
833
+ (childrenWithoutParentComponent.value || []).map((child) => {
834
+ return /* @__PURE__ */ _jsxC(Block, {
835
+ block: child,
836
+ get context() {
837
+ return state.childrenContext;
838
+ },
839
+ get registeredComponents() {
840
+ return props.registeredComponents;
841
+ },
842
+ [_IMMUTABLE]: {
843
+ context: _fnSignal((p0) => p0.childrenContext, [
844
+ state
845
+ ], "p0.childrenContext"),
846
+ registeredComponents: _fnSignal((p0) => p0.registeredComponents, [
847
+ props
848
+ ], "p0.registeredComponents")
849
+ }
850
+ }, 3, "block-" + child.id);
851
+ }),
852
+ (childrenWithoutParentComponent.value || []).map((child) => {
853
+ return /* @__PURE__ */ _jsxC(BlockStyles, {
854
+ block: child,
855
+ get context() {
856
+ return state.childrenContext;
857
+ },
858
+ [_IMMUTABLE]: {
859
+ context: _fnSignal((p0) => p0.childrenContext, [
860
+ state
861
+ ], "p0.childrenContext")
862
+ }
863
+ }, 3, "block-style-" + child.id);
864
+ })
865
+ ],
866
+ hasChildren: true,
867
+ [_IMMUTABLE]: {
868
+ Wrapper: _fnSignal((p0) => p0.value, [
869
+ Tag
870
+ ], "p0.value"),
871
+ block: _fnSignal((p0) => p0.value, [
872
+ processedBlock
873
+ ], "p0.value"),
874
+ context: _fnSignal((p0) => p0.context, [
875
+ props
876
+ ], "p0.context"),
877
+ hasChildren: _IMMUTABLE
878
+ }
879
+ }, 1, "jN_2") : null
880
+ ]
881
+ }, 1, "jN_3") : /* @__PURE__ */ _jsxC(ComponentRef, {
882
+ ...componentRefProps.value
883
+ }, 0, "jN_4") : null
884
+ }, 1, "jN_5");
885
+ }, "Block_component_nnPv0RY0U0k"));
886
+ const onClick$1 = function onClick2(props, state) {
887
+ var _a, _b;
888
+ if (isEditing() && !((_a = props.blocks) == null ? void 0 : _a.length))
889
+ (_b = window.parent) == null ? void 0 : _b.postMessage({
890
+ type: "builder.clickEmptyBlocks",
891
+ data: {
892
+ parentElementId: props.parent,
893
+ dataPath: props.path
894
+ }
895
+ }, "*");
896
+ };
897
+ const onMouseEnter = function onMouseEnter2(props, state) {
898
+ var _a, _b;
899
+ if (isEditing() && !((_a = props.blocks) == null ? void 0 : _a.length))
900
+ (_b = window.parent) == null ? void 0 : _b.postMessage({
901
+ type: "builder.hoverEmptyBlocks",
902
+ data: {
903
+ parentElementId: props.parent,
904
+ dataPath: props.path
905
+ }
906
+ }, "*");
907
+ };
908
+ const BlocksWrapper = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
909
+ useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$2, "BlocksWrapper_component_useStylesScoped_Kj0S9AOXQ0o"));
910
+ const className = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
911
+ var _a;
912
+ const [props2] = useLexicalScope();
913
+ return "builder-blocks" + (!((_a = props2.blocks) == null ? void 0 : _a.length) ? " no-blocks" : "");
914
+ }, "BlocksWrapper_component_className_useComputed_J5SSSH2Xf08", [
915
+ props
916
+ ]));
917
+ const state = {};
918
+ return /* @__PURE__ */ _jsxQ("div", {
919
+ onClick$: /* @__PURE__ */ inlinedQrl((event) => {
920
+ const [props2, state2] = useLexicalScope();
921
+ return onClick$1(props2);
922
+ }, "BlocksWrapper_component_div_onClick_1NkidSBS3D0", [
923
+ props,
924
+ state
925
+ ]),
926
+ onKeyPress$: /* @__PURE__ */ inlinedQrl((event) => {
927
+ const [props2, state2] = useLexicalScope();
928
+ return onClick$1(props2);
929
+ }, "BlocksWrapper_component_div_onKeyPress_Aaf0oNYOi80", [
930
+ props,
931
+ state
932
+ ]),
933
+ onMouseEnter$: /* @__PURE__ */ inlinedQrl((event) => {
934
+ const [props2, state2] = useLexicalScope();
935
+ return onMouseEnter(props2);
936
+ }, "BlocksWrapper_component_div_onMouseEnter_TxzAP5tI9Zc", [
937
+ props,
938
+ state
939
+ ])
940
+ }, {
941
+ "builder-parent-id": _fnSignal((p0) => p0.parent, [
942
+ props
943
+ ], "p0.parent"),
944
+ "builder-path": _fnSignal((p0) => p0.path, [
945
+ props
946
+ ], "p0.path"),
947
+ class: _fnSignal((p0) => p0.value + " div-BlocksWrapper", [
948
+ className
949
+ ], 'p0.value+" div-BlocksWrapper"'),
950
+ style: _fnSignal((p0) => p0.styleProp, [
951
+ props
952
+ ], "p0.styleProp")
953
+ }, /* @__PURE__ */ _jsxC(Slot, null, 3, "3u_0"), 0, "3u_1");
954
+ }, "BlocksWrapper_component_45hR0o6abzg"));
955
+ const STYLES$2 = `
956
+ .div-BlocksWrapper {
957
+ display: flex;
958
+ flex-direction: column;
959
+ align-items: stretch;
960
+ }
961
+ `;
962
+ const Blocks = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
963
+ const builderContext$1 = useContext(builderContext);
964
+ const componentsContext = useContext(ComponentsContext);
965
+ return /* @__PURE__ */ _jsxC(BlocksWrapper, {
966
+ get blocks() {
967
+ return props.blocks;
968
+ },
969
+ get parent() {
970
+ return props.parent;
971
+ },
972
+ get path() {
973
+ return props.path;
974
+ },
975
+ get styleProp() {
976
+ return props.styleProp;
977
+ },
978
+ children: [
979
+ props.blocks ? (props.blocks || []).map((block) => {
980
+ return /* @__PURE__ */ _jsxC(Block, {
981
+ block,
982
+ get context() {
983
+ return props.context || builderContext$1;
984
+ },
985
+ get registeredComponents() {
986
+ return props.registeredComponents || componentsContext.registeredComponents;
987
+ },
988
+ [_IMMUTABLE]: {
989
+ context: _fnSignal((p0, p1) => p1.context || p0, [
990
+ builderContext$1,
991
+ props
992
+ ], "p1.context||p0"),
993
+ registeredComponents: _fnSignal((p0, p1) => p1.registeredComponents || p0.registeredComponents, [
994
+ componentsContext,
995
+ props
996
+ ], "p1.registeredComponents||p0.registeredComponents")
997
+ }
998
+ }, 3, "render-block-" + block.id);
999
+ }) : null,
1000
+ props.blocks ? (props.blocks || []).map((block) => {
1001
+ return /* @__PURE__ */ _jsxC(BlockStyles, {
1002
+ block,
1003
+ get context() {
1004
+ return props.context || builderContext$1;
1005
+ },
1006
+ [_IMMUTABLE]: {
1007
+ context: _fnSignal((p0, p1) => p1.context || p0, [
1008
+ builderContext$1,
1009
+ props
1010
+ ], "p1.context||p0")
1011
+ }
1012
+ }, 3, "block-style-" + block.id);
1013
+ }) : null
1014
+ ],
1015
+ [_IMMUTABLE]: {
1016
+ blocks: _fnSignal((p0) => p0.blocks, [
1017
+ props
1018
+ ], "p0.blocks"),
1019
+ parent: _fnSignal((p0) => p0.parent, [
1020
+ props
1021
+ ], "p0.parent"),
1022
+ path: _fnSignal((p0) => p0.path, [
1023
+ props
1024
+ ], "p0.path"),
1025
+ styleProp: _fnSignal((p0) => p0.styleProp, [
1026
+ props
1027
+ ], "p0.styleProp")
1028
+ }
1029
+ }, 1, "0n_0");
1030
+ }, "Blocks_component_PI1ErWPzPEg"));
1031
+ function deoptSignal(value) {
1032
+ return value;
1033
+ }
1034
+ const getWidth = function getWidth2(props, state, index) {
1035
+ var _a;
1036
+ return ((_a = state.cols[index]) == null ? void 0 : _a.width) || 100 / state.cols.length;
1037
+ };
1038
+ const getColumnCssWidth = function getColumnCssWidth2(props, state, index) {
1039
+ const subtractWidth = state.gutterSize * (state.cols.length - 1) / state.cols.length;
1040
+ return `calc(${getWidth(props, state, index)}% - ${subtractWidth}px)`;
1041
+ };
1042
+ const getTabletStyle = function getTabletStyle2(props, state, { stackedStyle, desktopStyle }) {
1043
+ return state.stackAt === "tablet" ? stackedStyle : desktopStyle;
1044
+ };
1045
+ const getMobileStyle = function getMobileStyle2(props, state, { stackedStyle, desktopStyle }) {
1046
+ return state.stackAt === "never" ? desktopStyle : stackedStyle;
1047
+ };
1048
+ const columnCssVars = function columnCssVars2(props, state, index) {
1049
+ const gutter = index === 0 ? 0 : state.gutterSize;
1050
+ const width = getColumnCssWidth(props, state, index);
1051
+ const gutterPixels = `${gutter}px`;
1052
+ const mobileWidth = "100%";
1053
+ const mobileMarginLeft = 0;
1054
+ const marginLeftKey = "margin-left";
1055
+ return {
1056
+ width,
1057
+ [marginLeftKey]: gutterPixels,
1058
+ "--column-width-mobile": getMobileStyle(props, state, {
1059
+ stackedStyle: mobileWidth,
1060
+ desktopStyle: width
1061
+ }),
1062
+ "--column-margin-left-mobile": getMobileStyle(props, state, {
1063
+ stackedStyle: mobileMarginLeft,
1064
+ desktopStyle: gutterPixels
1065
+ }),
1066
+ "--column-width-tablet": getTabletStyle(props, state, {
1067
+ stackedStyle: mobileWidth,
1068
+ desktopStyle: width
1069
+ }),
1070
+ "--column-margin-left-tablet": getTabletStyle(props, state, {
1071
+ stackedStyle: mobileMarginLeft,
1072
+ desktopStyle: gutterPixels
1073
+ })
1074
+ };
1075
+ };
1076
+ const getWidthForBreakpointSize = function getWidthForBreakpointSize2(props, state, size) {
1077
+ var _a, _b;
1078
+ const breakpointSizes = getSizesForBreakpoints(((_b = (_a = props.builderContext.content) == null ? void 0 : _a.meta) == null ? void 0 : _b.breakpoints) || {});
1079
+ return breakpointSizes[size].max;
1080
+ };
1081
+ const Columns = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
1082
+ _jsxBranch();
1083
+ const state = useStore({
1084
+ cols: props.columns || [],
1085
+ flexDir: props.stackColumnsAt === "never" ? "row" : props.reverseColumnsWhenStacked ? "column-reverse" : "column",
1086
+ gutterSize: typeof props.space === "number" ? props.space || 0 : 20,
1087
+ stackAt: props.stackColumnsAt || "tablet"
1088
+ });
1089
+ useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$1, "Columns_component_useStylesScoped_s7JLZz7MCCQ"));
1090
+ const columnsCssVars = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
1091
+ const [props2, state2] = useLexicalScope();
1092
+ return {
1093
+ "--flex-dir": state2.flexDir,
1094
+ "--flex-dir-tablet": getTabletStyle(props2, state2, {
1095
+ stackedStyle: state2.flexDir,
1096
+ desktopStyle: "row"
1097
+ })
1098
+ };
1099
+ }, "Columns_component_columnsCssVars_useComputed_adFEq2RWT9s", [
1100
+ props,
1101
+ state
1102
+ ]));
1103
+ const columnsStyles = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
1104
+ const [props2, state2] = useLexicalScope();
1105
+ return `
1106
+ @media (max-width: ${getWidthForBreakpointSize(props2, state2, "medium")}px) {
1107
+ .${props2.builderBlock.id}-breakpoints {
1108
+ flex-direction: var(--flex-dir-tablet);
1109
+ align-items: stretch;
1110
+ }
1111
+
1112
+ .${props2.builderBlock.id}-breakpoints > .builder-column {
1113
+ width: var(--column-width-tablet) !important;
1114
+ margin-left: var(--column-margin-left-tablet) !important;
1115
+ }
1116
+ }
1117
+
1118
+ @media (max-width: ${getWidthForBreakpointSize(props2, state2, "small")}px) {
1119
+ .${props2.builderBlock.id}-breakpoints {
1120
+ flex-direction: var(--flex-dir);
1121
+ align-items: stretch;
1122
+ }
1123
+
1124
+ .${props2.builderBlock.id}-breakpoints > .builder-column {
1125
+ width: var(--column-width-mobile) !important;
1126
+ margin-left: var(--column-margin-left-mobile) !important;
1127
+ }
1128
+ },
1129
+ `;
1130
+ }, "Columns_component_columnsStyles_useComputed_nBtMPbzd1Wc", [
1131
+ props,
1132
+ state
1133
+ ]));
1134
+ return /* @__PURE__ */ _jsxQ("div", null, {
1135
+ class: _fnSignal((p0) => `builder-columns ${p0.builderBlock.id}-breakpoints div-Columns`, [
1136
+ props
1137
+ ], '`builder-columns ${p0.builderBlock.id}-breakpoints`+" div-Columns"'),
1138
+ style: _fnSignal((p0) => p0.value, [
1139
+ columnsCssVars
1140
+ ], "p0.value")
1141
+ }, [
1142
+ /* @__PURE__ */ _jsxC(InlinedStyles, {
1143
+ get styles() {
1144
+ return columnsStyles.value;
1145
+ },
1146
+ [_IMMUTABLE]: {
1147
+ styles: _fnSignal((p0) => p0.value, [
1148
+ columnsStyles
1149
+ ], "p0.value")
1150
+ }
1151
+ }, 3, "c0_0"),
1152
+ (props.columns || []).map((column, index) => {
1153
+ return /* @__PURE__ */ createElement("div", {
1154
+ class: "builder-column div-Columns-2",
1155
+ style: columnCssVars(props, state, index),
1156
+ key: index
1157
+ }, /* @__PURE__ */ _jsxC(Blocks, {
1158
+ path: `component.options.columns.${index}.blocks`,
1159
+ get parent() {
1160
+ return props.builderBlock.id;
1161
+ },
1162
+ get styleProp() {
1163
+ return {
1164
+ flexGrow: "1"
1165
+ };
1166
+ },
1167
+ get context() {
1168
+ return props.builderContext;
1169
+ },
1170
+ get registeredComponents() {
1171
+ return props.builderComponents;
1172
+ },
1173
+ blocks: deoptSignal(column.blocks),
1174
+ [_IMMUTABLE]: {
1175
+ context: _fnSignal((p0) => p0.builderContext, [
1176
+ props
1177
+ ], "p0.builderContext"),
1178
+ parent: _fnSignal((p0) => p0.builderBlock.id, [
1179
+ props
1180
+ ], "p0.builderBlock.id"),
1181
+ registeredComponents: _fnSignal((p0) => p0.builderComponents, [
1182
+ props
1183
+ ], "p0.builderComponents"),
1184
+ styleProp: _IMMUTABLE
1185
+ }
1186
+ }, 3, "c0_1"));
1187
+ })
1188
+ ], 1, "c0_2");
1189
+ }, "Columns_component_7yLj4bxdI6c"));
1190
+ const STYLES$1 = `
1191
+ .div-Columns {
1192
+ display: flex;
1193
+ line-height: normal;
1194
+ }
1195
+ .div-Columns-2 {
1196
+ display: flex;
1197
+ flex-direction: column;
1198
+ align-items: stretch;
1199
+ }
1200
+ `;
1201
+ const FragmentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
1202
+ return /* @__PURE__ */ _jsxQ("span", null, null, /* @__PURE__ */ _jsxC(Slot, null, 3, "oj_0"), 1, "oj_1");
1203
+ }, "FragmentComponent_component_T0AypnadAK0"));
1204
+ function removeProtocol(path) {
1205
+ return path.replace(/http(s)?:/, "");
1206
+ }
1207
+ function updateQueryParam(uri = "", key, value) {
1208
+ const re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
1209
+ const separator = uri.indexOf("?") !== -1 ? "&" : "?";
1210
+ if (uri.match(re))
1211
+ return uri.replace(re, "$1" + key + "=" + encodeURIComponent(value) + "$2");
1212
+ return uri + separator + key + "=" + encodeURIComponent(value);
1213
+ }
1214
+ function getShopifyImageUrl(src, size) {
1215
+ if (!src || !(src == null ? void 0 : src.match(/cdn\.shopify\.com/)) || !size)
1216
+ return src;
1217
+ if (size === "master")
1218
+ return removeProtocol(src);
1219
+ const match = src.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);
1220
+ if (match) {
1221
+ const prefix = src.split(match[0]);
1222
+ const suffix = match[3];
1223
+ const useSize = size.match("x") ? size : `${size}x`;
1224
+ return removeProtocol(`${prefix[0]}_${useSize}${suffix}`);
1225
+ }
1226
+ return null;
1227
+ }
1228
+ function getSrcSet(url) {
1229
+ if (!url)
1230
+ return url;
1231
+ const sizes = [
1232
+ 100,
1233
+ 200,
1234
+ 400,
1235
+ 800,
1236
+ 1200,
1237
+ 1600,
1238
+ 2e3
1239
+ ];
1240
+ if (url.match(/builder\.io/)) {
1241
+ let srcUrl = url;
1242
+ const widthInSrc = Number(url.split("?width=")[1]);
1243
+ if (!isNaN(widthInSrc))
1244
+ srcUrl = `${srcUrl} ${widthInSrc}w`;
1245
+ return sizes.filter((size) => size !== widthInSrc).map((size) => `${updateQueryParam(url, "width", size)} ${size}w`).concat([
1246
+ srcUrl
1247
+ ]).join(", ");
1248
+ }
1249
+ if (url.match(/cdn\.shopify\.com/))
1250
+ return sizes.map((size) => [
1251
+ getShopifyImageUrl(url, `${size}x${size}`),
1252
+ size
1253
+ ]).filter(([sizeUrl]) => !!sizeUrl).map(([sizeUrl, size]) => `${sizeUrl} ${size}w`).concat([
1254
+ url
1255
+ ]).join(", ");
1256
+ return url;
1257
+ }
1258
+ const Image = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
1259
+ var _a, _b, _c, _d;
1260
+ _jsxBranch();
1261
+ useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES, "Image_component_useStylesScoped_fBMYiVf9fuU"));
1262
+ const srcSetToUse = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
1263
+ var _a2;
1264
+ const [props2] = useLexicalScope();
1265
+ const imageToUse = props2.image || props2.src;
1266
+ const url = imageToUse;
1267
+ if (!url || // We can auto add srcset for cdn.builder.io and shopify
1268
+ // images, otherwise you can supply this prop manually
1269
+ !(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/)))
1270
+ return props2.srcset;
1271
+ if (props2.srcset && ((_a2 = props2.image) == null ? void 0 : _a2.includes("builder.io/api/v1/image"))) {
1272
+ if (!props2.srcset.includes(props2.image.split("?")[0])) {
1273
+ console.debug("Removed given srcset");
1274
+ return getSrcSet(url);
1275
+ }
1276
+ } else if (props2.image && !props2.srcset)
1277
+ return getSrcSet(url);
1278
+ return getSrcSet(url);
1279
+ }, "Image_component_srcSetToUse_useComputed_TZMibf9Gpvw", [
1280
+ props
1281
+ ]));
1282
+ const webpSrcSet = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
1283
+ var _a2;
1284
+ const [props2, srcSetToUse2] = useLexicalScope();
1285
+ if (((_a2 = srcSetToUse2.value) == null ? void 0 : _a2.match(/builder\.io/)) && !props2.noWebp)
1286
+ return srcSetToUse2.value.replace(/\?/g, "?format=webp&");
1287
+ else
1288
+ return "";
1289
+ }, "Image_component_webpSrcSet_useComputed_01YCu72BBtA", [
1290
+ props,
1291
+ srcSetToUse
1292
+ ]));
1293
+ const aspectRatioCss = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
1294
+ const [props2] = useLexicalScope();
1295
+ const aspectRatioStyles = {
1296
+ position: "absolute",
1297
+ height: "100%",
1298
+ width: "100%",
1299
+ left: "0px",
1300
+ top: "0px"
1301
+ };
1302
+ const out = props2.aspectRatio ? aspectRatioStyles : void 0;
1303
+ return out;
1304
+ }, "Image_component_aspectRatioCss_useComputed_yJ1jG0g5fbw", [
1305
+ props
1306
+ ]));
1307
+ return /* @__PURE__ */ _jsxC(Fragment$1, {
1308
+ children: [
1309
+ /* @__PURE__ */ _jsxQ("picture", null, null, [
1310
+ webpSrcSet.value ? /* @__PURE__ */ _jsxQ("source", null, {
1311
+ srcSet: _fnSignal((p0) => p0.value, [
1312
+ webpSrcSet
1313
+ ], "p0.value"),
1314
+ type: "image/webp"
1315
+ }, null, 3, "0A_0") : null,
1316
+ /* @__PURE__ */ _jsxQ("img", null, {
1317
+ alt: _fnSignal((p0) => p0.altText, [
1318
+ props
1319
+ ], "p0.altText"),
1320
+ class: _fnSignal((p0) => "builder-image" + (p0.className ? " " + p0.className : "") + " img-Image", [
1321
+ props
1322
+ ], '"builder-image"+(p0.className?" "+p0.className:"")+" img-Image"'),
1323
+ loading: "lazy",
1324
+ role: _fnSignal((p0) => p0.altText ? "presentation" : void 0, [
1325
+ props
1326
+ ], 'p0.altText?"presentation":undefined'),
1327
+ sizes: _fnSignal((p0) => p0.sizes, [
1328
+ props
1329
+ ], "p0.sizes"),
1330
+ src: _fnSignal((p0) => p0.image, [
1331
+ props
1332
+ ], "p0.image"),
1333
+ srcSet: _fnSignal((p0) => p0.value, [
1334
+ srcSetToUse
1335
+ ], "p0.value"),
1336
+ style: _fnSignal((p0, p1) => ({
1337
+ objectPosition: p1.backgroundPosition || "center",
1338
+ objectFit: p1.backgroundSize || "cover",
1339
+ ...p0.value
1340
+ }), [
1341
+ aspectRatioCss,
1342
+ props
1343
+ ], '{objectPosition:p1.backgroundPosition||"center",objectFit:p1.backgroundSize||"cover",...p0.value}')
1344
+ }, null, 3, null)
1345
+ ], 1, null),
1346
+ props.aspectRatio && !(((_b = (_a = props.builderBlock) == null ? void 0 : _a.children) == null ? void 0 : _b.length) && props.fitContent) ? /* @__PURE__ */ _jsxQ("div", null, {
1347
+ class: "builder-image-sizer div-Image",
1348
+ style: _fnSignal((p0) => ({
1349
+ paddingTop: p0.aspectRatio * 100 + "%"
1350
+ }), [
1351
+ props
1352
+ ], '{paddingTop:p0.aspectRatio*100+"%"}')
1353
+ }, null, 3, "0A_1") : null,
1354
+ ((_d = (_c = props.builderBlock) == null ? void 0 : _c.children) == null ? void 0 : _d.length) && props.fitContent ? /* @__PURE__ */ _jsxC(Slot, null, 3, "0A_2") : null,
1355
+ !props.fitContent && props.children ? /* @__PURE__ */ _jsxQ("div", null, {
1356
+ class: "div-Image-2"
1357
+ }, /* @__PURE__ */ _jsxC(Slot, null, 3, "0A_3"), 1, "0A_4") : null
1358
+ ]
1359
+ }, 1, "0A_5");
1360
+ }, "Image_component_LRxDkFa1EfU"));
1361
+ const STYLES = `
1362
+ .img-Image {
1363
+ opacity: 1;
1364
+ transition: opacity 0.2s ease-in-out;
1365
+ }
1366
+ .div-Image {
1367
+ width: 100%;
1368
+ pointer-events: none;
1369
+ font-size: 0;
1370
+ }
1371
+ .div-Image-2 {
1372
+ display: flex;
1373
+ flex-direction: column;
1374
+ align-items: stretch;
1375
+ position: absolute;
1376
+ top: 0;
1377
+ left: 0;
1378
+ width: 100%;
1379
+ height: 100%;
1380
+ }
1381
+ `;
1382
+ const SectionComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
1383
+ return /* @__PURE__ */ _jsxS("section", {
1384
+ ...props.attributes,
1385
+ children: /* @__PURE__ */ _jsxC(Slot, null, 3, "2Y_0"),
1386
+ style: {
1387
+ width: "100%",
1388
+ alignSelf: "stretch",
1389
+ flexGrow: 1,
1390
+ boxSizing: "border-box",
1391
+ maxWidth: props.maxWidth || 1200,
1392
+ display: "flex",
1393
+ flexDirection: "column",
1394
+ alignItems: "stretch",
1395
+ marginLeft: "auto",
1396
+ marginRight: "auto"
1397
+ }
1398
+ }, null, 0, "2Y_1");
1399
+ }, "SectionComponent_component_ZWF9iD5WeLg"));
1400
+ const getTopLevelDomain = (host) => {
1401
+ if (host === "localhost" || host === "127.0.0.1")
1402
+ return host;
1403
+ const parts = host.split(".");
1404
+ if (parts.length > 2)
1405
+ return parts.slice(1).join(".");
1406
+ return host;
1407
+ };
1408
+ const getCookieSync = ({ name, canTrack }) => {
1409
+ var _a;
1410
+ try {
1411
+ if (!canTrack)
1412
+ return void 0;
1413
+ return (_a = document.cookie.split("; ").find((row) => row.startsWith(`${name}=`))) == null ? void 0 : _a.split("=")[1];
1414
+ } catch (err) {
1415
+ logger.warn("[COOKIE] GET error: ", (err == null ? void 0 : err.message) || err);
1416
+ return void 0;
1417
+ }
1418
+ };
1419
+ const getCookie = async (args) => getCookieSync(args);
1420
+ const stringifyCookie = (cookie) => cookie.map(([key, value]) => value ? `${key}=${value}` : key).filter(checkIsDefined).join("; ");
1421
+ const SECURE_CONFIG = [
1422
+ [
1423
+ "secure",
1424
+ ""
1425
+ ],
1426
+ [
1427
+ "SameSite",
1428
+ "None"
1429
+ ]
1430
+ ];
1431
+ const createCookieString = ({ name, value, expires }) => {
1432
+ const secure = isBrowser() ? location.protocol === "https:" : true;
1433
+ const secureObj = secure ? SECURE_CONFIG : [
1434
+ []
1435
+ ];
1436
+ const expiresObj = expires ? [
1437
+ [
1438
+ "expires",
1439
+ expires.toUTCString()
1440
+ ]
1441
+ ] : [
1442
+ []
1443
+ ];
1444
+ const cookieValue = [
1445
+ [
1446
+ name,
1447
+ value
1448
+ ],
1449
+ ...expiresObj,
1450
+ [
1451
+ "path",
1452
+ "/"
1453
+ ],
1454
+ [
1455
+ "domain",
1456
+ getTopLevelDomain(window.location.hostname)
1457
+ ],
1458
+ ...secureObj
1459
+ ];
1460
+ const cookie = stringifyCookie(cookieValue);
1461
+ return cookie;
1462
+ };
1463
+ const setCookie = async ({ name, value, expires, canTrack }) => {
1464
+ try {
1465
+ if (!canTrack)
1466
+ return;
1467
+ const cookie = createCookieString({
1468
+ name,
1469
+ value,
1470
+ expires
1471
+ });
1472
+ document.cookie = cookie;
1473
+ } catch (err) {
1474
+ logger.warn("[COOKIE] SET error: ", (err == null ? void 0 : err.message) || err);
1475
+ }
1476
+ };
1477
+ const BUILDER_STORE_PREFIX = "builder.tests";
1478
+ const getContentTestKey = (id) => `${BUILDER_STORE_PREFIX}.${id}`;
1479
+ const getContentVariationCookie = ({ contentId }) => getCookie({
1480
+ name: getContentTestKey(contentId),
1481
+ canTrack: true
1482
+ });
1483
+ const getContentVariationCookieSync = ({ contentId }) => getCookieSync({
1484
+ name: getContentTestKey(contentId),
1485
+ canTrack: true
1486
+ });
1487
+ const setContentVariationCookie = ({ contentId, value }) => setCookie({
1488
+ name: getContentTestKey(contentId),
1489
+ value,
1490
+ canTrack: true
1491
+ });
1492
+ const checkIsBuilderContentWithVariations = (item) => checkIsDefined(item.id) && checkIsDefined(item.variations) && Object.keys(item.variations).length > 0;
1493
+ const getRandomVariationId = ({ id, variations }) => {
1494
+ var _a;
1495
+ let n = 0;
1496
+ const random = Math.random();
1497
+ for (const id2 in variations) {
1498
+ const testRatio = (_a = variations[id2]) == null ? void 0 : _a.testRatio;
1499
+ n += testRatio;
1500
+ if (random < n)
1501
+ return id2;
1502
+ }
1503
+ return id;
1504
+ };
1505
+ const getAndSetVariantId = (args) => {
1506
+ const randomVariationId = getRandomVariationId(args);
1507
+ setContentVariationCookie({
1508
+ contentId: args.id,
1509
+ value: randomVariationId
1510
+ }).catch((err) => {
1511
+ logger.error("could not store A/B test variation: ", err);
1512
+ });
1513
+ return randomVariationId;
1514
+ };
1515
+ const getTestFields = ({ item, testGroupId }) => {
1516
+ const variationValue = item.variations[testGroupId];
1517
+ if (testGroupId === item.id || // handle edge-case where `testGroupId` points to non-existing variation
1518
+ !variationValue)
1519
+ return {
1520
+ testVariationId: item.id,
1521
+ testVariationName: "Default"
1522
+ };
1523
+ else
1524
+ return {
1525
+ data: variationValue.data,
1526
+ testVariationId: variationValue.id,
1527
+ testVariationName: variationValue.name || (variationValue.id === item.id ? "Default" : "")
1528
+ };
1529
+ };
1530
+ const handleABTestingSync = ({ item, canTrack }) => {
1531
+ if (!canTrack)
1532
+ return item;
1533
+ if (!item)
1534
+ return void 0;
1535
+ if (!checkIsBuilderContentWithVariations(item))
1536
+ return item;
1537
+ const testGroupId = getContentVariationCookieSync({
1538
+ contentId: item.id
1539
+ }) || getAndSetVariantId({
1540
+ variations: item.variations,
1541
+ id: item.id
1542
+ });
1543
+ const variationValue = getTestFields({
1544
+ item,
1545
+ testGroupId
1546
+ });
1547
+ return {
1548
+ ...item,
1549
+ ...variationValue
1550
+ };
1551
+ };
1552
+ const handleABTesting = async ({ item, canTrack }) => {
1553
+ if (!canTrack)
1554
+ return item;
1555
+ if (!checkIsBuilderContentWithVariations(item))
1556
+ return item;
1557
+ const cookieValue = await getContentVariationCookie({
1558
+ contentId: item.id
1559
+ });
1560
+ const testGroupId = cookieValue || getAndSetVariantId({
1561
+ variations: item.variations,
1562
+ id: item.id
1563
+ });
1564
+ const variationValue = getTestFields({
1565
+ item,
1566
+ testGroupId
1567
+ });
1568
+ return {
1569
+ ...item,
1570
+ ...variationValue
1571
+ };
1572
+ };
1573
+ const getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
1574
+ const componentInfo$a = {
1575
+ name: "Core:Button",
1576
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
1577
+ defaultStyles: {
1578
+ // TODO: make min width more intuitive and set one
1579
+ appearance: "none",
1580
+ paddingTop: "15px",
1581
+ paddingBottom: "15px",
1582
+ paddingLeft: "25px",
1583
+ paddingRight: "25px",
1584
+ backgroundColor: "#000000",
1585
+ color: "white",
1586
+ borderRadius: "4px",
1587
+ textAlign: "center",
1588
+ cursor: "pointer"
1589
+ },
1590
+ inputs: [
1591
+ {
1592
+ name: "text",
1593
+ type: "text",
1594
+ defaultValue: "Click me!",
1595
+ bubble: true
1596
+ },
1597
+ {
1598
+ name: "link",
1599
+ type: "url",
1600
+ bubble: true
1601
+ },
1602
+ {
1603
+ name: "openLinkInNewTab",
1604
+ type: "boolean",
1605
+ defaultValue: false,
1606
+ friendlyName: "Open link in new tab"
1607
+ }
1608
+ ],
1609
+ static: true,
1610
+ noWrap: true
1611
+ };
1612
+ const componentInfo$9 = {
1613
+ // TODO: ways to statically preprocess JSON for references, functions, etc
1614
+ name: "Columns",
1615
+ isRSC: true,
1616
+ inputs: [
1617
+ {
1618
+ name: "columns",
1619
+ type: "array",
1620
+ broadcast: true,
1621
+ subFields: [
1622
+ {
1623
+ name: "blocks",
1624
+ type: "array",
1625
+ hideFromUI: true,
1626
+ defaultValue: [
1627
+ {
1628
+ "@type": "@builder.io/sdk:Element",
1629
+ responsiveStyles: {
1630
+ large: {
1631
+ display: "flex",
1632
+ flexDirection: "column",
1633
+ alignItems: "stretch",
1634
+ flexShrink: "0",
1635
+ position: "relative",
1636
+ marginTop: "30px",
1637
+ textAlign: "center",
1638
+ lineHeight: "normal",
1639
+ height: "auto",
1640
+ minHeight: "20px",
1641
+ minWidth: "20px",
1642
+ overflow: "hidden"
1643
+ }
1644
+ },
1645
+ component: {
1646
+ name: "Image",
1647
+ options: {
1648
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
1649
+ backgroundPosition: "center",
1650
+ backgroundSize: "cover",
1651
+ aspectRatio: 0.7004048582995948
1652
+ }
1653
+ }
1654
+ },
1655
+ {
1656
+ "@type": "@builder.io/sdk:Element",
1657
+ responsiveStyles: {
1658
+ large: {
1659
+ display: "flex",
1660
+ flexDirection: "column",
1661
+ alignItems: "stretch",
1662
+ flexShrink: "0",
1663
+ position: "relative",
1664
+ marginTop: "30px",
1665
+ textAlign: "center",
1666
+ lineHeight: "normal",
1667
+ height: "auto"
1668
+ }
1669
+ },
1670
+ component: {
1671
+ name: "Text",
1672
+ options: {
1673
+ text: "<p>Enter some text...</p>"
1674
+ }
1675
+ }
1676
+ }
1677
+ ]
1678
+ },
1679
+ {
1680
+ name: "width",
1681
+ type: "number",
1682
+ hideFromUI: true,
1683
+ helperText: "Width %, e.g. set to 50 to fill half of the space"
1684
+ },
1685
+ {
1686
+ name: "link",
1687
+ type: "url",
1688
+ helperText: "Optionally set a url that clicking this column will link to"
1689
+ }
1690
+ ],
1691
+ defaultValue: [
1692
+ {
1693
+ blocks: [
1694
+ {
1695
+ "@type": "@builder.io/sdk:Element",
1696
+ responsiveStyles: {
1697
+ large: {
1698
+ display: "flex",
1699
+ flexDirection: "column",
1700
+ alignItems: "stretch",
1701
+ flexShrink: "0",
1702
+ position: "relative",
1703
+ marginTop: "30px",
1704
+ textAlign: "center",
1705
+ lineHeight: "normal",
1706
+ height: "auto",
1707
+ minHeight: "20px",
1708
+ minWidth: "20px",
1709
+ overflow: "hidden"
1710
+ }
1711
+ },
1712
+ component: {
1713
+ name: "Image",
1714
+ options: {
1715
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
1716
+ backgroundPosition: "center",
1717
+ backgroundSize: "cover",
1718
+ aspectRatio: 0.7004048582995948
1719
+ }
1720
+ }
1721
+ },
1722
+ {
1723
+ "@type": "@builder.io/sdk:Element",
1724
+ responsiveStyles: {
1725
+ large: {
1726
+ display: "flex",
1727
+ flexDirection: "column",
1728
+ alignItems: "stretch",
1729
+ flexShrink: "0",
1730
+ position: "relative",
1731
+ marginTop: "30px",
1732
+ textAlign: "center",
1733
+ lineHeight: "normal",
1734
+ height: "auto"
1735
+ }
1736
+ },
1737
+ component: {
1738
+ name: "Text",
1739
+ options: {
1740
+ text: "<p>Enter some text...</p>"
1741
+ }
1742
+ }
1743
+ }
1744
+ ]
1745
+ },
1746
+ {
1747
+ blocks: [
1748
+ {
1749
+ "@type": "@builder.io/sdk:Element",
1750
+ responsiveStyles: {
1751
+ large: {
1752
+ display: "flex",
1753
+ flexDirection: "column",
1754
+ alignItems: "stretch",
1755
+ flexShrink: "0",
1756
+ position: "relative",
1757
+ marginTop: "30px",
1758
+ textAlign: "center",
1759
+ lineHeight: "normal",
1760
+ height: "auto",
1761
+ minHeight: "20px",
1762
+ minWidth: "20px",
1763
+ overflow: "hidden"
1764
+ }
1765
+ },
1766
+ component: {
1767
+ name: "Image",
1768
+ options: {
1769
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
1770
+ backgroundPosition: "center",
1771
+ backgroundSize: "cover",
1772
+ aspectRatio: 0.7004048582995948
1773
+ }
1774
+ }
1775
+ },
1776
+ {
1777
+ "@type": "@builder.io/sdk:Element",
1778
+ responsiveStyles: {
1779
+ large: {
1780
+ display: "flex",
1781
+ flexDirection: "column",
1782
+ alignItems: "stretch",
1783
+ flexShrink: "0",
1784
+ position: "relative",
1785
+ marginTop: "30px",
1786
+ textAlign: "center",
1787
+ lineHeight: "normal",
1788
+ height: "auto"
1789
+ }
1790
+ },
1791
+ component: {
1792
+ name: "Text",
1793
+ options: {
1794
+ text: "<p>Enter some text...</p>"
1795
+ }
1796
+ }
1797
+ }
1798
+ ]
1799
+ }
1800
+ ],
1801
+ onChange: (options) => {
1802
+ function clearWidths() {
1803
+ columns.forEach((col) => {
1804
+ col.delete("width");
1805
+ });
1806
+ }
1807
+ const columns = options.get("columns");
1808
+ if (Array.isArray(columns)) {
1809
+ const containsColumnWithWidth = !!columns.find((col) => col.get("width"));
1810
+ if (containsColumnWithWidth) {
1811
+ const containsColumnWithoutWidth = !!columns.find((col) => !col.get("width"));
1812
+ if (containsColumnWithoutWidth)
1813
+ clearWidths();
1814
+ else {
1815
+ const sumWidths = columns.reduce((memo, col) => {
1816
+ return memo + col.get("width");
1817
+ }, 0);
1818
+ const widthsDontAddUp = sumWidths !== 100;
1819
+ if (widthsDontAddUp)
1820
+ clearWidths();
1821
+ }
1822
+ }
1823
+ }
1824
+ }
1825
+ },
1826
+ {
1827
+ name: "space",
1828
+ type: "number",
1829
+ defaultValue: 20,
1830
+ helperText: "Size of gap between columns",
1831
+ advanced: true
1832
+ },
1833
+ {
1834
+ name: "stackColumnsAt",
1835
+ type: "string",
1836
+ defaultValue: "tablet",
1837
+ helperText: "Convert horizontal columns to vertical at what device size",
1838
+ enum: [
1839
+ "tablet",
1840
+ "mobile",
1841
+ "never"
1842
+ ],
1843
+ advanced: true
1844
+ },
1845
+ {
1846
+ name: "reverseColumnsWhenStacked",
1847
+ type: "boolean",
1848
+ defaultValue: false,
1849
+ helperText: "When stacking columns for mobile devices, reverse the ordering",
1850
+ advanced: true
1851
+ }
1852
+ ]
1853
+ };
1854
+ const componentInfo$8 = {
1855
+ name: "Fragment",
1856
+ static: true,
1857
+ hidden: true,
1858
+ canHaveChildren: true,
1859
+ noWrap: true
1860
+ };
1861
+ const componentInfo$7 = {
1862
+ name: "Image",
1863
+ static: true,
1864
+ image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",
1865
+ defaultStyles: {
1866
+ position: "relative",
1867
+ minHeight: "20px",
1868
+ minWidth: "20px",
1869
+ overflow: "hidden"
1870
+ },
1871
+ canHaveChildren: true,
1872
+ inputs: [
1873
+ {
1874
+ name: "image",
1875
+ type: "file",
1876
+ bubble: true,
1877
+ allowedFileTypes: [
1878
+ "jpeg",
1879
+ "jpg",
1880
+ "png",
1881
+ "svg"
1882
+ ],
1883
+ required: true,
1884
+ defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
1885
+ onChange: (options) => {
1886
+ const DEFAULT_ASPECT_RATIO = 0.7041;
1887
+ options.delete("srcset");
1888
+ options.delete("noWebp");
1889
+ function loadImage(url, timeout = 6e4) {
1890
+ return new Promise((resolve, reject) => {
1891
+ const img = document.createElement("img");
1892
+ let loaded = false;
1893
+ img.onload = () => {
1894
+ loaded = true;
1895
+ resolve(img);
1896
+ };
1897
+ img.addEventListener("error", (event) => {
1898
+ console.warn("Image load failed", event.error);
1899
+ reject(event.error);
1900
+ });
1901
+ img.src = url;
1902
+ setTimeout(() => {
1903
+ if (!loaded)
1904
+ reject(new Error("Image load timed out"));
1905
+ }, timeout);
1906
+ });
1907
+ }
1908
+ function round2(num) {
1909
+ return Math.round(num * 1e3) / 1e3;
1910
+ }
1911
+ const value = options.get("image");
1912
+ const aspectRatio = options.get("aspectRatio");
1913
+ fetch(value).then((res) => res.blob()).then((blob) => {
1914
+ if (blob.type.includes("svg"))
1915
+ options.set("noWebp", true);
1916
+ });
1917
+ if (value && (!aspectRatio || aspectRatio === DEFAULT_ASPECT_RATIO))
1918
+ return loadImage(value).then((img) => {
1919
+ const possiblyUpdatedAspectRatio = options.get("aspectRatio");
1920
+ if (options.get("image") === value && (!possiblyUpdatedAspectRatio || possiblyUpdatedAspectRatio === DEFAULT_ASPECT_RATIO)) {
1921
+ if (img.width && img.height) {
1922
+ options.set("aspectRatio", round2(img.height / img.width));
1923
+ options.set("height", img.height);
1924
+ options.set("width", img.width);
1925
+ }
1926
+ }
1927
+ });
1928
+ }
1929
+ },
1930
+ {
1931
+ name: "backgroundSize",
1932
+ type: "text",
1933
+ defaultValue: "cover",
1934
+ enum: [
1935
+ {
1936
+ label: "contain",
1937
+ value: "contain",
1938
+ helperText: "The image should never get cropped"
1939
+ },
1940
+ {
1941
+ label: "cover",
1942
+ value: "cover",
1943
+ helperText: "The image should fill it's box, cropping when needed"
1944
+ }
1945
+ ]
1946
+ },
1947
+ {
1948
+ name: "backgroundPosition",
1949
+ type: "text",
1950
+ defaultValue: "center",
1951
+ enum: [
1952
+ "center",
1953
+ "top",
1954
+ "left",
1955
+ "right",
1956
+ "bottom",
1957
+ "top left",
1958
+ "top right",
1959
+ "bottom left",
1960
+ "bottom right"
1961
+ ]
1962
+ },
1963
+ {
1964
+ name: "altText",
1965
+ type: "string",
1966
+ helperText: "Text to display when the user has images off"
1967
+ },
1968
+ {
1969
+ name: "height",
1970
+ type: "number",
1971
+ hideFromUI: true
1972
+ },
1973
+ {
1974
+ name: "width",
1975
+ type: "number",
1976
+ hideFromUI: true
1977
+ },
1978
+ {
1979
+ name: "sizes",
1980
+ type: "string",
1981
+ hideFromUI: true
1982
+ },
1983
+ {
1984
+ name: "srcset",
1985
+ type: "string",
1986
+ hideFromUI: true
1987
+ },
1988
+ {
1989
+ name: "lazy",
1990
+ type: "boolean",
1991
+ defaultValue: true,
1992
+ hideFromUI: true
1993
+ },
1994
+ {
1995
+ name: "fitContent",
1996
+ type: "boolean",
1997
+ helperText: "When child blocks are provided, fit to them instead of using the image's aspect ratio",
1998
+ defaultValue: true
1999
+ },
2000
+ {
2001
+ name: "aspectRatio",
2002
+ type: "number",
2003
+ helperText: "This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",
2004
+ advanced: true,
2005
+ defaultValue: 0.7041
2006
+ }
2007
+ ]
2008
+ };
2009
+ const componentInfo$6 = {
2010
+ name: "Core:Section",
2011
+ static: true,
2012
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
2013
+ inputs: [
2014
+ {
2015
+ name: "maxWidth",
2016
+ type: "number",
2017
+ defaultValue: 1200
2018
+ },
2019
+ {
2020
+ name: "lazyLoad",
2021
+ type: "boolean",
2022
+ defaultValue: false,
2023
+ advanced: true,
2024
+ description: "Only render this section when in view"
2025
+ }
2026
+ ],
2027
+ defaultStyles: {
2028
+ paddingLeft: "20px",
2029
+ paddingRight: "20px",
2030
+ paddingTop: "50px",
2031
+ paddingBottom: "50px",
2032
+ marginTop: "0px",
2033
+ width: "100vw",
2034
+ marginLeft: "calc(50% - 50vw)"
2035
+ },
2036
+ canHaveChildren: true,
2037
+ defaultChildren: [
2038
+ {
2039
+ "@type": "@builder.io/sdk:Element",
2040
+ responsiveStyles: {
2041
+ large: {
2042
+ textAlign: "center"
2043
+ }
2044
+ },
2045
+ component: {
2046
+ name: "Text",
2047
+ options: {
2048
+ text: "<p><b>I am a section! My content keeps from getting too wide, so that it's easy to read even on big screens.</b></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</p>"
2049
+ }
2050
+ }
2051
+ }
2052
+ ]
2053
+ };
2054
+ const componentInfo$5 = {
2055
+ name: "Symbol",
2056
+ noWrap: true,
2057
+ static: true,
2058
+ isRSC: true,
2059
+ inputs: [
2060
+ {
2061
+ name: "symbol",
2062
+ type: "uiSymbol"
2063
+ },
2064
+ {
2065
+ name: "dataOnly",
2066
+ helperText: "Make this a data symbol that doesn't display any UI",
2067
+ type: "boolean",
2068
+ defaultValue: false,
2069
+ advanced: true,
2070
+ hideFromUI: true
2071
+ },
2072
+ {
2073
+ name: "inheritState",
2074
+ helperText: "Inherit the parent component state and data",
2075
+ type: "boolean",
2076
+ defaultValue: false,
2077
+ advanced: true
2078
+ },
2079
+ {
2080
+ name: "renderToLiquid",
2081
+ helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
2082
+ type: "boolean",
2083
+ defaultValue: false,
2084
+ advanced: true,
2085
+ hideFromUI: true
2086
+ },
2087
+ {
2088
+ name: "useChildren",
2089
+ hideFromUI: true,
2090
+ type: "boolean"
2091
+ }
2092
+ ]
2093
+ };
2094
+ const componentInfo$4 = {
2095
+ name: "Text",
2096
+ static: true,
2097
+ isRSC: true,
2098
+ image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",
2099
+ inputs: [
2100
+ {
2101
+ name: "text",
2102
+ type: "html",
2103
+ required: true,
2104
+ autoFocus: true,
2105
+ bubble: true,
2106
+ defaultValue: "Enter some text..."
2107
+ }
2108
+ ],
2109
+ defaultStyles: {
2110
+ lineHeight: "normal",
2111
+ height: "auto",
2112
+ textAlign: "center"
2113
+ }
2114
+ };
2115
+ const Text = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
2116
+ return /* @__PURE__ */ _jsxQ("span", null, {
2117
+ class: "builder-text",
2118
+ dangerouslySetInnerHTML: _fnSignal((p0) => {
2119
+ var _a;
2120
+ return ((_a = p0.text) == null ? void 0 : _a.toString()) || "";
2121
+ }, [
2122
+ props
2123
+ ], 'p0.text?.toString()||""'),
2124
+ style: {
2125
+ outline: "none"
2126
+ }
2127
+ }, null, 3, "yO_0");
2128
+ }, "Text_component_15p0cKUxgIE"));
2129
+ const componentInfo$3 = {
2130
+ name: "Video",
2131
+ canHaveChildren: true,
2132
+ defaultStyles: {
2133
+ minHeight: "20px",
2134
+ minWidth: "20px"
2135
+ },
2136
+ image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-videocam-24px%20(1).svg?alt=media&token=49a84e4a-b20e-4977-a650-047f986874bb",
2137
+ inputs: [
2138
+ {
2139
+ name: "video",
2140
+ type: "file",
2141
+ allowedFileTypes: [
2142
+ "mp4"
2143
+ ],
2144
+ bubble: true,
2145
+ defaultValue: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",
2146
+ required: true
2147
+ },
2148
+ {
2149
+ name: "posterImage",
2150
+ type: "file",
2151
+ allowedFileTypes: [
2152
+ "jpeg",
2153
+ "png"
2154
+ ],
2155
+ helperText: "Image to show before the video plays"
2156
+ },
2157
+ {
2158
+ name: "autoPlay",
2159
+ type: "boolean",
2160
+ defaultValue: true
2161
+ },
2162
+ {
2163
+ name: "controls",
2164
+ type: "boolean",
2165
+ defaultValue: false
2166
+ },
2167
+ {
2168
+ name: "muted",
2169
+ type: "boolean",
2170
+ defaultValue: true
2171
+ },
2172
+ {
2173
+ name: "loop",
2174
+ type: "boolean",
2175
+ defaultValue: true
2176
+ },
2177
+ {
2178
+ name: "playsInline",
2179
+ type: "boolean",
2180
+ defaultValue: true
2181
+ },
2182
+ {
2183
+ name: "fit",
2184
+ type: "text",
2185
+ defaultValue: "cover",
2186
+ enum: [
2187
+ "contain",
2188
+ "cover",
2189
+ "fill",
2190
+ "auto"
2191
+ ]
2192
+ },
2193
+ {
2194
+ name: "preload",
2195
+ type: "text",
2196
+ defaultValue: "metadata",
2197
+ enum: [
2198
+ "auto",
2199
+ "metadata",
2200
+ "none"
2201
+ ]
2202
+ },
2203
+ {
2204
+ name: "fitContent",
2205
+ type: "boolean",
2206
+ helperText: "When child blocks are provided, fit to them instead of using the aspect ratio",
2207
+ defaultValue: true,
2208
+ advanced: true
2209
+ },
2210
+ {
2211
+ name: "position",
2212
+ type: "text",
2213
+ defaultValue: "center",
2214
+ enum: [
2215
+ "center",
2216
+ "top",
2217
+ "left",
2218
+ "right",
2219
+ "bottom",
2220
+ "top left",
2221
+ "top right",
2222
+ "bottom left",
2223
+ "bottom right"
2224
+ ]
2225
+ },
2226
+ {
2227
+ name: "height",
2228
+ type: "number",
2229
+ advanced: true
2230
+ },
2231
+ {
2232
+ name: "width",
2233
+ type: "number",
2234
+ advanced: true
2235
+ },
2236
+ {
2237
+ name: "aspectRatio",
2238
+ type: "number",
2239
+ advanced: true,
2240
+ defaultValue: 0.7004048582995948
2241
+ },
2242
+ {
2243
+ name: "lazyLoad",
2244
+ type: "boolean",
2245
+ helperText: 'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',
2246
+ defaultValue: true,
2247
+ advanced: true
2248
+ }
2249
+ ]
2250
+ };
2251
+ const Video = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
2252
+ const videoProps = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
2253
+ const [props2] = useLexicalScope();
2254
+ return {
2255
+ ...props2.autoPlay === true ? {
2256
+ autoPlay: true
2257
+ } : {},
2258
+ ...props2.muted === true ? {
2259
+ muted: true
2260
+ } : {},
2261
+ ...props2.controls === true ? {
2262
+ controls: true
2263
+ } : {},
2264
+ ...props2.loop === true ? {
2265
+ loop: true
2266
+ } : {},
2267
+ ...props2.playsInline === true ? {
2268
+ playsInline: true
2269
+ } : {}
2270
+ };
2271
+ }, "Video_component_videoProps_useComputed_60AadUGY06E", [
2272
+ props
2273
+ ]));
2274
+ const spreadProps = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
2275
+ const [props2, videoProps2] = useLexicalScope();
2276
+ return {
2277
+ ...props2.attributes,
2278
+ ...videoProps2.value
2279
+ };
2280
+ }, "Video_component_spreadProps_useComputed_ZdLsx18NYH4", [
2281
+ props,
2282
+ videoProps
2283
+ ]));
2284
+ return /* @__PURE__ */ _jsxS("video", {
2285
+ ...spreadProps.value
2286
+ }, {
2287
+ poster: _fnSignal((p0) => p0.posterImage, [
2288
+ props
2289
+ ], "p0.posterImage"),
2290
+ preload: _fnSignal((p0) => p0.preload || "metadata", [
2291
+ props
2292
+ ], 'p0.preload||"metadata"'),
2293
+ src: _fnSignal((p0) => p0.video || "no-src", [
2294
+ props
2295
+ ], 'p0.video||"no-src"'),
2296
+ style: _fnSignal((p0) => {
2297
+ var _a;
2298
+ return {
2299
+ width: "100%",
2300
+ height: "100%",
2301
+ ...(_a = p0.attributes) == null ? void 0 : _a.style,
2302
+ objectFit: p0.fit,
2303
+ objectPosition: p0.position,
2304
+ // Hack to get object fit to work as expected and
2305
+ // not have the video overflow
2306
+ borderRadius: 1
2307
+ };
2308
+ }, [
2309
+ props
2310
+ ], '{width:"100%",height:"100%",...p0.attributes?.style,objectFit:p0.fit,objectPosition:p0.position,borderRadius:1}')
2311
+ }, 0, "j7_0");
2312
+ }, "Video_component_qdcTZflYyoQ"));
2313
+ const componentInfo$2 = {
2314
+ name: "Embed",
2315
+ static: true,
2316
+ inputs: [
2317
+ {
2318
+ name: "url",
2319
+ type: "url",
2320
+ required: true,
2321
+ defaultValue: "",
2322
+ helperText: "e.g. enter a youtube url, google map, etc",
2323
+ onChange: (options) => {
2324
+ const url = options.get("url");
2325
+ if (url) {
2326
+ options.set("content", "Loading...");
2327
+ const apiKey = "ae0e60e78201a3f2b0de4b";
2328
+ return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then((res) => res.json()).then((data) => {
2329
+ if (options.get("url") === url) {
2330
+ if (data.html)
2331
+ options.set("content", data.html);
2332
+ else
2333
+ options.set("content", "Invalid url, please try another");
2334
+ }
2335
+ }).catch((_err) => {
2336
+ options.set("content", "There was an error embedding this URL, please try again or another URL");
2337
+ });
2338
+ } else
2339
+ options.delete("content");
2340
+ }
2341
+ },
2342
+ {
2343
+ name: "content",
2344
+ type: "html",
2345
+ defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
2346
+ hideFromUI: true
2347
+ }
2348
+ ]
2349
+ };
2350
+ const SCRIPT_MIME_TYPES = [
2351
+ "text/javascript",
2352
+ "application/javascript",
2353
+ "application/ecmascript"
2354
+ ];
2355
+ const isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
2356
+ const findAndRunScripts$1 = function findAndRunScripts2(props, state, elem) {
2357
+ if (!elem.value || !elem.value.getElementsByTagName)
2358
+ return;
2359
+ const scripts = elem.value.getElementsByTagName("script");
2360
+ for (let i = 0; i < scripts.length; i++) {
2361
+ const script = scripts[i];
2362
+ if (script.src && !state.scriptsInserted.includes(script.src)) {
2363
+ state.scriptsInserted.push(script.src);
2364
+ const newScript = document.createElement("script");
2365
+ newScript.async = true;
2366
+ newScript.src = script.src;
2367
+ document.head.appendChild(newScript);
2368
+ } else if (isJsScript(script) && !state.scriptsRun.includes(script.innerText))
2369
+ try {
2370
+ state.scriptsRun.push(script.innerText);
2371
+ new Function(script.innerText)();
2372
+ } catch (error) {
2373
+ console.warn("`Embed`: Error running script:", error);
2374
+ }
2375
+ }
2376
+ };
2377
+ const Embed = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
2378
+ const elem = useSignal();
2379
+ const state = useStore({
2380
+ ranInitFn: false,
2381
+ scriptsInserted: [],
2382
+ scriptsRun: []
2383
+ });
2384
+ useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
2385
+ const [elem2, props2, state2] = useLexicalScope();
2386
+ track2(() => elem2.value);
2387
+ track2(() => state2.ranInitFn);
2388
+ if (elem2.value && !state2.ranInitFn) {
2389
+ state2.ranInitFn = true;
2390
+ findAndRunScripts$1(props2, state2, elem2);
2391
+ }
2392
+ }, "Embed_component_useTask_bg7ez0XUtiM", [
2393
+ elem,
2394
+ props,
2395
+ state
2396
+ ]));
2397
+ return /* @__PURE__ */ _jsxQ("div", {
2398
+ ref: elem
2399
+ }, {
2400
+ class: "builder-embed",
2401
+ dangerouslySetInnerHTML: _fnSignal((p0) => p0.content, [
2402
+ props
2403
+ ], "p0.content")
2404
+ }, null, 3, "9r_0");
2405
+ }, "Embed_component_Uji08ORjXbE"));
2406
+ const ImgComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
2407
+ return /* @__PURE__ */ _jsxS("img", {
2408
+ ...props.attributes
2409
+ }, {
2410
+ alt: _fnSignal((p0) => p0.altText, [
2411
+ props
2412
+ ], "p0.altText"),
2413
+ src: _fnSignal((p0) => p0.imgSrc || p0.image, [
2414
+ props
2415
+ ], "p0.imgSrc||p0.image"),
2416
+ style: _fnSignal((p0) => ({
2417
+ objectFit: p0.backgroundSize || "cover",
2418
+ objectPosition: p0.backgroundPosition || "center"
2419
+ }), [
2420
+ props
2421
+ ], '{objectFit:p0.backgroundSize||"cover",objectPosition:p0.backgroundPosition||"center"}')
2422
+ }, 0, isEditing() && props.imgSrc || "default-key");
2423
+ }, "ImgComponent_component_FXvIDBSffO8"));
2424
+ const componentInfo$1 = {
2425
+ // friendlyName?
2426
+ name: "Raw:Img",
2427
+ hideFromInsertMenu: true,
2428
+ image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",
2429
+ inputs: [
2430
+ {
2431
+ name: "image",
2432
+ bubble: true,
2433
+ type: "file",
2434
+ allowedFileTypes: [
2435
+ "jpeg",
2436
+ "jpg",
2437
+ "png",
2438
+ "svg",
2439
+ "gif",
2440
+ "webp"
2441
+ ],
2442
+ required: true
2443
+ }
2444
+ ],
2445
+ noWrap: true,
2446
+ static: true
2447
+ };
2448
+ const findAndRunScripts = function findAndRunScripts22(props, state, elem) {
2449
+ if (elem.value && elem.value.getElementsByTagName && typeof window !== "undefined") {
2450
+ const scripts = elem.value.getElementsByTagName("script");
2451
+ for (let i = 0; i < scripts.length; i++) {
2452
+ const script = scripts[i];
2453
+ if (script.src) {
2454
+ if (state.scriptsInserted.includes(script.src))
2455
+ continue;
2456
+ state.scriptsInserted.push(script.src);
2457
+ const newScript = document.createElement("script");
2458
+ newScript.async = true;
2459
+ newScript.src = script.src;
2460
+ document.head.appendChild(newScript);
2461
+ } else if (!script.type || [
2462
+ "text/javascript",
2463
+ "application/javascript",
2464
+ "application/ecmascript"
2465
+ ].includes(script.type)) {
2466
+ if (state.scriptsRun.includes(script.innerText))
2467
+ continue;
2468
+ try {
2469
+ state.scriptsRun.push(script.innerText);
2470
+ new Function(script.innerText)();
2471
+ } catch (error) {
2472
+ console.warn("`CustomCode`: Error running script:", error);
2473
+ }
2474
+ }
2475
+ }
2476
+ }
2477
+ };
2478
+ const CustomCode = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
2479
+ const elem = useSignal();
2480
+ const state = useStore({
2481
+ scriptsInserted: [],
2482
+ scriptsRun: []
2483
+ });
2484
+ useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
2485
+ const [elem2, props2, state2] = useLexicalScope();
2486
+ findAndRunScripts(props2, state2, elem2);
2487
+ }, "CustomCode_component_useVisibleTask_S5QgEQZj6YE", [
2488
+ elem,
2489
+ props,
2490
+ state
2491
+ ]));
2492
+ return /* @__PURE__ */ _jsxQ("div", {
2493
+ ref: elem
2494
+ }, {
2495
+ class: _fnSignal((p0) => "builder-custom-code" + (p0.replaceNodes ? " replace-nodes" : ""), [
2496
+ props
2497
+ ], '"builder-custom-code"+(p0.replaceNodes?" replace-nodes":"")'),
2498
+ dangerouslySetInnerHTML: _fnSignal((p0) => p0.code, [
2499
+ props
2500
+ ], "p0.code")
2501
+ }, null, 3, "bY_0");
2502
+ }, "CustomCode_component_uYOSy7w7Zqw"));
2503
+ const componentInfo = {
2504
+ name: "Custom Code",
2505
+ static: true,
2506
+ requiredPermissions: [
2507
+ "editCode"
2508
+ ],
2509
+ inputs: [
2510
+ {
2511
+ name: "code",
2512
+ type: "html",
2513
+ required: true,
2514
+ defaultValue: "<p>Hello there, I am custom HTML code!</p>",
2515
+ code: true
2516
+ },
2517
+ {
2518
+ name: "replaceNodes",
2519
+ type: "boolean",
2520
+ helperText: "Preserve server rendered dom nodes",
2521
+ advanced: true
2522
+ },
2523
+ {
2524
+ name: "scriptsClientOnly",
2525
+ type: "boolean",
2526
+ defaultValue: false,
2527
+ helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
2528
+ advanced: true
2529
+ }
2530
+ ]
2531
+ };
2532
+ const getDefaultRegisteredComponents = () => [
2533
+ {
2534
+ component: Button,
2535
+ ...componentInfo$a
2536
+ },
2537
+ {
2538
+ component: Columns,
2539
+ ...componentInfo$9
2540
+ },
2541
+ {
2542
+ component: CustomCode,
2543
+ ...componentInfo
2544
+ },
2545
+ {
2546
+ component: Embed,
2547
+ ...componentInfo$2
2548
+ },
2549
+ {
2550
+ component: FragmentComponent,
2551
+ ...componentInfo$8
2552
+ },
2553
+ {
2554
+ component: Image,
2555
+ ...componentInfo$7
2556
+ },
2557
+ {
2558
+ component: ImgComponent,
2559
+ ...componentInfo$1
2560
+ },
2561
+ {
2562
+ component: SectionComponent,
2563
+ ...componentInfo$6
2564
+ },
2565
+ {
2566
+ component: Symbol$1,
2567
+ ...componentInfo$5
2568
+ },
2569
+ {
2570
+ component: Text,
2571
+ ...componentInfo$4
2572
+ },
2573
+ {
2574
+ component: Video,
2575
+ ...componentInfo$3
2576
+ }
2577
+ ];
2578
+ const components = [];
2579
+ const createRegisterComponentMessage = (info) => ({
2580
+ type: "builder.registerComponent",
2581
+ data: serializeComponentInfo(info)
2582
+ });
2583
+ const serializeFn = (fnValue) => {
2584
+ const fnStr = fnValue.toString().trim();
2585
+ const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
2586
+ return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
2587
+ };
2588
+ const serializeValue = (value) => typeof value === "function" ? serializeFn(value) : fastClone(value);
2589
+ const serializeComponentInfo = ({ inputs, ...info }) => ({
2590
+ ...fastClone(info),
2591
+ inputs: inputs == null ? void 0 : inputs.map((input) => Object.entries(input).reduce((acc, [key, value]) => ({
2592
+ ...acc,
2593
+ [key]: serializeValue(value)
2594
+ }), {}))
2595
+ });
2596
+ const getVariants = (content) => Object.values((content == null ? void 0 : content.variations) || {}).map((variant) => ({
2597
+ ...variant,
2598
+ testVariationId: variant.id,
2599
+ id: content == null ? void 0 : content.id
2600
+ }));
2601
+ const checkShouldRunVariants = ({ canTrack, content }) => {
2602
+ const hasVariants = getVariants(content).length > 0;
2603
+ if (!hasVariants)
2604
+ return false;
2605
+ if (!canTrack)
2606
+ return false;
2607
+ if (isBrowser())
2608
+ return false;
2609
+ return true;
2610
+ };
2611
+ function bldrAbTest(contentId, variants, isHydrationTarget2) {
2612
+ var _a;
2613
+ function getAndSetVariantId2() {
2614
+ function setCookie2(name, value, days) {
2615
+ let expires = "";
2616
+ if (days) {
2617
+ const date = /* @__PURE__ */ new Date();
2618
+ date.setTime(date.getTime() + days * 864e5);
2619
+ expires = "; expires=" + date.toUTCString();
2620
+ }
2621
+ document.cookie = name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=None";
2622
+ }
2623
+ function getCookie2(name) {
2624
+ const nameEQ = name + "=";
2625
+ const ca = document.cookie.split(";");
2626
+ for (let i = 0; i < ca.length; i++) {
2627
+ let c = ca[i];
2628
+ while (c.charAt(0) === " ")
2629
+ c = c.substring(1, c.length);
2630
+ if (c.indexOf(nameEQ) === 0)
2631
+ return c.substring(nameEQ.length, c.length);
2632
+ }
2633
+ return null;
2634
+ }
2635
+ const cookieName = `builder.tests.${contentId}`;
2636
+ const variantInCookie = getCookie2(cookieName);
2637
+ const availableIDs = variants.map((vr) => vr.id).concat(contentId);
2638
+ if (variantInCookie && availableIDs.includes(variantInCookie))
2639
+ return variantInCookie;
2640
+ let n = 0;
2641
+ const random = Math.random();
2642
+ for (let i = 0; i < variants.length; i++) {
2643
+ const variant = variants[i];
2644
+ const testRatio = variant.testRatio;
2645
+ n += testRatio;
2646
+ if (random < n) {
2647
+ setCookie2(cookieName, variant.id);
2648
+ return variant.id;
2649
+ }
2650
+ }
2651
+ setCookie2(cookieName, contentId);
2652
+ return contentId;
2653
+ }
2654
+ const winningVariantId = getAndSetVariantId2();
2655
+ const styleEl = (_a = document.currentScript) == null ? void 0 : _a.previousElementSibling;
2656
+ if (isHydrationTarget2) {
2657
+ styleEl.remove();
2658
+ const thisScriptEl = document.currentScript;
2659
+ thisScriptEl == null ? void 0 : thisScriptEl.remove();
2660
+ } else {
2661
+ const newStyleStr = variants.concat({
2662
+ id: contentId
2663
+ }).filter((variant) => variant.id !== winningVariantId).map((value) => {
2664
+ return `.variant-${value.id} { display: none; }
2665
+ `;
2666
+ }).join("");
2667
+ styleEl.innerHTML = newStyleStr;
2668
+ }
2669
+ }
2670
+ function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2) {
2671
+ var _a;
2672
+ if (!navigator.cookieEnabled)
2673
+ return;
2674
+ function getCookie2(name) {
2675
+ const nameEQ = name + "=";
2676
+ const ca = document.cookie.split(";");
2677
+ for (let i = 0; i < ca.length; i++) {
2678
+ let c = ca[i];
2679
+ while (c.charAt(0) === " ")
2680
+ c = c.substring(1, c.length);
2681
+ if (c.indexOf(nameEQ) === 0)
2682
+ return c.substring(nameEQ.length, c.length);
2683
+ }
2684
+ return null;
2685
+ }
2686
+ const cookieName = `builder.tests.${defaultContentId}`;
2687
+ const variantId = getCookie2(cookieName);
2688
+ const parentDiv = (_a = document.currentScript) == null ? void 0 : _a.parentElement;
2689
+ const variantIsDefaultContent = variantContentId === defaultContentId;
2690
+ if (variantId === variantContentId) {
2691
+ if (variantIsDefaultContent)
2692
+ return;
2693
+ parentDiv == null ? void 0 : parentDiv.removeAttribute("hidden");
2694
+ parentDiv == null ? void 0 : parentDiv.removeAttribute("aria-hidden");
2695
+ } else {
2696
+ if (variantIsDefaultContent) {
2697
+ if (isHydrationTarget2)
2698
+ parentDiv == null ? void 0 : parentDiv.remove();
2699
+ else {
2700
+ parentDiv == null ? void 0 : parentDiv.setAttribute("hidden", "true");
2701
+ parentDiv == null ? void 0 : parentDiv.setAttribute("aria-hidden", "true");
2702
+ }
2703
+ }
2704
+ return;
2705
+ }
2706
+ return;
2707
+ }
2708
+ const getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
2709
+ const isHydrationTarget = getIsHydrationTarget(TARGET);
2710
+ const AB_TEST_FN_NAME = "builderIoAbTest";
2711
+ const CONTENT_FN_NAME = "builderIoRenderContent";
2712
+ const getScriptString = () => {
2713
+ const fnStr = bldrAbTest.toString().replace(/\s+/g, " ");
2714
+ const fnStr2 = bldrCntntScrpt.toString().replace(/\s+/g, " ");
2715
+ return `
2716
+ window.${AB_TEST_FN_NAME} = ${fnStr}
2717
+ window.${CONTENT_FN_NAME} = ${fnStr2}
2718
+ `;
2719
+ };
2720
+ const getVariantsScriptString = (variants, contentId) => {
2721
+ return `
2722
+ window.${AB_TEST_FN_NAME}("${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget})`;
2723
+ };
2724
+ const getRenderContentScriptString = ({ contentId, variationId }) => {
2725
+ return `
2726
+ window.${CONTENT_FN_NAME}("${variationId}", "${contentId}", ${isHydrationTarget})`;
2727
+ };
2728
+ const InlinedScript = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
2729
+ return /* @__PURE__ */ _jsxQ("script", null, {
2730
+ dangerouslySetInnerHTML: _fnSignal((p0) => p0.scriptStr, [
2731
+ props
2732
+ ], "p0.scriptStr"),
2733
+ id: _fnSignal((p0) => p0.id, [
2734
+ props
2735
+ ], "p0.id")
2736
+ }, null, 3, "WO_0");
2737
+ }, "InlinedScript_component_hwThBdhA8rw"));
2738
+ function getGlobalThis() {
2739
+ if (typeof globalThis !== "undefined")
2740
+ return globalThis;
2741
+ if (typeof window !== "undefined")
2742
+ return window;
2743
+ if (typeof global !== "undefined")
2744
+ return global;
2745
+ if (typeof self !== "undefined")
2746
+ return self;
2747
+ return globalThis;
2748
+ }
2749
+ function getFetch() {
2750
+ const globalFetch = getGlobalThis().fetch;
2751
+ if (typeof globalFetch === "undefined") {
2752
+ console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
2753
+ For more information, read https://github.com/BuilderIO/this-package-uses-fetch`);
2754
+ throw new Error("Builder SDK could not find a global `fetch` function");
2755
+ }
2756
+ return globalFetch;
2757
+ }
2758
+ const fetch$1 = getFetch();
2759
+ function flatten(object, path = null, separator = ".") {
2760
+ return Object.keys(object).reduce((acc, key) => {
2761
+ const value = object[key];
2762
+ const newPath = [
2763
+ path,
2764
+ key
2765
+ ].filter(Boolean).join(separator);
2766
+ const isObject = [
2767
+ typeof value === "object",
2768
+ value !== null,
2769
+ !(Array.isArray(value) && value.length === 0)
2770
+ ].every(Boolean);
2771
+ return isObject ? {
2772
+ ...acc,
2773
+ ...flatten(value, newPath, separator)
2774
+ } : {
2775
+ ...acc,
2776
+ [newPath]: value
2777
+ };
2778
+ }, {});
2779
+ }
2780
+ const BUILDER_SEARCHPARAMS_PREFIX = "builder.";
2781
+ const BUILDER_OPTIONS_PREFIX = "options.";
2782
+ const convertSearchParamsToQueryObject = (searchParams) => {
2783
+ const options = {};
2784
+ searchParams.forEach((value, key) => {
2785
+ options[key] = value;
2786
+ });
2787
+ return options;
2788
+ };
2789
+ const getBuilderSearchParams = (_options) => {
2790
+ if (!_options)
2791
+ return {};
2792
+ const options = normalizeSearchParams(_options);
2793
+ const newOptions = {};
2794
+ Object.keys(options).forEach((key) => {
2795
+ if (key.startsWith(BUILDER_SEARCHPARAMS_PREFIX)) {
2796
+ const trimmedKey = key.replace(BUILDER_SEARCHPARAMS_PREFIX, "").replace(BUILDER_OPTIONS_PREFIX, "");
2797
+ newOptions[trimmedKey] = options[key];
2798
+ }
2799
+ });
2800
+ return newOptions;
2801
+ };
2802
+ const getBuilderSearchParamsFromWindow = () => {
2803
+ if (!isBrowser())
2804
+ return {};
2805
+ const searchParams = new URLSearchParams(window.location.search);
2806
+ return getBuilderSearchParams(searchParams);
2807
+ };
2808
+ const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
2809
+ const DEFAULT_API_VERSION = "v3";
2810
+ const generateContentUrl = (options) => {
2811
+ const { limit = 30, userAttributes, query, noTraverse = false, model, apiKey, includeRefs = true, enrich, locale, apiVersion = DEFAULT_API_VERSION } = options;
2812
+ if (!apiKey)
2813
+ throw new Error("Missing API key");
2814
+ if (![
2815
+ "v2",
2816
+ "v3"
2817
+ ].includes(apiVersion))
2818
+ throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${apiVersion}'`);
2819
+ const url = new URL(`https://cdn.builder.io/api/${apiVersion}/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}&includeRefs=${includeRefs}${locale ? `&locale=${locale}` : ""}${enrich ? `&enrich=${enrich}` : ""}`);
2820
+ const queryOptions = {
2821
+ ...getBuilderSearchParamsFromWindow(),
2822
+ ...normalizeSearchParams(options.options || {})
2823
+ };
2824
+ const flattened = flatten(queryOptions);
2825
+ for (const key in flattened)
2826
+ url.searchParams.set(key, String(flattened[key]));
2827
+ if (userAttributes)
2828
+ url.searchParams.set("userAttributes", JSON.stringify(userAttributes));
2829
+ if (query) {
2830
+ const flattened2 = flatten({
2831
+ query
2832
+ });
2833
+ for (const key in flattened2)
2834
+ url.searchParams.set(key, JSON.stringify(flattened2[key]));
2835
+ }
2836
+ return url;
2837
+ };
2838
+ const checkContentHasResults = (content) => "results" in content;
2839
+ async function fetchOneEntry(options) {
2840
+ const allContent = await fetchEntries({
2841
+ ...options,
2842
+ limit: 1
2843
+ });
2844
+ if (allContent)
2845
+ return allContent.results[0] || null;
2846
+ return null;
2847
+ }
2848
+ const getContent = fetchOneEntry;
2849
+ const _fetchContent = async (options) => {
2850
+ const url = generateContentUrl(options);
2851
+ const res = await fetch$1(url.href);
2852
+ const content = await res.json();
2853
+ return content;
2854
+ };
2855
+ const _processContentResult = async (options, content, url = generateContentUrl(options)) => {
2856
+ const canTrack = getDefaultCanTrack(options.canTrack);
2857
+ url.search.includes(`preview=`);
2858
+ if (!canTrack)
2859
+ return content;
2860
+ if (!(isBrowser() || TARGET === "reactNative"))
2861
+ return content;
2862
+ try {
2863
+ const newResults = [];
2864
+ for (const item of content.results)
2865
+ newResults.push(await handleABTesting({
2866
+ item,
2867
+ canTrack
2868
+ }));
2869
+ content.results = newResults;
2870
+ } catch (e) {
2871
+ logger.error("Could not process A/B tests. ", e);
2872
+ }
2873
+ return content;
2874
+ };
2875
+ async function fetchEntries(options) {
2876
+ try {
2877
+ const url = generateContentUrl(options);
2878
+ const content = await _fetchContent(options);
2879
+ if (!checkContentHasResults(content)) {
2880
+ logger.error("Error fetching data. ", {
2881
+ url,
2882
+ content,
2883
+ options
2884
+ });
2885
+ return null;
2886
+ }
2887
+ return _processContentResult(options, content);
2888
+ } catch (error) {
2889
+ logger.error("Error fetching data. ", error);
2890
+ return null;
2891
+ }
2892
+ }
2893
+ const getAllContent = fetchEntries;
2894
+ function isPreviewing() {
2895
+ if (!isBrowser())
2896
+ return false;
2897
+ if (isEditing())
2898
+ return false;
2899
+ return Boolean(location.search.indexOf("builder.preview=") !== -1);
2900
+ }
2901
+ function uuidv4() {
2902
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
2903
+ const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
2904
+ return v.toString(16);
2905
+ });
2906
+ }
2907
+ function uuid() {
2908
+ return uuidv4().replace(/-/g, "");
2909
+ }
2910
+ const SESSION_LOCAL_STORAGE_KEY = "builderSessionId";
2911
+ const getSessionId = async ({ canTrack }) => {
2912
+ if (!canTrack)
2913
+ return void 0;
2914
+ const sessionId = await getCookie({
2915
+ name: SESSION_LOCAL_STORAGE_KEY,
2916
+ canTrack
2917
+ });
2918
+ if (checkIsDefined(sessionId))
2919
+ return sessionId;
2920
+ else {
2921
+ const newSessionId = createSessionId();
2922
+ setSessionId({
2923
+ id: newSessionId,
2924
+ canTrack
2925
+ });
2926
+ return newSessionId;
2927
+ }
2928
+ };
2929
+ const createSessionId = () => uuid();
2930
+ const setSessionId = ({ id, canTrack }) => setCookie({
2931
+ name: SESSION_LOCAL_STORAGE_KEY,
2932
+ value: id,
2933
+ canTrack
2934
+ });
2935
+ const getLocalStorage = () => isBrowser() && typeof localStorage !== "undefined" ? localStorage : void 0;
2936
+ const getLocalStorageItem = ({ key, canTrack }) => {
2937
+ var _a;
2938
+ try {
2939
+ if (canTrack)
2940
+ return (_a = getLocalStorage()) == null ? void 0 : _a.getItem(key);
2941
+ return void 0;
2942
+ } catch (err) {
2943
+ console.debug("[LocalStorage] GET error: ", err);
2944
+ return void 0;
2945
+ }
2946
+ };
2947
+ const setLocalStorageItem = ({ key, canTrack, value }) => {
2948
+ var _a;
2949
+ try {
2950
+ if (canTrack)
2951
+ (_a = getLocalStorage()) == null ? void 0 : _a.setItem(key, value);
2952
+ } catch (err) {
2953
+ console.debug("[LocalStorage] SET error: ", err);
2954
+ }
2955
+ };
2956
+ const VISITOR_LOCAL_STORAGE_KEY = "builderVisitorId";
2957
+ const getVisitorId = ({ canTrack }) => {
2958
+ if (!canTrack)
2959
+ return void 0;
2960
+ const visitorId = getLocalStorageItem({
2961
+ key: VISITOR_LOCAL_STORAGE_KEY,
2962
+ canTrack
2963
+ });
2964
+ if (checkIsDefined(visitorId))
2965
+ return visitorId;
2966
+ else {
2967
+ const newVisitorId = createVisitorId();
2968
+ setVisitorId({
2969
+ id: newVisitorId,
2970
+ canTrack
2971
+ });
2972
+ return newVisitorId;
2973
+ }
2974
+ };
2975
+ const createVisitorId = () => uuid();
2976
+ const setVisitorId = ({ id, canTrack }) => setLocalStorageItem({
2977
+ key: VISITOR_LOCAL_STORAGE_KEY,
2978
+ value: id,
2979
+ canTrack
2980
+ });
2981
+ const getTrackingEventData = async ({ canTrack }) => {
2982
+ if (!canTrack)
2983
+ return {
2984
+ visitorId: void 0,
2985
+ sessionId: void 0
2986
+ };
2987
+ const sessionId = await getSessionId({
2988
+ canTrack
2989
+ });
2990
+ const visitorId = getVisitorId({
2991
+ canTrack
2992
+ });
2993
+ return {
2994
+ sessionId,
2995
+ visitorId
2996
+ };
2997
+ };
2998
+ const createEvent = async ({ type: eventType, canTrack, apiKey, metadata, ...properties }) => ({
2999
+ type: eventType,
3000
+ data: {
3001
+ ...properties,
3002
+ metadata: {
3003
+ url: location.href,
3004
+ ...metadata
3005
+ },
3006
+ ...await getTrackingEventData({
3007
+ canTrack
3008
+ }),
3009
+ userAttributes: getUserAttributes(),
3010
+ ownerId: apiKey
3011
+ }
3012
+ });
3013
+ async function _track(eventProps) {
3014
+ if (!eventProps.apiKey) {
3015
+ logger.error("Missing API key for track call. Please provide your API key.");
3016
+ return;
3017
+ }
3018
+ if (!eventProps.canTrack)
3019
+ return;
3020
+ if (isEditing())
3021
+ return;
3022
+ if (!(isBrowser() || TARGET === "reactNative"))
3023
+ return;
3024
+ return fetch(`https://cdn.builder.io/api/v1/track`, {
3025
+ method: "POST",
3026
+ body: JSON.stringify({
3027
+ events: [
3028
+ await createEvent(eventProps)
3029
+ ]
3030
+ }),
3031
+ headers: {
3032
+ "content-type": "application/json"
3033
+ },
3034
+ mode: "cors"
3035
+ }).catch((err) => {
3036
+ console.error("Failed to track: ", err);
3037
+ });
3038
+ }
3039
+ const track = (args) => _track({
3040
+ ...args,
3041
+ canTrack: true
3042
+ });
3043
+ function round(num) {
3044
+ return Math.round(num * 1e3) / 1e3;
3045
+ }
3046
+ const findParentElement = (target, callback, checkElement = true) => {
3047
+ if (!(target instanceof HTMLElement))
3048
+ return null;
3049
+ let parent2 = checkElement ? target : target.parentElement;
3050
+ do {
3051
+ if (!parent2)
3052
+ return null;
3053
+ const matches = callback(parent2);
3054
+ if (matches)
3055
+ return parent2;
3056
+ } while (parent2 = parent2.parentElement);
3057
+ return null;
3058
+ };
3059
+ const findBuilderParent = (target) => findParentElement(target, (el) => {
3060
+ const id = el.getAttribute("builder-id") || el.id;
3061
+ return Boolean((id == null ? void 0 : id.indexOf("builder-")) === 0);
3062
+ });
3063
+ const computeOffset = ({ event, target }) => {
3064
+ const targetRect = target.getBoundingClientRect();
3065
+ const xOffset = event.clientX - targetRect.left;
3066
+ const yOffset = event.clientY - targetRect.top;
3067
+ const xRatio = round(xOffset / targetRect.width);
3068
+ const yRatio = round(yOffset / targetRect.height);
3069
+ return {
3070
+ x: xRatio,
3071
+ y: yRatio
3072
+ };
3073
+ };
3074
+ const getInteractionPropertiesForEvent = (event) => {
3075
+ const target = event.target;
3076
+ const targetBuilderElement = target && findBuilderParent(target);
3077
+ const builderId = (targetBuilderElement == null ? void 0 : targetBuilderElement.getAttribute("builder-id")) || (targetBuilderElement == null ? void 0 : targetBuilderElement.id);
3078
+ return {
3079
+ targetBuilderElement: builderId || void 0,
3080
+ metadata: {
3081
+ targetOffset: target ? computeOffset({
3082
+ event,
3083
+ target
3084
+ }) : void 0,
3085
+ builderTargetOffset: targetBuilderElement ? computeOffset({
3086
+ event,
3087
+ target: targetBuilderElement
3088
+ }) : void 0,
3089
+ builderElementIndex: targetBuilderElement && builderId ? [].slice.call(document.getElementsByClassName(builderId)).indexOf(targetBuilderElement) : void 0
3090
+ }
3091
+ };
3092
+ };
3093
+ const SDK_VERSION = "0.6.1";
3094
+ const registry = {};
3095
+ function register(type, info) {
3096
+ let typeList = registry[type];
3097
+ if (!typeList)
3098
+ typeList = registry[type] = [];
3099
+ typeList.push(info);
3100
+ if (isBrowser()) {
3101
+ const message = {
3102
+ type: "builder.register",
3103
+ data: {
3104
+ type,
3105
+ info
3106
+ }
3107
+ };
3108
+ try {
3109
+ parent.postMessage(message, "*");
3110
+ if (parent !== window)
3111
+ window.postMessage(message, "*");
3112
+ } catch (err) {
3113
+ console.debug("Could not postmessage", err);
3114
+ }
3115
+ }
3116
+ }
3117
+ const registerInsertMenu = () => {
3118
+ register("insertMenu", {
3119
+ name: "_default",
3120
+ default: true,
3121
+ items: [
3122
+ {
3123
+ name: "Box"
3124
+ },
3125
+ {
3126
+ name: "Text"
3127
+ },
3128
+ {
3129
+ name: "Image"
3130
+ },
3131
+ {
3132
+ name: "Columns"
3133
+ },
3134
+ ...[
3135
+ {
3136
+ name: "Core:Section"
3137
+ },
3138
+ {
3139
+ name: "Core:Button"
3140
+ },
3141
+ {
3142
+ name: "Embed"
3143
+ },
3144
+ {
3145
+ name: "Custom Code"
3146
+ }
3147
+ ]
3148
+ ]
3149
+ });
3150
+ };
3151
+ let isSetupForEditing = false;
3152
+ const setupBrowserForEditing = (options = {}) => {
3153
+ var _a, _b;
3154
+ if (isSetupForEditing)
3155
+ return;
3156
+ isSetupForEditing = true;
3157
+ if (isBrowser()) {
3158
+ (_a = window.parent) == null ? void 0 : _a.postMessage({
3159
+ type: "builder.sdkInfo",
3160
+ data: {
3161
+ target: TARGET,
3162
+ version: SDK_VERSION,
3163
+ supportsPatchUpdates: false,
3164
+ // Supports builder-model="..." attribute which is needed to
3165
+ // scope our '+ add block' button styling
3166
+ supportsAddBlockScoping: true,
3167
+ supportsCustomBreakpoints: true
3168
+ }
3169
+ }, "*");
3170
+ (_b = window.parent) == null ? void 0 : _b.postMessage({
3171
+ type: "builder.updateContent",
3172
+ data: {
3173
+ options
3174
+ }
3175
+ }, "*");
3176
+ window.addEventListener("message", ({ data }) => {
3177
+ var _a2, _b2;
3178
+ if (!(data == null ? void 0 : data.type))
3179
+ return;
3180
+ switch (data.type) {
3181
+ case "builder.evaluate": {
3182
+ const text = data.data.text;
3183
+ const args = data.data.arguments || [];
3184
+ const id = data.data.id;
3185
+ const fn = new Function(text);
3186
+ let result;
3187
+ let error = null;
3188
+ try {
3189
+ result = fn.apply(null, args);
3190
+ } catch (err) {
3191
+ error = err;
3192
+ }
3193
+ if (error)
3194
+ (_a2 = window.parent) == null ? void 0 : _a2.postMessage({
3195
+ type: "builder.evaluateError",
3196
+ data: {
3197
+ id,
3198
+ error: error.message
3199
+ }
3200
+ }, "*");
3201
+ else if (result && typeof result.then === "function")
3202
+ result.then((finalResult) => {
3203
+ var _a3;
3204
+ (_a3 = window.parent) == null ? void 0 : _a3.postMessage({
3205
+ type: "builder.evaluateResult",
3206
+ data: {
3207
+ id,
3208
+ result: finalResult
3209
+ }
3210
+ }, "*");
3211
+ }).catch(console.error);
3212
+ else
3213
+ (_b2 = window.parent) == null ? void 0 : _b2.postMessage({
3214
+ type: "builder.evaluateResult",
3215
+ data: {
3216
+ result,
3217
+ id
3218
+ }
3219
+ }, "*");
3220
+ break;
3221
+ }
3222
+ }
3223
+ });
3224
+ }
3225
+ };
3226
+ const mergeNewContent = function mergeNewContent2(props, state, elementRef, newContent) {
3227
+ var _a, _b, _c, _d, _e;
3228
+ const newContentValue = {
3229
+ ...props.builderContextSignal.content,
3230
+ ...newContent,
3231
+ data: {
3232
+ ...(_a = props.builderContextSignal.content) == null ? void 0 : _a.data,
3233
+ ...newContent == null ? void 0 : newContent.data
3234
+ },
3235
+ meta: {
3236
+ ...(_b = props.builderContextSignal.content) == null ? void 0 : _b.meta,
3237
+ ...newContent == null ? void 0 : newContent.meta,
3238
+ breakpoints: ((_c = newContent == null ? void 0 : newContent.meta) == null ? void 0 : _c.breakpoints) || ((_e = (_d = props.builderContextSignal.content) == null ? void 0 : _d.meta) == null ? void 0 : _e.breakpoints)
3239
+ }
3240
+ };
3241
+ props.builderContextSignal.content = newContentValue;
3242
+ };
3243
+ const processMessage = function processMessage2(props, state, elementRef, event) {
3244
+ var _a;
3245
+ const { data } = event;
3246
+ if (data)
3247
+ switch (data.type) {
3248
+ case "builder.configureSdk": {
3249
+ const messageContent = data.data;
3250
+ const { breakpoints, contentId } = messageContent;
3251
+ if (!contentId || contentId !== ((_a = props.builderContextSignal.content) == null ? void 0 : _a.id))
3252
+ return;
3253
+ if (breakpoints)
3254
+ mergeNewContent(props, state, elementRef, {
3255
+ meta: {
3256
+ breakpoints
3257
+ }
3258
+ });
3259
+ state.forceReRenderCount = state.forceReRenderCount + 1;
3260
+ break;
3261
+ }
3262
+ case "builder.contentUpdate": {
3263
+ const messageContent = data.data;
3264
+ const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
3265
+ const contentData = messageContent.data;
3266
+ if (key === props.model) {
3267
+ mergeNewContent(props, state, elementRef, contentData);
3268
+ state.forceReRenderCount = state.forceReRenderCount + 1;
3269
+ }
3270
+ break;
3271
+ }
3272
+ }
3273
+ };
3274
+ const evaluateJsCode = function evaluateJsCode2(props, state, elementRef) {
3275
+ var _a, _b;
3276
+ const jsCode = (_b = (_a = props.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.jsCode;
3277
+ if (jsCode)
3278
+ evaluate({
3279
+ code: jsCode,
3280
+ context: props.context || {},
3281
+ localState: void 0,
3282
+ rootState: props.builderContextSignal.rootState,
3283
+ rootSetState: props.builderContextSignal.rootSetState
3284
+ });
3285
+ };
3286
+ const onClick = function onClick22(props, state, elementRef, event) {
3287
+ var _a, _b;
3288
+ if (props.builderContextSignal.content) {
3289
+ const variationId = (_a = props.builderContextSignal.content) == null ? void 0 : _a.testVariationId;
3290
+ const contentId = (_b = props.builderContextSignal.content) == null ? void 0 : _b.id;
3291
+ _track({
3292
+ type: "click",
3293
+ canTrack: state.canTrackToUse,
3294
+ contentId,
3295
+ apiKey: props.apiKey,
3296
+ variationId: variationId !== contentId ? variationId : void 0,
3297
+ ...getInteractionPropertiesForEvent(event),
3298
+ unique: !state.clicked
3299
+ });
3300
+ }
3301
+ if (!state.clicked)
3302
+ state.clicked = true;
3303
+ };
3304
+ const evalExpression = function evalExpression2(props, state, elementRef, expression) {
3305
+ return expression.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
3306
+ code: group,
3307
+ context: props.context || {},
3308
+ localState: void 0,
3309
+ rootState: props.builderContextSignal.rootState,
3310
+ rootSetState: props.builderContextSignal.rootSetState
3311
+ }));
3312
+ };
3313
+ const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
3314
+ fetch$1(url).then((response) => response.json()).then((json) => {
3315
+ var _a, _b;
3316
+ const newState = {
3317
+ ...props.builderContextSignal.rootState,
3318
+ [key]: json
3319
+ };
3320
+ (_b = (_a = props.builderContextSignal).rootSetState) == null ? void 0 : _b.call(_a, newState);
3321
+ state.httpReqsData[key] = true;
3322
+ }).catch((err) => {
3323
+ console.error("error fetching dynamic data", url, err);
3324
+ });
3325
+ };
3326
+ const runHttpRequests = function runHttpRequests2(props, state, elementRef) {
3327
+ var _a, _b;
3328
+ const requests = ((_b = (_a = props.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.httpRequests) ?? {};
3329
+ Object.entries(requests).forEach(([key, url]) => {
3330
+ if (url && (!state.httpReqsData[key] || isEditing())) {
3331
+ const evaluatedUrl = evalExpression(props, state, elementRef, url);
3332
+ handleRequest(props, state, elementRef, {
3333
+ url: evaluatedUrl,
3334
+ key
3335
+ });
3336
+ }
3337
+ });
3338
+ };
3339
+ const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
3340
+ if (isEditing())
3341
+ window.dispatchEvent(new CustomEvent("builder:component:stateChange", {
3342
+ detail: {
3343
+ state: fastClone(props.builderContextSignal.rootState),
3344
+ ref: {
3345
+ name: props.model
3346
+ }
3347
+ }
3348
+ }));
3349
+ };
3350
+ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
3351
+ _jsxBranch();
3352
+ const elementRef = useSignal();
3353
+ const state = useStore({
3354
+ canTrackToUse: checkIsDefined(props.canTrack) ? props.canTrack : true,
3355
+ clicked: false,
3356
+ forceReRenderCount: 0,
3357
+ httpReqsData: {},
3358
+ lastUpdated: 0,
3359
+ shouldSendResetCookie: false
3360
+ }, {
3361
+ deep: true
3362
+ });
3363
+ useContextProvider(builderContext, props.builderContextSignal);
3364
+ useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
3365
+ var _a, _b;
3366
+ const [elementRef2, props2, state2] = useLexicalScope();
3367
+ if (!props2.apiKey)
3368
+ logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
3369
+ if (isBrowser()) {
3370
+ if (isEditing()) {
3371
+ state2.forceReRenderCount = state2.forceReRenderCount + 1;
3372
+ window.addEventListener("message", processMessage.bind(null, props2, state2, elementRef2));
3373
+ registerInsertMenu();
3374
+ setupBrowserForEditing({
3375
+ ...props2.locale ? {
3376
+ locale: props2.locale
3377
+ } : {},
3378
+ ...props2.includeRefs ? {
3379
+ includeRefs: props2.includeRefs
3380
+ } : {},
3381
+ ...props2.enrich ? {
3382
+ enrich: props2.enrich
3383
+ } : {}
3384
+ });
3385
+ Object.values(props2.builderContextSignal.componentInfos).forEach((registeredComponent) => {
3386
+ var _a2;
3387
+ const message = createRegisterComponentMessage(registeredComponent);
3388
+ (_a2 = window.parent) == null ? void 0 : _a2.postMessage(message, "*");
3389
+ });
3390
+ window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
3391
+ }
3392
+ if (props2.builderContextSignal.content) {
3393
+ const variationId = (_a = props2.builderContextSignal.content) == null ? void 0 : _a.testVariationId;
3394
+ const contentId = (_b = props2.builderContextSignal.content) == null ? void 0 : _b.id;
3395
+ _track({
3396
+ type: "impression",
3397
+ canTrack: state2.canTrackToUse,
3398
+ contentId,
3399
+ apiKey: props2.apiKey,
3400
+ variationId: variationId !== contentId ? variationId : void 0
3401
+ });
3402
+ }
3403
+ if (isPreviewing()) {
3404
+ const searchParams = new URL(location.href).searchParams;
3405
+ const searchParamPreviewModel = searchParams.get("builder.preview");
3406
+ const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
3407
+ const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
3408
+ if (searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
3409
+ fetchOneEntry({
3410
+ model: props2.model,
3411
+ apiKey: props2.apiKey,
3412
+ apiVersion: props2.builderContextSignal.apiVersion
3413
+ }).then((content) => {
3414
+ if (content)
3415
+ mergeNewContent(props2, state2, elementRef2, content);
3416
+ });
3417
+ }
3418
+ evaluateJsCode(props2);
3419
+ runHttpRequests(props2, state2, elementRef2);
3420
+ emitStateUpdate(props2);
3421
+ }
3422
+ }, "EnableEditor_component_useVisibleTask_Olaxc9jCOFk", [
3423
+ elementRef,
3424
+ props,
3425
+ state
3426
+ ]));
3427
+ useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
3428
+ const [elementRef2, props2, state2] = useLexicalScope();
3429
+ track2(() => props2.content);
3430
+ if (props2.content)
3431
+ mergeNewContent(props2, state2, elementRef2, props2.content);
3432
+ }, "EnableEditor_component_useTask_Nb2VI04qp0M", [
3433
+ elementRef,
3434
+ props,
3435
+ state
3436
+ ]));
3437
+ useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
3438
+ const [state2] = useLexicalScope();
3439
+ track2(() => state2.shouldSendResetCookie);
3440
+ }, "EnableEditor_component_useTask_1_m0y1Z9vk4eQ", [
3441
+ state
3442
+ ]));
3443
+ useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
3444
+ const [elementRef2, props2, state2] = useLexicalScope();
3445
+ track2(() => {
3446
+ var _a, _b;
3447
+ return (_b = (_a = props2.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.jsCode;
3448
+ });
3449
+ track2(() => props2.builderContextSignal.rootState);
3450
+ evaluateJsCode(props2);
3451
+ }, "EnableEditor_component_useTask_2_xVyv0tDqZLs", [
3452
+ elementRef,
3453
+ props,
3454
+ state
3455
+ ]));
3456
+ useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
3457
+ const [elementRef2, props2, state2] = useLexicalScope();
3458
+ track2(() => {
3459
+ var _a, _b;
3460
+ return (_b = (_a = props2.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.httpRequests;
3461
+ });
3462
+ runHttpRequests(props2, state2, elementRef2);
3463
+ }, "EnableEditor_component_useTask_3_bQ0e5LHZwWE", [
3464
+ elementRef,
3465
+ props,
3466
+ state
3467
+ ]));
3468
+ useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
3469
+ const [elementRef2, props2, state2] = useLexicalScope();
3470
+ track2(() => props2.builderContextSignal.rootState);
3471
+ emitStateUpdate(props2);
3472
+ }, "EnableEditor_component_useTask_4_moHYZG8uNVU", [
3473
+ elementRef,
3474
+ props,
3475
+ state
3476
+ ]));
3477
+ return /* @__PURE__ */ _jsxC(Fragment, {
3478
+ children: props.builderContextSignal.content ? /* @__PURE__ */ _jsxS("div", {
3479
+ ref: elementRef,
3480
+ ...props.showContent ? {} : {
3481
+ hidden: true,
3482
+ "aria-hidden": true
3483
+ },
3484
+ children: /* @__PURE__ */ _jsxC(Slot, null, 3, "06_0"),
3485
+ onClick$: /* @__PURE__ */ inlinedQrl((event) => {
3486
+ const [elementRef2, props2, state2] = useLexicalScope();
3487
+ return onClick(props2, state2, elementRef2, event);
3488
+ }, "EnableEditor_component__Fragment_div_onClick_1QOkLijjH0M", [
3489
+ elementRef,
3490
+ props,
3491
+ state
3492
+ ])
3493
+ }, {
3494
+ "builder-content-id": _fnSignal((p0) => {
3495
+ var _a;
3496
+ return (_a = p0.builderContextSignal.content) == null ? void 0 : _a.id;
3497
+ }, [
3498
+ props
3499
+ ], "p0.builderContextSignal.content?.id"),
3500
+ "builder-model": _fnSignal((p0) => p0.model, [
3501
+ props
3502
+ ], "p0.model"),
3503
+ class: _fnSignal((p0) => p0.classNameProp, [
3504
+ props
3505
+ ], "p0.classNameProp")
3506
+ }, 0, state.forceReRenderCount) : null
3507
+ }, 1, "06_1");
3508
+ }, "EnableEditor_component_ko1mO8oaj8k"));
3509
+ const getCssFromFont = (font) => {
3510
+ var _a;
3511
+ const family = font.family + (font.kind && !font.kind.includes("#") ? ", " + font.kind : "");
3512
+ const name = family.split(",")[0];
3513
+ const url = font.fileUrl ?? ((_a = font == null ? void 0 : font.files) == null ? void 0 : _a.regular);
3514
+ let str = "";
3515
+ if (url && family && name)
3516
+ str += `
3517
+ @font-face {
3518
+ font-family: "${family}";
3519
+ src: local("${name}"), url('${url}') format('woff2');
3520
+ font-display: fallback;
3521
+ font-weight: 400;
3522
+ }
3523
+ `.trim();
3524
+ if (font.files)
3525
+ for (const weight in font.files) {
3526
+ const isNumber = String(Number(weight)) === weight;
3527
+ if (!isNumber)
3528
+ continue;
3529
+ const weightUrl = font.files[weight];
3530
+ if (weightUrl && weightUrl !== url)
3531
+ str += `
3532
+ @font-face {
3533
+ font-family: "${family}";
3534
+ src: url('${weightUrl}') format('woff2');
3535
+ font-display: fallback;
3536
+ font-weight: ${weight};
3537
+ }
3538
+ `.trim();
3539
+ }
3540
+ return str;
3541
+ };
3542
+ const getFontCss = ({ customFonts }) => {
3543
+ var _a;
3544
+ return ((_a = customFonts == null ? void 0 : customFonts.map((font) => getCssFromFont(font))) == null ? void 0 : _a.join(" ")) || "";
3545
+ };
3546
+ const getCss = ({ cssCode, contentId }) => {
3547
+ if (!cssCode)
3548
+ return "";
3549
+ if (!contentId)
3550
+ return cssCode;
3551
+ return (cssCode == null ? void 0 : cssCode.replace(/&/g, `div[builder-content-id="${contentId}"]`)) || "";
3552
+ };
3553
+ const ContentStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
3554
+ const state = useStore({
3555
+ injectedStyles: `
3556
+ ${getCss({
3557
+ cssCode: props.cssCode,
3558
+ contentId: props.contentId
3559
+ })}
3560
+ ${getFontCss({
3561
+ customFonts: props.customFonts
3562
+ })}
3563
+
3564
+ .builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
3565
+ margin: 0;
3566
+ }
3567
+ .builder-text > p, .builder-text > .builder-paragraph {
3568
+ color: inherit;
3569
+ line-height: inherit;
3570
+ letter-spacing: inherit;
3571
+ font-weight: inherit;
3572
+ font-size: inherit;
3573
+ text-align: inherit;
3574
+ font-family: inherit;
3575
+ }
3576
+ `.trim()
3577
+ });
3578
+ return /* @__PURE__ */ _jsxC(InlinedStyles, {
3579
+ get styles() {
3580
+ return state.injectedStyles;
3581
+ },
3582
+ [_IMMUTABLE]: {
3583
+ styles: _fnSignal((p0) => p0.injectedStyles, [
3584
+ state
3585
+ ], "p0.injectedStyles")
3586
+ }
3587
+ }, 3, "8O_0");
3588
+ }, "ContentStyles_component_Qbhu1myPWm0"));
3589
+ const getContextStateInitialValue = ({ content, data, locale }) => {
3590
+ var _a, _b, _c;
3591
+ const defaultValues = {};
3592
+ (_b = (_a = content == null ? void 0 : content.data) == null ? void 0 : _a.inputs) == null ? void 0 : _b.forEach((input) => {
3593
+ var _a2;
3594
+ if (input.name && input.defaultValue !== void 0 && ((_a2 = content == null ? void 0 : content.data) == null ? void 0 : _a2.state) && content.data.state[input.name] === void 0)
3595
+ defaultValues[input.name] = input.defaultValue;
3596
+ });
3597
+ const stateToUse = {
3598
+ ...(_c = content == null ? void 0 : content.data) == null ? void 0 : _c.state,
3599
+ ...data,
3600
+ ...locale ? {
3601
+ locale
3602
+ } : {}
3603
+ };
3604
+ return {
3605
+ ...defaultValues,
3606
+ ...stateToUse
3607
+ };
3608
+ };
3609
+ const getContentInitialValue = ({ content, data }) => {
3610
+ return !content ? void 0 : {
3611
+ ...content,
3612
+ data: {
3613
+ ...content == null ? void 0 : content.data,
3614
+ ...data
3615
+ },
3616
+ meta: content == null ? void 0 : content.meta
3617
+ };
3618
+ };
3619
+ const ContentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
3620
+ var _a, _b;
3621
+ _jsxBranch();
3622
+ const state = useStore({
3623
+ builderContextSignal: {
3624
+ content: getContentInitialValue({
3625
+ content: JSON.parse(JSON.stringify(props.content || {})),
3626
+ data: props.data
3627
+ }),
3628
+ localState: void 0,
3629
+ rootState: getContextStateInitialValue({
3630
+ content: props.content,
3631
+ data: props.data,
3632
+ locale: props.locale
3633
+ }),
3634
+ rootSetState: void 0,
3635
+ context: props.context || {},
3636
+ apiKey: props.apiKey,
3637
+ apiVersion: props.apiVersion,
3638
+ componentInfos: [
3639
+ ...getDefaultRegisteredComponents(),
3640
+ // While this `components` object is deprecated, we must maintain support for it.
3641
+ // Since users are able to override our default components, we need to make sure that we do not break such
3642
+ // existing usage.
3643
+ // This is why we spread `components` after the default Builder.io components, but before the `props.customComponents`,
3644
+ // which is the new standard way of providing custom components, and must therefore take precedence.
3645
+ ...components,
3646
+ ...props.customComponents || []
3647
+ ].reduce((acc, { component: _, ...info }) => ({
3648
+ ...acc,
3649
+ [info.name]: serializeComponentInfo(info)
3650
+ }), {}),
3651
+ inheritedStyles: {}
3652
+ },
3653
+ registeredComponents: [
3654
+ ...getDefaultRegisteredComponents(),
3655
+ // While this `components` object is deprecated, we must maintain support for it.
3656
+ // Since users are able to override our default components, we need to make sure that we do not break such
3657
+ // existing usage.
3658
+ // This is why we spread `components` after the default Builder.io components, but before the `props.customComponents`,
3659
+ // which is the new standard way of providing custom components, and must therefore take precedence.
3660
+ ...components,
3661
+ ...props.customComponents || []
3662
+ ].reduce((acc, { component, ...info }) => ({
3663
+ ...acc,
3664
+ [info.name]: {
3665
+ component,
3666
+ ...serializeComponentInfo(info)
3667
+ }
3668
+ }), {}),
3669
+ scriptStr: getRenderContentScriptString({
3670
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
3671
+ variationId: (_a = props.content) == null ? void 0 : _a.testVariationId,
3672
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
3673
+ contentId: (_b = props.content) == null ? void 0 : _b.id
3674
+ })
3675
+ }, {
3676
+ deep: true
3677
+ });
3678
+ useContextProvider(ComponentsContext, useStore({
3679
+ registeredComponents: state.registeredComponents
3680
+ }));
3681
+ return /* @__PURE__ */ _jsxC(EnableEditor, {
3682
+ get content() {
3683
+ return props.content;
3684
+ },
3685
+ get model() {
3686
+ return props.model;
3687
+ },
3688
+ get context() {
3689
+ return props.context;
3690
+ },
3691
+ get apiKey() {
3692
+ return props.apiKey;
3693
+ },
3694
+ get canTrack() {
3695
+ return props.canTrack;
3696
+ },
3697
+ get locale() {
3698
+ return props.locale;
3699
+ },
3700
+ get includeRefs() {
3701
+ return props.includeRefs;
3702
+ },
3703
+ get enrich() {
3704
+ return props.enrich;
3705
+ },
3706
+ get classNameProp() {
3707
+ return props.classNameProp;
3708
+ },
3709
+ get showContent() {
3710
+ return props.showContent;
3711
+ },
3712
+ get builderContextSignal() {
3713
+ return state.builderContextSignal;
3714
+ },
3715
+ children: [
3716
+ props.isSsrAbTest ? /* @__PURE__ */ _jsxC(InlinedScript, {
3717
+ get scriptStr() {
3718
+ return state.scriptStr;
3719
+ },
3720
+ [_IMMUTABLE]: {
3721
+ scriptStr: _fnSignal((p0) => p0.scriptStr, [
3722
+ state
3723
+ ], "p0.scriptStr")
3724
+ }
3725
+ }, 3, "LQ_0") : null,
3726
+ /* @__PURE__ */ _jsxC(ContentStyles, {
3727
+ get contentId() {
3728
+ var _a2;
3729
+ return (_a2 = state.builderContextSignal.content) == null ? void 0 : _a2.id;
3730
+ },
3731
+ get cssCode() {
3732
+ var _a2, _b2;
3733
+ return (_b2 = (_a2 = state.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.cssCode;
3734
+ },
3735
+ get customFonts() {
3736
+ var _a2, _b2;
3737
+ return (_b2 = (_a2 = state.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.customFonts;
3738
+ },
3739
+ [_IMMUTABLE]: {
3740
+ contentId: _fnSignal((p0) => {
3741
+ var _a2;
3742
+ return (_a2 = p0.builderContextSignal.content) == null ? void 0 : _a2.id;
3743
+ }, [
3744
+ state
3745
+ ], "p0.builderContextSignal.content?.id"),
3746
+ cssCode: _fnSignal((p0) => {
3747
+ var _a2, _b2;
3748
+ return (_b2 = (_a2 = p0.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.cssCode;
3749
+ }, [
3750
+ state
3751
+ ], "p0.builderContextSignal.content?.data?.cssCode"),
3752
+ customFonts: _fnSignal((p0) => {
3753
+ var _a2, _b2;
3754
+ return (_b2 = (_a2 = p0.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.customFonts;
3755
+ }, [
3756
+ state
3757
+ ], "p0.builderContextSignal.content?.data?.customFonts")
3758
+ }
3759
+ }, 3, "LQ_1"),
3760
+ /* @__PURE__ */ _jsxC(Blocks, {
3761
+ get blocks() {
3762
+ var _a2, _b2;
3763
+ return (_b2 = (_a2 = state.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.blocks;
3764
+ },
3765
+ get context() {
3766
+ return state.builderContextSignal;
3767
+ },
3768
+ get registeredComponents() {
3769
+ return state.registeredComponents;
3770
+ },
3771
+ [_IMMUTABLE]: {
3772
+ blocks: _fnSignal((p0) => {
3773
+ var _a2, _b2;
3774
+ return (_b2 = (_a2 = p0.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.blocks;
3775
+ }, [
3776
+ state
3777
+ ], "p0.builderContextSignal.content?.data?.blocks"),
3778
+ context: _fnSignal((p0) => p0.builderContextSignal, [
3779
+ state
3780
+ ], "p0.builderContextSignal"),
3781
+ registeredComponents: _fnSignal((p0) => p0.registeredComponents, [
3782
+ state
3783
+ ], "p0.registeredComponents")
3784
+ }
3785
+ }, 3, "LQ_2")
3786
+ ],
3787
+ [_IMMUTABLE]: {
3788
+ apiKey: _fnSignal((p0) => p0.apiKey, [
3789
+ props
3790
+ ], "p0.apiKey"),
3791
+ builderContextSignal: _fnSignal((p0) => p0.builderContextSignal, [
3792
+ state
3793
+ ], "p0.builderContextSignal"),
3794
+ canTrack: _fnSignal((p0) => p0.canTrack, [
3795
+ props
3796
+ ], "p0.canTrack"),
3797
+ classNameProp: _fnSignal((p0) => p0.classNameProp, [
3798
+ props
3799
+ ], "p0.classNameProp"),
3800
+ content: _fnSignal((p0) => p0.content, [
3801
+ props
3802
+ ], "p0.content"),
3803
+ context: _fnSignal((p0) => p0.context, [
3804
+ props
3805
+ ], "p0.context"),
3806
+ enrich: _fnSignal((p0) => p0.enrich, [
3807
+ props
3808
+ ], "p0.enrich"),
3809
+ includeRefs: _fnSignal((p0) => p0.includeRefs, [
3810
+ props
3811
+ ], "p0.includeRefs"),
3812
+ locale: _fnSignal((p0) => p0.locale, [
3813
+ props
3814
+ ], "p0.locale"),
3815
+ model: _fnSignal((p0) => p0.model, [
3816
+ props
3817
+ ], "p0.model"),
3818
+ showContent: _fnSignal((p0) => p0.showContent, [
3819
+ props
3820
+ ], "p0.showContent")
3821
+ }
3822
+ }, 1, "LQ_3");
3823
+ }, "ContentComponent_component_HIsczUcxjCE"));
3824
+ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
3825
+ _jsxBranch();
3826
+ const state = useStore({
3827
+ shouldRenderVariants: checkShouldRunVariants({
3828
+ canTrack: getDefaultCanTrack(props.canTrack),
3829
+ content: props.content
3830
+ })
3831
+ });
3832
+ const variantScriptStr = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
3833
+ var _a;
3834
+ const [props2] = useLexicalScope();
3835
+ return getVariantsScriptString(getVariants(props2.content).map((value) => ({
3836
+ id: value.testVariationId,
3837
+ testRatio: value.testRatio
3838
+ })), ((_a = props2.content) == null ? void 0 : _a.id) || "");
3839
+ }, "ContentVariants_component_variantScriptStr_useComputed_ldWqWafT8Ww", [
3840
+ props
3841
+ ]));
3842
+ const hideVariantsStyleString = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
3843
+ const [props2] = useLexicalScope();
3844
+ return getVariants(props2.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
3845
+ }, "ContentVariants_component_hideVariantsStyleString_useComputed_fQIC0fJqAl4", [
3846
+ props
3847
+ ]));
3848
+ const defaultContent = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
3849
+ var _a;
3850
+ const [props2, state2] = useLexicalScope();
3851
+ return state2.shouldRenderVariants ? {
3852
+ ...props2.content,
3853
+ testVariationId: (_a = props2.content) == null ? void 0 : _a.id
3854
+ } : handleABTestingSync({
3855
+ item: props2.content,
3856
+ canTrack: getDefaultCanTrack(props2.canTrack)
3857
+ });
3858
+ }, "ContentVariants_component_defaultContent_useComputed_00q2HQsQPYc", [
3859
+ props,
3860
+ state
3861
+ ]));
3862
+ useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
3863
+ }, "ContentVariants_component_useVisibleTask_10cWAqcJ45I"));
3864
+ return /* @__PURE__ */ _jsxC(Fragment$1, {
3865
+ children: [
3866
+ !props.__isNestedRender && TARGET !== "reactNative" ? /* @__PURE__ */ _jsxC(InlinedScript, {
3867
+ get scriptStr() {
3868
+ return getScriptString();
3869
+ },
3870
+ [_IMMUTABLE]: {
3871
+ scriptStr: _IMMUTABLE
3872
+ }
3873
+ }, 3, "XM_0") : null,
3874
+ state.shouldRenderVariants ? /* @__PURE__ */ _jsxC(Fragment, {
3875
+ children: [
3876
+ /* @__PURE__ */ _jsxC(InlinedStyles, {
3877
+ get id() {
3878
+ var _a;
3879
+ return `variants-styles-${(_a = props.content) == null ? void 0 : _a.id}`;
3880
+ },
3881
+ get styles() {
3882
+ return hideVariantsStyleString.value;
3883
+ },
3884
+ [_IMMUTABLE]: {
3885
+ id: _fnSignal((p0) => {
3886
+ var _a;
3887
+ return `variants-styles-${(_a = p0.content) == null ? void 0 : _a.id}`;
3888
+ }, [
3889
+ props
3890
+ ], "`variants-styles-${p0.content?.id}`"),
3891
+ styles: _fnSignal((p0) => p0.value, [
3892
+ hideVariantsStyleString
3893
+ ], "p0.value")
3894
+ }
3895
+ }, 3, "XM_1"),
3896
+ /* @__PURE__ */ _jsxC(InlinedScript, {
3897
+ get scriptStr() {
3898
+ return variantScriptStr.value;
3899
+ },
3900
+ [_IMMUTABLE]: {
3901
+ scriptStr: _fnSignal((p0) => p0.value, [
3902
+ variantScriptStr
3903
+ ], "p0.value")
3904
+ }
3905
+ }, 3, "XM_2"),
3906
+ (getVariants(props.content) || []).map((variant) => {
3907
+ return /* @__PURE__ */ _jsxC(ContentComponent, {
3908
+ content: variant,
3909
+ showContent: false,
3910
+ get classNameProp() {
3911
+ return void 0;
3912
+ },
3913
+ get model() {
3914
+ return props.model;
3915
+ },
3916
+ get data() {
3917
+ return props.data;
3918
+ },
3919
+ get context() {
3920
+ return props.context;
3921
+ },
3922
+ get apiKey() {
3923
+ return props.apiKey;
3924
+ },
3925
+ get apiVersion() {
3926
+ return props.apiVersion;
3927
+ },
3928
+ get customComponents() {
3929
+ return props.customComponents;
3930
+ },
3931
+ get canTrack() {
3932
+ return props.canTrack;
3933
+ },
3934
+ get locale() {
3935
+ return props.locale;
3936
+ },
3937
+ get includeRefs() {
3938
+ return props.includeRefs;
3939
+ },
3940
+ get enrich() {
3941
+ return props.enrich;
3942
+ },
3943
+ get isSsrAbTest() {
3944
+ return state.shouldRenderVariants;
3945
+ },
3946
+ [_IMMUTABLE]: {
3947
+ apiKey: _fnSignal((p0) => p0.apiKey, [
3948
+ props
3949
+ ], "p0.apiKey"),
3950
+ apiVersion: _fnSignal((p0) => p0.apiVersion, [
3951
+ props
3952
+ ], "p0.apiVersion"),
3953
+ canTrack: _fnSignal((p0) => p0.canTrack, [
3954
+ props
3955
+ ], "p0.canTrack"),
3956
+ classNameProp: _IMMUTABLE,
3957
+ context: _fnSignal((p0) => p0.context, [
3958
+ props
3959
+ ], "p0.context"),
3960
+ customComponents: _fnSignal((p0) => p0.customComponents, [
3961
+ props
3962
+ ], "p0.customComponents"),
3963
+ data: _fnSignal((p0) => p0.data, [
3964
+ props
3965
+ ], "p0.data"),
3966
+ enrich: _fnSignal((p0) => p0.enrich, [
3967
+ props
3968
+ ], "p0.enrich"),
3969
+ includeRefs: _fnSignal((p0) => p0.includeRefs, [
3970
+ props
3971
+ ], "p0.includeRefs"),
3972
+ isSsrAbTest: _fnSignal((p0) => p0.shouldRenderVariants, [
3973
+ state
3974
+ ], "p0.shouldRenderVariants"),
3975
+ locale: _fnSignal((p0) => p0.locale, [
3976
+ props
3977
+ ], "p0.locale"),
3978
+ model: _fnSignal((p0) => p0.model, [
3979
+ props
3980
+ ], "p0.model"),
3981
+ showContent: _IMMUTABLE
3982
+ }
3983
+ }, 3, variant.testVariationId);
3984
+ })
3985
+ ]
3986
+ }, 1, "XM_3") : null,
3987
+ /* @__PURE__ */ _jsxC(ContentComponent, {
3988
+ get content() {
3989
+ return defaultContent.value;
3990
+ },
3991
+ get classNameProp() {
3992
+ var _a;
3993
+ return `variant-${(_a = props.content) == null ? void 0 : _a.id}`;
3994
+ },
3995
+ showContent: true,
3996
+ get model() {
3997
+ return props.model;
3998
+ },
3999
+ get data() {
4000
+ return props.data;
4001
+ },
4002
+ get context() {
4003
+ return props.context;
4004
+ },
4005
+ get apiKey() {
4006
+ return props.apiKey;
4007
+ },
4008
+ get apiVersion() {
4009
+ return props.apiVersion;
4010
+ },
4011
+ get customComponents() {
4012
+ return props.customComponents;
4013
+ },
4014
+ get canTrack() {
4015
+ return props.canTrack;
4016
+ },
4017
+ get locale() {
4018
+ return props.locale;
4019
+ },
4020
+ get includeRefs() {
4021
+ return props.includeRefs;
4022
+ },
4023
+ get enrich() {
4024
+ return props.enrich;
4025
+ },
4026
+ get isSsrAbTest() {
4027
+ return state.shouldRenderVariants;
4028
+ },
4029
+ [_IMMUTABLE]: {
4030
+ apiKey: _fnSignal((p0) => p0.apiKey, [
4031
+ props
4032
+ ], "p0.apiKey"),
4033
+ apiVersion: _fnSignal((p0) => p0.apiVersion, [
4034
+ props
4035
+ ], "p0.apiVersion"),
4036
+ canTrack: _fnSignal((p0) => p0.canTrack, [
4037
+ props
4038
+ ], "p0.canTrack"),
4039
+ classNameProp: _fnSignal((p0) => {
4040
+ var _a;
4041
+ return `variant-${(_a = p0.content) == null ? void 0 : _a.id}`;
4042
+ }, [
4043
+ props
4044
+ ], "`variant-${p0.content?.id}`"),
4045
+ content: _fnSignal((p0) => p0.value, [
4046
+ defaultContent
4047
+ ], "p0.value"),
4048
+ context: _fnSignal((p0) => p0.context, [
4049
+ props
4050
+ ], "p0.context"),
4051
+ customComponents: _fnSignal((p0) => p0.customComponents, [
4052
+ props
4053
+ ], "p0.customComponents"),
4054
+ data: _fnSignal((p0) => p0.data, [
4055
+ props
4056
+ ], "p0.data"),
4057
+ enrich: _fnSignal((p0) => p0.enrich, [
4058
+ props
4059
+ ], "p0.enrich"),
4060
+ includeRefs: _fnSignal((p0) => p0.includeRefs, [
4061
+ props
4062
+ ], "p0.includeRefs"),
4063
+ isSsrAbTest: _fnSignal((p0) => p0.shouldRenderVariants, [
4064
+ state
4065
+ ], "p0.shouldRenderVariants"),
4066
+ locale: _fnSignal((p0) => p0.locale, [
4067
+ props
4068
+ ], "p0.locale"),
4069
+ model: _fnSignal((p0) => p0.model, [
4070
+ props
4071
+ ], "p0.model"),
4072
+ showContent: _IMMUTABLE
4073
+ }
4074
+ }, 3, "XM_4")
4075
+ ]
4076
+ }, 1, "XM_5");
4077
+ }, "ContentVariants_component_4tFRiQMMEfM"));
4078
+ const fetchSymbolContent = async ({ builderContextValue, symbol }) => {
4079
+ if ((symbol == null ? void 0 : symbol.model) && // This is a hack, we should not need to check for this, but it is needed for Svelte.
4080
+ (builderContextValue == null ? void 0 : builderContextValue.apiKey))
4081
+ return fetchOneEntry({
4082
+ model: symbol.model,
4083
+ apiKey: builderContextValue.apiKey,
4084
+ apiVersion: builderContextValue.apiVersion,
4085
+ ...(symbol == null ? void 0 : symbol.entry) && {
4086
+ query: {
4087
+ id: symbol.entry
4088
+ }
4089
+ }
4090
+ }).catch((err) => {
4091
+ logger.error("Could not fetch symbol content: ", err);
4092
+ return void 0;
4093
+ });
4094
+ return void 0;
4095
+ };
4096
+ const setContent = function setContent2(props, state) {
4097
+ if (state.contentToUse)
4098
+ return;
4099
+ fetchSymbolContent({
4100
+ symbol: props.symbol,
4101
+ builderContextValue: props.builderContext
4102
+ }).then((newContent) => {
4103
+ if (newContent)
4104
+ state.contentToUse = newContent;
4105
+ });
4106
+ };
4107
+ const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
4108
+ var _a;
4109
+ const className = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
4110
+ var _a2, _b;
4111
+ const [props2] = useLexicalScope();
4112
+ return [
4113
+ props2.attributes.class,
4114
+ "builder-symbol",
4115
+ ((_a2 = props2.symbol) == null ? void 0 : _a2.inline) ? "builder-inline-symbol" : void 0,
4116
+ ((_b = props2.symbol) == null ? void 0 : _b.dynamic) || props2.dynamic ? "builder-dynamic-symbol" : void 0
4117
+ ].filter(Boolean).join(" ");
4118
+ }, "Symbol_component_className_useComputed_Wb6GqgtDHpE", [
4119
+ props
4120
+ ]));
4121
+ const state = useStore({
4122
+ contentToUse: (_a = props.symbol) == null ? void 0 : _a.content
4123
+ });
4124
+ useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
4125
+ const [props2, state2] = useLexicalScope();
4126
+ setContent(props2, state2);
4127
+ }, "Symbol_component_useVisibleTask_oMPs8W5ZhwE", [
4128
+ props,
4129
+ state
4130
+ ]));
4131
+ useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
4132
+ const [props2, state2] = useLexicalScope();
4133
+ track2(() => props2.symbol);
4134
+ setContent(props2, state2);
4135
+ }, "Symbol_component_useTask_NIAWAC1bMBo", [
4136
+ props,
4137
+ state
4138
+ ]));
4139
+ return /* @__PURE__ */ _jsxS("div", {
4140
+ ...props.attributes,
4141
+ children: /* @__PURE__ */ _jsxC(ContentVariants, {
4142
+ get apiVersion() {
4143
+ return props.builderContext.apiVersion;
4144
+ },
4145
+ get apiKey() {
4146
+ return props.builderContext.apiKey;
4147
+ },
4148
+ get context() {
4149
+ return props.builderContext.context;
4150
+ },
4151
+ get customComponents() {
4152
+ return Object.values(props.builderComponents);
4153
+ },
4154
+ get data() {
4155
+ var _a2, _b, _c;
4156
+ return {
4157
+ ...(_a2 = props.symbol) == null ? void 0 : _a2.data,
4158
+ ...props.builderContext.localState,
4159
+ ...(_c = (_b = state.contentToUse) == null ? void 0 : _b.data) == null ? void 0 : _c.state
4160
+ };
4161
+ },
4162
+ get model() {
4163
+ var _a2;
4164
+ return (_a2 = props.symbol) == null ? void 0 : _a2.model;
4165
+ },
4166
+ get content() {
4167
+ return state.contentToUse;
4168
+ },
4169
+ [_IMMUTABLE]: {
4170
+ apiKey: _fnSignal((p0) => p0.builderContext.apiKey, [
4171
+ props
4172
+ ], "p0.builderContext.apiKey"),
4173
+ apiVersion: _fnSignal((p0) => p0.builderContext.apiVersion, [
4174
+ props
4175
+ ], "p0.builderContext.apiVersion"),
4176
+ content: _fnSignal((p0) => p0.contentToUse, [
4177
+ state
4178
+ ], "p0.contentToUse"),
4179
+ context: _fnSignal((p0) => p0.builderContext.context, [
4180
+ props
4181
+ ], "p0.builderContext.context"),
4182
+ customComponents: _fnSignal((p0) => Object.values(p0.builderComponents), [
4183
+ props
4184
+ ], "Object.values(p0.builderComponents)"),
4185
+ data: _fnSignal((p0, p1) => {
4186
+ var _a2, _b, _c;
4187
+ return {
4188
+ ...(_a2 = p0.symbol) == null ? void 0 : _a2.data,
4189
+ ...p0.builderContext.localState,
4190
+ ...(_c = (_b = p1.contentToUse) == null ? void 0 : _b.data) == null ? void 0 : _c.state
4191
+ };
4192
+ }, [
4193
+ props,
4194
+ state
4195
+ ], "{...p0.symbol?.data,...p0.builderContext.localState,...p1.contentToUse?.data?.state}"),
4196
+ model: _fnSignal((p0) => {
4197
+ var _a2;
4198
+ return (_a2 = p0.symbol) == null ? void 0 : _a2.model;
4199
+ }, [
4200
+ props
4201
+ ], "p0.symbol?.model")
4202
+ }
4203
+ }, 3, "Wt_0")
4204
+ }, {
4205
+ class: _fnSignal((p0) => p0.value, [
4206
+ className
4207
+ ], "p0.value")
4208
+ }, 0, "Wt_1");
4209
+ }, "Symbol_component_WVvggdkUPdk"));
4210
+ const RenderBlocks = Blocks;
4211
+ const RenderContent = ContentVariants;
4212
+ const settings = {};
4213
+ function setEditorSettings(newSettings) {
4214
+ if (isBrowser()) {
4215
+ Object.assign(settings, newSettings);
4216
+ const message = {
4217
+ type: "builder.settingsChange",
4218
+ data: settings
4219
+ };
4220
+ parent.postMessage(message, "*");
4221
+ }
4222
+ }
4223
+ const fetchBuilderProps = async (_args) => {
4224
+ var _a, _b, _c;
4225
+ const urlPath = _args.path || ((_a = _args.url) == null ? void 0 : _a.pathname) || ((_b = _args.userAttributes) == null ? void 0 : _b.urlPath);
4226
+ const getContentArgs = {
4227
+ ..._args,
4228
+ apiKey: _args.apiKey,
4229
+ model: _args.model || "page",
4230
+ userAttributes: {
4231
+ ..._args.userAttributes,
4232
+ ...urlPath ? {
4233
+ urlPath
4234
+ } : {}
4235
+ },
4236
+ options: getBuilderSearchParams(_args.searchParams || ((_c = _args.url) == null ? void 0 : _c.searchParams) || _args.options)
4237
+ };
4238
+ return {
4239
+ apiKey: getContentArgs.apiKey,
4240
+ model: getContentArgs.model,
4241
+ content: await fetchOneEntry(getContentArgs)
4242
+ };
4243
+ };
4244
+ export {
4245
+ Blocks,
4246
+ Button,
4247
+ Columns,
4248
+ ContentVariants as Content,
4249
+ FragmentComponent as Fragment,
4250
+ Image,
4251
+ RenderBlocks,
4252
+ RenderContent,
4253
+ SectionComponent as Section,
4254
+ Symbol$1 as Symbol,
4255
+ Text,
4256
+ Video,
4257
+ _processContentResult,
4258
+ createRegisterComponentMessage,
4259
+ fetchBuilderProps,
4260
+ fetchEntries,
4261
+ fetchOneEntry,
4262
+ getAllContent,
4263
+ getBuilderSearchParams,
4264
+ getContent,
4265
+ isEditing,
4266
+ isPreviewing,
4267
+ register,
4268
+ setEditorSettings,
4269
+ track
4270
+ };