import{a as A,c as I,d as D,f as Z,g as $,h as G,i as U}from"./chunk-G5R6FPWF.mjs";import{X as z,Z as e,aa as O,ia as N,j as c,o as S,q as a,t as l,u as m,x as g}from"./chunk-44IMGQZ2.mjs";var fe=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,J=i=>fe.test(String(i).toLowerCase()),P=N(function({formId:W,withName:o,nameField:p,withEmail:n,email:u,withMessage:d,message:f,layout:E,inputs:r,button:s,style:q,gap:_,onSubmit:H,...V}){let[k,K]=a(p?.value),[y,Q]=a(u?.value),[F,X]=a(f?.value),[Y,w]=a(!1),[ee,T]=a(!1),[te,j]=a(!1),[le,R]=a(!1),[re,oe]=a(!1),B=S(()=>z.current()===z.canvas,[]),ae=S(()=>{let t=[];return(o||d)&&t.push("max-content"),d&&t.push("1fr"),[...t,"max-content"].join(" ")},[o,n,d]),ie=S(()=>{let t=[];return(o&&!n||n&&!o)&&!d&&E==="horizontal"?"1fr max-content":"1fr"},[o,n,d,E]),{fontFamily:C,fontSize:v,fontWeight:L}=D(V),h=Z(V),b=G(V),M=c(()=>{let t=!1;return w(!1),T(!1),j(!1),o&&!k&&(w(!0),t=!0),n&&(!y||!J(y))&&(T(!0),t=!0),d&&!F&&(j(!0),t=!0),t},[J,o,n,d,k,y,F]),ne=c(t=>{if(R(!0),t.preventDefault(),M())R(!1);else{let pe=new FormData(t.target),ue=Object.fromEntries(pe.entries());fetch(`https://submit-form.com/${W}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(ue)}).then(()=>{oe(!0),H()}).catch(()=>R(!1))}},[W,H,M]),de=c(t=>{w(!1),K(t.target.value)},[]),se=c(t=>{T(!1),Q(t.target.value)},[]),ce=c(t=>{j(!1),X(t.target.value)},[]);return l(g.div,{style:{...q,...A,flexDirection:"column","--framer-formspark-placeholder-color":r.placeholderColor},children:re?l(g.div,{style:{height:"60px",width:"60px",background:s.fill,color:s.color,borderRadius:"50%",display:"flex",justifyContent:"center",alignItems:"center"},initial:{scale:0},animate:{scale:1},transition:{duration:.3},children:l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",children:l("path",{d:"M 2 14 L 10 22 L 26 6",fill:"transparent",strokeWidth:"4",stroke:"currentColor",strokeLinecap:"round"})})}):m("form",{style:{display:"grid",gridTemplateRows:ae,gridTemplateColumns:ie,gap:_,width:"100%",height:"100%"},onSubmit:ne,method:"POST",children:[(o||n)&&m("div",{style:{width:"100%",display:"grid",gridAutoFlow:E==="horizontal"?"column":"row",gap:_},children:[o&&l("input",{className:"framer-formspark-input",type:"text",name:"name",placeholder:p.placeholder,value:B?p.value:k,onChange:de,style:{...x,padding:b,borderRadius:h,fontFamily:C,fontWeight:L,fontSize:v,background:r.fill,color:r.color,boxShadow:`inset 0 0 0 1px ${Y?r.error:"transparent"}`}}),n&&l("input",{className:"framer-formspark-input",type:"email",name:"email",placeholder:u.placeholder,value:B?u.value:y,onChange:se,style:{...x,padding:b,borderRadius:h,fontFamily:C,fontWeight:L,fontSize:v,background:r.fill,color:r.color,boxShadow:`inset 0 0 0 1px ${ee?r.error:"transparent"}`}})]}),d&&l("textarea",{className:"framer-formspark-input",placeholder:f.placeholder,name:"message",value:B?f.value:F,onChange:ce,style:{...x,minHeight:0,padding:b,resize:"vertical",borderRadius:h,background:r.fill,fontFamily:C,fontWeight:L,fontSize:v,color:r.color,boxShadow:`inset 0 0 0 1px ${te?r.error:"transparent"}`}}),m("div",{children:[l(g.input,{type:"submit",value:s.label,style:{...x,borderRadius:h,padding:b,fontFamily:C,fontWeight:s.fontWeight,fontSize:v,background:s.fill,cursor:"pointer",color:s.color,zIndex:1},transition:{type:"ease",duration:.3},whileHover:{opacity:.8}}),le&&l("div",{style:{borderRadius:h,position:"absolute",display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",left:0,top:0,zIndex:2,color:s.color,background:s.fill},children:l(g.div,{style:{height:16,width:16},initial:{rotate:0},animate:{rotate:360},transition:{duration:2,repeat:1/0},children:m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:[l("path",{d:"M 8 0 C 3.582 0 0 3.582 0 8 C 0 12.419 3.582 16 8 16 C 12.418 16 16 12.419 16 8 C 15.999 3.582 12.418 0 8 0 Z M 8 14 C 4.687 14 2 11.314 2 8 C 2 4.687 4.687 2 8 2 C 11.314 2 14 4.687 14 8 C 14 11.314 11.314 14 8 14 Z",fill:"currentColor",opacity:"0.2"}),l("path",{d:"M 8 0 C 12.418 0 15.999 3.582 16 8 C 16 8 16 9 15 9 C 14 9 14 8 14 8 C 14 4.687 11.314 2 8 2 C 4.687 2 2 4.687 2 8 C 2 8 2 9 1 9 C 0 9 0 8 0 8 C 0 3.582 3.582 0 8 0 Z",fill:"currentColor"})]})})})]})]})})},[".framer-formspark-input::placeholder { color: var(--framer-formspark-placeholder-color) !important; }"]);P.defaultProps={fontSize:16,fontFamily:"Inter",fontWeight:400,padding:15,paddingTop:15,paddingBottom:15,paddingLeft:15,paddingRight:15,borderRadius:8,topLeftRadius:8,topRightRadius:8,bottomRightRadius:8,bottomLeftRadius:8,gap:15,nameField:{value:void 0,placeholder:"Name"},email:{value:void 0,placeholder:"Email"},message:{value:void 0,placeholder:"Message"},inputs:{fill:"#EBEBEB",color:"#000",placeholderColor:"rgba(0, 0, 0, 0.5)",error:"#EE4444"},layout:{fill:"#EBEBEB",color:"#000",placeholderColor:"rgba(0, 0, 0, 0.5)",error:"#EE4444"},button:{label:"Sign Up",fontWeight:600,fill:"#000",color:"#FFF"}};O(P,{formId:{title:"ID",placeholder:"7PbPpGN3",type:e.String,description:"Create a [FormSpark](https://formspark.io/) account, add a new form and copy its ID. [Learn more\u2026](https://www.framer.com/sites/integrations/formspark/)"},withName:{title:"Name",type:e.Boolean,enabledTitle:"Show",disabledTitle:"Hide",defaultValue:!0},nameField:{title:" ",type:e.Object,controls:{placeholder:{title:"Placeholder",type:e.String,defaultValue:"Name"},value:{title:"Value",type:e.String,defaultValue:""}},hidden:i=>!i.withName},withEmail:{title:"Email",type:e.Boolean,enabledTitle:"Show",disabledTitle:"Hide",defaultValue:!0},email:{title:" ",type:e.Object,controls:{placeholder:{title:"Placeholder",type:e.String,defaultValue:"Email"},value:{title:"Value",type:e.String}},hidden:i=>!i.withEmail},withMessage:{title:"Message",type:e.Boolean,enabledTitle:"Show",disabledTitle:"Hide",defaultValue:!0},message:{title:" ",type:e.Object,controls:{placeholder:{title:"Placeholder",type:e.String,defaultValue:"Message"},value:{title:"Value",type:e.String}},hidden:i=>!i.withMessage},layout:{title:"Layout",type:e.Enum,options:["horizontal","vertical"],displaySegmentedControl:!0,defaultValue:"horizontal"},inputs:{title:"Inputs",type:e.Object,controls:{fill:{title:"Fill",type:e.Color,defaultValue:"#EBEBEB"},color:{title:"Text",type:e.Color,defaultValue:"#000"},placeholderColor:{title:"Placeholder",type:e.Color,defaultValue:"rgba(0, 0, 0, 0.5)"},error:{title:"Error",type:e.Color,defaultValue:"#EE4444"}}},button:{title:"Button",type:e.Object,controls:{label:{title:"Label",type:e.String,defaultValue:"Sign Up"},fontWeight:{...I.fontWeight,defaultValue:600},fill:{title:"Fill",type:e.Color,defaultValue:"#000"},color:{title:"Text",type:e.Color,defaultValue:"#FFF"}}},...I,fontSize:{title:"Font Size",type:e.Number,displayStepper:!0,defaultValue:16},...U,...$,gap:{title:"Gap",type:e.Number,displayStepper:!0,min:0},onSubmit:{type:e.EventHandler}});var x={WebkitAppearance:"none",display:"inline-block",width:"100%",lineHeight:"1.4em",outline:"none",border:"none"},xe=P;export{xe as a};
//# sourceMappingURL=chunk-L7VAUM6N.mjs.map
