@homepages/concrete 6.1.0 → 7.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 (87) hide show
  1. package/CHANGELOG.md +166 -0
  2. package/codemods/manifest.json +17 -0
  3. package/codemods/object-form-only.mjs +39 -0
  4. package/codemods/steps/list-object-form.mjs +688 -0
  5. package/codemods/steps/select-object-form.mjs +210 -0
  6. package/dist/artifact/playground/client/assets/index-D8eepVr-.js +1101 -0
  7. package/dist/artifact/playground/client/index.html +1 -1
  8. package/dist/artifact/playground/host.mjs +14 -14
  9. package/dist/asset-modules.d.ts +2 -1
  10. package/dist/cli/check/stages/render.js +1 -1
  11. package/dist/cli/check/stages/sections.js +1 -1
  12. package/dist/fixtures/canonical.d.ts +2 -5
  13. package/dist/fixtures/media.js +11 -25
  14. package/dist/fixtures/property.js +28 -16
  15. package/dist/fixtures/resolve.js +75 -32
  16. package/dist/fixtures/rows.js +3 -83
  17. package/dist/fixtures.d.ts +17 -9
  18. package/dist/index.d.ts +9 -9
  19. package/dist/packages/external/concrete/package.js +1 -1
  20. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +31 -8
  21. package/dist/packages/internal/fill-bake/dist/derive-source.js +15 -4
  22. package/dist/packages/internal/fill-bake/dist/index.js +2 -2
  23. package/dist/packages/internal/fill-vocabulary/dist/origination.js +6 -1
  24. package/dist/packages/internal/fill-vocabulary/dist/row-reads.js +15 -0
  25. package/dist/packages/internal/property-facts/dist/index.js +1 -1
  26. package/dist/packages/internal/property-facts/dist/{property-facts-5pxZnlkh.js → property-facts-Cy7-O4p0.js} +2 -5
  27. package/dist/packages/internal/section-contracts/dist/catalog.js +0 -4
  28. package/dist/packages/internal/section-contracts/dist/choose-select-contract.js +4 -4
  29. package/dist/packages/internal/section-contracts/dist/display-evidence-contract.js +2 -1
  30. package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +5 -1
  31. package/dist/packages/internal/section-contracts/dist/group-contract.js +1 -3
  32. package/dist/packages/internal/section-contracts/dist/index.js +0 -1
  33. package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +3 -3
  34. package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +1 -5
  35. package/dist/packages/internal/section-contracts/dist/name-title-contract.js +2 -2
  36. package/dist/packages/internal/section-contracts/dist/pooling-field-contract.js +3 -1
  37. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +14 -0
  38. package/dist/packages/internal/section-contracts/dist/runners.js +0 -5
  39. package/dist/packages/internal/section-contracts/dist/source-contract.js +80 -4
  40. package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +12 -6
  41. package/dist/packages/internal/source-resolution/dist/index.js +57 -20
  42. package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +16 -17
  43. package/dist/packages/internal/template-contracts/dist/facts-view.js +6 -18
  44. package/dist/packages/internal/template-contracts/dist/row-sources.js +26 -0
  45. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +362 -380
  46. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +289 -289
  47. package/dist/primitives/slot-bindings.d.ts +7 -40
  48. package/dist/primitives/slot-bindings.js +10 -12
  49. package/dist/schema/define-schema.d.ts +1 -1
  50. package/dist/schema/define-schema.js +32 -17
  51. package/dist/schema/extract-fill-spec.js +15 -13
  52. package/dist/schema/fact.d.ts +2 -19
  53. package/dist/schema/fill-builders.d.ts +4 -3
  54. package/dist/schema/fill-spec.js +9 -1
  55. package/dist/schema/layout.d.ts +6 -8
  56. package/dist/schema/layout.js +3 -9
  57. package/dist/schema/property-facts.d.ts +16 -47
  58. package/dist/schema/row-fields.js +88 -0
  59. package/dist/schema/row-ref.d.ts +59 -0
  60. package/dist/schema/row-ref.js +28 -0
  61. package/dist/schema/runtime-values.d.ts +8 -13
  62. package/dist/schema/section-props.d.ts +19 -26
  63. package/dist/schema/section-schema.d.ts +6 -6
  64. package/dist/schema/section-schema.js +2 -2
  65. package/dist/schema/slot-builders.d.ts +222 -117
  66. package/dist/schema/slot-builders.js +57 -28
  67. package/dist/schema/slot-ref.d.ts +18 -2
  68. package/dist/schema/slot-ref.js +11 -3
  69. package/dist/schema/slot-types.d.ts +7 -7
  70. package/dist/schema/slot-types.js +55 -19
  71. package/dist/section/declare.d.ts +1 -1
  72. package/dist/section/section.d.ts +3 -3
  73. package/dist/template/logic-shim.d.ts +1 -1
  74. package/guide/reference/cli/INDEX.md +2 -2
  75. package/guide/reference/cli/build.md +1 -1
  76. package/guide/reference/cli/check.md +1 -1
  77. package/guide/reference/cli/dev.md +1 -1
  78. package/guide/reference/cli/property-add.md +1 -1
  79. package/guide/reference/cli/property-list.md +1 -1
  80. package/guide/reference/cli/publish.md +1 -1
  81. package/guide/reference/cli/upgrade.md +1 -1
  82. package/guide/reference/rules/INDEX.md +1 -2
  83. package/package.json +1 -1
  84. package/tsconfig.base.json +1 -0
  85. package/dist/artifact/playground/client/assets/index-Cqz-jjVw.js +0 -1101
  86. package/dist/packages/internal/section-contracts/dist/row-contract.js +0 -37
  87. package/dist/packages/internal/template-contracts/dist/layout.js +0 -10
@@ -4,7 +4,7 @@
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <title>Playground</title>
7
- <script type="module" crossorigin src="./assets/index-Cqz-jjVw.js"></script>
7
+ <script type="module" crossorigin src="./assets/index-D8eepVr-.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="./assets/index-CckS2ONm.css">
9
9
  </head>
10
10
  <body>
