1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,266027,e=>{"use strict";let t;var r=e.i(175555),s=e.i(540143),i=e.i(286491),n=e.i(915823),a=e.i(793803),o=e.i(619273),u=e.i(180166),c=class extends n.Subscribable{constructor(e,t){super(),this.options=t,this.#e=e,this.#t=null,this.#r=(0,a.pendingThenable)(),this.bindMethods(),this.setOptions(t)}#e;#s=void 0;#i=void 0;#n=void 0;#a;#o;#r;#t;#u;#c;#l;#h;#d;#f;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#s.addObserver(this),l(this.#s,this.options)?this.#g():this.updateResult(),this.#m())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return h(this.#s,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return h(this.#s,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#y(),this.#b(),this.#s.removeObserver(this)}setOptions(e){let t=this.options,r=this.#s;if(this.options=this.#e.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,o.resolveEnabled)(this.options.enabled,this.#s))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#R(),this.#s.setOptions(this.options),t._defaulted&&!(0,o.shallowEqualObjects)(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#s,observer:this});let s=this.hasListeners();s&&d(this.#s,r,this.options,t)&&this.#g(),this.updateResult(),s&&(this.#s!==r||(0,o.resolveEnabled)(this.options.enabled,this.#s)!==(0,o.resolveEnabled)(t.enabled,this.#s)||(0,o.resolveStaleTime)(this.options.staleTime,this.#s)!==(0,o.resolveStaleTime)(t.staleTime,this.#s))&&this.#v();let i=this.#w();s&&(this.#s!==r||(0,o.resolveEnabled)(this.options.enabled,this.#s)!==(0,o.resolveEnabled)(t.enabled,this.#s)||i!==this.#f)&&this.#C(i)}getOptimisticResult(e){var t,r;let s=this.#e.getQueryCache().build(this.#e,e),i=this.createResult(s,e);return t=this,r=i,(0,o.shallowEqualObjects)(t.getCurrentResult(),r)||(this.#n=i,this.#o=this.options,this.#a=this.#s.state),i}getCurrentResult(){return this.#n}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#r.status||this.#r.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#s}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),r=this.#e.getQueryCache().build(this.#e,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#g({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#g(e){this.#R();let t=this.#s.fetch(this.options,e);return e?.throwOnError||(t=t.catch(o.noop)),t}#v(){this.#y();let e=(0,o.resolveStaleTime)(this.options.staleTime,this.#s);if(o.isServer||this.#n.isStale||!(0,o.isValidTimeout)(e))return;let t=(0,o.timeUntilStale)(this.#n.dataUpdatedAt,e);this.#h=u.timeoutManager.setTimeout(()=>{this.#n.isStale||this.updateResult()},t+1)}#w(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#s):this.options.refetchInterval)??!1}#C(e){this.#b(),this.#f=e,!o.isServer&&!1!==(0,o.resolveEnabled)(this.options.enabled,this.#s)&&(0,o.isValidTimeout)(this.#f)&&0!==this.#f&&(this.#d=u.timeoutManager.setInterval(()=>{(this.options.refetchIntervalInBackground||r.focusManager.isFocused())&&this.#g()},this.#f))}#m(){this.#v(),this.#C(this.#w())}#y(){this.#h&&(u.timeoutManager.clearTimeout(this.#h),this.#h=void 0)}#b(){this.#d&&(u.timeoutManager.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let r,s=this.#s,n=this.options,u=this.#n,c=this.#a,h=this.#o,p=e!==s?e.state:this.#i,{state:g}=e,m={...g},y=!1;if(t._optimisticResults){let r=this.hasListeners(),a=!r&&l(e,t),o=r&&d(e,s,t,n);(a||o)&&(m={...m,...(0,i.fetchState)(g.data,e.options)}),"isRestoring"===t._optimisticResults&&(m.fetchStatus="idle")}let{error:b,errorUpdatedAt:R,status:v}=m;r=m.data;let w=!1;if(void 0!==t.placeholderData&&void 0===r&&"pending"===v){let e;u?.isPlaceholderData&&t.placeholderData===h?.placeholderData?(e=u.data,w=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,void 0!==e&&(v="success",r=(0,o.replaceData)(u?.data,e,t),y=!0)}if(t.select&&void 0!==r&&!w)if(u&&r===c?.data&&t.select===this.#u)r=this.#c;else try{this.#u=t.select,r=t.select(r),r=(0,o.replaceData)(u?.data,r,t),this.#c=r,this.#t=null}catch(e){this.#t=e}this.#t&&(b=this.#t,r=this.#c,R=Date.now(),v="error");let C="fetching"===m.fetchStatus,E="pending"===v,S="error"===v,O=E&&C,T=void 0!==r,F={status:v,fetchStatus:m.fetchStatus,isPending:E,isSuccess:"success"===v,isError:S,isInitialLoading:O,isLoading:O,data:r,dataUpdatedAt:m.dataUpdatedAt,error:b,errorUpdatedAt:R,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdate
1Count:m.errorUpdateCount,isFetched:m.dataUpdateCount>0||m.errorUpdateCount>0,isFetchedAfterMount:m.dataUpdateCount>p.dataUpdateCount||m.errorUpdateCount>p.errorUpdateCount,isFetching:C,isRefetching:C&&!E,isLoadingError:S&&!T,isPaused:"paused"===m.fetchStatus,isPlaceholderData:y,isRefetchError:S&&T,isStale:f(e,t),refetch:this.refetch,promise:this.#r,isEnabled:!1!==(0,o.resolveEnabled)(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=void 0!==F.data,r="error"===F.status&&!t,i=e=>{r?e.reject(F.error):t&&e.resolve(F.data)},n=()=>{i(this.#r=F.promise=(0,a.pendingThenable)())},o=this.#r;switch(o.status){case"pending":e.queryHash===s.queryHash&&i(o);break;case"fulfilled":(r||F.data!==o.value)&&n();break;case"rejected":r&&F.error===o.reason||n()}}return F}updateResult(){let e=this.#n,t=this.createResult(this.#s,this.options);if(this.#a=this.#s.state,this.#o=this.options,void 0!==this.#a.data&&(this.#l=this.#s),(0,o.shallowEqualObjects)(t,e))return;this.#n=t;let r=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#p.size)return!0;let s=new Set(r??this.#p);return this.options.throwOnError&&s.add("error"),Object.keys(this.#n).some(t=>this.#n[t]!==e[t]&&s.has(t))};this.#E({listeners:r()})}#R(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#s)return;let t=this.#s;this.#s=e,this.#i=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#m()}#E(e){s.notifyManager.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#n)}),this.#e.getQueryCache().notify({query:this.#s,type:"observerResultsUpdated"})})}};function l(e,t){return!1!==(0,o.resolveEnabled)(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&h(e,t,t.refetchOnMount)}function h(e,t,r){if(!1!==(0,o.resolveEnabled)(t.enabled,e)&&"static"!==(0,o.resolveStaleTime)(t.staleTime,e)){let s="function"==typeof r?r(e):r;return"always"===s||!1!==s&&f(e,t)}return!1}function d(e,t,r,s){return(e!==t||!1===(0,o.resolveEnabled)(s.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&f(e,r)}function f(e,t){return!1!==(0,o.resolveEnabled)(t.enabled,e)&&e.isStaleByTime((0,o.resolveStaleTime)(t.staleTime,e))}e.i(247167);var p=e.i(271645),g=e.i(912598);e.i(843476);var m=p.createContext((t=!1,{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t})),y=p.createContext(!1);y.Provider;var b=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function R(e,t){return function(e,t,r){let i,n=p.useContext(y),a=p.useContext(m),u=(0,g.useQueryClient)(r),c=u.defaultQueryOptions(e);u.getDefaultOptions().queries?._experimental_beforeQuery?.(c);let l=u.getQueryCache().get(c.queryHash);if(c._optimisticResults=n?"isRestoring":"optimistic",c.suspense){let e=e=>"static"===e?e:Math.max(e??1e3,1e3),t=c.staleTime;c.staleTime="function"==typeof t?(...r)=>e(t(...r)):e(t),"number"==typeof c.gcTime&&(c.gcTime=Math.max(c.gcTime,1e3))}i=l?.state.error&&"function"==typeof c.throwOnError?(0,o.shouldThrowError)(c.throwOnError,[l.state.error,l]):c.throwOnError,(c.suspense||c.experimental_prefetchInRender||i)&&!a.isReset()&&(c.retryOnMount=!1),p.useEffect(()=>{a.clearReset()},[a]);let h=!u.getQueryCache().get(c.queryHash),[d]=p.useState(()=>new t(u,c)),f=d.getOptimisticResult(c),R=!n&&!1!==e.subscribed;if(p.useSyncExternalStore(p.useCallback(e=>{let t=R?d.subscribe(s.notifyManager.batchCalls(e)):o.noop;return d.updateResult(),t},[d,R]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),p.useEffect(()=>{d.setOptions(c)},[c,d]),c?.suspense&&f.isPending)throw b(c,d,a);if((({result:e,errorResetBoundary:t,throwOnError:r,query:s,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(i&&void 0===e.data||(0,o.shouldThrowError)(r,[e.error,s])))({result:f,errorResetBoundary:a,throwOnError:c.throwOnError,query:l,suspense:c.suspense}))throw f.error;if(u.getDefaultOptions().queries?._experimental_afterQuery?.(c,f),c.experimental_prefetchInRender&&!o.isServer&&f.isLoading&&f.isFetching&&!n){let e=h?b(c,d,a):l?.promise;e?.catch(o.noop).finally(()=>{d.updateResult()})}return c.notifyOnChangeProps?f:d.trackResult(f)}(e,c,t)}e.s(["useQuery",()=>R],266027)},954616,e=>{"use strict";var t=e.i(271645),r=e.i(114272),s=e.i(540143),i=e.i(915823),n=e.i(619273),a=class extends i.Subscribable{#e;#n=void 0;#S;#O;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#T()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,n.shallowEqualObjects)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#S,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,n.hashKey)(t.mutationKey)!==(0,n.hashKey)(this.options.mutationKey)?this.reset():this.#S?.state.status==="pending"&&this.#S.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#S?.removeObserver(this)}onMutationUpdate(e){this.#T(),this.#E(e)}getCurrentResult(){return this.#n}reset(){this.#S?.removeObserver(this),this.#S=void 0,this.#T(),this.#E()}mutate(e,t){return this.#O=t,this.#S?.removeObserver(this),this.#S=this.#e.getMutationCache().build(this.#e,this.options),this.#S.addObserver(this),this.#S.execute(e)}#T(){let e=this.#S?.state??(0,r.getDefaultState)();this.#n={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#E(e){s.notifyManager.batch(()=>
1{if(this.#O&&this.hasListeners()){let t=this.#n.variables,r=this.#n.context,s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#O.onSuccess?.(e.data,t,r,s)}catch(e){Promise.reject(e)}try{this.#O.onSettled?.(e.data,null,t,r,s)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#O.onError?.(e.error,t,r,s)}catch(e){Promise.reject(e)}try{this.#O.onSettled?.(void 0,e.error,t,r,s)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#n)})})}},o=e.i(912598);function u(e,r){let i=(0,o.useQueryClient)(r),[u]=t.useState(()=>new a(i,e));t.useEffect(()=>{u.setOptions(e)},[u,e]);let c=t.useSyncExternalStore(t.useCallback(e=>u.subscribe(s.notifyManager.batchCalls(e)),[u]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),l=t.useCallback((e,t)=>{u.mutate(e,t).catch(n.noop)},[u]);if(c.error&&(0,n.shouldThrowError)(u.options.throwOnError,[c.error]))throw c.error;return{...c,mutate:l,mutateAsync:c.mutate}}e.s(["useMutation",()=>u],954616)},678745,e=>{"use strict";let t=(0,e.i(475254).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["default",()=>t])},643531,e=>{"use strict";var t=e.i(678745);e.s(["Check",()=>t.default])},88653,e=>{"use strict";e.i(247167);var t=e.i(843476),r=e.i(271645),s=e.i(231178),i=e.i(947414),n=e.i(674008),a=e.i(821476),o=e.i(772846),u=r,c=e.i(737806);function l(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}class h extends u.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent&&!1!==this.props.pop){let e=t.offsetParent,r=(0,o.isHTMLElement)(e)&&e.offsetWidth||0,s=(0,o.isHTMLElement)(e)&&e.offsetHeight||0,i=this.props.sizeRef.current;i.height=t.offsetHeight||0,i.width=t.offsetWidth||0,i.top=t.offsetTop,i.left=t.offsetLeft,i.right=r-i.width-i.left,i.bottom=s-i.height-i.top}return null}componentDidUpdate(){}render(){return this.props.children}}function d({children:e,isPresent:s,anchorX:i,anchorY:n,root:a,pop:o}){let d=(0,u.useId)(),f=(0,u.useRef)(null),p=(0,u.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:g}=(0,u.useContext)(c.MotionConfigContext),m=function(...e){return r.useCallback(function(...e){return t=>{let r=!1,s=e.map(e=>{let s=l(e,t);return r||"function"!=typeof s||(r=!0),s});if(r)return()=>{for(let t=0;t<s.length;t++){let r=s[t];"function"==typeof r?r():l(e[t],null)}}}}(...e),e)}(f,e.props?.ref??e?.ref);return(0,u.useInsertionEffect)(()=>{let{width:e,height:t,top:r,left:u,right:c,bottom:l}=p.current;if(s||!1===o||!f.current||!e||!t)return;let h="left"===i?`left: ${u}`:`right: ${c}`,m="bottom"===n?`bottom: ${l}`:`top: ${r}`;f.current.dataset.motionPopId=d;let y=document.createElement("style");g&&(y.nonce=g);let b=a??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(` 2 [data-motion-pop-id="${d}"] { 3 position: absolute !important; 4 width: ${e}px !important; 5 height: ${t}px !important; 6 ${h}px !important; 7 ${m}px !important; 8 } 9 `),()=>{b.contains(y)&&b.removeChild(y)}},[s]),(0,t.jsx)(h,{isPresent:s,childRef:f,sizeRef:p,pop:o,children:!1===o?e:u.cloneElement(e,{ref:m})})}let f=({children:e,initial:s,isPresent:n,onExitComplete:o,custom:u,presenceAffectsLayout:c,mode:l,anchorX:h,anchorY:f,root:g})=>{let m=(0,i.useConstant)(p),y=(0,r.useId)(),b=!0,R=(0,r.useMemo)(()=>(b=!1,{id:y,initial:s,isPresent:n,custom:u,onExitComplete:e=>
9{for(let t of(m.set(e,!0),m.values()))if(!t)return;o&&o()},register:e=>(m.set(e,!1),()=>m.delete(e))}),[n,m,o]);return c&&b&&(R={...R}),(0,r.useMemo)(()=>{m.forEach((e,t)=>m.set(t,!1))},[n]),r.useEffect(()=>{n||m.size||!o||o()},[n]),e=(0,t.jsx)(d,{pop:"popLayout"===l,isPresent:n,anchorX:h,anchorY:f,root:g,children:e}),(0,t.jsx)(a.PresenceContext.Provider,{value:R,children:e})};function p(){return new Map}var g=e.i(464978);let m=e=>e.key||"";function y(e){let t=[];return r.Children.forEach(e,e=>{(0,r.isValidElement)(e)&&t.push(e)}),t}let b=({children:e,custom:a,initial:o=!0,onExitComplete:u,presenceAffectsLayout:c=!0,mode:l="sync",propagate:h=!1,anchorX:d="left",anchorY:p="top",root:b})=>{let[R,v]=(0,g.usePresence)(h),w=(0,r.useMemo)(()=>y(e),[e]),C=h&&!R?[]:w.map(m),E=(0,r.useRef)(!0),S=(0,r.useRef)(w),O=(0,i.useConstant)(()=>new Map),T=(0,r.useRef)(new Set),[F,I]=(0,r.useState)(w),[M,k]=(0,r.useState)(w);(0,n.useIsomorphicLayoutEffect)(()=>{E.current=!1,S.current=w;for(let e=0;e<M.length;e++){let t=m(M[e]);C.includes(t)?(O.delete(t),T.current.delete(t)):!0!==O.get(t)&&O.set(t,!1)}},[M,C.length,C.join("-")]);let Q=[];if(w!==F){let e=[...w];for(let t=0;t<M.length;t++){let r=M[t],s=m(r);C.includes(s)||(e.splice(t,0,r),Q.push(r))}return"wait"===l&&Q.length&&(e=Q),k(y(e)),I(w),null}let{forceRender:x}=(0,r.useContext)(s.LayoutGroupContext);return(0,t.jsx)(t.Fragment,{children:M.map(e=>{let r=m(e),s=(!h||!!R)&&(w===M||C.includes(r));return(0,t.jsx)(f,{isPresent:s,initial:(!E.current||!!o)&&void 0,custom:a,presenceAffectsLayout:c,mode:l,root:b,onExitComplete:s?void 0:()=>{if(T.current.has(r)||(T.current.add(r),!O.has(r)))return;O.set(r,!0);let e=!0;O.forEach(t=>{t||(e=!1)}),e&&(x?.(),k(S.current),h&&v?.(),u&&u())},anchorX:d,anchorY:p,children:e},r)})})};e.s(["AnimatePresence",()=>b],88653)},853419,e=>{"use strict";function t(e,t){if("function"==typeof window.umami?.track)try{window.umami.track(e,t)}catch{}}function r(e,r){t(e,r)}function s(e){t("extension-install-click",{source:e})}function i(e){t("signup",{method:e})}function n(e){t("login",{method:e})}function a(e){t("directory-follow",{blog:e})}function o(e){t("community-follow",{blog:e})}function u(e){t("collection-view",{collection:e})}function c(){t("blog-submission")}function l(){t("contact-submission")}function h(e){t("onboarding-complete",{blogs_followed:e})}function d(e){t("opml-import",{feeds_in_file:e.feeds_in_file,imported:e.imported,skipped:e.skipped,failed:e.failed,source:e.source,success_rate:e.feeds_in_file>0?Math.round(e.imported/e.feeds_in_file*100):0})}function f(e){t("post-read",{source:e})}function p(e){t("post-starred",{action:e})}function g(e){t("post-read-later",{action:e})}function m(e){t("post-saved-offline",{source:e})}function y(e){t("mark-all-read",{scope:e})}function b(){t("settings-opened",void 0)}function R(e){t("settings-tab-changed",{tab:e})}function v(e){t("onboarding-step-viewed",{step:e})}function w(e){t("onboarding-skipped",{at_step:e})}function C(e){t("blog-unfollowed",{type:e})}function E(e){t("feed-refresh",{scope:e})}function S(e){t("blog-tags-updated",{tag_count:e})}function O(e){t("add-blog-modal-opened",{source:e})}function T(e,r){t("search-used",{context:e,has_query:r})}function F(e){t("view-filter-changed",{filter:e})}e.s(["trackAddBlogModalOpened",()=>O,"trackBlogSubmission",()=>c,"trackBlogTagsUpdated",()=>S,"trackBlogUnfollowed",()=>C,"trackCollectionView",()=>u,"trackCommunityFollow",()=>o,"trackContactSubmission",()=>l,"trackDetailedEvent",()=>r,"trackDirectoryFollow",()=>a,"trackEvent",()=>t,"trackExtensionInstallClick",()=>s,"trackFeedRefresh",()=>E,"trackLogin",()=>n,"trackMarkAllRead",()=>y,"trackOPMLImport",()=>d,"trackOnboardingComplete",()=>h,"trackOnboardingSkipped",()=>w,"trackOnboardingStepViewed",()=>v,"trackPostRead",()=>f,"trackPostReadLater",()=>g,"trackPostSavedOffline",()=>m,"trackPostStarred",()=>p,"trackSearch",()=>T,"trackSettingsOpened",()=>b,"trackSettingsTabChanged",()=>R,"trackSignup",()=>i,"trackViewFilterChanged",()=>F])},611573,e=>{"use strict";var t=e.i(610399),r=e.i(957470);let s="feeds",i="post_content";async function n(){return(0,t.openDB)("blogs-are-back-cache",2,{upgrade(e,t,r,n){e.objectStoreNames.contains(s)||e.createObjectStore(s,{keyPath:"feedUrl"}).createIndex("by-lastFetched","lastFetched"),e.objectStoreNames.contains(i)||e.createObjectStore(i,{keyPath:"guidHash"}).createIndex("by-feedUrl","feedUrl"),t<2&&n.objectStore(s).clear()}})}function a(e){try{return JSON.stringify(e).length}catch{return 102400}}async function o(){let e=await n(),t=await e.getAll(s);return{totalSize:t.reduce((e,t)=>
9e+a(t),0),feedCount:t.length,feeds:t}}async function u(e,t){let r=e.transaction(i,"readwrite"),s=r.store.index("by-feedUrl"),n=await s.openCursor(t);for(;n;)await n.delete(),n=await n.continue();await r.done}async function c(e=.2){let t=await n(),r=await t.getAll(s);if(0===r.length)return 0;let i=r.sort((e,t)=>e.lastFetched.getTime()-t.lastFetched.getTime()),a=Math.max(1,Math.floor(r.length*e)),o=i.slice(0,a);return await Promise.all(o.map(async e=>{await u(t,e.feedUrl),await t.delete(s,e.feedUrl)})),console.log(`[Cache] Evicted ${o.length} oldest feeds to free up space`),o.length}function l(e,t){return new Date().getTime()-e.getTime()<(t?r.CACHE_CONFIG.OFFLINE_RETENTION_MS:r.CACHE_CONFIG.INDEXEDDB_TTL_MS)}function h(){return"u">typeof navigator&&!navigator.onLine}async function d(e){try{let t=await n(),r=await t.get(s,e);return r?.lastFetched||null}catch(e){return console.error("Error getting last fetched timestamp:",e),null}}async function f(e,t){try{let i=await n(),a=await i.get(s,e);if(!a)return null;let o=new Date().getTime()-a.lastFetched.getTime(),u=h();if(!l(a.lastFetched)){if(u&&l(a.lastFetched,!0))return console.log(`[Cache] Returning offline-stale cache for ${e} (age: ${Math.round(o/36e5)}h)`),{feed:{metadata:a.metadata,posts:a.posts},age:o,isStale:!0,isOfflineStale:!0};return await i.delete(s,e),null}let c={metadata:a.metadata,posts:a.posts},d=t??r.CACHE_CONFIG.BACKGROUND_REFRESH_THRESHOLD_MS;return{feed:c,age:o,isStale:o>d}}catch(e){return console.error("Error getting cached feed:",e),null}}function p(e){return!1===e?r.CACHE_CONFIG.DIRECT_FETCH_REFRESH_THRESHOLD_MS:r.CACHE_CONFIG.MANUAL_REFRESH_THRESHOLD_MS}async function g(e){try{let t=await n(),r=await t.get(s,e);if(!r)return null;if(!l(r.lastFetched)){if(h()&&l(r.lastFetched,!0))return r;return await t.delete(s,e),null}return r}catch(e){return console.error("Error getting cached feed with headers:",e),null}}async function m(e){let t=await f(e);return t?t.feed:null}async function y(e,t,r,u){try{let l=await n(),h=[],d=[],f=Date.now();for(let r of t.posts){r.content&&r.guidHash&&h.push({guidHash:r.guidHash,content:r.content,feedUrl:e,cachedAt:f});let{content:t,...s}=r;d.push(s)}let p={feedUrl:e,posts:d,metadata:t.metadata,lastFetched:new Date,etag:r,lastModified:u},g=await o(),m=a(p);if(g.feedCount>=100||g.totalSize+m>0x6400000){let e=(g.totalSize/1024/1024).toFixed(2),t=(m/1024).toFixed(2);console.log(`[Cache] Limit approaching (${g.feedCount} feeds, ${e}MB + ${t}KB). Evicting...`),await c()}if(await l.put(s,p),h.length>0){let e=l.transaction(i,"readwrite");await Promise.all([...h.map(t=>e.store.put(t)),e.done])}if(g.feedCount%10==0){let e=((g.totalSize+m)/1024/1024).toFixed(2);console.log(`[Cache] Stats: ${g.feedCount+1} feeds, ~${e}MB total`)}}catch(e){console.error("Error caching feed:",e)}}async function b(e){try{let t=await n(),r=await t.get(i,e);return r?.content??null}catch(e){return console.error("Error getting post content:",e),null}}async function R(e,t){let r=await Promise.all(e.map(async e=>{let t=await m(e);return{url:e,cached:t}})),s=new Map;if(r.forEach(({url:e,cached:t})=>{t&&s.set(e,t)}),t?.includeContent&&s.size>0)try{let e=await n(),t=[];for(let e of s.values())for(let r of e.posts)r.guidHash&&t.push(r.guidHash);let r=new Map,a=e.transaction(i,"readonly");for(let e of(await Promise.all(t.map(async e=>{let t=await a.store.get(e);t?.content&&r.set(e,t.content)})),await a.done,s.values()))for(let t of e.posts)if(t.guidHash){let e=r.get(t.guidHash);e&&(t.content=e)}}catch(e){console.error("Error hydrating post content:",e)}return s}async function v(e){try{let t=await n();await u(t,e),await t.delete(s,e)}catch(e){console.error("Error deleting cached feed:",e)}}async function w(){try{let e=await n();await e.clear(s),await e.clear(i),console.log("[Cache] Cleared all cached feeds")}catch(e){console.error("Error clearing cache:",e)}}async function C(e){try{await v(e),console.log(`[Cache] Cleaned up cache for ${e}`)}catch(e){console.error("Error cleaning up feed cache:",e)}}async function E(){try{let e=await n(),t=await e.getAll(s),r=t.filter(e=>l(e.lastFetched)),i=t.filter(e=>!l(e.lastFetched));return{totalFeeds:t.length,validFeeds:r.length,expiredFeeds:i.length}}catch(e){return console.error("Error getting cache stats:",e),{totalFeeds:0,validFeeds:0,expiredFeeds:0}}}async function S(){try{let e=await n(),t=await e.getAll(s),r=h(),i=0;for(let n of t)if(!l(n.lastFetched)){if(r&&l(n.lastFetched,!0))continue;await u(e,n.feedUrl),await e.delete(s,n.feedUrl),i++}return i}catch(e){return console.error("Error cleaning up cache:",e),0}}e.s(["cleanupCacheForFeed",()=>C,"cleanupExpiredCache",()=>S,"clearAllCache",()=>w,"getCacheStats",()=>E,"getCachedFeed",()=>m,"getCachedFeedWithHeaders",()=>g,"getCachedFeedWithMeta",()=>f,"getCachedFeeds",()=>R,"getLastFetchedTimestamp",()=>d,"getManualRefreshThreshold",()=>p,"getPostContent",()=>
9b,"setCachedFeed",()=>y])}]);
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.