PageSourceSearch

https://aimangatranslator.app/assets/login-promo-provider-UT5fUueX.js

js aimangatranslator.app collected 2026-10-05 06:05:01 UTC 7,885 bytes, 1 lines download raw bytes

1import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,r}from"./framework-DJH1pfSr.js";import{t as i}from"./react-client-CAjdHkmk.js";import{c as a}from"./client-CmOHgZho.js";import{t as o}from"./navigation-DK41M7fL.js";import{t as s}from"./createLucideIcon-BRWvWrMn.js";import{t as c}from"./gift-B52uoTNh.js";import{t as l}from"./sparkles-DoLysNxV.js";import{t as u}from"./x-ChR1JV_j.js";import{_ as d,a as f,c as p,f as m,l as h,m as g,o as _,p as v,s as y,t as b,u as x,v as S}from"./promo-D7H9JO13.js";import{a as C,n as w}from"./track-BUg7VPxk.js";import{n as T}from"./auth-modal-provider-DuyXTIp9.js";var E=s(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),D=s(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),O=e(t(),1);async function k(){try{let e=await fetch(`/api/credits`,{cache:`no-store`});if(e.status===401)return{signedIn:!1,balance:null};let t=await e.json();return t.code===0?{signedIn:!0,balance:typeof t.data?.balance==`number`?t.data.balance:null}:{signedIn:!1,balance:null}}catch{return{signedIn:!1,balance:null}}}function A(){let{data:e,isPending:t}=a(),[n,r]=(0,O.useState)(!1),[i,o]=(0,O.useState)(`guest`),s=(0,O.useRef)(!1);s.current=n;let c=(0,O.useRef)(!!e?.user);c.current=!!e?.user;let l=(0,O.useCallback)(async e=>{if(typeof window>`u`||s.current||g())return;let t=await k(),n=t.signedIn||c.current,i=e===`interval_guest`||!n&&e!==`interval_pay`?`guest`:`pay`;(e===`interval_guest`||e===`login`)&&(i=n?`pay`:`guest`),(e===`interval_pay`||e===`after_generate`)&&(i=`pay`,n||(i=`guest`)),!(i===`pay`&&!v({signedIn:!0,balance:t.balance}))&&(o(i),r(!0))},[]),u=(0,O.useCallback)(()=>{r(!1)},[]);return(0,O.useEffect)(()=>{if(typeof window>`u`||t||!e?.user)return;let n=()=>{let t=x()||`unknown`,n=p();y()||C(n===`sign-up`?`sign_up`:`login`,{method:t}),e.user?.id&&w(e.user.id)};if(g()){d()&&h()&&n();return}if(!d())return;let r=window.setTimeout(()=>{h()&&(n(),l(`login`))},500);return()=>window.clearTimeout(r)},[t,e?.user,l]),(0,O.useEffect)(()=>{if(typeof window>`u`||t||g())return;let e=null,r=!1,i=t=>{r||(e!=null&&window.clearTimeout(e),e=window.setTimeout(()=>{(async()=>{if(r||s.current||g()){i(_);return}await l(c.current?`interval_pay`:`interval_guest`),s.current||i(_)})()},t))};return n?(e!=null&&window.clearTimeout(e),()=>{r=!0,e!=null&&window.clearTimeout(e)}):(i(f),()=>{r=!0,e!=null&&window.clearTimeout(e)})},[t,n,e?.user,l]),(0,O.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{l(e.detail?.reason||`after_generate`)};return window.addEventListener(b,e),()=>window.removeEventListener(b,e)},[l]),{open:n,mode:i,close:u,request:S}}var j=e(n(),1),M=r();function N({open:e,mode:t,onClose:n}){let r=i(`landing.promo`),a=(0,O.useId)(),{openAuth:s}=T(),[d,f]=(0,O.useState)(!1),[p,h]=(0,O.useState)(!1),g=(0,O.useRef)(d);g.current=d;let _=t===`guest`,v=e=>r(_?`guest_${e}`:`pay_${e}`);(0,O.useEffect)(()=>{h(!0)},[]),(0,O.useEffect)(()=>{e||f(!1)},[e]),(0,O.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&y()};window.addEventListener(`keydown`,t);let n=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{window.removeEventListener(`keydown`,t),document.body.style.overflow=n}},[e]);let y=()=>{g.current&&m(),n()},b=()=>{g.current&&m(),n(),_&&s({mode:`sign-up`,callbackUrl:`/#tools`,source:`promo`})},x=[v(`benefit_1`),v(`benefit_2`),v(`benefit_3`)];return!p||!e?null:(0,j.createPortal)((0,M.jsxs)(`div`,{className:`fixed inset-0 z-[1300] flex items-end justify-center p-0 sm:items-center sm:p-4`,children:[(0,M.jsx)(`button`,{type:`button`,className:`absolute inset-0 bg-[var(--amt-ink)]/55 backdrop-blur-[2px]`,"aria-label":r(`popup_close`),onClick:y}
1),(0,M.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":a,className:`relative z-10 flex w-full max-w-[22rem] flex-col items-center overflow-hidden border-[4px] border-[var(--amt-ink)] bg-[var(--amt-paper)] px-5 pt-8 pb-5 text-center shadow-[10px_10px_0_0_var(--amt-ink)] sm:max-w-md sm:px-8 sm:pt-10 sm:pb-6`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:y,className:`absolute top-3 right-3 z-20 border-[2px] border-[var(--amt-ink)] bg-white p-1.5 text-[var(--amt-ink)] hover:bg-[var(--amt-bg-elevated)]`,"aria-label":r(`popup_close`),children:(0,M.jsx)(u,{className:`size-4`})}),(0,M.jsx)(`div`,{className:`flex size-16 items-center justify-center border-[3px] border-[var(--amt-ink)] bg-[var(--amt-accent)] text-white shadow-[4px_4px_0_0_var(--amt-ink)] sm:size-[4.5rem]`,children:(0,M.jsx)(c,{className:`size-8 sm:size-9`,strokeWidth:2})}),(0,M.jsxs)(`p`,{className:`mt-4 inline-flex items-center gap-1 border-2 border-[var(--amt-accent)] bg-white px-2.5 py-0.5 text-[10px] font-bold tracking-[0.14em] text-[var(--amt-accent)] uppercase`,children:[(0,M.jsx)(l,{className:`size-3`}),v(`eyebrow`)]}),(0,M.jsx)(`h2`,{id:a,className:`amt-heading mt-3 max-w-[18rem] text-xl text-[var(--amt-ink)] uppercase sm:text-2xl`,children:v(`title`)}),(0,M.jsx)(`p`,{className:`mt-1.5 max-w-[18rem] text-[13px] leading-snug text-[var(--amt-text-muted)]`,children:v(`subtitle`)}),(0,M.jsxs)(`div`,{className:`mt-4 inline-flex items-center gap-1.5 border-[3px] border-[var(--amt-ink)] bg-[var(--amt-accent)] px-4 py-2 text-sm font-black text-white shadow-[3px_3px_0_0_var(--amt-ink)]`,children:[(0,M.jsx)(E,{className:`size-4 fill-white`}),v(`highlight`)]}),(0,M.jsx)(`p`,{className:`mt-3 max-w-[20rem] text-[12px] leading-relaxed text-[var(--amt-text-muted)] sm:text-[13px]`,children:v(`description`)}),(0,M.jsx)(`div`,{className:`mt-4 flex flex-wrap items-center justify-center gap-x-3 gap-y-1.5 text-[11px] font-semibold text-[var(--amt-ink)]`,children:x.map((e,t)=>(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[t===0?(0,M.jsx)(D,{className:`size-3 text-[var(--amt-accent)]`}):t===1?(0,M.jsx)(l,{className:`size-3 text-[var(--amt-accent)]`}):(0,M.jsx)(c,{className:`size-3 text-[var(--amt-accent)]`}),e]},e))}),(0,M.jsxs)(`div`,{className:`mt-6 flex w-full flex-col gap-2`,children:[_?(0,M.jsx)(`button`,{type:`button`,onClick:b,className:`promo-cta-pulse flex h-12 w-full items-center justify-center border-[3px] border-[var(--amt-ink)] bg-[var(--amt-accent)] text-[15px] font-bold text-white shadow-[4px_4px_0_0_var(--amt-ink)] transition hover:brightness-110`,children:v(`cta`)}):(0,M.jsx)(o,{href:`/pricing`,onClick:b,className:`promo-cta-pulse flex h-12 w-full items-center justify-center border-[3px] border-[var(--amt-ink)] bg-[var(--amt-accent)] text-[15px] font-bold text-white shadow-[4px_4px_0_0_var(--amt-ink)] transition hover:brightness-110`,children:v(`cta`)}),(0,M.jsx)(`button`,{type:`button`,onClick:y,className:`flex h-9 w-full items-center justify-center text-sm font-medium text-[var(--amt-text-muted)] transition hover:text-[var(--amt-ink)]`,children:r(`popup_secondary`)}),(0,M.jsxs)(`label`,{className:`flex cursor-pointer items-center justify-center gap-1.5 text-[11px] text-[var(--amt-text-muted)] sm:text-xs`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked),className:`size-3.5 shrink-0 border-[2px] border-[var(--amt-ink)] text-[var(--amt-accent)] focus:ring-[var(--amt-accent)]`}),(0,M.jsx)(`span`,{children:r(`popup_dont_show`)})]})]})]})]}),document.body)}function P({children:e}){let{open:t,mode:n,close:r}=A();return(0,M.jsxs)(M.Fragment,{children:[e,t?(0,M.jsx)(N,{open:t,mode:n,onClose:r}):null]})}export{P as LoginPromoProvider};

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.