PageSourceSearch

https://lingard.app/web-app/chunks/account-BV2AFbSe.js

js lingard.app collected 2026-09-24 14:33:38 UTC 3,854 bytes, 1 lines download raw bytes

1import{g as S}from"./firebase-app-check-CIcxtdQQ.js";import{u as x}from"./firebase-auth-DyJV_xjV.js";import"./firebase-core-jbjb5lj7.js";import{r as T,g as j,u as C,a as O}from"./firebase-storage-DPmt4kV5.js";import{aO as w,bH as P,bI as G,l as A,a as y,g as U,bA as M,w as $,u as k,bg as B,at as z,bC as H,bB as J}from"../app.js";import"./react-NqbtPKX2.js";import"./archive-d6nEYruE.js";function p(e){return e&&typeof e=="object"?e:{}}function h(e){const a=Number(e);return Number.isFinite(a)&&a>=0?Math.trunc(a):0}function V(e){return Math.max(h(e.updatedAt),...Object.values(p(e.fieldUpdatedAt)).map(h))}function _(e,a){if(Object.is(e,a))return!0;try{return JSON.stringify(e)===JSON.stringify(a)}catch{return!1}}function q(e,a){const t=p(e.payload);return Object.entries(a).every(([r,o])=>_(t[r],o))}async function b(e,a,t,r,o){const{doc:c,getDocFromServer:s,getFirestore:d}=await A(),n=U();n&&await S(n);const i=d(y()),f=c(i,t==="settings"?M(e.uid):`users/${e.uid}/langs/${a}/${t}/main`),m=Object.keys(r);for(let l=0;l<2;l+=1){const g=await s(f),u=g.exists()?g.data():{},I=await o?.(p(u.payload)),L={...p(u.payload),...r},D=Math.max(Date.now(),V(u)+1),F={...p(u.fieldUpdatedAt)};m.forEach(E=>{F[E]=D});const R={schemaVersion:Number(u.schemaVersion||1),payload:L,fieldUpdatedAt:F,updatedAt:D,deviceId:$()};await k(e,a,{...I,[t]:R});const N=await s(f),v=N.exists()?N.data():{};if(q(v,r))return t==="profile"&&o&&P(e.uid,a,r),t==="profile"?B(e.uid,a,v):p(v.payload)}throw new Error(`${t} synchronization was overwritten before it could be confirmed`)}async function W(e,a,t){const{doc:r,getDocFromServer:o,getFirestore:c}=await A(),s=c(y()),d=z(a);await Promise.all(H().filter(n=>n!==d).map(async n=>{try{const i=await o(r(s,`users/${e.uid}/langs/${n}/profile/main`));if(!i.exists()||p(i.data().payload).nativeLang===t)return;P(e.uid,n,{nativeLang:t}),await b(e,n,"profile",{nativeLang:t})}catch(i){console.warn("Native language did not reach every language profile",{language:n,error:i})}}))}async function ae(e,a,t){P(e.uid,a,t);const r=await b(e,a,"profile",t);return typeof t.nativeLang=="string"&&t.nativeLang.trim()&&await W(e,a,t.nativeLang.trim()),typeof t.name=="string"&&t.name.trim()&&t.name.trim()!==e.displayName&&await x(e,{displayName:t.name.trim()}).catch(()=>{}),r}async function re(e,a,t){if(!Number.isInteger(t)||t<1||t>240)throw new RangeError("Reading goals must be between 1 and 240 minutes");await G(e,a);const{doc:r,getDocFromServer:o,getFirestore:c}=await A(),s=c(y());let d=0;return await b(e,a,"profile",{goalReadingTime:t},async n=>{const i=new Date,f=String(Date.UTC(i.getFullYear(),i.getMonth(),i.getDate())),m=await o(r(s,`users/${e.uid}/langs/${a}/dailyProgress/${f}`)),l=m.exists()?m.data():{},g=J(n).readingMinutes;return d=Math.max(0,Number(l.TIME_READING)||0)*g/t,{dailyProgress:[{dateMs:f,TIME_READING:d,updatedAt:Math.max(Date.now(),h(l.updatedAt)+1),deviceId:$()}]}}),{readingGoalMinutes:t,readingProgress:d}}async function oe(e,a){const t=U();t&&await S(t);const r=a.type==="image/webp"?"webp":"jpg",o=`users/${e.uid}/profile/${crypto.randomUUID()}.${r}`,c=T(j(y()),o);await C(c,a,{contentType:a.type||"image/jpeg",cacheControl:"public,max-age=31536000,immutable"});const s=await O(c);return await x(e,{photoURL:s}).catch(()=>{}),{path:o,url:s}}function ne(e,a){return w(e,"claimHandle",{handle:a})}function ie(e,a,t){return w(e,"updateLeaderboardPrefs",{showAvatarOnLeaderboard:a,hideFromLeaderboard:t})}function se(e,a,t){return b(e,a,"settings",t)}function ce(e){return w(e,"manageStripeSubscription")}function de(e){return w(e,"deleteAuthenticatedUserAccount",{client_platform:"web"})}export{ne as claimProfileHandle,ce as createSubscriptionPortal,de as deleteAccount,ie as updateLeaderboardPreferences,ae as updateProfileFields,re as updateReadingGoal,se as updateSettingsFields,oe as uploadProfileAvatar};

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.