1import{a as k,r as t,j as e,b as M,L as O}from"./vendor-react-72e4a099.js";import{f as V,B as b,F as R,I,P as G}from"./Toast-43ee7788.js";import{a as L,A as w,e as B}from"./api-d8a57490.js";import{u as H,s as U}from"./buildLifecycle-a44b0e05.js";import{u as q,O as z,A as J,L as A,a as T,b as Y,c as _,d as N,G as $,E as K}from"./AuthShell-619b6fc9.js";import{Y as Q,V as W}from"./VkButton-d7173e86.js";import{p as X}from"./JoinByLinkModal-119f67b7.js";import{L as Z}from"./link-2-36909ef8.js";import{A as ee}from"./arrow-right-eda8f931.js";import"./createLucideIcon-581cd729.js";import"./eye-5711d0dd.js";import"./x-b9f3d093.js";import"./circle-check-63b159d4.js";import"./circle-alert-67975319.js";import"./Display-48adcc24.js";import"./promo-speaker-89d1d1d0.js";/* empty css */import"./chevron-right-b4336544.js";import"./arrow-up-955249b3.js";import"./heart-469df115.js";import"./thumbs-up-f55ea202.js";function se({open:r,onClose:c}){const x=k(),[p,n]=t.useState(""),[h,i]=t.useState(null),[j,m]=t.useState(!1);t.useEffect(()=>{r&&(n(""),i(null),m(!1))},[r]);const g=async o=>{o==null||o.preventDefault();const l=X(p);if(!l){i("ÐÑÑавÑÑе ÑÑÑÐ»ÐºÑ Ð¸Ð· пÑиглаÑÐµÐ½Ð¸Ñ Ð¸Ð»Ð¸ код из пиÑÑма");return}if("path"in l){c(),x(l.path);return}m(!0),i(null);try{const s=await L.get("/api/v1/public/resolve-code",{query:{code:l.code},anonymous:!0});if(!(s!=null&&s.path))throw new w("not found",404);c(),x(s.path)}catch(s){i(s instanceof w&&(s.status===404||s.status===400)?"Ðе наÑли ÑÑÐ¸Ñ Ð¸Ð»Ð¸ вÑÑÑеÑÑ Ð¿Ð¾ ÑÑÐ¾Ð¼Ñ ÐºÐ¾Ð´Ñ. ÐÑовеÑÑÑе ÑÑÑÐ»ÐºÑ Ð² пиÑÑме.":B(s,"Ðе полÑÑилоÑÑ Ð¾ÑкÑÑÑÑ ÑÑÑлкÑ. ÐопÑобÑйÑе еÑÑ Ñаз."))}finally{m(!1)}};return e.jsx(V,{open:r,onClose:c,title:"ÐойÑи как гоÑÑÑ",subtitle:"ÐÑÑавÑÑе ÑÑÑÐ»ÐºÑ Ð½Ð° ÑÑÐ¸Ñ Ð¸Ð»Ð¸ вÑÑÑеÑÑ Ð¸Ð· пÑиглаÑÐµÐ½Ð¸Ñ â аккаÑÐ½Ñ Ð½Ðµ нÑжен",icon:e.jsx(Z,{className:"sn-i sn-i-20"}),width:520,className:"sn-a-ui",footer:e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{flex:1}}),e.jsx(b,{variant:"quiet",onClick:c,children:"ÐÑмена"}),e.jsx(b,{variant:"primary",loading:j,disabled:!p.trim(),iconRight:e.jsx(ee,{className:"sn-i sn-i-16"}),onClick:()=>g(),children:"ÐеÑейÑи"})]}),children:e.jsx("form",{onSubmit:g,children:e.jsx(R,{label:"СÑÑлка или код",error:h||void 0,htmlFor:"guest-join-input",hint:h?void 0:"ÐапÑимеÑ, snich.ai/e/⦠или код вида stage-4k2p",children:e.jsx(I,{id:"guest-join-input","data-autofocus":!0,value:p,onChange:o=>{n(o.target.value),i(null)},placeholder:"СÑÑлка из пиÑÑма или код",invalid:!!h,autoComplete:"off"})})})})}function Ee(){const[r,c]=M(),x=k(),{login:p}=H(),n=U(r.get("next")),h=n==="/dashboard"?"":n,[i,j]=t.useState(()=>r.get("email")||""),[m,g]=t.useState(""),[o,l]=t.useState({}),[s,f]=t.useState(null),[C,y]=t.useState(!1),[P,E]=t.useState(!1),F=q(n),S=t.useMemo(()=>r.get("reset")==="1"?"ÐаÑÐ¾Ð»Ñ Ð¸Ð·Ð¼ÐµÐ½Ñн. ÐойдиÑе Ñ Ð½Ð¾Ð²Ñм паÑолем.":null,[r]);t.useEffect(()=>{const u=r.get("error");if(!u)return;f(z[u]||"Ðе ÑдалоÑÑ Ð²Ð¾Ð¹Ñи. ÐопÑобÑйÑе еÑÑ Ñаз.");const a=new URLSearchParams(r);a.delete("error"),c(a,{replace:!0})},[r,c]);const D=async u=>{u.preventDefault();const a={},v=i.trim();if(v?K.test(v)||(a.email="ÐÑовеÑÑÑе email â в нÑм оÑибка"):a.email="УкажиÑе email",m||(a.password="ÐведиÑе паÑолÑ"),l(a),f(null),!(a.email||a.password)){y(!0);try{const d=await L.post("/api/v1/auth/login",{email:v,password:m},{anonymous:!0});p(d.token,d.user),x(n,{replace:!0})}catch(d){d instanceof w&&(d.status===401||d.status===400)?f("ÐевеÑнÑй email или паÑолÑ"):f(B(d,"Ðе ÑдалоÑÑ Ð²Ð¾Ð¹Ñи. ÐопÑобÑйÑе еÑÑ Ñаз.")),y(!1)}}};return F?null:e.jsxs(J,{footer:e.jsxs("p",{className:"sn-a-auth-foot",children:["ÐÑодолжаÑ, Ð²Ñ Ð¿ÑинимаеÑе ",e.jsx(A,{kind:"terms",className:"sn-a-auth-legal"})," и ",e.jsx(A,{kind:"privacy",className:"sn-a-auth-legal"})]}),children:[e.jsx(T,{title:"ÐÑ
од в SNICH",subtitle:"Ð Ð¾Ð»Ñ Ð²ÑбиÑаÑÑ Ð½Ðµ нÑжно â она завиÑÐ¸Ñ Ð¾Ñ ÑобÑÑиÑ"}),e.jsx(Y,{current:"login",next:h}),e.jsxs("div",{className:"sn-a-auth-oauth",children:[e.jsx(Q,{label:"ÐойÑи Ñ Ð¯Ð½Ð´ÐµÐºÑ ID",next:n,onError:f}),e.jsx(W,{label:"ÐойÑи ÑеÑез VK ID",next:n})]}),e.jsx(_,{}),e.jsxs("form",{className:"sn-a-auth-form",onSubmit:D,noValidate:!0,children:[S&&!s&&e.jsx(N,{tone:"info",children:S}),s&&e.jsx(N,{children:s}),e.jsx(R,{label:"Email",htmlFor:"login-email",error:o.email,children:e.jsx(I,{id:"login-email",type:"email",name:"email",placeholder:"[email protected]",autoComplete:"email",value:i,invalid:!!o.email,onChange:u=>{j(u.target.value),l(a=>({...a,email:void 0}))}})}),e.jsxs("div",{className:"sn-field",children:[e.jsxs("div",{className:"sn-a-auth-labelrow",children:[e.jsx("label",{className:"sn-label",htmlFor:"login-pass",children:"ÐаÑолÑ"}),e.jsx(O,{to:`/forgot-password${i.trim()?`?email=${encodeURIComponent(i.trim())}`:""}`,children:"ÐабÑли паÑолÑ?"})]}),e.jsx(G,{id:"login-pass",name:"password",autoComplete:"current-password",placeholder:"ÐÐ°Ñ Ð¿Ð°ÑолÑ",value:m,invalid:!!o.password,onChange:u=>{g(u.target.value),l(a=>({...a,password:void 0}))}}),o.password&&e.jsx("span",{className:"sn-error",role:"alert",children:o.password})]}),e.jsx(b,{type:"submit",variant:"primary",size:"lg",loading:C,children:"ÐойÑи"})]}),e.jsx($,{onClick:()=>E(!0)}),e.jsx(se,{open:P,onClose:()=>E(!1)})]})}export{Ee 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.