@homepages/concrete 11.0.0 → 13.0.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.
Files changed (322) hide show
  1. package/CHANGELOG.md +203 -0
  2. package/README.md +8 -10
  3. package/codemods/fixtures-are-data.mjs +7 -0
  4. package/codemods/fixtures-list-properties.mjs +6 -0
  5. package/codemods/manifest.json +17 -0
  6. package/codemods/steps/fixtures-list-properties.mjs +16 -0
  7. package/codemods/steps/fixtures-to-data.mjs +41 -0
  8. package/dist/artifact/playground/client/assets/archivo-latin-ext-wght-normal-C4zznr8T.woff2 +0 -0
  9. package/dist/artifact/playground/client/assets/archivo-latin-wght-normal-E0tuGl4L.woff2 +0 -0
  10. package/dist/artifact/playground/client/assets/archivo-vietnamese-wght-normal-XAtsl5Q_.woff2 +0 -0
  11. package/dist/artifact/playground/client/assets/index-Bmvcss4B.js +1338 -0
  12. package/dist/artifact/playground/client/assets/index-C01UCAWD.css +1 -0
  13. package/dist/artifact/playground/client/index.html +2 -2
  14. package/dist/artifact/playground/client/island-canvas-host.mjs +1 -1
  15. package/dist/artifact/playground/host.mjs +110 -60
  16. package/dist/base.css +19 -59
  17. package/dist/cli/build/icons.js +1 -1
  18. package/dist/cli/build/index.js +11 -10
  19. package/dist/cli/build/manifest.js +44 -0
  20. package/dist/cli/build/record.js +123 -0
  21. package/dist/cli/build/sections.js +28 -18
  22. package/dist/cli/build/source.js +1 -1
  23. package/dist/cli/build/static.js +8 -5
  24. package/dist/cli/build/template-build.js +614 -0
  25. package/dist/cli/check/analyze.js +18 -1
  26. package/dist/cli/check/load-workspace.js +2 -2
  27. package/dist/cli/check/portable-names.js +1 -1
  28. package/dist/cli/check/render/corpus.js +119 -0
  29. package/dist/cli/check/render/invariants.js +1 -0
  30. package/dist/cli/check/stages/bundles.js +15 -18
  31. package/dist/cli/check/stages/composition.js +8 -25
  32. package/dist/cli/check/stages/fixtures.js +14 -10
  33. package/dist/cli/check/stages/logic.js +7 -23
  34. package/dist/cli/check/stages/render.js +12 -14
  35. package/dist/cli/check/stages/sections.js +22 -66
  36. package/dist/cli/check/stages/stylesheet.js +4 -26
  37. package/dist/cli/check/stages/workspace.js +27 -22
  38. package/dist/cli/commands.js +51 -23
  39. package/dist/cli/currency/preamble.js +1 -1
  40. package/dist/cli/currency/resolve-latest.js +3 -2
  41. package/dist/cli/dev/capture-browser.js +26 -0
  42. package/dist/cli/dev/fixture-schema.js +441 -0
  43. package/dist/cli/dev/folder-files.js +244 -0
  44. package/dist/cli/dev/index.js +7 -3
  45. package/dist/cli/dev/playground-server.js +34 -0
  46. package/dist/cli/dev/section-ladders.js +76 -0
  47. package/dist/cli/dev/server.js +120 -304
  48. package/dist/cli/install/background.js +16 -0
  49. package/dist/cli/install/index.js +45 -0
  50. package/dist/cli/install/tools.js +27 -0
  51. package/dist/cli/media/derive.js +19 -13
  52. package/dist/cli/media/deriver-plugin.js +14 -3
  53. package/dist/cli/property/fixture-list.js +46 -0
  54. package/dist/cli/property/index.js +12 -9
  55. package/dist/cli/property/library.js +12 -10
  56. package/dist/cli/publish/artifact.js +90 -0
  57. package/dist/cli/publish/captures.js +61 -0
  58. package/dist/cli/publish/fixtures.js +17 -0
  59. package/dist/cli/publish/index.js +10 -18
  60. package/dist/cli/{build → publish}/playground.js +3 -3
  61. package/dist/cli/publish/report.js +15 -33
  62. package/dist/cli/upgrade/codemod.d.ts +14 -0
  63. package/dist/cli/upgrade/fixture-conversion.d.ts +11 -0
  64. package/dist/cli/upgrade/fixture-conversion.js +54 -0
  65. package/dist/cli/upgrade/fixture-modules.js +125 -0
  66. package/dist/cli/upgrade/fixtures-to-data.d.ts +40 -0
  67. package/dist/cli/upgrade/fixtures-to-data.js +498 -0
  68. package/dist/cli/upgrade/index.js +18 -2
  69. package/dist/cli/upgrade/legacy-fixtures.d.ts +34 -0
  70. package/dist/cli/upgrade/legacy-fixtures.js +22 -0
  71. package/dist/cli/upgrade/stage.js +1 -1
  72. package/dist/cli/workspace-fixtures.js +80 -0
  73. package/dist/cli.js +1 -0
  74. package/dist/css/compile.js +9 -3
  75. package/dist/fixtures/bundle-rule.js +16 -16
  76. package/dist/fixtures/media-plugin.js +12 -33
  77. package/dist/fixtures/synthesize-empties.js +3 -2
  78. package/dist/index.d.ts +7 -7
  79. package/dist/{playground-island-runtime.d.ts → island-runtime.d.ts} +1 -2
  80. package/dist/{playground-island-runtime.js → island-runtime.js} +1 -2
  81. package/dist/islands/client-module.js +1 -1
  82. package/dist/{cli/dev → islands}/tsconfig-paths.js +2 -14
  83. package/dist/islands/wrap.js +40 -0
  84. package/dist/node_modules/.pnpm/acorn@8.18.0/node_modules/acorn/dist/acorn.js +5119 -0
  85. package/dist/packages/external/concrete/package.js +1 -1
  86. package/dist/packages/internal/bundle-evaluation/dist/cache.js +36 -0
  87. package/dist/packages/internal/bundle-evaluation/dist/evaluate.js +174 -0
  88. package/dist/packages/internal/bundle-evaluation/dist/index.js +5 -0
  89. package/dist/packages/internal/bundle-evaluation/dist/section-code.js +10 -0
  90. package/dist/packages/internal/capture-settle/dist/index.js +2 -2
  91. package/dist/packages/internal/capture-settle/dist/settle.js +88 -13
  92. package/dist/packages/internal/code-fingerprint/dist/index.js +57 -0
  93. package/dist/packages/internal/content-doc-ops/dist/index.js +176 -0
  94. package/dist/packages/internal/content-doc-ops/dist/made-rows.js +15 -0
  95. package/dist/packages/internal/deliverable-reads/dist/bootstrap.js +81 -0
  96. package/dist/packages/internal/deliverable-reads/dist/display.js +21 -0
  97. package/dist/packages/internal/deliverable-reads/dist/format.js +15 -0
  98. package/dist/packages/internal/deliverable-reads/dist/index.js +7 -0
  99. package/dist/packages/internal/deliverable-reads/dist/pages.js +29 -0
  100. package/dist/packages/internal/deliverable-reads/dist/requirements.js +72 -0
  101. package/dist/{cli/capture → packages/internal/download-files/dist}/bundle.js +8 -4
  102. package/dist/packages/internal/download-files/dist/capture-origin.js +126 -0
  103. package/dist/packages/internal/download-files/dist/capture-routes.js +139 -0
  104. package/dist/packages/internal/download-files/dist/capture-shell.js +38 -0
  105. package/dist/packages/internal/download-files/dist/capture.js +74 -0
  106. package/dist/packages/internal/download-files/dist/egress-watch.js +38 -0
  107. package/dist/packages/internal/download-files/dist/files.js +7 -0
  108. package/dist/packages/internal/download-files/dist/finish.js +35 -0
  109. package/dist/packages/internal/download-files/dist/fleet.js +94 -0
  110. package/dist/packages/internal/download-files/dist/format.js +40 -0
  111. package/dist/packages/internal/download-files/dist/make.js +105 -0
  112. package/dist/packages/internal/download-files/dist/master-tally.js +32 -0
  113. package/dist/packages/internal/download-files/dist/names.js +24 -0
  114. package/dist/packages/internal/download-files/dist/pdf-boxes.js +33 -0
  115. package/dist/packages/internal/download-files/dist/pdf-image-placements.js +194 -0
  116. package/dist/packages/internal/download-files/dist/pdf-images.js +289 -0
  117. package/dist/packages/internal/file-store/dist/files.js +8 -0
  118. package/dist/packages/internal/file-store/dist/lru.js +40 -0
  119. package/dist/packages/internal/file-store/dist/refusal.js +12 -0
  120. package/dist/packages/internal/file-store/dist/trees.js +151 -0
  121. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +1 -1
  122. package/dist/packages/internal/fill-bake/dist/compute-reads.js +48 -22
  123. package/dist/packages/internal/fill-bake/dist/held-rows.js +2 -0
  124. package/dist/packages/internal/fill-bake/dist/index.js +6 -1
  125. package/dist/packages/internal/fill-bake/dist/item-merge.js +4 -3
  126. package/dist/packages/internal/fill-bake/dist/resolve-instance.js +9 -0
  127. package/dist/packages/internal/fill-bake/dist/resolve.js +3 -0
  128. package/dist/packages/internal/fill-bake/dist/round-trip.js +2 -0
  129. package/dist/packages/internal/fill-bake/dist/strip.js +6 -0
  130. package/dist/packages/internal/fill-vocabulary/dist/holder.js +1 -1
  131. package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +1 -1
  132. package/dist/packages/internal/fill-vocabulary/dist/verbs.js +1 -1
  133. package/dist/packages/internal/format-geometry/dist/capture.js +3 -11
  134. package/dist/packages/internal/format-geometry/dist/format.d.ts +2 -8
  135. package/dist/packages/internal/format-geometry/dist/geometry.js +2 -13
  136. package/dist/packages/internal/island-runtime/dist/index.js +1 -10
  137. package/dist/packages/internal/island-runtime/dist/use-capture-ready.d.ts +5 -0
  138. package/dist/packages/internal/lead-fields/dist/ingest.js +72 -0
  139. package/dist/packages/internal/media-resolution/dist/video.js +6 -2
  140. package/dist/packages/internal/page-render/dist/addresses.js +57 -0
  141. package/dist/packages/internal/page-render/dist/index.js +6 -0
  142. package/dist/packages/internal/page-render/dist/kept.js +30 -0
  143. package/dist/packages/internal/page-render/dist/nav.js +42 -0
  144. package/dist/packages/internal/page-render/dist/render.js +152 -0
  145. package/dist/packages/internal/page-shell/dist/assemble.js +161 -0
  146. package/dist/packages/internal/page-shell/dist/escape.js +10 -0
  147. package/dist/packages/internal/page-shell/dist/frame.js +23 -0
  148. package/dist/packages/internal/page-shell/dist/index.js +26 -0
  149. package/dist/packages/internal/playground/dist/build-fingerprint.js +18 -0
  150. package/dist/packages/internal/playground/dist/fixture-conversions/list-names-properties.js +76 -0
  151. package/dist/packages/internal/playground/dist/fixture-formats.d.ts +37 -0
  152. package/dist/packages/internal/playground/dist/fixture-formats.js +20 -0
  153. package/dist/packages/internal/playground/dist/host/bootstrap.js +108 -0
  154. package/dist/packages/internal/playground/dist/host/built.js +202 -0
  155. package/dist/packages/internal/playground/dist/host/catalog-fixture.js +53 -0
  156. package/dist/packages/internal/playground/dist/host/download.js +34 -0
  157. package/dist/packages/internal/playground/dist/host/env.js +11 -0
  158. package/dist/packages/internal/playground/dist/host/everywhere-saves.js +353 -0
  159. package/dist/packages/internal/playground/dist/host/fixture-addresses.js +52 -0
  160. package/dist/packages/internal/playground/dist/host/fixture-documents.js +494 -0
  161. package/dist/packages/internal/playground/dist/host/fixture-operations.js +364 -0
  162. package/dist/packages/internal/playground/dist/host/fixture-units.js +93 -0
  163. package/dist/{fixtures → packages/internal/playground/dist/host}/image-dimensions.js +1 -1
  164. package/dist/packages/internal/playground/dist/host/leads.js +41 -0
  165. package/dist/packages/internal/playground/dist/host/media-saves.js +309 -0
  166. package/dist/{fixtures → packages/internal/playground/dist/host}/media-store.js +79 -26
  167. package/dist/packages/internal/playground/dist/host/overridable.js +9 -0
  168. package/dist/packages/internal/playground/dist/host/owned-saves.js +203 -0
  169. package/dist/{playground → packages/internal/playground/dist}/host/page-state.js +1 -1
  170. package/dist/packages/internal/playground/dist/host/program.js +54 -0
  171. package/dist/packages/internal/playground/dist/host/property-derive.js +216 -0
  172. package/dist/packages/internal/playground/dist/host/property-saves.js +74 -0
  173. package/dist/{fixtures → packages/internal/playground/dist/host}/property.js +88 -229
  174. package/dist/packages/internal/playground/dist/host/provenance.js +49 -0
  175. package/dist/packages/internal/playground/dist/host/resolve.js +553 -0
  176. package/dist/packages/internal/playground/dist/host/row-images.js +41 -0
  177. package/dist/{fixtures → packages/internal/playground/dist/host}/rows.js +1 -1
  178. package/dist/packages/internal/playground/dist/host/save.js +429 -0
  179. package/dist/packages/internal/playground/dist/host/serve.js +952 -0
  180. package/dist/packages/internal/playground/dist/host/site.js +79 -0
  181. package/dist/packages/internal/playground/dist/host/slots.js +202 -0
  182. package/dist/packages/internal/playground/dist/host/stated-content.js +93 -0
  183. package/dist/packages/internal/playground/dist/host/stored-fixtures.js +135 -0
  184. package/dist/packages/internal/playground/dist/host/violations.js +7 -0
  185. package/dist/packages/internal/playground/dist/jobs/lanes.js +24 -0
  186. package/dist/packages/internal/playground/dist/jobs/memory-queue.js +112 -0
  187. package/dist/packages/internal/playground/dist/jobs/probe.js +37 -0
  188. package/dist/packages/internal/playground/dist/jobs/queue.js +28 -0
  189. package/dist/packages/internal/playground/dist/jobs/runner.js +207 -0
  190. package/dist/packages/internal/playground/dist/layout.js +14 -0
  191. package/dist/packages/internal/playground/dist/platform.js +33 -0
  192. package/dist/packages/internal/playground/dist/server/changes.js +57 -0
  193. package/dist/packages/internal/playground/dist/server/crop.js +47 -0
  194. package/dist/packages/internal/playground/dist/server/derived-files.js +88 -0
  195. package/dist/packages/internal/playground/dist/server/download.js +158 -0
  196. package/dist/{cli/dev → packages/internal/playground/dist/server}/http.js +4 -12
  197. package/dist/packages/internal/playground/dist/server/jobs.js +29 -0
  198. package/dist/{cli/dev → packages/internal/playground/dist/server}/listen.js +4 -11
  199. package/dist/packages/internal/playground/dist/server/playground-server.js +424 -0
  200. package/dist/{cli/dev → packages/internal/playground/dist/server}/request-error.js +1 -1
  201. package/dist/packages/internal/playground/dist/server/size-ladders.js +170 -0
  202. package/dist/packages/internal/playground/dist/server/verification.js +75 -0
  203. package/dist/packages/internal/playground/dist/server/verify-build.js +139 -0
  204. package/dist/packages/internal/playground/dist/wire.js +78 -0
  205. package/dist/packages/internal/property-facts/dist/registry-facts.js +1 -1
  206. package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +1 -1
  207. package/dist/packages/internal/section-contracts/dist/reads-acyclic-contract.js +1 -1
  208. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +1 -1
  209. package/dist/packages/internal/site-files/dist/head.js +59 -0
  210. package/dist/packages/internal/site-files/dist/index.js +4 -0
  211. package/dist/packages/internal/site-files/dist/site.js +211 -0
  212. package/dist/packages/internal/static-assets-binding/dist/index.js +32 -0
  213. package/dist/packages/internal/static-assets-binding/dist/section-asset-url.js +38 -5
  214. package/dist/packages/internal/template-artifact/dist/asset-mime.js +8 -1
  215. package/dist/packages/internal/template-artifact/dist/build.js +148 -0
  216. package/dist/packages/internal/template-artifact/dist/composition.js +62 -0
  217. package/dist/packages/internal/template-artifact/dist/index.js +2 -2
  218. package/dist/packages/internal/template-artifact/dist/layout.js +48 -12
  219. package/dist/packages/internal/template-artifact/dist/manifest.js +3 -10
  220. package/dist/packages/internal/template-artifact/dist/verify.js +51 -31
  221. package/dist/packages/internal/template-contracts/dist/address-value.js +6 -1
  222. package/dist/packages/internal/template-contracts/dist/content-categories.js +10 -1
  223. package/dist/packages/internal/template-contracts/dist/fact-compute.d.ts +1 -1
  224. package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +1 -1
  225. package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +3 -3
  226. package/dist/packages/internal/template-contracts/dist/fact-registry.js +59 -32
  227. package/dist/packages/internal/template-contracts/dist/fill-spec.js +14 -1
  228. package/dist/packages/internal/template-contracts/dist/list.d.ts +3 -3
  229. package/dist/packages/internal/template-contracts/dist/media-candidates.js +67 -2
  230. package/dist/packages/internal/template-contracts/dist/media-offer.js +180 -0
  231. package/dist/packages/internal/template-contracts/dist/object.d.ts +2 -2
  232. package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +9 -2
  233. package/dist/packages/internal/template-contracts/dist/read-graph.js +36 -2
  234. package/dist/packages/internal/template-contracts/dist/ref-locate.js +16 -1
  235. package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +9 -10
  236. package/dist/packages/internal/template-contracts/dist/registry-facts.js +12 -1
  237. package/dist/packages/internal/template-contracts/dist/registry-graph.js +112 -0
  238. package/dist/packages/internal/template-contracts/dist/registry-shape.js +15 -2
  239. package/dist/packages/internal/template-contracts/dist/require-graph.js +300 -0
  240. package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +3 -3
  241. package/dist/packages/internal/template-contracts/dist/row.d.ts +3 -3
  242. package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +1 -1
  243. package/dist/{schema → packages/internal/template-contracts/dist}/section-nav.d.ts +1 -1
  244. package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +4 -4
  245. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +3 -1
  246. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +24 -1
  247. package/dist/packages/internal/template-contracts/dist/slot-overrides.js +26 -1
  248. package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +1 -1
  249. package/dist/packages/internal/template-contracts/dist/slot-types.js +1 -1
  250. package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +1 -1
  251. package/dist/packages/internal/template-contracts/dist/table-members.js +7 -2
  252. package/dist/packages/internal/template-contracts/dist/video-value.d.ts +1 -1
  253. package/dist/packages/internal/upload-formats/dist/heic.js +35 -0
  254. package/dist/packages/internal/upload-formats/dist/index.js +80 -0
  255. package/dist/packages/internal/upload-formats/dist/magic-bytes.js +293 -0
  256. package/dist/platform/paths.js +1 -0
  257. package/dist/platform/process.js +49 -1
  258. package/dist/primitives/FrameShell.d.ts +5 -2
  259. package/dist/primitives/FrameShell.js +2 -1
  260. package/dist/rules/registry.js +28 -4
  261. package/dist/schema/fact.d.ts +2 -2
  262. package/dist/schema/facts-view.d.ts +1 -1
  263. package/dist/schema/format.d.ts +0 -1
  264. package/dist/schema/format.js +1 -2
  265. package/dist/schema/manifest.js +18 -24
  266. package/dist/schema/section-props.d.ts +1 -1
  267. package/dist/schema/section-schema.d.ts +1 -1
  268. package/dist/schema/section-schema.js +1 -0
  269. package/dist/section/declare.d.ts +1 -1
  270. package/dist/section/discovery.js +6 -2
  271. package/dist/section/publish-shape.js +38 -0
  272. package/dist/section/section.d.ts +1 -1
  273. package/dist/site-analytics.js +6 -1
  274. package/dist/site-runtime/window-height.js +19 -0
  275. package/dist/template/define-template.d.ts +25 -4
  276. package/dist/template/define-template.js +3 -0
  277. package/dist/template/logic-shim.d.ts +1 -1
  278. package/dist/template/materialize.js +3 -1
  279. package/dist/template/running-copy.js +0 -1
  280. package/dist/template/section-reads.js +1 -1
  281. package/guide/reference/cli/INDEX.md +6 -5
  282. package/guide/reference/cli/build.md +10 -8
  283. package/guide/reference/cli/check.md +4 -2
  284. package/guide/reference/cli/dev.md +6 -2
  285. package/guide/reference/cli/install.md +41 -0
  286. package/guide/reference/cli/property-add.md +5 -4
  287. package/guide/reference/cli/property-list.md +2 -2
  288. package/guide/reference/cli/publish.md +5 -5
  289. package/guide/reference/cli/upgrade.md +1 -1
  290. package/guide/reference/rules/INDEX.md +9 -5
  291. package/package.json +14 -30
  292. package/dist/artifact/playground/client/assets/index-ByeGGedv.js +0 -1259
  293. package/dist/artifact/playground/client/assets/index-CxWPYOH2.css +0 -1
  294. package/dist/cli/build/artifact.js +0 -220
  295. package/dist/cli/build/captures.js +0 -48
  296. package/dist/cli/build/fixtures.js +0 -92
  297. package/dist/cli/capture/capture-browser.js +0 -37
  298. package/dist/cli/capture/capture.js +0 -113
  299. package/dist/cli/check/render/inputs.js +0 -60
  300. package/dist/cli/check/render/nav.js +0 -31
  301. package/dist/cli/dev/crop.js +0 -20
  302. package/dist/cli/dev/fixture-ladders.js +0 -96
  303. package/dist/cli/dev/hmr.js +0 -26
  304. package/dist/cli/dev/islands.js +0 -234
  305. package/dist/cli/dev/load-template.js +0 -52
  306. package/dist/cli/dev/vite.js +0 -114
  307. package/dist/cli/dev/workspace-reader.js +0 -248
  308. package/dist/cli/publish/freshness.js +0 -64
  309. package/dist/fixtures/brand.d.ts +0 -4
  310. package/dist/fixtures/brand.js +0 -8
  311. package/dist/fixtures/load.js +0 -159
  312. package/dist/fixtures/resolve.js +0 -392
  313. package/dist/fixtures.d.ts +0 -429
  314. package/dist/fixtures.js +0 -23
  315. package/dist/packages/internal/canvas-core/dist/island-host.js +0 -62
  316. package/dist/packages/internal/canvas-core/dist/island-shields.js +0 -30
  317. package/dist/playground/canvas-island-host.d.ts +0 -11
  318. package/dist/playground/canvas-island-host.js +0 -29
  319. package/dist/playground/canvas-markers.js +0 -14
  320. package/dist/playground/host/paths.js +0 -8
  321. package/dist/playground/layout.js +0 -17
  322. package/dist/playground/wire.js +0 -28
