pagiera 0.2.0-alpha.33

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 (192) hide show
  1. package/README.md +528 -0
  2. package/dist/adapters.d.ts +89 -0
  3. package/dist/adapters.d.ts.map +1 -0
  4. package/dist/adapters.js +2 -0
  5. package/dist/adapters.js.map +1 -0
  6. package/dist/client.d.ts +22 -0
  7. package/dist/client.d.ts.map +1 -0
  8. package/dist/client.js +33 -0
  9. package/dist/client.js.map +1 -0
  10. package/dist/data.js +210 -0
  11. package/dist/data.js.map +7 -0
  12. package/dist/document.d.ts +63 -0
  13. package/dist/document.d.ts.map +1 -0
  14. package/dist/document.js +25 -0
  15. package/dist/document.js.map +1 -0
  16. package/dist/editor.d.ts +14 -0
  17. package/dist/editor.d.ts.map +1 -0
  18. package/dist/editor.js +59 -0
  19. package/dist/editor.js.map +1 -0
  20. package/dist/full-editor.d.ts +53 -0
  21. package/dist/full-editor.js +11117 -0
  22. package/dist/full-editor.js.map +7 -0
  23. package/dist/full.css +3498 -0
  24. package/dist/index.d.ts +8 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +7 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/internal/app/api/ai-design/route.d.ts +3 -0
  29. package/dist/internal/app/api/ai-design/route.d.ts.map +1 -0
  30. package/dist/internal/app/api/ai-design/route.js +165 -0
  31. package/dist/internal/app/api/ai-design/route.js.map +1 -0
  32. package/dist/internal/app/p/editor/ai-panel.d.ts +27 -0
  33. package/dist/internal/app/p/editor/ai-panel.d.ts.map +1 -0
  34. package/dist/internal/app/p/editor/ai-panel.js +77 -0
  35. package/dist/internal/app/p/editor/ai-panel.js.map +1 -0
  36. package/dist/internal/app/p/editor/data-modal.d.ts +26 -0
  37. package/dist/internal/app/p/editor/data-modal.d.ts.map +1 -0
  38. package/dist/internal/app/p/editor/data-modal.js +94 -0
  39. package/dist/internal/app/p/editor/data-modal.js.map +1 -0
  40. package/dist/internal/app/p/editor/data-panel.d.ts +18 -0
  41. package/dist/internal/app/p/editor/data-panel.d.ts.map +1 -0
  42. package/dist/internal/app/p/editor/data-panel.js +45 -0
  43. package/dist/internal/app/p/editor/data-panel.js.map +1 -0
  44. package/dist/internal/app/p/editor/editor.d.ts +51 -0
  45. package/dist/internal/app/p/editor/editor.d.ts.map +1 -0
  46. package/dist/internal/app/p/editor/editor.js +1551 -0
  47. package/dist/internal/app/p/editor/editor.js.map +1 -0
  48. package/dist/internal/app/p/editor/fields.d.ts +111 -0
  49. package/dist/internal/app/p/editor/fields.d.ts.map +1 -0
  50. package/dist/internal/app/p/editor/fields.js +141 -0
  51. package/dist/internal/app/p/editor/fields.js.map +1 -0
  52. package/dist/internal/app/p/editor/inspector.d.ts +38 -0
  53. package/dist/internal/app/p/editor/inspector.d.ts.map +1 -0
  54. package/dist/internal/app/p/editor/inspector.js +336 -0
  55. package/dist/internal/app/p/editor/inspector.js.map +1 -0
  56. package/dist/internal/app/p/editor/library.d.ts +18 -0
  57. package/dist/internal/app/p/editor/library.d.ts.map +1 -0
  58. package/dist/internal/app/p/editor/library.js +61 -0
  59. package/dist/internal/app/p/editor/library.js.map +1 -0
  60. package/dist/internal/app/p/editor/parts.d.ts +75 -0
  61. package/dist/internal/app/p/editor/parts.d.ts.map +1 -0
  62. package/dist/internal/app/p/editor/parts.js +261 -0
  63. package/dist/internal/app/p/editor/parts.js.map +1 -0
  64. package/dist/internal/app/p/editor/templates-panel.d.ts +6 -0
  65. package/dist/internal/app/p/editor/templates-panel.d.ts.map +1 -0
  66. package/dist/internal/app/p/editor/templates-panel.js +12 -0
  67. package/dist/internal/app/p/editor/templates-panel.js.map +1 -0
  68. package/dist/internal/app/p/editor/use-canvas-view.d.ts +24 -0
  69. package/dist/internal/app/p/editor/use-canvas-view.d.ts.map +1 -0
  70. package/dist/internal/app/p/editor/use-canvas-view.js +242 -0
  71. package/dist/internal/app/p/editor/use-canvas-view.js.map +1 -0
  72. package/dist/internal/app/p/editor/use-editor.d.ts +48 -0
  73. package/dist/internal/app/p/editor/use-editor.d.ts.map +1 -0
  74. package/dist/internal/app/p/editor/use-editor.js +224 -0
  75. package/dist/internal/app/p/editor/use-editor.js.map +1 -0
  76. package/dist/internal/app/p/editor/variables-panel.d.ts +8 -0
  77. package/dist/internal/app/p/editor/variables-panel.d.ts.map +1 -0
  78. package/dist/internal/app/p/editor/variables-panel.js +52 -0
  79. package/dist/internal/app/p/editor/variables-panel.js.map +1 -0
  80. package/dist/internal/components/ui/select.d.ts +12 -0
  81. package/dist/internal/components/ui/select.d.ts.map +1 -0
  82. package/dist/internal/components/ui/select.js +32 -0
  83. package/dist/internal/components/ui/select.js.map +1 -0
  84. package/dist/internal/drizzle/index.d.ts +6 -0
  85. package/dist/internal/drizzle/index.d.ts.map +1 -0
  86. package/dist/internal/drizzle/index.js +20 -0
  87. package/dist/internal/drizzle/index.js.map +1 -0
  88. package/dist/internal/drizzle/schema.d.ts +405 -0
  89. package/dist/internal/drizzle/schema.d.ts.map +1 -0
  90. package/dist/internal/drizzle/schema.js +70 -0
  91. package/dist/internal/drizzle/schema.js.map +1 -0
  92. package/dist/internal/lib/data/context.d.ts +8 -0
  93. package/dist/internal/lib/data/context.d.ts.map +1 -0
  94. package/dist/internal/lib/data/context.js +17 -0
  95. package/dist/internal/lib/data/context.js.map +1 -0
  96. package/dist/internal/lib/data/source.d.ts +54 -0
  97. package/dist/internal/lib/data/source.d.ts.map +1 -0
  98. package/dist/internal/lib/data/source.js +229 -0
  99. package/dist/internal/lib/data/source.js.map +1 -0
  100. package/dist/internal/lib/editor/ai-types.d.ts +44 -0
  101. package/dist/internal/lib/editor/ai-types.d.ts.map +1 -0
  102. package/dist/internal/lib/editor/ai-types.js +2 -0
  103. package/dist/internal/lib/editor/ai-types.js.map +1 -0
  104. package/dist/internal/lib/editor/arrange.d.ts +12 -0
  105. package/dist/internal/lib/editor/arrange.d.ts.map +1 -0
  106. package/dist/internal/lib/editor/arrange.js +72 -0
  107. package/dist/internal/lib/editor/arrange.js.map +1 -0
  108. package/dist/internal/lib/editor/cascade.d.ts +39 -0
  109. package/dist/internal/lib/editor/cascade.d.ts.map +1 -0
  110. package/dist/internal/lib/editor/cascade.js +86 -0
  111. package/dist/internal/lib/editor/cascade.js.map +1 -0
  112. package/dist/internal/lib/editor/icon.d.ts +6 -0
  113. package/dist/internal/lib/editor/icon.d.ts.map +1 -0
  114. package/dist/internal/lib/editor/icon.js +13 -0
  115. package/dist/internal/lib/editor/icon.js.map +1 -0
  116. package/dist/internal/lib/editor/presets.d.ts +10 -0
  117. package/dist/internal/lib/editor/presets.d.ts.map +1 -0
  118. package/dist/internal/lib/editor/presets.js +83 -0
  119. package/dist/internal/lib/editor/presets.js.map +1 -0
  120. package/dist/internal/lib/editor/showcase.d.ts +14 -0
  121. package/dist/internal/lib/editor/showcase.d.ts.map +1 -0
  122. package/dist/internal/lib/editor/showcase.js +219 -0
  123. package/dist/internal/lib/editor/showcase.js.map +1 -0
  124. package/dist/internal/lib/editor/site-templates.d.ts +4 -0
  125. package/dist/internal/lib/editor/site-templates.d.ts.map +1 -0
  126. package/dist/internal/lib/editor/site-templates.js +156 -0
  127. package/dist/internal/lib/editor/site-templates.js.map +1 -0
  128. package/dist/internal/lib/editor/snap.d.ts +34 -0
  129. package/dist/internal/lib/editor/snap.d.ts.map +1 -0
  130. package/dist/internal/lib/editor/snap.js +70 -0
  131. package/dist/internal/lib/editor/snap.js.map +1 -0
  132. package/dist/internal/lib/editor/style.d.ts +53 -0
  133. package/dist/internal/lib/editor/style.d.ts.map +1 -0
  134. package/dist/internal/lib/editor/style.js +313 -0
  135. package/dist/internal/lib/editor/style.js.map +1 -0
  136. package/dist/internal/lib/editor/tree.d.ts +72 -0
  137. package/dist/internal/lib/editor/tree.d.ts.map +1 -0
  138. package/dist/internal/lib/editor/tree.js +301 -0
  139. package/dist/internal/lib/editor/tree.js.map +1 -0
  140. package/dist/internal/lib/editor/types.d.ts +273 -0
  141. package/dist/internal/lib/editor/types.d.ts.map +1 -0
  142. package/dist/internal/lib/editor/types.js +411 -0
  143. package/dist/internal/lib/editor/types.js.map +1 -0
  144. package/dist/internal/lib/editor/validate.d.ts +20 -0
  145. package/dist/internal/lib/editor/validate.d.ts.map +1 -0
  146. package/dist/internal/lib/editor/validate.js +467 -0
  147. package/dist/internal/lib/editor/validate.js.map +1 -0
  148. package/dist/internal/lib/pages.d.ts +83 -0
  149. package/dist/internal/lib/pages.d.ts.map +1 -0
  150. package/dist/internal/lib/pages.js +294 -0
  151. package/dist/internal/lib/pages.js.map +1 -0
  152. package/dist/internal/lib/render/bind.d.ts +18 -0
  153. package/dist/internal/lib/render/bind.d.ts.map +1 -0
  154. package/dist/internal/lib/render/bind.js +28 -0
  155. package/dist/internal/lib/render/bind.js.map +1 -0
  156. package/dist/internal/lib/render/css.d.ts +31 -0
  157. package/dist/internal/lib/render/css.d.ts.map +1 -0
  158. package/dist/internal/lib/render/css.js +239 -0
  159. package/dist/internal/lib/render/css.js.map +1 -0
  160. package/dist/internal/lib/render/load-data.d.ts +15 -0
  161. package/dist/internal/lib/render/load-data.d.ts.map +1 -0
  162. package/dist/internal/lib/render/load-data.js +39 -0
  163. package/dist/internal/lib/render/load-data.js.map +1 -0
  164. package/dist/internal/lib/render/page-render.d.ts +17 -0
  165. package/dist/internal/lib/render/page-render.d.ts.map +1 -0
  166. package/dist/internal/lib/render/page-render.js +117 -0
  167. package/dist/internal/lib/render/page-render.js.map +1 -0
  168. package/dist/internal/lib/utils.d.ts +3 -0
  169. package/dist/internal/lib/utils.d.ts.map +1 -0
  170. package/dist/internal/lib/utils.js +6 -0
  171. package/dist/internal/lib/utils.js.map +1 -0
  172. package/dist/manrope-data.d.ts +3 -0
  173. package/dist/manrope-data.d.ts.map +1 -0
  174. package/dist/manrope-data.js +3 -0
  175. package/dist/manrope-data.js.map +1 -0
  176. package/dist/page.d.ts +9 -0
  177. package/dist/page.d.ts.map +1 -0
  178. package/dist/page.js +148 -0
  179. package/dist/page.js.map +1 -0
  180. package/dist/provider.d.ts +14 -0
  181. package/dist/provider.d.ts.map +1 -0
  182. package/dist/provider.js +45 -0
  183. package/dist/provider.js.map +1 -0
  184. package/dist/runtime.d.ts +8 -0
  185. package/dist/runtime.js +717 -0
  186. package/dist/runtime.js.map +7 -0
  187. package/dist/server.d.ts +31 -0
  188. package/dist/server.js +2267 -0
  189. package/dist/server.js.map +7 -0
  190. package/dist/styles.css +300 -0
  191. package/package.json +94 -0
  192. package/thumbnail.png +0 -0
