import{j as e}from"./ui-vendor-8uIfD_JC.js";import{r as n,L as g}from"./react-vendor-28t7dxFl.js";import{a as M}from"./analytics-vendor-Buw7Jr8C.js";import{d as F,g as z,s as K,y as j,z as R,v as y,x as L,n as U,w as P,b as p,T,c as N,B as v,l as D}from"./index-BagLllOy.js";import{H}from"./header-B8URyXEE.js";import{F as _}from"./footer-B4a-Tf9e.js";import{a as q}from"./api-Cp4ZovNS.js";import{g as A,o as B}from"./seo-BoELg83m.js";import"./convex-vendor-BbyM1w2O.js";/**
 * @license lucide-react v0.546.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const I=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],J=F("circle-check",I);var Q=class extends z{#t;#r=void 0;#e;#s;constructor(t,r){super(),this.#t=t,this.setOptions(r),this.bindMethods(),this.#a()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const r=this.options;this.options=this.#t.defaultMutationOptions(t),K(this.options,r)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#e,observer:this}),r?.mutationKey&&this.options.mutationKey&&j(r.mutationKey)!==j(this.options.mutationKey)?this.reset():this.#e?.state.status==="pending"&&this.#e.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#e?.removeObserver(this)}onMutationUpdate(t){this.#a(),this.#i(t)}getCurrentResult(){return this.#r}reset(){this.#e?.removeObserver(this),this.#e=void 0,this.#a(),this.#i()}mutate(t,r){return this.#s=r,this.#e?.removeObserver(this),this.#e=this.#t.getMutationCache().build(this.#t,this.options),this.#e.addObserver(this),this.#e.execute(t)}#a(){const t=this.#e?.state??R();this.#r={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#i(t){y.batch(()=>{if(this.#s&&this.hasListeners()){const r=this.#r.variables,i=this.#r.context,a={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};t?.type==="success"?(this.#s.onSuccess?.(t.data,r,i,a),this.#s.onSettled?.(t.data,null,r,i,a)):t?.type==="error"&&(this.#s.onError?.(t.error,r,i,a),this.#s.onSettled?.(void 0,t.error,r,i,a))}this.listeners.forEach(r=>{r(this.#r)})})}};function $(t,r){const i=L(),[a]=n.useState(()=>new Q(i,t));n.useEffect(()=>{a.setOptions(t)},[a,t]);const o=n.useSyncExternalStore(n.useCallback(d=>a.subscribe(y.batchCalls(d)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),h=n.useCallback((d,x)=>{a.mutate(d,x).catch(U)},[a]);if(o.error&&P(a.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:h,mutateAsync:o.mutate}}function b({id:t,label:r,error:i,children:a}){return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{htmlFor:t,className:"block text-[13px] font-semibold text-foreground",children:[r," ",e.jsx("span",{className:"text-destructive",children:"*"})]}),a,i&&e.jsx("p",{className:"text-[12px] text-destructive",children:i})]})}const f=t=>N("w-full px-3.5 py-2.5 text-[14px] rounded-[10px] bg-secondary border outline-none transition-colors","placeholder:text-muted-foreground focus:border-primary",t?"border-destructive":"border-border");function re(){const[t,r]=n.useState(""),[i,a]=n.useState(""),[o,h]=n.useState(""),[d,x]=n.useState(""),[l,m]=n.useState({}),[S,k]=n.useState(!1),{mutate:C,isPending:u}=$({mutationFn:q.createFeedback,onSuccess:()=>{k(!0),r(""),a(""),h(""),m({}),window.scrollTo({top:0,behavior:"smooth"})},onError:s=>{D.error("Feedback error",{context:"FeedbackPage",error:s}),m({submit:"Произошла ошибка. Попробуйте ещё раз."})}}),O=()=>{const s={};return(!t.trim()||t.trim().length<2)&&(s.name="Минимум 2 символа"),(!i.trim()||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i))&&(s.email="Некорректный email"),(!o.trim()||o.trim().length<10)&&(s.message="Минимум 10 символов"),m(s),Object.keys(s).length===0},w=s=>{s.preventDefault(),!d&&O()&&C({name:t.trim(),contact_email:i.trim(),feedback:o.trim()})},E=A([{name:"Главная",url:p.siteUrl},{name:"Обратная связь"}]);return e.jsxs(e.Fragment,{children:[e.jsxs(M,{children:[e.jsx("title",{children:"Обратная связь | Goh.Place"}),e.jsx("meta",{name:"description",content:"Свяжитесь с нами — оставьте отзыв, предложение или сообщите об ошибке."}),e.jsx("link",{rel:"canonical",href:`${p.siteUrl}/feedback`}),e.jsx("script",{type:"application/ld+json",children:JSON.stringify(B)}),e.jsx("script",{type:"application/ld+json",children:JSON.stringify(E)})]}),e.jsxs("div",{className:"min-h-screen flex flex-col",children:[e.jsx(H,{}),e.jsx("main",{id:"main-content",className:"flex-1",children:e.jsxs("div",{className:"mx-auto max-w-[720px] px-6 pb-16",children:[e.jsxs("div",{className:"py-8 border-b border-border/60 mb-8",children:[e.jsxs("nav",{className:"flex items-center gap-1.5 text-[12px] text-muted-foreground mb-3 flex-nowrap whitespace-nowrap overflow-hidden",children:[e.jsx(g,{to:"/",className:"hover:text-foreground transition-colors",children:"Главная"}),e.jsx("span",{className:"opacity-40",children:"/"}),e.jsx("span",{className:"text-foreground",children:"Обратная связь"})]}),e.jsx("h1",{className:"text-[36px] font-bold tracking-[-0.04em] mb-2",children:"Обратная связь"}),e.jsx("p",{className:"text-muted-foreground text-[14px]",children:"Мы ценим ваше мнение. Оставьте отзыв, предложение или сообщите об ошибке."})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 mb-8",children:[{ico:"💬",title:"Telegram",sub:"Ответим быстрее всего",href:p.telegramUrl},{ico:"📧",title:"Email",sub:"support@goh.place",href:"mailto:support@goh.place"}].map((s,c)=>e.jsxs("a",{href:s.href,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3.5 p-4 rounded-[14px] bg-card border border-border/60 hover:border-primary/30 hover:-translate-y-0.5 transition-all no-underline text-foreground",children:[e.jsx("span",{className:"text-[28px]",children:s.ico}),e.jsxs("div",{children:[e.jsx("div",{className:"font-bold text-[14px]",children:s.title}),e.jsx("div",{className:"text-muted-foreground text-[12px]",children:s.sub})]})]},c))}),S&&e.jsxs("div",{className:"flex items-start gap-3.5 p-4 rounded-[14px] mb-6",style:{background:"rgba(34,197,94,0.10)",border:"1px solid rgba(34,197,94,0.22)"},children:[e.jsx(J,{className:"size-5 shrink-0 mt-0.5",style:{color:"#22c55e"}}),e.jsxs("div",{children:[e.jsx("p",{className:"font-bold text-[14px]",style:{color:"#22c55e"},children:"Сообщение отправлено!"}),e.jsx("p",{className:"text-muted-foreground text-[13px] mt-0.5 leading-relaxed",children:"Спасибо! Мы свяжемся с вами в ближайшее время на указанный email."})]})]}),e.jsxs("form",{onSubmit:w,className:"bg-card rounded-[18px] border border-border/60 p-7 space-y-5 mb-5",children:[e.jsx("h2",{className:"font-bold text-[17px]",children:"Написать нам"}),l.submit&&e.jsxs("div",{className:"flex items-center gap-2.5 p-3.5 rounded-[10px] text-destructive text-[13px]",style:{background:"rgba(239,68,68,0.08)",border:"1px solid rgba(239,68,68,0.2)"},children:[e.jsx(T,{className:"size-4 shrink-0"}),l.submit]}),e.jsx("input",{type:"text",name:"website",value:d,onChange:s=>x(s.target.value),className:"absolute opacity-0 pointer-events-none",tabIndex:-1,"aria-hidden":"true",autoComplete:"off"}),e.jsx(b,{id:"fb-name",label:"Имя",error:l.name,children:e.jsx("input",{id:"fb-name",value:t,onChange:s=>{r(s.target.value),m(c=>({...c,name:""}))},placeholder:"Ваше имя",className:f(l.name),disabled:u,autoComplete:"name"})}),e.jsx(b,{id:"fb-email",label:"Email",error:l.email,children:e.jsx("input",{id:"fb-email",type:"email",value:i,onChange:s=>{a(s.target.value),m(c=>({...c,email:""}))},placeholder:"your@email.com",className:f(l.email),disabled:u,autoComplete:"email"})}),e.jsxs(b,{id:"fb-msg",label:"Сообщение",error:l.message,children:[e.jsx("textarea",{id:"fb-msg",value:o,rows:5,maxLength:5e3,onChange:s=>{h(s.target.value),m(c=>({...c,message:""}))},placeholder:"Ваше сообщение...","aria-describedby":"fb-msg-count",className:N(f(l.message),"resize-y min-h-[130px]"),disabled:u}),e.jsxs("div",{id:"fb-msg-count",className:"flex justify-end text-[11px] text-muted-foreground mt-1","aria-live":"polite",children:[o.length,"/5000"]})]}),e.jsx(v,{type:"submit",className:"w-full h-11 font-bold text-[15px]",disabled:u,"aria-busy":u,children:u?"Отправляем…":"Отправить сообщение"})]}),e.jsxs("div",{className:"text-center p-5 rounded-[12px] bg-card border border-border/60",children:[e.jsx("p",{className:"text-muted-foreground text-[13px] mb-3",children:"Не нашли ответ на вопрос?"}),e.jsx(g,{to:"/faq",children:e.jsx(v,{variant:"outline",size:"sm",className:"font-semibold",children:"Перейти в FAQ →"})})]})]})}),e.jsx(_,{})]})]})}export{re as default};