@@ -24,6 +24,23 @@ function listKeyOf(key) {
24
24
  key: key.slice(dot + 1)
25
25
  };
26
26
  }
27
+ function pickedRowOf(element) {
28
+ return element.type === "row" ? element : null;
29
+ }
30
+ function pickedMediaField(element) {
31
+ if (element.type !== "object") return null;
32
+ for (const [key, field] of Object.entries(element.fields)) {
33
+ const source = field.source;
34
+ if (isMediaKind(field.type) && typeof source === "object" && source !== null && source.kind === "element") return key;
35
+ }
36
+ return null;
37
+ }
38
+ function rowFromKeys(row) {
39
+ return (Array.isArray(row.from) ? row.from : [row.from]).filter((key) => typeof key === "string");
40
+ }
41
+ function isPaged(fact) {
42
+ return fact.head !== null;
43
+ }
27
44
  function page(head, declaration) {
28
45
  if ("label" in head) throw new Error("fact registry: a page head holds no `label` — the declaration states the fact's name");
29
46
  for (const key of ["title", "description"]) {
@@ -334,7 +351,7 @@ const propertyMedia = list({
334
351
  ],
335
352
  from: uploads
336
353
  }),
337
- source: fill.pick({ brief: "Does this upload show the property? It belongs when its name or account says it is a photograph, a rendering, a video or a virtual tour of the property: its building, rooms, grounds, amenities, surroundings or views. It does not belong when its name or account says it is a floor plan or another diagram; a logo, wordmark or brand graphic; a headshot, portrait or other photograph of a person or people; a flyer, ad, business card, slide or other image that is mostly text; a screenshot; a map; or a scanned document page. When neither its name nor its account says what it is, you cannot tell. Order what belongs as a walk through the property: aerial and street views first, then the approach and entry, then the interiors room by room (living spaces, kitchen and dining, bedrooms, bathrooms), then outdoor spaces, amenities, surroundings and views, with every shot of one space together. A video or tour sits with the space it shows, and one of the whole property comes first." })
354
+ source: fill.pick({ brief: "What shows the property: its photographs, renderings, videos and virtual tours, of the building, its rooms, grounds, amenities, surroundings and views, which a page's gallery and sections draw for a visitor walking through the property. An upload belongs when its name or account says it is one of those. It does not belong when its name or account says it is something else: a floor plan or other diagram, a logo or brand graphic, a photograph of a person or people, a flyer, slide or other image that is mostly text, a screenshot, a map or a document page. When neither its name nor its account says what it is, you cannot tell. The list runs as a walk through the property: aerial and street views, then the approach and entry, then the interiors room by room (living spaces, kitchen and dining, bedrooms, bathrooms), then outdoor spaces, amenities, surroundings and views, every shot of one space together; a video or tour sits with the space it shows, and one of the whole property comes first." })
338
355
  });
