@prismicio/types-internal 4.0.0-pr.6.7b0b0be → 4.0.0-pr.6.bbcafda

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 (138) hide show
  1. package/dist/content/codec/link.js +8 -8
  2. package/dist/content/codec/link.js.map +1 -1
  3. package/dist/content/codec/richText.js +2 -2
  4. package/dist/content/codec/richText.js.map +1 -1
  5. package/dist/content/document.d.ts +2 -3019
  6. package/dist/content/document.d.ts.map +1 -1
  7. package/dist/content/field.d.ts +1 -30
  8. package/dist/content/field.d.ts.map +1 -1
  9. package/dist/content/field.js.map +1 -1
  10. package/dist/content/group.d.ts +2 -1
  11. package/dist/content/group.d.ts.map +1 -1
  12. package/dist/content/group.js.map +1 -1
  13. package/dist/content/legacy/boolean.d.ts +1 -0
  14. package/dist/content/legacy/embed.d.ts +1 -0
  15. package/dist/content/legacy/empty.d.ts +1 -0
  16. package/dist/content/legacy/field.d.ts +1 -0
  17. package/dist/content/legacy/geopoint.d.ts +1 -0
  18. package/dist/content/legacy/group.d.ts +9 -0
  19. package/dist/content/legacy/group.d.ts.map +1 -0
  20. package/dist/content/legacy/group.js.map +1 -1
  21. package/dist/content/legacy/integrationField.d.ts +1 -0
  22. package/dist/content/legacy/link.d.ts +41 -0
  23. package/dist/content/legacy/link.d.ts.map +1 -0
  24. package/dist/content/legacy/link.js.map +1 -1
  25. package/dist/content/legacy/nestable.d.ts +1 -0
  26. package/dist/content/legacy/nestable.js.map +1 -1
  27. package/dist/content/legacy/repeatable.d.ts +1 -0
  28. package/dist/content/legacy/richText.d.ts +109 -0
  29. package/dist/content/legacy/richText.d.ts.map +1 -0
  30. package/dist/content/legacy/richText.js +3 -3
  31. package/dist/content/legacy/richText.js.map +1 -1
  32. package/dist/content/legacy/separator.d.ts +1 -0
  33. package/dist/content/legacy/slice.js.map +1 -1
  34. package/dist/content/legacy/table.d.ts +1 -0
  35. package/dist/content/link.d.ts +74 -99
  36. package/dist/content/link.d.ts.map +1 -1
  37. package/dist/content/link.js +2 -2
  38. package/dist/content/link.js.map +1 -1
  39. package/dist/content/nestable.d.ts +13 -749
  40. package/dist/content/nestable.d.ts.map +1 -1
  41. package/dist/content/nestable.js.map +1 -1
  42. package/dist/content/repeatable.d.ts +3 -98
  43. package/dist/content/repeatable.d.ts.map +1 -1
  44. package/dist/content/richText.d.ts +81 -131
  45. package/dist/content/richText.d.ts.map +1 -1
  46. package/dist/content/richText.js +5 -4
  47. package/dist/content/richText.js.map +1 -1
  48. package/dist/content/slice.d.ts +6 -4509
  49. package/dist/content/slice.d.ts.map +1 -1
  50. package/dist/content/slice.js.map +1 -1
  51. package/dist/content/slices.d.ts +8 -6765
  52. package/dist/content/slices.d.ts.map +1 -1
  53. package/dist/content/table.d.ts +2 -134
  54. package/dist/content/table.d.ts.map +1 -1
  55. package/dist/content/widget.d.ts +5 -3020
  56. package/dist/content/widget.d.ts.map +1 -1
  57. package/dist/content/widget.js.map +1 -1
  58. package/dist/helpers/customTypeModel.d.ts +1 -1
  59. package/dist/helpers/documentContent.d.ts +3 -9
  60. package/dist/helpers/documentContent.d.ts.map +1 -1
  61. package/dist/helpers/documentContent.js +3 -3
  62. package/dist/helpers/documentContent.js.map +1 -1
  63. package/dist/helpers/traverseContent.d.ts +10 -11
  64. package/dist/helpers/traverseContent.d.ts.map +1 -1
  65. package/dist/helpers/traverseContent.js.map +1 -1
  66. package/dist/helpers/traverseContentWithModel.d.ts +10 -11
  67. package/dist/helpers/traverseContentWithModel.d.ts.map +1 -1
  68. package/dist/helpers/traverseContentWithModel.js.map +1 -1
  69. package/dist/index.d.ts +25 -25
  70. package/dist/io-ts.d.ts +3380 -70926
  71. package/dist/io-ts.d.ts.map +1 -1
  72. package/dist/io-ts.js +125 -122
  73. package/dist/io-ts.js.map +1 -1
  74. package/dist/model/customType.d.ts +3 -3329
  75. package/dist/model/customType.d.ts.map +1 -1
  76. package/dist/model/group.d.ts +391 -392
  77. package/dist/model/group.d.ts.map +1 -1
  78. package/dist/model/group.js.map +1 -1
  79. package/dist/model/image.d.ts +4 -4
  80. package/dist/model/image.js.map +1 -1
  81. package/dist/model/link.d.ts +18 -18
  82. package/dist/model/link.d.ts.map +1 -1
  83. package/dist/model/link.js +7 -7
  84. package/dist/model/link.js.map +1 -1
  85. package/dist/model/nestable.d.ts +17 -178
  86. package/dist/model/nestable.d.ts.map +1 -1
  87. package/dist/model/nestable.js.map +1 -1
  88. package/dist/model/richText.d.ts +3 -7
  89. package/dist/model/richText.d.ts.map +1 -1
  90. package/dist/model/richText.js.map +1 -1
  91. package/dist/model/section.d.ts +3 -3329
  92. package/dist/model/section.d.ts.map +1 -1
  93. package/dist/model/select.d.ts +1 -1
  94. package/dist/model/select.js +1 -1
  95. package/dist/model/select.js.map +1 -1
  96. package/dist/model/slice.d.ts +861 -3800
  97. package/dist/model/slice.d.ts.map +1 -1
  98. package/dist/model/slice.js +7 -2
  99. package/dist/model/slice.js.map +1 -1
  100. package/dist/model/slices.d.ts +3 -2195
  101. package/dist/model/slices.d.ts.map +1 -1
  102. package/dist/model/widget.d.ts +6 -3331
  103. package/dist/model/widget.d.ts.map +1 -1
  104. package/dist/model/widget.js.map +1 -1
  105. package/dist/zod4.d.ts +1345 -34797
  106. package/dist/zod4.d.ts.map +1 -1
  107. package/dist/zod4.js +125 -122
  108. package/dist/zod4.js.map +1 -1
  109. package/package.json +3 -2
  110. package/src/content/codec/link.ts +8 -8
  111. package/src/content/codec/richText.ts +10 -6
  112. package/src/content/field.ts +9 -2
  113. package/src/content/group.ts +5 -2
  114. package/src/content/legacy/group.ts +10 -4
  115. package/src/content/legacy/link.ts +32 -9
  116. package/src/content/legacy/nestable.ts +26 -2
  117. package/src/content/legacy/richText.ts +40 -7
  118. package/src/content/legacy/slice.ts +2 -2
  119. package/src/content/legacy/widget.ts +6 -2
  120. package/src/content/link.ts +32 -9
  121. package/src/content/nestable.ts +40 -2
  122. package/src/content/richText.ts +31 -9
  123. package/src/content/slice.ts +2 -2
  124. package/src/content/widget.ts +6 -2
  125. package/src/helpers/documentContent.ts +12 -15
  126. package/src/helpers/traverseContent.ts +12 -19
  127. package/src/helpers/traverseContentWithModel.ts +10 -16
  128. package/src/index.ts +3 -2
  129. package/src/io-ts.ts +166 -140
  130. package/src/model/group.ts +4 -1
  131. package/src/model/image.ts +1 -1
  132. package/src/model/link.ts +39 -45
  133. package/src/model/nestable.ts +33 -1
  134. package/src/model/richText.ts +2 -2
  135. package/src/model/select.ts +2 -2
  136. package/src/model/slice.ts +36 -9
  137. package/src/model/widget.ts +8 -4
  138. package/src/zod4.ts +166 -140
