1import{b as Ie,c as ge,d as g,s as U,j as Ae,e as le,i as z,F as we,n as ie,I as Fe,f as fe,g as $}from"./root-BjqBh5PT.js";import{r}from"./chunk-BV7QT456-ClmWjlzX.js";const Ee=[];var l;(function(c){c.none="none",c.all="all",c.loadFirstFrame="loadFirstFrame",c.loadOnScrollPriorityFrames="loadOnScrollPriorityFrames",c.buffer="buffer",c.circularBuffer="circularBuffer"})(l||(l={}));const be=r.forwardRef(({progress:c,path:R,extension:A="jpg",paddedZeros:w=3,count:o,onImageLoad:Z,onImageError:p,onFirstDraw:S,onLoaded:ee,alpha:re=!0,forcePriorityFramesLoad:j=!1,priorityFrames:W=Ee,loadStrategy:s,queryProps:k,reducedMotion:M=!1,bufferSize:T,...oe},me)=>{const F=r.useRef(null),J=r.useRef(null),N=r.useRef(-1),v=r.useRef(-1),C=r.useRef([]),K=r.useRef(null),I=r.useRef([]),E=r.useRef([]),O=r.useCallback(e=>e===l.buffer||e===l.circularBuffer,[]),ne=r.useRef(O(s)?1+T*2:o),Q=r.useRef(Math.round(c.get()*(o-1))),X=r.useRef(!1),[te,ce]=r.useState(!1),x=r.useRef(!1),se=r.useRef(!1);if(!T&&O(s))return null;const D=r.useRef(W);r.useEffect(()=>{D.current=W},[W]);const[de,P]=Ie({motionValue:!0}),he=ge(F,me,de),i=r.useCallback(()=>{if(v.current===-1)return;const e=v.current,t=J.current,u=C.current[e];!t||!u||!u.complete||!I.current[e]||N.current===e||(v.current=-1,N.current=e,X.current||(t.canvas.width=u.width,t.canvas.height=u.height,X.current=!0,ce(!0),S?.()),t.canvas.width&&t.canvas.height&&t.clearRect(0,0,t.canvas.width,t.canvas.height),t.drawImage(u,0,0))},[S]);r.useEffect(()=>{X.current=!1,ce(!1),C.current=Array.from({length:o},()=>{})},[R,A,w,o]);const d=r.useCallback(e=>Math.min(o-1,Math.max(0,Math.round(o*e))),[o]),ue=r.useCallback(e=>{N.current===-1&&d(c.get())===e&&(v.current=e,g.render(i),U.render(i))},[i,c,d]),_=r.useRef(null),V=r.useCallback((e,t,u,m)=>{E.current[e]=!0,I.current[e]=!1;const n=new Image;n.src=t,C.current[e]=n;const f=()=>{I.current[e]=!0,E.current[e]=!1,Z?.(e);const h=I.current.filter(a=>a===!0),B=E.current.filter(a=>a===!0);h.length>=ne.current&&B.length===0&&(F?.current&&(_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{F.current&&(F.current.dataset.ready="true")},100)),ee?.()),ue(e),n.removeEventListener("load",f),n.removeEventListener("error",L)},L=()=>{p?.(e),I.current[e]=!1,E.current[e]=!1,n.removeEventListener("load",f),n.removeEventListener("error",L)};return C.current[e]=n,u.push(f),m.push(L),n.complete?f():(n.addEventListener("load",f),n.addEventListener("error",L)),()=>{C.current.map((h,B)=>{h&&(h.removeEventListener("load",u?.[B]),h.removeEventListener("error",m?.[B]))})}},[Z,p,ee,ue,ne]),q=r.useCallback((e,t,u)=>{if(e)for(let m=0;m<e.length;m++){const n=e[m];I.current[n]!==!0&&E.current[n]!==!0&&(n>=o||V(n,Y(n,R,w,A,k),t,u))}},[o,A,w,R,k,V]),Y=(e,t,u,m,n)=>`${t}/${`${e}`.padStart(u,"0")}.${m}${n?`?${n}`:""}`,ae=r.useCallback((e,t,u,m=!1)=>{if(!m){const n=Math.max(0,t-u),f=t+u;return e>=n&&e<=f}for(let n=-u;n<=u;n++){const f=(t+n+o)%o;if(e===f)return!0}return!1},[o]),G=r.useRef(null),b=r.useCallback(()=>{if(g.render(i),M){x.current&&K.current.src===""&&(K.current.src=Y(d(c.get()),R,w,A,k));return}if(J.current=F.current?.getContext("2d",{alpha:re,desynchronized:!0})??null,!J.current)return;const t=s!==l.loadFirstFrame&&s!==l.loadOnScrollPriorityFrames||P.get();se.current=t;let u=[],m=[];N.current=-1,F?.current&&(F.current.dataset.ready="false");const n=d(c.get());let f,L;s===l.loadOnScrollPriorityFrames?f=[n,...D.current]:s===l.loadFirstFrame?(Q.current?f=[Q.current]:f=[n],L=[...D.current]):f=[n,...D.current];let h=!1;(j||!j&&(s===l.none||s===l.loadOnScrollPriorityFrames))&&(h=!0,q(f,u,m)),(j||!j&&s===l.loadFirstFrame&&x.current===!0)&&(h=!0,q(L,u,m));for(let a=0;a<o;a++)if(I.current[a]!==!0&&E.current[a]!==!0&&!(!t&&f.indexOf(a)===-1)&&!(h&&f.indexOf(a)!==-1)){if(O(s)){const H=s===l.circularBuffer,ve=Math.round(c.get()*(o-1));if(!ae(a,ve,T,H))continue}V(a,Y(a,R,w,A,k),u,m)}const B=C.current;G.current=()=>{g.render(i),B.map((a,H)=>{a&&(a.removeEventListener("load",u[H]),a.removeEventListener("error",m[H]),a.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEAAAAALAAAAAABAAEAAAI=")}),u=[],m=[]}},[i,M,re,s,P,d,c,j,R,w,A,k,q,o,V,ae,T,O]),Re=()=>{G.current&&(G.current(),G.current=null)};r.useEffect(()=>()=>{Re(),I.current=[],E.current=[],x.current=!1,g.render(i)}
1,[i,R]),r.useEffect(()=>c?.on("change",e=>{const t=d(e);v.current!==t&&(v.current=t,O(s)&&b(),g.render(i),U.render(i))}),[o,i,d,c,s,b,O]);const y=r.useRef(!1);return r.useEffect(()=>{const e=()=>{x.current=!0,y.current||(y.current=!0,b(),window.removeEventListener("scroll",e))};function t(){window.addEventListener("scroll",e)}(s===l.loadOnScrollPriorityFrames||s===l.loadFirstFrame)&&!y.current&&t()},[s,b]),r.useEffect(()=>((s!==l.none||s===void 0)&&s!==l.loadOnScrollPriorityFrames&&b(),P.get()&&(v.current=d(c.get()),g.render(i),U.render(i)),P.on("change",e=>{e?(se.current||b(),v.current=d(c.get()),g.render(i),U.render(i)):g.render(i)})),[i,b,P,s,d,c]),Ae(we,{children:[le(ke,{ref:K,"data-type":"ssr-fallback",src:s===l.none||s===l.loadOnScrollPriorityFrames?void 0:Y(Q.current||0,R,w,A,k),alt:"",showLoadingState:!1,show:z||!z&&!te||M}),le(Le,{ref:he,...oe,show:!z&&te&&!M})]})});be.displayName="ImageSequence";const Le=ie("canvas",fe(!1,"show"))(({show:c})=>$($` 2 display: block; 3 width: 100%; 4 object-fit: contain; 5 opacity: 0; 6 height: 0; 7 margin: 0; 8 padding: 0; 9 `,c&&$` 10 height: 100%; 11 opacity: 1; 12 `)),ke=ie(Fe,fe(!1,"show"))(({show:c})=>$($` 13 opacity: ${c?1:0}; 14 `,!c&&$` 15 height: 0; 16 `));export{l as I,be as a};
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.