339
356
  const floor_plans = list({
340
357
  label: "Floor plans",
@@ -343,7 +360,7 @@ const floor_plans = list({
343
360
  from: uploads,
344
361
  process: [process.cutout({ enclosed: "keep" })]
345
362
  }),
346
- source: fill.pick({ brief: "Is this upload exactly one floor plan? A floor plan is a top-down view of one floor of a dwelling's rooms and walls — drawn or rendered, flat or in 3D, at any size. It belongs when its name or account says it shows one floor plan, whatever title, figures or text are printed around it. It does not belong when its name or account says it holds two or more plans, or says it is something else: a building key or locator diagram (the building's outline with one unit shaded), a site, plot, parking or driveway diagram, a standalone legend, scale bar or north arrow, a logo, a photograph, or plain text. When neither its name nor its account says what it is, or how many plans it holds, you cannot tell. Order what belongs from the lowest floor to the highest; plans of several units go in the order the units are numbered, each unit's floors together." })
363
+ source: fill.pick({ brief: "The property's floor plans: each upload that is exactly one floor plan, a top-down view of one floor of a dwelling's rooms and walls, drawn or rendered, flat or in 3D, at any size, whatever title, figures or text are printed around it, which a page's plans draw and each unit's own plans are picked from. An upload belongs when its name or account says it shows one floor plan. It does not belong when its name or account says it holds two or more plans, or is something else: a building key or site diagram, a legend, scale bar or north arrow on its own, a logo, a photograph or plain text. When neither its name nor its account says what it is, or how many plans it holds, you cannot tell. The list runs from the lowest floor to the highest, the plans of several units in the order the units are numbered, each unit's floors together." })
347
364
  });
