@builder.io/sdk-react 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/README.md +4 -3
  2. package/lib/browser/blocks-exports.cjs +187 -0
  3. package/lib/browser/blocks-exports.mjs +3441 -0
  4. package/lib/browser/index.cjs +1 -187
  5. package/lib/browser/index.mjs +26 -3449
  6. package/lib/browser/{server-entry-a595b1cf.cjs → server-entry-093e302c.cjs} +1 -1
  7. package/lib/browser/{server-entry-f6f9bdcb.js → server-entry-7839c812.js} +1 -1
  8. package/lib/browser/server-entry.cjs +1 -1
  9. package/lib/browser/server-entry.mjs +1 -1
  10. package/lib/edge/blocks-0fc8e8d2.js +3385 -0
  11. package/lib/edge/blocks-exports.cjs +1 -0
  12. package/lib/edge/blocks-exports.mjs +16 -0
  13. package/lib/edge/blocks-f8688fcb.cjs +32 -0
  14. package/lib/edge/button-61181684.cjs +1 -0
  15. package/lib/edge/button-d9bbef90.js +29 -0
  16. package/lib/edge/columns-d152e266.cjs +28 -0
  17. package/lib/edge/columns-f7a9bca7.js +156 -0
  18. package/lib/edge/content-variants-cdcbcdd8.js +1711 -0
  19. package/lib/edge/content-variants-d2500971.cjs +133 -0
  20. package/lib/edge/custom-code-33b73ed1.js +44 -0
  21. package/lib/edge/custom-code-7390ba8b.cjs +1 -0
  22. package/lib/edge/dynamic-blocks-exports.cjs +39 -0
  23. package/lib/edge/dynamic-blocks-exports.mjs +37 -0
  24. package/lib/edge/dynamic-renderer-b5124984.js +9 -0
  25. package/lib/edge/dynamic-renderer-c00b8bcb.cjs +1 -0
  26. package/lib/edge/embed-11e03fa7.js +38 -0
  27. package/lib/edge/embed-9edce7df.cjs +1 -0
  28. package/lib/edge/form-ac531791.cjs +1 -0
  29. package/lib/edge/form-fb5fd55e.js +194 -0
  30. package/lib/edge/fragment-015b0912.js +8 -0
  31. package/lib/edge/fragment-61ef192d.cjs +1 -0
  32. package/lib/edge/get-class-prop-name-caee6506.cjs +1 -0
  33. package/lib/edge/get-class-prop-name-f22d7d53.js +18 -0
  34. package/lib/edge/image-6a3654d5.js +118 -0
  35. package/lib/edge/image-e4128296.cjs +17 -0
  36. package/lib/edge/img-317659e2.js +21 -0
  37. package/lib/edge/img-f2eeaa75.cjs +1 -0
  38. package/lib/edge/index.cjs +1 -207
  39. package/lib/edge/index.mjs +25 -5922
  40. package/lib/edge/input-526ea905.js +21 -0
  41. package/lib/edge/input-562438c4.cjs +1 -0
  42. package/lib/edge/section-68fbc212.js +26 -0
  43. package/lib/edge/section-70c8b709.cjs +1 -0
  44. package/lib/edge/select-17802399.js +21 -0
  45. package/lib/edge/select-d87a6280.cjs +1 -0
  46. package/lib/edge/server-entry-88f58ed4.cjs +2 -0
  47. package/lib/edge/{server-entry-f6f9bdcb.js → server-entry-e0830caf.js} +373 -372
  48. package/lib/edge/server-entry.cjs +1 -1
  49. package/lib/edge/server-entry.mjs +1 -1
  50. package/lib/edge/slot-39b50f6b.cjs +1 -0
  51. package/lib/edge/slot-eb244885.js +33 -0
  52. package/lib/edge/submit-button-13d8d5a7.cjs +1 -0
  53. package/lib/edge/submit-button-71dd4015.js +8 -0
  54. package/lib/edge/symbol-bf773f2a.js +78 -0
  55. package/lib/edge/symbol-ee31bb7f.cjs +1 -0
  56. package/lib/edge/text-15f0a6f4.js +18 -0
  57. package/lib/edge/text-7fdbde16.cjs +1 -0
  58. package/lib/edge/video-66b20833.js +106 -0
  59. package/lib/edge/video-702696a8.cjs +1 -0
  60. package/lib/node/blocks-exports.cjs +227 -0
  61. package/lib/node/blocks-exports.mjs +3548 -0
  62. package/lib/node/index.cjs +1 -227
  63. package/lib/node/index.mjs +27 -3556
  64. package/lib/node/{server-entry-31b5d683.cjs → server-entry-0e638a4f.cjs} +1 -1
  65. package/lib/node/{server-entry-c2b6d198.js → server-entry-e1cc0803.js} +1 -1
  66. package/lib/node/server-entry.cjs +1 -1
  67. package/lib/node/server-entry.mjs +1 -1
  68. package/package.json +19 -13
  69. package/types/blocks/button/index.d.ts +1 -0
  70. package/types/blocks/columns/index.d.ts +1 -0
  71. package/types/blocks/custom-code/index.d.ts +1 -0
  72. package/types/blocks/embed/index.d.ts +1 -0
  73. package/types/blocks/form/form/index.d.ts +1 -0
  74. package/types/blocks/form/input/index.d.ts +1 -0
  75. package/types/blocks/form/select/index.d.ts +1 -0
  76. package/types/blocks/form/submit-button/index.d.ts +1 -0
  77. package/types/blocks/fragment/index.d.ts +1 -0
  78. package/types/blocks/image/index.d.ts +1 -0
  79. package/types/blocks/img/index.d.ts +1 -0
  80. package/types/blocks/raw-text/index.d.ts +1 -0
  81. package/types/blocks/section/index.d.ts +1 -0
  82. package/types/blocks/slot/index.d.ts +1 -0
  83. package/types/blocks/symbol/index.d.ts +1 -0
  84. package/types/blocks/text/index.d.ts +1 -0
  85. package/types/blocks/textarea/index.d.ts +1 -0
  86. package/types/blocks/video/index.d.ts +1 -0
  87. package/types/components/blocks/index.d.ts +1 -0
  88. package/types/components/content-variants/index.d.ts +1 -0
  89. package/types/components/error-boundary.d.ts +11 -0
  90. package/types/constants/sdk-version.d.ts +1 -1
  91. package/types/functions/get-content/types.d.ts +1 -1
  92. package/types/index-helpers/blocks-exports.d.ts +10 -11
  93. package/lib/edge/server-entry-a595b1cf.cjs +0 -2
