PageSourceSearch

https://wewere.online/assets/useCursorTrails-BaXMFvdw.js

js wewere.online collected 2026-10-08 09:22:25 UTC 5,481 bytes, 1 lines download raw bytes

1import{r as G}from"./client-CUTvk0f7.js";import{a as J,b as q,r as Q}from"./styleUtils-LkIgZh7T.js";import{a as Z,T as K,R as Y,g as v,i as tt}from"./eventUtils-BzBD_l0W.js";const ot=36e5,rt=250,V="|segment:",nt=20;function N(n){if(n!==void 0)return n>ot?rt:n}function st(n,i){const o=new Int32Array(i);o.fill(-1);for(let c=0;c<n.length;c++)o[n[c]]=c;return o}function et(n,i){return`${n}${V}${i}`}function at(n){const i=n.lastIndexOf(V);if(i===-1)throw new Error(`Live trail id is missing its segment identity: ${n}`);return n.slice(0,i)}function dt(n,i){const o=new Set;for(const c of n)i.has(c)&&o.add(at(c));return Array.from(o)}function it(n){if(n.length<2)return n;const i=[n[0]];for(let o=1;o<n.length;o++){const c=n[o-1],_=n[o],u=Math.hypot(_.x-c.x,_.y-c.y),O=Math.max(1,Math.ceil(u/nt));for(let g=1;g<=O;g++){const I=g/O;i.push({x:c.x+(_.x-c.x)*I,y:c.y+(_.y-c.y)*I})}}return i}function mt(n,i,o){const c=G.useMemo(()=>n.filter(a=>a.type==="cursor"),[n]),_=G.useMemo(()=>{if(c.length===0||i.width===0)return{trails:[],documentCanvasSize:null};const f=(o.filters?.length??0)>0||o.pidFilter?c.filter(r=>o.pidFilter&&r.meta?.pid!==o.pidFilter?!1:Z(r.meta.url||"",o.filters)):c;let d=0,M=0;o.documentSpace&&f.forEach(r=>{if(!r.data||typeof r.data.x!="number"||typeof r.data.y!="number")return;const m=r.meta.vw||i.width,l=r.meta.vh||i.height,h=r.data.scrollX??0,T=r.data.scrollY??0,e=r.data.x*m+h,y=r.data.y*l+T;e>d&&(d=e),y>M&&(M=y)});const C=new Map,P=[],p=new Map;f.forEach(r=>{if(!r.data||typeof r.data.x!="number"||typeof r.data.y!="number")return;const m=r.meta.pid,l=r.meta.url||"",h=`${m}|${l}`;p.has(h)||p.set(h,[]),p.get(h).push(r)});let E=0;p.forEach((r,m)=>{r.sort((t,s)=>t.ts-s.ts);const l=r[0].meta.pid,h=r[0],T=t=>{if(o.randomizeColors){const s=Y[E%Y.length];return E++,s}return h.meta.cursor_color?v(h,t):(C.has(l)||C.set(l,tt(l)),C.get(l))};let e=[],y=[],k=0;if(r.forEach(t=>{const s=t.data.event||"move";if(s==="move"&&!o.eventFilter.move||s==="click"&&!o.eventFilter.click||s==="hold"&&!o.eventFilter.hold||s==="cursor_change"&&!
1o.eventFilter.cursor_change)return;let x,S;const b=t.data.x,F=t.data.y;if(b===void 0||F===void 0)return;if(o.documentSpace){const L=t.meta.vw||i.width,X=t.meta.vh||i.height,U=t.data.scrollX??0,W=t.data.scrollY??0;x=b*L+U,S=F*X+W}else x=b*i.width,S=F*i.height;const w=s==="click",A=s==="hold",H=t.data.cursor,$=e[e.length-1],z=o.documentSpace&&$!==void 0&&Math.abs(S-$.y)>i.height*.5;if(e.length===0||t.ts-k>K||z){if(e.length>=2&&!o.singleSegmentPerGroup){const L=e[0].ts,X=e[e.length-1].ts;P.push({points:[...e],color:T(L),opacity:1,id:`${m}|${L}`,pid:l,startTime:L,endTime:X,clicks:[...y]})}e=[{x,y:S,ts:t.ts,cursor:H}],y=[],w?y.push({x,y:S,ts:t.ts,button:t.data.button}):A&&y.push({x,y:S,ts:t.ts,button:t.data.button,duration:N(t.data.duration)})}else e.push({x,y:S,ts:t.ts,cursor:H}),w?y.push({x,y:S,ts:t.ts,button:t.data.button}):A&&y.push({x,y:S,ts:t.ts,button:t.data.button,duration:N(t.data.duration)});k=t.ts}),e.length>=2){const t=e[0].ts,s=e[e.length-1].ts;P.push({points:e,color:T(t),opacity:1,id:o.singleSegmentPerGroup?et(m,t):m,pid:l,startTime:t,endTime:s,clicks:[...y]})}});const D=o.documentSpace&&d>0&&M>0?{width:d,height:M}:null;return{trails:P,documentCanvasSize:D}},[c,o.randomizeColors,o.filters,o.pidFilter,o.eventFilter,o.documentSpace,o.singleSegmentPerGroup,i]),{trails:u,documentCanvasSize:O}=_,{timeBounds:g,cycleDuration:I,trailSchedule:R}=G.useMemo(()=>{if(u.length===0)return{timeBounds:{min:0,max:0},cycleDuration:0,trailSchedule:[]};const a=u.flatMap(t=>[t.startTime,t.endTime]),f=Math.min(...a),d=Math.max(...a),M=d-f,C=u.reduce((t,s)=>t+(s.endTime-s.startTime),0)/u.length,P=o.minGapBetweenTrails*1e3,p=1-o.overlapFactor*.8,E=C/o.maxConcurrentTrails*p,D=Math.max(P,E),r=u.length*D,m=Math.max(r,M>0?M:6e4),l=new Map;u.forEach((t,s)=>{l.has(t.color)||l.set(t.color,[]),l.get(t.color).push(s)});const h=Array.from(l.values()),T=[],e=Math.max(...h.map(t=>t.length));for(let t=0;t<e;t++)for(const s of h)t<s.length&&T.push(s[t]);const y=st(T,u.length),k=u.map((t,s)=>{if(o.trailAnimationMode==="natural")return{index:s,startTime:t.startTime,endTime:t.endTime,duration:t.endTime-t.startTime,adjustedClicks:t.clicks};{const x=t.endTime-t.startTime,b=y[s]*D%m,F=f+b-t.startTime,w=t.clicks.map(A=>({...A,ts:A.ts+F}));return{index:s,startTime:f+b,endTime:f+b+x,duration:x,adjustedClicks:w}}});return{timeBounds:{min:f,max:d},cycleDuration:m,trailSchedule:k}},[u,o.trailAnimationMode,o.maxConcurrentTrails,o.overlapFactor,o.minGapBetweenTrails]),B=G.useCallback((a,f,d,M=1)=>J(a,f,d,M),[]),j=G.useMemo(()=>u.length===0?[]:u.map((a,f)=>{const d=R[f];if(!d)return{trail:a,startOffsetMs:0,durationMs:a.endTime-a.startTime,variedPoints:a.points,clicksWithProgress:[]};const M=d.startTime-g.min,C=d.duration,P=a.points[0]?.x+a.points[0]?.y||0,p=B(a.points,o.trailStyle,P,o.chaosIntensity||1);let E=o.singleSegmentPerGroup?it(p):p;if(!o.singleSegmentPerGroup){const r=q(p);E=r===p?p:Q(r,r.length)}const D=a.clicks.map(r=>{let m=0,l=Math.abs(a.points[0]?.ts-r.ts);for(let T=1;T<a.points.length;T++){const e=Math.abs(a.points[T].ts-r.ts);e<l&&(l=e,m=T)}const h=a.points.length>1?m/(a.points.length-1):0;return{x:r.x,y:r.y,ts:r.ts,progress:h,duration:r.duration}});return{trail:a,startOffsetMs:M,durationMs:C,variedPoints:E,clicksWithProgress:D}}),[u,R,g.min,o.trailStyle,o.chaosIntensity,B]);return{trails:u,trailStates:j,trailSchedule:R,timeBounds:g,cycleDuration:I,documentCanvasSize:O}}export{dt as g,mt 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.