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

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