@bison-lab/payload-core 4.30.0 → 4.32.1

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.
@@ -116,8 +116,7 @@ const BLOCK_LIBRARY_CATEGORIES = [
116
116
  ];
117
117
  /**
118
118
  * Package catalogue. `megaMenu` and `navLink` are header item blocks, not
119
- * cards. Navigation's card is `floatingNav`. CTA is a category for a site
120
- * extra; the package ships no CTA slug. The preview route is SPI-53.
119
+ * cards. Navigation's card is `floatingNav`. The preview route is SPI-53.
121
120
  */
122
121
  const PACKAGE_BLOCK_SLUGS = [
123
122
  "hero",
@@ -136,6 +135,9 @@ const PACKAGE_BLOCK_SLUGS = [
136
135
  "video",
137
136
  "nap",
138
137
  "inquiryForm",
138
+ "ctaBand",
139
+ "logoCloud",
140
+ "gallery",
139
141
  "floatingNav"
140
142
  ];
141
143
  //#endregion
@@ -258,6 +260,27 @@ const PACKAGE_BLOCKS = [
258
260
  kind: "section",
259
261
  sectionControls: DEFAULT_SECTION_CONTROLS
260
262
  },
263
+ {
264
+ slug: "ctaBand",
265
+ label: "CTA band",
266
+ category: "cta",
267
+ kind: "section",
268
+ sectionControls: DEFAULT_SECTION_CONTROLS
269
+ },
270
+ {
271
+ slug: "logoCloud",
272
+ label: "Logo cloud",
273
+ category: "content",
274
+ kind: "section",
275
+ sectionControls: DEFAULT_SECTION_CONTROLS
276
+ },
277
+ {
278
+ slug: "gallery",
279
+ label: "Gallery",
280
+ category: "content",
281
+ kind: "section",
282
+ sectionControls: DEFAULT_SECTION_CONTROLS
283
+ },
261
284
  {
262
285
  slug: "floatingNav",
263
286
  label: "Floating navbar",
@@ -267,12 +290,23 @@ const PACKAGE_BLOCKS = [
267
290
  sectionControls: NO_SECTION_CONTROLS
268
291
  }
269
292
  ];
293
+ const PACKAGE_SLUGS$1 = new Set(PACKAGE_BLOCKS.map((entry) => entry.slug));
294
+ /**
295
+ * The package entries, then the site's extras. An extra whose slug the
296
+ * package ships replaces that package entry in its place: a site that
297
+ * registered its own block before the package shipped one under the same
298
+ * slug still renders its own config, so its label, category, controls,
299
+ * picture and sample are the true ones. A release that adds such a block
300
+ * therefore never yields two rows for one slug, and never relabels the
301
+ * site's block as the package's.
302
+ */
270
303
  function blockLibraryCatalogue(extras = []) {
271
- const extra = extras.filter((entry) => !NOT_CATALOGUE.has(entry.slug));
272
- return [...PACKAGE_BLOCKS.map((entry) => ({
304
+ const own = extras.filter((entry) => !NOT_CATALOGUE.has(entry.slug));
305
+ const shadows = new Map(own.filter((entry) => PACKAGE_SLUGS$1.has(entry.slug)).map((entry) => [entry.slug, entry]));
306
+ return [...PACKAGE_BLOCKS.map((entry) => shadows.get(entry.slug) ?? {
273
307
  ...entry,
274
308
  sectionControls: { ...entry.sectionControls }
275
- })), ...extra];
309
+ }), ...own.filter((entry) => !PACKAGE_SLUGS$1.has(entry.slug))];
276
310
  }
277
311
  function defaultBlockLibraryValue(options) {
278
312
  return blockLibraryCatalogue(options.blocks).map((entry) => toRow(entry, true));
@@ -385,15 +419,19 @@ const PACKAGE_SLUGS = new Set(PACKAGE_BLOCK_SLUGS);
385
419
  * `createBlockLibrary` keeps the rows it seeded (package and extras) on the
386
420
  * `blocks` field's `admin.custom.rows`, so a site block's catalogue default
387
421
  * is known here without the site passing `blocks` a second time. Package
388
- * slugs are left out; the catalogue already has them.
422
+ * slugs are left out (the catalogue already has them) unless the site
423
+ * registered its own entry under one, which `siteSlugs` records.
389
424
  */
390
425
  function blockLibraryEntriesFromConfig(payload) {
391
- const rows = ((Array.isArray(payload.config?.globals) ? payload.config.globals : []).find((global) => typeof global === "object" && global !== null && global.slug === "block-library")?.fields ?? []).find((field) => typeof field === "object" && field !== null && field.name === "blocks")?.admin?.custom?.rows;
426
+ const blocks = ((Array.isArray(payload.config?.globals) ? payload.config.globals : []).find((global) => typeof global === "object" && global !== null && global.slug === "block-library")?.fields ?? []).find((field) => typeof field === "object" && field !== null && field.name === "blocks");
427
+ const rows = blocks?.admin?.custom?.rows;
392
428
  if (!Array.isArray(rows)) return [];
429
+ const siteSlugs = blocks?.admin?.custom?.siteSlugs;
430
+ const own = new Set(Array.isArray(siteSlugs) ? siteSlugs.filter((slug) => typeof slug === "string") : []);
393
431
  return rows.flatMap((row) => {
394
432
  if (!row || typeof row !== "object") return [];
395
433
  const { slug, label, category, kind, sectionControls } = row;
396
- if (typeof slug !== "string" || !slug || PACKAGE_SLUGS.has(slug)) return [];
434
+ if (typeof slug !== "string" || !slug || PACKAGE_SLUGS.has(slug) && !own.has(slug)) return [];
397
435
  return [{
398
436
  slug,
399
437
  label: typeof label === "string" ? label : slug,
@@ -421,4 +459,4 @@ async function getSectionControls(payload, extras = blockLibraryEntriesFromConfi
421
459
  //#endregion
422
460
  export { sectionControlsOf as _, sectionControlsFromLibrary as a, BLOCK_LIBRARY_CATEGORIES as c, DEFAULT_SECTION_CONTROLS as d, HERO_SECTION_CONTROLS as f, defaultSectionControls as g, SECTION_CONTROL_LABELS as h, defaultBlockLibraryValue as i, BLOCK_LIBRARY_SLUG as l, SECTION_CONTROL_KEYS as m, getSectionControls as n, stampBlockLibrary as o, NO_SECTION_CONTROLS as p, blockLibraryCatalogue as r, validateBlockLibrary as s, blockLibraryEntriesFromConfig as t, PACKAGE_BLOCK_SLUGS as u };
423
461
 
424
- //# sourceMappingURL=published-Cc1a8uYp.mjs.map
462
+ //# sourceMappingURL=published-niJkPGjE.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"published-niJkPGjE.mjs","names":["PACKAGE_SLUGS"],"sources":["../src/block-library/controls.ts","../src/block-library/types.ts","../src/block-library/catalogue.ts","../src/block-library/published.ts"],"sourcesContent":["import type { BlockLibraryEntry, BlockLibraryKind } from \"./types\";\n\n/**\n * Which of the four section settings a block offers its editors. The\n * settings group on every page block keeps all four fields, so the page\n * schema never moves; a tick off hides the control in the editor and the\n * renderer ignores its stored value (payload-blocks, BIS-138). The choice\n * lives on the Block library row, seeded from the catalogue, so turning\n * one control off for one block is a Save, not a release (BIS-136).\n */\nexport const SECTION_CONTROL_KEYS = [\"background\", \"spacing\", \"anchor\", \"hidden\"] as const;\n\nexport type SectionControlKey = (typeof SECTION_CONTROL_KEYS)[number];\n\nexport type SectionControls = Record<SectionControlKey, boolean>;\n\n/** The words the settings fold uses, so the ticks read as the controls they hide. */\nexport const SECTION_CONTROL_LABELS: Record<SectionControlKey, string> = {\n background: \"Background\",\n spacing: \"Spacing\",\n anchor: \"Anchor\",\n hidden: \"Hidden\",\n};\n\n/** A section: every control. Also what a slug no catalogue knows gets. */\nexport const DEFAULT_SECTION_CONTROLS: SectionControls = {\n background: true,\n spacing: true,\n anchor: true,\n hidden: true,\n};\n\n/**\n * A hero: Anchor only. Background would compete with the hero's own tone,\n * Spacing is header clearance the editor should not change, and a hidden\n * hero is a published page with no opening.\n */\nexport const HERO_SECTION_CONTROLS: SectionControls = {\n background: false,\n spacing: false,\n anchor: true,\n hidden: false,\n};\n\n/** A navbar is not a section; the ticks do not render on its card. */\nexport const NO_SECTION_CONTROLS: SectionControls = {\n background: false,\n spacing: false,\n anchor: false,\n hidden: false,\n};\n\nexport function defaultSectionControls(kind: BlockLibraryKind): SectionControls {\n if (kind === \"hero\") return { ...HERO_SECTION_CONTROLS };\n if (kind === \"navbar\") return { ...NO_SECTION_CONTROLS };\n return { ...DEFAULT_SECTION_CONTROLS };\n}\n\n/** The entry's kind, from `kind` or else its category. */\nexport function kindOf(entry: Pick<BlockLibraryEntry, \"kind\" | \"category\">): BlockLibraryKind {\n return entry.kind ?? (entry.category === \"hero\" ? \"hero\" : entry.category === \"navigation\" ? \"navbar\" : \"section\");\n}\n\n/**\n * Reads four booleans off a stored or partial value, taking `fallback` for\n * any key that is absent or not a boolean. A row saved before the columns\n * existed, or an entry that names only one key, resolves this way.\n */\nexport function sectionControlsOf(value: unknown, fallback: SectionControls): SectionControls {\n const source = value && typeof value === \"object\" ? (value as Record<string, unknown>) : {};\n const out = { ...fallback };\n for (const key of SECTION_CONTROL_KEYS) {\n if (typeof source[key] === \"boolean\") out[key] = source[key] as boolean;\n }\n return out;\n}\n\n/** The catalogue default for one entry: its own `sectionControls` over the kind's. */\nexport function entrySectionControls(entry: BlockLibraryEntry): SectionControls {\n return sectionControlsOf(entry.sectionControls, defaultSectionControls(kindOf(entry)));\n}\n","import type { SectionControls } from \"./controls\";\n\nexport const BLOCK_LIBRARY_SLUG = \"block-library\";\n\nexport const BLOCK_LIBRARY_CATEGORIES = [\n { id: \"hero\", label: \"Hero\" },\n { id: \"feature\", label: \"Feature\" },\n { id: \"process\", label: \"Process\" },\n { id: \"faq\", label: \"FAQ\" },\n { id: \"testimonials\", label: \"Testimonials\" },\n { id: \"stats\", label: \"Stats\" },\n { id: \"content\", label: \"Content\" },\n { id: \"contact\", label: \"Contact\" },\n { id: \"cta\", label: \"CTA\" },\n { id: \"navigation\", label: \"Navigation\" },\n] as const;\n\nexport type BlockLibraryCategoryId = (typeof BLOCK_LIBRARY_CATEGORIES)[number][\"id\"];\n\nexport type BlockLibraryKind = \"hero\" | \"section\" | \"navbar\";\n\n/**\n * Package catalogue. `megaMenu` and `navLink` are header item blocks, not\n * cards. Navigation's card is `floatingNav`. The preview route is SPI-53.\n */\nexport const PACKAGE_BLOCK_SLUGS = [\n \"hero\",\n \"heroSweep\",\n \"heroCompact\",\n \"heroSimple\",\n \"showcasePanels\",\n \"featureHighlights\",\n \"featureChecklist\",\n \"processSteps\",\n \"faqColumns\",\n \"testimonialMasonry\",\n \"testimonialCarousel\",\n \"statsBand\",\n \"richText\",\n \"video\",\n \"nap\",\n \"inquiryForm\",\n \"ctaBand\",\n \"logoCloud\",\n \"gallery\",\n \"floatingNav\",\n] as const;\n\nexport type PackageBlockSlug = (typeof PACKAGE_BLOCK_SLUGS)[number];\n\nexport interface BlockLibraryEntry {\n slug: string;\n label: string;\n category: string;\n /** Defaults from the category: hero, navbar for navigation, otherwise section. */\n kind?: BlockLibraryKind;\n supportsMega?: boolean;\n sample?: unknown;\n /**\n * Which section settings the block offers, as the catalogue default its\n * row is seeded with. A key left out follows `kind`: a hero offers\n * Anchor only, a section all four, a navbar none. The row is what an\n * Admin then edits; this is only where it starts.\n */\n sectionControls?: Partial<SectionControls>;\n /**\n * The block's picture in Payload's Add Block drawer: a URL the site serves,\n * such as a screenshot `bison-block-thumbnails --out-dir public/…` wrote.\n * `blockDrawer()` sets it as the block's `admin.images.thumbnail` unless\n * the block config already has one. Package blocks ship theirs; a site\n * extra passes its own.\n */\n thumbnail?: string;\n}\n\nexport interface BlockLibraryRow {\n id: string;\n slug: string;\n label: string;\n category: string;\n enabled: boolean;\n kind: BlockLibraryKind;\n /** Four checkboxes beside Enabled. Hidden stays off on a hero row. */\n sectionControls: SectionControls;\n}\n\n/** The Block library Global as `findGlobal` returns it; rows are read loosely. */\nexport interface BlockLibraryDoc {\n blocks?: unknown;\n}\n\nexport interface BlockLibraryHolder {\n title?: string | null;\n slug?: string | null;\n}\n\n/** A draft that still holds a slug: a collection document or a Global. */\nexport interface BlockLibraryDraftHolder extends BlockLibraryHolder {\n collection?: string;\n id?: string | number;\n global?: string;\n}\n\n/** Where a slug is used. `published` refuses a disable; `drafts` are stripped. */\nexport interface BlockLibraryUsage {\n published: BlockLibraryHolder[];\n drafts: BlockLibraryDraftHolder[];\n}\n","import {\n DEFAULT_SECTION_CONTROLS,\n defaultSectionControls,\n entrySectionControls,\n HERO_SECTION_CONTROLS,\n kindOf,\n NO_SECTION_CONTROLS,\n sectionControlsOf,\n type SectionControls,\n} from \"./controls\";\nimport type {\n BlockLibraryDoc,\n BlockLibraryEntry,\n BlockLibraryHolder,\n BlockLibraryKind,\n BlockLibraryRow,\n} from \"./types\";\nimport { PACKAGE_BLOCK_SLUGS } from \"./types\";\n\nconst NOT_CATALOGUE = new Set([\"megaMenu\", \"navLink\"]);\n\n/**\n * Section controls are written out per entry so the defaults are read here,\n * not inferred: heroes Anchor only, sections all four, the navbar none.\n */\nconst PACKAGE_BLOCKS: readonly BlockLibraryEntry[] = [\n { slug: \"hero\", label: \"Hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"heroSweep\", label: \"Sweep hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"heroCompact\", label: \"Compact hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"heroSimple\", label: \"Simple hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"showcasePanels\", label: \"Showcase panels\", category: \"feature\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"featureHighlights\", label: \"Feature highlights\", category: \"feature\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"featureChecklist\", label: \"Feature checklist\", category: \"feature\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"processSteps\", label: \"Process steps\", category: \"process\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"faqColumns\", label: \"FAQ\", category: \"faq\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"testimonialMasonry\", label: \"Testimonials\", category: \"testimonials\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"testimonialCarousel\", label: \"Testimonial carousel\", category: \"testimonials\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"statsBand\", label: \"Stats\", category: \"stats\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"richText\", label: \"Rich text\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"video\", label: \"Video\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"nap\", label: \"Contact\", category: \"contact\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"inquiryForm\", label: \"Inquiry form\", category: \"contact\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"ctaBand\", label: \"CTA band\", category: \"cta\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"logoCloud\", label: \"Logo cloud\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"gallery\", label: \"Gallery\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"floatingNav\", label: \"Floating navbar\", category: \"navigation\", kind: \"navbar\", supportsMega: true, sectionControls: NO_SECTION_CONTROLS },\n];\n\nexport interface BlockLibraryOptions {\n blocks?: readonly BlockLibraryEntry[];\n previewPath: (slug: string) => string;\n}\n\nexport interface BlockLibraryCheck {\n originals?: readonly BlockLibraryRow[];\n /** Published documents that hold a slug being turned off. Any refuses. */\n holders?: readonly BlockLibraryHolder[];\n /** Drafts that hold it. Named in a refusal; never a reason to refuse. */\n drafts?: readonly BlockLibraryHolder[];\n pages?: unknown[];\n}\n\nconst PACKAGE_SLUGS = new Set(PACKAGE_BLOCKS.map((entry) => entry.slug));\n\n/**\n * The package entries, then the site's extras. An extra whose slug the\n * package ships replaces that package entry in its place: a site that\n * registered its own block before the package shipped one under the same\n * slug still renders its own config, so its label, category, controls,\n * picture and sample are the true ones. A release that adds such a block\n * therefore never yields two rows for one slug, and never relabels the\n * site's block as the package's.\n */\nexport function blockLibraryCatalogue(extras: readonly BlockLibraryEntry[] = []): BlockLibraryEntry[] {\n const own = extras.filter((entry) => !NOT_CATALOGUE.has(entry.slug));\n const shadows = new Map(own.filter((entry) => PACKAGE_SLUGS.has(entry.slug)).map((entry) => [entry.slug, entry]));\n return [\n ...PACKAGE_BLOCKS.map((entry) => shadows.get(entry.slug) ?? { ...entry, sectionControls: { ...entry.sectionControls } }),\n ...own.filter((entry) => !PACKAGE_SLUGS.has(entry.slug)),\n ];\n}\n\nexport function defaultBlockLibraryValue(options: BlockLibraryOptions): BlockLibraryRow[] {\n return blockLibraryCatalogue(options.blocks).map((entry) => toRow(entry, true));\n}\n\nfunction toRow(entry: BlockLibraryEntry, enabled = true, sectionControls?: SectionControls): BlockLibraryRow {\n return {\n id: entry.slug,\n slug: entry.slug,\n label: entry.label,\n category: entry.category,\n enabled,\n kind: kindOf(entry),\n sectionControls: sectionControls ?? entrySectionControls(entry),\n };\n}\n\n/**\n * The stored rows, one per catalogue entry in catalogue order. A stored\n * `enabled` and each stored tick are kept; anything else (a row that is\n * not there, a column that did not exist when it was saved) takes the\n * entry's default. A block that arrives in a later release gets its\n * catalogue default this way, without a migration beyond the new columns.\n */\nexport function stampBlockLibrary(value: unknown, options: BlockLibraryOptions): BlockLibraryRow[] {\n const catalogue = blockLibraryCatalogue(options.blocks);\n const incoming = new Map<string, { enabled?: boolean; sectionControls?: unknown }>();\n if (Array.isArray(value)) {\n for (const item of value) {\n if (!item || typeof item !== \"object\" || !(\"slug\" in item)) continue;\n const slug = item.slug;\n if (typeof slug !== \"string\" || NOT_CATALOGUE.has(slug)) continue;\n if (!catalogue.some((entry) => entry.slug === slug)) continue;\n const row = item as { enabled?: unknown; sectionControls?: unknown };\n incoming.set(slug, {\n enabled: typeof row.enabled === \"boolean\" ? row.enabled : undefined,\n sectionControls: row.sectionControls,\n });\n }\n }\n return catalogue.map((entry) => {\n const stored = incoming.get(entry.slug);\n return toRow(\n entry,\n stored?.enabled ?? true,\n sectionControlsOf(stored?.sectionControls, entrySectionControls(entry)),\n );\n });\n}\n\nfunction isKind(value: unknown): value is BlockLibraryKind {\n return value === \"hero\" || value === \"section\" || value === \"navbar\";\n}\n\n/**\n * Every slug to the controls its row offers: the stored ticks when the\n * document holds the row, else the catalogue default. A stored row is kept\n * whether or not its slug is in the catalogue, so a site extra's saved\n * ticks are read without the site passing its `blocks` here (its stored\n * `kind` fills a key the row lacks). `extras` adds the catalogue default\n * for a site extra the document does not hold yet; `getSectionControls`\n * reads them off the Global's config. A slug in neither is absent from the\n * map, and a consumer treats that as every control\n * (`DEFAULT_SECTION_CONTROLS`). A disabled block keeps its ticks.\n */\nexport function sectionControlsFromLibrary(\n doc: BlockLibraryDoc | null | undefined,\n extras: readonly BlockLibraryEntry[] = [],\n): Record<string, SectionControls> {\n const rows = stampBlockLibrary(doc?.blocks, { blocks: extras, previewPath: () => \"\" });\n const map = Object.fromEntries(rows.map((row) => [row.slug, row.sectionControls]));\n const stored = Array.isArray(doc?.blocks) ? doc.blocks : [];\n for (const item of stored) {\n if (!item || typeof item !== \"object\") continue;\n const row = item as { slug?: unknown; kind?: unknown; sectionControls?: unknown };\n if (typeof row.slug !== \"string\" || !row.slug || NOT_CATALOGUE.has(row.slug) || row.slug in map) continue;\n map[row.slug] = sectionControlsOf(\n row.sectionControls,\n defaultSectionControls(isKind(row.kind) ? row.kind : \"section\"),\n );\n }\n return map;\n}\n\nfunction enabledOf(rows: readonly BlockLibraryRow[], kind: BlockLibraryKind): number {\n return rows.filter((row) => row.kind === kind && row.enabled).length;\n}\n\nfunction holderLabel(holder: BlockLibraryHolder): string {\n const title = holder.title?.trim() || \"Untitled\";\n const slug = holder.slug?.trim();\n return slug ? `${title} (${slug})` : title;\n}\n\n/**\n * Refuses Hidden on a hero row (a page cannot publish without its hero),\n * then a disable: the last hero, the last navbar, or a slug a published\n * document holds. Drafts alone never refuse; the Save that turns the slug\n * off strips them (`stripDrafts`). Pure — writes nothing.\n */\nexport async function validateBlockLibrary(\n value: unknown,\n options: BlockLibraryOptions,\n check: BlockLibraryCheck = {},\n): Promise<true | string> {\n const next = stampBlockLibrary(value, options);\n const hiddenHero = next.find((row) => row.kind === \"hero\" && row.sectionControls.hidden);\n if (hiddenHero) {\n return `${hiddenHero.label} cannot offer Hidden: a page cannot publish without its hero.`;\n }\n\n const previous = check.originals ?? defaultBlockLibraryValue(options);\n const turningOff = next.filter((row) => {\n const before = previous.find((entry) => entry.slug === row.slug);\n return before?.enabled !== false && row.enabled === false;\n });\n if (turningOff.length === 0) return true;\n\n if (turningOff.some((row) => row.kind === \"hero\") && enabledOf(next, \"hero\") === 0) {\n return \"Cannot disable the last hero.\";\n }\n if (turningOff.some((row) => row.kind === \"navbar\") && enabledOf(next, \"navbar\") === 0) {\n return \"Cannot disable the last navbar.\";\n }\n\n const holders = check.holders ?? [];\n if (holders.length > 0) {\n const names = holders.map(holderLabel).join(\", \");\n const slugs = turningOff.map((row) => row.label).join(\", \");\n const drafts = check.drafts ?? [];\n const draftNote =\n drafts.length > 0 ? ` Drafts also use it and were left as they are: ${drafts.map(holderLabel).join(\", \")}.` : \"\";\n return `Cannot disable ${slugs}. Still published on: ${names}. Remove it from those first.${draftNote}`;\n }\n\n return true;\n}\n\nexport function packageBlockSlugs(): readonly string[] {\n return PACKAGE_BLOCK_SLUGS;\n}\n","import type { Payload } from \"payload\";\n\nimport { sectionControlsFromLibrary } from \"./catalogue\";\nimport type { SectionControls } from \"./controls\";\nimport { BLOCK_LIBRARY_SLUG, PACKAGE_BLOCK_SLUGS, type BlockLibraryDoc, type BlockLibraryEntry } from \"./types\";\n\n/** The slice of `Payload` these readers need, so a test can pass a stub. */\nexport interface BlockLibraryReader {\n findGlobal: (args: { slug: string; depth: number; overrideAccess: boolean }) => Promise<unknown>;\n config?: { globals?: unknown };\n}\n\nconst PACKAGE_SLUGS = new Set<string>(PACKAGE_BLOCK_SLUGS);\n\n/**\n * A site's own Block library entries, read back off the registered Global:\n * `createBlockLibrary` keeps the rows it seeded (package and extras) on the\n * `blocks` field's `admin.custom.rows`, so a site block's catalogue default\n * is known here without the site passing `blocks` a second time. Package\n * slugs are left out (the catalogue already has them) unless the site\n * registered its own entry under one, which `siteSlugs` records.\n */\nexport function blockLibraryEntriesFromConfig(payload: Pick<BlockLibraryReader, \"config\">): BlockLibraryEntry[] {\n const globals = Array.isArray(payload.config?.globals) ? payload.config.globals : [];\n const library = globals.find(\n (global): global is { slug: string; fields?: unknown[] } =>\n typeof global === \"object\" && global !== null && (global as { slug?: unknown }).slug === BLOCK_LIBRARY_SLUG,\n );\n const blocks = (library?.fields ?? []).find(\n (field): field is { admin?: { custom?: { rows?: unknown; siteSlugs?: unknown } } } =>\n typeof field === \"object\" && field !== null && (field as { name?: unknown }).name === \"blocks\",\n );\n const rows = blocks?.admin?.custom?.rows;\n if (!Array.isArray(rows)) return [];\n const siteSlugs = blocks?.admin?.custom?.siteSlugs;\n const own = new Set(Array.isArray(siteSlugs) ? siteSlugs.filter((slug) => typeof slug === \"string\") : []);\n return rows.flatMap((row): BlockLibraryEntry[] => {\n if (!row || typeof row !== \"object\") return [];\n const { slug, label, category, kind, sectionControls } = row as Record<string, unknown>;\n if (typeof slug !== \"string\" || !slug || (PACKAGE_SLUGS.has(slug) && !own.has(slug))) return [];\n return [\n {\n slug,\n label: typeof label === \"string\" ? label : slug,\n category: typeof category === \"string\" ? category : \"content\",\n ...(kind === \"hero\" || kind === \"section\" || kind === \"navbar\" ? { kind } : {}),\n ...(sectionControls && typeof sectionControls === \"object\"\n ? { sectionControls: sectionControls as BlockLibraryEntry[\"sectionControls\"] }\n : {}),\n },\n ];\n });\n}\n\n/**\n * The Block library's section controls at request time, for a page route\n * to hand `RenderBlocks` as `sectionControls`. Access is overridden: the\n * Global is read by editors, and the page is read by everyone. A site\n * extra's stored ticks are kept, and one the document does not hold yet\n * takes its catalogue default from the Global's config; pass `extras` only\n * to add entries the config does not know.\n */\nexport async function getSectionControls(\n payload: BlockLibraryReader | Payload,\n extras: readonly BlockLibraryEntry[] = blockLibraryEntriesFromConfig(payload as BlockLibraryReader),\n): Promise<Record<string, SectionControls>> {\n const doc = (await payload.findGlobal({ slug: BLOCK_LIBRARY_SLUG, depth: 0, overrideAccess: true })) as\n | BlockLibraryDoc\n | null\n | undefined;\n return sectionControlsFromLibrary(doc, extras);\n}\n"],"mappings":";;;;;;;;;AAUA,MAAa,uBAAuB;CAAC;CAAc;CAAW;CAAU;CAAS;;AAOjF,MAAa,yBAA4D;CACvE,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,QAAQ;CACT;;AAGD,MAAa,2BAA4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D,GAAI,SAAS,UAAU,SAAS,aAAa,SAAS,WAAW,EAAE,MAAM,GAAG,EAAE;GAC9E,GAAI,mBAAmB,OAAO,oBAAoB,WAC9C,EAAmB,iBAAyD,GAC5E,EAAE;GACP,CACF;GACD;;;;;;;;;;AAWJ,eAAsB,mBACpB,SACA,SAAuC,8BAA8B,QAA8B,EACzD;AAK1C,QAAO,2BAJM,MAAM,QAAQ,WAAW;EAAE,MAAM;EAAoB,OAAO;EAAG,gBAAgB;EAAM,CAAC,EAI5D,OAAO"}
@@ -16,7 +16,7 @@ import { parseArgs } from "node:util";
16
16
  *
17
17
  * WIREFRAME_EMAIL=… WIREFRAME_PASSWORD=… bison-wireframes \
18
18
  * --base http://localhost:3039 \
19
- * --slugs ctaBand,productMap \
19
+ * --slugs pricingTable,productMap \
20
20
  * --out src/blocks/wireframes.generated.ts
21
21
  *
22
22
  * `--preview /block-library/{slug}` is the route (the default), `--selector`
@@ -1 +1 @@
1
- {"version":3,"file":"wireframe-cli.mjs","names":[],"sources":["../src/wireframe-cli.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * @deprecated since 4.16: use `bison-block-thumbnails`, which takes real\n * screenshots. Still works for this release; it prints a pointer first.\n *\n * `bison-wireframes`: writes a module of Add Block drawer thumbnails, one\n * black-and-white wireframe per block, from a running site's Block library\n * preview route. Run it from the site, which supplies Playwright and its\n * browser; this package does not depend on either.\n *\n * WIREFRAME_EMAIL=… WIREFRAME_PASSWORD=… bison-wireframes \\\n * --base http://localhost:3039 \\\n * --slugs ctaBand,productMap \\\n * --out src/blocks/wireframes.generated.ts\n *\n * `--preview /block-library/{slug}` is the route (the default), `--selector`\n * the element that holds the sample (default: `BlockLibraryIsland`'s), and\n * `--users users` the auth collection to sign in to. The login is read from the\n * environment, never from arguments, so it stays out of shell history, and\n * is required unless `--no-login` names a public route. A preview that\n * answers an error or renders no sample fails the run; nothing is written.\n */\nimport { mkdirSync, writeFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { parseArgs } from \"node:util\";\n\nimport { captureWireframes, svgDataUri, type WireframePage } from \"./wireframe\";\n\ntype Browser = {\n newContext(): Promise<{\n newPage(): Promise<WireframePage>;\n request: { post(url: string, options: { data: unknown }): Promise<{ ok(): boolean; status(): number }> };\n }>;\n close(): Promise<void>;\n};\n\nconst { values } = parseArgs({\n options: {\n base: { type: \"string\" },\n preview: { type: \"string\", default: \"/block-library/{slug}\" },\n selector: { type: \"string\" },\n slugs: { type: \"string\" },\n out: { type: \"string\" },\n \"svg-dir\": { type: \"string\" },\n users: { type: \"string\", default: \"users\" },\n export: { type: \"string\", default: \"BLOCK_WIREFRAMES\" },\n \"no-login\": { type: \"boolean\", default: false },\n },\n});\n\nconsole.warn(\"bison-wireframes is deprecated: use bison-block-thumbnails (real screenshots) instead. It goes in the next major.\");\n\nfunction fail(message: string): never {\n console.error(`bison-wireframes: ${message}`);\n process.exit(1);\n}\n\nconst base = values.base?.replace(/\\/$/, \"\") ?? fail(\"--base is required\");\nconst slugs = (values.slugs ?? fail(\"--slugs is required\")).split(\",\").map((slug) => slug.trim()).filter(Boolean);\nconst out = values.out ?? fail(\"--out is required\");\nconst email = process.env.WIREFRAME_EMAIL;\nconst password = process.env.WIREFRAME_PASSWORD;\n// The Block library preview refuses a logged-out request, so a missing\n// login is an error unless the route is public (`--no-login`).\nif (!values[\"no-login\"] && !(email && password)) {\n fail(\"set WIREFRAME_EMAIL and WIREFRAME_PASSWORD, or pass --no-login for a public preview route\");\n}\n\n// Playwright from the site running this, not from this package.\nconst require = createRequire(join(process.cwd(), \"package.json\"));\nlet chromium: { launch(): Promise<Browser> };\ntry {\n ({ chromium } = require(\"playwright\") as { chromium: typeof chromium });\n} catch {\n try {\n ({ chromium } = require(\"@playwright/test\") as { chromium: typeof chromium });\n } catch {\n fail(\"needs playwright (or @playwright/test) installed in the project it runs from\");\n }\n}\n\nconst browser = await chromium.launch();\ntry {\n const context = await browser.newContext();\n if (!values[\"no-login\"]) {\n const login = await context.request.post(`${base}/api/${values.users}/login`, { data: { email, password } });\n if (!login.ok()) fail(`sign-in to ${base} failed (${login.status()})`);\n }\n const page = await context.newPage();\n const previews = slugs.map((slug) => ({ slug, url: `${base}${values.preview!.replace(\"{slug}\", slug)}` }));\n const svgs = await captureWireframes(page, previews, values.selector ? { selector: values.selector } : {});\n\n if (values[\"svg-dir\"]) {\n mkdirSync(values[\"svg-dir\"], { recursive: true });\n for (const [slug, svg] of Object.entries(svgs)) writeFileSync(join(values[\"svg-dir\"], `${slug}.svg`), svg);\n }\n\n const lines = Object.entries(svgs).map(([slug, svg]) => ` ${JSON.stringify(slug)}: ${JSON.stringify(svgDataUri(svg))},`);\n const module = [\n \"// Generated by `bison-wireframes` (@bison-lab/payload-core) from each block's\",\n \"// Block library preview. Do not edit by hand: rerun it when a layout changes.\",\n `export const ${values.export}: Record<string, string> = {`,\n ...lines,\n \"};\",\n \"\",\n ].join(\"\\n\");\n const target = resolve(out);\n mkdirSync(dirname(target), { recursive: true });\n writeFileSync(target, module);\n console.log(`bison-wireframes: wrote ${slugs.length} wireframes to ${out}`);\n} catch (error) {\n await browser.close();\n fail(error instanceof Error ? error.message : String(error));\n} finally {\n await browser.close();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAM,EAAE,WAAW,UAAU,EAC3B,SAAS;CACP,MAAM,EAAE,MAAM,UAAU;CACxB,SAAS;EAAE,MAAM;EAAU,SAAS;EAAyB;CAC7D,UAAU,EAAE,MAAM,UAAU;CAC5B,OAAO,EAAE,MAAM,UAAU;CACzB,KAAK,EAAE,MAAM,UAAU;CACvB,WAAW,EAAE,MAAM,UAAU;CAC7B,OAAO;EAAE,MAAM;EAAU,SAAS;EAAS;CAC3C,QAAQ;EAAE,MAAM;EAAU,SAAS;EAAoB;CACvD,YAAY;EAAE,MAAM;EAAW,SAAS;EAAO;CAChD,EACF,CAAC;AAEF,QAAQ,KAAK,oHAAoH;A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OAAO,YAAY,EAAE,WAAW,MAAM,CAAC;AACjD,OAAK,MAAM,CAAC,MAAM,QAAQ,OAAO,QAAQ,KAAK,CAAE,eAAc,KAAK,OAAO,YAAY,GAAG,KAAK,MAAM,EAAE,IAAI;;CAG5G,MAAM,QAAQ,OAAO,QAAQ,KAAK,CAAC,KAAK,CAAC,MAAM,SAAS,KAAK,KAAK,UAAU,KAAK,CAAC,IAAI,KAAK,UAAU,WAAW,IAAI,CAAC,CAAC,GAAG;CACzH,MAAM,SAAS;EACb;EACA;EACA,gBAAgB,OAAO,OAAO;EAC9B,GAAG;EACH;EACA;EACD,CAAC,KAAK,KAAK;CACZ,MAAM,SAAS,QAAQ,IAAI;AAC3B,WAAU,QAAQ,OAAO,EAAE,EAAE,WAAW,MAAM,CAAC;AAC/C,eAAc,QAAQ,OAAO;AAC7B,SAAQ,IAAI,2BAA2B,MAAM,OAAO,iBAAiB,MAAM;SACpE,OAAO;AACd,OAAM,QAAQ,OAAO;AACrB,MAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;UACpD;AACR,OAAM,QAAQ,OAAO"}
1
+ {"version":3,"file":"wireframe-cli.mjs","names":[],"sources":["../src/wireframe-cli.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * @deprecated since 4.16: use `bison-block-thumbnails`, which takes real\n * screenshots. Still works for this release; it prints a pointer first.\n *\n * `bison-wireframes`: writes a module of Add Block drawer thumbnails, one\n * black-and-white wireframe per block, from a running site's Block library\n * preview route. Run it from the site, which supplies Playwright and its\n * browser; this package does not depend on either.\n *\n * WIREFRAME_EMAIL=… WIREFRAME_PASSWORD=… bison-wireframes \\\n * --base http://localhost:3039 \\\n * --slugs pricingTable,productMap \\\n * --out src/blocks/wireframes.generated.ts\n *\n * `--preview /block-library/{slug}` is the route (the default), `--selector`\n * the element that holds the sample (default: `BlockLibraryIsland`'s), and\n * `--users users` the auth collection to sign in to. The login is read from the\n * environment, never from arguments, so it stays out of shell history, and\n * is required unless `--no-login` names a public route. A preview that\n * answers an error or renders no sample fails the run; nothing is written.\n */\nimport { mkdirSync, writeFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { parseArgs } from \"node:util\";\n\nimport { captureWireframes, svgDataUri, type WireframePage } from \"./wireframe\";\n\ntype Browser = {\n newContext(): Promise<{\n newPage(): Promise<WireframePage>;\n request: { post(url: string, options: { data: unknown }): Promise<{ ok(): boolean; status(): number }> };\n }>;\n close(): Promise<void>;\n};\n\nconst { values } = parseArgs({\n options: {\n base: { type: \"string\" },\n preview: { type: \"string\", default: \"/block-library/{slug}\" },\n selector: { type: \"string\" },\n slugs: { type: \"string\" },\n out: { type: \"string\" },\n \"svg-dir\": { type: \"string\" },\n users: { type: \"string\", default: \"users\" },\n export: { type: \"string\", default: \"BLOCK_WIREFRAMES\" },\n \"no-login\": { type: \"boolean\", default: false },\n },\n});\n\nconsole.warn(\"bison-wireframes is deprecated: use bison-block-thumbnails (real screenshots) instead. It goes in the next major.\");\n\nfunction fail(message: string): never {\n console.error(`bison-wireframes: ${message}`);\n process.exit(1);\n}\n\nconst base = values.base?.replace(/\\/$/, \"\") ?? fail(\"--base is required\");\nconst slugs = (values.slugs ?? fail(\"--slugs is required\")).split(\",\").map((slug) => slug.trim()).filter(Boolean);\nconst out = values.out ?? fail(\"--out is required\");\nconst email = process.env.WIREFRAME_EMAIL;\nconst password = process.env.WIREFRAME_PASSWORD;\n// The Block library preview refuses a logged-out request, so a missing\n// login is an error unless the route is public (`--no-login`).\nif (!values[\"no-login\"] && !(email && password)) {\n fail(\"set WIREFRAME_EMAIL and WIREFRAME_PASSWORD, or pass --no-login for a public preview route\");\n}\n\n// Playwright from the site running this, not from this package.\nconst require = createRequire(join(process.cwd(), \"package.json\"));\nlet chromium: { launch(): Promise<Browser> };\ntry {\n ({ chromium } = require(\"playwright\") as { chromium: typeof chromium });\n} catch {\n try {\n ({ chromium } = require(\"@playwright/test\") as { chromium: typeof chromium });\n } catch {\n fail(\"needs playwright (or @playwright/test) installed in the project it runs from\");\n }\n}\n\nconst browser = await chromium.launch();\ntry {\n const context = await browser.newContext();\n if (!values[\"no-login\"]) {\n const login = await context.request.post(`${base}/api/${values.users}/login`, { data: { email, password } });\n if (!login.ok()) fail(`sign-in to ${base} failed (${login.status()})`);\n }\n const page = await context.newPage();\n const previews = slugs.map((slug) => ({ slug, url: `${base}${values.preview!.replace(\"{slug}\", slug)}` }));\n const svgs = await captureWireframes(page, previews, values.selector ? { selector: values.selector } : {});\n\n if (values[\"svg-dir\"]) {\n mkdirSync(values[\"svg-dir\"], { recursive: true });\n for (const [slug, svg] of Object.entries(svgs)) writeFileSync(join(values[\"svg-dir\"], `${slug}.svg`), svg);\n }\n\n const lines = Object.entries(svgs).map(([slug, svg]) => ` ${JSON.stringify(slug)}: ${JSON.stringify(svgDataUri(svg))},`);\n const module = [\n \"// Generated by `bison-wireframes` (@bison-lab/payload-core) from each block's\",\n \"// Block library preview. Do not edit by hand: rerun it when a layout changes.\",\n `export const ${values.export}: Record<string, string> = {`,\n ...lines,\n \"};\",\n \"\",\n ].join(\"\\n\");\n const target = resolve(out);\n mkdirSync(dirname(target), { recursive: true });\n writeFileSync(target, module);\n console.log(`bison-wireframes: wrote ${slugs.length} wireframes to ${out}`);\n} catch (error) {\n await browser.close();\n fail(error instanceof Error ? error.message : String(error));\n} finally {\n await browser.close();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAM,EAAE,WAAW,UAAU,EAC3B,SAAS;CACP,MAAM,EAAE,MAAM,UAAU;CACxB,SAAS;EAAE,MAAM;EAAU,SAAS;EAAyB;CAC7D,UAAU,EAAE,MAAM,UAAU;CAC5B,OAAO,EAAE,MAAM,UAAU;CACzB,KAAK,EAAE,MAAM,UAAU;CACvB,WAAW,EAAE,MAAM,UAAU;CAC7B,OAAO;EAAE,MAAM;EAAU,SAAS;EAAS;CAC3C,QAAQ;EAAE,MAAM;E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I,EAAE,EACrD,OAAO,WAAW,EAAE,UAAU,OAAO,UAAU,GAAG,EAAE,CAAC;AAE1G,KAAI,OAAO,YAAY;AACrB,YAAU,OAAO,YAAY,EAAE,WAAW,MAAM,CAAC;AACjD,OAAK,MAAM,CAAC,MAAM,QAAQ,OAAO,QAAQ,KAAK,CAAE,eAAc,KAAK,OAAO,YAAY,GAAG,KAAK,MAAM,EAAE,IAAI;;CAG5G,MAAM,QAAQ,OAAO,QAAQ,KAAK,CAAC,KAAK,CAAC,MAAM,SAAS,KAAK,KAAK,UAAU,KAAK,CAAC,IAAI,KAAK,UAAU,WAAW,IAAI,CAAC,CAAC,GAAG;CACzH,MAAM,SAAS;EACb;EACA;EACA,gBAAgB,OAAO,OAAO;EAC9B,GAAG;EACH;EACA;EACD,CAAC,KAAK,KAAK;CACZ,MAAM,SAAS,QAAQ,IAAI;AAC3B,WAAU,QAAQ,OAAO,EAAE,EAAE,WAAW,MAAM,CAAC;AAC/C,eAAc,QAAQ,OAAO;AAC7B,SAAQ,IAAI,2BAA2B,MAAM,OAAO,iBAAiB,MAAM;SACpE,OAAO;AACd,OAAM,QAAQ,OAAO;AACrB,MAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;UACpD;AACR,OAAM,QAAQ,OAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bison-lab/payload-core",
3
- "version": "4.30.0",
3
+ "version": "4.32.1",
4
4
  "description": "Site-agnostic Payload CMS configuration for Bison Lab sites: the SEO tab, the Theme global, the Roles Global, the brand-assets cupboard, and the metadata and theme readers for the pages they describe",
5
5
  "keywords": [
6
6
  "bison-lab",
@@ -135,9 +135,9 @@
135
135
  "tsdown": "^0.21.0",
136
136
  "typescript": "^5.9.3",
137
137
  "vitest": "^4.1.2",
138
- "@bison-lab/fonts": "3.27.1",
139
138
  "@bison-lab/tokens": "4.5.0",
140
- "@bison-lab/ui": "4.30.0"
139
+ "@bison-lab/fonts": "3.27.1",
140
+ "@bison-lab/ui": "4.32.0"
141
141
  },
142
142
  "publishConfig": {
143
143
  "access": "public"
@@ -1 +0,0 @@
1
- {"version":3,"file":"catalogue-C2r48lET.d.mts","names":[],"sources":["../src/block-library/types.ts","../src/block-library/controls.ts","../src/block-library/published.ts","../src/block-library/catalogue.ts"],"mappings":";;;cAEa,kBAAA;AAAA,cAEA,wBAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAaD,sBAAA,WAAiC,wBAAA;AAAA,KAEjC,gBAAA;;;;;AAAZ;cAOa,mBAAA;AAAA,KAoBD,gBAAA,WAA2B,mBAAA;AAAA,UAEtB,iBAAA;EACf,IAAA;EACA,KAAA;EACA,QAAA;;EAEA,IAAA,GAAO,gBAAA;EACP,YAAA;EACA,MAAA;EAT0B;;;;AAE5B;;EAcE,eAAA,GAAkB,OAAA,CAAQ,eAAA;EATnB;;;;;;;EAiBP,SAAA;AAAA;AAAA,UAGe,eAAA;EACf,EAAA;EACA,IAAA;EACA,KAAA;EACA,QAAA;EACA,OAAA;EACA,IAAA,EAAM,gBAAA;EATG;EAWT,eAAA,EAAiB,eAAA;AAAA;;UAIF,eAAA;EACf,MAAA;AAAA;AAAA,UAGe,kBAAA;EACf,KAAA;EACA,IAAA;AAAA;;UAIe,uBAAA,SAAgC,kBAAA;EAC/C,UAAA;EACA,EAAA;EACA,MAAA;AAAA;AAbF;AAAA,UAiBiB,iBAAA;EACf,SAAA,EAAW,kBAAA;EACX,MAAA,EAAQ,uBAAA;AAAA;;;;;AAtGV;;;;;AAEA;cCMa,oBAAA;AAAA,KAED,iBAAA,WAA4B,oBAAA;AAAA,KAE5B,eAAA,GAAkB,MAAA,CAAO,iBAAA;;cAGxB,sBAAA,EAAwB,MAAA,CAAO,iBAAA;;cAQ/B,wBAAA,EAA0B,eAAA;;;;;;cAY1B,qBAAA,EAAuB,eAAA;;cAQvB,mBAAA,EAAqB,eAAA;AAAA,iBAOlB,sBAAA,CAAuB,IAAA,EAAM,gBAAA,GAAmB,eAAA;;;;;;iBAgBhD,iBAAA,CAAkB,KAAA,WAAgB,QAAA,EAAU,eAAA,GAAkB,eAAA;;;ADlE9E;AAAA,UEKiB,kBAAA;EACf,UAAA,GAAa,IAAA;IAAQ,IAAA;IAAc,KAAA;IAAe,cAAA;EAAA,MAA8B,OAAA;EAChF,MAAA;IAAW,OAAA;EAAA;AAAA;;;;;;;;iBAYG,6BAAA,CAA8B,OAAA,EAAS,IAAA,CAAK,kBAAA,cAAgC,iBAAA;;;;;;;;;iBAsCtE,kBAAA,CACpB,OAAA,EAAS,kBAAA,GAAqB,OAAA,EAC9B,MAAA,YAAiB,iBAAA,KAChB,OAAA,CAAQ,MAAA,SAAe,eAAA;;;UCjBT,mBAAA;EACf,MAAA,YAAkB,iBAAA;EAClB,WAAA,GAAc,IAAA;AAAA;AAAA,UAGC,iBAAA;EACf,SAAA,YAAqB,eAAA;EH/CV;EGiDX,OAAA,YAAmB,kBAAA;;EAEnB,MAAA,YAAkB,kBAAA;EAClB,KAAA;AAAA;AAAA,iBAGc,qBAAA,CAAsB,MAAA,YAAiB,iBAAA,KAA2B,iBAAA;AAAA,iBAQlE,wBAAA,CAAyB,OAAA,EAAS,mBAAA,GAAsB,eAAA;;;;;;;;iBAuBxD,iBAAA,CAAkB,KAAA,WAAgB,OAAA,EAAS,mBAAA,GAAsB,eAAA;;;;;;;;;;;AHzEjF;iBGkHgB,0BAAA,CACd,GAAA,EAAK,eAAA,qBACL,MAAA,YAAiB,iBAAA,KAChB,MAAA,SAAe,eAAA;;;;AHnHlB;;;iBGmJsB,oBAAA,CACpB,KAAA,WACA,OAAA,EAAS,mBAAA,EACT,KAAA,GAAO,iBAAA,GACN,OAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"published-Cc1a8uYp.mjs","names":[],"sources":["../src/block-library/controls.ts","../src/block-library/types.ts","../src/block-library/catalogue.ts","../src/block-library/published.ts"],"sourcesContent":["import type { BlockLibraryEntry, BlockLibraryKind } from \"./types\";\n\n/**\n * Which of the four section settings a block offers its editors. The\n * settings group on every page block keeps all four fields, so the page\n * schema never moves; a tick off hides the control in the editor and the\n * renderer ignores its stored value (payload-blocks, BIS-138). The choice\n * lives on the Block library row, seeded from the catalogue, so turning\n * one control off for one block is a Save, not a release (BIS-136).\n */\nexport const SECTION_CONTROL_KEYS = [\"background\", \"spacing\", \"anchor\", \"hidden\"] as const;\n\nexport type SectionControlKey = (typeof SECTION_CONTROL_KEYS)[number];\n\nexport type SectionControls = Record<SectionControlKey, boolean>;\n\n/** The words the settings fold uses, so the ticks read as the controls they hide. */\nexport const SECTION_CONTROL_LABELS: Record<SectionControlKey, string> = {\n background: \"Background\",\n spacing: \"Spacing\",\n anchor: \"Anchor\",\n hidden: \"Hidden\",\n};\n\n/** A section: every control. Also what a slug no catalogue knows gets. */\nexport const DEFAULT_SECTION_CONTROLS: SectionControls = {\n background: true,\n spacing: true,\n anchor: true,\n hidden: true,\n};\n\n/**\n * A hero: Anchor only. Background would compete with the hero's own tone,\n * Spacing is header clearance the editor should not change, and a hidden\n * hero is a published page with no opening.\n */\nexport const HERO_SECTION_CONTROLS: SectionControls = {\n background: false,\n spacing: false,\n anchor: true,\n hidden: false,\n};\n\n/** A navbar is not a section; the ticks do not render on its card. */\nexport const NO_SECTION_CONTROLS: SectionControls = {\n background: false,\n spacing: false,\n anchor: false,\n hidden: false,\n};\n\nexport function defaultSectionControls(kind: BlockLibraryKind): SectionControls {\n if (kind === \"hero\") return { ...HERO_SECTION_CONTROLS };\n if (kind === \"navbar\") return { ...NO_SECTION_CONTROLS };\n return { ...DEFAULT_SECTION_CONTROLS };\n}\n\n/** The entry's kind, from `kind` or else its category. */\nexport function kindOf(entry: Pick<BlockLibraryEntry, \"kind\" | \"category\">): BlockLibraryKind {\n return entry.kind ?? (entry.category === \"hero\" ? \"hero\" : entry.category === \"navigation\" ? \"navbar\" : \"section\");\n}\n\n/**\n * Reads four booleans off a stored or partial value, taking `fallback` for\n * any key that is absent or not a boolean. A row saved before the columns\n * existed, or an entry that names only one key, resolves this way.\n */\nexport function sectionControlsOf(value: unknown, fallback: SectionControls): SectionControls {\n const source = value && typeof value === \"object\" ? (value as Record<string, unknown>) : {};\n const out = { ...fallback };\n for (const key of SECTION_CONTROL_KEYS) {\n if (typeof source[key] === \"boolean\") out[key] = source[key] as boolean;\n }\n return out;\n}\n\n/** The catalogue default for one entry: its own `sectionControls` over the kind's. */\nexport function entrySectionControls(entry: BlockLibraryEntry): SectionControls {\n return sectionControlsOf(entry.sectionControls, defaultSectionControls(kindOf(entry)));\n}\n","import type { SectionControls } from \"./controls\";\n\nexport const BLOCK_LIBRARY_SLUG = \"block-library\";\n\nexport const BLOCK_LIBRARY_CATEGORIES = [\n { id: \"hero\", label: \"Hero\" },\n { id: \"feature\", label: \"Feature\" },\n { id: \"process\", label: \"Process\" },\n { id: \"faq\", label: \"FAQ\" },\n { id: \"testimonials\", label: \"Testimonials\" },\n { id: \"stats\", label: \"Stats\" },\n { id: \"content\", label: \"Content\" },\n { id: \"contact\", label: \"Contact\" },\n { id: \"cta\", label: \"CTA\" },\n { id: \"navigation\", label: \"Navigation\" },\n] as const;\n\nexport type BlockLibraryCategoryId = (typeof BLOCK_LIBRARY_CATEGORIES)[number][\"id\"];\n\nexport type BlockLibraryKind = \"hero\" | \"section\" | \"navbar\";\n\n/**\n * Package catalogue. `megaMenu` and `navLink` are header item blocks, not\n * cards. Navigation's card is `floatingNav`. CTA is a category for a site\n * extra; the package ships no CTA slug. The preview route is SPI-53.\n */\nexport const PACKAGE_BLOCK_SLUGS = [\n \"hero\",\n \"heroSweep\",\n \"heroCompact\",\n \"heroSimple\",\n \"showcasePanels\",\n \"featureHighlights\",\n \"featureChecklist\",\n \"processSteps\",\n \"faqColumns\",\n \"testimonialMasonry\",\n \"testimonialCarousel\",\n \"statsBand\",\n \"richText\",\n \"video\",\n \"nap\",\n \"inquiryForm\",\n \"floatingNav\",\n] as const;\n\nexport type PackageBlockSlug = (typeof PACKAGE_BLOCK_SLUGS)[number];\n\nexport interface BlockLibraryEntry {\n slug: string;\n label: string;\n category: string;\n /** Defaults from the category: hero, navbar for navigation, otherwise section. */\n kind?: BlockLibraryKind;\n supportsMega?: boolean;\n sample?: unknown;\n /**\n * Which section settings the block offers, as the catalogue default its\n * row is seeded with. A key left out follows `kind`: a hero offers\n * Anchor only, a section all four, a navbar none. The row is what an\n * Admin then edits; this is only where it starts.\n */\n sectionControls?: Partial<SectionControls>;\n /**\n * The block's picture in Payload's Add Block drawer: a URL the site serves,\n * such as a screenshot `bison-block-thumbnails --out-dir public/…` wrote.\n * `blockDrawer()` sets it as the block's `admin.images.thumbnail` unless\n * the block config already has one. Package blocks ship theirs; a site\n * extra passes its own.\n */\n thumbnail?: string;\n}\n\nexport interface BlockLibraryRow {\n id: string;\n slug: string;\n label: string;\n category: string;\n enabled: boolean;\n kind: BlockLibraryKind;\n /** Four checkboxes beside Enabled. Hidden stays off on a hero row. */\n sectionControls: SectionControls;\n}\n\n/** The Block library Global as `findGlobal` returns it; rows are read loosely. */\nexport interface BlockLibraryDoc {\n blocks?: unknown;\n}\n\nexport interface BlockLibraryHolder {\n title?: string | null;\n slug?: string | null;\n}\n\n/** A draft that still holds a slug: a collection document or a Global. */\nexport interface BlockLibraryDraftHolder extends BlockLibraryHolder {\n collection?: string;\n id?: string | number;\n global?: string;\n}\n\n/** Where a slug is used. `published` refuses a disable; `drafts` are stripped. */\nexport interface BlockLibraryUsage {\n published: BlockLibraryHolder[];\n drafts: BlockLibraryDraftHolder[];\n}\n","import {\n DEFAULT_SECTION_CONTROLS,\n defaultSectionControls,\n entrySectionControls,\n HERO_SECTION_CONTROLS,\n kindOf,\n NO_SECTION_CONTROLS,\n sectionControlsOf,\n type SectionControls,\n} from \"./controls\";\nimport type {\n BlockLibraryDoc,\n BlockLibraryEntry,\n BlockLibraryHolder,\n BlockLibraryKind,\n BlockLibraryRow,\n} from \"./types\";\nimport { PACKAGE_BLOCK_SLUGS } from \"./types\";\n\nconst NOT_CATALOGUE = new Set([\"megaMenu\", \"navLink\"]);\n\n/**\n * Section controls are written out per entry so the defaults are read here,\n * not inferred: heroes Anchor only, sections all four, the navbar none.\n */\nconst PACKAGE_BLOCKS: readonly BlockLibraryEntry[] = [\n { slug: \"hero\", label: \"Hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"heroSweep\", label: \"Sweep hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"heroCompact\", label: \"Compact hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"heroSimple\", label: \"Simple hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"showcasePanels\", label: \"Showcase panels\", category: \"feature\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"featureHighlights\", label: \"Feature highlights\", category: \"feature\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"featureChecklist\", label: \"Feature checklist\", category: \"feature\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"processSteps\", label: \"Process steps\", category: \"process\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"faqColumns\", label: \"FAQ\", category: \"faq\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"testimonialMasonry\", label: \"Testimonials\", category: \"testimonials\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"testimonialCarousel\", label: \"Testimonial carousel\", category: \"testimonials\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"statsBand\", label: \"Stats\", category: \"stats\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"richText\", label: \"Rich text\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"video\", label: \"Video\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"nap\", label: \"Contact\", category: \"contact\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"inquiryForm\", label: \"Inquiry form\", category: \"contact\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"floatingNav\", label: \"Floating navbar\", category: \"navigation\", kind: \"navbar\", supportsMega: true, sectionControls: NO_SECTION_CONTROLS },\n];\n\nexport interface BlockLibraryOptions {\n blocks?: readonly BlockLibraryEntry[];\n previewPath: (slug: string) => string;\n}\n\nexport interface BlockLibraryCheck {\n originals?: readonly BlockLibraryRow[];\n /** Published documents that hold a slug being turned off. Any refuses. */\n holders?: readonly BlockLibraryHolder[];\n /** Drafts that hold it. Named in a refusal; never a reason to refuse. */\n drafts?: readonly BlockLibraryHolder[];\n pages?: unknown[];\n}\n\nexport function blockLibraryCatalogue(extras: readonly BlockLibraryEntry[] = []): BlockLibraryEntry[] {\n const extra = extras.filter((entry) => !NOT_CATALOGUE.has(entry.slug));\n return [\n ...PACKAGE_BLOCKS.map((entry) => ({ ...entry, sectionControls: { ...entry.sectionControls } })),\n ...extra,\n ];\n}\n\nexport function defaultBlockLibraryValue(options: BlockLibraryOptions): BlockLibraryRow[] {\n return blockLibraryCatalogue(options.blocks).map((entry) => toRow(entry, true));\n}\n\nfunction toRow(entry: BlockLibraryEntry, enabled = true, sectionControls?: SectionControls): BlockLibraryRow {\n return {\n id: entry.slug,\n slug: entry.slug,\n label: entry.label,\n category: entry.category,\n enabled,\n kind: kindOf(entry),\n sectionControls: sectionControls ?? entrySectionControls(entry),\n };\n}\n\n/**\n * The stored rows, one per catalogue entry in catalogue order. A stored\n * `enabled` and each stored tick are kept; anything else (a row that is\n * not there, a column that did not exist when it was saved) takes the\n * entry's default. A block that arrives in a later release gets its\n * catalogue default this way, without a migration beyond the new columns.\n */\nexport function stampBlockLibrary(value: unknown, options: BlockLibraryOptions): BlockLibraryRow[] {\n const catalogue = blockLibraryCatalogue(options.blocks);\n const incoming = new Map<string, { enabled?: boolean; sectionControls?: unknown }>();\n if (Array.isArray(value)) {\n for (const item of value) {\n if (!item || typeof item !== \"object\" || !(\"slug\" in item)) continue;\n const slug = item.slug;\n if (typeof slug !== \"string\" || NOT_CATALOGUE.has(slug)) continue;\n if (!catalogue.some((entry) => entry.slug === slug)) continue;\n const row = item as { enabled?: unknown; sectionControls?: unknown };\n incoming.set(slug, {\n enabled: typeof row.enabled === \"boolean\" ? row.enabled : undefined,\n sectionControls: row.sectionControls,\n });\n }\n }\n return catalogue.map((entry) => {\n const stored = incoming.get(entry.slug);\n return toRow(\n entry,\n stored?.enabled ?? true,\n sectionControlsOf(stored?.sectionControls, entrySectionControls(entry)),\n );\n });\n}\n\nfunction isKind(value: unknown): value is BlockLibraryKind {\n return value === \"hero\" || value === \"section\" || value === \"navbar\";\n}\n\n/**\n * Every slug to the controls its row offers: the stored ticks when the\n * document holds the row, else the catalogue default. A stored row is kept\n * whether or not its slug is in the catalogue, so a site extra's saved\n * ticks are read without the site passing its `blocks` here (its stored\n * `kind` fills a key the row lacks). `extras` adds the catalogue default\n * for a site extra the document does not hold yet; `getSectionControls`\n * reads them off the Global's config. A slug in neither is absent from the\n * map, and a consumer treats that as every control\n * (`DEFAULT_SECTION_CONTROLS`). A disabled block keeps its ticks.\n */\nexport function sectionControlsFromLibrary(\n doc: BlockLibraryDoc | null | undefined,\n extras: readonly BlockLibraryEntry[] = [],\n): Record<string, SectionControls> {\n const rows = stampBlockLibrary(doc?.blocks, { blocks: extras, previewPath: () => \"\" });\n const map = Object.fromEntries(rows.map((row) => [row.slug, row.sectionControls]));\n const stored = Array.isArray(doc?.blocks) ? doc.blocks : [];\n for (const item of stored) {\n if (!item || typeof item !== \"object\") continue;\n const row = item as { slug?: unknown; kind?: unknown; sectionControls?: unknown };\n if (typeof row.slug !== \"string\" || !row.slug || NOT_CATALOGUE.has(row.slug) || row.slug in map) continue;\n map[row.slug] = sectionControlsOf(\n row.sectionControls,\n defaultSectionControls(isKind(row.kind) ? row.kind : \"section\"),\n );\n }\n return map;\n}\n\nfunction enabledOf(rows: readonly BlockLibraryRow[], kind: BlockLibraryKind): number {\n return rows.filter((row) => row.kind === kind && row.enabled).length;\n}\n\nfunction holderLabel(holder: BlockLibraryHolder): string {\n const title = holder.title?.trim() || \"Untitled\";\n const slug = holder.slug?.trim();\n return slug ? `${title} (${slug})` : title;\n}\n\n/**\n * Refuses Hidden on a hero row (a page cannot publish without its hero),\n * then a disable: the last hero, the last navbar, or a slug a published\n * document holds. Drafts alone never refuse; the Save that turns the slug\n * off strips them (`stripDrafts`). Pure — writes nothing.\n */\nexport async function validateBlockLibrary(\n value: unknown,\n options: BlockLibraryOptions,\n check: BlockLibraryCheck = {},\n): Promise<true | string> {\n const next = stampBlockLibrary(value, options);\n const hiddenHero = next.find((row) => row.kind === \"hero\" && row.sectionControls.hidden);\n if (hiddenHero) {\n return `${hiddenHero.label} cannot offer Hidden: a page cannot publish without its hero.`;\n }\n\n const previous = check.originals ?? defaultBlockLibraryValue(options);\n const turningOff = next.filter((row) => {\n const before = previous.find((entry) => entry.slug === row.slug);\n return before?.enabled !== false && row.enabled === false;\n });\n if (turningOff.length === 0) return true;\n\n if (turningOff.some((row) => row.kind === \"hero\") && enabledOf(next, \"hero\") === 0) {\n return \"Cannot disable the last hero.\";\n }\n if (turningOff.some((row) => row.kind === \"navbar\") && enabledOf(next, \"navbar\") === 0) {\n return \"Cannot disable the last navbar.\";\n }\n\n const holders = check.holders ?? [];\n if (holders.length > 0) {\n const names = holders.map(holderLabel).join(\", \");\n const slugs = turningOff.map((row) => row.label).join(\", \");\n const drafts = check.drafts ?? [];\n const draftNote =\n drafts.length > 0 ? ` Drafts also use it and were left as they are: ${drafts.map(holderLabel).join(\", \")}.` : \"\";\n return `Cannot disable ${slugs}. Still published on: ${names}. Remove it from those first.${draftNote}`;\n }\n\n return true;\n}\n\nexport function packageBlockSlugs(): readonly string[] {\n return PACKAGE_BLOCK_SLUGS;\n}\n","import type { Payload } from \"payload\";\n\nimport { sectionControlsFromLibrary } from \"./catalogue\";\nimport type { SectionControls } from \"./controls\";\nimport { BLOCK_LIBRARY_SLUG, PACKAGE_BLOCK_SLUGS, type BlockLibraryDoc, type BlockLibraryEntry } from \"./types\";\n\n/** The slice of `Payload` these readers need, so a test can pass a stub. */\nexport interface BlockLibraryReader {\n findGlobal: (args: { slug: string; depth: number; overrideAccess: boolean }) => Promise<unknown>;\n config?: { globals?: unknown };\n}\n\nconst PACKAGE_SLUGS = new Set<string>(PACKAGE_BLOCK_SLUGS);\n\n/**\n * A site's own Block library entries, read back off the registered Global:\n * `createBlockLibrary` keeps the rows it seeded (package and extras) on the\n * `blocks` field's `admin.custom.rows`, so a site block's catalogue default\n * is known here without the site passing `blocks` a second time. Package\n * slugs are left out; the catalogue already has them.\n */\nexport function blockLibraryEntriesFromConfig(payload: Pick<BlockLibraryReader, \"config\">): BlockLibraryEntry[] {\n const globals = Array.isArray(payload.config?.globals) ? payload.config.globals : [];\n const library = globals.find(\n (global): global is { slug: string; fields?: unknown[] } =>\n typeof global === \"object\" && global !== null && (global as { slug?: unknown }).slug === BLOCK_LIBRARY_SLUG,\n );\n const blocks = (library?.fields ?? []).find(\n (field): field is { admin?: { custom?: { rows?: unknown } } } =>\n typeof field === \"object\" && field !== null && (field as { name?: unknown }).name === \"blocks\",\n );\n const rows = blocks?.admin?.custom?.rows;\n if (!Array.isArray(rows)) return [];\n return rows.flatMap((row): BlockLibraryEntry[] => {\n if (!row || typeof row !== \"object\") return [];\n const { slug, label, category, kind, sectionControls } = row as Record<string, unknown>;\n if (typeof slug !== \"string\" || !slug || PACKAGE_SLUGS.has(slug)) return [];\n return [\n {\n slug,\n label: typeof label === \"string\" ? label : slug,\n category: typeof category === \"string\" ? category : \"content\",\n ...(kind === \"hero\" || kind === \"section\" || kind === \"navbar\" ? { kind } : {}),\n ...(sectionControls && typeof sectionControls === \"object\"\n ? { sectionControls: sectionControls as BlockLibraryEntry[\"sectionControls\"] }\n : {}),\n },\n ];\n });\n}\n\n/**\n * The Block library's section controls at request time, for a page route\n * to hand `RenderBlocks` as `sectionControls`. Access is overridden: the\n * Global is read by editors, and the page is read by everyone. A site\n * extra's stored ticks are kept, and one the document does not hold yet\n * takes its catalogue default from the Global's config; pass `extras` only\n * to add entries the config does not know.\n */\nexport async function getSectionControls(\n payload: BlockLibraryReader | Payload,\n extras: readonly BlockLibraryEntry[] = blockLibraryEntriesFromConfig(payload as BlockLibraryReader),\n): Promise<Record<string, SectionControls>> {\n const doc = (await payload.findGlobal({ slug: BLOCK_LIBRARY_SLUG, depth: 0, overrideAccess: true })) as\n | BlockLibraryDoc\n | null\n | undefined;\n return sectionControlsFromLibrary(doc, extras);\n}\n"],"mappings":";;;;;;;;;AAUA,MAAa,uBAAuB;CAAC;CAAc;CAAW;CAAU;CAAS;;AAOjF,MAAa,yBAA4D;CACvE,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,QAAQ;CACT;;AAGD,MAAa,2BAA4C;CACvD,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,QAAQ;CACT;;;;;;AAOD,MAAa,wBAAyC;CACpD,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,QAAQ;CACT;;AAGD,MAAa,sBAAuC;CAClD,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,QAAQ;CACT;AAED,SAAgB,uBAAuB,MAAyC;AAC9E,KAAI,SAAS,OAAQ,QAAO,EAAE,GAAG,uBAAuB;AACxD,KAAI,SAAS,SAAU,QAAO,EAAE,GAAG,qBAAqB;AACxD,QAAO,EAAE,GAAG,0BAA0B;;;AAIxC,SAAgB,OAAO,OAAuE;AAC5F,QAAO,MAAM,SAAS,MAAM,aAAa,SAAS,SAAS,MAAM,aAAa,eAAe,WAAW;;;;;;;AAQ1G,SAAgB,kBAAkB,OAAgB,UAA4C;CAC5F,MAAM,SAAS,SAAS,OAAO,UAAU,WAAY,QAAoC,EAAE;CAC3F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