@@ -1 +1 @@
1
- {"version":3,"file":"group.d.ts","names":[],"sources":["../../src/model/group.ts"],"mappings":";;;cA0Ba,sBAAA,EAAsB,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEvB,gBAAA,GAAmB,CAAA,CAAE,KAAA,QAAa,sBAAA;AAAA,cAGjC,gBAAA,EAAgB,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIjB,UAAA,GAAa,CAAA,CAAE,KAAA,QAAa,gBAAA"}
1
+ {"version":3,"file":"group.d.ts","names":[],"sources":["../../src/model/group.ts"],"mappings":";;;;cA2Ba,sBAAA,EAAsB,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEvB,gBAAA,GAAmB,CAAA,CAAE,KAAA,QAAa,sBAAA;AAAA,cAGjC,gBAAA,EAAgB,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAMjB,UAAA,GAAa,CAAA,CAAE,KAAA,QAAa,gBAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"group.js","names":[],"sources":["../../src/model/group.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { WidgetKeySchema } from \"../common/widgetKey\"\nimport { NestableModelSchema } from \"./nestable\"\n\nexport const GroupFieldType = \"Group\"\n\n// Factory to create group config schema with configurable widget types\nconst createGroupConfigSchema = <TWidgets extends z.ZodMiniType>(widgets: TWidgets) =>\n\tz.object({\n\t\tlabel: z.nullish(z.string()),\n\t\trepeat: z.optional(z.boolean()),\n\t\tfields: z.optional(z.record(WidgetKeySchema, widgets)),\n\t})\n\n// Factory to create group schema with configurable widget types\nconst createGroupSchema = <TWidgets extends z.ZodMiniType>(widgets: TWidgets) =>\n\tz.object({\n\t\ttype: z.literal(GroupFieldType),\n\t\tfieldset: z.nullish(z.string()),\n\t\ticon: z.optional(z.string()),\n\t\tdescription: z.optional(z.string()),\n\t\tconfig: z.optional(createGroupConfigSchema(widgets)),\n\t})\n\n// NestedGroup - only allows Nestable in fields (no further nesting)\nexport const NestedGroupModelSchema = createGroupSchema(NestableModelSchema)\n\nexport type NestedGroupModel = z.infer<typeof NestedGroupModelSchema>\n\n// Group - allows Nestable | NestedGroup in fields (max 2 levels of nesting)\nexport const GroupModelSchema = createGroupSchema(\n\tz.union([NestableModelSchema, NestedGroupModelSchema]),\n)\n\nexport type GroupModel = z.infer<typeof GroupModelSchema>\n"],"mappings":";;;;AAKA,MAAa,iBAAiB;AAG9B,MAAM,2BAA2D,YAChE,EAAE,OAAO;CACR,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC5B,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC;CAC/B,QAAQ,EAAE,SAAS,EAAE,OAAO,iBAAiB,QAAQ,CAAC;CACtD,CAAC;AAGH,MAAM,qBAAqD,YAC1D,EAAE,OAAO;CACR,MAAM,EAAE,QAAQ,eAAe;CAC/B,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC/B,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC;CAC5B,aAAa,EAAE,SAAS,EAAE,QAAQ,CAAC;CACnC,QAAQ,EAAE,SAAS,wBAAwB,QAAQ,CAAC;CACpD,CAAC;AAGH,MAAa,yBAAyB,kBAAkB,oBAAoB;AAK5E,MAAa,mBAAmB,kBAC/B,EAAE,MAAM,CAAC,qBAAqB,uBAAuB,CAAC,CACtD"}
1
+ {"version":3,"file":"group.js","names":[],"sources":["../../src/model/group.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { WidgetKeySchema } from \"../common/widgetKey\"\nimport type { NestableModel } from \"./nestable\"\nimport { NestableModelSchema } from \"./nestable\"\n\nexport const GroupFieldType = \"Group\"\n\n// Factory to create group config schema with configurable widget types\nconst createGroupConfigSchema = <TWidgets extends z.ZodMiniType>(widgets: TWidgets) =>\n\tz.object({\n\t\tlabel: z.nullish(z.string()),\n\t\trepeat: z.optional(z.boolean()),\n\t\tfields: z.optional(z.record(WidgetKeySchema, widgets)),\n\t})\n\n// Factory to create group schema with configurable widget types\nconst createGroupSchema = <TWidgets extends z.ZodMiniType>(widgets: TWidgets) =>\n\tz.object({\n\t\ttype: z.literal(GroupFieldType),\n\t\tfieldset: z.nullish(z.string()),\n\t\ticon: z.optional(z.string()),\n\t\tdescription: z.optional(z.string()),\n\t\tconfig: z.optional(createGroupConfigSchema(widgets)),\n\t})\n\n// NestedGroup - only allows Nestable in fields (no further nesting)\nexport const NestedGroupModelSchema = createGroupSchema(NestableModelSchema)\n\nexport type NestedGroupModel = z.infer<typeof NestedGroupModelSchema>\n\n// Group - allows Nestable | NestedGroup in fields (max 2 levels of nesting)\nexport const GroupModelSchema = createGroupSchema(\n\tz.union([NestableModelSchema, NestedGroupModelSchema]) as z.ZodMiniType<\n\t\tNestableModel | NestedGroupModel\n\t>,\n)\n\nexport type GroupModel = z.infer<typeof GroupModelSchema>\n"],"mappings":";;;;AAMA,MAAa,iBAAiB;AAG9B,MAAM,2BAA2D,YAChE,EAAE,OAAO;CACR,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC5B,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC;CAC/B,QAAQ,EAAE,SAAS,EAAE,OAAO,iBAAiB,QAAQ,CAAC;CACtD,CAAC;AAGH,MAAM,qBAAqD,YAC1D,EAAE,OAAO;CACR,MAAM,EAAE,QAAQ,eAAe;CAC/B,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC/B,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC;CAC5B,aAAa,EAAE,SAAS,EAAE,QAAQ,CAAC;CACnC,QAAQ,EAAE,SAAS,wBAAwB,QAAQ,CAAC;CACpD,CAAC;AAGH,MAAa,yBAAyB,kBAAkB,oBAAoB;AAK5E,MAAa,mBAAmB,kBAC/B,EAAE,MAAM,CAAC,qBAAqB,uBAAuB,CAAC,CAGtD"}
@@ -8,13 +8,13 @@ declare const ImageModelSchema: z.ZodMiniObject<{
8
8
  label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
9
9
  placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
10
10
  constraint: z.ZodMiniOptional<z.ZodMiniObject<{
11
- width: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniLiteral<"auto">, z.ZodMiniTransform<null, "auto">>, z.ZodMiniPipe<z.ZodMiniLiteral<"">, z.ZodMiniTransform<null, "">>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
12
- height: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniLiteral<"auto">, z.ZodMiniTransform<null, "auto">>, z.ZodMiniPipe<z.ZodMiniLiteral<"">, z.ZodMiniTransform<null, "">>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
11
+ width: z.ZodMiniOptional<z.ZodMiniType<number | null, unknown, z.core.$ZodTypeInternals<number | null, unknown>>>;
12
+ height: z.ZodMiniOptional<z.ZodMiniType<number | null, unknown, z.core.$ZodTypeInternals<number | null, unknown>>>;
13
13
  }, z.core.$strip>>;
14
14
  thumbnails: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
15
15
  name: z.ZodMiniString<string>;
16
- width: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniLiteral<"auto">, z.ZodMiniTransform<null, "auto">>, z.ZodMiniPipe<z.ZodMiniLiteral<"">, z.ZodMiniTransform<null, "">>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
17
- height: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniLiteral<"auto">, z.ZodMiniTransform<null, "auto">>, z.ZodMiniPipe<z.ZodMiniLiteral<"">, z.ZodMiniTransform<null, "">>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
16
+ width: z.ZodMiniOptional<z.ZodMiniType<number | null, unknown, z.core.$ZodTypeInternals<number | null, unknown>>>;
17
+ height: z.ZodMiniOptional<z.ZodMiniType<number | null, unknown, z.core.$ZodTypeInternals<number | null, unknown>>>;
18
18
  }, z.core.$strip>>>;
19
19
  }, z.core.$strip>>;
20
20
  }, z.core.$strip>;
