@schema-engine/forms 0.0.0-stage → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +69 -2
- package/dist/actions/index.d.ts +3 -0
- package/dist/actions/index.js +50 -0
- package/dist/actions/index.js.map +7 -0
- package/dist/actions/plugins/auto-save.plugin.d.ts +39 -0
- package/dist/actions/plugins/auto-save.plugin.js +10 -0
- package/dist/actions/plugins/auto-save.plugin.js.map +7 -0
- package/dist/actions/plugins/form-reset.plugin.d.ts +23 -0
- package/dist/actions/plugins/form-reset.plugin.js +9 -0
- package/dist/actions/plugins/form-reset.plugin.js.map +7 -0
- package/dist/actions/plugins/form-submit.plugin.d.ts +31 -0
- package/dist/actions/plugins/form-submit.plugin.js +9 -0
- package/dist/actions/plugins/form-submit.plugin.js.map +7 -0
- package/dist/actions/plugins/form-submit.registration.d.ts +22 -0
- package/dist/actions/plugins/form-submit.registration.js +8 -0
- package/dist/actions/plugins/form-submit.registration.js.map +7 -0
- package/dist/actions/plugins/gtm.plugin.d.ts +30 -0
- package/dist/actions/plugins/gtm.plugin.js +8 -0
- package/dist/actions/plugins/gtm.plugin.js.map +7 -0
- package/dist/actions/plugins/index.d.ts +16 -0
- package/dist/actions/plugins/index.js +45 -0
- package/dist/actions/plugins/index.js.map +7 -0
- package/dist/actions/plugins/notification.plugin.d.ts +32 -0
- package/dist/actions/plugins/notification.plugin.js +9 -0
- package/dist/actions/plugins/notification.plugin.js.map +7 -0
- package/dist/actions/plugins/notification.registration.d.ts +22 -0
- package/dist/actions/plugins/notification.registration.js +8 -0
- package/dist/actions/plugins/notification.registration.js.map +7 -0
- package/dist/actions/plugins/registrations.d.ts +17 -0
- package/dist/actions/plugins/registrations.js +14 -0
- package/dist/actions/plugins/registrations.js.map +7 -0
- package/dist/actions/triggers.d.ts +42 -0
- package/dist/actions/triggers.js +6 -0
- package/dist/actions/triggers.js.map +7 -0
- package/dist/actions/types.d.ts +16 -0
- package/dist/actions/types.js +1 -0
- package/dist/actions/types.js.map +7 -0
- package/dist/agent-tool/index.d.ts +54 -0
- package/dist/agent-tool/index.js +128 -0
- package/dist/agent-tool/index.js.map +7 -0
- package/dist/browser/action-registrations.d.ts +46 -0
- package/dist/browser/action-registrations.js +19 -0
- package/dist/browser/action-registrations.js.map +7 -0
- package/dist/browser/index.d.ts +4 -0
- package/dist/browser/index.js +36 -0
- package/dist/browser/index.js.map +7 -0
- package/dist/browser/tools/auto-save-storage.d.ts +20 -0
- package/dist/browser/tools/auto-save-storage.js +12 -0
- package/dist/browser/tools/auto-save-storage.js.map +7 -0
- package/dist/browser/tools/gdpr-consent.d.ts +32 -0
- package/dist/browser/tools/gdpr-consent.js +11 -0
- package/dist/browser/tools/gdpr-consent.js.map +7 -0
- package/dist/browser/tools/gtm-tracker.d.ts +7 -0
- package/dist/browser/tools/gtm-tracker.js +7 -0
- package/dist/browser/tools/gtm-tracker.js.map +7 -0
- package/dist/builder/form-authoring.d.ts +159 -0
- package/dist/builder/form-authoring.js +1 -0
- package/dist/builder/form-authoring.js.map +7 -0
- package/dist/builder/form-values.d.ts +158 -0
- package/dist/builder/form-values.js +0 -0
- package/dist/builder/form-values.js.map +7 -0
- package/dist/builder/index.d.ts +5 -0
- package/dist/builder/index.js +2 -0
- package/dist/builder/index.js.map +7 -0
- package/dist/builder/types.utils.d.ts +137 -0
- package/dist/builder/types.utils.js +1 -0
- package/dist/builder/types.utils.js.map +7 -0
- package/dist/chunk-237BHPDH.js +88 -0
- package/dist/chunk-237BHPDH.js.map +7 -0
- package/dist/chunk-25PLQDKN.js +45 -0
- package/dist/chunk-25PLQDKN.js.map +7 -0
- package/dist/chunk-2PTM54FQ.js +51 -0
- package/dist/chunk-2PTM54FQ.js.map +7 -0
- package/dist/chunk-2VKEOE2L.js +907 -0
- package/dist/chunk-2VKEOE2L.js.map +7 -0
- package/dist/chunk-2XWISGGM.js +8 -0
- package/dist/chunk-2XWISGGM.js.map +7 -0
- package/dist/chunk-2YKQAVI2.js +8 -0
- package/dist/chunk-2YKQAVI2.js.map +7 -0
- package/dist/chunk-3B7CJOF6.js +18 -0
- package/dist/chunk-3B7CJOF6.js.map +7 -0
- package/dist/chunk-3YLRJVVN.js +17 -0
- package/dist/chunk-3YLRJVVN.js.map +7 -0
- package/dist/chunk-4CUGHU36.js +58 -0
- package/dist/chunk-4CUGHU36.js.map +7 -0
- package/dist/chunk-4FELFUCD.js +0 -0
- package/dist/chunk-4FELFUCD.js.map +7 -0
- package/dist/chunk-4XPLSYTK.js +82 -0
- package/dist/chunk-4XPLSYTK.js.map +7 -0
- package/dist/chunk-56CJ2UZ7.js +55 -0
- package/dist/chunk-56CJ2UZ7.js.map +7 -0
- package/dist/chunk-5QXT7YAJ.js +87 -0
- package/dist/chunk-5QXT7YAJ.js.map +7 -0
- package/dist/chunk-5Y6U3MR3.js +54 -0
- package/dist/chunk-5Y6U3MR3.js.map +7 -0
- package/dist/chunk-6BAJHAGL.js +29 -0
- package/dist/chunk-6BAJHAGL.js.map +7 -0
- package/dist/chunk-6FUGK5HQ.js +26 -0
- package/dist/chunk-6FUGK5HQ.js.map +7 -0
- package/dist/chunk-6IZYNHZ3.js +118 -0
- package/dist/chunk-6IZYNHZ3.js.map +7 -0
- package/dist/chunk-6NV2JDGI.js +8 -0
- package/dist/chunk-6NV2JDGI.js.map +7 -0
- package/dist/chunk-6R2MBQPL.js +19 -0
- package/dist/chunk-6R2MBQPL.js.map +7 -0
- package/dist/chunk-7EQJUI5N.js +40 -0
- package/dist/chunk-7EQJUI5N.js.map +7 -0
- package/dist/chunk-AUZ45XPE.js +27 -0
- package/dist/chunk-AUZ45XPE.js.map +7 -0
- package/dist/chunk-BIHEIJG3.js +0 -0
- package/dist/chunk-BIHEIJG3.js.map +7 -0
- package/dist/chunk-BKNWW4PK.js +0 -0
- package/dist/chunk-BKNWW4PK.js.map +7 -0
- package/dist/chunk-BLFLCSG3.js +71 -0
- package/dist/chunk-BLFLCSG3.js.map +7 -0
- package/dist/chunk-BYYGAGNH.js +0 -0
- package/dist/chunk-BYYGAGNH.js.map +7 -0
- package/dist/chunk-CAZPWBQ4.js +18 -0
- package/dist/chunk-CAZPWBQ4.js.map +7 -0
- package/dist/chunk-CMPOBBRV.js +10 -0
- package/dist/chunk-CMPOBBRV.js.map +7 -0
- package/dist/chunk-CRQWKC67.js +118 -0
- package/dist/chunk-CRQWKC67.js.map +7 -0
- package/dist/chunk-CRVXBWSY.js +70 -0
- package/dist/chunk-CRVXBWSY.js.map +7 -0
- package/dist/chunk-D6ZHV6AT.js +0 -0
- package/dist/chunk-D6ZHV6AT.js.map +7 -0
- package/dist/chunk-DVDKPY2A.js +12 -0
- package/dist/chunk-DVDKPY2A.js.map +7 -0
- package/dist/chunk-E4VONSLO.js +15 -0
- package/dist/chunk-E4VONSLO.js.map +7 -0
- package/dist/chunk-EEYGPPLU.js +185 -0
- package/dist/chunk-EEYGPPLU.js.map +7 -0
- package/dist/chunk-EI5TMJDC.js +56 -0
- package/dist/chunk-EI5TMJDC.js.map +7 -0
- package/dist/chunk-EQ5AIF3T.js +117 -0
- package/dist/chunk-EQ5AIF3T.js.map +7 -0
- package/dist/chunk-EZZHO6DQ.js +26 -0
- package/dist/chunk-EZZHO6DQ.js.map +7 -0
- package/dist/chunk-FUHLRG3M.js +130 -0
- package/dist/chunk-FUHLRG3M.js.map +7 -0
- package/dist/chunk-FVOL3ZOJ.js +101 -0
- package/dist/chunk-FVOL3ZOJ.js.map +7 -0
- package/dist/chunk-G33EUV7N.js +288 -0
- package/dist/chunk-G33EUV7N.js.map +7 -0
- package/dist/chunk-GH34XFCC.js +56 -0
- package/dist/chunk-GH34XFCC.js.map +7 -0
- package/dist/chunk-GKWRJ6H4.js +27 -0
- package/dist/chunk-GKWRJ6H4.js.map +7 -0
- package/dist/chunk-GRZU6F7Q.js +80 -0
- package/dist/chunk-GRZU6F7Q.js.map +7 -0
- package/dist/chunk-GT2LARKT.js +107 -0
- package/dist/chunk-GT2LARKT.js.map +7 -0
- package/dist/chunk-GY657L56.js +206 -0
- package/dist/chunk-GY657L56.js.map +7 -0
- package/dist/chunk-H4ABGAAG.js +60 -0
- package/dist/chunk-H4ABGAAG.js.map +7 -0
- package/dist/chunk-H63UHX42.js +93 -0
- package/dist/chunk-H63UHX42.js.map +7 -0
- package/dist/chunk-HEAKWS27.js +2730 -0
- package/dist/chunk-HEAKWS27.js.map +7 -0
- package/dist/chunk-HIS4MGIR.js +8 -0
- package/dist/chunk-HIS4MGIR.js.map +7 -0
- package/dist/chunk-HPPFSWIV.js +213 -0
- package/dist/chunk-HPPFSWIV.js.map +7 -0
- package/dist/chunk-J2FC5K4B.js +87 -0
- package/dist/chunk-J2FC5K4B.js.map +7 -0
- package/dist/chunk-J5BSFDVK.js +123 -0
- package/dist/chunk-J5BSFDVK.js.map +7 -0
- package/dist/chunk-J7GSNWXT.js +151 -0
- package/dist/chunk-J7GSNWXT.js.map +7 -0
- package/dist/chunk-K22S7IZR.js +12 -0
- package/dist/chunk-K22S7IZR.js.map +7 -0
- package/dist/chunk-K5TMXCMY.js +139 -0
- package/dist/chunk-K5TMXCMY.js.map +7 -0
- package/dist/chunk-KE53GN4Q.js +246 -0
- package/dist/chunk-KE53GN4Q.js.map +7 -0
- package/dist/chunk-KFQEDSYI.js +24 -0
- package/dist/chunk-KFQEDSYI.js.map +7 -0
- package/dist/chunk-KLATKWUA.js +116 -0
- package/dist/chunk-KLATKWUA.js.map +7 -0
- package/dist/chunk-KSKWSUOB.js +17 -0
- package/dist/chunk-KSKWSUOB.js.map +7 -0
- package/dist/chunk-LFWEJXWE.js +68 -0
- package/dist/chunk-LFWEJXWE.js.map +7 -0
- package/dist/chunk-LMWJAD3B.js +24 -0
- package/dist/chunk-LMWJAD3B.js.map +7 -0
- package/dist/chunk-MD23VADH.js +92 -0
- package/dist/chunk-MD23VADH.js.map +7 -0
- package/dist/chunk-MKMJT3XR.js +0 -0
- package/dist/chunk-MKMJT3XR.js.map +7 -0
- package/dist/chunk-NJTLBSTR.js +82 -0
- package/dist/chunk-NJTLBSTR.js.map +7 -0
- package/dist/chunk-NJXKMF67.js +182 -0
- package/dist/chunk-NJXKMF67.js.map +7 -0
- package/dist/chunk-OBQBIOGN.js +16 -0
- package/dist/chunk-OBQBIOGN.js.map +7 -0
- package/dist/chunk-OLYHNFKC.js +82 -0
- package/dist/chunk-OLYHNFKC.js.map +7 -0
- package/dist/chunk-OR2L7EKO.js +33 -0
- package/dist/chunk-OR2L7EKO.js.map +7 -0
- package/dist/chunk-OUF57UZ7.js +28 -0
- package/dist/chunk-OUF57UZ7.js.map +7 -0
- package/dist/chunk-PBMM2N77.js +56 -0
- package/dist/chunk-PBMM2N77.js.map +7 -0
- package/dist/chunk-PH3LWLYN.js +49 -0
- package/dist/chunk-PH3LWLYN.js.map +7 -0
- package/dist/chunk-PHNMDWSK.js +9 -0
- package/dist/chunk-PHNMDWSK.js.map +7 -0
- package/dist/chunk-PN5EH6DM.js +36 -0
- package/dist/chunk-PN5EH6DM.js.map +7 -0
- package/dist/chunk-POCAINUE.js +42 -0
- package/dist/chunk-POCAINUE.js.map +7 -0
- package/dist/chunk-PXWVKJGF.js +6 -0
- package/dist/chunk-PXWVKJGF.js.map +7 -0
- package/dist/chunk-Q5LEK7CI.js +64 -0
- package/dist/chunk-Q5LEK7CI.js.map +7 -0
- package/dist/chunk-QH7VW7IY.js +0 -0
- package/dist/chunk-QH7VW7IY.js.map +7 -0
- package/dist/chunk-QLGM2AZW.js +173 -0
- package/dist/chunk-QLGM2AZW.js.map +7 -0
- package/dist/chunk-QT3EYUL5.js +85 -0
- package/dist/chunk-QT3EYUL5.js.map +7 -0
- package/dist/chunk-QYHOFLRX.js +43 -0
- package/dist/chunk-QYHOFLRX.js.map +7 -0
- package/dist/chunk-R3MBVWVI.js +127 -0
- package/dist/chunk-R3MBVWVI.js.map +7 -0
- package/dist/chunk-R6V3LH7F.js +67 -0
- package/dist/chunk-R6V3LH7F.js.map +7 -0
- package/dist/chunk-RB22U6HI.js +64 -0
- package/dist/chunk-RB22U6HI.js.map +7 -0
- package/dist/chunk-RQRQYYTB.js +34 -0
- package/dist/chunk-RQRQYYTB.js.map +7 -0
- package/dist/chunk-S5D2QE4G.js +53 -0
- package/dist/chunk-S5D2QE4G.js.map +7 -0
- package/dist/chunk-S7I76ISM.js +245 -0
- package/dist/chunk-S7I76ISM.js.map +7 -0
- package/dist/chunk-TBDZOQ2C.js +66 -0
- package/dist/chunk-TBDZOQ2C.js.map +7 -0
- package/dist/chunk-U2X3IYSD.js +23 -0
- package/dist/chunk-U2X3IYSD.js.map +7 -0
- package/dist/chunk-UGL3KNOT.js +42 -0
- package/dist/chunk-UGL3KNOT.js.map +7 -0
- package/dist/chunk-UN3DARLG.js +35 -0
- package/dist/chunk-UN3DARLG.js.map +7 -0
- package/dist/chunk-VGGERKV2.js +7 -0
- package/dist/chunk-VGGERKV2.js.map +7 -0
- package/dist/chunk-VVFXYY65.js +0 -0
- package/dist/chunk-VVFXYY65.js.map +7 -0
- package/dist/chunk-WLDCYUN6.js +161 -0
- package/dist/chunk-WLDCYUN6.js.map +7 -0
- package/dist/chunk-WMDTQS36.js +0 -0
- package/dist/chunk-WMDTQS36.js.map +7 -0
- package/dist/chunk-WS7SLVXL.js +550 -0
- package/dist/chunk-WS7SLVXL.js.map +7 -0
- package/dist/chunk-WUTGZYP4.js +290 -0
- package/dist/chunk-WUTGZYP4.js.map +7 -0
- package/dist/chunk-XKN3WWK3.js +0 -0
- package/dist/chunk-XKN3WWK3.js.map +7 -0
- package/dist/chunk-XPQRHO5E.js +587 -0
- package/dist/chunk-XPQRHO5E.js.map +7 -0
- package/dist/chunk-XQ5VJ4QO.js +62 -0
- package/dist/chunk-XQ5VJ4QO.js.map +7 -0
- package/dist/chunk-XQVKX47O.js +174 -0
- package/dist/chunk-XQVKX47O.js.map +7 -0
- package/dist/chunk-Y5CNB57V.js +22 -0
- package/dist/chunk-Y5CNB57V.js.map +7 -0
- package/dist/chunk-YDGH7DTL.js +18 -0
- package/dist/chunk-YDGH7DTL.js.map +7 -0
- package/dist/chunk-YIFUBPJ3.js +0 -0
- package/dist/chunk-YIFUBPJ3.js.map +7 -0
- package/dist/chunk-YUUDXRBW.js +212 -0
- package/dist/chunk-YUUDXRBW.js.map +7 -0
- package/dist/chunk-Z6DQLJS2.js +23 -0
- package/dist/chunk-Z6DQLJS2.js.map +7 -0
- package/dist/chunk-ZDEZ2FOC.js +81 -0
- package/dist/chunk-ZDEZ2FOC.js.map +7 -0
- package/dist/chunk-ZUYSGCEH.js +65 -0
- package/dist/chunk-ZUYSGCEH.js.map +7 -0
- package/dist/chunk-ZYP3MIH3.js +115 -0
- package/dist/chunk-ZYP3MIH3.js.map +7 -0
- package/dist/constraints/constraint-evaluator.d.ts +57 -0
- package/dist/constraints/constraint-evaluator.js +17 -0
- package/dist/constraints/constraint-evaluator.js.map +7 -0
- package/dist/constraints/index.d.ts +1 -0
- package/dist/constraints/index.js +17 -0
- package/dist/constraints/index.js.map +7 -0
- package/dist/csrf/index.d.ts +43 -0
- package/dist/csrf/index.js +43 -0
- package/dist/csrf/index.js.map +7 -0
- package/dist/engine/build-form-engine.d.ts +27 -0
- package/dist/engine/build-form-engine.js +58 -0
- package/dist/engine/build-form-engine.js.map +7 -0
- package/dist/engine/component-type.d.ts +19 -0
- package/dist/engine/component-type.js +6 -0
- package/dist/engine/component-type.js.map +7 -0
- package/dist/engine/create-form-engine.d.ts +100 -0
- package/dist/engine/create-form-engine.js +59 -0
- package/dist/engine/create-form-engine.js.map +7 -0
- package/dist/engine/form-action-context.d.ts +70 -0
- package/dist/engine/form-action-context.js +10 -0
- package/dist/engine/form-action-context.js.map +7 -0
- package/dist/engine/form-engine.d.ts +236 -0
- package/dist/engine/form-engine.js +61 -0
- package/dist/engine/form-engine.js.map +7 -0
- package/dist/engine/index.d.ts +12 -0
- package/dist/engine/index.js +124 -0
- package/dist/engine/index.js.map +7 -0
- package/dist/engine/schema-artifacts.d.ts +87 -0
- package/dist/engine/schema-artifacts.js +14 -0
- package/dist/engine/schema-artifacts.js.map +7 -0
- package/dist/engine/schema-metadata-catalog.d.ts +41 -0
- package/dist/engine/schema-metadata-catalog.js +6 -0
- package/dist/engine/schema-metadata-catalog.js.map +7 -0
- package/dist/engine/step-machine.d.ts +59 -0
- package/dist/engine/step-machine.js +32 -0
- package/dist/engine/step-machine.js.map +7 -0
- package/dist/engine/submission-schema.d.ts +53 -0
- package/dist/engine/submission-schema.js +22 -0
- package/dist/engine/submission-schema.js.map +7 -0
- package/dist/engine/value-validation.d.ts +237 -0
- package/dist/engine/value-validation.js +39 -0
- package/dist/engine/value-validation.js.map +7 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.js +283 -0
- package/dist/index.js.map +7 -0
- package/dist/lib/authoring-catalog.d.ts +5 -0
- package/dist/lib/authoring-catalog.js +11 -0
- package/dist/lib/authoring-catalog.js.map +7 -0
- package/dist/lib/container-kind-of.d.ts +5 -0
- package/dist/lib/container-kind-of.js +6 -0
- package/dist/lib/container-kind-of.js.map +7 -0
- package/dist/lib/debounce.d.ts +19 -0
- package/dist/lib/debounce.js +6 -0
- package/dist/lib/debounce.js.map +7 -0
- package/dist/lib/deep-readonly.d.ts +12 -0
- package/dist/lib/deep-readonly.js +0 -0
- package/dist/lib/deep-readonly.js.map +7 -0
- package/dist/lib/element-children.d.ts +35 -0
- package/dist/lib/element-children.js +16 -0
- package/dist/lib/element-children.js.map +7 -0
- package/dist/lib/exported-action-envelope.d.ts +11 -0
- package/dist/lib/exported-action-envelope.js +7 -0
- package/dist/lib/exported-action-envelope.js.map +7 -0
- package/dist/lib/exported-rules.d.ts +14 -0
- package/dist/lib/exported-rules.js +6 -0
- package/dist/lib/exported-rules.js.map +7 -0
- package/dist/lib/field-ref.d.ts +13 -0
- package/dist/lib/field-ref.js +6 -0
- package/dist/lib/field-ref.js.map +7 -0
- package/dist/lib/field-scope.d.ts +121 -0
- package/dist/lib/field-scope.js +41 -0
- package/dist/lib/field-scope.js.map +7 -0
- package/dist/lib/form-fetch.d.ts +36 -0
- package/dist/lib/form-fetch.js +10 -0
- package/dist/lib/form-fetch.js.map +7 -0
- package/dist/lib/form-view.d.ts +33 -0
- package/dist/lib/form-view.js +12 -0
- package/dist/lib/form-view.js.map +7 -0
- package/dist/lib/frozen-copy.d.ts +9 -0
- package/dist/lib/frozen-copy.js +7 -0
- package/dist/lib/frozen-copy.js.map +7 -0
- package/dist/lib/is-plain-object.d.ts +2 -0
- package/dist/lib/is-plain-object.js +6 -0
- package/dist/lib/is-plain-object.js.map +7 -0
- package/dist/lib/logger.d.ts +2 -0
- package/dist/lib/logger.js +6 -0
- package/dist/lib/logger.js.map +7 -0
- package/dist/lib/normalized-form-config.d.ts +106 -0
- package/dist/lib/normalized-form-config.js +19 -0
- package/dist/lib/normalized-form-config.js.map +7 -0
- package/dist/lib/omit-paths.d.ts +11 -0
- package/dist/lib/omit-paths.js +7 -0
- package/dist/lib/omit-paths.js.map +7 -0
- package/dist/lib/path-values.d.ts +47 -0
- package/dist/lib/path-values.js +22 -0
- package/dist/lib/path-values.js.map +7 -0
- package/dist/lib/renderer-data-attributes.d.ts +10 -0
- package/dist/lib/renderer-data-attributes.js +6 -0
- package/dist/lib/renderer-data-attributes.js.map +7 -0
- package/dist/lib/reserved-path-keys.d.ts +10 -0
- package/dist/lib/reserved-path-keys.js +10 -0
- package/dist/lib/reserved-path-keys.js.map +7 -0
- package/dist/lib/resolve-appearance.d.ts +48 -0
- package/dist/lib/resolve-appearance.js +10 -0
- package/dist/lib/resolve-appearance.js.map +7 -0
- package/dist/lib/standard-json-schema.d.ts +27 -0
- package/dist/lib/standard-json-schema.js +8 -0
- package/dist/lib/standard-json-schema.js.map +7 -0
- package/dist/lib/standard-schema.d.ts +19 -0
- package/dist/lib/standard-schema.js +8 -0
- package/dist/lib/standard-schema.js.map +7 -0
- package/dist/lib/submission-shape.d.ts +60 -0
- package/dist/lib/submission-shape.js +14 -0
- package/dist/lib/submission-shape.js.map +7 -0
- package/dist/lib/validate-form/grid-checks.d.ts +57 -0
- package/dist/lib/validate-form/grid-checks.js +16 -0
- package/dist/lib/validate-form/grid-checks.js.map +7 -0
- package/dist/lib/validate-form/issues.d.ts +43 -0
- package/dist/lib/validate-form/issues.js +13 -0
- package/dist/lib/validate-form/issues.js.map +7 -0
- package/dist/lib/validate-form/options.d.ts +22 -0
- package/dist/lib/validate-form/options.js +0 -0
- package/dist/lib/validate-form/options.js.map +7 -0
- package/dist/lib/validate-form/parse-elements.d.ts +23 -0
- package/dist/lib/validate-form/parse-elements.js +21 -0
- package/dist/lib/validate-form/parse-elements.js.map +7 -0
- package/dist/lib/validate-form/parse-owner-actions.d.ts +14 -0
- package/dist/lib/validate-form/parse-owner-actions.js +10 -0
- package/dist/lib/validate-form/parse-owner-actions.js.map +7 -0
- package/dist/lib/validate-form/parse-view.d.ts +11 -0
- package/dist/lib/validate-form/parse-view.js +11 -0
- package/dist/lib/validate-form/parse-view.js.map +7 -0
- package/dist/lib/validate-form/schema-issues.d.ts +16 -0
- package/dist/lib/validate-form/schema-issues.js +8 -0
- package/dist/lib/validate-form/schema-issues.js.map +7 -0
- package/dist/lib/validate-form/step-checks.d.ts +18 -0
- package/dist/lib/validate-form/step-checks.js +15 -0
- package/dist/lib/validate-form/step-checks.js.map +7 -0
- package/dist/lib/validate-form/validation-error.d.ts +26 -0
- package/dist/lib/validate-form/validation-error.js +8 -0
- package/dist/lib/validate-form/validation-error.js.map +7 -0
- package/dist/lib/validate-form.d.ts +34 -0
- package/dist/lib/validate-form.js +62 -0
- package/dist/lib/validate-form.js.map +7 -0
- package/dist/lib/zod-json-schema.d.ts +33 -0
- package/dist/lib/zod-json-schema.js +10 -0
- package/dist/lib/zod-json-schema.js.map +7 -0
- package/dist/recipes/built-in-specs.d.ts +1832 -0
- package/dist/recipes/built-in-specs.js +28 -0
- package/dist/recipes/built-in-specs.js.map +7 -0
- package/dist/recipes/built-in.d.ts +2 -0
- package/dist/recipes/built-in.js +49 -0
- package/dist/recipes/built-in.js.map +7 -0
- package/dist/recipes/define-form-recipe.d.ts +10 -0
- package/dist/recipes/define-form-recipe.js +6 -0
- package/dist/recipes/define-form-recipe.js.map +7 -0
- package/dist/recipes/define-recipe-spec.d.ts +13 -0
- package/dist/recipes/define-recipe-spec.js +8 -0
- package/dist/recipes/define-recipe-spec.js.map +7 -0
- package/dist/recipes/index.d.ts +6 -0
- package/dist/recipes/index.js +43 -0
- package/dist/recipes/index.js.map +7 -0
- package/dist/recipes/protocol.d.ts +24 -0
- package/dist/recipes/protocol.js +11 -0
- package/dist/recipes/protocol.js.map +7 -0
- package/dist/recipes/slot-schemas.d.ts +128 -0
- package/dist/recipes/slot-schemas.js +24 -0
- package/dist/recipes/slot-schemas.js.map +7 -0
- package/dist/recipes/types.d.ts +55 -0
- package/dist/recipes/types.js +1 -0
- package/dist/recipes/types.js.map +7 -0
- package/dist/recipes/view-model.d.ts +93 -0
- package/dist/recipes/view-model.js +29 -0
- package/dist/recipes/view-model.js.map +7 -0
- package/dist/registries/index.d.ts +8 -0
- package/dist/registries/index.js +0 -0
- package/dist/registries/index.js.map +7 -0
- package/dist/runtime/create-form-runtime.d.ts +43 -0
- package/dist/runtime/create-form-runtime.js +41 -0
- package/dist/runtime/create-form-runtime.js.map +7 -0
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/index.js +44 -0
- package/dist/runtime/index.js.map +7 -0
- package/dist/runtime/submission-lifecycle.d.ts +65 -0
- package/dist/runtime/submission-lifecycle.js +6 -0
- package/dist/runtime/submission-lifecycle.js.map +7 -0
- package/dist/runtime/types.d.ts +172 -0
- package/dist/runtime/types.js +6 -0
- package/dist/runtime/types.js.map +7 -0
- package/dist/schemas/base-field.d.ts +450 -0
- package/dist/schemas/base-field.js +36 -0
- package/dist/schemas/base-field.js.map +7 -0
- package/dist/schemas/field-config.d.ts +36 -0
- package/dist/schemas/field-config.js +1 -0
- package/dist/schemas/field-config.js.map +7 -0
- package/dist/schemas/form-config-shape.d.ts +763 -0
- package/dist/schemas/form-config-shape.js +35 -0
- package/dist/schemas/form-config-shape.js.map +7 -0
- package/dist/schemas/form-config.d.ts +1288 -0
- package/dist/schemas/form-config.js +41 -0
- package/dist/schemas/form-config.js.map +7 -0
- package/dist/schemas/html-attributes.d.ts +12 -0
- package/dist/schemas/html-attributes.js +12 -0
- package/dist/schemas/html-attributes.js.map +7 -0
- package/dist/schemas/index.d.ts +5 -0
- package/dist/schemas/index.js +165 -0
- package/dist/schemas/index.js.map +7 -0
- package/dist/schemas/validation/async/cache.d.ts +39 -0
- package/dist/schemas/validation/async/cache.js +6 -0
- package/dist/schemas/validation/async/cache.js.map +7 -0
- package/dist/schemas/validation/async/handler.d.ts +21 -0
- package/dist/schemas/validation/async/handler.js +11 -0
- package/dist/schemas/validation/async/handler.js.map +7 -0
- package/dist/schemas/validation/async/index.d.ts +8 -0
- package/dist/schemas/validation/async/index.js +14 -0
- package/dist/schemas/validation/async/index.js.map +7 -0
- package/dist/schemas/validation/defaults.d.ts +6 -0
- package/dist/schemas/validation/defaults.js +12 -0
- package/dist/schemas/validation/defaults.js.map +7 -0
- package/dist/schemas/validation/dependencies.d.ts +52 -0
- package/dist/schemas/validation/dependencies.js +17 -0
- package/dist/schemas/validation/dependencies.js.map +7 -0
- package/dist/schemas/validation/empty.d.ts +1 -0
- package/dist/schemas/validation/empty.js +6 -0
- package/dist/schemas/validation/empty.js.map +7 -0
- package/dist/schemas/validation/errors.d.ts +44 -0
- package/dist/schemas/validation/errors.js +12 -0
- package/dist/schemas/validation/errors.js.map +7 -0
- package/dist/schemas/validation/index.d.ts +9 -0
- package/dist/schemas/validation/index.js +130 -0
- package/dist/schemas/validation/index.js.map +7 -0
- package/dist/schemas/validation/presets.d.ts +66 -0
- package/dist/schemas/validation/presets.js +6 -0
- package/dist/schemas/validation/presets.js.map +7 -0
- package/dist/schemas/validation/relations.d.ts +12 -0
- package/dist/schemas/validation/relations.js +8 -0
- package/dist/schemas/validation/relations.js.map +7 -0
- package/dist/schemas/validation/types.d.ts +817 -0
- package/dist/schemas/validation/types.js +64 -0
- package/dist/schemas/validation/types.js.map +7 -0
- package/dist/schemas/validation/utils.d.ts +76 -0
- package/dist/schemas/validation/utils.js +24 -0
- package/dist/schemas/validation/utils.js.map +7 -0
- package/dist/schemas/validation/validation-registry.d.ts +124 -0
- package/dist/schemas/validation/validation-registry.js +27 -0
- package/dist/schemas/validation/validation-registry.js.map +7 -0
- package/dist/server-errors/from-json-api-errors.d.ts +13 -0
- package/dist/server-errors/from-json-api-errors.js +10 -0
- package/dist/server-errors/from-json-api-errors.js.map +7 -0
- package/dist/server-errors/from-problem-details.d.ts +15 -0
- package/dist/server-errors/from-problem-details.js +10 -0
- package/dist/server-errors/from-problem-details.js.map +7 -0
- package/dist/server-errors/index.d.ts +8 -0
- package/dist/server-errors/index.js +17 -0
- package/dist/server-errors/index.js.map +7 -0
- package/dist/server-errors/shared.d.ts +34 -0
- package/dist/server-errors/shared.js +23 -0
- package/dist/server-errors/shared.js.map +7 -0
- package/dist/state-container/create-form-state-container.d.ts +17 -0
- package/dist/state-container/create-form-state-container.js +31 -0
- package/dist/state-container/create-form-state-container.js.map +7 -0
- package/dist/state-container/dirty.d.ts +11 -0
- package/dist/state-container/dirty.js +9 -0
- package/dist/state-container/dirty.js.map +7 -0
- package/dist/state-container/field-array.d.ts +41 -0
- package/dist/state-container/field-array.js +8 -0
- package/dist/state-container/field-array.js.map +7 -0
- package/dist/state-container/hydration.d.ts +21 -0
- package/dist/state-container/hydration.js +11 -0
- package/dist/state-container/hydration.js.map +7 -0
- package/dist/state-container/index.d.ts +16 -0
- package/dist/state-container/index.js +51 -0
- package/dist/state-container/index.js.map +7 -0
- package/dist/state-container/issue-text.d.ts +11 -0
- package/dist/state-container/issue-text.js +6 -0
- package/dist/state-container/issue-text.js.map +7 -0
- package/dist/state-container/row-ids.d.ts +34 -0
- package/dist/state-container/row-ids.js +19 -0
- package/dist/state-container/row-ids.js.map +7 -0
- package/dist/state-container/selectors.d.ts +33 -0
- package/dist/state-container/selectors.js +22 -0
- package/dist/state-container/selectors.js.map +7 -0
- package/dist/state-container/stale-results.d.ts +28 -0
- package/dist/state-container/stale-results.js +9 -0
- package/dist/state-container/stale-results.js.map +7 -0
- package/dist/state-container/state-tree.d.ts +56 -0
- package/dist/state-container/state-tree.js +33 -0
- package/dist/state-container/state-tree.js.map +7 -0
- package/dist/state-container/submission.d.ts +45 -0
- package/dist/state-container/submission.js +26 -0
- package/dist/state-container/submission.js.map +7 -0
- package/dist/state-container/types.d.ts +404 -0
- package/dist/state-container/types.js +6 -0
- package/dist/state-container/types.js.map +7 -0
- package/dist/state-container/value-tree.d.ts +56 -0
- package/dist/state-container/value-tree.js +34 -0
- package/dist/state-container/value-tree.js.map +7 -0
- package/dist/testing/form-state-container-conformance.d.ts +51 -0
- package/dist/testing/form-state-container-conformance.js +43 -0
- package/dist/testing/form-state-container-conformance.js.map +7 -0
- package/dist/testing/index.d.ts +7 -0
- package/dist/testing/index.js +35 -0
- package/dist/testing/index.js.map +7 -0
- package/dist/types/actions.d.ts +75 -0
- package/dist/types/actions.js +1 -0
- package/dist/types/actions.js.map +7 -0
- package/dist/types/categories.d.ts +21 -0
- package/dist/types/categories.js +8 -0
- package/dist/types/categories.js.map +7 -0
- package/dist/types/define-element.d.ts +73 -0
- package/dist/types/define-element.js +8 -0
- package/dist/types/define-element.js.map +7 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.js +17 -0
- package/dist/types/index.js.map +7 -0
- package/dist/types/metadata.d.ts +14 -0
- package/dist/types/metadata.js +1 -0
- package/dist/types/metadata.js.map +7 -0
- package/dist/types/registration.d.ts +142 -0
- package/dist/types/registration.js +1 -0
- package/dist/types/registration.js.map +7 -0
- package/package.json +119 -3
- package/skill/SKILL.md +79 -0
- package/skill/reference/forms-actions.md +51 -0
- package/skill/reference/forms-submission.md +44 -0
- package/skill/reference/forms-validation.md +91 -0
- package/skill/reference/forms.md +179 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/state-container/create-form-state-container.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n\tcollectStepFieldPaths,\n\thasParticipationRules,\n\tisPathExcluded,\n\tplanFormValidation,\n\tresolveParticipation,\n\ttype Participation,\n\trunValidationPlan,\n\ttype ValidationIssue,\n} from '@/engine/value-validation';\nimport { createDebounceScope } from '@/lib/debounce';\nimport { resolveFieldRef } from '@/lib/field-ref';\nimport { logger } from '@/lib/logger';\nimport { frozenCopy } from '@/lib/frozen-copy';\nimport { getValueAtPath } from '@/lib/path-values';\nimport { isReservedPathKey } from '@/lib/reserved-path-keys';\nimport {\n\tbuildDependencyIndex,\n\tshouldSurfaceDependentError,\n\ttype DependencyIndex,\n} from '@/schemas/validation/dependencies';\nimport { dirtyTree } from './dirty';\nimport { readHydration } from './hydration';\nimport type { FieldArrayCommands } from './field-array';\nimport { anchorOf, flatIds, idsAt, replaceIdsAt, resolveAnchor, syncIds, type IdTree, type RowNode } from './row-ids';\nimport { submittedTree, submittedValues, toFormPath, type SubmissionRecord } from './submission';\nimport { createRunTracker } from './stale-results';\nimport { buildSubmissionShape } from '@/lib/submission-shape';\nimport {\n\tclearAround,\n\tclearAt,\n\tclearSelfAt,\n\tconformAt,\n\tcoveredAt,\n\tentries,\n\tfromEntries,\n\tmarkAt,\n\tnodeAt,\n\treorderAt,\n\tselfAt,\n\tsetSelfAt,\n\tstable,\n\ttype IsArrayAt,\n\ttype Tree,\n} from './state-tree';\nimport {\n\tFORM_ROOT,\n\ttype FormStateContainer,\n\ttype FormStateContainerOptions,\n\ttype FormStateError,\n\ttype FormStateErrorInput,\n\ttype FormStateErrorsInput,\n\ttype FormStateIssue,\n\ttype FormStateSnapshot,\n\ttype FormSubmitResult,\n\ttype FormValidateResult,\n\ttype NativeValidity,\n} from './types';\nimport {\n\tchangedPaths,\n\tcreateMap,\n\tisStructural,\n\tisWithin,\n\treconcile,\n\tsetIn,\n\tstabilize,\n\ttoInternal,\n\ttoInternalRecord,\n\ttoPlain,\n\ttoPlainMap,\n\ttype NullMap,\n} from './value-tree';\n\n/** The issues of one path in one source. */\ntype Issues = readonly FormStateIssue[];\n\n/**\n * What the container's own validation recorded for one path.\n *\n * @remarks Nothing is stored for a path that has no errors or warnings.\n */\ninterface Finding {\n\treadonly errors: Issues;\n\treadonly warnings: Issues;\n}\n\n/** What a rule of a path read when a server error was applied, so an edit of it clears the error. */\ninterface Dependency {\n\treadonly reference: string;\n\treadonly value: unknown;\n}\n\n/** A server error: its issues, and the values its path's rules read when it was applied. */\ninterface ServerEntry {\n\treadonly issues: Issues;\n\treadonly dependencies: readonly Dependency[];\n}\n\n/** A native fact and the value it describes; it is dropped once the value at its path is another. */\ninterface NativeFact {\n\treadonly validity: NativeValidity;\n\treadonly value: unknown;\n}\n\n/**\n * Everything the container holds. Replaced as a whole by every command; no part is mutated.\n *\n * @remarks\n * Field state is held in the shape of the values (see `state-tree.ts`), so a row's state is the row's\n * element of each array and moves with it. `validation` is what the container's own checks recorded,\n * `server` what a host set, `native` what the controls reported with their input. `failed` marks the\n * paths whose check failed and `validated` those a recorded check decided, `''` for the whole form.\n * `validating` marks the paths a check is running for. `excluded` lists the paths that take no part.\n */\ninterface State {\n\treadonly values: NullMap;\n\treadonly defaults: NullMap;\n\treadonly validation: Tree<Finding>;\n\treadonly server: Tree<ServerEntry>;\n\treadonly native: Tree<NativeFact>;\n\treadonly touched: Tree<true>;\n\treadonly failed: Tree<true>;\n\treadonly validated: Tree<true>;\n\treadonly validating: Tree<true>;\n\treadonly dirty: Tree<true>;\n\treadonly ids: IdTree | undefined;\n\treadonly excluded: readonly string[];\n\t/** What the constraints say, in order, as {@link resolveParticipation} resolved it; the same object while it is unchanged. */\n\treadonly participation: Participation;\n\treadonly exclusionVersion: number;\n\t/** Resets so far. */\n\treadonly generation: number;\n}\n\n/** A row while an operation rebuilds an array: where it was, and what it is now. */\ninterface RowEntry {\n\treadonly from?: number;\n\treadonly value: unknown;\n\treadonly node: RowNode;\n}\n\n/** What a rule check found for one path. */\ninterface PathFindings {\n\treadonly errors: FormStateIssue[];\n\treadonly warnings: FormStateIssue[];\n}\n\nconst NO_ISSUES: Issues = Object.freeze([]);\nconst NO_PAYLOAD: Readonly<Record<string, unknown>> = Object.freeze({});\nconst readAt = (root: NullMap, path: string): unknown => getValueAtPath(root, path);\nconst isRow = (index: number, length: number): boolean => Number.isInteger(index) && index >= 0 && index < length;\nconst asRows = (value: unknown): unknown[] => (Array.isArray(value) ? value : [value]);\nconst arrayIn =\n\t(values: NullMap): IsArrayAt =>\n\t(path) =>\n\t\tArray.isArray(readAt(values, path));\n\ninterface IssueParts {\n\treadonly ruleId?: string;\n\treadonly params?: Readonly<Record<string, unknown>>;\n\treadonly message?: string;\n}\n\nconst issue = (type: string, source: FormStateIssue['source'], parts: IssueParts = {}): FormStateIssue =>\n\tObject.freeze({\n\t\ttype,\n\t\tsource,\n\t\t...(parts.ruleId === undefined ? {} : { ruleId: parts.ruleId }),\n\t\t...(parts.params === undefined ? {} : { params: parts.params }),\n\t\t...(parts.message === undefined ? {} : { message: parts.message }),\n\t});\n\nconst ruleIssue = (found: ValidationIssue): FormStateIssue =>\n\tissue(found.type, 'validation', { ruleId: found.ruleId, params: found.params, message: found.message });\n\nconst nativeIssue = (validity: NativeValidity): FormStateIssue =>\n\tissue(validity.type, 'native', { params: validity.params, message: validity.message });\n\nconst sameParams = (a: unknown, b: unknown): boolean => Object.is(a, b) || JSON.stringify(a) === JSON.stringify(b);\n\nconst sameIssue = (a: FormStateIssue, b: FormStateIssue): boolean =>\n\ta.type === b.type &&\n\ta.source === b.source &&\n\ta.ruleId === b.ruleId &&\n\ta.message === b.message &&\n\tsameParams(a.params, b.params);\n\nconst sameIssues = (a: Issues, b: Issues): boolean =>\n\ta.length === b.length && a.every((known, index) => sameIssue(known, b[index]));\n\n/** The previous issues when `next` says the same, so an unchanged path keeps its objects. */\nconst reuseIssues = (previous: Issues | undefined, next: Issues): Issues =>\n\tprevious && sameIssues(previous, next) ? previous : Object.freeze([...next]);\n\n/** The previous finding when `next` reports the same, `undefined` when it reports nothing. */\nfunction reuseFinding(previous: Finding | undefined, errors: Issues, warnings: Issues): Finding | undefined {\n\tif (errors.length === 0 && warnings.length === 0) return undefined;\n\tif (previous && sameIssues(previous.errors, errors) && sameIssues(previous.warnings, warnings)) return previous;\n\treturn Object.freeze({\n\t\terrors: errors.length === 0 ? NO_ISSUES : Object.freeze([...errors]),\n\t\twarnings: warnings.length === 0 ? NO_ISSUES : Object.freeze([...warnings]),\n\t});\n}\n\n/** The error a list of issues makes, reusing `previous` when nothing in it changed. */\nfunction errorOf(issues: Issues, previous: FormStateError | undefined): FormStateError {\n\tif (previous && sameIssues(previous.all, issues)) return previous;\n\treturn Object.freeze({ ...issues[0], all: Object.freeze([...issues]) });\n}\n\nconst sameList = (a: readonly string[], b: readonly string[]): boolean =>\n\ta.length === b.length && a.every((value, index) => value === b[index]);\n\nconst internalPath = (path: string): string => (path === FORM_ROOT ? '' : path);\nconst publicPath = (path: string): string => (path === '' ? FORM_ROOT : path);\n\nconst hasMarkAround = (tree: Tree<true>, path: string): boolean =>\n\tcoveredAt(tree, path) || nodeAt(tree, path) !== undefined;\n\n/**\n * The row a path names that its array does not have, if any.\n *\n * @remarks An index segment below a value that is not an array or an object (absent, or a primitive) names a row of an array with no rows; a name below an absent object does not.\n */\nfunction missingRow(\n\tpath: string,\n\tvalues: NullMap,\n): { readonly segment: string; readonly above: string; readonly length: number } | undefined {\n\tconst segments = internalPath(path).split('.').filter(Boolean);\n\tfor (const [depth, segment] of segments.entries()) {\n\t\tconst above = segments.slice(0, depth).join('.');\n\t\tconst value = depth === 0 ? values : readAt(values, above);\n\t\tconst isIndex =\n\t\t\tString(Number(segment)) === segment && Number.isInteger(Number(segment)) && Number(segment) >= 0;\n\t\tif (Array.isArray(value) && !(isIndex && Number(segment) < value.length)) {\n\t\t\treturn { segment, above, length: value.length };\n\t\t}\n\t\tif (/^\\d+$/.test(segment) && !Array.isArray(value) && !isStructural(value)) {\n\t\t\treturn { segment, above, length: 0 };\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/** The marks that belong to paths taking part. */\nfunction withoutExcluded(flat: NullMap<true>, excluded: readonly string[]): NullMap<true> {\n\tif (excluded.length === 0) return flat;\n\tconst kept = createMap<true>();\n\tfor (const path of Object.keys(flat)) if (!isPathExcluded(excluded, path)) kept[path] = true;\n\treturn stabilize(flat, kept);\n}\n\n/** The errors of each path in `found`, reusing the objects of `previous` while their issues are unchanged. */\nfunction shapeErrors(\n\tfound: NullMap<FormStateIssue[]>,\n\tprevious: NullMap<FormStateError> | undefined,\n): NullMap<FormStateError> {\n\tconst merged = createMap<FormStateError>();\n\tfor (const [path, issues] of Object.entries(found)) merged[path] = errorOf(issues, previous?.[path]);\n\treturn stabilize(previous ?? createMap<FormStateError>(), merged);\n}\n\n/** The fact for `validity` and the value it describes, `previous` when it says the same. */\nfunction factOf(previous: NativeFact | undefined, validity: NativeValidity, value: unknown): NativeFact {\n\tif (\n\t\tprevious &&\n\t\tObject.is(previous.value, value) &&\n\t\tprevious.validity.type === validity.type &&\n\t\tprevious.validity.message === validity.message &&\n\t\tsameParams(previous.validity.params, validity.params)\n\t) {\n\t\treturn previous;\n\t}\n\treturn Object.freeze({\n\t\tvalidity: Object.freeze({\n\t\t\ttype: validity.type,\n\t\t\t...(validity.params === undefined ? {} : { params: frozenCopy(validity.params) }),\n\t\t\t...(validity.message === undefined ? {} : { message: validity.message }),\n\t\t}),\n\t\tvalue,\n\t});\n}\n\n/** The native facts with the ones that describe a value that is gone removed. */\nfunction pruneNative(tree: Tree<NativeFact>, values: NullMap): Tree<NativeFact> {\n\treturn stable(\n\t\ttree,\n\t\tentries(tree).reduce(\n\t\t\t(kept, [path, fact]) => (Object.is(readAt(values, path), fact.value) ? kept : clearSelfAt(kept, path)),\n\t\t\ttree,\n\t\t),\n\t);\n}\n\n/** What a path's rules read, as the values they have now. */\nfunction dependenciesOf(path: string, values: NullMap, index: DependencyIndex): readonly Dependency[] {\n\treturn index\n\t\t.referencesOf(path)\n\t\t.map((reference) => ({ reference, value: readAt(values, resolveFieldRef(reference, path)) }));\n}\n\n/** The issues a host gave for one path, as the container keeps them. */\nfunction serverIssues(input: FormStateErrorInput | readonly FormStateErrorInput[]): Issues {\n\treturn (Array.isArray(input) ? (input as readonly FormStateErrorInput[]) : [input as FormStateErrorInput]).map(\n\t\t(given) =>\n\t\t\tissue(given.type ?? 'server', 'server', {\n\t\t\t\tparams: given.params === undefined ? undefined : frozenCopy(given.params),\n\t\t\t\tmessage: given.message,\n\t\t\t}),\n\t);\n}\n\n/** Rejects a path whose segment the engine reserves, as no field can be named that. */\nfunction assertFieldPath(path: string, command: string): void {\n\tconst reserved = path.split('.').find(isReservedPathKey);\n\tif (reserved !== undefined) {\n\t\tthrow new Error(\n\t\t\t`${command}: '${path}' has the reserved segment '${reserved}'; a segment cannot start with '__' or be constructor, prototype or __proto__.`,\n\t\t);\n\t}\n}\n\n/** Rejects a path that names a row its array does not have; a path below an absent object is allowed. */\nfunction assertRowsExist(path: string, values: NullMap): void {\n\tconst missing = missingRow(path, values);\n\tif (missing) {\n\t\tthrow new Error(\n\t\t\t`setServerErrors: '${path}' names row '${missing.segment}' of '${missing.above}', which has ${missing.length} rows.`,\n\t\t);\n\t}\n}\n\n/** The facts with `reported` recorded for `path`: `null` withdraws, a fact is kept with the value it describes. */\nfunction withFact(\n\ttree: Tree<NativeFact>,\n\tpath: string,\n\treported: NativeValidity | null,\n\tvalues: NullMap,\n): Tree<NativeFact> {\n\tif (reported === null) return stable(tree, clearSelfAt(tree, path));\n\tconst known = selfAt(tree, path);\n\tconst fact = factOf(known, reported, readAt(values, path));\n\treturn fact === known ? tree : setSelfAt(tree, path, fact, arrayIn(values));\n}\n\n/**\n * Creates the engine's reference {@link FormStateContainer}: framework-free, with the engine's validation.\n *\n * @remarks\n * Values live in null-prototype maps and come out of the snapshot as frozen plain records; both views\n * share structure, so a branch no command touched keeps its reference. Validation goes through\n * `planFormValidation` and `runValidationPlan` with one debounce scope for recorded validation. Each silent\n * {@link FormStateContainer.checkValidity} gets a scope of its own, so it neither replaces a debounced call of\n * the validation that writes errors nor another check's, and answers for the value it was called with.\n *\n * Errors, native facts, touched marks and checks are trees with a slot per node, in the shape of the\n * values. A row operation is one splice, applied to the values and to every tree in the same commit, so\n * state cannot fall out of step with its rows. A validation result that arrives late finds its fields by\n * row id, not by index, and is applied only while the scope it covered is current.\n */\nexport function createFormStateContainer(options: FormStateContainerOptions): FormStateContainer {\n\tconst { config, registry } = options;\n\tconst { validationMode, reValidateMode } = config;\n\tconst elements = config.steps.flatMap((step) => step.elements);\n\tconst tracker = createRunTracker();\n\tconst debounceScope = createDebounceScope();\n\tconst listeners = new Set<() => void>();\n\tconst participates = hasParticipationRules(config.steps);\n\tlet rowCounter = 0;\n\tconst adoptedIds = new Set<string>();\n\tconst mintId = (): string => {\n\t\tlet id = `row-${++rowCounter}`;\n\t\twhile (adoptedIds.has(id)) id = `row-${++rowCounter}`;\n\t\treturn id;\n\t};\n\n\tconst NO_PARTICIPATION: Participation = Object.freeze({\n\t\texcluded: Object.freeze([]),\n\t\tskippedSteps: Object.freeze([]),\n\t\tfields: Object.freeze({}),\n\t});\n\n\t/** The participation of `values`, keeping the previous object's parts that are equal so a snapshot's reference holds while nothing changed. */\n\tfunction participationOf(values: NullMap, previous: Participation = NO_PARTICIPATION): Participation {\n\t\tif (!participates) return NO_PARTICIPATION;\n\t\tconst next = resolveParticipation(config.steps, toPlain(values) as Record<string, unknown>);\n\t\tconst excluded = sameList(next.excluded, previous.excluded) ? previous.excluded : Object.freeze(next.excluded);\n\t\tconst skippedSteps = sameList(next.skippedSteps, previous.skippedSteps)\n\t\t\t? previous.skippedSteps\n\t\t\t: Object.freeze(next.skippedSteps);\n\t\tconst names = Object.keys(next.fields);\n\t\tconst same =\n\t\t\tnames.length === Object.keys(previous.fields).length &&\n\t\t\tnames.every((name) => {\n\t\t\t\tconst before = Object.hasOwn(previous.fields, name) ? previous.fields[name] : undefined;\n\t\t\t\tconst now = next.fields[name];\n\t\t\t\treturn (\n\t\t\t\t\tbefore?.hidden === now.hidden &&\n\t\t\t\t\tbefore.disabled === now.disabled &&\n\t\t\t\t\tbefore.required === now.required\n\t\t\t\t);\n\t\t\t});\n\t\tconst fields = same\n\t\t\t? previous.fields\n\t\t\t: Object.freeze(\n\t\t\t\t\tObject.fromEntries(Object.entries(next.fields).map(([name, one]) => [name, Object.freeze(one)])),\n\t\t\t\t);\n\t\treturn excluded === previous.excluded && skippedSteps === previous.skippedSteps && fields === previous.fields\n\t\t\t? previous\n\t\t\t: Object.freeze({ excluded, skippedSteps, fields });\n\t}\n\n\tconst submissionShape = buildSubmissionShape(config.steps);\n\tconst hydrated = options.snapshot === undefined ? undefined : readHydration(options.snapshot);\n\tfor (const id of hydrated?.taken ?? []) adoptedIds.add(id);\n\tconst initialDefaults = toInternalRecord(options.defaults ?? {});\n\tconst initialValues = hydrated?.values ?? initialDefaults;\n\tconst initialParticipation = participationOf(initialValues);\n\tlet state: State = {\n\t\tvalues: initialValues,\n\t\tdefaults: initialDefaults,\n\t\tvalidation: undefined,\n\t\tserver: undefined,\n\t\tnative: undefined,\n\t\ttouched: undefined,\n\t\tfailed: undefined,\n\t\tvalidated: undefined,\n\t\tvalidating: undefined,\n\t\tdirty: hydrated ? dirtyTree(initialValues, initialDefaults) : undefined,\n\t\tids: hydrated ? hydrated.ids : syncIds(undefined, initialValues, mintId),\n\t\tparticipation: initialParticipation,\n\t\texcluded: initialParticipation.excluded,\n\t\texclusionVersion: 0,\n\t\tgeneration: 0,\n\t};\n\n\tconst declaredFor = new WeakMap<NullMap, ReadonlySet<string>>();\n\n\t/**\n\t * The paths some field of the config expands to for `values`, with every path above them.\n\t *\n\t * @remarks The rows are the live ones, so a path below a row that is gone is not declared, and neither is a name no field has.\n\t */\n\tfunction declaredPaths(values: NullMap): ReadonlySet<string> {\n\t\tconst known = declaredFor.get(values);\n\t\tif (known) return known;\n\t\tconst declared = new Set<string>();\n\t\tfor (const path of collectStepFieldPaths({ elements }, toPlain(values) as Record<string, unknown>)) {\n\t\t\tconst segments = path.split('.');\n\t\t\tfor (let depth = 1; depth <= segments.length; depth += 1) declared.add(segments.slice(0, depth).join('.'));\n\t\t}\n\t\tdeclaredFor.set(values, declared);\n\t\treturn declared;\n\t}\n\n\t/** Whether the value at a path is an array, which decides how its field state is shaped. */\n\tconst isArrayNow: IsArrayAt = (path) => Array.isArray(readAt(state.values, path));\n\n\tinterface Derived {\n\t\treadonly validation: Tree<Finding>;\n\t\treadonly server: Tree<ServerEntry>;\n\t\treadonly excluded: readonly string[];\n\t\treadonly errors: NullMap<FormStateError>;\n\t\treadonly warnings: NullMap<FormStateError>;\n\t}\n\tlet derivedFor: Derived | undefined;\n\n\t/**\n\t * The error and the warning of each path.\n\t *\n\t * @remarks\n\t * An error lists what the server said, then what the container's validation recorded (the rules in\n\t * authored order, then the native fact), the first shown. A path that takes no part has none of them.\n\t * Server errors are left out here, not deleted, so a path that takes part again finds them as they were;\n\t * `commit` clears what the checks recorded for a path the moment it is excluded, since a path that\n\t * returns is re-validated and its old findings described a value it may no longer have.\n\t */\n\tfunction derive(current: State): Derived {\n\t\tif (\n\t\t\tderivedFor &&\n\t\t\tderivedFor.validation === current.validation &&\n\t\t\tderivedFor.server === current.server &&\n\t\t\tderivedFor.excluded === current.excluded\n\t\t) {\n\t\t\treturn derivedFor;\n\t\t}\n\t\tconst takesPart = ([path]: readonly [string, unknown]) => !isPathExcluded(current.excluded, path);\n\t\tconst errors = createMap<FormStateIssue[]>();\n\t\tfor (const [path, entry] of entries(current.server).filter(takesPart)) {\n\t\t\t(errors[publicPath(path)] ??= []).push(...entry.issues);\n\t\t}\n\t\tconst warnings = createMap<FormStateIssue[]>();\n\t\tconst before = derivedFor;\n\t\tfor (const [path, finding] of entries(current.validation).filter(takesPart)) {\n\t\t\tconst where = publicPath(path);\n\t\t\tif (finding.errors.length > 0) (errors[where] ??= []).push(...finding.errors);\n\t\t\tif (finding.warnings.length > 0) warnings[where] = [...finding.warnings];\n\t\t}\n\t\tderivedFor = {\n\t\t\tvalidation: current.validation,\n\t\t\tserver: current.server,\n\t\t\texcluded: current.excluded,\n\t\t\terrors: shapeErrors(errors, before?.errors),\n\t\t\twarnings: shapeErrors(warnings, before?.warnings),\n\t\t};\n\t\treturn derivedFor;\n\t}\n\n\tconst marksFor = new Map<string, { tree: Tree<true>; excluded: readonly string[]; flat: NullMap<true> }>();\n\tfunction marks(kind: string, tree: Tree<true>, excluded: readonly string[] = []): NullMap<true> {\n\t\tconst known = marksFor.get(kind);\n\t\tif (known && known.tree === tree && known.excluded === excluded) return known.flat;\n\t\tconst merged = createMap<true>();\n\t\tfor (const [path] of entries(tree)) merged[publicPath(path)] = true;\n\t\tconst flat = stabilize(known?.flat ?? createMap<true>(), withoutExcluded(merged, excluded));\n\t\tmarksFor.set(kind, { tree, excluded, flat });\n\t\treturn flat;\n\t}\n\n\tlet flatIdsFor: { ids: IdTree | undefined; flat: NullMap<readonly string[]> } | undefined;\n\tfunction flatRowIds(current: State): NullMap<readonly string[]> {\n\t\tif (flatIdsFor && flatIdsFor.ids === current.ids) return flatIdsFor.flat;\n\t\tconst flat = stabilize(flatIdsFor?.flat ?? createMap<readonly string[]>(), flatIds(current.ids));\n\t\tflatIdsFor = { ids: current.ids, flat };\n\t\treturn flat;\n\t}\n\n\tlet publicFor: { readonly from: Participation; readonly view: FormStateSnapshot['participation'] } | undefined;\n\tfunction publicParticipation(from: Participation): FormStateSnapshot['participation'] {\n\t\tif (publicFor?.from === from) return publicFor.view;\n\t\tconst view = Object.freeze({ skippedSteps: from.skippedSteps, fields: from.fields });\n\t\tconst reused =\n\t\t\tpublicFor && publicFor.view.skippedSteps === view.skippedSteps && publicFor.view.fields === view.fields\n\t\t\t\t? publicFor.view\n\t\t\t\t: view;\n\t\tpublicFor = { from, view: reused };\n\t\treturn reused;\n\t}\n\n\tfunction toSnapshot(current: State): FormStateSnapshot {\n\t\tconst derived = derive(current);\n\t\treturn Object.freeze({\n\t\t\tvalues: toPlain(current.values) as FormStateSnapshot['values'],\n\t\t\terrors: toPlainMap(derived.errors),\n\t\t\twarnings: toPlainMap(derived.warnings),\n\t\t\ttouched: toPlainMap(marks('touched', current.touched)),\n\t\t\tdirty: toPlainMap(marks('dirty', current.dirty)),\n\t\t\trowIds: toPlainMap(flatRowIds(current)),\n\t\t\tvalidating: toPlainMap(marks('validating', current.validating, current.excluded)),\n\t\t\tisValid: Object.keys(derived.errors).length === 0,\n\t\t\tgeneration: current.generation,\n\t\t\tparticipation: publicParticipation(current.participation),\n\t\t});\n\t}\n\n\tlet snapshot = toSnapshot(state);\n\tconst serverSnapshot = snapshot;\n\n\tlet batchDepth = 0;\n\tlet notifyAfterBatch = false;\n\n\tfunction notify(): void {\n\t\tfor (const listener of listeners) listener();\n\t}\n\n\t/**\n\t * Runs one command's synchronous work, so every commit in it reaches subscribers as one notification.\n\t *\n\t * @remarks\n\t * A command that starts a validation commits the pending marks before the validation's first await; the\n\t * batch folds that into the command's own update.\n\t */\n\tfunction batch<T>(work: () => T): T {\n\t\tbatchDepth += 1;\n\t\ttry {\n\t\t\treturn work();\n\t\t} finally {\n\t\t\tbatchDepth -= 1;\n\t\t\tif (batchDepth === 0 && notifyAfterBatch) {\n\t\t\t\tnotifyAfterBatch = false;\n\t\t\t\tnotify();\n\t\t\t}\n\t\t}\n\t}\n\n\t/** The server errors whose path's rules read a value other than the one they were applied against. */\n\tfunction pruneServer(current: State): Tree<ServerEntry> {\n\t\treturn stable(\n\t\t\tcurrent.server,\n\t\t\tentries(current.server).reduce(\n\t\t\t\t(kept, [path, entry]) =>\n\t\t\t\t\tentry.dependencies.every(({ reference, value }) =>\n\t\t\t\t\t\tObject.is(readAt(current.values, resolveFieldRef(reference, path)), value),\n\t\t\t\t\t)\n\t\t\t\t\t\t? kept\n\t\t\t\t\t\t: clearSelfAt(kept, path),\n\t\t\t\tcurrent.server,\n\t\t\t),\n\t\t);\n\t}\n\n\t/** Applies one update atomically and notifies, only when something observable changed. */\n\tfunction commit(change: Partial<State>): void {\n\t\tconst previous = state;\n\t\tlet next: State = { ...previous, ...change };\n\t\tlet reeligible: string[] = [];\n\t\tif (next.values !== previous.values || next.defaults !== previous.defaults) {\n\t\t\tnext = { ...next, dirty: stable(previous.dirty, dirtyTree(next.values, next.defaults)) };\n\t\t}\n\t\tif (next.values !== previous.values) {\n\t\t\tif (next.native) next = { ...next, native: pruneNative(next.native, next.values) };\n\t\t\tif (next.server) next = { ...next, server: pruneServer(next) };\n\t\t\tif (participates) {\n\t\t\t\tconst participation = participationOf(next.values, previous.participation);\n\t\t\t\tconst { excluded } = participation;\n\t\t\t\tnext = { ...next, participation };\n\t\t\t\tif (excluded !== previous.excluded) {\n\t\t\t\t\tconst dropped = excluded.filter((path) => !isPathExcluded(previous.excluded, path));\n\t\t\t\t\treeligible = previous.excluded.filter(\n\t\t\t\t\t\t(path) =>\n\t\t\t\t\t\t\t!isPathExcluded(excluded, path) &&\n\t\t\t\t\t\t\t(hasMarkAround(next.failed, path) || hasMarkAround(next.validated, path)),\n\t\t\t\t\t);\n\t\t\t\t\tnext = {\n\t\t\t\t\t\t...next,\n\t\t\t\t\t\texcluded,\n\t\t\t\t\t\texclusionVersion: previous.exclusionVersion + 1,\n\t\t\t\t\t\tvalidation: dropped.reduce((tree, path) => clearAt(tree, path), next.validation),\n\t\t\t\t\t\tvalidating: dropped.reduce((tree, path) => clearAt(tree, path), next.validating),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tstate = next;\n\t\tconst nextSnapshot = toSnapshot(next);\n\t\tconst changed = (Object.keys(nextSnapshot) as Array<keyof FormStateSnapshot>).some(\n\t\t\t(key) => nextSnapshot[key] !== snapshot[key],\n\t\t);\n\t\tif (changed) {\n\t\t\tsnapshot = nextSnapshot;\n\t\t\tif (batchDepth > 0) notifyAfterBatch = true;\n\t\t\telse notify();\n\t\t}\n\t\tif (reeligible.length > 0) validateQuietly(reeligible, { record: true, markFailed: false });\n\t}\n\n\tconst isFailed = (path: string): boolean => coveredAt(state.failed, path);\n\tconst isTouched = (path: string): boolean => coveredAt(state.touched, path);\n\n\tfunction validatesOn(event: 'change' | 'blur', path: string): boolean {\n\t\tconst target = event === 'change' ? 'onChange' : 'onBlur';\n\t\tif (isFailed(path)) return reValidateMode === target;\n\t\tif (validationMode === 'onTouched') return event === 'blur' || isTouched(path);\n\t\treturn validationMode === 'all' || validationMode === target;\n\t}\n\n\ttype Outcome = FormValidateResult['outcome'];\n\n\tinterface ValidationMode {\n\t\t/** Writes the result, tracks it against later requests and marks its paths pending; a silent check does none of that. */\n\t\treadonly record: boolean;\n\t\t/** Starts re-validation by `reValidateMode` for the paths when they fail. */\n\t\treadonly markFailed: boolean;\n\t\t/** Match `names` as exact paths, not as prefixes. */\n\t\treadonly exact?: boolean;\n\t\t/** Run once more over the same rows when the result was overtaken; a second overtaking is `'overtaken'`. */\n\t\treadonly retry?: boolean;\n\t\t/** Reject, rather than only record, when a rule could not run. */\n\t\treadonly reject?: boolean;\n\t\t/** The submission this check validates: it keeps the values of the run that passed. */\n\t\treadonly submission?: SubmissionRecord;\n\t}\n\n\t/** Runs a check nobody awaits: an automatic one, which logs a rule that could not run and never rejects for it. */\n\tfunction validateQuietly(names: readonly string[], mode: ValidationMode): void {\n\t\trunValidation(names, mode).catch((error: unknown) => {\n\t\t\tlogger.error('A validation the form state container started on its own failed.', { error });\n\t\t});\n\t}\n\n\t/**\n\t * Validates `names` (the whole form when omitted; nothing when empty) against the values as they are now.\n\t *\n\t * @remarks\n\t * The check records its scope when it starts: the values and native facts it reads, the values its\n\t * rules depend on, the rows by id, the exclusions and the reset generation. A silent check answers for\n\t * that scope as it was, and for the server errors then too. A recorded result is applied path by path,\n\t * at the place its fields have now: each path is found again through the ids of the rows it ran through,\n\t * so a result for a row that moved lands on that row, and one for a row that is gone is dropped. It is\n\t * dropped for a path when that path's value or native fact changed while it ran, a value a rule of the\n\t * path reads changed, or a check that started later asked for the path. A reset drops the whole result,\n\t * nothing is run again, and the call is `'overtaken'`. When the scope was overtaken otherwise, an\n\t * explicit check runs once more over the same rows, wherever they are by then, and is `'overtaken'` when\n\t * that one is overtaken too or a row it was asked about is gone. A silent check is never overtaken: it\n\t * answers for the state it started from.\n\t */\n\tasync function runValidation(names: readonly string[] | undefined, mode: ValidationMode): Promise<Outcome> {\n\t\tif (names?.length === 0) return 'passed';\n\t\tconst start = {\n\t\t\tvalues: state.values,\n\t\t\tids: state.ids,\n\t\t\tvalidation: state.validation,\n\t\t\tnative: state.native,\n\t\t\tserver: state.server,\n\t\t\texcluded: state.excluded,\n\t\t\tparticipation: state.participation,\n\t\t\texclusionVersion: state.exclusionVersion,\n\t\t};\n\t\tconst startIndex = mode.record ? dependencyIndex() : undefined;\n\t\tconst startValues = toPlain(start.values) as Record<string, unknown>;\n\t\tconst plan = planFormValidation({\n\t\t\tsteps: config.steps,\n\t\t\tvalues: startValues,\n\t\t\tnames,\n\t\t\texactNames: mode.exact,\n\t\t\tparticipation: start.participation,\n\t\t});\n\t\tconst planned = [...new Set(plan.fields.map(({ fieldPath }) => fieldPath))];\n\t\tconst run = mode.record\n\t\t\t? tracker.start(\n\t\t\t\t\tnames?.map((name) => anchorOf(start.ids, name)),\n\t\t\t\t\tmode.exact === true,\n\t\t\t\t)\n\t\t\t: undefined;\n\t\tif (run) {\n\t\t\tcommit({\n\t\t\t\tvalidating: planned.reduce((tree, path) => setSelfAt(tree, path, true, isArrayNow), state.validating),\n\t\t\t});\n\t\t}\n\t\tconst finish = (extra: Partial<State> = {}): void => {\n\t\t\tif (!run) return;\n\t\t\tconst resolveNow = (anchor: Parameters<typeof resolveAnchor>[0]) => resolveAnchor(anchor, state.ids);\n\t\t\tlet validating = state.validating;\n\t\t\tfor (const path of planned) {\n\t\t\t\tconst current = resolveAnchor(anchorOf(start.ids, path), state.ids);\n\t\t\t\tif (current !== undefined && !tracker.superseded(run, current, resolveNow)) {\n\t\t\t\t\tvalidating = setSelfAt(validating, current, undefined, isArrayNow);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttracker.finish(run);\n\t\t\tcommit({ ...extra, validating });\n\t\t};\n\t\tlet outcome: Awaited<ReturnType<typeof runValidationPlan>>;\n\t\ttry {\n\t\t\toutcome = await runValidationPlan(plan, {\n\t\t\t\tregistry,\n\t\t\t\tdebounceScope: mode.record ? debounceScope : createDebounceScope(),\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tfinish();\n\t\t\tthrow error;\n\t\t}\n\t\tconst inScope = (path: string): boolean =>\n\t\t\t!names || (mode.exact ? names.includes(path) : names.some((name) => isWithin(path, name)));\n\t\tconst found = createMap<PathFindings>();\n\t\tconst at = (path: string): PathFindings => (found[path] ??= { errors: [], warnings: [] });\n\t\tfor (const [path, issues] of Object.entries(outcome.issues)) {\n\t\t\tfor (const raised of issues) {\n\t\t\t\tat(path)[raised.severity === 'warning' ? 'warnings' : 'errors'].push(ruleIssue(raised));\n\t\t\t}\n\t\t}\n\t\tfor (const [path, fact] of entries(start.native)) {\n\t\t\tif (inScope(path) && !isPathExcluded(start.excluded, path))\n\t\t\t\tat(path).errors.push(nativeIssue(fact.validity));\n\t\t}\n\t\tconst blocking = Object.values(found).some((entry) => entry.errors.length > 0);\n\t\tconst failures = Object.values(outcome.failures).flat();\n\t\tconst failure = failures[0];\n\t\tif (!mode.reject) {\n\t\t\tfor (const unrun of failures) {\n\t\t\t\tlogger.error(`A rule could not run during an automatic validation of '${unrun.path}'.`, {\n\t\t\t\t\terror: unrun,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tconst unchecked = new Set(outcome.superseded);\n\n\t\tif (!run || !startIndex) {\n\t\t\tif (failure && mode.reject) throw failure;\n\t\t\tconst answeredByServer = entries(start.server).some(\n\t\t\t\t([path]) => inScope(path) && !isPathExcluded(start.excluded, path),\n\t\t\t);\n\t\t\treturn !blocking && !answeredByServer && unchecked.size === 0 ? 'passed' : 'invalid';\n\t\t}\n\t\tif (tracker.outdated(run)) {\n\t\t\tfinish();\n\t\t\treturn 'overtaken';\n\t\t}\n\n\t\tconst now = (path: string): string | undefined => resolveAnchor(anchorOf(start.ids, path), state.ids);\n\t\tconst movedSince = (path: string): boolean => {\n\t\t\tconst current = now(path);\n\t\t\treturn current === undefined || !Object.is(readAt(state.values, current), readAt(start.values, path));\n\t\t};\n\t\tconst factMoved = (path: string, current: string): boolean =>\n\t\t\tselfAt(start.native, path) !== selfAt(state.native, current);\n\t\tconst dependencyChanged = (path: string): boolean =>\n\t\t\tstartIndex.referencesOf(path).some((reference) => {\n\t\t\t\tconst current = now(path);\n\t\t\t\tif (current === undefined) return true;\n\t\t\t\treturn !Object.is(\n\t\t\t\t\treadAt(state.values, resolveFieldRef(reference, current)),\n\t\t\t\t\treadAt(start.values, resolveFieldRef(reference, path)),\n\t\t\t\t);\n\t\t\t});\n\t\tconst lostContainer = (path: string): boolean =>\n\t\t\tpath\n\t\t\t\t.split('.')\n\t\t\t\t.slice(0, -1)\n\t\t\t\t.some((_, depth, segments) => {\n\t\t\t\t\tconst above = segments.slice(0, depth + 1).join('.');\n\t\t\t\t\tconst current = now(above);\n\t\t\t\t\treturn (\n\t\t\t\t\t\tcurrent === undefined ||\n\t\t\t\t\t\t(isStructural(readAt(start.values, above)) && !isStructural(readAt(state.values, current)))\n\t\t\t\t\t);\n\t\t\t\t});\n\t\tconst outrun = (path: string, current: string): boolean =>\n\t\t\tlostContainer(path) ||\n\t\t\tmovedSince(path) ||\n\t\t\ttracker.superseded(run, current, (anchor) => resolveAnchor(anchor, state.ids)) ||\n\t\t\tdependencyChanged(path);\n\t\tconst stale = (path: string, current: string | undefined): boolean =>\n\t\t\tcurrent === undefined || outrun(path, current) || factMoved(path, current);\n\t\tconst plannedSet = new Set(planned);\n\t\tconst decided = [\n\t\t\t...new Set([\n\t\t\t\t...planned,\n\t\t\t\t...entries(start.validation)\n\t\t\t\t\t.map(([path]) => path)\n\t\t\t\t\t.filter(inScope),\n\t\t\t\t...Object.keys(found),\n\t\t\t]),\n\t\t].map((path) => ({ path, current: now(path) }));\n\t\tconst excludedNow = (current: string): boolean => isPathExcluded(state.excluded, current);\n\t\tconst exclusionChanged =\n\t\t\tstart.exclusionVersion !== state.exclusionVersion &&\n\t\t\t(!names ||\n\t\t\t\t[...start.excluded, ...state.excluded].some((path) =>\n\t\t\t\t\tnames.some((name) => isWithin(path, name) || isWithin(name, path)),\n\t\t\t\t));\n\t\tconst scopeStale = (): boolean =>\n\t\t\tchangedPaths(start.values, state.values).some(\n\t\t\t\t(changed) => !names || names.some((name) => isWithin(changed, name) || isWithin(name, changed)),\n\t\t\t) ||\n\t\t\tstartIndex.watched.some(\n\t\t\t\t(watched) =>\n\t\t\t\t\t!Object.is(readAt(state.values, watched), readAt(start.values, watched)) &&\n\t\t\t\t\tstartIndex.dependentsOf(watched).some(inScope),\n\t\t\t);\n\t\tconst overtaken =\n\t\t\tunchecked.size > 0 ||\n\t\t\texclusionChanged ||\n\t\t\tscopeStale() ||\n\t\t\tdecided.some(\n\t\t\t\t({ path, current }) => (current === undefined || !excludedNow(current)) && stale(path, current),\n\t\t\t);\n\t\tif (mode.retry && overtaken) {\n\t\t\treturn batch(() => {\n\t\t\t\tconst again = names?.map((name) => now(name));\n\t\t\t\tfinish();\n\t\t\t\tif (again?.some((name) => name === undefined)) return Promise.resolve('overtaken');\n\t\t\t\treturn runValidation(again as string[] | undefined, { ...mode, retry: false });\n\t\t\t});\n\t\t}\n\n\t\tlet validation = state.validation;\n\t\tlet validated = state.validated;\n\t\tfor (const { path, current } of decided) {\n\t\t\tif (current === undefined || excludedNow(current) || unchecked.has(path)) continue;\n\t\t\tif (stale(path, current)) continue;\n\t\t\tconst entry = found[path] as PathFindings | undefined;\n\t\t\tvalidation = setSelfAt(\n\t\t\t\tvalidation,\n\t\t\t\tcurrent,\n\t\t\t\treuseFinding(selfAt(validation, current), entry?.errors ?? NO_ISSUES, entry?.warnings ?? NO_ISSUES),\n\t\t\t\tisArrayNow,\n\t\t\t);\n\t\t\tif (plannedSet.has(path)) validated = setSelfAt(validated, current, true, isArrayNow);\n\t\t}\n\t\tlet failed = state.failed;\n\t\tif (mode.markFailed) {\n\t\t\tfailed = names\n\t\t\t\t? names.reduce((tree, name) => {\n\t\t\t\t\t\tconst current = now(name);\n\t\t\t\t\t\treturn current === undefined ? tree : markAt(tree, current, isArrayNow);\n\t\t\t\t\t}, failed)\n\t\t\t\t: setSelfAt(failed, '', true, isArrayNow);\n\t\t}\n\t\tfinish({ validation, validated, failed });\n\t\tif (overtaken) return 'overtaken';\n\t\tif (failure && mode.reject) throw failure;\n\t\tconst scopeNow = names?.flatMap((name) => now(name) ?? []);\n\t\tconst stillInScope = (path: string): boolean =>\n\t\t\t!scopeNow || (mode.exact ? scopeNow.includes(path) : scopeNow.some((name) => isWithin(path, name)));\n\t\tconst passed = !blocking && !Object.keys(derive(state).errors).some(stillInScope);\n\t\tif (passed && mode.submission && mode.submission.epoch === tracker.epoch()) {\n\t\t\tmode.submission.values = start.values;\n\t\t\tmode.submission.ids = start.ids;\n\t\t\tmode.submission.excluded = start.excluded;\n\t\t}\n\t\treturn passed ? 'passed' : 'invalid';\n\t}\n\n\tlet cachedIndex: { ids: State['ids']; shape: string; index: DependencyIndex } | undefined;\n\n\t/**\n\t * The dependency index for the form's rows in `current`.\n\t *\n\t * @remarks\n\t * The index depends on the elements, which never change, and on how many rows each array has, so it\n\t * is rebuilt only when that row count signature changes. Writing a value, moving rows or adopting\n\t * ids leaves it as it was; the signature is not even computed while the row ids are the same tree.\n\t */\n\tfunction dependencyIndex(current: State = state): DependencyIndex {\n\t\tif (cachedIndex && cachedIndex.ids === current.ids) return cachedIndex.index;\n\t\tconst lengths = flatRowIds(current);\n\t\tconst shape = Object.keys(lengths)\n\t\t\t.map((path) => `${path}:${lengths[path].length}`)\n\t\t\t.toSorted()\n\t\t\t.join('|');\n\t\tif (cachedIndex?.shape === shape) {\n\t\t\tcachedIndex = { ...cachedIndex, ids: current.ids };\n\t\t\treturn cachedIndex.index;\n\t\t}\n\t\tconst index = buildDependencyIndex(elements, toPlain(current.values) as Record<string, unknown>, registry);\n\t\tcachedIndex = { ids: current.ids, shape, index };\n\t\treturn index;\n\t}\n\n\t/** Names that must be validated after a change: the dependents of every watched path whose value moved. */\n\tfunction dependentsOfChange(previousValues: NullMap): string[] {\n\t\tconst index = dependencyIndex();\n\t\tconst changed = index.watched.filter(\n\t\t\t(path) => !Object.is(readAt(previousValues, path), readAt(state.values, path)),\n\t\t);\n\t\treturn index\n\t\t\t.expand(changed)\n\t\t\t.filter((path) => shouldSurfaceDependentError({ touched: isTouched(path), submitted: isFailed(path) }));\n\t}\n\n\t/**\n\t * Validates what a change calls for, without waiting for it.\n\t *\n\t * @remarks\n\t * The changed path is validated with its descendants, or alone when `exact`: a row operation\n\t * validates the array's own rules and leaves the rows, which the user has not reached, to their dependents.\n\t * A rule that could not run is logged by the check itself; what can still reject is a bug in the\n\t * validation, which is logged too.\n\t */\n\tfunction afterChange(\n\t\tpreviousValues: NullMap,\n\t\tchangedPath: string,\n\t\texact: boolean,\n\t\tevents: { readonly change: boolean; readonly blur: boolean } = { change: true, blur: false },\n\t): void {\n\t\tconst names = new Set(dependentsOfChange(previousValues));\n\t\tconst validatesSelf =\n\t\t\t(events.change && validatesOn('change', changedPath)) || (events.blur && validatesOn('blur', changedPath));\n\t\tif (validatesSelf && !exact) names.add(changedPath);\n\t\tconst quiet = { record: true, markFailed: false } as const;\n\t\tif (names.size > 0) validateQuietly([...names], quiet);\n\t\tif (validatesSelf && exact) validateQuietly([changedPath], { ...quiet, exact });\n\t}\n\n\t/** What a host set no longer describes the value at `path`, or the paths around it, once it changed. */\n\tfunction dropHostErrors(path: string, includeBelow: boolean): Tree<ServerEntry> {\n\t\tconst around = clearAround(state.server, path);\n\t\treturn includeBelow ? clearAt(around, path) : clearSelfAt(around, path);\n\t}\n\n\t/**\n\t * Rejects a path `setValue` or `blur` may not write.\n\t *\n\t * @remarks A path must name rows its arrays have: rows are made with `fieldArray`, so a write cannot leave holes or rows without an id.\n\t */\n\tfunction assertWritable(command: 'setValue' | 'blur', path: string): void {\n\t\tassertFieldPath(path, command);\n\t\tconst missing = missingRow(path, state.values);\n\t\tif (missing) {\n\t\t\tthrow new Error(\n\t\t\t\t`${command}: '${path}' names row '${missing.segment}' of '${missing.above}', which has ${missing.length} rows; add rows with fieldArray.`,\n\t\t\t);\n\t\t}\n\t}\n\n\tfunction setValue(path: string, value: unknown): void {\n\t\tassertWritable('setValue', path);\n\t\tconst previousValues = state.values;\n\t\tconst branch = reconcile(readAt(previousValues, path), toInternal(value));\n\t\tconst values = setIn(previousValues, path, branch);\n\t\tif (values === previousValues) return;\n\t\tconst root = path.split('.')[0];\n\t\tbatch(() => {\n\t\t\tcommit({\n\t\t\t\tvalues,\n\t\t\t\tids: replaceIdsAt(state.ids, root, syncIds(idsAt(state.ids, root), readAt(values, root), mintId)),\n\t\t\t\tserver: dropHostErrors(path, true),\n\t\t\t\tvalidation: conformAt(state.validation, path, branch),\n\t\t\t\tnative: stable(state.native, conformAt(state.native, path, branch)),\n\t\t\t\ttouched: conformAt(state.touched, path, branch),\n\t\t\t\tfailed: conformAt(state.failed, path, branch),\n\t\t\t\tvalidated: conformAt(state.validated, path, branch),\n\t\t\t\tvalidating: conformAt(state.validating, path, branch),\n\t\t\t});\n\t\t\tafterChange(previousValues, path, false);\n\t\t});\n\t}\n\n\tfunction blur(path: string): void {\n\t\tassertWritable('blur', path);\n\t\tbatch(() => {\n\t\t\tcommit({ touched: markAt(state.touched, path, isArrayNow) });\n\t\t\tafterChange(state.values, path, false, { change: false, blur: true });\n\t\t});\n\t}\n\n\t/** The array at `path` as rows with their ids, minting an id for a row that has none. */\n\tfunction rowsAt(path: string): RowEntry[] {\n\t\tconst value = readAt(state.values, path);\n\t\tconst rows = Array.isArray(value) ? value : [];\n\t\tconst nodes = idsAt(state.ids, path);\n\t\treturn rows.map((row, index) => ({\n\t\t\tfrom: index,\n\t\t\tvalue: row,\n\t\t\tnode: (Array.isArray(nodes) ? (nodes as readonly RowNode[])[index] : undefined) ?? {\n\t\t\t\tid: mintId(),\n\t\t\t\tbelow: syncIds(undefined, row, mintId),\n\t\t\t},\n\t\t}));\n\t}\n\n\t/**\n\t * Writes the rows an operation produced: one splice, applied to the values and to every state tree.\n\t *\n\t * @remarks\n\t * Each state tree has one element per row, so a row's errors, native facts, touched marks, checks and\n\t * pending marks are carried by moving the element; a row the operation adds has none.\n\t */\n\tfunction commitRows(path: string, rows: readonly RowEntry[]): void {\n\t\tconst previousValues = state.values;\n\t\tconst order = rows.map((row) => row.from);\n\t\tconst values = setIn(\n\t\t\tpreviousValues,\n\t\t\tpath,\n\t\t\treconcile(\n\t\t\t\treadAt(previousValues, path),\n\t\t\t\trows.map((row) => row.value),\n\t\t\t),\n\t\t);\n\t\tconst root = path.split('.')[0];\n\t\tconst placed = replaceIdsAt(\n\t\t\tstate.ids,\n\t\t\tpath,\n\t\t\trows.map((row) => row.node),\n\t\t);\n\t\tbatch(() => {\n\t\t\tcommit({\n\t\t\t\tvalues,\n\t\t\t\tids: replaceIdsAt(placed, root, syncIds(idsAt(placed, root), readAt(values, root), mintId)),\n\t\t\t\tserver: reorderAt(dropHostErrors(path, false), path, order),\n\t\t\t\tvalidation: reorderAt(state.validation, path, order),\n\t\t\t\tnative: reorderAt(state.native, path, order),\n\t\t\t\ttouched: reorderAt(state.touched, path, order),\n\t\t\t\tfailed: reorderAt(state.failed, path, order),\n\t\t\t\tvalidated: reorderAt(state.validated, path, order),\n\t\t\t\tvalidating: reorderAt(state.validating, path, order),\n\t\t\t});\n\t\t\tafterChange(previousValues, path, true);\n\t\t});\n\t}\n\n\tconst fresh = (value: unknown): RowEntry => {\n\t\tconst internal = toInternal(value);\n\t\treturn { value: internal, node: { id: mintId(), below: syncIds(undefined, internal, mintId) } };\n\t};\n\n\tconst fieldArrays = new Map<string, FieldArrayCommands>();\n\tfunction fieldArray(path: string): FieldArrayCommands {\n\t\tconst known = fieldArrays.get(path);\n\t\tif (known) return known;\n\t\tconst insert = (index: number, value: unknown): void => {\n\t\t\tconst rows = rowsAt(path);\n\t\t\tconst added = asRows(value);\n\t\t\tif (!Number.isInteger(index) || index < 0 || index > rows.length || added.length === 0) return;\n\t\t\trows.splice(index, 0, ...added.map(fresh));\n\t\t\tcommitRows(path, rows);\n\t\t};\n\t\tconst rearrange = (indexes: number[], change: (rows: RowEntry[]) => RowEntry[]): void => {\n\t\t\tconst rows = rowsAt(path);\n\t\t\tif (!indexes.every((index) => isRow(index, rows.length))) return;\n\t\t\tcommitRows(path, change(rows));\n\t\t};\n\t\tconst commands: FieldArrayCommands = {\n\t\t\tappend: (value) => insert(rowsAt(path).length, value),\n\t\t\tprepend: (value) => insert(0, value),\n\t\t\tinsert,\n\t\t\tswap: (indexA, indexB) =>\n\t\t\t\trearrange([indexA, indexB], (rows) => {\n\t\t\t\t\t[rows[indexA], rows[indexB]] = [rows[indexB], rows[indexA]];\n\t\t\t\t\treturn rows;\n\t\t\t\t}),\n\t\t\tmove: (indexA, indexB) =>\n\t\t\t\trearrange([indexA, indexB], (rows) => {\n\t\t\t\t\trows.splice(indexB, 0, ...rows.splice(indexA, 1));\n\t\t\t\t\treturn rows;\n\t\t\t\t}),\n\t\t\tupdate: (index, value) =>\n\t\t\t\trearrange([index], (rows) => {\n\t\t\t\t\trows[index] = fresh(value);\n\t\t\t\t\treturn rows;\n\t\t\t\t}),\n\t\t\treplace: (values) => commitRows(path, values.map(fresh)),\n\t\t\tremove: (index) => {\n\t\t\t\tconst rows = rowsAt(path);\n\t\t\t\tif (index === undefined) return rows.length > 0 ? commitRows(path, []) : undefined;\n\t\t\t\tconst removed = new Set((Array.isArray(index) ? index : [index]).filter((i) => isRow(i, rows.length)));\n\t\t\t\tif (removed.size > 0)\n\t\t\t\t\tcommitRows(\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\trows.filter((_, position) => !removed.has(position)),\n\t\t\t\t\t);\n\t\t\t},\n\t\t};\n\t\tfieldArrays.set(path, commands);\n\t\treturn commands;\n\t}\n\n\tlet latestSubmission: SubmissionRecord | undefined;\n\n\t/** Whether the target of a server error, and the values its path's rules read, are as they were when the submission began. */\n\tfunction targetUnchanged(record: SubmissionRecord, was: string, now: string, index: DependencyIndex): boolean {\n\t\tif (was === '') return Object.is(record.values, state.values);\n\t\tif (!Object.is(readAt(record.values, was), readAt(state.values, now))) return false;\n\t\treturn index\n\t\t\t.referencesOf(now)\n\t\t\t.every((reference) =>\n\t\t\t\tObject.is(\n\t\t\t\t\treadAt(record.values, resolveFieldRef(reference, was)),\n\t\t\t\t\treadAt(state.values, resolveFieldRef(reference, now)),\n\t\t\t\t),\n\t\t\t);\n\t}\n\n\t/** Reports facts for the paths the container holds, in one commit and one validation run. */\n\tfunction reportNative(facts: Readonly<Record<string, NativeValidity | null>>): void {\n\t\tconst reported = Object.entries(facts);\n\t\tfor (const [path] of reported) assertFieldPath(path, 'reportNative');\n\t\tlet native = state.native;\n\t\tconst changed: string[] = [];\n\t\tfor (const [path, validity] of reported) {\n\t\t\tif (!declaredPaths(state.values).has(path)) continue;\n\t\t\tconst next = withFact(native, path, validity, state.values);\n\t\t\tif (next === native) continue;\n\t\t\tnative = next;\n\t\t\tchanged.push(path);\n\t\t}\n\t\tif (changed.length === 0) return;\n\t\tbatch(() => {\n\t\t\tcommit({ native });\n\t\t\tconst again = changed.filter(\n\t\t\t\t(path) =>\n\t\t\t\t\thasMarkAround(state.validated, path) || hasMarkAround(state.validating, path) || isFailed(path),\n\t\t\t);\n\t\t\tif (again.length > 0) validateQuietly(again, { record: true, markFailed: false });\n\t\t});\n\t}\n\n\t/**\n\t * Applies the server's answer to the submission `record`, if it is still the latest.\n\t *\n\t * @remarks The paths are checked first, so a bad one throws whether or not the answer would apply.\n\t */\n\tfunction setServerErrors(record: SubmissionRecord, errors: FormStateErrorsInput): void {\n\t\tconst submitted = submittedTree(record);\n\t\tconst declared = declaredPaths(submitted);\n\t\tconst given: Array<readonly [string, Issues]> = [];\n\t\tconst undeclared: FormStateIssue[] = [];\n\t\tfor (const [path, input] of Object.entries(errors)) {\n\t\t\tif (path !== FORM_ROOT) assertFieldPath(path, 'setServerErrors');\n\t\t\tassertRowsExist(path, submitted);\n\t\t\tconst issues = serverIssues(input);\n\t\t\tif (path === FORM_ROOT) given.push([path, issues]);\n\t\t\telse if (declared.has(path)) given.push([toFormPath(record, path), issues]);\n\t\t\telse undeclared.push(...issues);\n\t\t}\n\t\tconst root = given.findIndex(([path]) => path === FORM_ROOT);\n\t\tif (undeclared.length > 0) {\n\t\t\tif (root < 0) given.push([FORM_ROOT, undeclared]);\n\t\t\telse given[root] = [FORM_ROOT, [...given[root][1], ...undeclared]];\n\t\t}\n\t\tif (record !== latestSubmission) return;\n\t\tconst index = dependencyIndex();\n\t\tconst known = state.server;\n\t\tconst applied: Array<[string, ServerEntry]> = [];\n\t\tfor (const [path, issues] of given) {\n\t\t\tif (issues.length === 0) continue;\n\t\t\tconst was = internalPath(path);\n\t\t\tconst where = resolveAnchor(anchorOf(record.ids, was), state.ids);\n\t\t\tif (where === undefined || !targetUnchanged(record, was, where, index)) continue;\n\t\t\tconst dependencies = where === '' ? [] : dependenciesOf(where, state.values, index);\n\t\t\tconst previous = selfAt(known, where);\n\t\t\tconst kept = reuseIssues(previous?.issues, issues);\n\t\t\tapplied.push([\n\t\t\t\twhere,\n\t\t\t\tprevious &&\n\t\t\t\tprevious.issues === kept &&\n\t\t\t\tprevious.dependencies.length === dependencies.length &&\n\t\t\t\tprevious.dependencies.every(\n\t\t\t\t\t(one, position) =>\n\t\t\t\t\t\tone.reference === dependencies[position].reference &&\n\t\t\t\t\t\tObject.is(one.value, dependencies[position].value),\n\t\t\t\t)\n\t\t\t\t\t? previous\n\t\t\t\t\t: { issues: kept, dependencies },\n\t\t\t]);\n\t\t}\n\t\tcommit({ server: stable(known, fromEntries(applied, isArrayNow)) });\n\t}\n\n\tasync function submit(): Promise<FormSubmitResult> {\n\t\tconst record: SubmissionRecord = {\n\t\t\tvalues: state.values,\n\t\t\tids: state.ids,\n\t\t\texcluded: state.excluded,\n\t\t\tpayload: config.payload ?? NO_PAYLOAD,\n\t\t\tshape: submissionShape,\n\t\t\tepoch: tracker.epoch(),\n\t\t};\n\t\tlatestSubmission = record;\n\t\tconst outcome = await batch(() => {\n\t\t\tcommit({ server: undefined });\n\t\t\treturn runValidation(undefined, {\n\t\t\t\trecord: true,\n\t\t\t\tmarkFailed: true,\n\t\t\t\tretry: true,\n\t\t\t\treject: true,\n\t\t\t\tsubmission: record,\n\t\t\t});\n\t\t});\n\t\tif (latestSubmission !== record) return { outcome: 'overtaken' };\n\t\tif (outcome === 'passed') {\n\t\t\treturn {\n\t\t\t\toutcome,\n\t\t\t\tvalues: submittedValues(record),\n\t\t\t\tsetServerErrors: (errors) => setServerErrors(record, errors),\n\t\t\t};\n\t\t}\n\t\treturn { outcome };\n\t}\n\n\treturn {\n\t\tsubscribe(listener) {\n\t\t\tlisteners.add(listener);\n\t\t\treturn () => {\n\t\t\t\tlisteners.delete(listener);\n\t\t\t};\n\t\t},\n\t\tgetSnapshot: () => snapshot,\n\t\tgetServerSnapshot: () => serverSnapshot,\n\t\tgetValue: (path) => toPlain(readAt(state.values, path)),\n\t\tsetValue,\n\t\tblur,\n\t\treportNative,\n\t\treset(values) {\n\t\t\tconst defaults = values ? toInternalRecord(values) : state.defaults;\n\t\t\ttracker.reset();\n\t\t\tlatestSubmission = undefined;\n\t\t\tcommit({\n\t\t\t\tvalues: defaults,\n\t\t\t\tdefaults,\n\t\t\t\tvalidation: undefined,\n\t\t\t\tserver: undefined,\n\t\t\t\tnative: undefined,\n\t\t\t\ttouched: undefined,\n\t\t\t\tfailed: undefined,\n\t\t\t\tvalidated: undefined,\n\t\t\t\tvalidating: undefined,\n\t\t\t\tids: syncIds(undefined, defaults, mintId),\n\t\t\t\tgeneration: state.generation + 1,\n\t\t\t});\n\t\t},\n\t\tvalidate: async (paths) => ({\n\t\t\toutcome: await runValidation(paths, { record: true, markFailed: true, retry: true, reject: true }),\n\t\t}),\n\t\tcheckValidity: async () =>\n\t\t\t(await runValidation(undefined, { record: false, markFailed: false, reject: true })) === 'passed',\n\t\tsubmit,\n\t\tfieldArray,\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmJA,IAAM,YAAoB,OAAO,OAAO,CAAC,CAAC;AAC1C,IAAM,aAAgD,OAAO,OAAO,CAAC,CAAC;AACtE,IAAM,SAAS,CAAC,MAAe,SAA0B,eAAe,MAAM,IAAI;AAClF,IAAM,QAAQ,CAAC,OAAe,WAA4B,OAAO,UAAU,KAAK,KAAK,SAAS,KAAK,QAAQ;AAC3G,IAAM,SAAS,CAAC,UAA+B,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK;AACpF,IAAM,UACL,CAAC,WACD,CAAC,SACA,MAAM,QAAQ,OAAO,QAAQ,IAAI,CAAC;AAQpC,IAAM,QAAQ,CAAC,MAAc,QAAkC,QAAoB,CAAC,MACnF,OAAO,OAAO;AAAA,EACb;AAAA,EACA;AAAA,EACA,GAAI,MAAM,WAAW,SAAY,CAAC,IAAI,EAAE,QAAQ,MAAM,OAAO;AAAA,EAC7D,GAAI,MAAM,WAAW,SAAY,CAAC,IAAI,EAAE,QAAQ,MAAM,OAAO;AAAA,EAC7D,GAAI,MAAM,YAAY,SAAY,CAAC,IAAI,EAAE,SAAS,MAAM,QAAQ;AACjE,CAAC;AAEF,IAAM,YAAY,CAAC,UAClB,MAAM,MAAM,MAAM,cAAc,EAAE,QAAQ,MAAM,QAAQ,QAAQ,MAAM,QAAQ,SAAS,MAAM,QAAQ,CAAC;AAEvG,IAAM,cAAc,CAAC,aACpB,MAAM,SAAS,MAA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AAAA,IACA,aAAa,MAAM;AAAA,IACnB,mBAAmB,MAAM;AAAA,IACzB,UAAU,CAAC,SAAS,QAAQ,OAAO,MAAM,QAAQ,IAAI,CAAC;AAAA,IACtD;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM,QAAQ;AACb,YAAM,WAAW,SAAS,iBAAiB,MAAM,IAAI,MAAM;AAC3D,cAAQ,MAAM;AACd,yBAAmB;AACnB,aAAO;AAAA,QACN,QAAQ;AAAA,QACR;AAAA,QACA,YAAY;AAAA,QACZ,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,WAAW;AAAA,QACX,YAAY;AAAA,QACZ,KAAK,QAAQ,QAAW,UAAU,MAAM;AAAA,QACxC,YAAY,MAAM,aAAa;AAAA,MAChC,CAAC;AAAA,IACF;AAAA,IACA,UAAU,OAAO,WAAW;AAAA,MAC3B,SAAS,MAAM,cAAc,OAAO,EAAE,QAAQ,MAAM,YAAY,MAAM,OAAO,MAAM,QAAQ,KAAK,CAAC;AAAA,IAClG;AAAA,IACA,eAAe,YACb,MAAM,cAAc,QAAW,EAAE,QAAQ,OAAO,YAAY,OAAO,QAAQ,KAAK,CAAC,MAAO;AAAA,IAC1F;AAAA,IACA;AAAA,EACD;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/runtime/types.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ParsedActionSequence } from '@schema-engine/actions';\nimport type { FormEngineRuntime } from '@/engine/form-engine';\nimport type { FormActionConfig, SubmissionActionResult } from '@/runtime/submission-lifecycle';\nimport type { FormStepState, StepNavigationMode } from '@/engine/step-machine';\nimport type { ValidationStep } from '@/engine/value-validation';\nimport type { SubmissionSchema } from '@/engine/submission-schema';\nimport type { FormFetch } from '@/lib/form-fetch';\nimport type { FormActionTrigger } from '@/actions';\nimport type { DefaultValuesOf } from '@/builder/form-values';\nimport type { ValuesBrand } from '@/lib/normalized-form-config';\nimport type {\n\tFormStateContainer,\n\tFormStateContainerConfig,\n\tFormStateErrorsInput,\n\tFormIssueFormatter,\n\tFormStateHydration,\n\tFormSubmissionIssue,\n} from '@/state-container/types';\n\n/** The nested values of a form, as the container holds them and a submission hands them over. */\nexport type FormValues = Readonly<Record<string, unknown>>;\n\n/** What `onSubmit` is given besides the values that passed. */\nexport interface FormSubmitHelpers {\n\t/** Shows the server's answer to this submission, by path; `FORM_ROOT` stands for the form. */\n\tsetServerErrors: (errors: FormStateErrorsInput) => void;\n\t/**\n\t * The engine's `fetch`: the request to send the values with.\n\t *\n\t * @remarks It applies the engine's CSRF policy to a same-origin unsafe request, so a submit callback adds no token itself.\n\t */\n\tfetch: FormFetch;\n}\n\n/**\n * How a command ended.\n *\n * @remarks\n * - `moved`: the current step changed.\n * - `submitted` and `failed`: a submission ran and its actions and `onSubmit` succeeded or did not. Why it\n * failed is in `snapshot.submission.failures`, never in the return value.\n * - `invalid`: validation found errors, which are shown and focused.\n * - `overtaken`: an edit or a row move outran the check, so there is no verdict: nothing is shown or focused.\n * - `refused`: there was nowhere to go, or the step is unknown, skipped or not reachable.\n * - `busy`: another command was running.\n * - `cancelled`: a reset or an unmount revoked the command, which then wrote nothing.\n */\nexport type FormRuntimeOutcome =\n\t'moved' | 'submitted' | 'failed' | 'invalid' | 'overtaken' | 'refused' | 'busy' | 'cancelled';\n\n/** How `next()`, `back()` and `goTo()` ended. */\nexport type NavigationOutcome = Extract<\n\tFormRuntimeOutcome,\n\t'moved' | 'failed' | 'invalid' | 'overtaken' | 'refused' | 'busy' | 'cancelled'\n>;\n\n/** How `submit()` ended: before the last active step it acts as `next()`, so it can end `moved`. */\nexport type SubmitOutcome = Extract<\n\tFormRuntimeOutcome,\n\t'moved' | 'submitted' | 'failed' | 'invalid' | 'overtaken' | 'refused' | 'busy' | 'cancelled'\n>;\n\n/**\n * Where a submission is: `idle` until one starts, `validating` while its validation runs, `submitting` once it passed and the actions and `onSubmit` run, then how it ended.\n *\n * @remarks A submission that is `invalid` or `overtaken` goes from `validating` back to `idle` and is never `submitting`: submission starts, for the `form_submit_start` trigger and for a renderer's own start event, once it passed validation.\n */\nexport type SubmissionStatus = 'idle' | 'validating' | 'submitting' | 'success' | 'error';\n\n/**\n * Whether a submission is in progress: its validation or its actions are running.\n *\n * @remarks The one definition of busy, which the runtime's revoke and every renderer's submit button, label and busy state share.\n */\nexport function isSubmissionBusy(status: SubmissionStatus): boolean {\n\treturn status === 'validating' || status === 'submitting';\n}\n\n/**\n * What the form reports about its submissions.\n *\n * @remarks `failures` explain an `error` status and are empty otherwise. They are issues, so the form's one formatter words them.\n */\nexport interface FormSubmissionState {\n\treadonly status: SubmissionStatus;\n\treadonly failures: readonly FormSubmissionIssue[];\n\t/** The submissions that ended, whether they passed or failed validation, since the form was created or reset. */\n\treadonly submitCount: number;\n}\n\n/** What a runtime reports: its submission, and its steps. */\nexport interface FormRuntimeSnapshot {\n\treadonly submission: FormSubmissionState;\n\t/** The id of the current step. */\n\treadonly current: string;\n\t/** A `next`, `back`, `goTo` or a submit that acts as `next` is running. */\n\treadonly navigating: boolean;\n\t/** Every step in config order, skipped ones included. */\n\treadonly steps: readonly FormStepState[];\n}\n\n/** What only the renderer can do. */\nexport interface FormRuntimeHost {\n\t/**\n\t * Focuses the first control with an error among `paths`.\n\t *\n\t * @remarks The paths are those of the fields that have an error; the host picks the first in the document. The list may be empty (a rule that could not run records no field error), and the host then focuses nothing.\n\t */\n\tfocus(paths: readonly string[]): void;\n\t/** Writes the controls' values to the container and reports their native validity, as a submit does, before a check. */\n\tsync?(): void;\n\t/**\n\t * Called once a submission succeeded, after its actions and `onSubmit`, with the values the form declares, so a host whose form can post natively may do it with them.\n\t *\n\t * @remarks The values are what the form's elements write, checked by the schema derived from them, and not what the application's schema made of them (a `Date`, a class): a form posts what its fields hold. The host decides whether it posts, because a renderer always passes a stable `onSubmit` wrapper and the runtime cannot tell whether the application gave one: Radiant posts when it did not. The navigation cannot cut off the success and complete triggers, which ran first.\n\t */\n\tsubmitNatively?(values: FormValues): void;\n}\n\n/** A step of the config the runtime reads. */\nexport interface FormRuntimeStep<TAction extends FormActionConfig = FormActionConfig> extends ValidationStep {\n\treadonly id: string;\n\t/** Actions dispatched after the form's on every trigger while this step is current. */\n\treadonly actions?: ParsedActionSequence<TAction>;\n}\n\n/** The normalized form config, in the shape the runtime reads. */\nexport interface FormRuntimeConfig<\n\tTAction extends FormActionConfig = FormActionConfig,\n> extends FormStateContainerConfig {\n\treadonly id?: string;\n\treadonly navigation?: StepNavigationMode;\n\treadonly actions?: ParsedActionSequence<TAction>;\n\treadonly steps: readonly FormRuntimeStep<TAction>[];\n}\n\n/**\n * What {@link createFormRuntime} builds a runtime from.\n *\n * @template TValues - The values a submission holds, which the form's config carries ({@link ValuesBrand}); {@link FormValues} when it is not typed. It is inferred from `config`, which the runtime has parsed every submission against before it reaches a callback.\n */\nexport interface CreateFormRuntimeOptions<TAction extends FormActionConfig = FormActionConfig, TValues = FormValues> {\n\t/** The engine, for its validation registry, its actions and its `fetch`. */\n\tengine: FormEngineRuntime;\n\tconfig: FormRuntimeConfig<TAction> & ValuesBrand<TValues>;\n\t/** Values the form starts from, over the defaults of its fields. */\n\tdefaults?: DefaultValuesOf<TValues>;\n\t/** The snapshot of a container that rendered the form on the server, to start from. */\n\tsnapshot?: FormStateHydration;\n\thost: FormRuntimeHost;\n\t/** Called with the values that passed validation and matched the form's value schemas, after the submit actions and before the success trigger. */\n\tonSubmit?: (data: TValues, helpers: FormSubmitHelpers) => void | Promise<void>;\n\t/** Called when the values change, never for an error, a touch or a validation result. */\n\tonChange?: (data: FormValues) => void;\n\t/** Called with each submit action that succeeded, and the values that passed. Typed by the engine's actions. */\n\tonAction?: (action: TAction, data: TValues) => void | Promise<void>;\n\t/**\n\t * Takes the page to the `redirectUrl` a submit action asked for, once the whole submission succeeded.\n\t *\n\t * @remarks\n\t * Called at most once, after every submit action and `onSubmit` succeeded and the success trigger ran, with the\n\t * `redirectUrl` of the last successful submit action that set one. It replaces\n\t * {@link FormRuntimeHost.submitNatively} for that submission, since a native post would load a page of its own.\n\t * Defaults to {@link defaultNavigate}: `location.assign` where `globalThis.location` exists, and nothing on a server.\n\t */\n\tnavigate?: (url: string) => void;\n\t/** Called with the results of every trigger that ran actions, and once with those of the submit actions. */\n\tonActionResults?: (results: readonly SubmissionActionResult[], trigger: FormActionTrigger) => void | Promise<void>;\n}\n\n/** One instance of a form's lifecycle and wizard navigation, shared by every renderer. */\nexport interface FormRuntime {\n\t/** The form state: values, field state, validation and the captured submission. */\n\treadonly container: FormStateContainer;\n\t/** The normalized config the runtime was created from. */\n\treadonly config: FormRuntimeConfig;\n\t/**\n\t * The submitted values of the form as a Standard Schema, composed once from the config's elements.\n\t *\n\t * @remarks The schema every submission is checked against, so a tool that builds values for the form reads it from here and cannot drift from the runtime's.\n\t */\n\treadonly submissionSchema: SubmissionSchema;\n\t/** The engine's `formatIssue`, which a form without one of its own words its issues with. */\n\treadonly formatIssue: FormIssueFormatter | undefined;\n\t/**\n\t * Starts the runtime: dispatches `form_mount` the first time, and watches the values for `form_change` and `onChange`.\n\t *\n\t * @remarks The returned function stops the watch and revokes any command in flight (`next`, `back`, `goTo`, `submit`), which ends `'cancelled'`. Mounting again is allowed and dispatches `form_mount` no more.\n\t */\n\tmount: () => () => void;\n\tgetSnapshot: () => FormRuntimeSnapshot;\n\tgetServerSnapshot: () => FormRuntimeSnapshot;\n\tsubscribe: (listener: () => void) => () => void;\n\t/** Validates the current step and moves to the next active one. */\n\tnext: () => Promise<NavigationOutcome>;\n\t/** Moves to the previous active step, without validating. */\n\tback: () => Promise<NavigationOutcome>;\n\t/** Moves to the step `id`: back always, forward as the form's `navigation` allows. */\n\tgoTo: (id: string) => Promise<NavigationOutcome>;\n\t/** Acts as `next()` before the last active step; on it, validates every active step, runs the actions and `onSubmit`. */\n\tsubmit: () => Promise<SubmitOutcome>;\n\t/** Hides the outcome of the last submission: the status goes back to `idle` and the failures are dropped. */\n\tclearSubmission: () => void;\n}\n"],
|
|
5
|
+
"mappings": ";AA0EO,SAAS,iBAAiB,QAAmC;AACnE,SAAO,WAAW,gBAAgB,WAAW;AAC9C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/lib/container-kind-of.ts"],
|
|
4
|
+
"sourcesContent": ["import type { AnyElementRegistration, ContainerKind } from '@/types/registration';\n\n/**\n * The container semantics an element registration declares: only an input can hold children, so a static element has none.\n */\nexport function containerKindOf(registration: AnyElementRegistration | undefined): ContainerKind | undefined {\n\treturn registration?.kind === 'input' ? registration.containerKind : undefined;\n}\n"],
|
|
5
|
+
"mappings": ";AAKO,SAAS,gBAAgB,cAA6E;AAC5G,SAAO,cAAc,SAAS,UAAU,aAAa,gBAAgB;AACtE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isPlainObject
|
|
3
|
+
} from "./chunk-CMPOBBRV.js";
|
|
4
|
+
|
|
5
|
+
// src/lib/frozen-copy.ts
|
|
6
|
+
function frozenCopy(value) {
|
|
7
|
+
if (Array.isArray(value)) return Object.freeze(value.map(frozenCopy));
|
|
8
|
+
if (isPlainObject(value)) {
|
|
9
|
+
return Object.freeze(
|
|
10
|
+
Object.fromEntries(Object.entries(value).map(([key, child]) => [key, frozenCopy(child)]))
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
frozenCopy
|
|
18
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/lib/frozen-copy.ts"],
|
|
4
|
+
"sourcesContent": ["import { isPlainObject } from './is-plain-object';\n\n/**\n * A deep, frozen copy of a serializable value.\n *\n * @remarks\n * For data that crosses into an immutable snapshot, such as the `params` of an issue: a caller that keeps\n * the original and changes it later must not change what a snapshot says. Plain records and arrays are\n * copied; anything else (a primitive, or a value that is not data) is kept as it is.\n */\nexport function frozenCopy<T>(value: T): T {\n\tif (Array.isArray(value)) return Object.freeze(value.map(frozenCopy)) as T;\n\tif (isPlainObject(value)) {\n\t\treturn Object.freeze(\n\t\t\tObject.fromEntries(Object.entries(value).map(([key, child]) => [key, frozenCopy(child)])),\n\t\t) as T;\n\t}\n\treturn value;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;AAUO,SAAS,WAAc,OAAa;AAC1C,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO,OAAO,OAAO,MAAM,IAAI,UAAU,CAAC;AACpE,MAAI,cAAc,KAAK,GAAG;AACzB,WAAO,OAAO;AAAA,MACb,OAAO,YAAY,OAAO,QAAQ,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,WAAW,KAAK,CAAC,CAAC,CAAC;AAAA,IACzF;AAAA,EACD;AACA,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/lib/reserved-path-keys.ts
|
|
2
|
+
var RESERVED_PATH_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
3
|
+
var ENGINE_KEY_PREFIX = "__";
|
|
4
|
+
function isReservedPathKey(key) {
|
|
5
|
+
return RESERVED_PATH_KEYS.has(key) || key.startsWith(ENGINE_KEY_PREFIX);
|
|
6
|
+
}
|
|
7
|
+
function assertWritablePathKey(key) {
|
|
8
|
+
if (isReservedPathKey(key)) {
|
|
9
|
+
throw new Error(`Rejected path segment '${key}'`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
ENGINE_KEY_PREFIX,
|
|
15
|
+
isReservedPathKey,
|
|
16
|
+
assertWritablePathKey
|
|
17
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/lib/reserved-path-keys.ts"],
|
|
4
|
+
"sourcesContent": ["const RESERVED_PATH_KEYS: ReadonlySet<string> = new Set(['__proto__', 'constructor', 'prototype']);\n\n/** The prefix the engine keeps for its own path segments, such as the form's own error key. */\nexport const ENGINE_KEY_PREFIX = '__';\n\n/**\n * Whether a path segment is reserved: one that would reach an object's prototype, or one the engine keeps for itself.\n *\n * @remarks Every segment that starts with `__` is reserved, so a field can never collide with a key the engine adds, such as the form's own error key.\n */\nexport function isReservedPathKey(key: string): boolean {\n\treturn RESERVED_PATH_KEYS.has(key) || key.startsWith(ENGINE_KEY_PREFIX);\n}\n\n/** @throws {Error} When `key` is a reserved path segment. */\nexport function assertWritablePathKey(key: string): void {\n\tif (isReservedPathKey(key)) {\n\t\tthrow new Error(`Rejected path segment '${key}'`);\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,IAAM,qBAA0C,oBAAI,IAAI,CAAC,aAAa,eAAe,WAAW,CAAC;AAG1F,IAAM,oBAAoB;AAO1B,SAAS,kBAAkB,KAAsB;AACvD,SAAO,mBAAmB,IAAI,GAAG,KAAK,IAAI,WAAW,iBAAiB;AACvE;AAGO,SAAS,sBAAsB,KAAmB;AACxD,MAAI,kBAAkB,GAAG,GAAG;AAC3B,UAAM,IAAI,MAAM,0BAA0B,GAAG,GAAG;AAAA,EACjD;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// src/schemas/html-attributes.ts
|
|
2
|
+
import * as z from "zod/mini";
|
|
3
|
+
var RESERVED_HTML_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
|
|
4
|
+
"$type",
|
|
5
|
+
"name",
|
|
6
|
+
"id",
|
|
7
|
+
"value",
|
|
8
|
+
"defaultValue",
|
|
9
|
+
"checked",
|
|
10
|
+
"defaultChecked",
|
|
11
|
+
"type",
|
|
12
|
+
"disabled",
|
|
13
|
+
"readonly",
|
|
14
|
+
"readOnly",
|
|
15
|
+
"required",
|
|
16
|
+
"className",
|
|
17
|
+
"class",
|
|
18
|
+
"style",
|
|
19
|
+
"ref",
|
|
20
|
+
"key",
|
|
21
|
+
"children",
|
|
22
|
+
"dangerouslySetInnerHTML"
|
|
23
|
+
]);
|
|
24
|
+
var HtmlAttributeValueSchema = z.union([z.string(), z.number(), z.boolean()]);
|
|
25
|
+
function htmlAttributesAreAllowed(record2) {
|
|
26
|
+
for (const key of Object.keys(record2)) {
|
|
27
|
+
if (RESERVED_HTML_ATTRIBUTE_KEYS.has(key)) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
if (/^on[a-z]/i.test(key)) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
var HtmlAttributesSchema = z.record(z.string(), z.optional(HtmlAttributeValueSchema)).check(
|
|
37
|
+
z.refine(htmlAttributesAreAllowed, {
|
|
38
|
+
message: "htmlAttributes cannot contain reserved control props or event handlers"
|
|
39
|
+
})
|
|
40
|
+
).check(z.describe("Extra attributes forwarded to the focusable control (for example data-testid)"));
|
|
41
|
+
function mergeControlProps(controlProps, htmlAttributes) {
|
|
42
|
+
if (!htmlAttributes) {
|
|
43
|
+
return controlProps;
|
|
44
|
+
}
|
|
45
|
+
const passthrough = Object.fromEntries(
|
|
46
|
+
Object.entries(htmlAttributes).filter((entry) => {
|
|
47
|
+
return entry[1] !== void 0;
|
|
48
|
+
})
|
|
49
|
+
);
|
|
50
|
+
return { ...passthrough, ...controlProps };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export {
|
|
54
|
+
RESERVED_HTML_ATTRIBUTE_KEYS,
|
|
55
|
+
HtmlAttributeValueSchema,
|
|
56
|
+
HtmlAttributesSchema,
|
|
57
|
+
mergeControlProps
|
|
58
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/schemas/html-attributes.ts"],
|
|
4
|
+
"sourcesContent": ["import * as z from 'zod/mini';\n\nexport const RESERVED_HTML_ATTRIBUTE_KEYS = new Set([\n\t'$type',\n\t'name',\n\t'id',\n\t'value',\n\t'defaultValue',\n\t'checked',\n\t'defaultChecked',\n\t'type',\n\t'disabled',\n\t'readonly',\n\t'readOnly',\n\t'required',\n\t'className',\n\t'class',\n\t'style',\n\t'ref',\n\t'key',\n\t'children',\n\t'dangerouslySetInnerHTML',\n]);\n\nexport const HtmlAttributeValueSchema = z.union([z.string(), z.number(), z.boolean()]);\n\nfunction htmlAttributesAreAllowed(record: Record<string, unknown>): boolean {\n\tfor (const key of Object.keys(record)) {\n\t\tif (RESERVED_HTML_ATTRIBUTE_KEYS.has(key)) {\n\t\t\treturn false;\n\t\t}\n\t\tif (/^on[a-z]/i.test(key)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\nexport const HtmlAttributesSchema = z\n\t.record(z.string(), z.optional(HtmlAttributeValueSchema))\n\t.check(\n\t\tz.refine(htmlAttributesAreAllowed, {\n\t\t\tmessage: 'htmlAttributes cannot contain reserved control props or event handlers',\n\t\t}),\n\t)\n\t.check(z.describe('Extra attributes forwarded to the focusable control (for example data-testid)'));\n\nexport type HtmlAttributes = z.infer<typeof HtmlAttributesSchema>;\n\n/**\n * Merges optional field `htmlAttributes` under engine control props (identity, a11y, disabled).\n *\n * @remarks\n * Pass static control props only. Wire event handlers on the JSX node after spreading the result.\n */\nexport function mergeControlProps<const TControl extends Record<string, unknown>>(\n\tcontrolProps: TControl,\n\thtmlAttributes?: HtmlAttributes | null,\n): TControl {\n\tif (!htmlAttributes) {\n\t\treturn controlProps;\n\t}\n\n\tconst passthrough = Object.fromEntries(\n\t\tObject.entries(htmlAttributes).filter((entry): entry is [string, string | number | boolean] => {\n\t\t\treturn entry[1] !== undefined;\n\t\t}),\n\t);\n\n\treturn { ...passthrough, ...controlProps };\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,YAAY,OAAO;AAEZ,IAAM,+BAA+B,oBAAI,IAAI;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAC;AAEM,IAAM,2BAA6B,QAAM,CAAG,SAAO,GAAK,SAAO,GAAK,UAAQ,CAAC,CAAC;AAErF,SAAS,yBAAyBA,SAA0C;AAC3E,aAAW,OAAO,OAAO,KAAKA,OAAM,GAAG;AACtC,QAAI,6BAA6B,IAAI,GAAG,GAAG;AAC1C,aAAO;AAAA,IACR;AACA,QAAI,YAAY,KAAK,GAAG,GAAG;AAC1B,aAAO;AAAA,IACR;AAAA,EACD;AACA,SAAO;AACR;AAEO,IAAM,uBACX,SAAS,SAAO,GAAK,WAAS,wBAAwB,CAAC,EACvD;AAAA,EACE,SAAO,0BAA0B;AAAA,IAClC,SAAS;AAAA,EACV,CAAC;AACF,EACC,MAAQ,WAAS,+EAA+E,CAAC;AAU5F,SAAS,kBACf,cACA,gBACW;AACX,MAAI,CAAC,gBAAgB;AACpB,WAAO;AAAA,EACR;AAEA,QAAM,cAAc,OAAO;AAAA,IAC1B,OAAO,QAAQ,cAAc,EAAE,OAAO,CAAC,UAAwD;AAC9F,aAAO,MAAM,CAAC,MAAM;AAAA,IACrB,CAAC;AAAA,EACF;AAEA,SAAO,EAAE,GAAG,aAAa,GAAG,aAAa;AAC1C;",
|
|
6
|
+
"names": ["record"]
|
|
7
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// src/actions/plugins/auto-save.plugin.ts
|
|
2
|
+
import * as z from "zod/mini";
|
|
3
|
+
var AutoSaveActionSchema = z.object({
|
|
4
|
+
/** Optional description for documentation and debugging purposes */
|
|
5
|
+
description: z.optional(z.string()),
|
|
6
|
+
/** Storage key to use (will use generated key if not provided) */
|
|
7
|
+
storageKey: z.optional(z.string()),
|
|
8
|
+
/** Whether to include sensitive fields in auto-save */
|
|
9
|
+
includeSensitive: z.optional(z._default(z.boolean(), false))
|
|
10
|
+
});
|
|
11
|
+
var autoSaveDraftKeyPrefix = "autosave_";
|
|
12
|
+
function getAutoSaveDraftStorageKey(formId) {
|
|
13
|
+
return `${autoSaveDraftKeyPrefix}${formId}`;
|
|
14
|
+
}
|
|
15
|
+
function autoSavePlugin(config) {
|
|
16
|
+
const { storage } = config;
|
|
17
|
+
const handler = async (context) => {
|
|
18
|
+
const action = context.config;
|
|
19
|
+
try {
|
|
20
|
+
if (config.shouldSave && !await config.shouldSave()) {
|
|
21
|
+
return {
|
|
22
|
+
success: true,
|
|
23
|
+
message: "Auto-save skipped because permission was not granted",
|
|
24
|
+
shouldContinue: true
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const storageKey = action.storageKey || config.getStorageKey?.(context) || getAutoSaveDraftStorageKey(context.formId);
|
|
28
|
+
const formData = context.formData;
|
|
29
|
+
if (!formData || Object.keys(formData).length === 0) {
|
|
30
|
+
return {
|
|
31
|
+
success: false,
|
|
32
|
+
error: "No form data available for auto-save",
|
|
33
|
+
shouldContinue: true
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
let dataToSave = formData;
|
|
37
|
+
if (!action.includeSensitive) {
|
|
38
|
+
dataToSave = Object.fromEntries(
|
|
39
|
+
Object.entries(formData).filter(
|
|
40
|
+
([key]) => !key.toLowerCase().includes("password") && !key.toLowerCase().includes("secret") && !key.toLowerCase().includes("token")
|
|
41
|
+
)
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
await storage.save(storageKey, dataToSave);
|
|
45
|
+
if (config.onSave) {
|
|
46
|
+
await config.onSave(dataToSave, context);
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
success: true,
|
|
50
|
+
message: `Form data auto-saved to ${storageKey}`,
|
|
51
|
+
shouldContinue: true
|
|
52
|
+
};
|
|
53
|
+
} catch (error) {
|
|
54
|
+
const errorMessage = error instanceof Error ? error.message : "Failed to auto-save";
|
|
55
|
+
if (config.onError) {
|
|
56
|
+
await config.onError(errorMessage, context);
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
success: false,
|
|
60
|
+
error: errorMessage,
|
|
61
|
+
shouldContinue: true
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
$type: "auto_save",
|
|
67
|
+
schema: AutoSaveActionSchema,
|
|
68
|
+
metadata: {
|
|
69
|
+
name: "Auto Save",
|
|
70
|
+
description: "Automatically save form data to storage",
|
|
71
|
+
icon: "save",
|
|
72
|
+
defaultTriggers: ["form_change"]
|
|
73
|
+
},
|
|
74
|
+
execute: handler
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export {
|
|
79
|
+
AutoSaveActionSchema,
|
|
80
|
+
getAutoSaveDraftStorageKey,
|
|
81
|
+
autoSavePlugin
|
|
82
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/actions/plugins/auto-save.plugin.ts"],
|
|
4
|
+
"sourcesContent": ["import * as z from 'zod/mini';\nimport type { BuilderActionRuntimeContext, BuilderActionRegistration, BuilderActionConfig } from '@/types';\n\n/**\n * Storage Interface for Auto-Save Plugin\n */\nexport interface AutoSaveStorage {\n\t/** Save form data to storage */\n\tsave: (key: string, data: unknown) => Promise<void> | void;\n\t/** Load form data from storage, synchronously or as a promise. */\n\tload: (key: string) => unknown;\n\t/** Remove form data from storage */\n\tremove: (key: string) => Promise<void> | void;\n}\n\n/**\n * Auto-Save Plugin Configuration\n */\nexport interface AutoSavePluginConfig {\n\t/** Custom storage implementation */\n\tstorage: AutoSaveStorage;\n\t/** Checks whether saving is currently allowed, for example by a consent tool. */\n\tshouldSave?: () => boolean | Promise<boolean>;\n\t/** Called when auto-save succeeds */\n\tonSave?: (data: unknown, context: BuilderActionRuntimeContext<AutoSaveAction>) => void | Promise<void>;\n\t/** Called when auto-save fails */\n\tonError?: (error: string, context: BuilderActionRuntimeContext<AutoSaveAction>) => void | Promise<void>;\n\t/** Custom storage key generator */\n\tgetStorageKey?: (context: BuilderActionRuntimeContext<AutoSaveAction>) => string;\n}\n\n/** Schema for the `auto_save` action configuration. */\nexport const AutoSaveActionSchema = z.object({\n\t/** Optional description for documentation and debugging purposes */\n\tdescription: z.optional(z.string()),\n\t/** Storage key to use (will use generated key if not provided) */\n\tstorageKey: z.optional(z.string()),\n\t/** Whether to include sensitive fields in auto-save */\n\tincludeSensitive: z.optional(z._default(z.boolean(), false)),\n});\n\nexport type AutoSaveAction = BuilderActionConfig<'auto_save', typeof AutoSaveActionSchema>;\n\nconst autoSaveDraftKeyPrefix = 'autosave_';\n\n/** Builds the default storage key shared by auto-save and reset actions. */\nexport function getAutoSaveDraftStorageKey(formId: string): string {\n\treturn `${autoSaveDraftKeyPrefix}${formId}`;\n}\n\n/** Creates a configured `auto_save` action registration. */\nexport function autoSavePlugin(\n\tconfig: AutoSavePluginConfig,\n): BuilderActionRegistration<'auto_save', typeof AutoSaveActionSchema> {\n\tconst { storage } = config;\n\n\tconst handler = async (context: BuilderActionRuntimeContext<AutoSaveAction>) => {\n\t\tconst action = context.config;\n\t\ttry {\n\t\t\tif (config.shouldSave && !(await config.shouldSave())) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\tmessage: 'Auto-save skipped because permission was not granted',\n\t\t\t\t\tshouldContinue: true,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst storageKey =\n\t\t\t\taction.storageKey || config.getStorageKey?.(context) || getAutoSaveDraftStorageKey(context.formId);\n\n\t\t\tconst formData = context.formData;\n\n\t\t\tif (!formData || Object.keys(formData).length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: 'No form data available for auto-save',\n\t\t\t\t\tshouldContinue: true,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tlet dataToSave = formData;\n\t\t\tif (!action.includeSensitive) {\n\t\t\t\tdataToSave = Object.fromEntries(\n\t\t\t\t\tObject.entries(formData).filter(\n\t\t\t\t\t\t([key]) =>\n\t\t\t\t\t\t\t!key.toLowerCase().includes('password') &&\n\t\t\t\t\t\t\t!key.toLowerCase().includes('secret') &&\n\t\t\t\t\t\t\t!key.toLowerCase().includes('token'),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tawait storage.save(storageKey, dataToSave);\n\n\t\t\tif (config.onSave) {\n\t\t\t\tawait config.onSave(dataToSave, context);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tmessage: `Form data auto-saved to ${storageKey}`,\n\t\t\t\tshouldContinue: true,\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst errorMessage = error instanceof Error ? error.message : 'Failed to auto-save';\n\n\t\t\tif (config.onError) {\n\t\t\t\tawait config.onError(errorMessage, context);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: errorMessage,\n\t\t\t\tshouldContinue: true,\n\t\t\t};\n\t\t}\n\t};\n\n\treturn {\n\t\t$type: 'auto_save',\n\t\tschema: AutoSaveActionSchema,\n\t\tmetadata: {\n\t\t\tname: 'Auto Save',\n\t\t\tdescription: 'Automatically save form data to storage',\n\t\t\ticon: 'save',\n\t\t\tdefaultTriggers: ['form_change'],\n\t\t},\n\t\texecute: handler,\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,YAAY,OAAO;AAgCZ,IAAM,uBAAyB,SAAO;AAAA;A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2B,UAAU;AAAA,QAC9C,gBAAgB;AAAA,MACjB;AAAA,IACD,SAAS,OAAO;AACf,YAAM,eAAe,iBAAiB,QAAQ,MAAM,UAAU;AAE9D,UAAI,OAAO,SAAS;AACnB,cAAM,OAAO,QAAQ,cAAc,OAAO;AAAA,MAC3C;AAEA,aAAO;AAAA,QACN,SAAS;AAAA,QACT,OAAO;AAAA,QACP,gBAAgB;AAAA,MACjB;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,UAAU;AAAA,MACT,MAAM;AAAA,MACN,aAAa;AAAA,MACb,MAAM;AAAA,MACN,iBAAiB,CAAC,aAAa;AAAA,IAChC;AAAA,IACA,SAAS;AAAA,EACV;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ServerErrorsInputError,
|
|
3
|
+
groupByPath,
|
|
4
|
+
isRecord,
|
|
5
|
+
issueOf,
|
|
6
|
+
pointerToPath,
|
|
7
|
+
recordsAt,
|
|
8
|
+
serializableParams,
|
|
9
|
+
textOf
|
|
10
|
+
} from "./chunk-5QXT7YAJ.js";
|
|
11
|
+
import {
|
|
12
|
+
FORM_ROOT
|
|
13
|
+
} from "./chunk-PXWVKJGF.js";
|
|
14
|
+
|
|
15
|
+
// src/server-errors/from-problem-details.ts
|
|
16
|
+
var KNOWN = ["type", "title", "status", "detail", "instance", "errors"];
|
|
17
|
+
var ENTRY_MEMBERS = /* @__PURE__ */ new Set(["pointer", "detail", "code"]);
|
|
18
|
+
var ABOUT_BLANK = "about:blank";
|
|
19
|
+
function fromProblemDetails(problem) {
|
|
20
|
+
if (!isRecord(problem) || !KNOWN.some((key) => Object.hasOwn(problem, key))) {
|
|
21
|
+
throw new ServerErrorsInputError(
|
|
22
|
+
"A Problem Details response is an object with a type, title, status, detail or errors."
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
const kind = problem.type === ABOUT_BLANK ? void 0 : textOf(problem.type);
|
|
26
|
+
const entries = recordsAt(problem, "errors", "Problem Details member");
|
|
27
|
+
if (entries === void 0 || entries.length === 0) {
|
|
28
|
+
return { [FORM_ROOT]: issueOf({ type: kind, message: textOf(problem.detail) }) };
|
|
29
|
+
}
|
|
30
|
+
return groupByPath(
|
|
31
|
+
entries.map((entry) => {
|
|
32
|
+
if (entry.pointer === void 0 && entry.detail === void 0 && entry.code === void 0) {
|
|
33
|
+
throw new ServerErrorsInputError(
|
|
34
|
+
"A Problem Details error has none of 'pointer', 'detail' and 'code': nothing says what it is about."
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
if (entry.pointer !== void 0 && typeof entry.pointer !== "string") {
|
|
38
|
+
throw new ServerErrorsInputError("A Problem Details error 'pointer' must be a string.");
|
|
39
|
+
}
|
|
40
|
+
const pointer = textOf(entry.pointer);
|
|
41
|
+
return [
|
|
42
|
+
pointer === void 0 ? FORM_ROOT : pointerToPath(pointer),
|
|
43
|
+
issueOf({
|
|
44
|
+
type: textOf(entry.code) ?? kind,
|
|
45
|
+
message: textOf(entry.detail),
|
|
46
|
+
params: serializableParams(entry, ENTRY_MEMBERS)
|
|
47
|
+
})
|
|
48
|
+
];
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export {
|
|
54
|
+
fromProblemDetails
|
|
55
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/server-errors/from-problem-details.ts"],
|
|
4
|
+
"sourcesContent": ["import { FORM_ROOT, type FormStateErrorsInput } from '@/state-container/types';\nimport {\n\tgroupByPath,\n\tisRecord,\n\tissueOf,\n\tpointerToPath,\n\trecordsAt,\n\tserializableParams,\n\tServerErrorsInputError,\n\ttextOf,\n} from './shared';\n\nconst KNOWN = ['type', 'title', 'status', 'detail', 'instance', 'errors'];\nconst ENTRY_MEMBERS: ReadonlySet<string> = new Set(['pointer', 'detail', 'code']);\n\n/** The RFC 9457 default for a problem with no `type`; it names no kind of problem. */\nconst ABOUT_BLANK = 'about:blank';\n\n/**\n * The input of `setServerErrors` for an RFC 9457 Problem Details response.\n *\n * @remarks\n * Reads the common `errors` extension, a list of `{ pointer?, detail?, code?, ...extra }`: `pointer` is a JSON\n * Pointer (RFC 6901, plain or as a URI fragment) that becomes the dotted path, and no pointer means the form\n * ({@link FORM_ROOT}). An issue's `type` is its `code`, else the problem's `type` (`about:blank` names none), its\n * `message` is its `detail`, and the other members become `params` when they are plain serializable values.\n * Several errors on one path become a list. A problem with no `errors` is one issue on the form, with the\n * problem's `type` and `detail`. Reads no text of its own: `title` and `status` are not carried.\n *\n * @throws {ServerErrorsInputError} For input that is not an object with a recognisable member, for an `errors` that is not a list of objects, for an error with none of `pointer`, `detail` and `code`, for a `pointer` that is not a string, and for a pointer that is not one or names a reserved segment.\n */\nexport function fromProblemDetails(problem: unknown): FormStateErrorsInput {\n\tif (!isRecord(problem) || !KNOWN.some((key) => Object.hasOwn(problem, key))) {\n\t\tthrow new ServerErrorsInputError(\n\t\t\t'A Problem Details response is an object with a type, title, status, detail or errors.',\n\t\t);\n\t}\n\tconst kind = problem.type === ABOUT_BLANK ? undefined : textOf(problem.type);\n\tconst entries = recordsAt(problem, 'errors', 'Problem Details member');\n\tif (entries === undefined || entries.length === 0) {\n\t\treturn { [FORM_ROOT]: issueOf({ type: kind, message: textOf(problem.detail) }) };\n\t}\n\treturn groupByPath(\n\t\tentries.map((entry) => {\n\t\t\tif (entry.pointer === undefined && entry.detail === undefined && entry.code === undefined) {\n\t\t\t\tthrow new ServerErrorsInputError(\n\t\t\t\t\t\"A Problem Details error has none of 'pointer', 'detail' and 'code': nothing says what it is about.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (entry.pointer !== undefined && typeof entry.pointer !== 'string') {\n\t\t\t\tthrow new ServerErrorsInputError(\"A Problem Details error 'pointer' must be a string.\");\n\t\t\t}\n\t\t\tconst pointer = textOf(entry.pointer);\n\t\t\treturn [\n\t\t\t\tpointer === undefined ? FORM_ROOT : pointerToPath(pointer),\n\t\t\t\tissueOf({\n\t\t\t\t\ttype: textOf(entry.code) ?? kind,\n\t\t\t\t\tmessage: textOf(entry.detail),\n\t\t\t\t\tparams: serializableParams(entry, ENTRY_MEMBERS),\n\t\t\t\t}),\n\t\t\t] as const;\n\t\t}),\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;AAYA,IAAM,QAAQ,CAAC,QAAQ,SAAS,UAAU,UAAU,YAAY,QAAQ;AACxE,IAAM,gBAAqC,oBAAI,IAAI,CAAC,WAAW,UAAU,MAAM,CAAC;AAGhF,IAAM,cAAc;AAeb,SAAS,mBAAmB,SAAwC;AAC1E,MAAI,CAAC,SAAS,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,QAAQ,OAAO,OAAO,SAAS,GAAG,CAAC,GAAG;AAC5E,UAAM,IAAI;AAAA,MACT;AAAA,IACD;AAAA,EACD;AACA,QAAM,OAAO,QAAQ,SAAS,cAAc,SAAY,OAAO,QAAQ,IAAI;AAC3E,QAAM,UAAU,UAAU,SAAS,UAAU,wBAAwB;AACrE,MAAI,YAAY,UAAa,QAAQ,WAAW,GAAG;AAClD,WAAO,EAAE,CAAC,SAAS,GAAG,QAAQ,EAAE,MAAM,MAAM,SAAS,OAAO,QAAQ,MAAM,EAAE,CAAC,EAAE;AAAA,EAChF;AACA,SAAO;AAAA,IACN,QAAQ,IAAI,CAAC,UAAU;AACtB,UAAI,MAAM,YAAY,UAAa,MAAM,WAAW,UAAa,MAAM,SAAS,QAAW;AAC1F,cAAM,IAAI;AAAA,UACT;AAAA,QACD;AAAA,MACD;AACA,UAAI,MAAM,YAAY,UAAa,OAAO,MAAM,YAAY,UAAU;AACrE,cAAM,IAAI,uBAAuB,qDAAqD;AAAA,MACvF;AACA,YAAM,UAAU,OAAO,MAAM,OAAO;AACpC,aAA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