PageSourceSearch

https://farcaster.xyz/assets/use-scroll-BZ8FkXlA.js

js farcaster.xyz collected 2026-09-24 08:34:28 UTC 10,921 bytes, 9 lines download raw bytes

1import{r as a,j as P}from"./vendor-wagmi-CRHMQcRy.js";import{gS as L,gT as j,gU as he,gV as A,gW as F,gX as ge,gY as pe,gZ as se,g_ as me,g$ as re,h0 as oe,h1 as ye,h2 as xe,h3 as we,h4 as Ce,h5 as ve,h6 as ie,h7 as Ee,h8 as Se,h9 as X,ha as W}from"./index-CjDX1y09.js";function le(e,t){let n;const s=()=>{const{currentTime:r}=t,i=(r===null?0:r.value)/100;n!==i&&e(i),n=i};return L.preUpdate(s,!0),()=>j(s)}function Y(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Pe(...e){return t=>{let n=!1;const s=e.map(r=>{const o=Y(r,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let r=0;r<s.length;r++){const o=s[r];typeof o=="function"?o():Y(e[r],null)}}}}function Re(...e){return a.useCallback(Pe(...e),e)}class Le extends a.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(A(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const s=n.offsetParent,r=A(s)&&s.offsetWidth||0,o=A(s)&&s.offsetHeight||0,i=getComputedStyle(n),l=this.props.sizeRef.current;l.height=parseFloat(i.height),l.width=parseFloat(i.width),l.top=n.offsetTop,l.left=n.offsetLeft,l.right=r-l.width-l.left,l.bottom=o-l.height-l.top}return null}componentDidUpdate(){}render(){return this.props.children}}function Te({children:e,isPresent:t,anchorX:n,anchorY:s,root:r,pop:o}){const i=a.useId(),l=a.useRef(null),d=a.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:u}=a.useContext(he),c=e.props?.ref??e?.ref,m=Re(l,c);return a.useInsertionEffect(()=>{const{width:f,height:h,top:y,left:w,right:C,bottom:R}=d.current;if(t||o===!1||!l.current||!f||!h)return;const O=n==="left"?`left: ${w}`:`right: ${C}`,$=s==="bottom"?`bottom: ${R}`:`top: ${y}`;l.current.dataset.motionPopId=i;const p=document.createElement("style");u&&(p.nonce=u);const v=r??document.head;return v.appendChild(p),p.sheet&&p.sheet.insertRule(`
2          [data-motion-pop-id="${i}"] {
3            position: absolute !important;
4            width: ${f}px !important;
5            height: ${h}px !important;
6            ${O}px !important;
7            ${$}px !important;
8          }
9        `),()=>{l.current?.removeAttribute("data-motion-pop-id"),v.contains(p)&&v.removeChild(p)}},[t]),P.jsx(Le,{isPresent:t,childRef:l,sizeRef:d,pop:o,children:o===!1?e:a.cloneElement(e,{ref:m})})}const We=({children:e,initial:t,isPresent:n,onExitComplete:s,custom:r,presenceAffectsLayout:o,mode:i,anchorX:l,anchorY:d,root:u})=>{const c=F(be),m=a.useId();let f=!0,h=a.useMemo(()=>(f=!1,{id:m,initial:t,isPresent:n,custom:r,onExitComplete:y=>{c.set(y,!0);for(const w of c.values())if(!w)return;s&&s()},register:y=>(c.set(y,!1),()=>c.delete(y))}),[n,c,s]);return o&&f&&(h={...h}),a.useMemo(()=>{c.forEach((y,w)=>c.set(w,!1))},[n]),a.useEffect(()=>{!n&&!c.size&&s&&s()},[n]),e=P.jsx(Te,{pop:i==="popLayout",isPresent:n,anchorX:l,anchorY:d,root:u,children:e}),P.jsx(ge.Provider,{value:h,children:e})};function be(){return new Map}const b=e=>e.key||"";function U(e){const t=[];return a.Children.forEach(e,n=>{a.isValidElement(n)&&t.push(n)}),t}const Qe=({children:e,custom:t,initial:n=!0,onExitComplete:s,presenceAffectsLayout:r=!0,mode:o="sync",propagate:i=!1,anchorX:l="left",anchorY:d="top",root:u})=>{const[c,m]=pe(i),f=a.useMemo(()=>U(e),[e]),h=i&&!c?[]:f.map(b),y=a.useRef(!0),w=a.useRef(f),C=F(()=>new Map),R=a.useRef(new Set),[O,$]=a.useState(f),[p,v]=a.useState(f);se(()=>{y.current=!1,w.current=f;for(let x=0;x<p.length;x++){const g=b(p[x]);h.includes(g)?(C.delete(g),R.current.delete(g)):C.get(g)!==!0&&C.set(g,!1)}},[p,h.length,h.join("-")]);const z=[];if(f!==O){let x=[...f];for(let g=0;g<p.length;g++){const E=p[g],B=b(E);h.includes(B)||(x.splice(g,0,E),z.push(E))}return o==="wait"&&z.length&&(x=z),v(U(x)),$(f),null}const{forceRender:ae}=a.useContext(me);return P.jsx(P.Fragment,{children:p.map(x=>{const g=b(x),E=i&&!c?!1:f===p||h.includes(g),B=()=>{if(R.current.has(g))return;if(C.has(g))R.current.add(g),C.set(g,!0);else return;let V=!0;C.forEach(de=>{de||(V=!1)}),V&&(ae?.(),v(w.current),i&&m?.(),s&&s())};return P.jsx(We,{isPresent:E,initial:!y.current||n?void 0:!1,custom:t,presenceAffectsLayout:r,mode:o,root:u,onExitComplete:E?void 0:B,anchorX:l,anchorY:d,children:x},g)})})};function M(e){return typeof window>"u"?!1:e?re():oe()}const ke=50,K=()=>({current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}),He=()=>({time:0,x:K(),y:K()}),Ae={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function G(e,t,n,s){const r=n[t],{length:o,position:i}=Ae[t],l=r.current,d=n.time;r.current=Math.abs(e[`scroll${i}`]),r.scrollLength=e[`scroll${o}`]-e[`client${o}`],r.offset.length=0,r.offset[0]=0,r.offset[1]=r.scrollLength,r.progress=ye(0,r.scrollLength,r.current);const u=s-d;r.velocity=u>ke?0:xe(r.current-l,u)}function Me(e,t,n){G(e,"x",t,n),G(e,"y",t,n),t.time=n}function Oe(e,t){const n={x:0,y:0};let s=e;for(;s&&s!==t;)if(A(s))n.x+=s.offsetLeft,n.y+=s.offsetTop,s=s.offsetParent;else if(s.tagName==="svg"){const r=s.getBoundingClientRect();s=s.parentElement;const o=s.getBoundingClientRect();n.x+=r.left-o.left,n.y+=r.top-o.top}else if(s instanceof SVGGraphicsElement){const{x:r,y:o}=s.getBBox();n.x+=r,n.y+=o;let i=null,l=s.parentNode;for(;!i;)l.tagName==="svg"&&(i=l),l=s.parentNode;s=i}else break;return n}const D={start:0,center:.5,end:1};function _(e,t,n=0){let s=0;if(e in D&&(e=D[e]),typeof e=="string"){const r=parseFloat(e);e.endsWith("px")?s=r:e.endsWith("%")?e=r/100:e.endsWith("vw")?s=r/100*document.documentElement.clientWidth:e.endsWith("vh")?s=r/100*document.documentElement.clientHeight:e=r}return typeof e=="number"&&(s=t*e),n+s}const $e=[0,0];function ze(e,t,n,s){let r=Array.isArray(e)?e:$e,o=0,i=0;return typeof e=="number"?r=[e,e]:typeof e=="string"&&(e=e.trim(),e.includes(" ")?r=e.split(" "):r=[e,D[e]?e:"0"]),o=_(r[0],n,s),i=_(r[1],t),o-i}const T={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},Be={x:0,y:0};function Ie(e){return"getBBox"in e&&e.tagName!=="svg"?e.getBBox():{width:e.clientWidth,height:e.clientHeight}}function je(e,t,n){const{offset:s=T.All}=n,{target:r=e,axis:o="y"}=n,i=o==="y"?"height":"width",l=r!==e?Oe(r,e):Be,d=r===e?{width:e.scrollWidth,height:e.scrollHeight}:Ie(r),u={width:e.clientWidth,height:e.clientHeight};t[o].offset.length=0;let c=!t[o].interpolate;const m=s.length;for(let f=0;f<m;f++){const h=ze(s[f],u[i],d[i],l[o]);
9!c&&h!==t[o].interpolatorOffsets[f]&&(c=!0),t[o].offset[f]=h}c&&(t[o].interpolate=we(t[o].offset,Ce(s),{clamp:!1}),t[o].interpolatorOffsets=[...t[o].offset]),t[o].progress=ve(0,1,t[o].interpolate(t[o].current))}function De(e,t=e,n){if(n.x.targetOffset=0,n.y.targetOffset=0,t!==e){let s=t;for(;s&&s!==e;)n.x.targetOffset+=s.offsetLeft,n.y.targetOffset+=s.offsetTop,s=s.offsetParent}n.x.targetLength=t===e?t.scrollWidth:t.clientWidth,n.y.targetLength=t===e?t.scrollHeight:t.clientHeight,n.x.containerLength=e.clientWidth,n.y.containerLength=e.clientHeight}function Fe(e,t,n,s={}){return{measure:r=>{De(e,s.target,n),Me(e,n,r),(s.offset||s.target)&&je(e,n,s)},notify:()=>t(n)}}const S=new WeakMap,J=new WeakMap,I=new WeakMap,Z=new WeakMap,k=new WeakMap,q=e=>e===document.scrollingElement?window:e;function ce(e,{container:t=document.scrollingElement,trackContentSize:n=!1,...s}={}){if(!t)return ie;let r=I.get(t);r||(r=new Set,I.set(t,r));const o=He(),i=Fe(t,e,o,s);if(r.add(i),!S.has(t)){const d=()=>{for(const f of r)f.measure(Se.timestamp);L.preUpdate(u)},u=()=>{for(const f of r)f.notify()},c=()=>L.read(d);S.set(t,c);const m=q(t);window.addEventListener("resize",c),t!==document.documentElement&&J.set(t,Ee(t,c)),m.addEventListener("scroll",c),c()}if(n&&!k.has(t)){const d=S.get(t),u={width:t.scrollWidth,height:t.scrollHeight};Z.set(t,u);const c=()=>{const f=t.scrollWidth,h=t.scrollHeight;(u.width!==f||u.height!==h)&&(d(),u.width=f,u.height=h)},m=L.read(c,!0);k.set(t,m)}const l=S.get(t);return L.read(l,!1,!0),()=>{j(l);const d=I.get(t);if(!d||(d.delete(i),d.size))return;const u=S.get(t);S.delete(t),u&&(q(t).removeEventListener("scroll",u),J.get(t)?.(),window.removeEventListener("resize",u));const c=k.get(t);c&&(j(c),k.delete(t)),Z.delete(t)}}const Ne=[[T.Enter,"entry"],[T.Exit,"exit"],[T.Any,"cover"],[T.All,"contain"]],Q={start:0,end:1};function Ve(e){const t=e.trim().split(/\s+/);if(t.length!==2)return;const n=Q[t[0]],s=Q[t[1]];if(!(n===void 0||s===void 0))return[n,s]}function Xe(e){if(e.length!==2)return;const t=[];for(const n of e)if(Array.isArray(n))t.push(n);else if(typeof n=="string"){const s=Ve(n);if(!s)return;t.push(s)}else return;return t}function Ye(e,t){const n=Xe(e);if(!n)return!1;for(let s=0;s<2;s++){const r=n[s],o=t[s];if(r[0]!==o[0]||r[1]!==o[1])return!1}return!0}function N(e){if(!e)return{rangeStart:"contain 0%",rangeEnd:"contain 100%"};for(const[t,n]of Ne)if(Ye(e,t))return{rangeStart:`${n} 0%`,rangeEnd:`${n} 100%`}}const ee=new Map;function te(e){const t={value:0},n=ce(s=>{t.value=s[e.axis].progress*100},e);return{currentTime:t,cancel:n}}function fe({source:e,container:t,...n}){const{axis:s}=n;e&&(t=e);let r=ee.get(t);r||(r=new Map,ee.set(t,r));const o=n.target??"self";let i=r.get(o);i||(i={},r.set(o,i));const l=s+(n.offset??[]).join(",");return i[l]||(n.target&&M(n.target)?N(n.offset)?i[l]=new ViewTimeline({subject:n.target,axis:s}):i[l]=te({container:t,...n}):M()?i[l]=new ScrollTimeline({source:t,axis:s}):i[l]=te({container:t,...n})),i[l]}function Ue(e,t){const n=fe(t),s=t.target?N(t.offset):void 0,r=t.target?M(t.target)&&!!s:M();return e.attachTimeline({timeline:r?n:void 0,...s&&r&&{rangeStart:s.rangeStart,rangeEnd:s.rangeEnd},observe:o=>(o.pause(),le(i=>{o.time=o.iterationDuration*i},n))})}function Ke(e){return e.length===2}function Ge(e,t){return Ke(e)?ce(n=>{e(n[t.axis].progress,n)},t):le(e,fe(t))}function ue(e,{axis:t="y",container:n=document.scrollingElement,...s}={}){if(!n)return ie;const r={axis:t,container:n,...s};return typeof e=="function"?Ge(e,r):Ue(e,r)}const _e=()=>({scrollX:W(0),scrollY:W(0),scrollXProgress:W(0),scrollYProgress:W(0)}),H=e=>e?!e.current:!1;function ne(e,t,n,s){return{factory:r=>ue(r,{...t,axis:e,container:n?.current||void 0,target:s?.current||void 0}),times:[0,1],keyframes:[0,1],ease:r=>r,duration:1}}function Je(e,t){return typeof window>"u"?!1:e?re()&&!!N(t):oe()}function et({container:e,target:t,...n}={}){const s=F(_e);Je(t,n.offset)&&(s.scrollXProgress.accelerate=ne("x",n,e,t),s.scrollYProgress.accelerate=ne("y",n,e,t));const r=a.useRef(null),o=a.useRef(!1),i=a.useCallback(()=>(r.current=ue((l,{x:d,y:u})=>{s.scrollX.set(d.current),s.scrollXProgress.set(d.progress),s.scrollY.set(u.current),s.scrollYProgress.set(u.progress)}
9,{...n,container:e?.current||void 0,target:t?.current||void 0}),()=>{r.current?.()}),[e,t,JSON.stringify(n.offset)]);return se(()=>{if(o.current=!1,H(e)||H(t)){o.current=!0;return}else return i()},[i]),a.useEffect(()=>{if(o.current)return X(!H(e)),X(!H(t)),i()},[i]),s}export{Qe as A,et 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.