@@ -1 +1 @@
1
- {"version":3,"file":"image.js","names":[],"sources":["../../src/model/image.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\n/**\n * SideConstraint accepts multiple input formats and normalizes to number | null:\n * - Integer values\n * - String integers (e.g., \"100\")\n * - Pixel strings (e.g., \"100px\")\n * - \"auto\" or \"\" → null\n * - null\n */\nexport const SideConstraintSchema = z.union([\n\tz.pipe(\n\t\tz.literal(\"auto\"),\n\t\tz.transform(() => null),\n\t),\n\tz.pipe(\n\t\tz.literal(\"\"),\n\t\tz.transform(() => null),\n\t),\n\tz.null(),\n\tz.number().check(z.int()),\n\tz.pipe(\n\t\tz.string(),\n\t\tz.transform((s: string) => parseInt(s.replace(\"px\", \"\"), 10)),\n\t),\n])\n\nexport const ImageConstraintSchema = z.object({\n\twidth: z.optional(SideConstraintSchema),\n\theight: z.optional(SideConstraintSchema),\n})\n\nexport type ImageConstraint = z.infer<typeof ImageConstraintSchema>\n\nconst ThumbnailSchema = z.object({\n\tname: z.string(),\n\twidth: z.optional(SideConstraintSchema),\n\theight: z.optional(SideConstraintSchema),\n})\n\nconst ImageConfigSchema = z.object({\n\tlabel: z.nullish(z.string()),\n\tplaceholder: z.optional(z.string()),\n\tconstraint: z.optional(ImageConstraintSchema),\n\tthumbnails: z.optional(z.array(ThumbnailSchema)),\n})\n\nexport const ImageModelSchema = z.object({\n\ttype: z.literal(\"Image\"),\n\tfieldset: z.nullish(z.string()),\n\tconfig: z.optional(ImageConfigSchema),\n})\n\nexport type ImageModel = z.infer<typeof ImageModelSchema>\n"],"mappings":";;;;;;;;;;AAUA,MAAa,uBAAuB,EAAE,MAAM;CAC3C,EAAE,KACD,EAAE,QAAQ,OAAO,EACjB,EAAE,gBAAgB,KAAK,CACvB;CACD,EAAE,KACD,EAAE,QAAQ,GAAG,EACb,EAAE,gBAAgB,KAAK,CACvB;CACD,EAAE,MAAM;CACR,EAAE,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;CACzB,EAAE,KACD,EAAE,QAAQ,EACV,EAAE,WAAW,MAAc,SAAS,EAAE,QAAQ,MAAM,GAAG,EAAE,GAAG,CAAC,CAC7D;CACD,CAAC;AAEF,MAAa,wBAAwB,EAAE,OAAO;CAC7C,OAAO,EAAE,SAAS,qBAAqB;CACvC,QAAQ,EAAE,SAAS,qBAAqB;CACxC,CAAC;AAIF,MAAM,kBAAkB,EAAE,OAAO;CAChC,MAAM,EAAE,QAAQ;CAChB,OAAO,EAAE,SAAS,qBAAqB;CACvC,QAAQ,EAAE,SAAS,qBAAqB;CACxC,CAAC;AAEF,MAAM,oBAAoB,EAAE,OAAO;CAClC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC5B,aAAa,EAAE,SAAS,EAAE,QAAQ,CAAC;CACnC,YAAY,EAAE,SAAS,sBAAsB;CAC7C,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;CAChD,CAAC;AAEF,MAAa,mBAAmB,EAAE,OAAO;CACxC,MAAM,EAAE,QAAQ,QAAQ;CACxB,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC/B,QAAQ,EAAE,SAAS,kBAAkB;CACrC,CAAC"}
1
+ {"version":3,"file":"image.js","names":[],"sources":["../../src/model/image.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\n/**\n * SideConstraint accepts multiple input formats and normalizes to number | null:\n * - Integer values\n * - String integers (e.g., \"100\")\n * - Pixel strings (e.g., \"100px\")\n * - \"auto\" or \"\" → null\n * - null\n */\nexport const SideConstraintSchema: z.ZodMiniType<number | null> = z.union([\n\tz.pipe(\n\t\tz.literal(\"auto\"),\n\t\tz.transform(() => null),\n\t),\n\tz.pipe(\n\t\tz.literal(\"\"),\n\t\tz.transform(() => null),\n\t),\n\tz.null(),\n\tz.number().check(z.int()),\n\tz.pipe(\n\t\tz.string(),\n\t\tz.transform((s: string) => parseInt(s.replace(\"px\", \"\"), 10)),\n\t),\n])\n\nexport const ImageConstraintSchema = z.object({\n\twidth: z.optional(SideConstraintSchema),\n\theight: z.optional(SideConstraintSchema),\n})\n\nexport type ImageConstraint = z.infer<typeof ImageConstraintSchema>\n\nconst ThumbnailSchema = z.object({\n\tname: z.string(),\n\twidth: z.optional(SideConstraintSchema),\n\theight: z.optional(SideConstraintSchema),\n})\n\nconst ImageConfigSchema = z.object({\n\tlabel: z.nullish(z.string()),\n\tplaceholder: z.optional(z.string()),\n\tconstraint: z.optional(ImageConstraintSchema),\n\tthumbnails: z.optional(z.array(ThumbnailSchema)),\n})\n\nexport const ImageModelSchema = z.object({\n\ttype: z.literal(\"Image\"),\n\tfieldset: z.nullish(z.string()),\n\tconfig: z.optional(ImageConfigSchema),\n})\n\nexport type ImageModel = z.infer<typeof ImageModelSchema>\n"],"mappings":";;;;;;;;;;AAUA,MAAa,uBAAqD,EAAE,MAAM;CACzE,EAAE,KACD,EAAE,QAAQ,OAAO,EACjB,EAAE,gBAAgB,KAAK,CACvB;CACD,EAAE,KACD,EAAE,QAAQ,GAAG,EACb,EAAE,gBAAgB,KAAK,CACvB;CACD,EAAE,MAAM;CACR,EAAE,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;CACzB,EAAE,KACD,EAAE,QAAQ,EACV,EAAE,WAAW,MAAc,SAAS,EAAE,QAAQ,MAAM,GAAG,EAAE,GAAG,CAAC,CAC7D;CACD,CAAC;AAEF,MAAa,wBAAwB,EAAE,OAAO;CAC7C,OAAO,EAAE,SAAS,qBAAqB;CACvC,QAAQ,EAAE,SAAS,qBAAqB;CACxC,CAAC;AAIF,MAAM,kBAAkB,EAAE,OAAO;CAChC,MAAM,EAAE,QAAQ;CAChB,OAAO,EAAE,SAAS,qBAAqB;CACvC,QAAQ,EAAE,SAAS,qBAAqB;CACxC,CAAC;AAEF,MAAM,oBAAoB,EAAE,OAAO;CAClC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC5B,aAAa,EAAE,SAAS,EAAE,QAAQ,CAAC;CACnC,YAAY,EAAE,SAAS,sBAAsB;CAC7C,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;CAChD,CAAC;AAEF,MAAa,mBAAmB,EAAE,OAAO;CACxC,MAAM,EAAE,QAAQ,QAAQ;CACxB,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC/B,QAAQ,EAAE,SAAS,kBAAkB;CACrC,CAAC"}
@@ -9,33 +9,33 @@ declare const LinkModelSchema: z.ZodMiniObject<{
9
9
  useAsTitle: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
10
10
  placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
11
11
  select: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnknown, z.ZodMiniTransform<"media" | "document" | "web" | null, unknown>>>;
12
- customtypes: z.ZodMiniOptional<z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
12
+ customtypes: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
13
13
  id: z.ZodMiniString<string>;
14
- fields: z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
14
+ fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
15
15
  id: z.ZodMiniString<string>;
16
- fields: z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
16
+ fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
17
17
  id: z.ZodMiniString<string>;
18
- customtypes: z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
18
+ customtypes: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
19
19
  id: z.ZodMiniString<string>;
20
- fields: z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
20
+ fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
21
21
  id: z.ZodMiniString<string>;
22
- fields: z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniString<string>>>;
23
- }, z.core.$strip>, z.ZodMiniString<string>]>>>;
24
- }, z.core.$strip>]>>>;
25
- }, z.core.$strip>, z.ZodMiniString<string>]>>>;
22
+ fields: z.ZodMiniArray<z.ZodMiniString<string>>;
23
+ }, z.core.$strip>, z.ZodMiniString<string>]>>;
24
+ }, z.core.$strip>]>>;
25
+ }, z.core.$strip>, z.ZodMiniString<string>]>>;
26
26
  }, z.core.$strip>, z.ZodMiniObject<{
27
27
  id: z.ZodMiniString<string>;
28
- customtypes: z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
28
+ customtypes: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
29
29
  id: z.ZodMiniString<string>;
30
- fields: z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
30
+ fields: z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
31
31
  id: z.ZodMiniString<string>;
32
- fields: z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniString<string>>>;
33
- }, z.core.$strip>, z.ZodMiniString<string>]>>>;
34
- }, z.core.$strip>]>>>;
35
- }, z.core.$strip>, z.ZodMiniString<string>]>>>;
36
- }, z.core.$strip>]>>>>;
37
- masks: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<readonly string[], string | string[]>>>;
38
- tags: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<readonly string[], string | string[]>>>;
32
+ fields: z.ZodMiniArray<z.ZodMiniString<string>>;
33
+ }, z.core.$strip>, z.ZodMiniString<string>]>>;
34
+ }, z.core.$strip>]>>;
35
+ }, z.core.$strip>, z.ZodMiniString<string>]>>;
36
+ }, z.core.$strip>]>>>;
37
+ masks: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<string[], string | string[]>>>;
38
+ tags: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<string[], string | string[]>>>;
39
39
  allowTargetBlank: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
40
40
  allowText: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
41
41
  repeat: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
@@ -1 +1 @@
1
- {"version":3,"file":"link.d.ts","names":[],"sources":["../../src/model/link.ts"],"mappings":";;;cA4Ia,eAAA,EAAe,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAMhB,SAAA,GAAY,CAAA,CAAE,KAAA,QAAa,eAAA"}
1
+ {"version":3,"file":"link.d.ts","names":[],"sources":["../../src/model/link.ts"],"mappings":";;;cAsIa,eAAA,EAAe,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAMhB,SAAA,GAAY,CAAA,CAAE,KAAA,QAAa,eAAA"}
@@ -2,7 +2,7 @@ import { z } from "zod/mini";
2
2
  //#region src/model/link.ts
3
3
  const MasksArrayStringSchema = z.pipe(z.union([z.array(z.string()), z.string()]), z.transform((val) => typeof val === "string" ? [val] : val));
4
4
  const noDuplicateStrings = z.refine((arr) => new Set(arr).size === arr.length, "Fields have duplicates.");
