@remotion/studio 4.0.424 → 4.0.426

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 (88) hide show
  1. package/dist/api/create-composition.d.ts +1 -2
  2. package/dist/api/helpers/calc-new-props.d.ts +1 -2
  3. package/dist/components/AssetSelector.js +1 -1
  4. package/dist/components/AssetSelectorItem.d.ts +1 -0
  5. package/dist/components/AssetSelectorItem.js +9 -8
  6. package/dist/components/InitialCompositionLoader.js +13 -1
  7. package/dist/components/NewComposition/CodemodFooter.d.ts +1 -0
  8. package/dist/components/NewComposition/CodemodFooter.js +3 -1
  9. package/dist/components/NewComposition/DeleteComposition.js +1 -1
  10. package/dist/components/NewComposition/DuplicateComposition.js +5 -1
  11. package/dist/components/NewComposition/RenameComposition.js +1 -1
  12. package/dist/components/RenderModal/DataEditor.d.ts +2 -1
  13. package/dist/components/RenderModal/DataEditor.js +6 -6
  14. package/dist/components/RenderModal/RenderModalJSONPropsEditor.d.ts +2 -2
  15. package/dist/components/RenderModal/RenderModalJSONPropsEditor.js +3 -2
  16. package/dist/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +3 -3
  17. package/dist/components/RenderModal/SchemaEditor/SchemaEditor.js +4 -5
  18. package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.d.ts +3 -3
  19. package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +1 -0
  20. package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.d.ts +2 -2
  21. package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.js +4 -3
  22. package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +2 -2
  23. package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.js +3 -6
  24. package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.d.ts +2 -1
  25. package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.js +2 -2
  26. package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +2 -2
  27. package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +2 -2
  28. package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +2 -2
  29. package/dist/components/RenderModal/SchemaEditor/ZodDefaultEditor.d.ts +3 -3
  30. package/dist/components/RenderModal/SchemaEditor/ZodDefaultEditor.js +2 -1
  31. package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.d.ts +2 -2
  32. package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +18 -18
  33. package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +2 -2
  34. package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.js +6 -10
  35. package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +2 -2
  36. package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +4 -12
  37. package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.d.ts +2 -2
  38. package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.js +2 -2
  39. package/dist/components/RenderModal/SchemaEditor/ZodFieldValidation.js +4 -3
  40. package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.d.ts +2 -2
  41. package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.js +3 -2
  42. package/dist/components/RenderModal/SchemaEditor/ZodNullableEditor.d.ts +2 -2
  43. package/dist/components/RenderModal/SchemaEditor/ZodNullableEditor.js +2 -1
  44. package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +2 -2
  45. package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.js +49 -21
  46. package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +2 -2
  47. package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.js +4 -9
  48. package/dist/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +2 -2
  49. package/dist/components/RenderModal/SchemaEditor/ZodOptionalEditor.js +2 -1
  50. package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.d.ts +3 -3
  51. package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.d.ts +2 -2
  52. package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +0 -10
  53. package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +2 -2
  54. package/dist/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +2 -2
  55. package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +38 -33
  56. package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.d.ts +2 -2
  57. package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.d.ts +2 -2
  58. package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.js +3 -6
  59. package/dist/components/RenderModal/SchemaEditor/ZodTupleItemEditor.d.ts +2 -1
  60. package/dist/components/RenderModal/SchemaEditor/ZodTupleItemEditor.js +2 -2
  61. package/dist/components/RenderModal/SchemaEditor/ZodUnionEditor.d.ts +2 -2
  62. package/dist/components/RenderModal/SchemaEditor/ZodUnionEditor.js +11 -15
  63. package/dist/components/RenderModal/SchemaEditor/create-zod-values.d.ts +2 -2
  64. package/dist/components/RenderModal/SchemaEditor/create-zod-values.js +108 -110
  65. package/dist/components/RenderModal/SchemaEditor/extract-enum-json-paths.d.ts +3 -3
  66. package/dist/components/RenderModal/SchemaEditor/extract-enum-json-paths.js +72 -87
  67. package/dist/components/RenderModal/SchemaEditor/local-state.d.ts +3 -3
  68. package/dist/components/RenderModal/SchemaEditor/local-state.js +5 -4
  69. package/dist/components/RenderModal/SchemaEditor/zod-schema-type.d.ts +176 -0
  70. package/dist/components/RenderModal/SchemaEditor/zod-schema-type.js +330 -0
  71. package/dist/components/Tabs/index.js +2 -0
  72. package/dist/components/Tabs/vertical.js +2 -0
  73. package/dist/components/TimeValue.js +0 -2
  74. package/dist/components/Timeline/TimelineDragHandler.js +6 -0
  75. package/dist/components/get-zod-if-possible.d.ts +3 -0
  76. package/dist/components/get-zod-if-possible.js +23 -2
  77. package/dist/esm/{chunk-3g77e2p9.js → chunk-kde77jse.js} +589 -373
  78. package/dist/esm/index.mjs +170 -81
  79. package/dist/esm/internals.mjs +589 -373
  80. package/dist/esm/previewEntry.mjs +598 -375
  81. package/dist/esm/renderEntry.mjs +1 -1
  82. package/dist/helpers/inject-css.js +2 -1
  83. package/dist/index.d.ts +2 -2
  84. package/dist/previewEntry.d.ts +5 -0
  85. package/dist/previewEntry.js +11 -2
  86. package/dist/visual-controls/VisualControls.d.ts +4 -4
  87. package/dist/visual-controls/VisualControls.js +1 -1
  88. package/package.json +11 -11
@@ -3717,7 +3717,8 @@ var AssetFolderItem = ({
3717
3717
  parentFolder,
3718
3718
  toggleFolder,
3719
3719
  dropLocation,
3720
- setDropLocation
3720
+ setDropLocation,
3721
+ readOnlyStudio
3721
3722
  }) => {
3722
3723
  const [hovered, setHovered] = useState15(false);
3723
3724
  const openFolderTimerRef = useRef12(null);
@@ -3800,7 +3801,8 @@ var AssetFolderItem = ({
3800
3801
  tabIndex,
3801
3802
  toggleFolder,
3802
3803
  dropLocation,
3803
- setDropLocation
3804
+ setDropLocation,
3805
+ readOnlyStudio
3804
3806
  }, item.name) : null
3805
3807
  ]
3806
3808
  });
@@ -3813,7 +3815,8 @@ var AssetFolderTree = ({
3813
3815
  toggleFolder,
3814
3816
  tabIndex,
3815
3817
  dropLocation,
3816
- setDropLocation
3818
+ setDropLocation,
3819
+ readOnlyStudio
3817
3820
  }) => {
3818
3821
  const combinedParents = useMemo23(() => {
3819
3822
  return [parentFolder, name].filter(NoReactInternals3.truthy).join("/");
@@ -3828,7 +3831,8 @@ var AssetFolderTree = ({
3828
3831
  parentFolder: combinedParents,
3829
3832
  toggleFolder,
3830
3833
  dropLocation,
3831
- setDropLocation
3834
+ setDropLocation,
3835
+ readOnlyStudio
3832
3836
  }, folder.name);
3833
3837
  }),
3834
3838
  item.files.map((file) => {
@@ -3836,13 +3840,14 @@ var AssetFolderTree = ({
3836
3840
  item: file,
3837
3841
  tabIndex,
3838
3842
  level,
3839
- parentFolder: combinedParents
3843
+ parentFolder: combinedParents,
3844
+ readOnlyStudio
3840
3845
  }, file.src);
3841
3846
  })
3842
3847
  ]
3843
3848
  });
3844
3849
  };
3845
- var AssetSelectorItem = ({ item, tabIndex, level, parentFolder }) => {
3850
+ var AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio }) => {
3846
3851
  const isMobileLayout = useMobileLayout();
3847
3852
  const [hovered, setHovered] = useState15(false);
3848
3853
  const { setSidebarCollapsedState } = useContext10(SidebarContext);
@@ -3949,13 +3954,17 @@ var AssetSelectorItem = ({ item, tabIndex, level, parentFolder }) => {
3949
3954
  renderAction: renderCopyAction,
3950
3955
  onClick: copyToClipboard
3951
3956
  }),
3952
- /* @__PURE__ */ jsx35(Spacing, {
3953
- x: 0.5
3954
- }),
3955
- /* @__PURE__ */ jsx35(InlineAction, {
3956
- title: "Open in Explorer",
3957
- renderAction: renderFileExplorerAction,
3958
- onClick: revealInExplorer
3957
+ readOnlyStudio ? null : /* @__PURE__ */ jsxs9(Fragment5, {
3958
+ children: [
3959
+ /* @__PURE__ */ jsx35(Spacing, {
3960
+ x: 0.5
3961
+ }),
3962
+ /* @__PURE__ */ jsx35(InlineAction, {
3963
+ title: "Open in Explorer",
3964
+ renderAction: renderFileExplorerAction,
3965
+ onClick: revealInExplorer
3966
+ })
3967
+ ]
3959
3968
  })
3960
3969
  ]
3961
3970
  }) : null
@@ -4310,7 +4319,8 @@ var AssetSelector = ({ readOnlyStudio }) => {
4310
4319
  tabIndex,
4311
4320
  toggleFolder,
4312
4321
  dropLocation,
4313
- setDropLocation
4322
+ setDropLocation,
4323
+ readOnlyStudio
4314
4324
  })
4315
4325
  })
4316
4326
  ]
@@ -4431,7 +4441,9 @@ var selectorButton = {
4431
4441
  fontSize: 14,
4432
4442
  color: "inherit",
4433
4443
  alignItems: "center",
4434
- cursor: "default"
4444
+ cursor: "default",
4445
+ userSelect: "none",
4446
+ WebkitUserSelect: "none"
4435
4447
  };
