@brandlab-digital/site-core 3.15.1 → 3.16.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.
@@ -8,6 +8,10 @@
8
8
  * `planSectionSequence` is the sequencer's logic (F15), shared by `SectionSequence` in site-next and the K8 and K12
9
9
  * checks: skip what has nothing true to show, enforce the cap (only optional and recommended sections drop),
10
10
  * alternate the light tones so neighbours differ (at most one `band` and one `photo`) and write the per-page manifest.
11
+ *
12
+ * 3.16.0: the strips (the proof strip and the emergency band) and the site's signature sections don't count toward the
13
+ * cap (`UNCAPPED_SECTIONS`), so a trade band never pushes out the page's own content, and a signature section takes
14
+ * the place the site declares (`after`), up to `SIGNATURE_LIMITS` per family.
11
15
  */
12
16
  export declare const BRANDLAB_SECTION_IDS: readonly ["hero", "page-header", "article-header", "answer", "proof-strip", "emergency", "services", "local-facts", "council-rules", "nearby-jobs", "service-detail", "price-guide", "projects", "before-after", "gallery", "reviews", "comparison", "about-owner", "signature", "process", "guarantee", "licences", "partners", "team", "coverage", "area-map", "faqs", "nearby-areas", "related-services", "guides", "contact", "cta"];
13
17
  export type BrandlabSectionId = (typeof BRANDLAB_SECTION_IDS)[number];
@@ -28,6 +32,8 @@ export interface BrandlabSectionOrderEntry {
28
32
  readonly alternatives?: readonly BrandlabSectionId[];
29
33
  /** Shares one matrix position with that section: when both render they count once toward the cap. */
30
34
  readonly countsWith?: BrandlabSectionId;
35
+ /** A strip or signature section (3.16.0): it renders under the usual rules but never counts toward the cap. */
36
+ readonly uncapped?: true;
31
37
  }
