bfg-common 1.1.106 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/minify.js +126 -51
  2. package/package.json +4 -2
  3. package/plugins/spice-console/spice.console.ts +3 -113
  4. package/public/spice-console-minify/run.min.js +68 -96
  5. package/public/spice-console-minify/application/WorkerProcess.min.js +0 -1
  6. package/public/spice-console-minify/application/WorkerProcess_back.min.js +0 -1
  7. package/public/spice-console-minify/application/WorkerProcess_meta.min.js +0 -1
  8. package/public/spice-console-minify/application/WorkerProcess_reverse.min.js +0 -1
  9. package/public/spice-console-minify/application/agent.min.js +0 -1
  10. package/public/spice-console-minify/application/application.min.js +0 -1
  11. package/public/spice-console-minify/application/checkActivity.min.js +0 -1
  12. package/public/spice-console-minify/application/clientgui.min.js +0 -1
  13. package/public/spice-console-minify/application/clipboard/clipboarddataparser.min.js +0 -1
  14. package/public/spice-console-minify/application/clipboard/local/localClipboard.min.js +0 -1
  15. package/public/spice-console-minify/application/clipboard.min.js +0 -1
  16. package/public/spice-console-minify/application/codec.min.js +0 -1
  17. package/public/spice-console-minify/application/imagecache.min.js +0 -1
  18. package/public/spice-console-minify/application/inputmanager.min.js +0 -1
  19. package/public/spice-console-minify/application/packetfactory.min.js +0 -1
  20. package/public/spice-console-minify/application/packetfilter.min.js +0 -1
  21. package/public/spice-console-minify/application/packetprocess.min.js +0 -1
  22. package/public/spice-console-minify/application/rasteroperation.min.js +0 -1
  23. package/public/spice-console-minify/application/spiceconnection.min.js +0 -1
  24. package/public/spice-console-minify/application/stream.min.js +0 -1
  25. package/public/spice-console-minify/application/virtualmouse.min.js +0 -1
  26. package/public/spice-console-minify/keymaps/keyevent.min.js +0 -1
  27. package/public/spice-console-minify/keymaps/keymap.min.js +0 -1
  28. package/public/spice-console-minify/keymaps/keymapes.min.js +0 -1
  29. package/public/spice-console-minify/keymaps/keymapesObj.min.js +0 -1
  30. package/public/spice-console-minify/keymaps/keymapus.min.js +0 -1
  31. package/public/spice-console-minify/keymaps/scanCodeObjModifier.min.js +0 -1
  32. package/public/spice-console-minify/keymaps/scanCodeObjProvider.min.js +0 -1
  33. package/public/spice-console-minify/lib/AsyncConsumer.min.js +0 -1
  34. package/public/spice-console-minify/lib/AsyncWorker.min.js +0 -1
  35. package/public/spice-console-minify/lib/CollisionDetector.min.js +0 -1
  36. package/public/spice-console-minify/lib/DataLogger.min.js +0 -1
  37. package/public/spice-console-minify/lib/GenericObjectPool.min.js +0 -1
  38. package/public/spice-console-minify/lib/GlobalPool.min.js +0 -1
  39. package/public/spice-console-minify/lib/ImageUncompressor.min.js +0 -1
  40. package/public/spice-console-minify/lib/IntegrationBenchmark.min.js +0 -1
  41. package/public/spice-console-minify/lib/PacketWorkerIdentifier.min.js +0 -1
  42. package/public/spice-console-minify/lib/SyncAsyncHandler.min.js +0 -1
  43. package/public/spice-console-minify/lib/base64.min.js +0 -1
  44. package/public/spice-console-minify/lib/biginteger.min.js +0 -1
  45. package/public/spice-console-minify/lib/bowser.min.js +0 -1
  46. package/public/spice-console-minify/lib/decoder/dixie.min.js +0 -5
  47. package/public/spice-console-minify/lib/decoder/jmuxer.min.js +0 -1
  48. package/public/spice-console-minify/lib/displayRouter.min.js +0 -1
  49. package/public/spice-console-minify/lib/encrypt.min.js +0 -1
  50. package/public/spice-console-minify/lib/flipper.min.js +0 -1
  51. package/public/spice-console-minify/lib/graphic.min.js +0 -1
  52. package/public/spice-console-minify/lib/graphicdebug.min.js +0 -1
  53. package/public/spice-console-minify/lib/images/bitmap.min.js +0 -1
  54. package/public/spice-console-minify/lib/images/jsquic_family.min.js +0 -1
  55. package/public/spice-console-minify/lib/images/jsquic_rgba.min.js +0 -1
  56. package/public/spice-console-minify/lib/images/jsquic_uncompress.min.js +0 -1
  57. package/public/spice-console-minify/lib/images/lz.min.js +0 -1
  58. package/public/spice-console-minify/lib/images/png.min.js +0 -1
  59. package/public/spice-console-minify/lib/jgestures.min.js +0 -25
  60. package/public/spice-console-minify/lib/jquery-2.0.3.min.js +0 -25
  61. package/public/spice-console-minify/lib/jquery-mousewheel.min.js +0 -12
  62. package/public/spice-console-minify/lib/jquery-visibility.min.js +0 -2
  63. package/public/spice-console-minify/lib/jsbn.min.js +0 -1
  64. package/public/spice-console-minify/lib/jsbn2.min.js +0 -1
  65. package/public/spice-console-minify/lib/lodash.4.0.0.min.js +0 -6
  66. package/public/spice-console-minify/lib/modernizr.min.js +0 -1
  67. package/public/spice-console-minify/lib/pixastic.min.js +0 -1
  68. package/public/spice-console-minify/lib/prettyprint.min.js +0 -1
  69. package/public/spice-console-minify/lib/prng4.min.js +0 -1
  70. package/public/spice-console-minify/lib/queue.min.js +0 -1
  71. package/public/spice-console-minify/lib/rasterEngine.min.js +0 -1
  72. package/public/spice-console-minify/lib/rng.min.js +0 -1
  73. package/public/spice-console-minify/lib/runqueue.min.js +0 -1
  74. package/public/spice-console-minify/lib/sha1.min.js +0 -1
  75. package/public/spice-console-minify/lib/stuckkeyshandler.min.js +0 -1
  76. package/public/spice-console-minify/lib/timelapsedetector.min.js +0 -1
  77. package/public/spice-console-minify/lib/utils.min.js +0 -1
  78. package/public/spice-console-minify/lib/virtualjoystick.min.js +0 -1
  79. package/public/spice-console-minify/network/busconnection.min.js +0 -1
  80. package/public/spice-console-minify/network/clusternodechooser.min.js +0 -1
  81. package/public/spice-console-minify/network/connectioncontrol.min.js +0 -1
  82. package/public/spice-console-minify/network/packetcontroller.min.js +0 -1
  83. package/public/spice-console-minify/network/packetextractor.min.js +0 -1
  84. package/public/spice-console-minify/network/packetlinkfactory.min.js +0 -1
  85. package/public/spice-console-minify/network/packetreassembler.min.js +0 -1
  86. package/public/spice-console-minify/network/reassemblerfactory.min.js +0 -1
  87. package/public/spice-console-minify/network/sizedefiner.min.js +0 -1
  88. package/public/spice-console-minify/network/socket.min.js +0 -1
  89. package/public/spice-console-minify/network/socketqueue.min.js +0 -1
  90. package/public/spice-console-minify/network/spicechannel.min.js +0 -1
  91. package/public/spice-console-minify/network/websocketwrapper.min.js +0 -1
  92. package/public/spice-console-minify/process/busprocess.min.js +0 -1
  93. package/public/spice-console-minify/process/cursorprocess.min.js +0 -1
  94. package/public/spice-console-minify/process/displaypreprocess.min.js +0 -1
  95. package/public/spice-console-minify/process/displayprocess.min.js +0 -1
  96. package/public/spice-console-minify/process/inputprocess.min.js +0 -1
  97. package/public/spice-console-minify/process/mainprocess.min.js +0 -1
  98. package/public/spice-console-minify/process/playbackprocess.min.js +0 -1
  99. package/public/spice-console-minify/spiceobjects/generated/protocol.min.js +0 -1
  100. package/public/spice-console-minify/spiceobjects/spiceobjects.min.js +0 -1
  101. package/public/spice-console-minify/swcanvas/swcanvas.min.js +0 -1