@@ -1,4 +1,4 @@
1
- var Xe=/^(\d+(?:\.\d+)?)(in|mm)$/;function Y(e){let t=Xe.exec(e),[,n,r]=t??[];if(n===void 0||r===void 0)throw new Error(`malformed physical length: "${e}"`);let o=Number.parseFloat(n);return r==="mm"?o/25.4:o}function N(e){if(typeof e.width=="number"&&typeof e.height=="number")return{frameWidth:e.width,frameHeight:e.height,bleed:0,viewportWidth:e.width,viewportHeight:e.height,deviceScaleFactor:1,pixelWidth:e.width,pixelHeight:e.height,pointWidth:e.width/96*72,pointHeight:e.height/96*72,bleedPoints:0};let t=e,n=Y(t.width),r=Y(t.height),o=t.bleed===void 0?0:Y(t.bleed),l=n*96,u=r*96,d=o*96,a=l+2*d,h=u+2*d,v=t.dpi/96;return{frameWidth:l,frameHeight:u,bleed:d,viewportWidth:a,viewportHeight:h,deviceScaleFactor:v,pixelWidth:Math.round(a*v),pixelHeight:Math.round(h*v),pointWidth:(n+2*o)*72,pointHeight:(r+2*o)*72,bleedPoints:o*72}}var $="concrete-frame";function O(e){let t=N(e);return{"--frame-w":`${t.frameWidth}px`,"--frame-h":`${t.frameHeight}px`,"--frame-bleed":`${t.bleed}px`}}var J=`(function () {
1
+ var Xe=/^(\d+(?:\.\d+)?)(in|mm)$/;function Y(e){let t=Xe.exec(e),[,n,r]=t??[];if(n===void 0||r===void 0)throw new Error(`malformed physical length: "${e}"`);let o=Number.parseFloat(n);return r==="mm"?o/25.4:o}function O(e){if(typeof e.width=="number"&&typeof e.height=="number")return{frameWidth:e.width,frameHeight:e.height,bleed:0,viewportWidth:e.width,viewportHeight:e.height,deviceScaleFactor:1,pixelWidth:e.width,pixelHeight:e.height,pointWidth:e.width/96*72,pointHeight:e.height/96*72,bleedPoints:0};let t=e,n=Y(t.width),r=Y(t.height),o=t.bleed===void 0?0:Y(t.bleed),c=n*96,p=r*96,d=o*96,i=c+2*d,h=p+2*d,w=t.dpi/96;return{frameWidth:c,frameHeight:p,bleed:d,viewportWidth:i,viewportHeight:h,deviceScaleFactor:w,pixelWidth:Math.round(i*w),pixelHeight:Math.round(h*w),pointWidth:(n+2*o)*72,pointHeight:(r+2*o)*72,bleedPoints:o*72}}var $="concrete-frame";function N(e){let t=O(e);return{"--frame-w":`${t.frameWidth}px`,"--frame-h":`${t.frameHeight}px`,"--frame-bleed":`${t.bleed}px`}}var J=`(function () {
2
2
  function CaptureIntersectionObserver(callback, options) {
3
3
  var opts = options || {};
4
4
  this.root = opts.root || null;
@@ -62,11 +62,11 @@ var Xe=/^(\d+(?:\.\d+)?)(in|mm)$/;function Y(e){let t=Xe.exec(e),[,n,r]=t??[];if
62
62
  await new Promise((resolve) => {
63
63
  requestAnimationFrame(() => resolve(undefined));
64
64
  });
65
- })()`,ce=5,Qe=`(async () => {
65
+ })()`,de=5,Ze=`(async () => {
66
66
  const frame = () => new Promise((resolve) => {
67
67
  requestAnimationFrame(() => resolve(undefined));
68
68
  });
69
- for (let pass = 0; pass < ${ce}; pass += 1) {
69
+ for (let pass = 0; pass < ${de}; pass += 1) {
70
70
  const running = document.getAnimations().filter((animation) => {
71
71
  if (animation.playState === "finished" || animation.playState === "idle") return false;
72
72
  const timing = animation.effect && animation.effect.getComputedTiming();
@@ -83,14 +83,14 @@ var Xe=/^(\d+(?:\.\d+)?)(in|mm)$/;function Y(e){let t=Xe.exec(e),[,n,r]=t??[];if
83
83
  await frame();
84
84
  }
85
85
  await frame();
86
- })()`;function M(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function g(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function de(e){return ue(e.id,{...O(e)})}function ue(e,t){let n=Object.entries(t).map(([r,o])=>`${r}:${o}`).join(";");return{class:$,dataFormat:e,style:n}}function L(e,t){let n=de(e);return`<div class="${g(n.class)}" data-format="${g(n.dataFormat)}" style="${g(n.style)}">${t.join("")}</div>`}function C(e){switch(e.destination){case"published":return Ze(e);case"artifact":return et(e);case"preview":return tt(e);case"diff":return nt(e)}}function pe(e){return e.kind==="none"||Object.keys(e.islandMap).length===0?[]:[`<script>${J}</script>`]}var me="html, body { margin: 0; padding: 0; }";function fe(e){let t=[`rel="${e.rel}"`,`href="${g(e.href)}"`];return e.sizes!==void 0&&t.push(`sizes="${g(e.sizes)}"`),e.type!==void 0&&t.push(`type="${g(e.type)}"`),`<link ${t.join(" ")} />`}function Ze(e){let{meta:t}=e,n=['<meta charset="utf-8" />','<meta name="viewport" content="width=device-width, initial-scale=1" />',`<title>${g(t.title)}</title>`,`<meta name="description" content="${g(t.description)}" />`];t.canonical&&n.push(`<link rel="canonical" href="${g(t.canonical)}" />`);for(let o of t.icons??[])n.push(fe(o));n.push('<meta property="og:type" content="website" />'),t.siteName&&n.push(`<meta property="og:site_name" content="${g(t.siteName)}" />`),n.push(`<meta property="og:title" content="${g(t.title)}" />`),n.push(`<meta property="og:description" content="${g(t.description)}" />`),t.ogUrl&&n.push(`<meta property="og:url" content="${g(t.ogUrl)}" />`),t.ogImage&&(n.push(`<meta property="og:image" content="${g(t.ogImage)}" />`),t.ogImageWidth&&n.push(`<meta property="og:image:width" content="${t.ogImageWidth}" />`),t.ogImageHeight&&n.push(`<meta property="og:image:height" content="${t.ogImageHeight}" />`),t.ogImageType&&n.push(`<meta property="og:image:type" content="${g(t.ogImageType)}" />`),t.ogImageAlt&&n.push(`<meta property="og:image:alt" content="${g(t.ogImageAlt)}" />`),n.push('<meta name="twitter:card" content="summary_large_image" />'),n.push(`<meta name="twitter:title" content="${g(t.title)}" />`),n.push(`<meta name="twitter:description" content="${g(t.description)}" />`),n.push(`<meta name="twitter:image" content="${g(t.ogImage)}" />`)),n.push(...q(e.stylesheets)),n.push(...Z(e.islands)),e.prefetchUrls&&e.prefetchUrls.length>0&&n.push(`<script type="speculationrules">${M({prefetch:[{source:"list",urls:[...e.prefetchUrls]}]})}</script>`);let r=e.siteConfig?`
86
+ })()`;function M(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function g(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function ce(e){return ue(e.id,{...N(e)})}function ue(e,t){let n=Object.entries(t).map(([r,o])=>`${r}:${o}`).join(";");return{class:$,dataFormat:e,style:n}}function L(e,t){let n=ce(e);return`<div class="${g(n.class)}" data-format="${g(n.dataFormat)}" style="${g(n.style)}">${t.join("")}</div>`}function C(e){switch(e.destination){case"published":return Qe(e);case"artifact":return et(e);case"preview":return tt(e);case"diff":return nt(e)}}function pe(e){return e.kind==="none"||Object.keys(e.islandMap).length===0?[]:[`<script>${J}</script>`]}var me="html, body { margin: 0; padding: 0; }";function fe(e){let t=[`rel="${e.rel}"`,`href="${g(e.href)}"`];return e.sizes!==void 0&&t.push(`sizes="${g(e.sizes)}"`),e.type!==void 0&&t.push(`type="${g(e.type)}"`),`<link ${t.join(" ")} />`}function Qe(e){let{meta:t}=e,n=['<meta charset="utf-8" />','<meta name="viewport" content="width=device-width, initial-scale=1" />',`<title>${g(t.title)}</title>`,`<meta name="description" content="${g(t.description)}" />`];t.canonical&&n.push(`<link rel="canonical" href="${g(t.canonical)}" />`);for(let o of t.icons??[])n.push(fe(o));n.push('<meta property="og:type" content="website" />'),t.siteName&&n.push(`<meta property="og:site_name" content="${g(t.siteName)}" />`),n.push(`<meta property="og:title" content="${g(t.title)}" />`),n.push(`<meta property="og:description" content="${g(t.description)}" />`),t.ogUrl&&n.push(`<meta property="og:url" content="${g(t.ogUrl)}" />`),t.ogImage&&(n.push(`<meta property="og:image" content="${g(t.ogImage)}" />`),t.ogImageWidth&&n.push(`<meta property="og:image:width" content="${t.ogImageWidth}" />`),t.ogImageHeight&&n.push(`<meta property="og:image:height" content="${t.ogImageHeight}" />`),t.ogImageType&&n.push(`<meta property="og:image:type" content="${g(t.ogImageType)}" />`),t.ogImageAlt&&n.push(`<meta property="og:image:alt" content="${g(t.ogImageAlt)}" />`),n.push('<meta name="twitter:card" content="summary_large_image" />'),n.push(`<meta name="twitter:title" content="${g(t.title)}" />`),n.push(`<meta name="twitter:description" content="${g(t.description)}" />`),n.push(`<meta name="twitter:image" content="${g(t.ogImage)}" />`)),n.push(...q(e.stylesheets)),n.push(...Q(e.islands)),e.prefetchUrls&&e.prefetchUrls.length>0&&n.push(`<script type="speculationrules">${M({prefetch:[{source:"list",urls:[...e.prefetchUrls]}]})}</script>`);let r=e.siteConfig?`
87
87
  <script type="application/json" id="concrete-site-config">${M(e.siteConfig)}</script>`:"";return j({lang:t.lang??"en",head:n,body:` <body class="concrete-root">
88
88
  ${e.root.bodyHtml}${r}${ee(e.islands,"viewport")}
89
89
  <script type="module" src="${g(e.analyticsJs.url)}"></script>
90
- </body>`})}function et(e){let t=['<meta charset="utf-8" />'];e.title!==void 0&&t.push(`<title>${g(e.title)}</title>`),t.push(...q(e.stylesheets));let n=[me,...ot(e.root)];return t.push(Q(n)),t.push(...pe(e.islands)),t.push(...Z(e.islands)),j({lang:"en",head:t,body:` <body>${rt(e.root)}${ee(e.islands,"eager")}</body>`})}function tt(e){let t=['<meta charset="utf-8" />','<meta name="viewport" content="width=device-width, initial-scale=1" />',`<title>${g(e.title)}</title>`,...e.icon===void 0?[]:[fe({rel:"icon",href:e.icon})],...q(e.stylesheets),Q([me,...e.extraCss??[]]),...e.capture===!0?pe(e.islands):[],...Z(e.islands)],n=(e.devScripts??[]).map(r=>`
90
+ </body>`})}function et(e){let t=['<meta charset="utf-8" />'];e.title!==void 0&&t.push(`<title>${g(e.title)}</title>`),t.push(...q(e.stylesheets));let n=[me,...ot(e.root)];return t.push(Z(n)),t.push(...pe(e.islands)),t.push(...Q(e.islands)),j({lang:"en",head:t,body:` <body>${rt(e.root)}${ee(e.islands,"eager")}</body>`})}function tt(e){let t=['<meta charset="utf-8" />','<meta name="viewport" content="width=device-width, initial-scale=1" />',`<title>${g(e.title)}</title>`,...e.icon===void 0?[]:[fe({rel:"icon",href:e.icon})],...q(e.stylesheets),Z([me,...e.extraCss??[]]),...e.capture===!0?pe(e.islands):[],...Q(e.islands)],n=(e.devScripts??[]).map(r=>`
91
91
  ${r}`).join("");return j({lang:"en",head:t,body:` <body>
92
92
  ${e.root.bodyHtml}${ee(e.islands,e.capture===!0?"eager":"viewport")}${n}
93
- </body>`})}function nt(e){let t=['<meta charset="utf-8" />',`<meta name="viewport" content="width=${e.viewportWidth}, initial-scale=1" />`,`<title>${g(e.title)}</title>`,...q(e.stylesheets),Q([`html, body { margin: 0; padding: 0; width: ${e.viewportWidth}px; }`])];return j({lang:"en",head:t,body:` <body>${e.root.bodyHtml}</body>`})}function j(e){let t=e.head.map(n=>` ${n}`).join(`
93
+ </body>`})}function nt(e){let t=['<meta charset="utf-8" />',`<meta name="viewport" content="width=${e.viewportWidth}, initial-scale=1" />`,`<title>${g(e.title)}</title>`,...q(e.stylesheets),Z([`html, body { margin: 0; padding: 0; width: ${e.viewportWidth}px; }`])];return j({lang:"en",head:t,body:` <body>${e.root.bodyHtml}</body>`})}function j(e){let t=e.head.map(n=>` ${n}`).join(`
94
94
  `);return`<!doctype html>
95
95
  <html lang="${g(e.lang)}">
96
96
  <head>
@@ -99,21 +99,21 @@ ${t}
99
99
  ${e.body}
100
100
  </html>
101
101
  `}function rt(e){return e.kind==="frame"?L(e.format,e.sectionHtml):e.pages.map(t=>L(e.format,t)).join(`
102
- `)}function ot(e){return e.kind!=="frameStack"?[]:[`body > .${$} { break-after: page; }`,`body > .${$}:last-child { break-after: auto; }`]}function q(e){return e.kind==="links"?e.hrefs.map(t=>`<link rel="stylesheet" href="${g(t)}" />`):e.css.map(t=>`<style>${t}</style>`)}function Q(e){let[t,...n]=e;return t===void 0?"<style></style>":n.length===0?`<style>${t}</style>`:`<style>${t}
102
+ `)}function ot(e){return e.kind!=="frameStack"?[]:[`body > .${$} { break-after: page; }`,`body > .${$}:last-child { break-after: auto; }`]}function q(e){return e.kind==="links"?e.hrefs.map(t=>`<link rel="stylesheet" href="${g(t)}" />`):e.css.map(t=>`<style>${t}</style>`)}function Z(e){let[t,...n]=e;return t===void 0?"<style></style>":n.length===0?`<style>${t}</style>`:`<style>${t}
103
103
  ${n.join(`
104
104
  `)}
105
- </style>`}function Z(e){if(e.kind!=="bundles")return[];let t=[],n=e.reactVendorMap;if(n&&Object.keys(n).length>0&&t.push(`<script type="importmap">${M({imports:n})}</script>`),Object.keys(e.islandMap).length===0)return t;for(let r of[e.runtime.url,...Object.values(n??{}),...e.reactVendorCore?[e.reactVendorCore.url]:[]])t.push(`<link rel="modulepreload" href="${g(r)}" />`);return t}function ee(e,t){if(e.kind==="none"||Object.keys(e.islandMap).length===0)return"";let n=M(e.islandMap),r=t==="eager"?' window.__TR_ISLAND_SCHEDULE = "eager";':"";return e.kind==="bundles"?`
105
+ </style>`}function Q(e){if(e.kind!=="bundles")return[];let t=[],n=e.reactVendorMap;if(n&&Object.keys(n).length>0&&t.push(`<script type="importmap">${M({imports:n})}</script>`),Object.keys(e.islandMap).length===0)return t;for(let r of[e.runtime.url,...Object.values(n??{}),...e.reactVendorCore?[e.reactVendorCore.url]:[]])t.push(`<link rel="modulepreload" href="${g(r)}" />`);return t}function ee(e,t){if(e.kind==="none"||Object.keys(e.islandMap).length===0)return"";let n=M(e.islandMap),r=t==="eager"?' window.__TR_ISLAND_SCHEDULE = "eager";':"";return e.kind==="bundles"?`
106
106
  <script>window.__TR_ISLAND_MAP=${n};${r}</script>
107
107
  <script type="module" src="${g(e.runtime.url)}"></script>`:`
108
- ${it}
108
+ ${at}
109
109
  <script>window.__TR_ISLAND_MAP = ${n};${r}</script>
110
- <script type="module" src="${g(e.bootstrapUrl)}"></script>`}var it=`<script type="module">
110
+ <script type="module" src="${g(e.bootstrapUrl)}"></script>`}var at=`<script type="module">
111
111
  import RefreshRuntime from "/@react-refresh";
112
112
  RefreshRuntime.injectIntoGlobalHook(window);
113
113
  window.$RefreshReg$ = () => {};
114
114
  window.$RefreshSig$ = () => (type) => type;
115
115
  window.__vite_plugin_react_preamble_installed__ = true;
116
- </script>`;function ye(){let e={};return new Proxy(e,{get:(t,n)=>typeof n!="string"||n in e||n==="then"||n==="toJSON"?e[n]:`#${n}`})}function ge(e){let t=new URLSearchParams;for(let[r,o]of Object.entries(e))o!=null&&o!==""&&t.set(r,o);let n=t.toString();return n===""?"":`?${n}`}var T={catalog:"api/catalog",render:"api/render",media:e=>`api/media${ge({fixture:e})}`,capture:(e,t)=>`api/capture/${e}${ge({fixture:t.fixture,format:t.format,page:t.page,canvas:t.canvas})}`,live:(e,t)=>`fixtures/${encodeURIComponent(e)}/live${t==="/"?"/":`${t}/`}`,hmr:"__hmr"};var y=class extends Error{constructor(n,r){super(r);this.status=n}status};function at(e){return e.split("-").map(t=>t&&t[0].toUpperCase()+t.slice(1)).join(" ")}function he(e){let{variant:t}=e;return{required:e.required,variant:t===null?null:{cases:t.cases.map(n=>({value:n,label:at(n)})),locked:t.locked}}}function _e(e){return Object.fromEntries(e.map(t=>[t.instance_id,{enabled:t.enabled,...t.variant===void 0?{}:{variant:t.variant}}]))}function be(e){if(e==null)return{};if(typeof e!="object"||Array.isArray(e))throw new y(400,"A render request's display is an object keyed by instance id.");let t={};for(let[n,r]of Object.entries(e)){if(typeof r!="object"||r===null||Array.isArray(r))throw new y(400,`The display state of "${n}" is not an object.`);let{enabled:o,variant:l}=r;if(o!==void 0&&typeof o!="boolean")throw new y(400,`The display state of "${n}" has a non-boolean enabled.`);if(l!==void 0&&typeof l!="string")throw new y(400,`The display state of "${n}" has a non-string variant.`);t[n]={...o===void 0?{}:{enabled:o},...l===void 0?{}:{variant:l}}}return t}function ve(e,t){for(let[n,r]of Object.entries(t)){let o=e.instances.find(u=>u.instanceId===n);if(o===void 0)throw new y(400,`The composition places no instance "${n}".`);if(r.enabled===!1&&o.display.required)throw new y(400,`Section instance "${n}" is required and cannot be hidden.`);if(r.variant===void 0)continue;let l=o.display.variant;if(l===null)throw new y(400,`Section instance "${n}" declares no display variant.`);if(l.locked)throw new y(400,`Section instance "${n}" declares a locked variant, which the user cannot switch.`);if(!l.cases.includes(r.variant))throw new y(400,`"${r.variant}" is not a declared case of section instance "${n}" (declared: ${l.cases.join(", ")}).`)}}function we(e,t){return new Map(e.instances.map(n=>[n.instance_id,t[n.instance_id]?.enabled??n.enabled]))}function xe(e,t,n){let r=n[e.instance_id]?.variant;if(r===void 0||r===e.variant)return e;let o={...e.slots};for(let[l,u]of Object.entries(t))l in o||(u.variant===void 0||u.variant.cases.includes(r))&&(o[l]=u.type==="list"?[]:null);return{...e,variant:r,slots:o}}function Re(e){return Array.isArray(e)?e.length:0}function Se(e){return typeof e=="string"&&e!==""?e:null}function st(e){return{propertyType:Se(e.property_type),listingIntent:Se(e.listing_intent),units:Re(e.units),photos:Re(e.photos)}}function lt(e){let t=JSON.stringify(e),n=3735928559,r=1103547991;for(let o=0;o<t.length;o++){let l=t.charCodeAt(o);n=Math.imul(n^l,2654435761),r=Math.imul(r^l,1597334677)}return n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(16).padStart(14,"0")}function ke(e){return{id:e.id,label:e.label,summary:st(e.facts),doc:lt(e.instances),display:_e(e.instances)}}function Ie(e,t){let n=e.replace(/\/+$/,"");return t==="/"?`${n}/`:`${n}${t}/`}function Pe(e){let{pages:t,currentPageId:n,basePath:r}=e,o=t.find(d=>d.id===n);if(!o)throw new Error(`nav: page "${n}" is not one of the declared pages (${t.map(d=>d.id).join(", ")}).`);let l=[o,...t.filter(d=>d.id!==o.id&&d.enabled!==!1)],u={};for(let d of l)for(let a of d.sections)a.enabled===!1||a.key in u||(u[a.key]=d.id===o.id?`#${a.anchor}`:`${Ie(r,d.path)}#${a.anchor}`);return{anchors:u,pages:t.filter(d=>d.enabled!==!1).map(d=>({id:d.id,label:d.label,href:Ie(r,d.path),current:d.id===o.id}))}}function W(e,t){return e.pages?.[t]?.enabled!==!1}function te(e,t){return t.filter(n=>W(e,n.id))}var D={base:"stylesheets/base.css",template:"stylesheets/template.css"},k={frame:"__capture/frame",print:"__capture/print"};function Ee(e){return new URLSearchParams(e).toString()}function ne(e,t,n){return`${k.frame}?${Ee({fixture:e,page:t,format:n})}`}function Te(e,t){return`${k.print}?${Ee({fixture:e,format:t})}`}var ct=["text","number","select","image","list","poi","url","video","tour","document"],dt=[],wn=[...ct,...dt];var ut=["address","type","intent","describe","uploads","units","comparables","contacts"];var pt={address:"always",type:"always",intent:"always",describe:"always",uploads:"always",units:"derived",comparables:"derived",contacts:"derived"},xn=ut.filter(e=>pt[e]==="always");var mt={matterport:{kind:"tour",label:"Matterport",pattern:/(^|\.)matterport\.com$/i,strategy:"api"},biganto:{kind:"tour",label:"Biganto",pattern:/(^|\.)biganto\.com$/i,strategy:"opengraph"},youtube:{kind:"video",label:"YouTube",pattern:/(^|\.)(youtube\.com|youtu\.be)$/i,strategy:"oembed"},vimeo:{kind:"video",label:"Vimeo",pattern:/(^|\.)vimeo\.com$/i,strategy:"oembed"},zillow:{kind:"listing",label:"Zillow",pattern:/(^|\.)zillow\.com$/i,strategy:"none"},redfin:{kind:"listing",label:"Redfin",pattern:/(^|\.)redfin\.com$/i,strategy:"none"},dropbox:{kind:"file",label:"Dropbox",pattern:/(^|\.)dropbox\.com$/i,strategy:"none"},drive:{kind:"file",label:"Google Drive",pattern:/^drive\.google\.com$/i,strategy:"none"},maps:{kind:"map",label:"Google Maps",pattern:/(^|\.)google\.com$/i,path:/^\/maps(\/|$)/i,strategy:"none"}};function $e(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!=="http:"&&t.protocol!=="https:")return null;for(let[n,r]of Object.entries(mt))if(r.pattern.test(t.hostname)&&!(r.path&&!r.path.test(t.pathname)))return n;return null}var ft="badge=0&autopause=0&player_id=0&title=0&byline=0&portrait=0&sidedock=0&vimeo_logo=0&pip=0&chromecast=0&quality_selector=0&progress_bar=1";function Ce(e){let t=e.trim();if(!t)return null;let n=$e(t);if(n==="vimeo"){let r=t.match(/vimeo\.com\/(?:.*\/)?(\d+)/);return r?`https://player.vimeo.com/video/${r[1]}?${ft}`:null}if(n==="youtube"){let r=t.match(/youtu\.be\/([A-Za-z0-9_-]{11})/)??t.match(/[?&]v=([A-Za-z0-9_-]{11})/)??t.match(/youtube\.com\/(?:embed|shorts)\/([A-Za-z0-9_-]{11})/);return r?`https://www.youtube.com/embed/${r[1]}?rel=0`:null}return null}function Ae(e){let t=e.trim();if(!t)return null;let n=$e(t);if(n==="matterport"){let r=new URL(t).searchParams.get("m");return r!==null&&/^[A-Za-z0-9]+$/.test(r)?`https://my.matterport.com/show/?m=${r}&nt=1`:null}return n==="biganto"?t:null}var V=e=>e<0?0:e>1?1:e;function F(e){if(typeof e!="object"||e===null)return null;let{nx:t=0,ny:n=0,nw:r=1,nh:o=1}=e;if(![t,n,r,o].every(a=>typeof a=="number"&&Number.isFinite(a)))return null;let l=V(t),u=V(n),d={nx:l,ny:u,nw:Math.min(V(r),1-l),nh:Math.min(V(o),1-u)};return d.nw<=0||d.nh<=0||d.nx===0&&d.ny===0&&d.nw===1&&d.nh===1?null:d}var z={file(e){return typeof e=="string"?{url:e,responsive:null}:{url:e.url,responsive:e.responsive}}};function yt(e){if(typeof e!="object"||e===null)return null;let t=e.asset_id;return typeof t=="string"&&t!==""?t:null}function gt(e,t,n){if(e.file===null)return null;let r=n.crop===void 0?null:F(t.rect),o=n.crop===void 0?null:F(t.mobile_rect),l=n.file(e.file),u=r===null?{photo_id:e.id,url:l.url,alt:e.alt,responsive:l.responsive}:{photo_id:e.id,url:n.crop(e.file,r),alt:e.alt,responsive:null,rect:r};return o!==null&&(u.mobile={url:n.crop(e.file,o),responsive:null}),u}function He(e,t){if(e.posterFile!==void 0){let n=t.file(e.posterFile);return n.responsive===null?{poster:n.url}:{poster:n.url,poster_responsive:n.responsive}}return{poster:e.posterUrl??""}}function ht(e,t){let n=He(e,t);return e.file===null?{video_id:e.id,url:Ce(e.url??"")??"",...n,alt:e.alt,source:"link",...e.provider===null?{}:{provider:e.provider}}:{video_id:e.id,url:t.file(e.file).url,...n,alt:e.alt,source:"upload"}}function _t(e,t){return{tour_id:e.id,url:Ae(e.url??"")??"",...He(e,t),alt:e.alt,...e.provider===null?{}:{provider:e.provider}}}function bt(e,t){return e.file===null?null:{asset_id:e.id,url:t.file(e.file).url,filename:e.filename,content_type:e.mime,size_bytes:0}}function vt(e,t,n,r){let o=yt(t),l=o===null?void 0:n.get(o);if(l===void 0||l.kind!==e)return null;switch(e){case"image":return gt(l,t,r);case"video":return ht(l,r);case"tour":return _t(l,r);case"document":return bt(l,r);default:return null}}var wt=new Set(["image","video","tour","document"]),xt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Rt(e,t,n){let r=typeof e.id=="string"?e.id:"",o=typeof e.floor_label=="string"?e.floor_label:null,l=r===""?void 0:t.get(r),u=l?.kind==="image"&&l.file!==null?n.file(l.file):null;return{id:r,...typeof e.upload_id=="string"?{upload_id:e.upload_id}:{},url:u?.url??"",alt:o??"Floor plan",floor_label:o,position:typeof e.position=="number"?e.position:0,...u?.responsive?{responsive:u.responsive}:{}}}function St(e,t,n,r){return e.type==="image"&&Array.isArray(t)?t.filter(xt).map(o=>Rt(o,n,r)):re(e,t,n,r)}function re(e,t,n,r){if(t==null)return t;if(wt.has(e.type))return vt(e.type,t,n,r);if(e.type!=="list"||!Array.isArray(t))return t;let o=t;if(e.fields!==void 0){let l=e.fields;return o.map(u=>{if(typeof u!="object"||u===null)return u;let d={...u};for(let[a,h]of Object.entries(l))d[a]=St(h,d[a],n,r);return d})}if(e.element!==void 0){let l=e.element;return o.map(u=>re(l,u,n,r))}return o}function Ne(e,t,n,r=z){let o={};for(let[l,u]of Object.entries(e.slots)){let d=t.schema.slots[l];o[l]=d===void 0?u:re(d,u,n,r)}return o}function Oe(e){return typeof e=="string"?e:e.url}function kt(e,t){return e.split(",").map(n=>{let[r="",...o]=n.trim().split(/\s+/);return[t(r),...o].join(" ")}).join(", ")}function It(e){return{file(t){let n=z.file(t),r=n.responsive===null?null:{...n.responsive,sources:n.responsive.sources.map(o=>({...o,srcset:kt(o.srcset,e)}))};return{url:e(n.url),responsive:r}},crop(t,n){return e(z.file(t).url,{crop:n})}}}function A(e){return Array.isArray(e)?e:[]}function Me(e,t){let{facts:n}=e,r=a=>e.media[a],o=a=>a?.file===null||a?.file===void 0?"":t(Oe(a.file)),l=a=>a?.posterFile!==void 0?t(Oe(a.posterFile)):a?.posterUrl??"",u=[];for(let a of A(n.photos)){let h=r(a.id);u.push({id:a.id,kind:"photo",name:h?.filename||a.id,size:"",src:o(h),caption:a.caption??null})}for(let a of A(n.floor_plans)){let h=r(a.id);u.push({id:a.id,kind:"plan",name:h?.filename||a.id,size:"",src:o(h)})}for(let a of A(n.videos)){let h=a.provider??void 0;u.push({id:a.id,kind:"video",name:a.caption??r(a.id)?.filename??a.id,size:"",src:l(r(a.id)),caption:a.caption??null,ready:!0,durationMs:a.duration_ms??null,...h===void 0?{}:{provider:h}})}for(let a of A(n.tours))u.push({id:a.id,kind:"tour",name:`${a.provider??"Tour"} ${a.id}`,size:"",src:l(r(a.id)),ready:!0,provider:a.provider??""});for(let a of A(n.documents)){let h=r(a.id)?.sizeBytes;u.push({id:a.id,kind:"document",name:a.filename??a.id,size:"",src:"",mime:a.mime??"",...h===void 0?{}:{sizeBytes:h}})}let d=[["avatar_upload_id","headshot"],["logo_dark_upload_id","logo (dark)"],["logo_light_upload_id","logo (light)"]];for(let a of A(n.contacts)){let h=typeof a.name=="string"?a.name:"Contact";for(let[v,E]of d){let S=a[v];typeof S=="string"&&u.push({id:S,kind:"library",name:`${h} \u2014 ${E}`,size:"",src:o(r(S)),caption:h})}}return u}var Pt={image:["photo_id","asset_id"],video:["video_id","asset_id"],tour:["tour_id","asset_id"],document:["asset_id"]};function Et(e){return e.filter(t=>typeof t=="object"&&t!==null&&!Array.isArray(t)).map(({id:t,upload_id:n,floor_label:r,position:o})=>({id:typeof t=="string"?t:"",...typeof n=="string"?{upload_id:n}:{},floor_label:typeof r=="string"?r:null,position:typeof o=="number"?o:0}))}function oe(e,t){if(t==null)return t;let n=Pt[e.type];if(n!==void 0){if(typeof t!="object")return null;let o=t,l=n.map(a=>o[a]).find(a=>typeof a=="string"&&a!=="");if(typeof l!="string")return null;if(e.type!=="image")return{asset_id:l};let u=F(o.rect),d=typeof o.mobile=="object"&&o.mobile!==null?F(o.mobile.rect):null;return{asset_id:l,...u===null?{}:{rect:u},...d===null?{}:{mobile_rect:d}}}if(e.type!=="list"||!Array.isArray(t))return t;let r=t;if(e.fields!==void 0){let o=e.fields;return r.map(l=>{if(typeof l!="object"||l===null)return l;let u={...l};for(let[d,a]of Object.entries(o))d in u&&(u[d]=a.type==="image"&&Array.isArray(u[d])?Et(u[d]):oe(a,u[d]));return u})}if(e.element!==void 0){let o=e.element;return r.map(l=>oe(o,l))}return r}function De(e){let{instance:t,slots:n,fixture:r,session:o,assetUrl:l}=e,u={...t.slots},d={},a=r.provenance[t.instance_id]??{};for(let v of Object.keys(n))d[v]=a[v]??{kind:"empty"};for(let[v,E]of Object.entries(o??{})){let S=n[v];S!==void 0&&(u[v]=oe(S,E),d[v]={kind:"session"})}let h=new Map(Object.entries(r.media));return{slots:Ne({...t,slots:u},{schema:{slots:n}},h,It(l)),provenance:d}}var Fe=1024*1024;function $t(e){let t=N(e),n=typeof e.width=="string"?`${e.width} \xD7 ${String(e.height)}`:void 0;return{id:e.id,label:e.label,cssWidth:t.viewportWidth,cssHeight:t.viewportHeight,bleed:t.bleed,pixelWidth:t.pixelWidth,pixelHeight:t.pixelHeight,...n===void 0?{}:{physical:n},tokens:{...O(e)}}}function Ct(e,t){return new Response(t,{status:e,headers:{"content-type":"text/plain; charset=utf-8"}})}function ie(e){return new Response(JSON.stringify(e),{headers:{"content-type":"application/json; charset=utf-8"}})}function ae(e){return new Response(e,{headers:{"content-type":"text/html; charset=utf-8"}})}function At(e){if(typeof e!="object"||e===null)return null;let t=e.status;return typeof t=="number"&&Number.isInteger(t)&&t>=400&&t<600?t:null}function U(e,t,n){let r=e.searchParams.get(t);if(r===null||r==="")throw new y(400,`${n} needs a ${t} parameter.`);return r}function Ht(e){return`<script>
116
+ </script>`;function ye(){let e={};return new Proxy(e,{get:(t,n)=>typeof n!="string"||n in e||n==="then"||n==="toJSON"?e[n]:`#${n}`})}function ge(e){let t=new URLSearchParams;for(let[r,o]of Object.entries(e))o!=null&&o!==""&&t.set(r,o);let n=t.toString();return n===""?"":`?${n}`}var T={catalog:"api/catalog",render:"api/render",media:e=>`api/media${ge({fixture:e})}`,capture:(e,t)=>`api/capture/${e}${ge({fixture:t.fixture,format:t.format,page:t.page,canvas:t.canvas})}`,live:(e,t)=>`fixtures/${encodeURIComponent(e)}/live${t==="/"?"/":`${t}/`}`,hmr:"__hmr"};var y=class extends Error{constructor(n,r){super(r);this.status=n}status};function it(e){return e.split("-").map(t=>t&&t[0].toUpperCase()+t.slice(1)).join(" ")}function he(e){let{variant:t}=e;return{required:e.required,variant:t===null?null:{cases:t.cases.map(n=>({value:n,label:it(n)})),locked:t.locked}}}function _e(e){return Object.fromEntries(e.map(t=>[t.instance_id,{enabled:t.enabled,...t.variant===void 0?{}:{variant:t.variant}}]))}function be(e){if(e==null)return{};if(typeof e!="object"||Array.isArray(e))throw new y(400,"A render request's display is an object keyed by instance id.");let t={};for(let[n,r]of Object.entries(e)){if(typeof r!="object"||r===null||Array.isArray(r))throw new y(400,`The display state of "${n}" is not an object.`);let{enabled:o,variant:c}=r;if(o!==void 0&&typeof o!="boolean")throw new y(400,`The display state of "${n}" has a non-boolean enabled.`);if(c!==void 0&&typeof c!="string")throw new y(400,`The display state of "${n}" has a non-string variant.`);t[n]={...o===void 0?{}:{enabled:o},...c===void 0?{}:{variant:c}}}return t}function we(e,t){for(let[n,r]of Object.entries(t)){let o=e.instances.find(p=>p.instanceId===n);if(o===void 0)throw new y(400,`The composition places no instance "${n}".`);if(r.enabled===!1&&o.display.required)throw new y(400,`Section instance "${n}" is required and cannot be hidden.`);if(r.variant===void 0)continue;let c=o.display.variant;if(c===null)throw new y(400,`Section instance "${n}" declares no display variant.`);if(c.locked)throw new y(400,`Section instance "${n}" declares a locked variant, which the user cannot switch.`);if(!c.cases.includes(r.variant))throw new y(400,`"${r.variant}" is not a declared case of section instance "${n}" (declared: ${c.cases.join(", ")}).`)}}function ve(e,t){return new Map(e.instances.map(n=>[n.instance_id,t[n.instance_id]?.enabled??n.enabled]))}function xe(e,t,n){let r=n[e.instance_id]?.variant;if(r===void 0||r===e.variant)return e;let o={...e.slots};for(let[c,p]of Object.entries(t))c in o||(p.variant===void 0||p.variant.cases.includes(r))&&(o[c]=p.type==="list"?[]:null);return{...e,variant:r,slots:o}}function Re(e){return Array.isArray(e)?e.length:0}function Se(e){return typeof e=="string"&&e!==""?e:null}function st(e){return{propertyType:Se(e.property_type),listingIntent:Se(e.listing_intent),units:Re(e.units),photos:Re(e.photos)}}function lt(e){let t=JSON.stringify(e),n=3735928559,r=1103547991;for(let o=0;o<t.length;o++){let c=t.charCodeAt(o);n=Math.imul(n^c,2654435761),r=Math.imul(r^c,1597334677)}return n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(16).padStart(14,"0")}function Ie(e){return{id:e.id,label:e.label,summary:st(e.facts),doc:lt(e.instances),display:_e(e.instances)}}function ke(e,t){let n=e.replace(/\/+$/,"");return t==="/"?`${n}/`:`${n}${t}/`}function Pe(e){let{pages:t,currentPageId:n,basePath:r}=e,o=t.find(d=>d.id===n);if(!o)throw new Error(`nav: page "${n}" is not one of the declared pages (${t.map(d=>d.id).join(", ")}).`);let c=[o,...t.filter(d=>d.id!==o.id&&d.enabled!==!1)],p={};for(let d of c)for(let i of d.sections)i.enabled===!1||i.key in p||(p[i.key]=d.id===o.id?`#${i.anchor}`:`${ke(r,d.path)}#${i.anchor}`);return{anchors:p,pages:t.filter(d=>d.enabled!==!1).map(d=>({id:d.id,label:d.label,href:ke(r,d.path),current:d.id===o.id}))}}function W(e,t){return e.pages?.[t]?.enabled!==!1}function te(e,t){return t.filter(n=>W(e,n.id))}var D={base:"stylesheets/base.css",template:"stylesheets/template.css"},I={frame:"__capture/frame",print:"__capture/print"};function Ee(e){return new URLSearchParams(e).toString()}function ne(e,t,n){return`${I.frame}?${Ee({fixture:e,page:t,format:n})}`}function Te(e,t){return`${I.print}?${Ee({fixture:e,format:t})}`}var dt=["text","number","select","image","list","poi","url","video","tour","document"],ct=[],hn=[...dt,...ct];var ut=["address","type","intent","describe","uploads","units","comparables","contacts"];var pt={address:"always",type:"always",intent:"always",describe:"always",uploads:"always",units:"derived",comparables:"derived",contacts:"derived"},_n=ut.filter(e=>pt[e]==="always");var mt={matterport:{kind:"tour",label:"Matterport",pattern:/(^|\.)matterport\.com$/i,strategy:"api"},biganto:{kind:"tour",label:"Biganto",pattern:/(^|\.)biganto\.com$/i,strategy:"opengraph"},youtube:{kind:"video",label:"YouTube",pattern:/(^|\.)(youtube\.com|youtu\.be)$/i,strategy:"oembed"},vimeo:{kind:"video",label:"Vimeo",pattern:/(^|\.)vimeo\.com$/i,strategy:"oembed"},zillow:{kind:"listing",label:"Zillow",pattern:/(^|\.)zillow\.com$/i,strategy:"none"},redfin:{kind:"listing",label:"Redfin",pattern:/(^|\.)redfin\.com$/i,strategy:"none"},dropbox:{kind:"file",label:"Dropbox",pattern:/(^|\.)dropbox\.com$/i,strategy:"none"},drive:{kind:"file",label:"Google Drive",pattern:/^drive\.google\.com$/i,strategy:"none"},maps:{kind:"map",label:"Google Maps",pattern:/(^|\.)google\.com$/i,path:/^\/maps(\/|$)/i,strategy:"none"}};function $e(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!=="http:"&&t.protocol!=="https:")return null;for(let[n,r]of Object.entries(mt))if(r.pattern.test(t.hostname)&&!(r.path&&!r.path.test(t.pathname)))return n;return null}var ft="badge=0&autopause=0&player_id=0&title=0&byline=0&portrait=0&sidedock=0&vimeo_logo=0&pip=0&chromecast=0&quality_selector=0&progress_bar=1";function Ce(e){let t=e.trim();if(!t)return null;let n=$e(t);if(n==="vimeo"){let r=t.match(/vimeo\.com\/(?:.*\/)?(\d+)/);return r?`https://player.vimeo.com/video/${r[1]}?${ft}`:null}if(n==="youtube"){let r=t.match(/youtu\.be\/([A-Za-z0-9_-]{11})/)??t.match(/[?&]v=([A-Za-z0-9_-]{11})/)??t.match(/youtube\.com\/(?:embed|shorts)\/([A-Za-z0-9_-]{11})/);return r?`https://www.youtube.com/embed/${r[1]}?rel=0`:null}return null}function Ae(e){let t=e.trim();if(!t)return null;let n=$e(t);if(n==="matterport"){let r=new URL(t).searchParams.get("m");return r!==null&&/^[A-Za-z0-9]+$/.test(r)?`https://my.matterport.com/show/?m=${r}&nt=1`:null}return n==="biganto"?t:null}var V=e=>e<0?0:e>1?1:e;function F(e){if(typeof e!="object"||e===null)return null;let{nx:t=0,ny:n=0,nw:r=1,nh:o=1}=e;if(![t,n,r,o].every(i=>typeof i=="number"&&Number.isFinite(i)))return null;let c=V(t),p=V(n),d={nx:c,ny:p,nw:Math.min(V(r),1-c),nh:Math.min(V(o),1-p)};return d.nw<=0||d.nh<=0||d.nx===0&&d.ny===0&&d.nw===1&&d.nh===1?null:d}var z={file(e){return typeof e=="string"?{url:e,responsive:null}:{url:e.url,responsive:e.responsive}}};function yt(e,t){if(typeof t!="object"||t===null)return null;let{asset_id:n,photo_id:r}=t;return typeof n=="string"&&n!==""?n:e==="image"&&typeof r=="string"&&r!==""?r:null}function gt(e,t,n){if(e.file===null)return null;let r=n.crop===void 0?null:F(t.rect),o=n.crop===void 0?null:F(t.mobile_rect),c=n.file(e.file),p=r===null?{photo_id:e.id,url:c.url,alt:e.alt,responsive:c.responsive}:{photo_id:e.id,url:n.crop(e.file,r),alt:e.alt,responsive:null,rect:r};if(o!==null&&(p.mobile={url:n.crop(e.file,o),responsive:null}),"floor_label"in t){let d=typeof t.floor_label=="string"?t.floor_label:null;p.floor_label=d,p.alt===""&&(p.alt=d??"Floor plan")}return p}function He(e,t){if(e.posterFile!==void 0){let n=t.file(e.posterFile);return n.responsive===null?{poster:n.url}:{poster:n.url,poster_responsive:n.responsive}}return{poster:e.posterUrl??""}}function ht(e,t){let n=He(e,t);return e.file===null?{video_id:e.id,url:Ce(e.url??"")??"",...n,alt:e.alt,source:"link",...e.provider===null?{}:{provider:e.provider}}:{video_id:e.id,url:t.file(e.file).url,...n,alt:e.alt,source:"upload"}}function _t(e,t){return{tour_id:e.id,url:Ae(e.url??"")??"",...He(e,t),alt:e.alt,...e.provider===null?{}:{provider:e.provider}}}function bt(e,t){return e.file===null?null:{asset_id:e.id,url:t.file(e.file).url,filename:e.filename,content_type:e.mime,size_bytes:0}}function wt(e,t,n,r){let o=yt(e,t),c=o===null?void 0:n.get(o);if(c===void 0||c.kind!==e)return null;switch(e){case"image":return gt(c,t,r);case"video":return ht(c,r);case"tour":return _t(c,r);case"document":return bt(c,r);default:return null}}var vt=new Set(["image","video","tour","document"]);function re(e,t,n,r){if(t==null)return t;if(vt.has(e.type))return wt(e.type,t,n,r);if(e.type!=="list"||!Array.isArray(t))return t;let o=t;if(e.fields!==void 0){let c=e.fields;return o.map(p=>{if(typeof p!="object"||p===null)return p;let d={...p};for(let[i,h]of Object.entries(c))d[i]=re(h,d[i],n,r);return d})}if(e.element!==void 0){let c=e.element;return o.map(p=>re(c,p,n,r))}return o}function Oe(e,t,n,r=z){let o={};for(let[c,p]of Object.entries(e.slots)){let d=t.schema.slots[c];o[c]=d===void 0?p:re(d,p,n,r)}return o}function Ne(e){return typeof e=="string"?e:e.url}function xt(e,t){return e.split(",").map(n=>{let[r="",...o]=n.trim().split(/\s+/);return[t(r),...o].join(" ")}).join(", ")}function Rt(e){return{file(t){let n=z.file(t),r=n.responsive===null?null:{...n.responsive,sources:n.responsive.sources.map(o=>({...o,srcset:xt(o.srcset,e)}))};return{url:e(n.url),responsive:r}},crop(t,n){return e(z.file(t).url,{crop:n})}}}function A(e){return Array.isArray(e)?e:[]}function Me(e,t){let{facts:n}=e,r=i=>e.media[i],o=i=>i?.file===null||i?.file===void 0?"":t(Ne(i.file)),c=i=>i?.posterFile!==void 0?t(Ne(i.posterFile)):i?.posterUrl??"",p=[];for(let i of A(n.photos)){let h=r(i.id);p.push({id:i.id,kind:"photo",name:h?.filename||i.id,size:"",src:o(h),caption:i.caption??null})}for(let i of A(n.floor_plans)){let h=r(i.id);p.push({id:i.id,kind:"plan",name:h?.filename||i.id,size:"",src:o(h)})}for(let i of A(n.videos)){let h=i.provider??void 0;p.push({id:i.id,kind:"video",name:i.caption??r(i.id)?.filename??i.id,size:"",src:c(r(i.id)),caption:i.caption??null,ready:!0,durationMs:i.duration_ms??null,...h===void 0?{}:{provider:h}})}for(let i of A(n.tours))p.push({id:i.id,kind:"tour",name:`${i.provider??"Tour"} ${i.id}`,size:"",src:c(r(i.id)),ready:!0,provider:i.provider??""});for(let i of A(n.documents)){let h=r(i.id)?.sizeBytes;p.push({id:i.id,kind:"document",name:i.filename??i.id,size:"",src:"",mime:i.mime??"",...h===void 0?{}:{sizeBytes:h}})}let d=[["avatar_upload_id","headshot"],["logo_dark_upload_id","logo (dark)"],["logo_light_upload_id","logo (light)"]];for(let i of A(n.contacts)){let h=typeof i.name=="string"?i.name:"Contact";for(let[w,E]of d){let S=i[w];typeof S=="string"&&p.push({id:S,kind:"library",name:`${h} \u2014 ${E}`,size:"",src:o(r(S)),caption:h})}}return p}var St={image:["photo_id","asset_id"],video:["video_id","asset_id"],tour:["tour_id","asset_id"],document:["asset_id"]};function oe(e,t){if(t==null)return t;let n=St[e.type];if(n!==void 0){if(typeof t!="object")return null;let o=t,c=n.map(h=>o[h]).find(h=>typeof h=="string"&&h!=="");if(typeof c!="string")return null;if(e.type!=="image")return{asset_id:c};let p=F(o.rect),d=typeof o.mobile=="object"&&o.mobile!==null?F(o.mobile.rect):null,i="floor_label"in o?{floor_label:typeof o.floor_label=="string"?o.floor_label:null}:{};return{asset_id:c,...p===null?{}:{rect:p},...d===null?{}:{mobile_rect:d},...i}}if(e.type!=="list"||!Array.isArray(t))return t;let r=t;if(e.fields!==void 0){let o=e.fields;return r.map(c=>{if(typeof c!="object"||c===null)return c;let p={...c};for(let[d,i]of Object.entries(o))d in p&&(p[d]=oe(i,p[d]));return p})}if(e.element!==void 0){let o=e.element;return r.map(c=>oe(o,c))}return r}function De(e){let{instance:t,slots:n,fixture:r,session:o,assetUrl:c}=e,p={...t.slots},d={},i=r.provenance[t.instance_id]??{};for(let w of Object.keys(n))d[w]=i[w]??{kind:"empty"};for(let[w,E]of Object.entries(o??{})){let S=n[w];S!==void 0&&(p[w]=oe(S,E),d[w]={kind:"session"})}let h=new Map(Object.entries(r.media));return{slots:Oe({...t,slots:p},{schema:{slots:n}},h,Rt(c)),provenance:d}}var Fe=1024*1024;function kt(e){let t=O(e),n=typeof e.width=="string"?`${e.width} \xD7 ${String(e.height)}`:void 0;return{id:e.id,label:e.label,cssWidth:t.viewportWidth,cssHeight:t.viewportHeight,bleed:t.bleed,pixelWidth:t.pixelWidth,pixelHeight:t.pixelHeight,...n===void 0?{}:{physical:n},tokens:{...N(e)}}}function Pt(e,t){return new Response(t,{status:e,headers:{"content-type":"text/plain; charset=utf-8"}})}function ae(e){return new Response(JSON.stringify(e),{headers:{"content-type":"application/json; charset=utf-8"}})}function ie(e){return new Response(e,{headers:{"content-type":"text/html; charset=utf-8"}})}function Et(e){if(typeof e!="object"||e===null)return null;let t=e.status;return typeof t=="number"&&Number.isInteger(t)&&t>=400&&t<600?t:null}function U(e,t,n){let r=e.searchParams.get(t);if(r===null||r==="")throw new y(400,`${n} needs a ${t} parameter.`);return r}function Tt(e){return`<script>
117
117
  (function () {
118
118
  try {
119
119
  var src = new EventSource(${JSON.stringify(e)});
@@ -122,6 +122,6 @@ ${e.body}
122
122
  });
123
123
  } catch (e) { /* no change channel; the page stays as it is */ }
124
124
  })();
125
- </script>`}function Nt(e){if(e===T.catalog||e==="api/media"||e.startsWith("api/capture/")||e===k.frame||e===k.print)return!0;let[t,n,r]=e.split("/").filter(Boolean);return t==="fixtures"&&n!==void 0&&r==="live"}function Un(e){let{reader:t,assetUrl:n,renderer:r}=e,o=(e.base??"/").endsWith("/")?e.base??"/":`${e.base??"/"}/`,l=p=>/^([a-z][a-z0-9+.-]*:|\/)/i.test(p)?p:`${o}${p}`,u=()=>[D.base,D.template].map(p=>l(n(p)));async function d(p){let{fixtures:s}=await t.fixtures(),i=s.find(c=>c.id===p);if(i===void 0){let c=s.map(f=>f.id).join(", ")||"none";throw new y(404,`There is no fixture "${p}" (have: ${c}).`)}return i}function a(p,s){let i=p.instances.find(c=>c.instance_id===s);if(i===void 0)throw new y(400,`The composition places no instance "${s}".`);return i}function h(p,s,i,c,f){if(p.output!=="website")return{selfAnchor:c,anchors:ye(),pages:[]};let m=we(s,f),_=p.pages.map(R=>({id:R.id,label:R.label,path:R.path??`/${R.id}`,sections:R.sections.map(I=>({key:I.section,anchor:I.section,enabled:m.get(I.instanceId)!==!1}))})),b=`${o}${T.live(s.id,"/").replace(/\/$/,"")}`,w=Pe({pages:_,currentPageId:i,basePath:b});return{selfAnchor:c,anchors:w.anchors,pages:w.pages}}async function v(p,s,i,c,f,m){let _=p.instances.find(X=>X.instanceId===c.instance_id);if(_===void 0)throw new Error(`The composition places no section "${c.section_key}".`);let b=xe(c,_.sectionSchema.slots,m),{slots:w,provenance:R}=De({instance:b,slots:_.sectionSchema.slots,fixture:s,session:f,assetUrl:n}),I=h(p,s,i,b.section_key,m),x=b.variant,H=await r.section(b.section_key);return{html:r.renderToString(r.createElement(H,{slots:w,nav:I,variant:x??""}),{identifierPrefix:b.instance_id}),resolvedProps:{slots:w,nav:I,variant:x},provenance:R}}async function E(p,s,i){let c=[];for(let f of i.sections){let m=a(s,f.instanceId);m.enabled&&c.push((await v(p,s,i.id,m,void 0,{})).html)}return c}function S(p,s,i){let c=p.pages.find(f=>f.id===s);if(c===void 0)throw new y(i,`The template declares no page "${s}".`);return c}function G(p,s){if(p.output==="website")throw new y(404,`"${p.key}" is a website \u2014 captures are for rendered templates; open its pages live instead.`);let i=s===null?p.formats[0]:p.formats.find(c=>c.id===s);if(i===void 0)throw new y(404,`The template declares no format "${s??""}" (have: ${p.formats.map(c=>c.id).join(", ")}).`);return i}async function Ue(){let p=await t.islands(),s={wire:1,islands:{map:{...p.map},hostScript:p.canvasHost,importMap:{...p.importMap}},stylesheets:[D.base,D.template].map(m=>n(m))},i,c;try{i=await t.template(),c=await t.fixtures()}catch(m){return{...s,template:{key:"",name:"",output:"website",formats:[],pages:[],canvases:[],instances:[]},fixtures:[],capabilities:{hmr:t.live,capture:!1},error:m instanceof Error?m.message:String(m)}}let f=c.problems!==void 0&&c.fixtures.length===0?`No fixture could be rendered:
126
- ${c.problems}`:void 0;return{...s,template:{key:i.key,name:i.name,output:i.output,formats:i.output==="website"?[]:i.formats.map($t),pages:i.pages.map(m=>({id:m.id,label:m.label,...m.path===void 0?{}:{path:m.path},instanceIds:m.sections.map(_=>_.instanceId)})),canvases:i.canvases.map(m=>({id:m.id,label:m.label,pages:[...m.pages]})),instances:i.instances.map(m=>({...m,display:he(m.display)}))},fixtures:c.fixtures.map(ke),capabilities:{hmr:t.live,capture:i.output!=="website"&&t.capture!==void 0},...f===void 0?{}:{error:f}}}async function Le(p){if(p.method!=="POST")throw new y(405,`POST a render request to ${T.render}.`);let s=await p.text();if(new TextEncoder().encode(s).byteLength>Fe)throw new y(413,`request body exceeds ${Fe} bytes`);let i;try{i=s===""?void 0:JSON.parse(s)}catch(w){throw new y(400,`request body is not JSON: ${w instanceof Error?w.message:String(w)}`)}if(i===void 0||typeof i.page!="string"||typeof i.instance!="string"||typeof i.fixture!="string")throw new y(400,"A render request names a page, an instance and a fixture.");let c=typeof i.session=="object"&&i.session!==null?i.session:{},f=be(i.display),m=await t.template(),_=await d(i.fixture),b=S(m,i.page,400);return ve(m,f),v(m,_,b.id,a(_,i.instance),c.slots,f)}async function je(p){let s=await d(U(p,"fixture","api/media"));return{items:Me(s,n)}}async function qe(p,s){let i=await t.template();if(i.output!=="website")throw new y(404,`"${i.key}" is a rendered ${i.output} template and has no live pages \u2014 preview it on the canvas.`);let c=i.pages.find(_=>_.path===s);if(c===void 0){let _=i.pages.map(b=>b.path??b.id).join(", ");throw new y(404,`The template declares no page at "${s}" (have: ${_}).`)}let f=await d(p),m=await E(i,f,c);return C({destination:"preview",root:{kind:"plain",bodyHtml:m.join(`
127
- `)},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:u()},title:`${i.name} - ${c.label}`,extraCss:["html, body { background: #fff; }"],...t.live?{devScripts:[Ht(`${o}${T.hmr}`)]}:{}})}function se(p,s,i){let c=S(p,i,404);if(!W(s,c.id))throw new y(404,`The fixture "${s.id}" switches the page "${c.id}" off, so it has no capture.`);return c}async function We(p){let s=k.frame,i=await t.template(),c=G(i,p.searchParams.get("format")),f=await d(U(p,"fixture",s)),m=se(i,f,U(p,"page",s));return C({destination:"artifact",root:{kind:"frame",format:c,sectionHtml:await E(i,f,m)},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:u()},title:`${i.name} \u2014 ${m.id}`})}async function Ve(p){let s=await t.template(),i=G(s,p.searchParams.get("format"));if(s.output!=="document")throw new y(404,`"${s.key}" is an ${s.output} template \u2014 a PDF is for the document class; download its pages as a zip.`);let c=await d(U(p,"fixture",k.print)),f=[];for(let m of te(c,s.pages))f.push(await E(s,c,m));if(f.length===0)throw new y(404,`The fixture "${c.id}" switches every page off, so it has no PDF.`);return C({destination:"artifact",root:{kind:"frameStack",format:i,pages:f},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:u()},title:`${s.name} \u2014 print`})}async function ze(p,s){let i=p;if(i!=="screenshot"&&i!=="bundle"&&i!=="print")throw new y(404,`There is no capture at ${s.pathname}.`);let c=U(s,"fixture",`api/capture/${i}`),f=await t.template(),m=G(f,s.searchParams.get("format")),_=await d(c),b,w,R;if(i==="screenshot"){let x=s.searchParams.get("page")??te(_,f.pages)[0]?.id;if(x===void 0)throw new y(404,`The fixture "${c}" leaves no page on.`);se(f,_,x),b={kind:i,fixture:c,format:m,documents:[{path:ne(c,x,m.id),page:x,name:`${x}.png`}]},w="image/png",R=`${f.key}-${x}-${m.id}.png`}else if(i==="bundle"){if(f.output!=="image")throw new y(404,`"${f.key}" is a ${f.output} template \u2014 the zip is for the image class; a document downloads its PDF.`);let x=s.searchParams.get("canvas"),H=x===null?f.canvases[0]:f.canvases.find(P=>P.id===x);if(H===void 0)throw new y(404,`The template declares no canvas "${x??""}".`);let B=H.pages.filter(P=>W(_,P));if(B.length===0)throw new y(404,`The fixture "${c}" switches every page of the canvas "${H.id}" off, so it has no zip.`);let X=B.map(P=>({path:ne(c,P,m.id),page:P,name:`${f.pages.find(Be=>Be.id===P)?.label||P}.png`}));b={kind:i,fixture:c,format:m,documents:X},w="application/zip",R=`${f.key}-${m.id}.zip`}else{if(f.output!=="document")throw new y(404,`"${f.key}" is an ${f.output} template \u2014 a PDF is for the document class; download its pages as a zip.`);b={kind:i,fixture:c,format:m,documents:[{path:Te(c,m.id),page:null,name:`${f.key}.pdf`}]},w="application/pdf",R=`${f.key}.pdf`}if(t.capture===void 0)throw new y(501,"This playground has no captures to give.");let I=await t.capture(b);return new Response(new Uint8Array(I),{headers:{"content-type":w,"content-disposition":`attachment; filename="${encodeURIComponent(R)}"`}})}async function Ge(p,s,i){if(i===T.render)return ie(await Le(p));if(p.method!=="GET"&&p.method!=="HEAD"&&Nt(i))throw new y(405,`${i} only reads; the playground accepts no uploads and writes nothing.`);if(i===T.catalog)return ie(await Ue());if(i==="api/media")return ie(await je(s));if(i.startsWith("api/capture/"))return ze(i.slice(12),s);if(i===k.frame)return ae(await We(s));if(i===k.print)return ae(await Ve(s));let[c,f,m,_,...b]=i.split("/").filter(Boolean);if(c==="fixtures"&&f!==void 0&&m==="live"){if(b.length>0)throw new y(404,`There is no route at ${s.pathname}.`);return ae(await qe(decodeURIComponent(f),_===void 0?"/":`/${decodeURIComponent(_)}`))}return null}return{async handle(p){let s=new URL(p.url);if(!s.pathname.startsWith(o)&&`${s.pathname}/`!==o)return null;let i=s.pathname.slice(o.length);try{return await Ge(p,s,i)}catch(c){let f=At(c);if(f===null)throw c;return Ct(f,c instanceof Error?c.message:String(c))}}}}export{Un as createHost};
125
+ </script>`}function $t(e){if(e===T.catalog||e==="api/media"||e.startsWith("api/capture/")||e===I.frame||e===I.print)return!0;let[t,n,r]=e.split("/").filter(Boolean);return t==="fixtures"&&n!==void 0&&r==="live"}function Nn(e){let{reader:t,assetUrl:n,renderer:r}=e,o=(e.base??"/").endsWith("/")?e.base??"/":`${e.base??"/"}/`,c=u=>/^([a-z][a-z0-9+.-]*:|\/)/i.test(u)?u:`${o}${u}`,p=()=>[D.base,D.template].map(u=>c(n(u)));async function d(u){let{fixtures:s}=await t.fixtures(),a=s.find(l=>l.id===u);if(a===void 0){let l=s.map(f=>f.id).join(", ")||"none";throw new y(404,`There is no fixture "${u}" (have: ${l}).`)}return a}function i(u,s){let a=u.instances.find(l=>l.instance_id===s);if(a===void 0)throw new y(400,`The composition places no instance "${s}".`);return a}function h(u,s,a,l,f){if(u.output!=="website")return{selfAnchor:l,anchors:ye(),pages:[]};let m=ve(s,f),_=u.pages.map(R=>({id:R.id,label:R.label,path:R.path??`/${R.id}`,sections:R.sections.map(k=>({key:k.section,anchor:k.section,enabled:m.get(k.instanceId)!==!1}))})),b=`${o}${T.live(s.id,"/").replace(/\/$/,"")}`,v=Pe({pages:_,currentPageId:a,basePath:b});return{selfAnchor:l,anchors:v.anchors,pages:v.pages}}async function w(u,s,a,l,f,m){let _=u.instances.find(X=>X.instanceId===l.instance_id);if(_===void 0)throw new Error(`The composition places no section "${l.section_key}".`);let b=xe(l,_.sectionSchema.slots,m),{slots:v,provenance:R}=De({instance:b,slots:_.sectionSchema.slots,fixture:s,session:f,assetUrl:n}),k=h(u,s,a,b.section_key,m),x=b.variant,H=await r.section(b.section_key);return{html:r.renderToString(r.createElement(H,{slots:v,nav:k,variant:x??""}),{identifierPrefix:b.instance_id}),resolvedProps:{slots:v,nav:k,variant:x},provenance:R}}async function E(u,s,a){let l=[];for(let f of a.sections){let m=i(s,f.instanceId);m.enabled&&l.push((await w(u,s,a.id,m,void 0,{})).html)}return l}function S(u,s,a){let l=u.pages.find(f=>f.id===s);if(l===void 0)throw new y(a,`The template declares no page "${s}".`);return l}function B(u,s){if(u.output==="website")throw new y(404,`"${u.key}" is a website \u2014 captures are for rendered templates; open its pages live instead.`);let a=s===null?u.formats[0]:u.formats.find(l=>l.id===s);if(a===void 0)throw new y(404,`The template declares no format "${s??""}" (have: ${u.formats.map(l=>l.id).join(", ")}).`);return a}async function Ue(){let u=await t.islands(),s={wire:1,islands:{map:{...u.map},hostScript:u.canvasHost,importMap:{...u.importMap}},stylesheets:[D.base,D.template].map(m=>n(m))},a,l;try{a=await t.template(),l=await t.fixtures()}catch(m){return{...s,template:{key:"",name:"",output:"website",formats:[],pages:[],canvases:[],instances:[]},fixtures:[],capabilities:{hmr:t.live,capture:!1},error:m instanceof Error?m.message:String(m)}}let f=l.problems!==void 0&&l.fixtures.length===0?`No fixture could be rendered:
126
+ ${l.problems}`:void 0;return{...s,template:{key:a.key,name:a.name,output:a.output,formats:a.output==="website"?[]:a.formats.map(kt),pages:a.pages.map(m=>({id:m.id,label:m.label,...m.path===void 0?{}:{path:m.path},instanceIds:m.sections.map(_=>_.instanceId)})),canvases:a.canvases.map(m=>({id:m.id,label:m.label,pages:[...m.pages]})),instances:a.instances.map(m=>({...m,display:he(m.display)}))},fixtures:l.fixtures.map(Ie),capabilities:{hmr:t.live,capture:a.output!=="website"&&t.capture!==void 0},...f===void 0?{}:{error:f}}}async function Le(u){if(u.method!=="POST")throw new y(405,`POST a render request to ${T.render}.`);let s=await u.text();if(new TextEncoder().encode(s).byteLength>Fe)throw new y(413,`request body exceeds ${Fe} bytes`);let a;try{a=s===""?void 0:JSON.parse(s)}catch(v){throw new y(400,`request body is not JSON: ${v instanceof Error?v.message:String(v)}`)}if(a===void 0||typeof a.page!="string"||typeof a.instance!="string"||typeof a.fixture!="string")throw new y(400,"A render request names a page, an instance and a fixture.");let l=typeof a.session=="object"&&a.session!==null?a.session:{},f=be(a.display),m=await t.template(),_=await d(a.fixture),b=S(m,a.page,400);return we(m,f),w(m,_,b.id,i(_,a.instance),l.slots,f)}async function je(u){let s=await d(U(u,"fixture","api/media"));return{items:Me(s,n)}}async function qe(u,s){let a=await t.template();if(a.output!=="website")throw new y(404,`"${a.key}" is a rendered ${a.output} template and has no live pages \u2014 preview it on the canvas.`);let l=a.pages.find(_=>_.path===s);if(l===void 0){let _=a.pages.map(b=>b.path??b.id).join(", ");throw new y(404,`The template declares no page at "${s}" (have: ${_}).`)}let f=await d(u),m=await E(a,f,l);return C({destination:"preview",root:{kind:"plain",bodyHtml:m.join(`
127
+ `)},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:p()},title:`${a.name} - ${l.label}`,extraCss:["html, body { background: #fff; }"],...t.live?{devScripts:[Tt(`${o}${T.hmr}`)]}:{}})}function se(u,s,a){let l=S(u,a,404);if(!W(s,l.id))throw new y(404,`The fixture "${s.id}" switches the page "${l.id}" off, so it has no capture.`);return l}async function We(u){let s=I.frame,a=await t.template(),l=B(a,u.searchParams.get("format")),f=await d(U(u,"fixture",s)),m=se(a,f,U(u,"page",s));return C({destination:"artifact",root:{kind:"frame",format:l,sectionHtml:await E(a,f,m)},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:p()},title:`${a.name} \u2014 ${m.id}`})}async function Ve(u){let s=await t.template(),a=B(s,u.searchParams.get("format"));if(s.output!=="document")throw new y(404,`"${s.key}" is an ${s.output} template \u2014 a PDF is for the document class; download its pages as a zip.`);let l=await d(U(u,"fixture",I.print)),f=[];for(let m of te(l,s.pages))f.push(await E(s,l,m));if(f.length===0)throw new y(404,`The fixture "${l.id}" switches every page off, so it has no PDF.`);return C({destination:"artifact",root:{kind:"frameStack",format:a,pages:f},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:p()},title:`${s.name} \u2014 print`})}async function ze(u,s){let a=u;if(a!=="screenshot"&&a!=="bundle"&&a!=="print")throw new y(404,`There is no capture at ${s.pathname}.`);let l=U(s,"fixture",`api/capture/${a}`),f=await t.template(),m=B(f,s.searchParams.get("format")),_=await d(l),b,v,R;if(a==="screenshot"){let x=s.searchParams.get("page")??te(_,f.pages)[0]?.id;if(x===void 0)throw new y(404,`The fixture "${l}" leaves no page on.`);se(f,_,x),b={kind:a,fixture:l,format:m,documents:[{path:ne(l,x,m.id),page:x,name:`${x}.png`}]},v="image/png",R=`${f.key}-${x}-${m.id}.png`}else if(a==="bundle"){if(f.output!=="image")throw new y(404,`"${f.key}" is a ${f.output} template \u2014 the zip is for the image class; a document downloads its PDF.`);let x=s.searchParams.get("canvas"),H=x===null?f.canvases[0]:f.canvases.find(P=>P.id===x);if(H===void 0)throw new y(404,`The template declares no canvas "${x??""}".`);let G=H.pages.filter(P=>W(_,P));if(G.length===0)throw new y(404,`The fixture "${l}" switches every page of the canvas "${H.id}" off, so it has no zip.`);let X=G.map(P=>({path:ne(l,P,m.id),page:P,name:`${f.pages.find(Ge=>Ge.id===P)?.label||P}.png`}));b={kind:a,fixture:l,format:m,documents:X},v="application/zip",R=`${f.key}-${m.id}.zip`}else{if(f.output!=="document")throw new y(404,`"${f.key}" is an ${f.output} template \u2014 a PDF is for the document class; download its pages as a zip.`);b={kind:a,fixture:l,format:m,documents:[{path:Te(l,m.id),page:null,name:`${f.key}.pdf`}]},v="application/pdf",R=`${f.key}.pdf`}if(t.capture===void 0)throw new y(501,"This playground has no captures to give.");let k=await t.capture(b);return new Response(new Uint8Array(k),{headers:{"content-type":v,"content-disposition":`attachment; filename="${encodeURIComponent(R)}"`}})}async function Be(u,s,a){if(a===T.render)return ae(await Le(u));if(u.method!=="GET"&&u.method!=="HEAD"&&$t(a))throw new y(405,`${a} only reads; the playground accepts no uploads and writes nothing.`);if(a===T.catalog)return ae(await Ue());if(a==="api/media")return ae(await je(s));if(a.startsWith("api/capture/"))return ze(a.slice(12),s);if(a===I.frame)return ie(await We(s));if(a===I.print)return ie(await Ve(s));let[l,f,m,_,...b]=a.split("/").filter(Boolean);if(l==="fixtures"&&f!==void 0&&m==="live"){if(b.length>0)throw new y(404,`There is no route at ${s.pathname}.`);return ie(await qe(decodeURIComponent(f),_===void 0?"/":`/${decodeURIComponent(_)}`))}return null}return{async handle(u){let s=new URL(u.url);if(!s.pathname.startsWith(o)&&`${s.pathname}/`!==o)return null;let a=s.pathname.slice(o.length);try{return await Be(u,s,a)}catch(l){let f=Et(l);if(f===null)throw l;return Pt(f,l instanceof Error?l.message:String(l))}}}}export{Nn as createHost};
@@ -96,4 +96,5 @@ declare module "*.pdf" {
96
96
  declare module "*.zip" {
97
97
  const src: string;
98
98
  export default src;
99
- }
99
+ }
100
+ declare module "*.css" {}
@@ -84,7 +84,7 @@ function renderStage(ctx) {
84
84
  proof.rowFields.set(slotId, seen);
85
85
  }
