"use client"
import{b as m}from"./chunk-BCNZLJXV.mjs";import{l as i}from"./chunk-EOVN2AF5.mjs";import{useMemo as x,useState as u}from"react";import{jsx as a,jsxs as r}from"react/jsx-runtime";function M({title:g,description:c,inputAttrs:e,helpText:s,buttonText:f="Save Changes",disabledTooltip:o,handleSubmit:y}){let[t,p]=u(e.defaultValue),[l,d]=u(!1),b=x(()=>l||!t||t===e.defaultValue,[l,t,e.defaultValue]);return r("form",{onSubmit:async n=>{n.preventDefault(),d(!0),await y({[e.name]:t}),d(!1)},className:"rounded-lg border border-gray-200 bg-white",children:[r("div",{className:"relative flex flex-col space-y-6 p-5 sm:p-10",children:[r("div",{className:"flex flex-col space-y-3",children:[a("h2",{className:"text-xl font-medium",children:g}),a("p",{className:"text-sm text-gray-500",children:c})]}),typeof e.defaultValue=="string"?a("input",{...e,type:e.type||"text",required:!0,disabled:!!o,onChange:n=>p(n.target.value),className:i("w-full max-w-md rounded-md border border-gray-300 text-gray-900 placeholder-gray-400 focus:border-gray-500 focus:outline-none focus:ring-gray-500 sm:text-sm",{"cursor-not-allowed bg-gray-100 text-gray-400":o})}):a("div",{className:"h-[2.35rem] w-full max-w-md animate-pulse rounded-md bg-gray-200"})]}),r("div",{className:"flex items-center justify-between space-x-4 rounded-b-lg border-t border-gray-200 bg-gray-50 p-3 sm:px-10",children:[typeof s=="string"?a("p",{className:"prose-sm prose-a:underline prose-a:underline-offset-4 hover:prose-a:text-gray-700 text-gray-500 transition-colors",dangerouslySetInnerHTML:{__html:s||""}}):s,a("div",{className:"shrink-0",children:a(m,{text:f,loading:l,disabled:b,disabledTooltip:o})})]})]})}export{M as a};