@@ -0,0 +1,1711 @@
1
+ "use client";
2
+ import { jsx as g, Fragment as w, jsxs as U } from "react/jsx-runtime";
3
+ import { lazy as C, useRef as se, useState as y, useEffect as b, createElement as le } from "react";
4
+ import { h as L, T as ee, i as P, j as W, k as z, a as de, l as ce, m as ue, n as me, o as pe, p as ge, c as fe, e as he, q as be, u as J, v as ye } from "./server-entry-e0830caf.js";
5
+ import { Video as xe, Button as ve, Columns as Se, Fragment as Ie, Image as ke, Section as Ce, Symbol as Te, Text as we } from "./blocks-exports.mjs";
6
+ import { b as Ve, t as Re, e as Y, I as te, C as Ee, B as Fe } from "./blocks-0fc8e8d2.js";
7
+ import "./get-class-prop-name-f22d7d53.js";
8
+ import "./dynamic-renderer-b5124984.js";
9
+ const We = {
10
+ name: "Core:Button",
11
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
12
+ defaultStyles: {
13
+ // TODO: make min width more intuitive and set one
14
+ appearance: "none",
15
+ paddingTop: "15px",
16
+ paddingBottom: "15px",
17
+ paddingLeft: "25px",
18
+ paddingRight: "25px",
19
+ backgroundColor: "#000000",
20
+ color: "white",
21
+ borderRadius: "4px",
22
+ textAlign: "center",
23
+ cursor: "pointer"
24
+ },
25
+ inputs: [{
26
+ name: "text",
27
+ type: "text",
28
+ defaultValue: "Click me!",
29
+ bubble: !0
30
+ }, {
31
+ name: "link",
32
+ type: "url",
33
+ bubble: !0
34
+ }, {
35
+ name: "openLinkInNewTab",
36
+ type: "boolean",
37
+ defaultValue: !1,
38
+ friendlyName: "Open link in new tab"
39
+ }],
40
+ static: !0,
41
+ noWrap: !0
42
+ }, Ae = {
43
+ // TODO: ways to statically preprocess JSON for references, functions, etc
44
+ name: "Columns",
45
+ isRSC: !0,
46
+ inputs: [{
47
+ name: "columns",
48
+ type: "array",
49
+ broadcast: !0,
50
+ subFields: [{
51
+ name: "blocks",
52
+ type: "array",
53
+ hideFromUI: !0,
54
+ defaultValue: [{
55
+ "@type": "@builder.io/sdk:Element",
56
+ responsiveStyles: {
57
+ large: {
58
+ display: "flex",
59
+ flexDirection: "column",
60
+ alignItems: "stretch",
61
+ flexShrink: "0",
62
+ position: "relative",
63
+ marginTop: "30px",
64
+ textAlign: "center",
65
+ lineHeight: "normal",
66
+ height: "auto",
67
+ minHeight: "20px",
68
+ minWidth: "20px",
69
+ overflow: "hidden"
70
+ }
71
+ },
72
+ component: {
73
+ name: "Image",
74
+ options: {
75
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
76
+ backgroundPosition: "center",
77
+ backgroundSize: "cover",
78
+ aspectRatio: 0.7004048582995948
79
+ }
80
+ }
81
+ }, {
82
+ "@type": "@builder.io/sdk:Element",
83
+ responsiveStyles: {
84
+ large: {
85
+ display: "flex",
86
+ flexDirection: "column",
87
+ alignItems: "stretch",
88
+ flexShrink: "0",
89
+ position: "relative",
90
+ marginTop: "30px",
91
+ textAlign: "center",
92
+ lineHeight: "normal",
93
+ height: "auto"
94
+ }
95
+ },
96
+ component: {
97
+ name: "Text",
98
+ options: {
99
+ text: "<p>Enter some text...</p>"
100
+ }
101
+ }
102
+ }]
103
+ }, {
104
+ name: "width",
105
+ type: "number",
106
+ hideFromUI: !0,
107
+ helperText: "Width %, e.g. set to 50 to fill half of the space"
108
+ }, {
109
+ name: "link",
110
+ type: "url",
111
+ helperText: "Optionally set a url that clicking this column will link to"
112
+ }],
113
+ defaultValue: [{
114
+ blocks: [{
115
+ "@type": "@builder.io/sdk:Element",
116
+ responsiveStyles: {
117
+ large: {
118
+ display: "flex",
119
+ flexDirection: "column",
120
+ alignItems: "stretch",
121
+ flexShrink: "0",
122
+ position: "relative",
123
+ marginTop: "30px",
124
+ textAlign: "center",
125
+ lineHeight: "normal",
126
+ height: "auto",
127
+ minHeight: "20px",
128
+ minWidth: "20px",
129
+ overflow: "hidden"
130
+ }
131
+ },
132
+ component: {
133
+ name: "Image",
134
+ options: {
135
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
136
+ backgroundPosition: "center",
137
+ backgroundSize: "cover",
138
+ aspectRatio: 0.7004048582995948
139
+ }
140
+ }
141
+ }, {
142
+ "@type": "@builder.io/sdk:Element",
143
+ responsiveStyles: {
144
+ large: {
145
+ display: "flex",
146
+ flexDirection: "column",
147
+ alignItems: "stretch",
148
+ flexShrink: "0",
149
+ position: "relative",
150
+ marginTop: "30px",
151
+ textAlign: "center",
152
+ lineHeight: "normal",
153
+ height: "auto"
154
+ }
155
+ },
156
+ component: {
157
+ name: "Text",
158
+ options: {
159
+ text: "<p>Enter some text...</p>"
160
+ }
161
+ }
162
+ }]
163
+ }, {
164
+ blocks: [{
165
+ "@type": "@builder.io/sdk:Element",
166
+ responsiveStyles: {
167
+ large: {
168
+ display: "flex",
169
+ flexDirection: "column",
170
+ alignItems: "stretch",
171
+ flexShrink: "0",
172
+ position: "relative",
173
+ marginTop: "30px",
174
+ textAlign: "center",
175
+ lineHeight: "normal",
176
+ height: "auto",
177
+ minHeight: "20px",
178
+ minWidth: "20px",
179
+ overflow: "hidden"
180
+ }
181
+ },
182
+ component: {
183
+ name: "Image",
184
+ options: {
185
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
186
+ backgroundPosition: "center",
187
+ backgroundSize: "cover",
188
+ aspectRatio: 0.7004048582995948
189
+ }
190
+ }
191
+ }, {
192
+ "@type": "@builder.io/sdk:Element",
193
+ responsiveStyles: {
194
+ large: {
195
+ display: "flex",
196
+ flexDirection: "column",
197
+ alignItems: "stretch",
198
+ flexShrink: "0",
199
+ position: "relative",
200
+ marginTop: "30px",
201
+ textAlign: "center",
202
+ lineHeight: "normal",
203
+ height: "auto"
204
+ }
205
+ },
206
+ component: {
207
+ name: "Text",
208
+ options: {
209
+ text: "<p>Enter some text...</p>"
210
+ }
211
+ }
212
+ }]
213
+ }],
214
+ onChange: (e) => {
215
+ function t() {
216
+ n.forEach((o) => {
217
+ o.delete("width");
218
+ });
219
+ }
220
+ const n = e.get("columns");
221
+ Array.isArray(n) && n.find((d) => d.get("width")) && (n.find((u) => !u.get("width")) || n.reduce((m, l) => m + l.get("width"), 0) !== 100) && t();
222
+ }
223
+ }, {
224
+ name: "space",
225
+ type: "number",
226
+ defaultValue: 20,
227
+ helperText: "Size of gap between columns",
228
+ advanced: !0
229
+ }, {
230
+ name: "stackColumnsAt",
231
+ type: "string",
232
+ defaultValue: "tablet",
233
+ helperText: "Convert horizontal columns to vertical at what device size",
234
+ enum: ["tablet", "mobile", "never"],
235
+ advanced: !0
236
+ }, {
237
+ name: "reverseColumnsWhenStacked",
238
+ type: "boolean",
239
+ defaultValue: !1,
240
+ helperText: "When stacking columns for mobile devices, reverse the ordering",
241
+ advanced: !0
242
+ }]
243
+ }, Pe = {
244
+ name: "Fragment",
245
+ static: !0,
246
+ hidden: !0,
247
+ canHaveChildren: !0,
248
+ noWrap: !0
249
+ }, Ue = {
250
+ name: "Image",
251
+ static: !0,
252
+ 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",
253
+ defaultStyles: {
254
+ position: "relative",
255
+ minHeight: "20px",
256
+ minWidth: "20px",
257
+ overflow: "hidden"
258
+ },
259
+ canHaveChildren: !0,
260
+ inputs: [{
261
+ name: "image",
262
+ type: "file",
263
+ bubble: !0,
264
+ allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
265
+ required: !0,
266
+ defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
267
+ onChange: (e) => {
268
+ e.delete("srcset"), e.delete("noWebp");
269
+ function n(r, m = 6e4) {
270
+ return new Promise((l, f) => {
271
+ const x = document.createElement("img");
272
+ let I = !1;
273
+ x.onload = () => {
274
+ I = !0, l(x);
275
+ }, x.addEventListener("error", (k) => {
276
+ console.warn("Image load failed", k.error), f(k.error);
277
+ }), x.src = r, setTimeout(() => {
278
+ I || f(new Error("Image load timed out"));
279
+ }, m);
280
+ });
281
+ }
282
+ function o(r) {
283
+ return Math.round(r * 1e3) / 1e3;
284
+ }
285
+ const d = e.get("image"), u = e.get("aspectRatio");
286
+ if (fetch(d).then((r) => r.blob()).then((r) => {
287
+ r.type.includes("svg") && e.set("noWebp", !0);
288
+ }), d && (!u || u === 0.7041))
289
+ return n(d).then((r) => {
290
+ const m = e.get("aspectRatio");
291
+ e.get("image") === d && (!m || m === 0.7041) && r.width && r.height && (e.set("aspectRatio", o(r.height / r.width)), e.set("height", r.height), e.set("width", r.width));
292
+ });
293
+ }
294
+ }, {
295
+ name: "backgroundSize",
296
+ type: "text",
297
+ defaultValue: "cover",
298
+ enum: [{
299
+ label: "contain",
300
+ value: "contain",
301
+ helperText: "The image should never get cropped"
302
+ }, {
303
+ label: "cover",
304
+ value: "cover",
305
+ helperText: "The image should fill it's box, cropping when needed"
306
+ }]
307
+ }, {
308
+ name: "backgroundPosition",
309
+ type: "text",
310
+ defaultValue: "center",
311
+ enum: ["center", "top", "left", "right", "bottom", "top left", "top right", "bottom left", "bottom right"]
312
+ }, {
313
+ name: "altText",
314
+ type: "string",
315
+ helperText: "Text to display when the user has images off"
316
+ }, {
317
+ name: "height",
318
+ type: "number",
319
+ hideFromUI: !0
320
+ }, {
321
+ name: "width",
322
+ type: "number",
323
+ hideFromUI: !0
324
+ }, {
325
+ name: "sizes",
326
+ type: "string",
327
+ hideFromUI: !0
328
+ }, {
329
+ name: "srcset",
330
+ type: "string",
331
+ hideFromUI: !0
332
+ }, {
333
+ name: "lazy",
334
+ type: "boolean",
335
+ defaultValue: !0,
336
+ hideFromUI: !0
337
+ }, {
338
+ name: "fitContent",
339
+ type: "boolean",
340
+ helperText: "When child blocks are provided, fit to them instead of using the image's aspect ratio",
341
+ defaultValue: !0
342
+ }, {
343
+ name: "aspectRatio",
344
+ type: "number",
345
+ 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",
346
+ advanced: !0,
347
+ defaultValue: 0.7041
348
+ }]
349
+ }, Le = {
350
+ name: "Core:Section",
351
+ static: !0,
352
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
353
+ inputs: [{
354
+ name: "maxWidth",
355
+ type: "number",
356
+ defaultValue: 1200
357
+ }, {
358
+ name: "lazyLoad",
359
+ type: "boolean",
360
+ defaultValue: !1,
361
+ advanced: !0,
362
+ description: "Only render this section when in view"
363
+ }],
364
+ defaultStyles: {
365
+ paddingLeft: "20px",
366
+ paddingRight: "20px",
367
+ paddingTop: "50px",
368
+ paddingBottom: "50px",
369
+ marginTop: "0px",
370
+ width: "100vw",
371
+ marginLeft: "calc(50% - 50vw)"
372
+ },
373
+ canHaveChildren: !0,
374
+ defaultChildren: [{
375
+ "@type": "@builder.io/sdk:Element",
376
+ responsiveStyles: {
377
+ large: {
378
+ textAlign: "center"
379
+ }
380
+ },
381
+ component: {
382
+ name: "Text",
383
+ options: {
384
+ 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>"
385
+ }
386
+ }
387
+ }]
388
+ }, $e = {
389
+ name: "Slot",
390
+ isRSC: !0,
391
+ description: "Allow child blocks to be inserted into this content when used as a Symbol",
392
+ docsLink: "https://www.builder.io/c/docs/symbols-with-blocks",
393
+ image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",
394
+ // Maybe wrap this for canHaveChildren so bind children to this hm
395
+ inputs: [{
396
+ name: "name",
397
+ type: "string",
398
+ required: !0,
399
+ defaultValue: "children"
400
+ }]
401
+ }, He = C(() => import("./slot-eb244885.js")), De = {
402
+ name: "Symbol",
403
+ noWrap: !0,
404
+ static: !0,
405
+ isRSC: !0,
406
+ inputs: [{
407
+ name: "symbol",
408
+ type: "uiSymbol"
409
+ }, {
410
+ name: "dataOnly",
411
+ helperText: "Make this a data symbol that doesn't display any UI",
412
+ type: "boolean",
413
+ defaultValue: !1,
414
+ advanced: !0,
415
+ hideFromUI: !0
416
+ }, {
417
+ name: "inheritState",
418
+ helperText: "Inherit the parent component state and data",
419
+ type: "boolean",
420
+ defaultValue: !1,
421
+ advanced: !0
422
+ }, {
423
+ name: "renderToLiquid",
424
+ helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
425
+ type: "boolean",
426
+ defaultValue: !1,
427
+ advanced: !0,
428
+ hideFromUI: !0
429
+ }, {
430
+ name: "useChildren",
431
+ hideFromUI: !0,
432
+ type: "boolean"
433
+ }]
434
+ }, je = {
435
+ name: "Text",
436
+ static: !0,
437
+ isRSC: !0,
438
+ 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",
439
+ inputs: [{
440
+ name: "text",
441
+ type: "html",
442
+ required: !0,
443
+ autoFocus: !0,
444
+ bubble: !0,
445
+ defaultValue: "Enter some text..."
446
+ }],
447
+ defaultStyles: {
448
+ lineHeight: "normal",
449
+ height: "auto",
450
+ textAlign: "center"
451
+ }
452
+ }, qe = {
453
+ name: "Custom Code",
454
+ static: !0,
455
+ requiredPermissions: ["editCode"],
456
+ inputs: [{
457
+ name: "code",
458
+ type: "html",
459
+ required: !0,
460
+ defaultValue: "<p>Hello there, I am custom HTML code!</p>",
461
+ code: !0
462
+ }, {
463
+ name: "replaceNodes",
464
+ type: "boolean",
465
+ helperText: "Preserve server rendered dom nodes",
466
+ advanced: !0
467
+ }, {
468
+ name: "scriptsClientOnly",
469
+ type: "boolean",
470
+ defaultValue: !1,
471
+ helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
472
+ advanced: !0
473
+ }]
474
+ }, Ke = C(() => import("./custom-code-33b73ed1.js")), _e = {
475
+ name: "Embed",
476
+ static: !0,
477
+ inputs: [{
478
+ name: "url",
479
+ type: "url",
480
+ required: !0,
481
+ defaultValue: "",
482
+ helperText: "e.g. enter a youtube url, google map, etc",
483
+ onChange: (e) => {
484
+ const t = e.get("url");
485
+ if (t)
486
+ return e.set("content", "Loading..."), fetch(`https://iframe.ly/api/iframely?url=${t}&api_key=ae0e60e78201a3f2b0de4b`).then((o) => o.json()).then((o) => {
487
+ e.get("url") === t && (o.html ? e.set("content", o.html) : e.set("content", "Invalid url, please try another"));
488
+ }).catch((o) => {
489
+ e.set("content", "There was an error embedding this URL, please try again or another URL");
490
+ });
491
+ e.delete("content");
492
+ }
493
+ }, {
494
+ name: "content",
495
+ type: "html",
496
+ defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
497
+ hideFromUI: !0
498
+ }]
499
+ }, Be = C(() => import("./embed-11e03fa7.js")), Me = {
500
+ name: "Form:Form",
501
+ // editableTags: ['builder-form-error']
502
+ defaults: {
503
+ responsiveStyles: {
504
+ large: {
505
+ marginTop: "15px",
506
+ paddingBottom: "15px"
507
+ }
508
+ }
509
+ },
510
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fef36d2a846134910b64b88e6d18c5ca5",
511
+ inputs: [{
512
+ name: "sendSubmissionsTo",
513
+ type: "string",
514
+ // TODO: save to builder data and user can download as csv
515
+ // TODO: easy for mode too or computed add/remove fields form mode
516
+ // so you can edit details and high level mode at same time...
517
+ // Later - more integrations like mailchimp
518
+ // /api/v1/form-submit?to=mailchimp
519
+ enum: [{
520
+ label: "Send to email",
521
+ value: "email",
522
+ helperText: "Send form submissions to the email address of your choosing"
523
+ }, {
524
+ label: "Custom",
525
+ value: "custom",
526
+ helperText: "Handle where the form requests go manually with a little code, e.g. to your own custom backend"
527
+ }],
528
+ defaultValue: "email"
529
+ }, {
530
+ name: "sendSubmissionsToEmail",
531
+ type: "string",
532
+ required: !0,
533
+ // TODO: required: () => options.get("sendSubmissionsTo") === "email"
534
+ defaultValue: "your@email.com",
535
+ showIf: 'options.get("sendSubmissionsTo") === "email"'
536
+ }, {
537
+ name: "sendWithJs",
538
+ type: "boolean",
539
+ helperText: "Set to false to use basic html form action",
540
+ defaultValue: !0,
541
+ showIf: 'options.get("sendSubmissionsTo") === "custom"'
542
+ }, {
543
+ name: "name",
544
+ type: "string",
545
+ defaultValue: "My form"
546
+ // advanced: true
547
+ }, {
548
+ name: "action",
549
+ type: "string",
550
+ helperText: "URL to send the form data to",
551
+ showIf: 'options.get("sendSubmissionsTo") === "custom"'
552
+ }, {
553
+ name: "contentType",
554
+ type: "string",
555
+ defaultValue: "application/json",
556
+ advanced: !0,
557
+ // TODO: do automatically if file input
558
+ enum: ["application/json", "multipart/form-data", "application/x-www-form-urlencoded"],
559
+ showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
560
+ }, {
561
+ name: "method",
562
+ type: "string",
563
+ showIf: 'options.get("sendSubmissionsTo") === "custom"',
564
+ defaultValue: "POST",
565
+ advanced: !0
566
+ }, {
567
+ name: "previewState",
568
+ type: "string",
569
+ // TODO: persist: false flag
570
+ enum: ["unsubmitted", "sending", "success", "error"],
571
+ defaultValue: "unsubmitted",
572
+ helperText: 'Choose a state to edit, e.g. choose "success" to show what users see on success and edit the message',
573
+ showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
574
+ }, {
575
+ name: "successUrl",
576
+ type: "url",
577
+ helperText: "Optional URL to redirect the user to on form submission success",
578
+ showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
579
+ }, {
580
+ name: "resetFormOnSubmit",
581
+ type: "boolean",
582
+ showIf: "options.get('sendSubmissionsTo') === 'custom' && options.get('sendWithJs') === true",
583
+ advanced: !0
584
+ }, {
585
+ name: "successMessage",
586
+ type: "uiBlocks",
587
+ hideFromUI: !0,
588
+ defaultValue: [{
589
+ "@type": "@builder.io/sdk:Element",
590
+ responsiveStyles: {
591
+ large: {
592
+ marginTop: "10px"
593
+ }
594
+ },
595
+ component: {
596
+ name: "Text",
597
+ options: {
598
+ text: "<span>Thanks!</span>"
599
+ }
600
+ }
601
+ }]
602
+ }, {
603
+ name: "validate",
604
+ type: "boolean",
605
+ defaultValue: !0,
606
+ advanced: !0
607
+ }, {
608
+ name: "errorMessagePath",
609
+ type: "text",
610
+ advanced: !0,
611
+ helperText: 'Path to where to get the error message from in a JSON response to display to the user, e.g. "error.message" for a response like { "error": { "message": "this username is taken" }}'
612
+ }, {
613
+ name: "errorMessage",
614
+ type: "uiBlocks",
615
+ hideFromUI: !0,
616
+ defaultValue: [{
617
+ "@type": "@builder.io/sdk:Element",
618
+ responsiveStyles: {
619
+ large: {
620
+ marginTop: "10px"
621
+ }
622
+ },
623
+ bindings: {
624
+ "component.options.text": "state.formErrorMessage || block.component.options.text"
625
+ },
626
+ component: {
627
+ name: "Text",
628
+ options: {
629
+ text: "<span>Form submission error :( Please check your answers and try again</span>"
630
+ }
631
+ }
632
+ }]
633
+ }, {
634
+ name: "sendingMessage",
635
+ type: "uiBlocks",
636
+ hideFromUI: !0,
637
+ defaultValue: [{
638
+ "@type": "@builder.io/sdk:Element",
639
+ responsiveStyles: {
640
+ large: {
641
+ marginTop: "10px"
642
+ }
643
+ },
644
+ component: {
645
+ name: "Text",
646
+ options: {
647
+ text: "<span>Sending...</span>"
648
+ }
649
+ }
650
+ }]
651
+ }, {
652
+ name: "customHeaders",
653
+ type: "map",
654
+ valueType: {
655
+ type: "string"
656
+ },
657
+ advanced: !0,
658
+ showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
659
+ }],
660
+ noWrap: !0,
661
+ canHaveChildren: !0,
662
+ defaultChildren: [{
663
+ "@type": "@builder.io/sdk:Element",
664
+ responsiveStyles: {
665
+ large: {
666
+ marginTop: "10px"
667
+ }
668
+ },
669
+ component: {
670
+ name: "Text",
671
+ options: {
672
+ text: "<span>Enter your name</span>"
673
+ }
674
+ }
675
+ }, {
676
+ "@type": "@builder.io/sdk:Element",
677
+ responsiveStyles: {
678
+ large: {
679
+ marginTop: "10px"
680
+ }
681
+ },
682
+ component: {
683
+ name: "Form:Input",
684
+ options: {
685
+ name: "name",
686
+ placeholder: "Jane Doe"
687
+ }
688
+ }
689
+ }, {
690
+ "@type": "@builder.io/sdk:Element",
691
+ responsiveStyles: {
692
+ large: {
693
+ marginTop: "10px"
694
+ }
695
+ },
696
+ component: {
697
+ name: "Text",
698
+ options: {
699
+ text: "<span>Enter your email</span>"
700
+ }
701
+ }
702
+ }, {
703
+ "@type": "@builder.io/sdk:Element",
704
+ responsiveStyles: {
705
+ large: {
706
+ marginTop: "10px"
707
+ }
708
+ },
709
+ component: {
710
+ name: "Form:Input",
711
+ options: {
712
+ name: "email",
713
+ placeholder: "jane@doe.com"
714
+ }
715
+ }
716
+ }, {
717
+ "@type": "@builder.io/sdk:Element",
718
+ responsiveStyles: {
719
+ large: {
720
+ marginTop: "10px"
721
+ }
722
+ },
723
+ component: {
724
+ name: "Form:SubmitButton",
725
+ options: {
726
+ text: "Submit"
727
+ }
728
+ }
729
+ }]
730
+ }, Ne = C(() => import("./form-fb5fd55e.js")), Oe = {
731
+ name: "Form:Input",
732
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
733
+ inputs: [
734
+ {
735
+ name: "type",
736
+ type: "text",
737
+ enum: ["text", "number", "email", "url", "checkbox", "radio", "range", "date", "datetime-local", "search", "tel", "time", "file", "month", "week", "password", "color", "hidden"],
738
+ defaultValue: "text"
739
+ },
740
+ {
741
+ name: "name",
742
+ type: "string",
743
+ required: !0,
744
+ helperText: 'Every input in a form needs a unique name describing what it takes, e.g. "email"'
745
+ },
746
+ {
747
+ name: "placeholder",
748
+ type: "string",
749
+ defaultValue: "Hello there",
750
+ helperText: "Text to display when there is no value"
751
+ },
752
+ // TODO: handle value vs default value automatically like ng-model
753
+ {
754
+ name: "defaultValue",
755
+ type: "string"
756
+ },
757
+ {
758
+ name: "value",
759
+ type: "string",
760
+ advanced: !0
761
+ },
762
+ {
763
+ name: "required",
764
+ type: "boolean",
765
+ helperText: "Is this input required to be filled out to submit a form",
766
+ defaultValue: !1
767
+ }
768
+ ],
769
+ noWrap: !0,
770
+ static: !0,
771
+ defaultStyles: {
772
+ paddingTop: "10px",
773
+ paddingBottom: "10px",
774
+ paddingLeft: "10px",
775
+ paddingRight: "10px",
776
+ borderRadius: "3px",
777
+ borderWidth: "1px",
778
+ borderStyle: "solid",
779
+ borderColor: "#ccc"
780
+ }
781
+ }, ze = C(() => import("./input-526ea905.js")), Je = {
782
+ name: "Form:Select",
783
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
784
+ defaultStyles: {
785
+ alignSelf: "flex-start"
786
+ },
787
+ inputs: [{
788
+ name: "options",
789
+ type: "list",
790
+ required: !0,
791
+ subFields: [{
792
+ name: "value",
793
+ type: "text",
794
+ required: !0
795
+ }, {
796
+ name: "name",
797
+ type: "text"
798
+ }],
799
+ defaultValue: [{
800
+ value: "option 1"
801
+ }, {
802
+ value: "option 2"
803
+ }]
804
+ }, {
805
+ name: "name",
806
+ type: "string",
807
+ required: !0,
808
+ helperText: 'Every select in a form needs a unique name describing what it gets, e.g. "email"'
809
+ }, {
810
+ name: "defaultValue",
811
+ type: "string"
812
+ }, {
813
+ name: "value",
814
+ type: "string",
815
+ advanced: !0
816
+ }, {
817
+ name: "required",
818
+ type: "boolean",
819
+ defaultValue: !1
820
+ }],
821
+ static: !0,
822
+ noWrap: !0
823
+ }, Ye = C(() => import("./select-17802399.js")), Qe = {
824
+ name: "Form:SubmitButton",
825
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
826
+ defaultStyles: {
827
+ appearance: "none",
828
+ paddingTop: "15px",
829
+ paddingBottom: "15px",
830
+ paddingLeft: "25px",
831
+ paddingRight: "25px",
832
+ backgroundColor: "#3898EC",
833
+ color: "white",
834
+ borderRadius: "4px",
835
+ cursor: "pointer"
836
+ },
837
+ inputs: [{
838
+ name: "text",
839
+ type: "text",
840
+ defaultValue: "Click me"
841
+ }],
842
+ static: !0,
843
+ noWrap: !0
844
+ // TODO: optional children? maybe as optional form input
845
+ // that only shows if advanced setting is flipped
846
+ // TODO: defaultChildren
847
+ // canHaveChildren: true,
848
+ }, Ge = C(() => import("./submit-button-71dd4015.js")), Xe = {
849
+ // friendlyName?
850
+ name: "Raw:Img",
851
+ hideFromInsertMenu: !0,
852
+ 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",
853
+ inputs: [{
854
+ name: "image",
855
+ bubble: !0,
856
+ type: "file",
857
+ allowedFileTypes: ["jpeg", "jpg", "png", "svg", "gif", "webp"],
858
+ required: !0
859
+ }],
860
+ noWrap: !0,
861
+ static: !0
862
+ }, Ze = C(() => import("./img-317659e2.js")), et = {
863
+ name: "Video",
864
+ canHaveChildren: !0,
865
+ defaultStyles: {
866
+ minHeight: "20px",
867
+ minWidth: "20px"
868
+ },
869
+ 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",
870
+ inputs: [{
871
+ name: "video",
872
+ type: "file",
873
+ allowedFileTypes: ["mp4"],
874
+ bubble: !0,
875
+ defaultValue: "https://cdn.builder.io/o/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fd27731a526464deba0016216f5f9e570%2Fcompressed?apiKey=YJIGb4i01jvw0SRdL5Bt&token=d27731a526464deba0016216f5f9e570&alt=media&optimized=true",
876
+ required: !0
877
+ }, {
878
+ name: "posterImage",
879
+ type: "file",
880
+ allowedFileTypes: ["jpeg", "png"],
881
+ helperText: "Image to show before the video plays"
882
+ }, {
883
+ name: "autoPlay",
884
+ type: "boolean",
885
+ defaultValue: !0
886
+ }, {
887
+ name: "controls",
888
+ type: "boolean",
889
+ defaultValue: !1
890
+ }, {
891
+ name: "muted",
892
+ type: "boolean",
893
+ defaultValue: !0
894
+ }, {
895
+ name: "loop",
896
+ type: "boolean",
897
+ defaultValue: !0
898
+ }, {
899
+ name: "playsInline",
900
+ type: "boolean",
901
+ defaultValue: !0
902
+ }, {
903
+ name: "fit",
904
+ type: "text",
905
+ defaultValue: "cover",
906
+ enum: ["contain", "cover", "fill", "auto"]
907
+ }, {
908
+ name: "preload",
909
+ type: "text",
910
+ defaultValue: "metadata",
911
+ enum: ["auto", "metadata", "none"]
912
+ }, {
913
+ name: "fitContent",
914
+ type: "boolean",
915
+ helperText: "When child blocks are provided, fit to them instead of using the aspect ratio",
916
+ defaultValue: !0,
917
+ advanced: !0
918
+ }, {
919
+ name: "position",
920
+ type: "text",
921
+ defaultValue: "center",
922
+ enum: ["center", "top", "left", "right", "bottom", "top left", "top right", "bottom left", "bottom right"]
923
+ }, {
924
+ name: "height",
925
+ type: "number",
926
+ advanced: !0
927
+ }, {
928
+ name: "width",
929
+ type: "number",
930
+ advanced: !0
931
+ }, {
932
+ name: "aspectRatio",
933
+ type: "number",
934
+ advanced: !0,
935
+ defaultValue: 0.7004048582995948
936
+ }, {
937
+ name: "lazyLoad",
938
+ type: "boolean",
939
+ helperText: 'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',
940
+ defaultValue: !0,
941
+ advanced: !0
942
+ }]
943
+ }, tt = () => [{
944
+ component: Ke,
945
+ ...qe
946
+ }, {
947
+ component: Be,
948
+ ..._e
949
+ }, {
950
+ component: Ne,
951
+ ...Me
952
+ }, {
953
+ component: ze,
954
+ ...Oe
955
+ }, {
956
+ component: Ge,
957
+ ...Qe
958
+ }, {
959
+ component: Ye,
960
+ ...Je
961
+ }, {
962
+ component: Ze,
963
+ ...Xe
964
+ }, {
965
+ component: xe,
966
+ ...et
967
+ }], Q = () => [{
968
+ component: ve,
969
+ ...We
970
+ }, {
971
+ component: Se,
972
+ ...Ae
973
+ }, {
974
+ component: Ie,
975
+ ...Pe
976
+ }, {
977
+ component: ke,
978
+ ...Ue
979
+ }, {
980
+ component: Ce,
981
+ ...Le
982
+ }, {
983
+ component: He,
984
+ ...$e
985
+ }, {
986
+ component: Te,
987
+ ...De
988
+ }, {
989
+ component: we,
990
+ ...je
991
+ }, ...tt()], nt = `function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
992
+ function getAndSetVariantId() {
993
+ function setCookie(name, value, days) {
994
+ let expires = '';
995
+ if (days) {
996
+ const date = new Date();
997
+ date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
998
+ expires = '; expires=' + date.toUTCString();
999
+ }
1000
+ document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';
1001
+ }
1002
+ function getCookie(name) {
1003
+ const nameEQ = name + '=';
1004
+ const ca = document.cookie.split(';');
1005
+ for (let i = 0; i < ca.length; i++) {
1006
+ let c = ca[i];
1007
+ while (c.charAt(0) === ' ') c = c.substring(1, c.length);
1008
+ if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
1009
+ }
1010
+ return null;
1011
+ }
1012
+ const cookieName = \`builder.tests.\${contentId}\`;
1013
+ const variantInCookie = getCookie(cookieName);
1014
+ const availableIDs = variants.map(vr => vr.id).concat(contentId);
1015
+ if (variantInCookie && availableIDs.includes(variantInCookie)) {
1016
+ return variantInCookie;
1017
+ }
1018
+ let n = 0;
1019
+ const random = Math.random();
1020
+ for (let i = 0; i < variants.length; i++) {
1021
+ const variant = variants[i];
1022
+ const testRatio = variant.testRatio;
1023
+ n += testRatio;
1024
+ if (random < n) {
1025
+ setCookie(cookieName, variant.id);
1026
+ return variant.id;
1027
+ }
1028
+ }
1029
+ setCookie(cookieName, contentId);
1030
+ return contentId;
1031
+ }
1032
+ const winningVariantId = getAndSetVariantId();
1033
+ const styleEl = document.currentScript?.previousElementSibling;
1034
+ if (isHydrationTarget) {
1035
+ styleEl.remove();
1036
+ const thisScriptEl = document.currentScript;
1037
+ thisScriptEl?.remove();
1038
+ } else {
1039
+ const newStyleStr = variants.concat({
1040
+ id: contentId
1041
+ }).filter(variant => variant.id !== winningVariantId).map(value => {
1042
+ return \`.variant-\${value.id} { display: none; }
1043
+ \`;
1044
+ }).join('');
1045
+ styleEl.innerHTML = newStyleStr;
1046
+ }
1047
+ }`, at = `function updateVariantVisibility(variantContentId, defaultContentId, isHydrationTarget) {
1048
+ if (!navigator.cookieEnabled) {
1049
+ return;
1050
+ }
1051
+ function getCookie(name) {
1052
+ const nameEQ = name + '=';
1053
+ const ca = document.cookie.split(';');
1054
+ for (let i = 0; i < ca.length; i++) {
1055
+ let c = ca[i];
1056
+ while (c.charAt(0) === ' ') c = c.substring(1, c.length);
1057
+ if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
1058
+ }
1059
+ return null;
1060
+ }
1061
+ const cookieName = \`builder.tests.\${defaultContentId}\`;
1062
+ const winningVariant = getCookie(cookieName);
1063
+ const parentDiv = document.currentScript?.parentElement;
1064
+ const isDefaultContent = variantContentId === defaultContentId;
1065
+ const isWinningVariant = winningVariant === variantContentId;
1066
+ if (isWinningVariant && !isDefaultContent) {
1067
+ parentDiv?.removeAttribute('hidden');
1068
+ parentDiv?.removeAttribute('aria-hidden');
1069
+ } else if (!isWinningVariant && isDefaultContent) {
1070
+ parentDiv?.setAttribute('hidden', 'true');
1071
+ parentDiv?.setAttribute('aria-hidden', 'true');
1072
+ }
1073
+ if (isHydrationTarget) {
1074
+ if (!isWinningVariant) {
1075
+ parentDiv?.remove();
1076
+ }
1077
+ const thisScriptEl = document.currentScript;
1078
+ thisScriptEl?.remove();
1079
+ }
1080
+ return;
1081
+ }`, ne = "builderIoAbTest", ae = "builderIoRenderContent", F = (e) => Object.values((e == null ? void 0 : e.variations) || {}).map((t) => ({
1082
+ ...t,
1083
+ testVariationId: t.id,
1084
+ id: e == null ? void 0 : e.id
1085
+ })), it = ({
1086
+ canTrack: e,
1087
+ content: t
1088
+ }) => !(!(F(t).length > 0) || !e || L()), ot = (e) => e === "react" || e === "reactNative", ie = ot(ee), rt = () => `
1089
+ window.${ne} = ${nt}
1090
+ window.${ae} = ${at}
1091
+ `, st = (e, t) => `
1092
+ window.${ne}(
1093
+ "${t}",${JSON.stringify(e)}, ${ie}
1094
+ )`, lt = ({
1095
+ contentId: e,
1096
+ variationId: t
1097
+ }) => `window.${ae}(
1098
+ "${t}", "${e}", ${ie}
1099
+ )`;
1100
+ function $(e) {
1101
+ return /* @__PURE__ */ g(
1102
+ "script",
1103
+ {
1104
+ dangerouslySetInnerHTML: { __html: e.scriptStr },
1105
+ id: e.id || ""
1106
+ }
1107
+ );
1108
+ }
1109
+ function G(e) {
1110
+ return Math.round(e * 1e3) / 1e3;
1111
+ }
1112
+ const dt = (e, t, n = !0) => {
1113
+ if (!(e instanceof HTMLElement))
1114
+ return null;
1115
+ let o = n ? e : e.parentElement;
1116
+ do {
1117
+ if (!o)
1118
+ return null;
1119
+ if (t(o))
1120
+ return o;
1121
+ } while (o = o.parentElement);
1122
+ return null;
1123
+ }, ct = (e) => dt(e, (t) => {
1124
+ const n = t.getAttribute("builder-id") || t.id;
1125
+ return (n == null ? void 0 : n.indexOf("builder-")) === 0;
1126
+ }), X = ({
1127
+ event: e,
1128
+ target: t
1129
+ }) => {
1130
+ const n = t.getBoundingClientRect(), o = e.clientX - n.left, d = e.clientY - n.top, u = G(o / n.width), r = G(d / n.height);
1131
+ return {
1132
+ x: u,
1133
+ y: r
1134
+ };
1135
+ }, ut = (e) => {
1136
+ const t = e.target, n = t && ct(t), o = (n == null ? void 0 : n.getAttribute("builder-id")) || (n == null ? void 0 : n.id);
1137
+ return {
1138
+ targetBuilderElement: o || void 0,
1139
+ metadata: {
1140
+ targetOffset: t ? X({
1141
+ event: e,
1142
+ target: t
1143
+ }) : void 0,
1144
+ builderTargetOffset: n ? X({
1145
+ event: e,
1146
+ target: n
1147
+ }) : void 0,
1148
+ builderElementIndex: n && o ? [].slice.call(document.getElementsByClassName(o)).indexOf(n) : void 0
1149
+ }
1150
+ };
1151
+ };
1152
+ function mt(e) {
1153
+ var q, K, _, B, M, N, O;
1154
+ const t = se(null), [n, o] = y(() => 0);
1155
+ y(() => !0);
1156
+ function d(a) {
1157
+ var s, c;
1158
+ const i = {
1159
+ ...e.builderContextSignal.rootState,
1160
+ ...a
1161
+ };
1162
+ e.builderContextSignal.rootSetState ? (c = (s = e.builderContextSignal).rootSetState) == null || c.call(s, i) : e.setBuilderContextSignal((p) => ({
1163
+ ...p,
1164
+ rootState: i
1165
+ }));
1166
+ }
1167
+ function u(a) {
1168
+ var s, c, p, h, E;
1169
+ const i = {
1170
+ ...e.builderContextSignal.content,
1171
+ ...a,
1172
+ data: {
1173
+ ...(s = e.builderContextSignal.content) == null ? void 0 : s.data,
1174
+ ...a == null ? void 0 : a.data
1175
+ },
1176
+ meta: {
1177
+ ...(c = e.builderContextSignal.content) == null ? void 0 : c.meta,
1178
+ ...a == null ? void 0 : a.meta,
1179
+ breakpoints: ((p = a == null ? void 0 : a.meta) == null ? void 0 : p.breakpoints) || ((E = (h = e.builderContextSignal.content) == null ? void 0 : h.meta) == null ? void 0 : E.breakpoints)
1180
+ }
1181
+ };
1182
+ e.setBuilderContextSignal((re) => ({
1183
+ ...re,
1184
+ content: i
1185
+ }));
1186
+ }
1187
+ y(() => 0);
1188
+ const [r, m] = y(
1189
+ () => !1
1190
+ ), [l, f] = y(
1191
+ () => e.contentWrapper || "div"
1192
+ );
1193
+ function x(a) {
1194
+ return ue({
1195
+ model: e.model,
1196
+ trustedHosts: e.trustedHosts,
1197
+ callbacks: {
1198
+ configureSdk: (i) => {
1199
+ var p;
1200
+ const { breakpoints: s, contentId: c } = i;
1201
+ !c || c !== ((p = e.builderContextSignal.content) == null ? void 0 : p.id) || s && (u({
1202
+ meta: {
1203
+ breakpoints: s
1204
+ }
1205
+ }), o(n + 1));
1206
+ },
1207
+ animation: (i) => {
1208
+ Re(i);
1209
+ },
1210
+ contentUpdate: (i) => {
1211
+ u(i), o(n + 1);
1212
+ }
1213
+ }
1214
+ })(a);
1215
+ }
1216
+ function I() {
1217
+ var i, s;
1218
+ const a = (s = (i = e.builderContextSignal.content) == null ? void 0 : i.data) == null ? void 0 : s.jsCode;
1219
+ a && Y({
1220
+ code: a,
1221
+ context: e.context || {},
1222
+ localState: void 0,
1223
+ rootState: e.builderContextSignal.rootState,
1224
+ rootSetState: e.builderContextSignal.rootSetState
1225
+ });
1226
+ }
1227
+ const [k, A] = y(() => ({})), [V, v] = y(() => !1);
1228
+ function S(a) {
1229
+ var i, s;
1230
+ if (e.builderContextSignal.content) {
1231
+ const c = (i = e.builderContextSignal.content) == null ? void 0 : i.testVariationId, p = (s = e.builderContextSignal.content) == null ? void 0 : s.id;
1232
+ z({
1233
+ type: "click",
1234
+ canTrack: W(e.canTrack),
1235
+ contentId: p,
1236
+ apiKey: e.apiKey,
1237
+ variationId: c !== p ? c : void 0,
1238
+ ...ut(a),
1239
+ unique: !V
1240
+ });
1241
+ }
1242
+ V || v(!0);
1243
+ }
1244
+ function T(a) {
1245
+ return a.replace(
1246
+ /{{([^}]+)}}/g,
1247
+ (i, s) => Y({
1248
+ code: s,
1249
+ context: e.context || {},
1250
+ localState: void 0,
1251
+ rootState: e.builderContextSignal.rootState,
1252
+ rootSetState: e.builderContextSignal.rootSetState
1253
+ })
1254
+ );
1255
+ }
1256
+ function oe({ url: a, key: i }) {
1257
+ be(a).then((s) => s.json()).then((s) => {
1258
+ var p, h;
1259
+ const c = {
1260
+ ...e.builderContextSignal.rootState,
1261
+ [i]: s
1262
+ };
1263
+ (h = (p = e.builderContextSignal).rootSetState) == null || h.call(p, c), k[i] = !0;
1264
+ }).catch((s) => {
1265
+ console.error("error fetching dynamic data", a, s);
1266
+ });
1267
+ }
1268
+ function H() {
1269
+ var i, s, c;
1270
+ const a = (c = (s = (i = e.builderContextSignal.content) == null ? void 0 : i.data) == null ? void 0 : s.httpRequests) != null ? c : {};
1271
+ Object.entries(a).forEach(([p, h]) => {
1272
+ if (h && (!k[p] || P())) {
1273
+ const E = T(h);
1274
+ oe({
1275
+ url: E,
1276
+ key: p
1277
+ });
1278
+ }
1279
+ });
1280
+ }
1281
+ function R() {
1282
+ P() && window.dispatchEvent(
1283
+ new CustomEvent(
1284
+ "builder:component:stateChange",
1285
+ {
1286
+ detail: {
1287
+ state: me(e.builderContextSignal.rootState),
1288
+ ref: {
1289
+ name: e.model
1290
+ }
1291
+ }
1292
+ }
1293
+ )
1294
+ );
1295
+ }
1296
+ function D(a) {
1297
+ o(n + 1), window.addEventListener("message", x), pe(), ge({
1298
+ ...e.locale ? {
1299
+ locale: e.locale
1300
+ } : {},
1301
+ ...e.enrich ? {
1302
+ enrich: e.enrich
1303
+ } : {},
1304
+ ...e.trustedHosts ? {
1305
+ trustedHosts: e.trustedHosts
1306
+ } : {}
1307
+ }), Object.values(
1308
+ e.builderContextSignal.componentInfos
1309
+ ).forEach((i) => {
1310
+ var c;
1311
+ const s = fe(i);
1312
+ (c = window.parent) == null || c.postMessage(s, "*");
1313
+ }), window.addEventListener(
1314
+ "builder:component:stateChangeListenerActivated",
1315
+ R
1316
+ );
1317
+ }
1318
+ function j(a) {
1319
+ const i = new URL(location.href).searchParams, s = i.get("builder.preview"), c = i.get(
1320
+ `builder.preview.${s}`
1321
+ ), p = i.get("apiKey") || i.get("builder.space");
1322
+ s === e.model && p === e.apiKey && (!e.content || c === e.content.id) && he({
1323
+ model: e.model,
1324
+ apiKey: e.apiKey,
1325
+ apiVersion: e.builderContextSignal.apiVersion
1326
+ }).then((h) => {
1327
+ h && u(h);
1328
+ });
1329
+ }
1330
+ return b(() => {
1331
+ var a;
1332
+ return (a = t.current) == null || a.addEventListener(
1333
+ "initeditingbldr",
1334
+ D
1335
+ ), () => {
1336
+ var i;
1337
+ return (i = t.current) == null ? void 0 : i.removeEventListener(
1338
+ "initeditingbldr",
1339
+ D
1340
+ );
1341
+ };
1342
+ }, []), b(() => {
1343
+ var a;
1344
+ return (a = t.current) == null || a.addEventListener(
1345
+ "initpreviewingbldr",
1346
+ j
1347
+ ), () => {
1348
+ var i;
1349
+ return (i = t.current) == null ? void 0 : i.removeEventListener(
1350
+ "initpreviewingbldr",
1351
+ j
1352
+ );
1353
+ };
1354
+ }, []), b(() => {
1355
+ var a, i;
1356
+ if (L()) {
1357
+ if (P() && t.current && t.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && W(e.canTrack)) {
1358
+ const c = (a = e.builderContextSignal.content) == null ? void 0 : a.testVariationId, p = (i = e.builderContextSignal.content) == null ? void 0 : i.id, h = e.apiKey;
1359
+ z({
1360
+ type: "impression",
1361
+ canTrack: !0,
1362
+ contentId: p,
1363
+ apiKey: h,
1364
+ variationId: c !== p ? c : void 0
1365
+ });
1366
+ }
1367
+ de() && t.current && t.current.dispatchEvent(new CustomEvent("initpreviewingbldr"));
1368
+ }
1369
+ }, []), b(() => {
1370
+ e.apiKey || ce.error(
1371
+ "No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
1372
+ ), I(), H(), R();
1373
+ }, []), b(() => {
1374
+ e.content && u(e.content);
1375
+ }, [e.content]), b(() => {
1376
+ }, [r]), b(() => {
1377
+ I();
1378
+ }, [(K = (q = e.builderContextSignal.content) == null ? void 0 : q.data) == null ? void 0 : K.jsCode]), b(() => {
1379
+ H();
1380
+ }, [(B = (_ = e.builderContextSignal.content) == null ? void 0 : _.data) == null ? void 0 : B.httpRequests]), b(() => {
1381
+ R();
1382
+ }, [e.builderContextSignal.rootState]), b(() => {
1383
+ e.data && d(e.data);
1384
+ }, [e.data]), b(() => {
1385
+ e.locale && d({
1386
+ locale: e.locale
1387
+ });
1388
+ }, [e.locale]), b(() => () => {
1389
+ L() && (window.removeEventListener("message", x), window.removeEventListener(
1390
+ "builder:component:stateChangeListenerActivated",
1391
+ R
1392
+ ));
1393
+ }, []), /* @__PURE__ */ g(Ve.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content ? /* @__PURE__ */ g(w, { children: /* @__PURE__ */ le(
1394
+ l,
1395
+ {
1396
+ key: n,
1397
+ ref: t,
1398
+ onClick: (a) => S(a),
1399
+ "builder-content-id": (M = e.builderContextSignal.content) == null ? void 0 : M.id,
1400
+ "builder-model": e.model,
1401
+ ...e.showContent ? {} : {
1402
+ hidden: !0,
1403
+ "aria-hidden": !0
1404
+ },
1405
+ ...e.contentWrapperProps,
1406
+ className: `variant-${((N = e.content) == null ? void 0 : N.testVariationId) || ((O = e.content) == null ? void 0 : O.id)}`
1407
+ },
1408
+ e.children
1409
+ ) }) : null });
1410
+ }
1411
+ const pt = (e) => {
1412
+ var u, r;
1413
+ const t = e.family + (e.kind && !e.kind.includes("#") ? ", " + e.kind : ""), n = t.split(",")[0], o = (r = e.fileUrl) != null ? r : (u = e == null ? void 0 : e.files) == null ? void 0 : u.regular;
1414
+ let d = "";
1415
+ if (o && t && n && (d += `
1416
+ @font-face {
1417
+ font-family: "${t}";
1418
+ src: local("${n}"), url('${o}') format('woff2');
1419
+ font-display: fallback;
1420
+ font-weight: 400;
1421
+ }
1422
+ `.trim()), e.files)
1423
+ for (const m in e.files) {
1424
+ if (!(String(Number(m)) === m))
1425
+ continue;
1426
+ const f = e.files[m];
1427
+ f && f !== o && (d += `
1428
+ @font-face {
1429
+ font-family: "${t}";
1430
+ src: url('${f}') format('woff2');
1431
+ font-display: fallback;
1432
+ font-weight: ${m};
1433
+ }
1434
+ `.trim());
1435
+ }
1436
+ return d;
1437
+ }, gt = ({
1438
+ customFonts: e
1439
+ }) => {
1440
+ var t;
1441
+ return ((t = e == null ? void 0 : e.map((n) => pt(n))) == null ? void 0 : t.join(" ")) || "";
1442
+ }, ft = ({
1443
+ cssCode: e,
1444
+ contentId: t
1445
+ }) => e ? t ? (e == null ? void 0 : e.replace(/&/g, `div[builder-content-id="${t}"]`)) || "" : e : "";
1446
+ function ht(e) {
1447
+ const [t, n] = y(
1448
+ () => `
1449
+ ${ft({
1450
+ cssCode: e.cssCode,
1451
+ contentId: e.contentId
1452
+ })}
1453
+ ${gt({
1454
+ customFonts: e.customFonts
1455
+ })}
1456
+
1457
+ .builder-button {
1458
+ all: unset;
1459
+ }
1460
+
1461
+ .builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
1462
+ margin: 0;
1463
+ }
1464
+ .builder-text > p, .builder-text > .builder-paragraph {
1465
+ color: inherit;
1466
+ line-height: inherit;
1467
+ letter-spacing: inherit;
1468
+ font-weight: inherit;
1469
+ font-size: inherit;
1470
+ text-align: inherit;
1471
+ font-family: inherit;
1472
+ }
1473
+ `.trim()
1474
+ );
1475
+ return /* @__PURE__ */ g(te, { styles: t });
1476
+ }
1477
+ const bt = ({
1478
+ content: e,
1479
+ data: t,
1480
+ locale: n
1481
+ }) => {
1482
+ var u, r, m;
1483
+ const o = {}, d = ((u = e == null ? void 0 : e.data) == null ? void 0 : u.state) || {};
1484
+ return (m = (r = e == null ? void 0 : e.data) == null ? void 0 : r.inputs) == null || m.forEach((l) => {
1485
+ l.name && l.defaultValue !== void 0 && (o[l.name] = l.defaultValue);
1486
+ }), {
1487
+ ...o,
1488
+ ...d,
1489
+ ...t,
1490
+ ...n ? {
1491
+ locale: n
1492
+ } : {}
1493
+ };
1494
+ }, yt = ({
1495
+ content: e,
1496
+ data: t
1497
+ }) => e ? {
1498
+ ...e,
1499
+ data: {
1500
+ ...e == null ? void 0 : e.data,
1501
+ ...t
1502
+ },
1503
+ meta: e == null ? void 0 : e.meta
1504
+ } : void 0;
1505
+ function Z(e) {
1506
+ var l, f, x, I, k, A, V;
1507
+ const [t, n] = y(
1508
+ () => {
1509
+ var v, S;
1510
+ return lt({
1511
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
1512
+ variationId: (v = e.content) == null ? void 0 : v.testVariationId,
1513
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
1514
+ contentId: (S = e.content) == null ? void 0 : S.id
1515
+ });
1516
+ }
1517
+ );
1518
+ function o(v) {
1519
+ m((S) => ({
1520
+ ...S,
1521
+ rootState: v
1522
+ }));
1523
+ }
1524
+ const [d, u] = y(
1525
+ () => [
1526
+ ...Q(),
1527
+ ...e.customComponents || []
1528
+ ].reduce(
1529
+ (v, { component: S, ...T }) => ({
1530
+ ...v,
1531
+ [T.name]: {
1532
+ component: S,
1533
+ ...J(T)
1534
+ }
1535
+ }),
1536
+ {}
1537
+ )
1538
+ ), [r, m] = y(() => ({
1539
+ content: yt({
1540
+ content: e.content,
1541
+ data: e.data
1542
+ }),
1543
+ localState: void 0,
1544
+ rootState: bt({
1545
+ content: e.content,
1546
+ data: e.data,
1547
+ locale: e.locale
1548
+ }),
1549
+ rootSetState: o,
1550
+ context: e.context || {},
1551
+ apiKey: e.apiKey,
1552
+ apiVersion: e.apiVersion,
1553
+ componentInfos: [
1554
+ ...Q(),
1555
+ ...e.customComponents || []
1556
+ ].reduce(
1557
+ (v, { component: S, ...T }) => ({
1558
+ ...v,
1559
+ [T.name]: J(T)
1560
+ }),
1561
+ {}
1562
+ ),
1563
+ inheritedStyles: {},
1564
+ BlocksWrapper: e.blocksWrapper || "div",
1565
+ BlocksWrapperProps: e.blocksWrapperProps || {}
1566
+ }));
1567
+ return /* @__PURE__ */ g(
1568
+ Ee.Provider,
1569
+ {
1570
+ value: {
1571
+ registeredComponents: d
1572
+ },
1573
+ children: /* @__PURE__ */ U(
1574
+ mt,
1575
+ {
1576
+ content: e.content,
1577
+ data: e.data,
1578
+ model: e.model,
1579
+ context: e.context,
1580
+ apiKey: e.apiKey,
1581
+ canTrack: e.canTrack,
1582
+ locale: e.locale,
1583
+ enrich: e.enrich,
1584
+ showContent: e.showContent,
1585
+ builderContextSignal: r,
1586
+ contentWrapper: e.contentWrapper,
1587
+ contentWrapperProps: e.contentWrapperProps,
1588
+ linkComponent: e.linkComponent,
1589
+ trustedHosts: e.trustedHosts,
1590
+ setBuilderContextSignal: m,
1591
+ children: [
1592
+ e.isSsrAbTest ? /* @__PURE__ */ g(w, { children: /* @__PURE__ */ g($, { scriptStr: t }) }) : null,
1593
+ /* @__PURE__ */ g(w, { children: /* @__PURE__ */ g(
1594
+ ht,
1595
+ {
1596
+ contentId: (l = r.content) == null ? void 0 : l.id,
1597
+ cssCode: (x = (f = r.content) == null ? void 0 : f.data) == null ? void 0 : x.cssCode,
1598
+ customFonts: (k = (I = r.content) == null ? void 0 : I.data) == null ? void 0 : k.customFonts
1599
+ }
1600
+ ) }),
1601
+ /* @__PURE__ */ g(
1602
+ Fe,
1603
+ {
1604
+ blocks: (V = (A = r.content) == null ? void 0 : A.data) == null ? void 0 : V.blocks,
1605
+ context: r,
1606
+ registeredComponents: d,
1607
+ linkComponent: e.linkComponent
1608
+ }
1609
+ )
1610
+ ]
1611
+ }
1612
+ )
1613
+ }
1614
+ );
1615
+ }
1616
+ function wt(e) {
1617
+ var r, m;
1618
+ const [t, n] = y(
1619
+ () => it({
1620
+ canTrack: W(e.canTrack),
1621
+ content: e.content
1622
+ })
1623
+ );
1624
+ function o() {
1625
+ var l;
1626
+ return st(
1627
+ F(e.content).map((f) => ({
1628
+ id: f.testVariationId,
1629
+ testRatio: f.testRatio
1630
+ })),
1631
+ ((l = e.content) == null ? void 0 : l.id) || ""
1632
+ );
1633
+ }
1634
+ function d() {
1635
+ return F(e.content).map((l) => `.variant-${l.testVariationId} { display: none; } `).join("");
1636
+ }
1637
+ function u() {
1638
+ var l;
1639
+ return t ? {
1640
+ ...e.content,
1641
+ testVariationId: (l = e.content) == null ? void 0 : l.id
1642
+ } : ye({
1643
+ item: e.content,
1644
+ canTrack: W(e.canTrack)
1645
+ });
1646
+ }
1647
+ return b(() => {
1648
+ }, []), /* @__PURE__ */ U(w, { children: [
1649
+ !e.__isNestedRender && ee !== "reactNative" ? /* @__PURE__ */ g(w, { children: /* @__PURE__ */ g($, { scriptStr: rt() }) }) : null,
1650
+ t ? /* @__PURE__ */ U(w, { children: [
1651
+ /* @__PURE__ */ g(
1652
+ te,
1653
+ {
1654
+ id: `variants-styles-${(r = e.content) == null ? void 0 : r.id}`,
1655
+ styles: d()
1656
+ }
1657
+ ),
1658
+ /* @__PURE__ */ g($, { scriptStr: o() }),
1659
+ (m = F(e.content)) == null ? void 0 : m.map((l) => /* @__PURE__ */ g(
1660
+ Z,
1661
+ {
1662
+ content: l,
1663
+ showContent: !1,
1664
+ model: e.model,
1665
+ data: e.data,
1666
+ context: e.context,
1667
+ apiKey: e.apiKey,
1668
+ apiVersion: e.apiVersion,
1669
+ customComponents: e.customComponents,
1670
+ linkComponent: e.linkComponent,
1671
+ canTrack: e.canTrack,
1672
+ locale: e.locale,
1673
+ enrich: e.enrich,
1674
+ isSsrAbTest: t,
1675
+ blocksWrapper: e.blocksWrapper,
1676
+ blocksWrapperProps: e.blocksWrapperProps,
1677
+ contentWrapper: e.contentWrapper,
1678
+ contentWrapperProps: e.contentWrapperProps,
1679
+ trustedHosts: e.trustedHosts
1680
+ },
1681
+ l.testVariationId
1682
+ ))
1683
+ ] }) : null,
1684
+ /* @__PURE__ */ g(
1685
+ Z,
1686
+ {
1687
+ content: u(),
1688
+ showContent: !0,
1689
+ model: e.model,
1690
+ data: e.data,
1691
+ context: e.context,
1692
+ apiKey: e.apiKey,
1693
+ apiVersion: e.apiVersion,
1694
+ customComponents: e.customComponents,
1695
+ linkComponent: e.linkComponent,
1696
+ canTrack: e.canTrack,
1697
+ locale: e.locale,
1698
+ enrich: e.enrich,
1699
+ isSsrAbTest: t,
1700
+ blocksWrapper: e.blocksWrapper,
1701
+ blocksWrapperProps: e.blocksWrapperProps,
1702
+ contentWrapper: e.contentWrapper,
1703
+ contentWrapperProps: e.contentWrapperProps,
1704
+ trustedHosts: e.trustedHosts
1705
+ }
1706
+ )
1707
+ ] });
1708
+ }
1709
+ export {
1710
+ wt as default
1711
+ };