5
- const CustomTypeLevel2FieldGroupFieldsSchema = z.readonly(z.array(z.string()).check(noDuplicateStrings));
5
+ const CustomTypeLevel2FieldGroupFieldsSchema = z.array(z.string()).check(noDuplicateStrings);
6
6
  const CustomTypeLevel2FieldSchema = z.union([z.object({
7
7
  id: z.string(),
8
8
  fields: CustomTypeLevel2FieldGroupFieldsSchema
@@ -11,18 +11,18 @@ const noDuplicateIds = (items) => {
11
11
  const arr = items;
12
12
  return new Set(arr.map((item) => typeof item === "string" ? item : item.id)).size === arr.length;
13
13
  };
14
- const CustomTypeLevel2FieldsSchema = z.readonly(z.array(CustomTypeLevel2FieldSchema).check(z.refine(noDuplicateIds, "Fields have duplicates.")));
14
+ const CustomTypeLevel2FieldsSchema = z.array(CustomTypeLevel2FieldSchema).check(z.refine(noDuplicateIds, "Fields have duplicates."));
15
15
  const CustomTypeLevel2Schema = z.union([z.string(), z.object({
16
16
  id: z.string(),
17
17
  fields: CustomTypeLevel2FieldsSchema
18
18
  })]);
19
- const CustomTypesLevel2Schema = z.readonly(z.array(CustomTypeLevel2Schema).check(z.refine(noDuplicateIds, "Custom types have duplicates.")));
19
+ const CustomTypesLevel2Schema = z.array(CustomTypeLevel2Schema).check(z.refine(noDuplicateIds, "Custom types have duplicates."));
20
20
  const CustomTypeLevel1FieldCustomTypesSchema = z.object({
21
21
  id: z.string(),
22
22
  customtypes: CustomTypesLevel2Schema
23
23
  });
24
24
  const CustomTypeLevel1FieldGroupFieldSchema = z.union([CustomTypeLevel1FieldCustomTypesSchema, z.string()]);
25
- const CustomTypeLevel1FieldGroupFieldsSchema = z.readonly(z.array(CustomTypeLevel1FieldGroupFieldSchema).check(z.refine(noDuplicateIds, "Fields have duplicates.")));
25
+ const CustomTypeLevel1FieldGroupFieldsSchema = z.array(CustomTypeLevel1FieldGroupFieldSchema).check(z.refine(noDuplicateIds, "Fields have duplicates."));
26
26
  const CustomTypeLevel1FieldSchema = z.union([
27
27
  z.object({
28
28
  id: z.string(),
@@ -31,12 +31,12 @@ const CustomTypeLevel1FieldSchema = z.union([
31
31
  CustomTypeLevel1FieldCustomTypesSchema,
32
32
  z.string()
33
33
  ]);
34
- const CustomTypeLevel1FieldsSchema = z.readonly(z.array(CustomTypeLevel1FieldSchema).check(z.refine(noDuplicateIds, "Fields have duplicates.")));
34
+ const CustomTypeLevel1FieldsSchema = z.array(CustomTypeLevel1FieldSchema).check(z.refine(noDuplicateIds, "Fields have duplicates."));
35
35
  const CustomTypeLevel1Schema = z.union([z.string(), z.object({
36
36
  id: z.string(),
37
37
  fields: CustomTypeLevel1FieldsSchema
38
38
  })]);
39
- const CustomTypesSchema = z.readonly(z.array(CustomTypeLevel1Schema).check(({ value, issues }) => {
39
+ const CustomTypesSchema = z.array(CustomTypeLevel1Schema).check(({ value, issues }) => {
40
40
  const cts = value;
41
41
  const push = (message) => issues.push({
42
42
  code: "custom",
@@ -65,7 +65,7 @@ const CustomTypesSchema = z.readonly(z.array(CustomTypeLevel1Schema).check(({ va
65
65
  return;
66
66
  }
67
67
  if (strings.size > 0 && objects.size > 0) push("Cannot mix custom types as strings and objects with fields.");
68
- }));
68
+ });
69
69
  const SelectWithFallbackSchema = z.pipe(z.unknown(), z.transform((val) => {
70
70
  if (val === "media" || val === "document" || val === "web" || val === null) return val;
71
71
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"link.js","names":[],"sources":["../../src/model/link.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\n// Accepts string | string[], normalizes string to [string]\nconst MasksArrayStringSchema = z.pipe(\n\tz.union([z.array(z.string()), z.string()]),\n\tz.transform((val): readonly string[] => (typeof val === \"string\" ? [val] : val)),\n)\n\n// --- CustomTypes hierarchy (field selection in content relationship fields) ---\n\n// Level 2\n\nconst noDuplicateStrings = z.refine(\n\t(arr) => new Set(arr as string[]).size === (arr as string[]).length,\n\t\"Fields have duplicates.\",\n)\n\nconst CustomTypeLevel2FieldGroupFieldsSchema = z.readonly(\n\tz.array(z.string()).check(noDuplicateStrings),\n)\n\nconst CustomTypeLevel2FieldSchema = z.union([\n\tz.object({ id: z.string(), fields: CustomTypeLevel2FieldGroupFieldsSchema }),\n\tz.string(),\n])\n\nconst noDuplicateIds = (items: unknown) => {\n\tconst arr = items as { id: string }[] | string[]\n\tconst ids = new Set(arr.map((item) => (typeof item === \"string\" ? item : item.id)))\n\treturn ids.size === arr.length\n}\n\nconst CustomTypeLevel2FieldsSchema = z.readonly(\n\tz.array(CustomTypeLevel2FieldSchema).check(z.refine(noDuplicateIds, \"Fields have duplicates.\")),\n)\n\nconst CustomTypeLevel2Schema = z.union([\n\tz.string(),\n\tz.object({ id: z.string(), fields: CustomTypeLevel2FieldsSchema }),\n])\n\nconst CustomTypesLevel2Schema = z.readonly(\n\tz.array(CustomTypeLevel2Schema).check(z.refine(noDuplicateIds, \"Custom types have duplicates.\")),\n)\n\n// Level 1\n\nconst CustomTypeLevel1FieldCustomTypesSchema = z.object({\n\tid: z.string(),\n\tcustomtypes: CustomTypesLevel2Schema,\n})\n\nconst CustomTypeLevel1FieldGroupFieldSchema = z.union([\n\tCustomTypeLevel1FieldCustomTypesSchema,\n\tz.string(),\n])\n\nconst CustomTypeLevel1FieldGroupFieldsSchema = z.readonly(\n\tz\n\t\t.array(CustomTypeLevel1FieldGroupFieldSchema)\n\t\t.check(z.refine(noDuplicateIds, \"Fields have duplicates.\")),\n)\n\nconst CustomTypeLevel1FieldSchema = z.union([\n\tz.object({\n\t\tid: z.string(),\n\t\tfields: CustomTypeLevel1FieldGroupFieldsSchema,\n\t}),\n\tCustomTypeLevel1FieldCustomTypesSchema,\n\tz.string(),\n])\n\nconst CustomTypeLevel1FieldsSchema = z.readonly(\n\tz.array(CustomTypeLevel1FieldSchema).check(z.refine(noDuplicateIds, \"Fields have duplicates.\")),\n)\n\nconst CustomTypeLevel1Schema = z.union([\n\tz.string(),\n\tz.object({ id: z.string(), fields: CustomTypeLevel1FieldsSchema }),\n])\n\nconst CustomTypesSchema = z.readonly(\n\tz.array(CustomTypeLevel1Schema).check(({ value, issues }) => {\n\t\tconst cts = value as ({ id: string } | string)[]\n\t\tconst push = (message: string) => issues.push({ code: \"custom\", input: value, message })\n\t\tconst strings = new Set<string>()\n\t\tconst objects = new Set<string>()\n\t\tfor (const ct of cts) {\n\t\t\tlet failed = false\n\t\t\tif (typeof ct === \"string\") {\n\t\t\t\tfailed = objects.has(ct)\n\t\t\t\tstrings.add(ct)\n\t\t\t} else {\n\t\t\t\tconst { id } = ct\n\t\t\t\tfailed = strings.has(id) || objects.has(id)\n\t\t\t\tobjects.add(id)\n\t\t\t}\n\t\t\tif (failed) {\n\t\t\t\tpush(\"Custom types have duplicates.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif (objects.size > 1) {\n\t\t\tpush(\"Cannot have multiple custom types with fields selection.\")\n\t\t\treturn\n\t\t}\n\t\tif (strings.size > 0 && objects.size > 0) {\n\t\t\tpush(\"Cannot mix custom types as strings and objects with fields.\")\n\t\t}\n\t}),\n)\n\n// --- Select with fallback to null ---\n\nconst SelectWithFallbackSchema = z.pipe(\n\tz.unknown(),\n\tz.transform((val): \"media\" | \"document\" | \"web\" | null => {\n\t\tif (val === \"media\" || val === \"document\" || val === \"web\" || val === null) {\n\t\t\treturn val\n\t\t}\n\t\treturn null\n\t}),\n)\n\n// --- LinkConfig and Link ---\n\nconst LinkConfigSchema = z.object({\n\tlabel: z.nullish(z.string()),\n\tuseAsTitle: z.optional(z.boolean()),\n\tplaceholder: z.optional(z.string()),\n\tselect: z.optional(SelectWithFallbackSchema),\n\tcustomtypes: z.optional(CustomTypesSchema),\n\tmasks: z.optional(MasksArrayStringSchema),\n\ttags: z.optional(MasksArrayStringSchema),\n\tallowTargetBlank: z.optional(z.boolean()),\n\tallowText: z.optional(z.boolean()),\n\trepeat: z.optional(z.boolean()),\n\tvariants: z.optional(z.array(z.string())),\n})\n\nexport const LinkModelSchema = z.object({\n\ttype: z.literal(\"Link\"),\n\tfieldset: z.nullish(z.string()),\n\tconfig: z.optional(LinkConfigSchema),\n})\n\nexport type LinkModel = z.infer<typeof LinkModelSchema>\n"],"mappings":"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"}
1
+ {"version":3,"file":"link.js","names":[],"sources":["../../src/model/link.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\n// Accepts string | string[], normalizes string to [string]\nconst MasksArrayStringSchema = z.pipe(\n\tz.union([z.array(z.string()), z.string()]),\n\tz.transform((val): string[] => (typeof val === \"string\" ? [val] : val)),\n)\n\n// --- CustomTypes hierarchy (field selection in content relationship fields) ---\n\n// Level 2\n\nconst noDuplicateStrings = z.refine(\n\t(arr) => new Set(arr as string[]).size === (arr as string[]).length,\n\t\"Fields have duplicates.\",\n)\n\nconst CustomTypeLevel2FieldGroupFieldsSchema = z.array(z.string()).check(noDuplicateStrings)\n\nconst CustomTypeLevel2FieldSchema = z.union([\n\tz.object({ id: z.string(), fields: CustomTypeLevel2FieldGroupFieldsSchema }),\n\tz.string(),\n])\n\nconst noDuplicateIds = (items: unknown) => {\n\tconst arr = items as { id: string }[] | string[]\n\tconst ids = new Set(arr.map((item) => (typeof item === \"string\" ? item : item.id)))\n\treturn ids.size === arr.length\n}\n\nconst CustomTypeLevel2FieldsSchema = z\n\t.array(CustomTypeLevel2FieldSchema)\n\t.check(z.refine(noDuplicateIds, \"Fields have duplicates.\"))\n\nconst CustomTypeLevel2Schema = z.union([\n\tz.string(),\n\tz.object({ id: z.string(), fields: CustomTypeLevel2FieldsSchema }),\n])\n\nconst CustomTypesLevel2Schema = z\n\t.array(CustomTypeLevel2Schema)\n\t.check(z.refine(noDuplicateIds, \"Custom types have duplicates.\"))\n\n// Level 1\n\nconst CustomTypeLevel1FieldCustomTypesSchema = z.object({\n\tid: z.string(),\n\tcustomtypes: CustomTypesLevel2Schema,\n})\n\nconst CustomTypeLevel1FieldGroupFieldSchema = z.union([\n\tCustomTypeLevel1FieldCustomTypesSchema,\n\tz.string(),\n])\n\nconst CustomTypeLevel1FieldGroupFieldsSchema = z\n\t.array(CustomTypeLevel1FieldGroupFieldSchema)\n\t.check(z.refine(noDuplicateIds, \"Fields have duplicates.\"))\n\nconst CustomTypeLevel1FieldSchema = z.union([\n\tz.object({\n\t\tid: z.string(),\n\t\tfields: CustomTypeLevel1FieldGroupFieldsSchema,\n\t}),\n\tCustomTypeLevel1FieldCustomTypesSchema,\n\tz.string(),\n])\n\nconst CustomTypeLevel1FieldsSchema = z\n\t.array(CustomTypeLevel1FieldSchema)\n\t.check(z.refine(noDuplicateIds, \"Fields have duplicates.\"))\n\nconst CustomTypeLevel1Schema = z.union([\n\tz.string(),\n\tz.object({ id: z.string(), fields: CustomTypeLevel1FieldsSchema }),\n])\n\nconst CustomTypesSchema = z.array(CustomTypeLevel1Schema).check(({ value, issues }) => {\n\tconst cts = value as ({ id: string } | string)[]\n\tconst push = (message: string) => issues.push({ code: \"custom\", input: value, message })\n\tconst strings = new Set<string>()\n\tconst objects = new Set<string>()\n\tfor (const ct of cts) {\n\t\tlet failed = false\n\t\tif (typeof ct === \"string\") {\n\t\t\tfailed = objects.has(ct)\n\t\t\tstrings.add(ct)\n\t\t} else {\n\t\t\tconst { id } = ct\n\t\t\tfailed = strings.has(id) || objects.has(id)\n\t\t\tobjects.add(id)\n\t\t}\n\t\tif (failed) {\n\t\t\tpush(\"Custom types have duplicates.\")\n\t\t\treturn\n\t\t}\n\t}\n\tif (objects.size > 1) {\n\t\tpush(\"Cannot have multiple custom types with fields selection.\")\n\t\treturn\n\t}\n\tif (strings.size > 0 && objects.size > 0) {\n\t\tpush(\"Cannot mix custom types as strings and objects with fields.\")\n\t}\n})\n\n// --- Select with fallback to null ---\n\nconst SelectWithFallbackSchema = z.pipe(\n\tz.unknown(),\n\tz.transform((val): \"media\" | \"document\" | \"web\" | null => {\n\t\tif (val === \"media\" || val === \"document\" || val === \"web\" || val === null) {\n\t\t\treturn val\n\t\t}\n\t\treturn null\n\t}),\n)\n\n// --- LinkConfig and Link ---\n\nconst LinkConfigSchema = z.object({\n\tlabel: z.nullish(z.string()),\n\tuseAsTitle: z.optional(z.boolean()),\n\tplaceholder: z.optional(z.string()),\n\tselect: z.optional(SelectWithFallbackSchema),\n\tcustomtypes: z.optional(CustomTypesSchema),\n\tmasks: z.optional(MasksArrayStringSchema),\n\ttags: z.optional(MasksArrayStringSchema),\n\tallowTargetBlank: z.optional(z.boolean()),\n\tallowText: z.optional(z.boolean()),\n\trepeat: z.optional(z.boolean()),\n\tvariants: z.optional(z.array(z.string())),\n})\n\nexport const LinkModelSchema = z.object({\n\ttype: z.literal(\"Link\"),\n\tfieldset: z.nullish(z.string()),\n\tconfig: z.optional(LinkConfigSchema),\n})\n\nexport type LinkModel = z.infer<typeof LinkModelSchema>\n"],"mappings":"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"}
@@ -1,184 +1,23 @@
1
+ import { BooleanModel } from "./boolean.js";
2
+ import { ColorModel } from "./color.js";
3
+ import { DateModel } from "./date.js";
4
+ import { EmbedModel } from "./embed.js";
5
+ import { GeoPointModel } from "./geopoint.js";
6
+ import { ImageModel } from "./image.js";
7
+ import { IntegrationFieldModel } from "./integrationField.js";
8
+ import { LinkModel } from "./link.js";
9
+ import { NumberModel } from "./number.js";
10
+ import { RangeModel } from "./range.js";
11
+ import { RichTextModel } from "./richText.js";
12
+ import { SelectModel } from "./select.js";
13
+ import { SeparatorModel } from "./separator.js";
14
+ import { TableModel } from "./table.js";
15
+ import { TextModel } from "./text.js";
16
+ import { TimestampModel } from "./timestamp.js";
1
17
  import { z } from "zod/mini";
2
18
 
3
19
  //#region src/model/nestable.d.ts
4
- declare const NestableModelSchema: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
5
- type: z.ZodMiniLiteral<"Boolean">;
6
- config: z.ZodMiniOptional<z.ZodMiniObject<{
7
- label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
8
- default_value: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
9
- placeholder_true: z.ZodMiniOptional<z.ZodMiniString<string>>;
10
- placeholder_false: z.ZodMiniOptional<z.ZodMiniString<string>>;
11
- }, z.core.$strip>>;
12
- }, z.core.$strip>, z.ZodMiniObject<{
13
- type: z.ZodMiniLiteral<"Color">;
14
- fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
15
- config: z.ZodMiniOptional<z.ZodMiniObject<{
16
- label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
17
- placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
18
- }, z.core.$strip>>;
19
- }, z.core.$strip>, z.ZodMiniObject<{
20
- type: z.ZodMiniLiteral<"Date">;
21
- fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
22
- config: z.ZodMiniOptional<z.ZodMiniObject<{
23
- label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
24
- placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
25
- default: z.ZodMiniOptional<z.ZodMiniString<string>>;
26
- }, z.core.$strip>>;
27
- }, z.core.$strip>, z.ZodMiniObject<{
28
- type: z.ZodMiniLiteral<"Embed">;
29
- fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
30
- config: z.ZodMiniOptional<z.ZodMiniObject<{
31
- label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
32
- placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
33
- useAsTitle: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
34
- }, z.core.$strip>>;
35
- }, z.core.$strip>, z.ZodMiniObject<{
36
- type: z.ZodMiniLiteral<"GeoPoint">;
37
- fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
38
- config: z.ZodMiniOptional<z.ZodMiniObject<{
39
- label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
40
- }, z.core.$strip>>;
41
- }, z.core.$strip>, z.ZodMiniObject<{
42
- type: z.ZodMiniLiteral<"Image">;
43
- fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
44
- config: z.ZodMiniOptional<z.ZodMiniObject<{
45
- label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
46
- placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
47
- constraint: z.ZodMiniOptional<z.ZodMiniObject<{
48
- width: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniLiteral<"auto">, z.ZodMiniTransform<null, "auto">>, z.ZodMiniPipe<z.ZodMiniLiteral<"">, z.ZodMiniTransform<null, "">>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
49
- height: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniLiteral<"auto">, z.ZodMiniTransform<null, "auto">>, z.ZodMiniPipe<z.ZodMiniLiteral<"">, z.ZodMiniTransform<null, "">>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
50
- }, z.core.$strip>>;
51
- thumbnails: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
52
- name: z.ZodMiniString<string>;
53
- width: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniLiteral<"auto">, z.ZodMiniTransform<null, "auto">>, z.ZodMiniPipe<z.ZodMiniLiteral<"">, z.ZodMiniTransform<null, "">>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
54
- height: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniLiteral<"auto">, z.ZodMiniTransform<null, "auto">>, z.ZodMiniPipe<z.ZodMiniLiteral<"">, z.ZodMiniTransform<null, "">>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
55
- }, z.core.$strip>>>;
56
- }, z.core.$strip>>;
57
- }, z.core.$strip>, z.ZodMiniObject<{
58
- type: z.ZodMiniLiteral<"IntegrationFields">;
59
- fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
60
- config: z.ZodMiniOptional<z.ZodMiniObject<{
61
- label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
62
- placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
63
- catalog: z.ZodMiniOptional<z.ZodMiniString<string>>;
64
- }, z.core.$strip>>;
65
- }, z.core.$strip>, z.ZodMiniObject<{
66
- type: z.ZodMiniLiteral<"Link">;
67
- fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
68
- config: z.ZodMiniOptional<z.ZodMiniObject<{
69
- label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
70
- useAsTitle: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
71
- placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
72
- select: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnknown, z.ZodMiniTransform<"media" | "document" | "web" | null, unknown>>>;
73
- customtypes: z.ZodMiniOptional<z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
74
- id: z.ZodMiniString<string>;
75
- fields: z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
76
- id: z.ZodMiniString<string>;
77
- fields: z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
78
- id: z.ZodMiniString<string>;
79
- customtypes: z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
80
- id: z.ZodMiniString<string>;
81
- fields: z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
82
- id: z.ZodMiniString<string>;
83
- fields: z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniString<string>>>;
84
- }, z.core.$strip>, z.ZodMiniString<string>]>>>;
85
- }, z.core.$strip>]>>>;
86
- }, z.core.$strip>, z.ZodMiniString<string>]>>>;
87
- }, z.core.$strip>, z.ZodMiniObject<{
88
- id: z.ZodMiniString<string>;
89
- customtypes: z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniObject<{
90
- id: z.ZodMiniString<string>;
91
- fields: z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
92
- id: z.ZodMiniString<string>;
93
- fields: z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniString<string>>>;
94
- }, z.core.$strip>, z.ZodMiniString<string>]>>>;
95
- }, z.core.$strip>]>>>;
96
- }, z.core.$strip>, z.ZodMiniString<string>]>>>;
97
- }, z.core.$strip>]>>>>;
98
- masks: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<readonly string[], string | string[]>>>;
99
- tags: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniString<string>]>, z.ZodMiniTransform<readonly string[], string | string[]>>>;
100
- allowTargetBlank: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
101
- allowText: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
102
- repeat: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
103
- variants: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
104
- }, z.core.$strip>>;
105
- }, z.core.$strip>, z.ZodMiniObject<{
106
- type: z.ZodMiniLiteral<"Number">;
107
- fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
108
- config: z.ZodMiniOptional<z.ZodMiniObject<{
109
- label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
110
- placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
111
- min: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
112
- max: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
113
- step: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
114
- }, z.core.$strip>>;
115
- }, z.core.$strip>, z.ZodMiniObject<{
116
- type: z.ZodMiniLiteral<"Range">;
117
- fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
118
- config: z.ZodMiniOptional<z.ZodMiniObject<{
119
- label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
120
- placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
121
- min: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
122
- max: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
123
- step: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
124
- }, z.core.$strip>>;
125
- }, z.core.$strip>, z.ZodMiniObject<{
126
- type: z.ZodMiniLiteral<"StructuredText">;
127
- fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
128
- config: z.ZodMiniOptional<z.ZodMiniObject<{
129
- label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
130
- placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
131
- useAsTitle: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
132
- single: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNull]>, z.ZodMiniTransform<string, string | null>>>;
133
- multi: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNull]>, z.ZodMiniTransform<string, string | null>>>;
134
- imageConstraint: z.ZodMiniOptional<z.ZodMiniObject<{
135
- width: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniLiteral<"auto">, z.ZodMiniTransform<null, "auto">>, z.ZodMiniPipe<z.ZodMiniLiteral<"">, z.ZodMiniTransform<null, "">>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
136
- height: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniLiteral<"auto">, z.ZodMiniTransform<null, "auto">>, z.ZodMiniPipe<z.ZodMiniLiteral<"">, z.ZodMiniTransform<null, "">>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
137
- }, z.core.$strip>>;
138
- labels: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniNull, z.ZodMiniTransform<string[], null>>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<string[], string>>, z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniPipe<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniObject<{
139
- name: z.ZodMiniString<string>;
140
- }, z.core.$strip>>>, z.ZodMiniTransform<string[], Record<string, {
141
- name: string;
142
- }[]>>>]>, z.ZodMiniTransform<readonly string[], string[]>>>;
143
- allowTargetBlank: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
144
- }, z.core.$strip>>;
145
- }, z.core.$strip>, z.ZodMiniObject<{
146
- type: z.ZodMiniLiteral<"Select">;
147
- fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
148
- config: z.ZodMiniOptional<z.ZodMiniObject<{
149
- label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
150
- placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
151
- default_value: z.ZodMiniOptional<z.ZodMiniString<string>>;
152
- options: z.ZodMiniOptional<z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniPipe<z.ZodMiniNumber<number>, z.ZodMiniTransform<string, number>>, z.ZodMiniPipe<z.ZodMiniBoolean<boolean>, z.ZodMiniTransform<string, boolean>>]>>>>;
153
- }, z.core.$strip>>;
154
- }, z.core.$strip>, z.ZodMiniObject<{
155
- type: z.ZodMiniLiteral<"Separator">;
156
- config: z.ZodMiniOptional<z.ZodMiniObject<{
157
- label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
158
- }, z.core.$strip>>;
159
- }, z.core.$strip>, z.ZodMiniObject<{
160
- type: z.ZodMiniLiteral<"Table">;
161
- config: z.ZodMiniOptional<z.ZodMiniObject<{
162
- label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
163
- }, z.core.$strip>>;
164
- }, z.core.$strip>, z.ZodMiniObject<{
165
- type: z.ZodMiniLiteral<"Text">;
166
- fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
167
- config: z.ZodMiniOptional<z.ZodMiniObject<{
168
- label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
169
- useAsTitle: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
170
- placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
171
- }, z.core.$strip>>;
172
- }, z.core.$strip>, z.ZodMiniObject<{
173
- type: z.ZodMiniLiteral<"Timestamp">;
174
- fieldset: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
175
- config: z.ZodMiniOptional<z.ZodMiniObject<{
176
- label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
177
- placeholder: z.ZodMiniOptional<z.ZodMiniString<string>>;
178
- default: z.ZodMiniOptional<z.ZodMiniString<string>>;
179
- }, z.core.$strip>>;
180
- }, z.core.$strip>]>;
181
- type NestableModel = z.infer<typeof NestableModelSchema>;
20
+ type NestableModel = BooleanModel | ColorModel | DateModel | EmbedModel | GeoPointModel | ImageModel | IntegrationFieldModel | LinkModel | NumberModel | RangeModel | RichTextModel | SelectModel | SeparatorModel | TableModel | TextModel | TimestampModel;
182
21
  //#endregion
