venuekit 0.0.0-stage → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,670 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Topes de tamaño. El plano llega de afuera (el servidor del host lo valida antes de
5
+ * guardar), así que todo lo que se expande o se recorre tiene techo.
6
+ */
7
+ /** Techo de unidades vendibles totales del documento (Σ rows·cols de seatBlocks + Σ places de tables). */
8
+ declare const MAX_UNITS = 100000;
9
+ declare const MAX_ID_LENGTH = 64;
10
+ declare const MAX_NAME_LENGTH = 120;
11
+ declare const MAX_REF_LENGTH = 120;
12
+ declare const MAX_TABLE_LABEL_LENGTH = 20;
13
+ /** `background.src` es una URL (no data URL). */
14
+ declare const MAX_SRC_LENGTH = 4096;
15
+ declare const MAX_ELEMENTS = 5000;
16
+ /** Letras del inicio de fila: "ZZZ" ya da 18.278 filas posibles. */
17
+ declare const MAX_LETTERS_START = 3;
18
+ declare const MAX_SKIP = 100;
19
+ /** Tamaño de un bloque o una mesa respecto del de fábrica: sólo cambia el dibujo, nunca las unidades. */
20
+ declare const MIN_SCALE = 0.4;
21
+ declare const MAX_SCALE = 2;
22
+ /** IDs de elementos. Nunca ":" — es el separador de IDs de unidad. */
23
+ declare const idSchema: z.ZodString;
24
+ /** Sólo pasos de 90°, sentido horario. */
25
+ declare const rotationSchema: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>;
26
+ declare const transformSchema: z.ZodObject<{
27
+ x: z.ZodNumber;
28
+ y: z.ZodNumber;
29
+ rotation: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
30
+ }, z.core.$strip>;
31
+ /**
32
+ * Cómo se nombran las filas o las butacas de un bloque. Lo opcional falta en los
33
+ * planos viejos y vale lo de siempre: `alphabet` "latin" (sin Ñ) y `pattern`
34
+ * "sequential" (1, 2, 3…). `pattern` sólo vale con números; `alphabet`, sólo con letras.
35
+ */
36
+ declare const labelRuleSchema: z.ZodObject<{
37
+ kind: z.ZodEnum<{
38
+ letters: "letters";
39
+ numbers: "numbers";
40
+ }>;
41
+ start: z.ZodString;
42
+ direction: z.ZodEnum<{
43
+ ltr: "ltr";
44
+ rtl: "rtl";
45
+ }>;
46
+ skip: z.ZodOptional<z.ZodArray<z.ZodString>>;
47
+ alphabet: z.ZodOptional<z.ZodEnum<{
48
+ latin: "latin";
49
+ es: "es";
50
+ }>>;
51
+ pattern: z.ZodOptional<z.ZodEnum<{
52
+ sequential: "sequential";
53
+ odd: "odd";
54
+ even: "even";
55
+ center: "center";
56
+ }>>;
57
+ }, z.core.$strip>;
58
+ /**
59
+ * Enlace a un tipo de lugar del host. `name` sirve para re-enlazar planos guardados.
60
+ * `ref: ""` significa "sin asignar, recuerda el nombre": la pieza no está atada a
61
+ * ningún tipo, pero conserva cómo se llamaba el que tenía para el próximo re-enlace.
62
+ */
63
+ declare const placeTypeLinkSchema: z.ZodObject<{
64
+ ref: z.ZodString;
65
+ name: z.ZodString;
66
+ }, z.core.$strip>;
67
+ declare const seatBlockSchema: z.ZodObject<{
68
+ id: z.ZodString;
69
+ type: z.ZodLiteral<"seatBlock">;
70
+ transform: z.ZodObject<{
71
+ x: z.ZodNumber;
72
+ y: z.ZodNumber;
73
+ rotation: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
74
+ }, z.core.$strip>;
75
+ rows: z.ZodNumber;
76
+ cols: z.ZodNumber;
77
+ rowLabels: z.ZodObject<{
78
+ kind: z.ZodEnum<{
79
+ letters: "letters";
80
+ numbers: "numbers";
81
+ }>;
82
+ start: z.ZodString;
83
+ direction: z.ZodEnum<{
84
+ ltr: "ltr";
85
+ rtl: "rtl";
86
+ }>;
87
+ skip: z.ZodOptional<z.ZodArray<z.ZodString>>;
88
+ alphabet: z.ZodOptional<z.ZodEnum<{
89
+ latin: "latin";
90
+ es: "es";
91
+ }>>;
92
+ pattern: z.ZodOptional<z.ZodEnum<{
93
+ sequential: "sequential";
94
+ odd: "odd";
95
+ even: "even";
96
+ center: "center";
97
+ }>>;
98
+ }, z.core.$strip>;
99
+ seatLabels: z.ZodObject<{
100
+ kind: z.ZodEnum<{
101
+ letters: "letters";
102
+ numbers: "numbers";
103
+ }>;
104
+ start: z.ZodString;
105
+ direction: z.ZodEnum<{
106
+ ltr: "ltr";
107
+ rtl: "rtl";
108
+ }>;
109
+ skip: z.ZodOptional<z.ZodArray<z.ZodString>>;
110
+ alphabet: z.ZodOptional<z.ZodEnum<{
111
+ latin: "latin";
112
+ es: "es";
113
+ }>>;
114
+ pattern: z.ZodOptional<z.ZodEnum<{
115
+ sequential: "sequential";
116
+ odd: "odd";
117
+ even: "even";
118
+ center: "center";
119
+ }>>;
120
+ }, z.core.$strip>;
121
+ spacing: z.ZodObject<{
122
+ x: z.ZodNumber;
123
+ y: z.ZodNumber;
124
+ }, z.core.$strip>;
125
+ curve: z.ZodDefault<z.ZodNumber>;
126
+ scale: z.ZodDefault<z.ZodNumber>;
127
+ removed: z.ZodDefault<z.ZodArray<z.ZodString>>;
128
+ placeType: z.ZodDefault<z.ZodNullable<z.ZodObject<{
129
+ ref: z.ZodString;
130
+ name: z.ZodString;
131
+ }, z.core.$strip>>>;
132
+ }, z.core.$strip>;
133
+ declare const tableSchema: z.ZodObject<{
134
+ id: z.ZodString;
135
+ type: z.ZodLiteral<"table">;
136
+ transform: z.ZodObject<{
137
+ x: z.ZodNumber;
138
+ y: z.ZodNumber;
139
+ rotation: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
140
+ }, z.core.$strip>;
141
+ shape: z.ZodEnum<{
142
+ round: "round";
143
+ rect: "rect";
144
+ }>;
145
+ places: z.ZodNumber;
146
+ label: z.ZodString;
147
+ mode: z.ZodEnum<{
148
+ whole: "whole";
149
+ perPlace: "perPlace";
150
+ }>;
151
+ scale: z.ZodDefault<z.ZodNumber>;
152
+ placeType: z.ZodDefault<z.ZodNullable<z.ZodObject<{
153
+ ref: z.ZodString;
154
+ name: z.ZodString;
155
+ }, z.core.$strip>>>;
156
+ }, z.core.$strip>;
157
+ declare const landmarkSchema: z.ZodObject<{
158
+ id: z.ZodString;
159
+ type: z.ZodLiteral<"landmark">;
160
+ transform: z.ZodObject<{
161
+ x: z.ZodNumber;
162
+ y: z.ZodNumber;
163
+ rotation: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
164
+ }, z.core.$strip>;
165
+ kind: z.ZodString;
166
+ name: z.ZodString;
167
+ width: z.ZodNumber;
168
+ height: z.ZodNumber;
169
+ }, z.core.$strip>;
170
+ /** Dónde queda una entrada general en el plano. No tiene lugares: se vende por cantidad. */
171
+ declare const zoneSchema: z.ZodObject<{
172
+ id: z.ZodString;
173
+ type: z.ZodLiteral<"zone">;
174
+ transform: z.ZodObject<{
175
+ x: z.ZodNumber;
176
+ y: z.ZodNumber;
177
+ rotation: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
178
+ }, z.core.$strip>;
179
+ width: z.ZodNumber;
180
+ height: z.ZodNumber;
181
+ curve: z.ZodDefault<z.ZodNumber>;
182
+ placeType: z.ZodDefault<z.ZodNullable<z.ZodObject<{
183
+ ref: z.ZodString;
184
+ name: z.ZodString;
185
+ }, z.core.$strip>>>;
186
+ }, z.core.$strip>;
187
+ declare const elementSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
188
+ id: z.ZodString;
189
+ type: z.ZodLiteral<"seatBlock">;
190
+ transform: z.ZodObject<{
191
+ x: z.ZodNumber;
192
+ y: z.ZodNumber;
193
+ rotation: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
194
+ }, z.core.$strip>;
195
+ rows: z.ZodNumber;
196
+ cols: z.ZodNumber;
197
+ rowLabels: z.ZodObject<{
198
+ kind: z.ZodEnum<{
199
+ letters: "letters";
200
+ numbers: "numbers";
201
+ }>;
202
+ start: z.ZodString;
203
+ direction: z.ZodEnum<{
204
+ ltr: "ltr";
205
+ rtl: "rtl";
206
+ }>;
207
+ skip: z.ZodOptional<z.ZodArray<z.ZodString>>;
208
+ alphabet: z.ZodOptional<z.ZodEnum<{
209
+ latin: "latin";
210
+ es: "es";
211
+ }>>;
212
+ pattern: z.ZodOptional<z.ZodEnum<{
213
+ sequential: "sequential";
214
+ odd: "odd";
215
+ even: "even";
216
+ center: "center";
217
+ }>>;
218
+ }, z.core.$strip>;
219
+ seatLabels: z.ZodObject<{
220
+ kind: z.ZodEnum<{
221
+ letters: "letters";
222
+ numbers: "numbers";
223
+ }>;
224
+ start: z.ZodString;
225
+ direction: z.ZodEnum<{
226
+ ltr: "ltr";
227
+ rtl: "rtl";
228
+ }>;
229
+ skip: z.ZodOptional<z.ZodArray<z.ZodString>>;
230
+ alphabet: z.ZodOptional<z.ZodEnum<{
231
+ latin: "latin";
232
+ es: "es";
233
+ }>>;
234
+ pattern: z.ZodOptional<z.ZodEnum<{
235
+ sequential: "sequential";
236
+ odd: "odd";
237
+ even: "even";
238
+ center: "center";
239
+ }>>;
240
+ }, z.core.$strip>;
241
+ spacing: z.ZodObject<{
242
+ x: z.ZodNumber;
243
+ y: z.ZodNumber;
244
+ }, z.core.$strip>;
245
+ curve: z.ZodDefault<z.ZodNumber>;
246
+ scale: z.ZodDefault<z.ZodNumber>;
247
+ removed: z.ZodDefault<z.ZodArray<z.ZodString>>;
248
+ placeType: z.ZodDefault<z.ZodNullable<z.ZodObject<{
249
+ ref: z.ZodString;
250
+ name: z.ZodString;
251
+ }, z.core.$strip>>>;
252
+ }, z.core.$strip>, z.ZodObject<{
253
+ id: z.ZodString;
254
+ type: z.ZodLiteral<"table">;
255
+ transform: z.ZodObject<{
256
+ x: z.ZodNumber;
257
+ y: z.ZodNumber;
258
+ rotation: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
259
+ }, z.core.$strip>;
260
+ shape: z.ZodEnum<{
261
+ round: "round";
262
+ rect: "rect";
263
+ }>;
264
+ places: z.ZodNumber;
265
+ label: z.ZodString;
266
+ mode: z.ZodEnum<{
267
+ whole: "whole";
268
+ perPlace: "perPlace";
269
+ }>;
270
+ scale: z.ZodDefault<z.ZodNumber>;
271
+ placeType: z.ZodDefault<z.ZodNullable<z.ZodObject<{
272
+ ref: z.ZodString;
273
+ name: z.ZodString;
274
+ }, z.core.$strip>>>;
275
+ }, z.core.$strip>, z.ZodObject<{
276
+ id: z.ZodString;
277
+ type: z.ZodLiteral<"landmark">;
278
+ transform: z.ZodObject<{
279
+ x: z.ZodNumber;
280
+ y: z.ZodNumber;
281
+ rotation: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
282
+ }, z.core.$strip>;
283
+ kind: z.ZodString;
284
+ name: z.ZodString;
285
+ width: z.ZodNumber;
286
+ height: z.ZodNumber;
287
+ }, z.core.$strip>, z.ZodObject<{
288
+ id: z.ZodString;
289
+ type: z.ZodLiteral<"zone">;
290
+ transform: z.ZodObject<{
291
+ x: z.ZodNumber;
292
+ y: z.ZodNumber;
293
+ rotation: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
294
+ }, z.core.$strip>;
295
+ width: z.ZodNumber;
296
+ height: z.ZodNumber;
297
+ curve: z.ZodDefault<z.ZodNumber>;
298
+ placeType: z.ZodDefault<z.ZodNullable<z.ZodObject<{
299
+ ref: z.ZodString;
300
+ name: z.ZodString;
301
+ }, z.core.$strip>>>;
302
+ }, z.core.$strip>], "type">;
303
+ declare const backgroundSchema: z.ZodObject<{
304
+ src: z.ZodString;
305
+ x: z.ZodNumber;
306
+ y: z.ZodNumber;
307
+ width: z.ZodNumber;
308
+ height: z.ZodNumber;
309
+ opacity: z.ZodNumber;
310
+ locked: z.ZodBoolean;
311
+ }, z.core.$strip>;
312
+ declare const metaSchema: z.ZodObject<{
313
+ id: z.ZodString;
314
+ name: z.ZodString;
315
+ version: z.ZodLiteral<2>;
316
+ width: z.ZodNumber;
317
+ height: z.ZodNumber;
318
+ background: z.ZodDefault<z.ZodNullable<z.ZodObject<{
319
+ src: z.ZodString;
320
+ x: z.ZodNumber;
321
+ y: z.ZodNumber;
322
+ width: z.ZodNumber;
323
+ height: z.ZodNumber;
324
+ opacity: z.ZodNumber;
325
+ locked: z.ZodBoolean;
326
+ }, z.core.$strip>>>;
327
+ }, z.core.$strip>;
328
+ declare const layoutSchema: z.ZodObject<{
329
+ meta: z.ZodObject<{
330
+ id: z.ZodString;
331
+ name: z.ZodString;
332
+ version: z.ZodLiteral<2>;
333
+ width: z.ZodNumber;
334
+ height: z.ZodNumber;
335
+ background: z.ZodDefault<z.ZodNullable<z.ZodObject<{
336
+ src: z.ZodString;
337
+ x: z.ZodNumber;
338
+ y: z.ZodNumber;
339
+ width: z.ZodNumber;
340
+ height: z.ZodNumber;
341
+ opacity: z.ZodNumber;
342
+ locked: z.ZodBoolean;
343
+ }, z.core.$strip>>>;
344
+ }, z.core.$strip>;
345
+ elements: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
346
+ id: z.ZodString;
347
+ type: z.ZodLiteral<"seatBlock">;
348
+ transform: z.ZodObject<{
349
+ x: z.ZodNumber;
350
+ y: z.ZodNumber;
351
+ rotation: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
352
+ }, z.core.$strip>;
353
+ rows: z.ZodNumber;
354
+ cols: z.ZodNumber;
355
+ rowLabels: z.ZodObject<{
356
+ kind: z.ZodEnum<{
357
+ letters: "letters";
358
+ numbers: "numbers";
359
+ }>;
360
+ start: z.ZodString;
361
+ direction: z.ZodEnum<{
362
+ ltr: "ltr";
363
+ rtl: "rtl";
364
+ }>;
365
+ skip: z.ZodOptional<z.ZodArray<z.ZodString>>;
366
+ alphabet: z.ZodOptional<z.ZodEnum<{
367
+ latin: "latin";
368
+ es: "es";
369
+ }>>;
370
+ pattern: z.ZodOptional<z.ZodEnum<{
371
+ sequential: "sequential";
372
+ odd: "odd";
373
+ even: "even";
374
+ center: "center";
375
+ }>>;
376
+ }, z.core.$strip>;
377
+ seatLabels: z.ZodObject<{
378
+ kind: z.ZodEnum<{
379
+ letters: "letters";
380
+ numbers: "numbers";
381
+ }>;
382
+ start: z.ZodString;
383
+ direction: z.ZodEnum<{
384
+ ltr: "ltr";
385
+ rtl: "rtl";
386
+ }>;
387
+ skip: z.ZodOptional<z.ZodArray<z.ZodString>>;
388
+ alphabet: z.ZodOptional<z.ZodEnum<{
389
+ latin: "latin";
390
+ es: "es";
391
+ }>>;
392
+ pattern: z.ZodOptional<z.ZodEnum<{
393
+ sequential: "sequential";
394
+ odd: "odd";
395
+ even: "even";
396
+ center: "center";
397
+ }>>;
398
+ }, z.core.$strip>;
399
+ spacing: z.ZodObject<{
400
+ x: z.ZodNumber;
401
+ y: z.ZodNumber;
402
+ }, z.core.$strip>;
403
+ curve: z.ZodDefault<z.ZodNumber>;
404
+ scale: z.ZodDefault<z.ZodNumber>;
405
+ removed: z.ZodDefault<z.ZodArray<z.ZodString>>;
406
+ placeType: z.ZodDefault<z.ZodNullable<z.ZodObject<{
407
+ ref: z.ZodString;
408
+ name: z.ZodString;
409
+ }, z.core.$strip>>>;
410
+ }, z.core.$strip>, z.ZodObject<{
411
+ id: z.ZodString;
412
+ type: z.ZodLiteral<"table">;
413
+ transform: z.ZodObject<{
414
+ x: z.ZodNumber;
415
+ y: z.ZodNumber;
416
+ rotation: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
417
+ }, z.core.$strip>;
418
+ shape: z.ZodEnum<{
419
+ round: "round";
420
+ rect: "rect";
421
+ }>;
422
+ places: z.ZodNumber;
423
+ label: z.ZodString;
424
+ mode: z.ZodEnum<{
425
+ whole: "whole";
426
+ perPlace: "perPlace";
427
+ }>;
428
+ scale: z.ZodDefault<z.ZodNumber>;
429
+ placeType: z.ZodDefault<z.ZodNullable<z.ZodObject<{
430
+ ref: z.ZodString;
431
+ name: z.ZodString;
432
+ }, z.core.$strip>>>;
433
+ }, z.core.$strip>, z.ZodObject<{
434
+ id: z.ZodString;
435
+ type: z.ZodLiteral<"landmark">;
436
+ transform: z.ZodObject<{
437
+ x: z.ZodNumber;
438
+ y: z.ZodNumber;
439
+ rotation: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
440
+ }, z.core.$strip>;
441
+ kind: z.ZodString;
442
+ name: z.ZodString;
443
+ width: z.ZodNumber;
444
+ height: z.ZodNumber;
445
+ }, z.core.$strip>, z.ZodObject<{
446
+ id: z.ZodString;
447
+ type: z.ZodLiteral<"zone">;
448
+ transform: z.ZodObject<{
449
+ x: z.ZodNumber;
450
+ y: z.ZodNumber;
451
+ rotation: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
452
+ }, z.core.$strip>;
453
+ width: z.ZodNumber;
454
+ height: z.ZodNumber;
455
+ curve: z.ZodDefault<z.ZodNumber>;
456
+ placeType: z.ZodDefault<z.ZodNullable<z.ZodObject<{
457
+ ref: z.ZodString;
458
+ name: z.ZodString;
459
+ }, z.core.$strip>>>;
460
+ }, z.core.$strip>], "type">>;
461
+ }, z.core.$strip>;
462
+ /** Opciones de parseo con mensajes en español. Por parse, sin tocar la config global de Zod. */
463
+ declare const spanishParseOptions: {
464
+ error: z.core.$ZodErrorMap<z.core.$ZodIssue>;
465
+ };
466
+ type Rotation = z.infer<typeof rotationSchema>;
467
+ type Transform = z.infer<typeof transformSchema>;
468
+ type LabelRule = z.infer<typeof labelRuleSchema>;
469
+ type PlaceTypeLink = z.infer<typeof placeTypeLinkSchema>;
470
+ type SeatBlock = z.infer<typeof seatBlockSchema>;
471
+ type Table = z.infer<typeof tableSchema>;
472
+ type Landmark = z.infer<typeof landmarkSchema>;
473
+ type Zone = z.infer<typeof zoneSchema>;
474
+ type Element = z.infer<typeof elementSchema>;
475
+ type Background = z.infer<typeof backgroundSchema>;
476
+ type Layout = z.infer<typeof layoutSchema>;
477
+
478
+ type Point = {
479
+ x: number;
480
+ y: number;
481
+ };
482
+ type Box = {
483
+ minX: number;
484
+ minY: number;
485
+ maxX: number;
486
+ maxY: number;
487
+ };
488
+ /** Rota alrededor de (0,0) por `rotation` grados (horario, eje y hacia abajo) y traslada. */
489
+ declare function applyTransform(p: Point, t: Transform): Point;
490
+ declare function bbox(points: Point[]): Box;
491
+ /** Ray casting. */
492
+ declare function pointInPolygon(p: Point, polygon: [number, number][]): boolean;
493
+ declare function distance(a: Point, b: Point): number;
494
+
495
+ type SellableUnit = {
496
+ id: string;
497
+ label: string;
498
+ kind: "seat" | "place" | "table";
499
+ x: number;
500
+ y: number;
501
+ elementId: string;
502
+ /** Tipo de lugar del host al que está atada la pieza; null = "Sin asignar". */
503
+ placeTypeRef: string | null;
504
+ row?: string;
505
+ seat?: string;
506
+ rowIndex?: number;
507
+ colIndex?: number;
508
+ /** Etiqueta de la mesa ("4"), tanto en mesa entera como en sus lugares. */
509
+ table?: string;
510
+ place?: number;
511
+ };
512
+ declare function expandSeatBlock(block: SeatBlock): SellableUnit[];
513
+ declare const TABLE_RADIUS = 30;
514
+ declare const TABLE_WIDTH = 80;
515
+ declare const TABLE_HEIGHT = 40;
516
+ /** Distancia entre el borde de la mesa y el centro del lugar. */
517
+ declare const PLACE_OFFSET = 10;
518
+ declare function expandTable(table: Table): SellableUnit[];
519
+ /** Las zonas no generan unidades: una entrada general se vende por cantidad, no por lugar. */
520
+ declare function expand(layout: Layout): SellableUnit[];
521
+
522
+ /**
523
+ * Qué parte de lo vendido tocaría el cambio: una por mesa y una por (bloque, fila),
524
+ * no una por butaca, porque es lo que la persona entiende ("la mesa 4", "la fila C").
525
+ */
526
+ type LockViolation = {
527
+ reason: "table";
528
+ table: string;
529
+ } | {
530
+ reason: "row";
531
+ row: string;
532
+ elementId: string;
533
+ };
534
+ /**
535
+ * IDs bloqueados (vendidos) que `after` haría desaparecer, cambiar de etiqueta, pasar
536
+ * a otro tipo de lugar o cambiar de lugar físico adentro de la pieza (renumerar
537
+ * empezando en otra letra o número, saltear, invertir el sentido). Mover, girar,
538
+ * escalar o curvar la pieza entera no cambia nada de eso y no viola nada.
539
+ * Las zonas no cuentan: no tienen unidades vendidas por lugar.
540
+ * Orden estable: el del documento `before`.
541
+ */
542
+ declare function findLockViolations(before: Layout, after: Layout, locked: ReadonlySet<string>): LockViolation[];
543
+
544
+ type PieceKind = "seatBlock" | "roundTable" | "rectTable" | "zone" | `landmark:${string}`;
545
+ type PieceOptions = {
546
+ seats?: number;
547
+ };
548
+ declare const DEFAULT_BLOCK: {
549
+ rows: number;
550
+ cols: number;
551
+ };
552
+ declare const DEFAULT_TABLE_PLACES = 6;
553
+ declare const DEFAULT_ZONE: {
554
+ width: number;
555
+ height: number;
556
+ };
557
+ /** "b-1", "b-2"… el primero libre del prefijo. */
558
+ declare function newElementId(layout: Layout, prefix: "b" | "m" | "r" | "z"): string;
559
+ /**
560
+ * Cuánto mide una mesa de `places` lugares. La medida sale de la cantidad de gente:
561
+ * en redonda los lugares van sobre la circunferencia (el radio crece con el perímetro);
562
+ * en rectangular, repartidos arriba y abajo (crece el ancho).
563
+ */
564
+ declare function tableSize(shape: Table["shape"], places: number): {
565
+ radius: number;
566
+ } | {
567
+ width: number;
568
+ height: number;
569
+ };
570
+ /**
571
+ * Filas y columnas de un bloque de `seats` butacas, de hasta 10 por fila (12 si divide justo).
572
+ * Si ninguna medida divide justo, filas de 10 y se sacan las últimas de la última fila:
573
+ * las butacas vivas son siempre `seats`. `removed` usa los ids de unidad del bloque `blockId`
574
+ * con la numeración por defecto (filas A, B…; butacas 1, 2…).
575
+ */
576
+ declare function blockShape(seats: number, blockId: string): {
577
+ rows: number;
578
+ cols: number;
579
+ removed: string[];
580
+ };
581
+ /** Pieza nueva centrada en `at` (las mesas, zonas y referencias se anclan por el centro; el bloque, por su primera butaca). */
582
+ declare function createPiece(kind: PieceKind, id: string, at: Point, layout: Layout, opts?: PieceOptions): Element;
583
+ /**
584
+ * Copia corrida a la derecha, con otro id. La mesa toma el primer número libre y
585
+ * el bloque sigue la numeración de filas (B termina en F → la copia empieza en G),
586
+ * así quien compra no ve dos "fila A, butaca 1". Los huecos se copian fila por fila.
587
+ */
588
+ declare function duplicatePiece(el: Element, id: string, layout: Layout): Element;
589
+ declare function rotatePiece(el: Element): Element;
590
+ declare function toggleRemovedSeat(block: SeatBlock, unitId: string): SeatBlock;
591
+ /** El tamaño al paso más cercano (0.05 = 5 %), dentro de lo que acepta el esquema. */
592
+ declare function snapScale(scale: number, step?: number): number;
593
+ /**
594
+ * La pieza con otro tamaño y el mismo centro: crece o se achica en su lugar, no
595
+ * hacia un costado. El bloque se ancla en su primera butaca, así que hay que
596
+ * correrlo; la mesa ya se ancla en su centro.
597
+ */
598
+ declare function scalePiece<T extends SeatBlock | Table>(el: T, scale: number): T;
599
+
600
+ type PlaceTypeAccepts = "seats" | "tableWhole" | "tablePerPlace" | "zone";
601
+ type PlaceTypeOption = {
602
+ ref: string;
603
+ label: string;
604
+ color: string;
605
+ accepts: PlaceTypeAccepts;
606
+ /**
607
+ * Los cupos de los lotes, en cualquier orden. Ausente o vacío = sin tope. El tope es
608
+ * el mayor y cada bloque nuevo completa el tramo siguiente. Si los cupos del host
609
+ * SUMAN (lotes de 30, 50 y 100 = 180 lugares), pasá las sumas acumuladas: [30, 80, 180].
610
+ */
611
+ capacitySteps?: readonly number[];
612
+ };
613
+ declare function canAssign(el: Element, option: PlaceTypeOption): boolean;
614
+ /** El tope de lugares del tipo: el mayor de sus cupos. `null` = sin tope. */
615
+ declare function placeTypeCapacity(option: PlaceTypeOption): number | null;
616
+ /**
617
+ * Cuántos lugares trae el próximo bloque. Con lotes de cupos distintos va de a tramos
618
+ * (30 / 50 / 100 → 30, 20, 50): cada bloque completa el lote siguiente. 0 = ya está todo.
619
+ */
620
+ declare function nextBlockUnits(option: PlaceTypeOption, placed: number): number;
621
+ type CapacityViolation = {
622
+ ref: string;
623
+ label: string;
624
+ capacity: number;
625
+ units: number;
626
+ };
627
+ /**
628
+ * Los tipos que el cambio deja por encima de su cupo. Sólo cuenta lo que SUBE: un plano
629
+ * que ya venía pasado (el host bajó un cupo) se puede seguir editando, achicar o mover.
630
+ */
631
+ declare function capacityViolations(before: Layout, after: Layout, options: readonly PlaceTypeOption[]): CapacityViolation[];
632
+ /** Asigna (o con `null` quita) el tipo de lugar. La mesa toma el modo del tipo. */
633
+ declare function assignPlaceType(el: SeatBlock, option: PlaceTypeOption | null): SeatBlock;
634
+ declare function assignPlaceType(el: Table, option: PlaceTypeOption | null): Table;
635
+ declare function assignPlaceType(el: Zone, option: PlaceTypeOption | null): Zone;
636
+ declare function assignPlaceType(el: SeatBlock | Table | Zone, option: PlaceTypeOption | null): SeatBlock | Table | Zone;
637
+ /**
638
+ * Re-enlaza un plano guardado a los tipos de lugar del evento actual, por nombre.
639
+ * Los refs viejos son de otro evento: se pisan siempre. Lo que no encuentra una única
640
+ * opción compatible queda sin asignar (`ref: ""`) pero recuerda el nombre.
641
+ */
642
+ declare function rebindPlaceTypes(layout: Layout, options: readonly PlaceTypeOption[]): Layout;
643
+ type PlanSummary = {
644
+ seats: number;
645
+ tables: number;
646
+ places: number;
647
+ /** Zonas de entradas generales: no suman unidades, se venden por cantidad. */
648
+ zones: number;
649
+ types: number;
650
+ unassignedPieces: number;
651
+ byRef: Record<string, {
652
+ units: number;
653
+ seats: number;
654
+ tables: number;
655
+ places: number;
656
+ zones: number;
657
+ /**
658
+ * Nombres repetidos adentro de este tipo: quien compra vería dos "fila A, butaca 1"
659
+ * o dos "mesa 4". `seats` como `"fila:butaca"` (`"A:1"`), `tables` por número. El host
660
+ * no debería dejar publicar con algo acá.
661
+ */
662
+ duplicates: {
663
+ seats: string[];
664
+ tables: string[];
665
+ };
666
+ }>;
667
+ };
668
+ declare function summarize(layout: Layout): PlanSummary;
669
+
670
+ export { findLockViolations as $, type Table as A, type Box as B, type CapacityViolation as C, DEFAULT_BLOCK as D, type Element as E, type Transform as F, applyTransform as G, assignPlaceType as H, backgroundSchema as I, bbox as J, blockShape as K, type LabelRule as L, MAX_ELEMENTS as M, canAssign as N, capacityViolations as O, type Point as P, createPiece as Q, type Rotation as R, type SellableUnit as S, TABLE_HEIGHT as T, distance as U, duplicatePiece as V, elementSchema as W, expand as X, expandSeatBlock as Y, type Zone as Z, expandTable as _, type Layout as a, idSchema as a0, labelRuleSchema as a1, landmarkSchema as a2, layoutSchema as a3, metaSchema as a4, newElementId as a5, nextBlockUnits as a6, placeTypeCapacity as a7, placeTypeLinkSchema as a8, pointInPolygon as a9, rebindPlaceTypes as aa, rotatePiece as ab, rotationSchema as ac, scalePiece as ad, seatBlockSchema as ae, snapScale as af, spanishParseOptions as ag, summarize as ah, tableSchema as ai, tableSize as aj, toggleRemovedSeat as ak, transformSchema as al, zoneSchema as am, type Background as b, DEFAULT_TABLE_PLACES as c, DEFAULT_ZONE as d, type Landmark as e, type LockViolation as f, MAX_ID_LENGTH as g, MAX_LETTERS_START as h, MAX_NAME_LENGTH as i, MAX_REF_LENGTH as j, MAX_SCALE as k, MAX_SKIP as l, MAX_SRC_LENGTH as m, MAX_TABLE_LABEL_LENGTH as n, MAX_UNITS as o, MIN_SCALE as p, PLACE_OFFSET as q, type PieceKind as r, type PieceOptions as s, type PlaceTypeAccepts as t, type PlaceTypeLink as u, type PlaceTypeOption as v, type PlanSummary as w, type SeatBlock as x, TABLE_RADIUS as y, TABLE_WIDTH as z };