class RedgePak extends RedgeCanvas{ticker=0;busy=!1;done=!0;gutter=20;topgutter=120;row_size=1024;bits=6;d_packet_size=216;ROW_HEIGHT2=3;ROW_HEIGHT=5;plen_sum=0;used_old=0;old_page=0;blk_cnt=0;blk_pos=0;getSync(i){return new Promise((s,t)=>{$.get(i,function(i){var t=new ArrayBuffer(i.length),e=new Uint8Array(t);for(let t=0,s=i.length;tsetTimeout(t,s))}deconstructor(){super.deconstructor()}ii=0;fsize=16;phase=0;p1_page=0;p1_y=0;page_packets=[];packet_cnt=0;mode=0;ftick(){1===this.mode&&this.ftick_pak_mode()}ftick_pak_mode(){if(this.new_blocks)switch(this.phase){case 0:this.iii.plen)&&(i=t);if(i){var e="darkgreen";5{var t=r[f++];if(6==t.opcode&&console.log("poll"),8==t.opcode&&(i=t.data[54],t.blk=i)&&console.log(sprintf("*ACK* b:%2x",i)),7==t.opcode&&79this.row_size?(a=h+this.bsize-this.gutter-this.row_size,e=this.bsize-a,this.rect(this.ox(i.op.src/this.bsize),this.y(i.op.src/this.bsize),e,this.ROW_HEIGHT2,"none","green"),this.rect(this.gutter,o+this.ROW_HEIGHT,a,this.ROW_HEIGHT2,"none","green")):this.rect(this.ox(i.op.src/this.bsize),this.y(i.op.src/this.bsize),this.bsize,this.ROW_HEIGHT2,"none","green")),this.used_old+=this.bsize,i.op.type==t.PATCH){for(var r=[],_=0;_this.row_size+this.gutter?(a=h+this.bsize-this.gutter-this.row_size,this.rect(h-this.row_size,o+this.ROW_HEIGHT,2,this.ROW_HEIGHT2,"none","green")):this.rect(h,o,2,this.ROW_HEIGHT2,"none","green")),_+=1}}this.plen_sum+=i.plen,this.textrect(3*this.gutter+2*this.row_size,this.topgutter-10-this.fsize,sprintf("%5.1fkb/%5.1fkb %.1f%%",this.plen_sum/8192,this.ii*this.bsize/1024,this.plen_sum/8*100/(this.ii*this.bsize)),"black",this.fsize),this.textrect(this.gutter,this.topgutter-10-this.fsize,sprintf("%.1fkb %.1f%%",this.used_old/1024,100*this.used_old/(this.ii*this.bsize)),"black",this.fsize),i.page=Math.floor(this.ii*this.bsize/this.p.flash_page_size),i.page!=this.old_page&&(i.page&&(this.blk_pos=0,this.blk_cnt+=1,this.line(3*this.gutter+2*this.row_size-5,this.topgutter+this.ROW_HEIGHT*this.blk_cnt,3*this.gutter+2*this.row_size+this.d_packet_size+5,this.topgutter+this.ROW_HEIGHT*this.blk_cnt,"blue"),this.blk_cnt+=1),this.old_page=i.page),i.plen&&(this.blk_pos+i.plen/8>this.d_packet_size&&(this.blk_pos=0,this.blk_cnt++),this.rect(3*this.gutter+2*this.row_size+this.blk_pos,this.topgutter+this.ROW_HEIGHT*this.blk_cnt,i.plen/8-1,this.ROW_HEIGHT2,"none",30t+(s===e[i]?1:0),0)}constructor(t,s,i,e){super(t,s,i,e),this.bsize=1<{console.log("PAK Canvas constructed!!"),$$$("dform").update({OLD_FN:this.old_fn,NEW_FN:this.new_fn,PCAP_FN:this.pcap_fn}),$(`#${$$$("dform").id}_DZIP_PAUSE`).hide(),$(`#${$$$("dform").id}_DZIP_CONTINUE`).hide()},0),register_button_handler("DZIP_RUN","index",async t=>{this.mode=1,$(`#${t.form_id}_DZIP_PAUSE`).show(),$(`#${t.form_id}_DZIP_CONTINUE`).hide(),this.rebuild()}),register_button_handler("PCAP_RUN","index",async t=>{this.mode=2,$(`#${t.form_id}_DZIP_PAUSE`).hide(),$(`#${t.form_id}_DZIP_CONTINUE`).hide(),this.rebuild()}),register_button_handler("DZIP_PAUSE","index",async t=>{console.log("tadaa DZIP_PAUSE",this.id,t),this.mode=0,$(`#${t.form_id}_DZIP_PAUSE`).hide(),$(`#${t.form_id}_DZIP_CONTINUE`).show()}),register_button_handler("DZIP_CONTINUE","index",async t=>{console.log("tadaa DZIP_CONTINUE",t),this.mode=1,$(`#${t.form_id}_DZIP_PAUSE`).show(),$(`#${t.form_id}_DZIP_CONTINUE`).hide()}),this.r=t.req_ind("+","pcap","pcap",(t,s)=>{var i,e;7==s.opcode&&(console.log("******* PCAP",s.a,s.payload.data.length),i=Math.floor(s.a/this.row_size),s=Math.floor(s.a-i*this.row_size),i=this.topgutter+i*this.ROW_HEIGHT,e=this.row_size+2*this.gutter+s,s+this.d_packet_size