@builder.io/sdk-qwik 0.7.1-4 → 0.7.1-6

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