@seatmap-fyi/map-domain 0.1.0-alpha.3 → 0.1.0-alpha.48

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 (109) hide show
  1. package/dist/arc-fan-rebuild.d.ts +13 -0
  2. package/dist/arc-fan-rebuild.js +163 -0
  3. package/dist/arc-fan.d.ts +27 -0
  4. package/dist/arc-fan.interface.d.ts +83 -0
  5. package/dist/arc-fan.interface.js +30 -0
  6. package/dist/arc-fan.js +182 -0
  7. package/dist/catalog.d.ts +10 -3
  8. package/dist/catalog.js +66 -10
  9. package/dist/categories.d.ts +27 -0
  10. package/dist/categories.js +217 -0
  11. package/dist/editor-state.d.ts +4 -1
  12. package/dist/editor-state.js +61 -31
  13. package/dist/floors.d.ts +22 -0
  14. package/dist/floors.js +77 -0
  15. package/dist/geometry/boundary.d.ts +1 -1
  16. package/dist/geometry/boundary.js +16 -12
  17. package/dist/geometry/curve-warnings.d.ts +1 -1
  18. package/dist/geometry/curve-warnings.js +3 -5
  19. package/dist/geometry/decoration-bounds.d.ts +4 -0
  20. package/dist/geometry/decoration-bounds.js +42 -0
  21. package/dist/geometry/ellipse.js +4 -12
  22. package/dist/geometry/geometry.d.ts +12 -3
  23. package/dist/geometry/geometry.js +37 -28
  24. package/dist/geometry/layout-transform.d.ts +10 -0
  25. package/dist/geometry/layout-transform.interface.d.ts +6 -0
  26. package/dist/geometry/layout-transform.interface.js +1 -0
  27. package/dist/geometry/layout-transform.js +206 -0
  28. package/dist/geometry/polygon-curves.d.ts +17 -0
  29. package/dist/geometry/polygon-curves.interface.d.ts +21 -0
  30. package/dist/geometry/polygon-curves.interface.js +5 -0
  31. package/dist/geometry/polygon-curves.js +169 -0
  32. package/dist/geometry/primitives.d.ts +1 -1
  33. package/dist/geometry/primitives.js +2 -3
  34. package/dist/geometry/seat-shape.d.ts +24 -0
  35. package/dist/geometry/seat-shape.js +101 -0
  36. package/dist/geometry/seating-layout.d.ts +20 -3
  37. package/dist/geometry/seating-layout.js +113 -19
  38. package/dist/geometry/units.d.ts +8 -0
  39. package/dist/geometry/units.js +13 -0
  40. package/dist/geometry/venue-outline.d.ts +4 -18
  41. package/dist/geometry/venue-outline.interface.d.ts +23 -0
  42. package/dist/geometry/venue-outline.interface.js +7 -0
  43. package/dist/geometry/venue-outline.js +107 -49
  44. package/dist/identity.d.ts +3 -1
  45. package/dist/identity.js +32 -9
  46. package/dist/issues.d.ts +15 -2
  47. package/dist/issues.js +16 -6
  48. package/dist/labels.d.ts +12 -1
  49. package/dist/labels.js +76 -11
  50. package/dist/layers.d.ts +26 -0
  51. package/dist/layers.js +86 -0
  52. package/dist/media.d.ts +27 -0
  53. package/dist/media.js +89 -0
  54. package/dist/physical-document.interface.d.ts +592 -0
  55. package/dist/physical-document.interface.js +179 -0
  56. package/dist/preview.d.ts +1 -1
  57. package/dist/preview.js +70 -25
  58. package/dist/reference.js +1 -1
  59. package/dist/row-segments.d.ts +30 -0
  60. package/dist/row-segments.js +113 -0
  61. package/dist/schema.d.ts +1578 -68
  62. package/dist/schema.js +467 -98
  63. package/dist/seat-proximity.d.ts +4 -0
  64. package/dist/seat-proximity.js +119 -0
  65. package/dist/section-elevation.d.ts +5 -0
  66. package/dist/section-elevation.interface.d.ts +26 -0
  67. package/dist/section-elevation.interface.js +8 -0
  68. package/dist/section-elevation.js +53 -0
  69. package/dist/section-fill-rebuild.d.ts +10 -0
  70. package/dist/section-fill-rebuild.js +64 -0
  71. package/dist/section-fill.d.ts +84 -0
  72. package/dist/section-fill.interface.d.ts +94 -0
  73. package/dist/section-fill.interface.js +22 -0
  74. package/dist/section-fill.js +306 -0
  75. package/dist/section-growth.d.ts +11 -0
  76. package/dist/section-growth.interface.d.ts +12 -0
  77. package/dist/section-growth.interface.js +1 -0
  78. package/dist/section-growth.js +198 -0
  79. package/dist/section-layout.d.ts +95 -0
  80. package/dist/section-layout.interface.d.ts +8 -0
  81. package/dist/section-layout.interface.js +5 -0
  82. package/dist/section-layout.js +70 -0
  83. package/dist/section-outline-refit.d.ts +8 -0
  84. package/dist/section-outline-refit.js +246 -0
  85. package/dist/section-refit.d.ts +22 -0
  86. package/dist/section-refit.interface.d.ts +49 -0
  87. package/dist/section-refit.interface.js +6 -0
  88. package/dist/section-refit.js +179 -0
  89. package/dist/section-scale.d.ts +2 -0
  90. package/dist/section-scale.js +128 -0
  91. package/dist/sections.d.ts +23 -0
  92. package/dist/sections.js +144 -0
  93. package/dist/selling.d.ts +34 -0
  94. package/dist/selling.js +148 -0
  95. package/dist/spacing-repairs.d.ts +31 -0
  96. package/dist/spacing-repairs.js +168 -0
  97. package/dist/table-layout.d.ts +29 -0
  98. package/dist/table-layout.js +134 -0
  99. package/dist/validation.d.ts +7 -2
  100. package/dist/validation.interface.d.ts +20 -0
  101. package/dist/validation.interface.js +9 -0
  102. package/dist/validation.js +227 -78
  103. package/dist/wayfinding.d.ts +10 -0
  104. package/dist/wayfinding.interface.d.ts +52 -0
  105. package/dist/wayfinding.interface.js +28 -0
  106. package/dist/wayfinding.js +63 -0
  107. package/package.json +109 -4
  108. package/dist/types.d.ts +0 -313
  109. package/dist/types.js +0 -91
