@cloudflare/kumo 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +510 -0
- package/LICENSE +21 -0
- package/README.md +521 -0
- package/ai/component-registry.json +3754 -0
- package/ai/component-registry.md +4022 -0
- package/ai/schemas.ts +594 -0
- package/dist/badge-Dc99vsfo.js +51 -0
- package/dist/badge-Dc99vsfo.js.map +1 -0
- package/dist/banner-4fkH6Sbt.js +51 -0
- package/dist/banner-4fkH6Sbt.js.map +1 -0
- package/dist/breadcrumbs-B5SY2CWj.js +132 -0
- package/dist/breadcrumbs-B5SY2CWj.js.map +1 -0
- package/dist/button-E2-hZMZE.js +191 -0
- package/dist/button-E2-hZMZE.js.map +1 -0
- package/dist/catalog.js +229 -0
- package/dist/catalog.js.map +1 -0
- package/dist/checkbox-BexIU_lZ.js +224 -0
- package/dist/checkbox-BexIU_lZ.js.map +1 -0
- package/dist/clipboard-text-BFHWMjmr.js +108 -0
- package/dist/clipboard-text-BFHWMjmr.js.map +1 -0
- package/dist/cn-Bhsu1vx2.js +26 -0
- package/dist/cn-Bhsu1vx2.js.map +1 -0
- package/dist/code-T2wPDiM0.js +60 -0
- package/dist/code-T2wPDiM0.js.map +1 -0
- package/dist/collapsible-OBNkTO48.js +56 -0
- package/dist/collapsible-OBNkTO48.js.map +1 -0
- package/dist/combobox-Dld0kS0U.js +228 -0
- package/dist/combobox-Dld0kS0U.js.map +1 -0
- package/dist/command-line/cli.js +764 -0
- package/dist/command-line/commands/add.js +220 -0
- package/dist/command-line/commands/blocks.js +61 -0
- package/dist/command-line/commands/doc.js +167 -0
- package/dist/command-line/commands/init.js +95 -0
- package/dist/command-line/commands/ls.js +53 -0
- package/dist/command-palette-BgQ680BG.js +393 -0
- package/dist/command-palette-BgQ680BG.js.map +1 -0
- package/dist/components/badge.js +7 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/banner.js +7 -0
- package/dist/components/banner.js.map +1 -0
- package/dist/components/breadcrumbs.js +9 -0
- package/dist/components/breadcrumbs.js.map +1 -0
- package/dist/components/button.js +9 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/checkbox.js +8 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/clipboard-text.js +6 -0
- package/dist/components/clipboard-text.js.map +1 -0
- package/dist/components/code.js +7 -0
- package/dist/components/code.js.map +1 -0
- package/dist/components/collapsible.js +6 -0
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/combobox.js +6 -0
- package/dist/components/combobox.js.map +1 -0
- package/dist/components/command-palette.js +8 -0
- package/dist/components/command-palette.js.map +1 -0
- package/dist/components/date-range-picker.js +6 -0
- package/dist/components/date-range-picker.js.map +1 -0
- package/dist/components/dialog.js +11 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/dropdown.js +6 -0
- package/dist/components/dropdown.js.map +1 -0
- package/dist/components/empty.js +9 -0
- package/dist/components/empty.js.map +1 -0
- package/dist/components/field.js +9 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/grid.js +11 -0
- package/dist/components/grid.js.map +1 -0
- package/dist/components/input.js +11 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/label.js +10 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/layer-card.js +6 -0
- package/dist/components/layer-card.js.map +1 -0
- package/dist/components/link.js +9 -0
- package/dist/components/link.js.map +1 -0
- package/dist/components/loader.js +8 -0
- package/dist/components/loader.js.map +1 -0
- package/dist/components/menubar.js +7 -0
- package/dist/components/menubar.js.map +1 -0
- package/dist/components/meter.js +6 -0
- package/dist/components/meter.js.map +1 -0
- package/dist/components/pagination.js +6 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/popover.js +14 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/radio.js +10 -0
- package/dist/components/radio.js.map +1 -0
- package/dist/components/select.js +6 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/sensitive-input.js +8 -0
- package/dist/components/sensitive-input.js.map +1 -0
- package/dist/components/surface.js +6 -0
- package/dist/components/surface.js.map +1 -0
- package/dist/components/switch.js +8 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table.js +8 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.js +6 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/text.js +6 -0
- package/dist/components/text.js.map +1 -0
- package/dist/components/toast.js +8 -0
- package/dist/components/toast.js.map +1 -0
- package/dist/components/tooltip.js +7 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/date-range-picker-CbKEQ9pi.js +408 -0
- package/dist/date-range-picker-CbKEQ9pi.js.map +1 -0
- package/dist/dialog-B1TaN0oR.js +77 -0
- package/dist/dialog-B1TaN0oR.js.map +1 -0
- package/dist/dropdown-D0rhYKeG.js +263 -0
- package/dist/dropdown-D0rhYKeG.js.map +1 -0
- package/dist/empty-DzCqjea-.js +93 -0
- package/dist/empty-DzCqjea-.js.map +1 -0
- package/dist/field-V3J0Ql_V.js +71 -0
- package/dist/field-V3J0Ql_V.js.map +1 -0
- package/dist/grid-DKajRHh8.js +127 -0
- package/dist/grid-DKajRHh8.js.map +1 -0
- package/dist/index.js +125 -0
- package/dist/index.js.map +1 -0
- package/dist/input-Dqvc2AB_.js +109 -0
- package/dist/input-Dqvc2AB_.js.map +1 -0
- package/dist/input-area-B9qajxvZ.js +57 -0
- package/dist/input-area-B9qajxvZ.js.map +1 -0
- package/dist/input-group-Bl6tgD5-.js +111 -0
- package/dist/input-group-Bl6tgD5-.js.map +1 -0
- package/dist/label-87HQArUG.js +50 -0
- package/dist/label-87HQArUG.js.map +1 -0
- package/dist/layer-card-C8j5Hkkj.js +44 -0
- package/dist/layer-card-C8j5Hkkj.js.map +1 -0
- package/dist/link-6TIZ4JIw.js +73 -0
- package/dist/link-6TIZ4JIw.js.map +1 -0
- package/dist/link-provider-DPBGo-0n.js +22 -0
- package/dist/link-provider-DPBGo-0n.js.map +1 -0
- package/dist/loader-DHGMYlC6.js +105 -0
- package/dist/loader-DHGMYlC6.js.map +1 -0
- package/dist/menubar-DLwLRFB1.js +92 -0
- package/dist/menubar-DLwLRFB1.js.map +1 -0
- package/dist/meter-DKUuvXxS.js +51 -0
- package/dist/meter-DKUuvXxS.js.map +1 -0
- package/dist/pagination-C4HQqodz.js +99 -0
- package/dist/pagination-C4HQqodz.js.map +1 -0
- package/dist/popover-DhdIqrP7.js +178 -0
- package/dist/popover-DhdIqrP7.js.map +1 -0
- package/dist/primitives/accordion.js +6 -0
- package/dist/primitives/accordion.js.map +1 -0
- package/dist/primitives/alert-dialog.js +6 -0
- package/dist/primitives/alert-dialog.js.map +1 -0
- package/dist/primitives/autocomplete.js +6 -0
- package/dist/primitives/autocomplete.js.map +1 -0
- package/dist/primitives/avatar.js +6 -0
- package/dist/primitives/avatar.js.map +1 -0
- package/dist/primitives/button.js +6 -0
- package/dist/primitives/button.js.map +1 -0
- package/dist/primitives/checkbox-group.js +6 -0
- package/dist/primitives/checkbox-group.js.map +1 -0
- package/dist/primitives/checkbox.js +6 -0
- package/dist/primitives/checkbox.js.map +1 -0
- package/dist/primitives/collapsible.js +6 -0
- package/dist/primitives/collapsible.js.map +1 -0
- package/dist/primitives/combobox.js +6 -0
- package/dist/primitives/combobox.js.map +1 -0
- package/dist/primitives/context-menu.js +6 -0
- package/dist/primitives/context-menu.js.map +1 -0
- package/dist/primitives/dialog.js +6 -0
- package/dist/primitives/dialog.js.map +1 -0
- package/dist/primitives/direction-provider.js +7 -0
- package/dist/primitives/direction-provider.js.map +1 -0
- package/dist/primitives/field.js +6 -0
- package/dist/primitives/field.js.map +1 -0
- package/dist/primitives/fieldset.js +6 -0
- package/dist/primitives/fieldset.js.map +1 -0
- package/dist/primitives/form.js +6 -0
- package/dist/primitives/form.js.map +1 -0
- package/dist/primitives/input.js +6 -0
- package/dist/primitives/input.js.map +1 -0
- package/dist/primitives/menu.js +6 -0
- package/dist/primitives/menu.js.map +1 -0
- package/dist/primitives/menubar.js +6 -0
- package/dist/primitives/menubar.js.map +1 -0
- package/dist/primitives/meter.js +6 -0
- package/dist/primitives/meter.js.map +1 -0
- package/dist/primitives/navigation-menu.js +6 -0
- package/dist/primitives/navigation-menu.js.map +1 -0
- package/dist/primitives/number-field.js +6 -0
- package/dist/primitives/number-field.js.map +1 -0
- package/dist/primitives/popover.js +6 -0
- package/dist/primitives/popover.js.map +1 -0
- package/dist/primitives/preview-card.js +6 -0
- package/dist/primitives/preview-card.js.map +1 -0
- package/dist/primitives/progress.js +6 -0
- package/dist/primitives/progress.js.map +1 -0
- package/dist/primitives/radio-group.js +6 -0
- package/dist/primitives/radio-group.js.map +1 -0
- package/dist/primitives/radio.js +6 -0
- package/dist/primitives/radio.js.map +1 -0
- package/dist/primitives/scroll-area.js +6 -0
- package/dist/primitives/scroll-area.js.map +1 -0
- package/dist/primitives/select.js +6 -0
- package/dist/primitives/select.js.map +1 -0
- package/dist/primitives/separator.js +6 -0
- package/dist/primitives/separator.js.map +1 -0
- package/dist/primitives/slider.js +6 -0
- package/dist/primitives/slider.js.map +1 -0
- package/dist/primitives/switch.js +6 -0
- package/dist/primitives/switch.js.map +1 -0
- package/dist/primitives/tabs.js +6 -0
- package/dist/primitives/tabs.js.map +1 -0
- package/dist/primitives/toast.js +6 -0
- package/dist/primitives/toast.js.map +1 -0
- package/dist/primitives/toggle-group.js +6 -0
- package/dist/primitives/toggle-group.js.map +1 -0
- package/dist/primitives/toggle.js +6 -0
- package/dist/primitives/toggle.js.map +1 -0
- package/dist/primitives/toolbar.js +6 -0
- package/dist/primitives/toolbar.js.map +1 -0
- package/dist/primitives/tooltip.js +6 -0
- package/dist/primitives/tooltip.js.map +1 -0
- package/dist/primitives.js +43 -0
- package/dist/primitives.js.map +1 -0
- package/dist/radio-BVAG7hNp.js +125 -0
- package/dist/radio-BVAG7hNp.js.map +1 -0
- package/dist/registry.js +2 -0
- package/dist/registry.js.map +1 -0
- package/dist/schemas-BSdA0fz-.js +3210 -0
- package/dist/schemas-BSdA0fz-.js.map +1 -0
- package/dist/select-B5Vb3zou.js +122 -0
- package/dist/select-B5Vb3zou.js.map +1 -0
- package/dist/sensitive-input-D5HCV04N.js +258 -0
- package/dist/sensitive-input-D5HCV04N.js.map +1 -0
- package/dist/skeleton-line-CtpS1u1J.js +28 -0
- package/dist/skeleton-line-CtpS1u1J.js.map +1 -0
- package/dist/src/blocks/page-header/index.d.ts +2 -0
- package/dist/src/blocks/page-header/index.d.ts.map +1 -0
- package/dist/src/blocks/page-header/page-header.d.ts +38 -0
- package/dist/src/blocks/page-header/page-header.d.ts.map +1 -0
- package/dist/src/blocks/resource-list/index.d.ts +2 -0
- package/dist/src/blocks/resource-list/index.d.ts.map +1 -0
- package/dist/src/blocks/resource-list/resource-list.d.ts +18 -0
- package/dist/src/blocks/resource-list/resource-list.d.ts.map +1 -0
- package/dist/src/catalog/catalog.d.ts +75 -0
- package/dist/src/catalog/catalog.d.ts.map +1 -0
- package/dist/src/catalog/data.d.ts +44 -0
- package/dist/src/catalog/data.d.ts.map +1 -0
- package/dist/src/catalog/index.d.ts +39 -0
- package/dist/src/catalog/index.d.ts.map +1 -0
- package/dist/src/catalog/types.d.ts +226 -0
- package/dist/src/catalog/types.d.ts.map +1 -0
- package/dist/src/catalog/visibility.d.ts +37 -0
- package/dist/src/catalog/visibility.d.ts.map +1 -0
- package/dist/src/command-line/build-cli.d.ts +7 -0
- package/dist/src/command-line/build-cli.d.ts.map +1 -0
- package/dist/src/command-line/cli.d.ts +13 -0
- package/dist/src/command-line/cli.d.ts.map +1 -0
- package/dist/src/command-line/commands/add.d.ts +10 -0
- package/dist/src/command-line/commands/add.d.ts.map +1 -0
- package/dist/src/command-line/commands/blocks.d.ts +10 -0
- package/dist/src/command-line/commands/blocks.d.ts.map +1 -0
- package/dist/src/command-line/commands/doc.d.ts +14 -0
- package/dist/src/command-line/commands/doc.d.ts.map +1 -0
- package/dist/src/command-line/commands/init.d.ts +18 -0
- package/dist/src/command-line/commands/init.d.ts.map +1 -0
- package/dist/src/command-line/commands/ls.d.ts +10 -0
- package/dist/src/command-line/commands/ls.d.ts.map +1 -0
- package/dist/src/command-line/commands/migrate.d.ts +10 -0
- package/dist/src/command-line/commands/migrate.d.ts.map +1 -0
- package/dist/src/command-line/utils/config.d.ts +42 -0
- package/dist/src/command-line/utils/config.d.ts.map +1 -0
- package/dist/src/command-line/utils/transformer.d.ts +17 -0
- package/dist/src/command-line/utils/transformer.d.ts.map +1 -0
- package/dist/src/components/badge/badge.d.ts +46 -0
- package/dist/src/components/badge/badge.d.ts.map +1 -0
- package/dist/src/components/badge/index.d.ts +2 -0
- package/dist/src/components/badge/index.d.ts.map +1 -0
- package/dist/src/components/banner/banner.d.ts +45 -0
- package/dist/src/components/banner/banner.d.ts.map +1 -0
- package/dist/src/components/banner/index.d.ts +2 -0
- package/dist/src/components/banner/index.d.ts.map +1 -0
- package/dist/src/components/breadcrumbs/breadcrumbs.d.ts +43 -0
- package/dist/src/components/breadcrumbs/breadcrumbs.d.ts.map +1 -0
- package/dist/src/components/breadcrumbs/index.d.ts +2 -0
- package/dist/src/components/breadcrumbs/index.d.ts.map +1 -0
- package/dist/src/components/button/button.d.ts +118 -0
- package/dist/src/components/button/button.d.ts.map +1 -0
- package/dist/src/components/button/index.d.ts +2 -0
- package/dist/src/components/button/index.d.ts.map +1 -0
- package/dist/src/components/checkbox/checkbox.d.ts +167 -0
- package/dist/src/components/checkbox/checkbox.d.ts.map +1 -0
- package/dist/src/components/checkbox/index.d.ts +2 -0
- package/dist/src/components/checkbox/index.d.ts.map +1 -0
- package/dist/src/components/clipboard-text/clipboard-text.d.ts +38 -0
- package/dist/src/components/clipboard-text/clipboard-text.d.ts.map +1 -0
- package/dist/src/components/clipboard-text/index.d.ts +2 -0
- package/dist/src/components/clipboard-text/index.d.ts.map +1 -0
- package/dist/src/components/code/code.d.ts +138 -0
- package/dist/src/components/code/code.d.ts.map +1 -0
- package/dist/src/components/code/index.d.ts +4 -0
- package/dist/src/components/code/index.d.ts.map +1 -0
- package/dist/src/components/collapsible/collapsible.d.ts +62 -0
- package/dist/src/components/collapsible/collapsible.d.ts.map +1 -0
- package/dist/src/components/collapsible/index.d.ts +2 -0
- package/dist/src/components/collapsible/index.d.ts.map +1 -0
- package/dist/src/components/combobox/combobox.d.ts +124 -0
- package/dist/src/components/combobox/combobox.d.ts.map +1 -0
- package/dist/src/components/combobox/index.d.ts +2 -0
- package/dist/src/components/combobox/index.d.ts.map +1 -0
- package/dist/src/components/command-palette/command-palette.d.ts +225 -0
- package/dist/src/components/command-palette/command-palette.d.ts.map +1 -0
- package/dist/src/components/command-palette/index.d.ts +3 -0
- package/dist/src/components/command-palette/index.d.ts.map +1 -0
- package/dist/src/components/command-palette/types.d.ts +149 -0
- package/dist/src/components/command-palette/types.d.ts.map +1 -0
- package/dist/src/components/date-range-picker/date-range-picker.d.ts +65 -0
- package/dist/src/components/date-range-picker/date-range-picker.d.ts.map +1 -0
- package/dist/src/components/date-range-picker/index.d.ts +2 -0
- package/dist/src/components/date-range-picker/index.d.ts.map +1 -0
- package/dist/src/components/dialog/dialog.d.ts +121 -0
- package/dist/src/components/dialog/dialog.d.ts.map +1 -0
- package/dist/src/components/dialog/index.d.ts +2 -0
- package/dist/src/components/dialog/index.d.ts.map +1 -0
- package/dist/src/components/dropdown/dropdown.d.ts +58 -0
- package/dist/src/components/dropdown/dropdown.d.ts.map +1 -0
- package/dist/src/components/dropdown/index.d.ts +2 -0
- package/dist/src/components/dropdown/index.d.ts.map +1 -0
- package/dist/src/components/empty/empty.d.ts +34 -0
- package/dist/src/components/empty/empty.d.ts.map +1 -0
- package/dist/src/components/empty/index.d.ts +2 -0
- package/dist/src/components/empty/index.d.ts.map +1 -0
- package/dist/src/components/field/field.d.ts +38 -0
- package/dist/src/components/field/field.d.ts.map +1 -0
- package/dist/src/components/field/index.d.ts +2 -0
- package/dist/src/components/field/index.d.ts.map +1 -0
- package/dist/src/components/grid/grid.d.ts +107 -0
- package/dist/src/components/grid/grid.d.ts.map +1 -0
- package/dist/src/components/grid/index.d.ts +2 -0
- package/dist/src/components/grid/index.d.ts.map +1 -0
- package/dist/src/components/input/index.d.ts +4 -0
- package/dist/src/components/input/index.d.ts.map +1 -0
- package/dist/src/components/input/input-area.d.ts +46 -0
- package/dist/src/components/input/input-area.d.ts.map +1 -0
- package/dist/src/components/input/input-group.d.ts +39 -0
- package/dist/src/components/input/input-group.d.ts.map +1 -0
- package/dist/src/components/input/input.d.ts +157 -0
- package/dist/src/components/input/input.d.ts.map +1 -0
- package/dist/src/components/label/index.d.ts +2 -0
- package/dist/src/components/label/index.d.ts.map +1 -0
- package/dist/src/components/label/label.d.ts +54 -0
- package/dist/src/components/label/label.d.ts.map +1 -0
- package/dist/src/components/layer-card/index.d.ts +2 -0
- package/dist/src/components/layer-card/index.d.ts.map +1 -0
- package/dist/src/components/layer-card/layer-card.d.ts +16 -0
- package/dist/src/components/layer-card/layer-card.d.ts.map +1 -0
- package/dist/src/components/link/index.d.ts +2 -0
- package/dist/src/components/link/index.d.ts.map +1 -0
- package/dist/src/components/link/link.d.ts +35 -0
- package/dist/src/components/link/link.d.ts.map +1 -0
- package/dist/src/components/loader/index.d.ts +3 -0
- package/dist/src/components/loader/index.d.ts.map +1 -0
- package/dist/src/components/loader/loader.d.ts +30 -0
- package/dist/src/components/loader/loader.d.ts.map +1 -0
- package/dist/src/components/loader/skeleton-line.d.ts +10 -0
- package/dist/src/components/loader/skeleton-line.d.ts.map +1 -0
- package/dist/src/components/menubar/index.d.ts +3 -0
- package/dist/src/components/menubar/index.d.ts.map +1 -0
- package/dist/src/components/menubar/menubar.d.ts +22 -0
- package/dist/src/components/menubar/menubar.d.ts.map +1 -0
- package/dist/src/components/menubar/use-menu-navigation.d.ts +8 -0
- package/dist/src/components/menubar/use-menu-navigation.d.ts.map +1 -0
- package/dist/src/components/meter/index.d.ts +2 -0
- package/dist/src/components/meter/index.d.ts.map +1 -0
- package/dist/src/components/meter/meter.d.ts +18 -0
- package/dist/src/components/meter/meter.d.ts.map +1 -0
- package/dist/src/components/pagination/index.d.ts +2 -0
- package/dist/src/components/pagination/index.d.ts.map +1 -0
- package/dist/src/components/pagination/pagination.d.ts +28 -0
- package/dist/src/components/pagination/pagination.d.ts.map +1 -0
- package/dist/src/components/popover/index.d.ts +3 -0
- package/dist/src/components/popover/index.d.ts.map +1 -0
- package/dist/src/components/popover/popover.d.ts +110 -0
- package/dist/src/components/popover/popover.d.ts.map +1 -0
- package/dist/src/components/radio/index.d.ts +2 -0
- package/dist/src/components/radio/index.d.ts.map +1 -0
- package/dist/src/components/radio/radio.d.ts +141 -0
- package/dist/src/components/radio/radio.d.ts.map +1 -0
- package/dist/src/components/select/index.d.ts +2 -0
- package/dist/src/components/select/index.d.ts.map +1 -0
- package/dist/src/components/select/select.d.ts +128 -0
- package/dist/src/components/select/select.d.ts.map +1 -0
- package/dist/src/components/sensitive-input/index.d.ts +2 -0
- package/dist/src/components/sensitive-input/index.d.ts.map +1 -0
- package/dist/src/components/sensitive-input/sensitive-input.d.ts +70 -0
- package/dist/src/components/sensitive-input/sensitive-input.d.ts.map +1 -0
- package/dist/src/components/surface/index.d.ts +2 -0
- package/dist/src/components/surface/index.d.ts.map +1 -0
- package/dist/src/components/surface/surface.d.ts +48 -0
- package/dist/src/components/surface/surface.d.ts.map +1 -0
- package/dist/src/components/switch/index.d.ts +2 -0
- package/dist/src/components/switch/index.d.ts.map +1 -0
- package/dist/src/components/switch/switch.d.ts +155 -0
- package/dist/src/components/switch/switch.d.ts.map +1 -0
- package/dist/src/components/table/index.d.ts +2 -0
- package/dist/src/components/table/index.d.ts.map +1 -0
- package/dist/src/components/table/table.d.ts +54 -0
- package/dist/src/components/table/table.d.ts.map +1 -0
- package/dist/src/components/tabs/index.d.ts +3 -0
- package/dist/src/components/tabs/index.d.ts.map +1 -0
- package/dist/src/components/tabs/tabs.d.ts +64 -0
- package/dist/src/components/tabs/tabs.d.ts.map +1 -0
- package/dist/src/components/text/index.d.ts +2 -0
- package/dist/src/components/text/index.d.ts.map +1 -0
- package/dist/src/components/text/text.d.ts +153 -0
- package/dist/src/components/text/text.d.ts.map +1 -0
- package/dist/src/components/toast/index.d.ts +3 -0
- package/dist/src/components/toast/index.d.ts.map +1 -0
- package/dist/src/components/toast/toast.d.ts +66 -0
- package/dist/src/components/toast/toast.d.ts.map +1 -0
- package/dist/src/components/tooltip/index.d.ts +2 -0
- package/dist/src/components/tooltip/index.d.ts.map +1 -0
- package/dist/src/components/tooltip/tooltip.d.ts +43 -0
- package/dist/src/components/tooltip/tooltip.d.ts.map +1 -0
- package/dist/src/index.d.ts +39 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/primitives/accordion.d.ts +13 -0
- package/dist/src/primitives/accordion.d.ts.map +1 -0
- package/dist/src/primitives/alert-dialog.d.ts +13 -0
- package/dist/src/primitives/alert-dialog.d.ts.map +1 -0
- package/dist/src/primitives/autocomplete.d.ts +13 -0
- package/dist/src/primitives/autocomplete.d.ts.map +1 -0
- package/dist/src/primitives/avatar.d.ts +13 -0
- package/dist/src/primitives/avatar.d.ts.map +1 -0
- package/dist/src/primitives/button.d.ts +13 -0
- package/dist/src/primitives/button.d.ts.map +1 -0
- package/dist/src/primitives/checkbox-group.d.ts +13 -0
- package/dist/src/primitives/checkbox-group.d.ts.map +1 -0
- package/dist/src/primitives/checkbox.d.ts +13 -0
- package/dist/src/primitives/checkbox.d.ts.map +1 -0
- package/dist/src/primitives/collapsible.d.ts +13 -0
- package/dist/src/primitives/collapsible.d.ts.map +1 -0
- package/dist/src/primitives/combobox.d.ts +13 -0
- package/dist/src/primitives/combobox.d.ts.map +1 -0
- package/dist/src/primitives/context-menu.d.ts +13 -0
- package/dist/src/primitives/context-menu.d.ts.map +1 -0
- package/dist/src/primitives/dialog.d.ts +13 -0
- package/dist/src/primitives/dialog.d.ts.map +1 -0
- package/dist/src/primitives/direction-provider.d.ts +13 -0
- package/dist/src/primitives/direction-provider.d.ts.map +1 -0
- package/dist/src/primitives/field.d.ts +13 -0
- package/dist/src/primitives/field.d.ts.map +1 -0
- package/dist/src/primitives/fieldset.d.ts +13 -0
- package/dist/src/primitives/fieldset.d.ts.map +1 -0
- package/dist/src/primitives/form.d.ts +13 -0
- package/dist/src/primitives/form.d.ts.map +1 -0
- package/dist/src/primitives/index.d.ts +52 -0
- package/dist/src/primitives/index.d.ts.map +1 -0
- package/dist/src/primitives/input.d.ts +13 -0
- package/dist/src/primitives/input.d.ts.map +1 -0
- package/dist/src/primitives/menu.d.ts +13 -0
- package/dist/src/primitives/menu.d.ts.map +1 -0
- package/dist/src/primitives/menubar.d.ts +13 -0
- package/dist/src/primitives/menubar.d.ts.map +1 -0
- package/dist/src/primitives/meter.d.ts +13 -0
- package/dist/src/primitives/meter.d.ts.map +1 -0
- package/dist/src/primitives/navigation-menu.d.ts +13 -0
- package/dist/src/primitives/navigation-menu.d.ts.map +1 -0
- package/dist/src/primitives/number-field.d.ts +13 -0
- package/dist/src/primitives/number-field.d.ts.map +1 -0
- package/dist/src/primitives/popover.d.ts +13 -0
- package/dist/src/primitives/popover.d.ts.map +1 -0
- package/dist/src/primitives/preview-card.d.ts +13 -0
- package/dist/src/primitives/preview-card.d.ts.map +1 -0
- package/dist/src/primitives/progress.d.ts +13 -0
- package/dist/src/primitives/progress.d.ts.map +1 -0
- package/dist/src/primitives/radio-group.d.ts +13 -0
- package/dist/src/primitives/radio-group.d.ts.map +1 -0
- package/dist/src/primitives/radio.d.ts +13 -0
- package/dist/src/primitives/radio.d.ts.map +1 -0
- package/dist/src/primitives/scroll-area.d.ts +13 -0
- package/dist/src/primitives/scroll-area.d.ts.map +1 -0
- package/dist/src/primitives/select.d.ts +13 -0
- package/dist/src/primitives/select.d.ts.map +1 -0
- package/dist/src/primitives/separator.d.ts +13 -0
- package/dist/src/primitives/separator.d.ts.map +1 -0
- package/dist/src/primitives/slider.d.ts +13 -0
- package/dist/src/primitives/slider.d.ts.map +1 -0
- package/dist/src/primitives/switch.d.ts +13 -0
- package/dist/src/primitives/switch.d.ts.map +1 -0
- package/dist/src/primitives/tabs.d.ts +13 -0
- package/dist/src/primitives/tabs.d.ts.map +1 -0
- package/dist/src/primitives/toast.d.ts +13 -0
- package/dist/src/primitives/toast.d.ts.map +1 -0
- package/dist/src/primitives/toggle-group.d.ts +13 -0
- package/dist/src/primitives/toggle-group.d.ts.map +1 -0
- package/dist/src/primitives/toggle.d.ts +13 -0
- package/dist/src/primitives/toggle.d.ts.map +1 -0
- package/dist/src/primitives/toolbar.d.ts +13 -0
- package/dist/src/primitives/toolbar.d.ts.map +1 -0
- package/dist/src/primitives/tooltip.d.ts +13 -0
- package/dist/src/primitives/tooltip.d.ts.map +1 -0
- package/dist/src/registry/index.d.ts +8 -0
- package/dist/src/registry/index.d.ts.map +1 -0
- package/dist/src/registry/types.d.ts +191 -0
- package/dist/src/registry/types.d.ts.map +1 -0
- package/dist/src/utils/cn.d.ts +4 -0
- package/dist/src/utils/cn.d.ts.map +1 -0
- package/dist/src/utils/index.d.ts +3 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/link-provider.d.ts +12 -0
- package/dist/src/utils/link-provider.d.ts.map +1 -0
- package/dist/src/utils/prop-examples.d.ts +36 -0
- package/dist/src/utils/prop-examples.d.ts.map +1 -0
- package/dist/styles/kumo-binding.css +190 -0
- package/dist/styles/kumo-standalone.css +2 -0
- package/dist/styles/kumo.css +55 -0
- package/dist/styles/theme-fedramp.css +20 -0
- package/dist/styles/theme-kumo.css +186 -0
- package/dist/surface-BIC6CXiz.js +21 -0
- package/dist/surface-BIC6CXiz.js.map +1 -0
- package/dist/switch-D4duMhJ0.js +257 -0
- package/dist/switch-D4duMhJ0.js.map +1 -0
- package/dist/table-KuvHGpL8.js +153 -0
- package/dist/table-KuvHGpL8.js.map +1 -0
- package/dist/tabs-lQup-IbT.js +85 -0
- package/dist/tabs-lQup-IbT.js.map +1 -0
- package/dist/text-BEhqwMfe.js +97 -0
- package/dist/text-BEhqwMfe.js.map +1 -0
- package/dist/toast-8YyyQuqZ.js +69 -0
- package/dist/toast-8YyyQuqZ.js.map +1 -0
- package/dist/tooltip-DJWsDTWJ.js +85 -0
- package/dist/tooltip-DJWsDTWJ.js.map +1 -0
- package/dist/utils.js +10 -0
- package/dist/utils.js.map +1 -0
- package/dist/vendor-base-ui-DWIDNgE1.js +20446 -0
- package/dist/vendor-base-ui-DWIDNgE1.js.map +1 -0
- package/dist/vendor-floating-ui-BgbEw62H.js +1286 -0
- package/dist/vendor-floating-ui-BgbEw62H.js.map +1 -0
- package/dist/vendor-styling-BQbxAbdS.js +2775 -0
- package/dist/vendor-styling-BQbxAbdS.js.map +1 -0
- package/dist/vendor-utils-DD8jNJwD.js +741 -0
- package/dist/vendor-utils-DD8jNJwD.js.map +1 -0
- package/package.json +444 -0
- package/scripts/component-registry/cache.ts +123 -0
- package/scripts/component-registry/discovery.ts +469 -0
- package/scripts/component-registry/example-cleanup.ts +168 -0
- package/scripts/component-registry/index.test.ts +680 -0
- package/scripts/component-registry/index.ts +874 -0
- package/scripts/component-registry/markdown-generator.ts +222 -0
- package/scripts/component-registry/metadata.ts +643 -0
- package/scripts/component-registry/props-filter.ts +310 -0
- package/scripts/component-registry/schema-generator.ts +326 -0
- package/scripts/component-registry/sub-components.ts +349 -0
- package/scripts/component-registry/types.ts +156 -0
- package/scripts/component-registry/utils.ts +280 -0
- package/scripts/component-registry/variant-parser.ts +261 -0
- package/scripts/css-build.ts +55 -0
- package/scripts/generate-primitives.ts +178 -0
- package/scripts/theme-generator/config.ts +392 -0
- package/scripts/theme-generator/generate-css.ts +250 -0
- package/scripts/theme-generator/index.ts +159 -0
- package/scripts/theme-generator/migrate.ts +560 -0
- package/scripts/theme-generator/types.ts +86 -0
|
@@ -0,0 +1,3210 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var C;
|
|
3
|
+
(function(n) {
|
|
4
|
+
n.assertEqual = (s) => {
|
|
5
|
+
};
|
|
6
|
+
function e(s) {
|
|
7
|
+
}
|
|
8
|
+
n.assertIs = e;
|
|
9
|
+
function t(s) {
|
|
10
|
+
throw new Error();
|
|
11
|
+
}
|
|
12
|
+
n.assertNever = t, n.arrayToEnum = (s) => {
|
|
13
|
+
const r = {};
|
|
14
|
+
for (const o of s)
|
|
15
|
+
r[o] = o;
|
|
16
|
+
return r;
|
|
17
|
+
}, n.getValidEnumValues = (s) => {
|
|
18
|
+
const r = n.objectKeys(s).filter((l) => typeof s[s[l]] != "number"), o = {};
|
|
19
|
+
for (const l of r)
|
|
20
|
+
o[l] = s[l];
|
|
21
|
+
return n.objectValues(o);
|
|
22
|
+
}, n.objectValues = (s) => n.objectKeys(s).map(function(r) {
|
|
23
|
+
return s[r];
|
|
24
|
+
}), n.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
|
|
25
|
+
const r = [];
|
|
26
|
+
for (const o in s)
|
|
27
|
+
Object.prototype.hasOwnProperty.call(s, o) && r.push(o);
|
|
28
|
+
return r;
|
|
29
|
+
}, n.find = (s, r) => {
|
|
30
|
+
for (const o of s)
|
|
31
|
+
if (r(o))
|
|
32
|
+
return o;
|
|
33
|
+
}, n.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && Number.isFinite(s) && Math.floor(s) === s;
|
|
34
|
+
function a(s, r = " | ") {
|
|
35
|
+
return s.map((o) => typeof o == "string" ? `'${o}'` : o).join(r);
|
|
36
|
+
}
|
|
37
|
+
n.joinValues = a, n.jsonStringifyReplacer = (s, r) => typeof r == "bigint" ? r.toString() : r;
|
|
38
|
+
})(C || (C = {}));
|
|
39
|
+
var ye;
|
|
40
|
+
(function(n) {
|
|
41
|
+
n.mergeShapes = (e, t) => ({
|
|
42
|
+
...e,
|
|
43
|
+
...t
|
|
44
|
+
// second overwrites first
|
|
45
|
+
});
|
|
46
|
+
})(ye || (ye = {}));
|
|
47
|
+
const p = C.arrayToEnum([
|
|
48
|
+
"string",
|
|
49
|
+
"nan",
|
|
50
|
+
"number",
|
|
51
|
+
"integer",
|
|
52
|
+
"float",
|
|
53
|
+
"boolean",
|
|
54
|
+
"date",
|
|
55
|
+
"bigint",
|
|
56
|
+
"symbol",
|
|
57
|
+
"function",
|
|
58
|
+
"undefined",
|
|
59
|
+
"null",
|
|
60
|
+
"array",
|
|
61
|
+
"object",
|
|
62
|
+
"unknown",
|
|
63
|
+
"promise",
|
|
64
|
+
"void",
|
|
65
|
+
"never",
|
|
66
|
+
"map",
|
|
67
|
+
"set"
|
|
68
|
+
]), $ = (n) => {
|
|
69
|
+
switch (typeof n) {
|
|
70
|
+
case "undefined":
|
|
71
|
+
return p.undefined;
|
|
72
|
+
case "string":
|
|
73
|
+
return p.string;
|
|
74
|
+
case "number":
|
|
75
|
+
return Number.isNaN(n) ? p.nan : p.number;
|
|
76
|
+
case "boolean":
|
|
77
|
+
return p.boolean;
|
|
78
|
+
case "function":
|
|
79
|
+
return p.function;
|
|
80
|
+
case "bigint":
|
|
81
|
+
return p.bigint;
|
|
82
|
+
case "symbol":
|
|
83
|
+
return p.symbol;
|
|
84
|
+
case "object":
|
|
85
|
+
return Array.isArray(n) ? p.array : n === null ? p.null : n.then && typeof n.then == "function" && n.catch && typeof n.catch == "function" ? p.promise : typeof Map < "u" && n instanceof Map ? p.map : typeof Set < "u" && n instanceof Set ? p.set : typeof Date < "u" && n instanceof Date ? p.date : p.object;
|
|
86
|
+
default:
|
|
87
|
+
return p.unknown;
|
|
88
|
+
}
|
|
89
|
+
}, c = C.arrayToEnum([
|
|
90
|
+
"invalid_type",
|
|
91
|
+
"invalid_literal",
|
|
92
|
+
"custom",
|
|
93
|
+
"invalid_union",
|
|
94
|
+
"invalid_union_discriminator",
|
|
95
|
+
"invalid_enum_value",
|
|
96
|
+
"unrecognized_keys",
|
|
97
|
+
"invalid_arguments",
|
|
98
|
+
"invalid_return_type",
|
|
99
|
+
"invalid_date",
|
|
100
|
+
"invalid_string",
|
|
101
|
+
"too_small",
|
|
102
|
+
"too_big",
|
|
103
|
+
"invalid_intersection_types",
|
|
104
|
+
"not_multiple_of",
|
|
105
|
+
"not_finite"
|
|
106
|
+
]);
|
|
107
|
+
class P extends Error {
|
|
108
|
+
get errors() {
|
|
109
|
+
return this.issues;
|
|
110
|
+
}
|
|
111
|
+
constructor(e) {
|
|
112
|
+
super(), this.issues = [], this.addIssue = (a) => {
|
|
113
|
+
this.issues = [...this.issues, a];
|
|
114
|
+
}, this.addIssues = (a = []) => {
|
|
115
|
+
this.issues = [...this.issues, ...a];
|
|
116
|
+
};
|
|
117
|
+
const t = new.target.prototype;
|
|
118
|
+
Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
|
|
119
|
+
}
|
|
120
|
+
format(e) {
|
|
121
|
+
const t = e || function(r) {
|
|
122
|
+
return r.message;
|
|
123
|
+
}, a = { _errors: [] }, s = (r) => {
|
|
124
|
+
for (const o of r.issues)
|
|
125
|
+
if (o.code === "invalid_union")
|
|
126
|
+
o.unionErrors.map(s);
|
|
127
|
+
else if (o.code === "invalid_return_type")
|
|
128
|
+
s(o.returnTypeError);
|
|
129
|
+
else if (o.code === "invalid_arguments")
|
|
130
|
+
s(o.argumentsError);
|
|
131
|
+
else if (o.path.length === 0)
|
|
132
|
+
a._errors.push(t(o));
|
|
133
|
+
else {
|
|
134
|
+
let l = a, g = 0;
|
|
135
|
+
for (; g < o.path.length; ) {
|
|
136
|
+
const y = o.path[g];
|
|
137
|
+
g === o.path.length - 1 ? (l[y] = l[y] || { _errors: [] }, l[y]._errors.push(t(o))) : l[y] = l[y] || { _errors: [] }, l = l[y], g++;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
return s(this), a;
|
|
142
|
+
}
|
|
143
|
+
static assert(e) {
|
|
144
|
+
if (!(e instanceof P))
|
|
145
|
+
throw new Error(`Not a ZodError: ${e}`);
|
|
146
|
+
}
|
|
147
|
+
toString() {
|
|
148
|
+
return this.message;
|
|
149
|
+
}
|
|
150
|
+
get message() {
|
|
151
|
+
return JSON.stringify(this.issues, C.jsonStringifyReplacer, 2);
|
|
152
|
+
}
|
|
153
|
+
get isEmpty() {
|
|
154
|
+
return this.issues.length === 0;
|
|
155
|
+
}
|
|
156
|
+
flatten(e = (t) => t.message) {
|
|
157
|
+
const t = {}, a = [];
|
|
158
|
+
for (const s of this.issues)
|
|
159
|
+
if (s.path.length > 0) {
|
|
160
|
+
const r = s.path[0];
|
|
161
|
+
t[r] = t[r] || [], t[r].push(e(s));
|
|
162
|
+
} else
|
|
163
|
+
a.push(e(s));
|
|
164
|
+
return { formErrors: a, fieldErrors: t };
|
|
165
|
+
}
|
|
166
|
+
get formErrors() {
|
|
167
|
+
return this.flatten();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
P.create = (n) => new P(n);
|
|
171
|
+
const oe = (n, e) => {
|
|
172
|
+
let t;
|
|
173
|
+
switch (n.code) {
|
|
174
|
+
case c.invalid_type:
|
|
175
|
+
n.received === p.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
|
|
176
|
+
break;
|
|
177
|
+
case c.invalid_literal:
|
|
178
|
+
t = `Invalid literal value, expected ${JSON.stringify(n.expected, C.jsonStringifyReplacer)}`;
|
|
179
|
+
break;
|
|
180
|
+
case c.unrecognized_keys:
|
|
181
|
+
t = `Unrecognized key(s) in object: ${C.joinValues(n.keys, ", ")}`;
|
|
182
|
+
break;
|
|
183
|
+
case c.invalid_union:
|
|
184
|
+
t = "Invalid input";
|
|
185
|
+
break;
|
|
186
|
+
case c.invalid_union_discriminator:
|
|
187
|
+
t = `Invalid discriminator value. Expected ${C.joinValues(n.options)}`;
|
|
188
|
+
break;
|
|
189
|
+
case c.invalid_enum_value:
|
|
190
|
+
t = `Invalid enum value. Expected ${C.joinValues(n.options)}, received '${n.received}'`;
|
|
191
|
+
break;
|
|
192
|
+
case c.invalid_arguments:
|
|
193
|
+
t = "Invalid function arguments";
|
|
194
|
+
break;
|
|
195
|
+
case c.invalid_return_type:
|
|
196
|
+
t = "Invalid function return type";
|
|
197
|
+
break;
|
|
198
|
+
case c.invalid_date:
|
|
199
|
+
t = "Invalid date";
|
|
200
|
+
break;
|
|
201
|
+
case c.invalid_string:
|
|
202
|
+
typeof n.validation == "object" ? "includes" in n.validation ? (t = `Invalid input: must include "${n.validation.includes}"`, typeof n.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${n.validation.position}`)) : "startsWith" in n.validation ? t = `Invalid input: must start with "${n.validation.startsWith}"` : "endsWith" in n.validation ? t = `Invalid input: must end with "${n.validation.endsWith}"` : C.assertNever(n.validation) : n.validation !== "regex" ? t = `Invalid ${n.validation}` : t = "Invalid";
|
|
203
|
+
break;
|
|
204
|
+
case c.too_small:
|
|
205
|
+
n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "more than"} ${n.minimum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "over"} ${n.minimum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "bigint" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(n.minimum))}` : t = "Invalid input";
|
|
206
|
+
break;
|
|
207
|
+
case c.too_big:
|
|
208
|
+
n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "less than"} ${n.maximum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "under"} ${n.maximum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "bigint" ? t = `BigInt must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly" : n.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(n.maximum))}` : t = "Invalid input";
|
|
209
|
+
break;
|
|
210
|
+
case c.custom:
|
|
211
|
+
t = "Invalid input";
|
|
212
|
+
break;
|
|
213
|
+
case c.invalid_intersection_types:
|
|
214
|
+
t = "Intersection results could not be merged";
|
|
215
|
+
break;
|
|
216
|
+
case c.not_multiple_of:
|
|
217
|
+
t = `Number must be a multiple of ${n.multipleOf}`;
|
|
218
|
+
break;
|
|
219
|
+
case c.not_finite:
|
|
220
|
+
t = "Number must be finite";
|
|
221
|
+
break;
|
|
222
|
+
default:
|
|
223
|
+
t = e.defaultError, C.assertNever(n);
|
|
224
|
+
}
|
|
225
|
+
return { message: t };
|
|
226
|
+
};
|
|
227
|
+
let Pe = oe;
|
|
228
|
+
function Ee() {
|
|
229
|
+
return Pe;
|
|
230
|
+
}
|
|
231
|
+
const je = (n) => {
|
|
232
|
+
const { data: e, path: t, errorMaps: a, issueData: s } = n, r = [...t, ...s.path || []], o = {
|
|
233
|
+
...s,
|
|
234
|
+
path: r
|
|
235
|
+
};
|
|
236
|
+
if (s.message !== void 0)
|
|
237
|
+
return {
|
|
238
|
+
...s,
|
|
239
|
+
path: r,
|
|
240
|
+
message: s.message
|
|
241
|
+
};
|
|
242
|
+
let l = "";
|
|
243
|
+
const g = a.filter((y) => !!y).slice().reverse();
|
|
244
|
+
for (const y of g)
|
|
245
|
+
l = y(o, { data: e, defaultError: l }).message;
|
|
246
|
+
return {
|
|
247
|
+
...s,
|
|
248
|
+
path: r,
|
|
249
|
+
message: l
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
function u(n, e) {
|
|
253
|
+
const t = Ee(), a = je({
|
|
254
|
+
issueData: e,
|
|
255
|
+
data: n.data,
|
|
256
|
+
path: n.path,
|
|
257
|
+
errorMaps: [
|
|
258
|
+
n.common.contextualErrorMap,
|
|
259
|
+
// contextual error map is first priority
|
|
260
|
+
n.schemaErrorMap,
|
|
261
|
+
// then schema-bound map if available
|
|
262
|
+
t,
|
|
263
|
+
// then global override map
|
|
264
|
+
t === oe ? void 0 : oe
|
|
265
|
+
// then global default map
|
|
266
|
+
].filter((s) => !!s)
|
|
267
|
+
});
|
|
268
|
+
n.common.issues.push(a);
|
|
269
|
+
}
|
|
270
|
+
class R {
|
|
271
|
+
constructor() {
|
|
272
|
+
this.value = "valid";
|
|
273
|
+
}
|
|
274
|
+
dirty() {
|
|
275
|
+
this.value === "valid" && (this.value = "dirty");
|
|
276
|
+
}
|
|
277
|
+
abort() {
|
|
278
|
+
this.value !== "aborted" && (this.value = "aborted");
|
|
279
|
+
}
|
|
280
|
+
static mergeArray(e, t) {
|
|
281
|
+
const a = [];
|
|
282
|
+
for (const s of t) {
|
|
283
|
+
if (s.status === "aborted")
|
|
284
|
+
return k;
|
|
285
|
+
s.status === "dirty" && e.dirty(), a.push(s.value);
|
|
286
|
+
}
|
|
287
|
+
return { status: e.value, value: a };
|
|
288
|
+
}
|
|
289
|
+
static async mergeObjectAsync(e, t) {
|
|
290
|
+
const a = [];
|
|
291
|
+
for (const s of t) {
|
|
292
|
+
const r = await s.key, o = await s.value;
|
|
293
|
+
a.push({
|
|
294
|
+
key: r,
|
|
295
|
+
value: o
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
return R.mergeObjectSync(e, a);
|
|
299
|
+
}
|
|
300
|
+
static mergeObjectSync(e, t) {
|
|
301
|
+
const a = {};
|
|
302
|
+
for (const s of t) {
|
|
303
|
+
const { key: r, value: o } = s;
|
|
304
|
+
if (r.status === "aborted" || o.status === "aborted")
|
|
305
|
+
return k;
|
|
306
|
+
r.status === "dirty" && e.dirty(), o.status === "dirty" && e.dirty(), r.value !== "__proto__" && (typeof o.value < "u" || s.alwaysSet) && (a[r.value] = o.value);
|
|
307
|
+
}
|
|
308
|
+
return { status: e.value, value: a };
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
const k = Object.freeze({
|
|
312
|
+
status: "aborted"
|
|
313
|
+
}), Y = (n) => ({ status: "dirty", value: n }), Z = (n) => ({ status: "valid", value: n }), _e = (n) => n.status === "aborted", ve = (n) => n.status === "dirty", U = (n) => n.status === "valid", ee = (n) => typeof Promise < "u" && n instanceof Promise;
|
|
314
|
+
var f;
|
|
315
|
+
(function(n) {
|
|
316
|
+
n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e?.message;
|
|
317
|
+
})(f || (f = {}));
|
|
318
|
+
class E {
|
|
319
|
+
constructor(e, t, a, s) {
|
|
320
|
+
this._cachedPath = [], this.parent = e, this.data = t, this._path = a, this._key = s;
|
|
321
|
+
}
|
|
322
|
+
get path() {
|
|
323
|
+
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
const xe = (n, e) => {
|
|
327
|
+
if (U(e))
|
|
328
|
+
return { success: !0, data: e.value };
|
|
329
|
+
if (!n.common.issues.length)
|
|
330
|
+
throw new Error("Validation failed but no issues detected.");
|
|
331
|
+
return {
|
|
332
|
+
success: !1,
|
|
333
|
+
get error() {
|
|
334
|
+
if (this._error)
|
|
335
|
+
return this._error;
|
|
336
|
+
const t = new P(n.common.issues);
|
|
337
|
+
return this._error = t, this._error;
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
function S(n) {
|
|
342
|
+
if (!n)
|
|
343
|
+
return {};
|
|
344
|
+
const { errorMap: e, invalid_type_error: t, required_error: a, description: s } = n;
|
|
345
|
+
if (e && (t || a))
|
|
346
|
+
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
347
|
+
return e ? { errorMap: e, description: s } : { errorMap: (o, l) => {
|
|
348
|
+
const { message: g } = n;
|
|
349
|
+
return o.code === "invalid_enum_value" ? { message: g ?? l.defaultError } : typeof l.data > "u" ? { message: g ?? a ?? l.defaultError } : o.code !== "invalid_type" ? { message: l.defaultError } : { message: g ?? t ?? l.defaultError };
|
|
350
|
+
}, description: s };
|
|
351
|
+
}
|
|
352
|
+
class T {
|
|
353
|
+
get description() {
|
|
354
|
+
return this._def.description;
|
|
355
|
+
}
|
|
356
|
+
_getType(e) {
|
|
357
|
+
return $(e.data);
|
|
358
|
+
}
|
|
359
|
+
_getOrReturnCtx(e, t) {
|
|
360
|
+
return t || {
|
|
361
|
+
common: e.parent.common,
|
|
362
|
+
data: e.data,
|
|
363
|
+
parsedType: $(e.data),
|
|
364
|
+
schemaErrorMap: this._def.errorMap,
|
|
365
|
+
path: e.path,
|
|
366
|
+
parent: e.parent
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
_processInputParams(e) {
|
|
370
|
+
return {
|
|
371
|
+
status: new R(),
|
|
372
|
+
ctx: {
|
|
373
|
+
common: e.parent.common,
|
|
374
|
+
data: e.data,
|
|
375
|
+
parsedType: $(e.data),
|
|
376
|
+
schemaErrorMap: this._def.errorMap,
|
|
377
|
+
path: e.path,
|
|
378
|
+
parent: e.parent
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
_parseSync(e) {
|
|
383
|
+
const t = this._parse(e);
|
|
384
|
+
if (ee(t))
|
|
385
|
+
throw new Error("Synchronous parse encountered promise.");
|
|
386
|
+
return t;
|
|
387
|
+
}
|
|
388
|
+
_parseAsync(e) {
|
|
389
|
+
const t = this._parse(e);
|
|
390
|
+
return Promise.resolve(t);
|
|
391
|
+
}
|
|
392
|
+
parse(e, t) {
|
|
393
|
+
const a = this.safeParse(e, t);
|
|
394
|
+
if (a.success)
|
|
395
|
+
return a.data;
|
|
396
|
+
throw a.error;
|
|
397
|
+
}
|
|
398
|
+
safeParse(e, t) {
|
|
399
|
+
const a = {
|
|
400
|
+
common: {
|
|
401
|
+
issues: [],
|
|
402
|
+
async: t?.async ?? !1,
|
|
403
|
+
contextualErrorMap: t?.errorMap
|
|
404
|
+
},
|
|
405
|
+
path: t?.path || [],
|
|
406
|
+
schemaErrorMap: this._def.errorMap,
|
|
407
|
+
parent: null,
|
|
408
|
+
data: e,
|
|
409
|
+
parsedType: $(e)
|
|
410
|
+
}, s = this._parseSync({ data: e, path: a.path, parent: a });
|
|
411
|
+
return xe(a, s);
|
|
412
|
+
}
|
|
413
|
+
"~validate"(e) {
|
|
414
|
+
const t = {
|
|
415
|
+
common: {
|
|
416
|
+
issues: [],
|
|
417
|
+
async: !!this["~standard"].async
|
|
418
|
+
},
|
|
419
|
+
path: [],
|
|
420
|
+
schemaErrorMap: this._def.errorMap,
|
|
421
|
+
parent: null,
|
|
422
|
+
data: e,
|
|
423
|
+
parsedType: $(e)
|
|
424
|
+
};
|
|
425
|
+
if (!this["~standard"].async)
|
|
426
|
+
try {
|
|
427
|
+
const a = this._parseSync({ data: e, path: [], parent: t });
|
|
428
|
+
return U(a) ? {
|
|
429
|
+
value: a.value
|
|
430
|
+
} : {
|
|
431
|
+
issues: t.common.issues
|
|
432
|
+
};
|
|
433
|
+
} catch (a) {
|
|
434
|
+
a?.message?.toLowerCase()?.includes("encountered") && (this["~standard"].async = !0), t.common = {
|
|
435
|
+
issues: [],
|
|
436
|
+
async: !0
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
return this._parseAsync({ data: e, path: [], parent: t }).then((a) => U(a) ? {
|
|
440
|
+
value: a.value
|
|
441
|
+
} : {
|
|
442
|
+
issues: t.common.issues
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
async parseAsync(e, t) {
|
|
446
|
+
const a = await this.safeParseAsync(e, t);
|
|
447
|
+
if (a.success)
|
|
448
|
+
return a.data;
|
|
449
|
+
throw a.error;
|
|
450
|
+
}
|
|
451
|
+
async safeParseAsync(e, t) {
|
|
452
|
+
const a = {
|
|
453
|
+
common: {
|
|
454
|
+
issues: [],
|
|
455
|
+
contextualErrorMap: t?.errorMap,
|
|
456
|
+
async: !0
|
|
457
|
+
},
|
|
458
|
+
path: t?.path || [],
|
|
459
|
+
schemaErrorMap: this._def.errorMap,
|
|
460
|
+
parent: null,
|
|
461
|
+
data: e,
|
|
462
|
+
parsedType: $(e)
|
|
463
|
+
}, s = this._parse({ data: e, path: a.path, parent: a }), r = await (ee(s) ? s : Promise.resolve(s));
|
|
464
|
+
return xe(a, r);
|
|
465
|
+
}
|
|
466
|
+
refine(e, t) {
|
|
467
|
+
const a = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
|
|
468
|
+
return this._refinement((s, r) => {
|
|
469
|
+
const o = e(s), l = () => r.addIssue({
|
|
470
|
+
code: c.custom,
|
|
471
|
+
...a(s)
|
|
472
|
+
});
|
|
473
|
+
return typeof Promise < "u" && o instanceof Promise ? o.then((g) => g ? !0 : (l(), !1)) : o ? !0 : (l(), !1);
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
refinement(e, t) {
|
|
477
|
+
return this._refinement((a, s) => e(a) ? !0 : (s.addIssue(typeof t == "function" ? t(a, s) : t), !1));
|
|
478
|
+
}
|
|
479
|
+
_refinement(e) {
|
|
480
|
+
return new W({
|
|
481
|
+
schema: this,
|
|
482
|
+
typeName: b.ZodEffects,
|
|
483
|
+
effect: { type: "refinement", refinement: e }
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
superRefine(e) {
|
|
487
|
+
return this._refinement(e);
|
|
488
|
+
}
|
|
489
|
+
constructor(e) {
|
|
490
|
+
this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
|
|
491
|
+
version: 1,
|
|
492
|
+
vendor: "zod",
|
|
493
|
+
validate: (t) => this["~validate"](t)
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
optional() {
|
|
497
|
+
return L.create(this, this._def);
|
|
498
|
+
}
|
|
499
|
+
nullable() {
|
|
500
|
+
return G.create(this, this._def);
|
|
501
|
+
}
|
|
502
|
+
nullish() {
|
|
503
|
+
return this.nullable().optional();
|
|
504
|
+
}
|
|
505
|
+
array() {
|
|
506
|
+
return I.create(this);
|
|
507
|
+
}
|
|
508
|
+
promise() {
|
|
509
|
+
return re.create(this, this._def);
|
|
510
|
+
}
|
|
511
|
+
or(e) {
|
|
512
|
+
return ae.create([this, e], this._def);
|
|
513
|
+
}
|
|
514
|
+
and(e) {
|
|
515
|
+
return ne.create(this, e, this._def);
|
|
516
|
+
}
|
|
517
|
+
transform(e) {
|
|
518
|
+
return new W({
|
|
519
|
+
...S(this._def),
|
|
520
|
+
schema: this,
|
|
521
|
+
typeName: b.ZodEffects,
|
|
522
|
+
effect: { type: "transform", transform: e }
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
default(e) {
|
|
526
|
+
const t = typeof e == "function" ? e : () => e;
|
|
527
|
+
return new he({
|
|
528
|
+
...S(this._def),
|
|
529
|
+
innerType: this,
|
|
530
|
+
defaultValue: t,
|
|
531
|
+
typeName: b.ZodDefault
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
brand() {
|
|
535
|
+
return new st({
|
|
536
|
+
typeName: b.ZodBranded,
|
|
537
|
+
type: this,
|
|
538
|
+
...S(this._def)
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
catch(e) {
|
|
542
|
+
const t = typeof e == "function" ? e : () => e;
|
|
543
|
+
return new fe({
|
|
544
|
+
...S(this._def),
|
|
545
|
+
innerType: this,
|
|
546
|
+
catchValue: t,
|
|
547
|
+
typeName: b.ZodCatch
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
describe(e) {
|
|
551
|
+
const t = this.constructor;
|
|
552
|
+
return new t({
|
|
553
|
+
...this._def,
|
|
554
|
+
description: e
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
pipe(e) {
|
|
558
|
+
return ge.create(this, e);
|
|
559
|
+
}
|
|
560
|
+
readonly() {
|
|
561
|
+
return me.create(this);
|
|
562
|
+
}
|
|
563
|
+
isOptional() {
|
|
564
|
+
return this.safeParse(void 0).success;
|
|
565
|
+
}
|
|
566
|
+
isNullable() {
|
|
567
|
+
return this.safeParse(null).success;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
const $e = /^c[^\s-]{8,}$/i, Le = /^[0-9a-z]+$/, Ve = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Me = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, ze = /^[a-z0-9_-]{21}$/i, De = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Be = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Ue = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Fe = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
571
|
+
let ie;
|
|
572
|
+
const qe = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, We = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Ge = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Je = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Ye = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, He = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Ae = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Qe = new RegExp(`^${Ae}$`);
|
|
573
|
+
function Re(n) {
|
|
574
|
+
let e = "[0-5]\\d";
|
|
575
|
+
n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
576
|
+
const t = n.precision ? "+" : "?";
|
|
577
|
+
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
|
|
578
|
+
}
|
|
579
|
+
function Xe(n) {
|
|
580
|
+
return new RegExp(`^${Re(n)}$`);
|
|
581
|
+
}
|
|
582
|
+
function Ke(n) {
|
|
583
|
+
let e = `${Ae}T${Re(n)}`;
|
|
584
|
+
const t = [];
|
|
585
|
+
return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
586
|
+
}
|
|
587
|
+
function et(n, e) {
|
|
588
|
+
return !!((e === "v4" || !e) && qe.test(n) || (e === "v6" || !e) && Ge.test(n));
|
|
589
|
+
}
|
|
590
|
+
function tt(n, e) {
|
|
591
|
+
if (!De.test(n))
|
|
592
|
+
return !1;
|
|
593
|
+
try {
|
|
594
|
+
const [t] = n.split(".");
|
|
595
|
+
if (!t)
|
|
596
|
+
return !1;
|
|
597
|
+
const a = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), s = JSON.parse(atob(a));
|
|
598
|
+
return !(typeof s != "object" || s === null || "typ" in s && s?.typ !== "JWT" || !s.alg || e && s.alg !== e);
|
|
599
|
+
} catch {
|
|
600
|
+
return !1;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
function at(n, e) {
|
|
604
|
+
return !!((e === "v4" || !e) && We.test(n) || (e === "v6" || !e) && Je.test(n));
|
|
605
|
+
}
|
|
606
|
+
class j extends T {
|
|
607
|
+
_parse(e) {
|
|
608
|
+
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
|
|
609
|
+
const r = this._getOrReturnCtx(e);
|
|
610
|
+
return u(r, {
|
|
611
|
+
code: c.invalid_type,
|
|
612
|
+
expected: p.string,
|
|
613
|
+
received: r.parsedType
|
|
614
|
+
}), k;
|
|
615
|
+
}
|
|
616
|
+
const a = new R();
|
|
617
|
+
let s;
|
|
618
|
+
for (const r of this._def.checks)
|
|
619
|
+
if (r.kind === "min")
|
|
620
|
+
e.data.length < r.value && (s = this._getOrReturnCtx(e, s), u(s, {
|
|
621
|
+
code: c.too_small,
|
|
622
|
+
minimum: r.value,
|
|
623
|
+
type: "string",
|
|
624
|
+
inclusive: !0,
|
|
625
|
+
exact: !1,
|
|
626
|
+
message: r.message
|
|
627
|
+
}), a.dirty());
|
|
628
|
+
else if (r.kind === "max")
|
|
629
|
+
e.data.length > r.value && (s = this._getOrReturnCtx(e, s), u(s, {
|
|
630
|
+
code: c.too_big,
|
|
631
|
+
maximum: r.value,
|
|
632
|
+
type: "string",
|
|
633
|
+
inclusive: !0,
|
|
634
|
+
exact: !1,
|
|
635
|
+
message: r.message
|
|
636
|
+
}), a.dirty());
|
|
637
|
+
else if (r.kind === "length") {
|
|
638
|
+
const o = e.data.length > r.value, l = e.data.length < r.value;
|
|
639
|
+
(o || l) && (s = this._getOrReturnCtx(e, s), o ? u(s, {
|
|
640
|
+
code: c.too_big,
|
|
641
|
+
maximum: r.value,
|
|
642
|
+
type: "string",
|
|
643
|
+
inclusive: !0,
|
|
644
|
+
exact: !0,
|
|
645
|
+
message: r.message
|
|
646
|
+
}) : l && u(s, {
|
|
647
|
+
code: c.too_small,
|
|
648
|
+
minimum: r.value,
|
|
649
|
+
type: "string",
|
|
650
|
+
inclusive: !0,
|
|
651
|
+
exact: !0,
|
|
652
|
+
message: r.message
|
|
653
|
+
}), a.dirty());
|
|
654
|
+
} else if (r.kind === "email")
|
|
655
|
+
Ue.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
656
|
+
validation: "email",
|
|
657
|
+
code: c.invalid_string,
|
|
658
|
+
message: r.message
|
|
659
|
+
}), a.dirty());
|
|
660
|
+
else if (r.kind === "emoji")
|
|
661
|
+
ie || (ie = new RegExp(Fe, "u")), ie.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
662
|
+
validation: "emoji",
|
|
663
|
+
code: c.invalid_string,
|
|
664
|
+
message: r.message
|
|
665
|
+
}), a.dirty());
|
|
666
|
+
else if (r.kind === "uuid")
|
|
667
|
+
Me.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
668
|
+
validation: "uuid",
|
|
669
|
+
code: c.invalid_string,
|
|
670
|
+
message: r.message
|
|
671
|
+
}), a.dirty());
|
|
672
|
+
else if (r.kind === "nanoid")
|
|
673
|
+
ze.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
674
|
+
validation: "nanoid",
|
|
675
|
+
code: c.invalid_string,
|
|
676
|
+
message: r.message
|
|
677
|
+
}), a.dirty());
|
|
678
|
+
else if (r.kind === "cuid")
|
|
679
|
+
$e.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
680
|
+
validation: "cuid",
|
|
681
|
+
code: c.invalid_string,
|
|
682
|
+
message: r.message
|
|
683
|
+
}), a.dirty());
|
|
684
|
+
else if (r.kind === "cuid2")
|
|
685
|
+
Le.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
686
|
+
validation: "cuid2",
|
|
687
|
+
code: c.invalid_string,
|
|
688
|
+
message: r.message
|
|
689
|
+
}), a.dirty());
|
|
690
|
+
else if (r.kind === "ulid")
|
|
691
|
+
Ve.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
692
|
+
validation: "ulid",
|
|
693
|
+
code: c.invalid_string,
|
|
694
|
+
message: r.message
|
|
695
|
+
}), a.dirty());
|
|
696
|
+
else if (r.kind === "url")
|
|
697
|
+
try {
|
|
698
|
+
new URL(e.data);
|
|
699
|
+
} catch {
|
|
700
|
+
s = this._getOrReturnCtx(e, s), u(s, {
|
|
701
|
+
validation: "url",
|
|
702
|
+
code: c.invalid_string,
|
|
703
|
+
message: r.message
|
|
704
|
+
}), a.dirty();
|
|
705
|
+
}
|
|
706
|
+
else r.kind === "regex" ? (r.regex.lastIndex = 0, r.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
707
|
+
validation: "regex",
|
|
708
|
+
code: c.invalid_string,
|
|
709
|
+
message: r.message
|
|
710
|
+
}), a.dirty())) : r.kind === "trim" ? e.data = e.data.trim() : r.kind === "includes" ? e.data.includes(r.value, r.position) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
711
|
+
code: c.invalid_string,
|
|
712
|
+
validation: { includes: r.value, position: r.position },
|
|
713
|
+
message: r.message
|
|
714
|
+
}), a.dirty()) : r.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : r.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : r.kind === "startsWith" ? e.data.startsWith(r.value) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
715
|
+
code: c.invalid_string,
|
|
716
|
+
validation: { startsWith: r.value },
|
|
717
|
+
message: r.message
|
|
718
|
+
}), a.dirty()) : r.kind === "endsWith" ? e.data.endsWith(r.value) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
719
|
+
code: c.invalid_string,
|
|
720
|
+
validation: { endsWith: r.value },
|
|
721
|
+
message: r.message
|
|
722
|
+
}), a.dirty()) : r.kind === "datetime" ? Ke(r).test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
723
|
+
code: c.invalid_string,
|
|
724
|
+
validation: "datetime",
|
|
725
|
+
message: r.message
|
|
726
|
+
}), a.dirty()) : r.kind === "date" ? Qe.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
727
|
+
code: c.invalid_string,
|
|
728
|
+
validation: "date",
|
|
729
|
+
message: r.message
|
|
730
|
+
}), a.dirty()) : r.kind === "time" ? Xe(r).test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
731
|
+
code: c.invalid_string,
|
|
732
|
+
validation: "time",
|
|
733
|
+
message: r.message
|
|
734
|
+
}), a.dirty()) : r.kind === "duration" ? Be.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
735
|
+
validation: "duration",
|
|
736
|
+
code: c.invalid_string,
|
|
737
|
+
message: r.message
|
|
738
|
+
}), a.dirty()) : r.kind === "ip" ? et(e.data, r.version) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
739
|
+
validation: "ip",
|
|
740
|
+
code: c.invalid_string,
|
|
741
|
+
message: r.message
|
|
742
|
+
}), a.dirty()) : r.kind === "jwt" ? tt(e.data, r.alg) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
743
|
+
validation: "jwt",
|
|
744
|
+
code: c.invalid_string,
|
|
745
|
+
message: r.message
|
|
746
|
+
}), a.dirty()) : r.kind === "cidr" ? at(e.data, r.version) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
747
|
+
validation: "cidr",
|
|
748
|
+
code: c.invalid_string,
|
|
749
|
+
message: r.message
|
|
750
|
+
}), a.dirty()) : r.kind === "base64" ? Ye.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
751
|
+
validation: "base64",
|
|
752
|
+
code: c.invalid_string,
|
|
753
|
+
message: r.message
|
|
754
|
+
}), a.dirty()) : r.kind === "base64url" ? He.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
755
|
+
validation: "base64url",
|
|
756
|
+
code: c.invalid_string,
|
|
757
|
+
message: r.message
|
|
758
|
+
}), a.dirty()) : C.assertNever(r);
|
|
759
|
+
return { status: a.value, value: e.data };
|
|
760
|
+
}
|
|
761
|
+
_regex(e, t, a) {
|
|
762
|
+
return this.refinement((s) => e.test(s), {
|
|
763
|
+
validation: t,
|
|
764
|
+
code: c.invalid_string,
|
|
765
|
+
...f.errToObj(a)
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
_addCheck(e) {
|
|
769
|
+
return new j({
|
|
770
|
+
...this._def,
|
|
771
|
+
checks: [...this._def.checks, e]
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
email(e) {
|
|
775
|
+
return this._addCheck({ kind: "email", ...f.errToObj(e) });
|
|
776
|
+
}
|
|
777
|
+
url(e) {
|
|
778
|
+
return this._addCheck({ kind: "url", ...f.errToObj(e) });
|
|
779
|
+
}
|
|
780
|
+
emoji(e) {
|
|
781
|
+
return this._addCheck({ kind: "emoji", ...f.errToObj(e) });
|
|
782
|
+
}
|
|
783
|
+
uuid(e) {
|
|
784
|
+
return this._addCheck({ kind: "uuid", ...f.errToObj(e) });
|
|
785
|
+
}
|
|
786
|
+
nanoid(e) {
|
|
787
|
+
return this._addCheck({ kind: "nanoid", ...f.errToObj(e) });
|
|
788
|
+
}
|
|
789
|
+
cuid(e) {
|
|
790
|
+
return this._addCheck({ kind: "cuid", ...f.errToObj(e) });
|
|
791
|
+
}
|
|
792
|
+
cuid2(e) {
|
|
793
|
+
return this._addCheck({ kind: "cuid2", ...f.errToObj(e) });
|
|
794
|
+
}
|
|
795
|
+
ulid(e) {
|
|
796
|
+
return this._addCheck({ kind: "ulid", ...f.errToObj(e) });
|
|
797
|
+
}
|
|
798
|
+
base64(e) {
|
|
799
|
+
return this._addCheck({ kind: "base64", ...f.errToObj(e) });
|
|
800
|
+
}
|
|
801
|
+
base64url(e) {
|
|
802
|
+
return this._addCheck({
|
|
803
|
+
kind: "base64url",
|
|
804
|
+
...f.errToObj(e)
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
jwt(e) {
|
|
808
|
+
return this._addCheck({ kind: "jwt", ...f.errToObj(e) });
|
|
809
|
+
}
|
|
810
|
+
ip(e) {
|
|
811
|
+
return this._addCheck({ kind: "ip", ...f.errToObj(e) });
|
|
812
|
+
}
|
|
813
|
+
cidr(e) {
|
|
814
|
+
return this._addCheck({ kind: "cidr", ...f.errToObj(e) });
|
|
815
|
+
}
|
|
816
|
+
datetime(e) {
|
|
817
|
+
return typeof e == "string" ? this._addCheck({
|
|
818
|
+
kind: "datetime",
|
|
819
|
+
precision: null,
|
|
820
|
+
offset: !1,
|
|
821
|
+
local: !1,
|
|
822
|
+
message: e
|
|
823
|
+
}) : this._addCheck({
|
|
824
|
+
kind: "datetime",
|
|
825
|
+
precision: typeof e?.precision > "u" ? null : e?.precision,
|
|
826
|
+
offset: e?.offset ?? !1,
|
|
827
|
+
local: e?.local ?? !1,
|
|
828
|
+
...f.errToObj(e?.message)
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
date(e) {
|
|
832
|
+
return this._addCheck({ kind: "date", message: e });
|
|
833
|
+
}
|
|
834
|
+
time(e) {
|
|
835
|
+
return typeof e == "string" ? this._addCheck({
|
|
836
|
+
kind: "time",
|
|
837
|
+
precision: null,
|
|
838
|
+
message: e
|
|
839
|
+
}) : this._addCheck({
|
|
840
|
+
kind: "time",
|
|
841
|
+
precision: typeof e?.precision > "u" ? null : e?.precision,
|
|
842
|
+
...f.errToObj(e?.message)
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
duration(e) {
|
|
846
|
+
return this._addCheck({ kind: "duration", ...f.errToObj(e) });
|
|
847
|
+
}
|
|
848
|
+
regex(e, t) {
|
|
849
|
+
return this._addCheck({
|
|
850
|
+
kind: "regex",
|
|
851
|
+
regex: e,
|
|
852
|
+
...f.errToObj(t)
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
includes(e, t) {
|
|
856
|
+
return this._addCheck({
|
|
857
|
+
kind: "includes",
|
|
858
|
+
value: e,
|
|
859
|
+
position: t?.position,
|
|
860
|
+
...f.errToObj(t?.message)
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
startsWith(e, t) {
|
|
864
|
+
return this._addCheck({
|
|
865
|
+
kind: "startsWith",
|
|
866
|
+
value: e,
|
|
867
|
+
...f.errToObj(t)
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
endsWith(e, t) {
|
|
871
|
+
return this._addCheck({
|
|
872
|
+
kind: "endsWith",
|
|
873
|
+
value: e,
|
|
874
|
+
...f.errToObj(t)
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
min(e, t) {
|
|
878
|
+
return this._addCheck({
|
|
879
|
+
kind: "min",
|
|
880
|
+
value: e,
|
|
881
|
+
...f.errToObj(t)
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
max(e, t) {
|
|
885
|
+
return this._addCheck({
|
|
886
|
+
kind: "max",
|
|
887
|
+
value: e,
|
|
888
|
+
...f.errToObj(t)
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
length(e, t) {
|
|
892
|
+
return this._addCheck({
|
|
893
|
+
kind: "length",
|
|
894
|
+
value: e,
|
|
895
|
+
...f.errToObj(t)
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
/**
|
|
899
|
+
* Equivalent to `.min(1)`
|
|
900
|
+
*/
|
|
901
|
+
nonempty(e) {
|
|
902
|
+
return this.min(1, f.errToObj(e));
|
|
903
|
+
}
|
|
904
|
+
trim() {
|
|
905
|
+
return new j({
|
|
906
|
+
...this._def,
|
|
907
|
+
checks: [...this._def.checks, { kind: "trim" }]
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
toLowerCase() {
|
|
911
|
+
return new j({
|
|
912
|
+
...this._def,
|
|
913
|
+
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
toUpperCase() {
|
|
917
|
+
return new j({
|
|
918
|
+
...this._def,
|
|
919
|
+
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
get isDatetime() {
|
|
923
|
+
return !!this._def.checks.find((e) => e.kind === "datetime");
|
|
924
|
+
}
|
|
925
|
+
get isDate() {
|
|
926
|
+
return !!this._def.checks.find((e) => e.kind === "date");
|
|
927
|
+
}
|
|
928
|
+
get isTime() {
|
|
929
|
+
return !!this._def.checks.find((e) => e.kind === "time");
|
|
930
|
+
}
|
|
931
|
+
get isDuration() {
|
|
932
|
+
return !!this._def.checks.find((e) => e.kind === "duration");
|
|
933
|
+
}
|
|
934
|
+
get isEmail() {
|
|
935
|
+
return !!this._def.checks.find((e) => e.kind === "email");
|
|
936
|
+
}
|
|
937
|
+
get isURL() {
|
|
938
|
+
return !!this._def.checks.find((e) => e.kind === "url");
|
|
939
|
+
}
|
|
940
|
+
get isEmoji() {
|
|
941
|
+
return !!this._def.checks.find((e) => e.kind === "emoji");
|
|
942
|
+
}
|
|
943
|
+
get isUUID() {
|
|
944
|
+
return !!this._def.checks.find((e) => e.kind === "uuid");
|
|
945
|
+
}
|
|
946
|
+
get isNANOID() {
|
|
947
|
+
return !!this._def.checks.find((e) => e.kind === "nanoid");
|
|
948
|
+
}
|
|
949
|
+
get isCUID() {
|
|
950
|
+
return !!this._def.checks.find((e) => e.kind === "cuid");
|
|
951
|
+
}
|
|
952
|
+
get isCUID2() {
|
|
953
|
+
return !!this._def.checks.find((e) => e.kind === "cuid2");
|
|
954
|
+
}
|
|
955
|
+
get isULID() {
|
|
956
|
+
return !!this._def.checks.find((e) => e.kind === "ulid");
|
|
957
|
+
}
|
|
958
|
+
get isIP() {
|
|
959
|
+
return !!this._def.checks.find((e) => e.kind === "ip");
|
|
960
|
+
}
|
|
961
|
+
get isCIDR() {
|
|
962
|
+
return !!this._def.checks.find((e) => e.kind === "cidr");
|
|
963
|
+
}
|
|
964
|
+
get isBase64() {
|
|
965
|
+
return !!this._def.checks.find((e) => e.kind === "base64");
|
|
966
|
+
}
|
|
967
|
+
get isBase64url() {
|
|
968
|
+
return !!this._def.checks.find((e) => e.kind === "base64url");
|
|
969
|
+
}
|
|
970
|
+
get minLength() {
|
|
971
|
+
let e = null;
|
|
972
|
+
for (const t of this._def.checks)
|
|
973
|
+
t.kind === "min" && (e === null || t.value > e) && (e = t.value);
|
|
974
|
+
return e;
|
|
975
|
+
}
|
|
976
|
+
get maxLength() {
|
|
977
|
+
let e = null;
|
|
978
|
+
for (const t of this._def.checks)
|
|
979
|
+
t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
980
|
+
return e;
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
j.create = (n) => new j({
|
|
984
|
+
checks: [],
|
|
985
|
+
typeName: b.ZodString,
|
|
986
|
+
coerce: n?.coerce ?? !1,
|
|
987
|
+
...S(n)
|
|
988
|
+
});
|
|
989
|
+
function nt(n, e) {
|
|
990
|
+
const t = (n.toString().split(".")[1] || "").length, a = (e.toString().split(".")[1] || "").length, s = t > a ? t : a, r = Number.parseInt(n.toFixed(s).replace(".", "")), o = Number.parseInt(e.toFixed(s).replace(".", ""));
|
|
991
|
+
return r % o / 10 ** s;
|
|
992
|
+
}
|
|
993
|
+
class F extends T {
|
|
994
|
+
constructor() {
|
|
995
|
+
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
996
|
+
}
|
|
997
|
+
_parse(e) {
|
|
998
|
+
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== p.number) {
|
|
999
|
+
const r = this._getOrReturnCtx(e);
|
|
1000
|
+
return u(r, {
|
|
1001
|
+
code: c.invalid_type,
|
|
1002
|
+
expected: p.number,
|
|
1003
|
+
received: r.parsedType
|
|
1004
|
+
}), k;
|
|
1005
|
+
}
|
|
1006
|
+
let a;
|
|
1007
|
+
const s = new R();
|
|
1008
|
+
for (const r of this._def.checks)
|
|
1009
|
+
r.kind === "int" ? C.isInteger(e.data) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
1010
|
+
code: c.invalid_type,
|
|
1011
|
+
expected: "integer",
|
|
1012
|
+
received: "float",
|
|
1013
|
+
message: r.message
|
|
1014
|
+
}), s.dirty()) : r.kind === "min" ? (r.inclusive ? e.data < r.value : e.data <= r.value) && (a = this._getOrReturnCtx(e, a), u(a, {
|
|
1015
|
+
code: c.too_small,
|
|
1016
|
+
minimum: r.value,
|
|
1017
|
+
type: "number",
|
|
1018
|
+
inclusive: r.inclusive,
|
|
1019
|
+
exact: !1,
|
|
1020
|
+
message: r.message
|
|
1021
|
+
}), s.dirty()) : r.kind === "max" ? (r.inclusive ? e.data > r.value : e.data >= r.value) && (a = this._getOrReturnCtx(e, a), u(a, {
|
|
1022
|
+
code: c.too_big,
|
|
1023
|
+
maximum: r.value,
|
|
1024
|
+
type: "number",
|
|
1025
|
+
inclusive: r.inclusive,
|
|
1026
|
+
exact: !1,
|
|
1027
|
+
message: r.message
|
|
1028
|
+
}), s.dirty()) : r.kind === "multipleOf" ? nt(e.data, r.value) !== 0 && (a = this._getOrReturnCtx(e, a), u(a, {
|
|
1029
|
+
code: c.not_multiple_of,
|
|
1030
|
+
multipleOf: r.value,
|
|
1031
|
+
message: r.message
|
|
1032
|
+
}), s.dirty()) : r.kind === "finite" ? Number.isFinite(e.data) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
1033
|
+
code: c.not_finite,
|
|
1034
|
+
message: r.message
|
|
1035
|
+
}), s.dirty()) : C.assertNever(r);
|
|
1036
|
+
return { status: s.value, value: e.data };
|
|
1037
|
+
}
|
|
1038
|
+
gte(e, t) {
|
|
1039
|
+
return this.setLimit("min", e, !0, f.toString(t));
|
|
1040
|
+
}
|
|
1041
|
+
gt(e, t) {
|
|
1042
|
+
return this.setLimit("min", e, !1, f.toString(t));
|
|
1043
|
+
}
|
|
1044
|
+
lte(e, t) {
|
|
1045
|
+
return this.setLimit("max", e, !0, f.toString(t));
|
|
1046
|
+
}
|
|
1047
|
+
lt(e, t) {
|
|
1048
|
+
return this.setLimit("max", e, !1, f.toString(t));
|
|
1049
|
+
}
|
|
1050
|
+
setLimit(e, t, a, s) {
|
|
1051
|
+
return new F({
|
|
1052
|
+
...this._def,
|
|
1053
|
+
checks: [
|
|
1054
|
+
...this._def.checks,
|
|
1055
|
+
{
|
|
1056
|
+
kind: e,
|
|
1057
|
+
value: t,
|
|
1058
|
+
inclusive: a,
|
|
1059
|
+
message: f.toString(s)
|
|
1060
|
+
}
|
|
1061
|
+
]
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
_addCheck(e) {
|
|
1065
|
+
return new F({
|
|
1066
|
+
...this._def,
|
|
1067
|
+
checks: [...this._def.checks, e]
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
int(e) {
|
|
1071
|
+
return this._addCheck({
|
|
1072
|
+
kind: "int",
|
|
1073
|
+
message: f.toString(e)
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
positive(e) {
|
|
1077
|
+
return this._addCheck({
|
|
1078
|
+
kind: "min",
|
|
1079
|
+
value: 0,
|
|
1080
|
+
inclusive: !1,
|
|
1081
|
+
message: f.toString(e)
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
negative(e) {
|
|
1085
|
+
return this._addCheck({
|
|
1086
|
+
kind: "max",
|
|
1087
|
+
value: 0,
|
|
1088
|
+
inclusive: !1,
|
|
1089
|
+
message: f.toString(e)
|
|
1090
|
+
});
|
|
1091
|
+
}
|
|
1092
|
+
nonpositive(e) {
|
|
1093
|
+
return this._addCheck({
|
|
1094
|
+
kind: "max",
|
|
1095
|
+
value: 0,
|
|
1096
|
+
inclusive: !0,
|
|
1097
|
+
message: f.toString(e)
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
nonnegative(e) {
|
|
1101
|
+
return this._addCheck({
|
|
1102
|
+
kind: "min",
|
|
1103
|
+
value: 0,
|
|
1104
|
+
inclusive: !0,
|
|
1105
|
+
message: f.toString(e)
|
|
1106
|
+
});
|
|
1107
|
+
}
|
|
1108
|
+
multipleOf(e, t) {
|
|
1109
|
+
return this._addCheck({
|
|
1110
|
+
kind: "multipleOf",
|
|
1111
|
+
value: e,
|
|
1112
|
+
message: f.toString(t)
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
finite(e) {
|
|
1116
|
+
return this._addCheck({
|
|
1117
|
+
kind: "finite",
|
|
1118
|
+
message: f.toString(e)
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
safe(e) {
|
|
1122
|
+
return this._addCheck({
|
|
1123
|
+
kind: "min",
|
|
1124
|
+
inclusive: !0,
|
|
1125
|
+
value: Number.MIN_SAFE_INTEGER,
|
|
1126
|
+
message: f.toString(e)
|
|
1127
|
+
})._addCheck({
|
|
1128
|
+
kind: "max",
|
|
1129
|
+
inclusive: !0,
|
|
1130
|
+
value: Number.MAX_SAFE_INTEGER,
|
|
1131
|
+
message: f.toString(e)
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
get minValue() {
|
|
1135
|
+
let e = null;
|
|
1136
|
+
for (const t of this._def.checks)
|
|
1137
|
+
t.kind === "min" && (e === null || t.value > e) && (e = t.value);
|
|
1138
|
+
return e;
|
|
1139
|
+
}
|
|
1140
|
+
get maxValue() {
|
|
1141
|
+
let e = null;
|
|
1142
|
+
for (const t of this._def.checks)
|
|
1143
|
+
t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
1144
|
+
return e;
|
|
1145
|
+
}
|
|
1146
|
+
get isInt() {
|
|
1147
|
+
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && C.isInteger(e.value));
|
|
1148
|
+
}
|
|
1149
|
+
get isFinite() {
|
|
1150
|
+
let e = null, t = null;
|
|
1151
|
+
for (const a of this._def.checks) {
|
|
1152
|
+
if (a.kind === "finite" || a.kind === "int" || a.kind === "multipleOf")
|
|
1153
|
+
return !0;
|
|
1154
|
+
a.kind === "min" ? (t === null || a.value > t) && (t = a.value) : a.kind === "max" && (e === null || a.value < e) && (e = a.value);
|
|
1155
|
+
}
|
|
1156
|
+
return Number.isFinite(t) && Number.isFinite(e);
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
F.create = (n) => new F({
|
|
1160
|
+
checks: [],
|
|
1161
|
+
typeName: b.ZodNumber,
|
|
1162
|
+
coerce: n?.coerce || !1,
|
|
1163
|
+
...S(n)
|
|
1164
|
+
});
|
|
1165
|
+
class Q extends T {
|
|
1166
|
+
constructor() {
|
|
1167
|
+
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1168
|
+
}
|
|
1169
|
+
_parse(e) {
|
|
1170
|
+
if (this._def.coerce)
|
|
1171
|
+
try {
|
|
1172
|
+
e.data = BigInt(e.data);
|
|
1173
|
+
} catch {
|
|
1174
|
+
return this._getInvalidInput(e);
|
|
1175
|
+
}
|
|
1176
|
+
if (this._getType(e) !== p.bigint)
|
|
1177
|
+
return this._getInvalidInput(e);
|
|
1178
|
+
let a;
|
|
1179
|
+
const s = new R();
|
|
1180
|
+
for (const r of this._def.checks)
|
|
1181
|
+
r.kind === "min" ? (r.inclusive ? e.data < r.value : e.data <= r.value) && (a = this._getOrReturnCtx(e, a), u(a, {
|
|
1182
|
+
code: c.too_small,
|
|
1183
|
+
type: "bigint",
|
|
1184
|
+
minimum: r.value,
|
|
1185
|
+
inclusive: r.inclusive,
|
|
1186
|
+
message: r.message
|
|
1187
|
+
}), s.dirty()) : r.kind === "max" ? (r.inclusive ? e.data > r.value : e.data >= r.value) && (a = this._getOrReturnCtx(e, a), u(a, {
|
|
1188
|
+
code: c.too_big,
|
|
1189
|
+
type: "bigint",
|
|
1190
|
+
maximum: r.value,
|
|
1191
|
+
inclusive: r.inclusive,
|
|
1192
|
+
message: r.message
|
|
1193
|
+
}), s.dirty()) : r.kind === "multipleOf" ? e.data % r.value !== BigInt(0) && (a = this._getOrReturnCtx(e, a), u(a, {
|
|
1194
|
+
code: c.not_multiple_of,
|
|
1195
|
+
multipleOf: r.value,
|
|
1196
|
+
message: r.message
|
|
1197
|
+
}), s.dirty()) : C.assertNever(r);
|
|
1198
|
+
return { status: s.value, value: e.data };
|
|
1199
|
+
}
|
|
1200
|
+
_getInvalidInput(e) {
|
|
1201
|
+
const t = this._getOrReturnCtx(e);
|
|
1202
|
+
return u(t, {
|
|
1203
|
+
code: c.invalid_type,
|
|
1204
|
+
expected: p.bigint,
|
|
1205
|
+
received: t.parsedType
|
|
1206
|
+
}), k;
|
|
1207
|
+
}
|
|
1208
|
+
gte(e, t) {
|
|
1209
|
+
return this.setLimit("min", e, !0, f.toString(t));
|
|
1210
|
+
}
|
|
1211
|
+
gt(e, t) {
|
|
1212
|
+
return this.setLimit("min", e, !1, f.toString(t));
|
|
1213
|
+
}
|
|
1214
|
+
lte(e, t) {
|
|
1215
|
+
return this.setLimit("max", e, !0, f.toString(t));
|
|
1216
|
+
}
|
|
1217
|
+
lt(e, t) {
|
|
1218
|
+
return this.setLimit("max", e, !1, f.toString(t));
|
|
1219
|
+
}
|
|
1220
|
+
setLimit(e, t, a, s) {
|
|
1221
|
+
return new Q({
|
|
1222
|
+
...this._def,
|
|
1223
|
+
checks: [
|
|
1224
|
+
...this._def.checks,
|
|
1225
|
+
{
|
|
1226
|
+
kind: e,
|
|
1227
|
+
value: t,
|
|
1228
|
+
inclusive: a,
|
|
1229
|
+
message: f.toString(s)
|
|
1230
|
+
}
|
|
1231
|
+
]
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
_addCheck(e) {
|
|
1235
|
+
return new Q({
|
|
1236
|
+
...this._def,
|
|
1237
|
+
checks: [...this._def.checks, e]
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
positive(e) {
|
|
1241
|
+
return this._addCheck({
|
|
1242
|
+
kind: "min",
|
|
1243
|
+
value: BigInt(0),
|
|
1244
|
+
inclusive: !1,
|
|
1245
|
+
message: f.toString(e)
|
|
1246
|
+
});
|
|
1247
|
+
}
|
|
1248
|
+
negative(e) {
|
|
1249
|
+
return this._addCheck({
|
|
1250
|
+
kind: "max",
|
|
1251
|
+
value: BigInt(0),
|
|
1252
|
+
inclusive: !1,
|
|
1253
|
+
message: f.toString(e)
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1256
|
+
nonpositive(e) {
|
|
1257
|
+
return this._addCheck({
|
|
1258
|
+
kind: "max",
|
|
1259
|
+
value: BigInt(0),
|
|
1260
|
+
inclusive: !0,
|
|
1261
|
+
message: f.toString(e)
|
|
1262
|
+
});
|
|
1263
|
+
}
|
|
1264
|
+
nonnegative(e) {
|
|
1265
|
+
return this._addCheck({
|
|
1266
|
+
kind: "min",
|
|
1267
|
+
value: BigInt(0),
|
|
1268
|
+
inclusive: !0,
|
|
1269
|
+
message: f.toString(e)
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
multipleOf(e, t) {
|
|
1273
|
+
return this._addCheck({
|
|
1274
|
+
kind: "multipleOf",
|
|
1275
|
+
value: e,
|
|
1276
|
+
message: f.toString(t)
|
|
1277
|
+
});
|
|
1278
|
+
}
|
|
1279
|
+
get minValue() {
|
|
1280
|
+
let e = null;
|
|
1281
|
+
for (const t of this._def.checks)
|
|
1282
|
+
t.kind === "min" && (e === null || t.value > e) && (e = t.value);
|
|
1283
|
+
return e;
|
|
1284
|
+
}
|
|
1285
|
+
get maxValue() {
|
|
1286
|
+
let e = null;
|
|
1287
|
+
for (const t of this._def.checks)
|
|
1288
|
+
t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
1289
|
+
return e;
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
Q.create = (n) => new Q({
|
|
1293
|
+
checks: [],
|
|
1294
|
+
typeName: b.ZodBigInt,
|
|
1295
|
+
coerce: n?.coerce ?? !1,
|
|
1296
|
+
...S(n)
|
|
1297
|
+
});
|
|
1298
|
+
class le extends T {
|
|
1299
|
+
_parse(e) {
|
|
1300
|
+
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
|
|
1301
|
+
const a = this._getOrReturnCtx(e);
|
|
1302
|
+
return u(a, {
|
|
1303
|
+
code: c.invalid_type,
|
|
1304
|
+
expected: p.boolean,
|
|
1305
|
+
received: a.parsedType
|
|
1306
|
+
}), k;
|
|
1307
|
+
}
|
|
1308
|
+
return Z(e.data);
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
le.create = (n) => new le({
|
|
1312
|
+
typeName: b.ZodBoolean,
|
|
1313
|
+
coerce: n?.coerce || !1,
|
|
1314
|
+
...S(n)
|
|
1315
|
+
});
|
|
1316
|
+
class te extends T {
|
|
1317
|
+
_parse(e) {
|
|
1318
|
+
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
|
|
1319
|
+
const r = this._getOrReturnCtx(e);
|
|
1320
|
+
return u(r, {
|
|
1321
|
+
code: c.invalid_type,
|
|
1322
|
+
expected: p.date,
|
|
1323
|
+
received: r.parsedType
|
|
1324
|
+
}), k;
|
|
1325
|
+
}
|
|
1326
|
+
if (Number.isNaN(e.data.getTime())) {
|
|
1327
|
+
const r = this._getOrReturnCtx(e);
|
|
1328
|
+
return u(r, {
|
|
1329
|
+
code: c.invalid_date
|
|
1330
|
+
}), k;
|
|
1331
|
+
}
|
|
1332
|
+
const a = new R();
|
|
1333
|
+
let s;
|
|
1334
|
+
for (const r of this._def.checks)
|
|
1335
|
+
r.kind === "min" ? e.data.getTime() < r.value && (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1336
|
+
code: c.too_small,
|
|
1337
|
+
message: r.message,
|
|
1338
|
+
inclusive: !0,
|
|
1339
|
+
exact: !1,
|
|
1340
|
+
minimum: r.value,
|
|
1341
|
+
type: "date"
|
|
1342
|
+
}), a.dirty()) : r.kind === "max" ? e.data.getTime() > r.value && (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1343
|
+
code: c.too_big,
|
|
1344
|
+
message: r.message,
|
|
1345
|
+
inclusive: !0,
|
|
1346
|
+
exact: !1,
|
|
1347
|
+
maximum: r.value,
|
|
1348
|
+
type: "date"
|
|
1349
|
+
}), a.dirty()) : C.assertNever(r);
|
|
1350
|
+
return {
|
|
1351
|
+
status: a.value,
|
|
1352
|
+
value: new Date(e.data.getTime())
|
|
1353
|
+
};
|
|
1354
|
+
}
|
|
1355
|
+
_addCheck(e) {
|
|
1356
|
+
return new te({
|
|
1357
|
+
...this._def,
|
|
1358
|
+
checks: [...this._def.checks, e]
|
|
1359
|
+
});
|
|
1360
|
+
}
|
|
1361
|
+
min(e, t) {
|
|
1362
|
+
return this._addCheck({
|
|
1363
|
+
kind: "min",
|
|
1364
|
+
value: e.getTime(),
|
|
1365
|
+
message: f.toString(t)
|
|
1366
|
+
});
|
|
1367
|
+
}
|
|
1368
|
+
max(e, t) {
|
|
1369
|
+
return this._addCheck({
|
|
1370
|
+
kind: "max",
|
|
1371
|
+
value: e.getTime(),
|
|
1372
|
+
message: f.toString(t)
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
get minDate() {
|
|
1376
|
+
let e = null;
|
|
1377
|
+
for (const t of this._def.checks)
|
|
1378
|
+
t.kind === "min" && (e === null || t.value > e) && (e = t.value);
|
|
1379
|
+
return e != null ? new Date(e) : null;
|
|
1380
|
+
}
|
|
1381
|
+
get maxDate() {
|
|
1382
|
+
let e = null;
|
|
1383
|
+
for (const t of this._def.checks)
|
|
1384
|
+
t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
1385
|
+
return e != null ? new Date(e) : null;
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
te.create = (n) => new te({
|
|
1389
|
+
checks: [],
|
|
1390
|
+
coerce: n?.coerce || !1,
|
|
1391
|
+
typeName: b.ZodDate,
|
|
1392
|
+
...S(n)
|
|
1393
|
+
});
|
|
1394
|
+
class be extends T {
|
|
1395
|
+
_parse(e) {
|
|
1396
|
+
if (this._getType(e) !== p.symbol) {
|
|
1397
|
+
const a = this._getOrReturnCtx(e);
|
|
1398
|
+
return u(a, {
|
|
1399
|
+
code: c.invalid_type,
|
|
1400
|
+
expected: p.symbol,
|
|
1401
|
+
received: a.parsedType
|
|
1402
|
+
}), k;
|
|
1403
|
+
}
|
|
1404
|
+
return Z(e.data);
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
be.create = (n) => new be({
|
|
1408
|
+
typeName: b.ZodSymbol,
|
|
1409
|
+
...S(n)
|
|
1410
|
+
});
|
|
1411
|
+
class ke extends T {
|
|
1412
|
+
_parse(e) {
|
|
1413
|
+
if (this._getType(e) !== p.undefined) {
|
|
1414
|
+
const a = this._getOrReturnCtx(e);
|
|
1415
|
+
return u(a, {
|
|
1416
|
+
code: c.invalid_type,
|
|
1417
|
+
expected: p.undefined,
|
|
1418
|
+
received: a.parsedType
|
|
1419
|
+
}), k;
|
|
1420
|
+
}
|
|
1421
|
+
return Z(e.data);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
ke.create = (n) => new ke({
|
|
1425
|
+
typeName: b.ZodUndefined,
|
|
1426
|
+
...S(n)
|
|
1427
|
+
});
|
|
1428
|
+
class ce extends T {
|
|
1429
|
+
_parse(e) {
|
|
1430
|
+
if (this._getType(e) !== p.null) {
|
|
1431
|
+
const a = this._getOrReturnCtx(e);
|
|
1432
|
+
return u(a, {
|
|
1433
|
+
code: c.invalid_type,
|
|
1434
|
+
expected: p.null,
|
|
1435
|
+
received: a.parsedType
|
|
1436
|
+
}), k;
|
|
1437
|
+
}
|
|
1438
|
+
return Z(e.data);
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
ce.create = (n) => new ce({
|
|
1442
|
+
typeName: b.ZodNull,
|
|
1443
|
+
...S(n)
|
|
1444
|
+
});
|
|
1445
|
+
class we extends T {
|
|
1446
|
+
constructor() {
|
|
1447
|
+
super(...arguments), this._any = !0;
|
|
1448
|
+
}
|
|
1449
|
+
_parse(e) {
|
|
1450
|
+
return Z(e.data);
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
we.create = (n) => new we({
|
|
1454
|
+
typeName: b.ZodAny,
|
|
1455
|
+
...S(n)
|
|
1456
|
+
});
|
|
1457
|
+
class de extends T {
|
|
1458
|
+
constructor() {
|
|
1459
|
+
super(...arguments), this._unknown = !0;
|
|
1460
|
+
}
|
|
1461
|
+
_parse(e) {
|
|
1462
|
+
return Z(e.data);
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
de.create = (n) => new de({
|
|
1466
|
+
typeName: b.ZodUnknown,
|
|
1467
|
+
...S(n)
|
|
1468
|
+
});
|
|
1469
|
+
class V extends T {
|
|
1470
|
+
_parse(e) {
|
|
1471
|
+
const t = this._getOrReturnCtx(e);
|
|
1472
|
+
return u(t, {
|
|
1473
|
+
code: c.invalid_type,
|
|
1474
|
+
expected: p.never,
|
|
1475
|
+
received: t.parsedType
|
|
1476
|
+
}), k;
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
V.create = (n) => new V({
|
|
1480
|
+
typeName: b.ZodNever,
|
|
1481
|
+
...S(n)
|
|
1482
|
+
});
|
|
1483
|
+
class Se extends T {
|
|
1484
|
+
_parse(e) {
|
|
1485
|
+
if (this._getType(e) !== p.undefined) {
|
|
1486
|
+
const a = this._getOrReturnCtx(e);
|
|
1487
|
+
return u(a, {
|
|
1488
|
+
code: c.invalid_type,
|
|
1489
|
+
expected: p.void,
|
|
1490
|
+
received: a.parsedType
|
|
1491
|
+
}), k;
|
|
1492
|
+
}
|
|
1493
|
+
return Z(e.data);
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
Se.create = (n) => new Se({
|
|
1497
|
+
typeName: b.ZodVoid,
|
|
1498
|
+
...S(n)
|
|
1499
|
+
});
|
|
1500
|
+
class I extends T {
|
|
1501
|
+
_parse(e) {
|
|
1502
|
+
const { ctx: t, status: a } = this._processInputParams(e), s = this._def;
|
|
1503
|
+
if (t.parsedType !== p.array)
|
|
1504
|
+
return u(t, {
|
|
1505
|
+
code: c.invalid_type,
|
|
1506
|
+
expected: p.array,
|
|
1507
|
+
received: t.parsedType
|
|
1508
|
+
}), k;
|
|
1509
|
+
if (s.exactLength !== null) {
|
|
1510
|
+
const o = t.data.length > s.exactLength.value, l = t.data.length < s.exactLength.value;
|
|
1511
|
+
(o || l) && (u(t, {
|
|
1512
|
+
code: o ? c.too_big : c.too_small,
|
|
1513
|
+
minimum: l ? s.exactLength.value : void 0,
|
|
1514
|
+
maximum: o ? s.exactLength.value : void 0,
|
|
1515
|
+
type: "array",
|
|
1516
|
+
inclusive: !0,
|
|
1517
|
+
exact: !0,
|
|
1518
|
+
message: s.exactLength.message
|
|
1519
|
+
}), a.dirty());
|
|
1520
|
+
}
|
|
1521
|
+
if (s.minLength !== null && t.data.length < s.minLength.value && (u(t, {
|
|
1522
|
+
code: c.too_small,
|
|
1523
|
+
minimum: s.minLength.value,
|
|
1524
|
+
type: "array",
|
|
1525
|
+
inclusive: !0,
|
|
1526
|
+
exact: !1,
|
|
1527
|
+
message: s.minLength.message
|
|
1528
|
+
}), a.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (u(t, {
|
|
1529
|
+
code: c.too_big,
|
|
1530
|
+
maximum: s.maxLength.value,
|
|
1531
|
+
type: "array",
|
|
1532
|
+
inclusive: !0,
|
|
1533
|
+
exact: !1,
|
|
1534
|
+
message: s.maxLength.message
|
|
1535
|
+
}), a.dirty()), t.common.async)
|
|
1536
|
+
return Promise.all([...t.data].map((o, l) => s.type._parseAsync(new E(t, o, t.path, l)))).then((o) => R.mergeArray(a, o));
|
|
1537
|
+
const r = [...t.data].map((o, l) => s.type._parseSync(new E(t, o, t.path, l)));
|
|
1538
|
+
return R.mergeArray(a, r);
|
|
1539
|
+
}
|
|
1540
|
+
get element() {
|
|
1541
|
+
return this._def.type;
|
|
1542
|
+
}
|
|
1543
|
+
min(e, t) {
|
|
1544
|
+
return new I({
|
|
1545
|
+
...this._def,
|
|
1546
|
+
minLength: { value: e, message: f.toString(t) }
|
|
1547
|
+
});
|
|
1548
|
+
}
|
|
1549
|
+
max(e, t) {
|
|
1550
|
+
return new I({
|
|
1551
|
+
...this._def,
|
|
1552
|
+
maxLength: { value: e, message: f.toString(t) }
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1555
|
+
length(e, t) {
|
|
1556
|
+
return new I({
|
|
1557
|
+
...this._def,
|
|
1558
|
+
exactLength: { value: e, message: f.toString(t) }
|
|
1559
|
+
});
|
|
1560
|
+
}
|
|
1561
|
+
nonempty(e) {
|
|
1562
|
+
return this.min(1, e);
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
I.create = (n, e) => new I({
|
|
1566
|
+
type: n,
|
|
1567
|
+
minLength: null,
|
|
1568
|
+
maxLength: null,
|
|
1569
|
+
exactLength: null,
|
|
1570
|
+
typeName: b.ZodArray,
|
|
1571
|
+
...S(e)
|
|
1572
|
+
});
|
|
1573
|
+
function B(n) {
|
|
1574
|
+
if (n instanceof A) {
|
|
1575
|
+
const e = {};
|
|
1576
|
+
for (const t in n.shape) {
|
|
1577
|
+
const a = n.shape[t];
|
|
1578
|
+
e[t] = L.create(B(a));
|
|
1579
|
+
}
|
|
1580
|
+
return new A({
|
|
1581
|
+
...n._def,
|
|
1582
|
+
shape: () => e
|
|
1583
|
+
});
|
|
1584
|
+
} else return n instanceof I ? new I({
|
|
1585
|
+
...n._def,
|
|
1586
|
+
type: B(n.element)
|
|
1587
|
+
}) : n instanceof L ? L.create(B(n.unwrap())) : n instanceof G ? G.create(B(n.unwrap())) : n instanceof M ? M.create(n.items.map((e) => B(e))) : n;
|
|
1588
|
+
}
|
|
1589
|
+
class A extends T {
|
|
1590
|
+
constructor() {
|
|
1591
|
+
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1592
|
+
}
|
|
1593
|
+
_getCached() {
|
|
1594
|
+
if (this._cached !== null)
|
|
1595
|
+
return this._cached;
|
|
1596
|
+
const e = this._def.shape(), t = C.objectKeys(e);
|
|
1597
|
+
return this._cached = { shape: e, keys: t }, this._cached;
|
|
1598
|
+
}
|
|
1599
|
+
_parse(e) {
|
|
1600
|
+
if (this._getType(e) !== p.object) {
|
|
1601
|
+
const y = this._getOrReturnCtx(e);
|
|
1602
|
+
return u(y, {
|
|
1603
|
+
code: c.invalid_type,
|
|
1604
|
+
expected: p.object,
|
|
1605
|
+
received: y.parsedType
|
|
1606
|
+
}), k;
|
|
1607
|
+
}
|
|
1608
|
+
const { status: a, ctx: s } = this._processInputParams(e), { shape: r, keys: o } = this._getCached(), l = [];
|
|
1609
|
+
if (!(this._def.catchall instanceof V && this._def.unknownKeys === "strip"))
|
|
1610
|
+
for (const y in s.data)
|
|
1611
|
+
o.includes(y) || l.push(y);
|
|
1612
|
+
const g = [];
|
|
1613
|
+
for (const y of o) {
|
|
1614
|
+
const N = r[y], J = s.data[y];
|
|
1615
|
+
g.push({
|
|
1616
|
+
key: { status: "valid", value: y },
|
|
1617
|
+
value: N._parse(new E(s, J, s.path, y)),
|
|
1618
|
+
alwaysSet: y in s.data
|
|
1619
|
+
});
|
|
1620
|
+
}
|
|
1621
|
+
if (this._def.catchall instanceof V) {
|
|
1622
|
+
const y = this._def.unknownKeys;
|
|
1623
|
+
if (y === "passthrough")
|
|
1624
|
+
for (const N of l)
|
|
1625
|
+
g.push({
|
|
1626
|
+
key: { status: "valid", value: N },
|
|
1627
|
+
value: { status: "valid", value: s.data[N] }
|
|
1628
|
+
});
|
|
1629
|
+
else if (y === "strict")
|
|
1630
|
+
l.length > 0 && (u(s, {
|
|
1631
|
+
code: c.unrecognized_keys,
|
|
1632
|
+
keys: l
|
|
1633
|
+
}), a.dirty());
|
|
1634
|
+
else if (y !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1635
|
+
} else {
|
|
1636
|
+
const y = this._def.catchall;
|
|
1637
|
+
for (const N of l) {
|
|
1638
|
+
const J = s.data[N];
|
|
1639
|
+
g.push({
|
|
1640
|
+
key: { status: "valid", value: N },
|
|
1641
|
+
value: y._parse(
|
|
1642
|
+
new E(s, J, s.path, N)
|
|
1643
|
+
//, ctx.child(key), value, getParsedType(value)
|
|
1644
|
+
),
|
|
1645
|
+
alwaysSet: N in s.data
|
|
1646
|
+
});
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
return s.common.async ? Promise.resolve().then(async () => {
|
|
1650
|
+
const y = [];
|
|
1651
|
+
for (const N of g) {
|
|
1652
|
+
const J = await N.key, Ie = await N.value;
|
|
1653
|
+
y.push({
|
|
1654
|
+
key: J,
|
|
1655
|
+
value: Ie,
|
|
1656
|
+
alwaysSet: N.alwaysSet
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
return y;
|
|
1660
|
+
}).then((y) => R.mergeObjectSync(a, y)) : R.mergeObjectSync(a, g);
|
|
1661
|
+
}
|
|
1662
|
+
get shape() {
|
|
1663
|
+
return this._def.shape();
|
|
1664
|
+
}
|
|
1665
|
+
strict(e) {
|
|
1666
|
+
return f.errToObj, new A({
|
|
1667
|
+
...this._def,
|
|
1668
|
+
unknownKeys: "strict",
|
|
1669
|
+
...e !== void 0 ? {
|
|
1670
|
+
errorMap: (t, a) => {
|
|
1671
|
+
const s = this._def.errorMap?.(t, a).message ?? a.defaultError;
|
|
1672
|
+
return t.code === "unrecognized_keys" ? {
|
|
1673
|
+
message: f.errToObj(e).message ?? s
|
|
1674
|
+
} : {
|
|
1675
|
+
message: s
|
|
1676
|
+
};
|
|
1677
|
+
}
|
|
1678
|
+
} : {}
|
|
1679
|
+
});
|
|
1680
|
+
}
|
|
1681
|
+
strip() {
|
|
1682
|
+
return new A({
|
|
1683
|
+
...this._def,
|
|
1684
|
+
unknownKeys: "strip"
|
|
1685
|
+
});
|
|
1686
|
+
}
|
|
1687
|
+
passthrough() {
|
|
1688
|
+
return new A({
|
|
1689
|
+
...this._def,
|
|
1690
|
+
unknownKeys: "passthrough"
|
|
1691
|
+
});
|
|
1692
|
+
}
|
|
1693
|
+
// const AugmentFactory =
|
|
1694
|
+
// <Def extends ZodObjectDef>(def: Def) =>
|
|
1695
|
+
// <Augmentation extends ZodRawShape>(
|
|
1696
|
+
// augmentation: Augmentation
|
|
1697
|
+
// ): ZodObject<
|
|
1698
|
+
// extendShape<ReturnType<Def["shape"]>, Augmentation>,
|
|
1699
|
+
// Def["unknownKeys"],
|
|
1700
|
+
// Def["catchall"]
|
|
1701
|
+
// > => {
|
|
1702
|
+
// return new ZodObject({
|
|
1703
|
+
// ...def,
|
|
1704
|
+
// shape: () => ({
|
|
1705
|
+
// ...def.shape(),
|
|
1706
|
+
// ...augmentation,
|
|
1707
|
+
// }),
|
|
1708
|
+
// }) as any;
|
|
1709
|
+
// };
|
|
1710
|
+
extend(e) {
|
|
1711
|
+
return new A({
|
|
1712
|
+
...this._def,
|
|
1713
|
+
shape: () => ({
|
|
1714
|
+
...this._def.shape(),
|
|
1715
|
+
...e
|
|
1716
|
+
})
|
|
1717
|
+
});
|
|
1718
|
+
}
|
|
1719
|
+
/**
|
|
1720
|
+
* Prior to zod@1.0.12 there was a bug in the
|
|
1721
|
+
* inferred type of merged objects. Please
|
|
1722
|
+
* upgrade if you are experiencing issues.
|
|
1723
|
+
*/
|
|
1724
|
+
merge(e) {
|
|
1725
|
+
return new A({
|
|
1726
|
+
unknownKeys: e._def.unknownKeys,
|
|
1727
|
+
catchall: e._def.catchall,
|
|
1728
|
+
shape: () => ({
|
|
1729
|
+
...this._def.shape(),
|
|
1730
|
+
...e._def.shape()
|
|
1731
|
+
}),
|
|
1732
|
+
typeName: b.ZodObject
|
|
1733
|
+
});
|
|
1734
|
+
}
|
|
1735
|
+
// merge<
|
|
1736
|
+
// Incoming extends AnyZodObject,
|
|
1737
|
+
// Augmentation extends Incoming["shape"],
|
|
1738
|
+
// NewOutput extends {
|
|
1739
|
+
// [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
|
|
1740
|
+
// ? Augmentation[k]["_output"]
|
|
1741
|
+
// : k extends keyof Output
|
|
1742
|
+
// ? Output[k]
|
|
1743
|
+
// : never;
|
|
1744
|
+
// },
|
|
1745
|
+
// NewInput extends {
|
|
1746
|
+
// [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
|
|
1747
|
+
// ? Augmentation[k]["_input"]
|
|
1748
|
+
// : k extends keyof Input
|
|
1749
|
+
// ? Input[k]
|
|
1750
|
+
// : never;
|
|
1751
|
+
// }
|
|
1752
|
+
// >(
|
|
1753
|
+
// merging: Incoming
|
|
1754
|
+
// ): ZodObject<
|
|
1755
|
+
// extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
|
|
1756
|
+
// Incoming["_def"]["unknownKeys"],
|
|
1757
|
+
// Incoming["_def"]["catchall"],
|
|
1758
|
+
// NewOutput,
|
|
1759
|
+
// NewInput
|
|
1760
|
+
// > {
|
|
1761
|
+
// const merged: any = new ZodObject({
|
|
1762
|
+
// unknownKeys: merging._def.unknownKeys,
|
|
1763
|
+
// catchall: merging._def.catchall,
|
|
1764
|
+
// shape: () =>
|
|
1765
|
+
// objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
|
|
1766
|
+
// typeName: ZodFirstPartyTypeKind.ZodObject,
|
|
1767
|
+
// }) as any;
|
|
1768
|
+
// return merged;
|
|
1769
|
+
// }
|
|
1770
|
+
setKey(e, t) {
|
|
1771
|
+
return this.augment({ [e]: t });
|
|
1772
|
+
}
|
|
1773
|
+
// merge<Incoming extends AnyZodObject>(
|
|
1774
|
+
// merging: Incoming
|
|
1775
|
+
// ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
|
|
1776
|
+
// ZodObject<
|
|
1777
|
+
// extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
|
|
1778
|
+
// Incoming["_def"]["unknownKeys"],
|
|
1779
|
+
// Incoming["_def"]["catchall"]
|
|
1780
|
+
// > {
|
|
1781
|
+
// // const mergedShape = objectUtil.mergeShapes(
|
|
1782
|
+
// // this._def.shape(),
|
|
1783
|
+
// // merging._def.shape()
|
|
1784
|
+
// // );
|
|
1785
|
+
// const merged: any = new ZodObject({
|
|
1786
|
+
// unknownKeys: merging._def.unknownKeys,
|
|
1787
|
+
// catchall: merging._def.catchall,
|
|
1788
|
+
// shape: () =>
|
|
1789
|
+
// objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
|
|
1790
|
+
// typeName: ZodFirstPartyTypeKind.ZodObject,
|
|
1791
|
+
// }) as any;
|
|
1792
|
+
// return merged;
|
|
1793
|
+
// }
|
|
1794
|
+
catchall(e) {
|
|
1795
|
+
return new A({
|
|
1796
|
+
...this._def,
|
|
1797
|
+
catchall: e
|
|
1798
|
+
});
|
|
1799
|
+
}
|
|
1800
|
+
pick(e) {
|
|
1801
|
+
const t = {};
|
|
1802
|
+
for (const a of C.objectKeys(e))
|
|
1803
|
+
e[a] && this.shape[a] && (t[a] = this.shape[a]);
|
|
1804
|
+
return new A({
|
|
1805
|
+
...this._def,
|
|
1806
|
+
shape: () => t
|
|
1807
|
+
});
|
|
1808
|
+
}
|
|
1809
|
+
omit(e) {
|
|
1810
|
+
const t = {};
|
|
1811
|
+
for (const a of C.objectKeys(this.shape))
|
|
1812
|
+
e[a] || (t[a] = this.shape[a]);
|
|
1813
|
+
return new A({
|
|
1814
|
+
...this._def,
|
|
1815
|
+
shape: () => t
|
|
1816
|
+
});
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* @deprecated
|
|
1820
|
+
*/
|
|
1821
|
+
deepPartial() {
|
|
1822
|
+
return B(this);
|
|
1823
|
+
}
|
|
1824
|
+
partial(e) {
|
|
1825
|
+
const t = {};
|
|
1826
|
+
for (const a of C.objectKeys(this.shape)) {
|
|
1827
|
+
const s = this.shape[a];
|
|
1828
|
+
e && !e[a] ? t[a] = s : t[a] = s.optional();
|
|
1829
|
+
}
|
|
1830
|
+
return new A({
|
|
1831
|
+
...this._def,
|
|
1832
|
+
shape: () => t
|
|
1833
|
+
});
|
|
1834
|
+
}
|
|
1835
|
+
required(e) {
|
|
1836
|
+
const t = {};
|
|
1837
|
+
for (const a of C.objectKeys(this.shape))
|
|
1838
|
+
if (e && !e[a])
|
|
1839
|
+
t[a] = this.shape[a];
|
|
1840
|
+
else {
|
|
1841
|
+
let r = this.shape[a];
|
|
1842
|
+
for (; r instanceof L; )
|
|
1843
|
+
r = r._def.innerType;
|
|
1844
|
+
t[a] = r;
|
|
1845
|
+
}
|
|
1846
|
+
return new A({
|
|
1847
|
+
...this._def,
|
|
1848
|
+
shape: () => t
|
|
1849
|
+
});
|
|
1850
|
+
}
|
|
1851
|
+
keyof() {
|
|
1852
|
+
return Ze(C.objectKeys(this.shape));
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
A.create = (n, e) => new A({
|
|
1856
|
+
shape: () => n,
|
|
1857
|
+
unknownKeys: "strip",
|
|
1858
|
+
catchall: V.create(),
|
|
1859
|
+
typeName: b.ZodObject,
|
|
1860
|
+
...S(e)
|
|
1861
|
+
});
|
|
1862
|
+
A.strictCreate = (n, e) => new A({
|
|
1863
|
+
shape: () => n,
|
|
1864
|
+
unknownKeys: "strict",
|
|
1865
|
+
catchall: V.create(),
|
|
1866
|
+
typeName: b.ZodObject,
|
|
1867
|
+
...S(e)
|
|
1868
|
+
});
|
|
1869
|
+
A.lazycreate = (n, e) => new A({
|
|
1870
|
+
shape: n,
|
|
1871
|
+
unknownKeys: "strip",
|
|
1872
|
+
catchall: V.create(),
|
|
1873
|
+
typeName: b.ZodObject,
|
|
1874
|
+
...S(e)
|
|
1875
|
+
});
|
|
1876
|
+
class ae extends T {
|
|
1877
|
+
_parse(e) {
|
|
1878
|
+
const { ctx: t } = this._processInputParams(e), a = this._def.options;
|
|
1879
|
+
function s(r) {
|
|
1880
|
+
for (const l of r)
|
|
1881
|
+
if (l.result.status === "valid")
|
|
1882
|
+
return l.result;
|
|
1883
|
+
for (const l of r)
|
|
1884
|
+
if (l.result.status === "dirty")
|
|
1885
|
+
return t.common.issues.push(...l.ctx.common.issues), l.result;
|
|
1886
|
+
const o = r.map((l) => new P(l.ctx.common.issues));
|
|
1887
|
+
return u(t, {
|
|
1888
|
+
code: c.invalid_union,
|
|
1889
|
+
unionErrors: o
|
|
1890
|
+
}), k;
|
|
1891
|
+
}
|
|
1892
|
+
if (t.common.async)
|
|
1893
|
+
return Promise.all(a.map(async (r) => {
|
|
1894
|
+
const o = {
|
|
1895
|
+
...t,
|
|
1896
|
+
common: {
|
|
1897
|
+
...t.common,
|
|
1898
|
+
issues: []
|
|
1899
|
+
},
|
|
1900
|
+
parent: null
|
|
1901
|
+
};
|
|
1902
|
+
return {
|
|
1903
|
+
result: await r._parseAsync({
|
|
1904
|
+
data: t.data,
|
|
1905
|
+
path: t.path,
|
|
1906
|
+
parent: o
|
|
1907
|
+
}),
|
|
1908
|
+
ctx: o
|
|
1909
|
+
};
|
|
1910
|
+
})).then(s);
|
|
1911
|
+
{
|
|
1912
|
+
let r;
|
|
1913
|
+
const o = [];
|
|
1914
|
+
for (const g of a) {
|
|
1915
|
+
const y = {
|
|
1916
|
+
...t,
|
|
1917
|
+
common: {
|
|
1918
|
+
...t.common,
|
|
1919
|
+
issues: []
|
|
1920
|
+
},
|
|
1921
|
+
parent: null
|
|
1922
|
+
}, N = g._parseSync({
|
|
1923
|
+
data: t.data,
|
|
1924
|
+
path: t.path,
|
|
1925
|
+
parent: y
|
|
1926
|
+
});
|
|
1927
|
+
if (N.status === "valid")
|
|
1928
|
+
return N;
|
|
1929
|
+
N.status === "dirty" && !r && (r = { result: N, ctx: y }), y.common.issues.length && o.push(y.common.issues);
|
|
1930
|
+
}
|
|
1931
|
+
if (r)
|
|
1932
|
+
return t.common.issues.push(...r.ctx.common.issues), r.result;
|
|
1933
|
+
const l = o.map((g) => new P(g));
|
|
1934
|
+
return u(t, {
|
|
1935
|
+
code: c.invalid_union,
|
|
1936
|
+
unionErrors: l
|
|
1937
|
+
}), k;
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
get options() {
|
|
1941
|
+
return this._def.options;
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
ae.create = (n, e) => new ae({
|
|
1945
|
+
options: n,
|
|
1946
|
+
typeName: b.ZodUnion,
|
|
1947
|
+
...S(e)
|
|
1948
|
+
});
|
|
1949
|
+
function ue(n, e) {
|
|
1950
|
+
const t = $(n), a = $(e);
|
|
1951
|
+
if (n === e)
|
|
1952
|
+
return { valid: !0, data: n };
|
|
1953
|
+
if (t === p.object && a === p.object) {
|
|
1954
|
+
const s = C.objectKeys(e), r = C.objectKeys(n).filter((l) => s.indexOf(l) !== -1), o = { ...n, ...e };
|
|
1955
|
+
for (const l of r) {
|
|
1956
|
+
const g = ue(n[l], e[l]);
|
|
1957
|
+
if (!g.valid)
|
|
1958
|
+
return { valid: !1 };
|
|
1959
|
+
o[l] = g.data;
|
|
1960
|
+
}
|
|
1961
|
+
return { valid: !0, data: o };
|
|
1962
|
+
} else if (t === p.array && a === p.array) {
|
|
1963
|
+
if (n.length !== e.length)
|
|
1964
|
+
return { valid: !1 };
|
|
1965
|
+
const s = [];
|
|
1966
|
+
for (let r = 0; r < n.length; r++) {
|
|
1967
|
+
const o = n[r], l = e[r], g = ue(o, l);
|
|
1968
|
+
if (!g.valid)
|
|
1969
|
+
return { valid: !1 };
|
|
1970
|
+
s.push(g.data);
|
|
1971
|
+
}
|
|
1972
|
+
return { valid: !0, data: s };
|
|
1973
|
+
} else return t === p.date && a === p.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
|
|
1974
|
+
}
|
|
1975
|
+
class ne extends T {
|
|
1976
|
+
_parse(e) {
|
|
1977
|
+
const { status: t, ctx: a } = this._processInputParams(e), s = (r, o) => {
|
|
1978
|
+
if (_e(r) || _e(o))
|
|
1979
|
+
return k;
|
|
1980
|
+
const l = ue(r.value, o.value);
|
|
1981
|
+
return l.valid ? ((ve(r) || ve(o)) && t.dirty(), { status: t.value, value: l.data }) : (u(a, {
|
|
1982
|
+
code: c.invalid_intersection_types
|
|
1983
|
+
}), k);
|
|
1984
|
+
};
|
|
1985
|
+
return a.common.async ? Promise.all([
|
|
1986
|
+
this._def.left._parseAsync({
|
|
1987
|
+
data: a.data,
|
|
1988
|
+
path: a.path,
|
|
1989
|
+
parent: a
|
|
1990
|
+
}),
|
|
1991
|
+
this._def.right._parseAsync({
|
|
1992
|
+
data: a.data,
|
|
1993
|
+
path: a.path,
|
|
1994
|
+
parent: a
|
|
1995
|
+
})
|
|
1996
|
+
]).then(([r, o]) => s(r, o)) : s(this._def.left._parseSync({
|
|
1997
|
+
data: a.data,
|
|
1998
|
+
path: a.path,
|
|
1999
|
+
parent: a
|
|
2000
|
+
}), this._def.right._parseSync({
|
|
2001
|
+
data: a.data,
|
|
2002
|
+
path: a.path,
|
|
2003
|
+
parent: a
|
|
2004
|
+
}));
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
ne.create = (n, e, t) => new ne({
|
|
2008
|
+
left: n,
|
|
2009
|
+
right: e,
|
|
2010
|
+
typeName: b.ZodIntersection,
|
|
2011
|
+
...S(t)
|
|
2012
|
+
});
|
|
2013
|
+
class M extends T {
|
|
2014
|
+
_parse(e) {
|
|
2015
|
+
const { status: t, ctx: a } = this._processInputParams(e);
|
|
2016
|
+
if (a.parsedType !== p.array)
|
|
2017
|
+
return u(a, {
|
|
2018
|
+
code: c.invalid_type,
|
|
2019
|
+
expected: p.array,
|
|
2020
|
+
received: a.parsedType
|
|
2021
|
+
}), k;
|
|
2022
|
+
if (a.data.length < this._def.items.length)
|
|
2023
|
+
return u(a, {
|
|
2024
|
+
code: c.too_small,
|
|
2025
|
+
minimum: this._def.items.length,
|
|
2026
|
+
inclusive: !0,
|
|
2027
|
+
exact: !1,
|
|
2028
|
+
type: "array"
|
|
2029
|
+
}), k;
|
|
2030
|
+
!this._def.rest && a.data.length > this._def.items.length && (u(a, {
|
|
2031
|
+
code: c.too_big,
|
|
2032
|
+
maximum: this._def.items.length,
|
|
2033
|
+
inclusive: !0,
|
|
2034
|
+
exact: !1,
|
|
2035
|
+
type: "array"
|
|
2036
|
+
}), t.dirty());
|
|
2037
|
+
const r = [...a.data].map((o, l) => {
|
|
2038
|
+
const g = this._def.items[l] || this._def.rest;
|
|
2039
|
+
return g ? g._parse(new E(a, o, a.path, l)) : null;
|
|
2040
|
+
}).filter((o) => !!o);
|
|
2041
|
+
return a.common.async ? Promise.all(r).then((o) => R.mergeArray(t, o)) : R.mergeArray(t, r);
|
|
2042
|
+
}
|
|
2043
|
+
get items() {
|
|
2044
|
+
return this._def.items;
|
|
2045
|
+
}
|
|
2046
|
+
rest(e) {
|
|
2047
|
+
return new M({
|
|
2048
|
+
...this._def,
|
|
2049
|
+
rest: e
|
|
2050
|
+
});
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
M.create = (n, e) => {
|
|
2054
|
+
if (!Array.isArray(n))
|
|
2055
|
+
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2056
|
+
return new M({
|
|
2057
|
+
items: n,
|
|
2058
|
+
typeName: b.ZodTuple,
|
|
2059
|
+
rest: null,
|
|
2060
|
+
...S(e)
|
|
2061
|
+
});
|
|
2062
|
+
};
|
|
2063
|
+
class se extends T {
|
|
2064
|
+
get keySchema() {
|
|
2065
|
+
return this._def.keyType;
|
|
2066
|
+
}
|
|
2067
|
+
get valueSchema() {
|
|
2068
|
+
return this._def.valueType;
|
|
2069
|
+
}
|
|
2070
|
+
_parse(e) {
|
|
2071
|
+
const { status: t, ctx: a } = this._processInputParams(e);
|
|
2072
|
+
if (a.parsedType !== p.object)
|
|
2073
|
+
return u(a, {
|
|
2074
|
+
code: c.invalid_type,
|
|
2075
|
+
expected: p.object,
|
|
2076
|
+
received: a.parsedType
|
|
2077
|
+
}), k;
|
|
2078
|
+
const s = [], r = this._def.keyType, o = this._def.valueType;
|
|
2079
|
+
for (const l in a.data)
|
|
2080
|
+
s.push({
|
|
2081
|
+
key: r._parse(new E(a, l, a.path, l)),
|
|
2082
|
+
value: o._parse(new E(a, a.data[l], a.path, l)),
|
|
2083
|
+
alwaysSet: l in a.data
|
|
2084
|
+
});
|
|
2085
|
+
return a.common.async ? R.mergeObjectAsync(t, s) : R.mergeObjectSync(t, s);
|
|
2086
|
+
}
|
|
2087
|
+
get element() {
|
|
2088
|
+
return this._def.valueType;
|
|
2089
|
+
}
|
|
2090
|
+
static create(e, t, a) {
|
|
2091
|
+
return t instanceof T ? new se({
|
|
2092
|
+
keyType: e,
|
|
2093
|
+
valueType: t,
|
|
2094
|
+
typeName: b.ZodRecord,
|
|
2095
|
+
...S(a)
|
|
2096
|
+
}) : new se({
|
|
2097
|
+
keyType: j.create(),
|
|
2098
|
+
valueType: e,
|
|
2099
|
+
typeName: b.ZodRecord,
|
|
2100
|
+
...S(t)
|
|
2101
|
+
});
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
class Te extends T {
|
|
2105
|
+
get keySchema() {
|
|
2106
|
+
return this._def.keyType;
|
|
2107
|
+
}
|
|
2108
|
+
get valueSchema() {
|
|
2109
|
+
return this._def.valueType;
|
|
2110
|
+
}
|
|
2111
|
+
_parse(e) {
|
|
2112
|
+
const { status: t, ctx: a } = this._processInputParams(e);
|
|
2113
|
+
if (a.parsedType !== p.map)
|
|
2114
|
+
return u(a, {
|
|
2115
|
+
code: c.invalid_type,
|
|
2116
|
+
expected: p.map,
|
|
2117
|
+
received: a.parsedType
|
|
2118
|
+
}), k;
|
|
2119
|
+
const s = this._def.keyType, r = this._def.valueType, o = [...a.data.entries()].map(([l, g], y) => ({
|
|
2120
|
+
key: s._parse(new E(a, l, a.path, [y, "key"])),
|
|
2121
|
+
value: r._parse(new E(a, g, a.path, [y, "value"]))
|
|
2122
|
+
}));
|
|
2123
|
+
if (a.common.async) {
|
|
2124
|
+
const l = /* @__PURE__ */ new Map();
|
|
2125
|
+
return Promise.resolve().then(async () => {
|
|
2126
|
+
for (const g of o) {
|
|
2127
|
+
const y = await g.key, N = await g.value;
|
|
2128
|
+
if (y.status === "aborted" || N.status === "aborted")
|
|
2129
|
+
return k;
|
|
2130
|
+
(y.status === "dirty" || N.status === "dirty") && t.dirty(), l.set(y.value, N.value);
|
|
2131
|
+
}
|
|
2132
|
+
return { status: t.value, value: l };
|
|
2133
|
+
});
|
|
2134
|
+
} else {
|
|
2135
|
+
const l = /* @__PURE__ */ new Map();
|
|
2136
|
+
for (const g of o) {
|
|
2137
|
+
const y = g.key, N = g.value;
|
|
2138
|
+
if (y.status === "aborted" || N.status === "aborted")
|
|
2139
|
+
return k;
|
|
2140
|
+
(y.status === "dirty" || N.status === "dirty") && t.dirty(), l.set(y.value, N.value);
|
|
2141
|
+
}
|
|
2142
|
+
return { status: t.value, value: l };
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
Te.create = (n, e, t) => new Te({
|
|
2147
|
+
valueType: e,
|
|
2148
|
+
keyType: n,
|
|
2149
|
+
typeName: b.ZodMap,
|
|
2150
|
+
...S(t)
|
|
2151
|
+
});
|
|
2152
|
+
class X extends T {
|
|
2153
|
+
_parse(e) {
|
|
2154
|
+
const { status: t, ctx: a } = this._processInputParams(e);
|
|
2155
|
+
if (a.parsedType !== p.set)
|
|
2156
|
+
return u(a, {
|
|
2157
|
+
code: c.invalid_type,
|
|
2158
|
+
expected: p.set,
|
|
2159
|
+
received: a.parsedType
|
|
2160
|
+
}), k;
|
|
2161
|
+
const s = this._def;
|
|
2162
|
+
s.minSize !== null && a.data.size < s.minSize.value && (u(a, {
|
|
2163
|
+
code: c.too_small,
|
|
2164
|
+
minimum: s.minSize.value,
|
|
2165
|
+
type: "set",
|
|
2166
|
+
inclusive: !0,
|
|
2167
|
+
exact: !1,
|
|
2168
|
+
message: s.minSize.message
|
|
2169
|
+
}), t.dirty()), s.maxSize !== null && a.data.size > s.maxSize.value && (u(a, {
|
|
2170
|
+
code: c.too_big,
|
|
2171
|
+
maximum: s.maxSize.value,
|
|
2172
|
+
type: "set",
|
|
2173
|
+
inclusive: !0,
|
|
2174
|
+
exact: !1,
|
|
2175
|
+
message: s.maxSize.message
|
|
2176
|
+
}), t.dirty());
|
|
2177
|
+
const r = this._def.valueType;
|
|
2178
|
+
function o(g) {
|
|
2179
|
+
const y = /* @__PURE__ */ new Set();
|
|
2180
|
+
for (const N of g) {
|
|
2181
|
+
if (N.status === "aborted")
|
|
2182
|
+
return k;
|
|
2183
|
+
N.status === "dirty" && t.dirty(), y.add(N.value);
|
|
2184
|
+
}
|
|
2185
|
+
return { status: t.value, value: y };
|
|
2186
|
+
}
|
|
2187
|
+
const l = [...a.data.values()].map((g, y) => r._parse(new E(a, g, a.path, y)));
|
|
2188
|
+
return a.common.async ? Promise.all(l).then((g) => o(g)) : o(l);
|
|
2189
|
+
}
|
|
2190
|
+
min(e, t) {
|
|
2191
|
+
return new X({
|
|
2192
|
+
...this._def,
|
|
2193
|
+
minSize: { value: e, message: f.toString(t) }
|
|
2194
|
+
});
|
|
2195
|
+
}
|
|
2196
|
+
max(e, t) {
|
|
2197
|
+
return new X({
|
|
2198
|
+
...this._def,
|
|
2199
|
+
maxSize: { value: e, message: f.toString(t) }
|
|
2200
|
+
});
|
|
2201
|
+
}
|
|
2202
|
+
size(e, t) {
|
|
2203
|
+
return this.min(e, t).max(e, t);
|
|
2204
|
+
}
|
|
2205
|
+
nonempty(e) {
|
|
2206
|
+
return this.min(1, e);
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
X.create = (n, e) => new X({
|
|
2210
|
+
valueType: n,
|
|
2211
|
+
minSize: null,
|
|
2212
|
+
maxSize: null,
|
|
2213
|
+
typeName: b.ZodSet,
|
|
2214
|
+
...S(e)
|
|
2215
|
+
});
|
|
2216
|
+
class pe extends T {
|
|
2217
|
+
get schema() {
|
|
2218
|
+
return this._def.getter();
|
|
2219
|
+
}
|
|
2220
|
+
_parse(e) {
|
|
2221
|
+
const { ctx: t } = this._processInputParams(e);
|
|
2222
|
+
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
pe.create = (n, e) => new pe({
|
|
2226
|
+
getter: n,
|
|
2227
|
+
typeName: b.ZodLazy,
|
|
2228
|
+
...S(e)
|
|
2229
|
+
});
|
|
2230
|
+
class Ce extends T {
|
|
2231
|
+
_parse(e) {
|
|
2232
|
+
if (e.data !== this._def.value) {
|
|
2233
|
+
const t = this._getOrReturnCtx(e);
|
|
2234
|
+
return u(t, {
|
|
2235
|
+
received: t.data,
|
|
2236
|
+
code: c.invalid_literal,
|
|
2237
|
+
expected: this._def.value
|
|
2238
|
+
}), k;
|
|
2239
|
+
}
|
|
2240
|
+
return { status: "valid", value: e.data };
|
|
2241
|
+
}
|
|
2242
|
+
get value() {
|
|
2243
|
+
return this._def.value;
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2246
|
+
Ce.create = (n, e) => new Ce({
|
|
2247
|
+
value: n,
|
|
2248
|
+
typeName: b.ZodLiteral,
|
|
2249
|
+
...S(e)
|
|
2250
|
+
});
|
|
2251
|
+
function Ze(n, e) {
|
|
2252
|
+
return new q({
|
|
2253
|
+
values: n,
|
|
2254
|
+
typeName: b.ZodEnum,
|
|
2255
|
+
...S(e)
|
|
2256
|
+
});
|
|
2257
|
+
}
|
|
2258
|
+
class q extends T {
|
|
2259
|
+
_parse(e) {
|
|
2260
|
+
if (typeof e.data != "string") {
|
|
2261
|
+
const t = this._getOrReturnCtx(e), a = this._def.values;
|
|
2262
|
+
return u(t, {
|
|
2263
|
+
expected: C.joinValues(a),
|
|
2264
|
+
received: t.parsedType,
|
|
2265
|
+
code: c.invalid_type
|
|
2266
|
+
}), k;
|
|
2267
|
+
}
|
|
2268
|
+
if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
|
|
2269
|
+
const t = this._getOrReturnCtx(e), a = this._def.values;
|
|
2270
|
+
return u(t, {
|
|
2271
|
+
received: t.data,
|
|
2272
|
+
code: c.invalid_enum_value,
|
|
2273
|
+
options: a
|
|
2274
|
+
}), k;
|
|
2275
|
+
}
|
|
2276
|
+
return Z(e.data);
|
|
2277
|
+
}
|
|
2278
|
+
get options() {
|
|
2279
|
+
return this._def.values;
|
|
2280
|
+
}
|
|
2281
|
+
get enum() {
|
|
2282
|
+
const e = {};
|
|
2283
|
+
for (const t of this._def.values)
|
|
2284
|
+
e[t] = t;
|
|
2285
|
+
return e;
|
|
2286
|
+
}
|
|
2287
|
+
get Values() {
|
|
2288
|
+
const e = {};
|
|
2289
|
+
for (const t of this._def.values)
|
|
2290
|
+
e[t] = t;
|
|
2291
|
+
return e;
|
|
2292
|
+
}
|
|
2293
|
+
get Enum() {
|
|
2294
|
+
const e = {};
|
|
2295
|
+
for (const t of this._def.values)
|
|
2296
|
+
e[t] = t;
|
|
2297
|
+
return e;
|
|
2298
|
+
}
|
|
2299
|
+
extract(e, t = this._def) {
|
|
2300
|
+
return q.create(e, {
|
|
2301
|
+
...this._def,
|
|
2302
|
+
...t
|
|
2303
|
+
});
|
|
2304
|
+
}
|
|
2305
|
+
exclude(e, t = this._def) {
|
|
2306
|
+
return q.create(this.options.filter((a) => !e.includes(a)), {
|
|
2307
|
+
...this._def,
|
|
2308
|
+
...t
|
|
2309
|
+
});
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
q.create = Ze;
|
|
2313
|
+
class Ne extends T {
|
|
2314
|
+
_parse(e) {
|
|
2315
|
+
const t = C.getValidEnumValues(this._def.values), a = this._getOrReturnCtx(e);
|
|
2316
|
+
if (a.parsedType !== p.string && a.parsedType !== p.number) {
|
|
2317
|
+
const s = C.objectValues(t);
|
|
2318
|
+
return u(a, {
|
|
2319
|
+
expected: C.joinValues(s),
|
|
2320
|
+
received: a.parsedType,
|
|
2321
|
+
code: c.invalid_type
|
|
2322
|
+
}), k;
|
|
2323
|
+
}
|
|
2324
|
+
if (this._cache || (this._cache = new Set(C.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
|
|
2325
|
+
const s = C.objectValues(t);
|
|
2326
|
+
return u(a, {
|
|
2327
|
+
received: a.data,
|
|
2328
|
+
code: c.invalid_enum_value,
|
|
2329
|
+
options: s
|
|
2330
|
+
}), k;
|
|
2331
|
+
}
|
|
2332
|
+
return Z(e.data);
|
|
2333
|
+
}
|
|
2334
|
+
get enum() {
|
|
2335
|
+
return this._def.values;
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
Ne.create = (n, e) => new Ne({
|
|
2339
|
+
values: n,
|
|
2340
|
+
typeName: b.ZodNativeEnum,
|
|
2341
|
+
...S(e)
|
|
2342
|
+
});
|
|
2343
|
+
class re extends T {
|
|
2344
|
+
unwrap() {
|
|
2345
|
+
return this._def.type;
|
|
2346
|
+
}
|
|
2347
|
+
_parse(e) {
|
|
2348
|
+
const { ctx: t } = this._processInputParams(e);
|
|
2349
|
+
if (t.parsedType !== p.promise && t.common.async === !1)
|
|
2350
|
+
return u(t, {
|
|
2351
|
+
code: c.invalid_type,
|
|
2352
|
+
expected: p.promise,
|
|
2353
|
+
received: t.parsedType
|
|
2354
|
+
}), k;
|
|
2355
|
+
const a = t.parsedType === p.promise ? t.data : Promise.resolve(t.data);
|
|
2356
|
+
return Z(a.then((s) => this._def.type.parseAsync(s, {
|
|
2357
|
+
path: t.path,
|
|
2358
|
+
errorMap: t.common.contextualErrorMap
|
|
2359
|
+
})));
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
re.create = (n, e) => new re({
|
|
2363
|
+
type: n,
|
|
2364
|
+
typeName: b.ZodPromise,
|
|
2365
|
+
...S(e)
|
|
2366
|
+
});
|
|
2367
|
+
class W extends T {
|
|
2368
|
+
innerType() {
|
|
2369
|
+
return this._def.schema;
|
|
2370
|
+
}
|
|
2371
|
+
sourceType() {
|
|
2372
|
+
return this._def.schema._def.typeName === b.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
2373
|
+
}
|
|
2374
|
+
_parse(e) {
|
|
2375
|
+
const { status: t, ctx: a } = this._processInputParams(e), s = this._def.effect || null, r = {
|
|
2376
|
+
addIssue: (o) => {
|
|
2377
|
+
u(a, o), o.fatal ? t.abort() : t.dirty();
|
|
2378
|
+
},
|
|
2379
|
+
get path() {
|
|
2380
|
+
return a.path;
|
|
2381
|
+
}
|
|
2382
|
+
};
|
|
2383
|
+
if (r.addIssue = r.addIssue.bind(r), s.type === "preprocess") {
|
|
2384
|
+
const o = s.transform(a.data, r);
|
|
2385
|
+
if (a.common.async)
|
|
2386
|
+
return Promise.resolve(o).then(async (l) => {
|
|
2387
|
+
if (t.value === "aborted")
|
|
2388
|
+
return k;
|
|
2389
|
+
const g = await this._def.schema._parseAsync({
|
|
2390
|
+
data: l,
|
|
2391
|
+
path: a.path,
|
|
2392
|
+
parent: a
|
|
2393
|
+
});
|
|
2394
|
+
return g.status === "aborted" ? k : g.status === "dirty" || t.value === "dirty" ? Y(g.value) : g;
|
|
2395
|
+
});
|
|
2396
|
+
{
|
|
2397
|
+
if (t.value === "aborted")
|
|
2398
|
+
return k;
|
|
2399
|
+
const l = this._def.schema._parseSync({
|
|
2400
|
+
data: o,
|
|
2401
|
+
path: a.path,
|
|
2402
|
+
parent: a
|
|
2403
|
+
});
|
|
2404
|
+
return l.status === "aborted" ? k : l.status === "dirty" || t.value === "dirty" ? Y(l.value) : l;
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
if (s.type === "refinement") {
|
|
2408
|
+
const o = (l) => {
|
|
2409
|
+
const g = s.refinement(l, r);
|
|
2410
|
+
if (a.common.async)
|
|
2411
|
+
return Promise.resolve(g);
|
|
2412
|
+
if (g instanceof Promise)
|
|
2413
|
+
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2414
|
+
return l;
|
|
2415
|
+
};
|
|
2416
|
+
if (a.common.async === !1) {
|
|
2417
|
+
const l = this._def.schema._parseSync({
|
|
2418
|
+
data: a.data,
|
|
2419
|
+
path: a.path,
|
|
2420
|
+
parent: a
|
|
2421
|
+
});
|
|
2422
|
+
return l.status === "aborted" ? k : (l.status === "dirty" && t.dirty(), o(l.value), { status: t.value, value: l.value });
|
|
2423
|
+
} else
|
|
2424
|
+
return this._def.schema._parseAsync({ data: a.data, path: a.path, parent: a }).then((l) => l.status === "aborted" ? k : (l.status === "dirty" && t.dirty(), o(l.value).then(() => ({ status: t.value, value: l.value }))));
|
|
2425
|
+
}
|
|
2426
|
+
if (s.type === "transform")
|
|
2427
|
+
if (a.common.async === !1) {
|
|
2428
|
+
const o = this._def.schema._parseSync({
|
|
2429
|
+
data: a.data,
|
|
2430
|
+
path: a.path,
|
|
2431
|
+
parent: a
|
|
2432
|
+
});
|
|
2433
|
+
if (!U(o))
|
|
2434
|
+
return k;
|
|
2435
|
+
const l = s.transform(o.value, r);
|
|
2436
|
+
if (l instanceof Promise)
|
|
2437
|
+
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2438
|
+
return { status: t.value, value: l };
|
|
2439
|
+
} else
|
|
2440
|
+
return this._def.schema._parseAsync({ data: a.data, path: a.path, parent: a }).then((o) => U(o) ? Promise.resolve(s.transform(o.value, r)).then((l) => ({
|
|
2441
|
+
status: t.value,
|
|
2442
|
+
value: l
|
|
2443
|
+
})) : k);
|
|
2444
|
+
C.assertNever(s);
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
W.create = (n, e, t) => new W({
|
|
2448
|
+
schema: n,
|
|
2449
|
+
typeName: b.ZodEffects,
|
|
2450
|
+
effect: e,
|
|
2451
|
+
...S(t)
|
|
2452
|
+
});
|
|
2453
|
+
W.createWithPreprocess = (n, e, t) => new W({
|
|
2454
|
+
schema: e,
|
|
2455
|
+
effect: { type: "preprocess", transform: n },
|
|
2456
|
+
typeName: b.ZodEffects,
|
|
2457
|
+
...S(t)
|
|
2458
|
+
});
|
|
2459
|
+
class L extends T {
|
|
2460
|
+
_parse(e) {
|
|
2461
|
+
return this._getType(e) === p.undefined ? Z(void 0) : this._def.innerType._parse(e);
|
|
2462
|
+
}
|
|
2463
|
+
unwrap() {
|
|
2464
|
+
return this._def.innerType;
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
2467
|
+
L.create = (n, e) => new L({
|
|
2468
|
+
innerType: n,
|
|
2469
|
+
typeName: b.ZodOptional,
|
|
2470
|
+
...S(e)
|
|
2471
|
+
});
|
|
2472
|
+
class G extends T {
|
|
2473
|
+
_parse(e) {
|
|
2474
|
+
return this._getType(e) === p.null ? Z(null) : this._def.innerType._parse(e);
|
|
2475
|
+
}
|
|
2476
|
+
unwrap() {
|
|
2477
|
+
return this._def.innerType;
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
G.create = (n, e) => new G({
|
|
2481
|
+
innerType: n,
|
|
2482
|
+
typeName: b.ZodNullable,
|
|
2483
|
+
...S(e)
|
|
2484
|
+
});
|
|
2485
|
+
class he extends T {
|
|
2486
|
+
_parse(e) {
|
|
2487
|
+
const { ctx: t } = this._processInputParams(e);
|
|
2488
|
+
let a = t.data;
|
|
2489
|
+
return t.parsedType === p.undefined && (a = this._def.defaultValue()), this._def.innerType._parse({
|
|
2490
|
+
data: a,
|
|
2491
|
+
path: t.path,
|
|
2492
|
+
parent: t
|
|
2493
|
+
});
|
|
2494
|
+
}
|
|
2495
|
+
removeDefault() {
|
|
2496
|
+
return this._def.innerType;
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
he.create = (n, e) => new he({
|
|
2500
|
+
innerType: n,
|
|
2501
|
+
typeName: b.ZodDefault,
|
|
2502
|
+
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2503
|
+
...S(e)
|
|
2504
|
+
});
|
|
2505
|
+
class fe extends T {
|
|
2506
|
+
_parse(e) {
|
|
2507
|
+
const { ctx: t } = this._processInputParams(e), a = {
|
|
2508
|
+
...t,
|
|
2509
|
+
common: {
|
|
2510
|
+
...t.common,
|
|
2511
|
+
issues: []
|
|
2512
|
+
}
|
|
2513
|
+
}, s = this._def.innerType._parse({
|
|
2514
|
+
data: a.data,
|
|
2515
|
+
path: a.path,
|
|
2516
|
+
parent: {
|
|
2517
|
+
...a
|
|
2518
|
+
}
|
|
2519
|
+
});
|
|
2520
|
+
return ee(s) ? s.then((r) => ({
|
|
2521
|
+
status: "valid",
|
|
2522
|
+
value: r.status === "valid" ? r.value : this._def.catchValue({
|
|
2523
|
+
get error() {
|
|
2524
|
+
return new P(a.common.issues);
|
|
2525
|
+
},
|
|
2526
|
+
input: a.data
|
|
2527
|
+
})
|
|
2528
|
+
})) : {
|
|
2529
|
+
status: "valid",
|
|
2530
|
+
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
2531
|
+
get error() {
|
|
2532
|
+
return new P(a.common.issues);
|
|
2533
|
+
},
|
|
2534
|
+
input: a.data
|
|
2535
|
+
})
|
|
2536
|
+
};
|
|
2537
|
+
}
|
|
2538
|
+
removeCatch() {
|
|
2539
|
+
return this._def.innerType;
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
fe.create = (n, e) => new fe({
|
|
2543
|
+
innerType: n,
|
|
2544
|
+
typeName: b.ZodCatch,
|
|
2545
|
+
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2546
|
+
...S(e)
|
|
2547
|
+
});
|
|
2548
|
+
class Oe extends T {
|
|
2549
|
+
_parse(e) {
|
|
2550
|
+
if (this._getType(e) !== p.nan) {
|
|
2551
|
+
const a = this._getOrReturnCtx(e);
|
|
2552
|
+
return u(a, {
|
|
2553
|
+
code: c.invalid_type,
|
|
2554
|
+
expected: p.nan,
|
|
2555
|
+
received: a.parsedType
|
|
2556
|
+
}), k;
|
|
2557
|
+
}
|
|
2558
|
+
return { status: "valid", value: e.data };
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
Oe.create = (n) => new Oe({
|
|
2562
|
+
typeName: b.ZodNaN,
|
|
2563
|
+
...S(n)
|
|
2564
|
+
});
|
|
2565
|
+
class st extends T {
|
|
2566
|
+
_parse(e) {
|
|
2567
|
+
const { ctx: t } = this._processInputParams(e), a = t.data;
|
|
2568
|
+
return this._def.type._parse({
|
|
2569
|
+
data: a,
|
|
2570
|
+
path: t.path,
|
|
2571
|
+
parent: t
|
|
2572
|
+
});
|
|
2573
|
+
}
|
|
2574
|
+
unwrap() {
|
|
2575
|
+
return this._def.type;
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
class ge extends T {
|
|
2579
|
+
_parse(e) {
|
|
2580
|
+
const { status: t, ctx: a } = this._processInputParams(e);
|
|
2581
|
+
if (a.common.async)
|
|
2582
|
+
return (async () => {
|
|
2583
|
+
const r = await this._def.in._parseAsync({
|
|
2584
|
+
data: a.data,
|
|
2585
|
+
path: a.path,
|
|
2586
|
+
parent: a
|
|
2587
|
+
});
|
|
2588
|
+
return r.status === "aborted" ? k : r.status === "dirty" ? (t.dirty(), Y(r.value)) : this._def.out._parseAsync({
|
|
2589
|
+
data: r.value,
|
|
2590
|
+
path: a.path,
|
|
2591
|
+
parent: a
|
|
2592
|
+
});
|
|
2593
|
+
})();
|
|
2594
|
+
{
|
|
2595
|
+
const s = this._def.in._parseSync({
|
|
2596
|
+
data: a.data,
|
|
2597
|
+
path: a.path,
|
|
2598
|
+
parent: a
|
|
2599
|
+
});
|
|
2600
|
+
return s.status === "aborted" ? k : s.status === "dirty" ? (t.dirty(), {
|
|
2601
|
+
status: "dirty",
|
|
2602
|
+
value: s.value
|
|
2603
|
+
}) : this._def.out._parseSync({
|
|
2604
|
+
data: s.value,
|
|
2605
|
+
path: a.path,
|
|
2606
|
+
parent: a
|
|
2607
|
+
});
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
static create(e, t) {
|
|
2611
|
+
return new ge({
|
|
2612
|
+
in: e,
|
|
2613
|
+
out: t,
|
|
2614
|
+
typeName: b.ZodPipeline
|
|
2615
|
+
});
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2618
|
+
class me extends T {
|
|
2619
|
+
_parse(e) {
|
|
2620
|
+
const t = this._def.innerType._parse(e), a = (s) => (U(s) && (s.value = Object.freeze(s.value)), s);
|
|
2621
|
+
return ee(t) ? t.then((s) => a(s)) : a(t);
|
|
2622
|
+
}
|
|
2623
|
+
unwrap() {
|
|
2624
|
+
return this._def.innerType;
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
me.create = (n, e) => new me({
|
|
2628
|
+
innerType: n,
|
|
2629
|
+
typeName: b.ZodReadonly,
|
|
2630
|
+
...S(e)
|
|
2631
|
+
});
|
|
2632
|
+
var b;
|
|
2633
|
+
(function(n) {
|
|
2634
|
+
n.ZodString = "ZodString", n.ZodNumber = "ZodNumber", n.ZodNaN = "ZodNaN", n.ZodBigInt = "ZodBigInt", n.ZodBoolean = "ZodBoolean", n.ZodDate = "ZodDate", n.ZodSymbol = "ZodSymbol", n.ZodUndefined = "ZodUndefined", n.ZodNull = "ZodNull", n.ZodAny = "ZodAny", n.ZodUnknown = "ZodUnknown", n.ZodNever = "ZodNever", n.ZodVoid = "ZodVoid", n.ZodArray = "ZodArray", n.ZodObject = "ZodObject", n.ZodUnion = "ZodUnion", n.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", n.ZodIntersection = "ZodIntersection", n.ZodTuple = "ZodTuple", n.ZodRecord = "ZodRecord", n.ZodMap = "ZodMap", n.ZodSet = "ZodSet", n.ZodFunction = "ZodFunction", n.ZodLazy = "ZodLazy", n.ZodLiteral = "ZodLiteral", n.ZodEnum = "ZodEnum", n.ZodEffects = "ZodEffects", n.ZodNativeEnum = "ZodNativeEnum", n.ZodOptional = "ZodOptional", n.ZodNullable = "ZodNullable", n.ZodDefault = "ZodDefault", n.ZodCatch = "ZodCatch", n.ZodPromise = "ZodPromise", n.ZodBranded = "ZodBranded", n.ZodPipeline = "ZodPipeline", n.ZodReadonly = "ZodReadonly";
|
|
2635
|
+
})(b || (b = {}));
|
|
2636
|
+
const i = j.create, _ = F.create, d = le.create, x = ce.create, O = de.create;
|
|
2637
|
+
V.create;
|
|
2638
|
+
const z = I.create, m = A.create, v = ae.create;
|
|
2639
|
+
ne.create;
|
|
2640
|
+
const D = M.create, H = se.create, rt = pe.create, w = q.create;
|
|
2641
|
+
re.create;
|
|
2642
|
+
L.create;
|
|
2643
|
+
G.create;
|
|
2644
|
+
const h = v([
|
|
2645
|
+
i(),
|
|
2646
|
+
_(),
|
|
2647
|
+
d(),
|
|
2648
|
+
x(),
|
|
2649
|
+
m({ path: i() })
|
|
2650
|
+
]), K = rt(
|
|
2651
|
+
() => v([
|
|
2652
|
+
m({ and: z(K) }),
|
|
2653
|
+
m({ or: z(K) }),
|
|
2654
|
+
m({ not: K }),
|
|
2655
|
+
m({ path: i() }),
|
|
2656
|
+
m({ eq: D([h, h]) }),
|
|
2657
|
+
m({ neq: D([h, h]) }),
|
|
2658
|
+
m({ gt: D([h, h]) }),
|
|
2659
|
+
m({ gte: D([h, h]) }),
|
|
2660
|
+
m({ lt: D([h, h]) }),
|
|
2661
|
+
m({ lte: D([h, h]) })
|
|
2662
|
+
])
|
|
2663
|
+
), it = v([
|
|
2664
|
+
d(),
|
|
2665
|
+
m({ path: i() }),
|
|
2666
|
+
m({ auth: w(["signedIn", "signedOut"]) }),
|
|
2667
|
+
K
|
|
2668
|
+
]), ot = m({
|
|
2669
|
+
title: i(),
|
|
2670
|
+
message: i(),
|
|
2671
|
+
variant: w(["default", "danger"]).optional(),
|
|
2672
|
+
confirmLabel: i().optional(),
|
|
2673
|
+
cancelLabel: i().optional()
|
|
2674
|
+
}), lt = m({
|
|
2675
|
+
name: i(),
|
|
2676
|
+
params: H(i(), h).optional(),
|
|
2677
|
+
confirm: ot.optional(),
|
|
2678
|
+
onSuccess: m({ set: H(i(), h) }).optional(),
|
|
2679
|
+
onError: m({ set: H(i(), h) }).optional()
|
|
2680
|
+
}), ct = m({
|
|
2681
|
+
variant: w(["primary", "secondary", "destructive", "outline", "beta"]).optional(),
|
|
2682
|
+
className: i().optional(),
|
|
2683
|
+
children: v([i(), _(), d(), x(), h]).optional()
|
|
2684
|
+
}), dt = m({
|
|
2685
|
+
icon: v([i(), _(), d(), x(), h]).optional(),
|
|
2686
|
+
text: i().optional(),
|
|
2687
|
+
children: v([i(), _(), d(), x(), h]).optional(),
|
|
2688
|
+
variant: w(["default", "alert", "error"]).optional(),
|
|
2689
|
+
className: i().optional()
|
|
2690
|
+
}), ut = m({
|
|
2691
|
+
size: w(["sm", "base"]).optional(),
|
|
2692
|
+
children: v([i(), _(), d(), x(), h]).optional(),
|
|
2693
|
+
className: i().optional()
|
|
2694
|
+
}), pt = m({
|
|
2695
|
+
children: v([i(), _(), d(), x(), h]).optional(),
|
|
2696
|
+
className: i().optional(),
|
|
2697
|
+
icon: v([i(), _(), d(), x(), h]).optional(),
|
|
2698
|
+
loading: d().optional(),
|
|
2699
|
+
shape: w(["base", "square", "circle"]).optional(),
|
|
2700
|
+
size: w(["xs", "sm", "base", "lg"]).optional(),
|
|
2701
|
+
variant: w(["primary", "secondary", "ghost", "destructive", "secondary-destructive", "outline"]).optional(),
|
|
2702
|
+
id: i().optional(),
|
|
2703
|
+
lang: i().optional(),
|
|
2704
|
+
title: i().optional(),
|
|
2705
|
+
disabled: d().optional(),
|
|
2706
|
+
name: i().optional(),
|
|
2707
|
+
type: w(["submit", "reset", "button"]).optional(),
|
|
2708
|
+
value: O().optional()
|
|
2709
|
+
}), ht = m({
|
|
2710
|
+
variant: w(["default", "error"]).optional(),
|
|
2711
|
+
// Visual variant: "default" or "error" for validation failures (visual only, no error text)
|
|
2712
|
+
label: v([i(), _(), d(), x(), h]).optional(),
|
|
2713
|
+
// Label content for the checkbox (enables built-in Field wrapper) - can be a string or any React node
|
|
2714
|
+
labelTooltip: v([i(), _(), d(), x(), h]).optional(),
|
|
2715
|
+
// Tooltip content to display next to the label via an info icon
|
|
2716
|
+
controlFirst: d().optional(),
|
|
2717
|
+
// When true (default), checkbox appears before label. When false, label appears before checkbox.
|
|
2718
|
+
checked: d().optional(),
|
|
2719
|
+
// Whether the checkbox is checked (controlled)
|
|
2720
|
+
indeterminate: d().optional(),
|
|
2721
|
+
// Whether the checkbox is in indeterminate state
|
|
2722
|
+
disabled: d().optional(),
|
|
2723
|
+
// Whether the checkbox is disabled
|
|
2724
|
+
name: i().optional(),
|
|
2725
|
+
// Name for form submission
|
|
2726
|
+
required: d().optional(),
|
|
2727
|
+
// Whether the field is required
|
|
2728
|
+
className: i().optional(),
|
|
2729
|
+
// Additional class name
|
|
2730
|
+
onValueChange: O().optional()
|
|
2731
|
+
// Callback when checkbox value changes
|
|
2732
|
+
}), ft = m({
|
|
2733
|
+
size: w(["sm", "base", "lg"]).optional(),
|
|
2734
|
+
text: i(),
|
|
2735
|
+
// The text to display and copy to clipboard
|
|
2736
|
+
className: i().optional()
|
|
2737
|
+
// Additional CSS classes
|
|
2738
|
+
}), mt = m({
|
|
2739
|
+
lang: w(["ts", "tsx", "jsonc", "bash", "css"]).optional(),
|
|
2740
|
+
code: i(),
|
|
2741
|
+
// The code content to display
|
|
2742
|
+
values: O().optional(),
|
|
2743
|
+
// Template values for interpolation
|
|
2744
|
+
className: i().optional()
|
|
2745
|
+
// Additional CSS classes
|
|
2746
|
+
}), gt = m({
|
|
2747
|
+
children: v([i(), _(), d(), x(), h]).optional(),
|
|
2748
|
+
label: i(),
|
|
2749
|
+
// Text label displayed in the trigger button
|
|
2750
|
+
open: d().optional(),
|
|
2751
|
+
// Whether the collapsible content is visible
|
|
2752
|
+
className: i().optional(),
|
|
2753
|
+
// Additional CSS classes for the content panel
|
|
2754
|
+
onOpenChange: O().optional()
|
|
2755
|
+
// Callback when collapsed state changes
|
|
2756
|
+
}), yt = m({
|
|
2757
|
+
inputSide: w(["right", "top"]).optional(),
|
|
2758
|
+
items: z(O()),
|
|
2759
|
+
// Array of items to display in the dropdown
|
|
2760
|
+
value: z(O()).optional(),
|
|
2761
|
+
// Currently selected value(s)
|
|
2762
|
+
children: v([i(), _(), d(), x(), h]).optional(),
|
|
2763
|
+
// Combobox content (trigger, content, items)
|
|
2764
|
+
className: i().optional(),
|
|
2765
|
+
// Additional CSS classes
|
|
2766
|
+
label: v([i(), _(), d(), x(), h]).optional(),
|
|
2767
|
+
// Label content for the combobox (enables Field wrapper) - can be a string or any React node
|
|
2768
|
+
required: d().optional(),
|
|
2769
|
+
// Whether the combobox is required
|
|
2770
|
+
labelTooltip: v([i(), _(), d(), x(), h]).optional(),
|
|
2771
|
+
// Tooltip content to display next to the label via an info icon
|
|
2772
|
+
description: v([i(), _(), d(), x(), h]).optional(),
|
|
2773
|
+
// Helper text displayed below the combobox
|
|
2774
|
+
error: O().optional(),
|
|
2775
|
+
// Error message or validation error object
|
|
2776
|
+
onValueChange: O().optional(),
|
|
2777
|
+
// Callback when selection changes
|
|
2778
|
+
multiple: d().optional(),
|
|
2779
|
+
// Allow multiple selections
|
|
2780
|
+
isItemEqualToValue: O().optional()
|
|
2781
|
+
// Custom equality function for comparing items
|
|
2782
|
+
}), _t = m({
|
|
2783
|
+
open: d(),
|
|
2784
|
+
// Whether the dialog is open
|
|
2785
|
+
children: v([i(), _(), d(), x(), h]).optional()
|
|
2786
|
+
// Child content - typically one or more Panel components
|
|
2787
|
+
}), vt = m({
|
|
2788
|
+
size: w(["sm", "base", "lg"]).optional(),
|
|
2789
|
+
variant: w(["default", "subtle"]).optional(),
|
|
2790
|
+
timezone: i().optional(),
|
|
2791
|
+
// Display timezone (display only)
|
|
2792
|
+
className: i().optional(),
|
|
2793
|
+
// Additional CSS classes
|
|
2794
|
+
onStartDateChange: O().optional(),
|
|
2795
|
+
// Callback when start date changes
|
|
2796
|
+
onEndDateChange: O().optional()
|
|
2797
|
+
// Callback when end date changes
|
|
2798
|
+
}), xt = m({
|
|
2799
|
+
className: i().optional(),
|
|
2800
|
+
children: v([i(), _(), d(), x(), h]).optional(),
|
|
2801
|
+
size: w(["base", "sm", "lg", "xl"]).optional()
|
|
2802
|
+
}), bt = m({
|
|
2803
|
+
variant: w(["default", "danger"]).optional()
|
|
2804
|
+
}), kt = m({
|
|
2805
|
+
size: w(["sm", "base", "lg"]).optional(),
|
|
2806
|
+
icon: v([i(), _(), d(), x(), h]).optional(),
|
|
2807
|
+
title: i(),
|
|
2808
|
+
description: i().optional(),
|
|
2809
|
+
commandLine: i().optional(),
|
|
2810
|
+
contents: v([i(), _(), d(), x(), h]).optional(),
|
|
2811
|
+
className: i().optional()
|
|
2812
|
+
}), wt = m({
|
|
2813
|
+
controlFirst: d().optional(),
|
|
2814
|
+
// When true, places the control (checkbox/switch) before the label visually. When false (default), places the label before the control. Used to support different layout patterns (e.g., iOS-style toggles on the right).
|
|
2815
|
+
children: v([i(), _(), d(), x(), h]).optional(),
|
|
2816
|
+
label: v([i(), _(), d(), x(), h]).optional(),
|
|
2817
|
+
// The label content - can be a string or any React node
|
|
2818
|
+
required: d().optional(),
|
|
2819
|
+
// When explicitly false, shows gray "(optional)" text after the label. When true or undefined, no indicator is shown.
|
|
2820
|
+
labelTooltip: v([i(), _(), d(), x(), h]).optional(),
|
|
2821
|
+
// Tooltip content to display next to the label via an info icon
|
|
2822
|
+
error: O().optional(),
|
|
2823
|
+
description: v([i(), _(), d(), x(), h]).optional()
|
|
2824
|
+
}), St = m({
|
|
2825
|
+
children: v([i(), _(), d(), x(), h]).optional(),
|
|
2826
|
+
// Child node(s) that can be nested inside component
|
|
2827
|
+
className: i().optional(),
|
|
2828
|
+
// CSS class names that can be appended to the component
|
|
2829
|
+
id: i().optional(),
|
|
2830
|
+
lang: i().optional(),
|
|
2831
|
+
title: i().optional(),
|
|
2832
|
+
mobileDivider: d().optional(),
|
|
2833
|
+
// Show dividers between grid items on mobile (only works with 4up variant)
|
|
2834
|
+
gap: w(["none", "sm", "base", "lg"]).optional(),
|
|
2835
|
+
// Gap size between grid items
|
|
2836
|
+
variant: w(["2up", "side-by-side", "2-1", "1-2", "1-3up", "3up", "4up", "6up", "1-2-4up"]).optional()
|
|
2837
|
+
// Stylistic variations of the Grid layout
|
|
2838
|
+
}), Tt = m({
|
|
2839
|
+
label: v([i(), _(), d(), x(), h]).optional(),
|
|
2840
|
+
// Label content for the input (enables Field wrapper) - can be a string or any React node
|
|
2841
|
+
labelTooltip: v([i(), _(), d(), x(), h]).optional(),
|
|
2842
|
+
// Tooltip content to display next to the label via an info icon
|
|
2843
|
+
description: v([i(), _(), d(), x(), h]).optional(),
|
|
2844
|
+
// Helper text displayed below the input
|
|
2845
|
+
error: O().optional(),
|
|
2846
|
+
// Error message or validation error object
|
|
2847
|
+
size: w(["xs", "sm", "base", "lg"]).optional(),
|
|
2848
|
+
variant: w(["default", "error"]).optional()
|
|
2849
|
+
}), Ct = m({}), Nt = m({
|
|
2850
|
+
children: v([i(), _(), d(), x(), h]).optional(),
|
|
2851
|
+
// The label content - can be a string or any React node
|
|
2852
|
+
showOptional: d().optional(),
|
|
2853
|
+
// When true (and required is false), shows gray "(optional)" text after the label
|
|
2854
|
+
tooltip: v([i(), _(), d(), x(), h]).optional(),
|
|
2855
|
+
// Tooltip content to display next to the label via an info icon
|
|
2856
|
+
className: i().optional(),
|
|
2857
|
+
// Additional CSS classes
|
|
2858
|
+
asContent: d().optional()
|
|
2859
|
+
// When true, only renders the inline content (indicators, tooltip) without the outer span with font styling. Useful when composed inside another label element that already provides the text styling.
|
|
2860
|
+
}), Ot = m({
|
|
2861
|
+
children: v([i(), _(), d(), x(), h]).optional(),
|
|
2862
|
+
className: i().optional()
|
|
2863
|
+
}), At = m({
|
|
2864
|
+
variant: w(["inline", "current", "plain"]).optional(),
|
|
2865
|
+
to: i().optional(),
|
|
2866
|
+
children: v([i(), _(), d(), x(), h]).optional(),
|
|
2867
|
+
className: i().optional(),
|
|
2868
|
+
id: i().optional(),
|
|
2869
|
+
lang: i().optional(),
|
|
2870
|
+
title: i().optional(),
|
|
2871
|
+
download: O().optional(),
|
|
2872
|
+
href: i().optional(),
|
|
2873
|
+
hrefLang: i().optional(),
|
|
2874
|
+
media: i().optional(),
|
|
2875
|
+
ping: i().optional(),
|
|
2876
|
+
target: O().optional(),
|
|
2877
|
+
type: i().optional(),
|
|
2878
|
+
referrerPolicy: w(["", "no-referrer", "no-referrer-when-downgrade", "origin", "origin-when-cross-origin", "same-origin", "strict-origin", "strict-origin-when-cross-origin", "unsafe-url"]).optional(),
|
|
2879
|
+
render: v([i(), _(), d(), x(), h]).optional()
|
|
2880
|
+
// Allows you to replace the component’s HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.
|
|
2881
|
+
}), Rt = m({
|
|
2882
|
+
className: i().optional(),
|
|
2883
|
+
size: w(["sm", "base", "lg"]).optional()
|
|
2884
|
+
}), Zt = m({
|
|
2885
|
+
className: i().optional(),
|
|
2886
|
+
isActive: O().optional(),
|
|
2887
|
+
options: z(O()),
|
|
2888
|
+
optionIds: d().optional()
|
|
2889
|
+
}), It = m({
|
|
2890
|
+
customValue: i().optional(),
|
|
2891
|
+
label: i(),
|
|
2892
|
+
showValue: d().optional(),
|
|
2893
|
+
trackClassName: i().optional(),
|
|
2894
|
+
indicatorClassName: i().optional(),
|
|
2895
|
+
value: _().optional(),
|
|
2896
|
+
// Current value of the meter
|
|
2897
|
+
max: _().optional(),
|
|
2898
|
+
// Maximum value of the meter (default: 100)
|
|
2899
|
+
min: _().optional()
|
|
2900
|
+
// Minimum value of the meter (default: 0)
|
|
2901
|
+
}), Pt = m({
|
|
2902
|
+
controls: w(["full", "simple"]).optional(),
|
|
2903
|
+
setPage: O(),
|
|
2904
|
+
// Callback when page changes
|
|
2905
|
+
page: _().optional(),
|
|
2906
|
+
perPage: _().optional(),
|
|
2907
|
+
totalCount: _().optional()
|
|
2908
|
+
}), Et = m({
|
|
2909
|
+
side: w(["top", "bottom", "left", "right"]).optional()
|
|
2910
|
+
}), jt = m({
|
|
2911
|
+
legend: i(),
|
|
2912
|
+
// Legend text for the group (required for accessibility)
|
|
2913
|
+
children: v([i(), _(), d(), x(), h]).optional(),
|
|
2914
|
+
// Child Radio.Item components
|
|
2915
|
+
orientation: w(["vertical", "horizontal"]).optional(),
|
|
2916
|
+
// Layout direction of the radio items
|
|
2917
|
+
error: i().optional(),
|
|
2918
|
+
// Error message for the group
|
|
2919
|
+
description: v([i(), _(), d(), x(), h]).optional(),
|
|
2920
|
+
// Helper text for the group
|
|
2921
|
+
value: i().optional(),
|
|
2922
|
+
// Value of the radio that should be selected (controlled)
|
|
2923
|
+
disabled: d().optional(),
|
|
2924
|
+
// Whether all radios in the group are disabled
|
|
2925
|
+
controlPosition: w(["start", "end"]).optional(),
|
|
2926
|
+
// Position of radio control relative to label: "start" (default) puts radio before label, "end" puts label before radio
|
|
2927
|
+
name: i().optional(),
|
|
2928
|
+
// Form submission name for the radio group
|
|
2929
|
+
className: i().optional()
|
|
2930
|
+
// Additional CSS classes
|
|
2931
|
+
}), $t = m({
|
|
2932
|
+
className: i().optional(),
|
|
2933
|
+
// Additional CSS classes
|
|
2934
|
+
label: v([i(), _(), d(), x(), h]).optional(),
|
|
2935
|
+
// Label content for the select (enables Field wrapper) - can be a string or any React node
|
|
2936
|
+
hideLabel: d().optional(),
|
|
2937
|
+
// Whether to visually hide the label (still accessible to screen readers)
|
|
2938
|
+
placeholder: i().optional(),
|
|
2939
|
+
// Placeholder text when no value is selected
|
|
2940
|
+
loading: d().optional(),
|
|
2941
|
+
// Whether the select is in a loading state
|
|
2942
|
+
disabled: d().optional(),
|
|
2943
|
+
// Whether the select is disabled
|
|
2944
|
+
required: d().optional(),
|
|
2945
|
+
// Whether the select is required
|
|
2946
|
+
labelTooltip: v([i(), _(), d(), x(), h]).optional(),
|
|
2947
|
+
// Tooltip content to display next to the label via an info icon
|
|
2948
|
+
value: i().optional(),
|
|
2949
|
+
// The currently selected value
|
|
2950
|
+
children: v([i(), _(), d(), x(), h]).optional(),
|
|
2951
|
+
// Child elements (Select.Option components)
|
|
2952
|
+
description: v([i(), _(), d(), x(), h]).optional(),
|
|
2953
|
+
// Helper text displayed below the select
|
|
2954
|
+
error: O().optional(),
|
|
2955
|
+
// Error message or validation error object
|
|
2956
|
+
onValueChange: O().optional(),
|
|
2957
|
+
// Callback when selection changes
|
|
2958
|
+
defaultValue: i().optional()
|
|
2959
|
+
// Initial value for uncontrolled mode
|
|
2960
|
+
}), Lt = m({
|
|
2961
|
+
alt: i().optional(),
|
|
2962
|
+
autoComplete: O().optional(),
|
|
2963
|
+
checked: d().optional(),
|
|
2964
|
+
disabled: d().optional(),
|
|
2965
|
+
height: O().optional(),
|
|
2966
|
+
list: i().optional(),
|
|
2967
|
+
name: i().optional(),
|
|
2968
|
+
placeholder: i().optional(),
|
|
2969
|
+
readOnly: d().optional(),
|
|
2970
|
+
required: d().optional(),
|
|
2971
|
+
width: O().optional(),
|
|
2972
|
+
className: i().optional(),
|
|
2973
|
+
id: i().optional(),
|
|
2974
|
+
lang: i().optional(),
|
|
2975
|
+
title: i().optional(),
|
|
2976
|
+
children: v([i(), _(), d(), x(), h]).optional(),
|
|
2977
|
+
value: i().optional(),
|
|
2978
|
+
// Controlled value
|
|
2979
|
+
size: w(["xs", "sm", "base", "lg"]).optional(),
|
|
2980
|
+
// Size variant
|
|
2981
|
+
variant: w(["default", "error"]).optional(),
|
|
2982
|
+
// Style variant
|
|
2983
|
+
label: v([i(), _(), d(), x(), h]).optional(),
|
|
2984
|
+
// Label content for the input (enables Field wrapper and sets masked state label) - can be a string or any React node
|
|
2985
|
+
labelTooltip: v([i(), _(), d(), x(), h]).optional(),
|
|
2986
|
+
// Tooltip content to display next to the label via an info icon
|
|
2987
|
+
description: v([i(), _(), d(), x(), h]).optional(),
|
|
2988
|
+
// Helper text displayed below the input
|
|
2989
|
+
error: O().optional()
|
|
2990
|
+
// Error message or validation error object
|
|
2991
|
+
}), Vt = m({
|
|
2992
|
+
as: O().optional(),
|
|
2993
|
+
// The element type to render as (default: "div")
|
|
2994
|
+
className: i().optional(),
|
|
2995
|
+
// Additional CSS classes
|
|
2996
|
+
children: v([i(), _(), d(), x(), h]).optional()
|
|
2997
|
+
// Child elements
|
|
2998
|
+
}), Mt = m({
|
|
2999
|
+
variant: w(["default", "error"]).optional(),
|
|
3000
|
+
// Visual variant: "default" or "error" for validation failures (visual only, no error text)
|
|
3001
|
+
label: v([i(), _(), d(), x(), h]).optional(),
|
|
3002
|
+
// Label content for the switch (Field wrapper is built-in) - can be a string or any React node. Optional when used standalone for visual-only purposes.
|
|
3003
|
+
labelTooltip: v([i(), _(), d(), x(), h]).optional(),
|
|
3004
|
+
// Tooltip content to display next to the label via an info icon
|
|
3005
|
+
required: d().optional(),
|
|
3006
|
+
// Whether the switch is required. When explicitly false, shows "(optional)" text after the label.
|
|
3007
|
+
controlFirst: d().optional(),
|
|
3008
|
+
// When true (default), switch appears before label. When false, label appears before switch.
|
|
3009
|
+
size: w(["sm", "base", "lg"]).optional(),
|
|
3010
|
+
checked: d().optional(),
|
|
3011
|
+
disabled: d().optional(),
|
|
3012
|
+
transitioning: d().optional(),
|
|
3013
|
+
name: i().optional(),
|
|
3014
|
+
type: w(["submit", "reset", "button"]).optional(),
|
|
3015
|
+
value: O().optional(),
|
|
3016
|
+
className: i().optional(),
|
|
3017
|
+
id: i().optional(),
|
|
3018
|
+
lang: i().optional(),
|
|
3019
|
+
title: i().optional(),
|
|
3020
|
+
onClick: O()
|
|
3021
|
+
// Callback when switch is clicked
|
|
3022
|
+
}), zt = m({
|
|
3023
|
+
layout: w(["auto", "fixed"]).optional(),
|
|
3024
|
+
variant: w(["default", "selected"]).optional(),
|
|
3025
|
+
className: i().optional(),
|
|
3026
|
+
// Additional CSS classes
|
|
3027
|
+
children: v([i(), _(), d(), x(), h]).optional()
|
|
3028
|
+
// Child elements
|
|
3029
|
+
}), Dt = m({
|
|
3030
|
+
tabs: z(O()).optional(),
|
|
3031
|
+
// Array of tab items to render
|
|
3032
|
+
value: i().optional(),
|
|
3033
|
+
// Controlled value. When set, component becomes controlled.
|
|
3034
|
+
selectedValue: i().optional(),
|
|
3035
|
+
// Default selected value for uncontrolled mode. Ignored when `value` is set.
|
|
3036
|
+
activateOnFocus: d().optional(),
|
|
3037
|
+
// When true, tabs are activated immediately upon receiving focus via arrow keys. When false (default), tabs receive focus but require Enter/Space to activate. Set to true for better keyboard UX in most cases.
|
|
3038
|
+
className: i().optional(),
|
|
3039
|
+
// Additional class name for the root element
|
|
3040
|
+
listClassName: i().optional(),
|
|
3041
|
+
// Additional class name for the tab list element
|
|
3042
|
+
indicatorClassName: i().optional(),
|
|
3043
|
+
// Additional class name for the indicator element
|
|
3044
|
+
variant: w(["segmented", "underline"]).optional(),
|
|
3045
|
+
onValueChange: O().optional()
|
|
3046
|
+
// Callback when active tab changes
|
|
3047
|
+
}), Bt = m({
|
|
3048
|
+
variant: w(["heading1", "heading2", "heading3", "body", "secondary", "success", "error", "mono", "mono-secondary"]).optional(),
|
|
3049
|
+
// Text style variant
|
|
3050
|
+
size: w(["xs", "sm", "base", "lg"]).optional(),
|
|
3051
|
+
// Text size (only applies to body/secondary/success/error variants)
|
|
3052
|
+
bold: d().optional(),
|
|
3053
|
+
// Whether to use bold font weight (only applies to body variants)
|
|
3054
|
+
as: O().optional(),
|
|
3055
|
+
// The element type to render as
|
|
3056
|
+
children: v([i(), _(), d(), x(), h]).optional()
|
|
3057
|
+
// Child text content
|
|
3058
|
+
}), Ut = m({
|
|
3059
|
+
children: v([i(), _(), d(), x(), h]).optional()
|
|
3060
|
+
}), Ft = m({
|
|
3061
|
+
align: w(["start", "center", "end"]).optional(),
|
|
3062
|
+
asChild: d().optional(),
|
|
3063
|
+
className: i().optional(),
|
|
3064
|
+
side: w(["top", "bottom", "left", "right"]).optional(),
|
|
3065
|
+
content: v([i(), _(), d(), x(), h])
|
|
3066
|
+
// Content to display in the tooltip
|
|
3067
|
+
}), qt = w([
|
|
3068
|
+
"Badge",
|
|
3069
|
+
"Banner",
|
|
3070
|
+
"Breadcrumbs",
|
|
3071
|
+
"Button",
|
|
3072
|
+
"Checkbox",
|
|
3073
|
+
"ClipboardText",
|
|
3074
|
+
"Code",
|
|
3075
|
+
"Collapsible",
|
|
3076
|
+
"Combobox",
|
|
3077
|
+
"CommandPalette",
|
|
3078
|
+
"DateRangePicker",
|
|
3079
|
+
"Dialog",
|
|
3080
|
+
"DropdownMenu",
|
|
3081
|
+
"Empty",
|
|
3082
|
+
"Field",
|
|
3083
|
+
"Grid",
|
|
3084
|
+
"Input",
|
|
3085
|
+
"InputArea",
|
|
3086
|
+
"Label",
|
|
3087
|
+
"LayerCard",
|
|
3088
|
+
"Link",
|
|
3089
|
+
"Loader",
|
|
3090
|
+
"MenuBar",
|
|
3091
|
+
"Meter",
|
|
3092
|
+
"Pagination",
|
|
3093
|
+
"Popover",
|
|
3094
|
+
"Radio",
|
|
3095
|
+
"Select",
|
|
3096
|
+
"SensitiveInput",
|
|
3097
|
+
"Surface",
|
|
3098
|
+
"Switch",
|
|
3099
|
+
"Table",
|
|
3100
|
+
"Tabs",
|
|
3101
|
+
"Text",
|
|
3102
|
+
"Toasty",
|
|
3103
|
+
"Tooltip"
|
|
3104
|
+
]), Wt = {
|
|
3105
|
+
Badge: ct,
|
|
3106
|
+
Banner: dt,
|
|
3107
|
+
Breadcrumbs: ut,
|
|
3108
|
+
Button: pt,
|
|
3109
|
+
Checkbox: ht,
|
|
3110
|
+
ClipboardText: ft,
|
|
3111
|
+
Code: mt,
|
|
3112
|
+
Collapsible: gt,
|
|
3113
|
+
Combobox: yt,
|
|
3114
|
+
CommandPalette: _t,
|
|
3115
|
+
DateRangePicker: vt,
|
|
3116
|
+
Dialog: xt,
|
|
3117
|
+
DropdownMenu: bt,
|
|
3118
|
+
Empty: kt,
|
|
3119
|
+
Field: wt,
|
|
3120
|
+
Grid: St,
|
|
3121
|
+
Input: Tt,
|
|
3122
|
+
InputArea: Ct,
|
|
3123
|
+
Label: Nt,
|
|
3124
|
+
LayerCard: Ot,
|
|
3125
|
+
Link: At,
|
|
3126
|
+
Loader: Rt,
|
|
3127
|
+
MenuBar: Zt,
|
|
3128
|
+
Meter: It,
|
|
3129
|
+
Pagination: Pt,
|
|
3130
|
+
Popover: Et,
|
|
3131
|
+
Radio: jt,
|
|
3132
|
+
Select: $t,
|
|
3133
|
+
SensitiveInput: Lt,
|
|
3134
|
+
Surface: Vt,
|
|
3135
|
+
Switch: Mt,
|
|
3136
|
+
Table: zt,
|
|
3137
|
+
Tabs: Dt,
|
|
3138
|
+
Text: Bt,
|
|
3139
|
+
Toasty: Ut,
|
|
3140
|
+
Tooltip: Ft
|
|
3141
|
+
}, Gt = m({
|
|
3142
|
+
key: i(),
|
|
3143
|
+
type: qt,
|
|
3144
|
+
props: H(i(), O()),
|
|
3145
|
+
children: z(i()).optional(),
|
|
3146
|
+
parentKey: i().nullable().optional(),
|
|
3147
|
+
visible: it.optional(),
|
|
3148
|
+
action: lt.optional()
|
|
3149
|
+
}), Jt = m({
|
|
3150
|
+
root: i(),
|
|
3151
|
+
elements: H(i(), Gt)
|
|
3152
|
+
});
|
|
3153
|
+
function Yt(n) {
|
|
3154
|
+
const e = Wt[n.type];
|
|
3155
|
+
return e ? e.safeParse(n.props) : { success: !1, error: new P([{ code: "custom", message: `Unknown component type: ${n.type}`, path: ["type"] }]) };
|
|
3156
|
+
}
|
|
3157
|
+
function Ht(n) {
|
|
3158
|
+
return Jt.safeParse(n);
|
|
3159
|
+
}
|
|
3160
|
+
const Qt = ["Badge", "Banner", "Breadcrumbs", "Button", "Checkbox", "ClipboardText", "Code", "Collapsible", "Combobox", "CommandPalette", "DateRangePicker", "Dialog", "DropdownMenu", "Empty", "Field", "Grid", "Input", "InputArea", "Label", "LayerCard", "Link", "Loader", "MenuBar", "Meter", "Pagination", "Popover", "Radio", "Select", "SensitiveInput", "Surface", "Switch", "Table", "Tabs", "Text", "Toasty", "Tooltip"];
|
|
3161
|
+
export {
|
|
3162
|
+
ot as ActionConfirmSchema,
|
|
3163
|
+
lt as ActionSchema,
|
|
3164
|
+
ct as BadgePropsSchema,
|
|
3165
|
+
dt as BannerPropsSchema,
|
|
3166
|
+
ut as BreadcrumbsPropsSchema,
|
|
3167
|
+
pt as ButtonPropsSchema,
|
|
3168
|
+
ht as CheckboxPropsSchema,
|
|
3169
|
+
ft as ClipboardTextPropsSchema,
|
|
3170
|
+
mt as CodePropsSchema,
|
|
3171
|
+
gt as CollapsiblePropsSchema,
|
|
3172
|
+
yt as ComboboxPropsSchema,
|
|
3173
|
+
_t as CommandPalettePropsSchema,
|
|
3174
|
+
Wt as ComponentPropsSchemas,
|
|
3175
|
+
vt as DateRangePickerPropsSchema,
|
|
3176
|
+
xt as DialogPropsSchema,
|
|
3177
|
+
bt as DropdownMenuPropsSchema,
|
|
3178
|
+
h as DynamicValueSchema,
|
|
3179
|
+
kt as EmptyPropsSchema,
|
|
3180
|
+
wt as FieldPropsSchema,
|
|
3181
|
+
St as GridPropsSchema,
|
|
3182
|
+
Ct as InputAreaPropsSchema,
|
|
3183
|
+
Tt as InputPropsSchema,
|
|
3184
|
+
Qt as KUMO_COMPONENT_NAMES,
|
|
3185
|
+
qt as KumoComponentTypeSchema,
|
|
3186
|
+
Nt as LabelPropsSchema,
|
|
3187
|
+
Ot as LayerCardPropsSchema,
|
|
3188
|
+
At as LinkPropsSchema,
|
|
3189
|
+
Rt as LoaderPropsSchema,
|
|
3190
|
+
Zt as MenuBarPropsSchema,
|
|
3191
|
+
It as MeterPropsSchema,
|
|
3192
|
+
Pt as PaginationPropsSchema,
|
|
3193
|
+
Et as PopoverPropsSchema,
|
|
3194
|
+
jt as RadioPropsSchema,
|
|
3195
|
+
$t as SelectPropsSchema,
|
|
3196
|
+
Lt as SensitiveInputPropsSchema,
|
|
3197
|
+
Vt as SurfacePropsSchema,
|
|
3198
|
+
Mt as SwitchPropsSchema,
|
|
3199
|
+
zt as TablePropsSchema,
|
|
3200
|
+
Dt as TabsPropsSchema,
|
|
3201
|
+
Bt as TextPropsSchema,
|
|
3202
|
+
Ut as ToastyPropsSchema,
|
|
3203
|
+
Ft as TooltipPropsSchema,
|
|
3204
|
+
Gt as UIElementBaseSchema,
|
|
3205
|
+
Jt as UITreeSchema,
|
|
3206
|
+
it as VisibilityConditionSchema,
|
|
3207
|
+
Yt as validateElementProps,
|
|
3208
|
+
Ht as validateUITree
|
|
3209
|
+
};
|
|
3210
|
+
//# sourceMappingURL=schemas-BSdA0fz-.js.map
|