@@ -1 +0,0 @@
1
- function dispatch(t,e){var i=new Uint8Array(t),r=i[3],o=null,_=i[0];if(_===wdi.WorkerOperations.quic)try{o=wdi.JSQuic.quic_decode(t)}catch(t){}else if(_===wdi.WorkerOperations.lz_rgb)try{o=wdi.LZSS.lz_rgb32_decompress_rgb(t)}catch(t){}else if(_===wdi.WorkerOperations.bytesToUriJpeg)try{return o=bytesToURI(i,"jpeg"),void self.postMessage(o)}catch(t){}else if(_===wdi.WorkerOperations.bytesToUriPng)try{return o=bytesToURI(i,"png"),void self.postMessage(o)}catch(t){}if(!e||!o)return o;r?self.postMessage(o,[o]):self.postMessage(o)}function bytesToURI(t,e){for(var i="data:image/"+e+",",r=t.length,o=4;o<r;o++)t[o]<16?i+="%0":i+="%",i+=t[o].toString(16);return i}function bytesToInt16(t){var e=t.shift();return t.shift()*Math.pow(16,2)+e}function bytesToInt32(t){var e=bytesToInt16(t);return bytesToInt16(t)*Math.pow(16,4)+e}function wdi_quic_QuicFamily(){this.notGRcwlen=[],this.nGRcodewords=[],this.notGRprefixmask=[],this.notGRsuffixlen=[],this.xlatU2L=[],this.xlatL2U=[]}function wdi_quic_s_bucket(){this.pcounters=null,this.bestcode=0}function wdi_quic_CommonState(){this.wm_trigger=this,this.encoder=null,this.waitcnt=0,this.tabrand_seed=wdi.JSQuic.stabrand(),this.wmidx=wdi.JSQuic.DEFwmistart,this.wmileft=wdi.JSQuic.wminext,wdi.JSQuic.set_wm_trigger(this),this.melcstate=0,this.melclen=wdi.JSQuic.J[0],this.melcorder=1<<this.melclen>>>0}function wdi_quic_FamilyStat(){this.buckets_buf=null,this.buckets_ptrs=null,this.counters=0}function wdi_quic_Channel(){this.encoder=null,this.correlate_row_width=0,this.correlate_row=null,this._buckets_ptrs=null,this.family_stat_8bpc=new wdi_quic_FamilyStat,this.family_stat_5bpc=new wdi_quic_FamilyStat,this.state=new wdi_quic_CommonState,this.oldFirst=0}function wdi_quic_Encoder(t){this.computedWidth=0,this.result=[],this.cnt=0,this.pxCnt=0,this.usr=t,this.type=null,this.width=null,this.height=null,this.num_channels=null,this.n_buckets_8bpc=null,this.n_buckets_5bpc=null,this.io_available_bits=32,this.io_now=0,this.io_next_word=null,this.io_now=null,this.read_io_word(),this.io_word=this.io_next_word,this.read_io_word(),this.io_words_count=t.length,this.rows_completed=0,this.channels=[],this.alphaPos=3,this.rgb_state=new wdi_quic_CommonState;for(var e=0;e<4;e++)this.channels[e]=new wdi_quic_Channel,wdi.JSQuic.initChannel(this,this.channels[e])}function cnt_l_zeroes(t){return t>8388607?wdi.JSQuic.lzeroes[t>>>24]:t>32767?8+wdi.JSQuic.lzeroes[t>>>16&255]:t>127?16+wdi.JSQuic.lzeroes[t>>>8&255]:24+wdi.JSQuic.lzeroes[255&t]}function golomb_code_len(t,e){return t<wdi.nGRcodewords[e]?1+(t>>>e)+e:wdi.notGRcwlen[e]}function golomb_decoding(t,e,i,r,o,_,n){var s,a;if(e>r[t]){var c=cnt_l_zeroes(e);a=c<<t|e>>>32-(s=c+1+t)&i[t]}else s=o[t],a=_[t]+(e>>>32-s&i[n[t]]);return[a,s]}function real_update_model(t,e,i,r,o){var _,n,s,a,c=e.pcounters;for(s=c[n=r-1]+=golomb_code_len(i,n),_=r-2;_>=0;_--)(a=c[_]+=golomb_code_len(i,_))<s&&(n=_,s=a);if(e.bestcode=n,s>t.wm_trigger)for(;r-- >0;)c[r]>>>=1}function UPDATE_MODEL(t,e,i,r,o,_){real_update_model(e.rgb_state,find_bucket(e.channels[0],r[t-1]),r[t],i),real_update_model(e.rgb_state,find_bucket(e.channels[1],o[t-1]),o[t],i),real_update_model(e.rgb_state,find_bucket(e.channels[2],_[t-1]),_[t],i)}function find_bucket(t,e){return void 0===e&&(e=t.oldFirst),t._buckets_ptrs[e]}function QUIC_UNCOMPRESS_RGBA(t,e,i,r){quic_uncompress_row0(t,e,i,r),quic_four_uncompress_row0(t,t.channels[3],i,r),t.row_completed();for(var o=t.height,_=t.rgb_state,n=1;n<o;n++)quic_uncompress_row_a(t,e,i,r,_),quic_four_uncompress_row(t,t.channels[3],i,r),t.row_completed()}function quic_four_uncompress_row(t,e,i,r){for(var o=wdi.JSQuic.BPC_MASK[r],_=0,n=t.width;wdi.JSQuic.wmimax>e.state.wmidx&&e.state.wmileft<=n;)e.state.wmileft&&(uncompress_four_row_seg(t,e,_,_+e.state.wmileft,i,o,r),_+=e.state.wmileft,n-=e.state.wmileft),e.state.wmidx++,wdi.JSQuic.set_wm_trigger(e.state),e.state.wmileft=wdi.JSQuic.wminext;n&&(uncompress_four_row_seg(t,e,_,_+n,i,o,r),wdi.JSQuic.wmimax>e.state.wmidx&&(e.state.wmileft-=n))}function uncompress_four_row_seg(t,e,i,r,o,_,n){var s,a,c,d,w=e.correlate_row,l=0,u=wdi.JSQuic.bppmask[e.state.wmidx],f=0,m=0,b=!1,p=t.computedWidth,h=t.rows_completed,E=(t.rows_completed-1)*p,S=t.eatbits,R=t.appendAlpha,A=wdi.JSQuic.bppmask,g=wdi.notGRprefixmask,x=wdi.notGRcwlen,G=wdi.nGRcodewords,Q=wdi.notGRsuffixlen;for(i?(l=i+e.state.waitcnt,a=t.result[t.alphaPos-4]):(a=UNCOMPRESS_ONE_0_A(e,t,_,E),e.state.waitcnt?--e.state.waitcnt:(e.state.waitcnt=wdi.JSQuic.tabrand(e.state)&u,real_update_model(e.state,find_bucket(e,w[-1]),w[0],o)),l=++i+e.state.waitcnt);;){for(;l<r;){for(;i<=l&&!(b=RLE_PRED_A(i,t,f,p,h));i++)s=(c=golomb_decoding(find_bucket(e,w[i-1]).bestcode,t.io_word,A,g,x,G,Q))[0],d=c[1],w[i]=s,a=(wdi.xlatL2U[s]+(a+PIXEL_B(e,t,i,E)>>>1)&_)>>>0,R.call(t,a),S(d,t);if(b)break;real_update_model(e.state,find_bucket(e,w[l-1]),w[l],o),l=i+(wdi.JSQuic.tabrand(e.state)&u)}if(!b){for(;i<r&&!(b=RLE_PRED_A(i,t,f,p,h));i++)s=(c=golomb_decoding(find_bucket(e,w[i-1]).bestcode,t.io_word,A,g,x,G,Q))[0],d=c[1],w[i]=s,a=(wdi.xlatL2U[s]+(a+PIXEL_B(e,t,i,E)>>>1)&_)>>>0,R.call(t,a),S(d,t);if(!b)return void(e.state.waitcnt=l-r)}e.state.waitcnt=l-i,f=i,m=i+wdi.JSQuic.decode_channel_run(t,e);for(var v=t.rows_completed*(4*t.width)+4*i,P=t.result[v-1];i<m;i++)R.call(t,P);if(i===r)return;l=i+e.state.waitcnt,b=!1}}function quic_four_uncompress_row0(t,e,i,r){for(var o=wdi.JSQuic.BPC_MASK[r],_=0,n=t.width;wdi.JSQuic.wmimax>e.state.wmidx&&e.state.wmileft<=n;)e.state.wmileft&&(uncompress_four_row0_seg(t,e,_,_+e.wmileft,wdi.JSQuic.bppmask[e.state.wmidx],i,o,r),_+=e.state.wmileft,n-=e.state.wmileft),e.state.wmidx++,wdi.JSQuic.set_wm_trigger(e.state),e.state.wmileft=wdi.JSQuic.wminext;n&&(uncompress_four_row0_seg(t,e,_,_+n,wdi.JSQuic.bppmask[e.state.wmidx],i,o,r),wdi.JSQuic.wmimax>e.state.wmidx&&(e.state.wmileft-=n))}function uncompress_four_row0_seg(t,e,i,r,o,_,n,s){var a=e.correlate_row,c=0;for(i?c=i+e.state.waitcnt:(UNCOMPRESS_ONE_ROW0_0_A(e),e.state.waitcnt?--e.state.waitcnt:(e.state.waitcnt=wdi.JSQuic.tabrand(e.state)&o,real_update_model(e.state,find_bucket(e,a[-1]),a[0],_)),c=++i+e.state.waitcnt);c<r;){for(;i<=c;i++)UNCOMPRESS_ONE_ROW0_A(e,i,n,t,a);real_update_model(e.state,find_bucket(e,a[c-1]),a[c],_),c=i+(wdi.JSQuic.tabrand(e.state)&o)}for(;i<r;i++)UNCOMPRESS_ONE_ROW0_A(e,i,n,t,a);e.state.waitcnt=c-r}function SAME_PIXEL_A(t,e){return e[t-1]===e[t+3]}function RLE_PRED_A(t,e,i,r,o){var _=(o-1)*r+4*t;return!!(i!==t&&t>2&&SAME_PIXEL_A(_,e.result)&&SAME_PIXEL_A(_=o*r+4*(t-1),e.result))}function UNCOMPRESS_ONE_0_A(t,e,i,r){var o,_;t.oldFirst=t.correlate_row[0],o=golomb_decoding(find_bucket(t,t.correlate_row[-1]).bestcode,e.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen),t.correlate_row[0]=o[0],_=o[1];var n=(wdi.xlatL2U[t.correlate_row[0]]+PIXEL_B(t,e,0,r)&i)>>>0;return e.appendAlpha(n),e.eatbits(_,e),n}function UNCOMPRESS_ONE_A(t,e,i,r,o,_){var n,s,a=(n=golomb_decoding(find_bucket(t,o[e-1]).bestcode,r.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen))[0];s=n[1],o[e]=a,r.appendAlpha((wdi.xlatL2U[a]+(PIXEL_A_A(r)+PIXEL_B(t,r,e,_)>>>1)&i)>>>0),r.eatbits(s,r)}function UNCOMPRESS_ONE_ROW0_0_A(t){var e,i,r=t.encoder;e=golomb_decoding(find_bucket(t,0).bestcode,r.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen),t.correlate_row[0]=e[0],i=e[1],r.appendAlpha(wdi.xlatL2U[t.correlate_row[0]]),r.eatbits(i,r)}function UNCOMPRESS_ONE_ROW0_A(t,e,i,r,o){var _,n,s=(_=golomb_decoding(find_bucket(t,o[e-1]).bestcode,r.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen))[0];n=_[1],o[e]=s,r.appendAlpha(CORELATE_0_A(r,t,e,i,o)),r.eatbits(n,r)}function CORELATE_0_A(t,e,i,r,o){return(wdi.xlatL2U[o[i]]+PIXEL_A_A(t)&r)>>>0}function PIXEL_A_A(t){return t.result[t.alphaPos-4]}function QUIC_UNCOMPRESS_RGB(t,e,i,r){quic_uncompress_row0(t,e,i,r),t.row_completed();for(var o=t.rgb_state,_=t.height,n=t.result,s=t.resultData,a=t.width,c=wdi.JSQuic.BPC_MASK[r],d=wdi.JSQuic,w=t.channels[0],l=t.channels[1],u=t.channels[2],f=w._buckets_ptrs,m=l._buckets_ptrs,b=u._buckets_ptrs,p=w.correlate_row,h=l.correlate_row,E=u.correlate_row,S=t.computedWidth,R=wdi.xlatL2U,A=wdi.JSQuic.lzeroes,g=wdi.JSQuic.lzeroes8,x=wdi.JSQuic.lzeroes16,G=wdi.JSQuic.lzeroes24,Q=wdi.notGRprefixmask,v=wdi.notGRcwlen,P=wdi.nGRcodewords,k=wdi.notGRsuffixlen,I=t.eatbits,U=wdi.JSQuic.tabrand,L=wdi.JSQuic.decode_run,M=wdi.JSQuic.bppmask,J=(d=wdi.JSQuic,wdi.JSQuic.tabrand_chaos),y=d.TABRAND_SEEDMASK,O=t.usr,T=1;T<_;T++)quic_uncompress_row(t,e,i,r,o,-16777216,n,s,a,c,d,w,l,u,f,m,b,p,h,E,S,R,A,g,x,G,Q,v,P,k,I,U,L,M,J,y,O),t.rows_completed++}function quic_uncompress_row(t,e,i,r,o,_,n,s,a,c,d,w,l,u,f,m,b,p,h,E,S,R,A,g,x,G,Q,v,P,k,I,U,L,M,J,y,O){for(var T=0,C=t.rows_completed,N=C*S/4,z=(C-1)*S;d.wmimax>o.wmidx&&o.wmileft<=a;)o.wmileft&&(uncompress_row_seg(t,T,T+o.wmileft,i,c,r,o,_,n,s,w,l,u,f,m,b,p,h,E,S,R,A,g,x,G,Q,v,P,k,I,U,L,M,d,J,C,y,z,N,O),T+=o.wmileft,a-=o.wmileft),o.wmidx++,d.set_wm_trigger(o),o.wmileft=d.wminext;a&&(uncompress_row_seg(t,T,T+a,i,c,r,o,_,n,s,w,l,u,f,m,b,p,h,E,S,R,A,g,x,G,Q,v,P,k,I,U,L,M,d,J,C,y,z,N,O),d.wmimax>t.rgb_state.wmidx&&(o.wmileft-=a))}function quic_uncompress_row_a(t,e,i,r,o){for(var _=wdi.JSQuic.BPC_MASK[r],n=0,s=t.width;wdi.JSQuic.wmimax>o.wmidx&&o.wmileft<=s;)o.wmileft&&(uncompress_row_seg_a(t,n,n+o.wmileft,i,_,r,o),n+=o.wmileft,s-=o.wmileft),o.wmidx++,wdi.JSQuic.set_wm_trigger(o),o.wmileft=wdi.JSQuic.wminext;s&&(uncompress_row_seg_a(t,n,n+s,i,_,r,o),wdi.JSQuic.wmimax>t.rgb_state.wmidx&&(o.wmileft-=s))}function SAME_PIXEL_RGB_A(t,e){return e[t-4]===e[t]&&e[t-3]===e[t+1]&&e[t-2]===e[t+2]}function SAME_PIXEL(t,e){return e[t-1]===e[t]}function RLE_PRED_RGB_A(t,e,i,r,o){if(o!==t&&t>2&&(SAME_PIXEL_RGB_A(i,e.result)&&SAME_PIXEL_RGB_A(r+4*(t-1),e.result)))return!0;return!1}function RLE_PRED(t,e,i,r,o){if(o!==t&&t>2&&(SAME_PIXEL(4*i,e.result)&&SAME_PIXEL(4*(r+t-1),e.result)))return!0;return!1}function uncompress_row_seg(t,e,i,r,o,_,n,s,a,c,d,w,l,u,f,m,b,p,h,E,S,R,A,g,x,G,Q,v,P,k,I,U,L,M,J,y,O,T,C,N){var z,D,B,q,Y,W,X,F,Z,K,V,H,j,$,tt,et,it,rt,ot,_t=0,nt=L[n.wmidx],st=0,at=!1,ct=t.cnt,dt=t.pxCnt;for(e?(_t=e+n.waitcnt,B=a[ct-4],q=a[ct-3],Y=a[ct-2],W=b[e-1],X=p[e-1],F=h[e-1]):(B=UNCOMPRESS_ONE_0(d,t,o,T),q=UNCOMPRESS_ONE_0(w,t,o,T),Y=UNCOMPRESS_ONE_0(l,t,o,T),W=b[0],X=p[0],F=h[0],c[dt++]=255<<24|Y<<16|q<<8|B,n.waitcnt?--n.waitcnt:(n.waitcnt=I.call(M,n)&nt,UPDATE_MODEL(0,t,r,b,p,h)),_t=++e+n.waitcnt);;){for(;_t<i;){for(D=T+4*e;e<=_t;e++){if(c[($=D/4)-1]===c[$]&&c[(j=C+e-1)-1]===c[j]&&st!==e&&e>2){at=!0;break}K=u[W].bestcode,(V=t.io_word)>G[K]?W=(H=V>8388607?R[V>>>24]:V>32767?A[V>>>16&255]:V>127?g[V>>>8&255]:x[255&V])<<K|V>>>32-(Z=H+1+K)&L[K]:(Z=Q[K],W=v[K]+(V>>>32-Z&L[P[K]])),b[e]=W,B=S[W]+(B+a[D++]>>>1)&o,et=t.io_available_bits,it=t.io_word,it<<=Z,(rt=et-Z)>=0?(it=(it|t.io_next_word>>>rt)>>>0,t.io_available_bits=rt,t.io_word=it):(it=((it|=(ot=t.io_next_word)<<(rt=-rt)>>>0)|(ot=N[t.io_now++])>>>(et=32-rt))>>>0,t.io_available_bits=et,t.io_word=it,t.io_next_word=ot),K=f[X].bestcode,(V=t.io_word)>G[K]?X=(H=V>8388607?R[V>>>24]:V>32767?A[V>>>16&255]:V>127?g[V>>>8&255]:x[255&V])<<K|V>>>32-(Z=H+1+K)&L[K]:(Z=Q[K],X=v[K]+(V>>>32-Z&L[P[K]])),p[e]=X,q=S[X]+(q+a[D++]>>>1)&o,et=t.io_available_bits,it=t.io_word,it<<=Z,(rt=et-Z)>=0?(it=(it|t.io_next_word>>>rt)>>>0,t.io_available_bits=rt,t.io_word=it):(it=((it|=(ot=t.io_next_word)<<(rt=-rt)>>>0)|(ot=N[t.io_now++])>>>(et=32-rt))>>>0,t.io_available_bits=et,t.io_word=it,t.io_next_word=ot),K=m[F].bestcode,(V=t.io_word)>G[K]?F=(H=V>8388607?R[V>>>24]:V>32767?A[V>>>16&255]:V>127?g[V>>>8&255]:x[255&V])<<K|V>>>32-(Z=H+1+K)&L[K]:(Z=Q[K],F=v[K]+(V>>>32-Z&L[P[K]])),h[e]=F,Y=S[F]+(Y+a[D++]>>>1)&o,et=t.io_available_bits,it=t.io_word,it<<=Z,(rt=et-Z)>=0?(it=(it|t.io_next_word>>>rt)>>>0,t.io_available_bits=rt,t.io_word=it):(it=((it|=(ot=t.io_next_word)<<(rt=-rt)>>>0)|(ot=N[t.io_now++])>>>(et=32-rt))>>>0,t.io_available_bits=et,t.io_word=it,t.io_next_word=ot),c[dt++]=s|Y<<16|q<<8|B,D++}if(at)break;real_update_model(n,u[b[tt=_t-1]],b[_t],r),real_update_model(n,f[p[tt]],p[_t],r),real_update_model(n,m[h[tt]],h[_t],r),n.tabrand_seed++,_t=e+(J[n.tabrand_seed&O]&nt)}if(!at){for(D=T+4*e;e<i;e++){if(c[($=D/4)-1]===c[$]&&c[(j=C+e-1)-1]===c[j]&&st!==e&&e>2){at=!0;break}K=u[W].bestcode,(V=t.io_word)>G[K]?W=(H=V>8388607?R[V>>>24]:V>32767?A[V>>>16&255]:V>127?g[V>>>8&255]:x[255&V])<<K|V>>>32-(Z=H+1+K)&L[K]:(Z=Q[K],W=v[K]+(V>>>32-Z&L[P[K]])),b[e]=W,B=S[W]+(B+a[D++]>>>1)&o,et=t.io_available_bits,it=t.io_word,it<<=Z,(rt=et-Z)>=0?(it=(it|t.io_next_word>>>rt)>>>0,t.io_available_bits=rt,t.io_word=it):(it=((it|=(ot=t.io_next_word)<<(rt=-rt)>>>0)|(ot=N[t.io_now++])>>>(et=32-rt))>>>0,t.io_available_bits=et,t.io_word=it,t.io_next_word=ot),K=f[X].bestcode,(V=t.io_word)>G[K]?X=(H=V>8388607?R[V>>>24]:V>32767?A[V>>>16&255]:V>127?g[V>>>8&255]:x[255&V])<<K|V>>>32-(Z=H+1+K)&L[K]:(Z=Q[K],X=v[K]+(V>>>32-Z&L[P[K]])),p[e]=X,q=S[X]+(q+a[D++]>>>1)&o,et=t.io_available_bits,it=t.io_word,it<<=Z,(rt=et-Z)>=0?(it=(it|t.io_next_word>>>rt)>>>0,t.io_available_bits=rt,t.io_word=it):(it=((it|=(ot=t.io_next_word)<<(rt=-rt)>>>0)|(ot=N[t.io_now++])>>>(et=32-rt))>>>0,t.io_available_bits=et,t.io_word=it,t.io_next_word=ot),K=m[F].bestcode,(V=t.io_word)>G[K]?F=(H=V>8388607?R[V>>>24]:V>32767?A[V>>>16&255]:V>127?g[V>>>8&255]:x[255&V])<<K|V>>>32-(Z=H+1+K)&L[K]:(Z=Q[K],F=v[K]+(V>>>32-Z&L[P[K]])),h[e]=F,Y=S[F]+(Y+a[D++]>>>1)&o,et=t.io_available_bits,it=t.io_word,it<<=Z,(rt=et-Z)>=0?(it=(it|t.io_next_word>>>rt)>>>0,t.io_available_bits=rt,t.io_word=it):(it=((it|=(ot=t.io_next_word)<<(rt=-rt)>>>0)|(ot=N[t.io_now++])>>>(et=32-rt))>>>0,t.io_available_bits=et,t.io_word=it,t.io_next_word=ot),c[dt++]=255<<24|Y<<16|q<<8|B,D++}if(!at)return n.waitcnt=_t-i,t.cnt=4*dt,void(t.pxCnt=dt)}for(n.waitcnt=_t-e,st=e,run_end=U(t),e=run_end+e;run_end-- >0;)c[dt++]=s|Y<<16|q<<8|B;if(e===i)return t.cnt=4*dt,void(t.pxCnt=dt);W=b[z=e-1],X=p[z],F=h[z],_t=e+n.waitcnt,at=!1}}function uncompress_row_seg_a(t,e,i,r,o,_,n){var s,a,c,d,w,l,u,f,m,b,p,h,E=t.channels[0],S=t.channels[1],R=t.channels[2],A=E._buckets_ptrs,g=S._buckets_ptrs,x=R._buckets_ptrs,G=E.correlate_row,Q=S.correlate_row,v=R.correlate_row,P=0,k=wdi.JSQuic.bppmask[n.wmidx],I=0,U=0,L=!1,M=t.computedWidth,J=(t.rows_completed-1)*M,y=t.rows_completed*M,O=(t.rows_completed,t.rows_completed,t.result),T=t.resultData,C=wdi.xlatL2U,N=t.eatbits,z=wdi.JSQuic.tabrand,D=wdi.JSQuic.decode_run,B=(wdi.JSQuic.lzeroes,wdi.JSQuic.lzeroes8,wdi.JSQuic.lzeroes16,wdi.JSQuic.lzeroes24,t.cnt),q=t.pxCnt,Y=wdi.JSQuic.bppmask,W=wdi.notGRprefixmask,X=wdi.notGRcwlen,F=wdi.nGRcodewords,Z=wdi.notGRsuffixlen,K=255<<24;for(e?(P=e+n.waitcnt,c=O[B-4],d=O[B-3],w=O[B-2],l=G[e-1],u=Q[e-1],f=v[e-1]):(c=UNCOMPRESS_ONE_0(E,t,o,J),d=UNCOMPRESS_ONE_0(S,t,o,J),w=UNCOMPRESS_ONE_0(R,t,o,J),l=G[0],u=Q[0],f=v[0],T[q++]=255<<24|w<<16|d<<8|c,n.waitcnt?--n.waitcnt:(n.waitcnt=z.call(wdi.JSQuic,n)&k,UPDATE_MODEL(0,t,r,G,Q,v)),P=++e+n.waitcnt);;){for(;P<i;){for(a=J+4*e;e<=P&&!(L=RLE_PRED_RGB_A(e,t,a,y,I));e++)b=A[l].bestcode,(p=t.io_word)>W[b]?l=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],l=F[b]+(p>>>32-m&Y[Z[b]])),G[e]=l,c=C[l]+(c+O[a++]>>>1)&o,N(m,t),b=g[u].bestcode,(p=t.io_word)>W[b]?u=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],u=F[b]+(p>>>32-m&Y[Z[b]])),Q[e]=u,d=C[u]+(d+O[a++]>>>1)&o,N(m,t),b=x[f].bestcode,(p=t.io_word)>W[b]?f=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],f=F[b]+(p>>>32-m&Y[Z[b]])),v[e]=f,w=C[f]+(w+O[a++]>>>1)&o,N(m,t),T[q++]=K|w<<16|d<<8|c,a++;if(L)break;UPDATE_MODEL(P,t,r,G,Q,v),P=e+(z.call(wdi.JSQuic,n)&k)}if(!L){for(a=J+4*e;e<i&&!(L=RLE_PRED_RGB_A(e,t,a,y,I));e++)b=A[l].bestcode,(p=t.io_word)>W[b]?l=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],l=F[b]+(p>>>32-m&Y[Z[b]])),G[e]=l,c=C[l]+(c+O[a++]>>>1)&o,N(m,t),b=g[u].bestcode,(p=t.io_word)>W[b]?u=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],u=F[b]+(p>>>32-m&Y[Z[b]])),Q[e]=u,d=C[u]+(d+O[a++]>>>1)&o,N(m,t),b=x[f].bestcode,(p=t.io_word)>W[b]?f=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],f=F[b]+(p>>>32-m&Y[Z[b]])),v[e]=f,w=C[f]+(w+O[a++]>>>1)&o,N(m,t),T[q++]=255<<24|w<<16|d<<8|c,a++;if(!L)return n.waitcnt=P-i,t.cnt=4*q,void(t.pxCnt=q)}for(n.waitcnt=P-e,I=e,e=(U=D(t))+e;U-- >0;)T[q++]=K|w<<16|d<<8|c;if(e===i)return t.cnt=4*q,void(t.pxCnt=q);l=G[s=e-1],u=Q[s],f=v[s],P=e+n.waitcnt,L=!1}}function quic_uncompress_row0(t,e,i,r){for(var o=wdi.JSQuic.BPC_MASK[r],_=0,n=t.width;wdi.JSQuic.wmimax>t.rgb_state.wmidx&&t.rgb_state.wmileft<=n;)t.rgb_state.wmileft&&(uncompress_row0_seg(t,_,_+t.rgb_state.wmileft,wdi.JSQuic.bppmask[t.rgb_state.wmidx],i,o,r),_+=t.rgb_state.wmileft,n-=t.rgb_state.wmileft),t.rgb_state.wmidx++,wdi.JSQuic.set_wm_trigger(t.rgb_state),t.rgb_state.wmileft=wdi.JSQuic.wminext;n&&(uncompress_row0_seg(t,_,_+n,wdi.JSQuic.bppmask[t.rgb_state.wmidx],i,o,r),wdi.JSQuic.wmimax>t.rgb_state.wmidx&&(t.rgb_state.wmileft-=n))}function uncompress_row0_seg(t,e,i,r,o,_,n){var s,a,c,d=t.channels[0],w=t.channels[1],l=t.channels[2],u=d.correlate_row,f=w.correlate_row,m=l.correlate_row,b=0;for(e?b=e+t.rgb_state.waitcnt:(s=UNCOMPRESS_ONE_ROW0_0(d),a=UNCOMPRESS_ONE_ROW0_0(w),c=UNCOMPRESS_ONE_ROW0_0(l),t.appendPixel(s,a,c),t.rgb_state.waitcnt?--t.rgb_state.waitcnt:(t.rgb_state.waitcnt=wdi.JSQuic.tabrand(t.rgb_state)&r,UPDATE_MODEL(0,t,o,u,f,m)),b=++e+t.rgb_state.waitcnt);b<i;){for(;e<=b;e++)s=UNCOMPRESS_ONE_ROW0(d,e,_,t,u,s),a=UNCOMPRESS_ONE_ROW0(w,e,_,t,f,a),c=UNCOMPRESS_ONE_ROW0(l,e,_,t,m,c),t.appendPixel(s,a,c);UPDATE_MODEL(b,t,o,u,f,m),b=e+(wdi.JSQuic.tabrand(t.rgb_state)&r)}for(;e<i;e++)s=UNCOMPRESS_ONE_ROW0(d,e,_,t,u,s),a=UNCOMPRESS_ONE_ROW0(w,e,_,t,f,a),c=UNCOMPRESS_ONE_ROW0(l,e,_,t,m,c),t.appendPixel(s,a,c);t.rgb_state.waitcnt=b-i}function UNCOMPRESS_ONE_0(t,e,i,r){var o,_;t.oldFirst=t.correlate_row[0],o=golomb_decoding(find_bucket(t,t.correlate_row[0]).bestcode,e.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen),t.correlate_row[0]=o[0],_=o[1];var n=wdi.xlatL2U[t.correlate_row[0]]+e.result[r+t.num_channel]&i;return e.eatbits(_,e),n}function UNCOMPRESS_ONE(t,e,i,r,o,_,n,s,a,c,d,w,l){var u,f=(m=golomb_decoding(w[n[i]].bestcode,_.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen))[0];u=m[1],n[e]=f;var m=d[f]+(l+a[s+r+c]>>>1)&o;return _.eatbits(u,_),m}function UNCOMPRESS_ONE_ROW0_0(t){var e,i=t.encoder;r=golomb_decoding(find_bucket(t,0).bestcode,i.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen),t.correlate_row[0]=r[0],e=r[1];var r=wdi.xlatL2U[t.correlate_row[0]];return i.eatbits(e,i),r}function UNCOMPRESS_ONE_ROW0(t,e,i,r,o,_){var n;s=golomb_decoding(find_bucket(t,o[e-1]).bestcode,r.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen),o[e]=s[0],n=s[1];var s=CORELATE_0(r,t,e,i,o,_);return r.eatbits(n,r),s}function CORELATE_0(t,e,i,r,o,_){return wdi.xlatL2U[o[i]]+_&r}function PIXEL_A(t){return t.result[t.cnt-4]}function PIXEL_B(t,e,i,r){return e.result[r+4*i+t.num_channel]}window=this,window.wdi||(window.wdi={}),window.wdi.WorkerOperations={quic:0,lz_rgb:1,bytesToUriJpeg:2,bytesToUriPng:3},window.workerDispatch=dispatch,self.addEventListener("message",(function(t){return dispatch(t.data,!0)}),!1),wdi.QuicImageType={QUIC_IMAGE_TYPE_INVALID:0,QUIC_IMAGE_TYPE_GRAY:1,QUIC_IMAGE_TYPE_RGB16:2,QUIC_IMAGE_TYPE_RGB24:3,QUIC_IMAGE_TYPE_RGB32:4,QUIC_IMAGE_TYPE_RGBA:5},wdi.quic={},wdi.JSQuic={QUIC_MAGIC:1364543811,MAXNUMCODES:8,DEFevol:3,MINevol:0,MAXevol:5,DEFwmistart:0,MINwmistart:0,DEFmaxclen:26,DEFwmimax:6,DEFwminext:2048,MINwminext:1,MAXwminext:1e8,MAX_CHANNELS:4,wmimax:6,wminext:2048,evol:3,family_8bpc:new wdi_quic_QuicFamily,family_5bpc:new wdi_quic_QuicFamily,bppmask:new Int32Array([0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215,33554431,67108863,134217727,268435455,536870911,1073741823,2147483647,4294967295]),bitat:new Int32Array([1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648]),TABRAND_TABSIZE:256,TABRAND_SEEDMASK:255,tabrand_chaos:new Int32Array([46495042,893548311,794435923,2453991765,2077388039,894197842,1462934312,697534094,1826128012,343623392,2581292719,3811265708,459739748,2638427270,1654964626,101227083,2654850628,3668700691,572794346,2758751005,3445133904,2344099199,3367450297,898927923,3618406352,1606297603,754696453,20823118,2050458127,972590750,3990194068,3305596553,4239238564,1690498157,3015324227,2306127097,1510321853,548392192,971157512,2292288069,1611390505,4086766286,4084927083,1883326811,1891043243,113180603,1107690783,3778825955,3248980775,2443839100,2190866218,1932072870,495393613,1078522166,4051963518,1784694977,1768732442,2146763203,264646923,1474361405,2361552500,296035746,2489922759,2094565616,2409465348,1334241083,72483606,3740181004,4057920662,1734898312,4114662834,574624900,880305546,3258472262,26713132,1571648456,52557195,4043234286,2458021343,676064371,1528437109,64953873,546717185,2709319979,1947039598,2812723004,28691684,286829174,4235176970,3465707163,12526951,2154766700,3165032534,2036061161,3386656087,2301212354,2023576300,1061142336,3105452904,2743866805,3283373992,3397596080,3085489552,3196092395,3210707808,3651022684,925444321,2088074316,230011220,3223248386,533229176,523863486,3028311159,13140218,2538347282,900399636,3000796173,1526771255,3541282854,2992674461,2135722105,389334227,1225164337,3119947809,1803959919,3471171263,704170491,1407019136,1924534819,526887421,168782227,333811993,298623278,4268451686,381087740,2542899140,3266880867,2498950977,200969370,3511909096,3252303004,2268881098,2499828613,2606499854,3163208665,3790254546,1840025712,1319758833,3771674836,519421307,3512796222,1563402978,4284300462,2263719815,715250337,3178437172,2660191010,2982332026,3256309961,2709659997,3434092872,2367065591,69438718,915160508,183164069,3134331940,175242981,2680543346,1421955782,4231173251,1736652874,3990568476,1710820912,2286604440,3464587098,1261907837,1757387321,1128554270,1090050251,2429922486,1288729218,882830086,211637042,1376462063,2147615815,1737974929,798170275,4271572277,4241687072,1638524620,2760366295,1065115089,2097227717,1224023317,1625204849,3383303351,1488272307,2640186157,1649047732,819719707,2615091943,502645401,760628135,4108137983,63606742,1404337880,1865161130,4272996852,1239761976,790984678,3213322601,1917062825,4195069880,1962259360,2111002573,2311983960,1861406170,511141875,2797510619,1331661048,3130608186,147483493,3767089176,2650841450,4096523407,2574446300,1956416337,851468126,3607527519,1811658703,3642821136,832691095,2453312857,933732854,94341217,3393797730,1695907457,2405722077,2877685663,2469507058,2249636341,3988608661,4001245617,825934927,3103985967,1127151177,3691656896,1640967098,2168932645,2830550957,3998822878,3002602893,1509651465,775813869,2599574079,3791574229]),besttrigtab:[[550,900,800,700,500,350,300,200,180,180,160],[110,550,900,800,550,400,350,250,140,160,140],[100,120,550,900,700,500,400,300,220,250,160]],lzeroes:new Int32Array([8,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),J:new Int32Array([0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,5,5,6,6,7,7,8,9,10,11,12,13,14,15]),zeroLUT:null,BPC_MASK:{4:255,5:255,24:255,16:31},stabrand:function(){return this.TABRAND_SEEDMASK},tabrand:function(t){return t.tabrand_seed++,this.tabrand_chaos[t.tabrand_seed&this.TABRAND_SEEDMASK]},set_wm_trigger:function(t){var e=t.wmidx;e>10&&(e=10),t.wm_trigger=wdi.JSQuic.besttrigtab[Math.floor(wdi.JSQuic.evol>>1)][e]},ceil_log_2:function(t){var e;if(1===t)return 0;for(e=1,t-=1;t>>>=1;)e++;return e},decorelate_init:function(t,e){var i,r=this.bppmask[e],o=r>>>1;for(i=0;i<=r;i++)t.xlatU2L[i]=i<=o?i<<1>>>0:1+(r-i<<1>>>0)},corelate_init:function(t,e){var i,r=this.bppmask[e];for(i=0;i<=r;i++)t.xlatL2U[i]=1&i?r-(i>>>1):i>>>1},family_init:function(t,e,i){var r;for(r=0;r<e;r++){var o,_;(o=i-e)>parseInt(this.bppmask[e-r])&&(o=this.bppmask[e-r]),_=this.bppmask[e]+1-(o<<r>>>0),t.nGRcodewords[r]=o<<r>>>0,t.notGRcwlen[r]=o+this.ceil_log_2(_),t.notGRprefixmask[r]=this.bppmask[32-o],t.notGRsuffixlen[r]=this.ceil_log_2(_)}this.corelate_init(t,e)},init_zeroLUT:function(){var t,e,i,r;for(this.zeroLUT=new Int32Array(256),e=i=1,r=8,t=0;t<256;++t)this.zeroLUT[t]=r,0===--i&&(i=e,--r,e*=2)},quic_init:function(){this.family_init(this.family_8bpc,8,this.DEFmaxclen),this.init_zeroLUT(),wdi.xlatL2U=new Int32Array(this.family_8bpc.xlatL2U.length),wdi.xlatL2U.set(this.family_8bpc.xlatL2U),wdi.notGRprefixmask=new Int32Array(this.family_8bpc.notGRprefixmask.length),wdi.notGRprefixmask.set(this.family_8bpc.notGRprefixmask),wdi.nGRcodewords=new Int32Array(this.family_8bpc.nGRcodewords.length),wdi.nGRcodewords.set(this.family_8bpc.nGRcodewords),wdi.notGRcwlen=new Int32Array(this.family_8bpc.notGRcwlen.length),wdi.notGRcwlen.set(this.family_8bpc.notGRcwlen),wdi.notGRsuffixlen=new Int32Array(this.family_8bpc.notGRsuffixlen.length),wdi.notGRsuffixlen.set(this.family_8bpc.notGRsuffixlen);for(var t=wdi.JSQuic.lzeroes,e=new Int32Array(t),i=t.length,r=0;r<i;r++)e[r]=t[r]+8;wdi.JSQuic.lzeroes8=e;var o=new Int32Array(t);for(r=0;r<i;r++)o[r]=t[r]+16;wdi.JSQuic.lzeroes16=o;var _=new Int32Array(t);for(r=0;r<i;r++)_[r]=t[r]+24;wdi.JSQuic.lzeroes24=_},quic_image_params:function(t,e){var i,r;switch(e){case wdi.QuicImageType.QUIC_IMAGE_TYPE_GRAY:i=1,r=8;break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB16:i=3,r=5;break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB24:case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB32:i=3,r=8;break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGBA:i=4,r=8;break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_INVALID:default:i=0,r=0}return[i,r]},find_model_params:function(t,e){var i=0,r=0,o=0,_=0,n={ncounters:8};switch(n.levels=1<<e,n.n_buckets_ptrs=0,this.evol){case 1:n.repfirst=3,n.firstsize=1,n.repnext=2,n.mulsize=2;break;case 3:n.repfirst=1,n.firstsize=1,n.repnext=1,n.mulsize=2;break;case 5:n.repfirst=1,n.firstsize=1,n.repnext=1,n.mulsize=4;break;default:return wdi.Debug.error("fund model params: invalid evol"),!1}n.nbuckets=0,_=n.repfirst+1,i=n.firstsize;do{r=n.nbuckets?o+1:0,--_||(_=n.repnext,i*=n.mulsize),(o=r+i-1)+i>=n.levels&&(o=n.levels-1),n.n_buckets_ptrs||(n.n_buckets_ptrs=n.levels),n.nbuckets++}while(o<n.levels-1);return n},init_model_structures:function(t,e,i){e.buckets_buf=[];for(var r=0;r<i.nbuckets;r++)e.buckets_buf[r]=new wdi_quic_s_bucket;e.buckets_ptrs=[],e.counters=[],this.fill_model_structures(t,e,i)},fill_model_structures:function(t,e,i){var r,o,_,n,s=0;n=0,_=i.repfirst+1,r=i.firstsize;do{o=n?s+1:0,--_||(_=i.repnext,r*=i.mulsize),(s=o+r-1)+r>=i.levels&&(s=i.levels-1),e.buckets_buf[n].pcounters=new Int32Array(i.ncounters);for(var a=0;a<i.ncounters;a++)e.buckets_buf[n].pcounters[a]=0;for(var c=o;c<=s;c++)e.buckets_ptrs[c]=e.buckets_buf[n];n++}while(s<i.levels-1)},initChannel:function(t,e){e.encoder=t,e.state.encoder=t,e.correlate_row_width=0,e.correlate_row=null;var i=this.find_model_params(t,8);t.n_buckets_8bpc=i.nbuckets,this.init_model_structures(t,e.family_stat_8bpc,i),i=this.find_model_params(t,5),t.n_buckets_5bpc=i.nbuckets,this.init_model_structures(t,e.family_stat_5bpc,i)},encoder_reste_channels:function(t,e,i,r){t.num_channels=e;for(var o=0;o<e;o++){var _,n;if(t.channels[o].correlate_row_width<i&&(t.channels[o].correlate_row=new Array(i),t.channels[o].correlate_row_width=i),t.channels[o].num_channel=o,8===r){_=t.channels[o].family_stat_8bpc.buckets_buf,n=t.n_buckets_8bpc;for(var s=0;s<n;s++)_[s].bestcode=7;t.channels[o]._buckets_ptrs=t.channels[o].family_stat_8bpc.buckets_ptrs}else{if(5!==r)return FALSE;_=t.channels[o].family_stat_5bpc.buckets_buf,n=t.n_buckets_5bpc;for(s=0;s<n;s++)_[s].bestcode=4;t.channels[o]._buckets_ptrs=t.channels[o].family_stat_5bpc.buckets_ptrs}t.channels[o].state.waitcnt=0,t.channels[o].state.tabrand_seed=wdi.JSQuic.stabrand(),t.channels[o].state.wmidx=wdi.JSQuic.DEFwmistart,t.channels[o].state.wmileft=wdi.JSQuic.wminext}return!0},decode_channel_run:function(t,e){for(var i=0;;){var r,o;for(r=wdi.JSQuic.zeroLUT[(~(t.io_word>>>24)>>>0)%256],o=1;o<=r;o++)i+=e.state.melcorder,e.state.melcstate<32&&(e.state.melclen=wdi.JSQuic.J[++e.state.melcstate],e.state.melcorder=1<<e.state.melclen>>>0);if(8!==r){t.eatbits(r+1,t);break}t.eatbits(8,t)}return e.state.melclen&&(i+=t.io_word>>>32-e.state.melclen,t.eatbits(e.state.melclen,t)),e.state.melcstate&&(e.state.melclen=wdi.JSQuic.J[--e.state.melcstate],e.state.melcorder=1<<e.state.melclen>>>0),i},decode_run:function(t){for(var e,i,r,o=0,_=wdi.JSQuic.zeroLUT,n=t.rgb_state,s=wdi.JSQuic.J,a=t.eatbits;;){for(r=(e=_[(~(t.io_word>>>24)>>>0)%256])+1,i=1;i<r;i++)o+=t.rgb_state.melcorder,n.melcstate<32&&(n.melclen=s[++n.melcstate],n.melcorder=1<<n.melclen>>>0);if(8!==e){a(r,t);break}t.eatbits(8,t)}return n.melclen&&(o+=t.io_word>>>32-n.melclen,a(n.melclen,t)),n.melcstate&&(n.melclen=s[--n.melcstate],n.melcorder=1<<n.melclen>>>0),o},quic_decode:function(t){var e=new wdi_quic_Encoder(new Uint32Array(t)),i=65280&e.io_word;e.io_word;e.eat32bits(),e.eat32bits();e.io_word;e.eat32bits();e.io_word;e.eat32bits();var r=e.io_word;e.eat32bits(),e.type=r;var o=e.io_word;e.width=o,e.eat32bits();var _=e.io_word;e.height=_,e.eat32bits();var n=wdi.JSQuic.quic_image_params(e,r),s=n[0],a=n[1];this.encoder_reste_channels(e,s,o,a);var c=new ArrayBuffer(o*_*4),d=new Uint8Array(c);t=new Uint32Array(c);switch(e.result=d,e.resultData=t,e.setComputedWidth(o),r){case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB32:case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB24:QUIC_UNCOMPRESS_RGB(e,s,a,r);break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB16:break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGBA:if(QUIC_UNCOMPRESS_RGBA(e,s,a,r),i)for(var w=d.length-1;w>0;)d[w]=255,w-=4}return c}},wdi.JSQuic.quic_init(),wdi_quic_Encoder.prototype.append=function(t){this.result[this.cnt++]=t},wdi_quic_Encoder.prototype.appendPixel=function(t,e,i){this.resultData[this.pxCnt++]=255<<24|i<<16|e<<8|t,this.cnt+=4},wdi_quic_Encoder.prototype.eatbits=function(t,e){var i=e.io_available_bits,r=e.io_word,o=i-t;if(r<<=t,o>=0)return r=(r|e.io_next_word>>>o)>>>0,e.io_available_bits=o,void(e.io_word=r);var _=e.io_next_word;r=((r|=_<<(o=-o)>>>0)|(_=e.usr[e.io_now++])>>>(i=32-o))>>>0,e.io_available_bits=i,e.io_word=r,e.io_next_word=_},wdi_quic_Encoder.prototype.eat32bits=function(){this.eatbits(16,this),this.eatbits(16,this)},wdi_quic_Encoder.prototype.read_io_word=function(){this.io_next_word=this.usr[this.io_now++]},wdi_quic_Encoder.prototype.row_completed=function(){this.rows_completed++},wdi_quic_Encoder.prototype.setComputedWidth=function(t){this.computedWidth=4*t},wdi_quic_Encoder.prototype.appendAlpha=function(t){this.result[this.alphaPos]=t,this.alphaPos+=4};var lzDecompress={LZ_IMAGE_TYPE_INVALID:0,LZ_IMAGE_TYPE_PLT1_LE:1,LZ_IMAGE_TYPE_PLT1_BE:2,LZ_IMAGE_TYPE_PLT4_LE:3,LZ_IMAGE_TYPE_PLT4_BE:4,LZ_IMAGE_TYPE_PLT8:5,LZ_IMAGE_TYPE_RGB16:6,LZ_IMAGE_TYPE_RGB24:7,LZ_IMAGE_TYPE_RGB32:8,LZ_IMAGE_TYPE_RGBA:9,LZ_IMAGE_TYPE_XXXA:10,LZPALETTE_FLAG_PAL_CACHE_ME:1,LZPALETTE_FLAG_PAL_FROM_CACHE:2,LZPALETTE_FLAG_TOP_DOWN:4,PLT_PIXELS_PER_BYTE:[0,8,8,2,2,1],PLT1_MASK:[1,2,4,8,16,32,64,128],lz_rgb32_decompress_rgb_opaque_reverse:function(t){for(var e,i,r,o,_,n,s,a=new Uint8Array(t),c=(a[2],256*a[5]+a[4]),d=65536*(256*a[7]+a[6])+c,w=new ArrayBuffer(d),l=new Uint32Array(w),u=new DataView(t),f=u.getUint32(8),m=u.getUint32(12),b=d/4-1,p=a[16],h=16;b>=0;)if(0!=(p=a[h++])&&0!=(d=p>>5)){if(i=b,r=(31&p)<<8,7==d)do{d+=e=a[h++]}while(255==e);if(0==(r+=a[h++])){for(o=l[i+1];d>9;)l[b]=o,l[b-1]=o,l[b-2]=o,l[b-3]=o,l[b-4]=o,l[b-5]=o,l[b-6]=o,l[b-7]=o,l[b-8]=o,l[b-9]=o,b-=10,d-=10;for(;0!=d--;)l[b--]=o}else{for(8191==r&&(r+=(a[h]<<8)+a[h+1],h+=2),i+=r+1;d>9;)l[b]=l[i],l[b-1]=l[i-1],l[b-2]=l[i-2],l[b-3]=l[i-3],l[b-4]=l[i-4],l[b-5]=l[i-5],l[b-6]=l[i-6],l[b-7]=l[i-7],l[b-8]=l[i-8],l[b-9]=l[i-9],b-=10,d-=10,i-=10;for(;0!=d--;)l[b--]=l[i--]}}else{for(;p>9;)l[b]=4278190080|a[h]<<16|a[h+1]<<8|a[h+2],l[b-1]=4278190080|a[h+3]<<16|a[h+4]<<8|a[h+5],l[b-2]=4278190080|a[h+6]<<16|a[h+7]<<8|a[h+8],l[b-3]=4278190080|a[h+9]<<16|a[h+10]<<8|a[h+11],l[b-4]=4278190080|a[h+12]<<16|a[h+13]<<8|a[h+14],l[b-5]=4278190080|a[h+15]<<16|a[h+16]<<8|a[h+17],l[b-6]=4278190080|a[h+18]<<16|a[h+19]<<8|a[h+20],l[b-7]=4278190080|a[h+21]<<16|a[h+22]<<8|a[h+23],l[b-8]=4278190080|a[h+24]<<16|a[h+25]<<8|a[h+26],l[b-9]=4278190080|a[h+27]<<16|a[h+28]<<8|a[h+29],h+=30,b-=10,p-=10;0!=p&&(9==p?(l[b]=4278190080|a[h]<<16|a[h+1]<<8|a[h+2],l[b-1]=4278190080|a[h+3]<<16|a[h+4]<<8|a[h+5],l[b-2]=4278190080|a[h+6]<<16|a[h+7]<<8|a[h+8],l[b-3]=4278190080|a[h+9]<<16|a[h+10]<<8|a[h+11],l[b-4]=4278190080|a[h+12]<<16|a[h+13]<<8|a[h+14],l[b-5]=4278190080|a[h+15]<<16|a[h+16]<<8|a[h+17],l[b-6]=4278190080|a[h+18]<<16|a[h+19]<<8|a[h+20],l[b-7]=4278190080|a[h+21]<<16|a[h+22]<<8|a[h+23],l[b-8]=4278190080|a[h+24]<<16|a[h+25]<<8|a[h+26],h+=27,b-=9):8==p?(l[b]=4278190080|a[h]<<16|a[h+1]<<8|a[h+2],l[b-1]=4278190080|a[h+3]<<16|a[h+4]<<8|a[h+5],l[b-2]=4278190080|a[h+6]<<16|a[h+7]<<8|a[h+8],l[b-3]=4278190080|a[h+9]<<16|a[h+10]<<8|a[h+11],l[b-4]=4278190080|a[h+12]<<16|a[h+13]<<8|a[h+14],l[b-5]=4278190080|a[h+15]<<16|a[h+16]<<8|a[h+17],l[b-6]=4278190080|a[h+18]<<16|a[h+19]<<8|a[h+20],l[b-7]=4278190080|a[h+21]<<16|a[h+22]<<8|a[h+23],h+=24,b-=8):7==p?(l[b]=4278190080|a[h]<<16|a[h+1]<<8|a[h+2],l[b-1]=4278190080|a[h+3]<<16|a[h+4]<<8|a[h+5],l[b-2]=4278190080|a[h+6]<<16|a[h+7]<<8|a[h+8],l[b-3]=4278190080|a[h+9]<<16|a[h+10]<<8|a[h+11],l[b-4]=4278190080|a[h+12]<<16|a[h+13]<<8|a[h+14],l[b-5]=4278190080|a[h+15]<<16|a[h+16]<<8|a[h+17],l[b-6]=4278190080|a[h+18]<<16|a[h+19]<<8|a[h+20],h+=21,b-=7):6==p?(l[b]=4278190080|a[h]<<16|a[h+1]<<8|a[h+2],l[b-1]=4278190080|a[h+3]<<16|a[h+4]<<8|a[h+5],l[b-2]=4278190080|a[h+6]<<16|a[h+7]<<8|a[h+8],l[b-3]=4278190080|a[h+9]<<16|a[h+10]<<8|a[h+11],l[b-4]=4278190080|a[h+12]<<16|a[h+13]<<8|a[h+14],l[b-5]=4278190080|a[h+15]<<16|a[h+16]<<8|a[h+17],h+=18,b-=6):5==p?(l[b]=4278190080|a[h]<<16|a[h+1]<<8|a[h+2],l[b-1]=4278190080|a[h+3]<<16|a[h+4]<<8|a[h+5],l[b-2]=4278190080|a[h+6]<<16|a[h+7]<<8|a[h+8],l[b-3]=4278190080|a[h+9]<<16|a[h+10]<<8|a[h+11],l[b-4]=4278190080|a[h+12]<<16|a[h+13]<<8|a[h+14],h+=15,b-=5):4==p?(l[b]=4278190080|a[h]<<16|a[h+1]<<8|a[h+2],l[b-1]=4278190080|a[h+3]<<16|a[h+4]<<8|a[h+5],l[b-2]=4278190080|a[h+6]<<16|a[h+7]<<8|a[h+8],l[b-3]=4278190080|a[h+9]<<16|a[h+10]<<8|a[h+11],h+=12,b-=4):3==p?(l[b]=4278190080|a[h]<<16|a[h+1]<<8|a[h+2],l[b-1]=4278190080|a[h+3]<<16|a[h+4]<<8|a[h+5],l[b-2]=4278190080|a[h+6]<<16|a[h+7]<<8|a[h+8],h+=9,b-=3):2==p?(l[b]=4278190080|a[h]<<16|a[h+1]<<8|a[h+2],l[b-1]=4278190080|a[h+3]<<16|a[h+4]<<8|a[h+5],h+=6,b-=2):1==p&&(l[b--]=4278190080|a[h]<<16|a[h+1]<<8|a[h+2],h+=3)),l[b--]=4278190080|a[h]<<16|a[h+1]<<8|a[h+2],h+=3}for(var E=f-1;m--;)for(s=new Uint32Array(w,m*f*4,f),_=0,n=E;_<n;){var S=s[_];s[_++]=s[n],s[n--]=S}return w},lz_rgb32_decompress_rgb:function(t){var e=0,i=new Uint8Array(t),r=i[1],o=i[2],_=i[3];if(r&&!_)return lzDecompress.lz_rgb32_decompress_rgb_opaque_reverse(t);for(var n,s,a,c,d,w,l,u=256*i[5]+i[4],f=65536*(256*i[7]+i[6])+u,m=new ArrayBuffer(f),b=new Uint32Array(m),p=f/4,h=i[16],E=16;e!=p;)if(0!=(h=i[E++])&&0!=(f=h>>5)){if(s=e,a=(31&h)<<8,7==f)do{f+=n=i[E++]}while(255==n);if(0==(a+=i[E++])){for(w=b[--s];f>9;)b[e]=w,b[e+1]=w,b[e+2]=w,b[e+3]=w,b[e+4]=w,b[e+5]=w,b[e+6]=w,b[e+7]=w,b[e+8]=w,b[e+9]=w,e+=10,f-=10;for(;0!=f--;)b[e++]=w}else if(8191==a&&(a+=(i[E]<<8)+i[E+1],E+=2),s-=a+1,f>100&&s+f<e)l=new Uint32Array(m,4*s,f),b.set(l,e),e+=f,s+=f;else{for(;f>9;)b[e]=b[s],b[e+1]=b[s+1],b[e+2]=b[s+2],b[e+3]=b[s+3],b[e+4]=b[s+4],b[e+5]=b[s+5],b[e+6]=b[s+6],b[e+7]=b[s+7],b[e+8]=b[s+8],b[e+9]=b[s+9],e+=10,f-=10,s+=10;for(;0!=f--;)b[e++]=b[s++]}}else{for(;h>9;)b[e]=4278190080|i[E]<<16|i[E+1]<<8|i[E+2],b[e+1]=4278190080|i[E+3]<<16|i[E+4]<<8|i[E+5],b[e+2]=4278190080|i[E+6]<<16|i[E+7]<<8|i[E+8],b[e+3]=4278190080|i[E+9]<<16|i[E+10]<<8|i[E+11],b[e+4]=4278190080|i[E+12]<<16|i[E+13]<<8|i[E+14],b[e+5]=4278190080|i[E+15]<<16|i[E+16]<<8|i[E+17],b[e+6]=4278190080|i[E+18]<<16|i[E+19]<<8|i[E+20],b[e+7]=4278190080|i[E+21]<<16|i[E+22]<<8|i[E+23],b[e+8]=4278190080|i[E+24]<<16|i[E+25]<<8|i[E+26],b[e+9]=4278190080|i[E+27]<<16|i[E+28]<<8|i[E+29],E+=30,e+=10,h-=10;0!=h&&(9==h?(b[e]=4278190080|i[E]<<16|i[E+1]<<8|i[E+2],b[e+1]=4278190080|i[E+3]<<16|i[E+4]<<8|i[E+5],b[e+2]=4278190080|i[E+6]<<16|i[E+7]<<8|i[E+8],b[e+3]=4278190080|i[E+9]<<16|i[E+10]<<8|i[E+11],b[e+4]=4278190080|i[E+12]<<16|i[E+13]<<8|i[E+14],b[e+5]=4278190080|i[E+15]<<16|i[E+16]<<8|i[E+17],b[e+6]=4278190080|i[E+18]<<16|i[E+19]<<8|i[E+20],b[e+7]=4278190080|i[E+21]<<16|i[E+22]<<8|i[E+23],b[e+8]=4278190080|i[E+24]<<16|i[E+25]<<8|i[E+26],E+=27,e+=9):8==h?(b[e]=4278190080|i[E]<<16|i[E+1]<<8|i[E+2],b[e+1]=4278190080|i[E+3]<<16|i[E+4]<<8|i[E+5],b[e+2]=4278190080|i[E+6]<<16|i[E+7]<<8|i[E+8],b[e+3]=4278190080|i[E+9]<<16|i[E+10]<<8|i[E+11],b[e+4]=4278190080|i[E+12]<<16|i[E+13]<<8|i[E+14],b[e+5]=4278190080|i[E+15]<<16|i[E+16]<<8|i[E+17],b[e+6]=4278190080|i[E+18]<<16|i[E+19]<<8|i[E+20],b[e+7]=4278190080|i[E+21]<<16|i[E+22]<<8|i[E+23],E+=24,e+=8):7==h?(b[e]=4278190080|i[E]<<16|i[E+1]<<8|i[E+2],b[e+1]=4278190080|i[E+3]<<16|i[E+4]<<8|i[E+5],b[e+2]=4278190080|i[E+6]<<16|i[E+7]<<8|i[E+8],b[e+3]=4278190080|i[E+9]<<16|i[E+10]<<8|i[E+11],b[e+4]=4278190080|i[E+12]<<16|i[E+13]<<8|i[E+14],b[e+5]=4278190080|i[E+15]<<16|i[E+16]<<8|i[E+17],b[e+6]=4278190080|i[E+18]<<16|i[E+19]<<8|i[E+20],E+=21,e+=7):6==h?(b[e]=4278190080|i[E]<<16|i[E+1]<<8|i[E+2],b[e+1]=4278190080|i[E+3]<<16|i[E+4]<<8|i[E+5],b[e+2]=4278190080|i[E+6]<<16|i[E+7]<<8|i[E+8],b[e+3]=4278190080|i[E+9]<<16|i[E+10]<<8|i[E+11],b[e+4]=4278190080|i[E+12]<<16|i[E+13]<<8|i[E+14],b[e+5]=4278190080|i[E+15]<<16|i[E+16]<<8|i[E+17],E+=18,e+=6):5==h?(b[e]=4278190080|i[E]<<16|i[E+1]<<8|i[E+2],b[e+1]=4278190080|i[E+3]<<16|i[E+4]<<8|i[E+5],b[e+2]=4278190080|i[E+6]<<16|i[E+7]<<8|i[E+8],b[e+3]=4278190080|i[E+9]<<16|i[E+10]<<8|i[E+11],b[e+4]=4278190080|i[E+12]<<16|i[E+13]<<8|i[E+14],E+=15,e+=5):4==h?(b[e]=4278190080|i[E]<<16|i[E+1]<<8|i[E+2],b[e+1]=4278190080|i[E+3]<<16|i[E+4]<<8|i[E+5],b[e+2]=4278190080|i[E+6]<<16|i[E+7]<<8|i[E+8],b[e+3]=4278190080|i[E+9]<<16|i[E+10]<<8|i[E+11],E+=12,e+=4):3==h?(b[e]=4278190080|i[E]<<16|i[E+1]<<8|i[E+2],b[e+1]=4278190080|i[E+3]<<16|i[E+4]<<8|i[E+5],b[e+2]=4278190080|i[E+6]<<16|i[E+7]<<8|i[E+8],E+=9,e+=3):2==h?(b[e]=4278190080|i[E]<<16|i[E+1]<<8|i[E+2],b[e+1]=4278190080|i[E+3]<<16|i[E+4]<<8|i[E+5],E+=6,e+=2):1==h&&(b[e++]=4278190080|i[E]<<16|i[E+1]<<8|i[E+2],E+=3)),b[e++]=4278190080|i[E]<<16|i[E+1]<<8|i[E+2],E+=3}if(o===this.LZ_IMAGE_TYPE_RGBA&&!r){var S=new Uint8Array(m);for(e=0,h=null,h=i[E++];e<p;h=i[E++])if(s=e,f=h>>5,a=(31&h)<<8,d=4*e,h>=32){if(6===--f)do{f+=n=i[E++]}while(255===n);if(a+=n=i[E++],255===n&&a-n==7936&&(a=i[E++]<<8,a+=i[E++],a+=8191),f+=3,(s-=a+=1)===e-1)for(c=s;f;--f)S[(d=4*e)+3]=S[4*c+3],e++;else for(;f;--f)S[(d=4*e)+3]=S[4*s+3],e++,s++}else for(h++,S[d+3]=i[E++],e++,--h;h;h--)S[(d=4*e)+3]=i[E++],e++}return m}};wdi.LZSS?wdi.LZSS.lz_rgb32_decompress_rgb=lzDecompress.lz_rgb32_decompress_rgb:wdi.LZSS=lzDecompress;
@@ -1 +0,0 @@
1
- function dispatch(t,e){var i=new Uint8Array(t),r=i[3],o=null,_=i[0];if(_===wdi.WorkerOperations.quic)try{o=wdi.JSQuic.quic_decode(t)}catch(t){}else if(_===wdi.WorkerOperations.lz_rgb)try{o=wdi.LZSS.lz_rgb32_decompress_rgb(t)}catch(t){}else if(_===wdi.WorkerOperations.bytesToUriJpeg)try{return o=bytesToURI(i,"jpeg"),void self.postMessage(o)}catch(t){}else if(_===wdi.WorkerOperations.bytesToUriPng)try{return o=bytesToURI(i,"png"),void self.postMessage(o)}catch(t){}if(!e||!o)return o;r?self.postMessage(o,[o]):self.postMessage(o)}function bytesToURI(t,e){for(var i="data:image/"+e+",",r=t.length,o=4;o<r;o++)t[o]<16?i+="%0":i+="%",i+=t[o].toString(16);return i}function bytesToInt16(t){var e=t.shift();return t.shift()*Math.pow(16,2)+e}function bytesToInt32(t){var e=bytesToInt16(t);return bytesToInt16(t)*Math.pow(16,4)+e}function wdi_quic_QuicFamily(){this.notGRcwlen=[],this.nGRcodewords=[],this.notGRprefixmask=[],this.notGRsuffixlen=[],this.xlatU2L=[],this.xlatL2U=[]}function wdi_quic_s_bucket(){this.pcounters=null,this.bestcode=0}function wdi_quic_CommonState(){this.wm_trigger=this,this.encoder=null,this.waitcnt=0,this.tabrand_seed=wdi.JSQuic.stabrand(),this.wmidx=wdi.JSQuic.DEFwmistart,this.wmileft=wdi.JSQuic.wminext,wdi.JSQuic.set_wm_trigger(this),this.melcstate=0,this.melclen=wdi.JSQuic.J[0],this.melcorder=1<<this.melclen>>>0}function wdi_quic_FamilyStat(){this.buckets_buf=null,this.buckets_ptrs=null,this.counters=0}function wdi_quic_Channel(){this.encoder=null,this.correlate_row_width=0,this.correlate_row=null,this._buckets_ptrs=null,this.family_stat_8bpc=new wdi_quic_FamilyStat,this.family_stat_5bpc=new wdi_quic_FamilyStat,this.state=new wdi_quic_CommonState,this.oldFirst=0}function wdi_quic_Encoder(t){this.computedWidth=0,this.result=[],this.cnt=0,this.pxCnt=0,this.usr=t,this.type=null,this.width=null,this.height=null,this.num_channels=null,this.n_buckets_8bpc=null,this.n_buckets_5bpc=null,this.io_available_bits=32,this.io_now=0,this.io_next_word=null,this.io_now=null,this.read_io_word(),this.io_word=this.io_next_word,this.read_io_word(),this.io_words_count=t.length,this.rows_completed=0,this.channels=[],this.alphaPos=3,this.rgb_state=new wdi_quic_CommonState;for(var e=0;e<4;e++)this.channels[e]=new wdi_quic_Channel,wdi.JSQuic.initChannel(this,this.channels[e])}function cnt_l_zeroes(t){return t>8388607?wdi.JSQuic.lzeroes[t>>>24]:t>32767?8+wdi.JSQuic.lzeroes[t>>>16&255]:t>127?16+wdi.JSQuic.lzeroes[t>>>8&255]:24+wdi.JSQuic.lzeroes[255&t]}function golomb_code_len(t,e){return t<wdi.nGRcodewords[e]?1+(t>>>e)+e:wdi.notGRcwlen[e]}function golomb_decoding(t,e,i,r,o,_,n){var s,a;if(e>r[t]){var c=cnt_l_zeroes(e);a=c<<t|e>>>32-(s=c+1+t)&i[t]}else s=o[t],a=_[t]+(e>>>32-s&i[n[t]]);return[a,s]}function real_update_model(t,e,i,r,o){var _,n,s,a,c=e.pcounters;for(s=c[n=r-1]+=golomb_code_len(i,n),_=r-2;_>=0;_--)(a=c[_]+=golomb_code_len(i,_))<s&&(n=_,s=a);if(e.bestcode=n,s>t.wm_trigger)for(;r-- >0;)c[r]>>>=1}function UPDATE_MODEL(t,e,i,r,o,_){real_update_model(e.rgb_state,find_bucket(e.channels[0],r[t-1]),r[t],i),real_update_model(e.rgb_state,find_bucket(e.channels[1],o[t-1]),o[t],i),real_update_model(e.rgb_state,find_bucket(e.channels[2],_[t-1]),_[t],i)}function find_bucket(t,e){return void 0===e&&(e=t.oldFirst),t._buckets_ptrs[e]}function QUIC_UNCOMPRESS_RGBA(t,e,i,r){quic_uncompress_row0(t,e,i,r),quic_four_uncompress_row0(t,t.channels[3],i,r),t.row_completed();for(var o=t.height,_=t.rgb_state,n=1;n<o;n++)quic_uncompress_row_a(t,e,i,r,_),quic_four_uncompress_row(t,t.channels[3],i,r),t.row_completed()}function quic_four_uncompress_row(t,e,i,r){for(var o=wdi.JSQuic.BPC_MASK[r],_=0,n=t.width;wdi.JSQuic.wmimax>e.state.wmidx&&e.state.wmileft<=n;)e.state.wmileft&&(uncompress_four_row_seg(t,e,_,_+e.state.wmileft,i,o,r),_+=e.state.wmileft,n-=e.state.wmileft),e.state.wmidx++,wdi.JSQuic.set_wm_trigger(e.state),e.state.wmileft=wdi.JSQuic.wminext;n&&(uncompress_four_row_seg(t,e,_,_+n,i,o,r),wdi.JSQuic.wmimax>e.state.wmidx&&(e.state.wmileft-=n))}function uncompress_four_row_seg(t,e,i,r,o,_,n){var s,a,c,d,w=e.correlate_row,l=0,u=wdi.JSQuic.bppmask[e.state.wmidx],f=0,m=0,b=!1,p=t.computedWidth,h=t.rows_completed,E=(t.rows_completed-1)*p,S=t.eatbits,R=t.appendAlpha,A=wdi.JSQuic.bppmask,g=wdi.notGRprefixmask,x=wdi.notGRcwlen,G=wdi.nGRcodewords,Q=wdi.notGRsuffixlen;for(i?(l=i+e.state.waitcnt,a=t.result[t.alphaPos-4]):(a=UNCOMPRESS_ONE_0_A(e,t,_,E),e.state.waitcnt?--e.state.waitcnt:(e.state.waitcnt=wdi.JSQuic.tabrand(e.state)&u,real_update_model(e.state,find_bucket(e,w[-1]),w[0],o)),l=++i+e.state.waitcnt);;){for(;l<r;){for(;i<=l&&!(b=RLE_PRED_A(i,t,f,p,h));i++)s=(c=golomb_decoding(find_bucket(e,w[i-1]).bestcode,t.io_word,A,g,x,G,Q))[0],d=c[1],w[i]=s,a=(wdi.xlatL2U[s]+(a+PIXEL_B(e,t,i,E)>>>1)&_)>>>0,R.call(t,a),S(d,t);if(b)break;real_update_model(e.state,find_bucket(e,w[l-1]),w[l],o),l=i+(wdi.JSQuic.tabrand(e.state)&u)}if(!b){for(;i<r&&!(b=RLE_PRED_A(i,t,f,p,h));i++)s=(c=golomb_decoding(find_bucket(e,w[i-1]).bestcode,t.io_word,A,g,x,G,Q))[0],d=c[1],w[i]=s,a=(wdi.xlatL2U[s]+(a+PIXEL_B(e,t,i,E)>>>1)&_)>>>0,R.call(t,a),S(d,t);if(!b)return void(e.state.waitcnt=l-r)}e.state.waitcnt=l-i,f=i,m=i+wdi.JSQuic.decode_channel_run(t,e);for(var P=t.rows_completed*(4*t.width)+4*i,k=t.result[P-1];i<m;i++)R.call(t,k);if(i===r)return;l=i+e.state.waitcnt,b=!1}}function quic_four_uncompress_row0(t,e,i,r){for(var o=wdi.JSQuic.BPC_MASK[r],_=0,n=t.width;wdi.JSQuic.wmimax>e.state.wmidx&&e.state.wmileft<=n;)e.state.wmileft&&(uncompress_four_row0_seg(t,e,_,_+e.wmileft,wdi.JSQuic.bppmask[e.state.wmidx],i,o,r),_+=e.state.wmileft,n-=e.state.wmileft),e.state.wmidx++,wdi.JSQuic.set_wm_trigger(e.state),e.state.wmileft=wdi.JSQuic.wminext;n&&(uncompress_four_row0_seg(t,e,_,_+n,wdi.JSQuic.bppmask[e.state.wmidx],i,o,r),wdi.JSQuic.wmimax>e.state.wmidx&&(e.state.wmileft-=n))}function uncompress_four_row0_seg(t,e,i,r,o,_,n,s){var a=e.correlate_row,c=0;for(i?c=i+e.state.waitcnt:(UNCOMPRESS_ONE_ROW0_0_A(e),e.state.waitcnt?--e.state.waitcnt:(e.state.waitcnt=wdi.JSQuic.tabrand(e.state)&o,real_update_model(e.state,find_bucket(e,a[-1]),a[0],_)),c=++i+e.state.waitcnt);c<r;){for(;i<=c;i++)UNCOMPRESS_ONE_ROW0_A(e,i,n,t,a);real_update_model(e.state,find_bucket(e,a[c-1]),a[c],_),c=i+(wdi.JSQuic.tabrand(e.state)&o)}for(;i<r;i++)UNCOMPRESS_ONE_ROW0_A(e,i,n,t,a);e.state.waitcnt=c-r}function SAME_PIXEL_A(t,e){return e[t-1]===e[t+3]}function RLE_PRED_A(t,e,i,r,o){var _=(o-1)*r+4*t;return!!(i!==t&&t>2&&SAME_PIXEL_A(_,e.result)&&SAME_PIXEL_A(_=o*r+4*(t-1),e.result))}function UNCOMPRESS_ONE_0_A(t,e,i,r){var o,_;t.oldFirst=t.correlate_row[0],o=golomb_decoding(find_bucket(t,t.correlate_row[-1]).bestcode,e.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen),t.correlate_row[0]=o[0],_=o[1];var n=(wdi.xlatL2U[t.correlate_row[0]]+PIXEL_B(t,e,0,r)&i)>>>0;return e.appendAlpha(n),e.eatbits(_,e),n}function UNCOMPRESS_ONE_A(t,e,i,r,o,_){var n,s,a=(n=golomb_decoding(find_bucket(t,o[e-1]).bestcode,r.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen))[0];s=n[1],o[e]=a,r.appendAlpha((wdi.xlatL2U[a]+(PIXEL_A_A(r)+PIXEL_B(t,r,e,_)>>>1)&i)>>>0),r.eatbits(s,r)}function UNCOMPRESS_ONE_ROW0_0_A(t){var e,i,r=t.encoder;e=golomb_decoding(find_bucket(t,0).bestcode,r.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen),t.correlate_row[0]=e[0],i=e[1],r.appendAlpha(wdi.xlatL2U[t.correlate_row[0]]),r.eatbits(i,r)}function UNCOMPRESS_ONE_ROW0_A(t,e,i,r,o){var _,n,s=(_=golomb_decoding(find_bucket(t,o[e-1]).bestcode,r.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen))[0];n=_[1],o[e]=s,r.appendAlpha(CORELATE_0_A(r,t,e,i,o)),r.eatbits(n,r)}function CORELATE_0_A(t,e,i,r,o){return(wdi.xlatL2U[o[i]]+PIXEL_A_A(t)&r)>>>0}function PIXEL_A_A(t){return t.result[t.alphaPos-4]}function QUIC_UNCOMPRESS_RGB(t,e,i,r){quic_uncompress_row0(t,e,i,r),t.row_completed();for(var o=t.rgb_state,_=t.height,n=t.result,s=t.resultData,a=t.width,c=wdi.JSQuic.BPC_MASK[r],d=wdi.JSQuic,w=t.channels[0],l=t.channels[1],u=t.channels[2],f=w._buckets_ptrs,m=l._buckets_ptrs,b=u._buckets_ptrs,p=w.correlate_row,h=l.correlate_row,E=u.correlate_row,S=t.computedWidth,R=wdi.xlatL2U,A=wdi.JSQuic.lzeroes,g=wdi.JSQuic.lzeroes8,x=wdi.JSQuic.lzeroes16,G=wdi.JSQuic.lzeroes24,Q=wdi.notGRprefixmask,P=wdi.notGRcwlen,k=wdi.nGRcodewords,v=wdi.notGRsuffixlen,I=t.eatbits,L=wdi.JSQuic.tabrand,M=wdi.JSQuic.decode_run,U=wdi.JSQuic.bppmask,J=(d=wdi.JSQuic,wdi.JSQuic.tabrand_chaos),O=d.TABRAND_SEEDMASK,y=t.usr,T=1;T<_;T++)quic_uncompress_row(t,e,i,r,o,-16777216,n,s,a,c,d,w,l,u,f,m,b,p,h,E,S,R,A,g,x,G,Q,P,k,v,I,L,M,U,J,O,y),t.rows_completed++}function quic_uncompress_row(t,e,i,r,o,_,n,s,a,c,d,w,l,u,f,m,b,p,h,E,S,R,A,g,x,G,Q,P,k,v,I,L,M,U,J,O,y){for(var T=0,C=t.rows_completed,N=C*S/4,z=(C-1)*S;d.wmimax>o.wmidx&&o.wmileft<=a;)o.wmileft&&(uncompress_row_seg(t,T,T+o.wmileft,i,c,r,o,_,n,s,w,l,u,f,m,b,p,h,E,S,R,A,g,x,G,Q,P,k,v,I,L,M,U,d,J,C,O,z,N,y),T+=o.wmileft,a-=o.wmileft),o.wmidx++,d.set_wm_trigger(o),o.wmileft=d.wminext;a&&(uncompress_row_seg(t,T,T+a,i,c,r,o,_,n,s,w,l,u,f,m,b,p,h,E,S,R,A,g,x,G,Q,P,k,v,I,L,M,U,d,J,C,O,z,N,y),d.wmimax>t.rgb_state.wmidx&&(o.wmileft-=a))}function quic_uncompress_row_a(t,e,i,r,o){for(var _=wdi.JSQuic.BPC_MASK[r],n=0,s=t.width;wdi.JSQuic.wmimax>o.wmidx&&o.wmileft<=s;)o.wmileft&&(uncompress_row_seg_a(t,n,n+o.wmileft,i,_,r,o),n+=o.wmileft,s-=o.wmileft),o.wmidx++,wdi.JSQuic.set_wm_trigger(o),o.wmileft=wdi.JSQuic.wminext;s&&(uncompress_row_seg_a(t,n,n+s,i,_,r,o),wdi.JSQuic.wmimax>t.rgb_state.wmidx&&(o.wmileft-=s))}function SAME_PIXEL_RGB_A(t,e){return e[t-4]===e[t]&&e[t-3]===e[t+1]&&e[t-2]===e[t+2]}function SAME_PIXEL(t,e){return e[t-1]===e[t]}function RLE_PRED_RGB_A(t,e,i,r,o){if(o!==t&&t>2&&(SAME_PIXEL_RGB_A(i,e.result)&&SAME_PIXEL_RGB_A(r+4*(t-1),e.result)))return!0;return!1}function RLE_PRED(t,e,i,r,o){if(o!==t&&t>2&&(SAME_PIXEL(4*i,e.result)&&SAME_PIXEL(4*(r+t-1),e.result)))return!0;return!1}function uncompress_row_seg(t,e,i,r,o,_,n,s,a,c,d,w,l,u,f,m,b,p,h,E,S,R,A,g,x,G,Q,P,k,v,I,L,M,U,J,O,y,T,C,N){var z,D,B,q,Y,W,X,F,Z,K,H,V,j,$,tt,et,it,rt,ot,_t=0,nt=M[n.wmidx],st=0,at=!1,ct=t.cnt,dt=t.pxCnt;for(e?(_t=e+n.waitcnt,B=a[ct-4],q=a[ct-3],Y=a[ct-2],W=b[e-1],X=p[e-1],F=h[e-1]):(B=UNCOMPRESS_ONE_0(d,t,o,T),q=UNCOMPRESS_ONE_0(w,t,o,T),Y=UNCOMPRESS_ONE_0(l,t,o,T),W=b[0],X=p[0],F=h[0],c[dt++]=255<<24|Y<<16|q<<8|B,n.waitcnt?--n.waitcnt:(n.waitcnt=I.call(U,n)&nt,UPDATE_MODEL(0,t,r,b,p,h)),_t=++e+n.waitcnt);;){for(;_t<i;){for(D=T+4*e;e<=_t;e++){if(c[($=D/4)-1]===c[$]&&c[(j=C+e-1)-1]===c[j]&&st!==e&&e>2){at=!0;break}K=u[W].bestcode,(H=t.io_word)>G[K]?W=(V=H>8388607?R[H>>>24]:H>32767?A[H>>>16&255]:H>127?g[H>>>8&255]:x[255&H])<<K|H>>>32-(Z=V+1+K)&M[K]:(Z=Q[K],W=P[K]+(H>>>32-Z&M[k[K]])),b[e]=W,B=S[W]+(B+a[D++]>>>1)&o,et=t.io_available_bits,it=t.io_word,it<<=Z,(rt=et-Z)>=0?(it=(it|t.io_next_word>>>rt)>>>0,t.io_available_bits=rt,t.io_word=it):(it=((it|=(ot=t.io_next_word)<<(rt=-rt)>>>0)|(ot=N[t.io_now++])>>>(et=32-rt))>>>0,t.io_available_bits=et,t.io_word=it,t.io_next_word=ot),K=f[X].bestcode,(H=t.io_word)>G[K]?X=(V=H>8388607?R[H>>>24]:H>32767?A[H>>>16&255]:H>127?g[H>>>8&255]:x[255&H])<<K|H>>>32-(Z=V+1+K)&M[K]:(Z=Q[K],X=P[K]+(H>>>32-Z&M[k[K]])),p[e]=X,q=S[X]+(q+a[D++]>>>1)&o,et=t.io_available_bits,it=t.io_word,it<<=Z,(rt=et-Z)>=0?(it=(it|t.io_next_word>>>rt)>>>0,t.io_available_bits=rt,t.io_word=it):(it=((it|=(ot=t.io_next_word)<<(rt=-rt)>>>0)|(ot=N[t.io_now++])>>>(et=32-rt))>>>0,t.io_available_bits=et,t.io_word=it,t.io_next_word=ot),K=m[F].bestcode,(H=t.io_word)>G[K]?F=(V=H>8388607?R[H>>>24]:H>32767?A[H>>>16&255]:H>127?g[H>>>8&255]:x[255&H])<<K|H>>>32-(Z=V+1+K)&M[K]:(Z=Q[K],F=P[K]+(H>>>32-Z&M[k[K]])),h[e]=F,Y=S[F]+(Y+a[D++]>>>1)&o,et=t.io_available_bits,it=t.io_word,it<<=Z,(rt=et-Z)>=0?(it=(it|t.io_next_word>>>rt)>>>0,t.io_available_bits=rt,t.io_word=it):(it=((it|=(ot=t.io_next_word)<<(rt=-rt)>>>0)|(ot=N[t.io_now++])>>>(et=32-rt))>>>0,t.io_available_bits=et,t.io_word=it,t.io_next_word=ot),c[dt++]=s|Y<<16|q<<8|B,D++}if(at)break;real_update_model(n,u[b[tt=_t-1]],b[_t],r),real_update_model(n,f[p[tt]],p[_t],r),real_update_model(n,m[h[tt]],h[_t],r),n.tabrand_seed++,_t=e+(J[n.tabrand_seed&y]&nt)}if(!at){for(D=T+4*e;e<i;e++){if(c[($=D/4)-1]===c[$]&&c[(j=C+e-1)-1]===c[j]&&st!==e&&e>2){at=!0;break}K=u[W].bestcode,(H=t.io_word)>G[K]?W=(V=H>8388607?R[H>>>24]:H>32767?A[H>>>16&255]:H>127?g[H>>>8&255]:x[255&H])<<K|H>>>32-(Z=V+1+K)&M[K]:(Z=Q[K],W=P[K]+(H>>>32-Z&M[k[K]])),b[e]=W,B=S[W]+(B+a[D++]>>>1)&o,et=t.io_available_bits,it=t.io_word,it<<=Z,(rt=et-Z)>=0?(it=(it|t.io_next_word>>>rt)>>>0,t.io_available_bits=rt,t.io_word=it):(it=((it|=(ot=t.io_next_word)<<(rt=-rt)>>>0)|(ot=N[t.io_now++])>>>(et=32-rt))>>>0,t.io_available_bits=et,t.io_word=it,t.io_next_word=ot),K=f[X].bestcode,(H=t.io_word)>G[K]?X=(V=H>8388607?R[H>>>24]:H>32767?A[H>>>16&255]:H>127?g[H>>>8&255]:x[255&H])<<K|H>>>32-(Z=V+1+K)&M[K]:(Z=Q[K],X=P[K]+(H>>>32-Z&M[k[K]])),p[e]=X,q=S[X]+(q+a[D++]>>>1)&o,et=t.io_available_bits,it=t.io_word,it<<=Z,(rt=et-Z)>=0?(it=(it|t.io_next_word>>>rt)>>>0,t.io_available_bits=rt,t.io_word=it):(it=((it|=(ot=t.io_next_word)<<(rt=-rt)>>>0)|(ot=N[t.io_now++])>>>(et=32-rt))>>>0,t.io_available_bits=et,t.io_word=it,t.io_next_word=ot),K=m[F].bestcode,(H=t.io_word)>G[K]?F=(V=H>8388607?R[H>>>24]:H>32767?A[H>>>16&255]:H>127?g[H>>>8&255]:x[255&H])<<K|H>>>32-(Z=V+1+K)&M[K]:(Z=Q[K],F=P[K]+(H>>>32-Z&M[k[K]])),h[e]=F,Y=S[F]+(Y+a[D++]>>>1)&o,et=t.io_available_bits,it=t.io_word,it<<=Z,(rt=et-Z)>=0?(it=(it|t.io_next_word>>>rt)>>>0,t.io_available_bits=rt,t.io_word=it):(it=((it|=(ot=t.io_next_word)<<(rt=-rt)>>>0)|(ot=N[t.io_now++])>>>(et=32-rt))>>>0,t.io_available_bits=et,t.io_word=it,t.io_next_word=ot),c[dt++]=255<<24|Y<<16|q<<8|B,D++}if(!at)return n.waitcnt=_t-i,t.cnt=4*dt,void(t.pxCnt=dt)}for(n.waitcnt=_t-e,st=e,run_end=L(t),e=run_end+e;run_end-- >0;)c[dt++]=s|Y<<16|q<<8|B;if(e===i)return t.cnt=4*dt,void(t.pxCnt=dt);W=b[z=e-1],X=p[z],F=h[z],_t=e+n.waitcnt,at=!1}}function uncompress_row_seg_a(t,e,i,r,o,_,n){var s,a,c,d,w,l,u,f,m,b,p,h,E=t.channels[0],S=t.channels[1],R=t.channels[2],A=E._buckets_ptrs,g=S._buckets_ptrs,x=R._buckets_ptrs,G=E.correlate_row,Q=S.correlate_row,P=R.correlate_row,k=0,v=wdi.JSQuic.bppmask[n.wmidx],I=0,L=0,M=!1,U=t.computedWidth,J=(t.rows_completed-1)*U,O=t.rows_completed*U,y=(t.rows_completed,t.rows_completed,t.result),T=t.resultData,C=wdi.xlatL2U,N=t.eatbits,z=wdi.JSQuic.tabrand,D=wdi.JSQuic.decode_run,B=(wdi.JSQuic.lzeroes,wdi.JSQuic.lzeroes8,wdi.JSQuic.lzeroes16,wdi.JSQuic.lzeroes24,t.cnt),q=t.pxCnt,Y=wdi.JSQuic.bppmask,W=wdi.notGRprefixmask,X=wdi.notGRcwlen,F=wdi.nGRcodewords,Z=wdi.notGRsuffixlen,K=255<<24;for(e?(k=e+n.waitcnt,c=y[B-4],d=y[B-3],w=y[B-2],l=G[e-1],u=Q[e-1],f=P[e-1]):(c=UNCOMPRESS_ONE_0(E,t,o,J),d=UNCOMPRESS_ONE_0(S,t,o,J),w=UNCOMPRESS_ONE_0(R,t,o,J),l=G[0],u=Q[0],f=P[0],T[q++]=255<<24|w<<16|d<<8|c,n.waitcnt?--n.waitcnt:(n.waitcnt=z.call(wdi.JSQuic,n)&v,UPDATE_MODEL(0,t,r,G,Q,P)),k=++e+n.waitcnt);;){for(;k<i;){for(a=J+4*e;e<=k&&!(M=RLE_PRED_RGB_A(e,t,a,O,I));e++)b=A[l].bestcode,(p=t.io_word)>W[b]?l=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],l=F[b]+(p>>>32-m&Y[Z[b]])),G[e]=l,c=C[l]+(c+y[a++]>>>1)&o,N(m,t),b=g[u].bestcode,(p=t.io_word)>W[b]?u=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],u=F[b]+(p>>>32-m&Y[Z[b]])),Q[e]=u,d=C[u]+(d+y[a++]>>>1)&o,N(m,t),b=x[f].bestcode,(p=t.io_word)>W[b]?f=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],f=F[b]+(p>>>32-m&Y[Z[b]])),P[e]=f,w=C[f]+(w+y[a++]>>>1)&o,N(m,t),T[q++]=K|w<<16|d<<8|c,a++;if(M)break;UPDATE_MODEL(k,t,r,G,Q,P),k=e+(z.call(wdi.JSQuic,n)&v)}if(!M){for(a=J+4*e;e<i&&!(M=RLE_PRED_RGB_A(e,t,a,O,I));e++)b=A[l].bestcode,(p=t.io_word)>W[b]?l=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],l=F[b]+(p>>>32-m&Y[Z[b]])),G[e]=l,c=C[l]+(c+y[a++]>>>1)&o,N(m,t),b=g[u].bestcode,(p=t.io_word)>W[b]?u=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],u=F[b]+(p>>>32-m&Y[Z[b]])),Q[e]=u,d=C[u]+(d+y[a++]>>>1)&o,N(m,t),b=x[f].bestcode,(p=t.io_word)>W[b]?f=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],f=F[b]+(p>>>32-m&Y[Z[b]])),P[e]=f,w=C[f]+(w+y[a++]>>>1)&o,N(m,t),T[q++]=255<<24|w<<16|d<<8|c,a++;if(!M)return n.waitcnt=k-i,t.cnt=4*q,void(t.pxCnt=q)}for(n.waitcnt=k-e,I=e,e=(L=D(t))+e;L-- >0;)T[q++]=K|w<<16|d<<8|c;if(e===i)return t.cnt=4*q,void(t.pxCnt=q);l=G[s=e-1],u=Q[s],f=P[s],k=e+n.waitcnt,M=!1}}function quic_uncompress_row0(t,e,i,r){for(var o=wdi.JSQuic.BPC_MASK[r],_=0,n=t.width;wdi.JSQuic.wmimax>t.rgb_state.wmidx&&t.rgb_state.wmileft<=n;)t.rgb_state.wmileft&&(uncompress_row0_seg(t,_,_+t.rgb_state.wmileft,wdi.JSQuic.bppmask[t.rgb_state.wmidx],i,o,r),_+=t.rgb_state.wmileft,n-=t.rgb_state.wmileft),t.rgb_state.wmidx++,wdi.JSQuic.set_wm_trigger(t.rgb_state),t.rgb_state.wmileft=wdi.JSQuic.wminext;n&&(uncompress_row0_seg(t,_,_+n,wdi.JSQuic.bppmask[t.rgb_state.wmidx],i,o,r),wdi.JSQuic.wmimax>t.rgb_state.wmidx&&(t.rgb_state.wmileft-=n))}function uncompress_row0_seg(t,e,i,r,o,_,n){var s,a,c,d=t.channels[0],w=t.channels[1],l=t.channels[2],u=d.correlate_row,f=w.correlate_row,m=l.correlate_row,b=0;for(e?b=e+t.rgb_state.waitcnt:(s=UNCOMPRESS_ONE_ROW0_0(d),a=UNCOMPRESS_ONE_ROW0_0(w),c=UNCOMPRESS_ONE_ROW0_0(l),t.appendPixel(s,a,c),t.rgb_state.waitcnt?--t.rgb_state.waitcnt:(t.rgb_state.waitcnt=wdi.JSQuic.tabrand(t.rgb_state)&r,UPDATE_MODEL(0,t,o,u,f,m)),b=++e+t.rgb_state.waitcnt);b<i;){for(;e<=b;e++)s=UNCOMPRESS_ONE_ROW0(d,e,_,t,u,s),a=UNCOMPRESS_ONE_ROW0(w,e,_,t,f,a),c=UNCOMPRESS_ONE_ROW0(l,e,_,t,m,c),t.appendPixel(s,a,c);UPDATE_MODEL(b,t,o,u,f,m),b=e+(wdi.JSQuic.tabrand(t.rgb_state)&r)}for(;e<i;e++)s=UNCOMPRESS_ONE_ROW0(d,e,_,t,u,s),a=UNCOMPRESS_ONE_ROW0(w,e,_,t,f,a),c=UNCOMPRESS_ONE_ROW0(l,e,_,t,m,c),t.appendPixel(s,a,c);t.rgb_state.waitcnt=b-i}function UNCOMPRESS_ONE_0(t,e,i,r){var o,_;t.oldFirst=t.correlate_row[0],o=golomb_decoding(find_bucket(t,t.correlate_row[0]).bestcode,e.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen),t.correlate_row[0]=o[0],_=o[1];var n=wdi.xlatL2U[t.correlate_row[0]]+e.result[r+t.num_channel]&i;return e.eatbits(_,e),n}function UNCOMPRESS_ONE(t,e,i,r,o,_,n,s,a,c,d,w,l){var u,f=(m=golomb_decoding(w[n[i]].bestcode,_.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen))[0];u=m[1],n[e]=f;var m=d[f]+(l+a[s+r+c]>>>1)&o;return _.eatbits(u,_),m}function UNCOMPRESS_ONE_ROW0_0(t){var e,i=t.encoder;r=golomb_decoding(find_bucket(t,0).bestcode,i.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen),t.correlate_row[0]=r[0],e=r[1];var r=wdi.xlatL2U[t.correlate_row[0]];return i.eatbits(e,i),r}function UNCOMPRESS_ONE_ROW0(t,e,i,r,o,_){var n;s=golomb_decoding(find_bucket(t,o[e-1]).bestcode,r.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen),o[e]=s[0],n=s[1];var s=CORELATE_0(r,t,e,i,o,_);return r.eatbits(n,r),s}function CORELATE_0(t,e,i,r,o,_){return wdi.xlatL2U[o[i]]+_&r}function PIXEL_A(t){return t.result[t.cnt-4]}function PIXEL_B(t,e,i,r){return e.result[r+4*i+t.num_channel]}window=this,window.wdi||(window.wdi={}),window.wdi.WorkerOperations={quic:0,lz_rgb:1,bytesToUriJpeg:2,bytesToUriPng:3},window.workerDispatch=dispatch,self.addEventListener("message",(function(t){return dispatch(t.data,!0)}),!1),wdi.QuicImageType={QUIC_IMAGE_TYPE_INVALID:0,QUIC_IMAGE_TYPE_GRAY:1,QUIC_IMAGE_TYPE_RGB16:2,QUIC_IMAGE_TYPE_RGB24:3,QUIC_IMAGE_TYPE_RGB32:4,QUIC_IMAGE_TYPE_RGBA:5},wdi.quic={},wdi.JSQuic={QUIC_MAGIC:1364543811,MAXNUMCODES:8,DEFevol:3,MINevol:0,MAXevol:5,DEFwmistart:0,MINwmistart:0,DEFmaxclen:26,DEFwmimax:6,DEFwminext:2048,MINwminext:1,MAXwminext:1e8,MAX_CHANNELS:4,wmimax:6,wminext:2048,evol:3,family_8bpc:new wdi_quic_QuicFamily,family_5bpc:new wdi_quic_QuicFamily,bppmask:new Int32Array([0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215,33554431,67108863,134217727,268435455,536870911,1073741823,2147483647,4294967295]),bitat:new Int32Array([1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648]),TABRAND_TABSIZE:256,TABRAND_SEEDMASK:255,tabrand_chaos:new Int32Array([46495042,893548311,794435923,2453991765,2077388039,894197842,1462934312,697534094,1826128012,343623392,2581292719,3811265708,459739748,2638427270,1654964626,101227083,2654850628,3668700691,572794346,2758751005,3445133904,2344099199,3367450297,898927923,3618406352,1606297603,754696453,20823118,2050458127,972590750,3990194068,3305596553,4239238564,1690498157,3015324227,2306127097,1510321853,548392192,971157512,2292288069,1611390505,4086766286,4084927083,1883326811,1891043243,113180603,1107690783,3778825955,3248980775,2443839100,2190866218,1932072870,495393613,1078522166,4051963518,1784694977,1768732442,2146763203,264646923,1474361405,2361552500,296035746,2489922759,2094565616,2409465348,1334241083,72483606,3740181004,4057920662,1734898312,4114662834,574624900,880305546,3258472262,26713132,1571648456,52557195,4043234286,2458021343,676064371,1528437109,64953873,546717185,2709319979,1947039598,2812723004,28691684,286829174,4235176970,3465707163,12526951,2154766700,3165032534,2036061161,3386656087,2301212354,2023576300,1061142336,3105452904,2743866805,3283373992,3397596080,3085489552,3196092395,3210707808,3651022684,925444321,2088074316,230011220,3223248386,533229176,523863486,3028311159,13140218,2538347282,900399636,3000796173,1526771255,3541282854,2992674461,2135722105,389334227,1225164337,3119947809,1803959919,3471171263,704170491,1407019136,1924534819,526887421,168782227,333811993,298623278,4268451686,381087740,2542899140,3266880867,2498950977,200969370,3511909096,3252303004,2268881098,2499828613,2606499854,3163208665,3790254546,1840025712,1319758833,3771674836,519421307,3512796222,1563402978,4284300462,2263719815,715250337,3178437172,2660191010,2982332026,3256309961,2709659997,3434092872,2367065591,69438718,915160508,183164069,3134331940,175242981,2680543346,1421955782,4231173251,1736652874,3990568476,1710820912,2286604440,3464587098,1261907837,1757387321,1128554270,1090050251,2429922486,1288729218,882830086,211637042,1376462063,2147615815,1737974929,798170275,4271572277,4241687072,1638524620,2760366295,1065115089,2097227717,1224023317,1625204849,3383303351,1488272307,2640186157,1649047732,819719707,2615091943,502645401,760628135,4108137983,63606742,1404337880,1865161130,4272996852,1239761976,790984678,3213322601,1917062825,4195069880,1962259360,2111002573,2311983960,1861406170,511141875,2797510619,1331661048,3130608186,147483493,3767089176,2650841450,4096523407,2574446300,1956416337,851468126,3607527519,1811658703,3642821136,832691095,2453312857,933732854,94341217,3393797730,1695907457,2405722077,2877685663,2469507058,2249636341,3988608661,4001245617,825934927,3103985967,1127151177,3691656896,1640967098,2168932645,2830550957,3998822878,3002602893,1509651465,775813869,2599574079,3791574229]),besttrigtab:[[550,900,800,700,500,350,300,200,180,180,160],[110,550,900,800,550,400,350,250,140,160,140],[100,120,550,900,700,500,400,300,220,250,160]],lzeroes:new Int32Array([8,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),J:new Int32Array([0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,5,5,6,6,7,7,8,9,10,11,12,13,14,15]),zeroLUT:null,BPC_MASK:{4:255,5:255,24:255,16:31},stabrand:function(){return this.TABRAND_SEEDMASK},tabrand:function(t){return t.tabrand_seed++,this.tabrand_chaos[t.tabrand_seed&this.TABRAND_SEEDMASK]},set_wm_trigger:function(t){var e=t.wmidx;e>10&&(e=10),t.wm_trigger=wdi.JSQuic.besttrigtab[Math.floor(wdi.JSQuic.evol>>1)][e]},ceil_log_2:function(t){var e;if(1===t)return 0;for(e=1,t-=1;t>>>=1;)e++;return e},decorelate_init:function(t,e){var i,r=this.bppmask[e],o=r>>>1;for(i=0;i<=r;i++)t.xlatU2L[i]=i<=o?i<<1>>>0:1+(r-i<<1>>>0)},corelate_init:function(t,e){var i,r=this.bppmask[e];for(i=0;i<=r;i++)t.xlatL2U[i]=1&i?r-(i>>>1):i>>>1},family_init:function(t,e,i){var r;for(r=0;r<e;r++){var o,_;(o=i-e)>parseInt(this.bppmask[e-r])&&(o=this.bppmask[e-r]),_=this.bppmask[e]+1-(o<<r>>>0),t.nGRcodewords[r]=o<<r>>>0,t.notGRcwlen[r]=o+this.ceil_log_2(_),t.notGRprefixmask[r]=this.bppmask[32-o],t.notGRsuffixlen[r]=this.ceil_log_2(_)}this.corelate_init(t,e)},init_zeroLUT:function(){var t,e,i,r;for(this.zeroLUT=new Int32Array(256),e=i=1,r=8,t=0;t<256;++t)this.zeroLUT[t]=r,0===--i&&(i=e,--r,e*=2)},quic_init:function(){this.family_init(this.family_8bpc,8,this.DEFmaxclen),this.init_zeroLUT(),wdi.xlatL2U=new Int32Array(this.family_8bpc.xlatL2U.length),wdi.xlatL2U.set(this.family_8bpc.xlatL2U),wdi.notGRprefixmask=new Int32Array(this.family_8bpc.notGRprefixmask.length),wdi.notGRprefixmask.set(this.family_8bpc.notGRprefixmask),wdi.nGRcodewords=new Int32Array(this.family_8bpc.nGRcodewords.length),wdi.nGRcodewords.set(this.family_8bpc.nGRcodewords),wdi.notGRcwlen=new Int32Array(this.family_8bpc.notGRcwlen.length),wdi.notGRcwlen.set(this.family_8bpc.notGRcwlen),wdi.notGRsuffixlen=new Int32Array(this.family_8bpc.notGRsuffixlen.length),wdi.notGRsuffixlen.set(this.family_8bpc.notGRsuffixlen);for(var t=wdi.JSQuic.lzeroes,e=new Int32Array(t),i=t.length,r=0;r<i;r++)e[r]=t[r]+8;wdi.JSQuic.lzeroes8=e;var o=new Int32Array(t);for(r=0;r<i;r++)o[r]=t[r]+16;wdi.JSQuic.lzeroes16=o;var _=new Int32Array(t);for(r=0;r<i;r++)_[r]=t[r]+24;wdi.JSQuic.lzeroes24=_},quic_image_params:function(t,e){var i,r;switch(e){case wdi.QuicImageType.QUIC_IMAGE_TYPE_GRAY:i=1,r=8;break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB16:i=3,r=5;break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB24:case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB32:i=3,r=8;break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGBA:i=4,r=8;break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_INVALID:default:i=0,r=0}return[i,r]},find_model_params:function(t,e){var i=0,r=0,o=0,_=0,n={ncounters:8};switch(n.levels=1<<e,n.n_buckets_ptrs=0,this.evol){case 1:n.repfirst=3,n.firstsize=1,n.repnext=2,n.mulsize=2;break;case 3:n.repfirst=1,n.firstsize=1,n.repnext=1,n.mulsize=2;break;case 5:n.repfirst=1,n.firstsize=1,n.repnext=1,n.mulsize=4;break;default:return wdi.Debug.error("fund model params: invalid evol"),!1}n.nbuckets=0,_=n.repfirst+1,i=n.firstsize;do{r=n.nbuckets?o+1:0,--_||(_=n.repnext,i*=n.mulsize),(o=r+i-1)+i>=n.levels&&(o=n.levels-1),n.n_buckets_ptrs||(n.n_buckets_ptrs=n.levels),n.nbuckets++}while(o<n.levels-1);return n},init_model_structures:function(t,e,i){e.buckets_buf=[];for(var r=0;r<i.nbuckets;r++)e.buckets_buf[r]=new wdi_quic_s_bucket;e.buckets_ptrs=[],e.counters=[],this.fill_model_structures(t,e,i)},fill_model_structures:function(t,e,i){var r,o,_,n,s=0;n=0,_=i.repfirst+1,r=i.firstsize;do{o=n?s+1:0,--_||(_=i.repnext,r*=i.mulsize),(s=o+r-1)+r>=i.levels&&(s=i.levels-1),e.buckets_buf[n].pcounters=new Int32Array(i.ncounters);for(var a=0;a<i.ncounters;a++)e.buckets_buf[n].pcounters[a]=0;for(var c=o;c<=s;c++)e.buckets_ptrs[c]=e.buckets_buf[n];n++}while(s<i.levels-1)},initChannel:function(t,e){e.encoder=t,e.state.encoder=t,e.correlate_row_width=0,e.correlate_row=null;var i=this.find_model_params(t,8);t.n_buckets_8bpc=i.nbuckets,this.init_model_structures(t,e.family_stat_8bpc,i),i=this.find_model_params(t,5),t.n_buckets_5bpc=i.nbuckets,this.init_model_structures(t,e.family_stat_5bpc,i)},encoder_reste_channels:function(t,e,i,r){t.num_channels=e;for(var o=0;o<e;o++){var _,n;if(t.channels[o].correlate_row_width<i&&(t.channels[o].correlate_row=new Array(i),t.channels[o].correlate_row_width=i),t.channels[o].num_channel=o,8===r){_=t.channels[o].family_stat_8bpc.buckets_buf,n=t.n_buckets_8bpc;for(var s=0;s<n;s++)_[s].bestcode=7;t.channels[o]._buckets_ptrs=t.channels[o].family_stat_8bpc.buckets_ptrs}else{if(5!==r)return FALSE;_=t.channels[o].family_stat_5bpc.buckets_buf,n=t.n_buckets_5bpc;for(s=0;s<n;s++)_[s].bestcode=4;t.channels[o]._buckets_ptrs=t.channels[o].family_stat_5bpc.buckets_ptrs}t.channels[o].state.waitcnt=0,t.channels[o].state.tabrand_seed=wdi.JSQuic.stabrand(),t.channels[o].state.wmidx=wdi.JSQuic.DEFwmistart,t.channels[o].state.wmileft=wdi.JSQuic.wminext}return!0},decode_channel_run:function(t,e){for(var i=0;;){var r,o;for(r=wdi.JSQuic.zeroLUT[(~(t.io_word>>>24)>>>0)%256],o=1;o<=r;o++)i+=e.state.melcorder,e.state.melcstate<32&&(e.state.melclen=wdi.JSQuic.J[++e.state.melcstate],e.state.melcorder=1<<e.state.melclen>>>0);if(8!==r){t.eatbits(r+1,t);break}t.eatbits(8,t)}return e.state.melclen&&(i+=t.io_word>>>32-e.state.melclen,t.eatbits(e.state.melclen,t)),e.state.melcstate&&(e.state.melclen=wdi.JSQuic.J[--e.state.melcstate],e.state.melcorder=1<<e.state.melclen>>>0),i},decode_run:function(t){for(var e,i,r,o=0,_=wdi.JSQuic.zeroLUT,n=t.rgb_state,s=wdi.JSQuic.J,a=t.eatbits;;){for(r=(e=_[(~(t.io_word>>>24)>>>0)%256])+1,i=1;i<r;i++)o+=t.rgb_state.melcorder,n.melcstate<32&&(n.melclen=s[++n.melcstate],n.melcorder=1<<n.melclen>>>0);if(8!==e){a(r,t);break}t.eatbits(8,t)}return n.melclen&&(o+=t.io_word>>>32-n.melclen,a(n.melclen,t)),n.melcstate&&(n.melclen=s[--n.melcstate],n.melcorder=1<<n.melclen>>>0),o},quic_decode:function(t){var e=new wdi_quic_Encoder(new Uint32Array(t)),i=65280&e.io_word;e.io_word;e.eat32bits(),e.eat32bits();e.io_word;e.eat32bits();e.io_word;e.eat32bits();var r=e.io_word;e.eat32bits(),e.type=r;var o=e.io_word;e.width=o,e.eat32bits();var _=e.io_word;e.height=_,e.eat32bits();var n=wdi.JSQuic.quic_image_params(e,r),s=n[0],a=n[1];this.encoder_reste_channels(e,s,o,a);var c=new ArrayBuffer(o*_*4),d=new Uint8Array(c);t=new Uint32Array(c);switch(e.result=d,e.resultData=t,e.setComputedWidth(o),r){case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB32:case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB24:QUIC_UNCOMPRESS_RGB(e,s,a,r);break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB16:break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGBA:if(QUIC_UNCOMPRESS_RGBA(e,s,a,r),i)for(var w=d.length-1;w>0;)d[w]=255,w-=4}return c}},wdi.JSQuic.quic_init(),wdi_quic_Encoder.prototype.append=function(t){this.result[this.cnt++]=t},wdi_quic_Encoder.prototype.appendPixel=function(t,e,i){this.resultData[this.pxCnt++]=255<<24|i<<16|e<<8|t,this.cnt+=4},wdi_quic_Encoder.prototype.eatbits=function(t,e){var i=e.io_available_bits,r=e.io_word,o=i-t;if(r<<=t,o>=0)return r=(r|e.io_next_word>>>o)>>>0,e.io_available_bits=o,void(e.io_word=r);var _=e.io_next_word;r=((r|=_<<(o=-o)>>>0)|(_=e.usr[e.io_now++])>>>(i=32-o))>>>0,e.io_available_bits=i,e.io_word=r,e.io_next_word=_},wdi_quic_Encoder.prototype.eat32bits=function(){this.eatbits(16,this),this.eatbits(16,this)},wdi_quic_Encoder.prototype.read_io_word=function(){this.io_next_word=this.usr[this.io_now++]},wdi_quic_Encoder.prototype.row_completed=function(){this.rows_completed++},wdi_quic_Encoder.prototype.setComputedWidth=function(t){this.computedWidth=4*t},wdi_quic_Encoder.prototype.appendAlpha=function(t){this.result[this.alphaPos]=t,this.alphaPos+=4};var lzDecompress={LZ_IMAGE_TYPE_INVALID:0,LZ_IMAGE_TYPE_PLT1_LE:1,LZ_IMAGE_TYPE_PLT1_BE:2,LZ_IMAGE_TYPE_PLT4_LE:3,LZ_IMAGE_TYPE_PLT4_BE:4,LZ_IMAGE_TYPE_PLT8:5,LZ_IMAGE_TYPE_RGB16:6,LZ_IMAGE_TYPE_RGB24:7,LZ_IMAGE_TYPE_RGB32:8,LZ_IMAGE_TYPE_RGBA:9,LZ_IMAGE_TYPE_XXXA:10,LZPALETTE_FLAG_PAL_CACHE_ME:1,LZPALETTE_FLAG_PAL_FROM_CACHE:2,LZPALETTE_FLAG_TOP_DOWN:4,PLT_PIXELS_PER_BYTE:[0,8,8,2,2,1],PLT1_MASK:[1,2,4,8,16,32,64,128],lz_rgb32_decompress_rgb:function(t){for(var e,i,r,o,_,n,s,a=0,c=new Uint8Array(t),d=c[1],w=c[2],l=256*c[5]+c[4],u=65536*(256*c[7]+c[6])+l,f=new ArrayBuffer(u),m=new Uint32Array(f),b=u/4,p=c[8],h=8;a!=b;)if(0!=(p=c[h++])&&0!=(u=p>>5)){if(i=a,r=(31&p)<<8,7==u)do{u+=e=c[h++]}while(255==e);if(0==(r+=c[h++])){for(n=m[--i];u>9;)m[a]=n,m[a+1]=n,m[a+2]=n,m[a+3]=n,m[a+4]=n,m[a+5]=n,m[a+6]=n,m[a+7]=n,m[a+8]=n,m[a+9]=n,a+=10,u-=10;for(;0!=u--;)m[a++]=n}else if(8191==r&&(r+=(c[h]<<8)+c[h+1],h+=2),i-=r+1,u>100&&i+u<a)s=new Uint32Array(f,4*i,u),m.set(s,a),a+=u,i+=u;else{for(;u>9;)m[a]=m[i],m[a+1]=m[i+1],m[a+2]=m[i+2],m[a+3]=m[i+3],m[a+4]=m[i+4],m[a+5]=m[i+5],m[a+6]=m[i+6],m[a+7]=m[i+7],m[a+8]=m[i+8],m[a+9]=m[i+9],a+=10,u-=10,i+=10;for(;0!=u--;)m[a++]=m[i++]}}else{for(;p>9;)m[a]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],m[a+1]=4278190080|c[h+3]<<16|c[h+4]<<8|c[h+5],m[a+2]=4278190080|c[h+6]<<16|c[h+7]<<8|c[h+8],m[a+3]=4278190080|c[h+9]<<16|c[h+10]<<8|c[h+11],m[a+4]=4278190080|c[h+12]<<16|c[h+13]<<8|c[h+14],m[a+5]=4278190080|c[h+15]<<16|c[h+16]<<8|c[h+17],m[a+6]=4278190080|c[h+18]<<16|c[h+19]<<8|c[h+20],m[a+7]=4278190080|c[h+21]<<16|c[h+22]<<8|c[h+23],m[a+8]=4278190080|c[h+24]<<16|c[h+25]<<8|c[h+26],m[a+9]=4278190080|c[h+27]<<16|c[h+28]<<8|c[h+29],h+=30,a+=10,p-=10;0!=p&&(9==p?(m[a]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],m[a+1]=4278190080|c[h+3]<<16|c[h+4]<<8|c[h+5],m[a+2]=4278190080|c[h+6]<<16|c[h+7]<<8|c[h+8],m[a+3]=4278190080|c[h+9]<<16|c[h+10]<<8|c[h+11],m[a+4]=4278190080|c[h+12]<<16|c[h+13]<<8|c[h+14],m[a+5]=4278190080|c[h+15]<<16|c[h+16]<<8|c[h+17],m[a+6]=4278190080|c[h+18]<<16|c[h+19]<<8|c[h+20],m[a+7]=4278190080|c[h+21]<<16|c[h+22]<<8|c[h+23],m[a+8]=4278190080|c[h+24]<<16|c[h+25]<<8|c[h+26],h+=27,a+=9):8==p?(m[a]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],m[a+1]=4278190080|c[h+3]<<16|c[h+4]<<8|c[h+5],m[a+2]=4278190080|c[h+6]<<16|c[h+7]<<8|c[h+8],m[a+3]=4278190080|c[h+9]<<16|c[h+10]<<8|c[h+11],m[a+4]=4278190080|c[h+12]<<16|c[h+13]<<8|c[h+14],m[a+5]=4278190080|c[h+15]<<16|c[h+16]<<8|c[h+17],m[a+6]=4278190080|c[h+18]<<16|c[h+19]<<8|c[h+20],m[a+7]=4278190080|c[h+21]<<16|c[h+22]<<8|c[h+23],h+=24,a+=8):7==p?(m[a]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],m[a+1]=4278190080|c[h+3]<<16|c[h+4]<<8|c[h+5],m[a+2]=4278190080|c[h+6]<<16|c[h+7]<<8|c[h+8],m[a+3]=4278190080|c[h+9]<<16|c[h+10]<<8|c[h+11],m[a+4]=4278190080|c[h+12]<<16|c[h+13]<<8|c[h+14],m[a+5]=4278190080|c[h+15]<<16|c[h+16]<<8|c[h+17],m[a+6]=4278190080|c[h+18]<<16|c[h+19]<<8|c[h+20],h+=21,a+=7):6==p?(m[a]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],m[a+1]=4278190080|c[h+3]<<16|c[h+4]<<8|c[h+5],m[a+2]=4278190080|c[h+6]<<16|c[h+7]<<8|c[h+8],m[a+3]=4278190080|c[h+9]<<16|c[h+10]<<8|c[h+11],m[a+4]=4278190080|c[h+12]<<16|c[h+13]<<8|c[h+14],m[a+5]=4278190080|c[h+15]<<16|c[h+16]<<8|c[h+17],h+=18,a+=6):5==p?(m[a]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],m[a+1]=4278190080|c[h+3]<<16|c[h+4]<<8|c[h+5],m[a+2]=4278190080|c[h+6]<<16|c[h+7]<<8|c[h+8],m[a+3]=4278190080|c[h+9]<<16|c[h+10]<<8|c[h+11],m[a+4]=4278190080|c[h+12]<<16|c[h+13]<<8|c[h+14],h+=15,a+=5):4==p?(m[a]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],m[a+1]=4278190080|c[h+3]<<16|c[h+4]<<8|c[h+5],m[a+2]=4278190080|c[h+6]<<16|c[h+7]<<8|c[h+8],m[a+3]=4278190080|c[h+9]<<16|c[h+10]<<8|c[h+11],h+=12,a+=4):3==p?(m[a]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],m[a+1]=4278190080|c[h+3]<<16|c[h+4]<<8|c[h+5],m[a+2]=4278190080|c[h+6]<<16|c[h+7]<<8|c[h+8],h+=9,a+=3):2==p?(m[a]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],m[a+1]=4278190080|c[h+3]<<16|c[h+4]<<8|c[h+5],h+=6,a+=2):1==p&&(m[a++]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],h+=3)),m[a++]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],h+=3}if(w===this.LZ_IMAGE_TYPE_RGBA&&!d){var E=new Uint8Array(f);for(a=0,p=null,h--,p=c[h++];a<b;p=c[h++])if(i=a,u=p>>5,r=(31&p)<<8,_=4*a,p>=32){if(6===--u)do{u+=e=c[h++]}while(255===e);if(r+=e=c[h++],255===e&&r-e==7936&&(r=c[h++]<<8,r+=c[h++],r+=8191),u+=3,(i-=r+=1)===a-1)for(o=i;u;--u)E[(_=4*a)+3]=E[4*o+3],a++;else for(;u;--u)E[(_=4*a)+3]=E[4*i+3],a++,i++}else for(p++,E[_+3]=c[h++],a++,--p;p;p--)E[(_=4*a)+3]=c[h++],a++}return f}};wdi.LZSS?wdi.LZSS.lz_rgb32_decompress_rgb=lzDecompress.lz_rgb32_decompress_rgb:wdi.LZSS=lzDecompress;
@@ -1 +0,0 @@
1
- function dispatch(e,t){var i=new Uint8Array(e),r=i[3],o=null,_=i[0];if(_===wdi.WorkerOperations.quic)try{o=wdi.JSQuic.quic_decode(e)}catch(e){}else if(_===wdi.WorkerOperations.lz_rgb)try{o=wdi.LZSS.lz_rgb32_decompress_rgb(e)}catch(e){}else if(_===wdi.WorkerOperations.bytesToUriJpeg)try{return o=bytesToURI(i,"jpeg"),void self.postMessage(o)}catch(e){}else if(_===wdi.WorkerOperations.bytesToUriPng)try{return o=bytesToURI(i,"png"),void self.postMessage(o)}catch(e){}if(!t||!o)return o;r?self.postMessage(o,[o]):self.postMessage(o)}function bytesToURI(e,t){for(var i="data:image/"+t+",",r=e.length,o=4;o<r;o++)e[o]<16?i+="%0":i+="%",i+=e[o].toString(16);return i}function bytesToInt16(e){var t=e.shift();return e.shift()*Math.pow(16,2)+t}function bytesToInt32(e){var t=bytesToInt16(e);return bytesToInt16(e)*Math.pow(16,4)+t}function wdi_quic_QuicFamily(){this.notGRcwlen=[],this.nGRcodewords=[],this.notGRprefixmask=[],this.notGRsuffixlen=[],this.xlatU2L=[],this.xlatL2U=[]}function wdi_quic_s_bucket(){this.pcounters=null,this.bestcode=0}function wdi_quic_CommonState(){this.wm_trigger=this,this.encoder=null,this.waitcnt=0,this.tabrand_seed=wdi.JSQuic.stabrand(),this.wmidx=wdi.JSQuic.DEFwmistart,this.wmileft=wdi.JSQuic.wminext,wdi.JSQuic.set_wm_trigger(this),this.melcstate=0,this.melclen=wdi.JSQuic.J[0],this.melcorder=1<<this.melclen>>>0}function wdi_quic_FamilyStat(){this.buckets_buf=null,this.buckets_ptrs=null,this.counters=0}function wdi_quic_Channel(){this.encoder=null,this.correlate_row_width=0,this.correlate_row=null,this._buckets_ptrs=null,this.family_stat_8bpc=new wdi_quic_FamilyStat,this.family_stat_5bpc=new wdi_quic_FamilyStat,this.state=new wdi_quic_CommonState,this.oldFirst=0}function wdi_quic_Encoder(e){this.computedWidth=0,this.result=[],this.cnt=0,this.pxCnt=0,this.usr=e,this.type=null,this.width=null,this.height=null,this.num_channels=null,this.n_buckets_8bpc=null,this.n_buckets_5bpc=null,this.io_available_bits=32,this.io_now=0,this.io_next_word=null,this.io_now=null,this.read_io_word(),this.io_word=this.io_next_word,this.read_io_word(),this.io_words_count=e.length,this.rows_completed=0,this.channels=[],this.alphaPos=3,this.rgb_state=new wdi_quic_CommonState;for(var t=0;t<4;t++)this.channels[t]=new wdi_quic_Channel,wdi.JSQuic.initChannel(this,this.channels[t])}function cnt_l_zeroes(e){return e>8388607?wdi.JSQuic.lzeroes[e>>>24]:e>32767?8+wdi.JSQuic.lzeroes[e>>>16&255]:e>127?16+wdi.JSQuic.lzeroes[e>>>8&255]:24+wdi.JSQuic.lzeroes[255&e]}function golomb_code_len(e,t){return e<wdi.nGRcodewords[t]?1+(e>>>t)+t:wdi.notGRcwlen[t]}function golomb_decoding(e,t,i,r,o,_,n){var s,a;if(t>r[e]){var c=cnt_l_zeroes(t);a=c<<e|t>>>32-(s=c+1+e)&i[e]}else s=o[e],a=_[e]+(t>>>32-s&i[n[e]]);return[a,s]}function real_update_model(e,t,i,r,o){var _,n,s,a,c=t.pcounters;for(s=c[n=r-1]+=golomb_code_len(i,n),_=r-2;_>=0;_--)(a=c[_]+=golomb_code_len(i,_))<s&&(n=_,s=a);if(t.bestcode=n,s>e.wm_trigger)for(;r-- >0;)c[r]>>>=1}function UPDATE_MODEL(e,t,i,r,o,_){real_update_model(t.rgb_state,find_bucket(t.channels[0],r[e-1]),r[e],i),real_update_model(t.rgb_state,find_bucket(t.channels[1],o[e-1]),o[e],i),real_update_model(t.rgb_state,find_bucket(t.channels[2],_[e-1]),_[e],i)}function find_bucket(e,t){return void 0===t&&(t=e.oldFirst),e._buckets_ptrs[t]}function QUIC_UNCOMPRESS_RGBA(e,t,i,r){quic_uncompress_row0(e,t,i,r),quic_four_uncompress_row0(e,e.channels[3],i,r),e.row_completed();for(var o=e.height,_=e.rgb_state,n=1;n<o;n++)quic_uncompress_row_a(e,t,i,r,_),quic_four_uncompress_row(e,e.channels[3],i,r),e.row_completed()}function quic_four_uncompress_row(e,t,i,r){for(var o=wdi.JSQuic.BPC_MASK[r],_=0,n=e.width;wdi.JSQuic.wmimax>t.state.wmidx&&t.state.wmileft<=n;)t.state.wmileft&&(uncompress_four_row_seg(e,t,_,_+t.state.wmileft,i,o,r),_+=t.state.wmileft,n-=t.state.wmileft),t.state.wmidx++,wdi.JSQuic.set_wm_trigger(t.state),t.state.wmileft=wdi.JSQuic.wminext;n&&(uncompress_four_row_seg(e,t,_,_+n,i,o,r),wdi.JSQuic.wmimax>t.state.wmidx&&(t.state.wmileft-=n))}function uncompress_four_row_seg(e,t,i,r,o,_,n){var s,a,c,d,w=t.correlate_row,l=0,u=wdi.JSQuic.bppmask[t.state.wmidx],f=0,m=0,b=!1,p=e.computedWidth,h=e.rows_completed,E=(e.rows_completed-1)*p,S=e.eatbits,R=e.appendAlpha,g=wdi.JSQuic.bppmask,A=wdi.notGRprefixmask,x=wdi.notGRcwlen,G=wdi.nGRcodewords,v=wdi.notGRsuffixlen;for(i?(l=i+t.state.waitcnt,a=e.result[e.alphaPos-4]):(a=UNCOMPRESS_ONE_0_A(t,e,_,E),t.state.waitcnt?--t.state.waitcnt:(t.state.waitcnt=wdi.JSQuic.tabrand(t.state)&u,real_update_model(t.state,find_bucket(t,w[-1]),w[0],o)),l=++i+t.state.waitcnt);;){for(;l<r;){for(;i<=l&&!(b=RLE_PRED_A(i,e,f,p,h));i++)s=(c=golomb_decoding(find_bucket(t,w[i-1]).bestcode,e.io_word,g,A,x,G,v))[0],d=c[1],w[i]=s,a=(wdi.xlatL2U[s]+(a+PIXEL_B(t,e,i,E)>>>1)&_)>>>0,R.call(e,a),S(d,e);if(b)break;real_update_model(t.state,find_bucket(t,w[l-1]),w[l],o),l=i+(wdi.JSQuic.tabrand(t.state)&u)}if(!b){for(;i<r&&!(b=RLE_PRED_A(i,e,f,p,h));i++)s=(c=golomb_decoding(find_bucket(t,w[i-1]).bestcode,e.io_word,g,A,x,G,v))[0],d=c[1],w[i]=s,a=(wdi.xlatL2U[s]+(a+PIXEL_B(t,e,i,E)>>>1)&_)>>>0,R.call(e,a),S(d,e);if(!b)return void(t.state.waitcnt=l-r)}t.state.waitcnt=l-i,f=i,m=i+wdi.JSQuic.decode_channel_run(e,t);for(var Q=e.rows_completed*(4*e.width)+4*i,P=e.result[Q-1];i<m;i++)R.call(e,P);if(i===r)return;l=i+t.state.waitcnt,b=!1}}function quic_four_uncompress_row0(e,t,i,r){for(var o=wdi.JSQuic.BPC_MASK[r],_=0,n=e.width;wdi.JSQuic.wmimax>t.state.wmidx&&t.state.wmileft<=n;)t.state.wmileft&&(uncompress_four_row0_seg(e,t,_,_+t.wmileft,wdi.JSQuic.bppmask[t.state.wmidx],i,o,r),_+=t.state.wmileft,n-=t.state.wmileft),t.state.wmidx++,wdi.JSQuic.set_wm_trigger(t.state),t.state.wmileft=wdi.JSQuic.wminext;n&&(uncompress_four_row0_seg(e,t,_,_+n,wdi.JSQuic.bppmask[t.state.wmidx],i,o,r),wdi.JSQuic.wmimax>t.state.wmidx&&(t.state.wmileft-=n))}function uncompress_four_row0_seg(e,t,i,r,o,_,n,s){var a=t.correlate_row,c=0;for(i?c=i+t.state.waitcnt:(UNCOMPRESS_ONE_ROW0_0_A(t),t.state.waitcnt?--t.state.waitcnt:(t.state.waitcnt=wdi.JSQuic.tabrand(t.state)&o,real_update_model(t.state,find_bucket(t,a[-1]),a[0],_)),c=++i+t.state.waitcnt);c<r;){for(;i<=c;i++)UNCOMPRESS_ONE_ROW0_A(t,i,n,e,a);real_update_model(t.state,find_bucket(t,a[c-1]),a[c],_),c=i+(wdi.JSQuic.tabrand(t.state)&o)}for(;i<r;i++)UNCOMPRESS_ONE_ROW0_A(t,i,n,e,a);t.state.waitcnt=c-r}function SAME_PIXEL_A(e,t){return t[e-1]===t[e+3]}function RLE_PRED_A(e,t,i,r,o){var _=(o-1)*r+4*e;return!!(i!==e&&e>2&&SAME_PIXEL_A(_,t.result)&&SAME_PIXEL_A(_=o*r+4*(e-1),t.result))}function UNCOMPRESS_ONE_0_A(e,t,i,r){var o,_;e.oldFirst=e.correlate_row[0],o=golomb_decoding(find_bucket(e,e.correlate_row[-1]).bestcode,t.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen),e.correlate_row[0]=o[0],_=o[1];var n=(wdi.xlatL2U[e.correlate_row[0]]+PIXEL_B(e,t,0,r)&i)>>>0;return t.appendAlpha(n),t.eatbits(_,t),n}function UNCOMPRESS_ONE_A(e,t,i,r,o,_){var n,s,a=(n=golomb_decoding(find_bucket(e,o[t-1]).bestcode,r.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen))[0];s=n[1],o[t]=a,r.appendAlpha((wdi.xlatL2U[a]+(PIXEL_A_A(r)+PIXEL_B(e,r,t,_)>>>1)&i)>>>0),r.eatbits(s,r)}function UNCOMPRESS_ONE_ROW0_0_A(e){var t,i,r=e.encoder;t=golomb_decoding(find_bucket(e,0).bestcode,r.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen),e.correlate_row[0]=t[0],i=t[1],r.appendAlpha(wdi.xlatL2U[e.correlate_row[0]]),r.eatbits(i,r)}function UNCOMPRESS_ONE_ROW0_A(e,t,i,r,o){var _,n,s=(_=golomb_decoding(find_bucket(e,o[t-1]).bestcode,r.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen))[0];n=_[1],o[t]=s,r.appendAlpha(CORELATE_0_A(r,e,t,i,o)),r.eatbits(n,r)}function CORELATE_0_A(e,t,i,r,o){return(wdi.xlatL2U[o[i]]+PIXEL_A_A(e)&r)>>>0}function PIXEL_A_A(e){return e.result[e.alphaPos-4]}function QUIC_UNCOMPRESS_RGB(e,t,i,r){quic_uncompress_row0(e,t,i,r),e.row_completed();for(var o=e.rgb_state,_=e.height,n=e.result,s=e.resultData,a=e.width,c=wdi.JSQuic.BPC_MASK[r],d=wdi.JSQuic,w=e.channels[0],l=e.channels[1],u=e.channels[2],f=w._buckets_ptrs,m=l._buckets_ptrs,b=u._buckets_ptrs,p=w.correlate_row,h=l.correlate_row,E=u.correlate_row,S=e.computedWidth,R=wdi.xlatL2U,g=wdi.JSQuic.lzeroes,A=wdi.JSQuic.lzeroes8,x=wdi.JSQuic.lzeroes16,G=wdi.JSQuic.lzeroes24,v=wdi.notGRprefixmask,Q=wdi.notGRcwlen,P=wdi.nGRcodewords,k=wdi.notGRsuffixlen,I=e.eatbits,L=wdi.JSQuic.tabrand,M=wdi.JSQuic.decode_run,U=wdi.JSQuic.bppmask,J=(d=wdi.JSQuic,wdi.JSQuic.tabrand_chaos),O=d.TABRAND_SEEDMASK,C=e.usr,y=1;y<_;y++)quic_uncompress_row(e,t,i,r,o,-16777216,n,s,a,c,d,w,l,u,f,m,b,p,h,E,S,R,g,A,x,G,v,Q,P,k,I,L,M,U,J,O,C),e.rows_completed++}function quic_uncompress_row(e,t,i,r,o,_,n,s,a,c,d,w,l,u,f,m,b,p,h,E,S,R,g,A,x,G,v,Q,P,k,I,L,M,U,J,O,C){for(var y=0,T=e.rows_completed,N=T*S/4,z=(T-1)*S;d.wmimax>o.wmidx&&o.wmileft<=a;)o.wmileft&&(uncompress_row_seg(e,y,y+o.wmileft,i,c,r,o,_,n,s,w,l,u,f,m,b,p,h,E,S,R,g,A,x,G,v,Q,P,k,I,L,M,U,d,J,T,O,z,N,C),y+=o.wmileft,a-=o.wmileft),o.wmidx++,d.set_wm_trigger(o),o.wmileft=d.wminext;a&&(uncompress_row_seg(e,y,y+a,i,c,r,o,_,n,s,w,l,u,f,m,b,p,h,E,S,R,g,A,x,G,v,Q,P,k,I,L,M,U,d,J,T,O,z,N,C),d.wmimax>e.rgb_state.wmidx&&(o.wmileft-=a))}function quic_uncompress_row_a(e,t,i,r,o){for(var _=wdi.JSQuic.BPC_MASK[r],n=0,s=e.width;wdi.JSQuic.wmimax>o.wmidx&&o.wmileft<=s;)o.wmileft&&(uncompress_row_seg_a(e,n,n+o.wmileft,i,_,r,o),n+=o.wmileft,s-=o.wmileft),o.wmidx++,wdi.JSQuic.set_wm_trigger(o),o.wmileft=wdi.JSQuic.wminext;s&&(uncompress_row_seg_a(e,n,n+s,i,_,r,o),wdi.JSQuic.wmimax>e.rgb_state.wmidx&&(o.wmileft-=s))}function SAME_PIXEL_RGB_A(e,t){return t[e-4]===t[e]&&t[e-3]===t[e+1]&&t[e-2]===t[e+2]}function SAME_PIXEL(e,t){return t[e-1]===t[e]}function RLE_PRED_RGB_A(e,t,i,r,o){if(o!==e&&e>2&&(SAME_PIXEL_RGB_A(i,t.result)&&SAME_PIXEL_RGB_A(r+4*(e-1),t.result)))return!0;return!1}function RLE_PRED(e,t,i,r,o){if(o!==e&&e>2&&(SAME_PIXEL(4*i,t.result)&&SAME_PIXEL(4*(r+e-1),t.result)))return!0;return!1}function uncompress_row_seg(e,t,i,r,o,_,n,s,a,c,d,w,l,u,f,m,b,p,h,E,S,R,g,A,x,G,v,Q,P,k,I,L,M,U,J,O,C,y,T,N){var z,D,B,q,Y,W,X,F,Z,K,H,V,j,$,ee,te,ie,re,oe,_e=0,ne=M[n.wmidx],se=0,ae=!1,ce=e.cnt,de=e.pxCnt;for(t?(_e=t+n.waitcnt,B=a[ce-4],q=a[ce-3],Y=a[ce-2],W=b[t-1],X=p[t-1],F=h[t-1]):(B=UNCOMPRESS_ONE_0(d,e,o,y),q=UNCOMPRESS_ONE_0(w,e,o,y),Y=UNCOMPRESS_ONE_0(l,e,o,y),W=b[0],X=p[0],F=h[0],c[de++]=255<<24|Y<<16|q<<8|B,n.waitcnt?--n.waitcnt:(n.waitcnt=I.call(U,n)&ne,UPDATE_MODEL(0,e,r,b,p,h)),_e=++t+n.waitcnt);;){for(;_e<i;){for(D=y+4*t;t<=_e;t++){if(c[($=D/4)-1]===c[$]&&c[(j=T+t-1)-1]===c[j]&&se!==t&&t>2){ae=!0;break}K=u[W].bestcode,(H=e.io_word)>G[K]?W=(V=H>8388607?R[H>>>24]:H>32767?g[H>>>16&255]:H>127?A[H>>>8&255]:x[255&H])<<K|H>>>32-(Z=V+1+K)&M[K]:(Z=v[K],W=Q[K]+(H>>>32-Z&M[P[K]])),b[t]=W,B=S[W]+(B+a[D++]>>>1)&o,te=e.io_available_bits,ie=e.io_word,ie<<=Z,(re=te-Z)>=0?(ie=(ie|e.io_next_word>>>re)>>>0,e.io_available_bits=re,e.io_word=ie):(ie=((ie|=(oe=e.io_next_word)<<(re=-re)>>>0)|(oe=N[e.io_now++])>>>(te=32-re))>>>0,e.io_available_bits=te,e.io_word=ie,e.io_next_word=oe),K=f[X].bestcode,(H=e.io_word)>G[K]?X=(V=H>8388607?R[H>>>24]:H>32767?g[H>>>16&255]:H>127?A[H>>>8&255]:x[255&H])<<K|H>>>32-(Z=V+1+K)&M[K]:(Z=v[K],X=Q[K]+(H>>>32-Z&M[P[K]])),p[t]=X,q=S[X]+(q+a[D++]>>>1)&o,te=e.io_available_bits,ie=e.io_word,ie<<=Z,(re=te-Z)>=0?(ie=(ie|e.io_next_word>>>re)>>>0,e.io_available_bits=re,e.io_word=ie):(ie=((ie|=(oe=e.io_next_word)<<(re=-re)>>>0)|(oe=N[e.io_now++])>>>(te=32-re))>>>0,e.io_available_bits=te,e.io_word=ie,e.io_next_word=oe),K=m[F].bestcode,(H=e.io_word)>G[K]?F=(V=H>8388607?R[H>>>24]:H>32767?g[H>>>16&255]:H>127?A[H>>>8&255]:x[255&H])<<K|H>>>32-(Z=V+1+K)&M[K]:(Z=v[K],F=Q[K]+(H>>>32-Z&M[P[K]])),h[t]=F,Y=S[F]+(Y+a[D++]>>>1)&o,te=e.io_available_bits,ie=e.io_word,ie<<=Z,(re=te-Z)>=0?(ie=(ie|e.io_next_word>>>re)>>>0,e.io_available_bits=re,e.io_word=ie):(ie=((ie|=(oe=e.io_next_word)<<(re=-re)>>>0)|(oe=N[e.io_now++])>>>(te=32-re))>>>0,e.io_available_bits=te,e.io_word=ie,e.io_next_word=oe),c[de++]=s|Y<<16|q<<8|B,D++}if(ae)break;real_update_model(n,u[b[ee=_e-1]],b[_e],r),real_update_model(n,f[p[ee]],p[_e],r),real_update_model(n,m[h[ee]],h[_e],r),n.tabrand_seed++,_e=t+(J[n.tabrand_seed&C]&ne)}if(!ae){for(D=y+4*t;t<i;t++){if(c[($=D/4)-1]===c[$]&&c[(j=T+t-1)-1]===c[j]&&se!==t&&t>2){ae=!0;break}K=u[W].bestcode,(H=e.io_word)>G[K]?W=(V=H>8388607?R[H>>>24]:H>32767?g[H>>>16&255]:H>127?A[H>>>8&255]:x[255&H])<<K|H>>>32-(Z=V+1+K)&M[K]:(Z=v[K],W=Q[K]+(H>>>32-Z&M[P[K]])),b[t]=W,B=S[W]+(B+a[D++]>>>1)&o,te=e.io_available_bits,ie=e.io_word,ie<<=Z,(re=te-Z)>=0?(ie=(ie|e.io_next_word>>>re)>>>0,e.io_available_bits=re,e.io_word=ie):(ie=((ie|=(oe=e.io_next_word)<<(re=-re)>>>0)|(oe=N[e.io_now++])>>>(te=32-re))>>>0,e.io_available_bits=te,e.io_word=ie,e.io_next_word=oe),K=f[X].bestcode,(H=e.io_word)>G[K]?X=(V=H>8388607?R[H>>>24]:H>32767?g[H>>>16&255]:H>127?A[H>>>8&255]:x[255&H])<<K|H>>>32-(Z=V+1+K)&M[K]:(Z=v[K],X=Q[K]+(H>>>32-Z&M[P[K]])),p[t]=X,q=S[X]+(q+a[D++]>>>1)&o,te=e.io_available_bits,ie=e.io_word,ie<<=Z,(re=te-Z)>=0?(ie=(ie|e.io_next_word>>>re)>>>0,e.io_available_bits=re,e.io_word=ie):(ie=((ie|=(oe=e.io_next_word)<<(re=-re)>>>0)|(oe=N[e.io_now++])>>>(te=32-re))>>>0,e.io_available_bits=te,e.io_word=ie,e.io_next_word=oe),K=m[F].bestcode,(H=e.io_word)>G[K]?F=(V=H>8388607?R[H>>>24]:H>32767?g[H>>>16&255]:H>127?A[H>>>8&255]:x[255&H])<<K|H>>>32-(Z=V+1+K)&M[K]:(Z=v[K],F=Q[K]+(H>>>32-Z&M[P[K]])),h[t]=F,Y=S[F]+(Y+a[D++]>>>1)&o,te=e.io_available_bits,ie=e.io_word,ie<<=Z,(re=te-Z)>=0?(ie=(ie|e.io_next_word>>>re)>>>0,e.io_available_bits=re,e.io_word=ie):(ie=((ie|=(oe=e.io_next_word)<<(re=-re)>>>0)|(oe=N[e.io_now++])>>>(te=32-re))>>>0,e.io_available_bits=te,e.io_word=ie,e.io_next_word=oe),c[de++]=255<<24|Y<<16|q<<8|B,D++}if(!ae)return n.waitcnt=_e-i,e.cnt=4*de,void(e.pxCnt=de)}for(n.waitcnt=_e-t,se=t,run_end=L(e),t=run_end+t;run_end-- >0;)c[de++]=s|Y<<16|q<<8|B;if(t===i)return e.cnt=4*de,void(e.pxCnt=de);W=b[z=t-1],X=p[z],F=h[z],_e=t+n.waitcnt,ae=!1}}function uncompress_row_seg_a(e,t,i,r,o,_,n){var s,a,c,d,w,l,u,f,m,b,p,h,E=e.channels[0],S=e.channels[1],R=e.channels[2],g=E._buckets_ptrs,A=S._buckets_ptrs,x=R._buckets_ptrs,G=E.correlate_row,v=S.correlate_row,Q=R.correlate_row,P=0,k=wdi.JSQuic.bppmask[n.wmidx],I=0,L=0,M=!1,U=e.computedWidth,J=(e.rows_completed-1)*U,O=e.rows_completed*U,C=(e.rows_completed,e.rows_completed,e.result),y=e.resultData,T=wdi.xlatL2U,N=e.eatbits,z=wdi.JSQuic.tabrand,D=wdi.JSQuic.decode_run,B=(wdi.JSQuic.lzeroes,wdi.JSQuic.lzeroes8,wdi.JSQuic.lzeroes16,wdi.JSQuic.lzeroes24,e.cnt),q=e.pxCnt,Y=wdi.JSQuic.bppmask,W=wdi.notGRprefixmask,X=wdi.notGRcwlen,F=wdi.nGRcodewords,Z=wdi.notGRsuffixlen,K=255<<24;for(t?(P=t+n.waitcnt,c=C[B-4],d=C[B-3],w=C[B-2],l=G[t-1],u=v[t-1],f=Q[t-1]):(c=UNCOMPRESS_ONE_0(E,e,o,J),d=UNCOMPRESS_ONE_0(S,e,o,J),w=UNCOMPRESS_ONE_0(R,e,o,J),l=G[0],u=v[0],f=Q[0],y[q++]=255<<24|w<<16|d<<8|c,n.waitcnt?--n.waitcnt:(n.waitcnt=z.call(wdi.JSQuic,n)&k,UPDATE_MODEL(0,e,r,G,v,Q)),P=++t+n.waitcnt);;){for(;P<i;){for(a=J+4*t;t<=P&&!(M=RLE_PRED_RGB_A(t,e,a,O,I));t++)b=g[l].bestcode,(p=e.io_word)>W[b]?l=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],l=F[b]+(p>>>32-m&Y[Z[b]])),G[t]=l,c=T[l]+(c+C[a++]>>>1)&o,N(m,e),b=A[u].bestcode,(p=e.io_word)>W[b]?u=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],u=F[b]+(p>>>32-m&Y[Z[b]])),v[t]=u,d=T[u]+(d+C[a++]>>>1)&o,N(m,e),b=x[f].bestcode,(p=e.io_word)>W[b]?f=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],f=F[b]+(p>>>32-m&Y[Z[b]])),Q[t]=f,w=T[f]+(w+C[a++]>>>1)&o,N(m,e),y[q++]=K|w<<16|d<<8|c,a++;if(M)break;UPDATE_MODEL(P,e,r,G,v,Q),P=t+(z.call(wdi.JSQuic,n)&k)}if(!M){for(a=J+4*t;t<i&&!(M=RLE_PRED_RGB_A(t,e,a,O,I));t++)b=g[l].bestcode,(p=e.io_word)>W[b]?l=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],l=F[b]+(p>>>32-m&Y[Z[b]])),G[t]=l,c=T[l]+(c+C[a++]>>>1)&o,N(m,e),b=A[u].bestcode,(p=e.io_word)>W[b]?u=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],u=F[b]+(p>>>32-m&Y[Z[b]])),v[t]=u,d=T[u]+(d+C[a++]>>>1)&o,N(m,e),b=x[f].bestcode,(p=e.io_word)>W[b]?f=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],f=F[b]+(p>>>32-m&Y[Z[b]])),Q[t]=f,w=T[f]+(w+C[a++]>>>1)&o,N(m,e),y[q++]=255<<24|w<<16|d<<8|c,a++;if(!M)return n.waitcnt=P-i,e.cnt=4*q,void(e.pxCnt=q)}for(n.waitcnt=P-t,I=t,t=(L=D(e))+t;L-- >0;)y[q++]=K|w<<16|d<<8|c;if(t===i)return e.cnt=4*q,void(e.pxCnt=q);l=G[s=t-1],u=v[s],f=Q[s],P=t+n.waitcnt,M=!1}}function quic_uncompress_row0(e,t,i,r){for(var o=wdi.JSQuic.BPC_MASK[r],_=0,n=e.width;wdi.JSQuic.wmimax>e.rgb_state.wmidx&&e.rgb_state.wmileft<=n;)e.rgb_state.wmileft&&(uncompress_row0_seg(e,_,_+e.rgb_state.wmileft,wdi.JSQuic.bppmask[e.rgb_state.wmidx],i,o,r),_+=e.rgb_state.wmileft,n-=e.rgb_state.wmileft),e.rgb_state.wmidx++,wdi.JSQuic.set_wm_trigger(e.rgb_state),e.rgb_state.wmileft=wdi.JSQuic.wminext;n&&(uncompress_row0_seg(e,_,_+n,wdi.JSQuic.bppmask[e.rgb_state.wmidx],i,o,r),wdi.JSQuic.wmimax>e.rgb_state.wmidx&&(e.rgb_state.wmileft-=n))}function uncompress_row0_seg(e,t,i,r,o,_,n){var s,a,c,d=e.channels[0],w=e.channels[1],l=e.channels[2],u=d.correlate_row,f=w.correlate_row,m=l.correlate_row,b=0;for(t?b=t+e.rgb_state.waitcnt:(s=UNCOMPRESS_ONE_ROW0_0(d),a=UNCOMPRESS_ONE_ROW0_0(w),c=UNCOMPRESS_ONE_ROW0_0(l),e.appendPixel(s,a,c),e.rgb_state.waitcnt?--e.rgb_state.waitcnt:(e.rgb_state.waitcnt=wdi.JSQuic.tabrand(e.rgb_state)&r,UPDATE_MODEL(0,e,o,u,f,m)),b=++t+e.rgb_state.waitcnt);b<i;){for(;t<=b;t++)s=UNCOMPRESS_ONE_ROW0(d,t,_,e,u,s),a=UNCOMPRESS_ONE_ROW0(w,t,_,e,f,a),c=UNCOMPRESS_ONE_ROW0(l,t,_,e,m,c),e.appendPixel(s,a,c);UPDATE_MODEL(b,e,o,u,f,m),b=t+(wdi.JSQuic.tabrand(e.rgb_state)&r)}for(;t<i;t++)s=UNCOMPRESS_ONE_ROW0(d,t,_,e,u,s),a=UNCOMPRESS_ONE_ROW0(w,t,_,e,f,a),c=UNCOMPRESS_ONE_ROW0(l,t,_,e,m,c),e.appendPixel(s,a,c);e.rgb_state.waitcnt=b-i}function UNCOMPRESS_ONE_0(e,t,i,r){var o,_;e.oldFirst=e.correlate_row[0],o=golomb_decoding(find_bucket(e,e.correlate_row[0]).bestcode,t.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen),e.correlate_row[0]=o[0],_=o[1];var n=wdi.xlatL2U[e.correlate_row[0]]+t.result[r+e.num_channel]&i;return t.eatbits(_,t),n}function UNCOMPRESS_ONE(e,t,i,r,o,_,n,s,a,c,d,w,l){var u,f=(m=golomb_decoding(w[n[i]].bestcode,_.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen))[0];u=m[1],n[t]=f;var m=d[f]+(l+a[s+r+c]>>>1)&o;return _.eatbits(u,_),m}function UNCOMPRESS_ONE_ROW0_0(e){var t,i=e.encoder;r=golomb_decoding(find_bucket(e,0).bestcode,i.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen),e.correlate_row[0]=r[0],t=r[1];var r=wdi.xlatL2U[e.correlate_row[0]];return i.eatbits(t,i),r}function UNCOMPRESS_ONE_ROW0(e,t,i,r,o,_){var n;s=golomb_decoding(find_bucket(e,o[t-1]).bestcode,r.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen),o[t]=s[0],n=s[1];var s=CORELATE_0(r,e,t,i,o,_);return r.eatbits(n,r),s}function CORELATE_0(e,t,i,r,o,_){return wdi.xlatL2U[o[i]]+_&r}function PIXEL_A(e){return e.result[e.cnt-4]}function PIXEL_B(e,t,i,r){return t.result[r+4*i+e.num_channel]}window=this,window.wdi||(window.wdi={}),window.wdi.WorkerOperations={quic:0,lz_rgb:1,bytesToUriJpeg:2,bytesToUriPng:3},window.workerDispatch=dispatch,self.addEventListener("message",(function(e){return dispatch(e.data,!0)}),!1),wdi.QuicImageType={QUIC_IMAGE_TYPE_INVALID:0,QUIC_IMAGE_TYPE_GRAY:1,QUIC_IMAGE_TYPE_RGB16:2,QUIC_IMAGE_TYPE_RGB24:3,QUIC_IMAGE_TYPE_RGB32:4,QUIC_IMAGE_TYPE_RGBA:5},wdi.quic={},wdi.JSQuic={QUIC_MAGIC:1364543811,MAXNUMCODES:8,DEFevol:3,MINevol:0,MAXevol:5,DEFwmistart:0,MINwmistart:0,DEFmaxclen:26,DEFwmimax:6,DEFwminext:2048,MINwminext:1,MAXwminext:1e8,MAX_CHANNELS:4,wmimax:6,wminext:2048,evol:3,family_8bpc:new wdi_quic_QuicFamily,family_5bpc:new wdi_quic_QuicFamily,bppmask:new Int32Array([0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215,33554431,67108863,134217727,268435455,536870911,1073741823,2147483647,4294967295]),bitat:new Int32Array([1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648]),TABRAND_TABSIZE:256,TABRAND_SEEDMASK:255,tabrand_chaos:new Int32Array([46495042,893548311,794435923,2453991765,2077388039,894197842,1462934312,697534094,1826128012,343623392,2581292719,3811265708,459739748,2638427270,1654964626,101227083,2654850628,3668700691,572794346,2758751005,3445133904,2344099199,3367450297,898927923,3618406352,1606297603,754696453,20823118,2050458127,972590750,3990194068,3305596553,4239238564,1690498157,3015324227,2306127097,1510321853,548392192,971157512,2292288069,1611390505,4086766286,4084927083,1883326811,1891043243,113180603,1107690783,3778825955,3248980775,2443839100,2190866218,1932072870,495393613,1078522166,4051963518,1784694977,1768732442,2146763203,264646923,1474361405,2361552500,296035746,2489922759,2094565616,2409465348,1334241083,72483606,3740181004,4057920662,1734898312,4114662834,574624900,880305546,3258472262,26713132,1571648456,52557195,4043234286,2458021343,676064371,1528437109,64953873,546717185,2709319979,1947039598,2812723004,28691684,286829174,4235176970,3465707163,12526951,2154766700,3165032534,2036061161,3386656087,2301212354,2023576300,1061142336,3105452904,2743866805,3283373992,3397596080,3085489552,3196092395,3210707808,3651022684,925444321,2088074316,230011220,3223248386,533229176,523863486,3028311159,13140218,2538347282,900399636,3000796173,1526771255,3541282854,2992674461,2135722105,389334227,1225164337,3119947809,1803959919,3471171263,704170491,1407019136,1924534819,526887421,168782227,333811993,298623278,4268451686,381087740,2542899140,3266880867,2498950977,200969370,3511909096,3252303004,2268881098,2499828613,2606499854,3163208665,3790254546,1840025712,1319758833,3771674836,519421307,3512796222,1563402978,4284300462,2263719815,715250337,3178437172,2660191010,2982332026,3256309961,2709659997,3434092872,2367065591,69438718,915160508,183164069,3134331940,175242981,2680543346,1421955782,4231173251,1736652874,3990568476,1710820912,2286604440,3464587098,1261907837,1757387321,1128554270,1090050251,2429922486,1288729218,882830086,211637042,1376462063,2147615815,1737974929,798170275,4271572277,4241687072,1638524620,2760366295,1065115089,2097227717,1224023317,1625204849,3383303351,1488272307,2640186157,1649047732,819719707,2615091943,502645401,760628135,4108137983,63606742,1404337880,1865161130,4272996852,1239761976,790984678,3213322601,1917062825,4195069880,1962259360,2111002573,2311983960,1861406170,511141875,2797510619,1331661048,3130608186,147483493,3767089176,2650841450,4096523407,2574446300,1956416337,851468126,3607527519,1811658703,3642821136,832691095,2453312857,933732854,94341217,3393797730,1695907457,2405722077,2877685663,2469507058,2249636341,3988608661,4001245617,825934927,3103985967,1127151177,3691656896,1640967098,2168932645,2830550957,3998822878,3002602893,1509651465,775813869,2599574079,3791574229]),besttrigtab:[[550,900,800,700,500,350,300,200,180,180,160],[110,550,900,800,550,400,350,250,140,160,140],[100,120,550,900,700,500,400,300,220,250,160]],lzeroes:new Int32Array([8,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),J:new Int32Array([0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,5,5,6,6,7,7,8,9,10,11,12,13,14,15]),zeroLUT:null,BPC_MASK:{4:255,5:255,24:255,16:31},stabrand:function(){return this.TABRAND_SEEDMASK},tabrand:function(e){return e.tabrand_seed++,this.tabrand_chaos[e.tabrand_seed&this.TABRAND_SEEDMASK]},set_wm_trigger:function(e){var t=e.wmidx;t>10&&(t=10),e.wm_trigger=wdi.JSQuic.besttrigtab[Math.floor(wdi.JSQuic.evol>>1)][t]},ceil_log_2:function(e){var t;if(1===e)return 0;for(t=1,e-=1;e>>>=1;)t++;return t},decorelate_init:function(e,t){var i,r=this.bppmask[t],o=r>>>1;for(i=0;i<=r;i++)e.xlatU2L[i]=i<=o?i<<1>>>0:1+(r-i<<1>>>0)},corelate_init:function(e,t){var i,r=this.bppmask[t];for(i=0;i<=r;i++)e.xlatL2U[i]=1&i?r-(i>>>1):i>>>1},family_init:function(e,t,i){var r;for(r=0;r<t;r++){var o,_;(o=i-t)>parseInt(this.bppmask[t-r])&&(o=this.bppmask[t-r]),_=this.bppmask[t]+1-(o<<r>>>0),e.nGRcodewords[r]=o<<r>>>0,e.notGRcwlen[r]=o+this.ceil_log_2(_),e.notGRprefixmask[r]=this.bppmask[32-o],e.notGRsuffixlen[r]=this.ceil_log_2(_)}this.corelate_init(e,t)},init_zeroLUT:function(){var e,t,i,r;for(this.zeroLUT=new Int32Array(256),t=i=1,r=8,e=0;e<256;++e)this.zeroLUT[e]=r,0===--i&&(i=t,--r,t*=2)},quic_init:function(){this.family_init(this.family_8bpc,8,this.DEFmaxclen),this.init_zeroLUT(),wdi.xlatL2U=new Int32Array(this.family_8bpc.xlatL2U.length),wdi.xlatL2U.set(this.family_8bpc.xlatL2U),wdi.notGRprefixmask=new Int32Array(this.family_8bpc.notGRprefixmask.length),wdi.notGRprefixmask.set(this.family_8bpc.notGRprefixmask),wdi.nGRcodewords=new Int32Array(this.family_8bpc.nGRcodewords.length),wdi.nGRcodewords.set(this.family_8bpc.nGRcodewords),wdi.notGRcwlen=new Int32Array(this.family_8bpc.notGRcwlen.length),wdi.notGRcwlen.set(this.family_8bpc.notGRcwlen),wdi.notGRsuffixlen=new Int32Array(this.family_8bpc.notGRsuffixlen.length),wdi.notGRsuffixlen.set(this.family_8bpc.notGRsuffixlen);for(var e=wdi.JSQuic.lzeroes,t=new Int32Array(e),i=e.length,r=0;r<i;r++)t[r]=e[r]+8;wdi.JSQuic.lzeroes8=t;var o=new Int32Array(e);for(r=0;r<i;r++)o[r]=e[r]+16;wdi.JSQuic.lzeroes16=o;var _=new Int32Array(e);for(r=0;r<i;r++)_[r]=e[r]+24;wdi.JSQuic.lzeroes24=_},quic_image_params:function(e,t){var i,r;switch(t){case wdi.QuicImageType.QUIC_IMAGE_TYPE_GRAY:i=1,r=8;break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB16:i=3,r=5;break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB24:case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB32:i=3,r=8;break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGBA:i=4,r=8;break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_INVALID:default:i=0,r=0}return[i,r]},find_model_params:function(e,t){var i=0,r=0,o=0,_=0,n={ncounters:8};switch(n.levels=1<<t,n.n_buckets_ptrs=0,this.evol){case 1:n.repfirst=3,n.firstsize=1,n.repnext=2,n.mulsize=2;break;case 3:n.repfirst=1,n.firstsize=1,n.repnext=1,n.mulsize=2;break;case 5:n.repfirst=1,n.firstsize=1,n.repnext=1,n.mulsize=4;break;default:return wdi.Debug.error("fund model params: invalid evol"),!1}n.nbuckets=0,_=n.repfirst+1,i=n.firstsize;do{r=n.nbuckets?o+1:0,--_||(_=n.repnext,i*=n.mulsize),(o=r+i-1)+i>=n.levels&&(o=n.levels-1),n.n_buckets_ptrs||(n.n_buckets_ptrs=n.levels),n.nbuckets++}while(o<n.levels-1);return n},init_model_structures:function(e,t,i){t.buckets_buf=[];for(var r=0;r<i.nbuckets;r++)t.buckets_buf[r]=new wdi_quic_s_bucket;t.buckets_ptrs=[],t.counters=[],this.fill_model_structures(e,t,i)},fill_model_structures:function(e,t,i){var r,o,_,n,s=0;n=0,_=i.repfirst+1,r=i.firstsize;do{o=n?s+1:0,--_||(_=i.repnext,r*=i.mulsize),(s=o+r-1)+r>=i.levels&&(s=i.levels-1),t.buckets_buf[n].pcounters=new Int32Array(i.ncounters);for(var a=0;a<i.ncounters;a++)t.buckets_buf[n].pcounters[a]=0;for(var c=o;c<=s;c++)t.buckets_ptrs[c]=t.buckets_buf[n];n++}while(s<i.levels-1)},initChannel:function(e,t){t.encoder=e,t.state.encoder=e,t.correlate_row_width=0,t.correlate_row=null;var i=this.find_model_params(e,8);e.n_buckets_8bpc=i.nbuckets,this.init_model_structures(e,t.family_stat_8bpc,i),i=this.find_model_params(e,5),e.n_buckets_5bpc=i.nbuckets,this.init_model_structures(e,t.family_stat_5bpc,i)},encoder_reste_channels:function(e,t,i,r){e.num_channels=t;for(var o=0;o<t;o++){var _,n;if(e.channels[o].correlate_row_width<i&&(e.channels[o].correlate_row=new Array(i),e.channels[o].correlate_row_width=i),e.channels[o].num_channel=o,8===r){_=e.channels[o].family_stat_8bpc.buckets_buf,n=e.n_buckets_8bpc;for(var s=0;s<n;s++)_[s].bestcode=7;e.channels[o]._buckets_ptrs=e.channels[o].family_stat_8bpc.buckets_ptrs}else{if(5!==r)return FALSE;_=e.channels[o].family_stat_5bpc.buckets_buf,n=e.n_buckets_5bpc;for(s=0;s<n;s++)_[s].bestcode=4;e.channels[o]._buckets_ptrs=e.channels[o].family_stat_5bpc.buckets_ptrs}e.channels[o].state.waitcnt=0,e.channels[o].state.tabrand_seed=wdi.JSQuic.stabrand(),e.channels[o].state.wmidx=wdi.JSQuic.DEFwmistart,e.channels[o].state.wmileft=wdi.JSQuic.wminext}return!0},decode_channel_run:function(e,t){for(var i=0;;){var r,o;for(r=wdi.JSQuic.zeroLUT[(~(e.io_word>>>24)>>>0)%256],o=1;o<=r;o++)i+=t.state.melcorder,t.state.melcstate<32&&(t.state.melclen=wdi.JSQuic.J[++t.state.melcstate],t.state.melcorder=1<<t.state.melclen>>>0);if(8!==r){e.eatbits(r+1,e);break}e.eatbits(8,e)}return t.state.melclen&&(i+=e.io_word>>>32-t.state.melclen,e.eatbits(t.state.melclen,e)),t.state.melcstate&&(t.state.melclen=wdi.JSQuic.J[--t.state.melcstate],t.state.melcorder=1<<t.state.melclen>>>0),i},decode_run:function(e){for(var t,i,r,o=0,_=wdi.JSQuic.zeroLUT,n=e.rgb_state,s=wdi.JSQuic.J,a=e.eatbits;;){for(r=(t=_[(~(e.io_word>>>24)>>>0)%256])+1,i=1;i<r;i++)o+=e.rgb_state.melcorder,n.melcstate<32&&(n.melclen=s[++n.melcstate],n.melcorder=1<<n.melclen>>>0);if(8!==t){a(r,e);break}e.eatbits(8,e)}return n.melclen&&(o+=e.io_word>>>32-n.melclen,a(n.melclen,e)),n.melcstate&&(n.melclen=s[--n.melcstate],n.melcorder=1<<n.melclen>>>0),o},quic_decode:function(e){var t=new wdi_quic_Encoder(new Uint32Array(e)),i=65280&t.io_word;t.io_word;t.eat32bits(),t.eat32bits();t.io_word;t.eat32bits();t.io_word;t.eat32bits();var r=t.io_word;t.eat32bits(),t.type=r;var o=t.io_word;t.width=o,t.eat32bits();var _=t.io_word;t.height=_,t.eat32bits();var n=wdi.JSQuic.quic_image_params(t,r),s=n[0],a=n[1];this.encoder_reste_channels(t,s,o,a);var c=new ArrayBuffer(o*_*4),d=new Uint8Array(c);e=new Uint32Array(c);switch(t.result=d,t.resultData=e,t.setComputedWidth(o),r){case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB32:case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB24:QUIC_UNCOMPRESS_RGB(t,s,a,r);break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB16:break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGBA:if(QUIC_UNCOMPRESS_RGBA(t,s,a,r),i)for(var w=d.length-1;w>0;)d[w]=255,w-=4}return c}},wdi.JSQuic.quic_init(),wdi_quic_Encoder.prototype.append=function(e){this.result[this.cnt++]=e},wdi_quic_Encoder.prototype.appendPixel=function(e,t,i){this.resultData[this.pxCnt++]=255<<24|i<<16|t<<8|e,this.cnt+=4},wdi_quic_Encoder.prototype.eatbits=function(e,t){var i=t.io_available_bits,r=t.io_word,o=i-e;if(r<<=e,o>=0)return r=(r|t.io_next_word>>>o)>>>0,t.io_available_bits=o,void(t.io_word=r);var _=t.io_next_word;r=((r|=_<<(o=-o)>>>0)|(_=t.usr[t.io_now++])>>>(i=32-o))>>>0,t.io_available_bits=i,t.io_word=r,t.io_next_word=_},wdi_quic_Encoder.prototype.eat32bits=function(){this.eatbits(16,this),this.eatbits(16,this)},wdi_quic_Encoder.prototype.read_io_word=function(){this.io_next_word=this.usr[this.io_now++]},wdi_quic_Encoder.prototype.row_completed=function(){this.rows_completed++},wdi_quic_Encoder.prototype.setComputedWidth=function(e){this.computedWidth=4*e},wdi_quic_Encoder.prototype.appendAlpha=function(e){this.result[this.alphaPos]=e,this.alphaPos+=4};var lzDecompress={LZ_IMAGE_TYPE_INVALID:0,LZ_IMAGE_TYPE_PLT1_LE:1,LZ_IMAGE_TYPE_PLT1_BE:2,LZ_IMAGE_TYPE_PLT4_LE:3,LZ_IMAGE_TYPE_PLT4_BE:4,LZ_IMAGE_TYPE_PLT8:5,LZ_IMAGE_TYPE_RGB16:6,LZ_IMAGE_TYPE_RGB24:7,LZ_IMAGE_TYPE_RGB32:8,LZ_IMAGE_TYPE_RGBA:9,LZ_IMAGE_TYPE_XXXA:10,LZPALETTE_FLAG_PAL_CACHE_ME:1,LZPALETTE_FLAG_PAL_FROM_CACHE:2,LZPALETTE_FLAG_TOP_DOWN:4,PLT_PIXELS_PER_BYTE:[0,8,8,2,2,1],PLT1_MASK:[1,2,4,8,16,32,64,128],lz_rgb32_decompress_rgb:function(e){var t=1,i=0,r=new Uint8Array(e),o=r[t+1],_=r[t+2],n=256*r[(t+=3)+1]+r[t],s=256*r[(t+=2)+1]+r[t];t+=2;var a,c,d,w,l,u,f,m=65536*s+n,b=new ArrayBuffer(m),p=new Uint32Array(b),h=m/4,E=r[t++];do{if(0!==(m=E>>5)){if(c=i,d=(31&E)<<8,7===m)do{m+=a=r[t++]}while(255===a);if(8191===(d+=r[t++])&&(d+=(r[t]<<8)+r[t+1],t+=2),0===d){if(u=p[--c],0!==m)do{p[i++]=u}while(0!=--m)}else if(c-=d+1,m>100&&c+m<i)f=new Uint32Array(b,4*c,m),p.set(f,i),i+=m,c+=m;else{if(m>9)do{p[i]=p[c],p[i+1]=p[c+1],p[i+2]=p[c+2],p[i+3]=p[c+3],p[i+4]=p[c+4],p[i+5]=p[c+5],p[i+6]=p[c+6],p[i+7]=p[c+7],p[i+8]=p[c+8],p[i+9]=p[c+9],i+=10,m-=10,c+=10}while(m>9);if(0!==m)do{p[i++]=p[c++]}while(0!=--m)}}else{do{p[i++]=-16777216|r[t]<<16|r[t+1]<<8|r[t+2],t+=3}while(0!=E--)}E=r[t++]}while(i<h);if(_===this.LZ_IMAGE_TYPE_RGBA&&!o){var S=new Uint8Array(b);for(i=0,E=null,t--,E=r[t++];i<h;E=r[t++])if(c=i,m=E>>5,d=(31&E)<<8,l=4*i,E>=32){if(6===--m)do{m+=a=r[t++]}while(255===a);if(d+=a=r[t++],255===a&&d-a==7936&&(d=r[t++]<<8,d+=r[t++],d+=8191),m+=3,(c-=d+=1)===i-1)for(w=c;m;--m)S[(l=4*i)+3]=S[4*w+3],i++;else for(;m;--m)S[(l=4*i)+3]=S[4*c+3],i++,c++}else for(E++,S[l+3]=r[t++],i++,--E;E;E--)S[(l=4*i)+3]=r[t++],i++}return b}},fnCode=lzDecompress.lz_rgb32_decompress_rgb.toString();function generate_aux_optimizers(e){var t=generate_aux_optimizer(10);return e=e.replace("var INSERT_AUX_CODE_HERE",t)}function generate_aux_optimizer(e){for(var t="if(len > "+(e-1)+") {\ndo{\n",i=0;i<e;i++)t+="data[op+"+i+"] = aux;\n";return t+="op+="+e+";len -= "+e+";\n} while(len > "+(e-1)+") }\n"}function generate_color_optimizers(e){var t=generate_color_optimizer(100);return t+=generate_color_optimizer(10),e=e.replace("var INSERT_COLOR_CODE_HERE",t)}function generate_color_optimizer(e){for(var t="if(ctrl > "+(e-1)+") {\ndo{\n",i=0;i<e;i++)t+="data[op++] = pre_255_24 | in_buf[encoder] << 16 | in_buf[encoder+1] << 8 | in_buf[encoder+2];\n",t+="encoder+=3;\n";return t+="encoder+="+3*e+";op+="+e+";ctrl -= "+e+";\n} while(len > "+(e-1)+") }\n"}fnCode=generate_aux_optimizers(fnCode),fnCode=generate_color_optimizers(fnCode),eval(fnCode),lzDecompress.lz_rgb32_decompress_rgb=lz_rgb32_decompress_rgb,wdi.LZSS?wdi.LZSS.lz_rgb32_decompress_rgb=lzDecompress.lz_rgb32_decompress_rgb:wdi.LZSS=lzDecompress;
@@ -1 +0,0 @@
1
- function dispatch(t,e){var i=new Uint8Array(t),r=i[3],o=null,_=i[0];if(_===wdi.WorkerOperations.quic)try{o=wdi.JSQuic.quic_decode(t)}catch(t){}else if(_===wdi.WorkerOperations.lz_rgb)try{o=wdi.LZSS.lz_rgb32_decompress_rgb(t)}catch(t){}else if(_===wdi.WorkerOperations.bytesToUriJpeg)try{return o=bytesToURI(i,"jpeg"),void self.postMessage(o)}catch(t){}else if(_===wdi.WorkerOperations.bytesToUriPng)try{return o=bytesToURI(i,"png"),void self.postMessage(o)}catch(t){}if(!e||!o)return o;r?self.postMessage(o,[o]):self.postMessage(o)}function bytesToURI(t,e){for(var i="data:image/"+e+",",r=t.length,o=4;o<r;o++)t[o]<16?i+="%0":i+="%",i+=t[o].toString(16);return i}function bytesToInt16(t){var e=t.shift();return t.shift()*Math.pow(16,2)+e}function bytesToInt32(t){var e=bytesToInt16(t);return bytesToInt16(t)*Math.pow(16,4)+e}function wdi_quic_QuicFamily(){this.notGRcwlen=[],this.nGRcodewords=[],this.notGRprefixmask=[],this.notGRsuffixlen=[],this.xlatU2L=[],this.xlatL2U=[]}function wdi_quic_s_bucket(){this.pcounters=null,this.bestcode=0}function wdi_quic_CommonState(){this.wm_trigger=this,this.encoder=null,this.waitcnt=0,this.tabrand_seed=wdi.JSQuic.stabrand(),this.wmidx=wdi.JSQuic.DEFwmistart,this.wmileft=wdi.JSQuic.wminext,wdi.JSQuic.set_wm_trigger(this),this.melcstate=0,this.melclen=wdi.JSQuic.J[0],this.melcorder=1<<this.melclen>>>0}function wdi_quic_FamilyStat(){this.buckets_buf=null,this.buckets_ptrs=null,this.counters=0}function wdi_quic_Channel(){this.encoder=null,this.correlate_row_width=0,this.correlate_row=null,this._buckets_ptrs=null,this.family_stat_8bpc=new wdi_quic_FamilyStat,this.family_stat_5bpc=new wdi_quic_FamilyStat,this.state=new wdi_quic_CommonState,this.oldFirst=0}function wdi_quic_Encoder(t){this.computedWidth=0,this.result=[],this.cnt=0,this.pxCnt=0,this.usr=t,this.type=null,this.width=null,this.height=null,this.num_channels=null,this.n_buckets_8bpc=null,this.n_buckets_5bpc=null,this.io_available_bits=32,this.io_now=0,this.io_next_word=null,this.io_now=null,this.read_io_word(),this.io_word=this.io_next_word,this.read_io_word(),this.io_words_count=t.length,this.rows_completed=0,this.channels=[],this.alphaPos=3,this.rgb_state=new wdi_quic_CommonState;for(var e=0;e<4;e++)this.channels[e]=new wdi_quic_Channel,wdi.JSQuic.initChannel(this,this.channels[e])}function cnt_l_zeroes(t){return t>8388607?wdi.JSQuic.lzeroes[t>>>24]:t>32767?8+wdi.JSQuic.lzeroes[t>>>16&255]:t>127?16+wdi.JSQuic.lzeroes[t>>>8&255]:24+wdi.JSQuic.lzeroes[255&t]}function golomb_code_len(t,e){return t<wdi.nGRcodewords[e]?1+(t>>>e)+e:wdi.notGRcwlen[e]}function golomb_decoding(t,e,i,r,o,_,n){var s,a;if(e>r[t]){var c=cnt_l_zeroes(e);a=c<<t|e>>>32-(s=c+1+t)&i[t]}else s=o[t],a=_[t]+(e>>>32-s&i[n[t]]);return[a,s]}function real_update_model(t,e,i,r,o){var _,n,s,a,c=e.pcounters;for(s=c[n=r-1]+=golomb_code_len(i,n),_=r-2;_>=0;_--)(a=c[_]+=golomb_code_len(i,_))<s&&(n=_,s=a);if(e.bestcode=n,s>t.wm_trigger)for(;r-- >0;)c[r]>>>=1}function UPDATE_MODEL(t,e,i,r,o,_){real_update_model(e.rgb_state,find_bucket(e.channels[0],r[t-1]),r[t],i),real_update_model(e.rgb_state,find_bucket(e.channels[1],o[t-1]),o[t],i),real_update_model(e.rgb_state,find_bucket(e.channels[2],_[t-1]),_[t],i)}function find_bucket(t,e){return void 0===e&&(e=t.oldFirst),t._buckets_ptrs[e]}function QUIC_UNCOMPRESS_RGBA(t,e,i,r){quic_uncompress_row0(t,e,i,r),quic_four_uncompress_row0(t,t.channels[3],i,r),t.row_completed();for(var o=t.height,_=t.rgb_state,n=1;n<o;n++)quic_uncompress_row_a(t,e,i,r,_),quic_four_uncompress_row(t,t.channels[3],i,r),t.row_completed()}function quic_four_uncompress_row(t,e,i,r){for(var o=wdi.JSQuic.BPC_MASK[r],_=0,n=t.width;wdi.JSQuic.wmimax>e.state.wmidx&&e.state.wmileft<=n;)e.state.wmileft&&(uncompress_four_row_seg(t,e,_,_+e.state.wmileft,i,o,r),_+=e.state.wmileft,n-=e.state.wmileft),e.state.wmidx++,wdi.JSQuic.set_wm_trigger(e.state),e.state.wmileft=wdi.JSQuic.wminext;n&&(uncompress_four_row_seg(t,e,_,_+n,i,o,r),wdi.JSQuic.wmimax>e.state.wmidx&&(e.state.wmileft-=n))}function uncompress_four_row_seg(t,e,i,r,o,_,n){var s,a,c,d,w=e.correlate_row,l=0,u=wdi.JSQuic.bppmask[e.state.wmidx],f=0,m=0,b=!1,p=t.computedWidth,h=t.rows_completed,E=(t.rows_completed-1)*p,S=t.eatbits,R=t.appendAlpha,A=wdi.JSQuic.bppmask,g=wdi.notGRprefixmask,x=wdi.notGRcwlen,G=wdi.nGRcodewords,Q=wdi.notGRsuffixlen;for(i?(l=i+e.state.waitcnt,a=t.result[t.alphaPos-4]):(a=UNCOMPRESS_ONE_0_A(e,t,_,E),e.state.waitcnt?--e.state.waitcnt:(e.state.waitcnt=wdi.JSQuic.tabrand(e.state)&u,real_update_model(e.state,find_bucket(e,w[-1]),w[0],o)),l=++i+e.state.waitcnt);;){for(;l<r;){for(;i<=l&&!(b=RLE_PRED_A(i,t,f,p,h));i++)s=(c=golomb_decoding(find_bucket(e,w[i-1]).bestcode,t.io_word,A,g,x,G,Q))[0],d=c[1],w[i]=s,a=(wdi.xlatL2U[s]+(a+PIXEL_B(e,t,i,E)>>>1)&_)>>>0,R.call(t,a),S(d,t);if(b)break;real_update_model(e.state,find_bucket(e,w[l-1]),w[l],o),l=i+(wdi.JSQuic.tabrand(e.state)&u)}if(!b){for(;i<r&&!(b=RLE_PRED_A(i,t,f,p,h));i++)s=(c=golomb_decoding(find_bucket(e,w[i-1]).bestcode,t.io_word,A,g,x,G,Q))[0],d=c[1],w[i]=s,a=(wdi.xlatL2U[s]+(a+PIXEL_B(e,t,i,E)>>>1)&_)>>>0,R.call(t,a),S(d,t);if(!b)return void(e.state.waitcnt=l-r)}e.state.waitcnt=l-i,f=i,m=i+wdi.JSQuic.decode_channel_run(t,e);for(var P=t.rows_completed*(4*t.width)+4*i,k=t.result[P-1];i<m;i++)R.call(t,k);if(i===r)return;l=i+e.state.waitcnt,b=!1}}function quic_four_uncompress_row0(t,e,i,r){for(var o=wdi.JSQuic.BPC_MASK[r],_=0,n=t.width;wdi.JSQuic.wmimax>e.state.wmidx&&e.state.wmileft<=n;)e.state.wmileft&&(uncompress_four_row0_seg(t,e,_,_+e.wmileft,wdi.JSQuic.bppmask[e.state.wmidx],i,o,r),_+=e.state.wmileft,n-=e.state.wmileft),e.state.wmidx++,wdi.JSQuic.set_wm_trigger(e.state),e.state.wmileft=wdi.JSQuic.wminext;n&&(uncompress_four_row0_seg(t,e,_,_+n,wdi.JSQuic.bppmask[e.state.wmidx],i,o,r),wdi.JSQuic.wmimax>e.state.wmidx&&(e.state.wmileft-=n))}function uncompress_four_row0_seg(t,e,i,r,o,_,n,s){var a=e.correlate_row,c=0;for(i?c=i+e.state.waitcnt:(UNCOMPRESS_ONE_ROW0_0_A(e),e.state.waitcnt?--e.state.waitcnt:(e.state.waitcnt=wdi.JSQuic.tabrand(e.state)&o,real_update_model(e.state,find_bucket(e,a[-1]),a[0],_)),c=++i+e.state.waitcnt);c<r;){for(;i<=c;i++)UNCOMPRESS_ONE_ROW0_A(e,i,n,t,a);real_update_model(e.state,find_bucket(e,a[c-1]),a[c],_),c=i+(wdi.JSQuic.tabrand(e.state)&o)}for(;i<r;i++)UNCOMPRESS_ONE_ROW0_A(e,i,n,t,a);e.state.waitcnt=c-r}function SAME_PIXEL_A(t,e){return e[t-1]===e[t+3]}function RLE_PRED_A(t,e,i,r,o){var _=(o-1)*r+4*t;return!!(i!==t&&t>2&&SAME_PIXEL_A(_,e.result)&&SAME_PIXEL_A(_=o*r+4*(t-1),e.result))}function UNCOMPRESS_ONE_0_A(t,e,i,r){var o,_;t.oldFirst=t.correlate_row[0],o=golomb_decoding(find_bucket(t,t.correlate_row[-1]).bestcode,e.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen),t.correlate_row[0]=o[0],_=o[1];var n=(wdi.xlatL2U[t.correlate_row[0]]+PIXEL_B(t,e,0,r)&i)>>>0;return e.appendAlpha(n),e.eatbits(_,e),n}function UNCOMPRESS_ONE_A(t,e,i,r,o,_){var n,s,a=(n=golomb_decoding(find_bucket(t,o[e-1]).bestcode,r.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen))[0];s=n[1],o[e]=a,r.appendAlpha((wdi.xlatL2U[a]+(PIXEL_A_A(r)+PIXEL_B(t,r,e,_)>>>1)&i)>>>0),r.eatbits(s,r)}function UNCOMPRESS_ONE_ROW0_0_A(t){var e,i,r=t.encoder;e=golomb_decoding(find_bucket(t,0).bestcode,r.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen),t.correlate_row[0]=e[0],i=e[1],r.appendAlpha(wdi.xlatL2U[t.correlate_row[0]]),r.eatbits(i,r)}function UNCOMPRESS_ONE_ROW0_A(t,e,i,r,o){var _,n,s=(_=golomb_decoding(find_bucket(t,o[e-1]).bestcode,r.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen))[0];n=_[1],o[e]=s,r.appendAlpha(CORELATE_0_A(r,t,e,i,o)),r.eatbits(n,r)}function CORELATE_0_A(t,e,i,r,o){return(wdi.xlatL2U[o[i]]+PIXEL_A_A(t)&r)>>>0}function PIXEL_A_A(t){return t.result[t.alphaPos-4]}function QUIC_UNCOMPRESS_RGB(t,e,i,r){quic_uncompress_row0(t,e,i,r),t.row_completed();for(var o=t.rgb_state,_=t.height,n=t.result,s=t.resultData,a=t.width,c=wdi.JSQuic.BPC_MASK[r],d=wdi.JSQuic,w=t.channels[0],l=t.channels[1],u=t.channels[2],f=w._buckets_ptrs,m=l._buckets_ptrs,b=u._buckets_ptrs,p=w.correlate_row,h=l.correlate_row,E=u.correlate_row,S=t.computedWidth,R=wdi.xlatL2U,A=wdi.JSQuic.lzeroes,g=wdi.JSQuic.lzeroes8,x=wdi.JSQuic.lzeroes16,G=wdi.JSQuic.lzeroes24,Q=wdi.notGRprefixmask,P=wdi.notGRcwlen,k=wdi.nGRcodewords,v=wdi.notGRsuffixlen,I=t.eatbits,L=wdi.JSQuic.tabrand,M=wdi.JSQuic.decode_run,U=wdi.JSQuic.bppmask,J=(d=wdi.JSQuic,wdi.JSQuic.tabrand_chaos),y=d.TABRAND_SEEDMASK,O=t.usr,T=1;T<_;T++)quic_uncompress_row(t,e,i,r,o,-16777216,n,s,a,c,d,w,l,u,f,m,b,p,h,E,S,R,A,g,x,G,Q,P,k,v,I,L,M,U,J,y,O),t.rows_completed++}function quic_uncompress_row(t,e,i,r,o,_,n,s,a,c,d,w,l,u,f,m,b,p,h,E,S,R,A,g,x,G,Q,P,k,v,I,L,M,U,J,y,O){for(var T=0,C=t.rows_completed,N=C*S/4,z=(C-1)*S;d.wmimax>o.wmidx&&o.wmileft<=a;)o.wmileft&&(uncompress_row_seg(t,T,T+o.wmileft,i,c,r,o,_,n,s,w,l,u,f,m,b,p,h,E,S,R,A,g,x,G,Q,P,k,v,I,L,M,U,d,J,C,y,z,N,O),T+=o.wmileft,a-=o.wmileft),o.wmidx++,d.set_wm_trigger(o),o.wmileft=d.wminext;a&&(uncompress_row_seg(t,T,T+a,i,c,r,o,_,n,s,w,l,u,f,m,b,p,h,E,S,R,A,g,x,G,Q,P,k,v,I,L,M,U,d,J,C,y,z,N,O),d.wmimax>t.rgb_state.wmidx&&(o.wmileft-=a))}function quic_uncompress_row_a(t,e,i,r,o){for(var _=wdi.JSQuic.BPC_MASK[r],n=0,s=t.width;wdi.JSQuic.wmimax>o.wmidx&&o.wmileft<=s;)o.wmileft&&(uncompress_row_seg_a(t,n,n+o.wmileft,i,_,r,o),n+=o.wmileft,s-=o.wmileft),o.wmidx++,wdi.JSQuic.set_wm_trigger(o),o.wmileft=wdi.JSQuic.wminext;s&&(uncompress_row_seg_a(t,n,n+s,i,_,r,o),wdi.JSQuic.wmimax>t.rgb_state.wmidx&&(o.wmileft-=s))}function SAME_PIXEL_RGB_A(t,e){return e[t-4]===e[t]&&e[t-3]===e[t+1]&&e[t-2]===e[t+2]}function SAME_PIXEL(t,e){return e[t-1]===e[t]}function RLE_PRED_RGB_A(t,e,i,r,o){if(o!==t&&t>2&&(SAME_PIXEL_RGB_A(i,e.result)&&SAME_PIXEL_RGB_A(r+4*(t-1),e.result)))return!0;return!1}function RLE_PRED(t,e,i,r,o){if(o!==t&&t>2&&(SAME_PIXEL(4*i,e.result)&&SAME_PIXEL(4*(r+t-1),e.result)))return!0;return!1}function uncompress_row_seg(t,e,i,r,o,_,n,s,a,c,d,w,l,u,f,m,b,p,h,E,S,R,A,g,x,G,Q,P,k,v,I,L,M,U,J,y,O,T,C,N){var z,B,D,q,Y,W,X,F,Z,K,H,V,j,$,tt,et,it,rt,ot,_t=0,nt=M[n.wmidx],st=0,at=!1,ct=t.cnt,dt=t.pxCnt;for(e?(_t=e+n.waitcnt,D=a[ct-4],q=a[ct-3],Y=a[ct-2],W=b[e-1],X=p[e-1],F=h[e-1]):(D=UNCOMPRESS_ONE_0(d,t,o,T),q=UNCOMPRESS_ONE_0(w,t,o,T),Y=UNCOMPRESS_ONE_0(l,t,o,T),W=b[0],X=p[0],F=h[0],c[dt++]=255<<24|Y<<16|q<<8|D,n.waitcnt?--n.waitcnt:(n.waitcnt=I.call(U,n)&nt,UPDATE_MODEL(0,t,r,b,p,h)),_t=++e+n.waitcnt);;){for(;_t<i;){for(B=T+4*e;e<=_t;e++){if(c[($=B/4)-1]===c[$]&&c[(j=C+e-1)-1]===c[j]&&st!==e&&e>2){at=!0;break}K=u[W].bestcode,(H=t.io_word)>G[K]?W=(V=H>8388607?R[H>>>24]:H>32767?A[H>>>16&255]:H>127?g[H>>>8&255]:x[255&H])<<K|H>>>32-(Z=V+1+K)&M[K]:(Z=Q[K],W=P[K]+(H>>>32-Z&M[k[K]])),b[e]=W,D=S[W]+(D+a[B++]>>>1)&o,et=t.io_available_bits,it=t.io_word,it<<=Z,(rt=et-Z)>=0?(it=(it|t.io_next_word>>>rt)>>>0,t.io_available_bits=rt,t.io_word=it):(it=((it|=(ot=t.io_next_word)<<(rt=-rt)>>>0)|(ot=N[t.io_now++])>>>(et=32-rt))>>>0,t.io_available_bits=et,t.io_word=it,t.io_next_word=ot),K=f[X].bestcode,(H=t.io_word)>G[K]?X=(V=H>8388607?R[H>>>24]:H>32767?A[H>>>16&255]:H>127?g[H>>>8&255]:x[255&H])<<K|H>>>32-(Z=V+1+K)&M[K]:(Z=Q[K],X=P[K]+(H>>>32-Z&M[k[K]])),p[e]=X,q=S[X]+(q+a[B++]>>>1)&o,et=t.io_available_bits,it=t.io_word,it<<=Z,(rt=et-Z)>=0?(it=(it|t.io_next_word>>>rt)>>>0,t.io_available_bits=rt,t.io_word=it):(it=((it|=(ot=t.io_next_word)<<(rt=-rt)>>>0)|(ot=N[t.io_now++])>>>(et=32-rt))>>>0,t.io_available_bits=et,t.io_word=it,t.io_next_word=ot),K=m[F].bestcode,(H=t.io_word)>G[K]?F=(V=H>8388607?R[H>>>24]:H>32767?A[H>>>16&255]:H>127?g[H>>>8&255]:x[255&H])<<K|H>>>32-(Z=V+1+K)&M[K]:(Z=Q[K],F=P[K]+(H>>>32-Z&M[k[K]])),h[e]=F,Y=S[F]+(Y+a[B++]>>>1)&o,et=t.io_available_bits,it=t.io_word,it<<=Z,(rt=et-Z)>=0?(it=(it|t.io_next_word>>>rt)>>>0,t.io_available_bits=rt,t.io_word=it):(it=((it|=(ot=t.io_next_word)<<(rt=-rt)>>>0)|(ot=N[t.io_now++])>>>(et=32-rt))>>>0,t.io_available_bits=et,t.io_word=it,t.io_next_word=ot),c[dt++]=s|Y<<16|q<<8|D,B++}if(at)break;real_update_model(n,u[b[tt=_t-1]],b[_t],r),real_update_model(n,f[p[tt]],p[_t],r),real_update_model(n,m[h[tt]],h[_t],r),n.tabrand_seed++,_t=e+(J[n.tabrand_seed&O]&nt)}if(!at){for(B=T+4*e;e<i;e++){if(c[($=B/4)-1]===c[$]&&c[(j=C+e-1)-1]===c[j]&&st!==e&&e>2){at=!0;break}K=u[W].bestcode,(H=t.io_word)>G[K]?W=(V=H>8388607?R[H>>>24]:H>32767?A[H>>>16&255]:H>127?g[H>>>8&255]:x[255&H])<<K|H>>>32-(Z=V+1+K)&M[K]:(Z=Q[K],W=P[K]+(H>>>32-Z&M[k[K]])),b[e]=W,D=S[W]+(D+a[B++]>>>1)&o,et=t.io_available_bits,it=t.io_word,it<<=Z,(rt=et-Z)>=0?(it=(it|t.io_next_word>>>rt)>>>0,t.io_available_bits=rt,t.io_word=it):(it=((it|=(ot=t.io_next_word)<<(rt=-rt)>>>0)|(ot=N[t.io_now++])>>>(et=32-rt))>>>0,t.io_available_bits=et,t.io_word=it,t.io_next_word=ot),K=f[X].bestcode,(H=t.io_word)>G[K]?X=(V=H>8388607?R[H>>>24]:H>32767?A[H>>>16&255]:H>127?g[H>>>8&255]:x[255&H])<<K|H>>>32-(Z=V+1+K)&M[K]:(Z=Q[K],X=P[K]+(H>>>32-Z&M[k[K]])),p[e]=X,q=S[X]+(q+a[B++]>>>1)&o,et=t.io_available_bits,it=t.io_word,it<<=Z,(rt=et-Z)>=0?(it=(it|t.io_next_word>>>rt)>>>0,t.io_available_bits=rt,t.io_word=it):(it=((it|=(ot=t.io_next_word)<<(rt=-rt)>>>0)|(ot=N[t.io_now++])>>>(et=32-rt))>>>0,t.io_available_bits=et,t.io_word=it,t.io_next_word=ot),K=m[F].bestcode,(H=t.io_word)>G[K]?F=(V=H>8388607?R[H>>>24]:H>32767?A[H>>>16&255]:H>127?g[H>>>8&255]:x[255&H])<<K|H>>>32-(Z=V+1+K)&M[K]:(Z=Q[K],F=P[K]+(H>>>32-Z&M[k[K]])),h[e]=F,Y=S[F]+(Y+a[B++]>>>1)&o,et=t.io_available_bits,it=t.io_word,it<<=Z,(rt=et-Z)>=0?(it=(it|t.io_next_word>>>rt)>>>0,t.io_available_bits=rt,t.io_word=it):(it=((it|=(ot=t.io_next_word)<<(rt=-rt)>>>0)|(ot=N[t.io_now++])>>>(et=32-rt))>>>0,t.io_available_bits=et,t.io_word=it,t.io_next_word=ot),c[dt++]=255<<24|Y<<16|q<<8|D,B++}if(!at)return n.waitcnt=_t-i,t.cnt=4*dt,void(t.pxCnt=dt)}for(n.waitcnt=_t-e,st=e,run_end=L(t),e=run_end+e;run_end-- >0;)c[dt++]=s|Y<<16|q<<8|D;if(e===i)return t.cnt=4*dt,void(t.pxCnt=dt);W=b[z=e-1],X=p[z],F=h[z],_t=e+n.waitcnt,at=!1}}function uncompress_row_seg_a(t,e,i,r,o,_,n){var s,a,c,d,w,l,u,f,m,b,p,h,E=t.channels[0],S=t.channels[1],R=t.channels[2],A=E._buckets_ptrs,g=S._buckets_ptrs,x=R._buckets_ptrs,G=E.correlate_row,Q=S.correlate_row,P=R.correlate_row,k=0,v=wdi.JSQuic.bppmask[n.wmidx],I=0,L=0,M=!1,U=t.computedWidth,J=(t.rows_completed-1)*U,y=t.rows_completed*U,O=(t.rows_completed,t.rows_completed,t.result),T=t.resultData,C=wdi.xlatL2U,N=t.eatbits,z=wdi.JSQuic.tabrand,B=wdi.JSQuic.decode_run,D=(wdi.JSQuic.lzeroes,wdi.JSQuic.lzeroes8,wdi.JSQuic.lzeroes16,wdi.JSQuic.lzeroes24,t.cnt),q=t.pxCnt,Y=wdi.JSQuic.bppmask,W=wdi.notGRprefixmask,X=wdi.notGRcwlen,F=wdi.nGRcodewords,Z=wdi.notGRsuffixlen,K=255<<24;for(e?(k=e+n.waitcnt,c=O[D-4],d=O[D-3],w=O[D-2],l=G[e-1],u=Q[e-1],f=P[e-1]):(c=UNCOMPRESS_ONE_0(E,t,o,J),d=UNCOMPRESS_ONE_0(S,t,o,J),w=UNCOMPRESS_ONE_0(R,t,o,J),l=G[0],u=Q[0],f=P[0],T[q++]=255<<24|w<<16|d<<8|c,n.waitcnt?--n.waitcnt:(n.waitcnt=z.call(wdi.JSQuic,n)&v,UPDATE_MODEL(0,t,r,G,Q,P)),k=++e+n.waitcnt);;){for(;k<i;){for(a=J+4*e;e<=k&&!(M=RLE_PRED_RGB_A(e,t,a,y,I));e++)b=A[l].bestcode,(p=t.io_word)>W[b]?l=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],l=F[b]+(p>>>32-m&Y[Z[b]])),G[e]=l,c=C[l]+(c+O[a++]>>>1)&o,N(m,t),b=g[u].bestcode,(p=t.io_word)>W[b]?u=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],u=F[b]+(p>>>32-m&Y[Z[b]])),Q[e]=u,d=C[u]+(d+O[a++]>>>1)&o,N(m,t),b=x[f].bestcode,(p=t.io_word)>W[b]?f=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],f=F[b]+(p>>>32-m&Y[Z[b]])),P[e]=f,w=C[f]+(w+O[a++]>>>1)&o,N(m,t),T[q++]=K|w<<16|d<<8|c,a++;if(M)break;UPDATE_MODEL(k,t,r,G,Q,P),k=e+(z.call(wdi.JSQuic,n)&v)}if(!M){for(a=J+4*e;e<i&&!(M=RLE_PRED_RGB_A(e,t,a,y,I));e++)b=A[l].bestcode,(p=t.io_word)>W[b]?l=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],l=F[b]+(p>>>32-m&Y[Z[b]])),G[e]=l,c=C[l]+(c+O[a++]>>>1)&o,N(m,t),b=g[u].bestcode,(p=t.io_word)>W[b]?u=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],u=F[b]+(p>>>32-m&Y[Z[b]])),Q[e]=u,d=C[u]+(d+O[a++]>>>1)&o,N(m,t),b=x[f].bestcode,(p=t.io_word)>W[b]?f=(h=cnt_l_zeroes(p))<<b|p>>>32-(m=h+1+b)&Y[b]:(m=X[b],f=F[b]+(p>>>32-m&Y[Z[b]])),P[e]=f,w=C[f]+(w+O[a++]>>>1)&o,N(m,t),T[q++]=255<<24|w<<16|d<<8|c,a++;if(!M)return n.waitcnt=k-i,t.cnt=4*q,void(t.pxCnt=q)}for(n.waitcnt=k-e,I=e,e=(L=B(t))+e;L-- >0;)T[q++]=K|w<<16|d<<8|c;if(e===i)return t.cnt=4*q,void(t.pxCnt=q);l=G[s=e-1],u=Q[s],f=P[s],k=e+n.waitcnt,M=!1}}function quic_uncompress_row0(t,e,i,r){for(var o=wdi.JSQuic.BPC_MASK[r],_=0,n=t.width;wdi.JSQuic.wmimax>t.rgb_state.wmidx&&t.rgb_state.wmileft<=n;)t.rgb_state.wmileft&&(uncompress_row0_seg(t,_,_+t.rgb_state.wmileft,wdi.JSQuic.bppmask[t.rgb_state.wmidx],i,o,r),_+=t.rgb_state.wmileft,n-=t.rgb_state.wmileft),t.rgb_state.wmidx++,wdi.JSQuic.set_wm_trigger(t.rgb_state),t.rgb_state.wmileft=wdi.JSQuic.wminext;n&&(uncompress_row0_seg(t,_,_+n,wdi.JSQuic.bppmask[t.rgb_state.wmidx],i,o,r),wdi.JSQuic.wmimax>t.rgb_state.wmidx&&(t.rgb_state.wmileft-=n))}function uncompress_row0_seg(t,e,i,r,o,_,n){var s,a,c,d=t.channels[0],w=t.channels[1],l=t.channels[2],u=d.correlate_row,f=w.correlate_row,m=l.correlate_row,b=0;for(e?b=e+t.rgb_state.waitcnt:(s=UNCOMPRESS_ONE_ROW0_0(d),a=UNCOMPRESS_ONE_ROW0_0(w),c=UNCOMPRESS_ONE_ROW0_0(l),t.appendPixel(s,a,c),t.rgb_state.waitcnt?--t.rgb_state.waitcnt:(t.rgb_state.waitcnt=wdi.JSQuic.tabrand(t.rgb_state)&r,UPDATE_MODEL(0,t,o,u,f,m)),b=++e+t.rgb_state.waitcnt);b<i;){for(;e<=b;e++)s=UNCOMPRESS_ONE_ROW0(d,e,_,t,u,s),a=UNCOMPRESS_ONE_ROW0(w,e,_,t,f,a),c=UNCOMPRESS_ONE_ROW0(l,e,_,t,m,c),t.appendPixel(s,a,c);UPDATE_MODEL(b,t,o,u,f,m),b=e+(wdi.JSQuic.tabrand(t.rgb_state)&r)}for(;e<i;e++)s=UNCOMPRESS_ONE_ROW0(d,e,_,t,u,s),a=UNCOMPRESS_ONE_ROW0(w,e,_,t,f,a),c=UNCOMPRESS_ONE_ROW0(l,e,_,t,m,c),t.appendPixel(s,a,c);t.rgb_state.waitcnt=b-i}function UNCOMPRESS_ONE_0(t,e,i,r){var o,_;t.oldFirst=t.correlate_row[0],o=golomb_decoding(find_bucket(t,t.correlate_row[0]).bestcode,e.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen),t.correlate_row[0]=o[0],_=o[1];var n=wdi.xlatL2U[t.correlate_row[0]]+e.result[r+t.num_channel]&i;return e.eatbits(_,e),n}function UNCOMPRESS_ONE(t,e,i,r,o,_,n,s,a,c,d,w,l){var u,f=(m=golomb_decoding(w[n[i]].bestcode,_.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen))[0];u=m[1],n[e]=f;var m=d[f]+(l+a[s+r+c]>>>1)&o;return _.eatbits(u,_),m}function UNCOMPRESS_ONE_ROW0_0(t){var e,i=t.encoder;r=golomb_decoding(find_bucket(t,0).bestcode,i.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen),t.correlate_row[0]=r[0],e=r[1];var r=wdi.xlatL2U[t.correlate_row[0]];return i.eatbits(e,i),r}function UNCOMPRESS_ONE_ROW0(t,e,i,r,o,_){var n;s=golomb_decoding(find_bucket(t,o[e-1]).bestcode,r.io_word,wdi.JSQuic.bppmask,wdi.notGRprefixmask,wdi.notGRcwlen,wdi.nGRcodewords,wdi.notGRsuffixlen),o[e]=s[0],n=s[1];var s=CORELATE_0(r,t,e,i,o,_);return r.eatbits(n,r),s}function CORELATE_0(t,e,i,r,o,_){return wdi.xlatL2U[o[i]]+_&r}function PIXEL_A(t){return t.result[t.cnt-4]}function PIXEL_B(t,e,i,r){return e.result[r+4*i+t.num_channel]}window=this,window.wdi||(window.wdi={}),window.wdi.WorkerOperations={quic:0,lz_rgb:1,bytesToUriJpeg:2,bytesToUriPng:3},window.workerDispatch=dispatch,self.addEventListener("message",(function(t){return dispatch(t.data,!0)}),!1),wdi.QuicImageType={QUIC_IMAGE_TYPE_INVALID:0,QUIC_IMAGE_TYPE_GRAY:1,QUIC_IMAGE_TYPE_RGB16:2,QUIC_IMAGE_TYPE_RGB24:3,QUIC_IMAGE_TYPE_RGB32:4,QUIC_IMAGE_TYPE_RGBA:5},wdi.quic={},wdi.JSQuic={QUIC_MAGIC:1364543811,MAXNUMCODES:8,DEFevol:3,MINevol:0,MAXevol:5,DEFwmistart:0,MINwmistart:0,DEFmaxclen:26,DEFwmimax:6,DEFwminext:2048,MINwminext:1,MAXwminext:1e8,MAX_CHANNELS:4,wmimax:6,wminext:2048,evol:3,family_8bpc:new wdi_quic_QuicFamily,family_5bpc:new wdi_quic_QuicFamily,bppmask:new Int32Array([0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215,33554431,67108863,134217727,268435455,536870911,1073741823,2147483647,4294967295]),bitat:new Int32Array([1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648]),TABRAND_TABSIZE:256,TABRAND_SEEDMASK:255,tabrand_chaos:new Int32Array([46495042,893548311,794435923,2453991765,2077388039,894197842,1462934312,697534094,1826128012,343623392,2581292719,3811265708,459739748,2638427270,1654964626,101227083,2654850628,3668700691,572794346,2758751005,3445133904,2344099199,3367450297,898927923,3618406352,1606297603,754696453,20823118,2050458127,972590750,3990194068,3305596553,4239238564,1690498157,3015324227,2306127097,1510321853,548392192,971157512,2292288069,1611390505,4086766286,4084927083,1883326811,1891043243,113180603,1107690783,3778825955,3248980775,2443839100,2190866218,1932072870,495393613,1078522166,4051963518,1784694977,1768732442,2146763203,264646923,1474361405,2361552500,296035746,2489922759,2094565616,2409465348,1334241083,72483606,3740181004,4057920662,1734898312,4114662834,574624900,880305546,3258472262,26713132,1571648456,52557195,4043234286,2458021343,676064371,1528437109,64953873,546717185,2709319979,1947039598,2812723004,28691684,286829174,4235176970,3465707163,12526951,2154766700,3165032534,2036061161,3386656087,2301212354,2023576300,1061142336,3105452904,2743866805,3283373992,3397596080,3085489552,3196092395,3210707808,3651022684,925444321,2088074316,230011220,3223248386,533229176,523863486,3028311159,13140218,2538347282,900399636,3000796173,1526771255,3541282854,2992674461,2135722105,389334227,1225164337,3119947809,1803959919,3471171263,704170491,1407019136,1924534819,526887421,168782227,333811993,298623278,4268451686,381087740,2542899140,3266880867,2498950977,200969370,3511909096,3252303004,2268881098,2499828613,2606499854,3163208665,3790254546,1840025712,1319758833,3771674836,519421307,3512796222,1563402978,4284300462,2263719815,715250337,3178437172,2660191010,2982332026,3256309961,2709659997,3434092872,2367065591,69438718,915160508,183164069,3134331940,175242981,2680543346,1421955782,4231173251,1736652874,3990568476,1710820912,2286604440,3464587098,1261907837,1757387321,1128554270,1090050251,2429922486,1288729218,882830086,211637042,1376462063,2147615815,1737974929,798170275,4271572277,4241687072,1638524620,2760366295,1065115089,2097227717,1224023317,1625204849,3383303351,1488272307,2640186157,1649047732,819719707,2615091943,502645401,760628135,4108137983,63606742,1404337880,1865161130,4272996852,1239761976,790984678,3213322601,1917062825,4195069880,1962259360,2111002573,2311983960,1861406170,511141875,2797510619,1331661048,3130608186,147483493,3767089176,2650841450,4096523407,2574446300,1956416337,851468126,3607527519,1811658703,3642821136,832691095,2453312857,933732854,94341217,3393797730,1695907457,2405722077,2877685663,2469507058,2249636341,3988608661,4001245617,825934927,3103985967,1127151177,3691656896,1640967098,2168932645,2830550957,3998822878,3002602893,1509651465,775813869,2599574079,3791574229]),besttrigtab:[[550,900,800,700,500,350,300,200,180,180,160],[110,550,900,800,550,400,350,250,140,160,140],[100,120,550,900,700,500,400,300,220,250,160]],lzeroes:new Int32Array([8,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),J:new Int32Array([0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,5,5,6,6,7,7,8,9,10,11,12,13,14,15]),zeroLUT:null,BPC_MASK:{4:255,5:255,24:255,16:31},stabrand:function(){return this.TABRAND_SEEDMASK},tabrand:function(t){return t.tabrand_seed++,this.tabrand_chaos[t.tabrand_seed&this.TABRAND_SEEDMASK]},set_wm_trigger:function(t){var e=t.wmidx;e>10&&(e=10),t.wm_trigger=wdi.JSQuic.besttrigtab[Math.floor(wdi.JSQuic.evol>>1)][e]},ceil_log_2:function(t){var e;if(1===t)return 0;for(e=1,t-=1;t>>>=1;)e++;return e},decorelate_init:function(t,e){var i,r=this.bppmask[e],o=r>>>1;for(i=0;i<=r;i++)t.xlatU2L[i]=i<=o?i<<1>>>0:1+(r-i<<1>>>0)},corelate_init:function(t,e){var i,r=this.bppmask[e];for(i=0;i<=r;i++)t.xlatL2U[i]=1&i?r-(i>>>1):i>>>1},family_init:function(t,e,i){var r;for(r=0;r<e;r++){var o,_;(o=i-e)>parseInt(this.bppmask[e-r])&&(o=this.bppmask[e-r]),_=this.bppmask[e]+1-(o<<r>>>0),t.nGRcodewords[r]=o<<r>>>0,t.notGRcwlen[r]=o+this.ceil_log_2(_),t.notGRprefixmask[r]=this.bppmask[32-o],t.notGRsuffixlen[r]=this.ceil_log_2(_)}this.corelate_init(t,e)},init_zeroLUT:function(){var t,e,i,r;for(this.zeroLUT=new Int32Array(256),e=i=1,r=8,t=0;t<256;++t)this.zeroLUT[t]=r,0===--i&&(i=e,--r,e*=2)},quic_init:function(){this.family_init(this.family_8bpc,8,this.DEFmaxclen),this.init_zeroLUT(),wdi.xlatL2U=new Int32Array(this.family_8bpc.xlatL2U.length),wdi.xlatL2U.set(this.family_8bpc.xlatL2U),wdi.notGRprefixmask=new Int32Array(this.family_8bpc.notGRprefixmask.length),wdi.notGRprefixmask.set(this.family_8bpc.notGRprefixmask),wdi.nGRcodewords=new Int32Array(this.family_8bpc.nGRcodewords.length),wdi.nGRcodewords.set(this.family_8bpc.nGRcodewords),wdi.notGRcwlen=new Int32Array(this.family_8bpc.notGRcwlen.length),wdi.notGRcwlen.set(this.family_8bpc.notGRcwlen),wdi.notGRsuffixlen=new Int32Array(this.family_8bpc.notGRsuffixlen.length),wdi.notGRsuffixlen.set(this.family_8bpc.notGRsuffixlen);for(var t=wdi.JSQuic.lzeroes,e=new Int32Array(t),i=t.length,r=0;r<i;r++)e[r]=t[r]+8;wdi.JSQuic.lzeroes8=e;var o=new Int32Array(t);for(r=0;r<i;r++)o[r]=t[r]+16;wdi.JSQuic.lzeroes16=o;var _=new Int32Array(t);for(r=0;r<i;r++)_[r]=t[r]+24;wdi.JSQuic.lzeroes24=_},quic_image_params:function(t,e){var i,r;switch(e){case wdi.QuicImageType.QUIC_IMAGE_TYPE_GRAY:i=1,r=8;break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB16:i=3,r=5;break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB24:case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB32:i=3,r=8;break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGBA:i=4,r=8;break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_INVALID:default:i=0,r=0}return[i,r]},find_model_params:function(t,e){var i=0,r=0,o=0,_=0,n={ncounters:8};switch(n.levels=1<<e,n.n_buckets_ptrs=0,this.evol){case 1:n.repfirst=3,n.firstsize=1,n.repnext=2,n.mulsize=2;break;case 3:n.repfirst=1,n.firstsize=1,n.repnext=1,n.mulsize=2;break;case 5:n.repfirst=1,n.firstsize=1,n.repnext=1,n.mulsize=4;break;default:return wdi.Debug.error("fund model params: invalid evol"),!1}n.nbuckets=0,_=n.repfirst+1,i=n.firstsize;do{r=n.nbuckets?o+1:0,--_||(_=n.repnext,i*=n.mulsize),(o=r+i-1)+i>=n.levels&&(o=n.levels-1),n.n_buckets_ptrs||(n.n_buckets_ptrs=n.levels),n.nbuckets++}while(o<n.levels-1);return n},init_model_structures:function(t,e,i){e.buckets_buf=[];for(var r=0;r<i.nbuckets;r++)e.buckets_buf[r]=new wdi_quic_s_bucket;e.buckets_ptrs=[],e.counters=[],this.fill_model_structures(t,e,i)},fill_model_structures:function(t,e,i){var r,o,_,n,s=0;n=0,_=i.repfirst+1,r=i.firstsize;do{o=n?s+1:0,--_||(_=i.repnext,r*=i.mulsize),(s=o+r-1)+r>=i.levels&&(s=i.levels-1),e.buckets_buf[n].pcounters=new Int32Array(i.ncounters);for(var a=0;a<i.ncounters;a++)e.buckets_buf[n].pcounters[a]=0;for(var c=o;c<=s;c++)e.buckets_ptrs[c]=e.buckets_buf[n];n++}while(s<i.levels-1)},initChannel:function(t,e){e.encoder=t,e.state.encoder=t,e.correlate_row_width=0,e.correlate_row=null;var i=this.find_model_params(t,8);t.n_buckets_8bpc=i.nbuckets,this.init_model_structures(t,e.family_stat_8bpc,i),i=this.find_model_params(t,5),t.n_buckets_5bpc=i.nbuckets,this.init_model_structures(t,e.family_stat_5bpc,i)},encoder_reste_channels:function(t,e,i,r){t.num_channels=e;for(var o=0;o<e;o++){var _,n;if(t.channels[o].correlate_row_width<i&&(t.channels[o].correlate_row=new Array(i),t.channels[o].correlate_row_width=i),t.channels[o].num_channel=o,8===r){_=t.channels[o].family_stat_8bpc.buckets_buf,n=t.n_buckets_8bpc;for(var s=0;s<n;s++)_[s].bestcode=7;t.channels[o]._buckets_ptrs=t.channels[o].family_stat_8bpc.buckets_ptrs}else{if(5!==r)return FALSE;_=t.channels[o].family_stat_5bpc.buckets_buf,n=t.n_buckets_5bpc;for(s=0;s<n;s++)_[s].bestcode=4;t.channels[o]._buckets_ptrs=t.channels[o].family_stat_5bpc.buckets_ptrs}t.channels[o].state.waitcnt=0,t.channels[o].state.tabrand_seed=wdi.JSQuic.stabrand(),t.channels[o].state.wmidx=wdi.JSQuic.DEFwmistart,t.channels[o].state.wmileft=wdi.JSQuic.wminext}return!0},decode_channel_run:function(t,e){for(var i=0;;){var r,o;for(r=wdi.JSQuic.zeroLUT[(~(t.io_word>>>24)>>>0)%256],o=1;o<=r;o++)i+=e.state.melcorder,e.state.melcstate<32&&(e.state.melclen=wdi.JSQuic.J[++e.state.melcstate],e.state.melcorder=1<<e.state.melclen>>>0);if(8!==r){t.eatbits(r+1,t);break}t.eatbits(8,t)}return e.state.melclen&&(i+=t.io_word>>>32-e.state.melclen,t.eatbits(e.state.melclen,t)),e.state.melcstate&&(e.state.melclen=wdi.JSQuic.J[--e.state.melcstate],e.state.melcorder=1<<e.state.melclen>>>0),i},decode_run:function(t){for(var e,i,r,o=0,_=wdi.JSQuic.zeroLUT,n=t.rgb_state,s=wdi.JSQuic.J,a=t.eatbits;;){for(r=(e=_[(~(t.io_word>>>24)>>>0)%256])+1,i=1;i<r;i++)o+=t.rgb_state.melcorder,n.melcstate<32&&(n.melclen=s[++n.melcstate],n.melcorder=1<<n.melclen>>>0);if(8!==e){a(r,t);break}t.eatbits(8,t)}return n.melclen&&(o+=t.io_word>>>32-n.melclen,a(n.melclen,t)),n.melcstate&&(n.melclen=s[--n.melcstate],n.melcorder=1<<n.melclen>>>0),o},quic_decode:function(t){var e=new wdi_quic_Encoder(new Uint32Array(t)),i=65280&e.io_word;e.io_word;e.eat32bits(),e.eat32bits();e.io_word;e.eat32bits();e.io_word;e.eat32bits();var r=e.io_word;e.eat32bits(),e.type=r;var o=e.io_word;e.width=o,e.eat32bits();var _=e.io_word;e.height=_,e.eat32bits();var n=wdi.JSQuic.quic_image_params(e,r),s=n[0],a=n[1];this.encoder_reste_channels(e,s,o,a);var c=new ArrayBuffer(o*_*4),d=new Uint8Array(c);t=new Uint32Array(c);switch(e.result=d,e.resultData=t,e.setComputedWidth(o),r){case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB32:case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB24:QUIC_UNCOMPRESS_RGB(e,s,a,r);break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGB16:break;case wdi.QuicImageType.QUIC_IMAGE_TYPE_RGBA:if(QUIC_UNCOMPRESS_RGBA(e,s,a,r),i)for(var w=d.length-1;w>0;)d[w]=255,w-=4}return c}},wdi.JSQuic.quic_init(),wdi_quic_Encoder.prototype.append=function(t){this.result[this.cnt++]=t},wdi_quic_Encoder.prototype.appendPixel=function(t,e,i){this.resultData[this.pxCnt++]=255<<24|i<<16|e<<8|t,this.cnt+=4},wdi_quic_Encoder.prototype.eatbits=function(t,e){var i=e.io_available_bits,r=e.io_word,o=i-t;if(r<<=t,o>=0)return r=(r|e.io_next_word>>>o)>>>0,e.io_available_bits=o,void(e.io_word=r);var _=e.io_next_word;r=((r|=_<<(o=-o)>>>0)|(_=e.usr[e.io_now++])>>>(i=32-o))>>>0,e.io_available_bits=i,e.io_word=r,e.io_next_word=_},wdi_quic_Encoder.prototype.eat32bits=function(){this.eatbits(16,this),this.eatbits(16,this)},wdi_quic_Encoder.prototype.read_io_word=function(){this.io_next_word=this.usr[this.io_now++]},wdi_quic_Encoder.prototype.row_completed=function(){this.rows_completed++},wdi_quic_Encoder.prototype.setComputedWidth=function(t){this.computedWidth=4*t},wdi_quic_Encoder.prototype.appendAlpha=function(t){this.result[this.alphaPos]=t,this.alphaPos+=4};var lzDecompress={LZ_IMAGE_TYPE_INVALID:0,LZ_IMAGE_TYPE_PLT1_LE:1,LZ_IMAGE_TYPE_PLT1_BE:2,LZ_IMAGE_TYPE_PLT4_LE:3,LZ_IMAGE_TYPE_PLT4_BE:4,LZ_IMAGE_TYPE_PLT8:5,LZ_IMAGE_TYPE_RGB16:6,LZ_IMAGE_TYPE_RGB24:7,LZ_IMAGE_TYPE_RGB32:8,LZ_IMAGE_TYPE_RGBA:9,LZ_IMAGE_TYPE_XXXA:10,LZPALETTE_FLAG_PAL_CACHE_ME:1,LZPALETTE_FLAG_PAL_FROM_CACHE:2,LZPALETTE_FLAG_TOP_DOWN:4,PLT_PIXELS_PER_BYTE:[0,8,8,2,2,1],PLT1_MASK:[1,2,4,8,16,32,64,128],lz_rgb32_decompress_rgb_opaque_reverse:function(t){for(var e,i,r,o,_=new Uint8Array(t),n=(_[2],256*_[5]+_[4]),s=65536*(256*_[7]+_[6])+n,a=new ArrayBuffer(s),c=new Uint32Array(a),d=s/4-1,w=_[8],l=8;d>=0;)if(0!=(w=_[l++])&&0!=(s=w>>5)){if(i=d,r=(31&w)<<8,7==s)do{s+=e=_[l++]}while(255==e);if(0==(r+=_[l++]))for(o=c[i+1];0!=s--;)c[d--]=o;else for(8191==r&&(r+=(_[l]<<8)+_[l+1],l+=2),i+=r+1;0!=s--;)c[d--]=c[i--]}else do{c[d--]=4278190080|_[l]<<16|_[l+1]<<8|_[l+2],l+=3}while(w--);return a},lz_rgb32_decompress_rgb:function(t){for(var e,i,r,o,_,n,s,a=0,c=new Uint8Array(t),d=c[1],w=c[2],l=(c[3],256*c[5]+c[4]),u=65536*(256*c[7]+c[6])+l,f=new ArrayBuffer(u),m=new Uint32Array(f),b=u/4,p=c[8],h=8;a!=b;)if(0!=(p=c[h++])&&0!=(u=p>>5)){if(i=a,r=(31&p)<<8,7==u)do{u+=e=c[h++]}while(255==e);if(0==(r+=c[h++])){for(n=m[--i];u>9;)m[a]=n,m[a+1]=n,m[a+2]=n,m[a+3]=n,m[a+4]=n,m[a+5]=n,m[a+6]=n,m[a+7]=n,m[a+8]=n,m[a+9]=n,a+=10,u-=10;for(;0!=u--;)m[a++]=n}else if(8191==r&&(r+=(c[h]<<8)+c[h+1],h+=2),i-=r+1,u>100&&i+u<a)s=new Uint32Array(f,4*i,u),m.set(s,a),a+=u,i+=u;else{for(;u>9;)m[a]=m[i],m[a+1]=m[i+1],m[a+2]=m[i+2],m[a+3]=m[i+3],m[a+4]=m[i+4],m[a+5]=m[i+5],m[a+6]=m[i+6],m[a+7]=m[i+7],m[a+8]=m[i+8],m[a+9]=m[i+9],a+=10,u-=10,i+=10;for(;0!=u--;)m[a++]=m[i++]}}else{for(;p>9;)m[a]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],m[a+1]=4278190080|c[h+3]<<16|c[h+4]<<8|c[h+5],m[a+2]=4278190080|c[h+6]<<16|c[h+7]<<8|c[h+8],m[a+3]=4278190080|c[h+9]<<16|c[h+10]<<8|c[h+11],m[a+4]=4278190080|c[h+12]<<16|c[h+13]<<8|c[h+14],m[a+5]=4278190080|c[h+15]<<16|c[h+16]<<8|c[h+17],m[a+6]=4278190080|c[h+18]<<16|c[h+19]<<8|c[h+20],m[a+7]=4278190080|c[h+21]<<16|c[h+22]<<8|c[h+23],m[a+8]=4278190080|c[h+24]<<16|c[h+25]<<8|c[h+26],m[a+9]=4278190080|c[h+27]<<16|c[h+28]<<8|c[h+29],h+=30,a+=10,p-=10;0!=p&&(9==p?(m[a]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],m[a+1]=4278190080|c[h+3]<<16|c[h+4]<<8|c[h+5],m[a+2]=4278190080|c[h+6]<<16|c[h+7]<<8|c[h+8],m[a+3]=4278190080|c[h+9]<<16|c[h+10]<<8|c[h+11],m[a+4]=4278190080|c[h+12]<<16|c[h+13]<<8|c[h+14],m[a+5]=4278190080|c[h+15]<<16|c[h+16]<<8|c[h+17],m[a+6]=4278190080|c[h+18]<<16|c[h+19]<<8|c[h+20],m[a+7]=4278190080|c[h+21]<<16|c[h+22]<<8|c[h+23],m[a+8]=4278190080|c[h+24]<<16|c[h+25]<<8|c[h+26],h+=27,a+=9):8==p?(m[a]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],m[a+1]=4278190080|c[h+3]<<16|c[h+4]<<8|c[h+5],m[a+2]=4278190080|c[h+6]<<16|c[h+7]<<8|c[h+8],m[a+3]=4278190080|c[h+9]<<16|c[h+10]<<8|c[h+11],m[a+4]=4278190080|c[h+12]<<16|c[h+13]<<8|c[h+14],m[a+5]=4278190080|c[h+15]<<16|c[h+16]<<8|c[h+17],m[a+6]=4278190080|c[h+18]<<16|c[h+19]<<8|c[h+20],m[a+7]=4278190080|c[h+21]<<16|c[h+22]<<8|c[h+23],h+=24,a+=8):7==p?(m[a]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],m[a+1]=4278190080|c[h+3]<<16|c[h+4]<<8|c[h+5],m[a+2]=4278190080|c[h+6]<<16|c[h+7]<<8|c[h+8],m[a+3]=4278190080|c[h+9]<<16|c[h+10]<<8|c[h+11],m[a+4]=4278190080|c[h+12]<<16|c[h+13]<<8|c[h+14],m[a+5]=4278190080|c[h+15]<<16|c[h+16]<<8|c[h+17],m[a+6]=4278190080|c[h+18]<<16|c[h+19]<<8|c[h+20],h+=21,a+=7):6==p?(m[a]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],m[a+1]=4278190080|c[h+3]<<16|c[h+4]<<8|c[h+5],m[a+2]=4278190080|c[h+6]<<16|c[h+7]<<8|c[h+8],m[a+3]=4278190080|c[h+9]<<16|c[h+10]<<8|c[h+11],m[a+4]=4278190080|c[h+12]<<16|c[h+13]<<8|c[h+14],m[a+5]=4278190080|c[h+15]<<16|c[h+16]<<8|c[h+17],h+=18,a+=6):5==p?(m[a]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],m[a+1]=4278190080|c[h+3]<<16|c[h+4]<<8|c[h+5],m[a+2]=4278190080|c[h+6]<<16|c[h+7]<<8|c[h+8],m[a+3]=4278190080|c[h+9]<<16|c[h+10]<<8|c[h+11],m[a+4]=4278190080|c[h+12]<<16|c[h+13]<<8|c[h+14],h+=15,a+=5):4==p?(m[a]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],m[a+1]=4278190080|c[h+3]<<16|c[h+4]<<8|c[h+5],m[a+2]=4278190080|c[h+6]<<16|c[h+7]<<8|c[h+8],m[a+3]=4278190080|c[h+9]<<16|c[h+10]<<8|c[h+11],h+=12,a+=4):3==p?(m[a]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],m[a+1]=4278190080|c[h+3]<<16|c[h+4]<<8|c[h+5],m[a+2]=4278190080|c[h+6]<<16|c[h+7]<<8|c[h+8],h+=9,a+=3):2==p?(m[a]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],m[a+1]=4278190080|c[h+3]<<16|c[h+4]<<8|c[h+5],h+=6,a+=2):1==p&&(m[a++]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],h+=3)),m[a++]=4278190080|c[h]<<16|c[h+1]<<8|c[h+2],h+=3}if(w===this.LZ_IMAGE_TYPE_RGBA&&!d){var E=new Uint8Array(f);for(a=0,p=null,h--,p=c[h++];a<b;p=c[h++])if(i=a,u=p>>5,r=(31&p)<<8,_=4*a,p>=32){if(6===--u)do{u+=e=c[h++]}while(255===e);if(r+=e=c[h++],255===e&&r-e==7936&&(r=c[h++]<<8,r+=c[h++],r+=8191),u+=3,(i-=r+=1)===a-1)for(o=i;u;--u)E[(_=4*a)+3]=E[4*o+3],a++;else for(;u;--u)E[(_=4*a)+3]=E[4*i+3],a++,i++}else for(p++,E[_+3]=c[h++],a++,--p;p;p--)E[(_=4*a)+3]=c[h++],a++}return f}};wdi.LZSS?wdi.LZSS.lz_rgb32_decompress_rgb=lzDecompress.lz_rgb32_decompress_rgb:wdi.LZSS=lzDecompress;
@@ -1 +0,0 @@
1
- wdi.Agent=$.spcExtend(wdi.EventObject.prototype,{clientTokens:null,serverTokens:10,app:null,clipboardEnabled:!0,windows:null,clipboard:null,DELAY_BETWEEN_GRAB_AND_CTRLV:30,init:function(e){this.superInit(),this.app=e.app,this.clipboard=new wdi.Clipboard},dispose:function(){this.clientTokens=null,this.serverTokens=10,this.app=null,this.clipboardContent=null,this.clipboardEnabled=!0,this.windows=null},sendInitMessage:function(){var e=new wdi.SpiceMessage({messageType:wdi.SpiceVars.SPICE_MSGC_MAIN_AGENT_START,channel:wdi.SpiceVars.SPICE_CHANNEL_MAIN,args:new wdi.SpiceMsgMainAgentTokens({num_tokens:this.serverTokens})});this.app.spiceConnection.send(e);var s=1<<wdi.AgentCaps.VD_AGENT_CAP_MONITORS_CONFIG;this.clipboardEnabled&&(s|=1<<wdi.AgentCaps.VD_AGENT_CAP_CLIPBOARD_BY_DEMAND);var n={type:wdi.AgentMessageTypes.VD_AGENT_ANNOUNCE_CAPABILITIES,opaque:0,data:new wdi.VDAgentAnnounceCapabilities({request:0,caps:s})};this.sendAgentPacket(n)},setResolution:function(e,s){e<800&&(e=800),s<600&&(s=600);var n={type:wdi.AgentMessageTypes.VD_AGENT_MONITORS_CONFIG,opaque:0,data:new wdi.VDAgentMonitorsConfig({num_of_monitors:1,flags:0,data:new wdi.VDAgentMonConfig({width:e,height:s,depth:64,x:0,y:0})})};this.sendAgentPacket(n)},setClientTokens:function(e){this.clientTokens=e},sendAgentPacket:function(e){this.clientTokens--;var s=new wdi.SpiceMessage({messageType:wdi.SpiceVars.SPICE_MSGC_MAIN_AGENT_DATA,channel:wdi.SpiceVars.SPICE_CHANNEL_MAIN,args:new wdi.VDAgentMessage({protocol:1,type:e.type,opaque:e.opaque,data:e.data})});this.app.spiceConnection.send(s)},sendServerTokens:function(){var e=new wdi.SpiceMessage({messageType:wdi.SpiceVars.SPICE_MSGC_MAIN_AGENT_TOKEN,channel:wdi.SpiceVars.SPICE_CHANNEL_MAIN,args:new wdi.SpiceMsgMainAgentTokens({num_tokens:10})});this.app.spiceConnection.send(e),this.serverTokens=10},onAgentData:function(e){if(this.serverTokens--,0==this.serverTokens&&this.sendServerTokens(),e.type==wdi.AgentMessageTypes.VD_AGENT_ANNOUNCE_CAPABILITIES);else if(e.type==wdi.AgentMessageTypes.VD_AGENT_CLIPBOARD_GRAB){var s=this.clipboard.createRequest(e.clipboardType);this.sendAgentPacket(s)}else if(e.type==wdi.AgentMessageTypes.VD_AGENT_CLIPBOARD)this.fire("clipBoardData",e.clipboardData);else if(e.type==wdi.AgentMessageTypes.VD_AGENT_CLIPBOARD_REQUEST){s=this.clipboard.createContent();this.sendAgentPacket(s)}else e.type==wdi.AgentMessageTypes.VD_AGENT_CLIPBOARD_RELEASE||e.type==wdi.AgentMessageTypes.VD_AGENT_REPLY||(e.type==wdi.SpiceVars.SPICE_MSG_MAIN_AGENT_TOKEN?this.clientTokens+=e.args.num_tokens:console.warn("unknown message received by agent",e))},setClipboard:function(e){this.clipboard.setContent(e);var s=this.clipboard.createGrab();this.sendAgentPacket(s);var n=this;setTimeout((function(){n.app.sendShortcut(wdi.keyShortcutsHandled.CTRLV)}),this.DELAY_BETWEEN_GRAB_AND_CTRLV)},disableClipboard:function(){this.clipboardEnabled=!1}});
@@ -1 +0,0 @@
1
- Application=$.spcExtend(wdi.DomainObject,{spiceConnection:null,clientGui:null,agent:null,externalCallback:null,keyboardEnabled:!0,packetProcess:null,inputProcess:null,multimediaTime:null,lastMultimediaTime:null,busConnection:null,busProcess:null,timeLapseDetector:null,connectionInfo:null,reconnecting:null,checkActivity:null,configs:null,init:function(e){this.disposed=!1,e?this.configs=e:e=this.configs||{},wdi.spiceClientPath=e.spiceClientPath||"",wdi.Debug.log("application init"),wdi.GlobalPool.init(),this.spiceConnection=e.spiceConnection||new wdi.SpiceConnection,this.clientGui=e.clientGui||new wdi.ClientGui({app:this}),this.agent=e.agent||new wdi.Agent({app:this}),this.inputProcess=e.inputProcess||new wdi.InputProcess({clientGui:this.clientGui,spiceConnection:this.spiceConnection}),this.packetProcess=e.packetProcess,this.busConnection=e.busConnection||new wdi.BusConnection,this.busProcess=e.busProcess||new wdi.BusProcess({clientGui:this.clientGui,busConnection:this.busConnection}),this.timeLapseDetector=e.timeLapseDetector||new wdi.TimeLapseDetector,this.checkActivity=e.checkActivity,this.setup(),e.supportHighDPI?(this.clientGui.pixelRatio=window.devicePixelRatio,this.pixelRatio=window.devicePixelRatio):(this.clientGui.pixelRatio=1,this.pixelRatio=1)},run:function(e){if(this.runParams=e,e.hasOwnProperty("seamlessDesktopIntegration")&&(wdi.SeamlessIntegration=e.seamlessDesktopIntegration),!this.packetProcess){var t=!1;!1===e.useWorkers&&(t=new wdi.DisplayProcess({clientGui:this.clientGui,disableMessageBuffering:e.disableMessageBuffering})),this.packetProcess=new wdi.PacketProcess({app:this,clientGui:this.clientGui,agent:this.agent,spiceConnection:this.spiceConnection,inputsProcess:this.inputProcess,displayProcess:t,disableMessageBuffering:e.disableMessageBuffering})}if(this.checkActivity||(this.checkActivity=new wdi.CheckActivity(e.checkActivityInterval),this.checkActivity.addListener("activityLost",this.onActivityLost,this)),window.vdiLoadTest?this.spiceConnection.addListener("message",this.onMessage,this):this.spiceConnection.addListener("message",this.packetProcess.process,this.packetProcess),this.busConnection.connect(e),this.timeLapseDetector.startTimer(),e.canvasMargin&&this.clientGui.setCanvasMargin(e.canvasMargin),e.disableClipboard&&(this.agent.disableClipboard(),this.clientGui.disableClipboard(),this.enableCtrlC(),this.enableCtrlV()),e.layer&&this.clientGui.setLayer(e.layer),this.clientGui.checkFeatures()){wdi.SeamlessIntegration&&this.disableKeyboard(),wdi.Keymap.loadKeyMap(e.layout,this.clientGui.getStuckKeysHandler()),this.setExternalCallback(e.callback,e.context);try{this.connect({host:e.host,port:e.port,protocol:e.protocol,vmHost:e.vmHost,vmPort:e.vmPort,vmid:e.vmid,vmInfoToken:e.vmInfoToken,busHost:e.busHost,token:e.token,connectionControl:e.connectionControl,heartbeatToken:e.heartbeatToken,heartbeatTimeout:e.heartbeatTimeout})}catch(e){this.executeExternalCallback("error",1)}this.clientGui.setClientOffset(e.clientOffset.x,e.clientOffset.y)}e.hasOwnProperty("externalClipboardHandling")&&(this.externalClipoardHandling=e.externalClipboardHandling)},end:function(){},setup:function(){this.spiceConnection.addListener("mouseMode",this.onMouseMode,this),this.spiceConnection.addListener("initAgent",this.onInitAgent,this),this.spiceConnection.addListener("error",this.onDisconnect,this),this.spiceConnection.addListener("channelConnected",this.onChannelConnected,this),this.clientGui.addListener("input",this.onClientInput,this),this.clientGui.addListener("resolution",this.onResolution,this),this.clientGui.addListener("paste",this.onPaste,this),this.clientGui.addListener("startAudio",this.onStartAudio,this),this.clientGui.addListener("eventLayerCreated",this.onEventLayerCreated,this),this.busProcess.addListener("windowCreated",this.onWindowCreated,this),this.busProcess.addListener("windowClosed",this.onWindowClosed,this),this.busProcess.addListener("windowMoved",this.onWindowMoved,this),this.busProcess.addListener("windowResized",this.onWindowResized,this),this.busProcess.addListener("windowFocused",this.onWindowFocused,this),this.busProcess.addListener("windowMinimized",this.onWindowMinimized,this),this.busProcess.addListener("windowRestored",this.onWindowRestored,this),this.busProcess.addListener("windowMaximized",this.onWindowMaximized,this),this.busProcess.addListener("busConnected",this.onBusConnected,this),this.busProcess.addListener("menuResponse",this.onMenuResponse,this),this.busProcess.addListener("networkDriveResponse",this.onNetworkDriveResponse,this),this.busProcess.addListener("wrongPathError",this.onWrongPathError,this),this.busProcess.addListener("applicationLaunchedSuccessfully",this.onApplicationLaunchedSuccessfully,this),this.busProcess.addListener("selectedText",this.onRemoteSelectedText,this),this.busProcess.addListener("copiedText",this.onRemoteCopiedText,this),this.agent.addListener("clipBoardData",this.onClipBoardData,this),this.busConnection.addListener("busMessage",this.onBusMessage,this),this.busConnection.addListener("error",this.onDisconnect,this),this.timeLapseDetector.addListener("timeLapseDetected",this.onTimeLapseDetected,this),this.busProcess.addListener("defaultTypeEvent",this.onDefaultTypeEvent,this)},onChannelConnected:function(e){e===wdi.SpiceVars.SPICE_CHANNEL_INPUTS&&this.clientGui.releaseAllKeys()},onDefaultTypeEvent:function(e){this.executeExternalCallback(e.event,e)},onNetworkDriveResponse:function(e){this.executeExternalCallback("networkDriveResponse",e)},onDisconnect:function(e){var t=e;this.executeExternalCallback("error",t)},onResolution:function(e){this.executeExternalCallback("resolution",e)},onClipBoardData:function(e){this.externalClipoardHandling?this.executeExternalCallback("clipboardEvent",e):this.clientGui.setClipBoardData(e)},onRemoteCopiedText:function(e){this.clientGui.setToLocalClipboard(e)},onRemoteSelectedText:function(e){this.clientGui.setToLocalClipboard(e)},onWindowMinimized:function(e){var t=e;e=this.clientGui.resizeSubCanvas(t);this.executeExternalCallback("windowMinimized",e)},onWindowFocused:function(e){this.executeExternalCallback("windowFocused",e)},onWindowRestored:function(e){var t=e;e=this.clientGui.resizeSubCanvas(t);this.executeExternalCallback("windowRestored",e)},onWindowMaximized:function(e){var t=e;e=this.clientGui.resizeSubCanvas(t);this.executeExternalCallback("windowMaximized",e)},onWindowResized:function(e){var t=e;e=this.clientGui.resizeSubCanvas(t);this.executeExternalCallback("windowResized",e)},onWindowMoved:function(e){var t=e;e=this.clientGui.moveSubCanvas(t);this.executeExternalCallback("windowMoved",e)},onWindowClosed:function(e){var t=e;e=this.clientGui.deleteSubCanvas(t);this.executeExternalCallback("windowClosed",e)},onWindowCreated:function(e){var t=e;e=this.clientGui.createNewSubCanvas(t);this.executeExternalCallback("windowCreated",e)},onMenuResponse:function(e){var t=e;this.executeExternalCallback("menuResponse",t)},onClientInput:function(e){var t=e,i=t[0],n=t[1][0];this.inputProcess.isKeyboardShortcut(i,n)?this._sendCtrlKey(n.keyCode):this.inputProcess.send(t,i)},onMessage:function(e){var t=e;this.packetProcess.process(t);var i=this;window.checkResultsTimer&&clearTimeout(window.checkResultsTimer),window.checkResultsTimer=window.setTimeout((function(){i.executeExternalCallback("checkResults"),window.vdiLoadTest=!1}),5e3)},onBusConnected:function(e){wdi.SeamlessIntegration&&this.busProcess.requestWindowList()},onBusMessage:function(e){var t=e;this.busProcess.process(t)},onInitAgent:function(e){this.agent.setClientTokens(e),this.agent.sendInitMessage(this),this.reconnecting=!1,this.executeExternalCallback("ready",e)},onMouseMode:function(e){this.clientGui.setMouseMode(e)},onPaste:function(e){this.agent.setClipboard(e)},onStartAudio:function(){this.packetProcess.processors[wdi.SpiceVars.SPICE_CHANNEL_PLAYBACK].startAudio()},onEventLayerCreated:function(e){this.executeExternalCallback("eventLayerCreated",e)},onTimeLapseDetected:function(e){var t=e;this.executeExternalCallback("timeLapseDetected",t)},connect:function(e){wdi.Debug.log("application connect"),this.connectionInfo=e;try{this.spiceConnection.connect(e)}catch(e){wdi.Debug.error("application connect error",e),this.clientGui.showError(e.message)}},reconnect:function(e){this.reconnecting=!0,e.freeze&&this.freeze(),this.dispose(),this.init(),this.run(this.runParams)},freeze:function(){this.clientGui.freeze()},cancelFreeze:function(){this.clientGui.cancelFreeze()},setReconnecting:function(e){this.reconnecting=e},getReconnecting:function(){return this.reconnecting},setExternalCallback:function(e,t){this.externalCallback=[e,t]},executeExternalCallback:function(e,t){this.externalCallback[0].call(this.externalCallback[1],e,t)},sendCommand:function(e,t){switch(e){case"close":this.busProcess.closeWindow(t.hwnd);break;case"move":this.busProcess.moveWindow(t.hwnd,t.x,t.y);break;case"minimize":this.busProcess.minimizeWindow(t.hwnd);break;case"maximize":this.busProcess.maximizeWindow(t.hwnd);break;case"restore":this.busProcess.restoreWindow(t.hwnd);break;case"focus":this.busProcess.focusWindow(t.hwnd);break;case"resize":this.busProcess.resizeWindow(t.hwnd,t.width,t.height);break;case"run":this.busProcess.executeCommand(t.cmd);break;case"setResolution":this.agent.setResolution(t.width,t.height);break;case"getMenu":this.busProcess.getMenu();break;case"reMountNetworkDrive":this.busProcess.reMountNetworkDrive(t.host,t.username,t.password);break;case"refreshFileSystem":this.busProcess.refreshFileSystem();break;default:this.busProcess.sendGenericMessage(e,t)}},enableKeyboard:function(){this.clientGui.enableKeyboard()},disableKeyboard:function(){this.clientGui.disableKeyboard()},enableCtrlC:function(){wdi.KeymapES.setCtrlKey(67,46),wdi.KeymapUS.setCtrlKey(67,46)},enableCtrlV:function(){wdi.KeymapES.setCtrlKey(86,47),wdi.KeymapUS.setCtrlKey(86,47)},disconnect:function(){this.busConnection.disconnect(),this.spiceConnection.disconnect()},setMultimediaTime:function(e){this.multimediaTime=e,this.lastMultimediaTime=Date.now()},sendShortcut:function(e){e===wdi.keyShortcutsHandled.CTRLV?this._sendCtrlKey(86):e===wdi.keyShortcutsHandled.CTRLC&&this._sendCtrlKey(67)},sendCtrlAltDelete:function(){this._sendCtrlKey(18,46)},_sendCtrlKey:function(e,t){this.inputProcess.send(["keydown",[{generated:!0,type:"keydown",keyCode:17,charCode:0}]],"keydown"),this.inputProcess.send(["keydown",[{generated:!0,type:"keydown",keyCode:e,charCode:0}]],"keydown"),t&&this.inputProcess.send(["keydown",[{generated:!0,type:"keydown",keyCode:t,charCode:0}]],"keydown"),this.inputProcess.send(["keyup",[{generated:!0,type:"keyup",keyCode:e,charCode:0}]],"keyup"),t&&this.inputProcess.send(["keyup",[{generated:!0,type:"keyup",keyCode:t,charCode:0}]],"keyup"),this.inputProcess.send(["keyup",[{generated:!0,type:"keyup",keyCode:17,charCode:0}]],"keyup")},dispose:function(){this.disposed=!0,wdi.Debug.log("application dispose"),wdi.ExecutionControl.runQ.clear(),wdi.ExecutionControl.currentProxy=null,wdi.ExecutionControl.sync=!0,this.disableKeyboard(),this.disconnect(),this.packetProcess.dispose(),this.clientGui.dispose(),this.busProcess.clearEvents(),this.busProcess.dispose(),this.busConnection.clearEvents(),this.agent.clearEvents(),this.agent.dispose(),this.timeLapseDetector.clearEvents(),this.timeLapseDetector.dispose(),this.checkActivity.dispose()},onWrongPathError:function(e){this.executeExternalCallback("wrongPathError",e)},onApplicationLaunchedSuccessfully:function(e){this.executeExternalCallback("applicationLaunchedSuccessfully",e)},getKeyboardHandler:function(){return this.clientGui.handleKey},getClientGui:function(){return this.clientGui},setCurrentWindow:function(e){this.clientGui.inputManager.setCurrentWindow(e)},onActivityLost:function(e){this.executeExternalCallback("activityLost",e)},resetActivity:function(){this.checkActivity.resetActivity()},toSpiceResolution:function(e){return{width:e.width*this.pixelRatio,height:e.height*this.pixelRatio,scaleFactor:this.pixelRatio}}}),window.Application=Application,Application.prototype.run=Application.prototype.run,Application.prototype.sendCommand=Application.prototype.sendCommand,Application.prototype.enableKeyboard=Application.prototype.enableKeyboard,Application.prototype.disableKeyboard=Application.prototype.disableKeyboard,Application.prototype.dispose=Application.prototype.dispose,Application.prototype.getKeyboardHandler=Application.prototype.getKeyboardHandler,Application.prototype.getClientGui=Application.prototype.getClientGui,Application.prototype.setCurrentWindow=Application.prototype.setCurrentWindow,Application.prototype.reconnect=Application.prototype.reconnect,Application.prototype.freeze=Application.prototype.freeze,Application.prototype.cancelFreeze=Application.prototype.cancelFreeze,Application.prototype.setReconnecting=Application.prototype.setReconnecting,Application.prototype.getReconnecting=Application.prototype.getReconnecting;
@@ -1 +0,0 @@
1
- wdi.CheckActivity=$.spcExtend(wdi.EventObject.prototype,{init:function(t){this.superInit(),this.milliseconds=t||6e5,this.eventHandlers={keydown:this.resetActivity.bind(this),mousemove:this.resetActivity.bind(this),click:this.resetActivity.bind(this)},this.activityTimeout=this.createTimeout(),$(document).on(this.eventHandlers)},resetActivity:function(t){clearTimeout(this.activityTimeout),this.activityTimeout=this.createTimeout()},createTimeout:function(){var t=this;return setTimeout((function(){t.fire("activityLost")}),this.milliseconds)},dispose:function(){$(document).off(this.eventHandlers),clearTimeout(this.activityTimeout)}});
@@ -1 +0,0 @@
1
- wdi.SPICE_INPUT_MOTION_ACK_BUNCH=8,wdi.ClientGui=$.spcExtend(wdi.EventObject.prototype,{width:null,height:null,canvas:null,ack_wait:0,mouse_mode:0,mouse_status:0,eventLayer:null,counter:0,mainCanvas:0,firstTime:!0,clientOffsetX:0,clientOffsetY:0,magnifier:null,magnifierBackground:null,firstMove:!0,isMagnified:!0,isMouseDown:!1,soundStarted:!1,canvasMarginY:0,canvasMarginX:0,stuckKeysHandler:null,isKeyboardEnabled:!1,subCanvas:{},inputManager:null,clipboardEnabled:!0,layer:null,freezeClass:"freeze",app:{},init:function(e){this.time=Date.now(),this.canvas={},this.contexts={},this.superInit(),this.magnifier=window.$("<canvas/>").attr({width:150,height:150}).css({position:"absolute",left:"0px",top:"0px"}),this.stuckKeysHandler=e.stuckKeysHandler||new wdi.StuckKeysHandler,this.settings=e.settings||{},this.stuckKeysHandler.addListener("inputStuck",this._sendInput.bind(this),this),this.magnifierBackground=window.$("<img/>"),this.magnifierBackground.attr("src","/spice-console/resources/magnifier.png"),this.initSound(),this.inputManager=e.inputManager||new wdi.InputManager({stuckKeysHandler:this.stuckKeysHandler,window:$(window)}),this.inputManager.setCurrentWindow(window),this.clipBoardDataParser=e.clipBoardDataParser||new wdi.ClipboardDataParser({}),this.localClipboard=e.localClipboard||new wdi.LocalClipboard({clientGui:this}),this.app=e.app;var t=this;this.eventHandlers={hide:function(){t.stuckKeysHandler.releaseAllKeys()}},window.$(document).on(this.eventHandlers)},dispose:function(){wdi.Debug.log("Disposing ClientGui"),$(document).off(this.eventHandlers),this.unbindDOM(),this.removeAllCanvases(),this.inputManager.dispose(),this.stuckKeysHandler.dispose(),this.localClipboard.dispose(),this.width=null,this.height=null,this.canvas=null,this.ack_wait=0,this.mouse_mode=0,this.mouse_status=0,this.eventLayer=null,this.counter=0,this.mainCanvas=0,this.firstTime=!0,this.clientOffsetX=0,this.clientOffsetY=0,this.magnifier=null,this.magnifierBackground=null,this.firstMove=!0,this.isMagnified=!0,this.isMouseDown=!1,this.soundStarted=!1,this.canvasMarginY=0,this.canvasMarginX=0,this.stuckKeysHandler=null,this.subCanvas={},this.inputManager=null,this.clipboardEnabled=!0,this.layer=null,clearInterval(self.rightClickTimer),clearInterval(self.mouseDownTimer)},removeAllCanvases:function(){var e=this;Object.keys(this.canvas).forEach((function(t){$(e.canvas[t]).remove(),delete e.canvas[t],delete e.contexts[t]})),$(this.eventLayer).remove(),this.eventLayer=null},unbindDOM:function(){if(this.eventLayer){["touchstart","touchmove","touchend","mouseup","mousedown","mousemove","contextmenu","mousewheel"].forEach((function(e){$(this.eventLayer).unbind(e)}))}},freeze:function(){if(this.canvas[0]){var e=new Image,t=this.canvas[0],n=$(t);$(e).attr("style",n.attr("style")),$(e).attr("class",this.freezeClass),e.src=t.toDataURL("image/png"),n.parent().append($(e))}},cancelFreeze:function(){$("."+this.freezeClass).remove()},setLayer:function(e){this.layer=e},disableClipboard:function(){this.clipboardEnabled=!1},_sendInput:function(e){var t=e,n=t[0],i=t[1];this.fire("input",[n,i])},releaseAllKeys:function(){this.stuckKeysHandler.releaseAllKeys()},getContext:function(e){return this.contexts[e]},getCanvas:function(e){return this.canvas[e]},checkFeatures:function(){return!(!Modernizr.canvas||!Modernizr.websockets)||(alert("Your Browser is not compatible with WDI. Visit ... for a list of compatible browsers"),!1)},deleteSubCanvas:function(e){var t=this.subCanvas[e.hwnd];return this.subCanvas[e.hwnd]=null,t},moveSubCanvas:function(e){var t=this.subCanvas[e.hwnd];return t.info=e,this._fillSubCanvasFromWindow(e),t},resizeSubCanvas:function(e){var t=this.subCanvas[e.hwnd];return $([t.canvas,t.eventLayer]).attr({width:e.width,height:e.height}),t.info=e,this._fillSubCanvasFromWindow(e),t},_fillSubCanvasFromWindow:function(e){var t=parseInt(e.top,10),n=parseInt(e.left,10),i=parseInt(e.width,10),a=parseInt(e.height,10);this.fillSubCanvas({top:t,left:n,right:n+i,bottom:t+a})},createNewSubCanvas:function(e){var t=this.createEventLayer(e.hwnd+"_event",e.width,e.height);return this.subCanvas[e.hwnd]={canvas:$("<canvas/>").attr({width:e.width,height:e.height}).css({display:e.iconic?"none":"block"})[0],eventLayer:t,info:e,position:0},this.canvas[this.mainCanvas]&&this._fillSubCanvasFromWindow(e),[this.subCanvas[e.hwnd]]},fillSubCanvas:function(e){var t=this.canvas[this.mainCanvas],n=null;for(var i in this.subCanvas)if(null!=this.subCanvas[i]&&void 0!==this.subCanvas[i]&&this.subCanvas.hasOwnProperty(i))if(n=this.subCanvas[i].info,null!=e||null!=e){var a=parseInt(n.top,10),s=parseInt(n.left,10),o={top:a,left:s,right:s+parseInt(n.width,10),bottom:a+parseInt(n.height,10)};wdi.CollisionDetector.thereIsBoxCollision(o,e)&&this._doDrawSubCanvas(t,this.subCanvas[i],n)}else this._doDrawSubCanvas(t,this.subCanvas[i],n)},_doDrawSubCanvas:function(e,t,n){if(null!=this.canvas[this.mainCanvas]&&null!=this.canvas[this.mainCanvas]){var i=null;if(0===n.iconic){i=t.canvas.getContext("2d");var a=0,s=0,o=+n.width,r=+n.height,l=+n.left,u=+n.top;l<0&&(o+=l,a=-l,l=0),u<0&&(r+=u,s=-u,u=0);try{o=Math.max(1,Math.floor(o)),r=Math.max(1,Math.floor(r)),o>e.width&&(o=e.width),r>e.height&&(r=e.height),i.drawImage(e,l,u,o,r,a,s,o,r)}catch(e){wdi.Debug.error(e)}}}},removeCanvas:function(e){var t=e.args;t.surface_id===this.mainCanvas&&($(this.eventLayer).remove(),this.eventLayer=null),this.canvas[t.surface_id].keepAlive=!1,delete this.canvas[t.surface_id],delete this.contexts[t.surface_id]},drawCanvas:function(e){wdi.Debug.log("clientgui time: ",this.time);var t=e.args;if(t.width<window.innerWidth){const e=(window.innerWidth-t.width)/2;this.setCanvasMargin({x:e,y:this.canvasMarginY}),this.setClientOffset(-e,this.canvasMarginY)}var n=wdi.GlobalPool.create("Canvas");if(n.keepAlive=!0,n.id="canvas_"+t.surface_id,n.width=t.width*this.pixelRatio,n.height=t.height*this.pixelRatio,n.style.position="absolute",n.style.top=this.canvasMarginY+"px",n.style.left=this.canvasMarginX+"px",n.style.width=t.width+"px",n.style.height=t.height+"px",this.canvas[t.surface_id]=n,this.contexts[t.surface_id]=n.getContext("2d"),t.flags&&!wdi.SeamlessIntegration){this.mainCanvas=t.surface_id,this.eventLayer=this.createEventLayer("eventLayer",t.width,t.height);var i=$(this.eventLayer).css({position:"absolute",top:this.canvasMarginY+"px",left:this.canvasMarginX+"px"})[0];this.layer?(this.layer.appendChild(n),this.layer.appendChild(i)):(document.body.appendChild(n),document.body.appendChild(i)),!this.isKeyboardEnabled&&this.enableKeyboard()}if(this.firstTime&&this.clipboardEnabled){var a=this,s=this.settings.PASTES_PER_SECOND||5,o=_.throttle((function(e){a.fire("paste",e)}),1e3/s);$(document).bind("paste",(function(e){a.clipBoardDataParser.parse(e.originalEvent.clipboardData,o)})),$(document).bind("copy",(function(e){a.app.sendShortcut(wdi.keyShortcutsHandled.CTRLC)})),this.firstTime=!1}t.flags&&this.fire("resolution",[this.canvas[t.surface_id].width,this.canvas[t.surface_id].height])},disableKeyboard:function(){var e=window.$(window.document);e.unbind("keydown",this.handleKey),e.unbind("keyup",this.handleKey),e.unbind("keypress",this.handleKey),this.inputManager.disable()},enableKeyboard:function(){var e=this,t=window.$(window.document);t.keydown([e],this.handleKey),t.keypress([e],this.handleKey),t.keyup([e],this.handleKey),this.inputManager.enable(),!this.isKeyboardEnabled&&(this.isKeyboardEnabled=!0)},setCanvasMargin:function(e){this.canvasMarginX=e.x,this.canvasMarginY=e.y},createEventLayer:function(e,t,n){var i=this,a=$("<canvas/>").css({cursor:"default",position:"absolute"}).attr({id:e,width:t,height:n});window.bowser.firefox&&a.attr("contentEditable",!0),a.bind("touchstart",(function(e){e.preventDefault();var t=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],n=t.pageX,a=t.pageY;i.generateEvent.call(i,"mousemove",[n+i.clientOffsetX,a+i.clientOffsetY,i.mouse_status]),1===e.originalEvent.touches.length?(i.enabledTouchMove=!0,i.launchRightClick.call(i,n,a)):2===e.originalEvent.touches.length?(i.touchX=n,i.touchY=a,i.enabledTouchMove=!1):3===e.originalEvent.touches.length&&(i.touchY3=a,i.enabledTouchMove=!1)})),a.bind("touchmove",(function(e){var t=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],n=t.pageX,a=t.pageY;if(1===e.originalEvent.touches.length&&i.enabledTouchMove){i.isMagnified=!0,clearInterval(i.rightClickTimer),i.isMouseDown||(clearInterval(i.mouseDownTimer),i.launchMouseDown()),i.generateEvent.call(i,"mousemove",[n+i.clientOffsetX,a+i.clientOffsetY-80,i.mouse_status]);var s=$(this).offset(),o=n-s.left,r=a-s.top;i.firstMove&&($("body").append(i.magnifier),i.firstMove=!1);var l=o-75,u=r-160;i.magnifier.css({left:l,top:u});var h=i.magnifier[0].getContext("2d");h.clearRect(0,0,150,150),h.save(),h.beginPath(),h.arc(75,75,75,0,2*Math.PI,!1),h.clip(),h.drawImage(i.getCanvas(0),o-50,r-50-80,100,100,0,0,150,150),h.drawImage(i.magnifierBackground[0],0,0),h.restore()}else if(2===e.originalEvent.touches.length){var c=i.touchY-a;if(Math.abs(c)>10){var d=c>0?4:3;i.touchX=n,i.touchY=a,i.generateEvent.call(i,"mousedown",d),i.generateEvent.call(i,"mouseup",d)}}else if(3===e.originalEvent.touches.length){(c=i.touchY3-a)>100&&document.getElementById("hiddeninput").select()}e.preventDefault()})),a.bind("touchend",(function(e){if(i.enabledTouchMove){var t=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0];t.pageX,t.pageY;i.isMouseDown||i.generateEvent.call(i,"mousedown",0),i.isMouseDown=!1,i.generateEvent.call(i,"mouseup",0);$(this).offset();i.enabledTouchMove=!1,i.firstMove=!0,i.isMagnified&&i.magnifier.remove(),i.isMagnified=!1}clearInterval(i.rightClickTimer),clearInterval(i.mouseDownTimer)})),a.mouseup((function(e){var t=e.button;i.generateEvent.call(i,"mouseup",t),i.mouse_status=0,e.preventDefault()})),a.mousedown((function(e){var t=e.button;i.generateEvent.call(i,"mousedown",t),i.mouse_status=1,e.preventDefault()})),a.mousemove((function(e){var t=e.pageX,n=e.pageY;i.generateEvent.call(i,"mousemove",[(t+i.clientOffsetX)*i.pixelRatio,(n+i.clientOffsetY)*i.pixelRatio,i.mouse_status]),e.preventDefault()})),a.bind("contextmenu",(function(e){return e.preventDefault(),!1}));var s=_.throttle((function(e,t){var n=t>0?3:4;return i.generateEvent.call(i,"mousedown",n),i.generateEvent.call(i,"mouseup",n),!1}),60);return a.bind("mousewheel",s),this.fire("eventLayerCreated",a[0]),wdi.VirtualMouse.setEventLayer(a[0],0,0,t,n,1),a[0]},launchRightClick:function(e,t){var n=this;this.rightClickTimer=setTimeout((function(){n.generateEvent.call(n,"mousedown",2),n.generateEvent.call(n,"mouseup",2),n.enabledTouchMove=!1}),400)},launchMouseDown:function(e,t){var n=this;this.mouseDownTimer=setTimeout((function(){n.isMouseDown=!0,n.generateEvent.call(n,"mousedown",0)}),1500)},showError:function(e){wdi.Debug.warn(e),$("<div/>",{id:"error"}).html(e).css({"background-color":"#ff4141"}).appendTo("body"),setTimeout("$('#error').remove()",2e3)},generateEvent:function(e,t){if("mousemove"===e||"joystick"===e)this.ack_wait<wdi.SPICE_INPUT_MOTION_ACK_BUNCH&&(this.ack_wait++,this.fire("input",[e,t]));else{if(e.indexOf("key")>-1){if(this.stuckKeysHandler.checkSpecialKey(e,t[0].keyCode),!this.shouldGenerateKeyEvents(t[0].keyCode))return;var n="keypress"===e?this.inputManager.getValue():"";"keypress"===e&&$("#inputmanager").val(""),n&&(t=this.inputManager.manageChar(n,t))}this.fire("input",[e,t])}},shouldGenerateKeyEvents:function(e){return!this.inputManager.isSpecialKey(e)},motion_ack:function(){this.ack_wait=0},setMouseMode:function(e){this.mouse_mode=e},handleKey:function(e){e.data[0].generateEvent.call(e.data[0],e.type,[e]),wdi.Keymap.isInKeymap(e.keyCode)&&"keypress"!==e.type&&e.preventDefault()},setClientOffset:function(e,t){this.clientOffsetX=e,this.clientOffsetY=t},setClipBoardData:function(e){navigator.clipboard.writeText(e)},setToLocalClipboard:function(e){this.localClipboard.updateClipboardBuffer(e.value)},getStuckKeysHandler:function(){return this.stuckKeysHandler},initSound:function(){var e=this;if(Modernizr.touch){var t=$("<button>Start</button>",{id:"startAudio"}).css({padding:"10px 25px",fontSize:"25px",fontFamily:"Verdana",cursor:"pointer",margin:"0 auto"}).click((function(){e.soundStarted=!0,e.fire("startAudio"),$("#soundButtonContainer").remove()})),n=$('<div id="messageContainer"><p>Click to start using your virtual session:</p></div>').css({color:"white",textAlign:"center",fontSize:"25px",fontFamily:"Verdana",marginTop:"75px"}),i=$("<div></div>",{id:"soundButtonContainer"});t.appendTo(n),n.appendTo(i),i.appendTo("body"),i.css({position:"absolute",zIndex:999999999,top:0,left:0,width:"100%",height:document.height,backgroundColor:"black"})}else this.soundStarted=!0,window.setTimeout((function(){e.fire("startAudio")}),100)}});
@@ -1 +0,0 @@
1
- wdi.ClipboardDataParser=$.spcExtend(wdi.EventObject.prototype,{fileReader:null,init:function(e){this.fileReader=e.FileReader||FileReader},parse:function(e,t){var n=this,r=["image/png","text/plain"];function i(e,t){switch(e.kind){case"string":return function(e,t){var n=e.type;e.getAsString((function(e){return t({type:n,blob:e})}))}(e,t);case"file":return function(e,t){var r=e.type,i=e.getAsFile(),a=new n.fileReader;a.addEventListener("loadend",(function(){return t({type:r,blob:a.result})})),a.readAsArrayBuffer(i)}(e,t)}}var a=e.items;if(a)for(var l=0;l<r.length;l++)for(var f=r[l],s=0;s<a.length;s++){var o=a[s];if(o.type==f)return i(o,t)}else if(e.getData){f="text/plain";e.types.contains(f)&&t({type:f,blob:e.getData(f)})}}});
@@ -1 +0,0 @@
1
- wdi.LocalClipboard=$.spcExtend(wdi.EventObject.prototype,{init:function(o){this.clipboardContainer=$('<div style="position:absolute;top:-10000000px;"><textarea id="remoteClipboard" style="position:absolute;top:-10000000px;font-size: 20px;color:black;z-index: 100" rows="4" cols="50"></textarea></div>'),$("#vmw").prepend(this.clipboardContainer),this.clientGui=o.clientGui,this.eventHandlers={keydown:this.triggerCopyToClipboard.bind(this)},$(document).on(this.eventHandlers),this.delayCopyEvents={mousedown:this.copyToClipboard.bind(this),mouseup:this.copyToClipboard.bind(this),keydown:this.copyToClipboard.bind(this),keyup:this.copyToClipboard.bind(this)},$(document).on(this.delayCopyEvents)},updateClipboardBuffer:function(o){$("#remoteClipboard").val(o)},triggerCopyToClipboard:function(o){(function(o){var e=o.ctrlKey;return-1!=navigator.appVersion.indexOf("Mac")&&(e=o.metaKey),67===o.keyCode&&e})(o)&&(this.clipboardCopyDelay=Date.now()+1e3,o.preventDefault(),this.copyToClipboard(o))},copyToClipboard:function(o){if(this.clipboardCopyDelay&&!(this.clipboardCopyDelay<Date.now())){!function(o){$("#remoteClipboard").focus();try{var e=document.execCommand("copy");$("#remoteClipboard").blur(),$("#inputmanager").focus(),console.log("Result executeCommand",o.type,"-----",e)}catch(o){console.error(o)}}(o)}},dispose:function(){this.clipboardContainer.remove(),$(document).off(this.eventHandlers),$(document).off(this.delayCopyEvents)}});
@@ -1 +0,0 @@
1
- wdi.Clipboard=$.spcExtend(wdi.EventObject.prototype,{_blob:null,_type:null,getSpiceType:function(e){switch(e){case"text/plain":return wdi.ClipBoardTypes.VD_AGENT_CLIPBOARD_UTF8_TEXT;case"image/png":return wdi.ClipBoardTypes.VD_AGENT_CLIPBOARD_IMAGE_PNG;default:throw new Error("Unsupported mime type "+e)}},getMimeType:function(e){switch(e){case wdi.ClipBoardTypes.VD_AGENT_CLIPBOARD_UTF8_TEXT:return"text/plain";case wdi.ClipBoardTypes.VD_AGENT_CLIPBOARD_IMAGE_PNG:return"image/png";default:throw new Error("Unsupported spice type "+e)}},createGrab:function(){return{type:wdi.AgentMessageTypes.VD_AGENT_CLIPBOARD_GRAB,opaque:0,data:new wdi.VDAgentClipboardGrab({types:[this.getSpiceType(this._type)]})}},createRequest:function(e){return{type:wdi.AgentMessageTypes.VD_AGENT_CLIPBOARD_REQUEST,opaque:0,data:new wdi.VDAgentClipboardRequest({type:e})}},createContent:function(){return{type:wdi.AgentMessageTypes.VD_AGENT_CLIPBOARD,opaque:0,data:new wdi.VDAgentClipboard({type:this.getSpiceType(this._type),data:this._blob})}},setContent:function(e){this._type=e.type,this._blob=e.blob},getContent:function(){return{blob:this._blob,type:this._type}}});
@@ -1 +0,0 @@
1
- wdi.CodecH264={video:{},jmuxer:{},loadedVideo:{},queues:{},isReady:{},create:function(e){if(this.video[e])return;const t=document.createElement("video");t.id=`video${e}`,t.setAttribute("autoplay",""),this.video[e]=t,this.jmuxer[e]=new JMuxer({node:t,mode:"video",flushingTime:0,fps:60,onReady:()=>{this.isReady[e]=!0}})},addQueue:function(e,t){this.queues[e]||(this.queues[e]=[]),this.queues[e].push(t)},resetQueues:function(e){this.queues[e]=[]},feed:function(e,t){this._addListener(e),this.queues[e]?.length&&(this.queues[e].forEach((t=>{this.jmuxer[e].feed({video:t})})),this.resetQueues(e)),this.jmuxer[e].feed({video:t})},destroy:function(e){this._removeListener(e),this.video[e]?.remove(),this.video={},this.jmuxer={},this.loadedVideo={}},_addListener:function(e){this.video[e]?.removeEventListener("loadedmetadata",this.loadedVideo[e]),this.video[e].addEventListener("loadedmetadata",this.loadedVideo[e])},_removeListener:function(e){this.video[e]?.removeEventListener("loadedmetadata",this.loadedVideo[e])}},wdi.CodecVp8={decoders:{},create:function(e){this.decoders[e]=new vp8_decoder_ctx},destroy:function(){this.decoders={}},feed:function(e,t,i,d){const s=vp8_dixie_decode_frame(this.decoders[e],t,t.length);VPX_CODEC_OK===s&&this._I420toRGBA(this.decoders[e].ref_frames[0].img,i,d)},_I420toRGBA:function(e,t,i){const d=e.w,s=e.d_h,o=e.d_w;let n,r,u,a=t.createImageData(o,s),h=a.data;for(let t=0;t<s;t++)for(let i=0;i<o;i++){const s=e.planes[0][e.planes_off[0]+0+i+d*t],a=e.planes[1][e.planes_off[1]+0+(i>>1)+(d>>1)*(t>>1)],c=e.planes[2][e.planes_off[2]+0+(i>>1)+(d>>1)*(t>>1)];n=Math.round(s+1.13983*(c-128)),r=Math.round(s-.39465*(a-128)-.5806*(c-128)),u=Math.round(s+2.03211*(a-128)),h[0+4*i+4*o*t]=n,h[1+4*i+4*o*t]=r,h[2+4*i+4*o*t]=u,h[3+4*i+4*o*t]=255}t.putImageData(a,i.x,i.y)}},wdi.CodecH265={queue:{},configed:{},isReady:{},decoders:{},pendingFrames:{},underflow:{},baseTime:{},create:async function(e,t,i){const d={output:this._handleFrame.bind(this,e,t,i),error:e=>{console.log(e)}},s={codec:wdi.SpiceVideoCodecValue[wdi.currentCodec],codedWidth:640,codedHeight:480},{supported:o}=await VideoDecoder.isConfigSupported(s);o?(this.decoders[e]=new VideoDecoder(d),this.decoders[e].configure(s),this.isReady[e]=!0):console.log("not supported")},destroy:function(){this.queue={},this.configed={},this.isReady={},this.decoders={},this.pendingFrames={},this.underflow={},this.baseTime={}},addQueue:function(e,t){this.queues[e]||(this.queues[e]=[]),this.queues[e].push(t)},resetQueues:function(e){this.queues[e]=[]},setConfig:function(e,t){const i={codec:wdi.SpiceVideoCodecValue[wdi.currentCodec],codedWidth:t.width,codedHeight:t.height};this.decoders[e].configure(i),this.configed[e]=!0},decode:function(e,t){this.queue[e]?.length&&(this.queue[e].forEach((t=>{const i=new EncodedVideoChunk({type:"key",data:t,timestamp:performance.now()});this.decoders[e].decode(i)})),this.resetQueues(e));const i=new EncodedVideoChunk({type:"key",data:t,timestamp:performance.now()});this.decoders[e].decode(i)},_handleFrame:function(e,t,i,d){this.pendingFrames[e]||(this.pendingFrames[e]=[]),this.pendingFrames[e].push(d),void 0===this.underflow[e]&&(this.underflow[e]=!0),this.underflow[e]&&setTimeout(this._renderFrame.bind(this,e,t,i),0)},_renderFrame:async function(e,t,i){if(this.underflow[e]=0===this.pendingFrames[e].length,this.underflow[e])return;const d=this.pendingFrames[e].shift(),s=this._calculateTimeUntilNextFrame(d.timestamp,e);await new Promise((e=>{setTimeout(e,s)})),t.drawImage(d,i.x,i.y,i.width,i.height),d.close(),setTimeout(this._renderFrame.bind(this,e,t,i),0)},_calculateTimeUntilNextFrame:function(e,t){this.baseTime[t]||(this.baseTime[t]=performance.now());const i=performance.now()-this.baseTime[t];return Math.max(0,e/1e3-i)}};
@@ -1 +0,0 @@
1
- wdi.ImageCache={images:{},cursor:{},palettes:{},dispose:function(){wdi.Debug.log("Disposing ImageCache"),this.images={},this.cursor={},this.palettes={}},getImageFrom:function(t,e){var i=wdi.GlobalPool.create("Canvas"),a=this.images[t.id.toString()];i.width=a.width,i.height=a.height,i.getContext("2d").putImageData(a,0,0),e(i)},isImageInCache:function(t){return t.id.toString()in this.images},delImage:function(t){delete this.images[t.toString()]},addImage:function(t,e){e.getContext?this.images[t.id.toString()]=e.getContext("2d").getImageData(0,0,2e3,e.height):this.images[t.id.toString()]=e},getCursorFrom:function(t){return this.cursor[t.header.unique.toString()]},addCursor:function(t,e){this.cursor[t.header.unique.toString()]=e},getPalette:function(t){return this.palettes[t.toString()]},addPalette:function(t,e){this.palettes[t.toString()]=e},clearPalettes:function(){this.palettes={}}};
@@ -1 +0,0 @@
1
- wdi.InputManager=$.spcExtend(wdi.EventObject.prototype,{checkFocus:!1,input:null,window:null,stuckKeysHandler:null,init:function(t){this.time=Date.now(),wdi.Debug.log("inputmanager init: ",this.time),this.superInit(),this.input=t.input,this.window=t.window,this.stuckKeysHandler=t.stuckKeysHandler,this.$=t.jQuery||$,t.disableInput||(this.inputElement=this.$('<div style="position:absolute"><input type="text" id="inputmanager" value="_" style="opacity: 0; color: transparent"/></div>')),this.currentWindow=null,this.getClientSO(),this.tildeMarks=["´","`","^","¨"],this.lastChar=null,this.tildeReplacements={a:{0:"á",1:"à",2:"â",3:"ä"},e:{0:"é",1:"è",2:"ê",3:"ë"},i:{0:"í",1:"ì",2:"î",3:"ï"},o:{0:"ó",1:"ò",2:"ô",3:"ö"},u:{0:"ú",1:"ù",2:"û",3:"ü"},A:{0:"Á",1:"À",2:"Â",3:"Ä"},E:{0:"É",1:"È",2:"Ê",3:"Ë"},I:{0:"Í",1:"Ì",2:"Î",3:"Ï"},O:{0:"Ó",1:"Ò",2:"Ô",3:"Ö"},U:{0:"Ú",1:"Ù",2:"Û",3:"Ü"}}},getClientSO:function(){var t=window.navigator.platform.toLowerCase();t.indexOf("mac")>-1?this.clientSO="mac":t.indexOf("linux")?this.clientSO="linux":this.clientSO="windows"},setCurrentWindow:function(t){t=this.$(t),this.currentWindow&&(this.inputElement.remove(),this.currentWindow.unbind("blur")),this.$(t[0].document.getElementById("vmw")).prepend(this.inputElement),this.input=this.$(t[0].document.getElementById("inputmanager")),this.addListeners(t),this.currentWindow=t},dispose:function(){this.disposed=!0,this.inputElement.remove(),this.currentWindow.unbind("blur"),this.currentWindow.unbind("input"),this.inputElement=null,this.checkFocus=!1,this.input=null,this.window=null,this.stuckKeysHandler=null},addListeners:function(t){this._onBlur(t),this._onInput()},_onBlur:function(t){var i=this;t.on("blur",(function(t){i.checkFocus&&i.input.focus(),i.stuckKeysHandler.releaseSpecialKeysPressed()}))},_onInput:function(){var t=this;this.input.on("input",(function(i){t.input.val().length>1&&t.reset()}))},enable:function(){wdi.Debug.log("enable!!!!!!!!!! ",this.time),this.checkFocus=!0,this.input.select()},disable:function(){this.checkFocus=!1,this.input&&this.input.blur()},reset:function(){this.input.val("")},getValue:function(){var t=this.input.val();if(t&&this.reset(),"mac"===this.clientSO){if(this.tildeMarks.indexOf(this.lastChar)>-1&&this.tildeReplacements.hasOwnProperty(t))switch(this.lastChar){case this.tildeMarks[0]:t=this.tildeReplacements[t][0];break;case this.tildeMarks[1]:t=this.tildeReplacements[t][1];break;case this.tildeMarks[2]:t=this.tildeReplacements[t][2];break;case this.tildeMarks[3]:t=this.tildeReplacements[t][3]}t&&this.tildeMarks.indexOf(t)>-1?t!=this.lastChar?(this.lastChar=t,t=""):t===this.lastChar&&(this.lastChar=""):this.lastChar=t||this.lastChar}return t},manageChar:function(t,i){var e=[Object.create(i[0])];return e[0].type="inputmanager",e[0].charCode=t.charCodeAt(0),e},isSpecialKey:function(t){return-1!==[17].indexOf(t)}});
@@ -1 +0,0 @@
1
- wdi.PacketFactory={dispose:function(){wdi.Debug.log("Disposing PacketFactory")},extract:function(e){var a=null;switch(e.channel){case wdi.SpiceVars.SPICE_CHANNEL_DISPLAY:if(wdi.graphicDebug&&wdi.graphicDebug.debugMode)var S=JSON.stringify(e);switch(e.header.type){case wdi.SpiceVars.SPICE_MSG_DISPLAY_MODE:break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_MARK:a=(new wdi.SpiceDisplayMark).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_RESET:a=(new wdi.SpiceDisplayReset).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_COPY_BITS:a=(new wdi.SpiceCopyBits).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_INVAL_LIST:a=(new wdi.SpiceResourceList).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS:case wdi.SpiceVars.SPICE_MSG_DISPLAY_INVAL_PALETTE:break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES:a=(new wdi.SpiceDisplayInvalidAllPalettes).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_CREATE:a=(new wdi.SpiceStreamCreate).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_DATA:a=(new wdi.SpiceStreamData).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_CLIP:a=(new wdi.SpiceStreamClip).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_DATA_SIZED:a=(new wdi.SpiceStreamDataSized).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT:a=(new wdi.SpiceStreamActiveReport).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_DESTROY:a=(new wdi.SpiceStreamDestroy).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL:break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_FILL:a=(new wdi.SpiceDrawFill).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_OPAQUE:break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_COPY:a=(new wdi.SpiceDrawCopy).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_BLEND:a=(new wdi.drawBlend).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_BLACKNESS:a=(new wdi.SpiceDrawBlackness).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_WHITENESS:a=(new wdi.SpiceDrawWhiteness).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_INVERS:a=(new wdi.SpiceDrawInvers).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_ROP3:a=(new wdi.SpiceDrawRop3).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_STROKE:a=(new wdi.SpiceStroke).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_TEXT:a=(new wdi.SpiceDrawText).demarshall(e.body,e.header.size);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_TRANSPARENT:a=(new wdi.drawTransparent).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND:a=(new wdi.drawAlphaBlend).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_SURFACE_CREATE:a=(new wdi.SpiceSurface).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_DISPLAY_SURFACE_DESTROY:a=(new wdi.SpiceSurfaceDestroy).demarshall(e.body)}break;case wdi.SpiceVars.SPICE_CHANNEL_INPUTS:switch(e.header.type){case wdi.SpiceVars.SPICE_MSG_INPUTS_MOUSE_MOTION_ACK:a=new Object;break;case wdi.SpiceVars.SPICE_MSG_INPUTS_INIT:const S=new wdi.SpiceModifierData,i=S.demarshall(e.body);S.setModifierData(i.data);break;case wdi.SpiceVars.SPICE_MSG_INPUTS_KEY_MODIFIERS:const d=new wdi.SpiceModifierData,r=d.demarshall(e.body);d.setModifierData(r.data)}break;case wdi.SpiceVars.SPICE_CHANNEL_MAIN:switch(e.header.type){case wdi.SpiceVars.SPICE_MSG_MAIN_INIT:a=(new wdi.RedMainInit).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_MAIN_AGENT_DATA:a=(new wdi.VDAgentMessage).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_MAIN_AGENT_DISCONNECTED:a=(new wdi.SpiceMsgMainAgentDisconnected).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_MAIN_AGENT_CONNECTED:a=(new wdi.SpiceMsgMainAgentConnected).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_MAIN_MULTI_MEDIA_TIME:a=(new wdi.MainMultiMediaTime).demarshall(e.body);break;case wdi.SpiceVars.SPICE_MSG_MAIN_CHANNELS_LIST:a=(new wdi.MainMChannelsList).demarshall(e.body)}break;case wdi.SpiceVars.SPICE_CHANNEL_CURSOR:switch(e.header.type){case wdi.SpiceVars.SPICE_MSG_CURSOR_INIT:a=(new wdi.RedCursorInit).demarshall(e.body,e.header.size);break;case wdi.SpiceVars.SPICE_MSG_CURSOR_SET:a=(new wdi.RedCursorSet).demarshall(e.body,e.header.size);break;case wdi.SpiceVars.SPICE_MSG_CURSOR_HIDE:a=(new wdi.RedCursorHide).demarshall(e.body,e.header.size)}break;case wdi.SpiceVars.SPICE_CHANNEL_PLAYBACK:switch(e.header.type){case wdi.SpiceVars.SPICE_MSG_PLAYBACK_MODE:a=(new wdi.PlaybackMode).demarshall(e.body,e.header.size);break;case wdi.SpiceVars.SPICE_MSG_PLAYBACK_START:a=(new wdi.PlaybackStart).demarshall(e.body,e.header.size);break;case wdi.SpiceVars.SPICE_MSG_PLAYBACK_STOP:a=(new wdi.PlaybackStop).demarshall(e.body,e.header.size);break;case wdi.SpiceVars.SPICE_MSG_PLAYBACK_DATA:a=(new wdi.PlaybackData).demarshall(e.body,e.header.size)}}return a?(wdi.graphicDebug&&wdi.graphicDebug.debugMode&&S&&(a.originalData=S),new wdi.SpiceMessage({messageType:e.header.type,channel:e.channel,args:a})):(wdi.Debug.log(e.header.type,e.header.channel),!1)}};
@@ -1 +0,0 @@
1
- wdi.PacketFilter={restoreContext:!1,start:null,dispose:function(){wdi.Debug.log("Disposing PacketFilter"),this.restoreContext=!1,this.start=null},filter:function(e,t,i,a){if(wdi.logOperations&&(this.start=Date.now()),wdi.graphicDebug&&wdi.graphicDebug.debugMode&&wdi.graphicDebug.printDebugMessageOnFilter(e,a),wdi.IntegrationBenchmark&&wdi.IntegrationBenchmark.benchmarking){var r=new Date;wdi.IntegrationBenchmark.setStartTime(r.getTime())}if(e.args.base&&e.args.base.clip.type===wdi.SpiceClipType.SPICE_CLIP_TYPE_RECTS){var n=a.getContext(e.args.base.surface_id);n.save(),n.beginPath();for(var s=e.args.base.clip.rects.rects,o=s.length;o--;){var g=wdi.graphics.getBoxFromSrcArea(s[o]);n.rect(g.x,g.y,g.width,g.height)}n.clip(),this.restoreContext=e.args.base.surface_id}t.call(i,e)},notifyEnd:function(e,t){!1!==this.restoreContext&&(t.getContext(this.restoreContext).restore(),this.restoreContext=!1);if(wdi.SeamlessIntegration){var i=null;e.args.base&&e.args.base.box&&(i=e.args.base.box),t.fillSubCanvas(i)}if(wdi.graphicDebug&&wdi.graphicDebug.debugMode&&wdi.graphicDebug.printDebugMessageOnNotifyEnd(e,t),wdi.IntegrationBenchmark&&wdi.IntegrationBenchmark.benchmarking){var a=new Date;wdi.IntegrationBenchmark.setEndTime(a.getTime())}wdi.GlobalPool.cleanPool("Canvas"),wdi.GlobalPool.cleanPool("Image"),wdi.logOperations&&wdi.DataLogger.log(e,this.start)}};
@@ -1 +0,0 @@
1
- wdi.PacketProcess=$.spcExtend(wdi.DomainObject,{processors:{},init:function(s){this.processors[wdi.SpiceVars.SPICE_CHANNEL_MAIN]=s.mainProcess||new wdi.MainProcess({app:s.app}),this.processors[wdi.SpiceVars.SPICE_CHANNEL_DISPLAY]=s.displayProcess||new wdi.DisplayPreProcess({clientGui:s.clientGui,disableMessageBuffering:s.disableMessageBuffering}),this.processors[wdi.SpiceVars.SPICE_CHANNEL_INPUTS]=s.inputsProcess||new wdi.InputProcess({clientGui:s.clientGui,spiceConnection:s.spiceConnection}),this.processors[wdi.SpiceVars.SPICE_CHANNEL_CURSOR]=s.cursorProcess||new wdi.CursorProcess,this.processors[wdi.SpiceVars.SPICE_CHANNEL_PLAYBACK]=s.playbackProcess||new wdi.PlaybackProcess({app:s.app})},process:function(s){return wdi.exceptionHandling?this.processExceptionHandled(s):this.processPacket(s)},processExceptionHandled:function(s){try{return this.processPacket(s)}catch(s){wdi.Debug.error("PacketProcess: Error processing packet",s)}},processPacket:function(s){if(!s||!this.processors[s.channel])throw"Invalid channel or null message";this.processors[s.channel].process(s)},dispose:function(){wdi.Debug.log("Disposing PacketProcess all processors"),this.processors[wdi.SpiceVars.SPICE_CHANNEL_MAIN].dispose(),this.processors[wdi.SpiceVars.SPICE_CHANNEL_DISPLAY].dispose(),this.processors[wdi.SpiceVars.SPICE_CHANNEL_INPUTS].dispose(),this.processors[wdi.SpiceVars.SPICE_CHANNEL_CURSOR].dispose(),this.processors[wdi.SpiceVars.SPICE_CHANNEL_PLAYBACK].dispose(),this.processors={}}});
@@ -1 +0,0 @@
1
- wdi.RasterOperation={dispose:function(){wdi.Debug.log("Disposing RasterOperation")},process:function(i,t,e){var a=null;return i&wdi.SpiceRopd.SPICE_ROPD_INVERS_SRC||i&wdi.SpiceRopd.SPICE_ROPD_INVERS_BRUSH?t=this.invert(t):i&wdi.SpiceRopd.SPICE_ROPD_INVERS_DEST&&(e=this.invert(e)),i&wdi.SpiceRopd.SPICE_ROPD_OP_PUT?t:(i&wdi.SpiceRopd.SPICE_ROPD_OP_OR?a=this.boolOp(t,e,"or"):i&wdi.SpiceRopd.SPICE_ROPD_OP_AND?a=this.boolOp(t,e,"and"):i&wdi.SpiceRopd.SPICE_ROPD_OP_XOR?a=this.boolOp(t,e,"xor"):i&wdi.SpiceRopd.SPICE_ROPD_OP_BLACKNESS?a=this.lightness(e,"b"):i&wdi.SpiceRopd.SPICE_ROPD_OP_WHITENESS?a=this.lightness(e):i&wdi.SpiceRopd.SPICE_ROPD_OP_INVERS&&(a=this.invert(e)),i&wdi.SpiceRopd.SPICE_ROPD_INVERS_RES?this.invert(a):a)},flip:function(i){return i=wdi.Flipper.flip(i)},invert:function(i){return i=$(i).pixastic("invert")[0]},lightness:function(i,t){t="b"===t?-100:100;return i=$(i).pixastic("hsl",{hue:30,saturation:20,lightness:t})[0]},boolOp:function(i,t,e){var a=wdi.graphics.getDataFromImage(i).data,o=wdi.graphics.getDataFromImage(t).data,p=a.length-1,d=wdi.graphics.getNewTmpCanvas(i.width,i.height),r=d.getContext("2d"),n=r.createImageData(i.width,i.height),s=n.data;if("or"===e)for(;p>0;)n.data[p]=255,s[p-1]=a[p-1]|o[p-1],s[p-2]=a[p-2]|o[p-2],s[p-3]=a[p-3]|o[p-3],p-=4;else if("and"===e)for(;p>0;)n.data[p]=255,s[p-1]=a[p-1]&o[p-1],s[p-2]=a[p-2]&o[p-2],s[p-3]=a[p-3]&o[p-3],p-=4;else if("xor"===e)for(;p>0;)n.data[p]=255,s[p-1]=a[p-1]^o[p-1],s[p-2]=a[p-2]^o[p-2],s[p-3]=a[p-3]^o[p-3],p-=4;return r.putImageData(n,0,0),d}};
@@ -1 +0,0 @@
1
- wdi.SpiceConnection=$.spcExtend(wdi.EventObject.prototype,{channels:null,connectionId:null,connectionInfo:null,runQ:null,token:null,connectionControl:null,init:function(n){this.superInit(),this.channels={},this.channels[wdi.SpiceVars.SPICE_CHANNEL_MAIN]=n.mainChannel||new wdi.SpiceChannel,this.channels[wdi.SpiceVars.SPICE_CHANNEL_DISPLAY]=n.displayChannel||new wdi.SpiceChannel,this.channels[wdi.SpiceVars.SPICE_CHANNEL_INPUTS]=n.inputsChannel||new wdi.SpiceChannel,this.channels[wdi.SpiceVars.SPICE_CHANNEL_CURSOR]=n.cursorChannel||new wdi.SpiceChannel,this.channels[wdi.SpiceVars.SPICE_CHANNEL_PLAYBACK]=n.playbackChannel||new wdi.SpiceChannel,this.runQ=n.runQ||new wdi.RunQueue,this.connectionControl=n.connectionControl||new wdi.ConnectionControl,this.setup()},connect:function(n){this.connectionInfo=n,n.connectionControl&&this.connectionControl.connect(n),this.channels[wdi.SpiceVars.SPICE_CHANNEL_MAIN].connect(this.connectionInfo,wdi.SpiceVars.SPICE_CHANNEL_MAIN)},disconnect:function(){for(var n in wdi.Debug.log("spiceConnection disconnect"),this.runQ.clear(),this.clearEvents(),this.channels)this.channels[n].disconnect(),this.channels[n].clearEvents(),this.channels[n]=null,delete this.channels[n];this.connectionControl.disconnect(),this.runQ=null,this.token=null,this.channels=null,this.connectionId=null,this.connectionInfo=null,this.connectionControl=null},send:function(n){var e=n.args.marshall();this.channels[n.channel]?this.channels[n.channel].sendObject(e,n.messageType):console.error("channel not available",n.channel)},setup:function(){this.channels[wdi.SpiceVars.SPICE_CHANNEL_MAIN].addListener("connectionId",this.onConnectionId,this),this.channels[wdi.SpiceVars.SPICE_CHANNEL_MAIN].addListener("channelListAvailable",this.onChannelList,this),this.channels[wdi.SpiceVars.SPICE_CHANNEL_MAIN].addListener("mouseMode",this.onMouseMode,this),this.channels[wdi.SpiceVars.SPICE_CHANNEL_MAIN].addListener("initAgent",this.onInitAgent,this),this.channels[wdi.SpiceVars.SPICE_CHANNEL_MAIN].addListener("notify",this.onNotify,this),this.connectionControl.addListener("connectionLost",this.onDisconnect,this),this._setConnectedListeners();var n=null;for(var e in n=wdi.exceptionHandling?this.onChannelMessageExceptionHandled:this.processChannelMessage,this.channels)this.channels.hasOwnProperty(e)&&(this.channels[e].addListener("message",n,this),this.channels[e].addListener("status",this.onStatus,this),this.channels[e].addListener("error",this.onDisconnect,this))},_setConnectedListeners:function(){this._setConnectedListener(wdi.SpiceVars.SPICE_CHANNEL_MAIN),this._setConnectedListener(wdi.SpiceVars.SPICE_CHANNEL_DISPLAY),this._setConnectedListener(wdi.SpiceVars.SPICE_CHANNEL_INPUTS),this._setConnectedListener(wdi.SpiceVars.SPICE_CHANNEL_CURSOR),this._setConnectedListener(wdi.SpiceVars.SPICE_CHANNEL_PLAYBACK)},_setConnectedListener:function(n){this.channels[n].addListener("channelConnected",(function(){this.fire("channelConnected",n)}),this)},onDisconnect:function(n){this.fire("error",n)},onConnectionId:function(n){this.connectionId=n},onChannelList:function(n){this.connectChannels(n)},connectChannels:function(n){for(var e in this.channels)(e=parseInt(e,10))!=wdi.SpiceVars.SPICE_CHANNEL_MAIN&&-1!=n.indexOf(e)&&this.runQ.add((function(n,e){this.channels[e].connect(this.connectionInfo,e,this.connectionId,n)}),this,!1,e);this.runQ.process()},onInitAgent:function(n){var e=n;this.fire("initAgent",e)},onMouseMode:function(n){var e=n;this.fire("mouseMode",e)},onNotify:function(n){this.fire("notify")},onStatus:function(n){},onChannelMessageExceptionHandled:function(n){try{return this.processChannelMessage(n)}catch(n){wdi.Debug.error("SpiceConnection: Packet decodification error",n)}},processChannelMessage:function(n){var e=wdi.PacketFactory.extract(n);wdi.GlobalPool.discard("ViewQueue",n.body),wdi.GlobalPool.discard("RawSpiceMessage",n),e?this.fire("message",e):(wdi.Debug.log("Unknown packet "+n.channel+" "+n.header.type),wdi.Debug.log(n))}});
@@ -1 +0,0 @@
1
- wdi.Stream={streams:{},dispose:function(){wdi.Debug.log("Disposing Stream"),this.streams={}},addStream:function(s,t){this.streams[s]=t},deleteStream:function(s){this.streams[s]=void 0},getStream:function(s){return this.streams[s]},clip:function(s,t){this.streams[s].clip=t},startTransition:function(s){this.streams[s].transiting=!0},endTransition:function(s){this.streams[s].transiting=!1},setReady:function(s){this.streams[s].ready=!0},addQueue:function(s,t){this.streams[s].queues||(this.streams[s].queues=[]),this.streams[s].queues.push(t)},resetQueues:function(s){this.streams[s].queues=[]}};
@@ -1 +0,0 @@
1
- wdi.VirtualMouse={eventLayers:[],mouseData:null,visible:null,lastLayer:null,hotspot:{x:0,y:0},lastMousePosition:{x:0,y:0,width:0,height:0},dispose:function(){wdi.Debug.log("Disposing VirtualMouse"),this.eventLayers=[],this.mouseData=null,this.visible=null,this.lastLayer=null,this.hotspot={x:0,y:0},this.lastMousePosition={x:0,y:0,width:0,height:0}},setHotspot:function(t,e){this.hotspot.x=t,this.hotspot.y=e},setEventLayer:function(t,e,s,i,o,n){this.eventLayers.push({layer:t,left:e,top:s,right:e+i,bottom:s+o,position:n})},removeEventLayer:function(t){for(var e=this.eventLayers.length,s=0;s<e;s++)this.eventLayers[s].layer.id===t.id&&(this.eventLayers[t.id]=void 0)},getEventLayer:function(t,e){for(var s=this.eventLayers.length,i=null,o=0;o<s;o++)if(t>=(i=this.eventLayers[o]).left&&t<=i.right&&e>=i.top&&e<=i.bottom)return i.layer},setMouse:function(t,e,s){for(var i=this.eventLayers.length,o=0;o<i;o++)this.eventLayers[o].layer.style.cursor="url("+t+") "+e+" "+s+", default"},hideMouse:function(){for(var t=this.eventLayers.length,e=0;e<t;e++)this.eventLayers[e].layer.style.cursor="none"}};
@@ -1 +0,0 @@
1
- wdi.KeyEvent={isCtrlPressed:function(e){if(!e)throw new Error("isCtrlPressed: No event provided.");var r=e.ctrlKey;return-1!=navigator.platform.indexOf("Mac")&&(r=e.metaKey),r}};
@@ -1 +0,0 @@
1
- wdi.keyShortcutsHandled={CTRLV:0,CTRLC:1},wdi.Keymap={keymap:{},ctrlKeymap:{},ctrlForbiddenKeymap:{},charmap:{},ctrlPressed:!1,capsLock:!1,numLock:!1,isVirtualKeyboard:!1,isVirtualCapsLockOn:!1,twoBytesScanCodes:[91,219,92,220,29,157,93,221,82,210,83,211,75,203,71,201,79,207,72,200,80,208,73,201,81,209,77,205,28,156],loadKeyMap:function(e,t){try{this.keymap=wdi["Keymap"+e.toUpperCase()].getKeymap(),this.ctrlKeymap=wdi["Keymap"+e.toUpperCase()].getCtrlKeymap(),this.ctrlForbiddenKeymap=wdi["Keymap"+e.toUpperCase()].getCtrlForbiddenKeymap(),this.reservedCtrlKeymap=wdi["Keymap"+e.toUpperCase()].getReservedCtrlKeymap(),this.charmap=wdi["KeymapObj"+e.toUpperCase()].getCharmap(),this.stuckKeysHandler=t}catch(e){this.keymap=wdi.KeymapES.getKeymap(),this.ctrlKeymap=wdi.KeymapES.getCtrlKeymap(),this.ctrlForbiddenKeymap=wdi.KeymapES.getCtrlForbiddenKeymap(),this.reservedCtrlKeymap=wdi.KeymapES.getReservedCtrlKeymap(),this.charmap=wdi.KeymapObjES.getCharmap(),this.stuckKeysHandler=t}},isInKeymap:function(e){return void 0!==this.keymap[e]},getScanCodes:function(e){return e.hasScanCode?e.scanCode:this.isForbiddenCombination(e)?[]:this.isGeneratedShortcut(e.type,e.keyCode,e.generated)?this.getScanCodeFromKeyCode(e.keyCode,e.type,this.ctrlKeymap,this.reservedCtrlKeymap):this.handledByCharmap(e.type)&&e.originalEvent?this.getScanCodesFromCharCode(e.originalEvent.code):this.handledByNormalKeyCode(e.type,e.keyCode)?this.getScanCodeFromKeyCode(e.keyCode,e.type,this.keymap):[]},getScanCodeFromKeyCode:function(e,t,r,i){this.controlPressed(e,t);var a=null;if(void 0===(a=e in r?r[e]:i[e]))return[];if(a<256){if("keydown"==t)return[this.makeKeymap(a)];if("keyup"==t)return[this.makeKeymap(128|a)]}else{if("keydown"==t)return[this.makeKeymap(224|a-256<<8)];if("keyup"==t)return[this.makeKeymap(32992|a-256<<8)]}return a},isForbiddenCombination:function(e){var t=e.keyCode,r=(e.type,this.ctrlForbiddenKeymap);return!!(wdi.KeyEvent.isCtrlPressed(e)&&r[t]&&r[t])},controlPressed:function(e,t,r){if(17===e&&(this.ctrlPressed="keydown"===t),!r)return!1;17!==e&&91!==e&&("keydown"===t?wdi.KeyEvent.isCtrlPressed(r)&&(this.ctrlPressed=!0):"keyup"===t&&(wdi.KeyEvent.isCtrlPressed(r)||(this.ctrlPressed=!1)))},handledByCtrlKeyCode:function(e,t,r){if(("keydown"===e||"keyup"===e||"keypress"===e)&&this.ctrlPressed){if("keypress"===e)return!0;if(this.ctrlKeymap[t])return!0;if(r&&this.reservedCtrlKeymap[t])return!0}return!1},isGeneratedShortcut:function(e,t,r){if(("keydown"===e||"keyup"===e||"keypress"===e)&&this.ctrlPressed){if("keypress"===e)return!0;if(this.ctrlKeymap[t])return!0;if(r&&this.reservedCtrlKeymap[t])return!0}return!1},handledByNormalKeyCode:function(e,t){return!("keydown"!==e&&"keyup"!==e||!this.keymap[t])},handledByCharmap:function(e){return"inputmanager"===e},getScanCodesFromCharCode:function(e){var t=this.charmap[e];return new wdi.ScanCodeObjModifier(t).getScanCode()},makeKeymap:function(e){return-1!=$.inArray(e,this.twoBytesScanCodes)?[224,e,0,0]:[e,0,0]}};