183
22
  export { NestableModel };
184
23
  //# sourceMappingURL=nestable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nestable.d.ts","names":[],"sources":["../../src/model/nestable.ts"],"mappings":";;;cAmBa,mBAAA,EAAmB,CAAA,CAAA,YAAA,WAAA,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmBpB,aAAA,GAAgB,CAAA,CAAE,KAAA,QAAa,mBAAA"}
1
+ {"version":3,"file":"nestable.d.ts","names":[],"sources":["../../src/model/nestable.ts"],"mappings":";;;;;;;;;;;;;;;;;;;KAsDY,aAAA,GACT,YAAA,GACA,UAAA,GACA,SAAA,GACA,UAAA,GACA,aAAA,GACA,UAAA,GACA,qBAAA,GACA,SAAA,GACA,WAAA,GACA,UAAA,GACA,aAAA,GACA,WAAA,GACA,cAAA,GACA,UAAA,GACA,SAAA,GACA,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"nestable.js","names":[],"sources":["../../src/model/nestable.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { BooleanModelSchema } from \"./boolean\"\nimport { ColorModelSchema } from \"./color\"\nimport { DateModelSchema } from \"./date\"\nimport { EmbedModelSchema } from \"./embed\"\nimport { GeoPointModelSchema } from \"./geopoint\"\nimport { ImageModelSchema } from \"./image\"\nimport { IntegrationFieldModelSchema } from \"./integrationField\"\nimport { LinkModelSchema } from \"./link\"\nimport { NumberModelSchema } from \"./number\"\nimport { RangeModelSchema } from \"./range\"\nimport { RichTextModelSchema } from \"./richText\"\nimport { SelectModelSchema } from \"./select\"\nimport { SeparatorModelSchema } from \"./separator\"\nimport { TableModelSchema } from \"./table\"\nimport { TextModelSchema } from \"./text\"\nimport { TimestampModelSchema } from \"./timestamp\"\n\nexport const NestableModelSchema = z.union([\n\tBooleanModelSchema,\n\tColorModelSchema,\n\tDateModelSchema,\n\tEmbedModelSchema,\n\tGeoPointModelSchema,\n\tImageModelSchema,\n\tIntegrationFieldModelSchema,\n\tLinkModelSchema,\n\tNumberModelSchema,\n\tRangeModelSchema,\n\tRichTextModelSchema,\n\tSelectModelSchema,\n\tSeparatorModelSchema,\n\tTableModelSchema,\n\tTextModelSchema,\n\tTimestampModelSchema,\n])\n\nexport type NestableModel = z.infer<typeof NestableModelSchema>\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAa,sBAAsB,EAAE,MAAM;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC"}
1
+ {"version":3,"file":"nestable.js","names":[],"sources":["../../src/model/nestable.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport type { BooleanModel } from \"./boolean\"\nimport { BooleanModelSchema } from \"./boolean\"\nimport type { ColorModel } from \"./color\"\nimport { ColorModelSchema } from \"./color\"\nimport type { DateModel } from \"./date\"\nimport { DateModelSchema } from \"./date\"\nimport type { EmbedModel } from \"./embed\"\nimport { EmbedModelSchema } from \"./embed\"\nimport type { GeoPointModel } from \"./geopoint\"\nimport { GeoPointModelSchema } from \"./geopoint\"\nimport type { ImageModel } from \"./image\"\nimport { ImageModelSchema } from \"./image\"\nimport type { IntegrationFieldModel } from \"./integrationField\"\nimport { IntegrationFieldModelSchema } from \"./integrationField\"\nimport type { LinkModel } from \"./link\"\nimport { LinkModelSchema } from \"./link\"\nimport type { NumberModel } from \"./number\"\nimport { NumberModelSchema } from \"./number\"\nimport type { RangeModel } from \"./range\"\nimport { RangeModelSchema } from \"./range\"\nimport type { RichTextModel } from \"./richText\"\nimport { RichTextModelSchema } from \"./richText\"\nimport type { SelectModel } from \"./select\"\nimport { SelectModelSchema } from \"./select\"\nimport type { SeparatorModel } from \"./separator\"\nimport { SeparatorModelSchema } from \"./separator\"\nimport type { TableModel } from \"./table\"\nimport { TableModelSchema } from \"./table\"\nimport type { TextModel } from \"./text\"\nimport { TextModelSchema } from \"./text\"\nimport type { TimestampModel } from \"./timestamp\"\nimport { TimestampModelSchema } from \"./timestamp\"\n\nexport const NestableModelSchema = z.union([\n\tBooleanModelSchema,\n\tColorModelSchema,\n\tDateModelSchema,\n\tEmbedModelSchema,\n\tGeoPointModelSchema,\n\tImageModelSchema,\n\tIntegrationFieldModelSchema,\n\tLinkModelSchema,\n\tNumberModelSchema,\n\tRangeModelSchema,\n\tRichTextModelSchema,\n\tSelectModelSchema,\n\tSeparatorModelSchema,\n\tTableModelSchema,\n\tTextModelSchema,\n\tTimestampModelSchema,\n])\n\nexport type NestableModel =\n\t| BooleanModel\n\t| ColorModel\n\t| DateModel\n\t| EmbedModel\n\t| GeoPointModel\n\t| ImageModel\n\t| IntegrationFieldModel\n\t| LinkModel\n\t| NumberModel\n\t| RangeModel\n\t| RichTextModel\n\t| SelectModel\n\t| SeparatorModel\n\t| TableModel\n\t| TextModel\n\t| TimestampModel\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmCA,MAAa,sBAAsB,EAAE,MAAM;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC"}
@@ -11,14 +11,10 @@ declare const RichTextModelSchema: z.ZodMiniObject<{
11
11
  single: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNull]>, z.ZodMiniTransform<string, string | null>>>;
12
12
  multi: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNull]>, z.ZodMiniTransform<string, string | null>>>;
