1import{aw as w,aD as k,u as S,r,j as e,L as C,l as E,a2 as L,aE as T,n as F}from"./index-C9eo8hQZ.js";const P="https://api.onefap.ai/api";async function R(t){var s,n;const o=await w("".concat(P,"/api-requests"),{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify({...t,...k()})});if(o.ok)return;let l="";try{l=(n=(s=await o.json())==null?void 0:s.error)!=null?n:""}catch{}throw new Error(l||"Could not send that â try Telegram instead")}function A(){const{t}=S(),[o,l]=r.useState(""),[s,n]=r.useState(""),[c,f]=r.useState(""),[i,g]=r.useState(""),[h,j]=r.useState(!1),[d,m]=r.useState(!1),[N,y]=r.useState(!1),[u,x]=r.useState(""),p=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s.trim()),b=o.trim().length>0&&p&&i.trim().length>0,v=async()=>{if(!(!b||d)){m(!0),x("");try{await R({name:o.trim(),email:s.trim(),contact:c.trim(),message:i.trim()}),y(!0)}catch(a){x(a instanceof Error?a.message:t("apiFormFailed"))}finally{m(!1)}}};return e.jsxs("div",{className:"page-container animate-fade-in pb-16",children:[e.jsx("div",{className:"flex items-center gap-3 pt-2",children:e.jsxs(C,{to:"/",className:"inline-flex items-center gap-1.5 h-10 px-3.5 rounded-full bg-background-card text-sm font-medium text-foreground-muted hover:text-foreground transition-colors",children:[e.jsx(E,{className:"w-4 h-4 rtl:rotate-180","aria-hidden":"true"}),t("legalBack")]})}),e.jsxs("div",{className:"mx-auto mt-8 w-full max-w-xl",children:[e.jsx("h1",{className:"text-[28px] sm:text-[34px] font-extrabold leading-tight text-foreground",children:t("apiTitle")}),e.jsx("p",{className:"mt-3 text-[15px] leading-relaxed text-foreground-muted",children:t("apiText")}),e.jsxs("a",{href:L,target:"_blank",rel:"noopener noreferrer",className:"mt-6 flex h-14 w-full items-center justify-center gap-2 rounded-full bg-accent text-base font-bold text-white transition-colors hover:bg-accent-hover",children:[e.jsx(T,{className:"w-[18px] h-[18px]","aria-hidden":"true"}),t("apiTelegramCta")]}),N?e.jsxs("div",{className:"mt-8 rounded-2xl border border-accent/40 bg-accent/10 p-6 text-center",children:[e.jsx("p",{className:"text-base font-bold text-foreground",children:t("apiSentTitle")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-foreground-muted",children:t("apiSentText")})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-8 mb-3 text-center text-[13px] font-semibold uppercase tracking-wide text-foreground-dim",children:t("apiFormOr")}),e.jsxs("div",{className:"rounded-2xl border border-border bg-background-card p-5",children:[e.jsx("label",{htmlFor:"api-name",className:"text-xs font-semibold text-foreground-muted",children:t("apiNameLabel")}),e.jsx("input",{id:"api-name",value:o,onChange:a=>l(a.target.value.slice(0,120)),placeholder:t("apiNamePlaceholder"),autoComplete:"name",className:"mt-1.5 w-full rounded-2xl border border-border bg-background-elevated/60 px-3 py-3 text-base sm:text-sm text-foreground placeholder:text-foreground-dim focus:outline-none focus:border-accent"}),e.jsx("label",{htmlFor:"api-email",className:"mt-4 block text-xs font-semibold text-foreground-muted",children:t("apiEmailLabel")}),e.jsx("input",{id:"api-email",type:"email",inputMode:"email",autoComplete:"email",value:s,onChange:a=>n(a.target.value.slice(0,200)),onBlur:()=>j(!0),placeholder:t("apiEmailPlaceholder"),className:"mt-1.5 w-full rounded-2xl border border-border bg-background-elevated/60 px-3 py-3 text-base sm:text-sm text-foreground placeholder:text-foreground-dim focus:outline-none focus:border-accent"}),h&&s.trim().length>0&&!p&&e.jsx("p",{className:"mt-1.5 text-xs text-red-400",children:t("apiEmailInvalid")}),e.jsx("label",{htmlFor:"api-contact",className:"mt-4 block text-xs font-semibold text-foreground-muted",children:t("apiContactLabel")}),e.jsx("input",{id:"api-contact",value:c,onChange:a=>f(a.target.value.slice(0,200)),placeholder:t("apiContactPlaceholder"),className:"mt-1.5 w-full rounded-2xl border border-border bg-background-elevated/60 px-3 py-3 text-base sm:text-sm text-foreground placeholder:text-foreground-dim focus:outline-none focus:border-accent"}),e.jsx("label",{htmlFor:"api-message",className:"mt-4 block text-xs font-semibold text-foreground-muted",children:t("apiMessageLabel")}),e.jsx("textarea",{id:"api-message",value:i,onChange:a=>g(a.target.value.slice(0,2e3)),rows:4,placeholder:t("apiMessagePlaceholder"),className:"mt-1.5 w-full resize-none rounded-2xl border border-border bg-background-elevated/60 px-3 py-3 text-base sm:text-sm text-foreground placeholder:text-foreground-dim focus:outline-none focus:border-accent"}),u&&e.jsx("p",{className:"mt-3 text-sm text-red-400",children:u}),e.jsx("button",{type:"button",onClick:v,disabled:!b||d,className:"mt-4 flex h-12 w-full items-center justify-center gap-2 rounded-full bg-foreground text-base font-bold text-background transition-opacity disabled:opacity-50",children:d?e.jsx(F,{className:"w-5 h-5 animate-spin","aria-hidden":"true"}):t("apiSubmit")})]})]})]})]})}export{A as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.