{"version":3,"file":"BHaKi9Ux.js","sources":["../../../../../node_modules/@nuxt/ui/dist/runtime/composables/useFormGroup.mjs"],"sourcesContent":["import { inject, ref, computed } from \"vue\";\nimport { useDebounceFn } from \"@vueuse/core\";\nexport const useFormGroup = (inputProps, config) => {\n const formBus = inject(\"form-events\", void 0);\n const formGroup = inject(\"form-group\", void 0);\n const formInputs = inject(\"form-inputs\", void 0);\n if (formGroup) {\n if (inputProps?.id) {\n formGroup.inputId.value = inputProps?.id;\n }\n if (formInputs) {\n formInputs.value[formGroup.name.value] = formGroup.inputId.value;\n }\n }\n const blurred = ref(false);\n function emitFormEvent(type, path) {\n if (formBus) {\n formBus.emit({ type, path });\n }\n }\n function emitFormBlur() {\n emitFormEvent(\"blur\", formGroup?.name.value);\n blurred.value = true;\n }\n function emitFormChange() {\n emitFormEvent(\"change\", formGroup?.name.value);\n }\n const emitFormInput = useDebounceFn(() => {\n if (blurred.value || formGroup?.eagerValidation.value) {\n emitFormEvent(\"input\", formGroup?.name.value);\n }\n }, 300);\n return {\n inputId: computed(() => inputProps?.id ?? formGroup?.inputId.value),\n name: computed(() => inputProps?.name ?? formGroup?.name.value),\n size: computed(() => {\n const formGroupSize = config.size[formGroup?.size.value] ? formGroup?.size.value : null;\n return inputProps?.size ?? formGroupSize ?? config?.default?.size;\n }),\n color: computed(() => formGroup?.error?.value ? \"red\" : inputProps?.color),\n emitFormBlur,\n emitFormInput,\n emitFormChange\n };\n};\n"],"names":["useFormGroup","inputProps","config","formBus","inject","formGroup","formInputs","blurred","ref","emitFormEvent","type","path","emitFormBlur","emitFormChange","emitFormInput","useDebounceFn","computed","formGroupSize","_a"],"mappings":"yDAEY,MAACA,EAAe,CAACC,EAAYC,IAAW,CAClD,MAAMC,EAAUC,EAAO,cAAe,MAAM,EACtCC,EAAYD,EAAO,aAAc,MAAM,EACvCE,EAAaF,EAAO,cAAe,MAAM,EAC3CC,IACEJ,GAAA,MAAAA,EAAY,KACdI,EAAU,QAAQ,MAAQJ,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