PageSourceSearch

https://myechoboard.com/assets/MemoryFeed-CBvj8dmC.js

js myechoboard.com collected 2026-09-24 13:50:31 UTC 85,529 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MemoryDetailModal-D2r559XQ.js","assets/runtime-preload-CFP917pd.js","assets/vendor-react-C9yDzYQD.js","assets/useOfflineSource-1vy8u9R8.js","assets/offline-C2kw-B3Y.js","assets/app-BhliLHoU.js","assets/startup-core-CGeUO7uJ.js","assets/startup-platform-OWIpYyjW.js","assets/startup-diagnostics-bridge-CKNiHJ_f.js","assets/useNetworkStatus-pTwuOFZz.js","assets/nativeAppStateSubscriptions-Cv_2m-ZS.js","assets/asyncSemaphore-KO0g8gsf.js","assets/supabase-client-_h80EYw_.js","assets/vendor-supabase-BL1taoPA.js","assets/supabase-config-Bge368iX.js","assets/vendor-query-DpPswXvj.js","assets/runtime-utils-GN4cODRt.js","assets/userFilters-Bp32kBo8.js","assets/createLucideIcon-DNcTU-zM.js","assets/idleStorage-BGANA5qp.js","assets/perfConfig-DEgIskwG.js","assets/documentVisibilitySubscriptions-CqVNm4Da.js","assets/useUserSettings-COPNty3J.js","assets/vendor-capacitor-8exTJy5k.js","assets/feedMotion-BhgUIjw7.js","assets/passiveScrollSubscriptions-CS-jkkI4.js","assets/imageLoadFailurePolicy-DJD2yr3u.js","assets/useAuth-Dz3EPsxs.js","assets/memory-CJrksfzy.js","assets/exploreFilterSemantics-DQb3RKye.js","assets/x-lNdY5pWw.js","assets/image-utils-AdRSPECl.js","assets/BoardPreviewAvatar-6XMyttho.js","assets/VideoPosterOnly-CNeQsWm2.js","assets/videoUtils-CgPXwgg1.js","assets/performanceTier-CE8N6__E.js","assets/mediaQueryStore-DwN5Dqg0.js","assets/loader-circle-CWK_zhHB.js","assets/video-DibMJbQh.js","assets/useMemoryPreviews-BS4oUuox.js","assets/boundedRequest-B4Q3Iimu.js","assets/echoTypePolicy-DA-PDKiE.js","assets/boardPreviewPolicy-DVjUGhXs.js","assets/button-CcIRk75H.js","assets/index-DyIfOVK5.js","assets/index-nwDrq1j8.js","assets/dialog-DHNNRuDw.js","assets/index-BLLe0eFp.js","assets/index-CuooO_kK.js","assets/index-BrpnBk_C.js","assets/Combination-DIDwI44r.js","assets/index-6bR26fvg.js","assets/input-CJADGzyX.js","assets/select-BE1IGN5Z.js","assets/index-jVOyRz7F.js","assets/index-Bf_lj5FF.js","assets/index-CfYZuMWu.js","assets/index-C_zeqDvy.js","assets/index-CnKRQy80.js","assets/index-CoOSNOH9.js","assets/chevron-down-BFi_I8Zn.js","assets/check-MQhLD6FV.js","assets/chevron-up-DmrAct_7.js","assets/useUserFilters-hLhdUOK2.js","assets/memoryDetailMetadata-YR61o5BJ.js","assets/search-D7ByVMw5.js","assets/rotate-ccw-BkMzxdp0.js","assets/plus-CNl86JwM.js","assets/sliders-horizontal-Bf84lb4T.js","assets/memoryNoteEchoPages-D4iGhN4E.js","assets/dailyHearts-Dpst4P7w.js","assets/heart-DTG6gDEx.js","assets/shareUrls-BBmEIcFl.js","assets/drawer-RVJlVdjE.js","assets/use-mobile-D5Xf5BKb.js","assets/displayText-DVC6GTMU.js","assets/noteHtmlSecurity-C5849mqd.js","assets/safeExternalUrl-Hy3HQFqY.js","assets/MoodContext-C8nY2rn-.js","assets/useSubscription-CEwnjYgb.js","assets/ThemeContext-jMT4gQSB.js","assets/useHaptics-BI0pxz1a.js","assets/vendor-router-X7RJKav4.js","assets/useFollowing-B-v0MDOH.js","assets/useSharedBoards-HZIBsbff.js","assets/dropdown-menu-BEBSGtMc.js","assets/index-gOewhWoM.js","assets/circle-CkfN9-i9.js","assets/colorPreview-DNHK2pWR.js","assets/memoryDisplayTitle-BcAkzk0a.js","assets/boardViewSettings-CdKftBZg.js","assets/boardCardSize-DMpJ9b3m.js","assets/feedSettingsSubscriptions-BbSMaSgy.js","assets/memoryQueryCache-B47lTB9L.js","assets/feedMutationCoordinator-BvkdZE4y.js","assets/collectionNavigation-Dty1iP6Q.js","assets/folder-oSdBhNiA.js","assets/share-2-CXQVLp8U.js","assets/download-CzaTzqTz.js","assets/trash-2-B7zVZuh_.js","assets/ban-qJhRe8dJ.js","assets/flag-DV5vL-V-.js","assets/sparkles-COPkKMBj.js","assets/chevron-left-VZH14zeF.js","assets/external-link-n2tXYKjz.js","assets/music-B4uV8cIM.js","assets/circle-alert-CTzjEn3-.js","assets/file-text-B2HnMzWj.js","assets/ellipsis-D4MBwnVX.js","assets/pen-line-B-ZKUQwb.js","assets/FloatingReaction-DtqzlswO.js","assets/vendor-animation-DJXjROdF.js","assets/FeedSettingsPopover-BKQfMI2G.js","assets/popover-BqNd_ntB.js","assets/slider-16Gwg18s.js","assets/switch-CM-712rT.js","assets/settings-2-BlPhDt3l.js","assets/bookmark-plus-jDK9f88h.js","assets/FeedSelectionActionBar-DCvod52J.js","assets/BulkTagCompletionSummary-wu5Gz370.js","assets/circle-check-DwjPV3g7.js","assets/BulkTagPicker-BObvNe3s.js","assets/minus-DTEknrgZ.js","assets/tag-DttT5I5w.js","assets/MoveToBoardDialog-BIqXAB0t.js","assets/alert-dialog-BZjXuitG.js","assets/useBoards-KZlRZb0G.js","assets/UpgradeModal-CTU3dL8h.js","assets/zap-BLOtyeeL.js","assets/dbMetrics-D5Q8D3iF.js","assets/boundedAsyncPool-BG_N2Lbq.js","assets/rpcCapabilityCache-CVP6KxZ_.js","assets/useMemoryActions-CgyGQ4Np.js","assets/bulkMemoryTags-Ddec3Mf-.js","assets/boardSectionMemberships-BIWAwBQ2.js","assets/list-filter-CTkrhYiD.js","assets/performanceRum-DKAircGt.js","assets/errorReporting-CeP9RUm7.js","assets/rumNavigation-BhIWA8ac.js"])))=>i.map(i=>d[i]);
2import{_ as e}from"./runtime-preload-CFP917pd.js";import{r as t,R as r,j as n,a as o}from"./vendor-react-C9yDzYQD.js";import{c as a}from"./exploreExposureOutbox-NybhlhYP.js";import{g as i}from"./exploreContentIdentity-D-Otu-po.js";import{i as l}from"./exploreViewportExposure-p9xfc4T3.js";import{b as s,s as u}from"./exploreSeenStorage-D_DH2XtR.js";import{i as c,u as d}
2from"./feedMotion-BhgUIjw7.js";import{e as m,m as f}from"./userFilters-Bp32kBo8.js";import{n as h}from"./memoryBoardContext-vG9PRs0o.js";import{a as p,e as w,u as v,f as g,r as x,h as b,i as y,C as _,j as M,k as E,d as j,l as I,m as C}from"./collectionNavigation-Dty1iP6Q.js";import{a as T,i as R,f as S,c as N,g as k}from"./feedMutationCoordinator-BvkdZE4y.js";import{b as L}from"./feedPageRetention-yNIfWPHZ.js";import{r as A}from"./viewportLoadMoreObserver-CThDFSVJ.js";import{a as B,r as F,b as D}from"./MemoryCard-DJDOd9Hn.js";import{s as P,g as H}from"./nativeAppStateSubscriptions-Cv_2m-ZS.js";import{s as O}from"./documentVisibilitySubscriptions-CqVNm4Da.js";import{d as $,a as z,c as q}from"./vendor-query-DpPswXvj.js";import{M as V}from"./MemoryCardSkeleton-Ct5cNSA5.js";import{supabase as Y}from"./supabase-client-_h80EYw_.js";import{b as U}from"./echoTypePolicy-DA-PDKiE.js";import{a as W}from"./runtime-utils-GN4cODRt.js";import{u as K}from"./useNetworkStatus-pTwuOFZz.js";import{B as Q}from"./button-CcIRk75H.js";import{u as G}from"./MoodContext-C8nY2rn-.js";import{u as X}from"./ThemeContext-jMT4gQSB.js";import{u as J}from"./usePerfBudget-B6X6q34-.js";import{g as Z,b as ee}from"./useUserSettings-COPNty3J.js";import{u as te,g as re}from"./memoryNoteEchoPages-D4iGhN4E.js";import{D as ne}from"./dailyHearts-Dpst4P7w.js";import{t as oe}from"./useAuth-Dz3EPsxs.js";import{b as ae}from"./image-utils-AdRSPECl.js";import{u as ie}from"./useAiContentVisibility-C0IxXYx6.js";import{g as le}from"./shareUrls-BBmEIcFl.js";import{l as se}from"./boardViewSettings-CdKftBZg.js";import{s as ue,F as ce}from"./perfConfig-DEgIskwG.js";import{a as de}from"./passiveScrollSubscriptions-CS-jkkI4.js";import{a as me,s as fe}from"./windowResizeSubscriptions-C3xwW4pN.js";import{s as he}from"./feedSettingsSubscriptions-BbSMaSgy.js";import{b as pe,i as we}from"./startup-platform-OWIpYyjW.js";import{i as ve,s as ge}from"./searchGateway-ChZYX3l1.js";import{a as xe,u as be}from"./vendor-router-X7RJKav4.js";import{C as ye}from"./circle-alert-CTzjEn3-.js";import{S as _e}from"./sparkles-COPkKMBj.js";import{L as Me}from"./loader-circle-CWK_zhHB.js";import{W as Ee}from"./wifi-off-DgTu9GsA.js";import{C as je}from"./chevron-left-VZH14zeF.js";import{C as Ie}from"./dropdown-menu-BEBSGtMc.js";import{X as Ce}from"./x-lNdY5pWw.js";function Te(e,t,r){return t&&r?e.filter(e=>!function(e,t){return!!t&&(e.user_id||e.owner_id||e.added_by_id||e.added_by||e.source_board_owner_id)===t}(e,r)):e}function Re(e,t,r,n=!1){return!(!n&&null!==e)||!Number.isFinite(e)||!Number.isFinite(t)||Math.abs(t-e)>=Math.max(1,r)}function Se(e,t,r){if(0===e.length||r<t)return[];let n=0,o=e.length;for(;n<o;){const r=n+o>>>1,a=e[r];a.offsetTop+a.estimatedHeight<t?n=r+1:o=r}const a=n;for(n=a,o=e.length;n<o;){const t=n+o>>>1;e[t].offsetTop<=r?n=t+1:o=t}return e.slice(a,n)}const Ne=({budget:e,preferredDesired:t,trailingDesired:r})=>{const n=Math.max(0,Math.floor(e)),o=n>=2&&r>0?Math.min(r,Math.max(1,Math.floor(.25*n))):0;let a=Math.min(t,n-o),i=Math.min(r,n-a),l=n-a-i;if(l>0){const e=Math.min(t-a,l);a+=e,l-=e}return l>0&&(i+=Math.min(r-i,l)),{preferred:a,trailing:i}};function ke(e,t,r=18){if(e.count<=0||e.endIndex<e.startIndex)return[];const n=Math.max(0,Math.min(e.count-1,e.startIndex)),o=Math.max(n,Math.min(e.count-1,e.endIndex)),a=o-n+1,i=c({...t}),l=i?3:2,s=i?1.25:1,u="up"===t.direction,d=Math.min(n,Math.ceil(a*(u?l:s))),m=Math.min(e.count-o-1,Math.ceil(a*(u?s:l))),f=Number.isFinite(r)?Math.max(0,Math.floor(r)):18,h=Math.max(0,f-a),p=Ne({budget:h,preferredDesired:u?d:m,trailingDesired:u?m:d}),w=u?p.preferred:p.trailing,v=u?p.trailing:p.preferred,g=n-w,x=o+v;return Array.from({length:x-g+1},(e,t)=>g+t)}function Le({items:e,viewportTop:t,viewportHeight:r,totalHeight:n,motion:o,previous:a,maxItems:i=18,getId:l}){const s=Number.isFinite(i)?Math.max(0,Math.floor(i)):18;if((null==a?void 0:a.sourceItems)===e&&a.totalHeight===n&&a.visibleItems.length>0&&a.visibleItems.length<=s&&Number.isFinite(t)&&Number.isFinite(r)&&r>0){const i=a.visibleItems[0],l=a.visibleItems[a.visibleItems.length-1],s=.75*r,u=.25*r,c=Math.max(0,t-("up"===o.direction?s:u)),d=Math.min(n,t+r+("up"===o.direction?u:s));if(i.offsetTop<=c&&l.offsetTop+l.estimatedHeight>=d){let t=0,r=e.length;for(;t<r;){const n=t+r>>>1;e[n].offsetTop<i.offsetTop?t=n+1:r=n}if(a.visibleItems.every((r,n)=>e[t+n]===r))return a}}const u=((e,t)=>{const r=Math.max(1,e),n=c({...t}),o=n?2.75:2,a=n?1.25:1;return"up"===t.direction?{beforePx:r*o,afterPx:r*a}:{beforePx:r*a,afterPx:r*o}})(r,o),d=Math.max(0,t-u.beforePx),m=t+r+u.afterPx;let f=Se(e,d,m);if(0===f.length&&e.length>0){const r=new Set((null==a?void 0:a.visibleItems.map(e=>l(e)))||[]),n=r.size>0?e.filter(e=>r.has(l(e))):[];if(n.length>0)f=n;else{let r=e.length-1,n=0,a=e.length-1;for(;n<=a;){const o=Math.floor((n+a)/2);e[o].offsetTop>=t?(r=o,a=o-1):n=o+1}const i=Math.min(e.length,Math.max(1,s)),l="up"===o.direction?Math.max(0,r-i+1):Math.min(Math.max(0,r),Math.max(0,e.length-i));f=e.slice(l,l+i)}}if(f.length>s){const e=Se(f,t,t+Math.max(0,r));if(0===e.length)f=0===s?[]:"up"===o.direction?f.slice(-s):f.slice(0,s);else{const t=Math.max(s,e.length),r=f.indexOf(e[0]),n=r+e.length-1,a=t-e.length,i="up"===o.direction,l=Ne({budget:a,preferredDesired:i?r:f.length-n-1,trailingDesired:i?f.length-n-1:r}),u=i?l.preferred:l.trailing,c=i?l.trailing:l.preferred;f=f.slice(r-u,n+c+1)}}const h=f[0],p=f[f.length-1],w=h?l(h):null,v=p?l(p):null;return a&&a.sourceItems===e&&a.firstId===w&&a.lastId===v&&a.totalHeight===n&&a.visibleItems.length===f.length&&f.every((e,t)=>a.visibleItems[t]===e)?a:{sourceItems:e,visibleItems:f,firstId:w,lastId:v,topSpacer:h?Math.max(0,h.offsetTop):0,bottomSpacer:p?Math.max(0,n-(p.offsetTop+p.estimatedHeight)):Math.max(0,n),totalHeight:n}}const Ae=(e=Date.now())=>({expiresAt:e+3e5}),Be=(e,t=Date.now())=>Boolean(e&&e.expiresAt>=t),Fe=(e,t)=>e===t?null:e,De=2e3,Pe=()=>"visible"===document.visibilityState&&H();function He({rootRef:e,scopeKey:r,enabled:n=!0}){const o=t.useRef(null),a=t.useRef(new Map),i=t.useRef(new Map),l=t.useRef(new Set),u=t.useRef(new Map),c=t.useCallback(e=>{const t=u.current.get(e);void 0!==t&&window.clearTimeout(t),u.current.delete(e)},[]),d=t.useCallback((e,t,r)=>{var n;c(e),s(l.current,e,De),t.style.setProperty("--echo-entrance-delay",`${r}ms`),t.dataset.echoEntrance="active",null==(n=o.current)||n.unobserve(t)},[c]),m=t.useCallback((t,r)=>{var a;if(!n||l.current.has(t))return c(t),s(l.current,t,De),void(r.dataset.echoEntrance="settled");r.style.removeProperty("--echo-entrance-delay"),r.dataset.echoEntrance="pending",null==(a=o.current)||a.observe(r),c(t);const i=window.setTimeout(()=>{var n;if(u.current.delete(t),"pending"!==r.dataset.echoEntrance||!Pe())return;const o=r.getBoundingClientRect(),a=null==(n=null==e?void 0:e.current)?void 0:n.getBoundingClientRect(),i=(null==a?void 0:a.top)??0,l=(null==a?void 0:a.bottom)??window.innerHeight;o.bottom>i&&o.top<l&&d(t,r,0)},900);u.current.set(t,i)},[c,n,d,e]);return t.useLayoutEffect(()=>{const t=a.current;if(!n)return void t.forEach((e,t)=>{c(t),s(l.current,t,De),e.dataset.echoEntrance="settled"});if("undefined"==typeof IntersectionObserver)return void t.forEach((e,t)=>d(t,e,0));const r=new IntersectionObserver(e=>{Pe()&&e.filter(e=>e.isIntersecting).sort((e,t)=>
2{const r=e.boundingClientRect.top-t.boundingClientRect.top;return Math.abs(r)>4?r:e.boundingClientRect.left-t.boundingClientRect.left}).forEach((e,t)=>{const n=e.target,o=n.dataset.echoEntranceId;if(!o||l.current.has(o))return n.dataset.echoEntrance="settled",void r.unobserve(n);d(o,n,(e=>32*Math.min(Math.max(0,e),5))(t))})},{root:(null==e?void 0:e.current)||null,rootMargin:"0px 0px -2% 0px",threshold:.04});o.current=r,t.forEach((e,t)=>{l.current.has(t)||r.observe(e)});const i=()=>{Pe()&&t.forEach((e,t)=>{l.current.has(t)||(r.unobserve(e),r.observe(e))})},u=O(i),m=P(i);return()=>{u(),m(),r.disconnect(),o.current===r&&(o.current=null)}},[c,n,d,e]),t.useLayoutEffect(()=>{l.current.clear(),a.current.forEach((e,t)=>m(t,e))},[m,r]),t.useLayoutEffect(()=>()=>{var e;null==(e=o.current)||e.disconnect(),o.current=null,u.current.forEach(e=>window.clearTimeout(e)),u.current.clear(),a.current.clear(),i.current.clear(),l.current.clear()},[]),t.useCallback(e=>{const t=i.current.get(e);if(t)return t;const r=t=>{var r;const n=a.current.get(e);if(n&&n!==t&&(null==(r=o.current)||r.unobserve(n)),!t)return c(e),a.current.delete(e),void i.current.delete(e);t.dataset.echoEntranceId=e,a.current.set(e,t),m(e,t)};return i.current.set(e,r),r},[c,m])}const Oe=new Map;let $e=null;const ze=(e,t)=>{const r=e.borderBoxSize,n=Array.isArray(r)?r[0]:r,o="inline"===t?null==n?void 0:n.inlineSize:null==n?void 0:n.blockSize;return"number"==typeof o&&Number.isFinite(o)?o:"inline"===t?e.contentRect.width:e.contentRect.height},qe=(e,t)=>{const r=($e||"undefined"==typeof ResizeObserver||($e=new ResizeObserver(e=>{e.forEach(e=>{var t;null==(t=Oe.get(e.target))||t.forEach(t=>t(e))})})),$e);if(!r)return()=>{};let n=Oe.get(e);n||(n=new Set,Oe.set(e,n),r.observe(e)),n.add(t);let o=!1;return()=>{if(o)return;o=!0;const r=Oe.get(e);r&&(r.delete(t),r.size>0||(Oe.delete(e),null==$e||$e.unobserve(e),0===Oe.size&&(null==$e||$e.disconnect(),$e=null)))}},Ve=360,Ye=3e4,Ue=new Map,We=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,Ke=r.memo(function({items:e,columnIndex:t,totalHeight:o,onDelete:a,canDeleteMemory:i,deleteActionLabel:l,deleteActionKind:s,isSelected:u,isSelectionMode:c,onSelect:d,isReadOnly:m,handleCardClick:f,onLike:h,handleHeartClick:p,heartDisabled:w,viewRefForId:v,showAuthorAttribution:g,showHeartCountBadge:x,showExploreMatchChips:b,onNotInterested:y,onMemoryNotInterested:_,onMemoryMoreLikeThis:M,onReportMemory:E,onMemoryMediaUnavailable:j,onExploreMatchFilterClick:I,onFederatedFollow:C,resolveExternalMemoryId:T,isFederatedFollowing:R,priorityCount:S,feedSettings:L,echoPagesByMemoryId:A,measureRefForId:F,preferredBoardId:D,preferredBoardName:P,preferredBoardCanEdit:H,mobileView:O,imageSizes:$,lightweightCards:z,showReactButtonSetting:q,hapticsDisabled:V,routePathname:Y,navigateTo:U,authUser:K,authProfile:Q,isOnline:G,slowNetwork:X,isMobile:J,activeMoodSetting:Z,themeState:ee,lowEnd:te,nativeMobile:re,mutationContext:ne,entranceRefForId:oe}){const ae=r.useMemo(()=>e.map(e=>e.value.id),[e]);return N(ae),n.jsx("div",{className:"relative min-w-0 flex-1 [overflow-anchor:none]",style:{alignSelf:"flex-start",height:`${Math.max(0,o)}px`},children:e.map(e=>{const r=k(e.value.id,ne);return n.jsx("div",{ref:F?F(e.value.id):void 0,"data-feed-item-id":e.value.id,"data-feed-column-index":t,"data-feed-mutation-phase":r||void 0,"aria-busy":!!r||void 0,"aria-hidden":"exiting"===r||void 0,..."exiting"===r?{inert:""}:{},className:W("echo-feed-positioned-card absolute left-0 w-full [overflow-anchor:none] transition-[opacity,transform] duration-150 ease-out motion-reduce:transition-none","exiting"===r&&"pointer-events-none scale-[0.985] opacity-0"),style:{top:`${e.offsetTop}px`},children:n.jsx("div",{ref:oe(e.value.id),className:"echo-feed-card-entrance",children:n.jsx(B,{memory:e.value,index:e.index,disableBrowserCulling:!0,onDelete:!a||i&&!i(e.value)?void 0:a,deleteActionLabel:"function"==typeof l?l(e.value):l,deleteActionKind:"function"==typeof s?s(e.value):s,isSelected:u?u(e.value.id):void 0,isSelectionMode:c,onSelect:d,isReadOnly:m,onClick:f,onLike:h,onHeartClick:p,heartDisabled:w,priority:e.index<S,viewRef:v?v(e.value.id):void 0,showAuthorAttribution:g,showHeartCountBadge:x,showExploreMatchChips:b,onNotInterested:y,onMemoryNotInterested:_,onMemoryMoreLikeThis:M,onReportMemory:E,onMediaUnavailable:j,onExploreMatchFilterClick:I,onFederatedFollow:C,resolveExter
2nalMemoryId:T,isFederatedFollowing:R,feedSettings:L,echoPages:A.get(e.value.id),preferredBoardId:D,preferredBoardName:P,preferredBoardCanEdit:H,mutationSurfaceId:ne.surfaceId,mobileView:O,imageSizes:$,lightweight:z,showReactButtonSetting:q,hapticsDisabled:V,routePathname:Y,navigateTo:U,authUser:K,authProfile:Q,isOnline:G,slowNetwork:X,isMobile:J,activeMoodSetting:Z,themeState:ee,lowEnd:te,nativeMobile:re})})},e.value.id)})})}),Qe=r.lazy(()=>e(()=>import("./MemoryDetailModal-D2r559XQ.js").then(e=>e.a),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109])).then(e=>({default:e.MemoryDetailModal}))),Ge=r.lazy(()=>e(()=>import("./FloatingReaction-DtqzlswO.js"),__vite__mapDeps([110,2,7,111,71,18])).then(e=>({default:e.FloatingReaction}))),Xe=r.lazy(()=>e(()=>import("./FeedSettingsPopover-BKQfMI2G.js"),__vite__mapDeps([112,2,113,48,49,44,50,13,57,51,16,114,54,56,58,55,115,27,22,12,7,14,1,15,6,8,5,23,21,10,20,74,36,90,19,91,92,80,116,18,71,117,102])).then(e=>({default:e.FeedSettingsPopover}))),Je=r.lazy(()=>e(()=>import("./FeedSelectionActionBar-DCvod52J.js"),__vite__mapDeps([118,2,15,119,43,44,45,16,120,18,121,64,12,13,7,14,27,22,1,6,8,5,23,21,10,20,30,65,61,122,123,124,32,31,33,34,35,36,37,38,39,40,41,42,52,90,19,91,46,47,48,49,50,51,60,125,126,79,127,73,74,82,128,102,129,130,131,132,70,94,93,133,134,117,135,99])).then(e=>({default:e.FeedSelectionActionBar}))),Ze=({memory:e,onClose:t})=>{const r=e.image_url?ae(e.image_url,"medium"):null;return n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/15 p-0 backdrop-blur-md md:p-4","aria-label":"Opening echo","aria-busy":"true",children:n.jsxs("div",{className:"relative flex h-[100dvh] w-full max-w-[100vw] overflow-hidden bg-background/85 shadow-2xl backdrop-blur-2xl md:h-[90vh] md:max-w-7xl md:rounded-[2rem]",children:[n.jsx("button",{type:"button",onClick:t,className:"absolute left-5 top-5 z-20 flex h-11 w-11 items-center justify-center rounded-full bg-black/55 text-white shadow-lg backdrop-blur-md","aria-label":"Close echo",children:n.jsx(Ce,{className:"h-5 w-5"})}),n.jsx("div",{className:"relative flex min-w-0 flex-1 items-center justify-center overflow-hidden bg-black/20 md:w-[65%]",children:r?n.jsxs(n.Fragment,{children:[n.jsx("img",{src:r,alt:"","aria-hidden":"true",loading:"eager",decoding:"async",referrerPolicy:"no-referrer",className:"absolute inset-0 h-full w-full scale-110 object-cover opacity-35 blur-3xl saturate-150"}),n.jsx("img",{src:r,alt:e.title||"Echo",loading:"eager",decoding:"async",referrerPolicy:"no-referrer",className:"relative z-10 max-h-full max-w-full object-contain md:rounded-2xl md:shadow-2xl"})]}):n.jsx("div",{className:"h-2/3 w-2/3 animate-pulse rounded-[2rem] bg-white/10"})}),n.jsxs("div",{className:"hidden w-[35%] flex-col gap-6 bg-background/80 p-8 backdrop-blur-2xl md:flex",children:[n.jsx("div",{className:"h-12 w-3/4 animate-pulse rounded-2xl bg-muted/60"}),n.jsx("div",{className:"h-5 w-1/2 animate-pulse rounded-full bg-muted/45"}),n.jsx("div",{className:"mt-8 h-px w-full bg-border/60"}),n.jsx("div",{className:"h-5 w-28 animate-pulse rounded-full bg-muted/45"}),n.jsx("div",{className:"mt-auto h-14 w-full animate-pulse rounded-2xl bg-muted/60"})]})]})})},et=({memory:e,index:t})=>{const r=e.image_url?ae(e.image_url,"thumbnail")||e.image_url:null,o=e.title||`Selected Echo ${t+1}`;return n.jsx("div",{role:"listitem","aria-label":o,title:o,className:"relative h-14 w-14 shrink-0 overflow-hidden rounded-[12px] border-2 border-background bg-muted shadow-sm ring-1 ring-primary/20",children:r?n.jsx("img",{src:r,alt:"","aria-hidden":"true",loading:"eager",decoding:"async",referrerPolicy:"no-referrer",className:"h-full w-full object-cover"}):n.jsx("span",{className:"flex h-full w-full items-center justify-center text-[10px] font-black uppercase text-muted-foreground",children:(e.type||"E").slice(0,1)})})},tt=({memories:e,sourceCount:t})=>{const r=e.slice(0,6),o=Math.max(0,t-r.length);return n.jsxs("div",{className:"flex min-w-0 items-start gap-1.5",role:"list","aria-label":`${t.toLocaleStr
2ing()} selected similarity source${1===t?"":"s"}`,"data-similarity-source-thumbnails":!0,children:[r.map((e,t)=>n.jsx(et,{memory:e,index:t},e.id)),o>0?n.jsxs("span",{role:"listitem","aria-label":`${o.toLocaleString()} more selected echoes`,className:"relative flex h-14 w-14 shrink-0 items-center justify-center rounded-[12px] border-2 border-background bg-muted px-2 text-xs font-black tabular-nums text-muted-foreground shadow-sm ring-1 ring-primary/20",children:["+",o.toLocaleString()]}):null]})},rt=e=>e<768?2:Math.min(6,Math.max(1,Math.floor(e/244))),nt=new Map;let ot=null;const at=()=>{null===ot&&(ot=setTimeout(()=>{ot=null;const e=Array.from(nt.entries()).slice(0,80);e.forEach(([e])=>nt.delete(e)),(async e=>{let{data:t,error:r}=await Y.from("memory_notes").select("id, memory_id, content, created_at, metadata").in("memory_id",e).is("parent_note_id",null).order("created_at",{ascending:!0});if(r&&("PGRST204"===r.code||"42703"===r.code||String(r.message||"").toLowerCase().includes("metadata"))){const n=await Y.from("memory_notes").select("id, memory_id, content, created_at").in("memory_id",e).is("parent_note_id",null).order("created_at",{ascending:!0});t=n.data,r=n.error}if(r)throw r;const n=new Map;(t||[]).forEach(e=>{if(!e.memory_id)return;const t=n.get(e.memory_id);t?t.push(e):n.set(e.memory_id,[e])});const o=new Map;return e.forEach(e=>{o.set(e,re(n.get(e)||[]))}),o})(e.map(([e])=>e)).then(t=>{e.forEach(([e,r])=>{const n=t.get(e)||[];r.forEach(({resolve:e})=>e(n))})}).catch(t=>{e.forEach(([,e])=>{e.forEach(({reject:e})=>e(t))})}).finally(()=>{nt.size>0&&at()})},0))},it=(e,t)=>(null==e?void 0:e.itemsById.get(t))??null,lt=r.memo(r.forwardRef(({memories:c,searchQuery:N,isLoading:k,hasInitiallyLoaded:B=!0,showEmptyState:re=!0,feedError:ae,loadAttempts:Ce=0,onRetry:Se,onDelete:Ne,canDeleteMemory:ke,deleteActionLabel:De,deleteActionKind:Pe,onUpdateMemory:Oe,onLike:$e,processingCount:et=0,onLoadMore:ot,onLoadPrevious:lt,hasMore:ut=!1,hasPrevious:ct=!1,isLoadingMore:dt=!1,loadingMoreIndicatorDelayMs:mt=0,isLoadingPrevious:ft=!1,loadMoreError:ht,isSelected:pt,onSelect:wt,isSelectionMode:vt,isReadOnly:gt,onMemoryClick:xt,columnsOverride:bt,gapOverride:yt,showFeedSettingsTrigger:_t=!0,showPaginationFooter:Mt=!0,forceInfiniteScroll:Et=!1,applyAiContentPreference:jt=!1,aiContentPreferenceAlreadyApplied:It=!1,applyOwnEchoExplorePreference:Ct=!1,waitForScrollBeforeAutoLoadMore:Tt=!1,allowGlobalRefreshEvents:Rt=!0,hydrateOnOpen:St="missing",showAuthorAttribution:Nt=!1,showHeartCountBadge:kt=!1,showExploreMatchChips:Lt=!1,onNotInterested:At,onMemoryNotInterested:Bt,onMemoryMoreLikeThis:Ft,onReportMemory:Dt,onMemoryMediaUnavailable:Pt,onExploreMatchFilterClick:Ht,onFederatedFollow:Ot,resolveExternalMemoryId:$t,isFederatedFollowing:zt,scrollContainerRef:qt,columnPlacement:Vt="balanced",virtualizeCards:Yt=!0,preferredBoardId:Ut,preferredBoardName:Wt,preferredBoardCanEdit:Kt=!1,boardShareToken:Qt,boardContextViewConfig:Gt,mutationSurfaceId:Xt,performanceSurface:Jt,onSimilarityModeChange:Zt,className:er,...tr},rr)=>{var nr,or,ar,ir,lr,sr,ur,cr,dr,mr,fr;const[hr,pr]=t.useState(null),[wr,vr]=t.useState(()=>new Set),[gr,xr]=t.useState(null),[br,yr]=t.useState([]),[_r,Mr]=t.useState(!1),Er=t.useRef(!1),jr=t.useRef(!1),Ir=t.useRef(!0),Cr=r.useRef(null),Tr=r.useRef(null),Rr=r.useRef(null),Sr=r.useRef(0),Nr=t.useRef(null),kr=t.useRef(new Map),Lr=t.useRef(new Map),Ar=t.useRef(new Map),Br=t.useRef(new Map),Fr=t.useRef(null),Dr=t.useRef(new Map),Pr=t.useRef(new Map),Hr=t.useRef(new Map),Or=t.useRef(new Set),$r=t.useRef(null),zr=t.useRef(null),qr=t.useRef(null),Vr=t.useRef(null),Yr=t.useRef(null),Ur=t.useRef(null),Wr=t.useRef(null),Kr=t.useRef(null),Qr=t.useRef(0),Gr=t.useRef(0),Xr=t.useRef(null),Jr=t.useRef(0),Zr=t.useRef(void 0),en=t.useRef([]),tn=t.useRef([]),rn=t.useRef(0),nn=t.useRef(0),on=t.useRef(null),an=t.useRef(new Set),ln=t.useRef(null);t.useRef(!1);const sn=t.useRef(null),un=t.useRef(null),cn=t.useRef(0),dn=t.useRef(null),mn=t.useRef(!1),fn=t.useRef(!1),hn=t.useRef(null),pn=t.useRef(null),wn=t.useRef(dt),vn=t.useRef(!1),gn=t.useRef(0),xn=t.useRef(0),bn=t.useRef(null),yn=t.useRef(!1),_n=t.useRef(null),Mn=t.useRef(0),En=t.useRef(()=>{}),jn=xe(),In=T(),Cn=r.useMemo(()=>({boardId:Ut||null,surfaceId:Xt||null}),[Xt,Ut]),Tn=d(qt,`memory-feed:${jn.pathname}`),Rn=t.useRef(Tn);Rn.current=Tn;const Sn=be(),{user:Nn,profile:kn}=Z(),Ln="function"==typeof wt||"function"==typeof pt||"boolean"==typeof vt,An=Boolean(Nn)&&!Ln,Bn=ve(Boolean(null==kn?void 0:kn.is_admin)),Fn=$({queryKey:["feed-balanced-similarity","v2",gr],initialPageParam:null,queryFn:({pageParam:e})=>ge({resource:"echoes",mode:"public",query:"",similarToIds:gr||[],cursor:"string"==typeof e?e:void 0,limit:30},{viewerIsInternal:Boolean(null==kn?void 0:kn.is_admin)}),getNextPageParam:e=>e.nextCursor||void 0,enabled:Boolean((null==gr?void 0:gr.length)&&Bn),staleTime:6e4}),Dn=r.useMemo(()=>{var e;const t=new Set;return((null==(e=Fn.data)?void 0:e.pages)||[]).flatMap(e=>e.hits).filter(e=>!(!U(e)||t.has(e.id)||(t.add(e.id),0)))},[null==(nr=Fn.data)?void 0:nr.pages]),Pn=r.useMemo(()=>c.filter(U),[c]),Hn=r.useMemo(()=>Pn.filter(e=>!R(e.id,Cn)),[In,Cn,Pn]),On=r.useMemo(()=>Dn.filter(e=>!R(e.id,Cn)),[In,Cn,Dn]),$n=Boolean(gr&&Dn.length>0),zn=gr?On:Hn,qn=`${zn.length}:${(null==(or=zn[0])?void 0:or.id)||""}:${(null==(ar=zn[zn.length-1])?void 0:ar.id)||""}`,Vn=gr?Fn.isLoading:k,Yn=Fn.fetchNextPage,Un=r.useMemo(()=>gr?()=>Yn().then(()=>{}):ot,[Yn,gr,ot]),Wn=gr?Boolean(Fn.hasNextPage):ut,Kn=gr?Fn.isFetchingNextPage:dt,[Qn,Gn]=t.useState(()=>Kn&&mt<=0);t.useEffect(()=>{if(!Kn)return void Gn(!1);if(mt<=0)return void Gn(!0);const e=window.setTimeout(()=>{Gn(!0)},mt);return()=>window.clearTimeout(e)},[Kn,mt]);const Xn=gr?void 0:lt,Jn=!gr&&ct,Zn=!gr&&ft,eo=Ln?vt:wr.size>0,to=t.useCallback(e=>wr.has(e),[wr]),ro=t.useCallback(e=>{vr(t=>{const r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),no=Ln?pt:to,oo=Ln?wt:An?ro:void 0,ao=r.useMemo(()=>
2{if(0===wr.size)return[];const e=new Map([...Pn,...zn].map(e=>[e.id,e]));return[...wr].map(t=>e.get(t)).filter(e=>Boolean(e))},[wr,zn,Pn]),io=r.useMemo(()=>{if(!gr)return[];const e=new Map([...Pn,...br.filter(U)].map(e=>[e.id,e]));return gr.map(t=>e.get(t)).filter(e=>void 0!==e)},[gr,br,Pn]),lo=t.useCallback(()=>{xr(null),yr([]),null==Zt||Zt(!1)},[Zt]),so=te(Boolean($e&&(null==Nn?void 0:Nn.id))),{isOnline:uo,isSlow:co}=K(),mo=z(),fo=t.useRef(null),{settings:ho,isReady:po,error:wo,refreshSettings:vo}=ee(),{activeMood:go}=G(),xo=X(),{lowEnd:bo,nativeMobile:yo,tier:_o}=J(),[Mo,Eo]=t.useState(()=>!Tt),jo=t.useRef(!Tt),Io=t.useCallback(()=>{var e,t,r;const n=null==(e=Rr.current)?void 0:e.getBoundingClientRect().bottom;return void 0!==n&&((e,t,r=64)=>Number.isFinite(e)&&Number.isFinite(t)&&e<=t+Math.max(0,r))(n,(null==(t=null==qt?void 0:qt.current)?void 0:t.getBoundingClientRect().bottom)??(null==(r=window.visualViewport)?void 0:r.height)??window.innerHeight)},[qt]),[Co,To]=t.useState(0),[Ro,So]=t.useState(20),[No,ko]=t.useState(0),[Lo,Ao]=t.useState(!1),[Bo,Fo]=t.useState(null),[Do,Po]=t.useState(!1),Ho=Boolean($e&&void 0!==so.data&&so.data.remaining<=0);t.useEffect(()=>{if(!("/explore"!==jn.pathname||co||bo||yo))return ue(()=>{e(()=>import("./MemoryDetailModal-D2r559XQ.js").then(e=>e.a),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109])).catch(()=>{})},1200)},[co,jn.pathname,bo,yo]),t.useEffect(()=>{$e?so.data&&(fo.current=so.data.remaining):fo.current=null},[so.data,$e]);const Oo=t.useCallback((e=!1)=>{const t=Date.now()-rn.current;if(function(e,t,r){return!(!e||"idle"!==t)&&!!Number.isFinite(r)&&r>=Math.max(0,360)}(e,Rn.current.phase,t)){if(null!==Vr.current&&(window.clearTimeout(Vr.current),Vr.current=null),null!==qr.current)return;return void(qr.current=window.requestAnimationFrame(()=>{qr.current=null,ko(e=>e+1)}))}if(null!==Vr.current||null!==qr.current)return;const r=()=>{Vr.current=null;const e=Date.now()-rn.current;"idle"!==Rn.current.phase||e<Ve?Vr.current=window.setTimeout(r,"idle"===Rn.current.phase?Math.max(60,Ve-e):120):qr.current=window.requestAnimationFrame(()=>{qr.current=null,ko(e=>e+1)})};r()},[]),$o=t.useRef(null),zo=t.useCallback((e=!1)=>{if(!Un)return Promise.resolve();if(hn.current)return hn.current;const t=Date.now();if(!e&&t<cn.current)return Promise.resolve();cn.current=t+450;const r=Promise.resolve().then(Un).finally(()=>{hn.current===r&&(hn.current=null)});return hn.current=r,r},[Un]);t.useEffect(()=>{const e=wn.current;wn.current=Kn,e&&!Kn&&(cn.current=Math.max(cn.current,Date.now()+900))},[Kn]);const qo=t.useCallback(()=>{const e=null==qt?void 0:qt.current;if(e){const t=e.getBoundingClientRect();return{scrollContainer:e,rootTop:t.top,rootBottom:t.bottom,scrollTop:e.scrollTop}}return{scrollContainer:null,rootTop:0,rootBottom:window.innerHeight,scrollTop:window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0}},[qt]),Vo=t.useCallback((e=Date.now())=>{const t=Xr.current,r=Be(t,e);return t&&!r&&(Xr.current=null),Qr.current>=e||r},[]),Yo=t.useCallback((e,t)=>{var r,n,o;if("undefined"==typeof window)return;null!==Ur.current&&(window.clearTimeout(Ur.current),Ur.current=null);const a=Dr.current,i=new Map(a);if(0===i.size&&(null==(r=Rr.current)||r.querySelectorAll("[data-feed-item-id]").forEach(e=>{const t=e.dataset.feedItemId;t&&i.set(t,e)})),0===i.size)return;const l=void 0!==t,s=new Set(t||[]),u=qo(),c=Vo();if(u.scrollTop<=2&&!l&&!c)return void(Yr.current=null);const d=u.rootTop+(u.scrollContainer?8:80),m=u.rootBottom-8,f=e?i.get(e):null,h=[],p=new Set,w=(e,t)=>{if(s.has(e))return;if(p.has(e))return;const r=t.getBoundingClientRect();r.bottom<=d||r.top>=m||(p.add(e),h.push({id:e,node:t,distance:Math.abs(r.top-d),top:r.top}))};if(f&&w(e,f),0===h.length&&!l){const e=null==(n=Yr.current)?void 0:n.memoryId,t=e?i.get(e):null;e&&t&&w(e,t)}
2if(0===h.length&&l&&i.forEach((e,t)=>w(t,e)),0===h.length&&"function"==typeof document.elementsFromPoint){const e=null==(o=Rr.current)?void 0:o.getBoundingClientRect(),t=Math.max(0,(null==e?void 0:e.left)??0),r=Math.min(window.innerWidth,(null==e?void 0:e.right)??window.innerWidth),n=Math.max(d,(null==e?void 0:e.top)??d)+8;if(r>t&&n<m){const e=[.12,.5,.88].map(e=>t+(r-t)*e);[n,Math.min(m-1,n+48)].forEach(t=>{e.forEach(e=>{const r=document.elementsFromPoint(e,t).find(e=>e instanceof HTMLElement&&Boolean(e.closest("[data-memory-measure-id]"))),n=r instanceof HTMLElement?r.closest("[data-memory-measure-id]"):null,o=null==n?void 0:n.dataset.memoryMeasureId;n&&o&&i.get(o)===n&&w(o,n)})})}}let v;if(0===h.length&&a.forEach((e,t)=>{w(t,e)}),0===h.length&&i.forEach((e,t)=>w(t,e)),h.forEach(e=>{(!v||e.distance<v.distance)&&(v=e)}),!v)return;const g=Zr.current,x=it(g,v.id);Yr.current={memoryId:v.id,top:v.top,viewportOffsetTop:v.top-u.rootTop,scrollTop:u.scrollTop,capturedAt:Date.now(),layoutSignature:(null==g?void 0:g.signature)||null,layoutOffsetTop:(null==x?void 0:x.offsetTop)??null}},[qo,Vo]),Uo=t.useCallback(()=>{var e;const t=Yr.current;if(!t)return;const r=Date.now(),n=Vo(r),o=Gr.current>=r,a=n||o;if(!a&&r-t.capturedAt>8e3)return void(Yr.current=null);const i=qo(),l=Math.abs(i.scrollTop-t.scrollTop)>2,s=r-rn.current,u=xn.current>=r;if(s<Ve&&!(u&&s>=120))return!a&&l&&(Yr.current=null),void(a&&null===Ur.current&&(Ur.current=window.setTimeout(()=>{Ur.current=null,!Vo()&&Gr.current<Date.now()||Uo()},Math.max(16,(u?120:Ve)-s))));if(!a&&l)return void(Yr.current=null);const c=Dr.current.get(t.memoryId),d=(null==c?void 0:c.isConnected)?c:Array.from((null==(e=Rr.current)?void 0:e.querySelectorAll("[data-feed-item-id]"))||[]).find(e=>e.dataset.feedItemId===t.memoryId&&e.isConnected),m=Zr.current,f=it(m,t.memoryId),h=Boolean(m&&f&&t.layoutSignature&&(t.layoutSignature===m.signature||a)&&null!==t.layoutOffsetTop),p=d?d.getBoundingClientRect().top-t.top:h?f.offsetTop-t.layoutOffsetTop:0;if(Math.abs(p)<1)return f&&(Yr.current={...t,scrollTop:i.scrollTop,capturedAt:Date.now(),layoutSignature:(null==m?void 0:m.signature)||t.layoutSignature,layoutOffsetTop:f.offsetTop}),void(a&&null===Ur.current&&(Ur.current=window.setTimeout(()=>{Ur.current=null,Uo()},40)));const w=Math.max(0,i.scrollTop+p);Jr.current=Date.now()+120,i.scrollContainer?i.scrollContainer.scrollTop=w:window.scrollTo({top:w,behavior:"instant"}),Yr.current={...t,scrollTop:w,capturedAt:Date.now(),layoutSignature:(null==m?void 0:m.signature)||t.layoutSignature,layoutOffsetTop:(null==f?void 0:f.offsetTop)??t.layoutOffsetTop};let v=50,g=qo().scrollTop;const x=()=>{v-=1;const e=v>0?40:160;Ur.current=window.setTimeout(b,e)},b=()=>{var e;Ur.current=null;const r=Yr.current;if(!r||r.memoryId!==t.memoryId)return;const n=qo();if(!(Gr.current>=Date.now()||Vo()))return;const o=Array.from((null==(e=Rr.current)?void 0:e.querySelectorAll("[data-feed-item-id]"))||[]).find(e=>e.dataset.feedItemId===t.memoryId&&e.isConnected);if(!o)return void x();const a=o.getBoundingClientRect().top-t.top;if(Math.abs(a)>=1){const e=Math.max(0,n.scrollTop+a);Jr.current=Date.now()+120,n.scrollContainer?n.scrollContainer.scrollTop=e:window.scrollTo({top:e,behavior:"instant"}),g=qo().scrollTop,Yr.current={...r,scrollTop:g,capturedAt:Date.now()}}x()};null!==Ur.current&&window.clearTimeout(Ur.current),Ur.current=window.setTimeout(b,0)},[qo,Vo]),Wo=t.useCallback((e=!0)=>{if(!Xn||!Jn||Zn)return Promise.resolve();if(pn.current)return pn.current;const t=e?Ae():null;t&&(Xr.current=t,Qr.current=Date.now()+Ye,Yo());const r=Promise.resolve().then(Xn).finally(()=>{if(t){const e=Date.now(),r=Xr.current===t;Xr.current=Fe(Xr.current,t),r&&Be(t,e)?(Qr.current=Math.max(Qr.current,e+5e3),Yr.current&&(Yr.current={...Yr.current,capturedAt:e})):r&&Qr.current<e&&(Yr.current=null)}pn.current===r&&(pn.current=null)});return pn.current=r,r},[Yo,Jn,Zn,Xn]),Ko=t.useCallback(e=>({id:e.id,type:e.type,title:e.title,ai_title:e.ai_title||null,content:e.content,description:e.description,html_content:e.html_content||null,image_url:e.image_url,video_url:e.video_url||null,audio_url:e.audio_url||null,source_url:e.source_url,ai_description:e.ai_description,hearts:e.hearts||0,watch_count:e.watch_count||0,created_at:e.created_at,metadata:e.metadata||null,added_by:e.owner_id||e.added_by||e.user_id||null,owner_id:e.owner_id||e.user_id||e.added_by_id||e.added_by||null,user_id:e.user_id||e.owner_id||e.added_by_id||e.added_by||null,is_owner:Boolean(e.is_owner),can_edit:Boolean(e.can_edit),owner_username:e.owner_username||null,owner_full_name:e.owner_full_name||null,owner_avatar:e.owner_avatar||null,added_by_id:e.added_by_id||e.owner_id||e.user_id||e.added_by||null,added_by_username:e.owner_username||e.added_by_username||null,added_by_full_name:e.owner_full_name||e.added_by_full_name||null,added_by_avatar:e.owner_avatar||e.added_by_avatar||null,source_board_id:e.source_board_id||null,source_board_name:e.source_board_name||null,source_board_owner:e.source_board_owner||null,source_board_owner_id:e.source_board_owner_id||null,source_board_owner_full_name:e.source_board_owner_full_name||null,source_board_owner_avatar:e.source_board_owner_avatar||null,source_board_view_config:e.source_board_view_config||null,viewer_board_memberships:h(e.viewer_board_memberships),feed_rank:e.feed_rank||null}),[]),Qo=r.useMemo(()=>{const e=new Map;
2return zn.forEach(t=>{(null==t?void 0:t.id)&&e.set(t.id,t)}),e},[zn]),Go=r.useRef(Qo);r.useEffect(()=>{Go.current=Qo},[Qo]);const Xo=t.useCallback(e=>!!(e.source_board_owner||e.owner_username||e.added_by_username||e.user_id||e.added_by),[]),[Jo,Zo]=t.useState(()=>se()),ea=t.useRef(Jo);ea.current=Jo,t.useEffect(()=>{if(Jo.floatingReactions)return ue(()=>Ao(!0),250);Ao(!1)},[Jo.floatingReactions]);const ta=t.useCallback(()=>{null!==Kr.current&&(window.clearTimeout(Kr.current),Kr.current=null),null!==Wr.current&&(window.cancelAnimationFrame(Wr.current),Wr.current=null),Gr.current=Date.now()+3e4;const e=Yr.current;e?Yr.current={...e,capturedAt:Date.now()}:Yo()},[Yo]);t.useEffect(()=>he(()=>{const e=se(),t=ea.current;e.columns===t.columns&&e.gap===t.gap||ta(),ea.current=e,Zo(e)}),[ta]);const[ra,na]=t.useState(()=>"undefined"==typeof window?1:rt(window.innerWidth)),oa=t.useRef(ra);oa.current=ra,t.useEffect(()=>{const e=()=>{const e=rt(window.innerWidth);e!==oa.current&&(ta(),oa.current=e,na(e))};e();const t=me(()=>{rt(window.innerWidth)!==oa.current&&ta()}),r=fe(e);return()=>{t(),r()}},[ta]);const aa=2===ra,ia=aa,la="number"==typeof bt?bt:aa?null==bt?void 0:bt.mobile:null==bt?void 0:bt.desktop,sa=la?aa?Math.min(3,la):la:Jo.columns>0?aa?Math.min(3,Jo.columns):Jo.columns:ra,ua=void 0!==yt?yt:Jo.gap,ca=r.useMemo(()=>({paddingTop:`${ua}px`,paddingLeft:`${ua}px`,paddingRight:`${ua}px`,...tr.style||{}}),[ua,tr.style]),da="/explorefeed2"===jn.pathname,ma="/explore"===jn.pathname||da||"/explorefeed3"===jn.pathname,fa=ho.use_feed_pagination&&!Et,ha=[p(jn.state)||jn.pathname,N,fa?"paginated":"infinite",Jt||Cn.surfaceId||Cn.boardId||"feed",gr?`similar:${gr.join(",")}`:"source"].join("�"),pa=pe(),wa=we(),va=pa&&ia,ga=wa&&ia,xa=va||ga,ba=[jn.pathname,Jt||Xt||"memory-feed",Ut||"",(null==gr?void 0:gr.join(","))||""].join("|"),ya=He({rootRef:qt,scopeKey:ba,enabled:!yo}),_a="constrained"===_o,Ma=_a?ce.constrainedMobileInitial:va?ce.androidMobileInitial:ga?ce.iosMobileInitial:ia?ce.mobileInitial:ce.desktopInitial,Ea=_a?ce.constrainedMobileStep:va?ce.androidMobileStep:ga?ce.iosMobileStep:ia?ce.mobileStep:ce.desktopStep,ja=_a?9:12,Ia=(({virtualizeCards:e,useFeedPagination:t,isExploreFeed2Route:r,itemCount:n,initialLimit:o})=>e&&!t&&!r&&n>o)({virtualizeCards:Yt,useFeedPagination:fa,isExploreFeed2Route:da,itemCount:zn.length,initialLimit:Ma}),[Ca,Ta]=t.useState(Ma),Ra=!It&&(ma||null!==gr||jt),Sa=Ra&&po&&ho.hide_ai_content,Na=Ct&&ho.hide_own_echoes_in_explore,ka=r.useMemo(()=>Te(zn,Na,null==Nn?void 0:Nn.id),[zn,Na,null==Nn?void 0:Nn.id]),La=t.useRef({key:"",attempts:0,batch:""}),Aa=`${(null==Nn?void 0:Nn.id)||"anon"}:${jn.pathname}${jn.search}:${Na}:${N}:${(null==gr?void 0:gr.join(","))||"feed"}`;t.useEffect(()=>{var e,t;La.current.key!==Aa&&(La.current={key:Aa,attempts:0,batch:""});const r=La.current,n=`${zn.length}:${null==(e=zn[0])?void 0:e.id}:${null==(t=zn.at(-1))?void 0:t.id}`;r.batch!==n&&Un&&function({enabled:e,ready:t,hiddenCount:r,visibleCount:n,hasMore:o,busy:a,failed:i,attempts:l}){return e&&t&&r>0&&n<12&&o&&!a&&!i&&l<4}({enabled:Na,ready:po,hiddenCount:zn.length-ka.length,visibleCount:ka.length,hasMore:Wn,busy:Vn||Kn,failed:Boolean(ae||ht),attempts:r.attempts})&&(r.batch=n,r.attempts+=1,zo(!0).catch(()=>{}))},[Aa,Na,po,zn,ka.length,Un,Wn,Vn,Kn,ae,ht,zo]);const Ba=ie(ka,Sa,null==Nn?void 0:Nn.id,{preferenceReady:!Ra&&!Ct||po,preferenceError:Boolean(wo),refetchPreference:vo}),Fa=Ba.memories,Da=t.useRef(Fa);Da.current=Fa;const Pa=t.useRef(Symbol("memory-feed-collection-navigation")),Ha=t.useRef(!1),Oa=`${jn.pathname}${jn.search}${jn.hash}`,$a=r.useMemo(()=>w(Fa),[Fa]);t.useEffect(()=>{v({key:Oa,owner:Pa.current,echoIds:$a,hasMore:Boolean(Wn&&Un),hasPrevious:Boolean(Jn&&Xn),loadMore:Wn&&Un?()=>zo(!0):void 0,loadPrevious:Jn&&Xn?()=>Wo(!1):void 0})},[$a,Oa,Wn,Jn,Un,Xn,zo,Wo]),t.useEffect(()=>{const e=Pa.current;return()=>g(Oa,e)},[Oa]);const za=t.useCallback(async e=>{const t=null==hr?void 0:hr.id;if(!t||Ha.current)return!1;Ha.current=!0;try{const r=await x({key:Oa,currentEchoId:t,direction:e,knownEchoIds:$a});if(!r)return!1;const n=Da.current.find(e=>e.id===r.echoId);return!!n&&(Mr(!1),pr(n),!0)}finally{Ha.current=!1}},[$a,Oa,null==hr?void 0:hr.id]),qa=hr?$a.indexOf(hr.id):-1,Va=qa>0||Boolean(Jn&&Xn),Ya=qa>=0&&(qa<$a.length-1||Boolean(Wn&&Un)),Ua=r.useMemo(()=>Ia?Fa.slice(0,Ca):Fa,[Fa,Ca,Ia]),Wa=t.useRef({firstId:(null==(ir=Fa[0])?void 0:ir.id)||null,count:Fa.length}),Ka=(({shouldWindowLoadedFeed:e,renderedItemCount:t,policyVisibleLoadedItemCount:r,hasMore:n,canLoadMore:o})=>{const a=e&&t<r;return{hasUnrenderedLoadedItems:a,advance:a?"expand-window":n&&o?"load-more":"complete"}})({shouldWindowLoadedFeed:Ia,renderedItemCount:Ua.length,policyVisibleLoadedItemCount:Fa.length,hasMore:Wn,canLoadMore:Boolean(Un)}),Qa=Ka.hasUnrenderedLoadedItems,Ga=(Xa=Ua.length,Ja=Ro,Math.max(1,Math.ceil(Xa/Ja)));var Xa,Ja;const Za=(Co+1)*Ro,ei=(Co+2)*Ro,ti=fa&&(Ua.length>=ei||!Wn&&Ua.length>Za),ri=!vt&&fa&&Ua.length>0,ni=Ua.length>Co*Ro,oi=fa&&Wn&&!!Un&&ni,ai=fa&&(ti||oi),ii=fa&&(Co>0||Jn&&Boolean(Xn)),li=Do||Kn||Zn,si=r.useMemo(()=>((e,t,r,n)=>{if(!t)return e;const o=r*n;return e.slice(o,o+n)})(Ua,fa,Co,Ro),[Co,Ro,Ua,fa]),[ui,ci]=t.useState(()=>({top:0,height:"undefined"!=typeof window?window.innerHeight:900})),[di,mi]=t.useState(()=>((e,t,r)=>
2Math.max(160,(e-2*r-Math.max(0,t-1)*r)/Math.max(1,t)))("undefined"==typeof document?320:document.documentElement.clientWidth,sa,ua)),fi=t.useRef(0);r.useLayoutEffect(()=>{const e=Rr.current;if(!e)return;const t=t=>{const r=Math.max(160,((t??e.clientWidth)-Math.max(0,sa-1)*ua)/Math.max(1,sa));mi(e=>Math.abs(e-r)>4?r:e)};return t(),"undefined"==typeof ResizeObserver?fe(t):qe(e,e=>{t(ze(e,"inline"))})},[sa,ua]),t.useEffect(()=>{let e=null,t=!0,r=null;const n=va?72:ga?64:ia?180:192,a=null==qt?void 0:qt.current,i=()=>{if(e=null,!t)return;const r=Rr.current;if(!r)return;const o=r.getBoundingClientRect(),i=null==a?void 0:a.getBoundingClientRect(),l=window.visualViewport,s=(null==i?void 0:i.top)??(null==l?void 0:l.offsetTop)??0,u=(null==i?void 0:i.height)??(null==l?void 0:l.height)??window.innerHeight,c={top:s-o.top,height:u};ci(e=>Math.abs(e.top-c.top)>n||Math.abs(e.height-c.height)>32?c:e)},l=(t=!1)=>{const l=window.scrollY+(a?a.scrollTop:0),s=!t&&(va||ga)&&null!==r&&Math.abs(l-r)>=((null==a?void 0:a.clientHeight)||window.innerHeight);if(Re(r,l,n,t)){if(r=l,s)return null!==e&&window.cancelAnimationFrame(e),e=null,void o.flushSync(i);null===e&&(e=window.requestAnimationFrame(i))}},s=()=>l(!1),u=()=>l(!0),c=(a?[a,window]:[window]).map(e=>de(e,s)),d=fe(u),m=new Set,f=()=>{va||ga?(null!==e&&window.cancelAnimationFrame(e),e=null,o.flushSync(i)):l(!0)},h=(e=!1)=>{"visible"===document.visibilityState&&H()&&(m.forEach(e=>window.clearTimeout(e)),m.clear(),e?f():l(!0),[80,280].forEach(e=>{const t=window.setTimeout(()=>{m.delete(t),f()},e);m.add(t)}))},p=O(()=>h(!0)),w=P(e=>{e&&h(!0)}),v=window.visualViewport;return null==v||v.addEventListener("resize",u,{passive:!0}),null==v||v.addEventListener("scroll",s,{passive:!0}),h(),()=>{t=!1,null!==e&&(window.cancelAnimationFrame(e),e=null),c.forEach(e=>e()),d(),p(),w(),null==v||v.removeEventListener("resize",u),null==v||v.removeEventListener("scroll",s),m.forEach(e=>window.clearTimeout(e)),m.clear()}},[va,ga,ia,qt]),r.useEffect(()=>{const e=e=>{var t;const r=e.detail;(null==r?void 0:r.scope)&&!S(r.scope,Cn)||(null==(t=null==r?void 0:r.excludeMemoryIds)?void 0:t.length)&&!r.excludeMemoryIds.some(e=>Go.current.has(e))||(Qr.current=Date.now()+Ye,Yo((null==r?void 0:r.memoryId)||null,null==r?void 0:r.excludeMemoryIds))};return window.addEventListener("echo-feed-preserve-scroll",e),()=>{window.removeEventListener("echo-feed-preserve-scroll",e)}},[Yo,Cn]),r.useEffect(()=>{if(fa||!Jn||!Xn)return nn.current=0,void(on.current=null);const e=null==qt?void 0:qt.current,t=()=>window.scrollY+(e?e.scrollTop:0);on.current=t();const r=()=>{const e=t(),r=on.current;on.current=e,Date.now()<=Jr.current||null!==r&&e<r-4&&(nn.current=Date.now())},n=(e?[e,window]:[window]).map(e=>de(e,r));return()=>n.forEach(e=>e())},[Jn,Xn,qt,fa]),r.useEffect(()=>{if(fa||!Jn||!Xn)return;const e=Tr.current;if(!e)return;const t=new IntersectionObserver(e=>{var t;L({isIntersecting:Boolean(null==(t=e[0])?void 0:t.isIntersecting),hasPrevious:Jn,isLoadingPrevious:Zn,lastUpwardScrollAt:nn.current,programmaticScrollUntil:Jr.current})&&(nn.current=0,Wo(!0).catch(()=>{}))},{root:(null==qt?void 0:qt.current)||null,threshold:0,rootMargin:"1200px 0px 0px 0px"});return t.observe(e),()=>t.disconnect()},[Jn,Zn,Xn,qt,Wo,fa]),r.useEffect(()=>{const e=null==qt?void 0:qt.current,t=e?[e,window]:[window],r=e=>{rn.current=Date.now(),Jr.current=0,Yr.current=null,Xr.current=null,_n.current=null,Qr.current=0,Gr.current=0,xn.current=0,null!==Ur.current&&(window.clearTimeout(Ur.current),Ur.current=null)};return t.forEach(e=>{e.addEventListener("wheel",r,{passive:!0}),e.addEventListener("touchstart",r,{passive:!0}),e.addEventListener("pointerdown",r,{passive:!0})}),window.addEventListener("keydown",r),()=>{t.forEach(e=>{e.removeEventListener("wheel",r),e.removeEventListener("touchstart",r),e.removeEventListener("pointerdown",r)}),window.removeEventListener("keydown",r)}},[qt]),r.useEffect(()=>{const e=null==qt?void 0:qt.current,t=e?[e,window]:[window],r=()=>{rn.current=Date.now();const e=Yr.current;if(e&&!Vo()&&Gr.current<Date.now()){const t=qo(),r=t.scrollTop-e.scrollTop;Math.abs(r)>.5&&(Yr.current={...e,top:e.top-r,viewportOffsetTop:e.viewportOffsetTop-r,scrollTop:t.scrollTop,capturedAt:Date.now()})}null!==Wr.current&&(window.cancelAnimationFrame(Wr.current),Wr.current=null),null!==Kr.current&&window.clearTimeout(Kr.current);const t=()=>{Kr.current=null;const e=Date.now();if(Gr.current>=e)return void(Kr.current=window.setTimeout(t,Math.max(32,Gr.current-e+16)));if(Vo(e))return;if(e-fi.current<(ia?300:150))return;const r=Yr.current,n=r?Dr.current.get(r.memoryId):null;if(null==n?void 0:n.isConnected){const t=qo(),r=n.getBoundingClientRect();if(r.bottom>t.rootTop&&r.top<t.rootBottom)return void(fi.current=e)}fi.current=e,Wr.current=window.requestAnimationFrame(()=>{Wr.current=null,Yo()})};Kr.current=window.setTimeout(t,ia?320:180)};Yr.current||r();const n=t.map(e=>de(e,r));return()=>
2{n.forEach(e=>e()),null!==Kr.current&&(window.clearTimeout(Kr.current),Kr.current=null),null!==Wr.current&&(window.cancelAnimationFrame(Wr.current),Wr.current=null)}},[Yo,qo,Vo,ia,qt]),t.useEffect(()=>{gn.current+=1,vn.current=!1,yn.current=!1,_n.current=null,Xr.current=null,hn.current=null,pn.current=null,Qr.current=0,xn.current=0,Mn.current=0,cn.current=0,dn.current=null,mn.current=!1,fn.current=!1,null!==bn.current&&(window.clearTimeout(bn.current),bn.current=null),Yr.current=null,Gr.current=0,jo.current=!Tt,Eo(!Tt),Ta(Ma),To(0),So(20),Fo(null),Po(!1),$o.current&&(window.clearTimeout($o.current),$o.current=null)},[ha,Tt]),t.useEffect(()=>{var e;const t={firstId:(null==(e=Fa[0])?void 0:e.id)||null,count:Fa.length},n=Wa.current;Wa.current=t;const o=t.firstId===n.firstId?Math.max(0,t.count-n.count):0;r.startTransition(()=>{Ta(e=>{const r=Math.max(Ma,Math.min(e,t.count));return Ia&&0!==o?Math.min(t.count,r+o):r})})},[Fa,Ma,Ia]),t.useEffect(()=>{"idle"===Tn.phase&&yn.current&&En.current("scroll-idle")},[Tn.phase]),t.useEffect(()=>()=>{$o.current&&window.clearTimeout($o.current),bn.current&&window.clearTimeout(bn.current),null!==Ur.current&&(window.clearTimeout(Ur.current),Ur.current=null)},[]);const hi=t.useCallback(()=>{rn.current=Date.now(),Yr.current=null,null!==Kr.current&&(window.clearTimeout(Kr.current),Kr.current=null),null!==Wr.current&&(window.cancelAnimationFrame(Wr.current),Wr.current=null);const e=null==qt?void 0:qt.current;e?e.scrollTo({top:0,left:0,behavior:"auto"}):(window.scrollTo({top:0,left:0,behavior:"auto"}),document.documentElement.scrollTop=0,document.body.scrollTop=0)},[qt]);r.useLayoutEffect(()=>{if(!$n)return;Zr.current=void 0,en.current=[],tn.current=[];const e=window.requestAnimationFrame(()=>{const e=Rr.current;if(!e)return;const t=null==qt?void 0:qt.current,r=null==t?void 0:t.getBoundingClientRect();ci({top:((null==r?void 0:r.top)??0)-e.getBoundingClientRect().top,height:(null==r?void 0:r.height)??window.innerHeight})});return()=>window.cancelAnimationFrame(e)},[$n,gr,qt]),t.useEffect(()=>{if(!Rt)return;const e=e=>{var t;const r=e.detail;(null==r?void 0:r.surfaceId)&&r.surfaceId!==Cn.surfaceId||(null==(t=Rr.current)?void 0:t.closest('[aria-hidden="true"]'))||hi()};return window.addEventListener("echo-feed-explicit-refresh",e),()=>{window.removeEventListener("echo-feed-explicit-refresh",e)}},[Rt,Cn.surfaceId,hi]),t.useEffect(()=>{Bo||To(e=>Math.min(e,Ga-1))},[Ua.length,Bo,Ga]),r.useLayoutEffect(()=>{const e=Vo(),t=Gr.current>=Date.now();e||t?Uo():!ia&&Date.now()-rn.current>=180&&Yo()},[Yo,sa,ua,qn,Co,Vo,ia,No,Ca,Uo]);const pi=t.useCallback(()=>{var e;const t=null==(e=Rr.current)?void 0:e.getBoundingClientRect().top;if("number"!=typeof t)return;const r=Math.max(0,window.scrollY+t-96);window.scrollTo({top:r,behavior:"smooth"})},[]),wi=t.useCallback(()=>(Po(!0),zo(!0).catch(()=>{}).finally(()=>{Po(!1)})),[zo]),vi=t.useCallback(()=>{if(Co>0)return To(e=>Math.max(0,e-1)),void pi();Jn&&Xn&&!li&&(Yr.current=null,Wo(!1).then(pi).catch(()=>{}))},[Co,Jn,li,Xn,pi,Wo]),gi=t.useCallback(()=>{if(ti)return To(e=>e+1),void pi();oi&&!li&&(Fo({targetIndex:Co+1,sourceItemCountBeforeRequest:zn.length,followupRequestCount:0}),$o.current&&window.clearTimeout($o.current),$o.current=window.setTimeout(()=>{Fo(null),Po(!1),$o.current=null},12e3),wi())},[oi,Co,ti,li,zn.length,wi,pi]);t.useEffect(()=>{if(!Bo)return;const e=(({targetIndex:e,pageSize:t,visibleItemCount:r,sourceItemCount:n,sourceItemCountBeforeRequest:o,hasMore:a,canLoadMore:i,isBusy:l,followupRequestCount:s,maxFollowupRequests:u})=>{const c=Math.max(1,Math.floor(t)),d=Math.max(0,Math.floor(e))*c;return r>=d+c||!a&&r>d?"show-page":l?"wait":n>o&&a&&i&&s<u?"load-more":"stop"})({targetIndex:Bo.targetIndex,pageSize:Ro,visibleItemCount:Ua.length,sourceItemCount:zn.length,sourceItemCountBeforeRequest:Bo.sourceItemCountBeforeRequest,hasMore:Wn,canLoadMore:Boolean(Un),isBusy:li,followupRequestCount:Bo.followupRequestCount,maxFollowupRequests:8});return"show-page"===e?(Fo(null),$o.current&&(window.clearTimeout($o.current),$o.current=null),To(Bo.targetIndex),void pi()):"load-more"===e?(Fo({...Bo,sourceItemCountBeforeRequest:zn.length,followupRequestCount:Bo.followupRequestCount+1}),void wi()):void("stop"===e&&(Fo(null),$o.current&&(window.clearTimeout($o.current),$o.
2current=null)))},[Ro,Wn,li,Ua.length,zn.length,Un,Bo,wi,pi]);const xi=r.useMemo(()=>{const e=[sa,Math.round(4*di)/4,ma?1:0,Nt?1:0].join("|");Fr.current!==e&&(Br.current.clear(),Fr.current=e);const t=[jn.pathname,N,sa,ua,Vt,Nt?1:0].join("|"),r=function({items:e,columnCount:t,gap:r,placement:n,signature:o,measuredHeights:a,previous:i,getId:l,getPlacementHeight:s}){const u=Math.max(1,Math.floor(t)),c=Math.max(0,r),d=Boolean(i&&i.signature===o&&i.columnCount===u),m=d?i.assignments:new Map,f=d?i.itemsById:void 0,h=new Map,p=new Map,w=Array.from({length:u},()=>0),v=Array.from({length:u},()=>[]),g=new Set;e.forEach((e,t)=>{const r=l(e);if(!r||g.has(r))return;g.add(r);const o=Math.max(1,s(e)),i=null==a?void 0:a.get(r),d=Math.max(1,i??o),f=m.get(r);let h="number"==typeof f&&f>=0&&f<u?f:-1;if(h<0)if("sequential"===n)h=t%u;else{h=0;for(let e=1;e<w.length;e+=1)w[e]<w[h]&&(h=e)}p.set(r,h),v[h].push({id:r,value:e,index:t,placementHeight:o,estimatedHeight:d}),w[h]+=o+c});const x=v.map((e,t)=>{let r=0;return{items:e.map(e=>{const n=null==f?void 0:f.get(e.id),o=Boolean(n&&n.value===e.value&&n.index===e.index&&n.columnIndex===t&&n.offsetTop===r&&n.estimatedHeight===e.estimatedHeight&&n.placementHeight===e.placementHeight)?n:{...e,columnIndex:t,offsetTop:r};return r+=e.estimatedHeight+c,h.set(e.id,o),o}),totalHeight:Math.max(0,r-c)}});return{signature:o,columnCount:u,assignments:p,itemsById:h,columns:x}}({items:[...si],columnCount:sa,gap:ua,placement:Vt,signature:t,measuredHeights:Br.current,previous:Zr.current,getId:e=>e.id,getPlacementHeight:e=>{var t;const r="fediverse"===(null==(t=e.metadata)?void 0:t.source)?112:ma||Nt?43+("/explore"===jn.pathname||"/explorefeed2"===jn.pathname?8:0):0;if("note"===e.type)return 284+r;if("pdf"===e.type||"docx"===e.type)return di/(3/4)+r;if("audio"===e.type)return di+r;if("voice"===e.type)return 284+r;if(("image"===e.type||"url"===e.type)&&!e.image_url)return 284+r;const n=(e=>"video"===e.type?F(e.metadata,"video"):"image"===e.type||"url"===e.type?F(e.metadata,"image"):D(e.metadata)??.8)(e),o=n>0?di/n:ce.estimatedCardHeightPx;return Math.max(1,Math.min(1200,o+r))}});return Zr.current=r,r.columns},[si,sa,Vt,di,ua,ma,jn.pathname,No,N,Nt]),bi=r.useMemo(()=>di>0?`${Math.ceil(di)}px`:"50vw",[di]),yi=r.useMemo(()=>{if(fa||!Yt){const e=xi.map(e=>({...e,visibleItems:e.items,topSpacer:0,bottomSpacer:0}));return en.current=[],tn.current=e,e}const e=tn.current,t=[],r=Gr.current>=Date.now()||Vo()?Yr.current:null,n=r?it(Zr.current,r.memoryId):null,o=r&&n?Math.max(0,n.offsetTop-r.viewportOffsetTop):ui.top,a=xi.map((e,r)=>{const n=en.current[r],a=Le({items:e.items,viewportTop:ui.top,viewportHeight:ui.height,totalHeight:e.totalHeight,motion:Tn,previous:null==n?void 0:n.window,maxItems:ja,getId:e=>e.value.id});let i=a;if(Math.abs(o-ui.top)>1){const t=Le({items:e.items,viewportTop:o,viewportHeight:ui.height,totalHeight:e.totalHeight,motion:Tn,maxItems:ja,getId:e=>e.value.id}),r=[...new Map([...a.visibleItems,...t.visibleItems].map(e=>[e.id,e])).values()].sort((e,t)=>e.offsetTop-t.offsetTop),n=r[0],l=r[r.length-1];i={...t,visibleItems:r,firstId:(null==n?void 0:n.id)??null,lastId:(null==l?void 0:l.id)??null,topSpacer:n?Math.max(0,n.offsetTop):0,bottomSpacer:l?Math.max(0,e.totalHeight-(l.offsetTop+l.estimatedHeight)):Math.max(0,e.totalHeight)}}if(n&&i===n.window)return t[r]=n,n.value;const l={...e,visibleItems:i.visibleItems,topSpacer:i.topSpacer,bottomSpacer:i.bottomSpacer};return t[r]={window:i,value:l},l});return en.current=t,e.length===a.length&&a.every((t,r)=>t===e[r])?e:(tn.current=a,a)},[xi,Tn,ui.height,ui.top,Vo,ja,fa,Yt]),_i=r.useMemo(()=>{const e=new Set;return yi.forEach(t=>{t.visibleItems.forEach(({value:t})=>{!t.id||"note"!==t.type&&"pdf"!==t.type&&"docx"!==t.type||e.add(t.id)})}),Array.from(e).sort()},[yi]),Mi=t.useRef(new Set);t.useEffect(()=>{Mi.current=new Set(_i)},[_i]);const Ei=r.useMemo(()=>_i.map(e=>({queryKey:["feed-memory-note-echo-pages",e],queryFn:()=>(e=>We.test(e)?new Promise((t,r)=>{const n=nt.get(e);n?n.push({resolve:t,reject:r}):nt.set(e,[{resolve:t,reject:r}]),at()}):Promise.resolve([]))(e),staleTime:12e4,gcTime:xa?12e4:6e5})),[_i,xa]),ji=t.useCallback(e=>{if(0===e.length)return Ue;const t=new Map;return e.forEach((e,r)=>{e.data&&t.set(_i[r],e.data)}),t},[_i]),Ii=q({queries:Ei,combine:ji});t.useEffect(()=>{const e=e=>{const t=e.detail;if(null==t?void 0:t.memoryId){if(!Mi.current.has(t.memoryId))return;mo.invalidateQueries({queryKey:["feed-memory-note-echo-pages",t.memoryId],exact:!0})}else mo.invalidateQueries({queryKey:["feed-memory-note-echo-pages"]})};return window.addEventListener("memory-note-added",e),window.addEventListener("memory-note-updated",e),window.addEventListener("memory-note-deleted",e),()=>{window.removeEventListener("memory-note-added",e),window.removeEventListener("memory-note-updated",e),window.removeEventListener("memory-note-deleted",e)}},[mo]),t.useEffect(()=>{},[sa,Ua.length,yi,si.length]);const Ci=r.useMemo(()=>yi.reduce((e,t)=>
2e+t.visibleItems.length,0),[yi]);t.useEffect(()=>{m("window",{renderer:`memory-feed:${jn.pathname}`,mounted:Ci,columns:sa,blank:si.length>0&&0===Ci})},[sa,jn.pathname,Ci,si.length]);const Ti=t.useCallback((e,t,r)=>{m("commit",{renderer:`memory-feed:${jn.pathname}`,phase:t,durationMs:r})},[jn.pathname]),Ri=r.useMemo(()=>xa?Math.min(3,Math.max(1,sa)):ma&&ia?Math.max(1,sa):ma?Math.min(6,Math.max(2,sa)):Math.min(8,Math.max(2,sa)),[sa,ma,ia,xa]),Si=r.useMemo(()=>ia&&sa>1?"grid":"single",[sa,ia]),Ni=ia||pa||_a||bo,ki=r.useMemo(()=>{const e=ma?Math.max(18,5*sa):Math.max(8,3*sa);return Array.from({length:sa},(t,r)=>Array.from({length:Math.ceil(e/sa)},(e,t)=>t*sa+r).filter(t=>t<e))},[sa,ma]),Li=t.useCallback(async e=>{if("/explore"===jn.pathname&&e.source_board_id&&window.dispatchEvent(new CustomEvent("echoExploreOpened",{detail:{memoryId:e.id,boardId:e.source_board_id}})),xt)xt(e);else if(!ia&&["page","gallery","immersive"].includes(ho.echo_detail_layout)){Sr.current=window.scrollY;const t=`${jn.pathname}${jn.search}${jn.hash}`,r=b(e.id);y(t,r),Sn(le({...e,ownerUsername:e.source_board_owner||e.owner_username||e.added_by_username||null}),{state:{[I]:C(jn),[j]:t,[E]:jn.state,[M]:r,[_]:$a}})}else{Sr.current=window.scrollY,Mr(!1),pr(e);const t=Array.isArray(e.viewer_board_memberships)&&(!e.source_board_id||void 0!==e.source_board_view_config);if("always"!==St&&Xo(e)&&t)return;(async()=>{try{const{data:t,error:r}=await Y.rpc("get_memory_by_id_with_board_config",{p_memory_id:e.id});if(r)throw r;const n=Array.isArray(t)?t[0]:t;if(n){const t=Ko(n);pr(r=>(null==r?void 0:r.id)===e.id?t:r)}}catch(t){}})()}},[$a,Xo,St,ia,jn,Ko,Sn,xt,ho.echo_detail_layout]),Ai=t.useCallback(e=>{sn.current=e;const t=un.current;e&&t&&(un.current=null,e.trigger(t.x,t.y,t.color))},[]),Bi=t.useCallback((e,t)=>{var r;if($e){const e=fo.current;if(null!==e&&e<=0)return oe({title:"Daily hearts used",description:"Your 100 hearts refresh at midnight UTC."}),!1;if(null!==e){const t=e-1;fo.current=t,mo.setQueryData(ne,e=>e?{...e,used:Math.min(e.limit,e.used+1),remaining:t}:e)}}if(!Jo.floatingReactions)return!0;const n=t.currentTarget.querySelector("[data-reaction-heart]"),o=null==n?void 0:n.getBoundingClientRect(),a={x:o?o.left+o.width/2:t.clientX,y:o?o.top+o.height/2:t.clientY,color:(null==(r=xo.activeTheme)?void 0:r.primary_color)||(null==go?void 0:go.primary_color)||"hsl(var(--primary))"};return sn.current?(sn.current.trigger(a.x,a.y,a.color),!0):(un.current=a,Ao(!0),!0)},[null==go?void 0:go.primary_color,Jo.floatingReactions,$e,mo,null==(lr=xo.activeTheme)?void 0:lr.primary_color]),Fi=t.useCallback(()=>{pr(null),Mr(!1),Er.current=!1,requestAnimationFrame(()=>{window.scrollTo({top:Sr.current,behavior:"instant"})})},[]);t.useEffect(()=>{const e=new URLSearchParams(jn.search).get("openMemory");if(e){Sn("/",{replace:!0});const t=zn.find(t=>t.id===e);if(t)return pr(t),void Mr(!1);(async()=>{try{const{data:t,error:r}=await Y.rpc("get_memory_by_id",{p_memory_id:e});if(r)throw r;const n=Array.isArray(t)?t[0]:t;n&&(pr(Ko(n)),Mr(!1))}catch(t){}})()}},[jn.search,zn,Sn,Ko]),t.useEffect(()=>{const e=e=>{const{memory:t,edit:r}=e.detail;pr(t),Mr(!!r)},t=async e=>{const{memoryId:t}=e.detail,r=zn.find(e=>e.id===t);if(r)return pr(r),void Mr(!1);try{const{data:e,error:r}=await Y.rpc("get_memory_by_id",{p_memory_id:t});if(r)throw r;const n=Array.isArray(e)?e[0]:e;n&&(pr(Ko(n)),Mr(!1))}catch(n){}};return window.addEventListener("open-memory-detail",e),window.addEventListener("open-memory-from-notification",t),()=>{window.removeEventListener("open-memory-detail",e),window.removeEventListener("open-memory-from-notification",t)}},[zn,Ko]),t.useEffect(()=>{if(!(null==hr?void 0:hr.id))return;const e=zn.find(e=>e.id===hr.id);if(!e)return;Er.current=!0;const t=(e.hearts||0)>(hr.hearts||0),r=e.watch_count!==hr.watch_count;(t||r)&&pr(t=>{if(!t||t.id!==e.id)return t;const r={...e,owner_username:e.owner_username||t.owner_username||null,owner_full_name:e.owner_full_name||t.owner_full_name||null,owner_avatar:e.owner_avatar||t.owner_avatar||null,user_id:e.user_id||t.user_id||null,added_by:e.added_by||t.added_by||null,added_by_id:e.added_by_id||t.added_by_id||null,added_by_username:e.added_by_username||t.added_by_username||null,added_by_full_name:e.added_by_full_name||t.added_by_full_name||null,added_by_avatar:e.added_by_avatar||t.added_by_avatar||null,source_board_id:e.source_board_id||t.source_board_id||null,source_board_name:e.source_board_name||t.source_board_name||null,source_board_owner:e.source_board_owner||t.source_board_owner||null,source_board_owner_id:e.source_board_owner_id||t.source_board_owner_id||null,source_board_owner_full_name:e.source_board_owner_full_name||t.source_board_owner_full_name||null,source_board_owner_avatar:e.source_board_owner_avatar||t.source_board_owner_avatar||null,hearts:Math.max(t.hearts||0,e.hearts||0)};return r.hearts===t.hearts&&r.watch_count===t.watch_count&&r.owner_username===t.owner_username&&r.user_id===t.user_id&&r.source_board_id===t.source_board_id&&r.source_board_name===t.source_board_name?t:r})},[zn,null==hr?void 0:hr.hearts,null==hr?void 0:hr.id,null==hr?void 0:hr.watch_count]),t.useEffect(()=>{hr&&Er.current&&(zn.some(e=>e.id===hr.id)||Fi())},[zn,hr,Fi]),r.useEffect(()=>{if(!zn.length||"undefined"==typeof performance)return;let e=0,t=0;return e=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>{st("echo.route.first_feed_card",{feed_surface:Jt})})}),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(t)}},[zn.length,Jt]);const Di=r.useCallback(e=>{if(!(e.target instanceof HTMLImageElement))return;if(jr.current)return;jr.current=!0;const t=e.target;("function"==typeof t.decode?t.decode().catch(()=>{}):Promise.resolve()).then(()=>new Promise(e=>window.requestAnimationFrame(()=>e()))).then(()=>{Ir.current&&st("echo.route.first_feed_image",{feed_surface:Jt})})},[Jt]);r.useEffect(()=>(Ir.current=!0,jr.current=!1,()=>{Ir.current=!1}),[Jt]),r.useEffect(()=>{},[zn.length,co]),r.useEffect(()=>{const e=kr.current,t=Lr.current,r=an.current,n=new Set,o="/explore"===jn.pathname||"/explorefeed2"===jn.pathname,u=o?650:2e3,c=()=>"visible"===document.visibilityState&&H();let d=c();const m=(e,t,r)=>{var n,o,l,u;if(r.has(e))return;const c=Go.current.get(e);if(null==c?void 0:c.source_board_id){const d=(null==(n=c.metadata)?void 0:n._explore_feed_v2)||{},m=Number(d.position),f="string"==typeof d.batch_id&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(d.batch_id)?d.batch_id:null;s(r,e,2e3);const h={memoryId:e,contentIdentity:i(c),boardId:c.source_board_id,boardOwnerId:c.source_board_owner_id||null,feedRank:c.feed_rank||null,rankerVersion:(null==(u=null==(l=null==(o=c.metadata)?void 0:o._explore_match)?void 0:l.evidence)?void 0:u.ranker_version)||null,feedSessionId:f,feedPosition:Number.isFinite(m)?m:null,bucket:"string"==typeof d.bucket?d.bucket:null,source:"/explorefeed2"===jn.pathname?"for_you_v2":"explore",exposureRecorded:!0};"echoExploreExposed"===t&&a(h,(null==Nn?void 0:Nn.id)||null),window.dispatchEvent(new CustomEvent(t,{detail:h}))}},f=new IntersectionObserver(e=>
2{e.forEach(e=>{var t;const a=e.target,i=null==(t=null==a?void 0:a.dataset)?void 0:t.memoryId;if(i)if((o?l(e):e.isIntersecting)&&c()){if(o&&m(i,"echoExploreExposed",n),!kr.current.has(i)){const e=setTimeout(()=>{c()?(window.dispatchEvent(new CustomEvent("echoViewed",{detail:{memoryId:i}})),o&&m(i,"echoExploreViewed",r),kr.current.delete(i)):kr.current.delete(i)},u);kr.current.set(i,e)}}else{const e=kr.current.get(i);e&&clearTimeout(e),kr.current.delete(i)}})},{threshold:o?[0,.05,.1,.2,.35,.6,1]:.6}),h=f;Nr.current=f,d&&Lr.current.forEach(e=>f.observe(e));const p=()=>{e.forEach(e=>clearTimeout(e)),e.clear()},w=()=>{const e=c();if(e!==d){if(d=e,!e)return p(),void t.forEach(e=>f.unobserve(e));t.forEach(e=>{f.unobserve(e),f.observe(e)})}},v=O(w),g=P(w);return()=>{v(),g(),null==h||h.disconnect(),Nr.current=null,p(),r.clear()}},[jn.pathname,null==Nn?void 0:Nn.id]);const Pi=t.useCallback(e=>{const t=Ar.current.get(e);if(t)return t;const r=t=>{const r=Nr.current,n=Lr.current.get(e);if(n&&r&&r.unobserve(n),!t){Lr.current.delete(e),Ar.current.delete(e);const t=kr.current.get(e);return t&&clearTimeout(t),void kr.current.delete(e)}t.dataset.memoryId=e,Lr.current.set(e,t),"visible"===document.visibilityState&&H()&&(null==r||r.observe(t))};return Ar.current.set(e,r),r},[]),Hi=t.useCallback((e,t)=>{var r;const n=(e=>{const t=Number.isFinite(e)?e:1;return Math.max(1,Math.round(4*t)/4)})(t),o=Br.current.get(e),a=null==(r=it(Zr.current,e))?void 0:r.placementHeight;if(void 0!==a&&Math.abs(a-n)<1){if(void 0===o)return;return Br.current.delete(e),void Oo()}if(void 0!==o&&Math.abs(o-n)<.25)return;u(Br.current,e,n,1200);const i=o??a??n;f("card-height-correction",e),m("layout-correction",{renderer:"memory-feed",deltaPx:Math.abs(i-n)});const l=Math.abs(i-n);Oo(l>=Math.max(48,.2*i))},[Oo]),Oi=t.useCallback(e=>{Or.current.add(e);const t=(e=900)=>{null===zr.current&&null===$r.current&&(zr.current=window.setTimeout(()=>{zr.current=null,"idle"!==Rn.current.phase||vn.current||Date.now()<Mn.current?t():$r.current=window.requestAnimationFrame(()=>{$r.current=null;const e=Array.from(Or.current).slice(0,2);e.forEach(e=>{Or.current.delete(e)});const r=[];e.forEach(e=>{const t=Dr.current.get(e);(null==t?void 0:t.isConnected)&&r.push({id:e,height:t.getBoundingClientRect().height})}),r.forEach(({id:e,height:t})=>{Hi(e,t)}),Or.current.size>0&&t(64)})},e))};t()},[Hi]),$i=t.useCallback(e=>{const t=Hr.current.get(e);if(t)return t;const r=t=>{var r;if(Dr.current.get(e)&&(null==(r=Pr.current.get(e))||r(),Pr.current.delete(e),Dr.current.delete(e)),!t)return Or.current.delete(e),void Hr.current.delete(e);if(t.dataset.memoryMeasureId=e,Dr.current.set(e,t),"undefined"==typeof ResizeObserver)return void Oi(e);const n=qe(t,e=>{const t=e.target.dataset.memoryMeasureId;t&&Hi(t,ze(e,"block"))});Pr.current.set(e,n)};return Hr.current.set(e,r),r},[Hi,Oi]);t.useEffect(()=>()=>{null!==qr.current&&(window.cancelAnimationFrame(qr.current),qr.current=null),null!==Vr.current&&(window.clearTimeout(Vr.current),Vr.current=null),null!==$r.current&&(window.cancelAnimationFrame($r.current),$r.current=null),null!==zr.current&&(window.clearTimeout(zr.current),zr.current=null),Or.current.clear(),Pr.current.forEach(e=>e()),Pr.current.clear(),Dr.current.clear(),Hr.current.clear(),Ar.current.clear()},[]);const zi=t.useCallback(e=>{if(!e)return;const t=Math.round((Date.now()-e.openedAt)/1e3);t<2||window.dispatchEvent(new CustomEvent("echoExploreDwelled",{detail:{memoryId:e.memoryId,boardId:e.boardId,dwellSeconds:t}}))},[]);r.useEffect(()=>{const e="/explore"===jn.pathname&&(null==hr?void 0:hr.source_board_id)?{memoryId:hr.id,boardId:hr.source_board_id,openedAt:Date.now()}:null,t=ln.current;t&&e&&t.memoryId===e.memoryId||(zi(t),ln.current=e)},[zi,jn.pathname,null==hr?void 0:hr.id,null==hr?void 0:hr.source_board_id]),r.useEffect(()=>()=>{zi(ln.current),ln.current=null},[zi]),r.useEffect(()=>{if(fa)return jo.current=!1,void Eo(!1);if(!Tt)return jo.current=!0,void Eo(!0);(()=>{const e=null==qt?void 0:qt.current;return e?e.scrollTop||0:Math.max(window.scrollY||0,document.documentElement.scrollTop||0,document.body.scrollTop||0)})()>8&&(jo.current=!0,Eo(!0));const e=window.requestAnimationFrame(()=>{Io()&&Eo(!0)}),t=()=>{jo.current=!0,Eo(!0)},r=null==qt?void 0:qt.current,n=e=>{"PageDown"!==e.key&&"ArrowDown"!==e.key&&" "!==e.key&&"End"!==e.key||t()},o=r?[r]:[window];
2return o.forEach(e=>{e.addEventListener("wheel",t,{passive:!0,once:!0}),e.addEventListener("scroll",t,{passive:!0,once:!0})}),window.addEventListener("keydown",n,{once:!0}),()=>{window.cancelAnimationFrame(e),o.forEach(e=>{e.removeEventListener("wheel",t),e.removeEventListener("scroll",t)}),window.removeEventListener("keydown",n)}},[fa,Tt,qt,Fa.length,Io]);const qi=r.useRef({hasMore:Wn,hasHiddenLoadedMemories:Qa,loadMoreError:ht,seamAdvance:Ka.advance,isLoadingMore:Kn,memoriesLength:Fa.length,onLoadMore:Un,renderWindowStep:Ea,triggerLoadMore:zo});qi.current={hasMore:Wn,hasHiddenLoadedMemories:Qa,loadMoreError:ht,seamAdvance:Ka.advance,isLoadingMore:Kn,memoriesLength:Fa.length,onLoadMore:Un,renderWindowStep:Ea,triggerLoadMore:zo},En.current=(e="unknown",t=!1)=>{const n=qi.current;if(n.loadMoreError&&!t)return;if(!t&&"load-more"===n.seamAdvance&&jo.current&&mn.current)return;const o=Gr.current>=Date.now()&&null!==Yr.current,a=()=>{const e=_n.current;if(_n.current=null,e&&Xr.current===e&&Be(e)){const t=Yr.current;if(t&&!o){const e=qo(),r=e.scrollTop-t.scrollTop;Yr.current={...t,top:t.top-r,viewportOffsetTop:t.viewportOffsetTop-r,scrollTop:e.scrollTop,capturedAt:Date.now()}}return e}const t=Ae();return Xr.current=t,Qr.current=Date.now()+Ye,xn.current=Date.now()+Ye,o||Yo(),t},i=e=>{const t=Date.now();_n.current===e&&(_n.current=null);const r=Xr.current===e;Xr.current=Fe(Xr.current,e),r&&(Qr.current=t+1200,xn.current=t+1200,Yr.current&&(Yr.current={...Yr.current,capturedAt:t}))};if(!("expand-window"===n.seamAdvance||"load-more"===n.seamAdvance&&Boolean(n.onLoadMore))){const e=_n.current;return e&&(_n.current=null,Xr.current=Fe(Xr.current,e)),void(yn.current=!1)}if(vn.current||n.isLoadingMore)return;if("idle"!==Rn.current.phase||Date.now()-rn.current<120){const t=_n.current;if(!t||Xr.current!==t||!Be(t)){const e=Ae();_n.current=e,Xr.current=e,Qr.current=Date.now()+Ye,xn.current=Date.now()+Ye,o||Yo()}return yn.current=!0,void m("seam",{phase:"deferred",source:e,motion:Rn.current.phase})}if("expand-window"===n.seamAdvance){const t=a(),o=gn.current+1;return gn.current=o,vn.current=!0,Mn.current=Date.now()+320,yn.current=!1,f("feed-seam-expand"),r.startTransition(()=>{Ta(t=>{const r=Math.min(t+n.renderWindowStep,n.memoriesLength);return m("seam",{phase:"expand",source:e,before:t,after:r}),r})}),bn.current&&window.clearTimeout(bn.current),void(bn.current=window.setTimeout(()=>{gn.current===o?(bn.current=null,vn.current=!1,i(t)):i(t)},180))}if("load-more"!==n.seamAdvance||!n.onLoadMore)return void(yn.current=!1);const l=gn.current+1;gn.current=l,vn.current=!0;const s=null==qt?void 0:qt.current;dn.current=window.scrollY+(s?s.scrollTop:0),mn.current=!0;const u=a();Mn.current=Date.now()+600,yn.current=!1,f("feed-seam-fetch"),m("seam",{phase:"fetch-start",source:e}),n.triggerLoadMore(t).finally(()=>{gn.current===l&&(vn.current=!1,Mn.current=Date.now()+240),i(u),m("seam",{phase:"fetch-end",source:e})}).catch(()=>{})},r.useEffect(()=>{if(fa)return;if(!Mt)return;if(ht)return;if(!Cr.current)return;if(!Mo)return;let e=null,t=!1;const r=()=>{null!==e&&(window.clearTimeout(e),e=null)},n=()=>{if(e=null,!t)return;if(!jo.current&&!Io())return;const r=qi.current;En.current("intersection"),t&&(r.hasHiddenLoadedMemories||r.hasMore)&&(e=window.setTimeout(n,4e3))},o=new IntersectionObserver(e=>{var o;t=Boolean(null==(o=e[0])?void 0:o.isIntersecting),t?(r(),n()):r()},{root:A(Cr.current,null==qt?void 0:qt.current),threshold:.1,rootMargin:"/explore"===jn.pathname?co?"1200px":"2200px":"/"===jn.pathname?co?"1200px":"2400px":co?"900px":"1800px"});return Cr.current&&o.observe(Cr.current),()=>{t=!1,r(),o.disconnect()}},[fa,Mt,co,Mo,qt,jn.pathname,ht,Io]),r.useEffect(()=>{if(fa)return;if(!Mt)return;if(ht)return;if(!(Wn&&Un||Qa))return;if(!Mo)return;const e=null==qt?void 0:qt.current;let t=null,r=null;const n=va?160:96,o=()=>{var t;const n=null==(t=Rr.current)?void 0:t.getBoundingClientRect();if(n){if(e){const t=e.getBoundingClientRect();return void(r=e.scrollTop+n.bottom-t.top)}r=window.scrollY+n.bottom}else r=null},a=()=>{if(t=null,!jo.current&&!Io())return;const n=e?e.scrollTop+e.clientHeight:window.scrollY+window.innerHeight,o=e?e.scrollTop:window.scrollY,a=e?e.scrollHeight:document.documentElement.scrollHeight,i=o/Math.max(1,e?e.scrollHeight-e.clientHeight:document.documentElement.scrollHeight-window.innerHeight),l="/explore"===jn.pathname?.66:"/"===jn.pathname?.55:.7,s="/explore"===jn.pathname||"/"===jn.pathname?co?1200:2200:co?800:1400;if(i>=l||a-n<=s||null!==r&&r-n<=s){if(Qa)return void En.current("scroll-threshold");En.current("scroll-threshold")}},i=(r=!1)=>{const o=window.scrollY+(e?e.scrollTop:0),i=dn.current;(r||null!==i&&Math.abs(o-i)>=n)&&(mn.current=!1),Re(dn.current,o,n,r)&&null===t&&(t=window.requestAnimationFrame(a))},l=()=>i(!1),s=()=>{o(),l()},u=e=>{"PageDown"!==e.key&&"ArrowDown"!==e.key&&" "!==e.key&&"End"!==e.key||i(!0)},c=(e?[e,window]:[window]).map(e=>de(e,l));window.addEventListener("keydown",u);const d=fe(s),m=Rr.current?qe(Rr.current,s):()=>{};o();const f=!fn.current;fn.current=!0,f&&a();const h=f?[window.setTimeout(a,250),window.setTimeout(a,900),window.setTimeout(a,1800)]:[];return()=>
2{null!==t&&(window.cancelAnimationFrame(t),t=null),h.forEach(e=>window.clearTimeout(e)),c.forEach(e=>e()),window.removeEventListener("keydown",u),d(),m()}},[fa,Mt,va,ia,Wn,Qa,zn.length,Un,Kn,co,Mo,qt,zo,Ea,jn.pathname,ht,Io]);const Vi=Ra&&ka.length>0&&0===Fa.length;return Na&&po&&!Vn&&!ae&&zn.length>0&&0===ka.length?n.jsxs("div",{className:"flex min-h-64 flex-col items-center justify-center gap-3 px-6 text-center",role:"status",children:[n.jsx("p",{className:"font-medium",children:"Your own Echoes are hidden from Explore"}),n.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:Wn?"Continue browsing to find Echoes from other people.":"No other Echoes match this view. Try another search or change your Content Preferences."}),Wn&&Un?n.jsx(Q,{variant:"outline",disabled:Kn,onClick:()=>{zo(!0).catch(()=>{})},children:Kn?"Loading…":ht?"Retry":"Load more"}):null]}):Ba.isError&&Vi?n.jsxs("div",{className:"flex flex-col items-center justify-center px-4 py-20",role:"alert",children:[n.jsx("div",{className:"mb-4 rounded-full bg-muted/30 p-4",children:n.jsx(ye,{className:"h-8 w-8 text-muted-foreground"})}),n.jsxs("div",{className:"text-center",children:[n.jsx("p",{className:"mb-1 text-lg font-medium text-foreground",children:"We couldn't verify these recommendations"}),n.jsx("p",{className:"mx-auto max-w-sm text-sm text-muted-foreground/70",children:"Nothing unverified was shown. Retry to apply your AI-content preference and continue."})]}),n.jsx(Q,{className:"mt-6",variant:"secondary",onClick:()=>{Ba.refetch()},children:"Retry recommendations"})]}):ae&&uo&&0===zn.length&&!Vn?n.jsxs("div",{className:"flex flex-col items-center justify-center py-20 px-4",children:[n.jsx("div",{className:"bg-muted/30 p-4 rounded-full mb-4",children:n.jsx(ye,{className:"w-8 h-8 text-muted-foreground"})}),n.jsxs("div",{className:"text-center",children:[n.jsx("p",{className:"text-lg font-medium text-foreground mb-1",children:"We couldn't load these echoes"}),n.jsx("p",{className:"text-sm text-muted-foreground/70 max-w-xs mx-auto",children:"This looks like a temporary feed loading problem, not an empty feed. Try again in a moment."}),Ce>0&&n.jsxs("p",{className:"text-xs text-muted-foreground/60 mt-2",children:["Attempts: ",Ce]})]}),Se&&n.jsx("div",{className:"mt-6",children:n.jsx(Q,{variant:"secondary",onClick:Se,children:"Retry Now"})})]}):(Vn||!B)&&0===zn.length||Ba.isResolving&&Vi?n.jsx("div",{ref:rr,className:W("relative px-0 pb-tab-bar md:pb-0",er),...tr,style:ca,"aria-busy":"true",children:n.jsx("div",{className:"w-full",children:n.jsx("div",{className:"flex items-start w-full",style:{gap:`${ua}px`},children:ki.map((e,t)=>n.jsx("div",{className:"flex-1 min-w-0 flex flex-col",style:{alignSelf:"flex-start",gap:`${ua}px`},children:e.map(e=>n.jsx(V,{index:e,hasImage:!0},`feed-skeleton-${e}`))},`feed-skeleton-column-${t}`))})})}):Vi?n.jsx("div",{ref:rr,className:W("relative px-0 pb-tab-bar md:pb-0",er),...tr,style:ca,children:n.jsxs("div",{className:"flex min-h-64 flex-col items-center justify-center gap-3 rounded-3xl border border-primary/15 bg-primary/5 px-6 text-center",children:[n.jsx(_e,{className:"h-7 w-7 text-primary"}),n.jsxs("div",{children:[n.jsx("p",{className:"font-bold",children:"These recommendations match your content preference"}),n.jsx("p",{className:"mt-1 max-w-sm text-sm text-muted-foreground",children:"Community-flagged AI Echoes were hidden. You can continue for more recommendations."})]}),n.jsxs("div",{className:"flex gap-2",children:[Wn?n.jsxs(Q,{variant:"outline",className:"rounded-xl",disabled:Kn,onClick:()=>{zo(!0).catch(()=>{})},children:[Kn?n.jsx(Me,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Load more"]}):null,gr?n.jsx(Q,{className:"rounded-xl",onClick:lo,children:"Back to feed"}):null]})]})}):gr&&0===zn.length?n.jsx("div",{ref:rr,className:W("relative px-0 pb-tab-bar md:pb-0",er),...tr,style:ca,children:n.jsxs("div",{className:"flex min-h-64 flex-col items-center justify-center gap-3 rounded-3xl border border-primary/15 bg-primary/5 px-6 text-center",children:[n.jsx(_e,{className:"h-7 w-7 text-primary"}),io.length>0?n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-sm font-bold",children:"Similar to"}),n.jsx(tt,{memories:io,sourceCount:gr.length})]}):null,n.jsxs("div",{children:[n.jsx("p",{className:"font-bold",children:Fn.isError?"Similar echoes could not be loaded":"No close matches yet"}),n.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Your original feed and selection sources are unchanged."})]}),n.jsxs("div",{className:"flex gap-2",children:[Fn.isError?n.jsx(Q,{variant:"outline",className:"rounded-xl",onClick:()=>{Fn.refetch()},children:"Try again"}):null,n.jsx(Q,{className:"rounded-xl",onClick:lo,children:"Back to feed"})]})]})}):0===zn.length&&0===et&&N?n.jsx("div",{className:"flex flex-col items-center justify-center py-20",children:n.jsxs("div",{className:"text-center",children:[n.jsxs("p",{className:"text-lg text-muted-foreground mb-2",children:['No Echoes match "',N,'"']}
2),n.jsx("p",{className:"text-sm text-muted-foreground/70",children:"Try searching for concepts, colors, or vibes — I understand meaning, not just words"})]})}):0===zn.length&&0===et?uo?re?n.jsx("div",{className:"flex flex-col items-center justify-center py-20",children:n.jsxs("div",{className:"text-center",children:[n.jsx("p",{className:"text-lg text-muted-foreground mb-2",children:"Start saving what inspires you"}),n.jsx("p",{className:"text-sm text-muted-foreground/70",children:"Capture your first echo above to get started"})]})}):null:n.jsxs("div",{className:"flex flex-col items-center justify-center py-20 px-4",children:[n.jsx("div",{className:"bg-muted/30 p-4 rounded-full mb-4",children:n.jsx(Ee,{className:"w-8 h-8 text-muted-foreground"})}),n.jsxs("div",{className:"text-center",children:[n.jsx("p",{className:"text-lg font-medium text-foreground mb-2",children:"You're offline"}),n.jsx("p",{className:"text-sm text-muted-foreground/70 max-w-xs mx-auto",children:"Check your internet connection to see more Echoes. Local Echoes are still available."})]})]}):n.jsxs("div",{ref:rr,"data-feed-renderer":"memory-feed","data-feed-motion":Tn.phase,className:W("relative px-0 pb-tab-bar md:pb-0",er),...tr,style:ca,children:[gr&&n.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3 py-2","data-sim
2ilarity-rank-mode":null==(ur=null==(sr=Fn.data)?void 0:sr.pages[0])?void 0:ur.meta.rankMode,"data-similarity-semantic":(null==(dr=null==(cr=Fn.data)?void 0:cr.pages[0])?void 0:dr.meta.semantic)?"true":"false","data-similarity-weight":null==(fr=null==(mr=Fn.data)?void 0:mr.pages[0])?void 0:fr.meta.semanticWeight,"data-similarity-source-ids":gr.join(","),"data-similarity-query-mode":"embedding-only","data-similarity-popularity":"ignored",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsx("img",{src:"/logo-128.png",alt:"","aria-hidden":"true",width:128,height:125,className:"h-7 w-7 shrink-0 object-contain"}),n.jsx("span",{className:"shrink-0 text-sm font-bold",children:"Similar to"}),n.jsx(tt,{memories:io,sourceCount:gr.length})]}),n.jsx(Q,{variant:"ghost",size:"sm",className:"shrink-0 rounded-xl",onClick:lo,children:"Back to feed"})]}),!bt&&_t&&n.jsx("div",{className:"flex justify-end items-center mb-1.5 md:mb-2 gap-2",children:n.jsx(r.Suspense,{fallback:null,children:n.jsx(Xe,{})})}),n.jsxs("div",{className:"w-full",children:[Mt&&!fa&&Jn&&Xn?n.jsx("div",{ref:Tr,"data-feed-load-previous-sentinel":!0,"aria-hidden":"true",className:"h-px w-full [overflow-anchor:none]"}):null,Zn&&!fa?n.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:"Loading earlier echoes"}):null,n.jsx(r.Profiler,{id:`memory-feed:${jn.pathname}`,onRender:Ti,children:n.jsx("div",{ref:Rr,"data-feed-virtual-window":!0,onLoadCapture:Di,className:"flex items-start w-full [overflow-anchor:none]",style:{gap:`${ua}px`},children:yi.map((e,t)=>n.jsx(Ke,{items:e.visibleItems,columnIndex:t,totalHeight:e.totalHeight,onDelete:Ne,canDeleteMemory:ke,deleteActionLabel:De,deleteActionKind:Pe,isSelected:no,isSelectionMode:eo,onSelect:oo,isReadOnly:gt,handleCardClick:Li,onLike:$e,handleHeartClick:Bi,heartDisabled:Ho,viewRefForId:Pi,showAuthorAttribution:Nt,showHeartCountBadge:kt,showExploreMatchChips:Lt,onNotInterested:At,onMemoryNotInterested:Bt,onMemoryMoreLikeThis:Ft,onReportMemory:Dt,onMemoryMediaUnavailable:Pt,onExploreMatchFilterClick:Ht,onFederatedFollow:Ot,resolveExternalMemoryId:$t,isFederatedFollowing:zt,priorityCount:Ri,feedSettings:Jo,echoPagesByMemoryId:Ii,measureRefForId:$i,preferredBoardId:Ut,preferredBoardName:Wt,preferredBoardCanEdit:Kt,mobileView:Si,imageSizes:bi,lightweightCards:Ni,showReactButtonSetting:ho.show_react_button,hapticsDisabled:ho.disable_haptics,routePathname:jn.pathname,navigateTo:Sn,authUser:Nn,authProfile:kn,isOnline:uo,slowNetwork:co,isMobile:ia,activeMoodSetting:go,themeState:xo,lowEnd:bo,nativeMobile:yo,mutationContext:Cn,entranceRefForId:ya},`masonry-column-${t}`))})}),Mt&&ri&&n.jsxs("div",{className:"w-full py-6 flex items-center justify-center gap-3 [overflow-anchor:none]",children:[n.jsx(Q,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 rounded-full",onClick:vi,disabled:!ii||li,"aria-label":"Previous feed page",children:Zn&&0===Co?n.jsx(Me,{className:"h-4 w-4 animate-spin"}):n.jsx(je,{className:"h-4 w-4"})}),n.jsxs("div",{className:"min-w-[7rem] text-center text-xs font-bold uppercase tracking-widest text-muted-foreground",children:["Page ",Co+1]}),n.jsx(Q,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 rounded-full",onClick:gi,disabled:!ai||li,"aria-label":"Next feed page",children:li&&!ti?n.jsx(Me,{className:"h-4 w-4 animate-spin"}):n.jsx(Ie,{className:"h-4 w-4"})})]}),Mt&&!fa&&Ua.length>0&&n.jsxs("div",{ref:Cr,className:"flex h-28 w-full flex-none items-center justify-center [contain:layout_paint] [overflow-anchor:none]",children:[Kn&&Qn&&n.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-background/80 text-muted-foreground ring-1 ring-border/50",role:"status","aria-label":"Loading more",children:n.jsx(Me,{className:"h-4 w-4 animate-spin"})}),!Kn&&ht&&n.jsxs("div",{className:"flex min-h-14 flex-col items-center justify-center gap-1.5 text-center",role:"alert",children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Couldn’t load the next echoes. Your place is saved."}),n.jsx(Q,{type:"button",variant:"outline",size:"sm",className:"h-9",onClick:()=>En.current("error-retry",!0),children:"Retry loading echoes"})]}),!Kn&&!ht&&(Wn||Qa)&&n.jsx(Q,{type:"button",variant:"ghost",size:"sm",className:"h-10",onClick:()=>En.current("button",!0),children:"Load more echoes"}),!Kn&&!ht&&!Wn&&!Qa&&n.jsx("div",{className:"flex h-10 items-center text-xs font-medium text-muted-foreground
2/60",children:"You're all caught up"})]}),Vn&&zn.length>0&&!Kn&&n.jsx("div",{className:"w-full py-8 flex justify-center",children:n.jsx(Me,{className:"w-6 h-6 animate-spin text-primary"})})]}),An&&ao.length>0&&(null==Nn?void 0:Nn.id)?n.jsx(r.Suspense,{fallback:null,children:n.jsx(Je,{memories:ao,userId:Nn.id,similarEnabled:Bn,onClear:()=>vr(new Set),onDeleted:e=>{vr(t=>{const r=new Set(t);return e.forEach(e=>r.delete(e)),r})},onShowSimilar:()=>{const e=ao.slice(0,20),t=e.map(e=>e.id);ao.length>20&&oe({title:"Using 20 similarity sources",description:"The first 20 selected echoes are balanced evenly to keep semantic search fast."}),yr(e),xr(t),null==Zt||Zt(!0),vr(new Set),hi()}})}):null,hr&&n.jsx(r.Suspense,{fallback:n.jsx(Ze,{memory:hr,onClose:Fi}),children:n.jsx(Qe,{memory:hr,memories:Fa,isOpen:!0,initialIsEditing:_r,onClose:()=>{Fi()},onSave:Oe,onDelete:!Ne||ke&&!ke(hr)?void 0:e=>Ne(e,hr),deleteActionLabel:"function"==typeof De?De(hr):De,deleteActionKind:"function"==typeof Pe?Pe(hr):Pe,onLike:$e,canNavigateNextEcho:Ya,canNavigatePreviousEcho:Va,onNext:()=>za("next"),onPrev:()=>za("previous"),onNotInterested:At,onMemoryNotInterested:Bt,onMemoryMoreLikeThis:Ft,boardContextId:Ut,boardContextName:Wt,boardContextViewConfig:Gt,boardContextCanEdit:Kt,boardShareToken:Qt,mutationSurfaceId:Xt})}),Jo.floatingReactions&&Lo&&n.jsx(r.Suspense,{fallback:null,children:n.jsx(Ge,{ref:Ai})})]})}));lt.displayName="MemoryFeed";const st=(t,r)=>{e(()=>import("./performanceRum-DKAircGt.js"),__vite__mapDeps([136,1,5,2,6,7,8,137,138])).then(e=>{e.captureRumPerformanceMetricOnce(t,e.getRumNavigationDuration(),"millisecond",r)}).catch(()=>{})},ut=Object.freeze(Object.defineProperty({__proto__:null,MemoryFeed:lt},Symbol.toStringTag,{value:"Module"}));export{lt as M,ut as a,ke as e,Te as f,He 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.