@builder.io/sdk-qwik 0.5.2 → 0.5.3-0

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