32
38
  export interface BrandlabFamilyOrder {
33
39
  readonly family: BrandlabPageFamily;
@@ -36,8 +42,24 @@ export interface BrandlabFamilyOrder {
36
42
  readonly source: 'default' | 'recorded';
37
43
  readonly entries: readonly BrandlabSectionOrderEntry[];
38
44
  }
39
- /** 11 on home and service-in-suburb pages, 12 on service, region and suburb pages, 6 on hubs and company pages. */
45
+ /**
46
+ * 11 on home and service-in-suburb pages, 12 on service, region and suburb pages, 6 on hubs and company pages. The
47
+ * sections in `UNCAPPED_SECTIONS` don't count toward them.
48
+ */
40
49
  export declare const SECTION_CAPS: Readonly<Record<BrandlabPageFamily, number>>;
50
+ /**
51
+ * Sections that never count toward the cap (3.16.0): the two strips, which sit straight under the hero (the proof
52
+ * strip and a trade's emergency band), and the site's signature sections, which `SIGNATURE_LIMITS` bounds instead. The
53
+ * cap holds the page's own content sections, so a conditional trade band can't push one out.
54
+ */
55
+ export declare const UNCAPPED_SECTIONS: readonly BrandlabSectionId[];
56
+ /**
57
+ * The most signature sections a page renders (v2 §7.7: up to two on the home page and one on service pages). Families
58
+ * not listed take none, and their order has no `signature` place.
59
+ */
60
+ export declare const SIGNATURE_LIMITS: Readonly<Partial<Record<BrandlabPageFamily, number>>>;
61
+ /** A signature section's name (`data-bl-signature`): lower-case words joined by hyphens, for example `storm-line`. */
62
+ export declare const SIGNATURE_NAME_PATTERN: RegExp;
41
63
  /** The playbook trades (v2 §5, matrix part B). */
42
64
  export declare const BRANDLAB_TRADES: readonly ["building", "electrical", "exterior", "interiors", "landscaping", "plumbing", "pools", "renovations", "roofing", "tiling", "trees"];
43
65
  export type BrandlabTrade = (typeof BRANDLAB_TRADES)[number];
@@ -116,7 +138,7 @@ export type BrandlabSectionOrders = Readonly<Record<BrandlabPageFamily, Brandlab
116
138
  */
117
139
  export declare function defineSectionOrder(input?: BrandlabSectionOrderInput, tradeMap?: Readonly<Partial<Record<BrandlabTrade, BrandlabTradeSectionRules>>>): BrandlabSectionOrders;
118
140
  /** The reasons the sequencer itself skips a section. */
119
- export declare const SEQUENCER_SKIP_REASONS: readonly ["not-provided", "not-in-order", "duplicate", "cap"];
141
+ export declare const SEQUENCER_SKIP_REASONS: readonly ["not-provided", "not-in-order", "duplicate", "cap", "limit"];
120
142
  export type BrandlabSequencerSkipReason = (typeof SEQUENCER_SKIP_REASONS)[number];
121
143
  /**
122
144
  * A section's own, data-backed reason for rendering nothing: the data it needs isn't there (`no-feed-reviews`,
@@ -142,7 +164,10 @@ export declare const SECTION_MANIFEST_ATTRIBUTE = "data-bl-manifest";
142
164
  */
143
165
  export declare const SECTION_MANIFEST_FLAGS: readonly ["cap-exceeded"];
144
166
  export type BrandlabSectionManifestFlag = (typeof SECTION_MANIFEST_FLAGS)[number];
145
- /** The per-page manifest K12 reads: what was planned, what rendered with which tone, and what was skipped and why. */
167
+ /**
168
+ * The per-page manifest K12 reads: what was planned, what rendered with which tone, and what was skipped and why. A
169
+ * signature section carries its name (`signature`) and, when the site placed it, the section it follows (`after`).
170
+ */
146
171
  export interface BrandlabSectionManifest {
147
172
  readonly version: 1;
148
173
  readonly family: BrandlabPageFamily;
@@ -159,14 +184,20 @@ export interface BrandlabSectionManifest {
159
184
  readonly section: BrandlabSectionId;
160
185
  readonly requirement: BrandlabSectionRequirement;
161
186
  readonly tone: BrandlabSectionTone;
187
+ readonly signature?: string;
188
+ readonly after?: BrandlabSectionId;
162
189
  }[];
163
190
  readonly skipped: readonly {
164
191
  readonly id: BrandlabSectionId;
165
192
  readonly section: BrandlabSectionId;
166
193
  readonly requirement: BrandlabSectionRequirement | 'N';
167
194
  readonly reason: BrandlabSectionSkipReason;
195
+ readonly signature?: string;
168
196
  }[];
169
- /** The rendered sections counted toward the cap (sections sharing one matrix position count once). */
197
+ /**
198
+ * The rendered sections counted toward the cap: sections sharing one matrix position count once, and the strips and
199
+ * signature sections (`UNCAPPED_SECTIONS`) not at all.
200
+ */
170
201
  readonly counted: number;
171
202
  readonly flags: readonly BrandlabSectionManifestFlag[];
172
203
  }
@@ -177,6 +208,14 @@ export interface BrandlabSequenceCandidate {
177
208
  readonly ready?: BrandlabSectionReadiness;
178
209
  /** Defaults to `auto`. */
179
210
  readonly tone?: BrandlabSectionToneRequest;
211
+ /** A `signature` section's name (3.16.0), required for one: lower-case words joined by hyphens. */
212
+ readonly signature?: string;
213
+ /**
214
+ * Where a `signature` section goes (3.16.0): straight after this section of the family's order, or after the nearest
215
+ * section before it that renders. Not before the proof strip, and never after the CTA band. Without it, the
216
+ * signature takes the order's own `signature` place.
217
+ */
218
+ readonly after?: BrandlabSectionId;
180
219
  }
181
220
  export interface BrandlabSequencePlan {
182
221
  /** What renders, in order: the candidate's index, the planned place and the tone. */
@@ -198,7 +237,8 @@ export declare function assignSectionTones(requests: readonly BrandlabSectionTon
198
237
  * Plans one page: matches the page's candidate sections to the family order, skips what isn't ready, isn't offered or
199
238
  * isn't in the order, enforces the cap (optional, then recommended sections drop, last first; required and
200
239
  * conditional sections with data never drop: when they alone exceed the cap they all render and the manifest flags
201
- * `cap-exceeded`), assigns tones and writes the manifest.
240
+ * `cap-exceeded`; the sections in `UNCAPPED_SECTIONS` don't count), places the signature sections (3.16.0), assigns
241
+ * tones and writes the manifest.
202
242
  */
203
243
  export declare function planSectionSequence(order: BrandlabFamilyOrder, candidates: readonly BrandlabSequenceCandidate[], page?: string): BrandlabSequencePlan;
204
244
  //# sourceMappingURL=section-order.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"section-order.d.ts","sourceRoot":"","sources":["../src/section-order.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,oBAAoB,0aAiCvB,CAAA;AACV,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAA;AAErE,eAAO,MAAM,sBAAsB,kPAoBzB,CAAA;AACV,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAA;AAExE,mHAAmH;AACnH,eAAO,MAAM,6BAA6B,iCAAkC,CAAA;AAC5E,MAAM,MAAM,0BAA0B,GAAG,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvF,mGAAmG;AACnG,eAAO,MAAM,sBAAsB,iDAAkD,CAAA;AACrF,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,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AAM,CAAC;QAAC,QAAQ,CAAC,EAAE,EAAE,iBAAiB,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAA;KAAE,EAAE,CAAA;IAChI,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAA;CAC3C;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,SAAS,0BAA0B,EAAE,GAAG,mBAAmB,EAAE,CAsBzG;AAoBD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,mBAAmB,EAC1B,UAAU,EAAE,SAAS,yBAAyB,EAAE,EAChD,IAAI,CAAC,EAAE,MAAM,GACZ,oBAAoB,CAsItB"}
@@ -8,6 +8,10 @@
8
8
  * `planSectionSequence` is the sequencer's logic (F15), shared by `SectionSequence` in site-next and the K8 and K12
9
9
  * checks: skip what has nothing true to show, enforce the cap (only optional and recommended sections drop),
10
10
  * alternate the light tones so neighbours differ (at most one `band` and one `photo`) and write the per-page manifest.
11
+ *
12
+ * 3.16.0: the strips (the proof strip and the emergency band) and the site's signature sections don't count toward the
13
+ * cap (`UNCAPPED_SECTIONS`), so a trade band never pushes out the page's own content, and a signature section takes
14
+ * the place the site declares (`after`), up to `SIGNATURE_LIMITS` per family.
11
15
  */
12
16
  export const BRANDLAB_SECTION_IDS = [
13
17
  'hero',
@@ -68,7 +72,10 @@ export const BRANDLAB_PAGE_FAMILIES = [
68
72
  export const BRANDLAB_SECTION_REQUIREMENTS = ['R', 'C', 'Rec', 'O'];
69
73
  /** The section tones: two alternating grounds, one optional band and one optional photo ground. */
70
74
  export const BRANDLAB_SECTION_TONES = ['canvas', 'surface', 'band', 'photo'];
71
- /** 11 on home and service-in-suburb pages, 12 on service, region and suburb pages, 6 on hubs and company pages. */
75
+ /**
76
+ * 11 on home and service-in-suburb pages, 12 on service, region and suburb pages, 6 on hubs and company pages. The
77
+ * sections in `UNCAPPED_SECTIONS` don't count toward them.
78
+ */
72
79
  export const SECTION_CAPS = Object.freeze({
73
80
  home: 11,
74
81
  service: 12,
@@ -91,6 +98,19 @@ export const SECTION_CAPS = Object.freeze({
91
98
  emergency: 6,
92
99
  });
93
100
  const PROJECTS = ['projects', 'C', ['before-after']];
101
+ /**
102
+ * Sections that never count toward the cap (3.16.0): the two strips, which sit straight under the hero (the proof
103
+ * strip and a trade's emergency band), and the site's signature sections, which `SIGNATURE_LIMITS` bounds instead. The
104
+ * cap holds the page's own content sections, so a conditional trade band can't push one out.
105
+ */
106
+ export const UNCAPPED_SECTIONS = Object.freeze(['proof-strip', 'emergency', 'signature']);
107
+ /**
108
+ * The most signature sections a page renders (v2 §7.7: up to two on the home page and one on service pages). Families
109
+ * not listed take none, and their order has no `signature` place.
110
+ */
111
+ export const SIGNATURE_LIMITS = Object.freeze({ home: 2, service: 1 });
112
+ /** A signature section's name (`data-bl-signature`): lower-case words joined by hyphens, for example `storm-line`. */
113
+ export const SIGNATURE_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
94
114
  /** The defaults, in order. `EmergencyBand` has no number in the matrix; it sits straight after the proof strip. */
95
115
  const DEFAULT_ROWS = {
96
116
  home: [
@@ -99,6 +119,8 @@ const DEFAULT_ROWS = {
99
119
  ['emergency', 'C'],
100
120
  ['services', 'R'],
101
121
  PROJECTS,
122
+ // 3.16.0: genuine job photos beside the projects, as on the service pages.
123
+ ['gallery', 'O'],
102
124
  ['reviews', 'C'],
103
125
  ['price-guide', 'Rec'],
104
126
  ['about-owner', 'O'],
@@ -271,6 +293,7 @@ function toEntry([id, requirement, alternatives, countsWith]) {
271
293
  requirement,
272
294
  ...(alternatives ? { alternatives: Object.freeze([...alternatives]) } : {}),
273
295
  ...(countsWith ? { countsWith } : {}),
296
+ ...(UNCAPPED_SECTIONS.includes(id) ? { uncapped: true } : {}),
274
297
  });
275
298
  }
276
299
  /** The playbook trades (v2 §5, matrix part B). */
@@ -464,7 +487,7 @@ export function defineSectionOrder(input = {}, tradeMap = SECTION_ORDER_TRADE_MA
464
487
  return Object.freeze(orders);
465
488
  }
466
489
  /** The reasons the sequencer itself skips a section. */
467
- export const SEQUENCER_SKIP_REASONS = ['not-provided', 'not-in-order', 'duplicate', 'cap'];
490
+ export const SEQUENCER_SKIP_REASONS = ['not-provided', 'not-in-order', 'duplicate', 'cap', 'limit'];
468
491
  export const SECTION_READY = Object.freeze({ render: true });
469
492
  /** Whether a skip reason says the data isn't there (as opposed to the sequencer's own reasons). */
470
493
  export function isDataBackedSkipReason(reason) {
@@ -514,20 +537,46 @@ export function assignSectionTones(requests) {
514
537
  }
515
538
  /** Only optional, then recommended, sections drop for the cap; K12 needs every R and C section with data rendered. */
516
539
  const CAP_DROP_ORDER = ['O', 'Rec'];
540
+ /** Checks a signature candidate's name and place against the family's order; a mistake here is the site's code. */
541
+ function assertSignature(order, candidate) {
542
+ const where = `Signature section "${candidate.signature ?? ''}" on ${order.family} pages`;
543
+ if (typeof candidate.signature !== 'string' || !SIGNATURE_NAME_PATTERN.test(candidate.signature)) {
544
+ throw new Error(`${where}: a signature section needs a name of lower-case words joined by hyphens, for example "storm-line".`);
545
+ }
546
+ if (candidate.after === undefined)
547
+ return;
548
+ const ids = order.entries.map((entry) => entry.id);
549
+ const at = ids.indexOf(candidate.after);
550
+ if (at === -1)
551
+ throw new Error(`${where}: "${candidate.after}" is not in the order, so it can't follow it.`);
552
+ if (candidate.after === 'cta' || at === ids.length - 1)
553
+ throw new Error(`${where}: nothing follows the last section.`);
554
+ const proof = ids.indexOf('proof-strip');
555
+ if (at < Math.max(proof, 0))
556
+ throw new Error(`${where}: it can't come before the proof strip.`);
557
+ }
517
558
  /**
518
559
  * Plans one page: matches the page's candidate sections to the family order, skips what isn't ready, isn't offered or
519
560
  * isn't in the order, enforces the cap (optional, then recommended sections drop, last first; required and
520
561
  * conditional sections with data never drop: when they alone exceed the cap they all render and the manifest flags
521
- * `cap-exceeded`), assigns tones and writes the manifest.
562
+ * `cap-exceeded`; the sections in `UNCAPPED_SECTIONS` don't count), places the signature sections (3.16.0), assigns
563
+ * tones and writes the manifest.
522
564
  */
523
565
  export function planSectionSequence(order, candidates, page) {
524
566
  const skipped = [];
525
567
  const used = new Set();
526
568
  const chosen = [];
569
+ const isSignature = (candidate) => candidate.id === 'signature';
527
570
  for (const entry of order.entries) {
571
+ // Signature sections are placed after the cap, by their own rules.
572
+ if (entry.id === 'signature') {
573
+ if (!candidates.some(isSignature))
574
+ skipped.push({ id: entry.id, section: entry.id, requirement: entry.requirement, reason: 'not-provided' });
575
+ continue;
576
+ }
528
577
  const matches = candidates
529
578
  .map((candidate, index) => ({ candidate, index }))
530
- .filter(({ candidate, index }) => !used.has(index) && (candidate.id === entry.id || entry.alternatives?.includes(candidate.id)));
579
+ .filter(({ candidate, index }) => !used.has(index) && !isSignature(candidate) && (candidate.id === entry.id || entry.alternatives?.includes(candidate.id)));
531
580
  if (matches.length === 0) {
532
581
  skipped.push({ id: entry.id, section: entry.id, requirement: entry.requirement, reason: 'not-provided' });
533
582
  continue;
@@ -547,12 +596,12 @@ export function planSectionSequence(order, candidates, page) {
547
596
  }
548
597
  }
549
598
  candidates.forEach((candidate, index) => {
550
- if (!used.has(index))
599
+ if (!used.has(index) && !isSignature(candidate))
551
600
  skipped.push({ id: candidate.id, section: candidate.id, requirement: 'N', reason: 'not-in-order' });
552
601
  });
553
602
  const counted = () => {
554
603
  const ids = new Set(chosen.map((pick) => pick.entry.id));
555
- return chosen.filter((pick) => !(pick.entry.countsWith && ids.has(pick.entry.countsWith))).length;
604
+ return chosen.filter((pick) => !pick.entry.uncapped && !(pick.entry.countsWith && ids.has(pick.entry.countsWith))).length;
556
605
  };
557
606
  // Sections sharing one matrix position drop together, so every drop lowers the count by one.
558
607
  const position = (pick) => chosen.filter((other) => other === pick ||
@@ -562,7 +611,7 @@ export function planSectionSequence(order, candidates, page) {
562
611
  for (const requirement of CAP_DROP_ORDER) {
563
612
  for (let index = chosen.length - 1; index >= 0 && counted() > order.cap; index -= 1) {
564
613
  const pick = chosen[index];
565
- if (!pick || pick.entry.requirement !== requirement)
614
+ if (!pick || pick.entry.requirement !== requirement || pick.entry.uncapped)
566
615
  continue;
567
616
  const group = position(pick);
568
617
  if (!group.every((member) => CAP_DROP_ORDER.includes(member.entry.requirement)))
@@ -579,8 +628,48 @@ export function planSectionSequence(order, candidates, page) {
579
628
  index = Math.min(index, chosen.length);
580
629
  }
581
630
  }
582
- const tones = assignSectionTones(chosen.map((pick) => candidates[pick.candidate]?.tone ?? 'auto'));
583
- const rendered = chosen.map((pick, index) => ({ candidate: pick.candidate, id: pick.entry.id, tone: tones[index] ?? 'canvas' }));
631
+ // Signature sections (3.16.0): each goes straight after the section it names (or the nearest one before it that
632
+ // renders), or in the order's own `signature` place; at most SIGNATURE_LIMITS per family, never counted.
633
+ // A recorded order may leave the `signature` place out; a signature placed with `after` still renders there.
634
+ const ownPlace = order.entries.find((entry) => entry.id === 'signature');
635
+ const place = ownPlace ?? { id: 'signature', requirement: 'O', uncapped: true };
636
+ const plannedAt = (id) => order.entries.findIndex((entry) => entry.id === id);
637
+ const limit = SIGNATURE_LIMITS[order.family] ?? 0;
638
+ const placed = [];
639
+ candidates.forEach((candidate, index) => {
640
+ if (!isSignature(candidate))
641
+ return;
642
+ const signature = { signature: candidate.signature ?? '' };
643
+ if (limit === 0 || (!ownPlace && candidate.after === undefined)) {
644
+ skipped.push({ id: 'signature', section: 'signature', requirement: 'N', reason: 'not-in-order', ...signature });
645
+ return;
646
+ }
647
+ assertSignature(order, candidate);
648
+ const ready = candidate.ready ?? SECTION_READY;
649
+ if (!ready.render)
650
+ skipped.push({ id: 'signature', section: 'signature', requirement: place.requirement, reason: ready.reason, ...signature });
651
+ else if (placed.length >= limit)
652
+ skipped.push({ id: 'signature', section: 'signature', requirement: place.requirement, reason: 'limit', ...signature });
653
+ else {
654
+ // The anchor is the planned index the signature follows; the order's own place follows the section before it.
655
+ const anchor = candidate.after !== undefined ? plannedAt(candidate.after) : plannedAt('signature') - 1;
656
+ placed.push({ candidate: index, entry: place, anchor, ...(candidate.after !== undefined ? { after: candidate.after } : {}) });
657
+ }
658
+ });
659
+ const ordered = [];
660
+ const pending = [...placed];
661
+ for (const pick of chosen) {
662
+ const at = plannedAt(pick.entry.id);
663
+ // A signature anchored before this section goes in first (its anchor didn't render, or it is the place before).
664
+ while (pending.length > 0 && pending.some((item) => item.anchor < at)) {
665
+ const next = pending.findIndex((item) => item.anchor < at);
666
+ ordered.push(...pending.splice(next, 1));
667
+ }
668
+ ordered.push(pick);
669
+ }
670
+ ordered.push(...pending);
671
+ const tones = assignSectionTones(ordered.map((pick) => candidates[pick.candidate]?.tone ?? 'auto'));
672
+ const rendered = ordered.map((pick, index) => ({ candidate: pick.candidate, id: pick.entry.id, tone: tones[index] ?? 'canvas' }));
584
673
  const manifest = {
585
674
  version: 1,
586
675
  family: order.family,
@@ -588,12 +677,17 @@ export function planSectionSequence(order, candidates, page) {
588
677
  cap: order.cap,
589
678
  order: order.source,
590
679
  planned: order.entries.map((entry) => ({ id: entry.id, requirement: entry.requirement })),
591
- rendered: chosen.map((pick, index) => ({
592
- id: pick.entry.id,
593
- section: candidates[pick.candidate]?.id ?? pick.entry.id,
594
- requirement: pick.entry.requirement,
595
- tone: tones[index] ?? 'canvas',
596
- })),
680
+ rendered: ordered.map((pick, index) => {
681
+ const candidate = candidates[pick.candidate];
682
+ return {
683
+ id: pick.entry.id,
684
+ section: candidate?.id ?? pick.entry.id,
685
+ requirement: pick.entry.requirement,
686
+ tone: tones[index] ?? 'canvas',
687
+ ...(candidate && isSignature(candidate) ? { signature: candidate.signature ?? '' } : {}),
688
+ ...(pick.after !== undefined ? { after: pick.after } : {}),
689
+ };
690
+ }),
597
691
  skipped,
598
692
  counted: counted(),
599
693
  flags: counted() > order.cap ? ['cap-exceeded'] : [],
@@ -1 +1 @@
1
- {"version":3,"file":"section-order.js","sourceRoot":"","sources":["../src/section-order.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,CA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AAC,EAAE,CAAC;QACvC,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,KAAK,EAAE,KAAK,CAAC,MAAM;QACnB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;QACzF,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;YACrC,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE;YACjB,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE;YACxD,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW;YACnC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,QAAQ;SAC/B,CAAC,CAAC;QACH,OAAO;QACP,OAAO,EAAE,OAAO,EAAE;QAClB,KAAK,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE;KACrD,CAAA;IACD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAA;AAC/B,CAAC","sourcesContent":["/**\n * Section order (v2 §3.3 matrix part A; LIB §7a for hubs and company pages). Every page family has a default order of\n * sections, each required (R: skipped only when nothing true exists, and the manifest says why), conditional (C:\n * renders when its data exists), recommended (Rec) or optional (O). Sections a family doesn't use (N) are not in its\n * list. The hero or page header comes first and the CTA band last; a site may record an alternative order per family.\n * The permit note is a line inside `LocalFacts` (permit trades), not a section of its own.\n *\n * `planSectionSequence` is the sequencer's logic (F15), shared by `SectionSequence` in site-next and the K8 and K12\n * checks: skip what has nothing true to show, enforce the cap (only optional and recommended sections drop),\n * alternate the light tones so neighbours differ (at most one `band` and one `photo`) and write the per-page manifest.\n */\n\nexport const BRANDLAB_SECTION_IDS = [\n 'hero',\n 'page-header',\n 'article-header',\n 'answer',\n 'proof-strip',\n 'emergency',\n 'services',\n 'local-facts',\n 'council-rules',\n 'nearby-jobs',\n 'service-detail',\n 'price-guide',\n 'projects',\n 'before-after',\n 'gallery',\n 'reviews',\n 'comparison',\n 'about-owner',\n 'signature',\n 'process',\n 'guarantee',\n 'licences',\n 'partners',\n 'team',\n 'coverage',\n 'area-map',\n 'faqs',\n 'nearby-areas',\n 'related-services',\n 'guides',\n 'contact',\n 'cta',\n] as const\nexport type BrandlabSectionId = (typeof BRANDLAB_SECTION_IDS)[number]\n\nexport const BRANDLAB_PAGE_FAMILIES = [\n 'home',\n 'service',\n 'service-in-suburb',\n 'region',\n 'suburb',\n 'cost-guide',\n 'services-hub',\n 'locations-hub',\n 'projects-hub',\n 'project',\n 'gallery',\n 'reviews',\n 'about',\n 'faqs',\n 'contact',\n 'guides-hub',\n 'guide',\n 'council',\n 'emergency',\n] as const\nexport type BrandlabPageFamily = (typeof BRANDLAB_PAGE_FAMILIES)[number]\n\n/** R required, C conditional, Rec recommended, O optional (N, not used, is simply absent from a family's list). */\nexport const BRANDLAB_SECTION_REQUIREMENTS = ['R', 'C', 'Rec', 'O'] as const\nexport type BrandlabSectionRequirement = (typeof BRANDLAB_SECTION_REQUIREMENTS)[number]\n\n/** The section tones: two alternating grounds, one optional band and one optional photo ground. */\nexport const BRANDLAB_SECTION_TONES = ['canvas', 'surface', 'band', 'photo'] as const\nexport type BrandlabSectionTone = (typeof BRANDLAB_SECTION_TONES)[number]\n\n/** What a section asks for: a light tone the sequencer picks (`auto`), the page's one band or its one photo ground. */\nexport type BrandlabSectionToneRequest = 'auto' | 'band' | 'photo'\n\nexport interface BrandlabSectionOrderEntry {\n readonly id: BrandlabSectionId\n readonly requirement: BrandlabSectionRequirement\n /** Sections that may fill this place instead, for example `before-after` for `projects`. */\n readonly alternatives?: readonly BrandlabSectionId[]\n /** Shares one matrix position with that section: when both render they count once toward the cap. */\n readonly countsWith?: BrandlabSectionId\n}\n\nexport interface BrandlabFamilyOrder {\n readonly family: BrandlabPageFamily\n /** The most sections the page renders (v1 §7.1). */\n readonly cap: number\n readonly source: 'default' | 'recorded'\n readonly entries: readonly BrandlabSectionOrderEntry[]\n}\n\n/** 11 on home and service-in-suburb pages, 12 on service, region and suburb pages, 6 on hubs and company pages. */\nexport const SECTION_CAPS: Readonly<Record<BrandlabPageFamily, number>> = Object.freeze({\n home: 11,\n service: 12,\n 'service-in-suburb': 11,\n region: 12,\n suburb: 12,\n 'cost-guide': 12,\n 'services-hub': 6,\n 'locations-hub': 6,\n 'projects-hub': 6,\n project: 6,\n gallery: 6,\n reviews: 6,\n about: 6,\n faqs: 6,\n contact: 6,\n 'guides-hub': 6,\n guide: 6,\n council: 6,\n emergency: 6,\n})\n\ntype Row = readonly [\n BrandlabSectionId,\n BrandlabSectionRequirement,\n (readonly BrandlabSectionId[] | undefined)?,\n BrandlabSectionId?,\n]\n\nconst PROJECTS: Row = ['projects', 'C', ['before-after']]\n\n/** The defaults, in order. `EmergencyBand` has no number in the matrix; it sits straight after the proof strip. */\nconst DEFAULT_ROWS: Readonly<Record<BrandlabPageFamily, readonly Row[]>> = {\n home: [\n ['hero', 'R'],\n ['proof-strip', 'R'],\n ['emergency', 'C'],\n ['services', 'R'],\n PROJECTS,\n ['reviews', 'C'],\n ['price-guide', 'Rec'],\n ['about-owner', 'O'],\n ['signature', 'O'],\n ['process', 'O'],\n ['guarantee', 'O'],\n ['coverage', 'R'],\n ['faqs', 'Rec'],\n ['guides', 'C'],\n ['cta', 'R'],\n ],\n service: [\n ['hero', 'R'],\n ['proof-strip', 'R'],\n ['emergency', 'C'],\n ['service-detail', 'R'],\n ['price-guide', 'R'],\n PROJECTS,\n // 3.15.0: genuine job photos beside the projects, when the site has them.\n ['gallery', 'O'],\n ['reviews', 'C'],\n ['about-owner', 'O'],\n ['comparison', 'O'],\n ['signature', 'O'],\n ['process', 'O'],\n ['guarantee', 'C'],\n ['faqs', 'R'],\n ['related-services', 'C'],\n ['coverage', 'C'],\n ['guides', 'C'],\n ['cta', 'R'],\n ],\n 'service-in-suburb': [\n ['hero', 'R'],\n ['proof-strip', 'R'],\n ['emergency', 'C'],\n ['local-facts', 'R'],\n ['nearby-jobs', 'R'],\n ['price-guide', 'R'],\n ['service-detail', 'R'],\n ['reviews', 'R'],\n ['faqs', 'R'],\n ['nearby-areas', 'R'],\n ['related-services', 'R', undefined, 'nearby-areas'],\n ['cta', 'R'],\n ],\n region: [\n ['hero', 'R'],\n ['proof-strip', 'R'],\n ['service-detail', 'R'],\n ['services', 'R'],\n PROJECTS,\n ['reviews', 'C'],\n ['price-guide', 'C'],\n ['coverage', 'R'],\n ['faqs', 'R'],\n ['area-map', 'O'],\n ['cta', 'R'],\n ],\n suburb: [\n ['hero', 'R'],\n ['proof-strip', 'R'],\n ['local-facts', 'R'],\n ['services', 'R'],\n ['price-guide', 'C'],\n ['nearby-jobs', 'C'],\n ['reviews', 'C'],\n ['faqs', 'R'],\n // 3.15.0: the nearest served suburbs (NearbyAreas), then the locator map (AreaMap). Conditional: L3 holds any\n // neighbour list to real distance but no check needs one on a suburb page, so it renders when there are neighbours.\n ['nearby-areas', 'C'],\n ['area-map', 'R'],\n ['cta', 'R'],\n ],\n 'cost-guide': [\n ['article-header', 'R'],\n ['answer', 'R'],\n ['price-guide', 'R'],\n ['service-detail', 'R'],\n ['comparison', 'O'],\n PROJECTS,\n ['faqs', 'Rec'],\n ['cta', 'R'],\n ],\n 'services-hub': [\n ['page-header', 'R'],\n ['services', 'R'],\n ['reviews', 'C'],\n ['cta', 'R'],\n ],\n 'locations-hub': [\n ['page-header', 'R'],\n ['coverage', 'R'],\n ['cta', 'R'],\n ],\n 'projects-hub': [\n ['page-header', 'R'],\n ['projects', 'R'],\n ['reviews', 'C'],\n ['cta', 'R'],\n ],\n project: [\n ['hero', 'R', ['page-header']],\n ['gallery', 'R'],\n ['service-detail', 'R'],\n ['reviews', 'C'],\n ['related-services', 'R'],\n ['cta', 'R'],\n ],\n gallery: [\n ['page-header', 'R'],\n ['gallery', 'R'],\n ['cta', 'R'],\n ],\n reviews: [\n ['page-header', 'R'],\n ['reviews', 'R'],\n ['cta', 'R'],\n ],\n about: [\n ['page-header', 'R'],\n ['about-owner', 'R'],\n ['licences', 'C'],\n ['partners', 'C'],\n ['reviews', 'C'],\n ['team', 'O'],\n ['cta', 'R'],\n ],\n faqs: [\n ['page-header', 'R'],\n ['faqs', 'R'],\n ['cta', 'R'],\n ],\n // The contact page is the page header and the contact block, and nothing else (K12-contact).\n contact: [\n ['page-header', 'R'],\n ['contact', 'R'],\n ],\n 'guides-hub': [\n ['page-header', 'R'],\n ['guides', 'R'],\n ['cta', 'R'],\n ],\n guide: [\n ['article-header', 'R'],\n ['service-detail', 'R'],\n ['cta', 'R'],\n ],\n // `council-rules` (3.15.0): the council register's rule, fees, source and check date (CouncilRules). Optional by\n // default; a permit trade makes it conditional on a current register record.\n council: [\n ['page-header', 'R'],\n ['council-rules', 'O'],\n ['service-detail', 'R'],\n ['cta', 'R'],\n ],\n // 3.15.0: optional FAQs before the CTA band (AA's emergency tree work page answers storm and after-hours questions).\n emergency: [\n ['hero', 'R'],\n ['emergency', 'R'],\n ['service-detail', 'R'],\n ['reviews', 'C'],\n ['faqs', 'O'],\n ['cta', 'R'],\n ],\n}\n\nfunction toEntry([id, requirement, alternatives, countsWith]: Row): BrandlabSectionOrderEntry {\n return Object.freeze({\n id,\n requirement,\n ...(alternatives ? { alternatives: Object.freeze([...alternatives]) } : {}),\n ...(countsWith ? { countsWith } : {}),\n })\n}\n\n/** The playbook trades (v2 §5, matrix part B). */\nexport const BRANDLAB_TRADES = [\n 'building',\n 'electrical',\n 'exterior',\n 'interiors',\n 'landscaping',\n 'plumbing',\n 'pools',\n 'renovations',\n 'roofing',\n 'tiling',\n 'trees',\n] as const\nexport type BrandlabTrade = (typeof BRANDLAB_TRADES)[number]\n\n/** A trade's changes to the defaults: a new requirement for a section already in a family's order. */\nexport type BrandlabTradeSectionRules = Readonly<\n Partial<Record<BrandlabPageFamily, Readonly<Partial<Record<BrandlabSectionId, BrandlabSectionRequirement>>>>>\n>\n\n/**\n * Lines inside a section that a trade can require (3.14.0): the permit note is `LocalFacts`' `permit` slot; the\n * qualifications and insurance lines stand in for a licence block where the trade has no licence. A component marks\n * each slot it renders with `data-bl-slot=\"<slot>\"`; when its data is missing or stale it renders nothing for the slot\n * and lists `<slot>:<no-… reason>` in the section's `data-bl-slot-skip` attribute (check K12-slots reads both).\n */\nexport const BRANDLAB_SECTION_SLOTS = ['permit', 'qualifications', 'insurance', 'licence'] as const\nexport type BrandlabSectionSlot = (typeof BRANDLAB_SECTION_SLOTS)[number]\n\nexport const SECTION_SLOT_ATTRIBUTE = 'data-bl-slot'\nexport const SECTION_SLOT_SKIP_ATTRIBUTE = 'data-bl-slot-skip'\n\n/** A slot left empty for a data-backed reason, such as `{ slot: 'permit', reason: 'no-current-council-record' }`. */\nexport interface BrandlabSectionSlotSkip {\n readonly slot: BrandlabSectionSlot\n readonly reason: `no-${string}`\n}\n\n/** The `data-bl-slot-skip` value: space-separated `slot:reason` pairs. */\nexport function formatSectionSlotSkips(skips: readonly BrandlabSectionSlotSkip[]): string {\n return skips\n .map((skip) => {\n if (!(BRANDLAB_SECTION_SLOTS as readonly string[]).includes(skip.slot)) throw new Error(`Unknown section slot \"${skip.slot}\".`)\n if (!/^no-[a-z0-9]+(?:-[a-z0-9]+)*$/.test(skip.reason)) throw new Error(`A slot skip reason says what data is missing: \"no-…\", not \"${skip.reason}\".`)\n return `${skip.slot}:${skip.reason}`\n })\n .join(' ')\n}\n\n/** Reads a `data-bl-slot-skip` value; pairs that are not `slot:no-…` are ignored. */\nexport function parseSectionSlotSkips(value: string | undefined): BrandlabSectionSlotSkip[] {\n return (value ?? '')\n .split(/\\s+/)\n .flatMap((pair): BrandlabSectionSlotSkip[] => {\n const [slot, reason] = pair.split(':')\n return slot && reason && (BRANDLAB_SECTION_SLOTS as readonly string[]).includes(slot) && /^no-[a-z0-9]+(?:-[a-z0-9]+)*$/.test(reason)\n ? [{ slot: slot as BrandlabSectionSlot, reason: reason as `no-${string}` }]\n : []\n })\n}\n\n/** Slots a trade requires inside a family's sections. */\nexport type BrandlabTradeSlotRules = Readonly<\n Partial<Record<BrandlabPageFamily, Readonly<Partial<Record<BrandlabSectionId, readonly BrandlabSectionSlot[]>>>>>\n>\n\n/**\n * One trade's column of matrix part B: its credential block (a licence block, or qualifications and insurance where\n * the trade has no licence), its section requirement changes and the slots it requires. `unconfirmed` trades keep the\n * defaults until their playbook's rules are confirmed (licence classes, permit notes and emergency work are\n * \"inferred, confirm\" in the matrix).\n */\nexport interface BrandlabTradeProfile {\n readonly credentials: 'licence' | 'qualifications' | 'unconfirmed'\n readonly sections: BrandlabTradeSectionRules\n readonly slots: BrandlabTradeSlotRules\n /** Where the rules come from. */\n readonly source: string\n}\n\nconst UNCONFIRMED: BrandlabTradeProfile = Object.freeze({\n credentials: 'unconfirmed',\n sections: Object.freeze({}),\n slots: Object.freeze({}),\n source: 'Defaults until the playbook rules are confirmed (v2 §3.4).',\n})\n\n/** Validates trade profiles: requirement changes and slots name sections the family uses, and known slots. */\nexport function defineTradeProfiles<const T extends Readonly<Record<BrandlabTrade, BrandlabTradeProfile>>>(profiles: T): T {\n for (const [trade, profile] of Object.entries(profiles) as [string, BrandlabTradeProfile][]) {\n if (!(BRANDLAB_TRADES as readonly string[]).includes(trade)) throw new Error(`Unknown trade \"${trade}\".`)\n if (!['licence', 'qualifications', 'unconfirmed'].includes(profile.credentials)) {\n throw new Error(`Trade ${trade}: credentials must be licence, qualifications or unconfirmed.`)\n }\n const check = (rules: object, kind: string, value: (sectionValue: unknown, where: string) => void) => {\n for (const [family, sections] of Object.entries(rules)) {\n const rows = DEFAULT_ROWS[family as BrandlabPageFamily]\n if (!rows) throw new Error(`Trade ${trade}: unknown page family \"${family}\" in its ${kind}.`)\n for (const [section, sectionValue] of Object.entries(sections as object)) {\n if (!rows.some((row) => row[0] === section)) throw new Error(`Trade ${trade}: ${family} pages have no \"${section}\" section for its ${kind}.`)\n value(sectionValue, `Trade ${trade}: ${family} \"${section}\"`)\n }\n }\n }\n check(profile.sections, 'requirements', (requirement, where) => {\n if (!(BRANDLAB_SECTION_REQUIREMENTS as readonly unknown[]).includes(requirement)) throw new Error(`${where} has an unknown requirement.`)\n })\n check(profile.slots, 'slots', (slots, where) => {\n if (!Array.isArray(slots) || slots.length === 0 || slots.some((slot) => !(BRANDLAB_SECTION_SLOTS as readonly unknown[]).includes(slot))) {\n throw new Error(`${where} lists an unknown slot; slots are ${BRANDLAB_SECTION_SLOTS.join(', ')}.`)\n }\n })\n }\n return profiles\n}\n\n/**\n * Matrix part B, as confirmed (3.14.0). Trees: no NSW licence for tree work, so the licence block is optional and the\n * about page's owner block carries the qualifications and insurance lines; the council permit note is required on\n * suburb and service-in-suburb pages (hidden, with its reason, once the council record is stale), and council pages\n * show the council's rules whenever the register holds a current record (3.15.0). The other trades\n * stay on the defaults until their rules are confirmed.\n */\nexport const SECTION_TRADE_PROFILES: Readonly<Record<BrandlabTrade, BrandlabTradeProfile>> = Object.freeze(\n defineTradeProfiles({\n ...(Object.fromEntries(BRANDLAB_TRADES.map((trade) => [trade, UNCONFIRMED])) as Record<BrandlabTrade, BrandlabTradeProfile>),\n trees: Object.freeze({\n credentials: 'qualifications',\n sections: Object.freeze({ about: Object.freeze({ licences: 'O' }), council: Object.freeze({ 'council-rules': 'C' }) }),\n slots: Object.freeze({\n suburb: Object.freeze({ 'local-facts': Object.freeze(['permit'] as const) }),\n 'service-in-suburb': Object.freeze({ 'local-facts': Object.freeze(['permit'] as const) }),\n about: Object.freeze({ 'about-owner': Object.freeze(['qualifications', 'insurance'] as const) }),\n }),\n source: 'v2 §3.4 matrix part B (trees row); playbook-trees §2.3 (permit slot, rows 2 and 6), §2.4 (council register) and §1.7 (no tree-work licence).',\n }),\n }),\n)\n\n/** The trade map (matrix part B): each trade's section requirement changes, from `SECTION_TRADE_PROFILES`. */\nexport const SECTION_ORDER_TRADE_MAP: Readonly<Record<BrandlabTrade, BrandlabTradeSectionRules>> = Object.freeze(\n Object.fromEntries(BRANDLAB_TRADES.map((trade) => [trade, SECTION_TRADE_PROFILES[trade].sections])) as Record<BrandlabTrade, BrandlabTradeSectionRules>,\n)\n\n/** The slots a trade requires on a family's pages, section by section, in the order the profile lists them. */\nexport function requiredSectionSlots(\n family: BrandlabPageFamily,\n trade?: BrandlabTrade,\n profiles: Readonly<Partial<Record<BrandlabTrade, BrandlabTradeProfile>>> = SECTION_TRADE_PROFILES,\n): { readonly section: BrandlabSectionId; readonly slot: BrandlabSectionSlot }[] {\n const rules = trade ? profiles[trade]?.slots[family] : undefined\n if (!rules) return []\n return (Object.entries(rules) as [BrandlabSectionId, readonly BrandlabSectionSlot[]][]).flatMap(([section, slots]) =>\n slots.map((slot) => ({ section, slot })),\n )\n}\n\n/** A family's default order, with the trade's rules applied. */\nexport function defaultSectionOrder(\n family: BrandlabPageFamily,\n trade?: BrandlabTrade,\n tradeMap: Readonly<Partial<Record<BrandlabTrade, BrandlabTradeSectionRules>>> = SECTION_ORDER_TRADE_MAP,\n): BrandlabFamilyOrder {\n const rows = DEFAULT_ROWS[family]\n if (!rows) throw new Error(`Unknown page family \"${family}\".`)\n const rules = trade ? tradeMap[trade]?.[family] : undefined\n const entries = rows.map((row) => {\n const requirement = rules?.[row[0]]\n return toEntry(requirement ? [row[0], requirement, row[2], row[3]] : row)\n })\n return Object.freeze({ family, cap: SECTION_CAPS[family], source: 'default', entries: Object.freeze(entries) })\n}\n\n/** A site's recorded alternative order for one family (LIB §7a), with the decision that recorded it. */\nexport interface BrandlabRecordedSectionOrder {\n readonly order: readonly BrandlabSectionId[]\n /** Who decided and why, for example \"Romie, 19 Oct 2026: reviews before prices for Superior\". */\n readonly decision: string\n /** YYYY-MM-DD. */\n readonly recordedOn: string\n}\n\nexport interface BrandlabSectionOrderInput {\n readonly trade?: BrandlabTrade\n readonly recorded?: Readonly<Partial<Record<BrandlabPageFamily, BrandlabRecordedSectionOrder>>>\n}\n\nexport type BrandlabSectionOrders = Readonly<Record<BrandlabPageFamily, BrandlabFamilyOrder>>\n\nconst ISO_DATE = /^\\d{4}-\\d{2}-\\d{2}$/\n\nfunction recordedOrder(base: BrandlabFamilyOrder, recorded: BrandlabRecordedSectionOrder): BrandlabFamilyOrder {\n const family = base.family\n const fail = (detail: string): never => {\n throw new Error(`Recorded section order for ${family}: ${detail}`)\n }\n if (family === 'contact') fail('the contact page is the page header and the contact block, and nothing else.')\n if (typeof recorded.decision !== 'string' || !recorded.decision.trim()) fail('decision must say who decided and why.')\n if (typeof recorded.recordedOn !== 'string' || !ISO_DATE.test(recorded.recordedOn) || Number.isNaN(Date.parse(recorded.recordedOn))) {\n fail('recordedOn must be a YYYY-MM-DD date.')\n }\n if (!Array.isArray(recorded.order) || recorded.order.length === 0) fail('order must list the sections.')\n const byId = new Map(base.entries.map((entry) => [entry.id, entry]))\n const seen = new Set<string>()\n for (const id of recorded.order) {\n if (!byId.has(id)) fail(`\"${id}\" is not used on ${family} pages.`)\n if (seen.has(id)) fail(`\"${id}\" appears twice.`)\n seen.add(id)\n }\n for (const entry of base.entries) {\n if ((entry.requirement === 'R' || entry.requirement === 'C') && !seen.has(entry.id)) {\n fail(`\"${entry.id}\" is ${entry.requirement === 'R' ? 'required' : 'conditional'} and must stay in the order.`)\n }\n }\n const first = base.entries[0]?.id\n const last = base.entries[base.entries.length - 1]?.id\n if (recorded.order[0] !== first) fail(`\"${first}\" comes first.`)\n if (last === 'cta' && recorded.order[recorded.order.length - 1] !== 'cta') fail('the CTA band comes last.')\n const proof = recorded.order.indexOf('proof-strip')\n if (proof >= 5) fail('the proof strip stays within the first five sections.')\n return Object.freeze({\n family,\n cap: base.cap,\n source: 'recorded',\n entries: Object.freeze(recorded.order.map((id) => byId.get(id) as BrandlabSectionOrderEntry)),\n })\n}\n\n/**\n * Declares a site's section orders (`src/data/strategy.ts`): the defaults for every family, the trade's rules and any\n * recorded alternative orders. A recorded order keeps every required and conditional section, the first section\n * first, the CTA band last and the proof strip within the first five; the contact page can't be reordered.\n */\nexport function defineSectionOrder(\n input: BrandlabSectionOrderInput = {},\n tradeMap: Readonly<Partial<Record<BrandlabTrade, BrandlabTradeSectionRules>>> = SECTION_ORDER_TRADE_MAP,\n): BrandlabSectionOrders {\n if (input.trade !== undefined && !(BRANDLAB_TRADES as readonly string[]).includes(input.trade)) {\n throw new Error(`Unknown trade \"${input.trade}\".`)\n }\n for (const family of Object.keys(input.recorded ?? {})) {\n if (!(BRANDLAB_PAGE_FAMILIES as readonly string[]).includes(family)) throw new Error(`Unknown page family \"${family}\".`)\n }\n const orders = Object.fromEntries(\n BRANDLAB_PAGE_FAMILIES.map((family) => {\n const base = defaultSectionOrder(family, input.trade, tradeMap)\n const recorded = input.recorded?.[family]\n return [family, recorded ? recordedOrder(base, recorded) : base]\n }),\n ) as Record<BrandlabPageFamily, BrandlabFamilyOrder>\n return Object.freeze(orders)\n}\n\n/** The reasons the sequencer itself skips a section. */\nexport const SEQUENCER_SKIP_REASONS = ['not-provided', 'not-in-order', 'duplicate', 'cap'] as const\nexport type BrandlabSequencerSkipReason = (typeof SEQUENCER_SKIP_REASONS)[number]\n\n/**\n * A section's own, data-backed reason for rendering nothing: the data it needs isn't there (`no-feed-reviews`,\n * `no-approved-prices`, `no-jobs-nearby`, `no-faqs` and so on), or its content belongs in the hero checklist.\n */\nexport type BrandlabSectionDataReason = `no-${string}` | 'merge-into-hero-checklist'\nexport type BrandlabSectionSkipReason = BrandlabSectionDataReason | BrandlabSequencerSkipReason\n\n/** A section's guard, computed from the same data it renders: render, or render nothing and say why. */\nexport type BrandlabSectionReadiness =\n | { readonly render: true }\n | { readonly render: false; readonly reason: BrandlabSectionDataReason }\n\nexport const SECTION_READY: BrandlabSectionReadiness = Object.freeze({ render: true })\n\n/** Whether a skip reason says the data isn't there (as opposed to the sequencer's own reasons). */\nexport function isDataBackedSkipReason(reason: string): reason is BrandlabSectionDataReason {\n return reason === 'merge-into-hero-checklist' || /^no-[a-z0-9]+(?:-[a-z0-9]+)*$/.test(reason)\n}\n\n/** The attribute on the manifest's `<script type=\"application/json\">`. */\nexport const SECTION_MANIFEST_ATTRIBUTE = 'data-bl-manifest'\n\n/**\n * Page-level notes in the manifest. `cap-exceeded`: the required and conditional sections with data are more than\n * the cap, so they all render (neither drops for the cap) and the page is over its cap.\n */\nexport const SECTION_MANIFEST_FLAGS = ['cap-exceeded'] as const\nexport type BrandlabSectionManifestFlag = (typeof SECTION_MANIFEST_FLAGS)[number]\n\n/** The per-page manifest K12 reads: what was planned, what rendered with which tone, and what was skipped and why. */\nexport interface BrandlabSectionManifest {\n readonly version: 1\n readonly family: BrandlabPageFamily\n readonly page?: string\n readonly cap: number\n readonly order: 'default' | 'recorded'\n readonly planned: readonly { readonly id: BrandlabSectionId; readonly requirement: BrandlabSectionRequirement }[]\n /** `id` is the planned place; `section` is what filled it (an alternative such as `before-after`, or the same id). */\n readonly rendered: readonly {\n readonly id: BrandlabSectionId\n readonly section: BrandlabSectionId\n readonly requirement: BrandlabSectionRequirement\n readonly tone: BrandlabSectionTone\n }[]\n readonly skipped: readonly {\n readonly id: BrandlabSectionId\n readonly section: BrandlabSectionId\n readonly requirement: BrandlabSectionRequirement | 'N'\n readonly reason: BrandlabSectionSkipReason\n }[]\n /** The rendered sections counted toward the cap (sections sharing one matrix position count once). */\n readonly counted: number\n readonly flags: readonly BrandlabSectionManifestFlag[]\n}\n\n/** One section a page offers the sequencer. */\nexport interface BrandlabSequenceCandidate {\n readonly id: BrandlabSectionId\n /** Defaults to ready. */\n readonly ready?: BrandlabSectionReadiness\n /** Defaults to `auto`. */\n readonly tone?: BrandlabSectionToneRequest\n}\n\nexport interface BrandlabSequencePlan {\n /** What renders, in order: the candidate's index, the planned place and the tone. */\n readonly rendered: readonly { readonly candidate: number; readonly id: BrandlabSectionId; readonly tone: BrandlabSectionTone }[]\n readonly manifest: BrandlabSectionManifest\n}\n\n/**\n * Tones for the sections that render, in order. `auto` sections alternate canvas and surface, so neighbours never\n * share a background; after a band or photo section the next light tone is the one the last light section didn't\n * have (Omega's `alternateTones`). Only the first `band` request and the first `photo` request are honoured, and\n * never twice in a row; later requests fall back to the light tones.\n */\nexport function assignSectionTones(requests: readonly BrandlabSectionToneRequest[]): BrandlabSectionTone[] {\n const tones: BrandlabSectionTone[] = []\n let previous: BrandlabSectionTone | undefined\n let lastLight: 'canvas' | 'surface' = 'surface'\n let bandUsed = false\n let photoUsed = false\n for (const request of requests) {\n let next: BrandlabSectionTone\n if (request === 'band' && !bandUsed && previous !== 'band') {\n next = 'band'\n bandUsed = true\n } else if (request === 'photo' && !photoUsed && previous !== 'photo') {\n next = 'photo'\n photoUsed = true\n } else if (previous === 'canvas') next = 'surface'\n else if (previous === 'surface') next = 'canvas'\n else next = lastLight === 'canvas' ? 'surface' : 'canvas'\n tones.push(next)\n previous = next\n if (next === 'canvas' || next === 'surface') lastLight = next\n }\n return tones\n}\n\n/** Only optional, then recommended, sections drop for the cap; K12 needs every R and C section with data rendered. */\nconst CAP_DROP_ORDER: readonly BrandlabSectionRequirement[] = ['O', 'Rec']\n\n/**\n * Plans one page: matches the page's candidate sections to the family order, skips what isn't ready, isn't offered or\n * isn't in the order, enforces the cap (optional, then recommended sections drop, last first; required and\n * conditional sections with data never drop: when they alone exceed the cap they all render and the manifest flags\n * `cap-exceeded`), assigns tones and writes the manifest.\n */\nexport function planSectionSequence(\n order: BrandlabFamilyOrder,\n candidates: readonly BrandlabSequenceCandidate[],\n page?: string,\n): BrandlabSequencePlan {\n const skipped: BrandlabSectionManifest['skipped'][number][] = []\n const used = new Set<number>()\n const chosen: { candidate: number; entry: BrandlabSectionOrderEntry }[] = []\n\n for (const entry of order.entries) {\n const matches = candidates\n .map((candidate, index) => ({ candidate, index }))\n .filter(\n ({ candidate, index }) =>\n !used.has(index) && (candidate.id === entry.id || entry.alternatives?.includes(candidate.id)),\n )\n if (matches.length === 0) {\n skipped.push({ id: entry.id, section: entry.id, requirement: entry.requirement, reason: 'not-provided' })\n continue\n }\n let filled = false\n for (const { candidate, index } of matches) {\n used.add(index)\n const ready = candidate.ready ?? SECTION_READY\n if (filled) skipped.push({ id: entry.id, section: candidate.id, requirement: entry.requirement, reason: 'duplicate' })\n else if (!ready.render) skipped.push({ id: entry.id, section: candidate.id, requirement: entry.requirement, reason: ready.reason })\n else {\n chosen.push({ candidate: index, entry })\n filled = true\n }\n }\n }\n\n candidates.forEach((candidate, index) => {\n if (!used.has(index)) skipped.push({ id: candidate.id, section: candidate.id, requirement: 'N', reason: 'not-in-order' })\n })\n\n const counted = () => {\n const ids = new Set(chosen.map((pick) => pick.entry.id))\n return chosen.filter((pick) => !(pick.entry.countsWith && ids.has(pick.entry.countsWith))).length\n }\n // Sections sharing one matrix position drop together, so every drop lowers the count by one.\n const position = (pick: (typeof chosen)[number]) =>\n chosen.filter(\n (other) =>\n other === pick ||\n other.entry.countsWith === pick.entry.id ||\n pick.entry.countsWith === other.entry.id ||\n (pick.entry.countsWith !== undefined && other.entry.countsWith === pick.entry.countsWith),\n )\n for (const requirement of CAP_DROP_ORDER) {\n for (let index = chosen.length - 1; index >= 0 && counted() > order.cap; index -= 1) {\n const pick = chosen[index]\n if (!pick || pick.entry.requirement !== requirement) continue\n const group = position(pick)\n if (!group.every((member) => CAP_DROP_ORDER.includes(member.entry.requirement))) continue\n for (const member of group) {\n skipped.push({\n id: member.entry.id,\n section: candidates[member.candidate]?.id ?? member.entry.id,\n requirement: member.entry.requirement,\n reason: 'cap',\n })\n chosen.splice(chosen.indexOf(member), 1)\n }\n index = Math.min(index, chosen.length)\n }\n }\n\n const tones = assignSectionTones(chosen.map((pick) => candidates[pick.candidate]?.tone ?? 'auto'))\n const rendered = chosen.map((pick, index) => ({ candidate: pick.candidate, id: pick.entry.id, tone: tones[index] ?? 'canvas' }))\n const manifest: BrandlabSectionManifest = {\n version: 1,\n family: order.family,\n ...(page !== undefined ? { page } : {}),\n cap: order.cap,\n order: order.source,\n planned: order.entries.map((entry) => ({ id: entry.id, requirement: entry.requirement })),\n rendered: chosen.map((pick, index) => ({\n id: pick.entry.id,\n section: candidates[pick.candidate]?.id ?? pick.entry.id,\n requirement: pick.entry.requirement,\n tone: tones[index] ?? 'canvas',\n })),\n skipped,\n counted: counted(),\n flags: counted() > order.cap ? ['cap-exceeded'] : [],\n }\n return { rendered, manifest }\n}\n"]}
1
+ {"version":3,"file":"section-order.js","sourceRoot":"","sources":["../src/section-order.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,MAAM;IACN,aAAa;IACb,gBAAgB;IAChB,QAAQ;IACR,aAAa;IACb,WAAW;IACX,UAAU;IACV,aAAa;IACb,eAAe;IACf,aAAa;IACb,gBAAgB;IAChB,aAAa;IACb,UAAU;IACV,cAAc;IACd,SAAS;IACT,SAAS;IACT,YAAY;IACZ,aAAa;IACb,WAAW;IACX,SAAS;IACT,WAAW;IACX,UAAU;IACV,UAAU;IACV,MAAM;IACN,UAAU;IACV,UAAU;IACV,MAAM;IACN,cAAc;IACd,kBAAkB;IAClB,QAAQ;IACR,SAAS;IACT,KAAK;CACG,CAAA;AAGV,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,MAAM;IACN,SAAS;IACT,mBAAmB;IACnB,QAAQ;IACR,QAAQ;IACR,YAAY;IACZ,cAAc;IACd,eAAe;IACf,cAAc;IACd,SAAS;IACT,SAAS;IACT,SAAS;IACT,OAAO;IACP,MAAM;IACN,SAAS;IACT,YAAY;IACZ,OAAO;IACP,SAAS;IACT,WAAW;CACH,CAAA;AAGV,mHAAmH;AACnH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,CAAU,CAAA;AAG5E,mGAAmG;AACnG,MAAM,CA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AAC,SAAS,IAAI,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACxF,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC3D,CAAA;QACH,CAAC,CAAC;QACF,OAAO;QACP,OAAO,EAAE,OAAO,EAAE;QAClB,KAAK,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE;KACrD,CAAA;IACD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAA;AAC/B,CAAC","sourcesContent":["/**\n * Section order (v2 §3.3 matrix part A; LIB §7a for hubs and company pages). Every page family has a default order of\n * sections, each required (R: skipped only when nothing true exists, and the manifest says why), conditional (C:\n * renders when its data exists), recommended (Rec) or optional (O). Sections a family doesn't use (N) are not in its\n * list. The hero or page header comes first and the CTA band last; a site may record an alternative order per family.\n * The permit note is a line inside `LocalFacts` (permit trades), not a section of its own.\n *\n * `planSectionSequence` is the sequencer's logic (F15), shared by `SectionSequence` in site-next and the K8 and K12\n * checks: skip what has nothing true to show, enforce the cap (only optional and recommended sections drop),\n * alternate the light tones so neighbours differ (at most one `band` and one `photo`) and write the per-page manifest.\n *\n * 3.16.0: the strips (the proof strip and the emergency band) and the site's signature sections don't count toward the\n * cap (`UNCAPPED_SECTIONS`), so a trade band never pushes out the page's own content, and a signature section takes\n * the place the site declares (`after`), up to `SIGNATURE_LIMITS` per family.\n */\n\nexport const BRANDLAB_SECTION_IDS = [\n 'hero',\n 'page-header',\n 'article-header',\n 'answer',\n 'proof-strip',\n 'emergency',\n 'services',\n 'local-facts',\n 'council-rules',\n 'nearby-jobs',\n 'service-detail',\n 'price-guide',\n 'projects',\n 'before-after',\n 'gallery',\n 'reviews',\n 'comparison',\n 'about-owner',\n 'signature',\n 'process',\n 'guarantee',\n 'licences',\n 'partners',\n 'team',\n 'coverage',\n 'area-map',\n 'faqs',\n 'nearby-areas',\n 'related-services',\n 'guides',\n 'contact',\n 'cta',\n] as const\nexport type BrandlabSectionId = (typeof BRANDLAB_SECTION_IDS)[number]\n\nexport const BRANDLAB_PAGE_FAMILIES = [\n 'home',\n 'service',\n 'service-in-suburb',\n 'region',\n 'suburb',\n 'cost-guide',\n 'services-hub',\n 'locations-hub',\n 'projects-hub',\n 'project',\n 'gallery',\n 'reviews',\n 'about',\n 'faqs',\n 'contact',\n 'guides-hub',\n 'guide',\n 'council',\n 'emergency',\n] as const\nexport type BrandlabPageFamily = (typeof BRANDLAB_PAGE_FAMILIES)[number]\n\n/** R required, C conditional, Rec recommended, O optional (N, not used, is simply absent from a family's list). */\nexport const BRANDLAB_SECTION_REQUIREMENTS = ['R', 'C', 'Rec', 'O'] as const\nexport type BrandlabSectionRequirement = (typeof BRANDLAB_SECTION_REQUIREMENTS)[number]\n\n/** The section tones: two alternating grounds, one optional band and one optional photo ground. */\nexport const BRANDLAB_SECTION_TONES = ['canvas', 'surface', 'band', 'photo'] as const\nexport type BrandlabSectionTone = (typeof BRANDLAB_SECTION_TONES)[number]\n\n/** What a section asks for: a light tone the sequencer picks (`auto`), the page's one band or its one photo ground. */\nexport type BrandlabSectionToneRequest = 'auto' | 'band' | 'photo'\n\nexport interface BrandlabSectionOrderEntry {\n readonly id: BrandlabSectionId\n readonly requirement: BrandlabSectionRequirement\n /** Sections that may fill this place instead, for example `before-after` for `projects`. */\n readonly alternatives?: readonly BrandlabSectionId[]\n /** Shares one matrix position with that section: when both render they count once toward the cap. */\n readonly countsWith?: BrandlabSectionId\n /** A strip or signature section (3.16.0): it renders under the usual rules but never counts toward the cap. */\n readonly uncapped?: true\n}\n\nexport interface BrandlabFamilyOrder {\n readonly family: BrandlabPageFamily\n /** The most sections the page renders (v1 §7.1). */\n readonly cap: number\n readonly source: 'default' | 'recorded'\n readonly entries: readonly BrandlabSectionOrderEntry[]\n}\n\n/**\n * 11 on home and service-in-suburb pages, 12 on service, region and suburb pages, 6 on hubs and company pages. The\n * sections in `UNCAPPED_SECTIONS` don't count toward them.\n */\nexport const SECTION_CAPS: Readonly<Record<BrandlabPageFamily, number>> = Object.freeze({\n home: 11,\n service: 12,\n 'service-in-suburb': 11,\n region: 12,\n suburb: 12,\n 'cost-guide': 12,\n 'services-hub': 6,\n 'locations-hub': 6,\n 'projects-hub': 6,\n project: 6,\n gallery: 6,\n reviews: 6,\n about: 6,\n faqs: 6,\n contact: 6,\n 'guides-hub': 6,\n guide: 6,\n council: 6,\n emergency: 6,\n})\n\ntype Row = readonly [\n BrandlabSectionId,\n BrandlabSectionRequirement,\n (readonly BrandlabSectionId[] | undefined)?,\n BrandlabSectionId?,\n]\n\nconst PROJECTS: Row = ['projects', 'C', ['before-after']]\n\n/**\n * Sections that never count toward the cap (3.16.0): the two strips, which sit straight under the hero (the proof\n * strip and a trade's emergency band), and the site's signature sections, which `SIGNATURE_LIMITS` bounds instead. The\n * cap holds the page's own content sections, so a conditional trade band can't push one out.\n */\nexport const UNCAPPED_SECTIONS: readonly BrandlabSectionId[] = Object.freeze(['proof-strip', 'emergency', 'signature'])\n\n/**\n * The most signature sections a page renders (v2 §7.7: up to two on the home page and one on service pages). Families\n * not listed take none, and their order has no `signature` place.\n */\nexport const SIGNATURE_LIMITS: Readonly<Partial<Record<BrandlabPageFamily, number>>> = Object.freeze({ home: 2, service: 1 })\n\n/** A signature section's name (`data-bl-signature`): lower-case words joined by hyphens, for example `storm-line`. */\nexport const SIGNATURE_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/\n\n/** The defaults, in order. `EmergencyBand` has no number in the matrix; it sits straight after the proof strip. */\nconst DEFAULT_ROWS: Readonly<Record<BrandlabPageFamily, readonly Row[]>> = {\n home: [\n ['hero', 'R'],\n ['proof-strip', 'R'],\n ['emergency', 'C'],\n ['services', 'R'],\n PROJECTS,\n // 3.16.0: genuine job photos beside the projects, as on the service pages.\n ['gallery', 'O'],\n ['reviews', 'C'],\n ['price-guide', 'Rec'],\n ['about-owner', 'O'],\n ['signature', 'O'],\n ['process', 'O'],\n ['guarantee', 'O'],\n ['coverage', 'R'],\n ['faqs', 'Rec'],\n ['guides', 'C'],\n ['cta', 'R'],\n ],\n service: [\n ['hero', 'R'],\n ['proof-strip', 'R'],\n ['emergency', 'C'],\n ['service-detail', 'R'],\n ['price-guide', 'R'],\n PROJECTS,\n // 3.15.0: genuine job photos beside the projects, when the site has them.\n ['gallery', 'O'],\n ['reviews', 'C'],\n ['about-owner', 'O'],\n ['comparison', 'O'],\n ['signature', 'O'],\n ['process', 'O'],\n ['guarantee', 'C'],\n ['faqs', 'R'],\n ['related-services', 'C'],\n ['coverage', 'C'],\n ['guides', 'C'],\n ['cta', 'R'],\n ],\n 'service-in-suburb': [\n ['hero', 'R'],\n ['proof-strip', 'R'],\n ['emergency', 'C'],\n ['local-facts', 'R'],\n ['nearby-jobs', 'R'],\n ['price-guide', 'R'],\n ['service-detail', 'R'],\n ['reviews', 'R'],\n ['faqs', 'R'],\n ['nearby-areas', 'R'],\n ['related-services', 'R', undefined, 'nearby-areas'],\n ['cta', 'R'],\n ],\n region: [\n ['hero', 'R'],\n ['proof-strip', 'R'],\n ['service-detail', 'R'],\n ['services', 'R'],\n PROJECTS,\n ['reviews', 'C'],\n ['price-guide', 'C'],\n ['coverage', 'R'],\n ['faqs', 'R'],\n ['area-map', 'O'],\n ['cta', 'R'],\n ],\n suburb: [\n ['hero', 'R'],\n ['proof-strip', 'R'],\n ['local-facts', 'R'],\n ['services', 'R'],\n ['price-guide', 'C'],\n ['nearby-jobs', 'C'],\n ['reviews', 'C'],\n ['faqs', 'R'],\n // 3.15.0: the nearest served suburbs (NearbyAreas), then the locator map (AreaMap). Conditional: L3 holds any\n // neighbour list to real distance but no check needs one on a suburb page, so it renders when there are neighbours.\n ['nearby-areas', 'C'],\n ['area-map', 'R'],\n ['cta', 'R'],\n ],\n 'cost-guide': [\n ['article-header', 'R'],\n ['answer', 'R'],\n ['price-guide', 'R'],\n ['service-detail', 'R'],\n ['comparison', 'O'],\n PROJECTS,\n ['faqs', 'Rec'],\n ['cta', 'R'],\n ],\n 'services-hub': [\n ['page-header', 'R'],\n ['services', 'R'],\n ['reviews', 'C'],\n ['cta', 'R'],\n ],\n 'locations-hub': [\n ['page-header', 'R'],\n ['coverage', 'R'],\n ['cta', 'R'],\n ],\n 'projects-hub': [\n ['page-header', 'R'],\n ['projects', 'R'],\n ['reviews', 'C'],\n ['cta', 'R'],\n ],\n project: [\n ['hero', 'R', ['page-header']],\n ['gallery', 'R'],\n ['service-detail', 'R'],\n ['reviews', 'C'],\n ['related-services', 'R'],\n ['cta', 'R'],\n ],\n gallery: [\n ['page-header', 'R'],\n ['gallery', 'R'],\n ['cta', 'R'],\n ],\n reviews: [\n ['page-header', 'R'],\n ['reviews', 'R'],\n ['cta', 'R'],\n ],\n about: [\n ['page-header', 'R'],\n ['about-owner', 'R'],\n ['licences', 'C'],\n ['partners', 'C'],\n ['reviews', 'C'],\n ['team', 'O'],\n ['cta', 'R'],\n ],\n faqs: [\n ['page-header', 'R'],\n ['faqs', 'R'],\n ['cta', 'R'],\n ],\n // The contact page is the page header and the contact block, and nothing else (K12-contact).\n contact: [\n ['page-header', 'R'],\n ['contact', 'R'],\n ],\n 'guides-hub': [\n ['page-header', 'R'],\n ['guides', 'R'],\n ['cta', 'R'],\n ],\n guide: [\n ['article-header', 'R'],\n ['service-detail', 'R'],\n ['cta', 'R'],\n ],\n // `council-rules` (3.15.0): the council register's rule, fees, source and check date (CouncilRules). Optional by\n // default; a permit trade makes it conditional on a current register record.\n council: [\n ['page-header', 'R'],\n ['council-rules', 'O'],\n ['service-detail', 'R'],\n ['cta', 'R'],\n ],\n // 3.15.0: optional FAQs before the CTA band (AA's emergency tree work page answers storm and after-hours questions).\n emergency: [\n ['hero', 'R'],\n ['emergency', 'R'],\n ['service-detail', 'R'],\n ['reviews', 'C'],\n ['faqs', 'O'],\n ['cta', 'R'],\n ],\n}\n\nfunction toEntry([id, requirement, alternatives, countsWith]: Row): BrandlabSectionOrderEntry {\n return Object.freeze({\n id,\n requirement,\n ...(alternatives ? { alternatives: Object.freeze([...alternatives]) } : {}),\n ...(countsWith ? { countsWith } : {}),\n ...(UNCAPPED_SECTIONS.includes(id) ? { uncapped: true as const } : {}),\n })\n}\n\n/** The playbook trades (v2 §5, matrix part B). */\nexport const BRANDLAB_TRADES = [\n 'building',\n 'electrical',\n 'exterior',\n 'interiors',\n 'landscaping',\n 'plumbing',\n 'pools',\n 'renovations',\n 'roofing',\n 'tiling',\n 'trees',\n] as const\nexport type BrandlabTrade = (typeof BRANDLAB_TRADES)[number]\n\n/** A trade's changes to the defaults: a new requirement for a section already in a family's order. */\nexport type BrandlabTradeSectionRules = Readonly<\n Partial<Record<BrandlabPageFamily, Readonly<Partial<Record<BrandlabSectionId, BrandlabSectionRequirement>>>>>\n>\n\n/**\n * Lines inside a section that a trade can require (3.14.0): the permit note is `LocalFacts`' `permit` slot; the\n * qualifications and insurance lines stand in for a licence block where the trade has no licence. A component marks\n * each slot it renders with `data-bl-slot=\"<slot>\"`; when its data is missing or stale it renders nothing for the slot\n * and lists `<slot>:<no-… reason>` in the section's `data-bl-slot-skip` attribute (check K12-slots reads both).\n */\nexport const BRANDLAB_SECTION_SLOTS = ['permit', 'qualifications', 'insurance', 'licence'] as const\nexport type BrandlabSectionSlot = (typeof BRANDLAB_SECTION_SLOTS)[number]\n\nexport const SECTION_SLOT_ATTRIBUTE = 'data-bl-slot'\nexport const SECTION_SLOT_SKIP_ATTRIBUTE = 'data-bl-slot-skip'\n\n/** A slot left empty for a data-backed reason, such as `{ slot: 'permit', reason: 'no-current-council-record' }`. */\nexport interface BrandlabSectionSlotSkip {\n readonly slot: BrandlabSectionSlot\n readonly reason: `no-${string}`\n}\n\n/** The `data-bl-slot-skip` value: space-separated `slot:reason` pairs. */\nexport function formatSectionSlotSkips(skips: readonly BrandlabSectionSlotSkip[]): string {\n return skips\n .map((skip) => {\n if (!(BRANDLAB_SECTION_SLOTS as readonly string[]).includes(skip.slot)) throw new Error(`Unknown section slot \"${skip.slot}\".`)\n if (!/^no-[a-z0-9]+(?:-[a-z0-9]+)*$/.test(skip.reason)) throw new Error(`A slot skip reason says what data is missing: \"no-…\", not \"${skip.reason}\".`)\n return `${skip.slot}:${skip.reason}`\n })\n .join(' ')\n}\n\n/** Reads a `data-bl-slot-skip` value; pairs that are not `slot:no-…` are ignored. */\nexport function parseSectionSlotSkips(value: string | undefined): BrandlabSectionSlotSkip[] {\n return (value ?? '')\n .split(/\\s+/)\n .flatMap((pair): BrandlabSectionSlotSkip[] => {\n const [slot, reason] = pair.split(':')\n return slot && reason && (BRANDLAB_SECTION_SLOTS as readonly string[]).includes(slot) && /^no-[a-z0-9]+(?:-[a-z0-9]+)*$/.test(reason)\n ? [{ slot: slot as BrandlabSectionSlot, reason: reason as `no-${string}` }]\n : []\n })\n}\n\n/** Slots a trade requires inside a family's sections. */\nexport type BrandlabTradeSlotRules = Readonly<\n Partial<Record<BrandlabPageFamily, Readonly<Partial<Record<BrandlabSectionId, readonly BrandlabSectionSlot[]>>>>>\n>\n\n/**\n * One trade's column of matrix part B: its credential block (a licence block, or qualifications and insurance where\n * the trade has no licence), its section requirement changes and the slots it requires. `unconfirmed` trades keep the\n * defaults until their playbook's rules are confirmed (licence classes, permit notes and emergency work are\n * \"inferred, confirm\" in the matrix).\n */\nexport interface BrandlabTradeProfile {\n readonly credentials: 'licence' | 'qualifications' | 'unconfirmed'\n readonly sections: BrandlabTradeSectionRules\n readonly slots: BrandlabTradeSlotRules\n /** Where the rules come from. */\n readonly source: string\n}\n\nconst UNCONFIRMED: BrandlabTradeProfile = Object.freeze({\n credentials: 'unconfirmed',\n sections: Object.freeze({}),\n slots: Object.freeze({}),\n source: 'Defaults until the playbook rules are confirmed (v2 §3.4).',\n})\n\n/** Validates trade profiles: requirement changes and slots name sections the family uses, and known slots. */\nexport function defineTradeProfiles<const T extends Readonly<Record<BrandlabTrade, BrandlabTradeProfile>>>(profiles: T): T {\n for (const [trade, profile] of Object.entries(profiles) as [string, BrandlabTradeProfile][]) {\n if (!(BRANDLAB_TRADES as readonly string[]).includes(trade)) throw new Error(`Unknown trade \"${trade}\".`)\n if (!['licence', 'qualifications', 'unconfirmed'].includes(profile.credentials)) {\n throw new Error(`Trade ${trade}: credentials must be licence, qualifications or unconfirmed.`)\n }\n const check = (rules: object, kind: string, value: (sectionValue: unknown, where: string) => void) => {\n for (const [family, sections] of Object.entries(rules)) {\n const rows = DEFAULT_ROWS[family as BrandlabPageFamily]\n if (!rows) throw new Error(`Trade ${trade}: unknown page family \"${family}\" in its ${kind}.`)\n for (const [section, sectionValue] of Object.entries(sections as object)) {\n if (!rows.some((row) => row[0] === section)) throw new Error(`Trade ${trade}: ${family} pages have no \"${section}\" section for its ${kind}.`)\n value(sectionValue, `Trade ${trade}: ${family} \"${section}\"`)\n }\n }\n }\n check(profile.sections, 'requirements', (requirement, where) => {\n if (!(BRANDLAB_SECTION_REQUIREMENTS as readonly unknown[]).includes(requirement)) throw new Error(`${where} has an unknown requirement.`)\n })\n check(profile.slots, 'slots', (slots, where) => {\n if (!Array.isArray(slots) || slots.length === 0 || slots.some((slot) => !(BRANDLAB_SECTION_SLOTS as readonly unknown[]).includes(slot))) {\n throw new Error(`${where} lists an unknown slot; slots are ${BRANDLAB_SECTION_SLOTS.join(', ')}.`)\n }\n })\n }\n return profiles\n}\n\n/**\n * Matrix part B, as confirmed (3.14.0). Trees: no NSW licence for tree work, so the licence block is optional and the\n * about page's owner block carries the qualifications and insurance lines; the council permit note is required on\n * suburb and service-in-suburb pages (hidden, with its reason, once the council record is stale), and council pages\n * show the council's rules whenever the register holds a current record (3.15.0). The other trades\n * stay on the defaults until their rules are confirmed.\n */\nexport const SECTION_TRADE_PROFILES: Readonly<Record<BrandlabTrade, BrandlabTradeProfile>> = Object.freeze(\n defineTradeProfiles({\n ...(Object.fromEntries(BRANDLAB_TRADES.map((trade) => [trade, UNCONFIRMED])) as Record<BrandlabTrade, BrandlabTradeProfile>),\n trees: Object.freeze({\n credentials: 'qualifications',\n sections: Object.freeze({ about: Object.freeze({ licences: 'O' }), council: Object.freeze({ 'council-rules': 'C' }) }),\n slots: Object.freeze({\n suburb: Object.freeze({ 'local-facts': Object.freeze(['permit'] as const) }),\n 'service-in-suburb': Object.freeze({ 'local-facts': Object.freeze(['permit'] as const) }),\n about: Object.freeze({ 'about-owner': Object.freeze(['qualifications', 'insurance'] as const) }),\n }),\n source: 'v2 §3.4 matrix part B (trees row); playbook-trees §2.3 (permit slot, rows 2 and 6), §2.4 (council register) and §1.7 (no tree-work licence).',\n }),\n }),\n)\n\n/** The trade map (matrix part B): each trade's section requirement changes, from `SECTION_TRADE_PROFILES`. */\nexport const SECTION_ORDER_TRADE_MAP: Readonly<Record<BrandlabTrade, BrandlabTradeSectionRules>> = Object.freeze(\n Object.fromEntries(BRANDLAB_TRADES.map((trade) => [trade, SECTION_TRADE_PROFILES[trade].sections])) as Record<BrandlabTrade, BrandlabTradeSectionRules>,\n)\n\n/** The slots a trade requires on a family's pages, section by section, in the order the profile lists them. */\nexport function requiredSectionSlots(\n family: BrandlabPageFamily,\n trade?: BrandlabTrade,\n profiles: Readonly<Partial<Record<BrandlabTrade, BrandlabTradeProfile>>> = SECTION_TRADE_PROFILES,\n): { readonly section: BrandlabSectionId; readonly slot: BrandlabSectionSlot }[] {\n const rules = trade ? profiles[trade]?.slots[family] : undefined\n if (!rules) return []\n return (Object.entries(rules) as [BrandlabSectionId, readonly BrandlabSectionSlot[]][]).flatMap(([section, slots]) =>\n slots.map((slot) => ({ section, slot })),\n )\n}\n\n/** A family's default order, with the trade's rules applied. */\nexport function defaultSectionOrder(\n family: BrandlabPageFamily,\n trade?: BrandlabTrade,\n tradeMap: Readonly<Partial<Record<BrandlabTrade, BrandlabTradeSectionRules>>> = SECTION_ORDER_TRADE_MAP,\n): BrandlabFamilyOrder {\n const rows = DEFAULT_ROWS[family]\n if (!rows) throw new Error(`Unknown page family \"${family}\".`)\n const rules = trade ? tradeMap[trade]?.[family] : undefined\n const entries = rows.map((row) => {\n const requirement = rules?.[row[0]]\n return toEntry(requirement ? [row[0], requirement, row[2], row[3]] : row)\n })\n return Object.freeze({ family, cap: SECTION_CAPS[family], source: 'default', entries: Object.freeze(entries) })\n}\n\n/** A site's recorded alternative order for one family (LIB §7a), with the decision that recorded it. */\nexport interface BrandlabRecordedSectionOrder {\n readonly order: readonly BrandlabSectionId[]\n /** Who decided and why, for example \"Romie, 19 Oct 2026: reviews before prices for Superior\". */\n readonly decision: string\n /** YYYY-MM-DD. */\n readonly recordedOn: string\n}\n\nexport interface BrandlabSectionOrderInput {\n readonly trade?: BrandlabTrade\n readonly recorded?: Readonly<Partial<Record<BrandlabPageFamily, BrandlabRecordedSectionOrder>>>\n}\n\nexport type BrandlabSectionOrders = Readonly<Record<BrandlabPageFamily, BrandlabFamilyOrder>>\n\nconst ISO_DATE = /^\\d{4}-\\d{2}-\\d{2}$/\n\nfunction recordedOrder(base: BrandlabFamilyOrder, recorded: BrandlabRecordedSectionOrder): BrandlabFamilyOrder {\n const family = base.family\n const fail = (detail: string): never => {\n throw new Error(`Recorded section order for ${family}: ${detail}`)\n }\n if (family === 'contact') fail('the contact page is the page header and the contact block, and nothing else.')\n if (typeof recorded.decision !== 'string' || !recorded.decision.trim()) fail('decision must say who decided and why.')\n if (typeof recorded.recordedOn !== 'string' || !ISO_DATE.test(recorded.recordedOn) || Number.isNaN(Date.parse(recorded.recordedOn))) {\n fail('recordedOn must be a YYYY-MM-DD date.')\n }\n if (!Array.isArray(recorded.order) || recorded.order.length === 0) fail('order must list the sections.')\n const byId = new Map(base.entries.map((entry) => [entry.id, entry]))\n const seen = new Set<string>()\n for (const id of recorded.order) {\n if (!byId.has(id)) fail(`\"${id}\" is not used on ${family} pages.`)\n if (seen.has(id)) fail(`\"${id}\" appears twice.`)\n seen.add(id)\n }\n for (const entry of base.entries) {\n if ((entry.requirement === 'R' || entry.requirement === 'C') && !seen.has(entry.id)) {\n fail(`\"${entry.id}\" is ${entry.requirement === 'R' ? 'required' : 'conditional'} and must stay in the order.`)\n }\n }\n const first = base.entries[0]?.id\n const last = base.entries[base.entries.length - 1]?.id\n if (recorded.order[0] !== first) fail(`\"${first}\" comes first.`)\n if (last === 'cta' && recorded.order[recorded.order.length - 1] !== 'cta') fail('the CTA band comes last.')\n const proof = recorded.order.indexOf('proof-strip')\n if (proof >= 5) fail('the proof strip stays within the first five sections.')\n return Object.freeze({\n family,\n cap: base.cap,\n source: 'recorded',\n entries: Object.freeze(recorded.order.map((id) => byId.get(id) as BrandlabSectionOrderEntry)),\n })\n}\n\n/**\n * Declares a site's section orders (`src/data/strategy.ts`): the defaults for every family, the trade's rules and any\n * recorded alternative orders. A recorded order keeps every required and conditional section, the first section\n * first, the CTA band last and the proof strip within the first five; the contact page can't be reordered.\n */\nexport function defineSectionOrder(\n input: BrandlabSectionOrderInput = {},\n tradeMap: Readonly<Partial<Record<BrandlabTrade, BrandlabTradeSectionRules>>> = SECTION_ORDER_TRADE_MAP,\n): BrandlabSectionOrders {\n if (input.trade !== undefined && !(BRANDLAB_TRADES as readonly string[]).includes(input.trade)) {\n throw new Error(`Unknown trade \"${input.trade}\".`)\n }\n for (const family of Object.keys(input.recorded ?? {})) {\n if (!(BRANDLAB_PAGE_FAMILIES as readonly string[]).includes(family)) throw new Error(`Unknown page family \"${family}\".`)\n }\n const orders = Object.fromEntries(\n BRANDLAB_PAGE_FAMILIES.map((family) => {\n const base = defaultSectionOrder(family, input.trade, tradeMap)\n const recorded = input.recorded?.[family]\n return [family, recorded ? recordedOrder(base, recorded) : base]\n }),\n ) as Record<BrandlabPageFamily, BrandlabFamilyOrder>\n return Object.freeze(orders)\n}\n\n/** The reasons the sequencer itself skips a section. */\nexport const SEQUENCER_SKIP_REASONS = ['not-provided', 'not-in-order', 'duplicate', 'cap', 'limit'] as const\nexport type BrandlabSequencerSkipReason = (typeof SEQUENCER_SKIP_REASONS)[number]\n\n/**\n * A section's own, data-backed reason for rendering nothing: the data it needs isn't there (`no-feed-reviews`,\n * `no-approved-prices`, `no-jobs-nearby`, `no-faqs` and so on), or its content belongs in the hero checklist.\n */\nexport type BrandlabSectionDataReason = `no-${string}` | 'merge-into-hero-checklist'\nexport type BrandlabSectionSkipReason = BrandlabSectionDataReason | BrandlabSequencerSkipReason\n\n/** A section's guard, computed from the same data it renders: render, or render nothing and say why. */\nexport type BrandlabSectionReadiness =\n | { readonly render: true }\n | { readonly render: false; readonly reason: BrandlabSectionDataReason }\n\nexport const SECTION_READY: BrandlabSectionReadiness = Object.freeze({ render: true })\n\n/** Whether a skip reason says the data isn't there (as opposed to the sequencer's own reasons). */\nexport function isDataBackedSkipReason(reason: string): reason is BrandlabSectionDataReason {\n return reason === 'merge-into-hero-checklist' || /^no-[a-z0-9]+(?:-[a-z0-9]+)*$/.test(reason)\n}\n\n/** The attribute on the manifest's `<script type=\"application/json\">`. */\nexport const SECTION_MANIFEST_ATTRIBUTE = 'data-bl-manifest'\n\n/**\n * Page-level notes in the manifest. `cap-exceeded`: the required and conditional sections with data are more than\n * the cap, so they all render (neither drops for the cap) and the page is over its cap.\n */\nexport const SECTION_MANIFEST_FLAGS = ['cap-exceeded'] as const\nexport type BrandlabSectionManifestFlag = (typeof SECTION_MANIFEST_FLAGS)[number]\n\n/**\n * The per-page manifest K12 reads: what was planned, what rendered with which tone, and what was skipped and why. A\n * signature section carries its name (`signature`) and, when the site placed it, the section it follows (`after`).\n */\nexport interface BrandlabSectionManifest {\n readonly version: 1\n readonly family: BrandlabPageFamily\n readonly page?: string\n readonly cap: number\n readonly order: 'default' | 'recorded'\n readonly planned: readonly { readonly id: BrandlabSectionId; readonly requirement: BrandlabSectionRequirement }[]\n /** `id` is the planned place; `section` is what filled it (an alternative such as `before-after`, or the same id). */\n readonly rendered: readonly {\n readonly id: BrandlabSectionId\n readonly section: BrandlabSectionId\n readonly requirement: BrandlabSectionRequirement\n readonly tone: BrandlabSectionTone\n readonly signature?: string\n readonly after?: BrandlabSectionId\n }[]\n readonly skipped: readonly {\n readonly id: BrandlabSectionId\n readonly section: BrandlabSectionId\n readonly requirement: BrandlabSectionRequirement | 'N'\n readonly reason: BrandlabSectionSkipReason\n readonly signature?: string\n }[]\n /**\n * The rendered sections counted toward the cap: sections sharing one matrix position count once, and the strips and\n * signature sections (`UNCAPPED_SECTIONS`) not at all.\n */\n readonly counted: number\n readonly flags: readonly BrandlabSectionManifestFlag[]\n}\n\n/** One section a page offers the sequencer. */\nexport interface BrandlabSequenceCandidate {\n readonly id: BrandlabSectionId\n /** Defaults to ready. */\n readonly ready?: BrandlabSectionReadiness\n /** Defaults to `auto`. */\n readonly tone?: BrandlabSectionToneRequest\n /** A `signature` section's name (3.16.0), required for one: lower-case words joined by hyphens. */\n readonly signature?: string\n /**\n * Where a `signature` section goes (3.16.0): straight after this section of the family's order, or after the nearest\n * section before it that renders. Not before the proof strip, and never after the CTA band. Without it, the\n * signature takes the order's own `signature` place.\n */\n readonly after?: BrandlabSectionId\n}\n\nexport interface BrandlabSequencePlan {\n /** What renders, in order: the candidate's index, the planned place and the tone. */\n readonly rendered: readonly { readonly candidate: number; readonly id: BrandlabSectionId; readonly tone: BrandlabSectionTone }[]\n readonly manifest: BrandlabSectionManifest\n}\n\n/**\n * Tones for the sections that render, in order. `auto` sections alternate canvas and surface, so neighbours never\n * share a background; after a band or photo section the next light tone is the one the last light section didn't\n * have (Omega's `alternateTones`). Only the first `band` request and the first `photo` request are honoured, and\n * never twice in a row; later requests fall back to the light tones.\n */\nexport function assignSectionTones(requests: readonly BrandlabSectionToneRequest[]): BrandlabSectionTone[] {\n const tones: BrandlabSectionTone[] = []\n let previous: BrandlabSectionTone | undefined\n let lastLight: 'canvas' | 'surface' = 'surface'\n let bandUsed = false\n let photoUsed = false\n for (const request of requests) {\n let next: BrandlabSectionTone\n if (request === 'band' && !bandUsed && previous !== 'band') {\n next = 'band'\n bandUsed = true\n } else if (request === 'photo' && !photoUsed && previous !== 'photo') {\n next = 'photo'\n photoUsed = true\n } else if (previous === 'canvas') next = 'surface'\n else if (previous === 'surface') next = 'canvas'\n else next = lastLight === 'canvas' ? 'surface' : 'canvas'\n tones.push(next)\n previous = next\n if (next === 'canvas' || next === 'surface') lastLight = next\n }\n return tones\n}\n\n/** Only optional, then recommended, sections drop for the cap; K12 needs every R and C section with data rendered. */\nconst CAP_DROP_ORDER: readonly BrandlabSectionRequirement[] = ['O', 'Rec']\n\n/** Checks a signature candidate's name and place against the family's order; a mistake here is the site's code. */\nfunction assertSignature(order: BrandlabFamilyOrder, candidate: BrandlabSequenceCandidate): void {\n const where = `Signature section \"${candidate.signature ?? ''}\" on ${order.family} pages`\n if (typeof candidate.signature !== 'string' || !SIGNATURE_NAME_PATTERN.test(candidate.signature)) {\n throw new Error(`${where}: a signature section needs a name of lower-case words joined by hyphens, for example \"storm-line\".`)\n }\n if (candidate.after === undefined) return\n const ids = order.entries.map((entry) => entry.id)\n const at = ids.indexOf(candidate.after)\n if (at === -1) throw new Error(`${where}: \"${candidate.after}\" is not in the order, so it can't follow it.`)\n if (candidate.after === 'cta' || at === ids.length - 1) throw new Error(`${where}: nothing follows the last section.`)\n const proof = ids.indexOf('proof-strip')\n if (at < Math.max(proof, 0)) throw new Error(`${where}: it can't come before the proof strip.`)\n}\n\n/**\n * Plans one page: matches the page's candidate sections to the family order, skips what isn't ready, isn't offered or\n * isn't in the order, enforces the cap (optional, then recommended sections drop, last first; required and\n * conditional sections with data never drop: when they alone exceed the cap they all render and the manifest flags\n * `cap-exceeded`; the sections in `UNCAPPED_SECTIONS` don't count), places the signature sections (3.16.0), assigns\n * tones and writes the manifest.\n */\nexport function planSectionSequence(\n order: BrandlabFamilyOrder,\n candidates: readonly BrandlabSequenceCandidate[],\n page?: string,\n): BrandlabSequencePlan {\n const skipped: BrandlabSectionManifest['skipped'][number][] = []\n const used = new Set<number>()\n const chosen: { candidate: number; entry: BrandlabSectionOrderEntry }[] = []\n const isSignature = (candidate: BrandlabSequenceCandidate) => candidate.id === 'signature'\n\n for (const entry of order.entries) {\n // Signature sections are placed after the cap, by their own rules.\n if (entry.id === 'signature') {\n if (!candidates.some(isSignature)) skipped.push({ id: entry.id, section: entry.id, requirement: entry.requirement, reason: 'not-provided' })\n continue\n }\n const matches = candidates\n .map((candidate, index) => ({ candidate, index }))\n .filter(\n ({ candidate, index }) =>\n !used.has(index) && !isSignature(candidate) && (candidate.id === entry.id || entry.alternatives?.includes(candidate.id)),\n )\n if (matches.length === 0) {\n skipped.push({ id: entry.id, section: entry.id, requirement: entry.requirement, reason: 'not-provided' })\n continue\n }\n let filled = false\n for (const { candidate, index } of matches) {\n used.add(index)\n const ready = candidate.ready ?? SECTION_READY\n if (filled) skipped.push({ id: entry.id, section: candidate.id, requirement: entry.requirement, reason: 'duplicate' })\n else if (!ready.render) skipped.push({ id: entry.id, section: candidate.id, requirement: entry.requirement, reason: ready.reason })\n else {\n chosen.push({ candidate: index, entry })\n filled = true\n }\n }\n }\n\n candidates.forEach((candidate, index) => {\n if (!used.has(index) && !isSignature(candidate)) skipped.push({ id: candidate.id, section: candidate.id, requirement: 'N', reason: 'not-in-order' })\n })\n\n const counted = () => {\n const ids = new Set(chosen.map((pick) => pick.entry.id))\n return chosen.filter((pick) => !pick.entry.uncapped && !(pick.entry.countsWith && ids.has(pick.entry.countsWith))).length\n }\n // Sections sharing one matrix position drop together, so every drop lowers the count by one.\n const position = (pick: (typeof chosen)[number]) =>\n chosen.filter(\n (other) =>\n other === pick ||\n other.entry.countsWith === pick.entry.id ||\n pick.entry.countsWith === other.entry.id ||\n (pick.entry.countsWith !== undefined && other.entry.countsWith === pick.entry.countsWith),\n )\n for (const requirement of CAP_DROP_ORDER) {\n for (let index = chosen.length - 1; index >= 0 && counted() > order.cap; index -= 1) {\n const pick = chosen[index]\n if (!pick || pick.entry.requirement !== requirement || pick.entry.uncapped) continue\n const group = position(pick)\n if (!group.every((member) => CAP_DROP_ORDER.includes(member.entry.requirement))) continue\n for (const member of group) {\n skipped.push({\n id: member.entry.id,\n section: candidates[member.candidate]?.id ?? member.entry.id,\n requirement: member.entry.requirement,\n reason: 'cap',\n })\n chosen.splice(chosen.indexOf(member), 1)\n }\n index = Math.min(index, chosen.length)\n }\n }\n\n // Signature sections (3.16.0): each goes straight after the section it names (or the nearest one before it that\n // renders), or in the order's own `signature` place; at most SIGNATURE_LIMITS per family, never counted.\n // A recorded order may leave the `signature` place out; a signature placed with `after` still renders there.\n const ownPlace = order.entries.find((entry) => entry.id === 'signature')\n const place: BrandlabSectionOrderEntry = ownPlace ?? { id: 'signature', requirement: 'O', uncapped: true }\n const plannedAt = (id: BrandlabSectionId) => order.entries.findIndex((entry) => entry.id === id)\n const limit = SIGNATURE_LIMITS[order.family] ?? 0\n const placed: { candidate: number; entry: BrandlabSectionOrderEntry; anchor: number; after?: BrandlabSectionId }[] = []\n candidates.forEach((candidate, index) => {\n if (!isSignature(candidate)) return\n const signature = { signature: candidate.signature ?? '' }\n if (limit === 0 || (!ownPlace && candidate.after === undefined)) {\n skipped.push({ id: 'signature', section: 'signature', requirement: 'N', reason: 'not-in-order', ...signature })\n return\n }\n assertSignature(order, candidate)\n const ready = candidate.ready ?? SECTION_READY\n if (!ready.render) skipped.push({ id: 'signature', section: 'signature', requirement: place.requirement, reason: ready.reason, ...signature })\n else if (placed.length >= limit) skipped.push({ id: 'signature', section: 'signature', requirement: place.requirement, reason: 'limit', ...signature })\n else {\n // The anchor is the planned index the signature follows; the order's own place follows the section before it.\n const anchor = candidate.after !== undefined ? plannedAt(candidate.after) : plannedAt('signature') - 1\n placed.push({ candidate: index, entry: place, anchor, ...(candidate.after !== undefined ? { after: candidate.after } : {}) })\n }\n })\n const ordered: { candidate: number; entry: BrandlabSectionOrderEntry; after?: BrandlabSectionId }[] = []\n const pending = [...placed]\n for (const pick of chosen) {\n const at = plannedAt(pick.entry.id)\n // A signature anchored before this section goes in first (its anchor didn't render, or it is the place before).\n while (pending.length > 0 && pending.some((item) => item.anchor < at)) {\n const next = pending.findIndex((item) => item.anchor < at)\n ordered.push(...pending.splice(next, 1))\n }\n ordered.push(pick)\n }\n ordered.push(...pending)\n\n const tones = assignSectionTones(ordered.map((pick) => candidates[pick.candidate]?.tone ?? 'auto'))\n const rendered = ordered.map((pick, index) => ({ candidate: pick.candidate, id: pick.entry.id, tone: tones[index] ?? 'canvas' }))\n const manifest: BrandlabSectionManifest = {\n version: 1,\n family: order.family,\n ...(page !== undefined ? { page } : {}),\n cap: order.cap,\n order: order.source,\n planned: order.entries.map((entry) => ({ id: entry.id, requirement: entry.requirement })),\n rendered: ordered.map((pick, index) => {\n const candidate = candidates[pick.candidate]\n return {\n id: pick.entry.id,\n section: candidate?.id ?? pick.entry.id,\n requirement: pick.entry.requirement,\n tone: tones[index] ?? 'canvas',\n ...(candidate && isSignature(candidate) ? { signature: candidate.signature ?? '' } : {}),\n ...(pick.after !== undefined ? { after: pick.after } : {}),\n }\n }),\n skipped,\n counted: counted(),\n flags: counted() > order.cap ? ['cap-exceeded'] : [],\n }\n return { rendered, manifest }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brandlab-digital/site-core",
3
- "version": "3.15.1",
3
+ "version": "3.16.0",
4
4
  "license": "UNLICENSED",
5
5
  "repository": {
6
6
  "type": "git",