@builder.io/sdk-qwik 0.5.3-2 → 0.5.3-4

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