@getrheo/contracts 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/animations.d.ts +226 -0
  2. package/dist/animations.js +1160 -0
  3. package/dist/animations.js.map +1 -0
  4. package/dist/appIntegrations.d.ts +175 -0
  5. package/dist/appIntegrations.js +60 -0
  6. package/dist/appIntegrations.js.map +1 -0
  7. package/dist/billingPeriod.d.ts +26 -0
  8. package/dist/billingPeriod.js +39 -0
  9. package/dist/billingPeriod.js.map +1 -0
  10. package/dist/canvasEditorGates.d.ts +81 -0
  11. package/dist/canvasEditorGates.js +1460 -0
  12. package/dist/canvasEditorGates.js.map +1 -0
  13. package/dist/constants/index.d.ts +30 -0
  14. package/dist/constants/index.js +67 -0
  15. package/dist/constants/index.js.map +1 -0
  16. package/dist/dashboard.d.ts +181856 -0
  17. package/dist/dashboard.js +3348 -0
  18. package/dist/dashboard.js.map +1 -0
  19. package/dist/decisions.d.ts +575 -0
  20. package/dist/decisions.js +1209 -0
  21. package/dist/decisions.js.map +1 -0
  22. package/dist/events.d.ts +231 -0
  23. package/dist/events.js +63 -0
  24. package/dist/events.js.map +1 -0
  25. package/dist/experiments-DN8pQa_D.d.ts +530 -0
  26. package/dist/externalSurfaceIntegrations.d.ts +20 -0
  27. package/dist/externalSurfaceIntegrations.js +49 -0
  28. package/dist/externalSurfaceIntegrations.js.map +1 -0
  29. package/dist/externalSurfaces.d.ts +177 -0
  30. package/dist/externalSurfaces.js +1190 -0
  31. package/dist/externalSurfaces.js.map +1 -0
  32. package/dist/fields.d.ts +8 -0
  33. package/dist/fields.js +15 -0
  34. package/dist/fields.js.map +1 -0
  35. package/dist/flowManifestSchema-CtqygXCK.d.ts +50857 -0
  36. package/dist/flowTemplateComments.d.ts +23 -0
  37. package/dist/flowTemplateComments.js +14 -0
  38. package/dist/flowTemplateComments.js.map +1 -0
  39. package/dist/flowTemplates.d.ts +22 -0
  40. package/dist/flowTemplates.js +73 -0
  41. package/dist/flowTemplates.js.map +1 -0
  42. package/dist/identity.d.ts +35 -0
  43. package/dist/identity.js +18 -0
  44. package/dist/identity.js.map +1 -0
  45. package/dist/imageContentType.d.ts +11 -0
  46. package/dist/imageContentType.js +54 -0
  47. package/dist/imageContentType.js.map +1 -0
  48. package/dist/index.d.ts +224 -0
  49. package/dist/index.js +4557 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/layerUnion-BzXoAJLY.d.ts +34 -0
  52. package/dist/layers.d.ts +89844 -0
  53. package/dist/layers.js +1507 -0
  54. package/dist/layers.js.map +1 -0
  55. package/dist/layout-D0LpaKG-.d.ts +12896 -0
  56. package/dist/localized.d.ts +17 -0
  57. package/dist/localized.js +18 -0
  58. package/dist/localized.js.map +1 -0
  59. package/dist/manifest.d.ts +22192 -0
  60. package/dist/manifest.js +2163 -0
  61. package/dist/manifest.js.map +1 -0
  62. package/dist/media.d.ts +53 -0
  63. package/dist/media.js +55 -0
  64. package/dist/media.js.map +1 -0
  65. package/dist/planEntitlements.d.ts +65 -0
  66. package/dist/planEntitlements.js +117 -0
  67. package/dist/planEntitlements.js.map +1 -0
  68. package/dist/publish-exports.json +102 -0
  69. package/dist/screens.d.ts +33586 -0
  70. package/dist/screens.js +1439 -0
  71. package/dist/screens.js.map +1 -0
  72. package/dist/sdk.d.ts +145942 -0
  73. package/dist/sdk.js +3424 -0
  74. package/dist/sdk.js.map +1 -0
  75. package/dist/sdkAttributes.d.ts +11 -0
  76. package/dist/sdkAttributes.js +17 -0
  77. package/dist/sdkAttributes.js.map +1 -0
  78. package/dist/workspaceCapabilities.d.ts +15 -0
  79. package/dist/workspaceCapabilities.js +116 -0
  80. package/dist/workspaceCapabilities.js.map +1 -0
  81. package/package.json +162 -0
