PageSourceSearch

https://paperbleach.ai/assets/index--FE8vMNP.js

js paperbleach.ai collected 2026-10-05 12:24:31 UTC 14,113 bytes, 2 lines download raw bytes

1import{r as d,j as e,aT as z,E,B as s,V as X,Y as Z,aU as M,h as v,aV as k,aW as S,z as Y,aB as ee,T as $,v as te,C as J,U as K,u as W,bB as ne,aO as f,bC as N,bF as Q,bI as oe,aM as re,bJ as H,bK as V,G as O,bL as ae,bG as se,H as ie}from"./index-DgtcpqTc.js";import{C as ce}from"./custom-breadcrumbs-BYDw9GgM.js";import{P as le}from"./post-skeleton-COlPK0cp.js";import{D as de,a as pe}from"./doc-item-horizontal-D1E0uD9o.js";import{A as he}from"./app-widget-Cw_cYfhV.js";import{C as ue}from"./Card-BxjPtXZB.js";import{S as p}from"./Skeleton-DHkpMfYZ.js";import"./index.esm-h6sE_FDw.js";import"./zod-ClW-g7q0.js";import"./ContentCopy-cSdbLT1S.js";import"./Edit-BY-OxfJX.js";import"./schema-helper-CMNv8L9Z.js";import"./types-BWJuyASk.js";import"./component-block-BjeIxbO4.js";import"./CardHeader-CPndiZYN.js";import"./Grid-DKGE04vr.js";import"./format-number-1lVgud70.js";const me=async({limit:r,pageNumber:l})=>{const t=k();return S(t,"listDocument")({limit:r,pageNumber:l})},xe=()=>{const[r,l]=d.useState([]),[t,n]=d.useState(null),[i,o]=d.useState(!1),[h,y]=d.useState(!0),[A,c]=d.useState("body"),a=d.useRef(null),j=async u=>{y(!0);try{const C=await me({limit:8,pageNumber:u}),{documents:P}=C.data;l(P)}catch(C){console.error("Failed to fetch documents:",C)}finally{y(!1)}},I=u=>{n(u),o(!0),c("body")},G=()=>{o(!1),n(null)};return d.useEffect(()=>{if(i){const{current:u}=a;u&&u.focus()}},[i]),d.useEffect(()=>{j(1)},[]),e.jsxs(z,{children:[e.jsx(ce,{heading:"Documents",links:[{name:"View All",href:E.dashboard.documents},{name:"Recent Documents",href:E.dashboard.documents}]}),e.jsx(s,{mb:{xs:5,md:3}}),h?e.jsx(le,{variant:"horizontal"}):e.jsxs(e.Fragment,{children:[e.jsx(s,{gap:3,display:"grid",gridTemplateColumns:{xs:"repeat(1, 1fr)",md:"repeat(3, 1fr)"},children:r.map(u=>e.jsx(de,{doc:u,onClick:()=>I(u),onClickDelete:()=>{}},u.id))}),e.jsx(s,{display:"flex",justifyContent:"center",mt:{xs:5,md:8}})]}),e.jsxs(X,{open:i,onClose:G,scroll:A,fullWidth:!0,maxWidth:"md",children:[e.jsxs(Z,{dividers:A==="body",children:[e.jsx(s,{sx:{mb:2}}),e.jsx(pe,{document:t??void 0})]}),e.jsx(M,{children:e.jsx(v,{onClick:G,color:"primary",children:"Close"})})]})]})};function fe({title:r,description:l,action:t,img:n,sx:i,...o}){const h=Y();return e.jsxs(s,{sx:{...ee({color:`to right, ${te(h.vars.palette.grey["900Channel"],.88)} 0%, ${h.vars.palette.grey[900]} 75%`,imgUrl:`${J.site.basePath}/assets/background/background-5.webp`}),pt:5,pb:5,pr:3,gap:5,borderRadius:2,display:"flex",height:{md:1},position:"relative",pl:{xs:3,md:5},alignItems:"center",color:"common.white",textAlign:{xs:"center",md:"left"},flexDirection:{xs:"column",md:"row"},border:`solid 1px ${h.vars.palette.grey[800]}`,...i},...o,children:[e.jsxs(s,{sx:{display:"flex",flex:"1 1 auto",flexDirection:"column",alignItems:{xs:"center",md:"flex-start"}},children:[e.jsx($,{variant:"h4",sx:{whiteSpace:"pre-line",mb:1},children:r}),e.jsx($,{variant:"body2",sx:{opacity:.64,maxWidth:360,...t&&{mb:3}},children:l}),t&&t]}),n&&e.jsx(s,{sx:{maxWidth:260},children:n})]})}function q(r){return r&&typeof r._seconds=="number"?new Date(r._seconds*1e3+(r._nanoseconds||0)/1e6):null}function ge({sx:r,portalAction:l,userMeta:t,...n}){const{user:i}=K(),{t:o}=W(),[h,y]=d.useState(!1),[A,c]=d.useState(null),[a,j]=d.useState(!1),I=ne(),[G,u]=d.useState(!1);d.useEffect(()=>{i&&(async()=>{var g;if(i){y(!0);try{const w=k(),D=(await S(w,"listGroupOrders")({showParticipants:!1})).data;if((g=D.groupOrders)!=null&&g.length){const T=D.groupOrders.map(x=>({...x,createdAt:q(x.createdAt),expiredAt:q(x.expiredAt)})),R=T.find(x=>x.status!=="COMPLETED");c(R||null);const L=T.some(x=>x.status==="COMPLETED");j(L)}else c(null),j(!1)}catch(w){console.error("Failed to fetch group orders:",w),f.error(o("account_plan.errors.load_group_orders"))}finally{y(!1)}}})()},[i,o]);const C=async m=>{var g,w;if(!m){f.error(o("account_plan.toasts.sign_in")),window.location.href=E.auth.firebase.signIn+"?returnTo="+encodeURIComponent(window.location.pathname);return}try{const _=k(),F=S(_,"topUpRewrite");N(I,"top_up_from_account_card");const D=(g=window.Rewardful)==null?void 0:g.referral,T=(w=window.Rewardful)==null?void 0:w.coupon,R=window.location.href,L=document.referrer,U=(await F({quantity:1,rewardfulID:D,coupon:T,currentURL:R,refferalURL:L})).data;U.url?window.location.href=U.url:(console.error("Error fetching top up link"),f.error(o("account_plan.errors.top_up_link")))}catch(_){console.error("Error during top up:",_),f.error(o("account_plan.errors.top_up"))}}
1,P=async m=>{var g,w;if(!m){f.error(o("account_plan.toasts.sign_in")),window.location.href=E.auth.firebase.signIn+"?returnTo="+encodeURIComponent(window.location.pathname);return}try{const _=k(),F=S(_,"subscribeToPremium");N(I,"subscribe_to_premium_from_account_card");const D=(g=window.Rewardful)==null?void 0:g.referral,T=(w=window.Rewardful)==null?void 0:w.coupon,R=window.location.href,L=document.referrer,x="monthly",U=Q("paymentLink"+x);if(U){window.location.href=U;return}const B=(await F({period:x,rewardfulID:D,coupon:T,currentURL:R,refferalURL:L})).data;B.url?window.location.href=B.url:(console.error("Error fetching subscription link"),f.error(o("account_plan.errors.subscription_link")))}catch(_){console.error("Error during subscription:",_),f.error(o("account_plan.errors.subscription"))}},b=(m,g)=>e.jsxs(s,{sx:{display:"flex",typography:"body2",justifyContent:"space-between"},children:[e.jsx(s,{component:"span",sx:{color:"text.secondary"},children:m}),e.jsx(s,{component:"span",children:g})]});return e.jsxs(ue,{sx:{p:3,...r},...n,children:[!i&&e.jsxs($,{variant:"body2",children:[o("account_plan.messages.please_sign_in_plan_details_start"),e.jsx(s,{component:"span",sx:{color:"primary.main",cursor:"pointer"},onClick:()=>window.location.href=E.auth.firebase.signIn+"?returnTo="+encodeURIComponent(window.location.pathname),children:o("account_plan.link.sign_in")}),o("account_plan.messages.please_sign_in_plan_details_end")]}),i&&h&&e.jsxs(e.Fragment,{children:[e.jsx(p,{variant:"text",width:120,height:32,sx:{mb:1}}),e.jsxs(s,{sx:{gap:2,display:"flex",flexDirection:"column"},children:[e.jsx(p,{variant:"text",width:180,height:48}),e.jsxs(s,{sx:{gap:1,display:"flex",flexDirection:"column"},children:[e.jsx(p,{variant:"text",width:"100%",height:24}),e.jsx(p,{variant:"text",width:"100%",height:24}),e.jsx(p,{variant:"text",width:"100%",height:24})]}),e.jsxs(s,{sx:{gap:2,display:"flex",mt:2},children:[e.jsx(p,{variant:"rectangular",width:"100%",height:40,sx:{borderRadius:1}}),e.jsx(p,{variant:"rectangular",width:"100%",height:40,sx:{borderRadius:1}})]}),e.jsx(p,{variant:"rectangular",width:"100%",height:40,sx:{borderRadius:1}})]})]}),i&&!h&&e.jsxs(e.Fragment,{children:[e.jsx(s,{sx:{mb:1,typography:"h6"},children:o("account_plan.labels.current_plan")}),e.jsxs(s,{sx:{gap:2,display:"flex",flexDirection:"column"},children:[e.jsx(s,{sx:{typography:"h3"},children:t!=null&&t.role?(()=>{let m;return t.role==="gp_trial"?m="Group Trial":t.role==="basic"?m="Free":m=t.role.charAt(0).toUpperCase()+t.role.slice(1),m+(t.status==="trial"?" (Trial)":"")})():e.jsx(p,{variant:"text",width:180,height:48})}),t!=null&&t.role?t.role==="basic"?b(o("account_plan.labels.membership_since"),new Date(i.metadata.creationTime??"").toISOString().split("T")[0]):(t==null?void 0:t.role)==="gp_trial"?e.jsxs(e.Fragment,{children:[b(o("account_plan.labels.status"),o("account_plan.labels.active")),b(o("account_plan.labels.days_remaining"),t!=null&&t.dayLeft?`${t.dayLeft} days`:"N/A")]}):e.jsxs(e.Fragment,{children:[(t==null?void 0:t.cancelAtPeriodEnd)&&e.jsxs(e.Fragment,{children:[b(o("account_plan.labels.status"),o("account_plan.labels.canceled")),b("Current Cycle",t!=null&&t.cycleStartDate&&(t!=null&&t.cycleEndDate)?`${new Date(t.cycleStartDate).toLocaleDateString("en-US",{month:"short",day:"numeric"})} – ${new Date(t.cycleEndDate).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`:"N/A")]}),!(t!=null&&t.cancelAtPeriodEnd)&&e.jsxs(e.Fragment,{children:[b(o("account_plan.labels.status"),o("account_plan.labels.active")),b(o("account_plan.labels.next_renewal"),t!=null&&t.cycleEndDate?new Date(t.cycleEndDate).toLocaleDateString("en-CA"):"N/A")]})]}):e.jsxs(e.Fragment,{children:[e.jsxs(s,{sx:{gap:1,display:"flex",flexDirection:"column"},children:[e.jsx(p,{variant:"text",width:"100%",height:24}),e.jsx(p,{variant:"text",width:"100%",height:24}),e.jsx(p,{variant:"text",width:"100%",height:24})]}),e.jsxs(s,{sx:{gap:2,display:"flex",flexDirection:"column"},children:[e.jsxs(s,{sx:{gap:2,display:"flex"},children:[e.jsx(p,{variant:"rectangular",width:"100%",height:40,sx:{borderRadius:1}}),e.jsx(p,{variant:"rectangular",width:"100%",height:40,sx:{borderRadius:1}})]}),e.jsx(p,{variant:"rectangular",width:"100%",height:40,sx:{borderRadius:1}})]})]}),(t==null?void 0:t.stripeBalance)!==void 0&&b(o("account_plan.labels.credit_balance"),`$${(t.stripeBalance/100).toFixed(2)}`),e.jsxs(s,{sx:{gap:2,display:"flex",flexDirection:"column"},children:[e.jsx(s,{sx:{gap:2,display:"flex"},children:(t==null?void 0:t.role)==="basic"?e.jsxs(e.Fragment,{children:[e.jsx(v,{fullWidth:!0,variant:"contained",color:"warning",sx:{mb:2,mt:2,color:"white"},onClick:()=>C(i),children:o("account_plan.buttons.top_up")}),e.jsx(v,{fullWidth:!0,variant:"contained",color:"primary",sx:{mb:2,mt:2,color:"white"},onClick:()=>P(i),children:o("account_plan.buttons.buy_plans")})]}):(t==null?void 0:t.role)==="gp_trial"?e.jsxs(e.Fragment,{children:[e.jsx(v,{fullWidth:!0,variant:"contained",color:"primary",sx:{mb:2,mt:2},onClick:()=>P(i),children:o("account_plan.buttons.upgrade_to_premium")}),e.jsx(v,{fullWidth:!0,variant:"outlined",color:"primary",sx:{mb:2,mt:2},onClick:()=>C(i),children:o("account_plan.buttons.top_up")})]}):e.jsx(v,{fullWidth:!0,variant:"contained",color:"primary",sx:{mb:2,mt:2},onClick:()=>l(),children:o("account_plan.buttons.manage")})}),e.jsx(v,{fullWidth:!0,variant:"outlined",sx:{mb:2,backgroundColor:"white",borderColor:"success.main",color:"success.main","&:hover":{backgroundColor:"success.50",borderColor:"success.main"}},onClick:()=>{window.location.href="/promotion"},children:o("account_plan.buttons.view_join_group_trail")})]})]})]})]})}const we=60*60*1e3,ye=async()=>{const r=k(),t=await S(r,"userMetaTest")();return console.log("data",t),t};async function be(r=()=>!0){const l=Q("userMeta");if(console.log("cachedMeta",l),l)return l;const n=(await ye()).data;return r()&&se("userMeta",n,we),n}const _e=async()=>{const r=k(),n=(await S(r,"ext-firestore-stripe-payments-createPortalLink")({returnUrl:window.location.origin,local:"auto"})).data;if(n.error){f.error(W().t("overview_app_view.portal.error"));return}window.location.href=n.url||""};function ve(){const{t:r}=W(),{user:l}
1=K(),t=Y(),[n,i]=d.useState(null),o=d.useRef(0),{openSurvey:h}=oe(),y=async()=>{o.current+=1;const c=o.current;try{const a=await be(()=>c===o.current);if(c!==o.current)return;if(a.role!=="basic"?a.usedRewritesPercent=Math.min(Math.max(Math.round(a.docCountInCycle/a.docMaxInCycle*100),0),100):a.usedRewritesPercent=a.totalTopUpAmount?Math.min(Math.max(Math.round(a.docCountTotal/a.totalTopUpAmount*100),0),100):0,a.usedDetectionPercent=Math.min(Math.max(Math.round(a.detectionInCycle/a.detectionMaxInCycle*100),0),100),a.cycleStartDate&&a.cycleEndDate&&a.role!=="basic"){const j=new Date(a.cycleEndDate);a.cycleInfo=a.cancelAtPeriodEnd?"":`Renews in ${Math.ceil((j.getTime()-new Date().getTime())/(1e3*60*60*24))} days`}else a.cycleInfo="";i(a)}catch(a){console.error("Failed to fetch user meta:",a)}},A=re();return d.useEffect(()=>{const c=()=>{V(),y()};return window.addEventListener(H,c),()=>window.removeEventListener(H,c)},[]),d.useEffect(()=>{y();const c=new URLSearchParams(window.location.search),a=c.get("checkoutSessionStatus");a==="succeeded"?(f.success(r("overview_app_view.payment.success")),c.delete("checkoutSessionStatus"),A({pathname:location.pathname,search:c.toString()}),V()):a==="canceled"&&(f.error(r("overview_app_view.payment.canceled")),h("Q33p7N"))},[h,r]),e.jsx(z,{maxWidth:"xl",children:e.jsxs(O,{container:!0,spacing:3,children:[e.jsx(O,{xs:12,md:12,lg:12,children:e.jsx(fe,{title:`${r("overview_app_view.welcome.title")} 
2 ${l==null?void 0:l.displayName}`,description:"Let's get started with your first document.",img:e.jsx(ae,{hideBackground:!0})})}),e.jsx(O,{xs:12,md:5,lg:5,children:e.jsx(ge,{userMeta:n,portalAction:async()=>{f.info(r("overview_app_view.portal.generating")),await _e()}})}),e.jsx(O,{xs:12,md:5,lg:5,children:e.jsx(s,{sx:{gap:2,display:"flex",flexDirection:"column"},children:e.jsx(he,{title:r("overview_app_view.widget.title_plan_usage"),currentValue:(n==null?void 0:n.role)==="basic"?(n==null?void 0:n.docTopUpUsedTotal)||0:(n==null?void 0:n.docCountInCycle)||0,maxValue:(n==null?void 0:n.role)==="basic"?((n==null?void 0:n.totalTopUpAmount)||0)<=1e3&&(n==null?void 0:n.totalTopUpAmount)||0:(n==null?void 0:n.docMaxInCycle)||0,showChart:!0,icon:"fluent:document-24-filled",loading:!n,capReachedHint:(n==null?void 0:n.role)==="basic"?"You've used all your rewrite credits. Go Premium for 200 rewrites every month.":`You've used all ${(n==null?void 0:n.docMaxInCycle)||0} rewrites this cycle. Keep writing right now with PaperBleach Ultra.`,barLabel:(n==null?void 0:n.role)==="basic"?"Rewrite credits":"Rewrites this cycle",stats:n?[...(n.docCountTotal||0)>0?[{label:r("overview_app_view.widget.stat.total_usage"),value:n.docCountTotal}]:[],...(()=>{const c=n.rewriteBalance??(n.totalTopUpAmount||0)-(n.docTopUpUsedTotal||0);return c>0&&c<=1e3?[{label:r("overview_app_view.widget.stat.remains_top_up_credit"),value:c}]:[]})(),...(n.referralCount||0)>0?[{label:"Referrals",value:n.referralCount}]:[],...n.hasTranscribeSubscription?[{label:"Live Transcription",value:"Enabled"}]:[]]:[],chart:{series:(n==null?void 0:n.usedRewritesPercent)||0,colors:[t.vars.palette.primary.light,t.vars.palette.primary.main]}})})}),e.jsx(xe,{})]})})}function Be(){const{t:r}=W();return e.jsxs(e.Fragment,{children:[e.jsx(ie,{children:e.jsx("title",{children:r("overviewApp.metadata.title",{siteName:J.site.name})})}),e.jsx(ve,{})]})}export{Be 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.