348
365
  const propertyDocuments = list({
349
366
  label: "Documents",
@@ -355,28 +372,39 @@ const propertyDocuments = list({
355
372
  ],
356
373
  from: uploads
357
374
  }),
358
- source: fill.pick({ brief: "Does this upload set out the property's specifics? It belongs when its name or account says it records its figures, finances, terms, legal record, condition or plans: an offering memorandum, brochure, listing sheet, rent roll, financials, comparables, lease, survey, site plan, plan set, disclosure or report. It does not belong when its name or account says it is a photograph, rendering, video or tour showing the property; an image of floor plans or elevations; a logo; a photograph of people; an ad, sign or announcement; a map; or notes for whoever makes the marketing. When neither its name nor its account says what it is, you cannot tell. Order what belongs as a buyer reads it: the offering memorandum, brochure or listing sheet first, then the financials, rent roll and comparables, then the leases, legal record and disclosures, then the reports, surveys and plans." })
375
+ source: fill.pick({ brief: "The property's documents: what sets out its specifics, the figures, finances, terms, legal record, condition or plans a buyer, tenant or investor studies, which a page offers as downloads and a reader wanting only them reads in place of every upload. An upload belongs when its name or account says it records those: an offering memorandum, brochure, listing sheet, rent roll, financials, comparables, lease, survey, site plan, plan set, disclosure or report. It does not belong when its name or account says it is a photograph, rendering, video or tour showing the property, an image of floor plans or elevations, a logo, a photograph of people, an ad, sign or announcement, a map, or notes for whoever makes the marketing. When neither its name nor its account says what it is, you cannot tell. The list runs as a buyer reads it: the offering memorandum, brochure or listing sheet, then the financials, rent roll and comparables, then the leases, legal record and disclosures, then the reports, surveys and plans." })
359
376
  });
360
377
  const hero = image({
361
378
  label: "Hero",
362
379
  from: propertyMedia,
363
- source: fill.pick({ brief: "Choose the single cover photo for the property's page. The cover is a wide banner above the property's address, so it must stand for the whole property at a glance. Only an image whose name or account says it is a photograph of the property can be chosen. Never choose a logo, wordmark or other brand graphic; an agent, team or company headshot; a flyer, ad, business card, slide or any image that is mostly text; a screenshot; a map; a scanned document or brochure page; or a floor plan or other diagram — nor an image whose name and account do not say what it is. Among the photographs of the property prefer, in order: a front exterior of the building; another exterior or aerial view; the widest, brightest shot of the main living space. Rank close-up details, bathrooms, utility spaces, empty rooms and anything that reads as a fragment rather than a place last: they are weaker covers, never excluded, so when they are the only photographs of the property, choose the best of them. If not one candidate is a photograph of the property, choose none: no banner beats a banner that is not the property." })
380
+ source: fill.pick({ brief: "The property's cover image: the one image the page's banner draws above the address, standing for the whole property at a glance for a visitor arriving at the page. It is an image of the property, by its name or account, a photograph or a rendering alike, ranked by what it shows and never by how it was made: the front exterior of the building first, then another exterior or aerial view, then the widest, brightest view of the main living space. A close-up, a bathroom, a utility space, an empty room or anything that reads as a fragment rather than a place is a weaker cover, never ruled out, so where those are the only images of the property the best of them is the cover. A logo or brand graphic, a headshot, an image that is mostly text, a screenshot, a map, a document page, a floor plan or other diagram is not an image of the property, nor is an image whose name and account do not say what it is; with no image of the property there is no cover." })
364
381
  });
365
382
  const site_url = url({ label: "Website" });
