@opengis/form 0.0.120 → 0.0.122
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/dist/index-DSzdDC6o.js +8575 -0
- package/dist/index.css +1 -1
- package/dist/index.js +37 -9312
- package/dist/index.umd.cjs +48 -3
- package/dist/src/components/behavior.vue.d.ts.map +1 -0
- package/dist/{components/layouts → src/components/container-views}/index.d.ts.map +1 -1
- package/dist/src/components/container-views/vs-container-accordion.vue.d.ts.map +1 -0
- package/dist/src/components/container-views/vs-container-default.vue.d.ts.map +1 -0
- package/dist/src/components/container-views/vs-container-switcher.vue.d.ts.map +1 -0
- package/dist/src/components/form/vs-compact-form-navigation.vue.d.ts.map +1 -0
- package/dist/src/components/form/vs-compact-form.vue.d.ts.map +1 -0
- package/dist/src/components/icons/icon-no-data.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/address/vs-input-address.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/array/vs-input-array.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/array-select/vs-input-array-select.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-color.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-email.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-mask.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-number.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-password.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-range.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-static.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-switcher.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-tel.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-text.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-textarea.vue.d.ts.map +1 -0
- package/dist/{components → src/components}/inputs/date/datepicker/Datepicker.vue.d.ts +16 -4
- package/dist/src/components/inputs/date/datepicker/Datepicker.vue.d.ts.map +1 -0
- package/dist/{components → src/components}/inputs/date/datepicker/DayPicker.vue.d.ts +4 -1
- package/dist/src/components/inputs/date/datepicker/DayPicker.vue.d.ts.map +1 -0
- package/dist/{components → src/components}/inputs/date/datepicker/MonthPicker.vue.d.ts +4 -1
- package/dist/src/components/inputs/date/datepicker/MonthPicker.vue.d.ts.map +1 -0
- package/dist/{components → src/components}/inputs/date/datepicker/PickerPopup.vue.d.ts +4 -1
- package/dist/src/components/inputs/date/datepicker/PickerPopup.vue.d.ts.map +1 -0
- package/dist/{components → src/components}/inputs/date/datepicker/Timepicker.vue.d.ts +4 -1
- package/dist/src/components/inputs/date/datepicker/Timepicker.vue.d.ts.map +1 -0
- package/dist/{components → src/components}/inputs/date/datepicker/YearPicker.vue.d.ts +4 -1
- package/dist/src/components/inputs/date/datepicker/YearPicker.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/date/datepicker/types.d.ts.map +1 -0
- package/dist/src/components/inputs/date/vs-date-text.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/date/vs-input-date.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/date/vs-input-date1.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/date/vs-input-date2.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/date/vs-input-time.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/file/vs-input-file-list-item.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/file/vs-input-file.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/file/vs-input-file2.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/file-list/vs-input-file-list.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/file-list/vs-widget-file-info.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/file-list/vs-widget-file-item.vue.d.ts.map +1 -0
- package/dist/{components → src/components}/inputs/index.d.ts +8 -1
- package/dist/{components → src/components}/inputs/index.d.ts.map +1 -1
- package/dist/src/components/inputs/list/vs-input-dataform.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/list/vs-input-datalist.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/map/icons/icon-line.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/map/icons/icon-poligon-rectangle.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/map/icons/icon-poligon.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/map/map-layers.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/map/map-search.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/map/map.d.ts.map +1 -0
- package/dist/src/components/inputs/map/util.d.ts.map +1 -0
- package/dist/src/components/inputs/map/vs-input-map.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/options/checkbox/index.d.ts.map +1 -0
- package/dist/src/components/inputs/options/checkbox/vs-checkbox-buttons.vue.d.ts.map +1 -0
- package/dist/{components → src/components}/inputs/options/checkbox/vs-checkbox-default.vue.d.ts +2 -2
- package/dist/src/components/inputs/options/checkbox/vs-checkbox-default.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/options/checkbox/vs-input-checkbox-item.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/options/checkbox/vs-input-checkbox.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/options/radio/index.d.ts.map +1 -0
- package/dist/src/components/inputs/options/radio/vs-input-radio-buttons.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/options/radio/vs-input-radio-default.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/options/radio/vs-input-radio.vue.d.ts.map +1 -0
- package/dist/{components/inputs/base → src/components/inputs/richtext}/vs-input-richtext.vue.d.ts +2 -0
- package/dist/src/components/inputs/richtext/vs-input-richtext.vue.d.ts.map +1 -0
- package/dist/{components → src/components}/inputs/table/vs-input-datatable.vue.d.ts +2 -2
- package/dist/src/components/inputs/table/vs-input-datatable.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/tag/vs-input-tag.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/vs-input-codegen.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/vs-input-container.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/vs-input-key-value.vue.d.ts.map +1 -0
- package/dist/{components → src/components}/inputs/vs-input-monaco.vue.d.ts +5 -1
- package/dist/src/components/inputs/vs-input-monaco.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/vs-input-select.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/vs-input-slug.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/vs-input-text-array.vue.d.ts.map +1 -0
- package/dist/src/components/layouts/index.d.ts.map +1 -0
- package/dist/src/components/layouts/vs-compact-form-layout.vue.d.ts.map +1 -0
- package/dist/src/components/layouts/vs-layout-default.vue.d.ts.map +1 -0
- package/dist/src/components/layouts/vs-layout-horizontal.vue.d.ts.map +1 -0
- package/dist/src/components/layouts/vs-layout-inline.vue.d.ts.map +1 -0
- package/dist/src/components/layouts/vs-layout-settings.vue.d.ts.map +1 -0
- package/dist/src/components/modal/modal-edit.vue.d.ts.map +1 -0
- package/dist/src/components/ui/vs-calendar.vue.d.ts.map +1 -0
- package/dist/src/components/ui/vs-info-tooltip.vue.d.ts.map +1 -0
- package/dist/src/composables/i18n.d.ts.map +1 -0
- package/dist/src/composables/useForm.d.ts.map +1 -0
- package/dist/src/composables/useLocale.d.ts.map +1 -0
- package/dist/src/composables/useStyle.d.ts.map +1 -0
- package/dist/{index.d.ts → src/index.d.ts} +2 -1
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/plugin/form-plugin.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/index.d.ts +31 -0
- package/dist/src/richtext/components/controls/index.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-align.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-align.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-background-color.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-background-color.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-blockquote.vue.d.ts +11 -0
- package/dist/src/richtext/components/controls/vs-editor-blockquote.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-boldtext.vue.d.ts +11 -0
- package/dist/src/richtext/components/controls/vs-editor-boldtext.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-bullet-list.vue.d.ts +11 -0
- package/dist/src/richtext/components/controls/vs-editor-bullet-list.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-clear-formatting.vue.d.ts +11 -0
- package/dist/src/richtext/components/controls/vs-editor-clear-formatting.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-codeblock.vue.d.ts +11 -0
- package/dist/src/richtext/components/controls/vs-editor-codeblock.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-color.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-color.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-font-family.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-font-family.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-font-size.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-font-size.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-fullscreen.vue.d.ts +9 -0
- package/dist/src/richtext/components/controls/vs-editor-fullscreen.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-heading.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-heading.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-help.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-help.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-highlight.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-highlight.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-history.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-history.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-horizontal-rule.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-horizontal-rule.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-image.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-image.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-italic.vue.d.ts +11 -0
- package/dist/src/richtext/components/controls/vs-editor-italic.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-link.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-link.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-ordered-list.vue.d.ts +11 -0
- package/dist/src/richtext/components/controls/vs-editor-ordered-list.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-strike.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-strike.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-subscript.vue.d.ts +11 -0
- package/dist/src/richtext/components/controls/vs-editor-subscript.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-superscript.vue.d.ts +11 -0
- package/dist/src/richtext/components/controls/vs-editor-superscript.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-tab.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-tab.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-table.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-table.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-type-tag.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-type-tag.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-underline.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-underline.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/shared-components/vs-dialog.vue.d.ts +68 -0
- package/dist/src/richtext/components/shared-components/vs-dialog.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/shared-components/vs-form-color-picker.vue.d.ts +179 -0
- package/dist/src/richtext/components/shared-components/vs-form-color-picker.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/shared-components/vs-popover.vue.d.ts +33 -0
- package/dist/src/richtext/components/shared-components/vs-popover.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/shared-components/vs-text.vue.d.ts +135 -0
- package/dist/src/richtext/components/shared-components/vs-text.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/vs-markdown-richtext.vue.d.ts +17 -0
- package/dist/src/richtext/components/vs-markdown-richtext.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/vs-richtext.vue.d.ts +15 -0
- package/dist/src/richtext/components/vs-richtext.vue.d.ts.map +1 -0
- package/dist/src/richtext/composables/contentFormat.d.ts +5 -0
- package/dist/src/richtext/composables/contentFormat.d.ts.map +1 -0
- package/dist/src/richtext/locales.d.ts +132 -0
- package/dist/src/richtext/locales.d.ts.map +1 -0
- package/dist/src/schema.d.ts.map +1 -0
- package/dist/{types → src/types}/form.d.ts +1 -1
- package/dist/src/types/form.d.ts.map +1 -0
- package/dist/{types → src/types}/rules.d.ts.map +1 -1
- package/dist/src/utils/convertForm.d.ts.map +1 -0
- package/dist/src/utils/dateHelper.d.ts.map +1 -0
- package/dist/src/utils/dynamicPosition.d.ts.map +1 -0
- package/dist/src/utils/file.api.d.ts.map +1 -0
- package/dist/src/utils/file.preview.d.ts +3 -0
- package/dist/src/utils/file.preview.d.ts.map +1 -0
- package/dist/src/utils/formConditions.d.ts.map +1 -0
- package/dist/src/utils/formRules.d.ts.map +1 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/randomId.d.ts.map +1 -0
- package/dist/vs-richtext-DgknNuKW.js +3005 -0
- package/locales/en.json +34 -0
- package/locales/uk.json +34 -0
- package/package.json +16 -12
- package/dist/components/behavior.vue.d.ts.map +0 -1
- package/dist/components/container-views/index.d.ts.map +0 -1
- package/dist/components/container-views/vs-container-accordion.vue.d.ts.map +0 -1
- package/dist/components/container-views/vs-container-default.vue.d.ts.map +0 -1
- package/dist/components/container-views/vs-container-switcher.vue.d.ts.map +0 -1
- package/dist/components/form/vs-compact-form-navigation.vue.d.ts.map +0 -1
- package/dist/components/form/vs-compact-form.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-arrow-top-bottom.vue.d.ts +0 -3
- package/dist/components/icons/icon-arrow-top-bottom.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-check.vue.d.ts +0 -3
- package/dist/components/icons/icon-check.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-chevron-down.vue.d.ts +0 -3
- package/dist/components/icons/icon-chevron-down.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-chevron-top-bottom.vue.d.ts +0 -3
- package/dist/components/icons/icon-chevron-top-bottom.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-close.vue.d.ts +0 -3
- package/dist/components/icons/icon-close.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-copy.vue.d.ts +0 -3
- package/dist/components/icons/icon-copy.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-csv.vue.d.ts +0 -3
- package/dist/components/icons/icon-csv.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-delete.vue.d.ts +0 -3
- package/dist/components/icons/icon-delete.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-download.vue.d.ts +0 -3
- package/dist/components/icons/icon-download.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-export.vue.d.ts +0 -3
- package/dist/components/icons/icon-export.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-file.vue.d.ts +0 -3
- package/dist/components/icons/icon-file.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-geojson.vue.d.ts +0 -3
- package/dist/components/icons/icon-geojson.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-grip-vertical.vue.d.ts +0 -3
- package/dist/components/icons/icon-grip-vertical.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-import.vue.d.ts +0 -3
- package/dist/components/icons/icon-import.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-info.vue.d.ts +0 -3
- package/dist/components/icons/icon-info.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-magnifying-glass.vue.d.ts +0 -3
- package/dist/components/icons/icon-magnifying-glass.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-no-data.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-pdf.vue.d.ts +0 -3
- package/dist/components/icons/icon-pdf.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-pen.vue.d.ts +0 -3
- package/dist/components/icons/icon-pen.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-plus.vue.d.ts +0 -3
- package/dist/components/icons/icon-plus.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-upload.vue.d.ts +0 -3
- package/dist/components/icons/icon-upload.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-zip.vue.d.ts +0 -3
- package/dist/components/icons/icon-zip.vue.d.ts.map +0 -1
- package/dist/components/icons/index.d.ts +0 -6
- package/dist/components/icons/index.d.ts.map +0 -1
- package/dist/components/inputs/address/vs-input-address.vue.d.ts.map +0 -1
- package/dist/components/inputs/array/vs-input-array.vue.d.ts.map +0 -1
- package/dist/components/inputs/array-select/vs-input-array-select.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-color.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-email.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-mask.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-number.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-password.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-range.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-richtext.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-static.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-switcher.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-tel.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-text.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-textarea.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/datepicker/Datepicker.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/datepicker/DayPicker.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/datepicker/MonthPicker.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/datepicker/PickerPopup.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/datepicker/Timepicker.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/datepicker/YearPicker.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/datepicker/types.d.ts.map +0 -1
- package/dist/components/inputs/date/vs-date-text.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/vs-input-date.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/vs-input-date1.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/vs-input-date2.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/vs-input-time.vue.d.ts.map +0 -1
- package/dist/components/inputs/file/vs-input-file-list-item.vue.d.ts.map +0 -1
- package/dist/components/inputs/file/vs-input-file.vue.d.ts.map +0 -1
- package/dist/components/inputs/file/vs-input-file2.vue.d.ts.map +0 -1
- package/dist/components/inputs/file-list/vs-input-file-list.vue.d.ts.map +0 -1
- package/dist/components/inputs/file-list/vs-widget-file-info.vue.d.ts.map +0 -1
- package/dist/components/inputs/file-list/vs-widget-file-item.vue.d.ts.map +0 -1
- package/dist/components/inputs/list/vs-input-dataform.vue.d.ts.map +0 -1
- package/dist/components/inputs/list/vs-input-datalist.vue.d.ts.map +0 -1
- package/dist/components/inputs/map/icons/icon-compass.vue.d.ts +0 -3
- package/dist/components/inputs/map/icons/icon-compass.vue.d.ts.map +0 -1
- package/dist/components/inputs/map/icons/icon-full-screen.vue.d.ts +0 -3
- package/dist/components/inputs/map/icons/icon-full-screen.vue.d.ts.map +0 -1
- package/dist/components/inputs/map/icons/icon-line.vue.d.ts.map +0 -1
- package/dist/components/inputs/map/icons/icon-map-pin.vue.d.ts +0 -3
- package/dist/components/inputs/map/icons/icon-map-pin.vue.d.ts.map +0 -1
- package/dist/components/inputs/map/icons/icon-poligon-rectangle.vue.d.ts.map +0 -1
- package/dist/components/inputs/map/icons/icon-poligon.vue.d.ts.map +0 -1
- package/dist/components/inputs/map/map-layers.vue.d.ts.map +0 -1
- package/dist/components/inputs/map/map-search.vue.d.ts.map +0 -1
- package/dist/components/inputs/map/map.d.ts.map +0 -1
- package/dist/components/inputs/map/util.d.ts.map +0 -1
- package/dist/components/inputs/map/vs-input-map.vue.d.ts.map +0 -1
- package/dist/components/inputs/options/checkbox/index.d.ts.map +0 -1
- package/dist/components/inputs/options/checkbox/vs-checkbox-buttons.vue.d.ts.map +0 -1
- package/dist/components/inputs/options/checkbox/vs-checkbox-default.vue.d.ts.map +0 -1
- package/dist/components/inputs/options/checkbox/vs-input-checkbox-item.vue.d.ts.map +0 -1
- package/dist/components/inputs/options/checkbox/vs-input-checkbox.vue.d.ts.map +0 -1
- package/dist/components/inputs/options/radio/index.d.ts.map +0 -1
- package/dist/components/inputs/options/radio/vs-input-radio-buttons.vue.d.ts.map +0 -1
- package/dist/components/inputs/options/radio/vs-input-radio-default.vue.d.ts.map +0 -1
- package/dist/components/inputs/options/radio/vs-input-radio.vue.d.ts.map +0 -1
- package/dist/components/inputs/table/vs-input-datatable.vue.d.ts.map +0 -1
- package/dist/components/inputs/tag/vs-input-tag.vue.d.ts.map +0 -1
- package/dist/components/inputs/vs-input-codegen.vue.d.ts.map +0 -1
- package/dist/components/inputs/vs-input-container.vue.d.ts.map +0 -1
- package/dist/components/inputs/vs-input-key-value.vue.d.ts.map +0 -1
- package/dist/components/inputs/vs-input-monaco.vue.d.ts.map +0 -1
- package/dist/components/inputs/vs-input-select.vue.d.ts.map +0 -1
- package/dist/components/inputs/vs-input-slug.vue.d.ts.map +0 -1
- package/dist/components/inputs/vs-input-text-array.vue.d.ts.map +0 -1
- package/dist/components/layouts/vs-compact-form-layout.vue.d.ts.map +0 -1
- package/dist/components/layouts/vs-layout-default.vue.d.ts.map +0 -1
- package/dist/components/layouts/vs-layout-horizontal.vue.d.ts.map +0 -1
- package/dist/components/layouts/vs-layout-inline.vue.d.ts.map +0 -1
- package/dist/components/layouts/vs-layout-settings.vue.d.ts.map +0 -1
- package/dist/components/modal/modal-edit.vue.d.ts.map +0 -1
- package/dist/components/ui/vs-calendar.vue.d.ts.map +0 -1
- package/dist/components/ui/vs-info-tooltip.vue.d.ts.map +0 -1
- package/dist/composables/i18n.d.ts.map +0 -1
- package/dist/composables/useForm.d.ts.map +0 -1
- package/dist/composables/useLocale.d.ts.map +0 -1
- package/dist/composables/useStyle.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/plugin/form-plugin.d.ts.map +0 -1
- package/dist/schema.d.ts.map +0 -1
- package/dist/types/form.d.ts.map +0 -1
- package/dist/utils/convertForm.d.ts.map +0 -1
- package/dist/utils/dateHelper.d.ts.map +0 -1
- package/dist/utils/dynamicPosition.d.ts.map +0 -1
- package/dist/utils/file.api.d.ts.map +0 -1
- package/dist/utils/file.preview.d.ts +0 -3
- package/dist/utils/file.preview.d.ts.map +0 -1
- package/dist/utils/formConditions.d.ts.map +0 -1
- package/dist/utils/formRules.d.ts.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/randomId.d.ts.map +0 -1
- /package/dist/{components → src/components}/behavior.vue.d.ts +0 -0
- /package/dist/{components → src/components}/container-views/index.d.ts +0 -0
- /package/dist/{components → src/components}/container-views/vs-container-accordion.vue.d.ts +0 -0
- /package/dist/{components → src/components}/container-views/vs-container-default.vue.d.ts +0 -0
- /package/dist/{components → src/components}/container-views/vs-container-switcher.vue.d.ts +0 -0
- /package/dist/{components → src/components}/form/vs-compact-form-navigation.vue.d.ts +0 -0
- /package/dist/{components → src/components}/form/vs-compact-form.vue.d.ts +0 -0
- /package/dist/{components → src/components}/icons/icon-no-data.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/address/vs-input-address.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/array/vs-input-array.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/array-select/vs-input-array-select.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-color.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-email.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-mask.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-number.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-password.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-range.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-static.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-switcher.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-tel.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-text.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-textarea.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/date/datepicker/types.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/date/vs-date-text.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/date/vs-input-date.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/date/vs-input-date1.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/date/vs-input-date2.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/date/vs-input-time.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/file/vs-input-file-list-item.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/file/vs-input-file.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/file/vs-input-file2.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/file-list/vs-input-file-list.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/file-list/vs-widget-file-info.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/file-list/vs-widget-file-item.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/list/vs-input-dataform.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/list/vs-input-datalist.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/map/icons/icon-line.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/map/icons/icon-poligon-rectangle.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/map/icons/icon-poligon.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/map/map-layers.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/map/map-search.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/map/map.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/map/util.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/map/vs-input-map.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/options/checkbox/index.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/options/checkbox/vs-checkbox-buttons.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/options/checkbox/vs-input-checkbox-item.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/options/checkbox/vs-input-checkbox.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/options/radio/index.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/options/radio/vs-input-radio-buttons.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/options/radio/vs-input-radio-default.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/options/radio/vs-input-radio.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/tag/vs-input-tag.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/vs-input-codegen.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/vs-input-container.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/vs-input-key-value.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/vs-input-select.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/vs-input-slug.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/vs-input-text-array.vue.d.ts +0 -0
- /package/dist/{components → src/components}/layouts/index.d.ts +0 -0
- /package/dist/{components → src/components}/layouts/vs-compact-form-layout.vue.d.ts +0 -0
- /package/dist/{components → src/components}/layouts/vs-layout-default.vue.d.ts +0 -0
- /package/dist/{components → src/components}/layouts/vs-layout-horizontal.vue.d.ts +0 -0
- /package/dist/{components → src/components}/layouts/vs-layout-inline.vue.d.ts +0 -0
- /package/dist/{components → src/components}/layouts/vs-layout-settings.vue.d.ts +0 -0
- /package/dist/{components → src/components}/modal/modal-edit.vue.d.ts +0 -0
- /package/dist/{components → src/components}/ui/vs-calendar.vue.d.ts +0 -0
- /package/dist/{components → src/components}/ui/vs-info-tooltip.vue.d.ts +0 -0
- /package/dist/{composables → src/composables}/i18n.d.ts +0 -0
- /package/dist/{composables → src/composables}/useForm.d.ts +0 -0
- /package/dist/{composables → src/composables}/useLocale.d.ts +0 -0
- /package/dist/{composables → src/composables}/useStyle.d.ts +0 -0
- /package/dist/{plugin → src/plugin}/form-plugin.d.ts +0 -0
- /package/dist/{schema.d.ts → src/schema.d.ts} +0 -0
- /package/dist/{types → src/types}/rules.d.ts +0 -0
- /package/dist/{utils → src/utils}/convertForm.d.ts +0 -0
- /package/dist/{utils → src/utils}/dateHelper.d.ts +0 -0
- /package/dist/{utils → src/utils}/dynamicPosition.d.ts +0 -0
- /package/dist/{utils → src/utils}/file.api.d.ts +0 -0
- /package/dist/{utils → src/utils}/formConditions.d.ts +0 -0
- /package/dist/{utils → src/utils}/formRules.d.ts +0 -0
- /package/dist/{utils → src/utils}/index.d.ts +0 -0
- /package/dist/{utils → src/utils}/randomId.d.ts +0 -0
package/dist/index.umd.cjs
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
|
-
(function(ce,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@opengis/core"),require("lucide-vue-next")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core","lucide-vue-next"],e):(ce=typeof globalThis<"u"?globalThis:ce||self,e(ce.FormBuilder={},ce.Vue,ce.OpenGISCore,ce.lucide))})(this,function(ce,e,he,wl){"use strict";const xn=e.defineComponent({__name:"vs-info-tooltip",props:{text:{}},setup(l){const t=l,n=e.ref(!1),a=e.ref({top:"0px",left:"0px"});function o(s){if(!t.text)return;const i=s.currentTarget.getBoundingClientRect();a.value={top:`${i.bottom+4}px`,left:`${Math.min(i.left,window.innerWidth-230)}px`},n.value=!0}function r(){n.value=!1}return(s,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("span",{class:"inline-flex items-center",onMouseenter:o,onMouseleave:r},[e.renderSlot(s.$slots,"default",{},()=>[i[0]||(i[0]=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"text-gray-400 cursor-help"},[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),e.createElementVNode("path",{d:"M12 16v-4"}),e.createElementVNode("path",{d:"M12 8h.01"})],-1))])],32),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[n.value&&s.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(a.value),class:"fixed z-[9999] max-w-xs p-2 bg-gray-900 text-white text-xs rounded-lg shadow-lg pointer-events-none"},e.toDisplayString(s.text),5)):e.createCommentVNode("",!0)]))],64))}}),xl={class:"w-full relative"},_l={key:0,class:"text-[14px] font-medium text-gray-900 mb-2 flex items-center gap-1"},vl={class:"opacity-100"},El={key:0,class:"text-red-500 text-[14px]"},Vl={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Bl=e.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(l){const t=l,n=e.computed(()=>typeof t.item?.label=="string"&&t.item.label?t.item.label:t.item?.ua||t.label||t.ua),a=e.computed(()=>!!n.value),o=e.computed(()=>!!t.item?.rules?.includes("required")),r=e.computed(()=>t.item?.info||"");return(s,i)=>(e.openBlock(),e.createElementBlock("div",xl,[a.value?(e.openBlock(),e.createElementBlock("div",_l,[e.createElementVNode("span",vl,e.toDisplayString(n.value),1),o.value?(e.openBlock(),e.createElementBlock("span",El,"*")):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createBlock(xn,{key:1,text:r.value},null,8,["text"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"default",e.mergeProps(s.$attrs,{class:{"opacity-60":s.item.disabled}})),s.error?(e.openBlock(),e.createElementBlock("span",Vl,e.toDisplayString(s.error),1)):e.createCommentVNode("",!0)]))}}),Cl={class:"w-full relative flex flex-row items-center gap-2"},Sl={key:0,class:"text-red-500 text-[14px]"},Nl={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},$l=e.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{default:()=>({container:12,label:3})}},setup(l){const t=l,n=e.computed(()=>t.item?.label||t.label||t.ua),a=e.computed(()=>t.item?.info||""),o=e.computed(()=>t.columns??{container:12,label:3}),r=e.computed(()=>{const{container:d,label:p}=o.value;return!d||d<=0?0:Math.min(Math.max(p??0,0),d)/d}),s=e.computed(()=>t.item?.type==="html"||r.value<=0?!1:!!n.value),i=e.computed(()=>{if(!s.value)return{};const d=`${r.value*100}%`;return{flexBasis:d,maxWidth:d}}),c=e.computed(()=>{const{container:d,label:p}=o.value;if(!d||d<=0)return{};if(t.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!s.value)return{flexBasis:"100%",maxWidth:"100%"};const g=Math.max(d-Math.max(p??0,0),0)/d;if(!g)return{};const E=`${g*100}%`;return{flexBasis:E,maxWidth:E}});return(d,p)=>(e.openBlock(),e.createElementBlock("div",Cl,[s.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0 items-center gap-1",style:e.normalizeStyle(i.value)},[e.createTextVNode(e.toDisplayString(n.value)+" ",1),d.item?.rules?.includes("required")&&n.value?(e.openBlock(),e.createElementBlock("span",Sl,"*")):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createBlock(xn,{key:1,text:a.value},null,8,["text"])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"flex-1 min-w-0",style:e.normalizeStyle(c.value)},[e.renderSlot(d.$slots,"default",e.normalizeProps(e.guardReactiveProps(d.$attrs)))],4),d.error?(e.openBlock(),e.createElementBlock("span",Nl,e.toDisplayString(d.error),1)):e.createCommentVNode("",!0)]))}}),Ml={class:"w-full relative"},Dl={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Al=e.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",Ml,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),t.error?(e.openBlock(),e.createElementBlock("span",Dl,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}}),Fl={class:"flex-1 min-w-0"},Il={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},Ll={class:"truncate"},Tl={key:0,class:"text-red-500 text-[14px]"},Ol=["innerHTML"],zl={key:0,class:"mt-1 text-xs text-red-500"},Rl={default:Bl,horizontal:$l,inline:Al,settings:e.defineComponent({__name:"vs-layout-settings",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(l){const t=l,n=e.ref("uk");e.computed(()=>(t.item??{})?.[n.value]??t.ua??t.label??"");const a=e.computed(()=>t.item?.description??""),o=e.computed(()=>Array.isArray(t.item?.rules)&&t.item.rules.includes("required")),r=e.computed(()=>(typeof t.error=="string"?t.error:"")??""),s=()=>{const i=typeof localStorage<"u"?localStorage.getItem("locale"):null;n.value=i||"uk"};return e.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(n.value=localStorage.locale)}catch{}window.addEventListener("storage",s)}),e.onUnmounted(()=>{window.removeEventListener("storage",s)}),(i,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full relative",{"opacity-60":i.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(i.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",Fl,[i.ua||i.label?(e.openBlock(),e.createElementBlock("p",Il,[e.createElementVNode("span",Ll,e.toDisplayString(i.item[n.value]||i.ua||i.label),1),o.value?(e.openBlock(),e.createElementBlock("span",Tl,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createElementBlock("p",{key:1,class:"text-xs text-slate-500 dark:text-slate-400",innerHTML:a.value},null,8,Ol)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["w-full",["select","native-select"].includes(i.item.type)?"md:w-[30%]":"md:w-auto"])},[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))],2)],2),r.value?(e.openBlock(),e.createElementBlock("p",zl,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0)],2))}})};function De(l){return{inputClass:e.computed(()=>{const n=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${l?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return l?.size==="sm"?`${n}h-[32px]`:`${n}h-[38px]`})}}const jl=["placeholder","disabled"],Pl=e.defineComponent({__name:"vs-input-password",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=De(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??"");return(s,i)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"password","onUpdate:modelValue":i[0]||(i[0]=c=>a.value=c),placeholder:r.value,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":s.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,jl)),[[e.vModelText,a.value]])}}),Ul=["placeholder","disabled","maxlength","minlength"],it=e.defineComponent({__name:"vs-input-text",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=De(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??""),s=e.computed(()=>t.maxlength??void 0),i=e.computed(()=>t.minlength??void 0);function c(){typeof a.value=="string"&&(a.value=a.value.trim())}return(d,p)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"text","onUpdate:modelValue":p[0]||(p[0]=g=>a.value=g),placeholder:r.value,disabled:o.value,maxlength:s.value,minlength:i.value,onBlur:c,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[d.customClass,e.unref(n),{"!border-red-600":d.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Ul)),[[e.vModelText,a.value]])}}),Hl=["placeholder","disabled","min","max"],_n=e.defineComponent({__name:"vs-input-number",props:e.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=De(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled);return(r,s)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":s[0]||(s[0]=i=>a.value=i),placeholder:r.placeholder,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"},min:r.min,max:r.max},null,10,Hl)),[[e.vModelText,a.value]])}}),ae=(l,t)=>{const n=l.__vccOpts||l;for(const[a,o]of t)n[a]=o;return n},ql={},Kl={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function Gl(l,t){return e.openBlock(),e.createElementBlock("svg",Kl,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const Yl=ae(ql,[["render",Gl]]),Wl={class:"flex items-center gap-[4px]"},Zl=["value","id","disabled"],Jl=["for"],Xl={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},Ql=e.defineComponent({__name:"vs-checkbox-default",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},id:{},modelValue:{default:""},info:{},error:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=t,a=l,o=e.computed({get:()=>a.modelValue,set:s=>n("update:modelValue",s)}),r=e.computed(()=>!!a.disabled);return(s,i)=>(e.openBlock(),e.createElementBlock("div",Wl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:s.value,"onUpdate:modelValue":i[0]||(i[0]=c=>o.value=c),class:e.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":r.value}]),id:s.id,disabled:r.value},null,10,Zl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("label",{for:s.id,class:e.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":r.value}])},[e.createElementVNode("div",{class:e.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[o.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",s.error?"border-red-600":""]])},[e.createVNode(Yl,{height:"12",width:"12"})],2),e.createElementVNode("span",Xl,[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(s.label),1)])])],10,Jl)]))}}),ea=["name","value","disabled"],ta={class:"flex items-center gap-[6px] text-[14px]"},na={key:0,class:"text-[16px]"},la=["src"],aa=e.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{default:""},modelValue:{default:""},disabled:{type:Boolean},id:{},icon:{},imgUrl:{},style:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=e.computed({get:()=>n.modelValue,set:i=>{a("update:modelValue",i)}}),r=e.computed(()=>Array.isArray(o.value)?o.value.includes(n.value):o.value===!0||o.value===n.value),s=e.computed(()=>n.style?.size==="xs"?"p-1.5 text-xs":n.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(i,c)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[s.value,r.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"hidden",name:i.id,value:i.value,"onUpdate:modelValue":c[0]||(c[0]=d=>o.value=d),disabled:i.disabled},null,8,ea),[[e.vModelCheckbox,o.value]]),e.createElementVNode("span",ta,[i.icon||i.imgUrl?(e.openBlock(),e.createElementBlock("span",na,[i.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(i.icon)},null,2)):e.createCommentVNode("",!0),i.imgUrl?(e.openBlock(),e.createElementBlock("img",{key:1,src:i.imgUrl,width:"16",height:"16",alt:"icon"},null,8,la)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(i.label),1)])])],2))}}),oa={class:"flex items-center"},Wt=e.defineComponent({__name:"vs-input-checkbox-item",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},view:{default:"default"},modelValue:{type:[Boolean,Array],default:!1},icon:{},imgUrl:{},slots:{},option:{},style:{},error:{default:""}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=`radio-${Math.floor(Math.random()*1e4)}`,r=e.computed({get:()=>Array.isArray(n.modelValue)?Array.isArray(n.modelValue)&&n.modelValue.includes(n.value):n.modelValue,set:i=>{if(Array.isArray(n.modelValue)){let c=[...n.modelValue];i?c.includes(n.value)||c.push(n.value):c=c.filter(d=>d!==n.value),a("update:modelValue",c)}else a("update:modelValue",i)}}),s=e.ref(`vs-checkbox-${n.view||"default"}`);return(i,c)=>(e.openBlock(),e.createElementBlock("div",oa,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value==="vs-checkbox-buttons"?e.unref(aa):e.unref(Ql)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:r.value,"onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),id:o,icon:i.icon,imgUrl:i.imgUrl,style:e.normalizeStyle(i.style),error:i.error},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),ra={},sa={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function ia(l,t){return e.openBlock(),e.createElementBlock("svg",sa,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const Zt=ae(ra,[["render",ia]]),ca={},da={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function ua(l,t){return e.openBlock(),e.createElementBlock("svg",da,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),e.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const St=ae(ca,[["render",ua]]),pa={},ma={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function fa(l,t){return e.openBlock(),e.createElementBlock("svg",ma,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M12 9h.01"},null,-1),e.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),e.createElementVNode("path",{d:"M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z"},null,-1)]))}const ha=ae(pa,[["render",fa]]),ga={key:0,class:"flex items-start gap-x-1"},ya={key:0,class:"text-red-500 text-[14px]"},ka=["title"],ba=["disabled"],Jt=e.defineComponent({__name:"vs-input-switcher",props:e.mergeModels({rules:{default:()=>[]},view:{default:"checkbox"},label:{default:""},i:{default:""},text:{default:""},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue");return(a,o)=>t.view==="checkbox"?(e.openBlock(),e.createElementBlock("div",ga,[e.createVNode(Wt,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=r=>n.value=r),label:a.text,error:a.error||""},null,8,["modelValue","label","error"]),a.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",ya,"*")):e.createCommentVNode("",!0),a.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:a.i,onClick:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(ha),{class:"text-gray-500 w-[14px] h-[14px]"})],8,ka)):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.normalizeClass(["inline-flex h-5 w-9 shrink-0 px-[2px] cursor-pointer items-center rounded-full shadow-sm disabled:cursor-not-allowed disabled:opacity-50",[n.value?`bg-${a.style?.primaryColor||"blue"}-500`:"bg-stone-200",a.customClass]]),disabled:a.disabled,onClick:o[2]||(o[2]=r=>n.value=!n.value)},[e.createElementVNode("span",{"data-state":"checked",class:e.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[n.value?"translate-x-4":"translate-x-0"]])},null,2)],10,ba))}}),wa=["id","innerHTML"],Xt=e.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",{id:t.name,class:e.normalizeClass(["text-gray-900",t.customClass]),innerHTML:t.html?t.html:t.text},null,10,wa))}}),xa=["placeholder","disabled","name"],Qt=e.defineComponent({__name:"vs-input-mask",props:e.mergeModels({name:{},mask:{default:""},unmask:{type:Boolean,default:!1},placeholder:{default:"_"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=De(t.style),a=e.useModel(l,"modelValue"),o=e.ref(null);let r=null;function s(i){const c={9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},d=new Set;let p=!1;for(let E=0;E<i.length;E+=1){const y=i[E];y==="{"?p=!0:y==="}"?p=!1:p&&d.add(y)}const g={};return Object.keys(c).forEach(E=>{d.has(E)||(g[E]=c[E])}),{mask:i,definitions:g,lazy:!1}}return e.onMounted(async()=>{if(o.value){const{default:i}=await Promise.resolve().then(()=>bn),c=s(t.mask||"");r=i(o.value,c),r.on("accept",()=>{a.value=t.unmask?r.unmaskedValue:r.value}),r.on("complete",()=>{a.value=t.unmask?r.unmaskedValue:r.value}),r.value=a.value!=null?String(a.value):""}}),e.onBeforeUnmount(()=>{r?.destroy()}),e.watch(()=>t.mask,i=>{if(r){const c=s(i||"");r.updateOptions(c)}}),e.watch(a,i=>{r&&r.unmaskedValue!==i&&(r.value=i!=null?String(i):"")}),(i,c)=>(e.openBlock(),e.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:o,placeholder:i.placeholder,disabled:i.disabled,name:i.name,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,10,xa))}}),_a={class:"relative w-full bg-white rounded-lg"},va=["placeholder","disabled"],en=e.defineComponent({__name:"vs-input-email",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=De(t.style),a=e.useModel(l,"modelValue");return(o,r)=>(e.openBlock(),e.createElementBlock("div",_a,[r[1]||(r[1]=e.createStaticVNode('<div class="absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="stroke-gray-500 transition-all"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"></path><path d="M3 7l9 6l9 -6"></path></svg></div>',1)),e.withDirectives(e.createElementVNode("input",{type:"email","onUpdate:modelValue":r[0]||(r[0]=s=>a.value=s),placeholder:o.placeholder,disabled:o.disabled,class:e.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,va),[[e.vModelText,a.value]])]))}}),Ea={class:"relative w-full bg-white rounded-lg"},Va=["value","placeholder","disabled"],tn=e.defineComponent({__name:"vs-input-tel",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=De(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>a.value?a.value.startsWith("+")?a.value.slice(1):a.value:""),r=i=>{let{value:c}=i.target;c=c.replace(/^\+/,""),a.value=c?`+${c}`:""},s=i=>{const c=i,{data:d,inputType:p}=c;p&&p.startsWith("delete")||d&&/\D/.test(d)&&c.preventDefault()};return e.watch(()=>a.value,i=>{i&&!i.startsWith("+")?a.value=`+${i.replace(/^\+/,"")}`:i||(a.value="")},{immediate:!0}),(i,c)=>(e.openBlock(),e.createElementBlock("div",Ea,[c[0]||(c[0]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"stroke-gray-500 transition-all"},[e.createElementVNode("path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"})])],-1)),c[1]||(c[1]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[30px] text-gray-500 select-none pointer-events-none"}," + ",-1)),e.createElementVNode("input",{type:"tel",value:o.value,onInput:r,onBeforeinput:s,pattern:"^\\+[1-9]\\d{1,14}$",maxlength:"15",placeholder:i.placeholder,disabled:i.disabled,class:e.normalizeClass(["!pl-10 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":i.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Va)]))}}),Ba=["value","disabled"],Ca={class:"text-[13px] text-gray-700"},Sa=e.defineComponent({__name:"vs-input-radio-default",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>!!t.disabled);return(o,r)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center gap-0",[t.customClass,a.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r[0]||(r[0]=s=>n.value=s),type:"radio",value:t.value,disabled:a.value,class:"hidden"},null,8,Ba),[[e.vModelRadio,n.value]]),e.createElementVNode("span",{class:e.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${t.style?.primaryColor||"blue"}-500`,a.value?"opacity-50 cursor-not-allowed":""]])},[n.value==t.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${t.style?.primaryColor||"blue"}-500`]])},null,2)):e.createCommentVNode("",!0)],2),e.createElementVNode("span",Ca,e.toDisplayString(t.text),1)],2))}}),Na=["value","disabled"],$a={class:"text-[13px] text-gray-700"},Ma={"vs-input-radio-default":Sa,"vs-input-radio-buttons":e.defineComponent({__name:"vs-input-radio-buttons",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>!!t.disabled);return(o,r)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[n.value==t.value?`ring-2 ring-ring ring-${t.style?.primaryColor||"blue"}-500`:"",t.customClass,a.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r[0]||(r[0]=s=>n.value=s),type:"radio",value:t.value,disabled:a.value,class:"hidden"},null,8,Na),[[e.vModelRadio,n.value]]),e.createElementVNode("span",$a,e.toDisplayString(t.text),1)],2))}})},nn=e.defineComponent({__name:"vs-input-radio",props:e.mergeModels({options:{},position:{default:"vertical"},view:{default:"default"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>Ma[`vs-input-radio-${t.view}`]);return(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([o.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,s=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),e.mergeProps({key:s?.id,text:s.text,value:s.id.toString(),checked:n.value===s.id,modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=i=>n.value=i)},{ref_for:!0},o.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),Da={key:1,class:"w-full flex flex-col gap-4"},Aa={key:0,class:"text-sm font-medium text-muted-foreground my-2"},Fa="Без категорії",vn=ae(e.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},group:{default:void 0},values:{default:()=>[]},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=e.ref([]),r=e.reactive({}),s=y=>y?.value||y?.id||y?.text||y,i=y=>y.text||String(y),c=y=>`lg:col-span-${y||12}`,d=e.computed(()=>[n.position==="vertical"?"flex flex-col":"",n.colSpan?"grid":"flex justify-start"]),p=y=>y==null||y===""?null:typeof y=="string"||typeof y=="number"?y:String(y),g=e.computed(()=>{if(!n.group)return[];const y=new Map;o.value.forEach(k=>{const w=k[n.group],b=p(w);y.has(b)||y.set(b,[]),y.get(b)?.push(k)});const V=[];n.values?.length&&n.values.forEach(k=>{const w=p(k);V.push(w)});const f=new Set,h=k=>{const w=y.get(k)||[];if(!w.length)return null;const b=k===null?"group-null":`group-${String(k)}`,B=k===null?Fa:String(k);return f.add(k),{key:b,label:B,options:w}},x=[];return V.forEach(k=>{const w=h(k);w&&x.push(w)}),y.forEach((k,w)=>{if(f.has(w))return;const b=h(w);b&&x.push(b)}),x}),E=async()=>{try{const y=await fetch(`/api/suggest/${n.data}`).then(V=>V.json());o.value=y?.data||y}catch(y){console.error(y)}};return e.watch(()=>n.modelValue,y=>{if(typeof y=="boolean"&&o.value.length===1){const V=s(o.value[0]);r[V]=y}else if(Array.isArray(y)){const V=new Set(y);o.value.forEach(f=>{if(!f.disabled){const h=s(f);r[h]=V.has(h)}})}},{immediate:!0}),e.watch(r,()=>{if(!o.value.length){a("update:modelValue",null);return}const y=Object.entries(r).filter(([,V])=>V).map(([V])=>V);a("update:modelValue",y.length===0?[]:y)},{deep:!0}),e.onMounted(()=>{if(n.data)E().then(()=>{if(typeof n.modelValue=="boolean"&&o.value.length===1){const y=s(o.value[0]);r[y]=n.modelValue}else if(Array.isArray(n.modelValue)){const y=new Set(n.modelValue);o.value.forEach(V=>{if(!V.disabled){const f=s(V);r[f]=y.has(f)}})}});else if(o.value=n.options,typeof n.modelValue=="boolean"&&o.value.length===1){const y=s(o.value[0]);r[y]=n.modelValue}else if(Array.isArray(n.modelValue)){const y=new Set(n.modelValue);o.value.forEach(V=>{if(!V.disabled){const f=s(V);r[f]=y.has(f)}})}}),(y,V)=>n.group?(e.openBlock(),e.createElementBlock("div",Da,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,f=>(e.openBlock(),e.createElementBlock("div",{key:f.key,class:"flex flex-col gap-2"},[f.label?(e.openBlock(),e.createElementBlock("span",Aa,e.toDisplayString(f.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["p-0 w-full gap-[12px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.options,h=>(e.openBlock(),e.createBlock(Wt,{modelValue:r[s(h)],"onUpdate:modelValue":x=>r[s(h)]=x,value:s(h),class:e.normalizeClass(c(y.colSpan)),disabled:n.disabled||h.disabled,label:i(h),key:`${f.key}-${s(h)}`,icon:h?.icon,imgUrl:h?.imgUrl,option:h,view:y.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["p-0 w-full gap-[10px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,f=>(e.openBlock(),e.createBlock(Wt,{modelValue:r[s(f)],"onUpdate:modelValue":h=>r[s(f)]=h,value:s(f),class:e.normalizeClass(c(y.colSpan)),disabled:n.disabled||f.disabled,label:i(f),key:s(f),icon:f?.icon,imgUrl:f?.imgUrl,option:f,view:y.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-8e66207e"]]),Ia=["type","placeholder","disabled"],La=e.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},mode:{default:"date"}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l;function a(p){return p?n.mode==="datetime"?(p.includes("T")?p:null)||p+(p.includes(" ")?"":"T00:00"):p?.split(" ")[0]:null}const{inputClass:o}=De(n.style),r=t,s=e.computed({get:()=>a(n.modelValue),set:p=>r("update:modelValue",p)}),i=e.computed(()=>n.mode==="datetime"?"datetime-local":n.mode),c=e.computed(()=>!!n.disabled),d=e.computed(()=>n.placeholder??"");return(p,g)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:i.value,"onUpdate:modelValue":g[0]||(g[0]=E=>s.value=E),placeholder:d.value,disabled:c.value,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[p.modelValue?"":"text-opacity-50",e.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Ia)),[[e.vModelDynamic,s.value]])}}),Ta=(l,t)=>{if(!t||!Object.keys(t).length)return l;const[n,a=""]=l.split("?"),o=new URLSearchParams(a);Object.entries(t).forEach(([s,i])=>{i==null||i===""||o.set(s,String(i))});const r=o.toString();return r?`${n}?${r}`:n},En=async(l,t={})=>{try{const n=new FormData;n.append("unique","true"),n.append("file",l);const{api:a,id:o="1",form:r="form",table:s="table",customParams:i}=t,c=a||`/file/upload/uploads?id=${o||""}&form=${r||""}&table=${s||""}`,d=Ta(c,i);return(await fetch(d,{method:"POST",body:n}).then(g=>g.json()))?.result}catch(n){return he.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",n),null}},Oa=async l=>{try{return await fetch(`file/delete${l}`),!0}catch(t){return console.error(t),!1}},Vn=async l=>{try{const t=await fetch(`/file/download/files/uploads${l}`),n=await t.arrayBuffer(),a=t.headers["content-type"],o=new TextDecoder("utf-8").decode(n),r=new Blob([o],{type:a}),s=document.createElement("a");s.setAttribute("download",l),s.href=window.URL.createObjectURL(r),s.click()}catch(t){console.error(t.message)}},za={},Ra={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function ja(l,t){return e.openBlock(),e.createElementBlock("svg",Ra,t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 12h14"},null,-1),e.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const Ke=ae(za,[["render",ja]]),Pa={},Ua={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-text",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function Ha(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Ua,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><line x1="9" y1="9" x2="10" y2="9"></line><line x1="9" y1="13" x2="15" y2="13"></line><line x1="9" y1="17" x2="15" y2="17"></line>',6)]))}const qa=ae(Pa,[["render",Ha]]),Ka={},Ga={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-table",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function Ya(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Ga,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),e.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),e.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const Wa=ae(Ka,[["render",Ya]]),Za={},Ja={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Xa(l,t){return e.openBlock(),e.createElementBlock("svg",Ja,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M9 9l1 0"></path><path d="M9 13l6 0"></path><path d="M9 17l6 0"></path>',6)]))}const Bn=ae(Za,[["render",Xa]]),Qa={},eo={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-zip",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function to(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",eo,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 20.735a2 2 0 0 1 -1 -1.735v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-1"></path><path d="M11 17a2 2 0 0 1 2 2v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a2 2 0 0 1 2 -2z"></path><line x1="11" y1="5" x2="10" y2="5"></line><line x1="13" y1="7" x2="12" y2="7"></line><line x1="11" y1="9" x2="10" y2="9"></line><line x1="13" y1="11" x2="12" y2="11"></line><line x1="11" y1="13" x2="10" y2="13"></line><line x1="13" y1="15" x2="12" y2="15"></line>',9)]))}const no=ae(Qa,[["render",to]]),lo={},ao={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-code",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function oo(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",ao,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M10 13l-1 2l1 2"></path><path d="M14 13l1 2l-1 2"></path>',5)]))}const ro=ae(lo,[["render",oo]]),so=l=>{if(!l)return"";const t=l?.split(".");return t[t.length-1]},io=l=>{const t=so(l),n={imageFormat:["tiff","jpg","jpeg","png","svg","ico","webp"],sheetsFormat:["xls","csv","xlsx"],archivesFormat:["zip","rar"],textsFormat:["json","geojson","txt","yml","yaml","shp"],documentsFormat:["pdf"]};return n.imageFormat.includes(t)?"img":n.sheetsFormat.includes(t)?Wa:n.textsFormat.includes(t)?ro:n.documentsFormat.includes(t)?qa:n.archivesFormat.includes(t)?no:Bn},co={},uo={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function po(l,t){return e.openBlock(),e.createElementBlock("svg",uo,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const ct=ae(co,[["render",po]]),mo={},fo={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function ho(l,t){return e.openBlock(),e.createElementBlock("svg",fo,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Cn=ae(mo,[["render",ho]]),go=["title"],yo={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},ln=ae(e.defineComponent({__name:"vs-input-file-list-item",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},api:{},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(l){const t=e.useModel(l,"value"),n=e.useModel(l,"item"),a=l;return(o,r)=>(e.openBlock(),e.createElementBlock("div",{title:n.value,class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(io)(n.value)),{src:n.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:r[0]||(r[0]=s=>e.unref(Vn)(n.value))},null,8,["src"])),e.createElementVNode("div",yo,[e.createElementVNode("button",{type:"button",onClick:r[1]||(r[1]=s=>{e.unref(Oa)(n.value),t.value=a.multiple?t.value?.filter(i=>i!==n.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[e.createVNode(ct,{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:r[2]||(r[2]=s=>e.unref(Vn)(n.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[e.createVNode(Cn,{class:"w-4 h-4"})])])],8,go))}}),[["__scopeId","data-v-286cdbc0"]]),ko={class:"flex items-center gap-x-2"},bo=["accept","multiple","disabled"],wo={key:1,class:"flex items-center flex-wrap gap-2"},xo={key:1,class:"loader"},_o={key:1,class:"loader"},Sn=ae(e.defineComponent({__name:"vs-input-file",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},api:{},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["change"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=e.useModel(l,"modelValue"),o=t,r=e.ref(null),s=e.ref(!1),i=e.inject("values"),c=e.computed(()=>n.format?n.format.split(",").map(k=>k.trim().toLowerCase()).filter(Boolean):[]),d=k=>Array.isArray(a.value)&&a.value[k]||"",p=k=>{if(n.max_size&&k.size>n.max_size*1024*1024){const w=(k.size/1048576).toFixed(2);return he.notify({type:"error",title:"Помилка!",message:`Файл "${k.name}" занадто великий. Максимальний розмір: ${n.max_size} МБ, розмір файлу: ${w} МБ`,position:"right-bottom"}),!1}return!0},g=k=>{if(!c.value.length)return!0;const w=`.${k.name.split(".").pop()?.toLowerCase()||""}`,b=c.value.includes(w);return b||he.notify({type:"error",title:"Помилка!",message:`Неприпустимий формат файлу "${k.name}". Дозволені формати: ${c.value.join(", ")}`,position:"right-bottom"}),b},E=e.computed(()=>{const k={},w=[];if(!n.customParams?.length)return{params:k,missingSources:w};const b=i?.value??{};return n.customParams.forEach(B=>{if(!B)return;const[$,S]=B.split("="),j=$?.trim(),W=S?.trim();if(!j||!W)return;const K=b[W];if(K==null||K===""){w.push(W);return}k[j]=K}),{params:k,missingSources:w}}),y=()=>{const{params:k}=E.value;return{api:n.api,customParams:Object.keys(k).length?k:void 0}},V=()=>{const k=E.value.missingSources;if(!k.length)return!0;const w=k.join(", ");return he.notify({type:"warning",title:"Заповніть поля",message:`Поля (${w}) необхідні для завантаження файлу`,position:"right-bottom"}),!1},f=k=>{he.notify({type:"error",title:"Помилка завантаження",message:k||"Не вдалося завантажити файл. Спробуйте ще раз.",position:"right-bottom"})},h=()=>{n.disabled||s.value||V()&&r.value?.click()},x=async k=>{const{files:w}=k.target;if(!w||w.length===0)return;if(!V()){r.value&&(r.value.value="");return}const b=Array.from(w);if(n.max_size&&b.filter(S=>!p(S)).length>0){r.value&&(r.value.value="");return}if(b.filter($=>!g($)).length>0){r.value&&(r.value.value="");return}s.value=!0;try{if(n.multiple){const $=Array.from(w).map(async K=>await En(K,y())),S=await Promise.all($),W=S.filter(K=>K!==null).map(K=>K?.file_path).filter(Boolean);if(W.length===0){f();return}W.length<S.length&&f("Деякі файли не вдалося завантажити. Перевірте їх та спробуйте знову."),a.value=[...a.value||[],...W],o("change",a.value)}else{const $=w[0],S=await En($,y());if(!S?.file_path){f();return}a.value=S?.file_path,o("change",a.value||"")}}catch($){const S=$?.message||void 0;f(S)}finally{s.value=!1,r.value&&(r.value.value="")}};return(k,w)=>(e.openBlock(),e.createElementBlock("div",ko,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:r,type:"file",accept:n.format,multiple:k.multiple,onChange:x,disabled:s.value||k.disabled},null,40,bo),!k.multiple&&a.value?(e.openBlock(),e.createBlock(ln,{key:0,item:a.value,"onUpdate:item":w[0]||(w[0]=b=>a.value=b),value:a.value,"onUpdate:value":w[1]||(w[1]=b=>a.value=b)},null,8,["item","value"])):k.multiple?(e.openBlock(),e.createElementBlock("div",wo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(b,B)=>(e.openBlock(),e.createBlock(ln,{multiple:k.multiple,key:B,value:a.value,"onUpdate:value":w[2]||(w[2]=$=>a.value=$),item:d(B)},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:h,class:e.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",k.disabled||s.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[s.value?(e.openBlock(),e.createElementBlock("div",xo)):(e.openBlock(),e.createBlock(Ke,{key:0,class:"w-6 h-6"}))],2)])):e.createCommentVNode("",!0),k.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:h,class:e.normalizeClass([k.disabled||s.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center cursor-pointer hover:border-blue-500 transition-all duration-300 hover:bg-blue-50"])},[s.value?(e.openBlock(),e.createElementBlock("div",_o)):(e.openBlock(),e.createBlock(Ke,{key:0,class:"w-6 h-6"}))],2))]))}}),[["__scopeId","data-v-cf6efbaa"]]),vo={class:"vs-input-file2 flex flex-col gap-4"},Eo={class:"flex items-center gap-x-2"},Vo=["accept","disabled"],Bo={key:0,class:"absolute inset-0 flex flex-col items-center justify-center gap-1 rounded-lg bg-white/90 text-xs font-medium text-slate-600"},Co={key:0,class:"rounded-lg border border-[#CFD9E0] bg-white p-4 shadow-sm"},So={class:"flex items-center justify-between text-sm"},No={class:"truncate pr-4"},$o={class:"font-medium text-slate-800 truncate"},Mo={class:"text-slate-500"},Do={class:"text-slate-500 whitespace-nowrap"},Ao={class:"mt-3 h-2 rounded-full bg-slate-100 overflow-hidden"},Fo={class:"mt-3 flex flex-wrap gap-2 text-sm"},Io={key:0,class:"mt-2 text-sm text-rose-600"},Lo=e.defineComponent({__name:"vs-input-file2",props:e.mergeModels({format:{},max_size:{},api:{},chunkSize:{default:5*1024*1024},subdir:{default:""},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref(null),o=e.ref(null),r=e.ref(""),s=e.ref(0),i=e.ref(!1),c=e.ref(""),d=e.ref(null),p=e.inject("values"),g=e.computed(()=>t.format?t.format.split(",").map(z=>z.trim().toLowerCase()).filter(Boolean):[]),E=e.computed(()=>!o.value||!o.value.size?0:Math.min(100,Math.round(s.value/o.value.size*100))),y=e.computed(()=>o.value?`${h(s.value)} / ${h(o.value.size)}`:""),V=e.computed(()=>t.disabled?"opacity-50 cursor-not-allowed":i.value?"cursor-default text-blue-500":"cursor-pointer hover:border-blue-500 hover:bg-blue-50 hover:text-blue-500"),f=()=>{t.disabled||i.value||b()&&a.value?.click()},h=z=>{if(!Number.isFinite(z))return"0 B";const L=["B","KB","MB","GB"];let Z=0,F=z;for(;F>=1024&&Z<L.length-1;)F/=1024,Z+=1;return`${F.toFixed(Z===0?0:1)} ${L[Z]}`},x=z=>{if(!t.max_size)return!0;const L=t.max_size*1024*1024;return z.size>L?(he.notify({type:"error",title:"Файл занадто великий",message:`Максимальний розмір ${t.max_size} МБ`,position:"right-bottom"}),!1):!0},k=z=>{if(!g.value.length)return!0;const L=`.${z.name.split(".").pop()?.toLowerCase()||""}`;return g.value.includes(L)?!0:(he.notify({type:"error",title:"Непідтримуваний формат",message:`Дозволені формати: ${g.value.join(", ")}`,position:"right-bottom"}),!1)},w=e.computed(()=>{const z={},L=[];if(!t.customParams?.length)return{params:z,missing:L};const Z=p?.value??{};return t.customParams.forEach(F=>{if(!F)return;const[A,H]=F.split("="),P=A?.trim(),pe=H?.trim();if(!P||!pe)return;const ke=Z[pe];ke==null||ke===""?L.push(pe):z[P]=ke}),{params:z,missing:L}}),b=()=>w.value.missing.length?(he.notify({type:"warning",title:"Заповніть поля",message:`Потрібні значення: ${w.value.missing.join(", ")}`,position:"right-bottom"}),!1):!0,B=z=>{const L=z.target,Z=L.files?.[0];if(Z){if(!b()){L.value="";return}if(!x(Z)||!k(Z)){L.value="";return}o.value=Z,s.value=0,r.value="",c.value=""}},$=async()=>{if(!o.value){f();return}try{c.value="";const z={id:r.value||"",fileName:o.value.name,subdir:t.subdir,size:o.value.size,...w.value.params},L=await fetch("/api/file/upload2/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(z)});if(!L.ok)throw new Error("Не вдалося ініціалізувати завантаження");const Z=await L.json();r.value=Z.id||r.value,s.value=Z.uploaded||0,await S()}catch(z){c.value=z?.message||"Помилка при старті завантаження"}},S=async()=>{if(!(!o.value||!r.value)){i.value=!0;try{for(;s.value<o.value.size;){const z=s.value,L=Math.min(z+t.chunkSize,o.value.size),Z=o.value.slice(z,L);d.value=new AbortController;const F=await fetch(`/api/file/upload2/${r.value}`,{method:"PATCH",headers:{"Content-Range":`bytes ${z}-${L-1}/${o.value.size}`},body:Z,signal:d.value.signal});if(!F.ok)throw new Error("Помилка завантаження частини");const A=await F.json().catch(()=>({}));if(A.uploaded!=null?s.value=Number(A.uploaded):s.value=L,A.finished||s.value>=o.value.size){i.value=!1,n.value=A.file_path||A.url||r.value,he.notify({type:"success",title:"Файл завантажено",message:o.value.name,position:"right-bottom"}),T();return}}}catch(z){if(z?.name==="AbortError")return;c.value=z?.message||"Помилка при завантаженні",i.value=!1}finally{d.value=null,i.value=!1}}},j=()=>{i.value&&(d.value?.abort(),d.value=null,i.value=!1)},W=async()=>{if(o.value){if(!r.value){await $();return}await S()}},K=()=>{d.value?.abort(),d.value=null,T()},T=()=>{const z=a.value;z&&(z.value=""),o.value=null,r.value="",s.value=0,c.value=""};return(z,L)=>(e.openBlock(),e.createElementBlock("div",vo,[e.createElementVNode("div",Eo,[e.createElementVNode("input",{ref_key:"fileInput",ref:a,type:"file",class:"hidden",accept:t.format,disabled:i.value||t.disabled,onChange:B},null,40,Vo),n.value?(e.openBlock(),e.createBlock(ln,{key:0,item:n.value,"onUpdate:item":L[0]||(L[0]=Z=>n.value=Z),value:n.value,"onUpdate:value":L[1]||(L[1]=Z=>n.value=Z)},null,8,["item","value"])):(e.openBlock(),e.createElementBlock("div",{key:1,onClick:f,class:e.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",V.value])},[i.value?(e.openBlock(),e.createElementBlock("div",Bo,[L[2]||(L[2]=e.createElementVNode("div",{class:"loader"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(E.value)+"%",1)])):(e.openBlock(),e.createBlock(Ke,{key:1,class:"w-6 h-6"}))],2))]),o.value&&!n.value?(e.openBlock(),e.createElementBlock("div",Co,[e.createElementVNode("div",So,[e.createElementVNode("div",No,[e.createElementVNode("div",$o,e.toDisplayString(o.value.name),1),e.createElementVNode("div",Mo,e.toDisplayString(h(o.value.size)),1)]),e.createElementVNode("div",Do,e.toDisplayString(y.value),1)]),e.createElementVNode("div",Ao,[e.createElementVNode("div",{class:"h-full rounded-full bg-blue-500 transition-all duration-300",style:e.normalizeStyle({width:`${E.value}%`})},null,4)]),e.createElementVNode("div",Fo,[!i.value&&s.value>0&&s.value<(o.value?.size||0)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:W}," Resume ")):e.createCommentVNode("",!0),i.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:j}," Pause ")):e.createCommentVNode("",!0),!i.value&&s.value===0?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:$}," Upload ")):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"rounded border border-rose-200 px-3 py-1 text-rose-600",onClick:K}," Cancel ")]),c.value?(e.openBlock(),e.createElementBlock("p",Io,e.toDisplayString(c.value),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),an=ae(Lo,[["__scopeId","data-v-ea9f874f"]]),To={class:"max-w-[55vw]"},Oo={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},zo={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},Ro={class:"px-[5px]"},jo={class:""},Nt=e.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(l){const t=l,n=e.computed(()=>{try{return new Date(t.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function a(o){if(o<1024)return`${o} B`;const r=o/1024;return r<1024?`${r.toFixed(2)} KB`:`${(r/1024).toFixed(2)} MB`}return(o,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[r[1]||(r[1]=e.createStaticVNode('<div class="flex items-center justify-center h-[30px] w-[30px]"><svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-file"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path></svg></div>',1)),e.createElementVNode("div",To,[e.createElementVNode("p",Oo,e.toDisplayString(o.item?.uploaded_name),1),e.createElementVNode("p",zo,[e.createElementVNode("span",null,e.toDisplayString(o.item?.username),1),e.withDirectives(e.createElementVNode("span",Ro,"|",512),[[e.vShow,o.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(n.value),1),r[0]||(r[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",jo,e.toDisplayString(a(o.item?.size)),1)])])],64))}}),Po={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},Uo={key:0,class:"flex w-full gap-x-3 items-center"},Ho={key:1,class:"flex gap-x-3 w-full items-center"},qo={key:2,class:"flex gap-x-3 w-full items-center"},Ko=["href"],Go={key:3,class:"flex gap-x-3 w-full items-center"},Yo={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},Wo={class:"p-0.5 sm:p-1 inline-flex items-center gap-0.5 bg-white rounded-lg dark:bg-neutral-800 dark:border-neutral-700"},Zo={class:"inline-block"},Jo={class:"inline-block"},Xo=e.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(l,{emit:t}){const n=l,a=t;function o(p){return["pdf","json"].includes(p.ext)}function r(p){return["ppt","pptx","doc","docx","xls","xlsx"].includes(p.ext)}function s(p){const g=document.createElement("a");g.setAttribute("download",p?.uploaded_name),g.href=p?.file_path,g.click()}async function i(){try{await fetch(`${n.prefix}/widget/file/${n.item.entity_id}/${n.item.file_id}`),a("update")}catch(p){console.error(p)}}function c(){a("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function d(p){(n.item.ext==="jpg"||n.item.ext==="png")&&a("openLightbox",{item:n.item,index:p})}return(p,g)=>(e.openBlock(),e.createElementBlock("div",Po,[p.item.ext==="jpg"||p.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",Uo,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:g[0]||(g[0]=E=>d(p.index))},[e.createVNode(Nt,{item:p.item},null,8,["item"])])])):o(p.item)?(e.openBlock(),e.createElementBlock("div",Ho,[e.createVNode(Nt,{item:p.item},null,8,["item"])])):r(p.item)?(e.openBlock(),e.createElementBlock("div",qo,[e.createElementVNode("a",{href:`/api/file-preview?id=${p.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(Nt,{item:p.item},null,8,["item"])],8,Ko)])):(e.openBlock(),e.createElementBlock("div",Go,[e.createVNode(Nt,{item:p.item},null,8,["item"])])),e.createElementVNode("div",Yo,[e.createElementVNode("div",Wo,[e.createElementVNode("div",Zo,[e.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:g[1]||(g[1]=E=>s(p.item))},[e.createVNode(Cn,{height:"14",width:"14"})])]),g[3]||(g[3]=e.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),e.createElementVNode("div",Jo,[e.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:g[2]||(g[2]=E=>c())},[e.createVNode(ct,{height:"14",width:"14"})])])])])]))}}),Qo={},er={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function tr(l,t){return e.openBlock(),e.createElementBlock("svg",er,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const nr=ae(Qo,[["render",tr]]),lr={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},ar={class:"flex w-full mb-[12px] items-center gap-x-2"},or={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},rr={class1:"ml-auto"},sr={class:"py-1.5 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg bg-gray-100 cursor-pointer hover:bg-gray-200 text-gray-800 shadow-2xs hover:bg-gray-50 focus:outline-hidden focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},ir={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},cr={class:"relative"},dr={key:1,class:"space-y-3 max-h-[300px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},ur={key:0},Nn=e.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update"],setup(l,{emit:t}){const n=l,a=e.inject("form"),o=e.computed(()=>a.value.formId),r=e.ref(!1),s=e.ref(0),i=t,c=e.ref(!1),d=e.ref({}),p=e.ref([]),g=e.ref(""),E=e.computed(()=>Array.isArray(p.value)?p.value.filter(w=>w.ext==="jpg"||w.ext==="png").map(w=>w?.file_path):[]),y=e.computed(()=>g.value===""?p.value:p.value.filter(w=>w?.uploaded_name?.includes(g.value))),V=w=>{const b=E.value.findIndex(B=>B===w.item.file_path);b!==-1&&(r.value=!0,s.value=b)},f=async()=>{try{const w=await fetch(`${n.prefix}/widget/file/${o.value}`).then(b=>b.json());p.value=w?.rows}catch(w){console.error(w)}},h=async w=>{await Promise.all(Array.from(w.target.files).map(async b=>{const B=new FormData;B.append("file",b);try{const $=`${n.prefix}/widget/file/${o.value}`,S=await fetch($,{method:"POST",body:B});return S.ok?(i("update","file-list"),b):(he.notify({type:S.status>=400&&S.status<500?"warning":"error",title:"Error",message:`Error code: ${S.status}`}),null)}catch($){return he.notify({type:"error",title:"Error",message:$.message||"Unknown error"}),console.error($),null}})),await f()},x=w=>{const b={...w};return w.cancel||(b.cancel=()=>{c.value=!1}),w.updateListOnConfirm&&(b.confirm=async()=>{await w.confirm(),c.value=!1,f()}),b},k=w=>{d.value=x(w),c.value=!0};return e.watch(o,w=>{w&&f()}),e.onMounted(()=>{o.value&&f()}),(w,b)=>{const B=e.resolveComponent("Lightbox"),$=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",lr,[e.createElementVNode("div",ar,[e.createElementVNode("h2",or," Файлів: "+e.toDisplayString(p.value?.length),1),e.createElementVNode("div",rr,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:b[0]||(b[0]=S=>h(S))},null,32),e.createElementVNode("div",sr,[e.createVNode(nr,{height:"16",width:"16"})])])])]),p.value?.length>4?(e.openBlock(),e.createElementBlock("div",ir,[e.createElementVNode("div",null,[e.createElementVNode("div",cr,[b[8]||(b[8]=e.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[e.createElementVNode("svg",{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),e.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":b[1]||(b[1]=S=>g.value=S),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[e.vModelText,g.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),p.value?.length?(e.openBlock(),e.createElementBlock("div",dr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,(S,j)=>(e.openBlock(),e.createBlock(Xo,{key:j,prefix:w.prefix,item:S,index:j,onUpdate:b[2]||(b[2]=W=>w.$emit("update","file-list")),onOpenModal:b[3]||(b[3]=W=>k(W)),onOpenLightbox:b[4]||(b[4]=W=>V(W))},null,8,["prefix","item","index"]))),128)),y.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",ur,b[9]||(b[9]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):e.createCommentVNode("",!0),e.createVNode(B,{modelValue:r.value,"onUpdate:modelValue":b[5]||(b[5]=S=>r.value=S),startIndex:s.value,"onUpdate:index":b[6]||(b[6]=S=>s.value=S),images:E.value},null,8,["modelValue","startIndex","images"]),e.createVNode($,e.mergeProps({modelValue:c.value,"onUpdate:modelValue":b[7]||(b[7]=S=>c.value=S),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),pr={class:"flex items-center justify-between"},mr={class:"text-[16px] text-gray-900 font-medium"},fr={class:"grid gap-3"},hr=ae(e.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(l){const t=l,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,a=>{n.value=a}),(a,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",pr,[e.createElementVNode("p",mr,e.toDisplayString(l.title),1),e.createVNode(Jt,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=r=>n.value=r),style:e.normalizeStyle(l.style)},null,8,["modelValue","style"])]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",fr,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),gr={class:"text-[16px] text-gray-900 font-medium"},yr={class:"grid gap-3"},kr=ae(e.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(l){const t=l,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,a=>{n.value=a}),(a,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("button",{type:"button",onClick:o[0]||(o[0]=r=>n.value=!n.value),class:"flex items-center gap-2"},[e.createVNode(e.unref(Zt),{class:e.normalizeClass(["h-4 w-4 duration-300",[n.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",gr,e.toDisplayString(l.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",yr,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-590eff11"]]),br={class:"flex items-center justify-between"},wr={switcher:hr,accordion:kr,default:e.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",br,[e.createElementVNode("p",null,e.toDisplayString(l.title),1)]),e.renderSlot(t.$slots,"default")]))}})},Oe={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},xr=(l,t)=>String(l)===String(t),_r=(l,t)=>String(l)!==String(t),vr=(l,t)=>l>t,Er=(l,t)=>l>=t,Vr=(l,t)=>l<t,Br=(l,t)=>l<=t,Cr=(l,t)=>Array.isArray(t)&&t.length===2?l>=t[0]&&l<=t[1]:!1,Sr=(l,t)=>String(l).startsWith(String(t)),Nr=(l,t)=>String(l).endsWith(String(t)),$r=(l,t)=>String(l).includes(String(t)),Mr=(l,t)=>Array.isArray(t)?t.includes(l):!1,Dr=(l,t)=>Array.isArray(t)?!t.includes(l):!0,$n=(l,t)=>{if(!t)return!0;switch(t?.[1]){case Oe.Equal:return xr(l,t?.[2]);case Oe.Inequal:return _r(l,t?.[2]);case Oe.Higer:return vr(l,t?.[2]);case Oe.HigerOrEqual:return Er(l,t?.[2]);case Oe.Lower:return Vr(l,t?.[2]);case Oe.LowerOrEqual:return Br(l,t?.[2]);case Oe.Between:return Cr(l,t?.[2]);case Oe.StartWith:return Sr(l,t?.[2]);case Oe.EndWith:return Nr(l,t?.[2]);case Oe.Contain:return $r(l,t?.[2]);case Oe.In:return Mr(l,t?.[2]);case Oe.NotIn:return Dr(l,t?.[2]);default:return!0}},Mn=e.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},name:{type:String,default:""},schema:{type:Array,default:()=>[]}},setup(l){const t=l,n=e.inject("values",e.ref({})),a=e.inject("form"),o=e.computed(()=>t.schema?.filter(i=>{const c=i?.conditions;if(!c)return!0;const d=Array.isArray(c)?c[0]:c,p=t.name?n.value?.[t.name]?.[d]??n.value?.[d]:n.value?.[d];return $n(p,c)})),r=e.computed(()=>wr[t.view]),s=e.computed(()=>{if(n.value||(n.value={}),!t.name)return n.value;const i=n.value[t.name];if(i)return i;const c={};return n.value={...n.value,[t.name]:c},c});return(i,c)=>l.schema?.length?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{key:0,title:l.title,style:e.normalizeStyle(l.style)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,d=>(e.openBlock(),e.createBlock(Yn,e.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:s.value[d.name],"onUpdate:modelValue":p=>s.value[d.name]=p,style:l.style,error:e.unref(a)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),Ar=["aria-expanded","data-focus"],Fr={class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full"},Ir={key:0,class:"flex flex-nowrap items-center gap-1 overflow-x-auto overflow-y-hidden min-w-0 flex-1 py-0.5"},Lr={class:"flex items-center gap-1 min-w-0"},Tr=["title"],Or=["innerHTML"],zr=["onClick"],Rr={class:"flex-1 min-w-[2px]"},jr=["placeholder"],Pr=["title"],Ur=["innerHTML"],Hr={key:3,class:"truncate flex-1 min-w-0"},qr={key:2,class:"flex-1 min-w-[2px]"},Kr=["placeholder"],Gr={class:"flex items-center shrink-0"},Yr=["disabled"],Wr=["disabled","title"],Zr=["aria-disabled","onClick"],Jr=["innerHTML"],Xr={key:1,class:"px-3 py-2 text-center text-gray-500"},Qr=["disabled"],on="w-[16px] h-[16px] flex items-center justify-center flex-shrink-0 text-current",rn=ae(e.defineComponent({__name:"vs-input-select",props:{multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},mode:{},defaultValue:{},search:{type:Boolean,default:!0},placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{default:""},options:{default:()=>[]},api:{default:null},maxHeight:{default:400},parent:{},set:{},slot:{},add:{},teleport:{default:"body"},auto:{default:0},start:{default:0},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{},maxlength:{},minlength:{}},emits:["change","update:modelValue","value-selected"],setup(l,{emit:t}){const n=l,a=t,o=e.computed(()=>n.multiple),r=e.computed(()=>n.disabled);De(n.style);const s=e.computed({get:()=>n.modelValue,set:v=>a("update:modelValue",v)});!s.value&&n.defaultValue&&(s.value=n.defaultValue);const i=e.ref(null),c=e.ref(null),d=e.ref(null),p=e.ref(null),g=e.ref(!1),E=e.ref(!1),y=e.ref(null),V=e.ref([]),f=e.ref(-1),h=e.ref([]),x=e.ref(""),k=e.ref(null),w=e.ref("bottom"),b=e.ref({}),B=e.ref([]),$=e.computed(()=>{if(!B.value.length)return[];const v=V.value,N=new Map(v.map(I=>[I.id?.toString(),I]));return B.value.map(I=>N.get(I?.toString())).filter(I=>!!I)}),S=e.computed(()=>n.placeholder||"Select..."),j=e.computed(()=>P(y.value));e.computed(()=>o.value?!B.value.length&&x.value==="":!j.value&&x.value==="");const W=e.computed(()=>r.value?!1:o.value?B.value.length>0:!!s.value),K=v=>o.value?B.value.some(N=>N?.toString()===v?.toString()):s.value?.toString()===v?.toString(),T=e.computed(()=>{let v=V.value??[];if(!n.data&&x.value.trim()!==""){const N=x.value.toLowerCase();v=v.filter(I=>{const ee=P(I).toLowerCase(),ye=I.text?.toLowerCase?.()||"";return ee.includes(N)||ye.includes(N)})}if(o.value&&B.value.length){const N=new Set(B.value.map(I=>I?.toString()));v=v.filter(I=>!N.has(I.id?.toString()))}return v}),z=e.inject("values"),L=e.inject("field-props"),Z=/\{\{\s*([^}]+?)\s*\}\}/g,F=v=>(v?String(v):"").replace(/<[^>]*>/g,"").trim(),A=e.computed(()=>n.slot??n?.optionTemplate??""),H=v=>{if(!v)return"";const N=A.value;return N?N.replace(Z,(I,ee)=>{const ye=ee.trim(),_e=v[ye];return _e!=null?String(_e):""}):v.text??""},P=v=>{if(!v)return"";if(!A.value)return v.text??"";const I=H(v);return F(I)||v.text||""},pe=new Map,ke=wl.icons,Te=v=>v.replace(/^([A-Z])|[\s-_]+(\w)/g,(N,I,ee)=>ee?ee.toUpperCase():I.toLowerCase()),Ie=v=>{const N=Te(v);return N?N.charAt(0).toUpperCase()+N.slice(1):""},Y=v=>{if(!v)return;const N=Ie(v);if(pe.has(N))return pe.get(N);const ee=[N,`${N}Icon`,`Lucide${N}`,`Lucide${N}Icon`].map(ye=>ke[ye]).find(Boolean);return pe.set(N,ee),ee},re=v=>v?typeof v.icon=="string"?Y(v.icon)??null:v.icon??null:null,me=v=>!!(v?.color&&!re(v)),fe=v=>v?.color?{color:v.color}:void 0,ge=v=>!!re(v),O=(v,N,I)=>{if(!L)return!1;const ee=L.value?.[v]??{},ye=(ve,Ce,u)=>{if(!Ce.length)return ve;const[m,..._]=Ce,C={...ve};if(!_.length)return C[m]=u,C;const U=typeof ve[m]=="object"&&ve[m]!==null?ve[m]:{};return C[m]=ye(U,_,u),C},_e=ye(ee,N,I);return L.value={...L.value||{},[v]:_e},!0},ne=v=>{if(!n.set)return;const N=z?.value;!N&&!L||Object.entries(n.set).forEach(([I,ee])=>{if(!I)return;const ye=v?v[ee]:null,_e=I.split(".").map(u=>u.trim()).filter(Boolean);if(!_e.length)return;const[ve,...Ce]=_e;Ce.length&&O(ve,Ce,ye??null)||N&&(N[ve]=ye??null)})},Ee=e.computed(()=>n.parent?z?.value?.[n.parent]?.toString()??null:null),Ae=async v=>{if(!n.data){let N=n.options??[];if(v?.trim()){const I=v.toLowerCase();N=N.filter(ee=>{const ye=P(ee).toLowerCase(),_e=ee.text?.toLowerCase?.()||"";return ye.includes(I)||_e.includes(I)})}return N}try{const N=n.host??"",I=n.prefix??"api",ee=n.api??`/${I}/suggest/${n.data}`,ye=`${N}${ee}`,_e=new URLSearchParams;return _e.set("json","1"),v&&_e.set("key",v),Ee.value!==void 0&&Ee.value!==null&&Ee.value!==""&&_e.set("parent",Ee.value),n.start===1&&_e.set("start","1"),(await fetch(`${ye}?${_e.toString()}`).then(Ce=>Ce.json()))?.data??[]}catch{return[]}},M=async()=>{n.data?V.value=await Ae(x.value):V.value=n.options?[...n.options]:[]},R=async v=>{if(v==null||v==="")return null;const N=V.value?.find(I=>I?.id?.toString()===String(v));if(N)return N;if(n.data)try{const I=n.host??"",ee=n.prefix??"api",ye=n.api??`/${ee}/suggest/${n.data}`,_e=`${I}${ye}`,ve=new URLSearchParams;return ve.set("json","1"),ve.set("val",String(v)),Ee.value!==void 0&&Ee.value!==null&&Ee.value!==""&&ve.set("parent",Ee.value),n.start===1&&ve.set("start","1"),((await fetch(`${_e}?${ve.toString()}`).then(m=>m.json()))?.data??[])?.[0]??null}catch{return null}return null},q=async v=>{const N=new Set(V.value.map(ee=>ee.id?.toString())),I=v.filter(ee=>!N.has(ee?.toString()));I.length&&await I.reduce(async(ee,ye)=>{await ee;const _e=await R(ye);_e&&V.value.push(_e)},Promise.resolve())},le=()=>{if(!T.value.length){f.value=-1;return}let v=0;if(!o.value&&y.value){const N=y.value.id?.toString(),I=T.value.findIndex(ee=>ee.id?.toString()===N);I>=0&&(v=I)}f.value=v,e.nextTick(()=>{xe(h.value[v],d.value)})},oe=async()=>{r.value||(g.value=!0,await M(),await e.nextTick(()=>{ze(),k.value?.focus()}),le())},be=()=>{g.value=!1,f.value=-1,e.nextTick(()=>{k.value?.blur()})},Ve=async v=>{if(r.value)return;!g.value?await oe():be()},we=async()=>{if(!r.value){if(g.value){be();return}await oe()}},Xe=()=>{o.value?(B.value=[],s.value=[],a("change",[]),G(null,[])):(y.value=null,s.value=null,a("change",null),G(null,null)),ne(null),x.value="",e.nextTick(()=>k.value?.focus())},D=v=>{o.value&&(B.value=B.value.filter(N=>N?.toString()!==v?.toString()),s.value=[...B.value],a("change",s.value),G(null),e.nextTick(()=>k.value?.focus()))},G=(v,N)=>{const I=N??(o.value?[...B.value]:v?.id??null);a("value-selected",{name:n.name,value:I,option:v})},J=v=>{o.value?(K(v.id)||(B.value=[...B.value,v.id],s.value=[...B.value],a("change",s.value),G(v)),x.value="",e.nextTick(()=>{k.value?.focus(),f.value=Math.min(f.value,T.value.length-1)}),ne(null)):(y.value=v,s.value=v.id,a("change",s.value),G(v),x.value="",be(),ne(v))},ue=v=>{if(K(v.id)){o.value||be();return}J(v)},xe=(v,N)=>{if(!v||!N)return;const I=v.offsetTop,ee=I+v.offsetHeight,ye=N.scrollTop,_e=ye+N.clientHeight;let ve=N.scrollTop;I<ye?ve=I-80:ee>_e&&(ve=ee-N.clientHeight+4);const Ce=N;Ce.scrollTop=ve},Ue=v=>{let N=v.parentElement;for(;N;){if(N.classList.contains("ui-dialog__content"))return N;const I=window.getComputedStyle(N),ee=I.overflow+I.overflowY+I.overflowX;if(ee.includes("auto")||ee.includes("scroll")||N===document.body||N===document.documentElement)return N;N=N.parentElement}return document.body},ze=()=>{if(!c.value)return;const v=c.value.getBoundingClientRect(),N=window.innerHeight||document.documentElement.clientHeight,I=window.innerWidth||document.documentElement.clientWidth,ee=8,ye=8,_e=n.maxHeight||300,ve=N-v.bottom-ye-ee,Ce=v.top-ye-ee,u=ve>=Ce,m=Math.max(I-ee*2,0);let{width:_}=v;m>0&&_>m&&(_=m);let{left:C}=v;C+_+ee>I&&(C=I-_-ee),C=Math.max(C,ee);const U=Math.min(_e,Math.max(u?ve:Ce,50));w.value=u?"bottom":"top",b.value={position:"fixed",left:`${C}px`,width:`${_}px`,maxHeight:`${U}px`,transform:u?"none":"translateY(-100%)",top:u?`${v.bottom+ye}px`:`${v.top-ye}px`}},Re=async v=>{r.value||!g.value&&(v.key==="ArrowDown"||v.key==="ArrowUp")&&(v.preventDefault(),await oe())},tt=v=>{if(!g.value)return;const{key:N}=v;if(N==="ArrowDown")v.preventDefault(),f.value+1<T.value.length&&(f.value+=1,xe(h.value[f.value],d.value));else if(N==="ArrowUp")v.preventDefault(),f.value>0&&(f.value-=1,xe(h.value[f.value],d.value));else if(N==="Enter"){v.preventDefault();const I=T.value[f.value];I&&J(I),k.value?.blur()}else N==="Escape"?(v.preventDefault(),be()):N==="Backspace"?o.value&&x.value===""&&B.value.length&&(B.value=B.value.slice(0,-1),s.value=[...B.value],a("change",s.value)):N==="Home"?(f.value=0,xe(h.value[0],d.value)):N==="End"?(f.value=T.value.length-1,xe(h.value[f.value],d.value)):N==="Tab"&&be()},Ze=()=>{r.value||(E.value=!0)},He=()=>{E.value=!1,x.value=""},qe=v=>{v.key==="Escape"&&g.value&&be()},rt=v=>{const N=v.target;i.value?.contains(N)||p.value?.contains(N)||be()},Gt=v=>{g.value&&d.value&&!d.value.contains(v.target)&&ze()},vt=()=>{g.value&&ze()},Yt=()=>{g.value&&ze()};e.watch(()=>n.options,v=>{v?.length&&(V.value=[...v],nt())},{immediate:!0});async function nt(){if(o.value)Array.isArray(s.value)?B.value=[...s.value]:(B.value=s.value==null?[]:[s.value],s.value=[...B.value]),n.data&&B.value.length&&(await q(B.value),await e.nextTick());else{if(Array.isArray(s.value)){const v=s.value[0]??null;s.value=v??null}s.value!=null&&(y.value=await R(s.value)),ne(y.value??null)}}e.watch(s,()=>{nt()}),e.onMounted(async()=>{addEventListener("keydown",qe),addEventListener("scroll",Gt,!0),addEventListener("resize",vt),document.addEventListener("click",rt,!0),c.value&&Ue(c.value).addEventListener("scroll",Yt,!0),n.options?.length&&!n.data?V.value=[...n.options]:n.data&&(V.value=await Ae("")),await nt(),lt.value=!1}),e.onUnmounted(()=>{removeEventListener("keydown",qe),removeEventListener("scroll",Gt,!0),removeEventListener("resize",vt),document.removeEventListener("click",rt,!0),c.value&&Ue(c.value).removeEventListener("scroll",Yt,!0)});const st=e.ref(!1),pt=e.ref({}),Et=e.ref([]),mt=e.ref(null);async function Vt(){if(!(!n.add?.token||mt?.value.validate()))try{const N=n.add.api??`/api/table/${n.add.token}`,I=await fetch(N,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(pt.value)}),ee=await I.json().catch(()=>({})),ye=ee?.error||ee?.message,_e=Number(ee?.code)>=400;if(!I.ok||_e){he.notify({title:"Помилка",type:"error",message:ye||`Код помилки: ${ee?.code||I.status}`});return}const ve=ee?.id;if(!ve){he.notify({title:"Помилка",type:"error",message:"Обʼєкт створено, але в відповіді відсутній ID."});return}if(!n.options?.length&&n.data){const Ce=await fetch(`${n.api??`/api/suggest/${n.data}`}?val=${ve}`).then(u=>u.json());y.value=Ce[0],V.value.push(Ce[0]),s.value=ve}st.value=!1,he.notify({title:"Успіх",message:"Обʼєкт успішно створено."})}catch(N){he.notify({title:"Помилка",type:"error",message:N?.message||"Не вдалося створити обʼєкт."})}}async function ft(){if(!n.add)return null;const v=await fetch(`/api/template/form/${n.add.form}`).then(N=>N.json());return Et.value=v.schema,st.value=!0,null}function Bt(v,N=200){let I;return(...ee)=>{I&&clearTimeout(I),I=window.setTimeout(()=>v(...ee),N)}}const wn=Bt(async v=>{V.value=await Ae(v)},200);e.watch(x,v=>{n.data&&wn(v.trim())}),e.watch(()=>n.options,v=>{!n.data&&v?.length&&(V.value=[...v],nt())},{immediate:!0}),e.watch(()=>n.parent??n.parentValue,()=>{n.data&&M()});const lt=e.ref(!0);return e.watch(Ee,async()=>{if(n.data&&(lt.value||(o.value?(B.value=[],s.value=[],a("change",[])):(y.value=null,s.value=null,a("change",null))),await M(),n.auto===1&&Ee.value&&V.value.length>0)){const v=V.value[0];v&&J(v)}}),(v,N)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(he.VsModal),{visible:st.value,"onUpdate:visible":N[1]||(N[1]=I=>st.value=I),class:"z-[1000]",title:"Додати",buttonText:"Додати",onDone:Vt,teleport:v.teleport},{default:e.withCtx(()=>[e.createVNode(Je,{schema:Et.value,modelValue:pt.value,"onUpdate:modelValue":N[0]||(N[0]=I=>pt.value=I),ref_key:"addForm",ref:mt},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:N[5]||(N[5]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass])},[N[10]||(N[10]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),N[11]||(N[11]=e.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["vs-input-select__control flex min-h-[38px] items-center justify-between rounded transition-colors bg-white",r.value?"bg-gray-100 text-gray-400 cursor-not-allowed":""]),role:"combobox","aria-expanded":g.value,"aria-haspopup":"listbox",onKeydown:Re,onClick:we,"data-focus":g.value||E.value?"true":"false",ref_key:"triggerRef",ref:c},[e.createElementVNode("div",Fr,[o.value?(e.openBlock(),e.createElementBlock("div",Ir,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList($.value,I=>(e.openBlock(),e.createElementBlock("div",{class:"flex min-w-0 bg-[rgb(230,230,230)] rounded-[2px] m-[2px] box-border max-w-full",key:I.id},[e.createElementVNode("div",Lr,[me(I)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:e.normalizeStyle({backgroundColor:I?.color})},null,4)):e.createCommentVNode("",!0),!A.value&&ge(I)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(on),style:e.normalizeStyle(fe(I)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(re(I)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"truncate text-[#172b4d] overflow-hidden max-w-[200px] px-0.5 pl-1.5",title:P(I)},[A.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:H(I)},null,8,Or)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(I.text),1)],64))],8,Tr)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border text-[#172b4d] hover:bg-[rgb(255,189,173)] hover:text-[rgb(222,53,11)] flex-shrink-0",onClick:e.withModifiers(ee=>D(I.id),["stop"])},N[6]||(N[6]=[e.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,zr)]))),128)),e.createElementVNode("div",Rr,[!r.value&&v.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:k,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900 hover:cursor-pointer",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:B.value.length?" ":S.value,"onUpdate:modelValue":N[2]||(N[2]=I=>x.value=I),onFocus:Ze,onBlur:He,onKeydown:tt},null,40,jr)),[[e.vModelText,x.value]]):e.createCommentVNode("",!0)])])):!o.value&&j.value&&x.value===""?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["truncate text-gray-900 absolute flex items-center gap-1 min-w-0"]),title:j.value},[me(y.value)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block flex-shrink-0",style:e.normalizeStyle({backgroundColor:y.value?.color})},null,4)):e.createCommentVNode("",!0),!A.value&&ge(y.value)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(on),style:e.normalizeStyle(fe(y.value)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(re(y.value)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),A.value?(e.openBlock(),e.createElementBlock("span",{key:2,class:"truncate flex-1 min-w-0",innerHTML:H(y.value)},null,8,Ur)):(e.openBlock(),e.createElementBlock("span",Hr,e.toDisplayString(y.value?.text),1))],8,Pr)):e.createCommentVNode("",!0),o.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",qr,[!r.value&&v.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:k,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900 hover:cursor-pointer",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:j.value?" ":S.value,"onUpdate:modelValue":N[3]||(N[3]=I=>x.value=I),onFocus:Ze,onBlur:He,onKeydown:tt},null,40,Kr)),[[e.vModelText,x.value]]):e.createCommentVNode("",!0)]))]),e.createElementVNode("div",Gr,[W.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:r.value,onClick:e.withModifiers(Xe,["stop"])},N[7]||(N[7]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,Yr)):e.createCommentVNode("",!0),N[9]||(N[9]=e.createElementVNode("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),e.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:r.value,onClick:N[4]||(N[4]=e.withModifiers(I=>Ve(),["stop"])),title:g.value?"Закрити список":"Відкрити список"},N[8]||(N[8]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})],-1)]),8,Wr)])],42,Ar),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[g.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:p,class:e.normalizeClass(["fixed z-[3000] rounded bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.1),0_4px_11px_rgba(0,0,0,0.1)]"]),style:e.normalizeStyle(b.value),role:"listbox"},[e.createElementVNode("div",{class:"overflow-y-auto py-1",style:e.normalizeStyle({maxHeight:b.value.maxHeight||"300px"}),ref_key:"listRef",ref:d},[T.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(T.value,(I,ee)=>(e.openBlock(),e.createElementBlock("div",{key:I.id,ref_for:!0,ref:ye=>h.value[ee]=ye,class:e.normalizeClass(["flex px-3 py-2 gap-2 cursor-pointer select-none text-gray-900",K(I.id)?"bg-[#2684ff] text-white":"bg-white hover:bg-[#deebff] hover:text-[#172b4d]",f.value===ee&&!K(I.id)?"bg-[#deebff] text-[#172b4d]":""]),"aria-disabled":K(I.id)?"true":"false",role:"option",tabindex:"-1",onClick:ye=>ue(I)},[me(I)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block flex-shrink-0",style:e.normalizeStyle({backgroundColor:I?.color})},null,4)):e.createCommentVNode("",!0),!A.value&&ge(I)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(on),style:e.normalizeStyle(fe(I)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(re(I)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",f.value===I.id?"text-white":"",(f.value===ee,"")])},[A.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:H(I)},null,8,Jr)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(I.text),1)],64))],2)],10,Zr))),128)):(e.openBlock(),e.createElementBlock("div",Xr," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),n.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:ft,class:"bg-white hover:bg-gray-100 text-sm text-gray-900 py-[10px] px-3 border border-stone-200 rounded-md h-[38px] flex items-center gap-2",disabled:r.value,type:"button"},[e.createVNode(Ke,{width:"16",height:"16"}),N[12]||(N[12]=e.createElementVNode("span",null,"Додати",-1))],8,Qr)):e.createCommentVNode("",!0)],512)],64))}}),[["__scopeId","data-v-6c691161"]]),es=["placeholder","disabled"],Dn=e.defineComponent({__name:"vs-input-textarea",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=De(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??"");function s(){typeof a.value=="string"&&(a.value=a.value.trim())}return(i,c)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{"onUpdate:modelValue":c[0]||(c[0]=d=>a.value=d),placeholder:r.value,disabled:o.value,row:"2",onBlur:s,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,42,es)),[[e.vModelText,a.value]])}}),ts={key:1,class:"richtext-error"},An=e.defineComponent({__name:"vs-input-richtext",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},richtextProps:{default:()=>({})}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=e.ref(null);e.onMounted(async()=>{try{const d=await import("@opengis/richtext");t.value=d.VsRichtext}catch{console.warn("@opengis/richtext is not installed. Please install it in your app to use richtext input.")}});const n=l,{inputClass:a}=De(n.style),o=e.useModel(l,"modelValue"),r=e.computed(()=>!!n.disabled),s=e.computed(()=>n.placeholder??""),i=e.computed(()=>({height:"300px",...n.richtextProps}));return(c,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["richtext-wrapper !h-full !border-transparent",[c.customClass,e.unref(a),{"richtext-disabled":r.value}]]),style:e.normalizeStyle(r.value?{pointerEvents:"none",opacity:.6}:{})},[t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.mergeProps({key:0,modelValue:o.value,"onUpdate:modelValue":d[0]||(d[0]=p=>o.value=p),placeholder:s.value},i.value),null,16,["modelValue","placeholder"])):(e.openBlock(),e.createElementBlock("div",ts,d[1]||(d[1]=[e.createElementVNode("p",null,"@opengis/richtext package is not installed.",-1),e.createElementVNode("p",null,"Please install it: npm install @opengis/richtext",-1)])))],6))}}),ns={},ls={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"};function as(l,t){return e.openBlock(),e.createElementBlock("svg",ls,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),e.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const os=ae(ns,[["render",as]]),rs={},ss={xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function is(l,t){return e.openBlock(),e.createElementBlock("svg",ss,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const cs=ae(rs,[["render",is]]),ds={},us={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function ps(l,t){return e.openBlock(),e.createElementBlock("svg",us,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const ms=ae(ds,[["render",ps]]),fs={},hs={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function gs(l,t){return e.openBlock(),e.createElementBlock("svg",hs,t[0]||(t[0]=[e.createStaticVNode('<circle cx="9" cy="12" r="1"></circle><circle cx="9" cy="5" r="1"></circle><circle cx="9" cy="19" r="1"></circle><circle cx="15" cy="12" r="1"></circle><circle cx="15" cy="5" r="1"></circle><circle cx="15" cy="19" r="1"></circle>',6)]))}const $t=ae(fs,[["render",gs]]),ys={},ks={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function bs(l,t){return e.openBlock(),e.createElementBlock("svg",ks,t[0]||(t[0]=[e.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)]))}const ws=ae(ys,[["render",bs]]),xs={},_s={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function vs(l,t){return e.openBlock(),e.createElementBlock("svg",_s,t[0]||(t[0]=[e.createElementVNode("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"},null,-1)]))}const Es=ae(xs,[["render",vs]]),Vs={class:"bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden flex flex-col"},Bs={class:"flex flex-col gap-2 !p-4 border-b border-gray-200 sm:flex-row sm:items-center sm:justify-between bg-gray-50"},Cs={class:"relative w-full"},Ss={class:"flex flex-nowrap items-center justify-end gap-2 w-full overflow-x-auto"},Ns={class:"w-full overflow-x-auto"},$s={class:"w-full min-w-[640px] table-auto divide-y divide-gray-200"},Ms={class:"bg-gray-50"},Ds={class:"border-b border-gray-200"},As={class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 w-12 text-center"},Fs=["onClick"],Is={key:0,class:"text-gray-400"},Ls={key:0,colspan:"100%",class:"text-center"},Ts={class:"w-full"},Os={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},zs=["onDragstart","onDragover","onDrop"],Rs={class:"px-4 py-3 text-center align-middle"},js={class:"flex items-center justify-center"},Ps=["innerHTML"],Us={key:0,class:"flex items-center gap-3 text-sm text-gray-700"},Hs={key:0},qs=["src"],Ks={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},Gs={key:1,class:"flex items-center justify-center"},Ys={key:2,class:"text-sm font-medium text-gray-900"},Ws={class:"px-4 py-3 text-right whitespace-nowrap"},Zs={class:"flex items-center justify-end gap-2"},Js=["onClick"],Xs=["onClick"],Qs={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},Fn=e.defineComponent({__name:"vs-input-datatable",props:e.mergeModels({actions:{},colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useSlots(),a=M=>t.actions===void 0?!0:t.actions.includes(M),o=e.useModel(l,"modelValue"),r=e.ref({}),s=e.ref(""),i=e.ref(null),c=e.ref("asc"),d=e.computed(()=>{const M=o.value??[],R=s.value?M.filter(oe=>p.value?.some(be=>{const Ve=be.key||be.name;if(!Ve)return!1;const we=oe[Ve];return we?Array.isArray(we)?we.join(", ").toLowerCase().includes(s.value.toLowerCase()):String(we).toLowerCase().includes(s.value.toLowerCase()):!1})):M;if(!i.value)return R;const q=i.value,le=[...R].sort((oe,be)=>{const Ve=Ie(oe?.[q]),we=Ie(be?.[q]);return typeof Ve=="number"&&typeof we=="number"?Ve-we:String(Ve).localeCompare(String(we))});return c.value==="asc"?le:le.reverse()}),p=e.computed(()=>(t.colModel??[]).filter(M=>!M.tableHidden)),g=e.ref(null),E=e.ref(null),y=e.ref(null),V=M=>{g.value=M},f=M=>{E.value=M},h=M=>{if(g.value===null||g.value===M){g.value=null,E.value=null;return}const R=[...o.value],[q]=R.splice(g.value,1);R.splice(M,0,q),o.value=R,g.value=null,E.value=null},x=()=>{y.value&&y.value.click()},k=M=>{const R=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],q=M.toLowerCase();return R.some(le=>q.endsWith(le))},w=M=>{const q=M.target.files?.[0];if(!q)return;const le=new FileReader;le.onload=oe=>{try{const be=oe.target?.result;if(typeof be=="string"){const Ve=JSON.parse(be);Array.isArray(Ve)&&o.value.push(...Ve)}}catch(be){console.error("Error parsing file:",be)}},le.readAsText(q)},b=()=>{const M=JSON.stringify(o.value,null,2),R=new Blob([M],{type:"application/json"}),q=URL.createObjectURL(R),le=document.createElement("a");le.href=q,le.download="data.json",le.click(),URL.revokeObjectURL(q)},B=new Set(["autocomplete","select","radio","checkbox","combobox"]),$=new Map,S=(M,R)=>{const q=`/api/suggest/${M}`,le=q.includes("?")?"&":"?",oe=R?`&val=${R}`:"";return`${q}${le}json=1${oe}`},j=M=>M==null||M===""?null:typeof M=="object"?M?.id!==void 0&&M.id!==null&&M.id!==""?M.id:null:M,W=M=>{const R=new Set;return Array.isArray(o.value)&&o.value.forEach(q=>{const le=q?.[M];if(le==null||le==="")return;if(Array.isArray(le)){le.forEach(be=>{const Ve=j(be);Ve!==null&&R.add(Ve)});return}const oe=j(le);oe!==null&&R.add(oe)}),R},K=async()=>{if(!t.colModel?.length)return;const M=t.colModel.filter(R=>R.data&&B.has(R.type?.toLowerCase()||""));M.length&&await Promise.all(M.map(async R=>{const q=R.key||R.name;if(!q)return;const le=W(q),oe=Array.from(le).map(we=>String(we)).sort(),be=oe.join(",");if(!oe.length||$.get(q)===be)return;$.set(q,be);const Ve=oe.map(encodeURIComponent).join(",");try{const Xe=await(await fetch(S(R.data,Ve))).json();r.value[q]=Xe?.data??Xe}catch(we){console.error("Failed to fetch column values",we)}}))};e.watch([()=>t.colModel,()=>o.value],()=>{K()},{immediate:!0,deep:!0});const T=e.ref(""),z=e.ref(!1);let L="edit",Z=0;const F=M=>(M?.format||M?.type||"").toString().toLowerCase(),A=e.computed(()=>t.colModel?.filter(M=>F(M)!=="slot").map(M=>{const{slot:R,...q}=M;return q})??[]),H=e.ref({}),P=e.ref({}),pe=M=>typeof M!="string"?!1:!!n[M],ke=(M,R)=>R?R.split(".").reduce((q,le)=>q==null?q:q[le.trim()],M):M,Te=(M,R)=>typeof M!="string"?"":M.replace(/{{\s*([^}]+)\s*}}/g,(q,le)=>{const oe=ke(R,le.trim());return oe??""}),Ie=M=>{if(M==null||M==="")return"";if(typeof M=="number")return M;if(typeof M=="boolean")return M?1:0;if(typeof M=="string")return M.toLowerCase();if(Array.isArray(M))return M.map(R=>Ie(R)).join(", ");if(typeof M=="object"){if(M.text!==void 0)return String(M.text).toLowerCase();if(M.label!==void 0)return String(M.label).toLowerCase();if(M.id!==void 0)return String(M.id).toLowerCase()}return String(M).toLowerCase()},Y=M=>{const R=M.key||M.name;if(R){if(i.value===R){c.value=c.value==="asc"?"desc":"asc";return}i.value=R,c.value="asc"}};async function re(){T.value="Додати",z.value=!0,L="add",H.value={}}function me(M,R){if(!M?.length)return null;const q=typeof R=="object"?R?.id:R;return q==null||q===""?null:M.find(le=>le?.id?.toString()===q.toString())?.text??null}function fe(M){return M==null||M===""?"-":Array.isArray(M)?M.map(R=>typeof R=="object"?R?.text??R?.id??"-":R).join(", "):typeof M=="object"?M?.text??M?.id??"-":M}function ge(M,R){const q=R.key||R.name,le=M?.[q],oe=r.value[q];if(!le)return"-";if(Array.isArray(le)){const Ve=le.map(we=>me(oe,we)).filter(Boolean);return Ve.length?Ve.join(", "):fe(le)}const be=me(oe,le);return be||fe(le)}async function O(M,R){T.value="Редагувати",z.value=!0,L="edit",Z=R,H.value={...M}}function ne(){const M=P.value.validate();if(M){he.notify({type:"warning",title:"Помилка валідації",message:Object.entries(M).map(([R,q])=>`${R}: ${q}`).join(`
|
|
2
|
-
`)});return}L==="add"?Array.isArray(o.value)?o.value=[...o.value,H.value]:o.value=[H.value]:o.value=o.value.map((R,q)=>q===Z?H.value:R),z.value=!1}function Ee(M){o.value=o.value.filter((R,q)=>q!==M)}function Ae(){z.value=!1}return(M,R)=>(e.openBlock(),e.createElementBlock("div",Vs,[e.createElementVNode("div",Bs,[e.createElementVNode("div",Cs,[e.createVNode(os,{width:"16",height:"16",class:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":R[0]||(R[0]=q=>s.value=q),placeholder:"Пошук",class:"w-full rounded-md border border-gray-200 bg-white pl-10 pr-3 py-2 text-sm text-gray-900 placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-100"},null,512),[[e.vModelText,s.value]])]),e.createElementVNode("div",Ss,[a("import")?(e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"fileInput",ref:y,onChange:w,class:"hidden",accept:".json",type:"file"},null,544)):e.createCommentVNode("",!0),a("import")?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",onClick:x,class:"inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-gray-50 transition-colors"},[e.createVNode(cs,{class:"text-gray-700",width:"16",height:"16"}),R[4]||(R[4]=e.createTextVNode(" Імпорт ",-1))])):e.createCommentVNode("",!0),a("export")?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:b,class:"inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-gray-50 transition-colors"},[e.createVNode(ms,{class:"text-gray-700",width:"16",height:"16"}),R[5]||(R[5]=e.createTextVNode(" Експорт ",-1))])):e.createCommentVNode("",!0),a("add")?(e.openBlock(),e.createElementBlock("button",{key:3,onClick:re,type:"button",class:"inline-flex items-center gap-2 rounded-md bg-blue-500 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-600 transition-colors"},[e.createVNode(Ke,{class:"text-white"}),R[6]||(R[6]=e.createTextVNode(" Додати ",-1))])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Ns,[e.createElementVNode("table",$s,[e.createElementVNode("thead",Ms,[e.createElementVNode("tr",Ds,[e.createElementVNode("th",As,[e.createVNode($t,{width:"20",height:"20",class:"mx-auto text-gray-400"})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,q=>(e.openBlock(),e.createElementBlock("th",{key:q.key,class:"px-4 py-3 text-left text-xs font-semibold text-gray-900"},[e.createElementVNode("button",{type:"button",onClick:le=>Y(q),class:"flex items-center gap-1 text-xs font-semibold text-gray-700 hover:text-gray-900 transition-colors"},[e.createElementVNode("span",null,e.toDisplayString(q.ua||q.label),1),i.value===(q.key||q.name)?(e.openBlock(),e.createElementBlock("span",Is,e.toDisplayString(c.value==="asc"?"▲":"▼"),1)):e.createCommentVNode("",!0)],8,Fs)]))),128)),R[7]||(R[7]=e.createElementVNode("th",{class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 text-center w-[1%] whitespace-nowrap"}," Дії ",-1))])]),e.createElementVNode("tbody",{class:e.normalizeClass(["divide-y divide-gray-200",{"[&_tr:last-child]:border-0":!E.value}])},[d.value.length===0?(e.openBlock(),e.createElementBlock("td",Ls,[e.createElementVNode("div",Ts,[e.createElementVNode("div",Os,[e.createVNode(ws,{class:"w-48 mx-auto"}),R[8]||(R[8]=e.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[e.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),e.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(q,le)=>(e.openBlock(),e.createElementBlock("tr",{key:q.id,class:e.normalizeClass(["border-b transition-colors hover:bg-gray-50 cursor-move text-sm text-gray-700",{"opacity-50":g.value===le,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":E.value===le}]),draggable:"true",onDragstart:oe=>V(le),onDragover:e.withModifiers(oe=>f(le),["prevent"]),onDrop:oe=>h(le)},[e.createElementVNode("td",Rs,[e.createElementVNode("div",js,[e.createVNode($t,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,oe=>(e.openBlock(),e.createElementBlock("td",{key:oe.key,class:"px-4 py-3 align-middle"},[F(oe)==="slot"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[pe(oe.slot)?e.renderSlot(M.$slots,oe.slot,{key:0,row:q,value:q[oe.key],column:oe}):(e.openBlock(),e.createElementBlock("div",{key:1,class:"text-sm text-gray-900",innerHTML:Te(oe.slot,q)},null,8,Ps))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[F(oe)==="file"?(e.openBlock(),e.createElementBlock("div",Us,[k(ge(q,oe))?(e.openBlock(),e.createElementBlock("div",Hs,[e.createElementVNode("img",{src:ge(q,oe),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,qs)])):(e.openBlock(),e.createElementBlock("div",Ks,[e.createVNode(Bn,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):F(oe)==="color"?(e.openBlock(),e.createElementBlock("div",Gs,[e.createElementVNode("span",{class:"inline-flex h-6 w-6 rounded border border-gray-200",style:e.normalizeStyle({backgroundColor:ge(q,oe)||"#ffffff"})},null,4)])):(e.openBlock(),e.createElementBlock("div",Ys,e.toDisplayString(ge(q,oe)),1))],64))]))),128)),e.createElementVNode("td",Ws,[e.createElementVNode("div",Zs,[e.createElementVNode("button",{onClick:oe=>O(q,le),class:"p-1.5 text-gray-600 hover:text-blue-600 hover:bg-blue-50 rounded transition-colors"},[e.createVNode(Es,{width:"16",height:"16"})],8,Js),e.createElementVNode("button",{onClick:oe=>Ee(le),class:"p-1.5 text-gray-600 hover:text-red-600 hover:bg-red-50 rounded transition-colors"},[e.createVNode(ct,{width:"16",height:"16"})],8,Xs)])])],42,zs))),128))],2)])]),e.createVNode(e.unref(he.VsModal),{visible:z.value,title:T.value,size:"lg",onClose:Ae,teleport:"#modal"},{default:e.withCtx(()=>[e.createVNode(Je,{schema:A.value,values:H.value,"onUpdate:values":R[1]||(R[1]=q=>H.value=q),form:P.value,"onUpdate:form":R[2]||(R[2]=q=>P.value=q)},null,8,["schema","values","form"]),e.createElementVNode("div",Qs,[e.createElementVNode("button",{type:"button",onClick:R[3]||(R[3]=q=>z.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:ne,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])]),_:1},8,["visible","title"])]))}}),ei={},ti={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",stroke:"currentColor",fill:"none","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-map-pin"};function ni(l,t){return e.openBlock(),e.createElementBlock("svg",ti,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),e.createElementVNode("path",{d:"M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0z"},null,-1)]))}const li=ae(ei,[["render",ni]]),ai={},oi={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none","stroke-width":"2",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-line"};function ri(l,t){return e.openBlock(),e.createElementBlock("svg",oi,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const si=ae(ai,[["render",ri]]),ii={},ci={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-polygon"};function di(l,t){return e.openBlock(),e.createElementBlock("svg",ci,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M6.5 9.5l3.5 -3"></path><path d="M14 5.5l3 1.5"></path><path d="M18.5 10l-2.5 7"></path><path d="M13.5 17.5l-7 -5"></path>',9)]))}const ui=ae(ii,[["render",di]]),pi={},mi={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-topology-ring-3"};function fi(l,t){return e.openBlock(),e.createElementBlock("svg",mi,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M8 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M6 8v8"></path><path d="M18 16v-8"></path><path d="M8 6h8"></path><path d="M16 18h-8"></path>',9)]))}const hi=ae(pi,[["render",fi]]),gi={},yi={version:"1.1",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg","xmlns:sketch":"http://www.bohemiancoding.com/sketch/ns","xmlns:xlink":"http://www.w3.org/1999/xlink",class:"fullscreen-icon"};function ki(l,t){return e.openBlock(),e.createElementBlock("svg",yi,t[0]||(t[0]=[e.createElementVNode("title",null,null,-1),e.createElementVNode("desc",null,null,-1),e.createElementVNode("defs",null,null,-1),e.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[e.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[e.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[e.createElementVNode("path",{d:"M2,9 L0,9 L0,14 L5,14 L5,12 L2,12 L2,9 L2,9 Z M0,5 L2,5 L2,2 L5,2 L5,0 L0,0 L0,5 L0,5 Z M12,12 L9,12 L9,14 L14,14 L14,9 L12,9 L12,12 L12,12 Z M9,0 L9,2 L12,2 L12,5 L14,5 L14,0 L9,0 L9,0 Z",id:"Shape"})])])],-1)]))}const bi=ae(gi,[["render",ki]]),wi={class:"bg-white/30 p-1 rounded-md shadow w-fit"},xi={class:"flex gap-2"},_i=["onClick","title"],vi=["src"],Ei=e.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(l,{emit:t}){const n=l,a=e.ref(Object.keys(n.basemaps)[0]),o=t;function r(c){o("onLayerChange",c),a.value=c}const s={z:13,x:4790,y:2762};function i(c){if(c?.preview)return c.preview;if(!c?.url)return;const d={"{z}":s.z,"{x}":s.x,"{y}":s.y};let p=c.url;return Object.entries(d).forEach(([g,E])=>{p=p.replace(new RegExp(g,"gi"),String(E))}),p}return(c,d)=>(e.openBlock(),e.createElementBlock("div",wi,[e.createElementVNode("div",xi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.basemaps,(p,g)=>(e.openBlock(),e.createElementBlock("div",{key:g,class:e.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":a.value===g}]),onClick:E=>r(g),title:p.name||g,role:"button",tabindex:"0"},[e.createElementVNode("img",{src:i(p),alt:"",class:"w-10 h-10 object-cover"},null,8,vi)],10,_i))),128))])]))}}),Vi={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},Bi={key:0,class:"vs-select__options absolute z-50 mt-1 w-full bg-white border border-gray-300 shadow-lg rounded-lg text-sm"},Ci=["onClick"],Si={class:"relative flex-1 min-w-[140px]"},Ni=["placeholder"],$i="https://data.softpro.ua/api-user/gis-url-proxy",Mi="https://geo.rv.ua/api-user/dzk.api",Di=ae(e.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(l,{emit:t}){const n=l,a=t,o=["here","xy","parcel"],r=e.computed(()=>{const b=n.config?.tools?.filter(B=>o.includes(B));return b&&b.length?b:o}),s=e.computed(()=>n.config?.placeholder?.trim()||"Пошук…"),i=e.ref(r.value[0]??o[0]);e.watch(r,b=>{b.includes(i.value)||(i.value=b[0])});const c=e.ref(""),d=e.ref(!1),p=e.ref(null);e.watch(i,()=>{c.value="",d.value=!1});function g(b){i.value=b}function E(b){if(!d.value)return;const B=p.value;B&&!B.contains(b.target)&&(d.value=!1)}e.onMounted(()=>{window.addEventListener("click",E,!0)}),e.onBeforeUnmount(()=>{window.removeEventListener("click",E,!0)});function y(b){return b==="xy"?"Координати":b==="parcel"?"Кадастр":"Адреси"}function V(b){const B=b.replace(/[,]+/g," ").trim();if(!B)return null;const $=B.split(/\s+/).filter(Boolean);if($.length<2)return null;const S=$.slice(0,2).map(Number);if(!S.every(Z=>Number.isFinite(Z)))return null;const[j,W]=S;let K=j,T=W;const z=Z=>Math.abs(Z)<=90,L=Z=>Math.abs(Z)<=180;if(!z(K)||!L(T))if(z(T)&&L(K))K=W,T=j;else return null;return{lat:K,lng:T}}function f(b){return(b?.items||[]).map(($,S)=>({id:String($?.id??S),title:$?.title||$?.address?.label||"Знайдений обʼєкт",lat:Number($?.position?.lat),lng:Number($?.position?.lng)})).filter($=>Number.isFinite($.lat)&&Number.isFinite($.lng))}function h(b){const B=b?.result||b?.data||b;if(!B)return[];const $=B.geom_centroid;if(!$||!Array.isArray($.coordinates))return[];const[S,j]=$.coordinates;return!Number.isFinite(j)||!Number.isFinite(S)?[]:[{id:"parcel",title:B.cadnum||B.cad_num||"Земельна ділянка",lat:j,lng:S}]}function x(b){const $=b.replace(/\s+/g,"").split(":");if($.length!==4)return!1;const S=[10,2,3,4];return $.every((j,W)=>j.length===S[W]&&/^\d+$/.test(j))}function k(b){a("goToCoordinates",[b.lat,b.lng])}async function w(){const b=c.value.trim();if(b){if(i.value==="xy"){const B=V(b);if(!B){he.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}k(B),c.value="";return}try{const B=new URL(i.value==="here"?$i:Mi);if(i.value==="here")B.searchParams.set("searchtext",b);else{if(!x(b)){he.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}B.searchParams.set("cad_num",b)}const $=await fetch(B.toString());if(!$.ok)throw new Error(`HTTP ${$.status}`);const S=await $.json(),j=i.value==="here"?f(S):h(S);if(!j.length)he.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const W=j[0];k(W),c.value=""}}catch(B){const $=B?.message||"Помилка пошуку";he.notify({type:"error",title:"Пошук",message:$})}}}return(b,B)=>(e.openBlock(),e.createElementBlock("div",Vi,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(w,["prevent"])},[r.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:p,class:"relative search-type w-[140px]"},[e.createElementVNode("button",{type:"button",class:"vstSelect-input transition-all text-left bg-white border border-gray-200 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-100 block w-full py-1.5 px-3 text-sm cursor-pointer flex items-center justify-between gap-2",onClick:B[0]||(B[0]=$=>d.value=!d.value)},[e.createElementVNode("span",null,e.toDisplayString(y(i.value)),1),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":d.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},B[2]||(B[2]=[e.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2))]),d.value?(e.openBlock(),e.createElementBlock("div",Bi,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,$=>(e.openBlock(),e.createElementBlock("li",{key:$,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:S=>g($)},e.toDisplayString(y($)),9,Ci))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",Si,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":B[1]||(B[1]=$=>c.value=$),placeholder:s.value,type:"text",class:"vs-input transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,8,Ni),[[e.vModelText,c.value,void 0,{trim:!0}]]),B[3]||(B[3]=e.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5 5a7.5 7.5 0 0 0 11.65 11.65Z"})])],-1))])],32)]))}}),[["__scopeId","data-v-b5059a01"]]),Ai={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},Fi={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},Ii={class:"flex items-center gap-1"},Li=["disabled"],Ti=["disabled"],Oi=["disabled"],zi={class:"absolute top-4 right-4 z-[1000]"},Ri={class:"flex flex-col gap-[2px]"},ji=["disabled"],Pi=["disabled"],Ui=["disabled"],Hi=["disabled"],qi={class:"bg-white/95 border border-gray-200 rounded-md shadow-xl px-3 py-2 max-w-[240px] text-[11px] sm:text-xs text-gray-900"},Ki={class:"space-y-0.5"},Gi={class:"text-gray-500"},Yi={class:"text-gray-900 text-right break-all"},Wi={class:"absolute left-4 bottom-[36px] z-[1000]"},Zi={class:"flex flex-col gap-2"},Ji={key:0,class:"bg-white/95 border border-gray-200 rounded-md shadow-sm px-3 py-2 text-xs text-gray-700 min-w-[200px]"},Xi={class:"flex flex-col gap-1"},Qi=["checked","disabled","onChange"],ec={class:"text-gray-700 text-xs font-medium"},tc={class:"absolute bottom-0 left-0 right-0 z-[1000] min-h-[28px] bg-white/95 border-t border-gray-200 text-xs text-gray-700 flex items-center gap-4 pt-1"},nc={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full px-2 pb-1"},lc={class:"mr-auto flex items-center gap-2 min-w-0 relative"},ac={class:"shrink-0"},oc={class:"font-bold"},rc={class:"flex items-center"},sc={class:"text-xs mr-2"},ic={key:0,class:"text-xs mr-2"},cc={key:1,class:"text-xs mr-2"},dc=["disabled"],uc=["disabled"],Mt="__vs_form_maplibre_loader__",sn="__vs_form_maplibre_scripts__",Dt="vs-global-bounds-src",At="vs-global-bounds-line",In=ae(e.defineComponent({__name:"vs-input-map",props:{tools:{},handleZoom:{type:Boolean,default:!0},ctrlZoom:{type:Boolean,default:!0},geomType:{default:()=>[]},prefix:{default:""},katottg:{default:""},layers:{default:()=>[]},bounds:{},api:{},center:{default:void 0},zoom:{default:void 0},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=e.computed(()=>!!n.disabled),r=e.ref(!1),s=e.ref(null),i=e.ref(0),c=e.ref(""),d=e.ref(null),p=e.getCurrentInstance(),g=p?.appContext?.config?.globalProperties?.$settings??{},E=g?.map??{},y=p?.vnode?.props??{};function V(u){return Object.prototype.hasOwnProperty.call(y,u)||Object.prototype.hasOwnProperty.call(y,u.replace(/[A-Z]/g,m=>`-${m.toLowerCase()}`))}const f=Array.isArray(E.center)&&E.center.length===2?E.center:Array.isArray(g.center)&&g.center.length===2?g.center:[30,50];console.log(E);const h=typeof E.zoom=="number"?E.zoom:typeof g.zoom=="number"?g.zoom:typeof g.defaultZoom=="number"?g.defaultZoom:10,x=e.computed(()=>V("center")?n.center:E.center??n.center),k=e.computed(()=>V("zoom")?n.zoom:E.zoom??n.zoom),w=e.computed(()=>V("katottg")?String(n.katottg??""):String(E.katottg??n.katottg??"")),b=e.computed(()=>V("layers")?n.layers??[]:E.layers??n.layers??[]),B=e.computed(()=>V("bounds")?n.bounds:E.bounds??n.bounds),$=e.ref(Array.isArray(x.value)&&x.value.length===2?[...x.value]:f),S=e.ref(typeof k.value=="number"?k.value:h),j=e.ref(n.modelValue),W=e.ref(null),K=e.ref([]);let T=!1;const z=e.reactive({}),L=e.ref([]),Z=e.computed(()=>L.value.map(u=>z[u]).filter(Boolean)),F=e.ref(null),A=e.computed(()=>F.value?.entries??[]),H=e.computed(()=>{if(F.value)return{left:`${F.value.point.x+12}px`,top:`${F.value.point.y+12}px`}}),P=e.computed(()=>{const u={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!n.tools?.length)return{...u,point:!0,line:!0,polygon:!0,rectangle:!0};const m=new Set(n.tools.map(_=>_.toLowerCase()));return{search:m.has("search"),import:m.has("import"),export:m.has("export"),point:m.has("point"),line:m.has("line"),polygon:m.has("polygon"),rectangle:m.has("rectangle")}});function pe(u){if(typeof u!="string"||!u.trim())return"";if(/^https?:\/\//i.test(u))return u;const m=window?.location?.origin??"",_=u.replace(/^\/+/,"");return _?m?`${m}/${_}`:`/${_}`:m}function ke(){const u=Array.isArray(E.basemaps)&&E.basemaps.length?E.basemaps:g.basemaps;if(Array.isArray(u)&&u.length){const _=u.map((C,U)=>{const te=String(C?.key??C?.id??C?.name??`b${U}`),X=pe(String(C?.url??""));if(!X)return null;const ie=typeof C?.preview=="string"&&C.preview?pe(C.preview):"";return[te,{...C,url:X,preview:ie}]}).filter(C=>Array.isArray(C)&&C.length===2).reduce((C,[U,te])=>(C[U]=te,C),{});if(Object.keys(_).length)return _}return{voyager:{name:"Оглядова карта",url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/voyager/ua/13/4790/2762.png"},orto10:{name:"Ортофото 1:10K",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4790/2762.png"},osmb:{name:"Open Street Maps",url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png",preview:"https://tile.openstreetmap.org.ua/styles/osm-bright/13/4790/2762.png"}}}const Te=ke(),Ie=Object.keys(Te),Y=e.ref(Ie.length?Ie[0]:"");async function re(){if(typeof window>"u")return null;const u=window;if(u[Mt])return u[Mt];u[sn]=u[sn]||{};const m=u[sn],_=X=>{if(Array.from(document.styleSheets).some(Fe=>Fe?.href?.includes(X)))return;const Be=document.createElement("link");Be.rel="stylesheet",Be.href=X,document.head.appendChild(Be)},C=X=>(m[X]||(m[X]=new Promise((ie,Be)=>{const Fe=Array.from(document.scripts).find(je=>je.src===X);if(Fe){Fe.addEventListener("load",()=>ie(),{once:!0}),Fe.addEventListener("error",Be,{once:!0}),X.includes("maplibre")&&window.maplibregl&&ie(),X.includes("mapbox-gl-draw")&&window.MapboxDraw&&ie();return}const Me=document.createElement("script");Me.src=X,Me.async=!1,Me.onload=()=>ie(),Me.onerror=Be,document.head.appendChild(Me)})),m[X]),te=(async()=>{_("https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.css"),_("https://unpkg.com/@mapbox/mapbox-gl-draw@1.5.0/dist/mapbox-gl-draw.css"),window.maplibregl||await C("https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.js"),window.MapboxDraw||await C("https://unpkg.com/@mapbox/mapbox-gl-draw@1.5.0/dist/mapbox-gl-draw.js");const X=window.maplibregl,ie=window.MapboxDraw;if(!X)throw new Error("maplibregl not available after load");if(!ie)throw new Error("MapboxDraw not available after load");return{maplibregl:X,MapboxDraw:ie}})().catch(X=>{throw delete u[Mt],X});return u[Mt]=te,te}function me(u){return{version:8,sources:{rasterSource:{type:"raster",tiles:[u],tileSize:256}},layers:[{id:"rasterLayer",type:"raster",source:"rasterSource"}]}}let fe=null,ge=null,O=null,ne=null,Ee=null,Ae=null,M=!1,R=!1;function q(){return{onSetup(){const u=this.newFeature({type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[0,0],[0,0],[0,0],[0,0],[0,0]]]}});return this.addFeature(u),this.clearSelectedFeatures(),this.updateUIClasses({mouse:"add"}),this.setActionableState({trash:!0}),{rectangle:u,startPoint:null,hasCoordinates:!1}},onMouseMove(u,m){if(!u.startPoint)return;const[_,C]=u.startPoint,U=m.lngLat.lng,te=m.lngLat.lat;u.rectangle.setCoordinates([[[_,C],[U,C],[U,te],[_,te],[_,C]]])},onClick(u,m){if(!u.startPoint){u.startPoint=[m.lngLat.lng,m.lngLat.lat],u.hasCoordinates=!0,u.rectangle.setCoordinates([[[m.lngLat.lng,m.lngLat.lat],[m.lngLat.lng,m.lngLat.lat],[m.lngLat.lng,m.lngLat.lat],[m.lngLat.lng,m.lngLat.lat],[m.lngLat.lng,m.lngLat.lat]]]);return}const[_,C]=u.startPoint,U=m.lngLat.lng,te=m.lngLat.lat;return Math.abs(_-U)>0&&Math.abs(C-te)>0?(u.rectangle.setCoordinates([[[_,C],[U,C],[U,te],[_,te],[_,C]]]),this.map.fire("draw.create",{features:[u.rectangle.toGeoJSON()]}),this.changeMode("simple_select",{featureIds:[u.rectangle.id]})):(this.deleteFeature([u.rectangle.id],{silent:!0}),u.hasCoordinates=!1,this.changeMode("simple_select"))},onStop(){},onTrash(u){this.deleteFeature([u.rectangle.id],{silent:!0}),this.changeMode("simple_select")},toDisplayFeatures(u,m,_){if(!u.hasCoordinates)return;const C=m.properties.id===u.rectangle.id;m.properties.active=C?"true":"false",_(m)}}}const le=[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","$type","Polygon"],["!=","active","true"]],paint:{"fill-color":"#3b82f6","fill-outline-color":"#3b82f6","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","$type","Polygon"],["==","active","true"]],paint:{"fill-color":"#2563eb","fill-outline-color":"#2563eb","fill-opacity":.2}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","$type","Polygon"],["!=","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3b82f6","line-width":2}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","$type","Polygon"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#2563eb","line-width":2}},{id:"gl-draw-lines-inactive",type:"line",filter:["all",["==","$type","LineString"],["!=","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3b82f6","line-width":2}},{id:"gl-draw-lines-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#2563eb","line-width":2}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["!=","active","true"]],paint:{"circle-radius":5,"circle-color":"#3b82f6"}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"]],paint:{"circle-radius":6,"circle-color":"#2563eb"}},{id:"gl-draw-polygon-and-line-vertex-halo-active",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-active",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#2563eb"}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","meta","midpoint"],["==","$type","Point"]],paint:{"circle-radius":4,"circle-color":"#1d4ed8"}}];function oe(){const u=Y.value;return!u||!Te[u]?.url?"":Te[u].url}function be(u,m){return u?.id?String(u.id):u?.url?`${u.url}-${m}`:`layer-${m}`}function Ve(u){const m=String(u?.url??"").trim();if(!m)return"";if(/^https?:\/\//i.test(m))return m;const _=window.location?.origin??"",C=m.replace(/^\/+/,"");return`${_}/${C}`}function we(u){u&&F.value?.layerId!==u||(F.value=null)}function Xe(u,m={}){return u.popup===!1?[]:Array.isArray(u.popup)?u.popup.length?u.popup.map(_=>{const C=_?.field||_?.name;if(!C)return null;const U=m[C];return U==null||U===""?null:{key:_.label||C,value:String(U)}}).filter(Boolean):[]:Object.entries(m).slice(0,5).map(([_,C])=>({key:_,value:C==null?"—":String(C)}))}function D(u){if(!Array.isArray(u))return[];const m=C=>Array.isArray(C)&&C.length>=2&&Number.isFinite(Number(C[0]))&&Number.isFinite(Number(C[1])),_=C=>{if(!C.length)return C;const U=C[0],te=C[C.length-1];return!te||U[0]!==te[0]||U[1]!==te[1]?[...C,U]:C};if(u.length&&m(u[0])){const C=u.map(U=>[Number(U[0]),Number(U[1])]).filter(m);return C.length?[_(C)]:[]}return u.length&&Array.isArray(u[0])&&m(u[0][0])?u.map(U=>Array.isArray(U)?U.map(te=>[Number(te[0]),Number(te[1])]):[]).filter(U=>U.length).map(_):u.length&&Array.isArray(u[0])&&Array.isArray(u[0][0])&&m(u[0][0][0])?u.flatMap(U=>Array.isArray(U)?U:[]).map(U=>Array.isArray(U)?U.map(te=>[Number(te[0]),Number(te[1])]):[]).filter(U=>U.length).map(_):[]}function G(u){const m=u.style??{},_=m.color??"#3b82f6";if(!m.colorAttr||!m.colorSet)return _;const C=Object.keys(m.colorSet);if(!C.length)return _;const U=["match",["to-string",["get",m.colorAttr]]];return C.forEach(te=>{U.push(String(te),m.colorSet?.[te]??_)}),U.push(_),U}function J(u){if(!O)return;u.handlers.forEach(_=>{try{O.off(_.type,_.layerId,_.handler)}catch{}}),u.handlers=[],[...u.layerIds,...u.boundsIds].forEach(_=>{O.getLayer(_)&&O.removeLayer(_)}),O.getSource(u.sourceId)&&O.removeSource(u.sourceId);const m=`vs-ov-bounds-src-${u.id}`;O.getSource(m)&&O.removeSource(m),we(u.id)}function ue(u,m){if(!O)return[];const _=`vs-ov-bounds-src-${m}`,C=`vs-ov-bounds-line-${m}`,U=u.bounds??B.value??K.value,te=D(U);if(!te.length)return[];const X={type:"FeatureCollection",features:te.map(ie=>({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:ie}}))};return O.getSource(_)&&O.removeSource(_),O.addSource(_,{type:"geojson",data:X}),O.addLayer({id:C,type:"line",source:_,paint:{"line-color":u.style?.stroke??u.style?.color??"#2563eb","line-width":u.style?.width??2,"line-opacity":u.style?.opacity??.8,"line-dasharray":[2,2]}}),[C]}function xe(u){if(!O)return;J(u);const m=u.config,_=Ve(m);if(!_)return;const C=[],U=[];if(/\.v(?:m)?t(?:\?|$)/i.test(_)||/\.pbf(?:\?|$)/i.test(_)){const ie=m.sourceLayer||m.layer||m.service_layer||m.dataset?.layer||m.id;O.addSource(u.sourceId,{type:"vector",tiles:[_]});const Be=String(m.style?.type??"polygon").toLowerCase(),Fe=G(m),Me=m.style?.opacity??.5;if(Be==="point"){const je=`vs-ov-point-${u.id}`;O.addLayer({id:je,type:"circle",source:u.sourceId,"source-layer":ie,paint:{"circle-color":Fe,"circle-radius":5,"circle-opacity":Me}}),C.push(je)}else if(Be==="polyline"||Be==="line"){const je=`vs-ov-line-${u.id}`;O.addLayer({id:je,type:"line",source:u.sourceId,"source-layer":ie,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":Fe,"line-width":m.style?.width??2,"line-opacity":Me}}),C.push(je)}else{const je=`vs-ov-fill-${u.id}`,Ct=`vs-ov-border-${u.id}`;O.addLayer({id:je,type:"fill",source:u.sourceId,"source-layer":ie,paint:{"fill-color":Fe,"fill-opacity":Me}}),O.addLayer({id:Ct,type:"line",source:u.sourceId,"source-layer":ie,paint:{"line-color":m.style?.stroke??m.style?.color??"#2563eb","line-width":m.style?.width??1,"line-opacity":Me}}),C.push(je,Ct)}}else{O.addSource(u.sourceId,{type:"raster",tiles:[_],tileSize:256});const ie=`vs-ov-raster-${u.id}`;O.addLayer({id:ie,type:"raster",source:u.sourceId,paint:{"raster-opacity":m.style?.opacity??1}}),C.push(ie)}C.forEach(ie=>{const Be=Me=>{if(!Me?.features?.length){we(u.id);return}const je=Me.features[0]?.properties??{},Ct=Xe(u.config,je);if(!Ct.length){we(u.id);return}F.value={layerId:u.id,entries:Ct,point:{x:Me.point.x,y:Me.point.y}}},Fe=()=>we(u.id);O.on("mousemove",ie,Be),O.on("mouseleave",ie,Fe),U.push({layerId:ie,type:"mousemove",handler:Be},{layerId:ie,type:"mouseleave",handler:Fe})}),u.layerIds=C,u.boundsIds=ue(u.config,u.id),u.handlers=U;const X=u.visible?"visible":"none";[...u.layerIds,...u.boundsIds].forEach(ie=>{O.getLayer(ie)&&O.setLayoutProperty(ie,"visibility",X)})}function Ue(){if(!O)return;const m={type:"FeatureCollection",features:D(B.value??K.value).map(_=>({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:_}}))};O.getSource(Dt)?O.getSource(Dt).setData(m):O.addSource(Dt,{type:"geojson",data:m}),O.getLayer(At)||O.addLayer({id:At,type:"line",source:Dt,paint:{"line-color":"#2563eb","line-width":2,"line-opacity":.8,"line-dasharray":[2,2]}})}function ze(u){if(!O||o.value)return;const m=z[u];if(!m)return;m.visible=!m.visible;const _=m.visible?"visible":"none";[...m.layerIds,...m.boundsIds].forEach(C=>{O.getLayer(C)&&O.setLayoutProperty(C,"visibility",_)}),Re(),m.visible||we(u)}function Re(){if(!O)return;const u=[],m=[],_=[],C=[];L.value.forEach(X=>{const ie=z[X];if(!ie)return;const Be=String(ie.config?.url??""),Fe=/\.v(?:m)?t(?:\?|$)/i.test(Be),Me=/\.png(?:\?|$)/i.test(Be);Fe?_.push(...ie.layerIds):Me?u.push(...ie.layerIds):m.push(...ie.layerIds),C.push(...ie.boundsIds)}),[...u,...m,..._,...C].forEach(X=>{O.getLayer(X)&&O.moveLayer(X)}),O.getLayer(At)&&O.moveLayer(At),(O.getStyle?.()?.layers??[]).map(X=>String(X?.id??"")).filter(X=>X.startsWith("gl-draw-")).forEach(X=>{O.getLayer(X)&&O.moveLayer(X)})}function tt(u){if(!Te[u]||(Y.value=u,!O))return;const m=oe();if(!m)return;const _=O.getCenter?.(),C=O.getZoom?.(),U=ne?.getAll?.();O.setStyle(me(m)),O.once("style.load",()=>{if(O&&(_&&Number.isFinite(C)&&O.jumpTo({center:[_.lng,_.lat],zoom:C}),Ue(),L.value.forEach(te=>{const X=z[te];X&&xe(X)}),Re(),U?.features?.length&&ne))try{U.features.forEach(te=>ne.add(te)),i.value=U.features.length}catch{i.value=0}})}function Ze(u){return u?u.type==="FeatureCollection"?u.features?.[0]?.geometry??null:u.type==="Feature"?u.geometry??null:u.geom?.type&&Array.isArray(u.geom.coordinates)?{type:u.geom.type,coordinates:u.geom.coordinates}:typeof u.type=="string"&&Array.isArray(u.coordinates)?u:null:null}function He(u){return{type:"Feature",properties:{},geometry:u}}function qe(u){if(!u)return null;try{return JSON.parse(JSON.stringify(u))}catch{return null}}function rt(u){if(!u)return"__null__";try{return JSON.stringify(u)}catch{return"__invalid__"}}function Gt(u){const m=pt(u);if(!m)return null;const[[_,C],[U,te]]=m;return{lat:(C+te)/2,lng:(_+U)/2}}function vt(u){if(!Array.isArray(u)||u.length<3)return 0;const m=(C,U)=>{const te=C*2003750834e-2/180,X=Math.log(Math.tan((90+U)*Math.PI/360))/(Math.PI/180);return[te,X*2003750834e-2/180]};let _=0;for(let C=0;C<u.length-1;C+=1){const[U,te]=m(Number(u[C][0]),Number(u[C][1])),[X,ie]=m(Number(u[C+1][0]),Number(u[C+1][1]));_+=U*ie-X*te}return Math.abs(_/2)/1e6}function Yt(u){if(!u?.type||!u?.coordinates)return null;if(u.type==="Polygon"){const m=u.coordinates?.[0];return Array.isArray(m)?vt(m):null}return u.type==="MultiPolygon"?u.coordinates.reduce((m,_)=>{const C=_?.[0];return Array.isArray(C)?m+vt(C):m},0):null}function nt(u){if(!u){d.value=null;return}const m=Gt(u);if(!m){d.value=null;return}d.value={type:String(u.type??"Feature"),center:m,areaKm2:Yt(u)}}function st(u,m){if(!Array.isArray(u)||!Array.isArray(m)||u.length!==2||m.length!==2)return!1;const _=1e-9;return Math.abs(Number(u[0])-Number(m[0]))<_&&Math.abs(Number(u[1])-Number(m[1]))<_}function pt(u){if(!u)return null;let m=1/0,_=1/0,C=-1/0,U=-1/0;const te=X=>{if(Array.isArray(X)){if(X.length>=2&&Number.isFinite(X[0])&&Number.isFinite(X[1])){const ie=Number(X[0]),Be=Number(X[1]);m=Math.min(m,ie),_=Math.min(_,Be),C=Math.max(C,ie),U=Math.max(U,Be);return}X.forEach(te)}};return te(u.coordinates),!Number.isFinite(m)||!Number.isFinite(_)?null:[[m,_],[C,U]]}function Et(u){if(!O||!u)return;const m=pt(u);if(!m)return;const[[_,C],[U,te]]=m;if(_===U&&C===te){O.easeTo({center:[_,C],zoom:Math.max(S.value,14)});return}O.fitBounds(m,{padding:30,duration:250,maxZoom:18})}function mt(){if(!ne){i.value=0;return}const u=ne.getAll();i.value=u?.features?.length??0}function Vt(){if(!ne)return;const u=ne.getAll();if(i.value=u?.features?.length??0,!u?.features?.length){Ee=null,d.value=null,T||(Ae="__null__",a("update:modelValue",null));return}const m=qe(u.features[u.features.length-1]?.geometry??null);Ee=m,nt(m),T||(Ae=rt(m),a("update:modelValue",m))}function ft(){if(!ne)return;(ne.getAll()?.features||[]).forEach(m=>ne.delete(m.id)),mt()}function Bt(u){if(!ne)return;const m=Ze(u);if(T=!0,ft(),m)try{ne.add(He(m))}catch{}T=!1,Ee=qe(m),mt(),nt(m),m&&(Et(m),o.value||N())}function wn(){if(ne){if(T=!0,ft(),Ee)try{ne.add(He(Ee))}catch{}T=!1,mt(),nt(Ee)}}function lt(){if(ne){try{ne.changeMode("simple_select",{featureIds:[]})}catch{}c.value=""}}function v(u){if(o.value||!ne)return;R=!0,lt(),c.value=u;const m=u==="marker"?"draw_point":u==="polyline"?"draw_line_string":u==="rectangle"?"draw_rectangle":"draw_polygon";T=!0,ft(),T=!1;try{ne.changeMode(m)}catch{c.value=""}finally{requestAnimationFrame(()=>{R=!1})}}function N(){if(o.value||!ne)return;const u=ne.getAll();if(u?.features?.length)try{ne.changeMode("direct_select",{featureId:u.features[0].id}),c.value="edit"}catch{c.value=""}}function I(){o.value||!ne||(lt(),ft(),Ae="__null__",d.value=null,a("update:modelValue",null))}function ee(){o.value||!Ee||Et(Ee)}function ye(u){O&&O.easeTo({center:[u[1],u[0]],zoom:13,duration:250})}function _e(){o.value||W.value?.click()}function ve(u){if(o.value||!ne)return;const m=u.target,_=m.files?.[0];if(!_)return;const C=new FileReader;C.onload=()=>{try{const U=JSON.parse(String(C.result)),te=Ze(U);if(!te)return;Bt(te)}finally{m.value=""}},C.readAsText(_)}function Ce(){if(o.value||!ne)return;const u=ne.getAll(),m=new Blob([JSON.stringify(u,null,2)],{type:"application/json"}),_=URL.createObjectURL(m),C=document.createElement("a");C.href=_,C.download="data.geojson",C.click(),URL.revokeObjectURL(_)}return e.onMounted(async()=>{if(!s.value)return;const u=await re();fe=u.maplibregl,ge=u.MapboxDraw;const m=oe();m&&(O=new fe.Map({container:s.value,style:me(m),center:[$.value[0],$.value[1]],zoom:S.value,attributionControl:!1}),O.addControl(new fe.NavigationControl({showCompass:!0}),"bottom-right"),O.on("load",()=>{if(!(!ge||!O)){if(ne=new ge({displayControlsDefault:!1,modes:{...ge.modes,draw_rectangle:q()},controls:{point:!1,line_string:!1,polygon:!1,trash:!1},styles:le}),O.addControl(ne),O.on("draw.create",()=>{if(!ne)return;const _=ne.getAll();if(_.features.length>1){const C=_.features[_.features.length-1];T=!0,_.features.slice(0,-1).forEach(U=>ne.delete(U.id)),T=!1,C&&(T=!0,ne.add(C),T=!1)}Vt(),N()}),O.on("draw.update",_=>{if(!M){if(_?.action==="move"){if(M=!0,wn(),M=!1,c.value==="edit"){const C=ne?.getAll?.()?.features?.[0];if(C?.id)try{ne.changeMode("direct_select",{featureId:C.id})}catch{c.value=""}}return}Vt()}}),O.on("draw.delete",()=>{c.value==="marker"||c.value==="polyline"||c.value==="polygon"||c.value==="rectangle"||(Vt(),c.value="",lt())}),O.on("draw.selectionchange",()=>{if(!(!ne||M)&&c.value!=="edit"&&!(c.value==="marker"||c.value==="polyline"||c.value==="polygon"||c.value==="rectangle")){if(!o.value&&i.value>0){N();return}try{ne.changeMode("simple_select",{featureIds:[]})}catch{}}}),j.value!==void 0){const _=j.value;j.value=void 0,requestAnimationFrame(()=>{ne&&Bt(_)})}Ue(),L.value.forEach(_=>{const C=z[_];C&&xe(C)}),Re()}}),O.on("zoomend",()=>{O&&(S.value=O.getZoom())}))}),e.onUnmounted(()=>{Object.values(z).forEach(u=>{O&&J(u)}),we(),O?.remove&&O.remove(),O=null,ne=null}),e.watch(()=>n.modelValue,u=>{if(!ne){j.value=u;return}const m=Ze(u),_=rt(m);if(Ae&&_===Ae){Ae=null;return}Ae=null,Bt(u)},{deep:!0}),e.watch(()=>b.value,u=>{const m=Array.isArray(u)?u:[],_=[],C=new Set;m.forEach((U,te)=>{if(!U)return;const X=be(U,te);_.push(X),C.add(X);const ie={...U,id:X},Be=z[X],Fe=Be?.visible??!!ie.visible;Be&&O&&J(Be),z[X]={id:X,config:ie,visible:Fe,sourceId:`vs-ov-src-${X}`,layerIds:[],boundsIds:[],handlers:[]}}),Object.keys(z).forEach(U=>{if(C.has(U))return;const te=z[U];te&&O&&J(te),delete z[U]}),L.value=_,O&&(L.value.forEach(U=>{const te=z[U];te&&xe(te)}),Re())},{immediate:!0,deep:!0}),e.watch(()=>B.value,()=>{O&&(Ue(),L.value.forEach(u=>{const m=z[u];m&&xe(m)}),Re())},{deep:!0}),e.watch(()=>w.value,async u=>{if(K.value=[],!u){O&&(Ue(),L.value.forEach(m=>{const _=z[m];_&&xe(_)}),Re());return}try{const m=await fetch(`https://data.gki.com.ua/api-user/atu/${u}`);if(!m?.ok)return;const C=(await m.json())?.geometry?.coordinates;Array.isArray(C)&&C.length&&(K.value=C)}catch(m){console.error("Failed to fetch KATOTTG bounds",m)}finally{if(!O)return;Ue(),L.value.forEach(m=>{const _=z[m];_&&xe(_)}),Re()}},{immediate:!0}),e.watch(()=>x.value,u=>{if(!Array.isArray(u)||u.length!==2)return;const m=[Number(u[0]),Number(u[1])];if(st($.value,m)||($.value=[...m],!O))return;const _=O.getCenter?.();_&&st([_.lng,_.lat],$.value)||O.easeTo({center:[$.value[0],$.value[1]]})},{deep:!0}),e.watch(()=>k.value,u=>{typeof u=="number"&&(S.value=u,O&&O.setZoom(u))}),e.watch(o,u=>{u&<()}),e.watch(i,u=>{if(u>0){o.value||N();return}R||lt()}),e.watch(r,()=>{setTimeout(()=>{O?.resize&&O.resize()},50)}),(u,m)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body",disabled:!r.value},[e.createElementVNode("div",{class:e.normalizeClass(["vs-map-wrapper relative w-full h-[400px]",{fullscreen:r.value}])},[e.createElementVNode("div",{ref_key:"mapContainer",ref:s,class:"w-full h-[calc(100%-28px)]"},null,512),P.value.search||P.value.import||P.value.export?(e.openBlock(),e.createElementBlock("div",Ai,[P.value.search?(e.openBlock(),e.createBlock(Di,{key:0,onGoToCoordinates:ye})):e.createCommentVNode("",!0),P.value.import||P.value.export?(e.openBlock(),e.createElementBlock("div",Fi,[e.createElementVNode("div",Ii,[P.value.import?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:_e,disabled:o.value}," Import ",8,Li)):e.createCommentVNode("",!0),P.value.export?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:Ce,disabled:o.value||i.value===0}," Export ",8,Ti)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"importRef",ref:W,type:"file",onChange:ve,accept:".json,.geojson",class:"hidden",disabled:o.value},null,40,Oi)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",zi,[e.createElementVNode("div",Ri,[P.value.point?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-btn",{"vs-active":c.value==="marker"}]),title:"Point",onClick:m[0]||(m[0]=_=>v("marker")),disabled:o.value},[e.createVNode(li)],10,ji)):e.createCommentVNode("",!0),P.value.line?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["vs-btn",{"vs-active":c.value==="polyline"}]),title:"Line",onClick:m[1]||(m[1]=_=>v("polyline")),disabled:o.value},[e.createVNode(si)],10,Pi)):e.createCommentVNode("",!0),P.value.polygon?(e.openBlock(),e.createElementBlock("button",{key:2,class:e.normalizeClass(["vs-btn",{"vs-active":c.value==="polygon"}]),title:"Polygon",onClick:m[2]||(m[2]=_=>v("polygon")),disabled:o.value},[e.createVNode(ui)],10,Ui)):e.createCommentVNode("",!0),P.value.rectangle?(e.openBlock(),e.createElementBlock("button",{key:3,class:e.normalizeClass(["vs-btn",{"vs-active":c.value==="rectangle"}]),title:"Rectangle",onClick:m[3]||(m[3]=_=>v("rectangle")),disabled:o.value},[e.createVNode(hi)],10,Hi)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:m[4]||(m[4]=_=>r.value=!r.value),title:"Full Screen"},[e.createVNode(bi,{style:{width:"12px",height:"12px"}})])])]),A.value.length?(e.openBlock(),e.createElementBlock("div",{key:1,class:"absolute z-[1500] pointer-events-none",style:e.normalizeStyle(H.value)},[e.createElementVNode("div",qi,[e.createElementVNode("dl",Ki,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(A.value,_=>(e.openBlock(),e.createElementBlock("div",{key:`${_.key}-${_.value}`,class:"flex justify-between gap-2"},[e.createElementVNode("dt",Gi,e.toDisplayString(_.key),1),e.createElementVNode("dd",Yi,e.toDisplayString(_.value),1)]))),128))])])],4)):e.createCommentVNode("",!0),e.createElementVNode("div",Wi,[e.createElementVNode("div",Zi,[e.createVNode(Ei,{basemaps:e.unref(Te),onOnLayerChange:tt},null,8,["basemaps"]),Z.value.length?(e.openBlock(),e.createElementBlock("div",Ji,[m[5]||(m[5]=e.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Шари",-1)),e.createElementVNode("div",Xi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Z.value,_=>(e.openBlock(),e.createElementBlock("label",{key:_.id,class:"flex items-center gap-2 cursor-pointer select-none"},[e.createElementVNode("input",{type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:_.visible,disabled:o.value,onChange:C=>ze(_.id)},null,40,Qi),e.createElementVNode("span",ec,e.toDisplayString(_.config.title||_.config.name||_.id),1)]))),128))])])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",tc,[d.value?(e.openBlock(),e.createElementBlock("div",nc,[e.createElementVNode("div",lc,[e.createElementVNode("div",ac,[m[6]||(m[6]=e.createTextVNode(" Type: ",-1)),e.createElementVNode("span",oc,e.toDisplayString(d.value.type),1)])]),e.createElementVNode("div",rc,[e.createElementVNode("div",sc,[m[7]||(m[7]=e.createTextVNode(" Center: ",-1)),e.createElementVNode("b",null,e.toDisplayString(d.value.center.lat.toFixed(5))+", "+e.toDisplayString(d.value.center.lng.toFixed(5)),1)]),d.value.areaKm2!==null?(e.openBlock(),e.createElementBlock("div",ic,[m[8]||(m[8]=e.createTextVNode(" Area: ",-1)),e.createElementVNode("b",null,e.toDisplayString(d.value.areaKm2.toFixed(1))+" km²",1)])):(e.openBlock(),e.createElementBlock("div",cc,m[9]||(m[9]=[e.createTextVNode("Area: ",-1),e.createElementVNode("b",null,"—",-1)]))),e.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Zoom to feature",onClick:ee,disabled:o.value},m[10]||(m[10]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"w-3 h-3"},[e.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),e.createElementVNode("path",{d:"M7 10l6 0"}),e.createElementVNode("path",{d:"M10 7l0 6"}),e.createElementVNode("path",{d:"M21 21l-6 -6"})],-1)]),8,dc),e.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Delete feature",onClick:I,disabled:o.value},[e.createVNode(ct,{class:"w-3 h-3"})],8,uc)])])):e.createCommentVNode("",!0)])],2)],8,["disabled"]))}}),[["__scopeId","data-v-3b015982"]]),pc=["data-focus"],mc={class:"flex items-center"},fc={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},hc=["onClick","aria-label"],gc={key:0,class:"absolute text-gray-500 truncate pl-2"},yc={class:"flex-1 min-w-[2px]"},kc=["placeholder"],bc={class:"flex items-center shrink-0"},wc=["disabled"],Ln=e.defineComponent({__name:"vs-input-tag",props:e.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=t;De(n.style);const o=e.ref(null),r=e.ref(null),s=e.ref(null),i=e.ref(!1),c=e.ref(""),d=e.useModel(l,"modelValue"),p=e.computed(()=>n.placeholder||"Add tag…"),g=e.computed(()=>d.value?.length===0&&c.value===""),E=e.computed(()=>!n.disabled&&d.value?.length>0),y=e.computed(()=>n.disabled),V=async()=>{y.value||await e.nextTick(()=>s.value?.focus())},f=$=>{const S=$.trim();S!==""&&(!d.value||!Array.isArray(d.value)?d.value=[S]:n.unique?d.value.includes(S)||(d.value=[...d.value,S]):d.value=[...d.value,S],c.value="")},h=()=>{const $=c.value;$.trim()!==""&&f($),c.value=""},x=$=>{const S=d.value.slice();S.splice($,1),a("update:modelValue",S)},k=()=>{a("update:modelValue",[])},w=()=>{y.value||(i.value=!0)},b=()=>{i.value=!1,!y.value&&h()},B=$=>{const{key:S}=$;S==="Enter"?($.preventDefault(),h()):S==="Backspace"&&c.value===""&&d.value.length>0&&x(d.value.length-1)};return($,S)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:S[1]||(S[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass]),role:"group","aria-label":"Tag input"},[e.createElementVNode("div",{class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",i.value?"border-blue-500 ring-1 ring-blue-500":"",y.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":i.value?"true":"false",onClick:V},[e.createElementVNode("div",{class:"flex flex-1 flex-wrap items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"chipsRef",ref:r},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(j,W)=>(e.openBlock(),e.createElementBlock("div",{key:W,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[e.createElementVNode("div",mc,[e.createElementVNode("div",fc,e.toDisplayString(j),1)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:e.withModifiers(K=>x(W),["stop"]),"aria-label":`Remove ${j}`},S[2]||(S[2]=[e.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,hc)]))),128)),g.value?(e.openBlock(),e.createElementBlock("div",gc,e.toDisplayString(p.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",yc,[y.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:s,class:"pl-2 w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-label":"Add tag","onUpdate:modelValue":S[0]||(S[0]=j=>c.value=j),onFocus:w,onBlur:b,onKeydown:B,placeholder:d.value&&d.value.length?"":void 0},null,40,kc)),[[e.vModelText,c.value]])])],512),e.createElementVNode("div",bc,[E.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:y.value,onClick:e.withModifiers(k,["stop"])},S[3]||(S[3]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,wc)):e.createCommentVNode("",!0)])],10,pc)],2)],512))}}),xc={class:"relative flex gap-1 bg-white w-full"},_c=["disabled","placeholder"],Tn=ae(e.defineComponent({__name:"vs-input-slug",props:e.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=e.inject("values"),n=l,a=e.useModel(l,"modelValue");function o(s){const i={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"y",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"kh",ц:"ts",ч:"ch",ш:"sh",щ:"shch",ы:"y",э:"e",ю:"yu",я:"ya",ь:"",ъ:"",є:"ye",і:"i",ї:"yi",ґ:"g"};return s.toLowerCase().split("").map(c=>i[c]||c).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const r=()=>{const s=t?.value?.[n.parent||""]?.toString(),i=o(s);a.value=i.toString()};return(s,i)=>(e.openBlock(),e.createElementBlock("div",xc,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:s.disabled,placeholder:s.placeholder,"onUpdate:modelValue":i[0]||(i[0]=c=>a.value=c),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,_c),[[e.vModelText,a.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:r}," Gen ")]))}}),[["__scopeId","data-v-b0eba370"]]),vc={class:"relative flex gap-1 bg-white w-full"},Ec=["disabled","placeholder"],Vc=["disabled"],Bc={key:0},Cc={key:1},On=ae(e.defineComponent({__name:"vs-input-codegen",props:e.mergeModels({table:{},code:{},init:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref(!1),o=e.computed(()=>t.init!==!1),r=e.computed(()=>!!t.table&&!!t.code),s=()=>{if(!r.value)return"";const d=encodeURIComponent(String(t.table)),p=encodeURIComponent(String(t.code));return`/api/code-gen/${d}/${p}`},i=async()=>{if(!r.value||a.value)return;const d=s();if(d){a.value=!0;try{const g=await(await fetch(d)).text();n.value=g}finally{a.value=!1}}},c=()=>{o.value&&(n.value||i())};return e.onMounted(()=>{c()}),e.watch(()=>[t.table,t.code,t.init],()=>{c()}),(d,p)=>(e.openBlock(),e.createElementBlock("div",vc,[e.withDirectives(e.createElementVNode("input",{disabled:d.disabled,placeholder:d.placeholder,"onUpdate:modelValue":p[0]||(p[0]=g=>n.value=g),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,Ec),[[e.vModelText,n.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:a.value||d.disabled||!r.value,onClick:i},[a.value?(e.openBlock(),e.createElementBlock("span",Cc,"...")):(e.openBlock(),e.createElementBlock("span",Bc,"Gen"))],8,Vc)]))}}),[["__scopeId","data-v-6ee5237d"]]),Sc={class:"w-full"},Nc={ref:"sortableContainer",class:"flex flex-col gap-1"},$c=["onDragstart","onDrop"],Mc={class:"w-1/3"},Dc={class:"w-2/3"},Ac=["onClick"],Fc={key:0,class:"text-[14px] text-gray-700"},Ic={class:"mt-2 w-full flex items-center"},Lc=["disabled"],zn=ae(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=h=>`${h}-${Math.random().toString(36).substring(2,15)}`,a=e.inject("values"),o=l,r=t,s=o.addButtonText??"Додати",i=o.ignore??[],c=e.ref([]),d=e.ref(null);(()=>{const h=o.parent&&a?.value?.[o.parent]||o.modelValue||{};c.value=Object.entries(h).filter(([x])=>!i.includes(x)).map(([x,k])=>({id:n("key-value-"),key:x,value:k}))})();function g(h){d.value=h}function E(h){if(d.value===null||d.value===h)return;const x=c.value.splice(d.value,1)[0];c.value.splice(h,0,x),d.value=null}const y=e.computed(()=>c.value.some(h=>h.key&&!h.value||!h.key&&h.value)),V=()=>{c.value.push({id:n("key-value-"),key:"",value:""})},f=h=>{c.value=c.value.filter(x=>x.id!==h)};return e.watch(c,h=>{const x={};h.forEach(w=>{w.key&&w.value!==void 0&&(x[w.key]=w.value)});const k={};i.length&&i.forEach(w=>{k[w]=o.parent?a?.value?.[o.parent]?.[w]:void 0}),a?.value&&o.parent&&(a.value[o.parent]={...k,...x}),r("update:modelValue",x)},{deep:!0}),(h,x)=>(e.openBlock(),e.createElementBlock("div",Sc,[e.createElementVNode("div",Nc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(k,w)=>(e.openBlock(),e.createElementBlock("div",{key:k.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===w}]),draggable:"true",onDragstart:b=>g(w),onDragover:x[0]||(x[0]=e.withModifiers(()=>{},["prevent"])),onDrop:b=>E(w)},[x[1]||(x[1]=e.createStaticVNode('<button class="cursor-move" data-v-81b9444f><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-81b9444f><circle cx="15" cy="12" r="1.5" data-v-81b9444f></circle><circle cx="15" cy="24" r="1.5" data-v-81b9444f></circle><circle cx="21" cy="12" r="1.5" data-v-81b9444f></circle><circle cx="21" cy="24" r="1.5" data-v-81b9444f></circle><circle cx="21" cy="18" r="1.5" data-v-81b9444f></circle><circle cx="15" cy="18" r="1.5" data-v-81b9444f></circle></svg></button>',1)),e.createElementVNode("div",Mc,[e.createVNode(it,{modelValue:k.key,"onUpdate:modelValue":b=>k.key=b,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Dc,[e.createVNode(it,{modelValue:k.value,"onUpdate:modelValue":b=>k.value=b,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:b=>f(k.id),class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200"},[e.createVNode(e.unref(St),{height:"16",width:"16"})],8,Ac)],42,$c))),128))],512),c.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Fc," Дані для відображення відсутні ")),e.createElementVNode("div",Ic,[e.createElementVNode("button",{type:"button",onClick:V,disabled:y.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(Ke,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(e.unref(s)),1)],8,Lc)])]))}}),[["__scopeId","data-v-81b9444f"]]),Tc={class:"w-full"},Oc={ref:"sortableContainer",class:"flex flex-col gap-1"},zc=["onDragstart","onDrop"],Rc=["disabled"],jc={class:"flex-1"},Pc=["onClick","disabled"],Uc={key:0,class:"text-[14px] text-gray-700"},Hc={class:"mt-2 w-full flex items-center"},qc=["disabled"],Rn=ae(e.defineComponent({__name:"vs-input-text-array",props:e.mergeModels({addButtonText:{default:"Додати"},inputType:{default:"text"},placeholder:{default:"Значення"},mask:{default:""},disabled:{type:Boolean,default:!1}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref([]),o=e.ref(null),r=e.computed(()=>!!t.disabled),s=e.computed(()=>t.placeholder??""),i=e.computed(()=>t.addButtonText??"Додати");let c=!1;const d=h=>`${h}-${Math.random().toString(36).substring(2,15)}`,p=h=>{const x=h??n.value??[];a.value=x.map((k,w)=>({id:a.value[w]?.id??d("text-array"),value:k??""}))};p(),e.watch(()=>n.value,h=>{if(c){c=!1;return}p(h||[])},{deep:!0}),e.watch(a,h=>{c=!0,n.value=h.map(x=>x.value).filter(x=>x!=null&&x!=="")},{deep:!0});const g=e.computed(()=>r.value||a.value.some(h=>!h.value));function E(){g.value||(a.value=[...a.value,{id:d("text-array"),value:""}])}function y(h){r.value||(a.value=a.value.filter(x=>x.id!==h))}function V(h){r.value||(o.value=h)}function f(h){if(r.value||o.value===null||o.value===h)return;const x=[...a.value],[k]=x.splice(o.value,1);x.splice(h,0,k),a.value=x,o.value=null}return(h,x)=>(e.openBlock(),e.createElementBlock("div",Tc,[e.createElementVNode("div",Oc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(k,w)=>(e.openBlock(),e.createElementBlock("div",{key:k.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":o.value===w}]),draggable:"true",onDragstart:b=>V(w),onDragover:x[0]||(x[0]=e.withModifiers(()=>{},["prevent"])),onDrop:b=>f(w)},[e.createElementVNode("button",{class:"cursor-move",type:"button",disabled:r.value},x[1]||(x[1]=[e.createStaticVNode('<svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-66316a33><circle cx="15" cy="12" r="1.5" data-v-66316a33></circle><circle cx="15" cy="24" r="1.5" data-v-66316a33></circle><circle cx="21" cy="12" r="1.5" data-v-66316a33></circle><circle cx="21" cy="24" r="1.5" data-v-66316a33></circle><circle cx="21" cy="18" r="1.5" data-v-66316a33></circle><circle cx="15" cy="18" r="1.5" data-v-66316a33></circle></svg>',1)]),8,Rc),e.createElementVNode("div",jc,[h.inputType==="text"?(e.openBlock(),e.createBlock(it,{key:0,modelValue:k.value,"onUpdate:modelValue":b=>k.value=b,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),h.inputType==="tel"?(e.openBlock(),e.createBlock(tn,{key:1,modelValue:k.value,"onUpdate:modelValue":b=>k.value=b,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),h.inputType==="email"?(e.openBlock(),e.createBlock(en,{key:2,modelValue:k.value,"onUpdate:modelValue":b=>k.value=b,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),h.inputType==="mask"?(e.openBlock(),e.createBlock(Qt,{key:3,modelValue:k.value,"onUpdate:modelValue":b=>k.value=b,mask:h.mask,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","mask","disabled","placeholder"])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:b=>y(k.id),disabled:r.value,class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200 disabled:opacity-50"},[e.createVNode(e.unref(St),{height:"16",width:"16"})],8,Pc)],42,zc))),128))],512),a.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Uc," Дані для відображення відсутні ")),e.createElementVNode("div",Hc,[e.createElementVNode("button",{type:"button",onClick:E,disabled:g.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(Ke,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(i.value),1)],8,qc)])]))}}),[["__scopeId","data-v-66316a33"]]),Kc={class:"flex items-center gap-2 w-full"},Gc=["disabled"],Yc=["disabled"],jn=e.defineComponent({__name:"vs-input-color",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,{inputClass:a}=De(n.style),o=t,r=e.computed({get:()=>n.modelValue||"#000000",set:i=>o("update:modelValue",i)}),s=e.computed(()=>!!n.disabled);return(i,c)=>(e.openBlock(),e.createElementBlock("div",Kc,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),disabled:s.value,ref:"color",class:e.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[i.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Gc),[[e.vModelText,r.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":c[1]||(c[1]=d=>r.value=d),disabled:s.value},null,8,Yc),[[e.vModelText,r.value]])]))}}),Wc={class:"flex items-center gap-2 w-full"},Zc=["min","max","step","disabled"],Jc=["disabled"],Pn=e.defineComponent({__name:"vs-input-range",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},min:{default:0},max:{default:100},step:{default:1}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,{inputClass:a}=De(n.style),o=t,r=e.computed({get:()=>Number(n.modelValue??n.min),set:i=>o("update:modelValue",Number(i))}),s=e.computed(()=>!!n.disabled);return(i,c)=>(e.openBlock(),e.createElementBlock("div",Wc,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),min:i.min,max:i.max,step:i.step,disabled:s.value,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[i.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")])},null,10,Zc),[[e.vModelText,r.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":c[1]||(c[1]=d=>r.value=d),disabled:s.value},null,8,Jc),[[e.vModelText,r.value]])]))}}),Xc=["placeholder","disabled","name"],Qc=["type","value","onInput","placeholder","disabled"],ed=["onClick"],Un=e.defineComponent({__name:"vs-input-array",props:e.mergeModels({count:{default:1},limit:{default:1},mask:{default:""},unmask:{type:Boolean,default:!1},inputType:{default:"text"},isAdded:{type:Boolean,default:!1},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.ref(t.count),a=e.computed(()=>t.limit),{inputClass:o}=De(t.style),r=e.useModel(l,"modelValue"),s=e.computed(()=>!!t.disabled),i=e.computed(()=>t.placeholder??"");e.watchEffect(()=>{const f=r.value?.length??0;f<n.value&&(r.value=[...r.value??[],...Array(n.value-f)])});const c=e.ref({}),d=e.ref({});function p(f,h){f&&(c.value[h]=f)}async function g(f,h){if(!f||t.inputType!=="mask")return;const{default:x}=await Promise.resolve().then(()=>bn);d.value[h]&&d.value[h].destroy(),d.value[h]=x(f,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),d.value[h].on("accept",()=>{const k=[...r.value||[]];k[h]=t.unmask?d.value[h].unmaskedValue:d.value[h].value,r.value=k}),d.value[h].on("complete",()=>{const k=[...r.value||[]];k[h]=t.unmask?d.value[h].unmaskedValue:d.value[h].value,r.value=k}),r.value?.[h]&&(d.value[h].value=r.value[h])}function E(f,h){if(s.value)return;const x=f.target.value??null,k=[...r.value];k[h]=t.inputType==="text"?x:Number(x),r.value=k}function y(){n.value+=1;const f=t.inputType==="text"||t.inputType==="mask"?null:0;r.value=[...r.value,f],t.inputType==="mask"&&setTimeout(()=>{const h=n.value-1;c.value[h]&&g(c.value[h],h)},0)}function V(f){if(n.value>1){d.value[f]&&(d.value[f].destroy(),delete d.value[f]),n.value-=1,r.value=r.value.filter((x,k)=>k!==f);const h={};Object.keys(d.value).forEach(x=>{const k=parseInt(x,10);k>f?h[k-1]=d.value[k]:k<f&&(h[k]=d.value[k])}),d.value=h}}return e.onMounted(()=>{if(t.inputType==="mask")for(let f=0;f<n.value;f+=1)c.value[f]&&g(c.value[f],f)}),e.onBeforeUnmount(()=>{Object.values(d.value).forEach(f=>{f&&f.destroy()})}),e.watch(()=>t.mask,f=>{t.inputType==="mask"&&Object.values(d.value).forEach(h=>{h&&h.updateOptions({mask:f,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})})}),e.watch(r,f=>{t.inputType==="mask"&&f&&f.forEach((h,x)=>{d.value[x]&&d.value[x].value!==h&&(d.value[x].value=h||"")})},{deep:!0}),(f,h)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["grid gap-2",`grid-cols-${a.value}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,x=>(e.openBlock(),e.createElementBlock("div",{key:x,class:"flex items-center gap-2 w-full"},[f.inputType==="mask"?(e.openBlock(),e.createElementBlock("input",{key:0,type:"text",ref_for:!0,ref:k=>p(k,x-1),placeholder:f.placeholder,disabled:f.disabled,name:`${f.name}[${x-1}]`,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":f.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Xc)):(e.openBlock(),e.createElementBlock("input",{key:1,type:f.inputType,value:r.value?.[x-1],onInput:k=>E(k,x-1),placeholder:i.value,disabled:s.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":f.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Qc)),!f.disabled&&x===n.value&&f.isAdded?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:e.withModifiers(y,["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-green-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(Ke,{height:"18",width:"18"})])):e.createCommentVNode("",!0),!f.disabled&&n.value>1&&f.isAdded?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",onClick:e.withModifiers(k=>V(x-1),["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-red-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(St,{height:"18",width:"18"})],8,ed)):e.createCommentVNode("",!0)]))),128))],2))}}),td=["aria-expanded","data-focus"],nd=["placeholder","disabled","readonly"],ld={class:"max-h-full"},ad=["onClick","disabled"],od={key:0,class:"px-3 py-2 text-sm text-stone-500"},rd={class:"flex flex-col gap-1"},sd=["onDragstart","onDrop"],id=["disabled"],cd=["title"],dd=["disabled","onClick","aria-label"],ud={key:0,class:"text-xs text-stone-500"},Ft=ae(e.defineComponent({__name:"vs-input-array-select",props:e.mergeModels({options:{default:()=>[]},data:{default:""},api:{default:""},prefix:{default:"api"},host:{default:""},parent:{},search:{type:Boolean,default:!0},maxHeight:{default:280},start:{default:0},slot:{},disabled:{type:Boolean,default:!1},style:{},customClass:{},modelValue:{},error:{},name:{},placeholder:{default:"Оберіть значення"},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["change","update:modelValue","value-selected"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=t,o=e.useModel(l,"modelValue"),r=e.ref([]),s=e.ref(n.options??[]),i=e.ref({}),c=e.ref({}),d=e.ref({keyword:"",parent:null}),p=e.ref(""),g=e.ref(!1),E=e.ref(null),y=e.ref(null),V=e.ref(null),f=e.ref(null),h=e.ref(null),x=e.ref({});let k=!1,w=!1;const b=e.inject("values"),B=e.computed(()=>!!n.disabled),$=e.computed(()=>n.placeholder??"Оберіть значення"),S=e.computed(()=>n.search!==!1),j=e.computed(()=>{const D=n.parent??n.parentValue;return D?String(D):""}),W=e.computed(()=>j.value?b?.value?.[j.value]??null:null),K=D=>D==null?"__null__":String(D),T=D=>{if(!D)return"";const G=D.label??D.text??D.name??D.ua??D.en;return G?String(G):D.id!==void 0&&D.id!==null?String(D.id):""},z=D=>{const G=K(D);return c.value[G]||(c.value[G]=`array-select-${G}-${Math.random().toString(36).slice(2,8)}`),c.value[G]},L=e.computed(()=>new Set(r.value.map(D=>K(D.id)))),Z=e.computed(()=>{const D=L.value;let G=[...s.value];if(!n.data&&p.value.trim()){const J=p.value.toLowerCase();G=G.filter(ue=>T(ue).toLowerCase().includes(J))}return G.filter(J=>!D.has(K(J.id)))}),F=()=>{if(!n.data)return"";const D=n.prefix??"api",G=n.api??`/${D}/suggest/${n.data}`;return`${n.host??""}${G}`},A=()=>{r.value.length&&(k=!0,r.value=r.value.map(D=>({...D,text:i.value[K(D.id)]??D.text})))},H=D=>{const G=K(D.id),J=T(D);J&&(i.value[G]=J)},P=D=>{s.value=D?[...D]:[],D?.forEach(H),A()},pe=D=>{if(!D.length)return;const G=new Map(s.value.map(J=>[K(J.id),J]));D.forEach(J=>{const ue=K(J.id);G.set(ue,J),H(J)}),s.value=Array.from(G.values()),A()},ke=async(D="")=>{if(!n.data)return[];const G=F();if(!G)return[];const J=new URLSearchParams;J.set("json","1"),D&&J.set("key",D),n.start===1&&J.set("start","1"),W.value!==null&&W.value!==void 0&&W.value!==""&&J.set("parent",String(W.value));try{return(await(await fetch(`${G}?${J.toString()}`)).json())?.data??[]}catch{return[]}},Te=async D=>{if(!n.data||!D.length)return[];const G=F();if(!G)return[];const J=Array.from(new Set(D.map(xe=>K(xe)))),ue=new URLSearchParams;ue.set("json","1"),ue.set("val",J.join(",")),n.start===1&&ue.set("start","1"),W.value!==null&&W.value!==void 0&&W.value!==""&&ue.set("parent",String(W.value));try{const ze=(await(await fetch(`${G}?${ue.toString()}`)).json())?.data??[];return pe(ze),ze}catch{return[]}},Ie=async(D="",{force:G=!1}={})=>{if(!n.data)return;const J=W.value??null;if(!G&&d.value.keyword===D&&d.value.parent===J&&s.value.length>0)return;d.value={keyword:D,parent:J};const xe=await ke(D);P(xe)},re=((D,G=200)=>{let J;return(...ue)=>{J&&clearTimeout(J),J=setTimeout(()=>D(...ue),G)}})(async D=>{n.data&&await Ie(D,{force:!0})},250),me=e.ref(null),fe=()=>{if(!V.value)return;const D=V.value.getBoundingClientRect(),G=window.innerHeight??document.documentElement.clientHeight,J=window.innerWidth??document.documentElement.clientWidth,ue=8,xe=8,Ue=n.maxHeight??280,ze=G-D.bottom-xe-ue,Re=D.top-xe-ue,tt=ze>=Re,Ze=Math.max(J-ue*2,0);let{width:He}=D;Ze>0&&He>Ze&&(He=Ze);let{left:qe}=D;qe+He+ue>J&&(qe=J-He-ue),qe=Math.max(qe,ue);const rt=Math.min(Ue,Math.max(tt?ze:Re,50));x.value={position:"fixed",left:`${qe}px`,width:`${He}px`,maxHeight:`${rt}px`,transform:tt?"none":"translateY(-100%)",top:tt?`${D.bottom+xe}px`:`${D.top-xe}px`}},ge=async(D="click")=>{B.value||g.value||(me.value=D,await Ie(p.value.trim()),g.value=!0,await e.nextTick(),fe(),h.value?.focus())},O=()=>{g.value=!1,me.value=null,e.nextTick(()=>{h.value?.blur()})},ne=async D=>{if(D.stopPropagation(),!B.value){if(g.value){if(me.value==="focus"){me.value=null;return}O();return}await ge("click")}},Ee=D=>{D.key==="Escape"&&O()},Ae=D=>{if(!g.value)return;const G=D.target;f.value?.contains(G)||O()},M=D=>{const G=D.target;y.value?.contains(G)||f.value?.contains(G)||O()},R=D=>{if(D.key==="Escape"){D.preventDefault(),O();return}if(D.key==="Enter"){D.preventDefault();const G=Z.value[0];G&&q(G)}},q=D=>{if(!D)return;const G=K(D.id);if(L.value.has(G))return;H(D);const J={id:D.id,text:T(D)||String(D.id??""),key:z(D.id)};r.value=[...r.value,J],le(D),p.value="",e.nextTick(()=>{h.value?.focus()})},le=D=>{const G=r.value.map(J=>J.id);a("value-selected",{name:n.name,value:G,option:D})},oe=D=>{if(B.value)return;const G=r.value.filter(J=>K(J.id)!==K(D));r.value=G},be=D=>{B.value||(E.value=D)},Ve=D=>{if(B.value||E.value===null||E.value===D)return;const G=[...r.value],[J]=G.splice(E.value,1);G.splice(D,0,J),E.value=null,r.value=G},we=async()=>{const G=(Array.isArray(o.value)?[...o.value]:[]).filter(ue=>ue!=null);if(n.data&&G.length){const ue=G.filter(xe=>!i.value[K(xe)]);ue.length&&await Te(ue)}const J=G.map(ue=>({id:ue,text:i.value[K(ue)]??String(ue),key:z(ue)}));k=!0,r.value=J};e.watch(r,D=>{if(k){k=!1;return}const G=D.map(J=>J.id);w=!0,o.value=G,a("change",G)},{deep:!0}),e.watch(o,()=>{if(w){w=!1;return}we()},{deep:!0}),e.watch(p,D=>{!n.data||!g.value||re(D.trim())}),e.watch(B,D=>{D&&O()}),e.watch(()=>n.options,async D=>{n.data||(P(D??[]),await we())},{immediate:!0,deep:!0}),e.watch(()=>n.data,async D=>{D&&(await Ie(p.value.trim()),await we())},{immediate:!0});const Xe=e.ref(!1);return e.watch(W,async()=>{if(n.data){if(!Xe.value){Xe.value=!0;return}r.value=[],await Ie(p.value.trim()),await we()}}),e.onMounted(async()=>{document.addEventListener("click",M,!0),window.addEventListener("keydown",Ee),window.addEventListener("scroll",Ae,!0),await we()}),e.onUnmounted(()=>{document.removeEventListener("click",M,!0),window.removeEventListener("keydown",Ee),window.removeEventListener("scroll",Ae,!0)}),(D,G)=>(e.openBlock(),e.createElementBlock("div",{class:"flex flex-col gap-2 w-full",ref_key:"rootRef",ref:y},[e.createElementVNode("div",{class:"relative",onClick:G[2]||(G[2]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{ref_key:"triggerRef",ref:V,class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white px-3","border-gray-300 hover:border-[#b3d4ff]",g.value?"border-[#2684ff] ring-1 ring-[#2684ff] shadow-[0_0_0_1px_rgba(38,132,255,0.5)]":"",B.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":g.value,"aria-haspopup":"listbox","data-focus":g.value?"true":"false",onClick:ne},[e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:h,"onUpdate:modelValue":G[0]||(G[0]=J=>p.value=J),placeholder:$.value,disabled:B.value,readonly:!S.value,onFocus:G[1]||(G[1]=()=>ge("focus")),onKeydown:R,class:"flex-1 bg-transparent border-0 outline-none px-0 py-1 text-sm text-stone-900 placeholder:text-stone-400"},null,40,nd),[[e.vModelText,p.value]]),e.createElementVNode("span",{class:e.normalizeClass(["text-stone-400 transition-transform duration-150",g.value?"rotate-180":""]),"aria-hidden":"true"},[e.createVNode(Zt,{width:"16",height:"16"})],2)],10,td),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[g.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:f,class:"fixed z-[3000] rounded-md border border-stone-200 bg-white shadow-lg overflow-auto",style:e.normalizeStyle(x.value)},[e.createElementVNode("div",ld,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Z.value,J=>(e.openBlock(),e.createElementBlock("button",{key:K(J.id),type:"button",class:"w-full px-3 py-2 text-left text-sm text-stone-900 hover:bg-stone-100 disabled:opacity-50",onClick:e.withModifiers(ue=>q(J),["stop"]),disabled:B.value},e.toDisplayString(T(J)),9,ad))),128)),Z.value.length===0?(e.openBlock(),e.createElementBlock("p",od," Немає варіантів ")):e.createCommentVNode("",!0)])],4)):e.createCommentVNode("",!0)]),_:1})]))]),e.createElementVNode("div",rd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(J,ue)=>(e.openBlock(),e.createElementBlock("div",{key:J.key,class:e.normalizeClass(["flex items-center gap-2 rounded-md border border-stone-200 bg-white px-2 py-2",{"opacity-60":E.value===ue}]),draggable:"true",onDragstart:xe=>be(ue),onDragover:G[3]||(G[3]=e.withModifiers(()=>{},["prevent"])),onDrop:xe=>Ve(ue),onDragend:G[4]||(G[4]=xe=>E.value=null)},[e.createElementVNode("button",{type:"button",class:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-stone-500 hover:text-stone-900",disabled:B.value,"aria-label":"Перетягнути"},[e.createVNode($t,{width:"14",height:"14"})],8,id),e.createElementVNode("div",{class:"flex-1 text-sm text-stone-900",title:J.text},e.toDisplayString(J.text),9,cd),e.createElementVNode("button",{type:"button",class:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-stone-400 hover:text-stone-900",disabled:B.value,onClick:e.withModifiers(xe=>oe(J.id),["stop"]),"aria-label":`Видалити ${J.text}`},[e.createVNode(St,{width:"14",height:"14"})],8,dd)],42,sd))),128)),r.value.length===0?(e.openBlock(),e.createElementBlock("p",ud,"Немає вибраних значень")):e.createCommentVNode("",!0)])],512))}}),[["__scopeId","data-v-ad849ae4"]]),pd={class:"flex items-center gap-2 w-full"},md={class:"relative flex-1"},fd=["placeholder","disabled","onKeydown"],hd=["disabled"],gd={key:0,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},yd={key:1,class:"animate-spin h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},kd={key:0,class:"fixed inset-0 z-[1000] flex items-center justify-center bg-black/50"},bd={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},wd={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},xd=["onClick"],_d={key:0,class:"p-4 text-sm text-gray-500"},Hn=e.defineComponent({__name:"vs-input-address",props:e.mergeModels({api:{default:""},geom:{default:""},includes:{default:()=>[]},bbox:{},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(l,{emit:t}){const n=/{{\s*([^}]+?)\s*}}/g,a=l,o=t,{inputClass:r}=De(a.style),s=e.useModel(l,"modelValue"),i=e.computed({get:()=>s.value,set:S=>{s.value=S}}),c=e.ref(!1),d=e.ref([]),p=e.ref(!1),g=e.ref(null);e.watch(p,S=>{typeof document>"u"||(S?(g.value=document.body.style.overflow,document.body.style.overflow="hidden"):g.value!=null?(document.body.style.overflow=g.value,g.value=null):document.body.style.removeProperty("overflow"))}),e.onBeforeUnmount(()=>{typeof document>"u"||(g.value!=null?document.body.style.overflow=g.value:document.body.style.removeProperty("overflow"))});const E=e.computed(()=>a.placeholder??""),y=e.computed(()=>!!a.disabled),V=S=>{if(!S)return null;if(Array.isArray(S))return S;if(typeof S=="string"){const j=S.split(",").map(W=>W.trim()).filter(Boolean);return j.length!==4?null:j.map(Number)}return null},f=e.computed(()=>{const S=V(a.bbox);if(!S||S.length!==4)return null;const j=S.map(Number);return j.some(W=>Number.isNaN(W))?null:j}),h=e.computed(()=>{const S=f.value;if(!S)return"";const[j,W,K,T]=S;return`${j},${Math.max(W,T)},${K},${Math.min(W,T)}`});e.computed(()=>h.value?"1":"0");const x=e.inject("values");function k(){!y.value&&i.value.trim()&&w()}async function w(){const S=(i.value||"").trim();if(!S)return;let j=S;if(a.includes?.length&&x?.value){const K=a.includes.map(T=>x.value?.[T]).filter(Boolean);K.length&&(j=`${K.join(", ")}, ${S}`)}const W=$(j);if(W){c.value=!0;try{const T=await(await fetch(W)).json();d.value=Array.isArray(T)?T:[],p.value=!0}catch(K){console.error("Address search error:",K)}finally{c.value=!1}}}function b(){p.value=!p.value}function B(S){if(!S)return;p.value=!1;const j=parseFloat(S.lat),K={type:"Point",coordinates:[parseFloat(S.lon),j]};a.geom&&x?.value&&(x.value[a.geom]=K),o("update:geom",K)}function $(S){if(!a.api)return"";const j={value:encodeURIComponent(S),bbox:f.value?f.value.join(","):""};return a.api.replace(n,(W,K)=>j[K.trim()]??"")}return(S,j)=>(e.openBlock(),e.createElementBlock("div",pd,[e.createElementVNode("div",md,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":j[0]||(j[0]=W=>i.value=W),placeholder:E.value,disabled:y.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white border rounded-md placeholder:text-gray-400 focus:ring-2 focus:ring-blue-500",[e.unref(r),{"!border-red-600":a.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:e.withKeys(e.withModifiers(k,["prevent"]),["enter"])},null,42,fd),[[e.vModelText,i.value]]),d.value.length?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-blue-600",onClick:b,title:"Show search results"},j[2]||(j[2]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),e.createElementVNode("path",{d:"M12 16v-4"}),e.createElementVNode("path",{d:"M12 8h.01"})],-1)]))):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:w,class:"flex items-center justify-center px-2 py-2 border rounded-md bg-white hover:bg-gray-50 text-gray-600 hover:text-blue-600 disabled:opacity-50 h-[38px]",disabled:c.value||!i.value?.trim()},[c.value?(e.openBlock(),e.createElementBlock("svg",yd,j[4]||(j[4]=[e.createElementVNode("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),e.createElementVNode("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"},null,-1)]))):(e.openBlock(),e.createElementBlock("svg",gd,j[3]||(j[3]=[e.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),e.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"},null,-1)])))],8,hd),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[p.value?(e.openBlock(),e.createElementBlock("div",kd,[e.createElementVNode("div",bd,[e.createElementVNode("div",wd,[j[6]||(j[6]=e.createElementVNode("span",null,"Search results",-1)),e.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:j[1]||(j[1]=W=>p.value=!1),title:"Close"},j[5]||(j[5]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)]))]),e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(W,K)=>(e.openBlock(),e.createElementBlock("li",{key:K,onClick:T=>B(W),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},e.toDisplayString(W.display_name),9,xd))),128))]),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",_d," No results found "))])])):e.createCommentVNode("",!0)]))]))}}),qn=(l="")=>`${l}${Math.floor(Math.random()*1e4)}`,vd={class:"vs-datalist space-y-3"},Ed={class:"space-y-3"},Vd=["onClick","disabled"],Bd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},Cd=["disabled"],Sd=ae(e.defineComponent({__name:"vs-input-datalist",props:e.mergeModels({schema:{default:()=>[]},minItems:{default:0},maxItems:{default:void 0},addButtonText:{default:"Додати позицію"},emptyLabel:{default:"Немає рядків"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>Array.isArray(n.value)?n.value:[]),o=e.ref([]),r=e.computed(()=>t.schema?.map(f=>({...f,disabled:t.disabled||f.disabled}))??[]),s=e.computed(()=>r.value.map(f=>V(f))),i=e.computed(()=>t.disabled?!1:t.maxItems?a.value.length<t.maxItems:!0),c=e.computed(()=>t.disabled||a.value.length<=(t.minItems||0));e.watch(()=>a.value.length,()=>{d(),p()},{immediate:!0}),e.watch(()=>t.schema,p,{immediate:!0,deep:!0});function d(){const f=a.value.length;o.value.length<f?o.value=[...o.value,...Array.from({length:f-o.value.length},()=>qn())]:o.value.length>f&&o.value.splice(f)}function p(){if(!t.minItems||a.value.length>=t.minItems)return;const f=t.minItems-a.value.length,h=Array.from({length:f},g);n.value=[...a.value,...h]}function g(){const f={};return r.value.forEach(h=>{f[h.name]=h?.default??null}),f}function E(){i.value&&(n.value=[...a.value,g()],d())}function y(f){c.value||(n.value=a.value.filter((h,x)=>x!==f),d(),p())}function V(f){return{...f}}return(f,h)=>(e.openBlock(),e.createElementBlock("div",vd,[e.createElementVNode("div",Ed,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(x,k)=>(e.openBlock(),e.createElementBlock("div",{key:o.value[k],class:"flex items-center gap-3"},[e.createVNode(Je,{schema:s.value,layout:"inline",navigation:!1,values:a.value[k],"onUpdate:values":w=>a.value[k]=w,"form-id":o.value[k]},null,8,["schema","values","onUpdate:values","form-id"]),e.createElementVNode("button",{type:"button",class:"h-[38px] w-[38px] flex items-center justify-center text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",onClick:w=>y(k),disabled:c.value},[e.createVNode(ct,{class:"w-5 h-5"})],8,Vd)]))),128)),a.value.length===0?(e.openBlock(),e.createElementBlock("div",Bd,e.toDisplayString(t.emptyLabel),1)):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:E,disabled:!i.value},[e.createVNode(Ke,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,Cd)]))}}),[["__scopeId","data-v-8bcb5436"]]),Nd={};function $d(l,t){return e.openBlock(),e.createElementBlock("svg",e.mergeProps({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},l.$attrs),t[0]||(t[0]=[e.createElementVNode("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"},null,-1),e.createElementVNode("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"},null,-1)]),16)}const Md=ae(Nd,[["render",$d]]),Dd={class:"vs-dataform space-y-4"},Ad=["draggable","onDragstart","onDragover","onDragenter","onDrop"],Fd={class:"flex items-center gap-2"},Id=["onClick"],Ld={class:"text-sm font-medium text-gray-700"},Td={class:"flex items-center gap-2"},Od=["title","onClick","disabled"],zd=["title","onClick","disabled"],Rd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},jd=["disabled"],Pd=ae(e.defineComponent({__name:"vs-input-dataform",props:e.mergeModels({schema:{default:()=>[]},minGroups:{default:0},maxGroups:{default:void 0},addButtonText:{default:"Додати групу фільтрів"},groupLabel:{default:void 0},duplicateTitle:{default:"Дублювати групу"},removeTitle:{default:"Видалити групу"},emptyLabel:{},view:{default:"default"},collapsible:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref([]),o=e.ref([]),r=e.ref(0),s=e.ref(null),i=e.ref(null),c=e.ref(null),d=e.computed(()=>t.groupLabel??"Group"),p=e.computed(()=>t.emptyLabel??"Ще немає груп"),g=e.computed(()=>t.schema?.map(Y=>({...Y,disabled:t.disabled||Y.disabled}))??[]),E=e.computed(()=>g.value.map(Y=>W(Y))),y=e.computed(()=>t.view==="accordion"),V=e.computed(()=>!!(t.collapsible||y.value)),f=e.computed(()=>t.draggable!==!1),h=e.computed(()=>t.disabled?!1:t.maxGroups?n.value.length<t.maxGroups:!0),x=e.computed(()=>t.disabled||n.value.length<=(t.minGroups||0));e.watch(()=>n.value.length,()=>{k(),w(),b()},{immediate:!0}),e.watch(()=>t.schema,b,{immediate:!0,deep:!0}),e.watch(()=>t.view,()=>{w()},{immediate:!0});function k(){const Y=n.value.length;a.value.length<Y?a.value=[...a.value,...Array.from({length:Y-a.value.length},()=>qn())]:a.value.length>Y&&a.value.splice(Y)}function w(){const Y=n.value.length;y.value?Y===0?r.value=-1:r.value>=Y?r.value=Y-1:r.value<0&&(r.value=0):o.value.length<Y?o.value=[...o.value,...Array.from({length:Y-o.value.length},()=>!1)]:o.value.length>Y&&o.value.splice(Y)}function b(){if(!t.minGroups||n.value.length>=t.minGroups)return;const Y=t.minGroups-n.value.length,re=Array.from({length:Y},B);n.value=[...n.value,...re],w()}function B(){const Y={};return g.value.forEach(re=>{Y[re.name]=re?.default??null}),Y}function $(){h.value&&(n.value=[...n.value,B()],k(),w())}function S(Y){x.value||(n.value=n.value.filter((re,me)=>me!==Y),k(),y.value?r.value>=n.value.length&&(r.value=n.value.length-1):o.value.splice(Y,1),b())}function j(Y){if(t.disabled)return;const re=JSON.parse(JSON.stringify(n.value[Y]??{}));n.value=[...n.value.slice(0,Y+1),re,...n.value.slice(Y+1)],k(),y.value?r.value>Y&&(r.value+=1):o.value.splice(Y+1,0,o.value[Y]??!1)}function W(Y){return{...Y}}function K(Y){return y.value?r.value===-1&&Y===0?!1:r.value!==Y:!!o.value[Y]}function T(Y){if(V.value){if(y.value){r.value=Y;return}o.value[Y]=!o.value[Y]}}function z(Y,re){if(!f.value||t.disabled){re.preventDefault();return}s.value=Y,i.value=Y,c.value={groups:JSON.parse(JSON.stringify(n.value)),keys:[...a.value],states:[...o.value]},re.dataTransfer?.setData("text/plain",String(Y)),re.dataTransfer?.setDragImage?.(re.currentTarget,0,0)}function L(Y,re){!f.value||t.disabled||s.value!==null&&pe(Y,re)}function Z(Y,re){pe(Y,re)}function F(Y){!f.value||t.disabled||Ie()}function A(){c.value&&P(),s.value=null,i.value=null,c.value=null}function H(Y,re){const me=[...n.value],[fe]=me.splice(Y,1);me.splice(re,0,fe),n.value=me;const ge=[...a.value],[O]=ge.splice(Y,1);if(ge.splice(re,0,O),a.value=ge,y.value)r.value===Y&&(r.value=re);else{const ne=[...o.value],[Ee]=ne.splice(Y,1);ne.splice(re,0,Ee),o.value=ne}}function P(){c.value&&(n.value=c.value.groups,a.value=c.value.keys,o.value=c.value.states,c.value=null,i.value=null)}function pe(Y,re){if(s.value===null)return;const me=ke(Y,re);i.value=me,Te(me)}function ke(Y,re){if(!re?.currentTarget)return Y;const me=re.currentTarget.getBoundingClientRect(),ge=re.clientY-me.top>me.height/2?Y+1:Y;return Math.max(0,Math.min(ge,n.value.length))}function Te(Y){const re=s.value;if(re===null)return;let me=Y;if(me>n.value.length&&(me=n.value.length),me===re||me===re+1)return;const fe=me>re?me-1:me;H(re,fe),s.value=fe,i.value=me>re?fe+1:fe}function Ie(){c.value=null,s.value=null,i.value=null}return(Y,re)=>(e.openBlock(),e.createElementBlock("div",Dd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(me,fe)=>(e.openBlock(),e.createElementBlock("div",{key:a.value[fe],class:e.normalizeClass(["relative border border-gray-200 rounded-lg bg-white transition vs-dataform__group",[t.view==="accordion"?"overflow-hidden":K(fe)?"pt-6 px-6":"p-6"]]),draggable:f.value&&!t.disabled,onDragstart:ge=>z(fe,ge),onDragend:A,onDragover:e.withModifiers(ge=>L(fe,ge),["prevent"]),onDragenter:e.withModifiers(ge=>Z(fe,ge),["prevent"]),onDrop:e.withModifiers(ge=>F(),["prevent"])},[e.createElementVNode("div",{class:e.normalizeClass(["flex items-center justify-between gap-2 border-b border-gray-100 px-4 py-3",[t.view!=="accordion"?"-mx-6 -mt-6 px-6":"",t.view!=="accordion"&&!K(fe)?"rounded-t-lg":"rounded-lg"]])},[e.createElementVNode("div",Fd,[f.value?(e.openBlock(),e.createBlock($t,{key:0,class:"w-4 h-4 text-gray-400","aria-hidden":"true"})):e.createCommentVNode("",!0),V.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"rounded-full p-1 text-gray-500 transition hover:bg-gray-100",onClick:ge=>T(fe)},[e.createVNode(Zt,{class:e.normalizeClass(["h-4 w-4 transition",K(fe)?"-rotate-90":"rotate-0"])},null,8,["class"])],8,Id)):e.createCommentVNode("",!0),e.createElementVNode("div",Ld,e.toDisplayString(`${d.value} (${fe+1})`),1)]),e.createElementVNode("div",Td,[e.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:t.duplicateTitle,onClick:ge=>j(fe),disabled:t.disabled,draggable:"false"},[e.createVNode(Md,{class:"w-5 h-5"})],8,Od),e.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:t.removeTitle,onClick:ge=>S(fe),disabled:x.value,draggable:"false"},[e.createVNode(ct,{class:"w-5 h-5"})],8,zd)])],2),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(t.view==="accordion"?"p-6":"pt-6")},[e.createVNode(Je,{class:"vs-dataform__form",schema:E.value,layout:"inline",navigation:!1,values:n.value[fe],"onUpdate:values":ge=>n.value[fe]=ge,"form-id":a.value[fe],disabled:t.disabled},null,8,["schema","values","onUpdate:values","form-id","disabled"])],2),[[e.vShow,!K(fe)]])],42,Ad))),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("div",Rd,e.toDisplayString(p.value),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:$,disabled:!h.value},[e.createVNode(Ke,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,jd)]))}}),[["__scopeId","data-v-3b71fe50"]]),It="__vs_form_monaco_loader__",Kn=e.defineComponent({__name:"vs-input-monaco",props:e.mergeModels({syntax:{default:"xml"},theme:{default:"vs-light"},height:{default:280},minimap:{type:Boolean,default:!1},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref(null),o=e.computed(()=>typeof t.height=="number"?`${t.height}px`:t.height||"280px");let r=null,s=null,i=!1;const c=()=>{if(s)return Promise.resolve(s);if(typeof window>"u")return Promise.resolve(null);const p=window;if(p.monaco?.editor?.create)return s=p.monaco,Promise.resolve(s);if(p[It])return p[It];const E=(async()=>{const y=h=>{if(Array.from(document.styleSheets||[]).some(w=>w?.href?.includes(h)))return;const k=document.createElement("link");k.rel="stylesheet",k.href=h,document.head.appendChild(k)},V=h=>new Promise((x,k)=>{if(Array.from(document.scripts).some(B=>B.src===h))return x();const b=document.createElement("script");b.src=h,b.async=!0,b.onload=()=>x(),b.onerror=B=>k(B),document.body.appendChild(b)}),f="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.0/min/vs";return y(`${f}/editor/editor.main.min.css`),await V(`${f}/loader.min.js`),new Promise((h,x)=>{window.require.config({paths:{vs:f}}),window.require(["vs/editor/editor.main"],()=>{s=window.monaco,p.monaco=s,h(s)},k=>x(k))})})().catch(y=>{throw delete p[It],y});return p[It]=E,E},d=()=>{!a.value||!s||(r&&(r.dispose(),r=null),r=s.editor.create(a.value,{value:n.value||"",language:t.syntax,theme:t.theme,automaticLayout:!0,minimap:{enabled:!!t.minimap},readOnly:!!t.disabled}),r.onDidChangeModelContent(()=>{i||(n.value=r.getValue())}))};return e.watch(()=>n.value,p=>{if(!r)return;const g=r.getValue();p!==g&&(i=!0,r.setValue(p||""),i=!1)}),e.watch(()=>t.syntax,p=>{!r||!s||s.editor.setModelLanguage(r.getModel(),p||"xml")}),e.watch(()=>t.theme,p=>{s&&s.editor.setTheme(p||"vs-light")}),e.watch(()=>t.disabled,p=>{r&&r.updateOptions({readOnly:!!p})}),e.watch(()=>t.minimap,p=>{r&&r.updateOptions({minimap:{enabled:!!p}})}),e.onMounted(async()=>{try{const p=await c();if(!p||!p.editor)return;s=p,d()}catch(p){console.error("Failed to load Monaco editor",p)}}),e.onBeforeUnmount(()=>{r&&(r.dispose(),r=null)}),(p,g)=>(e.openBlock(),e.createElementBlock("div",{class:"w-full",style:e.normalizeStyle({height:o.value})},[e.createElementVNode("div",{ref_key:"editorContainer",ref:a,class:"w-full h-full overflow-hidden border border-[#CFD9E0] rounded"},null,512)],4))}}),Gn={VsInputText:it,VsInputRadio:nn,"vs-input-text":it,"vs-input-password":Pl,"vs-input-textarea":Dn,"vs-input-richtext":An,"vs-input-mask":Qt,"vs-input-number":_n,"vs-input-radio":nn,"vs-input-select":rn,"vs-input-switcher":Jt,"vs-input-static":Xt,"vs-input-container":Mn,"vs-input-date":La,"vs-input-checkbox":vn,"vs-input-file":Sn,"vs-input-file2":an,file2:an,File2:an,"vs-input-html":Xt,"vs-input-email":en,"vs-input-tel":tn,"vs-input-datatable":Fn,"vs-input-map":In,"vs-input-file-list":Nn,"vs-input-tags":Ln,"vs-input-slug":Tn,"vs-input-codegen":On,"vs-input-key-value":zn,"vs-input-text[]":Rn,"vs-input-range":Pn,"vs-input-color":jn,"vs-input-native-select":rn,VsInputArraySelect:Ft,"vs-input-array":Un,"vs-input-array-select":Ft,"array-select":Ft,"vs-input-address":Hn,"vs-input-datalist":Sd,"vs-input-dataform":Pd,"vs-input-monaco":Kn},Ud=e.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(l){const t=l,n=e.inject("values");async function a(){try{if(!t.api)return;const o=t.api.replace("{{value}}",t.value),r=await fetch(o);if(!r.ok){he.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const s=await r.json();if(!t.set||!n)return;for(const[i,c]of Object.entries(t.set))n.value[i]=s.result[c]}catch(o){console.error(t.error,o)}}return(o,r)=>(e.openBlock(),e.createElementBlock("button",{onClick:a,class:"vs-button relative inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-blue-500 hover:border-blue-500 hover:bg-blue-500 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 ml-0 md:ml-2 mt-2 md:mt-0 py-[8px] md:w-2/4 whitespace-nowrap w-full"},e.toDisplayString(o.button),1))}}),Hd={class:"flex flex-col gap-1 w-full"},qd=["innerHTML"],Yn=e.defineComponent({__name:"vs-compact-form-layout",props:e.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]},columns:{default:()=>({container:12,label:3})}},{modelValue:{default:null},modelModifiers:{}}),emits:e.mergeModels(["value-selected"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=e.useModel(l,"modelValue"),o=t,r=e.computed(()=>Rl[`${n.layout}`]),s=["label","placeholder","info","description","text","html"],i=e.ref(x()),c=e.computed(()=>V(n.item,i.value)),d=e.computed(()=>Gn?.[`vs-input-${n.item.type}`]),p=e.inject("field-props"),g=e.computed(()=>{const w=e.unref(d);if(!w)return new Set;const b=w.props??w.__vccOpts?.props;if(!b)return new Set;const B=Array.isArray(b)?b:Object.keys(b);return new Set(B)}),E=e.computed(()=>{const w={...c.value??{}},b=n.item?.name;b&&p?.value?.[b]&&Object.assign(w,p.value[b]);const B=g.value;return B.size?Object.fromEntries(Object.entries(w).filter(([$])=>B.has($))):{}}),y=w=>{const b=typeof w=="object"&&w!==null?w:{value:w};o("value-selected",{...b,name:b.name??n.item?.name})};e.onMounted(()=>{i.value=x(),window.addEventListener("storage",k)}),e.onUnmounted(()=>{window.removeEventListener("storage",k)});function V(w,b){if(!w)return{};const B={...w};return s.forEach($=>{const S=h(w,$,b);S!=null&&(B[$]=S)}),Array.isArray(w.options)&&(B.options=w.options.map($=>f($,b))),B}function f(w,b){if(!w)return w;const B={...w},$=h(w,"label",b),S=h(w,"text",b);return $!=null&&(B.label=$),S!=null?B.text=S:$!=null&&(B.text=$),B}function h(w,b,B){const $=`${b}:${B}`;if(w?.[$]!=null)return w[$];if(b==="label"&&w?.[B]!=null)return w[B];if(w?.[b]!=null)return w[b];if(b==="label"){if(w?.ua!=null)return w.ua;if(w?.en!=null)return w.en}if(b==="text"||b==="html"){if(w?.ua!=null)return w.ua;if(w?.en!=null)return w.en}return null}function x(){return typeof window>"u"?"uk":localStorage.getItem("locale")||"uk"}function k(){i.value=x()}return(w,b)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{ua:c.value.ua,error:n.error||"",item:c.value,columns:n.columns,label:c.value.label},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex w-full",`${n.item.type}-component`])},[e.createElementVNode("div",Hd,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value),e.mergeProps(E.value,{modelValue:a.value,"onUpdate:modelValue":b[0]||(b[0]=B=>a.value=B),onValueSelected:y}),null,16,["modelValue"])),c.value.description&&n.layout!=="settings"?(e.openBlock(),e.createElementBlock("p",{key:0,class:"text-sm text-gray-500",innerHTML:c.value.description},null,8,qd)):e.createCommentVNode("",!0)]),c.value.behavior?.api&&c.value.behavior?.button?(e.openBlock(),e.createBlock(Ud,e.mergeProps({key:0},c.value.behavior,{value:a.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),Kd={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},Gd={class:"vs-compact-form-navigation__rail mt-[6px]"},Yd=["onClick"],Wd=ae(e.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(l,{expose:t}){const n=l,a=e.ref([]),o=e.ref(""),r=e.ref(""),s=e.computed(()=>!!n.enabled),i=e.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),c=e.computed(()=>{const T=n.width;if(T==null)return{};const z=typeof T=="number"?`${T}px`:`${T}`;return{width:z,minWidth:z}});let d=null,p=0,g=0,E=null,y=null,V=null;const f=()=>W(),h=()=>k();e.watch(()=>n.target,async T=>{if($(),!T){E=null,a.value=[],o.value="";return}E=T,s.value&&(await e.nextTick(),B(T),k())},{immediate:!0}),e.watch(()=>n.scrollContainer,T=>{if(!s.value){y=T??null;return}x(T??null),e.nextTick(()=>k())},{immediate:!0}),e.onMounted(()=>{n.scrollContainer||x(null),k()}),e.onBeforeUnmount(()=>{$(),x(null,!0),E=null,typeof window<"u"&&(p&&window.cancelAnimationFrame(p),g&&window.cancelAnimationFrame(g))});function x(T,z=!1){if(V&&(V(),V=null),z){y=null;return}if(y=T??null,typeof window>"u")return;const L=T??window,Z=window;L.addEventListener("scroll",f,{passive:!0}),Z.addEventListener("resize",h),V=()=>{L.removeEventListener("scroll",f),Z.removeEventListener("resize",h)}}function k(){if(!s.value||!E)return;p&&typeof window<"u"&&window.cancelAnimationFrame(p);const T=()=>{w(),p=0};typeof window>"u"?T():p=window.requestAnimationFrame(T)}function w(){if(!s.value||!E)return;const T=Array.from(E.querySelectorAll("h1, h2")),z=new Set,L=[];T.forEach((Z,F)=>{const A=Z.textContent?.trim()??"";if(!A)return;let H=(Z.getAttribute("id")??"").trim();H||(H=b(A)||`heading-${F+1}`);let P=H,pe=1;for(;z.has(P);)P=`${H}-${pe+=1}`;Z.id!==P&&Object.assign(Z,{id:P}),z.add(P),L.push({id:P,text:A,level:Z.tagName.toLowerCase()==="h1"?1:2})}),a.value=L,L.length||(o.value=""),j()}function b(T){return T.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function B(T){!T||!s.value||typeof MutationObserver>"u"||($(),d=new MutationObserver(()=>k()),d.observe(T,{childList:!0,subtree:!0}))}function $(){d&&(d.disconnect(),d=null)}function S(T){const z=y;if(!z)return typeof window>"u"?T.offsetTop:T.getBoundingClientRect().top+window.scrollY;const L=T.getBoundingClientRect(),Z=z.getBoundingClientRect();return L.top-Z.top+z.scrollTop}function j(){if(!s.value||!a.value.length)return;const T=y,z=(T?T.scrollTop:null)||(typeof window<"u"?window.scrollY:0),L=(T?T.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),Z=z+L;let F=null;for(let H=0;H<a.value.length;H+=1){const P=a.value[H],pe=document.getElementById(P.id);if(pe){const ke=S(pe);ke+pe.offsetHeight>z&&ke<Z&&(F=P.id)}}!F&&r.value&&(F=r.value),F&&(r.value=F);const A=T?T.scrollHeight-T.clientHeight:document.documentElement.scrollHeight-window.innerHeight;z+5>=A&&(F=a.value[a.value.length-1].id),F&&(o.value=F)}function W(){s.value&&(g&&window.cancelAnimationFrame(g),g=window.requestAnimationFrame(()=>{j(),g=0}))}function K(T){if(!s.value)return;const z=document.getElementById(T);if(!z)return;const L=y,Z=Math.max(0,S(z));L?L.scrollTo({top:Z,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:Z,behavior:"smooth"})}return t({refresh:k}),(T,z)=>s.value&&a.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(i.value),style:e.normalizeStyle(c.value)},[e.createElementVNode("h2",Kd,e.toDisplayString(T.title),1),e.createElementVNode("div",Gd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,L=>(e.openBlock(),e.createElementBlock("div",{key:L.id,class:e.normalizeClass(["vs-compact-form-navigation__item relative",L.level===2?"vs-compact-form-navigation__item--nested":"",L.id===o.value?"vs-compact-form-navigation__item--active":""])},[e.createElementVNode("button",{type:"button",onClick:Z=>K(L.id),class:e.normalizeClass(["vs-compact-form-navigation__button flex gap-x-3 py-[6px] pr-3 text-sm duration-200 hover:text-gray-800",L.level===2?"pl-[15px]":"pl-[18px]",L.id===o.value?"text-gray-800":"text-gray-500"])},[e.createElementVNode("span",null,e.toDisplayString(L.text),1)],10,Yd)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-1584a562"]]),at={required:"Це поле є обов’язковим",email:"Неправильний email",tel:"Неправильний телефон",minlength:l=>`Мінімальна довжина — ${l} символів`,maxlength:l=>`Максимальна довжина — ${l} символів`},Zd=l=>typeof l=="string"?l.trim()?!1:at.required:Array.isArray(l)?l.map(n=>typeof n=="string"?n.trim():n).filter(n=>n!=null&&n!=="").length?!1:at.required:l?!1:at.required,Jd=l=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return l?t.test(l)?!1:at.email:!1},Xd=l=>{const t=/^\+[1-9]\d{1,14}$/;return l?t.test(l)?!1:at.tel:!1},Wn=l=>l==null?0:typeof l=="string"?l.trim().length:Array.isArray(l)?l.length:typeof l=="number"?l.toString().length:String(l).length,Qd=(l,t)=>{if(l==null)return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&Wn(l)<n?t?.message||at.minlength(n):!1},eu=(l,t)=>{if(l==null||l==="")return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&Wn(l)>n?t?.message||at.maxlength(n):!1},tu=(l,t)=>{const n=t.pattern??t.regexp,a=typeof n=="string"?new RegExp(n):n;if(Array.isArray(l)){const o=l.filter(Boolean);return o.length===0||o.every(r=>a.test(r))?!1:t.message}return!a.test(l)&&l?t.message:!1},nu=(l,t)=>!1,lu=(l,t)=>{switch(typeof t=="string"?t:t.type){case"required":return Zd(l);case"email":return Jd(l);case"tel":return Xd(l);case"regexp":return tu(l,t);case"minlength":return Qd(l,t);case"maxlength":return eu(l,t);case"custom":return nu();default:return!1}},au={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",file:"file",dropzone:"file"};function Zn(l){const t=l?.toLowerCase();return au[t]||t}function cn(l,t=!1){if(Array.isArray(l)){const a=[];return l.forEach(o=>{const r={...o};r.name=(o.name||o.id||o.key||"").toString(),r.type=Zn(o.type),r.label=o.label||o.ua,r.rules=o.rules||o.validators,r.type==="email"&&!r.rules&&(r.rules=["email"]),o.data&&(r.api=`/api/suggest/${o.data}`),r.disabled=r.disabled??t,Array.isArray(r.schema)&&(r.schema=cn(r.schema,r.disabled)),a.push(r)}),a}const n=[];return Object.entries(l).forEach(a=>{const o={name:a[0],...a[1],type:Zn(a[1].type),label:a[1].label||a[1].ua,rules:a[1].rules||a[1].validators,disabled:a[1].disabled??t};o.type==="email"&&!o.rules&&(o.rules=["email"]),a[1].type?.includes("list")&&(o.multiple=!0),!o.api&&a[1].data&&(o.api=`/api/suggest/${a[1].data}`),Array.isArray(o.schema)&&(o.schema=cn(o.schema,o.disabled)),n.push(o)}),n}function ou(l,t,n=!1){const a=e.computed(()=>cn((Array.isArray(t),t),typeof n=="boolean"?n:n.value)),o=e.ref({});function r(d){const p=d?.conditions;if(!p)return!0;const g=Array.isArray(p)?p[0]:p,E=l?.value?.[g];return $n(E,p)}const s=(d=a.value,p=!0)=>(d.forEach(g=>{const E=[],y=Number(g?.minlength),V=Number(g?.maxlength);!Number.isNaN(y)&&Number.isFinite(y)&&E.push({type:"minlength",value:y}),!Number.isNaN(V)&&Number.isFinite(V)&&E.push({type:"maxlength",value:V});const f=[...E,...g.rules||[]];if(f.length){if(!r(g)){delete o.value[g.name];return}let h=!1,x=null;f.forEach(k=>{const w=lu(l.value[g.name],k);w&&(h=!0,!x&&typeof w=="string"&&(x=w))}),h&&x?o.value[g.name]=x:delete o.value[g.name]}g.schema&&s(g.schema,!1)}),p&&Object.values(o.value).some(Boolean)?o.value:null),i=e.computed(()=>a.value?.filter(d=>d.hidden!==!0&&r(d)));return{errors:o,validate:s,reset:()=>{l.value={},o.value={}},visibleSchema:i}}const ru={class:"flex w-full h-full min-h-0 gap-6"},su={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},Je=e.defineComponent({__name:"vs-compact-form",props:e.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1},navigation:{type:Boolean,default:!1},navWidth:{default:400},columns:{}},{form:{default:()=>({})},formModifiers:{},modelValue:{default:()=>({})},modelModifiers:{},values:{default:void 0},valuesModifiers:{}}),emits:e.mergeModels(["handle-submit","update:modelValue","value-selected"],["update:form","update:modelValue","update:values"]),setup(l,{expose:t,emit:n}){const a=n,o=l,r=e.useModel(l,"form"),s=e.useModel(l,"modelValue"),i=e.useModel(l,"values"),c=e.computed({get:()=>i.value??s.value,set:L=>{s.value=L,i.value=L}}),{errors:d,validate:p,reset:g,visibleSchema:E}=ou(c,o.schema,e.toRef(o,"disabled")),y=e.ref(null),V=e.ref(null),f=e.ref({}),h=e.computed(()=>o.navigation),x=e.computed(()=>o.navWidth),k=e.computed(()=>o.style?.columns),w=Object.freeze({container:12,label:3}),b=e.computed(()=>o.columns??k.value??w),B=e.computed(()=>o.columns!=null||k.value!=null),$=e.computed(()=>B.value?"horizontal":o.layout),S=L=>L?.columns?"horizontal":$.value,j=L=>L?.columns??b.value,W=()=>{a("update:modelValue",c.value),p(),a("handle-submit",c.value)},K=L=>{a("value-selected",L)},T=()=>{o.formId&&(c.value?.id!==void 0&&c.value?.id!==null&&c.value?.id!==""||(c.value={...c.value??{},id:o.formId}))};t({validate:p,reset:g,errors:d}),e.onMounted(()=>{T(),r.value={value:c.value,errors:d.value,reset:g,validate:p,formId:o.formId}}),e.watch(()=>o.formId,()=>{T()},{immediate:!0});function z(L,Z){if(L===Z)return!0;if(typeof L!="object"||typeof Z!="object"||!L||!Z)return!1;const F=Object.keys(L),A=Object.keys(Z);return F.length!==A.length?!1:F.every(H=>L[H]===Z[H])}return e.provide("form",r),e.provide("values",c),e.provide("field-props",f),(L,Z)=>(e.openBlock(),e.createElementBlock("div",ru,[e.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:V},[e.createElementVNode("form",{ref_key:"formRef",ref:y,onSubmit:e.withModifiers(W,["prevent"]),class:e.normalizeClass(["grid grid-cols-12 p-1",$.value==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E),(F,A)=>(e.openBlock(),e.createElementBlock("div",{key:F.name,class:e.normalizeClass(S(F)==="horizontal"?"col-span-12":`col-span-${F.col||12}`)},[e.createVNode(Yn,{style:e.normalizeStyle(L.style),item:F,layout:S(F),columns:j(F),"model-value":c.value[F.name],"onUpdate:modelValue":H=>{const P=c.value[F.name];z(P,H)||(c.value[F.name]=H)},error:e.unref(d)[F.name],onValueSelected:K},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),S(F)==="settings"&&A+1!==e.unref(E).length?(e.openBlock(),e.createElementBlock("div",su)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(Wd,{target:y.value,"scroll-container":V.value,enabled:h.value,width:x.value},null,8,["target","scroll-container","enabled","width"])]))}}),iu={class:"relative"},cu={class:"w-full h-full fixed top-0 start-0 bg-black bg-opacity-50"},du={class:"m-[10px] fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 min-h-0 h-fit max-h-[80vh] overflow-hidden opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl lg:w-7/12 w-11/12"},uu={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},pu={class:"font-medium text-gray-800 dark:text-[#ffffff]"},mu={class:"p-4 mim-h-0 h-full overflow-auto"},Jn=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{},api:{},method:{}},emits:["close","save","edit"],setup(l,{emit:t}){const n=l,a=t,o=e.ref(n.schema),r=e.ref(n.defaultValue?JSON.parse(JSON.stringify(n.defaultValue)):{}),s=e.ref({}),i=e.ref(n.token||""),c=e.ref(n.mode),d=()=>{const V=n.method?.trim().toUpperCase();return V==="GET"||V==="POST"||V==="PUT"?V:c.value==="add"?"POST":"PUT"},p=()=>{he.notify({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`})},g=async V=>{if(console.log(V),V.ok){await V.json().catch(()=>({})),p(),a("save",r.value);return}if(V.status===400){const f=await V.json().catch(()=>({}));he.notify({type:"warning",title:"Помилка валідації",message:f.message||"Некоректні дані (400)"});return}if(V.status===500){he.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"});return}he.notify({type:"error",title:"Помилка",message:`Статус: ${V.status}`})};async function E(){const V=s.value.validate();if(V){he.notify({type:"warning",title:"Помилка валідації",message:Object.entries(V).map(([h,x])=>`${h}: ${x}`).join(`
|
|
3
|
-
`)});return}const f=n.api?.trim();if(f){const h=d();try{const x=await fetch(f,{method:h,headers:h==="GET"?void 0:{"Content-Type":"application/json"},body:h==="GET"?void 0:JSON.stringify(r.value)});await g(x)}catch(x){he.notify({type:"error",title:"Помилка з’єднання",message:x.message||"Не вдалося виконати запит"})}return}if(i.value)try{const h=await fetch(`/api/table/${i.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r.value)});await g(h)}catch(h){he.notify({type:"error",title:"Помилка з’єднання",message:h.message||"Не вдалося виконати запит"})}else a("edit",r.value),y()}function y(){a("close")}return e.onMounted(async()=>{try{if(n.form&&!n.schema){const V=await fetch(`/api/template/form/${n.form}`);if(!V.ok){he.notify({type:V.status>=400&&V.status<500?"warning":"error",title:"Error",message:`Error code: ${V.status}`});return}const f=await V.json();o.value=f.schema,f.token&&(i.value=f.token)}else if(n.token&&!n.defaultValue){i.value=n.token;const V=await fetch(`/api/form/${i.value}`);if(!V.ok){he.notify({type:V.status>=400&&V.status<500?"warning":"error",title:"Error",message:`Error code: ${V.status}`});return}const f=await V.json();o.value=f.schema,f.data?r.value=f.data:c.value="add",f.obj&&(r.value={...r.value,...f.obj})}}catch(V){he.notify({type:"error",title:"Error",message:V.message||"Unexpected error"}),console.error(V)}}),(V,f)=>(e.openBlock(),e.createElementBlock("div",iu,[e.createElementVNode("div",cu,[e.createElementVNode("div",du,[e.createElementVNode("div",uu,[e.createElementVNode("h3",pu,e.toDisplayString(c.value==="add"?"Додати":"Змінити"),1),e.createElementVNode("button",{onClick:y,type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"},f[2]||(f[2]=[e.createElementVNode("span",{class:"sr-only"},"Close",-1),e.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("path",{d:"M18 6 6 18"}),e.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),e.createElementVNode("div",mu,[o.value?(e.openBlock(),e.createBlock(Je,{key:0,schema:o.value,values:r.value,"onUpdate:values":f[0]||(f[0]=h=>r.value=h),form:s.value,"onUpdate:form":f[1]||(f[1]=h=>s.value=h),formId:i.value},null,8,["schema","values","form","formId"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"vs-form__head mr-5 mb-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},[e.createElementVNode("button",{type:"button",onClick:y,class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:E,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])])])]))}}),fu=1440*60*1e3,hu=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],gu=["січ","лют","бер","квіт","трав","черв","лип","серп","вер","жовт","лист","груд"],yu=["нд","пн","вт","ср","чт","пт","сб"];function Se(l){return l instanceof Date&&!Number.isNaN(l.getTime())}const dt=l=>new Date(l.getTime());function ot(l){const t=dt(l);return t.setHours(0,0,0,0),t}function ht(l){const t=dt(l);return t.setHours(23,59,59,999),t}function dn(l){return ot(new Date(l.getFullYear(),l.getMonth(),1))}function un(l){return ht(new Date(l.getFullYear(),l.getMonth()+1,0))}function pn(l,t){const n=new Date(l),a=n.getDate();n.setDate(1),n.setMonth(n.getMonth()+t);const o=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();return n.setDate(Math.min(a,o)),n}function ku(l,t){return pn(l,-1)}function Lt(l,t){const n=new Date(l);return n.setFullYear(n.getFullYear()+t),n}function Xn(l,t){return Lt(l,-t)}function Qn(l){return ot(new Date(l.getFullYear(),0,1))}function el(l){return ht(new Date(l.getFullYear(),11,31))}function bu(l){const t=Math.floor(l.getFullYear()/10)*10;return ot(new Date(t,0,1))}function wu(l){const t=Math.floor(l.getFullYear()/10)*10+9;return ht(new Date(t,11,31))}const Pe=l=>l.getFullYear(),Tt=l=>Math.floor(l.getFullYear()/10)*10;function xu(l){const t=[];let n=ot(l.start);const a=ot(l.end);for(;n<=a;)t.push(dt(n)),n=new Date(n.getTime()+fu);return t}function _u(l){const t=[];let n=dn(l.start);const a=un(l.end);for(;n<=a;)t.push(dt(n)),n=pn(n,1);return t}function vu(l){const t=[];let n=Qn(l.start);const a=el(l.end);for(;n<=a;)t.push(dt(n)),n=Lt(n,1);return t}function mn(l,t=1){const n=ot(l),a=(n.getDay()-t+7)%7;return n.setDate(n.getDate()-a),n}function Eu(l,t=1){const n=mn(l,t);return n.setDate(n.getDate()+6),ht(n)}function Vu(l,t,n=0){const a=mn(l,n),o=(t-n+7)%7;return a.setDate(a.getDate()+o),a}const Ot=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth()&&l.getDate()===t.getDate(),fn=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth(),tl=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear(),nl=(l,t)=>!!l&&!!t&&Ot(l,t)&&l.getHours()===t.getHours(),Bu=(l,t)=>!!l&&!!t&&nl(l,t)&&l.getMinutes()===t.getMinutes();function Cu(l,t){const n=l.getTime();return n>=t.start.getTime()&&n<=t.end.getTime()}const gt=(l,t)=>!!l&&!!t&&l.getTime()<t.getTime(),yt=(l,t)=>!!l&&!!t&&l.getTime()>t.getTime();function Su(l){const t=l.filter(n=>Se(n));if(t.length)return t.reduce((n,a)=>n.getTime()>=a.getTime()?n:a)}function Nu(l){const t=l.filter(n=>Se(n));if(t.length)return t.reduce((n,a)=>n.getTime()<=a.getTime()?n:a)}function ll(l,t){const n=dt(l);return typeof t.year=="number"&&n.setFullYear(t.year),typeof t.month=="number"&&n.setMonth(t.month),typeof t.date=="number"&&n.setDate(t.date),typeof t.hours=="number"&&n.setHours(t.hours),typeof t.minutes=="number"&&n.setMinutes(t.minutes),typeof t.seconds=="number"&&n.setSeconds(t.seconds),typeof t.milliseconds=="number"&&n.setMilliseconds(t.milliseconds),n}const zt=(l,t=2)=>String(l).padStart(t,"0");function al(l,t){return t==="wide"?hu[l]:gu[l]}function $u(l){return yu[l]}const Mu=[{token:"LLLL",format:l=>al(l.getMonth(),"wide")},{token:"LLL",format:l=>al(l.getMonth(),"abbreviated")},{token:"EE",format:l=>$u(l.getDay())},{token:"yyyy",format:l=>String(l.getFullYear())},{token:"MM",format:l=>zt(l.getMonth()+1)},{token:"dd",format:l=>zt(l.getDate())},{token:"HH",format:l=>zt(l.getHours())},{token:"mm",format:l=>zt(l.getMinutes())}];function Rt(l,t){if(!Se(l))return"";let n="",a=0;for(;a<t.length;){const o=Mu.find(r=>t.startsWith(r.token,a));o?(n+=o.format(l),a+=o.token.length):(n+=t[a],a+=1)}return n}const Du={"yyyy-MM-dd":/^(\d{4})-(\d{2})-(\d{2})$/,"dd.MM.yyyy":/^(\d{2})\.(\d{2})\.(\d{4})$/,"dd.MM.yyyy HH:mm":/^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2})$/,"HH:mm":/^(\d{2}):(\d{2})$/,"MM.yyyy":/^(\d{2})\.(\d{4})$/,yyyy:/^(\d{4})$/};function ol(l,t){const n=Du[t];if(!n){const o=new Date(l);return Se(o)?o:null}const a=l.match(n);if(!a)return null;switch(t){case"yyyy-MM-dd":{const[,o,r,s]=a,i=new Date(Number(o),Number(r)-1,Number(s));return Se(i)?i:null}case"dd.MM.yyyy":{const[,o,r,s]=a,i=new Date(Number(s),Number(r)-1,Number(o));return Se(i)?i:null}case"dd.MM.yyyy HH:mm":{const[,o,r,s,i,c]=a,d=new Date(Number(s),Number(r)-1,Number(o),Number(i),Number(c));return Se(d)?d:null}case"HH:mm":{const[,o,r]=a,s=new Date;return s.setHours(Number(o),Number(r),0,0),s}case"MM.yyyy":{const[,o,r]=a;return new Date(Number(r),Number(o)-1,1)}case"yyyy":{const[,o]=a;return new Date(Number(o),0,1)}default:return null}}const Au=["year","month","day","time","custom"],Fu=e.defineComponent({emits:{elementClick:l=>Se(l),left:()=>!0,right:()=>!0,heading:()=>!0},props:{headingClickable:{type:Boolean,default:!1},leftDisabled:{type:Boolean,default:!1},rightDisabled:{type:Boolean,default:!1},columnCount:{type:Number,default:7},items:{type:Array,default:()=>[]},viewMode:{type:String,required:!0,validate:l=>typeof l=="string"&&Au.includes(l)}}}),Iu={class:"v3dp__heading"},Lu=["disabled"],Tu=["disabled"],Ou={class:"v3dp__body"},zu={class:"v3dp__subheading"},Ru={class:"v3dp__elements"},ju=["disabled","onClick"];function Pu(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["v3dp__popout",`v3dp__popout-${l.viewMode}`]),style:e.normalizeStyle({"--popout-column-definition":`repeat(${l.columnCount}, 1fr)`}),onMousedown:t[3]||(t[3]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Iu,[e.createElementVNode("button",{class:"v3dp__heading__button v3dp__heading__button__left",disabled:l.leftDisabled,onClick:t[0]||(t[0]=e.withModifiers(s=>l.$emit("left"),["stop","prevent"]))},[e.renderSlot(l.$slots,"arrow-left",{},()=>[t[4]||(t[4]=e.createElementVNode("svg",{class:"v3dp__heading__icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 6 8"},[e.createElementVNode("g",{fill:"none","fill-rule":"evenodd"},[e.createElementVNode("path",{stroke:"none",d:"M-9 16V-8h24v24z"}),e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 0L1 4l4 4"})])],-1))],!0)],8,Lu),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.headingClickable?"button":"span"),{class:"v3dp__heading__center",onClick:t[1]||(t[1]=e.withModifiers(s=>l.$emit("heading"),["stop","prevent"]))},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"heading",{},void 0,!0)]),_:3})),e.createElementVNode("button",{class:"v3dp__heading__button v3dp__heading__button__right",disabled:l.rightDisabled,onClick:t[2]||(t[2]=e.withModifiers(s=>l.$emit("right"),["stop","prevent"]))},[e.renderSlot(l.$slots,"arrow-right",{},()=>[t[5]||(t[5]=e.createElementVNode("svg",{class:"v3dp__heading__icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 6 8"},[e.createElementVNode("g",{fill:"none","fill-rule":"evenodd"},[e.createElementVNode("path",{stroke:"none",d:"M15-8v24H-9V-8z"}),e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M1 8l4-4-4-4"})])],-1))],!0)],8,Tu)]),e.createElementVNode("div",Ou,["subheading"in l.$slots?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",zu,[e.renderSlot(l.$slots,"subheading",{},void 0,!0)]),t[6]||(t[6]=e.createElementVNode("hr",{class:"v3dp__divider"},null,-1))],64)):e.createCommentVNode("",!0),e.createElementVNode("div",Ru,[e.renderSlot(l.$slots,"body",{},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.items,s=>(e.openBlock(),e.createElementBlock("button",{key:s.key,disabled:s.disabled,class:e.normalizeClass([{selected:s.selected,current:s.current},`v3dp__element__button__${l.viewMode}`]),onClick:e.withModifiers(i=>l.$emit("elementClick",s.value),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(s.display),1)],10,ju))),128))],!0)])])],38)}const jt=ae(Fu,[["render",Pu],["__scopeId","data-v-bc92af04"]]),Uu=e.defineComponent({components:{PickerPopup:jt},emits:{"update:pageDate":l=>Se(l),select:l=>Se(l)},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1}},setup(l,{emit:t}){const n=e.computed(()=>bu(l.pageDate)),a=e.computed(()=>wu(l.pageDate)),o=(g,E,y)=>!E&&!y?!0:!(E&&Pe(g)<Pe(E)||y&&Pe(g)>Pe(y)),r=e.computed(()=>vu({start:n.value,end:a.value}).map(g=>({value:g,key:String(Pe(g)),display:Pe(g),selected:!!l.selected&&Pe(g)===Pe(l.selected),disabled:!o(g,l.lowerLimit,l.upperLimit)}))),s=e.computed(()=>{const g=Pe(n.value),E=Pe(a.value);return`${g} - ${E}`}),i=e.computed(()=>l.lowerLimit&&(Tt(l.lowerLimit)===Tt(l.pageDate)||gt(l.pageDate,l.lowerLimit))),c=e.computed(()=>l.upperLimit&&(Tt(l.upperLimit)===Tt(l.pageDate)||yt(l.pageDate,l.upperLimit)));return{years:r,heading:s,leftDisabled:i,rightDisabled:c,previousPage:()=>t("update:pageDate",Xn(l.pageDate,10)),nextPage:()=>t("update:pageDate",Lt(l.pageDate,10))}}});function Hu(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{columnCount:3,leftDisabled:l.leftDisabled,rightDisabled:l.rightDisabled,items:l.years,viewMode:"year",onLeft:l.previousPage,onRight:l.nextPage,onElementClick:t[0]||(t[0]=i=>l.$emit("select",i))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.heading),1)]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const qu=ae(Uu,[["render",Hu]]),Ku=e.defineComponent({components:{PickerPopup:jt},emits:{"update:pageDate":l=>Se(l),select:l=>Se(l),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},format:{type:String,required:!1,default:"LLL"},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1}},setup(l,{emit:t}){const n=e.computed(()=>Qn(l.pageDate)),a=e.computed(()=>el(l.pageDate)),o=e.computed(()=>E=>Rt(E,l.format)),r=(E,y,V)=>!y&&!V?!0:!(y&>(E,dn(y))||V&&yt(E,un(V))),s=e.computed(()=>_u({start:n.value,end:a.value}).map(E=>({value:E,display:o.value(E),key:o.value(E),selected:!!l.selected&&fn(l.selected,E),disabled:!r(E,l.lowerLimit,l.upperLimit)}))),i=e.computed(()=>Pe(n.value)),c=e.computed(()=>l.lowerLimit&&(tl(l.lowerLimit,l.pageDate)||gt(l.pageDate,l.lowerLimit))),d=e.computed(()=>l.upperLimit&&(tl(l.upperLimit,l.pageDate)||yt(l.pageDate,l.upperLimit)));return{months:s,heading:i,leftDisabled:c,rightDisabled:d,previousPage:()=>t("update:pageDate",Xn(l.pageDate,1)),nextPage:()=>t("update:pageDate",Lt(l.pageDate,1))}}});function Gu(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",columnCount:3,items:l.months,leftDisabled:l.leftDisabled,rightDisabled:l.rightDisabled,viewMode:"month",onLeft:l.previousPage,onRight:l.nextPage,onHeading:t[0]||(t[0]=i=>l.$emit("back")),onElementClick:t[1]||(t[1]=i=>l.$emit("select",i))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.heading),1)]),_:1},8,["items","leftDisabled","rightDisabled","onLeft","onRight"])}const Yu=ae(Ku,[["render",Gu]]),Wu=e.defineComponent({components:{PickerPopup:jt},emits:{"update:pageDate":l=>Se(l),select:l=>Se(l),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},format:{type:String,required:!1,default:"dd"},headingFormat:{type:String,required:!1,default:"LLLL yyyy"},weekdayFormat:{type:String,required:!1,default:"EE"},weekStartsOn:{type:Number,required:!1,default:1,validator:l=>typeof l=="number"&&Number.isInteger(l)&&l>=0&&l<=6},customWeekdays:{type:Array,required:!1},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1}},setup(l,{emit:t}){const n=e.computed(()=>h=>x=>Rt(x,h)),a=e.computed(()=>dn(l.pageDate)),o=e.computed(()=>un(l.pageDate)),r=e.computed(()=>({start:a.value,end:o.value})),s=e.computed(()=>({start:mn(a.value,l.weekStartsOn),end:Eu(o.value,l.weekStartsOn)})),i=e.computed(()=>l.customWeekdays?.length===7?l.customWeekdays:null),c=e.computed(()=>{const h=l.weekStartsOn,x=i.value;if(x)return Array.from({length:7}).map((w,b)=>x[(h+b)%7]);const k=n.value(l.weekdayFormat);return Array.from(Array(7)).map((w,b)=>(h+b)%7).map(w=>Vu(new Date,w,l.weekStartsOn)).map(k)}),d=(h,x,k,w)=>w?.dates?.some(b=>Ot(h,b))||w?.predicate?.(h)?!1:!x&&!k?!0:!(x&>(h,ot(x))||k&&yt(h,ht(k))),p=e.computed(()=>{const h=new Date,x=n.value(l.format);return xu(s.value).map(k=>({value:k,display:x(k),selected:!!l.selected&&Ot(l.selected,k),current:Ot(h,k),disabled:!l.allowOutsideInterval&&!Cu(k,r.value)||!d(k,l.lowerLimit,l.upperLimit,l.disabledDates),key:n.value("yyyy-MM-dd")(k)}))}),g=e.computed(()=>n.value(l.headingFormat)(l.pageDate)),E=e.computed(()=>l.lowerLimit&&(fn(l.lowerLimit,l.pageDate)||gt(l.pageDate,l.lowerLimit))),y=e.computed(()=>l.upperLimit&&(fn(l.upperLimit,l.pageDate)||yt(l.pageDate,l.upperLimit)));return{weekDays:c,days:p,heading:g,leftDisabled:E,rightDisabled:y,previousPage:()=>t("update:pageDate",ku(l.pageDate)),nextPage:()=>t("update:pageDate",pn(l.pageDate,1))}}});function Zu(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",leftDisabled:l.leftDisabled,rightDisabled:l.rightDisabled,items:l.days,viewMode:"day",onLeft:l.previousPage,onRight:l.nextPage,onHeading:t[0]||(t[0]=i=>l.$emit("back")),onElementClick:t[1]||(t[1]=i=>l.$emit("select",i))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.heading),1)]),subheading:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.weekDays,(i,c)=>(e.openBlock(),e.createElementBlock("span",{key:i,class:e.normalizeClass(`v3dp__subheading__weekday__${c}`)},e.toDisplayString(i),3))),128))]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const Ju=ae(Wu,[["render",Zu]]);function rl(l,t){const n=l.getBoundingClientRect(),a={height:l.clientHeight,width:l.clientWidth},o=t.getBoundingClientRect();if(!(o.top>=n.top&&o.bottom<=n.top+a.height)){const s=o.top-n.top,i=o.bottom-n.bottom;Math.abs(s)<Math.abs(i)?l.scrollTop+=s:l.scrollTop+=i}}const Xu=e.defineComponent({components:{PickerPopup:jt},emits:{select:l=>Se(l),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},visible:{type:Boolean,required:!0},disabledTime:{type:Object,required:!1}},setup(l,{emit:t}){const n=e.ref(null),a=e.ref(null),o=e.computed(()=>l.pageDate??l.selected),r=e.ref(o.value.getHours()),s=e.ref(o.value.getMinutes());e.watch(()=>l.selected,y=>{let V=0,f=0;y&&(V=y.getHours(),f=y.getMinutes()),r.value=V,s.value=f});const i=e.computed(()=>[...Array(24).keys()].map(y=>({value:y,date:ll(new Date(o.value.getTime()),{hours:y,minutes:s.value,seconds:0}),selected:r.value===y,ref:e.ref(null)}))),c=e.computed(()=>[...Array(60).keys()].map(y=>({value:y,date:ll(new Date(o.value.getTime()),{hours:r.value,minutes:y,seconds:0}),selected:s.value===y,ref:e.ref(null)}))),d=y=>{s.value=y.value,t("select",y.date)},p=()=>{const y=i.value.find(f=>f.ref.value?.classList?.contains("selected")??!1),V=c.value.find(f=>f.ref.value?.classList?.contains("selected")??!1);y&&V&&(rl(n.value,y.ref.value),rl(a.value,V.ref.value))};return e.watch(()=>l.visible,y=>{y&&e.nextTick(p)}),{hoursListRef:n,minutesListRef:a,hours:r,minutes:s,hoursList:i,minutesList:c,padStartZero:y=>`0${y}`.substr(-2),selectMinutes:d,isEnabled:y=>!(l.disabledTime?.dates?.some(V=>nl(y,V)&&Bu(y,V))||l.disabledTime?.predicate?.(y)),scroll:p}}}),Qu={ref:"hoursListRef",class:"v3dp__column"},ep=["disabled","onClick"],tp={ref:"minutesListRef",class:"v3dp__column"},np=["disabled","onClick"];function lp(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",columnCount:2,leftDisabled:!0,rightDisabled:!0,viewMode:"time",onHeading:t[0]||(t[0]=i=>l.$emit("back"))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.padStartZero(l.hours))+":"+e.toDisplayString(l.padStartZero(l.minutes)),1)]),body:e.withCtx(()=>[e.createElementVNode("div",Qu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.hoursList,i=>(e.openBlock(),e.createElementBlock("button",{key:i.value,ref_for:!0,ref:i.ref,class:e.normalizeClass([{selected:i.selected},"v3dp__element_button__hour"]),disabled:!l.isEnabled(i.date),onClick:e.withModifiers(c=>l.hours=i.value,["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(l.padStartZero(i.value)),1)],10,ep))),128))],512),e.createElementVNode("div",tp,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.minutesList,i=>(e.openBlock(),e.createElementBlock("button",{key:i.value,ref_for:!0,ref:i.ref,class:e.normalizeClass([{selected:i.selected},"v3dp__element_button__minute"]),disabled:!l.isEnabled(i.date),onClick:e.withModifiers(c=>l.selectMinutes(i),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(l.padStartZero(i.value)),1)],10,np))),128))],512)]),_:1})}const ap=ae(Xu,[["render",lp],["__scopeId","data-v-610b89e1"]]),Pt=["time","day","month","year"],op=(l,t,n=void 0)=>{let a=n||new Date;const o=Su([l,a]);o&&(a=o);const r=Nu([t,a]);return r&&(a=r),a},rp=e.defineComponent({components:{YearPicker:qu,MonthPicker:Yu,DayPicker:Ju,TimePicker:ap},inheritAttrs:!1,props:{placeholder:{type:String,default:""},modelValue:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1},disabledTime:{type:Object,required:!1},upperLimit:{type:Date,required:!1},lowerLimit:{type:Date,required:!1},startingView:{type:String,required:!1,default:"day",validate:l=>typeof l=="string"&&Pt.includes(l)},startingViewDate:{type:Date,required:!1,default:()=>new Date},dayPickerHeadingFormat:{type:String,required:!1,default:"LLLL yyyy"},monthListFormat:{type:String,required:!1,default:"LLL"},weekdayFormat:{type:String,required:!1,default:"EE"},dayFormat:{type:String,required:!1,default:"dd"},inputFormat:{type:String,required:!1,default:"yyyy-MM-dd"},weekDayNames:{type:Array,required:!1},weekStartsOn:{type:Number,required:!1,default:1,validator:l=>[0,1,2,3,4,5,6].includes(l)},disabled:{type:Boolean,required:!1,default:!1},clearable:{type:Boolean,required:!1,default:!1},typeable:{type:Boolean,required:!1,default:!1},minimumView:{type:String,required:!1,default:"day",validate:l=>typeof l=="string"&&Pt.includes(l)}},emits:{"update:modelValue":l=>l==null||Se(l),decadePageChanged:l=>!0,yearPageChanged:l=>!0,monthPageChanged:l=>!0,opened:()=>!0,closed:()=>!0},setup(l,{emit:t,attrs:n}){const a=e.ref("none"),o=e.ref(l.startingViewDate),r=e.ref(null),s=e.ref(!1),i=e.ref(""),c=F=>{const A=F.replace(/[a-zA-Z]/g,"0");return/0/.test(A)?A:""},d=e.computed(()=>c(l.inputFormat));let p=null,g=null;const E=()=>{p?.destroy(),p=null},y=async()=>{if(!g){const{default:F}=await Promise.resolve().then(()=>bn);g=F}return g},V=()=>{p&&p.value!==i.value&&(p.value=i.value??"")},f=async()=>{if(E(),!r.value||!d.value)return;p=(await y())(r.value,{mask:d.value,lazy:!0,overwrite:!0}),V()};e.watchEffect(()=>{if(!i.value)return;const F=ol(i.value,l.inputFormat);F&&(o.value=F)}),e.watchEffect(()=>{i.value=l.modelValue&&Se(l.modelValue)?Rt(l.modelValue,l.inputFormat):""}),e.onMounted(()=>{d.value&&e.nextTick(()=>{f()})}),e.onBeforeUnmount(()=>{E()}),e.watch(d,F=>{F?e.nextTick(()=>{f()}):E()}),e.watch(i,()=>{V()});const h=(F="none")=>{l.disabled||(F!=="none"&&a.value==="none"&&(o.value=l.modelValue||op(l.lowerLimit,l.upperLimit,o.value)),a.value=F,t(F!=="none"?"opened":"closed"))};e.watchEffect(()=>{l.disabled&&(a.value="none")});const x=(F,A)=>{o.value=A,F==="year"?t("decadePageChanged",A):F==="month"?t("yearPageChanged",A):F==="day"&&t("monthPageChanged",A)},k=F=>{o.value=F,l.minimumView==="year"?(h("none"),t("update:modelValue",F)):a.value="month"},w=F=>{o.value=F,l.minimumView==="month"?(h("none"),t("update:modelValue",F)):a.value="day"},b=F=>{o.value=F,l.minimumView==="day"?(h("none"),t("update:modelValue",F)):a.value="time"},B=F=>{h("none"),t("update:modelValue",F)},$=()=>{l.clearable&&(h("none"),t("update:modelValue",null),o.value=l.startingViewDate)},S=()=>s.value=!0,j=()=>h(T.value),W=()=>{s.value=!1,h()},K=F=>{const A=F.keyCode?F.keyCode:F.which;if([27,13].includes(A)&&r.value.blur(),l.typeable){const P=ol(r.value.value,l.inputFormat);P&&i.value===Rt(P,l.inputFormat)&&(i.value=r.value.value,t("update:modelValue",P))}},T=e.computed(()=>{const F=Pt.indexOf(l.startingView),A=Pt.indexOf(l.minimumView);return F<A?l.minimumView:l.startingView}),z=F=>Object.fromEntries(Object.entries(F??{}).filter(([A,H])=>A.startsWith("--"))),L=e.computed(()=>l.weekDayNames?.length===7?l.weekDayNames:void 0);return{blur:W,focus:j,click:S,input:i,inputRef:r,pageDate:o,renderView:h,updatePageDate:x,selectYear:k,selectMonth:w,selectDay:b,selectTime:B,keyUp:K,normalizedWeekdayNames:L,viewShown:a,goBackFromTimepicker:()=>l.startingView==="time"&&l.minimumView==="time"?null:a.value="day",clearModelValue:$,initialView:T,log:F=>console.log(F),variables:z}}}),sp={class:"v3dp__input_wrapper"},ip=["readonly","placeholder","disabled","tabindex"],cp={class:"v3dp__clearable"};function dp(l,t,n,a,o,r){const s=e.resolveComponent("year-picker"),i=e.resolveComponent("month-picker"),c=e.resolveComponent("day-picker"),d=e.resolveComponent("time-picker");return e.openBlock(),e.createElementBlock("div",{class:"v3dp__datepicker",style:e.normalizeStyle(l.variables(l.$attrs.style))},[e.createElementVNode("div",sp,[e.withDirectives(e.createElementVNode("input",e.mergeProps({type:"text",ref:"inputRef",readonly:!l.typeable,"onUpdate:modelValue":t[0]||(t[0]=p=>l.input=p)},l.$attrs,{placeholder:l.placeholder,disabled:l.disabled,tabindex:l.disabled?-1:0,onKeyup:t[1]||(t[1]=(...p)=>l.keyUp&&l.keyUp(...p)),onBlur:t[2]||(t[2]=(...p)=>l.blur&&l.blur(...p)),onFocus:t[3]||(t[3]=(...p)=>l.focus&&l.focus(...p)),onClick:t[4]||(t[4]=(...p)=>l.click&&l.click(...p))}),null,16,ip),[[e.vModelText,l.input]]),e.withDirectives(e.createElementVNode("div",cp,[e.renderSlot(l.$slots,"clear",{onClear:l.clearModelValue},()=>[e.createElementVNode("i",{onClick:t[5]||(t[5]=p=>l.clearModelValue())},"x")])],512),[[e.vShow,l.clearable&&l.modelValue]])]),e.withDirectives(e.createVNode(s,{pageDate:l.pageDate,"onUpdate:pageDate":t[6]||(t[6]=p=>l.updatePageDate("year",p)),selected:l.modelValue,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,onSelect:l.selectYear},null,8,["pageDate","selected","lowerLimit","upperLimit","onSelect"]),[[e.vShow,l.viewShown==="year"]]),e.withDirectives(e.createVNode(i,{pageDate:l.pageDate,"onUpdate:pageDate":t[7]||(t[7]=p=>l.updatePageDate("month",p)),selected:l.modelValue,onSelect:l.selectMonth,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,format:l.monthListFormat,onBack:t[8]||(t[8]=p=>l.viewShown="year")},null,8,["pageDate","selected","onSelect","lowerLimit","upperLimit","format"]),[[e.vShow,l.viewShown==="month"]]),e.withDirectives(e.createVNode(c,{pageDate:l.pageDate,"onUpdate:pageDate":t[9]||(t[9]=p=>l.updatePageDate("day",p)),selected:l.modelValue,weekStartsOn:l.weekStartsOn,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,headingFormat:l.dayPickerHeadingFormat,disabledDates:l.disabledDates,weekdayFormat:l.weekdayFormat,"allow-outside-interval":l.allowOutsideInterval,format:l.dayFormat,"custom-weekdays":l.normalizedWeekdayNames,onSelect:l.selectDay,onBack:t[10]||(t[10]=p=>l.viewShown="month")},null,8,["pageDate","selected","weekStartsOn","lowerLimit","upperLimit","headingFormat","disabledDates","weekdayFormat","allow-outside-interval","format","custom-weekdays","onSelect"]),[[e.vShow,l.viewShown==="day"]]),e.withDirectives(e.createVNode(d,{pageDate:l.pageDate,visible:l.viewShown==="time",selected:l.modelValue,disabledTime:l.disabledTime,onSelect:l.selectTime,onBack:l.goBackFromTimepicker},null,8,["pageDate","visible","selected","disabledTime","onSelect","onBack"]),[[e.vShow,l.viewShown==="time"]])],4)}const up=ae(rp,[["render",dp]]),pp=ae(e.defineComponent({__name:"vs-input-date2",props:{clearable:{type:Boolean,default:!0},now:{type:Boolean},editable:{type:Boolean,default:!0},time:{type:Boolean},isInfinity:{type:Boolean},mode:{default:"date"},weekStart:{},dayNames:{},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,{inputClass:o}=De(n.style),r=e.computed(()=>n.mode?n.mode:n.time?"datetime":"date"),s={date:"дд.мм.рррр",datetime:"дд.мм.рррр гг:хх",month:"мм.рррр",week:"рррр-тиждень",time:"гг:хх",year:"рррр"},i=e.computed(()=>n.placeholder||s[r.value]||""),c=e.computed(()=>["py-1.5 px-3 block w-full placeholder:text-[#767f8f] bg-white",o.value,n.customClass,{"!border-red-600":n.error}]),d=e.computed(()=>!n.modelValue&&n.now?new Date:null),p=e.computed({get:()=>w(n.modelValue??d.value,r.value)||void 0,set:A=>a("update:modelValue",b(A,r.value))}),g=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"],E=e.computed(()=>{if(n.dayNames?.length)return n.dayNames.length===7?n.dayNames:g}),y=e.computed(()=>{const A=n.weekStart,H=typeof A=="string"?Number(A):A;return H===void 0||Number.isNaN(H)?1:Math.min(6,Math.max(0,H))}),V=e.computed(()=>{switch(r.value){case"time":return{startingView:"time",minimumView:"time"};case"month":return{startingView:"month",minimumView:"month"};case"year":return{startingView:"year",minimumView:"year"};case"datetime":return{startingView:"day",minimumView:"time"};default:return{startingView:"day",minimumView:"day"}}}),f={date:"dd.MM.yyyy",datetime:"dd.MM.yyyy HH:mm",month:"MM.yyyy",time:"HH:mm",week:"dd.MM.yyyy",year:"yyyy"},h=e.computed(()=>f[r.value]||"dd.MM.yyyy"),x=e.computed(()=>({"--vdp-selected-bg-color":n.style?.primaryColor||"#2563eb","--vdp-hover-bg-color":n.style?.primaryColor||"#2563eb","--vdp-selected-color":"#ffffff","--vdp-hover-color":"#ffffff","--vdp-border-radius":n.style?.size==="sm"?"6px":"8px","--vdp-elem-font-size":n.style?.size==="sm"?"0.75em":"0.85em"})),k=e.ref(!1);e.watch(()=>n.modelValue,A=>{A?k.value=!0:n.now||(k.value=!1)},{immediate:!0}),e.watchEffect(()=>{n.now&&!n.modelValue&&!k.value&&(a("update:modelValue",b(new Date,r.value)),k.value=!0)});function w(A,H){if(!A)return null;if(A instanceof Date&&!Number.isNaN(A.getTime()))return A;if(typeof A!="string")return null;switch(H){case"datetime":return j(A);case"time":return T(A);case"month":return W(A);case"year":return K(A);case"week":return z(A);case"date":default:return S(A)}}function b(A,H){if(!A)return null;const P=A instanceof Date?A:w(A,H);if(!P)return null;switch(H){case"datetime":return`${B(P)}T${$(P)}`;case"time":return $(P);case"month":return`${P.getFullYear()}-${F(P.getMonth()+1)}`;case"year":return`${P.getFullYear()}`;case"week":{const{year:pe,week:ke}=L(P);return`${pe}-W${F(ke)}`}case"date":default:return B(P)}}function B(A){return`${A.getFullYear()}-${F(A.getMonth()+1)}-${F(A.getDate())}`}function $(A){return`${F(A.getHours())}:${F(A.getMinutes())}`}function S(A){const H=A.split("-");if(H.length<3)return null;const[P,pe,ke]=H.map(Number);return!P||!pe||!ke?null:new Date(P,pe-1,ke)}function j(A){const H=A.includes("T")?A:A.replace(" ","T"),P=new Date(H);return Number.isNaN(P.getTime())?null:P}function W(A){const[H,P]=A.split("-").map(Number);return!H||Number.isNaN(P)?null:new Date(H,(P||1)-1,1)}function K(A){const H=Number(A);return H?new Date(H,0,1):null}function T(A){const H=A.match(/^(\d{1,2}):(\d{2})$/);if(!H)return null;const[,P,pe]=H,ke=new Date;return ke.setHours(Number(P),Number(pe),0,0),ke}function z(A){const H=A.match(/^(\d{4})-W(\d{2})$/);if(!H)return null;const[,P,pe]=H,ke=Number(pe);return Z(Number(P),ke)}function L(A){const H=new Date(Date.UTC(A.getFullYear(),A.getMonth(),A.getDate())),P=H.getUTCDay()||7;H.setUTCDate(H.getUTCDate()+4-P);const pe=new Date(Date.UTC(H.getUTCFullYear(),0,1)),ke=Math.ceil(((H.getTime()-pe.getTime())/864e5+1)/7);return{year:H.getUTCFullYear(),week:ke}}function Z(A,H){if(!A||!H)return null;const P=new Date(A,0,1+(H-1)*7),pe=P.getDay(),ke=P;return pe<=4?ke.setDate(P.getDate()-P.getDay()+1):ke.setDate(P.getDate()+8-P.getDay()),ke}function F(A){return String(A).padStart(2,"0")}return(A,H)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vs-date-picker",n.customClass]),style:e.normalizeStyle(x.value)},[e.createVNode(up,{modelValue:p.value,"onUpdate:modelValue":H[0]||(H[0]=P=>p.value=P),placeholder:i.value,disabled:n.disabled,clearable:n.clearable,typeable:n.editable,"week-day-names":E.value,"week-starts-on":y.value,"starting-view":V.value.startingView,"minimum-view":V.value.minimumView,"input-format":h.value,name:n.name,class:e.normalizeClass(c.value)},null,8,["modelValue","placeholder","disabled","clearable","typeable","week-day-names","week-starts-on","starting-view","minimum-view","input-format","name","class"])],6))}}),[["__scopeId","data-v-a65a2ac3"]]),sl=(l={mode:"edit",schema:null})=>new Promise(t=>{const{close:n}=he.modal({title:l.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:Jn,contentProps:{...l,onClose:()=>{t(null),n()},onSave:a=>{t(a),n()}}})});Je.install=function(t){t.component("VForm",Je),Object.assign(t.config.globalProperties,{$form:sl}),t.provide("form",sl),window.v3plugin||(window.v3plugin={})};function Qe(l){return typeof l=="string"||l instanceof String}function il(l){var t;return typeof l=="object"&&l!=null&&(l==null||(t=l.constructor)==null?void 0:t.name)==="Object"}function cl(l,t){return Array.isArray(t)?cl(l,(n,a)=>t.includes(a)):Object.entries(l).reduce((n,a)=>{let[o,r]=a;return t(r,o)&&(n[o]=r),n},{})}const Q={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function dl(l){switch(l){case Q.LEFT:return Q.FORCE_LEFT;case Q.RIGHT:return Q.FORCE_RIGHT;default:return l}}function hn(l){return l.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function Ut(l,t){if(t===l)return!0;const n=Array.isArray(t),a=Array.isArray(l);let o;if(n&&a){if(t.length!=l.length)return!1;for(o=0;o<t.length;o++)if(!Ut(t[o],l[o]))return!1;return!0}if(n!=a)return!1;if(t&&l&&typeof t=="object"&&typeof l=="object"){const r=t instanceof Date,s=l instanceof Date;if(r&&s)return t.getTime()==l.getTime();if(r!=s)return!1;const i=t instanceof RegExp,c=l instanceof RegExp;if(i&&c)return t.toString()==l.toString();if(i!=c)return!1;const d=Object.keys(t);for(o=0;o<d.length;o++)if(!Object.prototype.hasOwnProperty.call(l,d[o]))return!1;for(o=0;o<d.length;o++)if(!Ut(l[d[o]],t[d[o]]))return!1;return!0}else if(t&&l&&typeof t=="function"&&typeof l=="function")return t.toString()===l.toString();return!1}class mp{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?Q.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?Q.RIGHT:Q.LEFT}}function se(l,t){return new se.InputMask(l,t)}function ul(l){if(l==null)throw new Error("mask property should be defined");return l instanceof RegExp?se.MaskedRegExp:Qe(l)?se.MaskedPattern:l===Date?se.MaskedDate:l===Number?se.MaskedNumber:Array.isArray(l)||l===Array?se.MaskedDynamic:se.Masked&&l.prototype instanceof se.Masked?l:se.Masked&&l instanceof se.Masked?l.constructor:l instanceof Function?se.MaskedFunction:(console.warn("Mask not found for mask",l),se.Masked)}function ut(l){if(!l)throw new Error("Options in not defined");if(se.Masked){if(l.prototype instanceof se.Masked)return{mask:l};const{mask:t=void 0,...n}=l instanceof se.Masked?{mask:l}:il(l)&&l.mask instanceof se.Masked?l:{};if(t){const a=t.mask;return{...cl(t,(o,r)=>!r.startsWith("_")),mask:t.constructor,_mask:a,...n}}}return il(l)?{...l}:{mask:l}}function Ge(l){if(se.Masked&&l instanceof se.Masked)return l;const t=ut(l),n=ul(t.mask);if(!n)throw new Error("Masked class is not found for provided mask "+t.mask+", appropriate module needs to be imported manually before creating mask.");return t.mask===n&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new n(t)}se.createMask=Ge;class Ht{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return t??this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return t??this.value.length}select(t,n){if(!(t==null||n==null||t===this.selectionStart&&n===this.selectionEnd))try{this._unsafeSelect(t,n)}catch{}}get isActive(){return!1}}se.MaskElement=Ht;const pl=90,fp=89;class kt extends Ht{constructor(t){super(),this.input=t,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var t,n,a;return(t=(n=(a=this.input).getRootNode)==null?void 0:n.call(a))!=null?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){if(this._handlers.redo&&(t.keyCode===pl&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===fp&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===pl&&(t.metaKey||t.ctrlKey))return t.preventDefault(),this._handlers.undo(t);t.isComposing||this._handlers.selectionChange(t)}_onBeforeinput(t){if(t.inputType==="historyUndo"&&this._handlers.undo)return t.preventDefault(),this._handlers.undo(t);if(t.inputType==="historyRedo"&&this._handlers.redo)return t.preventDefault(),this._handlers.redo(t)}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}se.HTMLMaskElement=kt;class ml extends kt{constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,n){this.input.setSelectionRange(t,n)}get value(){return this.input.value}set value(t){this.input.value=t}}se.HTMLMaskElement=kt;class gn extends kt{get _unsafeSelectionStart(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),a=n&&n.anchorOffset,o=n&&n.focusOffset;return o==null||a==null||a<o?a:o}get _unsafeSelectionEnd(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),a=n&&n.anchorOffset,o=n&&n.focusOffset;return o==null||a==null||a>o?a:o}_unsafeSelect(t,n){if(!this.rootElement.createRange)return;const a=this.rootElement.createRange();a.setStart(this.input.firstChild||this.input,t),a.setEnd(this.input.lastChild||this.input,n);const o=this.rootElement,r=o.getSelection&&o.getSelection();r&&(r.removeAllRanges(),r.addRange(a))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}se.HTMLContenteditableMaskElement=gn;class qt{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>qt.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}qt.MAX_LENGTH=100;class fl{constructor(t,n){this.el=t instanceof Ht?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new gn(t):new ml(t),this.masked=Ge(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new qt,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(t){var n;return t==null||((n=this.masked)==null?void 0:n.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof se.Masked)&&this.masked.constructor===ul(t)){this.masked.updateOptions({mask:t});return}const n=t instanceof se.Masked?t:Ge({mask:t});n.unmaskedValue=this.masked.unmaskedValue,this.masked=n}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t,n){const a=this._listeners[t];a&&a.forEach(o=>o(n))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){!this.el||!this.el.isActive||(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(t){const n=this.masked.unmaskedValue,a=this.masked.value,o=this.masked.rawInputValue,r=this.displayValue,s=this.unmaskedValue!==n||this.value!==a||this._rawInputValue!==o;this._unmaskedValue=n,this._value=a,this._rawInputValue=o,this.el.value!==r&&(this.el.value=r),t==="auto"?this.alignCursor():t!=null&&(this.cursorPos=t),s&&this._fireChangeEvents(),!this._historyChanging&&(s||this.history.isEmpty)&&this.history.push({unmaskedValue:n,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:n,...a}=t,o=!this.maskEquals(n),r=this.masked.optionsIsChanged(a);o&&(this.mask=n),r&&this.masked.updateOptions(a),(o||r)&&this.updateControl()}updateCursor(t){t!=null&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,Q.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,n){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(n),this}off(t,n){if(!this._listeners[t])return this;if(!n)return delete this._listeners[t],this;const a=this._listeners[t].indexOf(n);return a>=0&&this._listeners[t].splice(a,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const n=new mp({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),a=this.masked.rawInputValue,o=this.masked.splice(n.startChangePos,n.removed.length,n.inserted,n.removeDirection,{input:!0,raw:!0}).offset,r=a===this.masked.rawInputValue?n.removeDirection:Q.NONE;let s=this.masked.nearestInputPos(n.startChangePos+o,r);r!==Q.NONE&&(s=this.masked.nearestInputPos(s,Q.NONE)),this.updateControl(s),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}se.InputMask=fl;class de{static normalize(t){return Array.isArray(t)?t:[t,new de]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}se.ChangeDetails=de;class Ye{constructor(t,n,a){t===void 0&&(t=""),n===void 0&&(n=0),this.value=t,this.from=n,this.stop=a}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||t!=null&&this.from>=t)return"";const n=this.value[0];return this.value=this.value.slice(1),n}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class Ne{constructor(t){this._value="",this._update({...Ne.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,n){n===void 0&&(n={input:!0}),this.reset(),this.append(t,n,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,n){return t}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),Math.min(this.displayValue.length,n-t)}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this.displayValue.slice(t,n)}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new Ye(this.extractInput(t,n),t)}appendTail(t){return Qe(t)&&(t=new Ye(String(t))),t.appendTo(this)}_appendCharRaw(t,n){return t?(this._value+=t,new de({inserted:t,rawInserted:t})):new de}_appendChar(t,n,a){n===void 0&&(n={});const o=this.state;let r;if([t,r]=this.doPrepareChar(t,n),t&&(r=r.aggregate(this._appendCharRaw(t,n)),!r.rawInserted&&this.autofix==="pad")){const s=this.state;this.state=o;let i=this.pad(n);const c=this._appendCharRaw(t,n);i=i.aggregate(c),c.rawInserted||i.equals(r)?r=i:this.state=s}if(r.inserted){let s,i=this.doValidate(n)!==!1;if(i&&a!=null){const c=this.state;if(this.overwrite===!0){s=a.state;for(let p=0;p<r.rawInserted.length;++p)a.unshift(this.displayValue.length-r.tailShift)}let d=this.appendTail(a);if(i=d.rawInserted.length===a.toString().length,!(i&&d.inserted)&&this.overwrite==="shift"){this.state=c,s=a.state;for(let p=0;p<r.rawInserted.length;++p)a.shift();d=this.appendTail(a),i=d.rawInserted.length===a.toString().length}i&&d.inserted&&(this.state=c)}i||(r=new de,this.state=o,a&&s&&(a.state=s))}return r}_appendPlaceholder(){return new de}_appendEager(){return new de}append(t,n,a){if(!Qe(t))throw new Error("value should be string");const o=Qe(a)?new Ye(String(a)):a;n!=null&&n.tail&&(n._beforeTailState=this.state);let r;[t,r]=this.doPrepare(t,n);for(let s=0;s<t.length;++s){const i=this._appendChar(t[s],n,o);if(!i.rawInserted&&!this.doSkipInvalid(t[s],n,o))break;r.aggregate(i)}return(this.eager===!0||this.eager==="append")&&n!=null&&n.input&&t&&r.aggregate(this._appendEager()),o!=null&&(r.tailShift+=this.appendTail(o).tailShift),r}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(n),new de}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const n=this.rawInputValue,a=this.value,o=t();return this.rawInputValue=n,this.value&&this.value!==a&&a.indexOf(this.value)===0&&(this.append(a.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,o}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const n=this.state,a=t(this);return this.state=n,delete this._isolated,a}doSkipInvalid(t,n,a){return!!this.skipInvalid}doPrepare(t,n){return n===void 0&&(n={}),de.normalize(this.prepare?this.prepare(t,this,n):t)}doPrepareChar(t,n){return n===void 0&&(n={}),de.normalize(this.prepareChar?this.prepareChar(t,this,n):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,n,a,o,r){a===void 0&&(a=""),o===void 0&&(o=Q.NONE),r===void 0&&(r={input:!0});const s=t+n,i=this.extractTail(s),c=this.eager===!0||this.eager==="remove";let d;c&&(o=dl(o),d=this.extractInput(0,s,{raw:!0}));let p=t;const g=new de;if(o!==Q.NONE&&(p=this.nearestInputPos(t,n>1&&t!==0&&!c?Q.NONE:o),g.tailShift=p-t),g.aggregate(this.remove(p)),c&&o!==Q.NONE&&d===this.rawInputValue)if(o===Q.FORCE_LEFT){let E;for(;d===this.rawInputValue&&(E=this.displayValue.length);)g.aggregate(new de({tailShift:-1})).aggregate(this.remove(E-1))}else o===Q.FORCE_RIGHT&&i.unshift();return g.aggregate(this.append(a,r,i))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!Ut(this,t)}typedValueEquals(t){const n=this.typedValue;return t===n||Ne.EMPTY_VALUES.includes(t)&&Ne.EMPTY_VALUES.includes(n)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new de}}Ne.DEFAULTS={skipInvalid:!0},Ne.EMPTY_VALUES=[void 0,null,""],se.Masked=Ne;class et{constructor(t,n){t===void 0&&(t=[]),n===void 0&&(n=0),this.chunks=t,this.from=n}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=Qe(t)?new Ye(String(t)):t;const n=this.chunks[this.chunks.length-1],a=n&&(n.stop===t.stop||t.stop==null)&&t.from===n.from+n.toString().length;if(t instanceof Ye)a?n.extend(t.toString()):this.chunks.push(t);else if(t instanceof et){if(t.stop==null){let o;for(;t.chunks.length&&t.chunks[0].stop==null;)o=t.chunks.shift(),o.from+=t.from,this.extend(o)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof se.MaskedPattern))return new Ye(this.toString()).appendTo(t);const n=new de;for(let a=0;a<this.chunks.length;++a){const o=this.chunks[a],r=t._mapPosToBlock(t.displayValue.length),s=o.stop;let i;if(s!=null&&(!r||r.index<=s)&&((o instanceof et||t._stops.indexOf(s)>=0)&&n.aggregate(t._appendPlaceholder(s)),i=o instanceof et&&t._blocks[s]),i){const c=i.appendTail(o);n.aggregate(c);const d=o.toString().slice(c.rawInserted.length);d&&n.aggregate(t.append(d,{tail:!0}))}else n.aggregate(t.append(o.toString(),{tail:!0}))}return n}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:n,...a}=t;Object.assign(this,a),this.chunks=n.map(o=>{const r="chunks"in o?new et:new Ye;return r.state=o,r})}unshift(t){if(!this.chunks.length||t!=null&&this.from>=t)return"";const n=t!=null?t-this.from:t;let a=0;for(;a<this.chunks.length;){const o=this.chunks[a],r=o.unshift(n);if(o.toString()){if(!r)break;++a}else this.chunks.splice(a,1);if(r)return r}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const n=this.chunks[t],a=n.shift();if(n.toString()){if(!a)break;--t}else this.chunks.splice(t,1);if(a)return a}return""}}class hp{constructor(t,n){this.masked=t,this._log=[];const{offset:a,index:o}=t._mapPosToBlock(n)||(n<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=a,this.index=o,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((n=this.block)==null?void 0:n.displayValue.length)||0){var n;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,Q.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,Q.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,Q.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,Q.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,Q.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,Q.NONE),!0})}}class yn{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(n),this._value||(this._isRawInput=!1),new de}nearestInputPos(t,n){n===void 0&&(n=Q.NONE);const a=0,o=this._value.length;switch(n){case Q.LEFT:case Q.FORCE_LEFT:return a;case Q.NONE:case Q.RIGHT:case Q.FORCE_RIGHT:default:return o}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._isRawInput?n-t:0}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),a===void 0&&(a={}),a.raw&&this._isRawInput&&this._value.slice(t,n)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,n){if(n===void 0&&(n={}),this.isFilled)return new de;const a=this.eager===!0||this.eager==="append",r=this.char===t&&(this.isUnmasking||n.input||n.raw)&&(!n.raw||!a)&&!n.tail,s=new de({inserted:this.char,rawInserted:r?this.char:""});return this._value=this.char,this._isRawInput=r&&(n.raw||n.input),s}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new de;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new Ye("")}appendTail(t){return Qe(t)&&(t=new Ye(String(t))),t.appendTo(this)}append(t,n,a){const o=this._appendChar(t[0],n);return a!=null&&(o.tailShift+=this.appendTail(a).tailShift),o}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=!!t._rawInputValue}pad(t){return this._appendPlaceholder()}}class bt{constructor(t){const{parent:n,isOptional:a,placeholderChar:o,displayChar:r,lazy:s,eager:i,...c}=t;this.masked=Ge(c),Object.assign(this,{parent:n,isOptional:a,placeholderChar:o,displayChar:r,lazy:s,eager:i})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),t===0&&n>=1?(this.isFilled=!1,this.masked.remove(t,n)):new de}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(t,n){if(n===void 0&&(n={}),this.isFilled)return new de;const a=this.masked.state;let o=this.masked._appendChar(t,this.currentMaskFlags(n));return o.inserted&&this.doValidate(n)===!1&&(o=new de,this.masked.state=a),!o.inserted&&!this.isOptional&&!this.lazy&&!n.input&&(o.inserted=this.placeholderChar),o.skip=!o.inserted&&!this.isOptional,this.isFilled=!!o.inserted,o}append(t,n,a){return this.masked.append(t,this.currentMaskFlags(n),a)}_appendPlaceholder(){return this.isFilled||this.isOptional?new de:(this.isFilled=!0,new de({inserted:this.placeholderChar}))}_appendEager(){return new de}extractTail(t,n){return this.masked.extractTail(t,n)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.masked.extractInput(t,n,a)}nearestInputPos(t,n){n===void 0&&(n=Q.NONE);const a=0,o=this.value.length,r=Math.min(Math.max(t,a),o);switch(n){case Q.LEFT:case Q.FORCE_LEFT:return this.isComplete?r:a;case Q.RIGHT:case Q.FORCE_RIGHT:return this.isComplete?r:o;case Q.NONE:default:return r}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.value.slice(t,n).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var n;return{...t,_beforeTailState:(t==null||(n=t._beforeTailState)==null?void 0:n.masked)||t?._beforeTailState}}pad(t){return new de}}bt.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class hl extends Ne{updateOptions(t){super.updateOptions(t)}_update(t){const n=t.mask;n&&(t.validate=a=>a.search(n)>=0),super._update(t)}}se.MaskedRegExp=hl;class $e extends Ne{constructor(t){super({...$e.DEFAULTS,...t,definitions:Object.assign({},bt.DEFAULT_DEFINITIONS,t?.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const n=this.mask;if(!n||!t)return;let a=!1,o=!1;for(let r=0;r<n.length;++r){if(this.blocks){const d=n.slice(r),p=Object.keys(this.blocks).filter(E=>d.indexOf(E)===0);p.sort((E,y)=>y.length-E.length);const g=p[0];if(g){const{expose:E,repeat:y,...V}=ut(this.blocks[g]),f={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...V,repeat:y,parent:this},h=y!=null?new se.RepeatBlock(f):Ge(f);h&&(this._blocks.push(h),E&&(this.exposeBlock=h),this._maskedBlocks[g]||(this._maskedBlocks[g]=[]),this._maskedBlocks[g].push(this._blocks.length-1)),r+=g.length-1;continue}}let s=n[r],i=s in t;if(s===$e.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(s==="{"||s==="}"){a=!a;continue}if(s==="["||s==="]"){o=!o;continue}if(s===$e.ESCAPE_CHAR){if(++r,s=n[r],!s)break;i=!1}const c=i?new bt({isOptional:o,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...ut(t[s]),parent:this}):new yn({char:s,eager:this.eager,isUnmasking:a});this._blocks.push(c)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t){this.reset();return}const{_blocks:n,...a}=t;this._blocks.forEach((o,r)=>o.state=n[r]),super.state=a}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((t,n)=>t+=n.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(n),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,n)=>t+=n.value,"")}set value(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(n),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(n),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,n)=>t+=n.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const n=new de;let a=(t=this._mapPosToBlock(this.displayValue.length))==null?void 0:t.index;if(a==null)return n;this._blocks[a].isFilled&&++a;for(let o=a;o<this._blocks.length;++o){const r=this._blocks[o]._appendEager();if(!r.inserted)break;n.aggregate(r)}return n}_appendCharRaw(t,n){n===void 0&&(n={});const a=this._mapPosToBlock(this.displayValue.length),o=new de;if(!a)return o;for(let s=a.index,i;i=this._blocks[s];++s){var r;const c=i._appendChar(t,{...n,_beforeTailState:(r=n._beforeTailState)==null||(r=r._blocks)==null?void 0:r[s]});if(o.aggregate(c),c.consumed)break}return o}extractTail(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=new et;return t===n||this._forEachBlocksInRange(t,n,(o,r,s,i)=>{const c=o.extractTail(s,i);c.stop=this._findStopBefore(r),c.from=this._blockStartPos(r),c instanceof et&&(c.blockIndex=r),a.extend(c)}),a}extractInput(t,n,a){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),a===void 0&&(a={}),t===n)return"";let o="";return this._forEachBlocksInRange(t,n,(r,s,i,c)=>{o+=r.extractInput(i,c,a)}),o}_findStopBefore(t){let n;for(let a=0;a<this._stops.length;++a){const o=this._stops[a];if(o<=t)n=o;else break}return n}_appendPlaceholder(t){const n=new de;if(this.lazy&&t==null)return n;const a=this._mapPosToBlock(this.displayValue.length);if(!a)return n;const o=a.index,r=t??this._blocks.length;return this._blocks.slice(o,r).forEach(s=>{if(!s.lazy||t!=null){var i;n.aggregate(s._appendPlaceholder((i=s._blocks)==null?void 0:i.length))}}),n}_mapPosToBlock(t){let n="";for(let a=0;a<this._blocks.length;++a){const o=this._blocks[a],r=n.length;if(n+=o.displayValue,t<=n.length)return{index:a,offset:t-r}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((n,a)=>n+=a.displayValue.length,0)}_forEachBlocksInRange(t,n,a){n===void 0&&(n=this.displayValue.length);const o=this._mapPosToBlock(t);if(o){const r=this._mapPosToBlock(n),s=r&&o.index===r.index,i=o.offset,c=r&&s?r.offset:this._blocks[o.index].displayValue.length;if(a(this._blocks[o.index],o.index,i,c),r&&!s){for(let d=o.index+1;d<r.index;++d)a(this._blocks[d],d,0,this._blocks[d].displayValue.length);a(this._blocks[r.index],r.index,0,r.offset)}}}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=super.remove(t,n);return this._forEachBlocksInRange(t,n,(o,r,s,i)=>{a.aggregate(o.remove(s,i))}),a}nearestInputPos(t,n){if(n===void 0&&(n=Q.NONE),!this._blocks.length)return 0;const a=new hp(this,t);if(n===Q.NONE)return a.pushRightBeforeInput()||(a.popState(),a.pushLeftBeforeInput())?a.pos:this.displayValue.length;if(n===Q.LEFT||n===Q.FORCE_LEFT){if(n===Q.LEFT){if(a.pushRightBeforeFilled(),a.ok&&a.pos===t)return t;a.popState()}if(a.pushLeftBeforeInput(),a.pushLeftBeforeRequired(),a.pushLeftBeforeFilled(),n===Q.LEFT){if(a.pushRightBeforeInput(),a.pushRightBeforeRequired(),a.ok&&a.pos<=t||(a.popState(),a.ok&&a.pos<=t))return a.pos;a.popState()}return a.ok?a.pos:n===Q.FORCE_LEFT?0:(a.popState(),a.ok||(a.popState(),a.ok)?a.pos:0)}return n===Q.RIGHT||n===Q.FORCE_RIGHT?(a.pushRightBeforeInput(),a.pushRightBeforeRequired(),a.pushRightBeforeFilled()?a.pos:n===Q.FORCE_RIGHT?this.displayValue.length:(a.popState(),a.ok||(a.popState(),a.ok)?a.pos:this.nearestInputPos(t,Q.LEFT))):t}totalInputPositions(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);let a=0;return this._forEachBlocksInRange(t,n,(o,r,s,i)=>{a+=o.totalInputPositions(s,i)}),a}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const n=this._maskedBlocks[t];return n?n.map(a=>this._blocks[a]):[]}pad(t){const n=new de;return this._forEachBlocksInRange(0,this.displayValue.length,a=>n.aggregate(a.pad(t))),n}}$e.DEFAULTS={...Ne.DEFAULTS,lazy:!0,placeholderChar:"_"},$e.STOP_CHAR="`",$e.ESCAPE_CHAR="\\",$e.InputDefinition=bt,$e.FixedDefinition=yn,se.MaskedPattern=$e;class wt extends $e{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:n=this.to||0,from:a=this.from||0,maxLength:o=this.maxLength||0,autofix:r=this.autofix,...s}=t;this.to=n,this.from=a,this.maxLength=Math.max(String(n).length,o),this.autofix=r;const i=String(this.from).padStart(this.maxLength,"0"),c=String(this.to).padStart(this.maxLength,"0");let d=0;for(;d<c.length&&c[d]===i[d];)++d;s.mask=c.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),super._update(s)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let n="",a="";const[,o,r]=t.match(/^(\D*)(\d*)(\D*)/)||[];return r&&(n="0".repeat(o.length)+r,a="9".repeat(o.length)+r),n=n.padEnd(this.maxLength,"0"),a=a.padEnd(this.maxLength,"9"),[n,a]}doPrepareChar(t,n){n===void 0&&(n={});let a;return[t,a]=super.doPrepareChar(t.replace(/\D/g,""),n),t||(a.skip=!this.isComplete),[t,a]}_appendCharRaw(t,n){if(n===void 0&&(n={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,n);const a=String(this.from).padStart(this.maxLength,"0"),o=String(this.to).padStart(this.maxLength,"0"),[r,s]=this.boundaries(this.value+t);return Number(s)<this.from?super._appendCharRaw(a[this.value.length],n):Number(r)>this.to?!n.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(a[this.value.length],n).aggregate(this._appendCharRaw(t,n)):super._appendCharRaw(o[this.value.length],n):super._appendCharRaw(t,n)}doValidate(t){const n=this.value;if(n.search(/[^0]/)===-1&&n.length<=this._matchFrom)return!0;const[o,r]=this.boundaries(n);return this.from<=Number(r)&&Number(o)<=this.to&&super.doValidate(t)}pad(t){const n=new de;if(this.value.length===this.maxLength)return n;const a=this.value,o=this.maxLength-this.value.length;if(o){this.reset();for(let r=0;r<o;++r)n.aggregate(super._appendCharRaw("0",t));a.split("").forEach(r=>this._appendCharRaw(r))}return n}}se.MaskedRange=wt;const gp="d{.}`m{.}`Y";class We extends $e{static extractPatternOptions(t){const{mask:n,pattern:a,...o}=t;return{...o,mask:Qe(n)?n:a}}constructor(t){super(We.extractPatternOptions({...We.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:n,pattern:a,blocks:o,...r}={...We.DEFAULTS,...t},s=Object.assign({},We.GET_DEFAULT_BLOCKS());t.min&&(s.Y.from=t.min.getFullYear()),t.max&&(s.Y.to=t.max.getFullYear()),t.min&&t.max&&s.Y.from===s.Y.to&&(s.m.from=t.min.getMonth()+1,s.m.to=t.max.getMonth()+1,s.m.from===s.m.to&&(s.d.from=t.min.getDate(),s.d.to=t.max.getDate())),Object.assign(s,this.blocks,o),super._update({...r,mask:Qe(n)?n:a,blocks:s})}doValidate(t){const n=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&n!=null&&(this.min==null||this.min<=n)&&(this.max==null||n<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}optionsIsChanged(t){return super.optionsIsChanged(We.extractPatternOptions(t))}}We.GET_DEFAULT_BLOCKS=()=>({d:{mask:wt,from:1,to:31,maxLength:2},m:{mask:wt,from:1,to:12,maxLength:2},Y:{mask:wt,from:1900,to:9999}}),We.DEFAULTS={...$e.DEFAULTS,mask:Date,pattern:gp,format:(l,t)=>{if(!l)return"";const n=String(l.getDate()).padStart(2,"0"),a=String(l.getMonth()+1).padStart(2,"0"),o=l.getFullYear();return[n,a,o].join(".")},parse:(l,t)=>{const[n,a,o]=l.split(".").map(Number);return new Date(o,a-1,n)}},se.MaskedDate=We;class xt extends Ne{constructor(t){super({...xt.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map(n=>{const{expose:a,...o}=ut(n),r=Ge({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...o});return a&&(this.exposeMask=r),r}):[])}_appendCharRaw(t,n){n===void 0&&(n={});const a=this._applyDispatch(t,n);return this.currentMask&&a.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(n))),a}_applyDispatch(t,n,a){t===void 0&&(t=""),n===void 0&&(n={}),a===void 0&&(a="");const o=n.tail&&n._beforeTailState!=null?n._beforeTailState._value:this.value,r=this.rawInputValue,s=n.tail&&n._beforeTailState!=null?n._beforeTailState._rawInputValue:r,i=r.slice(s.length),c=this.currentMask,d=new de,p=c?.state;return this.currentMask=this.doDispatch(t,{...n},a),this.currentMask&&(this.currentMask!==c?(this.currentMask.reset(),s&&(this.currentMask.append(s,{raw:!0}),d.tailShift=this.currentMask.value.length-o.length),i&&(d.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):p&&(this.currentMask.state=p)),d}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const n=new de;return t&&n.aggregate(this._applyDispatch("",{},t)),n.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var n,a;return{...t,_beforeTailState:((n=t._beforeTailState)==null?void 0:n.currentMaskRef)===this.currentMask&&((a=t._beforeTailState)==null?void 0:a.currentMask)||t._beforeTailState}}doDispatch(t,n,a){return n===void 0&&(n={}),a===void 0&&(a=""),this.dispatch(t,this,n,a)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,n){n===void 0&&(n={});let[a,o]=super.doPrepare(t,n);if(this.currentMask){let r;[a,r]=super.doPrepare(a,this.currentMaskFlags(n)),o=o.aggregate(r)}return[a,o]}doPrepareChar(t,n){n===void 0&&(n={});let[a,o]=super.doPrepareChar(t,n);if(this.currentMask){let r;[a,r]=super.doPrepareChar(a,this.currentMaskFlags(n)),o=o.aggregate(r)}return[a,o]}reset(){var t;(t=this.currentMask)==null||t.reset(),this.compiledMasks.forEach(n=>n.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask){this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,this._applyDispatch();return}let n=String(t);this.currentMask&&(this.currentMask.typedValue=t,n=this.currentMask.unmaskedValue),this.unmaskedValue=n}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return!!((t=this.currentMask)!=null&&t.isComplete)}get isFilled(){var t;return!!((t=this.currentMask)!=null&&t.isFilled)}remove(t,n){const a=new de;return this.currentMask&&a.aggregate(this.currentMask.remove(t,n)).aggregate(this._applyDispatch()),a}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(n=>n.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:n,currentMaskRef:a,currentMask:o,...r}=t;n&&this.compiledMasks.forEach((s,i)=>s.state=n[i]),a!=null&&(this.currentMask=a,this.currentMask.state=o),super.state=r}extractInput(t,n,a){return this.currentMask?this.currentMask.extractInput(t,n,a):""}extractTail(t,n){return this.currentMask?this.currentMask.extractTail(t,n):super.extractTail(t,n)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,n){return this.currentMask?this.currentMask.nearestInputPos(t,n):super.nearestInputPos(t,n)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every((n,a)=>{if(!t[a])return;const{mask:o,...r}=t[a];return Ut(n,r)&&n.maskEquals(o)}):super.maskEquals(t)}typedValueEquals(t){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(t))}}xt.DEFAULTS={...Ne.DEFAULTS,dispatch:(l,t,n,a)=>{if(!t.compiledMasks.length)return;const o=t.rawInputValue,r=t.compiledMasks.map((s,i)=>{const c=t.currentMask===s,d=c?s.displayValue.length:s.nearestInputPos(s.displayValue.length,Q.FORCE_LEFT);return s.rawInputValue!==o?(s.reset(),s.append(o,{raw:!0})):c||s.remove(d),s.append(l,t.currentMaskFlags(n)),s.appendTail(a),{index:i,weight:s.rawInputValue.length,totalInputPositions:s.totalInputPositions(0,Math.max(d,s.nearestInputPos(s.displayValue.length,Q.FORCE_LEFT)))}});return r.sort((s,i)=>i.weight-s.weight||i.totalInputPositions-s.totalInputPositions),t.compiledMasks[r[0].index]}},se.MaskedDynamic=xt;class _t extends $e{constructor(t){super({..._t.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:n,...a}=t;if(n){const o=n.map(i=>i.length),r=Math.min(...o),s=Math.max(...o)-r;a.mask="*".repeat(r),s&&(a.mask+="["+"*".repeat(s)+"]"),this.enum=n}super._update(a)}_appendCharRaw(t,n){n===void 0&&(n={});const a=Math.min(this.nearestInputPos(0,Q.FORCE_RIGHT),this.value.length),o=this.enum.filter(r=>this.matchValue(r,this.unmaskedValue+t,a));if(o.length){o.length===1&&this._forEachBlocksInRange(0,this.value.length,(s,i)=>{const c=o[0][i];i>=this.value.length||c===s.value||(s.reset(),s._appendChar(c,n))});const r=super._appendCharRaw(o[0][this.value.length],n);return o.length===1&&o[0].slice(this.unmaskedValue.length).split("").forEach(s=>r.aggregate(super._appendCharRaw(s))),r}return new de({skip:!this.isComplete})}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new Ye("",t)}remove(t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),t===n)return new de;const a=Math.min(super.nearestInputPos(0,Q.FORCE_RIGHT),this.value.length);let o;for(o=t;o>=0&&!(this.enum.filter(i=>this.matchValue(i,this.value.slice(a,o),a)).length>1);--o);const r=super.remove(o,n);return r.tailShift+=o-t,r}get isComplete(){return this.enum.indexOf(this.value)>=0}}_t.DEFAULTS={...$e.DEFAULTS,matchValue:(l,t,n)=>l.indexOf(t,n)===n},se.MaskedEnum=_t;class gl extends Ne{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}se.MaskedFunction=gl;var yl;class Le extends Ne{constructor(t){super({...Le.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),n="\\d*",a=(this.scale?"("+hn(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+n+a),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(hn).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(hn(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const n=t.split(this.radix);return n[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),n.join(this.radix)}doPrepareChar(t,n){n===void 0&&(n={});const[a,o]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(n.input&&n.raw||!n.input&&!n.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),n);return t&&!a&&(o.skip=!0),a&&!this.allowPositive&&!this.value&&a!=="-"&&o.aggregate(this._appendChar("-")),[a,o]}_separatorsCount(t,n){n===void 0&&(n=!1);let a=0;for(let o=0;o<t;++o)this._value.indexOf(this.thousandsSeparator,o)===o&&(++a,n&&(t+=this.thousandsSeparator.length));return a}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n),this._removeThousandsSeparators(super.extractInput(t,n,a))}_appendCharRaw(t,n){n===void 0&&(n={});const a=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,o=this._separatorsCountFromSlice(a);this._value=this._removeThousandsSeparators(this.value);const r=this._value;this._value+=t;const s=this.number;let i=!isNaN(s),c=!1;if(i){let E;this.min!=null&&this.min<0&&this.number<this.min&&(E=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(E=this.max),E!=null&&(this.autofix?(this._value=this.format(E,this).replace(Le.UNMASKED_RADIX,this.radix),c||(c=r===this._value&&!n.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let d;i?d=new de({inserted:this._value.slice(r.length),rawInserted:c?"":t,skip:c}):(this._value=r,d=new de),this._value=this._insertThousandsSeparators(this._value);const p=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,g=this._separatorsCountFromSlice(p);return d.tailShift+=(g-o)*this.thousandsSeparator.length,d}_findSeparatorAround(t){if(this.thousandsSeparator){const n=t-this.thousandsSeparator.length+1,a=this.value.indexOf(this.thousandsSeparator,n);if(a<=t)return a}return-1}_adjustRangeWithSeparators(t,n){const a=this._findSeparatorAround(t);a>=0&&(t=a);const o=this._findSeparatorAround(n);return o>=0&&(n=o+this.thousandsSeparator.length),[t,n]}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n);const a=this.value.slice(0,t),o=this.value.slice(n),r=this._separatorsCount(a.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(a+o));const s=this._separatorsCountFromSlice(a);return new de({tailShift:(s-r)*this.thousandsSeparator.length})}nearestInputPos(t,n){if(!this.thousandsSeparator)return t;switch(n){case Q.NONE:case Q.LEFT:case Q.FORCE_LEFT:{const a=this._findSeparatorAround(t-1);if(a>=0){const o=a+this.thousandsSeparator.length;if(t<o||this.value.length<=o||n===Q.FORCE_LEFT)return a}break}case Q.RIGHT:case Q.FORCE_RIGHT:{const a=this._findSeparatorAround(t);if(a>=0)return a+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let n=t;this.min!=null&&(n=Math.max(n,this.min)),this.max!=null&&(n=Math.min(n,this.max)),n!==t&&(this.unmaskedValue=this.format(n,this));let a=this.value;this.normalizeZeros&&(a=this._normalizeZeros(a)),this.padFractionalZeros&&this.scale>0&&(a=this._padFractionalZeros(a)),this._value=a}super.doCommit()}_normalizeZeros(t){const n=this._removeThousandsSeparators(t).split(this.radix);return n[0]=n[0].replace(/^(\D*)(0*)(\d*)/,(a,o,r,s)=>o+s),t.length&&!/\d$/.test(n[0])&&(n[0]=n[0]+"0"),n.length>1&&(n[1]=n[1].replace(/0*$/,""),n[1].length||(n.length=1)),this._insertThousandsSeparators(n.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const n=t.split(this.radix);return n.length<2&&n.push(""),n[1]=n[1].padEnd(this.scale,"0"),n.join(this.radix)}doSkipInvalid(t,n,a){n===void 0&&(n={});const o=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===Le.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,n,a)&&!o}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,Le.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(Le.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(t){return(super.typedValueEquals(t)||Le.EMPTY_VALUES.includes(t)&&Le.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}yl=Le,Le.UNMASKED_RADIX=".",Le.EMPTY_VALUES=[...Ne.EMPTY_VALUES,0],Le.DEFAULTS={...Ne.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[yl.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:l=>l.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},se.MaskedNumber=Le;const Kt={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function kn(l,t,n){t===void 0&&(t=Kt.MASKED),n===void 0&&(n=Kt.MASKED);const a=Ge(l);return o=>a.runIsolated(r=>(r[t]=o,r[n]))}function kl(l,t,n,a){return kn(t,n,a)(l)}se.PIPE_TYPE=Kt,se.createPipe=kn,se.pipe=kl;class bl extends $e{get repeatFrom(){var t;return(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?t:0}get repeatTo(){var t;return(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var n,a,o;const{repeat:r,...s}=ut(t);this._blockOpts=Object.assign({},this._blockOpts,s);const i=Ge(this._blockOpts);this.repeat=(n=(a=r??i.repeat)!=null?a:this.repeat)!=null?n:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((o=this._blocks)==null?void 0:o.length)||0,this.repeatFrom)),blocks:{m:i},eager:i.eager,overwrite:i.overwrite,skipInvalid:i.skipInvalid,lazy:i.lazy,placeholderChar:i.placeholderChar,displayChar:i.displayChar})}_allocateBlock(t){if(t<this._blocks.length)return this._blocks[t];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(Ge(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,n){n===void 0&&(n={});const a=new de;for(let c=(o=(r=this._mapPosToBlock(this.displayValue.length))==null?void 0:r.index)!=null?o:Math.max(this._blocks.length-1,0),d,p;d=(s=this._blocks[c])!=null?s:p=!p&&this._allocateBlock(c);++c){var o,r,s,i;const g=d._appendChar(t,{...n,_beforeTailState:(i=n._beforeTailState)==null||(i=i._blocks)==null?void 0:i[c]});if(g.skip&&p){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(a.aggregate(g),g.consumed)break}return a}_trimEmptyTail(t,n){var a,o;t===void 0&&(t=0);const r=Math.max(((a=this._mapPosToBlock(t))==null?void 0:a.index)||0,this.repeatFrom,0);let s;n!=null&&(s=(o=this._mapPosToBlock(n))==null?void 0:o.index),s==null&&(s=this._blocks.length-1);let i=0;for(let c=s;r<=c&&!this._blocks[c].unmaskedValue;--c,++i);i&&(this._blocks.splice(s-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=super.remove(t,n);return this._trimEmptyTail(t,n),a}totalInputPositions(t,n){return t===void 0&&(t=0),n==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,n)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}}se.RepeatBlock=bl;try{globalThis.IMask=se}catch{}const bn=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:de,ChunksTailDetails:et,DIRECTION:Q,HTMLContenteditableMaskElement:gn,HTMLInputMaskElement:ml,HTMLMaskElement:kt,InputMask:fl,MaskElement:Ht,Masked:Ne,MaskedDate:We,MaskedDynamic:xt,MaskedEnum:_t,MaskedFunction:gl,MaskedNumber:Le,MaskedPattern:$e,MaskedRange:wt,MaskedRegExp:hl,PIPE_TYPE:Kt,PatternFixedDefinition:yn,PatternInputDefinition:bt,RepeatBlock:bl,createMask:Ge,createPipe:kn,default:se,forceDirection:dl,normalizeOpts:ut,pipe:kl},Symbol.toStringTag,{value:"Module"}));ce.ModalEdit=Jn,ce.VForm=Je,ce.VsInputAddress=Hn,ce.VsInputArray=Un,ce.VsInputArraySelect=Ft,ce.VsInputCheckbox=vn,ce.VsInputCodegen=On,ce.VsInputColor=jn,ce.VsInputContainer=Mn,ce.VsInputDate=pp,ce.VsInputEmail=en,ce.VsInputFile=Sn,ce.VsInputFileList=Nn,ce.VsInputKeyValue=zn,ce.VsInputMask=Qt,ce.VsInputMonaco=Kn,ce.VsInputNumber=_n,ce.VsInputRadio=nn,ce.VsInputRange=Pn,ce.VsInputRichtext=An,ce.VsInputSelect=rn,ce.VsInputSlug=Tn,ce.VsInputStatic=Xt,ce.VsInputSwitcher=Jt,ce.VsInputTag=Ln,ce.VsInputTel=tn,ce.VsInputText=it,ce.VsInputTextArray=Rn,ce.VsInputTextarea=Dn,ce.default=Je,ce.inputs=Gn,ce.vsInputDatatable=Fn,ce.vsInputMap=In,Object.defineProperties(ce,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(de,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@opengis/core"),require("lucide-vue-next")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core","lucide-vue-next"],e):(de=typeof globalThis<"u"?globalThis:de||self,e(de.FormBuilder={},de.Vue,de.OpenGISCore,de.lucide))})(this,function(de,e,ge,R){"use strict";const zn=e.defineComponent({__name:"vs-info-tooltip",props:{text:{}},setup(r){const t=r,n=e.ref(!1),l=e.ref({top:"0px",left:"0px"});function a(s){if(!t.text)return;const c=s.currentTarget.getBoundingClientRect();l.value={top:`${c.bottom+4}px`,left:`${Math.min(c.left,window.innerWidth-230)}px`},n.value=!0}function o(){n.value=!1}return(s,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("span",{class:"inline-flex items-center",onMouseenter:a,onMouseleave:o},[e.renderSlot(s.$slots,"default",{},()=>[e.createVNode(e.unref(R.Info),{class:"h-4 w-4 text-gray-400 cursor-help"})])],32),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[n.value&&s.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(l.value),class:"fixed z-[9999] max-w-xs p-2 bg-gray-900 text-white text-xs rounded-lg shadow-lg pointer-events-none"},e.toDisplayString(s.text),5)):e.createCommentVNode("",!0)]))],64))}}),Zr={class:"w-full relative"},Xr={key:0,class:"text-[14px] font-medium text-gray-900 mb-2 flex items-center gap-1"},Jr={class:"opacity-100"},Qr={key:0,class:"text-red-500 text-[14px]"},el={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},tl=e.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(r){const t=r,n=e.computed(()=>typeof t.item?.label=="string"&&t.item.label?t.item.label:t.item?.ua||t.label||t.ua),l=e.computed(()=>!!n.value),a=e.computed(()=>!!t.item?.rules?.includes("required")),o=e.computed(()=>t.item?.info||"");return(s,c)=>(e.openBlock(),e.createElementBlock("div",Zr,[l.value?(e.openBlock(),e.createElementBlock("div",Xr,[e.createElementVNode("span",Jr,e.toDisplayString(n.value),1),a.value?(e.openBlock(),e.createElementBlock("span",Qr,"*")):e.createCommentVNode("",!0),o.value?(e.openBlock(),e.createBlock(zn,{key:1,text:o.value},null,8,["text"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"default",e.mergeProps(s.$attrs,{class:{"opacity-60":s.item.disabled}})),s.error?(e.openBlock(),e.createElementBlock("span",el,e.toDisplayString(s.error),1)):e.createCommentVNode("",!0)]))}}),nl={class:"w-full relative flex flex-row items-center gap-2"},rl={key:0,class:"text-red-500 text-[14px]"},ll={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},al=e.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{default:()=>({container:12,label:3})}},setup(r){const t=r,n=e.computed(()=>t.item?.label||t.label||t.ua),l=e.computed(()=>t.item?.info||""),a=e.computed(()=>t.columns??{container:12,label:3}),o=e.computed(()=>{const{container:d,label:u}=a.value;return!d||d<=0?0:Math.min(Math.max(u??0,0),d)/d}),s=e.computed(()=>t.item?.type==="html"||o.value<=0?!1:!!n.value),c=e.computed(()=>{if(!s.value)return{};const d=`${o.value*100}%`;return{flexBasis:d,maxWidth:d}}),i=e.computed(()=>{const{container:d,label:u}=a.value;if(!d||d<=0)return{};if(t.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!s.value)return{flexBasis:"100%",maxWidth:"100%"};const p=Math.max(d-Math.max(u??0,0),0)/d;if(!p)return{};const g=`${p*100}%`;return{flexBasis:g,maxWidth:g}});return(d,u)=>(e.openBlock(),e.createElementBlock("div",nl,[s.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0 items-center gap-1",style:e.normalizeStyle(c.value)},[e.createTextVNode(e.toDisplayString(n.value)+" ",1),d.item?.rules?.includes("required")&&n.value?(e.openBlock(),e.createElementBlock("span",rl,"*")):e.createCommentVNode("",!0),l.value?(e.openBlock(),e.createBlock(zn,{key:1,text:l.value},null,8,["text"])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"flex-1 min-w-0",style:e.normalizeStyle(i.value)},[e.renderSlot(d.$slots,"default",e.normalizeProps(e.guardReactiveProps(d.$attrs)))],4),d.error?(e.openBlock(),e.createElementBlock("span",ll,e.toDisplayString(d.error),1)):e.createCommentVNode("",!0)]))}}),ol={class:"w-full relative"},sl={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},il=e.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(r){return(t,n)=>(e.openBlock(),e.createElementBlock("div",ol,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),t.error?(e.openBlock(),e.createElementBlock("span",sl,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}}),cl={class:"flex-1 min-w-0"},dl={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},ul={class:"truncate"},pl={key:0,class:"text-red-500 text-[14px]"},fl=["innerHTML"],ml={key:0,class:"mt-1 text-xs text-red-500"},hl={default:tl,horizontal:al,inline:il,settings:e.defineComponent({__name:"vs-layout-settings",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(r){const t=r,n=e.ref("uk");e.computed(()=>(t.item??{})?.[n.value]??t.ua??t.label??"");const l=e.computed(()=>t.item?.description??""),a=e.computed(()=>Array.isArray(t.item?.rules)&&t.item.rules.includes("required")),o=e.computed(()=>(typeof t.error=="string"?t.error:"")??""),s=()=>{const c=typeof localStorage<"u"?localStorage.getItem("locale"):null;n.value=c||"uk"};return e.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(n.value=localStorage.locale)}catch{}window.addEventListener("storage",s)}),e.onUnmounted(()=>{window.removeEventListener("storage",s)}),(c,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full relative",{"opacity-60":c.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(c.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",cl,[c.ua||c.label?(e.openBlock(),e.createElementBlock("p",dl,[e.createElementVNode("span",ul,e.toDisplayString(c.item[n.value]||c.ua||c.label),1),a.value?(e.openBlock(),e.createElementBlock("span",pl,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),l.value?(e.openBlock(),e.createElementBlock("p",{key:1,class:"text-xs text-slate-500 dark:text-slate-400",innerHTML:l.value},null,8,fl)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["w-full",["select","native-select"].includes(c.item.type)?"md:w-[30%]":"md:w-auto"])},[e.renderSlot(c.$slots,"default",e.normalizeProps(e.guardReactiveProps(c.$attrs)))],2)],2),o.value?(e.openBlock(),e.createElementBlock("p",ml,e.toDisplayString(o.value),1)):e.createCommentVNode("",!0)],2))}})};function Le(r){return{inputClass:e.computed(()=>{const n=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${r?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return r?.size==="sm"?`${n}h-[32px]`:`${n}h-[38px]`})}}const gl=["placeholder","disabled"],yl=e.defineComponent({__name:"vs-input-password",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Le(t.style),l=e.useModel(r,"modelValue"),a=e.computed(()=>!!t.disabled),o=e.computed(()=>t.placeholder??"");return(s,c)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"password","onUpdate:modelValue":c[0]||(c[0]=i=>l.value=i),placeholder:o.value,disabled:a.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":s.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,gl)),[[e.vModelText,l.value]])}}),bl=["placeholder","disabled","maxlength","minlength"],yt=e.defineComponent({__name:"vs-input-text",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Le(t.style),l=e.useModel(r,"modelValue"),a=e.computed(()=>!!t.disabled),o=e.computed(()=>t.placeholder??""),s=e.computed(()=>t.maxlength??void 0),c=e.computed(()=>t.minlength??void 0);function i(){typeof l.value=="string"&&(l.value=l.value.trim())}return(d,u)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"text","onUpdate:modelValue":u[0]||(u[0]=p=>l.value=p),placeholder:o.value,disabled:a.value,maxlength:s.value,minlength:c.value,onBlur:i,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[d.customClass,e.unref(n),{"!border-red-600":d.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,bl)),[[e.vModelText,l.value]])}}),kl=["placeholder","disabled","min","max"],Rn=e.defineComponent({__name:"vs-input-number",props:e.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Le(t.style),l=e.useModel(r,"modelValue"),a=e.computed(()=>!!t.disabled);return(o,s)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":s[0]||(s[0]=c=>l.value=c),placeholder:o.placeholder,disabled:a.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"},min:o.min,max:o.max},null,10,kl)),[[e.vModelText,l.value]])}}),xl={class:"flex items-center gap-[4px]"},wl=["value","id","disabled"],_l=["for"],vl={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},Cl=e.defineComponent({__name:"vs-checkbox-default",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},id:{},modelValue:{default:""},info:{},error:{}},emits:["update:modelValue"],setup(r,{emit:t}){const n=t,l=r,a=e.computed({get:()=>l.modelValue,set:s=>n("update:modelValue",s)}),o=e.computed(()=>!!l.disabled);return(s,c)=>(e.openBlock(),e.createElementBlock("div",xl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:s.value,"onUpdate:modelValue":c[0]||(c[0]=i=>a.value=i),class:e.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":o.value}]),id:s.id,disabled:o.value},null,10,wl),[[e.vModelCheckbox,a.value]]),e.createElementVNode("label",{for:s.id,class:e.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":o.value}])},[e.createElementVNode("div",{class:e.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[a.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",s.error?"border-red-600":""]])},[e.createVNode(e.unref(R.Check),{class:"h-4 w-4"})],2),e.createElementVNode("span",vl,[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(s.label),1)])])],10,_l)]))}}),El=["name","value","disabled"],Bl={class:"flex items-center gap-[6px] text-[14px]"},Vl={key:0,class:"text-[16px]"},Sl=["src"],$l=e.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{default:""},modelValue:{default:""},disabled:{type:Boolean},id:{},icon:{},imgUrl:{},style:{}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r,l=t,a=e.computed({get:()=>n.modelValue,set:c=>{l("update:modelValue",c)}}),o=e.computed(()=>Array.isArray(a.value)?a.value.includes(n.value):a.value===!0||a.value===n.value),s=e.computed(()=>n.style?.size==="xs"?"p-1.5 text-xs":n.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(c,i)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[s.value,o.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"hidden",name:c.id,value:c.value,"onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),disabled:c.disabled},null,8,El),[[e.vModelCheckbox,a.value]]),e.createElementVNode("span",Bl,[c.icon||c.imgUrl?(e.openBlock(),e.createElementBlock("span",Vl,[c.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(c.icon)},null,2)):e.createCommentVNode("",!0),c.imgUrl?(e.openBlock(),e.createElementBlock("img",{key:1,src:c.imgUrl,width:"16",height:"16",alt:"icon"},null,8,Sl)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(c.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(c.label),1)])])],2))}}),Al={class:"flex items-center"},sn=e.defineComponent({__name:"vs-input-checkbox-item",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},view:{default:"default"},modelValue:{type:[Boolean,Array],default:!1},icon:{},imgUrl:{},slots:{},option:{},style:{},error:{default:""}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r,l=t,a=`radio-${Math.floor(Math.random()*1e4)}`,o=e.computed({get:()=>Array.isArray(n.modelValue)?Array.isArray(n.modelValue)&&n.modelValue.includes(n.value):n.modelValue,set:c=>{if(Array.isArray(n.modelValue)){let i=[...n.modelValue];c?i.includes(n.value)||i.push(n.value):i=i.filter(d=>d!==n.value),l("update:modelValue",i)}else l("update:modelValue",c)}}),s=e.ref(`vs-checkbox-${n.view||"default"}`);return(c,i)=>(e.openBlock(),e.createElementBlock("div",Al,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value==="vs-checkbox-buttons"?e.unref($l):e.unref(Cl)),{value:c.value,label:c.label,info:c.option?.info,disabled:c.disabled,modelValue:o.value,"onUpdate:modelValue":i[0]||(i[0]=d=>o.value=d),id:a,icon:c.icon,imgUrl:c.imgUrl,style:e.normalizeStyle(c.style),error:c.error},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),Fl={key:0,class:"flex items-start gap-x-1"},Nl={key:0,class:"text-red-500 text-[14px]"},Dl=["title"],Ml=["disabled"],cn=e.defineComponent({__name:"vs-input-switcher",props:e.mergeModels({rules:{default:()=>[]},view:{default:"checkbox"},label:{default:""},i:{default:""},text:{default:""},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue");return(l,a)=>t.view==="checkbox"?(e.openBlock(),e.createElementBlock("div",Fl,[e.createVNode(sn,{modelValue:n.value,"onUpdate:modelValue":a[0]||(a[0]=o=>n.value=o),label:l.text,error:l.error||""},null,8,["modelValue","label","error"]),l.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",Nl,"*")):e.createCommentVNode("",!0),l.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:l.i,onClick:a[1]||(a[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(R.Info),{class:"h-4 w-4 text-gray-500"})],8,Dl)):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.normalizeClass(["inline-flex h-5 w-9 shrink-0 px-[2px] cursor-pointer items-center rounded-full shadow-sm disabled:cursor-not-allowed disabled:opacity-50",[n.value?`bg-${l.style?.primaryColor||"blue"}-500`:"bg-stone-200",l.customClass]]),disabled:l.disabled,onClick:a[2]||(a[2]=o=>n.value=!n.value)},[e.createElementVNode("span",{"data-state":"checked",class:e.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[n.value?"translate-x-4":"translate-x-0"]])},null,2)],10,Ml))}}),Tl=["id","innerHTML"],dn=e.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},setup(r){return(t,n)=>(e.openBlock(),e.createElementBlock("div",{id:t.name,class:e.normalizeClass(["text-gray-900",t.customClass]),innerHTML:t.html?t.html:t.text},null,10,Tl))}}),Ll=["placeholder","disabled","name"],un=e.defineComponent({__name:"vs-input-mask",props:e.mergeModels({name:{},mask:{default:""},unmask:{type:Boolean,default:!1},placeholder:{default:"_"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Le(t.style),l=e.useModel(r,"modelValue"),a=e.ref(null);let o=null;function s(c){const i={9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},d=new Set;let u=!1;for(let g=0;g<c.length;g+=1){const f=c[g];f==="{"?u=!0:f==="}"?u=!1:u&&d.add(f)}const p={};return Object.keys(i).forEach(g=>{d.has(g)||(p[g]=i[g])}),{mask:c,definitions:p,lazy:!1}}return e.onMounted(async()=>{if(a.value){const{default:c}=await Promise.resolve().then(()=>Nn),i=s(t.mask||"");o=c(a.value,i),o.on("accept",()=>{l.value=t.unmask?o.unmaskedValue:o.value}),o.on("complete",()=>{l.value=t.unmask?o.unmaskedValue:o.value}),o.value=l.value!=null?String(l.value):""}}),e.onBeforeUnmount(()=>{o?.destroy()}),e.watch(()=>t.mask,c=>{if(o){const i=s(c||"");o.updateOptions(i)}}),e.watch(l,c=>{o&&o.unmaskedValue!==c&&(o.value=c!=null?String(c):"")}),(c,i)=>(e.openBlock(),e.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:a,placeholder:c.placeholder,disabled:c.disabled,name:c.name,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,10,Ll))}}),Il={class:"relative w-full bg-white rounded-lg"},Ol={class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},zl=["placeholder","disabled"],pn=e.defineComponent({__name:"vs-input-email",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Le(t.style),l=e.useModel(r,"modelValue");return(a,o)=>(e.openBlock(),e.createElementBlock("div",Il,[e.createElementVNode("div",Ol,[e.createVNode(e.unref(R.Mail),{class:"h-4 w-4 stroke-gray-500 transition-all"})]),e.withDirectives(e.createElementVNode("input",{type:"email","onUpdate:modelValue":o[0]||(o[0]=s=>l.value=s),placeholder:a.placeholder,disabled:a.disabled,class:e.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":a.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,zl),[[e.vModelText,l.value]])]))}}),Rl={class:"relative w-full bg-white rounded-lg"},Pl={class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},jl=["value","placeholder","disabled"],fn=e.defineComponent({__name:"vs-input-tel",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Le(t.style),l=e.useModel(r,"modelValue"),a=e.computed(()=>l.value?l.value.startsWith("+")?l.value.slice(1):l.value:""),o=c=>{let{value:i}=c.target;i=i.replace(/^\+/,""),l.value=i?`+${i}`:""},s=c=>{const i=c,{data:d,inputType:u}=i;u&&u.startsWith("delete")||d&&/\D/.test(d)&&i.preventDefault()};return e.watch(()=>l.value,c=>{c&&!c.startsWith("+")?l.value=`+${c.replace(/^\+/,"")}`:c||(l.value="")},{immediate:!0}),(c,i)=>(e.openBlock(),e.createElementBlock("div",Rl,[e.createElementVNode("div",Pl,[e.createVNode(e.unref(R.Phone),{class:"h-4 w-4 stroke-gray-500 transition-all"})]),i[0]||(i[0]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[30px] text-gray-500 select-none pointer-events-none"}," + ",-1)),e.createElementVNode("input",{type:"tel",value:a.value,onInput:o,onBeforeinput:s,pattern:"^\\+[1-9]\\d{1,14}$",maxlength:"15",placeholder:c.placeholder,disabled:c.disabled,class:e.normalizeClass(["!pl-10 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":c.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,jl)]))}}),Ul=["value","disabled"],Hl={class:"text-[13px] text-gray-700"},ql=e.defineComponent({__name:"vs-input-radio-default",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),l=e.computed(()=>!!t.disabled);return(a,o)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center gap-0",[t.customClass,l.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":o[0]||(o[0]=s=>n.value=s),type:"radio",value:t.value,disabled:l.value,class:"hidden"},null,8,Ul),[[e.vModelRadio,n.value]]),e.createElementVNode("span",{class:e.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${t.style?.primaryColor||"blue"}-500`,l.value?"opacity-50 cursor-not-allowed":""]])},[n.value==t.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${t.style?.primaryColor||"blue"}-500`]])},null,2)):e.createCommentVNode("",!0)],2),e.createElementVNode("span",Hl,e.toDisplayString(t.text),1)],2))}}),Kl=["value","disabled"],Gl={class:"text-[13px] text-gray-700"},Wl={"vs-input-radio-default":ql,"vs-input-radio-buttons":e.defineComponent({__name:"vs-input-radio-buttons",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),l=e.computed(()=>!!t.disabled);return(a,o)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[n.value==t.value?`ring-2 ring-ring ring-${t.style?.primaryColor||"blue"}-500`:"",t.customClass,l.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":o[0]||(o[0]=s=>n.value=s),type:"radio",value:t.value,disabled:l.value,class:"hidden"},null,8,Kl),[[e.vModelRadio,n.value]]),e.createElementVNode("span",Gl,e.toDisplayString(t.text),1)],2))}})},mn=e.defineComponent({__name:"vs-input-radio",props:e.mergeModels({options:{},position:{default:"vertical"},view:{default:"default"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),l=e.computed(()=>Wl[`vs-input-radio-${t.view}`]);return(a,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([a.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.options,s=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.value),e.mergeProps({key:s?.id,text:s.text,value:s.id.toString(),checked:n.value===s.id,modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=c=>n.value=c)},{ref_for:!0},a.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),Yl={key:1,class:"w-full flex flex-col gap-4"},Zl={key:0,class:"text-sm font-medium text-muted-foreground my-2"},Xl="Без категорії",Jl=e.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},group:{default:void 0},values:{default:()=>[]},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r,l=t,a=e.ref([]),o=e.reactive({}),s=f=>f?.value||f?.id||f?.text||f,c=f=>f.text||String(f),i=f=>`lg:col-span-${f||12}`,d=e.computed(()=>[n.position==="vertical"?"flex flex-col":"",n.colSpan?"grid":"flex justify-start"]),u=f=>f==null||f===""?null:typeof f=="string"||typeof f=="number"?f:String(f),p=e.computed(()=>{if(!n.group)return[];const f=new Map;a.value.forEach(w=>{const k=w[n.group],x=u(k);f.has(x)||f.set(x,[]),f.get(x)?.push(w)});const y=[];n.values?.length&&n.values.forEach(w=>{const k=u(w);y.push(k)});const h=new Set,b=w=>{const k=f.get(w)||[];if(!k.length)return null;const x=w===null?"group-null":`group-${String(w)}`,S=w===null?Xl:String(w);return h.add(w),{key:x,label:S,options:k}},C=[];return y.forEach(w=>{const k=b(w);k&&C.push(k)}),f.forEach((w,k)=>{if(h.has(k))return;const x=b(k);x&&C.push(x)}),C}),g=async()=>{try{const f=await fetch(`/api/suggest/${n.data}`).then(y=>y.json());a.value=f?.data||f}catch(f){console.error(f)}};return e.watch(()=>n.modelValue,f=>{if(typeof f=="boolean"&&a.value.length===1){const y=s(a.value[0]);o[y]=f}else if(Array.isArray(f)){const y=new Set(f);a.value.forEach(h=>{if(!h.disabled){const b=s(h);o[b]=y.has(b)}})}},{immediate:!0}),e.watch(o,()=>{if(!a.value.length){l("update:modelValue",null);return}const f=Object.entries(o).filter(([,y])=>y).map(([y])=>y);l("update:modelValue",f.length===0?[]:f)},{deep:!0}),e.onMounted(()=>{if(n.data)g().then(()=>{if(typeof n.modelValue=="boolean"&&a.value.length===1){const f=s(a.value[0]);o[f]=n.modelValue}else if(Array.isArray(n.modelValue)){const f=new Set(n.modelValue);a.value.forEach(y=>{if(!y.disabled){const h=s(y);o[h]=f.has(h)}})}});else if(a.value=n.options,typeof n.modelValue=="boolean"&&a.value.length===1){const f=s(a.value[0]);o[f]=n.modelValue}else if(Array.isArray(n.modelValue)){const f=new Set(n.modelValue);a.value.forEach(y=>{if(!y.disabled){const h=s(y);o[h]=f.has(h)}})}}),(f,y)=>n.group?(e.openBlock(),e.createElementBlock("div",Yl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,h=>(e.openBlock(),e.createElementBlock("div",{key:h.key,class:"flex flex-col gap-2"},[h.label?(e.openBlock(),e.createElementBlock("span",Zl,e.toDisplayString(h.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["p-0 w-full gap-[12px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.options,b=>(e.openBlock(),e.createBlock(sn,{modelValue:o[s(b)],"onUpdate:modelValue":C=>o[s(b)]=C,value:s(b),class:e.normalizeClass(i(f.colSpan)),disabled:n.disabled||b.disabled,label:c(b),key:`${h.key}-${s(b)}`,icon:b?.icon,imgUrl:b?.imgUrl,option:b,view:f.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["p-0 w-full gap-[10px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,h=>(e.openBlock(),e.createBlock(sn,{modelValue:o[s(h)],"onUpdate:modelValue":b=>o[s(h)]=b,value:s(h),class:e.normalizeClass(i(f.colSpan)),disabled:n.disabled||h.disabled,label:c(h),key:s(h),icon:h?.icon,imgUrl:h?.imgUrl,option:h,view:f.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),pe=(r,t)=>{const n=r.__vccOpts||r;for(const[l,a]of t)n[l]=a;return n},Pn=pe(Jl,[["__scopeId","data-v-8e66207e"]]),Ql=["type","placeholder","disabled"],ea=e.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},mode:{default:"date"}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r;function l(u){return u?n.mode==="datetime"?(u.includes("T")?u:null)||u+(u.includes(" ")?"":"T00:00"):u?.split(" ")[0]:null}const{inputClass:a}=Le(n.style),o=t,s=e.computed({get:()=>l(n.modelValue),set:u=>o("update:modelValue",u)}),c=e.computed(()=>n.mode==="datetime"?"datetime-local":n.mode),i=e.computed(()=>!!n.disabled),d=e.computed(()=>n.placeholder??"");return(u,p)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:c.value,"onUpdate:modelValue":p[0]||(p[0]=g=>s.value=g),placeholder:d.value,disabled:i.value,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[u.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Ql)),[[e.vModelDynamic,s.value]])}}),ta=(r,t)=>{if(!t||!Object.keys(t).length)return r;const[n,l=""]=r.split("?"),a=new URLSearchParams(l);Object.entries(t).forEach(([s,c])=>{c==null||c===""||a.set(s,String(c))});const o=a.toString();return o?`${n}?${o}`:n},jn=async(r,t={})=>{try{const n=new FormData;n.append("unique","true"),n.append("file",r);const{api:l,id:a="1",form:o="form",table:s="table",customParams:c}=t,i=l||`/file/upload/uploads?id=${a||""}&form=${o||""}&table=${s||""}`,d=ta(i,c);return(await fetch(d,{method:"POST",body:n}).then(p=>p.json()))?.result}catch(n){return ge.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",n),null}},na=async r=>{try{return await fetch(`file/delete${r}`),!0}catch(t){return console.error(t),!1}},Un=async r=>{try{const t=await fetch(`/file/download/files/uploads${r}`),n=await t.arrayBuffer(),l=t.headers["content-type"],a=new TextDecoder("utf-8").decode(n),o=new Blob([a],{type:l}),s=document.createElement("a");s.setAttribute("download",r),s.href=window.URL.createObjectURL(o),s.click()}catch(t){console.error(t.message)}},ra=r=>{if(!r)return"";const t=r?.split(".");return t[t.length-1]},la=r=>{const t=ra(r),n={imageFormat:["tiff","jpg","jpeg","png","svg","ico","webp"],sheetsFormat:["xls","csv","xlsx"],archivesFormat:["zip","rar"],textsFormat:["json","geojson","txt","yml","yaml","shp"],documentsFormat:["pdf"]};return n.imageFormat.includes(t)?"img":n.sheetsFormat.includes(t)?R.Table:n.textsFormat.includes(t)?R.FileCode:n.documentsFormat.includes(t)?R.FileText:n.archivesFormat.includes(t)?R.FileArchive:R.FileText},aa=["title"],oa={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},hn=pe(e.defineComponent({__name:"vs-input-file-list-item",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},api:{},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(r){const t=e.useModel(r,"value"),n=e.useModel(r,"item"),l=r;return(a,o)=>(e.openBlock(),e.createElementBlock("div",{title:n.value,class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(la)(n.value)),{src:n.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:o[0]||(o[0]=s=>e.unref(Un)(n.value))},null,8,["src"])),e.createElementVNode("div",oa,[e.createElementVNode("button",{type:"button",onClick:o[1]||(o[1]=s=>{e.unref(na)(n.value),t.value=l.multiple?t.value?.filter(c=>c!==n.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[e.createVNode(e.unref(R.Trash2),{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:o[2]||(o[2]=s=>e.unref(Un)(n.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[e.createVNode(e.unref(R.Download),{class:"w-4 h-4"})])])],8,aa))}}),[["__scopeId","data-v-dc557562"]]),sa={class:"flex items-center gap-x-2"},ia=["accept","multiple","disabled"],ca={key:1,class:"flex items-center flex-wrap gap-2"},da={key:1,class:"loader"},ua={key:1,class:"loader"},Hn=pe(e.defineComponent({__name:"vs-input-file",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},api:{},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["change"],["update:modelValue"]),setup(r,{emit:t}){const n=r,l=e.useModel(r,"modelValue"),a=t,o=e.ref(null),s=e.ref(!1),c=e.inject("values"),i=e.computed(()=>n.format?n.format.split(",").map(w=>w.trim().toLowerCase()).filter(Boolean):[]),d=w=>Array.isArray(l.value)&&l.value[w]||"",u=w=>{if(n.max_size&&w.size>n.max_size*1024*1024){const k=(w.size/1048576).toFixed(2);return ge.notify({type:"error",title:"Помилка!",message:`Файл "${w.name}" занадто великий. Максимальний розмір: ${n.max_size} МБ, розмір файлу: ${k} МБ`,position:"right-bottom"}),!1}return!0},p=w=>{if(!i.value.length)return!0;const k=`.${w.name.split(".").pop()?.toLowerCase()||""}`,x=i.value.includes(k);return x||ge.notify({type:"error",title:"Помилка!",message:`Неприпустимий формат файлу "${w.name}". Дозволені формати: ${i.value.join(", ")}`,position:"right-bottom"}),x},g=e.computed(()=>{const w={},k=[];if(!n.customParams?.length)return{params:w,missingSources:k};const x=c?.value??{};return n.customParams.forEach(S=>{if(!S)return;const[L,$]=S.split("="),v=L?.trim(),A=$?.trim();if(!v||!A)return;const E=x[A];if(E==null||E===""){k.push(A);return}w[v]=E}),{params:w,missingSources:k}}),f=()=>{const{params:w}=g.value;return{api:n.api,customParams:Object.keys(w).length?w:void 0}},y=()=>{const w=g.value.missingSources;if(!w.length)return!0;const k=w.join(", ");return ge.notify({type:"warning",title:"Заповніть поля",message:`Поля (${k}) необхідні для завантаження файлу`,position:"right-bottom"}),!1},h=w=>{ge.notify({type:"error",title:"Помилка завантаження",message:w||"Не вдалося завантажити файл. Спробуйте ще раз.",position:"right-bottom"})},b=()=>{n.disabled||s.value||y()&&o.value?.click()},C=async w=>{const{files:k}=w.target;if(!k||k.length===0)return;if(!y()){o.value&&(o.value.value="");return}const x=Array.from(k);if(n.max_size&&x.filter($=>!u($)).length>0){o.value&&(o.value.value="");return}if(x.filter(L=>!p(L)).length>0){o.value&&(o.value.value="");return}s.value=!0;try{if(n.multiple){const L=Array.from(k).map(async E=>await jn(E,f())),$=await Promise.all(L),A=$.filter(E=>E!==null).map(E=>E?.file_path).filter(Boolean);if(A.length===0){h();return}A.length<$.length&&h("Деякі файли не вдалося завантажити. Перевірте їх та спробуйте знову."),l.value=[...l.value||[],...A],a("change",l.value)}else{const L=k[0],$=await jn(L,f());if(!$?.file_path){h();return}l.value=$?.file_path,a("change",l.value||"")}}catch(L){const $=L?.message||void 0;h($)}finally{s.value=!1,o.value&&(o.value.value="")}};return(w,k)=>(e.openBlock(),e.createElementBlock("div",sa,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:o,type:"file",accept:n.format,multiple:w.multiple,onChange:C,disabled:s.value||w.disabled},null,40,ia),!w.multiple&&l.value?(e.openBlock(),e.createBlock(hn,{key:0,item:l.value,"onUpdate:item":k[0]||(k[0]=x=>l.value=x),value:l.value,"onUpdate:value":k[1]||(k[1]=x=>l.value=x)},null,8,["item","value"])):w.multiple?(e.openBlock(),e.createElementBlock("div",ca,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(x,S)=>(e.openBlock(),e.createBlock(hn,{multiple:w.multiple,key:S,value:l.value,"onUpdate:value":k[2]||(k[2]=L=>l.value=L),item:d(S)},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:b,class:e.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",w.disabled||s.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[s.value?(e.openBlock(),e.createElementBlock("div",da)):(e.openBlock(),e.createBlock(e.unref(R.Plus),{key:0,class:"h-4 w-4"}))],2)])):e.createCommentVNode("",!0),w.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:b,class:e.normalizeClass([w.disabled||s.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center cursor-pointer hover:border-blue-500 transition-all duration-300 hover:bg-blue-50"])},[s.value?(e.openBlock(),e.createElementBlock("div",ua)):(e.openBlock(),e.createBlock(e.unref(R.Plus),{key:0,class:"h-4 w-4"}))],2))]))}}),[["__scopeId","data-v-63366cf6"]]),pa={class:"vs-input-file2 flex flex-col gap-4"},fa={class:"flex items-center gap-x-2"},ma=["accept","disabled"],ha={key:0,class:"absolute inset-0 flex flex-col items-center justify-center gap-1 rounded-lg bg-white/90 text-xs font-medium text-slate-600"},ga={key:0,class:"rounded-lg border border-[#CFD9E0] bg-white p-4 shadow-sm"},ya={class:"flex items-center justify-between text-sm"},ba={class:"truncate pr-4"},ka={class:"font-medium text-slate-800 truncate"},xa={class:"text-slate-500"},wa={class:"text-slate-500 whitespace-nowrap"},_a={class:"mt-3 h-2 rounded-full bg-slate-100 overflow-hidden"},va={class:"mt-3 flex flex-wrap gap-2 text-sm"},Ca={key:0,class:"mt-2 text-sm text-rose-600"},Ea=e.defineComponent({__name:"vs-input-file2",props:e.mergeModels({format:{},max_size:{},api:{},chunkSize:{default:5*1024*1024},subdir:{default:""},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),l=e.ref(null),a=e.ref(null),o=e.ref(""),s=e.ref(0),c=e.ref(!1),i=e.ref(""),d=e.ref(null),u=e.inject("values"),p=e.computed(()=>t.format?t.format.split(",").map(B=>B.trim().toLowerCase()).filter(Boolean):[]),g=e.computed(()=>!a.value||!a.value.size?0:Math.min(100,Math.round(s.value/a.value.size*100))),f=e.computed(()=>a.value?`${b(s.value)} / ${b(a.value.size)}`:""),y=e.computed(()=>t.disabled?"opacity-50 cursor-not-allowed":c.value?"cursor-default text-blue-500":"cursor-pointer hover:border-blue-500 hover:bg-blue-50 hover:text-blue-500"),h=()=>{t.disabled||c.value||x()&&l.value?.click()},b=B=>{if(!Number.isFinite(B))return"0 B";const M=["B","KB","MB","GB"];let N=0,F=B;for(;F>=1024&&N<M.length-1;)F/=1024,N+=1;return`${F.toFixed(N===0?0:1)} ${M[N]}`},C=B=>{if(!t.max_size)return!0;const M=t.max_size*1024*1024;return B.size>M?(ge.notify({type:"error",title:"Файл занадто великий",message:`Максимальний розмір ${t.max_size} МБ`,position:"right-bottom"}),!1):!0},w=B=>{if(!p.value.length)return!0;const M=`.${B.name.split(".").pop()?.toLowerCase()||""}`;return p.value.includes(M)?!0:(ge.notify({type:"error",title:"Непідтримуваний формат",message:`Дозволені формати: ${p.value.join(", ")}`,position:"right-bottom"}),!1)},k=e.computed(()=>{const B={},M=[];if(!t.customParams?.length)return{params:B,missing:M};const N=u?.value??{};return t.customParams.forEach(F=>{if(!F)return;const[T,U]=F.split("="),j=T?.trim(),Y=U?.trim();if(!j||!Y)return;const ee=N[Y];ee==null||ee===""?M.push(Y):B[j]=ee}),{params:B,missing:M}}),x=()=>k.value.missing.length?(ge.notify({type:"warning",title:"Заповніть поля",message:`Потрібні значення: ${k.value.missing.join(", ")}`,position:"right-bottom"}),!1):!0,S=B=>{const M=B.target,N=M.files?.[0];if(N){if(!x()){M.value="";return}if(!C(N)||!w(N)){M.value="";return}a.value=N,s.value=0,o.value="",i.value=""}},L=async()=>{if(!a.value){h();return}try{i.value="";const B={id:o.value||"",fileName:a.value.name,subdir:t.subdir,size:a.value.size,...k.value.params},M=await fetch("/api/file/upload2/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(B)});if(!M.ok)throw new Error("Не вдалося ініціалізувати завантаження");const N=await M.json();o.value=N.id||o.value,s.value=N.uploaded||0,await $()}catch(B){i.value=B?.message||"Помилка при старті завантаження"}},$=async()=>{if(!(!a.value||!o.value)){c.value=!0;try{for(;s.value<a.value.size;){const B=s.value,M=Math.min(B+t.chunkSize,a.value.size),N=a.value.slice(B,M);d.value=new AbortController;const F=await fetch(`/api/file/upload2/${o.value}`,{method:"PATCH",headers:{"Content-Range":`bytes ${B}-${M-1}/${a.value.size}`},body:N,signal:d.value.signal});if(!F.ok)throw new Error("Помилка завантаження частини");const T=await F.json().catch(()=>({}));if(T.uploaded!=null?s.value=Number(T.uploaded):s.value=M,T.finished||s.value>=a.value.size){c.value=!1,n.value=T.file_path||T.url||o.value,ge.notify({type:"success",title:"Файл завантажено",message:a.value.name,position:"right-bottom"}),V();return}}}catch(B){if(B?.name==="AbortError")return;i.value=B?.message||"Помилка при завантаженні",c.value=!1}finally{d.value=null,c.value=!1}}},v=()=>{c.value&&(d.value?.abort(),d.value=null,c.value=!1)},A=async()=>{if(a.value){if(!o.value){await L();return}await $()}},E=()=>{d.value?.abort(),d.value=null,V()},V=()=>{const B=l.value;B&&(B.value=""),a.value=null,o.value="",s.value=0,i.value=""};return(B,M)=>(e.openBlock(),e.createElementBlock("div",pa,[e.createElementVNode("div",fa,[e.createElementVNode("input",{ref_key:"fileInput",ref:l,type:"file",class:"hidden",accept:t.format,disabled:c.value||t.disabled,onChange:S},null,40,ma),n.value?(e.openBlock(),e.createBlock(hn,{key:0,item:n.value,"onUpdate:item":M[0]||(M[0]=N=>n.value=N),value:n.value,"onUpdate:value":M[1]||(M[1]=N=>n.value=N)},null,8,["item","value"])):(e.openBlock(),e.createElementBlock("div",{key:1,onClick:h,class:e.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",y.value])},[c.value?(e.openBlock(),e.createElementBlock("div",ha,[M[2]||(M[2]=e.createElementVNode("div",{class:"loader"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(g.value)+"%",1)])):(e.openBlock(),e.createBlock(e.unref(R.Plus),{key:1,class:"h-4 w-4"}))],2))]),a.value&&!n.value?(e.openBlock(),e.createElementBlock("div",ga,[e.createElementVNode("div",ya,[e.createElementVNode("div",ba,[e.createElementVNode("div",ka,e.toDisplayString(a.value.name),1),e.createElementVNode("div",xa,e.toDisplayString(b(a.value.size)),1)]),e.createElementVNode("div",wa,e.toDisplayString(f.value),1)]),e.createElementVNode("div",_a,[e.createElementVNode("div",{class:"h-full rounded-full bg-blue-500 transition-all duration-300",style:e.normalizeStyle({width:`${g.value}%`})},null,4)]),e.createElementVNode("div",va,[!c.value&&s.value>0&&s.value<(a.value?.size||0)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:A}," Resume ")):e.createCommentVNode("",!0),c.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:v}," Pause ")):e.createCommentVNode("",!0),!c.value&&s.value===0?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:L}," Upload ")):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"rounded border border-rose-200 px-3 py-1 text-rose-600",onClick:E}," Cancel ")]),i.value?(e.openBlock(),e.createElementBlock("p",Ca,e.toDisplayString(i.value),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),gn=pe(Ea,[["__scopeId","data-v-a2e59d0a"]]),Ba={class:"flex items-center justify-center h-[30px] w-[30px]"},Va={class:"max-w-[55vw]"},Sa={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},$a={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},Aa={class:"px-[5px]"},Fa={class:""},Ot=e.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(r){const t=r,n=e.computed(()=>{try{return new Date(t.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function l(a){if(a<1024)return`${a} B`;const o=a/1024;return o<1024?`${o.toFixed(2)} KB`:`${(o/1024).toFixed(2)} MB`}return(a,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",Ba,[e.createVNode(e.unref(R.FileText),{class:"icon icon-tabler icons-tabler-outline icon-tabler-file h-4 w-4"})]),e.createElementVNode("div",Va,[e.createElementVNode("p",Sa,e.toDisplayString(a.item?.uploaded_name),1),e.createElementVNode("p",$a,[e.createElementVNode("span",null,e.toDisplayString(a.item?.username),1),e.withDirectives(e.createElementVNode("span",Aa,"|",512),[[e.vShow,a.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(n.value),1),o[0]||(o[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",Fa,e.toDisplayString(l(a.item?.size)),1)])])],64))}}),Na={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},Da={key:0,class:"flex w-full gap-x-3 items-center"},Ma={key:1,class:"flex gap-x-3 w-full items-center"},Ta={key:2,class:"flex gap-x-3 w-full items-center"},La=["href"],Ia={key:3,class:"flex gap-x-3 w-full items-center"},Oa={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},za={class:"p-0.5 sm:p-1 inline-flex items-center gap-0.5 bg-white rounded-lg dark:bg-neutral-800 dark:border-neutral-700"},Ra={class:"inline-block"},Pa={class:"inline-block"},ja=e.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(r,{emit:t}){const n=r,l=t;function a(u){return["pdf","json"].includes(u.ext)}function o(u){return["ppt","pptx","doc","docx","xls","xlsx"].includes(u.ext)}function s(u){const p=document.createElement("a");p.setAttribute("download",u?.uploaded_name),p.href=u?.file_path,p.click()}async function c(){try{await fetch(`${n.prefix}/widget/file/${n.item.entity_id}/${n.item.file_id}`),l("update")}catch(u){console.error(u)}}function i(){l("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:c,updateListOnConfirm:!0})}function d(u){(n.item.ext==="jpg"||n.item.ext==="png")&&l("openLightbox",{item:n.item,index:u})}return(u,p)=>(e.openBlock(),e.createElementBlock("div",Na,[u.item.ext==="jpg"||u.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",Da,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:p[0]||(p[0]=g=>d(u.index))},[e.createVNode(Ot,{item:u.item},null,8,["item"])])])):a(u.item)?(e.openBlock(),e.createElementBlock("div",Ma,[e.createVNode(Ot,{item:u.item},null,8,["item"])])):o(u.item)?(e.openBlock(),e.createElementBlock("div",Ta,[e.createElementVNode("a",{href:`/api/file-preview?id=${u.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(Ot,{item:u.item},null,8,["item"])],8,La)])):(e.openBlock(),e.createElementBlock("div",Ia,[e.createVNode(Ot,{item:u.item},null,8,["item"])])),e.createElementVNode("div",Oa,[e.createElementVNode("div",za,[e.createElementVNode("div",Ra,[e.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:p[1]||(p[1]=g=>s(u.item))},[e.createVNode(e.unref(R.Download),{class:"h-4 w-4"})])]),p[3]||(p[3]=e.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),e.createElementVNode("div",Pa,[e.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:p[2]||(p[2]=g=>i())},[e.createVNode(e.unref(R.Trash2),{class:"h-4 w-4"})])])])])]))}}),Ua={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},Ha={class:"flex w-full mb-[12px] items-center gap-x-2"},qa={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},Ka={class1:"ml-auto"},Ga={class:"py-1.5 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg bg-gray-100 cursor-pointer hover:bg-gray-200 text-gray-800 shadow-2xs hover:bg-gray-50 focus:outline-hidden focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},Wa={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},Ya={class:"relative"},Za={class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},Xa={key:1,class:"space-y-3 max-h-[300px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},Ja={key:0},qn=e.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update"],setup(r,{emit:t}){const n=r,l=e.inject("form"),a=e.computed(()=>l.value.formId),o=e.ref(!1),s=e.ref(0),c=t,i=e.ref(!1),d=e.ref({}),u=e.ref([]),p=e.ref(""),g=e.computed(()=>Array.isArray(u.value)?u.value.filter(k=>k.ext==="jpg"||k.ext==="png").map(k=>k?.file_path):[]),f=e.computed(()=>p.value===""?u.value:u.value.filter(k=>k?.uploaded_name?.includes(p.value))),y=k=>{const x=g.value.findIndex(S=>S===k.item.file_path);x!==-1&&(o.value=!0,s.value=x)},h=async()=>{try{const k=await fetch(`${n.prefix}/widget/file/${a.value}`).then(x=>x.json());u.value=k?.rows}catch(k){console.error(k)}},b=async k=>{await Promise.all(Array.from(k.target.files).map(async x=>{const S=new FormData;S.append("file",x);try{const L=`${n.prefix}/widget/file/${a.value}`,$=await fetch(L,{method:"POST",body:S});return $.ok?(c("update","file-list"),x):(ge.notify({type:$.status>=400&&$.status<500?"warning":"error",title:"Error",message:`Error code: ${$.status}`}),null)}catch(L){return ge.notify({type:"error",title:"Error",message:L.message||"Unknown error"}),console.error(L),null}})),await h()},C=k=>{const x={...k};return k.cancel||(x.cancel=()=>{i.value=!1}),k.updateListOnConfirm&&(x.confirm=async()=>{await k.confirm(),i.value=!1,h()}),x},w=k=>{d.value=C(k),i.value=!0};return e.watch(a,k=>{k&&h()}),e.onMounted(()=>{a.value&&h()}),(k,x)=>{const S=e.resolveComponent("Lightbox"),L=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",Ua,[e.createElementVNode("div",Ha,[e.createElementVNode("h2",qa," Файлів: "+e.toDisplayString(u.value?.length),1),e.createElementVNode("div",Ka,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:x[0]||(x[0]=$=>b($))},null,32),e.createElementVNode("div",Ga,[e.createVNode(e.unref(R.Upload),{class:"h-4 w-4"})])])])]),u.value?.length>4?(e.openBlock(),e.createElementBlock("div",Wa,[e.createElementVNode("div",null,[e.createElementVNode("div",Ya,[e.createElementVNode("div",Za,[e.createVNode(e.unref(R.Search),{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400"})]),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":x[1]||(x[1]=$=>p.value=$),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[e.vModelText,p.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),u.value?.length?(e.openBlock(),e.createElementBlock("div",Xa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,($,v)=>(e.openBlock(),e.createBlock(ja,{key:v,prefix:k.prefix,item:$,index:v,onUpdate:x[2]||(x[2]=A=>k.$emit("update","file-list")),onOpenModal:x[3]||(x[3]=A=>w(A)),onOpenLightbox:x[4]||(x[4]=A=>y(A))},null,8,["prefix","item","index"]))),128)),f.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ja,x[8]||(x[8]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):e.createCommentVNode("",!0),e.createVNode(S,{modelValue:o.value,"onUpdate:modelValue":x[5]||(x[5]=$=>o.value=$),startIndex:s.value,"onUpdate:index":x[6]||(x[6]=$=>s.value=$),images:g.value},null,8,["modelValue","startIndex","images"]),e.createVNode(L,e.mergeProps({modelValue:i.value,"onUpdate:modelValue":x[7]||(x[7]=$=>i.value=$),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),Qa={class:"flex items-center justify-between"},eo={class:"text-[16px] text-gray-900 font-medium"},to={class:"grid gap-3"},no=pe(e.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(r){const t=r,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,l=>{n.value=l}),(l,a)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Qa,[e.createElementVNode("p",eo,e.toDisplayString(r.title),1),e.createVNode(cn,{modelValue:n.value,"onUpdate:modelValue":a[0]||(a[0]=o=>n.value=o),style:e.normalizeStyle(r.style)},null,8,["modelValue","style"])]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",to,[e.renderSlot(l.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),ro={class:"text-[16px] text-gray-900 font-medium"},lo={class:"grid gap-3"},ao=pe(e.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(r){const t=r,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,l=>{n.value=l}),(l,a)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("button",{type:"button",onClick:a[0]||(a[0]=o=>n.value=!n.value),class:"flex items-center gap-2"},[e.createVNode(e.unref(R.ChevronDown),{class:e.normalizeClass(["h-4 w-4 duration-300",[n.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",ro,e.toDisplayString(r.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",lo,[e.renderSlot(l.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-0c825d65"]]),oo={class:"flex items-center justify-between"},so={switcher:no,accordion:ao,default:e.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(r){return(t,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",oo,[e.createElementVNode("p",null,e.toDisplayString(r.title),1)]),e.renderSlot(t.$slots,"default")]))}})},Ye={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},io=(r,t)=>String(r)===String(t),co=(r,t)=>String(r)!==String(t),uo=(r,t)=>r>t,po=(r,t)=>r>=t,fo=(r,t)=>r<t,mo=(r,t)=>r<=t,ho=(r,t)=>Array.isArray(t)&&t.length===2?r>=t[0]&&r<=t[1]:!1,go=(r,t)=>String(r).startsWith(String(t)),yo=(r,t)=>String(r).endsWith(String(t)),bo=(r,t)=>String(r).includes(String(t)),ko=(r,t)=>Array.isArray(t)?t.includes(r):!1,xo=(r,t)=>Array.isArray(t)?!t.includes(r):!0,Kn=(r,t)=>{if(!t)return!0;switch(t?.[1]){case Ye.Equal:return io(r,t?.[2]);case Ye.Inequal:return co(r,t?.[2]);case Ye.Higer:return uo(r,t?.[2]);case Ye.HigerOrEqual:return po(r,t?.[2]);case Ye.Lower:return fo(r,t?.[2]);case Ye.LowerOrEqual:return mo(r,t?.[2]);case Ye.Between:return ho(r,t?.[2]);case Ye.StartWith:return go(r,t?.[2]);case Ye.EndWith:return yo(r,t?.[2]);case Ye.Contain:return bo(r,t?.[2]);case Ye.In:return ko(r,t?.[2]);case Ye.NotIn:return xo(r,t?.[2]);default:return!0}},Gn=e.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},name:{type:String,default:""},schema:{type:Array,default:()=>[]}},setup(r){const t=r,n=e.inject("values",e.ref({})),l=e.inject("form"),a=e.computed(()=>t.schema?.filter(c=>{const i=c?.conditions;if(!i)return!0;const d=Array.isArray(i)?i[0]:i,u=t.name?n.value?.[t.name]?.[d]??n.value?.[d]:n.value?.[d];return Kn(u,i)})),o=e.computed(()=>so[t.view]),s=e.computed(()=>{if(n.value||(n.value={}),!t.name)return n.value;const c=n.value[t.name];if(c)return c;const i={};return n.value={...n.value,[t.name]:i},i});return(c,i)=>r.schema?.length?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.value),{key:0,title:r.title,style:e.normalizeStyle(r.style)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,d=>(e.openBlock(),e.createBlock(cr,e.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:s.value[d.name],"onUpdate:modelValue":u=>s.value[d.name]=u,style:r.style,error:e.unref(l)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),wo=["aria-expanded","data-focus"],_o={class:"relative flex flex-1 items-center gap-1 py-0.5 pl-1 pr-0 overflow-hidden h-full min-w-0"},vo={key:0,class:"flex flex-nowrap items-center gap-1 overflow-x-auto overflow-y-hidden min-w-0 flex-1 py-0.5"},Co={class:"flex items-center gap-1 min-w-0"},Eo=["title"],Bo=["innerHTML"],Vo=["onClick"],So={class:"flex-1 min-w-[2px]"},$o=["placeholder"],Ao=["title"],Fo=["innerHTML"],No={key:3,class:"truncate flex-1 min-w-0"},Do={key:2,class:"flex-1 min-w-[2px]"},Mo=["placeholder"],To={class:"flex items-center shrink-0"},Lo=["disabled"],Io={key:1,class:"self-stretch w-px bg-[#ccc] my-[1px]"},Oo=["disabled","title"],zo=["aria-disabled","onClick"],Ro=["innerHTML"],Po={key:1,class:"px-3 py-2 text-center text-gray-500"},jo=["disabled"],yn="w-[16px] h-[16px] flex items-center justify-center flex-shrink-0 text-current",bn=pe(e.defineComponent({__name:"vs-input-select",props:{multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},mode:{},defaultValue:{},search:{type:Boolean,default:!0},placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{default:""},options:{default:()=>[]},api:{default:null},maxHeight:{default:400},parent:{},set:{},slot:{},add:{},teleport:{default:"body"},auto:{default:0},start:{default:0},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{},maxlength:{},minlength:{}},emits:["change","update:modelValue","value-selected"],setup(r,{emit:t}){const n=r,l=t,a=e.computed(()=>n.multiple),o=e.computed(()=>n.disabled);Le(n.style);const s=e.computed({get:()=>n.modelValue,set:I=>l("update:modelValue",I)});!s.value&&n.defaultValue&&(s.value=n.defaultValue);const c=e.ref(null),i=e.ref(null),d=e.ref(null),u=e.ref(null),p=e.ref(!1),g=e.ref(!1),f=e.ref(null),y=e.ref([]),h=e.ref(-1),b=e.ref([]),C=e.ref(""),w=e.ref(null),k=e.ref("bottom"),x=e.ref({}),S=e.ref([]),L=e.computed(()=>{if(!S.value.length)return[];const I=y.value,q=new Map(I.map(H=>[H.id?.toString(),H]));return S.value.map(H=>q.get(H?.toString())).filter(H=>!!H)}),$=e.computed(()=>n.placeholder||"Select..."),v=e.computed(()=>j(f.value));e.computed(()=>a.value?!S.value.length&&C.value==="":!v.value&&C.value==="");const A=e.computed(()=>o.value?!1:a.value?S.value.length>0:!!s.value),E=I=>a.value?S.value.some(q=>q?.toString()===I?.toString()):s.value?.toString()===I?.toString(),V=e.computed(()=>{let I=y.value??[];if(!n.data&&C.value.trim()!==""){const q=C.value.toLowerCase();I=I.filter(H=>{const le=j(H).toLowerCase(),ke=H.text?.toLowerCase?.()||"";return le.includes(q)||ke.includes(q)})}if(a.value&&S.value.length){const q=new Set(S.value.map(H=>H?.toString()));I=I.filter(H=>!q.has(H.id?.toString()))}return I}),B=e.inject("values"),M=e.inject("field-props"),N=/\{\{\s*([^}]+?)\s*\}\}/g,F=I=>(I?String(I):"").replace(/<[^>]*>/g,"").trim(),T=e.computed(()=>n.slot??n?.optionTemplate??""),U=I=>{if(!I)return"";const q=T.value;return q?q.replace(N,(H,le)=>{const ke=le.trim(),we=I[ke];return we!=null?String(we):""}):I.text??""},j=I=>{if(!I)return"";if(!T.value)return I.text??"";const H=U(I);return F(H)||I.text||""},Y=I=>I?I.icon??null:null,ee=I=>!!(I?.color&&!Y(I)),ve=I=>I?.color?{color:I.color}:void 0,ye=I=>!!Y(I),W=(I,q,H)=>{if(!M)return!1;const le=M.value?.[I]??{},ke=(_e,Ae,Re)=>{if(!Ae.length)return _e;const[We,...st]=Ae,Ze={..._e};if(!st.length)return Ze[We]=Re,Ze;const Lt=typeof _e[We]=="object"&&_e[We]!==null?_e[We]:{};return Ze[We]=ke(Lt,st,Re),Ze},we=ke(le,q,H);return M.value={...M.value||{},[I]:we},!0},ae=I=>{if(!n.set)return;const q=B?.value;!q&&!M||Object.entries(n.set).forEach(([H,le])=>{if(!H)return;const ke=I?I[le]:null,we=H.split(".").map(Re=>Re.trim()).filter(Boolean);if(!we.length)return;const[_e,...Ae]=we;Ae.length&&W(_e,Ae,ke??null)||q&&(q[_e]=ke??null)})},ie=e.computed(()=>n.parent?B?.value?.[n.parent]?.toString()??null:null),be=async I=>{if(!n.data){let q=n.options??[];if(I?.trim()){const H=I.toLowerCase();q=q.filter(le=>{const ke=j(le).toLowerCase(),we=le.text?.toLowerCase?.()||"";return ke.includes(H)||we.includes(H)})}return q}try{const q=n.host??"",H=n.prefix??"api",le=n.api??`/${H}/suggest/${n.data}`,ke=`${q}${le}`,we=new URLSearchParams;return we.set("json","1"),I&&we.set("key",I),ie.value!==void 0&&ie.value!==null&&ie.value!==""&&we.set("parent",ie.value),n.start===1&&we.set("start","1"),(await fetch(`${ke}?${we.toString()}`).then(Ae=>Ae.json()))?.data??[]}catch{return[]}},xe=async()=>{n.data?y.value=await be(C.value):y.value=n.options?[...n.options]:[]},K=async I=>{if(I==null||I==="")return null;const q=y.value?.find(H=>H?.id?.toString()===String(I));if(q)return q;if(n.data)try{const H=n.host??"",le=n.prefix??"api",ke=n.api??`/${le}/suggest/${n.data}`,we=`${H}${ke}`,_e=new URLSearchParams;return _e.set("json","1"),_e.set("val",String(I)),ie.value!==void 0&&ie.value!==null&&ie.value!==""&&_e.set("parent",ie.value),n.start===1&&_e.set("start","1"),((await fetch(`${we}?${_e.toString()}`).then(We=>We.json()))?.data??[])?.[0]??null}catch{return null}return null},se=async I=>{const q=new Set(y.value.map(le=>le.id?.toString())),H=I.filter(le=>!q.has(le?.toString()));H.length&&await H.reduce(async(le,ke)=>{await le;const we=await K(ke);we&&y.value.push(we)},Promise.resolve())},Me=()=>{if(!V.value.length){h.value=-1;return}let I=0;if(!a.value&&f.value){const q=f.value.id?.toString(),H=V.value.findIndex(le=>le.id?.toString()===q);H>=0&&(I=H)}h.value=I,e.nextTick(()=>{qe(b.value[I],d.value)})},Ie=async()=>{o.value||(p.value=!0,await xe(),await e.nextTick(()=>{J(),w.value?.focus()}),Me())},z=()=>{p.value=!1,h.value=-1,e.nextTick(()=>{w.value?.blur()})},G=async I=>{if(o.value)return;!p.value?await Ie():z()},X=async()=>{if(!o.value){if(p.value){z();return}await Ie()}},oe=()=>{a.value?(S.value=[],s.value=[],l("change",[]),Ee(null,[])):(f.value=null,s.value=null,l("change",null),Ee(null,null)),ae(null),C.value="",e.nextTick(()=>w.value?.focus())},ce=I=>{a.value&&(S.value=S.value.filter(q=>q?.toString()!==I?.toString()),s.value=[...S.value],l("change",s.value),Ee(null),e.nextTick(()=>w.value?.focus()))},Ee=(I,q)=>{const H=q??(a.value?[...S.value]:I?.id??null);l("value-selected",{name:n.name,value:H,option:I})},Ve=I=>{a.value?(E(I.id)||(S.value=[...S.value,I.id],s.value=[...S.value],l("change",s.value),Ee(I)),C.value="",e.nextTick(()=>{w.value?.focus(),h.value=Math.min(h.value,V.value.length-1)}),ae(null)):(f.value=I,s.value=I.id,l("change",s.value),Ee(I),C.value="",z(),ae(I))},Ce=I=>{if(E(I.id)){a.value||z();return}Ve(I)},qe=(I,q)=>{if(!I||!q)return;const H=I.offsetTop,le=H+I.offsetHeight,ke=q.scrollTop,we=ke+q.clientHeight;let _e=q.scrollTop;H<ke?_e=H-80:le>we&&(_e=le-q.clientHeight+4);const Ae=q;Ae.scrollTop=_e},P=I=>{let q=I.parentElement;for(;q;){if(q.classList.contains("ui-dialog__content"))return q;const H=window.getComputedStyle(q),le=H.overflow+H.overflowY+H.overflowX;if(le.includes("auto")||le.includes("scroll")||q===document.body||q===document.documentElement)return q;q=q.parentElement}return document.body},J=()=>{if(!i.value)return;const I=i.value.getBoundingClientRect(),q=window.innerHeight||document.documentElement.clientHeight,H=window.innerWidth||document.documentElement.clientWidth,le=8,ke=8,we=n.maxHeight||300,_e=q-I.bottom-ke-le,Ae=I.top-ke-le,Re=_e>=Ae,We=Math.max(H-le*2,0);let{width:st}=I;We>0&&st>We&&(st=We);let{left:Ze}=I;Ze+st+le>H&&(Ze=H-st-le),Ze=Math.max(Ze,le);const Lt=Math.min(we,Math.max(Re?_e:Ae,50));k.value=Re?"bottom":"top",x.value={position:"fixed",left:`${Ze}px`,width:`${st}px`,maxHeight:`${Lt}px`,transform:Re?"none":"translateY(-100%)",top:Re?`${I.bottom+ke}px`:`${I.top-ke}px`}},Q=async I=>{o.value||!p.value&&(I.key==="ArrowDown"||I.key==="ArrowUp")&&(I.preventDefault(),await Ie())},he=I=>{if(!p.value)return;const{key:q}=I;if(q==="ArrowDown")I.preventDefault(),h.value+1<V.value.length&&(h.value+=1,qe(b.value[h.value],d.value));else if(q==="ArrowUp")I.preventDefault(),h.value>0&&(h.value-=1,qe(b.value[h.value],d.value));else if(q==="Enter"){I.preventDefault();const H=V.value[h.value];H&&Ve(H),w.value?.blur()}else q==="Escape"?(I.preventDefault(),z()):q==="Backspace"?a.value&&C.value===""&&S.value.length&&(S.value=S.value.slice(0,-1),s.value=[...S.value],l("change",s.value)):q==="Home"?(h.value=0,qe(b.value[0],d.value)):q==="End"?(h.value=V.value.length-1,qe(b.value[h.value],d.value)):q==="Tab"&&z()},Be=()=>{o.value||(g.value=!0)},Qe=()=>{g.value=!1,C.value=""},at=I=>{I.key==="Escape"&&p.value&&z()},Ke=I=>{const q=I.target;c.value?.contains(q)||u.value?.contains(q)||z()},ft=I=>{p.value&&d.value&&!d.value.contains(I.target)&&J()},ot=()=>{p.value&&J()},et=()=>{p.value&&J()};e.watch(()=>n.options,I=>{I?.length&&(y.value=[...I],Ge())},{immediate:!0});async function Ge(){if(a.value)Array.isArray(s.value)?S.value=[...s.value]:(S.value=s.value==null?[]:[s.value],s.value=[...S.value]),n.data&&S.value.length&&(await se(S.value),await e.nextTick());else{if(Array.isArray(s.value)){const I=s.value[0]??null;s.value=I??null}s.value!=null&&(f.value=await K(s.value)),ae(f.value??null)}}e.watch(s,()=>{Ge()}),e.onMounted(async()=>{addEventListener("keydown",at),addEventListener("scroll",ft,!0),addEventListener("resize",ot),document.addEventListener("click",Ke,!0),i.value&&P(i.value).addEventListener("scroll",et,!0),n.options?.length&&!n.data?y.value=[...n.options]:n.data&&(y.value=await be("")),await Ge(),xt.value=!1}),e.onUnmounted(()=>{removeEventListener("keydown",at),removeEventListener("scroll",ft,!0),removeEventListener("resize",ot),document.removeEventListener("click",Ke,!0),i.value&&P(i.value).removeEventListener("scroll",et,!0)});const it=e.ref(!1),Dt=e.ref({}),Mt=e.ref([]),rn=e.ref(null);async function Tt(){if(!(!n.add?.token||rn?.value.validate()))try{const q=n.add.api??`/api/table/${n.add.token}`,H=await fetch(q,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Dt.value)}),le=await H.json().catch(()=>({})),ke=le?.error||le?.message,we=Number(le?.code)>=400;if(!H.ok||we){ge.notify({title:"Помилка",type:"error",message:ke||`Код помилки: ${le?.code||H.status}`});return}const _e=le?.id;if(!_e){ge.notify({title:"Помилка",type:"error",message:"Обʼєкт створено, але в відповіді відсутній ID."});return}if(!n.options?.length&&n.data){const Ae=await fetch(`${n.api??`/api/suggest/${n.data}`}?val=${_e}`).then(Re=>Re.json());f.value=Ae[0],y.value.push(Ae[0]),s.value=_e}it.value=!1,ge.notify({title:"Успіх",message:"Обʼєкт успішно створено."})}catch(q){ge.notify({title:"Помилка",type:"error",message:q?.message||"Не вдалося створити обʼєкт."})}}async function ln(){if(!n.add)return null;const I=await fetch(`/api/template/form/${n.add.form}`).then(q=>q.json());return Mt.value=I.schema,it.value=!0,null}function an(I,q=200){let H;return(...le)=>{H&&clearTimeout(H),H=window.setTimeout(()=>I(...le),q)}}const on=an(async I=>{y.value=await be(I)},200);e.watch(C,I=>{n.data&&on(I.trim())}),e.watch(()=>n.options,I=>{!n.data&&I?.length&&(y.value=[...I],Ge())},{immediate:!0}),e.watch(()=>n.parent??n.parentValue,()=>{n.data&&xe()});const xt=e.ref(!0);return e.watch(ie,async()=>{if(n.data&&(xt.value||(a.value?(S.value=[],s.value=[],l("change",[])):(f.value=null,s.value=null,l("change",null))),await xe(),n.auto===1&&ie.value&&y.value.length>0)){const I=y.value[0];I&&Ve(I)}}),(I,q)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(ge.VsModal),{visible:it.value,"onUpdate:visible":q[1]||(q[1]=H=>it.value=H),class:"z-[1000]",title:"Додати",buttonText:"Додати",onDone:Tt,teleport:I.teleport},{default:e.withCtx(()=>[e.createVNode(tt,{schema:Mt.value,modelValue:Dt.value,"onUpdate:modelValue":q[0]||(q[0]=H=>Dt.value=H),ref_key:"addForm",ref:rn},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:c,onClick:q[5]||(q[5]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass])},[q[6]||(q[6]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),q[7]||(q[7]=e.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["vs-input-select__control flex min-h-[38px] items-center justify-between rounded transition-colors bg-white",o.value?"bg-gray-100 text-gray-400 cursor-not-allowed":""]),role:"combobox","aria-expanded":p.value,"aria-haspopup":"listbox",onKeydown:Q,onClick:X,"data-focus":p.value||g.value?"true":"false",ref_key:"triggerRef",ref:i},[e.createElementVNode("div",_o,[a.value?(e.openBlock(),e.createElementBlock("div",vo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(L.value,H=>(e.openBlock(),e.createElementBlock("div",{class:"flex min-w-0 bg-[rgb(230,230,230)] rounded-[2px] m-[2px] box-border max-w-full",key:H.id},[e.createElementVNode("div",Co,[ee(H)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:e.normalizeStyle({backgroundColor:H?.color})},null,4)):e.createCommentVNode("",!0),!T.value&&ye(H)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(yn),style:e.normalizeStyle(ve(H)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(Y(H)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"truncate text-[#172b4d] overflow-hidden max-w-[200px] px-0.5 pl-1.5",title:j(H)},[T.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:U(H)},null,8,Bo)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(H.text),1)],64))],8,Eo)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border text-[#172b4d] hover:bg-[rgb(255,189,173)] hover:text-[rgb(222,53,11)] flex-shrink-0",onClick:e.withModifiers(le=>ce(H.id),["stop"])},[e.createVNode(e.unref(R.X),{"aria-hidden":"true",focusable:"false",class:"inline-block h-4 w-4"})],8,Vo)]))),128)),e.createElementVNode("div",So,[!o.value&&I.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:w,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900 hover:cursor-pointer",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:S.value.length?" ":$.value,"onUpdate:modelValue":q[2]||(q[2]=H=>C.value=H),onFocus:Be,onBlur:Qe,onKeydown:he},null,40,$o)),[[e.vModelText,C.value]]):e.createCommentVNode("",!0)])])):!a.value&&v.value&&C.value===""?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["truncate text-gray-900 absolute inset-x-0 pl-2 flex items-center gap-1 min-w-0"]),title:v.value},[ee(f.value)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block flex-shrink-0",style:e.normalizeStyle({backgroundColor:f.value?.color})},null,4)):e.createCommentVNode("",!0),!T.value&&ye(f.value)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(yn),style:e.normalizeStyle(ve(f.value)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(Y(f.value)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),T.value?(e.openBlock(),e.createElementBlock("span",{key:2,class:"truncate flex-1 min-w-0",innerHTML:U(f.value)},null,8,Fo)):(e.openBlock(),e.createElementBlock("span",No,e.toDisplayString(f.value?.text),1))],8,Ao)):e.createCommentVNode("",!0),a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Do,[!o.value&&I.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:w,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900 hover:cursor-pointer",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:v.value?" ":$.value,"onUpdate:modelValue":q[3]||(q[3]=H=>C.value=H),onFocus:Be,onBlur:Qe,onKeydown:he},null,40,Mo)),[[e.vModelText,C.value]]):e.createCommentVNode("",!0)]))]),e.createElementVNode("div",To,[A.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:o.value,onClick:e.withModifiers(oe,["stop"])},[e.createVNode(e.unref(R.X),{class:"h-4 w-4"})],8,Lo)):e.createCommentVNode("",!0),A.value?(e.openBlock(),e.createElementBlock("div",Io)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:o.value,onClick:q[4]||(q[4]=e.withModifiers(H=>G(),["stop"])),title:p.value?"Закрити список":"Відкрити список"},[e.createVNode(e.unref(R.ChevronDown),{class:"h-4 w-4"})],8,Oo)])],42,wo),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[p.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:e.normalizeClass(["fixed z-[3000] rounded bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.1),0_4px_11px_rgba(0,0,0,0.1)]"]),style:e.normalizeStyle(x.value),role:"listbox"},[e.createElementVNode("div",{class:"overflow-y-auto py-1",style:e.normalizeStyle({maxHeight:x.value.maxHeight||"300px"}),ref_key:"listRef",ref:d},[V.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(V.value,(H,le)=>(e.openBlock(),e.createElementBlock("div",{key:H.id,ref_for:!0,ref:ke=>b.value[le]=ke,class:e.normalizeClass(["flex px-3 py-2 gap-2 cursor-pointer select-none text-gray-900",E(H.id)?"bg-[#2684ff] text-white":"bg-white hover:bg-[#deebff] hover:text-[#172b4d]",h.value===le&&!E(H.id)?"bg-[#deebff] text-[#172b4d]":""]),"aria-disabled":E(H.id)?"true":"false",role:"option",tabindex:"-1",onClick:ke=>Ce(H)},[ee(H)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block flex-shrink-0",style:e.normalizeStyle({backgroundColor:H?.color})},null,4)):e.createCommentVNode("",!0),!T.value&&ye(H)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(yn),style:e.normalizeStyle(ve(H)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(Y(H)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",h.value===H.id?"text-white":"",(h.value===le,"")])},[T.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:U(H)},null,8,Ro)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(H.text),1)],64))],2)],10,zo))),128)):(e.openBlock(),e.createElementBlock("div",Po," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),n.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:ln,class:"bg-white hover:bg-gray-100 text-sm text-gray-900 py-[10px] px-3 border border-stone-200 rounded-md h-[38px] flex items-center gap-2",disabled:o.value,type:"button"},[e.createVNode(e.unref(R.Plus),{class:"h-4 w-4"}),q[8]||(q[8]=e.createElementVNode("span",null,"Додати",-1))],8,jo)):e.createCommentVNode("",!0)],512)],64))}}),[["__scopeId","data-v-4f31eacf"]]),Uo=["placeholder","disabled"],Wn=e.defineComponent({__name:"vs-input-textarea",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Le(t.style),l=e.useModel(r,"modelValue"),a=e.computed(()=>!!t.disabled),o=e.computed(()=>t.placeholder??"");function s(){typeof l.value=="string"&&(l.value=l.value.trim())}return(c,i)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{"onUpdate:modelValue":i[0]||(i[0]=d=>l.value=d),placeholder:o.value,disabled:a.value,row:"2",onBlur:s,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,42,Uo)),[[e.vModelText,l.value]])}}),Yn=e.defineComponent({__name:"vs-input-richtext",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},format:{default:"html"},richtextProps:{default:()=>({})}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=e.defineAsyncComponent(()=>Promise.resolve().then(()=>pm)),n=r,{inputClass:l}=Le(n.style),a=e.useModel(r,"modelValue"),o=e.computed(()=>!!n.disabled),s=e.computed(()=>n.placeholder??""),c=e.computed(()=>({height:"300px",format:n.format,...n.richtextProps}));return(i,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["!h-full",[i.customClass,e.unref(l)]]),style:e.normalizeStyle(o.value?{pointerEvents:"none",opacity:.6}:{})},[e.createVNode(e.unref(t),e.mergeProps({modelValue:a.value,"onUpdate:modelValue":d[0]||(d[0]=u=>a.value=u),placeholder:s.value},c.value),null,16,["modelValue","placeholder"])],6))}}),Ho={},qo={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Ko(r,t){return e.openBlock(),e.createElementBlock("svg",qo,t[0]||(t[0]=[e.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)]))}const Go=pe(Ho,[["render",Ko]]),Wo={class:"bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden flex flex-col"},Yo={class:"flex flex-col gap-2 !p-4 border-b border-gray-200 sm:flex-row sm:items-center sm:justify-between bg-gray-50"},Zo={class:"relative w-full"},Xo={class:"flex flex-nowrap items-center justify-end gap-2 w-full overflow-x-auto"},Jo={class:"w-full overflow-x-auto"},Qo={class:"w-full min-w-[640px] table-auto divide-y divide-gray-200"},es={class:"bg-gray-50"},ts={class:"border-b border-gray-200"},ns={class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 w-12 text-center"},rs=["onClick"],ls={key:0,class:"text-gray-400"},as={key:0,colspan:"100%",class:"text-center"},os={class:"w-full"},ss={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},is=["onDragstart","onDragover","onDrop"],cs={class:"px-4 py-3 text-center align-middle"},ds={class:"flex items-center justify-center"},us=["innerHTML"],ps={key:0,class:"flex items-center gap-3 text-sm text-gray-700"},fs={key:0},ms=["src"],hs={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},gs={key:1,class:"flex items-center justify-center"},ys={key:2,class:"text-sm font-medium text-gray-900"},bs={class:"px-4 py-3 text-right whitespace-nowrap"},ks={class:"flex items-center justify-end gap-2"},xs=["onClick"],ws=["onClick"],_s={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},Zn=e.defineComponent({__name:"vs-input-datatable",props:e.mergeModels({actions:{},colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useSlots(),l=z=>t.actions===void 0?!0:t.actions.includes(z),a=e.useModel(r,"modelValue"),o=e.ref({}),s=e.ref(""),c=e.ref(null),i=e.ref("asc"),d=e.computed(()=>{const z=a.value??[],G=s.value?z.filter(ce=>u.value?.some(Ee=>{const Ve=Ee.key||Ee.name;if(!Ve)return!1;const Ce=ce[Ve];return Ce?Array.isArray(Ce)?Ce.join(", ").toLowerCase().includes(s.value.toLowerCase()):String(Ce).toLowerCase().includes(s.value.toLowerCase()):!1})):z;if(!c.value)return G;const X=c.value,oe=[...G].sort((ce,Ee)=>{const Ve=ye(ce?.[X]),Ce=ye(Ee?.[X]);return typeof Ve=="number"&&typeof Ce=="number"?Ve-Ce:String(Ve).localeCompare(String(Ce))});return i.value==="asc"?oe:oe.reverse()}),u=e.computed(()=>(t.colModel??[]).filter(z=>!z.tableHidden)),p=e.ref(null),g=e.ref(null),f=e.ref(null),y=z=>{p.value=z},h=z=>{g.value=z},b=z=>{if(p.value===null||p.value===z){p.value=null,g.value=null;return}const G=[...a.value],[X]=G.splice(p.value,1);G.splice(z,0,X),a.value=G,p.value=null,g.value=null},C=()=>{f.value&&f.value.click()},w=z=>{const G=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],X=z.toLowerCase();return G.some(oe=>X.endsWith(oe))},k=z=>{const X=z.target.files?.[0];if(!X)return;const oe=new FileReader;oe.onload=ce=>{try{const Ee=ce.target?.result;if(typeof Ee=="string"){const Ve=JSON.parse(Ee);Array.isArray(Ve)&&a.value.push(...Ve)}}catch(Ee){console.error("Error parsing file:",Ee)}},oe.readAsText(X)},x=()=>{const z=JSON.stringify(a.value,null,2),G=new Blob([z],{type:"application/json"}),X=URL.createObjectURL(G),oe=document.createElement("a");oe.href=X,oe.download="data.json",oe.click(),URL.revokeObjectURL(X)},S=new Set(["autocomplete","select","radio","checkbox","combobox"]),L=new Map,$=(z,G)=>{const X=`/api/suggest/${z}`,oe=X.includes("?")?"&":"?",ce=G?`&val=${G}`:"";return`${X}${oe}json=1${ce}`},v=z=>z==null||z===""?null:typeof z=="object"?z?.id!==void 0&&z.id!==null&&z.id!==""?z.id:null:z,A=z=>{const G=new Set;return Array.isArray(a.value)&&a.value.forEach(X=>{const oe=X?.[z];if(oe==null||oe==="")return;if(Array.isArray(oe)){oe.forEach(Ee=>{const Ve=v(Ee);Ve!==null&&G.add(Ve)});return}const ce=v(oe);ce!==null&&G.add(ce)}),G},E=async()=>{if(!t.colModel?.length)return;const z=t.colModel.filter(G=>G.data&&S.has(G.type?.toLowerCase()||""));z.length&&await Promise.all(z.map(async G=>{const X=G.key||G.name;if(!X)return;const oe=A(X),ce=Array.from(oe).map(Ce=>String(Ce)).sort(),Ee=ce.join(",");if(!ce.length||L.get(X)===Ee)return;L.set(X,Ee);const Ve=ce.map(encodeURIComponent).join(",");try{const qe=await(await fetch($(G.data,Ve))).json();o.value[X]=qe?.data??qe}catch(Ce){console.error("Failed to fetch column values",Ce)}}))};e.watch([()=>t.colModel,()=>a.value],()=>{E()},{immediate:!0,deep:!0});const V=e.ref(""),B=e.ref(!1);let M="edit",N=0;const F=z=>(z?.format||z?.type||"").toString().toLowerCase(),T=e.computed(()=>t.colModel?.filter(z=>F(z)!=="slot").map(z=>{const{slot:G,...X}=z;return X})??[]),U=e.ref({}),j=e.ref({}),Y=z=>typeof z!="string"?!1:!!n[z],ee=(z,G)=>G?G.split(".").reduce((X,oe)=>X==null?X:X[oe.trim()],z):z,ve=(z,G)=>typeof z!="string"?"":z.replace(/{{\s*([^}]+)\s*}}/g,(X,oe)=>{const ce=ee(G,oe.trim());return ce??""}),ye=z=>{if(z==null||z==="")return"";if(typeof z=="number")return z;if(typeof z=="boolean")return z?1:0;if(typeof z=="string")return z.toLowerCase();if(Array.isArray(z))return z.map(G=>ye(G)).join(", ");if(typeof z=="object"){if(z.text!==void 0)return String(z.text).toLowerCase();if(z.label!==void 0)return String(z.label).toLowerCase();if(z.id!==void 0)return String(z.id).toLowerCase()}return String(z).toLowerCase()},W=z=>{const G=z.key||z.name;if(G){if(c.value===G){i.value=i.value==="asc"?"desc":"asc";return}c.value=G,i.value="asc"}};async function ae(){V.value="Додати",B.value=!0,M="add",U.value={}}function ie(z,G){if(!z?.length)return null;const X=typeof G=="object"?G?.id:G;return X==null||X===""?null:z.find(oe=>oe?.id?.toString()===X.toString())?.text??null}function be(z){return z==null||z===""?"-":Array.isArray(z)?z.map(G=>typeof G=="object"?G?.text??G?.id??"-":G).join(", "):typeof z=="object"?z?.text??z?.id??"-":z}function xe(z,G){const X=G.key||G.name,oe=z?.[X],ce=o.value[X];if(!oe)return"-";if(Array.isArray(oe)){const Ve=oe.map(Ce=>ie(ce,Ce)).filter(Boolean);return Ve.length?Ve.join(", "):be(oe)}const Ee=ie(ce,oe);return Ee||be(oe)}async function K(z,G){V.value="Редагувати",B.value=!0,M="edit",N=G,U.value={...z}}function se(){const z=j.value.validate();if(z){ge.notify({type:"warning",title:"Помилка валідації",message:Object.entries(z).map(([G,X])=>`${G}: ${X}`).join(`
|
|
2
|
+
`)});return}M==="add"?Array.isArray(a.value)?a.value=[...a.value,U.value]:a.value=[U.value]:a.value=a.value.map((G,X)=>X===N?U.value:G),B.value=!1}function Me(z){a.value=a.value.filter((G,X)=>X!==z)}function Ie(){B.value=!1}return(z,G)=>(e.openBlock(),e.createElementBlock("div",Wo,[e.createElementVNode("div",Yo,[e.createElementVNode("div",Zo,[e.createVNode(e.unref(R.Search),{class:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400"}),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":G[0]||(G[0]=X=>s.value=X),placeholder:"Пошук",class:"w-full rounded-md border border-gray-200 bg-white pl-10 pr-3 py-2 text-sm text-gray-900 placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-100"},null,512),[[e.vModelText,s.value]])]),e.createElementVNode("div",Xo,[l("import")?(e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"fileInput",ref:f,onChange:k,class:"hidden",accept:".json",type:"file"},null,544)):e.createCommentVNode("",!0),l("import")?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",onClick:C,class:"inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-gray-50 transition-colors"},[e.createVNode(e.unref(R.Upload),{class:"h-4 w-4 text-gray-700"}),G[4]||(G[4]=e.createTextVNode(" Імпорт ",-1))])):e.createCommentVNode("",!0),l("export")?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:x,class:"inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-gray-50 transition-colors"},[e.createVNode(e.unref(R.Download),{class:"h-4 w-4 text-gray-700"}),G[5]||(G[5]=e.createTextVNode(" Експорт ",-1))])):e.createCommentVNode("",!0),l("add")?(e.openBlock(),e.createElementBlock("button",{key:3,onClick:ae,type:"button",class:"inline-flex items-center gap-2 rounded-md bg-blue-500 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-600 transition-colors"},[e.createVNode(e.unref(R.Plus),{class:"h-4 w-4 text-white"}),G[6]||(G[6]=e.createTextVNode(" Додати ",-1))])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Jo,[e.createElementVNode("table",Qo,[e.createElementVNode("thead",es,[e.createElementVNode("tr",ts,[e.createElementVNode("th",ns,[e.createVNode(e.unref(R.GripVertical),{class:"mx-auto h-4 w-4 text-gray-400"})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,X=>(e.openBlock(),e.createElementBlock("th",{key:X.key,class:"px-4 py-3 text-left text-xs font-semibold text-gray-900"},[e.createElementVNode("button",{type:"button",onClick:oe=>W(X),class:"flex items-center gap-1 text-xs font-semibold text-gray-700 hover:text-gray-900 transition-colors"},[e.createElementVNode("span",null,e.toDisplayString(X.ua||X.label),1),c.value===(X.key||X.name)?(e.openBlock(),e.createElementBlock("span",ls,e.toDisplayString(i.value==="asc"?"▲":"▼"),1)):e.createCommentVNode("",!0)],8,rs)]))),128)),G[7]||(G[7]=e.createElementVNode("th",{class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 text-center w-[1%] whitespace-nowrap"}," Дії ",-1))])]),e.createElementVNode("tbody",{class:e.normalizeClass(["divide-y divide-gray-200",{"[&_tr:last-child]:border-0":!g.value}])},[d.value.length===0?(e.openBlock(),e.createElementBlock("td",as,[e.createElementVNode("div",os,[e.createElementVNode("div",ss,[e.createVNode(Go,{class:"w-48 mx-auto"}),G[8]||(G[8]=e.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[e.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),e.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(X,oe)=>(e.openBlock(),e.createElementBlock("tr",{key:X.id,class:e.normalizeClass(["border-b transition-colors hover:bg-gray-50 cursor-move text-sm text-gray-700",{"opacity-50":p.value===oe,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":g.value===oe}]),draggable:"true",onDragstart:ce=>y(oe),onDragover:e.withModifiers(ce=>h(oe),["prevent"]),onDrop:ce=>b(oe)},[e.createElementVNode("td",cs,[e.createElementVNode("div",ds,[e.createVNode(e.unref(R.GripVertical),{class:"mx-auto h-4 w-4 text-slate-400 dark:text-slate-500"})])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,ce=>(e.openBlock(),e.createElementBlock("td",{key:ce.key,class:"px-4 py-3 align-middle"},[F(ce)==="slot"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[Y(ce.slot)?e.renderSlot(z.$slots,ce.slot,{key:0,row:X,value:X[ce.key],column:ce}):(e.openBlock(),e.createElementBlock("div",{key:1,class:"text-sm text-gray-900",innerHTML:ve(ce.slot,X)},null,8,us))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[F(ce)==="file"?(e.openBlock(),e.createElementBlock("div",ps,[w(xe(X,ce))?(e.openBlock(),e.createElementBlock("div",fs,[e.createElementVNode("img",{src:xe(X,ce),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,ms)])):(e.openBlock(),e.createElementBlock("div",hs,[e.createVNode(e.unref(R.FileText),{class:"h-4 w-4 min-w-4"})]))])):F(ce)==="color"?(e.openBlock(),e.createElementBlock("div",gs,[e.createElementVNode("span",{class:"inline-flex h-6 w-6 rounded border border-gray-200",style:e.normalizeStyle({backgroundColor:xe(X,ce)||"#ffffff"})},null,4)])):(e.openBlock(),e.createElementBlock("div",ys,e.toDisplayString(xe(X,ce)),1))],64))]))),128)),e.createElementVNode("td",bs,[e.createElementVNode("div",ks,[e.createElementVNode("button",{onClick:ce=>K(X,oe),class:"p-1.5 text-gray-600 hover:text-blue-600 hover:bg-blue-50 rounded transition-colors"},[e.createVNode(e.unref(R.Pencil),{class:"h-4 w-4"})],8,xs),e.createElementVNode("button",{onClick:ce=>Me(oe),class:"p-1.5 text-gray-600 hover:text-red-600 hover:bg-red-50 rounded transition-colors"},[e.createVNode(e.unref(R.Trash2),{class:"h-4 w-4"})],8,ws)])])],42,is))),128))],2)])]),e.createVNode(e.unref(ge.VsModal),{visible:B.value,title:V.value,size:"lg",onClose:Ie,teleport:"#modal"},{default:e.withCtx(()=>[e.createVNode(tt,{schema:T.value,values:U.value,"onUpdate:values":G[1]||(G[1]=X=>U.value=X),form:j.value,"onUpdate:form":G[2]||(G[2]=X=>j.value=X)},null,8,["schema","values","form"]),e.createElementVNode("div",_s,[e.createElementVNode("button",{type:"button",onClick:G[3]||(G[3]=X=>B.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:se,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])]),_:1},8,["visible","title"])]))}}),vs={},Cs={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none","stroke-width":"2",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-line"};function Es(r,t){return e.openBlock(),e.createElementBlock("svg",Cs,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const Bs=pe(vs,[["render",Es]]),Vs={},Ss={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-polygon"};function $s(r,t){return e.openBlock(),e.createElementBlock("svg",Ss,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M6.5 9.5l3.5 -3"></path><path d="M14 5.5l3 1.5"></path><path d="M18.5 10l-2.5 7"></path><path d="M13.5 17.5l-7 -5"></path>',9)]))}const As=pe(Vs,[["render",$s]]),Fs={},Ns={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-topology-ring-3"};function Ds(r,t){return e.openBlock(),e.createElementBlock("svg",Ns,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M8 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M6 8v8"></path><path d="M18 16v-8"></path><path d="M8 6h8"></path><path d="M16 18h-8"></path>',9)]))}const Ms=pe(Fs,[["render",Ds]]),Ts={class:"bg-white/30 p-1 rounded-md shadow w-fit"},Ls={class:"flex gap-2"},Is=["onClick","title"],Os=["src"],zs=e.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(r,{emit:t}){const n=r,l=e.ref(Object.keys(n.basemaps)[0]),a=t;function o(i){a("onLayerChange",i),l.value=i}const s={z:13,x:4790,y:2762};function c(i){if(i?.preview)return i.preview;if(!i?.url)return;const d={"{z}":s.z,"{x}":s.x,"{y}":s.y};let u=i.url;return Object.entries(d).forEach(([p,g])=>{u=u.replace(new RegExp(p,"gi"),String(g))}),u}return(i,d)=>(e.openBlock(),e.createElementBlock("div",Ts,[e.createElementVNode("div",Ls,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.basemaps,(u,p)=>(e.openBlock(),e.createElementBlock("div",{key:p,class:e.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":l.value===p}]),onClick:g=>o(p),title:u.name||p,role:"button",tabindex:"0"},[e.createElementVNode("img",{src:c(u),alt:"",class:"w-10 h-10 object-cover"},null,8,Os)],10,Is))),128))])]))}}),Rs={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},Ps={key:0,class:"vs-select__options absolute z-50 mt-1 w-full bg-white border border-gray-300 shadow-lg rounded-lg text-sm"},js=["onClick"],Us={class:"relative flex-1 min-w-[140px]"},Hs=["placeholder"],qs={type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},Ks="https://data.softpro.ua/api-user/gis-url-proxy",Gs="https://geo.rv.ua/api-user/dzk.api",Ws=pe(e.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(r,{emit:t}){const n=r,l=t,a=["here","xy","parcel"],o=e.computed(()=>{const x=n.config?.tools?.filter(S=>a.includes(S));return x&&x.length?x:a}),s=e.computed(()=>n.config?.placeholder?.trim()||"Пошук…"),c=e.ref(o.value[0]??a[0]);e.watch(o,x=>{x.includes(c.value)||(c.value=x[0])});const i=e.ref(""),d=e.ref(!1),u=e.ref(null);e.watch(c,()=>{i.value="",d.value=!1});function p(x){c.value=x}function g(x){if(!d.value)return;const S=u.value;S&&!S.contains(x.target)&&(d.value=!1)}e.onMounted(()=>{window.addEventListener("click",g,!0)}),e.onBeforeUnmount(()=>{window.removeEventListener("click",g,!0)});function f(x){return x==="xy"?"Координати":x==="parcel"?"Кадастр":"Адреси"}function y(x){const S=x.replace(/[,]+/g," ").trim();if(!S)return null;const L=S.split(/\s+/).filter(Boolean);if(L.length<2)return null;const $=L.slice(0,2).map(Number);if(!$.every(N=>Number.isFinite(N)))return null;const[v,A]=$;let E=v,V=A;const B=N=>Math.abs(N)<=90,M=N=>Math.abs(N)<=180;if(!B(E)||!M(V))if(B(V)&&M(E))E=A,V=v;else return null;return{lat:E,lng:V}}function h(x){return(x?.items||[]).map((L,$)=>({id:String(L?.id??$),title:L?.title||L?.address?.label||"Знайдений обʼєкт",lat:Number(L?.position?.lat),lng:Number(L?.position?.lng)})).filter(L=>Number.isFinite(L.lat)&&Number.isFinite(L.lng))}function b(x){const S=x?.result||x?.data||x;if(!S)return[];const L=S.geom_centroid;if(!L||!Array.isArray(L.coordinates))return[];const[$,v]=L.coordinates;return!Number.isFinite(v)||!Number.isFinite($)?[]:[{id:"parcel",title:S.cadnum||S.cad_num||"Земельна ділянка",lat:v,lng:$}]}function C(x){const L=x.replace(/\s+/g,"").split(":");if(L.length!==4)return!1;const $=[10,2,3,4];return L.every((v,A)=>v.length===$[A]&&/^\d+$/.test(v))}function w(x){l("goToCoordinates",[x.lat,x.lng])}async function k(){const x=i.value.trim();if(x){if(c.value==="xy"){const S=y(x);if(!S){ge.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}w(S),i.value="";return}try{const S=new URL(c.value==="here"?Ks:Gs);if(c.value==="here")S.searchParams.set("searchtext",x);else{if(!C(x)){ge.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}S.searchParams.set("cad_num",x)}const L=await fetch(S.toString());if(!L.ok)throw new Error(`HTTP ${L.status}`);const $=await L.json(),v=c.value==="here"?h($):b($);if(!v.length)ge.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const A=v[0];w(A),i.value=""}}catch(S){const L=S?.message||"Помилка пошуку";ge.notify({type:"error",title:"Пошук",message:L})}}}return(x,S)=>(e.openBlock(),e.createElementBlock("div",Rs,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(k,["prevent"])},[o.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:"relative search-type w-[140px]"},[e.createElementVNode("button",{type:"button",class:"vstSelect-input transition-all text-left bg-white border border-gray-200 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-100 block w-full py-1.5 px-3 text-sm cursor-pointer flex items-center justify-between gap-2",onClick:S[0]||(S[0]=L=>d.value=!d.value)},[e.createElementVNode("span",null,e.toDisplayString(f(c.value)),1),e.createVNode(e.unref(R.ChevronDown),{class:e.normalizeClass(["h-4 w-4 text-gray-500 transition-transform",{"rotate-180":d.value}])},null,8,["class"])]),d.value?(e.openBlock(),e.createElementBlock("div",Ps,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,L=>(e.openBlock(),e.createElementBlock("li",{key:L,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:$=>p(L)},e.toDisplayString(f(L)),9,js))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",Us,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":S[1]||(S[1]=L=>i.value=L),placeholder:s.value,type:"text",class:"vs-input transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,8,Hs),[[e.vModelText,i.value,void 0,{trim:!0}]]),e.createElementVNode("button",qs,[e.createVNode(e.unref(R.Search),{class:"h-4 w-4"})])])],32)]))}}),[["__scopeId","data-v-2b66205f"]]),Ys={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},Zs={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},Xs={class:"flex items-center gap-1"},Js=["disabled"],Qs=["disabled"],ei=["disabled"],ti={class:"absolute top-4 right-4 z-[1000]"},ni={class:"flex flex-col gap-[2px]"},ri=["disabled"],li=["disabled"],ai=["disabled"],oi=["disabled"],si={class:"bg-white/95 border border-gray-200 rounded-md shadow-xl px-3 py-2 max-w-[240px] text-[11px] sm:text-xs text-gray-900"},ii={class:"space-y-0.5"},ci={class:"text-gray-500"},di={class:"text-gray-900 text-right break-all"},ui={class:"absolute left-4 bottom-[36px] z-[1000]"},pi={class:"flex flex-col gap-2"},fi={key:0,class:"bg-white/95 border border-gray-200 rounded-md shadow-sm px-3 py-2 text-xs text-gray-700 min-w-[200px]"},mi={class:"flex flex-col gap-1"},hi=["checked","disabled","onChange"],gi={class:"text-gray-700 text-xs font-medium"},yi={class:"absolute bottom-0 left-0 right-0 z-[1000] min-h-[28px] bg-white/95 border-t border-gray-200 text-xs text-gray-700 flex items-center gap-4 pt-1"},bi={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full px-2 pb-1"},ki={class:"mr-auto flex items-center gap-2 min-w-0 relative"},xi={class:"shrink-0"},wi={class:"font-bold"},_i={class:"flex items-center"},vi={class:"text-xs mr-2"},Ci={key:0,class:"text-xs mr-2"},Ei={key:1,class:"text-xs mr-2"},Bi=["disabled"],Vi=["disabled"],zt="__vs_form_maplibre_loader__",kn="__vs_form_maplibre_scripts__",Rt="vs-global-bounds-src",Pt="vs-global-bounds-line",Xn=pe(e.defineComponent({__name:"vs-input-map",props:{tools:{},handleZoom:{type:Boolean,default:!0},ctrlZoom:{type:Boolean,default:!0},geomType:{default:()=>[]},prefix:{default:""},katottg:{default:""},layers:{default:()=>[]},bounds:{},api:{},center:{default:void 0},zoom:{default:void 0},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r,l=t,a=e.computed(()=>!!n.disabled),o=e.ref(!1),s=e.ref(null),c=e.ref(0),i=e.ref(""),d=e.ref(null),u=e.getCurrentInstance(),p=u?.appContext?.config?.globalProperties?.$settings??{},g=p?.map??{},f=u?.vnode?.props??{};function y(m){return Object.prototype.hasOwnProperty.call(f,m)||Object.prototype.hasOwnProperty.call(f,m.replace(/[A-Z]/g,_=>`-${_.toLowerCase()}`))}const h=Array.isArray(g.center)&&g.center.length===2?g.center:Array.isArray(p.center)&&p.center.length===2?p.center:[30,50];console.log(g);const b=typeof g.zoom=="number"?g.zoom:typeof p.zoom=="number"?p.zoom:typeof p.defaultZoom=="number"?p.defaultZoom:10,C=e.computed(()=>y("center")?n.center:g.center??n.center),w=e.computed(()=>y("zoom")?n.zoom:g.zoom??n.zoom),k=e.computed(()=>y("katottg")?String(n.katottg??""):String(g.katottg??n.katottg??"")),x=e.computed(()=>y("layers")?n.layers??[]:g.layers??n.layers??[]),S=e.computed(()=>y("bounds")?n.bounds:g.bounds??n.bounds),L=e.ref(Array.isArray(C.value)&&C.value.length===2?[...C.value]:h),$=e.ref(typeof w.value=="number"?w.value:b),v=e.ref(n.modelValue),A=e.ref(null),E=e.ref([]);let V=!1;const B=e.reactive({}),M=e.ref([]),N=e.computed(()=>M.value.map(m=>B[m]).filter(Boolean)),F=e.ref(null),T=e.computed(()=>F.value?.entries??[]),U=e.computed(()=>{if(F.value)return{left:`${F.value.point.x+12}px`,top:`${F.value.point.y+12}px`}}),j=e.computed(()=>{const m={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!n.tools?.length)return{...m,point:!0,line:!0,polygon:!0,rectangle:!0};const _=new Set(n.tools.map(D=>D.toLowerCase()));return{search:_.has("search"),import:_.has("import"),export:_.has("export"),point:_.has("point"),line:_.has("line"),polygon:_.has("polygon"),rectangle:_.has("rectangle")}});function Y(m){if(typeof m!="string"||!m.trim())return"";if(/^https?:\/\//i.test(m))return m;const _=window?.location?.origin??"",D=m.replace(/^\/+/,"");return D?_?`${_}/${D}`:`/${D}`:_}function ee(){const m=Array.isArray(g.basemaps)&&g.basemaps.length?g.basemaps:p.basemaps;if(Array.isArray(m)&&m.length){const D=m.map((O,Z)=>{const re=String(O?.key??O?.id??O?.name??`b${Z}`),te=Y(String(O?.url??""));if(!te)return null;const fe=typeof O?.preview=="string"&&O.preview?Y(O.preview):"";return[re,{...O,url:te,preview:fe}]}).filter(O=>Array.isArray(O)&&O.length===2).reduce((O,[Z,re])=>(O[Z]=re,O),{});if(Object.keys(D).length)return D}return{voyager:{name:"Оглядова карта",url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/voyager/ua/13/4790/2762.png"},orto10:{name:"Ортофото 1:10K",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4790/2762.png"},osmb:{name:"Open Street Maps",url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png",preview:"https://tile.openstreetmap.org.ua/styles/osm-bright/13/4790/2762.png"}}}const ve=ee(),ye=Object.keys(ve),W=e.ref(ye.length?ye[0]:"");async function ae(){if(typeof window>"u")return null;const m=window;if(m[zt])return m[zt];m[kn]=m[kn]||{};const _=m[kn],D=te=>{if(Array.from(document.styleSheets).some(Oe=>Oe?.href?.includes(te)))return;const Se=document.createElement("link");Se.rel="stylesheet",Se.href=te,document.head.appendChild(Se)},O=te=>(_[te]||(_[te]=new Promise((fe,Se)=>{const Oe=Array.from(document.scripts).find(Xe=>Xe.src===te);if(Oe){Oe.addEventListener("load",()=>fe(),{once:!0}),Oe.addEventListener("error",Se,{once:!0}),te.includes("maplibre")&&window.maplibregl&&fe(),te.includes("mapbox-gl-draw")&&window.MapboxDraw&&fe();return}const Te=document.createElement("script");Te.src=te,Te.async=!1,Te.onload=()=>fe(),Te.onerror=Se,document.head.appendChild(Te)})),_[te]),re=(async()=>{D("https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.css"),D("https://unpkg.com/@mapbox/mapbox-gl-draw@1.5.0/dist/mapbox-gl-draw.css"),window.maplibregl||await O("https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.js"),window.MapboxDraw||await O("https://unpkg.com/@mapbox/mapbox-gl-draw@1.5.0/dist/mapbox-gl-draw.js");const te=window.maplibregl,fe=window.MapboxDraw;if(!te)throw new Error("maplibregl not available after load");if(!fe)throw new Error("MapboxDraw not available after load");return{maplibregl:te,MapboxDraw:fe}})().catch(te=>{throw delete m[zt],te});return m[zt]=re,re}function ie(m){return{version:8,sources:{rasterSource:{type:"raster",tiles:[m],tileSize:256}},layers:[{id:"rasterLayer",type:"raster",source:"rasterSource"}]}}let be=null,xe=null,K=null,se=null,Me=null,Ie=null,z=!1,G=!1;function X(){return{onSetup(){const m=this.newFeature({type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[0,0],[0,0],[0,0],[0,0],[0,0]]]}});return this.addFeature(m),this.clearSelectedFeatures(),this.updateUIClasses({mouse:"add"}),this.setActionableState({trash:!0}),{rectangle:m,startPoint:null,hasCoordinates:!1}},onMouseMove(m,_){if(!m.startPoint)return;const[D,O]=m.startPoint,Z=_.lngLat.lng,re=_.lngLat.lat;m.rectangle.setCoordinates([[[D,O],[Z,O],[Z,re],[D,re],[D,O]]])},onClick(m,_){if(!m.startPoint){m.startPoint=[_.lngLat.lng,_.lngLat.lat],m.hasCoordinates=!0,m.rectangle.setCoordinates([[[_.lngLat.lng,_.lngLat.lat],[_.lngLat.lng,_.lngLat.lat],[_.lngLat.lng,_.lngLat.lat],[_.lngLat.lng,_.lngLat.lat],[_.lngLat.lng,_.lngLat.lat]]]);return}const[D,O]=m.startPoint,Z=_.lngLat.lng,re=_.lngLat.lat;return Math.abs(D-Z)>0&&Math.abs(O-re)>0?(m.rectangle.setCoordinates([[[D,O],[Z,O],[Z,re],[D,re],[D,O]]]),this.map.fire("draw.create",{features:[m.rectangle.toGeoJSON()]}),this.changeMode("simple_select",{featureIds:[m.rectangle.id]})):(this.deleteFeature([m.rectangle.id],{silent:!0}),m.hasCoordinates=!1,this.changeMode("simple_select"))},onStop(){},onTrash(m){this.deleteFeature([m.rectangle.id],{silent:!0}),this.changeMode("simple_select")},toDisplayFeatures(m,_,D){if(!m.hasCoordinates)return;const O=_.properties.id===m.rectangle.id;_.properties.active=O?"true":"false",D(_)}}}const oe=[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","$type","Polygon"],["!=","active","true"]],paint:{"fill-color":"#3b82f6","fill-outline-color":"#3b82f6","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","$type","Polygon"],["==","active","true"]],paint:{"fill-color":"#2563eb","fill-outline-color":"#2563eb","fill-opacity":.2}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","$type","Polygon"],["!=","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3b82f6","line-width":2}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","$type","Polygon"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#2563eb","line-width":2}},{id:"gl-draw-lines-inactive",type:"line",filter:["all",["==","$type","LineString"],["!=","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3b82f6","line-width":2}},{id:"gl-draw-lines-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#2563eb","line-width":2}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["!=","active","true"]],paint:{"circle-radius":5,"circle-color":"#3b82f6"}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"]],paint:{"circle-radius":6,"circle-color":"#2563eb"}},{id:"gl-draw-polygon-and-line-vertex-halo-active",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-active",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#2563eb"}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","meta","midpoint"],["==","$type","Point"]],paint:{"circle-radius":4,"circle-color":"#1d4ed8"}}];function ce(){const m=W.value;return!m||!ve[m]?.url?"":ve[m].url}function Ee(m,_){return m?.id?String(m.id):m?.url?`${m.url}-${_}`:`layer-${_}`}function Ve(m){const _=String(m?.url??"").trim();if(!_)return"";if(/^https?:\/\//i.test(_))return _;const D=window.location?.origin??"",O=_.replace(/^\/+/,"");return`${D}/${O}`}function Ce(m){m&&F.value?.layerId!==m||(F.value=null)}function qe(m,_={}){return m.popup===!1?[]:Array.isArray(m.popup)?m.popup.length?m.popup.map(D=>{const O=D?.field||D?.name;if(!O)return null;const Z=_[O];return Z==null||Z===""?null:{key:D.label||O,value:String(Z)}}).filter(Boolean):[]:Object.entries(_).slice(0,5).map(([D,O])=>({key:D,value:O==null?"—":String(O)}))}function P(m){if(!Array.isArray(m))return[];const _=O=>Array.isArray(O)&&O.length>=2&&Number.isFinite(Number(O[0]))&&Number.isFinite(Number(O[1])),D=O=>{if(!O.length)return O;const Z=O[0],re=O[O.length-1];return!re||Z[0]!==re[0]||Z[1]!==re[1]?[...O,Z]:O};if(m.length&&_(m[0])){const O=m.map(Z=>[Number(Z[0]),Number(Z[1])]).filter(_);return O.length?[D(O)]:[]}return m.length&&Array.isArray(m[0])&&_(m[0][0])?m.map(Z=>Array.isArray(Z)?Z.map(re=>[Number(re[0]),Number(re[1])]):[]).filter(Z=>Z.length).map(D):m.length&&Array.isArray(m[0])&&Array.isArray(m[0][0])&&_(m[0][0][0])?m.flatMap(Z=>Array.isArray(Z)?Z:[]).map(Z=>Array.isArray(Z)?Z.map(re=>[Number(re[0]),Number(re[1])]):[]).filter(Z=>Z.length).map(D):[]}function J(m){const _=m.style??{},D=_.color??"#3b82f6";if(!_.colorAttr||!_.colorSet)return D;const O=Object.keys(_.colorSet);if(!O.length)return D;const Z=["match",["to-string",["get",_.colorAttr]]];return O.forEach(re=>{Z.push(String(re),_.colorSet?.[re]??D)}),Z.push(D),Z}function Q(m){if(!K)return;m.handlers.forEach(D=>{try{K.off(D.type,D.layerId,D.handler)}catch{}}),m.handlers=[],[...m.layerIds,...m.boundsIds].forEach(D=>{K.getLayer(D)&&K.removeLayer(D)}),K.getSource(m.sourceId)&&K.removeSource(m.sourceId);const _=`vs-ov-bounds-src-${m.id}`;K.getSource(_)&&K.removeSource(_),Ce(m.id)}function he(m,_){if(!K)return[];const D=`vs-ov-bounds-src-${_}`,O=`vs-ov-bounds-line-${_}`,Z=m.bounds??S.value??E.value,re=P(Z);if(!re.length)return[];const te={type:"FeatureCollection",features:re.map(fe=>({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:fe}}))};return K.getSource(D)&&K.removeSource(D),K.addSource(D,{type:"geojson",data:te}),K.addLayer({id:O,type:"line",source:D,paint:{"line-color":m.style?.stroke??m.style?.color??"#2563eb","line-width":m.style?.width??2,"line-opacity":m.style?.opacity??.8,"line-dasharray":[2,2]}}),[O]}function Be(m){if(!K)return;Q(m);const _=m.config,D=Ve(_);if(!D)return;const O=[],Z=[];if(/\.v(?:m)?t(?:\?|$)/i.test(D)||/\.pbf(?:\?|$)/i.test(D)){const fe=_.sourceLayer||_.layer||_.service_layer||_.dataset?.layer||_.id;K.addSource(m.sourceId,{type:"vector",tiles:[D]});const Se=String(_.style?.type??"polygon").toLowerCase(),Oe=J(_),Te=_.style?.opacity??.5;if(Se==="point"){const Xe=`vs-ov-point-${m.id}`;K.addLayer({id:Xe,type:"circle",source:m.sourceId,"source-layer":fe,paint:{"circle-color":Oe,"circle-radius":5,"circle-opacity":Te}}),O.push(Xe)}else if(Se==="polyline"||Se==="line"){const Xe=`vs-ov-line-${m.id}`;K.addLayer({id:Xe,type:"line",source:m.sourceId,"source-layer":fe,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":Oe,"line-width":_.style?.width??2,"line-opacity":Te}}),O.push(Xe)}else{const Xe=`vs-ov-fill-${m.id}`,It=`vs-ov-border-${m.id}`;K.addLayer({id:Xe,type:"fill",source:m.sourceId,"source-layer":fe,paint:{"fill-color":Oe,"fill-opacity":Te}}),K.addLayer({id:It,type:"line",source:m.sourceId,"source-layer":fe,paint:{"line-color":_.style?.stroke??_.style?.color??"#2563eb","line-width":_.style?.width??1,"line-opacity":Te}}),O.push(Xe,It)}}else{K.addSource(m.sourceId,{type:"raster",tiles:[D],tileSize:256});const fe=`vs-ov-raster-${m.id}`;K.addLayer({id:fe,type:"raster",source:m.sourceId,paint:{"raster-opacity":_.style?.opacity??1}}),O.push(fe)}O.forEach(fe=>{const Se=Te=>{if(!Te?.features?.length){Ce(m.id);return}const Xe=Te.features[0]?.properties??{},It=qe(m.config,Xe);if(!It.length){Ce(m.id);return}F.value={layerId:m.id,entries:It,point:{x:Te.point.x,y:Te.point.y}}},Oe=()=>Ce(m.id);K.on("mousemove",fe,Se),K.on("mouseleave",fe,Oe),Z.push({layerId:fe,type:"mousemove",handler:Se},{layerId:fe,type:"mouseleave",handler:Oe})}),m.layerIds=O,m.boundsIds=he(m.config,m.id),m.handlers=Z;const te=m.visible?"visible":"none";[...m.layerIds,...m.boundsIds].forEach(fe=>{K.getLayer(fe)&&K.setLayoutProperty(fe,"visibility",te)})}function Qe(){if(!K)return;const _={type:"FeatureCollection",features:P(S.value??E.value).map(D=>({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:D}}))};K.getSource(Rt)?K.getSource(Rt).setData(_):K.addSource(Rt,{type:"geojson",data:_}),K.getLayer(Pt)||K.addLayer({id:Pt,type:"line",source:Rt,paint:{"line-color":"#2563eb","line-width":2,"line-opacity":.8,"line-dasharray":[2,2]}})}function at(m){if(!K||a.value)return;const _=B[m];if(!_)return;_.visible=!_.visible;const D=_.visible?"visible":"none";[..._.layerIds,..._.boundsIds].forEach(O=>{K.getLayer(O)&&K.setLayoutProperty(O,"visibility",D)}),Ke(),_.visible||Ce(m)}function Ke(){if(!K)return;const m=[],_=[],D=[],O=[];M.value.forEach(te=>{const fe=B[te];if(!fe)return;const Se=String(fe.config?.url??""),Oe=/\.v(?:m)?t(?:\?|$)/i.test(Se),Te=/\.png(?:\?|$)/i.test(Se);Oe?D.push(...fe.layerIds):Te?m.push(...fe.layerIds):_.push(...fe.layerIds),O.push(...fe.boundsIds)}),[...m,..._,...D,...O].forEach(te=>{K.getLayer(te)&&K.moveLayer(te)}),K.getLayer(Pt)&&K.moveLayer(Pt),(K.getStyle?.()?.layers??[]).map(te=>String(te?.id??"")).filter(te=>te.startsWith("gl-draw-")).forEach(te=>{K.getLayer(te)&&K.moveLayer(te)})}function ft(m){if(!ve[m]||(W.value=m,!K))return;const _=ce();if(!_)return;const D=K.getCenter?.(),O=K.getZoom?.(),Z=se?.getAll?.();K.setStyle(ie(_)),K.once("style.load",()=>{if(K&&(D&&Number.isFinite(O)&&K.jumpTo({center:[D.lng,D.lat],zoom:O}),Qe(),M.value.forEach(re=>{const te=B[re];te&&Be(te)}),Ke(),Z?.features?.length&&se))try{Z.features.forEach(re=>se.add(re)),c.value=Z.features.length}catch{c.value=0}})}function ot(m){return m?m.type==="FeatureCollection"?m.features?.[0]?.geometry??null:m.type==="Feature"?m.geometry??null:m.geom?.type&&Array.isArray(m.geom.coordinates)?{type:m.geom.type,coordinates:m.geom.coordinates}:typeof m.type=="string"&&Array.isArray(m.coordinates)?m:null:null}function et(m){return{type:"Feature",properties:{},geometry:m}}function Ge(m){if(!m)return null;try{return JSON.parse(JSON.stringify(m))}catch{return null}}function it(m){if(!m)return"__null__";try{return JSON.stringify(m)}catch{return"__invalid__"}}function Dt(m){const _=an(m);if(!_)return null;const[[D,O],[Z,re]]=_;return{lat:(O+re)/2,lng:(D+Z)/2}}function Mt(m){if(!Array.isArray(m)||m.length<3)return 0;const _=(O,Z)=>{const re=O*2003750834e-2/180,te=Math.log(Math.tan((90+Z)*Math.PI/360))/(Math.PI/180);return[re,te*2003750834e-2/180]};let D=0;for(let O=0;O<m.length-1;O+=1){const[Z,re]=_(Number(m[O][0]),Number(m[O][1])),[te,fe]=_(Number(m[O+1][0]),Number(m[O+1][1]));D+=Z*fe-te*re}return Math.abs(D/2)/1e6}function rn(m){if(!m?.type||!m?.coordinates)return null;if(m.type==="Polygon"){const _=m.coordinates?.[0];return Array.isArray(_)?Mt(_):null}return m.type==="MultiPolygon"?m.coordinates.reduce((_,D)=>{const O=D?.[0];return Array.isArray(O)?_+Mt(O):_},0):null}function Tt(m){if(!m){d.value=null;return}const _=Dt(m);if(!_){d.value=null;return}d.value={type:String(m.type??"Feature"),center:_,areaKm2:rn(m)}}function ln(m,_){if(!Array.isArray(m)||!Array.isArray(_)||m.length!==2||_.length!==2)return!1;const D=1e-9;return Math.abs(Number(m[0])-Number(_[0]))<D&&Math.abs(Number(m[1])-Number(_[1]))<D}function an(m){if(!m)return null;let _=1/0,D=1/0,O=-1/0,Z=-1/0;const re=te=>{if(Array.isArray(te)){if(te.length>=2&&Number.isFinite(te[0])&&Number.isFinite(te[1])){const fe=Number(te[0]),Se=Number(te[1]);_=Math.min(_,fe),D=Math.min(D,Se),O=Math.max(O,fe),Z=Math.max(Z,Se);return}te.forEach(re)}};return re(m.coordinates),!Number.isFinite(_)||!Number.isFinite(D)?null:[[_,D],[O,Z]]}function on(m){if(!K||!m)return;const _=an(m);if(!_)return;const[[D,O],[Z,re]]=_;if(D===Z&&O===re){K.easeTo({center:[D,O],zoom:Math.max($.value,14)});return}K.fitBounds(_,{padding:30,duration:250,maxZoom:18})}function xt(){if(!se){c.value=0;return}const m=se.getAll();c.value=m?.features?.length??0}function I(){if(!se)return;const m=se.getAll();if(c.value=m?.features?.length??0,!m?.features?.length){Me=null,d.value=null,V||(Ie="__null__",l("update:modelValue",null));return}const _=Ge(m.features[m.features.length-1]?.geometry??null);Me=_,Tt(_),V||(Ie=it(_),l("update:modelValue",_))}function q(){if(!se)return;(se.getAll()?.features||[]).forEach(_=>se.delete(_.id)),xt()}function H(m){if(!se)return;const _=ot(m);if(V=!0,q(),_)try{se.add(et(_))}catch{}V=!1,Me=Ge(_),xt(),Tt(_),_&&(on(_),a.value||_e())}function le(){if(se){if(V=!0,q(),Me)try{se.add(et(Me))}catch{}V=!1,xt(),Tt(Me)}}function ke(){if(se){try{se.changeMode("simple_select",{featureIds:[]})}catch{}i.value=""}}function we(m){if(a.value||!se)return;G=!0,ke(),i.value=m;const _=m==="marker"?"draw_point":m==="polyline"?"draw_line_string":m==="rectangle"?"draw_rectangle":"draw_polygon";V=!0,q(),V=!1;try{se.changeMode(_)}catch{i.value=""}finally{requestAnimationFrame(()=>{G=!1})}}function _e(){if(a.value||!se)return;const m=se.getAll();if(m?.features?.length)try{se.changeMode("direct_select",{featureId:m.features[0].id}),i.value="edit"}catch{i.value=""}}function Ae(){a.value||!se||(ke(),q(),Ie="__null__",d.value=null,l("update:modelValue",null))}function Re(){a.value||!Me||on(Me)}function We(m){K&&K.easeTo({center:[m[1],m[0]],zoom:13,duration:250})}function st(){a.value||A.value?.click()}function Ze(m){if(a.value||!se)return;const _=m.target,D=_.files?.[0];if(!D)return;const O=new FileReader;O.onload=()=>{try{const Z=JSON.parse(String(O.result)),re=ot(Z);if(!re)return;H(re)}finally{_.value=""}},O.readAsText(D)}function Lt(){if(a.value||!se)return;const m=se.getAll(),_=new Blob([JSON.stringify(m,null,2)],{type:"application/json"}),D=URL.createObjectURL(_),O=document.createElement("a");O.href=D,O.download="data.geojson",O.click(),URL.revokeObjectURL(D)}return e.onMounted(async()=>{if(!s.value)return;const m=await ae();be=m.maplibregl,xe=m.MapboxDraw;const _=ce();_&&(K=new be.Map({container:s.value,style:ie(_),center:[L.value[0],L.value[1]],zoom:$.value,attributionControl:!1}),K.addControl(new be.NavigationControl({showCompass:!0}),"bottom-right"),K.on("load",()=>{if(!(!xe||!K)){if(se=new xe({displayControlsDefault:!1,modes:{...xe.modes,draw_rectangle:X()},controls:{point:!1,line_string:!1,polygon:!1,trash:!1},styles:oe}),K.addControl(se),K.on("draw.create",()=>{if(!se)return;const D=se.getAll();if(D.features.length>1){const O=D.features[D.features.length-1];V=!0,D.features.slice(0,-1).forEach(Z=>se.delete(Z.id)),V=!1,O&&(V=!0,se.add(O),V=!1)}I(),_e()}),K.on("draw.update",D=>{if(!z){if(D?.action==="move"){if(z=!0,le(),z=!1,i.value==="edit"){const O=se?.getAll?.()?.features?.[0];if(O?.id)try{se.changeMode("direct_select",{featureId:O.id})}catch{i.value=""}}return}I()}}),K.on("draw.delete",()=>{i.value==="marker"||i.value==="polyline"||i.value==="polygon"||i.value==="rectangle"||(I(),i.value="",ke())}),K.on("draw.selectionchange",()=>{if(!(!se||z)&&i.value!=="edit"&&!(i.value==="marker"||i.value==="polyline"||i.value==="polygon"||i.value==="rectangle")){if(!a.value&&c.value>0){_e();return}try{se.changeMode("simple_select",{featureIds:[]})}catch{}}}),v.value!==void 0){const D=v.value;v.value=void 0,requestAnimationFrame(()=>{se&&H(D)})}Qe(),M.value.forEach(D=>{const O=B[D];O&&Be(O)}),Ke()}}),K.on("zoomend",()=>{K&&($.value=K.getZoom())}))}),e.onUnmounted(()=>{Object.values(B).forEach(m=>{K&&Q(m)}),Ce(),K?.remove&&K.remove(),K=null,se=null}),e.watch(()=>n.modelValue,m=>{if(!se){v.value=m;return}const _=ot(m),D=it(_);if(Ie&&D===Ie){Ie=null;return}Ie=null,H(m)},{deep:!0}),e.watch(()=>x.value,m=>{const _=Array.isArray(m)?m:[],D=[],O=new Set;_.forEach((Z,re)=>{if(!Z)return;const te=Ee(Z,re);D.push(te),O.add(te);const fe={...Z,id:te},Se=B[te],Oe=Se?.visible??!!fe.visible;Se&&K&&Q(Se),B[te]={id:te,config:fe,visible:Oe,sourceId:`vs-ov-src-${te}`,layerIds:[],boundsIds:[],handlers:[]}}),Object.keys(B).forEach(Z=>{if(O.has(Z))return;const re=B[Z];re&&K&&Q(re),delete B[Z]}),M.value=D,K&&(M.value.forEach(Z=>{const re=B[Z];re&&Be(re)}),Ke())},{immediate:!0,deep:!0}),e.watch(()=>S.value,()=>{K&&(Qe(),M.value.forEach(m=>{const _=B[m];_&&Be(_)}),Ke())},{deep:!0}),e.watch(()=>k.value,async m=>{if(E.value=[],!m){K&&(Qe(),M.value.forEach(_=>{const D=B[_];D&&Be(D)}),Ke());return}try{const _=await fetch(`https://data.gki.com.ua/api-user/atu/${m}`);if(!_?.ok)return;const O=(await _.json())?.geometry?.coordinates;Array.isArray(O)&&O.length&&(E.value=O)}catch(_){console.error("Failed to fetch KATOTTG bounds",_)}finally{if(!K)return;Qe(),M.value.forEach(_=>{const D=B[_];D&&Be(D)}),Ke()}},{immediate:!0}),e.watch(()=>C.value,m=>{if(!Array.isArray(m)||m.length!==2)return;const _=[Number(m[0]),Number(m[1])];if(ln(L.value,_)||(L.value=[..._],!K))return;const D=K.getCenter?.();D&&ln([D.lng,D.lat],L.value)||K.easeTo({center:[L.value[0],L.value[1]]})},{deep:!0}),e.watch(()=>w.value,m=>{typeof m=="number"&&($.value=m,K&&K.setZoom(m))}),e.watch(a,m=>{m&&ke()}),e.watch(c,m=>{if(m>0){a.value||_e();return}G||ke()}),e.watch(o,()=>{setTimeout(()=>{K?.resize&&K.resize()},50)}),(m,_)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body",disabled:!o.value},[e.createElementVNode("div",{class:e.normalizeClass(["vs-map-wrapper relative w-full h-[400px]",{fullscreen:o.value}])},[e.createElementVNode("div",{ref_key:"mapContainer",ref:s,class:"w-full h-[calc(100%-28px)]"},null,512),j.value.search||j.value.import||j.value.export?(e.openBlock(),e.createElementBlock("div",Ys,[j.value.search?(e.openBlock(),e.createBlock(Ws,{key:0,onGoToCoordinates:We})):e.createCommentVNode("",!0),j.value.import||j.value.export?(e.openBlock(),e.createElementBlock("div",Zs,[e.createElementVNode("div",Xs,[j.value.import?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:st,disabled:a.value}," Import ",8,Js)):e.createCommentVNode("",!0),j.value.export?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:Lt,disabled:a.value||c.value===0}," Export ",8,Qs)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"importRef",ref:A,type:"file",onChange:Ze,accept:".json,.geojson",class:"hidden",disabled:a.value},null,40,ei)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",ti,[e.createElementVNode("div",ni,[j.value.point?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-btn",{"vs-active":i.value==="marker"}]),title:"Point",onClick:_[0]||(_[0]=D=>we("marker")),disabled:a.value},[e.createVNode(e.unref(R.MapPin),{class:"h-4 w-4"})],10,ri)):e.createCommentVNode("",!0),j.value.line?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["vs-btn",{"vs-active":i.value==="polyline"}]),title:"Line",onClick:_[1]||(_[1]=D=>we("polyline")),disabled:a.value},[e.createVNode(Bs)],10,li)):e.createCommentVNode("",!0),j.value.polygon?(e.openBlock(),e.createElementBlock("button",{key:2,class:e.normalizeClass(["vs-btn",{"vs-active":i.value==="polygon"}]),title:"Polygon",onClick:_[2]||(_[2]=D=>we("polygon")),disabled:a.value},[e.createVNode(As)],10,ai)):e.createCommentVNode("",!0),j.value.rectangle?(e.openBlock(),e.createElementBlock("button",{key:3,class:e.normalizeClass(["vs-btn",{"vs-active":i.value==="rectangle"}]),title:"Rectangle",onClick:_[3]||(_[3]=D=>we("rectangle")),disabled:a.value},[e.createVNode(Ms)],10,oi)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:_[4]||(_[4]=D=>o.value=!o.value),title:"Full Screen"},[e.createVNode(e.unref(R.Maximize),{class:"h-4 w-4"})])])]),T.value.length?(e.openBlock(),e.createElementBlock("div",{key:1,class:"absolute z-[1500] pointer-events-none",style:e.normalizeStyle(U.value)},[e.createElementVNode("div",si,[e.createElementVNode("dl",ii,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.value,D=>(e.openBlock(),e.createElementBlock("div",{key:`${D.key}-${D.value}`,class:"flex justify-between gap-2"},[e.createElementVNode("dt",ci,e.toDisplayString(D.key),1),e.createElementVNode("dd",di,e.toDisplayString(D.value),1)]))),128))])])],4)):e.createCommentVNode("",!0),e.createElementVNode("div",ui,[e.createElementVNode("div",pi,[e.createVNode(zs,{basemaps:e.unref(ve),onOnLayerChange:ft},null,8,["basemaps"]),N.value.length?(e.openBlock(),e.createElementBlock("div",fi,[_[5]||(_[5]=e.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Шари",-1)),e.createElementVNode("div",mi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,D=>(e.openBlock(),e.createElementBlock("label",{key:D.id,class:"flex items-center gap-2 cursor-pointer select-none"},[e.createElementVNode("input",{type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:D.visible,disabled:a.value,onChange:O=>at(D.id)},null,40,hi),e.createElementVNode("span",gi,e.toDisplayString(D.config.title||D.config.name||D.id),1)]))),128))])])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",yi,[d.value?(e.openBlock(),e.createElementBlock("div",bi,[e.createElementVNode("div",ki,[e.createElementVNode("div",xi,[_[6]||(_[6]=e.createTextVNode(" Type: ",-1)),e.createElementVNode("span",wi,e.toDisplayString(d.value.type),1)])]),e.createElementVNode("div",_i,[e.createElementVNode("div",vi,[_[7]||(_[7]=e.createTextVNode(" Center: ",-1)),e.createElementVNode("b",null,e.toDisplayString(d.value.center.lat.toFixed(5))+", "+e.toDisplayString(d.value.center.lng.toFixed(5)),1)]),d.value.areaKm2!==null?(e.openBlock(),e.createElementBlock("div",Ci,[_[8]||(_[8]=e.createTextVNode(" Area: ",-1)),e.createElementVNode("b",null,e.toDisplayString(d.value.areaKm2.toFixed(1))+" km²",1)])):(e.openBlock(),e.createElementBlock("div",Ei,_[9]||(_[9]=[e.createTextVNode("Area: ",-1),e.createElementVNode("b",null,"—",-1)]))),e.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Zoom to feature",onClick:Re,disabled:a.value},[e.createVNode(e.unref(R.ZoomIn),{class:"h-3 w-3"})],8,Bi),e.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Delete feature",onClick:Ae,disabled:a.value},[e.createVNode(e.unref(R.Trash2),{class:"h-4 w-4"})],8,Vi)])])):e.createCommentVNode("",!0)])],2)],8,["disabled"]))}}),[["__scopeId","data-v-67b0a2ef"]]),Si=["data-focus"],$i={class:"flex items-center"},Ai={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},Fi=["onClick","aria-label"],Ni={key:0,class:"absolute text-gray-500 truncate pl-2"},Di={class:"flex-1 min-w-[2px]"},Mi=["placeholder"],Ti={class:"flex items-center shrink-0"},Li=["disabled"],Jn=e.defineComponent({__name:"vs-input-tag",props:e.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue"],["update:modelValue"]),setup(r,{emit:t}){const n=r,l=t;Le(n.style);const a=e.ref(null),o=e.ref(null),s=e.ref(null),c=e.ref(!1),i=e.ref(""),d=e.useModel(r,"modelValue"),u=e.computed(()=>n.placeholder||"Add tag…"),p=e.computed(()=>d.value?.length===0&&i.value===""),g=e.computed(()=>!n.disabled&&d.value?.length>0),f=e.computed(()=>n.disabled),y=async()=>{f.value||await e.nextTick(()=>s.value?.focus())},h=L=>{const $=L.trim();$!==""&&(!d.value||!Array.isArray(d.value)?d.value=[$]:n.unique?d.value.includes($)||(d.value=[...d.value,$]):d.value=[...d.value,$],i.value="")},b=()=>{const L=i.value;L.trim()!==""&&h(L),i.value=""},C=L=>{const $=d.value.slice();$.splice(L,1),l("update:modelValue",$)},w=()=>{l("update:modelValue",[])},k=()=>{f.value||(c.value=!0)},x=()=>{c.value=!1,!f.value&&b()},S=L=>{const{key:$}=L;$==="Enter"?(L.preventDefault(),b()):$==="Backspace"&&i.value===""&&d.value.length>0&&C(d.value.length-1)};return(L,$)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:a,onClick:$[1]||($[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass]),role:"group","aria-label":"Tag input"},[e.createElementVNode("div",{class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",c.value?"border-blue-500 ring-1 ring-blue-500":"",f.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":c.value?"true":"false",onClick:y},[e.createElementVNode("div",{class:"flex flex-1 flex-wrap items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"chipsRef",ref:o},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(v,A)=>(e.openBlock(),e.createElementBlock("div",{key:A,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[e.createElementVNode("div",$i,[e.createElementVNode("div",Ai,e.toDisplayString(v),1)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:e.withModifiers(E=>C(A),["stop"]),"aria-label":`Remove ${v}`},[e.createVNode(e.unref(R.X),{"aria-hidden":"true",focusable:"false",class:"inline-block h-4 w-4"})],8,Fi)]))),128)),p.value?(e.openBlock(),e.createElementBlock("div",Ni,e.toDisplayString(u.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Di,[f.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:s,class:"pl-2 w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-label":"Add tag","onUpdate:modelValue":$[0]||($[0]=v=>i.value=v),onFocus:k,onBlur:x,onKeydown:S,placeholder:d.value&&d.value.length?"":void 0},null,40,Mi)),[[e.vModelText,i.value]])])],512),e.createElementVNode("div",Ti,[g.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:f.value,onClick:e.withModifiers(w,["stop"])},[e.createVNode(e.unref(R.X),{class:"h-4 w-4"})],8,Li)):e.createCommentVNode("",!0)])],10,Si)],2)],512))}}),Ii={class:"relative flex gap-1 bg-white w-full"},Oi=["disabled","placeholder"],Qn=pe(e.defineComponent({__name:"vs-input-slug",props:e.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=e.inject("values"),n=r,l=e.useModel(r,"modelValue");function a(s){const c={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"y",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"kh",ц:"ts",ч:"ch",ш:"sh",щ:"shch",ы:"y",э:"e",ю:"yu",я:"ya",ь:"",ъ:"",є:"ye",і:"i",ї:"yi",ґ:"g"};return s.toLowerCase().split("").map(i=>c[i]||i).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const o=()=>{const s=t?.value?.[n.parent||""]?.toString(),c=a(s);l.value=c.toString()};return(s,c)=>(e.openBlock(),e.createElementBlock("div",Ii,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:s.disabled,placeholder:s.placeholder,"onUpdate:modelValue":c[0]||(c[0]=i=>l.value=i),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,Oi),[[e.vModelText,l.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:o}," Gen ")]))}}),[["__scopeId","data-v-b0eba370"]]),zi={class:"relative flex gap-1 bg-white w-full"},Ri=["disabled","placeholder"],Pi=["disabled"],ji={key:0},Ui={key:1},er=pe(e.defineComponent({__name:"vs-input-codegen",props:e.mergeModels({table:{},code:{},init:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),l=e.ref(!1),a=e.computed(()=>t.init!==!1),o=e.computed(()=>!!t.table&&!!t.code),s=()=>{if(!o.value)return"";const d=encodeURIComponent(String(t.table)),u=encodeURIComponent(String(t.code));return`/api/code-gen/${d}/${u}`},c=async()=>{if(!o.value||l.value)return;const d=s();if(d){l.value=!0;try{const p=await(await fetch(d)).text();n.value=p}finally{l.value=!1}}},i=()=>{a.value&&(n.value||c())};return e.onMounted(()=>{i()}),e.watch(()=>[t.table,t.code,t.init],()=>{i()}),(d,u)=>(e.openBlock(),e.createElementBlock("div",zi,[e.withDirectives(e.createElementVNode("input",{disabled:d.disabled,placeholder:d.placeholder,"onUpdate:modelValue":u[0]||(u[0]=p=>n.value=p),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,Ri),[[e.vModelText,n.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:l.value||d.disabled||!o.value,onClick:c},[l.value?(e.openBlock(),e.createElementBlock("span",Ui,"...")):(e.openBlock(),e.createElementBlock("span",ji,"Gen"))],8,Pi)]))}}),[["__scopeId","data-v-6ee5237d"]]),Hi={class:"w-full"},qi={ref:"sortableContainer",class:"flex flex-col gap-1"},Ki=["onDragstart","onDrop"],Gi={class:"cursor-move",type:"button"},Wi={class:"w-1/3"},Yi={class:"w-2/3"},Zi=["onClick"],Xi={key:0,class:"text-[14px] text-gray-700"},Ji={class:"mt-2 w-full flex items-center"},Qi=["disabled"],tr=pe(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(r,{emit:t}){const n=b=>`${b}-${Math.random().toString(36).substring(2,15)}`,l=e.inject("values"),a=r,o=t,s=a.addButtonText??"Додати",c=a.ignore??[],i=e.ref([]),d=e.ref(null);(()=>{const b=a.parent&&l?.value?.[a.parent]||a.modelValue||{};i.value=Object.entries(b).filter(([C])=>!c.includes(C)).map(([C,w])=>({id:n("key-value-"),key:C,value:w}))})();function p(b){d.value=b}function g(b){if(d.value===null||d.value===b)return;const C=i.value.splice(d.value,1)[0];i.value.splice(b,0,C),d.value=null}const f=e.computed(()=>i.value.some(b=>b.key&&!b.value||!b.key&&b.value)),y=()=>{i.value.push({id:n("key-value-"),key:"",value:""})},h=b=>{i.value=i.value.filter(C=>C.id!==b)};return e.watch(i,b=>{const C={};b.forEach(k=>{k.key&&k.value!==void 0&&(C[k.key]=k.value)});const w={};c.length&&c.forEach(k=>{w[k]=a.parent?l?.value?.[a.parent]?.[k]:void 0}),l?.value&&a.parent&&(l.value[a.parent]={...w,...C}),o("update:modelValue",C)},{deep:!0}),(b,C)=>(e.openBlock(),e.createElementBlock("div",Hi,[e.createElementVNode("div",qi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(w,k)=>(e.openBlock(),e.createElementBlock("div",{key:w.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===k}]),draggable:"true",onDragstart:x=>p(k),onDragover:C[0]||(C[0]=e.withModifiers(()=>{},["prevent"])),onDrop:x=>g(k)},[e.createElementVNode("button",Gi,[e.createVNode(e.unref(R.GripVertical),{class:"h-4 w-4"})]),e.createElementVNode("div",Wi,[e.createVNode(yt,{modelValue:w.key,"onUpdate:modelValue":x=>w.key=x,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Yi,[e.createVNode(yt,{modelValue:w.value,"onUpdate:modelValue":x=>w.value=x,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:x=>h(w.id),class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200"},[e.createVNode(e.unref(R.X),{class:"h-4 w-4"})],8,Zi)],42,Ki))),128))],512),i.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Xi," Дані для відображення відсутні ")),e.createElementVNode("div",Ji,[e.createElementVNode("button",{type:"button",onClick:y,disabled:f.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(e.unref(R.Plus),{class:"h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(e.unref(s)),1)],8,Qi)])]))}}),[["__scopeId","data-v-d8c3f9d6"]]),ec={class:"w-full"},tc={ref:"sortableContainer",class:"flex flex-col gap-1"},nc=["onDragstart","onDrop"],rc=["disabled"],lc={class:"flex-1"},ac=["onClick","disabled"],oc={key:0,class:"text-[14px] text-gray-700"},sc={class:"mt-2 w-full flex items-center"},ic=["disabled"],nr=pe(e.defineComponent({__name:"vs-input-text-array",props:e.mergeModels({addButtonText:{default:"Додати"},inputType:{default:"text"},placeholder:{default:"Значення"},mask:{default:""},disabled:{type:Boolean,default:!1}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),l=e.ref([]),a=e.ref(null),o=e.computed(()=>!!t.disabled),s=e.computed(()=>t.placeholder??""),c=e.computed(()=>t.addButtonText??"Додати");let i=!1;const d=b=>`${b}-${Math.random().toString(36).substring(2,15)}`,u=b=>{const C=b??n.value??[];l.value=C.map((w,k)=>({id:l.value[k]?.id??d("text-array"),value:w??""}))};u(),e.watch(()=>n.value,b=>{if(i){i=!1;return}u(b||[])},{deep:!0}),e.watch(l,b=>{i=!0,n.value=b.map(C=>C.value).filter(C=>C!=null&&C!=="")},{deep:!0});const p=e.computed(()=>o.value||l.value.some(b=>!b.value));function g(){p.value||(l.value=[...l.value,{id:d("text-array"),value:""}])}function f(b){o.value||(l.value=l.value.filter(C=>C.id!==b))}function y(b){o.value||(a.value=b)}function h(b){if(o.value||a.value===null||a.value===b)return;const C=[...l.value],[w]=C.splice(a.value,1);C.splice(b,0,w),l.value=C,a.value=null}return(b,C)=>(e.openBlock(),e.createElementBlock("div",ec,[e.createElementVNode("div",tc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(w,k)=>(e.openBlock(),e.createElementBlock("div",{key:w.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":a.value===k}]),draggable:"true",onDragstart:x=>y(k),onDragover:C[0]||(C[0]=e.withModifiers(()=>{},["prevent"])),onDrop:x=>h(k)},[e.createElementVNode("button",{class:"cursor-move",type:"button",disabled:o.value},[e.createVNode(e.unref(R.GripVertical),{class:"h-4 w-4"})],8,rc),e.createElementVNode("div",lc,[b.inputType==="text"?(e.openBlock(),e.createBlock(yt,{key:0,modelValue:w.value,"onUpdate:modelValue":x=>w.value=x,disabled:o.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),b.inputType==="tel"?(e.openBlock(),e.createBlock(fn,{key:1,modelValue:w.value,"onUpdate:modelValue":x=>w.value=x,disabled:o.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),b.inputType==="email"?(e.openBlock(),e.createBlock(pn,{key:2,modelValue:w.value,"onUpdate:modelValue":x=>w.value=x,disabled:o.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),b.inputType==="mask"?(e.openBlock(),e.createBlock(un,{key:3,modelValue:w.value,"onUpdate:modelValue":x=>w.value=x,mask:b.mask,disabled:o.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","mask","disabled","placeholder"])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:x=>f(w.id),disabled:o.value,class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200 disabled:opacity-50"},[e.createVNode(e.unref(R.X),{class:"h-4 w-4"})],8,ac)],42,nc))),128))],512),l.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",oc," Дані для відображення відсутні ")),e.createElementVNode("div",sc,[e.createElementVNode("button",{type:"button",onClick:g,disabled:p.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(e.unref(R.Plus),{class:"h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(c.value),1)],8,ic)])]))}}),[["__scopeId","data-v-2c229b1f"]]),cc={class:"flex items-center gap-2 w-full"},dc=["disabled"],uc=["disabled"],rr=e.defineComponent({__name:"vs-input-color",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r,{inputClass:l}=Le(n.style),a=t,o=e.computed({get:()=>n.modelValue||"#000000",set:c=>a("update:modelValue",c)}),s=e.computed(()=>!!n.disabled);return(c,i)=>(e.openBlock(),e.createElementBlock("div",cc,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":i[0]||(i[0]=d=>o.value=d),disabled:s.value,ref:"color",class:e.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[c.modelValue?"":"text-opacity-50",e.unref(l)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,dc),[[e.vModelText,o.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":i[1]||(i[1]=d=>o.value=d),disabled:s.value},null,8,uc),[[e.vModelText,o.value]])]))}}),pc={class:"flex items-center gap-2 w-full"},fc=["min","max","step","disabled"],mc=["disabled"],lr=e.defineComponent({__name:"vs-input-range",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},min:{default:0},max:{default:100},step:{default:1}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r,{inputClass:l}=Le(n.style),a=t,o=e.computed({get:()=>Number(n.modelValue??n.min),set:c=>a("update:modelValue",Number(c))}),s=e.computed(()=>!!n.disabled);return(c,i)=>(e.openBlock(),e.createElementBlock("div",pc,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":i[0]||(i[0]=d=>o.value=d),min:c.min,max:c.max,step:c.step,disabled:s.value,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[c.modelValue?"":"text-opacity-50",e.unref(l)].join(" ")])},null,10,fc),[[e.vModelText,o.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":i[1]||(i[1]=d=>o.value=d),disabled:s.value},null,8,mc),[[e.vModelText,o.value]])]))}}),hc=["placeholder","disabled","name"],gc=["type","value","onInput","placeholder","disabled"],yc=["onClick"],ar=e.defineComponent({__name:"vs-input-array",props:e.mergeModels({count:{default:1},limit:{default:1},mask:{default:""},unmask:{type:Boolean,default:!1},inputType:{default:"text"},isAdded:{type:Boolean,default:!1},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.ref(t.count),l=e.computed(()=>t.limit),{inputClass:a}=Le(t.style),o=e.useModel(r,"modelValue"),s=e.computed(()=>!!t.disabled),c=e.computed(()=>t.placeholder??"");e.watchEffect(()=>{const h=o.value?.length??0;h<n.value&&(o.value=[...o.value??[],...Array(n.value-h)])});const i=e.ref({}),d=e.ref({});function u(h,b){h&&(i.value[b]=h)}async function p(h,b){if(!h||t.inputType!=="mask")return;const{default:C}=await Promise.resolve().then(()=>Nn);d.value[b]&&d.value[b].destroy(),d.value[b]=C(h,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),d.value[b].on("accept",()=>{const w=[...o.value||[]];w[b]=t.unmask?d.value[b].unmaskedValue:d.value[b].value,o.value=w}),d.value[b].on("complete",()=>{const w=[...o.value||[]];w[b]=t.unmask?d.value[b].unmaskedValue:d.value[b].value,o.value=w}),o.value?.[b]&&(d.value[b].value=o.value[b])}function g(h,b){if(s.value)return;const C=h.target.value??null,w=[...o.value];w[b]=t.inputType==="text"?C:Number(C),o.value=w}function f(){n.value+=1;const h=t.inputType==="text"||t.inputType==="mask"?null:0;o.value=[...o.value,h],t.inputType==="mask"&&setTimeout(()=>{const b=n.value-1;i.value[b]&&p(i.value[b],b)},0)}function y(h){if(n.value>1){d.value[h]&&(d.value[h].destroy(),delete d.value[h]),n.value-=1,o.value=o.value.filter((C,w)=>w!==h);const b={};Object.keys(d.value).forEach(C=>{const w=parseInt(C,10);w>h?b[w-1]=d.value[w]:w<h&&(b[w]=d.value[w])}),d.value=b}}return e.onMounted(()=>{if(t.inputType==="mask")for(let h=0;h<n.value;h+=1)i.value[h]&&p(i.value[h],h)}),e.onBeforeUnmount(()=>{Object.values(d.value).forEach(h=>{h&&h.destroy()})}),e.watch(()=>t.mask,h=>{t.inputType==="mask"&&Object.values(d.value).forEach(b=>{b&&b.updateOptions({mask:h,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})})}),e.watch(o,h=>{t.inputType==="mask"&&h&&h.forEach((b,C)=>{d.value[C]&&d.value[C].value!==b&&(d.value[C].value=b||"")})},{deep:!0}),(h,b)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["grid gap-2",`grid-cols-${l.value}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,C=>(e.openBlock(),e.createElementBlock("div",{key:C,class:"flex items-center gap-2 w-full"},[h.inputType==="mask"?(e.openBlock(),e.createElementBlock("input",{key:0,type:"text",ref_for:!0,ref:w=>u(w,C-1),placeholder:h.placeholder,disabled:h.disabled,name:`${h.name}[${C-1}]`,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(a),{"!border-red-600":h.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,hc)):(e.openBlock(),e.createElementBlock("input",{key:1,type:h.inputType,value:o.value?.[C-1],onInput:w=>g(w,C-1),placeholder:c.value,disabled:s.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(a),{"!border-red-600":h.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,gc)),!h.disabled&&C===n.value&&h.isAdded?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:e.withModifiers(f,["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-green-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(e.unref(R.Plus),{class:"h-4 w-4"})])):e.createCommentVNode("",!0),!h.disabled&&n.value>1&&h.isAdded?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",onClick:e.withModifiers(w=>y(C-1),["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-red-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(e.unref(R.X),{class:"h-4 w-4"})],8,yc)):e.createCommentVNode("",!0)]))),128))],2))}}),bc=["aria-expanded","data-focus"],kc=["placeholder","disabled","readonly"],xc={class:"max-h-full"},wc=["onClick","disabled"],_c={key:0,class:"px-3 py-2 text-sm text-stone-500"},vc={class:"flex flex-col gap-1"},Cc=["onDragstart","onDrop"],Ec=["disabled"],Bc=["title"],Vc=["disabled","onClick","aria-label"],Sc={key:0,class:"text-xs text-stone-500"},jt=pe(e.defineComponent({__name:"vs-input-array-select",props:e.mergeModels({options:{default:()=>[]},data:{default:""},api:{default:""},prefix:{default:"api"},host:{default:""},parent:{},search:{type:Boolean,default:!0},maxHeight:{default:280},start:{default:0},slot:{},disabled:{type:Boolean,default:!1},style:{},customClass:{},modelValue:{},error:{},name:{},placeholder:{default:"Оберіть значення"},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["change","update:modelValue","value-selected"],["update:modelValue"]),setup(r,{emit:t}){const n=r,l=t,a=e.useModel(r,"modelValue"),o=e.ref([]),s=e.ref(n.options??[]),c=e.ref({}),i=e.ref({}),d=e.ref({keyword:"",parent:null}),u=e.ref(""),p=e.ref(!1),g=e.ref(null),f=e.ref(null),y=e.ref(null),h=e.ref(null),b=e.ref(null),C=e.ref({});let w=!1,k=!1;const x=e.inject("values"),S=e.computed(()=>!!n.disabled),L=e.computed(()=>n.placeholder??"Оберіть значення"),$=e.computed(()=>n.search!==!1),v=e.computed(()=>{const P=n.parent??n.parentValue;return P?String(P):""}),A=e.computed(()=>v.value?x?.value?.[v.value]??null:null),E=P=>P==null?"__null__":String(P),V=P=>{if(!P)return"";const J=P.label??P.text??P.name??P.ua??P.en;return J?String(J):P.id!==void 0&&P.id!==null?String(P.id):""},B=P=>{const J=E(P);return i.value[J]||(i.value[J]=`array-select-${J}-${Math.random().toString(36).slice(2,8)}`),i.value[J]},M=e.computed(()=>new Set(o.value.map(P=>E(P.id)))),N=e.computed(()=>{const P=M.value;let J=[...s.value];if(!n.data&&u.value.trim()){const Q=u.value.toLowerCase();J=J.filter(he=>V(he).toLowerCase().includes(Q))}return J.filter(Q=>!P.has(E(Q.id)))}),F=()=>{if(!n.data)return"";const P=n.prefix??"api",J=n.api??`/${P}/suggest/${n.data}`;return`${n.host??""}${J}`},T=()=>{o.value.length&&(w=!0,o.value=o.value.map(P=>({...P,text:c.value[E(P.id)]??P.text})))},U=P=>{const J=E(P.id),Q=V(P);Q&&(c.value[J]=Q)},j=P=>{s.value=P?[...P]:[],P?.forEach(U),T()},Y=P=>{if(!P.length)return;const J=new Map(s.value.map(Q=>[E(Q.id),Q]));P.forEach(Q=>{const he=E(Q.id);J.set(he,Q),U(Q)}),s.value=Array.from(J.values()),T()},ee=async(P="")=>{if(!n.data)return[];const J=F();if(!J)return[];const Q=new URLSearchParams;Q.set("json","1"),P&&Q.set("key",P),n.start===1&&Q.set("start","1"),A.value!==null&&A.value!==void 0&&A.value!==""&&Q.set("parent",String(A.value));try{return(await(await fetch(`${J}?${Q.toString()}`)).json())?.data??[]}catch{return[]}},ve=async P=>{if(!n.data||!P.length)return[];const J=F();if(!J)return[];const Q=Array.from(new Set(P.map(Be=>E(Be)))),he=new URLSearchParams;he.set("json","1"),he.set("val",Q.join(",")),n.start===1&&he.set("start","1"),A.value!==null&&A.value!==void 0&&A.value!==""&&he.set("parent",String(A.value));try{const at=(await(await fetch(`${J}?${he.toString()}`)).json())?.data??[];return Y(at),at}catch{return[]}},ye=async(P="",{force:J=!1}={})=>{if(!n.data)return;const Q=A.value??null;if(!J&&d.value.keyword===P&&d.value.parent===Q&&s.value.length>0)return;d.value={keyword:P,parent:Q};const Be=await ee(P);j(Be)},ae=((P,J=200)=>{let Q;return(...he)=>{Q&&clearTimeout(Q),Q=setTimeout(()=>P(...he),J)}})(async P=>{n.data&&await ye(P,{force:!0})},250),ie=e.ref(null),be=()=>{if(!y.value)return;const P=y.value.getBoundingClientRect(),J=window.innerHeight??document.documentElement.clientHeight,Q=window.innerWidth??document.documentElement.clientWidth,he=8,Be=8,Qe=n.maxHeight??280,at=J-P.bottom-Be-he,Ke=P.top-Be-he,ft=at>=Ke,ot=Math.max(Q-he*2,0);let{width:et}=P;ot>0&&et>ot&&(et=ot);let{left:Ge}=P;Ge+et+he>Q&&(Ge=Q-et-he),Ge=Math.max(Ge,he);const it=Math.min(Qe,Math.max(ft?at:Ke,50));C.value={position:"fixed",left:`${Ge}px`,width:`${et}px`,maxHeight:`${it}px`,transform:ft?"none":"translateY(-100%)",top:ft?`${P.bottom+Be}px`:`${P.top-Be}px`}},xe=async(P="click")=>{S.value||p.value||(ie.value=P,await ye(u.value.trim()),p.value=!0,await e.nextTick(),be(),b.value?.focus())},K=()=>{p.value=!1,ie.value=null,e.nextTick(()=>{b.value?.blur()})},se=async P=>{if(P.stopPropagation(),!S.value){if(p.value){if(ie.value==="focus"){ie.value=null;return}K();return}await xe("click")}},Me=P=>{P.key==="Escape"&&K()},Ie=P=>{if(!p.value)return;const J=P.target;h.value?.contains(J)||K()},z=P=>{const J=P.target;f.value?.contains(J)||h.value?.contains(J)||K()},G=P=>{if(P.key==="Escape"){P.preventDefault(),K();return}if(P.key==="Enter"){P.preventDefault();const J=N.value[0];J&&X(J)}},X=P=>{if(!P)return;const J=E(P.id);if(M.value.has(J))return;U(P);const Q={id:P.id,text:V(P)||String(P.id??""),key:B(P.id)};o.value=[...o.value,Q],oe(P),u.value="",e.nextTick(()=>{b.value?.focus()})},oe=P=>{const J=o.value.map(Q=>Q.id);l("value-selected",{name:n.name,value:J,option:P})},ce=P=>{if(S.value)return;const J=o.value.filter(Q=>E(Q.id)!==E(P));o.value=J},Ee=P=>{S.value||(g.value=P)},Ve=P=>{if(S.value||g.value===null||g.value===P)return;const J=[...o.value],[Q]=J.splice(g.value,1);J.splice(P,0,Q),g.value=null,o.value=J},Ce=async()=>{const J=(Array.isArray(a.value)?[...a.value]:[]).filter(he=>he!=null);if(n.data&&J.length){const he=J.filter(Be=>!c.value[E(Be)]);he.length&&await ve(he)}const Q=J.map(he=>({id:he,text:c.value[E(he)]??String(he),key:B(he)}));w=!0,o.value=Q};e.watch(o,P=>{if(w){w=!1;return}const J=P.map(Q=>Q.id);k=!0,a.value=J,l("change",J)},{deep:!0}),e.watch(a,()=>{if(k){k=!1;return}Ce()},{deep:!0}),e.watch(u,P=>{!n.data||!p.value||ae(P.trim())}),e.watch(S,P=>{P&&K()}),e.watch(()=>n.options,async P=>{n.data||(j(P??[]),await Ce())},{immediate:!0,deep:!0}),e.watch(()=>n.data,async P=>{P&&(await ye(u.value.trim()),await Ce())},{immediate:!0});const qe=e.ref(!1);return e.watch(A,async()=>{if(n.data){if(!qe.value){qe.value=!0;return}o.value=[],await ye(u.value.trim()),await Ce()}}),e.onMounted(async()=>{document.addEventListener("click",z,!0),window.addEventListener("keydown",Me),window.addEventListener("scroll",Ie,!0),await Ce()}),e.onUnmounted(()=>{document.removeEventListener("click",z,!0),window.removeEventListener("keydown",Me),window.removeEventListener("scroll",Ie,!0)}),(P,J)=>(e.openBlock(),e.createElementBlock("div",{class:"flex flex-col gap-2 w-full",ref_key:"rootRef",ref:f},[e.createElementVNode("div",{class:"relative",onClick:J[2]||(J[2]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{ref_key:"triggerRef",ref:y,class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white px-3","border-gray-300 hover:border-[#b3d4ff]",p.value?"border-[#2684ff] ring-1 ring-[#2684ff] shadow-[0_0_0_1px_rgba(38,132,255,0.5)]":"",S.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":p.value,"aria-haspopup":"listbox","data-focus":p.value?"true":"false",onClick:se},[e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:b,"onUpdate:modelValue":J[0]||(J[0]=Q=>u.value=Q),placeholder:L.value,disabled:S.value,readonly:!$.value,onFocus:J[1]||(J[1]=()=>xe("focus")),onKeydown:G,class:"flex-1 bg-transparent border-0 outline-none px-0 py-1 text-sm text-stone-900 placeholder:text-stone-400"},null,40,kc),[[e.vModelText,u.value]]),e.createElementVNode("span",{class:e.normalizeClass(["text-stone-400 transition-transform duration-150",p.value?"rotate-180":""]),"aria-hidden":"true"},[e.createVNode(e.unref(R.ChevronDown),{class:"h-4 w-4"})],2)],10,bc),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[p.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:h,class:"fixed z-[3000] rounded-md border border-stone-200 bg-white shadow-lg overflow-auto",style:e.normalizeStyle(C.value)},[e.createElementVNode("div",xc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,Q=>(e.openBlock(),e.createElementBlock("button",{key:E(Q.id),type:"button",class:"w-full px-3 py-2 text-left text-sm text-stone-900 hover:bg-stone-100 disabled:opacity-50",onClick:e.withModifiers(he=>X(Q),["stop"]),disabled:S.value},e.toDisplayString(V(Q)),9,wc))),128)),N.value.length===0?(e.openBlock(),e.createElementBlock("p",_c," Немає варіантів ")):e.createCommentVNode("",!0)])],4)):e.createCommentVNode("",!0)]),_:1})]))]),e.createElementVNode("div",vc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(Q,he)=>(e.openBlock(),e.createElementBlock("div",{key:Q.key,class:e.normalizeClass(["flex items-center gap-2 rounded-md border border-stone-200 bg-white px-2 py-2",{"opacity-60":g.value===he}]),draggable:"true",onDragstart:Be=>Ee(he),onDragover:J[3]||(J[3]=e.withModifiers(()=>{},["prevent"])),onDrop:Be=>Ve(he),onDragend:J[4]||(J[4]=Be=>g.value=null)},[e.createElementVNode("button",{type:"button",class:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-stone-500 hover:text-stone-900",disabled:S.value,"aria-label":"Перетягнути"},[e.createVNode(e.unref(R.GripVertical),{class:"h-4 w-4"})],8,Ec),e.createElementVNode("div",{class:"flex-1 text-sm text-stone-900",title:Q.text},e.toDisplayString(Q.text),9,Bc),e.createElementVNode("button",{type:"button",class:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-stone-400 hover:text-stone-900",disabled:S.value,onClick:e.withModifiers(Be=>ce(Q.id),["stop"]),"aria-label":`Видалити ${Q.text}`},[e.createVNode(e.unref(R.X),{class:"h-4 w-4"})],8,Vc)],42,Cc))),128)),o.value.length===0?(e.openBlock(),e.createElementBlock("p",Sc,"Немає вибраних значень")):e.createCommentVNode("",!0)])],512))}}),[["__scopeId","data-v-56e6cd88"]]),$c={class:"flex items-center gap-2 w-full"},Ac={class:"relative flex-1"},Fc=["placeholder","disabled","onKeydown"],Nc=["disabled"],Dc={key:0,class:"fixed inset-0 z-[1000] flex items-center justify-center bg-black/50"},Mc={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},Tc={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},Lc=["onClick"],Ic={key:0,class:"p-4 text-sm text-gray-500"},or=e.defineComponent({__name:"vs-input-address",props:e.mergeModels({api:{default:""},geom:{default:""},includes:{default:()=>[]},bbox:{},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(r,{emit:t}){const n=/{{\s*([^}]+?)\s*}}/g,l=r,a=t,{inputClass:o}=Le(l.style),s=e.useModel(r,"modelValue"),c=e.computed({get:()=>s.value,set:$=>{s.value=$}}),i=e.ref(!1),d=e.ref([]),u=e.ref(!1),p=e.ref(null);e.watch(u,$=>{typeof document>"u"||($?(p.value=document.body.style.overflow,document.body.style.overflow="hidden"):p.value!=null?(document.body.style.overflow=p.value,p.value=null):document.body.style.removeProperty("overflow"))}),e.onBeforeUnmount(()=>{typeof document>"u"||(p.value!=null?document.body.style.overflow=p.value:document.body.style.removeProperty("overflow"))});const g=e.computed(()=>l.placeholder??""),f=e.computed(()=>!!l.disabled),y=$=>{if(!$)return null;if(Array.isArray($))return $;if(typeof $=="string"){const v=$.split(",").map(A=>A.trim()).filter(Boolean);return v.length!==4?null:v.map(Number)}return null},h=e.computed(()=>{const $=y(l.bbox);if(!$||$.length!==4)return null;const v=$.map(Number);return v.some(A=>Number.isNaN(A))?null:v}),b=e.computed(()=>{const $=h.value;if(!$)return"";const[v,A,E,V]=$;return`${v},${Math.max(A,V)},${E},${Math.min(A,V)}`});e.computed(()=>b.value?"1":"0");const C=e.inject("values");function w(){!f.value&&c.value.trim()&&k()}async function k(){const $=(c.value||"").trim();if(!$)return;let v=$;if(l.includes?.length&&C?.value){const E=l.includes.map(V=>C.value?.[V]).filter(Boolean);E.length&&(v=`${E.join(", ")}, ${$}`)}const A=L(v);if(A){i.value=!0;try{const V=await(await fetch(A)).json();d.value=Array.isArray(V)?V:[],u.value=!0}catch(E){console.error("Address search error:",E)}finally{i.value=!1}}}function x(){u.value=!u.value}function S($){if(!$)return;u.value=!1;const v=parseFloat($.lat),E={type:"Point",coordinates:[parseFloat($.lon),v]};l.geom&&C?.value&&(C.value[l.geom]=E),a("update:geom",E)}function L($){if(!l.api)return"";const v={value:encodeURIComponent($),bbox:h.value?h.value.join(","):""};return l.api.replace(n,(A,E)=>v[E.trim()]??"")}return($,v)=>(e.openBlock(),e.createElementBlock("div",$c,[e.createElementVNode("div",Ac,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":v[0]||(v[0]=A=>c.value=A),placeholder:g.value,disabled:f.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white border rounded-md placeholder:text-gray-400 focus:ring-2 focus:ring-blue-500",[e.unref(o),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:e.withKeys(e.withModifiers(w,["prevent"]),["enter"])},null,42,Fc),[[e.vModelText,c.value]]),d.value.length?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-blue-600",onClick:x,title:"Show search results"},[e.createVNode(e.unref(R.Info),{class:"h-4 w-4"})])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:k,class:"flex items-center justify-center px-2 py-2 border rounded-md bg-white hover:bg-gray-50 text-gray-600 hover:text-blue-600 disabled:opacity-50 h-[38px]",disabled:i.value||!c.value?.trim()},[i.value?(e.openBlock(),e.createBlock(e.unref(R.LoaderCircle),{key:1,class:"h-5 w-5 animate-spin text-gray-400"})):(e.openBlock(),e.createBlock(e.unref(R.Search),{key:0,class:"h-4 w-4"}))],8,Nc),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[u.value?(e.openBlock(),e.createElementBlock("div",Dc,[e.createElementVNode("div",Mc,[e.createElementVNode("div",Tc,[v[2]||(v[2]=e.createElementVNode("span",null,"Search results",-1)),e.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:v[1]||(v[1]=A=>u.value=!1),title:"Close"},[e.createVNode(e.unref(R.X),{class:"h-4 w-4"})])]),e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(A,E)=>(e.openBlock(),e.createElementBlock("li",{key:E,onClick:V=>S(A),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},e.toDisplayString(A.display_name),9,Lc))),128))]),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ic," No results found "))])])):e.createCommentVNode("",!0)]))]))}}),sr=(r="")=>`${r}${Math.floor(Math.random()*1e4)}`,Oc={class:"vs-datalist space-y-3"},zc={class:"space-y-3"},Rc=["onClick","disabled"],Pc={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},jc=["disabled"],Uc=pe(e.defineComponent({__name:"vs-input-datalist",props:e.mergeModels({schema:{default:()=>[]},minItems:{default:0},maxItems:{default:void 0},addButtonText:{default:"Додати позицію"},emptyLabel:{default:"Немає рядків"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),l=e.computed(()=>Array.isArray(n.value)?n.value:[]),a=e.ref([]),o=e.computed(()=>t.schema?.map(h=>({...h,disabled:t.disabled||h.disabled}))??[]),s=e.computed(()=>o.value.map(h=>y(h))),c=e.computed(()=>t.disabled?!1:t.maxItems?l.value.length<t.maxItems:!0),i=e.computed(()=>t.disabled||l.value.length<=(t.minItems||0));e.watch(()=>l.value.length,()=>{d(),u()},{immediate:!0}),e.watch(()=>t.schema,u,{immediate:!0,deep:!0});function d(){const h=l.value.length;a.value.length<h?a.value=[...a.value,...Array.from({length:h-a.value.length},()=>sr())]:a.value.length>h&&a.value.splice(h)}function u(){if(!t.minItems||l.value.length>=t.minItems)return;const h=t.minItems-l.value.length,b=Array.from({length:h},p);n.value=[...l.value,...b]}function p(){const h={};return o.value.forEach(b=>{h[b.name]=b?.default??null}),h}function g(){c.value&&(n.value=[...l.value,p()],d())}function f(h){i.value||(n.value=l.value.filter((b,C)=>C!==h),d(),u())}function y(h){return{...h}}return(h,b)=>(e.openBlock(),e.createElementBlock("div",Oc,[e.createElementVNode("div",zc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(C,w)=>(e.openBlock(),e.createElementBlock("div",{key:a.value[w],class:"flex items-center gap-3"},[e.createVNode(tt,{schema:s.value,layout:"inline",navigation:!1,values:l.value[w],"onUpdate:values":k=>l.value[w]=k,"form-id":a.value[w]},null,8,["schema","values","onUpdate:values","form-id"]),e.createElementVNode("button",{type:"button",class:"h-[38px] w-[38px] flex items-center justify-center text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",onClick:k=>f(w),disabled:i.value},[e.createVNode(e.unref(R.Trash2),{class:"h-4 w-4"})],8,Rc)]))),128)),l.value.length===0?(e.openBlock(),e.createElementBlock("div",Pc,e.toDisplayString(t.emptyLabel),1)):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:g,disabled:!c.value},[e.createVNode(e.unref(R.Plus),{class:"h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,jc)]))}}),[["__scopeId","data-v-260e3e66"]]),Hc={class:"vs-dataform space-y-4"},qc=["draggable","onDragstart","onDragover","onDragenter","onDrop"],Kc={class:"flex items-center gap-2"},Gc=["onClick"],Wc={class:"text-sm font-medium text-gray-700"},Yc={class:"flex items-center gap-2"},Zc=["title","onClick","disabled"],Xc=["title","onClick","disabled"],Jc={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},Qc=["disabled"],ed=pe(e.defineComponent({__name:"vs-input-dataform",props:e.mergeModels({schema:{default:()=>[]},minGroups:{default:0},maxGroups:{default:void 0},addButtonText:{default:"Додати групу фільтрів"},groupLabel:{default:void 0},duplicateTitle:{default:"Дублювати групу"},removeTitle:{default:"Видалити групу"},emptyLabel:{},view:{default:"default"},collapsible:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),l=e.ref([]),a=e.ref([]),o=e.ref(0),s=e.ref(null),c=e.ref(null),i=e.ref(null),d=e.computed(()=>t.groupLabel??"Group"),u=e.computed(()=>t.emptyLabel??"Ще немає груп"),p=e.computed(()=>t.schema?.map(W=>({...W,disabled:t.disabled||W.disabled}))??[]),g=e.computed(()=>p.value.map(W=>A(W))),f=e.computed(()=>t.view==="accordion"),y=e.computed(()=>!!(t.collapsible||f.value)),h=e.computed(()=>t.draggable!==!1),b=e.computed(()=>t.disabled?!1:t.maxGroups?n.value.length<t.maxGroups:!0),C=e.computed(()=>t.disabled||n.value.length<=(t.minGroups||0));e.watch(()=>n.value.length,()=>{w(),k(),x()},{immediate:!0}),e.watch(()=>t.schema,x,{immediate:!0,deep:!0}),e.watch(()=>t.view,()=>{k()},{immediate:!0});function w(){const W=n.value.length;l.value.length<W?l.value=[...l.value,...Array.from({length:W-l.value.length},()=>sr())]:l.value.length>W&&l.value.splice(W)}function k(){const W=n.value.length;f.value?W===0?o.value=-1:o.value>=W?o.value=W-1:o.value<0&&(o.value=0):a.value.length<W?a.value=[...a.value,...Array.from({length:W-a.value.length},()=>!1)]:a.value.length>W&&a.value.splice(W)}function x(){if(!t.minGroups||n.value.length>=t.minGroups)return;const W=t.minGroups-n.value.length,ae=Array.from({length:W},S);n.value=[...n.value,...ae],k()}function S(){const W={};return p.value.forEach(ae=>{W[ae.name]=ae?.default??null}),W}function L(){b.value&&(n.value=[...n.value,S()],w(),k())}function $(W){C.value||(n.value=n.value.filter((ae,ie)=>ie!==W),w(),f.value?o.value>=n.value.length&&(o.value=n.value.length-1):a.value.splice(W,1),x())}function v(W){if(t.disabled)return;const ae=JSON.parse(JSON.stringify(n.value[W]??{}));n.value=[...n.value.slice(0,W+1),ae,...n.value.slice(W+1)],w(),f.value?o.value>W&&(o.value+=1):a.value.splice(W+1,0,a.value[W]??!1)}function A(W){return{...W}}function E(W){return f.value?o.value===-1&&W===0?!1:o.value!==W:!!a.value[W]}function V(W){if(y.value){if(f.value){o.value=W;return}a.value[W]=!a.value[W]}}function B(W,ae){if(!h.value||t.disabled){ae.preventDefault();return}s.value=W,c.value=W,i.value={groups:JSON.parse(JSON.stringify(n.value)),keys:[...l.value],states:[...a.value]},ae.dataTransfer?.setData("text/plain",String(W)),ae.dataTransfer?.setDragImage?.(ae.currentTarget,0,0)}function M(W,ae){!h.value||t.disabled||s.value!==null&&Y(W,ae)}function N(W,ae){Y(W,ae)}function F(W){!h.value||t.disabled||ye()}function T(){i.value&&j(),s.value=null,c.value=null,i.value=null}function U(W,ae){const ie=[...n.value],[be]=ie.splice(W,1);ie.splice(ae,0,be),n.value=ie;const xe=[...l.value],[K]=xe.splice(W,1);if(xe.splice(ae,0,K),l.value=xe,f.value)o.value===W&&(o.value=ae);else{const se=[...a.value],[Me]=se.splice(W,1);se.splice(ae,0,Me),a.value=se}}function j(){i.value&&(n.value=i.value.groups,l.value=i.value.keys,a.value=i.value.states,i.value=null,c.value=null)}function Y(W,ae){if(s.value===null)return;const ie=ee(W,ae);c.value=ie,ve(ie)}function ee(W,ae){if(!ae?.currentTarget)return W;const ie=ae.currentTarget.getBoundingClientRect(),xe=ae.clientY-ie.top>ie.height/2?W+1:W;return Math.max(0,Math.min(xe,n.value.length))}function ve(W){const ae=s.value;if(ae===null)return;let ie=W;if(ie>n.value.length&&(ie=n.value.length),ie===ae||ie===ae+1)return;const be=ie>ae?ie-1:ie;U(ae,be),s.value=be,c.value=ie>ae?be+1:be}function ye(){i.value=null,s.value=null,c.value=null}return(W,ae)=>(e.openBlock(),e.createElementBlock("div",Hc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(ie,be)=>(e.openBlock(),e.createElementBlock("div",{key:l.value[be],class:e.normalizeClass(["relative border border-gray-200 rounded-lg bg-white transition vs-dataform__group",[t.view==="accordion"?"overflow-hidden":E(be)?"pt-6 px-6":"p-6"]]),draggable:h.value&&!t.disabled,onDragstart:xe=>B(be,xe),onDragend:T,onDragover:e.withModifiers(xe=>M(be,xe),["prevent"]),onDragenter:e.withModifiers(xe=>N(be,xe),["prevent"]),onDrop:e.withModifiers(xe=>F(),["prevent"])},[e.createElementVNode("div",{class:e.normalizeClass(["flex items-center justify-between gap-2 border-b border-gray-100 px-4 py-3",[t.view!=="accordion"?"-mx-6 -mt-6 px-6":"",t.view!=="accordion"&&!E(be)?"rounded-t-lg":"rounded-lg"]])},[e.createElementVNode("div",Kc,[h.value?(e.openBlock(),e.createBlock(e.unref(R.GripVertical),{key:0,class:"h-4 w-4 text-gray-400","aria-hidden":"true"})):e.createCommentVNode("",!0),y.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"rounded-full p-1 text-gray-500 transition hover:bg-gray-100",onClick:xe=>V(be)},[e.createVNode(e.unref(R.ChevronDown),{class:e.normalizeClass(["h-4 w-4 transition",E(be)?"-rotate-90":"rotate-0"])},null,8,["class"])],8,Gc)):e.createCommentVNode("",!0),e.createElementVNode("div",Wc,e.toDisplayString(`${d.value} (${be+1})`),1)]),e.createElementVNode("div",Yc,[e.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:t.duplicateTitle,onClick:xe=>v(be),disabled:t.disabled,draggable:"false"},[e.createVNode(e.unref(R.Copy),{class:"h-4 w-4"})],8,Zc),e.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:t.removeTitle,onClick:xe=>$(be),disabled:C.value,draggable:"false"},[e.createVNode(e.unref(R.Trash2),{class:"h-4 w-4"})],8,Xc)])],2),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(t.view==="accordion"?"p-6":"pt-6")},[e.createVNode(tt,{class:"vs-dataform__form",schema:g.value,layout:"inline",navigation:!1,values:n.value[be],"onUpdate:values":xe=>n.value[be]=xe,"form-id":l.value[be],disabled:t.disabled},null,8,["schema","values","onUpdate:values","form-id","disabled"])],2),[[e.vShow,!E(be)]])],42,qc))),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("div",Jc,e.toDisplayString(u.value),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:L,disabled:!b.value},[e.createVNode(e.unref(R.Plus),{class:"h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,Qc)]))}}),[["__scopeId","data-v-cfbcfed8"]]),Ut="__vs_form_monaco_loader__",mt="__vs_form_monaco_script_loader__",Ht="__vs_form_monaco_editor_loader__",xn=e.defineComponent({__name:"vs-input-monaco",props:e.mergeModels({syntax:{default:"xml"},theme:{default:"vs-light"},height:{default:280},minimap:{type:Boolean,default:!1},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r,{expose:t}){const n=r,l=e.useModel(r,"modelValue"),a=e.ref(null),o=e.computed(()=>typeof n.height=="number"?`${n.height}px`:n.height||"280px");let s=null,c=null,i=!1;const d=()=>{if(c)return Promise.resolve(c);if(typeof window>"u")return Promise.resolve(null);const y=window;if(y.monaco?.editor?.create)return c=y.monaco,Promise.resolve(c);if(y[Ut])return y[Ut];const b=(async()=>{const C=x=>{if(Array.from(document.styleSheets||[]).some($=>$?.href?.includes(x)))return;const L=document.createElement("link");L.rel="stylesheet",L.href=x,document.head.appendChild(L)},w=x=>{if(y[mt]?.[x])return y[mt][x];y[mt]||={};const S=Array.from(document.scripts).find(L=>L.src===x);return S?(y[mt][x]=new Promise((L,$)=>{const v=S.readyState;if(S.dataset.loaded==="true"||v==="loaded"||v==="complete"){L();return}S.addEventListener("load",()=>{S.dataset.loaded="true",L()},{once:!0}),S.addEventListener("error",A=>$(A),{once:!0})}),y[mt][x]):(y[mt][x]=new Promise((L,$)=>{const v=document.createElement("script");v.src=x,v.async=!0,v.onload=()=>{v.dataset.loaded="true",L()},v.onerror=A=>$(A),document.body.appendChild(v)}),y[mt][x])},k="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.0/min/vs";return C(`${k}/editor/editor.main.min.css`),await w(`${k}/loader.min.js`),y[Ht]||(y[Ht]=new Promise((x,S)=>{window.require.config({paths:{vs:k}}),window.require(["vs/editor/editor.main"],()=>{c=window.monaco,y.monaco=c,x(c)},L=>S(L))}).catch(x=>{throw delete y[Ht],x})),y[Ht]})().catch(C=>{throw delete y[Ut],C});return y[Ut]=b,b},u=()=>{!a.value||!c||(s&&(s.dispose(),s=null),s=c.editor.create(a.value,{value:l.value||"",language:n.syntax,theme:n.theme,automaticLayout:!0,minimap:{enabled:!!n.minimap},readOnly:!!n.disabled}),s.onDidChangeModelContent(()=>{i||(l.value=s.getValue())}))},p=()=>{s?.focus()},g=()=>s,f=()=>c;return e.watch(()=>l.value,y=>{if(!s)return;const h=s.getValue();y!==h&&(i=!0,s.setValue(y||""),i=!1)}),e.watch(()=>n.syntax,y=>{!s||!c||c.editor.setModelLanguage(s.getModel(),y||"xml")}),e.watch(()=>n.theme,y=>{c&&c.editor.setTheme(y||"vs-light")}),e.watch(()=>n.disabled,y=>{s&&s.updateOptions({readOnly:!!y})}),e.watch(()=>n.minimap,y=>{s&&s.updateOptions({minimap:{enabled:!!y}})}),e.onMounted(async()=>{try{const y=await d();if(!y||!y.editor)return;c=y,u()}catch(y){console.error("Failed to load Monaco editor",y)}}),e.onBeforeUnmount(()=>{s&&(s.dispose(),s=null)}),t({focus:p,getEditor:g,getMonaco:f}),(y,h)=>(e.openBlock(),e.createElementBlock("div",{class:"w-full",style:e.normalizeStyle({height:o.value})},[e.createElementVNode("div",{ref_key:"editorContainer",ref:a,class:"w-full h-full overflow-hidden border border-[#CFD9E0] rounded"},null,512)],4))}}),ir={VsInputText:yt,VsInputRadio:mn,"vs-input-text":yt,"vs-input-password":yl,"vs-input-textarea":Wn,"vs-input-richtext":Yn,"vs-input-mask":un,"vs-input-number":Rn,"vs-input-radio":mn,"vs-input-select":bn,"vs-input-switcher":cn,"vs-input-static":dn,"vs-input-container":Gn,"vs-input-date":ea,"vs-input-checkbox":Pn,"vs-input-file":Hn,"vs-input-file2":gn,file2:gn,File2:gn,"vs-input-html":dn,"vs-input-email":pn,"vs-input-tel":fn,"vs-input-datatable":Zn,"vs-input-map":Xn,"vs-input-file-list":qn,"vs-input-tags":Jn,"vs-input-slug":Qn,"vs-input-codegen":er,"vs-input-key-value":tr,"vs-input-text[]":nr,"vs-input-range":lr,"vs-input-color":rr,"vs-input-native-select":bn,VsInputArraySelect:jt,"vs-input-array":ar,"vs-input-array-select":jt,"array-select":jt,"vs-input-address":or,"vs-input-datalist":Uc,"vs-input-dataform":ed,"vs-input-monaco":xn},td=e.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(r){const t=r,n=e.inject("values");async function l(){try{if(!t.api)return;const a=t.api.replace("{{value}}",t.value),o=await fetch(a);if(!o.ok){ge.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const s=await o.json();if(!t.set||!n)return;for(const[c,i]of Object.entries(t.set))n.value[c]=s.result[i]}catch(a){console.error(t.error,a)}}return(a,o)=>(e.openBlock(),e.createElementBlock("button",{onClick:l,class:"vs-button relative inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-blue-500 hover:border-blue-500 hover:bg-blue-500 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 ml-0 md:ml-2 mt-2 md:mt-0 py-[8px] md:w-2/4 whitespace-nowrap w-full"},e.toDisplayString(a.button),1))}}),nd={class:"flex flex-col gap-1 w-full"},rd=["innerHTML"],cr=e.defineComponent({__name:"vs-compact-form-layout",props:e.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]},columns:{default:()=>({container:12,label:3})}},{modelValue:{default:null},modelModifiers:{}}),emits:e.mergeModels(["value-selected"],["update:modelValue"]),setup(r,{emit:t}){const n=r,l=e.useModel(r,"modelValue"),a=t,o=e.computed(()=>hl[`${n.layout}`]),s=["label","placeholder","info","description","text","html"],c=e.ref(C()),i=e.computed(()=>y(n.item,c.value)),d=e.computed(()=>ir?.[`vs-input-${n.item.type}`]),u=e.inject("field-props"),p=e.computed(()=>{const k=e.unref(d);if(!k)return new Set;const x=k.props??k.__vccOpts?.props;if(!x)return new Set;const S=Array.isArray(x)?x:Object.keys(x);return new Set(S)}),g=e.computed(()=>{const k={...i.value??{}},x=n.item?.name;x&&u?.value?.[x]&&Object.assign(k,u.value[x]);const S=p.value;return S.size?Object.fromEntries(Object.entries(k).filter(([L])=>S.has(L))):{}}),f=k=>{const x=typeof k=="object"&&k!==null?k:{value:k};a("value-selected",{...x,name:x.name??n.item?.name})};e.onMounted(()=>{c.value=C(),window.addEventListener("storage",w)}),e.onUnmounted(()=>{window.removeEventListener("storage",w)});function y(k,x){if(!k)return{};const S={...k};return s.forEach(L=>{const $=b(k,L,x);$!=null&&(S[L]=$)}),Array.isArray(k.options)&&(S.options=k.options.map(L=>h(L,x))),S}function h(k,x){if(!k)return k;const S={...k},L=b(k,"label",x),$=b(k,"text",x);return L!=null&&(S.label=L),$!=null?S.text=$:L!=null&&(S.text=L),S}function b(k,x,S){const L=`${x}:${S}`;if(k?.[L]!=null)return k[L];if(x==="label"&&k?.[S]!=null)return k[S];if(k?.[x]!=null)return k[x];if(x==="label"){if(k?.ua!=null)return k.ua;if(k?.en!=null)return k.en}if(x==="text"||x==="html"){if(k?.ua!=null)return k.ua;if(k?.en!=null)return k.en}return null}function C(){return typeof window>"u"?"uk":localStorage.getItem("locale")||"uk"}function w(){c.value=C()}return(k,x)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.value),{ua:i.value.ua,error:n.error||"",item:i.value,columns:n.columns,label:i.value.label},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex w-full",`${n.item.type}-component`])},[e.createElementVNode("div",nd,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value),e.mergeProps(g.value,{modelValue:l.value,"onUpdate:modelValue":x[0]||(x[0]=S=>l.value=S),onValueSelected:f}),null,16,["modelValue"])),i.value.description&&n.layout!=="settings"?(e.openBlock(),e.createElementBlock("p",{key:0,class:"text-sm text-gray-500",innerHTML:i.value.description},null,8,rd)):e.createCommentVNode("",!0)]),i.value.behavior?.api&&i.value.behavior?.button?(e.openBlock(),e.createBlock(td,e.mergeProps({key:0},i.value.behavior,{value:l.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),ld={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},ad={class:"vs-compact-form-navigation__rail mt-[6px]"},od=["onClick"],sd=pe(e.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(r,{expose:t}){const n=r,l=e.ref([]),a=e.ref(""),o=e.ref(""),s=e.computed(()=>!!n.enabled),c=e.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),i=e.computed(()=>{const V=n.width;if(V==null)return{};const B=typeof V=="number"?`${V}px`:`${V}`;return{width:B,minWidth:B}});let d=null,u=0,p=0,g=null,f=null,y=null;const h=()=>A(),b=()=>w();e.watch(()=>n.target,async V=>{if(L(),!V){g=null,l.value=[],a.value="";return}g=V,s.value&&(await e.nextTick(),S(V),w())},{immediate:!0}),e.watch(()=>n.scrollContainer,V=>{if(!s.value){f=V??null;return}C(V??null),e.nextTick(()=>w())},{immediate:!0}),e.onMounted(()=>{n.scrollContainer||C(null),w()}),e.onBeforeUnmount(()=>{L(),C(null,!0),g=null,typeof window<"u"&&(u&&window.cancelAnimationFrame(u),p&&window.cancelAnimationFrame(p))});function C(V,B=!1){if(y&&(y(),y=null),B){f=null;return}if(f=V??null,typeof window>"u")return;const M=V??window,N=window;M.addEventListener("scroll",h,{passive:!0}),N.addEventListener("resize",b),y=()=>{M.removeEventListener("scroll",h),N.removeEventListener("resize",b)}}function w(){if(!s.value||!g)return;u&&typeof window<"u"&&window.cancelAnimationFrame(u);const V=()=>{k(),u=0};typeof window>"u"?V():u=window.requestAnimationFrame(V)}function k(){if(!s.value||!g)return;const V=Array.from(g.querySelectorAll("h1, h2")),B=new Set,M=[];V.forEach((N,F)=>{const T=N.textContent?.trim()??"";if(!T)return;let U=(N.getAttribute("id")??"").trim();U||(U=x(T)||`heading-${F+1}`);let j=U,Y=1;for(;B.has(j);)j=`${U}-${Y+=1}`;N.id!==j&&Object.assign(N,{id:j}),B.add(j),M.push({id:j,text:T,level:N.tagName.toLowerCase()==="h1"?1:2})}),l.value=M,M.length||(a.value=""),v()}function x(V){return V.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function S(V){!V||!s.value||typeof MutationObserver>"u"||(L(),d=new MutationObserver(()=>w()),d.observe(V,{childList:!0,subtree:!0}))}function L(){d&&(d.disconnect(),d=null)}function $(V){const B=f;if(!B)return typeof window>"u"?V.offsetTop:V.getBoundingClientRect().top+window.scrollY;const M=V.getBoundingClientRect(),N=B.getBoundingClientRect();return M.top-N.top+B.scrollTop}function v(){if(!s.value||!l.value.length)return;const V=f,B=(V?V.scrollTop:null)||(typeof window<"u"?window.scrollY:0),M=(V?V.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),N=B+M;let F=null;for(let U=0;U<l.value.length;U+=1){const j=l.value[U],Y=document.getElementById(j.id);if(Y){const ee=$(Y);ee+Y.offsetHeight>B&&ee<N&&(F=j.id)}}!F&&o.value&&(F=o.value),F&&(o.value=F);const T=V?V.scrollHeight-V.clientHeight:document.documentElement.scrollHeight-window.innerHeight;B+5>=T&&(F=l.value[l.value.length-1].id),F&&(a.value=F)}function A(){s.value&&(p&&window.cancelAnimationFrame(p),p=window.requestAnimationFrame(()=>{v(),p=0}))}function E(V){if(!s.value)return;const B=document.getElementById(V);if(!B)return;const M=f,N=Math.max(0,$(B));M?M.scrollTo({top:N,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:N,behavior:"smooth"})}return t({refresh:w}),(V,B)=>s.value&&l.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(c.value),style:e.normalizeStyle(i.value)},[e.createElementVNode("h2",ld,e.toDisplayString(V.title),1),e.createElementVNode("div",ad,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,M=>(e.openBlock(),e.createElementBlock("div",{key:M.id,class:e.normalizeClass(["vs-compact-form-navigation__item relative",M.level===2?"vs-compact-form-navigation__item--nested":"",M.id===a.value?"vs-compact-form-navigation__item--active":""])},[e.createElementVNode("button",{type:"button",onClick:N=>E(M.id),class:e.normalizeClass(["vs-compact-form-navigation__button flex gap-x-3 py-[6px] pr-3 text-sm duration-200 hover:text-gray-800",M.level===2?"pl-[15px]":"pl-[18px]",M.id===a.value?"text-gray-800":"text-gray-500"])},[e.createElementVNode("span",null,e.toDisplayString(M.text),1)],10,od)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-1584a562"]]),ht={required:"Це поле є обов’язковим",email:"Неправильний email",tel:"Неправильний телефон",minlength:r=>`Мінімальна довжина — ${r} символів`,maxlength:r=>`Максимальна довжина — ${r} символів`},id=r=>typeof r=="string"?r.trim()?!1:ht.required:Array.isArray(r)?r.map(n=>typeof n=="string"?n.trim():n).filter(n=>n!=null&&n!=="").length?!1:ht.required:r?!1:ht.required,cd=r=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return r?t.test(r)?!1:ht.email:!1},dd=r=>{const t=/^\+[1-9]\d{1,14}$/;return r?t.test(r)?!1:ht.tel:!1},dr=r=>r==null?0:typeof r=="string"?r.trim().length:Array.isArray(r)?r.length:typeof r=="number"?r.toString().length:String(r).length,ud=(r,t)=>{if(r==null)return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&dr(r)<n?t?.message||ht.minlength(n):!1},pd=(r,t)=>{if(r==null||r==="")return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&dr(r)>n?t?.message||ht.maxlength(n):!1},fd=(r,t)=>{const n=t.pattern??t.regexp,l=typeof n=="string"?new RegExp(n):n;if(Array.isArray(r)){const a=r.filter(Boolean);return a.length===0||a.every(o=>l.test(o))?!1:t.message}return!l.test(r)&&r?t.message:!1},md=(r,t)=>!1,hd=(r,t)=>{switch(typeof t=="string"?t:t.type){case"required":return id(r);case"email":return cd(r);case"tel":return dd(r);case"regexp":return fd(r,t);case"minlength":return ud(r,t);case"maxlength":return pd(r,t);case"custom":return md();default:return!1}},gd={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",file:"file",dropzone:"file"};function ur(r){const t=r?.toLowerCase();return gd[t]||t}function wn(r,t=!1){if(Array.isArray(r)){const l=[];return r.forEach(a=>{const o={...a};o.name=(a.name||a.id||a.key||"").toString(),o.type=ur(a.type),o.label=a.label||a.ua,o.rules=a.rules||a.validators,o.type==="email"&&!o.rules&&(o.rules=["email"]),a.data&&(o.api=`/api/suggest/${a.data}`),o.disabled=o.disabled??t,Array.isArray(o.schema)&&(o.schema=wn(o.schema,o.disabled)),l.push(o)}),l}const n=[];return Object.entries(r).forEach(l=>{const a={name:l[0],...l[1],type:ur(l[1].type),label:l[1].label||l[1].ua,rules:l[1].rules||l[1].validators,disabled:l[1].disabled??t};a.type==="email"&&!a.rules&&(a.rules=["email"]),l[1].type?.includes("list")&&(a.multiple=!0),!a.api&&l[1].data&&(a.api=`/api/suggest/${l[1].data}`),Array.isArray(a.schema)&&(a.schema=wn(a.schema,a.disabled)),n.push(a)}),n}function yd(r,t,n=!1){const l=e.computed(()=>wn((Array.isArray(t),t),typeof n=="boolean"?n:n.value)),a=e.ref({});function o(d){const u=d?.conditions;if(!u)return!0;const p=Array.isArray(u)?u[0]:u,g=r?.value?.[p];return Kn(g,u)}const s=(d=l.value,u=!0)=>(d.forEach(p=>{const g=[],f=Number(p?.minlength),y=Number(p?.maxlength);!Number.isNaN(f)&&Number.isFinite(f)&&g.push({type:"minlength",value:f}),!Number.isNaN(y)&&Number.isFinite(y)&&g.push({type:"maxlength",value:y});const h=[...g,...p.rules||[]];if(h.length){if(!o(p)){delete a.value[p.name];return}let b=!1,C=null;h.forEach(w=>{const k=hd(r.value[p.name],w);k&&(b=!0,!C&&typeof k=="string"&&(C=k))}),b&&C?a.value[p.name]=C:delete a.value[p.name]}p.schema&&s(p.schema,!1)}),u&&Object.values(a.value).some(Boolean)?a.value:null),c=e.computed(()=>l.value?.filter(d=>d.hidden!==!0&&o(d)));return{errors:a,validate:s,reset:()=>{r.value={},a.value={}},visibleSchema:c}}const bd={class:"flex w-full h-full min-h-0 gap-6"},kd={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},tt=e.defineComponent({__name:"vs-compact-form",props:e.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1},navigation:{type:Boolean,default:!1},navWidth:{default:400},columns:{}},{form:{default:()=>({})},formModifiers:{},modelValue:{default:()=>({})},modelModifiers:{},values:{default:void 0},valuesModifiers:{}}),emits:e.mergeModels(["handle-submit","update:modelValue","value-selected"],["update:form","update:modelValue","update:values"]),setup(r,{expose:t,emit:n}){const l=n,a=r,o=e.useModel(r,"form"),s=e.useModel(r,"modelValue"),c=e.useModel(r,"values"),i=e.computed({get:()=>c.value??s.value,set:M=>{s.value=M,c.value=M}}),{errors:d,validate:u,reset:p,visibleSchema:g}=yd(i,a.schema,e.toRef(a,"disabled")),f=e.ref(null),y=e.ref(null),h=e.ref({}),b=e.computed(()=>a.navigation),C=e.computed(()=>a.navWidth),w=e.computed(()=>a.style?.columns),k=Object.freeze({container:12,label:3}),x=e.computed(()=>a.columns??w.value??k),S=e.computed(()=>a.columns!=null||w.value!=null),L=e.computed(()=>S.value?"horizontal":a.layout),$=M=>M?.columns?"horizontal":L.value,v=M=>M?.columns??x.value,A=()=>{l("update:modelValue",i.value),u(),l("handle-submit",i.value)},E=M=>{l("value-selected",M)},V=()=>{a.formId&&(i.value?.id!==void 0&&i.value?.id!==null&&i.value?.id!==""||(i.value={...i.value??{},id:a.formId}))};t({validate:u,reset:p,errors:d}),e.onMounted(()=>{V(),o.value={value:i.value,errors:d.value,reset:p,validate:u,formId:a.formId}}),e.watch(()=>a.formId,()=>{V()},{immediate:!0});function B(M,N){if(M===N)return!0;if(typeof M!="object"||typeof N!="object"||!M||!N)return!1;const F=Object.keys(M),T=Object.keys(N);return F.length!==T.length?!1:F.every(U=>M[U]===N[U])}return e.provide("form",o),e.provide("values",i),e.provide("field-props",h),(M,N)=>(e.openBlock(),e.createElementBlock("div",bd,[e.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:y},[e.createElementVNode("form",{ref_key:"formRef",ref:f,onSubmit:e.withModifiers(A,["prevent"]),class:e.normalizeClass(["grid grid-cols-12 p-1",L.value==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(g),(F,T)=>(e.openBlock(),e.createElementBlock("div",{key:F.name,class:e.normalizeClass($(F)==="horizontal"?"col-span-12":`col-span-${F.col||12}`)},[e.createVNode(cr,{style:e.normalizeStyle(M.style),item:F,layout:$(F),columns:v(F),"model-value":i.value[F.name],"onUpdate:modelValue":U=>{const j=i.value[F.name];B(j,U)||(i.value[F.name]=U)},error:e.unref(d)[F.name],onValueSelected:E},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),$(F)==="settings"&&T+1!==e.unref(g).length?(e.openBlock(),e.createElementBlock("div",kd)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(sd,{target:f.value,"scroll-container":y.value,enabled:b.value,width:C.value},null,8,["target","scroll-container","enabled","width"])]))}}),xd={class:"relative"},wd={class:"w-full h-full fixed top-0 start-0 bg-black bg-opacity-50"},_d={class:"m-[10px] fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 min-h-0 h-fit max-h-[80vh] overflow-hidden opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl lg:w-7/12 w-11/12"},vd={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},Cd={class:"font-medium text-gray-800 dark:text-[#ffffff]"},Ed={class:"p-4 mim-h-0 h-full overflow-auto"},pr=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{},api:{},method:{}},emits:["close","save","edit"],setup(r,{emit:t}){const n=r,l=t,a=e.ref(n.schema),o=e.ref(n.defaultValue?JSON.parse(JSON.stringify(n.defaultValue)):{}),s=e.ref({}),c=e.ref(n.token||""),i=e.ref(n.mode),d=()=>{const y=n.method?.trim().toUpperCase();return y==="GET"||y==="POST"||y==="PUT"?y:i.value==="add"?"POST":"PUT"},u=()=>{ge.notify({type:"success",title:"Успішно",message:`Дані успішно ${i.value==="add"?"збережено":"оновлено"}`})},p=async y=>{if(console.log(y),y.ok){await y.json().catch(()=>({})),u(),l("save",o.value);return}if(y.status===400){const h=await y.json().catch(()=>({}));ge.notify({type:"warning",title:"Помилка валідації",message:h.message||"Некоректні дані (400)"});return}if(y.status===500){ge.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"});return}ge.notify({type:"error",title:"Помилка",message:`Статус: ${y.status}`})};async function g(){const y=s.value.validate();if(y){ge.notify({type:"warning",title:"Помилка валідації",message:Object.entries(y).map(([b,C])=>`${b}: ${C}`).join(`
|
|
3
|
+
`)});return}const h=n.api?.trim();if(h){const b=d();try{const C=await fetch(h,{method:b,headers:b==="GET"?void 0:{"Content-Type":"application/json"},body:b==="GET"?void 0:JSON.stringify(o.value)});await p(C)}catch(C){ge.notify({type:"error",title:"Помилка з’єднання",message:C.message||"Не вдалося виконати запит"})}return}if(c.value)try{const b=await fetch(`/api/table/${c.value}`,{method:i.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(o.value)});await p(b)}catch(b){ge.notify({type:"error",title:"Помилка з’єднання",message:b.message||"Не вдалося виконати запит"})}else l("edit",o.value),f()}function f(){l("close")}return e.onMounted(async()=>{try{if(n.form&&!n.schema){const y=await fetch(`/api/template/form/${n.form}`);if(!y.ok){ge.notify({type:y.status>=400&&y.status<500?"warning":"error",title:"Error",message:`Error code: ${y.status}`});return}const h=await y.json();a.value=h.schema,h.token&&(c.value=h.token)}else if(n.token&&!n.defaultValue){c.value=n.token;const y=await fetch(`/api/form/${c.value}`);if(!y.ok){ge.notify({type:y.status>=400&&y.status<500?"warning":"error",title:"Error",message:`Error code: ${y.status}`});return}const h=await y.json();a.value=h.schema,h.data?o.value=h.data:i.value="add",h.obj&&(o.value={...o.value,...h.obj})}}catch(y){ge.notify({type:"error",title:"Error",message:y.message||"Unexpected error"}),console.error(y)}}),(y,h)=>(e.openBlock(),e.createElementBlock("div",xd,[e.createElementVNode("div",wd,[e.createElementVNode("div",_d,[e.createElementVNode("div",vd,[e.createElementVNode("h3",Cd,e.toDisplayString(i.value==="add"?"Додати":"Змінити"),1),e.createElementVNode("button",{onClick:f,type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"},[h[2]||(h[2]=e.createElementVNode("span",{class:"sr-only"},"Close",-1)),e.createVNode(e.unref(R.X),{class:"h-4 w-4 flex-shrink-0"})])]),e.createElementVNode("div",Ed,[a.value?(e.openBlock(),e.createBlock(tt,{key:0,schema:a.value,values:o.value,"onUpdate:values":h[0]||(h[0]=b=>o.value=b),form:s.value,"onUpdate:form":h[1]||(h[1]=b=>s.value=b),formId:c.value},null,8,["schema","values","form","formId"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"vs-form__head mr-5 mb-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},[e.createElementVNode("button",{type:"button",onClick:f,class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:g,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])])])]))}}),Bd=1440*60*1e3,Vd=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],Sd=["січ","лют","бер","квіт","трав","черв","лип","серп","вер","жовт","лист","груд"],$d=["нд","пн","вт","ср","чт","пт","сб"];function Fe(r){return r instanceof Date&&!Number.isNaN(r.getTime())}const bt=r=>new Date(r.getTime());function gt(r){const t=bt(r);return t.setHours(0,0,0,0),t}function wt(r){const t=bt(r);return t.setHours(23,59,59,999),t}function _n(r){return gt(new Date(r.getFullYear(),r.getMonth(),1))}function vn(r){return wt(new Date(r.getFullYear(),r.getMonth()+1,0))}function Cn(r,t){const n=new Date(r),l=n.getDate();n.setDate(1),n.setMonth(n.getMonth()+t);const a=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();return n.setDate(Math.min(l,a)),n}function Ad(r,t){return Cn(r,-1)}function qt(r,t){const n=new Date(r);return n.setFullYear(n.getFullYear()+t),n}function fr(r,t){return qt(r,-t)}function mr(r){return gt(new Date(r.getFullYear(),0,1))}function hr(r){return wt(new Date(r.getFullYear(),11,31))}function Fd(r){const t=Math.floor(r.getFullYear()/10)*10;return gt(new Date(t,0,1))}function Nd(r){const t=Math.floor(r.getFullYear()/10)*10+9;return wt(new Date(t,11,31))}const Je=r=>r.getFullYear(),Kt=r=>Math.floor(r.getFullYear()/10)*10;function Dd(r){const t=[];let n=gt(r.start);const l=gt(r.end);for(;n<=l;)t.push(bt(n)),n=new Date(n.getTime()+Bd);return t}function Md(r){const t=[];let n=_n(r.start);const l=vn(r.end);for(;n<=l;)t.push(bt(n)),n=Cn(n,1);return t}function Td(r){const t=[];let n=mr(r.start);const l=hr(r.end);for(;n<=l;)t.push(bt(n)),n=qt(n,1);return t}function En(r,t=1){const n=gt(r),l=(n.getDay()-t+7)%7;return n.setDate(n.getDate()-l),n}function Ld(r,t=1){const n=En(r,t);return n.setDate(n.getDate()+6),wt(n)}function Id(r,t,n=0){const l=En(r,n),a=(t-n+7)%7;return l.setDate(l.getDate()+a),l}const Gt=(r,t)=>!!r&&!!t&&r.getFullYear()===t.getFullYear()&&r.getMonth()===t.getMonth()&&r.getDate()===t.getDate(),Bn=(r,t)=>!!r&&!!t&&r.getFullYear()===t.getFullYear()&&r.getMonth()===t.getMonth(),gr=(r,t)=>!!r&&!!t&&r.getFullYear()===t.getFullYear(),yr=(r,t)=>!!r&&!!t&&Gt(r,t)&&r.getHours()===t.getHours(),Od=(r,t)=>!!r&&!!t&&yr(r,t)&&r.getMinutes()===t.getMinutes();function zd(r,t){const n=r.getTime();return n>=t.start.getTime()&&n<=t.end.getTime()}const _t=(r,t)=>!!r&&!!t&&r.getTime()<t.getTime(),vt=(r,t)=>!!r&&!!t&&r.getTime()>t.getTime();function Rd(r){const t=r.filter(n=>Fe(n));if(t.length)return t.reduce((n,l)=>n.getTime()>=l.getTime()?n:l)}function Pd(r){const t=r.filter(n=>Fe(n));if(t.length)return t.reduce((n,l)=>n.getTime()<=l.getTime()?n:l)}function br(r,t){const n=bt(r);return typeof t.year=="number"&&n.setFullYear(t.year),typeof t.month=="number"&&n.setMonth(t.month),typeof t.date=="number"&&n.setDate(t.date),typeof t.hours=="number"&&n.setHours(t.hours),typeof t.minutes=="number"&&n.setMinutes(t.minutes),typeof t.seconds=="number"&&n.setSeconds(t.seconds),typeof t.milliseconds=="number"&&n.setMilliseconds(t.milliseconds),n}const Wt=(r,t=2)=>String(r).padStart(t,"0");function kr(r,t){return t==="wide"?Vd[r]:Sd[r]}function jd(r){return $d[r]}const Ud=[{token:"LLLL",format:r=>kr(r.getMonth(),"wide")},{token:"LLL",format:r=>kr(r.getMonth(),"abbreviated")},{token:"EE",format:r=>jd(r.getDay())},{token:"yyyy",format:r=>String(r.getFullYear())},{token:"MM",format:r=>Wt(r.getMonth()+1)},{token:"dd",format:r=>Wt(r.getDate())},{token:"HH",format:r=>Wt(r.getHours())},{token:"mm",format:r=>Wt(r.getMinutes())}];function Yt(r,t){if(!Fe(r))return"";let n="",l=0;for(;l<t.length;){const a=Ud.find(o=>t.startsWith(o.token,l));a?(n+=a.format(r),l+=a.token.length):(n+=t[l],l+=1)}return n}const Hd={"yyyy-MM-dd":/^(\d{4})-(\d{2})-(\d{2})$/,"dd.MM.yyyy":/^(\d{2})\.(\d{2})\.(\d{4})$/,"dd.MM.yyyy HH:mm":/^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2})$/,"HH:mm":/^(\d{2}):(\d{2})$/,"MM.yyyy":/^(\d{2})\.(\d{4})$/,yyyy:/^(\d{4})$/};function xr(r,t){const n=Hd[t];if(!n){const a=new Date(r);return Fe(a)?a:null}const l=r.match(n);if(!l)return null;switch(t){case"yyyy-MM-dd":{const[,a,o,s]=l,c=new Date(Number(a),Number(o)-1,Number(s));return Fe(c)?c:null}case"dd.MM.yyyy":{const[,a,o,s]=l,c=new Date(Number(s),Number(o)-1,Number(a));return Fe(c)?c:null}case"dd.MM.yyyy HH:mm":{const[,a,o,s,c,i]=l,d=new Date(Number(s),Number(o)-1,Number(a),Number(c),Number(i));return Fe(d)?d:null}case"HH:mm":{const[,a,o]=l,s=new Date;return s.setHours(Number(a),Number(o),0,0),s}case"MM.yyyy":{const[,a,o]=l;return new Date(Number(o),Number(a)-1,1)}case"yyyy":{const[,a]=l;return new Date(Number(a),0,1)}default:return null}}const qd=["year","month","day","time","custom"],Kd=e.defineComponent({components:{ChevronLeft:R.ChevronLeft,ChevronRight:R.ChevronRight},emits:{elementClick:r=>Fe(r),left:()=>!0,right:()=>!0,heading:()=>!0},props:{headingClickable:{type:Boolean,default:!1},leftDisabled:{type:Boolean,default:!1},rightDisabled:{type:Boolean,default:!1},columnCount:{type:Number,default:7},items:{type:Array,default:()=>[]},viewMode:{type:String,required:!0,validate:r=>typeof r=="string"&&qd.includes(r)}}}),Gd={class:"v3dp__heading"},Wd=["disabled"],Yd=["disabled"],Zd={class:"v3dp__body"},Xd={class:"v3dp__subheading"},Jd={class:"v3dp__elements"},Qd=["disabled","onClick"];function eu(r,t,n,l,a,o){const s=e.resolveComponent("ChevronLeft"),c=e.resolveComponent("ChevronRight");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["v3dp__popout",`v3dp__popout-${r.viewMode}`]),style:e.normalizeStyle({"--popout-column-definition":`repeat(${r.columnCount}, 1fr)`}),onMousedown:t[3]||(t[3]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Gd,[e.createElementVNode("button",{class:"v3dp__heading__button v3dp__heading__button__left",disabled:r.leftDisabled,onClick:t[0]||(t[0]=e.withModifiers(i=>r.$emit("left"),["stop","prevent"]))},[e.renderSlot(r.$slots,"arrow-left",{},()=>[e.createVNode(s,{class:"v3dp__heading__icon h-4 w-4"})],!0)],8,Wd),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.headingClickable?"button":"span"),{class:"v3dp__heading__center",onClick:t[1]||(t[1]=e.withModifiers(i=>r.$emit("heading"),["stop","prevent"]))},{default:e.withCtx(()=>[e.renderSlot(r.$slots,"heading",{},void 0,!0)]),_:3})),e.createElementVNode("button",{class:"v3dp__heading__button v3dp__heading__button__right",disabled:r.rightDisabled,onClick:t[2]||(t[2]=e.withModifiers(i=>r.$emit("right"),["stop","prevent"]))},[e.renderSlot(r.$slots,"arrow-right",{},()=>[e.createVNode(c,{class:"v3dp__heading__icon h-4 w-4"})],!0)],8,Yd)]),e.createElementVNode("div",Zd,["subheading"in r.$slots?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Xd,[e.renderSlot(r.$slots,"subheading",{},void 0,!0)]),t[4]||(t[4]=e.createElementVNode("hr",{class:"v3dp__divider"},null,-1))],64)):e.createCommentVNode("",!0),e.createElementVNode("div",Jd,[e.renderSlot(r.$slots,"body",{},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.items,i=>(e.openBlock(),e.createElementBlock("button",{key:i.key,disabled:i.disabled,class:e.normalizeClass([{selected:i.selected,current:i.current},`v3dp__element__button__${r.viewMode}`]),onClick:e.withModifiers(d=>r.$emit("elementClick",i.value),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(i.display),1)],10,Qd))),128))],!0)])])],38)}const Zt=pe(Kd,[["render",eu],["__scopeId","data-v-9e083852"]]),tu=e.defineComponent({components:{PickerPopup:Zt},emits:{"update:pageDate":r=>Fe(r),select:r=>Fe(r)},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1}},setup(r,{emit:t}){const n=e.computed(()=>Fd(r.pageDate)),l=e.computed(()=>Nd(r.pageDate)),a=(p,g,f)=>!g&&!f?!0:!(g&&Je(p)<Je(g)||f&&Je(p)>Je(f)),o=e.computed(()=>Td({start:n.value,end:l.value}).map(p=>({value:p,key:String(Je(p)),display:Je(p),selected:!!r.selected&&Je(p)===Je(r.selected),disabled:!a(p,r.lowerLimit,r.upperLimit)}))),s=e.computed(()=>{const p=Je(n.value),g=Je(l.value);return`${p} - ${g}`}),c=e.computed(()=>r.lowerLimit&&(Kt(r.lowerLimit)===Kt(r.pageDate)||_t(r.pageDate,r.lowerLimit))),i=e.computed(()=>r.upperLimit&&(Kt(r.upperLimit)===Kt(r.pageDate)||vt(r.pageDate,r.upperLimit)));return{years:o,heading:s,leftDisabled:c,rightDisabled:i,previousPage:()=>t("update:pageDate",fr(r.pageDate,10)),nextPage:()=>t("update:pageDate",qt(r.pageDate,10))}}});function nu(r,t,n,l,a,o){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{columnCount:3,leftDisabled:r.leftDisabled,rightDisabled:r.rightDisabled,items:r.years,viewMode:"year",onLeft:r.previousPage,onRight:r.nextPage,onElementClick:t[0]||(t[0]=c=>r.$emit("select",c))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.heading),1)]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const ru=pe(tu,[["render",nu]]),lu=e.defineComponent({components:{PickerPopup:Zt},emits:{"update:pageDate":r=>Fe(r),select:r=>Fe(r),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},format:{type:String,required:!1,default:"LLL"},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1}},setup(r,{emit:t}){const n=e.computed(()=>mr(r.pageDate)),l=e.computed(()=>hr(r.pageDate)),a=e.computed(()=>g=>Yt(g,r.format)),o=(g,f,y)=>!f&&!y?!0:!(f&&_t(g,_n(f))||y&&vt(g,vn(y))),s=e.computed(()=>Md({start:n.value,end:l.value}).map(g=>({value:g,display:a.value(g),key:a.value(g),selected:!!r.selected&&Bn(r.selected,g),disabled:!o(g,r.lowerLimit,r.upperLimit)}))),c=e.computed(()=>Je(n.value)),i=e.computed(()=>r.lowerLimit&&(gr(r.lowerLimit,r.pageDate)||_t(r.pageDate,r.lowerLimit))),d=e.computed(()=>r.upperLimit&&(gr(r.upperLimit,r.pageDate)||vt(r.pageDate,r.upperLimit)));return{months:s,heading:c,leftDisabled:i,rightDisabled:d,previousPage:()=>t("update:pageDate",fr(r.pageDate,1)),nextPage:()=>t("update:pageDate",qt(r.pageDate,1))}}});function au(r,t,n,l,a,o){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",columnCount:3,items:r.months,leftDisabled:r.leftDisabled,rightDisabled:r.rightDisabled,viewMode:"month",onLeft:r.previousPage,onRight:r.nextPage,onHeading:t[0]||(t[0]=c=>r.$emit("back")),onElementClick:t[1]||(t[1]=c=>r.$emit("select",c))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.heading),1)]),_:1},8,["items","leftDisabled","rightDisabled","onLeft","onRight"])}const ou=pe(lu,[["render",au]]),su=e.defineComponent({components:{PickerPopup:Zt},emits:{"update:pageDate":r=>Fe(r),select:r=>Fe(r),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},format:{type:String,required:!1,default:"dd"},headingFormat:{type:String,required:!1,default:"LLLL yyyy"},weekdayFormat:{type:String,required:!1,default:"EE"},weekStartsOn:{type:Number,required:!1,default:1,validator:r=>typeof r=="number"&&Number.isInteger(r)&&r>=0&&r<=6},customWeekdays:{type:Array,required:!1},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1}},setup(r,{emit:t}){const n=e.computed(()=>b=>C=>Yt(C,b)),l=e.computed(()=>_n(r.pageDate)),a=e.computed(()=>vn(r.pageDate)),o=e.computed(()=>({start:l.value,end:a.value})),s=e.computed(()=>({start:En(l.value,r.weekStartsOn),end:Ld(a.value,r.weekStartsOn)})),c=e.computed(()=>r.customWeekdays?.length===7?r.customWeekdays:null),i=e.computed(()=>{const b=r.weekStartsOn,C=c.value;if(C)return Array.from({length:7}).map((k,x)=>C[(b+x)%7]);const w=n.value(r.weekdayFormat);return Array.from(Array(7)).map((k,x)=>(b+x)%7).map(k=>Id(new Date,k,r.weekStartsOn)).map(w)}),d=(b,C,w,k)=>k?.dates?.some(x=>Gt(b,x))||k?.predicate?.(b)?!1:!C&&!w?!0:!(C&&_t(b,gt(C))||w&&vt(b,wt(w))),u=e.computed(()=>{const b=new Date,C=n.value(r.format);return Dd(s.value).map(w=>({value:w,display:C(w),selected:!!r.selected&&Gt(r.selected,w),current:Gt(b,w),disabled:!r.allowOutsideInterval&&!zd(w,o.value)||!d(w,r.lowerLimit,r.upperLimit,r.disabledDates),key:n.value("yyyy-MM-dd")(w)}))}),p=e.computed(()=>n.value(r.headingFormat)(r.pageDate)),g=e.computed(()=>r.lowerLimit&&(Bn(r.lowerLimit,r.pageDate)||_t(r.pageDate,r.lowerLimit))),f=e.computed(()=>r.upperLimit&&(Bn(r.upperLimit,r.pageDate)||vt(r.pageDate,r.upperLimit)));return{weekDays:i,days:u,heading:p,leftDisabled:g,rightDisabled:f,previousPage:()=>t("update:pageDate",Ad(r.pageDate)),nextPage:()=>t("update:pageDate",Cn(r.pageDate,1))}}});function iu(r,t,n,l,a,o){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",leftDisabled:r.leftDisabled,rightDisabled:r.rightDisabled,items:r.days,viewMode:"day",onLeft:r.previousPage,onRight:r.nextPage,onHeading:t[0]||(t[0]=c=>r.$emit("back")),onElementClick:t[1]||(t[1]=c=>r.$emit("select",c))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.heading),1)]),subheading:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.weekDays,(c,i)=>(e.openBlock(),e.createElementBlock("span",{key:c,class:e.normalizeClass(`v3dp__subheading__weekday__${i}`)},e.toDisplayString(c),3))),128))]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const cu=pe(su,[["render",iu]]);function wr(r,t){const n=r.getBoundingClientRect(),l={height:r.clientHeight,width:r.clientWidth},a=t.getBoundingClientRect();if(!(a.top>=n.top&&a.bottom<=n.top+l.height)){const s=a.top-n.top,c=a.bottom-n.bottom;Math.abs(s)<Math.abs(c)?r.scrollTop+=s:r.scrollTop+=c}}const du=e.defineComponent({components:{PickerPopup:Zt},emits:{select:r=>Fe(r),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},visible:{type:Boolean,required:!0},disabledTime:{type:Object,required:!1}},setup(r,{emit:t}){const n=e.ref(null),l=e.ref(null),a=e.computed(()=>r.pageDate??r.selected),o=e.ref(a.value.getHours()),s=e.ref(a.value.getMinutes());e.watch(()=>r.selected,f=>{let y=0,h=0;f&&(y=f.getHours(),h=f.getMinutes()),o.value=y,s.value=h});const c=e.computed(()=>[...Array(24).keys()].map(f=>({value:f,date:br(new Date(a.value.getTime()),{hours:f,minutes:s.value,seconds:0}),selected:o.value===f,ref:e.ref(null)}))),i=e.computed(()=>[...Array(60).keys()].map(f=>({value:f,date:br(new Date(a.value.getTime()),{hours:o.value,minutes:f,seconds:0}),selected:s.value===f,ref:e.ref(null)}))),d=f=>{s.value=f.value,t("select",f.date)},u=()=>{const f=c.value.find(h=>h.ref.value?.classList?.contains("selected")??!1),y=i.value.find(h=>h.ref.value?.classList?.contains("selected")??!1);f&&y&&(wr(n.value,f.ref.value),wr(l.value,y.ref.value))};return e.watch(()=>r.visible,f=>{f&&e.nextTick(u)}),{hoursListRef:n,minutesListRef:l,hours:o,minutes:s,hoursList:c,minutesList:i,padStartZero:f=>`0${f}`.substr(-2),selectMinutes:d,isEnabled:f=>!(r.disabledTime?.dates?.some(y=>yr(f,y)&&Od(f,y))||r.disabledTime?.predicate?.(f)),scroll:u}}}),uu={ref:"hoursListRef",class:"v3dp__column"},pu=["disabled","onClick"],fu={ref:"minutesListRef",class:"v3dp__column"},mu=["disabled","onClick"];function hu(r,t,n,l,a,o){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",columnCount:2,leftDisabled:!0,rightDisabled:!0,viewMode:"time",onHeading:t[0]||(t[0]=c=>r.$emit("back"))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.padStartZero(r.hours))+":"+e.toDisplayString(r.padStartZero(r.minutes)),1)]),body:e.withCtx(()=>[e.createElementVNode("div",uu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.hoursList,c=>(e.openBlock(),e.createElementBlock("button",{key:c.value,ref_for:!0,ref:c.ref,class:e.normalizeClass([{selected:c.selected},"v3dp__element_button__hour"]),disabled:!r.isEnabled(c.date),onClick:e.withModifiers(i=>r.hours=c.value,["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(r.padStartZero(c.value)),1)],10,pu))),128))],512),e.createElementVNode("div",fu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.minutesList,c=>(e.openBlock(),e.createElementBlock("button",{key:c.value,ref_for:!0,ref:c.ref,class:e.normalizeClass([{selected:c.selected},"v3dp__element_button__minute"]),disabled:!r.isEnabled(c.date),onClick:e.withModifiers(i=>r.selectMinutes(c),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(r.padStartZero(c.value)),1)],10,mu))),128))],512)]),_:1})}const gu=pe(du,[["render",hu],["__scopeId","data-v-610b89e1"]]),Xt=["time","day","month","year"],yu=(r,t,n=void 0)=>{let l=n||new Date;const a=Rd([r,l]);a&&(l=a);const o=Pd([t,l]);return o&&(l=o),l},bu=e.defineComponent({components:{YearPicker:ru,MonthPicker:ou,DayPicker:cu,TimePicker:gu},inheritAttrs:!1,props:{placeholder:{type:String,default:""},modelValue:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1},disabledTime:{type:Object,required:!1},upperLimit:{type:Date,required:!1},lowerLimit:{type:Date,required:!1},startingView:{type:String,required:!1,default:"day",validate:r=>typeof r=="string"&&Xt.includes(r)},startingViewDate:{type:Date,required:!1,default:()=>new Date},dayPickerHeadingFormat:{type:String,required:!1,default:"LLLL yyyy"},monthListFormat:{type:String,required:!1,default:"LLL"},weekdayFormat:{type:String,required:!1,default:"EE"},dayFormat:{type:String,required:!1,default:"dd"},inputFormat:{type:String,required:!1,default:"yyyy-MM-dd"},weekDayNames:{type:Array,required:!1},weekStartsOn:{type:Number,required:!1,default:1,validator:r=>[0,1,2,3,4,5,6].includes(r)},disabled:{type:Boolean,required:!1,default:!1},clearable:{type:Boolean,required:!1,default:!1},typeable:{type:Boolean,required:!1,default:!1},minimumView:{type:String,required:!1,default:"day",validate:r=>typeof r=="string"&&Xt.includes(r)}},emits:{"update:modelValue":r=>r==null||Fe(r),decadePageChanged:r=>!0,yearPageChanged:r=>!0,monthPageChanged:r=>!0,opened:()=>!0,closed:()=>!0},setup(r,{emit:t,attrs:n}){const l=e.ref("none"),a=e.ref(r.startingViewDate),o=e.ref(null),s=e.ref(!1),c=e.ref(""),i=F=>{const T=F.replace(/[a-zA-Z]/g,"0");return/0/.test(T)?T:""},d=e.computed(()=>i(r.inputFormat));let u=null,p=null;const g=()=>{u?.destroy(),u=null},f=async()=>{if(!p){const{default:F}=await Promise.resolve().then(()=>Nn);p=F}return p},y=()=>{u&&u.value!==c.value&&(u.value=c.value??"")},h=async()=>{if(g(),!o.value||!d.value)return;u=(await f())(o.value,{mask:d.value,lazy:!0,overwrite:!0}),y()};e.watchEffect(()=>{if(!c.value)return;const F=xr(c.value,r.inputFormat);F&&(a.value=F)}),e.watchEffect(()=>{c.value=r.modelValue&&Fe(r.modelValue)?Yt(r.modelValue,r.inputFormat):""}),e.onMounted(()=>{d.value&&e.nextTick(()=>{h()})}),e.onBeforeUnmount(()=>{g()}),e.watch(d,F=>{F?e.nextTick(()=>{h()}):g()}),e.watch(c,()=>{y()});const b=(F="none")=>{r.disabled||(F!=="none"&&l.value==="none"&&(a.value=r.modelValue||yu(r.lowerLimit,r.upperLimit,a.value)),l.value=F,t(F!=="none"?"opened":"closed"))};e.watchEffect(()=>{r.disabled&&(l.value="none")});const C=(F,T)=>{a.value=T,F==="year"?t("decadePageChanged",T):F==="month"?t("yearPageChanged",T):F==="day"&&t("monthPageChanged",T)},w=F=>{a.value=F,r.minimumView==="year"?(b("none"),t("update:modelValue",F)):l.value="month"},k=F=>{a.value=F,r.minimumView==="month"?(b("none"),t("update:modelValue",F)):l.value="day"},x=F=>{a.value=F,r.minimumView==="day"?(b("none"),t("update:modelValue",F)):l.value="time"},S=F=>{b("none"),t("update:modelValue",F)},L=()=>{r.clearable&&(b("none"),t("update:modelValue",null),a.value=r.startingViewDate)},$=()=>s.value=!0,v=()=>b(V.value),A=()=>{s.value=!1,b()},E=F=>{const T=F.keyCode?F.keyCode:F.which;if([27,13].includes(T)&&o.value.blur(),r.typeable){const j=xr(o.value.value,r.inputFormat);j&&c.value===Yt(j,r.inputFormat)&&(c.value=o.value.value,t("update:modelValue",j))}},V=e.computed(()=>{const F=Xt.indexOf(r.startingView),T=Xt.indexOf(r.minimumView);return F<T?r.minimumView:r.startingView}),B=F=>Object.fromEntries(Object.entries(F??{}).filter(([T,U])=>T.startsWith("--"))),M=e.computed(()=>r.weekDayNames?.length===7?r.weekDayNames:void 0);return{blur:A,focus:v,click:$,input:c,inputRef:o,pageDate:a,renderView:b,updatePageDate:C,selectYear:w,selectMonth:k,selectDay:x,selectTime:S,keyUp:E,normalizedWeekdayNames:M,viewShown:l,goBackFromTimepicker:()=>r.startingView==="time"&&r.minimumView==="time"?null:l.value="day",clearModelValue:L,initialView:V,log:F=>console.log(F),variables:B}}}),ku={class:"v3dp__input_wrapper"},xu=["readonly","placeholder","disabled","tabindex"],wu={class:"v3dp__clearable"};function _u(r,t,n,l,a,o){const s=e.resolveComponent("year-picker"),c=e.resolveComponent("month-picker"),i=e.resolveComponent("day-picker"),d=e.resolveComponent("time-picker");return e.openBlock(),e.createElementBlock("div",{class:"v3dp__datepicker",style:e.normalizeStyle(r.variables(r.$attrs.style))},[e.createElementVNode("div",ku,[e.withDirectives(e.createElementVNode("input",e.mergeProps({type:"text",ref:"inputRef",readonly:!r.typeable,"onUpdate:modelValue":t[0]||(t[0]=u=>r.input=u)},r.$attrs,{placeholder:r.placeholder,disabled:r.disabled,tabindex:r.disabled?-1:0,onKeyup:t[1]||(t[1]=(...u)=>r.keyUp&&r.keyUp(...u)),onBlur:t[2]||(t[2]=(...u)=>r.blur&&r.blur(...u)),onFocus:t[3]||(t[3]=(...u)=>r.focus&&r.focus(...u)),onClick:t[4]||(t[4]=(...u)=>r.click&&r.click(...u))}),null,16,xu),[[e.vModelText,r.input]]),e.withDirectives(e.createElementVNode("div",wu,[e.renderSlot(r.$slots,"clear",{onClear:r.clearModelValue},()=>[e.createElementVNode("i",{onClick:t[5]||(t[5]=u=>r.clearModelValue())},"x")])],512),[[e.vShow,r.clearable&&r.modelValue]])]),e.withDirectives(e.createVNode(s,{pageDate:r.pageDate,"onUpdate:pageDate":t[6]||(t[6]=u=>r.updatePageDate("year",u)),selected:r.modelValue,lowerLimit:r.lowerLimit,upperLimit:r.upperLimit,onSelect:r.selectYear},null,8,["pageDate","selected","lowerLimit","upperLimit","onSelect"]),[[e.vShow,r.viewShown==="year"]]),e.withDirectives(e.createVNode(c,{pageDate:r.pageDate,"onUpdate:pageDate":t[7]||(t[7]=u=>r.updatePageDate("month",u)),selected:r.modelValue,onSelect:r.selectMonth,lowerLimit:r.lowerLimit,upperLimit:r.upperLimit,format:r.monthListFormat,onBack:t[8]||(t[8]=u=>r.viewShown="year")},null,8,["pageDate","selected","onSelect","lowerLimit","upperLimit","format"]),[[e.vShow,r.viewShown==="month"]]),e.withDirectives(e.createVNode(i,{pageDate:r.pageDate,"onUpdate:pageDate":t[9]||(t[9]=u=>r.updatePageDate("day",u)),selected:r.modelValue,weekStartsOn:r.weekStartsOn,lowerLimit:r.lowerLimit,upperLimit:r.upperLimit,headingFormat:r.dayPickerHeadingFormat,disabledDates:r.disabledDates,weekdayFormat:r.weekdayFormat,"allow-outside-interval":r.allowOutsideInterval,format:r.dayFormat,"custom-weekdays":r.normalizedWeekdayNames,onSelect:r.selectDay,onBack:t[10]||(t[10]=u=>r.viewShown="month")},null,8,["pageDate","selected","weekStartsOn","lowerLimit","upperLimit","headingFormat","disabledDates","weekdayFormat","allow-outside-interval","format","custom-weekdays","onSelect"]),[[e.vShow,r.viewShown==="day"]]),e.withDirectives(e.createVNode(d,{pageDate:r.pageDate,visible:r.viewShown==="time",selected:r.modelValue,disabledTime:r.disabledTime,onSelect:r.selectTime,onBack:r.goBackFromTimepicker},null,8,["pageDate","visible","selected","disabledTime","onSelect","onBack"]),[[e.vShow,r.viewShown==="time"]])],4)}const vu=pe(bu,[["render",_u]]),Cu=pe(e.defineComponent({__name:"vs-input-date2",props:{clearable:{type:Boolean,default:!0},now:{type:Boolean},editable:{type:Boolean,default:!0},time:{type:Boolean},isInfinity:{type:Boolean},mode:{default:"date"},weekStart:{},dayNames:{},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r,l=t,{inputClass:a}=Le(n.style),o=e.computed(()=>n.mode?n.mode:n.time?"datetime":"date"),s={date:"дд.мм.рррр",datetime:"дд.мм.рррр гг:хх",month:"мм.рррр",week:"рррр-тиждень",time:"гг:хх",year:"рррр"},c=e.computed(()=>n.placeholder||s[o.value]||""),i=e.computed(()=>["py-1.5 px-3 block w-full placeholder:text-[#767f8f] bg-white",a.value,n.customClass,{"!border-red-600":n.error}]),d=e.computed(()=>!n.modelValue&&n.now?new Date:null),u=e.computed({get:()=>k(n.modelValue??d.value,o.value)||void 0,set:T=>l("update:modelValue",x(T,o.value))}),p=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"],g=e.computed(()=>{if(n.dayNames?.length)return n.dayNames.length===7?n.dayNames:p}),f=e.computed(()=>{const T=n.weekStart,U=typeof T=="string"?Number(T):T;return U===void 0||Number.isNaN(U)?1:Math.min(6,Math.max(0,U))}),y=e.computed(()=>{switch(o.value){case"time":return{startingView:"time",minimumView:"time"};case"month":return{startingView:"month",minimumView:"month"};case"year":return{startingView:"year",minimumView:"year"};case"datetime":return{startingView:"day",minimumView:"time"};default:return{startingView:"day",minimumView:"day"}}}),h={date:"dd.MM.yyyy",datetime:"dd.MM.yyyy HH:mm",month:"MM.yyyy",time:"HH:mm",week:"dd.MM.yyyy",year:"yyyy"},b=e.computed(()=>h[o.value]||"dd.MM.yyyy"),C=e.computed(()=>({"--vdp-selected-bg-color":n.style?.primaryColor||"#2563eb","--vdp-hover-bg-color":n.style?.primaryColor||"#2563eb","--vdp-selected-color":"#ffffff","--vdp-hover-color":"#ffffff","--vdp-border-radius":n.style?.size==="sm"?"6px":"8px","--vdp-elem-font-size":n.style?.size==="sm"?"0.75em":"0.85em"})),w=e.ref(!1);e.watch(()=>n.modelValue,T=>{T?w.value=!0:n.now||(w.value=!1)},{immediate:!0}),e.watchEffect(()=>{n.now&&!n.modelValue&&!w.value&&(l("update:modelValue",x(new Date,o.value)),w.value=!0)});function k(T,U){if(!T)return null;if(T instanceof Date&&!Number.isNaN(T.getTime()))return T;if(typeof T!="string")return null;switch(U){case"datetime":return v(T);case"time":return V(T);case"month":return A(T);case"year":return E(T);case"week":return B(T);case"date":default:return $(T)}}function x(T,U){if(!T)return null;const j=T instanceof Date?T:k(T,U);if(!j)return null;switch(U){case"datetime":return`${S(j)}T${L(j)}`;case"time":return L(j);case"month":return`${j.getFullYear()}-${F(j.getMonth()+1)}`;case"year":return`${j.getFullYear()}`;case"week":{const{year:Y,week:ee}=M(j);return`${Y}-W${F(ee)}`}case"date":default:return S(j)}}function S(T){return`${T.getFullYear()}-${F(T.getMonth()+1)}-${F(T.getDate())}`}function L(T){return`${F(T.getHours())}:${F(T.getMinutes())}`}function $(T){const U=T.split("-");if(U.length<3)return null;const[j,Y,ee]=U.map(Number);return!j||!Y||!ee?null:new Date(j,Y-1,ee)}function v(T){const U=T.includes("T")?T:T.replace(" ","T"),j=new Date(U);return Number.isNaN(j.getTime())?null:j}function A(T){const[U,j]=T.split("-").map(Number);return!U||Number.isNaN(j)?null:new Date(U,(j||1)-1,1)}function E(T){const U=Number(T);return U?new Date(U,0,1):null}function V(T){const U=T.match(/^(\d{1,2}):(\d{2})$/);if(!U)return null;const[,j,Y]=U,ee=new Date;return ee.setHours(Number(j),Number(Y),0,0),ee}function B(T){const U=T.match(/^(\d{4})-W(\d{2})$/);if(!U)return null;const[,j,Y]=U,ee=Number(Y);return N(Number(j),ee)}function M(T){const U=new Date(Date.UTC(T.getFullYear(),T.getMonth(),T.getDate())),j=U.getUTCDay()||7;U.setUTCDate(U.getUTCDate()+4-j);const Y=new Date(Date.UTC(U.getUTCFullYear(),0,1)),ee=Math.ceil(((U.getTime()-Y.getTime())/864e5+1)/7);return{year:U.getUTCFullYear(),week:ee}}function N(T,U){if(!T||!U)return null;const j=new Date(T,0,1+(U-1)*7),Y=j.getDay(),ee=j;return Y<=4?ee.setDate(j.getDate()-j.getDay()+1):ee.setDate(j.getDate()+8-j.getDay()),ee}function F(T){return String(T).padStart(2,"0")}return(T,U)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vs-date-picker",n.customClass]),style:e.normalizeStyle(C.value)},[e.createVNode(vu,{modelValue:u.value,"onUpdate:modelValue":U[0]||(U[0]=j=>u.value=j),placeholder:c.value,disabled:n.disabled,clearable:n.clearable,typeable:n.editable,"week-day-names":g.value,"week-starts-on":f.value,"starting-view":y.value.startingView,"minimum-view":y.value.minimumView,"input-format":b.value,name:n.name,class:e.normalizeClass(i.value)},null,8,["modelValue","placeholder","disabled","clearable","typeable","week-day-names","week-starts-on","starting-view","minimum-view","input-format","name","class"])],6))}}),[["__scopeId","data-v-a65a2ac3"]]),Eu={form:{richtext:{paragraph:"Paragraph",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",createTable:"Create Table",addColumn:"Add Column",addRow:"Add Row",deleteColumn:"Delete Column",deleteRow:"Delete Row",deleteTable:"Delete Table",mergeCells:"Merge Cells",splitCells:"Split Cells",linkTitle:"Enter Link",link:"Link",linkUrl:"Enter URL",editLink:"Edit Link",openLink:"Open Link",removeLink:"Remove Link",openInNewTab:"Open in New Tab",editor:"Editor",html:"HTML",markdown:"Markdown",create:"Create",update:"Update",cancel:"Cancel"}}},Bu={form:{richtext:{paragraph:"Звичайний текст",heading1:"Заголовок 1",heading2:"Заголовок 2",heading3:"Заголовок 3",heading4:"Заголовок 4",heading5:"Заголовок 5",heading6:"Заголовок 6",createTable:"Створити таблицю",addColumn:"Додати колонку",addRow:"Додати рядок",deleteColumn:"Видалити колонку",deleteRow:"Видалити рядок",deleteTable:"Видалити таблицю",mergeCells:"Об'єднати комірки",splitCells:"Розділити комірки",linkTitle:"Додати посилання",link:"Посилання",linkUrl:"Введіть URL",editLink:"Редагувати посилання",openLink:"Відкрити посилання",removeLink:"Видалити посилання",openInNewTab:"Відкривати в новій вкладці",editor:"Редактор",html:"HTML",markdown:"Markdown",create:"Створити",update:"Оновити",cancel:"Скасувати"}}},_r=Eu.form.richtext,vr=Bu.form.richtext,Vn={en:{form:{richtext:_r}},uk:{form:{richtext:vr}}},Cr=(r={mode:"edit",schema:null})=>new Promise(t=>{const{close:n}=ge.modal({title:r.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:pr,contentProps:{...r,onClose:()=>{t(null),n()},onSave:l=>{t(l),n()}}})});tt.install=function(t){t.component("VForm",tt),Object.assign(t.config.globalProperties,{$form:Cr}),t.provide("form",Cr),window.v3plugin||(window.v3plugin={})};function ct(r){return typeof r=="string"||r instanceof String}function Er(r){var t;return typeof r=="object"&&r!=null&&(r==null||(t=r.constructor)==null?void 0:t.name)==="Object"}function Br(r,t){return Array.isArray(t)?Br(r,(n,l)=>t.includes(l)):Object.entries(r).reduce((n,l)=>{let[a,o]=l;return t(o,a)&&(n[a]=o),n},{})}const ne={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function Vr(r){switch(r){case ne.LEFT:return ne.FORCE_LEFT;case ne.RIGHT:return ne.FORCE_RIGHT;default:return r}}function Sn(r){return r.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function Jt(r,t){if(t===r)return!0;const n=Array.isArray(t),l=Array.isArray(r);let a;if(n&&l){if(t.length!=r.length)return!1;for(a=0;a<t.length;a++)if(!Jt(t[a],r[a]))return!1;return!0}if(n!=l)return!1;if(t&&r&&typeof t=="object"&&typeof r=="object"){const o=t instanceof Date,s=r instanceof Date;if(o&&s)return t.getTime()==r.getTime();if(o!=s)return!1;const c=t instanceof RegExp,i=r instanceof RegExp;if(c&&i)return t.toString()==r.toString();if(c!=i)return!1;const d=Object.keys(t);for(a=0;a<d.length;a++)if(!Object.prototype.hasOwnProperty.call(r,d[a]))return!1;for(a=0;a<d.length;a++)if(!Jt(r[d[a]],t[d[a]]))return!1;return!0}else if(t&&r&&typeof t=="function"&&typeof r=="function")return t.toString()===r.toString();return!1}class Vu{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?ne.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?ne.RIGHT:ne.LEFT}}function ue(r,t){return new ue.InputMask(r,t)}function Sr(r){if(r==null)throw new Error("mask property should be defined");return r instanceof RegExp?ue.MaskedRegExp:ct(r)?ue.MaskedPattern:r===Date?ue.MaskedDate:r===Number?ue.MaskedNumber:Array.isArray(r)||r===Array?ue.MaskedDynamic:ue.Masked&&r.prototype instanceof ue.Masked?r:ue.Masked&&r instanceof ue.Masked?r.constructor:r instanceof Function?ue.MaskedFunction:(console.warn("Mask not found for mask",r),ue.Masked)}function kt(r){if(!r)throw new Error("Options in not defined");if(ue.Masked){if(r.prototype instanceof ue.Masked)return{mask:r};const{mask:t=void 0,...n}=r instanceof ue.Masked?{mask:r}:Er(r)&&r.mask instanceof ue.Masked?r:{};if(t){const l=t.mask;return{...Br(t,(a,o)=>!o.startsWith("_")),mask:t.constructor,_mask:l,...n}}}return Er(r)?{...r}:{mask:r}}function nt(r){if(ue.Masked&&r instanceof ue.Masked)return r;const t=kt(r),n=Sr(t.mask);if(!n)throw new Error("Masked class is not found for provided mask "+t.mask+", appropriate module needs to be imported manually before creating mask.");return t.mask===n&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new n(t)}ue.createMask=nt;class Qt{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return t??this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return t??this.value.length}select(t,n){if(!(t==null||n==null||t===this.selectionStart&&n===this.selectionEnd))try{this._unsafeSelect(t,n)}catch{}}get isActive(){return!1}}ue.MaskElement=Qt;const $r=90,Su=89;class Ct extends Qt{constructor(t){super(),this.input=t,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var t,n,l;return(t=(n=(l=this.input).getRootNode)==null?void 0:n.call(l))!=null?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){if(this._handlers.redo&&(t.keyCode===$r&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===Su&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===$r&&(t.metaKey||t.ctrlKey))return t.preventDefault(),this._handlers.undo(t);t.isComposing||this._handlers.selectionChange(t)}_onBeforeinput(t){if(t.inputType==="historyUndo"&&this._handlers.undo)return t.preventDefault(),this._handlers.undo(t);if(t.inputType==="historyRedo"&&this._handlers.redo)return t.preventDefault(),this._handlers.redo(t)}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}ue.HTMLMaskElement=Ct;class Ar extends Ct{constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,n){this.input.setSelectionRange(t,n)}get value(){return this.input.value}set value(t){this.input.value=t}}ue.HTMLMaskElement=Ct;class $n extends Ct{get _unsafeSelectionStart(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),l=n&&n.anchorOffset,a=n&&n.focusOffset;return a==null||l==null||l<a?l:a}get _unsafeSelectionEnd(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),l=n&&n.anchorOffset,a=n&&n.focusOffset;return a==null||l==null||l>a?l:a}_unsafeSelect(t,n){if(!this.rootElement.createRange)return;const l=this.rootElement.createRange();l.setStart(this.input.firstChild||this.input,t),l.setEnd(this.input.lastChild||this.input,n);const a=this.rootElement,o=a.getSelection&&a.getSelection();o&&(o.removeAllRanges(),o.addRange(l))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}ue.HTMLContenteditableMaskElement=$n;class en{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>en.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}en.MAX_LENGTH=100;class Fr{constructor(t,n){this.el=t instanceof Qt?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new $n(t):new Ar(t),this.masked=nt(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new en,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(t){var n;return t==null||((n=this.masked)==null?void 0:n.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof ue.Masked)&&this.masked.constructor===Sr(t)){this.masked.updateOptions({mask:t});return}const n=t instanceof ue.Masked?t:nt({mask:t});n.unmaskedValue=this.masked.unmaskedValue,this.masked=n}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t,n){const l=this._listeners[t];l&&l.forEach(a=>a(n))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){!this.el||!this.el.isActive||(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(t){const n=this.masked.unmaskedValue,l=this.masked.value,a=this.masked.rawInputValue,o=this.displayValue,s=this.unmaskedValue!==n||this.value!==l||this._rawInputValue!==a;this._unmaskedValue=n,this._value=l,this._rawInputValue=a,this.el.value!==o&&(this.el.value=o),t==="auto"?this.alignCursor():t!=null&&(this.cursorPos=t),s&&this._fireChangeEvents(),!this._historyChanging&&(s||this.history.isEmpty)&&this.history.push({unmaskedValue:n,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:n,...l}=t,a=!this.maskEquals(n),o=this.masked.optionsIsChanged(l);a&&(this.mask=n),o&&this.masked.updateOptions(l),(a||o)&&this.updateControl()}updateCursor(t){t!=null&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,ne.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,n){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(n),this}off(t,n){if(!this._listeners[t])return this;if(!n)return delete this._listeners[t],this;const l=this._listeners[t].indexOf(n);return l>=0&&this._listeners[t].splice(l,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const n=new Vu({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),l=this.masked.rawInputValue,a=this.masked.splice(n.startChangePos,n.removed.length,n.inserted,n.removeDirection,{input:!0,raw:!0}).offset,o=l===this.masked.rawInputValue?n.removeDirection:ne.NONE;let s=this.masked.nearestInputPos(n.startChangePos+a,o);o!==ne.NONE&&(s=this.masked.nearestInputPos(s,ne.NONE)),this.updateControl(s),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}ue.InputMask=Fr;class me{static normalize(t){return Array.isArray(t)?t:[t,new me]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}ue.ChangeDetails=me;class rt{constructor(t,n,l){t===void 0&&(t=""),n===void 0&&(n=0),this.value=t,this.from=n,this.stop=l}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||t!=null&&this.from>=t)return"";const n=this.value[0];return this.value=this.value.slice(1),n}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class Ne{constructor(t){this._value="",this._update({...Ne.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,n){n===void 0&&(n={input:!0}),this.reset(),this.append(t,n,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,n){return t}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),Math.min(this.displayValue.length,n-t)}extractInput(t,n,l){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this.displayValue.slice(t,n)}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new rt(this.extractInput(t,n),t)}appendTail(t){return ct(t)&&(t=new rt(String(t))),t.appendTo(this)}_appendCharRaw(t,n){return t?(this._value+=t,new me({inserted:t,rawInserted:t})):new me}_appendChar(t,n,l){n===void 0&&(n={});const a=this.state;let o;if([t,o]=this.doPrepareChar(t,n),t&&(o=o.aggregate(this._appendCharRaw(t,n)),!o.rawInserted&&this.autofix==="pad")){const s=this.state;this.state=a;let c=this.pad(n);const i=this._appendCharRaw(t,n);c=c.aggregate(i),i.rawInserted||c.equals(o)?o=c:this.state=s}if(o.inserted){let s,c=this.doValidate(n)!==!1;if(c&&l!=null){const i=this.state;if(this.overwrite===!0){s=l.state;for(let u=0;u<o.rawInserted.length;++u)l.unshift(this.displayValue.length-o.tailShift)}let d=this.appendTail(l);if(c=d.rawInserted.length===l.toString().length,!(c&&d.inserted)&&this.overwrite==="shift"){this.state=i,s=l.state;for(let u=0;u<o.rawInserted.length;++u)l.shift();d=this.appendTail(l),c=d.rawInserted.length===l.toString().length}c&&d.inserted&&(this.state=i)}c||(o=new me,this.state=a,l&&s&&(l.state=s))}return o}_appendPlaceholder(){return new me}_appendEager(){return new me}append(t,n,l){if(!ct(t))throw new Error("value should be string");const a=ct(l)?new rt(String(l)):l;n!=null&&n.tail&&(n._beforeTailState=this.state);let o;[t,o]=this.doPrepare(t,n);for(let s=0;s<t.length;++s){const c=this._appendChar(t[s],n,a);if(!c.rawInserted&&!this.doSkipInvalid(t[s],n,a))break;o.aggregate(c)}return(this.eager===!0||this.eager==="append")&&n!=null&&n.input&&t&&o.aggregate(this._appendEager()),a!=null&&(o.tailShift+=this.appendTail(a).tailShift),o}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(n),new me}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const n=this.rawInputValue,l=this.value,a=t();return this.rawInputValue=n,this.value&&this.value!==l&&l.indexOf(this.value)===0&&(this.append(l.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,a}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const n=this.state,l=t(this);return this.state=n,delete this._isolated,l}doSkipInvalid(t,n,l){return!!this.skipInvalid}doPrepare(t,n){return n===void 0&&(n={}),me.normalize(this.prepare?this.prepare(t,this,n):t)}doPrepareChar(t,n){return n===void 0&&(n={}),me.normalize(this.prepareChar?this.prepareChar(t,this,n):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,n,l,a,o){l===void 0&&(l=""),a===void 0&&(a=ne.NONE),o===void 0&&(o={input:!0});const s=t+n,c=this.extractTail(s),i=this.eager===!0||this.eager==="remove";let d;i&&(a=Vr(a),d=this.extractInput(0,s,{raw:!0}));let u=t;const p=new me;if(a!==ne.NONE&&(u=this.nearestInputPos(t,n>1&&t!==0&&!i?ne.NONE:a),p.tailShift=u-t),p.aggregate(this.remove(u)),i&&a!==ne.NONE&&d===this.rawInputValue)if(a===ne.FORCE_LEFT){let g;for(;d===this.rawInputValue&&(g=this.displayValue.length);)p.aggregate(new me({tailShift:-1})).aggregate(this.remove(g-1))}else a===ne.FORCE_RIGHT&&c.unshift();return p.aggregate(this.append(l,o,c))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!Jt(this,t)}typedValueEquals(t){const n=this.typedValue;return t===n||Ne.EMPTY_VALUES.includes(t)&&Ne.EMPTY_VALUES.includes(n)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new me}}Ne.DEFAULTS={skipInvalid:!0},Ne.EMPTY_VALUES=[void 0,null,""],ue.Masked=Ne;class dt{constructor(t,n){t===void 0&&(t=[]),n===void 0&&(n=0),this.chunks=t,this.from=n}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=ct(t)?new rt(String(t)):t;const n=this.chunks[this.chunks.length-1],l=n&&(n.stop===t.stop||t.stop==null)&&t.from===n.from+n.toString().length;if(t instanceof rt)l?n.extend(t.toString()):this.chunks.push(t);else if(t instanceof dt){if(t.stop==null){let a;for(;t.chunks.length&&t.chunks[0].stop==null;)a=t.chunks.shift(),a.from+=t.from,this.extend(a)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof ue.MaskedPattern))return new rt(this.toString()).appendTo(t);const n=new me;for(let l=0;l<this.chunks.length;++l){const a=this.chunks[l],o=t._mapPosToBlock(t.displayValue.length),s=a.stop;let c;if(s!=null&&(!o||o.index<=s)&&((a instanceof dt||t._stops.indexOf(s)>=0)&&n.aggregate(t._appendPlaceholder(s)),c=a instanceof dt&&t._blocks[s]),c){const i=c.appendTail(a);n.aggregate(i);const d=a.toString().slice(i.rawInserted.length);d&&n.aggregate(t.append(d,{tail:!0}))}else n.aggregate(t.append(a.toString(),{tail:!0}))}return n}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:n,...l}=t;Object.assign(this,l),this.chunks=n.map(a=>{const o="chunks"in a?new dt:new rt;return o.state=a,o})}unshift(t){if(!this.chunks.length||t!=null&&this.from>=t)return"";const n=t!=null?t-this.from:t;let l=0;for(;l<this.chunks.length;){const a=this.chunks[l],o=a.unshift(n);if(a.toString()){if(!o)break;++l}else this.chunks.splice(l,1);if(o)return o}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const n=this.chunks[t],l=n.shift();if(n.toString()){if(!l)break;--t}else this.chunks.splice(t,1);if(l)return l}return""}}class $u{constructor(t,n){this.masked=t,this._log=[];const{offset:l,index:a}=t._mapPosToBlock(n)||(n<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=l,this.index=a,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((n=this.block)==null?void 0:n.displayValue.length)||0){var n;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,ne.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,ne.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,ne.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,ne.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,ne.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,ne.NONE),!0})}}class An{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(n),this._value||(this._isRawInput=!1),new me}nearestInputPos(t,n){n===void 0&&(n=ne.NONE);const l=0,a=this._value.length;switch(n){case ne.LEFT:case ne.FORCE_LEFT:return l;case ne.NONE:case ne.RIGHT:case ne.FORCE_RIGHT:default:return a}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._isRawInput?n-t:0}extractInput(t,n,l){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),l===void 0&&(l={}),l.raw&&this._isRawInput&&this._value.slice(t,n)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,n){if(n===void 0&&(n={}),this.isFilled)return new me;const l=this.eager===!0||this.eager==="append",o=this.char===t&&(this.isUnmasking||n.input||n.raw)&&(!n.raw||!l)&&!n.tail,s=new me({inserted:this.char,rawInserted:o?this.char:""});return this._value=this.char,this._isRawInput=o&&(n.raw||n.input),s}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new me;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new rt("")}appendTail(t){return ct(t)&&(t=new rt(String(t))),t.appendTo(this)}append(t,n,l){const a=this._appendChar(t[0],n);return l!=null&&(a.tailShift+=this.appendTail(l).tailShift),a}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=!!t._rawInputValue}pad(t){return this._appendPlaceholder()}}class Et{constructor(t){const{parent:n,isOptional:l,placeholderChar:a,displayChar:o,lazy:s,eager:c,...i}=t;this.masked=nt(i),Object.assign(this,{parent:n,isOptional:l,placeholderChar:a,displayChar:o,lazy:s,eager:c})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),t===0&&n>=1?(this.isFilled=!1,this.masked.remove(t,n)):new me}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(t,n){if(n===void 0&&(n={}),this.isFilled)return new me;const l=this.masked.state;let a=this.masked._appendChar(t,this.currentMaskFlags(n));return a.inserted&&this.doValidate(n)===!1&&(a=new me,this.masked.state=l),!a.inserted&&!this.isOptional&&!this.lazy&&!n.input&&(a.inserted=this.placeholderChar),a.skip=!a.inserted&&!this.isOptional,this.isFilled=!!a.inserted,a}append(t,n,l){return this.masked.append(t,this.currentMaskFlags(n),l)}_appendPlaceholder(){return this.isFilled||this.isOptional?new me:(this.isFilled=!0,new me({inserted:this.placeholderChar}))}_appendEager(){return new me}extractTail(t,n){return this.masked.extractTail(t,n)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,n,l){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.masked.extractInput(t,n,l)}nearestInputPos(t,n){n===void 0&&(n=ne.NONE);const l=0,a=this.value.length,o=Math.min(Math.max(t,l),a);switch(n){case ne.LEFT:case ne.FORCE_LEFT:return this.isComplete?o:l;case ne.RIGHT:case ne.FORCE_RIGHT:return this.isComplete?o:a;case ne.NONE:default:return o}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.value.slice(t,n).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var n;return{...t,_beforeTailState:(t==null||(n=t._beforeTailState)==null?void 0:n.masked)||t?._beforeTailState}}pad(t){return new me}}Et.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class Nr extends Ne{updateOptions(t){super.updateOptions(t)}_update(t){const n=t.mask;n&&(t.validate=l=>l.search(n)>=0),super._update(t)}}ue.MaskedRegExp=Nr;class De extends Ne{constructor(t){super({...De.DEFAULTS,...t,definitions:Object.assign({},Et.DEFAULT_DEFINITIONS,t?.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const n=this.mask;if(!n||!t)return;let l=!1,a=!1;for(let o=0;o<n.length;++o){if(this.blocks){const d=n.slice(o),u=Object.keys(this.blocks).filter(g=>d.indexOf(g)===0);u.sort((g,f)=>f.length-g.length);const p=u[0];if(p){const{expose:g,repeat:f,...y}=kt(this.blocks[p]),h={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...y,repeat:f,parent:this},b=f!=null?new ue.RepeatBlock(h):nt(h);b&&(this._blocks.push(b),g&&(this.exposeBlock=b),this._maskedBlocks[p]||(this._maskedBlocks[p]=[]),this._maskedBlocks[p].push(this._blocks.length-1)),o+=p.length-1;continue}}let s=n[o],c=s in t;if(s===De.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(s==="{"||s==="}"){l=!l;continue}if(s==="["||s==="]"){a=!a;continue}if(s===De.ESCAPE_CHAR){if(++o,s=n[o],!s)break;c=!1}const i=c?new Et({isOptional:a,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...kt(t[s]),parent:this}):new An({char:s,eager:this.eager,isUnmasking:l});this._blocks.push(i)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t){this.reset();return}const{_blocks:n,...l}=t;this._blocks.forEach((a,o)=>a.state=n[o]),super.state=l}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((t,n)=>t+=n.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(n),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,n)=>t+=n.value,"")}set value(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(n),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(n),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,n)=>t+=n.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const n=new me;let l=(t=this._mapPosToBlock(this.displayValue.length))==null?void 0:t.index;if(l==null)return n;this._blocks[l].isFilled&&++l;for(let a=l;a<this._blocks.length;++a){const o=this._blocks[a]._appendEager();if(!o.inserted)break;n.aggregate(o)}return n}_appendCharRaw(t,n){n===void 0&&(n={});const l=this._mapPosToBlock(this.displayValue.length),a=new me;if(!l)return a;for(let s=l.index,c;c=this._blocks[s];++s){var o;const i=c._appendChar(t,{...n,_beforeTailState:(o=n._beforeTailState)==null||(o=o._blocks)==null?void 0:o[s]});if(a.aggregate(i),i.consumed)break}return a}extractTail(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const l=new dt;return t===n||this._forEachBlocksInRange(t,n,(a,o,s,c)=>{const i=a.extractTail(s,c);i.stop=this._findStopBefore(o),i.from=this._blockStartPos(o),i instanceof dt&&(i.blockIndex=o),l.extend(i)}),l}extractInput(t,n,l){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),l===void 0&&(l={}),t===n)return"";let a="";return this._forEachBlocksInRange(t,n,(o,s,c,i)=>{a+=o.extractInput(c,i,l)}),a}_findStopBefore(t){let n;for(let l=0;l<this._stops.length;++l){const a=this._stops[l];if(a<=t)n=a;else break}return n}_appendPlaceholder(t){const n=new me;if(this.lazy&&t==null)return n;const l=this._mapPosToBlock(this.displayValue.length);if(!l)return n;const a=l.index,o=t??this._blocks.length;return this._blocks.slice(a,o).forEach(s=>{if(!s.lazy||t!=null){var c;n.aggregate(s._appendPlaceholder((c=s._blocks)==null?void 0:c.length))}}),n}_mapPosToBlock(t){let n="";for(let l=0;l<this._blocks.length;++l){const a=this._blocks[l],o=n.length;if(n+=a.displayValue,t<=n.length)return{index:l,offset:t-o}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((n,l)=>n+=l.displayValue.length,0)}_forEachBlocksInRange(t,n,l){n===void 0&&(n=this.displayValue.length);const a=this._mapPosToBlock(t);if(a){const o=this._mapPosToBlock(n),s=o&&a.index===o.index,c=a.offset,i=o&&s?o.offset:this._blocks[a.index].displayValue.length;if(l(this._blocks[a.index],a.index,c,i),o&&!s){for(let d=a.index+1;d<o.index;++d)l(this._blocks[d],d,0,this._blocks[d].displayValue.length);l(this._blocks[o.index],o.index,0,o.offset)}}}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const l=super.remove(t,n);return this._forEachBlocksInRange(t,n,(a,o,s,c)=>{l.aggregate(a.remove(s,c))}),l}nearestInputPos(t,n){if(n===void 0&&(n=ne.NONE),!this._blocks.length)return 0;const l=new $u(this,t);if(n===ne.NONE)return l.pushRightBeforeInput()||(l.popState(),l.pushLeftBeforeInput())?l.pos:this.displayValue.length;if(n===ne.LEFT||n===ne.FORCE_LEFT){if(n===ne.LEFT){if(l.pushRightBeforeFilled(),l.ok&&l.pos===t)return t;l.popState()}if(l.pushLeftBeforeInput(),l.pushLeftBeforeRequired(),l.pushLeftBeforeFilled(),n===ne.LEFT){if(l.pushRightBeforeInput(),l.pushRightBeforeRequired(),l.ok&&l.pos<=t||(l.popState(),l.ok&&l.pos<=t))return l.pos;l.popState()}return l.ok?l.pos:n===ne.FORCE_LEFT?0:(l.popState(),l.ok||(l.popState(),l.ok)?l.pos:0)}return n===ne.RIGHT||n===ne.FORCE_RIGHT?(l.pushRightBeforeInput(),l.pushRightBeforeRequired(),l.pushRightBeforeFilled()?l.pos:n===ne.FORCE_RIGHT?this.displayValue.length:(l.popState(),l.ok||(l.popState(),l.ok)?l.pos:this.nearestInputPos(t,ne.LEFT))):t}totalInputPositions(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);let l=0;return this._forEachBlocksInRange(t,n,(a,o,s,c)=>{l+=a.totalInputPositions(s,c)}),l}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const n=this._maskedBlocks[t];return n?n.map(l=>this._blocks[l]):[]}pad(t){const n=new me;return this._forEachBlocksInRange(0,this.displayValue.length,l=>n.aggregate(l.pad(t))),n}}De.DEFAULTS={...Ne.DEFAULTS,lazy:!0,placeholderChar:"_"},De.STOP_CHAR="`",De.ESCAPE_CHAR="\\",De.InputDefinition=Et,De.FixedDefinition=An,ue.MaskedPattern=De;class Bt extends De{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:n=this.to||0,from:l=this.from||0,maxLength:a=this.maxLength||0,autofix:o=this.autofix,...s}=t;this.to=n,this.from=l,this.maxLength=Math.max(String(n).length,a),this.autofix=o;const c=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0");let d=0;for(;d<i.length&&i[d]===c[d];)++d;s.mask=i.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),super._update(s)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let n="",l="";const[,a,o]=t.match(/^(\D*)(\d*)(\D*)/)||[];return o&&(n="0".repeat(a.length)+o,l="9".repeat(a.length)+o),n=n.padEnd(this.maxLength,"0"),l=l.padEnd(this.maxLength,"9"),[n,l]}doPrepareChar(t,n){n===void 0&&(n={});let l;return[t,l]=super.doPrepareChar(t.replace(/\D/g,""),n),t||(l.skip=!this.isComplete),[t,l]}_appendCharRaw(t,n){if(n===void 0&&(n={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,n);const l=String(this.from).padStart(this.maxLength,"0"),a=String(this.to).padStart(this.maxLength,"0"),[o,s]=this.boundaries(this.value+t);return Number(s)<this.from?super._appendCharRaw(l[this.value.length],n):Number(o)>this.to?!n.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(l[this.value.length],n).aggregate(this._appendCharRaw(t,n)):super._appendCharRaw(a[this.value.length],n):super._appendCharRaw(t,n)}doValidate(t){const n=this.value;if(n.search(/[^0]/)===-1&&n.length<=this._matchFrom)return!0;const[a,o]=this.boundaries(n);return this.from<=Number(o)&&Number(a)<=this.to&&super.doValidate(t)}pad(t){const n=new me;if(this.value.length===this.maxLength)return n;const l=this.value,a=this.maxLength-this.value.length;if(a){this.reset();for(let o=0;o<a;++o)n.aggregate(super._appendCharRaw("0",t));l.split("").forEach(o=>this._appendCharRaw(o))}return n}}ue.MaskedRange=Bt;const Au="d{.}`m{.}`Y";class lt extends De{static extractPatternOptions(t){const{mask:n,pattern:l,...a}=t;return{...a,mask:ct(n)?n:l}}constructor(t){super(lt.extractPatternOptions({...lt.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:n,pattern:l,blocks:a,...o}={...lt.DEFAULTS,...t},s=Object.assign({},lt.GET_DEFAULT_BLOCKS());t.min&&(s.Y.from=t.min.getFullYear()),t.max&&(s.Y.to=t.max.getFullYear()),t.min&&t.max&&s.Y.from===s.Y.to&&(s.m.from=t.min.getMonth()+1,s.m.to=t.max.getMonth()+1,s.m.from===s.m.to&&(s.d.from=t.min.getDate(),s.d.to=t.max.getDate())),Object.assign(s,this.blocks,a),super._update({...o,mask:ct(n)?n:l,blocks:s})}doValidate(t){const n=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&n!=null&&(this.min==null||this.min<=n)&&(this.max==null||n<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}optionsIsChanged(t){return super.optionsIsChanged(lt.extractPatternOptions(t))}}lt.GET_DEFAULT_BLOCKS=()=>({d:{mask:Bt,from:1,to:31,maxLength:2},m:{mask:Bt,from:1,to:12,maxLength:2},Y:{mask:Bt,from:1900,to:9999}}),lt.DEFAULTS={...De.DEFAULTS,mask:Date,pattern:Au,format:(r,t)=>{if(!r)return"";const n=String(r.getDate()).padStart(2,"0"),l=String(r.getMonth()+1).padStart(2,"0"),a=r.getFullYear();return[n,l,a].join(".")},parse:(r,t)=>{const[n,l,a]=r.split(".").map(Number);return new Date(a,l-1,n)}},ue.MaskedDate=lt;class Vt extends Ne{constructor(t){super({...Vt.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map(n=>{const{expose:l,...a}=kt(n),o=nt({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...a});return l&&(this.exposeMask=o),o}):[])}_appendCharRaw(t,n){n===void 0&&(n={});const l=this._applyDispatch(t,n);return this.currentMask&&l.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(n))),l}_applyDispatch(t,n,l){t===void 0&&(t=""),n===void 0&&(n={}),l===void 0&&(l="");const a=n.tail&&n._beforeTailState!=null?n._beforeTailState._value:this.value,o=this.rawInputValue,s=n.tail&&n._beforeTailState!=null?n._beforeTailState._rawInputValue:o,c=o.slice(s.length),i=this.currentMask,d=new me,u=i?.state;return this.currentMask=this.doDispatch(t,{...n},l),this.currentMask&&(this.currentMask!==i?(this.currentMask.reset(),s&&(this.currentMask.append(s,{raw:!0}),d.tailShift=this.currentMask.value.length-a.length),c&&(d.tailShift+=this.currentMask.append(c,{raw:!0,tail:!0}).tailShift)):u&&(this.currentMask.state=u)),d}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const n=new me;return t&&n.aggregate(this._applyDispatch("",{},t)),n.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var n,l;return{...t,_beforeTailState:((n=t._beforeTailState)==null?void 0:n.currentMaskRef)===this.currentMask&&((l=t._beforeTailState)==null?void 0:l.currentMask)||t._beforeTailState}}doDispatch(t,n,l){return n===void 0&&(n={}),l===void 0&&(l=""),this.dispatch(t,this,n,l)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,n){n===void 0&&(n={});let[l,a]=super.doPrepare(t,n);if(this.currentMask){let o;[l,o]=super.doPrepare(l,this.currentMaskFlags(n)),a=a.aggregate(o)}return[l,a]}doPrepareChar(t,n){n===void 0&&(n={});let[l,a]=super.doPrepareChar(t,n);if(this.currentMask){let o;[l,o]=super.doPrepareChar(l,this.currentMaskFlags(n)),a=a.aggregate(o)}return[l,a]}reset(){var t;(t=this.currentMask)==null||t.reset(),this.compiledMasks.forEach(n=>n.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask){this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,this._applyDispatch();return}let n=String(t);this.currentMask&&(this.currentMask.typedValue=t,n=this.currentMask.unmaskedValue),this.unmaskedValue=n}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return!!((t=this.currentMask)!=null&&t.isComplete)}get isFilled(){var t;return!!((t=this.currentMask)!=null&&t.isFilled)}remove(t,n){const l=new me;return this.currentMask&&l.aggregate(this.currentMask.remove(t,n)).aggregate(this._applyDispatch()),l}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(n=>n.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:n,currentMaskRef:l,currentMask:a,...o}=t;n&&this.compiledMasks.forEach((s,c)=>s.state=n[c]),l!=null&&(this.currentMask=l,this.currentMask.state=a),super.state=o}extractInput(t,n,l){return this.currentMask?this.currentMask.extractInput(t,n,l):""}extractTail(t,n){return this.currentMask?this.currentMask.extractTail(t,n):super.extractTail(t,n)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,n){return this.currentMask?this.currentMask.nearestInputPos(t,n):super.nearestInputPos(t,n)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every((n,l)=>{if(!t[l])return;const{mask:a,...o}=t[l];return Jt(n,o)&&n.maskEquals(a)}):super.maskEquals(t)}typedValueEquals(t){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(t))}}Vt.DEFAULTS={...Ne.DEFAULTS,dispatch:(r,t,n,l)=>{if(!t.compiledMasks.length)return;const a=t.rawInputValue,o=t.compiledMasks.map((s,c)=>{const i=t.currentMask===s,d=i?s.displayValue.length:s.nearestInputPos(s.displayValue.length,ne.FORCE_LEFT);return s.rawInputValue!==a?(s.reset(),s.append(a,{raw:!0})):i||s.remove(d),s.append(r,t.currentMaskFlags(n)),s.appendTail(l),{index:c,weight:s.rawInputValue.length,totalInputPositions:s.totalInputPositions(0,Math.max(d,s.nearestInputPos(s.displayValue.length,ne.FORCE_LEFT)))}});return o.sort((s,c)=>c.weight-s.weight||c.totalInputPositions-s.totalInputPositions),t.compiledMasks[o[0].index]}},ue.MaskedDynamic=Vt;class St extends De{constructor(t){super({...St.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:n,...l}=t;if(n){const a=n.map(c=>c.length),o=Math.min(...a),s=Math.max(...a)-o;l.mask="*".repeat(o),s&&(l.mask+="["+"*".repeat(s)+"]"),this.enum=n}super._update(l)}_appendCharRaw(t,n){n===void 0&&(n={});const l=Math.min(this.nearestInputPos(0,ne.FORCE_RIGHT),this.value.length),a=this.enum.filter(o=>this.matchValue(o,this.unmaskedValue+t,l));if(a.length){a.length===1&&this._forEachBlocksInRange(0,this.value.length,(s,c)=>{const i=a[0][c];c>=this.value.length||i===s.value||(s.reset(),s._appendChar(i,n))});const o=super._appendCharRaw(a[0][this.value.length],n);return a.length===1&&a[0].slice(this.unmaskedValue.length).split("").forEach(s=>o.aggregate(super._appendCharRaw(s))),o}return new me({skip:!this.isComplete})}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new rt("",t)}remove(t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),t===n)return new me;const l=Math.min(super.nearestInputPos(0,ne.FORCE_RIGHT),this.value.length);let a;for(a=t;a>=0&&!(this.enum.filter(c=>this.matchValue(c,this.value.slice(l,a),l)).length>1);--a);const o=super.remove(a,n);return o.tailShift+=a-t,o}get isComplete(){return this.enum.indexOf(this.value)>=0}}St.DEFAULTS={...De.DEFAULTS,matchValue:(r,t,n)=>r.indexOf(t,n)===n},ue.MaskedEnum=St;class Dr extends Ne{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}ue.MaskedFunction=Dr;var Mr;class ze extends Ne{constructor(t){super({...ze.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),n="\\d*",l=(this.scale?"("+Sn(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+n+l),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(Sn).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(Sn(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const n=t.split(this.radix);return n[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),n.join(this.radix)}doPrepareChar(t,n){n===void 0&&(n={});const[l,a]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(n.input&&n.raw||!n.input&&!n.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),n);return t&&!l&&(a.skip=!0),l&&!this.allowPositive&&!this.value&&l!=="-"&&a.aggregate(this._appendChar("-")),[l,a]}_separatorsCount(t,n){n===void 0&&(n=!1);let l=0;for(let a=0;a<t;++a)this._value.indexOf(this.thousandsSeparator,a)===a&&(++l,n&&(t+=this.thousandsSeparator.length));return l}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,n,l){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n),this._removeThousandsSeparators(super.extractInput(t,n,l))}_appendCharRaw(t,n){n===void 0&&(n={});const l=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,a=this._separatorsCountFromSlice(l);this._value=this._removeThousandsSeparators(this.value);const o=this._value;this._value+=t;const s=this.number;let c=!isNaN(s),i=!1;if(c){let g;this.min!=null&&this.min<0&&this.number<this.min&&(g=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(g=this.max),g!=null&&(this.autofix?(this._value=this.format(g,this).replace(ze.UNMASKED_RADIX,this.radix),i||(i=o===this._value&&!n.tail)):c=!1),c&&(c=!!this._value.match(this._numberRegExp))}let d;c?d=new me({inserted:this._value.slice(o.length),rawInserted:i?"":t,skip:i}):(this._value=o,d=new me),this._value=this._insertThousandsSeparators(this._value);const u=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,p=this._separatorsCountFromSlice(u);return d.tailShift+=(p-a)*this.thousandsSeparator.length,d}_findSeparatorAround(t){if(this.thousandsSeparator){const n=t-this.thousandsSeparator.length+1,l=this.value.indexOf(this.thousandsSeparator,n);if(l<=t)return l}return-1}_adjustRangeWithSeparators(t,n){const l=this._findSeparatorAround(t);l>=0&&(t=l);const a=this._findSeparatorAround(n);return a>=0&&(n=a+this.thousandsSeparator.length),[t,n]}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n);const l=this.value.slice(0,t),a=this.value.slice(n),o=this._separatorsCount(l.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(l+a));const s=this._separatorsCountFromSlice(l);return new me({tailShift:(s-o)*this.thousandsSeparator.length})}nearestInputPos(t,n){if(!this.thousandsSeparator)return t;switch(n){case ne.NONE:case ne.LEFT:case ne.FORCE_LEFT:{const l=this._findSeparatorAround(t-1);if(l>=0){const a=l+this.thousandsSeparator.length;if(t<a||this.value.length<=a||n===ne.FORCE_LEFT)return l}break}case ne.RIGHT:case ne.FORCE_RIGHT:{const l=this._findSeparatorAround(t);if(l>=0)return l+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let n=t;this.min!=null&&(n=Math.max(n,this.min)),this.max!=null&&(n=Math.min(n,this.max)),n!==t&&(this.unmaskedValue=this.format(n,this));let l=this.value;this.normalizeZeros&&(l=this._normalizeZeros(l)),this.padFractionalZeros&&this.scale>0&&(l=this._padFractionalZeros(l)),this._value=l}super.doCommit()}_normalizeZeros(t){const n=this._removeThousandsSeparators(t).split(this.radix);return n[0]=n[0].replace(/^(\D*)(0*)(\d*)/,(l,a,o,s)=>a+s),t.length&&!/\d$/.test(n[0])&&(n[0]=n[0]+"0"),n.length>1&&(n[1]=n[1].replace(/0*$/,""),n[1].length||(n.length=1)),this._insertThousandsSeparators(n.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const n=t.split(this.radix);return n.length<2&&n.push(""),n[1]=n[1].padEnd(this.scale,"0"),n.join(this.radix)}doSkipInvalid(t,n,l){n===void 0&&(n={});const a=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===ze.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,n,l)&&!a}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,ze.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(ze.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(t){return(super.typedValueEquals(t)||ze.EMPTY_VALUES.includes(t)&&ze.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}Mr=ze,ze.UNMASKED_RADIX=".",ze.EMPTY_VALUES=[...Ne.EMPTY_VALUES,0],ze.DEFAULTS={...Ne.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[Mr.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:r=>r.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},ue.MaskedNumber=ze;const tn={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function Fn(r,t,n){t===void 0&&(t=tn.MASKED),n===void 0&&(n=tn.MASKED);const l=nt(r);return a=>l.runIsolated(o=>(o[t]=a,o[n]))}function Tr(r,t,n,l){return Fn(t,n,l)(r)}ue.PIPE_TYPE=tn,ue.createPipe=Fn,ue.pipe=Tr;class Lr extends De{get repeatFrom(){var t;return(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?t:0}get repeatTo(){var t;return(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var n,l,a;const{repeat:o,...s}=kt(t);this._blockOpts=Object.assign({},this._blockOpts,s);const c=nt(this._blockOpts);this.repeat=(n=(l=o??c.repeat)!=null?l:this.repeat)!=null?n:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((a=this._blocks)==null?void 0:a.length)||0,this.repeatFrom)),blocks:{m:c},eager:c.eager,overwrite:c.overwrite,skipInvalid:c.skipInvalid,lazy:c.lazy,placeholderChar:c.placeholderChar,displayChar:c.displayChar})}_allocateBlock(t){if(t<this._blocks.length)return this._blocks[t];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(nt(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,n){n===void 0&&(n={});const l=new me;for(let i=(a=(o=this._mapPosToBlock(this.displayValue.length))==null?void 0:o.index)!=null?a:Math.max(this._blocks.length-1,0),d,u;d=(s=this._blocks[i])!=null?s:u=!u&&this._allocateBlock(i);++i){var a,o,s,c;const p=d._appendChar(t,{...n,_beforeTailState:(c=n._beforeTailState)==null||(c=c._blocks)==null?void 0:c[i]});if(p.skip&&u){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(l.aggregate(p),p.consumed)break}return l}_trimEmptyTail(t,n){var l,a;t===void 0&&(t=0);const o=Math.max(((l=this._mapPosToBlock(t))==null?void 0:l.index)||0,this.repeatFrom,0);let s;n!=null&&(s=(a=this._mapPosToBlock(n))==null?void 0:a.index),s==null&&(s=this._blocks.length-1);let c=0;for(let i=s;o<=i&&!this._blocks[i].unmaskedValue;--i,++c);c&&(this._blocks.splice(s-c+1,c),this.mask=this.mask.slice(c))}reset(){super.reset(),this._trimEmptyTail()}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const l=super.remove(t,n);return this._trimEmptyTail(t,n),l}totalInputPositions(t,n){return t===void 0&&(t=0),n==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,n)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}}ue.RepeatBlock=Lr;try{globalThis.IMask=ue}catch{}const Nn=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:me,ChunksTailDetails:dt,DIRECTION:ne,HTMLContenteditableMaskElement:$n,HTMLInputMaskElement:Ar,HTMLMaskElement:Ct,InputMask:Fr,MaskElement:Qt,Masked:Ne,MaskedDate:lt,MaskedDynamic:Vt,MaskedEnum:St,MaskedFunction:Dr,MaskedNumber:ze,MaskedPattern:De,MaskedRange:Bt,MaskedRegExp:Nr,PIPE_TYPE:tn,PatternFixedDefinition:An,PatternInputDefinition:Et,RepeatBlock:Lr,createMask:nt,createPipe:Fn,default:ue,forceDirection:Vr,normalizeOpts:kt,pipe:Tr},Symbol.toStringTag,{value:"Module"})),Fu=async r=>{try{const t=new FormData;return t.append("unique","true"),t.append("file",r),(await(await fetch("/file/upload/uploads?id=&form=&table=",{method:"POST",body:t})).json())?.result}catch(t){console.error(t)}},Nu=async(r,t,n)=>{const l=t.clipboardData?.items;if(l){const a=t.clipboardData?.getData("text/html"),o=t.clipboardData?.getData("text/plain");if(a){const{state:s,dispatch:c}=r,{tr:i}=s,d=n.fromSchema(r.state.schema),u=new DOMParser().parseFromString(a,"text/html").body,p=d.parse(u),g=i.replaceSelectionWith(p);return c(g),t.preventDefault(),!0}if(o){const{state:s,dispatch:c}=r,{tr:i}=s,d=i.insertText(o,s.selection.from,s.selection.to);return c(d),t.preventDefault(),!0}for(let s=0;s<l.length;s++){const c=l[s];if(c.type.startsWith("image/")){const i=c.getAsFile();if(i){const d=await Fu(i),{schema:u}=r.state,p=u.nodes.image.create({src:d?.file_path}),g=r.state.tr.replaceSelectionWith(p);return r.dispatch(g),t.preventDefault(),!0}}}}return!1},Du="https://esm.sh",Pe="3.7.2",Ir="3.7.2",Mu=`?deps=@tiptap/core@${Pe},@tiptap/pm@${Ir}`,je=r=>`${Du}/${r}${Mu}`,Ue={core:je(`@tiptap/core@${Pe}`),starterKit:je(`@tiptap/starter-kit@${Pe}`),textStyle:je(`@tiptap/extension-text-style@${Pe}`),table:je(`@tiptap/extension-table@${Pe}`),highlight:je(`@tiptap/extension-highlight@${Pe}`),subscript:je(`@tiptap/extension-subscript@${Pe}`),superscript:je(`@tiptap/extension-superscript@${Pe}`),link:je(`@tiptap/extension-link@${Pe}`),image:je(`@tiptap/extension-image@${Pe}`),textAlign:je(`@tiptap/extension-text-align@${Pe}`),heading:je(`@tiptap/extension-heading@${Pe}`),paragraph:je(`@tiptap/extension-paragraph@${Pe}`),pmModel:je(`@tiptap/pm@${Ir}/model`)},$t="__vs_form_tiptap_loader__",He=r=>import(r),$e=(r,t)=>r?.[t]||r?.default?.[t]||r?.default?.default?.[t]||r?.default||r,Or={1:"font-weight:700; font-size:30px;",2:"font-weight:700; font-size:26px;",3:"font-weight:700; font-size:22px;",4:"font-weight:700; font-size:18px;",5:"font-weight:500; font-size:16px;",6:"font-weight:400; font-size:14px;"},Tu=r=>r.extend({addOptions(){return{...this.parent?.(),levels:[1,2,3,4,5,6]}}}).extend({addAttributes(){return{...this.parent?.(),level:{default:1,renderHTML:t=>{const n=t.level||1;return{class:`heading-level-${n}`,style:Or[n]||Or[1]}}}}}}),Lu=r=>r.configure({HTMLAttributes:{style:"min-height: 1rem;"}}),Iu=(r,t,n,l,a)=>{const o=t.extend({renderHTML({HTMLAttributes:s}){return["div",{style:"overflow-x: auto;"},["table",s,0]]},parseHTML(){return[{tag:"div.table-wrapper table",priority:100},{tag:"table"}]}});return r.extend({addExtensions(){return[o.configure({HTMLAttributes:{class:"editor-content"},resizable:!0}),n,l,a]}})},Ou=r=>r.extend({addAttributes(){return{...this.parent?.(),fontFamily:{default:null,parseHTML:t=>t.style.fontFamily?.replace(/['"]/g,""),renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}},fontSize:{default:null,parseHTML:t=>t.style.fontSize?.replace(/['"]/g,""),renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}},color:{default:null,parseHTML:t=>t.style.color?.replace(/['"]/g,""),renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}},backgroundColor:{default:null,parseHTML:t=>t.style.backgroundColor?.replace(/['"]/g,""),renderHTML:t=>!t.backgroundColor||t.backgroundColor==="transparent"?{}:{style:`background-color: ${t.backgroundColor}`}}}},addCommands(){return{setFontFamily:t=>({chain:n})=>n().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run(),setFontSize:t=>({chain:n})=>n().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run(),setColor:t=>({chain:n})=>n().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run(),setBackgroundColor:t=>({chain:n})=>n().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),zu=r=>r.create({name:"iframe",group:"block",inline:!1,atom:!0,selectable:!0,addAttributes(){return{src:{default:null},width:{default:"100%"},height:{default:"280"},frameborder:{default:"0"},allow:{default:null},allowfullscreen:{default:null},referrerpolicy:{default:null},loading:{default:null},class:{default:null},title:{default:null},style:{default:null}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:t}){return["iframe",t]}});async function Ru(){if(typeof window>"u")return null;const r=window;return r[$t]||(r[$t]=Promise.all([He(Ue.core),He(Ue.starterKit),He(Ue.textStyle),He(Ue.table),He(Ue.highlight),He(Ue.subscript),He(Ue.superscript),He(Ue.link),He(Ue.image),He(Ue.textAlign),He(Ue.heading),He(Ue.paragraph),He(Ue.pmModel)]).then(([t,n,l,a,o,s,c,i,d,u,p,g,f])=>{const y=$e(t,"Editor"),h=$e(t,"Node"),b=$e(t,"Extension"),C=$e(n,"StarterKit"),w=$e(l,"TextStyle"),k=$e(a,"TableKit"),x=$e(a,"Table"),S=$e(a,"TableRow"),L=$e(a,"TableCell"),$=$e(a,"TableHeader"),v=$e(o,"Highlight"),A=$e(s,"Subscript"),E=$e(c,"Superscript"),V=$e(i,"Link"),B=$e(d,"Image"),M=$e(u,"TextAlign"),N=$e(p,"Heading"),F=$e(g,"Paragraph"),T=$e(f,"DOMParser");if(!y||!h||!C||!w||!k||!x||!S||!L||!$||!v||!A||!E||!V||!B||!M||!N||!F||!T)throw new Error("Failed to resolve one or more Tiptap modules");return{Editor:y,Extension:b,ProseMirrorDOMParser:T,StarterKit:C,ExtendedTextStyle:Ou(w),Highlight:v,Subscript:A,Superscript:E,Link:V,Image:B,TextAlign:M,CustomHeading:Tu(N),CustomParagraph:Lu(F),CustomTableKit:Iu(k,x,S,L,$),Iframe:zu(h)}}).catch(t=>{throw delete r[$t],t})),r[$t]}function Pu(r){let t=!1;const n=e.shallowRef(null),l=e.ref(!1),a=e.ref(""),o=async(d,u="")=>{if(!d)return null;l.value=!0,a.value="";try{const p=await Ru();if(!p)return null;const g=new p.Editor({element:d,content:u,extensions:[p.StarterKit.configure({history:{depth:100,newGroupDelay:500},code:{HTMLAttributes:{class:"editor-code"}},codeBlock:{HTMLAttributes:{class:"editor-codeblock"}},paragraph:!1,heading:!1,link:!1}),p.Superscript,p.Subscript,p.ExtendedTextStyle,p.CustomParagraph,p.CustomHeading,p.Highlight,p.Image.configure({inline:!0,allowBase64:!0,HTMLAttributes:{class:"editor-image"}}),p.TextAlign.configure({types:["heading","paragraph"]}),p.Link.configure({HTMLAttributes:{class:"editor-link"},openOnClick:!1,autolink:!0}),p.CustomTableKit,p.Iframe],editorProps:{handlePaste:(f,y)=>Nu(f,y,p.ProseMirrorDOMParser),handleKeyDown:(f,y)=>{if(y.key==="Tab"){const h=f.state,{$anchor:b}=h.selection;let C=!1;for(let w=b.depth;w>0;w--){const k=b.node(w);if(k&&(k.type.name==="bulletList"||k.type.name==="orderedList")){C=!0;break}}return C?!1:(y.preventDefault(),!0)}return!1}}});return n.value=e.markRaw(g),g}catch(p){return a.value="Failed to load rich text editor dependencies.",console.error("Failed to initialize rich text editor",p),null}finally{l.value=!1}},s=e.computed(()=>n.value||null);return e.watch(n,d=>{d&&n.value.on("update",u=>{if(!t){t=!0;const p=u.editor.getHTML();r.modelValue,setTimeout(()=>{t=!1},10)}})}),{editor:n,editorInstance:s,focusEditor:()=>{n.value&&!n.value.isFocused&&n.value.commands.focus()},createEditor:o,destroyEditor:()=>{n.value&&(n.value.destroy(),n.value=null)},isLoading:l,loadError:a}}function ju(r,t,n,{toEditorContent:l,toSourceContent:a}={}){const o=e.ref(!1),s=e.ref(""),c=e.ref(null);return{isHtmlMode:o,htmlContent:s,htmlTextarea:c,toggleHtmlMode:async u=>{if(o.value=u,u)r.value&&(s.value=a?await a(r.value.getHTML(),t):r.value.getHTML()),e.nextTick(()=>{c.value&&c.value.focus?.()});else if(r.value){const p=l?await l(s.value,t):s.value;r.value.commands.setContent(p,!0),e.nextTick(()=>{r.value?.commands?.focus?.()})}},onHtmlInput:u=>{s.value=u,n&&n("update:modelValue",u)}}}function Uu(){const r=e.ref(!1);return{isFullscreen:r,toggleFullscreen:()=>{r.value=!r.value}}}const ut=r=>r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),At=r=>{let t=ut(r||"");return t=t.replace(/!\[([^\]]*)]\(([^)\s]+)(?:\s+"([^"]+)")?\)/g,(n,l,a,o)=>{const s=o?` title="${ut(o)}"`:"";return`<img src="${ut(a)}" alt="${ut(l)}"${s}>`}),t=t.replace(/\[([^\]]+)]\(([^)\s]+)(?:\s+"([^"]+)")?\)/g,(n,l,a,o)=>{const s=o?` title="${ut(o)}"`:"";return`<a href="${ut(a)}"${s} target="_blank" rel="noopener noreferrer">${l}</a>`}),t=t.replace(/`([^`]+)`/g,"<code>$1</code>"),t=t.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),t=t.replace(/__([^_]+)__/g,"<strong>$1</strong>"),t=t.replace(/~~([^~]+)~~/g,"<del>$1</del>"),t=t.replace(/\*([^*\n]+)\*/g,"<em>$1</em>"),t=t.replace(/_([^_\n]+)_/g,"<em>$1</em>"),t},Ft=r=>/^\s*\d+\.\s+/.test(r),Dn=r=>/^\s*[-*+]\s+/.test(r),zr=r=>/^\s*[-*+]\s+\[[ xX]\]\s+/.test(r),Mn=r=>/^\s*>\s?/.test(r),Tn=r=>/^\s*\|?(?:\s*:?-{3,}:?\s*\|)+\s*:?-{3,}:?\s*\|?\s*$/.test(r),Rr=r=>r.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(t=>At(t.trim())),Hu=(r,t)=>{const n=r[t],l=r[t+1];if(!n||!l||!n.includes("|")||!Tn(l))return null;const a=Rr(n),o=[];let s=t+2;for(;s<r.length&&r[s].includes("|")&&r[s].trim()!=="";){const d=Rr(r[s]);o.push(`<tr>${d.map(u=>`<td>${u}</td>`).join("")}</tr>`),s+=1}const c=`<thead><tr>${a.map(d=>`<th>${d}</th>`).join("")}</tr></thead>`,i=o.length?`<tbody>${o.join("")}</tbody>`:"";return{html:`<table>${c}${i}</table>`,nextIndex:s}},qu=(r,t)=>{const n=Ft(r[t]),l=n?"ol":"ul",a=[];let o=t;for(;o<r.length;){const s=r[o];if(s.trim()===""||!(n?Ft(s):(Dn(s)||zr(s))&&!Ft(s)))break;const i=s.match(/^\s*[-*+]\s+\[([ xX])\]\s+(.*)$/);if(i){const d=i[1].toLowerCase()==="x";a.push(`<li><input type="checkbox" disabled${d?" checked":""}> ${At(i[2])}</li>`)}else{const d=s.replace(/^\s*(?:[-*+]|\d+\.)\s+/,"");a.push(`<li>${At(d)}</li>`)}o+=1}return{html:`<${l}>${a.join("")}</${l}>`,nextIndex:o}},Ku=(r,t)=>{const l=r[t].replace(/^```/,"").trim(),a=[];let o=t+1;for(;o<r.length&&!r[o].startsWith("```");)a.push(r[o]),o+=1;return{html:`<pre><code${l?` class="language-${ut(l)}"`:""}>${ut(a.join(`
|
|
4
|
+
`))}</code></pre>`,nextIndex:o<r.length?o+1:o}},Gu=(r,t)=>{const n=[];let l=t;for(;l<r.length;){const a=r[l];if(a.trim()===""||a.startsWith("```")||/^#{1,6}\s+/.test(a)||/^---+$/.test(a.trim())||/^\*\*\*+$/.test(a.trim())||Mn(a)||Ft(a)||Dn(a)||l+1<r.length&&a.includes("|")&&Tn(r[l+1]))break;n.push(a.trim()),l+=1}return{html:`<p>${At(n.join(" "))}</p>`,nextIndex:l}},Pr=r=>{const n=(r||"").replace(/\r\n/g,`
|
|
5
|
+
`).split(`
|
|
6
|
+
`),l=[];let a=0;for(;a<n.length;){const o=n[a],s=o.trim();if(!s){a+=1;continue}if(o.startsWith("```")){const d=Ku(n,a);l.push(d.html),a=d.nextIndex;continue}const c=o.match(/^(#{1,6})\s+(.*)$/);if(c){const d=c[1].length;l.push(`<h${d}>${At(c[2])}</h${d}>`),a+=1;continue}if(/^---+$/.test(s)||/^\*\*\*+$/.test(s)){l.push("<hr>"),a+=1;continue}if(o.includes("|")&&a+1<n.length&&Tn(n[a+1])){const d=Hu(n,a);if(d){l.push(d.html),a=d.nextIndex;continue}}if(Mn(o)){const d=[];for(;a<n.length&&Mn(n[a]);)d.push(n[a].replace(/^\s*>\s?/,"")),a+=1;l.push(`<blockquote>${Pr(d.join(`
|
|
7
|
+
`))}</blockquote>`);continue}if(Ft(o)||Dn(o)||zr(o)){const d=qu(n,a);l.push(d.html),a=d.nextIndex;continue}const i=Gu(n,a);l.push(i.html),a=i.nextIndex}return l.join("")},Ln=r=>(r.textContent||"").replace(/\u00a0/g," "),jr=r=>Array.from(r.childNodes).map(t=>In(t)).join(""),Wu=r=>{const t=Array.from(r.querySelectorAll("tr"));if(!t.length)return"";const n=c=>`| ${Array.from(c.children).map(d=>jr(d).trim()).join(" | ")} |`,l=t[0],a=l?Array.from(l.children).length:0,o=`| ${Array(Math.max(a,1)).fill("---").join(" | ")} |`,s=t.slice(1).map(c=>n(c));return[n(l),o,...s].join(`
|
|
8
|
+
`)},Ur=(r,t=!1)=>Array.from(r.children).filter(n=>n.nodeType===Node.ELEMENT_NODE).map((n,l)=>{const a=n,o=a.querySelector('input[type="checkbox"]'),s=Array.from(a.childNodes).filter(c=>!(c instanceof HTMLInputElement)).map(c=>In(c)).join("").trim();return o?`- [${o.checked?"x":" "}] ${s}`:t?`${l+1}. ${s}`:`- ${s}`}).join(`
|
|
9
|
+
`);function In(r){if(r.nodeType===Node.TEXT_NODE)return Ln(r);if(r.nodeType!==Node.ELEMENT_NODE)return"";const t=r,n=t.tagName.toLowerCase(),l=jr(t);switch(n){case"br":return`
|
|
10
|
+
`;case"p":return`${l.trim()}
|
|
11
|
+
|
|
12
|
+
`;case"strong":case"b":return`**${l}**`;case"em":case"i":return`*${l}*`;case"del":case"s":return`~~${l}~~`;case"code":return t.parentElement?.tagName.toLowerCase()==="pre"?l:`\`${l}\``;case"pre":{const a=t.querySelector("code"),c=(a?.className||"").match(/language-([a-z0-9_-]+)/i)?.[1]||"",i=Ln(a||t);return`\`\`\`${c}
|
|
13
|
+
${i}
|
|
14
|
+
\`\`\`
|
|
15
|
+
|
|
16
|
+
`}case"blockquote":return`${l.trim().split(`
|
|
17
|
+
`).map(a=>`> ${a}`).join(`
|
|
18
|
+
`)}
|
|
19
|
+
|
|
20
|
+
`;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{const a=Number(n[1]);return`${"#".repeat(a)} ${l.trim()}
|
|
21
|
+
|
|
22
|
+
`}case"ul":return`${Ur(t,!1)}
|
|
23
|
+
|
|
24
|
+
`;case"ol":return`${Ur(t,!0)}
|
|
25
|
+
|
|
26
|
+
`;case"a":{const a=t.getAttribute("href")||"";return`[${l||a}](${a})`}case"img":{const a=t.getAttribute("alt")||"",o=t.getAttribute("src")||"";return o?``:""}case"hr":return`---
|
|
27
|
+
|
|
28
|
+
`;case"table":return`${Wu(t)}
|
|
29
|
+
|
|
30
|
+
`;default:return l}}const Hr=r=>{if(!r)return"";if(typeof window>"u"||typeof DOMParser>"u")return r;const n=new DOMParser().parseFromString(r,"text/html");return Array.from(n.body.childNodes).map(l=>In(l)).join("").replace(/\n{3,}/g,`
|
|
31
|
+
|
|
32
|
+
`).trim()},On=async(r,t)=>t!=="md"?r||"":Pr(r||""),Yu=async(r,t)=>t!=="md"?r||"":Hr(r||""),Zu=async(r,t)=>t!=="md"?r||"":Hr(r||""),Xu=r=>String(r).trim().toLowerCase().split("-")[0],Ju=()=>typeof window>"u"?"uk":Xu(localStorage.getItem("language")||localStorage.getItem("locale")||navigator.language||"uk"),Qu=(r,t)=>{const n=t.replace(/^form\.richtext\./,"");return Vn?.[r]?.form?.richtext?.[n]||Vn?.uk?.form?.richtext?.[n]||t},qr=r=>r.startsWith("form.richtext.")?r:`form.richtext.${r}`;function nn(){const t=e.getCurrentInstance()?.appContext?.config?.globalProperties,n=t?.$i18n;return{t:a=>{const o=t?.$t,s=t?.$te,c=typeof n?.te=="function"?n.te.bind(n):null;if(typeof o=="function"){const i=qr(a);if((typeof s=="function"?s(i):typeof c=="function"?c(i):null)!==!1){const u=o(i);if(u&&u!==i)return u}}return Qu(Ju(),qr(a))}}}const ep={components:{Quote:R.Quote},props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function tp(r,t,n,l,a,o){const s=e.resolveComponent("Quote");return e.openBlock(),e.createElementBlock("button",{title:"Blockquote",onClick:t[0]||(t[0]=(...c)=>o.toggleBlockquote&&o.toggleBlockquote(...c)),class:e.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none",{"bg-gray-100 text-gray-900":n.editor?.isActive("blockquote")}])},[e.createVNode(s,{class:"h-4 w-4"})],2)}const np=pe(ep,[["render",tp]]),rp={components:{List:R.List},props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function lp(r,t,n,l,a,o){const s=e.resolveComponent("List");return e.openBlock(),e.createElementBlock("button",{title:"Bullet List",onClick:t[0]||(t[0]=(...c)=>o.toggleBulletList&&o.toggleBulletList(...c)),class:e.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("bulletList")}])},[e.createVNode(s,{class:"h-4 w-4"})],2)}const ap=pe(rp,[["render",lp]]),op={components:{ListOrdered:R.ListOrdered},props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function sp(r,t,n,l,a,o){const s=e.resolveComponent("ListOrdered");return e.openBlock(),e.createElementBlock("button",{title:"Ordered List",onClick:t[0]||(t[0]=(...c)=>o.toggleOrderedList&&o.toggleOrderedList(...c)),class:e.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("orderedList")}])},[e.createVNode(s,{class:"h-4 w-4"})],2)}const ip=pe(op,[["render",sp]]),cp={components:{CodeXml:R.CodeXml},props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function dp(r,t,n,l,a,o){const s=e.resolveComponent("CodeXml");return e.openBlock(),e.createElementBlock("button",{title:"Code Block",onClick:t[0]||(t[0]=(...c)=>o.toggleCodeBlock&&o.toggleCodeBlock(...c)),class:e.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("codeBlock")}])},[e.createVNode(s,{class:"h-4 w-4"})],2)}const up=pe(cp,[["render",dp]]),pp={components:{Bold:R.Bold},props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.commands.toggleBold()}}};function fp(r,t,n,l,a,o){const s=e.resolveComponent("Bold");return e.openBlock(),e.createElementBlock("button",{title:"Bold Text",onClick:t[0]||(t[0]=(...c)=>o.toggleBold&&o.toggleBold(...c)),class:e.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("bold")}])},[e.createVNode(s,{class:"h-4 w-4"}),t[1]||(t[1]=e.createElementVNode("span",{class:"sr-only"},"Bold",-1))],2)}const mp=pe(pp,[["render",fp]]),hp={components:{Italic:R.Italic},props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function gp(r,t,n,l,a,o){const s=e.resolveComponent("Italic");return e.openBlock(),e.createElementBlock("button",{title:"Italic Text",onClick:t[0]||(t[0]=(...c)=>o.toggleItalic&&o.toggleItalic(...c)),class:e.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("italic")}])},[e.createVNode(s,{class:"h-4 w-4"}),t[1]||(t[1]=e.createElementVNode("span",{class:"sr-only"},"Italic",-1))],2)}const yp=pe(hp,[["render",gp]]),bp={__name:"vs-editor-underline",props:{editor:Object},setup(r){const t=r,n=()=>{t.editor&&t.editor.chain().focus().toggleUnderline().run()};return(l,a)=>(e.openBlock(),e.createElementBlock("button",{title:"Underline",onClick:n,class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[r.editor?.isActive("underline")?"bg-gray-100 text-gray-900":"text-gray-500"]])},[e.createVNode(e.unref(R.Underline),{class:"h-4 w-4"})],2))}},kp={__name:"vs-editor-strike",props:{editor:Object},setup(r){const t=r,n=()=>{t.editor&&t.editor.chain().focus().toggleStrike().run()};return(l,a)=>(e.openBlock(),e.createElementBlock("button",{title:"Strikethrough",onClick:n,class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[r.editor?.isActive("strike")?"bg-gray-100 text-gray-900":"text-gray-500"]])},[e.createVNode(e.unref(R.Strikethrough),{class:"h-4 w-4"})],2))}},xp={components:{X:R.X},props:{visible:{type:Boolean,default:()=>!1},modelValue:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},size:{type:String,default:()=>""},closeClickBack:{type:Boolean,default:()=>!1}},emits:["update:visible","update:modelValue","onClose","confirm","cancel"],inheritAttrs:!1,name:"vs-dialog",mounted(){window.addEventListener("keydown",this.checkKey)},unmounted(){window.removeEventListener("keydown",this.checkKey)},computed:{hasSlot(){return!!this.$slots?.footer},checkSize(){return this.size==="small"?"md:w-5/12 w-9/12":this.size==="medium"?"md:w-6/12 w-9/12":"lg:w-7/12 w-11/12"}},methods:{checkKey({key:r}){r==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("update:modelValue",!1),this.$emit("onClose")},handleConfirm(){this.$emit("confirm"),this.handleClose()},handleCancel(){this.$emit("cancel"),this.handleClose()},closeByClickBack(r,t){t&&r.target.classList.contains("vs-dialog-overlay")&&this.handleClose()}}},wp={key:0,class:"vsTailwind ui-dialog__wrapper"},_p={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},vp={class:"font-medium text-gray-800 dark:text-[#ffffff]"},Cp={class:"ui-dialog__content p-4"},Ep={key:0,class:"flex justify-end gap-x-2"};function Bp(r,t,n,l,a,o){const s=e.resolveComponent("X");return e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[n.visible||n.modelValue?(e.openBlock(),e.createElementBlock("div",wp,[e.createElementVNode("div",{onMousedown:t[1]||(t[1]=c=>o.closeByClickBack(c,n.closeClickBack)),class:"vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 z-[100001] bg-black bg-opacity-50"},[e.createVNode(e.Transition,{name:"content",appear:""},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["ui-dialog__modal opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",[o.checkSize]])},[e.createElementVNode("div",_p,[e.createElementVNode("h3",vp,e.toDisplayString(n.title),1),e.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:t[0]||(t[0]=(...c)=>o.handleClose&&o.handleClose(...c))},[t[2]||(t[2]=e.createElementVNode("span",{class:"sr-only"},"Close",-1)),e.createVNode(s,{class:"h-4 w-4 flex-shrink-0"})])]),e.createElementVNode("div",Cp,[e.renderSlot(r.$slots,"default",{},void 0,!0)]),o.hasSlot?(e.openBlock(),e.createElementBlock("div",Ep,[e.renderSlot(r.$slots,"footer",{handleClose:o.handleClose,handleConfirm:o.handleConfirm,handleCancel:o.handleCancel},void 0,!0)])):e.createCommentVNode("",!0)],2)]),_:3})],32)])):e.createCommentVNode("",!0)])}const Kr=pe(xp,[["render",Bp],["__scopeId","data-v-56ad9010"]]),Vp=e.defineComponent({components:{IconClose:R.X,IconSearch:R.Search,IconEmail:R.Mail},inheritAttrs:!1,props:{icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},modelValue:{type:String,default:()=>""},placeholder:{type:String,default:()=>""},iconPosition:{type:String,default:()=>"right"},type:{type:String,default:()=>"text"},style:{type:Object,default:()=>null},size:{type:String,default:()=>"md"},attrs:{type:Object,default:()=>{}}},emits:["onInput","update:modelValue","blur","focus"],computed:{checkSize(){return(this.style?.size||this.size)==="xs"?"h-[32px] text-sm":(this.style?.size||this.size)==="md"?"h-[38px] text-sm":(this.style?.size||this.size)==="lg"?"h-[46px] text-[20px]":"h-[38px] text-sm"},value:{get(){return this.modelValue},set(r){this.$emit("update:modelValue",r.trim())}},clearIconStyle(){return[{"right-8":this.icon&&this.iconPosition==="right","right-3":!this.icon||this.iconPosition!=="right","pointer-events-none":this.disabled}]},iconStylePosition(){return[{"left-3":this.icon&&this.iconPosition==="left","right-3":this.icon&&this.iconPosition==="right"}]},inputStyle(){return[{"!pr-8":this.clearable&&!this.icon,"!pr-7":this.clearable,"!pr-16":this.clearable&&this.icon&&this.iconPosition==="right","!pl-8":this.icon&&this.iconPosition==="left","!pr-[50px]":this.clearable&&this.value&&this.icon&&this.iconPosition==="right","!cursor-not-allowed bg-slate-100":this.disabled,"bg-white":!this.disabled}]}},methods:{handleInput(){this.$emit("onInput",this.modelValue)},handleBlur(){this.$emit("blur")},handleFocus(){this.$emit("focus")},clearInput(){this.$emit("update:modelValue",""),this.$emit("onInput","")},async inputFocus(){await this.$refs.vsText?.focus()}}}),Sp={class:"vs-form-text relative bg-white rounded-lg"},$p={key:2,class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},Ap=["disabled","type","placeholder"];function Fp(r,t,n,l,a,o){const s=e.resolveComponent("IconClose"),c=e.resolveComponent("IconSearch"),i=e.resolveComponent("IconEmail");return e.openBlock(),e.createElementBlock("div",Sp,[r.clearable&&r.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:t[0]||(t[0]=(...d)=>r.clearInput&&r.clearInput(...d))},[e.createVNode(s,{class:"h-4 w-4 stroke-gray-500 transition-all hover:stroke-red-500"})])):e.createCommentVNode("",!0),r.icon&&r.icon==="search"?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["absolute bottom-2/4 translate-y-2/4 cursor-pointer",r.iconStylePosition])},[e.createVNode(c,{class:"h-4 w-4 stroke-gray-500 transition-all"})],2)):r.icon&&r.icon==="email"?(e.openBlock(),e.createElementBlock("div",$p,[e.createVNode(i,{class:"h-4 w-4 stroke-gray-500 transition-all"})])):(e.openBlock(),e.createElementBlock("i",{key:3,class:e.normalizeClass(["absolute bottom-2/4 translate-y-2/4 text-gray-500 cursor-pointer",["ti "+r.icon,r.iconStylePosition]])},null,2)),r.clearable&&r.value?(e.openBlock(),e.createElementBlock("div",{key:4,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:t[1]||(t[1]=(...d)=>r.clearInput&&r.clearInput(...d))},[e.createVNode(s,{class:"h-4 w-4 stroke-gray-500 transition-all hover:stroke-red-500"})])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",e.mergeProps({ref:"vsText",disabled:r.disabled,type:r.type,onInput:t[2]||(t[2]=(...d)=>r.handleInput&&r.handleInput(...d)),placeholder:r.placeholder,"onUpdate:modelValue":t[3]||(t[3]=d=>r.value=d)},r.style?.attrs||r.attrs||{},{onFocus:t[4]||(t[4]=(...d)=>r.handleFocus&&r.handleFocus(...d)),onBlur:t[5]||(t[5]=(...d)=>r.handleBlur&&r.handleBlur(...d)),class:[[r.inputStyle,r.checkSize],"py-2 px-3 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg text-sm text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"]}),null,16,Ap),[[e.vModelDynamic,r.value]])])}const Gr=pe(Vp,[["render",Fp],["__scopeId","data-v-eb21a54f"]]),Np=["title"],Dp={class:"flex flex-col gap-3 p-[20px]"},Mp={class:"relative flex items-center gap-2"},Tp={class:"flex-1"},Lp={key:0,class:"flex items-center gap-2 flex-shrink-0"},Ip=["title"],Op=["title"],zp={class:"flex items-center gap-2"},Rp={for:"openInNewTab",class:"text-sm text-gray-700 cursor-pointer"},Pp={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},jp=Object.assign({inheritAttrs:!1},{__name:"vs-editor-link",props:{editor:Object},setup(r){const{t}=nn(),n=r,l=e.ref(!1),a=e.ref(""),o=e.ref(!1),s=e.ref(!1),c=()=>{if(!n.editor)return;n.editor.chain().focus().extendMarkRange("link").run();const g=n.editor.getAttributes("link");g.href?(o.value=!0,a.value=g.href,s.value=g.target==="_blank"):(o.value=!1,a.value="",s.value=!1),l.value=!0},i=()=>{l.value=!1,a.value="",o.value=!1,s.value=!1},d=()=>{if(!n.editor||!a.value.trim())return;let g=a.value.trim();g.match(/^https?:\/\//i)||(g="https://"+g),n.editor.chain().focus().setLink({href:g,target:s.value?"_blank":null}).run(),i()},u=()=>{n.editor&&(n.editor.chain().focus().unsetLink().run(),i())},p=()=>{if(!a.value)return;let g=a.value.trim();g.match(/^https?:\/\//i)||(g="https://"+g),window.open(g,"_blank","noopener,noreferrer")};return(g,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("button",{title:e.unref(t)("form.richtext.link")||"Посилання",onClick:c,class:e.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none",{"bg-gray-100 text-gray-900":r.editor?.isActive("link")}])},[e.createVNode(e.unref(R.Link2),{class:"h-4 w-4"})],10,Np),e.createVNode(Kr,{title:o.value?e.unref(t)("form.richtext.editLink")||"Редагувати посилання":e.unref(t)("form.richtext.linkTitle")||"Додати посилання",visible:l.value,"onUpdate:visible":f[2]||(f[2]=y=>l.value=y),size:"small"},{footer:e.withCtx(()=>[e.createElementVNode("div",Pp,[e.createElementVNode("button",{style:{border:"1px solid #000"},onClick:i,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"},e.toDisplayString(e.unref(t)("form.richtext.cancel")||"Скасувати"),1),e.createElementVNode("button",{onClick:d,class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"},e.toDisplayString(o.value?e.unref(t)("form.richtext.update")||"Оновити":e.unref(t)("form.richtext.create")||"Створити"),1)])]),default:e.withCtx(()=>[e.createElementVNode("div",Dp,[e.createElementVNode("div",Mp,[e.createElementVNode("div",Tp,[e.createVNode(Gr,{modelValue:a.value,"onUpdate:modelValue":f[0]||(f[0]=y=>a.value=y),placeholder:e.unref(t)("form.richtext.linkUrl")||"Введіть URL",class:"w-full"},null,8,["modelValue","placeholder"])]),o.value?(e.openBlock(),e.createElementBlock("div",Lp,[e.createElementVNode("button",{onClick:p,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none transition-colors",title:e.unref(t)("form.richtext.openLink")||"Відкрити посилання"},[e.createVNode(e.unref(R.ExternalLink),{class:"h-4 w-4"})],8,Ip),e.createElementVNode("button",{onClick:u,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-red-600 hover:bg-red-50 focus:outline-none transition-colors",title:e.unref(t)("form.richtext.removeLink")||"Видалити посилання"},[e.createVNode(e.unref(R.Trash2),{class:"h-4 w-4"})],8,Op)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",zp,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",id:"openInNewTab","onUpdate:modelValue":f[1]||(f[1]=y=>s.value=y),class:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500"},null,512),[[e.vModelCheckbox,s.value]]),e.createElementVNode("label",Rp,e.toDisplayString(e.unref(t)("form.richtext.openInNewTab")||"Відкривати в новій вкладці"),1)])])]),_:1},8,["title","visible"])],64))}}),Nt=async(r,t,n,l=10)=>{if(!t||!n)return;await e.nextTick();const a=await n?.getBoundingClientRect(),o=await t?.getBoundingClientRect();if(!o||!a)return;const s=await parseInt(t?.getBoundingClientRect()?.height),c=await parseInt(t?.getBoundingClientRect()?.width),i=await parseInt(n?.getBoundingClientRect()?.height),d=await parseInt(n?.getBoundingClientRect()?.width),u=await window.innerHeight,p=await window.innerWidth;let g=0,f=0;const y=o.bottom+l+i;switch(r){case"top":o.top-a.height-l<0?g=o.top-a.height+l+i+s:g=o.top-a.height-l,p>d+o.right+30?f=o.left-a.width/2+o.width/2:f=p-30-d;break;case"bottom":u>y?g=o.bottom+l:g=o.bottom-l-i-s,f=o.left-a.width/2+o.width/2;break;case"left":g=o.top-a.height/2+o.height/2,o.left-a.width-l>0?f=o.left-a.width-l:f=10;break;case"right":g=o.top-a.height/2+o.height/2,p-c>d?f=o.right+l:f=p-30-d;break;case"top-right":o.top-a.height-l<0?g=o.top-a.height+l+i+s:g=o.top-a.height-l,p-c>d?f=o.right+l:f=p-30-d;break;case"top-left":o.top-a.height-l<0?g=o.top-a.height+l+i+s:g=o.top-a.height-l,o.left-a.width-l>0?f=o.left-a.width-l:f=10;break;case"top-start":o.top-a.height-l<0?g=o.top-a.height+l+i+s:g=o.top-a.height-l,o.left>0?f=o.left:f=10;break;case"bottom-right":u>y?g=o.bottom+l:g=o.bottom-l-i-s,p-c>d?f=o.left:f=p-30-d;break;case"bottom-left":u>y?g=o.bottom+l:g=o.bottom-l-i-s,o.left>0?f=o.right-d:f=10;break;case"bottom-start":u>y?g=o.bottom+l:g=o.bottom-l-i-s,o.left>0?f=o.left:f=10;break}g+i>u?g=u-i-l:g<0&&(g=l),f+d>p?f=p-d-l:f<0&&(f=l),n instanceof HTMLElement&&(n.style.top=`${g}px`,n.style.left=`${f}px`,n.style.position="fixed")},Up={class:"text-center"},Hp={class:"py-2 px-4 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},pt=Object.assign({inheritAttrs:!1},{__name:"vs-popover",props:{isOpen:{type:Boolean,default:()=>!1},placement:{type:String,default:"top"},gap:{type:Number,default:8},width:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},trigger:{type:String,default:"click"},teleport:{type:String,default:"body"}},emits:["isvisible"],setup(r,{expose:t,emit:n}){const l=r,a=n,o=e.ref(!1),s=e.ref([]),c=e.ref(null),i=e.ref(null),d=e.ref(null);e.watch(o,k=>{k?(u(),window.addEventListener("resize",()=>Nt(l.placement,i.value,d.value)),Nt(l.placement,i.value,d.value)):window.removeEventListener("resize",()=>Nt(l.placement,i.value,d.value)),a("isvisible",k)}),e.onMounted(()=>{window.addEventListener("click",b),window.addEventListener("popstate",C),window.addEventListener("scroll",w,!0),u()}),e.onBeforeUnmount(()=>{window.removeEventListener("click",b),window.removeEventListener("popstate",C),p()});const u=()=>{let k=c.value;for(;k&&k!==document.body;)(k.scrollHeight>k.clientHeight||k.scrollWidth>k.clientWidth)&&(k.addEventListener("scroll",h),s.value.push(k)),k=k.parentElement;document.body&&(document.body.addEventListener("scroll",h),s.value.push(document.body))},p=()=>{s.value.forEach(k=>{k.removeEventListener("scroll",h)}),s.value=[]},g=()=>{o.value=!0,Nt(l.placement,i.value,d.value)},f=()=>{o.value=!1},y=async()=>{await Nt(l.placement,i.value,d.value),o.value=!o.value},h=()=>{o.value=!1},b=k=>{if(!k){o.value=!1;return}i.value?.contains(k.target)||d.value?.contains(k.target)||(o.value=!1)},C=()=>{o.value&&(o.value=!1)},w=k=>{o.value&&d.value&&!d.value.contains(k.target)&&(o.value=!1)};return t({togglePopover:y}),(k,x)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"popover",ref:c,class:"vs-popover inline-block"},[e.createElementVNode("div",Up,[r.trigger==="click"?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"popoverRef",ref:i,onClick:y,class:e.normalizeClass({"pointer-events-none":r.disabled})},[e.renderSlot(k.$slots,"reference",{},()=>[x[0]||(x[0]=e.createElementVNode("button",null,"Click me!",-1))])],2)):e.createCommentVNode("",!0),r.trigger==="hover"?(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"popoverRef",ref:i,onMouseover:g,onMouseleave:f,class:e.normalizeClass({"pointer-events-none":r.disabled})},[e.renderSlot(k.$slots,"reference",{},()=>[x[1]||(x[1]=e.createElementVNode("button",null,"Click me!",-1))])],34)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.Teleport,{to:r.teleport},[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(["vsTailwind vs-popover__content",r.placement]),ref_key:"contentPop",ref:d,style:e.normalizeStyle({width:r.width?r.width+"px":"fit-content",zIndex:100001})},[e.createElementVNode("div",Hp,[e.renderSlot(k.$slots,"default",{},()=>[x[2]||(x[2]=e.createElementVNode("span",null,"Popover content",-1))])])],6),[[e.vShow,o.value]])]),_:3})],8,["to"]))])],512))}}),qp={class:"flex flex-col gap-[2px] p-[2px]"},Kp=["onClick"],Gp={__name:"vs-editor-table",props:{editor:Object},setup(r){const{t}=nn(),n=r,l=e.ref(!1),a=e.ref("popover"),o=()=>{n.editor&&(n.editor.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),a.value.togglePopover())},s=()=>{n.editor&&(n.editor.chain().focus().addColumnAfter().run(),a.value.togglePopover())},c=()=>{n.editor&&(n.editor.chain().focus().addRowAfter().run(),a.value.togglePopover())},i=()=>{n.editor&&(n.editor.chain().focus().deleteColumn().run(),a.value.togglePopover())},d=()=>{n.editor&&(n.editor.chain().focus().deleteRow().run(),a.value.togglePopover())},u=()=>{n.editor&&(n.editor.chain().focus().deleteTable().run(),a.value.togglePopover())},p=()=>{n.editor&&(n.editor.chain().focus().mergeCells().run(),a.value.togglePopover())},g=()=>{n.editor&&(n.editor.chain().focus().splitCell().run(),a.value.togglePopover())},f=e.computed(()=>[{text:t("form.richtext.createTable"),function:o},{text:t("form.richtext.addColumn"),function:s},{text:t("form.richtext.addRow"),function:c},{text:t("form.richtext.deleteColumn"),function:i},{text:t("form.richtext.deleteRow"),function:d},{text:t("form.richtext.deleteTable"),function:u},{text:t("form.richtext.mergeCells"),function:p},{text:t("form.richtext.splitCells"),function:g}]);return(y,h)=>(e.openBlock(),e.createBlock(pt,{ref_key:"popover",ref:a,placement:"bottom",onIsvisible:h[0]||(h[0]=b=>l.value=b)},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Table",class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[l.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[e.createVNode(e.unref(R.Table2),{class:"h-4 w-4"})],2)]),default:e.withCtx(()=>[e.createElementVNode("div",qp,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(b,C)=>(e.openBlock(),e.createElementBlock("button",{key:C,onClick:b?.function,class:"px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded"},e.toDisplayString(b.text),9,Kp))),128))])]),_:1},512))}},Wp={class:"flex gap-[4px] p-1"},Yp=["title","onClick"],Zp={__name:"vs-editor-align",props:{editor:Object},setup(r){const t=r,n={left:R.AlignLeft,center:R.AlignCenter,right:R.AlignRight,justify:R.AlignJustify},l=e.ref(!1),a=e.ref("popover"),o=e.ref("left"),s=e.computed(()=>t.editor?t.editor.isActive("paragraph",{textAlign:"left"})||t.editor.isActive("heading",{textAlign:"left"}):!1),c=e.computed(()=>t.editor?t.editor.isActive("paragraph",{textAlign:"right"})||t.editor.isActive("heading",{textAlign:"right"}):!1),i=e.computed(()=>t.editor?t.editor.isActive("paragraph",{textAlign:"center"})||t.editor.isActive("heading",{textAlign:"center"}):!1),d=e.computed(()=>t.editor?t.editor.isActive("paragraph",{textAlign:"justify"})||t.editor.isActive("heading",{textAlign:"justify"}):!1),u=e.computed(()=>s.value||c.value||i.value||d.value),p=()=>{c.value?o.value="right":i.value?o.value="center":d.value?o.value="justify":o.value="left"};e.watch([s,c,i,d],()=>{p()},{immediate:!0}),e.onMounted(()=>{t.editor&&(t.editor.on("selectionUpdate",p),t.editor.on("update",p))}),e.onUnmounted(()=>{t.editor&&(t.editor.off("selectionUpdate",p),t.editor.off("update",p))});const g=y=>{t.editor&&(t.editor.chain().focus().setTextAlign(y).run(),o.value=y)},f=e.ref([{id:"left",isActive:s},{id:"center",isActive:i},{id:"right",isActive:c},{id:"justify",isActive:d}]);return(y,h)=>(e.openBlock(),e.createBlock(pt,{ref_key:"popover",ref:a,placement:"bottom",onIsvisible:h[0]||(h[0]=b=>l.value=b)},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Text Align",class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[u.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n[o.value]),{height:"16",width:"16"}))],2)]),default:e.withCtx(()=>[e.createElementVNode("div",Wp,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,b=>(e.openBlock(),e.createElementBlock("button",{title:"Text align "+b?.id,class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":b?.isActive}]),key:b?.id,onClick:C=>g(b?.id)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n[b?.id]),{height:"16",width:"16"}))],10,Yp))),128))])]),_:1},512))}},Xp={class:"flex flex-col gap-[2px] p-[2px]"},Jp=["onClick"],Qp={__name:"vs-editor-type-tag",props:{editor:Object},setup(r){const{t}=nn(),n=r,l=e.ref(!1),a=e.ref("popover"),o=()=>{n.editor&&(n.editor?.chain().focus().setParagraph().run(),a.value.togglePopover())},s=i=>{n.editor&&(n.editor?.chain().focus().toggleHeading({level:i}).run(),a.value.togglePopover())},c=e.computed(()=>[{text:t("form.richtext.heading1"),id:1,style:"font-[700] text-[30px]"},{text:t("form.richtext.heading2"),id:2,style:"font-[700] text-[26px]"},{text:t("form.richtext.heading3"),id:3,style:"font-[700] text-[22px]"},{text:t("form.richtext.heading4"),id:4,style:"font-[700] text-[18px]"},{text:t("form.richtext.heading5"),id:5,style:"font-[500] text-[16px]"},{text:t("form.richtext.heading6"),id:6,style:"font-[400] text-[14px]"}]);return(i,d)=>(e.openBlock(),e.createBlock(pt,{ref_key:"popover",ref:a,placement:"bottom",onIsvisible:d[0]||(d[0]=u=>l.value=u)},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Type Tag",class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[l.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[e.createVNode(e.unref(R.Type),{class:"h-4 w-4"})],2)]),default:e.withCtx(()=>[e.createElementVNode("div",Xp,[e.createElementVNode("button",{onClick:o,class:e.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded",[r.editor?.isActive("paragraph")?"bg-gray-100":""]])},e.toDisplayString(e.unref(t)("form.richtext.paragraph")),3),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(u,p)=>(e.openBlock(),e.createElementBlock("button",{key:p,onClick:g=>s(u?.id),class:e.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded leading-[100%]",[u?.style,r.editor?.isActive("heading",{level:u?.id})?"bg-gray-100":""]])},e.toDisplayString(e.unref(t)(`form.richtext.heading${u?.id}`)),11,Jp))),128))])]),_:1},512))}},ef={components:{VsText:Gr},inheritAttrs:!1,events:["update:modelValue"],props:{modelValue:{type:String},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},isTextInputShown:{type:Boolean,default:()=>!0}},computed:{value:{get(){return this.modelValue??""},set(r){this.$emit("update:modelValue",r)}}}},tf={class:"flex items-center w-full max-w-[182px]"},nf=["disabled"];function rf(r,t,n,l,a,o){const s=e.resolveComponent("vs-text");return e.openBlock(),e.createElementBlock("div",tf,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":t[0]||(t[0]=c=>o.value=c),type:"color",class:e.normalizeClass(["w-[38px] h-[38px] min-h-[38px] min-w-[38px] py-[2px] px-[3px] -ml-1 dark:bg-neutral-800 border dark:border-neutral-700 border-stone-200 rounded-lg",n.disabled?"cursor-not-allowed":"cursor-pointer"]),disabled:n.disabled},null,10,nf),[[e.vModelText,o.value]]),n.isTextInputShown?(e.openBlock(),e.createBlock(s,{key:0,modelValue:o.value,"onUpdate:modelValue":t[1]||(t[1]=c=>o.value=c),class:"ml-2 w-full",disabled:n.disabled,clearable:n.clearable},null,8,["modelValue","disabled","clearable"])):e.createCommentVNode("",!0)])}const Wr=pe(ef,[["render",rf]]),lf={class:"flex gap-[4px] mb-[8px]"},af={class:"grid grid-rows-3 grid-cols-7"},of={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},sf=["onClick","title"],cf={__name:"vs-editor-color",props:{editor:Object},setup(r){const t=r,n=e.ref(null),l=e.ref("#000000"),a=e.computed(()=>t.editor&&t.editor.getAttributes("textStyle").color||"#000000"),o=e.computed(()=>a.value!=="#000000"),s=()=>{t.editor&&(l.value=a.value)};e.onMounted(()=>{t.editor&&(t.editor.on("selectionUpdate",s),t.editor.on("update",s),s())}),e.onUnmounted(()=>{t.editor&&(t.editor.off("selectionUpdate",s),t.editor.off("update",s))});const c=e.ref(["#172B4D","#0747A6","#008DA6","#006644","#FF991F","#BF2600","#403294","#97A0AF","#4C9AFF","#00B8D9","#36B37E","#FFC400","#FF5630","#6554C0","#FFFFFF","#B3D4FF","#B3F5FF","#ABF5D1","#FFF0B3","#FFBDAD","#EAE6FF"]),i=p=>{t.editor&&(t.editor.chain().focus().setColor(p).run(),l.value=p,n.value&&n.value.togglePopover())},d=()=>{i(l.value)},u=p=>({"#172B4D":"Default","#0747A6":"Bright blue","#008DA6":"Bright blue-green","#006644":"Bright green","#FF991F":"Bright orange","#BF2600":"Bright red","#403294":"Bright purple","#97A0AF":"Gray","#4C9AFF":"Blue","#00B8D9":"Blue-green","#36B37E":"Green","#FFC400":"Yellow","#FF5630":"Red","#6554C0":"Purple","#FFFFFF":"White","#B3D4FF":"Bright blue","#B3F5FF":"Bright blue-green","#ABF5D1":"Bright green","#FFF0B3":"Bright yellow","#FFBDAD":"Bright red","#EAE6FF":"Bright purple"})[p]||p;return(p,g)=>(e.openBlock(),e.createBlock(pt,{ref_key:"popover",ref:n,placement:"bottom"},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Text Color",class:e.normalizeClass(["flex flex-col h-[30px] min-w-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-100":o.value}])},[g[1]||(g[1]=e.createElementVNode("span",{class:"leading-none"},"A",-1)),e.createElementVNode("span",{class:"block h-1 w-5",style:e.normalizeStyle({backgroundColor:l.value})},null,4)],2)]),default:e.withCtx(()=>[e.createElementVNode("div",null,[e.createElementVNode("div",lf,[e.createVNode(Wr,{modelValue:l.value,"onUpdate:modelValue":g[0]||(g[0]=f=>l.value=f)},null,8,["modelValue"]),e.createElementVNode("button",{onClick:d,class:"h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"},[e.createVNode(e.unref(R.Check),{class:"h-4 w-4 text-white"})])]),e.createElementVNode("div",af,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,f=>(e.openBlock(),e.createElementBlock("div",{key:f,class:"h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"},[e.createElementVNode("div",of,[e.createElementVNode("button",{class:"flex items-center justify-center w-full h-full",style:e.normalizeStyle({backgroundColor:f}),onClick:y=>i(f),title:u(f)},[l.value===f?(e.openBlock(),e.createBlock(e.unref(R.Check),{key:0,class:"h-4 w-4 text-gray-500"})):e.createCommentVNode("",!0)],12,sf)])]))),128))])])]),_:1},512))}},df={class:"flex gap-[4px] mb-[8px]"},uf={class:"grid grid-rows-3 grid-cols-7"},pf={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},ff=["onClick","title"],mf=["onClick","title"],hf={__name:"vs-editor-background-color",props:{editor:Object},setup(r){const t=r,n=e.ref(null),l=e.ref("transparent"),a=e.computed(()=>t.editor&&t.editor.getAttributes("textStyle").backgroundColor||"transparent"),o=e.computed(()=>a.value!=="transparent"&&a.value!==""),s=()=>{t.editor&&(l.value=a.value)};e.onMounted(()=>{t.editor&&(t.editor.on("selectionUpdate",s),t.editor.on("update",s),s())}),e.onUnmounted(()=>{t.editor&&(t.editor.off("selectionUpdate",s),t.editor.off("update",s))});const c=e.ref(["#172B4D","#0747A6","#008DA6","#006644","#FF991F","#BF2600","#403294","#97A0AF","#4C9AFF","#00B8D9","#36B37E","#FFC400","#FF5630","#6554C0","#FFFFFF","#B3D4FF","#B3F5FF","#ABF5D1","#FFF0B3","#FFBDAD","#EAE6FF"]),i=p=>{t.editor&&(t.editor.chain().focus().setBackgroundColor(p).run(),l.value=p,n.value&&n.value.togglePopover())},d=()=>{i(l.value)},u=p=>({"#172B4D":"Default","#0747A6":"Bright blue","#008DA6":"Bright blue-green","#006644":"Bright green","#FF991F":"Bright orange","#BF2600":"Bright red","#403294":"Bright purple","#97A0AF":"Gray","#4C9AFF":"Blue","#00B8D9":"Blue-green","#36B37E":"Green","#FFC400":"Yellow","#FF5630":"Red","#6554C0":"Purple",transparent:"Transparent","#B3D4FF":"Bright blue","#B3F5FF":"Bright blue-green","#ABF5D1":"Bright green","#FFF0B3":"Bright yellow","#FFBDAD":"Bright red","#EAE6FF":"Bright purple"})[p]||p;return(p,g)=>(e.openBlock(),e.createBlock(pt,{ref_key:"popover",ref:n,placement:"bottom"},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Background Color",class:e.normalizeClass(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-100":o.value}])},[e.createVNode(e.unref(R.PaintBucket),{class:"h-4 w-4"}),e.createElementVNode("span",{class:"block h-1 w-5",style:e.normalizeStyle({backgroundColor:l.value})},null,4)],2)]),default:e.withCtx(()=>[e.createElementVNode("div",null,[e.createElementVNode("div",df,[e.createVNode(Wr,{modelValue:l.value,"onUpdate:modelValue":g[0]||(g[0]=f=>l.value=f)},null,8,["modelValue"]),e.createElementVNode("button",{onClick:d,class:"h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"},[e.createVNode(e.unref(R.Check),{class:"h-4 w-4 text-white"})])]),e.createElementVNode("div",uf,[e.createElementVNode("button",{onClick:g[1]||(g[1]=f=>i("transparent")),class:"col-span-7 flex items-center justify-center gap-2 bg-gray-100 rounded-md py-1 mb-2 hover:bg-gray-200"},[e.createVNode(e.unref(R.Eraser),{class:"h-4 w-4"}),g[2]||(g[2]=e.createElementVNode("p",null,"no color",-1))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,f=>(e.openBlock(),e.createElementBlock("div",{key:f,class:"h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"},[e.createElementVNode("div",pf,[f!=="transparent"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"flex items-center justify-center w-full h-full",style:e.normalizeStyle({backgroundColor:f}),onClick:y=>i(f),title:u(f)},[l.value===f?(e.openBlock(),e.createBlock(e.unref(R.Check),{key:0,class:"h-4 w-4 text-gray-500"})):e.createCommentVNode("",!0)],12,ff)):e.createCommentVNode("",!0),f==="transparent"?(e.openBlock(),e.createElementBlock("button",{key:1,class:"flex items-center justify-center w-full h-full",onClick:y=>i(f),title:u(f)},[l.value===f?(e.openBlock(),e.createBlock(e.unref(R.Check),{key:0,class:"h-4 w-4 text-gray-500"})):e.createCommentVNode("",!0)],8,mf)):e.createCommentVNode("",!0)])]))),128))])])]),_:1},512))}},gf={__name:"vs-editor-highlight",props:{editor:Object},setup(r){const t=r,n=e.computed(()=>t.editor?.isActive("highlight")),l=()=>{t.editor&&t.editor.chain().focus().toggleHighlight().run()};return(a,o)=>(e.openBlock(),e.createElementBlock("button",{title:"Highlight",onClick:l,class:e.normalizeClass(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-200":n.value}])},[e.createVNode(e.unref(R.Highlighter),{class:"h-4 w-4"})],2))}},yf={class:"truncate"},bf={class:"w-[200px]"},kf={class:"max-h-[200px] overflow-y-auto"},xf=["onClick"],wf={__name:"vs-editor-font-family",props:{editor:Object},setup(r){const t=r,n=e.ref("popover"),l=e.ref(!1),a=e.ref([{label:"Arial",value:"Arial, sans-serif"},{label:"Helvetica",value:"Helvetica, sans-serif"},{label:"Times New Roman",value:"Times New Roman, serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Verdana",value:"Verdana, sans-serif"},{label:"Courier New",value:"Courier New, monospace"},{label:"Comic Sans MS",value:"Comic Sans MS, cursive"},{label:"Impact",value:"Impact, sans-serif"},{label:"Trebuchet MS",value:"Trebuchet MS, sans-serif"},{label:"Palatino",value:"Palatino, serif"}]),o=e.computed(()=>{if(!t.editor)return"Arial, sans-serif";for(const d of a.value)if(t.editor.isActive("textStyle",{fontFamily:d.value}))return d.value;return"Arial, sans-serif"}),s=e.computed(()=>a.value.find(u=>u.value===o.value)?.label||"Arial"),c=d=>t.editor?t.editor.isActive("textStyle",{fontFamily:d}):!1,i=d=>{t.editor&&(t.editor.chain().focus().setFontFamily(d).run(),n.value&&n.value.togglePopover())};return(d,u)=>(e.openBlock(),e.createBlock(pt,{ref_key:"popover",ref:n,placement:"bottom",onIsvisible:u[0]||(u[0]=p=>l.value=p)},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Font Family",class:e.normalizeClass(["h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm",[l.value?"bg-gray-100 text-gray-900":"text-gray-700"]]),style:e.normalizeStyle({fontFamily:o.value})},[e.createElementVNode("span",yf,e.toDisplayString(s.value),1),e.createVNode(e.unref(R.ChevronDown),{class:"ml-1 h-3 w-3 text-gray-400"})],6)]),default:e.withCtx(()=>[e.createElementVNode("div",bf,[e.createElementVNode("ul",kf,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,p=>(e.openBlock(),e.createElementBlock("li",{key:p.value,class:e.normalizeClass(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm",{"bg-gray-100":c(p.value)}]),style:e.normalizeStyle({fontFamily:p.value}),onClick:g=>i(p.value)},e.toDisplayString(p.label),15,xf))),128))])])]),_:1},512))}},_f={class:"w-[120px]"},vf={class:"max-h-[200px] overflow-y-auto"},Cf=["onClick"],Ef={__name:"vs-editor-font-size",props:{editor:Object},setup(r){const t=r,n=e.ref("popover"),l=e.ref("14px"),a=e.computed(()=>t.editor&&t.editor.getAttributes("textStyle").fontSize||"14px"),o=e.computed(()=>a.value!=="14px"),s=()=>{t.editor&&(l.value=a.value)};e.onMounted(()=>{t.editor&&(t.editor.on("selectionUpdate",s),t.editor.on("update",s),s())}),e.onUnmounted(()=>{t.editor&&(t.editor.off("selectionUpdate",s),t.editor.off("update",s))});const c=e.ref([{label:"8px",value:"8px"},{label:"9px",value:"9px"},{label:"10px",value:"10px"},{label:"11px",value:"11px"},{label:"12px",value:"12px"},{label:"14px",value:"14px"},{label:"16px",value:"16px"},{label:"18px",value:"18px"},{label:"20px",value:"20px"},{label:"24px",value:"24px"},{label:"28px",value:"28px"},{label:"32px",value:"32px"},{label:"36px",value:"36px"},{label:"48px",value:"48px"},{label:"72px",value:"72px"}]),i=d=>{t.editor&&(t.editor.chain().focus().setFontSize(d).run(),l.value=d,n.value&&n.value.togglePopover())};return(d,u)=>(e.openBlock(),e.createBlock(pt,{ref_key:"popover",ref:n,placement:"bottom"},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Font Size",class:e.normalizeClass(["h-[30px] px-2 min-w-[30px] rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700 space-x-1",{"bg-gray-100 text-gray-900":o.value}])},[e.createVNode(e.unref(R.ALargeSmall),{class:"h-4 w-4"}),e.createVNode(e.unref(R.ChevronDown),{class:"h-3 w-3 text-gray-400"})],2)]),default:e.withCtx(()=>[e.createElementVNode("div",_f,[e.createElementVNode("ul",vf,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,p=>(e.openBlock(),e.createElementBlock("li",{key:p.value,class:"px-3 py-2 hover:bg-gray-100 cursor-pointer",onClick:g=>i(p.value)},e.toDisplayString(p.label),9,Cf))),128))])])]),_:1},512))}},Bf={components:{Superscript:R.Superscript},props:{editor:Object},methods:{toggleSuperscript(){this.editor&&this.editor.commands.toggleSuperscript()}}};function Vf(r,t,n,l,a,o){const s=e.resolveComponent("Superscript");return e.openBlock(),e.createElementBlock("button",{title:"Superscript",onClick:t[0]||(t[0]=(...c)=>o.toggleSuperscript&&o.toggleSuperscript(...c)),class:e.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("superscript")}])},[e.createVNode(s,{class:"h-4 w-4"}),t[1]||(t[1]=e.createElementVNode("span",{class:"sr-only"},"Superscript",-1))],2)}const Sf=pe(Bf,[["render",Vf]]),$f={components:{Subscript:R.Subscript},props:{editor:Object},methods:{toggleSubscript(){this.editor&&this.editor.commands.toggleSubscript()}}};function Af(r,t,n,l,a,o){const s=e.resolveComponent("Subscript");return e.openBlock(),e.createElementBlock("button",{title:"Subscript",onClick:t[0]||(t[0]=(...c)=>o.toggleSubscript&&o.toggleSubscript(...c)),class:e.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("subscript")}])},[e.createVNode(s,{class:"h-4 w-4"}),t[1]||(t[1]=e.createElementVNode("span",{class:"sr-only"},"Subscript",-1))],2)}const Ff=pe($f,[["render",Af]]),Nf={title:"Heading",class:"h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700"},Df={class:"truncate"},Mf={class:"max-h-[200px] overflow-y-auto"},Tf=["onClick"],Lf=pe({__name:"vs-editor-heading",props:{editor:Object},setup(r){const t=r,n=e.ref("popover"),l=e.ref([{label:"Heading 1",value:1},{label:"Heading 2",value:2},{label:"Heading 3",value:3},{label:"Heading 4",value:4},{label:"Heading 5",value:5},{label:"Heading 6",value:6}]),a=e.computed(()=>{if(!t.editor)return"Paragraph";for(let i=1;i<=6;i++)if(t.editor.isActive("heading",{level:i}))return`H ${i}`;return"P"}),o=i=>({1:"font-weight:700; font-size:30px;",2:"font-weight:700; font-size:26px;",3:"font-weight:700; font-size:22px;",4:"font-weight:700; font-size:18px;",5:"font-weight:500; font-size:16px;",6:"font-weight:400; font-size:14px;"})[i]||"",s=i=>{t.editor&&(t.editor.chain().focus().setHeading({level:i}).run(),n.value&&n.value.togglePopover())},c=()=>{t.editor&&(t.editor.chain().focus().setParagraph().run(),n.value&&n.value.togglePopover())};return(i,d)=>(e.openBlock(),e.createBlock(pt,{ref_key:"popover",ref:n,placement:"bottom"},{reference:e.withCtx(()=>[e.createElementVNode("button",Nf,[e.createElementVNode("span",Df,e.toDisplayString(a.value),1),e.createVNode(e.unref(R.ChevronDown),{class:"ml-1 h-3 w-3 text-gray-400"})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,[e.createElementVNode("ul",Mf,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,u=>(e.openBlock(),e.createElementBlock("li",{key:u.value,class:e.normalizeClass(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm",`heading-level-${u.value}`]),style:e.normalizeStyle(o(u.value)),onClick:p=>s(u.value)},e.toDisplayString(u.label),15,Tf))),128)),e.createElementVNode("li",{class:"px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm border-t border-gray-200 mt-1 pt-2",onClick:c}," Paragraph ")])])]),_:1},512))}},[["__scopeId","data-v-96f02f2a"]]),If={components:{RemoveFormatting:R.RemoveFormatting},props:{editor:Object},methods:{clearFormatting(){this.editor&&this.editor.commands.unsetAllMarks()}}};function Of(r,t,n,l,a,o){const s=e.resolveComponent("RemoveFormatting");return e.openBlock(),e.createElementBlock("button",{title:"Clear Formatting",onClick:t[0]||(t[0]=(...c)=>o.clearFormatting&&o.clearFormatting(...c)),class:"h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100"},[e.createVNode(s,{class:"h-4 w-4"}),t[1]||(t[1]=e.createElementVNode("span",{class:"sr-only"},"Clear Formatting",-1))])}const zf=pe(If,[["render",Of]]),Rf={class:"relative"},Pf={key:0,class:"mt-4"},jf=["src","alt","title"],Uf={key:0,class:"text-sm text-red-500"},Hf={key:1,class:"mt-4"},qf={class:"text-sm text-gray-600 mb-2"},Kf={class:"flex flex-wrap gap-2"},Gf=["src","alt","onError"],Wf=["onClick"],Yf={class:"flex justify-end gap-x-2 p-[20px]"},Zf=Object.assign({inheritAttrs:!1},{__name:"vs-editor-image",props:{editor:{type:Object,required:!0}},setup(r){const t=r,n=e.ref(!1),l=e.ref(!1),a=e.ref({}),o=e.ref(!1),s=e.ref([]),c=e.ref(null),i=e.ref({src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1}),d=e.computed(()=>{if(Array.isArray(i.value.file)){const v=i.value.file.filter(V=>V instanceof File),A=i.value.file.filter(V=>typeof V=="string"&&V.trim()!=="");return v.length+A.length>1}return i.value.file instanceof FileList?i.value.file.length>1:!1}),u=e.computed(()=>Array.isArray(i.value.file)?i.value.file.filter(v=>v instanceof File).length===1:i.value.file instanceof FileList?i.value.file.length===1:i.value.file instanceof File),p=e.computed(()=>{if(d.value)return"";if(i.value.src)return i.value.src;if(u.value){let v=null;if(Array.isArray(i.value.file)||i.value.file instanceof FileList?v=i.value.file[0]:i.value.file instanceof File&&(v=i.value.file),v instanceof File){const A=s.value.find(E=>E.file===v);return A?A.preview:""}else if(typeof v=="string")return v}return""}),g=e.computed(()=>[{name:"src",label:"URL зображення",type:"text",required:!1,placeholder:"https://example.com/image.png"},{name:"file",label:"Файл (можна вибрати кілька)",type:"file",multiple:!0,required:!1,placeholder:"Шлях до файлу зображення",accept:"image/*"},{name:"width",label:"Ширина",type:"number",required:!1,placeholder:"Ширина зображення",clearable:!0,min:0},{name:"height",label:"Висота",type:"number",required:!1,placeholder:"Висота зображення",clearable:!0,min:0},{name:"alt",label:"Альтернативний текст",type:"text",required:!1,placeholder:"Опис зображення"},{name:"title",label:"Заголовок (необов'язково)",type:"text",required:!1,placeholder:"Заголовок зображення"},{name:"link",label:"Посилання",type:"text",required:!1,placeholder:"https://example.com"},{name:"openInNewTab",label:"Відкривати у новій вкладці?",type:"switcher",required:!1}]),f=()=>{if(!t.editor)return;if(t.editor.isActive("image")){const{state:A}=t.editor,{selection:E}=A,{$from:V}=E;let B=null,M=null;if(V.parent.type.name==="image")B=V.before(V.depth),M=V.parent;else for(let ee=V.depth;ee>0;ee--){const ve=V.node(ee),ye=V.before(ee);ve.type.name==="paragraph"&&ve.forEach((W,ae)=>{if(W.type.name==="image"){const ie=ye+ae+1;(B===null||Math.abs(ie-E.$from.pos)<Math.abs(B-E.$from.pos))&&(B=ie,M=W)}})}if(B!==null&&M){try{t.editor.chain().focus().setNodeSelection(B).run()}catch{t.editor.chain().focus().setTextSelection(B).run()}c.value=B}else{t.editor.chain().focus().selectParentNode().run();const{state:ee}=t.editor;c.value=ee.selection.$from.pos}const N=M?M.attrs:t.editor.getAttributes("image");o.value=!0;let F="",T=!1;const U=t.editor.getAttributes("link");U&&U.href&&(F=U.href,T=U.target==="_blank");const j=N.src||"",Y=j?[j]:[];i.value={src:j,file:Y,alt:N.alt||"",title:N.title||"",width:N.width||"",height:N.height||"",link:F,openInNewTab:T}}else o.value=!1,i.value={src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1};l.value=!1,n.value=!0},y=()=>{n.value=!1,l.value=!1,o.value=!1,s.value=[],c.value=null,i.value={src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1}},h=async v=>{if(!v||v.length===0)return;const A=[];for(const E of v)if(E&&E.type&&E.type.startsWith("image/")&&!s.value.some(B=>B.file===E)){const B=new Promise((M,N)=>{const F=new FileReader;F.onload=T=>{s.value.push({file:E,preview:T.target.result,error:!1}),M()},F.onerror=N,F.readAsDataURL(E)});A.push(B)}await Promise.all(A)},b=v=>{s.value.splice(v,1),Array.isArray(i.value.file)&&i.value.file.splice(v,1)},C=()=>{const v=i.value.width!==null&&i.value.width!==void 0&&i.value.width!==""&&String(i.value.width).trim()!==""?String(i.value.width).trim():"",A=i.value.height!==null&&i.value.height!==void 0&&i.value.height!==""&&String(i.value.height).trim()!==""?String(i.value.height).trim():"",E={};return v&&A?(E.width=v,E.height=A,E.style=`width: ${v}px; height: ${A}px; object-fit: fill;`):v?(E.width=v,E.height=void 0):A?(E.height=A,E.width=void 0):(E.width=void 0,E.height=void 0),E},w=(v,A=null,E=50)=>{const V=()=>{const{view:N}=v;if(!N||!N.dom)return;N.dom.querySelectorAll("img.editor-image[width][height]").forEach(U=>{if(U instanceof HTMLImageElement){const j=U.getAttribute("width"),Y=U.getAttribute("height");j&&Y&&j!=="auto"&&Y!=="auto"&&j!==""&&Y!==""&&!isNaN(Number(j))&&!isNaN(Number(Y))&&(U.style.cssText=`
|
|
33
|
+
width: ${j}px !important;
|
|
34
|
+
height: ${Y}px !important;
|
|
35
|
+
max-width: none !important;
|
|
36
|
+
max-height: none !important;
|
|
37
|
+
min-width: auto !important;
|
|
38
|
+
min-height: auto !important;
|
|
39
|
+
object-fit: fill !important;
|
|
40
|
+
`.replace(/\s+/g," ").trim())}})},B=i.value.width,M=i.value.height;B&&M&&B!==""&&M!==""?[0,E,E*2,E*3,E*4].forEach(F=>{setTimeout(V,F)}):(V(),setTimeout(V,E))},k=async()=>{let v=[],A=[];if(Array.isArray(i.value.file)?(v=i.value.file.filter(N=>N instanceof File),A=i.value.file.filter(N=>typeof N=="string"&&N.trim()!=="")):i.value.file instanceof FileList?v=Array.from(i.value.file):i.value.file instanceof File?v=[i.value.file]:typeof i.value.file=="string"&&i.value.file.trim()!==""&&(A=[i.value.file]),v.length===0&&A.length===0&&a.value&&a.value.file){const N=a.value.file;Array.isArray(N)?(v=N.filter(F=>F instanceof File),A=N.filter(F=>typeof F=="string"&&F.trim()!=="")):N instanceof FileList?v=Array.from(N):N instanceof File?v=[N]:typeof N=="string"&&N.trim()!==""&&(A=[N])}if(A.length>0&&!o.value){for(const N of A)s.value.some(F=>F.url===N)||s.value.push({url:N,preview:N,error:!1});if(v.length===0&&s.value.length>0){await S();return}}const E=v.length,V=E+A.length;if(!(o.value&&E<=1)){if(E>0){const N=v.filter(F=>!s.value.some(T=>T.file===F));N.length>0&&await h(N)}}if(!o.value){if(V>1||d.value||s.value.length>1){if(s.value.length>0){await S();return}else if(E>0){if(await h(v),s.value.length>0){await S();return}}else if(A.length>0){await S();return}}else if(s.value.length>1){await S();return}}let B=i.value.src;if(u.value){let N=null;if(Array.isArray(i.value.file)||i.value.file instanceof FileList?N=i.value.file[0]:(i.value.file instanceof File||typeof i.value.file=="string")&&(N=i.value.file),N instanceof File)try{const F=new FileReader,T=await new Promise((U,j)=>{F.onload=Y=>U(Y.target.result),F.onerror=j,F.readAsDataURL(N)});B=T,o.value&&(i.value.src=T)}catch(F){console.error("Помилка при читанні файлу:",F),ge.notify({type:"error",title:"Помилка",message:"Не вдалося прочитати файл"});return}else typeof N=="string"&&N.trim()!==""&&(B=N.trim(),o.value&&N.trim()!==i.value.src&&(i.value.src=N.trim(),B=N.trim()))}else if(Array.isArray(i.value.file)&&i.value.file.length===1){const N=i.value.file[0];typeof N=="string"&&N.trim()!==""&&(B=N.trim(),(!i.value.src||i.value.src!==N.trim())&&(i.value.src=N.trim()))}else typeof i.value.file=="string"&&i.value.file.trim()!==""&&(B=i.value.file.trim(),(!i.value.src||i.value.src!==i.value.file.trim())&&(i.value.src=i.value.file.trim()));const M=B||Array.isArray(i.value.file)&&i.value.file.length>0&&(i.value.file.some(N=>N instanceof File)||i.value.file.some(N=>typeof N=="string"&&N.trim()!==""))||i.value.file instanceof FileList&&i.value.file.length>0||typeof i.value.file=="string"&&i.value.file.trim()!=="";if(!B&&!M){ge.notify({type:"warning",title:"Попередження",message:"Будь ласка, введіть URL зображення або виберіть файл"});return}if(!d.value&&!M&&await a.value.validate()){ge.notify({type:"warning",title:"Попередження",message:"Будь ласка, заповніть всі обов'язкові поля"});return}if(t.editor&&B)if(o.value&&c.value!==null){const{state:N}=t.editor;try{t.editor.chain().focus().setNodeSelection(c.value).run()}catch{t.editor.chain().focus().setTextSelection(c.value).run()}const F=t.editor.getAttributes("link"),T=F&&F.href,U=C(),j={src:B,alt:i.value.alt||"",title:i.value.title||"",...U};if((!i.value.width||i.value.width==="")&&(j.width=void 0),(!i.value.height||i.value.height==="")&&(j.height=void 0),t.editor.chain().focus().updateAttributes("image",j).run(),setTimeout(()=>{const{view:Y}=t.editor;if(!Y||!Y.dom)return;Y.dom.querySelectorAll("img.editor-image").forEach(ye=>{if(ye instanceof HTMLImageElement){const W=ye.getAttribute("src")||ye.src;(W===B||W.includes(B.split("/").pop()))&&(i.value.width&&i.value.height?(ye.style.setProperty("width",`${i.value.width}px`,"important"),ye.style.setProperty("height",`${i.value.height}px`,"important"),ye.style.setProperty("object-fit","fill","important"),ye.style.setProperty("max-width","none","important"),ye.style.setProperty("max-height","none","important")):(ye.style.removeProperty("width"),ye.style.removeProperty("height"),ye.style.removeProperty("object-fit"),ye.style.removeProperty("max-width"),ye.style.removeProperty("max-height")))}})},20),i.value.link&&i.value.link.trim()!==""){let Y=i.value.link.trim();Y.match(/^https?:\/\//i)||(Y="https://"+Y),T?t.editor.chain().focus().extendMarkRange("link").setLink({href:Y,target:i.value.openInNewTab?"_blank":null}).run():t.editor.chain().focus().selectParentNode().setLink({href:Y,target:i.value.openInNewTab?"_blank":null}).run()}else T&&t.editor.chain().focus().extendMarkRange("link").unsetLink().run()}else{const{state:N}=t.editor,{selection:F}=N,{$anchor:T}=F;let U=null;for(let Y=T.depth;Y>0;Y--){const ee=T.node(Y);if(ee&&ee.type.name==="paragraph"){U=ee;break}}if(U&&U.content.content.some(Y=>Y.type.name==="image")){const Y=x(U,T.before(T.depth));if(Y!==null){const ee=C(),ve=N.schema.nodes.image.create({src:B,alt:i.value.alt||"",title:i.value.title||"",...ee});if(i.value.link&&i.value.link.trim()!==""){let ye=i.value.link.trim();ye.match(/^https?:\/\//i)||(ye="https://"+ye);const W=N.schema.marks.link.create({href:ye,target:i.value.openInNewTab?"_blank":null}),ae=ve.type.create(ve.attrs,ve.content,[W]);t.editor.chain().focus().insertContentAt(Y+1,ae).run(),w(t.editor,B)}else t.editor.chain().focus().insertContentAt(Y+1,ve).run(),w(t.editor,B)}else if(i.value.link&&i.value.link.trim()!==""){const ee=C();t.editor.chain().focus().setImage({src:B,alt:i.value.alt||"",title:i.value.title||"",...ee}).run(),setTimeout(()=>{let ve=i.value.link.trim();ve.match(/^https?:\/\//i)||(ve="https://"+ve),t.editor.chain().focus().selectParentNode().setLink({href:ve,target:i.value.openInNewTab?"_blank":null}).run(),w(t.editor,B,20)},10)}else{const ee=C();t.editor.chain().focus().setImage({src:B,alt:i.value.alt||"",title:i.value.title||"",...ee}).run(),w(t.editor,B)}}else if(i.value.link&&i.value.link.trim()!==""){const Y=C();t.editor.chain().focus().setImage({src:B,alt:i.value.alt||"",title:i.value.title||"",...Y}).run(),setTimeout(()=>{let ee=i.value.link.trim();ee.match(/^https?:\/\//i)||(ee="https://"+ee),t.editor.chain().focus().selectParentNode().setLink({href:ee,target:i.value.openInNewTab?"_blank":null}).run(),w(t.editor,B,20)},10)}else{const Y=C();t.editor.chain().focus().setImage({src:B,alt:i.value.alt||"",title:i.value.title||"",...Y}).run(),w(t.editor,B)}}y()},x=(v,A)=>{let E=null;return v.forEach((V,B)=>{V.type.name==="image"&&(E=A+B+1)}),E},S=async()=>{if(t.editor){if(s.value.length===0)if(Array.isArray(i.value.file)&&i.value.file.length>0){const v=i.value.file.filter(E=>typeof E=="string"&&E.trim()!==""),A=i.value.file.filter(E=>E instanceof File);for(const E of v)s.value.some(V=>V.url===E||V.preview===E)||s.value.push({url:E,preview:E,error:!1});A.length>0&&await h(A)}else d.value&&await h(i.value.file);if(s.value.length!==0)try{const v=[],A=C();for(const E of s.value){const V=E.url||E.preview||"";if(!V)continue;const B=t.editor.schema.nodes.image.create({src:V,alt:i.value.alt||"",title:i.value.title||"",...A});v.push(B)}v.length>0&&(t.editor.chain().focus().command(({tr:E,dispatch:V})=>{if(V){const{selection:B}=E,{$anchor:M}=B;let N=B.$anchor.pos,F=null,T=null;for(let j=M.depth;j>0;j--){const Y=M.node(j);if(Y&&Y.type.name==="paragraph"){F=Y,T=M.start(j);break}}if(F){let j=null;F.forEach((Y,ee)=>{Y.type.name==="image"&&(j=T+ee+1)}),j!==null?N=j+1:N=T+F.content.size}let U=N;return v.forEach(j=>{E.insert(U,j),U+=j.nodeSize}),!0}return!1}).run(),i.value.width&&i.value.height&&setTimeout(()=>{const{view:E}=t.editor;E&&E.dom&&E.dom.querySelectorAll("img.editor-image").forEach(M=>{M instanceof HTMLImageElement&&Array.from(s.value).some(F=>{const T=F.url||F.preview||"",U=M.src||M.getAttribute("src")||"";return U===T||U.includes(T.split("/").pop())})&&(M.style.setProperty("width",`${i.value.width}px`,"important"),M.style.setProperty("height",`${i.value.height}px`,"important"),M.style.setProperty("object-fit","fill","important"),M.style.setProperty("max-width","none","important"),M.style.setProperty("max-height","none","important"))})},50)),y()}catch(v){console.error("Помилка при додаванні зображень:",v),ge.notify({type:"error",title:"Помилка",message:"Не вдалося додати зображення"})}}},L=async()=>{await k()},$=()=>{y()};return e.watch(()=>i.value.file,async(v,A)=>{if(l.value=!1,!(o.value&&Array.isArray(v)&&v.length===1&&typeof v[0]=="string"&&!v.some(V=>V instanceof File)))if(Array.isArray(v)&&v.length>0){const E=v.filter(B=>B instanceof File),V=v.filter(B=>typeof B=="string"&&B.trim()!=="");if(E.length>0&&(o.value?o.value&&E.length===1&&V.length===0&&(s.value=[]):s.value=[],(!o.value||E.length>1||V.length>0)&&await h(E),o.value&&E.length===1&&V.length===0)){const B=new FileReader;B.onload=M=>{i.value.src=M.target.result},B.readAsDataURL(E[0])}if(V.length>0)if(o.value)o.value&&V.length===1&&E.length===0&&(i.value.src=V[0]);else{E.length===0&&(s.value=[]);for(const B of V)s.value.some(M=>M.url===B||M.preview===B)||s.value.push({url:B,preview:B,error:!1})}}else v&&typeof v=="object"&&v instanceof FileList?(o.value||(s.value=[]),await h(Array.from(v))):v&&typeof v=="object"&&!Array.isArray(v)&&v instanceof File?(o.value||(s.value=[]),await h([v])):o.value||(s.value=[])},{immediate:!1}),e.watch(()=>i.value.src,()=>{l.value=!1}),(v,A)=>(e.openBlock(),e.createElementBlock("div",Rf,[e.createElementVNode("button",{onClick:f,class:e.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",r.editor?.isActive("image")?"bg-gray-200 text-gray-900":""]),title:"Додати зображення"},[e.createVNode(e.unref(R.Image),{class:"h-4 w-4"}),A[4]||(A[4]=e.createElementVNode("span",{class:"sr-only"},"Додати зображення",-1))],2),e.createVNode(Kr,{modelValue:n.value,"onUpdate:modelValue":A[3]||(A[3]=E=>n.value=E),title:o.value?"Редагувати зображення":"Додати зображення"},{footer:e.withCtx(()=>[e.createElementVNode("div",Yf,[e.createElementVNode("button",{onClick:$,type:"button",class:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500"}," Скасувати "),e.createElementVNode("button",{onClick:L,type:"button",class:"px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500"},e.toDisplayString(o.value?"Оновити зображення":"Додати зображення"),1)])]),default:e.withCtx(()=>[e.createVNode(tt,{modelValue:i.value,"onUpdate:modelValue":A[0]||(A[0]=E=>i.value=E),schema:g.value,form:a.value,"onUpdate:form":A[1]||(A[1]=E=>a.value=E)},null,8,["modelValue","schema","form"]),p.value&&!d.value?(e.openBlock(),e.createElementBlock("div",Pf,[A[5]||(A[5]=e.createElementVNode("p",{class:"text-sm text-gray-600 mb-2"},"Попередній перегляд:",-1)),e.withDirectives(e.createElementVNode("img",{src:p.value,alt:i.value.alt||"Попередній перегляд зображення",title:i.value.title,class:"max-w-full h-auto max-h-32 rounded border",onError:A[2]||(A[2]=E=>l.value=!0)},null,40,jf),[[e.vShow,!l.value]]),l.value?(e.openBlock(),e.createElementBlock("p",Uf," Не вдалося завантажити попередній перегляд зображення ")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),s.value.length>0?(e.openBlock(),e.createElementBlock("div",Hf,[e.createElementVNode("p",qf,"Попередній перегляд ("+e.toDisplayString(s.value.length)+" зображень):",1),A[6]||(A[6]=e.createElementVNode("p",{class:"text-xs text-gray-500 mb-2"}," Зображення будуть розміщені в ряд, якщо вони помістяться по ширині ",-1)),e.createElementVNode("div",Kf,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(E,V)=>(e.openBlock(),e.createElementBlock("div",{key:V,class:"relative"},[e.withDirectives(e.createElementVNode("img",{src:E.preview,alt:`Попередній перегляд ${V+1}`,class:"max-w-[100px] max-h-[100px] rounded border object-contain",onError:B=>E.error=!0},null,40,Gf),[[e.vShow,!E.error]]),e.createElementVNode("button",{onClick:B=>b(V),class:"absolute -top-2 -right-2 bg-red-500 text-white rounded-full w-5 h-5 flex items-center justify-center text-xs hover:bg-red-600",type:"button"}," × ",8,Wf)]))),128))])])):e.createCommentVNode("",!0)]),_:1},8,["modelValue","title"])]))}}),Xf={class:"flex items-center"},Jf=["disabled"],Qf=["disabled"],em=pe(Object.assign({inheritAttrs:!1},{__name:"vs-editor-history",props:{editor:Object},setup(r){const t=r,n=()=>{t.editor?.can().undo()&&t.editor.chain().focus().undo().run()},l=()=>{t.editor?.can().redo()&&t.editor.chain().focus().redo().run()};return(a,o)=>(e.openBlock(),e.createElementBlock("div",Xf,[e.createElementVNode("button",{onClick:n,class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-l-full hover:text-gray-900 hover:bg-gray-100 border-r border-gray-200",[r.editor?.can().undo()?"text-gray-500":"text-gray-300 cursor-not-allowed"]]),disabled:!r.editor?.can().undo(),title:"Undo (Ctrl+Z)"},[e.createVNode(e.unref(R.Undo2),{class:"h-4 w-4"})],10,Jf),e.createElementVNode("button",{onClick:l,class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-r-full hover:text-gray-900 hover:bg-gray-100",[r.editor?.can().redo()?"text-gray-500":"text-gray-300 cursor-not-allowed"]]),disabled:!r.editor?.can().redo(),title:"Redo (Ctrl+Y)"},[e.createVNode(e.unref(R.Redo2),{class:"h-4 w-4"})],10,Qf)]))}}),[["__scopeId","data-v-6a87fc55"]]),tm={class:"relative"},nm={class:"p-6"},rm={class:"flex justify-between items-center mb-4"},lm={bold:mp,italic:yp,color:cf,background_color:hf,highlight:gf,bullet_list:ap,ordered_list:ip,blockquote:np,codeblock:up,underline:bp,strike:kp,link:jp,table:Gp,text_align:Zp,type_tag:Qp,font_family:wf,font_size:Ef,superscript:Sf,subscript:Ff,heading:Lf,clear_formatting:zf,image:Zf,history:em,help:pe(Object.assign({inheritAttrs:!1},{__name:"vs-editor-help",props:{editor:Object},setup(r){const t=e.ref(!1),n=e.ref(null),l=()=>{t.value=!t.value},a=()=>{t.value=!1};return(o,s)=>(e.openBlock(),e.createElementBlock("div",tm,[e.createElementVNode("button",{ref_key:"helpButton",ref:n,onClick:l,class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 text-gray-500",[t.value?"bg-gray-100 text-gray-900":"text-gray-500"]]),title:"Markdown Shortcuts Help"},[e.createVNode(e.unref(R.CircleHelp),{class:"h-4 w-4"})],2),t.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[100001]",onClick:a},[e.createElementVNode("div",{class:"bg-white rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] overflow-y-auto",onClick:s[0]||(s[0]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",nm,[e.createElementVNode("div",rm,[s[1]||(s[1]=e.createElementVNode("h2",{class:"text-xl font-semibold text-gray-900"},"Common Markdown Syntax & Shortcuts",-1)),e.createElementVNode("button",{onClick:a,class:"text-gray-400 hover:text-gray-600 transition-colors"},[e.createVNode(e.unref(R.X),{class:"h-6 w-6"})])]),s[2]||(s[2]=e.createStaticVNode('<div class="space-y-6" data-v-92c21275><div data-v-92c21275><h3 class="text-lg font-medium text-gray-800 mb-3" data-v-92c21275>Markdown Syntax</h3><div class="overflow-x-auto" data-v-92c21275><table class="w-full border-collapse" data-v-92c21275><thead data-v-92c21275><tr class="bg-gray-50" data-v-92c21275><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-92c21275>Element</th><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-92c21275>Example</th></tr></thead><tbody class="text-sm" data-v-92c21275><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Bold</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>**bold text**</code> or <code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>__bold text__</code></td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Italics</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>*italic text*</code> or <code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>_italic text_</code></td></tr><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Strikethrough</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>~strikethrough text~</code></td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Headings</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275># Heading 1</code>, <code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>## Heading 2</code>, etc., up to <code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>###### Heading 6</code></td></tr><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Unordered Lists</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275> Use an asterisk (*), dash (-), or plus sign (+) followed by a space. </td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Ordered Lists</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275> Use a number followed by a period and a space (e.g., <code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>1. First item</code>). </td></tr><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Blockquotes</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275> Start with a greater-than sign (>) followed by a space. </td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Inline Code</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275> Surround with backticks (<code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>`</code>). </td></tr><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Code Blocks</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275> Enclose with three backticks (<code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>```</code>) before and after the code. </td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Images</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275> Use <code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275></code> syntax. </td></tr><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Links</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275> Use <code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>[Link Text](url)</code> syntax. </td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Checklists</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275> Create a list item with <code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>- [ ]</code> for an incomplete task or <code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>- [x]</code> for a completed one. </td></tr></tbody></table></div></div><div data-v-92c21275><h3 class="text-lg font-medium text-gray-800 mb-3" data-v-92c21275>Common Editing Shortcuts</h3><div class="overflow-x-auto" data-v-92c21275><table class="w-full border-collapse" data-v-92c21275><thead data-v-92c21275><tr class="bg-gray-50" data-v-92c21275><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-92c21275>Shortcut</th><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-92c21275>Action</th></tr></thead><tbody class="text-sm" data-v-92c21275><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Ctrl+A</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Select all text</td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Ctrl+B</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Apply bold formatting</td></tr><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Ctrl+C</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Copy selected text</td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Ctrl+I</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Apply italic formatting</td></tr><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Ctrl+K</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Open the insert link dialog</td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Ctrl+S</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Save the current document</td></tr><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Ctrl+V</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Paste copied text</td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Ctrl+X</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Cut selected text</td></tr><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Ctrl+Y</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Redo the last action</td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Alt+Shift+Backspace</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Redo the last action</td></tr><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Ctrl+Z</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Undo the last action</td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Alt+Backspace</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Undo the last action</td></tr></tbody></table></div></div></div>',1))])])])):e.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-92c21275"]]),horizontal_rule:{__name:"vs-editor-horizontal-rule",props:{editor:Object},setup(r){const t=r,n=()=>{t.editor&&t.editor.chain().focus().setHorizontalRule().run()};return(l,a)=>(e.openBlock(),e.createElementBlock("button",{title:"Horizontal Rule",onClick:n,class:"flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex"},[e.createVNode(e.unref(R.Minus),{class:"h-4 w-4"})]))}},fullscreen:{__name:"vs-editor-fullscreen",props:{editor:Object},emits:["toggle-fullscreen"],setup(r,{emit:t}){const n=t,l=()=>{n("toggle-fullscreen")};return(a,o)=>(e.openBlock(),e.createElementBlock("button",{title:"Fullscreen",onClick:l,class:"w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100"},[e.createVNode(e.unref(R.Maximize),{class:"h-4 w-4"})]))}},tab:Object.assign({inheritAttrs:!1},{__name:"vs-editor-tab",props:{editor:{type:Object,required:!0}},setup(r){const t=r,n=()=>{t.editor&&(t.editor.isActive("bulletList")||t.editor.isActive("orderedList"))&&t.editor.chain().focus().sinkListItem("listItem").run()};return(l,a)=>(e.openBlock(),e.createElementBlock("button",{title:"Tab (Increase List Indent)",onClick:n,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none"},[e.createVNode(e.unref(R.ListIndentIncrease),{class:"h-4 w-4"})]))}})},Yr={basic:["history","font_family","font_size","bold","italic","underline","strike","text_align","bullet_list","ordered_list","link","image","clear_formatting","help"],default:["history","heading","font_family","font_size","bold","italic","underline","strike","superscript","subscript","color","background_color","highlight","text_align","bullet_list","ordered_list","blockquote","codeblock","table","link","image","horizontal_rule","clear_formatting","fullscreen","help"],full:["history","heading","font_family","font_size","bold","italic","underline","strike","color","background_color","highlight","text_align","bullet_list","ordered_list","blockquote","codeblock","table","link","image","horizontal_rule","superscript","subscript","clear_formatting","fullscreen","help"]},am={class:"flex align-middle gap-x-0.5 border-b flex-wrap border-b-gray-200 px-[10px] py-[6px] border-solid border-transparent"},om={class:"rich-text-scroll-wrapper"},sm={key:0,class:"richtext-loading text-sm text-gray-500"},im={key:1,class:"richtext-error text-sm text-red-600"},cm={class:"html-source-editor"},dm={class:"flex justify-end border-t border-[#e5e7eb] bg-[#f8fafc] px-4 min-h-[38px] items-start overflow-visible"},um={class:"inline-flex items-stretch -mt-px"},pm=Object.freeze(Object.defineProperty({__proto__:null,default:Object.assign({inheritAttrs:!1},{__name:"vs-richtext",props:e.mergeModels({modelValue:{type:String,default:()=>""},height:{type:String,default:()=>"300px"},format:{type:String,default:()=>"html"},toolbar:{type:[Array,String],default:()=>"default"}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue"],["update:modelValue"]),setup(r){const t=r,n=e.useModel(r,"modelValue"),l=e.ref(null),{t:a}=nn(),o=e.computed(()=>t.format==="md"?"markdown":"html"),s=e.computed(()=>t.format==="md"?a("form.richtext.markdown"):a("form.richtext.html")),{editor:c,editorInstance:i,focusEditor:d,createEditor:u,destroyEditor:p,isLoading:g,loadError:f}=Pu(t),{isHtmlMode:y,htmlContent:h,htmlTextarea:b,toggleHtmlMode:C}=ju(c,t.format,($,v)=>{$==="update:modelValue"&&(n.value=v)},{toEditorContent:On,toSourceContent:Yu}),{isFullscreen:w,toggleFullscreen:k}=Uu(),x=e.computed(()=>typeof t.toolbar=="string"?Yr[t.toolbar]||Yr.default:t.toolbar),S=e.computed(()=>x.value.map($=>lm[$]).filter(Boolean));e.watch(()=>t.modelValue,async $=>{if(c.value){const v=await On($||"",t.format),A=c.value.getHTML();v!==A&&v!=="<p></p>"&&c.value.commands.setContent(v,!1)}},{immediate:!0});const L=$=>{if(!$||!$.view||!$.view.dom)return;$.view.dom.querySelectorAll("img.editor-image[width][height]").forEach(A=>{if(A instanceof HTMLImageElement){const E=A.getAttribute("width"),V=A.getAttribute("height");E&&V&&E!=="auto"&&V!=="auto"&&E!==""&&V!==""&&!isNaN(Number(E))&&!isNaN(Number(V))&&(A.style.cssText=`
|
|
41
|
+
width: ${E}px !important;
|
|
42
|
+
height: ${V}px !important;
|
|
43
|
+
max-width: none !important;
|
|
44
|
+
max-height: none !important;
|
|
45
|
+
min-width: auto !important;
|
|
46
|
+
min-height: auto !important;
|
|
47
|
+
object-fit: fill !important;
|
|
48
|
+
`.replace(/\s+/g," ").trim())}})};return e.watch(c,$=>{$&&(e.nextTick(()=>{L(c.value)}),c.value.on("update",async v=>{const A=v.editor.getHTML(),E=await Zu(A,t.format);E!==t.modelValue&&A!=="<p></p>"&&(n.value=E),setTimeout(()=>{L(v.editor)},10)}))}),e.onMounted(async()=>{const $=await On(t.modelValue||"",t.format);await u(l.value,$),e.nextTick(()=>{c.value&&setTimeout(()=>{L(c.value)},100)})}),e.onBeforeUnmount(()=>{p()}),($,v)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["bg-white rounded-md w-full",{"fixed left-0 right-0 top-0 bottom-0 z-[100000]":e.unref(w)}])},[e.createElementVNode("div",am,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,A=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:A},[e.unref(c)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(A),{key:0,editor:e.unref(i),onToggleFullscreen:e.unref(k)},null,40,["editor","onToggleFullscreen"])):e.createCommentVNode("",!0)],64))),128))]),e.createElementVNode("div",{onClick:v[1]||(v[1]=(...A)=>e.unref(d)&&e.unref(d)(...A)),class:"relative w-full px-4 py-2 bg-white rounded-b-lg editor-content",style:e.normalizeStyle({height:e.unref(w)?"calc(95vh - 44px)":r.height})},[e.withDirectives(e.createElementVNode("div",om,[e.createElementVNode("div",{ref_key:"editorElement",ref:l,class:"relative w-full"},null,512),e.unref(g)?(e.openBlock(),e.createElementBlock("div",sm,"Loading editor...")):e.createCommentVNode("",!0),e.unref(f)?(e.openBlock(),e.createElementBlock("div",im,e.toDisplayString(e.unref(f)),1)):e.createCommentVNode("",!0)],512),[[e.vShow,!e.unref(y)]]),e.withDirectives(e.createElementVNode("div",cm,[e.createVNode(xn,{ref_key:"htmlTextarea",ref:b,modelValue:e.unref(h),"onUpdate:modelValue":v[0]||(v[0]=A=>e.isRef(h)?h.value=A:null),height:"100%",syntax:o.value,theme:"vs-light"},null,8,["modelValue","syntax"])],512),[[e.vShow,e.unref(y)]])],4),e.createElementVNode("div",dm,[e.createElementVNode("div",um,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["min-w-[96px] h-[30px] px-[14px] border border-[#cfd6e0] bg-[#f3f5f8] text-[8px] font-bold uppercase tracking-[0.06em] leading-none cursor-pointer transition-colors duration-200 border-b-[1px] border-b-[#cfd6e0] rounded-none rounded-bl-[8px] hover:bg-[#eef1f5] hover:text-[#667284]",e.unref(y)?"text-[#8f99aa]":"!bg-white text-[#49556a] border-[#cfd6e0] border-t-transparent relative z-[1]"]),onClick:v[2]||(v[2]=A=>e.unref(C)(!1))},e.toDisplayString(e.unref(a)("form.richtext.editor")),3),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["min-w-[96px] h-[30px] px-[14px] border border-[#cfd6e0] border-l-0 bg-[#f3f5f8] text-[8px] font-bold uppercase tracking-[0.06em] leading-none cursor-pointer transition-colors duration-200 border-b-[1px] border-b-[#cfd6e0] rounded-none rounded-br-[8px] hover:bg-[#eef1f5] hover:text-[#667284]",e.unref(y)?"!bg-white text-[#49556a] border-[#cfd6e0] border-t-transparent relative z-[1]":"text-[#8f99aa]"]),onClick:v[3]||(v[3]=A=>e.unref(C)(!0))},e.toDisplayString(s.value),3)])])],2))}})},Symbol.toStringTag,{value:"Module"}));de.ModalEdit=pr,de.VForm=tt,de.VsInputAddress=or,de.VsInputArray=ar,de.VsInputArraySelect=jt,de.VsInputCheckbox=Pn,de.VsInputCodegen=er,de.VsInputColor=rr,de.VsInputContainer=Gn,de.VsInputDate=Cu,de.VsInputEmail=pn,de.VsInputFile=Hn,de.VsInputFileList=qn,de.VsInputKeyValue=tr,de.VsInputMask=un,de.VsInputMonaco=xn,de.VsInputNumber=Rn,de.VsInputRadio=mn,de.VsInputRange=lr,de.VsInputRichtext=Yn,de.VsInputSelect=bn,de.VsInputSlug=Qn,de.VsInputStatic=dn,de.VsInputSwitcher=cn,de.VsInputTag=Jn,de.VsInputTel=fn,de.VsInputText=yt,de.VsInputTextArray=nr,de.VsInputTextarea=Wn,de.default=tt,de.inputs=ir,de.richtextLocaleEn=_r,de.richtextLocaleUk=vr,de.richtextMessages=Vn,de.vsInputDatatable=Zn,de.vsInputMap=Xn,Object.defineProperties(de,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|