package/dist/schema.js CHANGED
@@ -1,19 +1,22 @@
1
- import { DocumentLimits, NumberingScheme, LabelDirection, RowLabelPosition, SeatingKind, CurveMode, DecorationKind, LabelAlignment, RowAlignment, SectionOutlineRole, AreaKind, ShapeKind, VenueGlyph, } from "./types.js";
1
+ import { ArcFanFacing, ArcFanFit, ArcFanMaximumRows, ArcFanMaximumPartsPerRow, ArcFanSectionOrigin, } from "./arc-fan.interface.js";
2
+ import { EntranceKind, GateUse, LineCap, LineJoin, LineEnding } from "./wayfinding.interface.js";
3
+ import { polygonContour, polygonContourVertexCount, PolygonVertexLimit, PolygonCornerRadiusMaxM, } from "./geometry/polygon-curves.js";
4
+ import { DocumentLimits, TicketRestriction, TableBookingMode, TableChairDistribution, StandingBookingMode, SeatShape, TicketOptionLimit, NumberingScheme, LabelDirection, RowLabelPosition, AccessNeed, SeatingKind, CurveMode, DecorationKind, LabelAlignment, RowAlignment, RowStagger, RowEnds, RowJoin, SectionOutlineRole, RowRefitStrength, SectionRotation, SectionScale, SectionTier, SectionRake, SectionFrontRowHeight, AreaKind, ShapeKind, VenueGlyph, } from "./physical-document.interface.js";
2
5
  import { z } from "zod";
6
+ import { tableSellingValid, standingSellingValid } from "./selling.js";
7
+ import { ticketOptionNameKey } from "./categories.js";
3
8
  import { issue, IssueCode } from "./issues.js";
4
- import { footprint, generateGroup, project, worldMatrices, } from "./geometry/geometry.js";
5
- const uuid = z
6
- .string()
7
- .regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/);
9
+ import { footprint, generateGroup, project, worldMatrices } from "./geometry/geometry.js";
10
+ const uuid = z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/);
8
11
  const finite = z.number().finite();
9
12
  const coordinate = finite.min(-10000).max(10000);
10
13
  const dimension = finite.min(0.001).max(10000);
11
14
  const nonNegative = finite.min(0).max(10000);
12
15
  const angle = finite.min(-180).lt(180);
16
+ const unsupportedText = /[\u0000-\u001f\u007f-\u009f]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u;
13
17
  const text = (limit, multiline = false) => z
14
18
  .string()
15
- .refine((v) => Array.from(v).length <= limit &&
16
- !/[\u0000-\u001f\u007f-\u009f]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u.test(multiline ? v.replace(/\n/g, "") : v), "Text exceeds its limit or contains unsupported control/surrogate characters.")
19
+ .refine((v) => Array.from(v).length <= limit && !unsupportedText.test(multiline ? v.replace(/\n/g, "") : v), "Text exceeds its limit or contains unsupported control/surrogate characters.")
17
20
  .meta({
18
21
  maxLength: limit,
19
22
  description: multiline
@@ -27,7 +30,13 @@ const name = text(120)
27
30
  description: "Nonempty, trimmed name; at most 120 Unicode code points. Control characters and unpaired surrogates are rejected.",
28
31
  });
29
32
  const label = text(80);
33
+ // Materialized labels retain their authored text within the document size limit.
34
+ export const storedLabelSchema = z
35
+ .string()
36
+ .refine((value) => !unsupportedText.test(value), "Use single-line text without control characters.")
37
+ .describe("Single-line label text without control characters or unpaired surrogates.");
30
38
  const point = z.strictObject({ x: coordinate, y: coordinate });
39
+ const focalPoint = point.describe("Authored seat-facing point in the chart coordinate system, in metres.").optional();
31
40
  const size = z.strictObject({ width: dimension, height: dimension });
