@mistriwork/mistri 1.0.0-rc.34 → 1.0.0-rc.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/dist/adapters/commands/commandJournalSchema.js +9 -10
- package/dist/client/assets/AccountAdministration-k0lSg4L4.js +2 -0
- package/dist/client/assets/AccountAdministration-k0lSg4L4.js.br +0 -0
- package/dist/client/assets/AccountAdministration-k0lSg4L4.js.gz +0 -0
- package/dist/client/assets/AccountAdministration-k0lSg4L4.js.map +1 -0
- package/dist/client/assets/AccountControl-D3NSj9po.js +3 -0
- package/dist/client/assets/AccountControl-D3NSj9po.js.br +0 -0
- package/dist/client/assets/AccountControl-D3NSj9po.js.gz +0 -0
- package/dist/client/assets/AccountControl-D3NSj9po.js.map +1 -0
- package/dist/client/assets/AccountProfile-p8VcSKEt.js +2 -0
- package/dist/client/assets/AccountProfile-p8VcSKEt.js.br +0 -0
- package/dist/client/assets/AccountProfile-p8VcSKEt.js.gz +0 -0
- package/dist/client/assets/AccountProfile-p8VcSKEt.js.map +1 -0
- package/dist/client/assets/ApiOperations-DxA2PbUX.js +2 -0
- package/dist/client/assets/ApiOperations-DxA2PbUX.js.br +0 -0
- package/dist/client/assets/ApiOperations-DxA2PbUX.js.gz +0 -0
- package/dist/client/assets/ApiOperations-DxA2PbUX.js.map +1 -0
- package/dist/client/assets/AppColumnMenuPopups-CziyIHgG.js +2 -0
- package/dist/client/assets/AppColumnMenuPopups-CziyIHgG.js.br +0 -0
- package/dist/client/assets/AppColumnMenuPopups-CziyIHgG.js.gz +0 -0
- package/dist/client/assets/AppColumnMenuPopups-CziyIHgG.js.map +1 -0
- package/dist/client/assets/AsOfChip-DukzBdSi.js +2 -0
- package/dist/client/assets/AsOfChip-DukzBdSi.js.br +0 -0
- package/dist/client/assets/AsOfChip-DukzBdSi.js.gz +0 -0
- package/dist/client/assets/AsOfChip-DukzBdSi.js.map +1 -0
- package/dist/client/assets/AssistantPanel-CAag-yY1.js +3 -0
- package/dist/client/assets/AssistantPanel-CAag-yY1.js.br +0 -0
- package/dist/client/assets/AssistantPanel-CAag-yY1.js.gz +0 -0
- package/dist/client/assets/AssistantPanel-CAag-yY1.js.map +1 -0
- package/dist/client/assets/AttachmentList-Ciz3VvkG.js +3 -0
- package/dist/client/assets/AttachmentList-Ciz3VvkG.js.br +0 -0
- package/dist/client/assets/AttachmentList-Ciz3VvkG.js.gz +0 -0
- package/dist/client/assets/AttachmentList-Ciz3VvkG.js.map +1 -0
- package/dist/client/assets/BoardCardEditor-lUmO-a4K.js +2 -0
- package/dist/client/assets/BoardCardEditor-lUmO-a4K.js.br +0 -0
- package/dist/client/assets/BoardCardEditor-lUmO-a4K.js.gz +0 -0
- package/dist/client/assets/BoardCardEditor-lUmO-a4K.js.map +1 -0
- package/dist/client/assets/BoardList-DgG-HAof.js +5 -0
- package/dist/client/assets/BoardList-DgG-HAof.js.br +0 -0
- package/dist/client/assets/BoardList-DgG-HAof.js.gz +0 -0
- package/dist/client/assets/BoardList-DgG-HAof.js.map +1 -0
- package/dist/client/assets/BrandingForm-CZjkbPTS.js +2 -0
- package/dist/client/assets/BrandingForm-CZjkbPTS.js.br +0 -0
- package/dist/client/assets/BrandingForm-CZjkbPTS.js.gz +0 -0
- package/dist/client/assets/BrandingForm-CZjkbPTS.js.map +1 -0
- package/dist/client/assets/BreakdownRoom-CSMk1unC.js +2 -0
- package/dist/client/assets/BreakdownRoom-CSMk1unC.js.br +0 -0
- package/dist/client/assets/BreakdownRoom-CSMk1unC.js.gz +0 -0
- package/dist/client/assets/BreakdownRoom-CSMk1unC.js.map +1 -0
- package/dist/client/assets/CalendarList-BM1pMzq5.js +2 -0
- package/dist/client/assets/CalendarList-BM1pMzq5.js.br +0 -0
- package/dist/client/assets/CalendarList-BM1pMzq5.js.gz +0 -0
- package/dist/client/assets/CalendarList-BM1pMzq5.js.map +1 -0
- package/dist/client/assets/CardsList-DcGpJWQE.js +2 -0
- package/dist/client/assets/CardsList-DcGpJWQE.js.br +0 -0
- package/dist/client/assets/CardsList-DcGpJWQE.js.gz +0 -0
- package/dist/client/assets/CardsList-DcGpJWQE.js.map +1 -0
- package/dist/client/assets/Chart-BN1tUHmc.js +2 -0
- package/dist/client/assets/Chart-BN1tUHmc.js.br +0 -0
- package/dist/client/assets/Chart-BN1tUHmc.js.gz +0 -0
- package/dist/client/assets/Chart-BN1tUHmc.js.map +1 -0
- package/dist/client/assets/ChartFigure-CH_yWzQj.js +3 -0
- package/dist/client/assets/ChartFigure-CH_yWzQj.js.br +0 -0
- package/dist/client/assets/ChartFigure-CH_yWzQj.js.gz +0 -0
- package/dist/client/assets/ChartFigure-CH_yWzQj.js.map +1 -0
- package/dist/client/assets/ChartShapes-Dmzhpe0E.js +2 -0
- package/dist/client/assets/ChartShapes-Dmzhpe0E.js.br +0 -0
- package/dist/client/assets/ChartShapes-Dmzhpe0E.js.gz +0 -0
- package/dist/client/assets/ChartShapes-Dmzhpe0E.js.map +1 -0
- package/dist/client/assets/CheckedAppTargetAction-EIw2_GWj.js +2 -0
- package/dist/client/assets/CheckedAppTargetAction-EIw2_GWj.js.br +0 -0
- package/dist/client/assets/CheckedAppTargetAction-EIw2_GWj.js.gz +0 -0
- package/dist/client/assets/CheckedAppTargetAction-EIw2_GWj.js.map +1 -0
- package/dist/client/assets/Choices-jMLc3A6A.js +2 -0
- package/dist/client/assets/Choices-jMLc3A6A.js.br +0 -0
- package/dist/client/assets/Choices-jMLc3A6A.js.gz +0 -0
- package/dist/client/assets/Choices-jMLc3A6A.js.map +1 -0
- package/dist/client/assets/ClaimInvitation-CJ62rAFs.js +2 -0
- package/dist/client/assets/ClaimInvitation-CJ62rAFs.js.br +0 -0
- package/dist/client/assets/ClaimInvitation-CJ62rAFs.js.gz +0 -0
- package/dist/client/assets/ClaimInvitation-CJ62rAFs.js.map +1 -0
- package/dist/client/assets/CommandAnswers-BpDEMWHE.js +2 -0
- package/dist/client/assets/CommandAnswers-BpDEMWHE.js.br +0 -0
- package/dist/client/assets/CommandAnswers-BpDEMWHE.js.gz +0 -0
- package/dist/client/assets/CommandAnswers-BpDEMWHE.js.map +1 -0
- package/dist/client/assets/CommandForm-rwjHMxTQ.js +3 -0
- package/dist/client/assets/CommandForm-rwjHMxTQ.js.br +0 -0
- package/dist/client/assets/CommandForm-rwjHMxTQ.js.gz +0 -0
- package/dist/client/assets/CommandForm-rwjHMxTQ.js.map +1 -0
- package/dist/client/assets/CommandLines-B9zlmbIU.js +2 -0
- package/dist/client/assets/CommandLines-B9zlmbIU.js.br +0 -0
- package/dist/client/assets/CommandLines-B9zlmbIU.js.gz +0 -0
- package/dist/client/assets/CommandLines-B9zlmbIU.js.map +1 -0
- package/dist/client/assets/CommandLive-DOiH-UTF.js +2 -0
- package/dist/client/assets/CommandLive-DOiH-UTF.js.br +0 -0
- package/dist/client/assets/CommandLive-DOiH-UTF.js.gz +0 -0
- package/dist/client/assets/CommandLive-DOiH-UTF.js.map +1 -0
- package/dist/client/assets/CommandReference-CE8k_QvM.js +3 -0
- package/dist/client/assets/CommandReference-CE8k_QvM.js.br +0 -0
- package/dist/client/assets/CommandReference-CE8k_QvM.js.gz +0 -0
- package/dist/client/assets/CommandReference-CE8k_QvM.js.map +1 -0
- package/dist/client/assets/Composer-BMAbAbLT.js +5 -0
- package/dist/client/assets/Composer-BMAbAbLT.js.br +0 -0
- package/dist/client/assets/Composer-BMAbAbLT.js.gz +0 -0
- package/dist/client/assets/Composer-BMAbAbLT.js.map +1 -0
- package/dist/client/assets/CountedLabel-DOu4oXbO.js +2 -0
- package/dist/client/assets/CountedLabel-DOu4oXbO.js.br +0 -0
- package/dist/client/assets/CountedLabel-DOu4oXbO.js.gz +0 -0
- package/dist/client/assets/CountedLabel-DOu4oXbO.js.map +1 -0
- package/dist/client/assets/CustomList-C2p_IaMt.js +2 -0
- package/dist/client/assets/CustomList-C2p_IaMt.js.br +0 -0
- package/dist/client/assets/CustomList-C2p_IaMt.js.gz +0 -0
- package/dist/client/assets/CustomList-C2p_IaMt.js.map +1 -0
- package/dist/client/assets/CustomPage-CjC3cwhm.js +3 -0
- package/dist/client/assets/CustomPage-CjC3cwhm.js.br +0 -0
- package/dist/client/assets/CustomPage-CjC3cwhm.js.gz +0 -0
- package/dist/client/assets/CustomPage-CjC3cwhm.js.map +1 -0
- package/dist/client/assets/CustomSection-DA9Rw0A6.js +2 -0
- package/dist/client/assets/CustomSection-DA9Rw0A6.js.br +0 -0
- package/dist/client/assets/CustomSection-DA9Rw0A6.js.gz +0 -0
- package/dist/client/assets/CustomSection-DA9Rw0A6.js.map +1 -0
- package/dist/client/assets/Dashboard-CCohuQ7E.js +3 -0
- package/dist/client/assets/Dashboard-CCohuQ7E.js.br +0 -0
- package/dist/client/assets/Dashboard-CCohuQ7E.js.gz +0 -0
- package/dist/client/assets/Dashboard-CCohuQ7E.js.map +1 -0
- package/dist/client/assets/DashboardActivity-BAEuPuIh.js +2 -0
- package/dist/client/assets/DashboardActivity-BAEuPuIh.js.br +0 -0
- package/dist/client/assets/DashboardActivity-BAEuPuIh.js.gz +0 -0
- package/dist/client/assets/DashboardActivity-BAEuPuIh.js.map +1 -0
- package/dist/client/assets/DashboardFind-D31OVz3O.js +2 -0
- package/dist/client/assets/DashboardFind-D31OVz3O.js.br +0 -0
- package/dist/client/assets/DashboardFind-D31OVz3O.js.gz +0 -0
- package/dist/client/assets/DashboardFind-D31OVz3O.js.map +1 -0
- package/dist/client/assets/DashboardList-CcjnJXE3.js +2 -0
- package/dist/client/assets/DashboardList-CcjnJXE3.js.br +0 -0
- package/dist/client/assets/DashboardList-CcjnJXE3.js.gz +0 -0
- package/dist/client/assets/DashboardList-CcjnJXE3.js.map +1 -0
- package/dist/client/assets/DateTimeInput-DyeQR_Io.js +2 -0
- package/dist/client/assets/DateTimeInput-DyeQR_Io.js.br +0 -0
- package/dist/client/assets/DateTimeInput-DyeQR_Io.js.gz +0 -0
- package/dist/client/assets/DateTimeInput-DyeQR_Io.js.map +1 -0
- package/dist/client/assets/DecisionChip-BJPIwBEZ.js +2 -0
- package/dist/client/assets/DecisionChip-BJPIwBEZ.js.br +0 -0
- package/dist/client/assets/DecisionChip-BJPIwBEZ.js.gz +0 -0
- package/dist/client/assets/DecisionChip-BJPIwBEZ.js.map +1 -0
- package/dist/client/assets/DefinedFields-CvrHJbkw.js +2 -0
- package/dist/client/assets/DefinedFields-CvrHJbkw.js.br +0 -0
- package/dist/client/assets/DefinedFields-CvrHJbkw.js.gz +0 -0
- package/dist/client/assets/DefinedFields-CvrHJbkw.js.map +1 -0
- package/dist/client/assets/Diagram-CVvuVGWH.js +6 -0
- package/dist/client/assets/Diagram-CVvuVGWH.js.br +0 -0
- package/dist/client/assets/Diagram-CVvuVGWH.js.gz +0 -0
- package/dist/client/assets/Diagram-CVvuVGWH.js.map +1 -0
- package/dist/client/assets/Directory-Bb7sBoG6.js +2 -0
- package/dist/client/assets/Directory-Bb7sBoG6.js.br +0 -0
- package/dist/client/assets/Directory-Bb7sBoG6.js.gz +0 -0
- package/dist/client/assets/Directory-Bb7sBoG6.js.map +1 -0
- package/dist/client/assets/Document-C5NQUGNq.js +2 -0
- package/dist/client/assets/Document-C5NQUGNq.js.br +0 -0
- package/dist/client/assets/Document-C5NQUGNq.js.gz +0 -0
- package/dist/client/assets/Document-C5NQUGNq.js.map +1 -0
- package/dist/client/assets/Export-D60mLO5Y.js +2 -0
- package/dist/client/assets/Export-D60mLO5Y.js.br +0 -0
- package/dist/client/assets/Export-D60mLO5Y.js.gz +0 -0
- package/dist/client/assets/Export-D60mLO5Y.js.map +1 -0
- package/dist/client/assets/FilePreview-ev3RA_hJ.js +2 -0
- package/dist/client/assets/FilePreview-ev3RA_hJ.js.br +0 -0
- package/dist/client/assets/FilePreview-ev3RA_hJ.js.gz +0 -0
- package/dist/client/assets/FilePreview-ev3RA_hJ.js.map +1 -0
- package/dist/client/assets/FormClaimSurface-DIN4n3f7.js +2 -0
- package/dist/client/assets/FormClaimSurface-DIN4n3f7.js.br +0 -0
- package/dist/client/assets/FormClaimSurface-DIN4n3f7.js.gz +0 -0
- package/dist/client/assets/FormClaimSurface-DIN4n3f7.js.map +1 -0
- package/dist/client/assets/FormDialog-DAMN3zSr.js +3 -0
- package/dist/client/assets/FormDialog-DAMN3zSr.js.br +0 -0
- package/dist/client/assets/FormDialog-DAMN3zSr.js.gz +0 -0
- package/dist/client/assets/FormDialog-DAMN3zSr.js.map +1 -0
- package/dist/client/assets/FormLines-p068Zfxc.js +2 -0
- package/dist/client/assets/FormLines-p068Zfxc.js.br +0 -0
- package/dist/client/assets/FormLines-p068Zfxc.js.gz +0 -0
- package/dist/client/assets/FormLines-p068Zfxc.js.map +1 -0
- package/dist/client/assets/FormParts-BlDNZ0GG.js +2 -0
- package/dist/client/assets/FormParts-BlDNZ0GG.js.br +0 -0
- package/dist/client/assets/FormParts-BlDNZ0GG.js.gz +0 -0
- package/dist/client/assets/FormParts-BlDNZ0GG.js.map +1 -0
- package/dist/client/assets/FormStatusSurface-CbFBY8eV.js +2 -0
- package/dist/client/assets/FormStatusSurface-CbFBY8eV.js.br +0 -0
- package/dist/client/assets/FormStatusSurface-CbFBY8eV.js.gz +0 -0
- package/dist/client/assets/FormStatusSurface-CbFBY8eV.js.map +1 -0
- package/dist/client/assets/Gallery-CJ5yQ1_F.js +3 -0
- package/dist/client/assets/Gallery-CJ5yQ1_F.js.br +0 -0
- package/dist/client/assets/Gallery-CJ5yQ1_F.js.gz +0 -0
- package/dist/client/assets/Gallery-CJ5yQ1_F.js.map +1 -0
- package/dist/client/assets/GanttList-CFGbXQSC.js +2 -0
- package/dist/client/assets/GanttList-CFGbXQSC.js.br +0 -0
- package/dist/client/assets/GanttList-CFGbXQSC.js.gz +0 -0
- package/dist/client/assets/GanttList-CFGbXQSC.js.map +1 -0
- package/dist/client/assets/GridCellEditor-92Wh_5Mb.js +2 -0
- package/dist/client/assets/GridCellEditor-92Wh_5Mb.js.br +0 -0
- package/dist/client/assets/GridCellEditor-92Wh_5Mb.js.gz +0 -0
- package/dist/client/assets/GridCellEditor-92Wh_5Mb.js.map +1 -0
- package/dist/client/assets/HeldFiles-DZ7mPDxe.js +3 -0
- package/dist/client/assets/HeldFiles-DZ7mPDxe.js.br +0 -0
- package/dist/client/assets/HeldFiles-DZ7mPDxe.js.gz +0 -0
- package/dist/client/assets/HeldFiles-DZ7mPDxe.js.map +1 -0
- package/dist/client/assets/HelpPanel-CoMyHvBN.js +2 -0
- package/dist/client/assets/HelpPanel-CoMyHvBN.js.br +0 -0
- package/dist/client/assets/HelpPanel-CoMyHvBN.js.gz +0 -0
- package/dist/client/assets/HelpPanel-CoMyHvBN.js.map +1 -0
- package/dist/client/assets/ImportDialog-8O3i13PQ.js +9 -0
- package/dist/client/assets/ImportDialog-8O3i13PQ.js.br +0 -0
- package/dist/client/assets/ImportDialog-8O3i13PQ.js.gz +0 -0
- package/dist/client/assets/ImportDialog-8O3i13PQ.js.map +1 -0
- package/dist/client/assets/InboxList-CQ0CY4hT.js +2 -0
- package/dist/client/assets/InboxList-CQ0CY4hT.js.br +0 -0
- package/dist/client/assets/InboxList-CQ0CY4hT.js.gz +0 -0
- package/dist/client/assets/InboxList-CQ0CY4hT.js.map +1 -0
- package/dist/client/assets/IntakeControls-Dua2jgo0.js +2 -0
- package/dist/client/assets/IntakeControls-Dua2jgo0.js.br +0 -0
- package/dist/client/assets/IntakeControls-Dua2jgo0.js.gz +0 -0
- package/dist/client/assets/IntakeControls-Dua2jgo0.js.map +1 -0
- package/dist/client/assets/IntegrationsForm-pYtisdTi.js +2 -0
- package/dist/client/assets/IntegrationsForm-pYtisdTi.js.br +0 -0
- package/dist/client/assets/IntegrationsForm-pYtisdTi.js.gz +0 -0
- package/dist/client/assets/IntegrationsForm-pYtisdTi.js.map +1 -0
- package/dist/client/assets/JsonView-8Akr9Rgs.js +4 -0
- package/dist/client/assets/JsonView-8Akr9Rgs.js.br +0 -0
- package/dist/client/assets/JsonView-8Akr9Rgs.js.gz +0 -0
- package/dist/client/assets/JsonView-8Akr9Rgs.js.map +1 -0
- package/dist/client/assets/LayoutBuilder-ZHGY7v1J.js +2 -0
- package/dist/client/assets/LayoutBuilder-ZHGY7v1J.js.br +0 -0
- package/dist/client/assets/LayoutBuilder-ZHGY7v1J.js.gz +0 -0
- package/dist/client/assets/LayoutBuilder-ZHGY7v1J.js.map +1 -0
- package/dist/client/assets/Lightbox-DCP96tqR.js +2 -0
- package/dist/client/assets/Lightbox-DCP96tqR.js.br +0 -0
- package/dist/client/assets/Lightbox-DCP96tqR.js.gz +0 -0
- package/dist/client/assets/Lightbox-DCP96tqR.js.map +1 -0
- package/dist/client/assets/LiveNotices-CGP7wwTc.js +2 -0
- package/dist/client/assets/LiveNotices-CGP7wwTc.js.br +0 -0
- package/dist/client/assets/LiveNotices-CGP7wwTc.js.gz +0 -0
- package/dist/client/assets/LiveNotices-CGP7wwTc.js.map +1 -0
- package/dist/client/assets/MinorMoneyInput-DeVeS_jw.js +2 -0
- package/dist/client/assets/MinorMoneyInput-DeVeS_jw.js.br +0 -0
- package/dist/client/assets/MinorMoneyInput-DeVeS_jw.js.gz +0 -0
- package/dist/client/assets/MinorMoneyInput-DeVeS_jw.js.map +1 -0
- package/dist/client/assets/MultiStepForm-CxBVlxWj.js +3 -0
- package/dist/client/assets/MultiStepForm-CxBVlxWj.js.br +0 -0
- package/dist/client/assets/MultiStepForm-CxBVlxWj.js.gz +0 -0
- package/dist/client/assets/MultiStepForm-CxBVlxWj.js.map +1 -0
- package/dist/client/assets/NewMenu-BmoZPQKp.js +2 -0
- package/dist/client/assets/NewMenu-BmoZPQKp.js.br +0 -0
- package/dist/client/assets/NewMenu-BmoZPQKp.js.gz +0 -0
- package/dist/client/assets/NewMenu-BmoZPQKp.js.map +1 -0
- package/dist/client/assets/NewRecord-Dj7atwj6.js +3 -0
- package/dist/client/assets/NewRecord-Dj7atwj6.js.br +0 -0
- package/dist/client/assets/NewRecord-Dj7atwj6.js.gz +0 -0
- package/dist/client/assets/NewRecord-Dj7atwj6.js.map +1 -0
- package/dist/client/assets/PageFlowDiagram-BqOVsZmd.js +3 -0
- package/dist/client/assets/PageFlowDiagram-BqOVsZmd.js.br +0 -0
- package/dist/client/assets/PageFlowDiagram-BqOVsZmd.js.gz +0 -0
- package/dist/client/assets/PageFlowDiagram-BqOVsZmd.js.map +1 -0
- package/dist/client/assets/PageFlows-CG0HGKvh.js +2 -0
- package/dist/client/assets/PageFlows-CG0HGKvh.js.br +0 -0
- package/dist/client/assets/PageFlows-CG0HGKvh.js.gz +0 -0
- package/dist/client/assets/PageFlows-CG0HGKvh.js.map +1 -0
- package/dist/client/assets/PageGroups-DYKCYJr2.js +2 -0
- package/dist/client/assets/PageGroups-DYKCYJr2.js.br +0 -0
- package/dist/client/assets/PageGroups-DYKCYJr2.js.gz +0 -0
- package/dist/client/assets/PageGroups-DYKCYJr2.js.map +1 -0
- package/dist/client/assets/PageHistory-DyIdIPLr.js +2 -0
- package/dist/client/assets/PageHistory-DyIdIPLr.js.br +0 -0
- package/dist/client/assets/PageHistory-DyIdIPLr.js.gz +0 -0
- package/dist/client/assets/PageHistory-DyIdIPLr.js.map +1 -0
- package/dist/client/assets/PageSkeleton-qjnaRaGS.js +2 -0
- package/dist/client/assets/PageSkeleton-qjnaRaGS.js.br +2 -0
- package/dist/client/assets/PageSkeleton-qjnaRaGS.js.gz +0 -0
- package/dist/client/assets/PageSkeleton-qjnaRaGS.js.map +1 -0
- package/dist/client/assets/Palette-DUWwovvo.js +3 -0
- package/dist/client/assets/Palette-DUWwovvo.js.br +0 -0
- package/dist/client/assets/Palette-DUWwovvo.js.gz +0 -0
- package/dist/client/assets/Palette-DUWwovvo.js.map +1 -0
- package/dist/client/assets/PeekPanel-CYQXt5yf.js +2 -0
- package/dist/client/assets/PeekPanel-CYQXt5yf.js.br +0 -0
- package/dist/client/assets/PeekPanel-CYQXt5yf.js.gz +0 -0
- package/dist/client/assets/PeekPanel-CYQXt5yf.js.map +1 -0
- package/dist/client/assets/PlacedFormSurface-BONfJUC7.js +2 -0
- package/dist/client/assets/PlacedFormSurface-BONfJUC7.js.br +0 -0
- package/dist/client/assets/PlacedFormSurface-BONfJUC7.js.gz +0 -0
- package/dist/client/assets/PlacedFormSurface-BONfJUC7.js.map +1 -0
- package/dist/client/assets/Prefs-CDQo56nx.js +2 -0
- package/dist/client/assets/Prefs-CDQo56nx.js.br +0 -0
- package/dist/client/assets/Prefs-CDQo56nx.js.gz +0 -0
- package/dist/client/assets/Prefs-CDQo56nx.js.map +1 -0
- package/dist/client/assets/PresentedList-GQoSZyYr.js +2 -0
- package/dist/client/assets/PresentedList-GQoSZyYr.js.br +0 -0
- package/dist/client/assets/PresentedList-GQoSZyYr.js.gz +0 -0
- package/dist/client/assets/PresentedList-GQoSZyYr.js.map +1 -0
- package/dist/client/assets/PublicGuard-BI9ygPtS.js +2 -0
- package/dist/client/assets/PublicGuard-BI9ygPtS.js.br +0 -0
- package/dist/client/assets/PublicGuard-BI9ygPtS.js.gz +0 -0
- package/dist/client/assets/PublicGuard-BI9ygPtS.js.map +1 -0
- package/dist/client/assets/QrCode-CqxFbur1.js +4 -0
- package/dist/client/assets/QrCode-CqxFbur1.js.br +0 -0
- package/dist/client/assets/QrCode-CqxFbur1.js.gz +0 -0
- package/dist/client/assets/QrCode-CqxFbur1.js.map +1 -0
- package/dist/client/assets/QuickAdd-CpzEpoGq.js +2 -0
- package/dist/client/assets/QuickAdd-CpzEpoGq.js.br +0 -0
- package/dist/client/assets/QuickAdd-CpzEpoGq.js.gz +0 -0
- package/dist/client/assets/QuickAdd-CpzEpoGq.js.map +1 -0
- package/dist/client/assets/Record-QEjD9NcZ.js +2 -0
- package/dist/client/assets/Record-QEjD9NcZ.js.br +0 -0
- package/dist/client/assets/Record-QEjD9NcZ.js.gz +0 -0
- package/dist/client/assets/Record-QEjD9NcZ.js.map +1 -0
- package/dist/client/assets/RecordModal-DfFD8Qne.js +2 -0
- package/dist/client/assets/RecordModal-DfFD8Qne.js.br +0 -0
- package/dist/client/assets/RecordModal-DfFD8Qne.js.gz +0 -0
- package/dist/client/assets/RecordModal-DfFD8Qne.js.map +1 -0
- package/dist/client/assets/RichTextEditor--Am_WaHf.js +144 -0
- package/dist/client/assets/RichTextEditor--Am_WaHf.js.br +0 -0
- package/dist/client/assets/RichTextEditor--Am_WaHf.js.gz +0 -0
- package/dist/client/assets/RichTextEditor--Am_WaHf.js.map +1 -0
- package/dist/client/assets/SavedFormSurface-BmYGMR4d.js +2 -0
- package/dist/client/assets/SavedFormSurface-BmYGMR4d.js.br +0 -0
- package/dist/client/assets/SavedFormSurface-BmYGMR4d.js.gz +0 -0
- package/dist/client/assets/SavedFormSurface-BmYGMR4d.js.map +1 -0
- package/dist/client/assets/SectionPeriod-COF-FBe3.js +2 -0
- package/dist/client/assets/SectionPeriod-COF-FBe3.js.br +2 -0
- package/dist/client/assets/SectionPeriod-COF-FBe3.js.gz +0 -0
- package/dist/client/assets/SectionPeriod-COF-FBe3.js.map +1 -0
- package/dist/client/assets/SetFieldDialog-CAxQGIjG.js +2 -0
- package/dist/client/assets/SetFieldDialog-CAxQGIjG.js.br +0 -0
- package/dist/client/assets/SetFieldDialog-CAxQGIjG.js.gz +0 -0
- package/dist/client/assets/SetFieldDialog-CAxQGIjG.js.map +1 -0
- package/dist/client/assets/SignedInFormDialog-BGlB42Ww.js +2 -0
- package/dist/client/assets/SignedInFormDialog-BGlB42Ww.js.br +2 -0
- package/dist/client/assets/SignedInFormDialog-BGlB42Ww.js.gz +0 -0
- package/dist/client/assets/SignedInFormDialog-BGlB42Ww.js.map +1 -0
- package/dist/client/assets/SuggestBox-CjP-WGbG.js +2 -0
- package/dist/client/assets/SuggestBox-CjP-WGbG.js.br +0 -0
- package/dist/client/assets/SuggestBox-CjP-WGbG.js.gz +0 -0
- package/dist/client/assets/SuggestBox-CjP-WGbG.js.map +1 -0
- package/dist/client/assets/SuiteAppPreference-CXVvPO66.js +2 -0
- package/dist/client/assets/SuiteAppPreference-CXVvPO66.js.br +0 -0
- package/dist/client/assets/SuiteAppPreference-CXVvPO66.js.gz +0 -0
- package/dist/client/assets/SuiteAppPreference-CXVvPO66.js.map +1 -0
- package/dist/client/assets/SuiteAppSwitcher-Cmda8WA7.js +2 -0
- package/dist/client/assets/SuiteAppSwitcher-Cmda8WA7.js.br +0 -0
- package/dist/client/assets/SuiteAppSwitcher-Cmda8WA7.js.gz +0 -0
- package/dist/client/assets/SuiteAppSwitcher-Cmda8WA7.js.map +1 -0
- package/dist/client/assets/SupportLog-B8QZ3rvd.js +2 -0
- package/dist/client/assets/SupportLog-B8QZ3rvd.js.br +0 -0
- package/dist/client/assets/SupportLog-B8QZ3rvd.js.gz +0 -0
- package/dist/client/assets/SupportLog-B8QZ3rvd.js.map +1 -0
- package/dist/client/assets/SupportSessions-Cyn2I8G1.js +2 -0
- package/dist/client/assets/SupportSessions-Cyn2I8G1.js.br +0 -0
- package/dist/client/assets/SupportSessions-Cyn2I8G1.js.gz +0 -0
- package/dist/client/assets/SupportSessions-Cyn2I8G1.js.map +1 -0
- package/dist/client/assets/TenantAdministration-CXGMxfOu.js +4 -0
- package/dist/client/assets/TenantAdministration-CXGMxfOu.js.br +0 -0
- package/dist/client/assets/TenantAdministration-CXGMxfOu.js.gz +0 -0
- package/dist/client/assets/TenantAdministration-CXGMxfOu.js.map +1 -0
- package/dist/client/assets/TenantApiTokens-Cqyz0KaC.js +2 -0
- package/dist/client/assets/TenantApiTokens-Cqyz0KaC.js.br +0 -0
- package/dist/client/assets/TenantApiTokens-Cqyz0KaC.js.gz +0 -0
- package/dist/client/assets/TenantApiTokens-Cqyz0KaC.js.map +1 -0
- package/dist/client/assets/TenantInvitations-BKCQDdYs.js +2 -0
- package/dist/client/assets/TenantInvitations-BKCQDdYs.js.br +0 -0
- package/dist/client/assets/TenantInvitations-BKCQDdYs.js.gz +0 -0
- package/dist/client/assets/TenantInvitations-BKCQDdYs.js.map +1 -0
- package/dist/client/assets/ThemeLab-CUH3fjaa.js +4 -0
- package/dist/client/assets/ThemeLab-CUH3fjaa.js.br +0 -0
- package/dist/client/assets/ThemeLab-CUH3fjaa.js.gz +0 -0
- package/dist/client/assets/ThemeLab-CUH3fjaa.js.map +1 -0
- package/dist/client/assets/TimelineComposer-B8wN8pJv.js +2 -0
- package/dist/client/assets/TimelineComposer-B8wN8pJv.js.br +0 -0
- package/dist/client/assets/TimelineComposer-B8wN8pJv.js.gz +0 -0
- package/dist/client/assets/TimelineComposer-B8wN8pJv.js.map +1 -0
- package/dist/client/assets/TimelineReactions-Bar-Nn5E.js +2 -0
- package/dist/client/assets/TimelineReactions-Bar-Nn5E.js.br +0 -0
- package/dist/client/assets/TimelineReactions-Bar-Nn5E.js.gz +0 -0
- package/dist/client/assets/TimelineReactions-Bar-Nn5E.js.map +1 -0
- package/dist/client/assets/TopNav-CvEoPTNu.js +3 -0
- package/dist/client/assets/TopNav-CvEoPTNu.js.br +0 -0
- package/dist/client/assets/TopNav-CvEoPTNu.js.gz +0 -0
- package/dist/client/assets/TopNav-CvEoPTNu.js.map +1 -0
- package/dist/client/assets/Tour-BmYdtbXU.js +2 -0
- package/dist/client/assets/Tour-BmYdtbXU.js.br +0 -0
- package/dist/client/assets/Tour-BmYdtbXU.js.gz +0 -0
- package/dist/client/assets/Tour-BmYdtbXU.js.map +1 -0
- package/dist/client/assets/TreeList-tULtFXG6.js +2 -0
- package/dist/client/assets/TreeList-tULtFXG6.js.br +0 -0
- package/dist/client/assets/TreeList-tULtFXG6.js.gz +0 -0
- package/dist/client/assets/TreeList-tULtFXG6.js.map +1 -0
- package/dist/client/assets/TreePicker-DGj3Z6NC.js +2 -0
- package/dist/client/assets/TreePicker-DGj3Z6NC.js.br +0 -0
- package/dist/client/assets/TreePicker-DGj3Z6NC.js.gz +0 -0
- package/dist/client/assets/TreePicker-DGj3Z6NC.js.map +1 -0
- package/dist/client/assets/ViewFormDialog-CDLQyRTw.js +3 -0
- package/dist/client/assets/ViewFormDialog-CDLQyRTw.js.br +0 -0
- package/dist/client/assets/ViewFormDialog-CDLQyRTw.js.gz +0 -0
- package/dist/client/assets/ViewFormDialog-CDLQyRTw.js.map +1 -0
- package/dist/client/assets/appImport-DDwzxtP1.js +4 -0
- package/dist/client/assets/appImport-DDwzxtP1.js.br +0 -0
- package/dist/client/assets/appImport-DDwzxtP1.js.gz +0 -0
- package/dist/client/assets/appImport-DDwzxtP1.js.map +1 -0
- package/dist/client/assets/appLive-COIGDbj9.js +3 -0
- package/dist/client/assets/appLive-COIGDbj9.js.br +0 -0
- package/dist/client/assets/appLive-COIGDbj9.js.gz +0 -0
- package/dist/client/assets/appLive-COIGDbj9.js.map +1 -0
- package/dist/client/assets/assistantStream-B-SoxURv.js +7 -0
- package/dist/client/assets/assistantStream-B-SoxURv.js.br +0 -0
- package/dist/client/assets/assistantStream-B-SoxURv.js.gz +0 -0
- package/dist/client/assets/assistantStream-B-SoxURv.js.map +1 -0
- package/dist/client/assets/beacon-BuVZ8MDW.js +2 -0
- package/dist/client/assets/beacon-BuVZ8MDW.js.br +0 -0
- package/dist/client/assets/beacon-BuVZ8MDW.js.gz +0 -0
- package/dist/client/assets/beacon-BuVZ8MDW.js.map +1 -0
- package/dist/client/assets/blocks-CzUjFgm-.js +3 -0
- package/dist/client/assets/blocks-CzUjFgm-.js.br +0 -0
- package/dist/client/assets/blocks-CzUjFgm-.js.gz +0 -0
- package/dist/client/assets/blocks-CzUjFgm-.js.map +1 -0
- package/dist/client/assets/builtInInputs-C3j7d2uF.js +3 -0
- package/dist/client/assets/builtInInputs-C3j7d2uF.js.br +0 -0
- package/dist/client/assets/builtInInputs-C3j7d2uF.js.gz +0 -0
- package/dist/client/assets/builtInInputs-C3j7d2uF.js.map +1 -0
- package/dist/client/assets/commandDraft-Cdboj46f.js +2 -0
- package/dist/client/assets/commandDraft-Cdboj46f.js.br +0 -0
- package/dist/client/assets/commandDraft-Cdboj46f.js.gz +0 -0
- package/dist/client/assets/commandDraft-Cdboj46f.js.map +1 -0
- package/dist/client/assets/componentLoader-DX9U2BOa.js +3 -0
- package/dist/client/assets/componentLoader-DX9U2BOa.js.br +0 -0
- package/dist/client/assets/componentLoader-DX9U2BOa.js.gz +0 -0
- package/dist/client/assets/componentLoader-DX9U2BOa.js.map +1 -0
- package/dist/client/assets/composer-B3iveMnA.js +2 -0
- package/dist/client/assets/composer-B3iveMnA.js.br +0 -0
- package/dist/client/assets/composer-B3iveMnA.js.gz +0 -0
- package/dist/client/assets/composer-B3iveMnA.js.map +1 -0
- package/dist/client/assets/computedParse-qmXbLM0o.js +2 -0
- package/dist/client/assets/computedParse-qmXbLM0o.js.br +0 -0
- package/dist/client/assets/computedParse-qmXbLM0o.js.gz +0 -0
- package/dist/client/assets/computedParse-qmXbLM0o.js.map +1 -0
- package/dist/client/assets/computedValue-aBO9YPUl.js +2 -0
- package/dist/client/assets/computedValue-aBO9YPUl.js.br +0 -0
- package/dist/client/assets/computedValue-aBO9YPUl.js.gz +0 -0
- package/dist/client/assets/computedValue-aBO9YPUl.js.map +1 -0
- package/dist/client/assets/conditionWords-snEJReRe.js +2 -0
- package/dist/client/assets/conditionWords-snEJReRe.js.br +0 -0
- package/dist/client/assets/conditionWords-snEJReRe.js.gz +0 -0
- package/dist/client/assets/conditionWords-snEJReRe.js.map +1 -0
- package/dist/client/assets/definedValues-C1WEJErx.js +2 -0
- package/dist/client/assets/definedValues-C1WEJErx.js.br +0 -0
- package/dist/client/assets/definedValues-C1WEJErx.js.gz +0 -0
- package/dist/client/assets/definedValues-C1WEJErx.js.map +1 -0
- package/dist/client/assets/experimentExposure-CyKO0mH8.js +3 -0
- package/dist/client/assets/experimentExposure-CyKO0mH8.js.br +0 -0
- package/dist/client/assets/experimentExposure-CyKO0mH8.js.gz +0 -0
- package/dist/client/assets/experimentExposure-CyKO0mH8.js.map +1 -0
- package/dist/client/assets/export-Go_3Ncw6.js +4 -0
- package/dist/client/assets/export-Go_3Ncw6.js.br +0 -0
- package/dist/client/assets/export-Go_3Ncw6.js.gz +0 -0
- package/dist/client/assets/export-Go_3Ncw6.js.map +1 -0
- package/dist/client/assets/formCommandRun-BjvsJglU.js +2 -0
- package/dist/client/assets/formCommandRun-BjvsJglU.js.br +0 -0
- package/dist/client/assets/formCommandRun-BjvsJglU.js.gz +0 -0
- package/dist/client/assets/formCommandRun-BjvsJglU.js.map +1 -0
- package/dist/client/assets/formStepCheck-BYw7hGM7.js +2 -0
- package/dist/client/assets/formStepCheck-BYw7hGM7.js.br +0 -0
- package/dist/client/assets/formStepCheck-BYw7hGM7.js.gz +0 -0
- package/dist/client/assets/formStepCheck-BYw7hGM7.js.map +1 -0
- package/dist/client/assets/funnel-DOdqpCX6.js +2 -0
- package/dist/client/assets/funnel-DOdqpCX6.js.br +0 -0
- package/dist/client/assets/funnel-DOdqpCX6.js.gz +0 -0
- package/dist/client/assets/funnel-DOdqpCX6.js.map +1 -0
- package/dist/client/assets/handoff-DOjnNDsu.js +3 -0
- package/dist/client/assets/handoff-DOjnNDsu.js.br +0 -0
- package/dist/client/assets/handoff-DOjnNDsu.js.gz +0 -0
- package/dist/client/assets/handoff-DOjnNDsu.js.map +1 -0
- package/dist/client/assets/headlessLanding-B4ojD22g.js +2 -0
- package/dist/client/assets/headlessLanding-B4ojD22g.js.br +0 -0
- package/dist/client/assets/headlessLanding-B4ojD22g.js.gz +0 -0
- package/dist/client/assets/headlessLanding-B4ojD22g.js.map +1 -0
- package/dist/client/assets/index-YB5g6elu.js +16 -0
- package/dist/client/assets/index-YB5g6elu.js.br +0 -0
- package/dist/client/assets/index-YB5g6elu.js.gz +0 -0
- package/dist/client/assets/index-YB5g6elu.js.map +1 -0
- package/dist/client/assets/liveSync-CFuH_ghe.js +3 -0
- package/dist/client/assets/liveSync-CFuH_ghe.js.br +0 -0
- package/dist/client/assets/liveSync-CFuH_ghe.js.gz +0 -0
- package/dist/client/assets/liveSync-CFuH_ghe.js.map +1 -0
- package/dist/client/assets/mentionRows-CZHhEE1r.js +2 -0
- package/dist/client/assets/mentionRows-CZHhEE1r.js.br +0 -0
- package/dist/client/assets/mentionRows-CZHhEE1r.js.gz +0 -0
- package/dist/client/assets/mentionRows-CZHhEE1r.js.map +1 -0
- package/dist/client/assets/newMenuModel-n05Tjq2R.js +2 -0
- package/dist/client/assets/newMenuModel-n05Tjq2R.js.br +0 -0
- package/dist/client/assets/newMenuModel-n05Tjq2R.js.gz +0 -0
- package/dist/client/assets/newMenuModel-n05Tjq2R.js.map +1 -0
- package/dist/client/assets/newRecordModel-CrGTRDJS.js +2 -0
- package/dist/client/assets/newRecordModel-CrGTRDJS.js.br +0 -0
- package/dist/client/assets/newRecordModel-CrGTRDJS.js.gz +0 -0
- package/dist/client/assets/newRecordModel-CrGTRDJS.js.map +1 -0
- package/dist/client/assets/oauthConsent-CfwVbcv4.js +2 -0
- package/dist/client/assets/oauthConsent-CfwVbcv4.js.br +0 -0
- package/dist/client/assets/oauthConsent-CfwVbcv4.js.gz +0 -0
- package/dist/client/assets/oauthConsent-CfwVbcv4.js.map +1 -0
- package/dist/client/assets/pageControls-qQZ6u9zP.js +2 -0
- package/dist/client/assets/pageControls-qQZ6u9zP.js.br +0 -0
- package/dist/client/assets/pageControls-qQZ6u9zP.js.gz +0 -0
- package/dist/client/assets/pageControls-qQZ6u9zP.js.map +1 -0
- package/dist/client/assets/paramControls-Dq2DJhPP.js +2 -0
- package/dist/client/assets/paramControls-Dq2DJhPP.js.br +0 -0
- package/dist/client/assets/paramControls-Dq2DJhPP.js.gz +0 -0
- package/dist/client/assets/paramControls-Dq2DJhPP.js.map +1 -0
- package/dist/client/assets/public-DG__jqw_.js +3 -0
- package/dist/client/assets/public-DG__jqw_.js.br +0 -0
- package/dist/client/assets/public-DG__jqw_.js.gz +0 -0
- package/dist/client/assets/public-DG__jqw_.js.map +1 -0
- package/dist/client/assets/publicInputs-DQR-WRab.js +3 -0
- package/dist/client/assets/publicInputs-DQR-WRab.js.br +3 -0
- package/dist/client/assets/publicInputs-DQR-WRab.js.gz +0 -0
- package/dist/client/assets/publicInputs-DQR-WRab.js.map +1 -0
- package/dist/client/assets/publicPageCommand-CS8CtUqB.js +2 -0
- package/dist/client/assets/publicPageCommand-CS8CtUqB.js.br +0 -0
- package/dist/client/assets/publicPageCommand-CS8CtUqB.js.gz +0 -0
- package/dist/client/assets/publicPageCommand-CS8CtUqB.js.map +1 -0
- package/dist/client/assets/publicPlacement-fBdQWr1n.js +2 -0
- package/dist/client/assets/publicPlacement-fBdQWr1n.js.br +0 -0
- package/dist/client/assets/publicPlacement-fBdQWr1n.js.gz +0 -0
- package/dist/client/assets/publicPlacement-fBdQWr1n.js.map +1 -0
- package/dist/client/assets/recordSearch-GLSoUf-J.js +2 -0
- package/dist/client/assets/recordSearch-GLSoUf-J.js.br +0 -0
- package/dist/client/assets/recordSearch-GLSoUf-J.js.gz +0 -0
- package/dist/client/assets/recordSearch-GLSoUf-J.js.map +1 -0
- package/dist/client/assets/savedFormApi-C1SXvpih.js +2 -0
- package/dist/client/assets/savedFormApi-C1SXvpih.js.br +0 -0
- package/dist/client/assets/savedFormApi-C1SXvpih.js.gz +0 -0
- package/dist/client/assets/savedFormApi-C1SXvpih.js.map +1 -0
- package/dist/client/assets/shell-UOqMGfHm.js +13 -0
- package/dist/client/assets/shell-UOqMGfHm.js.br +0 -0
- package/dist/client/assets/shell-UOqMGfHm.js.gz +0 -0
- package/dist/client/assets/shell-UOqMGfHm.js.map +1 -0
- package/dist/client/assets/steps-BuMYsYrH.js +2 -0
- package/dist/client/assets/steps-BuMYsYrH.js.br +0 -0
- package/dist/client/assets/steps-BuMYsYrH.js.gz +0 -0
- package/dist/client/assets/steps-BuMYsYrH.js.map +1 -0
- package/dist/client/assets/tenant-CLmIa5pl.js +3 -0
- package/dist/client/assets/tenant-CLmIa5pl.js.br +0 -0
- package/dist/client/assets/tenant-CLmIa5pl.js.gz +0 -0
- package/dist/client/assets/tenant-CLmIa5pl.js.map +1 -0
- package/dist/client/assets/tenantInvitations-GiR5jiNd.js +2 -0
- package/dist/client/assets/tenantInvitations-GiR5jiNd.js.br +0 -0
- package/dist/client/assets/tenantInvitations-GiR5jiNd.js.gz +0 -0
- package/dist/client/assets/tenantInvitations-GiR5jiNd.js.map +1 -0
- package/dist/client/assets/tenantLive-m76CsKaK.js +2 -0
- package/dist/client/assets/tenantLive-m76CsKaK.js.br +0 -0
- package/dist/client/assets/tenantLive-m76CsKaK.js.gz +0 -0
- package/dist/client/assets/tenantLive-m76CsKaK.js.map +1 -0
- package/dist/client/assets/themeBench-CKLalHAb.js +2 -0
- package/dist/client/assets/themeBench-CKLalHAb.js.br +0 -0
- package/dist/client/assets/themeBench-CKLalHAb.js.gz +0 -0
- package/dist/client/assets/themeBench-CKLalHAb.js.map +1 -0
- package/dist/client/index.html +2 -2
- package/dist/client/index.html.br +0 -0
- package/dist/client/index.html.gz +0 -0
- package/dist/client/index.public.html +2 -2
- package/dist/client/index.public.html.br +0 -0
- package/dist/client/index.public.html.gz +0 -0
- package/dist/docs/status.md +4 -4
- package/dist/embed/react/headless.js +1 -1
- package/dist/embed/react/index.js +1 -1
- package/dist/server/tenant/tenantReadSource.js +18 -2
- package/dist/server/tenant/tenantStore.js +24 -7
- package/dist/server/tenant/tenantWriteSource.js +4 -6
- package/dist/ssr/render.js +1 -1
- package/package.json +4 -4
- package/dist/client/assets/AccountAdministration-DQYBsNEK.js +0 -2
- package/dist/client/assets/AccountAdministration-DQYBsNEK.js.br +0 -0
- package/dist/client/assets/AccountAdministration-DQYBsNEK.js.gz +0 -0
- package/dist/client/assets/AccountAdministration-DQYBsNEK.js.map +0 -1
- package/dist/client/assets/AccountControl-DMssHbjf.js +0 -3
- package/dist/client/assets/AccountControl-DMssHbjf.js.br +0 -0
- package/dist/client/assets/AccountControl-DMssHbjf.js.gz +0 -0
- package/dist/client/assets/AccountControl-DMssHbjf.js.map +0 -1
- package/dist/client/assets/AccountProfile-DSyGozq4.js +0 -2
- package/dist/client/assets/AccountProfile-DSyGozq4.js.br +0 -0
- package/dist/client/assets/AccountProfile-DSyGozq4.js.gz +0 -0
- package/dist/client/assets/AccountProfile-DSyGozq4.js.map +0 -1
- package/dist/client/assets/ApiOperations-DFrNeaiH.js +0 -2
- package/dist/client/assets/ApiOperations-DFrNeaiH.js.br +0 -0
- package/dist/client/assets/ApiOperations-DFrNeaiH.js.gz +0 -0
- package/dist/client/assets/ApiOperations-DFrNeaiH.js.map +0 -1
- package/dist/client/assets/AppColumnMenuPopups-B-rTJ2Bc.js +0 -2
- package/dist/client/assets/AppColumnMenuPopups-B-rTJ2Bc.js.br +0 -0
- package/dist/client/assets/AppColumnMenuPopups-B-rTJ2Bc.js.gz +0 -0
- package/dist/client/assets/AppColumnMenuPopups-B-rTJ2Bc.js.map +0 -1
- package/dist/client/assets/AsOfChip-B0nuxJ2t.js +0 -2
- package/dist/client/assets/AsOfChip-B0nuxJ2t.js.br +0 -0
- package/dist/client/assets/AsOfChip-B0nuxJ2t.js.gz +0 -0
- package/dist/client/assets/AsOfChip-B0nuxJ2t.js.map +0 -1
- package/dist/client/assets/AssistantPanel-CPb7MNin.js +0 -3
- package/dist/client/assets/AssistantPanel-CPb7MNin.js.br +0 -0
- package/dist/client/assets/AssistantPanel-CPb7MNin.js.gz +0 -0
- package/dist/client/assets/AssistantPanel-CPb7MNin.js.map +0 -1
- package/dist/client/assets/AttachmentList-BYvwjmkD.js +0 -3
- package/dist/client/assets/AttachmentList-BYvwjmkD.js.br +0 -0
- package/dist/client/assets/AttachmentList-BYvwjmkD.js.gz +0 -0
- package/dist/client/assets/AttachmentList-BYvwjmkD.js.map +0 -1
- package/dist/client/assets/BoardCardEditor-Cs26OrL9.js +0 -2
- package/dist/client/assets/BoardCardEditor-Cs26OrL9.js.br +0 -0
- package/dist/client/assets/BoardCardEditor-Cs26OrL9.js.gz +0 -0
- package/dist/client/assets/BoardCardEditor-Cs26OrL9.js.map +0 -1
- package/dist/client/assets/BoardList-C-lQ5BF-.js +0 -5
- package/dist/client/assets/BoardList-C-lQ5BF-.js.br +0 -0
- package/dist/client/assets/BoardList-C-lQ5BF-.js.gz +0 -0
- package/dist/client/assets/BoardList-C-lQ5BF-.js.map +0 -1
- package/dist/client/assets/BrandingForm-BAJiCMeC.js +0 -2
- package/dist/client/assets/BrandingForm-BAJiCMeC.js.br +0 -0
- package/dist/client/assets/BrandingForm-BAJiCMeC.js.gz +0 -0
- package/dist/client/assets/BrandingForm-BAJiCMeC.js.map +0 -1
- package/dist/client/assets/BreakdownRoom-h5GgdwTX.js +0 -2
- package/dist/client/assets/BreakdownRoom-h5GgdwTX.js.br +0 -0
- package/dist/client/assets/BreakdownRoom-h5GgdwTX.js.gz +0 -0
- package/dist/client/assets/BreakdownRoom-h5GgdwTX.js.map +0 -1
- package/dist/client/assets/CalendarList-DzYxxQtZ.js +0 -2
- package/dist/client/assets/CalendarList-DzYxxQtZ.js.br +0 -0
- package/dist/client/assets/CalendarList-DzYxxQtZ.js.gz +0 -0
- package/dist/client/assets/CalendarList-DzYxxQtZ.js.map +0 -1
- package/dist/client/assets/CardsList-C1w2EZBB.js +0 -2
- package/dist/client/assets/CardsList-C1w2EZBB.js.br +0 -0
- package/dist/client/assets/CardsList-C1w2EZBB.js.gz +0 -0
- package/dist/client/assets/CardsList-C1w2EZBB.js.map +0 -1
- package/dist/client/assets/Chart-D5NI5UBc.js +0 -2
- package/dist/client/assets/Chart-D5NI5UBc.js.br +0 -0
- package/dist/client/assets/Chart-D5NI5UBc.js.gz +0 -0
- package/dist/client/assets/Chart-D5NI5UBc.js.map +0 -1
- package/dist/client/assets/ChartFigure-CzEwHZY9.js +0 -3
- package/dist/client/assets/ChartFigure-CzEwHZY9.js.br +0 -0
- package/dist/client/assets/ChartFigure-CzEwHZY9.js.gz +0 -0
- package/dist/client/assets/ChartFigure-CzEwHZY9.js.map +0 -1
- package/dist/client/assets/ChartShapes-C_lwQ-IJ.js +0 -2
- package/dist/client/assets/ChartShapes-C_lwQ-IJ.js.br +0 -0
- package/dist/client/assets/ChartShapes-C_lwQ-IJ.js.gz +0 -0
- package/dist/client/assets/ChartShapes-C_lwQ-IJ.js.map +0 -1
- package/dist/client/assets/CheckedAppTargetAction-F66G8xCi.js +0 -2
- package/dist/client/assets/CheckedAppTargetAction-F66G8xCi.js.br +0 -0
- package/dist/client/assets/CheckedAppTargetAction-F66G8xCi.js.gz +0 -0
- package/dist/client/assets/CheckedAppTargetAction-F66G8xCi.js.map +0 -1
- package/dist/client/assets/Choices-D_ltQoA6.js +0 -2
- package/dist/client/assets/Choices-D_ltQoA6.js.br +0 -0
- package/dist/client/assets/Choices-D_ltQoA6.js.gz +0 -0
- package/dist/client/assets/Choices-D_ltQoA6.js.map +0 -1
- package/dist/client/assets/ClaimInvitation-D0HOoJB_.js +0 -2
- package/dist/client/assets/ClaimInvitation-D0HOoJB_.js.br +0 -0
- package/dist/client/assets/ClaimInvitation-D0HOoJB_.js.gz +0 -0
- package/dist/client/assets/ClaimInvitation-D0HOoJB_.js.map +0 -1
- package/dist/client/assets/CommandAnswers-DewG0nub.js +0 -2
- package/dist/client/assets/CommandAnswers-DewG0nub.js.br +0 -0
- package/dist/client/assets/CommandAnswers-DewG0nub.js.gz +0 -0
- package/dist/client/assets/CommandAnswers-DewG0nub.js.map +0 -1
- package/dist/client/assets/CommandForm-DDopegB7.js +0 -3
- package/dist/client/assets/CommandForm-DDopegB7.js.br +0 -0
- package/dist/client/assets/CommandForm-DDopegB7.js.gz +0 -0
- package/dist/client/assets/CommandForm-DDopegB7.js.map +0 -1
- package/dist/client/assets/CommandLines-WjJmO6mj.js +0 -2
- package/dist/client/assets/CommandLines-WjJmO6mj.js.br +0 -0
- package/dist/client/assets/CommandLines-WjJmO6mj.js.gz +0 -0
- package/dist/client/assets/CommandLines-WjJmO6mj.js.map +0 -1
- package/dist/client/assets/CommandLive-HCDtks_E.js +0 -2
- package/dist/client/assets/CommandLive-HCDtks_E.js.br +0 -0
- package/dist/client/assets/CommandLive-HCDtks_E.js.gz +0 -0
- package/dist/client/assets/CommandLive-HCDtks_E.js.map +0 -1
- package/dist/client/assets/CommandReference-z9DNMNI7.js +0 -3
- package/dist/client/assets/CommandReference-z9DNMNI7.js.br +0 -0
- package/dist/client/assets/CommandReference-z9DNMNI7.js.gz +0 -0
- package/dist/client/assets/CommandReference-z9DNMNI7.js.map +0 -1
- package/dist/client/assets/Composer-BZq7rP6h.js +0 -5
- package/dist/client/assets/Composer-BZq7rP6h.js.br +0 -0
- package/dist/client/assets/Composer-BZq7rP6h.js.gz +0 -0
- package/dist/client/assets/Composer-BZq7rP6h.js.map +0 -1
- package/dist/client/assets/CountedLabel-Bkhw171e.js +0 -2
- package/dist/client/assets/CountedLabel-Bkhw171e.js.br +0 -0
- package/dist/client/assets/CountedLabel-Bkhw171e.js.gz +0 -0
- package/dist/client/assets/CountedLabel-Bkhw171e.js.map +0 -1
- package/dist/client/assets/CustomList-eXqiBsfL.js +0 -2
- package/dist/client/assets/CustomList-eXqiBsfL.js.br +0 -0
- package/dist/client/assets/CustomList-eXqiBsfL.js.gz +0 -0
- package/dist/client/assets/CustomList-eXqiBsfL.js.map +0 -1
- package/dist/client/assets/CustomPage-Cf2UCree.js +0 -3
- package/dist/client/assets/CustomPage-Cf2UCree.js.br +0 -0
- package/dist/client/assets/CustomPage-Cf2UCree.js.gz +0 -0
- package/dist/client/assets/CustomPage-Cf2UCree.js.map +0 -1
- package/dist/client/assets/CustomSection-B3p69LEw.js +0 -2
- package/dist/client/assets/CustomSection-B3p69LEw.js.br +0 -0
- package/dist/client/assets/CustomSection-B3p69LEw.js.gz +0 -0
- package/dist/client/assets/CustomSection-B3p69LEw.js.map +0 -1
- package/dist/client/assets/Dashboard-D6oLLfIa.js +0 -3
- package/dist/client/assets/Dashboard-D6oLLfIa.js.br +0 -0
- package/dist/client/assets/Dashboard-D6oLLfIa.js.gz +0 -0
- package/dist/client/assets/Dashboard-D6oLLfIa.js.map +0 -1
- package/dist/client/assets/DashboardActivity-B8_MNq6v.js +0 -2
- package/dist/client/assets/DashboardActivity-B8_MNq6v.js.br +0 -0
- package/dist/client/assets/DashboardActivity-B8_MNq6v.js.gz +0 -0
- package/dist/client/assets/DashboardActivity-B8_MNq6v.js.map +0 -1
- package/dist/client/assets/DashboardFind-mIWh5Fkp.js +0 -2
- package/dist/client/assets/DashboardFind-mIWh5Fkp.js.br +0 -0
- package/dist/client/assets/DashboardFind-mIWh5Fkp.js.gz +0 -0
- package/dist/client/assets/DashboardFind-mIWh5Fkp.js.map +0 -1
- package/dist/client/assets/DashboardList-BpGbXMue.js +0 -2
- package/dist/client/assets/DashboardList-BpGbXMue.js.br +0 -0
- package/dist/client/assets/DashboardList-BpGbXMue.js.gz +0 -0
- package/dist/client/assets/DashboardList-BpGbXMue.js.map +0 -1
- package/dist/client/assets/DateTimeInput-7zFMo3La.js +0 -2
- package/dist/client/assets/DateTimeInput-7zFMo3La.js.br +0 -0
- package/dist/client/assets/DateTimeInput-7zFMo3La.js.gz +0 -0
- package/dist/client/assets/DateTimeInput-7zFMo3La.js.map +0 -1
- package/dist/client/assets/DecisionChip-SI0k8S9X.js +0 -2
- package/dist/client/assets/DecisionChip-SI0k8S9X.js.br +0 -0
- package/dist/client/assets/DecisionChip-SI0k8S9X.js.gz +0 -0
- package/dist/client/assets/DecisionChip-SI0k8S9X.js.map +0 -1
- package/dist/client/assets/DefinedFields-CFESpvWC.js +0 -2
- package/dist/client/assets/DefinedFields-CFESpvWC.js.br +0 -0
- package/dist/client/assets/DefinedFields-CFESpvWC.js.gz +0 -0
- package/dist/client/assets/DefinedFields-CFESpvWC.js.map +0 -1
- package/dist/client/assets/Diagram-z4DYLakX.js +0 -6
- package/dist/client/assets/Diagram-z4DYLakX.js.br +0 -0
- package/dist/client/assets/Diagram-z4DYLakX.js.gz +0 -0
- package/dist/client/assets/Diagram-z4DYLakX.js.map +0 -1
- package/dist/client/assets/Directory-BFLmBRFU.js +0 -2
- package/dist/client/assets/Directory-BFLmBRFU.js.br +0 -0
- package/dist/client/assets/Directory-BFLmBRFU.js.gz +0 -0
- package/dist/client/assets/Directory-BFLmBRFU.js.map +0 -1
- package/dist/client/assets/Document-CnDtqKmt.js +0 -2
- package/dist/client/assets/Document-CnDtqKmt.js.br +0 -0
- package/dist/client/assets/Document-CnDtqKmt.js.gz +0 -0
- package/dist/client/assets/Document-CnDtqKmt.js.map +0 -1
- package/dist/client/assets/Export-kr5d1z08.js +0 -2
- package/dist/client/assets/Export-kr5d1z08.js.br +0 -0
- package/dist/client/assets/Export-kr5d1z08.js.gz +0 -0
- package/dist/client/assets/Export-kr5d1z08.js.map +0 -1
- package/dist/client/assets/FilePreview-WR_cyL4x.js +0 -2
- package/dist/client/assets/FilePreview-WR_cyL4x.js.br +0 -0
- package/dist/client/assets/FilePreview-WR_cyL4x.js.gz +0 -0
- package/dist/client/assets/FilePreview-WR_cyL4x.js.map +0 -1
- package/dist/client/assets/FormClaimSurface-CoA2qciy.js +0 -2
- package/dist/client/assets/FormClaimSurface-CoA2qciy.js.br +0 -0
- package/dist/client/assets/FormClaimSurface-CoA2qciy.js.gz +0 -0
- package/dist/client/assets/FormClaimSurface-CoA2qciy.js.map +0 -1
- package/dist/client/assets/FormDialog-Br_gRw9C.js +0 -3
- package/dist/client/assets/FormDialog-Br_gRw9C.js.br +0 -0
- package/dist/client/assets/FormDialog-Br_gRw9C.js.gz +0 -0
- package/dist/client/assets/FormDialog-Br_gRw9C.js.map +0 -1
- package/dist/client/assets/FormLines-BLa5S_9c.js +0 -2
- package/dist/client/assets/FormLines-BLa5S_9c.js.br +0 -0
- package/dist/client/assets/FormLines-BLa5S_9c.js.gz +0 -0
- package/dist/client/assets/FormLines-BLa5S_9c.js.map +0 -1
- package/dist/client/assets/FormParts-CSw14gh3.js +0 -2
- package/dist/client/assets/FormParts-CSw14gh3.js.br +0 -0
- package/dist/client/assets/FormParts-CSw14gh3.js.gz +0 -0
- package/dist/client/assets/FormParts-CSw14gh3.js.map +0 -1
- package/dist/client/assets/FormStatusSurface-4oeqEU2L.js +0 -2
- package/dist/client/assets/FormStatusSurface-4oeqEU2L.js.br +0 -0
- package/dist/client/assets/FormStatusSurface-4oeqEU2L.js.gz +0 -0
- package/dist/client/assets/FormStatusSurface-4oeqEU2L.js.map +0 -1
- package/dist/client/assets/Gallery-DI_JVbvZ.js +0 -3
- package/dist/client/assets/Gallery-DI_JVbvZ.js.br +0 -0
- package/dist/client/assets/Gallery-DI_JVbvZ.js.gz +0 -0
- package/dist/client/assets/Gallery-DI_JVbvZ.js.map +0 -1
- package/dist/client/assets/GanttList-CYf9KqgI.js +0 -2
- package/dist/client/assets/GanttList-CYf9KqgI.js.br +0 -0
- package/dist/client/assets/GanttList-CYf9KqgI.js.gz +0 -0
- package/dist/client/assets/GanttList-CYf9KqgI.js.map +0 -1
- package/dist/client/assets/GridCellEditor-0Zdb-3q7.js +0 -2
- package/dist/client/assets/GridCellEditor-0Zdb-3q7.js.br +0 -0
- package/dist/client/assets/GridCellEditor-0Zdb-3q7.js.gz +0 -0
- package/dist/client/assets/GridCellEditor-0Zdb-3q7.js.map +0 -1
- package/dist/client/assets/HeldFiles-Ddp0STEh.js +0 -3
- package/dist/client/assets/HeldFiles-Ddp0STEh.js.br +0 -0
- package/dist/client/assets/HeldFiles-Ddp0STEh.js.gz +0 -0
- package/dist/client/assets/HeldFiles-Ddp0STEh.js.map +0 -1
- package/dist/client/assets/HelpPanel-YeWiL_LM.js +0 -2
- package/dist/client/assets/HelpPanel-YeWiL_LM.js.br +0 -0
- package/dist/client/assets/HelpPanel-YeWiL_LM.js.gz +0 -0
- package/dist/client/assets/HelpPanel-YeWiL_LM.js.map +0 -1
- package/dist/client/assets/ImportDialog-DKwlADLF.js +0 -9
- package/dist/client/assets/ImportDialog-DKwlADLF.js.br +0 -0
- package/dist/client/assets/ImportDialog-DKwlADLF.js.gz +0 -0
- package/dist/client/assets/ImportDialog-DKwlADLF.js.map +0 -1
- package/dist/client/assets/InboxList-DwG7hIcF.js +0 -2
- package/dist/client/assets/InboxList-DwG7hIcF.js.br +0 -0
- package/dist/client/assets/InboxList-DwG7hIcF.js.gz +0 -0
- package/dist/client/assets/InboxList-DwG7hIcF.js.map +0 -1
- package/dist/client/assets/IntakeControls-BdlBCXYe.js +0 -2
- package/dist/client/assets/IntakeControls-BdlBCXYe.js.br +0 -0
- package/dist/client/assets/IntakeControls-BdlBCXYe.js.gz +0 -0
- package/dist/client/assets/IntakeControls-BdlBCXYe.js.map +0 -1
- package/dist/client/assets/IntegrationsForm-BuhX6fIA.js +0 -2
- package/dist/client/assets/IntegrationsForm-BuhX6fIA.js.br +0 -0
- package/dist/client/assets/IntegrationsForm-BuhX6fIA.js.gz +0 -0
- package/dist/client/assets/IntegrationsForm-BuhX6fIA.js.map +0 -1
- package/dist/client/assets/JsonView-3kpHVB-6.js +0 -4
- package/dist/client/assets/JsonView-3kpHVB-6.js.br +0 -0
- package/dist/client/assets/JsonView-3kpHVB-6.js.gz +0 -0
- package/dist/client/assets/JsonView-3kpHVB-6.js.map +0 -1
- package/dist/client/assets/LayoutBuilder-BJiFK3uD.js +0 -2
- package/dist/client/assets/LayoutBuilder-BJiFK3uD.js.br +0 -0
- package/dist/client/assets/LayoutBuilder-BJiFK3uD.js.gz +0 -0
- package/dist/client/assets/LayoutBuilder-BJiFK3uD.js.map +0 -1
- package/dist/client/assets/Lightbox-DkU-Tlm6.js +0 -2
- package/dist/client/assets/Lightbox-DkU-Tlm6.js.br +0 -0
- package/dist/client/assets/Lightbox-DkU-Tlm6.js.gz +0 -0
- package/dist/client/assets/Lightbox-DkU-Tlm6.js.map +0 -1
- package/dist/client/assets/LiveNotices-CQiWoXHc.js +0 -2
- package/dist/client/assets/LiveNotices-CQiWoXHc.js.br +0 -0
- package/dist/client/assets/LiveNotices-CQiWoXHc.js.gz +0 -0
- package/dist/client/assets/LiveNotices-CQiWoXHc.js.map +0 -1
- package/dist/client/assets/MinorMoneyInput-cmVROgnp.js +0 -2
- package/dist/client/assets/MinorMoneyInput-cmVROgnp.js.br +0 -0
- package/dist/client/assets/MinorMoneyInput-cmVROgnp.js.gz +0 -0
- package/dist/client/assets/MinorMoneyInput-cmVROgnp.js.map +0 -1
- package/dist/client/assets/MultiStepForm-CRJo8q2V.js +0 -3
- package/dist/client/assets/MultiStepForm-CRJo8q2V.js.br +0 -0
- package/dist/client/assets/MultiStepForm-CRJo8q2V.js.gz +0 -0
- package/dist/client/assets/MultiStepForm-CRJo8q2V.js.map +0 -1
- package/dist/client/assets/NewMenu-Xy45Ndff.js +0 -2
- package/dist/client/assets/NewMenu-Xy45Ndff.js.br +0 -0
- package/dist/client/assets/NewMenu-Xy45Ndff.js.gz +0 -0
- package/dist/client/assets/NewMenu-Xy45Ndff.js.map +0 -1
- package/dist/client/assets/NewRecord-CtwCX_Us.js +0 -3
- package/dist/client/assets/NewRecord-CtwCX_Us.js.br +0 -0
- package/dist/client/assets/NewRecord-CtwCX_Us.js.gz +0 -0
- package/dist/client/assets/NewRecord-CtwCX_Us.js.map +0 -1
- package/dist/client/assets/PageFlowDiagram-Cb4cbCdY.js +0 -3
- package/dist/client/assets/PageFlowDiagram-Cb4cbCdY.js.br +0 -0
- package/dist/client/assets/PageFlowDiagram-Cb4cbCdY.js.gz +0 -0
- package/dist/client/assets/PageFlowDiagram-Cb4cbCdY.js.map +0 -1
- package/dist/client/assets/PageFlows-ActQTIr2.js +0 -2
- package/dist/client/assets/PageFlows-ActQTIr2.js.br +0 -0
- package/dist/client/assets/PageFlows-ActQTIr2.js.gz +0 -0
- package/dist/client/assets/PageFlows-ActQTIr2.js.map +0 -1
- package/dist/client/assets/PageGroups-B7OX0vQf.js +0 -2
- package/dist/client/assets/PageGroups-B7OX0vQf.js.br +0 -0
- package/dist/client/assets/PageGroups-B7OX0vQf.js.gz +0 -0
- package/dist/client/assets/PageGroups-B7OX0vQf.js.map +0 -1
- package/dist/client/assets/PageHistory--ZD3HI40.js +0 -2
- package/dist/client/assets/PageHistory--ZD3HI40.js.br +0 -0
- package/dist/client/assets/PageHistory--ZD3HI40.js.gz +0 -0
- package/dist/client/assets/PageHistory--ZD3HI40.js.map +0 -1
- package/dist/client/assets/PageSkeleton-DbJ4f46e.js +0 -2
- package/dist/client/assets/PageSkeleton-DbJ4f46e.js.br +0 -4
- package/dist/client/assets/PageSkeleton-DbJ4f46e.js.gz +0 -0
- package/dist/client/assets/PageSkeleton-DbJ4f46e.js.map +0 -1
- package/dist/client/assets/Palette-BAP4izWy.js +0 -3
- package/dist/client/assets/Palette-BAP4izWy.js.br +0 -0
- package/dist/client/assets/Palette-BAP4izWy.js.gz +0 -0
- package/dist/client/assets/Palette-BAP4izWy.js.map +0 -1
- package/dist/client/assets/PeekPanel-CptRpDPL.js +0 -2
- package/dist/client/assets/PeekPanel-CptRpDPL.js.br +0 -0
- package/dist/client/assets/PeekPanel-CptRpDPL.js.gz +0 -0
- package/dist/client/assets/PeekPanel-CptRpDPL.js.map +0 -1
- package/dist/client/assets/PlacedFormSurface-DNPtQGXy.js +0 -2
- package/dist/client/assets/PlacedFormSurface-DNPtQGXy.js.br +0 -0
- package/dist/client/assets/PlacedFormSurface-DNPtQGXy.js.gz +0 -0
- package/dist/client/assets/PlacedFormSurface-DNPtQGXy.js.map +0 -1
- package/dist/client/assets/Prefs-Cm9bMZ7p.js +0 -2
- package/dist/client/assets/Prefs-Cm9bMZ7p.js.br +0 -0
- package/dist/client/assets/Prefs-Cm9bMZ7p.js.gz +0 -0
- package/dist/client/assets/Prefs-Cm9bMZ7p.js.map +0 -1
- package/dist/client/assets/PresentedList-DhL7j-dU.js +0 -2
- package/dist/client/assets/PresentedList-DhL7j-dU.js.br +0 -0
- package/dist/client/assets/PresentedList-DhL7j-dU.js.gz +0 -0
- package/dist/client/assets/PresentedList-DhL7j-dU.js.map +0 -1
- package/dist/client/assets/PublicGuard-DKIHFfg8.js +0 -2
- package/dist/client/assets/PublicGuard-DKIHFfg8.js.br +0 -0
- package/dist/client/assets/PublicGuard-DKIHFfg8.js.gz +0 -0
- package/dist/client/assets/PublicGuard-DKIHFfg8.js.map +0 -1
- package/dist/client/assets/QrCode-qHy1Ejfv.js +0 -4
- package/dist/client/assets/QrCode-qHy1Ejfv.js.br +0 -0
- package/dist/client/assets/QrCode-qHy1Ejfv.js.gz +0 -0
- package/dist/client/assets/QrCode-qHy1Ejfv.js.map +0 -1
- package/dist/client/assets/QuickAdd-DYOu_Ghs.js +0 -2
- package/dist/client/assets/QuickAdd-DYOu_Ghs.js.br +0 -0
- package/dist/client/assets/QuickAdd-DYOu_Ghs.js.gz +0 -0
- package/dist/client/assets/QuickAdd-DYOu_Ghs.js.map +0 -1
- package/dist/client/assets/Record-CUrP8J6I.js +0 -2
- package/dist/client/assets/Record-CUrP8J6I.js.br +0 -0
- package/dist/client/assets/Record-CUrP8J6I.js.gz +0 -0
- package/dist/client/assets/Record-CUrP8J6I.js.map +0 -1
- package/dist/client/assets/RecordModal-Dk116VnI.js +0 -2
- package/dist/client/assets/RecordModal-Dk116VnI.js.br +0 -0
- package/dist/client/assets/RecordModal-Dk116VnI.js.gz +0 -0
- package/dist/client/assets/RecordModal-Dk116VnI.js.map +0 -1
- package/dist/client/assets/RichTextEditor-BQiIJE1m.js +0 -144
- package/dist/client/assets/RichTextEditor-BQiIJE1m.js.br +0 -0
- package/dist/client/assets/RichTextEditor-BQiIJE1m.js.gz +0 -0
- package/dist/client/assets/RichTextEditor-BQiIJE1m.js.map +0 -1
- package/dist/client/assets/SavedFormSurface-BQS-S75B.js +0 -2
- package/dist/client/assets/SavedFormSurface-BQS-S75B.js.br +0 -0
- package/dist/client/assets/SavedFormSurface-BQS-S75B.js.gz +0 -0
- package/dist/client/assets/SavedFormSurface-BQS-S75B.js.map +0 -1
- package/dist/client/assets/SectionPeriod-C766q1er.js +0 -2
- package/dist/client/assets/SectionPeriod-C766q1er.js.br +0 -0
- package/dist/client/assets/SectionPeriod-C766q1er.js.gz +0 -0
- package/dist/client/assets/SectionPeriod-C766q1er.js.map +0 -1
- package/dist/client/assets/SetFieldDialog-B_SJQVoj.js +0 -2
- package/dist/client/assets/SetFieldDialog-B_SJQVoj.js.br +0 -0
- package/dist/client/assets/SetFieldDialog-B_SJQVoj.js.gz +0 -0
- package/dist/client/assets/SetFieldDialog-B_SJQVoj.js.map +0 -1
- package/dist/client/assets/SignedInFormDialog-BZoEdk66.js +0 -2
- package/dist/client/assets/SignedInFormDialog-BZoEdk66.js.br +0 -4
- package/dist/client/assets/SignedInFormDialog-BZoEdk66.js.gz +0 -0
- package/dist/client/assets/SignedInFormDialog-BZoEdk66.js.map +0 -1
- package/dist/client/assets/SuggestBox-CeG1AvAE.js +0 -2
- package/dist/client/assets/SuggestBox-CeG1AvAE.js.br +0 -0
- package/dist/client/assets/SuggestBox-CeG1AvAE.js.gz +0 -0
- package/dist/client/assets/SuggestBox-CeG1AvAE.js.map +0 -1
- package/dist/client/assets/SuiteAppPreference-2taQpqdr.js +0 -2
- package/dist/client/assets/SuiteAppPreference-2taQpqdr.js.br +0 -0
- package/dist/client/assets/SuiteAppPreference-2taQpqdr.js.gz +0 -0
- package/dist/client/assets/SuiteAppPreference-2taQpqdr.js.map +0 -1
- package/dist/client/assets/SuiteAppSwitcher-CPoa4O9Q.js +0 -2
- package/dist/client/assets/SuiteAppSwitcher-CPoa4O9Q.js.br +0 -0
- package/dist/client/assets/SuiteAppSwitcher-CPoa4O9Q.js.gz +0 -0
- package/dist/client/assets/SuiteAppSwitcher-CPoa4O9Q.js.map +0 -1
- package/dist/client/assets/SupportLog-E7vZs1il.js +0 -2
- package/dist/client/assets/SupportLog-E7vZs1il.js.br +0 -0
- package/dist/client/assets/SupportLog-E7vZs1il.js.gz +0 -0
- package/dist/client/assets/SupportLog-E7vZs1il.js.map +0 -1
- package/dist/client/assets/SupportSessions-DWvX1D7N.js +0 -2
- package/dist/client/assets/SupportSessions-DWvX1D7N.js.br +0 -0
- package/dist/client/assets/SupportSessions-DWvX1D7N.js.gz +0 -0
- package/dist/client/assets/SupportSessions-DWvX1D7N.js.map +0 -1
- package/dist/client/assets/TenantAdministration-hACWZhYV.js +0 -4
- package/dist/client/assets/TenantAdministration-hACWZhYV.js.br +0 -0
- package/dist/client/assets/TenantAdministration-hACWZhYV.js.gz +0 -0
- package/dist/client/assets/TenantAdministration-hACWZhYV.js.map +0 -1
- package/dist/client/assets/TenantApiTokens-DSgY32Gk.js +0 -2
- package/dist/client/assets/TenantApiTokens-DSgY32Gk.js.br +0 -0
- package/dist/client/assets/TenantApiTokens-DSgY32Gk.js.gz +0 -0
- package/dist/client/assets/TenantApiTokens-DSgY32Gk.js.map +0 -1
- package/dist/client/assets/TenantInvitations-DBHp2ILL.js +0 -2
- package/dist/client/assets/TenantInvitations-DBHp2ILL.js.br +0 -0
- package/dist/client/assets/TenantInvitations-DBHp2ILL.js.gz +0 -0
- package/dist/client/assets/TenantInvitations-DBHp2ILL.js.map +0 -1
- package/dist/client/assets/ThemeLab-CJj-UgDy.js +0 -4
- package/dist/client/assets/ThemeLab-CJj-UgDy.js.br +0 -0
- package/dist/client/assets/ThemeLab-CJj-UgDy.js.gz +0 -0
- package/dist/client/assets/ThemeLab-CJj-UgDy.js.map +0 -1
- package/dist/client/assets/TimelineComposer-LO6tvAA5.js +0 -2
- package/dist/client/assets/TimelineComposer-LO6tvAA5.js.br +0 -0
- package/dist/client/assets/TimelineComposer-LO6tvAA5.js.gz +0 -0
- package/dist/client/assets/TimelineComposer-LO6tvAA5.js.map +0 -1
- package/dist/client/assets/TimelineReactions-DQmlxpN5.js +0 -2
- package/dist/client/assets/TimelineReactions-DQmlxpN5.js.br +0 -0
- package/dist/client/assets/TimelineReactions-DQmlxpN5.js.gz +0 -0
- package/dist/client/assets/TimelineReactions-DQmlxpN5.js.map +0 -1
- package/dist/client/assets/TopNav-ByNGt2HL.js +0 -3
- package/dist/client/assets/TopNav-ByNGt2HL.js.br +0 -0
- package/dist/client/assets/TopNav-ByNGt2HL.js.gz +0 -0
- package/dist/client/assets/TopNav-ByNGt2HL.js.map +0 -1
- package/dist/client/assets/Tour-BXsRjmcu.js +0 -2
- package/dist/client/assets/Tour-BXsRjmcu.js.br +0 -0
- package/dist/client/assets/Tour-BXsRjmcu.js.gz +0 -0
- package/dist/client/assets/Tour-BXsRjmcu.js.map +0 -1
- package/dist/client/assets/TreeList-DMQExu7J.js +0 -2
- package/dist/client/assets/TreeList-DMQExu7J.js.br +0 -0
- package/dist/client/assets/TreeList-DMQExu7J.js.gz +0 -0
- package/dist/client/assets/TreeList-DMQExu7J.js.map +0 -1
- package/dist/client/assets/TreePicker-SVTq4DWB.js +0 -2
- package/dist/client/assets/TreePicker-SVTq4DWB.js.br +0 -0
- package/dist/client/assets/TreePicker-SVTq4DWB.js.gz +0 -0
- package/dist/client/assets/TreePicker-SVTq4DWB.js.map +0 -1
- package/dist/client/assets/ViewFormDialog-CFOt9WOJ.js +0 -3
- package/dist/client/assets/ViewFormDialog-CFOt9WOJ.js.br +0 -0
- package/dist/client/assets/ViewFormDialog-CFOt9WOJ.js.gz +0 -0
- package/dist/client/assets/ViewFormDialog-CFOt9WOJ.js.map +0 -1
- package/dist/client/assets/appImport-IKZLMDe8.js +0 -4
- package/dist/client/assets/appImport-IKZLMDe8.js.br +0 -0
- package/dist/client/assets/appImport-IKZLMDe8.js.gz +0 -0
- package/dist/client/assets/appImport-IKZLMDe8.js.map +0 -1
- package/dist/client/assets/appLive-DJHYuIU8.js +0 -3
- package/dist/client/assets/appLive-DJHYuIU8.js.br +0 -0
- package/dist/client/assets/appLive-DJHYuIU8.js.gz +0 -0
- package/dist/client/assets/appLive-DJHYuIU8.js.map +0 -1
- package/dist/client/assets/assistantStream-PIix1prW.js +0 -7
- package/dist/client/assets/assistantStream-PIix1prW.js.br +0 -0
- package/dist/client/assets/assistantStream-PIix1prW.js.gz +0 -0
- package/dist/client/assets/assistantStream-PIix1prW.js.map +0 -1
- package/dist/client/assets/beacon-BZUg3lwf.js +0 -2
- package/dist/client/assets/beacon-BZUg3lwf.js.br +0 -0
- package/dist/client/assets/beacon-BZUg3lwf.js.gz +0 -0
- package/dist/client/assets/beacon-BZUg3lwf.js.map +0 -1
- package/dist/client/assets/blocks-CCFZikE-.js +0 -3
- package/dist/client/assets/blocks-CCFZikE-.js.br +0 -0
- package/dist/client/assets/blocks-CCFZikE-.js.gz +0 -0
- package/dist/client/assets/blocks-CCFZikE-.js.map +0 -1
- package/dist/client/assets/builtInInputs-CH_xYO6j.js +0 -3
- package/dist/client/assets/builtInInputs-CH_xYO6j.js.br +0 -0
- package/dist/client/assets/builtInInputs-CH_xYO6j.js.gz +0 -0
- package/dist/client/assets/builtInInputs-CH_xYO6j.js.map +0 -1
- package/dist/client/assets/commandDraft-BDvPhSza.js +0 -2
- package/dist/client/assets/commandDraft-BDvPhSza.js.br +0 -0
- package/dist/client/assets/commandDraft-BDvPhSza.js.gz +0 -0
- package/dist/client/assets/commandDraft-BDvPhSza.js.map +0 -1
- package/dist/client/assets/componentLoader-BSp8wEAY.js +0 -3
- package/dist/client/assets/componentLoader-BSp8wEAY.js.br +0 -0
- package/dist/client/assets/componentLoader-BSp8wEAY.js.gz +0 -0
- package/dist/client/assets/componentLoader-BSp8wEAY.js.map +0 -1
- package/dist/client/assets/composer-BEJkvr0M.js +0 -2
- package/dist/client/assets/composer-BEJkvr0M.js.br +0 -0
- package/dist/client/assets/composer-BEJkvr0M.js.gz +0 -0
- package/dist/client/assets/composer-BEJkvr0M.js.map +0 -1
- package/dist/client/assets/computedParse-lgc6fG-v.js +0 -2
- package/dist/client/assets/computedParse-lgc6fG-v.js.br +0 -0
- package/dist/client/assets/computedParse-lgc6fG-v.js.gz +0 -0
- package/dist/client/assets/computedParse-lgc6fG-v.js.map +0 -1
- package/dist/client/assets/computedValue-BDfmNGZT.js +0 -2
- package/dist/client/assets/computedValue-BDfmNGZT.js.br +0 -0
- package/dist/client/assets/computedValue-BDfmNGZT.js.gz +0 -0
- package/dist/client/assets/computedValue-BDfmNGZT.js.map +0 -1
- package/dist/client/assets/conditionWords-CaRbP9G5.js +0 -2
- package/dist/client/assets/conditionWords-CaRbP9G5.js.br +0 -0
- package/dist/client/assets/conditionWords-CaRbP9G5.js.gz +0 -0
- package/dist/client/assets/conditionWords-CaRbP9G5.js.map +0 -1
- package/dist/client/assets/definedValues-Cb_0VeJ9.js +0 -2
- package/dist/client/assets/definedValues-Cb_0VeJ9.js.br +0 -0
- package/dist/client/assets/definedValues-Cb_0VeJ9.js.gz +0 -0
- package/dist/client/assets/definedValues-Cb_0VeJ9.js.map +0 -1
- package/dist/client/assets/experimentExposure-BOtTPeR9.js +0 -3
- package/dist/client/assets/experimentExposure-BOtTPeR9.js.br +0 -0
- package/dist/client/assets/experimentExposure-BOtTPeR9.js.gz +0 -0
- package/dist/client/assets/experimentExposure-BOtTPeR9.js.map +0 -1
- package/dist/client/assets/export-BkQcAhVr.js +0 -4
- package/dist/client/assets/export-BkQcAhVr.js.br +0 -0
- package/dist/client/assets/export-BkQcAhVr.js.gz +0 -0
- package/dist/client/assets/export-BkQcAhVr.js.map +0 -1
- package/dist/client/assets/formCommandRun-CPMaCLsm.js +0 -2
- package/dist/client/assets/formCommandRun-CPMaCLsm.js.br +0 -0
- package/dist/client/assets/formCommandRun-CPMaCLsm.js.gz +0 -0
- package/dist/client/assets/formCommandRun-CPMaCLsm.js.map +0 -1
- package/dist/client/assets/formStepCheck-CPvULv3d.js +0 -2
- package/dist/client/assets/formStepCheck-CPvULv3d.js.br +0 -0
- package/dist/client/assets/formStepCheck-CPvULv3d.js.gz +0 -0
- package/dist/client/assets/formStepCheck-CPvULv3d.js.map +0 -1
- package/dist/client/assets/funnel-DlQ9M3y2.js +0 -2
- package/dist/client/assets/funnel-DlQ9M3y2.js.br +0 -0
- package/dist/client/assets/funnel-DlQ9M3y2.js.gz +0 -0
- package/dist/client/assets/funnel-DlQ9M3y2.js.map +0 -1
- package/dist/client/assets/handoff-CugDDjyd.js +0 -3
- package/dist/client/assets/handoff-CugDDjyd.js.br +0 -0
- package/dist/client/assets/handoff-CugDDjyd.js.gz +0 -0
- package/dist/client/assets/handoff-CugDDjyd.js.map +0 -1
- package/dist/client/assets/headlessLanding-ClkGzcVt.js +0 -2
- package/dist/client/assets/headlessLanding-ClkGzcVt.js.br +0 -0
- package/dist/client/assets/headlessLanding-ClkGzcVt.js.gz +0 -0
- package/dist/client/assets/headlessLanding-ClkGzcVt.js.map +0 -1
- package/dist/client/assets/index-C42fyowY.js +0 -16
- package/dist/client/assets/index-C42fyowY.js.br +0 -0
- package/dist/client/assets/index-C42fyowY.js.gz +0 -0
- package/dist/client/assets/index-C42fyowY.js.map +0 -1
- package/dist/client/assets/liveSync-CLc2TyPv.js +0 -3
- package/dist/client/assets/liveSync-CLc2TyPv.js.br +0 -0
- package/dist/client/assets/liveSync-CLc2TyPv.js.gz +0 -0
- package/dist/client/assets/liveSync-CLc2TyPv.js.map +0 -1
- package/dist/client/assets/mentionRows-B4Zfo_1m.js +0 -2
- package/dist/client/assets/mentionRows-B4Zfo_1m.js.br +0 -0
- package/dist/client/assets/mentionRows-B4Zfo_1m.js.gz +0 -0
- package/dist/client/assets/mentionRows-B4Zfo_1m.js.map +0 -1
- package/dist/client/assets/newMenuModel-B6aB1Uqh.js +0 -2
- package/dist/client/assets/newMenuModel-B6aB1Uqh.js.br +0 -0
- package/dist/client/assets/newMenuModel-B6aB1Uqh.js.gz +0 -0
- package/dist/client/assets/newMenuModel-B6aB1Uqh.js.map +0 -1
- package/dist/client/assets/newRecordModel-BETkJR0e.js +0 -2
- package/dist/client/assets/newRecordModel-BETkJR0e.js.br +0 -0
- package/dist/client/assets/newRecordModel-BETkJR0e.js.gz +0 -0
- package/dist/client/assets/newRecordModel-BETkJR0e.js.map +0 -1
- package/dist/client/assets/oauthConsent-C6ffqFTR.js +0 -2
- package/dist/client/assets/oauthConsent-C6ffqFTR.js.br +0 -0
- package/dist/client/assets/oauthConsent-C6ffqFTR.js.gz +0 -0
- package/dist/client/assets/oauthConsent-C6ffqFTR.js.map +0 -1
- package/dist/client/assets/pageControls-B_PPm47V.js +0 -2
- package/dist/client/assets/pageControls-B_PPm47V.js.br +0 -0
- package/dist/client/assets/pageControls-B_PPm47V.js.gz +0 -0
- package/dist/client/assets/pageControls-B_PPm47V.js.map +0 -1
- package/dist/client/assets/paramControls-CNGbkkwd.js +0 -2
- package/dist/client/assets/paramControls-CNGbkkwd.js.br +0 -0
- package/dist/client/assets/paramControls-CNGbkkwd.js.gz +0 -0
- package/dist/client/assets/paramControls-CNGbkkwd.js.map +0 -1
- package/dist/client/assets/public-DPBH749j.js +0 -3
- package/dist/client/assets/public-DPBH749j.js.br +0 -0
- package/dist/client/assets/public-DPBH749j.js.gz +0 -0
- package/dist/client/assets/public-DPBH749j.js.map +0 -1
- package/dist/client/assets/publicInputs-xX0E1xHP.js +0 -3
- package/dist/client/assets/publicInputs-xX0E1xHP.js.br +0 -0
- package/dist/client/assets/publicInputs-xX0E1xHP.js.gz +0 -0
- package/dist/client/assets/publicInputs-xX0E1xHP.js.map +0 -1
- package/dist/client/assets/publicPageCommand-DaWvyZV2.js +0 -2
- package/dist/client/assets/publicPageCommand-DaWvyZV2.js.br +0 -0
- package/dist/client/assets/publicPageCommand-DaWvyZV2.js.gz +0 -0
- package/dist/client/assets/publicPageCommand-DaWvyZV2.js.map +0 -1
- package/dist/client/assets/publicPlacement-jiPqfzvs.js +0 -2
- package/dist/client/assets/publicPlacement-jiPqfzvs.js.br +0 -0
- package/dist/client/assets/publicPlacement-jiPqfzvs.js.gz +0 -0
- package/dist/client/assets/publicPlacement-jiPqfzvs.js.map +0 -1
- package/dist/client/assets/recordSearch-_Z6WiCS_.js +0 -2
- package/dist/client/assets/recordSearch-_Z6WiCS_.js.br +0 -0
- package/dist/client/assets/recordSearch-_Z6WiCS_.js.gz +0 -0
- package/dist/client/assets/recordSearch-_Z6WiCS_.js.map +0 -1
- package/dist/client/assets/savedFormApi-kZVNRpjg.js +0 -2
- package/dist/client/assets/savedFormApi-kZVNRpjg.js.br +0 -0
- package/dist/client/assets/savedFormApi-kZVNRpjg.js.gz +0 -0
- package/dist/client/assets/savedFormApi-kZVNRpjg.js.map +0 -1
- package/dist/client/assets/shell-091j_0M8.js +0 -13
- package/dist/client/assets/shell-091j_0M8.js.br +0 -0
- package/dist/client/assets/shell-091j_0M8.js.gz +0 -0
- package/dist/client/assets/shell-091j_0M8.js.map +0 -1
- package/dist/client/assets/steps-C1zq7_Wz.js +0 -2
- package/dist/client/assets/steps-C1zq7_Wz.js.br +0 -0
- package/dist/client/assets/steps-C1zq7_Wz.js.gz +0 -0
- package/dist/client/assets/steps-C1zq7_Wz.js.map +0 -1
- package/dist/client/assets/tenant-BZTQOqUF.js +0 -3
- package/dist/client/assets/tenant-BZTQOqUF.js.br +0 -0
- package/dist/client/assets/tenant-BZTQOqUF.js.gz +0 -0
- package/dist/client/assets/tenant-BZTQOqUF.js.map +0 -1
- package/dist/client/assets/tenantInvitations-Bqy9Yqgq.js +0 -2
- package/dist/client/assets/tenantInvitations-Bqy9Yqgq.js.br +0 -0
- package/dist/client/assets/tenantInvitations-Bqy9Yqgq.js.gz +0 -0
- package/dist/client/assets/tenantInvitations-Bqy9Yqgq.js.map +0 -1
- package/dist/client/assets/tenantLive-BIpf1ph1.js +0 -2
- package/dist/client/assets/tenantLive-BIpf1ph1.js.br +0 -0
- package/dist/client/assets/tenantLive-BIpf1ph1.js.gz +0 -0
- package/dist/client/assets/tenantLive-BIpf1ph1.js.map +0 -1
- package/dist/client/assets/themeBench-C2u8gJO2.js +0 -2
- package/dist/client/assets/themeBench-C2u8gJO2.js.br +0 -0
- package/dist/client/assets/themeBench-C2u8gJO2.js.gz +0 -0
- package/dist/client/assets/themeBench-C2u8gJO2.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";2jBAuGaA,EAAY,CAAC,QAAS,OAAQ,aAAc,WAAY,QAAS,WAAY,QAAS,QAAQ,EAE9EA,EAAU,OAAQ,GAAQC,IAAQ,cAAgBA,IAAQ,OAAO,EAElED,EAAU,OAAQ,GAAQC,IAAQ,SAAWA,IAAQ,QAAQ,EACzF,IAAMC,EAAiB,CAAC,OAAQ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AAA,CACF,EACA,QAAAJ,EAAA5M,EAAA,QACD,EAEL,CAEA,IAAAiN,GAAAtF,EAAAiB,GAAAL,CAAA,EACA2E,GAAAvF,EAAAyB,GAAAb,CAAA,EACA4E,GAAAxF,EAAA4B,GAAAhB,CAAA,EACA6E,GAAAzF,EAAA8B,GAAAlB,CAAA,EACA8E,GAAA1F,GAAA,OACEpB,EAAA,aAAAC,EAAA,CAA4B,OAAQ,SAAU,MAAM,GACpDoD,GAAA,aAAApD,EAAAS,CAAA,GACF+C,CAAA,EACAsD,GAAA3F,GAAA,OACEpB,EAAA,WAAAC,EAAA,mBACAoD,GAAA,WAAApD,EAAAS,EAAA,aACF+C,CAAA,EACAuD,GAAA5F,EAAAqD,GAAA,eAAqD,SAAU,UAAW,OAAO,GAAAC,EAAA,EACjFuC,GAAA7F,EAAAqD,GAAA,iBAAwD,QAAS,MAAO,UAAW,KAAM,UAAU,GAAAG,EAAA,EACnGsC,GAAA9F,EAAAyD,EAAA,wBAAAM,CAAA,EACAgC,GAAA/F,EAAAyD,EAAA,gCAAAM,CAAA,EACAiC,GAAAhG,EAAAyD,EAAA,6BAAAM,CAAA,EACAkC,GAAAjG,EAAAiE,GAAAG,EAAA,EACA8B,GAAAlG,EAAA,IAEIpB,EAAA,YAAAC,EAAA,kBACA,OAAAA,EAAA,qCAAAA,EAAA,kBACF,MAAA0B,EAAA,KAAAjC,GAAA,IAAA0F,CAAA,IAGFmC,GAAAnG,EAAAgF,GAAAG,EAAA,EAGAiB,GAAArI,MAAAC,MAAA,mH","names":["PAGE_KEYS","key","SECTION_COMMON","BACKDROP_RENAMED","PRESENTATION_RENAMED","PRESENTATION_KEYS","MAX_LINES","parseShow","raw","at","entry","i","localColumn","value","o","cardTitle","queueColumn","name","parseCalendarBackdrop","list","here","isRecord","allowKeys","start","end","labelColumn","DISPLAY_TONES","parsePresentation","kind","parseCustomList","parseSplit","primary","LABEL_SEGMENT","linesKey","rawLines","lines","max","line","facts","fact","badge","openLabel","date","CALENDAR_SPANS","one","span","backdrop","parseCards","by","lanes","lane","order","swimlanes","limits","n","category","footer","parseBoardFooter","sum","folded","stray","index","item","parseIcon","seen","result","input","detail","row","RANGE","MATCH","WHERE_OPERATORS","NUMERAL","ISO_DAY","COLUMN_NAME","plain","prototype","described","tag","kindOf","isFlagColumn","column","columnKind","written","text","oneOf","values","parts","got","op","condition","equal","operand","notEqual","compileWhere","where","each","table","say","defineMessages","DashboardBlock","onDemand","__vitePreload","RecordPageBody","TreeList","GanttList","PresentedList","SplitListDetail","AssistantRoom","TabStrip","WIDTHS","CURVES","noop","RENAMED","takes","props","words","needs","allowed","carried","out","names","resourceOf","resource","page","state","tableNamed","fromOf","scope","conditionOf","asked","scopedCondition","compiled","andQuery","block","useContext","UiPageContext","UiScopeContext","resolved","judge","error","import_jsx_runtime","Problem","ErrorBoundary","createElement","draw","SectionBlock","section","held","useMemo","METRIC","metricSection","query","title","BETTER","FIGURE_FORMATS","goal","target","CHART","chartSection","DASH_CHART_SHAPES","BREAKDOWN","breakdownSection","ROWS","rowsSection","TABLE_SIZINGS","show","recordAsk","blockName","record","only","RecordBlock","keyText","recordKey","fields","mounted","useRef","import_react","owner","captureRecordSurfaceOwner","pageId","setPageId","useState","live","pageFor","id","sections","presented","TreeBlock","spec","GanttBlock","listed","word","required","movesOf","declared","named","PresentedBlock","ask","splitAsk","primaryKey","param","SplitBlock","local","setLocal","picked","pick","rows","useRows","problem","refused","_Fragment","label","Value","tabsAsk","tabs","tab","TabsBlock","strip","token","Metric","Chart","Breakdown","Rows","RecordCard","Timeline","Tree","Gantt","Board","Calendar","Gallery","Split","Assistant","Tabs","Steps"],"ignoreList":[],"sources":["../../../../engine/src/shared/pageConfig.ts","../../../src/shared/formRules.ts","../../../src/shared/appFlows.ts","../../../src/shared/appViews.ts","../../../../engine/src/shared/pageWhere.ts","../../../src/client/copy/components/components/sdk/blocks.ts","../../../src/client/components/sdk/blocks.tsx"],"sourcesContent":["/*\n * Reading pages from configuration: the `pages` section of a tablewalk.json\n * and an App's page bodies. A malformed page throws with the page and, where\n * there is one, the fix; nothing is skipped.\n */\nimport { isMessageRef, parseCaption } from './appMessages.js';\nimport { parseTableSizing } from './tableSizing.js';\nimport { parseRelatedCreate } from './relatedCreate.js';\nimport { parseListEmpty } from './listEmpty.js';\nimport { CHART_SHAPES, FIGURE_FORMATS, FIGURE_FORMAT_WORDS, allowKeys, humanName } from './model.js';\nimport { headingOf } from './appNoun.js';\nimport { CARDS_MAX_LINES, HEADER_MAX_FACTS, parseCards, parseFacts, type AppCardsList } from './appCards.js';\nimport { parseIcon } from './appIcons.js';\nimport { slug } from './slug.js';\nimport { parsePageLayout } from './pageLayouts.js';\nimport { parseSortText } from './sortText.js';\nimport { componentPropValues, parseComponentDecl, parsePageReads, parsePageTotals, parseRecordFields } from './appComponents.js';\nimport { parseAppLinkAction, parseAppTarget, type AppLinkAction } from './appLinks.js';\nimport {\n type PageChart,\n type SectionWidth,\n WIDTHS,\n type SectionOffset,\n OFFSETS,\n type FieldColumns,\n type SectionRegion,\n SECTION_REGIONS,\n FIELD_COLUMNS,\n type PageMetric,\n type PageList,\n MAX_STREAMS,\n MAX_HISTORY_LIMIT,\n type TimelineComposer,\n type TimelineReactions,\n type TimelineTone,\n type PageSection,\n type PageDef,\n MAX_SECTIONS,\n MAX_PAGE_SECTIONS,\n screenSections,\n type PageHeadlineAction,\n type PageSimilar,\n type PageGroup,\n GROUPS_MOST,\n GROUP_ROWS_MOST,\n} from './pageModel.js';\n\n/* ---------- config ---------- */\n\n/**\n * Read the `pages` section of a tablewalk.json.\n *\n * Throws on a malformed file rather than skipping the bad entry: a page that\n * silently did not appear is a bug report that starts \"I definitely wrote\n * it\". Everything a config file can get wrong is named with the page it is\n * in and, where there is one, the fix.\n */\nexport function parsePagesConfig(raw: unknown, where: string): PageDef[] {\n const pages = (raw as { pages?: unknown })?.pages;\n if (pages === undefined) return [];\n if (!Array.isArray(pages)) throw new Error(`${where}: \"pages\" must be an array.`);\n\n const seen = new Set<string>();\n return pages.map((entry, i) => {\n const at = `${where}: page ${i + 1}`;\n if (!entry || typeof entry !== 'object' || Array.isArray(entry)) {\n throw new Error(`${at} is not an object.`);\n }\n const p = entry as Record<string, unknown>;\n const said = typeof p.label === 'string' && p.label.trim() ? ` (\"${p.label.trim()}\")` : '';\n if (p.id !== undefined && (typeof p.id !== 'string' || !p.id.trim())) {\n throw new Error(`${at}${said} has an \"id\" that is not a non-empty string.`);\n }\n const named = p.label !== undefined ? parseCaption(p.label, `${at}.label`) : typeof p.base === 'string' ? humanName(p.base.trim()) : '';\n const id = p.id === undefined ? `config-${slug(named, 'page')}` : String(p.id);\n const page = parsePageBody(p, at, id, true);\n /* An embed and a note's action name an App's views; a tablewalk.json has none to name. */\n for (const [n, section] of page.sections.entries()) {\n if (section.kind === 'list' && section.view !== undefined) {\n throw new Error(\n `${at} (\"${page.name}\") section ${n + 1} embeds the view \"${section.view}\", and a config file has no views: write a related list ({ kind: \"list\", from, whose }) instead.`,\n );\n }\n if (section.kind === 'note' && section.action) {\n throw new Error(\n `${at} (\"${page.name}\") section ${n + 1} is a note whose \"action\" needs an App, and a config file has no views to open. Remove \"action\".`,\n );\n }\n }\n if (seen.has(id)) throw new Error(`${at} (\"${page.name}\") repeats the id \"${id}\".`);\n seen.add(id);\n return page;\n });\n}\n\n/* Spellings renamed before 1.0, refused with the word that replaced them (allowKeys' `refused`). */\n/* A call to action's emphasis is its `intent`, as a button's is; `kind` names what a thing is. */\nconst CUSTOM_RENAMED = {\n totals: 'is now \"figures\": the named aggregate reads its component receives as figures.<name> (\"totals\" is a list\\'s footer of sums)',\n} as const;\nconst INTENT_RENAMED = { kind: 'is now \"intent\", as a button says it: \"primary\" or \"secondary\"' } as const;\nconst PAGE_RENAMED = { onlyOn: 'is now \"connection\", as the root of the config file says it' } as const;\n/** The keys a page takes. A tablewalk.json page also names its `id`; an App page is keyed by it. */\nexport const PAGE_KEYS = ['label', 'base', 'connection', 'listTabs', 'empty', 'sections', 'aside', 'layout'] as const;\n/** An App page has no `connection`: the App names its one connection, and a page scoped to another would never show. Nor a `label`: it is called its resource's `noun`. */\nexport const APP_PAGE_KEYS = PAGE_KEYS.filter((key) => key !== 'connection' && key !== 'label');\n/* `aside` and `layout` are an App page's alone: the Workbench's pages draw what they say, in the record's one skeleton. */\nconst WORKBENCH_PAGE_KEYS = PAGE_KEYS.filter((key) => key !== 'aside' && key !== 'layout');\nconst SECTION_COMMON = ['kind', 'title', 'icon', 'region', 'tab', 'width', 'offsetLeft', 'offsetRight', 'hidden', 'when'] as const;\n/** A tab's name is a word or two across the strip, not a sentence. */\nconst MAX_TAB_NAME = 40;\n/** The keys each page section kind takes. Anything else is refused by name. A `segment` is read before the\n section is (appSegments.ts unfoldSegments), as its word in `query`. */\n/* `view` is an authored kind with no section of its own: `embed(view, { whose })`\n is read into a related list that remembers the view (PageList.view). */\nexport const PAGE_SECTION_KEYS: Record<PageSection['kind'] | 'view' | 'header' | 'current' | 'card' | 'headline', readonly string[]> = {\n fields: [...SECTION_COMMON, 'show', 'columns', 'names', 'presentation', 'editable', 'empty'],\n /* The record a reference names, in a box of its own: the first shown field is its title, the rest its facts. */\n card: [...SECTION_COMMON, 'show'],\n /* A figure with its facts, its earlier value, its estimate and the calls to action beside it. */\n headline: [...SECTION_COMMON, 'show', 'links', 'subfigure', 'subtitle', 'was', 'note'],\n /* The record's head: drawn where the head is, so nothing that would place it elsewhere. */\n header: ['kind', 'status', 'facts', 'primary', 'destructive', 'actions'],\n /* The one current related row as a card: nothing to page, sum or add under it. */\n current: ['kind', 'title', 'icon', 'region', 'tab', 'width', 'when', 'from', 'whose', 'show', 'query', 'sort', 'empty', 'opens'],\n timeline: [...SECTION_COMMON, 'streams', 'limit', 'create', 'newest', 'composer', 'tone', 'compact', 'side', 'reactions'],\n history: [...SECTION_COMMON, 'limit'],\n flows: [...SECTION_COMMON],\n diagram: [...SECTION_COMMON],\n custom: [...SECTION_COMMON, 'component', 'record', 'rows', 'figures', 'props'],\n metric: [...SECTION_COMMON, 'from', 'whose', 'about', 'measure', 'query', 'segment', 'format', 'unit'],\n breakdown: [...SECTION_COMMON, 'from', 'whose', 'about', 'by', 'measure', 'query', 'segment', 'limit', 'format', 'unit', 'empty'],\n chart: [\n ...SECTION_COMMON,\n 'from',\n 'whose',\n 'about',\n 'by',\n 'measure',\n 'shape',\n 'curve',\n 'total',\n 'sort',\n 'query',\n 'segment',\n 'limit',\n 'height',\n 'target',\n 'format',\n 'unit',\n 'empty',\n ],\n note: [...SECTION_COMMON, 'text', 'action', 'variant'],\n view: [...SECTION_COMMON, 'view', 'whose', 'about', 'limit'],\n list: [\n ...SECTION_COMMON,\n 'from',\n 'whose',\n 'show',\n 'query',\n 'segment',\n 'limit',\n 'sort',\n 'create',\n 'empty',\n 'sizing',\n 'presentation',\n 'totals',\n 'same',\n 'near',\n 'opens',\n 'rowActions',\n 'actions',\n 'group',\n ],\n};\nexport const STREAM_KEYS = ['from', 'whose', 'at', 'text', 'badge', 'author', 'query', 'about', 'side', 'tone', 'compact'] as const;\n\n/**\n * One page body: a tablewalk.json page, whose `id` is its own or derives\n * from the name, or an App page, whose id is its key. The body is the same\n * either way, so the page builder, the scaffold and mistri check emit one\n * shape. Every key is checked: an unknown one is refused with the list.\n */\nexport function parsePageBody(\n p: Record<string, unknown>,\n at: string,\n id: string,\n withId = false,\n noun?: string,\n keys: readonly string[] = WORKBENCH_PAGE_KEYS,\n): PageDef {\n const caption = p.label === undefined ? undefined : parseCaption(p.label, `${at}.label`);\n if (typeof p.base !== 'string' || !p.base.trim()) {\n throw new Error(`${at}${typeof p.label === 'string' ? ` (\"${p.label.trim()}\")` : ''} has no \"base\" table.`);\n }\n /* A page is called what its records are: its resource's noun, else its table's name. */\n const name = caption ?? (noun ? headingOf(noun) : humanName(p.base.trim()));\n /* Said by name rather than as an unknown key: an author who copied an App's page into a tablewalk.json is told\n why it does not apply there, not that the word does not exist. */\n if (p.layout !== undefined && !keys.includes('layout')) {\n throw new Error(\n `[page-layout] ${at} (\"${name}\") has \"layout\", which is an App page's: a config file's page draws the record's one skeleton. Remove it.`,\n );\n }\n allowKeys(p, withId ? [...keys, 'id'] : keys, `${at} (\"${name}\")`, keys.includes('connection') ? PAGE_RENAMED : undefined);\n if (p.connection !== undefined && typeof p.connection !== 'string') {\n throw new Error(`${at} (\"${name}\") has a \"connection\" that is not a string.`);\n }\n /* Refused rather than coerced, like every other boolean in this file:\n `\"listTabs\": \"false\"` is a truthy string. */\n if (p.listTabs !== undefined && typeof p.listTabs !== 'boolean') {\n throw new Error(`${at} (\"${name}\") has \"listTabs\": ${JSON.stringify(p.listTabs)}. It must be true or false, without quotes.`);\n }\n /* The only value is the opt-out: a default aside is not something an author switches on. */\n if (p.aside !== undefined && p.aside !== false) {\n throw new Error(`${at} (\"${name}\") has \"aside\": ${JSON.stringify(p.aside)}. It can only be false, to leave the default aside out.`);\n }\n /* What every related list that says nothing of its own does while it has no rows. A list's own `empty` wins. */\n if (p.empty !== undefined && p.empty !== 'hide' && p.empty !== 'collapse') {\n throw new Error(\n `${at} (\"${name}\") has \"empty\": ${JSON.stringify(p.empty)}. A page's is 'hide' (leave an empty list out) or 'collapse' (say so in one line); a list takes guidance of its own.`,\n );\n }\n const pageEmpty = p.empty as 'hide' | 'collapse' | undefined;\n const sections = parseSections(p.sections, at, name, keys.includes('connection')).map((section) =>\n pageEmpty && section.kind === 'list' && section.presentation !== 'card' && !section.empty && !section.emptyMode\n ? { ...section, emptyMode: pageEmpty }\n : section,\n );\n return {\n id,\n name,\n base: p.base.trim(),\n sections,\n connection: p.connection as string | undefined,\n /* Stored as written: an App's page draws a tab strip of its lists only\n when it says `true`, and the Workbench's only unless it says `false`. */\n ...(typeof p.listTabs === 'boolean' ? { listTabs: p.listTabs } : {}),\n ...(pageEmpty ? { empty: pageEmpty } : {}),\n ...(p.aside === false ? { aside: false as const } : {}),\n ...(p.layout !== undefined ? { layout: parsePageLayout(p.layout, `${at} (\"${name}\")`) } : {}),\n source: 'config' as const,\n };\n}\n\nfunction parseSections(raw: unknown, at: string, name: string, config: boolean): PageSection[] {\n if (raw === undefined) return [{ kind: 'fields', width: 'full' }];\n if (!Array.isArray(raw)) throw new Error(`${at} (\"${name}\") has \"sections\" that are not an array.`);\n if (raw.length > MAX_PAGE_SECTIONS) {\n throw new Error(`${at} (\"${name}\") has more than ${MAX_PAGE_SECTIONS} sections, its tabs' included.`);\n }\n const sections = raw.map((entry, i) => parseSection(entry, `${at} (\"${name}\") section ${i + 1}`, config));\n /* A page is a screen, not a report: what one screen draws is counted, so a record that holds more says it in\n tabs, each a screen of its own (a major incident's comms log, bridge and review beside the ticket's work). */\n const drawn = screenSections(sections);\n if (drawn > MAX_SECTIONS) {\n throw new Error(\n `${at} (\"${name}\") has more than ${MAX_SECTIONS} sections on one screen (${drawn}). A page is a screen, not a report: ` +\n 'give some of them a \"tab\", and each tab is counted as a screen of its own.',\n );\n }\n /* A record has one head. */\n if (sections.filter((s) => s.kind === 'fields' && s.presentation === 'header').length > 1) {\n throw new Error(`${at} (\"${name}\") has two record headers. A record has one head: say every fact in one header({ … }).`);\n }\n /* A strip of one tab is a heading with a border round it: the name says\n \"these are tabs of each other\", which takes two. Each region has its own. */\n for (const region of SECTION_REGIONS) {\n const tabs = new Set(sections.filter((s) => (s.region ?? 'main') === region && s.tab).map((s) => s.tab));\n if (tabs.size === 1) {\n throw new Error(\n `${at} (\"${name}\") names one tab, \"${[...tabs][0]}\"${region === 'aside' ? ' in its side panel' : ''}. A tab strip needs two tabs or more: name another, or leave \"tab\" out.`,\n );\n }\n }\n return sections;\n}\n\n/**\n * A column count, refused rather than clamped.\n *\n * Clamping `\"columns\": 7` to 3 would render a layout nobody asked for and say\n * nothing about it; the file is the thing being edited, so the file is where\n * the mistake belongs.\n */\nfunction parseFieldColumns(value: unknown, at: string): FieldColumns | undefined {\n if (value === undefined || value === null) return undefined;\n const n = Number(value);\n if (!FIELD_COLUMNS.includes(n as FieldColumns)) {\n throw new Error(`${at} has \"columns\" of ${JSON.stringify(value)}. Use 1, 2 or 3.`);\n }\n return n as FieldColumns;\n}\n\n/** A boolean the file must spell as one — `\"true\"` is a truthy string. */\nfunction parseFlag(raw: unknown, at: string, key: string): boolean | undefined {\n if (raw === undefined) return undefined;\n if (typeof raw !== 'boolean') {\n throw new Error(`${at} has \"${key}\": ${JSON.stringify(raw)}. It must be true or false, without quotes.`);\n }\n return raw || undefined;\n}\n\n/* The spellings a section may not use any more, each mapped to the word\n that replaced it. Refused by name, in the parser's usual voice, so a page\n written against the pre-rename format fails with its fix rather than\n half-working. The renames (docs/apps.md, \"The respelling\"): `whose`\n says the direction `path` hid, `about` moves the subject the\n way `of` only implied, `show` and `sort` are the query\n language's own words. */\nconst RENAMED: Record<string, string> = {\n tint: '\"tone\", as a display rule says it: { kind: { internal: \\'warn\\' } } on the timeline, or one tone on a stream',\n order: \"\\\"newest\\\": 'first' (the default) or 'last', the way a conversation reads\",\n edit: '\"editable\", as a list view says it',\n path: '\"whose\" — the column on the section\\'s table that names this record, e.g. \"customer_id\" or \"invoice_id.customer_id\"',\n of: '\"about\" — the record this section is about, named by a reference column of the base, e.g. \"site_id\"',\n paths: '\"show\" — the fields to show, e.g. [\"name\", \"account_id.name\"]',\n orderBy: '\"sort\" — written like the query bar, e.g. \"due_on desc, name\"',\n};\n\nfunction refuseRenamed(s: Record<string, unknown>, at: string, keys: string[]): void {\n for (const key of keys) {\n if (s[key] !== undefined) throw new Error(`${at} has \"${key}\", which is now ${RENAMED[key]}.`);\n }\n}\n\n/* The forms of a fields section that are gone, and what each is now, in one place: they were refused one at a time,\n each in its own words, so an upgrade met them one load after another with no sight of the rest. Every refusal of\n one of them ends with this whole table. */\nconst RETIRED_FIELDS_FORMS: ReadonlyArray<readonly [string, string]> = [\n [\"fields(…, { presentation: 'card' })\", \"card(title, 'dealer_id', ['rating', 'city']): a section of its own\"],\n [\"fields(…, { presentation: 'headline' })\", \"headline('price', { was, subfigure, note, links }): a section of its own\"],\n [\"fields(…, { presentation: 'accordion' })\", \"gone: a group of fields is always open; use 'summary', 'facts', 'table' or 'properties'\"],\n ['fields(…, { collapsed })', 'gone with the accordion: leave it out'],\n ['fields(…, { actions })', 'headline(figure, { links })'],\n ['fields(…, { subfigure | was | note })', 'headline(figure, { subfigure | was | note })'],\n];\n/** The mapping as lines for a refusal's end, without a closing full stop. */\nconst retiredFieldsForms = (): string =>\n `Fields forms that are gone, and what each is now:\\n${RETIRED_FIELDS_FORMS.map(([was, now]) => ` ${was} → ${now}`).join('\\n')}`;\n\ntype FieldPresentation = 'summary' | 'headline' | 'facts' | 'table' | 'properties' | 'card';\n/* What `fields` itself says; a headline and a card are sections of their own, and read into fields on the way. */\nconst FIELD_PRESENTATIONS: readonly FieldPresentation[] = ['summary', 'facts', 'table', 'properties', 'headline', 'card'];\n/* A field name or a label path, as `show` takes them: \"price\", \"dealer_id.name\". */\nconst FIELD_PATH = /^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)*$/;\n\n/**\n * `measure` is the dashboard's word — \"count\", \"sum amount\" — and the one a\n * page metric or chart says, read into the planner's fn and column. Absent\n * is a count.\n */\nfunction parseMeasure(raw: unknown, at: string): { fn: PageMetric['fn']; column?: string } {\n if (raw === undefined) return { fn: 'count' };\n const m = /^\\s*(count|sum|avg|min|max)(?:\\s+(?:distinct\\s+)?([A-Za-z_][\\w]*))?(?:\\s+as\\s+\\w+)?\\s*$/i.exec(String(raw));\n if (!m) throw new Error(`${at} has a \"measure\" of \"${String(raw)}\" — write it like \"count\", \"sum amount\" or \"avg total as mean\".`);\n const fn = m[1].toLowerCase() as PageMetric['fn'];\n if (fn !== 'count' && !m[2])\n throw new Error(`${at} has a \"measure\" of \"${String(raw).trim()}\" with no column to ${fn}: write it like \"${fn} amount\".`);\n return { fn, ...(m[2] === undefined ? {} : { column: m[2].trim() }) };\n}\n\nfunction parseSection(entry: unknown, at: string, config: boolean): PageSection {\n if (!entry || typeof entry !== 'object' || Array.isArray(entry)) {\n throw new Error(`${at} is not an object.`);\n }\n let s = entry as Record<string, unknown>;\n let kind = s.kind === undefined ? 'fields' : String(s.kind);\n /* What a tablewalk.json page may say that an App's page may not: the options only the Workbench's page builder\n sets, which an App leaves out as it leaves out a section (a hidden one is simply not written). */\n if (!config) {\n for (const key of ['hidden', 'offsetLeft', 'names', 'sizing'] as const) {\n if (s[key] !== undefined)\n throw new Error(\n `${at} has \"${key}\", which only a config file page takes. ${\n key === 'hidden'\n ? 'An App leaves a section out instead of hiding it'\n : key === 'sizing'\n ? /* Nothing on a page's related list keeps its columns from crowding; said so, rather than a replacement invented. */\n 'An App page does not use it: a related table fits its pane. For a wide one, name fewer columns in \"show\", or give the table a list view of its own, where `sizing: \\'scroll\\'` is taken, and link to it'\n : 'An App page does not use it'\n }.`,\n );\n }\n }\n /* The record's head and the current card are kinds of their own as they\n are written, so a refusal says \"header\" and \"current\" as the author\n did; the page draws them as the fields and the list they are. */\n if (kind === 'header') {\n /* `factLabels` is the page model's reading of the facts (pageModel.ts),\n and its type is published, so an author finds it there and writes it.\n A fact's word has one spelling, in `facts` itself. */\n if (Object.hasOwn(s, 'factLabels'))\n throw new Error(\n `${at} has no \"factLabels\": a fact's word is said in \"facts\" itself, as { column: 'steps', after: 'step' }. It takes: ${PAGE_SECTION_KEYS.header.join(', ')}.`,\n );\n allowKeys(s, PAGE_SECTION_KEYS.header, at);\n return parseHeader(s, at);\n }\n const current = kind === 'current';\n if (current) {\n allowKeys(s, PAGE_SECTION_KEYS.current, at);\n s = { ...s, kind: 'list', presentation: 'card' };\n kind = 'list';\n } else if (kind === 'list' && s.presentation === 'card') {\n throw new Error(\n `${at}: a related list's presentation is \"gallery\" or a cards object; the one current row as a card is its own section, current(title, from, whose, { query, sort, show }).`,\n );\n }\n /* A card and a headline are written as the sections they are and drawn as the fields they show. */\n const written = kind;\n if (written === 'card' || written === 'headline') {\n allowKeys(\n s,\n PAGE_SECTION_KEYS[written],\n at,\n written === 'headline' ? { actions: 'is now \"links\": the calls to action beside the figure' } : {},\n );\n s = { ...s, kind: 'fields', presentation: written };\n kind = 'fields';\n }\n if (s.sizing !== undefined && kind !== 'list') throw new Error(`${at}: sizing belongs on a related list.`);\n if (s.region !== undefined && !SECTION_REGIONS.includes(s.region as SectionRegion)) {\n throw new Error(`${at} has an invalid \"region\". Use \"main\" or \"aside\".`);\n }\n const tab = s.tab === undefined ? undefined : parseCaption(s.tab, `${at}.tab`);\n if (tab && tab.length > MAX_TAB_NAME) {\n throw new Error(`${at} has a \"tab\" that is not a name of at most ${MAX_TAB_NAME} characters, like \"Details\".`);\n }\n /* Where a section is drawn: its region, and the tab of that region's strip. The sections that are about the\n record's surroundings rather than the record — a card of another record, the one current row, the change\n history — stand beside it unless the author puts them in the main column. */\n const region =\n (s.region as SectionRegion | undefined) ?? (written === 'card' || current || kind === 'history' ? ('aside' as const) : undefined);\n const placement = {\n ...(region === undefined ? {} : { region }),\n ...(tab === undefined ? {} : { tab }),\n ...(s.icon === undefined ? {} : { icon: parseIcon(s.icon, at) }),\n };\n if (s.create !== undefined && kind !== 'list' && kind !== 'timeline')\n throw new Error(`${at}: create belongs on a related list or a timeline.`);\n if (s.presentation !== undefined && kind !== 'fields' && kind !== 'list')\n throw new Error(`${at}: presentation belongs on fields (summary, facts, table, properties) or a related list (gallery, cards).`);\n const width = parseWidth(s.width, at);\n const offsetLeft = parseOffset(s.offsetLeft, at, 'offsetLeft');\n const offsetRight = parseOffset(s.offsetRight, at, 'offsetRight');\n const title = s.title === undefined ? undefined : isMessageRef(s.title) ? parseCaption(s.title, `${at}.title`) : String(s.title);\n const hidden = parseFlag(s.hidden, at, 'hidden');\n if (s.when !== undefined && (typeof s.when !== 'string' || !s.when.trim())) {\n throw new Error(`${at} has a \"when\" that is not a condition like \"status = converted\".`);\n }\n const when = s.when === undefined ? undefined : (s.when as string).trim();\n\n if (kind === 'fields') {\n refuseRenamed(s, at, ['paths', 'edit']);\n if (s.presentation === 'header')\n throw new Error(`${at}: the record's head is a section of its own, header({ status, facts, primary }), not a fields presentation.`);\n if (written === 'fields' && (s.presentation === 'card' || s.presentation === 'headline'))\n throw new Error(\n `${at}: a ${s.presentation} is its own section, ${\n s.presentation === 'card' ? \"card(title, 'dealer_id', ['rating', 'city'])\" : \"headline('price', { was, subfigure, note, links })\"\n }, not a fields presentation. ${retiredFieldsForms()}.`,\n );\n const authored =\n written === 'card' || written === 'headline' ? Object.fromEntries(Object.entries(s).filter(([k]) => k !== 'presentation')) : s;\n allowKeys(authored, PAGE_SECTION_KEYS[written === 'card' || written === 'headline' ? written : 'fields'], at, {\n collapsed: `is gone with the accordion: a group of fields is always open. ${retiredFieldsForms()}`,\n ...(written === 'fields'\n ? {\n actions: `belongs on a headline(figure, { links }). ${retiredFieldsForms()}`,\n subfigure: `belongs on a headline(figure, { subfigure }). ${retiredFieldsForms()}`,\n subtitle: `belongs on a headline(figure, { subtitle }). ${retiredFieldsForms()}`,\n was: `belongs on a headline(figure, { was }). ${retiredFieldsForms()}`,\n note: `belongs on a headline(figure, { note }). ${retiredFieldsForms()}`,\n }\n : {}),\n });\n if (s.show !== undefined && !Array.isArray(s.show)) {\n throw new Error(`${at} has a \"show\" that is not an array of field names.`);\n }\n if (s.presentation !== undefined && !FIELD_PRESENTATIONS.includes(s.presentation as FieldPresentation)) {\n throw new Error(\n `${at}: a fields presentation is \"summary\", \"facts\", \"table\" or \"properties\"${\n s.presentation === 'accordion' ? `; the accordion is gone: a group of fields is always open. ${retiredFieldsForms()}` : ''\n }.`,\n );\n }\n if (written === 'headline' && (!Array.isArray(s.show) || !s.show.length)) {\n throw new Error(`${at}: a headline shows its figure and its facts; name them in \"show\", the figure first.`);\n }\n if (s.presentation === 'facts' && (!Array.isArray(s.show) || !s.show.length)) {\n throw new Error(`${at}: a facts line says the values it names; name them in \"show\".`);\n }\n if (written === 'card' && (!Array.isArray(s.show) || !s.show.length)) {\n throw new Error(`${at}: a card is titled by its first field and says the rest as facts; name them in \"show\", the title first.`);\n }\n if (s.editable !== undefined && s.editable !== true)\n throw new Error(\n `${at} has \"editable\": ${JSON.stringify(s.editable)}. It is true, to edit the properties in place; leave it out otherwise.`,\n );\n if (s.editable === true && s.presentation !== undefined && !['summary', 'properties'].includes(s.presentation as string)) {\n throw new Error(\n `${at}: \"editable\" belongs on the fields a reader edits — a summary or a property rail; a ${String(s.presentation)} says values, it does not hold them.`,\n );\n }\n if (s.empty !== undefined && s.empty !== 'hide' && s.empty !== 'show') {\n throw new Error(\n `${at} has \"empty\": ${JSON.stringify(s.empty)}. A block of fields leaves out the values a record does not have ('hide') or says each as a dash ('show'); a property rail hides them unless it says 'show'.`,\n );\n }\n if (s.was !== undefined && (typeof s.was !== 'string' || !FIELD_PATH.test(s.was.trim()))) {\n throw new Error(`${at} has a \"was\" that is not a field name, like \"was_price\": the figure's earlier value.`);\n }\n if (s.subfigure !== undefined && (typeof s.subfigure !== 'string' || !FIELD_PATH.test(s.subfigure.trim()))) {\n throw new Error(`${at} has a \"subfigure\" that is not a field name or a label path like \"account_id.name\".`);\n }\n if (s.subtitle !== undefined && (typeof s.subtitle !== 'string' || !FIELD_PATH.test(s.subtitle.trim()))) {\n throw new Error(\n `${at} has a \"subtitle\" that is not a field name or a label path like \"income_frequency\": the line under the figure.`,\n );\n }\n if (s.note !== undefined && (typeof s.note !== 'string' || !s.note.trim() || s.note.trim().length > 300)) {\n throw new Error(`${at} has a \"note\" that is not text of at most 300 characters.`);\n }\n /* A reference says the record it names by default in an App, so the\n one thing worth writing is the opt-out. */\n if (s.names !== undefined && s.names !== false) {\n throw new Error(\n `${at} has \"names\": ${JSON.stringify(s.names)}. A reference shows the record it names by default; say false to keep the raw id, or leave it out.`,\n );\n }\n return {\n kind: 'fields',\n ...placement,\n title,\n width,\n offsetLeft,\n offsetRight,\n hidden,\n ...(when ? { when } : {}),\n paths: (s.show as string[] | undefined)?.map(String),\n columns: parseFieldColumns(s.columns, at),\n names: s.names === false ? false : undefined,\n ...(s.presentation === undefined ? {} : { presentation: s.presentation as FieldPresentation }),\n ...(s.editable === true ? { edit: true as const } : {}),\n ...(s.empty === 'hide' || s.empty === 'show' ? { emptyMode: s.empty } : {}),\n ...(s.links === undefined ? {} : { actions: parseHeadlineActions(s.links, at) }),\n ...(s.subfigure === undefined ? {} : { subfigure: (s.subfigure as string).trim() }),\n ...(s.subtitle === undefined ? {} : { subtitle: (s.subtitle as string).trim() }),\n ...(s.was === undefined ? {} : { was: (s.was as string).trim() }),\n ...(s.note === undefined ? {} : { note: (s.note as string).trim() }),\n };\n }\n\n if (kind === 'timeline') {\n refuseRenamed(s, at, ['tint', 'order']);\n allowKeys(s, PAGE_SECTION_KEYS.timeline, at);\n if (!Array.isArray(s.streams) || !s.streams.length) {\n throw new Error(`${at} is a timeline and needs \"streams\" — the dated child rows it merges.`);\n }\n if (s.streams.length > MAX_STREAMS) {\n throw new Error(`${at} merges more than ${MAX_STREAMS} streams.`);\n }\n const streams = (s.streams as unknown[]).map((raw, i) => {\n const here = `${at}, stream ${i + 1}`;\n if (!raw || typeof raw !== 'object' || Array.isArray(raw)) throw new Error(`${here} is not an object.`);\n const t = raw as Record<string, unknown>;\n refuseRenamed(t, here, ['path', 'tint']);\n /* The parts as the row draws them. `show` and `detail` read the opposite of how they were drawn (the main value\n leads, the badge sits beside who and when): they are refused with their new names, not read. */\n for (const [was, now] of [\n ['show', 'text'],\n ['detail', 'badge'],\n ] as const)\n if (t[was] !== undefined)\n throw new Error(\n `${here} has \"${was}\", which is now \"${now}\"${now === 'text' ? \" — the row's main value\" : ' — the quiet word beside who and when'}.`,\n );\n allowKeys(t, STREAM_KEYS, here);\n const from = typeof t.from === 'string' ? t.from.trim() : '';\n if (!from) throw new Error(`${here} has no \"from\" table.`);\n const path = typeof t.whose === 'string' ? t.whose.trim() : '';\n if (!path) throw new Error(`${here} has no \"whose\" — the column that leads back to this record.`);\n const atCol = typeof t.at === 'string' ? t.at.trim() : '';\n if (!atCol) throw new Error(`${here} has no \"at\" — the date column the stream is ordered by.`);\n const text = typeof t.text === 'string' ? t.text.trim() : '';\n if (!text) throw new Error(`${here} has no \"text\" — the line each row becomes.`);\n /* `query` is the one spelling; the internal stream keeps its `filter`.\n `author` says who wrote a row, where `by` groups one everywhere else;\n the internal stream keeps its `by`. */\n const filterRaw = t.query;\n /* `about` as a list's: the stream's rows lead to the row a reference of the record names (a deal's company),\n not to the record, so a timeline reaches its parent's other children. */\n if (t.about !== undefined && (typeof t.about !== 'string' || !t.about.trim() || t.about.includes('.')))\n throw new Error(`${here} has an \"about\" that is not a reference column of the page's table, e.g. \"company_id\".`);\n /* The stream's own far side, where its rows name the other party in their own words (`person_id`, not `author_id`). */\n if (t.side !== undefined && (typeof t.side !== 'string' || !t.side.trim()))\n throw new Error(`${here} has a \"side\" that is not a condition like \"person_id = record.caller_id\".`);\n /* The stream's own dress, where every row of it is one kind (time logged, a system event): no column to name. */\n if (t.tone !== undefined && !(TIMELINE_TONES as readonly unknown[]).includes(t.tone))\n throw new Error(`${here} has a \"tone\" that is not one of ${TIMELINE_TONES.join(', ')}: every row of this stream wears it.`);\n if (t.compact !== undefined && t.compact !== true)\n throw new Error(`${here} has a \"compact\" that is not true: every row of this stream is one line, or leave it out.`);\n return {\n ...(typeof t.about === 'string' ? { of: t.about.trim() } : {}),\n from,\n path,\n at: atCol,\n text,\n badge: t.badge === undefined ? undefined : String(t.badge).trim() || undefined,\n by: t.author === undefined ? undefined : String(t.author).trim() || undefined,\n filter: filterRaw === undefined ? undefined : String(filterRaw).trim() || undefined,\n ...(typeof t.side === 'string' ? { side: t.side.trim() } : {}),\n ...(t.tone === undefined ? {} : { tone: t.tone as TimelineTone }),\n ...(t.compact === true ? { compact: true as const } : {}),\n };\n });\n const limit = s.limit === undefined ? undefined : Number(s.limit);\n if (limit !== undefined && (!Number.isInteger(limit) || limit < 1)) {\n throw new Error(`${at} has a \"limit\" that is not a positive whole number.`);\n }\n if (s.newest !== undefined && s.newest !== 'first' && s.newest !== 'last') {\n throw new Error(`${at} has a \"newest\" that is neither 'first' (the default) nor 'last' (a conversation, read down to the latest).`);\n }\n const composer = s.composer === undefined ? undefined : parseTimelineComposer(s.composer, at);\n const tone = s.tone === undefined ? undefined : parseTimelineTone(s.tone, at);\n const compact = s.compact === undefined ? undefined : parseTimelineCompact(s.compact, at);\n /* The other party's rows: a condition in the query language over each stream's rows, where `record.<column>` is\n the page's record. Judged per stream against the catalog with the rest of the section (page.ts timelineSides). */\n if (s.side !== undefined && (typeof s.side !== 'string' || !s.side.trim())) {\n throw new Error(`${at} has a \"side\" that is not a condition like \"author_id = record.caller_id\".`);\n }\n const side = typeof s.side === 'string' ? s.side.trim() : undefined;\n const reactions = s.reactions === undefined ? undefined : parseTimelineReactions(s.reactions, at);\n if (composer && s.create !== undefined) {\n throw new Error(\n `${at} has both \"composer\" and \"create\": a conversation's composer is the commands' (reply, note), and \"create\" is the form's. Keep one.`,\n );\n }\n return {\n kind: 'timeline',\n ...placement,\n title,\n streams,\n limit,\n width,\n offsetLeft,\n offsetRight,\n hidden,\n ...(s.newest === 'last' ? { newest: 'last' as const } : {}),\n ...(composer ? { composer } : {}),\n ...(tone ? { tone } : {}),\n ...(compact ? { compact } : {}),\n ...(side ? { side } : {}),\n ...(reactions ? { reactions } : {}),\n ...(s.create === undefined ? {} : { create: parseRelatedCreate(s.create, at) }),\n ...(when ? { when } : {}),\n };\n }\n\n if (kind === 'custom') {\n allowKeys(s, PAGE_SECTION_KEYS.custom, at, CUSTOM_RENAMED);\n /* The author's own component, placed like any section: its reads are\n declared, so the planner checks and runs them (appComponents.ts). */\n const component = parseComponentDecl(s.component, `${at}, \"component\"`, 'section');\n const parsed = parsePageReads(s.rows, at);\n const reads =\n parsed &&\n Object.fromEntries(\n Object.entries(parsed).map(([name, read]) => [\n name,\n read.sort === undefined ? read : { ...read, orderBy: parseSort(read.sort, `${at}, rows \"${name}\"`) },\n ]),\n );\n const totals = parsePageTotals(s.figures, at);\n return {\n kind: 'custom',\n ...placement,\n title,\n width,\n offsetLeft,\n offsetRight,\n hidden,\n ...(when ? { when } : {}),\n component,\n ...(s.record === undefined ? {} : { record: parseRecordFields(s.record, at) }),\n ...(reads ? { reads } : {}),\n ...(totals ? { aggregates: totals } : {}),\n props: componentPropValues(component, s.props, at),\n };\n }\n\n if (kind === 'history') {\n allowKeys(s, PAGE_SECTION_KEYS.history, at);\n const limit = s.limit === undefined ? undefined : Number(s.limit);\n if (limit !== undefined && (!Number.isInteger(limit) || limit < 1 || limit > MAX_HISTORY_LIMIT)) {\n throw new Error(`${at} has a \"limit\" that is not a whole number from 1 to ${MAX_HISTORY_LIMIT}.`);\n }\n return {\n kind: 'history',\n ...placement,\n title,\n width,\n offsetLeft,\n offsetRight,\n hidden,\n ...(limit === undefined ? {} : { limit }),\n ...(when ? { when } : {}),\n };\n }\n\n if (kind === 'flows' || kind === 'diagram') {\n allowKeys(s, PAGE_SECTION_KEYS[kind], at);\n return {\n kind,\n ...placement,\n title,\n width,\n offsetLeft,\n offsetRight,\n hidden,\n ...(when ? { when } : {}),\n };\n }\n\n if (kind === 'note') {\n allowKeys(s, PAGE_SECTION_KEYS.note, at);\n if (typeof s.text !== 'string' || !s.text.trim()) throw new Error(`${at} is a note and has no \"text\" — the words it says.`);\n let action: AppLinkAction | undefined;\n if (s.action !== undefined) {\n action = parseAppLinkAction(s.action, `${at}, \"action\"`, true);\n }\n if (s.variant !== undefined && s.variant !== 'quiet' && s.variant !== 'callout') {\n throw new Error(\n `${at} has a \"variant\" of ${JSON.stringify(s.variant)}: a note is \"quiet\" (small print, no mark) or a \"callout\" (a ground of its own); leave it out for the plain note.`,\n );\n }\n return {\n kind: 'note',\n ...placement,\n title,\n width,\n offsetLeft,\n offsetRight,\n hidden,\n ...(when ? { when } : {}),\n ...(s.variant === undefined ? {} : { variant: s.variant as 'quiet' | 'callout' }),\n text: s.text.trim(),\n ...(action ? { action } : {}),\n };\n }\n\n if (kind === 'view') {\n allowKeys(s, PAGE_SECTION_KEYS.view, at);\n if (typeof s.view !== 'string' || !s.view.trim()) throw new Error(`${at} embeds no \"view\" — the key of one of the App's list views.`);\n const path = typeof s.whose === 'string' ? s.whose.trim() : '';\n if (!path) {\n throw new Error(\n `${at} embeds \"${s.view.trim()}\" with no \"whose\" — on a page, an embedded list shows the rows *whose* named column ` +\n \"is this record: embed('invoices', { whose: 'customer_id' }).\",\n );\n }\n if (s.about !== undefined && (typeof s.about !== 'string' || !s.about.trim())) {\n throw new Error(`${at} has an \"about\" that is not a non-empty string.`);\n }\n if (s.limit !== undefined && (typeof s.limit !== 'number' || !Number.isInteger(s.limit) || s.limit < 1)) {\n throw new Error(`${at} has a \"limit\" that is not a positive whole number.`);\n }\n return {\n kind: 'list',\n ...placement,\n title,\n width,\n offsetLeft,\n offsetRight,\n hidden,\n ...(when ? { when } : {}),\n view: s.view.trim(),\n from: '',\n path,\n ...(s.about === undefined ? {} : { of: (s.about as string).trim() }),\n ...(s.limit === undefined ? {} : { limit: s.limit as number }),\n };\n }\n\n if (kind !== 'metric' && kind !== 'list' && kind !== 'breakdown' && kind !== 'chart') {\n throw new Error(\n `${at} has an unknown kind \"${kind}\". Use \"fields\", \"metric\", \"list\", \"breakdown\", \"chart\", \"note\", \"timeline\", \"history\", \"flows\", \"diagram\", \"custom\" or \"view\" (an embedded list view); ` +\n 'in an App, each is written with its helper: fields(), metric(), related(), breakdown(), chart(), note(), timeline(), history(), flows(), diagram(), custom(), embed().',\n );\n }\n\n refuseRenamed(s, at, kind === 'list' ? ['path', 'of', 'orderBy'] : ['path', 'of', 'orderBy', 'edit']);\n if (kind === 'list' && s.columns !== undefined) {\n throw new Error(`${at} has \"columns\", which is now \"show\" — the columns the list shows, e.g. [\"due_on\", \"status\"].`);\n }\n allowKeys(\n s,\n PAGE_SECTION_KEYS[kind],\n at,\n kind === 'list'\n ? {\n about: 'a related list no longer takes: a row that shares a column with the record is found by { same: [column] }',\n similar: \"is now the list's own match: related(title, from, { same: [column], near: { column: 0.25 } })\",\n editable: 'is gone: the lines of a record are edited in its form (a form\\'s \"lines\")',\n order: 'is gone with the editable lines; a list sorts with \"sort\"',\n }\n : {\n subtitle:\n \"is a second line under a record's own figure, read from a column of the record (headline(figure, { subtitle })); \" +\n 'a measured figure has no record\\'s column to read it from. Say it in the figure\\'s \"unit\" or its title',\n },\n );\n const from = typeof s.from === 'string' ? s.from.trim() : '';\n if (!from) throw new Error(`${at} has no \"from\" table.`);\n const similar = kind === 'list' && s.same !== undefined ? parseMatch(s, at) : undefined;\n if (kind === 'list' && s.near !== undefined && s.same === undefined)\n throw new Error(`${at} has \"near\" without \"same\": a match is the columns a row shares with the record, and the numbers it keeps near.`);\n const path = similar ? '' : typeof s.whose === 'string' ? s.whose.trim() : '';\n if (!path && !similar) {\n throw new Error(\n `${at} has no \"whose\" — the rows shown are the ${from} rows *whose* named column ` +\n 'is this record: \"customer_id\" for the customer\\'s own rows, ' +\n '\"invoice_id.customer_id\" for rows two references away; or, to list the rows that share its values, \"same\".',\n );\n }\n /* `query` is the one word for narrowing rows, on a page section as on a\n dashboard's; the internal section keeps its `filter`. */\n const filter = s.query === undefined ? undefined : String(s.query).trim() || undefined;\n /* `about` moves a figure's subject one reference away from the\n root: \"tickets at this order's site\" is { from: \"ticket\", whose:\n \"site_id\", about: \"site_id\" }. Absent means the root itself. */\n if (s.about !== undefined && (typeof s.about !== 'string' || !s.about.trim())) {\n throw new Error(`${at} has an \"about\" that is not a non-empty string.`);\n }\n const of = s.about === undefined ? undefined : (s.about as string).trim();\n\n /* A figure said as a dashboard's is (appViews.ts): an average of a 1–5 rating has no column rule to say it, and\n drew \"3.333\" with nothing after it; a win rate `avg won * 100` is a percent (G111). */\n if (s.format !== undefined && !(FIGURE_FORMATS as readonly string[]).includes(String(s.format)))\n throw new Error(`${at} has a \"format\" of \"${String(s.format)}\". Use ${FIGURE_FORMAT_WORDS}.`);\n if (s.unit !== undefined && (typeof s.unit !== 'string' || !s.unit.trim() || s.unit.length > 24))\n throw new Error(`${at} has a \"unit\" that is not a short word said after the figure, like \"days\".`);\n const figureWords = {\n ...(s.format === undefined ? {} : { format: s.format as PageMetric['format'] }),\n ...(s.unit === undefined ? {} : { unit: (s.unit as string).trim() }),\n };\n\n if (kind === 'metric') {\n const { fn, column: columnRaw } = parseMeasure(s.measure, at);\n return {\n kind: 'metric',\n ...placement,\n title,\n width,\n offsetLeft,\n offsetRight,\n hidden,\n ...(when ? { when } : {}),\n fn: fn as PageMetric['fn'],\n from,\n path,\n of,\n column: columnRaw === undefined ? undefined : String(columnRaw).trim(),\n filter,\n ...figureWords,\n };\n }\n\n if (kind === 'chart') {\n const by = typeof s.by === 'string' ? s.by.trim() : '';\n if (!by) throw new Error(`${at} has no \"by\" — what its groups are: \"status\", or a bucketed date like \"month issued_on\".`);\n if (s.shape !== undefined && !(CHART_SHAPES as readonly string[]).includes(String(s.shape))) {\n throw new Error(`${at} has a \"shape\" of \"${String(s.shape)}\". Use \"line\", \"bar\", \"donut\" or \"stacked\".`);\n }\n if (s.shape === 'stacked' && !by.includes(',')) {\n throw new Error(\n `${at} is a stacked chart and needs a two-key \"by\" — \"month issued_on, status\": a bar for each month, divided by status.`,\n );\n }\n if (s.limit !== undefined && (typeof s.limit !== 'number' || !Number.isInteger(s.limit) || s.limit < 1)) {\n throw new Error(`${at} has a \"limit\" that is not a positive whole number.`);\n }\n if (s.height !== undefined && (typeof s.height !== 'number' || !Number.isFinite(s.height) || s.height < 120)) {\n throw new Error(`${at} has a \"height\" that is not a number of pixels (120 or more).`);\n }\n if (s.target !== undefined && (typeof s.target !== 'number' || !Number.isFinite(s.target))) {\n throw new Error(`${at} has a \"target\" that is not a number.`);\n }\n if (s.target !== undefined && s.shape === 'donut')\n throw new Error(`${at} is a donut, which has no scale to draw a \"target\" on. Use a line or stacked bars.`);\n let sort: string | undefined;\n if (s.sort !== undefined) {\n if (s.shape !== 'bar' && s.shape !== 'donut')\n throw new Error(`${at} has a \"sort\", which orders the categories of a bar chart or a donut; a line runs along its key.`);\n if (s.sort === 'value' || s.sort === 'category') sort = s.sort;\n else {\n const parsed = parseSortText(s.sort, at, 'starts_on');\n if (parsed!.length !== 1 || parsed![0].column.includes('.'))\n throw new Error(\n `${at} has a \"sort\" of more than one column or a path; categories are ordered by 'value', 'category' or one column of the rows: \"starts_on desc\".`,\n );\n sort = parsed![0].direction === 'desc' ? `${parsed![0].column} desc` : parsed![0].column;\n }\n }\n if (s.curve !== undefined) {\n if (s.curve !== 'smooth' && s.curve !== 'straight')\n throw new Error(`${at} has a \"curve\" of ${JSON.stringify(s.curve)}. Use \"smooth\" or \"straight\".`);\n if (s.shape !== undefined && s.shape !== 'line') throw new Error(`${at} is a ${String(s.shape)} chart; only a line has a \"curve\".`);\n }\n if (s.total !== undefined) {\n if (s.shape !== 'donut') throw new Error(`${at} has a \"total\", which names a donut's middle figure; it is not a donut.`);\n if (typeof s.total !== 'string' || !s.total.trim() || s.total.trim().length > 40)\n throw new Error(`${at} has a \"total\" that is not a few words (at most 40 characters): what the middle figure counts.`);\n }\n if (s.empty !== undefined && s.empty !== 'hide')\n throw new Error(\n `${at} has \"empty\": ${JSON.stringify(s.empty)}. A chart takes 'hide', which leaves it out while it has nothing to draw.`,\n );\n const { fn, column } = parseMeasure(s.measure, at);\n return {\n kind: 'chart',\n ...placement,\n title,\n width,\n offsetLeft,\n offsetRight,\n hidden,\n ...(when ? { when } : {}),\n from,\n path,\n of,\n by,\n fn,\n ...(column === undefined ? {} : { column }),\n ...(s.shape === undefined ? {} : { shape: s.shape as PageChart['shape'] }),\n ...(sort ? { sort } : {}),\n filter,\n ...(s.limit === undefined ? {} : { limit: s.limit as number }),\n ...(s.height === undefined ? {} : { height: s.height as number }),\n ...(s.target === undefined ? {} : { target: s.target as number }),\n ...(s.curve === undefined ? {} : { curve: s.curve as 'smooth' | 'straight' }),\n ...(s.total === undefined ? {} : { total: (s.total as string).trim() }),\n ...(s.empty === 'hide' ? { emptyMode: 'hide' as const } : {}),\n ...figureWords,\n };\n }\n\n if (kind === 'breakdown') {\n const by = typeof s.by === 'string' ? s.by.trim() : '';\n if (!by) {\n throw new Error(`${at} has no \"by\" — the column its groups are counted under.`);\n }\n if (s.limit !== undefined && (typeof s.limit !== 'number' || !Number.isInteger(s.limit) || s.limit < 1)) {\n throw new Error(`${at} has a \"limit\" that is not a positive whole number.`);\n }\n if (s.empty !== undefined && s.empty !== 'hide')\n throw new Error(\n `${at} has \"empty\": ${JSON.stringify(s.empty)}. A breakdown takes 'hide', which leaves it out while it has nothing to count.`,\n );\n const measure = parseMeasure(s.measure, at);\n return {\n kind: 'breakdown',\n // A count is what a breakdown says when it says nothing.\n ...(measure.fn === 'count' && measure.column === undefined\n ? {}\n : { fn: measure.fn, ...(measure.column === undefined ? {} : { column: measure.column }) }),\n ...placement,\n title,\n width,\n offsetLeft,\n offsetRight,\n hidden,\n ...(when ? { when } : {}),\n from,\n path,\n of,\n by,\n filter,\n limit: s.limit as number | undefined,\n ...(s.empty === 'hide' ? { emptyMode: 'hide' as const } : {}),\n ...figureWords,\n };\n }\n\n if (s.limit !== undefined && (typeof s.limit !== 'number' || !Number.isInteger(s.limit) || s.limit < 1)) {\n throw new Error(`${at} has a \"limit\" that is not a positive whole number.`);\n }\n if (s.show !== undefined && !Array.isArray(s.show)) {\n throw new Error(`${at} has a \"show\" that is not an array of column names.`);\n }\n const shown = s.show === undefined ? undefined : parseShowEntries(s.show as unknown[], at);\n /* A gallery draws a related list of image files; whether the rows are\n files is the App's to say (`file` on the resource), judged where the\n page meets the App. */\n /* Or its rows as cards, in the list view's own cards grammar: the same\n keys, judged against the catalog where the page meets the App. */\n let cards: AppCardsList | undefined;\n /* The one current row as a card — the active lease, the latest visit —\n chosen by the list's query and sort: one row, so nothing to page, sum\n or add under it. */\n /* The reference a card over a link table opens, instead of the link row: judged against the catalog with the page. */\n if (s.opens !== undefined && !current) throw new Error(`${at} has \"opens\", which belongs on a current() card.`);\n if (s.opens !== undefined && (typeof s.opens !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(s.opens.trim())))\n throw new Error(`${at} has an \"opens\" that is not a reference column of \"${from}\", e.g. \"conversation_id\".`);\n if (current && (s.empty === false || s.empty === 'collapse'))\n throw new Error(\n `${at} is a current() card; say what no row means with \"empty\" guidance, or leave it out while there is none with empty: 'hide'.`,\n );\n if (s.presentation !== undefined && s.presentation !== 'gallery' && !current) {\n const raw = s.presentation;\n if (!raw || typeof raw !== 'object' || Array.isArray(raw) || (raw as Record<string, unknown>).kind !== 'cards') {\n throw new Error(`${at}: a related list's presentation is \"gallery\" or a cards object { kind: 'cards', primary, … }.`);\n }\n const c = raw as Record<string, unknown>;\n allowKeys(\n c,\n ['kind', 'primary', 'description', 'value', 'badge', 'icon', 'properties', 'facts', 'footer', 'image', 'media'],\n `${at}, presentation (cards)`,\n { lines: 'is now \"properties\": the captioned values under the title (\"facts\" stays the dotted line)' },\n );\n if (typeof c.primary !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)?$/.test(c.primary.trim()))\n throw new Error(`${at}, presentation (cards): \"primary\" must be a local column or a one-hop path like \"vehicle_id.title\".`);\n if (\n c.properties !== undefined &&\n (!Array.isArray(c.properties) ||\n c.properties.length > CARDS_MAX_LINES ||\n c.properties.some((line) => typeof line !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)?$/.test(line.trim())))\n ) {\n throw new Error(`${at}, presentation (cards): \"properties\" must be at most ${CARDS_MAX_LINES} local columns or one-hop label paths.`);\n }\n cards = parseCards(\n c,\n `${at}, presentation (cards)`,\n c.primary.trim(),\n ((c.properties as string[] | undefined) ?? []).map((line) => line.trim()),\n );\n }\n /* `empty` is the guidance a list with no rows shows, or what to do with the list instead: 'hide' leaves it out\n until it has a row (a manager's direct reports, on a page most people's are none), 'collapse' says it in one\n quiet line with the other empty lists beside it. Where the reader may add a row, 'hide' collapses rather than\n hides: a list that offers a door is never taken away (PageSections.tsx). */\n if (s.empty === true)\n throw new Error(\n `${at} has \"empty: true\". \"empty\" is guidance ({ title, description, action }), 'hide' to leave the list out while it has no rows, or 'collapse' to say so in one line.`,\n );\n if (s.empty === false) throw new Error(`${at} has \"empty: false\", which is now \"empty: 'hide'\".`);\n const emptyMode = s.empty === 'hide' || s.empty === 'collapse' ? s.empty : undefined;\n /* A footer of sums, the list view's `totals`: over every row that points\n at the record, not the page, so it is one aggregate over the rows the\n path reaches and never through a filter. */\n let totals: string[] | undefined;\n if (s.totals !== undefined) {\n if (\n !Array.isArray(s.totals) ||\n !s.totals.length ||\n s.totals.some((c) => typeof c !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(c))\n ) {\n throw new Error(`${at} has \"totals\" that are not a list of the rows' numeric columns, rollups or computed numbers.`);\n }\n if (new Set(s.totals).size !== s.totals.length) throw new Error(`${at} has \"totals\" that name one column twice.`);\n if (s.presentation !== undefined)\n throw new Error(\n `${at} has \"totals\" and a ${s.presentation === 'gallery' ? 'gallery' : 'cards'} presentation; a footer of totals belongs to a table.`,\n );\n const narrowed = ['query', 'near'].filter((key) => s[key] !== undefined && s[key] !== false);\n if (narrowed.length) {\n throw new Error(\n `${at} has \"totals\" and \"${narrowed[0]}\". Totals sum every row that points at the record and cannot be narrowed; drop one, or add a total() metric beside the list.`,\n );\n }\n totals = s.totals as string[];\n }\n const group = parseGroup(s, at, { similar: Boolean(similar), presentation: s.presentation, current });\n /* The child's own verbs, from a ⋯ at the end of each row, as its own page offers them: a table's, never a card's or a photo's. */\n if (s.rowActions !== undefined && s.rowActions !== true && s.rowActions !== false)\n throw new Error(`${at}: \"rowActions\" must be true (a ⋯ menu on each row with the row's own actions) or false.`);\n if (s.rowActions === true && s.presentation !== undefined)\n throw new Error(`${at} has \"rowActions\" and a presentation; a row menu belongs to a table.`);\n /* The record's own verbs that add to this list — \"Add to the committee\" on a deal — drawn in the list's head\n rather than the record's, by the ids its resource's actions have (checked against them where the App is). */\n let listActions: string[] | undefined;\n if (s.actions !== undefined) {\n if (\n !Array.isArray(s.actions) ||\n !s.actions.length ||\n s.actions.length > 4 ||\n s.actions.some((id) => typeof id !== 'string' || !id.trim())\n )\n throw new Error(`${at}: \"actions\" is one to four of the record's own action ids, drawn in the list's head: ['addBuyer'].`);\n listActions = (s.actions as string[]).map((id) => id.trim());\n if (new Set(listActions).size !== listActions.length) throw new Error(`${at} has \"actions\" naming one action twice.`);\n }\n return {\n kind: 'list',\n ...placement,\n ...(s.sizing === undefined ? {} : { sizing: parseTableSizing(s.sizing, at) }),\n ...(s.presentation === 'gallery' || s.presentation === 'card'\n ? { presentation: s.presentation }\n : cards\n ? { presentation: cards }\n : {}),\n ...(similar ? { similar } : {}),\n title,\n width,\n offsetLeft,\n offsetRight,\n hidden,\n ...(when ? { when } : {}),\n from,\n path,\n columns: shown?.columns,\n ...(shown?.labels ? { labels: shown.labels } : {}),\n filter,\n limit: s.presentation === 'card' ? 1 : (s.limit as number | undefined),\n ...(typeof s.opens === 'string' ? { opens: s.opens.trim() } : {}),\n orderBy: parseSort(s.sort, at),\n ...(s.create === undefined ? {} : s.create === false ? { noCreate: true as const } : { create: parseRelatedCreate(s.create, at) }),\n ...(s.empty === undefined || emptyMode ? {} : { empty: parseListEmpty(s.empty, at) }),\n ...(emptyMode ? { emptyMode } : {}),\n ...(group ? { group } : {}),\n ...(totals ? { totals } : {}),\n ...(s.rowActions === true ? { rowActions: true as const } : {}),\n ...(listActions ? { listActions } : {}),\n };\n}\n\n/**\n * A related list's `group`: one header for each record its rows share through `by`, the rows to a group under it.\n * One level only. `limit` beside it is the rows to a group, so it is held to what a group opens to.\n */\nfunction parseGroup(\n s: Record<string, unknown>,\n at: string,\n beside: { similar: boolean; presentation: unknown; current: boolean },\n): PageGroup | undefined {\n if (s.group === undefined) return undefined;\n const raw = s.group;\n if (!raw || typeof raw !== 'object' || Array.isArray(raw))\n throw new Error(\n `${at} has a \"group\" that is not an object: group: { by: 'estimate_id', show: ['vehicle_id', 'total'], sort: 'created_on desc', limit: 5 }.`,\n );\n if (beside.current) throw new Error(`${at} is a current() card, which is one row and has nothing to group.`);\n if (beside.similar)\n throw new Error(`${at} has \"group\" and \"same\": a matched list is not the record's children, so it has no chain worth grouping.`);\n if (beside.presentation !== undefined)\n throw new Error(\n `${at} has \"group\" and a ${beside.presentation === 'gallery' ? 'gallery' : 'cards'} presentation; groups are drawn as tables.`,\n );\n const g = raw as Record<string, unknown>;\n allowKeys(g, ['by', 'show', 'sort', 'limit', 'empty', 'sum'], `${at}, group`);\n if (typeof g.by !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)*$/.test(g.by.trim()))\n throw new Error(`${at}, group has no \"by\": the column or reference the rows are grouped under, like \"estimate_id\".`);\n if (g.show !== undefined) {\n if (\n !Array.isArray(g.show) ||\n !g.show.length ||\n g.show.length > 4 ||\n g.show.some((c) => typeof c !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(c))\n )\n throw new Error(`${at}, group has a \"show\" that is not one to four columns of the record each group is: ['vehicle_id', 'total'].`);\n if (new Set(g.show).size !== g.show.length) throw new Error(`${at}, group has a \"show\" that names one column twice.`);\n }\n let sort: PageGroup['sort'];\n if (g.sort !== undefined) {\n const parsed = parseSortText(g.sort, `${at}, group`, 'created_on desc')!;\n if (parsed.length !== 1 || parsed[0].column.includes('.'))\n throw new Error(\n `${at}, group has a \"sort\" of more than one column or a path; groups are ordered by one column of their record: \"created_on desc\".`,\n );\n sort = { column: parsed[0].column, direction: parsed[0].direction };\n }\n if (g.limit !== undefined && (typeof g.limit !== 'number' || !Number.isInteger(g.limit) || g.limit < 1 || g.limit > GROUPS_MOST))\n throw new Error(`${at}, group has a \"limit\" that is not a whole number of groups from 1 to ${GROUPS_MOST}.`);\n // A msg() is said by the loader before a page is read; one that reaches here has no catalog to say it.\n if (isMessageRef(g.empty)) parseCaption(g.empty, `${at}.group.empty`);\n if (g.empty !== undefined && (typeof g.empty !== 'string' || !g.empty.trim() || g.empty.length > 60))\n throw new Error(`${at}, group has an \"empty\" that is not a short name for the rows with no value: 'Backlog'.`);\n let sum: string[] | undefined;\n if (g.sum !== undefined) {\n const named = typeof g.sum === 'string' ? [g.sum] : g.sum;\n if (\n !Array.isArray(named) ||\n named.length < 1 ||\n named.length > 2 ||\n named.some((c) => typeof c !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(c))\n )\n throw new Error(`${at}, group has a \"sum\" that is not one or two numeric columns of the rows: 'points' or ['points', 'hours'].`);\n if (new Set(named).size !== named.length) throw new Error(`${at}, group has a \"sum\" that names one column twice.`);\n sum = named as string[];\n }\n if (typeof s.limit === 'number' && s.limit > GROUP_ROWS_MOST)\n throw new Error(`${at} has a \"limit\" of ${s.limit} beside \"group\", where it is the rows to a group: at most ${GROUP_ROWS_MOST}.`);\n return {\n by: g.by.trim(),\n ...(g.show ? { show: g.show as string[] } : {}),\n ...(sort ? { sort } : {}),\n ...(g.limit === undefined ? {} : { limit: g.limit as number }),\n ...(g.empty === undefined ? {} : { empty: (g.empty as string).trim() }),\n ...(sum ? { sum } : {}),\n };\n}\n\n/* The record's header: the head the page already draws — its noun over the\n name, the verbs beside it — with the status chip and the facts line an\n author names. It is drawn in the head, not where it is written, so what\n would move it (a region, a tab, a width) is refused rather than ignored. */\nfunction parseHeader(s: Record<string, unknown>, at: string): PageSection {\n if (s.status !== undefined && (typeof s.status !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(s.status.trim()))) {\n throw new Error(`${at} has a \"status\" that is not one of the record's own columns, like \"stage\".`);\n }\n if (\n s.destructive !== undefined &&\n (!Array.isArray(s.destructive) || !s.destructive.length || s.destructive.some((id) => typeof id !== 'string' || !id.trim()))\n ) {\n throw new Error(`${at} has a \"destructive\" that is not a list of the record's action ids, like ['markLost'].`);\n }\n /* The one verb drawn filled: the one the record most needs next, which\n is never one that takes something away. Whether each id is one of the\n base resource's actions is the App's to judge (apps.ts), where both are known. */\n if (s.primary !== undefined && (typeof s.primary !== 'string' || !s.primary.trim())) {\n throw new Error(`${at} has a \"primary\" that is not the id of one of the record's actions, like 'renew'.`);\n }\n if (\n s.actions !== undefined &&\n (!Array.isArray(s.actions) ||\n !s.actions.length ||\n s.actions.some((id) => typeof id !== 'string' || !id.trim()) ||\n new Set(s.actions.map((id) => String(id).trim())).size !== s.actions.length)\n ) {\n throw new Error(`${at} has \"actions\" that are not a list of the record's action ids, each once, like ['resolve', 'reassign'].`);\n }\n /* The filled verb is one the head draws. */\n if (\n Array.isArray(s.actions) &&\n typeof s.primary === 'string' &&\n !s.actions.some((id) => String(id).trim() === (s.primary as string).trim())\n ) {\n throw new Error(`${at} has \"primary\" \"${s.primary}\", which is not one of its \"actions\": the head cannot fill a verb it does not draw.`);\n }\n if (\n typeof s.primary === 'string' &&\n Array.isArray(s.destructive) &&\n s.destructive.some((id) => typeof id === 'string' && id.trim() === (s.primary as string).trim())\n ) {\n throw new Error(\n `${at} names \"${s.primary}\" both \"primary\" and \"destructive\": the filled button is the forward verb, and a destructive one is drawn last and quiet.`,\n );\n }\n /* A header with only a `primary` or its `destructive` verbs is the head\n the page draws anyway, told which verb to fill: worth writing. One that\n says nothing is a slip. */\n if (['status', 'facts', 'primary', 'destructive', 'actions'].every((key) => s[key] === undefined)) {\n throw new Error(\n `${at}: a record header says something: a \"status\", \"facts\", its \"primary\" verb, its \"destructive\" ones or the \"actions\" it draws.`,\n );\n }\n const facts = s.facts === undefined ? undefined : parseFacts(s.facts, `${at}, header`, 'facts', HEADER_MAX_FACTS);\n return {\n kind: 'fields',\n presentation: 'header',\n paths: facts?.facts ?? [],\n ...(facts?.factLabels ? { factLabels: facts.factLabels } : {}),\n ...(s.status === undefined ? {} : { status: (s.status as string).trim() }),\n ...(s.primary === undefined ? {} : { primary: (s.primary as string).trim() }),\n ...(s.destructive === undefined ? {} : { destructive: (s.destructive as string[]).map((id) => id.trim()) }),\n ...(s.actions === undefined ? {} : { headerActions: (s.actions as string[]).map((id) => id.trim()) }),\n };\n}\n\n/* A conversation's composer: the commands its two modes run, named as the App's actions name them. */\nfunction parseTimelineComposer(raw: unknown, at: string): TimelineComposer {\n if (!raw || typeof raw !== 'object' || Array.isArray(raw))\n throw new Error(`${at} has a \"composer\" that is not { reply, note? }: the names of the commands a Reply and an Internal note run.`);\n const c = raw as Record<string, unknown>;\n allowKeys(c, ['reply', 'note', 'templates'], `${at}, composer`);\n for (const key of ['reply', 'note'] as const) {\n if (c[key] !== undefined && (typeof c[key] !== 'string' || !(c[key] as string).trim()))\n throw new Error(`${at}: composer.${key} is not a command's name.`);\n }\n if (typeof c.reply !== 'string') throw new Error(`${at}: a composer needs \"reply\", the command a Reply runs.`);\n const reply = c.reply.trim();\n const note = typeof c.note === 'string' ? c.note.trim() : undefined;\n if (note !== undefined && note === reply)\n throw new Error(\n `${at}: composer.reply and composer.note name the same command \"${reply}\"; a note is a different command from a reply.`,\n );\n const templates = c.templates === undefined ? undefined : parseComposerTemplates(c.templates, at);\n return { reply, ...(note === undefined ? {} : { note }), ...(templates ? { templates } : {}) };\n}\n\n/* Reactions under each entry: the table that holds them, the kinds offered, and the command that gives or takes one\n back. Its columns are judged against the catalog with the rest of the section (page.ts timelineReactions). */\nfunction parseTimelineReactions(raw: unknown, at: string): TimelineReactions {\n if (!raw || typeof raw !== 'object' || Array.isArray(raw))\n throw new Error(\n `${at} has \"reactions\" that is not { from, kinds, command, whose?, by?, column? }: the table reactions are rows of, the kinds offered, and the command that toggles one.`,\n );\n const r = raw as Record<string, unknown>;\n allowKeys(r, ['from', 'kinds', 'command', 'whose', 'by', 'column'], `${at}, reactions`);\n for (const key of ['from', 'command'] as const) {\n if (typeof r[key] !== 'string' || !(r[key] as string).trim())\n throw new Error(\n `${at}: reactions needs \"${key}\", ${key === 'from' ? 'the table whose rows are the reactions' : \"the name of the App's command that gives a reaction or takes it back\"}.`,\n );\n }\n for (const key of ['whose', 'by', 'column'] as const) {\n if (r[key] !== undefined && (typeof r[key] !== 'string' || !(r[key] as string).trim()))\n throw new Error(`${at}: reactions.${key} is not a column's name.`);\n }\n const kinds = r.kinds;\n if (!Array.isArray(kinds) || !kinds.length || kinds.some((kind) => typeof kind !== 'string' || !kind.trim()))\n throw new Error(`${at}: reactions needs \"kinds\", the values a reaction may be, in the order they are drawn: ['like', 'thanks'].`);\n const trimmed = kinds.map((kind: string) => kind.trim());\n const twice = trimmed.find((kind, i) => trimmed.indexOf(kind) !== i);\n if (twice !== undefined) throw new Error(`${at}: reactions.kinds names \"${twice}\" twice.`);\n if (trimmed.length > MAX_REACTION_KINDS)\n throw new Error(`${at}: reactions.kinds names ${trimmed.length} kinds; a row of reactions holds at most ${MAX_REACTION_KINDS}.`);\n return {\n from: (r.from as string).trim(),\n kinds: trimmed,\n command: (r.command as string).trim(),\n ...(typeof r.whose === 'string' ? { whose: r.whose.trim() } : {}),\n ...(typeof r.by === 'string' ? { by: r.by.trim() } : {}),\n ...(typeof r.column === 'string' ? { column: r.column.trim() } : {}),\n };\n}\n\n/* A row of reactions under an entry stays one quiet line: more kinds than this is a survey, not a reaction. */\nconst MAX_REACTION_KINDS = 8;\n\n/* Canned replies: the rows of a resource, each a label to pick and the text it puts in the box. */\nfunction parseComposerTemplates(raw: unknown, at: string): NonNullable<TimelineComposer['templates']> {\n if (!raw || typeof raw !== 'object' || Array.isArray(raw))\n throw new Error(\n `${at}: composer.templates is not { from, labelColumn, text, query? }: the resource whose rows are canned replies, and their two columns.`,\n );\n const t = raw as Record<string, unknown>;\n allowKeys(t, ['from', 'labelColumn', 'text', 'query'], `${at}, composer.templates`, {\n label: 'is now \"labelColumn\": the column a reader picks a reply by',\n });\n for (const key of ['from', 'labelColumn', 'text'] as const) {\n if (typeof t[key] !== 'string' || !(t[key] as string).trim())\n throw new Error(\n `${at}: composer.templates needs \"${key}\", ${key === 'from' ? 'the resource whose rows are the canned replies' : key === 'labelColumn' ? 'the column a reader picks by' : 'the column whose words fill the box'}.`,\n );\n }\n /* Which rows are offered, beyond what the reader may read: a retired response is still readable. */\n if (t.query !== undefined && (typeof t.query !== 'string' || !t.query.trim()))\n throw new Error(`${at}: composer.templates has a \"query\" that is not a condition, like 'active = true'.`);\n return {\n from: (t.from as string).trim(),\n labelColumn: (t.labelColumn as string).trim(),\n text: (t.text as string).trim(),\n ...(typeof t.query === 'string' ? { query: t.query.trim() } : {}),\n };\n}\n\nconst TIMELINE_TONES = ['good', 'warn', 'bad', 'info', 'neutral'] as const;\n/* A tone rule says \"this column's value → a tone\": one or two columns at most, each a short list. */\nfunction parseTimelineTone(raw: unknown, at: string): Record<string, Record<string, TimelineTone>> {\n if (!raw || typeof raw !== 'object' || Array.isArray(raw) || !Object.keys(raw).length) {\n throw new Error(`${at} has a \"tone\" that is not { column: { value: tone } }, like { kind: { internal: 'warn' } }.`);\n }\n const out: Record<string, Record<string, TimelineTone>> = {};\n for (const [column, values] of Object.entries(raw)) {\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(column))\n throw new Error(`${at}: tone names \"${column}\", which is not one of the stream's own columns.`);\n if (!values || typeof values !== 'object' || Array.isArray(values) || !Object.keys(values).length) {\n throw new Error(`${at}: tone.${column} is not { value: tone }, like { internal: 'warn' }.`);\n }\n out[column] = {};\n for (const [value, tone] of Object.entries(values)) {\n if (!(TIMELINE_TONES as readonly unknown[]).includes(tone))\n throw new Error(`${at}: tone.${column}.${value} is \"${String(tone)}\", not one of ${TIMELINE_TONES.join(', ')}.`);\n out[column][value] = tone as TimelineTone;\n }\n }\n return out;\n}\n\n/* Rows of these column values are one line: { kind: ['system'] }. */\nfunction parseTimelineCompact(raw: unknown, at: string): Record<string, string[]> {\n if (!raw || typeof raw !== 'object' || Array.isArray(raw) || !Object.keys(raw).length) {\n throw new Error(`${at} has a \"compact\" that is not { column: [values] }, like { kind: ['system'] }.`);\n }\n const out: Record<string, string[]> = {};\n for (const [column, values] of Object.entries(raw)) {\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(column))\n throw new Error(`${at}: compact names \"${column}\", which is not one of the stream's own columns.`);\n if (!Array.isArray(values) || !values.length || values.some((value) => typeof value !== 'string' || !value)) {\n throw new Error(`${at}: compact.${column} is not a list of values, like ['system'].`);\n }\n out[column] = values.map(String);\n }\n return out;\n}\n\n/* Few enough columns that each still says why a row is on the list. */\nconst MATCH_MAX_SAME = 4;\nconst MATCH_MAX_NEAR = 2;\n\n/**\n * A list's match: the rows that share the record's own values, `same` equal\n * and `near` within a fraction. It is found by those values rather than by a\n * reference, so each word that only means something beside a reference is\n * refused here rather than ignored: there is no `whose` to walk, no parent\n * to `create` under (`empty` is kept: a match that finds nothing says so), and where the rows are the page's own table the record\n * is always left out.\n */\nfunction parseMatch(s: Record<string, unknown>, section: string): PageSimilar {\n /* Named by its title where it has one: a page may hold several related lists, and \"section 3\" alone is a count. */\n const at = typeof s.title === 'string' && s.title.trim() ? `${section} (\"${s.title.trim()}\")` : section;\n const beside: Record<string, string> = {\n whose: \"its rows share the record's values rather than point at it\",\n create:\n \"its rows are not the record's children: a row added here would need the record's values in every matched column, and a near column has no value to fill, so there is nothing to add them under (add through the list's own page)\",\n };\n for (const [key, why] of Object.entries(beside)) {\n if (s[key] !== undefined && s[key] !== false) throw new Error(`${at} has \"${key}\" beside \"same\" — ${why}.`);\n }\n const column = /^[A-Za-z_][A-Za-z0-9_]*$/;\n if (\n !Array.isArray(s.same) ||\n !s.same.length ||\n s.same.length > MATCH_MAX_SAME ||\n s.same.some((c) => typeof c !== 'string' || !column.test(c))\n ) {\n throw new Error(`${at}: \"same\" must be one to ${MATCH_MAX_SAME} columns a row shares with the record, e.g. ['body_type'].`);\n }\n const same = s.same as string[];\n if (new Set(same).size !== same.length) throw new Error(`${at}: \"same\" names a column twice.`);\n if (s.near === undefined) return { same };\n if (!s.near || typeof s.near !== 'object' || Array.isArray(s.near)) {\n throw new Error(`${at}: \"near\" must be an object of number columns and fractions, e.g. { price: 0.25 }.`);\n }\n const near = Object.entries(s.near as Record<string, unknown>);\n if (!near.length || near.length > MATCH_MAX_NEAR) {\n throw new Error(`${at}: \"near\" must name one or ${MATCH_MAX_NEAR === 2 ? 'two' : MATCH_MAX_NEAR} columns.`);\n }\n for (const [name, fraction] of near) {\n if (!column.test(name)) throw new Error(`${at}: \"near\" names \"${name}\", which is not a column name.`);\n if (same.includes(name)) throw new Error(`${at}: \"${name}\" is in both \"same\" and \"near\" — equal already is near.`);\n if (typeof fraction !== 'number' || !Number.isFinite(fraction) || fraction <= 0 || fraction > 1) {\n throw new Error(`${at}: \"near\" on \"${name}\" must be a fraction above 0 and at most 1 — 0.25 is within ±25% of the record's value.`);\n }\n }\n return { same, near: Object.fromEntries(near) as Record<string, number> };\n}\n\n/**\n * A list's `show`, in the nav's grammar: a column path, or `{ column,\n * label }` with the app's word over it. The paths stay the planner's\n * `columns`; the labels ride beside them for whoever draws the header.\n */\nfunction parseShowEntries(raw: unknown[], at: string): { columns: string[]; labels?: Record<string, string> } {\n const labels: Record<string, string> = {};\n const columns = raw.map((entry, i) => {\n if (typeof entry === 'string') return entry;\n if (entry && typeof entry === 'object' && !Array.isArray(entry)) {\n const c = entry as Record<string, unknown>;\n for (const key of Object.keys(c)) {\n if (key !== 'column' && key !== 'label') throw new Error(`${at}, \"show\" entry ${i + 1} has no \"${key}\". It takes: column, label.`);\n }\n if (typeof c.column !== 'string' || !c.column.trim()) throw new Error(`${at}, \"show\" entry ${i + 1} has no \"column\".`);\n if (c.label !== undefined && (typeof c.label !== 'string' || !c.label.trim())) {\n throw new Error(`${at}, \"show\" entry ${i + 1} has a \"label\" that is not a non-empty string.`);\n }\n if (c.label !== undefined) labels[c.column.trim()] = (c.label as string).trim();\n return c.column.trim();\n }\n throw new Error(`${at}, \"show\" entry ${i + 1} is not a column name or a { \"column\", \"label\" } object.`);\n });\n return { columns, ...(Object.keys(labels).length ? { labels } : {}) };\n}\n\n/**\n * A headline's calls to action: one or two, each opening one of the App's\n * views — a public form, a list, a dashboard — by its key: the landing's\n * call-to-action shape. Whether the key names such a view is judged where\n * the page meets the App.\n */\nfunction parseHeadlineActions(raw: unknown, at: string): PageHeadlineAction[] {\n if (!Array.isArray(raw) || !raw.length || raw.length > 2) throw new Error(`${at}: \"links\" must be one or two { label, to }.`);\n return raw.map((entry, i) => {\n const here = `${at}, link ${i + 1}`;\n if (!entry || typeof entry !== 'object' || Array.isArray(entry)) throw new Error(`${here} is not an object { label, to }.`);\n const a = entry as Record<string, unknown>;\n if (a.to !== undefined && typeof a.to !== 'string') {\n allowKeys(a, ['label', 'to', 'intent'], here, INTENT_RENAMED);\n if (typeof a.label !== 'string' || !a.label.trim() || a.label.trim().length > 60)\n throw new Error(`${here} needs a \"label\" of at most 60 characters.`);\n if (a.intent !== undefined && a.intent !== 'primary' && a.intent !== 'secondary')\n throw new Error(`${here} has an \"intent\" of \"${String(a.intent)}\". Use \"primary\" or \"secondary\".`);\n return {\n label: a.label.trim(),\n to: parseAppTarget(a.to, `${here}.to`, true),\n ...(a.intent === undefined ? {} : { intent: a.intent as 'primary' | 'secondary' }),\n };\n }\n allowKeys(a, ['label', 'to', 'intent', 'prefill', 'defaults', 'open'], here, INTENT_RENAMED);\n if (typeof a.label !== 'string' || !a.label.trim() || a.label.trim().length > 60)\n throw new Error(`${here} needs a \"label\" of at most 60 characters.`);\n if (typeof a.to !== 'string' || !/^[a-z0-9][a-z0-9-]{0,63}$/.test(a.to))\n throw new Error(`${here} needs a \"to\": the key of one of the App's views, or an appLink().`);\n if (a.intent !== undefined && a.intent !== 'primary' && a.intent !== 'secondary')\n throw new Error(`${here} has an \"intent\" of \"${String(a.intent)}\". Use \"primary\" or \"secondary\".`);\n /* A public form over the record, rather than a page of its own. Only\n 'modal': \"drawer\" is a list's word for a row, and a page is the default\n because it is what an address opens. */\n if (a.open !== undefined && a.open !== 'modal')\n throw new Error(`${here} has an \"open\" of \"${String(a.open)}\". Use \"modal\", or leave it out for a page.`);\n /* Where the form the action opens starts: an input filled from this\n record (input → field path), or with the author's words — `defaults`, the\n word a New form and a related list's create say a stated starting value with. */\n const inputs = (raw: unknown, key: 'prefill' | 'defaults'): Record<string, string> | undefined => {\n if (raw === undefined) return undefined;\n if (!raw || typeof raw !== 'object' || Array.isArray(raw) || !Object.keys(raw).length)\n throw new Error(`${here} has a \"${key}\" that is not an object of form input → ${key === 'prefill' ? 'field path' : 'text'}.`);\n return Object.fromEntries(\n Object.entries(raw as Record<string, unknown>).map(([input, value]) => {\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(input)) throw new Error(`${here}, ${key}: \"${input}\" is not a form input's name.`);\n if (key === 'prefill' && (typeof value !== 'string' || !FIELD_PATH.test(value.trim())))\n throw new Error(`${here}, prefill: \"${input}\" must name one of this record's fields.`);\n if (key === 'defaults' && (typeof value !== 'string' || !value.trim() || value.length > 500))\n throw new Error(`${here}, defaults: \"${input}\" must be text of at most 500 characters.`);\n return [input, (value as string).trim()];\n }),\n );\n };\n const prefill = inputs(a.prefill, 'prefill');\n const defaults = inputs(a.defaults, 'defaults');\n return {\n label: a.label.trim(),\n view: a.to,\n ...(a.intent === undefined ? {} : { intent: a.intent as 'primary' | 'secondary' }),\n ...(prefill ? { prefill } : {}),\n ...(defaults ? { defaults } : {}),\n ...(a.open === undefined ? {} : { open: 'modal' as const }),\n };\n });\n}\n\nfunction parseWidth(raw: unknown, at: string): SectionWidth | undefined {\n if (raw === undefined) return undefined;\n const width = String(raw);\n if (!WIDTHS.includes(width as SectionWidth)) {\n throw new Error(`${at} has a \"width\" of \"${width}\". Use ${WIDTHS.join(', ')}.`);\n }\n return width as SectionWidth;\n}\n\nfunction parseOffset(raw: unknown, at: string, side: string): SectionOffset | undefined {\n if (raw === undefined) return undefined;\n const offset = String(raw);\n if (!OFFSETS.includes(offset as SectionOffset)) {\n throw new Error(`${at} has an \"${side}\" of \"${offset}\". Use ${OFFSETS.join(', ')}.`);\n }\n return offset as SectionOffset;\n}\n\nfunction parseSort(raw: unknown, at: string): PageList['orderBy'] {\n return parseSortText(raw, at, 'due_on desc, name');\n}\n","import type { AppForm, FormLines } from './app.js';\nimport { columnKind, isFlagColumn, type ColumnMeta, type DatabaseSchema, type TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { autoKey, formShownFields, isRequired } from '@mistriwork/engine/shared/form.js';\nimport { unknownKey } from '@mistriwork/engine/shared/suggest.js';\nimport { computedColumnMeta } from '@mistriwork/engine/shared/computed.js';\nimport {\n LOCAL_FIELD,\n RESERVED,\n columnNamed,\n compileCondition,\n comparisonResult,\n conditionResult,\n evaluateFormCondition,\n family,\n formDefaultWord,\n normalize,\n rowValue,\n scalar,\n type CompiledCondition,\n type FormCondition,\n type FormOperator,\n type FormScalar,\n type FormStep,\n type FormStyle,\n} from '@mistriwork/engine/shared/formValues.js';\nexport {\n MAX_FORM_CONDITION,\n MAX_FORM_PREDICATES,\n evaluateFormCondition,\n formDefaultWord,\n inferredFormDefaults,\n type FormCondition,\n type FormScalar,\n type FormStep,\n type FormStyle,\n} from '@mistriwork/engine/shared/formValues.js';\nimport type { AppFormField, FormChildGroup } from '@mistriwork/engine/shared/servedApp.js';\nexport type { AppFormField, FormChildGroup } from '@mistriwork/engine/shared/servedApp.js';\n\n/** A validation rule: the record must meet `must`, a condition, wherever `when` (a condition too) holds. The\n * message is shown at the first column `must` names. */\nexport interface FormRule {\n must: FormCondition;\n when?: FormCondition;\n message: string;\n}\n\nexport const FORM_OPEN = ['drawer', 'page'] as const;\nexport const FORM_STYLES = ['stepper', 'intake'] as const;\n/** How a vocabulary or a flag may be drawn on a New form (`fields.<column>.as`). */\nconst FORM_FIELD_AS = ['cards', 'buttons', 'radios', 'select'] as const;\nexport const FORM_FIELD_KEYS = ['label', 'help', 'placeholder', 'multiline', 'as', 'where', 'tree'] as const;\n/** A narrowed reference compares at most this many columns. */\nexport const MAX_FORM_WHERE = 4;\nconst MAX_FORM_DESCRIPTION = 500;\n\nexport const MAX_FORM_RULES = 128;\nexport const MAX_FORM_FIELDS = 256;\nexport const MAX_FORM_GROUPS = 32;\nexport const MAX_FORM_CHILDREN = 16;\nexport const MAX_FORM_CHILD_ROWS = 64;\nconst MAX_FORM_CHILD_ID = 64;\nexport const MAX_FORM_STEPS = 16;\nexport const MAX_FORM_STEP_FIELDS = 256;\nconst MAX_FORM_STEP_ID = 64;\nexport const FORM_UNRESOLVED_MESSAGE = 'This value could not be validated.';\n// eslint-disable-next-line no-control-regex -- Resource names must exclude ASCII control characters.\nconst RESOURCE = /^\\S(?:[^\\x00-\\x1f\\x7f]*\\S)?$/u;\n\nfunction fail(where: string): never {\n // Never stringify rejected data: it may contain row values or executable hooks.\n throw new Error(`${where}: invalid form declaration.`);\n}\n\nfunction frozen<T extends object>(value: T): T {\n return Object.freeze(value);\n}\nfunction object(raw: unknown, where: string, keys?: readonly string[]): Record<string, unknown> {\n if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return fail(where);\n const proto = Object.getPrototypeOf(raw);\n if (proto !== Object.prototype && proto !== null) return fail(where);\n const descriptors = Object.getOwnPropertyDescriptors(raw);\n if (Reflect.ownKeys(raw).length !== Object.keys(descriptors).length) return fail(where);\n const result: Record<string, unknown> = {};\n for (const [key, descriptor] of Object.entries(descriptors)) {\n /* An unknown key is named with the keys the place takes, as allowKeys\n names one everywhere else. A key is authored; the values are what\n fail() must never echo. */\n if (keys && !keys.includes(key) && !RESERVED.has(key)) throw new Error(`${where} ${unknownKey(key, keys)}.`);\n if (RESERVED.has(key) || !descriptor.enumerable || !Object.hasOwn(descriptor, 'value') || (keys && !keys.includes(key)))\n return fail(where);\n Object.defineProperty(result, key, { value: descriptor.value, enumerable: true });\n }\n return result;\n}\n\nfunction list(raw: unknown, where: string, max: number, min = 0): unknown[] {\n if (!Array.isArray(raw) || raw.length < min || raw.length > max || Object.getPrototypeOf(raw) !== Array.prototype) return fail(where);\n const descriptors = Object.getOwnPropertyDescriptors(raw);\n if (Reflect.ownKeys(raw).length !== raw.length + 1) return fail(where);\n const result: unknown[] = [];\n for (let i = 0; i < raw.length; i++) {\n const descriptor = descriptors[String(i)];\n if (!descriptor || !descriptor.enumerable || !Object.hasOwn(descriptor, 'value')) return fail(where);\n result.push(descriptor.value);\n }\n return result;\n}\n\nfunction field(raw: unknown, where: string): string {\n if (typeof raw !== 'string' || !LOCAL_FIELD.test(raw) || RESERVED.has(raw)) return fail(where);\n return raw;\n}\n\nfunction text(raw: unknown, where: string): string {\n // eslint-disable-next-line no-control-regex -- Static labels/messages must not contain ASCII control characters.\n if (typeof raw !== 'string' || !raw.trim() || raw.length > 256 || /[\\x00-\\x1f\\x7f]/u.test(raw)) return fail(where);\n return raw;\n}\n\nfunction childId(raw: unknown, where: string): string {\n if (typeof raw !== 'string' || raw.length > MAX_FORM_CHILD_ID || !/^[a-z][a-z0-9_-]*$/u.test(raw)) return fail(where);\n return raw;\n}\n\nfunction stepId(raw: unknown, where: string): string {\n if (typeof raw !== 'string' || raw.length > MAX_FORM_STEP_ID || !/^[a-z][a-z0-9_-]*$/u.test(raw)) return fail(where);\n return raw;\n}\n\n/** The id `step()` gives a step: its label's slug. */\nfunction stepSlug(label: string): string {\n return label\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-|-$/g, '');\n}\n\n/* A step written as an object may leave its id out, as `step()` does; the\n label's slug is its id then — a step that lists fields and one that saves\n through its own command alike (appSavedForms.ts), and a label with no slug that can be one\n (`'1. Basics'`) says what to write rather than failing opaquely. */\nexport function stepIdOf(s: Record<string, unknown>, label: string, where: string): string {\n if (Object.hasOwn(s, 'id')) return stepId(s.id, where);\n const slug = stepSlug(label);\n if (!/^[a-z][a-z0-9_-]*$/u.test(slug) || slug.length > MAX_FORM_STEP_ID) {\n throw new Error(`${where}: step \"${label}\" needs an \"id\" — lowercase letters, digits, \"_\" and \"-\", starting with a letter.`);\n }\n return slug;\n}\n\n/** Author prose that is not a row value: one sentence or a few, plain text. */\nfunction sentence(raw: unknown, where: string, max: number): string {\n // eslint-disable-next-line no-control-regex -- Static copy must not contain ASCII control characters.\n if (typeof raw !== 'string' || !raw.trim() || raw.length > max || /[\\x00-\\x1f\\x7f]/u.test(raw)) {\n throw new Error(`${where} is not plain text of at most ${max} characters.`);\n }\n return raw.trim();\n}\n\nfunction parseFormField(raw: unknown, name: string, where: string): AppFormField {\n const here = `${where}, fields \"${name}\"`;\n const f = object(raw, here, FORM_FIELD_KEYS);\n const result: AppFormField = {};\n for (const key of ['label', 'help', 'placeholder'] as const) {\n if (Object.hasOwn(f, key)) result[key] = sentence(f[key], `${here}, \"${key}\"`, 256);\n }\n if (Object.hasOwn(f, 'multiline')) {\n if (typeof f.multiline !== 'boolean') throw new Error(`${here}, \"multiline\" is true or false.`);\n result.multiline = f.multiline;\n }\n if (Object.hasOwn(f, 'as')) {\n if (typeof f.as !== 'string' || !FORM_FIELD_AS.includes(f.as as (typeof FORM_FIELD_AS)[number])) {\n throw new Error(`${here}, \"as\" is one of ${FORM_FIELD_AS.map((w) => `\"${w}\"`).join(', ')}.`);\n }\n result.as = f.as as (typeof FORM_FIELD_AS)[number];\n }\n if (Object.hasOwn(f, 'where')) {\n const pairs = Object.entries(object(f.where, `${here}, \"where\"`));\n if (!pairs.length || pairs.length > MAX_FORM_WHERE) {\n throw new Error(`${here}, \"where\" names one to ${MAX_FORM_WHERE} columns: { project_id: 'project_id' }.`);\n }\n result.where = frozen(Object.fromEntries(pairs.map(([target, local]) => [field(target, here), field(local, here)])));\n }\n if (Object.hasOwn(f, 'tree')) result.tree = field(f.tree, `${here}, \"tree\"`);\n return frozen(result);\n}\n\n/** A condition, checked as the query language and kept as its text. */\nexport function parseFormCondition(raw: unknown, where = 'Condition', paths = false): FormCondition {\n compileCondition(raw, where, undefined, 'record', paths);\n return (raw as string).trim();\n}\n\nexport function parseFormRules(raw: unknown, where = 'Validation'): FormRule[] {\n return frozen(\n list(raw, where, MAX_FORM_RULES).map((rawRule) => {\n const r = object(rawRule, where, ['must', 'when', 'message']);\n if (!Object.hasOwn(r, 'must')) return fail(where);\n return frozen({\n must: parseFormCondition(r.must, `${where}, \"must\"`, true),\n message: text(r.message, where),\n ...(Object.hasOwn(r, 'when') ? { when: parseFormCondition(r.when, `${where}, \"when\"`, true) } : {}),\n });\n }),\n );\n}\n\n/** The column a rule's message is shown at: the first one its `must` compares, or the reference it reads through. */\nfunction ruleField(rule: FormRule): string {\n return compileCondition(rule.must, 'Validation', undefined, 'record', true)[0][0].field.split('.')[0];\n}\n\nexport function parseAppValidation(raw: unknown, where = 'Validation'): Record<string, FormRule[]> {\n const declarations = object(raw, where);\n if (Object.keys(declarations).length > MAX_FORM_FIELDS) return fail(where);\n return frozen(\n Object.fromEntries(\n Object.entries(declarations).map(([resource, rules]) => {\n if (!RESOURCE.test(resource) || resource.length > 256) return fail(where);\n return [resource, parseFormRules(rules, where)];\n }),\n ),\n );\n}\n\n/** The most fields side by side in one row. */\nconst MAX_FORM_ROW = 3;\nconst STEP_WORDS = { title: 160, lead: 500, next: 40, skip: 40 } as const;\n/** The keys a step takes beside its id, label and fields. */\nconst STEP_WORD_KEYS = Object.keys(STEP_WORDS) as readonly (keyof typeof STEP_WORDS)[];\n\n/** A step's own words for the intake style: its heading, the sentence under it, and its button's. */\nexport function parseStepWords(\n s: Record<string, unknown>,\n where: string,\n keys: readonly (keyof typeof STEP_WORDS)[] = STEP_WORD_KEYS,\n): Pick<FormStep, 'title' | 'lead' | 'next' | 'skip'> {\n const result: Pick<FormStep, 'title' | 'lead' | 'next' | 'skip'> = {};\n for (const key of keys) if (Object.hasOwn(s, key)) result[key] = sentence(s[key], `${where}, \"${key}\"`, STEP_WORDS[key]);\n return result;\n}\n\n/**\n * Fields as authored, for a step, a group or the form's `show`: names, and inner lists that are rows\n * (`[['first_name', 'last_name'], 'dob']`). The fields are the names read through, in order, the list everything\n * else reads; `rows` is kept beside them only where some row holds more than one.\n */\nfunction parseRowFields(raw: unknown, where: string, max: number, min: number): { fields: string[]; rows?: string[][] } {\n const rows = list(raw, where, max, min).map((entry, i): string[] => {\n if (!Array.isArray(entry)) return [field(entry, where)];\n const at = `${where}, field ${i + 1}`;\n if (!entry.length) throw new Error(`${at} is an empty row. A row holds one to ${MAX_FORM_ROW} fields.`);\n if (entry.length > MAX_FORM_ROW)\n throw new Error(\n `${at} is a row of ${entry.length} fields; a row holds at most ${MAX_FORM_ROW}, side by side. Split it into two rows.`,\n );\n if (entry.some((member) => Array.isArray(member)))\n throw new Error(`${at} nests a row inside a row. A row is one list of field names: [['first_name', 'last_name'], 'dob'].`);\n return list(entry, at, MAX_FORM_ROW, 1).map((member) => field(member, where));\n });\n const fields = rows.flat();\n if (fields.length > max) return fail(where);\n const twice = fields.find((name, i) => fields.indexOf(name) !== i);\n if (twice !== undefined) throw new Error(`${where} names \"${twice}\" twice; a field stands in one place on the form.`);\n return {\n fields: frozen(fields),\n ...(rows.some((row) => row.length > 1) ? { rows: frozen(rows.map((row) => frozen(row))) } : {}),\n };\n}\n\n/**\n * A list read again from a parsed model: its flat `fields` and the `rows` kept beside them, which must say the same\n * names in the same order. Authored, the rows are the list itself.\n */\nfunction rowFields(\n raw: Record<string, unknown>,\n key: string,\n rowsKey: string,\n where: string,\n parsed: boolean,\n max: number,\n min: number,\n): { fields: string[]; rows?: string[][] } {\n if (!parsed || !Object.hasOwn(raw, rowsKey)) return parseRowFields(raw[key], where, max, min);\n const read = parseRowFields(raw[rowsKey], where, max, min);\n const flat = list(raw[key], where, max, min);\n if (flat.length !== read.fields.length || flat.some((name, i) => name !== read.fields[i])) return fail(where);\n return read;\n}\n\n/** The keys an authored resource form takes (children stay behind the shared parser). */\nconst FORM_KEYS = [\n 'show',\n 'defaults',\n 'derived',\n 'groups',\n 'when',\n 'steps',\n 'style',\n 'description',\n 'open',\n 'fields',\n 'lines',\n 'live',\n] as const;\n/** What an author writes: `derived` is read out of `defaults` (`{ from: 'service_id.price' }`), never said itself. */\nexport const AUTHORED_FORM_KEYS = FORM_KEYS.filter((key) => key !== 'derived');\n/** A value taken from a referenced record: one reference of this table, then a column of the table it names. */\nconst DERIVED_PATH = /^[A-Za-z_][A-Za-z0-9_]{0,127}\\.[A-Za-z_][A-Za-z0-9_]{0,127}$/;\n\n/** The most collections of child rows one New form asks, and the most names it says live. */\nconst MAX_FORM_LINES = 4;\nconst MAX_FORM_LIVE = 16;\nconst LINE_KEYS = ['label', 'from', 'whose', 'show', 'order', 'min', 'max'] as const;\nconst IDENT = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/;\n\n/**\n * A New form's child rows — an order's lines, a bundle's items — asked as a\n * grid under the record's fields and inserted with it, in its transaction:\n * `lines: [{ label: 'Items', from: 'order_line', whose: 'order_id', show: ['product_id', 'qty', 'unit_price'] }]`.\n * The words are a related list's (`related(title, from, whose, { show })`), and its caption is a `label` as a group's is;\n * the catalog checks them where the form meets it (formLines.ts).\n */\nfunction parseFormLines(raw: unknown, where: string): FormLines[] {\n if (!Array.isArray(raw) || !raw.length || raw.length > MAX_FORM_LINES)\n throw new Error(\n `${where}: form.lines is a list of one to ${MAX_FORM_LINES} collections of child rows, each { label, from, whose, show }.`,\n );\n const seen = new Set<string>();\n return frozen(\n raw.map((entry, i) => {\n const at = `${where}: form.lines ${i + 1}`;\n if (!entry || typeof entry !== 'object' || Array.isArray(entry)) throw new Error(`${at} is not { label, from, whose, show }.`);\n const l = entry as Record<string, unknown>;\n if (l.title !== undefined) throw new Error(`${at} has \"title\", which is now \"label\", as a group's caption is.`);\n const extra = Object.keys(l).find((key) => !(LINE_KEYS as readonly string[]).includes(key));\n if (extra !== undefined) throw new Error(`${at} ${unknownKey(extra, LINE_KEYS)}.`);\n if (typeof l.label !== 'string' || !l.label.trim() || l.label.length > 80)\n throw new Error(`${at} needs a \"label\" of at most 80 characters.`);\n for (const key of ['from', 'whose'] as const)\n if (typeof l[key] !== 'string' || !IDENT.test(l[key] as string))\n throw new Error(\n `${at} needs \"${key}\": ${key === 'from' ? 'the resource of the rows' : 'the column of those rows that points at this record'}.`,\n );\n if (\n !Array.isArray(l.show) ||\n !l.show.length ||\n l.show.length > 12 ||\n l.show.some((column) => typeof column !== 'string' || !IDENT.test(column)) ||\n new Set(l.show).size !== l.show.length\n )\n throw new Error(`${at} needs \"show\": one to 12 of the row's own columns, each once.`);\n if (l.order !== undefined && (typeof l.order !== 'string' || !IDENT.test(l.order)))\n throw new Error(`${at} has an \"order\" that is not a column of the rows: the number each row's place is kept in.`);\n const bound = (key: 'min' | 'max') => {\n const v = l[key];\n if (v === undefined) return undefined;\n if (typeof v !== 'number' || !Number.isInteger(v) || v < (key === 'max' ? 1 : 0) || v > MAX_FORM_CHILD_ROWS)\n throw new Error(`${at} has a \"${key}\" that is not a whole number of rows up to ${MAX_FORM_CHILD_ROWS}.`);\n return v;\n };\n const min = bound('min'),\n max = bound('max');\n if (min !== undefined && max !== undefined && min > max) throw new Error(`${at} has a \"min\" above its \"max\".`);\n if (seen.has(l.from as string))\n throw new Error(`${at} asks the rows of \"${l.from as string}\" a second time; one collection per resource.`);\n seen.add(l.from as string);\n return frozen({\n label: l.label.trim(),\n from: l.from as string,\n whose: l.whose as string,\n show: frozen([...(l.show as string[])]),\n ...(l.order === undefined ? {} : { order: l.order as string }),\n ...(min === undefined ? {} : { min }),\n ...(max === undefined ? {} : { max }),\n });\n }),\n );\n}\n\n/** The resource's computed columns and rollups a New form says as its fields and lines are typed: `live: ['subtotal', 'total']`. */\nfunction parseFormLive(raw: unknown, where: string): string[] {\n if (\n !Array.isArray(raw) ||\n !raw.length ||\n raw.length > MAX_FORM_LIVE ||\n raw.some((name) => typeof name !== 'string' || !IDENT.test(name)) ||\n new Set(raw).size !== raw.length\n )\n throw new Error(`${where}: form.live is a list of one to ${MAX_FORM_LIVE} of the resource's computed columns and rollups, each once.`);\n return frozen([...(raw as string[])]);\n}\n\n/** `parsed`: the form is a model already read (its `show` derived from its groups), not an authored one. */\nfunction parseAppFormShape(raw: unknown, where: string, parsed = false): Omit<AppForm, 'children'> {\n /* A parsed model carries its rows beside its flat lists (`showRows`, a group's and a step's `rows`); an author writes\n them inside the lists. */\n const f = object(raw, where, parsed ? [...FORM_KEYS, 'showRows'] : FORM_KEYS);\n const result: AppForm = {};\n /* `show` is what the form asks. Its steps, or else its groups, are that list already, so saying both is two lists to keep\n alike: it is the one or the other. */\n if (Object.hasOwn(f, 'show')) {\n if (parsed && Object.hasOwn(f, 'groups') && !Object.hasOwn(f, 'steps')) {\n /* derived again below */\n } else if (Object.hasOwn(f, 'steps') || Object.hasOwn(f, 'groups')) {\n throw new Error(\n `${where} has \"show\" and ${Object.hasOwn(f, 'steps') ? 'steps' : 'groups'}: the form asks the fields of its ${Object.hasOwn(f, 'steps') ? 'steps' : 'groups'}. Keep one.`,\n );\n }\n const { fields, rows } = rowFields(f, 'show', 'showRows', where, parsed, MAX_FORM_FIELDS, 0);\n result.show = fields;\n if (rows) result.showRows = rows;\n }\n if (Object.hasOwn(f, 'defaults')) {\n const defaults = object(f.defaults, where);\n if (Object.keys(defaults).length > MAX_FORM_FIELDS) return fail(where);\n result.defaults = frozen(Object.fromEntries(Object.entries(defaults).map(([key, value]) => [field(key, where), scalar(value, where)])));\n }\n if (Object.hasOwn(f, 'derived')) {\n const derived = object(f.derived, where);\n if (Object.keys(derived).length > MAX_FORM_FIELDS) return fail(where);\n result.derived = frozen(\n Object.fromEntries(\n Object.entries(derived).map(([key, path]) => {\n if (typeof path !== 'string' || !DERIVED_PATH.test(path))\n throw new Error(\n `${where}: defaults \"${key}\" is from ${JSON.stringify(path)}; a value from a record is { from: 'reference.column' }.`,\n );\n if (Object.hasOwn(result.defaults ?? {}, key)) throw new Error(`${where}: defaults \"${key}\" is said twice.`);\n return [field(key, where), path];\n }),\n ),\n );\n }\n if (Object.hasOwn(f, 'groups')) {\n const seen = new Set<string>();\n result.groups = frozen(\n list(f.groups, where, MAX_FORM_GROUPS).map((rawGroup) => {\n const g = object(rawGroup, where, parsed ? ['label', 'description', 'fields', 'rows'] : ['label', 'description', 'fields']);\n const { fields, rows } = rowFields(g, 'fields', 'rows', where, parsed, MAX_FORM_FIELDS, 1);\n for (const name of fields) {\n if (seen.has(name)) return fail(where);\n seen.add(name);\n }\n const label = text(g.label, where);\n return frozen({\n label,\n ...(Object.hasOwn(g, 'description')\n ? { description: sentence(g.description, `${where}, group \"${label}\", \"description\"`, 256) }\n : {}),\n fields,\n ...(rows ? { rows } : {}),\n });\n }),\n );\n }\n /* The groups carve up what the form asks, in their order; with steps, the steps' fields are the list (formShownFields). */\n if (result.groups && !Object.hasOwn(f, 'steps')) {\n result.show = frozen(result.groups.flatMap((group) => [...group.fields]));\n /* Their rows are the form's, read in the same order; a group without rows is one field to a row. */\n if (result.groups.some((group) => group.rows))\n result.showRows = frozen(result.groups.flatMap((group) => group.rows ?? group.fields.map((name) => frozen([name]))));\n }\n if (Object.hasOwn(f, 'when')) {\n const conditions = object(f.when, where);\n if (Object.keys(conditions).length > MAX_FORM_FIELDS) return fail(where);\n result.when = frozen(\n Object.fromEntries(\n Object.entries(conditions).map(([key, value]) => {\n const name = field(key, where);\n if (result.show && !result.show.includes(name)) return fail(where);\n return [name, parseFormCondition(value, `${where}, when \"${name}\"`)];\n }),\n ),\n );\n }\n if (Object.hasOwn(f, 'steps')) {\n const seenIds = new Set<string>();\n const owned = new Set<string>();\n result.steps = frozen(\n list(f.steps, where, MAX_FORM_STEPS, 1).map((rawStep) => {\n const s = object(rawStep, where, ['id', 'label', 'fields', ...(parsed ? ['rows'] : []), ...STEP_WORD_KEYS]);\n const label = text(s.label, where);\n const id = stepIdOf(s, label, where);\n if (seenIds.has(id)) throw new Error(`${where}: two steps are \"${id}\"; give one an \"id\" of its own.`);\n seenIds.add(id);\n const { fields, rows } = rowFields(s, 'fields', 'rows', where, parsed, MAX_FORM_STEP_FIELDS, 1);\n if (fields.some((name) => owned.has(name))) return fail(where);\n fields.forEach((name) => owned.add(name));\n return frozen({ id, label, fields, ...(rows ? { rows } : {}), ...parseStepWords(s, `${where}, step \"${id}\"`) });\n }),\n );\n /* A row stands inside one group, as a group stands inside one step: the group's heading sits over the row, and\n the fields a group leaves out are drawn after every group. */\n if (result.groups) {\n const groupOf = new Map(result.groups.flatMap((group, at) => group.fields.map((name) => [name, at] as const)));\n for (const step of result.steps)\n for (const row of step.rows ?? []) {\n if (new Set(row.map((name) => groupOf.get(name) ?? -1)).size > 1)\n throw new Error(\n `${where}: step \"${step.id}\" puts ${row.map((name) => `\"${name}\"`).join(', ')} in one row across groups. A row stands inside one group.`,\n );\n }\n }\n }\n if (Object.hasOwn(f, 'style')) {\n if (!(FORM_STYLES as readonly unknown[]).includes(f.style)) throw new Error(`${where}, \"style\" is 'stepper' or 'intake'.`);\n if (!Object.hasOwn(f, 'steps')) throw new Error(`${where}, \"style\" draws steps, and this form has none.`);\n result.style = f.style as FormStyle;\n }\n if (Object.hasOwn(f, 'description')) result.description = sentence(f.description, `${where}, \"description\"`, MAX_FORM_DESCRIPTION);\n if (Object.hasOwn(f, 'open')) {\n if (!(FORM_OPEN as readonly unknown[]).includes(f.open)) throw new Error(`${where}, \"open\" is 'drawer' or 'page'.`);\n result.open = f.open as AppForm['open'];\n }\n if (Object.hasOwn(f, 'lines')) result.lines = parseFormLines(f.lines, where);\n if (Object.hasOwn(f, 'live')) result.live = parseFormLive(f.live, where);\n if (Object.hasOwn(f, 'fields')) {\n const declared = Object.entries(object(f.fields, `${where}, \"fields\"`));\n if (declared.length > MAX_FORM_FIELDS) return fail(where);\n result.fields = frozen(Object.fromEntries(declared.map(([name, value]) => [field(name, where), parseFormField(value, name, where)])));\n }\n return frozen(result);\n}\n\nfunction parseFormChildren(raw: unknown, where = 'Form, children'): FormChildGroup[] {\n const seen = new Set<string>();\n return frozen(\n list(raw, where, MAX_FORM_CHILDREN).map((rawChild) => {\n const c = object(rawChild, where, ['id', 'label', 'table', 'relation', 'min', 'max', 'form']);\n const id = childId(c.id, where);\n if (seen.has(id)) return fail(where);\n seen.add(id);\n const relation = object(c.relation, where, ['from', 'to']);\n const min = c.min === undefined ? 0 : c.min;\n const max = c.max;\n if (\n typeof min !== 'number' ||\n typeof max !== 'number' ||\n !Number.isInteger(min) ||\n min < 0 ||\n min > MAX_FORM_CHILD_ROWS ||\n !Number.isInteger(max) ||\n max < 1 ||\n max > MAX_FORM_CHILD_ROWS ||\n min > max\n )\n return fail(where);\n if (typeof c.table !== 'string' || !RESOURCE.test(c.table) || c.table.length > 256) return fail(where);\n const captured: FormChildGroup = {\n id,\n label: text(c.label, where),\n table: c.table,\n relation: { from: field(relation.from, where), to: field(relation.to, where) },\n ...(min ? { min } : {}),\n max,\n ...(c.form === undefined ? {} : { form: parseAppFormShape(c.form, `${where} \"${id}\", form`) }),\n };\n return frozen(captured);\n }),\n );\n}\n\nexport function parseAppForm(raw: unknown, where = 'Form', parsed = false): AppForm {\n const input = object(raw, where, [...FORM_KEYS, ...(parsed ? ['showRows'] : []), 'children']);\n const shape = parseAppFormShape(Object.fromEntries(Object.entries(input).filter(([key]) => key !== 'children')), where, parsed);\n if (!Object.hasOwn(input, 'children')) return shape as AppForm;\n return frozen({ ...shape, children: parseFormChildren(input.children, `${where}, children`) });\n}\n\nexport function referencedConditionFields(condition: FormCondition, paths = false): string[] {\n return [\n ...new Set(\n compileCondition(condition, 'Condition', undefined, 'record', paths)\n .flat()\n .map((p) => p.field),\n ),\n ];\n}\n\nexport function referencedRuleFields(rules: readonly FormRule[]): string[] {\n return [\n ...new Set(\n parseFormRules(rules).flatMap((rule) => [\n ...compileCondition(rule.must, 'Validation', undefined, 'record', true)\n .flat()\n .flatMap((p) => [p.field, ...(p.other === undefined ? [] : [p.other])]),\n ...(rule.when ? referencedConditionFields(rule.when, true) : []),\n ]),\n ),\n ];\n}\n\n/** A record as a rule reads it: a text column holding only blanks is as empty as a missing one. */\nfunction blanksAsEmpty(row: Readonly<Record<string, unknown>>, columns: readonly ColumnMeta[]): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n for (const column of columns) {\n const value = rowValue(row, column.name);\n result[column.name] = typeof value === 'string' && !value.trim() && family(column) === 'text' ? null : value;\n }\n return result;\n}\n\nfunction comparisonProblem(column: ColumnMeta, op: FormOperator): boolean {\n const kind = family(column);\n return !kind || ((kind === 'text' || kind === 'boolean') && op !== 'eq' && op !== 'ne');\n}\n\nfunction conditionProblems(condition: FormCondition, table: TableMeta, paths = false): string[] {\n let compiled: CompiledCondition;\n try {\n compiled = compileCondition(\n condition,\n `Condition \"${condition}\"`,\n table.columns,\n /^\\w+$/.test(table.name) ? table.name : undefined,\n paths,\n );\n } catch (error) {\n return [(error as Error).message];\n }\n return compiled.flat().flatMap((p) => {\n const column = columnNamed(table.columns, p.field);\n if (p.other !== undefined) {\n const other = columnNamed(table.columns, p.other);\n return !column || !other || family(column) !== family(other) || comparisonProblem(column, p.operator)\n ? [`Condition on \"${p.field}\" is not comparable with \"${p.other}\" in this schema.`]\n : [];\n }\n return !column ||\n comparisonProblem(column, p.operator) ||\n p.values.some((value) => normalize(column, value) === undefined || (value === null && p.operator !== 'eq' && p.operator !== 'ne'))\n ? [`Condition on \"${p.field}\" is not comparable with this schema.`]\n : [];\n });\n}\n\n/** The `reference.column` paths a validation reads through its references, each once. */\nexport function ruleReferencePaths(rules: readonly FormRule[]): string[] {\n return referencedRuleFields(rules).filter((field) => field.includes('.'));\n}\n\n/**\n * The columns a validation is judged against: the table's own, and each column it reads through a reference,\n * named by its path and typed as the referenced column is. `problems` says each path the catalog cannot follow.\n */\nexport function ruleColumns(\n rules: readonly FormRule[],\n table: TableMeta,\n schema: DatabaseSchema | undefined,\n): { columns: ColumnMeta[]; problems: string[] } {\n const columns = [...table.columns];\n const problems: string[] = [];\n for (const path of ruleReferencePaths(rules)) {\n const source = derivedSource(path, table, schema);\n if ('problem' in source) problems.push(`Validation reads \"${path}\": ${source.problem}`);\n else columns.push({ ...source.column, name: path, primaryKey: false });\n }\n return { columns, problems };\n}\n\nexport function validateFormRules(rules: readonly FormRule[], table: TableMeta, schema?: DatabaseSchema): string[] {\n const captured = parseFormRules(rules);\n // Without a catalog a path cannot be followed, and is left to the check that has one.\n if (!schema && ruleReferencePaths(captured).length) return [];\n const { columns, problems } = ruleColumns(captured, table, schema);\n if (problems.length) return problems;\n const judged = { ...table, columns };\n for (const rule of captured) {\n problems.push(...conditionProblems(rule.must, judged, true));\n if (rule.when) problems.push(...conditionProblems(rule.when, judged, true));\n }\n return [...new Set(problems)];\n}\n\n/** What a form is judged against beyond its own table: the catalog its references\n * point into, and who `me` can be — `null` for an App without sign-in, the\n * `auth.me` table's id (or undefined, email only) where people sign in. */\ninterface AppFormContext {\n schema?: DatabaseSchema;\n /** The catalog a value from a referenced record is read from: `schema` with its computed columns (app.ts storedComputed). */\n derivedFrom?: DatabaseSchema;\n person?: { table?: string } | null;\n}\n\n/** Use the current readable projection; this helper never grants field access. */\nexport function validateAppForm(\n form: AppForm,\n table: TableMeta,\n readableFields: readonly string[] = table.columns.map((c) => c.name),\n context: AppFormContext = {},\n): string[] {\n const captured = parseAppForm(form, 'Form', true);\n const readable = new Set(readableFields);\n const stepFields = (captured.steps ?? []).flatMap((step) => step.fields);\n const shownFields = formShownFields(captured);\n const presentationFields = [\n ...(captured.show ?? []),\n ...Object.keys(captured.defaults ?? {}),\n ...(captured.groups ?? []).flatMap((group) => group.fields),\n ...Object.keys(captured.when ?? {}),\n ...stepFields,\n ...Object.keys(captured.fields ?? {}),\n ...Object.values(captured.fields ?? {}).flatMap((f) => Object.values(f?.where ?? {})),\n ];\n const problems: string[] = [];\n const defaults = captured.defaults ?? {};\n const named = [...(captured.show ?? []), ...Object.keys(defaults)].filter((name) => !columnNamed(table.columns, name));\n const assignedDefaults = table.columns.filter((c) => c.identity === 'always' && Object.hasOwn(defaults, c.name));\n const nullDefaults = table.columns.filter((c) => !c.nullable && Object.hasOwn(defaults, c.name) && defaults[c.name] === null);\n if (named.length) problems.push(`Form: \"${table.name}\" has no column ${named.map((name) => `\"${name}\"`).join(', ')}.`);\n if (assignedDefaults.length)\n problems.push(\n `Form: ${assignedDefaults.map((c) => `\"${c.name}\"`).join(', ')} is always assigned by the database and cannot have a form default.`,\n );\n if (nullDefaults.length) problems.push(`Form: ${nullDefaults.map((c) => `\"${c.name}\"`).join(', ')} cannot default to null (NOT NULL).`);\n for (const [name, path] of Object.entries(captured.derived ?? {}))\n problems.push(...derivedProblems(name, path, table, context.derivedFrom ?? context.schema));\n if (shownFields) {\n const shown = new Set([...shownFields, ...Object.keys(defaults), ...Object.keys(captured.derived ?? {})]);\n const assigned = autoKey(table);\n const starved = table.columns.filter((c) => isRequired(c, assigned) && !shown.has(c.name));\n if (starved.length)\n problems.push(\n `Form: \"${table.name}\" requires ${starved.map((c) => `\"${c.name}\"`).join(', ')} (NOT NULL, no default) — show it, or give it a default.`,\n );\n }\n if (captured.steps) {\n const shown = new Set(captured.show ?? stepFields);\n const owned = new Set(stepFields);\n const missingOwnership = [...shown].filter((name) => !owned.has(name));\n const unshown = [...owned].filter((name) => !shown.has(name));\n if (missingOwnership.length || unshown.length) {\n problems.push('Form steps must own exactly the fields in show.');\n }\n const owner = new Map<string, string>();\n for (const step of captured.steps) for (const name of step.fields) owner.set(name, step.id);\n for (const group of captured.groups ?? []) {\n const stepIds = new Set(group.fields.map((name) => owner.get(name)).filter((id): id is string => id !== undefined));\n if (stepIds.size > 1) problems.push(`Form group \"${group.label}\" cannot span multiple steps.`);\n if (group.fields.some((name) => !owner.has(name)))\n problems.push(`Form group \"${group.label}\" contains a field outside the form steps.`);\n }\n }\n for (const name of new Set(presentationFields)) {\n if (!columnNamed(table.columns, name) || !readable.has(name)) problems.push(`Form field \"${name}\" is unknown or hidden.`);\n }\n /* A field may be shown while a computed column holds: the form works it out from the draft as it is filled in\n (newRecordModel.ts), so the condition reads it as a column, as the browser does. */\n const computed = table.computed ?? {};\n const judged = Object.keys(computed).length\n ? { ...table, columns: [...table.columns, ...Object.entries(computed).map(([name, value]) => computedColumnMeta(name, value))] }\n : table;\n for (const condition of Object.values(captured.when ?? {})) {\n if (!condition) continue;\n problems.push(...conditionProblems(condition, judged));\n if (referencedConditionFields(condition).some((name) => !readable.has(name) && !Object.hasOwn(computed, name))) {\n problems.push('Form visibility depends on an unreadable field.');\n }\n }\n const shownNow = new Set(shownFields ?? table.columns.map((c) => c.name));\n for (const [name, dress] of Object.entries(captured.fields ?? {})) {\n const column = columnNamed(table.columns, name);\n if (!column || !dress) continue;\n if (!shownNow.has(name)) problems.push(`Form: fields \"${name}\" is not a field this form asks for; add it to show, or drop its dress.`);\n if (dress.multiline !== undefined && family(column) !== 'text')\n problems.push(`Form: fields \"${name}\" is ${column.type || 'untyped'}; only a text field is drawn on one line or several.`);\n if (dress.as !== undefined) {\n const vocabulary = Boolean(column.allowed?.length);\n if (!vocabulary && !isFlagColumn(column))\n problems.push(\n `Form: fields \"${name}\" is ${column.type || 'untyped'}; \"as\" draws a column with a vocabulary (an enum or a check-constrained text) or a flag.`,\n );\n else if (!vocabulary && (dress.as === 'cards' || dress.as === 'radios'))\n problems.push(\n `Form: fields \"${name}\" is a flag; \"as: '${dress.as}'\" needs a vocabulary, a flag is drawn as \"buttons\" or \"select\".`,\n );\n }\n if (dress.where) problems.push(...narrowingProblems(name, column, dress.where, table, context.schema));\n if (dress.tree) problems.push(...treeProblems(name, column, dress.tree, context.schema));\n }\n for (const [name, value] of Object.entries(defaults)) {\n const column = columnNamed(table.columns, name);\n if (column) problems.push(...defaultWordProblems(name, column, value, context));\n }\n return [...new Set(problems)];\n}\n\n/* A narrowed picker is the reference's choices, where the referenced row\n agrees with this record on one to four columns. The server holds every\n write to it (appValidation.ts), so what it names must be real columns. */\nfunction narrowingProblems(\n name: string,\n column: ColumnMeta,\n where: Record<string, string>,\n table: TableMeta,\n schema?: DatabaseSchema,\n): string[] {\n if (!column.references)\n return [`Form: fields \"${name}\" narrows with \"where\", which only a reference takes; \"${name}\" refers to nothing.`];\n const problems: string[] = [];\n for (const local of Object.values(where)) {\n if (local === name) problems.push(`Form: fields \"${name}\", \"where\" compares \"${name}\" with itself.`);\n else if (!columnNamed(table.columns, local))\n problems.push(`Form: fields \"${name}\", \"where\" names \"${local}\", which is not a column of ${table.name}.`);\n }\n if (!schema) return problems;\n const target = schema.tables.find((candidate) => candidate.id === column.references!.table);\n if (!target)\n return [\n ...problems,\n `Form: fields \"${name}\" refers to ${column.references.table}, which this catalog does not read, so its choices cannot be narrowed.`,\n ];\n for (const remote of Object.keys(where)) {\n if (!columnNamed(target.columns, remote))\n problems.push(`Form: fields \"${name}\", \"where\" names \"${remote}\", which is not a column of ${target.name}.`);\n }\n return problems;\n}\n\n/* A tree picker draws the referenced table as the hierarchy one of its columns makes, so that column must name a\n row of the same table: a parent read from anywhere else would open a branch onto another table's keys. */\nfunction treeProblems(name: string, column: ColumnMeta, tree: string, schema?: DatabaseSchema): string[] {\n if (!column.references) return [`Form: fields \"${name}\" is drawn as a tree, which only a reference is; \"${name}\" refers to nothing.`];\n if (!schema) return [];\n const target = schema.tables.find((candidate) => candidate.id === column.references!.table);\n if (!target)\n return [\n `Form: fields \"${name}\" refers to ${column.references.table}, which this catalog does not read, so it cannot be drawn as a tree.`,\n ];\n const parent = columnNamed(target.columns, tree);\n if (!parent) return [`Form: fields \"${name}\", \"tree\" names \"${tree}\", which is not a column of ${target.name}.`];\n const to =\n parent.references?.table ??\n schema.foreignKeys.find((key) => key.from.table === target.id && key.from.columns.length === 1 && key.from.columns[0] === tree)?.to\n .table;\n if (to !== target.id)\n return [\n `Form: fields \"${name}\", \"tree\" names \"${tree}\", which ${to ? `refers to ${to}` : 'refers to nothing'}; a tree's column names a parent row of ${target.name} itself.`,\n ];\n return [];\n}\n\nfunction referencedTable(to: string | undefined, schema: DatabaseSchema | undefined): TableMeta | undefined {\n return to && schema\n ? (schema.tables.find((candidate) => candidate.id === to) ?? schema.tables.find((candidate) => candidate.name === to))\n : undefined;\n}\n\n/** The table a reference column of `table` names, where the catalog reads it. */\nexport function referenceTarget(via: string, table: TableMeta, schema: DatabaseSchema | undefined): TableMeta | undefined {\n const reference = columnNamed(table.columns, via);\n const fk = schema?.foreignKeys.find((key) => key.from.table === table.id && key.from.columns.length === 1 && key.from.columns[0] === via);\n return reference ? referencedTable(reference.references?.table ?? fk?.to.table, schema) : undefined;\n}\n\n/**\n * A value from a referenced record (`defaults: { labor_charge: { from: 'service_id.price' } }`): the first name\n * is a reference of this table, the second a column of the table it names, holding what this column holds.\n */\nexport function derivedSource(\n path: string,\n table: TableMeta,\n schema: DatabaseSchema | undefined,\n): { via: ColumnMeta; target: TableMeta; column: ColumnMeta; key: string } | { problem: string } {\n const [via, name] = path.split('.');\n const reference = columnNamed(table.columns, via);\n if (!reference) return { problem: `\"${table.name}\" has no column \"${via}\".` };\n const fk = schema?.foreignKeys.find((key) => key.from.table === table.id && key.from.columns.length === 1 && key.from.columns[0] === via);\n const to = reference.references?.table ?? fk?.to.table;\n const target = referencedTable(to, schema);\n if (!to) return { problem: `\"${via}\" is no reference, so it names no record to take a value from.` };\n if (!target) return { problem: `\"${via}\" refers to ${to}, which this catalog does not read.` };\n const column = columnNamed(target.columns, name);\n if (!column) return { problem: `${target.name} has no column \"${name}\".` };\n const key = reference.references?.column ?? fk?.to.columns[0] ?? target.columns.find((candidate) => candidate.primaryKey)?.name;\n if (!key) return { problem: `${target.name} has no key \"${via}\" could name.` };\n return { via: reference, target, column, key };\n}\n\nfunction derivedProblems(name: string, path: string, table: TableMeta, schema: DatabaseSchema | undefined): string[] {\n const column = columnNamed(table.columns, name);\n if (!column) return [`Form: \"${table.name}\" has no column \"${name}\".`];\n if (!schema) return [];\n const source = derivedSource(path, table, schema);\n if ('problem' in source) return [`Form: defaults \"${name}\" is from \"${path}\": ${source.problem}`];\n if (columnKind(source.column.type) !== columnKind(column.type))\n return [\n `Form: defaults \"${name}\" is from \"${path}\", which is ${source.column.type || 'untyped'}; \"${name}\" is ${column.type || 'untyped'}.`,\n ];\n return [];\n}\n\nfunction defaultWordProblems(name: string, column: ColumnMeta, value: FormScalar, context: AppFormContext): string[] {\n if (value === 'today' || value === 'now') {\n return formDefaultWord(column, value)\n ? []\n : [\n `Form: defaults \"${name}\" is ${value}, which fills a date column; \"${name}\" is ${column.type || 'untyped'}` +\n \" (a SQLite TEXT date is declared with types: { column: 'date' }).\",\n ];\n }\n if (value !== 'me') return [];\n if (!formDefaultWord(column, value))\n return [\n `Form: defaults \"${name}\" is me, the signed-in person — a row of the auth.me table or an email; \"${name}\" is ${column.type || 'untyped'}.`,\n ];\n if (context.person === null) return [`Form: defaults \"${name}\" is me, and this App has no sign-in.`];\n if (context.person && column.references && column.references.table !== context.person.table) {\n return [\n `Form: defaults \"${name}\" is me, and \"${name}\" refers to ${column.references.table}, not to the table people are rows of (auth.me).`,\n ];\n }\n return [];\n}\n\nfunction tableId(table: TableMeta): string {\n return table.id;\n}\n\n/** Validate the child-group contract against a catalog before it is exposed.\n * This checks only shape, relation and field authority; it never creates a\n * child, infers a write grant, or treats a presentation form as permission. */\nexport function validateFormChildren(\n children: readonly FormChildGroup[],\n parent: TableMeta,\n schema: DatabaseSchema,\n readableFields: ReadonlyMap<string, readonly string[]> = new Map(),\n): string[] {\n const problems: string[] = [];\n const seen = new Set<string>();\n for (const child of parseFormChildren(children)) {\n if (seen.has(child.id)) problems.push(`Child group \"${child.id}\" is declared more than once.`);\n seen.add(child.id);\n const targets = schema.tables.filter((table) => table.id === child.table || table.name === child.table);\n const target = targets.length === 1 ? targets[0] : undefined;\n if (!target) {\n problems.push(`Child group \"${child.id}\" names an unknown or ambiguous table.`);\n continue;\n }\n const from = columnNamed(target.columns, child.relation.from);\n const to = columnNamed(parent.columns, child.relation.to);\n if (!from || !to) problems.push(`Child group \"${child.id}\" has an unknown relation column.`);\n const relation = schema.foreignKeys.filter(\n (fk) =>\n fk.from.table === tableId(target) &&\n fk.to.table === tableId(parent) &&\n fk.from.columns.length === 1 &&\n fk.to.columns.length === 1 &&\n fk.from.columns[0] === child.relation.from &&\n fk.to.columns[0] === child.relation.to,\n );\n if (relation.length !== 1) problems.push(`Child group \"${child.id}\" must name one declared foreign-key relation to its parent.`);\n const readable = readableFields.get(target.id) ?? target.columns.map((column) => column.name);\n if (child.form)\n problems.push(...validateAppForm(child.form, target, readable).map((problem) => `Child group \"${child.id}\": ${problem}`));\n }\n return [...new Set(problems)];\n}\n\ninterface FormChildInput {\n /** Child rows keyed by the authored group ID; absent means an empty draft. */\n rows?: readonly Readonly<Record<string, unknown>>[];\n}\n\ninterface FormChildrenResult {\n valid: boolean;\n errors: Record<string, string[]>;\n unresolved: string[];\n}\n\nfunction safeScalar(raw: unknown): FormScalar | undefined {\n if (raw === null) return null;\n if (typeof raw === 'string') return raw;\n if (typeof raw === 'boolean') return raw;\n if (typeof raw === 'number' && Number.isFinite(raw) && Math.abs(raw) <= Number.MAX_SAFE_INTEGER) return raw;\n return undefined;\n}\n\n/** Evaluate a bounded aggregate draft without persistence. The caller supplies\n * the already-authorized resource rules; unknown rows and relations remain\n * unresolved rather than becoming a false success. */\nexport function evaluateFormChildren(\n children: readonly FormChildGroup[],\n parentRow: Readonly<Record<string, unknown>>,\n inputs: Readonly<Record<string, FormChildInput | undefined>>,\n schema: DatabaseSchema,\n validation: ReadonlyMap<string, readonly FormRule[]> = new Map(),\n): FormChildrenResult {\n const errors: Record<string, string[]> = {};\n const unresolved = new Set<string>();\n const add = (key: string, message: string) => {\n const list = errors[key] ?? (errors[key] = []);\n if (!list.includes(message)) list.push(message);\n };\n for (const child of parseFormChildren(children)) {\n const targets = schema.tables.filter((table) => table.id === child.table || table.name === child.table);\n const target = targets.length === 1 ? targets[0] : undefined;\n if (!target) {\n unresolved.add(child.id);\n continue;\n }\n const input = inputs[child.id];\n const rows = input?.rows ?? [];\n if (!Array.isArray(rows) || rows.length > child.max || rows.length < (child.min ?? 0)) {\n add(child.id, `Add between ${child.min ?? 0} and ${child.max} items.`);\n continue;\n }\n const parentValue = safeScalar(rowValue(parentRow, child.relation.to));\n const fk = columnNamed(target.columns, child.relation.from);\n if (!fk || parentValue === undefined) {\n unresolved.add(child.id);\n continue;\n }\n const rules = validation.get(target.id) ?? validation.get(target.name) ?? [];\n rows.forEach((row, index) => {\n const key = `${child.id}[${index}]`;\n if (!row || typeof row !== 'object' || Array.isArray(row)) {\n unresolved.add(key);\n return;\n }\n const childValue = rowValue(row, child.relation.from);\n const linked = comparisonResult({ field: child.relation.from, operator: 'eq', values: [parentValue] }, row, target.columns);\n if (linked === false) add(`${key}.${child.relation.from}`, 'This item belongs to a different parent.');\n else if (linked === 'unknown' || childValue === undefined) unresolved.add(`${key}.${child.relation.from}`);\n if (rules.length) {\n const result = evaluateFormRules(rules, row, target.columns, { mode: 'authoritative' });\n for (const [fieldName, messages] of Object.entries(result.errors)) {\n for (const message of messages) add(`${key}.${fieldName}`, message);\n }\n result.unresolved.forEach((fieldName) => unresolved.add(`${key}.${fieldName}`));\n }\n });\n }\n return { valid: !Object.keys(errors).length && !unresolved.size, errors, unresolved: [...unresolved] };\n}\n\ninterface FormRuleResult {\n valid: boolean;\n errors: Record<string, string[]>;\n /** Rule target fields whose result is unknown, including incomplete drafts. */\n unresolved: string[];\n}\n\n/** Validate a complete candidate row, after trusted default resolution / update\n * merging. Does not read defaults, merge drafts, write, or grant authority.\n * Preview leaves unknown rules unresolved without showing premature field errors.\n * Authoritative mode rejects them with fixed safe messages. Both return valid:false.\n * Transport owners must also redact messages/field keys for unreadable targets.\n */\nexport function evaluateFormRules(\n rules: readonly FormRule[],\n row: Readonly<Record<string, unknown>>,\n columns: readonly ColumnMeta[],\n options?: { mode: 'authoritative' | 'preview' },\n): FormRuleResult {\n const errors: Record<string, string[]> = {};\n const unresolved = new Set<string>();\n const add = (name: string, message: string) => {\n const messages = errors[name] ?? (errors[name] = []);\n if (!messages.includes(message)) messages.push(message);\n };\n const judged = blanksAsEmpty(row, columns);\n for (const rule of parseFormRules(rules)) {\n const applies = rule.when ? evaluateFormCondition(rule.when, row, columns, true) : true;\n if (applies === false) continue;\n const at = ruleField(rule);\n let result: boolean | 'unknown' = 'unknown';\n if (applies === true) {\n try {\n result = conditionResult(compileCondition(rule.must, 'Validation', columns, 'record', true), judged, columns);\n } catch {\n result = 'unknown';\n }\n }\n if (result === 'unknown') {\n unresolved.add(at);\n if (options?.mode !== 'preview') add(at, FORM_UNRESOLVED_MESSAGE);\n } else if (!result) add(at, rule.message);\n }\n return { valid: !Object.keys(errors).length && !unresolved.size, errors, unresolved: [...unresolved] };\n}\n","/**\n * Flows whose steps are rows: a resource's `flows` binds a table of\n * flows and a table of their steps, which an administrator edits while the\n * App runs, to the durable workflow engine that runs them on its records:\n *\n * purchase_order: {\n * flows: {\n * from: 'po_flow', steps: 'po_flow_step',\n * set: ['notes'],\n * events: { 'po.decided': 'order' },\n * kinds: { approval: { command: 'requestApproval', input: ['approver'], waitFor: 'po.decided' } },\n * },\n * }\n *\n * The rows have fixed column names, so there is one way to write one. A flow\n * is `id`, `name` and `start` (`created`, `updated` or `manual`), and may\n * have a `condition` in the query language, `changes` (the one column an\n * update must change) and `active`. A step is `flow_id`, `position` and\n * `kind`, with the inputs its kind reads: the platform's own kinds (`wait`,\n * `until`, `branch`, `set`, `waitFor`, `notify`) and the App's, each of which runs one\n * of the App's commands on the record — so whatever a flow does to data goes\n * through the command door, under its rules, principal and audit.\n *\n * Steps that share a position start together, and the run goes on once each\n * is done. A step of an App kind that waits for an event may wait for `all`\n * of those its command asked (its `mode`), end early when its `condition`\n * holds, give up after its `duration`, and run the kind's `remind` command\n * every `remind` while it waits.\n *\n * A `notify` step tells an `audience` its `message`: the resource's `notify`\n * rules `on: { flow: '<audience>' }` say who that is and how (`to`, `send`,\n * `email`), and the words are the step's (`{message}` in the rule's title),\n * kept in the inbox in the step's own transaction (adapters/inbox/inbox.ts).\n *\n * Pure, and shared: the server judges a stored row here (appValidation.ts)\n * and compiles a flow's rows into the plan a run follows (flowCommand.ts)\n * with the same words, so a row the form accepted is a step the run can take.\n */\nimport { parseDuration } from '@mistriwork/engine/shared/duration.js';\n\n/** A step kind the App declares: the command it runs on the record, the step columns it takes as input, and an event to wait for after. */\ninterface FlowKind {\n readonly command: string;\n /** Step columns passed to the command under their own names; `'note?'` is one a step may leave empty. */\n readonly input?: readonly string[];\n /** An event of `events` the run waits for once the command has run. */\n readonly waitFor?: string;\n /** A command run on the record, with the same input, every `remind` a step of this kind waits. */\n readonly remind?: string;\n}\n\n/** `resources.<r>.flows`: the tables the flows and their steps are rows of, and what those rows may do. */\nexport interface FlowBinding {\n readonly from: string;\n readonly steps: string;\n /** Columns of the record a `set` step may write. None: the App offers no `set` step. */\n readonly set?: readonly string[];\n /** The events a run may wait for, each with the payload field that names the record it is about. */\n readonly events?: Readonly<Record<string, string>>;\n readonly kinds?: Readonly<Record<string, FlowKind>>;\n}\n\n/** The platform's own step kinds. */\nconst BUILT_IN_KINDS = ['wait', 'until', 'branch', 'set', 'waitFor', 'notify'] as const;\n/** The longest a notify step's words may be: a notice is a line. */\nconst MESSAGE_MOST = 500;\nconst FLOW_TRIGGERS = ['created', 'updated', 'manual'] as const;\nexport type FlowTrigger = (typeof FLOW_TRIGGERS)[number];\n\n/** The columns every flows table has, and every steps table: the rest are read where present. */\nconst FLOW_NEEDED = ['id', 'name', 'start'] as const;\nconst STEP_NEEDED = ['flow_id', 'position', 'kind'] as const;\n/** The most steps one flow runs: a process, not a program. */\nexport const FLOW_STEPS_MOST = 100;\n/** The longest a step may wait: the workflow engine's own ceiling. */\nconst DURATION_MOST = 366 * 86_400_000;\n\nconst IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/;\nconst KIND_NAME = /^[A-Za-z][A-Za-z0-9_]{0,39}$/;\nconst EVENT_NAME = /^[A-Za-z][A-Za-z0-9_.-]{0,127}$/;\nconst COMMAND_ID = /^[A-Za-z][A-Za-z0-9_-]*$/;\n\nconst isObject = (value: unknown): value is Record<string, unknown> => !!value && typeof value === 'object' && !Array.isArray(value);\n\n/** `resources.<r>.flows`, read for its shape. Throws the sentence the author reads. */\nexport function parseFlows(raw: unknown, at: string): FlowBinding {\n const here = `${at}, flows`;\n if (!isObject(raw))\n throw new Error(\n `${here} is not an object → { from, steps, set?, events?, kinds? }, like flows: { from: 'po_flow', steps: 'po_flow_step' }.`,\n );\n const unknown = Object.keys(raw).find((key) => !['from', 'steps', 'set', 'events', 'kinds'].includes(key));\n if (unknown) throw new Error(`${here} has \"${unknown}\"; it takes from, steps, set, events and kinds.`);\n for (const name of ['from', 'steps'] as const)\n if (typeof raw[name] !== 'string' || !raw[name].trim())\n throw new Error(`${here}: \"${name}\" names the resource whose rows are the ${name === 'from' ? 'flows' : \"flows' steps\"}.`);\n const binding: { -readonly [K in keyof FlowBinding]: FlowBinding[K] } = {\n from: (raw.from as string).trim(),\n steps: (raw.steps as string).trim(),\n };\n if (raw.set !== undefined) {\n if (!Array.isArray(raw.set) || !raw.set.length || raw.set.some((column) => typeof column !== 'string' || !IDENTIFIER.test(column)))\n throw new Error(`${here}: \"set\" lists the record's own columns a set step may write, like set: ['notes'].`);\n binding.set = Object.freeze([...new Set(raw.set as string[])]);\n }\n if (raw.events !== undefined) {\n if (!isObject(raw.events) || !Object.keys(raw.events).length)\n throw new Error(\n `${here}: \"events\" names each event a run may wait for and the payload field naming the record, like events: { 'po.decided': 'order' }.`,\n );\n for (const [name, field] of Object.entries(raw.events)) {\n if (!EVENT_NAME.test(name))\n throw new Error(`${here}, events \"${name}\": an event is named as defineEvent names it, like 'po.decided'.`);\n if (typeof field !== 'string' || !IDENTIFIER.test(field))\n throw new Error(`${here}, events \"${name}\": name the payload field that holds the record's id, like 'order'.`);\n }\n binding.events = Object.freeze({ ...(raw.events as Record<string, string>) });\n }\n if (raw.kinds !== undefined) {\n if (!isObject(raw.kinds) || !Object.keys(raw.kinds).length)\n throw new Error(`${here}: \"kinds\" names each step kind the App adds, like kinds: { send: { command: 'sendPurchaseOrder' } }.`);\n const kinds: Record<string, FlowKind> = {};\n for (const [name, value] of Object.entries(raw.kinds)) {\n const kind = `${here}, kinds \"${name}\"`;\n if (!KIND_NAME.test(name)) throw new Error(`${kind}: a step kind is a word of letters, digits and underscores.`);\n if ((BUILT_IN_KINDS as readonly string[]).includes(name))\n throw new Error(\n `${kind}: \"${name}\" is one of the platform's own step kinds (${BUILT_IN_KINDS.join(', ')}); name the App's kind another word.`,\n );\n if (!isObject(value)) throw new Error(`${kind} is not an object → { command, input?, waitFor?, remind? }.`);\n const extra = Object.keys(value).find((key) => !['command', 'input', 'waitFor', 'remind'].includes(key));\n if (extra) throw new Error(`${kind} has \"${extra}\"; it takes command, input, waitFor and remind.`);\n if (typeof value.command !== 'string' || !COMMAND_ID.test(value.command))\n throw new Error(`${kind}: \"command\" names one of the App's commands, which the step runs on the record.`);\n const entry: { command: string; input?: readonly string[]; waitFor?: string; remind?: string } = { command: value.command };\n if (value.input !== undefined) {\n if (\n !Array.isArray(value.input) ||\n !value.input.length ||\n value.input.some((column) => typeof column !== 'string' || !IDENTIFIER.test(column.replace(/\\?$/, '')))\n )\n throw new Error(\n `${kind}: \"input\" lists the step columns the command takes, like input: ['approver'] ('note?' for one a step may leave empty).`,\n );\n entry.input = Object.freeze([...(value.input as string[])]);\n }\n if (value.waitFor !== undefined) {\n if (typeof value.waitFor !== 'string' || !binding.events || !Object.hasOwn(binding.events, value.waitFor))\n throw new Error(`${kind}: \"waitFor\" names one of the flows' events, which \"events\" lists.`);\n entry.waitFor = value.waitFor;\n }\n if (value.remind !== undefined) {\n if (typeof value.remind !== 'string' || !COMMAND_ID.test(value.remind) || entry.waitFor === undefined)\n throw new Error(`${kind}: \"remind\" names one of the App's commands, run on the record while a step waits for \"waitFor\".`);\n entry.remind = value.remind;\n }\n kinds[name] = Object.freeze(entry);\n }\n binding.kinds = Object.freeze(kinds);\n }\n return Object.freeze(binding);\n}\n\n/** Every command a binding's kinds run, with the kind that runs it: its step's command, and its reminder. */\nexport const flowKindCommands = (binding: FlowBinding): { kind: string; command: string }[] =>\n Object.entries(binding.kinds ?? {}).flatMap(([kind, declared]) => [\n { kind, command: declared.command },\n ...(declared.remind ? [{ kind, command: declared.remind }] : []),\n ]);\n\n/** A kind's input column, and whether a step may leave it empty. */\nconst kindInputs = (kind: FlowKind): { column: string; optional: boolean }[] =>\n (kind.input ?? []).map((name) => ({ column: name.replace(/\\?$/, ''), optional: name.endsWith('?') }));\n\ninterface CatalogTable {\n readonly name: string;\n readonly columns: readonly { readonly name: string; readonly primaryKey: boolean }[];\n}\n\n/** Why a binding cannot run on this catalog, or undefined. `machine` is the record's state column, which only its verbs move. */\nexport function flowsProblem(\n binding: FlowBinding,\n table: CatalogTable,\n from: CatalogTable | undefined,\n steps: CatalogTable | undefined,\n machine?: string,\n): string | undefined {\n const has = (meta: CatalogTable, name: string) => meta.columns.some((column) => column.name === name);\n if (table.columns.filter((column) => column.primaryKey).length !== 1)\n return `flows: \"${table.name}\" has no single-column key; a flow's run and the events it waits for name a record by one key.`;\n if (!from) return `flows: \"${binding.from}\" is not a declared resource on this connection.`;\n if (!steps) return `flows: \"${binding.steps}\" is not a declared resource on this connection.`;\n const missing = (meta: CatalogTable, needed: readonly string[]) => needed.filter((name) => !has(meta, name));\n const flowGap = missing(from, FLOW_NEEDED);\n if (flowGap.length)\n return `flows: \"${from.name}\" has no ${flowGap.map((name) => `\"${name}\"`).join(', ')}; a flow row has id, name and start (and may have condition, changes and active).`;\n const stepGap = missing(steps, STEP_NEEDED);\n if (stepGap.length)\n return `flows: \"${steps.name}\" has no ${stepGap.map((name) => `\"${name}\"`).join(', ')}; a step row has flow_id, position and kind (and the columns its kind reads).`;\n for (const column of binding.set ?? []) {\n if (!has(table, column)) return `flows: set names \"${column}\", which \"${table.name}\" does not have.`;\n if (table.columns.find((candidate) => candidate.name === column)!.primaryKey) return `flows: set names \"${column}\", the record's key.`;\n if (column === machine) return `flows: set names \"${column}\", the state column of the record's machine, which only its verbs move.`;\n }\n for (const [name, kind] of Object.entries(binding.kinds ?? {}))\n for (const { column } of kindInputs(kind))\n if (!has(steps, column)) return `flows: kind \"${name}\" takes \"${column}\", which \"${steps.name}\" does not have.`;\n return undefined;\n}\n\n/* ---------- a row, judged ---------- */\n\n/** What a row breaks, by the column that says it. */\ntype FlowBreak =\n | 'name'\n | 'start'\n | 'condition'\n | 'changes'\n | 'kind'\n | 'position'\n | 'duration'\n | 'dateField'\n | 'setField'\n | 'goto'\n | 'event'\n | 'input'\n | 'mode'\n | 'remind'\n | 'together'\n | 'audience'\n | 'message'\n | 'flowId';\n\n/** What the server says of a break: a fixed sentence, never the row's value. */\nexport const FLOW_REASONS: Readonly<Record<FlowBreak, string>> = Object.freeze({\n name: 'Name the flow.',\n start: 'Choose created, updated or manual.',\n condition: 'Write a condition in the query language about this record, like status = draft.',\n changes: \"Name one of the record's columns.\",\n kind: 'Choose one of the step kinds this App offers.',\n position: 'Give the step a whole-number position.',\n duration: \"Enter a duration, like '2 hours' or '3 days', at most a year.\",\n dateField: \"Name one of the record's date columns.\",\n setField: 'Name a column a flow may set.',\n goto: \"Name a later step's position.\",\n event: 'Choose one of the events this App’s flows wait for.',\n input: 'This step kind needs a value here.',\n mode: 'Choose any or all: all waits for each one the step asks.',\n remind: \"Enter how often to remind, like '1 day', on a step whose kind reminds.\",\n together: 'A branch decides alone: give it a position no other step has.',\n audience: \"Choose who is told: one of the audiences this App's notices name.\",\n message: `Write what they are told, at most ${MESSAGE_MOST} characters.`,\n flowId: 'Choose the flow this step belongs to.',\n});\n\n/** What the judge knows of the record's table: its columns, its date columns, and whether a condition reads. */\nexport interface FlowRecordShape {\n readonly columns: ReadonlySet<string>;\n readonly dates: ReadonlySet<string>;\n /** Whether a condition is a filter over the record's stored columns. */\n readonly condition: (text: string) => boolean;\n /** The audiences the resource's `notify` rules name `on: { flow }`: whom a `notify` step may tell. */\n readonly audiences?: ReadonlySet<string>;\n}\n\nconst text = (value: unknown): string | undefined => {\n if (value === null || value === undefined) return undefined;\n const said = typeof value === 'string' ? value.trim() : typeof value === 'number' || typeof value === 'boolean' ? String(value) : '';\n return said ? said : undefined;\n};\nconst whole = (value: unknown): number | undefined => {\n const n = typeof value === 'number' ? value : typeof value === 'string' && /^\\s*-?\\d+\\s*$/.test(value) ? Number(value) : NaN;\n return Number.isSafeInteger(n) ? n : undefined;\n};\nconst durationMs = (value: unknown): number | undefined => {\n const ms = parseDuration(text(value));\n return ms && ms <= DURATION_MOST ? ms : undefined;\n};\n\n/** Every break of a flow row, by column. */\nexport function flowRowBreaks(row: Readonly<Record<string, unknown>>, record: FlowRecordShape): { field: string; reason: FlowBreak }[] {\n const breaks: { field: string; reason: FlowBreak }[] = [];\n if (!text(row.name)) breaks.push({ field: 'name', reason: 'name' });\n if (!(FLOW_TRIGGERS as readonly string[]).includes(text(row.start) ?? '')) breaks.push({ field: 'start', reason: 'start' });\n const condition = text(row.condition);\n if (condition !== undefined && !record.condition(condition)) breaks.push({ field: 'condition', reason: 'condition' });\n const changes = text(row.changes);\n if (changes !== undefined && !record.columns.has(changes)) breaks.push({ field: 'changes', reason: 'changes' });\n return breaks;\n}\n\n/** Every break of a step row, by column: an unknown kind, or an input its kind needs and lacks or cannot read. */\nexport function stepRowBreaks(\n row: Readonly<Record<string, unknown>>,\n binding: FlowBinding,\n record: FlowRecordShape,\n): { field: string; reason: FlowBreak }[] {\n const breaks: { field: string; reason: FlowBreak }[] = [];\n const say = (field: string, reason: FlowBreak) => breaks.push({ field, reason });\n if (row.flow_id === null || row.flow_id === undefined || row.flow_id === '') say('flow_id', 'flowId');\n const position = whole(row.position);\n if (position === undefined || position < 0) say('position', 'position');\n const kind = text(row.kind) ?? '';\n const duration = text(row.duration);\n switch (kind) {\n case 'wait':\n if (durationMs(duration) === undefined) say('duration', 'duration');\n break;\n case 'until':\n if (!record.dates.has(text(row.field) ?? '')) say('field', 'dateField');\n if (duration !== undefined && durationMs(duration) === undefined) say('duration', 'duration');\n break;\n case 'branch': {\n const condition = text(row.condition);\n if (condition === undefined || !record.condition(condition)) say('condition', 'condition');\n // A branch only jumps forward, so a run visits each step at most once.\n if (text(row.goto) !== undefined) {\n const to = whole(row.goto);\n if (to === undefined || (position !== undefined && to <= position)) say('goto', 'goto');\n }\n break;\n }\n case 'set':\n if (!(binding.set ?? []).includes(text(row.field) ?? '')) say('field', 'setField');\n break;\n case 'waitFor':\n if (!Object.hasOwn(binding.events ?? {}, text(row.event) ?? '')) say('event', 'event');\n if (duration !== undefined && durationMs(duration) === undefined) say('duration', 'duration');\n break;\n case 'notify': {\n if (!record.audiences?.has(text(row.audience) ?? '')) say('audience', 'audience');\n const message = text(row.message);\n if (message === undefined || message.length > MESSAGE_MOST) say('message', 'message');\n break;\n }\n default: {\n const declared = Object.hasOwn(binding.kinds ?? {}, kind) ? binding.kinds![kind] : undefined;\n if (!declared) {\n say('kind', 'kind');\n break;\n }\n const inputs = kindInputs(declared);\n for (const { column, optional } of inputs) if (!optional && text(row[column]) === undefined) say(column, 'input');\n /* The wait's own columns, where the kind does not take them as input: only a kind that waits has a wait to shape. */\n const own = (column: string) => !inputs.some((input) => input.column === column);\n const waits = declared.waitFor !== undefined;\n const mode = text(row.mode);\n if (own('mode') && mode !== undefined && (!waits || (mode !== 'any' && mode !== 'all'))) say('mode', 'mode');\n const remind = text(row.remind);\n if (own('remind') && remind !== undefined && (!declared.remind || durationMs(remind) === undefined)) say('remind', 'remind');\n if (own('duration') && duration !== undefined && (!waits || durationMs(duration) === undefined)) say('duration', 'duration');\n const condition = text(row.condition);\n if (own('condition') && condition !== undefined && (!waits || !record.condition(condition))) say('condition', 'condition');\n }\n }\n return breaks;\n}\n\n/* ---------- a flow's rows, as the plan a run follows ---------- */\n\n/** One step as a run takes it: read once, when the run starts, and kept with it. */\nexport type PlanStep = Readonly<\n {\n position: number;\n title?: string;\n /** Its place among the steps that share its position, from 1, where more than one does: they start together. */\n member?: number;\n } & (\n | { kind: 'wait'; duration: string }\n | { kind: 'until'; field: string; duration?: string }\n | { kind: 'branch'; condition: string; goto?: number }\n | { kind: 'set'; field: string; value: string | null }\n | { kind: 'waitFor'; event: string; field: string; duration?: string }\n | { kind: 'notify'; audience: string; message: string }\n | {\n kind: 'command';\n name: string;\n command: string;\n input: Readonly<Record<string, string>>;\n waitFor?: { event: string; field: string };\n /** Wait for each one the command asked (its output's `asked`), not the first. */\n mode?: 'all';\n /** The wait ends early once this holds of the record. */\n condition?: string;\n /** The most the wait lasts; then the run goes on. */\n duration?: string;\n /** The command run every `every` while the step waits. */\n remind?: { command: string; every: string };\n }\n )\n>;\n\nexport interface FlowPlan {\n readonly flow: string;\n readonly name: string;\n readonly steps: readonly PlanStep[];\n /** The first row that cannot run: the run stops on it, saying why, before it does anything. */\n readonly problem?: Readonly<{ position: number | null; reason: string }>;\n}\n\n/** A flow's rows as its plan, in position order. Judged as a write judges them, so a row the form refused never runs. */\nexport function flowPlan(\n flow: Readonly<Record<string, unknown>>,\n rows: readonly Readonly<Record<string, unknown>>[],\n binding: FlowBinding,\n record: FlowRecordShape,\n): FlowPlan {\n const id = text(flow.id) ?? '';\n const name = text(flow.name) ?? id;\n /* Steps that share a position keep one order, by their own key, so a run's steps are named the same each time they are read. */\n const ordered = [...rows].sort(\n (a, b) => (whole(a.position) ?? 0) - (whole(b.position) ?? 0) || String(a.id ?? '').localeCompare(String(b.id ?? '')),\n );\n if (ordered.length > FLOW_STEPS_MOST)\n return { flow: id, name, steps: [], problem: { position: null, reason: `A flow runs at most ${FLOW_STEPS_MOST} steps.` } };\n const steps: PlanStep[] = [];\n const shared = new Map<number, number>();\n for (const row of ordered) shared.set(whole(row.position) ?? -1, (shared.get(whole(row.position) ?? -1) ?? 0) + 1);\n const members = new Map<number, number>();\n for (const row of ordered) {\n const position = whole(row.position) ?? -1;\n const broken = stepRowBreaks(row, binding, record)[0];\n if (broken) return { flow: id, name, steps: [], problem: { position, reason: `${broken.field}: ${FLOW_REASONS[broken.reason]}` } };\n const together = shared.get(position)! > 1;\n if (together && (text(row.kind) === 'branch' || text(row.remind) !== undefined))\n return {\n flow: id,\n name,\n steps: [],\n problem: {\n position,\n reason: text(row.kind) === 'branch' ? FLOW_REASONS.together : 'A step that starts together with others sends no reminders.',\n },\n };\n const member = (members.get(position) ?? 0) + 1;\n members.set(position, member);\n const title = text(row.title);\n const head = { position, ...(title ? { title: title.slice(0, 200) } : {}), ...(together ? { member } : {}) };\n const kind = text(row.kind)!;\n const duration = text(row.duration);\n switch (kind) {\n case 'wait':\n steps.push({ ...head, kind, duration: duration! });\n break;\n case 'until':\n steps.push({ ...head, kind, field: text(row.field)!, ...(duration ? { duration } : {}) });\n break;\n case 'branch': {\n const to = whole(row.goto);\n steps.push({ ...head, kind, condition: text(row.condition)!, ...(to === undefined ? {} : { goto: to }) });\n break;\n }\n case 'set':\n steps.push({ ...head, kind, field: text(row.field)!, value: text(row.value) ?? null });\n break;\n case 'waitFor': {\n const event = text(row.event)!;\n steps.push({ ...head, kind, event, field: binding.events![event], ...(duration ? { duration } : {}) });\n break;\n }\n case 'notify':\n steps.push({ ...head, kind, audience: text(row.audience)!, message: text(row.message)! });\n break;\n default: {\n const declared = binding.kinds![kind];\n const inputs = kindInputs(declared);\n const input = Object.fromEntries(\n inputs.flatMap(({ column }) => {\n const value = text(row[column]);\n return value === undefined ? [] : [[column, value]];\n }),\n );\n const own = (column: string) => (inputs.some((each) => each.column === column) ? undefined : text(row[column]));\n const wait = declared.waitFor\n ? {\n waitFor: { event: declared.waitFor, field: binding.events![declared.waitFor] },\n ...(own('mode') === 'all' ? { mode: 'all' as const } : {}),\n ...(own('condition') ? { condition: own('condition')! } : {}),\n ...(own('duration') ? { duration: own('duration')! } : {}),\n ...(declared.remind && own('remind') ? { remind: { command: declared.remind, every: own('remind')! } } : {}),\n }\n : {};\n steps.push({ ...head, kind: 'command', name: kind, command: declared.command, input, ...wait });\n }\n }\n }\n return { flow: id, name, steps };\n}\n\n/** Whether a flow row is switched on: no `active` column, or one that is not false. */\nexport function flowActive(row: Readonly<Record<string, unknown>>): boolean {\n const value = row.active;\n return !(value === false || value === 0 || value === '0' || value === 'false' || value === 'f');\n}\n\n/** Whether a flow starts on this change: its `start`, and an update's `changes` column among the columns that changed.\n * A change naming a flow starts that one alone: a manual start, or `mistri flows start --flow` (flowStarts.ts). */\nexport function flowTriggered(\n row: Readonly<Record<string, unknown>>,\n change: Readonly<{ trigger: FlowTrigger; changed: readonly string[]; flow?: string }>,\n): boolean {\n if (!flowActive(row)) return false;\n const trigger = text(row.start);\n if (change.trigger === 'manual') return trigger === 'manual' && text(row.id) === change.flow;\n if (trigger !== change.trigger || (change.flow !== undefined && text(row.id) !== change.flow)) return false;\n const changes = text(row.changes);\n return change.trigger === 'created' || changes === undefined || change.changed.includes(changes);\n}\n","/**\n * Content: everything a visitor can open, keyed in `views`, and the `nav`\n * that only arranges references to them. A view is one of:\n *\n * - `list`: the rows of one resource — how they read (`show`, `tabs`,\n * `filters`), how they draw (`presentation`), how they open (`open`);\n * - `dashboard`: sections about whole tables, which may embed a list view;\n * - `form`: one command's form, signed in or public (appForms.ts);\n * - `landing`: the public front page (appLanding.ts).\n *\n * Nav holds a view id, `{ to, label }` for a menu-only word, or a\n * `navGroup` — never an inline definition — and is optional: an App\n * without it has no menu. Every list, dashboard and signed-in form view\n * must be reachable (nav, home, a landing, or a reachable dashboard's embed or\n * note action); a view appears in nav at most once; public views are not in\n * nav, which is signed-in chrome.\n *\n * The App keeps the views it opens as rooms — every view nav references,\n * every list or dashboard a home rule names (the one room of an App without\n * nav), and every list or dashboard a reachable dashboard embeds or names in\n * a note action — under their keys, nav as the tree it was written as, and the home rules as written, for the server\n * to evaluate per visitor. A list view keeps its own words, with its action\n * selector; the New form, the actions and the captions stay the resource's.\n * A dashboard keeps its sections, an embed drawn as the list or board\n * section its view reads as and naming that view, whose room its \"open →\"\n * opens. Every form is kept under its key, public ones too; the landing\n * under its own.\n */\nimport { tabKey } from '@mistriwork/engine/shared/addressParams.js';\nimport { filterAddressWord, listFilterKey } from '@mistriwork/engine/shared/listFilters.js';\nimport { parseViewImport } from './appImport.js';\nimport { LABEL_SEGMENT } from '@mistriwork/engine/shared/recordLabel.js';\nimport { parseCaption } from '@mistriwork/engine/shared/appMessages.js';\nimport { andQuery, splitClauseTail } from '@mistriwork/engine/shared/query.js';\nimport { segmentBookOf, unfoldSegments } from './appSegments.js';\nimport { PREVIOUS_PERIOD } from './dashWindow.js';\nimport { WIDTHS, type SectionWidth } from '@mistriwork/engine/shared/page.js';\nimport { parseTableSizing } from '@mistriwork/engine/shared/tableSizing.js';\nimport { parseListEmpty } from '@mistriwork/engine/shared/listEmpty.js';\nimport { ASSISTANT_ROOM, parseRoutePath } from './appAddress.js';\nimport { destinationProblem, type DestinationKind } from './appDestinations.js';\nimport { parseAppLinkAction } from '@mistriwork/engine/shared/appLinks.js';\nimport { checkGreeting } from './appGreeting.js';\nimport {\n BETTER,\n DASH_CHART_SHAPES,\n DASH_KINDS,\n FILTER_BARS,\n OPEN_MODES,\n SECTION_KEYS,\n VIEW_SECTION_KEYS,\n navViewKeys,\n parseRealm,\n resourceCeiling,\n type AppAuth,\n type AppDashSection,\n type DashTarget,\n type FilterBar,\n type AppDashboardView,\n type AppFormView,\n type AppHomeRule,\n type AppLanding,\n type AppSurface,\n type AppListView,\n type AppNavNode,\n DEFAULT_WINDOWS,\n} from './appModel.js';\nimport {\n FIGURE_FORMATS,\n FIGURE_FORMAT_WORDS,\n DISPLAY_TONES,\n VIEW_KEY,\n allowKeys,\n humanName,\n isRecord,\n keyHomesOf,\n optionalText,\n} from '@mistriwork/engine/shared/model.js';\nimport {\n CALENDAR_BACKDROPS_MAX,\n CALENDAR_SPANS,\n type CalendarSpan,\n type AppBoardFact,\n type AppCalendarBackdrop,\n type AppListPresentation,\n type AppListTab,\n type AppSplitListDetail,\n} from '@mistriwork/engine/shared/listPresentations.js';\nimport { parseEditable } from './appListEditable.js';\nimport { parseFormView } from './appForms.js';\nimport { headingOf } from '@mistriwork/engine/shared/appNoun.js';\nimport { landingViews, parseLandingView } from './appLanding.js';\nimport { CARDS_MAX_LINES, parseCards } from '@mistriwork/engine/shared/appCards.js';\nimport { checkDeclaredResource, checkResourceSlot, type ParsedData } from './appResourceBlocks.js';\nimport { parseHome, type HomeView } from './appHome.js';\nimport { OVERVIEW } from './appOverview.js';\nimport { parseIcon } from '@mistriwork/engine/shared/appIcons.js';\nimport { unknownKey } from '@mistriwork/engine/shared/suggest.js';\nimport { isAreaName } from '@mistriwork/engine/shared/dashLayout.js';\nimport {\n embedInteractive,\n firstRunSection,\n nameSectionWindows,\n parseActivitySection,\n parseCustomDashSection,\n parseFindSection,\n parseSectionWindows,\n} from './appDashSections.js';\nimport { parseCustomList } from '@mistriwork/engine/shared/appComponents.js';\nimport { conditionsOnly, parseChartShape, parseAreas, parseFunnelStages, parseNoteBanner, parseStepsShape } from './appDashShapes.js';\nimport { AppProblems, gather } from './appProblems.js';\nimport { autoKeyOf } from '@mistriwork/engine/shared/autoBucket.js';\nimport { parseOpenRoles } from './appViewRoles.js';\nimport { parseNav } from './appNav.js';\nimport { favoriteFlag, parseHead, parsePageView } from './appPageViews.js';\nimport { parseSurfaces, type SurfaceFile } from './appSurfaces.js';\n\n/* Each view as parsed: the AppDef view itself, beside what only parsing\n needs — its key and where it was written, and a dashboard's tables and\n embeds, which the home and reachability checks read. */\ninterface ListView {\n kind: 'list';\n key: string;\n at: string;\n view: AppListView;\n}\nexport interface DashboardView {\n kind: 'dashboard';\n key: string;\n at: string;\n view: AppDashboardView;\n /** Every table a section reads, embeds included: what a home rule's roles must read. */\n tables: string[];\n embeds: string[];\n}\ninterface LandingView {\n kind: 'landing';\n key: string;\n at: string;\n raw: Record<string, unknown>;\n}\nexport interface FormView {\n kind: 'form';\n key: string;\n at: string;\n form: AppFormView;\n}\nexport type ParsedView = ListView | DashboardView | LandingView | FormView;\n\n/** A parsed view's kind, as a destination reads it (appDestinations.ts). */\nconst parsedKind = (view: ParsedView | undefined): DestinationKind | undefined =>\n view === undefined ? undefined : view.kind === 'form' ? (view.form.public ? 'public form' : 'form') : view.kind;\n\nexport interface ContentContext {\n data: ParsedData;\n name: string;\n auth?: AppAuth;\n api?: import('./appApi.js').AppApiDef;\n /** The App's surfaces/ files, judged once the views are (appSurfaces.ts). */\n surfaces?: readonly SurfaceFile[];\n}\ninterface ParsedContent {\n views: Record<string, AppListView | AppDashboardView | AppFormView>;\n nav: AppNavNode[];\n home: AppHomeRule[];\n landing?: { view: string; content: AppLanding };\n surfaces?: Record<string, AppSurface>;\n}\n\n/* Spellings renamed before 1.0, refused with the word that replaced them (allowKeys' `refused`). */\nconst LIST_VIEW_RENAMED = {\n table: 'is now \"from\": the resource whose rows the list shows',\n keys: 'is now \"shortcuts\": a split\\'s single keys for the picked record\\'s actions',\n} as const;\nconst BACKDROP_RENAMED = {\n resource: 'is now \"from\", and the date columns a span runs between are \"start\" and \"end\"',\n to: 'is now \"end\"',\n label: 'is now \"labelColumn\": the column whose value names a span',\n} as const;\n/* Captioned values are `properties` (a fields section's presentation of that name); `facts` is the dotted line only. */\nconst PRESENTATION_RENAMED = {\n queue: {\n facts: 'is now \"properties\": the captioned values under the title (a dotted line is a card\\'s \"facts\")',\n },\n cards: {\n lines: 'is now \"properties\": the captioned values under the title (\"facts\" stays the dotted line)',\n },\n} as const;\nconst DASHBOARD_VIEW_RENAMED = {\n table: 'is now \"from\": the resource every section that names none reads',\n layout: 'is now \"areas\": the rows of area names its sections stand in (\"layout\" is a page\\'s archetype)',\n refresh: 'is gone: a dashboard follows changes as they happen and re-reads what depends on the time each minute',\n} as const;\nexport const LIST_VIEW_KEYS = [\n 'kind',\n 'from',\n 'label',\n 'path',\n 'icon',\n 'query',\n // Read before the view is (appSegments.ts unfoldSegments): the segment's word joins `query`.\n 'segment',\n 'show',\n 'presentation',\n 'board',\n 'split',\n 'empty',\n 'tabs',\n 'filters',\n 'filterBar',\n 'suggest',\n 'advancedFilters',\n 'quickAdd',\n 'favorite',\n 'totals',\n 'group',\n 'density',\n 'rowActions',\n 'editable',\n 'open',\n 'opens',\n 'sizing',\n 'actions',\n 'sort',\n 'order',\n 'import',\n 'shortcuts',\n 'heading',\n 'roles',\n 'count',\n] as const;\nexport const DASHBOARD_VIEW_KEYS = [\n 'kind',\n 'label',\n 'path',\n 'heading',\n 'head',\n 'description',\n 'icon',\n 'from',\n 'sections',\n 'aside',\n 'areas',\n 'windows',\n 'window',\n 'windowControl',\n 'filters',\n 'favorite',\n 'roles',\n] as const;\nexport const PRESENTATION_KEYS = {\n checklist: ['kind', 'primary', 'checked', 'lines'],\n queue: ['kind', 'primary', 'lines', 'properties', 'badge', 'openLabel'],\n board: ['kind', 'by', 'lanes', 'order', 'swimlanes', 'limits', 'primary', 'lines', 'category', 'footer', 'sum', 'folded'],\n calendar: ['kind', 'date', 'end', 'span', 'primary', 'lines', 'badge', 'backdrop'],\n tree: ['kind', 'parent', 'primary', 'lines'],\n gantt: ['kind', 'start', 'end', 'primary', 'by', 'progress'],\n cards: ['kind', 'primary', 'description', 'value', 'badge', 'icon', 'properties', 'facts', 'footer', 'image', 'media'],\n split: ['kind', 'detail', 'limit', 'row'],\n} as const;\n/** How many `lines` a card below its primary may carry, by presentation. */\nconst MAX_LINES = {\n checklist: 1,\n queue: 2,\n board: 1,\n calendar: 1,\n tree: 1,\n cards: CARDS_MAX_LINES,\n} as const;\n/* A sort as the query bar writes one: columns or label paths, each with an optional direction. */\nconst SORT_TEXT = /^\\s*[A-Za-z_][\\w.]*(\\s+(asc|desc))?(\\s*,\\s*[A-Za-z_][\\w.]*(\\s+(asc|desc))?)*\\s*$/i;\n\nexport function parseContent(a: Record<string, unknown>, where: string, ctx: ContentContext): ParsedContent {\n if (a.views !== undefined && !isRecord(a.views)) throw new Error(`${where}: \"views\" must be an object of views keyed by id.`);\n const entries = Object.entries((a.views ?? {}) as Record<string, unknown>);\n const views = new Map<string, ParsedView>();\n /* Two passes: a dashboard's embeds read the list views, so every other\n view is parsed first. */\n /* Each view is judged on its own, so one run names every view's refusal\n (appProblems.ts); the checks across views wait until all of them parse. */\n const problems: string[] = [];\n const failed = new Set<string>();\n const book = segmentBookOf(ctx.data.resources);\n const unfolded = new Map<string, Record<string, unknown>>();\n for (const [key, authored] of entries) {\n const at = `${where}: views \"${key}\"`;\n const parsed = gather(problems, () => {\n if (!VIEW_KEY.test(key)) throw new Error(`${at}: a view key is its address, and must be lowercase letters, digits and hyphens.`);\n if (!isRecord(authored)) throw new Error(`${at} is not an object.`);\n // A segment named anywhere in the view is its word in a query from here on (appSegments.ts).\n const value = unfoldSegments(authored, book, at) as Record<string, unknown>;\n unfolded.set(key, value);\n const kind = viewKind(value, at);\n if (kind === 'list')\n views.set(key, {\n kind,\n key,\n at,\n view: withOpenRoles(parseListView(value, at, ctx.data), value, at, ctx),\n });\n else if (kind === 'form')\n views.set(key, {\n kind,\n key,\n at,\n form: withOpenRoles(parseFormView(value, at), value, at, ctx),\n });\n else if (kind === 'landing') views.set(key, { kind, key, at, raw: value });\n return true;\n });\n if (!parsed) failed.add(key);\n }\n for (const [key, value] of entries) {\n if (failed.has(key)) continue;\n const said: string[] = [];\n gather(said, () => {\n const at = `${where}: views \"${key}\"`;\n const raw = unfolded.get(key) ?? (value as Record<string, unknown>);\n const parsed =\n raw.kind === 'dashboard'\n ? parseDashboardView(raw, key, at, ctx.data, views, Boolean(ctx.auth))\n : raw.kind === 'page'\n ? parsePageView(raw, key, at, ctx, views)\n : undefined;\n if (parsed)\n views.set(key, {\n ...parsed,\n view: withOpenRoles(parsed.view, raw, at, ctx),\n });\n });\n /* A dashboard over a list that did not parse would only restate that list's refusal. */\n problems.push(...said.filter((problem) => ![...failed].some((bad) => problem.includes(`\"${bad}\"`))));\n }\n if (problems.length) throw new AppProblems(problems);\n /* The checks across views are independent of each other too: each is gathered, so the menu's typo and the home's\n are said in one run, and only the reachability walk, which reads both, waits until they parse. */\n const across: string[] = [];\n const order = entries.map(([key]) => key);\n /* An App that names no home starts on an overview of its main table (appOverview.ts): a room of its own, which nav\n may name as `overview` like any view. Its sections wait for the catalog; an App with no list has nothing to show\n on one, and is still asked where a visitor starts. */\n const overview = a.home === undefined && order.some((key) => views.get(key)?.kind === 'list') && !views.has(OVERVIEW);\n if (overview) {\n views.set(OVERVIEW, {\n kind: 'dashboard',\n key: OVERVIEW,\n at: `${where}: the overview (no \"home\")`,\n embeds: [],\n tables: [],\n view: { label: 'Overview', icon: 'house', sections: [], overview: true },\n });\n /* The menu's first room, as home is the first place a reader lands: a menu drawn from the views lists it first. */\n order.unshift(OVERVIEW);\n }\n const apiViews = ctx.api?.views.map((entry) => entry.view) ?? [];\n for (const key of apiViews) {\n if (views.get(key)?.kind !== 'list') across.push(`${where}: api.views.${key} must reference an existing list view.`);\n }\n const ofKind = <K extends ParsedView['kind']>(kind: K) =>\n order.map((key) => views.get(key)!).filter((view): view is Extract<ParsedView, { kind: K }> => view.kind === kind);\n\n const forms = ofKind('form');\n if (forms.length && !ctx.auth?.roles) {\n across.push(`${where}: form views require \"auth\" and \"auth.roles\". A form runs a command, and commands need both.`);\n } else gather(across, () => checkForms(forms, ctx));\n for (const source of ofKind('list')) {\n const said = [\n { at: `${source.at}, \"empty.action.view\"`, action: source.view.empty?.action },\n ...(source.view.tabs ?? []).map((tab, i) => ({ at: `${source.at}, tab ${i + 1}, \"empty.action.view\"`, action: tab.empty?.action })),\n ];\n for (const { at, action } of said) {\n if (!action) continue;\n /* A room, by the one rule every action's destination answers to (appDestinations.ts): \"No canned responses:\n write one\" opens the signed-in form that writes one. */\n const problem = destinationProblem(at, action.view, parsedKind(views.get(action.view)));\n if (problem) across.push(problem);\n }\n }\n /* A dashboard's note, a banner too, opens a room by the same rule. Its target becomes a room only when this\n dashboard is reached from nav, home, a landing or a reachable dashboard; final payload projection still\n removes lost targets. */\n for (const source of ofKind('dashboard')) {\n const placed = [\n ...source.view.sections.map((section, i) => ({ section, at: `${source.at}, section ${i + 1}` })),\n ...(source.view.aside ?? []).map((section, i) => ({ section, at: `${source.at}, \"aside\", section ${i + 1}` })),\n ];\n for (const { section, at } of placed) {\n if (section.kind !== 'note' || !section.action || 'to' in section.action) continue;\n const problem = destinationProblem(`${at}, note action`, section.action.view, parsedKind(views.get(section.action.view)));\n if (problem) across.push(problem);\n }\n }\n const publicForms = new Set(forms.filter((view) => view.form.public).map((view) => view.key));\n /* What a landing may open and show: the public forms, and — with\n `auth.public` — every list and dashboard whose tables the public reads\n all of, as a signed-out home may name (appHome.ts). */\n const publicReads = new Set(ctx.auth?.public?.read ?? []);\n const openLists = new Map(\n ofKind('list')\n .filter((view) => publicReads.has(view.view.table))\n .map((view) => [view.key, view.view]),\n );\n const openViews = new Set([\n ...openLists.keys(),\n ...ofKind('dashboard')\n .filter((view) => view.tables.length && view.tables.every((table) => publicReads.has(table)))\n .map((view) => view.key),\n ]);\n const images = new Set(\n Object.entries(ctx.data.resources ?? {})\n .filter(([name, resource]) => resource.file && publicReads.has(name))\n .map(([name]) => name),\n );\n const landingsSaid = across.length;\n const landings = ofKind('landing').flatMap((view) => {\n const landing = gather(across, () =>\n parseLandingView(view.raw, view.at, {\n forms: publicForms,\n views: openViews,\n lists: openLists,\n images,\n }),\n );\n return landing ? [{ key: view.key, landing }] : [];\n });\n /* A landing that did not parse names nothing: what it would have opened is not known, so nothing is judged unreached. */\n const landingsRead = across.length === landingsSaid;\n const landingKeys = landings.flatMap(({ landing }) => landingViews(landing));\n /* A landing is the signed-out front page: what it shows or opens is for visitors who hold no role. */\n for (const key of landingKeys) {\n const view = views.get(key);\n const roles =\n view?.kind === 'form' ? view.form.roles : view?.kind === 'list' || view?.kind === 'dashboard' ? view.view.roles : undefined;\n if (roles)\n across.push(\n `${view!.at} names \"roles\", and the landing opens it to signed-out visitors, who hold none. Remove \"roles\", or the landing's link to it.`,\n );\n }\n if (landings.length > 1)\n across.push(`${where}: views \"${landings[0].key}\" and \"${landings[1].key}\" are both landings. An App has one front page.`);\n if (landings.length && !ctx.auth) {\n across.push(\n `${where}: a landing view requires \"auth\". An App without sign-in has no signed-out front door — every visitor already sees the App.`,\n );\n }\n\n /* An assistant with a page of its own is a room nav may place, by its word, as a view is (appAssistant.ts). */\n const assistantPage =\n isRecord(a.assistant) && Array.isArray(a.assistant.placement) && (a.assistant.placement as unknown[]).includes('page');\n if (assistantPage && views.has(ASSISTANT_ROOM))\n across.push(\n `${where}: views \"${ASSISTANT_ROOM}\" takes the word the assistant's page is placed by (assistant placement 'page'). Give the view another key.`,\n );\n const nav = gather(across, () => parseNav(a.nav, where, views, order, parsedKind, assistantPage, Object.keys(ctx.auth?.roles ?? {})));\n /* Workspaces stand in a band across the window (the header's switcher), which a header held in the sidebar's head cannot hold. */\n if (nav?.some((node) => 'group' in node && node.workspace) && isRecord(a.ui) && isRecord(a.ui.shell) && a.ui.shell.header === 'sidebar')\n across.push(\n `${where}: ui.shell.header 'sidebar' draws no bar across the window, and nav workspaces are picked in one: their tabs stand in the bar after the App's mark. Remove header, or say 'bar'.`,\n );\n /* A menu the App wrote leads with the overview it did not: the room every reader starts on is one they can go back to. */\n if (overview && nav?.length && !navViewKeys(nav).includes(OVERVIEW)) nav.unshift({ view: OVERVIEW });\n /* A record's tab is opened on its record (pages/<view>/[id]/<tab>.page.tsx): no visitor starts on one, and nothing\n else need reach it. */\n const recordTabKeys = order.filter((key) => {\n const view = views.get(key);\n return view?.kind === 'dashboard' && view.view.page?.record !== undefined;\n });\n const homeViews = new Map<string, HomeView>(\n order\n .filter((key) => !recordTabKeys.includes(key))\n .map((key) => {\n const view = views.get(key)!;\n if (view.kind === 'form') {\n return [\n key,\n {\n kind: 'form',\n tables: [],\n command: view.form.command.id,\n ...(view.form.public ? { public: true as const } : {}),\n ...(view.form.roles ? { roles: view.form.roles } : {}),\n },\n ];\n }\n const roles = view.kind === 'landing' ? undefined : view.view.roles;\n return [\n key,\n {\n kind: view.kind,\n tables: view.kind === 'list' ? [view.view.table] : view.kind === 'dashboard' ? view.tables : [],\n ...(roles ? { roles } : {}),\n },\n ];\n }),\n );\n const rules = gather(across, () =>\n parseHome(overview ? OVERVIEW : a.home, where, homeViews, ctx.auth, resourceCeiling(ctx.data).read, ctx.name),\n );\n /* What nothing opens is judged only once the menu, the home and the landing are all known: one that did not parse\n would make every room it names look orphaned. */\n if (!nav || !rules || !landingsRead) throw new AppProblems(across);\n // The assistant's room is nav's to place and no view's: nothing below serves it as one.\n const navKeys = navViewKeys(nav).filter((key) => views.has(key));\n\n /* A list, dashboard or signed-in form view nothing can open is a typo or\n an orphan; either way it would go unserved without a word. A public\n form is opened at its own address. Dashboard embeds, the lists metrics\n open and note actions are\n traversed only after a root reaches their dashboard: two orphan notes\n pointing at each other never manufacture a room. */\n /* A list a record's page embeds is opened by that page: a thread's posts, drawn only on the thread. */\n const pageEmbeds = Object.values(isRecord(a.pages) ? a.pages : {}).flatMap((page) =>\n (isRecord(page) && Array.isArray(page.sections) ? page.sections : []).flatMap((section) =>\n isRecord(section) && section.kind === 'view' && typeof section.view === 'string' ? [section.view] : [],\n ),\n );\n /* The header's New menu opens its views and the forms of its commands (ui.shell.new; app.ts checks the names). */\n const rawNew = (isRecord(a.ui) && isRecord(a.ui.shell) && Array.isArray(a.ui.shell.new) ? a.ui.shell.new.filter(isRecord) : []).flatMap(\n (entry) => (Array.isArray(entry.children) ? entry.children.filter(isRecord) : [entry]),\n );\n const newKeys = [\n ...rawNew.flatMap((entry) => (typeof entry.view === 'string' && views.has(entry.view) ? [entry.view] : [])),\n ...forms.filter(({ form }) => !form.public && rawNew.some((entry) => entry.command === form.command.id)).map(({ key }) => key),\n ];\n /* A free-form page is always served at its address, so a signed-in form it opens (`forms`) is reached from it. */\n const pageFormKeys = order.flatMap((key) => {\n const view = views.get(key);\n return view?.kind === 'dashboard' ? (view.view.page?.forms ?? []) : [];\n });\n /* A public page is the signed-out door's: opened at its address, never from the signed-in menu, which leaves it out\n unless it says `nav` (appPages.ts). Its address is its reference. */\n const publicPageKeys = order.filter((key) => {\n const view = views.get(key);\n return view?.kind === 'dashboard' && view.view.page?.public === true;\n });\n const reachable = new Set([\n ...navKeys,\n ...rules.map((rule) => rule.view),\n ...landingKeys,\n ...apiViews,\n ...pageEmbeds,\n ...newKeys,\n ...pageFormKeys,\n ...publicPageKeys,\n ...recordTabKeys,\n ]);\n for (const key of reachable) {\n const view = views.get(key);\n if (view?.kind !== 'dashboard') continue;\n for (const target of [\n ...view.embeds,\n ...[...view.view.sections, ...(view.view.aside ?? [])].flatMap((section) =>\n section.kind === 'note' && section.action && 'view' in section.action\n ? [section.action.view]\n : section.kind === 'metric' && section.view\n ? [section.view]\n : section.kind === 'firstRun'\n ? (section.steps ?? []).map((step) => step.view)\n : [],\n ),\n ])\n reachable.add(target);\n }\n for (const key of order) {\n const view = views.get(key)!;\n if (view.kind === 'form' && !view.form.public && !reachable.has(key)) {\n across.push(\n `${view.at} is a signed-in form referenced by nothing — not nav, not home, not the New menu (ui.shell.new), not a page's forms — so nothing could open it. Reference it, or remove it.`,\n );\n }\n if (view.kind === 'dashboard' && !reachable.has(key)) {\n across.push(\n `${view.at} is referenced by nothing — not nav, not home, not a reachable dashboard's embed, metric or note action, or a landing's { kind: 'view' } section — so nothing could open it. Reference it, or remove it.`,\n );\n }\n }\n if (across.length) throw new AppProblems(across);\n /* A list nothing links to is still a list: a view is everything a visitor\n can open, and `nav` arranges the menu over some of them. An unlinked one\n is served at its address and offered by ⌘K, and no menu lists it — the\n lookup lists an ops App keeps (a code table, a log) without crowding the\n side menu. A dashboard stays refused: what it opens is only reached\n through it, and an orphan pair must not manufacture rooms. */\n for (const key of order) if (views.get(key)!.kind === 'list') reachable.add(key);\n /* So is a free-form page: served at its address, which another page or a component may link to with nav: false. */\n for (const key of order) {\n const view = views.get(key)!;\n if (view.kind === 'dashboard' && view.view.page) reachable.add(key);\n }\n\n /* The served set includes every ordinary root and every room a reachable\n dashboard opens. Navigation still decides the sidebar; an action target\n is a room only after its source dashboard is independently reachable. */\n const served: Record<string, AppListView | AppDashboardView | AppFormView> = {};\n for (const key of reachable) {\n const view = views.get(key)!;\n if (view.kind === 'landing' || (view.kind === 'form' && view.form.public)) continue;\n served[key] = view.kind === 'form' ? view.form : view.view;\n }\n /* Then the public forms, which no menu names: each is served at its own address. */\n for (const view of forms) if (view.form.public) served[view.key] = view.form;\n const [landing] = landings;\n const surfaces = ctx.surfaces?.length ? parseSurfaces(ctx.surfaces, ctx, views) : undefined;\n return {\n ...(surfaces ? { surfaces } : {}),\n views: served,\n nav,\n home: rules.map(({ at: _at, ...rule }) => rule),\n ...(landing ? { landing: { view: landing.key, content: landing.landing } } : {}),\n };\n}\n\n/*\n * A form's command is granted like any other, and for a signed-in form the\n * grant is its whole audience: one whose command no role holds could be\n * opened by nobody. A command a form runs creates its rows and names none,\n * so no action runs it on a record too.\n */\nfunction checkForms(forms: readonly FormView[], ctx: ContentContext): void {\n const grants = Object.values(ctx.auth?.roles ?? {});\n const actions = Object.entries(ctx.data.resources ?? {}).flatMap(([name, resource]) =>\n (resource.actions ?? []).flatMap((action) => (action.command ? [{ name, id: action.command.id }] : [])),\n );\n for (const { at, form } of forms) {\n const id = form.command.id;\n const acting = actions.find((action) => action.id === id);\n if (acting) {\n throw new Error(\n `${at} runs the command \"${id}\", which an action on resources \"${acting.name}\" also runs. ` +\n \"A form's command creates records and names none; an action's names the record it acts on. Register a command for each.\",\n );\n }\n if (form.public) continue;\n /* Under \"auth.rows\" a signed-in form is served too: its command runs in\n the member's scope, so a row it inserts must land inside it (the scoped\n transaction refuses one that does not), and a tenant's owner column is\n the runtime's to fill, never the handler's. */\n if (!grants.some((grant) => grant.commands?.includes(id))) {\n throw new Error(\n `${at} runs the command \"${id}\", which no role in auth.roles is granted, so nobody could open the form. Grant it in auth.roles.<role>.commands.`,\n );\n }\n }\n}\n\nfunction viewKind(value: Record<string, unknown>, at: string): ParsedView['kind'] {\n const kind = value.kind;\n if (kind === undefined) {\n /* A view without its kind: say which one its keys suggest. */\n if (Object.hasOwn(value, 'sections')) throw new Error(`${at} has no \"kind\"; a dashboard view says kind: 'dashboard'.`);\n if (Object.hasOwn(value, 'from')) throw new Error(`${at} has no \"kind\"; a list view says kind: 'list'.`);\n throw new Error(\n `${at} has no \"kind\". A view is one of: list, dashboard, form or landing, written with listView(), dashboard(), commandForm() or landing(); a free-form page is a pages/*.page.tsx file.`,\n );\n }\n if (kind !== 'list' && kind !== 'dashboard' && kind !== 'landing' && kind !== 'form' && kind !== 'page') {\n throw new Error(\n `${at} has a \"kind\" of \"${String(kind)}\". A view is one of: list, dashboard, form or landing, written with listView(), dashboard(), commandForm() or landing(); a free-form page is a pages/*.page.tsx file.`,\n );\n }\n /* A free-form page is served as the dashboard that draws it (parsePageView). */\n return kind === 'page' ? 'dashboard' : kind;\n}\n\n/* ---------- list views ---------- */\n\n/* A board or a split is a key of the list view that carries its options, so the view says which it is by the key and\n the two cannot be written together; the rest draw through `presentation`, written with their helpers. Both parse to\n the one `presentation` the rest of the platform reads. */\nfunction listPresentation(v: Record<string, unknown>, at: string): AppListPresentation | undefined {\n const keyed = (['board', 'split'] as const).filter((key) => v[key] !== undefined);\n const kind = isRecord(v.presentation) ? v.presentation.kind : undefined;\n if (kind === 'board' || kind === 'split') {\n throw new Error(\n `${at} has a \"presentation\" of kind \"${kind}\". A ${kind} is a key of the list view: ${kind}: { ${kind === 'board' ? \"by: 'status', primary: 'name'\" : \"detail: ['name']\"} }.`,\n );\n }\n if (keyed.length + (v.presentation === undefined ? 0 : 1) > 1) {\n throw new Error(\n `${at} has ${[...keyed.map((key) => `\"${key}\"`), ...(v.presentation === undefined ? [] : ['\"presentation\"'])].join(' and ')}. A list draws its rows one way: a board, a split or a presentation.`,\n );\n }\n if (keyed.length === 0) return v.presentation === undefined ? undefined : parsePresentation(v.presentation, at);\n const key = keyed[0];\n if (!isRecord(v[key])) throw new Error(`${at}: \"${key}\" must be an object${key === 'board' ? ' with at least \"by\"' : ''}.`);\n allowKeys(\n v[key] as Record<string, unknown>,\n PRESENTATION_KEYS[key].filter((name) => name !== 'kind'),\n `${at}, \"${key}\"`,\n );\n return parsePresentation({ ...(v[key] as object), kind: key }, at);\n}\n\n/* A text filter's suggestions: the distinct values of a few of the list's own columns, offered as the reader types.\n Keyed by the filter they fill, which the list must declare: a suggestion for a box nobody draws is a typo. */\nfunction parseSuggest(raw: unknown, filters: string[] | undefined, at: string): Record<string, string[]> {\n const where = `${at}, \"suggest\"`;\n if (!isRecord(raw) || !Object.keys(raw).length)\n throw new Error(\n `${where} must name a text filter and the columns whose values it suggests, like suggest: { title: ['make', 'model'] }.`,\n );\n const declared = (filters ?? []).map((name) => name.trim());\n return Object.fromEntries(\n Object.entries(raw).map(([filter, columns]) => {\n if (!declared.includes(filter))\n throw new Error(`${where} names \"${filter}\", which is not one of this list's \"filters\". Suggestions fill a filter the list draws.`);\n if (\n !Array.isArray(columns) ||\n !columns.length ||\n columns.some((column) => typeof column !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(column.trim()))\n )\n throw new Error(`${where}, \"${filter}\" must be a list of the resource's own column names, like ['make', 'model'].`);\n return [filter, [...new Set((columns as string[]).map((column) => column.trim()))]];\n }),\n );\n}\n\nfunction parseListView(v: Record<string, unknown>, at: string, data: ParsedData): AppListView {\n allowKeys(v, [...LIST_VIEW_KEYS, 'realm'], at, LIST_VIEW_RENAMED);\n if (typeof v.from !== 'string' || !v.from.trim()) throw new Error(`${at} has no \"from\": a list view shows the rows of one resource.`);\n const table = v.from.trim();\n checkResourceSlot(table, `${at}, \"from\"`, data);\n checkDeclaredResource(table, `${at}, \"from\"`, data);\n const resource = data.resources![table];\n if (v.advancedFilters !== undefined && typeof v.advancedFilters !== 'boolean') {\n throw new Error(`${at}: \"advancedFilters\" must be true or false.`);\n }\n if (typeof v.filterBar === 'boolean')\n throw new Error(`${at}: \"filterBar\" is now one of 'bar', 'rail' or 'none': ${v.filterBar ? \"true is 'bar'\" : \"false is 'none'\"}.`);\n if (v.filterBar !== undefined && !FILTER_BARS.includes(v.filterBar as FilterBar)) {\n throw new Error(`${at}: \"filterBar\" must be 'bar', 'rail' (the filters as a rail of facets beside the rows) or 'none'.`);\n }\n if (v.quickAdd !== undefined && typeof v.quickAdd !== 'boolean') {\n throw new Error(`${at}: \"quickAdd\" must be true (inline resources.${table}.form, or the schema's New form) or false.`);\n }\n if (v.open === 'peek') throw new Error(`${at} has an \"open\" of \"peek\", which is now \"drawer\", as the New form's is.`);\n if (v.open !== undefined && !(OPEN_MODES as readonly unknown[]).includes(v.open)) {\n throw new Error(`${at} has an \"open\" of \"${String(v.open)}\". Use \"page\", \"drawer\" or \"modal\".`);\n }\n if (v.filters !== undefined && !Array.isArray(v.filters)) throw new Error(`${at} has \"filters\" that are not a list of column names.`);\n /* A filter across a reference or over the rows that point at the record is held as the words its condition\n starts with (listFilters.ts), so everything downstream reads one kind of filter. */\n const filters = (v.filters as unknown[] | undefined)?.map((filter) => listFilterKey(filter, at));\n const words = new Map<string, string>();\n for (const filter of filters ?? []) {\n const word = filterAddressWord(filter);\n if (words.has(word)) throw new Error(`${at} names the filter \"${words.get(word)}\" twice.`);\n words.set(word, filter);\n }\n const suggest = v.suggest === undefined ? undefined : parseSuggest(v.suggest, filters, at);\n const importing = v.import === undefined ? undefined : parseViewImport(v.import, at);\n if (importing && !importing.command && resource.access !== 'write') {\n throw new Error(\n `${at} has \"import\" over resources \"${table}\", which the App does not write; importing creates records, which needs access 'write'.`,\n );\n }\n const presentation = listPresentation(v, at);\n if (presentation?.kind === 'calendar')\n for (const [i, span] of (presentation.backdrop ?? []).entries()) {\n const here = `${at}, presentation, backdrop${(presentation.backdrop?.length ?? 0) > 1 ? ` ${i + 1}` : ''}, \"from\"`;\n checkResourceSlot(span.from, here, data);\n checkDeclaredResource(span.from, here, data);\n }\n const empty = v.empty === undefined ? undefined : parseListEmpty(v.empty, at);\n if (empty && (presentation?.kind === 'calendar' || presentation?.kind === 'tree' || presentation?.kind === 'gantt')) {\n throw new Error(\n `${at} has \"empty\" and a ${presentation.kind} presentation. A ${presentation.kind} reads its own rows, so use its ordinary empty state.`,\n );\n }\n /* A split's list is the narrow pane beside a record; a rail beside it would leave the rows no room. */\n if (v.filterBar === 'rail' && presentation?.kind === 'split') {\n throw new Error(\n `${at} has filterBar 'rail' and a split presentation. A rail sits beside a full list; a split's list keeps the bar (or filterBar: 'none').`,\n );\n }\n /* A board over a machine's column reads its lanes from the machine (app.ts withMachineLanes): one order, said once. */\n if (presentation?.kind === 'board' && presentation.lanes !== undefined && resource?.machine?.column === presentation.by) {\n throw new Error(\n `${at}: presentation \"lanes\" orders \"${presentation.by}\", which the machine of resources.${table} moves; ` +\n 'its lanes are the machine\\'s states in its order. Drop \"lanes\".',\n );\n }\n /* A card's place is the reader's to change by hand; a column the resource moves only through its actions never is. */\n if (presentation?.kind === 'board' && presentation.order !== undefined && resource?.machine?.column === presentation.order) {\n throw new Error(\n `${at}: presentation \"order\" names \"${presentation.order}\", which the machine of resources.${table} moves. ` +\n \"A card's place is the reader's to change; name another numeric column.\",\n );\n }\n let totals: string[] | undefined;\n if (v.totals !== undefined) {\n if (\n !Array.isArray(v.totals) ||\n !v.totals.length ||\n v.totals.some((c) => typeof c !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(c))\n ) {\n throw new Error(`${at} has \"totals\" that are not a list of the resource's own numeric columns.`);\n }\n if (new Set(v.totals).size !== v.totals.length) throw new Error(`${at} has \"totals\" that name one column twice.`);\n if (presentation) throw new Error(`${at} has \"totals\" and a ${presentation.kind} presentation; a footer of totals belongs to a grid.`);\n totals = v.totals as string[];\n }\n /* A grid's groups, by one of its own columns: the heads are a breakdown of that column, and the rows are read in its\n order (listQuestion.ts groupedQuestion). A record page's related list groups with an object, `{ by }`, because it\n pages its groups and reads the grouped record's facts; a list view's groups are its rows', so a column says it. */\n let group: string | undefined;\n if (v.group !== undefined) {\n if (typeof v.group !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(v.group.trim()))\n throw new Error(`${at}: \"group\" must name one of the resource's own columns: group: 'stage'.`);\n if (presentation)\n throw new Error(`${at} has \"group\" and a ${presentation.kind} presentation; heads over groups of rows belong to a grid.`);\n if (v.order !== undefined)\n throw new Error(\n `${at} has \"group\" and \"order\": a hand order ranks the whole list, and grouped rows stand by their group first. Keep one.`,\n );\n group = v.group.trim();\n }\n if (v.rowActions !== undefined) {\n if (typeof v.rowActions !== 'boolean') throw new Error(`${at}: \"rowActions\" must be true (a ⋯ menu on each row) or false.`);\n if (v.rowActions && presentation)\n throw new Error(`${at} has \"rowActions\" and a ${presentation.kind} presentation; a row menu belongs to a grid.`);\n }\n const editable = parseEditable(v, at, table, resource, presentation);\n if (v.density !== undefined && v.density !== 'comfortable' && v.density !== 'compact') {\n throw new Error(`${at} has a \"density\" of \"${String(v.density)}\". Use \"comfortable\" or \"compact\".`);\n }\n /* Row height and column sizing are a grid's. A split's list is drawn as\n one; the card presentations draw no grid for either to reach. */\n for (const key of ['density', 'sizing'] as const) {\n if (v[key] !== undefined && presentation && presentation.kind !== 'split') {\n throw new Error(\n `${at} has \"${key}\" and a ${presentation.kind} presentation; ${key === 'density' ? 'a row height' : 'column sizing'} belongs to a grid.`,\n );\n }\n }\n /* A join table's list opens the record each row is about. The grid's rows only: a card, a lane or a\n split's pick is drawn and acted on as the row it is. */\n if (v.opens !== undefined) {\n if (typeof v.opens !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(v.opens.trim())) {\n throw new Error(`${at}: \"opens\" must name one of the resource's reference columns, whose record a row opens.`);\n }\n if (presentation)\n throw new Error(`${at} has \"opens\" and a ${presentation.kind} presentation; a row opens another record from a grid only.`);\n }\n if (presentation?.kind === 'split' && v.open !== undefined) {\n throw new Error(`${at} has \"open\" and a split presentation, which opens its rows in its own detail pane. Remove \"open\".`);\n }\n let actions: string[] | undefined;\n if (v.actions !== undefined) {\n if (!Array.isArray(v.actions)) throw new Error(`${at} has \"actions\" that are not a list of action ids.`);\n if (presentation?.kind !== 'queue' && presentation?.kind !== 'board' && presentation?.kind !== 'custom') {\n throw new Error(\n `${at} has \"actions\", which only a queue, a board or a custom list takes: a grid, a checklist or a split draws no actions, and a record page offers every one of resources.${table}.actions.`,\n );\n }\n const declared = (resource.actions ?? []).map((action) => action.id);\n actions = v.actions.map((id, i) => {\n if (typeof id !== 'string' || !id.trim()) {\n throw new Error(`${at}, \"actions\" entry ${i + 1} is not an action id: a view lists the ids of resources.${table}.actions.`);\n }\n if (!declared.includes(id.trim())) {\n throw new Error(\n `${at}, \"actions\" names \"${id.trim()}\", which resources.${table}.actions does not declare. ` +\n (declared.length ? `It declares: ${declared.join(', ')}.` : 'It declares no actions.'),\n );\n }\n return id.trim();\n });\n if (new Set(actions).size !== actions.length) throw new Error(`${at} has \"actions\" that name one action twice.`);\n }\n /* The list's order, one key: \"created_on desc\" is how it reads when\n nothing else says one, and a list of named orders is the Sort menu a\n reader chooses from, the first of them the order the list opens in.\n Written like the query bar, so a chosen one is the query's own sort\n clause and the address carries it; the opening one is kept out of the\n bar, as a hand order is: it is the view's reading, not a question\n anyone asked. A tab's sort clause wins over it, and the menu over both.\n A hand order already is one, and a sort in the standing query would\n read every tab its own way. */\n let sort: string | undefined;\n let sorts: Array<{ label: string; sort: string }> | undefined;\n if (v.sort !== undefined) {\n if (Array.isArray(v.sort)) {\n if (v.sort.length < 2 || v.sort.length > 8)\n throw new Error(`${at} has a \"sort\" list that is not two to eight { label, sort }: one order is a string, \"created_on desc\".`);\n sorts = v.sort.map((entry, i) => {\n const here = `${at}, sort ${i + 1}`;\n if (!isRecord(entry)) throw new Error(`${here} is not an object { label, sort }.`);\n allowKeys(entry, ['label', 'sort'], here);\n if (typeof entry.label !== 'string' || !entry.label.trim() || entry.label.trim().length > 40)\n throw new Error(`${here} needs a \"label\" of at most 40 characters.`);\n if (typeof entry.sort !== 'string' || !SORT_TEXT.test(entry.sort)) {\n throw new Error(`${here} has a \"sort\" that is not written like the query bar: \"price\", \"price desc\", \"year desc, mileage\".`);\n }\n return {\n label: entry.label.trim(),\n sort: entry.sort.trim().replace(/\\s+/g, ' '),\n };\n });\n if (new Set(sorts.map((entry) => entry.label)).size !== sorts.length)\n throw new Error(`${at} has a \"sort\" list with one label twice.`);\n sort = sorts[0]!.sort;\n } else if (typeof v.sort !== 'string' || !SORT_TEXT.test(v.sort)) {\n throw new Error(\n `${at} has a \"sort\" that is not written like the query bar (\"created_on desc\", \"year desc, mileage\") or a list of named orders, [{ label: 'Newest', sort: 'listed_on desc' }, …].`,\n );\n } else sort = v.sort.trim().replace(/\\s+/g, ' ');\n if (v.order !== undefined) {\n throw new Error(\n `${at} has \"sort\" and \"order\": a hand order is the list's own reading already, kept in \"${String(v.order).trim()}\". Keep one.`,\n );\n }\n if (presentation?.kind === 'board' || presentation?.kind === 'calendar') {\n throw new Error(`${at} has \"sort\" and a ${presentation.kind} presentation, which orders its cards itself.`);\n }\n }\n /* A hand order: the numeric column each row's place is kept in, read\n ascending wherever nothing else sorts the question. A sort in the\n standing query would win on every tab, so the order could never be read\n and is refused; a tab's own sort, a header and the Sort menu are readings\n of their own, and hide the handles while they last. */\n let order: string | undefined;\n if (v.order !== undefined) {\n if (typeof v.order !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(v.order.trim())) {\n throw new Error(`${at}: \"order\" must name one of the resource's own numeric columns, holding each row's place in the list.`);\n }\n order = v.order.trim();\n if (presentation?.kind === 'board') {\n throw new Error(`${at} has \"order\" and a board presentation; a board keeps its cards' places in its presentation's \"order\".`);\n }\n if (\n presentation?.kind === 'calendar' ||\n presentation?.kind === 'split' ||\n presentation?.kind === 'tree' ||\n presentation?.kind === 'gantt'\n ) {\n const which = {\n calendar: 'puts each record on its day',\n split: 'reads its list beside a record',\n tree: 'puts each record under its parent',\n gantt: 'puts each record on its dates',\n }[presentation.kind];\n throw new Error(\n `${at} has \"order\" and a ${presentation.kind} presentation, which ${which}. ` +\n 'A hand order is for a grid, a checklist, a queue or cards.',\n );\n }\n if (resource?.machine?.column === order) {\n throw new Error(\n `${at}: \"order\" names \"${order}\", which the machine of resources.${table} moves. ` +\n \"A row's place is the reader's to change; name another numeric column.\",\n );\n }\n }\n /* Single keys for the picked record's actions, in a split: the pane's header shows each beside its verb.\n Authored `shortcuts`; kept as the view's `keys`. */\n let keys: Record<string, string> | undefined;\n if (v.shortcuts !== undefined) {\n if (presentation?.kind !== 'split')\n throw new Error(`${at} has \"shortcuts\", which a split takes: they act on the record picked beside the list.`);\n if (!isRecord(v.shortcuts) || !Object.keys(v.shortcuts).length)\n throw new Error(`${at}: \"shortcuts\" must be an object of one key to an action id: { e: 'escalate' }.`);\n const declared = (resource?.actions ?? []).map((action) => action.id);\n keys = {};\n for (const [key, id] of Object.entries(v.shortcuts)) {\n if (!/^[a-z0-9]$/.test(key) || key === 'j' || key === 'k') {\n throw new Error(`${at}, \"shortcuts\" has \"${key}\": a key is one lowercase letter or digit, and J and K are the walk's own.`);\n }\n if (typeof id !== 'string' || !declared.includes(id.trim())) {\n throw new Error(\n `${at}, \"shortcuts\" maps \"${key}\" to ${JSON.stringify(id)}, which resources.${table}.actions does not declare. ` +\n (declared.length ? `It declares: ${declared.join(', ')}.` : 'It declares no actions.'),\n );\n }\n keys[key] = id.trim();\n }\n if (new Set(Object.values(keys)).size !== Object.keys(keys).length)\n throw new Error(`${at} has \"shortcuts\" that give one action two keys.`);\n }\n if (v.heading !== undefined && v.heading !== false) throw new Error(`${at}: \"heading\" is false, to draw the list without its title.`);\n /* A standing query is the conditions every tab reads under: the order is `sort`, the columns `show`. */\n const standingQuery = optionalText(v, 'query', at);\n if (standingQuery !== undefined) conditionsOnly(standingQuery, at);\n return {\n table,\n ...(sorts ? { sorts } : {}),\n ...(sort ? { sort } : {}),\n ...(order ? { order } : {}),\n ...(v.label === undefined ? {} : { label: parseCaption(v.label, `${at}.label`) }),\n ...(v.path === undefined ? {} : { path: parseRoutePath(v.path, at) }),\n ...(v.icon === undefined ? {} : { icon: parseIcon(v.icon, at) }),\n ...(v.realm === undefined ? {} : { realm: parseRealm(v.realm, at) }),\n ...(standingQuery === undefined ? {} : { query: standingQuery }),\n ...(v.show === undefined ? {} : { show: parseShow(v.show, at) }),\n ...(presentation ? { presentation } : {}),\n ...(empty ? { empty } : {}),\n ...(v.tabs === undefined ? {} : { tabs: parseTabs(v.tabs, at) }),\n ...(filters === undefined ? {} : { filters }),\n ...(v.filterBar === undefined ? {} : { filterBar: v.filterBar as FilterBar }),\n ...(suggest ? { suggest } : {}),\n ...(v.advancedFilters === undefined ? {} : { advancedFilters: v.advancedFilters as boolean }),\n ...(v.quickAdd === true ? { quickAdd: true as const } : {}),\n ...(favoriteFlag(v.favorite, at) ? { favorite: true as const } : {}),\n ...(totals ? { totals } : {}),\n ...(group ? { group } : {}),\n ...(v.density === undefined ? {} : { density: v.density as 'comfortable' | 'compact' }),\n ...(v.rowActions === true ? { rowActions: true as const } : {}),\n ...(editable ? { editable } : {}),\n ...(v.open === undefined ? {} : { open: v.open as AppListView['open'] }),\n ...(v.opens === undefined ? {} : { opens: (v.opens as string).trim() }),\n ...(v.sizing === undefined ? {} : { sizing: parseTableSizing(v.sizing, at) }),\n ...(actions ? { actions } : {}),\n ...(importing === undefined ? {} : { import: importing }),\n ...(keys ? { keys } : {}),\n ...(v.heading === false ? { heading: false as const } : {}),\n ...(countFlag(v.count, at) === undefined ? {} : { count: countFlag(v.count, at) }),\n };\n}\n\n/* A list's say on its menu count (shared/menuCounts.ts): true or false over the rule. */\nfunction countFlag(value: unknown, at: string): boolean | undefined {\n if (value === undefined) return undefined;\n if (typeof value !== 'boolean') throw new Error(`${at}: \"count\" is true or false: whether the menu counts this list.`);\n return value;\n}\n\n/**\n * A view's `show`: plain strings, each a column or a dotted label path. The\n * caption is the resource's (`resources.<table>.labels`), wherever it shows.\n */\nfunction parseShow(raw: unknown, at: string): string[] {\n if (!Array.isArray(raw)) throw new Error(`${at} has a \"show\" that is not a list of column names.`);\n return raw.map((entry, i) => {\n if (typeof entry !== 'string' || !entry.trim()) throw new Error(`${at}, \"show\" entry ${i + 1} is not a column name or a label path.`);\n return entry.trim();\n });\n}\n\n/** What a list that names nothing is called: its records, several of them, as the resource's noun says, else its table's name. */\nfunction listLabel(table: string, data: ParsedData): string {\n const noun = data.resources?.[table]?.noun;\n return noun ? headingOf(noun.many) : humanName(table);\n}\n\n/** A dashboard section's captions: the resource's word for each shown column it has one for. */\nfunction labelsFor(show: readonly string[] | undefined, labels: Record<string, string> | undefined): Record<string, string> | undefined {\n const named = (show ?? []).filter((column) => labels !== undefined && Object.hasOwn(labels, column));\n return named.length ? Object.fromEntries(named.map((column) => [column, labels![column]])) : undefined;\n}\n\nfunction parseTabs(raw: unknown, at: string): AppListTab[] {\n if (!Array.isArray(raw)) throw new Error(`${at} has \"tabs\" that are not an array.`);\n return raw.map((entry, i) => {\n const here = `${at}, tab ${i + 1}`;\n if (!isRecord(entry)) throw new Error(`${here} is not an object.`);\n /* A tab's own order is its `sort`, kept as a sort clause after its conditions —\n \"status = open sort due_on\" — which every reader of the tab (its\n count, the address, a dashboard's embed) takes as it is, and which\n wins over the view's `sort`. */\n // `segment` is what a tab naming one unfolds to (appSegments.ts); its name is the tab's address.\n allowKeys(entry, ['label', 'query', 'segment', 'sort', 'empty'], here);\n if (typeof entry.label !== 'string' || !entry.label.trim()) throw new Error(`${here} has no \"label\".`);\n const query = optionalText(entry, 'query', here);\n const segment = typeof entry.segment === 'string' ? entry.segment : undefined;\n if (query !== undefined) conditionsOnly(query, here);\n if (entry.sort !== undefined && (typeof entry.sort !== 'string' || !SORT_TEXT.test(entry.sort))) {\n throw new Error(`${here} has a \"sort\" that is not written like the query bar: \"due_on\", \"created_on desc\", \"year desc, mileage\".`);\n }\n const sort = typeof entry.sort === 'string' ? entry.sort.trim().replace(/\\s+/g, ' ') : undefined;\n /* What the tab says while nothing is under it, as a list's `empty` says it for the list as it opens. */\n const empty = entry.empty === undefined ? undefined : parseListEmpty(entry.empty, here);\n return {\n label: entry.label.trim(),\n query: sort === undefined ? query : `${query ? `${query} ` : ''}sort ${sort}`,\n ...(segment ? { segment, slug: segment } : {}),\n ...(empty ? { empty } : {}),\n };\n });\n}\n\n/** A local column for a card: bare, non-empty, never a path. */\nfunction localColumn(o: Record<string, unknown>, key: string, at: string): string {\n const value = o[key];\n if (typeof value !== 'string' || !value.trim() || value.includes('.'))\n throw new Error(`${at}: \"${key}\" must name a local column, not a path.`);\n return value.trim();\n}\n\n/** A card's title: its own column, or one read through a reference, one hop (`vehicle_id.title`). */\nfunction cardTitle(value: unknown, at: string): string {\n if (typeof value !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)?$/.test(value.trim()))\n throw new Error(`${at}: \"primary\" must be a local column or a one-hop path like \"vehicle_id.title\".`);\n return value.trim();\n}\n\n/** A queue may say a referenced record's name, but never walk past one join. */\nfunction queueColumn(value: unknown, key: string, at: string): string {\n if (typeof value !== 'string' || !value.trim()) {\n throw new Error(`${at}: \"${key}\" must be a local column or a one-hop label path like \"employee_id.name\".`);\n }\n const name = value.trim();\n /* Keep legacy local names verbatim (apart from outer whitespace): before\n paths, a local column was any non-empty spelling without a dot. */\n if (!name.includes('.')) return name;\n if (/^[A-Za-z_][A-Za-z0-9_]*\\.[A-Za-z_][A-Za-z0-9_]*$/.test(name)) return name;\n throw new Error(`${at}: \"${key}\" must be a local column or a one-hop label path like \"employee_id.name\".`);\n}\n\n/**\n * A calendar's shaded spans: one kind or a list of them, each another\n * resource's rows from one of its date columns to another, labeled by a third\n * and shaded in a display tone. The resource is checked as declared where the\n * view is (parseListView), and its columns against the catalog (listProblem).\n */\nfunction parseCalendarBackdrop(raw: unknown, at: string): AppCalendarBackdrop[] {\n const list = Array.isArray(raw) ? raw : [raw];\n if (!list.length || list.length > CALENDAR_BACKDROPS_MAX) {\n throw new Error(\n `${at}: a calendar shades one to ${CALENDAR_BACKDROPS_MAX} kinds of span, like { from: 'blackout', start: 'starts_on', end: 'ends_on', labelColumn: 'name' }.`,\n );\n }\n return list.map((entry, i) => {\n const here = list.length > 1 ? `${at} ${i + 1}` : at;\n if (!isRecord(entry)) throw new Error(`${here} is not { from, start, end, labelColumn }.`);\n allowKeys(entry, ['from', 'start', 'end', 'labelColumn', 'tone'], here, BACKDROP_RENAMED);\n if (typeof entry.from !== 'string' || !entry.from.trim())\n throw new Error(`${here} has no \"from\": the resource whose rows are the spans, like 'blackout'.`);\n const start = localColumn(entry, 'start', here);\n const end = localColumn(entry, 'end', here);\n const labelColumn = localColumn(entry, 'labelColumn', here);\n if (entry.tone !== undefined && !(DISPLAY_TONES as readonly unknown[]).includes(entry.tone)) {\n throw new Error(`${here} has a \"tone\" of \"${String(entry.tone)}\". Use ${DISPLAY_TONES.join(', ')}.`);\n }\n return {\n from: entry.from.trim(),\n start,\n end,\n labelColumn,\n ...(entry.tone === undefined ? {} : { tone: entry.tone as AppCalendarBackdrop['tone'] }),\n };\n });\n}\n\n/**\n * How a list's rows draw: a checklist, a queue, a board — each a card of one\n * `primary` column and up to its `lines` — or a split list/detail workspace.\n * Local readable columns only for the cards, refused by name, so an author\n * learns one grammar.\n */\n/** Shared shape validation for authored lists and captured App embeds. */\nexport function parsePresentation(raw: unknown, at: string): AppListPresentation {\n const here = `${at}, presentation`;\n if (!isRecord(raw)) throw new Error(`${here} must be a checklist, queue, board, calendar, tree, gantt, cards, split or custom object.`);\n const kind = raw.kind;\n /* The author's own component draws the rows; the list around them is the platform's. */\n if (kind === 'custom') return parseCustomList(raw, `${here} (a custom list)`);\n if (\n kind !== 'checklist' &&\n kind !== 'queue' &&\n kind !== 'board' &&\n kind !== 'calendar' &&\n kind !== 'tree' &&\n kind !== 'gantt' &&\n kind !== 'cards' &&\n kind !== 'split'\n ) {\n throw new Error(`${here} needs a \"kind\" of \"checklist\", \"queue\", \"board\", \"calendar\", \"tree\", \"gantt\", \"cards\", \"split\" or \"custom\".`);\n }\n allowKeys(raw, PRESENTATION_KEYS[kind], `${here} (a ${kind})`, PRESENTATION_RENAMED[kind as keyof typeof PRESENTATION_RENAMED]);\n if (kind === 'split') return parseSplit(raw, `${here} (a split)`);\n if (kind === 'gantt') {\n const start = localColumn(raw, 'start', here);\n const end = localColumn(raw, 'end', here);\n if (end === start) throw new Error(`${here}: \"end\" names \"${end}\", the same column as \"start\"; a bar needs the column it ends on.`);\n return {\n kind,\n start,\n end,\n primary: queueColumn(raw.primary, 'primary', here),\n ...(raw.by === undefined ? {} : { by: queueColumn(raw.by, 'by', here) }),\n ...(raw.progress === undefined ? {} : { progress: localColumn(raw, 'progress', here) }),\n };\n }\n /* A card with no title of its own is titled by its record's name, `$label`, which resolving the view against\n the catalog makes the path that name is read from (appCards.ts cardsTitled). */\n /* A board, a queue or a calendar with no `primary` says the record's name too: resolving the list against the\n catalog reads it where the resource names its records (app.ts titledPresentation). */\n const primary =\n (kind === 'board' || kind === 'queue' || kind === 'calendar') && raw.primary === undefined\n ? LABEL_SEGMENT\n : kind === 'queue' || kind === 'calendar' || kind === 'tree' || kind === 'board'\n ? queueColumn(raw.primary, 'primary', here)\n : kind === 'cards' && raw.primary === undefined\n ? LABEL_SEGMENT\n : kind === 'cards'\n ? cardTitle(raw.primary, here)\n : localColumn(raw, 'primary', here);\n /* A card's captioned values are its `properties`; every other presentation's quiet lines under the title are `lines`.\n The model keeps one list for both. */\n const linesKey = kind === 'cards' ? 'properties' : 'lines';\n const rawLines = raw[linesKey];\n let lines: string[] = [];\n if (rawLines !== undefined) {\n const max = MAX_LINES[kind];\n if (!Array.isArray(rawLines) || rawLines.length > max) {\n throw new Error(`${here}: \"${linesKey}\" must be a list of at most ${max} local column${max === 1 ? '' : 's'} beneath the primary.`);\n }\n /* Cards, queues and calendars may say a referenced record's name; the\n other presentations' lines stay the row's own columns. */\n lines = rawLines.map((_, i) => {\n const line = (rawLines as unknown[])[i];\n if (kind === 'queue' || kind === 'calendar' || kind === 'tree') return queueColumn(line, String(i), `${here}, lines`);\n if (kind !== 'cards') return localColumn(rawLines as unknown as Record<string, unknown>, String(i), `${here}, lines`);\n if (typeof line !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)?$/.test(line.trim())) {\n throw new Error(`${here}, properties: a card's property is a local column or a one-hop label path like \"dealer_id.name\".`);\n }\n return line.trim();\n });\n }\n if (kind === 'checklist')\n return {\n kind,\n primary,\n checked: localColumn(raw, 'checked', here),\n ...(lines.length ? { lines } : {}),\n };\n if (kind === 'tree')\n return {\n kind,\n parent: localColumn(raw, 'parent', here),\n primary,\n ...(lines.length ? { lines } : {}),\n };\n if (kind === 'queue') {\n let facts: string[] | undefined;\n if (raw.properties !== undefined) {\n if (!Array.isArray(raw.properties) || !raw.properties.length || raw.properties.length > 6) {\n throw new Error(`${here}: \"properties\" must be one to 6 local columns or one-hop label paths.`);\n }\n facts = raw.properties.map((fact, i) => queueColumn(fact, String(i), `${here}, properties`));\n }\n const badge = raw.badge === undefined ? undefined : queueColumn(raw.badge, 'badge', here);\n const openLabel = raw.openLabel;\n if (openLabel !== undefined && (typeof openLabel !== 'string' || !openLabel.trim())) {\n throw new Error(`${here}: \"openLabel\" must be a non-empty string.`);\n }\n return {\n kind,\n primary,\n ...(lines.length ? { lines } : {}),\n ...(facts?.length ? { facts } : {}),\n ...(badge === undefined ? {} : { badge }),\n ...(typeof openLabel === 'string' ? { openLabel: openLabel.trim() } : {}),\n };\n }\n if (kind === 'calendar') {\n const date = localColumn(raw, 'date', here);\n /* A range: the record spans its days from `date` to `end`, both its own\n columns, so a move can shift the two together. */\n const end = raw.end === undefined ? undefined : localColumn(raw, 'end', here);\n if (end !== undefined && end === date)\n throw new Error(`${here}: \"end\" names \"${end}\", the same column as \"date\"; a range needs the column its last day is in.`);\n /* A month is what a calendar always was, so it is said by leaving the span out: the model keeps a week or a day. */\n if (raw.span !== undefined && !CALENDAR_SPANS.includes(raw.span as CalendarSpan))\n throw new Error(\n `${here}: \"span\" must be ${CALENDAR_SPANS.map((one) => `\"${one}\"`).join(', ')}: what one page of the calendar shows.`,\n );\n const span = raw.span === undefined || raw.span === 'month' ? undefined : (raw.span as Exclude<CalendarSpan, 'month'>);\n const badge = raw.badge === undefined ? undefined : queueColumn(raw.badge, 'badge', here);\n const backdrop = raw.backdrop === undefined ? undefined : parseCalendarBackdrop(raw.backdrop, `${here}, backdrop`);\n return {\n kind,\n date,\n ...(end === undefined ? {} : { end }),\n ...(span ? { span } : {}),\n primary,\n ...(lines.length ? { lines } : {}),\n ...(badge === undefined ? {} : { badge }),\n ...(backdrop ? { backdrop } : {}),\n };\n }\n if (kind === 'cards') return parseCards(raw, `${here} (cards)`, primary, lines);\n const by = localColumn(raw, 'by', here);\n let lanes: string[] | undefined;\n if (raw.lanes !== undefined) {\n if (\n !Array.isArray(raw.lanes) ||\n !raw.lanes.length ||\n raw.lanes.length > 8 ||\n raw.lanes.some((lane) => typeof lane !== 'string' || !lane.trim())\n ) {\n throw new Error(`${here}: \"lanes\" must be one to eight non-empty lane values.`);\n }\n lanes = (raw.lanes as string[]).map((lane) => lane.trim());\n if (new Set(lanes).size !== lanes.length) throw new Error(`${here}: \"lanes\" must be unique.`);\n }\n const order = raw.order === undefined ? undefined : localColumn(raw, 'order', here);\n const swimlanes = raw.swimlanes === undefined ? undefined : localColumn(raw, 'swimlanes', here);\n /* A row, a lane and a place are three questions; one column cannot answer two of them. */\n if (swimlanes !== undefined && (swimlanes === by || swimlanes === order)) {\n throw new Error(\n `${here}: \"swimlanes\" names \"${swimlanes}\", which is already the board's \"${swimlanes === by ? 'by' : 'order'}\". Rows need a column of their own.`,\n );\n }\n let limits: Record<string, number> | undefined;\n if (raw.limits !== undefined) {\n if (!isRecord(raw.limits) || !Object.keys(raw.limits).length) {\n throw new Error(`${here}: \"limits\" must be an object of lane values to whole numbers, like { in_progress: 4 }.`);\n }\n limits = {};\n for (const [key, n] of Object.entries(raw.limits)) {\n const lane = key.trim();\n if (!lane) throw new Error(`${here}: \"limits\" has a blank lane value.`);\n if (lanes && !lanes.includes(lane))\n throw new Error(`${here}: \"limits\" names \"${lane}\", which is not one of its \"lanes\" (${lanes.join(', ')}).`);\n if (typeof n !== 'number' || !Number.isInteger(n) || n < 1 || n > 999) {\n throw new Error(`${here}: \"limits.${lane}\" must be a whole number from 1 to 999: the lane's work-in-progress limit.`);\n }\n limits[lane] = n;\n }\n }\n const category = raw.category === undefined ? undefined : localColumn(raw, 'category', here);\n if (category !== undefined && category === by)\n throw new Error(`${here}: \"category\" names \"${category}\", the board's \"by\": every card in a lane would wear the lane's chip.`);\n const footer = raw.footer === undefined ? undefined : parseBoardFooter(raw.footer, here);\n const sum = raw.sum === undefined ? undefined : localColumn(raw, 'sum', here);\n if (sum !== undefined && sum === by)\n throw new Error(`${here}: \"sum\" names \"${sum}\", the board's \"by\": a lane's own value is not an amount.`);\n let folded: string[] | undefined;\n if (raw.folded !== undefined) {\n if (\n !Array.isArray(raw.folded) ||\n !raw.folded.length ||\n raw.folded.length > 8 ||\n raw.folded.some((lane) => typeof lane !== 'string' || !lane.trim())\n )\n throw new Error(`${here}: \"folded\" must be one to eight lane values, like ['won', 'lost'].`);\n folded = (raw.folded as string[]).map((lane) => lane.trim());\n const stray = lanes && folded.find((lane) => !lanes!.includes(lane));\n if (stray) throw new Error(`${here}: \"folded\" names \"${stray}\", which is not one of its \"lanes\" (${lanes!.join(', ')}).`);\n }\n return {\n kind,\n by,\n ...(lanes ? { lanes } : {}),\n ...(order === undefined ? {} : { order }),\n ...(swimlanes === undefined ? {} : { swimlanes }),\n ...(limits ? { limits } : {}),\n primary,\n ...(lines.length ? { lines } : {}),\n ...(category === undefined ? {} : { category }),\n ...(footer ? { footer } : {}),\n ...(sum === undefined ? {} : { sum }),\n ...(folded ? { folded: [...new Set(folded)] } : {}),\n };\n}\n\n/** A card's foot: one to four local columns, each bare or `{ column, icon }`. */\nfunction parseBoardFooter(raw: unknown, here: string): AppBoardFact[] {\n if (!Array.isArray(raw) || !raw.length || raw.length > 4)\n throw new Error(`${here}: \"footer\" must be one to four local columns, each a name or { column, icon }.`);\n const facts = raw.map((item, index): AppBoardFact => {\n const at = `${here}, footer[${index}]`;\n if (typeof item === 'string') return { column: localColumn({ column: item }, 'column', at) };\n if (!isRecord(item)) throw new Error(`${at} must be a local column or { column, icon }.`);\n allowKeys(item, ['column', 'icon'], at);\n return {\n column: localColumn(item, 'column', at),\n ...(item.icon === undefined ? {} : { icon: parseIcon(item.icon, at) }),\n };\n });\n const seen = new Set<string>();\n for (const fact of facts) {\n if (seen.has(fact.column)) throw new Error(`${here}: \"footer\" names \"${fact.column}\" twice.`);\n seen.add(fact.column);\n }\n return facts;\n}\n\n/**\n * A split draws the view's own list — its show, query, tabs and filter bar —\n * beside the record the reader picks, so all it says itself is the detail's\n * fields and the list's page size. The detail is headed by the resource's\n * noun, as New is.\n */\nfunction parseSplit(input: Record<string, unknown>, at: string): AppSplitListDetail {\n const result: AppSplitListDetail = { kind: 'split' };\n if (input.detail !== undefined) {\n if (!Array.isArray(input.detail) || input.detail.length > 64) {\n throw new Error(`${at}: \"detail\" must be a list of at most 64 columns or label paths: the picked record's fields.`);\n }\n const detail = parseShow(input.detail, `${at}, detail`);\n if (new Set(detail).size !== detail.length) throw new Error(`${at}: \"detail\" names one column twice.`);\n result.detail = detail;\n }\n if (input.limit !== undefined) {\n if (!Number.isInteger(input.limit) || (input.limit as number) < 1 || (input.limit as number) > 200) {\n throw new Error(`${at}: \"limit\" must be an integer from 1 to 200: the list's page size.`);\n }\n result.limit = input.limit as number;\n }\n if (input.row !== undefined) {\n /* The queue's vocabulary: a split's rows are the queue's rows, narrowed to the pane beside a record. */\n const here = `${at}, \"row\"`;\n if (!isRecord(input.row)) throw new Error(`${here} must be an object: { primary, lines, properties, badge, avatar }.`);\n allowKeys(input.row, ['primary', 'lines', 'properties', 'badge', 'avatar'], here, PRESENTATION_RENAMED.queue);\n const row = input.row;\n const primary = queueColumn(row.primary, 'primary', here);\n if (row.lines !== undefined && (!Array.isArray(row.lines) || row.lines.length > MAX_LINES.queue)) {\n throw new Error(`${here}: \"lines\" must be a list of at most ${MAX_LINES.queue} columns beneath the primary.`);\n }\n const lines = ((row.lines ?? []) as unknown[]).map((line, i) => queueColumn(line, String(i), `${here}, lines`));\n if (row.properties !== undefined && (!Array.isArray(row.properties) || !row.properties.length || row.properties.length > 6)) {\n throw new Error(`${here}: \"properties\" must be one to 6 local columns or one-hop label paths.`);\n }\n const facts = ((row.properties ?? []) as unknown[]).map((fact, i) => queueColumn(fact, String(i), `${here}, properties`));\n result.row = {\n primary,\n ...(lines.length ? { lines } : {}),\n ...(facts.length ? { facts } : {}),\n ...(row.badge === undefined ? {} : { badge: queueColumn(row.badge, 'badge', here) }),\n ...(row.avatar === undefined ? {} : { avatar: queueColumn(row.avatar, 'avatar', here) }),\n };\n }\n return result;\n}\n\n/* ---------- dashboard views ---------- */\n\nfunction parseDashboardView(\n v: Record<string, unknown>,\n key: string,\n at: string,\n data: ParsedData,\n views: ReadonlyMap<string, ParsedView>,\n signsIn: boolean,\n): DashboardView {\n allowKeys(v, [...DASHBOARD_VIEW_KEYS, 'realm'], at, DASHBOARD_VIEW_RENAMED);\n if (typeof v.label !== 'string' || !v.label.trim()) throw new Error(`${at} is a dashboard and has no \"label\".`);\n /* A dashboard-level \"from\" is the sections' default — a board over one\n table should not repeat its name six times. A section that names its\n own still wins. */\n const description = optionalText(v, 'description', at);\n /* The words over the sections when they are not the menu's: \"Hello, {me.name}\". */\n /* false: the title is not drawn (it stays for a screen reader); the menu and the tab keep the label. */\n const heading = v.heading === false ? undefined : optionalText(v, 'heading', at);\n checkGreeting(heading, `${at}, \"heading\"`, signsIn);\n checkGreeting(description, `${at}, \"description\"`, signsIn);\n const table = optionalText(v, 'from', at);\n if (table) {\n checkResourceSlot(table, `${at}, \"from\"`, data);\n checkDeclaredResource(table, `${at}, \"from\"`, data);\n }\n if (\n v.windows !== undefined &&\n (!Array.isArray(v.windows) || !v.windows.length || v.windows.some((w) => typeof w !== 'string' || !w.trim()))\n ) {\n throw new Error(`${at} has \"windows\" that are not a list of phrases like \"last 30 days\".`);\n }\n /* The window it opens on, one of the windows it offers; an address's `?period=` still wins. */\n const offered = ((v.windows as string[] | undefined) ?? DEFAULT_WINDOWS).map((w) => w.trim().replace(/\\s+/g, ' '));\n const opensOn = typeof v.window === 'string' ? v.window.trim().replace(/\\s+/g, ' ') : undefined;\n if (v.window !== undefined && (!opensOn || !offered.includes(opensOn)))\n throw new Error(\n `${at} has a \"window\" of ${JSON.stringify(v.window)}, which is not one of the windows it offers: ${offered.map((w) => JSON.stringify(w)).join(', ')}.`,\n );\n if (v.windowControl !== undefined && v.windowControl !== 'segmented' && v.windowControl !== 'button')\n throw new Error(`${at} has a \"windowControl\" of ${JSON.stringify(v.windowControl)}. Use \"segmented\" or \"button\".`);\n if (v.filters !== undefined && (!Array.isArray(v.filters) || v.filters.some((f) => typeof f !== 'string' || !f.trim()))) {\n throw new Error(`${at} has \"filters\" that are not a list of column names.`);\n }\n if (!Array.isArray(v.sections)) throw new Error(`${at} needs \"sections\": a list of at least one section.`);\n if (v.aside !== undefined && !Array.isArray(v.aside)) throw new Error(`${at} has an \"aside\" that is not a list of sections.`);\n const embeds: string[] = [];\n const sections = parseDashSections(v.sections, at, table, data, views, embeds);\n const aside = Array.isArray(v.aside) ? parseDashSections(v.aside, `${at}, \"aside\"`, table, data, views, embeds, true) : undefined;\n nameSectionWindows([...sections, ...(aside ?? [])], at);\n const areas = parseAreas(v.areas, at, sections, aside !== undefined);\n /* The sections' default is one only while a section inherits it: a table\n every section names again for itself is read by nothing. */\n if (\n table &&\n ![...(v.sections as unknown[]), ...((v.aside as unknown[] | undefined) ?? [])].some(\n (s) =>\n isRecord(s) &&\n s.kind !== 'note' &&\n s.kind !== 'banner' &&\n s.kind !== 'view' &&\n s.kind !== 'firstRun' &&\n s.kind !== 'activity' &&\n s.kind !== 'find' &&\n s.kind !== 'branding' &&\n s.kind !== 'integrations' &&\n s.from === undefined,\n )\n ) {\n throw new Error(`${at} has a \"from\" that no section inherits: every section names its own \"from\". Remove it.`);\n }\n return {\n kind: 'dashboard',\n key,\n at,\n embeds,\n tables: [...new Set([...sections, ...(aside ?? [])].map((section) => section.table).filter((name): name is string => Boolean(name)))],\n view: {\n label: v.label.trim(),\n ...(heading === undefined ? {} : { heading }),\n ...(v.heading === false ? { headingHidden: true as const } : {}),\n ...parseHead(v.head, at),\n ...(description === undefined ? {} : { description }),\n sections,\n ...(aside === undefined ? {} : { aside }),\n ...(areas === undefined ? {} : { areas }),\n ...(v.path === undefined ? {} : { path: parseRoutePath(v.path, at) }),\n ...(v.icon === undefined ? {} : { icon: parseIcon(v.icon, at) }),\n ...(v.realm === undefined ? {} : { realm: parseRealm(v.realm, at) }),\n ...(v.windows === undefined ? {} : { windows: (v.windows as string[]).map((w) => w.trim()) }),\n ...(opensOn === undefined ? {} : { window: opensOn }),\n ...(v.windowControl === 'button' ? { windowControl: 'button' as const } : {}),\n ...(v.filters === undefined ? {} : { filters: (v.filters as string[]).map((f) => f.trim()) }),\n ...(favoriteFlag(v.favorite, at) ? { favorite: true as const } : {}),\n },\n };\n}\n\n/** A view with the roles it names, checked against the App's (appViewRoles.ts). */\nfunction withOpenRoles<V extends object>(view: V, raw: Record<string, unknown>, at: string, ctx: ContentContext): V & { roles?: string[] } {\n const roles = parseOpenRoles(raw.roles, at, ctx.auth);\n return roles ? { ...view, roles } : view;\n}\n\n/** A section kind as a noun: \"a metric\", \"a rows section\" — \"a rows\" is not English. */\n/** Keys a dashboard section kind took under another name, with what they are now. */\nconst RENAMED_SECTION_KEYS: Record<string, Record<string, string>> = {\n metric: { view: '\"to\": metric(title, from, { to: \\'overdue_list\\' }) opens the list view it names' },\n custom: {\n totals: '\"figures\": the named aggregate reads its component receives as figures.<name> (\"totals\" is a list\\'s footer of sums)',\n },\n};\n\nconst sectionWord = (kind: string) => (kind === 'rows' ? 'rows section' : kind);\n\n/** The target's standing filter stays ahead of a metric's own refinement,\n both when parsed and when its compare/window is derived (app.ts). */\nexport function metricCohortQuery(standingQuery: string | undefined, refinement: string | undefined): string | undefined {\n const standing = andQuery(splitClauseTail(standingQuery ?? '').head);\n const own = andQuery(splitClauseTail(refinement ?? '').head);\n // A normalized section may be parsed again. Only a whole leading\n // conjunction counts as already scoped; an `or` is bracketed above.\n return (standing && own !== standing && !own.startsWith(`${standing} and `) ? andQuery(standing, own) : own) || undefined;\n}\n\nfunction parseDashSections(\n raw: unknown[],\n at: string,\n defaultTable: string | undefined,\n data: ParsedData,\n views: ReadonlyMap<string, ParsedView>,\n embeds: string[],\n aside = false,\n): AppDashSection[] {\n if (!raw.length) throw new Error(`${at}: a dashboard needs at least one section.`);\n /* Each section is judged on its own: one run names every section's refusal (appProblems.ts). */\n const problems: string[] = [];\n const sections = raw.map((entry, i) =>\n gather(problems, (): AppDashSection => {\n const here = `${at}, section ${i + 1}`;\n if (!isRecord(entry)) throw new Error(`${here} is not an object.`);\n const s = entry;\n if (s.kind === 'view') {\n const section = embedSection(s, here, views, data, aside);\n embeds.push(s.view as string);\n return section;\n }\n const authored = String(s.kind ?? '');\n /* A banner is a note drawn as one: its own kind to the author, a note of variant 'banner' once read. */\n const banner = authored === 'banner';\n const kind = banner ? 'note' : authored;\n if (!(DASH_KINDS as readonly string[]).includes(authored)) {\n throw new Error(\n `${here} has an unknown kind \"${authored}\". Use \"metric\", \"breakdown\", \"rows\", \"chart\", \"note\", \"banner\", \"matrix\", \"funnel\", \"board\", \"firstRun\", \"custom\", \"activity\", \"find\", \"branding\", \"integrations\" or \"view\", each written with its helper: metric(), breakdown(), rows(), chart(), note(), banner(), matrix(), funnel(), board(), firstRun(), custom(), activity(), find(), brandingForm(), integrationsForm(), embed().`,\n );\n }\n if (kind === 'firstRun') {\n if (aside) throw new Error(`${here} is a first run, which stands in the dashboard's main flow: move it into \"sections\".`);\n if (raw.filter((other) => isRecord(other) && other.kind === 'firstRun').length > 1) {\n throw new Error(`${at} has more than one first run. One list of first steps is the start; put every step in it.`);\n }\n return firstRunSection(s, here, views);\n }\n /* Per kind, so `show` on a metric or `over` on a note is refused rather\n than read by nothing — `over` on a note used to switch the whole\n dashboard's window controls on for a section the window never reached.\n A key another kind reads is named as that kind's (\"only a chart\n carries\"); a key no kind reads is a typo and gets the list. */\n const takes = SECTION_KEYS[authored as keyof typeof SECTION_KEYS];\n for (const key of Object.keys(s)) {\n if (takes.includes(key) || /^[$_]/.test(key)) continue;\n /* A key renamed within its own kind is told as the rename: \"only a view carries\" for a metric's `view` sent the\n author to the embed, when the card's destination is `to`. */\n const renamed = RENAMED_SECTION_KEYS[kind]?.[key];\n if (renamed) throw new Error(`${here} has \"${key}\", which is now ${renamed}.`);\n const owners = (Object.keys(SECTION_KEYS) as Array<AppDashSection['kind']>).filter((k) => SECTION_KEYS[k].includes(key));\n if (owners.length) throw new Error(`${here} has \"${key}\", which only a ${owners.map(sectionWord).join(' or ')} carries.`);\n throw new Error(`${here} (a ${sectionWord(authored)}) ${unknownKey(key, takes, keyHomesOf(key))}.`);\n }\n if (kind === 'custom') return parseCustomDashSection(s, here, data);\n if (kind === 'activity') return parseActivitySection(s, here, data);\n if (kind === 'find') return parseFindSection(s, here, data);\n /* The tenant's own Branding form: what it may change is the App's `branding` (checked at the root). The\n integrations' settings form is the same shape: what it shows is the jobs module's, read from the server. */\n if (kind === 'branding' || kind === 'integrations') {\n if (s.title !== undefined && (typeof s.title !== 'string' || !s.title.trim()))\n throw new Error(`${here} has a \"title\" that is not text.`);\n if (s.width !== undefined && !WIDTHS.includes(String(s.width) as SectionWidth))\n throw new Error(`${here} has a \"width\" of \"${String(s.width)}\". Use ${WIDTHS.join(', ')}.`);\n return {\n kind,\n ...(s.title === undefined ? {} : { title: (s.title as string).trim() }),\n ...(s.icon === undefined ? {} : { icon: parseIcon(s.icon, here) }),\n ...(s.width === undefined ? {} : { width: s.width as SectionWidth }),\n };\n }\n let bannerKeys: Pick<AppDashSection, 'variant' | 'eyebrow' | 'image'> = {};\n if (kind === 'note') {\n if (typeof s.text !== 'string' || !s.text.trim()) throw new Error(`${here} is a note and has no \"text\".`);\n if (s.action !== undefined) {\n parseAppLinkAction(s.action, `${here}, \"action\"`);\n }\n bannerKeys = parseNoteBanner(s, here, data, banner);\n } else if (s.from === undefined ? !defaultTable : typeof s.from !== 'string' || !s.from.trim()) {\n throw new Error(\n `${here} has no \"from\"${\n defaultTable === undefined ? ' — name one, or set a dashboard-level \"from\" for every section to inherit' : ''\n }.`,\n );\n }\n if (typeof s.from === 'string') {\n checkResourceSlot(s.from.trim(), `${here}, \"from\"`, data);\n checkDeclaredResource(s.from.trim(), `${here}, \"from\"`, data);\n }\n if ((kind === 'breakdown' || kind === 'chart') && (typeof s.by !== 'string' || !s.by.trim())) {\n throw new Error(`${here} has no \"by\" — the column its groups are counted under.`);\n }\n let card: string[] | undefined;\n if (kind === 'board') {\n /* Lanes come from values of one of the table's own columns; a\n bucketed or dotted by has no value a card could sit under. */\n if (typeof s.by !== 'string' || !s.by.trim())\n throw new Error(`${here} is a board and has no \"by\" — the column whose values are its lanes.`);\n if (/[\\s.,]/.test(s.by.trim())) {\n throw new Error(\n `${here} has a \"by\" of \"${String(s.by).trim()}\" — a board's lanes come from a bare column of its own table, like \"status\".`,\n );\n }\n if (s.lanes !== undefined) {\n if (\n !Array.isArray(s.lanes) ||\n s.lanes.length < 1 ||\n s.lanes.length > 8 ||\n s.lanes.some((lane) => typeof lane !== 'string' || !lane.trim())\n ) {\n throw new Error(`${here} has \"lanes\" that are not a list of 1 to 8 nonblank strings.`);\n }\n if (new Set(s.lanes).size !== s.lanes.length)\n throw new Error(`${here} has duplicate \"lanes\". Each exact lane value may appear only once.`);\n }\n /* The one card vocabulary: a primary line, then its lines, label\n paths welcome. Absent, the card is the table's label column alone;\n lines beneath an unnamed primary would take its place. */\n if (s.primary !== undefined && (typeof s.primary !== 'string' || !s.primary.trim()))\n throw new Error(`${here} has a \"primary\" that is not a column or a label path.`);\n if (s.lines !== undefined && (!Array.isArray(s.lines) || s.lines.some((line) => typeof line !== 'string' || !line.trim()))) {\n throw new Error(`${here} has \"lines\" that are not a list of columns or label paths.`);\n }\n const lines = ((s.lines ?? []) as string[]).map((line) => line.trim());\n if (lines.length && s.primary === undefined) {\n throw new Error(\n `${here} has \"lines\" and no \"primary\": name the card's first line — the label column stands alone only on a card with no lines.`,\n );\n }\n if (s.primary !== undefined) card = [(s.primary as string).trim(), ...lines];\n }\n if (kind === 'matrix' && (typeof s.by !== 'string' || !s.by.trim() || !s.by.includes(','))) {\n throw new Error(\n `${here} is a matrix and needs a two-key \"by\" — \"stage, month close_date\": rows by the first, columns by the second.`,\n );\n }\n if (s.shape === 'funnel')\n throw new Error(\n `${here} has shape: 'funnel', which is now funnel(title, from, stages): ordered stages counted in one statement. Where rows stand now, by one column's values, is breakdown(title, from, column, { shape: 'steps' }).`,\n );\n const stages = kind === 'funnel' ? parseFunnelStages(s, here) : undefined;\n if (kind === 'breakdown') parseStepsShape(s, here);\n else if (s.shape !== undefined && !(DASH_CHART_SHAPES as readonly string[]).includes(String(s.shape))) {\n throw new Error(\n `${here} has a \"shape\" of \"${String(s.shape)}\". Use \"line\", \"bar\", \"donut\", \"stacked\", \"scatter\", \"heatmap\", \"waterfall\" or \"treemap\".`,\n );\n }\n if (kind === 'chart') parseChartShape(s, here);\n /* `auto` is a chart's word (autoBucket.ts): a breakdown lists its groups and a matrix crosses two fixed keys, and\n neither can have its unit move with the window; a heatmap's grid is a fixed grid of cells. */\n if (typeof s.by === 'string' && /(^|,)\\s*auto\\b/i.test(s.by)) {\n if (kind === 'matrix' || s.shape === 'heatmap') {\n throw new Error(\n `${here} is a ${kind === 'matrix' ? 'matrix' : 'heatmap'}, whose keys must both be fixed: \"auto\" picks a unit from the window, and a grid's cells cannot move with it. Write the unit, like \"month close_date\".`,\n );\n }\n if (kind !== 'chart') {\n throw new Error(\n `${here} has an \"auto\" key, which only a chart takes: its unit follows the window. Write the unit, like \"month close_date\".`,\n );\n }\n if (!autoKeyOf(s.by)) throw new Error(`${here} has a \"by\" of \"${s.by.trim()}\": \"auto\" cuts a date column, like \"auto created_at\".`);\n }\n if (s.shape === 'stacked' && (typeof s.by !== 'string' || !s.by.trim() || !s.by.includes(','))) {\n throw new Error(`${here} is a stacked chart and needs a two-key \"by\" — \"region, stage\": a bar for each region, divided by stage.`);\n }\n /* A goal a line or a bar can be measured against; a donut has no scale to rule it on. */\n /* A metric's goal may be read from data — a measure over a table and a query, in the metric's own words;\n a chart's rule is a number. */\n let target: number | DashTarget | undefined;\n /* A breakdown's goal is a row per group (G76): a seller's won against their quota, the target table's `by`\n matching each group's key, windowed by its own `over` as the section is by its. */\n const grouped = kind === 'breakdown';\n if (grouped && s.target !== undefined && (s.target === null || typeof s.target !== 'object' || Array.isArray(s.target)))\n throw new Error(\n `${here} has a \"target\" that is not a goal per group: { from, by, measure, over? }, a quota's amount by its owner.`,\n );\n if (grouped && s.target !== undefined && s.shape === 'steps')\n throw new Error(`${here} is drawn as steps, which have no bar to measure a \"target\" on.`);\n if (\n s.target !== undefined &&\n (kind === 'metric' || grouped) &&\n s.target !== null &&\n typeof s.target === 'object' &&\n !Array.isArray(s.target)\n ) {\n const t = s.target as Record<string, unknown>;\n const keys = grouped ? ['from', 'query', 'measure', 'by', 'over'] : ['from', 'query', 'measure'];\n if (t.table !== undefined)\n throw new Error(`${here} has a \"target\" with \"table\", which is now \"from\": the resource its goal is read from.`);\n const unknown = Object.keys(t).filter((key) => !keys.includes(key));\n if (unknown.length)\n throw new Error(\n grouped\n ? `${here} has a \"target\" with ${unknown.map((key) => `\"${key}\"`).join(', ')}. A breakdown's target says \"from\", \"by\", \"measure\", \"query\" and \"over\".`\n : `${here} has a \"target\" with ${unknown.map((key) => `\"${key}\"`).join(', ')}. A target from data says \"from\", \"query\" and \"measure\", as the metric does.`,\n );\n for (const key of keys) {\n if (t[key] !== undefined && (typeof t[key] !== 'string' || !(t[key] as string).trim()))\n throw new Error(`${here} has a \"target\" whose \"${key}\" is not a non-empty string.`);\n }\n if (grouped && (t.by === undefined || /\\s|,/.test((t.by as string).trim())))\n throw new Error(`${here} has a \"target\" with no single \"by\": the column of its table each group's key is matched on.`);\n if (grouped && typeof s.by === 'string' && /\\s|,/.test(s.by.trim()))\n throw new Error(`${here} groups by \"${s.by.trim()}\"; a target is matched on one plain column's value.`);\n if (t.query === undefined && t.measure === undefined && t.from === undefined)\n throw new Error(`${here} has an empty \"target\": give a number, or the \"from\", \"query\" and \"measure\" its goal is read from.`);\n if (t.from !== undefined) checkDeclaredResource((t.from as string).trim(), `${here}, \"target\", \"from\"`, data);\n if (typeof t.query === 'string') conditionsOnly(t.query, here, 'target');\n target = {\n table: (t.from as string | undefined)?.trim() ?? (typeof s.from === 'string' ? s.from.trim() : defaultTable) ?? '',\n ...(t.query === undefined ? {} : { query: (t.query as string).trim() }),\n measure: ((t.measure ?? s.measure ?? 'count') as string).trim(),\n ...(t.by === undefined ? {} : { by: (t.by as string).trim() }),\n ...(t.over === undefined ? {} : { over: (t.over as string).trim() }),\n };\n } else if (s.target !== undefined) {\n if (typeof s.target !== 'number' || !Number.isFinite(s.target)) {\n throw new Error(\n `${here} has a \"target\" that is not a number${kind === 'metric' ? ', or the \"from\", \"query\" and \"measure\" its goal is read from' : ''}.`,\n );\n }\n target = s.target;\n }\n if (s.curve !== undefined) {\n if (s.curve !== 'smooth' && s.curve !== 'straight')\n throw new Error(`${here} has a \"curve\" of ${JSON.stringify(s.curve)}. Use \"smooth\" or \"straight\".`);\n if (s.shape !== undefined && s.shape !== 'line')\n throw new Error(`${here} is a ${String(s.shape)} chart; only a line has a \"curve\".`);\n }\n if (s.total !== undefined) {\n if (s.shape !== 'donut') throw new Error(`${here} has a \"total\", which names a donut's middle figure; it is not a donut.`);\n if (typeof s.total !== 'string' || !s.total.trim() || s.total.trim().length > 40)\n throw new Error(`${here} has a \"total\" that is not a few words (at most 40 characters): what the middle figure counts.`);\n }\n if (s.target !== undefined && s.shape === 'donut')\n throw new Error(`${here} is a donut, which has no scale to draw a \"target\" on. Use a line or stacked bars.`);\n if (kind === 'chart' && s.sort !== undefined) {\n if (s.shape !== 'bar' && s.shape !== 'donut')\n throw new Error(`${here} has a \"sort\", which orders the categories of a bar chart or a donut; a line runs along its key.`);\n if (s.sort !== 'value' && s.sort !== 'category')\n throw new Error(\n `${here} has a \"sort\" of ${JSON.stringify(s.sort)}. Use \"value\" (largest first) or \"category\" (the key's own order).`,\n );\n }\n for (const key of ['title', 'query', 'measure', 'x', 'compare', 'by', 'sort', 'over'] as const) {\n if (s[key] !== undefined && (typeof s[key] !== 'string' || !(s[key] as string).trim())) {\n throw new Error(`${here} has a \"${key}\" that is not a non-empty string.`);\n }\n }\n for (const key of ['query', 'compare'] as const) {\n if (typeof s[key] === 'string' && s[key] !== PREVIOUS_PERIOD) conditionsOnly(s[key] as string, here, key);\n }\n const table = kind === 'note' ? undefined : typeof s.from === 'string' ? s.from.trim() : defaultTable;\n const columns = s.show === undefined ? undefined : parseShow(s.show, here);\n const labels = labelsFor(columns, table ? data.resources?.[table]?.labels : undefined);\n if (s.limit !== undefined && (typeof s.limit !== 'number' || !Number.isInteger(s.limit) || s.limit < 1)) {\n throw new Error(`${here} has a \"limit\" that is not a positive whole number.`);\n }\n if (s.height !== undefined && (typeof s.height !== 'number' || !Number.isFinite(s.height) || s.height < 120)) {\n throw new Error(`${here} has a \"height\" that is not a number of pixels (120 or more).`);\n }\n if (s.width !== undefined && !WIDTHS.includes(String(s.width) as SectionWidth)) {\n throw new Error(`${here} has a \"width\" of \"${String(s.width)}\". Use ${WIDTHS.join(', ')}.`);\n }\n if (s.better !== undefined) {\n if (!(BETTER as readonly string[]).includes(String(s.better)))\n throw new Error(`${here} has a \"better\" of \"${String(s.better)}\". Use \"up\" or \"down\".`);\n /* Without \"compare\" there is no change to colour: advice (appAdvisories), not a refusal. */\n }\n if (s.spark !== undefined && typeof s.spark !== 'boolean') throw new Error(`${here} has a \"spark\" that is not true or false.`);\n if (s.format !== undefined && !(FIGURE_FORMATS as readonly string[]).includes(String(s.format)))\n throw new Error(`${here} has a \"format\" of \"${String(s.format)}\". Use ${FIGURE_FORMAT_WORDS}.`);\n if (s.unit !== undefined && (typeof s.unit !== 'string' || !s.unit.trim() || s.unit.length > 24))\n throw new Error(`${here} has a \"unit\" that is not a short word said after the figure, like \"days\".`);\n if (s.figure !== undefined && s.figure !== 'exact' && s.figure !== 'compact')\n throw new Error(\n `${here} has a \"figure\" of ${JSON.stringify(s.figure)}. Use \"exact\" (to the cent, the default) or \"compact\" (\"$28.1K\").`,\n );\n const windows = parseSectionWindows(s, here);\n /* A metric counts its own query. The list it opens (`to:`) adds only its\n standing conditions — the rows that list can show at all, so the drill\n holds every row counted — never a tab: a tab is where a reader starts,\n not what the list is, and a metric with no query counted the first\n tab's open rows where it meant every row. The drill opens\n the list on exactly the counted rows (its \"All\" tab, where it has one).\n List plumbing is not part of a measure. Resolve this before windows and\n comparisons are derived, so every read and the drill share a cohort. */\n let opens: string | undefined;\n let query = s.query === undefined ? undefined : (s.query as string).trim();\n let compare = s.compare === undefined ? undefined : (s.compare as string).trim();\n /* A breakdown, chart or matrix says where its groups open the same way (`to: 'view-id'`, or `false` for groups that\n are text); a metric's card is the one doorway of its own. A group's list is judged as a metric's is. */\n const drills = kind === 'breakdown' || kind === 'chart' || kind === 'matrix' || kind === 'funnel';\n /* A metric's card takes false the same way: a figure read where it stands, opening nothing. */\n const doorway = drills || kind === 'metric';\n if (doorway && s.to !== undefined && s.to !== false && typeof s.to !== 'string')\n throw new Error(`${here} has a \"to\" that is not a list view's key or false.`);\n if ((kind === 'metric' || drills) && s.to !== undefined && s.to !== false) {\n const target = typeof s.to === 'string' ? views.get(s.to.trim()) : undefined;\n if (!target || target.kind !== 'list') {\n const lists = [...views.values()].filter((view) => view.kind === 'list').map((view) => view.key);\n throw new Error(\n `${here} opens \"${String(s.to)}\", which is not a list view this App declares. Its list views: ${lists.join(', ') || 'none'}.`,\n );\n }\n if (table !== undefined && target.view.table !== table) {\n throw new Error(\n `${here} counts ${table} and opens \"${target.key}\", a list of ${target.view.table}. ${drills ? 'A group opens a list of the rows it counted.' : 'A metric opens a list of the rows it counted.'}`,\n );\n }\n // An authored clause-only query must not become absent: parsing that\n // section again would silently count every row instead.\n for (const [key, value] of [\n ['query', query],\n ['compare', compare],\n ] as const) {\n if (value !== undefined && !splitClauseTail(value).head) {\n throw new Error(\n `${here} has a \"${key}\" with no filter conditions. A metric opening a list needs conditions, not only sort, show or limit clauses. ` +\n (key === 'query'\n ? 'Omit \"query\" to count every row the target view shows.'\n : 'Omit \"compare\" to leave out the comparison.'),\n );\n }\n }\n opens = target.key;\n query = metricCohortQuery(target.view.query, query);\n // A full compare is its own refinement; previous period is derived\n // later from the effective query.\n if (compare && compare !== PREVIOUS_PERIOD) compare = metricCohortQuery(target.view.query, compare);\n }\n /* The aside is a narrow column: rows there read as names, each with a\n quiet line under it and a value at its end — never a table's columns. */\n if (aside && kind === 'rows' && columns && columns.length > 3) {\n throw new Error(\n `${here} shows ${columns.length} columns. Rows in the aside draw as a name, a line under it and a value at its end: show at most three, or move them into \"sections\".`,\n );\n }\n /* What a section with nothing does: a rows section says so in place (guidance) or leaves itself out; the others\n leave themselves out. A dashboard has no 'collapse': the sections do not sit in a run of empty lists. */\n if (s.empty === false) throw new Error(`${here} has \"empty: false\", which is now \"empty: 'hide'\".`);\n if (s.empty === 'collapse')\n throw new Error(\n `${here} has \"empty: 'collapse'\", which only a record page's related lists take. A dashboard section that has nothing says so in place (rows take guidance) or is left out with \"empty: 'hide'\".`,\n );\n if (s.empty !== undefined && s.empty !== 'hide' && kind !== 'rows')\n throw new Error(\n `${here} (a ${sectionWord(kind)}) takes \"empty: 'hide'\", which leaves it out while it has nothing; guidance is a rows section's.`,\n );\n const emptyMode = s.empty === 'hide' ? ('hide' as const) : undefined;\n return {\n ...(opens === undefined ? {} : { view: opens }),\n ...(doorway && s.to === false ? { noDrill: true as const } : {}),\n kind: kind as AppDashSection['kind'],\n title: s.title === undefined ? undefined : String(s.title).trim(),\n table,\n text: s.text === undefined ? undefined : (s.text as string).trim(),\n /* A section's mark: beside its title, or a note's over its guidance. */\n ...(s.icon !== undefined ? { icon: parseIcon(s.icon, here) } : {}),\n ...(kind === 'note' && s.action !== undefined ? { action: parseAppLinkAction(s.action, `${here}, \"action\"`) } : {}),\n ...bannerKeys,\n query,\n measure: s.measure === undefined ? undefined : (s.measure as string).trim(),\n compare,\n better: s.better as AppDashSection['better'],\n spark: s.spark as boolean | undefined,\n ...(s.format === undefined ? {} : { format: s.format as AppDashSection['format'] }),\n ...(s.unit === undefined ? {} : { unit: (s.unit as string).trim() }),\n ...(s.figure === undefined ? {} : { figure: s.figure as 'exact' | 'compact' }),\n by: s.by === undefined ? undefined : (s.by as string).trim(),\n ...(stages ? { stages } : {}),\n ...(s.lanes === undefined ? {} : { lanes: [...(s.lanes as string[])] }),\n shape: s.shape as AppDashSection['shape'],\n ...(typeof s.x === 'string' ? { x: s.x.trim() } : {}),\n ...(s.curve === undefined ? {} : { curve: s.curve as 'smooth' | 'straight' }),\n ...(typeof s.total === 'string' ? { total: s.total.trim() } : {}),\n ...(s.notes === undefined\n ? {}\n : {\n notes: Object.fromEntries(Object.entries(s.notes as Record<string, string>).map(([k, v]) => [k, v.trim()])),\n }),\n over: s.over === undefined ? undefined : (s.over as string).trim(),\n ...(windows ? { windows } : {}),\n show: card ?? columns,\n ...(labels ? { labels } : {}),\n sort: s.sort === undefined ? undefined : (s.sort as string).trim(),\n ...(s.sizing === undefined ? {} : { sizing: parseTableSizing(s.sizing, here) }),\n ...(kind === 'rows' && s.empty !== undefined && !emptyMode ? { empty: parseListEmpty(s.empty, here) } : {}),\n ...(emptyMode ? { emptyMode } : {}),\n limit: s.limit as number | undefined,\n width: s.width as SectionWidth | undefined,\n ...(s.height === undefined ? {} : { height: s.height as number }),\n ...(target === undefined ? {} : { target }),\n };\n }),\n );\n /* Where a section stands on the layout is read beside its kind's keys, since every kind takes it the same way. */\n raw.forEach((entry, i) => {\n if (!isRecord(entry) || entry.area === undefined) return;\n gather(problems, () => {\n const here = `${at}, section ${i + 1}`;\n if (aside) throw new Error(`${here} has an \"area\", and the aside is not on the areas: an aside is a column of its own.`);\n if (entry.kind === 'firstRun')\n throw new Error(`${here} is a first run, which leads the dashboard outside its areas: it takes no \"area\".`);\n if (typeof entry.area !== 'string' || !isAreaName(entry.area.trim()))\n throw new Error(\n `${here} has an \"area\" that is not an area name: a lowercase word like \"trend\" (letters, digits and hyphens, at most 24).`,\n );\n if (entry.width !== undefined)\n throw new Error(`${here} has a \"width\" beside its \"area\": the area sets its width. Remove the \"width\".`);\n const section = sections[i];\n if (section) section.area = entry.area.trim();\n });\n });\n if (problems.length) throw new AppProblems(problems);\n return sections as AppDashSection[];\n}\n\n/**\n * A list view drawn inside a dashboard, read-only like any dashboard list:\n * the rows the view's room opens on (its standing query and a tab, or the\n * split's list query), drawn as its presentation reads — a grid or split as\n * a list of its show, a checklist or queue as a list of its card, a board as\n * a board. The dashboard's window and pick filters apply as to any section.\n */\nfunction embedSection(\n s: Record<string, unknown>,\n at: string,\n views: ReadonlyMap<string, ParsedView>,\n data: ParsedData,\n aside: boolean,\n): AppDashSection {\n allowKeys(s, VIEW_SECTION_KEYS, `${at} (a view)`, { tab: 'is now \"listTab\": the list tab\\'s address word' });\n const listViews = [...views.values()].filter((view) => view.kind === 'list').map((view) => view.key);\n const parsed = typeof s.view === 'string' ? views.get(s.view) : undefined;\n if (!parsed || parsed.kind !== 'list') {\n throw new Error(\n `${at} embeds \"${String(s.view)}\", which is not a list view this App declares. Its list views: ${listViews.join(', ') || 'none'}.`,\n );\n }\n const { key, view } = parsed;\n const title = optionalText(s, 'title', at);\n const over = optionalText(s, 'over', at);\n if (s.width !== undefined && !WIDTHS.includes(String(s.width) as SectionWidth)) {\n throw new Error(`${at} has a \"width\" of \"${String(s.width)}\". Use ${WIDTHS.join(', ')}.`);\n }\n if (s.limit !== undefined && (typeof s.limit !== 'number' || !Number.isInteger(s.limit) || s.limit < 1)) {\n throw new Error(`${at} has a \"limit\" that is not a positive whole number.`);\n }\n let tab = view.tabs?.[0];\n if (s.listTab !== undefined) {\n /* A tab is named by its address word, the one its URL carries (`?tab=`): a label is said in the reader's\n language and changes with `msg()`, the word does not. */\n tab = view.tabs?.find((candidate) => tabKey(candidate) === s.listTab);\n if (!tab) {\n const byLabel = view.tabs?.find((candidate) => candidate.label === s.listTab);\n throw new Error(\n byLabel\n ? `${at} names the tab \"${String(s.listTab)}\" by its label. Name a tab by its address word: \"${tabKey(byLabel)}\".`\n : `${at} names the tab \"${String(s.listTab)}\", which the view \"${key}\" does not have. ` +\n (view.tabs?.length ? `Its tabs: ${view.tabs.map((candidate) => tabKey(candidate)).join(', ')}.` : 'It has no tabs.'),\n );\n }\n }\n const presentation = view.presentation;\n const windows = parseSectionWindows(s, at);\n if (windows && presentation?.kind === 'board')\n throw new Error(`${at} embeds \"${key}\", a board, which takes the dashboard's window; its own \"windows\" are for a list.`);\n const interactive = embedInteractive(s, at, key, presentation?.kind, aside);\n /* What the embed says while it has nothing: its own guidance or 'hide', as a rows section takes; else the tab's,\n and on the first tab (the list as it opens) the list's own. A board says 'hide' or nothing: its lanes are its\n empty state. */\n if (s.empty === false) throw new Error(`${at} has \"empty: false\", which is now \"empty: 'hide'\".`);\n const own = s.empty === undefined || s.empty === 'hide' ? undefined : parseListEmpty(s.empty, at);\n if (own && presentation?.kind === 'board')\n throw new Error(`${at} embeds \"${key}\", a board, which takes \"empty: 'hide'\"; its lanes say it has nothing.`);\n const empty = own ?? tab?.empty ?? (tab === view.tabs?.[0] ? view.empty : undefined);\n const query = andQuery(view.query, tab?.query) || undefined;\n // The view's default order, where its tab says none of its own.\n const tabSorts = Boolean(tab?.query && /(^|\\s)(sort|order\\s+by)\\b/i.test(splitClauseTail(tab.query).tail));\n const base = {\n title: title ?? view.label ?? listLabel(view.table, data),\n table: view.table,\n ...(s.icon === undefined ? {} : { icon: parseIcon(s.icon, at) }),\n ...(query ? { query } : {}),\n ...(view.sort && !tabSorts ? { sort: view.sort } : {}),\n ...(s.width === undefined ? {} : { width: s.width as SectionWidth }),\n ...(s.limit === undefined ? {} : { limit: s.limit as number }),\n ...(over ? { over } : {}),\n ...(windows ? { windows } : {}),\n ...(interactive ? { interactive } : {}),\n ...(s.empty === 'hide' ? { emptyMode: 'hide' as const } : empty && presentation?.kind !== 'board' ? { empty } : {}),\n view: key,\n };\n if (!presentation || presentation.kind === 'split') {\n const show = view.show;\n const labels = labelsFor(show, data.resources?.[view.table]?.labels);\n return {\n kind: 'rows',\n ...base,\n ...(show ? { show } : {}),\n ...(labels ? { labels } : {}),\n ...(view.sizing === undefined ? {} : { sizing: view.sizing }),\n };\n }\n /* A custom list embedded is still its component's to draw (the rows section hands the view's presentation on). */\n if (presentation.kind === 'custom') return { kind: 'rows', ...base, show: [...presentation.show] };\n const card = [presentation.primary, ...('lines' in presentation ? (presentation.lines ?? []) : [])];\n if (presentation.kind === 'board') {\n if (s.width !== undefined) throw new Error(`${at} embeds \"${key}\", a board, which a dashboard draws full width. Remove \"width\".`);\n return {\n kind: 'board',\n ...base,\n by: presentation.by,\n ...(presentation.lanes ? { lanes: [...presentation.lanes] } : {}),\n show: card,\n };\n }\n return { kind: 'rows', ...base, show: card };\n}\n","/**\n * A free-form page's object condition (`where={{ status: 'booked', party_size: { gt: 1 } }}`), written out as the\n * query language's own text. One compiler for both ends: the browser compiles a block's `where` into the query it\n * already sends, and the server compiles the `where` a read sends beside its `query` (resourceReadHttp.ts). Either\n * way the result is parsed by the one parser under the reader's grants, so an object condition is held to exactly\n * what the same condition typed as text would be — there is no second path to the database.\n *\n * The server never trusts the browser's types: a key that is not one of the resource's columns, an operator the\n * object form does not have, or a value of the wrong kind for its column is refused with a sentence, not dropped.\n * Dropping it would widen the read silently, and a page that asked for one class's bookings would draw everyone's.\n *\n * Values are written so the parser reads them as what they are: a string is quoted (a quoted value is always\n * text, so `'me'` or `'today'` in a text column is those letters), except digits on a number column, which stay\n * bare so they compare as numbers, ids past 2^53 included, and an ISO day on a date column, bare so it reads as\n * that day (on a timestamp, all of it). A list is a chain of `=` joined by `or`, never `in (…)`: the language\n * splits an `in` list at every comma, quoted or not.\n */\nimport { columnKind, isFlagColumn, type ColumnMeta, type TableMeta } from './schema.js';\n\n/** The operators of the object form, and the language's word for each. */\nconst RANGE: Readonly<Record<string, string>> = { gt: '>', gte: '>=', lt: '<', lte: '<=' };\nconst MATCH: Readonly<Record<string, string>> = { contains: 'contains', startsWith: 'startswith', endsWith: 'endswith' };\nconst WHERE_OPERATORS: readonly string[] = ['not', ...Object.keys(RANGE), ...Object.keys(MATCH)];\n\ntype Kind = 'number' | 'boolean' | 'date' | 'text' | 'other';\nconst NUMERAL = /^-?\\d+(?:\\.\\d+)?$/;\nconst ISO_DAY = /^\\d{4}-\\d{2}-\\d{2}$/;\n/* The language's column token: a name outside it could not be read back as a column. */\nconst COLUMN_NAME = /^[\\w$]+$/;\n\n/* By shape, not by identity: an object made in another realm (a worker, a bundle's own copy of Object, a test\n sandbox) has a different Object.prototype, and one from Object.create(null) has none; both are plain data. A Date,\n a Map or a class instance says its own tag. */\nconst plain = (value: unknown): value is Record<string, unknown> => {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) return false;\n const prototype = Object.getPrototypeOf(value);\n return prototype === null || prototype === Object.prototype || Object.prototype.toString.call(value) === '[object Object]';\n};\n\n/* What a refused value actually was, so the sentence names it instead of saying \"object\" of an object. */\nconst described = (value: unknown): string => {\n if (Array.isArray(value)) return 'an array';\n if (typeof value !== 'object' || value === null) return `a ${typeof value}`;\n const tag = Object.prototype.toString.call(value).slice(8, -1);\n return /^[AEIOU]/.test(tag) ? `an ${tag}` : `a ${tag}`;\n};\n\nconst kindOf = (column: ColumnMeta): Kind => (isFlagColumn(column) ? 'boolean' : columnKind(column.type));\n\n/* One value in the language, or the sentence that says why it cannot stand for this column. */\nfunction written(name: string, kind: Kind, value: unknown): { text: string } | { error: string } {\n if (typeof value === 'number') {\n const text = String(value);\n if ((kind === 'number' || kind === 'other') && Number.isFinite(value) && NUMERAL.test(text)) return { text };\n return { error: `${name} cannot be compared with the number ${text}.` };\n }\n if (typeof value === 'boolean') {\n if (kind === 'boolean' || kind === 'other') return { text: String(value) };\n return { error: `${name} holds no yes or no, so it cannot be compared with ${value}.` };\n }\n if (typeof value === 'string') {\n if (kind === 'number') {\n if (NUMERAL.test(value)) return { text: value };\n return { error: `${name} holds numbers, so it cannot be compared with \"${value}\".` };\n }\n if (kind === 'boolean') return { error: `${name} holds yes or no: compare it with true or false, not \"${value}\".` };\n if (kind === 'date' && ISO_DAY.test(value)) return { text: value };\n return { text: `\"${value.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"')}\"` };\n }\n return { error: `${name} cannot be compared with ${value === undefined ? 'undefined' : (JSON.stringify(value) ?? typeof value)}.` };\n}\n\nfunction oneOf(name: string, kind: Kind, values: readonly unknown[], op: '=' | '!='): { text: string } | { error: string } {\n if (!values.length) return { error: `${name} is asked for one of no values: leave it out, or name at least one.` };\n const parts: string[] = [];\n for (const value of values) {\n const got = written(name, kind, value);\n if ('error' in got) return got;\n parts.push(`${name} ${op} ${got.text}`);\n }\n if (op === '!=') return { text: parts.join(' and ') };\n return { text: parts.length === 1 ? parts[0] : `(${parts.join(' or ')})` };\n}\n\nfunction condition(name: string, kind: Kind, value: unknown): { text: string } | { error: string } {\n if (value === null) return { text: `${name} is empty` };\n if (Array.isArray(value)) return oneOf(name, kind, value, '=');\n if (!plain(value)) return equal(name, kind, value);\n const parts: string[] = [];\n for (const [op, operand] of Object.entries(value)) {\n if (operand === undefined) continue;\n if (op === 'not') {\n const got =\n operand === null\n ? { text: `${name} is not empty` }\n : Array.isArray(operand)\n ? oneOf(name, kind, operand, '!=')\n : notEqual(name, kind, operand);\n if ('error' in got) return got;\n parts.push(got.text);\n } else if (Object.hasOwn(RANGE, op)) {\n if (kind === 'boolean') return { error: `${name} holds yes or no, which has no ${op}.` };\n const got = written(name, kind, operand);\n if ('error' in got) return got;\n parts.push(`${name} ${RANGE[op]} ${got.text}`);\n } else if (Object.hasOwn(MATCH, op)) {\n if (kind !== 'text' && kind !== 'other') return { error: `${name} does not hold text, so it has no ${op}.` };\n if (typeof operand !== 'string') return { error: `${name} ${op} takes text, not ${JSON.stringify(operand) ?? typeof operand}.` };\n parts.push(`${name} ${MATCH[op]} ${(written(name, 'text', operand) as { text: string }).text}`);\n } else {\n return { error: `${name} has no operator \"${op}\": the object form has ${WHERE_OPERATORS.join(', ')}.` };\n }\n }\n if (!parts.length)\n return { error: `${name} is given an object with no operator in it: the object form has ${WHERE_OPERATORS.join(', ')}.` };\n return { text: parts.join(' and ') };\n}\n\nfunction equal(name: string, kind: Kind, value: unknown): { text: string } | { error: string } {\n const got = written(name, kind, value);\n return 'error' in got ? got : { text: `${name} = ${got.text}` };\n}\n\nfunction notEqual(name: string, kind: Kind, value: unknown): { text: string } | { error: string } {\n const got = written(name, kind, value);\n return 'error' in got ? got : { text: `${name} != ${got.text}` };\n}\n\n/**\n * The query text an object condition means on this table, or the sentence that refuses it. A key whose value is\n * `undefined` asks nothing (JSON drops it on the way to the server, so the browser must too); every other key is\n * one condition, and the conditions are joined by `and`. A list of objects is each of them, joined by `and`: a\n * `<Scope>`'s condition and the one a block inside it adds, sent as they were written.\n */\nexport function compileWhere(where: unknown, table: Pick<TableMeta, 'name' | 'columns'>): { text: string } | { error: string } {\n if (where === undefined || where === null) return { text: '' };\n if (Array.isArray(where)) {\n const parts: string[] = [];\n for (const each of where) {\n if (!plain(each)) return { error: 'A where list holds objects of column names and values, one for each condition joined.' };\n const got = compileWhere(each, table);\n if ('error' in got) return got;\n // Every join inside one is an `and` too, and its `or` chains are already in brackets: no brackets needed here.\n if (got.text) parts.push(got.text);\n }\n return { text: parts.join(' and ') };\n }\n if (!plain(where)) return { error: `A where is an object of column names and values, not ${described(where)}.` };\n const parts: string[] = [];\n for (const [key, value] of Object.entries(where)) {\n if (value === undefined) continue;\n const column = table.columns.find((one) => one.name === key);\n if (!column || !COLUMN_NAME.test(key)) return { error: `${table.name} has no column \"${key}\".` };\n const got = condition(key, kindOf(column), value);\n if ('error' in got) return got;\n parts.push(got.text);\n }\n return { text: parts.join(' and ') };\n}\n","/** What sdk/blocks says, in the custom components room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '@mistriwork/kit/client/messages.js';\n\nexport const say = defineMessages({\n blockHasNo: '<{block}> has no \"{name}\". It takes {takes}.',\n blockRenamed: '<{block}> has \"{name}\", which is now \"{now}\".',\n blockNeeds: '<{block}> needs \"{name}\".',\n blockReadsUndeclared: '<{block}> reads \"{resource}\", which the page \"{label}\" does not read. It reads {reads}.',\n blockWhere: '<{block}> has a where it cannot ask: {problem}',\n blockNotAResource: '<{block}> reads \"{resource}\", which is not one of this App\\'s resources.',\n blockValue: '<{block}> has a \"{name}\" of \"{value}\". Use {allowed}.',\n blockTabs: '<Tabs> needs \"tabs\": a list of tabs, each with its own \"key\", a \"label\" and its \"content\".',\n blockTabParam: '<Tabs> keeps its tab in \"{param}\", which is not one of the page\\'s params.',\n blockMoveUndeclared: '<{block}> moves a card with \"{name}\", which the page \"{label}\" does not declare. It declares {declared}.',\n blockSplitKey: '<Split> picks a record by one key column, and \"{resource}\" has {count}.',\n blockSplitParam: '<Split> keeps its pick in \"{param}\", which is not one of the page\\'s params.',\n blockSplitDetail: 'Details',\n blockWholeNumber: 'a whole number of 1 or more',\n blockNothing: 'no commands or actions',\n blockNoPage: 'This record has no page.',\n});\n","/**\n * The platform's blocks as a free-form page's components (`@mistriwork/mistri/page`): `<Rows>`, `<Metric>`, `<Chart>`,\n * `<Breakdown>`, `<RecordCard>`, `<Timeline>`, `<Tree>`, `<Gantt>`, `<Board>`, `<Calendar>`, `<Gallery>`, `<Split>`,\n * `<Assistant>` and `<Tabs>`.\n *\n * Each is the component that draws the same thing on a dashboard, a record page or a list, handed the section it\n * would be handed there: no block draws anything of its own. Their props are the DSL's words for that section\n * (`metric('Open', 'ticket', { query, measure })` is `<Metric title=\"Open\" from=\"ticket\" query measure />`), so\n * there is one vocabulary, and each read goes through the same routes as the room's, under the reader's grants.\n *\n * This module is a part loaded when a page draws a block (page.tsx), and each block's own component is a part\n * loaded when that block is drawn: a page of metrics never fetches the Gantt.\n *\n * Each block's props are judged before it draws: a word it does not take, a value outside its words or a resource\n * the page does not read stands as the shared problem note in its place, saying which, marked as a part that could\n * not be drawn (an authoring mistake, which the browser suites fail on), while the rest of the page stays. What\n * throws while drawing stands behind the block's own boundary, as a dashboard section does.\n */\nimport { createElement, useContext, type ComponentProps, useEffect, useMemo, useRef, useState, type ReactNode } from 'react';\nimport { pageFor, state } from '@mistriwork/kit/client/core.js';\nimport { tableNamed, type TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { parsePresentation, PRESENTATION_KEYS } from '../../../shared/appViews.js';\nimport { BETTER, DASH_CHART_SHAPES } from '../../../shared/appModel.js';\nimport { FIGURE_FORMATS } from '@mistriwork/engine/shared/model.js';\nimport { TABLE_SIZINGS } from '@mistriwork/engine/shared/tableSizing.js';\nimport type { AppGanttList, AppSplitListDetail, AppTreeList } from '@mistriwork/engine/shared/listPresentations.js';\nimport { primaryKey } from '@mistriwork/engine/shared/schema.js';\nimport { ErrorBoundary } from '@mistriwork/kit/client/components/ErrorBoundary.js';\nimport { Problem } from '@mistriwork/kit/client/components/Notes.js';\nimport { onDemand } from '@mistriwork/kit/client/components/onDemand.js';\nimport { captureRecordSurfaceOwner } from '@mistriwork/kit/client/components/recordSurface.js';\nimport type { Section } from '@mistriwork/kit/client/components/dashboardModel.js';\nimport type { PageSections } from '../RecordPageBody.js';\nimport type { PageEntry } from '@mistriwork/kit/client/components/pageModel.js';\nimport { andQuery } from '@mistriwork/engine/shared/query.js';\nimport { compileWhere } from '@mistriwork/engine/shared/pageWhere.js';\nimport { scopedCondition, UiPageContext, UiScopeContext, type UiPageFrame, type UiScope } from './context.js';\nimport { say } from '../../copy/components/components/sdk/blocks.js';\nimport { useRows } from './hooks.js';\nimport { Value } from './kit.js';\n\nconst DashboardBlock = onDemand(() => import('../Dashboard.js'), 'DashboardBlock');\nconst RecordPageBody = onDemand(() => import('../RecordPageBody.js'), 'RecordPageBody');\nconst TreeList = onDemand(() => import('../TreeList.js'), 'TreeList');\nconst GanttList = onDemand(() => import('../GanttList.js'), 'GanttList');\nconst PresentedList = onDemand(() => import('./PresentedList.js'), 'PresentedList');\nconst SplitListDetail = onDemand(() => import('../SplitListDetail.js'), 'SplitListDetail');\nconst AssistantRoom = onDemand(() => import('../AssistantPanel.js'), 'AssistantRoom');\nconst TabStrip = onDemand(() => import('@mistriwork/kit/client/components/PageSections.js'), 'TabStrip');\n\nconst WIDTHS = ['full', 'half', 'third', 'two-thirds'] as const;\nconst CURVES = ['smooth', 'straight'] as const;\nconst noop = () => {};\n\ntype Props = Readonly<Record<string, unknown>>;\n\n/* Words a block once took, refused with the one that replaced them. */\nconst RENAMED: Readonly<Record<string, string>> = { resource: 'from' };\n\n/* Each prop a block takes is one of its DSL words; anything else is a typo the author should hear about. */\nfunction takes(block: string, props: Props, words: readonly string[]): void {\n for (const name of Object.keys(props)) {\n if (words.includes(name)) continue;\n if (Object.hasOwn(RENAMED, name) && words.includes(RENAMED[name]))\n throw new Error(say('blockRenamed', { block, name, now: RENAMED[name] }));\n throw new Error(say('blockHasNo', { block, name, takes: words.join(', ') }));\n }\n}\n\nfunction needs(block: string, props: Props, name: string): string {\n const value = props[name];\n if (typeof value !== 'string' || !value.trim()) throw new Error(say('blockNeeds', { block, name }));\n return value.trim();\n}\n\nfunction oneOf<T extends string>(block: string, props: Props, name: string, allowed: readonly T[]): T | undefined {\n const value = props[name];\n if (value === undefined) return undefined;\n if (!allowed.includes(value as T)) {\n throw new Error(say('blockValue', { block, name, value: String(value), allowed: allowed.map((each) => `\"${each}\"`).join(', ') }));\n }\n return value as T;\n}\n\n/* The words a section carries as they are: text, a number, a list of text. The server's parser judges their sense. */\nfunction carried(props: Props, names: readonly string[]): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const name of names) if (props[name] !== undefined) out[name] = props[name];\n return out;\n}\n\n/** The table a block reads: one of the page's own reads, named as the App names it. */\nfunction resourceOf(block: string, resource: unknown, page: UiPageFrame | null): TableMeta {\n if (typeof resource !== 'string' || !resource) throw new Error(say('blockNeeds', { block, name: 'from' }));\n if (page && !page.reads.includes(resource)) {\n throw new Error(\n say('blockReadsUndeclared', { block, resource, label: page.label, reads: page.reads.map((name) => `\"${name}\"`).join(', ') }),\n );\n }\n const table = state.schema ? (tableNamed(state.schema, resource) as TableMeta | undefined) : undefined;\n if (!table) throw new Error(say('blockNotAResource', { block, resource }));\n return table;\n}\n\n/* The resource a block reads: its own `from`, or the Scope's around it. */\nfunction fromOf(props: Props, scope: UiScope | null): unknown {\n return props.from ?? scope?.from;\n}\n\n/* A block's condition as the one query text a section carries: the Scope's (when it reads the Scope's resource), then\n the block's own `where` and `query`, each object compiled against the table's columns as the server compiles them. */\nfunction conditionOf(block: string, props: Props, scope: UiScope | null, table: TableMeta): string | undefined {\n const asked = scopedCondition(scope, fromOf(props, scope) as string, props.where, props.query as string | undefined);\n const compiled = compileWhere(asked.where, table);\n if ('error' in compiled) throw new Error(say('blockWhere', { block, problem: compiled.error }));\n const query = andQuery(asked.query, compiled.text);\n return query || undefined;\n}\n\n/* A block: its props judged against the page and Scope it stands in, then drawn by the platform's component behind a boundary. */\nfunction block<R extends object>(\n judge: (props: Props, page: UiPageFrame | null, scope: UiScope | null) => R,\n draw: (resolved: R) => ReactNode,\n) {\n return function Block(props: Props) {\n const page = useContext(UiPageContext);\n const scope = useContext(UiScopeContext);\n let resolved: R;\n try {\n resolved = judge(props, page, scope);\n } catch (error) {\n const text = (error as Error).message;\n console.error(text);\n return <Problem crashed text={text} />;\n }\n return <ErrorBoundary>{createElement(draw as (props: R) => ReactNode, resolved)}</ErrorBoundary>;\n };\n}\n\n/* A dashboard's section, drawn where the page places it. Memoized on its words, so a page's redraw is not a refetch. */\nfunction SectionBlock({ section }: { section: Section }) {\n const words = JSON.stringify(section);\n const held = useMemo(() => section, [words]); // eslint-disable-line react-hooks/exhaustive-deps\n return <DashboardBlock section={held} />;\n}\n\nconst METRIC = ['title', 'from', 'where', 'query', 'measure', 'compare', 'better', 'format', 'unit', 'target', 'width'];\nfunction metricSection(props: Props, page: UiPageFrame | null, scope: UiScope | null): { section: Section } {\n takes('Metric', props, METRIC);\n const table = resourceOf('Metric', fromOf(props, scope), page);\n const query = conditionOf('Metric', props, scope, table);\n const title = needs('Metric', props, 'title');\n oneOf('Metric', props, 'better', BETTER);\n oneOf('Metric', props, 'format', FIGURE_FORMATS);\n oneOf('Metric', props, 'width', WIDTHS);\n /* A goal read from data is the metric's three words again; its table, where it names one, is one the page reads. */\n const goal = props.target;\n let target: Section['target'];\n if (goal !== null && typeof goal === 'object') {\n const asked = goal as { from?: string; table?: string; query?: string; measure?: string };\n if (asked.table !== undefined) throw new Error(say('blockRenamed', { block: 'Metric', name: 'target.table', now: 'target.from' }));\n target = {\n table: asked.from === undefined ? table.id : resourceOf('Metric', asked.from, page).id,\n ...(asked.query === undefined ? {} : { query: asked.query }),\n measure: asked.measure ?? (props.measure as string | undefined) ?? 'count',\n };\n } else if (goal !== undefined) target = goal as number;\n return {\n section: {\n kind: 'metric',\n table: table.id,\n ...(query === undefined ? {} : { query }),\n ...carried(props, ['measure', 'compare', 'better', 'format', 'unit', 'width']),\n title,\n ...(target === undefined ? {} : { target }),\n } as Section,\n };\n}\n\n/* A chart's and a breakdown's figures are said as a metric's are: `format` and `unit` reach the dashboard's own sayer\n (dashboardModel's figureSayer), so a measure of seconds reads \"10h 2m\" on a bar, an axis and a tooltip. */\nconst CHART = [\n 'title',\n 'from',\n 'by',\n 'where',\n 'query',\n 'measure',\n 'shape',\n 'x',\n 'curve',\n 'total',\n 'target',\n 'limit',\n 'height',\n 'format',\n 'unit',\n 'width',\n];\nfunction chartSection(props: Props, page: UiPageFrame | null, scope: UiScope | null): { section: Section } {\n takes('Chart', props, CHART);\n const table = resourceOf('Chart', fromOf(props, scope), page);\n const query = conditionOf('Chart', props, scope, table);\n const title = needs('Chart', props, 'title');\n needs('Chart', props, 'by');\n oneOf('Chart', props, 'shape', DASH_CHART_SHAPES);\n oneOf('Chart', props, 'curve', CURVES);\n oneOf('Chart', props, 'format', FIGURE_FORMATS);\n oneOf('Chart', props, 'width', WIDTHS);\n return {\n section: {\n kind: 'chart',\n table: table.id,\n shape: 'line',\n ...(query === undefined ? {} : { query }),\n ...carried(props, ['by', 'measure', 'shape', 'x', 'curve', 'total', 'target', 'limit', 'height', 'format', 'unit', 'width']),\n title,\n } as Section,\n };\n}\n\nconst BREAKDOWN = ['title', 'from', 'by', 'where', 'query', 'measure', 'limit', 'format', 'unit', 'width'];\nfunction breakdownSection(props: Props, page: UiPageFrame | null, scope: UiScope | null): { section: Section } {\n takes('Breakdown', props, BREAKDOWN);\n const table = resourceOf('Breakdown', fromOf(props, scope), page);\n const query = conditionOf('Breakdown', props, scope, table);\n const title = needs('Breakdown', props, 'title');\n needs('Breakdown', props, 'by');\n oneOf('Breakdown', props, 'format', FIGURE_FORMATS);\n oneOf('Breakdown', props, 'width', WIDTHS);\n return {\n section: {\n kind: 'breakdown',\n table: table.id,\n ...(query === undefined ? {} : { query }),\n ...carried(props, ['by', 'measure', 'limit', 'format', 'unit', 'width']),\n title,\n } as Section,\n };\n}\n\nconst ROWS = ['title', 'from', 'where', 'query', 'show', 'sort', 'limit', 'sizing', 'width'];\nfunction rowsSection(props: Props, page: UiPageFrame | null, scope: UiScope | null): { section: Section } {\n takes('Rows', props, ROWS);\n const table = resourceOf('Rows', fromOf(props, scope), page);\n const query = conditionOf('Rows', props, scope, table);\n const title = needs('Rows', props, 'title');\n oneOf('Rows', props, 'sizing', TABLE_SIZINGS);\n oneOf('Rows', props, 'width', WIDTHS);\n const show = props.show as readonly string[] | undefined;\n return {\n section: {\n kind: 'rows',\n table: table.id,\n ...(query === undefined ? {} : { query }),\n ...carried(props, ['sort', 'limit', 'sizing', 'width']),\n ...(show ? { show: [...show] } : {}),\n title,\n } as Section,\n };\n}\n\ninterface RecordAsk {\n table: TableMeta;\n recordKey: Record<string, unknown>;\n show?: readonly string[];\n only?: string;\n}\n\nfunction recordAsk(blockName: string, props: Props, page: UiPageFrame | null, only?: string): RecordAsk {\n const table = resourceOf(blockName, props.from, page);\n const record = props.record;\n if (!record || typeof record !== 'object' || Array.isArray(record))\n throw new Error(say('blockNeeds', { block: blockName, name: 'record' }));\n return {\n table,\n recordKey: record as Record<string, unknown>,\n ...(props.show === undefined ? {} : { show: props.show as readonly string[] }),\n ...(only ? { only } : {}),\n };\n}\n\n/* A record's own page, drawn in the page: its fields (or `show`'s) under its name and verbs, or only its timeline. */\nfunction RecordBlock({ table, recordKey, show, only }: RecordAsk) {\n const keyText = JSON.stringify(recordKey);\n const fields = show?.join('\\u0000');\n const mounted = useRef(true);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n const owner = useMemo(() => captureRecordSurfaceOwner(() => mounted.current), [table.id, keyText]);\n const [pageId, setPageId] = useState<string | null>();\n useEffect(() => {\n let live = true;\n void (pageFor(table.id) as Promise<string | null>).then(\n (id) => live && setPageId(id ?? null),\n () => live && setPageId(null),\n );\n return () => {\n live = false;\n };\n }, [table.id]);\n const sections = useMemo(() => (show?.length ? ([{ kind: 'fields', paths: [...show] }] as PageSections) : undefined), [fields]); // eslint-disable-line react-hooks/exhaustive-deps\n if (pageId === null) return <p className=\"note\">{say('blockNoPage')}</p>;\n if (pageId === undefined) return null;\n return (\n <RecordPageBody\n key={keyText}\n owner={owner}\n tableId={table.id}\n recordKey={recordKey}\n pageId={pageId}\n close={noop}\n setPendingProbe={noop}\n onName={noop}\n onSettled={noop}\n {...(sections ? { sections } : {})}\n {...(only ? { only } : {})}\n />\n );\n}\n\n/* A tree and a Gantt chart are a list's presentations: their words are the presentation's, read by its own parser. */\ninterface Presented {\n table: TableMeta;\n spec: AppTreeList | AppGanttList;\n entry: { kind: 'table'; table: string; query: string };\n}\n\nfunction presented(blockName: string, kind: 'tree' | 'gantt', words: string[]) {\n return (props: Props, page: UiPageFrame | null, scope: UiScope | null): Presented => {\n takes(blockName, props, ['from', 'where', 'query', ...words]);\n const table = resourceOf(blockName, fromOf(props, scope), page);\n const spec = parsePresentation({ kind, ...carried(props, words) }, `<${blockName}>`) as AppTreeList | AppGanttList;\n return { table, spec, entry: { kind: 'table', table: table.id, query: conditionOf(blockName, props, scope, table) ?? '' } };\n };\n}\n\n/* Held on their words, so a page's redraw is not a refetch. */\nfunction TreeBlock({ table, spec, entry }: Presented) {\n const words = JSON.stringify([spec, entry]);\n const held = useMemo(() => ({ spec, entry }), [words]); // eslint-disable-line react-hooks/exhaustive-deps\n return <TreeList table={table} spec={held.spec as AppTreeList} entry={held.entry} />;\n}\n\nfunction GanttBlock({ table, spec, entry }: Presented) {\n const words = JSON.stringify([spec, entry]);\n const held = useMemo(() => ({ spec, entry }), [words]); // eslint-disable-line react-hooks/exhaustive-deps\n return <GanttList table={table} spec={held.spec as AppGanttList} entry={held.entry} />;\n}\n\n/* A board, a calendar and a gallery are list presentations too, but they read through the list's own room (the lanes'\n counts, the month, the cards), which PresentedList draws. Their words are the presentation's, and `where`, `query`,\n `sort` and `limit` ask the question as a `<Rows>` asks it; a gallery is the list's cards, led by their `image`. */\n\ntype PresentedAsk = ComponentProps<typeof PresentedList>;\n\nfunction listed(blockName: string, kind: 'board' | 'calendar' | 'cards', required: readonly string[]) {\n const words = PRESENTATION_KEYS[kind].filter((word) => word !== 'kind');\n return (props: Props, page: UiPageFrame | null, scope: UiScope | null): PresentedAsk => {\n takes(blockName, props, ['from', 'where', 'query', 'sort', 'limit', 'label', ...(kind === 'board' ? ['move'] : []), ...words]);\n /* A gallery's `image` is a column or the related file resource's `{ from, whose, sort }`: parsed as the cards' own. */\n for (const name of required)\n if (!(name === 'image' && props[name] !== null && typeof props[name] === 'object')) needs(blockName, props, name);\n const table = resourceOf(blockName, fromOf(props, scope), page);\n const spec = parsePresentation({ kind, ...carried(props, words) }, `<${blockName}>`);\n if (props.limit !== undefined && (!Number.isInteger(props.limit) || (props.limit as number) < 1))\n throw new Error(say('blockValue', { block: blockName, name: 'limit', value: String(props.limit), allowed: say('blockWholeNumber') }));\n return {\n table,\n spec,\n query: conditionOf(blockName, props, scope, table) ?? '',\n ...carried(props, ['sort', 'limit']),\n label: typeof props.label === 'string' ? props.label : blockName,\n moves: movesOf(blockName, props, page),\n };\n };\n}\n\n/* What a drop may run: the commands and fixed actions the page declared, or the ones `move` names out of them. */\nfunction movesOf(blockName: string, props: Props, page: UiPageFrame | null): readonly string[] {\n const declared = [...(page?.commands ?? []), ...(page?.actions ?? [])];\n const named = props.move as readonly string[] | undefined;\n if (named === undefined) return declared;\n for (const name of named) {\n if (!declared.includes(name)) {\n throw new Error(\n say('blockMoveUndeclared', {\n block: blockName,\n name,\n label: page?.label ?? '',\n declared: declared.length ? declared.map((each) => `\"${each}\"`).join(', ') : say('blockNothing'),\n }),\n );\n }\n }\n return named;\n}\n\nfunction PresentedBlock(ask: PresentedAsk) {\n return <PresentedList {...ask} />;\n}\n\n/* A split: the rows in a queue beside the picked record's own page, the pick kept in a page param when it names one. */\ninterface SplitAsk {\n table: TableMeta;\n spec: AppSplitListDetail & { row: NonNullable<AppSplitListDetail['row']> };\n query: string;\n sort?: string;\n param?: string;\n label: string;\n page: UiPageFrame | null;\n}\n\nfunction splitAsk(props: Props, page: UiPageFrame | null, scope: UiScope | null): SplitAsk {\n takes('Split', props, ['from', 'where', 'query', 'sort', 'param', 'label', 'detail', 'limit', 'row']);\n if (props.row === null || typeof props.row !== 'object') throw new Error(say('blockNeeds', { block: 'Split', name: 'row' }));\n const table = resourceOf('Split', fromOf(props, scope), page);\n const spec = parsePresentation({ kind: 'split', ...carried(props, ['detail', 'limit', 'row']) }, '<Split>') as SplitAsk['spec'];\n if (primaryKey(table).length !== 1)\n throw new Error(say('blockSplitKey', { resource: table.id, count: String(primaryKey(table).length) }));\n const param = props.param as string | undefined;\n if (param !== undefined && !page?.params.includes(param)) throw new Error(say('blockSplitParam', { param: String(param) }));\n return {\n table,\n spec,\n query: conditionOf('Split', props, scope, table) ?? '',\n ...carried(props, ['sort', 'param']),\n label: typeof props.label === 'string' ? props.label : 'Split',\n page,\n };\n}\n\nfunction SplitBlock({ table, spec, query, sort, param, label, page }: SplitAsk) {\n const [local, setLocal] = useState<string | undefined>();\n const [key] = primaryKey(table);\n const picked = param ? page?.get(param) : local;\n const pick = (value: string | undefined) => (param ? page?.set(param, value) : setLocal(value));\n const { primary, lines = [] } = spec.row;\n const rows = useRows(table.id, {\n query: query || undefined,\n sort,\n limit: spec.limit ?? 20,\n show: [primary, ...lines],\n keys: true,\n });\n const list = rows.data ?? [];\n const row = picked === undefined ? undefined : list.find((each) => String(each[key]) === picked);\n // A refused or failed read says so: an empty queue would tell a moderator there is nothing to do.\n const problem = rows.isError ? <Problem text={(rows.error as Error).message} retry={() => void rows.refetch()} /> : null;\n /* A refresh that fails keeps the rows it had, and the record open beside them, with the problem above: only a first\n read that never answered, or a refusal (the grant is gone), takes the list away. */\n const refused = [401, 403].includes((rows.error as { status?: number } | null)?.status ?? 0);\n if (problem && (rows.data === undefined || refused)) return problem;\n return (\n <>\n {problem}\n <SplitListDetail\n listLabel={label}\n detailLabel={say('blockSplitDetail')}\n detailTitle={row ? String(row[primary] ?? '') : say('blockSplitDetail')}\n selected={Boolean(row)}\n onCloseDetail={() => pick(undefined)}\n sentenceTitle\n list={\n <div className=\"queue queue-pick-list\">\n <ul className=\"queue-list\" aria-label={label}>\n {list.map((each) => {\n const id = String(each[key]);\n return (\n <li key={id} className=\"queue-row\">\n <button type=\"button\" className=\"queue-pick\" aria-current={id === picked ? 'true' : undefined} onClick={() => pick(id)}>\n <strong>\n <Value value={each[primary]} resource={table.id} column={primary} compact />\n </strong>\n {lines.map((line) => (\n <span key={line}>\n <Value value={each[line]} resource={table.id} column={line} compact />\n </span>\n ))}\n </button>\n </li>\n );\n })}\n </ul>\n </div>\n }\n detail={\n row ? <RecordBlock table={table} recordKey={{ [key]: row[key] }} {...(spec.detail ? { show: spec.detail } : {})} /> : undefined\n }\n />\n </>\n );\n}\n\ninterface TabSpec {\n key: string;\n label: ReactNode;\n content: ReactNode;\n}\n\ninterface TabsAsk {\n tabs: readonly TabSpec[];\n param?: string;\n label: string;\n page: UiPageFrame | null;\n}\n\nfunction tabsAsk(props: Props, page: UiPageFrame | null): TabsAsk {\n takes('Tabs', props, ['tabs', 'param', 'label']);\n const tabs = props.tabs as readonly TabSpec[] | undefined;\n if (\n !Array.isArray(tabs) ||\n !tabs.length ||\n tabs.some((tab) => !tab || typeof tab.key !== 'string' || !tab.key) ||\n new Set(tabs.map((tab) => tab.key)).size !== tabs.length\n ) {\n throw new Error(say('blockTabs'));\n }\n const param = props.param as string | undefined;\n if (param !== undefined && !page?.params.includes(param)) throw new Error(say('blockTabParam', { param: String(param) }));\n return { tabs, ...(param === undefined ? {} : { param }), label: typeof props.label === 'string' ? props.label : '', page };\n}\n\n/* Tabs, as a record page's are drawn: each panel drawn the first time it is opened, and kept in a page param if named. */\nfunction TabsBlock({ tabs, param, label, page }: TabsAsk) {\n const strip = tabs.map((tab) => ({ key: tab.key, token: tab.key, label: tab.label }));\n const entry = useMemo(() => ({ tab: param ? page?.get(param) : undefined }) as PageEntry, []); // eslint-disable-line react-hooks/exhaustive-deps\n return (\n <TabStrip\n tabs={strip}\n name={label}\n entry={entry}\n scoped={false}\n onTab={(token: string | undefined) => {\n if (param) page?.set(param, token);\n }}\n draw={(i: number) => tabs[i].content}\n />\n );\n}\n\nexport const Metric = block(metricSection, SectionBlock);\nexport const Chart = block(chartSection, SectionBlock);\nexport const Breakdown = block(breakdownSection, SectionBlock);\nexport const Rows = block(rowsSection, SectionBlock);\nexport const RecordCard = block((props, page) => {\n takes('RecordCard', props, ['from', 'record', 'show']);\n return recordAsk('RecordCard', props, page);\n}, RecordBlock);\nexport const Timeline = block((props, page) => {\n takes('Timeline', props, ['from', 'record']);\n return recordAsk('Timeline', props, page, 'timeline');\n}, RecordBlock);\nexport const Tree = block(presented('Tree', 'tree', ['parent', 'primary', 'lines']), TreeBlock);\nexport const Gantt = block(presented('Gantt', 'gantt', ['start', 'end', 'primary', 'by', 'progress']), GanttBlock);\nexport const Board = block(listed('Board', 'board', ['by']), PresentedBlock);\nexport const Calendar = block(listed('Calendar', 'calendar', ['date']), PresentedBlock);\nexport const Gallery = block(listed('Gallery', 'cards', ['image']), PresentedBlock);\nexport const Split = block(splitAsk, SplitBlock);\nexport const Assistant = block(\n (props) => {\n takes('Assistant', props, ['conversation']);\n return typeof props.conversation === 'string' ? { conversation: props.conversation } : {};\n },\n (ask: { conversation?: string }) => <AssistantRoom {...ask} />,\n);\nexport const Tabs = block(tabsAsk, TabsBlock);\n/* `<Steps>` (steps.tsx): a command's form over several steps, its stepper and the intake style's sheets loaded with\n it, so a page that draws none carries none. */\nexport const Steps = onDemand(() => import('./steps.js'), 'Steps', { quiet: true });\n"],"file":"blocks-CCFZikE-.js"}
|