@@ -0,0 +1,717 @@
1
+ // src/internal/lib/render/page-render.tsx
2
+ import React from "react";
3
+
4
+ // src/internal/lib/editor/types.ts
5
+ var DEFAULT_BREAKPOINTS = [
6
+ { id: "desktop", name: "Desktop", width: 1280 },
7
+ { id: "tablet", name: "Tablet", width: 768 },
8
+ { id: "mobile", name: "Mobile", width: 375 }
9
+ ];
10
+
11
+ // src/internal/lib/editor/cascade.ts
12
+ var DEFAULT_CASCADE = {
13
+ breakpoints: DEFAULT_BREAKPOINTS,
14
+ baseId: "desktop"
15
+ };
16
+ function cascadeOf(breakpoints, baseId) {
17
+ const list = breakpoints?.length ? breakpoints : DEFAULT_BREAKPOINTS;
18
+ const base = list.find((item) => item.id === baseId) ?? widest(list);
19
+ return { breakpoints: list, baseId: base.id };
20
+ }
21
+ function widest(list) {
22
+ return list.reduce((a, b) => b.width > a.width ? b : a, list[0]);
23
+ }
24
+ function baseOf(cascade) {
25
+ return cascade.breakpoints.find((item) => item.id === cascade.baseId) ?? widest(cascade.breakpoints);
26
+ }
27
+ function overrideChain(cascade, targetId) {
28
+ const base = baseOf(cascade);
29
+ if (targetId === base.id) return [];
30
+ const target = cascade.breakpoints.find((item) => item.id === targetId);
31
+ if (!target) return [];
32
+ const goingNarrower = target.width < base.width;
33
+ const between = cascade.breakpoints.filter((item) => {
34
+ if (item.id === base.id) return false;
35
+ return goingNarrower ? item.width < base.width && item.width >= target.width : item.width > base.width && item.width <= target.width;
36
+ });
37
+ between.sort((a, b) => goingNarrower ? b.width - a.width : a.width - b.width);
38
+ return between.map((item) => item.id);
39
+ }
40
+ function mediaPlan(cascade) {
41
+ const base = baseOf(cascade);
42
+ const narrower = cascade.breakpoints.filter((item) => item.id !== base.id && item.width < base.width).sort((a, b) => b.width - a.width).map((item) => {
43
+ const ceiling = cascade.breakpoints.filter((other) => other.width > item.width).reduce(
44
+ (lowest, other) => Math.min(lowest, other.width),
45
+ Number.POSITIVE_INFINITY
46
+ );
47
+ return { id: item.id, query: `(max-width: ${ceiling - 1}px)` };
48
+ });
49
+ const wider = cascade.breakpoints.filter((item) => item.id !== base.id && item.width > base.width).sort((a, b) => a.width - b.width).map((item) => ({ id: item.id, query: `(min-width: ${item.width}px)` }));
50
+ return [...narrower, ...wider];
51
+ }
52
+ var chainCache = /* @__PURE__ */ new WeakMap();
53
+ function chainFor(cascade, targetId) {
54
+ let byTarget = chainCache.get(cascade);
55
+ if (!byTarget) {
56
+ byTarget = /* @__PURE__ */ new Map();
57
+ chainCache.set(cascade, byTarget);
58
+ }
59
+ const cached = byTarget.get(targetId);
60
+ if (cached) return cached;
61
+ const chain = overrideChain(cascade, targetId);
62
+ byTarget.set(targetId, chain);
63
+ return chain;
64
+ }
65
+
66
+ // src/internal/lib/editor/style.ts
67
+ function resolveStyle(element, breakpoint, cascade = DEFAULT_CASCADE) {
68
+ let style = element.base;
69
+ for (const step of chainFor(cascade, breakpoint)) {
70
+ const override = element.overrides?.[step];
71
+ if (override) style = { ...style, ...override };
72
+ }
73
+ return style;
74
+ }
75
+ var JUSTIFY_MAP = {
76
+ start: "flex-start",
77
+ center: "center",
78
+ end: "flex-end",
79
+ between: "space-between"
80
+ };
81
+ var ALIGN_MAP = {
82
+ start: "flex-start",
83
+ center: "center",
84
+ end: "flex-end",
85
+ stretch: "stretch"
86
+ };
87
+ function styleToCss(style, context, element) {
88
+ const css = {
89
+ boxSizing: "border-box",
90
+ display: "flex",
91
+ flexDirection: style.direction,
92
+ gap: style.gap || void 0,
93
+ justifyContent: JUSTIFY_MAP[style.justify],
94
+ alignItems: ALIGN_MAP[style.align],
95
+ flexWrap: style.wrap ? "wrap" : "nowrap",
96
+ paddingTop: style.padT || void 0,
97
+ paddingRight: style.padR || void 0,
98
+ paddingBottom: style.padB || void 0,
99
+ paddingLeft: style.padL || void 0,
100
+ backgroundColor: style.bg || void 0,
101
+ // A gradient and a photo can be layered; the gradient is painted first
102
+ // so it reads as a scrim over the image.
103
+ backgroundImage: [style.gradient, style.bgImage && `url("${style.bgImage}")`].filter(Boolean).join(", ") || void 0,
104
+ backgroundSize: style.bgImage ? style.bgSize : void 0,
105
+ backgroundPosition: style.bgImage ? style.bgPosition : void 0,
106
+ backgroundRepeat: style.bgImage ? "no-repeat" : void 0,
107
+ overflow: style.overflow === "visible" ? void 0 : style.overflow,
108
+ aspectRatio: style.aspectRatio || void 0,
109
+ cursor: style.cursor === "auto" ? void 0 : style.cursor,
110
+ mixBlendMode: style.blendMode === "normal" ? void 0 : style.blendMode,
111
+ filter: style.blur ? `blur(${style.blur}px)` : void 0,
112
+ backdropFilter: style.backdropBlur ? `blur(${style.backdropBlur}px)` : void 0,
113
+ color: style.color,
114
+ borderRadius: style.radius || void 0,
115
+ opacity: style.opacity === 100 ? void 0 : style.opacity / 100,
116
+ borderWidth: style.borderW || void 0,
117
+ borderColor: style.borderW ? style.borderC : void 0,
118
+ borderStyle: style.borderW ? style.borderStyle : void 0,
119
+ boxShadow: style.shadow || void 0,
120
+ transform: [
121
+ style.rotate ? `rotate(${style.rotate}deg)` : "",
122
+ style.scale === 100 ? "" : `scale(${style.scale / 100})`
123
+ ].filter(Boolean).join(" ") || void 0,
124
+ fontFamily: style.fontFamily === "inherit" ? void 0 : style.fontFamily,
125
+ fontSize: style.fontSize,
126
+ fontWeight: style.fontWeight,
127
+ lineHeight: style.lineHeight,
128
+ letterSpacing: style.letterSpacing || void 0,
129
+ textAlign: style.textAlign,
130
+ textTransform: style.textTransform
131
+ };
132
+ if (element?.type === "Grid" && style.layout === "stack") {
133
+ css.display = "grid";
134
+ css.gridTemplateColumns = `repeat(${Math.max(1, style.columns)}, minmax(0, 1fr))`;
135
+ css.alignItems = ALIGN_MAP[style.align];
136
+ }
137
+ if (style.layout === "absolute") {
138
+ css.display = "block";
139
+ }
140
+ if (context.parentLayout === "absolute") {
141
+ css.position = "absolute";
142
+ css.left = style.x;
143
+ css.top = style.y;
144
+ css.width = style.widthMode === "fixed" ? style.w : "max-content";
145
+ css.height = style.heightMode === "fixed" ? style.h : "max-content";
146
+ if (style.widthMode === "fill") css.width = "100%";
147
+ if (style.heightMode === "fill") css.height = "100%";
148
+ const transforms = [];
149
+ if (style.constraintX === "center") {
150
+ css.left = `calc(50% + ${style.x}px)`;
151
+ transforms.push("translateX(-50%)");
152
+ } else if (style.constraintX === "end") {
153
+ css.left = void 0;
154
+ css.right = style.x;
155
+ } else if (style.constraintX === "stretch") {
156
+ css.left = style.x;
157
+ css.right = style.x;
158
+ css.width = "auto";
159
+ }
160
+ if (style.constraintY === "center") {
161
+ css.top = `calc(50% + ${style.y}px)`;
162
+ transforms.push("translateY(-50%)");
163
+ } else if (style.constraintY === "end") {
164
+ css.top = void 0;
165
+ css.bottom = style.y;
166
+ } else if (style.constraintY === "stretch") {
167
+ css.top = style.y;
168
+ css.bottom = style.y;
169
+ css.height = "auto";
170
+ }
171
+ if (css.transform) transforms.push(String(css.transform));
172
+ css.transform = transforms.join(" ") || void 0;
173
+ return css;
174
+ }
175
+ css.position = style.position === "sticky" ? "sticky" : "relative";
176
+ if (style.position === "sticky") css.top = style.stickyOffset;
177
+ const mainAxisIsWidth = context.parentDirection === "row";
178
+ applySize(css, "width", style.widthMode, style.w, mainAxisIsWidth);
179
+ applySize(css, "height", style.heightMode, style.h, !mainAxisIsWidth);
180
+ return css;
181
+ }
182
+ function applySize(css, axis, mode, value, isMainAxis) {
183
+ if (mode === "fixed") {
184
+ css[axis] = value;
185
+ if (isMainAxis) css.flexShrink = 0;
186
+ return;
187
+ }
188
+ if (mode === "auto") {
189
+ css[axis] = "auto";
190
+ if (isMainAxis) css.flexGrow = 0;
191
+ else css.alignSelf = "flex-start";
192
+ return;
193
+ }
194
+ css[axis] = "auto";
195
+ if (isMainAxis) {
196
+ css.flexGrow = 1;
197
+ css.flexBasis = 0;
198
+ } else {
199
+ css.alignSelf = "stretch";
200
+ }
201
+ }
202
+ function splitBand(css, contentWidth) {
203
+ const inner = {
204
+ boxSizing: "border-box",
205
+ display: css.display,
206
+ flexDirection: css.flexDirection,
207
+ gap: css.gap,
208
+ justifyContent: css.justifyContent,
209
+ alignItems: css.alignItems,
210
+ flexWrap: css.flexWrap,
211
+ gridTemplateColumns: css.gridTemplateColumns,
212
+ width: "100%",
213
+ maxWidth: contentWidth,
214
+ marginLeft: "auto",
215
+ marginRight: "auto"
216
+ };
217
+ const shell = { ...css };
218
+ shell.flexDirection = void 0;
219
+ shell.gap = void 0;
220
+ shell.justifyContent = void 0;
221
+ shell.alignItems = void 0;
222
+ shell.flexWrap = void 0;
223
+ shell.gridTemplateColumns = void 0;
224
+ shell.display = "block";
225
+ return { shell, inner };
226
+ }
227
+ function isBand(type, style, root) {
228
+ return type === "Section" && style.layout === "stack" && !root.fullWidth;
229
+ }
230
+ function rootStyleToCss(root) {
231
+ return {
232
+ boxSizing: "border-box",
233
+ display: root.layout === "stack" ? "flex" : "block",
234
+ flexDirection: root.direction,
235
+ gap: root.gap || void 0,
236
+ alignItems: ALIGN_MAP[root.align],
237
+ paddingTop: root.padT || void 0,
238
+ paddingRight: root.padR || void 0,
239
+ paddingBottom: root.padB || void 0,
240
+ paddingLeft: root.padL || void 0,
241
+ backgroundColor: root.bg,
242
+ fontFamily: root.fontFamily === "inherit" ? void 0 : root.fontFamily,
243
+ position: "relative",
244
+ minHeight: "100%",
245
+ width: "100%"
246
+ };
247
+ }
248
+
249
+ // src/internal/lib/editor/tree.ts
250
+ function indexById(elements) {
251
+ return new Map(elements.map((el) => [el.id, el]));
252
+ }
253
+ function childrenOf(elements, parentId) {
254
+ return elements.filter((el) => (el.parentId ?? void 0) === parentId).sort((a, b) => a.z - b.z);
255
+ }
256
+ function subtreeIds(elements, rootId) {
257
+ const ids = /* @__PURE__ */ new Set([rootId]);
258
+ let grew = true;
259
+ while (grew) {
260
+ grew = false;
261
+ for (const el of elements) {
262
+ if (el.parentId && ids.has(el.parentId) && !ids.has(el.id)) {
263
+ ids.add(el.id);
264
+ grew = true;
265
+ }
266
+ }
267
+ }
268
+ return ids;
269
+ }
270
+ function absolutePosition(byId, element, breakpoint, cascade = DEFAULT_CASCADE) {
271
+ const own = resolveStyle(element, breakpoint, cascade);
272
+ let x = own.x;
273
+ let y = own.y;
274
+ let parent = element.parentId ? byId.get(element.parentId) : void 0;
275
+ const guard = /* @__PURE__ */ new Set([element.id]);
276
+ while (parent && !guard.has(parent.id)) {
277
+ guard.add(parent.id);
278
+ const style = resolveStyle(parent, breakpoint, cascade);
279
+ x += style.x;
280
+ y += style.y;
281
+ parent = parent.parentId ? byId.get(parent.parentId) : void 0;
282
+ }
283
+ return { x, y };
284
+ }
285
+ function isNote(element, byId, breakpoint, frameWidth, rootLayout = "absolute", cascade = DEFAULT_CASCADE) {
286
+ const parent = element.parentId ? byId.get(element.parentId) : void 0;
287
+ const placedBy = parent ? resolveStyle(parent, breakpoint, cascade).layout : rootLayout;
288
+ if (placedBy !== "absolute") return false;
289
+ const style = resolveStyle(element, breakpoint, cascade);
290
+ const { x } = absolutePosition(byId, element, breakpoint, cascade);
291
+ const right = x + (style.widthMode === "fixed" ? style.w : 0);
292
+ return right <= 0 || x >= frameWidth;
293
+ }
294
+ function noteIds(elements, byId, breakpoint, frameWidth, rootLayout = "absolute", cascade = DEFAULT_CASCADE) {
295
+ const notes = /* @__PURE__ */ new Set();
296
+ for (const element of elements) {
297
+ if (isNote(element, byId, breakpoint, frameWidth, rootLayout, cascade)) {
298
+ for (const id of subtreeIds(elements, element.id)) notes.add(id);
299
+ }
300
+ }
301
+ return notes;
302
+ }
303
+
304
+ // src/internal/lib/data/source.ts
305
+ function selectPath(payload, path) {
306
+ const steps = path.split(".").map((s) => s.trim()).filter(Boolean);
307
+ let cursor = payload;
308
+ for (const step of steps) {
309
+ if (cursor === null || typeof cursor !== "object") return void 0;
310
+ cursor = cursor[step];
311
+ }
312
+ return cursor;
313
+ }
314
+ function readBinding(row, path) {
315
+ const value = selectPath(row, path);
316
+ if (value === null || value === void 0) return "";
317
+ if (typeof value === "object") return "";
318
+ return String(value);
319
+ }
320
+
321
+ // src/internal/lib/render/bind.ts
322
+ function bindElement(element, row) {
323
+ if (!row || !element.binding) return element;
324
+ const value = readBinding(row, element.binding);
325
+ if (element.type === "Image" || element.type === "Video") {
326
+ return value ? { ...element, src: value } : element;
327
+ }
328
+ return { ...element, content: value };
329
+ }
330
+ function rowsFor(element, data, placeholderWhenEmpty) {
331
+ const rows = element.sourceId ? data[element.sourceId] : void 0;
332
+ if (rows && rows.length > 0) return rows;
333
+ return placeholderWhenEmpty ? [void 0] : [];
334
+ }
335
+
336
+ // src/internal/lib/render/css.ts
337
+ var UNITLESS = /* @__PURE__ */ new Set([
338
+ "opacity",
339
+ "zIndex",
340
+ "flexGrow",
341
+ "flexShrink",
342
+ "flexBasis",
343
+ "lineHeight",
344
+ "order",
345
+ "fontWeight",
346
+ "columns"
347
+ ]);
348
+ function kebab(property) {
349
+ return property.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
350
+ }
351
+ function declarationsToCss(css) {
352
+ return Object.entries(css).filter(([, value]) => value !== void 0 && value !== null && value !== "").map(([property, value]) => {
353
+ const rendered = typeof value === "number" && !UNITLESS.has(property) ? `${value}px` : String(value);
354
+ return `${kebab(property)}:${rendered}`;
355
+ }).join(";");
356
+ }
357
+ function classFor(id) {
358
+ return `pg-${id.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
359
+ }
360
+ var DEFAULT_PAGE_FONT = "ui-sans-serif, system-ui, sans-serif";
361
+ function resolveFont(fontFamily) {
362
+ return fontFamily === "inherit" || fontFamily === "" ? DEFAULT_PAGE_FONT : fontFamily;
363
+ }
364
+ function rulesFor(element, byId, breakpoint, rootStyle, cascade) {
365
+ const parent = element.parentId ? byId.get(element.parentId) : void 0;
366
+ const parentStyle = parent ? resolveStyle(parent, breakpoint, cascade) : void 0;
367
+ const style = resolveStyle(element, breakpoint, cascade);
368
+ const css = styleToCss(
369
+ style,
370
+ {
371
+ parentLayout: parentStyle?.layout ?? "stack",
372
+ parentDirection: parentStyle?.direction ?? "column"
373
+ },
374
+ element
375
+ );
376
+ css.zIndex = element.z;
377
+ if (style.hidden) css.display = "none";
378
+ if (!isBand(element.type, style, rootStyle) || style.hidden) {
379
+ return [["", declarationsToCss(css)]];
380
+ }
381
+ const { shell, inner } = splitBand(css, rootStyle.maxWidth);
382
+ return [
383
+ ["", declarationsToCss(shell)],
384
+ [">.pg-inner", declarationsToCss(inner)]
385
+ ];
386
+ }
387
+ var ENTRANCE_KEYFRAMES = `
388
+ @keyframes pg-fade{from{opacity:0}to{opacity:1}}
389
+ @keyframes pg-up{from{opacity:0;translate:0 28px}to{opacity:1;translate:none}}
390
+ @keyframes pg-down{from{opacity:0;translate:0 -28px}to{opacity:1;translate:none}}
391
+ @keyframes pg-left{from{opacity:0;translate:-32px 0}to{opacity:1;translate:none}}
392
+ @keyframes pg-right{from{opacity:0;translate:32px 0}to{opacity:1;translate:none}}
393
+ @keyframes pg-zoom{from{opacity:0;scale:.94}to{opacity:1;scale:none}}
394
+ /* The hidden start state is applied only once the script is running, so a
395
+ visitor without JavaScript still sees every element. */
396
+ .pg-ready .pg-anim{opacity:0}
397
+ /* Revealed elements are visible as a resting value, not only as the end of a
398
+ keyframe: if animations are disabled or never get to run, the content still
399
+ shows rather than staying at zero opacity. */
400
+ .pg-ready .pg-anim.pg-in{opacity:1}
401
+ @media (prefers-reduced-motion:reduce){.pg-ready .pg-anim{opacity:1;animation:none!important}}
402
+ `.trim();
403
+ var ENTRANCE_SCRIPT = `
404
+ (function(){
405
+ var nodes=document.querySelectorAll('.pg-anim');
406
+ if(!nodes.length)return;
407
+ var reveal=function(n){n.classList.add('pg-in');};
408
+ var all=function(){for(var i=0;i<nodes.length;i++)reveal(nodes[i]);};
409
+
410
+ if(!('IntersectionObserver' in window)||!window.matchMedia||matchMedia('(prefers-reduced-motion:reduce)').matches){
411
+ all();return;
412
+ }
413
+ document.documentElement.classList.add('pg-ready');
414
+
415
+ // Anything already in view animates straight away rather than waiting for
416
+ // the observer's first delivery.
417
+ var pending=[];
418
+ for(var i=0;i<nodes.length;i++){
419
+ var r=nodes[i].getBoundingClientRect();
420
+ if(r.top<innerHeight&&r.bottom>0)reveal(nodes[i]);else pending.push(nodes[i]);
421
+ }
422
+
423
+ var io=new IntersectionObserver(function(entries){
424
+ for(var j=0;j<entries.length;j++){
425
+ if(entries[j].isIntersecting){reveal(entries[j].target);io.unobserve(entries[j].target);}
426
+ }
427
+ },{threshold:0.15,rootMargin:'0px 0px -8% 0px'});
428
+ for(var k=0;k<pending.length;k++)io.observe(pending[k]);
429
+
430
+ // Last resort: never leave content invisible because a callback did not run.
431
+ setTimeout(all,3000);
432
+ })();
433
+ `.trim();
434
+ function hasEntrances(elements, cascade = DEFAULT_CASCADE) {
435
+ const baseId = baseOf(cascade).id;
436
+ return elements.some(
437
+ (el) => resolveStyle(el, baseId, cascade).entrance !== "none"
438
+ );
439
+ }
440
+ function stylesheetFor(elements, rootStyle) {
441
+ const byId = new Map(elements.map((el) => [el.id, el]));
442
+ const cascade = cascadeOf(rootStyle.breakpoints, rootStyle.baseBreakpointId);
443
+ const baseId = baseOf(cascade).id;
444
+ const parts = [];
445
+ for (const font of rootStyle.customFonts ?? []) {
446
+ const family = font.name.replace(/["'{};]/g, "");
447
+ const rawUrl = font.url.replace(/["'()\\]/g, "");
448
+ const url = rawUrl === "/fonts/manrope-variable.woff2" ? "/api/pagiera/assets/manrope-variable.woff2" : rawUrl;
449
+ parts.push(`@font-face{font-family:"${family}";src:url("${url}") format("woff2");font-weight:${font.weight};font-style:${font.style};font-display:swap}`);
450
+ }
451
+ parts.push(`html,body{margin:0;padding:0;background:${rootStyle.bg}}`);
452
+ parts.push(`html{scroll-behavior:smooth}.pg-root{${declarationsToCss(rootStyleToCss(rootStyle))}}`);
453
+ parts.push(
454
+ // The font is pinned on `.pg-root` rather than on <body>: the app's
455
+ // layout puts a font class on <body>, which would out-specify an
456
+ // element selector and leak the editor's typeface into the site.
457
+ // The shell spans the viewport; the content width is applied by each
458
+ // band's inner box, so section backgrounds reach both edges.
459
+ `.pg-root{font-family:${resolveFont(rootStyle.fontFamily)}}.pg-node{box-sizing:border-box}.pg-node img{display:block;width:100%;height:100%}.pg-link{text-decoration:none;color:inherit}`
460
+ );
461
+ for (const element of elements) {
462
+ const emitted = rulesFor(element, byId, baseId, rootStyle, cascade).map(([suffix, decl]) => `.${classFor(element.id)}${suffix}{${decl}}`).join("");
463
+ parts.push(emitted);
464
+ }
465
+ for (const plan of mediaPlan(cascade)) {
466
+ const breakpoint = plan.id;
467
+ const affected = elements.filter((el) => {
468
+ if (el.overrides?.[breakpoint]) return true;
469
+ const parent = el.parentId ? byId.get(el.parentId) : void 0;
470
+ return Boolean(parent?.overrides?.[breakpoint]);
471
+ });
472
+ if (affected.length === 0) continue;
473
+ const rules = affected.flatMap(
474
+ (el) => rulesFor(el, byId, breakpoint, rootStyle, cascade).map(
475
+ ([suffix, decl]) => `.${classFor(el.id)}${suffix}{${decl}}`
476
+ )
477
+ ).join("");
478
+ parts.push(`@media ${plan.query}{${rules}}`);
479
+ }
480
+ if (hasEntrances(elements, cascade)) {
481
+ parts.push(ENTRANCE_KEYFRAMES);
482
+ for (const element of elements) {
483
+ const style = resolveStyle(element, baseId, cascade);
484
+ if (style.entrance === "none") continue;
485
+ parts.push(
486
+ `.pg-ready .${classFor(element.id)}.pg-in{animation:pg-${style.entrance} ${style.entranceDuration}ms ${style.entranceCurve === "spring" ? `cubic-bezier(.16,${1 + Math.max(0, 45 - style.springDamping) / 100},${Math.max(0.12, Math.min(0.52, 120 / style.springStiffness))},1)` : `cubic-bezier(${style.entranceBezier})`} ${style.entranceDelay}ms both}`
487
+ );
488
+ }
489
+ }
490
+ for (const element of elements) {
491
+ if (element.hover || element.press) parts.push(`.${classFor(element.id)}{transition:transform .42s cubic-bezier(.16,1,.3,1),scale .42s cubic-bezier(.16,1,.3,1),rotate .42s cubic-bezier(.16,1,.3,1),translate .42s cubic-bezier(.16,1,.3,1),background-color .32s ease,color .32s ease,border-color .32s ease,box-shadow .42s cubic-bezier(.16,1,.3,1),opacity .32s ease,filter .42s ease;will-change:transform}`);
492
+ if (!element.hover || Object.keys(element.hover).length === 0) continue;
493
+ const merged = { ...resolveStyle(element, baseId, cascade), ...element.hover };
494
+ const parent = element.parentId ? byId.get(element.parentId) : void 0;
495
+ const parentStyle = parent ? resolveStyle(parent, baseId, cascade) : void 0;
496
+ const css = styleToCss(
497
+ merged,
498
+ {
499
+ parentLayout: parentStyle?.layout ?? "stack",
500
+ parentDirection: parentStyle?.direction ?? "column"
501
+ },
502
+ element
503
+ );
504
+ parts.push(
505
+ `.${classFor(element.id)}:hover{${declarationsToCss(css)}}`
506
+ );
507
+ }
508
+ for (const element of elements) {
509
+ if (element.press && Object.keys(element.press).length) {
510
+ const merged = { ...resolveStyle(element, baseId, cascade), ...element.press };
511
+ const parent = element.parentId ? byId.get(element.parentId) : void 0;
512
+ const parentStyle = parent ? resolveStyle(parent, baseId, cascade) : void 0;
513
+ const css = styleToCss(merged, { parentLayout: parentStyle?.layout ?? "stack", parentDirection: parentStyle?.direction ?? "column" }, element);
514
+ parts.push(`.${classFor(element.id)}:active{${declarationsToCss(css)}}`);
515
+ }
516
+ if (element.loop) {
517
+ const name = element.loop.type;
518
+ parts.push(`.${classFor(element.id)}{animation:pg-loop-${name} ${element.loop.duration}ms ease-in-out infinite}`);
519
+ }
520
+ }
521
+ if (elements.some((element) => element.loop)) parts.push(`@keyframes pg-loop-pulse{0%,100%{scale:1}50%{scale:1.06}}@keyframes pg-loop-float{0%,100%{translate:0 0}50%{translate:0 -12px}}@keyframes pg-loop-spin{to{rotate:360deg}}@media(prefers-reduced-motion:reduce){.pg-node{animation:none!important}}`);
522
+ return parts.join("\n");
523
+ }
524
+
525
+ // src/internal/lib/editor/icon.tsx
526
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
527
+ var paths = {
528
+ star: /* @__PURE__ */ jsx("path", { d: "m12 2.8 2.8 5.7 6.2.9-4.5 4.4 1.1 6.2-5.6-2.9L6.4 20l1.1-6.2L3 9.4l6.2-.9L12 2.8Z" }),
529
+ heart: /* @__PURE__ */ jsx("path", { d: "M20.8 5.8c-2.2-2.2-5.7-2.2-7.9 0L12 6.7l-.9-.9a5.6 5.6 0 0 0-7.9 7.9L12 22l8.8-8.3a5.6 5.6 0 0 0 0-7.9Z" }),
530
+ "arrow-right": /* @__PURE__ */ jsxs(Fragment, { children: [
531
+ /* @__PURE__ */ jsx("path", { d: "M5 12h14" }),
532
+ /* @__PURE__ */ jsx("path", { d: "m14 7 5 5-5 5" })
533
+ ] }),
534
+ check: /* @__PURE__ */ jsx("path", { d: "m5 12 4 4L19 6" }),
535
+ menu: /* @__PURE__ */ jsxs(Fragment, { children: [
536
+ /* @__PURE__ */ jsx("path", { d: "M4 7h16" }),
537
+ /* @__PURE__ */ jsx("path", { d: "M4 12h16" }),
538
+ /* @__PURE__ */ jsx("path", { d: "M4 17h16" })
539
+ ] }),
540
+ search: /* @__PURE__ */ jsxs(Fragment, { children: [
541
+ /* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "7" }),
542
+ /* @__PURE__ */ jsx("path", { d: "m20 20-4-4" })
543
+ ] })
544
+ };
545
+ function IconGlyph({ element }) {
546
+ return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "100%", height: "100%", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: paths[element.iconName ?? "star"] });
547
+ }
548
+
549
+ // src/internal/lib/render/page-render.tsx
550
+ import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
551
+ function RenderedPage({
552
+ elements: all,
553
+ rootStyle,
554
+ data = {}
555
+ }) {
556
+ const frameWidth = rootStyle.fullWidth ? Number.POSITIVE_INFINITY : rootStyle.maxWidth;
557
+ const cascade = cascadeOf(rootStyle.breakpoints, rootStyle.baseBreakpointId);
558
+ const baseId = baseOf(cascade).id;
559
+ const notes = noteIds(all, indexById(all), baseId, frameWidth, rootStyle.layout, cascade);
560
+ const elements = all.filter((element) => !notes.has(element.id) && element.componentRole !== "master");
561
+ return /* @__PURE__ */ jsxs2(Fragment2, { children: [
562
+ /* @__PURE__ */ jsx2(
563
+ "style",
564
+ {
565
+ dangerouslySetInnerHTML: { __html: stylesheetFor(elements, rootStyle) }
566
+ }
567
+ ),
568
+ /* @__PURE__ */ jsx2("main", { className: "pg-root", children: childrenOf(elements, void 0).map((el) => /* @__PURE__ */ jsx2(
569
+ RenderedNode,
570
+ {
571
+ element: el,
572
+ elements,
573
+ rootStyle,
574
+ data
575
+ },
576
+ el.id
577
+ )) }),
578
+ hasEntrances(elements) && /* @__PURE__ */ jsx2(
579
+ "script",
580
+ {
581
+ dangerouslySetInnerHTML: { __html: ENTRANCE_SCRIPT }
582
+ }
583
+ ),
584
+ elements.some((element) => element.draggable) && /* @__PURE__ */ jsx2("script", { dangerouslySetInnerHTML: { __html: DRAG_SCRIPT } }),
585
+ elements.some((element) => element.interaction && ["toggle-layer", "show-layer", "hide-layer"].includes(element.interaction.action)) && /* @__PURE__ */ jsx2("script", { dangerouslySetInnerHTML: { __html: ACTION_SCRIPT } })
586
+ ] });
587
+ }
588
+ function RenderedNode({
589
+ element: raw,
590
+ elements,
591
+ rootStyle,
592
+ data,
593
+ row
594
+ }) {
595
+ const cascade = cascadeOf(rootStyle.breakpoints, rootStyle.baseBreakpointId);
596
+ const baseId = baseOf(cascade).id;
597
+ const directRow = row ?? (raw.sourceId ? data[raw.sourceId]?.[0] : void 0);
598
+ const element = bindElement(raw, directRow);
599
+ const children = childrenOf(elements, element.id);
600
+ const style = resolveStyle(element, baseId, cascade);
601
+ const band = isBand(element.type, style, rootStyle);
602
+ const className = `pg-node ${classFor(element.id)}` + (band ? " pg-band" : "") + (style.entrance === "none" ? "" : " pg-anim");
603
+ const renderChildren = () => element.type === "Repeat" ? rowsFor(element, data, true).flatMap(
604
+ (dataRow, index) => children.map((child) => /* @__PURE__ */ jsx2(
605
+ RenderedNode,
606
+ {
607
+ element: child,
608
+ elements,
609
+ rootStyle,
610
+ data,
611
+ row: dataRow
612
+ },
613
+ `${index}:${child.id}`
614
+ ))
615
+ ) : children.map((child) => /* @__PURE__ */ jsx2(
616
+ RenderedNode,
617
+ {
618
+ element: child,
619
+ elements,
620
+ rootStyle,
621
+ data,
622
+ row: element.type === "Request" ? data[element.sourceId ?? ""]?.[0] : row
623
+ },
624
+ child.id
625
+ ));
626
+ const content = /* @__PURE__ */ jsxs2(Fragment2, { children: [
627
+ /* @__PURE__ */ jsx2(ElementContent, { element }),
628
+ renderChildren()
629
+ ] });
630
+ const body = band ? /* @__PURE__ */ jsx2("div", { className: "pg-inner", children: content }) : content;
631
+ const interactionHref = element.interaction?.action === "scroll-to" ? `#${classFor(element.interaction.value)}` : element.interaction?.action === "navigate" ? element.interaction.value : void 0;
632
+ const href = interactionHref || element.href;
633
+ const target = element.interaction?.target || element.target;
634
+ if (href) {
635
+ return /* @__PURE__ */ jsx2(
636
+ "a",
637
+ {
638
+ id: classFor(element.id),
639
+ "data-pg-drag": element.draggable ? "true" : void 0,
640
+ "data-pg-action": element.interaction?.action,
641
+ "data-pg-target": element.interaction && !["navigate", "scroll-to"].includes(element.interaction.action) ? classFor(element.interaction.value) : void 0,
642
+ className: `${className} pg-link`,
643
+ href,
644
+ target,
645
+ rel: target === "_blank" ? "noopener noreferrer" : void 0,
646
+ children: body
647
+ }
648
+ );
649
+ }
650
+ const tag = semanticTag(element);
651
+ return React.createElement(tag, {
652
+ id: classFor(element.id),
653
+ type: tag === "button" ? "button" : void 0,
654
+ "data-pg-drag": element.draggable ? "true" : void 0,
655
+ "data-pg-action": element.interaction?.action,
656
+ "data-pg-target": element.interaction && !["navigate", "scroll-to"].includes(element.interaction.action) ? classFor(element.interaction.value) : void 0,
657
+ "data-pg-display": element.type === "Grid" ? "grid" : isContainerType(element.type) || element.type === "Section" ? "flex" : "block",
658
+ className
659
+ }, body);
660
+ }
661
+ function semanticTag(element) {
662
+ const name = (element.name ?? "").toLowerCase();
663
+ if (element.type === "Button") return "button";
664
+ if (element.type === "Heading") {
665
+ const level = name.match(/(?:^|\s)h([1-6])(?:\s|$)/)?.[1] ?? "2";
666
+ return `h${level}`;
667
+ }
668
+ if (element.type === "Text") return "p";
669
+ if (name.includes("navbar") || name === "nav" || name.includes("navigation")) return "nav";
670
+ if (name.includes("footer")) return "footer";
671
+ if (name.includes("header")) return "header";
672
+ if (element.type === "Section") return "section";
673
+ return "div";
674
+ }
675
+ var DRAG_SCRIPT = `(function(){document.querySelectorAll('[data-pg-drag]').forEach(function(n){n.style.touchAction='none';n.style.cursor='grab';n.addEventListener('pointerdown',function(e){if(e.button!==0)return;e.preventDefault();var sx=e.clientX,sy=e.clientY,ox=Number(n.dataset.dx||0),oy=Number(n.dataset.dy||0);n.setPointerCapture(e.pointerId);n.style.cursor='grabbing';var move=function(p){var x=ox+p.clientX-sx,y=oy+p.clientY-sy;n.dataset.dx=String(x);n.dataset.dy=String(y);n.style.translate=x+'px '+y+'px'};var up=function(){n.style.cursor='grab';n.removeEventListener('pointermove',move);n.removeEventListener('pointerup',up)};n.addEventListener('pointermove',move);n.addEventListener('pointerup',up)})})})();`;
676
+ var ACTION_SCRIPT = `(function(){document.querySelectorAll('[data-pg-target]').forEach(function(trigger){trigger.style.cursor='pointer';trigger.addEventListener('click',function(event){var target=document.getElementById(trigger.dataset.pgTarget);if(!target)return;event.preventDefault();var action=trigger.dataset.pgAction;var open=target.dataset.pgOpen==='true';var next=action==='show-layer'?true:action==='hide-layer'?false:!open;target.dataset.pgOpen=next?'true':'false';target.style.setProperty('display',next?(target.dataset.pgDisplay||'flex'):'none','important');trigger.setAttribute('aria-expanded',String(next));target.setAttribute('aria-hidden',String(!next))})})})();`;
677
+ function isContainerType(type) {
678
+ return ["Frame", "Stack", "Container", "Request", "Repeat"].includes(type);
679
+ }
680
+ function ElementContent({ element }) {
681
+ if (element.code) return /* @__PURE__ */ jsx2("iframe", { title: element.name ?? "Code component", srcDoc: element.code, sandbox: "", style: { width: "100%", height: "100%", border: 0, borderRadius: "inherit" } });
682
+ if (element.type === "Image") {
683
+ if (!element.src) return null;
684
+ return (
685
+ // biome-ignore lint/performance/noImgElement: the src is author-supplied at runtime and cannot be statically optimised
686
+ /* @__PURE__ */ jsx2(
687
+ "img",
688
+ {
689
+ src: element.src,
690
+ alt: element.alt ?? "",
691
+ style: { objectFit: element.objectFit ?? "cover", borderRadius: "inherit" }
692
+ }
693
+ )
694
+ );
695
+ }
696
+ if (element.type === "Video") {
697
+ if (!element.src) return null;
698
+ return /* @__PURE__ */ jsx2(
699
+ "iframe",
700
+ {
701
+ src: element.src,
702
+ title: element.name ?? "Video",
703
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; picture-in-picture",
704
+ allowFullScreen: true,
705
+ style: { width: "100%", height: "100%", border: 0, borderRadius: "inherit" }
706
+ }
707
+ );
708
+ }
709
+ if (element.type === "Icon") return /* @__PURE__ */ jsx2(IconGlyph, { element });
710
+ if (!element.content) return null;
711
+ return /* @__PURE__ */ jsx2("span", { style: { display: "block", width: "100%", whiteSpace: "pre-wrap" }, children: element.content });
712
+ }
713
+ export {
714
+ ElementContent,
715
+ RenderedPage
716
+ };
717
+ //# sourceMappingURL=runtime.js.map