366
- const UNIT_PLANS_BRIEF = "Is this floor plan labelled for this unit? Its label is read from its name and the text printed on it, never from the rooms drawn or any figures. It belongs when its label names this unit: the unit's label or a plain variant of it (\"Unit 3\", \"#3\", \"Apt 3\" and \"Residence 3\" all label \"Unit 3\"); a descriptor the unit's label carries in brackets, like \"(PH)\", may be left off. A plan labelling several units, such as a shared floor printed \"Unit 1/2/3\", belongs to each of them. It is excluded when it labels other units and not this one. When it labels no unit, you cannot tell. Order what belongs from the lowest floor to the highest.";
367
- const UNIT_PHOTOS_BRIEF = "Is this photo labelled for this unit? Its label is read from its name, the text printed on it and a caption its account records, never from the rooms it shows, any figures, how much it looks like the unit or where it falls among the uploads. It belongs when its label names this unit: the unit's label or a plain variant of it (\"Unit 3\", \"#3\", \"Apt 3\" and \"Residence 3\" all label \"Unit 3\"); a descriptor the unit's label carries in brackets, like \"(PH)\", may be left off. A photo labelled for several units belongs to each of them. It is excluded when it labels other units and not this one. When it labels no unit, you cannot tell.";
383
+ const LABEL_FORMS = {
384
+ unit: "\"Unit 3\", \"#3\", \"Apt 3\" and \"Residence 3\" all label \"Unit 3\"",
385
+ space: "\"Suite 200\", \"Ste 200\" and \"#200\" all label \"Suite 200\""
386
+ };
387
+ function labeledPlansBrief(row) {
388
+ return `This ${row}'s floor plans: every one of the property's floor plans labeled for it, whatever the plan draws (a floor of the ${row}, its roof deck, its storage), listed beside the ${row}'s specs. A plan's label is read from its name and the text printed on it, never from the rooms drawn or any figures. A plan belongs when its label names this ${row}: the ${row}'s own label or a plain variant of it (${LABEL_FORMS[row]}), a descriptor the ${row}'s label carries in brackets left off; a plan labeled for several ${row}s, as a shared floor printed with each ${row}'s number, belongs to each of them. A plan labeled for other ${row}s and not this one does not belong. When a plan labels no ${row}, you cannot tell. The list runs from the lowest floor to the highest.
389
+
390
+ floor: the level of the ${row} the plan draws, or the part of it where the plan draws no whole level, in the form "Basement", "2nd floor" or "Roof deck". It is read as the plan's label is, from the plan's name and a title among the words printed on it, never from what its account says the drawing shows or from the words that mark its rooms, and a ${row} number is not a floor. A plan whose name and printed title state neither has none.`;
391
+ }
392
+ function labeledPhotosBrief(row) {
393
+ return `This ${row}'s photos: every one of the property's photos labeled for it, whatever the photo shows, listed beside the ${row}'s specs. A photo's label is read from its name, the text printed on it and a caption its account records, never from what it shows, any figures, how much it looks like the ${row} or where it falls among the uploads. A photo belongs when its label names this ${row}: the ${row}'s own label or a plain variant of it (${LABEL_FORMS[row]}), a descriptor the ${row}'s label carries in brackets left off; a photo labeled for several ${row}s belongs to each of them. A photo labeled for other ${row}s and not this one does not belong. When a photo labels no ${row}, you cannot tell.`;
394
+ }
395
+ const UNIT_PLANS_BRIEF = labeledPlansBrief("unit");
396
+ const UNIT_PHOTOS_BRIEF = labeledPhotosBrief("unit");
368
397
  const UNITS_BRIEF = [
369
- "List every dwelling the uploads present with its own specs printed — its beds, baths, square feet, asking price or rent written out for that dwelling: the home a listing describes, or each unit a building's documents name or number. A dwelling the uploads only name, picture or mark with a status, with no specs of its own, is not listed. A plan or row printed for several units (\"Unit 4/6\") lists each of those units, each with what is printed for it. A dwelling named in several uploads, or on several pages, is one item carrying everything they print for it. A unit-mix row standing for several unnamed units is not a dwelling; neither is a commercial space, a whole building, a comparable property, a market average or a portfolio total.",
370
- "Every member is what an upload prints as text for that dwelling, and nothing else. An upload's own text, as its account quotes it (a document's or a sheet's content, an image's printed words), is what it prints; the account's description of what a drawing, a photo or a map shows (the rooms, the doors, the spaces) is never a member's source. Never count rooms; never compute, round or convert a figure; never carry one across from another dwelling, a unit-mix average or the building's totals; never add what is usual for a dwelling of its kind. A figure printed for a neighbourhood, a development or the building is never a dwelling's, and a count or fee is 0 only where the uploads print none for that dwelling. A member no upload prints for that dwelling is null, and a null is always better than a guess.",
371
- "label: the unit's own name as printed — its unit number or name (\"201\", \"Residence 201\", \"4B\", \"Penthouse 501\"), without a word marking its status (\"model\", \"available\") — and never its street address. A dwelling presented alone, with no unit name, is always labelled \"Home\", whatever name the uploads print for the home itself.",
372
- "beds, baths, sqft: exactly as printed for that dwelling; a studio has one bedroom.",
373
- "price: the asking price or monthly rent as written for that dwelling, or its status word (\"Sold\", \"Leased\", \"Request for Info\").",
374
- "floor: the floor of its building the dwelling sits on, as printed (\"3\", \"PH\", \"Ground\", \"3 to 4\"); never read off its unit number.",
375
- "hoa_monthly: the HOA, condo or strata fee printed per month for that dwelling. A fee printed for another period, or for the building, is null.",
376
- "parking: the number of parking spaces printed for that dwelling (\"1 deeded space\" is 1, \"two-car garage\" is 2). Parking printed with no count, or for the building, is null.",
377
- "lot_sqft: the lot size printed in square feet for that dwelling: a home's own lot. A lot in another unit, or the lot of a building several dwellings share, is null.",
378
- "amenities: a feature this dwelling has that the other dwellings in its building do not, in a few words as an upload states it, such as \"Private roof deck\", \"Corner unit\", \"Harbor views\". Check each one against the other dwellings: a feature printed for two of them, or for the building, is the building's and goes on no dwelling, however a sheet praises it; a routine fitting or finish, a note printed on a plan, or what its other members already say sets nothing apart. Most dwellings have none. Leave the list empty when nothing is this one's alone.",
379
- "When the uploads present no dwelling with its own specs printed, return no items."
398
+ "The property's units: a row for each dwelling the uploads present with specs of its own, the home a listing describes or each unit a building's documents name or number, read by a buyer or tenant comparing the residences and by the user checking each row against their documents. The property is what the uploads market, whatever address they print for it. A row holds what the uploads print for that dwelling: the words printed on a sheet, a page or a floor plan, as its account quotes them, never what an account says a drawing, a photo or a map shows, the rooms, doors and spaces; each figure as printed, not worked out from other figures, rounded or carried over from another dwelling, a unit mix or the building; and a member no upload prints for that dwelling is empty. A dwelling the uploads only name, picture or mark with a status, with no specs printed for it, has no row. A plan or a row printed for several dwellings, in the form \"Unit 4/6\", gives each of those dwellings a row of its own carrying what is printed for it, and no row stands for two; a dwelling named in several uploads or on several pages is one row carrying everything they print for it. A commercial space is not a dwelling, nor is a unit-mix row standing for unnamed units, a whole building, a comparable property, a market average or a portfolio total.",
399
+ "label: the dwelling's own name as printed, its unit number or name, in the form \"201\", \"Residence 201\" or \"4B\", one dwelling's alone, without a status word and never its street address; a dwelling presented alone, with no unit name, is \"Home\".",
400
+ "beds, baths, sqft: as printed for that dwelling; a studio is one bedroom.",
401
+ "price: the asking price or monthly rent as written for that dwelling, or, where none is printed, its status word, in the form \"Sold\" or \"Leased\".",
402
+ "floor: the floor of its building the dwelling sits on, as printed; a unit number is not a floor.",
403
+ "hoa_monthly: the HOA, condo or strata fee printed per month for that dwelling; a fee for another period, or for the building, is not its own.",
404
+ "parking: the number of parking spaces printed for that dwelling, a garage counted by its cars; parking printed with no count, or for the building, is not its own.",
405
+ "lot_sqft: the lot printed in square feet for that dwelling, a home's own; a lot the building's dwellings share is not its own.",
406
+ "amenities: what sets this dwelling apart from the other dwellings in its building, each in the few words an upload states it; a feature printed for two of them, or for the building, is the building's, and a standard finish, a note printed on a plan or what the other members already say sets nothing apart. Most dwellings have none.",
407
+ "When no dwelling has specs of its own printed, the table is empty."
380
408
  ].join("\n\n");
381
409
  const unitLabel = text.short({ label: "Unit" });
382
410
  const unitBeds = number({ label: "Beds" });
@@ -465,19 +493,18 @@ const units = page({
465
493
  }
466
494
  })
467
495
  }));
468
- const SPACE_PLANS_BRIEF = "Is this floor plan labelled for this space? Its label is read from its name and the text printed on it, never from the rooms drawn or any figures. It belongs when its label names this space: the space's label or a plain variant of it (\"Suite 200\", \"Ste 200\" and \"#200\" all label \"Suite 200\"); a descriptor the space's label carries in brackets may be left off. A plan labelling several spaces belongs to each of them. It is excluded when it labels other spaces and not this one. When it labels no space, you cannot tell. Order what belongs from the lowest floor to the highest.";
469
- const SPACE_PHOTOS_BRIEF = "Is this photo labelled for this space? Its label is read from its name, the text printed on it and a caption its account records, never from what it shows, any figures, how much it looks like the space or where it falls among the uploads. It belongs when its label names this space: the space's label or a plain variant of it (\"Suite 200\", \"Ste 200\" and \"#200\" all label \"Suite 200\"); a descriptor the space's label carries in brackets may be left off. A photo labelled for several spaces belongs to each of them. It is excluded when it labels other spaces and not this one. When it labels no space, you cannot tell.";
496
+ const SPACE_PLANS_BRIEF = labeledPlansBrief("space");
497
+ const SPACE_PHOTOS_BRIEF = labeledPhotosBrief("space");
470
498
  const COMMERCIAL_SPACES_BRIEF = [
471
- "List every commercial space the uploads present with its own specs printed — its use, square feet, rent or price written out for that space: each shop, office suite, restaurant or other non-residential space a building's documents name or number. A space the uploads only name, picture or mark with a status, with no specs of its own, is not listed. A space named in several uploads, or on several pages, is one item carrying everything they print for it. A dwelling is never a commercial space; neither is a whole building, a comparable property, a market average or a portfolio total.",
472
- "Every member is what an upload prints as text for that space, and nothing else. An upload's own text, as its account quotes it (a document's or a sheet's content, an image's printed words), is what it prints; the account's description of what a drawing, a photo or a map shows is never a member's source. Never compute, round or convert a figure; never carry one across from another space or the building's totals; never add what is usual for a space of its kind. A member no upload prints for that space is null, and a null is always better than a guess.",
473
- "label: the space's own name as printed (\"Retail A\", \"Suite 200\", \"Ground-floor restaurant\"), without a word marking its status (\"available\", \"leased\"), and never its street address.",
474
- "use: what the space is for, as printed (\"Retail\", \"Office\", \"Restaurant\").",
475
- "sqft: the square feet printed for that space.",
476
- "price: the rent or price as written for that space (\"$45/SF/yr\", \"$8,500/mo\"), or its status word (\"Leased\", \"Call for pricing\").",
477
- "floor: the floor of its building the space sits on, as printed (\"1\", \"Ground\", \"Mezzanine\"); never read off its suite number.",
478
- "parking: the number of parking spaces printed for that space. Parking printed with no count, or for the building, is null.",
479
- "amenities: a feature this space has that the other spaces in its building do not, in a few words as an upload states it, such as \"Corner frontage\", \"Drive-thru\", \"Grease trap\". Check each one against the other spaces: a feature printed for two of them, or for the building, is the building's and goes on no space, however a sheet praises it; a routine fitting or finish, a note printed on a plan, or what its other members already say sets nothing apart. Most spaces have none. Leave the list empty when nothing is this one's alone.",
480
- "When the uploads present no commercial space with its own specs printed, return no items."
499
+ "The property's commercial spaces: a row for each shop, office suite, restaurant or other non-residential space the uploads present with specs of its own, named or numbered in a building's documents, read by a tenant or investor comparing the spaces and by the user checking each row against their documents. The property is what the uploads market, whatever address they print for it. A row holds what the uploads print for that space: the words printed on a sheet, a page or a floor plan, as its account quotes them, never what an account says a drawing, a photo or a map shows; each figure as printed, not worked out from other figures, rounded or carried over from another space or the building; and a member no upload prints for that space is empty. A space the uploads only name, picture or mark with a status, with no specs printed for it, has no row, and a space named in several uploads or on several pages is one row carrying everything they print for it. A dwelling is not a commercial space, nor is a whole building, a comparable property, a market average or a portfolio total.",
500
+ "label: the space's own name as printed, in the form \"Suite 200\" or \"Retail A\", without a status word and never its street address.",
501
+ "use: what the space is for, as printed.",
502
+ "sqft: as printed for that space.",
503
+ "price: the rent or price as written for that space, or, where none is printed, its status word, in the form \"Leased\" or \"Call for pricing\".",
504
+ "floor: the floor of its building the space sits on, as printed; a suite number is not a floor.",
505
+ "parking: the number of parking spaces printed for that space; parking printed with no count, or for the building, is not its own.",
506
+ "amenities: what sets this space apart from the other spaces in its building, each in the few words an upload states it; a feature printed for two of them, or for the building, is the building's, and a standard fitting, a note printed on a plan or what the other members already say sets nothing apart. Most spaces have none.",
507
+ "When no commercial space has specs of its own printed, the table is empty."
481
508
  ].join("\n\n");
