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