PageSourceSearch

https://fluentai.pro/assets/useLearningLists-Z79s7Dsp.js

js fluentai.pro collected 2026-10-02 00:24:28 UTC 16,955 bytes, 1 lines download raw bytes

1import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{a as t,l as n,n as r}from"./react-vendor-HKp8TdYr.js";import{t as i}from"./ui-translation-CEt4Jbc6.js";import{k as a}from"./design-system-BeMiRs4n.js";import{i as o,n as s,r as c,t as l}from"./classPrivateFieldGet2-CB7J8LIR.js";import{In as u,Kt as d,Rn as f,s as p}from"./use-session-CYPy8wd6.js";import{C as m,D as h,E as g,S as _,b as ee,g as v,h as y,l as b,m as x,p as S,u as C,v as w,w as T,y as E}from"./settings.store-DbVAx60J.js";import{O as D,T as O,c as k,f as te,m as ne,t as A,w as re}from"./optimistic-cache-updaters-1SkWEi6P.js";var j=new WeakMap,M=new WeakMap,N=new WeakMap,P=new WeakMap,F=new WeakMap,I=new WeakMap,L=new WeakMap,R=new WeakMap,z=new WeakMap,B=new WeakMap,V=new WeakMap,H=new WeakMap,U=new WeakMap,W=new WeakMap,G=new WeakSet,K=class extends y{constructor(e,t){super(),C(this,G),o(this,j,void 0),o(this,M,void 0),o(this,N,void 0),o(this,P,void 0),o(this,F,void 0),o(this,I,void 0),o(this,L,void 0),o(this,R,void 0),o(this,z,void 0),o(this,B,void 0),o(this,V,void 0),o(this,H,void 0),o(this,U,void 0),o(this,W,new Set),this.options=t,s(j,this,e),s(L,this,null),this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(l(M,this).addObserver(this),ue(l(M,this),this.options)?c(G,this,q).call(this):this.updateResult(),c(G,this,Y).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return de(l(M,this),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return de(l(M,this),this.options,this.options.refetchOnWindowFocus)}
1destroy(){this.listeners=new Set,c(G,this,X).call(this),c(G,this,se).call(this),l(M,this).removeObserver(this)}setOptions(e){let t=this.options,n=l(M,this);if(this.options=l(j,this).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof _(this.options.enabled,l(M,this))!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);c(G,this,ce).call(this),l(M,this).setOptions(this.options),t._defaulted&&!m(this.options,t)&&l(j,this).getQueryCache().notify({type:`observerOptionsUpdated`,query:l(M,this),observer:this});let r=this.hasListeners();r&&fe(l(M,this),n,this.options,t)&&c(G,this,q).call(this),this.updateResult(),r&&(l(M,this)!==n||_(this.options.enabled,l(M,this))!==_(t.enabled,l(M,this))||_(this.options.staleTime,l(M,this))!==_(t.staleTime,l(M,this)))&&c(G,this,ie).call(this);let i=c(G,this,ae).call(this);r&&(l(M,this)!==n||_(this.options.enabled,l(M,this))!==_(t.enabled,l(M,this))||i!==l(U,this))&&c(G,this,oe).call(this,i)}getOptimisticResult(e){let t=l(j,this).getQueryCache().build(l(j,this),e),n=this.createResult(t,e);return m(this.getCurrentResult(),n)||(s(P,this,n),s(I,this,this.options),s(F,this,l(M,this).state)),n}getCurrentResult(){return l(P,this)}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){l(W,this).add(e)}getCurrentQuery(){return l(M,this)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=l(j,this).defaultQueryOptions(e),n=l(j,this).getQueryCache().build(l(j,this),t),r=()=>{},i,a=new Promise(e=>{i=e,r=l(j,this).getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return c(G,this,q).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),l(P,this)))}createResult(e,t){let n=l(M,this),r=this.options,i=l(P,this),a=l(F,this),o=l(I,this),c=e===n?l(N,this):e.state,{state:u}=e,d={...u},f=!1,p;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&ue(e,t),o=i&&fe(e,n,t,r);(a||o)&&(d={...d,...b(u.data,e.options)}),t._optimisticResults===`isRestoring`&&(d.fetchStatus=`idle`)}let{error:m,errorUpdatedAt:h,status:g}=d;p=d.data;let v=!1;if(t.placeholderData!==void 0&&p===void 0&&g===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,v=!0):e=typeof t.placeholderData==`function`?t.placeholderData(l(B,this)?.state.data,l(B,this)):t.placeholderData,e!==void 0&&(g=`success`,p=ee(i?.data,e,t),f=!0)}if(t.select&&p!==void 0&&!v){if(i&&p===a?.data&&t.select===l(R,this))p=l(z,this);else try{s(R,this,t.select),p=t.select(p),p=ee(i?.data,p,t),s(z,this,p),s(L,this,null)}catch(e){s(L,this,e)}}else p===void 0&&s(L,this,null);l(L,this)&&(m=l(L,this),p=l(z,this),h=Date.now(),g=`error`,f=!1);let y=d.fetchStatus===`fetching`,x=g===`pending`,S=g===`error`,C=x&&y,w=p!==void 0;return{status:g,fetchStatus:d.fetchStatus,isPending:x,isSuccess:g===`success`,isError:S,isInitialLoading:C,isLoading:C,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:h,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:y,isRefetching:y&&!x,isLoadingError:S&&!w,isPaused:d.fetchStatus===`paused`,isPlaceholderData:f,isRefetchError:S&&w,isStale:pe(e,t),refetch:this.refetch,isEnabled:_(t.enabled,e)!==!1}}updateResult(){let e=l(P,this),t=this.createResult(l(M,this),this.options);if(s(F,this,l(M,this).state),s(I,this,this.options),l(F,this).data!==void 0&&s(B,this,l(M,this)),m(t,e))return;s(P,this,t);let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!l(W,this).size)return!0;let r=new Set(n??l(W,this));return this.options.throwOnError&&r.add(`error`),Object.keys(l(P,this)).some(t=>{let n=t;return l(P,this)[n]!==e[n]&&r.has(n)})})();S.batch(()=>
1{n&&this.listeners.forEach(e=>{e(l(P,this))}),l(j,this).getQueryCache().notify({query:l(M,this),type:`observerResultsUpdated`})})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&c(G,this,Y).call(this)}};function q(e){c(G,this,ce).call(this);let t=l(M,this).fetch(this.options,e);return e?.throwOnError||(t=t.catch(E)),t}function J(e){return!v()&&_(this.options.enabled,l(M,this))!==!1&&w(e)}function ie(){c(G,this,X).call(this);let e=_(this.options.staleTime,l(M,this));if(l(P,this).isStale||!c(G,this,J).call(this,e))return;let t=g(l(P,this).dataUpdatedAt,e)+1;s(V,this,h.setTimeout(()=>{l(P,this).isStale||this.updateResult()},t))}function ae(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(l(M,this)):this.options.refetchInterval)??!1}function oe(e){c(G,this,se).call(this),s(U,this,e),l(U,this)!==0&&c(G,this,J).call(this,l(U,this))&&s(H,this,h.setInterval(()=>{(this.options.refetchIntervalInBackground||x.isFocused())&&c(G,this,q).call(this)},l(U,this)))}function Y(){c(G,this,ie).call(this),c(G,this,oe).call(this,c(G,this,ae).call(this))}function X(){l(V,this)!==void 0&&(h.clearTimeout(l(V,this)),s(V,this,void 0))}function se(){l(H,this)!==void 0&&(h.clearInterval(l(H,this)),s(H,this,void 0))}function ce(){let e=l(j,this).getQueryCache().build(l(j,this),this.options);if(e===l(M,this))return;let t=l(M,this);s(M,this,e),s(N,this,e.state),this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}function le(e,t){return _(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||_(t.retryOnMount,e)!==!1)}function ue(e,t){return le(e,t)||e.state.data!==void 0&&de(e,t,t.refetchOnMount)}function de(e,t,n){if(_(t.enabled,e)!==!1&&_(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&pe(e,t)}return!1}function fe(e,t,n,r){return(e!==t||_(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&pe(e,n)}function pe(e,t){return _(t.enabled,e)!==!1&&e.isStaleByTime(_(t.staleTime,e))}var Z=e(n(),1),me=Z.createContext(!1),he=()=>Z.useContext(me);me.Provider,t();function ge(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var _e=Z.createContext(ge()),ve=()=>Z.useContext(_e),ye=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?T(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},be=e=>{Z.useEffect(()=>{e.clearReset()},[e])},xe=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||T(n,[e.error,r])),Se=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Ce=(e,t)=>e?.suspense&&t.isPending,we=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Te(e,t,n){let r=he(),i=ve(),a=f(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Se(o),ye(o,i,s),be(i);let[l]=Z.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(Z.useSyncExternalStore(Z.useCallback(e=>{let t=d?l.subscribe(S.batchCalls(e)):E;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),Z.useEffect(()=>{l.setOptions(o)},[o,l]),Ce(o,u))throw we(o,l,i);if(xe({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Ee(e,t){return Te(e,K,t)}var De=r();async function Q(e){await e.queryClient.cancelQueries(e.queryFilter);let t=e.queryClient.getQueriesData(e.queryFilter);for(let[n,r]of t)r&&e.queryClient.setQueryData(n,e.update(r));return t}function Oe(e){for(let[t,n]of e.snapshots)n!==void 0&&e.queryClient.setQueryData(t,n)}function ke(e,t){let n=new Map;for(let[,r]of e){if(!r)continue;let e=`pages`in r?r.pages:[r];for(let r of e)for(let e of r.items)t.has(e.id)&&n.set(e.id,e)}return[...n.values()]}function Ae(e,t){for(let[,n]of e){let e=n?.find(e=>e.id===t);if(e)return e}}function je(e,t,n){let r=e.getQueriesData(t);for(let[t,i]of r)i&&e.setQueryData(t,D(i,n))}function Me(e,t){t?.listSnapshots&&Oe({queryClient:e,snapshots:t.listSnapshots}
1),t?.entriesSnapshots&&Oe({queryClient:e,snapshots:t.entriesSnapshots})}function Ne({bookmarkIds:e,entriesSnapshots:t,listId:n,listSnapshots:r,queryClient:i},a){let o=Ae(r,n);if(o)for(let[n,r]of t)r&&i.setQueryData(n,O({data:r,bookmarkIds:e,list:o,action:a}))}function Pe(e){let{bookmarkIds:t,entriesSnapshots:n,listId:r,listSnapshots:i,queryClient:a}=e,o=ke(n,t);if(Ne(e,`add`),o.length>0)for(let[e,t]of i)t&&a.setQueryData(e,A({data:t,listId:r,entries:o}))}function Fe(e){let{bookmarkIds:t,listId:n,listSnapshots:r,queryClient:i}=e;Ne(e,`remove`);for(let[e,a]of r)a&&i.setQueryData(e,k({data:a,listId:n,bookmarkIds:t}))}function Ie(e){return{...e.name===void 0?{}:{name:e.name},...e.description===void 0?{}:{description:e.description},...e.icon===void 0?{}:{icon:e.icon},...e.color===void 0?{}:{color:e.color}}}function $({action:e,error:t,itemCount:n}){let r=t instanceof Error?t:Error(t.message??`Learning list mutation failed`);p(r,{action:e,extra:{item_count:n},feature:`learning-lists`})}function Le(...e){return e.some(e=>e.isPending)}function Re(e){return e?e instanceof Error?e.message:String(e):null}function ze(e){let t=(0,De.c)(58),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{enabled:r}=n,o=r===void 0||r,s=d(),c=f(),l;t[2]===s.learningCenter.getLearningCenterAllList?l=t[3]:(l=s.learningCenter.getLearningCenterAllList.queryOptions({}),t[2]=s.learningCenter.getLearningCenterAllList,t[3]=l);let p=l,m=s.learningCenter.getLearningCenterAllList.pathFilter({}),h;t[4]!==o||t[5]!==p?(h={...p,enabled:o},t[4]=o,t[5]=p,t[6]=h):h=t[6];let{data:g,isLoading:_,error:ee,refetch:v}=Ee(h),y=u(s.learningCenter.addLearningCenterList.mutationOptions({onSuccess:e=>{je(c,m,e),c.invalidateQueries(m),a.success(i(`List created successfully`))},onError:Be})),b;t[7]===c?b=t[8]:(b=(e,t,n)=>{n?.snapshots&&Oe({queryClient:c,snapshots:n.snapshots}),$({action:`update_list`,error:e}),a.error(i(`Failed to update list: `)+e.message)},t[7]=c,t[8]=b);let x=u(s.learningCenter.updateLearningCenterList.mutationOptions({onMutate:async e=>({snapshots:await Q({queryClient:c,queryFilter:m,update:t=>re(t,e.id,Ie(e))})}),onSuccess:e=>{je(c,m,e),c.invalidateQueries(m),a.success(i(`List updated successfully`))},onError:b})),S;t[9]===c?S=t[10]:(S=(e,t,n)=>{Me(c,n),$({action:`delete_list`,error:e}),a.error(i(`Failed to delete list: `)+e.message)},t[9]=c,t[10]=S);let C=u(s.learningCenter.removeLearningCenterList.mutationOptions({onMutate:async e=>{let{id:t}=e,n=new Set([t]),r=await Q({queryClient:c,queryFilter:m,update:e=>te(e,n)});return{entriesSnapshots:await Q({queryClient:c,queryFilter:s.notebook.getEntriesFiltered.pathFilter(),update:e=>ne(e,n)}),listSnapshots:r}},onSuccess:()=>{c.invalidateQueries(m),a.success(i(`List deleted successfully`))},onError:S})),w;t[11]===c?w=t[12]:(w=(e,t,n)=>{Me(c,n),$({action:`delete_lists`,error:e,itemCount:t.ids.length}),a.error(i(`Failed to delete lists: `)+e.message)},t[11]=c,t[12]=w);let T=u(s.learningCenter.removeLearningCenterLists.mutationOptions({onMutate:async e=>{let{ids:t}=e,n=new Set(t),r=await Q({queryClient:c,queryFilter:m,update:e=>te(e,n)});return{entriesSnapshots:await Q({queryClient:c,queryFilter:s.notebook.getEntriesFiltered.pathFilter(),update:e=>ne(e,n)}),listSnapshots:r}},onSuccess:()=>{c.invalidateQueries(m),a.success(i(`Lists deleted successfully`))},onError:w})),E;t[13]===c?E=t[14]:(E=(e,t,n)=>{Me(c,n),$({action:`add_bookmarks_to_list`,error:e,itemCount:t.bookmarkId.length}),a.error(i(`Failed to add to list: `)+e.message)},t[13]=c,t[14]=E);let D=u(s.learningCenter.addBookmarkToList.mutationOptions({onMutate:async e=>{let t=new Set(e.bookmarkId),n=m,r=s.notebook.getEntriesFiltered.pathFilter();await Promise.all([c.cancelQueries(n),c.cancelQueries(r)]);let i=c.getQueriesData(n),a=c.getQueriesData(r);return Pe({bookmarkIds:t,entriesSnapshots:a,listId:e.listId,listSnapshots:i,queryClient:c}),{entriesSnapshots:a,listSnapshots:i}},onSuccess:()=>{c.invalidateQueries(m),c.invalidateQueries(s.notebook.getEntriesFiltered.pathFilter())},onError:E})),O;t[15]===c?O=t[16]:(O=(e,t,n)=>{Me(c,n),$({action:`remove_bookmarks_from_list`,error:e,itemCount:t.bookmarkId.length}),a.error(i(`Failed to remove from list: `)+(e?.message??``))},t[15]=c,t[16]=O);let k=u(s.learningCenter.removeBookmarkFromList.mutationOptions({onMutate:async e=>{let t=new Set(e.bookmarkId),n=m,r=s.notebook.getEntriesFiltered.pathFilter();await Promise.all([c.cancelQueries(n),c.cancelQueries(r)]);let i=c.getQueriesData(n),a=c.getQueriesData(r);
1return Fe({bookmarkIds:t,entriesSnapshots:a,listId:e.listId,listSnapshots:i,queryClient:c}),{entriesSnapshots:a,listSnapshots:i}},onSuccess:()=>{c.invalidateQueries(m),c.invalidateQueries(s.notebook.getEntriesFiltered.pathFilter()),a.success(i(`Deletion successful`))},onError:O})),A;t[17]===y?A=t[18]:(A=async e=>y.mutateAsync(e),t[17]=y,t[18]=A);let j=A,M;t[19]===x?M=t[20]:(M=async e=>x.mutateAsync(e),t[19]=x,t[20]=M);let N=M,P;t[21]===C?P=t[22]:(P=async e=>C.mutateAsync({id:e}),t[21]=C,t[22]=P);let F=P,I;t[23]===T?I=t[24]:(I=e=>T.mutateAsync({ids:e}),t[23]=T,t[24]=I);let L=I,R;t[25]===D?R=t[26]:(R=e=>{let t={listId:e.listId,bookmarkId:[e.bookmarkId]};return D.mutateAsync(t)},t[25]=D,t[26]=R);let z=R,B;t[27]===D?B=t[28]:(B=async e=>{let t={listId:e.listId,bookmarkId:e.bookmarkIds,aiSelection:e.aiSelection};return await D.mutateAsync(t),{success:!0}},t[27]=D,t[28]=B);let V=B,H;t[29]===k?H=t[30]:(H=async e=>{let t={listId:e.listId,bookmarkId:[e.bookmarkId]};return await k.mutateAsync(t),{success:!0}},t[29]=k,t[30]=H);let U=H,W;t[31]===k?W=t[32]:(W=async e=>{let t={listId:e.listId,bookmarkId:e.bookmarkIds};return await k.mutateAsync(t),{success:!0}},t[31]=k,t[32]=W);let G=W,K;t[33]===v?K=t[34]:(K=async()=>{await v()},t[33]=v,t[34]=K);let q=K,J;t[35]===ee?J=t[36]:(J=Re(ee),t[35]=ee,t[36]=J);let ie=J,ae=y.isPending,oe=x.isPending,Y;t[37]!==C||t[38]!==T?(Y=Le(C,T),t[37]=C,t[38]=T,t[39]=Y):Y=t[39];let X;return t[40]!==z||t[41]!==V||t[42]!==D.isPending||t[43]!==j||t[44]!==y.isPending||t[45]!==F||t[46]!==L||t[47]!==ie||t[48]!==_||t[49]!==g||t[50]!==q||t[51]!==U||t[52]!==G||t[53]!==k.isPending||t[54]!==Y||t[55]!==N||t[56]!==x.isPending?(X={lists:g,isLoading:_,error:ie,createList:j,updateList:N,deleteList:F,deleteLists:L,addItemToList:z,addItemsToList:V,removeItemFromList:U,removeItemsFromList:G,isCreating:ae,isUpdating:oe,isDeleting:Y,isAddingItem:D.isPending,isRemovingItem:k.isPending,refetch:q},t[40]=z,t[41]=V,t[42]=D.isPending,t[43]=j,t[44]=y.isPending,t[45]=F,t[46]=L,t[47]=ie,t[48]=_,t[49]=g,t[50]=q,t[51]=U,t[52]=G,t[53]=k.isPending,t[54]=Y,t[55]=N,t[56]=x.isPending,t[57]=X):X=t[57],X}function Be(e){$({action:`create_list`,error:e}),a.error(i(`Failed to create list: `)+e.message)}export{Te as a,Ce as c,be as d,ve as f,Ee as i,ye as l,K as m,Oe as n,Se as o,he as p,Q as r,we as s,ze as t,xe as u};

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.