482
509
  const spaceLabel = text.short({ label: "Space" });
483
510
  const commercial_spaces = page({
@@ -507,7 +534,7 @@ const commercial_spaces = page({
507
534
  }
508
535
  })
509
536
  }));
510
- const COMPARABLES_BRIEF = "The uploads may present comparable properties: other properties an upload sets beside the subject for comparison. The subject is the property the uploads are marketing, at the read address; in a building, that is the building and every unit the uploads market in it. Find every comparable and return it as an item. A property is a comparable because an upload compares it with the subject, and it may appear as a row in a sales or rent comparables table, as a panel with its own photo and figures, as a numbered pin in a map legend, or as a line in a survey of recent trades. An upload presenting the subject or one of its units for itself, such as its listing sheet, brochure, price list or market history, presents the subject, whatever unit line it prints beside the read street. Read every upload whole, including tables that continue from one page to the next. Copy each figure exactly as an upload states it for that property, and each listing's remarks word for word. Specs come only from what is printed as text: never count rooms or take a figure from what a floor plan drawing, a photo or a map shows; a studio has one bedroom. Never compute one: not by multiplying a price per unit by a unit count, not by dividing a price by a size, not by counting the days between two dates, not by converting a yearly fee to a monthly one, not by averaging rows, and never by carrying a figure across from a neighbouring row, a summary or the subject. If a property is listed in more than one place — on several pages, or in several uploads — return one item carrying every figure those places state. A figure no upload states for that property is null; a null is always better than a guess. Never return the subject, even where it appears in a comparables table or at the centre of a comparables map. Another unit of the subject's building is a comparable only where an upload sets it beside the subject as one, such as a sister unit's earlier sale in a comps table. Do not return a market, submarket or area average, a portfolio total, or anything that is not an individual property. When no upload compares another property with the subject, return no items.";
537
+ const COMPARABLES_BRIEF = "The property's comparables: the other properties an upload sets beside the one it markets, so that property's price and specs can be weighed against theirs, read by a buyer or seller judging the price and by the user checking each row against their documents. They appear as the rows of a sales or rent comparables table, as panels with their own photo and figures, as numbered pins in a map legend or as lines in a survey of recent trades. The property the uploads market is the one this request is for, whatever address they print for it; in a building, it is the building and every unit the uploads market in it. It is never a comparable, even in its own comparables table or at the center of a comparables map, and an upload presenting it or one of its units for itself, such as a listing sheet, brochure, price list or market history, presents no comparable; another unit of its building is a comparable only where an upload sets it beside the property as one, such as a sister unit's earlier sale in a comps table. A market or area average, a portfolio total, or anything that is not one property is not a comparable. A row holds what the uploads print for that property, read through every upload whole, a table included where it continues onto the next page: each figure as printed and a listing's remarks word for word, never worked out from other figures or carried over from a neighboring row, a summary or the property itself; a studio is one bedroom; a property listed in several places is one row carrying every figure those places state; a figure no upload prints for it is empty. When no upload sets another property beside the one it markets, the list is empty.";
511
538
  const comparablePlace = address({ label: "Address" });
512
539
  const comparableSaleDate = date({ label: "Sale date" });