4436
4448
  var Tab = ({ children, onClick, style, selected }) => {
4437
4449
  const [hovered, setHovered] = useState20(false);
@@ -4601,10 +4613,16 @@ var InitialCompositionLoader = () => {
4601
4613
  const selectAsset = useSelectAsset();
4602
4614
  const staticFiles = useStaticFiles();
4603
4615
  useEffect15(() => {
4616
+ const canvasContentFromUrl = deriveCanvasContentFromUrl();
4604
4617
  if (canvasContent) {
4618
+ if (canvasContentFromUrl && canvasContentFromUrl.type === "composition" && canvasContent.type === "composition" && canvasContentFromUrl.compositionId !== canvasContent.compositionId) {
4619
+ const exists = compositions.find((c) => c.id === canvasContentFromUrl.compositionId);
4620
+ if (exists) {
4621
+ selectComposition(exists, false);
4622
+ }
4623
+ }
4605
4624
  return;
4606
4625
  }
4607
- const canvasContentFromUrl = deriveCanvasContentFromUrl();
4608
4626
  if (canvasContentFromUrl && canvasContentFromUrl.type === "composition") {
4609
4627
  const exists = compositions.find((c) => c.id === canvasContentFromUrl.compositionId);
4610
4628
  if (exists) {
@@ -11138,6 +11156,14 @@ async function getZodIfPossible() {
11138
11156
  return null;
11139
11157
  }
11140
11158
  }
11159
+ var getZodV3IfPossible = async () => {
11160
+ try {
11161
+ const mod = await import("zod/v3");
11162
+ return mod;
11163
+ } catch {
11164
+ return null;
11165
+ }
11166
+ };
11141
11167
  var getZTypesIfPossible = async () => {
11142
11168
  try {
11143
11169
  const mod = await import("@remotion/zod-types");
@@ -11157,19 +11183,24 @@ var useZodTypesIfPossible = () => {
11157
11183
  var ZodContext = createContext16(null);
11158
11184
  var ZodProvider = ({ children }) => {
11159
11185
  const [zod, setZod] = useState40(null);
11186
+ const [zodV3, setZodV3] = useState40(null);
11160
11187
  const [zodTypes, setZodTypes] = useState40(null);
11161
11188
  useEffect39(() => {
11162
11189
  getZodIfPossible().then((z) => setZod(z));
11163
11190
  }, []);
11191
+ useEffect39(() => {
11192
+ getZodV3IfPossible().then((z) => setZodV3(z));
11193
+ }, []);
11164
11194
  useEffect39(() => {
11165
11195
  getZTypesIfPossible().then((z) => setZodTypes(z));
11166
11196
  }, []);
11167
11197
  const contextValue = useMemo53(() => {
11168
11198
  return {
11169
11199
  zod,
11200
+ zodV3,
11170
11201
  zodTypes
11171
11202
  };
11172
- }, [zod, zodTypes]);
11203
+ }, [zod, zodV3, zodTypes]);
11173
11204
  return /* @__PURE__ */ jsx96(ZodContext.Provider, {
11174
11205
  value: contextValue,
11175
11206
  children
@@ -11311,6 +11342,184 @@ import { Internals as Internals30 } from "remotion";
11311
11342
  // src/api/save-default-props.ts
11312
11343
  import { getRemotionEnvironment as getRemotionEnvironment4 } from "remotion";
11313
11344
 
11345
+ // src/components/RenderModal/SchemaEditor/zod-schema-type.ts
11346
+ var zodSafeParse = (schema, data) => {
11347
+ return schema.safeParse(data);
11348
+ };
11349
+ var getZodDef = (schema) => {
11350
+ if (schema._def)
11351
+ return schema._def;
11352
+ if (schema._zod)
11353
+ return schema._zod.def;
11354
+ throw new Error("Invalid zod schema: missing _def and _zod");
11355
+ };
11356
+ var v3TypeNameMap = {
11357
+ ZodString: "string",
11358
+ ZodNumber: "number",
11359
+ ZodBoolean: "boolean",
11360
+ ZodObject: "object",
11361
+ ZodArray: "array",
11362
+ ZodEnum: "enum",
11363
+ ZodUnion: "union",
11364
+ ZodDiscriminatedUnion: "discriminatedUnion",
11365
+ ZodOptional: "optional",
11366
+ ZodNullable: "nullable",
11367
+ ZodDefault: "default",
11368
+ ZodTuple: "tuple",
11369
+ ZodDate: "date",
11370
+ ZodAny: "any",
11371
+ ZodUnknown: "unknown",
11372
+ ZodBigInt: "bigint",
11373
+ ZodNull: "null",
11374
+ ZodUndefined: "undefined",
11375
+ ZodEffects: "effects",
11376
+ ZodLiteral: "literal",
11377
+ ZodRecord: "record",
11378
+ ZodNever: "never",
11379
+ ZodVoid: "void",
11380
+ ZodNaN: "nan",
11381
+ ZodSymbol: "symbol",
11382
+ ZodIntersection: "intersection",
11383
+ ZodMap: "map",
11384
+ ZodSet: "set",
11385
+ ZodLazy: "lazy",
11386
+ ZodFunction: "function",
11387
+ ZodNativeEnum: "nativeEnum",
11388
+ ZodCatch: "catch",
11389
+ ZodPromise: "promise",
11390
+ ZodBranded: "branded",
11391
+ ZodPipeline: "pipeline"
11392
+ };
11393
+ var isZodV3Schema = (schema) => {
11394
+ const def = getZodDef(schema);
11395
+ return "typeName" in def;
11396
+ };
11397
+ var getZodSchemaType = (schema) => {
11398
+ const def = getZodDef(schema);
11399
+ if ("typeName" in def) {
11400
+ const { typeName } = def;
11401
+ return v3TypeNameMap[typeName] ?? typeName;
11402
+ }
11403
+ const { type } = def;
11404
+ if (type === "union" && def.discriminator !== undefined) {
11405
+ return "discriminatedUnion";
11406
+ }
11407
+ return type;
11408
+ };
11409
+ var getZodSchemaDescription = (schema) => {
11410
+ if (isZodV3Schema(schema)) {
11411
+ return getZodDef(schema).description;
11412
+ }
11413
+ return schema.description;
11414
+ };
11415
+ var getObjectShape = (schema) => {
11416
+ const { shape } = getZodDef(schema);
11417
+ return typeof shape === "function" ? shape() : shape;
11418
+ };
11419
+ var getArrayElement = (schema) => {
11420
+ const def = getZodDef(schema);
11421
+ return isZodV3Schema(schema) ? def.type : def.element;
11422
+ };
11423
+ var getInnerType = (schema) => {
11424
+ return getZodDef(schema).innerType;
11425
+ };
11426
+ var getEffectsInner = (schema) => {
11427
+ return getZodDef(schema).schema;
11428
+ };
11429
+ var getLiteralValue = (schema) => {
11430
+ const def = getZodDef(schema);
11431
+ if (isZodV3Schema(schema)) {
11432
+ return def.value;
11433
+ }
11434
+ return def.values?.[0];
11435
+ };
11436
+ var getEnumValues = (schema) => {
11437
+ const def = getZodDef(schema);
11438
+ if (isZodV3Schema(schema)) {
11439
+ return def.values;
11440
+ }
11441
+ const { entries } = def;
11442
+ return Object.values(entries);
11443
+ };
11444
+ var getFirstEnumValue = (schema) => {
11445
+ const def = getZodDef(schema);
11446
+ if (isZodV3Schema(schema)) {
11447
+ if (def.typeName === "ZodNativeEnum") {
11448
+ const vals = Object.values(def.values);
11449
+ return vals[0];
11450
+ }
11451
+ return def.values[0];
11452
+ }
11453
+ const { entries } = def;
11454
+ const pairs = Object.entries(entries);
11455
+ const hasReverseMapping = pairs.some(([key, value]) => key !== String(value));
11456
+ if (hasReverseMapping) {
11457
+ const forwardPairs = pairs.filter(([key]) => Number.isNaN(Number(key)));
11458
+ if (forwardPairs.length > 0) {
11459
+ return forwardPairs[0][1];
11460
+ }
11461
+ }
11462
+ return Object.values(entries)[0];
11463
+ };
11464
+ var getUnionOptions = (schema) => {
11465
+ return getZodDef(schema).options;
11466
+ };
11467
+ var getDefaultValue = (schema) => {
11468
+ const dv = getZodDef(schema).defaultValue;
11469
+ return typeof dv === "function" ? dv() : dv;
11470
+ };
11471
+ var getDiscriminator = (schema) => {
11472
+ return getZodDef(schema).discriminator;
11473
+ };
11474
+ var getDiscriminatedOptionKeys = (schema) => {
11475
+ const def = getZodDef(schema);
11476
+ const discriminator = getDiscriminator(schema);
11477
+ if (isZodV3Schema(schema) && def.optionsMap) {
11478
+ return [...def.optionsMap.keys()];
11479
+ }
11480
+ const options = getUnionOptions(schema);
11481
+ return options.map((option) => {
11482
+ const shape = getObjectShape(option);
11483
+ const discriminatorSchema = shape[discriminator];
11484
+ return getLiteralValue(discriminatorSchema);
11485
+ });
11486
+ };
11487
+ var getDiscriminatedOption = (schema, discriminatorValue) => {
11488
+ const def = getZodDef(schema);
11489
+ const discriminator = getDiscriminator(schema);
11490
+ if (isZodV3Schema(schema) && def.optionsMap) {
11491
+ return def.optionsMap.get(discriminatorValue);
11492
+ }
11493
+ const options = getUnionOptions(schema);
11494
+ return options.find((option) => {
11495
+ const shape = getObjectShape(option);
11496
+ const discriminatorSchema = shape[discriminator];
11497
+ return getLiteralValue(discriminatorSchema) === discriminatorValue;
11498
+ });
11499
+ };
11500
+ var getIntersectionSchemas = (schema) => {
11501
+ const def = getZodDef(schema);
11502
+ return { left: def.left, right: def.right };
11503
+ };
11504
+ var getTupleItems = (schema) => {
11505
+ return getZodDef(schema).items;
11506
+ };
11507
+ var getRecordValueType = (schema) => {
11508
+ return getZodDef(schema).valueType;
11509
+ };
11510
+ var getRecordKeyType = (schema) => {
11511
+ return getZodDef(schema).keyType;
11512
+ };
11513
+ var getPipelineOutput = (schema) => {
11514
+ return getZodDef(schema).out;
11515
+ };
11516
+ var getPipelineInput = (schema) => {
11517
+ return getZodDef(schema).in;
11518
+ };
11519
+ var getBrandedInner = (schema) => {
11520
+ return isZodV3Schema(schema) ? getZodDef(schema).type : schema;
11521
+ };
11522
+
11314
11523
  // src/components/RenderModal/SchemaEditor/extract-enum-json-paths.ts
11315
11524
  var extractEnumJsonPaths = ({
11316
11525
  schema,
@@ -11318,11 +11527,14 @@ var extractEnumJsonPaths = ({
11318
11527
  currentPath,
11319
11528
  zodTypes
11320
11529
  }) => {
11321
- const def = schema._def;
11322
- const typeName = def.typeName;
11530
+ const description = getZodSchemaDescription(schema);
11531
+ if (zodTypes && description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
11532
+ return [currentPath];
11533
+ }
11534
+ const typeName = getZodSchemaType(schema);
11323
11535
  switch (typeName) {
11324
- case zodRuntime.ZodFirstPartyTypeKind.ZodObject: {
11325
- const shape = def.shape();
11536
+ case "object": {
11537
+ const shape = getObjectShape(schema);
11326
11538
  const keys = Object.keys(shape);
11327
11539
  return keys.map((key) => {
11328
11540
  return extractEnumJsonPaths({
@@ -11333,16 +11545,16 @@ var extractEnumJsonPaths = ({
11333
11545
  });
11334
11546
  }).flat(1);
11335
11547
  }
11336
- case zodRuntime.ZodFirstPartyTypeKind.ZodArray: {
11548
+ case "array": {
11337
11549
  return extractEnumJsonPaths({
11338
- schema: def.type,
11550
+ schema: getArrayElement(schema),
11339
11551
  zodRuntime,
11340
11552
  currentPath: [...currentPath, "[]"],
11341
11553
  zodTypes
11342
11554
  });
11343
11555
  }
11344
- case zodRuntime.ZodFirstPartyTypeKind.ZodUnion: {
11345
- return def.options.map((option) => {
11556
+ case "union": {
11557
+ return getUnionOptions(schema).map((option) => {
11346
11558
  return extractEnumJsonPaths({
11347
11559
  schema: option,
11348
11560
  zodRuntime,
@@ -11351,8 +11563,8 @@ var extractEnumJsonPaths = ({
11351
11563
  });
11352
11564
  }).flat(1);
11353
11565
  }
11354
- case zodRuntime.ZodFirstPartyTypeKind.ZodDiscriminatedUnion: {
11355
- return def.options.map((op) => {
11566
+ case "discriminatedUnion": {
11567
+ return getUnionOptions(schema).map((op) => {
11356
11568
  return extractEnumJsonPaths({
11357
11569
  schema: op,
11358
11570
  zodRuntime,
@@ -11361,22 +11573,19 @@ var extractEnumJsonPaths = ({
11361
11573
  });
11362
11574
  }).flat(1);
11363
11575
  }
11364
- case zodRuntime.ZodFirstPartyTypeKind.ZodLiteral: {
11576
+ case "literal": {
11365
11577
  return [currentPath];
11366
11578
  }
11367
- case zodRuntime.ZodFirstPartyTypeKind.ZodEffects: {
11368
- if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
11369
- return [currentPath];
11370
- }
11579
+ case "effects": {
11371
11580
  return extractEnumJsonPaths({
11372
- schema: def.schema,
11581
+ schema: getEffectsInner(schema),
11373
11582
  zodRuntime,
11374
11583
  currentPath,
11375
11584
  zodTypes
11376
11585
  });
11377
11586
  }
11378
- case zodRuntime.ZodFirstPartyTypeKind.ZodIntersection: {
11379
- const { left: left3, right } = def;
11587
+ case "intersection": {
11588
+ const { left: left3, right } = getIntersectionSchemas(schema);
11380
11589
  const leftValue = extractEnumJsonPaths({
11381
11590
  schema: left3,
11382
11591
  zodRuntime,
@@ -11391,109 +11600,94 @@ var extractEnumJsonPaths = ({
11391
11600
  });
11392
11601
  return [...leftValue, ...rightValue];
11393
11602
  }
11394
- case zodRuntime.ZodFirstPartyTypeKind.ZodTuple: {
11395
- return def.items.map((item, i) => extractEnumJsonPaths({
11603
+ case "tuple": {
11604
+ return getTupleItems(schema).map((item, i) => extractEnumJsonPaths({
11396
11605
  schema: item,
11397
11606
  zodRuntime,
11398
11607
  currentPath: [...currentPath, i],
11399
11608
  zodTypes
11400
11609
  })).flat(1);
11401
11610
  }
11402
- case zodRuntime.ZodFirstPartyTypeKind.ZodRecord: {
11403
- const values = extractEnumJsonPaths({
11404
- schema: def.valueType,
11611
+ case "record": {
11612
+ const recordPath = [...currentPath, "{}"];
11613
+ const keyResults = extractEnumJsonPaths({
11614
+ schema: getRecordKeyType(schema),
11615
+ zodRuntime,
11616
+ currentPath: recordPath,
11617
+ zodTypes
11618
+ });
11619
+ const valueResults = extractEnumJsonPaths({
11620
+ schema: getRecordValueType(schema),
11405
11621
  zodRuntime,
11406
- currentPath: [...currentPath, "{}"],
11622
+ currentPath: recordPath,
11407
11623
  zodTypes
11408
11624
  });
11409
- return values;
11625
+ return [...keyResults, ...valueResults];
11410
11626
  }
11411
- case zodRuntime.ZodFirstPartyTypeKind.ZodFunction: {
11627
+ case "function": {
11412
11628
  throw new Error("Cannot create a value for type function");
11413
11629
  }
11414
- case zodRuntime.ZodFirstPartyTypeKind.ZodEnum: {
11630
+ case "enum": {
11415
11631
  return [currentPath];
11416
11632
  }
11417
- case zodRuntime.ZodFirstPartyTypeKind.ZodNativeEnum: {
11633
+ case "nativeEnum": {
11418
11634
  return [];
11419
11635
  }
11420
- case zodRuntime.ZodFirstPartyTypeKind.ZodOptional: {
11421
- const defType = def;
11422
- const value = extractEnumJsonPaths({
11423
- schema: defType.innerType,
11424
- zodRuntime,
11425
- currentPath,
11426
- zodTypes
11427
- });
11428
- return value;
11429
- }
11430
- case zodRuntime.ZodFirstPartyTypeKind.ZodNullable: {
11431
- const defType = def;
11432
- const value = extractEnumJsonPaths({
11433
- schema: defType.innerType,
11434
- zodRuntime,
11435
- currentPath,
11436
- zodTypes
11437
- });
11438
- return value;
11439
- }
11440
- case zodRuntime.ZodFirstPartyTypeKind.ZodDefault: {
11441
- const defType = def;
11636
+ case "optional":
11637
+ case "nullable":
11638
+ case "catch": {
11442
11639
  return extractEnumJsonPaths({
11443
- schema: defType.innerType,
11640
+ schema: getInnerType(schema),
11444
11641
  zodRuntime,
11445
11642
  currentPath,
11446
11643
  zodTypes
11447
11644
  });
11448
11645
  }
11449
- case zodRuntime.ZodFirstPartyTypeKind.ZodCatch: {
11450
- const defType = def;
11646
+ case "default": {
11451
11647
  return extractEnumJsonPaths({
11452
- schema: defType.innerType,
11648
+ schema: getInnerType(schema),
11453
11649
  zodRuntime,
11454
11650
  currentPath,
11455
11651
  zodTypes
11456
11652
  });
11457
11653
  }
11458
- case zodRuntime.ZodFirstPartyTypeKind.ZodPromise: {
11654
+ case "promise": {
11459
11655
  return [];
11460
11656
  }
11461
- case zodRuntime.ZodFirstPartyTypeKind.ZodBranded: {
11462
- const defType = def;
11463
- const value = extractEnumJsonPaths({
11464
- schema: defType.type,
11657
+ case "branded": {
11658
+ return extractEnumJsonPaths({
11659
+ schema: getBrandedInner(schema),
11465
11660
  zodRuntime,
11466
11661
  currentPath,
11467
11662
  zodTypes
11468
11663
  });
11469
- return value;
11470
11664
  }
11471
- case zodRuntime.ZodFirstPartyTypeKind.ZodPipeline: {
11472
- const defType = def;
11473
- const value = extractEnumJsonPaths({
11474
- schema: defType.out,
11665
+ case "pipeline":
11666
+ case "pipe": {
11667
+ return extractEnumJsonPaths({
11668
+ schema: getPipelineOutput(schema),
11475
11669
  zodRuntime,
11476
11670
  currentPath,
11477
11671
  zodTypes
11478
11672
  });
11479
- return value;
11480
11673
  }
11481
- case zodRuntime.ZodFirstPartyTypeKind.ZodString:
11482
- case zodRuntime.ZodFirstPartyTypeKind.ZodNumber:
11483
- case zodRuntime.ZodFirstPartyTypeKind.ZodBigInt:
11484
- case zodRuntime.ZodFirstPartyTypeKind.ZodBoolean:
11485
- case zodRuntime.ZodFirstPartyTypeKind.ZodNaN:
11486
- case zodRuntime.ZodFirstPartyTypeKind.ZodDate:
11487
- case zodRuntime.ZodFirstPartyTypeKind.ZodSymbol:
11488
- case zodRuntime.ZodFirstPartyTypeKind.ZodUndefined:
11489
- case zodRuntime.ZodFirstPartyTypeKind.ZodNull:
11490
- case zodRuntime.ZodFirstPartyTypeKind.ZodAny:
11491
- case zodRuntime.ZodFirstPartyTypeKind.ZodUnknown:
11492
- case zodRuntime.ZodFirstPartyTypeKind.ZodNever:
11493
- case zodRuntime.ZodFirstPartyTypeKind.ZodVoid:
11494
- case zodRuntime.ZodFirstPartyTypeKind.ZodMap:
11495
- case zodRuntime.ZodFirstPartyTypeKind.ZodLazy:
11496
- case zodRuntime.ZodFirstPartyTypeKind.ZodSet: {
11674
+ case "string":
11675
+ case "number":
11676
+ case "bigint":
11677
+ case "boolean":
11678
+ case "nan":
11679
+ case "date":
11680
+ case "symbol":
11681
+ case "undefined":
11682
+ case "null":
11683
+ case "any":
11684
+ case "unknown":
11685
+ case "never":
11686
+ case "void":
11687
+ case "map":
11688
+ case "lazy":
11689
+ case "set":
11690
+ case "custom": {
11497
11691
  return [];
11498
11692
  }
11499
11693
  default:
@@ -11849,7 +12043,7 @@ var ZodErrorMessages = ({ zodValidationResult, viewTab }) => {
11849
12043
  }, []);
11850
12044
  if (viewTab === "json") {
11851
12045
  return /* @__PURE__ */ jsx103("div", {
11852
- children: zodValidationResult.error.errors.map((error) => {
12046
+ children: zodValidationResult.error.issues.map((error) => {
11853
12047
  return /* @__PURE__ */ jsxs46("div", {
11854
12048
  style: style7,
11855
12049
  children: [
@@ -11869,7 +12063,7 @@ var ZodErrorMessages = ({ zodValidationResult, viewTab }) => {
11869
12063
  });
11870
12064
  }
11871
12065
  return /* @__PURE__ */ jsx103("div", {
11872
- children: zodValidationResult.error.errors.map((error) => {
12066
+ children: zodValidationResult.error.issues.map((error) => {
11873
12067
  return /* @__PURE__ */ jsxs46("div", {
11874
12068
  style: style7,
11875
12069
  children: [
@@ -11926,7 +12120,7 @@ var scrollable = {
11926
12120
  var parseJSON = (str, schema) => {
11927
12121
  try {
11928
12122
  const value = NoReactInternals8.deserializeJSONWithSpecialTypes(str);
11929
- const zodValidation = schema.safeParse(value);
12123
+ const zodValidation = zodSafeParse(schema, value);
11930
12124
  return { str, value, validJSON: true, zodValidation };
11931
12125
  } catch (e) {
11932
12126
  return { str, validJSON: false, error: e.message };
@@ -11958,7 +12152,7 @@ var RenderModalJSONPropsEditor = ({
11958
12152
  const onChange = useCallback48((e) => {
11959
12153
  const parsed = parseJSON(e.target.value, schema);
11960
12154
  if (parsed.validJSON) {
11961
- const validationResult = schema.safeParse(parsed.value);
12155
+ const validationResult = zodSafeParse(schema, parsed.value);
11962
12156
  setLocalValue({
11963
12157
  str: e.target.value,
11964
12158
  value: parsed.value,
@@ -12570,46 +12764,72 @@ var createZodValues = (schema, zodRuntime, zodTypes) => {
12570
12764
  if (!schema) {
12571
12765
  throw new Error("Invalid zod schema");
12572
12766
  }
12573
- const def = schema._def;
12574
- const typeName = def.typeName;
12767
+ const description = getZodSchemaDescription(schema);
12768
+ if (zodTypes) {
12769
+ if (description === zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
12770
+ return "#ffffff";
12771
+ }
12772
+ if (description === zodTypes.ZodZypesInternals.REMOTION_TEXTAREA_BRAND) {
12773
+ return "";
12774
+ }
12775
+ if (description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
12776
+ return [
12777
+ [1, 0, 0],
12778
+ [0, 1, 0],
12779
+ [0, 0, 1]
12780
+ ];
12781
+ }
12782
+ }
12783
+ const typeName = getZodSchemaType(schema);
12575
12784
  switch (typeName) {
12576
- case zodRuntime.ZodFirstPartyTypeKind.ZodString:
12785
+ case "string":
12577
12786
  return "";
12578
- case zodRuntime.ZodFirstPartyTypeKind.ZodNumber: {
12579
- for (const check of def.checks) {
12580
- if (check.kind === "min") {
12581
- return check.value;
12582
- }
12583
- if (check.kind === "max" && check.value < 0) {
12584
- return check.value;
12787
+ case "number": {
12788
+ const { checks } = getZodDef(schema);
12789
+ if (checks) {
12790
+ if (isZodV3Schema(schema)) {
12791
+ for (const check of checks) {
12792
+ if (check.kind === "min")
12793
+ return check.value;
12794
+ if (check.kind === "max" && check.value < 0)
12795
+ return check.value;
12796
+ }
12797
+ } else {
12798
+ for (const check of checks) {
12799
+ const cd = check._zod?.def;
12800
+ if (cd?.check === "greater_than")
12801
+ return cd.value;
12802
+ if (cd?.check === "less_than" && cd.value < 0)
12803
+ return cd.value;
12804
+ }
12585
12805
  }
12586
12806
  }
12587
12807
  return 0;
12588
12808
  }
12589
- case zodRuntime.ZodFirstPartyTypeKind.ZodBigInt:
12809
+ case "bigint":
12590
12810
  return BigInt(0);
12591
- case zodRuntime.ZodFirstPartyTypeKind.ZodBoolean:
12811
+ case "boolean":
12592
12812
  return false;
12593
- case zodRuntime.ZodFirstPartyTypeKind.ZodNaN:
12813
+ case "nan":
12594
12814
  return NaN;
12595
- case zodRuntime.ZodFirstPartyTypeKind.ZodDate:
12815
+ case "date":
12596
12816
  return new Date;
12597
- case zodRuntime.ZodFirstPartyTypeKind.ZodSymbol:
12817
+ case "symbol":
12598
12818
  return Symbol("remotion");
12599
- case zodRuntime.ZodFirstPartyTypeKind.ZodUndefined:
12819
+ case "undefined":
12820
+ case "void":
12600
12821
  return;
12601
- case zodRuntime.ZodFirstPartyTypeKind.ZodNull:
12822
+ case "null":
12602
12823
  return null;
12603
- case zodRuntime.ZodFirstPartyTypeKind.ZodAny:
12824
+ case "any":
12825
+ case "custom":
12604
12826
  throw new Error("Cannot create a value for type z.any()");
12605
- case zodRuntime.ZodFirstPartyTypeKind.ZodUnknown:
12827
+ case "unknown":
12606
12828
  throw new Error("Cannot create a value for type z.unknown()");
12607
- case zodRuntime.ZodFirstPartyTypeKind.ZodNever:
12829
+ case "never":
12608
12830
  throw new Error("Cannot create a value for type z.never()");
12609
- case zodRuntime.ZodFirstPartyTypeKind.ZodVoid:
12610
- return;
12611
- case zodRuntime.ZodFirstPartyTypeKind.ZodObject: {
12612
- const shape = def.shape();
12831
+ case "object": {
12832
+ const shape = getObjectShape(schema);
12613
12833
  const keys = Object.keys(shape);
12614
12834
  const returnValue = keys.reduce((existing, key) => {
12615
12835
  existing[key] = createZodValues(shape[key], zodRuntime, zodTypes);
@@ -12617,40 +12837,25 @@ var createZodValues = (schema, zodRuntime, zodTypes) => {
12617
12837
  }, {});
12618
12838
  return returnValue;
12619
12839
  }
12620
- case zodRuntime.ZodFirstPartyTypeKind.ZodArray: {
12621
- return [
12622
- createZodValues(def.type, zodRuntime, zodTypes)
12623
- ];
12840
+ case "array": {
12841
+ return [createZodValues(getArrayElement(schema), zodRuntime, zodTypes)];
12624
12842
  }
12625
- case zodRuntime.ZodFirstPartyTypeKind.ZodUnion: {
12626
- const firstOptions = def.options[0];
12627
- return firstOptions ? createZodValues(firstOptions, zodRuntime, zodTypes) : undefined;
12843
+ case "union": {
12844
+ const firstOption = getUnionOptions(schema)[0];
12845
+ return firstOption ? createZodValues(firstOption, zodRuntime, zodTypes) : undefined;
12628
12846
  }
12629
- case zodRuntime.ZodFirstPartyTypeKind.ZodDiscriminatedUnion: {
12630
- const options = def.options[0];
12631
- return createZodValues(options, zodRuntime, zodTypes);
12847
+ case "discriminatedUnion": {
12848
+ const firstOption = getUnionOptions(schema)[0];
12849
+ return createZodValues(firstOption, zodRuntime, zodTypes);
12632
12850
  }
12633
- case zodRuntime.ZodFirstPartyTypeKind.ZodLiteral: {
12634
- return def.value;
12851
+ case "literal": {
12852
+ return getLiteralValue(schema);
12635
12853
  }
12636
- case zodRuntime.ZodFirstPartyTypeKind.ZodEffects: {
12637
- if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
12638
- return "#ffffff";
12639
- }
12640
- if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_TEXTAREA_BRAND) {
12641
- return "";
12642
- }
12643
- if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
12644
- return [
12645
- [1, 0, 0],
12646
- [0, 1, 0],
12647
- [0, 0, 1]
12648
- ];
12649
- }
12650
- return createZodValues(def.schema, zodRuntime, zodTypes);
12854
+ case "effects": {
12855
+ return createZodValues(getEffectsInner(schema), zodRuntime, zodTypes);
12651
12856
  }
12652
- case zodRuntime.ZodFirstPartyTypeKind.ZodIntersection: {
12653
- const { left: left3, right } = def;
12857
+ case "intersection": {
12858
+ const { left: left3, right } = getIntersectionSchemas(schema);
12654
12859
  const leftValue = createZodValues(left3, zodRuntime, zodTypes);
12655
12860
  if (typeof leftValue !== "object") {
12656
12861
  throw new Error("Cannot create value for type z.intersection: Left side is not an object");
@@ -12661,73 +12866,59 @@ var createZodValues = (schema, zodRuntime, zodTypes) => {
12661
12866
  }
12662
12867
  return { ...leftValue, ...rightValue };
12663
12868
  }
12664
- case zodRuntime.ZodFirstPartyTypeKind.ZodTuple: {
12665
- const items = def.items.map((item2) => createZodValues(item2, zodRuntime, zodTypes));
12666
- return items;
12869
+ case "tuple": {
12870
+ return getTupleItems(schema).map((item2) => createZodValues(item2, zodRuntime, zodTypes));
12667
12871
  }
12668
- case zodRuntime.ZodFirstPartyTypeKind.ZodRecord: {
12669
- const values = createZodValues(def.valueType, zodRuntime, zodTypes);
12872
+ case "record": {
12873
+ const values = createZodValues(getRecordValueType(schema), zodRuntime, zodTypes);
12670
12874
  return { key: values };
12671
12875
  }
12672
- case zodRuntime.ZodFirstPartyTypeKind.ZodMap: {
12673
- const defType = def;
12674
- const values = createZodValues(defType.valueType, zodRuntime, zodTypes);
12675
- const key = createZodValues(defType.keyType, zodRuntime, zodTypes);
12876
+ case "map": {
12877
+ const values = createZodValues(getRecordValueType(schema), zodRuntime, zodTypes);
12878
+ const key = createZodValues(getRecordKeyType(schema), zodRuntime, zodTypes);
12676
12879
  return new Map([[key, values]]);
12677
12880
  }
12678
- case zodRuntime.ZodFirstPartyTypeKind.ZodLazy: {
12679
- const defType = def;
12680
- const type = defType.getter();
12881
+ case "lazy": {
12882
+ const type = getZodDef(schema).getter();
12681
12883
  return createZodValues(type, zodRuntime, zodTypes);
12682
12884
  }
12683
- case zodRuntime.ZodFirstPartyTypeKind.ZodSet: {
12684
- const defType = def;
12685
- const values = createZodValues(defType.valueType, zodRuntime, zodTypes);
12885
+ case "set": {
12886
+ const values = createZodValues(getZodDef(schema).valueType, zodRuntime, zodTypes);
12686
12887
  return new Set([values]);
12687
12888
  }
12688
- case zodRuntime.ZodFirstPartyTypeKind.ZodFunction: {
12889
+ case "function": {
12689
12890
  throw new Error("Cannot create a value for type function");
12690
12891
  }
12691
- case zodRuntime.ZodFirstPartyTypeKind.ZodEnum: {
12692
- const { values } = def;
12693
- return values[0];
12892
+ case "enum": {
12893
+ return getFirstEnumValue(schema);
12694
12894
  }
12695
- case zodRuntime.ZodFirstPartyTypeKind.ZodNativeEnum: {
12895
+ case "nativeEnum": {
12696
12896
  return 0;
12697
12897
  }
12698
- case zodRuntime.ZodFirstPartyTypeKind.ZodOptional: {
12699
- const defType = def;
12700
- const value = createZodValues(defType.innerType, zodRuntime, zodTypes);
12701
- return value;
12702
- }
12703
- case zodRuntime.ZodFirstPartyTypeKind.ZodNullable: {
12704
- const defType = def;
12705
- const value = createZodValues(defType.innerType, zodRuntime, zodTypes);
12706
- return value;
12707
- }
12708
- case zodRuntime.ZodFirstPartyTypeKind.ZodDefault: {
12709
- const defType = def;
12710
- return defType.defaultValue();
12898
+ case "optional":
12899
+ case "nullable":
12900
+ case "catch": {
12901
+ return createZodValues(getInnerType(schema), zodRuntime, zodTypes);
12711
12902
  }
12712
- case zodRuntime.ZodFirstPartyTypeKind.ZodCatch: {
12713
- const defType = def;
12714
- const value = createZodValues(defType.innerType, zodRuntime, zodTypes);
12715
- return value;
12903
+ case "default": {
12904
+ return getDefaultValue(schema);
12716
12905
  }
12717
- case zodRuntime.ZodFirstPartyTypeKind.ZodPromise: {
12718
- const defType = def;
12719
- const value = createZodValues(defType.type, zodRuntime, zodTypes);
12906
+ case "promise": {
12907
+ const def = getZodDef(schema);
12908
+ const inner = isZodV3Schema(schema) ? def.type : def.innerType;
12909
+ const value = createZodValues(inner, zodRuntime, zodTypes);
12720
12910
  return Promise.resolve(value);
12721
12911
  }
12722
- case zodRuntime.ZodFirstPartyTypeKind.ZodBranded: {
12723
- const defType = def;
12724
- const value = createZodValues(defType.type, zodRuntime, zodTypes);
12725
- return value;
12912
+ case "branded": {
12913
+ return createZodValues(getBrandedInner(schema), zodRuntime, zodTypes);
12726
12914
  }
12727
- case zodRuntime.ZodFirstPartyTypeKind.ZodPipeline: {
12728
- const defType = def;
12729
- const value = createZodValues(defType.out, zodRuntime, zodTypes);
12730
- return value;
12915
+ case "pipeline":
12916
+ case "pipe": {
12917
+ const out = getPipelineOutput(schema);
12918
+ if (getZodSchemaType(out) === "transform") {
12919
+ return createZodValues(getPipelineInput(schema), zodRuntime, zodTypes);
12920
+ }
12921
+ return createZodValues(out, zodRuntime, zodTypes);
12731
12922
  }
12732
12923
  default:
12733
12924
  throw new Error("Not implemented: " + typeName);
@@ -12760,16 +12951,16 @@ var SchemaArrayItemSeparationLine = ({ onChange, index, schema, isLast, showAddB
12760
12951
  if (!z) {
12761
12952
  throw new Error("expected zod");
12762
12953
  }
12763
- const def = schema._def;
12954
+ const arrayElement = getArrayElement(schema);
12764
12955
  const onAdd = useCallback51(() => {
12765
12956
  onChange((oldV) => {
12766
12957
  return [
12767
12958
  ...oldV.slice(0, index + 1),
12768
- createZodValues(def.type, z, zodTypes),
12959
+ createZodValues(arrayElement, z, zodTypes),
12769
12960
  ...oldV.slice(index + 1)
12770
12961
  ];
12771
12962
  }, false, true);
12772
- }, [def.type, index, onChange, z, zodTypes]);
12963
+ }, [arrayElement, index, onChange, z, zodTypes]);
12773
12964
  const dynamicAddButtonStyle = useMemo61(() => {
12774
12965
  return {
12775
12966
  display: "flex",
@@ -12900,7 +13091,7 @@ import React79, { useMemo as useMemo67, useState as useState47 } from "react";
12900
13091
  import { useCallback as useCallback52, useMemo as useMemo63 } from "react";
12901
13092
  import { jsx as jsx112 } from "react/jsx-runtime";
12902
13093
  var ZodArrayItemEditor = ({
12903
- def,
13094
+ elementSchema,
12904
13095
  onChange,
12905
13096
  jsonPath,
12906
13097
  index,
@@ -12938,7 +13129,7 @@ var ZodArrayItemEditor = ({
12938
13129
  return /* @__PURE__ */ jsx112("div", {
12939
13130
  children: /* @__PURE__ */ jsx112(ZodSwitch, {
12940
13131
  jsonPath: newJsonPath,
12941
- schema: def.type,
13132
+ schema: elementSchema,
12942
13133
  value,
12943
13134
  setValue,
12944
13135
  defaultValue,
@@ -13172,7 +13363,8 @@ var stackTraceLabel = {
13172
13363
  fontSize: 14
13173
13364
  };
13174
13365
  var ZodFieldValidation = ({ localValue, path }) => {
13175
- if (localValue.zodValidation.success) {
13366
+ const { zodValidation } = localValue;
13367
+ if (zodValidation.success) {
13176
13368
  return null;
13177
13369
  }
13178
13370
  return /* @__PURE__ */ jsxs54("div", {
@@ -13180,7 +13372,7 @@ var ZodFieldValidation = ({ localValue, path }) => {
13180
13372
  children: [
13181
13373
  /* @__PURE__ */ jsx115(ValidationMessage, {
13182
13374
  align: "flex-start",
13183
- message: localValue.zodValidation.error.format()._errors[0],
13375
+ message: zodValidation.error.format()._errors[0],
13184
13376
  type: "error"
13185
13377
  }),
13186
13378
  /* @__PURE__ */ jsx115(Spacing, {
@@ -13195,7 +13387,7 @@ var ZodFieldValidation = ({ localValue, path }) => {
13195
13387
  style: stackTraceLabel,
13196
13388
  children: "Zod Validation has failed:"
13197
13389
  }),
13198
- localValue.zodValidation.error.errors.map((error, index) => /* @__PURE__ */ jsxs54("div", {
13390
+ zodValidation.error.issues.map((error, index) => /* @__PURE__ */ jsxs54("div", {
13199
13391
  style: stackTraceLabel,
13200
13392
  children: [
13201
13393
  "Type: ",
@@ -13247,7 +13439,7 @@ var useLocalState = ({
13247
13439
  [parentRevision]: {
13248
13440
  value: unsavedValue,
13249
13441
  keyStabilityRevision: 0,
13250
- zodValidation: schema.safeParse(unsavedValue)
13442
+ zodValidation: zodSafeParse(schema, unsavedValue)
13251
13443
  }
13252
13444
  };
13253
13445
  });
@@ -13256,7 +13448,7 @@ var useLocalState = ({
13256
13448
  return {
13257
13449
  value: unsavedValue,
13258
13450
  keyStabilityRevision: 0,
13259
- zodValidation: schema.safeParse(unsavedValue)
13451
+ zodValidation: zodSafeParse(schema, unsavedValue)
13260
13452
  };
13261
13453
  }
13262
13454
  return localValueOrNull[parentRevision];
@@ -13275,7 +13467,7 @@ var useLocalState = ({
13275
13467
  return localUnsavedValue ?? {
13276
13468
  value: savedValue,
13277
13469
  keyStabilityRevision: 0,
13278
- zodValidation: schema.safeParse(savedValue)
13470
+ zodValidation: zodSafeParse(schema, savedValue)
13279
13471
  };
13280
13472
  }, [localUnsavedValue, savedValue, schema]);
13281
13473
  const stateRef = useRef26(currentLocalValue);
@@ -13286,7 +13478,7 @@ var useLocalState = ({
13286
13478
  if (isSame) {
13287
13479
  return;
13288
13480
  }
13289
- const safeParse = schema.safeParse(newValue);
13481
+ const safeParse = zodSafeParse(schema, newValue);
13290
13482
  if (safeParse.success || forceApply) {
13291
13483
  setValue(updater, forceApply, increment);
13292
13484
  }
@@ -13354,7 +13546,7 @@ var ZodArrayEditor = ({
13354
13546
  savedValue: defaultValue
13355
13547
  });
13356
13548
  const [expanded, setExpanded] = useState47(true);
13357
- const def = schema._def;
13549
+ const arrayElement = getArrayElement(schema);
13358
13550
  const suffix2 = useMemo67(() => {
13359
13551
  return expanded ? " [" : " [...] ";
13360
13552
  }, [expanded]);
@@ -13363,10 +13555,6 @@ var ZodArrayEditor = ({
13363
13555
  throw new Error("expected zod");
13364
13556
  }
13365
13557
  const zodTypes = useZodTypesIfPossible();
13366
- const typeName = def.typeName;
13367
- if (typeName !== z.ZodFirstPartyTypeKind.ZodArray) {
13368
- throw new Error("expected object");
13369
- }
13370
13558
  const isDefaultValue = useMemo67(() => {
13371
13559
  return deepEqual(localValue.value, defaultValue);
13372
13560
  }, [defaultValue, localValue]);
@@ -13405,10 +13593,10 @@ var ZodArrayEditor = ({
13405
13593
  /* @__PURE__ */ jsx117(ZodArrayItemEditor, {
13406
13594
  onChange,
13407
13595
  value: child,
13408
- def,
13596
+ elementSchema: arrayElement,
13409
13597
  index: i,
13410
13598
  jsonPath,
13411
- defaultValue: defaultValue?.[i] ?? createZodValues(def.type, z, zodTypes),
13599
+ defaultValue: defaultValue?.[i] ?? createZodValues(arrayElement, z, zodTypes),
13412
13600
  onSave,
13413
13601
  showSaveButton,
13414
13602
  saving,
@@ -14057,7 +14245,7 @@ var ZodDefaultEditor = ({
14057
14245
  saveDisabledByParent,
14058
14246
  mayPad
14059
14247
  }) => {
14060
- const { innerType } = schema._def;
14248
+ const innerType = getInnerType(schema);
14061
14249
  return /* @__PURE__ */ jsx124(ZodSwitch, {
14062
14250
  defaultValue,
14063
14251
  jsonPath,
@@ -14094,8 +14282,8 @@ var ZodDiscriminatedUnionEditor = ({
14094
14282
  throw new Error("expected zod");
14095
14283
  }
14096
14284
  const zodTypes = useZodTypesIfPossible();
14097
- const typedSchema = schema._def;
14098
- const options = useMemo72(() => [...typedSchema.optionsMap.keys()], [typedSchema.optionsMap]);
14285
+ const discriminator = getDiscriminator(schema);
14286
+ const options = useMemo72(() => getDiscriminatedOptionKeys(schema), [schema]);
14099
14287
  const {
14100
14288
  localValue,
14101
14289
  onChange: setLocalValue,
@@ -14113,9 +14301,13 @@ var ZodDiscriminatedUnionEditor = ({
14113
14301
  label: option,
14114
14302
  id: option,
14115
14303
  keyHint: null,
14116
- leftItem: option === value[typedSchema.discriminator] ? /* @__PURE__ */ jsx125(Checkmark, {}) : null,
14304
+ leftItem: option === value[discriminator] ? /* @__PURE__ */ jsx125(Checkmark, {}) : null,
14117
14305
  onClick: () => {
14118
- const val = createZodValues(typedSchema.optionsMap.get(option), z, zodTypes);
14306
+ const optionSchema = getDiscriminatedOption(schema, option);
14307
+ if (!optionSchema) {
14308
+ throw new Error(`No schema found for discriminator value: ${option}`);
14309
+ }
14310
+ const val = createZodValues(optionSchema, z, zodTypes);
14119
14311
  setLocalValue(() => val, false, false);
14120
14312
  },
14121
14313
  quickSwitcherLabel: null,
@@ -14123,29 +14315,21 @@ var ZodDiscriminatedUnionEditor = ({
14123
14315
  type: "item"
14124
14316
  };
14125
14317
  });
14126
- }, [
14127
- options,
14128
- setLocalValue,
14129
- typedSchema.discriminator,
14130
- typedSchema.optionsMap,
14131
- value,
14132
- z,
14133
- zodTypes
14134
- ]);
14318
+ }, [options, setLocalValue, discriminator, schema, value, z, zodTypes]);
14135
14319
  const save = useCallback59(() => {
14136
14320
  onSave(() => value, false, false);
14137
14321
  }, [onSave, value]);
14138
14322
  const discriminatedUnionReplacement = useMemo72(() => {
14139
14323
  return {
14140
- discriminator: typedSchema.discriminator,
14324
+ discriminator,
14141
14325
  markup: /* @__PURE__ */ jsxs60(Fieldset, {
14142
14326
  shouldPad: mayPad,
14143
14327
  success: true,
14144
14328
  children: [
14145
14329
  /* @__PURE__ */ jsx125(SchemaLabel, {
14146
14330
  handleClick: null,
14147
- isDefaultValue: localValue.value[typedSchema.discriminator] === defaultValue[typedSchema.discriminator],
14148
- jsonPath: [...jsonPath, typedSchema.discriminator],
14331
+ isDefaultValue: localValue.value[discriminator] === defaultValue[discriminator],
14332
+ jsonPath: [...jsonPath, discriminator],
14149
14333
  onRemove,
14150
14334
  onReset: reset,
14151
14335
  onSave: save,
@@ -14158,7 +14342,7 @@ var ZodDiscriminatedUnionEditor = ({
14158
14342
  /* @__PURE__ */ jsx125(Combobox, {
14159
14343
  title: "Select type",
14160
14344
  values: comboBoxValues,
14161
- selectedId: value[typedSchema.discriminator]
14345
+ selectedId: value[discriminator]
14162
14346
  })
14163
14347
  ]
14164
14348
  }, "replacement")
@@ -14176,9 +14360,13 @@ var ZodDiscriminatedUnionEditor = ({
14176
14360
  saveDisabledByParent,
14177
14361
  saving,
14178
14362
  showSaveButton,
14179
- typedSchema.discriminator,
14363
+ discriminator,
14180
14364
  value
14181
14365
  ]);
14366
+ const currentOptionSchema = getDiscriminatedOption(schema, value[discriminator]);
14367
+ if (!currentOptionSchema) {
14368
+ throw new Error("No matching option found for discriminated union");
14369
+ }
14182
14370
  return /* @__PURE__ */ jsx125(ZodObjectEditor, {
14183
14371
  jsonPath,
14184
14372
  mayPad,
@@ -14187,12 +14375,12 @@ var ZodDiscriminatedUnionEditor = ({
14187
14375
  onSave,
14188
14376
  saveDisabledByParent,
14189
14377
  saving,
14190
- schema: typedSchema.optionsMap.get(value[typedSchema.discriminator]),
14378
+ schema: currentOptionSchema,
14191
14379
  setValue: setLocalValue,
14192
14380
  showSaveButton,
14193
14381
  unsavedValue: value,
14194
14382
  discriminatedUnionReplacement
14195
- }, value[typedSchema.discriminator]);
14383
+ }, value[discriminator]);
14196
14384
  };
14197
14385
 
14198
14386
  // src/components/RenderModal/SchemaEditor/ZodEffectEditor.tsx
@@ -14212,9 +14400,9 @@ var ZodEffectEditor = ({
14212
14400
  saving,
14213
14401
  mayPad
14214
14402
  }) => {
14215
- const z = useZodIfPossible();
14216
- if (!z) {
14217
- throw new Error("expected zod");
14403
+ const typeName = getZodSchemaType(schema);
14404
+ if (typeName !== "effects") {
14405
+ throw new Error("expected effect");
14218
14406
  }
14219
14407
  const { localValue, onChange } = useLocalState({
14220
14408
  unsavedValue: value,
@@ -14222,11 +14410,7 @@ var ZodEffectEditor = ({
14222
14410
  setValue: updateValue,
14223
14411
  savedValue: defaultValue
14224
14412
  });
14225
- const def = schema._def;
14226
- const typeName = def.typeName;
14227
- if (typeName !== z.ZodFirstPartyTypeKind.ZodEffects) {
14228
- throw new Error("expected effect");
14229
- }
14413
+ const innerSchema = getEffectsInner(schema);
14230
14414
  return /* @__PURE__ */ jsxs61(Fieldset, {
14231
14415
  shouldPad: mayPad,
14232
14416
  success: localValue.zodValidation.success,
@@ -14237,7 +14421,7 @@ var ZodEffectEditor = ({
14237
14421
  value,
14238
14422
  setValue: onChange,
14239
14423
  jsonPath,
14240
- schema: def.schema,
14424
+ schema: innerSchema,
14241
14425
  defaultValue,
14242
14426
  onSave,
14243
14427
  showSaveButton,
@@ -14272,10 +14456,6 @@ var ZodEnumEditor = ({
14272
14456
  onRemove,
14273
14457
  saving
14274
14458
  }) => {
14275
- const z = useZodIfPossible();
14276
- if (!z) {
14277
- throw new Error("expected zod");
14278
- }
14279
14459
  const {
14280
14460
  localValue,
14281
14461
  onChange: setLocalValue,
@@ -14286,14 +14466,10 @@ var ZodEnumEditor = ({
14286
14466
  unsavedValue: value,
14287
14467
  savedValue: defaultValue
14288
14468
  });
14289
- const def = schema._def;
14290
- const typeName = def.typeName;
14291
- if (typeName !== z.ZodFirstPartyTypeKind.ZodEnum) {
14292
- throw new Error("expected enum");
14293
- }
14469
+ const enumValues = getEnumValues(schema);
14294
14470
  const isRoot = jsonPath.length === 0;
14295
14471
  const comboBoxValues = useMemo73(() => {
14296
- return def.values.map((option) => {
14472
+ return enumValues.map((option) => {
14297
14473
  return {
14298
14474
  value: option,
14299
14475
  label: option,
@@ -14308,7 +14484,7 @@ var ZodEnumEditor = ({
14308
14484
  type: "item"
14309
14485
  };
14310
14486
  });
14311
- }, [def.values, setLocalValue, value]);
14487
+ }, [enumValues, setLocalValue, value]);
14312
14488
  const save = useCallback60(() => {
14313
14489
  onSave(() => value, false, false);
14314
14490
  }, [onSave, value]);
@@ -14373,7 +14549,7 @@ var ZodMatrixEditor = ({
14373
14549
  savedValue: defaultValue
14374
14550
  });
14375
14551
  const [expanded, setExpanded] = useState50(true);
14376
- const def = schema._def;
14552
+ const arrayElement = getArrayElement(schema);
14377
14553
  const suffix2 = useMemo74(() => {
14378
14554
  return expanded ? " [" : " [...] ";
14379
14555
  }, [expanded]);
@@ -14431,10 +14607,10 @@ var ZodMatrixEditor = ({
14431
14607
  children: /* @__PURE__ */ jsx128(ZodArrayItemEditor, {
14432
14608
  onChange,
14433
14609
  value: item2,
14434
- def,
14610
+ elementSchema: arrayElement,
14435
14611
  index: actualIndex,
14436
14612
  jsonPath,
14437
- defaultValue: defaultValue?.[actualIndex] ?? createZodValues(def.type, z, zodTypes),
14613
+ defaultValue: defaultValue?.[actualIndex] ?? createZodValues(arrayElement, z, zodTypes),
14438
14614
  onSave,
14439
14615
  showSaveButton,
14440
14616
  saving,
@@ -14634,7 +14810,7 @@ var ZodNullableEditor = ({
14634
14810
  saveDisabledByParent,
14635
14811
  mayPad
14636
14812
  }) => {
14637
- const { innerType } = schema._def;
14813
+ const innerType = getInnerType(schema);
14638
14814
  return /* @__PURE__ */ jsx131(ZodOrNullishEditor, {
14639
14815
  defaultValue,
14640
14816
  jsonPath,
@@ -14659,40 +14835,58 @@ var fullWidth6 = {
14659
14835
  width: "100%"
14660
14836
  };
14661
14837
  var getMinValue = (schema) => {
14662
- const minCheck = schema._def.checks.find((c) => c.kind === "min");
14663
- if (!minCheck) {
14664
- return -Infinity;
14665
- }
14666
- if (minCheck.kind !== "min") {
14667
- throw new Error("Expected min check");
14668
- }
14669
- if (!minCheck.inclusive) {
14838
+ const { checks } = getZodDef(schema);
14839
+ if (!checks)
14670
14840
  return -Infinity;
14841
+ if (isZodV3Schema(schema)) {
14842
+ const minCheck = checks.find((c) => c.kind === "min");
14843
+ if (!minCheck || !minCheck.inclusive)
14844
+ return -Infinity;
14845
+ return minCheck.value;
14846
+ }
14847
+ for (const c of checks) {
14848
+ const def = c._zod?.def;
14849
+ if (def?.check === "greater_than" && def.inclusive) {
14850
+ return def.value;
14851
+ }
14671
14852
  }
14672
- return minCheck.value;
14853
+ return -Infinity;
14673
14854
  };
14674
14855
  var getMaxValue = (schema) => {
14675
- const maxCheck = schema._def.checks.find((c) => c.kind === "max");
14676
- if (!maxCheck) {
14677
- return Infinity;
14678
- }
14679
- if (maxCheck.kind !== "max") {
14680
- throw new Error("Expected max check");
14681
- }
14682
- if (!maxCheck.inclusive) {
14856
+ const { checks } = getZodDef(schema);
14857
+ if (!checks)
14683
14858
  return Infinity;
14859
+ if (isZodV3Schema(schema)) {
14860
+ const maxCheck = checks.find((c) => c.kind === "max");
14861
+ if (!maxCheck || !maxCheck.inclusive)
14862
+ return Infinity;
14863
+ return maxCheck.value;
14864
+ }
14865
+ for (const c of checks) {
14866
+ const def = c._zod?.def;
14867
+ if (def?.check === "less_than" && def.inclusive) {
14868
+ return def.value;
14869
+ }
14684
14870
  }
14685
- return maxCheck.value;
14871
+ return Infinity;
14686
14872
  };
14687
14873
  var getStep = (schema) => {
14688
- const multipleStep = schema._def.checks.find((c) => c.kind === "multipleOf");
14689
- if (!multipleStep) {
14874
+ const { checks } = getZodDef(schema);
14875
+ if (!checks)
14690
14876
  return;
14877
+ if (isZodV3Schema(schema)) {
14878
+ const multipleStep = checks.find((c) => c.kind === "multipleOf");
14879
+ if (!multipleStep)
14880
+ return;
14881
+ return multipleStep.value;
14691
14882
  }
14692
- if (multipleStep.kind !== "multipleOf") {
14693
- throw new Error("Expected multipleOf check");
14883
+ for (const c of checks) {
14884
+ const def = c._zod?.def;
14885
+ if (def?.check === "multiple_of") {
14886
+ return def.value;
14887
+ }
14694
14888
  }
14695
- return multipleStep.value;
14889
+ return;
14696
14890
  };
14697
14891
  var ZodNumberEditor = ({
14698
14892
  jsonPath,
@@ -14785,7 +14979,7 @@ var ZodOptionalEditor = ({
14785
14979
  saveDisabledByParent,
14786
14980
  mayPad
14787
14981
  }) => {
14788
- const { innerType } = schema._def;
14982
+ const innerType = getInnerType(schema);
14789
14983
  return /* @__PURE__ */ jsx133(ZodOrNullishEditor, {
14790
14984
  defaultValue,
14791
14985
  jsonPath,
@@ -14822,10 +15016,6 @@ var ZodStaticFileEditor = ({
14822
15016
  saveDisabledByParent,
14823
15017
  mayPad
14824
15018
  }) => {
14825
- const z = useZodIfPossible();
14826
- if (!z) {
14827
- throw new Error("expected zod");
14828
- }
14829
15019
  const {
14830
15020
  localValue,
14831
15021
  onChange: setLocalValue,
@@ -14836,11 +15026,6 @@ var ZodStaticFileEditor = ({
14836
15026
  unsavedValue: value,
14837
15027
  savedValue: defaultValue
14838
15028
  });
14839
- const def = schema._def;
14840
- const typeName = def.typeName;
14841
- if (typeName !== z.ZodFirstPartyTypeKind.ZodString) {
14842
- throw new Error("expected enum");
14843
- }
14844
15029
  const isRoot = jsonPath.length === 0;
14845
15030
  const staticFiles = useStaticFiles();
14846
15031
  const comboBoxValues = useMemo75(() => {
@@ -15065,7 +15250,7 @@ import React93, { useMemo as useMemo77, useState as useState51 } from "react";
15065
15250
  import { useCallback as useCallback67, useMemo as useMemo76 } from "react";
15066
15251
  import { jsx as jsx137 } from "react/jsx-runtime";
15067
15252
  var ZodTupleItemEditor = ({
15068
- def,
15253
+ tupleItems,
15069
15254
  onChange,
15070
15255
  jsonPath,
15071
15256
  index,
@@ -15099,7 +15284,7 @@ var ZodTupleItemEditor = ({
15099
15284
  return /* @__PURE__ */ jsx137("div", {
15100
15285
  children: /* @__PURE__ */ jsx137(ZodSwitch, {
15101
15286
  jsonPath: newJsonPath,
15102
- schema: def.items[index],
15287
+ schema: tupleItems[index],
15103
15288
  value,
15104
15289
  setValue,
15105
15290
  defaultValue,
@@ -15135,7 +15320,7 @@ var ZodTupleEditor = ({
15135
15320
  savedValue: defaultValue
15136
15321
  });
15137
15322
  const [expanded, setExpanded] = useState51(true);
15138
- const def = schema._def;
15323
+ const tupleItems = getTupleItems(schema);
15139
15324
  const suffix2 = useMemo77(() => {
15140
15325
  return expanded ? " [" : " [...] ";
15141
15326
  }, [expanded]);
@@ -15144,10 +15329,6 @@ var ZodTupleEditor = ({
15144
15329
  throw new Error("expected zod");
15145
15330
  }
15146
15331
  const zodTypes = useZodTypesIfPossible();
15147
- const typeName = def.typeName;
15148
- if (typeName !== z.ZodFirstPartyTypeKind.ZodTuple) {
15149
- throw new Error("expected object");
15150
- }
15151
15332
  const isDefaultValue = useMemo77(() => {
15152
15333
  return deepEqual(localValue.value, defaultValue);
15153
15334
  }, [defaultValue, localValue]);
@@ -15186,10 +15367,10 @@ var ZodTupleEditor = ({
15186
15367
  /* @__PURE__ */ jsx138(ZodTupleItemEditor, {
15187
15368
  onChange,
15188
15369
  value: child,
15189
- def,
15370
+ tupleItems,
15190
15371
  index: i,
15191
15372
  jsonPath,
15192
- defaultValue: defaultValue?.[i] ?? createZodValues(def.items[i], z, zodTypes),
15373
+ defaultValue: defaultValue?.[i] ?? createZodValues(tupleItems[i], z, zodTypes),
15193
15374
  onSave,
15194
15375
  showSaveButton,
15195
15376
  saving,
@@ -15226,14 +15407,18 @@ var ZodTupleEditor = ({
15226
15407
 
15227
15408
  // src/components/RenderModal/SchemaEditor/ZodUnionEditor.tsx
15228
15409
  import { jsx as jsx139 } from "react/jsx-runtime";
15229
- var findNull = (value, zodType) => {
15230
- const nullIndex = value.findIndex((v) => v._def.typeName === zodType.ZodFirstPartyTypeKind.ZodNull || v._def.typeName === zodType.ZodFirstPartyTypeKind.ZodUndefined);
15410
+ var findNull = (value) => {
15411
+ const nullIndex = value.findIndex((v) => {
15412
+ const type = getZodSchemaType(v);
15413
+ return type === "null" || type === "undefined";
15414
+ });
15231
15415
  if (nullIndex === -1) {
15232
15416
  return null;
15233
15417
  }
15234
- const nullishValue = value[nullIndex]._def.typeName === zodType.ZodFirstPartyTypeKind.ZodNull ? null : undefined;
15418
+ const nullishValue = getZodSchemaType(value[nullIndex]) === "null" ? null : undefined;
15235
15419
  const otherSchema = value[nullIndex === 0 ? 1 : 0];
15236
- const otherSchemaIsAlsoNullish = otherSchema._def.typeName === zodType.ZodFirstPartyTypeKind.ZodNull || otherSchema._def.typeName === zodType.ZodFirstPartyTypeKind.ZodUndefined;
15420
+ const otherType = getZodSchemaType(otherSchema);
15421
+ const otherSchemaIsAlsoNullish = otherType === "null" || otherType === "undefined";
15237
15422
  return {
15238
15423
  nullIndex,
15239
15424
  nullishValue,
@@ -15254,11 +15439,7 @@ var ZodUnionEditor = ({
15254
15439
  saveDisabledByParent,
15255
15440
  mayPad
15256
15441
  }) => {
15257
- const { options } = schema._def;
15258
- const z = useZodIfPossible();
15259
- if (!z) {
15260
- throw new Error("expected zod");
15261
- }
15442
+ const options = getUnionOptions(schema);
15262
15443
  if (options.length > 2) {
15263
15444
  return /* @__PURE__ */ jsx139(ZonNonEditableValue, {
15264
15445
  jsonPath,
@@ -15277,7 +15458,7 @@ var ZodUnionEditor = ({
15277
15458
  mayPad
15278
15459
  });
15279
15460
  }
15280
- const nullResult = findNull(options, z);
15461
+ const nullResult = findNull(options);
15281
15462
  if (!nullResult) {
15282
15463
  return /* @__PURE__ */ jsx139(ZonNonEditableValue, {
15283
15464
  jsonPath,
@@ -15329,14 +15510,10 @@ var ZodSwitch = ({
15329
15510
  saveDisabledByParent,
15330
15511
  mayPad
15331
15512
  }) => {
15332
- const def = schema._def;
15333
- const typeName = def.typeName;
15334
- const z = useZodIfPossible();
15335
- if (!z) {
15336
- throw new Error("expected zod");
15337
- }
15513
+ const typeName = getZodSchemaType(schema);
15514
+ const description = getZodSchemaDescription(schema);
15338
15515
  const zodTypes = useZodTypesIfPossible();
15339
- if (typeName === z.ZodFirstPartyTypeKind.ZodObject) {
15516
+ if (typeName === "object") {
15340
15517
  return /* @__PURE__ */ jsx140(ZodObjectEditor, {
15341
15518
  setValue,
15342
15519
  unsavedValue: value,
@@ -15352,7 +15529,22 @@ var ZodSwitch = ({
15352
15529
  discriminatedUnionReplacement: null
15353
15530
  });
15354
15531
  }
15355
- if (typeName === z.ZodFirstPartyTypeKind.ZodString) {
15532
+ if (typeName === "string") {
15533
+ if (zodTypes && description === zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
15534
+ return /* @__PURE__ */ jsx140(ZodColorEditor, {
15535
+ value,
15536
+ setValue,
15537
+ jsonPath,
15538
+ schema,
15539
+ onSave,
15540
+ defaultValue,
15541
+ showSaveButton,
15542
+ onRemove,
15543
+ saving,
15544
+ saveDisabledByParent,
15545
+ mayPad
15546
+ });
15547
+ }
15356
15548
  if (value.startsWith(window.remotion_staticBase)) {
15357
15549
  return /* @__PURE__ */ jsx140(ZodStaticFileEditor, {
15358
15550
  setValue,
@@ -15368,7 +15560,7 @@ var ZodSwitch = ({
15368
15560
  mayPad
15369
15561
  });
15370
15562
  }
15371
- if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_TEXTAREA_BRAND) {
15563
+ if (zodTypes && description === zodTypes.ZodZypesInternals.REMOTION_TEXTAREA_BRAND) {
15372
15564
  return /* @__PURE__ */ jsx140(ZodTextareaEditor, {
15373
15565
  value,
15374
15566
  setValue,
@@ -15397,7 +15589,7 @@ var ZodSwitch = ({
15397
15589
  mayPad
15398
15590
  });
15399
15591
  }
15400
- if (typeName === z.ZodFirstPartyTypeKind.ZodDate) {
15592
+ if (typeName === "date") {
15401
15593
  return /* @__PURE__ */ jsx140(ZodDateEditor, {
15402
15594
  value,
15403
15595
  setValue,
@@ -15412,7 +15604,7 @@ var ZodSwitch = ({
15412
15604
  mayPad
15413
15605
  });
15414
15606
  }
15415
- if (typeName === z.ZodFirstPartyTypeKind.ZodNumber) {
15607
+ if (typeName === "number") {
15416
15608
  return /* @__PURE__ */ jsx140(ZodNumberEditor, {
15417
15609
  value,
15418
15610
  setValue,
@@ -15427,7 +15619,7 @@ var ZodSwitch = ({
15427
15619
  mayPad
15428
15620
  });
15429
15621
  }
15430
- if (typeName === z.ZodFirstPartyTypeKind.ZodBoolean) {
15622
+ if (typeName === "boolean") {
15431
15623
  return /* @__PURE__ */ jsx140(ZodBooleanEditor, {
15432
15624
  value,
15433
15625
  setValue,
@@ -15442,7 +15634,7 @@ var ZodSwitch = ({
15442
15634
  schema
15443
15635
  });
15444
15636
  }
15445
- if (typeName === z.ZodFirstPartyTypeKind.ZodUndefined) {
15637
+ if (typeName === "undefined") {
15446
15638
  return /* @__PURE__ */ jsx140(ZonNonEditableValue, {
15447
15639
  jsonPath,
15448
15640
  showSaveButton,
@@ -15451,7 +15643,7 @@ var ZodSwitch = ({
15451
15643
  mayPad
15452
15644
  });
15453
15645
  }
15454
- if (typeName === z.ZodFirstPartyTypeKind.ZodNull) {
15646
+ if (typeName === "null") {
15455
15647
  return /* @__PURE__ */ jsx140(ZonNonEditableValue, {
15456
15648
  jsonPath,
15457
15649
  showSaveButton,
@@ -15460,7 +15652,7 @@ var ZodSwitch = ({
15460
15652
  mayPad
15461
15653
  });
15462
15654
  }
15463
- if (typeName === z.ZodFirstPartyTypeKind.ZodAny) {
15655
+ if (typeName === "any") {
15464
15656
  return /* @__PURE__ */ jsx140(ZonNonEditableValue, {
15465
15657
  jsonPath,
15466
15658
  showSaveButton,
@@ -15469,7 +15661,7 @@ var ZodSwitch = ({
15469
15661
  mayPad
15470
15662
  });
15471
15663
  }
15472
- if (typeName === z.ZodFirstPartyTypeKind.ZodBigInt) {
15664
+ if (typeName === "bigint") {
15473
15665
  return /* @__PURE__ */ jsx140(ZonNonEditableValue, {
15474
15666
  jsonPath,
15475
15667
  showSaveButton,
@@ -15478,7 +15670,7 @@ var ZodSwitch = ({
15478
15670
  mayPad
15479
15671
  });
15480
15672
  }
15481
- if (typeName === z.ZodFirstPartyTypeKind.ZodUnknown) {
15673
+ if (typeName === "unknown") {
15482
15674
  return /* @__PURE__ */ jsx140(ZonNonEditableValue, {
15483
15675
  jsonPath,
15484
15676
  showSaveButton,
@@ -15487,7 +15679,22 @@ var ZodSwitch = ({
15487
15679
  mayPad
15488
15680
  });
15489
15681
  }
15490
- if (typeName === z.ZodFirstPartyTypeKind.ZodArray) {
15682
+ if (typeName === "array") {
15683
+ if (zodTypes && description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
15684
+ return /* @__PURE__ */ jsx140(ZodMatrixEditor, {
15685
+ setValue,
15686
+ value,
15687
+ jsonPath,
15688
+ schema,
15689
+ defaultValue,
15690
+ onSave,
15691
+ showSaveButton,
15692
+ onRemove,
15693
+ saving,
15694
+ saveDisabledByParent,
15695
+ mayPad
15696
+ });
15697
+ }
15491
15698
  return /* @__PURE__ */ jsx140(ZodArrayEditor, {
15492
15699
  setValue,
15493
15700
  value,
@@ -15502,7 +15709,7 @@ var ZodSwitch = ({
15502
15709
  mayPad
15503
15710
  });
15504
15711
  }
15505
- if (typeName === z.ZodFirstPartyTypeKind.ZodEnum) {
15712
+ if (typeName === "enum") {
15506
15713
  return /* @__PURE__ */ jsx140(ZodEnumEditor, {
15507
15714
  setValue,
15508
15715
  value,
@@ -15515,8 +15722,8 @@ var ZodSwitch = ({
15515
15722
  saving
15516
15723
  });
15517
15724
  }
15518
- if (typeName === z.ZodFirstPartyTypeKind.ZodEffects) {
15519
- if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
15725
+ if (typeName === "effects") {
15726
+ if (zodTypes && description === zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
15520
15727
  return /* @__PURE__ */ jsx140(ZodColorEditor, {
15521
15728
  value,
15522
15729
  setValue,
@@ -15531,12 +15738,12 @@ var ZodSwitch = ({
15531
15738
  mayPad
15532
15739
  });
15533
15740
  }
15534
- if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
15741
+ if (zodTypes && description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
15535
15742
  return /* @__PURE__ */ jsx140(ZodMatrixEditor, {
15536
15743
  setValue,
15537
15744
  value,
15538
15745
  jsonPath,
15539
- schema: schema._def.schema,
15746
+ schema: getEffectsInner(schema),
15540
15747
  defaultValue,
15541
15748
  onSave,
15542
15749
  showSaveButton,
@@ -15559,7 +15766,7 @@ var ZodSwitch = ({
15559
15766
  mayPad
15560
15767
  });
15561
15768
  }
15562
- if (typeName === z.ZodFirstPartyTypeKind.ZodUnion) {
15769
+ if (typeName === "union") {
15563
15770
  return /* @__PURE__ */ jsx140(ZodUnionEditor, {
15564
15771
  schema,
15565
15772
  showSaveButton,
@@ -15574,7 +15781,7 @@ var ZodSwitch = ({
15574
15781
  mayPad
15575
15782
  });
15576
15783
  }
15577
- if (typeName === z.ZodFirstPartyTypeKind.ZodOptional) {
15784
+ if (typeName === "optional") {
15578
15785
  return /* @__PURE__ */ jsx140(ZodOptionalEditor, {
15579
15786
  jsonPath,
15580
15787
  showSaveButton,
@@ -15589,7 +15796,7 @@ var ZodSwitch = ({
15589
15796
  mayPad
15590
15797
  });
15591
15798
  }
15592
- if (typeName === z.ZodFirstPartyTypeKind.ZodNullable) {
15799
+ if (typeName === "nullable") {
15593
15800
  return /* @__PURE__ */ jsx140(ZodNullableEditor, {
15594
15801
  jsonPath,
15595
15802
  showSaveButton,
@@ -15604,7 +15811,7 @@ var ZodSwitch = ({
15604
15811
  mayPad
15605
15812
  });
15606
15813
  }
15607
- if (typeName === z.ZodFirstPartyTypeKind.ZodDefault) {
15814
+ if (typeName === "default") {
15608
15815
  return /* @__PURE__ */ jsx140(ZodDefaultEditor, {
15609
15816
  jsonPath,
15610
15817
  showSaveButton,
@@ -15619,7 +15826,7 @@ var ZodSwitch = ({
15619
15826
  mayPad
15620
15827
  });
15621
15828
  }
15622
- if (typeName === z.ZodFirstPartyTypeKind.ZodDiscriminatedUnion) {
15829
+ if (typeName === "discriminatedUnion") {
15623
15830
  return /* @__PURE__ */ jsx140(ZodDiscriminatedUnionEditor, {
15624
15831
  defaultValue,
15625
15832
  mayPad,
@@ -15634,7 +15841,7 @@ var ZodSwitch = ({
15634
15841
  showSaveButton
15635
15842
  });
15636
15843
  }
15637
- if (typeName === z.ZodFirstPartyTypeKind.ZodTuple) {
15844
+ if (typeName === "tuple") {
15638
15845
  return /* @__PURE__ */ jsx140(ZodTupleEditor, {
15639
15846
  setValue,
15640
15847
  value,
@@ -15674,10 +15881,6 @@ var ZodObjectEditor = ({
15674
15881
  mayPad,
15675
15882
  discriminatedUnionReplacement
15676
15883
  }) => {
15677
- const z = useZodIfPossible();
15678
- if (!z) {
15679
- throw new Error("expected zod");
15680
- }
15681
15884
  const [expanded, setExpanded] = useState52(true);
15682
15885
  const { localValue, onChange, RevisionContextProvider, reset } = useLocalState({
15683
15886
  schema,
@@ -15685,12 +15888,11 @@ var ZodObjectEditor = ({
15685
15888
  unsavedValue,
15686
15889
  savedValue
15687
15890
  });
15688
- const def = schema._def;
15689
- const typeName = def.typeName;
15690
- if (typeName !== z.ZodFirstPartyTypeKind.ZodObject) {
15891
+ const typeName = getZodSchemaType(schema);
15892
+ if (typeName !== "object") {
15691
15893
  throw new Error("expected object");
15692
15894
  }
15693
- const shape = def.shape();
15895
+ const shape = getObjectShape(schema);
15694
15896
  const keys = Object.keys(shape);
15695
15897
  const isRoot = jsonPath.length === 0;
15696
15898
  const isDefaultValue = useMemo78(() => {
@@ -15835,13 +16037,12 @@ var SchemaEditor = ({
15835
16037
  save.unregister();
15836
16038
  };
15837
16039
  }, [keybindings, onQuickSave, onSave]);
15838
- const def = schema._def;
15839
- const typeName = def.typeName;
16040
+ const typeName = getZodSchemaType(schema);
15840
16041
  const reset = useCallback68(() => {
15841
16042
  setValue(savedDefaultProps);
15842
16043
  }, [savedDefaultProps, setValue]);
15843
16044
  if (!zodValidationResult.success) {
15844
- const defaultPropsValid = schema.safeParse(savedDefaultProps);
16045
+ const defaultPropsValid = zodSafeParse(schema, savedDefaultProps);
15845
16046
  if (!defaultPropsValid.success) {
15846
16047
  return /* @__PURE__ */ jsx142(InvalidDefaultProps, {
15847
16048
  zodValidationResult
@@ -15852,7 +16053,7 @@ var SchemaEditor = ({
15852
16053
  zodValidationResult
15853
16054
  });
15854
16055
  }
15855
- if (typeName !== z.ZodFirstPartyTypeKind.ZodObject) {
16056
+ if (typeName !== "object") {
15856
16057
  return /* @__PURE__ */ jsx142(TopLevelZodValue, {
15857
16058
  typeReceived: typeName
15858
16059
  });
@@ -16114,7 +16315,7 @@ var DataEditor = ({
16114
16315
  if (schema === "no-schema") {
16115
16316
  return "no-schema";
16116
16317
  }
16117
- return schema.safeParse(defaultProps);
16318
+ return zodSafeParse(schema, defaultProps);
16118
16319
  }, [defaultProps, schema]);
16119
16320
  const setShowWarning = useCallback70((val) => {
16120
16321
  setShowWarningWithoutPersistance((prevVal) => {
@@ -16289,9 +16490,8 @@ var DataEditor = ({
16289
16490
  if (zodValidationResult === "no-schema") {
16290
16491
  throw new Error("expected schema");
16291
16492
  }
16292
- const def = schema._def;
16293
- const typeName = def.typeName;
16294
- if (typeName === z.ZodFirstPartyTypeKind.ZodAny) {
16493
+ const typeName = getZodSchemaType(schema);
16494
+ if (typeName === "any") {
16295
16495
  return /* @__PURE__ */ jsx144(NoSchemaDefined, {});
16296
16496
  }
16297
16497
  if (!unresolvedComposition.defaultProps) {
@@ -20842,6 +21042,8 @@ var Inner2 = () => {
20842
21042
  if (!videoConfig) {
20843
21043
  return;
20844
21044
  }
21045
+ document.body.style.userSelect = "none";
21046
+ document.body.style.webkitUserSelect = "none";
20845
21047
  if (e.target === inPointerHandle.current) {
20846
21048
  if (inFrame === null) {
20847
21049
  throw new Error("expected outframe");
@@ -21003,6 +21205,8 @@ var Inner2 = () => {
21003
21205
  }, [get, inFrame, inOutDragging, outFrame, videoConfig, width]);
21004
21206
  const onPointerUpScrubbing = useCallback97((e) => {
21005
21207
  stopInterval();
21208
+ document.body.style.userSelect = "";
21209
+ document.body.style.webkitUserSelect = "";
21006
21210
  if (!videoConfig) {
21007
21211
  return;
21008
21212
  }
@@ -21028,6 +21232,8 @@ var Inner2 = () => {
21028
21232
  }
21029
21233
  }, [dragging, left3, play, videoConfig, setFrame, width]);
21030
21234
  const onPointerUpInOut = useCallback97((e) => {
21235
+ document.body.style.userSelect = "";
21236
+ document.body.style.webkitUserSelect = "";
21031
21237
  if (!videoConfig) {
21032
21238
  return;
21033
21239
  }
@@ -21533,9 +21739,7 @@ var text = {
21533
21739
  alignItems: "center",
21534
21740
  fontVariantNumeric: "tabular-nums",
21535
21741
  lineHeight: 1,
21536
- width: "100%",
21537
- userSelect: "none",
21538
- WebkitUserSelect: "none"
21742
+ width: "100%"
21539
21743
  };
21540
21744
  var time = {
21541
21745
  display: "inline-block",
@@ -23639,7 +23843,8 @@ var CodemodFooter = ({
23639
23843
  successNotification,
23640
23844
  errorNotification,
23641
23845
  genericSubmitLabel,
23642
- submitLabel
23846
+ submitLabel,
23847
+ onSuccess
23643
23848
  }) => {
23644
23849
  const [submitting, setSubmitting] = useState73(false);
23645
23850
  const { setSelectedModal } = useContext78(ModalsContext);
@@ -23668,6 +23873,7 @@ var CodemodFooter = ({
23668
23873
  signal: new AbortController().signal
23669
23874
  }).then(() => {
23670
23875
  notification2.replaceContent(successNotification, 2000);
23876
+ onSuccess?.();
23671
23877
  }).catch((err) => {
23672
23878
  notification2.replaceContent(`${errorNotification}: ${err.message}`, 2000);
23673
23879
  });
@@ -23675,6 +23881,7 @@ var CodemodFooter = ({
23675
23881
  codemod,
23676
23882
  errorNotification,
23677
23883
  loadingNotification,
23884
+ onSuccess,
23678
23885
  setSelectedModal,
23679
23886
  successNotification
23680
23887
  ]);
@@ -23819,7 +24026,8 @@ var DeleteCompositionLoaded = ({ compositionId }) => {
23819
24026
  genericSubmitLabel: `Delete`,
23820
24027
  submitLabel: ({ relativeRootPath }) => `Delete from ${relativeRootPath}`,
23821
24028
  codemod,
23822
- valid: true
24029
+ valid: true,
24030
+ onSuccess: null
23823
24031
  })
23824
24032
  })
23825
24033
  ]
@@ -24080,6 +24288,9 @@ var DuplicateCompositionLoaded = ({ initialType }) => {
24080
24288
  size4.width,
24081
24289
  type
24082
24290
  ]);
24291
+ const onDuplicateSuccess = useCallback107(() => {
24292
+ pushUrl(`/${newId}`);
24293
+ }, [newId]);
24083
24294
  const onSubmit = useCallback107((e) => {
24084
24295
  e.preventDefault();
24085
24296
  }, []);
@@ -24278,7 +24489,8 @@ var DuplicateCompositionLoaded = ({ initialType }) => {
24278
24489
  genericSubmitLabel: "Duplicate",
24279
24490
  submitLabel: ({ relativeRootPath }) => `Add to ${relativeRootPath}`,
24280
24491
  codemod,
24281
- valid
24492
+ valid,
24493
+ onSuccess: onDuplicateSuccess
24282
24494
  })
24283
24495
  })
24284
24496
  ]
@@ -24390,7 +24602,8 @@ var RenameCompositionLoaded = () => {
24390
24602
  genericSubmitLabel: "Rename",
24391
24603
  submitLabel: ({ relativeRootPath }) => `Modify ${relativeRootPath}`,
24392
24604
  codemod,
24393
- valid
24605
+ valid,
24606
+ onSuccess: null
24394
24607
  })
24395
24608
  })
24396
24609
  ]
@@ -26501,7 +26714,9 @@ var selectorButton2 = {
26501
26714
  flexDirection: "row",
26502
26715
  fontSize: 14,
26503
26716
  color: "inherit",
26504
- alignItems: "center"
26717
+ alignItems: "center",
26718
+ userSelect: "none",
26719
+ WebkitUserSelect: "none"
26505
26720
  };
26506
26721
  var VerticalTab = ({ children, onClick, style: style12, selected }) => {
26507
26722
  const [hovered, setHovered] = useState80(false);
@@ -33144,9 +33359,10 @@ var makeDefaultGlobalCSS = () => {
33144
33359
  /* Override Chakra UI position: relative on body */
33145
33360
  position: static !important;
33146
33361
  }
33147
-
33362
+
33148
33363
  .remotion-splitter {
33149
33364
  user-select: none;
33365
+ -webkit-user-select: none;
33150
33366
  }
33151
33367
 
33152
33368
  .remotion-splitter-horizontal {
@@ -33965,6 +34181,15 @@ var enableHotMiddleware = () => {
33965
34181
  // src/previewEntry.tsx
33966
34182
  import { jsx as jsx294 } from "react/jsx-runtime";
33967
34183
  Internals69.CSSUtils.injectCSS(Internals69.CSSUtils.makeDefaultPreviewCSS(null, "#1f2428"));
34184
+ if (!window.__remotionOverlayStarted) {
34185
+ window.__remotionOverlayStarted = true;
34186
+ try {
34187
+ startErrorOverlay();
34188
+ enableHotMiddleware();
34189
+ } catch (err) {
34190
+ console.error("Failed to initialize error overlay", err);
34191
+ }
34192
+ }
33968
34193
  var root = null;
33969
34194
  var getRootForElement = () => {
33970
34195
  if (root) {
@@ -33991,5 +34216,3 @@ Internals69.waitForRoot((NewRoot) => {
33991
34216
  rootComponent: NewRoot
33992
34217
  }));
33993
34218
  });
33994
- startErrorOverlay();
33995
- enableHotMiddleware();