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