(()=>{var le={};(function(D,M){D.SuperGif=M()})(le,function(){var D=function(a){return a.reduce(function(e,p){return e*2+p},0)},M=function(a){for(var e=[],p=7;p>=0;p--)e.push(!!(a&1<=this.data.length)throw new Error("Attempted to read past end of stream.");return a instanceof Uint8Array?a[this.pos++]:a.charCodeAt(this.pos++)&255},this.readBytes=function(e){for(var p=[],_=0;_>3)&1<<(p&7)&&(g|=1<"u"&&(e.auto_play=!s.getAttribute("rel:auto_play")||s.getAttribute("rel:auto_play")=="1");var O=e.hasOwnProperty("on_end")?e.on_end:null,G=e.hasOwnProperty("loop_delay")?e.loop_delay:0,R=e.hasOwnProperty("loop_mode")?e.loop_mode:"auto",L=e.hasOwnProperty("draw_while_loading")?e.draw_while_loading:!0,j=L?e.hasOwnProperty("show_progress_bar")?e.show_progress_bar:!0:!1,q=e.hasOwnProperty("progressbar_height")?e.progressbar_height:25,ce=e.hasOwnProperty("progressbar_background_color")?e.progressbar_background_color:"rgba(255,255,255,0.4)",de=e.hasOwnProperty("progressbar_foreground_color")?e.progressbar_foreground_color:"rgba(255,0,22,.8)",$=function(){P=null,d=null,c=t,t=null,u=null},ee=function(){try{fe(_,ye)}catch{V("parse")}},xe=function(r){U.innerHTML=r,U.style.visibility="visible"},re=function(r,n){C.width=r*y(),C.height=n*y(),U.style.minWidth=r*y()+"px",F.width=r,F.height=n,F.style.width=r+"px",F.style.height=n+"px",F.getContext("2d").setTransform(1,0,0,1,0,0)},ve=function(r,n){if(!I[r]){I[r]=n;return}typeof n.x<"u"&&(I[r].x=n.x),typeof n.y<"u"&&(I[r].y=n.y)},te=function(r,n,h){if(h&&j){var f=q,m,T,b,z;if(e.is_vp){if(E?(b=(e.vp_t+e.vp_h-f)/y(),f=f/y(),m=e.vp_l/y(),T=m+r/n*(e.vp_w/y()),z=C.width/y()):(b=e.vp_t+e.vp_h-f,f=f,m=e.vp_l,T=m+r/n*e.vp_w,z=C.width),!1)if(E)var Z,J,B,K;else var Z,J,B,K}else b=(C.height-f)/(E?y():1),T=r/n*C.width/(E?y():1),z=C.width/(E?y():1),f/=E?y():1;w.fillStyle=ce,w.fillRect(T,b,z-T,f),w.fillStyle=de,w.fillRect(0,b,T,f)}},V=function(r){var n=function(){w.fillStyle="black",w.fillRect(0,0,e.c_w?e.c_w:l.width,e.c_h?e.c_h:l.height),w.strokeStyle="red",w.lineWidth=3,w.moveTo(0,0),w.lineTo(e.c_w?e.c_w:l.width,e.c_h?e.c_h:l.height),w.moveTo(0,e.c_h?e.c_h:l.height),w.lineTo(e.c_w?e.c_w:l.width,0),w.stroke()};S=r,l={width:s.width,height:s.height},v=[],n()},he=function(r){l=r,re(l.width,l.height)},_e=function(r){ae(),$(),P=r.transparencyGiven?r.transparencyIndex:null,d=r.delayTime,t=r.disposalMethod},ae=function(){!u||(v.push({data:u.getImageData(0,0,l.width,l.height),delay:d}),I.push({x:0,y:0}))},ge=function(r){u||(u=F.getContext("2d"));var n=v.length,h=r.lctFlag?r.lct:l.gct;n>0&&(c===3?i!==null?u.putImageData(v[i].data,0,0):u.clearRect(g.leftPos,g.topPos,g.width,g.height):i=n-1,c===2&&u.clearRect(g.leftPos,g.topPos,g.width,g.height));var f=u.getImageData(r.leftPos,r.topPos,r.width,r.height);r.pixels.forEach(function(m,T){m!==P&&(f.data[T*4+0]=h[m][0],f.data[T*4+1]=h[m][1],f.data[T*4+2]=h[m][2],f.data[T*4+3]=255)}),u.putImageData(f,r.leftPos,r.topPos),E||(w.scale(y(),y()),E=!0),L&&(w.drawImage(F,0,0),L=e.auto_play),g=r},N=function(){var r=-1,n=0,h=!1,f=!1,m=function(){var B=o?1:-1;return(r+B+v.length)%v.length},T=function(B){r=r+B,z()},b=function(){var B=!1,K=function(){O!==null&&O(s),n++,R!==!1||n<0?Q():(B=!1,x=!1)},Q=function(){if(B=x,!!B){T(1);var W=v[r].delay*10;W||(W=100);var we=m();we===0?(W+=G,setTimeout(K,W)):setTimeout(Q,W)}};return function(){B||setTimeout(Q,0)}}(),z=function(){var B;r=parseInt(r,10),r>v.length-1&&(r=0),r<0&&(r=0),B=I[r],F.getContext("2d").putImageData(v[r].data,B.x,B.y),w.globalCompositeOperation="copy",w.drawImage(F,0,0)},Z=function(){x=!0,b()},J=function(){x=!1};return{init:function(){S||(e.c_w&&e.c_h||w.scale(y(),y()),e.auto_play?b():(r=0,z()))},step:b,play:Z,pause:J,playing:x,move_relative:T,current_frame:function(){return r},length:function(){return v.length},move_to:function(B){r=B,z()}}}(),ne=function(r){te(_.pos,_.data.length,r)},oe=function(){},H=function(r,n){return function(h){r(h),ne(n)}},ye={hdr:H(he),gce:H(_e),com:H(oe),app:{NETSCAPE:H(oe)},img:H(ge,!0),eof:function(r){ae(),ne(!1),e.c_w&&e.c_h||(C.width=l.width*y(),C.height=l.height*y()),N.init(),A=!1,k&&k(s)}},ie=function(){var r=s.parentNode,n=document.createElement("div");C=document.createElement("canvas"),w=C.getContext("2d"),U=document.createElement("div"),F=document.createElement("canvas"),n.width=C.width=s.width,n.height=C.height=s.height,U.style.minWidth=s.width+"px",n.className="jsgif",U.className="jsgif_toolbar",n.appendChild(C),n.appendChild(U),r.insertBefore(n,s),r.removeChild(s),e.c_w&&e.c_h&&re(e.c_w,e.c_h),X=!0},y=function(){var r;return e.max_width&&l&&l.width>e.max_width?r=e.max_width/l.width:r=1,r},C,w,U,F,X=!1,k=!1,se=function(r){return A?!1:(r?k=r:k=!1,A=!0,v=[],$(),i=null,c=null,u=null,g=null,!0)};return{play:N.play,pause:N.pause,move_relative:N.move_relative,move_to:N.move_to,get_playing:function(){return x},get_canvas:function(){return C},get_canvas_scale:function(){return y()},get_loading:function(){return A},get_auto_play:function(){return e.auto_play},get_length:function(){return N.length()},get_current_frame:function(){return N.current_frame()},load_url:function(r,n){if(!!se(n)){var h=new XMLHttpRequest;h.open("GET",r,!0),"overrideMimeType"in h?h.overrideMimeType("text/plain; charset=x-user-defined"):"responseType"in h?h.responseType="arraybuffer":h.setRequestHeader("Accept-Charset","x-user-defined"),h.onloadstart=function(){X||ie()},h.onload=function(f){this.status!=200&&V("xhr - response"),"response"in this||(this.response=new VBArray(this.responseText).toArray().map(String.fromCharCode).join(""));var m=this.response;m.toString().indexOf("ArrayBuffer")>0&&(m=new Uint8Array(m)),_=new Y(m),setTimeout(ee,0)},h.onprogress=function(f){f.lengthComputable&&te(f.loaded,f.total,!0)},h.onerror=function(){V("xhr")},h.send()}},load:function(r){this.load_url(s.getAttribute("rel:animated_src")||s.src,r)},load_raw:function(r,n){!se(n)||(X||ie(),_=new Y(r),setTimeout(ee,0))},set_frame_offset:ve}};return pe});var me=le.SuperGif;})();