package/dist/layers.js ADDED
@@ -0,0 +1,1507 @@
1
+ import { z } from 'zod';
2
+
3
+ // src/layers/initLayerSchema.ts
4
+
5
+ // src/layers/layerSchemaRef.ts
6
+ var layerSchemaStore = {};
7
+ var LocaleCode = z.string().regex(/^[a-z]{2}(-[A-Z]{2})?$/, 'locale must be like "en" or "en-US"');
8
+ var LocalizedTextSchema = z.object({
9
+ default: z.string().min(1, "default copy is required"),
10
+ translations: z.record(LocaleCode, z.string()).optional()
11
+ });
12
+
13
+ // src/hyperlinkHref.ts
14
+ var parseHyperlinkHref = (raw) => {
15
+ const t = raw.trim();
16
+ if (!t) return { ok: false };
17
+ let u;
18
+ try {
19
+ u = new URL(t);
20
+ } catch {
21
+ return { ok: false };
22
+ }
23
+ const scheme = u.protocol.replace(/:$/, "").toLowerCase();
24
+ if (scheme === "https") {
25
+ if (!u.hostname) return { ok: false };
26
+ return { ok: true, scheme: "https", host: u.hostname };
27
+ }
28
+ if (scheme === "mailto") {
29
+ return { ok: true, scheme: "mailto" };
30
+ }
31
+ return { ok: false };
32
+ };
33
+
34
+ // src/constants/index.ts
35
+ var FIELD_CLASSIFICATIONS = ["safe", "sensitive"];
36
+ var MEDIA_TYPES = ["image", "font", "lottie", "video"];
37
+
38
+ // src/media.ts
39
+ var MediaTypeSchema = z.enum(MEDIA_TYPES);
40
+ var MediaReferenceSchema = z.object({
41
+ mediaAssetId: z.string().uuid()
42
+ });
43
+ z.object({
44
+ id: z.string().uuid(),
45
+ orgId: z.string().uuid(),
46
+ type: MediaTypeSchema,
47
+ url: z.string().url(),
48
+ name: z.string().nullable().optional(),
49
+ contentType: z.string(),
50
+ sizeBytes: z.number().int().nonnegative(),
51
+ archivedAt: z.string().datetime().nullable().optional(),
52
+ createdAt: z.string().datetime()
53
+ });
54
+ var LayerIdSchema = z.string().min(1).max(64).regex(/^lyr_[a-z0-9_]+$/i, "layer id must look like lyr_<id>");
55
+ var ScreenIdSchema = z.string().min(1).max(64).regex(/^scr_[a-z0-9_]+$/i, "screen id must look like scr_<id>");
56
+ var RESTING_MOTION_PRESETS = ["translate", "bounce", "scale", "pulse", "rotate"];
57
+ var RestingMotionPresetSchema = z.enum(RESTING_MOTION_PRESETS);
58
+ var RESTING_MOTION_SCALE_DIRECTIONS = ["up", "down"];
59
+ var RestingMotionScaleDirectionSchema = z.enum(RESTING_MOTION_SCALE_DIRECTIONS);
60
+ var RESTING_MOTION_ROTATE_DIRECTIONS = ["clockwise", "counterclockwise"];
61
+ var RestingMotionRotateDirectionSchema = z.enum(RESTING_MOTION_ROTATE_DIRECTIONS);
62
+ var RestingMotionSchema = z.object({
63
+ preset: RestingMotionPresetSchema,
64
+ /**
65
+ * Timeline segment length (ms): motion is active from start until
66
+ * start + durationMs. When {@link loop} is true, the preset pattern repeats
67
+ * every {@link cycleDurationMs} (or preset default) within this window.
68
+ */
69
+ durationMs: z.number().int().min(200).max(2e4).optional(),
70
+ /** When true, repeat the motion pattern within the timeline segment; default is one shot. */
71
+ loop: z.boolean().optional(),
72
+ /**
73
+ * Duration (ms) of one full pattern cycle when looping. Defaults per {@link RESTING_MOTION_DEFAULT_DURATION_MS}.
74
+ */
75
+ cycleDurationMs: z.number().int().min(200).max(2e4).optional(),
76
+ intensity: z.number().min(0).max(2).optional(),
77
+ /** Bounce preset only: vertical lift in px. When omitted, uses `14 * intensity` (default intensity 1 → 14). */
78
+ bounceAmplitudePx: z.number().min(1).max(80).optional(),
79
+ /** Scale preset: grow (+) or shrink (−) toward a peak, then return to 100%. */
80
+ scaleDirection: RestingMotionScaleDirectionSchema.optional(),
81
+ /**
82
+ * Scale preset: when true (default), each cycle goes rest → peak scale → rest.
83
+ * When false, ramps rest → peak and holds; with loop, the next cycle restarts from rest.
84
+ */
85
+ scaleSpringBack: z.boolean().optional(),
86
+ /**
87
+ * Scale preset: magnitude in % — growth above 100% (up to +400% = 5× at peak) or shrink toward
88
+ * 100%− (up to 90% so peak can be 10% size). See authoring caps in the layer editor.
89
+ */
90
+ scalePercent: z.number().min(0).max(400).optional(),
91
+ /**
92
+ * Scale preset: ms for one full out-and-back (rest → peak → rest). Timeline bar still sets
93
+ * {@link durationMs} (when the layer may animate); this controls how fast each cycle runs.
94
+ */
95
+ scalePatternDurationMs: z.number().int().min(200).max(2e4).optional(),
96
+ /** @deprecated Use {@link scalePercent} + {@link scaleDirection}. Kept for legacy manifests. */
97
+ scaleUpPercent: z.number().min(0).max(400).optional(),
98
+ /** @deprecated Use {@link scalePercent} + {@link scaleDirection}. Kept for legacy manifests. */
99
+ scaleDownPercent: z.number().min(0).max(90).optional(),
100
+ /**
101
+ * @deprecated Legacy vertical-only float (px). Prefer {@link translatePeakXPercent} / {@link translatePeakYPercent}.
102
+ */
103
+ translateRangePx: z.number().min(0).max(40).optional(),
104
+ /** @deprecated Legacy peak offsets in px. Prefer {@link translatePeakXPercent} / {@link translatePeakYPercent}. */
105
+ translatePeakXPx: z.number().min(-200).max(200).optional(),
106
+ /** @deprecated Legacy peak offsets in px. Prefer {@link translatePeakXPercent} / {@link translatePeakYPercent}. */
107
+ translatePeakYPx: z.number().min(-200).max(200).optional(),
108
+ /** Translate preset: peak X offset as % of the layer box (−200–200). Scaled by intensity. */
109
+ translatePeakXPercent: z.number().min(-200).max(200).optional(),
110
+ /** Translate preset: peak Y offset as % of the layer box (−200–200). Scaled by intensity. */
111
+ translatePeakYPercent: z.number().min(-200).max(200).optional(),
112
+ /**
113
+ * Translate preset: when true (default), each cycle goes rest → peak offset → rest. When false, ramp to
114
+ * peak and hold; with loop, the next cycle restarts from the origin.
115
+ */
116
+ translateSpringBack: z.boolean().optional(),
117
+ /** Rotate preset: target rotation in degrees (0–360), scaled by intensity. */
118
+ rotateMaxDeg: z.number().min(0).max(360).optional(),
119
+ /** Rotate preset: spin direction; omitted or `clockwise` → positive angles (default). */
120
+ rotateDirection: RestingMotionRotateDirectionSchema.optional(),
121
+ /**
122
+ * Rotate preset: when true (default), each cycle oscillates 0° → peak → 0°.
123
+ * When false, each cycle ramps 0° → peak and holds; with loop, the next cycle snaps to 0° and ramps again.
124
+ */
125
+ rotateSpringBack: z.boolean().optional(),
126
+ /** Pulse preset: minimum opacity at the dip (0–1). Omitted → `1 - 0.38 * intensity`. */
127
+ pulseMinOpacity: z.number().min(0).max(1).optional(),
128
+ /** Ms after the last mount/stagger clip ends before motion applies (authoring + scrub). */
129
+ delayMsAfterMountEnd: z.number().int().min(0).max(6e4).optional(),
130
+ /**
131
+ * Absolute start time (ms from screen mount). When set, overrides
132
+ * {@link delayMsAfterMountEnd} + mount-clip end so motion can sit between
133
+ * clips (e.g. after first entry, before exit) when multiple mounts exist.
134
+ */
135
+ timelineStartMs: z.number().int().min(0).max(36e5).optional()
136
+ }).strict();
137
+ var RestingMotionEntrySchema = RestingMotionSchema.extend({
138
+ id: z.string().min(1)
139
+ });
140
+
141
+ // src/layers/base.ts
142
+ var baseLayerShape = {
143
+ id: LayerIdSchema,
144
+ name: z.string().max(80).optional(),
145
+ restingMotion: RestingMotionSchema.optional(),
146
+ restingMotions: z.array(RestingMotionEntrySchema).optional()
147
+ };
148
+ var ThemedColorModesSchema = z.object({
149
+ light: z.string().min(1).optional(),
150
+ dark: z.string().min(1).optional()
151
+ }).strict().refine((o) => o.light !== void 0 || o.dark !== void 0, {
152
+ message: "at least one of light or dark is required"
153
+ });
154
+ var ThemedColorSchema = z.union([z.string().min(1), ThemedColorModesSchema]);
155
+ var DEFAULT_THEMED_FOREGROUND = {
156
+ light: "#000000",
157
+ dark: "#ffffff"
158
+ };
159
+ var PRIMARY_FILLED_LABEL = {
160
+ light: "#ffffff",
161
+ dark: "#000000"
162
+ };
163
+ var WIDTH_PRESETS = ["auto", "full", "1/2", "1/3", "2/3", "1/4", "3/4"];
164
+ var WidthValueSchema = z.union([z.enum(WIDTH_PRESETS), z.number().int().min(0).max(2e3)]);
165
+ var HEIGHT_PRESETS = ["auto", "full", "fill"];
166
+ var CommonLayoutHeightSchema = z.union([
167
+ z.enum(HEIGHT_PRESETS),
168
+ z.number().int().min(0).max(2e3)
169
+ ]);
170
+
171
+ // src/layers/styleCommon.ts
172
+ var NonNegativePxSchema = z.number().int().min(0);
173
+ var PaddingSchema = z.object({
174
+ t: NonNegativePxSchema.optional(),
175
+ r: NonNegativePxSchema.optional(),
176
+ b: NonNegativePxSchema.optional(),
177
+ l: NonNegativePxSchema.optional()
178
+ }).partial();
179
+ var BorderSchema = z.object({
180
+ width: z.number().int().min(0).max(20).optional(),
181
+ color: ThemedColorSchema.optional()
182
+ }).partial();
183
+ var DropShadowSchema = z.object({
184
+ offsetX: z.number().int().min(-100).max(100).optional(),
185
+ offsetY: z.number().int().min(-100).max(100).optional(),
186
+ blur: z.number().int().min(0).max(100).optional(),
187
+ spread: z.number().int().min(-50).max(50).optional(),
188
+ color: ThemedColorSchema.optional(),
189
+ opacity: z.number().min(0).max(1).optional()
190
+ }).partial();
191
+ var CommonStyleSchema = z.object({
192
+ padding: PaddingSchema.optional(),
193
+ margin: PaddingSchema.optional(),
194
+ radius: z.number().int().min(0).max(96).optional(),
195
+ background: ThemedColorSchema.optional(),
196
+ border: BorderSchema.optional(),
197
+ shadow: DropShadowSchema.optional(),
198
+ opacity: z.number().min(0).max(1).optional(),
199
+ width: WidthValueSchema.optional(),
200
+ /** Omit for normal flow; `'absolute'` removes the layer from flex flow (non-root only). */
201
+ position: z.literal("absolute").optional(),
202
+ /** Pixel insets when `position === 'absolute'` (same shape as padding). */
203
+ inset: PaddingSchema.optional(),
204
+ zIndex: z.number().int().min(-999).max(999).optional(),
205
+ /** Static rotation in degrees (CSS `rotate`); not timeline animation. */
206
+ rotate: z.number().min(-360).max(360).optional(),
207
+ /** Cross-axis size: `auto` (hug), `full`/`fill` (parent height), or fixed px. No fractions. */
208
+ height: CommonLayoutHeightSchema.optional(),
209
+ /** Stroke thickness in px for layers that render a stroke primitive (e.g. loader ring). */
210
+ strokeWidth: z.number().int().min(0).max(64).optional()
211
+ }).partial();
212
+ var TextStyleSchema = CommonStyleSchema.extend({
213
+ /**
214
+ * Logical font family: manifest `theme.fontFamily` when omitted, {@link TEXT_FONT_FAMILY_SYSTEM_UI}
215
+ * for the platform stack, or a custom name (matches `Branding.fontFamilies[].name` for uploaded fonts).
216
+ */
217
+ fontFamily: z.string().min(1).max(128).optional(),
218
+ fontSize: z.number().int().min(8).max(96).optional(),
219
+ fontWeight: z.number().int().min(100).max(900).optional(),
220
+ color: ThemedColorSchema.optional(),
221
+ align: z.enum(["left", "center", "right"]).optional(),
222
+ lineHeight: z.number().min(0.8).max(3).optional(),
223
+ /** Multiplier (0–1) applied to the resolved background color alpha only; text stays fully opaque unless `opacity` is set. */
224
+ backgroundOpacity: z.number().min(0).max(1).optional()
225
+ });
226
+ var ImageStyleSchema = CommonStyleSchema.extend({
227
+ fit: z.enum(["cover", "contain", "fill"]).optional(),
228
+ aspectRatio: z.number().positive().max(10).optional()
229
+ });
230
+ var IconStyleSchema = CommonStyleSchema.extend({
231
+ color: ThemedColorSchema.optional()
232
+ });
233
+ var ICON_FAMILIES = ["ionicons"];
234
+ var ButtonStyleSchema = CommonStyleSchema.extend({
235
+ fontSize: z.number().int().min(8).max(96).optional(),
236
+ fontWeight: z.number().int().min(100).max(900).optional(),
237
+ color: ThemedColorSchema.optional(),
238
+ align: z.enum(["left", "center", "right"]).optional()
239
+ });
240
+ var BUTTON_LAYER_VARIANTS = ["primary", "secondary", "ghost", "destructive"];
241
+ var ButtonLayerVariantSchema = z.enum(BUTTON_LAYER_VARIANTS);
242
+ var CommonStyleBreakpointsSchema = z.object({
243
+ sm: CommonStyleSchema.partial().optional(),
244
+ md: CommonStyleSchema.partial().optional(),
245
+ lg: CommonStyleSchema.partial().optional(),
246
+ xl: CommonStyleSchema.partial().optional(),
247
+ "2xl": CommonStyleSchema.partial().optional()
248
+ }).partial().optional();
249
+ var TextStyleBreakpointsSchema = z.object({
250
+ sm: TextStyleSchema.partial().optional(),
251
+ md: TextStyleSchema.partial().optional(),
252
+ lg: TextStyleSchema.partial().optional(),
253
+ xl: TextStyleSchema.partial().optional(),
254
+ "2xl": TextStyleSchema.partial().optional()
255
+ }).partial().optional();
256
+ var ImageStyleBreakpointsSchema = z.object({
257
+ sm: ImageStyleSchema.partial().optional(),
258
+ md: ImageStyleSchema.partial().optional(),
259
+ lg: ImageStyleSchema.partial().optional(),
260
+ xl: ImageStyleSchema.partial().optional(),
261
+ "2xl": ImageStyleSchema.partial().optional()
262
+ }).partial().optional();
263
+ var IconStyleBreakpointsSchema = z.object({
264
+ sm: IconStyleSchema.partial().optional(),
265
+ md: IconStyleSchema.partial().optional(),
266
+ lg: IconStyleSchema.partial().optional(),
267
+ xl: IconStyleSchema.partial().optional(),
268
+ "2xl": IconStyleSchema.partial().optional()
269
+ }).partial().optional();
270
+ var ButtonStyleBreakpointsSchema = z.object({
271
+ sm: ButtonStyleSchema.partial().optional(),
272
+ md: ButtonStyleSchema.partial().optional(),
273
+ lg: ButtonStyleSchema.partial().optional(),
274
+ xl: ButtonStyleSchema.partial().optional(),
275
+ "2xl": ButtonStyleSchema.partial().optional()
276
+ }).partial().optional();
277
+ var StackLayoutBreakpointPatchSchema = z.object({
278
+ gap: NonNegativePxSchema.optional(),
279
+ direction: z.enum(["vertical", "horizontal"]).optional()
280
+ }).partial();
281
+ var StackLayoutBreakpointsSchema = z.object({
282
+ sm: StackLayoutBreakpointPatchSchema.optional(),
283
+ md: StackLayoutBreakpointPatchSchema.optional(),
284
+ lg: StackLayoutBreakpointPatchSchema.optional(),
285
+ xl: StackLayoutBreakpointPatchSchema.optional(),
286
+ "2xl": StackLayoutBreakpointPatchSchema.optional()
287
+ }).partial().optional();
288
+ var ButtonLayoutBreakpointPatchSchema = z.object({
289
+ gap: NonNegativePxSchema.optional(),
290
+ direction: z.enum(["vertical", "horizontal"]).optional()
291
+ }).partial();
292
+ var ButtonLayoutBreakpointsSchema = z.object({
293
+ sm: ButtonLayoutBreakpointPatchSchema.optional(),
294
+ md: ButtonLayoutBreakpointPatchSchema.optional(),
295
+ lg: ButtonLayoutBreakpointPatchSchema.optional(),
296
+ xl: ButtonLayoutBreakpointPatchSchema.optional(),
297
+ "2xl": ButtonLayoutBreakpointPatchSchema.optional()
298
+ }).partial().optional();
299
+ var OS_PERMISSION_KEYS = [
300
+ "notifications",
301
+ "camera",
302
+ "microphone",
303
+ "photo_library",
304
+ "contacts",
305
+ "calendar",
306
+ "reminders",
307
+ "location_when_in_use",
308
+ "location_always",
309
+ "motion",
310
+ "bluetooth",
311
+ "app_tracking_transparency",
312
+ "speech_recognition",
313
+ "face_id",
314
+ "health_kit",
315
+ "media_library",
316
+ "local_network",
317
+ "nearby_interactions",
318
+ "nfc",
319
+ "full_screen_intent_android",
320
+ "sms_android",
321
+ "phone_android"
322
+ ];
323
+ var OsPermissionKeySchema = z.enum(OS_PERMISSION_KEYS);
324
+ var PERMISSION_CAPTURE_FIELD_KEY_PREFIX = "permission:";
325
+ var permissionCaptureFieldKey = (key) => `${PERMISSION_CAPTURE_FIELD_KEY_PREFIX}${key}`;
326
+ var oauthLoginResponseKey = (layerId) => `oauth:${layerId}`;
327
+ var emailPasswordAuthResponseKey = (layerId) => `email_pw:${layerId}`;
328
+ var PERMISSION_OUTCOME_VALUES = ["granted", "denied", "blocked"];
329
+ var PermissionOutcomeSchema = z.enum(PERMISSION_OUTCOME_VALUES);
330
+ var OS_PERMISSION_OUTCOME_CONTINUE = "continue";
331
+ var OS_PERMISSION_OUTCOME_END = "end";
332
+ var OsPermissionOutcomeBranchTargetSchema = z.union([
333
+ ScreenIdSchema,
334
+ z.literal(OS_PERMISSION_OUTCOME_CONTINUE),
335
+ z.literal(OS_PERMISSION_OUTCOME_END)
336
+ ]);
337
+ var OsPermissionOutcomesSchema = z.object({
338
+ granted: OsPermissionOutcomeBranchTargetSchema,
339
+ denied: OsPermissionOutcomeBranchTargetSchema,
340
+ blocked: OsPermissionOutcomeBranchTargetSchema
341
+ }).strict();
342
+ var APP_REVIEW_CAPTURE_FIELD_KEY_PREFIX = "app_review:";
343
+ var appReviewCaptureFieldKey = (layerId) => `${APP_REVIEW_CAPTURE_FIELD_KEY_PREFIX}${layerId}`;
344
+ var APP_REVIEW_OUTCOMES = ["not_shown", "dismissed"];
345
+ var AppReviewOutcomeSchema = z.enum(APP_REVIEW_OUTCOMES);
346
+ var ButtonActionSchema = z.discriminatedUnion("kind", [
347
+ z.object({ kind: z.literal("none") }),
348
+ z.object({ kind: z.literal("continue") }),
349
+ z.object({ kind: z.literal("skip") }),
350
+ z.object({ kind: z.literal("end_flow") }),
351
+ z.object({
352
+ kind: z.literal("go_back_one_screen"),
353
+ fallbackScreenId: ScreenIdSchema.optional()
354
+ }),
355
+ z.object({ kind: z.literal("go_to_step"), screenId: ScreenIdSchema }),
356
+ z.object({
357
+ kind: z.literal("request_os_permission"),
358
+ permissionKey: OsPermissionKeySchema,
359
+ outcomes: OsPermissionOutcomesSchema
360
+ }),
361
+ z.object({
362
+ kind: z.literal("play_media"),
363
+ targetLayerIds: z.array(z.string().min(1)).min(1)
364
+ }),
365
+ z.object({ kind: z.literal("request_app_review") })
366
+ ]);
367
+ var TEXT_INPUT_TYPES = ["plain", "email", "phone", "url", "multiline"];
368
+ var TextInputTypeSchema = z.enum(TEXT_INPUT_TYPES);
369
+ var COUNTER_DISPLAY_KINDS = ["number", "time"];
370
+ var COUNTER_TIME_FORMATS = ["mm_ss", "hh_mm_ss", "dd_hh_mm_ss"];
371
+ var CheckboxGlyphStyleSchema = z.object({
372
+ /** Square edge length in px. */
373
+ size: z.number().int().min(8).max(128).optional(),
374
+ radius: z.number().int().min(0).max(96).optional(),
375
+ background: ThemedColorSchema.optional(),
376
+ border: BorderSchema.optional(),
377
+ shadow: DropShadowSchema.optional(),
378
+ opacity: z.number().min(0).max(1).optional(),
379
+ /** Fill color for the check mark when checked. */
380
+ checkColor: ThemedColorSchema.optional()
381
+ }).partial();
382
+ var OAUTH_LOGIN_PRESETS = ["github", "google", "apple"];
383
+ var OAUTH_LOGIN_PRESET_DISPLAY = {
384
+ google: "Google",
385
+ github: "GitHub",
386
+ apple: "Apple"
387
+ };
388
+ var DEFAULT_OAUTH_PRESET_BUTTON_LABEL = {
389
+ google: "Sign in with Google",
390
+ github: "Continue with GitHub",
391
+ apple: "Sign in with Apple"
392
+ };
393
+ var defaultOAuthPresetButtonLabel = (provider) => DEFAULT_OAUTH_PRESET_BUTTON_LABEL[provider];
394
+ var oauthPresetEffectiveLabel = (provider, label2) => {
395
+ const base = DEFAULT_OAUTH_PRESET_BUTTON_LABEL[provider];
396
+ if (!label2) return { default: base };
397
+ const d = typeof label2.default === "string" && label2.default.trim().length > 0 ? label2.default : base;
398
+ return {
399
+ default: d,
400
+ ...label2.translations && Object.keys(label2.translations).length > 0 ? { translations: { ...label2.translations } } : {}
401
+ };
402
+ };
403
+ var OAuthPresetButtonChromeSchema = CommonStyleSchema.pick({
404
+ width: true,
405
+ padding: true,
406
+ margin: true,
407
+ radius: true
408
+ }).partial();
409
+ var OAuthPresetButtonChromeBreakpointsSchema = z.object({
410
+ sm: OAuthPresetButtonChromeSchema.partial().optional(),
411
+ md: OAuthPresetButtonChromeSchema.partial().optional(),
412
+ lg: OAuthPresetButtonChromeSchema.partial().optional(),
413
+ xl: OAuthPresetButtonChromeSchema.partial().optional(),
414
+ "2xl": OAuthPresetButtonChromeSchema.partial().optional()
415
+ }).partial().optional();
416
+ var EMAIL_PASSWORD_AUTH_MODES = ["sign_in", "sign_up"];
417
+ var EMAIL_PASSWORD_SLOTS = ["email", "password", "confirm"];
418
+
419
+ // src/layers/kinds/chrome.ts
420
+ var lazyLayer = () => layerSchemaStore.schema;
421
+ var ButtonLayerSchema = z.object({
422
+ ...baseLayerShape,
423
+ kind: z.literal("button"),
424
+ children: z.lazy(() => z.array(lazyLayer())),
425
+ action: ButtonActionSchema,
426
+ variant: ButtonLayerVariantSchema,
427
+ direction: z.enum(["vertical", "horizontal"]).optional(),
428
+ gap: z.number().int().min(0).optional(),
429
+ align: z.enum(["start", "center", "end", "stretch"]).optional(),
430
+ distribution: z.enum(["start", "center", "end", "between", "around"]).optional(),
431
+ style: ButtonStyleSchema.optional(),
432
+ styleBreakpoints: ButtonStyleBreakpointsSchema,
433
+ buttonLayoutBreakpoints: ButtonLayoutBreakpointsSchema
434
+ });
435
+ var BackButtonLayerSchema = z.object({
436
+ ...baseLayerShape,
437
+ kind: z.literal("back_button"),
438
+ children: z.lazy(() => z.array(lazyLayer())),
439
+ variant: ButtonLayerVariantSchema,
440
+ direction: z.enum(["vertical", "horizontal"]).optional(),
441
+ gap: z.number().int().min(0).optional(),
442
+ align: z.enum(["start", "center", "end", "stretch"]).optional(),
443
+ distribution: z.enum(["start", "center", "end", "between", "around"]).optional(),
444
+ style: ButtonStyleSchema.optional(),
445
+ styleBreakpoints: ButtonStyleBreakpointsSchema,
446
+ buttonLayoutBreakpoints: ButtonLayoutBreakpointsSchema,
447
+ fallbackScreenId: ScreenIdSchema.optional()
448
+ });
449
+ var ProgressLayerSchema = z.object({
450
+ ...baseLayerShape,
451
+ kind: z.literal("progress"),
452
+ trackColor: ThemedColorSchema.optional(),
453
+ fillColor: ThemedColorSchema.optional(),
454
+ style: CommonStyleSchema.optional()
455
+ });
456
+ var LoaderOnCompleteSchema = z.discriminatedUnion("mode", [
457
+ z.object({ mode: z.literal("none") }),
458
+ z.object({ mode: z.literal("next") }),
459
+ z.object({ mode: z.literal("screen"), screenId: ScreenIdSchema })
460
+ ]);
461
+ var LoaderLayerSchema = z.object({
462
+ ...baseLayerShape,
463
+ kind: z.literal("loader"),
464
+ variant: z.enum(["linear", "circular"]).optional(),
465
+ targetPercent: z.number().int().min(0).max(100).optional(),
466
+ fillDelayMs: z.number().int().min(0).max(1e4).optional(),
467
+ durationMs: z.number().int().min(0).max(36e5).optional(),
468
+ onComplete: LoaderOnCompleteSchema.optional(),
469
+ trackColor: ThemedColorSchema.optional(),
470
+ trackOpacity: z.number().min(0).max(1).optional(),
471
+ fillColor: ThemedColorSchema.optional(),
472
+ /** Horizontal alignment of the bar or ring within the layer box (default start). */
473
+ align: z.enum(["start", "center", "end"]).optional(),
474
+ style: CommonStyleSchema.optional()
475
+ }).superRefine((data, ctx) => {
476
+ if (data.variant !== "circular") return;
477
+ const w = data.style?.width;
478
+ const h = data.style?.height;
479
+ if (typeof w === "number" && typeof h === "number" && w !== h) {
480
+ ctx.addIssue({
481
+ code: z.ZodIssueCode.custom,
482
+ message: "circular loader requires style.width === style.height",
483
+ path: ["style", "height"]
484
+ });
485
+ }
486
+ });
487
+ var CounterLayerSchema = z.object({
488
+ ...baseLayerShape,
489
+ kind: z.literal("counter"),
490
+ startValue: z.number().finite(),
491
+ endValue: z.number().finite(),
492
+ durationMs: z.number().int().min(0).max(36e5).optional(),
493
+ delayMs: z.number().int().min(0).max(36e5).optional(),
494
+ decimalPlaces: z.number().int().min(0).max(10).optional(),
495
+ displayKind: z.enum(COUNTER_DISPLAY_KINDS).optional(),
496
+ timeFormat: z.enum(COUNTER_TIME_FORMATS).optional(),
497
+ style: TextStyleSchema.optional(),
498
+ styleBreakpoints: TextStyleBreakpointsSchema
499
+ });
500
+ var CheckboxLayerSchema = z.object({
501
+ ...baseLayerShape,
502
+ kind: z.literal("checkbox"),
503
+ fieldKey: z.string().min(1),
504
+ blocking: z.boolean().optional(),
505
+ uncheckedStyle: CheckboxGlyphStyleSchema.optional(),
506
+ checkedStyle: CheckboxGlyphStyleSchema.optional(),
507
+ style: CommonStyleSchema.optional(),
508
+ styleBreakpoints: CommonStyleBreakpointsSchema
509
+ });
510
+
511
+ // src/layers/kinds/layout.ts
512
+ var lazyLayer2 = () => layerSchemaStore.schema;
513
+ var StackLayerSchema = z.object({
514
+ ...baseLayerShape,
515
+ kind: z.literal("stack"),
516
+ style: CommonStyleSchema.optional(),
517
+ styleBreakpoints: CommonStyleBreakpointsSchema,
518
+ stackLayoutBreakpoints: StackLayoutBreakpointsSchema,
519
+ selectedStyle: CommonStyleSchema.optional(),
520
+ direction: z.enum(["vertical", "horizontal"]),
521
+ gap: z.number().int().min(0).optional(),
522
+ align: z.enum(["start", "center", "end", "stretch"]).optional(),
523
+ justify: z.enum(["start", "center", "end"]).optional(),
524
+ distribution: z.enum(["start", "center", "end", "between", "around"]).optional(),
525
+ wrap: z.boolean().optional(),
526
+ children: z.lazy(() => z.array(lazyLayer2()))
527
+ });
528
+ var TextLayerSchema = z.object({
529
+ ...baseLayerShape,
530
+ kind: z.literal("text"),
531
+ text: LocalizedTextSchema,
532
+ style: TextStyleSchema.optional(),
533
+ styleBreakpoints: TextStyleBreakpointsSchema
534
+ });
535
+ var migrateLegacyHyperlinkForParse = (raw) => {
536
+ if (!raw || typeof raw !== "object") return raw;
537
+ const o = raw;
538
+ if (o.kind !== "hyperlink") return raw;
539
+ const existing = o.children;
540
+ if (Array.isArray(existing) && existing.length > 0) return raw;
541
+ const idSrc = typeof o.id === "string" ? o.id.replace(/[^a-zA-Z0-9_]/g, "_") : "lyr_hyperlink";
542
+ const textChildId = `${idSrc}_lnktxt`.slice(0, 64);
543
+ const children = [
544
+ {
545
+ id: textChildId,
546
+ kind: "text",
547
+ text: o.text ?? { default: "Link" },
548
+ ...typeof o.style === "object" && o.style !== null ? { style: o.style } : {},
549
+ ...typeof o.styleBreakpoints === "object" && o.styleBreakpoints !== null ? { styleBreakpoints: o.styleBreakpoints } : {}
550
+ }
551
+ ];
552
+ const next = {
553
+ ...o,
554
+ children
555
+ };
556
+ delete next.text;
557
+ delete next.style;
558
+ delete next.styleBreakpoints;
559
+ return next;
560
+ };
561
+ var HyperlinkLayerSchemaInner = z.object({
562
+ ...baseLayerShape,
563
+ kind: z.literal("hyperlink"),
564
+ href: z.string().min(1).max(2048),
565
+ children: z.lazy(() => z.array(lazyLayer2()).min(1)),
566
+ direction: z.enum(["vertical", "horizontal"]).optional(),
567
+ gap: z.number().int().min(0).optional(),
568
+ align: z.enum(["start", "center", "end", "stretch"]).optional(),
569
+ distribution: z.enum(["start", "center", "end", "between", "around"]).optional(),
570
+ wrap: z.boolean().optional(),
571
+ style: CommonStyleSchema.optional(),
572
+ styleBreakpoints: CommonStyleBreakpointsSchema
573
+ }).superRefine((data, ctx) => {
574
+ const p = parseHyperlinkHref(data.href.trim());
575
+ if (!p.ok) {
576
+ ctx.addIssue({
577
+ code: z.ZodIssueCode.custom,
578
+ message: "hyperlink href must be a valid https: or mailto: URL",
579
+ path: ["href"]
580
+ });
581
+ }
582
+ });
583
+ var HyperlinkLayerSchema = z.preprocess(
584
+ migrateLegacyHyperlinkForParse,
585
+ HyperlinkLayerSchemaInner
586
+ );
587
+ var ImageLayerSchema = z.object({
588
+ ...baseLayerShape,
589
+ kind: z.literal("image"),
590
+ media: MediaReferenceSchema.optional(),
591
+ alt: z.string().max(280).optional(),
592
+ style: ImageStyleSchema.optional(),
593
+ styleBreakpoints: ImageStyleBreakpointsSchema
594
+ });
595
+ var LottieLayerSchema = z.object({
596
+ ...baseLayerShape,
597
+ kind: z.literal("lottie"),
598
+ media: MediaReferenceSchema.optional(),
599
+ loop: z.boolean().optional(),
600
+ autoPlay: z.boolean().optional(),
601
+ triggerLayerId: z.string().min(1).optional(),
602
+ onComplete: LoaderOnCompleteSchema.optional(),
603
+ style: ImageStyleSchema.optional(),
604
+ styleBreakpoints: ImageStyleBreakpointsSchema
605
+ });
606
+ var VideoLayerSchema = z.object({
607
+ ...baseLayerShape,
608
+ kind: z.literal("video"),
609
+ media: MediaReferenceSchema.optional(),
610
+ loop: z.boolean().optional(),
611
+ autoPlay: z.boolean().optional(),
612
+ triggerLayerId: z.string().min(1).optional(),
613
+ onComplete: LoaderOnCompleteSchema.optional(),
614
+ audioEnabled: z.boolean().optional(),
615
+ style: ImageStyleSchema.optional(),
616
+ styleBreakpoints: ImageStyleBreakpointsSchema
617
+ });
618
+ var IconLayerSchema = z.object({
619
+ ...baseLayerShape,
620
+ kind: z.literal("icon"),
621
+ family: z.enum(ICON_FAMILIES),
622
+ iconName: z.string().min(1).max(128),
623
+ style: IconStyleSchema.optional(),
624
+ styleBreakpoints: IconStyleBreakpointsSchema
625
+ });
626
+ var lazyLayer3 = () => layerSchemaStore.schema;
627
+ var oauthLoginManifestProviderFromLayer = (layer) => layer.variant === "preset" ? { type: "preset", provider: layer.provider } : oauthLoginCustomPayloadFromLayer(layer);
628
+ var oauthLoginCustomPayloadFromLayer = (layer) => {
629
+ const text = layer.children.find((c) => c.kind === "text");
630
+ const icon = layer.children.find((c) => c.kind === "icon");
631
+ return {
632
+ type: "custom",
633
+ rowId: layer.rowId,
634
+ label: text?.text ?? { default: "" },
635
+ family: icon?.family ?? "ionicons",
636
+ iconName: icon?.iconName ?? "help-circle-outline"
637
+ };
638
+ };
639
+ var OAuthProviderPresetLayerSchema = z.object({
640
+ ...baseLayerShape,
641
+ kind: z.literal("oauth_provider"),
642
+ variant: z.literal("preset"),
643
+ provider: z.enum(OAUTH_LOGIN_PRESETS),
644
+ label: LocalizedTextSchema.optional(),
645
+ style: OAuthPresetButtonChromeSchema.optional(),
646
+ styleBreakpoints: OAuthPresetButtonChromeBreakpointsSchema.optional()
647
+ });
648
+ var migrateOAuthProviderCustomIncoming = (raw) => {
649
+ if (!raw || typeof raw !== "object") return raw;
650
+ const o = raw;
651
+ if (o.kind !== "oauth_provider" || o.variant !== "custom") return raw;
652
+ const ch = o.children;
653
+ if (Array.isArray(ch) && ch.length > 0) {
654
+ const next2 = { ...o };
655
+ if (next2.buttonVariant === void 0) next2.buttonVariant = "secondary";
656
+ return next2;
657
+ }
658
+ const pid = typeof o.id === "string" ? o.id : "lyr_oauth_custom";
659
+ const slug = pid.replace(/[^a-z0-9_]/gi, "_").slice(0, 40) || "oauth";
660
+ const label2 = o.label ?? { default: "Custom" };
661
+ let family = o.family ?? "ionicons";
662
+ let iconName = o.iconName ?? "shield-outline";
663
+ if (family === "sf_symbol") {
664
+ family = "ionicons";
665
+ iconName = "star-outline";
666
+ }
667
+ const cid = slug;
668
+ const iconId = `lyr_${cid}_ico`.slice(0, 64);
669
+ const textId = `lyr_${cid}_txt`.slice(0, 64);
670
+ const next = { ...o };
671
+ delete next.label;
672
+ delete next.family;
673
+ delete next.iconName;
674
+ return {
675
+ ...next,
676
+ buttonVariant: o.buttonVariant ?? "secondary",
677
+ children: [
678
+ { id: iconId, kind: "icon", family, iconName },
679
+ { id: textId, kind: "text", text: label2 }
680
+ ]
681
+ };
682
+ };
683
+ var OAuthProviderCustomLayerSchemaValidated = z.object({
684
+ ...baseLayerShape,
685
+ kind: z.literal("oauth_provider"),
686
+ variant: z.literal("custom"),
687
+ rowId: z.string().uuid(),
688
+ buttonVariant: ButtonLayerVariantSchema,
689
+ direction: z.enum(["vertical", "horizontal"]).optional(),
690
+ gap: z.number().int().min(0).optional(),
691
+ align: z.enum(["start", "center", "end", "stretch"]).optional(),
692
+ distribution: z.enum(["start", "center", "end", "between", "around"]).optional(),
693
+ children: z.lazy(() => z.array(lazyLayer3()).min(1)),
694
+ style: ButtonStyleSchema.optional(),
695
+ styleBreakpoints: ButtonStyleBreakpointsSchema,
696
+ buttonLayoutBreakpoints: ButtonLayoutBreakpointsSchema
697
+ });
698
+ var OAuthProviderCustomLayerSchema = z.preprocess(
699
+ migrateOAuthProviderCustomIncoming,
700
+ OAuthProviderCustomLayerSchemaValidated
701
+ );
702
+ var OAuthProviderLayerSchema = z.union([
703
+ OAuthProviderPresetLayerSchema,
704
+ OAuthProviderCustomLayerSchema
705
+ ]);
706
+ var OAuthLoginPresetProviderSchema = z.object({
707
+ type: z.literal("preset"),
708
+ provider: z.enum(OAUTH_LOGIN_PRESETS)
709
+ });
710
+ var OAuthLoginCustomProviderSchema = z.object({
711
+ type: z.literal("custom"),
712
+ rowId: z.string().uuid(),
713
+ label: LocalizedTextSchema,
714
+ family: z.enum(ICON_FAMILIES),
715
+ iconName: z.string().min(1).max(128)
716
+ });
717
+ var OAuthLoginProviderSchema = z.discriminatedUnion("type", [
718
+ OAuthLoginPresetProviderSchema,
719
+ OAuthLoginCustomProviderSchema
720
+ ]);
721
+ var oauthLoginChildrenUniquePresets = (children, ctx) => {
722
+ const seen = /* @__PURE__ */ new Set();
723
+ for (let i = 0; i < children.length; i++) {
724
+ const c = children[i];
725
+ if (!c || c.kind !== "oauth_provider" || c.variant !== "preset") continue;
726
+ const preset = c.provider;
727
+ if (seen.has(preset)) {
728
+ ctx.addIssue({
729
+ code: z.ZodIssueCode.custom,
730
+ message: `duplicate OAuth preset "${preset}"`,
731
+ path: ["children", i, "provider"]
732
+ });
733
+ return;
734
+ }
735
+ seen.add(preset);
736
+ }
737
+ };
738
+ var migrateOAuthLoginIncoming = (raw) => {
739
+ if (!raw || typeof raw !== "object") return raw;
740
+ const o = raw;
741
+ if (o.kind !== "oauth_login") return raw;
742
+ if (Array.isArray(o.children) && o.children.length > 0) return raw;
743
+ const provs = o.providers;
744
+ if (!Array.isArray(provs) || provs.length === 0) return raw;
745
+ const pid = typeof o.id === "string" ? o.id : "lyr_oauth_legacy";
746
+ const slug = pid.replace(/^lyr_/i, "").replace(/[^a-z0-9_]/gi, "_").replace(/^_+/, "").slice(0, 48) || "oauth";
747
+ const children = provs.map((p, idx) => {
748
+ const prov = p ?? {};
749
+ const cid = `lyr_${slug}_opr_${idx}`.slice(0, 64);
750
+ if (prov.type === "preset") {
751
+ return {
752
+ id: cid,
753
+ kind: "oauth_provider",
754
+ variant: "preset",
755
+ provider: prov.provider
756
+ };
757
+ }
758
+ return {
759
+ id: cid,
760
+ kind: "oauth_provider",
761
+ variant: "custom",
762
+ rowId: String(prov.rowId),
763
+ buttonVariant: "secondary",
764
+ children: [
765
+ {
766
+ id: `${cid}_ico`.slice(0, 64),
767
+ kind: "icon",
768
+ family: prov.family ?? "ionicons",
769
+ iconName: String(prov.iconName ?? "shield")
770
+ },
771
+ {
772
+ id: `${cid}_txt`.slice(0, 64),
773
+ kind: "text",
774
+ text: prov.label ?? { default: "Custom" }
775
+ }
776
+ ]
777
+ };
778
+ });
779
+ const { providers: _omit, ...rest } = o;
780
+ return { ...rest, children };
781
+ };
782
+ var OAuthLoginLayerSchemaValidated = z.object({
783
+ ...baseLayerShape,
784
+ kind: z.literal("oauth_login"),
785
+ children: z.lazy(
786
+ () => z.array(OAuthProviderLayerSchema).min(1).superRefine(oauthLoginChildrenUniquePresets)
787
+ ),
788
+ gap: z.number().int().min(0).optional(),
789
+ align: z.enum(["start", "center", "end", "stretch"]).optional(),
790
+ style: CommonStyleSchema.optional(),
791
+ styleBreakpoints: CommonStyleBreakpointsSchema
792
+ });
793
+ var OAuthLoginLayerSchema = z.preprocess(
794
+ migrateOAuthLoginIncoming,
795
+ OAuthLoginLayerSchemaValidated
796
+ );
797
+ var OAuthLoginProvidersArraySchema = z.array(OAuthLoginProviderSchema).min(1).superRefine((providers, ctx) => {
798
+ const seen = /* @__PURE__ */ new Set();
799
+ for (let i = 0; i < providers.length; i++) {
800
+ const p = providers[i];
801
+ if (!p || p.type !== "preset") continue;
802
+ const preset = p.provider;
803
+ if (seen.has(preset)) {
804
+ ctx.addIssue({
805
+ code: z.ZodIssueCode.custom,
806
+ message: `duplicate OAuth preset "${preset}"`,
807
+ path: [i, "provider"]
808
+ });
809
+ return;
810
+ }
811
+ seen.add(preset);
812
+ }
813
+ });
814
+ var FIELD_KEY_RE = /^[a-z][a-z0-9_]*$/;
815
+ var FieldKeySchema = z.string().min(1).max(64).regex(FIELD_KEY_RE, "field key must be snake_case");
816
+ var FieldClassificationSchema = z.enum(FIELD_CLASSIFICATIONS);
817
+
818
+ // src/layers/kinds/auth/emailPasswordAuth.ts
819
+ var lazyLayer4 = () => layerSchemaStore.schema;
820
+ var EmailPasswordAuthModeSchema = z.enum(EMAIL_PASSWORD_AUTH_MODES);
821
+ var migrateEmailPasswordAuthIncoming = (raw) => {
822
+ if (!raw || typeof raw !== "object") return raw;
823
+ const o = raw;
824
+ if (o.kind !== "email_password_auth") return raw;
825
+ if (Array.isArray(o.children) && o.children.length > 0) return raw;
826
+ const idBase = typeof o.id === "string" ? o.id : "lyr_email_password_auth";
827
+ const slugRaw = idBase.replace(/^lyr_/i, "").replace(/[^a-z0-9_]/gi, "_");
828
+ const slug = slugRaw.length > 0 ? slugRaw.slice(0, 40) : "ep_auth";
829
+ const mode = o.mode === "sign_up" ? "sign_up" : "sign_in";
830
+ const pickLt = (v, fallback) => v && typeof v === "object" && v !== null && "default" in v ? v : { default: fallback };
831
+ const mkField = (suf, slot, labelSource, fallbackPlaceholder) => ({
832
+ id: `lyr_${slug}_fld_${suf}`.slice(0, 64),
833
+ kind: "email_password_field",
834
+ slot,
835
+ ...labelSource ? { placeholder: pickLt(labelSource, fallbackPlaceholder) } : { placeholder: { default: fallbackPlaceholder } },
836
+ children: []
837
+ });
838
+ const children = [];
839
+ children.push(mkField("email", "email", o.emailLabel, "Email"));
840
+ children.push(mkField("pw", "password", o.passwordLabel, "Password"));
841
+ if (mode === "sign_up") {
842
+ children.push(mkField("cf", "confirm", o.confirmPasswordLabel, "Confirm password"));
843
+ }
844
+ const submitLbl = o.submitLabel ?? { default: mode === "sign_in" ? "Sign in" : "Create account" };
845
+ children.push({
846
+ id: `lyr_${slug}_submit`.slice(0, 64),
847
+ kind: "email_password_submit",
848
+ buttonVariant: "primary",
849
+ direction: "horizontal",
850
+ align: "center",
851
+ distribution: "center",
852
+ gap: 8,
853
+ children: [
854
+ {
855
+ id: `lyr_${slug}_submit_txt`.slice(0, 64),
856
+ kind: "text",
857
+ text: submitLbl
858
+ }
859
+ ]
860
+ });
861
+ const {
862
+ emailLabel: _e,
863
+ passwordLabel: _p,
864
+ confirmPasswordLabel: _c,
865
+ submitLabel: _s,
866
+ ...rest
867
+ } = o;
868
+ return { ...rest, mode, children };
869
+ };
870
+ var refineEmailPasswordAuthChildren = (data, ctx) => {
871
+ const fields = data.children.filter((c) => c.kind === "email_password_field");
872
+ const submits = data.children.filter((c) => c.kind === "email_password_submit");
873
+ const slotSeen = /* @__PURE__ */ new Set();
874
+ for (const f of fields) {
875
+ if (slotSeen.has(f.slot)) {
876
+ ctx.addIssue({
877
+ code: z.ZodIssueCode.custom,
878
+ message: `duplicate email_password_field slot "${f.slot}"`,
879
+ path: ["children"]
880
+ });
881
+ }
882
+ slotSeen.add(f.slot);
883
+ }
884
+ const slotHas = new Set(fields.map((f) => f.slot));
885
+ const requiredSlots = data.mode === "sign_up" ? ["email", "password", "confirm"] : ["email", "password"];
886
+ for (const s of requiredSlots) {
887
+ if (!slotHas.has(s)) {
888
+ ctx.addIssue({
889
+ code: z.ZodIssueCode.custom,
890
+ message: data.mode === "sign_up" ? `sign_up requires an email_password_field with slot "${s}"` : `sign_in requires an email_password_field with slot "${s}"`,
891
+ path: ["children"]
892
+ });
893
+ }
894
+ }
895
+ if (data.mode === "sign_in" && slotHas.has("confirm")) {
896
+ ctx.addIssue({
897
+ code: z.ZodIssueCode.custom,
898
+ message: 'sign_in must not include email_password_field with slot "confirm"',
899
+ path: ["children"]
900
+ });
901
+ }
902
+ if (submits.length !== 1) {
903
+ ctx.addIssue({
904
+ code: z.ZodIssueCode.custom,
905
+ message: `email_password_auth must have exactly one email_password_submit (found ${submits.length})`,
906
+ path: ["children"]
907
+ });
908
+ }
909
+ };
910
+ var EmailPasswordFieldLayerSchema = z.object({
911
+ ...baseLayerShape,
912
+ kind: z.literal("email_password_field"),
913
+ slot: z.enum(EMAIL_PASSWORD_SLOTS),
914
+ placeholder: LocalizedTextSchema.optional(),
915
+ children: z.lazy(() => z.array(lazyLayer4())).optional(),
916
+ style: CommonStyleSchema.optional(),
917
+ styleBreakpoints: CommonStyleBreakpointsSchema
918
+ });
919
+ var EmailPasswordSubmitLayerSchema = z.object({
920
+ ...baseLayerShape,
921
+ kind: z.literal("email_password_submit"),
922
+ buttonVariant: ButtonLayerVariantSchema,
923
+ direction: z.enum(["vertical", "horizontal"]).optional(),
924
+ gap: z.number().int().min(0).optional(),
925
+ align: z.enum(["start", "center", "end", "stretch"]).optional(),
926
+ distribution: z.enum(["start", "center", "end", "between", "around"]).optional(),
927
+ children: z.lazy(() => z.array(lazyLayer4()).min(1)),
928
+ style: ButtonStyleSchema.optional(),
929
+ styleBreakpoints: ButtonStyleBreakpointsSchema,
930
+ buttonLayoutBreakpoints: ButtonLayoutBreakpointsSchema
931
+ });
932
+ var EmailPasswordAuthLayerSchemaValidated = z.object({
933
+ ...baseLayerShape,
934
+ kind: z.literal("email_password_auth"),
935
+ mode: EmailPasswordAuthModeSchema,
936
+ fieldKey: FieldKeySchema,
937
+ minPasswordLength: z.number().int().min(4).max(128).optional(),
938
+ children: z.lazy(
939
+ () => z.array(z.union([EmailPasswordFieldLayerSchema, EmailPasswordSubmitLayerSchema])).min(1)
940
+ ),
941
+ gap: z.number().int().min(0).optional(),
942
+ align: z.enum(["start", "center", "end", "stretch"]).optional(),
943
+ style: CommonStyleSchema.optional(),
944
+ styleBreakpoints: CommonStyleBreakpointsSchema
945
+ }).superRefine(refineEmailPasswordAuthChildren);
946
+ var EmailPasswordAuthLayerSchema = z.preprocess(
947
+ migrateEmailPasswordAuthIncoming,
948
+ EmailPasswordAuthLayerSchemaValidated
949
+ );
950
+ var ChoiceOptionBindingSchema = z.object({
951
+ optionId: z.string().min(1).max(64),
952
+ rootLayerId: LayerIdSchema
953
+ });
954
+ var BranchConditionSchema = z.object({
955
+ choiceId: z.string().min(1),
956
+ goTo: ScreenIdSchema
957
+ });
958
+ var ChoiceBranchingSchema = z.object({
959
+ enabled: z.boolean(),
960
+ conditions: z.array(BranchConditionSchema)
961
+ });
962
+
963
+ // src/layers/kinds/input.ts
964
+ var lazyLayer5 = () => layerSchemaStore.schema;
965
+ var ChoiceChildrenAndBindingsRefinement = (data, ctx) => {
966
+ const childIds = /* @__PURE__ */ new Set();
967
+ for (const c of data.children) {
968
+ if (childIds.has(c.id)) {
969
+ ctx.addIssue({
970
+ code: z.ZodIssueCode.custom,
971
+ message: `duplicate option child id "${c.id}"`,
972
+ path: ["children"]
973
+ });
974
+ }
975
+ childIds.add(c.id);
976
+ }
977
+ const seenOptionIds = /* @__PURE__ */ new Set();
978
+ const seenRootIds = /* @__PURE__ */ new Set();
979
+ for (const b of data.optionBindings) {
980
+ if (seenOptionIds.has(b.optionId)) {
981
+ ctx.addIssue({
982
+ code: z.ZodIssueCode.custom,
983
+ message: `duplicate optionId "${b.optionId}" in optionBindings`,
984
+ path: ["optionBindings"]
985
+ });
986
+ }
987
+ seenOptionIds.add(b.optionId);
988
+ if (seenRootIds.has(b.rootLayerId)) {
989
+ ctx.addIssue({
990
+ code: z.ZodIssueCode.custom,
991
+ message: `duplicate rootLayerId "${b.rootLayerId}" in optionBindings`,
992
+ path: ["optionBindings"]
993
+ });
994
+ }
995
+ seenRootIds.add(b.rootLayerId);
996
+ if (!childIds.has(b.rootLayerId)) {
997
+ ctx.addIssue({
998
+ code: z.ZodIssueCode.custom,
999
+ message: `optionBindings rootLayerId "${b.rootLayerId}" does not match any direct child stack`,
1000
+ path: ["optionBindings"]
1001
+ });
1002
+ }
1003
+ }
1004
+ if (data.optionBindings.length !== data.children.length) {
1005
+ ctx.addIssue({
1006
+ code: z.ZodIssueCode.custom,
1007
+ message: "optionBindings length must equal children length",
1008
+ path: ["optionBindings"]
1009
+ });
1010
+ }
1011
+ };
1012
+ var SingleChoiceLayerSchema = z.object({
1013
+ ...baseLayerShape,
1014
+ kind: z.literal("single_choice"),
1015
+ fieldKey: FieldKeySchema,
1016
+ children: z.lazy(
1017
+ () => z.array(StackLayerSchema).min(2)
1018
+ ),
1019
+ optionBindings: z.array(ChoiceOptionBindingSchema).min(2),
1020
+ branching: ChoiceBranchingSchema,
1021
+ direction: z.enum(["vertical", "horizontal", "grid"]).optional(),
1022
+ gap: z.number().int().min(0).optional(),
1023
+ columns: z.number().int().min(1).max(12).optional(),
1024
+ style: CommonStyleSchema.optional(),
1025
+ styleBreakpoints: CommonStyleBreakpointsSchema
1026
+ });
1027
+ var MultipleChoiceLayerSchema = z.object({
1028
+ ...baseLayerShape,
1029
+ kind: z.literal("multiple_choice"),
1030
+ fieldKey: FieldKeySchema,
1031
+ children: z.lazy(
1032
+ () => z.array(StackLayerSchema).min(2)
1033
+ ),
1034
+ optionBindings: z.array(ChoiceOptionBindingSchema).min(2),
1035
+ minSelections: z.number().int().nonnegative().optional(),
1036
+ maxSelections: z.number().int().positive().optional(),
1037
+ branching: ChoiceBranchingSchema,
1038
+ direction: z.enum(["vertical", "horizontal", "grid"]).optional(),
1039
+ gap: z.number().int().min(0).optional(),
1040
+ columns: z.number().int().min(1).max(12).optional(),
1041
+ style: CommonStyleSchema.optional(),
1042
+ styleBreakpoints: CommonStyleBreakpointsSchema
1043
+ });
1044
+ var validateChoiceChildrenAndBindings = ChoiceChildrenAndBindingsRefinement;
1045
+ var TextInputLayerSchema = z.object({
1046
+ ...baseLayerShape,
1047
+ kind: z.literal("text_input"),
1048
+ fieldKey: FieldKeySchema,
1049
+ placeholder: LocalizedTextSchema.optional(),
1050
+ inputType: TextInputTypeSchema.optional(),
1051
+ required: z.boolean().optional(),
1052
+ minLength: z.number().int().min(0).max(2e3).optional(),
1053
+ maxLength: z.number().int().positive().max(2e3).optional(),
1054
+ classification: FieldClassificationSchema,
1055
+ children: z.lazy(() => z.array(lazyLayer5())).optional(),
1056
+ style: CommonStyleSchema.optional()
1057
+ });
1058
+ var ScaleInputLabelStyleSchema = z.object({
1059
+ fontFamily: z.string().min(1).max(128).optional(),
1060
+ fontSize: z.number().int().min(8).max(96).optional(),
1061
+ fontWeight: z.number().int().min(100).max(900).optional(),
1062
+ color: ThemedColorSchema.optional(),
1063
+ align: z.enum(["left", "center", "right"]).optional(),
1064
+ lineHeight: z.number().min(0.8).max(3).optional(),
1065
+ opacity: z.number().min(0).max(1).optional()
1066
+ }).partial();
1067
+ var ScaleInputLayerSchema = z.object({
1068
+ ...baseLayerShape,
1069
+ kind: z.literal("scale_input"),
1070
+ fieldKey: FieldKeySchema,
1071
+ min: z.number(),
1072
+ max: z.number(),
1073
+ step: z.number().positive().optional(),
1074
+ defaultValue: z.number().optional(),
1075
+ minLabel: LocalizedTextSchema.optional(),
1076
+ maxLabel: LocalizedTextSchema.optional(),
1077
+ labelStyle: ScaleInputLabelStyleSchema.optional(),
1078
+ valueStyle: ScaleInputLabelStyleSchema.optional(),
1079
+ showLabels: z.boolean().optional(),
1080
+ showValue: z.boolean().optional(),
1081
+ trackHeight: z.number().int().min(2).max(32).optional(),
1082
+ trackColor: ThemedColorSchema.optional(),
1083
+ fillColor: ThemedColorSchema.optional(),
1084
+ thumbSize: z.number().int().min(8).max(48).optional(),
1085
+ thumbColor: ThemedColorSchema.optional(),
1086
+ children: z.lazy(() => z.array(lazyLayer5())).optional(),
1087
+ style: CommonStyleSchema.optional()
1088
+ });
1089
+ var CarouselIndicatorsStyleSchema = z.object({
1090
+ width: z.number().int().min(1).max(64).optional(),
1091
+ height: z.number().int().min(1).max(64).optional(),
1092
+ defaultColor: ThemedColorSchema.optional(),
1093
+ defaultOpacity: z.number().min(0).max(1).optional(),
1094
+ activeColor: ThemedColorSchema.optional(),
1095
+ activeOpacity: z.number().min(0).max(1).optional(),
1096
+ activeWidth: z.number().int().min(1).max(64).optional(),
1097
+ activeHeight: z.number().int().min(1).max(64).optional(),
1098
+ border: BorderSchema.optional(),
1099
+ activeBorder: BorderSchema.optional()
1100
+ }).partial();
1101
+ var CarouselPageControlSchema = z.object({
1102
+ position: z.enum(["top", "bottom"]),
1103
+ spacing: z.number().int().min(0).optional(),
1104
+ padding: PaddingSchema.optional(),
1105
+ margin: PaddingSchema.optional(),
1106
+ indicators: CarouselIndicatorsStyleSchema.optional(),
1107
+ border: BorderSchema.optional(),
1108
+ shadow: DropShadowSchema.optional()
1109
+ });
1110
+ var CarouselLayerSchema = z.object({
1111
+ ...baseLayerShape,
1112
+ kind: z.literal("carousel"),
1113
+ slides: z.lazy(() => z.array(StackLayerSchema).min(1)),
1114
+ pageAlignment: z.enum(["top", "center", "bottom"]).optional(),
1115
+ pageSpacing: z.number().int().min(0).optional(),
1116
+ pagePeek: z.number().int().min(0).max(400).optional(),
1117
+ openOn: z.number().int().min(0).optional(),
1118
+ loop: z.boolean().optional(),
1119
+ autoAdvance: z.boolean().optional(),
1120
+ autoAdvanceMs: z.number().int().min(500).max(6e4).optional(),
1121
+ pageControl: CarouselPageControlSchema.optional(),
1122
+ style: CommonStyleSchema.optional(),
1123
+ styleBreakpoints: CommonStyleBreakpointsSchema
1124
+ });
1125
+
1126
+ // src/layers/initLayerSchema.ts
1127
+ layerSchemaStore.schema = z.lazy(
1128
+ () => z.union([
1129
+ StackLayerSchema,
1130
+ TextLayerSchema,
1131
+ HyperlinkLayerSchema,
1132
+ ImageLayerSchema,
1133
+ LottieLayerSchema,
1134
+ VideoLayerSchema,
1135
+ IconLayerSchema,
1136
+ ButtonLayerSchema,
1137
+ BackButtonLayerSchema,
1138
+ ProgressLayerSchema,
1139
+ LoaderLayerSchema,
1140
+ CounterLayerSchema,
1141
+ CheckboxLayerSchema,
1142
+ SingleChoiceLayerSchema,
1143
+ MultipleChoiceLayerSchema,
1144
+ TextInputLayerSchema,
1145
+ ScaleInputLayerSchema,
1146
+ OAuthLoginLayerSchema,
1147
+ OAuthProviderPresetLayerSchema,
1148
+ OAuthProviderCustomLayerSchema,
1149
+ EmailPasswordAuthLayerSchema,
1150
+ EmailPasswordFieldLayerSchema,
1151
+ EmailPasswordSubmitLayerSchema,
1152
+ CarouselLayerSchema
1153
+ ])
1154
+ );
1155
+ var LayerSchema = layerSchemaStore.schema;
1156
+
1157
+ // src/layers/layerKinds.ts
1158
+ var LAYER_KINDS = [
1159
+ "stack",
1160
+ "text",
1161
+ "image",
1162
+ "lottie",
1163
+ "video",
1164
+ "icon",
1165
+ "button",
1166
+ "back_button",
1167
+ "progress",
1168
+ "loader",
1169
+ "counter",
1170
+ "single_choice",
1171
+ "multiple_choice",
1172
+ "text_input",
1173
+ "scale_input",
1174
+ "oauth_provider",
1175
+ "oauth_login",
1176
+ "email_password_auth",
1177
+ "email_password_field",
1178
+ "email_password_submit",
1179
+ "carousel",
1180
+ "hyperlink",
1181
+ "checkbox"
1182
+ ];
1183
+ var INPUT_LAYER_KINDS = [
1184
+ "single_choice",
1185
+ "multiple_choice",
1186
+ "text_input",
1187
+ "scale_input"
1188
+ ];
1189
+
1190
+ // src/layers/tree.ts
1191
+ var STYLE_BREAKPOINT_KEYS = ["sm", "md", "lg", "xl", "2xl"];
1192
+ var commonStyleHasAbsolutePosition = (style, breakpoints) => {
1193
+ if (style?.position === "absolute") return true;
1194
+ if (!breakpoints) return false;
1195
+ for (const k of STYLE_BREAKPOINT_KEYS) {
1196
+ if (breakpoints[k]?.position === "absolute") return true;
1197
+ }
1198
+ return false;
1199
+ };
1200
+ var layerHasAbsolutePositionAuthored = (layer) => {
1201
+ switch (layer.kind) {
1202
+ case "stack":
1203
+ return commonStyleHasAbsolutePosition(layer.style, layer.styleBreakpoints) || layer.selectedStyle?.position === "absolute";
1204
+ case "text":
1205
+ case "counter":
1206
+ return commonStyleHasAbsolutePosition(layer.style, layer.styleBreakpoints);
1207
+ case "image":
1208
+ case "lottie":
1209
+ case "video":
1210
+ return commonStyleHasAbsolutePosition(layer.style, layer.styleBreakpoints);
1211
+ case "icon":
1212
+ return commonStyleHasAbsolutePosition(layer.style, layer.styleBreakpoints);
1213
+ case "button":
1214
+ case "back_button":
1215
+ case "hyperlink":
1216
+ return commonStyleHasAbsolutePosition(layer.style, layer.styleBreakpoints);
1217
+ case "progress":
1218
+ case "loader":
1219
+ return commonStyleHasAbsolutePosition(layer.style, void 0);
1220
+ case "text_input":
1221
+ case "scale_input":
1222
+ return commonStyleHasAbsolutePosition(layer.style, void 0);
1223
+ case "oauth_provider":
1224
+ if (layer.variant === "preset") {
1225
+ return commonStyleHasAbsolutePosition(layer.style, layer.styleBreakpoints);
1226
+ }
1227
+ return commonStyleHasAbsolutePosition(layer.style, layer.styleBreakpoints);
1228
+ case "oauth_login":
1229
+ return commonStyleHasAbsolutePosition(layer.style, layer.styleBreakpoints);
1230
+ case "email_password_auth":
1231
+ return commonStyleHasAbsolutePosition(layer.style, layer.styleBreakpoints);
1232
+ case "email_password_field":
1233
+ return commonStyleHasAbsolutePosition(layer.style, layer.styleBreakpoints);
1234
+ case "email_password_submit":
1235
+ return commonStyleHasAbsolutePosition(layer.style, layer.styleBreakpoints);
1236
+ case "carousel":
1237
+ return commonStyleHasAbsolutePosition(layer.style, void 0);
1238
+ case "checkbox":
1239
+ case "single_choice":
1240
+ case "multiple_choice":
1241
+ return commonStyleHasAbsolutePosition(layer.style, layer.styleBreakpoints);
1242
+ default:
1243
+ return false;
1244
+ }
1245
+ };
1246
+ var layerSubtreeContainsAbsolutePosition = (layer) => {
1247
+ if (layerHasAbsolutePositionAuthored(layer)) return true;
1248
+ if (layer.kind === "stack") {
1249
+ return layer.children.some(layerSubtreeContainsAbsolutePosition);
1250
+ }
1251
+ if (layer.kind === "carousel") {
1252
+ return layer.slides.some(layerSubtreeContainsAbsolutePosition);
1253
+ }
1254
+ if (layer.kind === "button" || layer.kind === "back_button" || layer.kind === "hyperlink") {
1255
+ return layer.children.some(layerSubtreeContainsAbsolutePosition);
1256
+ }
1257
+ if (layer.kind === "single_choice" || layer.kind === "multiple_choice") {
1258
+ return layer.children.some(layerSubtreeContainsAbsolutePosition);
1259
+ }
1260
+ if (layer.kind === "text_input" || layer.kind === "scale_input") {
1261
+ return layer.children?.some(layerSubtreeContainsAbsolutePosition) ?? false;
1262
+ }
1263
+ if (layer.kind === "oauth_login") {
1264
+ return layer.children.some(layerSubtreeContainsAbsolutePosition);
1265
+ }
1266
+ if (layer.kind === "oauth_provider" && layer.variant === "custom") {
1267
+ return layer.children.some(layerSubtreeContainsAbsolutePosition);
1268
+ }
1269
+ if (layer.kind === "email_password_auth") {
1270
+ return layer.children.some(layerSubtreeContainsAbsolutePosition);
1271
+ }
1272
+ if (layer.kind === "email_password_field") {
1273
+ return layer.children?.some(layerSubtreeContainsAbsolutePosition) ?? false;
1274
+ }
1275
+ if (layer.kind === "email_password_submit") {
1276
+ return layer.children.some(layerSubtreeContainsAbsolutePosition);
1277
+ }
1278
+ return false;
1279
+ };
1280
+
1281
+ // src/layers/layerUnion.ts
1282
+ var isInputLayer = (l) => l.kind === "single_choice" || l.kind === "multiple_choice" || l.kind === "text_input" || l.kind === "scale_input";
1283
+ var isParentLayer = (l) => l.kind === "stack" || l.kind === "carousel" || l.kind === "button" || l.kind === "back_button" || l.kind === "hyperlink" || l.kind === "single_choice" || l.kind === "multiple_choice" || l.kind === "text_input" || l.kind === "scale_input" || l.kind === "oauth_login" || l.kind === "oauth_provider" && l.variant === "custom" || l.kind === "email_password_auth" || l.kind === "email_password_field" || l.kind === "email_password_submit";
1284
+
1285
+ // src/layers/minimalLayerExamples.ts
1286
+ var label = (id, copy) => ({
1287
+ id,
1288
+ kind: "text",
1289
+ text: { default: copy },
1290
+ style: { color: PRIMARY_FILLED_LABEL }
1291
+ });
1292
+ var choiceOptions = (prefix) => {
1293
+ const a = {
1294
+ id: `${prefix}_opt_a`,
1295
+ kind: "stack",
1296
+ direction: "horizontal",
1297
+ align: "center",
1298
+ gap: 8,
1299
+ children: [
1300
+ {
1301
+ id: `${prefix}_opt_a_t`,
1302
+ kind: "text",
1303
+ text: { default: "A" },
1304
+ style: { color: DEFAULT_THEMED_FOREGROUND }
1305
+ }
1306
+ ]
1307
+ };
1308
+ const b = {
1309
+ id: `${prefix}_opt_b`,
1310
+ kind: "stack",
1311
+ direction: "horizontal",
1312
+ align: "center",
1313
+ gap: 8,
1314
+ children: [
1315
+ {
1316
+ id: `${prefix}_opt_b_t`,
1317
+ kind: "text",
1318
+ text: { default: "B" },
1319
+ style: { color: DEFAULT_THEMED_FOREGROUND }
1320
+ }
1321
+ ]
1322
+ };
1323
+ return {
1324
+ children: [a, b],
1325
+ optionBindings: [
1326
+ { optionId: "a", rootLayerId: `${prefix}_opt_a` },
1327
+ { optionId: "b", rootLayerId: `${prefix}_opt_b` }
1328
+ ]
1329
+ };
1330
+ };
1331
+ var minimalLayerExamples = () => ({
1332
+ stack: {
1333
+ id: "lyr_stack",
1334
+ kind: "stack",
1335
+ direction: "vertical",
1336
+ gap: 8,
1337
+ children: [
1338
+ {
1339
+ id: "lyr_stack_txt",
1340
+ kind: "text",
1341
+ text: { default: "Nested" },
1342
+ style: { color: DEFAULT_THEMED_FOREGROUND }
1343
+ }
1344
+ ]
1345
+ },
1346
+ text: {
1347
+ id: "lyr_text",
1348
+ kind: "text",
1349
+ text: { default: "Hello" },
1350
+ style: { color: DEFAULT_THEMED_FOREGROUND }
1351
+ },
1352
+ image: { id: "lyr_image", kind: "image", alt: "x" },
1353
+ lottie: { id: "lyr_lottie", kind: "lottie", loop: true },
1354
+ video: { id: "lyr_video", kind: "video", loop: true },
1355
+ icon: { id: "lyr_icon", kind: "icon", family: "ionicons", iconName: "star-outline" },
1356
+ button: {
1357
+ id: "lyr_btn",
1358
+ kind: "button",
1359
+ variant: "primary",
1360
+ action: { kind: "continue" },
1361
+ children: [label("lyr_btn_t", "Go")]
1362
+ },
1363
+ back_button: {
1364
+ id: "lyr_back",
1365
+ kind: "back_button",
1366
+ variant: "secondary",
1367
+ children: [label("lyr_back_t", "Back")]
1368
+ },
1369
+ progress: { id: "lyr_prog", kind: "progress", style: { height: 6 } },
1370
+ loader: { id: "lyr_load", kind: "loader", variant: "linear" },
1371
+ counter: {
1372
+ id: "lyr_ctr",
1373
+ kind: "counter",
1374
+ startValue: 0,
1375
+ endValue: 10,
1376
+ durationMs: 500
1377
+ },
1378
+ single_choice: {
1379
+ id: "lyr_sc",
1380
+ kind: "single_choice",
1381
+ fieldKey: "pick",
1382
+ branching: { enabled: false, conditions: [] },
1383
+ ...choiceOptions("lyr_sc")
1384
+ },
1385
+ multiple_choice: {
1386
+ id: "lyr_mc",
1387
+ kind: "multiple_choice",
1388
+ fieldKey: "tags",
1389
+ branching: { enabled: false, conditions: [] },
1390
+ ...choiceOptions("lyr_mc")
1391
+ },
1392
+ text_input: {
1393
+ id: "lyr_ti",
1394
+ kind: "text_input",
1395
+ fieldKey: "name",
1396
+ classification: "safe"
1397
+ },
1398
+ scale_input: {
1399
+ id: "lyr_scale",
1400
+ kind: "scale_input",
1401
+ fieldKey: "level",
1402
+ min: 1,
1403
+ max: 5,
1404
+ defaultValue: 3
1405
+ },
1406
+ oauth_provider: {
1407
+ id: "lyr_oauth_gh",
1408
+ kind: "oauth_provider",
1409
+ variant: "preset",
1410
+ provider: "github"
1411
+ },
1412
+ oauth_login: {
1413
+ id: "lyr_oauth",
1414
+ kind: "oauth_login",
1415
+ gap: 8,
1416
+ children: [
1417
+ {
1418
+ id: "lyr_oauth_gh_inner",
1419
+ kind: "oauth_provider",
1420
+ variant: "preset",
1421
+ provider: "google"
1422
+ }
1423
+ ]
1424
+ },
1425
+ email_password_auth: {
1426
+ id: "lyr_epa",
1427
+ kind: "email_password_auth",
1428
+ mode: "sign_in",
1429
+ fieldKey: "credentials",
1430
+ children: [
1431
+ {
1432
+ id: "lyr_epf_email",
1433
+ kind: "email_password_field",
1434
+ slot: "email",
1435
+ placeholder: { default: "Email" }
1436
+ },
1437
+ {
1438
+ id: "lyr_epf_pass",
1439
+ kind: "email_password_field",
1440
+ slot: "password",
1441
+ placeholder: { default: "Password" }
1442
+ },
1443
+ {
1444
+ id: "lyr_eps",
1445
+ kind: "email_password_submit",
1446
+ buttonVariant: "primary",
1447
+ children: [label("lyr_eps_t", "Sign in")]
1448
+ }
1449
+ ]
1450
+ },
1451
+ email_password_field: {
1452
+ id: "lyr_epf_only",
1453
+ kind: "email_password_field",
1454
+ slot: "email"
1455
+ },
1456
+ email_password_submit: {
1457
+ id: "lyr_eps_only",
1458
+ kind: "email_password_submit",
1459
+ buttonVariant: "primary",
1460
+ children: [label("lyr_eps_only_t", "Submit")]
1461
+ },
1462
+ carousel: {
1463
+ id: "lyr_car",
1464
+ kind: "carousel",
1465
+ slides: [
1466
+ {
1467
+ id: "lyr_slide",
1468
+ kind: "stack",
1469
+ direction: "vertical",
1470
+ gap: 8,
1471
+ children: [
1472
+ {
1473
+ id: "lyr_slide_t",
1474
+ kind: "text",
1475
+ text: { default: "Slide" },
1476
+ style: { color: DEFAULT_THEMED_FOREGROUND }
1477
+ }
1478
+ ]
1479
+ }
1480
+ ]
1481
+ },
1482
+ hyperlink: {
1483
+ id: "lyr_link",
1484
+ kind: "hyperlink",
1485
+ href: "https://example.com",
1486
+ children: [
1487
+ {
1488
+ id: "lyr_link_t",
1489
+ kind: "text",
1490
+ text: { default: "Link" },
1491
+ style: { color: DEFAULT_THEMED_FOREGROUND }
1492
+ }
1493
+ ]
1494
+ },
1495
+ checkbox: {
1496
+ id: "lyr_chk",
1497
+ kind: "checkbox",
1498
+ fieldKey: "agree"
1499
+ }
1500
+ });
1501
+ var manifestScreenLayerKinds = () => LAYER_KINDS.filter(
1502
+ (k) => k !== "oauth_provider" && k !== "email_password_field" && k !== "email_password_submit"
1503
+ );
1504
+
1505
+ export { APP_REVIEW_CAPTURE_FIELD_KEY_PREFIX, APP_REVIEW_OUTCOMES, AppReviewOutcomeSchema, BUTTON_LAYER_VARIANTS, BackButtonLayerSchema, BorderSchema, BranchConditionSchema, ButtonActionSchema, ButtonLayerSchema, ButtonLayerVariantSchema, ButtonLayoutBreakpointsSchema, ButtonStyleBreakpointsSchema, ButtonStyleSchema, COUNTER_DISPLAY_KINDS, COUNTER_TIME_FORMATS, CarouselIndicatorsStyleSchema, CarouselLayerSchema, CarouselPageControlSchema, CheckboxGlyphStyleSchema, CheckboxLayerSchema, ChoiceBranchingSchema, ChoiceOptionBindingSchema, CommonLayoutHeightSchema, CommonStyleBreakpointsSchema, CommonStyleSchema, CounterLayerSchema, DEFAULT_OAUTH_PRESET_BUTTON_LABEL, DEFAULT_THEMED_FOREGROUND, DropShadowSchema, EMAIL_PASSWORD_AUTH_MODES, EMAIL_PASSWORD_SLOTS, EmailPasswordAuthLayerSchema, EmailPasswordAuthModeSchema, EmailPasswordFieldLayerSchema, EmailPasswordSubmitLayerSchema, HEIGHT_PRESETS, HyperlinkLayerSchema, ICON_FAMILIES, INPUT_LAYER_KINDS, IconLayerSchema, IconStyleBreakpointsSchema, IconStyleSchema, ImageLayerSchema, ImageStyleBreakpointsSchema, ImageStyleSchema, LAYER_KINDS, LayerIdSchema, LayerSchema, LoaderLayerSchema, LoaderOnCompleteSchema, LottieLayerSchema, MultipleChoiceLayerSchema, NonNegativePxSchema, OAUTH_LOGIN_PRESETS, OAUTH_LOGIN_PRESET_DISPLAY, OAuthLoginCustomProviderSchema, OAuthLoginLayerSchema, OAuthLoginPresetProviderSchema, OAuthLoginProviderSchema, OAuthLoginProvidersArraySchema, OAuthPresetButtonChromeBreakpointsSchema, OAuthPresetButtonChromeSchema, OAuthProviderCustomLayerSchema, OAuthProviderLayerSchema, OAuthProviderPresetLayerSchema, OS_PERMISSION_KEYS, OS_PERMISSION_OUTCOME_CONTINUE, OS_PERMISSION_OUTCOME_END, OsPermissionKeySchema, OsPermissionOutcomeBranchTargetSchema, PERMISSION_CAPTURE_FIELD_KEY_PREFIX, PERMISSION_OUTCOME_VALUES, PRIMARY_FILLED_LABEL, PaddingSchema, PermissionOutcomeSchema, ProgressLayerSchema, RESTING_MOTION_PRESETS, RESTING_MOTION_ROTATE_DIRECTIONS, RESTING_MOTION_SCALE_DIRECTIONS, RestingMotionEntrySchema, RestingMotionPresetSchema, RestingMotionRotateDirectionSchema, RestingMotionScaleDirectionSchema, RestingMotionSchema, ScaleInputLabelStyleSchema, ScaleInputLayerSchema, ScreenIdSchema, SingleChoiceLayerSchema, StackLayerSchema, StackLayoutBreakpointsSchema, TEXT_INPUT_TYPES, TextInputLayerSchema, TextInputTypeSchema, TextLayerSchema, TextStyleBreakpointsSchema, TextStyleSchema, ThemedColorModesSchema, ThemedColorSchema, VideoLayerSchema, WIDTH_PRESETS, WidthValueSchema, appReviewCaptureFieldKey, baseLayerShape, commonStyleHasAbsolutePosition, defaultOAuthPresetButtonLabel, emailPasswordAuthResponseKey, isInputLayer, isParentLayer, layerHasAbsolutePositionAuthored, layerSchemaStore, layerSubtreeContainsAbsolutePosition, manifestScreenLayerKinds, minimalLayerExamples, oauthLoginManifestProviderFromLayer, oauthLoginResponseKey, oauthPresetEffectiveLabel, permissionCaptureFieldKey, validateChoiceChildrenAndBindings };
1506
+ //# sourceMappingURL=layers.js.map
1507
+ //# sourceMappingURL=layers.js.map