@seatmap-fyi/map-domain 0.1.0-alpha.4 → 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.
- package/dist/arc-fan-rebuild.d.ts +13 -0
- package/dist/arc-fan-rebuild.js +163 -0
- package/dist/arc-fan.d.ts +27 -0
- package/dist/arc-fan.interface.d.ts +83 -0
- package/dist/arc-fan.interface.js +30 -0
- package/dist/arc-fan.js +182 -0
- package/dist/catalog.d.ts +6 -4
- package/dist/catalog.js +31 -17
- package/dist/categories.d.ts +5 -3
- package/dist/categories.js +104 -25
- package/dist/editor-state.d.ts +4 -1
- package/dist/editor-state.js +53 -30
- package/dist/floors.d.ts +22 -0
- package/dist/floors.js +77 -0
- package/dist/geometry/boundary.d.ts +1 -1
- package/dist/geometry/boundary.js +16 -12
- package/dist/geometry/curve-warnings.d.ts +1 -1
- package/dist/geometry/curve-warnings.js +3 -5
- package/dist/geometry/decoration-bounds.d.ts +4 -0
- package/dist/geometry/decoration-bounds.js +42 -0
- package/dist/geometry/ellipse.js +4 -12
- package/dist/geometry/geometry.d.ts +6 -3
- package/dist/geometry/geometry.js +28 -30
- package/dist/geometry/layout-transform.d.ts +10 -0
- package/dist/geometry/layout-transform.interface.d.ts +6 -0
- package/dist/geometry/layout-transform.interface.js +1 -0
- package/dist/geometry/layout-transform.js +206 -0
- package/dist/geometry/polygon-curves.d.ts +17 -0
- package/dist/geometry/polygon-curves.interface.d.ts +21 -0
- package/dist/geometry/polygon-curves.interface.js +5 -0
- package/dist/geometry/polygon-curves.js +169 -0
- package/dist/geometry/primitives.d.ts +1 -1
- package/dist/geometry/primitives.js +2 -3
- package/dist/geometry/seat-shape.d.ts +1 -1
- package/dist/geometry/seat-shape.js +1 -1
- package/dist/geometry/seating-layout.d.ts +9 -1
- package/dist/geometry/seating-layout.js +66 -57
- package/dist/geometry/units.d.ts +8 -0
- package/dist/geometry/units.js +13 -0
- package/dist/geometry/venue-outline.d.ts +4 -18
- package/dist/geometry/venue-outline.interface.d.ts +23 -0
- package/dist/geometry/venue-outline.interface.js +7 -0
- package/dist/geometry/venue-outline.js +107 -49
- package/dist/identity.d.ts +3 -1
- package/dist/identity.js +32 -17
- package/dist/issues.d.ts +15 -2
- package/dist/issues.js +16 -6
- package/dist/labels.d.ts +6 -1
- package/dist/labels.js +20 -18
- package/dist/layers.d.ts +26 -0
- package/dist/layers.js +86 -0
- package/dist/media.d.ts +27 -0
- package/dist/media.js +89 -0
- package/dist/{types.d.ts → physical-document.interface.d.ts} +117 -4
- package/dist/{types.js → physical-document.interface.js} +17 -0
- package/dist/preview.d.ts +1 -1
- package/dist/preview.js +39 -29
- package/dist/reference.js +1 -1
- package/dist/row-segments.d.ts +5 -1
- package/dist/row-segments.js +10 -9
- package/dist/schema.d.ts +591 -14
- package/dist/schema.js +238 -102
- package/dist/seat-proximity.d.ts +4 -0
- package/dist/seat-proximity.js +119 -0
- package/dist/section-elevation.d.ts +5 -0
- package/dist/section-elevation.interface.d.ts +26 -0
- package/dist/section-elevation.interface.js +8 -0
- package/dist/section-elevation.js +53 -0
- package/dist/section-fill-rebuild.d.ts +10 -0
- package/dist/section-fill-rebuild.js +64 -0
- package/dist/section-fill.d.ts +84 -0
- package/dist/section-fill.interface.d.ts +94 -0
- package/dist/section-fill.interface.js +22 -0
- package/dist/section-fill.js +306 -0
- package/dist/section-growth.d.ts +11 -0
- package/dist/section-growth.interface.d.ts +12 -0
- package/dist/section-growth.interface.js +1 -0
- package/dist/section-growth.js +198 -0
- package/dist/section-layout.d.ts +95 -0
- package/dist/section-layout.interface.d.ts +8 -0
- package/dist/section-layout.interface.js +5 -0
- package/dist/section-layout.js +70 -0
- package/dist/section-outline-refit.d.ts +8 -0
- package/dist/section-outline-refit.js +246 -0
- package/dist/section-refit.d.ts +22 -0
- package/dist/section-refit.interface.d.ts +49 -0
- package/dist/section-refit.interface.js +6 -0
- package/dist/section-refit.js +179 -0
- package/dist/section-scale.d.ts +2 -0
- package/dist/section-scale.js +128 -0
- package/dist/sections.d.ts +23 -0
- package/dist/sections.js +144 -0
- package/dist/selling.d.ts +1 -1
- package/dist/selling.js +11 -26
- package/dist/spacing-repairs.d.ts +31 -0
- package/dist/spacing-repairs.js +168 -0
- package/dist/table-layout.d.ts +1 -2
- package/dist/table-layout.js +14 -22
- package/dist/validation.d.ts +7 -2
- package/dist/validation.interface.d.ts +20 -0
- package/dist/validation.interface.js +9 -0
- package/dist/validation.js +221 -85
- package/dist/wayfinding.d.ts +10 -0
- package/dist/wayfinding.interface.d.ts +52 -0
- package/dist/wayfinding.interface.js +28 -0
- package/dist/wayfinding.js +63 -0
- package/package.json +89 -4
package/dist/table-layout.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export const TableLayoutUnitM = 0.55 / 24;
|
|
1
|
+
import { LayoutUnitM } from "./geometry/units.js";
|
|
2
|
+
import { SeatingKind, TableChairDistribution, } from "./physical-document.interface.js";
|
|
4
3
|
export const TableLayoutDefaults = {
|
|
5
|
-
chairSizeM: 18 *
|
|
6
|
-
chairGapM: 7 *
|
|
4
|
+
chairSizeM: 18 * LayoutUnitM,
|
|
5
|
+
chairGapM: 7 * LayoutUnitM,
|
|
7
6
|
};
|
|
8
7
|
export const TableLayoutLimits = {
|
|
9
8
|
chairs: 40,
|
|
@@ -19,7 +18,7 @@ export const TableLayoutLimits = {
|
|
|
19
18
|
export const TableChairSides = ["top", "bottom", "left", "right"];
|
|
20
19
|
export function defaultRoundTableRecipe() {
|
|
21
20
|
return {
|
|
22
|
-
diameterM: 72 *
|
|
21
|
+
diameterM: 72 * LayoutUnitM,
|
|
23
22
|
chairGapM: TableLayoutDefaults.chairGapM,
|
|
24
23
|
startAngleDeg: 0,
|
|
25
24
|
automaticSize: true,
|
|
@@ -29,8 +28,8 @@ export function defaultRoundTableRecipe() {
|
|
|
29
28
|
export function defaultLongTableLayout() {
|
|
30
29
|
return {
|
|
31
30
|
recipe: {
|
|
32
|
-
widthM: 80 *
|
|
33
|
-
depthM: 50 *
|
|
31
|
+
widthM: 80 * LayoutUnitM,
|
|
32
|
+
depthM: 50 * LayoutUnitM,
|
|
34
33
|
chairGapM: TableLayoutDefaults.chairGapM,
|
|
35
34
|
chairDistribution: TableChairDistribution.EqualSegments,
|
|
36
35
|
},
|
|
@@ -39,13 +38,12 @@ export function defaultLongTableLayout() {
|
|
|
39
38
|
}
|
|
40
39
|
/** Shared by committed count reconciliation and placement previews. */
|
|
41
40
|
export function automaticTableRadiusM(count, arcDeg) {
|
|
42
|
-
return
|
|
41
|
+
return Math.min(160, Math.max(36, (count * 4 * 360) / arcDeg)) * LayoutUnitM;
|
|
43
42
|
}
|
|
44
43
|
export function resizeRoundTable(table) {
|
|
45
44
|
if (!table.recipe.automaticSize)
|
|
46
45
|
return table;
|
|
47
|
-
const diameterM = 2 *
|
|
48
|
-
automaticTableRadiusM(table.chairs.length, table.recipe.seatArcDeg ?? 360);
|
|
46
|
+
const diameterM = 2 * automaticTableRadiusM(table.chairs.length, table.recipe.seatArcDeg ?? 360);
|
|
49
47
|
if (diameterM === table.recipe.diameterM)
|
|
50
48
|
return table;
|
|
51
49
|
return { ...table, recipe: { ...table.recipe, diameterM } };
|
|
@@ -68,16 +66,14 @@ export function setRoundTableArc(table, requested) {
|
|
|
68
66
|
});
|
|
69
67
|
}
|
|
70
68
|
function dimensionM(requested, minimum, maximum) {
|
|
71
|
-
const units = Math.min(maximum, Math.max(minimum, Math.round(requested /
|
|
72
|
-
return units *
|
|
69
|
+
const units = Math.min(maximum, Math.max(minimum, Math.round(requested / LayoutUnitM)));
|
|
70
|
+
return units * LayoutUnitM;
|
|
73
71
|
}
|
|
74
72
|
export function setRoundTableRadius(table, requested) {
|
|
75
73
|
if (table.recipe.automaticSize)
|
|
76
74
|
return table;
|
|
77
75
|
const diameterM = 2 * dimensionM(requested, 24, 160);
|
|
78
|
-
return diameterM === table.recipe.diameterM
|
|
79
|
-
? table
|
|
80
|
-
: { ...table, recipe: { ...table.recipe, diameterM } };
|
|
76
|
+
return diameterM === table.recipe.diameterM ? table : { ...table, recipe: { ...table.recipe, diameterM } };
|
|
81
77
|
}
|
|
82
78
|
export function setLongTableDimensions(table, widthM, depthM) {
|
|
83
79
|
const recipe = {
|
|
@@ -85,10 +81,7 @@ export function setLongTableDimensions(table, widthM, depthM) {
|
|
|
85
81
|
widthM: dimensionM(widthM, 40, 320),
|
|
86
82
|
depthM: dimensionM(depthM, 30, 240),
|
|
87
83
|
};
|
|
88
|
-
return recipe.widthM === table.recipe.widthM &&
|
|
89
|
-
recipe.depthM === table.recipe.depthM
|
|
90
|
-
? table
|
|
91
|
-
: { ...table, recipe };
|
|
84
|
+
return recipe.widthM === table.recipe.widthM && recipe.depthM === table.recipe.depthM ? table : { ...table, recipe };
|
|
92
85
|
}
|
|
93
86
|
/** Shape changes retain inventory identity, personal overrides and the inactive shape settings. */
|
|
94
87
|
export function changeTableShape(table, kind) {
|
|
@@ -127,8 +120,7 @@ export function changeTableShape(table, kind) {
|
|
|
127
120
|
right: [],
|
|
128
121
|
};
|
|
129
122
|
for (const [index, side] of sides.entries()) {
|
|
130
|
-
const count = Math.floor(chairs.length / sides.length) +
|
|
131
|
-
(index < chairs.length % sides.length ? 1 : 0);
|
|
123
|
+
const count = Math.floor(chairs.length / sides.length) + (index < chairs.length % sides.length ? 1 : 0);
|
|
132
124
|
chairsBySide[side] = chairs.slice(offset, offset + count);
|
|
133
125
|
offset += count;
|
|
134
126
|
}
|
package/dist/validation.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type PhysicalDocumentV1, type UUID } from "./
|
|
1
|
+
import { type PhysicalDocumentV1, type UUID } from "./physical-document.interface.js";
|
|
2
2
|
import { type DomainIssue } from "./issues.js";
|
|
3
|
-
|
|
3
|
+
import { type AssetReadiness } from "./validation.interface.js";
|
|
4
|
+
export type { AssetReadiness } from "./validation.interface.js";
|
|
4
5
|
/** Label equality and collision ownership live here; consumers only project issues. */
|
|
5
6
|
export declare class ValidationIndex {
|
|
6
7
|
private document;
|
|
@@ -8,6 +9,7 @@ export declare class ValidationIndex {
|
|
|
8
9
|
private buckets;
|
|
9
10
|
private owners;
|
|
10
11
|
private collisions;
|
|
12
|
+
private dirtyLabels;
|
|
11
13
|
private groupIssues;
|
|
12
14
|
private seats;
|
|
13
15
|
private companions;
|
|
@@ -15,7 +17,10 @@ export declare class ValidationIndex {
|
|
|
15
17
|
constructor(document: PhysicalDocumentV1, assetReadiness?: AssetReadiness);
|
|
16
18
|
private key;
|
|
17
19
|
private refresh;
|
|
20
|
+
/** Booking collisions already explain the affected rows; do not also report their shared name. */
|
|
21
|
+
private collisionIssues;
|
|
18
22
|
private put;
|
|
23
|
+
private refreshLabels;
|
|
19
24
|
private remove;
|
|
20
25
|
private indexGroup;
|
|
21
26
|
rebuild(document: PhysicalDocumentV1): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { UUID } from "./physical-document.interface.js";
|
|
2
|
+
export type AssetReadiness = ReadonlySet<UUID>;
|
|
3
|
+
export declare enum LabelScope {
|
|
4
|
+
Row = "row",
|
|
5
|
+
Table = "table",
|
|
6
|
+
Seat = "seat",
|
|
7
|
+
Booking = "booking",
|
|
8
|
+
Section = "section",
|
|
9
|
+
Area = "area"
|
|
10
|
+
}
|
|
11
|
+
export type LabelEntry = {
|
|
12
|
+
kind: LabelScope;
|
|
13
|
+
id: UUID;
|
|
14
|
+
ownerId: UUID;
|
|
15
|
+
label: string;
|
|
16
|
+
bookingRowName?: string;
|
|
17
|
+
seatLabels?: ReadonlySet<string>;
|
|
18
|
+
field: string;
|
|
19
|
+
scope: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var LabelScope;
|
|
2
|
+
(function (LabelScope) {
|
|
3
|
+
LabelScope["Row"] = "row";
|
|
4
|
+
LabelScope["Table"] = "table";
|
|
5
|
+
LabelScope["Seat"] = "seat";
|
|
6
|
+
LabelScope["Booking"] = "booking";
|
|
7
|
+
LabelScope["Section"] = "section";
|
|
8
|
+
LabelScope["Area"] = "area";
|
|
9
|
+
})(LabelScope || (LabelScope = {}));
|
package/dist/validation.js
CHANGED
|
@@ -1,12 +1,59 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { entranceReferences, gateCatalog } from "./wayfinding.js";
|
|
2
|
+
import { EntranceKind } from "./wayfinding.interface.js";
|
|
3
|
+
import { mediaReferences } from "./media.js";
|
|
4
|
+
import { seatProximityIssues } from "./seat-proximity.js";
|
|
5
|
+
import { sectionCatalog } from "./sections.js";
|
|
6
|
+
import { categoryIssues } from "./categories.js";
|
|
7
|
+
import { SeatingKind } from "./physical-document.interface.js";
|
|
8
|
+
import { ShapeKind, DecorationKind, } from "./physical-document.interface.js";
|
|
9
|
+
import { IssueCode, IssueSeverity, issue, issueKey, missingLabelMessage } from "./issues.js";
|
|
10
|
+
import { documentCatalog, documentGroupSeats } from "./catalog.js";
|
|
5
11
|
import { rowSegments, changedSegmentGroups } from "./row-segments.js";
|
|
6
|
-
import { labelKey,
|
|
7
|
-
import { footprint, footprintInside,
|
|
12
|
+
import { labelKey, rowBookingLabel, rowDisplayLabel } from "./labels.js";
|
|
13
|
+
import { footprint, footprintInside, generatedSeats, invalidPolygon } from "./geometry/geometry.js";
|
|
8
14
|
import { curveWarnings, CurveWarningKind } from "./geometry/curve-warnings.js";
|
|
9
15
|
import { capacity } from "./schema.js";
|
|
16
|
+
import { LabelScope } from "./validation.interface.js";
|
|
17
|
+
/** Count ambiguous buyer rows using current connected identities and physical booking names. */
|
|
18
|
+
function ambiguousRowCount(entries) {
|
|
19
|
+
const parents = new Map();
|
|
20
|
+
const bookingOwners = new Map();
|
|
21
|
+
const ownerOf = (id) => {
|
|
22
|
+
let owner = id;
|
|
23
|
+
while (parents.get(owner) !== owner)
|
|
24
|
+
owner = parents.get(owner);
|
|
25
|
+
let member = id;
|
|
26
|
+
while (member !== owner) {
|
|
27
|
+
const next = parents.get(member);
|
|
28
|
+
parents.set(member, owner);
|
|
29
|
+
member = next;
|
|
30
|
+
}
|
|
31
|
+
return owner;
|
|
32
|
+
};
|
|
33
|
+
for (const entry of entries) {
|
|
34
|
+
if (!parents.has(entry.id))
|
|
35
|
+
parents.set(entry.id, entry.id);
|
|
36
|
+
if (!entry.bookingRowName)
|
|
37
|
+
continue;
|
|
38
|
+
const previous = bookingOwners.get(entry.bookingRowName);
|
|
39
|
+
if (previous !== undefined)
|
|
40
|
+
parents.set(ownerOf(entry.id), ownerOf(previous));
|
|
41
|
+
else
|
|
42
|
+
bookingOwners.set(entry.bookingRowName, entry.id);
|
|
43
|
+
}
|
|
44
|
+
const occupied = new Map();
|
|
45
|
+
let overlaps = false;
|
|
46
|
+
for (const entry of entries) {
|
|
47
|
+
const owner = ownerOf(entry.id);
|
|
48
|
+
for (const label of entry.seatLabels) {
|
|
49
|
+
const previous = occupied.get(label);
|
|
50
|
+
if (previous !== undefined && previous !== owner)
|
|
51
|
+
overlaps = true;
|
|
52
|
+
occupied.set(label, owner);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return overlaps ? new Set([...parents.keys()].map(ownerOf)).size : 0;
|
|
56
|
+
}
|
|
10
57
|
/** Label equality and collision ownership live here; consumers only project issues. */
|
|
11
58
|
export class ValidationIndex {
|
|
12
59
|
document;
|
|
@@ -14,6 +61,7 @@ export class ValidationIndex {
|
|
|
14
61
|
buckets = new Map();
|
|
15
62
|
owners = new Map();
|
|
16
63
|
collisions = new Map();
|
|
64
|
+
dirtyLabels = new Set();
|
|
17
65
|
groupIssues = new Map();
|
|
18
66
|
seats = new Map();
|
|
19
67
|
companions = new Map();
|
|
@@ -27,12 +75,49 @@ export class ValidationIndex {
|
|
|
27
75
|
return entry.scope + "\0" + labelKey(entry.label);
|
|
28
76
|
}
|
|
29
77
|
refresh(key) {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
78
|
+
const bucket = [...(this.buckets.get(key)?.values() ?? [])];
|
|
79
|
+
const entries = [...new Map(bucket.map((entry) => [entry.id, entry])).values()];
|
|
80
|
+
const rowNames = entries[0]?.kind === LabelScope.Row;
|
|
81
|
+
const count = rowNames ? ambiguousRowCount(bucket) : entries.length;
|
|
82
|
+
if (count > 1) {
|
|
83
|
+
const first = entries[0];
|
|
84
|
+
const bookingLabel = first.bookingRowName === undefined
|
|
85
|
+
? undefined
|
|
86
|
+
: [first.bookingRowName, labelKey(first.label)].filter(Boolean).join("-");
|
|
87
|
+
this.collisions.set(key, {
|
|
88
|
+
...issue(IssueCode.DuplicateLabel, rowNames
|
|
89
|
+
? `${count} rows share the name “${first.label}”`
|
|
90
|
+
: bookingLabel === undefined
|
|
91
|
+
? "Labels must be unique within their inventory scope."
|
|
92
|
+
: `Seat label “${bookingLabel}” is used more than once.`, entries.map((entry) => entry.id), entries[0].scope),
|
|
93
|
+
...(rowNames
|
|
94
|
+
? {
|
|
95
|
+
description: `${count} rows share the label “${entries[0].label}”, so buyers cannot tell which row a seat belongs to.`,
|
|
96
|
+
blocks: [],
|
|
97
|
+
}
|
|
98
|
+
: {}),
|
|
99
|
+
severity: rowNames ? IssueSeverity.Warning : IssueSeverity.Error,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
33
102
|
else
|
|
34
103
|
this.collisions.delete(key);
|
|
35
104
|
}
|
|
105
|
+
/** Booking collisions already explain the affected rows; do not also report their shared name. */
|
|
106
|
+
collisionIssues() {
|
|
107
|
+
const catalog = documentCatalog(this.document);
|
|
108
|
+
const segments = rowSegments(this.document);
|
|
109
|
+
const bookingRows = new Set();
|
|
110
|
+
for (const [key, collision] of this.collisions) {
|
|
111
|
+
if (!key.startsWith(`${LabelScope.Booking}:`))
|
|
112
|
+
continue;
|
|
113
|
+
for (const id of collision.entityIds) {
|
|
114
|
+
const rowId = catalog.seats.get(id).seat.rowId;
|
|
115
|
+
const segment = segments.get(rowId);
|
|
116
|
+
bookingRows.add(segment?.coherent ? segment.row.id : rowId);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return [...this.collisions.values()].filter((collision) => collision.severity !== IssueSeverity.Warning || !collision.entityIds.every((id) => bookingRows.has(id)));
|
|
120
|
+
}
|
|
36
121
|
put(owner, entries) {
|
|
37
122
|
this.owners.set(owner, entries);
|
|
38
123
|
for (const entry of entries) {
|
|
@@ -42,18 +127,23 @@ export class ValidationIndex {
|
|
|
42
127
|
bucket = new Map();
|
|
43
128
|
this.buckets.set(key, bucket);
|
|
44
129
|
}
|
|
45
|
-
bucket.set(entry.
|
|
46
|
-
this.
|
|
130
|
+
bucket.set(entry.field, entry);
|
|
131
|
+
this.dirtyLabels.add(key);
|
|
47
132
|
}
|
|
48
133
|
}
|
|
134
|
+
refreshLabels() {
|
|
135
|
+
for (const key of this.dirtyLabels)
|
|
136
|
+
this.refresh(key);
|
|
137
|
+
this.dirtyLabels.clear();
|
|
138
|
+
}
|
|
49
139
|
remove(owner) {
|
|
50
140
|
for (const entry of this.owners.get(owner) ?? []) {
|
|
51
141
|
const key = this.key(entry);
|
|
52
142
|
const bucket = this.buckets.get(key);
|
|
53
|
-
bucket?.delete(entry.
|
|
143
|
+
bucket?.delete(entry.field);
|
|
54
144
|
if (!bucket?.size)
|
|
55
145
|
this.buckets.delete(key);
|
|
56
|
-
this.
|
|
146
|
+
this.dirtyLabels.add(key);
|
|
57
147
|
this.seats.delete(entry.id);
|
|
58
148
|
this.companions.delete(entry.id);
|
|
59
149
|
}
|
|
@@ -63,49 +153,77 @@ export class ValidationIndex {
|
|
|
63
153
|
indexGroup(g) {
|
|
64
154
|
const entries = [];
|
|
65
155
|
const local = [];
|
|
66
|
-
const
|
|
156
|
+
const owners = sectionCatalog(this.document).owners;
|
|
157
|
+
const bookingScopes = new Map();
|
|
158
|
+
const unnamedConnectedParts = new Set();
|
|
159
|
+
const rowSeatLabels = new Map();
|
|
67
160
|
if (g.kind === SeatingKind.Straight || g.kind === SeatingKind.Curved)
|
|
68
161
|
for (let i = 0; i < g.rows.length; i++) {
|
|
69
162
|
const row = g.rows[i];
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
id: segment?.row.id ?? row.id,
|
|
75
|
-
ownerId: g.id,
|
|
76
|
-
label: segment?.row.label ??
|
|
77
|
-
row.labelOverride ??
|
|
78
|
-
sequenceLabel(g.labels.rows, i, g.rows.length),
|
|
79
|
-
scope: `rows:${section}`,
|
|
80
|
-
field: `${row.id}.label`,
|
|
163
|
+
const bookingName = labelKey(rowBookingLabel(g, i));
|
|
164
|
+
bookingScopes.set(row.id, {
|
|
165
|
+
key: `${LabelScope.Booking}:${JSON.stringify([owners.get(row.id) ?? g.floorId ?? null, bookingName])}`,
|
|
166
|
+
rowName: bookingName,
|
|
81
167
|
});
|
|
168
|
+
const segment = rowSegments(this.document).get(row.id);
|
|
169
|
+
const label = segment?.displayLabel ?? rowDisplayLabel(g, i);
|
|
170
|
+
const field = `${row.id}.label`;
|
|
171
|
+
const displayName = labelKey(label);
|
|
172
|
+
if (segment?.coherent && !bookingName)
|
|
173
|
+
unnamedConnectedParts.add(row.id);
|
|
174
|
+
if (displayName) {
|
|
175
|
+
const seatLabels = new Set();
|
|
176
|
+
rowSeatLabels.set(row.id, seatLabels);
|
|
177
|
+
entries.push({
|
|
178
|
+
seatLabels,
|
|
179
|
+
id: segment?.coherent ? segment.row.id : row.id,
|
|
180
|
+
ownerId: g.id,
|
|
181
|
+
label,
|
|
182
|
+
bookingRowName: bookingName,
|
|
183
|
+
kind: LabelScope.Row,
|
|
184
|
+
scope: `rows:${owners.get(row.id) ?? (g.floorId ? `floor:${g.floorId}` : "unsectioned")}`,
|
|
185
|
+
field,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
if (!(segment ? bookingName : displayName)) {
|
|
189
|
+
const affected = [row.id, ...row.seats.filter((seat) => !seat.gap).map((seat) => seat.id)];
|
|
190
|
+
local.push({
|
|
191
|
+
...issue(IssueCode.MissingLabel, missingLabelMessage(affected.length), affected, field),
|
|
192
|
+
severity: IssueSeverity.Warning,
|
|
193
|
+
blocks: [],
|
|
194
|
+
});
|
|
195
|
+
}
|
|
82
196
|
}
|
|
83
197
|
else
|
|
84
198
|
entries.push({
|
|
85
199
|
id: g.id,
|
|
86
200
|
ownerId: g.id,
|
|
87
|
-
label: g.labels.
|
|
88
|
-
|
|
89
|
-
|
|
201
|
+
label: g.labels.code,
|
|
202
|
+
kind: LabelScope.Table,
|
|
203
|
+
scope: "tables",
|
|
204
|
+
field: `${g.id}.labels.code`,
|
|
90
205
|
});
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const matrix = sectionOutline
|
|
97
|
-
? worldMatrices(this.document).get(g.id)
|
|
206
|
+
// Unnamed parts still display the connected sequence, but their booking check uses physical numbering.
|
|
207
|
+
const physicalBookingLabels = unnamedConnectedParts.size
|
|
208
|
+
? new Map(generatedSeats(g)
|
|
209
|
+
.filter((seat) => seat.rowId !== null && unnamedConnectedParts.has(seat.rowId))
|
|
210
|
+
.map((seat) => [seat.id, seat.bookingLabel]))
|
|
98
211
|
: undefined;
|
|
99
212
|
let outside = false;
|
|
100
213
|
for (const s of documentGroupSeats(this.document, g)) {
|
|
101
214
|
if (s.slot.gap)
|
|
102
215
|
continue;
|
|
216
|
+
if (s.rowId)
|
|
217
|
+
rowSeatLabels.get(s.rowId)?.add(labelKey(s.label));
|
|
218
|
+
const booking = s.rowId ? bookingScopes.get(s.rowId) : undefined;
|
|
103
219
|
entries.push({
|
|
104
220
|
id: s.id,
|
|
105
221
|
ownerId: g.id,
|
|
106
|
-
label: s.
|
|
107
|
-
|
|
108
|
-
|
|
222
|
+
label: physicalBookingLabels?.get(s.id) ?? s.bookingLabel,
|
|
223
|
+
kind: s.rowId ? LabelScope.Booking : LabelScope.Seat,
|
|
224
|
+
scope: booking?.key ?? `chairs:${g.id}`,
|
|
225
|
+
bookingRowName: booking?.rowName,
|
|
226
|
+
field: `${s.id}.bookingLabel`,
|
|
109
227
|
});
|
|
110
228
|
this.seats.set(s.id, {
|
|
111
229
|
groupId: g.id,
|
|
@@ -113,29 +231,23 @@ export class ValidationIndex {
|
|
|
113
231
|
});
|
|
114
232
|
if (s.slot.attributes?.companionForSeatId)
|
|
115
233
|
this.companions.set(s.id, s.slot.attributes.companionForSeatId);
|
|
116
|
-
if (
|
|
117
|
-
(sectionOutline &&
|
|
118
|
-
!footprintInside(footprint(s, matrix), sectionOutline)))
|
|
234
|
+
if (g.boundary && !footprintInside(footprint(s), g.boundary))
|
|
119
235
|
outside = true;
|
|
120
236
|
}
|
|
121
|
-
for (const e of entries)
|
|
122
|
-
if (!labelKey(e.label) || Array.from(e.label).length > 80)
|
|
237
|
+
for (const e of entries) {
|
|
238
|
+
if (e.kind !== LabelScope.Row && (!labelKey(e.label) || Array.from(e.label).length > 80)) {
|
|
123
239
|
local.push(issue(IssueCode.InvalidLabel, "Use a nonempty label of at most 80 characters.", [e.id], e.field));
|
|
240
|
+
}
|
|
241
|
+
}
|
|
124
242
|
if (outside)
|
|
125
243
|
local.push(issue(IssueCode.OutsideBoundary, "Inventory extends beyond its declared boundary. No seats have been removed.", [g.id], `${g.id}.boundary`));
|
|
126
244
|
if (g.boundary && invalidPolygon(g.boundary))
|
|
127
245
|
local.push(issue(IssueCode.InvalidBoundary, "Repair intersecting boundaries or invalid holes.", [g.id], `${g.id}.boundary`));
|
|
128
246
|
if (g.kind === SeatingKind.Curved) {
|
|
129
247
|
const warnings = curveWarnings(g.recipe, g.rows.map((r) => r.seats.length), g.seatSizeM, g.rows);
|
|
130
|
-
const overrun = warnings.find((w) => w.kind === CurveWarningKind.Overrun)
|
|
248
|
+
const overrun = warnings.find((w) => w.kind === CurveWarningKind.Overrun);
|
|
131
249
|
if (overrun)
|
|
132
250
|
local.push(issue(IssueCode.CurveOverrun, overrun.message, [g.id], `${g.id}.recipe`));
|
|
133
|
-
if (clearance)
|
|
134
|
-
local.push({
|
|
135
|
-
...issue(IssueCode.SeatClearance, clearance.message, [g.id], `${g.id}.recipe`),
|
|
136
|
-
severity: IssueSeverity.Warning,
|
|
137
|
-
blocks: [],
|
|
138
|
-
});
|
|
139
251
|
}
|
|
140
252
|
this.put(g.id, entries);
|
|
141
253
|
this.groupIssues.set(g.id, local);
|
|
@@ -145,6 +257,7 @@ export class ValidationIndex {
|
|
|
145
257
|
this.buckets.clear();
|
|
146
258
|
this.owners.clear();
|
|
147
259
|
this.collisions.clear();
|
|
260
|
+
this.dirtyLabels.clear();
|
|
148
261
|
this.groupIssues.clear();
|
|
149
262
|
this.seats.clear();
|
|
150
263
|
this.companions.clear();
|
|
@@ -153,6 +266,7 @@ export class ValidationIndex {
|
|
|
153
266
|
id: s.id,
|
|
154
267
|
ownerId: document.mapId,
|
|
155
268
|
label: s.label,
|
|
269
|
+
kind: LabelScope.Section,
|
|
156
270
|
scope: "sections",
|
|
157
271
|
field: `${s.id}.label`,
|
|
158
272
|
})));
|
|
@@ -163,45 +277,44 @@ export class ValidationIndex {
|
|
|
163
277
|
{
|
|
164
278
|
id: a.id,
|
|
165
279
|
ownerId: a.id,
|
|
166
|
-
label: a.
|
|
167
|
-
|
|
168
|
-
|
|
280
|
+
label: a.code,
|
|
281
|
+
kind: LabelScope.Area,
|
|
282
|
+
scope: `areas:${a.kind}`,
|
|
283
|
+
field: `${a.id}.code`,
|
|
169
284
|
},
|
|
170
285
|
]);
|
|
286
|
+
this.refreshLabels();
|
|
171
287
|
this.refreshBaseIssues(document);
|
|
172
288
|
}
|
|
173
289
|
refreshBaseIssues(document) {
|
|
174
290
|
this.baseIssues = [];
|
|
291
|
+
for (const logical of documentCatalog(document).segmentedRows.values()) {
|
|
292
|
+
if (!logical.coherent) {
|
|
293
|
+
this.baseIssues.push(issue(IssueCode.InvalidSegmentedRow, "Invalid segmented row", [logical.row.parts[0].rowId]));
|
|
294
|
+
}
|
|
295
|
+
}
|
|
175
296
|
for (const entity of [...document.sections, ...document.areas])
|
|
176
|
-
if (!labelKey(entity.label))
|
|
177
|
-
this.baseIssues.push(issue(IssueCode.InvalidLabel, "Use a nonempty inventory label.", [entity.id], `${entity.id}
|
|
297
|
+
if (!labelKey("code" in entity ? entity.code : entity.label))
|
|
298
|
+
this.baseIssues.push(issue(IssueCode.InvalidLabel, "Use a nonempty inventory label.", [entity.id], `${entity.id}.${"code" in entity ? "code" : "label"}`));
|
|
178
299
|
for (const s of document.sections)
|
|
179
300
|
if (s.outline && invalidPolygon(s.outline))
|
|
180
301
|
this.baseIssues.push(issue(IssueCode.InvalidBoundary, "Section boundary needs repair.", [s.id], `${s.id}.outline`));
|
|
181
302
|
for (const a of document.areas)
|
|
182
|
-
if (a.shape.kind === ShapeKind.Polygon &&
|
|
183
|
-
|
|
184
|
-
this.baseIssues.push(issue(IssueCode.InvalidBoundary, "Area boundary needs repair.", [
|
|
185
|
-
a.id,
|
|
186
|
-
]));
|
|
303
|
+
if (a.shape.kind === ShapeKind.Polygon && invalidPolygon(a.shape.boundary))
|
|
304
|
+
this.baseIssues.push(issue(IssueCode.InvalidBoundary, "Area boundary needs repair.", [a.id]));
|
|
187
305
|
for (const d of document.decorations) {
|
|
188
306
|
if (d.kind === DecorationKind.Polygon && invalidPolygon(d.boundary))
|
|
189
|
-
this.baseIssues.push(issue(IssueCode.InvalidBoundary, "Artwork boundary needs repair.", [
|
|
190
|
-
d.id,
|
|
191
|
-
]));
|
|
192
|
-
if (d.kind === DecorationKind.Image &&
|
|
193
|
-
(!document.assets.some((a) => a.id === d.assetId) ||
|
|
194
|
-
!this.assetReadiness.has(d.assetId)))
|
|
195
|
-
this.baseIssues.push(issue(IssueCode.MissingAsset, "Referenced artwork is unavailable. Retry or remove the reference.", [d.id], `${d.id}.assetId`));
|
|
307
|
+
this.baseIssues.push(issue(IssueCode.InvalidBoundary, "Artwork boundary needs repair.", [d.id]));
|
|
196
308
|
}
|
|
197
309
|
}
|
|
198
310
|
update(document, changedGroupIds, refreshMetadata = false) {
|
|
199
311
|
const before = this.document;
|
|
200
312
|
this.document = document;
|
|
201
|
-
const affected = new Set([
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
313
|
+
const affected = new Set([...changedGroupIds, ...changedSegmentGroups(before, document)]);
|
|
314
|
+
if (before.sections !== document.sections || before.collections !== document.collections) {
|
|
315
|
+
for (const group of document.seatingGroups)
|
|
316
|
+
affected.add(group.id);
|
|
317
|
+
}
|
|
205
318
|
for (const id of affected)
|
|
206
319
|
this.remove(id);
|
|
207
320
|
for (const g of document.seatingGroups)
|
|
@@ -215,6 +328,7 @@ export class ValidationIndex {
|
|
|
215
328
|
id: section.id,
|
|
216
329
|
ownerId: document.mapId,
|
|
217
330
|
label: section.label,
|
|
331
|
+
kind: LabelScope.Section,
|
|
218
332
|
scope: "sections",
|
|
219
333
|
field: `${section.id}.label`,
|
|
220
334
|
})));
|
|
@@ -223,18 +337,48 @@ export class ValidationIndex {
|
|
|
223
337
|
{
|
|
224
338
|
id: area.id,
|
|
225
339
|
ownerId: area.id,
|
|
226
|
-
label: area.
|
|
227
|
-
|
|
228
|
-
|
|
340
|
+
label: area.code,
|
|
341
|
+
kind: LabelScope.Area,
|
|
342
|
+
scope: `areas:${area.kind}`,
|
|
343
|
+
field: `${area.id}.code`,
|
|
229
344
|
},
|
|
230
345
|
]);
|
|
231
346
|
this.refreshBaseIssues(document);
|
|
232
347
|
}
|
|
348
|
+
this.refreshLabels();
|
|
233
349
|
}
|
|
234
350
|
issues() {
|
|
351
|
+
const assetIds = new Set(this.document.assets.map((asset) => asset.id));
|
|
352
|
+
const missingAssets = mediaReferences(this.document)
|
|
353
|
+
.filter((reference) => !assetIds.has(reference.assetId) || !this.assetReadiness.has(reference.assetId))
|
|
354
|
+
.map((reference) => issue(IssueCode.MissingAsset, "Referenced artwork is unavailable. Retry or remove the reference.", [reference.ownerId], reference.fieldPath));
|
|
355
|
+
const gates = gateCatalog(this.document);
|
|
356
|
+
const missingGates = [...entranceReferences(this.document)].flatMap(({ objectId, entrance }) => entrance.kind === EntranceKind.Gate && !gates.has(entrance.gateId)
|
|
357
|
+
? [issue(IssueCode.UnknownGate, "The assigned entrance gate is missing.", [objectId], `${objectId}.entrance`)]
|
|
358
|
+
: []);
|
|
359
|
+
const sections = sectionCatalog(this.document).entries;
|
|
360
|
+
const emptySections = this.document.sections
|
|
361
|
+
.filter((section) => {
|
|
362
|
+
const { capacity } = sections.get(section.id);
|
|
363
|
+
return capacity.physicalSeats + capacity.gaQuantity === 0;
|
|
364
|
+
})
|
|
365
|
+
.map((section) => section.id);
|
|
366
|
+
const sectionWarnings = emptySections.length
|
|
367
|
+
? [
|
|
368
|
+
{
|
|
369
|
+
...issue(IssueCode.EmptySection, `${emptySections.length} ${emptySections.length === 1 ? "section is" : "sections are"} empty`, emptySections),
|
|
370
|
+
severity: IssueSeverity.Warning,
|
|
371
|
+
blocks: [],
|
|
372
|
+
},
|
|
373
|
+
]
|
|
374
|
+
: [];
|
|
235
375
|
const issues = [
|
|
236
376
|
...this.baseIssues,
|
|
237
|
-
...
|
|
377
|
+
...sectionWarnings,
|
|
378
|
+
...missingGates,
|
|
379
|
+
...missingAssets,
|
|
380
|
+
...categoryIssues(this.document),
|
|
381
|
+
...this.collisionIssues(),
|
|
238
382
|
...Array.from(this.groupIssues.values()).flat(),
|
|
239
383
|
];
|
|
240
384
|
const companionStatus = new Map();
|
|
@@ -259,20 +403,12 @@ export class ValidationIndex {
|
|
|
259
403
|
if (invalid)
|
|
260
404
|
issues.push(issue(IssueCode.InvalidCompanion, "Companion reference is missing, self-referential or cyclic.", [id], `${id}.attributes.companionForSeatId`));
|
|
261
405
|
}
|
|
262
|
-
if (capacity(this.document).physicalSeats +
|
|
263
|
-
capacity(this.document).gaQuantity ===
|
|
264
|
-
0)
|
|
406
|
+
if (capacity(this.document).physicalSeats + capacity(this.document).gaQuantity === 0)
|
|
265
407
|
issues.push(issue(IssueCode.EmptyInventory, "Add inventory before assignment or publication.", [this.document.mapId]));
|
|
266
|
-
return issues.sort((a, b) => issueKey(a).localeCompare(issueKey(b)));
|
|
408
|
+
return [...issues.sort((a, b) => issueKey(a).localeCompare(issueKey(b))), ...seatProximityIssues(this.document)];
|
|
267
409
|
}
|
|
268
410
|
setAssetReadiness(assets) {
|
|
269
411
|
this.assetReadiness = assets;
|
|
270
|
-
this.baseIssues = this.baseIssues.filter((i) => i.code !== IssueCode.MissingAsset);
|
|
271
|
-
for (const d of this.document.decorations)
|
|
272
|
-
if (d.kind === DecorationKind.Image &&
|
|
273
|
-
(!this.document.assets.some((a) => a.id === d.assetId) ||
|
|
274
|
-
!assets.has(d.assetId)))
|
|
275
|
-
this.baseIssues.push(issue(IssueCode.MissingAsset, "Referenced artwork is unavailable. Retry or remove the reference.", [d.id], `${d.id}.assetId`));
|
|
276
412
|
}
|
|
277
413
|
}
|
|
278
414
|
export function validatePhysicalDocument(document, assets = new Set()) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EntranceAssignment, EntranceReference, GateEntry } from "./wayfinding.interface.js";
|
|
2
|
+
import type { PhysicalDocumentV1, UUID } from "./physical-document.interface.js";
|
|
3
|
+
/** Gate identities and their direct assignments share the physical document lifetime. */
|
|
4
|
+
export declare function gateCatalog(document: PhysicalDocumentV1): ReadonlyMap<UUID, GateEntry>;
|
|
5
|
+
export declare function entranceReferences(document: PhysicalDocumentV1): Generator<EntranceReference>;
|
|
6
|
+
/** Resolve explicit inventory instructions before the primary section's entrance. */
|
|
7
|
+
export declare function inventoryEntrance(document: PhysicalDocumentV1, id: UUID): EntranceAssignment | undefined;
|
|
8
|
+
/** Authored instructions can differ from the gate name without changing the serving gate. */
|
|
9
|
+
export declare function entranceLabel(document: PhysicalDocumentV1, entrance: EntranceAssignment): string | undefined;
|
|
10
|
+
export declare function entranceWithLabel(document: PhysicalDocumentV1, entrance: EntranceAssignment | undefined, label: string): EntranceAssignment | undefined;
|