@lifesg/web-frontend-engine 2.2.4 → 2.2.5
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/chunks/file-upload-manager.817b80cc.js +2 -0
- package/chunks/file-upload-manager.817b80cc.js.map +1 -0
- package/chunks/{index.ac3b6195.js → index.44b5e2a5.js} +10 -10
- package/chunks/{index.ac3b6195.js.map → index.44b5e2a5.js.map} +1 -1
- package/chunks/{index.a24b1857.js → index.51ad1607.js} +2 -2
- package/chunks/{index.a24b1857.js.map → index.51ad1607.js.map} +1 -1
- package/chunks/{index.8edac70b.js → index.f1de2e77.js} +2 -2
- package/chunks/{index.8edac70b.js.map → index.f1de2e77.js.map} +1 -1
- package/chunks/{location-modal.6475a4db.js → location-modal.1859f93a.js} +2 -2
- package/chunks/{location-modal.6475a4db.js.map → location-modal.1859f93a.js.map} +1 -1
- package/cjs/chunks/file-upload-manager.85af8429.js +2 -0
- package/cjs/chunks/file-upload-manager.85af8429.js.map +1 -0
- package/cjs/chunks/{index.d136a8bd.js → index.48f1a1f1.js} +2 -2
- package/cjs/chunks/{index.d136a8bd.js.map → index.48f1a1f1.js.map} +1 -1
- package/cjs/chunks/{index.6a929030.js → index.c2370225.js} +7 -7
- package/cjs/chunks/{index.6a929030.js.map → index.c2370225.js.map} +1 -1
- package/cjs/chunks/{index.6e0e20f7.js → index.efc005fc.js} +2 -2
- package/cjs/chunks/{index.6e0e20f7.js.map → index.efc005fc.js.map} +1 -1
- package/cjs/chunks/{location-modal.e5989ca3.js → location-modal.6885ccea.js} +2 -2
- package/cjs/chunks/{location-modal.e5989ca3.js.map → location-modal.6885ccea.js.map} +1 -1
- package/cjs/index.js +1 -1
- package/components/custom/array-field/array-field-element.d.ts +10 -11
- package/components/custom/array-field/array-field.d.ts +3 -3
- package/components/custom/array-field/array-field.styles.d.ts +22 -23
- package/components/custom/array-field/index.d.ts +2 -2
- package/components/custom/array-field/types.d.ts +39 -39
- package/components/custom/filter/filter/filter.d.ts +3 -3
- package/components/custom/filter/filter/types.d.ts +12 -12
- package/components/custom/filter/filter-checkbox/filter-checkbox.d.ts +3 -3
- package/components/custom/filter/filter-checkbox/types.d.ts +23 -23
- package/components/custom/filter/filter-helper.d.ts +8 -8
- package/components/custom/filter/filter-item/filter-item.d.ts +3 -3
- package/components/custom/filter/filter-item/types.d.ts +13 -13
- package/components/custom/filter/index.d.ts +3 -3
- package/components/custom/filter/types.d.ts +11 -11
- package/components/custom/iframe/iframe.d.ts +3 -3
- package/components/custom/iframe/index.d.ts +2 -2
- package/components/custom/iframe/types.d.ts +28 -29
- package/components/custom/index.d.ts +6 -6
- package/components/custom/review/index.d.ts +2 -2
- package/components/custom/review/review.d.ts +3 -3
- package/components/custom/review/review.styles.d.ts +12 -13
- package/components/custom/review/types.d.ts +60 -60
- package/components/custom/timeline/index.d.ts +2 -2
- package/components/custom/timeline/timeline.d.ts +3 -3
- package/components/custom/timeline/types.d.ts +19 -19
- package/components/custom/types.d.ts +87 -87
- package/components/elements/accordion/accordion.d.ts +6 -6
- package/components/elements/accordion/accordion.styles.d.ts +1 -2
- package/components/elements/accordion/index.d.ts +2 -2
- package/components/elements/accordion/types.d.ts +27 -27
- package/components/elements/alert/alert.d.ts +3 -3
- package/components/elements/alert/index.d.ts +2 -2
- package/components/elements/alert/types.d.ts +9 -10
- package/components/elements/divider/divider.d.ts +3 -3
- package/components/elements/divider/index.d.ts +2 -2
- package/components/elements/divider/types.d.ts +6 -6
- package/components/elements/grid/grid.d.ts +3 -3
- package/components/elements/grid/index.d.ts +2 -2
- package/components/elements/grid/types.d.ts +11 -11
- package/components/elements/index.d.ts +9 -9
- package/components/elements/list/data.d.ts +3 -3
- package/components/elements/list/index.d.ts +3 -3
- package/components/elements/list/list-item.d.ts +3 -3
- package/components/elements/list/list.d.ts +3 -3
- package/components/elements/list/types.d.ts +17 -17
- package/components/elements/popover/index.d.ts +2 -2
- package/components/elements/popover/popover.d.ts +3 -3
- package/components/elements/popover/types.d.ts +15 -15
- package/components/elements/section/index.d.ts +2 -2
- package/components/elements/section/section.d.ts +2 -2
- package/components/elements/section/section.styles.d.ts +11 -12
- package/components/elements/section/types.d.ts +16 -16
- package/components/elements/sections/index.d.ts +1 -1
- package/components/elements/sections/sections.d.ts +13 -13
- package/components/elements/tab/index.d.ts +2 -2
- package/components/elements/tab/tab.d.ts +3 -3
- package/components/elements/tab/types.d.ts +23 -23
- package/components/elements/text/data.d.ts +121 -122
- package/components/elements/text/index.d.ts +2 -2
- package/components/elements/text/text.d.ts +3 -3
- package/components/elements/text/types.d.ts +18 -18
- package/components/elements/types.d.ts +97 -97
- package/components/elements/wrapper/col-wrapper.d.ts +12 -12
- package/components/elements/wrapper/conditional-renderer.d.ts +16 -16
- package/components/elements/wrapper/field-wrapper.d.ts +9 -10
- package/components/elements/wrapper/index.d.ts +2 -2
- package/components/elements/wrapper/types.d.ts +29 -30
- package/components/elements/wrapper/wrapper.d.ts +2 -3
- package/components/fields/button/button.d.ts +3 -3
- package/components/fields/button/index.d.ts +2 -2
- package/components/fields/button/types.d.ts +17 -17
- package/components/fields/checkbox-group/checkbox-group.d.ts +3 -3
- package/components/fields/checkbox-group/checkbox-group.styles.d.ts +23 -24
- package/components/fields/checkbox-group/index.d.ts +2 -2
- package/components/fields/checkbox-group/types.d.ts +33 -33
- package/components/fields/chips/chips.d.ts +3 -3
- package/components/fields/chips/chips.styles.d.ts +5 -6
- package/components/fields/chips/index.d.ts +2 -2
- package/components/fields/chips/types.d.ts +18 -19
- package/components/fields/contact-field/contact-field.d.ts +3 -3
- package/components/fields/contact-field/data.d.ts +6 -6
- package/components/fields/contact-field/index.d.ts +2 -2
- package/components/fields/contact-field/types.d.ts +31 -31
- package/components/fields/contact-field/utils.d.ts +7 -7
- package/components/fields/date-field/date-field.d.ts +3 -3
- package/components/fields/date-field/index.d.ts +2 -2
- package/components/fields/date-field/types.d.ts +20 -20
- package/components/fields/date-range-field/date-range-field.d.ts +3 -3
- package/components/fields/date-range-field/index.d.ts +2 -2
- package/components/fields/date-range-field/types.d.ts +32 -32
- package/components/fields/e-signature-field/e-signature-field.d.ts +3 -3
- package/components/fields/e-signature-field/e-signature-field.styles.d.ts +4 -5
- package/components/fields/e-signature-field/index.d.ts +2 -2
- package/components/fields/e-signature-field/types.d.ts +22 -22
- package/components/fields/error-field/error-field.d.ts +3 -3
- package/components/fields/error-field/index.d.ts +2 -2
- package/components/fields/error-field/types.d.ts +11 -11
- package/components/fields/file-upload/file-upload-context.d.ts +14 -14
- package/components/fields/file-upload/file-upload-helper.d.ts +10 -10
- package/components/fields/file-upload/file-upload-manager.d.ts +14 -14
- package/components/fields/file-upload/file-upload.d.ts +4 -4
- package/components/fields/file-upload/index.d.ts +2 -2
- package/components/fields/file-upload/types.d.ts +78 -78
- package/components/fields/hidden-field/hidden-field.d.ts +3 -3
- package/components/fields/hidden-field/index.d.ts +2 -2
- package/components/fields/hidden-field/types.d.ts +29 -29
- package/components/fields/histogram-slider/histogram-slider.d.ts +3 -3
- package/components/fields/histogram-slider/index.d.ts +2 -2
- package/components/fields/histogram-slider/types.d.ts +20 -20
- package/components/fields/image-upload/image-context/image-context.d.ts +16 -16
- package/components/fields/image-upload/image-context/index.d.ts +1 -1
- package/components/fields/image-upload/image-input/drag-upload/drag-upload.d.ts +2 -3
- package/components/fields/image-upload/image-input/drag-upload/drag-upload.styles.d.ts +14 -15
- package/components/fields/image-upload/image-input/drag-upload/index.d.ts +2 -2
- package/components/fields/image-upload/image-input/drag-upload/types.d.ts +15 -16
- package/components/fields/image-upload/image-input/file-item/file-item.d.ts +11 -11
- package/components/fields/image-upload/image-input/file-item/file-item.styles.d.ts +48 -49
- package/components/fields/image-upload/image-input/file-item/index.d.ts +1 -1
- package/components/fields/image-upload/image-input/image-input.d.ts +26 -26
- package/components/fields/image-upload/image-input/image-input.styles.d.ts +47 -48
- package/components/fields/image-upload/image-input/index.d.ts +1 -1
- package/components/fields/image-upload/image-manager/image-manager.d.ts +25 -25
- package/components/fields/image-upload/image-manager/index.d.ts +2 -2
- package/components/fields/image-upload/image-review/image-editor/image-editor.d.ts +2 -3
- package/components/fields/image-upload/image-review/image-editor/image-editor.styles.d.ts +6 -7
- package/components/fields/image-upload/image-review/image-editor/index.d.ts +3 -3
- package/components/fields/image-upload/image-review/image-editor/types.d.ts +17 -17
- package/components/fields/image-upload/image-review/image-error/image-error.d.ts +10 -10
- package/components/fields/image-upload/image-review/image-error/image-error.styles.d.ts +31 -32
- package/components/fields/image-upload/image-review/image-error/index.d.ts +1 -1
- package/components/fields/image-upload/image-review/image-prompts/image-prompts.d.ts +11 -11
- package/components/fields/image-upload/image-review/image-prompts/index.d.ts +1 -1
- package/components/fields/image-upload/image-review/image-review.d.ts +18 -18
- package/components/fields/image-upload/image-review/image-review.styles.d.ts +128 -129
- package/components/fields/image-upload/image-review/image-thumbnails/image-thumbnails.d.ts +11 -11
- package/components/fields/image-upload/image-review/image-thumbnails/image-thumbnails.styles.d.ts +29 -30
- package/components/fields/image-upload/image-review/image-thumbnails/index.d.ts +1 -1
- package/components/fields/image-upload/image-review/index.d.ts +1 -1
- package/components/fields/image-upload/image-upload-helper.d.ts +12 -10
- package/components/fields/image-upload/image-upload.d.ts +4 -4
- package/components/fields/image-upload/index.d.ts +2 -2
- package/components/fields/image-upload/types.d.ts +151 -151
- package/components/fields/index.d.ts +30 -30
- package/components/fields/location-field/index.d.ts +2 -2
- package/components/fields/location-field/location-field.d.ts +3 -3
- package/components/fields/location-field/location-helper.d.ts +38 -39
- package/components/fields/location-field/location-input/dummy-location-field.d.ts +13 -14
- package/components/fields/location-field/location-input/index.d.ts +1 -1
- package/components/fields/location-field/location-input/location-input.d.ts +6 -7
- package/components/fields/location-field/location-input/location-input.styles.d.ts +22 -23
- package/components/fields/location-field/location-modal/infinite-scroll/index.d.ts +1 -1
- package/components/fields/location-field/location-modal/infinite-scroll/infinite-scroll.d.ts +11 -12
- package/components/fields/location-field/location-modal/infinite-scroll/infinite-scroll.style.d.ts +1 -2
- package/components/fields/location-field/location-modal/infinite-scroll/loading-indicator/config.d.ts +5 -5
- package/components/fields/location-field/location-modal/infinite-scroll/loading-indicator/index.d.ts +1 -1
- package/components/fields/location-field/location-modal/infinite-scroll/loading-indicator/loading-indicator.d.ts +5 -5
- package/components/fields/location-field/location-modal/infinite-scroll/loading-indicator/loading-indicator.styles.d.ts +2 -3
- package/components/fields/location-field/location-modal/location-modal.d.ts +8 -8
- package/components/fields/location-field/location-modal/location-modal.data.d.ts +3 -3
- package/components/fields/location-field/location-modal/location-modal.styles.d.ts +16 -17
- package/components/fields/location-field/location-modal/location-picker/helper.d.ts +4 -4
- package/components/fields/location-field/location-modal/location-picker/index.d.ts +1 -1
- package/components/fields/location-field/location-modal/location-picker/legend/index.d.ts +1 -1
- package/components/fields/location-field/location-modal/location-picker/legend/legend.d.ts +8 -8
- package/components/fields/location-field/location-modal/location-picker/legend/legend.styles.d.ts +10 -11
- package/components/fields/location-field/location-modal/location-picker/location-picker.d.ts +3 -3
- package/components/fields/location-field/location-modal/location-picker/location-picker.styles.d.ts +17 -18
- package/components/fields/location-field/location-modal/location-picker/types.d.ts +34 -35
- package/components/fields/location-field/location-modal/location-search/helper.d.ts +14 -14
- package/components/fields/location-field/location-modal/location-search/index.d.ts +1 -1
- package/components/fields/location-field/location-modal/location-search/location-search.d.ts +2 -2
- package/components/fields/location-field/location-modal/location-search/location-search.styles.d.ts +84 -85
- package/components/fields/location-field/location-modal/location-search/types.d.ts +30 -30
- package/components/fields/location-field/location-modal/no-network-modal/no-network-modal.d.ts +7 -7
- package/components/fields/location-field/location-modal/no-network-modal/no-network-modal.styles.d.ts +29 -30
- package/components/fields/location-field/location-modal/types.d.ts +18 -18
- package/components/fields/location-field/types.d.ts +163 -163
- package/components/fields/masked-field/index.d.ts +2 -2
- package/components/fields/masked-field/masked-field.d.ts +3 -3
- package/components/fields/masked-field/types.d.ts +12 -12
- package/components/fields/multi-select/index.d.ts +2 -2
- package/components/fields/multi-select/multi-select.d.ts +3 -3
- package/components/fields/multi-select/types.d.ts +9 -9
- package/components/fields/nested-multi-select/index.d.ts +2 -2
- package/components/fields/nested-multi-select/nested-multi-select.d.ts +3 -3
- package/components/fields/nested-multi-select/types.d.ts +33 -34
- package/components/fields/otp-verification-field/index.d.ts +2 -2
- package/components/fields/otp-verification-field/otp-verification-field.d.ts +3 -3
- package/components/fields/otp-verification-field/types.d.ts +46 -46
- package/components/fields/radio-button/index.d.ts +2 -2
- package/components/fields/radio-button/radio-button.d.ts +3 -3
- package/components/fields/radio-button/radio-button.styles.d.ts +29 -30
- package/components/fields/radio-button/types.d.ts +41 -41
- package/components/fields/range-select/index.d.ts +2 -2
- package/components/fields/range-select/range-select.d.ts +3 -3
- package/components/fields/range-select/types.d.ts +9 -9
- package/components/fields/reset-button/index.d.ts +2 -2
- package/components/fields/reset-button/reset-button.d.ts +3 -3
- package/components/fields/reset-button/types.d.ts +8 -8
- package/components/fields/select/index.d.ts +2 -2
- package/components/fields/select/select.d.ts +3 -3
- package/components/fields/select/types.d.ts +9 -9
- package/components/fields/select-histogram/index.d.ts +2 -2
- package/components/fields/select-histogram/select-histogram.d.ts +3 -3
- package/components/fields/select-histogram/types.d.ts +17 -17
- package/components/fields/slider/index.d.ts +2 -2
- package/components/fields/slider/slider.d.ts +3 -3
- package/components/fields/slider/types.d.ts +11 -11
- package/components/fields/submit-button/index.d.ts +2 -2
- package/components/fields/submit-button/submit-button.d.ts +3 -3
- package/components/fields/submit-button/types.d.ts +7 -7
- package/components/fields/switch/index.d.ts +2 -2
- package/components/fields/switch/switch.d.ts +3 -3
- package/components/fields/switch/switch.styles.d.ts +1 -2
- package/components/fields/switch/types.d.ts +10 -10
- package/components/fields/text-field/index.d.ts +2 -2
- package/components/fields/text-field/text-field.d.ts +3 -3
- package/components/fields/text-field/types.d.ts +37 -37
- package/components/fields/textarea/index.d.ts +2 -2
- package/components/fields/textarea/textarea.d.ts +3 -3
- package/components/fields/textarea/textarea.styles.d.ts +19 -20
- package/components/fields/textarea/types.d.ts +8 -8
- package/components/fields/time-field/index.d.ts +2 -2
- package/components/fields/time-field/time-field.d.ts +3 -3
- package/components/fields/time-field/types.d.ts +7 -7
- package/components/fields/types.d.ts +122 -122
- package/components/fields/unit-number-field/index.d.ts +2 -2
- package/components/fields/unit-number-field/types.d.ts +8 -8
- package/components/fields/unit-number-field/unit-number-field.d.ts +3 -3
- package/components/frontend-engine/frontend-engine.d.ts +23 -23
- package/components/frontend-engine/index.d.ts +2 -2
- package/components/frontend-engine/types.d.ts +213 -214
- package/components/frontend-engine/use-form-change.d.ts +12 -12
- package/components/index.d.ts +2 -2
- package/components/shared/chip/chip.d.ts +6 -6
- package/components/shared/chip/chip.styles.d.ts +16 -17
- package/components/shared/chip/index.d.ts +2 -2
- package/components/shared/chip/types.d.ts +4 -4
- package/components/shared/error-messages.d.ts +102 -102
- package/components/shared/index.d.ts +6 -6
- package/components/shared/prompt/index.d.ts +2 -2
- package/components/shared/prompt/prompt.d.ts +2 -2
- package/components/shared/prompt/prompt.styles.d.ts +40 -41
- package/components/shared/prompt/types.d.ts +16 -16
- package/components/shared/sanitize/index.d.ts +1 -1
- package/components/shared/sanitize/sanitize.d.ts +13 -14
- package/components/shared/static-map/index.d.ts +1 -1
- package/components/shared/static-map/static-map.d.ts +12 -12
- package/components/shared/static-map/static-map.styles.d.ts +12 -13
- package/components/shared/warning/index.d.ts +1 -1
- package/components/shared/warning/warning.d.ts +6 -6
- package/components/types.d.ts +4 -4
- package/context-providers/context-providers.d.ts +7 -7
- package/context-providers/custom-components/context-provider.d.ts +14 -14
- package/context-providers/custom-components/index.d.ts +1 -1
- package/context-providers/event/context-provider.d.ts +14 -14
- package/context-providers/event/index.d.ts +2 -2
- package/context-providers/event/types.d.ts +10 -10
- package/context-providers/form-schema/context-provider.d.ts +12 -12
- package/context-providers/form-schema/index.d.ts +1 -1
- package/context-providers/form-values/context-provider.d.ts +23 -23
- package/context-providers/form-values/index.d.ts +1 -1
- package/context-providers/frontend-engine-form/context-provider.d.ts +13 -13
- package/context-providers/frontend-engine-form/index.d.ts +1 -1
- package/context-providers/index.d.ts +7 -7
- package/context-providers/recaptcha/index.d.ts +3 -3
- package/context-providers/recaptcha/recaptcha-hook.d.ts +5 -5
- package/context-providers/recaptcha/recaptcha-provider.d.ts +10 -11
- package/context-providers/recaptcha/types.d.ts +14 -14
- package/context-providers/yup/context-provider.d.ts +16 -16
- package/context-providers/yup/custom-conditions/html-safe.d.ts +1 -1
- package/context-providers/yup/custom-conditions/index.d.ts +3 -3
- package/context-providers/yup/custom-conditions/uen.d.ts +1 -1
- package/context-providers/yup/custom-conditions/uinfin.d.ts +1 -1
- package/context-providers/yup/helper.d.ts +44 -44
- package/context-providers/yup/index.d.ts +4 -4
- package/context-providers/yup/types.d.ts +82 -82
- package/index.d.ts +3 -3
- package/index.js +1 -1
- package/package.json +1 -1
- package/services/index.d.ts +1 -1
- package/services/onemap/onemap-service.d.ts +21 -21
- package/services/onemap/types.d.ts +48 -48
- package/utils/api-client/api-client.d.ts +65 -65
- package/utils/api-client/index.d.ts +1 -1
- package/utils/date-time-helper.d.ts +22 -22
- package/utils/file-helper.d.ts +45 -47
- package/utils/geolocation-helper.d.ts +17 -17
- package/utils/hooks/index.d.ts +12 -12
- package/utils/hooks/use-custom-components.d.ts +5 -6
- package/utils/hooks/use-deep-layout-effect.d.ts +3 -3
- package/utils/hooks/use-field-event.d.ts +10 -10
- package/utils/hooks/use-form-schema.d.ts +6 -7
- package/utils/hooks/use-form-values.d.ts +11 -12
- package/utils/hooks/use-frontend-engine-component.d.ts +17 -17
- package/utils/hooks/use-frontend-engine-form.d.ts +6 -7
- package/utils/hooks/use-iframe-message.d.ts +5 -5
- package/utils/hooks/use-previous.d.ts +4 -4
- package/utils/hooks/use-validation-config.d.ts +10 -10
- package/utils/hooks/use-validation-schema.d.ts +15 -15
- package/utils/hooks/use-window-helper.d.ts +1 -1
- package/utils/id-helper.d.ts +1 -1
- package/utils/image-helper.d.ts +49 -49
- package/utils/index.d.ts +11 -11
- package/utils/math-helper.d.ts +5 -5
- package/utils/object-helper.d.ts +15 -15
- package/utils/prop-helper.d.ts +8 -8
- package/utils/test-helper.d.ts +4 -4
- package/utils/ts-helper.d.ts +1 -1
- package/utils/types.d.ts +9 -9
- package/chunks/file-upload-manager.ddb44c1f.js +0 -2
- package/chunks/file-upload-manager.ddb44c1f.js.map +0 -1
- package/cjs/chunks/file-upload-manager.b22d56d4.js +0 -2
- package/cjs/chunks/file-upload-manager.b22d56d4.js.map +0 -1
|
@@ -303,7 +303,7 @@ function YN(e){return"[object Object]"===Object.prototype.toString.call(e)}Objec
|
|
|
303
303
|
height: auto;
|
|
304
304
|
`,v$=({id:t,lat:n,lng:r,address:i,staticMapPinColor:a={r:28,g:118,b:213},className:c,onClick:l,disabled:f})=>{const p=s(!1),[h,m]=o(""),g=s([0,0]),A=d(N);u(()=>(window.addEventListener("resize",y),n&&r&&y(),()=>{window.removeEventListener("resize",y)}),[n,r]);const y=()=>{if(!n||!r)return;const e=window.matchMedia(`(max-width: ${x["sm-max"]({theme:A})}px)`).matches;if(p.current!==e||g.current[0]!==n||g.current[1]!==r){p.current=e;const t=e?A$.mobile:A$.desktop,i=15,o=t.height+i;m(m$.getStaticMapUrl(n,r,t.width,o,a)),g.current=[n,r]}};return n&&r?e(y$,{id:wS.generateId(t,"static-map"),"data-testid":wS.generateId(t,"static-map"),className:c,onClick:l,"aria-disabled":f,children:e(_$,{alt:i||"Location Map",src:h,onError:e=>{e.currentTarget.src="https://assets.life.gov.sg/web-frontend-engine/img/map/static_map_placeholder.png"}})}):null},b$=({id:t,message:n,className:r})=>n?e(E$,{type:"warning","data-testid":wS.generateId(t,"warning"),className:r,children:n}):null,E$=I(P)`
|
|
305
305
|
margin: -1rem 0rem 2rem;
|
|
306
|
-
`,w$=["required","length","min","max","matches","email","url","uuid","positive","negative","integer","lessThan","moreThan","when","filled","empty","equals","notEquals","includes","excludes","uinfin","equalsField","withinDays","htmlSafe"];var S$;!function(e){const t=[],n={};e.buildSchema=(t,n)=>{const i={},[a,o]=r(t);return Object.keys(a).forEach(n=>{const{schema:r,validationRules:a}=t[n];i[n]=e.buildFieldSchema(r,a)}),sI().meta({yupId:n}).shape(i,o)};const r=e=>{const t=[],n={...e};return Object.entries(n).forEach(([e,{validationRules:r}])=>{const[a,o]=i(e,n,r);t.push(...o),n[e].validationRules=a}),[n,t]},i=(e,t,n)=>{const r=[],a=n?.filter(e=>!("when"in e))||[];return n?.filter(e=>"when"in e).forEach(n=>{const o={...n,when:n.when?{...n.when}:void 0};Object.keys(o.when).forEach(n=>{if(!t[n])return void console.warn(`field "${n}" was not found, when condition on "${e}" was not applied`);r.push([e,n]),o.when[n]={...o.when[n],yupSchema:t[n].schema.clone()};const[a,s]=i(e,t,o.when[n].then);o.when[n].then=a,r.push(...s)}),a.push(o)}),[a,r]};e.buildFieldSchema=(t,n)=>e.mapRules(t,n),e.mapSchemaType=e=>{switch(e){case"string":return VO().typeError("Only string values are allowed");case"number":return HO().typeError("Only number values are allowed");case"boolean":return zO().strict().typeError("Only boolean values are allowed");case"array":return cI().typeError("Only array values are allowed");case"object":return sI().typeError("Only object values are allowed");default:return $O()}},e.mapRules=(n,r)=>(r.forEach(r=>{const i=Object.keys(r).filter(e=>w$.includes(e))?.[0];switch(!0){case r.required:n=n.required(r.errorMessage||Yg.COMMON.FIELD_REQUIRED);break;case!!r.email:case!!r.url:case!!r.uuid:case!!r.positive:case!!r.negative:case!!r.integer:try{n=n[i](r.errorMessage)}catch(e){console.warn(`error applying "${i}" condition to ${n.type} schema`)}break;case r.length>0:case!isNaN(r.min):case!isNaN(r.max):case!isNaN(r.lessThan):case!isNaN(r.moreThan):try{n=n[i](r[i],r.errorMessage)}catch(e){console.warn(`error applying "${i}" condition to ${n.type} schema`)}break;case!!r.matches:{const e=r.matches.match(/\/(.*)\/([a-z]+)?/);try{n=n.matches(new RegExp(e[1],e[2]),r.errorMessage)}catch(e){console.warn(`error applying "${i}" condition to ${n.type} schema`)}}break;case!!r.when:Object.keys(r.when).forEach(t=>{const i=r.when[t]?.yupSchema;if(!i)return void console.warn(`[mapRules] Unexpected: yupSchema missing for field "${t}" in when condition. `);const a=r.when[t].is,o=e.mapRules(n,r.when[t].then),s=r.when[t].otherwise&&e.mapRules(n,r.when[t].otherwise);n=Array.isArray(a)&&a.every(e=>"object"==typeof e)?n.when(t,t=>{const n=e.mapRules(i.clone(),a);let r=!1;try{n.validateSync(t),r=!0}catch(e){}return r?o:s}):n.when(t,{is:a,then:o,otherwise:s})})}const a=Object.keys(r).filter(e=>t.includes(e))?.[0];a&&(n[a]?n=n[a](r[a],r.errorMessage):console.warn(`error applying "${a}" condition to ${n.type} schema`)),Object.keys(r).forEach(e=>{n=n.meta({rules:[...n.describe().meta?.rules||[],r]})}),n&&(n=n.transform(e=>{if(null!==e&&""!==e&&("object"!=typeof e||0!==Object.keys(e).length))return e}))}),n),e.addCondition=(e,r,i,a,o=!1)=>{if(a){if(n[a]||(n[a]={}),n[a][r]&&!0!==o)return void console.warn(`the validation condition "${r}" is not added because it already exists!`);n[a][r]=i}else if(t.includes(r)&&!0!==o)return void console.warn(`the validation condition "${r}" is not added because it already exists!`);t.includes(r)||t.push(r),fI(pI[e],r,function(e,t){return this.test({name:r,message:t,test:(t,o)=>{if(!a)return i(t,e,o);const s=o.options.from.length,u=o.options.from[s-1].schema.describe().meta.yupId;return n[u]?.[r]?.(t,e,o)}})})}}(S$||(S$={}));var C$=Nn,x$=si;var M$=function(e){return!0===e||!1===e||x$(e)&&"[object Boolean]"==C$(e)},O$=EM;var T$=function(e,t){return O$(e,t)},I$=Nn,D$=si;var N$=function(e){return"number"==typeof e||D$(e)&&"[object Number]"==I$(e)};const L$=/^[A-Za-z\s,()/.@'-]+$/;var k$;S$.addCondition("string","htmlSafe",(e,t)=>!(!bS(e)&&t)||L$.test(e)),function(e){e.LOCAL_S_PREFIX="S",e.LOCAL_T_PREFIX="T",e.FOREIGN_F_PREFIX="F",e.FOREIGN_G_PREFIX="G",e.FOREIGN_M_PREFIX="M"}(k$||(k$={}));const R$=[2,7,6,5,4,3,2],F$=["J","Z","I","H","G","F","E","D","C","B","A"],$$=["X","W","U","T","R","Q","P","N","M","L","K"],P$=["X","W","U","T","R","Q","P","N","J","L","K"];function z$(e){if("string"==typeof e){const t=function(e){return/^[STFGM]\d{7}[A-Z]$/.test(e)}(e),n=e.charAt(8)===function(e){let t=0;for(let n=0;n<7;++n)t+=Number(e.charAt(n+1))*R$[n];const n=e.charAt(0);n!==k$.LOCAL_T_PREFIX&&n!==k$.FOREIGN_G_PREFIX||(t+=4);n===k$.FOREIGN_M_PREFIX&&(t+=3);let r;r=n===k$.LOCAL_S_PREFIX||n===k$.LOCAL_T_PREFIX?F$[t%11]:n===k$.FOREIGN_M_PREFIX?P$[t%11]:$$[t%11];return r}(e);return t&&n}return!1}S$.addCondition("string","uinfin",e=>!!bS(e)||z$(e));const B$=["LP","LL","FC","PF","RF","MQ","MM","NB","CC","CS","MB","FM","GS","GA","GB","DP","CP","NR","CM","CD","MD","HS","VH","CH","MH","CL","XL","CX","RP","TU","TC","FB","FN","PA","PB","SS","MC","SM"];S$.addCondition("string","uen",e=>!!bS(e)||function(e){if(e.length<9||e.length>10)return!1;if(9===(e=e.toUpperCase()).length){if(e.match(/^\d{8}[A-Z]$/))return!0}else if(10===e.length){if(e.match(/^\d{9}[A-Z]$/))return!0;const t=String.raw`^((R|S|T)([\d]{2})(`+B$.join("|")+String.raw`)([\d]{4})([A-Z]))$`;if(e.match(t))return!0}return!1}(e));const Z$=e=>N$(e)?SS(e):bS(e)&&!M$(e);S$.addCondition("mixed","filled",e=>!Z$(e)),S$.addCondition("mixed","empty",e=>Z$(e)),S$.addCondition("mixed","equals",(e,t)=>!Z$(e)&&T$(e,t)),S$.addCondition("mixed","notEquals",(e,t)=>!Z$(e)&&!T$(e,t)),S$.addCondition("string","notMatches",(e,t)=>{if(Z$(e))return!0;const n=t.match(/\/(.*)\/([a-z]+)?/);return!new RegExp(n[1],n[2]).test(e)}),S$.addCondition("string","noWhitespaceOnly",(e,t)=>!(!Z$(e)&&t)||/\S/.test(e)),S$.addCondition("string","whitespace",(e,t)=>!(!Z$(e)&&t&&("object"!=typeof t||M$(t.noLeadingOrTrailingWhitespace)))||("object"!=typeof t||t.noLeadingOrTrailingWhitespace?/^(?!\s+$)(?!\s).*(?<!\s)$/.test(e):/\S/.test(e))),S$.addCondition("array","includes",(e,t)=>!e?.length||(Array.isArray(t)?t.filter(t=>e.includes(t)).length===t.length:e.includes(t))),S$.addCondition("array","excludes",(e,t)=>!e?.length||(Array.isArray(t)?e.length&&0===t.filter(t=>e.includes(t)).length:!e.includes(t))),S$.addCondition("mixed","equalsField",(e,t,n)=>{if("object"==typeof e){if(Array.isArray(e)&&Array.isArray(n.parent[`${t}`])){const r=[...e].sort(),i=[...n.parent[`${t}`]].sort();return T$(r,i)}return T$(e,n.parent[`${t}`])}return T$(e,n.parent[`${t}`])}),S$.addCondition("mixed","notEqualsField",(e,t,n)=>{if("object"==typeof e){if(Array.isArray(e)&&Array.isArray(n.parent[`${t}`])){const r=[...e].sort(),i=[...n.parent[`${t}`]].sort();return!T$(r,i)}return!T$(e,n.parent[`${t}`])}return!T$(e,n.parent[`${t}`])}),S$.addCondition("mixed","withinDays",(e,t)=>!!bS(e)||Vg.checkWithinDays(e,t)),S$.addCondition("mixed","beyondDays",(e,t)=>!!bS(e)||Vg.checkBeyondDays(e,t));const U$=({children:t,recaptchaSiteKey:n})=>e(ru,{recaptchaSiteKey:n,children:e(WC,{children:e(Ws,{children:e(Ks,{children:e(Qs,{children:e(Ys,{children:e(Xs,{children:t})})})})})})}),j$=()=>{const{customComponents:e,setCustomComponents:t}=d(Gs),n=f(t=>e?.[t],[e]);return{customComponents:e,getCustomComponent:n,setCustomComponents:t}},G$="undefined"!=typeof window?(e,t)=>{const n=s(t),r=s(0);return T$(t,n.current)||(n.current=t,r.current+=1),p(e,[r.current])}:js,Y$=()=>{const{eventManagerRef:e}=d(Vs),t=f((t,n,r,i,a)=>{if("function"==typeof r&&"function"!=typeof i){const[a,o,s,u]=[t,n,r,i];e.current?.addEventListener(`${o}:${a}`,s,u)}else if("function"==typeof i){const[o,s,u,c,l]=[t,n,r,i,a];e.current?.addEventListener(`${u}:${s}`,c,l)}},[e]),n=f((t,n,r,i,a)=>{if("function"==typeof r&&"function"!=typeof i){const[a,o,s,u]=[t,n,r,i];e.current?.removeEventListener(`${o}:${a}`,s,u)}else if("function"==typeof i){const[o,s,u,c,l]=[t,n,r,i,a];e.current?.removeEventListener(`${u}:${s}`,c,l)}},[e]);return{addFieldEventListener:t,dispatchFieldEvent:f((t,n,r,i)=>{if("string"!=typeof r){const[i,a,o]=[t,n,r];return e.current?.dispatchEvent(new CustomEvent(`${a}:${i}`,{cancelable:!0,detail:{id:a,...o}}))}{const[a,o,s,u]=[t,n,r,i];return e.current?.dispatchEvent(new CustomEvent(`${s}:${o}`,{cancelable:!0,detail:{id:s,...u}}))}},[e]),removeFieldEventListener:n}};var V$=Jr,W$=qt;var H$=function(e,t,n){(void 0!==n&&!W$(e[t],n)||void 0===n&&!(t in e))&&V$(e,t,n)},K$=Ji,q$=si;var Q$=function(e){return q$(e)&&K$(e)};var J$=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]},X$=ai,eP=ma;var tP=H$,nP=_a.exports,rP=ko,iP=va,aP=Wo,oP=mi,sP=gi,uP=Q$,cP=Ai.exports,lP=$n,dP=Ln,fP=dC,pP=Li,hP=J$,mP=function(e){return X$(e,eP(e))};var gP=function(e,t,n,r,i,a,o){var s=hP(e,n),u=hP(t,n),c=o.get(u);if(c)tP(e,n,c);else{var l=a?a(s,u,n+"",e,t,o):void 0,d=void 0===l;if(d){var f=sP(u),p=!f&&cP(u),h=!f&&!p&&pP(u);l=u,f||p||h?sP(s)?l=s:uP(s)?l=iP(s):p?(d=!1,l=nP(u,!0)):h?(d=!1,l=rP(u,!0)):l=[]:fP(u)||oP(u)?(l=s,oP(s)?l=mP(s):dP(s)&&!lP(s)||(l=aP(u))):d=!1}d&&(o.set(u,l),i(l,u,r,a,o),o.delete(u)),tP(e,n,l)}},AP=Wr,yP=H$,_P=Lx,vP=gP,bP=Ln,EP=ma,wP=J$;var SP=function e(t,n,r,i,a){t!==n&&_P(n,function(o,s){if(a||(a=new AP),bP(o))vP(t,n,s,r,e,i,a);else{var u=i?i(wP(t,s),o,s+"",t,n,a):void 0;void 0===u&&(u=o),yP(t,s,u)}},EP)},CP=CC,xP=SC,MP=DC;var OP=function(e,t){return MP(xP(e,t,CP),e+"")},TP=qt,IP=Ji,DP=vi,NP=Ln;var LP=function(e,t,n){if(!NP(n))return!1;var r=typeof t;return!!("number"==r?IP(n)&&DP(t,n.length):"string"==r&&t in n)&&TP(n[t],e)},kP=OP,RP=LP;var FP=function(e){return kP(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&"function"==typeof a?(i--,a):void 0,o&&RP(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})},$P=SP,PP=FP(function(e,t,n){$P(e,t,n)}),zP=PP;const BP=()=>{const{setFormSchema:e,formSchema:t}=d(Hs);return{setFormSchema:e,formSchema:t,overrideSchema:f((e,t)=>{if(bS(t)||"string"==typeof e)return e;let n={};if(Object.keys(e).forEach(e=>{const r=ES.getNestedValueByKey(t,e,{searchIn:["children"]});bS(r)||(n={...n,...r})}),!bS(n)){const t=Fs(e),r=zP(t,n);return ES.removeNil(r)}return e},[])}},ZP=e=>{const t=He(),{setFormValues:n,formValues:r,formValuesRef:i,registeredFields:a,setRegisteredFields:o}=d(qs),s=f((n,r=!1)=>{if("string"!=typeof n){if(Array.isArray(n)){if(r){const r=n.filter(e=>a.includes(e));return e?.getValues(r)||t?.getValues(r)}return e?.getValues(n)||t?.getValues(n)}{const n=e?.getValues()||t?.getValues();if(r){const e={};return Object.entries(n).forEach(([t,n])=>{a.includes(t)&&(e[t]=n)}),e}return n}}if(!r||r&&a.includes(n))return e?.getValues(n)||t?.getValues(n)},[t?.getValues,e?.getValues,a]);return{formValues:r,getField:e=>i.current[e],setFields:e=>{i.current={...i.current,...e},n(t=>({...t,...e}))},setField:(e,t)=>{i.current[e]=t,n(n=>({...n,[e]:t}))},resetFields:e=>{i.current={...e},n(()=>({...e}))},registeredFields:a,setRegisteredFields:o,getFormValues:s}},UP=()=>{const{formValidationConfig:e,setFormValidationConfig:t}=d(VC);return{formValidationConfig:e,setFieldValidationConfig:(e,n,r=[])=>{t(t=>({...t,[e]:{schema:n,validationRules:r}}))},removeFieldValidationConfig:e=>t(t=>{const n={...t};return delete n[e],n})}},jP=()=>{const{addFieldEventListener:e,dispatchFieldEvent:t,removeFieldEventListener:n}=Y$(),r=He(),{setFieldValidationConfig:i,removeFieldValidationConfig:a}=UP();return{event:{addFieldEventListener:e,dispatchFieldEvent:t,removeFieldEventListener:n},formContext:r,validation:{setValidation:i,removeValidation:a}}},GP=()=>{const{submitHandler:e,setSubmitHandler:t,wrapInForm:n,setWrapInForm:r}=d(Js);return{submitHandler:e,setSubmitHandler:t,wrapInForm:n,setWrapInForm:r}},YP=(e,t)=>{u(()=>{const n=n=>{n.data.type===e&&t(n)};return window.addEventListener("message",n),()=>{window.removeEventListener("message",n)}},[e,t])},VP=e=>{const t=s();return u(()=>{t.current=e},[e]),t.current},WP=()=>{const{formValidationConfig:e,warnings:t,setWarnings:n,yupId:r}=d(VC),[i,a]=o(sI()),[s,c]=o(sI()),l=f(()=>{if(e){let t={},n={};Object.entries(e).forEach(([e,r])=>{if(!r.validationRules||0===r.validationRules.length)return void(t=ES.upsert(t,e,{schema:r.schema,validationRules:[]}));const i=r.validationRules.filter(({soft:e})=>e),a=r.validationRules.filter(({soft:e})=>!e);i.length&&(n=ES.upsert(n,e,{schema:r.schema,validationRules:i})),a.length&&(t=ES.upsert(t,e,{schema:r.schema,validationRules:a}))}),c(S$.buildSchema(n,r)),a(S$.buildSchema(t,r))}},[e,r]);u(()=>{l()},[l]);return{warnings:t,softValidationSchema:s,hardValidationSchema:i,rebuildValidationSchema:l,performSoftValidation:(e,t)=>{e.validate(t,{abortEarly:!1}).then(()=>{n({})}).catch(e=>{const t=e;if(bS(t))return;const r=t.inner.reduce((e,t)=>(e[t.path]=t.message,e),{});n(r)})},addWarnings:e=>{n({...t,...e})},yupId:r}},HP=()=>{const e=d(N);return f(()=>window.innerWidth<=x["sm-max"]({theme:e})||window.innerWidth>window.innerHeight&&window.innerHeight<x["sm-max"]({theme:e}),[e])},KP=I.div`
|
|
306
|
+
`,w$=["required","length","min","max","matches","email","url","uuid","positive","negative","integer","lessThan","moreThan","when","filled","empty","equals","notEquals","includes","excludes","uinfin","equalsField","withinDays","htmlSafe"];var S$;!function(e){const t=[],n={};e.buildSchema=(t,n)=>{const i={},[a,o]=r(t);return Object.keys(a).forEach(n=>{const{schema:r,validationRules:a}=t[n];i[n]=e.buildFieldSchema(r,a)}),sI().meta({yupId:n}).shape(i,o)};const r=e=>{const t=[],n={...e};return Object.entries(n).forEach(([e,{validationRules:r}])=>{const[a,o]=i(e,n,r);t.push(...o),n[e].validationRules=a}),[n,t]},i=(e,t,n)=>{const r=[],a=n?.filter(e=>!("when"in e))||[];return n?.filter(e=>"when"in e).forEach(n=>{const o={...n,when:n.when?{...n.when}:void 0};Object.keys(o.when).forEach(n=>{if(!t[n])return void console.warn(`field "${n}" was not found, when condition on "${e}" was not applied`);r.push([e,n]),o.when[n]={...o.when[n],yupSchema:t[n].schema.clone()};const[a,s]=i(e,t,o.when[n].then);o.when[n].then=a,r.push(...s)}),a.push(o)}),[a,r]};e.buildFieldSchema=(t,n)=>e.mapRules(t,n),e.mapSchemaType=e=>{switch(e){case"string":return VO().typeError("Only string values are allowed");case"number":return HO().typeError("Only number values are allowed");case"boolean":return zO().strict().typeError("Only boolean values are allowed");case"array":return cI().typeError("Only array values are allowed");case"object":return sI().typeError("Only object values are allowed");default:return $O()}},e.mapRules=(n,r)=>(r.forEach(r=>{const i=Object.keys(r).filter(e=>w$.includes(e))?.[0];switch(!0){case r.required:n=n.required(r.errorMessage||Yg.COMMON.FIELD_REQUIRED);break;case!!r.email:case!!r.url:case!!r.uuid:case!!r.positive:case!!r.negative:case!!r.integer:try{n=n[i](r.errorMessage)}catch(e){console.warn(`error applying "${i}" condition to ${n.type} schema`)}break;case r.length>0:case!isNaN(r.min):case!isNaN(r.max):case!isNaN(r.lessThan):case!isNaN(r.moreThan):try{n=n[i](r[i],r.errorMessage)}catch(e){console.warn(`error applying "${i}" condition to ${n.type} schema`)}break;case!!r.matches:{const e=r.matches.match(/\/(.*)\/([a-z]+)?/);try{n=n.matches(new RegExp(e[1],e[2]),r.errorMessage)}catch(e){console.warn(`error applying "${i}" condition to ${n.type} schema`)}}break;case!!r.when:Object.keys(r.when).forEach(t=>{const i=r.when[t]?.yupSchema;if(!i)return void console.warn(`[mapRules] Unexpected: yupSchema missing for field "${t}" in when condition. `);const a=r.when[t].is,o=e.mapRules(n,r.when[t].then),s=r.when[t].otherwise&&e.mapRules(n,r.when[t].otherwise);n=Array.isArray(a)&&a.every(e=>"object"==typeof e)?n.when(t,t=>{const n=e.mapRules(i.clone(),a);let r=!1;try{n.validateSync(t),r=!0}catch(e){}return r?o:s}):n.when(t,{is:a,then:o,otherwise:s})})}const a=Object.keys(r).filter(e=>t.includes(e))?.[0];a&&(n[a]?n=n[a](r[a],r.errorMessage):console.warn(`error applying "${a}" condition to ${n.type} schema`)),Object.keys(r).forEach(e=>{n=n.meta({rules:[...n.describe().meta?.rules||[],r]})}),n&&(n=n.transform(e=>{if(null!==e&&""!==e&&("object"!=typeof e||0!==Object.keys(e).length))return e}))}),n),e.addCondition=(e,r,i,a,o=!1)=>{if(a){if(n[a]||(n[a]={}),n[a][r]&&!0!==o)return void console.warn(`the validation condition "${r}" is not added because it already exists!`);n[a][r]=i}else if(t.includes(r)&&!0!==o)return void console.warn(`the validation condition "${r}" is not added because it already exists!`);t.includes(r)||t.push(r),fI(pI[e],r,function(e,t){return this.test({name:r,message:t,test:(t,o)=>{if(!a)return i(t,e,o);const s=o.options.from.length,u=o.options.from[s-1].schema.describe().meta.yupId;return n[u]?.[r]?.(t,e,o)}})})}}(S$||(S$={}));var C$=Nn,x$=si;var M$=function(e){return!0===e||!1===e||x$(e)&&"[object Boolean]"==C$(e)},O$=EM;var T$=function(e,t){return O$(e,t)},I$=Nn,D$=si;var N$=function(e){return"number"==typeof e||D$(e)&&"[object Number]"==I$(e)};const L$=/^[A-Za-z\s,()/.@'-]+$/;var k$;S$.addCondition("string","htmlSafe",(e,t)=>!(!bS(e)&&t)||L$.test(e)),function(e){e.LOCAL_S_PREFIX="S",e.LOCAL_T_PREFIX="T",e.FOREIGN_F_PREFIX="F",e.FOREIGN_G_PREFIX="G",e.FOREIGN_M_PREFIX="M"}(k$||(k$={}));const R$=[2,7,6,5,4,3,2],F$=["J","Z","I","H","G","F","E","D","C","B","A"],$$=["X","W","U","T","R","Q","P","N","M","L","K"],P$=["X","W","U","T","R","Q","P","N","J","L","K"];function z$(e){if("string"==typeof e){const t=function(e){return/^[STFGM]\d{7}[A-Z]$/.test(e)}(e),n=e.charAt(8)===function(e){let t=0;for(let n=0;n<7;++n)t+=Number(e.charAt(n+1))*R$[n];const n=e.charAt(0);n!==k$.LOCAL_T_PREFIX&&n!==k$.FOREIGN_G_PREFIX||(t+=4);n===k$.FOREIGN_M_PREFIX&&(t+=3);let r;r=n===k$.LOCAL_S_PREFIX||n===k$.LOCAL_T_PREFIX?F$[t%11]:n===k$.FOREIGN_M_PREFIX?P$[t%11]:$$[t%11];return r}(e);return t&&n}return!1}S$.addCondition("string","uinfin",e=>!!bS(e)||z$(e));const B$=["LP","LL","FC","PF","RF","MQ","MM","NB","CC","CS","MB","FM","GS","GA","GB","DP","CP","NR","CM","CD","MD","HS","VH","CH","MH","CL","XL","CX","RP","TU","TC","FB","FN","PA","PB","SS","MC","SM"];S$.addCondition("string","uen",e=>!!bS(e)||function(e){if(e.length<9||e.length>10)return!1;if(9===(e=e.toUpperCase()).length){if(e.match(/^\d{8}[A-Z]$/))return!0}else if(10===e.length){if(e.match(/^\d{9}[A-Z]$/))return!0;const t=String.raw`^((R|S|T)([\d]{2})(`+B$.join("|")+String.raw`)([\d]{4})([A-Z]))$`;if(e.match(t))return!0}return!1}(e));const Z$=e=>N$(e)?SS(e):bS(e)&&!M$(e);S$.addCondition("mixed","filled",e=>!Z$(e)),S$.addCondition("mixed","empty",e=>Z$(e)),S$.addCondition("mixed","equals",(e,t)=>!Z$(e)&&T$(e,t)),S$.addCondition("mixed","notEquals",(e,t)=>!Z$(e)&&!T$(e,t)),S$.addCondition("string","notMatches",(e,t)=>{if(Z$(e))return!0;const n=t.match(/\/(.*)\/([a-z]+)?/);return!new RegExp(n[1],n[2]).test(e)}),S$.addCondition("string","noWhitespaceOnly",(e,t)=>!(!Z$(e)&&t)||/\S/.test(e)),S$.addCondition("string","whitespace",(e,t)=>!(!Z$(e)&&t&&("object"!=typeof t||M$(t.noLeadingOrTrailingWhitespace)))||("object"!=typeof t||t.noLeadingOrTrailingWhitespace?/^\S([\s\S]*\S)?$/.test(e):/\S/.test(e))),S$.addCondition("array","includes",(e,t)=>!e?.length||(Array.isArray(t)?t.filter(t=>e.includes(t)).length===t.length:e.includes(t))),S$.addCondition("array","excludes",(e,t)=>!e?.length||(Array.isArray(t)?e.length&&0===t.filter(t=>e.includes(t)).length:!e.includes(t))),S$.addCondition("mixed","equalsField",(e,t,n)=>{if("object"==typeof e){if(Array.isArray(e)&&Array.isArray(n.parent[`${t}`])){const r=[...e].sort(),i=[...n.parent[`${t}`]].sort();return T$(r,i)}return T$(e,n.parent[`${t}`])}return T$(e,n.parent[`${t}`])}),S$.addCondition("mixed","notEqualsField",(e,t,n)=>{if("object"==typeof e){if(Array.isArray(e)&&Array.isArray(n.parent[`${t}`])){const r=[...e].sort(),i=[...n.parent[`${t}`]].sort();return!T$(r,i)}return!T$(e,n.parent[`${t}`])}return!T$(e,n.parent[`${t}`])}),S$.addCondition("mixed","withinDays",(e,t)=>!!bS(e)||Vg.checkWithinDays(e,t)),S$.addCondition("mixed","beyondDays",(e,t)=>!!bS(e)||Vg.checkBeyondDays(e,t));const U$=({children:t,recaptchaSiteKey:n})=>e(ru,{recaptchaSiteKey:n,children:e(WC,{children:e(Ws,{children:e(Ks,{children:e(Qs,{children:e(Ys,{children:e(Xs,{children:t})})})})})})}),j$=()=>{const{customComponents:e,setCustomComponents:t}=d(Gs),n=f(t=>e?.[t],[e]);return{customComponents:e,getCustomComponent:n,setCustomComponents:t}},G$="undefined"!=typeof window?(e,t)=>{const n=s(t),r=s(0);return T$(t,n.current)||(n.current=t,r.current+=1),p(e,[r.current])}:js,Y$=()=>{const{eventManagerRef:e}=d(Vs),t=f((t,n,r,i,a)=>{if("function"==typeof r&&"function"!=typeof i){const[a,o,s,u]=[t,n,r,i];e.current?.addEventListener(`${o}:${a}`,s,u)}else if("function"==typeof i){const[o,s,u,c,l]=[t,n,r,i,a];e.current?.addEventListener(`${u}:${s}`,c,l)}},[e]),n=f((t,n,r,i,a)=>{if("function"==typeof r&&"function"!=typeof i){const[a,o,s,u]=[t,n,r,i];e.current?.removeEventListener(`${o}:${a}`,s,u)}else if("function"==typeof i){const[o,s,u,c,l]=[t,n,r,i,a];e.current?.removeEventListener(`${u}:${s}`,c,l)}},[e]);return{addFieldEventListener:t,dispatchFieldEvent:f((t,n,r,i)=>{if("string"!=typeof r){const[i,a,o]=[t,n,r];return e.current?.dispatchEvent(new CustomEvent(`${a}:${i}`,{cancelable:!0,detail:{id:a,...o}}))}{const[a,o,s,u]=[t,n,r,i];return e.current?.dispatchEvent(new CustomEvent(`${s}:${o}`,{cancelable:!0,detail:{id:s,...u}}))}},[e]),removeFieldEventListener:n}};var V$=Jr,W$=qt;var H$=function(e,t,n){(void 0!==n&&!W$(e[t],n)||void 0===n&&!(t in e))&&V$(e,t,n)},K$=Ji,q$=si;var Q$=function(e){return q$(e)&&K$(e)};var J$=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]},X$=ai,eP=ma;var tP=H$,nP=_a.exports,rP=ko,iP=va,aP=Wo,oP=mi,sP=gi,uP=Q$,cP=Ai.exports,lP=$n,dP=Ln,fP=dC,pP=Li,hP=J$,mP=function(e){return X$(e,eP(e))};var gP=function(e,t,n,r,i,a,o){var s=hP(e,n),u=hP(t,n),c=o.get(u);if(c)tP(e,n,c);else{var l=a?a(s,u,n+"",e,t,o):void 0,d=void 0===l;if(d){var f=sP(u),p=!f&&cP(u),h=!f&&!p&&pP(u);l=u,f||p||h?sP(s)?l=s:uP(s)?l=iP(s):p?(d=!1,l=nP(u,!0)):h?(d=!1,l=rP(u,!0)):l=[]:fP(u)||oP(u)?(l=s,oP(s)?l=mP(s):dP(s)&&!lP(s)||(l=aP(u))):d=!1}d&&(o.set(u,l),i(l,u,r,a,o),o.delete(u)),tP(e,n,l)}},AP=Wr,yP=H$,_P=Lx,vP=gP,bP=Ln,EP=ma,wP=J$;var SP=function e(t,n,r,i,a){t!==n&&_P(n,function(o,s){if(a||(a=new AP),bP(o))vP(t,n,s,r,e,i,a);else{var u=i?i(wP(t,s),o,s+"",t,n,a):void 0;void 0===u&&(u=o),yP(t,s,u)}},EP)},CP=CC,xP=SC,MP=DC;var OP=function(e,t){return MP(xP(e,t,CP),e+"")},TP=qt,IP=Ji,DP=vi,NP=Ln;var LP=function(e,t,n){if(!NP(n))return!1;var r=typeof t;return!!("number"==r?IP(n)&&DP(t,n.length):"string"==r&&t in n)&&TP(n[t],e)},kP=OP,RP=LP;var FP=function(e){return kP(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&"function"==typeof a?(i--,a):void 0,o&&RP(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})},$P=SP,PP=FP(function(e,t,n){$P(e,t,n)}),zP=PP;const BP=()=>{const{setFormSchema:e,formSchema:t}=d(Hs);return{setFormSchema:e,formSchema:t,overrideSchema:f((e,t)=>{if(bS(t)||"string"==typeof e)return e;let n={};if(Object.keys(e).forEach(e=>{const r=ES.getNestedValueByKey(t,e,{searchIn:["children"]});bS(r)||(n={...n,...r})}),!bS(n)){const t=Fs(e),r=zP(t,n);return ES.removeNil(r)}return e},[])}},ZP=e=>{const t=He(),{setFormValues:n,formValues:r,formValuesRef:i,registeredFields:a,setRegisteredFields:o}=d(qs),s=f((n,r=!1)=>{if("string"!=typeof n){if(Array.isArray(n)){if(r){const r=n.filter(e=>a.includes(e));return e?.getValues(r)||t?.getValues(r)}return e?.getValues(n)||t?.getValues(n)}{const n=e?.getValues()||t?.getValues();if(r){const e={};return Object.entries(n).forEach(([t,n])=>{a.includes(t)&&(e[t]=n)}),e}return n}}if(!r||r&&a.includes(n))return e?.getValues(n)||t?.getValues(n)},[t?.getValues,e?.getValues,a]);return{formValues:r,getField:e=>i.current[e],setFields:e=>{i.current={...i.current,...e},n(t=>({...t,...e}))},setField:(e,t)=>{i.current[e]=t,n(n=>({...n,[e]:t}))},resetFields:e=>{i.current={...e},n(()=>({...e}))},registeredFields:a,setRegisteredFields:o,getFormValues:s}},UP=()=>{const{formValidationConfig:e,setFormValidationConfig:t}=d(VC);return{formValidationConfig:e,setFieldValidationConfig:(e,n,r=[])=>{t(t=>({...t,[e]:{schema:n,validationRules:r}}))},removeFieldValidationConfig:e=>t(t=>{const n={...t};return delete n[e],n})}},jP=()=>{const{addFieldEventListener:e,dispatchFieldEvent:t,removeFieldEventListener:n}=Y$(),r=He(),{setFieldValidationConfig:i,removeFieldValidationConfig:a}=UP();return{event:{addFieldEventListener:e,dispatchFieldEvent:t,removeFieldEventListener:n},formContext:r,validation:{setValidation:i,removeValidation:a}}},GP=()=>{const{submitHandler:e,setSubmitHandler:t,wrapInForm:n,setWrapInForm:r}=d(Js);return{submitHandler:e,setSubmitHandler:t,wrapInForm:n,setWrapInForm:r}},YP=(e,t)=>{u(()=>{const n=n=>{n.data.type===e&&t(n)};return window.addEventListener("message",n),()=>{window.removeEventListener("message",n)}},[e,t])},VP=e=>{const t=s();return u(()=>{t.current=e},[e]),t.current},WP=()=>{const{formValidationConfig:e,warnings:t,setWarnings:n,yupId:r}=d(VC),[i,a]=o(sI()),[s,c]=o(sI()),l=f(()=>{if(e){let t={},n={};Object.entries(e).forEach(([e,r])=>{if(!r.validationRules||0===r.validationRules.length)return void(t=ES.upsert(t,e,{schema:r.schema,validationRules:[]}));const i=r.validationRules.filter(({soft:e})=>e),a=r.validationRules.filter(({soft:e})=>!e);i.length&&(n=ES.upsert(n,e,{schema:r.schema,validationRules:i})),a.length&&(t=ES.upsert(t,e,{schema:r.schema,validationRules:a}))}),c(S$.buildSchema(n,r)),a(S$.buildSchema(t,r))}},[e,r]);u(()=>{l()},[l]);return{warnings:t,softValidationSchema:s,hardValidationSchema:i,rebuildValidationSchema:l,performSoftValidation:(e,t)=>{e.validate(t,{abortEarly:!1}).then(()=>{n({})}).catch(e=>{const t=e;if(bS(t))return;const r=t.inner.reduce((e,t)=>(e[t.path]=t.message,e),{});n(r)})},addWarnings:e=>{n({...t,...e})},yupId:r}},HP=()=>{const e=d(N);return f(()=>window.innerWidth<=x["sm-max"]({theme:e})||window.innerWidth>window.innerHeight&&window.innerHeight<x["sm-max"]({theme:e}),[e])},KP=I.div`
|
|
307
307
|
padding: ${w["spacing-32"]};
|
|
308
308
|
${S.MaxWidth.sm} {
|
|
309
309
|
padding: ${w["spacing-32"]} ${w["spacing-20"]};
|
|
@@ -483,7 +483,7 @@ function YN(e){return"[object Object]"===Object.prototype.toString.call(e)}Objec
|
|
|
483
483
|
cursor: pointer;
|
|
484
484
|
`,EU=I(P)`
|
|
485
485
|
margin-top: ${w["spacing-8"]};
|
|
486
|
-
`;var wU=to,SU=function(){},CU=wU&&1/Kx(new wU([,-0]))[1]==1/0?function(e){return new wU(e)}:SU,xU=Zx,MU=Fz,OU=$z,TU=jx,IU=CU,DU=Kx;var NU=function(e,t,n){var r=-1,i=MU,a=e.length,o=!0,s=[],u=s;if(n)o=!1,i=OU;else if(a>=200){var c=t?null:IU(e);if(c)return DU(c);o=!1,i=TU,u=new xU}else u=t?[]:s;e:for(;++r<a;){var l=e[r],d=t?t(l):l;if(l=n||0!==l?l:0,o&&d==d){for(var f=u.length;f--;)if(u[f]===d)continue e;t&&u.push(d),s.push(l)}else i(u,d,n)||(u!==s&&u.push(d),s.push(l))}return s},LU=Gz,kU=_C,RU=NU;var FU=function(e,t,n){var r=e.length;if(r<2)return r?RU(e[0]):[];for(var i=-1,a=Array(r);++i<r;)for(var o=e[i],s=-1;++s<r;)s!=i&&(a[i]=LU(a[i]||o,e[s],t,n));return RU(kU(a,1),t,n)},$U=ba,PU=FU,zU=Q$,BU=OP(function(e){return PU($U(e,zU))});const ZU=a({files:[],setFiles:()=>null,currentFileIds:[],setCurrentFileIds:()=>null}),UU=({children:t})=>{const[n,r]=o([]),[i,a]=o([]),s=l(()=>({files:n,setFiles:r,currentFileIds:i,setCurrentFileIds:a}),[n,i]);return e(ZU.Provider,{value:s,children:t})};var jU,GU;!function(e){e.findAvailableSlot=e=>{const t=e.reduce((e,{slot:t})=>t>e?t:e,0),n=Math.max(t,e.length),r=Array(n).fill(0).map((e,t)=>t),i=e.map(({slot:e})=>e);return r.filter(e=>!i.includes(e))[0]??n}}(jU||(jU={})),function(e){e[e.INJECTED=-99]="INJECTED",e[e.INJECTING=-98]="INJECTING",e[e.TO_DELETE=-4]="TO_DELETE",e[e.ERROR_FORMAT=-3]="ERROR_FORMAT",e[e.ERROR_GENERIC=-2]="ERROR_GENERIC",e[e.ERROR_SIZE=-1]="ERROR_SIZE",e[e.NONE=0]="NONE",e[e.UPLOAD_READY=4]="UPLOAD_READY",e[e.UPLOADING=5]="UPLOADING",e[e.UPLOADED=6]="UPLOADED"}(GU||(GU={}));const YU=y(()=>import("./file-upload-manager.
|
|
486
|
+
`;var wU=to,SU=function(){},CU=wU&&1/Kx(new wU([,-0]))[1]==1/0?function(e){return new wU(e)}:SU,xU=Zx,MU=Fz,OU=$z,TU=jx,IU=CU,DU=Kx;var NU=function(e,t,n){var r=-1,i=MU,a=e.length,o=!0,s=[],u=s;if(n)o=!1,i=OU;else if(a>=200){var c=t?null:IU(e);if(c)return DU(c);o=!1,i=TU,u=new xU}else u=t?[]:s;e:for(;++r<a;){var l=e[r],d=t?t(l):l;if(l=n||0!==l?l:0,o&&d==d){for(var f=u.length;f--;)if(u[f]===d)continue e;t&&u.push(d),s.push(l)}else i(u,d,n)||(u!==s&&u.push(d),s.push(l))}return s},LU=Gz,kU=_C,RU=NU;var FU=function(e,t,n){var r=e.length;if(r<2)return r?RU(e[0]):[];for(var i=-1,a=Array(r);++i<r;)for(var o=e[i],s=-1;++s<r;)s!=i&&(a[i]=LU(a[i]||o,e[s],t,n));return RU(kU(a,1),t,n)},$U=ba,PU=FU,zU=Q$,BU=OP(function(e){return PU($U(e,zU))});const ZU=a({files:[],setFiles:()=>null,currentFileIds:[],setCurrentFileIds:()=>null}),UU=({children:t})=>{const[n,r]=o([]),[i,a]=o([]),s=l(()=>({files:n,setFiles:r,currentFileIds:i,setCurrentFileIds:a}),[n,i]);return e(ZU.Provider,{value:s,children:t})};var jU,GU;!function(e){e.findAvailableSlot=e=>{const t=e.reduce((e,{slot:t})=>t>e?t:e,0),n=Math.max(t,e.length),r=Array(n).fill(0).map((e,t)=>t),i=e.map(({slot:e})=>e);return r.filter(e=>!i.includes(e))[0]??n}}(jU||(jU={})),function(e){e[e.INJECTED=-99]="INJECTED",e[e.INJECTING=-98]="INJECTING",e[e.TO_DELETE=-4]="TO_DELETE",e[e.ERROR_FORMAT=-3]="ERROR_FORMAT",e[e.ERROR_GENERIC=-2]="ERROR_GENERIC",e[e.ERROR_SIZE=-1]="ERROR_SIZE",e[e.NONE=0]="NONE",e[e.UPLOAD_READY=4]="UPLOAD_READY",e[e.UPLOADING=5]="UPLOADING",e[e.UPLOADED=6]="UPLOADED"}(GU||(GU={}));const YU=y(()=>import("./file-upload-manager.817b80cc.js")),VU=r=>{const{id:i,error:a,isDirty:c,isTouched:l,value:p,schema:{compressImages:h,description:m,hideThumbnail:g,label:A,uploadOnAddingFile:y,validation:v,warning:b,...E},warning:w}=r,{files:S,currentFileIds:C,setFiles:x}=d(ZU),M=s({}),O=s({}),T=s({}),I=s({}),D=s({}),{setFieldValidationConfig:N}=UP(),{dispatchFieldEvent:L}=Y$(),{clearErrors:k,setError:R}=He(),[F,$]=o(),P=s(S);P.current=S;const z=f((e,t)=>{const n=[...t],r=n.length;e.forEach((e,t)=>{!T.current.max||r+t<T.current.max?(n.push({...e,slot:jU.findAvailableSlot(n)}),k(i)):R(i,{type:"max",message:T.current.errorMessage||Yg.UPLOAD().MAX_FILES(T.current.max)})}),x(n)},[k,i,R,x]);u(()=>{L("mount",i)},[L,i]),u(()=>{const e=v?.find(e=>"required"in e),t=v?.find(e=>"fileType"in e),n=v?.find(e=>"fileExtension"in e),r=v?.find(e=>"maxSizeInKb"in e),a=v?.find(e=>"upload"in e&&e.upload);M.current=t?.fileType?t:{},O.current=t?.fileType&&n?.fileExtension?n:{},I.current=r?.maxSizeInKb>0?r:{},D.current=a||{};const o=v?.find(e=>"length"in e),s=v?.find(e=>"max"in e);T.current=o?{max:o.length,errorMessage:o.errorMessage}:s?{max:s.max,errorMessage:s.errorMessage}:{},N(i,cI().of(sI().shape({dataURL:VO(),fileId:VO(),fileName:VO(),fileUrl:VO(),uploadResponse:sI()})).test("is-empty-array",e?.errorMessage||Yg.UPLOAD().REQUIRED,t=>!t||!e?.required||t.length>0).test("max-size-in-kb",I.current.errorMessage||Yg.UPLOAD().MAX_FILE_SIZE(I.current.maxSizeInKb),e=>!(e&&Array.isArray(e)&&I.current.maxSizeInKb)||S.filter(e=>e.status===GU.UPLOADED).every(e=>{if("base64"===y.type&&e.dataURL)return Gg.getFilesizeFromBase64(e.dataURL)<=1024*I.current.maxSizeInKb;if("multipart"===y.type){const t=e.uploadResponse?.data||e.uploadResponse;let n=e.rawFile?.size||t?.fileSize;return isNaN(n)&&(n=0),n<=1024*I.current.maxSizeInKb}})).test("max-files",T.current.errorMessage||Yg.UPLOAD().MAX_FILES(T.current.max),e=>!(e&&Array.isArray(e)&&T.current.max)||e.length<=T.current.max).test("no-interim-statuses",Yg.UPLOAD().UPLOADING,()=>{const e=new Set([GU.INJECTED,GU.INJECTING,GU.NONE,GU.UPLOAD_READY,GU.UPLOADING]);return!P.current.some(t=>e.has(t.status))}),v)},[v,S.map(e=>e.status).join(",")]),u(()=>{if(!c&&!l){const e=Array.isArray(p)?p:[];if(!(BU(e.map(({fileId:e})=>e),C).length>0))return;const t=[];e.forEach(({dataURL:e,fileId:n,fileName:r,fileUrl:i,uploadResponse:a})=>{t.push({addedFrom:"schema",dataURL:e,fileItem:{id:n},uploadResponse:a,fileUrl:i,rawFile:{name:r},slot:null,status:GU.INJECTED})}),z(t,[])}},[z,c,l,C,p]),u(()=>{if(a?.message)try{const{message:e,fileErrors:t}=JSON.parse(a.message);t&&x(P.current.map(e=>{const n=t[e.fileItem.id];return n?{...e,fileItem:{...e.fileItem,errorMessage:n}}:e})),e&&$(e)}catch(e){$(a.message)}else $(void 0)},[a?.message,x]);const B=t=>t?e(c$,{children:t}):null;return t(n,{children:[e(_,{fallback:null,children:e(YU,{compressImages:!!h,fileTypeRule:M.current,fileExtensionRule:O.current,hideThumbnail:g,id:i,maxFileSizeRule:I.current,upload:y,uploadRule:D.current,value:p})}),e(re,{...E,accept:M.current.fileType?.map(e=>`.${e}`).join(","),description:B(m),errorMessage:B(F),fileItems:S.filter(({fileItem:e,status:t})=>!!e&&t!==GU.INJECTED&&t!==GU.INJECTING).map(({fileItem:e})=>e),id:i,maxFiles:T.current.max,onChange:e=>{z(e.map(e=>({addedFrom:"input",rawFile:e,slot:null,status:GU.NONE})),S)},onDelete:e=>{x(S.map(t=>t.fileItem.id!==e.id?t:{...t,status:GU.TO_DELETE})),k(i)},title:B(A),warning:B(w||b)})]})},WU=a({images:[],setImages:()=>null,errorCount:0,setErrorCount:()=>null,currentFileIds:[],setCurrentFileIds:()=>null}),HU=({children:t})=>{const[n,r]=o([]),[i,a]=o(0),[s,u]=o([]);return e(WU.Provider,{value:{images:n,setImages:r,errorCount:i,setErrorCount:a,currentFileIds:s,setCurrentFileIds:u},children:t})},KU=["jpg","gif","png","heic","heif","webp"];var qU,QU;!function(e){e[e.INJECTED=-99]="INJECTED",e[e.ERROR_FILENAME=-8]="ERROR_FILENAME",e[e.ERROR_CUSTOM_MUTED=-7]="ERROR_CUSTOM_MUTED",e[e.ERROR_EXCEED=-6]="ERROR_EXCEED",e[e.ERROR_CUSTOM=-5]="ERROR_CUSTOM",e[e.TO_DELETE=-4]="TO_DELETE",e[e.ERROR_FORMAT=-3]="ERROR_FORMAT",e[e.ERROR_GENERIC=-2]="ERROR_GENERIC",e[e.ERROR_SIZE=-1]="ERROR_SIZE",e[e.NONE=0]="NONE",e[e.TO_RECOMPRESS=1]="TO_RECOMPRESS",e[e.COMPRESSED=2]="COMPRESSED",e[e.RECOMPRESSED=2]="RECOMPRESSED",e[e.CONVERTED=2]="CONVERTED",e[e.EDITED=3]="EDITED",e[e.UPLOAD_READY=4]="UPLOAD_READY",e[e.UPLOADING=5]="UPLOADING",e[e.UPLOADED=6]="UPLOADED",e[e.PENDING=7]="PENDING"}(qU||(qU={})),function(e){e.shouldRenderFileItem=e=>{const{status:t,drawingDataURL:n,dataURL:r}=e;return!(!n&&!r)||t<qU.NONE&&t!==qU.INJECTED&&t!==qU.TO_DELETE},e.findAvailableSlot=e=>{const t=e.reduce((e,{slot:t})=>t>e?t:e,0),n=Math.max(t,e.length),r=Array(n).fill(0).map((e,t)=>t),i=e.map(({slot:e})=>e);return r.filter(e=>!i.includes(e))[0]??n}}(QU||(QU={}));var JU,XU={exports:{}},ej={exports:{}},tj={};var nj,rj,ij,aj,oj,sj,uj,cj,lj,dj,fj,pj,hj,mj,gj={};
|
|
487
487
|
/** @license React v16.13.1
|
|
488
488
|
* react-is.development.js
|
|
489
489
|
*
|
|
@@ -635,7 +635,7 @@ object-assign
|
|
|
635
635
|
`,zG=I.div`
|
|
636
636
|
display: flex;
|
|
637
637
|
width: 100%;
|
|
638
|
-
`,BG=({id:r="file-item",index:i,fileItem:a,maxSizeInKb:c,accepts:l,onDelete:d,validation:p})=>{const{dataURL:h,file:m,name:g,status:A,uploadProgress:y}=a,[_,v]=o(!1),[b,E]=o(),w=s(null),[S,C]=o(),x=f(()=>{const e=Gg.truncateFileName(g,w);C(e)},[g]);u(()=>{const e=new ResizeObserver(()=>{w.current&&x()}),t=w.current;return t&&(e.observe(t),x()),()=>{t&&e.unobserve(t)}},[w,x]),u(()=>{switch(A){case
|
|
638
|
+
`,BG=({id:r="file-item",index:i,fileItem:a,maxSizeInKb:c,accepts:l,onDelete:d,validation:p})=>{const{dataURL:h,file:m,name:g,status:A,uploadProgress:y}=a,[_,v]=o(!1),[b,E]=o(),w=s(null),[S,C]=o(),x=f(()=>{const e=Gg.truncateFileName(g,w);C(e)},[g]);u(()=>{const e=new ResizeObserver(()=>{w.current&&x()}),t=w.current;return t&&(e.observe(t),x()),()=>{t&&e.unobserve(t)}},[w,x]),u(()=>{switch(A){case qU.ERROR_FORMAT:{const e=p?.find(e=>"fileType"in e),t=e?.errorMessage||Yg.UPLOAD("photo").FILE_TYPE(l);v(!0),E(t);break}case qU.ERROR_GENERIC:{const e=p?.find(e=>"upload"in e),t=e?.errorMessage||Yg.UPLOAD("photo").GENERIC;v(!0),E(t);break}case qU.ERROR_SIZE:{const e=p?.find(e=>"maxSizeInKb"in e),t=e?.errorMessage||Yg.UPLOAD("photo").MAX_FILE_SIZE(c);v(!0),E(t);break}case qU.ERROR_FILENAME:{const e=p?.find(e=>"matches"in e),t=e?.errorMessage||Yg.UPLOAD("photo").MODAL.GENERIC_ERROR.INVALID_FILE_NAME;v(!0),E(t);break}case qU.ERROR_CUSTOM:{const e=a.customErrorMessage;v(!0),E(e);break}case qU.ERROR_CUSTOM_MUTED:{const e=a.customErrorMessage;v(!1),E(e);break}}},[A,h,m.type,c]);const M=`${Math.round(Gg.getFilesizeFromBase64(a.drawingDataURL||a.dataURL||"")/1e3)} KB`,O=()=>(_||A===qU.ERROR_CUSTOM_MUTED)&&e($G,{weight:"semibold",id:wS.generateId(`${r}-${i+1}`,"error-text"),"data-testid":wS.generateId(`${r}-${i+1}`,"error-text"),children:b});return e(xG,{$isError:_,$isCustomMuted:A===qU.ERROR_CUSTOM_MUTED,id:wS.generateId(`${r}-${i+1}`),"data-testid":wS.generateId(`${r}-${i+1}`),children:t(n,{children:[e(MG,{children:A===qU.ERROR_CUSTOM_MUTED?t(n,{children:[t(zG,{children:[e(DG,{$src:a.dataURL??"",id:wS.generateId(`${r}-${i+1}`,"image"),"data-testid":wS.generateId(`${r}-${i+1}`,"image")}),t(NG,{forwardedAs:"div",id:wS.generateId(`${r}-${i+1}`,"file-image"),"data-testid":wS.generateId(`${r}-${i+1}`,"file-image"),children:[e(LG,{ref:w,children:S}),e(RG,{children:O()}),e(kG,{children:M})]})]}),e(NG,{forwardedAs:"div",id:wS.generateId(`${r}-${i+1}`,"file-error"),"data-testid":wS.generateId(`${r}-${i+1}`,"file-error"),children:e(kG,{children:O()})})]}):t(n,{children:[A===qU.UPLOADED&&!_&&e(DG,{$src:a.dataURL??"",id:wS.generateId(`${r}-${i+1}`,"image"),"data-testid":wS.generateId(`${r}-${i+1}`,"image")}),t(NG,{forwardedAs:"div",id:wS.generateId(`${r}-${i+1}`,"file-image"),"data-testid":wS.generateId(`${r}-${i+1}`,"file-image"),children:[e(LG,{ref:w,children:S}),O(),e(kG,{children:M})]})]})}),e(OG,{children:e(T.BodyBL,{id:wS.generateId(`${r}-${i+1}`,"file-size"),"data-testid":wS.generateId(`${r}-${i+1}`,"file-size"),children:M})}),!_&&[qU.COMPRESSED,qU.CONVERTED,qU.UPLOADING].includes(A)?e(TG,{children:e(FG,{value:y,max:100})}):e(IG,{children:e(PG,{onClick:d(i),id:wS.generateId(`${r}-${i+1}`,"btn-delete"),"data-testid":wS.generateId(`${r}-${i+1}`,"btn-delete"),"aria-label":`remove ${g}`,children:e(ie,{})})})]})})},ZG=I.div`
|
|
639
639
|
border-radius: ${C.sm};
|
|
640
640
|
${E.Util["dashed-default"]({colour:b.border,thickness:E["width-040"],radius:C.sm})}
|
|
641
641
|
&:not(:last-child) {
|
|
@@ -696,7 +696,7 @@ object-assign
|
|
|
696
696
|
`,qG=I(P)`
|
|
697
697
|
margin-top: ${w["spacing-16"]};
|
|
698
698
|
margin-bottom: ${w["spacing-16"]};
|
|
699
|
-
`,QG=n=>{const{id:r,capture:i,className:a,label:s,buttonLabel:c="Add photos",description:l,dimensions:f,maxFiles:p,accepts:h,maxSizeInKb:m,validation:g,errorMessage:A,multiple:y,warning:_,tooltip:b}=n,{images:E,setImages:w,setErrorCount:S}=d(WU),{dispatchFieldEvent:C}=Y$(),x=v(),[M,O]=o(0),[T,I]=o();u(()=>{p>0&&O(p-E.length)},[p,E.length]);const D=VP(T);u(()=>{D&&!T&&S(e=>Math.max(0,e-1))},[T]);const N=e=>{e?.preventDefault(),C("file-dialog",r),x?.current?.fileDialog()},L=e=>t=>{t.preventDefault(),w(t=>t.map((t,n)=>({...t,...n===e?{status:
|
|
699
|
+
`,QG=n=>{const{id:r,capture:i,className:a,label:s,buttonLabel:c="Add photos",description:l,dimensions:f,maxFiles:p,accepts:h,maxSizeInKb:m,validation:g,errorMessage:A,multiple:y,warning:_,tooltip:b}=n,{images:E,setImages:w,setErrorCount:S}=d(WU),{dispatchFieldEvent:C}=Y$(),x=v(),[M,O]=o(0),[T,I]=o();u(()=>{p>0&&O(p-E.length)},[p,E.length]);const D=VP(T);u(()=>{D&&!T&&S(e=>Math.max(0,e-1))},[T]);const N=e=>{e?.preventDefault(),C("file-dialog",r),x?.current?.fileDialog()},L=e=>t=>{t.preventDefault(),w(t=>t.map((t,n)=>({...t,...n===e?{status:qU.TO_DELETE}:{}}))),I(!1)};return e(ZG,{id:wS.generateId(r),"data-testid":wS.generateId(r),className:a,"aria-invalid":!!A,"aria-describedby":!!A&&wS.generateId(r,"error"),children:t(CG,{id:`${r}-drag-upload`,accept:h,capture:i,onInput:e=>{if(e&&e.length)if(!p||e.length+E.length<=p){const t=[...E];e.forEach(e=>{const n=QU.findAvailableSlot(t);t.push({id:Hg(),file:e,name:e.name,dimensions:f,status:qU.NONE,uploadProgress:0,addedFrom:"dragInput",slot:n})}),w(t),I(!1)}else p>0&&I(!0)},ref:x,multiple:y,children:[e(UG,{forwardedAs:"label",htmlFor:wS.generateId(r,"file-input-add-button"),$hasDescription:!!l,weight:"semibold",children:s}),b&&t(jG,{type:"button","data-testid":wS.generateId(r,"tooltip"),onClick:()=>C("click-tooltip",r),children:[b.label&&e(YG,{children:b.label}),b.icon&&(t=>{const n=Y[t];return e(GG,{children:e(n,{})})})(b.icon)]}),l&&e(VG,{children:e(c$,{children:l})}),E&&E.length?E.map((t,n)=>QU.shouldRenderFileItem(t)?e(BG,{id:`${r}-file-item`,index:n,fileItem:t,maxSizeInKb:m,accepts:h,validation:g,onDelete:L},`${t.name}_${n}`):null):null,T?(()=>{const t=g?.find(e=>"length"in e),n=g?.find(e=>"max"in e);let i=t?.errorMessage||n?.errorMessage;return i||(i=M<1||0===E.length?Yg.UPLOAD("photo").MAX_FILES(p):Yg.UPLOAD("photo").MAX_FILES_WITH_REMAINING(M)),e(qG,{type:"error","data-testid":wS.generateId(r,"error"),children:i})})():null,A&&(k=A,e(qG,{type:"error","data-testid":wS.generateId(r,"error"),children:k})),_?e(qG,{type:"warning","data-testid":wS.generateId(r,"warning"),children:_}):null,p&&M<=0?null:t(WG,{children:[e(HG,{type:"button",onClick:N,styleType:"secondary",id:wS.generateId(r,"file-input-add-button"),"data-testid":wS.generateId(r,"file-input-add-button"),children:c}),e(KG,{children:"or drop them here"})]})]})});var k},JG=I.div`
|
|
700
700
|
position: absolute;
|
|
701
701
|
top: 0;
|
|
702
702
|
left: 0;
|
|
@@ -744,7 +744,7 @@ object-assign
|
|
|
744
744
|
@media (orientation: landscape) and (max-height: ${x["sm-max"]}px) {
|
|
745
745
|
margin-top: ${w["spacing-8"]};
|
|
746
746
|
}
|
|
747
|
-
`,aY=r=>{const{id:i="photo-error",image:{name:a,status:c,customErrorMessage:l},accepts:p,maxSizeInKb:h,onClickOk:m,maxFilesErrorMessage:g,maxFiles:A}=r,{images:y}=d(WU),[_,v]=o(),[b,E]=o(),[w,S]=o(),C=s(null),x=f(()=>{const e=Gg.truncateFileName(a,C);S(e)},[a]);return u(()=>{const t=e(rY,{children:w});switch(c){case
|
|
747
|
+
`,aY=r=>{const{id:i="photo-error",image:{name:a,status:c,customErrorMessage:l},accepts:p,maxSizeInKb:h,onClickOk:m,maxFilesErrorMessage:g,maxFiles:A}=r,{images:y}=d(WU),[_,v]=o(),[b,E]=o(),[w,S]=o(),C=s(null),x=f(()=>{const e=Gg.truncateFileName(a,C);S(e)},[a]);return u(()=>{const t=e(rY,{children:w});switch(c){case qU.ERROR_FORMAT:v(Yg.UPLOAD("photo").MODAL.FILE_TYPE.TITLE),E(Yg.UPLOAD("photo").MODAL.FILE_TYPE.DESCRIPTION(t,p));break;case qU.ERROR_FILENAME:v(Yg.UPLOAD("file").MODAL.GENERIC_ERROR.INVALID_FILE_NAME),E(e(n,{children:l}));break;case qU.ERROR_GENERIC:v(Yg.UPLOAD("photo").MODAL.GENERIC_ERROR.TITLE),E(Yg.UPLOAD("photo").MODAL.GENERIC_ERROR.DESCRIPTION(t));break;case qU.ERROR_SIZE:v(Yg.UPLOAD("photo").MODAL.MAX_FILE_SIZE.TITLE),E(Yg.UPLOAD("photo").MODAL.MAX_FILE_SIZE.DESCRIPTION(t,h));break;case qU.ERROR_EXCEED:{const t=A-y.filter(({status:e})=>e>=qU.NONE).length;let r=g;r||(r=t<1||0===y.length?Yg.UPLOAD("photo").MAX_FILES(A):Yg.UPLOAD("photo").MAX_FILES_WITH_REMAINING(t)),v("Photo limit exceeded"),E(e(n,{children:r}));break}}},[p,l,y,A,g,h,a,c,w]),u(()=>{const e=new ResizeObserver(()=>{C.current&&x()}),t=C.current;return t&&(e.observe(t),x()),()=>{t&&e.unobserve(t)}},[C,x]),t(JG,{children:[e(XG,{src:"https://assets.life.gov.sg/web-frontend-engine/img/icons/warning-white.svg",alt:_}),t(eY,{children:[e(nY,{id:wS.generateId(i,"title"),"data-testid":wS.generateId(i,"title"),weight:"bold",children:_}),e(tY,{ref:C,children:b}),e(iY,{onClick:m,id:wS.generateId(i,"ok-button"),"data-testid":wS.generateId(i,"ok-button"),children:"OK"})]})]})},oY=r=>{const{id:i="image-prompts",onDecideClearDrawing:a,onDecideDelete:o,onDecideExit:s,images:u,show:c}=r;return t(n,{children:[e(xI,{id:wS.generateId(i,"delete"),title:u.length>1?"Delete photo?":"Delete photo and exit?",show:"delete"===c,size:"large",description:u.length>1?"This photo will not be uploaded.":"As you're deleting the only photo, you'll be brought back to the form. You'll have to upload another photo.",buttons:[{id:"delete",title:u.length>1?"Yes, delete":"Delete and exit",onClick:()=>o(!0)},{id:"cancel",title:"Cancel",buttonStyle:"secondary",onClick:()=>o(!1)}]}),e(xI,{id:wS.generateId(i,"exit"),title:"Exit without saving?",show:"exit"===c,description:"Your photos or drawings will not be saved.",buttons:[{id:"exit",title:"Yes, exit",onClick:()=>s(!0)},{id:"cancel",title:"Cancel",buttonStyle:"secondary",onClick:()=>s(!1)}]}),e(xI,{id:wS.generateId(i,"clearing-drawing"),title:"Clear drawings?",show:"clear-drawing"===c,description:"Your changes will not be saved.",buttons:[{title:"Yes, clear",onClick:()=>a(!0)},{title:"Cancel",buttonStyle:"secondary",onClick:()=>a(!1)}]})]})},sY=I(R.Box)`
|
|
748
748
|
display: block;
|
|
749
749
|
max-height: fit-content;
|
|
750
750
|
|
|
@@ -1016,7 +1016,7 @@ object-assign
|
|
|
1016
1016
|
stroke: ${b["icon-primary"]};
|
|
1017
1017
|
stroke-width: 1;
|
|
1018
1018
|
}
|
|
1019
|
-
`,$Y=r=>{const{accepts:i,activeFileIndex:a,capture:o,id:u="image-thumbnails",images:c,maxFiles:l,onClickThumbnail:d,onSelectFile:f,multiple:p}=r,h=s(null),m=async e=>{const t=Array.from(e.target.files||[]);t.length&&setTimeout(()=>{f(t)},100)},g=()=>h?.current?.click();return t(OY,{id:wS.generateId(u),children:[c.map((n,r)=>n.status===
|
|
1019
|
+
`,$Y=r=>{const{accepts:i,activeFileIndex:a,capture:o,id:u="image-thumbnails",images:c,maxFiles:l,onClickThumbnail:d,onSelectFile:f,multiple:p}=r,h=s(null),m=async e=>{const t=Array.from(e.target.files||[]);t.length&&setTimeout(()=>{f(t)},100)},g=()=>h?.current?.click();return t(OY,{id:wS.generateId(u),children:[c.map((n,r)=>n.status===qU.NONE?e(LY,{children:[...Array(4)].map((t,n)=>e(NY,{},`dot-${n}`))},r):n.status>qU.NONE||n.status===qU.ERROR_CUSTOM_MUTED?e(TY,{id:wS.generateId(u,`item-${r+1}`),"data-testid":wS.generateId(u,`item-${r+1}`),$src:n.thumbnailDataURL||n.dataURL||"https://assets.life.gov.sg/web-frontend-engine/img/icons/photo-placeholder-add.svg",type:"button","aria-label":`thumbnail of ${n.name}`,onClick:()=>d(r),children:e(kY,{$isSelected:a===r})},r):"reviewModal"===n.addedFrom||n.status<qU.NONE?t(TY,{id:wS.generateId(u,`item-${r+1}`),"data-testid":wS.generateId(u,`item-${r+1}`),type:"button","aria-label":`error with ${n.name}`,onClick:()=>d(r),$error:!0,children:[e(kY,{$isSelected:a===r}),e(IY,{})]},r):void 0),(c.filter(({status:e,addedFrom:t})=>e>=qU.NONE||e===qU.ERROR_CUSTOM_MUTED||"reviewModal"===t).length<l||!l)&&t(n,{children:[e(RY,{id:wS.generateId(u,"file-input"),"data-testid":wS.generateId(u,"file-input"),type:"file","aria-hidden":"true",tabIndex:-1,capture:o,ref:h,accept:i.map(e=>`.${e}`).join(", "),onChange:m,multiple:p,value:""}),e(FY,{type:"button",id:wS.generateId(u,"add-image-button"),"data-testid":wS.generateId(u,"add-image-button"),"aria-label":"add image",styleType:"secondary",onClick:g,children:e(le,{})})]})]})},PY=y(()=>import("./index.51ad1607.js")),zY=[{color:"#282828",label:"black"},{color:"#FFF",colorScheme:"light",label:"white"},{color:"#017cd3",label:"blue"},{color:"#fb0101",label:"red"},{color:"#22910c",label:"green"},{color:"#f8e821",label:"yellow"}],BY=r=>{const{accepts:i,capture:a,className:c,compress:l,dimensions:p,id:h="image-review",maxFiles:m,maxSizeInKb:g,onExit:A,outputType:y,show:v,multiple:b,maxFilesErrorMessage:E,imageReviewModalStyles:w}=r,{images:S,setImages:C}=d(WU),{dispatchFieldEvent:x,addFieldEventListener:M,removeFieldEventListener:O}=Y$(),T=VP(v),[I,D]=o(S.length-1),[N,L]=o(!1),[k,F]=o(),$=!!S?.find(({status:e})=>e===qU.NONE),[P,z]=o(zY[0].color),[B,Z]=o(!1),U=s(null),j=!!S?.find(({addedFrom:e,status:t})=>"reviewModal"===e&&t<=qU.NONE)||!S.length,G=f(e=>{e.detail.removePendingImages&&C(e=>e.filter(({status:e})=>e===qU.UPLOADED||e===qU.ERROR_CUSTOM_MUTED)),A()},[A,C]),Y=e=>{!m||e.length+S.filter(({status:e,addedFrom:t})=>e>=qU.NONE||"reviewModal"===t).length<=m?e.forEach(e=>{C(t=>{const n=QU.findAvailableSlot(t);return[...t,{id:Hg(),file:e,name:e.name,dimensions:p,status:qU.NONE,uploadProgress:0,addedFrom:"reviewModal",slot:n}]})}):C(t=>{const n=QU.findAvailableSlot(t);return[...t,{id:Hg(),file:e[0],name:e[0].name,dimensions:p,status:qU.ERROR_EXCEED,uploadProgress:0,addedFrom:"reviewModal",slot:n}]})},V=e=>{e&&(C(e=>e.map((e,t)=>({...e,...t===I?{status:qU.TO_DELETE}:{}}))),D(Math.max(0,I-1))),F(null)},W=f(()=>{C(e=>e.filter(({status:e})=>e>=qU.NONE||e===qU.ERROR_CUSTOM_MUTED).map(e=>{const t={...e};return e.drawingDataURL&&(t.dataURL=e.drawingDataURL),e.status<qU.UPLOAD_READY&&e.status>qU.NONE&&(t.status=qU.UPLOAD_READY),t.drawingDataURL=void 0,t.drawing=void 0,t}))},[C]),H=()=>{!x("save-review-images",h,{images:S,retry:H})||(W(),A())},K=()=>{L(!0),z(zY[0].color)},q=async()=>{const{dataURL:e,drawing:t}=U.current?.export()||{},n=await jw.dataUrlToImage(e),r=await jw.resampleImage(n,{scale:96/n.width,type:Gg.fileExtensionToMimeType(y)}),i=await Gg.fileToDataUrl(r);C(n=>{const r=[...n];return r[I]={...r[I],thumbnailDataURL:i,drawingDataURL:e,drawing:t,status:l?qU.TO_RECOMPRESS:qU.EDITED},r}),L(!1),J()},Q=()=>{J(),Z(!0)},J=()=>{z(""),Z(!1)};u(()=>{const e={"trigger-save-review-images":W,"dismiss-review-modal":G};return Object.entries(e).forEach(([e,t])=>{M(e,h,t)}),()=>{Object.entries(e).forEach(([e,t])=>{O(e,h,t)})}},[M,G,W,h,O]),u(()=>{D(S.length-1)},[S.length]),u(()=>{v?x("show-review-modal",h):T&&x("hide-review-modal",h)},[v]);return e(R,{id:wS.generateId(h,void 0,v?"show":"hide"),className:c?`${c}-review`:void 0,show:v,children:e(sY,{className:c?`${c}-review-modal-box`:void 0,imageReviewModalStyles:w,showCloseButton:!1,children:v?t(n,{children:[e(uY,{className:c?`${c}-header`:void 0,$drawActive:N,children:t(n,N?{children:[e(fY,{id:wS.generateId(h,"clear-drawing-button"),"data-testid":wS.generateId(h,"clear-drawing-button"),onClick:()=>F("clear-drawing"),children:"Clear"}),e(fY,{id:wS.generateId(h,"save-drawing"),"data-testid":wS.generateId(h,"save-drawing"),onClick:q,children:"Save"})]}:{children:[e(cY,{id:wS.generateId(h,"close-button"),"data-testid":wS.generateId(h,"close-button"),"aria-label":"exit review modal",onClick:()=>F("exit"),children:e(ie,{type:"cross"})}),e(lY,{weight:"semibold",children:"Review photos"})]})}),t(pY,{children:[S.length>0&&e(vY,{className:c?`${c}-editor`:void 0,children:e(_,{fallback:null,children:e(PY,{baseImageDataURL:S[I]?.dataURL,drawing:S[I]?.drawing,color:N?P:void 0,erase:!!N&&B,ref:U,maxSizeInKb:g})})}),S.length>0&&e(hY,{children:"Loading Preview..."}),!N&&S[I]?.status>=qU.NONE&&t(mY,{children:[t(gY,{id:wS.generateId(h,"draw-button"),"data-testid":wS.generateId(h,"draw-button"),onClick:K,disabled:$,children:[e(yY,{$disabled:$}),e(AY,{weight:"semibold",$disabled:$,children:"Draw"})]}),t(gY,{id:wS.generateId(h,"delete-button"),"data-testid":wS.generateId(h,"delete-button"),onClick:()=>F("delete"),disabled:$,children:[e(_Y,{$disabled:$}),e(AY,{weight:"semibold",$disabled:$,children:"Delete"})]})]}),S[I]?.status<qU.NONE&&e(aY,{id:`${h}-photo-error`,image:S[I],accepts:i,maxSizeInKb:g,onClickOk:()=>V(!0),maxFilesErrorMessage:E,maxFiles:m})]}),e(bY,{className:c?`${c}-footer`:void 0,children:t(n,N?{children:[e(wY,{id:wS.generateId(h,"eraser-button"),"data-testid":wS.generateId(h,"eraser-button"),"aria-label":"eraser",onClick:Q,children:e(SY,{$eraseMode:B})}),e(xY,{children:zY.map(({color:t,colorScheme:n,label:r},i)=>e(MY,{id:wS.generateId(h,`palette-color-${i}`),"aria-label":`${r} brush`,$color:t,$colorScheme:n,onClick:()=>(e=>{J(),z(e)})(t),children:P===t&&e(CY,{$colorScheme:n})},t))})]}:{children:[e($Y,{id:`${h}-image-thumbnails`,activeFileIndex:I,accepts:i,capture:a,maxFiles:m,images:S,onClickThumbnail:D,onSelectFile:Y,multiple:b}),e(EY,{id:wS.generateId(h,"save-button"),"data-testid":wS.generateId(h,"save-button"),onClick:H,disabled:j,children:"Save"})]})}),e(oY,{images:S,show:k,onDecideClearDrawing:e=>{e&&U.current.clearDrawing(),F(null)},onDecideDelete:V,onDecideExit:e=>{e&&(C(S.filter(({addedFrom:e,status:t})=>t>=qU.UPLOADED||t<qU.NONE&&"dragInput"===e).map(e=>({...e,drawingDataURL:void 0,drawing:void 0}))),A()),F(null)}})]}):e(n,{})})})},ZY=y(()=>import("./index.f1de2e77.js")),UY=r=>{const{schema:{buttonLabel:i,capture:a,className:s,compress:c,crop:l,description:f,dimensions:p={width:1e3,height:1e3},editImage:h,label:m,outputType:g="jpg",uploadOnAddingFile:A,validation:y,multiple:v,imageReviewModalStyles:b,tooltip:E},id:w,error:S,isDirty:C,isTouched:x,value:M,warning:O}=r,{images:T,setImages:I,currentFileIds:D}=d(WU),N=VP(T),[L,k]=o([...KU]),[R,F]=o(0),[$,P]=o(0),[z,B]=o(!1),[Z,U]=o(!1),{setFieldValidationConfig:j}=UP(),{dispatchFieldEvent:G}=Y$(),Y=HP();u(()=>{G("mount",w)},[G,w]),u(()=>{if(!C&&!x){const e=Array.isArray(M)?M:[];if(!(BU(e.map(({fileId:e})=>e),D).length>0))return;const t=[];e.forEach(({fileId:e,fileName:n,dataURL:r,uploadResponse:i},a)=>{const o={id:e||Hg(),file:{},name:n,dimensions:{width:10,height:10},dataURL:r,status:qU.INJECTED,addedFrom:"schema",uploadProgress:100,slot:a,uploadResponse:i};t.push(o)}),I(t)}},[C,x,D,I,M]),u(()=>{const e=y?.find(e=>"required"in e),t=y?.find(e=>"fileType"in e),n=y?.find(e=>"maxSizeInKb"in e);t?.fileType&&t?.fileType!==L&&k(t?.fileType),n?.maxSizeInKb&&n?.maxSizeInKb!==$&&P(n?.maxSizeInKb);const r=y?.find(e=>"length"in e),i=y?.find(e=>"max"in e);let a;r?a={maxFiles:r.length,errorMessage:r.errorMessage}:i&&(a={maxFiles:i.max,errorMessage:i.errorMessage}),a?.maxFiles&&R!==a.maxFiles&&F(a.maxFiles),j(w,cI().of(sI().shape({fileName:VO(),dataURL:VO()})).test("is-empty-array",e?.errorMessage||Yg.UPLOAD("photo").REQUIRED,t=>!t||!e?.required||t.length>0).test("max-size-in-kb",n?.errorMessage||Yg.UPLOAD("photo").MAX_FILE_SIZE(n?.maxSizeInKb),e=>!(e&&Array.isArray(e)&&n?.maxSizeInKb)||e.every(e=>Gg.getFilesizeFromBase64(e.dataURL)<=1024*n?.maxSizeInKb)),y)},[y]),u(()=>{T.some(e=>e.status===qU.NONE)||(T.some((e,t)=>{const n=N?.[t];if(e.status!==n?.status||e.dataURL!==n.dataURL)switch(e.status){case qU.COMPRESSED:case qU.CONVERTED:if(h&&!Z)return Y()?U(!0):B(!0),!0}}),0===T.length&&U(!1))},[T.map(e=>e.status).join(","),T.map(e=>e.dataURL).join(",")]);const V=(e=!1)=>{e?h&&(document.body.classList.remove("lifesg-ds-overlay-open"),U(!0)):I(e=>e.map(e=>e.status<qU.UPLOAD_READY&&e.status>qU.NONE?{...e,status:qU.UPLOAD_READY}:e)),B(!1)};return t(n,{children:[e(_,{fallback:null,children:e(ZY,{accepts:L,compress:!!c,crop:!!l,dimensions:p,editImage:h,id:w,maxSizeInKb:$,outputType:g,upload:A,filenameMatches:y?.find(e=>"matches"in e)?.matches,filenameMatchesErrorMessage:y?.find(e=>"matches"in e)?.errorMessage,value:M})}),e(QG,{id:w,capture:a,className:s,label:m,description:f,buttonLabel:i,accepts:L,maxFiles:R,maxSizeInKb:$,dimensions:p,errorMessage:S?.message,validation:y,multiple:v,warning:O,tooltip:E}),e(xI,{id:`${w}-review-prompt`,title:"Review photos?",size:"large",show:z,description:"This lets you check if you've selected the correct photos, and draw on them to highlight the issue.",buttons:[{id:"ok",title:"Ok",onClick:()=>V(!0)},{id:"skip",title:"Skip",buttonStyle:"secondary",onClick:()=>V()}]}),(()=>{const t=y?.find(e=>"max"in e);return e(BY,{accepts:L,dimensions:p,id:w,className:s,maxFiles:R,maxFilesErrorMessage:t?.errorMessage,maxSizeInKb:$,onExit:()=>U(!1),outputType:g,show:Z,multiple:v,capture:a,imageReviewModalStyles:b})})()]})},jY=D`
|
|
1020
1020
|
border: ${E["width-010"]} ${E.solid} ${b["border-focus"]};
|
|
1021
1021
|
box-shadow: none;
|
|
1022
1022
|
`,GY=D`
|
|
@@ -1095,7 +1095,7 @@ object-assign
|
|
|
1095
1095
|
${e=>D`
|
|
1096
1096
|
margin-left: ${e.$readOnly?w["spacing-4"]:w["spacing-12"]};
|
|
1097
1097
|
`}
|
|
1098
|
-
`,KY=n=>{const{id:r,"data-testid":i,className:a,disabled:o,readOnly:s,onFocus:u,value:c,placeholder:l,error:d}=n;return t(VY,{id:r,"data-testid":i,type:"button",className:a,disabled:o,$readOnly:s,$error:d,onFocus:u,onClick:e=>{o||e.currentTarget.focus()},tabIndex:o?-1:0,"aria-disabled":o||void 0,"aria-haspopup":"dialog","aria-readonly":s,children:[e(WY,l&&!c?{$placeholder:!0,$disabled:o,children:l}:{$disabled:o,children:c}),e(HY,{$disabled:o,$readOnly:s,"aria-hidden":"true",children:e(fe,{})})]})},qY=t=>{const{id:n,label:r,className:i,locationInputPlaceholder:a="",onFocus:o,value:s,errorMessage:u,disabled:c,readOnly:l}=t;return e(X.CustomField,{id:wS.generateId(n,"location-input"),"data-testid":wS.generateId(n,"location-input"),label:r,errorMessage:u,children:e(KY,{id:wS.generateId(n,"location-input-base"),"data-testid":wS.generateId(n,"location-input-base"),disabled:c,readOnly:l,placeholder:a,onFocus:o,value:s,error:!!u,className:i})})},QY=y(()=>import("./location-modal.
|
|
1098
|
+
`,KY=n=>{const{id:r,"data-testid":i,className:a,disabled:o,readOnly:s,onFocus:u,value:c,placeholder:l,error:d}=n;return t(VY,{id:r,"data-testid":i,type:"button",className:a,disabled:o,$readOnly:s,$error:d,onFocus:u,onClick:e=>{o||e.currentTarget.focus()},tabIndex:o?-1:0,"aria-disabled":o||void 0,"aria-haspopup":"dialog","aria-readonly":s,children:[e(WY,l&&!c?{$placeholder:!0,$disabled:o,children:l}:{$disabled:o,children:c}),e(HY,{$disabled:o,$readOnly:s,"aria-hidden":"true",children:e(fe,{})})]})},qY=t=>{const{id:n,label:r,className:i,locationInputPlaceholder:a="",onFocus:o,value:s,errorMessage:u,disabled:c,readOnly:l}=t;return e(X.CustomField,{id:wS.generateId(n,"location-input"),"data-testid":wS.generateId(n,"location-input"),label:r,errorMessage:u,children:e(KY,{id:wS.generateId(n,"location-input-base"),"data-testid":wS.generateId(n,"location-input-base"),disabled:c,readOnly:l,placeholder:a,onFocus:o,value:s,error:!!u,className:i})})},QY=y(()=>import("./location-modal.1859f93a.js"));class JY extends Error{code;message;constructor(e){super(),Object.assign(this,e)}}var XY;!function(e){e.IS_EMAIL_VALID="is-email-valid",e.IS_PHONE_NUMBER_VALID="is-phone-number-valid",e.SEND_OTP_FAILED="send-otp-failed",e.OTP_VERIFICATION_FAILED="otp-verification-failed",e.IS_OTP_VERIFIED="is-otp-verified",e.API_ERROR="api"}(XY||(XY={}));const eV=I(T.BodyMD)`
|
|
1099
1099
|
cursor: ${e=>e.disabled?"not-allowed":"pointer"};
|
|
1100
1100
|
`,tV=I(he)`
|
|
1101
1101
|
margin-right: ${w["spacing-4"]};
|
|
@@ -1131,7 +1131,7 @@ object-assign
|
|
|
1131
1131
|
gap: ${w["spacing-16"]};
|
|
1132
1132
|
`,uV=I.div`
|
|
1133
1133
|
${({$color:e})=>e&&`color: ${e};`}
|
|
1134
|
-
`;var cV;!function(e){e.BUTTON="ButtonField",e.CHECKBOX="CheckboxGroup",e.CHIPS="Chips",e["CONTACT-FIELD"]="ContactField",e["DATE-FIELD"]="DateField",e["DATE-RANGE-FIELD"]="DateRangeField",e["EMAIL-FIELD"]="TextField",e["E-SIGNATURE-FIELD"]="ESignatureField",e["ERROR-FIELD"]="ErrorField",e["FILE-UPLOAD"]="FileUpload",e["HIDDEN-FIELD"]="HiddenField",e["HISTOGRAM-SLIDER"]="HistogramSlider",e["IMAGE-UPLOAD"]="ImageUpload",e["LOCATION-FIELD"]="LocationField",e["MASKED-FIELD"]="MaskedField",e["MULTI-SELECT"]="MultiSelect",e["NESTED-MULTI-SELECT"]="NestedMultiSelect",e["RANGE-SELECT"]="RangeSelect",e["NUMERIC-FIELD"]="TextField",e["OTP-VERIFICATION-FIELD"]="OtpVerificationField",e.RADIO="RadioButtonGroup",e.RESET="ResetButton",e.SELECT="Select",e["SELECT-HISTOGRAM"]="SelectHistogram",e.SLIDER="Slider",e.SUBMIT="SubmitButton",e.SWITCH="Switch",e.TEXTAREA="Textarea",e["TEXT-FIELD"]="TextField",e["TIME-FIELD"]="TimeField",e["UNIT-NUMBER-FIELD"]="UnitNumberField"}(cV||(cV={}));var lV=Object.freeze({__proto__:null,ButtonField:n=>{const{id:r,schema:i}=n,{commonSchema:{label:a},customSchema:{endIcon:o,href:s,startIcon:u,target:c,...l}}=YC(i),{dispatchFieldEvent:d}=Y$(),f=t=>{if(!t)return null;const n=Y[t];return e(n,{})};return t(Oz,{type:"button",...l,onClick:e=>{d("click",r,e),s&&(e=>{try{return!!new URL(e)}catch{return!1}})(s)&&(c?window.open(s,c,"noopener noreferrer"):window.location.href=s)},children:[f(u),a,f(o)]})},CheckboxGroup:r=>{const{formattedLabel:i,error:a,id:s,onChange:c,schema:l,value:d,warning:f}=r,{commonSchema:{customOptions:p,validation:h},customSchema:{className:m,disabled:g,options:A,...y}}=YC(l),{setValue:_}=He(),[v,b]=o(d||[]),{setFieldValidationConfig:E}=UP();u(()=>{const e=h?.find(e=>"required"in e);E(s,cI().of(VO()).test("is-empty-array",e?.errorMessage||Yg.COMMON.REQUIRED_OPTION,t=>!t||!e?.required||t.length>0),h)},[h]),Us(()=>{const e=d?.filter(e=>A.find(t=>t.value===e));_(s,e)},[A]),u(()=>{b(d||[])},[d]);const w=(e,t)=>{const n=A.find(e=>!0===e.none);let r=[...v];t?r=r.includes(e)?[]:[e]:r.includes(e)?r=Hz(r,e,n?.value):(r.push(e),r=Hz(r,n?.value)),c({target:{value:r}})},S=e=>v.includes(e),C=()=>{const e=Hg();return`${s}-${e}`},x=t=>"string"==typeof t?e(c$,{inline:!0,children:t}):e(mV,{children:t});return t(n,{children:[e(X.CustomField,{id:s,label:i,errorMessage:a?.message,children:e("div",{role:"group",children:"toggle"===p?.styleType?A.length>0&&"toggle"===p.styleType&&e(Jz,{$layoutType:p?.layoutType??"horizontal",className:m?`${m}-checkbox-container`:void 0,children:A.map((t,n)=>{const r=C();return e(Xz,{type:"checkbox","data-testid":wS.generateId(s,"toggle"),id:r,className:m,disabled:g??t.disabled,focusableWhenDisabled:g,name:r,indicator:p?.indicator,styleType:!1===p?.border?"no-border":"default",checked:S(t.value),onChange:()=>w(t.value,t.none),error:!!a?.message,compositeSection:t.children?{children:e(mV,{children:t.children}),collapsible:!1}:null,subLabel:!!t.subLabel&&x(t.subLabel),children:x(t.label)},n)})}):A.length>0&&A.map((n,r)=>{const i=C();return t(Qz,{className:m?`${m}-checkbox-container`:void 0,children:[e(qz,{...y,"data-testid":wS.generateId(s,"checkbox"),id:i,className:m,disabled:g??n.disabled,name:i,value:n.value,focusableWhenDisabled:g,checked:S(n.value),onChange:()=>w(n.value)}),e(Kz,{forwardedAs:"label",htmlFor:i,disabled:g??n.disabled,children:x(n.label)})]},r)})})}),e(b$,{id:s,message:f})]})},Chips:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:l,value:d,warning:f}=r,{commonSchema:{validation:p},customSchema:{disabled:h,options:m,textarea:g,...y}}=YC(l),[_,v]=o(d||[]),[b,E]=o(!1),[w,S]=o(!0),{setValue:C,unregister:x}=He(),{setFieldValidationConfig:M,removeFieldValidationConfig:O}=UP();u(()=>{b||x(I())},[]),u(()=>{const e=p?.find(e=>"required"in e),t=p?.find(e=>"max"in e),n=p?.find(e=>"length"in e);M(s,cI().of(VO()).test("is-empty-array",e?.errorMessage||Yg.COMMON.REQUIRED_OPTION,t=>!t||!e?.required||t.length>0),p),1!==t?.max&&1!==n?.length||S(!1)},[p]),Us(()=>{const e=[...m.map(e=>e.value),g?.label],t=d?.filter(t=>e.includes(t));C(s,t)},[m]),u(()=>{d?.includes(D())?N(!0):N(),v(d||[])},[d]);const T=e=>_.includes(e),I=()=>`${s}-textarea`,D=()=>"string"==typeof g?.label?g?.label:g?.label?.mainLabel,N=(e=!1)=>{E(e),e||O(I())},L=e=>{let t=[..._];if(t.includes(e))return t=t.filter(t=>t!==e),void c({target:{value:t}});w?t.push(e):t=[e],c({target:{value:t}})};return t(n,{children:[t(X.CustomField,{label:a,errorMessage:i?.message,children:[t(sB,{"data-testid":wS.generateId(s,"chips"),$showTextarea:b,children:[m.map((e,t)=>A(gI,{...y,key:t,onClick:()=>L(e.value),isActive:T(e.value),disabled:h??e.disabled},e.label)),(()=>{if(!g?.label)return;const t=D();return e(gI,{...y,onClick:()=>{L(t)},isActive:T(t),children:t})})()]}),(()=>{if(!g?.label)return e(n,{});const t=I(),r={uiType:"textarea",className:l.className?`${l.className}-textarea`:void 0,...g};return b?e(eB,{id:t,schema:r,Field:oB}):e(n,{})})()]}),e(b$,{id:s,message:f})]})},ContactField:r=>{const{isDirty:i,formattedLabel:a,error:s,id:c,onBlur:l,onChange:d,schema:f,value:p,warning:h}=r,{commonSchema:{validation:m},customSchema:{defaultCountry:g,disabled:A,enableSearch:y,placeholder:_,...v}}=YC(f),{resetField:b}=He(),[E,w]=o(p||""),S=VP(g),[C,x]=o(g),[M]=o((()=>{const e=new Map;return uB.forEach(t=>{const[n,...r]=t,i=r.find(e=>/^\d+$/.test(e));e.set(n,i)}),e})()),[O,T]=o(),[I,D]=o(),[N,L]=o(void 0),{setFieldValidationConfig:k}=UP();u(()=>{const e=m?.find(e=>"contactNumber"in e),t=e?.contactNumber?.singaporeNumber,n=e?.contactNumber?.internationalNumber,r=e?.errorMessage;M.has(n)?(x(n),L(!0)):["default","house","mobile"].includes(t)?(x("Singapore"),L(!0)):L(!1),D(t),k(c,VO().test("singaporeNumber",r||Yg.CONTACT.INVALID_SINGAPORE_NUMBER,e=>!e||!t||pU.isSingaporeNumber(e,t)).test("internationalNumber",r||Yg.CONTACT.INVALID_INTERNATIONAL_NUMBER,e=>!(e&&!t&&n)||pU.isInternationalNumber(O?.name,e)),m)},[m,O]),u(()=>{const e=C||"Singapore";T({name:e,prefix:M.get(e)})},[C,M]),u(()=>{const e=m?.find(e=>"contactNumber"in e),t=e?.contactNumber?.singaporeNumber,n=e?.contactNumber?.internationalNumber;!g||S===g||M.has(n)||["default","house","mobile"].includes(t)||x(g)},[m,g]),u(()=>{if(void 0!==N&&!i){const{prefix:e,number:t}=pU.getParsedPhoneNumber(p||""),n=e.replace(/\+/g,""),r=(e=>{for(const[t,,,n]of uB)if(t===e)return n})(C||"Singapore");if(!N||N&&n===r){const n=R({countryCode:e||r,number:t});b(c,{defaultValue:n,keepDirty:!0})}else{const e=R({countryCode:"",number:""});b(c,{defaultValue:e,keepDirty:!0})}}},[p,i,N,C]);const R=e=>{const{countryCode:t,number:n}=e,r=t.replace(/\+/g,"");if(!1===N&&r!==O?.prefix){const e=((e,t)=>{for(const[n,r]of t.entries())if(r===e)return n})(r,M);e&&T({name:e,prefix:t})}return w(n),pU.formatPhoneNumber(e.countryCode,e.number)||""};return t(n,{children:[e(X.PhoneNumberInput,{...v,"data-testid":wS.generateId(c,"contact"),disabled:A,enableSearch:y,errorMessage:s?.message,fixedCountry:N,id:c,label:a,placeholder:(()=>{if(_)return _;if(I){return`Enter ${"mobile"===I?"mobile":"home"} number`}return"Enter contact number"})(),value:(()=>{if(!O)return;const{prefix:e}=O;return{number:E,countryCode:e}})(),onBlur:l,onChange:e=>{const t=R(e);d({target:{value:t}})}}),e(b$,{id:c,message:h})]})},DateField:r=>{const{error:i,formattedLabel:a,id:s,isDirty:c,onBlur:l,onChange:d,schema:f,value:p,warning:h}=r,{commonSchema:{validation:m},customSchema:{useCurrentDate:g,dateFormat:A=hU,...y}}=YC(f),{setValue:_}=He(),[v,b]=o(p||""),[E,w]=o(),{setFieldValidationConfig:S}=UP();u(()=>{const e=m?.find(e=>"dateFormat"in e&&e.dateFormat),t=m?.find(e=>"future"in e),n=m?.find(e=>"past"in e),r=m?.find(e=>"notFuture"in e),i=m?.find(e=>"notPast"in e),a=m?.find(e=>"minDate"in e),o=m?.find(e=>"maxDate"in e),u=m?.find(e=>"excludedDates"in e),c=m?.find(e=>"withinDays"in e),l=m?.find(e=>"beyondDays"in e),d=Vg.toLocalDateOrTime(a?.minDate,A,"date"),f=Vg.toLocalDateOrTime(o?.maxDate,A,"date");S(s,VO().test("is-date",e?.errorMessage||Yg.DATE.INVALID,e=>!e||""===e||!!M(e)&&!!Vg.toLocalDateOrTime(e,A,"date")).test("future",t?.errorMessage||Yg.DATE.MUST_BE_FUTURE,e=>{if(!M(e)||!t?.future)return!0;const n=Vg.toLocalDateOrTime(e,A,"date");return!!n?.isAfter(Wf.now())}).test("past",n?.errorMessage||Yg.DATE.MUST_BE_PAST,e=>{if(!M(e)||!n?.past)return!0;const t=Vg.toLocalDateOrTime(e,A,"date");return!!t?.isBefore(Wf.now())}).test("not-future",r?.errorMessage||Yg.DATE.CANNOT_BE_FUTURE,e=>{if(!M(e)||!r?.notFuture)return!0;const t=Vg.toLocalDateOrTime(e,A,"date");return!t?.isAfter(Wf.now())}).test("not-past",i?.errorMessage||Yg.DATE.CANNOT_BE_PAST,e=>{if(!M(e)||!i?.notPast)return!0;const t=Vg.toLocalDateOrTime(e,A,"date");return!t?.isBefore(Wf.now())}).test("min-date",a?.errorMessage||Yg.DATE.MIN_DATE(Vg.formatDateTime(a?.minDate,"dd/MM/uuuu","date")),e=>{if(!M(e)||!d)return!0;const t=Vg.toLocalDateOrTime(e,A,"date");return!t?.isBefore(d)}).test("max-date",o?.errorMessage||Yg.DATE.MAX_DATE(Vg.formatDateTime(o?.maxDate,"dd/MM/uuuu","date")),e=>{if(!M(e)||!f)return!0;const t=Vg.toLocalDateOrTime(e,A,"date");return!t?.isAfter(f)}).test("excluded-dates",u?.errorMessage||Yg.DATE.DISABLED_DATES,e=>!M(e)||!u||!u.excludedDates.includes(e)).test("within-days",c?.errorMessage||c?.withinDays&&Yg.DATE.WITHIN_DAYS(c?.withinDays),e=>!M(e)||!c||Vg.checkWithinDays(e,{...c.withinDays,dateFormat:A})).test("beyond-days",l?.errorMessage||l?.beyondDays&&Yg.DATE.BEYOND_DAYS(l?.beyondDays),e=>!M(e)||!l||Vg.checkBeyondDays(e,{...l.beyondDays,dateFormat:A})),m);const p=c?.withinDays&&Vg.calculateDisabledWithinDaysRange({...c.withinDays,dateFormat:A}),h=l?.beyondDays&&Vg.calculateDisabledBeyondDaysRange({...l.beyondDays,dateFormat:A}),g=x([d,t?.future&&Wf.now().plusDays(1),i?.notPast&&Wf.now(),p?.startDate,h?.startDate]),y=C([f,n?.past&&Wf.now().minusDays(1),r?.notFuture&&Wf.now(),p?.endDate,h?.endDate]),_=[...u?.excludedDates||[]];(g||y||_)&&w(e=>({...e,minDate:g?.format(mU),maxDate:y?.format(mU),disabledDates:_}))},[m]),u(()=>{if(A)if(p)if(M(p)){const e=Vg.toLocalDateOrTime(p,A,"date");b(Vg.formatDateTime(e?.toString(),hU,"date",Yg.DATE.INVALID))}else b(Yg.DATE.INVALID);else if(!c)if(g){const e=Vg.formatDateTime(Wf.now().toString(),A,"date");_(s,e);const t=Vg.formatDateTime(Wf.now().toString(),hU,"date");b(t)}else b(void 0)},[g,p,A,c]);const C=e=>e.filter(e=>e).sort((e,t)=>e.isAfter(t)?1:-1)?.[0],x=e=>e.filter(e=>e).sort((e,t)=>e.isBefore(t)?1:-1)?.[0],M=e=>e&&e!==Yg.DATE.INVALID;return t(n,{children:[e(X.DateInput,{...y,...E,id:s,"data-testid":wS.generateId(s,"date"),label:a,errorMessage:i?.message,onBlur:l,onChange:e=>{d({target:{value:Vg.formatDateTime(e,A,"date",Yg.DATE.INVALID)}})},value:v}),e(b$,{id:s,message:h})]})},DateRangeField:r=>{const{error:i,formattedLabel:a,id:s,isDirty:c,onBlur:l,onChange:d,schema:f,value:p={from:void 0,to:void 0},warning:h}=r,{commonSchema:{validation:m},customSchema:{dateFormat:g=AU,variant:A,...y}}=YC(f),[_,v]=o(p.from||""),[b,E]=o(p.to||""),[w,S]=o(),{setFieldValidationConfig:C}=UP(),[x,M]=o([]);Us(()=>{C(s,sI().shape({from:VO(),to:VO()}).test({name:"is-empty-string",test(e,t){M(t.schema.describe().meta?.rules??[]);const n=N(t.schema.describe().meta?.rules,"required");if(!e||!n)return!0;return!!(e.from?.length>0&&e.to?.length>0)||t.createError({message:n?.errorMessage??Yg.DATE_RANGE.REQUIRED})}}).test({name:"is-date",test(e,t){const n=m?.find(e=>!!e&&"dateFormat"in e&&e.dateFormat);if(l$.exports.isEmpty(e?.from)||l$.exports.isEmpty(e?.to))return!0;return!(!I(e.from)||!I(e.to)||!Vg.toLocalDateOrTime(e.from,g,"date")||!Vg.toLocalDateOrTime(e.to,g,"date"))||t.createError({message:n?.errorMessage||Yg.DATE_RANGE.INVALID})}}).test({name:"number-of-days",test(e,t){if("week"===A)return!0;const n=N(t.schema.describe().meta?.rules,"numberOfDays"),r=n?.numberOfDays;if(!I(e.from)||!I(e.to)||!r)return!0;const i=Vg.toLocalDateOrTime(e.from,g,"date");return!!Vg.toLocalDateOrTime(e.to,g,"date").equals(i.plusDays(r-1))||t.createError({message:n?.errorMessage??Yg.DATE_RANGE.MUST_HAVE_NUMBER_OF_DAYS(r)})}}).test({name:"future",test(e,t){if("week"===A)return!0;const n=N(t.schema.describe().meta?.rules,"future");if(!I(e.from)||!I(e.to)||!n)return!0;const r=Vg.toLocalDateOrTime(e.from,g,"date"),i=Vg.toLocalDateOrTime(e.to,g,"date");return!(!r?.isAfter(Wf.now())||!i?.isAfter(Wf.now()))||t.createError({message:n?.errorMessage??Yg.DATE_RANGE.MUST_BE_FUTURE})}}).test({name:"past",test(e,t){if("week"===A)return!0;const n=N(t.schema.describe().meta?.rules,"past");if(!I(e.from)||!I(e.to)||!n)return!0;const r=Vg.toLocalDateOrTime(e.from,g,"date"),i=Vg.toLocalDateOrTime(e.to,g,"date");return!(!r?.isBefore(Wf.now())||!i?.isBefore(Wf.now()))||t.createError({message:n?.errorMessage??Yg.DATE_RANGE.MUST_BE_PAST})}}).test({name:"not-future",test(e,t){if("week"===A)return!0;const n=N(t.schema.describe().meta?.rules,"notFuture");if(!I(e.from)||!I(e.to)||!n)return!0;const r=Vg.toLocalDateOrTime(e.from,g,"date"),i=Vg.toLocalDateOrTime(e.to,g,"date");return!(r?.isAfter(Wf.now())||i?.isAfter(Wf.now()))||t.createError({message:n?.errorMessage??Yg.DATE_RANGE.CANNOT_BE_FUTURE})}}).test({name:"not-past",test(e,t){if("week"===A)return!0;const n=N(t.schema.describe().meta?.rules,"notPast");if(!I(e.from)||!I(e.to)||!n)return!0;const r=Vg.toLocalDateOrTime(e.from,g,"date"),i=Vg.toLocalDateOrTime(e.to,g,"date");return!(r?.isBefore(Wf.now())||i?.isBefore(Wf.now()))||t.createError({message:n?.errorMessage??Yg.DATE_RANGE.CANNOT_BE_PAST})}}).test({name:"min-date",test(e,t){if("week"===A)return!0;const n=N(t.schema.describe().meta?.rules,"minDate"),r=n?.minDate,i=r?Vg.toLocalDateOrTime(r,g,"date"):void 0;if(!I(e.from)||!I(e.to)||!i)return!0;const a=Vg.toLocalDateOrTime(e.from,g,"date"),o=Vg.toLocalDateOrTime(e.to,g,"date");return!(a?.isBefore(i)||o?.isBefore(i))||t.createError({message:n?.errorMessage??Yg.DATE_RANGE.MIN_DATE(Vg.formatDateTime(r,"dd/MM/uuuu","date"))})}}).test({name:"max-date",test(e,t){if("week"===A)return!0;const n=N(t.schema.describe().meta?.rules,"maxDate"),r=n?.maxDate,i=r?Vg.toLocalDateOrTime(r,g,"date"):void 0;if(!I(e.from)||!I(e.to)||!i)return!0;const a=Vg.toLocalDateOrTime(e.from,g,"date"),o=Vg.toLocalDateOrTime(e.to,g,"date");return!(a?.isAfter(i)||o?.isAfter(i))||t.createError({message:n?.errorMessage??Yg.DATE_RANGE.MAX_DATE(Vg.formatDateTime(r,"dd/MM/uuuu","date"))})}}).test({name:"excluded-dates",test(e,t){if("week"===A)return!0;const n=N(t.schema.describe().meta?.rules,"excludedDates"),r=n?.excludedDates;if(!I(e.from)||!I(e.to)||!r)return!0;const i=Vg.toLocalDateOrTime(e.from,g,"date"),a=Vg.toLocalDateOrTime(e.to,g,"date");try{const e=r.map(e=>Vg.toLocalDateOrTime(e,g,"date"));for(const r of e)if(i.isEqual(r)||a.isEqual(r))return t.createError({message:n?.errorMessage??Yg.DATE_RANGE.DISABLED_DATES});return!0}catch{return!1}}}),m);const e=N(x,"future"),t=N(x,"past"),n=N(x,"notFuture"),r=N(x,"notPast"),i=N(x,"minDate"),a=N(x,"maxDate"),o=N(x,"excludedDates"),u=N(x,"numberOfDays"),c=Vg.toLocalDateOrTime(i?.minDate,g,"date"),l=Vg.toLocalDateOrTime(a?.maxDate,g,"date"),d=T([c,e?.future&&Wf.now().plusDays(1),r?.notPast&&Wf.now()]),f=O([l,t?.past&&Wf.now().minusDays(1),n?.notFuture&&Wf.now()]),p=o?.excludedDates,h=u?.numberOfDays;S(e=>({...e,minDate:d?.format(yU),maxDate:f?.format(yU),disabledDates:p,numberOfDays:h}))},[m,x]),u(()=>{D(gU.START)},[p.from,g,c]),u(()=>{D(gU.END)},[p.to,g,c]);const O=e=>e.filter(e=>e).sort((e,t)=>e.isAfter(t)?1:-1)?.[0],T=e=>e.filter(e=>e).sort((e,t)=>e.isBefore(t)?1:-1)?.[0],I=e=>e&&e!==Yg.DATE_RANGE.INVALID,D=e=>{const t=e===gU.START?p.from:p.to,n=e===gU.START?v:E;if(g)if(t)if(I(t)){const e=Vg.toLocalDateOrTime(t,g,"date");n(Vg.formatDateTime(e?.toString(),AU,"date",Yg.DATE_RANGE.INVALID))}else n(Yg.DATE_RANGE.INVALID);else c||n(void 0)},N=(e,t)=>{const n=e?.find(e=>t in e),r=m?.find(e=>!!e&&t in e);return l$.exports.isEmpty(n)?l$.exports.isEmpty(r)?void 0:r:n};return t(n,{children:[e(X.DateRangeInput,{...y,...w,id:s,"data-testid":wS.generateId(s,"date"),label:a,errorMessage:i?.message,onBlur:l,onChange:(e,t)=>{d({target:{value:{from:Vg.formatDateTime(e,g,"date",Yg.DATE_RANGE.INVALID),to:Vg.formatDateTime(t,g,"date",Yg.DATE_RANGE.INVALID)}}})},value:_,valueEnd:b,variant:A}),e(b$,{id:s,message:h})]})},get TDateRangeInputType(){return gU},ESignatureField:n=>{const{error:r,formattedLabel:i,id:a,onChange:c,schema:{label:l,uiType:d,upload:f,validation:p,...h},value:m,warning:g}=n,[A,y]=o(null),[_,v]=o(0),[b,E]=o(0),[w,S]=o(null),{setFieldValidationConfig:C}=UP(),x=s(null),{clearErrors:M}=He();u(()=>{const e=p?.find(e=>"upload"in e&&e.upload);x.current=e,C(a,sI().shape({fileId:VO().required(),dataURL:VO(),fileUrl:VO(),uploadResponse:$O().nullable()}).default(void 0),p)},[p]),u(()=>{if(E(0),T(m)){if(m.dataURL)y(m.dataURL);else if(m.fileUrl){const e=D(m.fileId,m.fileUrl);return()=>e.abort()}}else y(null)},[m]);const O=async e=>{if(!e)return y(null),E(0),v(0),S(null),void c({target:{value:null}});const t=Hg();if(y(e),E(0),bS(f))c({target:{value:{fileId:t,dataURL:e}}});else try{const n=await I(t,e);c({target:{value:{fileId:t,..."base64"===f.type&&{dataURL:e},fileUrl:n?.data?.fileUrl,uploadResponse:n}}}),M(a),v(0)}catch(e){v(e=>e+1),S(null)}},T=e=>!!e,I=async(e,t)=>{S(0);const n=new FormData;if(n.append("fileId",e),f.sessionId&&n.append("sessionId",f.sessionId),"base64"===f.type)n.append("dataURL",t);else if("multipart"===f.type){const r=await Gg.dataUrlToBlob(t),i=Gg.blobToFile(r,{name:e,lastModified:Date.now()});n.append("file",i,e)}const r=await new zl("",void 0,void 0,!0).post(f.url,n,{headers:{"Content-Type":"base64"===f.type?"application/json":"multipart/form-data",...f.headers},onUploadProgress:e=>{const{loaded:t,total:n}=e;S(t/n)}});return S(null),r},D=(e,t)=>{const n=new AbortController;return(async()=>{try{const r=await new zl("",void 0,void 0,!1,{responseType:"blob"}).get(t,{signal:n.signal}),i=await Gg.getType(new File([r],e)),a=new File([r],e,{type:i.mime}),o=await Gg.fileToDataUrl(a);y(o),E(0)}catch(e){if(e instanceof El)return;E(e=>e+1)}})(),n};return t(_U,{children:[e(X.ESignature,{...h,id:a,label:i,onChange:O,value:A,...null!==w&&{loadingProgress:w}}),(r?.message||_||b)&&null===w?_>0?t(vU,{children:[e(ne,{}),t("span",{children:[x.current?.errorMessage||Yg.ESIGNATURE.UPLOAD,e(bU,{type:"button",onClick:()=>O(A),children:"Please try again."})]}),_>=3&&e(EU,{type:"warning","data-testid":"upload-refresh-alert",children:"Refresh this page if you cannot upload your signature."})]}):b>0&&T(m)?t(vU,{children:[e(ne,{}),t("span",{children:["Failed to load.",e(bU,{type:"button",onClick:()=>D(m.fileId,m.fileUrl),children:"Please try again."})]}),b>=3&&e(EU,{type:"warning","data-testid":"load-refresh-alert",children:"Refresh this page if your signature failed to load."})]}):t(vU,{children:[e(ne,{}),e("span",{children:r?.message})]}):null,e(b$,{id:a,message:g})]})},ErrorField:t=>{const{id:n,schema:{children:r}}=t,{setFieldValidationConfig:i}=UP();return u(()=>{i(n,$O().test(()=>!1),[])},[]),r?e(mV,{children:r}):null},FileUploadInner:VU,FileUpload:t=>e(UU,{children:e(VU,{...t})}),get EFileStatus(){return GU},HiddenField:t=>{const{id:n,name:r,onBlur:i,onChange:a,schema:{showIf:o,uiType:s,validation:c,valueType:l,value:d,...f},value:p}=t,{setFieldValidationConfig:h}=UP(),{setValue:m}=He();return u(()=>{let e;switch(l){case"null":e=$O();break;case"number":e=HO();break;case"boolean":e=zO();break;default:e=VO()}h(n,e,c)},[c,l]),u(()=>{"null"===l&&null!==p?m(n,null):SS(d)||p===d||m(n,d)},[m,n,l,d,p]),e("input",{onBlur:i,onChange:a,...f,type:"hidden",id:n,"data-testid":n,name:r,value:d??p??""})},HistogramSlider:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{label:d,bins:f,interval:p,validation:h,disabled:m,readOnly:g,className:A,ariaLabels:y,customOptions:_},value:v,warning:b}=r,{resetField:E}=He(),[w,S]=o(void 0),{setFieldValidationConfig:C}=UP(),x=l(()=>Math.min(...f.map(e=>e.minValue)),[f]),M=l(()=>Math.max(...f.map(e=>e.minValue))+p,[f,p]);u(()=>{v?S((e=>["number"==typeof e?.from?e.from:x,"number"==typeof e?.to?e.to:M])(v)):(E(s,{defaultValue:{from:x,to:M},keepDirty:!0}),S([x,M]))},[v]),u(()=>{const e=h?.find(e=>"required"in e),t=h?.find(e=>"bin"in e&&e.bin),n=h?.find(e=>"incremental"in e&&e.incremental),r=h?.find(e=>"withinRange"in e&&e.withinRange);C(s,sI({from:HO(),to:HO()}).test("is-required",e?.errorMessage||Yg.COMMON.REQUIRED_OPTIONS,t=>!t||!e||!SS(t.from)&&!SS(t.to)).test("is-bin",t?.errorMessage||Yg.SLIDER.MUST_BE_INCREMENTAL,e=>{if(!e||"number"!=typeof e.from||"number"!=typeof e.to)return!0;const{from:t,to:n}=e,r=Math.min(...f.map(e=>e.minValue));return Number.isInteger((t-r)/p)&&Number.isInteger((n-r)/p)}).test("is-incremental",n?.errorMessage||Yg.SLIDER.MUST_BE_INCREMENTAL,e=>!e||"number"!=typeof e.from||"number"!=typeof e.to||e.from<e.to).test("is-within-range",r?.errorMessage||Yg.SLIDER.MUST_BE_INCREMENTAL,e=>{if(!e||"number"!=typeof e.from||"number"!=typeof e.to)return!0;const{from:t,to:n}=e,r=Math.min(...f.map(e=>e.minValue)),i=Math.max(...f.map(e=>e.minValue))+p;return!(t<r||n>i)}),h)},[h,f,p]);return t(n,{children:[e(X.HistogramSlider,{..._,id:s,"data-testid":wS.generateId(s,"histogram-slider"),label:a,errorMessage:i?.message,onChangeEnd:e=>{const[t,n]=e;c({target:{value:{from:t,to:n}}})},value:w,bins:f,interval:p,disabled:m,readOnly:g,className:A,ariaLabels:y}),e(b$,{id:s,message:b})]})},ImageUploadInner:UY,ImageUpload:t=>e(HU,{children:e(UY,{...t})}),ACCEPTED_FILE_TYPES:qU,get EImageStatus(){return QU},LocationField:n=>{const{error:r,formattedLabel:i,id:a,schema:{className:s="location",mapApi:c,disabled:l,gettingCurrentLocationFetchMessage:d,interactiveMapPinIconUrl:f,label:p,locationInputPlaceholder:h,locationListTitle:m,locationModalStyles:g,mapBannerText:A,mapPanZoom:y,mustHavePostalCode:v,readOnly:b,staticMapPinColor:E,validation:w,hasExplicitEdit:S,locationSelectionMode:C="default",disableSearch:x,addressFieldPlaceholder:M,searchBarIcon:O,bufferRadius:T,pinsOnlyIndicateCurrentLocation:I,legendItems:D,defaultAddress:N},value:L,warning:R}=n,[F,$]=o(!1),{setValue:P}=He(),{setFieldValidationConfig:z}=UP(),{dispatchFieldEvent:B,addFieldEventListener:Z,removeFieldEventListener:U}=Y$();u(()=>(Z("show-location-modal",a,Y),B("show-location-modal-ready",a),()=>{U("show-location-modal",a,Y)}),[]),u(()=>{const e=w?.find(e=>"required"in e),t=w?.find(e=>"postalCode"in e);z(a,sI({address:VO(),blockNo:VO(),building:VO(),lat:HO(),lng:HO(),postalCode:VO(),roadName:VO(),x:HO(),y:HO()}).test("is-required",e?.errorMessage||Yg.COMMON.FIELD_REQUIRED,t=>!e?.required||!!t&&!!t.lat&&!!t.lng).test("must-have-postal-code",t?.errorMessage||Yg.LOCATION.MUST_HAVE_POSTAL_CODE,t=>!e||!v||m$.hasGotAddressValue(t.postalCode)),w)},[w]);const j=(e,t=!0)=>{P(a,e,{shouldDirty:t})},G=()=>{b||l||($(!0),B("show-location-modal",a))},Y=()=>{$(!0)};return t("div",{id:a,"data-testid":wS.generateId(a),className:s,children:[e(qY,{id:a,label:i,className:s,locationInputPlaceholder:h,onChange:e=>e.currentTarget.blur(),onFocus:G,value:L?.address||"",errorMessage:r?.message,disabled:"explicit"===S&&!!L?.address||l,readOnly:b}),S&&L?.address&&e(k.Default,{id:wS.generateId(a,"edit-button"),"data-testid":wS.generateId(a,"edit-button"),styleType:"secondary",onClick:()=>{!B("click-edit-button",a)||$(!0)},type:"button",children:"Edit"}),!!L?.lat&&!!L?.lng&&e(v$,{id:a,className:`${s}-static-map`,lat:L.lat,lng:L.lng,staticMapPinColor:E,onClick:G,disabled:l}),e(_,{fallback:null,children:QY&&e(QY,{id:a,className:s,showLocationModal:F,onClose:()=>{$(!1),B("hide-location-modal",a)},formValues:L,onConfirm:j,updateFormValues:j,mapPanZoom:y,mapApi:c,interactiveMapPinIconUrl:f,gettingCurrentLocationFetchMessage:d,mustHavePostalCode:v,locationModalStyles:g,locationListTitle:m,mapBannerText:A,locationSelectionMode:C,disableSearch:x,addressFieldPlaceholder:M,searchBarIcon:O,bufferRadius:T,pinsOnlyIndicateCurrentLocation:I,legendItems:D,defaultAddress:N})}),e(b$,{id:a,message:R})]})},GeolocationPositionErrorWrapper:JY,MaskedField:r=>{const{error:i,formattedLabel:a,id:s,onBlur:c,onChange:l,value:d,schema:{label:f,uiType:p,validation:h,maskRegex:m,iconMask:g,iconUnmask:A,...y},warning:_}=r,[v,b]=o(d||""),[E,w]=o({}),{setFieldValidationConfig:S}=UP();u(()=>{S(s,VO(),h);const e=h?.find(e=>"max"in e),t=h?.find(e=>"length"in e),n={...E};e?.max>0?n.maxLength=e.max:t?.length>0&&(n.maxLength=t.length),w(n)},[h]),u(()=>{d!==v&&b(d||"")},[d]);const C=t=>{if(!t)return;const n=Y[t];return e(n,{"data-testid":t})};return t(n,{children:[e(X.MaskedInput,{...y,...E,id:s,"data-testid":wS.generateId(s,p),label:a,onBlur:c,onChange:e=>{l(e)},value:v,errorMessage:i?.message,maskRegex:(()=>{if(m)try{const e=m.match(/\/(.*)\/([a-z]+)?/);return new RegExp(e[1],e[2])}catch(e){console.warn(`invalid regex pattern: ${m}`)}})(),iconMask:C(g),iconUnmask:C(A)}),e(b$,{id:s,message:_})]})},MultiSelect:r=>{const{error:i,formattedLabel:a,id:s,onBlur:c,onChange:l,schema:d,value:f,warning:p}=r,{commonSchema:{validation:h},customSchema:{options:m=[],...g}}=YC(d),{setValue:A}=He(),[y,_]=o(f||[]),{setFieldValidationConfig:v}=UP();u(()=>{const e=h?.find(e=>"required"in e);v(s,cI().of(VO()).test("is-empty-array",e?.errorMessage||Yg.COMMON.REQUIRED_OPTION,t=>!t||!e?.required||t.length>0),h)},[h]),js(()=>{const e=f?.filter(e=>m.find(t=>t.value===e));A(s,e)},[m]),u(()=>{_(f||[])},[f]);return t(n,{children:[e(X.MultiSelect,{...g,id:s,"data-testid":wS.generateId(s),label:a,options:m,onBlur:c,onSelectOptions:e=>{const t=e.map(e=>e.value);l({target:{value:t}})},selectedOptions:m.filter(e=>y.includes(e.value)),valueExtractor:e=>e.value,listExtractor:e=>e.label,errorMessage:i?.message}),e(b$,{id:s,message:p})]})},OtpVerificationField:r=>{const{error:i,id:a,value:c,formattedLabel:l,onChange:d,warning:f,schema:{validation:p,request:h,verification:m,withPrefix:g,verifyOtpCountdownTimer:A,prefixSeparator:y,type:_,...v}}=r,[b,E]=o(c?.otpCode||""),[w,S]=o(c?.otpPrefix),C=s(c?.transactionId),x=s(-1),M=s(-1),O=c?.state||"default",T=c?.contact||"",I={number:"phone-number"===_?T:"",countryCode:"+65"},D=p?.find(e=>"otp-type"in e),N=p?.find(e=>"required"in e),{setFieldValidationConfig:L}=UP(),{formState:k,setError:R,clearErrors:F}=He(),{submitCount:$}=k;u(()=>{L(a,sI().test(XY.IS_OTP_VERIFIED,N?.errorMessage||z(),e=>!N?.required||"verified"===e?.state),p)},[p,O]);const P=async()=>{const e=D?.["otp-type"]??void 0;if("email"===e&&(t=T,!VO().required().email().isValidSync(t)))throw R(a,{type:XY.IS_EMAIL_VALID,message:D?.errorMessage||Yg.OTP_VERIFICATION.INVALID_EMAIL}),new Error;var t;const n=`${I.countryCode}${I.number}`;if("phone-number"===e&&!(e=>pU.isSingaporeNumber(e))(n))throw R(a,{type:XY.IS_PHONE_NUMBER_VALID,message:D?.errorMessage||Yg.OTP_VERIFICATION.INVALID_PHONE}),new Error;const r={type:_,..."email"===_?{email:T}:{phoneNo:n},...void 0!==g&&{withPrefix:g}},i=await new zl("",void 0,void 0,!0).post(h.endpoint.url,r).catch(e=>{const t=e?.message||Yg.OTP_VERIFICATION.SEND_OTP_FAILED;throw R(a,{type:XY.SEND_OTP_FAILED,message:t}),new Error(t)}),o=i?.transactionId??i?.data?.transactionId,s=i?.prefix??i?.data?.prefix;C.current=o,s&&S(s),F(a),x.current=$,d({target:{value:{contact:"email"===e?T:I.number,otpPrefix:s??w,type:_,state:"sent"}}})},z=()=>"default"===O?"email"===_?Yg.OTP_VERIFICATION.EMAIL_VERIFICATION_REQUIRED:Yg.OTP_VERIFICATION.PHONE_VERIFICATION_REQUIRED:"sent"===O?Yg.OTP_VERIFICATION.OTP_REQUIRED:void 0,B={...v,id:a,"data-testid":wS.generateId(a,"otp-verification-field"),label:l,otpState:O,onOtpStateChange:e=>{"default"===e&&(E(""),S(void 0),C.current=void 0,d({target:{value:{...c,state:void 0,additionalData:void 0,otpPrefix:void 0}}}))},onSendOtp:P,onResendOtp:P,onVerifyOtp:async e=>{const t="email"===_?T:I.number,n=await new zl("",void 0,void 0,!0).post(m.endpoint.url,{transactionId:C.current,otp:e,otpPrefix:w}).catch(e=>{const t=e?.message||Yg.OTP_VERIFICATION.OTP_VERIFICATION_FAILED;throw R(a,{type:XY.OTP_VERIFICATION_FAILED,message:t}),new Error(t)});d({target:{value:{contact:t,otpPrefix:w,type:_,state:"verified",additionalData:n?.additionalData??n?.data?.additionalData}}})},sendOtpError:(()=>{if("sent"===O)return;if(i?.type===XY.IS_EMAIL_VALID||i?.type===XY.IS_PHONE_NUMBER_VALID||i?.type===XY.SEND_OTP_FAILED)return i?.message;return k.isSubmitted&&$>M.current&&i?.type===XY.IS_OTP_VERIFIED?i?.message:void 0})(),verifyOtpError:(()=>{if("sent"!==O)return;return i?.type===XY.IS_OTP_VERIFIED&&$>x.current||i?.type===XY.OTP_VERIFICATION_FAILED||i?.type===XY.API_ERROR?i?.message:void 0})(),otpValue:{value:b,...w&&{prefix:w},...y&&{prefixSeparator:y}},onOtpChange:e=>{F(a),E(e)},...void 0!==h.placeholder&&{sendOtpPlaceholder:h.placeholder},...void 0!==A&&{verifyOtpCountdownTimer:A},...void 0!==m.showThumbnail&&{showVerifyOtpThumbnail:m.showThumbnail},...void 0!==m.title&&{verifyOtpTitle:m.title},...void 0!==m.message&&{verifyOtpMessage:m.message}};return t(n,{children:[e(X.OtpVerification,"email"===_?{...B,type:"email",emailValue:T,onEmailChange:e=>{M.current=$,F(a),d({target:{value:{...c,contact:e}}})}}:{...B,type:"phone-number",phoneNumberValue:I,onPhoneNumberChange:e=>{M.current=$,F(a);let t=e.number;e.number||(t=""),d({target:{value:{...c,contact:t}}})},fixedCountry:!0}),e(b$,{id:a,message:f})]})},get EOtpVerificationErrorType(){return XY},NestedMultiSelect:r=>{const{schema:{label:i,validation:a,options:s=[],...c},id:l,value:d,formattedLabel:p,onChange:h,onBlur:m,error:g,warning:A}=r,{setValue:y}=He(),{setFieldValidationConfig:_}=UP(),[v,b]=o(d),[E,w]=o([]),S=f(e=>{const t=[],n=(e,r)=>{for(const i in e){const a=[...r,i],o=e[i];"string"==typeof o?t.push(a):n(o,a)}};return n(e,[]),t},[]);u(()=>{const e=a?.find(e=>"required"in e);_(l,sI().test("is-required",e?.errorMessage||Yg.COMMON.REQUIRED_OPTION,t=>!e?.required||!!t&&!!Object.keys(t).length),a)},[a]),js(()=>{const e=(t,n)=>{const r={};for(const i of t){const{key:t,subItems:a}=i,o=n[t];if(o){const n="string"==typeof o?o:e(a||[],o);Object.keys(n).length?r[t]=n:delete r[t]}}return r},t=d?e(s,d):d;y(l,t)},[s]),u(()=>{b(d);const e=S(d);w(e)},[S,v,d]);return t(n,{children:[e(X.NestedMultiSelect,{...c,id:l,"data-testid":wS.generateId(l),label:p,options:s,onSelectOptions:(e,t)=>{const n=((e,t)=>{const n={};return e.forEach((e,r)=>{e.reduce((n,i,a)=>(a===e.length-1?n[i]=t[r]:n[i]||(n[i]={}),n[i]),n)}),n})(e,t);h({target:{value:n}})},onBlur:m,selectedKeyPaths:E,errorMessage:g?.message}),e(b$,{id:l,message:A})]})},RadioButtonGroup:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:l,value:d,warning:f}=r,{commonSchema:{customOptions:p,validation:h},customSchema:{className:m,disabled:g,options:y,..._}}=YC(l),{setValue:v}=He(),[b,E]=o(d||""),{setFieldValidationConfig:w}=UP();u(()=>{w(s,VO(),h)},[h]),Us(()=>{y.find(e=>e.value===d)||v(s,"")},[y]),u(()=>{E(d||"")},[d]);const S=e=>{c({target:{value:e}})},C=e=>b===e,x=()=>{const e=Hg();return`${s}-${e}`},M=t=>"string"==typeof t?e(c$,{inline:!0,children:t}):e(mV,{children:t});return t(n,{children:[e(X.CustomField,{id:s,label:a,errorMessage:i?.message,children:e("div",{role:"radiogroup",tabIndex:0,children:(()=>{switch(p?.styleType){case"toggle":return y.length>0&&"toggle"===p.styleType&&e(aV,{className:m?`${m} ${m}-radio-container`:void 0,$layoutType:p?.layoutType??"horizontal",children:y.map((t,n)=>{const r=x();return A(oV,{..._,key:n,type:"radio",id:r,className:m?`${m}-radio`:void 0,"data-testid":wS.generateId(s,"radio"),disabled:g??t.disabled,focusableWhenDisabled:g,name:r,indicator:p?.indicator,styleType:!1===p?.border?"no-border":"default",checked:C(t.value),onChange:()=>S(t.value),error:!!i?.message,compositeSection:t.children?{children:e(mV,{children:t.children}),collapsible:!1}:null,subLabel:!!t.subLabel&&M(t.subLabel)},M(t.label))})});case"image-button":return y.length>0&&e(iV,{className:m?`${m} ${m}-radio-container`:void 0,children:y.map((e,t)=>{const n=x();return A(nV,{..._,type:"button",key:t,id:n,className:m?`${m}-radio`:void 0,"data-testid":wS.generateId(s,"radio"),disabled:g??e.disabled,focusableWhenDisabled:g,name:n,selected:C(e.value),onClick:()=>S(e.value),imgSrc:e.imgSrc,error:!!i?.message},e.label)})});default:return y.length>0&&y.map((n,r)=>{const i=x();return t(rV,{className:m?`${m}-radio-container`:void 0,children:[e(tV,{..._,className:m,id:i,"data-testid":wS.generateId(s,"radio"),disabled:g??n.disabled,focusableWhenDisabled:g,name:i,value:n.value,checked:C(n.value),onChange:()=>S(n.value)}),e(eV,{forwardedAs:"label",htmlFor:i,disabled:g??n.disabled,children:M(n.label)})]},r)})}})()})}),e(b$,{id:s,message:f})]})},RangeSelect:r=>{const{error:i,formattedLabel:a,id:c,onBlur:l,onChange:d,schema:f,value:p={from:void 0,to:void 0},warning:h}=r,{commonSchema:{validation:m},customSchema:{options:g,...A}}=YC(f),{setValue:y}=He(),[_,v]=o(p.from||""),[b,E]=o(p.to||""),{setFieldValidationConfig:w}=UP(),S=s(!1);u(()=>{const e=m?.find(e=>"required"in e);w(c,sI().shape({from:VO(),to:VO()}).test("is-empty-string",e?.errorMessage||Yg.COMMON.REQUIRED_OPTIONS,t=>!t||!e?.required||t.from?.length>0&&t.to?.length>0),m)},[m]),Us(()=>{const e={};g.from.find(e=>e.value===p.from)||(e.from=""),g.to.find(e=>e.value===p.to)||(e.to=""),y(c,{...p,...e})},[g]),u(()=>{E(p.from),v(p.to)},[p]);return t(n,{children:[e(X.RangeSelect,{...A,id:c,onHideOptions:()=>{S.current?S.current=!1:p.from&&p.to||d({target:{value:{from:void 0,to:void 0}}})},onBlur:l,"data-testid":wS.generateId(c),label:a,options:g,onSelectOption:e=>{void 0===e.from&&void 0===e.to&&d({target:{value:{from:void 0,to:void 0}}}),e.from&&d({target:{value:{from:e.from.value,to:void 0}}}),e.to&&(S.current=!0,d({target:{value:{to:e.to.value,from:b}}}))},selectedOptions:{from:g.from.find(({value:e})=>e===b),to:g.to.find(({value:e})=>e===_)},valueToStringFunction:e=>`${e.from} - ${e.to}`,valueExtractor:e=>({from:e.value,to:e.value}),displayValueExtractor:e=>e.label,listExtractor:e=>e.label,errorMessage:i?.message}),e(b$,{id:c,message:h})]})},ResetButton:t=>{const{id:n,schema:r}=t,{commonSchema:{label:i},customSchema:{disabled:a,ignoreDefaultValues:o,...s}}=YC(r),{reset:u,getValues:c}=He(),{resetFields:l}=ZP(),{formSchema:{defaultValues:d}}=BP();return e(k.Default,{...s,disabled:a,"data-testid":n,id:n,type:"reset",onClick:()=>{if(o){const e=c();Object.entries(e).forEach(([t,n])=>{gi(n)?e[t]=[]:yz(n)||N$(n)?e[t]="":si(n)&&(e[t]={})}),u(e),l(e)}else u(),l(d)},children:i})},Select:r=>{const{error:i,formattedLabel:a,id:s,onBlur:c,onChange:l,schema:d,value:f,warning:p}=r,{commonSchema:{validation:h},customSchema:{options:m,...g}}=YC(d),{setValue:A}=He(),[y,_]=o(f||""),{setFieldValidationConfig:v}=UP();u(()=>{v(s,VO(),h)},[h]),Us(()=>{m.find(e=>e.value===f)||A(s,"")},[m]),u(()=>{_(f||"")},[f]);return t(n,{children:[e(X.Select,{...g,id:s,"data-testid":wS.generateId(s,"select"),label:a,errorMessage:i?.message,options:m,onBlur:c,onSelectOption:(e,t)=>{l({target:{value:t}})},selectedOption:m.find(({value:e})=>e===y),displayValueExtractor:e=>e.label,valueExtractor:e=>e.value,listExtractor:e=>e.label}),e(b$,{id:s,message:p})]})},SelectHistogram:r=>{const{error:i,formattedLabel:a,id:s,onBlur:c,onChange:l,schema:{label:d,validation:f,disabled:p,readOnly:h,className:m,histogramSlider:g,customOptions:A},value:y,warning:_}=r,{bins:v,interval:b,...E}=g,{resetField:w}=He(),[S,C]=o([0,0]),{setFieldValidationConfig:x}=UP();u(()=>{if(y)C([y.from,y.to]);else{const e=Math.min(...v.map(e=>e.minValue)),t=Math.max(...v.map(e=>e.minValue))+b;w(s,{defaultValue:{from:e,to:t},keepDirty:!0}),C([e,t])}},[y]),u(()=>{const e=f?.find(e=>"required"in e),t=f?.find(e=>"bin"in e&&e.bin),n=f?.find(e=>"incremental"in e&&e.incremental),r=f?.find(e=>"withinRange"in e&&e.withinRange);x(s,sI({from:HO(),to:HO()}).test("is-required",e?.errorMessage||Yg.COMMON.REQUIRED_OPTIONS,t=>!t||!e||!SS(t.from)&&!SS(t.to)).test("is-bin",t?.errorMessage||Yg.SLIDER.MUST_BE_INCREMENTAL,e=>{if(!e||"number"!=typeof e.from||"number"!=typeof e.to)return!0;const{from:t,to:n}=e,r=Math.min(...v.map(e=>e.minValue));return Number.isInteger((t-r)/b)&&Number.isInteger((n-r)/b)}).test("is-incremental",n?.errorMessage||Yg.SLIDER.MUST_BE_INCREMENTAL,e=>!e||"number"!=typeof e.from||"number"!=typeof e.to||e.from<e.to).test("is-within-range",r?.errorMessage||Yg.SLIDER.MUST_BE_INCREMENTAL,e=>{if(!e||"number"!=typeof e.from||"number"!=typeof e.to)return!0;const{from:t,to:n}=e,r=Math.min(...v.map(e=>e.minValue)),i=Math.max(...v.map(e=>e.minValue))+b;return!(t<r||n>i)}),f)},[f,v,b]);return t(n,{children:[e(X.SelectHistogram,{id:s,"data-testid":wS.generateId(s,"select-histogram"),label:a,errorMessage:i?.message,onBlur:c,onChangeEnd:e=>{const[t,n]=e;l({target:{value:{from:t,to:n}}})},disabled:p,readOnly:h,className:m,rangeLabelPrefix:A?.rangeLabelPrefix,rangeLabelSuffix:A?.rangeLabelSuffix,value:S,histogramSlider:{bins:v,interval:b,...E}}),e(b$,{id:s,message:_})]})},Slider:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{label:l,customOptions:d,validation:f,disabled:p,readOnly:h,className:m,ariaLabel:g},value:A,warning:y}=r,[_,v]=o(),{setFieldValidationConfig:b}=UP();u(()=>{const e=f?.find(e=>"min"in e),t=f?.find(e=>"max"in e),n=f?.find(e=>"increment"in e);b(s,HO().test("is-incremental",n?.errorMessage||Yg.SLIDER.MUST_BE_INCREMENTAL,t=>{if("number"!=typeof t||!n)return!0;const r=n.increment,i=(e?.min??0)-t;return Number.isInteger(i/r)}),f),(e||t||n)&&v({min:e?.min,max:t?.max,step:n?.increment})},[f]);return t(n,{children:[e(X.Slider,{...d,..._,id:s,"data-testid":wS.generateId(s,"slider"),label:a,errorMessage:i?.message,onChangeEnd:e=>{c({target:{value:e}})},value:A,disabled:p,readOnly:h,className:m,ariaLabel:g}),e(b$,{id:s,message:y})]})},SubmitButton:t=>{const{id:n,schema:r}=t,{commonSchema:{label:i},customSchema:{disabled:a,...s}}=YC(r),{submitHandler:c,wrapInForm:l}=GP(),{setFieldValidationConfig:d}=UP(),{hardValidationSchema:f}=WP(),p=at({disabled:"invalid-form"!==a}),[h,m]=o(!0===a);u(()=>{d(n,$O())},[]),u(()=>{"invalid-form"!==a&&m(!!a)},[a]),Us(()=>{(async()=>{if("invalid-form"===a)try{await f.validate(p),m(!1)}catch(e){m(!0)}})()},[p,f]);return e(k.Default,{...s,disabled:h,"data-testid":n,id:n,onClick:e=>{l||(e.preventDefault(),c?.())},type:"submit",children:i})},Switch:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:l,value:d,warning:f}=r,{commonSchema:{customOptions:p,label:h,validation:m},customSchema:{className:g,disabled:A,...y}}=YC(l),[_,v]=o(d||void 0),{setFieldValidationConfig:b}=UP();u(()=>{b(s,zO().strict(),m)},[m]),u(()=>{v(d)},[d]);const E=e=>{c({target:{value:e}})},w=e=>_===e,S=e=>`${s}-${e}`;return t(n,{children:[e(X.CustomField,{id:s,label:a,errorMessage:i?.message,children:t(sV,{className:g,role:"radiogroup","aria-label":"string"==typeof h?h:u$(h.mainLabel,{allowedTags:[]}),children:[e(te,{...y,type:"yes",id:S("yes"),"data-testid":wS.generateId(s,"switch-yes"),disabled:A,styleType:!1===p?.border?"no-border":"default",checked:w(!0),onChange:()=>E(!0),indicator:!0,name:s,error:!!i?.message,children:"Yes"}),e(te,{...y,type:"no",id:S("no"),"data-testid":wS.generateId(s,"switch-no"),disabled:A,styleType:!1===p?.border?"no-border":"default",checked:w(!1),onChange:()=>E(!1),indicator:!0,name:s,error:!!i?.message,children:"No"})]})}),e(b$,{id:s,message:f})]})},TextField:r=>{const{error:i,formattedLabel:a,id:c,onBlur:l,onChange:d,value:f,schema:p,warning:h}=r,{commonSchema:{customOptions:m,uiType:g,validation:A},customSchema:{inputMode:y,..._}}=YC(p),[v,b]=o(f??""),[E,w]=o({}),{setFieldValidationConfig:S}=UP(),C=s(null),x=s(0);u(()=>{switch(g){case"numeric-field":{const e=A?.find(e=>"decimals"in e);let t=HO();void 0!==e?.decimals&&(t=t.test("decimals",e.errorMessage||Yg.NUMERIC.INVALID_DECIMALS(e.decimals),t=>{if(null==t)return!0;const n=String(t).split(".")[1];return!n||n.length<=e.decimals})),S(c,t,A);const n=A?.find(e=>"min"in e),r=A?.find(e=>"max"in e),i={...E};n?.min>0&&(i.min=n.min),r?.max>0&&(i.max=r.max),w(i);break}case"email-field":{const e=A?.find(e=>e.email);S(c,VO().email(e?.errorMessage||Yg.EMAIL.INVALID),A);const t=A?.find(e=>"max"in e),n=A?.find(e=>"length"in e),r={...E};t?.max>0?r.maxLength=t.max:n?.length>0&&(r.maxLength=n.length),w(r);break}case"text-field":{S(c,VO(),A);const e=A?.find(e=>"max"in e),t=A?.find(e=>"length"in e),n={...E};e?.max>0?n.maxLength=e.max:t?.length>0&&(n.maxLength=t.length),w(n);break}}},[A]),u(()=>{f!==v&&b(f??"")},[f]),u(()=>{"text-field"===g&&document?.activeElement===C.current&&C.current.selectionEnd!==x.current&&C.current.setSelectionRange(x.current,x.current)},[v]),u(()=>{"text-field"===p.uiType&&"uppercase"===p.customOptions?.textTransform&&v&&b(e=>e?.toString().toUpperCase())},["text-field"===p.uiType&&p.customOptions?.textTransform]);const M=()=>!!m?.addOn,O=M()?X.InputGroup:X.Input;return t(n,{children:[e(O,{..._,...E,id:c,"data-testid":wS.generateId(c,g),ref:C,type:(()=>{switch(g){case"numeric-field":return"number";case"email-field":return"email";default:return"text"}})(),label:a,onBlur:l,onPaste:e=>{const t=e.clipboardData.getData("text");(m?.preventCopyAndPaste||"numeric-field"===g&&/e/i.test(t))&&e.preventDefault()},onDrop:e=>m?.preventDragAndDrop?e.preventDefault():null,inputMode:(()=>{if(y)return y;switch(g){case"numeric-field":return"numeric";case"email-field":return"email";case"text-field":return"text";default:return"none"}})(),onChange:e=>{if("numeric-field"===g){const t=A?.find(e=>"decimals"in e);if(void 0!==t?.decimals){const[n,r]=e.target.value.split(".");r&&r.length>t.decimals&&(e.target.value=`${n}.${r.slice(0,t.decimals)}`)}const n=!isNaN(parseFloat(e.target.value))?+e.target.value:void 0;return d({target:{value:n}}),void b(n??"")}"text-field"===p.uiType?(x.current=e.target.selectionEnd,"uppercase"===p.customOptions?.textTransform&&(e.target.value=e.target.value.toUpperCase()),d(e)):d(e),b(e.target.value)},onKeyDown:e=>{"numeric-field"===g&&"e"===e.key.toLowerCase()&&e.preventDefault()},value:v,errorMessage:i?.message,addon:(()=>{if(M()){if("label"===m.addOn.type)return{type:"label",position:m.addOn.position,attributes:{value:m.addOn.value}};if("icon"===m.addOn.type){const{icon:t,position:n,color:r}=m.addOn,i=Y[t];return{type:"custom",position:n,attributes:{children:e(uV,{as:i,$color:r})}}}}})()}),e(b$,{id:c,message:h})]})},Textarea:oB,TimeField:r=>{const{error:i,formattedLabel:a,id:s,onBlur:c,onChange:l,schema:d,value:f,warning:p}=r,{commonSchema:{validation:h},customSchema:{is24HourFormat:m,placeholder:g,useCurrentTime:A,...y}}=YC(d),[_,v]=o(f||""),{setFieldValidationConfig:b}=UP();u(()=>{b(s,VO(),h)},[h]),u(()=>{if(A&&!f){const e=m?"H:mm":"h:mma";setTimeout(()=>E(e))}else v(f)},[f,A,m]);const E=e=>{const t=Vg.formatDateTime(qf.now().toString().toUpperCase(),e,"time");v(t),l({target:{value:t}})};return t(n,{children:[e(X.Timepicker,{...y,id:s,"data-testid":wS.generateId(s,"time"),label:a,errorMessage:i?.message,value:_,placeholder:g,format:m?"24hr":"12hr",onBlur:c,onChange:e=>{l({target:{value:e}})}}),e(b$,{id:s,message:p})]})},get EFieldType(){return cV},UnitNumberField:r=>{const{formattedLabel:i,error:a,id:s,onBlur:c,onChange:l,schema:d,value:f,warning:p}=r,{commonSchema:{validation:h},customSchema:m}=YC(d),[g,A]=o(f||""),{setFieldValidationConfig:y}=UP();u(()=>{const e=h?.find(e=>"unitNumberFormat"in e);y(s,VO().matches(/^([a-zA-Z0-9]{1,3}-[a-zA-Z0-9]{1,5})$/,{excludeEmptyString:!0,message:e?.errorMessage||Yg.UNIT_NUMBER.INVALID}),h)},[h]),u(()=>{A(f||"")},[f]);return t(n,{children:[e(X.UnitNumberInput,{...m,id:s,"data-testid":wS.generateId(s,"unit-number"),label:i,value:g,onBlur:c,onChange:e=>{l({target:{value:e}})},errorMessage:a?.message}),e(b$,{id:s,message:p})]})}});const dV=({id:t,children:r,childSchema:i})=>{if("columns"in i){if((a=i.columns)&&("xxs"in a||"xs"in a||"sm"in a||"md"in a||"lg"in a||"xl"in a||"xxl"in a)){const{xxs:n,xs:a,sm:o,md:s,lg:u,xl:c,xxl:l,...d}=i.columns||{};return e(z.ColDiv,{"data-testid":wS.generateId(t,"grid_item"),xlCols:c,lgCols:u,mdCols:s,smCols:o,xsCols:a,xxlCols:l,xxsCols:n,...d,children:r})}const{desktop:n,tablet:o,mobile:s,...u}=i.columns||{};return e(me.ColDiv,{"data-testid":wS.generateId(t,"grid_item"),desktopCols:n??12,tabletCols:o,mobileCols:s,...u,children:r})}var a;return e(n,{children:r})},fV=({id:t,renderRules:r,children:i,schema:a})=>{const{formValidationConfig:s,removeFieldValidationConfig:u}=UP(),[c,l]=o(void 0),{formValues:d}=ZP(),{unregister:f}=He();js(()=>{if(bS(r))return;const e=p();if(e!==c){if(!e){[t,...h(a)].forEach(e=>{u(e),f(e)})}l(e)}},[s,d,r]);const p=()=>{if(bS(r))return!0;let e=!1;return r.forEach(t=>{if(!e){const n={};Object.entries(t).forEach(([e,t])=>{if(t.find(e=>e.shown)&&!s?.[e])return void(n[e]={schema:$O().test("shown",()=>!1),validationRules:[]});const r=s?.[e]?.schema.type;if(r){let i=S$.mapSchemaType(r);"number"===r&&(i=i.nullable().transform((e,t)=>!isNaN(parseFloat(t?.toString()))?+t:void 0)),n[e]={schema:i,validationRules:t}}});const r=S$.buildSchema(n);try{r.validateSync(d),e=!0}catch(e){}}}),e},h=e=>{const n=e.children,r=[];switch(e.uiType){case"chips":r.push(t+"-textarea");break;case"checkbox":case"radio":e.options.forEach(e=>{const t=e.children;!bS(t)&&Ln(t)&&Object.entries(t).forEach(([e,t])=>{r.push(e),t.children&&r.push(...h(t.children))})})}return bS(n)||!Ln(n)||Object.entries(n).forEach(([e,t])=>{r.push(e),t.children&&r.push(...h(t.children))}),r};return bS(r)||c?e(n,{children:i}):null},pV=Object.keys(cV),hV=Object.keys(az),mV=t=>{const{id:r,schema:i,children:a}=t,{showIf:s,uiType:u,children:c,...l}=i||{},{warnings:d}=WP(),[f,p]=o(null),{control:h}=He(),{getCustomComponent:m}=j$(),{formSchema:{overrides:A},overrideSchema:y}=BP();G$(()=>{const t=y(c||a,A);if("object"==typeof t){const n=[];Object.keys(t).forEach(r=>{const i=t[r];if(bS(i)||"object"!=typeof i)return;let a=e(g,{children:Yg.GENERIC.UNSUPPORTED},r);if("referenceKey"in i){const t=i.referenceKey.toUpperCase();a=m(i.referenceKey)||Mz[xz[t]]?_(r,i)(v):Mz[Cz[t]]?_(r,i)(b):e(g,{},r)}else"uiType"in i&&(pV.includes(i.uiType.toUpperCase())?a=_(r,i)(v):hV.includes(i.uiType.toUpperCase())&&(a=_(r,i)(b)));n.push(a)}),p(n)}else p("string"==typeof t?t:Yg.GENERIC.UNSUPPORTED)},[c||a,A,h,d,m]);const _=(t,n)=>r=>e(fV,{id:t,...n&&"showIf"in n&&{renderRules:n.showIf},schema:n,children:r(t,n)},t),v=(t,n)=>{let r;return"uiType"in n?r=lV[cV[n.uiType?.toUpperCase()]]:"referenceKey"in n&&(r=Mz[xz[n.referenceKey?.toUpperCase()]]||m(n.referenceKey)),r?e(dV,{id:t,childSchema:n,children:e(eB,{id:t,schema:n,Field:r,warning:d?.[t]})}):null},b=(t,n)=>{let r;return"uiType"in n?r=oz[az[n.uiType?.toUpperCase()]]||mV:"referenceKey"in n&&(r=Mz[Cz[n.referenceKey?.toUpperCase()]]),e(dV,{id:t,childSchema:n,children:e(r,{schema:n,id:t})})};return u?e(u,{...l,id:r,"data-testid":wS.generateId(r,u),children:f}):e(n,{children:f})},gV=I(z.Container)`
|
|
1134
|
+
`;var cV;!function(e){e.BUTTON="ButtonField",e.CHECKBOX="CheckboxGroup",e.CHIPS="Chips",e["CONTACT-FIELD"]="ContactField",e["DATE-FIELD"]="DateField",e["DATE-RANGE-FIELD"]="DateRangeField",e["EMAIL-FIELD"]="TextField",e["E-SIGNATURE-FIELD"]="ESignatureField",e["ERROR-FIELD"]="ErrorField",e["FILE-UPLOAD"]="FileUpload",e["HIDDEN-FIELD"]="HiddenField",e["HISTOGRAM-SLIDER"]="HistogramSlider",e["IMAGE-UPLOAD"]="ImageUpload",e["LOCATION-FIELD"]="LocationField",e["MASKED-FIELD"]="MaskedField",e["MULTI-SELECT"]="MultiSelect",e["NESTED-MULTI-SELECT"]="NestedMultiSelect",e["RANGE-SELECT"]="RangeSelect",e["NUMERIC-FIELD"]="TextField",e["OTP-VERIFICATION-FIELD"]="OtpVerificationField",e.RADIO="RadioButtonGroup",e.RESET="ResetButton",e.SELECT="Select",e["SELECT-HISTOGRAM"]="SelectHistogram",e.SLIDER="Slider",e.SUBMIT="SubmitButton",e.SWITCH="Switch",e.TEXTAREA="Textarea",e["TEXT-FIELD"]="TextField",e["TIME-FIELD"]="TimeField",e["UNIT-NUMBER-FIELD"]="UnitNumberField"}(cV||(cV={}));var lV=Object.freeze({__proto__:null,ButtonField:n=>{const{id:r,schema:i}=n,{commonSchema:{label:a},customSchema:{endIcon:o,href:s,startIcon:u,target:c,...l}}=YC(i),{dispatchFieldEvent:d}=Y$(),f=t=>{if(!t)return null;const n=Y[t];return e(n,{})};return t(Oz,{type:"button",...l,onClick:e=>{d("click",r,e),s&&(e=>{try{return!!new URL(e)}catch{return!1}})(s)&&(c?window.open(s,c,"noopener noreferrer"):window.location.href=s)},children:[f(u),a,f(o)]})},CheckboxGroup:r=>{const{formattedLabel:i,error:a,id:s,onChange:c,schema:l,value:d,warning:f}=r,{commonSchema:{customOptions:p,validation:h},customSchema:{className:m,disabled:g,options:A,...y}}=YC(l),{setValue:_}=He(),[v,b]=o(d||[]),{setFieldValidationConfig:E}=UP();u(()=>{const e=h?.find(e=>"required"in e);E(s,cI().of(VO()).test("is-empty-array",e?.errorMessage||Yg.COMMON.REQUIRED_OPTION,t=>!t||!e?.required||t.length>0),h)},[h]),Us(()=>{const e=d?.filter(e=>A.find(t=>t.value===e));_(s,e)},[A]),u(()=>{b(d||[])},[d]);const w=(e,t)=>{const n=A.find(e=>!0===e.none);let r=[...v];t?r=r.includes(e)?[]:[e]:r.includes(e)?r=Hz(r,e,n?.value):(r.push(e),r=Hz(r,n?.value)),c({target:{value:r}})},S=e=>v.includes(e),C=()=>{const e=Hg();return`${s}-${e}`},x=t=>"string"==typeof t?e(c$,{inline:!0,children:t}):e(mV,{children:t});return t(n,{children:[e(X.CustomField,{id:s,label:i,errorMessage:a?.message,children:e("div",{role:"group",children:"toggle"===p?.styleType?A.length>0&&"toggle"===p.styleType&&e(Jz,{$layoutType:p?.layoutType??"horizontal",className:m?`${m}-checkbox-container`:void 0,children:A.map((t,n)=>{const r=C();return e(Xz,{type:"checkbox","data-testid":wS.generateId(s,"toggle"),id:r,className:m,disabled:g??t.disabled,focusableWhenDisabled:g,name:r,indicator:p?.indicator,styleType:!1===p?.border?"no-border":"default",checked:S(t.value),onChange:()=>w(t.value,t.none),error:!!a?.message,compositeSection:t.children?{children:e(mV,{children:t.children}),collapsible:!1}:null,subLabel:!!t.subLabel&&x(t.subLabel),children:x(t.label)},n)})}):A.length>0&&A.map((n,r)=>{const i=C();return t(Qz,{className:m?`${m}-checkbox-container`:void 0,children:[e(qz,{...y,"data-testid":wS.generateId(s,"checkbox"),id:i,className:m,disabled:g??n.disabled,name:i,value:n.value,focusableWhenDisabled:g,checked:S(n.value),onChange:()=>w(n.value)}),e(Kz,{forwardedAs:"label",htmlFor:i,disabled:g??n.disabled,children:x(n.label)})]},r)})})}),e(b$,{id:s,message:f})]})},Chips:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:l,value:d,warning:f}=r,{commonSchema:{validation:p},customSchema:{disabled:h,options:m,textarea:g,...y}}=YC(l),[_,v]=o(d||[]),[b,E]=o(!1),[w,S]=o(!0),{setValue:C,unregister:x}=He(),{setFieldValidationConfig:M,removeFieldValidationConfig:O}=UP();u(()=>{b||x(I())},[]),u(()=>{const e=p?.find(e=>"required"in e),t=p?.find(e=>"max"in e),n=p?.find(e=>"length"in e);M(s,cI().of(VO()).test("is-empty-array",e?.errorMessage||Yg.COMMON.REQUIRED_OPTION,t=>!t||!e?.required||t.length>0),p),1!==t?.max&&1!==n?.length||S(!1)},[p]),Us(()=>{const e=[...m.map(e=>e.value),g?.label],t=d?.filter(t=>e.includes(t));C(s,t)},[m]),u(()=>{d?.includes(D())?N(!0):N(),v(d||[])},[d]);const T=e=>_.includes(e),I=()=>`${s}-textarea`,D=()=>"string"==typeof g?.label?g?.label:g?.label?.mainLabel,N=(e=!1)=>{E(e),e||O(I())},L=e=>{let t=[..._];if(t.includes(e))return t=t.filter(t=>t!==e),void c({target:{value:t}});w?t.push(e):t=[e],c({target:{value:t}})};return t(n,{children:[t(X.CustomField,{label:a,errorMessage:i?.message,children:[t(sB,{"data-testid":wS.generateId(s,"chips"),$showTextarea:b,children:[m.map((e,t)=>A(gI,{...y,key:t,onClick:()=>L(e.value),isActive:T(e.value),disabled:h??e.disabled},e.label)),(()=>{if(!g?.label)return;const t=D();return e(gI,{...y,onClick:()=>{L(t)},isActive:T(t),children:t})})()]}),(()=>{if(!g?.label)return e(n,{});const t=I(),r={uiType:"textarea",className:l.className?`${l.className}-textarea`:void 0,...g};return b?e(eB,{id:t,schema:r,Field:oB}):e(n,{})})()]}),e(b$,{id:s,message:f})]})},ContactField:r=>{const{isDirty:i,formattedLabel:a,error:s,id:c,onBlur:l,onChange:d,schema:f,value:p,warning:h}=r,{commonSchema:{validation:m},customSchema:{defaultCountry:g,disabled:A,enableSearch:y,placeholder:_,...v}}=YC(f),{resetField:b}=He(),[E,w]=o(p||""),S=VP(g),[C,x]=o(g),[M]=o((()=>{const e=new Map;return uB.forEach(t=>{const[n,...r]=t,i=r.find(e=>/^\d+$/.test(e));e.set(n,i)}),e})()),[O,T]=o(),[I,D]=o(),[N,L]=o(void 0),{setFieldValidationConfig:k}=UP();u(()=>{const e=m?.find(e=>"contactNumber"in e),t=e?.contactNumber?.singaporeNumber,n=e?.contactNumber?.internationalNumber,r=e?.errorMessage;M.has(n)?(x(n),L(!0)):["default","house","mobile"].includes(t)?(x("Singapore"),L(!0)):L(!1),D(t),k(c,VO().test("singaporeNumber",r||Yg.CONTACT.INVALID_SINGAPORE_NUMBER,e=>!e||!t||pU.isSingaporeNumber(e,t)).test("internationalNumber",r||Yg.CONTACT.INVALID_INTERNATIONAL_NUMBER,e=>!(e&&!t&&n)||pU.isInternationalNumber(O?.name,e)),m)},[m,O]),u(()=>{const e=C||"Singapore";T({name:e,prefix:M.get(e)})},[C,M]),u(()=>{const e=m?.find(e=>"contactNumber"in e),t=e?.contactNumber?.singaporeNumber,n=e?.contactNumber?.internationalNumber;!g||S===g||M.has(n)||["default","house","mobile"].includes(t)||x(g)},[m,g]),u(()=>{if(void 0!==N&&!i){const{prefix:e,number:t}=pU.getParsedPhoneNumber(p||""),n=e.replace(/\+/g,""),r=(e=>{for(const[t,,,n]of uB)if(t===e)return n})(C||"Singapore");if(!N||N&&n===r){const n=R({countryCode:e||r,number:t});b(c,{defaultValue:n,keepDirty:!0})}else{const e=R({countryCode:"",number:""});b(c,{defaultValue:e,keepDirty:!0})}}},[p,i,N,C]);const R=e=>{const{countryCode:t,number:n}=e,r=t.replace(/\+/g,"");if(!1===N&&r!==O?.prefix){const e=((e,t)=>{for(const[n,r]of t.entries())if(r===e)return n})(r,M);e&&T({name:e,prefix:t})}return w(n),pU.formatPhoneNumber(e.countryCode,e.number)||""};return t(n,{children:[e(X.PhoneNumberInput,{...v,"data-testid":wS.generateId(c,"contact"),disabled:A,enableSearch:y,errorMessage:s?.message,fixedCountry:N,id:c,label:a,placeholder:(()=>{if(_)return _;if(I){return`Enter ${"mobile"===I?"mobile":"home"} number`}return"Enter contact number"})(),value:(()=>{if(!O)return;const{prefix:e}=O;return{number:E,countryCode:e}})(),onBlur:l,onChange:e=>{const t=R(e);d({target:{value:t}})}}),e(b$,{id:c,message:h})]})},DateField:r=>{const{error:i,formattedLabel:a,id:s,isDirty:c,onBlur:l,onChange:d,schema:f,value:p,warning:h}=r,{commonSchema:{validation:m},customSchema:{useCurrentDate:g,dateFormat:A=hU,...y}}=YC(f),{setValue:_}=He(),[v,b]=o(p||""),[E,w]=o(),{setFieldValidationConfig:S}=UP();u(()=>{const e=m?.find(e=>"dateFormat"in e&&e.dateFormat),t=m?.find(e=>"future"in e),n=m?.find(e=>"past"in e),r=m?.find(e=>"notFuture"in e),i=m?.find(e=>"notPast"in e),a=m?.find(e=>"minDate"in e),o=m?.find(e=>"maxDate"in e),u=m?.find(e=>"excludedDates"in e),c=m?.find(e=>"withinDays"in e),l=m?.find(e=>"beyondDays"in e),d=Vg.toLocalDateOrTime(a?.minDate,A,"date"),f=Vg.toLocalDateOrTime(o?.maxDate,A,"date");S(s,VO().test("is-date",e?.errorMessage||Yg.DATE.INVALID,e=>!e||""===e||!!M(e)&&!!Vg.toLocalDateOrTime(e,A,"date")).test("future",t?.errorMessage||Yg.DATE.MUST_BE_FUTURE,e=>{if(!M(e)||!t?.future)return!0;const n=Vg.toLocalDateOrTime(e,A,"date");return!!n?.isAfter(Wf.now())}).test("past",n?.errorMessage||Yg.DATE.MUST_BE_PAST,e=>{if(!M(e)||!n?.past)return!0;const t=Vg.toLocalDateOrTime(e,A,"date");return!!t?.isBefore(Wf.now())}).test("not-future",r?.errorMessage||Yg.DATE.CANNOT_BE_FUTURE,e=>{if(!M(e)||!r?.notFuture)return!0;const t=Vg.toLocalDateOrTime(e,A,"date");return!t?.isAfter(Wf.now())}).test("not-past",i?.errorMessage||Yg.DATE.CANNOT_BE_PAST,e=>{if(!M(e)||!i?.notPast)return!0;const t=Vg.toLocalDateOrTime(e,A,"date");return!t?.isBefore(Wf.now())}).test("min-date",a?.errorMessage||Yg.DATE.MIN_DATE(Vg.formatDateTime(a?.minDate,"dd/MM/uuuu","date")),e=>{if(!M(e)||!d)return!0;const t=Vg.toLocalDateOrTime(e,A,"date");return!t?.isBefore(d)}).test("max-date",o?.errorMessage||Yg.DATE.MAX_DATE(Vg.formatDateTime(o?.maxDate,"dd/MM/uuuu","date")),e=>{if(!M(e)||!f)return!0;const t=Vg.toLocalDateOrTime(e,A,"date");return!t?.isAfter(f)}).test("excluded-dates",u?.errorMessage||Yg.DATE.DISABLED_DATES,e=>!M(e)||!u||!u.excludedDates.includes(e)).test("within-days",c?.errorMessage||c?.withinDays&&Yg.DATE.WITHIN_DAYS(c?.withinDays),e=>!M(e)||!c||Vg.checkWithinDays(e,{...c.withinDays,dateFormat:A})).test("beyond-days",l?.errorMessage||l?.beyondDays&&Yg.DATE.BEYOND_DAYS(l?.beyondDays),e=>!M(e)||!l||Vg.checkBeyondDays(e,{...l.beyondDays,dateFormat:A})),m);const p=c?.withinDays&&Vg.calculateDisabledWithinDaysRange({...c.withinDays,dateFormat:A}),h=l?.beyondDays&&Vg.calculateDisabledBeyondDaysRange({...l.beyondDays,dateFormat:A}),g=x([d,t?.future&&Wf.now().plusDays(1),i?.notPast&&Wf.now(),p?.startDate,h?.startDate]),y=C([f,n?.past&&Wf.now().minusDays(1),r?.notFuture&&Wf.now(),p?.endDate,h?.endDate]),_=[...u?.excludedDates||[]];(g||y||_)&&w(e=>({...e,minDate:g?.format(mU),maxDate:y?.format(mU),disabledDates:_}))},[m]),u(()=>{if(A)if(p)if(M(p)){const e=Vg.toLocalDateOrTime(p,A,"date");b(Vg.formatDateTime(e?.toString(),hU,"date",Yg.DATE.INVALID))}else b(Yg.DATE.INVALID);else if(!c)if(g){const e=Vg.formatDateTime(Wf.now().toString(),A,"date");_(s,e);const t=Vg.formatDateTime(Wf.now().toString(),hU,"date");b(t)}else b(void 0)},[g,p,A,c]);const C=e=>e.filter(e=>e).sort((e,t)=>e.isAfter(t)?1:-1)?.[0],x=e=>e.filter(e=>e).sort((e,t)=>e.isBefore(t)?1:-1)?.[0],M=e=>e&&e!==Yg.DATE.INVALID;return t(n,{children:[e(X.DateInput,{...y,...E,id:s,"data-testid":wS.generateId(s,"date"),label:a,errorMessage:i?.message,onBlur:l,onChange:e=>{d({target:{value:Vg.formatDateTime(e,A,"date",Yg.DATE.INVALID)}})},value:v}),e(b$,{id:s,message:h})]})},DateRangeField:r=>{const{error:i,formattedLabel:a,id:s,isDirty:c,onBlur:l,onChange:d,schema:f,value:p={from:void 0,to:void 0},warning:h}=r,{commonSchema:{validation:m},customSchema:{dateFormat:g=AU,variant:A,...y}}=YC(f),[_,v]=o(p.from||""),[b,E]=o(p.to||""),[w,S]=o(),{setFieldValidationConfig:C}=UP(),[x,M]=o([]);Us(()=>{C(s,sI().shape({from:VO(),to:VO()}).test({name:"is-empty-string",test(e,t){M(t.schema.describe().meta?.rules??[]);const n=N(t.schema.describe().meta?.rules,"required");if(!e||!n)return!0;return!!(e.from?.length>0&&e.to?.length>0)||t.createError({message:n?.errorMessage??Yg.DATE_RANGE.REQUIRED})}}).test({name:"is-date",test(e,t){const n=m?.find(e=>!!e&&"dateFormat"in e&&e.dateFormat);if(l$.exports.isEmpty(e?.from)||l$.exports.isEmpty(e?.to))return!0;return!(!I(e.from)||!I(e.to)||!Vg.toLocalDateOrTime(e.from,g,"date")||!Vg.toLocalDateOrTime(e.to,g,"date"))||t.createError({message:n?.errorMessage||Yg.DATE_RANGE.INVALID})}}).test({name:"number-of-days",test(e,t){if("week"===A)return!0;const n=N(t.schema.describe().meta?.rules,"numberOfDays"),r=n?.numberOfDays;if(!I(e.from)||!I(e.to)||!r)return!0;const i=Vg.toLocalDateOrTime(e.from,g,"date");return!!Vg.toLocalDateOrTime(e.to,g,"date").equals(i.plusDays(r-1))||t.createError({message:n?.errorMessage??Yg.DATE_RANGE.MUST_HAVE_NUMBER_OF_DAYS(r)})}}).test({name:"future",test(e,t){if("week"===A)return!0;const n=N(t.schema.describe().meta?.rules,"future");if(!I(e.from)||!I(e.to)||!n)return!0;const r=Vg.toLocalDateOrTime(e.from,g,"date"),i=Vg.toLocalDateOrTime(e.to,g,"date");return!(!r?.isAfter(Wf.now())||!i?.isAfter(Wf.now()))||t.createError({message:n?.errorMessage??Yg.DATE_RANGE.MUST_BE_FUTURE})}}).test({name:"past",test(e,t){if("week"===A)return!0;const n=N(t.schema.describe().meta?.rules,"past");if(!I(e.from)||!I(e.to)||!n)return!0;const r=Vg.toLocalDateOrTime(e.from,g,"date"),i=Vg.toLocalDateOrTime(e.to,g,"date");return!(!r?.isBefore(Wf.now())||!i?.isBefore(Wf.now()))||t.createError({message:n?.errorMessage??Yg.DATE_RANGE.MUST_BE_PAST})}}).test({name:"not-future",test(e,t){if("week"===A)return!0;const n=N(t.schema.describe().meta?.rules,"notFuture");if(!I(e.from)||!I(e.to)||!n)return!0;const r=Vg.toLocalDateOrTime(e.from,g,"date"),i=Vg.toLocalDateOrTime(e.to,g,"date");return!(r?.isAfter(Wf.now())||i?.isAfter(Wf.now()))||t.createError({message:n?.errorMessage??Yg.DATE_RANGE.CANNOT_BE_FUTURE})}}).test({name:"not-past",test(e,t){if("week"===A)return!0;const n=N(t.schema.describe().meta?.rules,"notPast");if(!I(e.from)||!I(e.to)||!n)return!0;const r=Vg.toLocalDateOrTime(e.from,g,"date"),i=Vg.toLocalDateOrTime(e.to,g,"date");return!(r?.isBefore(Wf.now())||i?.isBefore(Wf.now()))||t.createError({message:n?.errorMessage??Yg.DATE_RANGE.CANNOT_BE_PAST})}}).test({name:"min-date",test(e,t){if("week"===A)return!0;const n=N(t.schema.describe().meta?.rules,"minDate"),r=n?.minDate,i=r?Vg.toLocalDateOrTime(r,g,"date"):void 0;if(!I(e.from)||!I(e.to)||!i)return!0;const a=Vg.toLocalDateOrTime(e.from,g,"date"),o=Vg.toLocalDateOrTime(e.to,g,"date");return!(a?.isBefore(i)||o?.isBefore(i))||t.createError({message:n?.errorMessage??Yg.DATE_RANGE.MIN_DATE(Vg.formatDateTime(r,"dd/MM/uuuu","date"))})}}).test({name:"max-date",test(e,t){if("week"===A)return!0;const n=N(t.schema.describe().meta?.rules,"maxDate"),r=n?.maxDate,i=r?Vg.toLocalDateOrTime(r,g,"date"):void 0;if(!I(e.from)||!I(e.to)||!i)return!0;const a=Vg.toLocalDateOrTime(e.from,g,"date"),o=Vg.toLocalDateOrTime(e.to,g,"date");return!(a?.isAfter(i)||o?.isAfter(i))||t.createError({message:n?.errorMessage??Yg.DATE_RANGE.MAX_DATE(Vg.formatDateTime(r,"dd/MM/uuuu","date"))})}}).test({name:"excluded-dates",test(e,t){if("week"===A)return!0;const n=N(t.schema.describe().meta?.rules,"excludedDates"),r=n?.excludedDates;if(!I(e.from)||!I(e.to)||!r)return!0;const i=Vg.toLocalDateOrTime(e.from,g,"date"),a=Vg.toLocalDateOrTime(e.to,g,"date");try{const e=r.map(e=>Vg.toLocalDateOrTime(e,g,"date"));for(const r of e)if(i.isEqual(r)||a.isEqual(r))return t.createError({message:n?.errorMessage??Yg.DATE_RANGE.DISABLED_DATES});return!0}catch{return!1}}}),m);const e=N(x,"future"),t=N(x,"past"),n=N(x,"notFuture"),r=N(x,"notPast"),i=N(x,"minDate"),a=N(x,"maxDate"),o=N(x,"excludedDates"),u=N(x,"numberOfDays"),c=Vg.toLocalDateOrTime(i?.minDate,g,"date"),l=Vg.toLocalDateOrTime(a?.maxDate,g,"date"),d=T([c,e?.future&&Wf.now().plusDays(1),r?.notPast&&Wf.now()]),f=O([l,t?.past&&Wf.now().minusDays(1),n?.notFuture&&Wf.now()]),p=o?.excludedDates,h=u?.numberOfDays;S(e=>({...e,minDate:d?.format(yU),maxDate:f?.format(yU),disabledDates:p,numberOfDays:h}))},[m,x]),u(()=>{D(gU.START)},[p.from,g,c]),u(()=>{D(gU.END)},[p.to,g,c]);const O=e=>e.filter(e=>e).sort((e,t)=>e.isAfter(t)?1:-1)?.[0],T=e=>e.filter(e=>e).sort((e,t)=>e.isBefore(t)?1:-1)?.[0],I=e=>e&&e!==Yg.DATE_RANGE.INVALID,D=e=>{const t=e===gU.START?p.from:p.to,n=e===gU.START?v:E;if(g)if(t)if(I(t)){const e=Vg.toLocalDateOrTime(t,g,"date");n(Vg.formatDateTime(e?.toString(),AU,"date",Yg.DATE_RANGE.INVALID))}else n(Yg.DATE_RANGE.INVALID);else c||n(void 0)},N=(e,t)=>{const n=e?.find(e=>t in e),r=m?.find(e=>!!e&&t in e);return l$.exports.isEmpty(n)?l$.exports.isEmpty(r)?void 0:r:n};return t(n,{children:[e(X.DateRangeInput,{...y,...w,id:s,"data-testid":wS.generateId(s,"date"),label:a,errorMessage:i?.message,onBlur:l,onChange:(e,t)=>{d({target:{value:{from:Vg.formatDateTime(e,g,"date",Yg.DATE_RANGE.INVALID),to:Vg.formatDateTime(t,g,"date",Yg.DATE_RANGE.INVALID)}}})},value:_,valueEnd:b,variant:A}),e(b$,{id:s,message:h})]})},get TDateRangeInputType(){return gU},ESignatureField:n=>{const{error:r,formattedLabel:i,id:a,onChange:c,schema:{label:l,uiType:d,upload:f,validation:p,...h},value:m,warning:g}=n,[A,y]=o(null),[_,v]=o(0),[b,E]=o(0),[w,S]=o(null),{setFieldValidationConfig:C}=UP(),x=s(null),{clearErrors:M}=He();u(()=>{const e=p?.find(e=>"upload"in e&&e.upload);x.current=e,C(a,sI().shape({fileId:VO().required(),dataURL:VO(),fileUrl:VO(),uploadResponse:$O().nullable()}).default(void 0),p)},[p]),u(()=>{if(E(0),T(m)){if(m.dataURL)y(m.dataURL);else if(m.fileUrl){const e=D(m.fileId,m.fileUrl);return()=>e.abort()}}else y(null)},[m]);const O=async e=>{if(!e)return y(null),E(0),v(0),S(null),void c({target:{value:null}});const t=Hg();if(y(e),E(0),bS(f))c({target:{value:{fileId:t,dataURL:e}}});else try{const n=await I(t,e);c({target:{value:{fileId:t,..."base64"===f.type&&{dataURL:e},fileUrl:n?.data?.fileUrl,uploadResponse:n}}}),M(a),v(0)}catch(e){v(e=>e+1),S(null)}},T=e=>!!e,I=async(e,t)=>{S(0);const n=new FormData;if(n.append("fileId",e),f.sessionId&&n.append("sessionId",f.sessionId),"base64"===f.type)n.append("dataURL",t);else if("multipart"===f.type){const r=await Gg.dataUrlToBlob(t),i=Gg.blobToFile(r,{name:e,lastModified:Date.now()});n.append("file",i,e)}const r=await new zl("",void 0,void 0,!0).post(f.url,n,{headers:{"Content-Type":"base64"===f.type?"application/json":"multipart/form-data",...f.headers},onUploadProgress:e=>{const{loaded:t,total:n}=e;S(t/n)}});return S(null),r},D=(e,t)=>{const n=new AbortController;return(async()=>{try{const r=await new zl("",void 0,void 0,!1,{responseType:"blob"}).get(t,{signal:n.signal}),i=await Gg.getType(new File([r],e)),a=new File([r],e,{type:i.mime}),o=await Gg.fileToDataUrl(a);y(o),E(0)}catch(e){if(e instanceof El)return;E(e=>e+1)}})(),n};return t(_U,{children:[e(X.ESignature,{...h,id:a,label:i,onChange:O,value:A,...null!==w&&{loadingProgress:w}}),(r?.message||_||b)&&null===w?_>0?t(vU,{children:[e(ne,{}),t("span",{children:[x.current?.errorMessage||Yg.ESIGNATURE.UPLOAD,e(bU,{type:"button",onClick:()=>O(A),children:"Please try again."})]}),_>=3&&e(EU,{type:"warning","data-testid":"upload-refresh-alert",children:"Refresh this page if you cannot upload your signature."})]}):b>0&&T(m)?t(vU,{children:[e(ne,{}),t("span",{children:["Failed to load.",e(bU,{type:"button",onClick:()=>D(m.fileId,m.fileUrl),children:"Please try again."})]}),b>=3&&e(EU,{type:"warning","data-testid":"load-refresh-alert",children:"Refresh this page if your signature failed to load."})]}):t(vU,{children:[e(ne,{}),e("span",{children:r?.message})]}):null,e(b$,{id:a,message:g})]})},ErrorField:t=>{const{id:n,schema:{children:r}}=t,{setFieldValidationConfig:i}=UP();return u(()=>{i(n,$O().test(()=>!1),[])},[]),r?e(mV,{children:r}):null},FileUploadInner:VU,FileUpload:t=>e(UU,{children:e(VU,{...t})}),get EFileStatus(){return GU},HiddenField:t=>{const{id:n,name:r,onBlur:i,onChange:a,schema:{showIf:o,uiType:s,validation:c,valueType:l,value:d,...f},value:p}=t,{setFieldValidationConfig:h}=UP(),{setValue:m}=He();return u(()=>{let e;switch(l){case"null":e=$O();break;case"number":e=HO();break;case"boolean":e=zO();break;default:e=VO()}h(n,e,c)},[c,l]),u(()=>{"null"===l&&null!==p?m(n,null):SS(d)||p===d||m(n,d)},[m,n,l,d,p]),e("input",{onBlur:i,onChange:a,...f,type:"hidden",id:n,"data-testid":n,name:r,value:d??p??""})},HistogramSlider:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{label:d,bins:f,interval:p,validation:h,disabled:m,readOnly:g,className:A,ariaLabels:y,customOptions:_},value:v,warning:b}=r,{resetField:E}=He(),[w,S]=o(void 0),{setFieldValidationConfig:C}=UP(),x=l(()=>Math.min(...f.map(e=>e.minValue)),[f]),M=l(()=>Math.max(...f.map(e=>e.minValue))+p,[f,p]);u(()=>{v?S((e=>["number"==typeof e?.from?e.from:x,"number"==typeof e?.to?e.to:M])(v)):(E(s,{defaultValue:{from:x,to:M},keepDirty:!0}),S([x,M]))},[v]),u(()=>{const e=h?.find(e=>"required"in e),t=h?.find(e=>"bin"in e&&e.bin),n=h?.find(e=>"incremental"in e&&e.incremental),r=h?.find(e=>"withinRange"in e&&e.withinRange);C(s,sI({from:HO(),to:HO()}).test("is-required",e?.errorMessage||Yg.COMMON.REQUIRED_OPTIONS,t=>!t||!e||!SS(t.from)&&!SS(t.to)).test("is-bin",t?.errorMessage||Yg.SLIDER.MUST_BE_INCREMENTAL,e=>{if(!e||"number"!=typeof e.from||"number"!=typeof e.to)return!0;const{from:t,to:n}=e,r=Math.min(...f.map(e=>e.minValue));return Number.isInteger((t-r)/p)&&Number.isInteger((n-r)/p)}).test("is-incremental",n?.errorMessage||Yg.SLIDER.MUST_BE_INCREMENTAL,e=>!e||"number"!=typeof e.from||"number"!=typeof e.to||e.from<e.to).test("is-within-range",r?.errorMessage||Yg.SLIDER.MUST_BE_INCREMENTAL,e=>{if(!e||"number"!=typeof e.from||"number"!=typeof e.to)return!0;const{from:t,to:n}=e,r=Math.min(...f.map(e=>e.minValue)),i=Math.max(...f.map(e=>e.minValue))+p;return!(t<r||n>i)}),h)},[h,f,p]);return t(n,{children:[e(X.HistogramSlider,{..._,id:s,"data-testid":wS.generateId(s,"histogram-slider"),label:a,errorMessage:i?.message,onChangeEnd:e=>{const[t,n]=e;c({target:{value:{from:t,to:n}}})},value:w,bins:f,interval:p,disabled:m,readOnly:g,className:A,ariaLabels:y}),e(b$,{id:s,message:b})]})},ImageUploadInner:UY,ImageUpload:t=>e(HU,{children:e(UY,{...t})}),ACCEPTED_FILE_TYPES:KU,get EImageStatus(){return qU},LocationField:n=>{const{error:r,formattedLabel:i,id:a,schema:{className:s="location",mapApi:c,disabled:l,gettingCurrentLocationFetchMessage:d,interactiveMapPinIconUrl:f,label:p,locationInputPlaceholder:h,locationListTitle:m,locationModalStyles:g,mapBannerText:A,mapPanZoom:y,mustHavePostalCode:v,readOnly:b,staticMapPinColor:E,validation:w,hasExplicitEdit:S,locationSelectionMode:C="default",disableSearch:x,addressFieldPlaceholder:M,searchBarIcon:O,bufferRadius:T,pinsOnlyIndicateCurrentLocation:I,legendItems:D,defaultAddress:N},value:L,warning:R}=n,[F,$]=o(!1),{setValue:P}=He(),{setFieldValidationConfig:z}=UP(),{dispatchFieldEvent:B,addFieldEventListener:Z,removeFieldEventListener:U}=Y$();u(()=>(Z("show-location-modal",a,Y),B("show-location-modal-ready",a),()=>{U("show-location-modal",a,Y)}),[]),u(()=>{const e=w?.find(e=>"required"in e),t=w?.find(e=>"postalCode"in e);z(a,sI({address:VO(),blockNo:VO(),building:VO(),lat:HO(),lng:HO(),postalCode:VO(),roadName:VO(),x:HO(),y:HO()}).test("is-required",e?.errorMessage||Yg.COMMON.FIELD_REQUIRED,t=>!e?.required||!!t&&!!t.lat&&!!t.lng).test("must-have-postal-code",t?.errorMessage||Yg.LOCATION.MUST_HAVE_POSTAL_CODE,t=>!e||!v||m$.hasGotAddressValue(t.postalCode)),w)},[w]);const j=(e,t=!0)=>{P(a,e,{shouldDirty:t})},G=()=>{b||l||($(!0),B("show-location-modal",a))},Y=()=>{$(!0)};return t("div",{id:a,"data-testid":wS.generateId(a),className:s,children:[e(qY,{id:a,label:i,className:s,locationInputPlaceholder:h,onChange:e=>e.currentTarget.blur(),onFocus:G,value:L?.address||"",errorMessage:r?.message,disabled:"explicit"===S&&!!L?.address||l,readOnly:b}),S&&L?.address&&e(k.Default,{id:wS.generateId(a,"edit-button"),"data-testid":wS.generateId(a,"edit-button"),styleType:"secondary",onClick:()=>{!B("click-edit-button",a)||$(!0)},type:"button",children:"Edit"}),!!L?.lat&&!!L?.lng&&e(v$,{id:a,className:`${s}-static-map`,lat:L.lat,lng:L.lng,staticMapPinColor:E,onClick:G,disabled:l}),e(_,{fallback:null,children:QY&&e(QY,{id:a,className:s,showLocationModal:F,onClose:()=>{$(!1),B("hide-location-modal",a)},formValues:L,onConfirm:j,updateFormValues:j,mapPanZoom:y,mapApi:c,interactiveMapPinIconUrl:f,gettingCurrentLocationFetchMessage:d,mustHavePostalCode:v,locationModalStyles:g,locationListTitle:m,mapBannerText:A,locationSelectionMode:C,disableSearch:x,addressFieldPlaceholder:M,searchBarIcon:O,bufferRadius:T,pinsOnlyIndicateCurrentLocation:I,legendItems:D,defaultAddress:N})}),e(b$,{id:a,message:R})]})},GeolocationPositionErrorWrapper:JY,MaskedField:r=>{const{error:i,formattedLabel:a,id:s,onBlur:c,onChange:l,value:d,schema:{label:f,uiType:p,validation:h,maskRegex:m,iconMask:g,iconUnmask:A,...y},warning:_}=r,[v,b]=o(d||""),[E,w]=o({}),{setFieldValidationConfig:S}=UP();u(()=>{S(s,VO(),h);const e=h?.find(e=>"max"in e),t=h?.find(e=>"length"in e),n={...E};e?.max>0?n.maxLength=e.max:t?.length>0&&(n.maxLength=t.length),w(n)},[h]),u(()=>{d!==v&&b(d||"")},[d]);const C=t=>{if(!t)return;const n=Y[t];return e(n,{"data-testid":t})};return t(n,{children:[e(X.MaskedInput,{...y,...E,id:s,"data-testid":wS.generateId(s,p),label:a,onBlur:c,onChange:e=>{l(e)},value:v,errorMessage:i?.message,maskRegex:(()=>{if(m)try{const e=m.match(/\/(.*)\/([a-z]+)?/);return new RegExp(e[1],e[2])}catch(e){console.warn(`invalid regex pattern: ${m}`)}})(),iconMask:C(g),iconUnmask:C(A)}),e(b$,{id:s,message:_})]})},MultiSelect:r=>{const{error:i,formattedLabel:a,id:s,onBlur:c,onChange:l,schema:d,value:f,warning:p}=r,{commonSchema:{validation:h},customSchema:{options:m=[],...g}}=YC(d),{setValue:A}=He(),[y,_]=o(f||[]),{setFieldValidationConfig:v}=UP();u(()=>{const e=h?.find(e=>"required"in e);v(s,cI().of(VO()).test("is-empty-array",e?.errorMessage||Yg.COMMON.REQUIRED_OPTION,t=>!t||!e?.required||t.length>0),h)},[h]),js(()=>{const e=f?.filter(e=>m.find(t=>t.value===e));A(s,e)},[m]),u(()=>{_(f||[])},[f]);return t(n,{children:[e(X.MultiSelect,{...g,id:s,"data-testid":wS.generateId(s),label:a,options:m,onBlur:c,onSelectOptions:e=>{const t=e.map(e=>e.value);l({target:{value:t}})},selectedOptions:m.filter(e=>y.includes(e.value)),valueExtractor:e=>e.value,listExtractor:e=>e.label,errorMessage:i?.message}),e(b$,{id:s,message:p})]})},OtpVerificationField:r=>{const{error:i,id:a,value:c,formattedLabel:l,onChange:d,warning:f,schema:{validation:p,request:h,verification:m,withPrefix:g,verifyOtpCountdownTimer:A,prefixSeparator:y,type:_,...v}}=r,[b,E]=o(c?.otpCode||""),[w,S]=o(c?.otpPrefix),C=s(c?.transactionId),x=s(-1),M=s(-1),O=c?.state||"default",T=c?.contact||"",I={number:"phone-number"===_?T:"",countryCode:"+65"},D=p?.find(e=>"otp-type"in e),N=p?.find(e=>"required"in e),{setFieldValidationConfig:L}=UP(),{formState:k,setError:R,clearErrors:F}=He(),{submitCount:$}=k;u(()=>{L(a,sI().test(XY.IS_OTP_VERIFIED,N?.errorMessage||z(),e=>!N?.required||"verified"===e?.state),p)},[p,O]);const P=async()=>{const e=D?.["otp-type"]??void 0;if("email"===e&&(t=T,!VO().required().email().isValidSync(t)))throw R(a,{type:XY.IS_EMAIL_VALID,message:D?.errorMessage||Yg.OTP_VERIFICATION.INVALID_EMAIL}),new Error;var t;const n=`${I.countryCode}${I.number}`;if("phone-number"===e&&!(e=>pU.isSingaporeNumber(e))(n))throw R(a,{type:XY.IS_PHONE_NUMBER_VALID,message:D?.errorMessage||Yg.OTP_VERIFICATION.INVALID_PHONE}),new Error;const r={type:_,..."email"===_?{email:T}:{phoneNo:n},...void 0!==g&&{withPrefix:g}},i=await new zl("",void 0,void 0,!0).post(h.endpoint.url,r).catch(e=>{const t=e?.message||Yg.OTP_VERIFICATION.SEND_OTP_FAILED;throw R(a,{type:XY.SEND_OTP_FAILED,message:t}),new Error(t)}),o=i?.transactionId??i?.data?.transactionId,s=i?.prefix??i?.data?.prefix;C.current=o,s&&S(s),F(a),x.current=$,d({target:{value:{contact:"email"===e?T:I.number,otpPrefix:s??w,type:_,state:"sent"}}})},z=()=>"default"===O?"email"===_?Yg.OTP_VERIFICATION.EMAIL_VERIFICATION_REQUIRED:Yg.OTP_VERIFICATION.PHONE_VERIFICATION_REQUIRED:"sent"===O?Yg.OTP_VERIFICATION.OTP_REQUIRED:void 0,B={...v,id:a,"data-testid":wS.generateId(a,"otp-verification-field"),label:l,otpState:O,onOtpStateChange:e=>{"default"===e&&(E(""),S(void 0),C.current=void 0,d({target:{value:{...c,state:void 0,additionalData:void 0,otpPrefix:void 0}}}))},onSendOtp:P,onResendOtp:P,onVerifyOtp:async e=>{const t="email"===_?T:I.number,n=await new zl("",void 0,void 0,!0).post(m.endpoint.url,{transactionId:C.current,otp:e,otpPrefix:w}).catch(e=>{const t=e?.message||Yg.OTP_VERIFICATION.OTP_VERIFICATION_FAILED;throw R(a,{type:XY.OTP_VERIFICATION_FAILED,message:t}),new Error(t)});d({target:{value:{contact:t,otpPrefix:w,type:_,state:"verified",additionalData:n?.additionalData??n?.data?.additionalData}}})},sendOtpError:(()=>{if("sent"===O)return;if(i?.type===XY.IS_EMAIL_VALID||i?.type===XY.IS_PHONE_NUMBER_VALID||i?.type===XY.SEND_OTP_FAILED)return i?.message;return k.isSubmitted&&$>M.current&&i?.type===XY.IS_OTP_VERIFIED?i?.message:void 0})(),verifyOtpError:(()=>{if("sent"!==O)return;return i?.type===XY.IS_OTP_VERIFIED&&$>x.current||i?.type===XY.OTP_VERIFICATION_FAILED||i?.type===XY.API_ERROR?i?.message:void 0})(),otpValue:{value:b,...w&&{prefix:w},...y&&{prefixSeparator:y}},onOtpChange:e=>{F(a),E(e)},...void 0!==h.placeholder&&{sendOtpPlaceholder:h.placeholder},...void 0!==A&&{verifyOtpCountdownTimer:A},...void 0!==m.showThumbnail&&{showVerifyOtpThumbnail:m.showThumbnail},...void 0!==m.title&&{verifyOtpTitle:m.title},...void 0!==m.message&&{verifyOtpMessage:m.message}};return t(n,{children:[e(X.OtpVerification,"email"===_?{...B,type:"email",emailValue:T,onEmailChange:e=>{M.current=$,F(a),d({target:{value:{...c,contact:e}}})}}:{...B,type:"phone-number",phoneNumberValue:I,onPhoneNumberChange:e=>{M.current=$,F(a);let t=e.number;e.number||(t=""),d({target:{value:{...c,contact:t}}})},fixedCountry:!0}),e(b$,{id:a,message:f})]})},get EOtpVerificationErrorType(){return XY},NestedMultiSelect:r=>{const{schema:{label:i,validation:a,options:s=[],...c},id:l,value:d,formattedLabel:p,onChange:h,onBlur:m,error:g,warning:A}=r,{setValue:y}=He(),{setFieldValidationConfig:_}=UP(),[v,b]=o(d),[E,w]=o([]),S=f(e=>{const t=[],n=(e,r)=>{for(const i in e){const a=[...r,i],o=e[i];"string"==typeof o?t.push(a):n(o,a)}};return n(e,[]),t},[]);u(()=>{const e=a?.find(e=>"required"in e);_(l,sI().test("is-required",e?.errorMessage||Yg.COMMON.REQUIRED_OPTION,t=>!e?.required||!!t&&!!Object.keys(t).length),a)},[a]),js(()=>{const e=(t,n)=>{const r={};for(const i of t){const{key:t,subItems:a}=i,o=n[t];if(o){const n="string"==typeof o?o:e(a||[],o);Object.keys(n).length?r[t]=n:delete r[t]}}return r},t=d?e(s,d):d;y(l,t)},[s]),u(()=>{b(d);const e=S(d);w(e)},[S,v,d]);return t(n,{children:[e(X.NestedMultiSelect,{...c,id:l,"data-testid":wS.generateId(l),label:p,options:s,onSelectOptions:(e,t)=>{const n=((e,t)=>{const n={};return e.forEach((e,r)=>{e.reduce((n,i,a)=>(a===e.length-1?n[i]=t[r]:n[i]||(n[i]={}),n[i]),n)}),n})(e,t);h({target:{value:n}})},onBlur:m,selectedKeyPaths:E,errorMessage:g?.message}),e(b$,{id:l,message:A})]})},RadioButtonGroup:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:l,value:d,warning:f}=r,{commonSchema:{customOptions:p,validation:h},customSchema:{className:m,disabled:g,options:y,..._}}=YC(l),{setValue:v}=He(),[b,E]=o(d||""),{setFieldValidationConfig:w}=UP();u(()=>{w(s,VO(),h)},[h]),Us(()=>{y.find(e=>e.value===d)||v(s,"")},[y]),u(()=>{E(d||"")},[d]);const S=e=>{c({target:{value:e}})},C=e=>b===e,x=()=>{const e=Hg();return`${s}-${e}`},M=t=>"string"==typeof t?e(c$,{inline:!0,children:t}):e(mV,{children:t});return t(n,{children:[e(X.CustomField,{id:s,label:a,errorMessage:i?.message,children:e("div",{role:"radiogroup",tabIndex:0,children:(()=>{switch(p?.styleType){case"toggle":return y.length>0&&"toggle"===p.styleType&&e(aV,{className:m?`${m} ${m}-radio-container`:void 0,$layoutType:p?.layoutType??"horizontal",children:y.map((t,n)=>{const r=x();return A(oV,{..._,key:n,type:"radio",id:r,className:m?`${m}-radio`:void 0,"data-testid":wS.generateId(s,"radio"),disabled:g??t.disabled,focusableWhenDisabled:g,name:r,indicator:p?.indicator,styleType:!1===p?.border?"no-border":"default",checked:C(t.value),onChange:()=>S(t.value),error:!!i?.message,compositeSection:t.children?{children:e(mV,{children:t.children}),collapsible:!1}:null,subLabel:!!t.subLabel&&M(t.subLabel)},M(t.label))})});case"image-button":return y.length>0&&e(iV,{className:m?`${m} ${m}-radio-container`:void 0,children:y.map((e,t)=>{const n=x();return A(nV,{..._,type:"button",key:t,id:n,className:m?`${m}-radio`:void 0,"data-testid":wS.generateId(s,"radio"),disabled:g??e.disabled,focusableWhenDisabled:g,name:n,selected:C(e.value),onClick:()=>S(e.value),imgSrc:e.imgSrc,error:!!i?.message},e.label)})});default:return y.length>0&&y.map((n,r)=>{const i=x();return t(rV,{className:m?`${m}-radio-container`:void 0,children:[e(tV,{..._,className:m,id:i,"data-testid":wS.generateId(s,"radio"),disabled:g??n.disabled,focusableWhenDisabled:g,name:i,value:n.value,checked:C(n.value),onChange:()=>S(n.value)}),e(eV,{forwardedAs:"label",htmlFor:i,disabled:g??n.disabled,children:M(n.label)})]},r)})}})()})}),e(b$,{id:s,message:f})]})},RangeSelect:r=>{const{error:i,formattedLabel:a,id:c,onBlur:l,onChange:d,schema:f,value:p={from:void 0,to:void 0},warning:h}=r,{commonSchema:{validation:m},customSchema:{options:g,...A}}=YC(f),{setValue:y}=He(),[_,v]=o(p.from||""),[b,E]=o(p.to||""),{setFieldValidationConfig:w}=UP(),S=s(!1);u(()=>{const e=m?.find(e=>"required"in e);w(c,sI().shape({from:VO(),to:VO()}).test("is-empty-string",e?.errorMessage||Yg.COMMON.REQUIRED_OPTIONS,t=>!t||!e?.required||t.from?.length>0&&t.to?.length>0),m)},[m]),Us(()=>{const e={};g.from.find(e=>e.value===p.from)||(e.from=""),g.to.find(e=>e.value===p.to)||(e.to=""),y(c,{...p,...e})},[g]),u(()=>{E(p.from),v(p.to)},[p]);return t(n,{children:[e(X.RangeSelect,{...A,id:c,onHideOptions:()=>{S.current?S.current=!1:p.from&&p.to||d({target:{value:{from:void 0,to:void 0}}})},onBlur:l,"data-testid":wS.generateId(c),label:a,options:g,onSelectOption:e=>{void 0===e.from&&void 0===e.to&&d({target:{value:{from:void 0,to:void 0}}}),e.from&&d({target:{value:{from:e.from.value,to:void 0}}}),e.to&&(S.current=!0,d({target:{value:{to:e.to.value,from:b}}}))},selectedOptions:{from:g.from.find(({value:e})=>e===b),to:g.to.find(({value:e})=>e===_)},valueToStringFunction:e=>`${e.from} - ${e.to}`,valueExtractor:e=>({from:e.value,to:e.value}),displayValueExtractor:e=>e.label,listExtractor:e=>e.label,errorMessage:i?.message}),e(b$,{id:c,message:h})]})},ResetButton:t=>{const{id:n,schema:r}=t,{commonSchema:{label:i},customSchema:{disabled:a,ignoreDefaultValues:o,...s}}=YC(r),{reset:u,getValues:c}=He(),{resetFields:l}=ZP(),{formSchema:{defaultValues:d}}=BP();return e(k.Default,{...s,disabled:a,"data-testid":n,id:n,type:"reset",onClick:()=>{if(o){const e=c();Object.entries(e).forEach(([t,n])=>{gi(n)?e[t]=[]:yz(n)||N$(n)?e[t]="":si(n)&&(e[t]={})}),u(e),l(e)}else u(),l(d)},children:i})},Select:r=>{const{error:i,formattedLabel:a,id:s,onBlur:c,onChange:l,schema:d,value:f,warning:p}=r,{commonSchema:{validation:h},customSchema:{options:m,...g}}=YC(d),{setValue:A}=He(),[y,_]=o(f||""),{setFieldValidationConfig:v}=UP();u(()=>{v(s,VO(),h)},[h]),Us(()=>{m.find(e=>e.value===f)||A(s,"")},[m]),u(()=>{_(f||"")},[f]);return t(n,{children:[e(X.Select,{...g,id:s,"data-testid":wS.generateId(s,"select"),label:a,errorMessage:i?.message,options:m,onBlur:c,onSelectOption:(e,t)=>{l({target:{value:t}})},selectedOption:m.find(({value:e})=>e===y),displayValueExtractor:e=>e.label,valueExtractor:e=>e.value,listExtractor:e=>e.label}),e(b$,{id:s,message:p})]})},SelectHistogram:r=>{const{error:i,formattedLabel:a,id:s,onBlur:c,onChange:l,schema:{label:d,validation:f,disabled:p,readOnly:h,className:m,histogramSlider:g,customOptions:A},value:y,warning:_}=r,{bins:v,interval:b,...E}=g,{resetField:w}=He(),[S,C]=o([0,0]),{setFieldValidationConfig:x}=UP();u(()=>{if(y)C([y.from,y.to]);else{const e=Math.min(...v.map(e=>e.minValue)),t=Math.max(...v.map(e=>e.minValue))+b;w(s,{defaultValue:{from:e,to:t},keepDirty:!0}),C([e,t])}},[y]),u(()=>{const e=f?.find(e=>"required"in e),t=f?.find(e=>"bin"in e&&e.bin),n=f?.find(e=>"incremental"in e&&e.incremental),r=f?.find(e=>"withinRange"in e&&e.withinRange);x(s,sI({from:HO(),to:HO()}).test("is-required",e?.errorMessage||Yg.COMMON.REQUIRED_OPTIONS,t=>!t||!e||!SS(t.from)&&!SS(t.to)).test("is-bin",t?.errorMessage||Yg.SLIDER.MUST_BE_INCREMENTAL,e=>{if(!e||"number"!=typeof e.from||"number"!=typeof e.to)return!0;const{from:t,to:n}=e,r=Math.min(...v.map(e=>e.minValue));return Number.isInteger((t-r)/b)&&Number.isInteger((n-r)/b)}).test("is-incremental",n?.errorMessage||Yg.SLIDER.MUST_BE_INCREMENTAL,e=>!e||"number"!=typeof e.from||"number"!=typeof e.to||e.from<e.to).test("is-within-range",r?.errorMessage||Yg.SLIDER.MUST_BE_INCREMENTAL,e=>{if(!e||"number"!=typeof e.from||"number"!=typeof e.to)return!0;const{from:t,to:n}=e,r=Math.min(...v.map(e=>e.minValue)),i=Math.max(...v.map(e=>e.minValue))+b;return!(t<r||n>i)}),f)},[f,v,b]);return t(n,{children:[e(X.SelectHistogram,{id:s,"data-testid":wS.generateId(s,"select-histogram"),label:a,errorMessage:i?.message,onBlur:c,onChangeEnd:e=>{const[t,n]=e;l({target:{value:{from:t,to:n}}})},disabled:p,readOnly:h,className:m,rangeLabelPrefix:A?.rangeLabelPrefix,rangeLabelSuffix:A?.rangeLabelSuffix,value:S,histogramSlider:{bins:v,interval:b,...E}}),e(b$,{id:s,message:_})]})},Slider:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{label:l,customOptions:d,validation:f,disabled:p,readOnly:h,className:m,ariaLabel:g},value:A,warning:y}=r,[_,v]=o(),{setFieldValidationConfig:b}=UP();u(()=>{const e=f?.find(e=>"min"in e),t=f?.find(e=>"max"in e),n=f?.find(e=>"increment"in e);b(s,HO().test("is-incremental",n?.errorMessage||Yg.SLIDER.MUST_BE_INCREMENTAL,t=>{if("number"!=typeof t||!n)return!0;const r=n.increment,i=(e?.min??0)-t;return Number.isInteger(i/r)}),f),(e||t||n)&&v({min:e?.min,max:t?.max,step:n?.increment})},[f]);return t(n,{children:[e(X.Slider,{...d,..._,id:s,"data-testid":wS.generateId(s,"slider"),label:a,errorMessage:i?.message,onChangeEnd:e=>{c({target:{value:e}})},value:A,disabled:p,readOnly:h,className:m,ariaLabel:g}),e(b$,{id:s,message:y})]})},SubmitButton:t=>{const{id:n,schema:r}=t,{commonSchema:{label:i},customSchema:{disabled:a,...s}}=YC(r),{submitHandler:c,wrapInForm:l}=GP(),{setFieldValidationConfig:d}=UP(),{hardValidationSchema:f}=WP(),p=at({disabled:"invalid-form"!==a}),[h,m]=o(!0===a);u(()=>{d(n,$O())},[]),u(()=>{"invalid-form"!==a&&m(!!a)},[a]),Us(()=>{(async()=>{if("invalid-form"===a)try{await f.validate(p),m(!1)}catch(e){m(!0)}})()},[p,f]);return e(k.Default,{...s,disabled:h,"data-testid":n,id:n,onClick:e=>{l||(e.preventDefault(),c?.())},type:"submit",children:i})},Switch:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:l,value:d,warning:f}=r,{commonSchema:{customOptions:p,label:h,validation:m},customSchema:{className:g,disabled:A,...y}}=YC(l),[_,v]=o(d||void 0),{setFieldValidationConfig:b}=UP();u(()=>{b(s,zO().strict(),m)},[m]),u(()=>{v(d)},[d]);const E=e=>{c({target:{value:e}})},w=e=>_===e,S=e=>`${s}-${e}`;return t(n,{children:[e(X.CustomField,{id:s,label:a,errorMessage:i?.message,children:t(sV,{className:g,role:"radiogroup","aria-label":"string"==typeof h?h:u$(h.mainLabel,{allowedTags:[]}),children:[e(te,{...y,type:"yes",id:S("yes"),"data-testid":wS.generateId(s,"switch-yes"),disabled:A,styleType:!1===p?.border?"no-border":"default",checked:w(!0),onChange:()=>E(!0),indicator:!0,name:s,error:!!i?.message,children:"Yes"}),e(te,{...y,type:"no",id:S("no"),"data-testid":wS.generateId(s,"switch-no"),disabled:A,styleType:!1===p?.border?"no-border":"default",checked:w(!1),onChange:()=>E(!1),indicator:!0,name:s,error:!!i?.message,children:"No"})]})}),e(b$,{id:s,message:f})]})},TextField:r=>{const{error:i,formattedLabel:a,id:c,onBlur:l,onChange:d,value:f,schema:p,warning:h}=r,{commonSchema:{customOptions:m,uiType:g,validation:A},customSchema:{inputMode:y,..._}}=YC(p),[v,b]=o(f??""),[E,w]=o({}),{setFieldValidationConfig:S}=UP(),C=s(null),x=s(0);u(()=>{switch(g){case"numeric-field":{const e=A?.find(e=>"decimals"in e);let t=HO();void 0!==e?.decimals&&(t=t.test("decimals",e.errorMessage||Yg.NUMERIC.INVALID_DECIMALS(e.decimals),t=>{if(null==t)return!0;const n=String(t).split(".")[1];return!n||n.length<=e.decimals})),S(c,t,A);const n=A?.find(e=>"min"in e),r=A?.find(e=>"max"in e),i={...E};n?.min>0&&(i.min=n.min),r?.max>0&&(i.max=r.max),w(i);break}case"email-field":{const e=A?.find(e=>e.email);S(c,VO().email(e?.errorMessage||Yg.EMAIL.INVALID),A);const t=A?.find(e=>"max"in e),n=A?.find(e=>"length"in e),r={...E};t?.max>0?r.maxLength=t.max:n?.length>0&&(r.maxLength=n.length),w(r);break}case"text-field":{S(c,VO(),A);const e=A?.find(e=>"max"in e),t=A?.find(e=>"length"in e),n={...E};e?.max>0?n.maxLength=e.max:t?.length>0&&(n.maxLength=t.length),w(n);break}}},[A]),u(()=>{f!==v&&b(f??"")},[f]),u(()=>{"text-field"===g&&document?.activeElement===C.current&&C.current.selectionEnd!==x.current&&C.current.setSelectionRange(x.current,x.current)},[v]),u(()=>{"text-field"===p.uiType&&"uppercase"===p.customOptions?.textTransform&&v&&b(e=>e?.toString().toUpperCase())},["text-field"===p.uiType&&p.customOptions?.textTransform]);const M=()=>!!m?.addOn,O=M()?X.InputGroup:X.Input;return t(n,{children:[e(O,{..._,...E,id:c,"data-testid":wS.generateId(c,g),ref:C,type:(()=>{switch(g){case"numeric-field":return"number";case"email-field":return"email";default:return"text"}})(),label:a,onBlur:l,onPaste:e=>{const t=e.clipboardData.getData("text");(m?.preventCopyAndPaste||"numeric-field"===g&&/e/i.test(t))&&e.preventDefault()},onDrop:e=>m?.preventDragAndDrop?e.preventDefault():null,inputMode:(()=>{if(y)return y;switch(g){case"numeric-field":return"numeric";case"email-field":return"email";case"text-field":return"text";default:return"none"}})(),onChange:e=>{if("numeric-field"===g){const t=A?.find(e=>"decimals"in e);if(void 0!==t?.decimals){const[n,r]=e.target.value.split(".");r&&r.length>t.decimals&&(e.target.value=`${n}.${r.slice(0,t.decimals)}`)}const n=!isNaN(parseFloat(e.target.value))?+e.target.value:void 0;return d({target:{value:n}}),void b(n??"")}"text-field"===p.uiType?(x.current=e.target.selectionEnd,"uppercase"===p.customOptions?.textTransform&&(e.target.value=e.target.value.toUpperCase()),d(e)):d(e),b(e.target.value)},onKeyDown:e=>{"numeric-field"===g&&"e"===e.key.toLowerCase()&&e.preventDefault()},value:v,errorMessage:i?.message,addon:(()=>{if(M()){if("label"===m.addOn.type)return{type:"label",position:m.addOn.position,attributes:{value:m.addOn.value}};if("icon"===m.addOn.type){const{icon:t,position:n,color:r}=m.addOn,i=Y[t];return{type:"custom",position:n,attributes:{children:e(uV,{as:i,$color:r})}}}}})()}),e(b$,{id:c,message:h})]})},Textarea:oB,TimeField:r=>{const{error:i,formattedLabel:a,id:s,onBlur:c,onChange:l,schema:d,value:f,warning:p}=r,{commonSchema:{validation:h},customSchema:{is24HourFormat:m,placeholder:g,useCurrentTime:A,...y}}=YC(d),[_,v]=o(f||""),{setFieldValidationConfig:b}=UP();u(()=>{b(s,VO(),h)},[h]),u(()=>{if(A&&!f){const e=m?"H:mm":"h:mma";setTimeout(()=>E(e))}else v(f)},[f,A,m]);const E=e=>{const t=Vg.formatDateTime(qf.now().toString().toUpperCase(),e,"time");v(t),l({target:{value:t}})};return t(n,{children:[e(X.Timepicker,{...y,id:s,"data-testid":wS.generateId(s,"time"),label:a,errorMessage:i?.message,value:_,placeholder:g,format:m?"24hr":"12hr",onBlur:c,onChange:e=>{l({target:{value:e}})}}),e(b$,{id:s,message:p})]})},get EFieldType(){return cV},UnitNumberField:r=>{const{formattedLabel:i,error:a,id:s,onBlur:c,onChange:l,schema:d,value:f,warning:p}=r,{commonSchema:{validation:h},customSchema:m}=YC(d),[g,A]=o(f||""),{setFieldValidationConfig:y}=UP();u(()=>{const e=h?.find(e=>"unitNumberFormat"in e);y(s,VO().matches(/^([a-zA-Z0-9]{1,3}-[a-zA-Z0-9]{1,5})$/,{excludeEmptyString:!0,message:e?.errorMessage||Yg.UNIT_NUMBER.INVALID}),h)},[h]),u(()=>{A(f||"")},[f]);return t(n,{children:[e(X.UnitNumberInput,{...m,id:s,"data-testid":wS.generateId(s,"unit-number"),label:i,value:g,onBlur:c,onChange:e=>{l({target:{value:e}})},errorMessage:a?.message}),e(b$,{id:s,message:p})]})}});const dV=({id:t,children:r,childSchema:i})=>{if("columns"in i){if((a=i.columns)&&("xxs"in a||"xs"in a||"sm"in a||"md"in a||"lg"in a||"xl"in a||"xxl"in a)){const{xxs:n,xs:a,sm:o,md:s,lg:u,xl:c,xxl:l,...d}=i.columns||{};return e(z.ColDiv,{"data-testid":wS.generateId(t,"grid_item"),xlCols:c,lgCols:u,mdCols:s,smCols:o,xsCols:a,xxlCols:l,xxsCols:n,...d,children:r})}const{desktop:n,tablet:o,mobile:s,...u}=i.columns||{};return e(me.ColDiv,{"data-testid":wS.generateId(t,"grid_item"),desktopCols:n??12,tabletCols:o,mobileCols:s,...u,children:r})}var a;return e(n,{children:r})},fV=({id:t,renderRules:r,children:i,schema:a})=>{const{formValidationConfig:s,removeFieldValidationConfig:u}=UP(),[c,l]=o(void 0),{formValues:d}=ZP(),{unregister:f}=He();js(()=>{if(bS(r))return;const e=p();if(e!==c){if(!e){[t,...h(a)].forEach(e=>{u(e),f(e)})}l(e)}},[s,d,r]);const p=()=>{if(bS(r))return!0;let e=!1;return r.forEach(t=>{if(!e){const n={};Object.entries(t).forEach(([e,t])=>{if(t.find(e=>e.shown)&&!s?.[e])return void(n[e]={schema:$O().test("shown",()=>!1),validationRules:[]});const r=s?.[e]?.schema.type;if(r){let i=S$.mapSchemaType(r);"number"===r&&(i=i.nullable().transform((e,t)=>!isNaN(parseFloat(t?.toString()))?+t:void 0)),n[e]={schema:i,validationRules:t}}});const r=S$.buildSchema(n);try{r.validateSync(d),e=!0}catch(e){}}}),e},h=e=>{const n=e.children,r=[];switch(e.uiType){case"chips":r.push(t+"-textarea");break;case"checkbox":case"radio":e.options.forEach(e=>{const t=e.children;!bS(t)&&Ln(t)&&Object.entries(t).forEach(([e,t])=>{r.push(e),t.children&&r.push(...h(t.children))})})}return bS(n)||!Ln(n)||Object.entries(n).forEach(([e,t])=>{r.push(e),t.children&&r.push(...h(t.children))}),r};return bS(r)||c?e(n,{children:i}):null},pV=Object.keys(cV),hV=Object.keys(az),mV=t=>{const{id:r,schema:i,children:a}=t,{showIf:s,uiType:u,children:c,...l}=i||{},{warnings:d}=WP(),[f,p]=o(null),{control:h}=He(),{getCustomComponent:m}=j$(),{formSchema:{overrides:A},overrideSchema:y}=BP();G$(()=>{const t=y(c||a,A);if("object"==typeof t){const n=[];Object.keys(t).forEach(r=>{const i=t[r];if(bS(i)||"object"!=typeof i)return;let a=e(g,{children:Yg.GENERIC.UNSUPPORTED},r);if("referenceKey"in i){const t=i.referenceKey.toUpperCase();a=m(i.referenceKey)||Mz[xz[t]]?_(r,i)(v):Mz[Cz[t]]?_(r,i)(b):e(g,{},r)}else"uiType"in i&&(pV.includes(i.uiType.toUpperCase())?a=_(r,i)(v):hV.includes(i.uiType.toUpperCase())&&(a=_(r,i)(b)));n.push(a)}),p(n)}else p("string"==typeof t?t:Yg.GENERIC.UNSUPPORTED)},[c||a,A,h,d,m]);const _=(t,n)=>r=>e(fV,{id:t,...n&&"showIf"in n&&{renderRules:n.showIf},schema:n,children:r(t,n)},t),v=(t,n)=>{let r;return"uiType"in n?r=lV[cV[n.uiType?.toUpperCase()]]:"referenceKey"in n&&(r=Mz[xz[n.referenceKey?.toUpperCase()]]||m(n.referenceKey)),r?e(dV,{id:t,childSchema:n,children:e(eB,{id:t,schema:n,Field:r,warning:d?.[t]})}):null},b=(t,n)=>{let r;return"uiType"in n?r=oz[az[n.uiType?.toUpperCase()]]||mV:"referenceKey"in n&&(r=Mz[Cz[n.referenceKey?.toUpperCase()]]),e(dV,{id:t,childSchema:n,children:e(r,{schema:n,id:t})})};return u?e(u,{...l,id:r,"data-testid":wS.generateId(r,u),children:f}):e(n,{children:f})},gV=I(z.Container)`
|
|
1135
1135
|
gap: ${w["spacing-32"]};
|
|
1136
1136
|
`,AV=I(z.Container)`
|
|
1137
1137
|
gap: ${w["spacing-32"]};
|
|
@@ -1147,5 +1147,5 @@ object-assign
|
|
|
1147
1147
|
}
|
|
1148
1148
|
`,yV=I.div`
|
|
1149
1149
|
flex: 1;
|
|
1150
|
-
`,_V=t=>{const{sectionSchema:{children:n,layoutType:r,customOptions:i={gridType:"v2"}},...a}=t;switch(r){case"grid":return(()=>{const t="v3"===i.gridType?gV:AV,r="v3"===i.gridType?"grid":"flex";return e(z.Section,{children:e(t,{type:r,children:e(mV,{...a,children:n})})})})();case"contain":return e(z.Content,{children:e(yV,{children:e(mV,{...a,children:n})})});default:return e(mV,{...a,children:n})}},vV=()=>{const{formSchema:{sections:r,overrides:i},overrideSchema:a}=BP();return e(n,{children:(()=>{const o=a(r,i);return o?Object.entries(o).map(([t,n],r)=>e(_V,{id:t,sectionSchema:n},`section-${r}`)):t(n,{children:["Unable to render Frontend Engine schema, make sure schema is declared within ",e("code",{children:"sections"}),"."]})})()})},bV=h((r,a)=>{const{data:c,className:l=null,components:d,onSubmit:p,onSubmitError:h,wrapInForm:g=!0}=r,{className:A=null,defaultValues:y,id:_,stripUnknown:v,revalidationMode:b="onChange",validationMode:E="onTouched"}=c||{},{addFieldEventListener:w,dispatchFieldEvent:S,removeFieldEventListener:C}=Y$(),{setCustomComponents:x}=j$(),{setSubmitHandler:M,setWrapInForm:O}=GP(),{addWarnings:T,performSoftValidation:I,softValidationSchema:D,hardValidationSchema:N,rebuildValidationSchema:L,yupId:k}=WP(),R=function(e={}){const t=i.useRef(void 0),n=i.useRef(void 0),[r,a]=i.useState({isDirty:!1,isValidating:!1,isLoading:pt(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:pt(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...jt(e),formState:r});const o=t.current.control;return o._options=e,tt({subject:o._subjects.state,next:e=>{Je(e,o._proxyFormState,o._updateFormState,!0)&&a({...o._formState})}}),i.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),i.useEffect(()=>{if(o._proxyFormState.isDirty){const e=o._getDirty();e!==r.isDirty&&o._subjects.state.next({isDirty:e})}},[o,r.isDirty]),i.useEffect(()=>{e.values&&!Tt(e.values,n.current)?(o._reset(e.values,o._options.resetOptions),n.current=e.values,a(e=>({...e}))):o._resetDefaultValues()},[e.values,o]),i.useEffect(()=>{e.errors&&o._setErrors(e.errors)},[e.errors,o]),i.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),i.useEffect(()=>{e.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})},[e.shouldUnregister,o]),t.current.formState=qe(r,o),t.current}({mode:E,reValidateMode:b,defaultValues:y,resolver:async(e,t,n)=>(I(D,e),await function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),function(r,i,a){try{return Promise.resolve(function(o,s){try{var u=(t.context&&"development"===process.env.NODE_ENV&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(e["sync"===n.mode?"validateSync":"validate"](r,Object.assign({abortEarly:!1},t,{context:i}))).then(function(e){return a.shouldUseNativeValidation&&Yt({},a),{values:n.rawValues?r:e,errors:{}}}))}catch(e){return s(e)}return u&&u.then?u.then(void 0,s):u}(0,function(e){if(!e.inner)throw e;return{values:{},errors:Vt((t=e,n=!a.shouldUseNativeValidation&&"all"===a.criteriaMode,(t.inner||[]).reduce(function(e,t){if(e[t.path]||(e[t.path]={message:t.message,type:t.type}),n){var r=e[t.path].types,i=r&&r[t.type];e[t.path]=st(t.path,n,e,t.type,i?[].concat(i,t.message):t.message)}return e},{})),a)};var t,n}))}catch(e){return Promise.reject(e)}}}(N)(e,t,n))}),{setFormSchema:F}=BP(),{reset:$,handleSubmit:P,getValues:z,setValue:B,setError:Z,trigger:U,formState:j,clearErrors:G}=R,{resetFields:Y,setFields:V,getFormValues:W,registeredFields:H}=ZP(R),K=s(H),{checkIsFormValid:q}=((e,t)=>{const{data:n,onChange:r,onValueChange:i}=e,{stripUnknown:a}=n||{},{hardValidationSchema:c}=WP(),{formValidationConfig:l}=UP(),{watch:d,getValues:p,formState:h,clearErrors:m}=t,{setFields:g,setField:A,getFormValues:y}=ZP(t),[_,v]=o({}),[b,E]=o(!1),w=VP(l),S=VP(c),C=s(void 0),x=s(void 0),M=f((e=!1)=>{if(!e)try{return c.validateSync(p()),!0}catch(e){return!1}return(async()=>{try{return await c.validate(p()),!0}catch(e){return!1}})()},[p,c]),O=s(async()=>{});return O.current=async()=>{const e=y(void 0,a),t=await M(!0);i&&Object.keys(l||{}).length&&(x.current===t&&T$(C.current,e)||i(e,t)),C.current=e,x.current=t},u(()=>{const e=d((e,{name:t})=>{t?A(t,e[t]):g(e)});return()=>e.unsubscribe()},[]),u(()=>{if(r&&Object.keys(l||{}).length){const e=d(async()=>{const e=await M(!0);r(y(void 0,a),e)});return M(!0).then(e=>r(y(void 0,a),e)),()=>e.unsubscribe()}},[M,r,d,l]),u(()=>{const e=d(async()=>{await O.current()});return()=>e.unsubscribe()},[d]),u(()=>{if(w){const e=e=>Object.entries(e).map(([e,{validationRules:t}])=>[e,t]),t=e(w),n=e(l);T$(t,n)||E(!0)}},[l]),u(()=>{b&&S!==c&&O.current().then(()=>E(!1))},[b,c]),u(()=>{const e=h.errors;if(e&&!bS(e)){const e=d(e=>{const t=Object.fromEntries(Object.entries(h.errors).filter(([e,t])=>"api"===t.type));t&&!bS(t)&&Object.keys(t).forEach(t=>{_[t]!==e[t]&&m(t)}),v(e)});return()=>e.unsubscribe()}},[h,d]),{checkIsFormValid:M}})(r,R);m(a,()=>({addFieldEventListener:w,addCustomValidation:Q,dispatchFieldEvent:S,getValues:e=>W(e,v),isDirty:j.isDirty,isValid:q,validate:U,removeFieldEventListener:C,reset:(e,t)=>{$(e,t),Y("function"==typeof e?e(R.getValues())??y:e??y)},setErrors:ee,clearErrors:G,setWarnings:te,setValue:B,submit:P(J,X)}));const Q=(e,t,n,r=!1)=>{S$.addCondition(e,t,n,k,r),L()},J=f(()=>{p?.(W(void 0,v))},[W,p,v]),X=f(e=>{setTimeout(()=>h?.(e))},[h]),ee=e=>{Object.entries(e).forEach(([e,t])=>{K.current.includes(e)&&(Array.isArray(t)?Z(e,{type:"api",message:t[0]}):Z(e,"object"==typeof t?{type:"api",message:JSON.stringify(t)}:{type:"api",message:t}))})},te=e=>{const t={};Object.entries(e).forEach(([e,n])=>{K.current.includes(e)&&(t[e]=n)}),T(t)};u(()=>{V(z())},[]),js(()=>{$(Fs(y))},[y]),Us(()=>{F(c)},[c||{}]),u(()=>{x(d)},[d]),u(()=>{M(()=>P(J,X))},[J,X]),u(()=>{O(g)},[g]),u(()=>{K.current=H},[H]);const ne=_?`frontend-engine-${_}`:"frontend-engine",re=[l,A].join(" ").trim(),ie=g?"form":"div";return c?e(Ke,{...R,children:e(ie,{id:ne,"data-testid":_?wS.generateId(_,"frontend-engine"):ne,className:re,noValidate:!0,onSubmit:P(J,X),ref:a,children:e(vV,{})})}):t(n,{children:["Missing ",e("code",{children:"data"})," prop, unable to render Frontend Engine."]})}),EV=h((t,n)=>e(U$,{recaptchaSiteKey:t.recaptchaSiteKey,children:e(bV,{...t,ref:n})}));export{zl as A,SI as D,GU as E,ZU as F,JY as G,jw as I,m$ as L,g$ as O,xI as P,tu as R,c$ as S,wS as T,He as a,Y$ as b,Gg as c,Yg as d,WU as e,
|
|
1151
|
-
//# sourceMappingURL=index.
|
|
1150
|
+
`,_V=t=>{const{sectionSchema:{children:n,layoutType:r,customOptions:i={gridType:"v2"}},...a}=t;switch(r){case"grid":return(()=>{const t="v3"===i.gridType?gV:AV,r="v3"===i.gridType?"grid":"flex";return e(z.Section,{children:e(t,{type:r,children:e(mV,{...a,children:n})})})})();case"contain":return e(z.Content,{children:e(yV,{children:e(mV,{...a,children:n})})});default:return e(mV,{...a,children:n})}},vV=()=>{const{formSchema:{sections:r,overrides:i},overrideSchema:a}=BP();return e(n,{children:(()=>{const o=a(r,i);return o?Object.entries(o).map(([t,n],r)=>e(_V,{id:t,sectionSchema:n},`section-${r}`)):t(n,{children:["Unable to render Frontend Engine schema, make sure schema is declared within ",e("code",{children:"sections"}),"."]})})()})},bV=h((r,a)=>{const{data:c,className:l=null,components:d,onSubmit:p,onSubmitError:h,wrapInForm:g=!0}=r,{className:A=null,defaultValues:y,id:_,stripUnknown:v,revalidationMode:b="onChange",validationMode:E="onTouched"}=c||{},{addFieldEventListener:w,dispatchFieldEvent:S,removeFieldEventListener:C}=Y$(),{setCustomComponents:x}=j$(),{setSubmitHandler:M,setWrapInForm:O}=GP(),{addWarnings:T,performSoftValidation:I,softValidationSchema:D,hardValidationSchema:N,rebuildValidationSchema:L,yupId:k}=WP(),R=function(e={}){const t=i.useRef(void 0),n=i.useRef(void 0),[r,a]=i.useState({isDirty:!1,isValidating:!1,isLoading:pt(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:pt(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...jt(e),formState:r});const o=t.current.control;return o._options=e,tt({subject:o._subjects.state,next:e=>{Je(e,o._proxyFormState,o._updateFormState,!0)&&a({...o._formState})}}),i.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),i.useEffect(()=>{if(o._proxyFormState.isDirty){const e=o._getDirty();e!==r.isDirty&&o._subjects.state.next({isDirty:e})}},[o,r.isDirty]),i.useEffect(()=>{e.values&&!Tt(e.values,n.current)?(o._reset(e.values,o._options.resetOptions),n.current=e.values,a(e=>({...e}))):o._resetDefaultValues()},[e.values,o]),i.useEffect(()=>{e.errors&&o._setErrors(e.errors)},[e.errors,o]),i.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),i.useEffect(()=>{e.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})},[e.shouldUnregister,o]),t.current.formState=qe(r,o),t.current}({mode:E,reValidateMode:b,defaultValues:y,resolver:async(e,t,n)=>(I(D,e),await function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),function(r,i,a){try{return Promise.resolve(function(o,s){try{var u=(t.context&&"development"===process.env.NODE_ENV&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(e["sync"===n.mode?"validateSync":"validate"](r,Object.assign({abortEarly:!1},t,{context:i}))).then(function(e){return a.shouldUseNativeValidation&&Yt({},a),{values:n.rawValues?r:e,errors:{}}}))}catch(e){return s(e)}return u&&u.then?u.then(void 0,s):u}(0,function(e){if(!e.inner)throw e;return{values:{},errors:Vt((t=e,n=!a.shouldUseNativeValidation&&"all"===a.criteriaMode,(t.inner||[]).reduce(function(e,t){if(e[t.path]||(e[t.path]={message:t.message,type:t.type}),n){var r=e[t.path].types,i=r&&r[t.type];e[t.path]=st(t.path,n,e,t.type,i?[].concat(i,t.message):t.message)}return e},{})),a)};var t,n}))}catch(e){return Promise.reject(e)}}}(N)(e,t,n))}),{setFormSchema:F}=BP(),{reset:$,handleSubmit:P,getValues:z,setValue:B,setError:Z,trigger:U,formState:j,clearErrors:G}=R,{resetFields:Y,setFields:V,getFormValues:W,registeredFields:H}=ZP(R),K=s(H),{checkIsFormValid:q}=((e,t)=>{const{data:n,onChange:r,onValueChange:i}=e,{stripUnknown:a}=n||{},{hardValidationSchema:c}=WP(),{formValidationConfig:l}=UP(),{watch:d,getValues:p,formState:h,clearErrors:m}=t,{setFields:g,setField:A,getFormValues:y}=ZP(t),[_,v]=o({}),[b,E]=o(!1),w=VP(l),S=VP(c),C=s(void 0),x=s(void 0),M=f((e=!1)=>{if(!e)try{return c.validateSync(p()),!0}catch(e){return!1}return(async()=>{try{return await c.validate(p()),!0}catch(e){return!1}})()},[p,c]),O=s(async()=>{});return O.current=async()=>{const e=y(void 0,a),t=await M(!0);i&&Object.keys(l||{}).length&&(x.current===t&&T$(C.current,e)||i(e,t)),C.current=e,x.current=t},u(()=>{const e=d((e,{name:t})=>{t?A(t,e[t]):g(e)});return()=>e.unsubscribe()},[]),u(()=>{if(r&&Object.keys(l||{}).length){const e=d(async()=>{const e=await M(!0);r(y(void 0,a),e)});return M(!0).then(e=>r(y(void 0,a),e)),()=>e.unsubscribe()}},[M,r,d,l]),u(()=>{const e=d(async()=>{await O.current()});return()=>e.unsubscribe()},[d]),u(()=>{if(w){const e=e=>Object.entries(e).map(([e,{validationRules:t}])=>[e,t]),t=e(w),n=e(l);T$(t,n)||E(!0)}},[l]),u(()=>{b&&S!==c&&O.current().then(()=>E(!1))},[b,c]),u(()=>{const e=h.errors;if(e&&!bS(e)){const e=d(e=>{const t=Object.fromEntries(Object.entries(h.errors).filter(([e,t])=>"api"===t.type));t&&!bS(t)&&Object.keys(t).forEach(t=>{_[t]!==e[t]&&m(t)}),v(e)});return()=>e.unsubscribe()}},[h,d]),{checkIsFormValid:M}})(r,R);m(a,()=>({addFieldEventListener:w,addCustomValidation:Q,dispatchFieldEvent:S,getValues:e=>W(e,v),isDirty:j.isDirty,isValid:q,validate:U,removeFieldEventListener:C,reset:(e,t)=>{$(e,t),Y("function"==typeof e?e(R.getValues())??y:e??y)},setErrors:ee,clearErrors:G,setWarnings:te,setValue:B,submit:P(J,X)}));const Q=(e,t,n,r=!1)=>{S$.addCondition(e,t,n,k,r),L()},J=f(()=>{p?.(W(void 0,v))},[W,p,v]),X=f(e=>{setTimeout(()=>h?.(e))},[h]),ee=e=>{Object.entries(e).forEach(([e,t])=>{K.current.includes(e)&&(Array.isArray(t)?Z(e,{type:"api",message:t[0]}):Z(e,"object"==typeof t?{type:"api",message:JSON.stringify(t)}:{type:"api",message:t}))})},te=e=>{const t={};Object.entries(e).forEach(([e,n])=>{K.current.includes(e)&&(t[e]=n)}),T(t)};u(()=>{V(z())},[]),js(()=>{$(Fs(y))},[y]),Us(()=>{F(c)},[c||{}]),u(()=>{x(d)},[d]),u(()=>{M(()=>P(J,X))},[J,X]),u(()=>{O(g)},[g]),u(()=>{K.current=H},[H]);const ne=_?`frontend-engine-${_}`:"frontend-engine",re=[l,A].join(" ").trim(),ie=g?"form":"div";return c?e(Ke,{...R,children:e(ie,{id:ne,"data-testid":_?wS.generateId(_,"frontend-engine"):ne,className:re,noValidate:!0,onSubmit:P(J,X),ref:a,children:e(vV,{})})}):t(n,{children:["Missing ",e("code",{children:"data"})," prop, unable to render Frontend Engine."]})}),EV=h((t,n)=>e(U$,{recaptchaSiteKey:t.recaptchaSiteKey,children:e(bV,{...t,ref:n})}));export{zl as A,SI as D,GU as E,ZU as F,JY as G,jw as I,m$ as L,g$ as O,xI as P,tu as R,c$ as S,wS as T,He as a,Y$ as b,Gg as c,Yg as d,WU as e,qU as f,Hg as g,Wt as h,p$ as i,h$ as j,Wg as k,l$ as l,HP as m,jP as n,EV as o,az as p,cV as q,VP as u};
|
|
1151
|
+
//# sourceMappingURL=index.44b5e2a5.js.map
|