86
86
  const groupOf = /* @__PURE__ */ new Map();
87
- for (const group of schema.groups ?? []) for (const member of group.members.flatMap((row) => typeof row === "string" ? [row] : [...row])) groupOf.set(member, group.id);
87
+ for (const group of schema.groups ?? []) for (const member of group.members) groupOf.set(member, group.id);
88
88
  for (const [slotId, instances] of coverage.enclosingGroupsBySlot) {
89
89
  const group = groupOf.get(slotId);
90
90
  if (group !== void 0 && instances.some((groups) => !groups.has(group))) proof.escapedGroup.add(slotId);
@@ -59,7 +59,7 @@ function sectionsStage(ctx) {
59
59
  try {
60
60
  const parsed = SectionSchema.parse(materialized);
61
61
  parsed.slot_order = Object.keys(parsed.slots);
62
- for (const slot of Object.values(parsed.slots)) if (slot.type === "list" && slot.fields) slot.item_order = slot.layout ? slot.layout.flatMap((row) => typeof row === "string" ? [row] : [...row]) : Object.keys(slot.fields);
62
+ for (const slot of Object.values(parsed.slots)) if (slot.type === "list" && slot.fields) slot.item_order = Object.keys(slot.fields);
63
63
  const fillSpec = FillSpec.parse(fillSpecFromSchema(materialized));
64
64
  sections.push({
65
65
  key,
@@ -119,9 +119,8 @@ interface CanonicalComparable {
119
119
  beds: number | null;
120
120
  baths: number | null;
121
121
  sqft: number | null;
122
- photo_url: string | null;
123
- source_url: string | null;
124
- source_name: string | null;
122
+ /** The id of the comp's own photo upload — in no media pool; null when none was uploaded. */
123
+ photo_upload_id: string | null;
125
124
  /** The year the comparable was built. */
126
125
  year_built: number | null;
127
126
  /** Lot size in square feet. */
@@ -131,8 +130,6 @@ interface CanonicalComparable {
131
130
  units: number | null;
132
131
  /** Monthly HOA dues in dollars. */
133
132
  hoa_monthly: number | null;
134
- /** Live listings only; null on a closed sale. */
135
- days_on_market: number | null;
136
133
  /** The asking price in dollars, beside `price`. */
137
134
  list_price: number | null;
138
135
  /** ISO `YYYY-MM-DD` — when the listing went live, not when it closed. */
@@ -31,10 +31,11 @@ const servedMedia = { file(file) {
31
31
  responsive: file.responsive
32
32
  };
33
33
  } };
34
- function assetId(value) {
34
+ function refId(kind, value) {
35
35
  if (typeof value !== "object" || value === null) return null;
36
- const id = value.asset_id;
37
- return typeof id === "string" && id !== "" ? id : null;
36
+ const { asset_id: assetId, photo_id: photoId } = value;
37
+ if (typeof assetId === "string" && assetId !== "") return assetId;
38
+ return kind === "image" && typeof photoId === "string" && photoId !== "" ? photoId : null;
38
39
  }
39
40
  function imageValue(entry, ref, resolver) {
40
41
  if (entry.file === null) return null;
@@ -57,6 +58,11 @@ function imageValue(entry, ref, resolver) {
57
58
  url: resolver.crop(entry.file, mobileRect),
58
59
  responsive: null
59
60
  };
61
+ if ("floor_label" in ref) {
62
+ const floorLabel = typeof ref.floor_label === "string" ? ref.floor_label : null;
63
+ value.floor_label = floorLabel;
64
+ if (value.alt === "") value.alt = floorLabel ?? "Floor plan";
65
+ }
60
66
  return value;
61
67
  }
62
68
  function posterOf(entry, resolver) {
@@ -107,7 +113,7 @@ function documentValue(entry, resolver) {
107
113
  };
108
114
  }
109
115
  function renderMediaRef(kind, value, media, resolver) {
110
- const id = assetId(value);
116
+ const id = refId(kind, value);
111
117
  const entry = id === null ? void 0 : media.get(id);
112
118
  if (entry === void 0 || entry.kind !== kind) return null;
113
119
  switch (kind) {
@@ -124,26 +130,6 @@ const MEDIA_KINDS = /* @__PURE__ */ new Set([
124
130
  "tour",
125
131
  "document"
126
132
  ]);
127
- const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
128
- function floorPlanValue(ref, media, resolver) {
129
- const id = typeof ref.id === "string" ? ref.id : "";
130
- const floorLabel = typeof ref.floor_label === "string" ? ref.floor_label : null;
131
- const entry = id === "" ? void 0 : media.get(id);
132
- const served = entry?.kind === "image" && entry.file !== null ? resolver.file(entry.file) : null;
133
- return {
134
- id,
135
- ...typeof ref.upload_id === "string" ? { upload_id: ref.upload_id } : {},
136
- url: served?.url ?? "",
137
- alt: floorLabel ?? "Floor plan",
138
- floor_label: floorLabel,
139
- position: typeof ref.position === "number" ? ref.position : 0,
140
- ...served?.responsive ? { responsive: served.responsive } : {}
141
- };
142
- }
143
- function renderRowField(def, value, media, resolver) {
144
- if (def.type === "image" && Array.isArray(value)) return value.filter(isRecord).map((ref) => floorPlanValue(ref, media, resolver));
145
- return renderValue(def, value, media, resolver);
146
- }
147
133
  function renderValue(def, value, media, resolver) {
148
134
  if (value === null || value === void 0) return value;
149
135
  if (MEDIA_KINDS.has(def.type)) return renderMediaRef(def.type, value, media, resolver);
@@ -154,7 +140,7 @@ function renderValue(def, value, media, resolver) {
154
140
  return items.map((row) => {
155
141
  if (typeof row !== "object" || row === null) return row;
156
142
  const out = { ...row };
157
- for (const [field, fieldDef] of Object.entries(fields)) out[field] = renderRowField(fieldDef, out[field], media, resolver);
143
+ for (const [field, fieldDef] of Object.entries(fields)) out[field] = renderValue(fieldDef, out[field], media, resolver);
158
144
  return out;
159
145
  });
160
146
  }
@@ -1,4 +1,4 @@
1
- import { _ as PropertyFactsSchema } from "../packages/internal/property-facts/dist/property-facts-5pxZnlkh.js";
1
+ import { _ as PropertyFactsSchema } from "../packages/internal/property-facts/dist/property-facts-Cy7-O4p0.js";
2
2
  import "../packages/internal/property-facts/dist/index.js";
3
3
  import { basename, extname } from "node:path";
4
4
 
@@ -6,6 +6,9 @@ import { basename, extname } from "node:path";
6
6
  function contactImageId(contactId, field) {
7
7
  return `contact:${contactId}:${field}`;
8
8
  }
9
+ function comparableImageId(comparableId) {
10
+ return `comparable:${comparableId}:photo`;
11
+ }
9
12
  const MIME_BY_EXTENSION = {
10
13
  ".pdf": "application/pdf",
11
14
  ".mp4": "video/mp4",
@@ -173,25 +176,34 @@ function canonicalizeProperty(property, file) {
173
176
  logo_light_upload_id: image(logoLight, "logo_light")
174
177
  });
175
178
  }
179
+ const comparables = [];
180
+ for (const [i, comp] of (property.comparables ?? []).entries()) {
181
+ const { photo, ...row } = comp;
182
+ let photoId = null;
183
+ if (photo !== null && photo !== void 0 && admitFile(photo, `comparables[${i}].photo`)) {
184
+ photoId = comparableImageId(comp.id);
185
+ media.set(photoId, entry(photoId, "image", photo, comp.address));
186
+ }
187
+ comparables.push({
188
+ year_built: null,
189
+ lot_sqft: null,
190
+ stories: null,
191
+ units: null,
192
+ hoa_monthly: null,
193
+ list_price: null,
194
+ listed_date: null,
195
+ mls_number: null,
196
+ description: null,
197
+ property_type: null,
198
+ ...row,
199
+ photo_upload_id: photoId
200
+ });
201
+ }
176
202
  if (violations.length > 0) return {
177
203
  facts: null,
178
204
  media,
179
205
  violations
180
206
  };
181
- const comparables = (property.comparables ?? []).map((comp) => ({
182
- year_built: null,
183
- lot_sqft: null,
184
- stories: null,
185
- units: null,
186
- hoa_monthly: null,
187
- days_on_market: null,
188
- list_price: null,
189
- listed_date: null,
190
- mls_number: null,
191
- description: null,
192
- property_type: null,
193
- ...comp
194
- }));
195
207
  const candidate = {
196
208
  address: property.address,
197
209
  lat: property.lat,
@@ -239,4 +251,4 @@ function entry(id, kind, file, alt) {
239
251
  }
240
252
 
241
253
  //#endregion
242
- export { canonicalizeProperty, contactImageId, mediaUrl };
254
+ export { canonicalizeProperty, comparableImageId, contactImageId, mediaUrl };
@@ -1,9 +1,10 @@
1
+ import { COLLECTIONS } from "../packages/internal/template-contracts/dist/slot-catalog.js";
1
2
  import { getComputed } from "../schema/compute.js";
3
+ import { isSerializedSlotRef } from "../schema/slot-ref.js";
2
4
  import { buildReadGraph } from "../template/section-reads.js";
3
5
  import { readFact } from "../packages/internal/template-contracts/dist/facts-view.js";
4
- import { rowFieldSources } from "../packages/internal/source-resolution/dist/index.js";
5
6
  import { buildDeriveFactsView } from "../packages/internal/property-facts/dist/derive-facts-view.js";
6
- import { bakeDisplayEntries, bakePropertyRefSlots } from "../packages/internal/fill-bake/dist/bake-property-ref.js";
7
+ import { bakeDisplayEntries, bakePropertyRefSlots, projectComputedRows, rowComputesOf } from "../packages/internal/fill-bake/dist/bake-property-ref.js";
7
8
  import "../packages/internal/fill-bake/dist/index.js";
8
9
  import { canonicalizeProperty, contactImageId } from "./property.js";
9
10
  import { blankForField, canonicalizeRows } from "./rows.js";
@@ -96,6 +97,7 @@ function computeOrder(placements) {
96
97
  function valuesFor(reads, facts, settled, own) {
97
98
  return reads.map((ref) => {
98
99
  if (ref.kind === "fact") return readFact(facts, ref.key);
100
+ if (ref.kind === "row") return void 0;
99
101
  if (ref.section === own?.section) return own.slots[ref.slot];
100
102
  const from = settled.get(ref.section);
101
103
  if (from === void 0) return void 0;
@@ -111,7 +113,7 @@ function sameSectionOrder(sectionKey, declared) {
111
113
  const slot = declared.get(id);
112
114
  if (slot === void 0 || visited.has(id)) return;
113
115
  visited.add(id);
114
- for (const ref of slot.reads) if (ref.kind !== "fact" && ref.section === sectionKey) visit(ref.slot);
116
+ for (const ref of slot.reads) if (isSerializedSlotRef(ref) && ref.section === sectionKey) visit(ref.slot);
115
117
  ordered.push([id, slot]);
116
118
  };
117
119
  for (const id of declared.keys()) visit(id);
@@ -156,16 +158,37 @@ function resolveInstance(placement, entry, ctx) {
156
158
  const resolvedDisplay = bakeDisplayEntries({ display }, ctx.facts, bakeCtx);
157
159
  const computeFns = getComputed(schema);
158
160
  const factsView = buildDeriveFactsView(ctx.facts);
161
+ const values = entry?.values ?? {};
162
+ const slotPass = {
163
+ placement,
164
+ values,
165
+ baked,
166
+ computeFns,
167
+ factsView,
168
+ bakeCtx
169
+ };
170
+ let ungated;
159
171
  for (const [entryName, entryDef] of Object.entries(display)) {
160
172
  const reads = declaredReads(entryDef?.source);
161
173
  const transform = entryDef?.source?.transform;
162
174
  if (reads.length === 0 || typeof transform !== "string") continue;
163
- const answered = runDeclared(computeFns, transform, valuesFor(reads, factsView, ctx.settled));
175
+ let own;
176
+ if (reads.some((ref) => isSerializedSlotRef(ref) && ref.section === section.key)) {
177
+ ungated ??= buildSlots(slotPass, {
178
+ ...ctx,
179
+ violations: [],
180
+ log: void 0
181
+ }, null).slots;
182
+ own = {
183
+ section: section.key,
184
+ slots: ungated
185
+ };
186
+ }
187
+ const answered = runDeclared(computeFns, transform, valuesFor(reads, factsView, ctx.settled, own));
164
188
  const answer = typeof answered?.value === "string" ? answered.value : "";
165
189
  if (entryDef?.cases?.includes(answer) === true) resolvedDisplay[entryName] = answer;
166
190
  else delete resolvedDisplay[entryName];
167
191
  }
168
- const values = entry?.values ?? {};
169
192
  const visibility = resolvedDisplay.visibility ?? display.visibility?.cases?.[0];
170
193
  const enabled = typeof values.enabled === "boolean" ? values.enabled : visibility === void 0 ? true : visibility !== "hidden";
171
194
  const declaredCases = display.variant?.cases;
@@ -174,17 +197,37 @@ function resolveInstance(placement, entry, ctx) {
174
197
  if (declaredCases?.includes(values.variant) !== true) throw new Error(`Fixture "${ctx.fixtureId}" (${ctx.module}): content for "${placement.instance}" names variant "${values.variant}", which section "${section.key}" does not declare.`);
175
198
  variant = values.variant;
176
199
  }
200
+ const { slots, provenance } = buildSlots(slotPass, ctx, { variant });
201
+ return {
202
+ instance: {
203
+ instance_id: placement.instance,
204
+ section_key: section.key,
205
+ enabled,
206
+ ...variant === void 0 ? {} : { variant },
207
+ slots
208
+ },
209
+ provenance,
210
+ settled: {
211
+ slots,
212
+ visibility: resolvedDisplay.visibility ?? display.visibility?.cases?.[0],
213
+ variant
214
+ }
215
+ };
216
+ }
217
+ function buildSlots(pass, ctx, gate) {
218
+ const { placement, values, baked, computeFns, factsView, bakeCtx } = pass;
219
+ const section = placement.section;
177
220
  const slots = {};
178
221
  const provenance = {};
179
222
  const declared = /* @__PURE__ */ new Map();
180
- for (const [id, def] of Object.entries(schema.slots)) {
181
- const gate = def.variant?.cases;
182
- if (gate !== void 0 && (variant === void 0 || !gate.includes(variant))) continue;
223
+ for (const [id, def] of Object.entries(section.schema.slots)) {
224
+ const cases = def.variant?.cases;
225
+ if (gate !== null && cases !== void 0 && (gate.variant === void 0 || !cases.includes(gate.variant))) continue;
183
226
  const source = def.source;
184
227
  if (source?.kind === "direct" && typeof source.field === "string") {
185
228
  const rows = baked[id] ?? null;
186
229
  const fields = def.type === "list" ? def.fields : void 0;
187
- slots[id] = fields === void 0 ? rows : enrichedRows(fields, rows, values[id], {
230
+ slots[id] = fields === void 0 ? rows : enrichedRows(source.field, fields, rows, values[id], {
188
231
  ...ctx,
189
232
  instance: placement.instance,
190
233
  slot: id
@@ -197,11 +240,15 @@ function resolveInstance(placement, entry, ctx) {
197
240
  }
198
241
  if (source?.kind === "derived" && typeof source.transform === "string") {
199
242
  const reads = declaredReads(source);
200
- if (reads.length > 0) declared.set(id, {
201
- transform: source.transform,
202
- reads,
203
- type: def.type
204
- });
243
+ if (reads.length > 0) {
244
+ const fields = def.type === "list" ? def.fields : void 0;
245
+ declared.set(id, {
246
+ transform: source.transform,
247
+ reads,
248
+ type: def.type,
249
+ ...fields === void 0 ? {} : { fields }
250
+ });
251
+ }
205
252
  slots[id] = baked[id] ?? null;
206
253
  provenance[id] = {
207
254
  kind: "computed",
@@ -226,25 +273,19 @@ function resolveInstance(placement, entry, ctx) {
226
273
  section: section.key,
227
274
  slots
228
275
  };
229
- for (const [id, slot] of sameSectionOrder(section.key, declared)) slots[id] = runDeclared(computeFns, slot.transform, valuesFor(slot.reads, factsView, ctx.settled, own))?.value ?? emptyValueFor(slot.type);
276
+ for (const [id, slot] of sameSectionOrder(section.key, declared)) {
277
+ const value = runDeclared(computeFns, slot.transform, valuesFor(slot.reads, factsView, ctx.settled, own))?.value ?? emptyValueFor(slot.type);
278
+ slots[id] = slot.fields === void 0 ? value : projectComputedRows(value, slot.fields, rowComputesOf(id, slot.fields, () => factsView, bakeCtx));
279
+ }
230
280
  return {
231
- instance: {
232
- instance_id: placement.instance,
233
- section_key: section.key,
234
- enabled,
235
- ...variant === void 0 ? {} : { variant },
236
- slots
237
- },
238
- provenance,
239
- settled: {
240
- slots,
241
- visibility: resolvedDisplay.visibility ?? display.visibility?.cases?.[0],
242
- variant
243
- }
281
+ slots,
282
+ provenance
244
283
  };
245
284
  }
246
- function enrichedRows(fields, baked, stated, ctx) {
285
+ function enrichedRows(collection, fields, baked, stated, ctx) {
247
286
  if (!Array.isArray(baked)) return baked;
287
+ if (!Object.hasOwn(COLLECTIONS, collection)) return baked;
288
+ const idKey = COLLECTIONS[collection].idKey;
248
289
  const bakedRows = baked;
249
290
  const statedRows = Array.isArray(stated) ? stated : [];
250
291
  if (statedRows.length > bakedRows.length) ctx.violations.push({
@@ -256,10 +297,12 @@ function enrichedRows(fields, baked, stated, ctx) {
256
297
  for (const [field, fieldDef] of Object.entries(fields)) if (fieldDef.source === void 0) blanks[field] = blankForField(fieldDef);
257
298
  return bakedRows.map((row, index) => {
258
299
  if (typeof row !== "object" || row === null) return row;
300
+ const bakedRow = row;
259
301
  const out = {
260
- ...blanks,
261
- ...row
302
+ [idKey]: bakedRow[idKey],
303
+ ...blanks
262
304
  };
305
+ for (const field of Object.keys(fields)) if (field in bakedRow) out[field] = bakedRow[field];
263
306
  const statedRow = statedRows[index];
264
307
  if (typeof statedRow !== "object" || statedRow === null || Array.isArray(statedRow)) return out;
265
308
  for (const [field, fieldDef] of Object.entries(fields)) {
@@ -277,7 +320,7 @@ function authoredValue(def, value, ctx) {
277
320
  if (!Array.isArray(value)) return value;
278
321
  if (def.fields !== void 0) {
279
322
  const fields = def.fields;
280
- return canonicalizeRows(def, value, ctx.facts, rowFieldSources(fields)).map((row) => {
323
+ return canonicalizeRows(def, value).map((row) => {
281
324
  if (typeof row !== "object" || row === null) return row;
282
325
  const out = { ...row };
283
326
  for (const [field, fieldDef] of Object.entries(fields)) if (out[field] !== null && out[field] !== void 0) out[field] = authoredValue(fieldDef, out[field], ctx);