32
41
  const transform = z.strictObject({
33
42
  positionM: point,
@@ -38,41 +47,106 @@ const transform = z.strictObject({
38
47
  const ring = z
39
48
  .array(point)
40
49
  .min(3)
41
- .max(10000)
50
+ .max(PolygonVertexLimit)
42
51
  .refine((v) => v[0].x !== v[v.length - 1].x || v[0].y !== v[v.length - 1].y, "Rings close implicitly; do not repeat the first vertex.")
43
52
  .describe("Implicitly closed ring; the last vertex must not repeat the first.");
44
- const polygon = z.strictObject({
53
+ const polygon = z
54
+ .strictObject({
45
55
  outer: ring,
46
56
  holes: z.array(ring).max(10000),
57
+ edgeCurvature: z.array(finite.min(-100).max(100)).max(PolygonVertexLimit).optional(),
58
+ cornerRounding: finite.min(0).max(100).optional(),
59
+ cornerRadiusM: nonNegative.max(PolygonCornerRadiusMaxM).optional(),
60
+ })
61
+ .superRefine((value, context) => {
62
+ if (value.edgeCurvature && value.edgeCurvature.length !== value.outer.length) {
63
+ context.addIssue({
64
+ code: "custom",
65
+ path: ["edgeCurvature"],
66
+ message: "Provide one curvature value per outer side.",
67
+ });
68
+ return;
69
+ }
70
+ if (value.cornerRounding !== undefined && value.cornerRadiusM !== undefined) {
71
+ context.addIssue({ code: "custom", path: ["cornerRadiusM"], message: "Use one corner rounding mode." });
72
+ return;
73
+ }
74
+ if (polygonContourVertexCount(value) > PolygonVertexLimit)
75
+ context.addIssue({
76
+ code: "custom",
77
+ path: ["edgeCurvature"],
78
+ message: "The boundary exceeds the 1mm / 10,000-vertex curve limit.",
79
+ });
47
80
  });
81
+ export const hexColourSchema = z.string().regex(/^#[0-9a-fA-F]{6}$/);
48
82
  const paint = z.strictObject({
49
- color: z.string().regex(/^#[0-9a-fA-F]{6}$/),
83
+ color: hexColourSchema,
50
84
  opacity: finite.min(0).max(1),
51
85
  });
52
86
  const sequence = z
53
87
  .strictObject({
54
88
  scheme: z.enum(NumberingScheme),
55
- startAt: finite.int().min(1).max(1e9),
89
+ startAt: finite.int().min(0).max(1e9),
56
90
  direction: z.enum(LabelDirection),
57
91
  prefix: text(32).optional(),
58
92
  suffix: text(32).optional(),
93
+ numberFrom: z.enum(["first", "last"]).optional(),
94
+ lastAt: finite.int().min(0).max(1e9).optional(),
59
95
  })
60
- .refine((v) => v.scheme !== NumberingScheme.Odd || v.startAt % 2 === 1, "Odd numbering must start at an odd integer.")
61
- .refine((v) => v.scheme !== NumberingScheme.Even || v.startAt % 2 === 0, "Even numbering must start at an even integer.")
62
- .describe("Odd/even numbering requires a matching odd/even startAt value.");
96
+ .superRefine((value, context) => {
97
+ if (value.numberFrom === "last" && value.lastAt === undefined)
98
+ context.addIssue({
99
+ code: "custom",
100
+ path: ["lastAt"],
101
+ message: "Last-seat anchoring requires a last number.",
102
+ });
103
+ if (value.scheme === NumberingScheme.Roman && (value.startAt > 999 || (value.lastAt ?? 0) > 100999))
104
+ context.addIssue({
105
+ code: "custom",
106
+ path: ["startAt"],
107
+ message: "Roman start numbers must be at most 999.",
108
+ });
109
+ });
63
110
  const labelStyle = z.strictObject({
64
111
  visible: z.boolean(),
65
112
  fontSizeM: dimension,
113
+ style: z.enum(["plain", "pill"]).optional(),
114
+ rotationDeg: angle.optional(),
115
+ color: hexColourSchema.optional(),
116
+ });
117
+ const rowLabelStyle = labelStyle.extend({
118
+ position: z.enum(RowLabelPosition),
119
+ style: z.enum(["plain", "pill"]).optional(),
120
+ rotationDeg: angle.optional(),
121
+ });
122
+ export const buyerPhotoSchema = z.strictObject({ assetId: uuid });
123
+ export const seatPresentationSchema = z.strictObject({
124
+ buyerPhoto: buyerPhotoSchema.optional(),
125
+ gap: z.boolean().optional(),
126
+ buyerNote: text(160).optional(),
127
+ labelStyle: labelStyle.optional(),
66
128
  });
129
+ export const rowPresentationSchema = z.strictObject({
130
+ buyerPhoto: buyerPhotoSchema.optional(),
131
+ bookingLabel: storedLabelSchema.optional(),
132
+ buyerNoun: text(80).optional(),
133
+ buyerNote: text(160).optional(),
134
+ labelStyle: rowLabelStyle.optional(),
135
+ });
136
+ export const seatShapeSchema = z.enum(SeatShape);
67
137
  const seat = z.strictObject({
138
+ ...seatPresentationSchema.shape,
139
+ seatShape: seatShapeSchema.optional(),
68
140
  id: uuid,
69
- labelOverride: label.optional(),
141
+ categoryId: uuid.nullable().optional(),
142
+ labelOverride: storedLabelSchema.optional(),
70
143
  attributes: z
71
144
  .strictObject({
72
- accessible: z.boolean().optional(),
145
+ wheelchair: z.enum(["seat", "space"]).optional(),
146
+ accessNeeds: z.array(z.enum(AccessNeed)).max(Object.keys(AccessNeed).length).optional(),
147
+ obstructedView: z.boolean().optional(),
148
+ premium: z.boolean().optional(),
73
149
  restrictedView: z.boolean().optional(),
74
- hearingAssistance: z.boolean().optional(),
75
- semiAmbulatory: z.boolean().optional(),
76
150
  companionForSeatId: uuid.optional(),
77
151
  })
78
152
  .optional(),
@@ -84,21 +158,81 @@ const seat = z.strictObject({
84
158
  })
85
159
  .optional(),
86
160
  });
161
+ export const rowLayoutSchema = z.strictObject({
162
+ originM: point,
163
+ seatPitchM: dimension,
164
+ curveDeg: finite,
165
+ rotationDeg: finite.min(-180).max(180),
166
+ seatRotationOffsetDeg: finite.min(-180).max(180).optional(),
167
+ });
168
+ export const entranceSchema = z.discriminatedUnion("kind", [
169
+ z.strictObject({ kind: z.literal(EntranceKind.Gate), gateId: uuid, label: storedLabelSchema.optional() }),
170
+ z.strictObject({ kind: z.literal(EntranceKind.Text), label: storedLabelSchema }),
171
+ ]);
172
+ const gateDetails = z.strictObject({
173
+ use: z.enum(GateUse),
174
+ stepFree: z.boolean().optional(),
175
+ opens: text(120).optional(),
176
+ showToBuyers: z.boolean().optional(),
177
+ });
87
178
  const row = z.strictObject({
179
+ entrance: entranceSchema.optional(),
180
+ fillOrigin: z
181
+ .strictObject({
182
+ sectionId: uuid,
183
+ rowIndex: finite
184
+ .int()
185
+ .min(0)
186
+ .max(DocumentLimits.PhysicalSeats - 1),
187
+ partIndex: finite
188
+ .int()
189
+ .min(0)
190
+ .max(DocumentLimits.PhysicalSeats - 1),
191
+ })
192
+ .optional(),
193
+ zIndex: finite.int().min(-2147483648).max(2147483647).optional(),
194
+ ...rowPresentationSchema.shape,
88
195
  id: uuid,
89
- labelOverride: label.optional(),
196
+ categoryId: uuid.nullable().optional(),
197
+ labelOverride: storedLabelSchema.optional(),
90
198
  offsetM: point.optional(),
91
199
  seatSequenceOverride: sequence.optional(),
200
+ layout: rowLayoutSchema.optional(),
201
+ aisleSeats: z.enum(RowEnds).optional(),
92
202
  seats: z.array(seat).min(1).max(DocumentLimits.PhysicalSeats),
93
203
  });
94
204
  const drawable = {
205
+ floorId: uuid.describe("Physical floor identity when the map defines levels.").optional(),
95
206
  id: uuid,
96
207
  parentId: uuid.nullable(),
97
208
  transform,
98
209
  zIndex: finite.int().min(-2147483648).max(2147483647),
99
210
  };
211
+ const partySize = {
212
+ minGuests: finite.int().min(1).max(DocumentLimits.PhysicalSeats),
213
+ maxGuests: finite.int().min(1).max(DocumentLimits.PhysicalSeats),
214
+ };
215
+ const tableSelling = z.discriminatedUnion("mode", [
216
+ z.strictObject({
217
+ mode: z.enum([TableBookingMode.Individual, TableBookingMode.Whole]),
218
+ }),
219
+ z.strictObject({ mode: z.literal(TableBookingMode.Party), ...partySize }),
220
+ ]);
221
+ const standingSelling = z.discriminatedUnion("mode", [
222
+ z.strictObject({
223
+ mode: z.enum([StandingBookingMode.Standing, StandingBookingMode.Whole]),
224
+ wheelchairPlaces: finite.int().min(0).max(2147483647),
225
+ }),
226
+ z.strictObject({
227
+ mode: z.literal(StandingBookingMode.Party),
228
+ wheelchairPlaces: finite.int().min(0).max(2147483647),
229
+ ...partySize,
230
+ }),
231
+ ]);
100
232
  const groupBase = {
233
+ entrance: entranceSchema.optional(),
101
234
  ...drawable,
235
+ categoryId: uuid.nullable().optional(),
102
236
  name,
103
237
  sectionId: uuid.nullable(),
104
238
  seatSizeM: size,
@@ -108,17 +242,80 @@ const groupBase = {
108
242
  const rowsLabels = z.strictObject({
109
243
  rows: sequence,
110
244
  seats: sequence,
111
- rowStyle: z.strictObject({
112
- visible: z.boolean(),
113
- fontSizeM: dimension,
114
- position: z.enum(RowLabelPosition),
115
- }),
245
+ rowStyle: rowLabelStyle,
246
+ });
247
+ export const segmentedRowSchema = z.strictObject({
248
+ id: uuid,
249
+ label: storedLabelSchema.min(1, "Use a nonempty connected row label."),
250
+ sequence,
251
+ qualifySeatLabels: z.boolean().optional(),
252
+ smoothCorners: z.boolean().optional(),
253
+ parts: z
254
+ .array(z.strictObject({
255
+ rowId: uuid,
256
+ joinBefore: z.enum(RowJoin).nullable(),
257
+ labelOverride: storedLabelSchema.optional(),
258
+ }))
259
+ .min(1)
260
+ .max(DocumentLimits.PhysicalSeats),
116
261
  });
262
+ const inventoryNaming = { code: label, name: label.optional() };
117
263
  const tableLabels = z.strictObject({
118
- table: label,
264
+ ...inventoryNaming,
119
265
  chairs: sequence,
120
266
  tableStyle: labelStyle,
121
267
  });
268
+ const roundTableRecipe = z.strictObject({
269
+ diameterM: dimension,
270
+ chairGapM: nonNegative,
271
+ startAngleDeg: angle,
272
+ automaticSize: z.boolean().optional(),
273
+ seatArcDeg: z.number().finite().min(120).max(360).optional(),
274
+ });
275
+ const rectangularTableRecipe = z.strictObject({
276
+ widthM: dimension,
277
+ depthM: dimension,
278
+ chairGapM: nonNegative,
279
+ chairPitchM: dimension.optional(),
280
+ chairDistribution: z.enum(TableChairDistribution).optional(),
281
+ });
282
+ const longTableLayout = z
283
+ .strictObject({
284
+ recipe: rectangularTableRecipe,
285
+ sides: z.strictObject({
286
+ top: z.boolean(),
287
+ bottom: z.boolean(),
288
+ left: z.boolean(),
289
+ right: z.boolean(),
290
+ }),
291
+ })
292
+ .refine((value) => Object.values(value.sides).some(Boolean), "Choose at least one table side.");
293
+ const arcFanRecipeSchema = z
294
+ .strictObject({
295
+ rowCount: finite.int().min(1).max(ArcFanMaximumRows),
296
+ innerRadiusM: dimension,
297
+ rowPitchM: dimension,
298
+ seatPitchM: dimension,
299
+ startAngleDeg: finite,
300
+ endAngleDeg: finite,
301
+ taperDeg: finite,
302
+ skewDeg: finite,
303
+ fit: z.enum(ArcFanFit),
304
+ facing: z.enum(ArcFanFacing),
305
+ seatsPerRow: finite.int().min(2).max(DocumentLimits.PhysicalSeats).optional(),
306
+ aisles: z.strictObject({ left: nonNegative, center: nonNegative, right: nonNegative }),
307
+ })
308
+ .refine((recipe) => recipe.fit !== ArcFanFit.SameCount || recipe.seatsPerRow !== undefined, "A fixed-count fan requires seats per row.");
309
+ const arcFanGenerationSchema = z.strictObject({
310
+ recipe: arcFanRecipeSchema,
311
+ sectionId: uuid.nullable(),
312
+ sectionOrigin: z.enum(ArcFanSectionOrigin),
313
+ members: z
314
+ .array(z.strictObject({ rowId: uuid, bookingLabel: storedLabelSchema, labelOverride: storedLabelSchema.optional() }))
315
+ .min(1)
316
+ .max(ArcFanMaximumRows * ArcFanMaximumPartsPerRow)
317
+ .refine((members) => new Set(members.map((member) => member.rowId)).size === members.length, "Generated fan members must be unique."),
318
+ });
122
319
  export const groupSchema = z.discriminatedUnion("kind", [
123
320
  z.strictObject({
124
321
  ...groupBase,
@@ -127,7 +324,9 @@ export const groupSchema = z.discriminatedUnion("kind", [
127
324
  seatPitchM: dimension,
128
325
  rowPitchM: dimension,
129
326
  rowAlignment: z.enum(RowAlignment).optional(),
327
+ stagger: z.enum(RowStagger).optional(),
130
328
  }),
329
+ arcFan: arcFanGenerationSchema.optional(),
131
330
  labels: rowsLabels,
132
331
  rows: z.array(row).min(1).max(DocumentLimits.PhysicalSeats),
133
332
  }),
@@ -154,6 +353,7 @@ export const groupSchema = z.discriminatedUnion("kind", [
154
353
  }),
155
354
  ]),
156
355
  }),
356
+ arcFan: arcFanGenerationSchema.optional(),
157
357
  labels: rowsLabels,
158
358
  rows: z.array(row).min(1).max(DocumentLimits.PhysicalSeats),
159
359
  }),
@@ -161,12 +361,9 @@ export const groupSchema = z.discriminatedUnion("kind", [
161
361
  .strictObject({
162
362
  ...groupBase,
163
363
  kind: z.literal(SeatingKind.Rectangular),
164
- recipe: z.strictObject({
165
- widthM: dimension,
166
- depthM: dimension,
167
- chairGapM: nonNegative,
168
- chairPitchM: dimension.optional(),
169
- }),
364
+ selling: tableSelling.optional(),
365
+ recipe: rectangularTableRecipe,
366
+ roundLayout: roundTableRecipe.optional(),
170
367
  labels: tableLabels,
171
368
  chairsBySide: z.strictObject({
172
369
  top: z.array(seat).max(DocumentLimits.PhysicalSeats),
@@ -175,18 +372,19 @@ export const groupSchema = z.discriminatedUnion("kind", [
175
372
  left: z.array(seat).max(DocumentLimits.PhysicalSeats),
176
373
  }),
177
374
  })
178
- .refine((v) => Object.values(v.chairsBySide).some((s) => s.length > 0), "A table needs at least one chair."),
179
- z.strictObject({
375
+ .refine((v) => Object.values(v.chairsBySide).some((s) => s.length > 0), "A table needs at least one chair.")
376
+ .refine(tableSellingValid, "Table selling requires valid guest limits and no personal chair settings."),
377
+ z
378
+ .strictObject({
180
379
  ...groupBase,
181
380
  kind: z.literal(SeatingKind.Round),
182
- recipe: z.strictObject({
183
- diameterM: dimension,
184
- chairGapM: nonNegative,
185
- startAngleDeg: angle,
186
- }),
381
+ selling: tableSelling.optional(),
382
+ recipe: roundTableRecipe,
383
+ longLayout: longTableLayout.optional(),
187
384
  labels: tableLabels,
188
385
  chairs: z.array(seat).min(1).max(DocumentLimits.PhysicalSeats),
189
- }),
386
+ })
387
+ .refine(tableSellingValid, "Table selling requires valid guest limits and no personal chair settings."),
190
388
  ]);
191
389
  export const decorationStyleSchema = z.strictObject({
192
390
  fill: paint.optional(),
@@ -195,6 +393,8 @@ export const decorationStyleSchema = z.strictObject({
195
393
  });
196
394
  const decorationBase = {
197
395
  ...drawable,
396
+ label: storedLabelSchema.optional(),
397
+ heightM: nonNegative.optional(),
198
398
  style: decorationStyleSchema.optional(),
199
399
  };
200
400
  const decoration = z.discriminatedUnion("kind", [
@@ -209,6 +409,7 @@ const decoration = z.discriminatedUnion("kind", [
209
409
  .strictObject({
210
410
  ...decorationBase,
211
411
  kind: z.literal(DecorationKind.Rectangle),
412
+ gate: gateDetails.optional(),
212
413
  sizeM: size,
213
414
  cornerRadiusM: nonNegative,
214
415
  })
@@ -221,11 +422,17 @@ const decoration = z.discriminatedUnion("kind", [
221
422
  z.strictObject({
222
423
  ...decorationBase,
223
424
  kind: z.literal(DecorationKind.Line),
425
+ route: z.strictObject({ stepFree: z.boolean() }).optional(),
426
+ lineCap: z.enum(LineCap).optional(),
427
+ lineJoin: z.enum(LineJoin).optional(),
428
+ startEnding: z.enum(LineEnding).optional(),
429
+ endEnding: z.enum(LineEnding).optional(),
224
430
  pointsM: z.array(point).min(2).max(10000),
225
431
  }),
226
432
  z.strictObject({
227
433
  ...decorationBase,
228
434
  kind: z.literal(DecorationKind.Polygon),
435
+ gate: gateDetails.optional(),
229
436
  boundary: polygon,
230
437
  }),
231
438
  z.strictObject({
@@ -242,11 +449,12 @@ const decoration = z.discriminatedUnion("kind", [
242
449
  opacity: finite.min(0).max(1),
243
450
  }),
244
451
  ]);
245
- const area = z.strictObject({
452
+ const areaBase = {
453
+ entrance: entranceSchema.optional(),
246
454
  ...drawable,
247
- kind: z.literal(AreaKind.GeneralAdmission),
455
+ ...inventoryNaming,
456
+ categoryId: uuid.nullable().optional(),
248
457
  sectionId: uuid.nullable(),
249
- label,
250
458
  labelStyle,
251
459
  capacity: finite.int().min(1).max(2147483647),
252
460
  shape: z.discriminatedUnion("kind", [
@@ -260,8 +468,67 @@ const area = z.strictObject({
260
468
  .refine((v) => v.cornerRadiusM <= Math.min(v.widthM, v.heightM) / 2),
261
469
  z.strictObject({ kind: z.literal(ShapeKind.Polygon), boundary: polygon }),
262
470
  ]),
471
+ };
472
+ const area = z.discriminatedUnion("kind", [
473
+ z
474
+ .strictObject({
475
+ ...areaBase,
476
+ kind: z.literal(AreaKind.GeneralAdmission),
477
+ selling: standingSelling.optional(),
478
+ })
479
+ .refine(standingSellingValid, "Standing selling must fit its capacity and one-party limit."),
480
+ z.strictObject({ ...areaBase, kind: z.literal(AreaKind.Booth) }),
481
+ ]);
482
+ const templatePrice = finite.min(0).max(1_000_000_000);
483
+ export const ticketOptionSchema = z.strictObject({
484
+ id: uuid,
485
+ name: text(80).refine((value) => value.length > 0 && value === value.trim(), "Use a trimmed, nonempty option name."),
486
+ price: templatePrice,
487
+ restriction: z.enum(TicketRestriction).optional(),
488
+ guidance: text(240, true).optional(),
489
+ });
490
+ export const categorySchema = z
491
+ .strictObject({
492
+ id: uuid,
493
+ name,
494
+ color: hexColourSchema,
495
+ defaultPrice: templatePrice.nullable().optional(),
496
+ onSale: z.boolean().optional(),
497
+ seatShape: seatShapeSchema.optional(),
498
+ ticketOptions: z.array(ticketOptionSchema).max(TicketOptionLimit).optional(),
499
+ })
500
+ .superRefine((category, context) => {
501
+ const names = new Set();
502
+ for (const [index, option] of (category.ticketOptions ?? []).entries()) {
503
+ const key = ticketOptionNameKey(option.name);
504
+ if (names.has(key))
505
+ context.addIssue({
506
+ code: "custom",
507
+ path: ["ticketOptions", index, "name"],
508
+ message: `${option.name} is already an option here`,
509
+ });
510
+ names.add(key);
511
+ }
512
+ });
513
+ export const categoriesSchema = z
514
+ .array(categorySchema)
515
+ .max(1024)
516
+ .superRefine((categories, context) => {
517
+ const ids = new Set();
518
+ for (const [index, category] of categories.entries()) {
519
+ for (const id of [category.id, ...(category.ticketOptions ?? []).map((option) => option.id)]) {
520
+ if (ids.has(id))
521
+ context.addIssue({
522
+ code: "custom",
523
+ path: [index],
524
+ message: "Category and ticket-option identities must be unique.",
525
+ });
526
+ ids.add(id);
527
+ }
528
+ }
263
529
  });
264
530
  export const documentSchema = z.strictObject({
531
+ buyerPhoto: buyerPhotoSchema.optional(),
265
532
  schemaVersion: z.literal(1),
266
533
  mapId: uuid,
267
534
  name,
@@ -272,13 +539,48 @@ export const documentSchema = z.strictObject({
272
539
  rotation: z.literal("clockwise"),
273
540
  }),
274
541
  background: paint,
542
+ categories: categoriesSchema.optional(),
543
+ floors: z
544
+ .array(z.strictObject({ id: uuid, name, baseHeightM: coordinate, focalPoint }))
545
+ .min(1)
546
+ .max(1024)
547
+ .describe("Physical levels in display order. When present, every section, collection and drawable must reference one of these floor identities.")
548
+ .optional(),
549
+ zones: z
550
+ .array(z.strictObject({ id: uuid, name, color: hexColourSchema, focalPoint }))
551
+ .max(1024)
552
+ .describe("Section groups in display order, independent of physical floors.")
553
+ .optional(),
275
554
  sections: z
276
555
  .array(z.strictObject({
556
+ entrance: entranceSchema.optional(),
557
+ buyerPhoto: buyerPhotoSchema.optional(),
277
558
  id: uuid,
278
- label,
559
+ label: storedLabelSchema,
560
+ floorId: uuid.describe("Physical floor identity when the map defines levels.").optional(),
561
+ zoneId: uuid.describe("Optional chart-wide zone membership.").optional(),
562
+ elevation: z
563
+ .strictObject({
564
+ tier: z.enum(SectionTier).optional(),
565
+ rakeDeg: finite.min(SectionRake.min).max(SectionRake.max).optional(),
566
+ frontRowHeightM: finite.min(SectionFrontRowHeight.min).max(SectionFrontRowHeight.max).optional(),
567
+ })
568
+ .describe("Authored section slope and front-row elevation relative to its floor.")
569
+ .optional(),
570
+ categoryId: uuid.nullable().optional(),
279
571
  displayLabel: text(80, true).optional(),
280
572
  outline: polygon.optional(),
281
573
  outlineRole: z.enum(SectionOutlineRole).optional(),
574
+ rotationDeg: z.number().int().min(SectionRotation.min).max(SectionRotation.max).optional(),
575
+ scalePercent: z.number().min(SectionScale.min).max(SectionScale.max).optional(),
576
+ outlineGrowthFactor: finite.positive().optional(),
577
+ rowRefitStrength: z
578
+ .number()
579
+ .int()
580
+ .min(RowRefitStrength.min)
581
+ .max(RowRefitStrength.max)
582
+ .describe("Last accepted row refit strength in percent.")
583
+ .optional(),
282
584
  style: decorationStyleSchema.optional(),
283
585
  labelPlacement: z
284
586
  .strictObject({
@@ -292,17 +594,13 @@ export const documentSchema = z.strictObject({
292
594
  .max(1024),
293
595
  collections: z.array(z.strictObject({ ...drawable, name })).max(10000),
294
596
  seatingGroups: z.array(groupSchema).max(DocumentLimits.PhysicalSeats),
597
+ segmentedRows: z.array(segmentedRowSchema).max(DocumentLimits.PhysicalSeats).optional(),
295
598
  areas: z.array(area).max(10000),
296
599
  decorations: z.array(decoration).max(10000),
297
600
  assets: z
298
601
  .array(z.strictObject({
299
602
  id: uuid,
300
- mimeType: z.enum([
301
- "image/png",
302
- "image/jpeg",
303
- "image/webp",
304
- "image/svg+xml",
305
- ]),
603
+ mimeType: z.enum(["image/png", "image/jpeg", "image/webp", "image/svg+xml"]),
306
604
  }))
307
605
  .max(256),
308
606
  });
@@ -315,14 +613,13 @@ export const paintSchema = paint;
315
613
  export const transformSchema = transform;
316
614
  export const mapNameSchema = name;
317
615
  export const sectionSchema = documentSchema.shape.sections.element;
616
+ export const floorsSchema = documentSchema.shape.floors.unwrap();
617
+ export const zonesSchema = documentSchema.shape.zones.unwrap();
318
618
  export const uuidSchema = uuid;
319
619
  export const dimensionSchema = dimension;
320
620
  export const coordinateSchema = coordinate;
321
621
  export const rotationSchema = angle;
322
- export const positiveCountSchema = finite
323
- .int()
324
- .min(1)
325
- .max(DocumentLimits.PhysicalSeats);
622
+ export const positiveCountSchema = finite.int().min(1).max(DocumentLimits.PhysicalSeats);
326
623
  export const labelSequenceSchema = sequence;
327
624
  export const inventoryLabelSchema = label;
328
625
  export const attributesSchema = seat.shape.attributes;
@@ -341,8 +638,7 @@ export var DocumentParseStatus;
341
638
  DocumentParseStatus["Rejected"] = "rejected";
342
639
  })(DocumentParseStatus || (DocumentParseStatus = {}));
343
640
  export function groupSeatCount(group) {
344
- return group.kind === SeatingKind.Straight ||
345
- group.kind === SeatingKind.Curved
641
+ return group.kind === SeatingKind.Straight || group.kind === SeatingKind.Curved
346
642
  ? group.rows.reduce((n, r) => n + r.seats.length, 0)
347
643
  : group.kind === SeatingKind.Round
348
644
  ? group.chairs.length
@@ -358,33 +654,90 @@ export function* seatSlots(group) {
358
654
  for (const side of ["top", "right", "bottom", "left"])
359
655
  yield* group.chairsBySide[side];
360
656
  }
657
+ const inventoryCounts = new WeakMap();
658
+ function slotInventoryCount(slots) {
659
+ let count = inventoryCounts.get(slots);
660
+ if (count === undefined) {
661
+ count = 0;
662
+ for (const slot of slots)
663
+ if (!slot.gap)
664
+ count++;
665
+ inventoryCounts.set(slots, count);
666
+ }
667
+ return count;
668
+ }
669
+ export function groupInventoryCount(group) {
670
+ if ("rows" in group)
671
+ return group.rows.reduce((sum, row) => sum + slotInventoryCount(row.seats), 0);
672
+ if ("chairs" in group)
673
+ return slotInventoryCount(group.chairs);
674
+ return Object.values(group.chairsBySide).reduce((sum, seats) => sum + slotInventoryCount(seats), 0);
675
+ }
361
676
  export function capacity(document) {
362
- return {
363
- physicalSeats: document.seatingGroups.reduce((n, g) => n + groupSeatCount(g), 0),
364
- gaQuantity: document.areas.reduce((n, a) => n + a.capacity, 0),
365
- };
677
+ let physicalSeats = document.seatingGroups.reduce((sum, group) => sum + groupInventoryCount(group), 0);
678
+ let gaQuantity = 0;
679
+ for (const area of document.areas) {
680
+ if (area.kind === AreaKind.Booth)
681
+ physicalSeats++;
682
+ else
683
+ gaQuantity += area.capacity;
684
+ }
685
+ return { physicalSeats, gaQuantity };
366
686
  }
367
687
  export function structuralIssues(document, changedGroups) {
368
688
  const errors = [];
369
689
  const ids = new Set([document.mapId]);
370
690
  const add = (id) => {
371
691
  if (ids.has(id))
372
- errors.push(issue(IssueCode.DuplicateId, "Physical identities must be unique.", [
373
- id,
374
- ]));
692
+ errors.push(issue(IssueCode.DuplicateId, "Physical identities must be unique.", [id]));
375
693
  ids.add(id);
376
694
  };
695
+ const floors = new Set((document.floors ?? []).map((floor) => floor.id));
696
+ for (const floor of document.floors ?? [])
697
+ add(floor.id);
698
+ for (const member of [
699
+ ...document.sections,
700
+ ...document.collections,
701
+ ...document.seatingGroups,
702
+ ...document.areas,
703
+ ...document.decorations,
704
+ ]) {
705
+ if (member.floorId ? !floors.has(member.floorId) : floors.size > 0) {
706
+ errors.push(issue(IssueCode.UnknownFloor, "Physical objects must reference an existing floor when levels are defined.", [
707
+ member.id,
708
+ ]));
709
+ }
710
+ }
377
711
  const sections = new Set(document.sections.map((s) => s.id));
378
712
  const parents = new Map(document.collections.map((c) => [c.id, c]));
713
+ const floorById = new Map([
714
+ ...document.sections,
715
+ ...document.collections,
716
+ ...document.seatingGroups,
717
+ ...document.areas,
718
+ ...document.decorations,
719
+ ].map((object) => [object.id, object.floorId]));
379
720
  let vertices = 0;
380
- const visitPolygon = (p) => {
381
- if (p)
382
- vertices += p.outer.length + p.holes.reduce((n, h) => n + h.length, 0);
721
+ const visitPolygon = (polygon) => {
722
+ if (polygon)
723
+ vertices += polygonContourVertexCount(polygon) + polygon.holes.reduce((total, hole) => total + hole.length, 0);
383
724
  };
725
+ const zones = new Set();
726
+ for (const zone of document.zones ?? []) {
727
+ add(zone.id);
728
+ zones.add(zone.id);
729
+ }
384
730
  for (const s of document.sections) {
385
731
  add(s.id);
732
+ if (s.zoneId && !zones.has(s.zoneId))
733
+ errors.push(issue(IssueCode.UnknownZone, "Section zone reference does not exist.", [s.id]));
386
734
  visitPolygon(s.outline);
387
735
  }
736
+ for (const category of document.categories ?? []) {
737
+ add(category.id);
738
+ for (const option of category.ticketOptions ?? [])
739
+ add(option.id);
740
+ }
388
741
  for (const a of document.assets)
389
742
  add(a.id);
390
743
  for (const object of [
@@ -394,18 +747,23 @@ export function structuralIssues(document, changedGroups) {
394
747
  ...document.decorations,
395
748
  ]) {
396
749
  add(object.id);
750
+ if ("sectionId" in object && object.sectionId !== null && !sections.has(object.sectionId))
751
+ errors.push(issue(IssueCode.UnknownSection, "Section reference does not exist.", [object.id]));
397
752
  if ("sectionId" in object &&
398
753
  object.sectionId !== null &&
399
- !sections.has(object.sectionId))
400
- errors.push(issue(IssueCode.UnknownSection, "Section reference does not exist.", [
401
- object.id,
402
- ]));
754
+ sections.has(object.sectionId) &&
755
+ floorById.get(object.sectionId) !== object.floorId)
756
+ errors.push(issue(IssueCode.UnknownSection, "A section and its contents must belong to the same floor.", [object.id]));
757
+ if (object.parentId && parents.has(object.parentId) && floorById.get(object.parentId) !== object.floorId)
758
+ errors.push(issue(IssueCode.InvalidParent, "A collection and its contents must belong to the same floor.", [object.id]));
403
759
  const visited = new Set([object.id]);
404
760
  let parent = object.parentId;
405
761
  let depth = 0;
406
762
  while (parent) {
407
763
  if (visited.has(parent) || !parents.has(parent) || ++depth > 64) {
408
- errors.push(issue(IssueCode.InvalidParent, "Parent must be an existing acyclic collection, within depth 64.", [object.id]));
764
+ errors.push(issue(IssueCode.InvalidParent, "Parent must be an existing acyclic collection, within depth 64.", [
765
+ object.id,
766
+ ]));
409
767
  break;
410
768
  }
411
769
  visited.add(parent);
@@ -413,6 +771,13 @@ export function structuralIssues(document, changedGroups) {
413
771
  }
414
772
  }
415
773
  for (const g of document.seatingGroups) {
774
+ if ("arcFan" in g && g.arcFan?.sectionId) {
775
+ const target = g.arcFan.sectionId;
776
+ if (!sections.has(target))
777
+ errors.push(issue(IssueCode.UnknownSection, "Generated fan section reference does not exist.", [g.id]));
778
+ else if (floorById.get(target) !== g.floorId)
779
+ errors.push(issue(IssueCode.UnknownSection, "A generated fan and its section must belong to the same floor.", [g.id]));
780
+ }
416
781
  visitPolygon(g.boundary);
417
782
  if (g.kind === SeatingKind.Straight || g.kind === SeatingKind.Curved)
418
783
  for (const r of g.rows) {
@@ -424,6 +789,21 @@ export function structuralIssues(document, changedGroups) {
424
789
  for (const s of generateGroup(g))
425
790
  add(s.id);
426
791
  }
792
+ const rowOwners = new Map(document.seatingGroups.flatMap((group) => "rows" in group ? group.rows.map((row) => [row.id, { group, row }]) : []));
793
+ const assignedRows = new Set();
794
+ for (const logical of document.segmentedRows ?? []) {
795
+ add(logical.id);
796
+ for (let index = 0; index < logical.parts.length; index++) {
797
+ const part = logical.parts[index];
798
+ const owner = rowOwners.get(part.rowId);
799
+ if (!owner ||
800
+ assignedRows.has(part.rowId) ||
801
+ !owner.row.layout ||
802
+ (index === 0 ? part.joinBefore !== null : part.joinBefore === null))
803
+ errors.push(issue(IssueCode.InvalidStructure, "Each row part must have independent geometry, one logical owner and a valid join.", [logical.id, part.rowId]));
804
+ assignedRows.add(part.rowId);
805
+ }
806
+ }
427
807
  for (const a of document.areas)
428
808
  if (a.shape.kind === ShapeKind.Polygon)
429
809
  visitPolygon(a.shape.boundary);
@@ -433,17 +813,19 @@ export function structuralIssues(document, changedGroups) {
433
813
  else if (d.kind === DecorationKind.Polygon)
434
814
  visitPolygon(d.boundary);
435
815
  const counts = capacity(document);
436
- if (counts.physicalSeats > DocumentLimits.PhysicalSeats ||
816
+ if (document.seatingGroups.reduce((total, group) => total + groupSeatCount(group), 0) +
817
+ document.areas.filter((area) => area.kind === AreaKind.Booth).length >
818
+ DocumentLimits.PhysicalSeats ||
437
819
  !Number.isSafeInteger(counts.gaQuantity + counts.physicalSeats) ||
438
820
  vertices > 100000)
439
821
  errors.push(issue(IssueCode.Limit, "Document exceeds its inventory, capacity or vertex safety limit.", [document.mapId]));
440
822
  if (errors.length)
441
823
  return errors;
442
824
  const matrices = worldMatrices(document);
443
- const within = (p) => Number.isFinite(p.x) &&
444
- Number.isFinite(p.y) &&
445
- Math.abs(p.x) <= 10000 &&
446
- Math.abs(p.y) <= 10000;
825
+ const within = (p) => Number.isFinite(p.x) && Number.isFinite(p.y) && Math.abs(p.x) <= 10000 && Math.abs(p.y) <= 10000;
826
+ for (const section of document.sections)
827
+ if (section.outline && polygonContour(section.outline).outer.some((point) => !within(point)))
828
+ errors.push(issue(IssueCode.WorldBounds, "Derived section geometry exceeds its safety bounds.", [section.id]));
447
829
  for (const g of document.seatingGroups) {
448
830
  if (changedGroups && !changedGroups.has(g.id))
449
831
  continue;
@@ -457,23 +839,20 @@ export function structuralIssues(document, changedGroups) {
457
839
  if (d.kind === DecorationKind.Line)
458
840
  points = d.pointsM;
459
841
  else if (d.kind === DecorationKind.Polygon)
460
- points = [...d.boundary.outer, ...d.boundary.holes.flat()];
461
- else if (d.kind === AreaKind.GeneralAdmission &&
462
- d.shape.kind === ShapeKind.Polygon)
463
- points = [...d.shape.boundary.outer, ...d.shape.boundary.holes.flat()];
842
+ points = [...polygonContour(d.boundary).outer, ...d.boundary.holes.flat()];
843
+ else if ((d.kind === AreaKind.GeneralAdmission || d.kind === AreaKind.Booth) && d.shape.kind === ShapeKind.Polygon)
844
+ points = [...polygonContour(d.shape.boundary).outer, ...d.shape.boundary.holes.flat()];
464
845
  else {
465
846
  const w = d.kind === DecorationKind.Circle
466
847
  ? d.radiusM * 2
467
- : d.kind === AreaKind.GeneralAdmission &&
468
- d.shape.kind === ShapeKind.Rectangle
848
+ : (d.kind === AreaKind.GeneralAdmission || d.kind === AreaKind.Booth) && d.shape.kind === ShapeKind.Rectangle
469
849
  ? d.shape.widthM
470
850
  : "sizeM" in d
471
851
  ? d.sizeM.width
472
852
  : 0;
473
853
  const h = d.kind === DecorationKind.Circle
474
854
  ? d.radiusM * 2
475
- : d.kind === AreaKind.GeneralAdmission &&
476
- d.shape.kind === ShapeKind.Rectangle
855
+ : (d.kind === AreaKind.GeneralAdmission || d.kind === AreaKind.Booth) && d.shape.kind === ShapeKind.Rectangle
477
856
  ? d.shape.heightM
478
857
  : "sizeM" in d
479
858
  ? d.sizeM.height
@@ -493,9 +872,7 @@ export function structuralIssues(document, changedGroups) {
493
872
  export function parsePhysicalDocument(input) {
494
873
  let raw = input;
495
874
  try {
496
- if (typeof raw !== "string" &&
497
- new TextEncoder().encode(JSON.stringify(raw)).byteLength >
498
- DocumentLimits.JsonBytes)
875
+ if (typeof raw !== "string" && new TextEncoder().encode(JSON.stringify(raw)).byteLength > DocumentLimits.JsonBytes)
499
876
  return {
500
877
  status: DocumentParseStatus.Rejected,
501
878
  issues: [issue(IssueCode.Limit, "Document exceeds 64MiB.", [])],
@@ -512,9 +889,7 @@ export function parsePhysicalDocument(input) {
512
889
  catch {
513
890
  return {
514
891
  status: DocumentParseStatus.Rejected,
515
- issues: [
516
- issue(IssueCode.InvalidJson, "Document is not readable JSON.", []),
517
- ],
892
+ issues: [issue(IssueCode.InvalidJson, "Document is not readable JSON.", [])],
518
893
  };
519
894
  }
520
895
  const result = documentSchema.safeParse(raw);
@@ -523,9 +898,7 @@ export function parsePhysicalDocument(input) {
523
898
  status: DocumentParseStatus.Rejected,
524
899
  issues: result.error.issues
525
900
  .slice(0, 50)
526
- .map((e) => issue(e.path[0] === "schemaVersion"
527
- ? IssueCode.UnsupportedVersion
528
- : IssueCode.InvalidStructure, e.message, [], e.path.map(String).join("."))),
901
+ .map((e) => issue(e.path[0] === "schemaVersion" ? IssueCode.UnsupportedVersion : IssueCode.InvalidStructure, e.message, [], e.path.map(String).join("."))),
529
902
  };
530
903
  const document = result.data;
531
904
  const errors = structuralIssues(document);
@@ -536,17 +909,13 @@ export function parsePhysicalDocument(input) {
536
909
  /** Prepared entity schemas have already passed. Recheck global references and only changed world geometry. */
537
910
  export function validatePreparedDocument(document, changedGroups) {
538
911
  const { seatingGroups, ...metadata } = document;
539
- const result = documentSchema
540
- .omit({ seatingGroups: true })
541
- .safeParse(metadata);
912
+ const result = documentSchema.omit({ seatingGroups: true }).safeParse(metadata);
542
913
  if (!result.success)
543
914
  return result.error.issues
544
915
  .slice(0, 50)
545
916
  .map((error) => issue(IssueCode.InvalidStructure, error.message, [], error.path.map(String).join(".")));
546
917
  if (seatingGroups.length > DocumentLimits.PhysicalSeats)
547
- return [
548
- issue(IssueCode.Limit, "Too many seating owners.", [document.mapId]),
549
- ];
918
+ return [issue(IssueCode.Limit, "Too many seating owners.", [document.mapId])];
550
919
  return structuralIssues(document, changedGroups);
551
920
  }
552
921
  export function serializePhysicalDocument(document) {