13
13
  imageConstraint: z.ZodMiniOptional<z.ZodMiniObject<{
14
- width: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniLiteral<"auto">, z.ZodMiniTransform<null, "auto">>, z.ZodMiniPipe<z.ZodMiniLiteral<"">, z.ZodMiniTransform<null, "">>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
15
- height: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniLiteral<"auto">, z.ZodMiniTransform<null, "auto">>, z.ZodMiniPipe<z.ZodMiniLiteral<"">, z.ZodMiniTransform<null, "">>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<number, string>>]>>;
14
+ width: z.ZodMiniOptional<z.ZodMiniType<number | null, unknown, z.core.$ZodTypeInternals<number | null, unknown>>>;
15
+ height: z.ZodMiniOptional<z.ZodMiniType<number | null, unknown, z.core.$ZodTypeInternals<number | null, unknown>>>;
16
16
  }, z.core.$strip>>;
17
- labels: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniNull, z.ZodMiniTransform<string[], null>>, z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<string[], string>>, z.ZodMiniArray<z.ZodMiniString<string>>, z.ZodMiniPipe<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniObject<{
18
- name: z.ZodMiniString<string>;
19
- }, z.core.$strip>>>, z.ZodMiniTransform<string[], Record<string, {
20
- name: string;
21
- }[]>>>]>, z.ZodMiniTransform<readonly string[], string[]>>>;
17
+ labels: z.ZodMiniOptional<z.ZodMiniType<string[], unknown, z.core.$ZodTypeInternals<string[], unknown>>>;
22
18
  allowTargetBlank: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
