PageSourceSearch

https://git-hub-new-api.hf.space/static/js/async/47.c2f3875be0.js

js git-hub-new-api.hf.space collected 2026-10-03 16:54:13 UTC 7,775 bytes, 1 lines download raw bytes

1"use strict";(self.rspackChunknewapi_web=self.rspackChunknewapi_web||[]).push([[47],{57598(e,a,t){var s=t(65311);function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{initialSeconds:a=30,autoStart:t=!1}=e,[r,n]=(0,s.useState)(a),[i,c]=(0,s.useState)(t),l=(0,s.useRef)(null),o=(0,s.useCallback)(()=>{l.current&&(window.clearInterval(l.current),l.current=null)},[]),d=(0,s.useCallback)(()=>{o(),c(!1)},[o]),u=(0,s.useCallback)(e=>{n(e??a),c(!0),o(),l.current=window.setInterval(()=>{n(e=>e<=1?(o(),c(!1),a):e-1)},1e3)},[o,a]),m=(0,s.useCallback)(()=>{d(),n(a)},[a,d]);return(0,s.useEffect)(()=>()=>o(),[o]),{secondsLeft:r,isActive:i,start:u,stop:d,reset:m}}t.d(a,{L:()=>r})},71250(e,a,t){t.r(a),t.d(a,{component:()=>E});var s=t(79015),r=t(30661),n=t(89077),i=t(43303),c=t(226),l=t(44459),o=t(99435),d=t(70326),u=t(65311),m=t(27606),h=t(26028),f=t(31155),x=t(58419),j=t(37875),p=t(73178),g=t(1996),w=t(62724),v=t(62978),C=t(52685),y=t(41916),_=t(30780),R=t(31600),N=t(52921),b=t(54958),S=t(57598),k=t(95204),A=t(29396),P=t(47801);function L(e){let{className:a,...t}=e,{t:r}=(0,n.Bd)(),[c,l]=(0,u.useState)(!1),[L,E]=(0,u.useState)(""),[I,q]=(0,u.useState)(!1),[W,B]=(0,u.useState)(""),[V,z]=(0,u.useState)(!1),[F,J]=(0,u.useState)(!1),M=r("Please agree to the legal terms first"),{status:Q}=(0,i.s)(),{isTurnstileEnabled:U,turnstileSiteKey:$,turnstileToken:T,setTurnstileToken:D,validateTurnstile:G}=(0,k.A)(),{redirectToLogin:H,handleLoginSuccess:K}=(0,N.u)(),{isSending:O,secondsLeft:X,isActive:Y,sendCode:Z}=function(e){let[a,t]=(0,u.useState)(!1),{secondsLeft:s,isActive:r,start:n}=(0,S.L)({initialSeconds:30});return{isSending:a,secondsLeft:s,isActive:r,sendCode:async a=>{if(!a)return h.oR.error(b.Ay.t("Please enter your email first")),!1;if(e?.validateTurnstile&&!e.validateTurnstile())return!1;t(!0);try{let t=await (0,C.gA)(a,e?.turnstileToken);if(t?.success)return n(),h.oR.success(b.Ay.t("Verification email sent")),!0;return h.oR.error(t?.message||b.Ay.t("Failed to send verification email")),!1}catch(e){return!1}finally{t(!1)}}}}({turnstileToken:T,validateTurnstile:G}),ee=(0,m.mN)({resolver:(0,o.u)(R.Ru),defaultValues:{username:"",email:"",password:"",confirmPassword:""}}),ea=ee.watch("email"),et=!!Q?.email_verification,es=!!Q?.user_agreement_enabled,er=!!Q?.privacy_policy_enabled,en=es||er,ei=Q?.oauth_register_enabled??Q?.data?.oauth_register_enabled??!0,ec=!!Q?.wechat_login,el=!U||!!T,eo=(0,u.useMemo)(()=>Q?.wechat_qrcode||Q?.wechat_qr_code||Q?.wechat_qrcode_image_url||Q?.wechat_qr_code_image_url||Q?.wechat_account_qrcode_image_url||Q?.WeChatAccountQRCodeImageURL||Q?.data?.wechat_qrcode||Q?.data?.WeChatAccountQRCodeImageURL||"",[Q]);async function ed(e){if(en&&!I)return void h.oR.error(M);if(et){if(!e.email)return void h.oR.error(r("Please enter your email"));if(!L)return void h.oR.error(r("Please enter the verification code"))}if(G()){l(!0);try{let a=await (0,C.kz)({username:e.username,password:e.password,email:e.email||void 0,verification_code:L||void 0,aff_code:(0,A.LC)(),turnstile:T});a?.success?(h.oR.success(r("Account created! Please sign in")),H()):h.oR.error(a?.message||r("Failed to create account"))}catch(e){}finally{l(!1)}}}async function eu(){await Z(ea||"")}(0,u.useEffect)(()=>{en?q(!1):q(!0)},[en]),(0,u.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get("aff")?.trim();e&&(0,A.Es)(e)},[]);let em=e=>{z(e),e||(B(""),J(!1))};async function eh(){if(!W.trim())return void h.oR.error(r("Please enter the verification code"));J(!0);try{let e=await (0,C.Cw)(W);e?.success?(await K(e.data),h.oR.success(r("Signed in via WeChat")),em(!1)):h.oR.error(e?.message||r("Login failed"))}catch(e){h.oR.error(r("Login failed"))}finally{J(!1)}}return(0,s.jsxs)(g.lV,{...ee,children:[(0,s.jsxs)("form",{onSubmit:ee.handleSubmit(ed),className:(0,P.cn)("grid gap-4",a),...t,children:[(0,s.jsx)(g.zB,{control:ee.control,name:"username",render:e=>{let{field:a}=e;return(0,s.jsxs)(g.eI,{children:[(0,s.jsx)(g.lR,{children:r("Username")}),(0,s.jsx)(g.MJ,{children:(0,s.jsx)(w.p,{placeholder:r("Enter your username"),...a})}),(0,s.jsx)(g.C5,{})]})}}),(0,s.jsx)(g.zB,{control:ee.control,name:"password",render:e=>{let{field:a}=e;return(0,s.jsxs)(g.eI,{children:[(0,s.jsx)(g.lR,{children:r("Password")}),(0,s.jsx)(g.MJ,{children:(0,s.jsx)(x.y,{placeholder:r("Enter password (8-20 characters)"),...a})}),(0,s.jsx)(g.C5,{})]})}}),(0,s.jsx)(g.zB,{control:ee.control,name:"confirmPassword",render:e=>{let{field:a}=e;return(0,s.jsxs)(g.eI,{children:[(0,s.jsx)(g.lR,{children:r("Confirm password")}),(0,s.jsx)(g.MJ,{children:(0,s.jsx)(x.y,{placeholder:r("Confirm password"),...a})}),(0,s.jsx)(g.C5,{})]})}}),et&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(g.zB,{control:ee.control,name:"email",render:e=>{let{field:a}=e;return(0,s.jsxs)(g.eI,{children:[(0,s.jsx)(g.lR,{children:r("Email (required for verification)")}),(0,s.jsx)(g.MJ,{children:(0,s.jsx)(w.p,{placeholder:r("[email protected]"),type:"email",...a})}),(0,s.jsx)(g.C5,{})]})}}),(0,s.jsxs)("div",{className:"flex items-end gap-2",children:[(0,s.jsx)("div",{className:"flex-1",children:(0,s.jsx)(w.p,{placeholder:r("Verification code"),value:L,onChange:e=>E(e.target.value)})}),(0,s.jsx)(p.$,{variant:"outline",type:"button",disabled:c||O||Y||!ea||!el,onClick:eu,children:Y?r("Resend ({{seconds}}s)",{seconds:X}):O?(0,s.jsx)(d.A,{className:"h-4 w-4 animate-spin"}):r("Send code")})]})]}),U&&(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(j.X,{siteKey:$,onVerify:D})}),(0,s.jsx)(y.G,{status:Q,checked:I,onCheckedChange:q,className:"mt-1"}),(0,s.jsxs)(p.$,{type:"submit",className:"mt-2 w-full justify-center gap-2",disabled:c||en&&!I||!el,children:[c?(0,s.jsx)(d.A,{className:"h-4 w-4 animate-spin"}):null,r("Create account")]}),ei&&(0,s.jsx)(_.m,{status:Q,disabled:c||en&&!I,onWeChatLogin:ec?()=>{en&&!I?h.oR.error(M):z(!0)}:void 0,isWeChatLoading:F,className:"pt-2"})]}),ec&&(0,s.jsxs)(f.l,{open:V,onOpenChange:em,title:r("WeChat sign in"),description:r("Scan the QR code to follow the official account and reply with “验证码” to receive your verification code."),contentClassName:"max-w-sm",headerClassName:"text-left",contentHeight:"auto",bodyClassName:"space-y-4",footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(p.$,{type:"button",variant:"outline",onClick:()=>em(!1),disabled:F,children:r("Cancel")}),(0,s.jsxs)(p.$,{type:"button",onClick:eh,disabled:F||!W.trim()||en&&!I,className:"gap-2",children:[F?(0,s.jsx)(d.A,{className:"h-4 w-4 animate-spin"}):null,r("Confirm")]})]}),children:[eo?(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsx)("img",{src:eo,alt:r("WeChat login QR code"),className:"h-40 w-40 rounded-md border object-contain"})}):(0,s.jsx)("p",{className:"text-muted-foreground text-sm",children:r("QR code is not configured. Please contact support.")}),(0,s.jsxs)("div",{className:"grid gap-2",children:[(0,s.jsx)(v.J,{htmlFor:"wechat-code",children:r("
1Verification code")}),(0,s.jsx)(w.p,{id:"wechat-code",placeholder:r("Enter the verification code"),value:W,onChange:e=>B(e.target.value),autoComplete:"one-time-code"})]})]})]})}let E=function(){let{t:e}=(0,n.Bd)(),{status:a}=(0,i.s)();return(0,s.jsx)(c.D,{children:(0,s.jsxs)("div",{className:"w-full space-y-8",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("h2",{className:"text-center text-2xl font-semibold tracking-tight sm:text-left",children:e("Create an account")}),(0,s.jsxs)("p",{className:"text-muted-foreground text-left text-sm sm:text-base",children:[e("Already have an account?")," ",(0,s.jsx)(r.N_,{to:"/sign-in",className:"hover:text-primary font-medium underline underline-offset-4",children:e("Sign in")}),"."]})]}),(0,s.jsx)(L,{}),(0,s.jsx)(l.N,{variant:"sign-up",status:a,className:"text-center"})]})})}}}]);

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.