513
540
  const comparables = page({
@@ -574,7 +601,7 @@ const contacts = page({
574
601
  max: 12,
575
602
  source: fill.pick({
576
603
  reads: [uploads],
577
- brief: "Choose this listing's contacts from the library's contacts, judging each one's name, title, organisation, email and phone against the read uploads' names and accounts. A contact may be chosen only when an upload's name or account says it prints their email or phone, or their full name, as a contact for this listing — an agent, broker, or sales or leasing contact. A contact the uploads leave out, where their accounts name the listing's contacts, is not chosen. A shared organisation, a matching first name, or a name printed in another role (an architect, a photographer, a seller) is not evidence. When no upload's account names any contact, choose none. Order those chosen as the uploads present them for this listing, the first or most prominent first."
604
+ brief: "The listing's contacts: the people a buyer or tenant reaches about this property, chosen from the library's contacts, in the order the listing presents them, the first or most prominent first. A contact belongs when an upload's name or account says it prints their email or phone, or their full name, as a contact for this listing, an agent, broker, or sales or leasing contact, judged by their name, title, organization, email and phone against what the uploads print. A contact the uploads leave out, where their accounts name the listing's contacts, does not belong, and a shared organization, a matching first name or a name printed in another role, an architect, a photographer or a seller, names no contact. When no upload's account names any contact, there are none."
578
605
  }),
579
606
  item: row({
580
607
  label: "Contact",
@@ -602,4 +629,4 @@ const propertyFacts = defineFacts("property", {
602
629
  linkRegistry(propertyFacts);
603
630
 
604
631
  //#endregion
605
- export { COMPARABLE_PRICE_PERIOD_VALUES, COMPARABLE_STATUS_VALUES, FACT_HOMES, LISTING_INTENT_VALUES, comparableDistanceMeters, comparablePricePeriod, comparableStatusOf, defineFacts, haversineMeters, libraryFacts, listKeyOf, page, propertyFacts, refuseHolderKeys };
632
+ export { COMPARABLE_PRICE_PERIOD_VALUES, COMPARABLE_STATUS_VALUES, FACT_HOMES, LISTING_INTENT_VALUES, comparableDistanceMeters, comparablePricePeriod, comparableStatusOf, defineFacts, haversineMeters, isPaged, libraryFacts, listKeyOf, page, pickedMediaField, pickedRowOf, propertyFacts, refuseHolderKeys, rowFromKeys };
@@ -287,6 +287,19 @@ function fillSpecFromSchema(schema) {
287
287
  decisions
288
288
  };
289
289
  }
290
+ function fillSpecFromRegistry(registry) {
291
+ const reads = newCollector();
292
+ const pages = registry.pages;
293
+ const decisions = treeDecisions({
294
+ slots: Object.fromEntries(Object.entries(pages).map(([key, page]) => [`${registry.home}.${key}`, page.declaration])),
295
+ userAnswers: true
296
+ }, reads);
297
+ return {
298
+ reads: [...reads.facts].sort(),
299
+ slot_reads: [],
300
+ decisions
301
+ };
302
+ }
290
303
 
291
304
  //#endregion
292
- export { fillSpecFromSchema };
305
+ export { fillSpecFromRegistry, fillSpecFromSchema };
@@ -1,13 +1,13 @@
1
1
  import { ImageValue } from "./runtime-values.js";
2
- import { RegistryTableKey } from "./registry-shape.js";
3
- import { ComputeBinding } from "./compute.js";
4
- import { ElementOf, ElementTableOf } from "./row-ref.js";
5
2
  import { ListItemSlot } from "./slot-types.js";
6
3
  import { ComputeRead, RowRef, SiblingSlot, SiblingSource, SlotRef } from "./slot-ref.js";
7
4
  import { FindFill, PickFill, WriteFill } from "./fill-builders.js";
8
5
  import { FillMark } from "./fill-declaration.js";
6
+ import { ComputeBinding } from "./compute.js";
9
7
  import { MediaSlotDef } from "./slot-builders.js";
8
+ import { RegistryTableKey } from "./registry-shape.js";
10
9
  import { RowSlotDef, TableSource } from "./row.js";
10
+ import { ElementOf, ElementTableOf } from "./row-ref.js";
11
11
  //#region ../../internal/template-contracts/dist/list.d.ts
12
12
  interface FillNode {
13
13
  readonly brief: string;
@@ -1,7 +1,8 @@
1
1
  import { declaredKinds, mediaDeclarationProblem } from "./slot-catalog.js";
2
- import "./registry-facts.js";
2
+ import { framedValueAt, isMediaReference, mediaIdOf, mergeMedia, owningValues } from "./registry-facts.js";
3
3
 
4
4
  //#region ../../internal/template-contracts/dist/media-candidates.js
5
+ const UPLOADS_LIST = "property.uploads";
5
6
  function fromListsOf(from) {
6
7
  if (typeof from === "string" && from !== "") return [from];
7
8
  if (!Array.isArray(from) || from.length === 0 || !from.every((key) => typeof key === "string" && key !== "")) return void 0;
@@ -16,6 +17,63 @@ function mediaFilterOf(declaration) {
16
17
  from
17
18
  };
18
19
  }
20
+ function isRecord(value) {
21
+ return value !== null && typeof value === "object" && !Array.isArray(value);
22
+ }
23
+ function itemValueOf(item) {
24
+ if (mediaIdOf(item) !== void 0 || !isRecord(item)) return item;
25
+ for (const member of Object.values(item)) if (mediaIdOf(member) !== void 0) return member;
26
+ }
27
+ function mediaListValues(facts, key) {
28
+ const [home, ...path] = key.split(".");
29
+ if (home !== "property" || path.length === 0) return null;
30
+ let at = facts;
31
+ for (const step of path) {
32
+ at = Array.isArray(at) ? at.find((item) => isRecord(item) && item["id"] === step) : isRecord(at) && Object.hasOwn(at, step) ? at[step] : void 0;
33
+ if (at === void 0) return null;
34
+ }
35
+ if (!Array.isArray(at)) return null;
36
+ return at.flatMap((item) => {
37
+ const value = itemValueOf(item);
38
+ const id = mediaIdOf(value);
39
+ return id === void 0 ? [] : [{
40
+ id,
41
+ value
42
+ }];
43
+ });
44
+ }
45
+ function mediaListItems(facts, key) {
46
+ return mediaListValues(facts, key)?.map(({ id }) => id) ?? null;
47
+ }
48
+ function attributedCandidates(facts, filter) {
49
+ const owning = owningValues(facts);
50
+ const seen = /* @__PURE__ */ new Set();
51
+ const out = [];
52
+ for (const list of fromListsOf(filter.from) ?? []) for (const { id, value: item } of mediaListValues(facts, list) ?? []) {
53
+ if (seen.has(id)) continue;
54
+ const owner = owning.get(id);
55
+ const file = owner === void 0 || !Object.hasOwn(facts.files, owner.file) ? void 0 : facts.files[owner.file];
56
+ if (owner === void 0 || file === void 0 || !filter.kinds.includes(file.kind)) continue;
57
+ seen.add(id);
58
+ const value = isMediaReference(item) ? framedValueAt(owner, item) : owner;
59
+ out.push({
60
+ id,
61
+ value,
62
+ file,
63
+ list
64
+ });
65
+ }
66
+ return out;
67
+ }
68
+ function attributedMedia(facts, filter) {
69
+ return attributedCandidates(facts, filter).map(({ value, file, list }) => ({
70
+ record: mergeMedia(file, value),
71
+ list
72
+ }));
73
+ }
74
+ function candidateSet(facts, filter) {
75
+ return attributedMedia(facts, filter).map(({ record }) => record);
76
+ }
19
77
  function readMediaOf(of) {
20
78
  if (of === null || typeof of !== "object") return null;
21
79
  const record = of;
@@ -33,6 +91,13 @@ function mediaOf(filter) {
33
91
  ...filter.from === void 0 ? {} : { from: [...filter.from] }
34
92
  };
35
93
  }
94
+ function withSubsetOrder(ids, reordered) {
95
+ const listed = new Set(ids);
96
+ const moved = reordered.filter((id) => listed.has(id));
97
+ const members = new Set(moved);
98
+ let next = 0;
99
+ return ids.map((id) => members.has(id) ? moved[next++] : id);
100
+ }
36
101
 
37
102
  //#endregion
38
- export { fromListsOf, mediaFilterOf, mediaOf, readMediaOf };
103
+ export { UPLOADS_LIST, attributedCandidates, attributedMedia, candidateSet, fromListsOf, mediaFilterOf, mediaListItems, mediaListValues, mediaOf, readMediaOf, withSubsetOrder };
@@ -0,0 +1,180 @@
1
+ import { declaredKinds } from "./slot-catalog.js";
2
+ import { mediaFilterOf, readMediaOf } from "./media-candidates.js";
3
+ import { memberMediaFilter, memberValueType, tableHome } from "./registry-shape.js";
4
+ import { listTableOf, memberAddressOf, rowTableOf } from "./ref-locate.js";
5
+ import { rowFieldMember, tableField } from "./table-members.js";
6
+ import { memberSourceOf } from "./row-sources.js";
7
+ import { decisionFills } from "./decision-fills.js";
8
+ import { isAnnotatedMediaItem } from "./list-editing.js";
9
+
10
+ //#region ../../internal/template-contracts/dist/media-offer.js
11
+ function boundMember(slot, table) {
12
+ if (table == null) return null;
13
+ const member = rowFieldMember(table, slot);
14
+ if (member === null) return null;
15
+ const declaration = tableField(table, member);
16
+ const valueType = declaration === void 0 ? null : memberValueType(declaration);
17
+ if (declaration === void 0 || valueType == null) return null;
18
+ const filter = memberMediaFilter(declaration);
19
+ return {
20
+ table,
21
+ member,
22
+ value_type: valueType,
23
+ ...filter !== void 0 ? { filter } : {}
24
+ };
25
+ }
26
+ const OWNED = { kind: "owned" };
27
+ function picked(filter) {
28
+ return filter === null ? OWNED : {
29
+ kind: "picked",
30
+ filter
31
+ };
32
+ }
33
+ function declaredOffer(slot, table) {
34
+ if (slot.from !== void 0) return picked(mediaFilterOf(slot));
35
+ const member = boundMember(slot, table);
36
+ if (member === null) return null;
37
+ return member.filter === void 0 ? OWNED : picked(mediaFilterOf({
38
+ type: slot.type,
39
+ from: member.filter.from
40
+ }));
41
+ }
42
+ function mediaOffer(slot, table) {
43
+ return declaredOffer(slot, table) ?? OWNED;
44
+ }
45
+ function itemOffer(list, itemSlot, table) {
46
+ return declaredOffer(itemSlot, table) ?? declaredOffer({
47
+ ...itemSlot,
48
+ source: list.source
49
+ }, table);
50
+ }
51
+ function annotatedFieldOffer(list, field, scope) {
52
+ const declared = declaredOffer(field, scope.itemTable);
53
+ if (declared !== null) return declared;
54
+ if (scope.picksBy !== null && field.source?.kind === "element") return {
55
+ kind: "picked",
56
+ filter: scope.picksBy
57
+ };
58
+ return declaredOffer({
59
+ ...field,
60
+ source: list.source
61
+ }, scope.listTable) ?? OWNED;
62
+ }
63
+ function fillPicksMediaBy(fillSpec, slotId) {
64
+ const decisions = isRecord(fillSpec) ? fillSpec["decisions"] : void 0;
65
+ if (!Array.isArray(decisions)) return null;
66
+ const decision = decisions.find((entry) => {
67
+ const produces = isRecord(entry) ? entry["produces"] : void 0;
68
+ return Array.isArray(produces) && produces[0] === slotId;
69
+ });
70
+ if (!decisionFills(decision).some((fill) => fill.verb === "pick")) return null;
71
+ return readMediaOf(isRecord(decision) ? decision["of"] : void 0);
72
+ }
73
+ function isRecord(value) {
74
+ return value !== null && typeof value === "object" && !Array.isArray(value);
75
+ }
76
+ function itemFieldsOf(list) {
77
+ const element = list.element;
78
+ return element?.type === "object" ? element.fields ?? {} : null;
79
+ }
80
+ function memberRowTable(slots, scope, source) {
81
+ const member = memberSourceOf(source);
82
+ if (member === null) return null;
83
+ const row = (Object.hasOwn(scope, member.slot) ? scope[member.slot] : void 0) ?? (Object.hasOwn(slots, member.slot) ? slots[member.slot] : void 0);
84
+ return row?.type === "row" ? rowTableOf(row) : null;
85
+ }
86
+ function contentSlotOfferAt(slots, slotPath, fillSpec) {
87
+ const [head = "", ...rest] = slotPath.split(".");
88
+ const top = Object.hasOwn(slots, head) ? slots[head] : void 0;
89
+ if (top === void 0) return null;
90
+ if (top.type === "list") return listOfferAt(slots, top, rest, {
91
+ rowTable: memberRowTable(slots, slots, top.source),
92
+ inRecord: false,
93
+ picksBy: fillPicksMediaBy(fillSpec, head)
94
+ });
95
+ if (top.type === "object") {
96
+ const [field, ...deeper] = rest;
97
+ const declaration = field === void 0 ? void 0 : top.fields?.[field];
98
+ if (declaration === void 0 || deeper.length > 0) return null;
99
+ return mediaAt(declaration, mediaOffer(declaration, memberRowTable(slots, top.fields ?? {}, declaration.source)));
100
+ }
101
+ return rest.length > 0 ? null : mediaAt(top, mediaOffer(top, memberRowTable(slots, slots, top.source)));
102
+ }
103
+ function listOfferAt(slots, list, path, walk) {
104
+ const [field, ...deeper] = path;
105
+ if (field === void 0) {
106
+ const element = list.element;
107
+ if (element === void 0) return null;
108
+ return mediaAt(element, itemOffer(list, element, walk.rowTable) ?? OWNED);
109
+ }
110
+ const fields = itemFieldsOf(list);
111
+ const declaration = fields?.[field];
112
+ if (fields === null || declaration === void 0) return null;
113
+ const itemTable = walk.inRecord ? walk.rowTable : listTableOf({ slots }, list);
114
+ if (declaration.type === "list") return listOfferAt(slots, declaration, deeper, {
115
+ rowTable: itemTable,
116
+ inRecord: true,
117
+ picksBy: null
118
+ });
119
+ if (deeper.length > 0) return null;
120
+ return mediaAt(declaration, isAnnotatedMediaItem(fields) ? annotatedFieldOffer(list, declaration, {
121
+ itemTable,
122
+ listTable: walk.rowTable,
123
+ picksBy: walk.picksBy
124
+ }) : declaredOffer(declaration, itemTable) ?? (walk.picksBy !== null && declaration.source?.kind === "element" ? {
125
+ kind: "picked",
126
+ filter: walk.picksBy
127
+ } : OWNED));
128
+ }
129
+ function mediaAt(declaration, offer) {
130
+ return mediaFilterOf(declaration) === null ? null : {
131
+ declaration,
132
+ offer
133
+ };
134
+ }
135
+ const OWNED_MEMBER_TYPES = /* @__PURE__ */ new Set([
136
+ "image",
137
+ "video",
138
+ "tour",
139
+ "document"
140
+ ]);
141
+ function slotDeclarationAt(slots, slotId) {
142
+ const [head = "", ...rest] = slotId.split(".");
143
+ let slot = Object.hasOwn(slots, head) ? slots[head] : void 0;
144
+ for (const field of rest) slot = (slot?.type === "list" ? slot.element ?? slot : slot)?.fields?.[field];
145
+ return slot;
146
+ }
147
+ function readerAt(slots, slotId) {
148
+ const dot = slotId.lastIndexOf(".");
149
+ if (dot <= 0) return {};
150
+ const container = slotId.slice(0, dot);
151
+ const holder = slotDeclarationAt(slots, container);
152
+ const siblings = (holder?.type === "list" ? holder.element ?? holder : holder)?.fields;
153
+ return siblings === void 0 ? { container } : {
154
+ container,
155
+ siblings
156
+ };
157
+ }
158
+ function ownedRowMemberOf(slots, slotId, declaration) {
159
+ const source = declaration.source;
160
+ if (source?.kind !== "row" || source.slot === void 0) return null;
161
+ const address = memberAddressOf(slots, readerAt(slots, slotId), {
162
+ slot: source.slot,
163
+ field: source.field
164
+ });
165
+ if (address?.layer !== "home") return null;
166
+ const { table, member } = address;
167
+ const fact = tableField(table, member);
168
+ if (fact === void 0 || !OWNED_MEMBER_TYPES.has(fact.type) || fact.from !== void 0) return null;
169
+ const kind = fact.type;
170
+ if (!declaredKinds(declaration).includes(kind)) return null;
171
+ return {
172
+ table,
173
+ member,
174
+ kind,
175
+ home: tableHome(table)
176
+ };
177
+ }
178
+
179
+ //#endregion
180
+ export { annotatedFieldOffer, boundMember, contentSlotOfferAt, declaredOffer, fillPicksMediaBy, itemOffer, mediaOffer, ownedRowMemberOf };
@@ -1,8 +1,8 @@
1
- import { AddressValue } from "./address-value.js";
2
1
  import { ObjectBindingOwnKey } from "./slot-catalog.js";
3
- import { ComputeBinding } from "./compute.js";
2
+ import { AddressValue } from "./address-value.js";
4
3
  import { ObjectFieldSlot } from "./slot-types.js";
5
4
  import { ElementRef, RowRef } from "./slot-ref.js";
5
+ import { ComputeBinding } from "./compute.js";
6
6
  import { MirrorSource, MirrorValueOption, SlotSource, TextSlotDef } from "./slot-builders.js";
7
7
  //#region ../../internal/template-contracts/dist/object.d.ts
8
8
  /** A field an object takes: a value slot, a row, or a list of value slots — each stating its label. */
@@ -1,5 +1,5 @@
1
1
  import { normalizeAddressValue } from "./address-value.js";
2
- import { MEDIA_KINDS, PROCESS_VERBS } from "./slot-catalog.js";
2
+ import { MEDIA_KINDS, PROCESS_VERBS, SLOT_TYPES } from "./slot-catalog.js";
3
3
  import { ICON_NAMES } from "./icon-names.js";
4
4
  import { z } from "zod";
5
5
 
@@ -157,6 +157,13 @@ const PRIMITIVE_DESCRIPTORS = {
157
157
  isEmpty: isBlankMedia
158
158
  }
159
159
  };
160
+ function isPrimitive(type) {
161
+ return SLOT_TYPES.includes(type);
162
+ }
163
+ function defaultForSlotType(type) {
164
+ if (type === "object") return {};
165
+ return isPrimitive(type) ? PRIMITIVE_DESCRIPTORS[type].default() : null;
166
+ }
160
167
 
161
168
  //#endregion
162
- export { PRIMITIVE_DESCRIPTORS };
169
+ export { PRIMITIVE_DESCRIPTORS, defaultForSlotType };
@@ -1,5 +1,5 @@
1
1
  import { memberListOfKey, tableColumnOfKey, tableOf } from "./registry-shape.js";
2
- import "./ref-locate.js";
2
+ import { placementOf } from "./ref-locate.js";
3
3
  import { isMediaListKey, isRegistryFactKey } from "./fact-keys.js";
4
4
 
5
5
  //#region ../../internal/template-contracts/dist/read-graph.js
@@ -208,6 +208,40 @@ function sectionGraphOf(schema, fillSpec) {
208
208
  }
209
209
  return graph;
210
210
  }
211
+ function templateGraphOf(pages, sections) {
212
+ const placement = placementOf(pages);
213
+ return { pages: pages.map((page) => ({
214
+ id: page.id,
215
+ instances: page.sections.map((entry) => {
216
+ const graph = sections.get(entry.section);
217
+ if (graph === void 0) throw new Error(`read graph: the composition places section "${entry.section}", which carries no read graph.`);
218
+ const reader = {
219
+ instanceId: entry.instance_id,
220
+ section: entry.section
221
+ };
222
+ const slots = graph.slots.map((slot) => {
223
+ const { mirrors, ...rest } = slot;
224
+ if (mirrors === void 0) return rest;
225
+ const upstream = placement.locate(mirrors, reader);
226
+ return upstream === void 0 ? rest : {
227
+ ...rest,
228
+ mirrors: {
229
+ instanceId: upstream.instanceId,
230
+ slot: upstream.slot
231
+ }
232
+ };
233
+ });
234
+ return {
235
+ instanceId: entry.instance_id,
236
+ section: entry.section,
237
+ required: entry.required === true,
238
+ ...graph.visibility === void 0 ? {} : { visibility: graph.visibility },
239
+ ...graph.variant === void 0 ? {} : { variant: graph.variant },
240
+ slots
241
+ };
242
+ })
243
+ })) };
244
+ }
211
245
 
212
246
  //#endregion
213
- export { factPathOf, rowBaseOf, sectionGraphOf };
247
+ export { factPathOf, rowBaseOf, sectionGraphOf, templateGraphOf };