23
19
  }, z.core.$strip>>;
24
20
  }, z.core.$strip>;
@@ -1 +1 @@
1
- {"version":3,"file":"richText.d.ts","names":[],"sources":["../../src/model/richText.ts"],"mappings":";;;cAmGa,mBAAA,EAAmB,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;KAMpB,aAAA,GAAgB,CAAA,CAAE,KAAA,QAAa,mBAAA"}
1
+ {"version":3,"file":"richText.d.ts","names":[],"sources":["../../src/model/richText.ts"],"mappings":";;;cAmGa,mBAAA,EAAmB,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;KAMpB,aAAA,GAAgB,CAAA,CAAE,KAAA,QAAa,mBAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"richText.js","names":[],"sources":["../../src/model/richText.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { ImageConstraintSchema } from \"./image\"\n\nexport const RichTextFieldType = \"StructuredText\"\n\nexport const DEFAULT_OPTION = \"paragraph\"\n\nexport const RichTextNodeType = {\n\theading1: \"heading1\",\n\theading2: \"heading2\",\n\theading3: \"heading3\",\n\theading4: \"heading4\",\n\theading5: \"heading5\",\n\theading6: \"heading6\",\n\tparagraph: \"paragraph\",\n\tpreformatted: \"preformatted\",\n\torderedList: \"o-list-item\",\n\tlist: \"list-item\",\n\timage: \"image\",\n\tembed: \"embed\",\n\thyperlink: \"hyperlink\",\n\tstrong: \"strong\",\n\tem: \"em\",\n\trtl: \"rtl\",\n} as const\n\nconst VALID_NODE_TYPES = Object.values(RichTextNodeType)\n\n/**\n * RichTextOptions parses comma-separated node types, filters invalid ones,\n * and defaults to \"paragraph\" if empty or null.\n */\nconst RichTextOptionsSchema = z.pipe(\n\tz.union([z.string(), z.null()]),\n\tz.transform((s: string | null) => {\n\t\tif (!s) return DEFAULT_OPTION\n\t\tconst entries = s.split(\",\").map((e: string) => e.trim())\n\t\tconst filtered = entries.filter((e: string) =>\n\t\t\tVALID_NODE_TYPES.includes(e as (typeof VALID_NODE_TYPES)[number]),\n\t\t)\n\t\treturn filtered.length ? filtered.join(\",\") : DEFAULT_OPTION\n\t}),\n)\n\n/**\n * RichTextLabels accepts multiple formats and normalizes to string[]:\n * - null → []\n * - \"label\" → [\"label\"]\n * - [\"a\", \"b\"] → [\"a\", \"b\"]\n * - { \"\": [{name: \"a\"}], \"key\": [{name: \"b\"}] } → [\"a\", \"b\"] (legacy format)\n */\nconst LegacyLabelsFormat = z.record(z.string(), z.array(z.object({ name: z.string() })))\n\nconst RichTextLabelsSchema = z.pipe(\n\tz.union([\n\t\tz.pipe(\n\t\t\tz.null(),\n\t\t\tz.transform(() => [] as string[]),\n\t\t),\n\t\tz.pipe(\n\t\t\tz.string(),\n\t\t\tz.transform((s: string) => [s]),\n\t\t),\n\t\tz.array(z.string()),\n\t\tz.pipe(\n\t\t\tLegacyLabelsFormat,\n\t\t\tz.transform((obj: Record<string, Array<{ name: string }>>) => {\n\t\t\t\tconst entries = Object.entries(obj)\n\t\t\t\tif (!entries.length) return [] as string[]\n\n\t\t\t\t// Handle legacy format with empty key\n\t\t\t\tif (obj[\"\"]) {\n\t\t\t\t\treturn obj[\"\"].map((l: { name: string }) => l.name)\n\t\t\t\t}\n\n\t\t\t\t// Convert all entries to flat array of names\n\t\t\t\treturn entries\n\t\t\t\t\t.reduce<string[]>((acc, [, labelsEntries]) => {\n\t\t\t\t\t\treturn acc.concat(labelsEntries.map((l: { name: string }) => l.name))\n\t\t\t\t\t}, [])\n\t\t\t\t\t.filter(Boolean)\n\t\t\t}),\n\t\t),\n\t]),\n\tz.transform((result: string[]) => result as readonly string[]),\n)\n\nconst RichTextConfigSchema = z.object({\n\tlabel: z.nullish(z.string()),\n\tplaceholder: z.optional(z.string()),\n\tuseAsTitle: z.optional(z.boolean()),\n\tsingle: z.optional(RichTextOptionsSchema),\n\tmulti: z.optional(RichTextOptionsSchema),\n\timageConstraint: z.optional(ImageConstraintSchema),\n\tlabels: z.optional(RichTextLabelsSchema),\n\tallowTargetBlank: z.optional(z.boolean()),\n})\n\nexport const RichTextModelSchema = z.object({\n\ttype: z.literal(RichTextFieldType),\n\tfieldset: z.nullish(z.string()),\n\tconfig: z.optional(RichTextConfigSchema),\n})\n\nexport type RichTextModel = z.infer<typeof RichTextModelSchema>\n"],"mappings":";;;AAIA,MAAa,oBAAoB;AAEjC,MAAa,iBAAiB;AAqB9B,MAAM,mBAAmB,OAAO,OAnBA;CAC/B,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,WAAW;CACX,cAAc;CACd,aAAa;CACb,MAAM;CACN,OAAO;CACP,OAAO;CACP,WAAW;CACX,QAAQ;CACR,IAAI;CACJ,KAAK;CACL,CAEuD;;;;;AAMxD,MAAM,wBAAwB,EAAE,KAC/B,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC,EAC/B,EAAE,WAAW,MAAqB;AACjC,KAAI,CAAC,EAAG,QAAO;CAEf,MAAM,WADU,EAAE,MAAM,IAAI,CAAC,KAAK,MAAc,EAAE,MAAM,CAAC,CAChC,QAAQ,MAChC,iBAAiB,SAAS,EAAuC,CACjE;AACD,QAAO,SAAS,SAAS,SAAS,KAAK,IAAI,GAAG;EAC7C,CACF;;;;;;;;AASD,MAAM,qBAAqB,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;AAExF,MAAM,uBAAuB,EAAE,KAC9B,EAAE,MAAM;CACP,EAAE,KACD,EAAE,MAAM,EACR,EAAE,gBAAgB,EAAE,CAAa,CACjC;CACD,EAAE,KACD,EAAE,QAAQ,EACV,EAAE,WAAW,MAAc,CAAC,EAAE,CAAC,CAC/B;CACD,EAAE,MAAM,EAAE,QAAQ,CAAC;CACnB,EAAE,KACD,oBACA,EAAE,WAAW,QAAiD;EAC7D,MAAM,UAAU,OAAO,QAAQ,IAAI;AACnC,MAAI,CAAC,QAAQ,OAAQ,QAAO,EAAE;AAG9B,MAAI,IAAI,IACP,QAAO,IAAI,IAAI,KAAK,MAAwB,EAAE,KAAK;AAIpD,SAAO,QACL,QAAkB,KAAK,GAAG,mBAAmB;AAC7C,UAAO,IAAI,OAAO,cAAc,KAAK,MAAwB,EAAE,KAAK,CAAC;KACnE,EAAE,CAAC,CACL,OAAO,QAAQ;GAChB,CACF;CACD,CAAC,EACF,EAAE,WAAW,WAAqB,OAA4B,CAC9D;AAED,MAAM,uBAAuB,EAAE,OAAO;CACrC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC5B,aAAa,EAAE,SAAS,EAAE,QAAQ,CAAC;CACnC,YAAY,EAAE,SAAS,EAAE,SAAS,CAAC;CACnC,QAAQ,EAAE,SAAS,sBAAsB;CACzC,OAAO,EAAE,SAAS,sBAAsB;CACxC,iBAAiB,EAAE,SAAS,sBAAsB;CAClD,QAAQ,EAAE,SAAS,qBAAqB;CACxC,kBAAkB,EAAE,SAAS,EAAE,SAAS,CAAC;CACzC,CAAC;AAEF,MAAa,sBAAsB,EAAE,OAAO;CAC3C,MAAM,EAAE,QAAQ,kBAAkB;CAClC,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC/B,QAAQ,EAAE,SAAS,qBAAqB;CACxC,CAAC"}
1
+ {"version":3,"file":"richText.js","names":[],"sources":["../../src/model/richText.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { ImageConstraintSchema } from \"./image\"\n\nexport const RichTextFieldType = \"StructuredText\"\n\nexport const DEFAULT_OPTION = \"paragraph\"\n\nexport const RichTextNodeType = {\n\theading1: \"heading1\",\n\theading2: \"heading2\",\n\theading3: \"heading3\",\n\theading4: \"heading4\",\n\theading5: \"heading5\",\n\theading6: \"heading6\",\n\tparagraph: \"paragraph\",\n\tpreformatted: \"preformatted\",\n\torderedList: \"o-list-item\",\n\tlist: \"list-item\",\n\timage: \"image\",\n\tembed: \"embed\",\n\thyperlink: \"hyperlink\",\n\tstrong: \"strong\",\n\tem: \"em\",\n\trtl: \"rtl\",\n} as const\n\nconst VALID_NODE_TYPES = Object.values(RichTextNodeType)\n\n/**\n * RichTextOptions parses comma-separated node types, filters invalid ones,\n * and defaults to \"paragraph\" if empty or null.\n */\nconst RichTextOptionsSchema = z.pipe(\n\tz.union([z.string(), z.null()]),\n\tz.transform((s: string | null) => {\n\t\tif (!s) return DEFAULT_OPTION\n\t\tconst entries = s.split(\",\").map((e: string) => e.trim())\n\t\tconst filtered = entries.filter((e: string) =>\n\t\t\tVALID_NODE_TYPES.includes(e as (typeof VALID_NODE_TYPES)[number]),\n\t\t)\n\t\treturn filtered.length ? filtered.join(\",\") : DEFAULT_OPTION\n\t}),\n)\n\n/**\n * RichTextLabels accepts multiple formats and normalizes to string[]:\n * - null → []\n * - \"label\" → [\"label\"]\n * - [\"a\", \"b\"] → [\"a\", \"b\"]\n * - { \"\": [{name: \"a\"}], \"key\": [{name: \"b\"}] } → [\"a\", \"b\"] (legacy format)\n */\nconst LegacyLabelsFormat = z.record(z.string(), z.array(z.object({ name: z.string() })))\n\nconst RichTextLabelsSchema: z.ZodMiniType<string[]> = z.pipe(\n\tz.union([\n\t\tz.pipe(\n\t\t\tz.null(),\n\t\t\tz.transform(() => [] as string[]),\n\t\t),\n\t\tz.pipe(\n\t\t\tz.string(),\n\t\t\tz.transform((s: string) => [s]),\n\t\t),\n\t\tz.array(z.string()),\n\t\tz.pipe(\n\t\t\tLegacyLabelsFormat,\n\t\t\tz.transform((obj: Record<string, Array<{ name: string }>>) => {\n\t\t\t\tconst entries = Object.entries(obj)\n\t\t\t\tif (!entries.length) return [] as string[]\n\n\t\t\t\t// Handle legacy format with empty key\n\t\t\t\tif (obj[\"\"]) {\n\t\t\t\t\treturn obj[\"\"].map((l: { name: string }) => l.name)\n\t\t\t\t}\n\n\t\t\t\t// Convert all entries to flat array of names\n\t\t\t\treturn entries\n\t\t\t\t\t.reduce<string[]>((acc, [, labelsEntries]) => {\n\t\t\t\t\t\treturn acc.concat(labelsEntries.map((l: { name: string }) => l.name))\n\t\t\t\t\t}, [])\n\t\t\t\t\t.filter(Boolean)\n\t\t\t}),\n\t\t),\n\t]),\n\tz.transform((result: string[]) => result as string[]),\n)\n\nconst RichTextConfigSchema = z.object({\n\tlabel: z.nullish(z.string()),\n\tplaceholder: z.optional(z.string()),\n\tuseAsTitle: z.optional(z.boolean()),\n\tsingle: z.optional(RichTextOptionsSchema),\n\tmulti: z.optional(RichTextOptionsSchema),\n\timageConstraint: z.optional(ImageConstraintSchema),\n\tlabels: z.optional(RichTextLabelsSchema),\n\tallowTargetBlank: z.optional(z.boolean()),\n})\n\nexport const RichTextModelSchema = z.object({\n\ttype: z.literal(RichTextFieldType),\n\tfieldset: z.nullish(z.string()),\n\tconfig: z.optional(RichTextConfigSchema),\n})\n\nexport type RichTextModel = z.infer<typeof RichTextModelSchema>\n"],"mappings":";;;AAIA,MAAa,oBAAoB;AAEjC,MAAa,iBAAiB;AAqB9B,MAAM,mBAAmB,OAAO,OAnBA;CAC/B,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,WAAW;CACX,cAAc;CACd,aAAa;CACb,MAAM;CACN,OAAO;CACP,OAAO;CACP,WAAW;CACX,QAAQ;CACR,IAAI;CACJ,KAAK;CACL,CAEuD;;;;;AAMxD,MAAM,wBAAwB,EAAE,KAC/B,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC,EAC/B,EAAE,WAAW,MAAqB;AACjC,KAAI,CAAC,EAAG,QAAO;CAEf,MAAM,WADU,EAAE,MAAM,IAAI,CAAC,KAAK,MAAc,EAAE,MAAM,CAAC,CAChC,QAAQ,MAChC,iBAAiB,SAAS,EAAuC,CACjE;AACD,QAAO,SAAS,SAAS,SAAS,KAAK,IAAI,GAAG;EAC7C,CACF;;;;;;;;AASD,MAAM,qBAAqB,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;AAExF,MAAM,uBAAgD,EAAE,KACvD,EAAE,MAAM;CACP,EAAE,KACD,EAAE,MAAM,EACR,EAAE,gBAAgB,EAAE,CAAa,CACjC;CACD,EAAE,KACD,EAAE,QAAQ,EACV,EAAE,WAAW,MAAc,CAAC,EAAE,CAAC,CAC/B;CACD,EAAE,MAAM,EAAE,QAAQ,CAAC;CACnB,EAAE,KACD,oBACA,EAAE,WAAW,QAAiD;EAC7D,MAAM,UAAU,OAAO,QAAQ,IAAI;AACnC,MAAI,CAAC,QAAQ,OAAQ,QAAO,EAAE;AAG9B,MAAI,IAAI,IACP,QAAO,IAAI,IAAI,KAAK,MAAwB,EAAE,KAAK;AAIpD,SAAO,QACL,QAAkB,KAAK,GAAG,mBAAmB;AAC7C,UAAO,IAAI,OAAO,cAAc,KAAK,MAAwB,EAAE,KAAK,CAAC;KACnE,EAAE,CAAC,CACL,OAAO,QAAQ;GAChB,CACF;CACD,CAAC,EACF,EAAE,WAAW,WAAqB,OAAmB,CACrD;AAED,MAAM,uBAAuB,EAAE,OAAO;CACrC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC5B,aAAa,EAAE,SAAS,EAAE,QAAQ,CAAC;CACnC,YAAY,EAAE,SAAS,EAAE,SAAS,CAAC;CACnC,QAAQ,EAAE,SAAS,sBAAsB;CACzC,OAAO,EAAE,SAAS,sBAAsB;CACxC,iBAAiB,EAAE,SAAS,sBAAsB;CAClD,QAAQ,EAAE,SAAS,qBAAqB;CACxC,kBAAkB,EAAE,SAAS,EAAE,SAAS,CAAC;CACzC,CAAC;AAEF,MAAa,sBAAsB,EAAE,OAAO;CAC3C,MAAM,EAAE,QAAQ,kBAAkB;CAClC,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC/B,QAAQ,EAAE,SAAS,qBAAqB;CACxC,CAAC"}