=0?b:-1,m-b,t),b=m,e.flush_pending()}function dt(){let t,n,i,r;do{if(r=c-v-m,0===r&&0===m&&0===v)r=a;else if(-1==r)r--;else if(m>=a+a-262){l.set(l.subarray(a,a+a),0),k-=a,m-=a,b-=a,t=_,i=t;do{n=65535&f[--i],f[i]=n>=a?n-a:0}while(0!=--t);t=a,i=t;do{n=65535&d[--i],d[i]=n>=a?n-a:0}while(0!=--t);r+=a}if(0===e.avail_in)return;t=e.read_buf(l,m+v,r),v+=t,v>=3&&(u=255&l[m],u=(u<a-262?m-(a-262):0;let f=S;const u=o,_=m+258;let h=l[r+s-1],w=l[r+s];A>=R&&(i>>=2),f>v&&(f=v);do{if(e=t,l[e+s]==w&&l[e+s-1]==h&&l[e]==l[r]&&l[++e]==l[r+1]){r+=2,e++;do{}while(l[++r]==l[++e]&&l[++r]==l[++e]&&l[++r]==l[++e]&&l[++r]==l[++e]&&l[++r]==l[++e]&&l[++r]==l[++e]&&l[++r]==l[++e]&&l[++r]==l[++e]&&r<_);if(n=258-(_-r),r=_-258,n>s){if(k=t,s=n,n>=f)break;h=l[r+s-1],w=l[r+s]}}}while((t=65535&d[t&u])>c&&0!=--i);return s<=v?s:v}function ut(e){return e.total_in=e.total_out=0,e.msg=null,t.pending=0,t.pending_out=0,n=113,r=0,M.dyn_tree=F,M.stat_desc=L.static_l_desc,C.dyn_tree=T,C.stat_desc=L.static_d_desc,B.dyn_tree=I,B.stat_desc=L.static_bl_desc,Z=0,Y=0,G=8,X(),function(){c=2*a,f[_-1]=0;for(let t=0;t<_-1;t++)f[t]=0;U=P[z].max_lazy,R=P[z].good_length,S=P[z].nice_length,E=P[z].max_chain,m=0,b=0,v=0,g=A=2,y=0,u=0}(),0}t.depth=[],t.bl_count=[],t.heap=[],F=[],T=[],I=[],t.pqdownheap=function(e,n){const i=t.heap,r=i[n];let a=n<<1;for(;a<=t.heap_len&&(a9||8!=c||r<9||r>15||n<0||n>9||b<0||b>2?-2:(e.dstate=t,s=r,a=1<9||n<0||n>2?-2:(P[z].func!=P[e].func&&0!==t.total_in&&(i=t.deflate(1)),z!=e&&(z=e,U=P[z].max_lazy,R=P[z].good_length,S=P[z].nice_length,E=P[z].max_chain),D=n,i)},t.deflateSetDictionary=function(t,e,i){let r,s=i,c=0;if(!e||42!=n)return-2;if(s<3)return 0;for(s>a-262&&(s=a-262,c=i-s),l.set(e.subarray(c,c+s),0),m=s,b=s,u=255&l[0],u=(u<4||h<0)return-2;if(!c.next_out||!c.next_in&&0!==c.avail_in||666==n&&4!=h)return c.msg=N[4],-2;if(0===c.avail_out)return c.msg=N[7],-5;var I;if(e=c,F=r,r=h,42==n&&(R=8+(s-8<<4)<<8,S=(z-1&255)>>1,S>3&&(S=3),R|=S<<6,0!==m&&(R|=32),R+=31-R%31,n=113,Q((I=R)>>8&255),Q(255&I)),0!==t.pending){if(e.flush_pending(),0===e.avail_out)return r=-1,0}else if(0===e.avail_in&&h<=F&&4!=h)return e.msg=N[7],-5;if(666==n&&0!==e.avail_in)return c.msg=N[7],-5;if(0!==e.avail_in||0!==v||0!=h&&666!=n){switch(T=-1,P[z].func){case 0:T=function(t){let n,r=65535;for(r>i-5&&(r=i-5);;){if(v<=1){if(dt(),0===v&&0==t)return 0;if(0===v)break}if(m+=v,v=0,n=b+r,(0===m||m>=n)&&(v=m-n,m=n,ct(!1),0===e.avail_out))return 0;if(m-b>=a-262&&(ct(!1),0===e.avail_out))return 0}return ct(4==t),0===e.avail_out?4==t?2:0:4==t?3:1}(h);break;case 1:T=function(t){let n,i=0;for(;;){if(v<262){if(dt(),v<262&&0==t)return 0;if(0===v)break}if(v>=3&&(u=(u<
=3)if(n=rt(m-k,g-3),v-=g,g<=U&&v>=3){g--;do{m++,u=(u<
=3&&(u=(u<
4096)&&(g=2)),A>=3&&g<=A){i=m+v-3,n=rt(m-1-x,A-3),v-=A-1,A-=2;do{++m<=i&&(u=(u<
0&&e.next_in_index!=o&&(i(e.next_in_index),o=e.next_in_index)}while(e.avail_in>0||0===e.avail_out);return d.length>1?(s=new Uint8Array(c),d.forEach((function(t){s.set(t,l),l+=t.length}))):s=d[0]||new Uint8Array(0),s}},this.flush=function(){let t,i,a=0,s=0;const o=[];do{if(e.next_out_index=0,e.avail_out=n,t=e.deflate(4),1!=t&&0!=t)throw new Error(\"deflating: \"+e.msg);n-e.avail_out>0&&o.push(r.slice(0,e.next_out_index)),s+=e.next_out_index}while(e.avail_in>0||0===e.avail_out);return e.deflateEnd(),i=new Uint8Array(s),o.forEach((function(t){i.set(t,a),a+=t.length})),i}}q.prototype={deflateInit:function(t,e){const n=this;return n.dstate=new V,e||(e=15),n.dstate.deflateInit(n,t,e)},deflate:function(t){const e=this;return e.dstate?e.dstate.deflate(e,t):-2},deflateEnd:function(){const t=this;if(!t.dstate)return-2;const e=t.dstate.deflateEnd();return t.dstate=null,e},deflateParams:function(t,e){const n=this;return n.dstate?n.dstate.deflateParams(n,t,e):-2},deflateSetDictionary:function(t,e){const n=this;return n.dstate?n.dstate.deflateSetDictionary(n,t,e):-2},read_buf:function(t,e,n){const i=this;let r=i.avail_in;return r>n&&(r=n),0===r?0:(i.avail_in-=r,t.set(i.next_in.subarray(i.next_in_index,i.next_in_index+r),e),i.next_in_index+=r,i.total_in+=r,r)},flush_pending:function(){const t=this;let e=t.dstate.pending;e>t.avail_out&&(e=t.avail_out),0!==e&&(t.next_out.set(t.dstate.pending_buf.subarray(t.dstate.pending_out,t.dstate.pending_out+e),t.next_out_index),t.next_out_index+=e,t.dstate.pending_out+=e,t.total_out+=e,t.avail_out-=e,t.dstate.pending-=e,0===t.dstate.pending&&(t.dstate.pending_out=0))}};const G=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],Z=[96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,192,80,7,10,0,8,96,0,8,32,0,9,160,0,8,0,0,8,128,0,8,64,0,9,224,80,7,6,0,8,88,0,8,24,0,9,144,83,7,59,0,8,120,0,8,56,0,9,208,81,7,17,0,8,104,0,8,40,0,9,176,0,8,8,0,8,136,0,8,72,0,9,240,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,200,81,7,13,0,8,100,0,8,36,0,9,168,0,8,4,0,8,132,0,8,68,0,9,232,80,7,8,0,8,92,0,8,28,0,9,152,84,7,83,0,8,124,0,8,60,0,9,216,82,7,23,0,8,108,0,8,44,0,9,184,0,8,12,0,8,140,0,8,76,0,9,248,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,196,81,7,11,0,8,98,0,8,34,0,9,164,0,8,2,0,8,130,0,8,66,0,9,228,80,7,7,0,8,90,0,8,26,0,9,148,84,7,67,0,8,122,0,8,58,0,9,212,82,7,19,0,8,106,0,8,42,0,9,180,0,8,10,0,8,138,0,8,74,0,9,244,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,204,81,7,15,0,8,102,0,8,38,0,9,172,0,8,6,0,8,134,0,8,70,0,9,236,80,7,9,0,8,94,0,8,30,0,9,156,84,7,99,0,8,126,0,8,62,0,9,220,82,7,27,0,8,110,0,8,46,0,9,188,0,8,14,0,8,142,0,8,78,0,9,252,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,194,80,7,10,0,8,97,0,8,33,0,9,162,0,8,1,0,8,129,0,8,65,0,9,226,80,7,6,0,8,89,0,8,25,0,9,146,83,7,59,0,8,121,0,8,57,0,9,210,81,7,17,0,8,105,0,8,41,0,9,178,0,8,9,0,8,137,0,8,73,0,9,242,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,202,81,7,13,0,8,101,0,8,37,0,9,170,0,8,5,0,8,133,0,8,69,0,9,234,80,7,8,0,8,93,0,8,29,0,9,154,84,7,83,0,8,125,0,8,61,0,9,218,82,7,23,0,8,109,0,8,45,0,9,186,0,8,13,0,8,141,0,8,77,0,9,250,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,198,81,7,11,0,8,99,0,8,35,0,9,166,0,8,3,0,8,131,0,8,67,0,9,230,80,7,7,0,8,91,0,8,27,0,9,150,84,7,67,0,8,123,0,8,59,0,9,214,82,7,19,0,8,107,0,8,43,0,9,182,0,8,11,0,8,139,0,8,75,0,9,246,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,206,81,7,15,0,8,103,0,8,39,0,9,174,0,8,7,0,8,135,0,8,71,0,9,238,80,7,9,0,8,95,0,8,31,0,9,158,84,7,99,0,8,127,0,8,63,0,9,222,82,7,27,0,8,111,0,8,47,0,9,190,0,8,15,0,8,143,0,8,79,0,9,254,96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,193,80,7,10,0,8,96,0,8,32,0,9,161,0,8,0,0,8,128,0,8,64,0,9,225,80,7,6,0,8,88,0,8,24,0,9,145,83,7,59,0,8,120,0,8,56,0,9,209,81,7,17,0,8,104,0,8,40,0,9,177,0,8,8,0,8,136,0,8,72,0,9,241,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,201,81,7,13,0,8,100,0,8,36,0,9,169,0,8,4,0,8,132,0,8,68,0,9,233,80,7,8,0,8,92,0,8,28,0,9,153,84,7,83,0,8,124,0,8,60,0,9,217,82,7,23,0,8,108,0,8,44,0,9,185,0,8,12,0,8,140,0,8,76,0,9,249,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,197,81,7,11,0,8,98,0,8,34,0,9,165,0,8,2,0,8,130,0,8,66,0,9,229,80,7,7,0,8,90,0,8,26,0,9,149,84,7,67,0,8,122,0,8,58,0,9,213,82,7,19,0,8,106,0,8,42,0,9,181,0,8,10,0,8,138,0,8,74,0,9,245,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,205,81,7,15,0,8,102,0,8,38,0,9,173,0,8,6,0,8,134,0,8,70,0,9,237,80,7,9,0,8,94,0,8,30,0,9,157,84,7,99,0,8,126,0,8,62,0,9,221,82,7,27,0,8,110,0,8,46,0,9,189,0,8,14,0,8,142,0,8,78,0,9,253,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,195,80,7,10,0,8,97,0,8,33,0,9,163,0,8,1,0,8,129,0,8,65,0,9,227,80,7,6,0,8,89,0,8,25,0,9,147,83,7,59,0,8,121,0,8,57,0,9,211,81,7,17,0,8,105,0,8,41,0,9,179,0,8,9,0,8,137,0,8,73,0,9,243,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,203,81,7,13,0,8,101,0,8,37,0,9,171,0,8,5,0,8,133,0,8,69,0,9,235,80,7,8,0,8,93,0,8,29,0,9,155,84,7,83,0,8,125,0,8,61,0,9,219,82,7,23,0,8,109,0,8,45,0,9,187,0,8,13,0,8,141,0,8,77,0,9,251,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,199,81,7,11,0,8,99,0,8,35,0,9,167,0,8,3,0,8,131,0,8,67,0,9,231,80,7,7,0,8,91,0,8,27,0,9,151,84,7,67,0,8,123,0,8,59,0,9,215,82,7,19,0,8,107,0,8,43,0,9,183,0,8,11,0,8,139,0,8,75,0,9,247,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,207,81,7,15,0,8,103,0,8,39,0,9,175,0,8,7,0,8,135,0,8,71,0,9,239,80,7,9,0,8,95,0,8,31,0,9,159,84,7,99,0,8,127,0,8,63,0,9,223,82,7,27,0,8,111,0,8,47,0,9,191,0,8,15,0,8,143,0,8,79,0,9,255],Y=[80,5,1,87,5,257,83,5,17,91,5,4097,81,5,5,89,5,1025,85,5,65,93,5,16385,80,5,3,88,5,513,84,5,33,92,5,8193,82,5,9,90,5,2049,86,5,129,192,5,24577,80,5,2,87,5,385,83,5,25,91,5,6145,81,5,7,89,5,1537,85,5,97,93,5,24577,80,5,4,88,5,769,84,5,49,92,5,12289,82,5,13,90,5,3073,86,5,193,192,5,24577],X=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],J=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,112,112],Q=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],$=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];function tt(){let t,e,n,i,r,a;function s(t,e,s,o,l,c,d,f,u,_,h){let w,p,b,g,x,y,m,k,v,A,E,U,z,D,R;A=0,x=s;do{n[t[e+A]]++,A++,x--}while(0!==x);if(n[0]==s)return d[0]=-1,f[0]=0,0;for(k=f[0],y=1;y<=15&&0===n[y];y++);for(m=y,kx&&(k=x),f[0]=k,D=1<U+k;){if(g++,U+=k,R=b-U,R=R>k?k:R,(p=1<<(y=m-U))>w+1&&(p-=w+1,z=m,y1440)return-3;r[g]=E=_[0],_[0]+=R,0!==g?(a[g]=x,i[0]=y,i[1]=k,y=x>>>U-k,i[2]=E-r[g-1]-y,u.set(i,3*(r[g-1]+y))):d[0]=E}for(i[1]=m-U,A>=s?i[0]=192:h[A]>>U;y>>=1)x^=y;for(x^=y,v=(1<257?(-3==_?u.msg=\"oversubscribed distance tree\":-5==_?(u.msg=\"incomplete distance tree\",_=-3):-4!=_&&(u.msg=\"empty distance tree with lengths\",_=-3),_):0)}}function et(){const t=this;let e,n,i,r,a=0,s=0,o=0,l=0,c=0,d=0,f=0,u=0,_=0,h=0;function w(t,e,n,i,r,a,s,o){let l,c,d,f,u,_,h,w,p,b,g,x,y,m,k,v;h=o.next_in_index,w=o.avail_in,u=s.bitb,_=s.bitk,p=s.write,b=p>=c[v+1],_-=c[v+1],0!=(16&f)){for(f&=15,y=c[v+2]+(u&G[f]),u>>=f,_-=f;_<15;)w--,u|=(255&o.read_byte(h++))<<_,_+=8;for(l=u&x,c=r,d=a,v=3*(d+l),f=c[v];;){if(u>>=c[v+1],_-=c[v+1],0!=(16&f)){for(f&=15;_>=f,_-=f,b-=y,p>=m)k=p-m,p-k>0&&2>p-k?(s.window[p++]=s.window[k++],s.window[p++]=s.window[k++],y-=2):(s.window.set(s.window.subarray(k,k+2),p),p+=2,k+=2,y-=2);else{k=p-m;do{k+=s.end}while(k<0);if(f=s.end-k,y>f){if(y-=f,p-k>0&&f>p-k)do{s.window[p++]=s.window[k++]}while(0!=--f);else s.window.set(s.window.subarray(k,k+f),p),p+=f,k+=f,f=0;k=0}}if(p-k>0&&y>p-k)do{s.window[p++]=s.window[k++]}while(0!=--y);else s.window.set(s.window.subarray(k,k+y),p),p+=y,k+=y,y=0;break}if(0!=(64&f))return o.msg=\"invalid distance code\",y=o.avail_in-w,y=_>>3>3:y,w+=y,h-=y,_-=y<<3,s.bitb=u,s.bitk=_,o.avail_in=w,o.total_in+=h-o.next_in_index,o.next_in_index=h,s.write=p,-3;l+=c[v+2],l+=u&G[f],v=3*(d+l),f=c[v]}break}if(0!=(64&f))return 0!=(32&f)?(y=o.avail_in-w,y=_>>3>3:y,w+=y,h-=y,_-=y<<3,s.bitb=u,s.bitk=_,o.avail_in=w,o.total_in+=h-o.next_in_index,o.next_in_index=h,s.write=p,1):(o.msg=\"invalid literal/length code\",y=o.avail_in-w,y=_>>3>3:y,w+=y,h-=y,_-=y<<3,s.bitb=u,s.bitk=_,o.avail_in=w,o.total_in+=h-o.next_in_index,o.next_in_index=h,s.write=p,-3);if(l+=c[v+2],l+=u&G[f],v=3*(d+l),0===(f=c[v])){u>>=c[v+1],_-=c[v+1],s.window[p++]=c[v+2],b--;break}}else u>>=c[v+1],_-=c[v+1],s.window[p++]=c[v+2],b--}while(b>=258&&w>=10);return y=o.avail_in-w,y=_>>3>3:y,w+=y,h-=y,_-=y<<3,s.bitb=u,s.bitk=_,o.avail_in=w,o.total_in+=h-o.next_in_index,o.next_in_index=h,s.write=p,0}t.init=function(t,a,s,o,l,c){e=0,f=t,u=a,i=s,_=o,r=l,h=c,n=null},t.proc=function(t,p,b){let g,x,y,m,k,v,A,E=0,U=0,z=0;for(z=p.next_in_index,m=p.avail_in,E=t.bitb,U=t.bitk,k=t.write,v=k=258&&m>=10&&(t.bitb=E,t.bitk=U,p.avail_in=m,p.total_in+=z-p.next_in_index,p.next_in_index=z,t.write=k,b=w(f,u,i,_,r,h,t,p),z=p.next_in_index,m=p.avail_in,E=t.bitb,U=t.bitk,k=t.write,v=k>>=n[x+1],U-=n[x+1],y=n[x],0===y){l=n[x+2],e=6;break}if(0!=(16&y)){c=15&y,a=n[x+2],e=2;break}if(0==(64&y)){o=y,s=x/3+n[x+2];break}if(0!=(32&y)){e=7;break}return e=9,p.msg=\"invalid literal/length code\",b=-3,t.bitb=E,t.bitk=U,p.avail_in=m,p.total_in+=z-p.next_in_index,p.next_in_index=z,t.write=k,t.inflate_flush(p,b);case 2:for(g=c;U>=g,U-=g,o=u,n=r,s=h,e=3;case 3:for(g=o;U>=n[x+1],U-=n[x+1],y=n[x],0!=(16&y)){c=15&y,d=n[x+2],e=4;break}if(0==(64&y)){o=y,s=x/3+n[x+2];break}return e=9,p.msg=\"invalid distance code\",b=-3,t.bitb=E,t.bitk=U,p.avail_in=m,p.total_in+=z-p.next_in_index,p.next_in_index=z,t.write=k,t.inflate_flush(p,b);case 4:for(g=c;U>=g,U-=g,e=5;case 5:for(A=k-d;A<0;)A+=t.end;for(;0!==a;){if(0===v&&(k==t.end&&0!==t.read&&(k=0,v=k7&&(U-=8,m++,z--),t.write=k,b=t.inflate_flush(p,b),k=t.write,v=kt.avail_out&&(i=t.avail_out),0!==i&&-5==e&&(e=0),t.avail_out-=i,t.total_out+=i,t.next_out.set(n.window.subarray(a,a+i),r),r+=i,a+=i,a==n.end&&(a=0,n.write==n.end&&(n.write=0),i=n.write-a,i>t.avail_out&&(i=t.avail_out),0!==i&&-5==e&&(e=0),t.avail_out-=i,t.total_out+=i,t.next_out.set(n.window.subarray(a,a+i),r),r+=i,a+=i),t.next_out_index=r,n.read=a,e},n.proc=function(t,e){let h,w,p,b,g,x,y,m;for(b=t.next_in_index,g=t.avail_in,w=n.bitb,p=n.bitk,x=n.write,y=x>>1){case 0:w>>>=3,p-=3,h=7&p,w>>>=h,p-=h,r=1;break;case 1:k=[],v=[],A=[[]],E=[[]],tt.inflate_trees_fixed(k,v,A,E),d.init(k[0],v[0],A[0],0,E[0],0),w>>>=3,p-=3,r=6;break;case 2:w>>>=3,p-=3,r=3;break;case 3:return w>>>=3,p-=3,r=9,t.msg=\"invalid block type\",e=-3,n.bitb=w,n.bitk=p,t.avail_in=g,t.total_in+=b-t.next_in_index,t.next_in_index=b,n.write=x,n.inflate_flush(t,e)}break;case 1:for(;p<32;){if(0===g)return n.bitb=w,n.bitk=p,t.avail_in=g,t.total_in+=b-t.next_in_index,t.next_in_index=b,n.write=x,n.inflate_flush(t,e);e=0,g--,w|=(255&t.read_byte(b++))<>>16&65535)!=(65535&w))return r=9,t.msg=\"invalid stored block lengths\",e=-3,n.bitb=w,n.bitk=p,t.avail_in=g,t.total_in+=b-t.next_in_index,t.next_in_index=b,n.write=x,n.inflate_flush(t,e);a=65535&w,w=p=0,r=0!==a?2:0!==f?7:0;break;case 2:if(0===g)return n.bitb=w,n.bitk=p,t.avail_in=g,t.total_in+=b-t.next_in_index,t.next_in_index=b,n.write=x,n.inflate_flush(t,e);if(0===y&&(x==n.end&&0!==n.read&&(x=0,y=xg&&(h=g),h>y&&(h=y),n.window.set(t.read_buf(b,h),x),b+=h,g-=h,x+=h,y-=h,0!=(a-=h))break;r=0!==f?7:0;break;case 3:for(;p<14;){if(0===g)return n.bitb=w,n.bitk=p,t.avail_in=g,t.total_in+=b-t.next_in_index,t.next_in_index=b,n.write=x,n.inflate_flush(t,e);e=0,g--,w|=(255&t.read_byte(b++))<29||(h>>5&31)>29)return r=9,t.msg=\"too many length or distance symbols\",e=-3,n.bitb=w,n.bitk=p,t.avail_in=g,t.total_in+=b-t.next_in_index,t.next_in_index=b,n.write=x,n.inflate_flush(t,e);if(h=258+(31&h)+(h>>5&31),!i||i.length>>=14,p-=14,o=0,r=4;case 4:for(;o<4+(s>>>10);){for(;p<3;){if(0===g)return n.bitb=w,n.bitk=p,t.avail_in=g,t.total_in+=b-t.next_in_index,t.next_in_index=b,n.write=x,n.inflate_flush(t,e);e=0,g--,w|=(255&t.read_byte(b++))<>>=3,p-=3}for(;o<19;)i[nt[o++]]=0;if(l[0]=7,h=_.inflate_trees_bits(i,l,c,u,t),0!=h)return-3==(e=h)&&(i=null,r=9),n.bitb=w,n.bitk=p,t.avail_in=g,t.total_in+=b-t.next_in_index,t.next_in_index=b,n.write=x,n.inflate_flush(t,e);o=0,r=5;case 5:for(;h=s,!(o>=258+(31&h)+(h>>5&31));){let a,d;for(h=l[0];p>>=h,p-=h,i[o++]=d;else{for(m=18==d?7:d-14,a=18==d?11:3;p>>=h,p-=h,a+=w&G[m],w>>>=m,p-=m,m=o,h=s,m+a>258+(31&h)+(h>>5&31)||16==d&&m<1)return i=null,r=9,t.msg=\"invalid bit length repeat\",e=-3,n.bitb=w,n.bitk=p,t.avail_in=g,t.total_in+=b-t.next_in_index,t.next_in_index=b,n.write=x,n.inflate_flush(t,e);d=16==d?i[m-1]:0;do{i[m++]=d}while(0!=--a);o=m}}if(c[0]=-1,U=[],z=[],D=[],R=[],U[0]=9,z[0]=6,h=s,h=_.inflate_trees_dynamic(257+(31&h),1+(h>>5&31),i,U,z,D,R,u,t),0!=h)return-3==h&&(i=null,r=9),e=h,n.bitb=w,n.bitk=p,t.avail_in=g,t.total_in+=b-t.next_in_index,t.next_in_index=b,n.write=x,n.inflate_flush(t,e);d.init(U[0],z[0],u,D[0],u,R[0]),r=6;case 6:if(n.bitb=w,n.bitk=p,t.avail_in=g,t.total_in+=b-t.next_in_index,t.next_in_index=b,n.write=x,1!=(e=d.proc(n,t,e)))return n.inflate_flush(t,e);if(e=0,d.free(t),b=t.next_in_index,g=t.avail_in,w=n.bitb,p=n.bitk,x=n.write,y=x15?(t.inflateEnd(n),-2):(t.wbits=i,n.istate.blocks=new it(n,1<>4)>r.wbits){r.mode=13,t.msg=\"invalid window size\",r.marker=5;break}r.mode=1;case 1:if(0===t.avail_in)return n;if(n=e,t.avail_in--,t.total_in++,i=255&t.read_byte(t.next_in_index++),((r.method<<8)+i)%31!=0){r.mode=13,t.msg=\"incorrect header check\",r.marker=5;break}if(0==(32&i)){r.mode=7;break}r.mode=2;case 2:if(0===t.avail_in)return n;n=e,t.avail_in--,t.total_in++,r.need=(255&t.read_byte(t.next_in_index++))<<24&4278190080,r.mode=3;case 3:if(0===t.avail_in)return n;n=e,t.avail_in--,t.total_in++,r.need+=(255&t.read_byte(t.next_in_index++))<<16&16711680,r.mode=4;case 4:if(0===t.avail_in)return n;n=e,t.avail_in--,t.total_in++,r.need+=(255&t.read_byte(t.next_in_index++))<<8&65280,r.mode=5;case 5:return 0===t.avail_in?n:(n=e,t.avail_in--,t.total_in++,r.need+=255&t.read_byte(t.next_in_index++),r.mode=6,2);case 6:return r.mode=13,t.msg=\"need dictionary\",r.marker=0,-2;case 7:if(n=r.blocks.proc(t,n),-3==n){r.mode=13,r.marker=0;break}if(0==n&&(n=e),1!=n)return n;n=e,r.blocks.reset(t,r.was),r.mode=12;case 12:return 1;case 13:return-3;default:return-2}},t.inflateSetDictionary=function(t,e,n){let i=0,r=n;if(!t||!t.istate||6!=t.istate.mode)return-2;const a=t.istate;return r>=1<0&&e.next_in_index!=c&&(a(e.next_in_index),c=e.next_in_index)}while(e.avail_in>0||0===e.avail_out);return s.length>1?(l=new Uint8Array(f),s.forEach((function(t){l.set(t,d),d+=t.length}))):l=s[0]||new Uint8Array(0),l}},this.flush=function(){e.inflateEnd()}}st.prototype={inflateInit:function(t){const e=this;return e.istate=new at,t||(t=15),e.istate.inflateInit(e,t)},inflate:function(t){const e=this;return e.istate?e.istate.inflate(e,t):-2},inflateEnd:function(){const t=this;if(!t.istate)return-2;const e=t.istate.inflateEnd(t);return t.istate=null,e},inflateSync:function(){const t=this;return t.istate?t.istate.inflateSync(t):-2},inflateSetDictionary:function(t,e){const n=this;return n.istate?n.istate.inflateSetDictionary(n,t,e):-2},read_byte:function(t){return this.next_in[t]},read_buf:function(t,e){return this.next_in.subarray(t,t+e)}},self.initCodec=()=>{self.Deflate=K,self.Inflate=ot}}).toString(),e=URL.createObjectURL(new Blob([\"(\"+t+\")()\"],{type:\"text/javascript\"}));P({workerScripts:{inflate:[e],deflate:[e]}})}})(),P({Deflate:function(t){const e=new g,n=(i=t&&t.chunkSize?t.chunkSize:65536)+5*(Math.floor(i/16383)+1);var i;const r=new Uint8Array(n);let a=t?t.level:-1;void 0===a&&(a=-1),e.deflateInit(a),e.next_out=r,this.append=function(t,i){let a,s,o=0,l=0,c=0;const d=[];if(t.length){e.next_in_index=0,e.next_in=t,e.avail_in=t.length;do{if(e.next_out_index=0,e.avail_out=n,a=e.deflate(0),0!=a)throw new Error(\"deflating: \"+e.msg);e.next_out_index&&(e.next_out_index==n?d.push(new Uint8Array(r)):d.push(r.slice(0,e.next_out_index))),c+=e.next_out_index,i&&e.next_in_index>0&&e.next_in_index!=o&&(i(e.next_in_index),o=e.next_in_index)}while(e.avail_in>0||0===e.avail_out);return d.length>1?(s=new Uint8Array(c),d.forEach((function(t){s.set(t,l),l+=t.length}))):s=d[0]||new Uint8Array(0),s}},this.flush=function(){let t,i,a=0,s=0;const o=[];do{if(e.next_out_index=0,e.avail_out=n,t=e.deflate(4),1!=t&&0!=t)throw new Error(\"deflating: \"+e.msg);n-e.avail_out>0&&o.push(r.slice(0,e.next_out_index)),s+=e.next_out_index}while(e.avail_in>0||0===e.avail_out);return e.deflateEnd(),i=new Uint8Array(s),o.forEach((function(t){i.set(t,a),a+=t.length})),i}},Inflate:function(t){const e=new O,n=t&&t.chunkSize?Math.floor(2*t.chunkSize):131072,i=new Uint8Array(n);let r=!1;e.inflateInit(),e.next_out=i,this.append=function(t,a){const s=[];let o,l,c=0,d=0,f=0;if(0!==t.length){e.next_in_index=0,e.next_in=t,e.avail_in=t.length;do{if(e.next_out_index=0,e.avail_out=n,0!==e.avail_in||r||(e.next_in_index=0,r=!0),o=e.inflate(0),r&&o===m){if(0!==e.avail_in)throw new Error(\"inflating: bad input\")}else if(0!==o&&1!==o)throw new Error(\"inflating: \"+e.msg);if((r||1===o)&&e.avail_in===t.length)throw new Error(\"inflating: bad input\");e.next_out_index&&(e.next_out_index===n?s.push(new Uint8Array(i)):s.push(i.slice(0,e.next_out_index))),f+=e.next_out_index,a&&e.next_in_index>0&&e.next_in_index!=c&&(a(e.next_in_index),c=e.next_in_index)}while(e.avail_in>0||0===e.avail_out);return s.length>1?(l=new Uint8Array(f),s.forEach((function(t){l.set(t,d),d+=t.length}))):l=s[0]||new Uint8Array(0),l}},this.flush=function(){e.inflateEnd()}}}),t.BlobReader=ie,t.BlobWriter=re,t.Data64URIReader=class extends ee{constructor(t){super(),this.dataURI=t;let e=t.length;for(;\"=\"==t.charAt(e-1);)e--;this.dataStart=t.indexOf(\",\")+1,this.size=Math.floor(.75*(e-this.dataStart))}async readUint8Array(t,e){const n=new Uint8Array(e),i=4*Math.floor(t/3),r=atob(this.dataURI.substring(i+this.dataStart,4*Math.ceil((t+e)/3)+this.dataStart)),a=t-3*Math.floor(i/4);for(let t=a;t2?this.data+=btoa(n):this.pending=n}getData(){return this.data+btoa(this.pending)}},t.ERR_ABORT=Nt,t.ERR_BAD_FORMAT=Se,t.ERR_CENTRAL_DIRECTORY_NOT_FOUND=Me,t.ERR_DUPLICATED_NAME=nn,t.ERR_ENCRYPTED=Oe,t.ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND=Ie,t.ERR_EOCDR_NOT_FOUND=Fe,t.ERR_EOCDR_ZIP64_NOT_FOUND=Te,t.ERR_EXTRAFIELD_ZIP64_NOT_FOUND=Be,t.ERR_HTTP_RANGE=Gt,t.ERR_INVALID_COMMENT=rn,t.ERR_INVALID_ENCRYPTION_STRENGTH=ln,t.ERR_INVALID_ENTRY_COMMENT=an,t.ERR_INVALID_ENTRY_NAME=sn,t.ERR_INVALID_EXTRAFIELD_DATA=dn,t.ERR_INVALID_EXTRAFIELD_TYPE=cn,t.ERR_INVALID_PASSWORD=J,t.ERR_INVALID_SIGNATURE=St,t.ERR_INVALID_VERSION=on,t.ERR_LOCAL_FILE_HEADER_NOT_FOUND=Ce,t.ERR_UNSUPPORTED_COMPRESSION=Le,t.ERR_UNSUPPORTED_ENCRYPTION=We,t.ERR_UNSUPPORTED_FORMAT=fn,t.HttpRangeReader=class extends fe{constructor(t,e={}){e.useRangeHeader=!0,super(t,e)}},t.HttpReader=fe,t.Reader=ee,t.TextReader=class extends ee{constructor(t){super(),this.blobReader=new ie(new Blob([t],{type:Zt}))}async init(){super.init(),this.blobReader.init(),this.size=this.blobReader.size}async readUint8Array(t,e){return this.blobReader.readUint8Array(t,e)}},t.TextWriter=class extends ne{constructor(t){super(),this.encoding=t,this.blob=new Blob([],{type:Zt})}async writeUint8Array(t){super.writeUint8Array(t),this.blob=new Blob([this.blob,t.buffer],{type:Zt})}getData(){const t=new FileReader;return new Promise(((e,n)=>{t.onload=t=>e(t.target.result),t.onerror=()=>n(t.error),t.readAsText(this.blob,this.encoding)}))}},t.Uint8ArrayReader=class extends ee{constructor(t){super(),this.array=t,this.size=t.length}async readUint8Array(t,e){return this.array.slice(t,t+e)}},t.Uint8ArrayWriter=class extends ne{constructor(){super(),this.array=new Uint8Array(0)}async writeUint8Array(t){super.writeUint8Array(t);const e=this.array;this.array=new Uint8Array(e.length+t.length),this.array.set(e),this.array.set(t,e.length)}getData(){return this.array}},t.Writer=ne,t.ZipReader=class{constructor(t,e={}){Object.assign(this,{reader:t,options:e,config:H()})}async getEntries(t={}){const e=this,n=e.reader;if(n.initialized||await n.init(),n.size<22)throw new Error(Se);const i=await async function(t,e,n,i,r){const a=new Uint8Array(4);!function(t,e,n){t.setUint32(e,n,!0)}(tn(a),0,e);const s=i+r;return await o(i)||await o(Math.min(s,n));async function o(e){const r=n-e,s=await en(t,r,e);for(let t=s.length-i;t>=0;t--)if(s[t]==a[0]&&s[t+1]==a[1]&&s[t+2]==a[2]&&s[t+3]==a[3])return{offset:r+t,buffer:s.slice(t,t+i).buffer}}}(n,ge,n.size,22,1048560);if(!i)throw new Error(Fe);const r=tn(i);let a=Qe(r,12),s=Qe(r,16),o=Je(r,8),l=0;if(s==_e||o==he){const t=tn(await en(n,i.offset-20,20));if(Qe(t,0)!=ye)throw new Error(Te);s=$e(t,8);let e=await en(n,s,56),r=tn(e);const c=i.offset-20-56;if(Qe(r,0)!=xe&&s!=c){const t=s;s=c,l=s-t,e=await en(n,s,56),r=tn(e)}if(Qe(r,0)!=xe)throw new Error(Ie);o=$e(r,24),a=Qe(t,4),s-=$e(r,40)}if(s<0||s>=n.size)throw new Error(Se);let c=0,d=await en(n,s,n.size-s),f=tn(d);const u=i.offset-a;if(Qe(f,c)!=be&&s!=u){const t=s;s=u,l=s-t,d=await en(n,s,n.size-s),f=tn(d)}if(s<0||s>=n.size)throw new Error(Se);const _=[];for(let i=0;ir.getData(t,g,e),_.push(g),c=b,t.onprogress)try{t.onprogress(i+1,o,new Re(r))}catch(t){}}return _}async close(){}},t.ZipWriter=class{constructor(t,e={}){Object.assign(this,{writer:t,options:e,config:H(),files:new Map,offset:t.size,pendingCompressedSize:0,pendingEntries:[]})}async add(t=\"\",e,n={}){const i=this;if(!(_ni.pendingEntries.push({name:t,reader:e,options:n,resolve:r,reject:a})));_n++;try{return await async function(t,e,n,i){e=e.trim(),i.directory&&!e.endsWith(Ae)?e+=Ae:i.directory=e.endsWith(Ae);if(t.files.has(e))throw new Error(nn);const r=(new TextEncoder).encode(e);if(r.length>he)throw new Error(sn);const a=i.comment||\"\",s=(new TextEncoder).encode(a);if(s.length>he)throw new Error(an);const o=t.options.version||i.version||0;if(o>he)throw new Error(on);const l=t.options.versionMadeBy||i.versionMadeBy||20;if(l>he)throw new Error(on);const c=pn(t,i,\"lastModDate\")||new Date,d=pn(t,i,\"lastAccessDate\"),f=pn(t,i,\"creationDate\"),u=pn(t,i,\"password\"),_=pn(t,i,\"encryptionStrength\")||3,h=pn(t,i,\"zipCrypto\");if(void 0!==u&&void 0!==_&&(_<1||_>3))throw new Error(ln);let w=new Uint8Array(0);const p=i.extraField;if(p){let t=0,e=0;p.forEach((e=>t+=4+e.length)),w=new Uint8Array(t),p.forEach(((t,n)=>{if(n>he)throw new Error(cn);if(t.length>he)throw new Error(dn);mn(w,new Uint16Array([n]),e),mn(w,new Uint16Array([t.length]),e+2),mn(w,t,e+4),e+=4+t.length}))}let b=pn(t,i,\"extendedTimestamp\");void 0===b&&(b=!0);let g=0,x=pn(t,i,\"keepOrder\");void 0===x&&(x=!0);let y=0,m=pn(t,i,\"msDosCompatible\");void 0===m&&(m=!0);const k=pn(t,i,\"internalFileAttribute\")||0,v=pn(t,i,\"externalFileAttribute\")||0;n&&(n.initialized||await n.init(),y=n.size,g=function(t){return t+5*(Math.floor(t/16383)+1)}(y));let A=i.zip64||t.options.zip64||!1;if(t.offset+t.pendingCompressedSize>=_e||y>=_e||g>=_e){if(!1===i.zip64||!1===t.options.zip64||!x)throw new Error(fn);A=!0}t.pendingCompressedSize+=g,await Promise.resolve();const E=pn(t,i,\"level\"),U=pn(t,i,\"useWebWorkers\"),z=pn(t,i,\"bufferedWrite\");let D=pn(t,i,\"dataDescriptor\");const R=pn(t,i,\"signal\");void 0===D&&(D=!0);const S=await async function(t,e,n,i){const r=t.files,a=t.writer,s=Array.from(r.values()).pop();let o,l,c,d={};r.set(e,d);try{let f,u,_;if(i.keepOrder&&(f=s&&s.lock),d.lock=_=new Promise((t=>c=t)),i.bufferedWrite||t.lockWrite||!i.dataDescriptor?(u=new re,u.init(),o=!0):(t.lockWrite=new Promise((t=>l=t)),a.initialized||await a.init(),u=a),d=await async function(t,e,n,i){const{rawFilename:r,lastAccessDate:a,creationDate:s,password:o,level:l,zip64:c,zipCrypto:d,dataDescriptor:f,directory:u,version:_,versionMadeBy:h,rawComment:w,rawExtraField:p,useWebWorkers:b,onprogress:g,signal:x,encryptionStrength:y,extendedTimestamp:m,msDosCompatible:k,internalFileAttribute:v,externalFileAttribute:A}=i,E=Boolean(o&&o.length),U=0!==l&&!u;let z,D,R;if(E&&!d){z=new Uint8Array(un.length+2);const t=kn(z);gn(t,0,me),mn(z,un,2),bn(t,8,y)}else z=new Uint8Array(0);if(m){R=new Uint8Array(9+(a?4:0)+(s?4:0));const t=kn(R);gn(t,0,ke),gn(t,2,R.length-4);bn(t,4,1+(a?2:0)+(s?4:0)),xn(t,5,Math.floor(i.lastModDate.getTime()/1e3)),a&&xn(t,9,Math.floor(a.getTime()/1e3)),s&&xn(t,13,Math.floor(s.getTime()/1e3));try{D=new Uint8Array(36);const t=kn(D),e=wn(i.lastModDate);gn(t,0,10),gn(t,2,32),gn(t,8,1),gn(t,10,24),yn(t,12,e),yn(t,20,wn(a)||e),yn(t,28,wn(s)||e)}catch(t){D=new Uint8Array(0)}}else D=R=new Uint8Array(0);const S={version:_||20,versionMadeBy:h,zip64:c,directory:Boolean(u),filenameUTF8:!0,rawFilename:r,commentUTF8:!0,rawComment:w,rawExtraFieldZip64:c?new Uint8Array(28):new Uint8Array(0),rawExtraFieldExtendedTimestamp:R,rawExtraFieldNTFS:D,rawExtraFieldAES:z,rawExtraField:p,extendedTimestamp:m,msDosCompatible:k,internalFileAttribute:v,externalFileAttribute:A};let F=S.uncompressedSize=0,T=ve;f&&(T|=8);let I=0;U&&(I=8);c&&(S.version=S.version>45?S.version:45);E&&(T|=1,d||(S.version=S.version>51?S.version:51,I=99,U&&(S.rawExtraFieldAES[9]=8)));S.compressionMethod=I;const M=S.headerArray=new Uint8Array(26),C=kn(M);gn(C,0,S.version),gn(C,2,T),gn(C,4,I);const B=new Uint32Array(1),O=kn(B);let W;W=i.lastModDateEe?Ee:i.lastModDate;gn(O,0,(W.getHours()<<6|W.getMinutes())<<5|W.getSeconds()/2),gn(O,2,(W.getFullYear()-1980<<4|W.getMonth()+1)<<5|W.getDate());const L=B[0];xn(C,6,L),gn(C,22,r.length);const H=z.length+R.length+D.length+S.rawExtraField.length;gn(C,24,H);const P=new Uint8Array(30+r.length+H);let N;xn(kn(P),0,we),mn(P,M,4),mn(P,r,30),mn(P,z,30+r.length),mn(P,R,30+r.length+z.length),mn(P,D,30+r.length+z.length+R.length),mn(P,S.rawExtraField,30+r.length+z.length+R.length+D.length);let j=0;if(t){F=S.uncompressedSize=t.size;const i=await Ht(n.Deflate,{codecType:Dt,level:l,password:o,encryptionStrength:y,zipCrypto:E&&d,passwordVerification:E&&d&&L>>8&255,signed:!0,compressed:U,encrypted:E,useWebWorkers:b},n);await e.writeUint8Array(P),S.dataWritten=!0,N=await jt(i,t,e,0,F,n,{onprogress:g,signal:x}),j=N.length}else await e.writeUint8Array(P),S.dataWritten=!0;let V,q=new Uint8Array(0);f&&(q=new Uint8Array(c?24:16),V=kn(q),xn(V,0,pe));if(t){const t=N.signature;if(E&&!d||void 0===t||(xn(C,10,t),S.signature=t,f&&xn(V,4,t)),c){const t=kn(S.rawExtraFieldZip64);gn(t,0,1),gn(t,2,24),xn(C,14,_e),yn(t,12,BigInt(j)),xn(C,18,_e),yn(t,4,BigInt(F)),f&&(yn(V,8,BigInt(j)),yn(V,16,BigInt(F)))}else xn(C,14,j),xn(C,18,F),f&&(xn(V,8,j),xn(V,12,F))}f&&await e.writeUint8Array(q);const K=P.length+j+q.length;return Object.assign(S,{compressedSize:j,lastModDate:W,rawLastModDate:L,creationDate:s,lastAccessDate:a,encrypted:E,length:K}),S}(n,u,t.config,i),d.lock=_,r.set(e,d),d.filename=e,o){let e=0;const n=u.getData();let s;await Promise.all([t.lockWrite,f]);do{s=Array.from(r.values()).find((t=>t.writingBufferedData)),s&&await s.lock}while(s&&s.lock);if(d.writingBufferedData=!0,!i.dataDescriptor){const t=26,r=await hn(n,0,t),s=new DataView(r);d.encrypted&&!i.zipCrypto||xn(s,14,d.signature),d.zip64?(xn(s,18,_e),xn(s,22,_e)):(xn(s,18,d.compressedSize),xn(s,22,d.uncompressedSize)),await a.writeUint8Array(new Uint8Array(r)),e=t}await async function(t,e,n=0){const i=536870912;async function r(){if(n=_e)throw new Error(fn);return t.offset+=d.length,d}catch(n){throw(o&&d.writingBufferedData||!o&&d.dataWritten)&&(n.corruptedEntry=t.hasCorruptedEntries=!0,d.uncompressedSize&&(t.offset+=d.uncompressedSize)),r.delete(e),n}finally{c(),l&&l()}}(t,e,n,Object.assign({},i,{rawFilename:r,rawComment:s,version:o,versionMadeBy:l,lastModDate:c,lastAccessDate:d,creationDate:f,rawExtraField:w,zip64:A,password:u,level:E,useWebWorkers:U,encryptionStrength:_,extendedTimestamp:b,zipCrypto:h,bufferedWrite:z,keepOrder:x,dataDescriptor:D,signal:R,msDosCompatible:m,internalFileAttribute:k,externalFileAttribute:v}));g&&(t.pendingCompressedSize-=g);return Object.assign(S,{name:e,comment:a,extraField:p}),new Re(S)}(i,t,e,n)}finally{_n--;const t=i.pendingEntries.shift();t&&i.add(t.name,t.reader,t.options).then(t.resolve).catch(t.reject)}}async close(t=new Uint8Array(0),e={}){return await async function(t,e,n){const i=t.writer,r=t.files;let a=0,s=0,o=t.offset,l=r.size;for(const[,t]of r)s+=46+t.rawFilename.length+t.rawComment.length+t.rawExtraFieldZip64.length+t.rawExtraFieldAES.length+t.rawExtraFieldExtendedTimestamp.length+t.rawExtraFieldNTFS.length+t.rawExtraField.length;let c=n.zip64||t.options.zip64||!1;if(o>=_e||s>=_e||l>=he){if(!1===n.zip64||!1===t.options.zip64)throw new Error(fn);c=!0}const d=new Uint8Array(s+(c?98:22)),f=kn(d);if(e&&e.length){if(!(e.length<=he))throw new Error(rn);gn(f,a+20,e.length)}for(const[t,e]of Array.from(r.values()).entries()){const{rawFilename:i,rawExtraFieldZip64:s,rawExtraFieldAES:o,rawExtraField:l,rawComment:c,versionMadeBy:u,headerArray:_,directory:h,zip64:w,msDosCompatible:p,internalFileAttribute:b,externalFileAttribute:g}=e;let x,y;if(e.extendedTimestamp){y=e.rawExtraFieldNTFS,x=new Uint8Array(9);const t=kn(x);gn(t,0,ke),gn(t,2,x.length-4),bn(t,4,1),xn(t,5,Math.floor(e.lastModDate.getTime()/1e3))}else y=x=new Uint8Array(0);const m=s.length+o.length+x.length+y.length+l.length;if(xn(f,a,be),gn(f,a+4,u),mn(d,_,a+6),gn(f,a+30,m),gn(f,a+32,c.length),xn(f,a+34,b),g?xn(f,a+38,g):h&&p&&bn(f,a+38,16),xn(f,a+42,w?_e:e.offset),mn(d,i,a+46),mn(d,s,a+46+i.length),mn(d,o,a+46+i.length+s.length),mn(d,x,a+46+i.length+s.length+o.length),mn(d,y,a+46+i.length+s.length+o.length+x.length),mn(d,l,a+46+i.length+s.length+o.length+x.length+y.length),mn(d,c,a+46+i.length+m),a+=46+i.length+m+c.length,n.onprogress)try{n.onprogress(t+1,r.size,new Re(e))}catch(t){}}c&&(xn(f,a,xe),yn(f,a+4,BigInt(44)),gn(f,a+12,45),gn(f,a+14,45),yn(f,a+24,BigInt(l)),yn(f,a+32,BigInt(l)),yn(f,a+40,BigInt(s)),yn(f,a+48,BigInt(o)),xn(f,a+56,ye),yn(f,a+64,BigInt(o)+BigInt(s)),xn(f,a+72,1),l=he,o=_e,s=_e,a+=76);xn(f,a,ge),gn(f,a+8,l),gn(f,a+10,l),xn(f,a+12,s),xn(f,a+16,o),await i.writeUint8Array(d),e&&e.length&&await i.writeUint8Array(e)}(this,t,e),this.writer.getData()}},t.configure=P,t.getMimeType=function(){return\"application/octet-stream\"},t.initShimAsyncCodec=(t,e={},n)=>({Deflate:N(t.Deflate,e.deflate,n),Inflate:N(t.Inflate,e.inflate,n)}),t.terminateWorkers=function(){Wt.forEach((t=>t.terminate()))},Object.defineProperty(t,\"__esModule\",{value:!0})}));\r\n","/*!\r\n * JSPrintManager v4.0.0\r\n * https://neodynamic.com/products/printing/js-print-manager\r\n *\r\n * GitHub Repo\r\n * https://github.com/neodynamic/jsprintmanager\r\n *\r\n * Requires zip-full.min.js file from\r\n * https://github.com/gildas-lormeau/zip.js\r\n *\r\n * Requires JSPrintManager Client App\r\n * https://neodynamic.com/downloads/jspm\r\n *\r\n * Copyright Neodynamic SRL\r\n * https://neodynamic.com\r\n * Date: 2021-06-25\r\n */\r\nvar JSPM;\r\n(function (JSPM) {\r\n var ClientJob = (function () {\r\n function ClientJob() {\r\n this._type = '';\r\n }\r\n ClientJob.prototype._generateDataAsync = function () {\r\n return new Promise(function (_) {\r\n });\r\n };\r\n ClientJob.prototype.onUpdate = function (data, last) { };\r\n ;\r\n ClientJob.prototype.onError = function (data, critical) { };\r\n ;\r\n ClientJob.prototype.sendToClient = function () {\r\n var _this = this;\r\n return new Promise(function (ok, err) {\r\n _this._generateDataAsync().then(function (data) {\r\n var properties = {\r\n type: _this._type,\r\n on_update: function (data, first, last) {\r\n if (first)\r\n ok(data);\r\n else\r\n _this.onUpdate(data, last);\r\n },\r\n on_error: function (data, first, critical) {\r\n if (first)\r\n err(data);\r\n else\r\n _this.onError(data, critical);\r\n }\r\n };\r\n JSPM.JSPrintManager.WS.send(data, properties);\r\n }).catch(function (e) { return err(e); });\r\n });\r\n };\r\n return ClientJob;\r\n }());\r\n JSPM.ClientJob = ClientJob;\r\n})(JSPM || (JSPM = {}));\r\nvar __extends = (this && this.__extends) || (function () {\r\n var extendStatics = function (d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n };\r\n return function (d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nvar __generator = (this && this.__generator) || function (thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n};\r\nvar JSPM;\r\n(function (JSPM) {\r\n var ClientPrintJob = (function (_super) {\r\n __extends(ClientPrintJob, _super);\r\n function ClientPrintJob() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this._clientPrinter = null;\r\n _this._printerCommandsCopies = 1;\r\n _this._printerCommands = \"\";\r\n _this._printerCommandsCodePage = JSPM.Encoding.Default;\r\n _this._binaryPrinterCommands = null;\r\n _this._printFileGroup = [];\r\n return _this;\r\n }\r\n Object.defineProperty(ClientPrintJob.prototype, \"clientPrinter\", {\r\n get: function () {\r\n return this._clientPrinter;\r\n },\r\n set: function (value) {\r\n this._clientPrinter = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClientPrintJob.prototype, \"printerCommandsCopies\", {\r\n get: function () {\r\n return this._printerCommandsCopies;\r\n },\r\n set: function (value) {\r\n if (value < 1)\r\n throw \"Copies must be greater than or equal to 1.\";\r\n this._printerCommandsCopies = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClientPrintJob.prototype, \"printerCommands\", {\r\n get: function () {\r\n return this._printerCommands;\r\n },\r\n set: function (value) {\r\n this._printerCommands = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClientPrintJob.prototype, \"printerCommandsCodePage\", {\r\n get: function () {\r\n return this._printerCommandsCodePage;\r\n },\r\n set: function (value) {\r\n this._printerCommandsCodePage = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClientPrintJob.prototype, \"binaryPrinterCommands\", {\r\n get: function () {\r\n return this._binaryPrinterCommands;\r\n },\r\n set: function (value) {\r\n this._binaryPrinterCommands = value;\r\n this._printerCommands = \"\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClientPrintJob.prototype, \"files\", {\r\n get: function () {\r\n return this._printFileGroup;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ClientPrintJob.prototype.onUpdated = function (data) { };\r\n ;\r\n ClientPrintJob.prototype.onFinished = function (data) { };\r\n ;\r\n ClientPrintJob.prototype.onError = function (data, is_critical) { };\r\n ;\r\n ClientPrintJob.prototype.onUpdate = function (data, last) {\r\n if (last) {\r\n this.onFinished(data);\r\n }\r\n else {\r\n this.onUpdated(data);\r\n }\r\n };\r\n ClientPrintJob.prototype._genPFGArrayAsync = function (printFileGroup) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n if (!zip) {\r\n reject(\"zip-full.min.js file from https://github.com/gildas-lormeau/zip.js project is missing.\");\r\n return;\r\n }\r\n if (printFileGroup.length == 0)\r\n return;\r\n zip.configure({ useWebWorkers: false });\r\n var blobW = new zip.BlobWriter(\"application/zip\");\r\n var zipWriter = new zip.ZipWriter(blobW);\r\n var zipped_files = printFileGroup.map(function (pf) { return new Promise(function (ok, err) { return __awaiter(_this, void 0, void 0, function () {\r\n var file_content, reason_1;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n _a.trys.push([0, 3, , 4]);\r\n return [4, pf.getContent()];\r\n case 1:\r\n file_content = _a.sent();\r\n return [4, zipWriter.add(pf.fileName, file_content)];\r\n case 2:\r\n _a.sent();\r\n ok();\r\n return [3, 4];\r\n case 3:\r\n reason_1 = _a.sent();\r\n err(reason_1);\r\n return [3, 4];\r\n case 4: return [2];\r\n }\r\n });\r\n }); }); });\r\n Promise.all(zipped_files).then(function (_) { return __awaiter(_this, void 0, void 0, function () {\r\n var e_1;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n _a.trys.push([0, 3, , 4]);\r\n return [4, zipWriter.add(\"metadata.json\", new zip.BlobReader(new Blob([JSON.stringify(printFileGroup.map(function (pf) { return pf.getProperties(); }))])))];\r\n case 1:\r\n _a.sent();\r\n return [4, zipWriter.close()];\r\n case 2:\r\n _a.sent();\r\n resolve(blobW.getData());\r\n return [3, 4];\r\n case 3:\r\n e_1 = _a.sent();\r\n reject(e_1);\r\n return [3, 4];\r\n case 4: return [2];\r\n }\r\n });\r\n }); }).catch(function (e) { return reject(e); });\r\n });\r\n };\r\n ClientPrintJob.prototype._genPCArrayAsync = function (binPrinterCommands, printerCopies) {\r\n return new Promise(function (resolve, reject) {\r\n try {\r\n var copies = JSPM.Utils._str2UTF8Array(printerCopies.toString());\r\n var pcc_copies = new Uint8Array(0);\r\n if (printerCopies > 1) {\r\n pcc_copies = new Uint8Array(5 + copies.length);\r\n pcc_copies.set([80, 67, 67, 61]);\r\n pcc_copies.set(copies, 4);\r\n pcc_copies.set([124], 4 + copies.length);\r\n }\r\n if (binPrinterCommands != null && binPrinterCommands.length > 0)\r\n resolve(new Blob([pcc_copies, binPrinterCommands]));\r\n }\r\n catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n ClientPrintJob.prototype._genPrinterArrayAsync = function (clientPrinter) {\r\n return new Promise(function (resolve, reject) {\r\n try {\r\n if (!clientPrinter)\r\n clientPrinter = new JSPM.UserSelectedPrinter();\r\n var toRet = new Uint8Array(JSPM.Utils._str2UTF8Array(clientPrinter.serialize()));\r\n resolve(toRet);\r\n }\r\n catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n ClientPrintJob.prototype._cmd2bin = function () {\r\n if (this._printerCommands && this._printerCommands.length > 0) {\r\n try {\r\n if (this._printerCommandsCodePage == JSPM.Encoding.Default) {\r\n this._binaryPrinterCommands = new Uint8Array(JSPM.Utils._str2UTF8Array(this._printerCommands));\r\n }\r\n else {\r\n if (!('cptable' in window)) {\r\n throw \"cptable.js and cputils.js files from \" +\r\n \"https://github.com/SheetJS/js-codepage\" +\r\n \"project are missing\";\r\n }\r\n if (!('utils' in window['cptable'])) {\r\n throw \"cptable.js and cputils.js files from \" +\r\n \"https://github.com/SheetJS/js-codepage \" +\r\n \"project are missing\";\r\n }\r\n if (!(this._printerCommandsCodePage in window['cptable'])) {\r\n throw \"Encoding \" +\r\n this._printerCommandsCodePage.toString() +\r\n \" is missing. Add it from\" +\r\n \"https://github.com/SheetJS/js-codepage/tree/master/bits\";\r\n }\r\n this._binaryPrinterCommands = new Uint8Array(cptable.utils.encode(this._printerCommandsCodePage, this._printerCommands));\r\n }\r\n }\r\n catch (e) {\r\n throw e;\r\n }\r\n }\r\n };\r\n ClientPrintJob.prototype._generateDataAsync = function () {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this._cmd2bin();\r\n var header = new Uint8Array([99, 112, 106, 2]);\r\n Promise.race([\r\n _this._genPCArrayAsync(_this.binaryPrinterCommands, _this._printerCommandsCopies),\r\n _this._genPFGArrayAsync(_this._printFileGroup)\r\n ])\r\n .then(function (file_data) {\r\n _this._genPrinterArrayAsync(_this._clientPrinter)\r\n .then(function (printer_data) {\r\n var idx1 = JSPM.Utils._intToByteArray(file_data.size);\r\n resolve(new Blob([header, idx1, file_data, printer_data]));\r\n })\r\n .catch(function (e) { reject(e); });\r\n })\r\n .catch(function (e) { reject(e); });\r\n });\r\n };\r\n return ClientPrintJob;\r\n }(JSPM.ClientJob));\r\n JSPM.ClientPrintJob = ClientPrintJob;\r\n})(JSPM || (JSPM = {}));\r\nvar JSPM;\r\n(function (JSPM) {\r\n var ClientPrintJobGroup = (function (_super) {\r\n __extends(ClientPrintJobGroup, _super);\r\n function ClientPrintJobGroup() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this._jobs = [];\r\n return _this;\r\n }\r\n Object.defineProperty(ClientPrintJobGroup.prototype, \"jobs\", {\r\n get: function () {\r\n return this._jobs;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ClientPrintJobGroup.prototype._generateMiniJob = function (cj) {\r\n var INDEXES_SIZE = 8;\r\n return new Promise(function (ok, error) {\r\n cj._cmd2bin();\r\n Promise.race([\r\n cj._genPCArrayAsync(cj.binaryPrinterCommands, cj.printerCommandsCopies),\r\n cj._genPFGArrayAsync(cj.files)\r\n ])\r\n .then(function (file_data) {\r\n cj._genPrinterArrayAsync(cj.clientPrinter).then(function (printer_data) {\r\n var idx1 = JSPM.Utils._intToByteArray(file_data.size);\r\n ok(new Blob([idx1, file_data, printer_data]));\r\n }).catch(function (e) { error(e); });\r\n }).catch(function (e) { error(e); });\r\n });\r\n };\r\n ClientPrintJobGroup.prototype._generateDataAsync = function () {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n var header = new Uint8Array([99, 112, 106, 103, 2]);\r\n var jobs_qty = new Uint8Array(JSPM.Utils._intToByteArray(_this.jobs.length));\r\n var promises = [];\r\n for (var i = 0; i < _this.jobs.length; i++) {\r\n promises.push(_this._generateMiniJob(_this.jobs[i]));\r\n }\r\n Promise.all(promises).then(function (data_arr) {\r\n var jobs_metadata = data_arr.map(function (x) {\r\n return {\r\n startIndex: 0,\r\n endIndex: x.size - 1\r\n };\r\n });\r\n for (var i = 1; i < jobs_metadata.length; i++) {\r\n jobs_metadata[i].startIndex = jobs_metadata[i - 1].endIndex + 1;\r\n jobs_metadata[i].endIndex += jobs_metadata[i].startIndex;\r\n }\r\n var metadata = JSON.stringify(jobs_metadata);\r\n var jobs = data_arr.reduce(function (prev, curr) { return new Blob([prev, curr]); });\r\n var jobs_offset = new Uint8Array(JSPM.Utils._intToByteArray(jobs.size));\r\n resolve(new Blob([header, jobs_qty, jobs_offset, jobs, metadata]));\r\n })\r\n .catch(function (error) {\r\n reject(error);\r\n });\r\n });\r\n };\r\n return ClientPrintJobGroup;\r\n }(JSPM.ClientJob));\r\n JSPM.ClientPrintJobGroup = ClientPrintJobGroup;\r\n})(JSPM || (JSPM = {}));\r\nvar JSPM;\r\n(function (JSPM) {\r\n var DefaultPrinter = (function () {\r\n function DefaultPrinter() {\r\n this.Id = 0;\r\n }\r\n DefaultPrinter.prototype.serialize = function () {\r\n return JSON.stringify({\r\n 'type': this.Id\r\n });\r\n };\r\n return DefaultPrinter;\r\n }());\r\n JSPM.DefaultPrinter = DefaultPrinter;\r\n var InstalledPrinter = (function () {\r\n function InstalledPrinter(printerName, printToDefaultIfNotFound, trayName, paperName, duplex) {\r\n if (printToDefaultIfNotFound === void 0) { printToDefaultIfNotFound = false; }\r\n if (trayName === void 0) { trayName = ''; }\r\n if (paperName === void 0) { paperName = ''; }\r\n if (duplex === void 0) { duplex = JSPM.DuplexMode.Default; }\r\n this.Id = 1;\r\n this._name = \"\";\r\n this._printDefault = false;\r\n this._tray = \"\";\r\n this._paper = \"\";\r\n this._duplex = JSPM.DuplexMode.Default;\r\n if (!printerName)\r\n throw \"The specified printer name is null or empty.\";\r\n this._name = printerName;\r\n this._printDefault = printToDefaultIfNotFound;\r\n this._paper = paperName;\r\n this._tray = trayName;\r\n this._duplex = duplex;\r\n }\r\n InstalledPrinter.prototype.bool2str = function (value, true_val, false_val) {\r\n if (true_val === void 0) { true_val = '1'; }\r\n if (false_val === void 0) { false_val = '0'; }\r\n return value ? true_val : false_val;\r\n };\r\n Object.defineProperty(InstalledPrinter.prototype, \"printerName\", {\r\n get: function () {\r\n return this._name;\r\n },\r\n set: function (value) {\r\n this._name = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstalledPrinter.prototype, \"printToDefaultIfNotFound\", {\r\n get: function () {\r\n return this._printDefault;\r\n },\r\n set: function (value) {\r\n this._printDefault = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstalledPrinter.prototype, \"trayName\", {\r\n get: function () {\r\n return this._tray;\r\n },\r\n set: function (value) {\r\n this._tray = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstalledPrinter.prototype, \"paperName\", {\r\n get: function () {\r\n return this._paper;\r\n },\r\n set: function (value) {\r\n this._paper = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstalledPrinter.prototype, \"duplex\", {\r\n get: function () {\r\n return this._duplex;\r\n },\r\n set: function (value) {\r\n this._duplex = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n InstalledPrinter.prototype.serialize = function () {\r\n if (!this._name) {\r\n throw \"The specified printer name is null or empty.\";\r\n }\r\n return JSON.stringify({\r\n type: this.Id,\r\n name: this._name,\r\n duplex: this._duplex,\r\n paper: this._paper,\r\n tray: this._tray,\r\n use_default: this._printDefault\r\n });\r\n };\r\n return InstalledPrinter;\r\n }());\r\n JSPM.InstalledPrinter = InstalledPrinter;\r\n var ParallelPortPrinter = (function () {\r\n function ParallelPortPrinter(portName) {\r\n this.Id = 2;\r\n this._parallelPortName = \"LPT1\";\r\n if (!portName)\r\n throw \"The specified parallel port name is null or empty.\";\r\n this._parallelPortName = portName;\r\n }\r\n Object.defineProperty(ParallelPortPrinter.prototype, \"portName\", {\r\n get: function () {\r\n return this._parallelPortName;\r\n },\r\n set: function (value) {\r\n this._parallelPortName = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ParallelPortPrinter.prototype.serialize = function () {\r\n if (!this.portName)\r\n throw \"The specified parallel port name is null or empty.\";\r\n return JSON.stringify({\r\n type: this.Id,\r\n port: this._parallelPortName\r\n });\r\n };\r\n return ParallelPortPrinter;\r\n }());\r\n JSPM.ParallelPortPrinter = ParallelPortPrinter;\r\n var SerialPortPrinter = (function () {\r\n function SerialPortPrinter(portName, baudRate, parity, stopBits, dataBits, flowControl) {\r\n this.Id = 3;\r\n this._port = \"COM1\";\r\n this._baud_rate = 9600;\r\n this._parity = JSPM.Serial.Parity.None;\r\n this._stop_bits = JSPM.Serial.StopBits.One;\r\n this._data_bits = JSPM.Serial.DataBits.Eight;\r\n this._flow_control = JSPM.Serial.Handshake.XOnXOff;\r\n if (!portName)\r\n throw \"The specified serial port name is null or empty.\";\r\n this._port = portName;\r\n this._baud_rate = baudRate;\r\n this._parity = parity;\r\n this._stop_bits = stopBits;\r\n this._data_bits = dataBits;\r\n this._flow_control = flowControl;\r\n }\r\n Object.defineProperty(SerialPortPrinter.prototype, \"portName\", {\r\n get: function () {\r\n return this._port;\r\n },\r\n set: function (value) {\r\n this._port = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SerialPortPrinter.prototype, \"baudRate\", {\r\n get: function () {\r\n return this._baud_rate;\r\n },\r\n set: function (value) {\r\n this._baud_rate = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SerialPortPrinter.prototype, \"parity\", {\r\n get: function () {\r\n return this._parity;\r\n },\r\n set: function (value) {\r\n this._parity = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SerialPortPrinter.prototype, \"stopBits\", {\r\n get: function () {\r\n return this._stop_bits;\r\n },\r\n set: function (value) {\r\n this._stop_bits = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SerialPortPrinter.prototype, \"dataBits\", {\r\n get: function () {\r\n return this._data_bits;\r\n },\r\n set: function (value) {\r\n this._data_bits = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SerialPortPrinter.prototype, \"flowControl\", {\r\n get: function () {\r\n return this._flow_control;\r\n },\r\n set: function (value) {\r\n this._flow_control = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n SerialPortPrinter.prototype.serialize = function () {\r\n if (!this.portName)\r\n throw \"The specified serial port name is null or empty.\";\r\n return JSON.stringify({\r\n type: this.Id,\r\n port: this._port,\r\n baud_rate: this._baud_rate,\r\n data_bits: this._data_bits,\r\n flow_control: this._flow_control,\r\n parity: this._parity,\r\n stop_bits: this._stop_bits\r\n });\r\n };\r\n return SerialPortPrinter;\r\n }());\r\n JSPM.SerialPortPrinter = SerialPortPrinter;\r\n var NetworkPrinter = (function () {\r\n function NetworkPrinter(port, ipAddress, dnsName) {\r\n this.Id = 4;\r\n this._ip = \"0.0.0.0\";\r\n this._port = 0;\r\n this._dnsName = \"\";\r\n if (!(ipAddress || dnsName))\r\n throw \"You have to specify an IP address or a DNS name\";\r\n if (ipAddress)\r\n this._ip = ipAddress;\r\n if (dnsName)\r\n this._dnsName = dnsName;\r\n this._port = port;\r\n }\r\n Object.defineProperty(NetworkPrinter.prototype, \"dnsName\", {\r\n get: function () {\r\n return this._dnsName;\r\n },\r\n set: function (value) {\r\n this._dnsName = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(NetworkPrinter.prototype, \"ipAddress\", {\r\n get: function () {\r\n return this._ip;\r\n },\r\n set: function (value) {\r\n this._ip = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(NetworkPrinter.prototype, \"port\", {\r\n get: function () {\r\n return this._port;\r\n },\r\n set: function (value) {\r\n if (!(value >= 0 && value <= 65535))\r\n throw \"Invalid Port Number\";\r\n this._port = Math.floor(value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n NetworkPrinter.prototype.serialize = function () {\r\n if (!(this.dnsName || this.ipAddress))\r\n throw \"You have to specify an IP address or a DNS name\";\r\n return JSON.stringify({\r\n type: this.Id,\r\n ip: this._ip,\r\n dns: this._dnsName,\r\n port: this._port\r\n });\r\n };\r\n return NetworkPrinter;\r\n }());\r\n JSPM.NetworkPrinter = NetworkPrinter;\r\n var UserSelectedPrinter = (function () {\r\n function UserSelectedPrinter() {\r\n this.Id = 5;\r\n }\r\n UserSelectedPrinter.prototype.serialize = function () {\r\n return JSON.stringify({\r\n type: this.Id\r\n });\r\n };\r\n return UserSelectedPrinter;\r\n }());\r\n JSPM.UserSelectedPrinter = UserSelectedPrinter;\r\n})(JSPM || (JSPM = {}));\r\nvar JSPM;\r\n(function (JSPM) {\r\n var ClientScanJob = (function (_super) {\r\n __extends(ClientScanJob, _super);\r\n function ClientScanJob() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this._type = 'scan_job';\r\n _this._scannerName = \"\";\r\n _this._pixelMode = JSPM.PixelMode.Color;\r\n _this._resolution = 200;\r\n _this._imageFormat = JSPM.ScannerImageFormatOutput.JPG;\r\n _this._enableDuplex = false;\r\n _this._enableFeeder = false;\r\n _this._feederCount = 1;\r\n return _this;\r\n }\r\n Object.defineProperty(ClientScanJob.prototype, \"scannerName\", {\r\n get: function () {\r\n return this._scannerName;\r\n },\r\n set: function (val) {\r\n this._scannerName = val;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClientScanJob.prototype, \"pixelMode\", {\r\n get: function () {\r\n return this._pixelMode;\r\n },\r\n set: function (val) {\r\n this._pixelMode = val;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClientScanJob.prototype, \"resolution\", {\r\n get: function () {\r\n return this._resolution;\r\n },\r\n set: function (val) {\r\n this._resolution = val;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClientScanJob.prototype, \"imageFormat\", {\r\n get: function () {\r\n return this._imageFormat;\r\n },\r\n set: function (val) {\r\n this._imageFormat = val;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClientScanJob.prototype, \"enableDuplex\", {\r\n get: function () {\r\n return this._enableDuplex;\r\n },\r\n set: function (val) {\r\n this._enableDuplex = val;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClientScanJob.prototype, \"enableFeeder\", {\r\n get: function () {\r\n return this._enableFeeder;\r\n },\r\n set: function (val) {\r\n this._enableFeeder = val;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClientScanJob.prototype, \"feederCount\", {\r\n get: function () {\r\n return this._feederCount;\r\n },\r\n set: function (val) {\r\n this._feederCount = val;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ClientScanJob.prototype.onFinished = function (data) { };\r\n ;\r\n ClientScanJob.prototype.onError = function (data, is_critical) { };\r\n ;\r\n ClientScanJob.prototype.onUpdate = function (data, last) {\r\n if (data.result) {\r\n this.onFinished(data);\r\n }\r\n };\r\n ClientScanJob.prototype._generateDataAsync = function () {\r\n var _this = this;\r\n return new Promise(function (ok, err) {\r\n if (!_this._resolution)\r\n err(\"Scan resolution is required\");\r\n if (!_this._scannerName)\r\n err(\"Scanner name is required\");\r\n var json = {\r\n output_image_format: _this._imageFormat,\r\n pixel_mode: _this._pixelMode,\r\n scanner_name: _this._scannerName,\r\n resolution: _this._resolution,\r\n enable_duplex: _this._enableDuplex,\r\n enable_feeder: _this._enableFeeder,\r\n feeder_count: _this._feederCount\r\n };\r\n ok(JSON.stringify(json));\r\n });\r\n };\r\n return ClientScanJob;\r\n }(JSPM.ClientJob));\r\n JSPM.ClientScanJob = ClientScanJob;\r\n})(JSPM || (JSPM = {}));\r\nvar JSPM;\r\n(function (JSPM) {\r\n var PrintFileType;\r\n (function (PrintFileType) {\r\n PrintFileType[PrintFileType[\"Image\"] = 0] = \"Image\";\r\n PrintFileType[PrintFileType[\"Generic\"] = 1] = \"Generic\";\r\n PrintFileType[PrintFileType[\"Document\"] = 2] = \"Document\";\r\n PrintFileType[PrintFileType[\"WDOC\"] = 3] = \"WDOC\";\r\n PrintFileType[PrintFileType[\"WXLS\"] = 4] = \"WXLS\";\r\n PrintFileType[PrintFileType[\"WPDF\"] = 5] = \"WPDF\";\r\n PrintFileType[PrintFileType[\"WTXT\"] = 6] = \"WTXT\";\r\n PrintFileType[PrintFileType[\"Group\"] = 7] = \"Group\";\r\n PrintFileType[PrintFileType[\"WTIF\"] = 8] = \"WTIF\";\r\n })(PrintFileType = JSPM.PrintFileType || (JSPM.PrintFileType = {}));\r\n ;\r\n var PrintersInfoLevel;\r\n (function (PrintersInfoLevel) {\r\n PrintersInfoLevel[PrintersInfoLevel[\"Basic\"] = 0] = \"Basic\";\r\n PrintersInfoLevel[PrintersInfoLevel[\"Extended\"] = 1] = \"Extended\";\r\n })(PrintersInfoLevel = JSPM.PrintersInfoLevel || (JSPM.PrintersInfoLevel = {}));\r\n var Encoding;\r\n (function (Encoding) {\r\n Encoding[Encoding[\"Default\"] = -1] = \"Default\";\r\n Encoding[Encoding[\"IBM_EBCDIC_US_Canada\"] = 37] = \"IBM_EBCDIC_US_Canada\";\r\n Encoding[Encoding[\"OEM_United_States\"] = 437] = \"OEM_United_States\";\r\n Encoding[Encoding[\"IBM_EBCDIC_International\"] = 500] = \"IBM_EBCDIC_International\";\r\n Encoding[Encoding[\"Polish_MS_DOS\"] = 620] = \"Polish_MS_DOS\";\r\n Encoding[Encoding[\"Arabic_ASMO_708\"] = 708] = \"Arabic_ASMO_708\";\r\n Encoding[Encoding[\"Arabic_Transparent_ASMO_Arabic_DOS\"] = 720] = \"Arabic_Transparent_ASMO_Arabic_DOS\";\r\n Encoding[Encoding[\"OEM_Greek_formerly_437G_Greek_DOS\"] = 737] = \"OEM_Greek_formerly_437G_Greek_DOS\";\r\n Encoding[Encoding[\"OEM_Baltic_Baltic_DOS\"] = 775] = \"OEM_Baltic_Baltic_DOS\";\r\n Encoding[Encoding[\"OEM_Russian_Cyrillic_Euro_symbol\"] = 808] = \"OEM_Russian_Cyrillic_Euro_symbol\";\r\n Encoding[Encoding[\"OEM_Multilingual_Latin_1_Western_European_DOS\"] = 850] = \"OEM_Multilingual_Latin_1_Western_European_DOS\";\r\n Encoding[Encoding[\"OEM_Latin_2_Central_European_DOS\"] = 852] = \"OEM_Latin_2_Central_European_DOS\";\r\n Encoding[Encoding[\"OEM_Cyrillic_primarily_Russian\"] = 855] = \"OEM_Cyrillic_primarily_Russian\";\r\n Encoding[Encoding[\"OEM_Turkish_Turkish_DOS\"] = 857] = \"OEM_Turkish_Turkish_DOS\";\r\n Encoding[Encoding[\"OEM_Multilingual_Latin_1_Euro_symbol\"] = 858] = \"OEM_Multilingual_Latin_1_Euro_symbol\";\r\n Encoding[Encoding[\"OEM_Portuguese_Portuguese_DOS\"] = 860] = \"OEM_Portuguese_Portuguese_DOS\";\r\n Encoding[Encoding[\"OEM_Icelandic_Icelandic_DOS\"] = 861] = \"OEM_Icelandic_Icelandic_DOS\";\r\n Encoding[Encoding[\"OEM_Hebrew_Hebrew_DOS\"] = 862] = \"OEM_Hebrew_Hebrew_DOS\";\r\n Encoding[Encoding[\"OEM_French_Canadian_French_Canadian_DOS\"] = 863] = \"OEM_French_Canadian_French_Canadian_DOS\";\r\n Encoding[Encoding[\"OEM_Arabic_Arabic_864\"] = 864] = \"OEM_Arabic_Arabic_864\";\r\n Encoding[Encoding[\"OEM_Nordic_Nordic_DOS\"] = 865] = \"OEM_Nordic_Nordic_DOS\";\r\n Encoding[Encoding[\"OEM_Russian_Cyrillic_DOS\"] = 866] = \"OEM_Russian_Cyrillic_DOS\";\r\n Encoding[Encoding[\"OEM_Modern_Greek_Greek_Modern_DOS\"] = 869] = \"OEM_Modern_Greek_Greek_Modern_DOS\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Multilingual_ROECE_Latin_2\"] = 870] = \"IBM_EBCDIC_Multilingual_ROECE_Latin_2\";\r\n Encoding[Encoding[\"OEM_Cyrillic_primarily_Russian_Euro_Symbol\"] = 872] = \"OEM_Cyrillic_primarily_Russian_Euro_Symbol\";\r\n Encoding[Encoding[\"Windows_Thai\"] = 874] = \"Windows_Thai\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Greek_Modern\"] = 875] = \"IBM_EBCDIC_Greek_Modern\";\r\n Encoding[Encoding[\"Kamenicky_Czech_MS_DOS\"] = 895] = \"Kamenicky_Czech_MS_DOS\";\r\n Encoding[Encoding[\"Japanese_Shift_JIS\"] = 932] = \"Japanese_Shift_JIS\";\r\n Encoding[Encoding[\"Simplified_Chinese_GBK\"] = 936] = \"Simplified_Chinese_GBK\";\r\n Encoding[Encoding[\"Korean\"] = 949] = \"Korean\";\r\n Encoding[Encoding[\"Traditional_Chinese_Big5\"] = 950] = \"Traditional_Chinese_Big5\";\r\n Encoding[Encoding[\"IBM_EBCDIC_French\"] = 1010] = \"IBM_EBCDIC_French\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Turkish_Latin_5\"] = 1026] = \"IBM_EBCDIC_Turkish_Latin_5\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Latin_1_Open_System\"] = 1047] = \"IBM_EBCDIC_Latin_1_Open_System\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Lao_1132_1133_1341\"] = 1132] = \"IBM_EBCDIC_Lao_1132_1133_1341\";\r\n Encoding[Encoding[\"IBM_EBCDIC_US_Canada_037_Euro_symbol\"] = 1140] = \"IBM_EBCDIC_US_Canada_037_Euro_symbol\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Germany_20273_Euro_symbol\"] = 1141] = \"IBM_EBCDIC_Germany_20273_Euro_symbol\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Denmark_Norway_20277_Euro_symbol\"] = 1142] = \"IBM_EBCDIC_Denmark_Norway_20277_Euro_symbol\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Finland_Sweden_20278_Euro_symbol\"] = 1143] = \"IBM_EBCDIC_Finland_Sweden_20278_Euro_symbol\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Italy_20280_Euro_symbol\"] = 1144] = \"IBM_EBCDIC_Italy_20280_Euro_symbol\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Latin_America_Spain_20284_Euro_symbol\"] = 1145] = \"IBM_EBCDIC_Latin_America_Spain_20284_Euro_symbol\";\r\n Encoding[Encoding[\"IBM_EBCDIC_United_Kingdom_20285_Euro_symbol\"] = 1146] = \"IBM_EBCDIC_United_Kingdom_20285_Euro_symbol\";\r\n Encoding[Encoding[\"IBM_EBCDIC_France_20297_Euro_symbol\"] = 1147] = \"IBM_EBCDIC_France_20297_Euro_symbol\";\r\n Encoding[Encoding[\"IBM_EBCDIC_International_500_Euro_symbol\"] = 1148] = \"IBM_EBCDIC_International_500_Euro_symbol\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Icelandic_20871_Euro_symbol\"] = 1149] = \"IBM_EBCDIC_Icelandic_20871_Euro_symbol\";\r\n Encoding[Encoding[\"Unicode_UTF_16_little_endian_BMP_of_ISO_10646\"] = 1200] = \"Unicode_UTF_16_little_endian_BMP_of_ISO_10646\";\r\n Encoding[Encoding[\"Unicode_UTF_16_big_endian\"] = 1201] = \"Unicode_UTF_16_big_endian\";\r\n Encoding[Encoding[\"Windows_Central_Europe\"] = 1250] = \"Windows_Central_Europe\";\r\n Encoding[Encoding[\"Windows_Cyrillic\"] = 1251] = \"Windows_Cyrillic\";\r\n Encoding[Encoding[\"Windows_Latin_I\"] = 1252] = \"Windows_Latin_I\";\r\n Encoding[Encoding[\"Windows_Greek\"] = 1253] = \"Windows_Greek\";\r\n Encoding[Encoding[\"Windows_Turkish\"] = 1254] = \"Windows_Turkish\";\r\n Encoding[Encoding[\"Windows_Hebrew\"] = 1255] = \"Windows_Hebrew\";\r\n Encoding[Encoding[\"Windows_Arabic\"] = 1256] = \"Windows_Arabic\";\r\n Encoding[Encoding[\"Windows_Baltic\"] = 1257] = \"Windows_Baltic\";\r\n Encoding[Encoding[\"Windows_Vietnam\"] = 1258] = \"Windows_Vietnam\";\r\n Encoding[Encoding[\"Korean_Johab\"] = 1361] = \"Korean_Johab\";\r\n Encoding[Encoding[\"MAC_Roman\"] = 10000] = \"MAC_Roman\";\r\n Encoding[Encoding[\"Japanese_Mac\"] = 10001] = \"Japanese_Mac\";\r\n Encoding[Encoding[\"MAC_Traditional_Chinese_Big5\"] = 10002] = \"MAC_Traditional_Chinese_Big5\";\r\n Encoding[Encoding[\"Korean_Mac\"] = 10003] = \"Korean_Mac\";\r\n Encoding[Encoding[\"Arabic_Mac\"] = 10004] = \"Arabic_Mac\";\r\n Encoding[Encoding[\"Hebrew_Mac\"] = 10005] = \"Hebrew_Mac\";\r\n Encoding[Encoding[\"Greek_Mac\"] = 10006] = \"Greek_Mac\";\r\n Encoding[Encoding[\"Cyrillic_Mac\"] = 10007] = \"Cyrillic_Mac\";\r\n Encoding[Encoding[\"MAC_Simplified_Chinese_GB_2312\"] = 10008] = \"MAC_Simplified_Chinese_GB_2312\";\r\n Encoding[Encoding[\"Romanian_Mac\"] = 10010] = \"Romanian_Mac\";\r\n Encoding[Encoding[\"Ukrainian_Mac\"] = 10017] = \"Ukrainian_Mac\";\r\n Encoding[Encoding[\"Thai_Mac\"] = 10021] = \"Thai_Mac\";\r\n Encoding[Encoding[\"MAC_Latin_2_Central_European\"] = 10029] = \"MAC_Latin_2_Central_European\";\r\n Encoding[Encoding[\"Icelandic_Mac\"] = 10079] = \"Icelandic_Mac\";\r\n Encoding[Encoding[\"Turkish_Mac\"] = 10081] = \"Turkish_Mac\";\r\n Encoding[Encoding[\"Croatian_Mac\"] = 10082] = \"Croatian_Mac\";\r\n Encoding[Encoding[\"Unicode_UTF_32_little_endian_byte_order\"] = 12000] = \"Unicode_UTF_32_little_endian_byte_order\";\r\n Encoding[Encoding[\"Unicode_UTF_32_big_endian_byte_order\"] = 12001] = \"Unicode_UTF_32_big_endian_byte_order\";\r\n Encoding[Encoding[\"CNS_Taiwan_Chinese_Traditional\"] = 20000] = \"CNS_Taiwan_Chinese_Traditional\";\r\n Encoding[Encoding[\"TCA_Taiwan\"] = 20001] = \"TCA_Taiwan\";\r\n Encoding[Encoding[\"ETEN_Taiwan_Chinese_Traditional\"] = 20002] = \"ETEN_Taiwan_Chinese_Traditional\";\r\n Encoding[Encoding[\"IBM5550_Taiwan\"] = 20003] = \"IBM5550_Taiwan\";\r\n Encoding[Encoding[\"TeleText_Taiwan\"] = 20004] = \"TeleText_Taiwan\";\r\n Encoding[Encoding[\"Wang_Taiwan\"] = 20005] = \"Wang_Taiwan\";\r\n Encoding[Encoding[\"Western_European_IA5_IRV_International_Alphabet_5\"] = 20105] = \"Western_European_IA5_IRV_International_Alphabet_5\";\r\n Encoding[Encoding[\"IA5_German_7_bit\"] = 20106] = \"IA5_German_7_bit\";\r\n Encoding[Encoding[\"IA5_Swedish_7_bit\"] = 20107] = \"IA5_Swedish_7_bit\";\r\n Encoding[Encoding[\"IA5_Norwegian_7_bit\"] = 20108] = \"IA5_Norwegian_7_bit\";\r\n Encoding[Encoding[\"US_ASCII_7_bit\"] = 20127] = \"US_ASCII_7_bit\";\r\n Encoding[Encoding[\"T_61\"] = 20261] = \"T_61\";\r\n Encoding[Encoding[\"ISO_6937_Non_Spacing_Accent\"] = 20269] = \"ISO_6937_Non_Spacing_Accent\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Germany\"] = 20273] = \"IBM_EBCDIC_Germany\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Denmark_Norway\"] = 20277] = \"IBM_EBCDIC_Denmark_Norway\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Finland_Sweden\"] = 20278] = \"IBM_EBCDIC_Finland_Sweden\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Italy\"] = 20280] = \"IBM_EBCDIC_Italy\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Latin_America_Spain\"] = 20284] = \"IBM_EBCDIC_Latin_America_Spain\";\r\n Encoding[Encoding[\"IBM_EBCDIC_United_Kingdom\"] = 20285] = \"IBM_EBCDIC_United_Kingdom\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Japanese_Katakana_Extended\"] = 20290] = \"IBM_EBCDIC_Japanese_Katakana_Extended\";\r\n Encoding[Encoding[\"IBM_EBCDIC_France\"] = 20297] = \"IBM_EBCDIC_France\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Arabic\"] = 20420] = \"IBM_EBCDIC_Arabic\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Greek\"] = 20423] = \"IBM_EBCDIC_Greek\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Hebrew\"] = 20424] = \"IBM_EBCDIC_Hebrew\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Korean_Extended\"] = 20833] = \"IBM_EBCDIC_Korean_Extended\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Thai\"] = 20838] = \"IBM_EBCDIC_Thai\";\r\n Encoding[Encoding[\"Russian_Cyrillic_KOI8_R\"] = 20866] = \"Russian_Cyrillic_KOI8_R\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Icelandic\"] = 20871] = \"IBM_EBCDIC_Icelandic\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Cyrillic_Russian\"] = 20880] = \"IBM_EBCDIC_Cyrillic_Russian\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Turkish\"] = 20905] = \"IBM_EBCDIC_Turkish\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Latin_1_Open_System_1047_Euro_symbol\"] = 20924] = \"IBM_EBCDIC_Latin_1_Open_System_1047_Euro_symbol\";\r\n Encoding[Encoding[\"Japanese_JIS_0208_1990_and_0212_1990\"] = 20932] = \"Japanese_JIS_0208_1990_and_0212_1990\";\r\n Encoding[Encoding[\"Simplified_Chinese_GB2312_80\"] = 20936] = \"Simplified_Chinese_GB2312_80\";\r\n Encoding[Encoding[\"Korean_Wansung\"] = 20949] = \"Korean_Wansung\";\r\n Encoding[Encoding[\"IBM_EBCDIC_Cyrillic_Serbian_Bulgarian\"] = 21025] = \"IBM_EBCDIC_Cyrillic_Serbian_Bulgarian\";\r\n Encoding[Encoding[\"Extended_Ext_Alpha_Lowercase\"] = 21027] = \"Extended_Ext_Alpha_Lowercase\";\r\n Encoding[Encoding[\"Ukrainian_Cyrillic_KOI8_U\"] = 21866] = \"Ukrainian_Cyrillic_KOI8_U\";\r\n Encoding[Encoding[\"ISO_8859_1_Latin_1_Western_European\"] = 28591] = \"ISO_8859_1_Latin_1_Western_European\";\r\n Encoding[Encoding[\"ISO_8859_2_Latin_2_Central_European\"] = 28592] = \"ISO_8859_2_Latin_2_Central_European\";\r\n Encoding[Encoding[\"ISO_8859_3_Latin_3\"] = 28593] = \"ISO_8859_3_Latin_3\";\r\n Encoding[Encoding[\"ISO_8859_4_Baltic\"] = 28594] = \"ISO_8859_4_Baltic\";\r\n Encoding[Encoding[\"ISO_8859_5_Cyrillic\"] = 28595] = \"ISO_8859_5_Cyrillic\";\r\n Encoding[Encoding[\"ISO_8859_6_Arabic\"] = 28596] = \"ISO_8859_6_Arabic\";\r\n Encoding[Encoding[\"ISO_8859_7_Greek\"] = 28597] = \"ISO_8859_7_Greek\";\r\n Encoding[Encoding[\"ISO_8859_8_Hebrew_ISO_Visual\"] = 28598] = \"ISO_8859_8_Hebrew_ISO_Visual\";\r\n Encoding[Encoding[\"ISO_8859_9_Turkish\"] = 28599] = \"ISO_8859_9_Turkish\";\r\n Encoding[Encoding[\"ISO_8859_10_Latin_6\"] = 28600] = \"ISO_8859_10_Latin_6\";\r\n Encoding[Encoding[\"ISO_8859_11_Latin_Thai\"] = 28601] = \"ISO_8859_11_Latin_Thai\";\r\n Encoding[Encoding[\"ISO_8859_13_Latin_7_Estonian\"] = 28603] = \"ISO_8859_13_Latin_7_Estonian\";\r\n Encoding[Encoding[\"ISO_8859_14_Latin_8_Celtic\"] = 28604] = \"ISO_8859_14_Latin_8_Celtic\";\r\n Encoding[Encoding[\"ISO_8859_15_Latin_9\"] = 28605] = \"ISO_8859_15_Latin_9\";\r\n Encoding[Encoding[\"ISO_8859_15_Latin_10\"] = 28606] = \"ISO_8859_15_Latin_10\";\r\n Encoding[Encoding[\"Europa_3\"] = 29001] = \"Europa_3\";\r\n Encoding[Encoding[\"ISO_8859_8_Hebrew_ISO_Logical\"] = 38598] = \"ISO_8859_8_Hebrew_ISO_Logical\";\r\n Encoding[Encoding[\"Atari_ST_TT\"] = 47451] = \"Atari_ST_TT\";\r\n Encoding[Encoding[\"ISO_2022_JIS_Japanese_with_no_halfwidth_Katakana\"] = 50220] = \"ISO_2022_JIS_Japanese_with_no_halfwidth_Katakana\";\r\n Encoding[Encoding[\"ISO_2022_JIS_Japanese_with_halfwidth_Katakana\"] = 50221] = \"ISO_2022_JIS_Japanese_with_halfwidth_Katakana\";\r\n Encoding[Encoding[\"ISO_2022_Japanese_JIS_X_0201_1989_1_byte_Kana_SO_SI\"] = 50222] = \"ISO_2022_Japanese_JIS_X_0201_1989_1_byte_Kana_SO_SI\";\r\n Encoding[Encoding[\"ISO_2022_Korean\"] = 50225] = \"ISO_2022_Korean\";\r\n Encoding[Encoding[\"ISO_2022_Simplified_Chinese\"] = 50227] = \"ISO_2022_Simplified_Chinese\";\r\n Encoding[Encoding[\"EUC_Japanese\"] = 51932] = \"EUC_Japanese\";\r\n Encoding[Encoding[\"EUC_Simplified_Chinese\"] = 51936] = \"EUC_Simplified_Chinese\";\r\n Encoding[Encoding[\"EUC_Korean\"] = 51949] = \"EUC_Korean\";\r\n Encoding[Encoding[\"HZ_GB2312_Simplified_Chinese\"] = 52936] = \"HZ_GB2312_Simplified_Chinese\";\r\n Encoding[Encoding[\"GB18030_Simplified_Chinese_4_byte\"] = 54936] = \"GB18030_Simplified_Chinese_4_byte\";\r\n Encoding[Encoding[\"ISCII_Devanagari\"] = 57002] = \"ISCII_Devanagari\";\r\n Encoding[Encoding[\"ISCII_Bengali\"] = 57003] = \"ISCII_Bengali\";\r\n Encoding[Encoding[\"ISCII_Tamil\"] = 57004] = \"ISCII_Tamil\";\r\n Encoding[Encoding[\"ISCII_Telugu\"] = 57005] = \"ISCII_Telugu\";\r\n Encoding[Encoding[\"ISCII_Assamese\"] = 57006] = \"ISCII_Assamese\";\r\n Encoding[Encoding[\"ISCII_Oriya\"] = 57007] = \"ISCII_Oriya\";\r\n Encoding[Encoding[\"ISCII_Kannada\"] = 57008] = \"ISCII_Kannada\";\r\n Encoding[Encoding[\"ISCII_Malayalam\"] = 57009] = \"ISCII_Malayalam\";\r\n Encoding[Encoding[\"ISCII_Gujarati\"] = 57010] = \"ISCII_Gujarati\";\r\n Encoding[Encoding[\"ISCII_Punjabi\"] = 57011] = \"ISCII_Punjabi\";\r\n Encoding[Encoding[\"Unicode_UTF_7\"] = 65000] = \"Unicode_UTF_7\";\r\n Encoding[Encoding[\"Unicode_UTF_8\"] = 65001] = \"Unicode_UTF_8\";\r\n })(Encoding = JSPM.Encoding || (JSPM.Encoding = {}));\r\n var DuplexMode;\r\n (function (DuplexMode) {\r\n DuplexMode[DuplexMode[\"Default\"] = 0] = \"Default\";\r\n DuplexMode[DuplexMode[\"Simplex\"] = 1] = \"Simplex\";\r\n DuplexMode[DuplexMode[\"DuplexLongEdge\"] = 2] = \"DuplexLongEdge\";\r\n DuplexMode[DuplexMode[\"DuplexShortEdge\"] = 3] = \"DuplexShortEdge\";\r\n })(DuplexMode = JSPM.DuplexMode || (JSPM.DuplexMode = {}));\r\n var Sizing;\r\n (function (Sizing) {\r\n Sizing[Sizing[\"None\"] = 0] = \"None\";\r\n Sizing[Sizing[\"Fit\"] = 1] = \"Fit\";\r\n })(Sizing = JSPM.Sizing || (JSPM.Sizing = {}));\r\n var ScannerImageFormatOutput;\r\n (function (ScannerImageFormatOutput) {\r\n ScannerImageFormatOutput[ScannerImageFormatOutput[\"JPG\"] = 0] = \"JPG\";\r\n ScannerImageFormatOutput[ScannerImageFormatOutput[\"PNG\"] = 1] = \"PNG\";\r\n })(ScannerImageFormatOutput = JSPM.ScannerImageFormatOutput || (JSPM.ScannerImageFormatOutput = {}));\r\n var PixelMode;\r\n (function (PixelMode) {\r\n PixelMode[PixelMode[\"Grayscale\"] = 0] = \"Grayscale\";\r\n PixelMode[PixelMode[\"Color\"] = 1] = \"Color\";\r\n })(PixelMode = JSPM.PixelMode || (JSPM.PixelMode = {}));\r\n var FileSourceType;\r\n (function (FileSourceType) {\r\n FileSourceType[FileSourceType[\"Base64\"] = 0] = \"Base64\";\r\n FileSourceType[FileSourceType[\"Text\"] = 1] = \"Text\";\r\n FileSourceType[FileSourceType[\"BLOB\"] = 2] = \"BLOB\";\r\n FileSourceType[FileSourceType[\"URL\"] = 3] = \"URL\";\r\n })(FileSourceType = JSPM.FileSourceType || (JSPM.FileSourceType = {}));\r\n ;\r\n var WSStatus;\r\n (function (WSStatus) {\r\n WSStatus[WSStatus[\"Open\"] = 0] = \"Open\";\r\n WSStatus[WSStatus[\"Closed\"] = 1] = \"Closed\";\r\n WSStatus[WSStatus[\"Blocked\"] = 2] = \"Blocked\";\r\n WSStatus[WSStatus[\"WaitingForUserResponse\"] = 3] = \"WaitingForUserResponse\";\r\n })(WSStatus = JSPM.WSStatus || (JSPM.WSStatus = {}));\r\n ;\r\n var PrintRotation;\r\n (function (PrintRotation) {\r\n PrintRotation[PrintRotation[\"None\"] = 0] = \"None\";\r\n PrintRotation[PrintRotation[\"Rot90\"] = 1] = \"Rot90\";\r\n PrintRotation[PrintRotation[\"Rot180\"] = 2] = \"Rot180\";\r\n PrintRotation[PrintRotation[\"Rot270\"] = 3] = \"Rot270\";\r\n })(PrintRotation = JSPM.PrintRotation || (JSPM.PrintRotation = {}));\r\n var TextAlignment;\r\n (function (TextAlignment) {\r\n TextAlignment[TextAlignment[\"Left\"] = 0] = \"Left\";\r\n TextAlignment[TextAlignment[\"Center\"] = 1] = \"Center\";\r\n TextAlignment[TextAlignment[\"Right\"] = 2] = \"Right\";\r\n TextAlignment[TextAlignment[\"Justify\"] = 3] = \"Justify\";\r\n TextAlignment[TextAlignment[\"None\"] = 4] = \"None\";\r\n })(TextAlignment = JSPM.TextAlignment || (JSPM.TextAlignment = {}));\r\n var PrintOrientation;\r\n (function (PrintOrientation) {\r\n PrintOrientation[PrintOrientation[\"Portrait\"] = 0] = \"Portrait\";\r\n PrintOrientation[PrintOrientation[\"Landscape\"] = 1] = \"Landscape\";\r\n })(PrintOrientation = JSPM.PrintOrientation || (JSPM.PrintOrientation = {}));\r\n})(JSPM || (JSPM = {}));\r\n(function (JSPM) {\r\n var Serial;\r\n (function (Serial) {\r\n var Parity;\r\n (function (Parity) {\r\n Parity[Parity[\"None\"] = 0] = \"None\";\r\n Parity[Parity[\"Odd\"] = 1] = \"Odd\";\r\n Parity[Parity[\"Even\"] = 2] = \"Even\";\r\n Parity[Parity[\"Mark\"] = 3] = \"Mark\";\r\n Parity[Parity[\"Space\"] = 4] = \"Space\";\r\n })(Parity = Serial.Parity || (Serial.Parity = {}));\r\n var StopBits;\r\n (function (StopBits) {\r\n StopBits[StopBits[\"One\"] = 0] = \"One\";\r\n StopBits[StopBits[\"OnePointFive\"] = 1] = \"OnePointFive\";\r\n StopBits[StopBits[\"Two\"] = 2] = \"Two\";\r\n })(StopBits = Serial.StopBits || (Serial.StopBits = {}));\r\n var DataBits;\r\n (function (DataBits) {\r\n DataBits[DataBits[\"Eight\"] = 0] = \"Eight\";\r\n DataBits[DataBits[\"Seven\"] = 1] = \"Seven\";\r\n DataBits[DataBits[\"Six\"] = 2] = \"Six\";\r\n DataBits[DataBits[\"Five\"] = 3] = \"Five\";\r\n })(DataBits = Serial.DataBits || (Serial.DataBits = {}));\r\n var Handshake;\r\n (function (Handshake) {\r\n Handshake[Handshake[\"None\"] = 0] = \"None\";\r\n Handshake[Handshake[\"RequestToSend\"] = 1] = \"RequestToSend\";\r\n Handshake[Handshake[\"RequestToSendXOnXOff\"] = 2] = \"RequestToSendXOnXOff\";\r\n Handshake[Handshake[\"XOnXOff\"] = 3] = \"XOnXOff\";\r\n })(Handshake = Serial.Handshake || (Serial.Handshake = {}));\r\n })(Serial = JSPM.Serial || (JSPM.Serial = {}));\r\n})(JSPM || (JSPM = {}));\r\nvar JSPM;\r\n(function (JSPM) {\r\n var JSPrintManager = (function () {\r\n function JSPrintManager() {\r\n }\r\n Object.defineProperty(JSPrintManager, \"session_certificate\", {\r\n get: function () {\r\n return this._ses_cert;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n JSPrintManager.start = function (secure, host, port) {\r\n if (secure === void 0) { secure = true; }\r\n if (host === void 0) { host = 'localhost'; }\r\n if (port === void 0) { port = 24443; }\r\n return __awaiter(this, void 0, void 0, function () {\r\n var ws;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (!this.WS)\r\n this.WS = new JSPM.NDWS(host, port, secure, this.auto_reconnect);\r\n this.WS.onStatusChanged = this.onStatusChanged;\r\n return [4, this.WS.start()];\r\n case 1:\r\n ws = _a.sent();\r\n return [2, ws];\r\n }\r\n });\r\n });\r\n };\r\n Object.defineProperty(JSPrintManager, \"license_url\", {\r\n get: function () {\r\n return this._license;\r\n },\r\n set: function (value) {\r\n this._license = value;\r\n if (this.WS && this.WS.status == JSPM.WSStatus.Open)\r\n this.WS.send(JSON.stringify({ url: this._license }), {\r\n type: \"set_license\",\r\n on_update: function (_) { }, on_error: function (_) { }\r\n });\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n JSPrintManager.getPrinters = function () {\r\n var _this = this;\r\n return new Promise(function (ok, err) {\r\n _this.WS.send('', {\r\n type: 'printers_list',\r\n on_update: function (data) {\r\n if (data && 'result' in data)\r\n ok(data.result);\r\n else\r\n ok(data);\r\n },\r\n on_error: function (data) { return err(data); }\r\n });\r\n });\r\n };\r\n JSPrintManager.getSessionCertificate = function () {\r\n var _this = this;\r\n return new Promise(function (ok, err) {\r\n _this.WS.send('', {\r\n type: 'session_certificate',\r\n on_update: function (data) {\r\n if (data && 'result' in data)\r\n ok(data.result);\r\n else\r\n ok(data);\r\n },\r\n on_error: function (data) { return err(data); }\r\n });\r\n });\r\n };\r\n JSPrintManager.getPrintersInfo = function (detail_level, printer_name) {\r\n var _this = this;\r\n if (detail_level === void 0) { detail_level = JSPM.PrintersInfoLevel.Basic; }\r\n if (printer_name === void 0) { printer_name = ''; }\r\n return new Promise(function (ok, err) {\r\n var data = { 'detail_level': detail_level };\r\n if (printer_name)\r\n data['printer_name'] = printer_name;\r\n _this.WS.send(JSON.stringify(data), {\r\n type: 'printers_complete_list',\r\n on_update: function (data) {\r\n if (data && 'result' in data)\r\n ok(data.result);\r\n else\r\n ok(data);\r\n },\r\n on_error: function (data) { return err(data); }\r\n });\r\n });\r\n };\r\n Object.defineProperty(JSPrintManager, \"websocket_status\", {\r\n get: function () {\r\n return this.WS ? this.WS.status : JSPM.WSStatus.Closed;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n JSPrintManager.showAbout = function () {\r\n var _this = this;\r\n return new Promise(function (ok, err) {\r\n _this.WS.send('', {\r\n type: 'about',\r\n on_update: function (data) {\r\n if (data && 'result' in data)\r\n ok(data.result);\r\n else\r\n ok(data);\r\n },\r\n on_error: function (data) { return err(data); }\r\n });\r\n });\r\n };\r\n JSPrintManager.updateClient = function () {\r\n var _this = this;\r\n return new Promise(function (ok, err) {\r\n _this.WS.send('', {\r\n type: 'update',\r\n on_update: function (data) {\r\n if (data && 'result' in data)\r\n ok(data.result);\r\n else\r\n ok(data);\r\n },\r\n on_error: function (data) { return err(data); }\r\n });\r\n });\r\n };\r\n JSPrintManager.getSystemFonts = function () {\r\n var _this = this;\r\n return new Promise(function (ok, err) {\r\n _this.WS.send('', {\r\n type: 'fonts_list',\r\n on_update: function (data) {\r\n if (data && 'result' in data)\r\n ok(data.result);\r\n else\r\n ok(data);\r\n },\r\n on_error: function (data) { return err(data); }\r\n });\r\n });\r\n };\r\n JSPrintManager.getSerialPorts = function () {\r\n var _this = this;\r\n return new Promise(function (ok, err) {\r\n _this.WS.send('', {\r\n type: 'serial_ports_list',\r\n on_update: function (data) {\r\n if (data && 'result' in data)\r\n ok(data.result);\r\n else\r\n ok(data);\r\n },\r\n on_error: function (data) { return err(data); }\r\n });\r\n });\r\n };\r\n JSPrintManager.getScanners = function () {\r\n var _this = this;\r\n return new Promise(function (ok, err) {\r\n _this.WS.send('', {\r\n type: 'scanner_list',\r\n on_update: function (data) {\r\n if (data && 'result' in data)\r\n ok(data.result);\r\n else\r\n ok(data);\r\n },\r\n on_error: function (data) { return err(data); }\r\n });\r\n });\r\n };\r\n JSPrintManager.onPrinterCreated = function (callback, error, detail_level) {\r\n if (detail_level === void 0) { detail_level = JSPM.PrintersInfoLevel.Extended; }\r\n if (detail_level == JSPM.PrintersInfoLevel.Basic)\r\n throw \"Basic detail level information is not implemented yet\";\r\n if (navigator.platform.toLowerCase().indexOf(\"win\") < 0)\r\n throw \"This functionality is Windows only\";\r\n return this.WS.send('', {\r\n type: 'on_printer_creation',\r\n on_update: function (data) { return callback(data); },\r\n on_error: function (data) { return error(data); }\r\n });\r\n };\r\n JSPrintManager.onPrinterUpdated = function (callback, error, detail_level) {\r\n if (detail_level === void 0) { detail_level = JSPM.PrintersInfoLevel.Extended; }\r\n if (detail_level == JSPM.PrintersInfoLevel.Basic)\r\n throw \"Basic detail level information is not implemented yet\";\r\n if (navigator.platform.toLowerCase().indexOf(\"win\") < 0)\r\n throw \"This functionality is Windows only\";\r\n return this.WS.send('', {\r\n type: 'on_printer_modification',\r\n on_update: function (data) { return callback(data); },\r\n on_error: function (data) { return error(data); }\r\n });\r\n };\r\n JSPrintManager.onPrinterDeleted = function (callback, error, detail_level) {\r\n if (detail_level === void 0) { detail_level = JSPM.PrintersInfoLevel.Extended; }\r\n if (detail_level == JSPM.PrintersInfoLevel.Basic)\r\n throw \"Basic detail level information is not implemented yet\";\r\n if (navigator.platform.toLowerCase().indexOf(\"win\") < 0)\r\n throw \"This functionality is Windows only\";\r\n return this.WS.send('', {\r\n type: 'on_printer_deletion',\r\n on_update: function (data) { return callback(data); },\r\n on_error: function (data) { return error(data); }\r\n });\r\n };\r\n JSPrintManager.unsubscribePrinterEvent = function (id) {\r\n var _this = this;\r\n return new Promise(function (ok, err) {\r\n return _this.WS.send(JSON.stringify({ close: true }), {\r\n id: id,\r\n type: 'on_printer_deletion',\r\n on_update: function (data) { return ok(data); },\r\n on_error: function (data) { return err(data); }\r\n });\r\n });\r\n };\r\n JSPrintManager.stop = function () {\r\n this.WS.stop();\r\n };\r\n JSPrintManager._ses_cert = \"\";\r\n JSPrintManager.auto_reconnect = false;\r\n JSPrintManager._license = document.location.origin + \"/jspm\";\r\n JSPrintManager.onStatusChanged = function () { };\r\n return JSPrintManager;\r\n }());\r\n JSPM.JSPrintManager = JSPrintManager;\r\n})(JSPM || (JSPM = {}));\r\nvar JSPM;\r\n(function (JSPM) {\r\n var NDWS = (function () {\r\n function NDWS(addr, port, secure, auto_reconnect) {\r\n if (addr === void 0) { addr = 'localhost'; }\r\n if (port === void 0) { port = 24443; }\r\n if (secure === void 0) { secure = true; }\r\n if (auto_reconnect === void 0) { auto_reconnect = false; }\r\n this._job_list = [];\r\n this._processing_message = new JSPM.Mutex();\r\n this.autoReconnect = false;\r\n this.onClose = function (e) { };\r\n this.onOpen = function (e) { };\r\n this.onStatusChanged = function () { };\r\n this._addr = addr;\r\n this._port = port;\r\n this._secure = secure;\r\n this.autoReconnect = auto_reconnect;\r\n }\r\n Object.defineProperty(NDWS.prototype, \"address\", {\r\n get: function () {\r\n return this._addr;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(NDWS.prototype, \"port\", {\r\n get: function () {\r\n return this._port;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(NDWS.prototype, \"isSecure\", {\r\n get: function () {\r\n return this._secure;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(NDWS.prototype, \"status\", {\r\n get: function () {\r\n return this._status;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n NDWS.prototype._onOpen = function (e, __this) {\r\n this._status = JSPM.WSStatus.WaitingForUserResponse;\r\n this._pingPong();\r\n __this.onStatusChanged();\r\n __this.onOpen(e);\r\n };\r\n NDWS.prototype._onMessage = function (e) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var unlock, json_data, job, last, msg_type, data, critical, blob, id_buf, id, data_blob, job, err_1;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4, this._processing_message.lock()];\r\n case 1:\r\n unlock = _a.sent();\r\n _a.label = 2;\r\n case 2:\r\n _a.trys.push([2, 6, 7, 8]);\r\n if (!(typeof (e.data) == 'string')) return [3, 3];\r\n json_data = JSON.parse(e.data);\r\n job = this._job_list[json_data.id];\r\n if (!job)\r\n throw \"Job \" + json_data.id + \" doesn't exist\";\r\n last = ('last' in json_data) ? json_data.last : false;\r\n msg_type = ('type' in json_data) ? json_data.type : 'message';\r\n data = ('data' in json_data) ? json_data.data : {};\r\n switch (msg_type) {\r\n case 'message':\r\n {\r\n if (job.on_update && typeof (job.on_update === \"function\"))\r\n job.on_update(data, job.first_update, last);\r\n }\r\n break;\r\n case 'error':\r\n {\r\n critical = 'critical' in json_data ?\r\n json_data.critical : false;\r\n if (job.on_error && typeof (job.on_error === \"function\"))\r\n job.on_error(data, job.first_update, critical);\r\n }\r\n break;\r\n default: {\r\n if (job.on_update && typeof (job.on_update === \"function\"))\r\n job.on_update(data, job.first_update, last);\r\n }\r\n }\r\n if (last)\r\n delete this._job_list[json_data.id];\r\n return [3, 5];\r\n case 3:\r\n blob = e.data;\r\n return [4, blob.slice(blob.size - 8, blob.size).arrayBuffer()];\r\n case 4:\r\n id_buf = _a.sent();\r\n id = new TextDecoder('utf-8').decode(id_buf);\r\n data_blob = blob.slice(0, blob.size - 8);\r\n job = this._job_list[id];\r\n if (!job)\r\n throw \"Job \" + id + \" doesn't exist\";\r\n if (job.on_update && typeof (job.on_update === \"function\"))\r\n job.on_update(data_blob, job.first_update, false);\r\n _a.label = 5;\r\n case 5:\r\n job.first_update = false;\r\n return [3, 8];\r\n case 6:\r\n err_1 = _a.sent();\r\n throw \"Malformed message. Error: \" + err_1 + \" Message: \" + e.data;\r\n case 7:\r\n unlock();\r\n return [7];\r\n case 8: return [2];\r\n }\r\n });\r\n });\r\n };\r\n NDWS.prototype._onError = function (e) {\r\n try {\r\n var json_data = JSON.parse(e);\r\n var job = this._job_list[json_data.id];\r\n if (!job)\r\n throw e;\r\n job.on_error(e, true, true);\r\n }\r\n catch (_a) {\r\n throw e;\r\n }\r\n };\r\n NDWS.prototype._pingPong = function () {\r\n var _this = this;\r\n setInterval(function (_) {\r\n if (_this._status != JSPM.WSStatus.Open)\r\n return;\r\n _this.send('', {\r\n type: 'ping',\r\n on_update: function (_) { },\r\n on_error: function (_) { }\r\n });\r\n }, 30000);\r\n };\r\n NDWS.prototype._onClose = function (e, __this) {\r\n var _this = this;\r\n if (e.code == 403)\r\n this._status = JSPM.WSStatus.Blocked;\r\n else {\r\n this._status = JSPM.WSStatus.Closed;\r\n if (this.autoReconnect)\r\n setTimeout(function (_) {\r\n _this.start();\r\n }, 2000);\r\n }\r\n __this.onClose(e);\r\n __this.onStatusChanged();\r\n };\r\n ;\r\n NDWS.prototype._genID = function () {\r\n return Math.floor((1 + Math.random()) * 0x100000000)\r\n .toString(16)\r\n .substring(1);\r\n };\r\n NDWS.prototype._send = function (data, properties) {\r\n var id = \"\";\r\n if ('id' in properties) {\r\n id = properties.id;\r\n }\r\n else {\r\n do {\r\n var id = this._genID();\r\n } while (this._job_list[id]);\r\n this._job_list[id] = {\r\n id: id,\r\n first_update: true,\r\n on_update: properties['on_update'],\r\n on_error: properties['on_error']\r\n };\r\n }\r\n var _data = '';\r\n if (data instanceof Blob) {\r\n var job_id = new Uint8Array(('id' + id).split('')\r\n .map(function (a) { return a.charCodeAt(0); }));\r\n _data = new Blob([data, job_id]);\r\n }\r\n else if (typeof data == 'string') {\r\n _data = { id: id, data: data };\r\n if ('type' in properties) {\r\n _data['type'] = properties.type;\r\n }\r\n _data = JSON.stringify(_data);\r\n }\r\n else {\r\n delete this._job_list[id];\r\n _data = data;\r\n }\r\n this._ws.send(_data);\r\n return id;\r\n };\r\n NDWS.prototype.start = function () {\r\n var _this = this;\r\n return new Promise(function (ok, err) {\r\n try {\r\n _this._ws = new WebSocket((_this._secure ? 'wss://' : 'ws://') +\r\n _this._addr + ':' + _this._port);\r\n _this._ws.onclose = function (e) { return _this._onClose(e, _this); };\r\n _this._ws.onerror = function (i) {\r\n err(i);\r\n };\r\n _this._ws.onopen = function (i) {\r\n _this._ws.onopen = function (e) { return _this._onOpen(e, _this); };\r\n _this._ws.onmessage = function (e) {\r\n try {\r\n var json = JSON.parse(e.data);\r\n if ('connection' in json) {\r\n if (json.connection == 'CONNECTED') {\r\n _this._status = JSPM.WSStatus.Open;\r\n _this.onStatusChanged();\r\n _this.onOpen(json.certificate);\r\n JSPM.JSPrintManager._ses_cert = json.certificate;\r\n _this.send(JSON.stringify({ url: JSPM.JSPrintManager.license_url }), {\r\n type: \"set_license\",\r\n on_update: function (v) { console.info(\"JSPrintManager License:\", 'result' in v ? v['result'] : v); },\r\n on_error: function (v) { console.warn(\"JSPrintManager License:\", 'result' in v ? v['result'] : v); },\r\n });\r\n var verArray = json.version.split('.');\r\n if (verArray[0] + '.' + verArray[1] != JSPM.VERSION) {\r\n console.warn(\"Lib JS version and \" +\r\n \"desktop version differs Desktop(\" +\r\n json.version + \") JS (\" + JSPM.VERSION +\r\n \")\");\r\n }\r\n _this._ws.onmessage = function (e) { return __awaiter(_this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4, this._onMessage(e)];\r\n case 1:\r\n _a.sent();\r\n return [2];\r\n }\r\n });\r\n }); };\r\n _this._ws.onerror = _this._onError;\r\n ok();\r\n }\r\n else {\r\n err(\"WS Connection not established. Reason: \" + json.connection);\r\n }\r\n }\r\n }\r\n catch (e) {\r\n err(\"Malformed message. Check if JS version \" +\r\n \"and Desktop version are the same. Description: \" + e);\r\n }\r\n };\r\n };\r\n }\r\n catch (e) {\r\n if (_this.autoReconnect)\r\n setTimeout(function () {\r\n _this.start().then(ok).catch(err);\r\n }, 2000);\r\n else\r\n err(e);\r\n }\r\n });\r\n };\r\n NDWS.prototype.send = function (data, properties) {\r\n if (this._status == JSPM.WSStatus.Closed)\r\n properties['on_first_error'](\"The WebSocket connection is closed\");\r\n else if (this._status == JSPM.WSStatus.Blocked)\r\n properties['on_first_error'](\"The site is blocked and the connection was closed\");\r\n else if (this._ws.readyState != this._ws.OPEN)\r\n properties['on_first_error'](\"The WebSocket isn't ready yet\");\r\n return this._send(data, properties);\r\n };\r\n NDWS.prototype.stop = function () {\r\n if (this._ws) {\r\n this._ws.close();\r\n this._ws = null;\r\n }\r\n };\r\n return NDWS;\r\n }());\r\n JSPM.NDWS = NDWS;\r\n})(JSPM || (JSPM = {}));\r\nvar JSPM;\r\n(function (JSPM) {\r\n var PrintFile = (function () {\r\n function PrintFile(fileContent, fileContentType, fileName, copies) {\r\n this.fileName = \"\";\r\n this._copies = 1;\r\n this.fileContent = fileContent;\r\n this.fileContentType = fileContentType;\r\n if (!fileName)\r\n throw \"You must specify a FileName including the extension.\";\r\n this.fileName = fileName;\r\n if (copies)\r\n this.copies = copies;\r\n this.escapeInvalidFileNameChars();\r\n }\r\n Object.defineProperty(PrintFile.prototype, \"copies\", {\r\n get: function () {\r\n return this._copies;\r\n },\r\n set: function (value) {\r\n if (value < 1)\r\n throw \"Copies must be greater than or equal to 1.\";\r\n this._copies = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n PrintFile.prototype.escapeInvalidFileNameChars = function () {\r\n if (this.fileName.indexOf(\"\\\\\") > -1)\r\n this.fileName = this.fileName.replace(\"\\\\\", \"BACKSLASHCHAR\");\r\n };\r\n PrintFile.prototype.bool2str = function (value, true_val, false_val) {\r\n if (true_val === void 0) { true_val = '1'; }\r\n if (false_val === void 0) { false_val = '0'; }\r\n return value ? true_val : false_val;\r\n };\r\n PrintFile.prototype.getProperties = function () {\r\n return {\r\n file_type: JSPM.PrintFileType.Generic,\r\n file_name: this.fileName,\r\n copies: this._copies\r\n };\r\n };\r\n PrintFile.prototype.isValidRange = function (range) {\r\n range = range.replace(/\\s/g, '');\r\n if (range == null || range == '')\r\n return true;\r\n var reg = /([0-9])+((-[0-9]+)|(,[0-9]+))*/;\r\n var test = reg.exec(range);\r\n if (test == null)\r\n return false;\r\n if (test[0].length != range.length)\r\n return false;\r\n return true;\r\n };\r\n PrintFile.prototype._getBLOBContent = function (fileContentType, fileContent) {\r\n return new Promise(function (ok, err) {\r\n switch (fileContentType) {\r\n case JSPM.FileSourceType.BLOB:\r\n {\r\n ok(fileContent);\r\n }\r\n break;\r\n case JSPM.FileSourceType.Base64:\r\n {\r\n try {\r\n var chars = atob(fileContent);\r\n var bytes = new Uint8Array(chars.length);\r\n for (var i = 0; i < chars.length; i++) {\r\n bytes[i] = chars.charCodeAt(i);\r\n }\r\n ok(new Blob([bytes]));\r\n }\r\n catch (e) {\r\n err('Error trying to decode the base64 data.\\n' + e);\r\n }\r\n }\r\n break;\r\n case JSPM.FileSourceType.Text:\r\n {\r\n try {\r\n var bytes = new Uint8Array(fileContent.length);\r\n for (var i = 0; i < fileContent.length; i++) {\r\n bytes[i] = fileContent.charCodeAt(i);\r\n }\r\n ok(new Blob([bytes]));\r\n }\r\n catch (e) {\r\n err('Error trying to decode the text data.\\n' + e);\r\n }\r\n }\r\n break;\r\n case JSPM.FileSourceType.URL:\r\n {\r\n var xhr_1 = new XMLHttpRequest();\r\n xhr_1.open('GET', fileContent, true);\r\n xhr_1.responseType = 'blob';\r\n xhr_1.onload = function (oEvent) {\r\n ok(xhr_1.response);\r\n };\r\n xhr_1.send(null);\r\n }\r\n break;\r\n default: err('FileSourceType not specified');\r\n }\r\n });\r\n };\r\n PrintFile.prototype.getContent = function () {\r\n var _this = this;\r\n return new Promise(function (ok, err) {\r\n switch (_this.fileContentType) {\r\n case JSPM.FileSourceType.Base64:\r\n {\r\n ok(new zip.Data64URIReader(_this.fileContent));\r\n }\r\n break;\r\n case JSPM.FileSourceType.BLOB:\r\n {\r\n ok(new zip.BlobReader(_this.fileContent));\r\n }\r\n break;\r\n case JSPM.FileSourceType.Text:\r\n {\r\n ok(new zip.TextReader(_this.fileContent));\r\n }\r\n break;\r\n case JSPM.FileSourceType.URL:\r\n {\r\n var xhr_2 = new XMLHttpRequest();\r\n xhr_2.open('GET', _this.fileContent, true);\r\n xhr_2.responseType = 'blob';\r\n xhr_2.onload = function (oEvent) {\r\n ok(new zip.BlobReader(xhr_2.response));\r\n };\r\n xhr_2.send(null);\r\n }\r\n break;\r\n default: err(\"The file content type is invalid\");\r\n }\r\n });\r\n };\r\n return PrintFile;\r\n }());\r\n JSPM.PrintFile = PrintFile;\r\n var PrintFileDuplexable = (function (_super) {\r\n __extends(PrintFileDuplexable, _super);\r\n function PrintFileDuplexable() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this.manualDuplexMessage = \"\";\r\n _this.manualDuplex = false;\r\n _this.printInReverseOrder = false;\r\n _this.printRange = '';\r\n return _this;\r\n }\r\n return PrintFileDuplexable;\r\n }(PrintFile));\r\n JSPM.PrintFileDuplexable = PrintFileDuplexable;\r\n})(JSPM || (JSPM = {}));\r\nvar JSPM;\r\n(function (JSPM) {\r\n var PrintFileDOC = (function (_super) {\r\n __extends(PrintFileDOC, _super);\r\n function PrintFileDOC(fileContent, fileContentType, fileName, copies) {\r\n var _this = _super.call(this, fileContent, fileContentType, fileName, copies) || this;\r\n _this.encryptedPassword = \"\";\r\n return _this;\r\n }\r\n PrintFileDOC.prototype.getProperties = function () {\r\n return {\r\n file_type: JSPM.PrintFileType.WDOC,\r\n file_name: this.fileName,\r\n copies: this.copies,\r\n manual_duplex: this.manualDuplex,\r\n reverse: this.printInReverseOrder,\r\n duplex_message: this.manualDuplexMessage,\r\n range: this.printRange,\r\n password: this.encryptedPassword,\r\n };\r\n };\r\n PrintFileDOC.prototype.getContent = function () {\r\n var _this = this;\r\n return new Promise(function (ok, err) {\r\n if (!_this.isValidRange(_this.printRange))\r\n err('Invalid Print Range');\r\n _this._getBLOBContent(_this.fileContentType, _this.fileContent)\r\n .then(function (file_content) {\r\n ok(new zip.BlobReader(file_content));\r\n })\r\n .catch(function (reason) { return err(reason); });\r\n });\r\n };\r\n return PrintFileDOC;\r\n }(JSPM.PrintFileDuplexable));\r\n JSPM.PrintFileDOC = PrintFileDOC;\r\n})(JSPM || (JSPM = {}));\r\nvar JSPM;\r\n(function (JSPM) {\r\n var PrintFileGroup = (function (_super) {\r\n __extends(PrintFileGroup, _super);\r\n function PrintFileGroup(fileContent, fileName, copies) {\r\n return _super.call(this, fileContent, JSPM.FileSourceType.BLOB, fileName, copies) || this;\r\n }\r\n PrintFileGroup.prototype.getProperties = function () {\r\n return {\r\n file_type: JSPM.PrintFileType.Group,\r\n file_name: this.fileName,\r\n range: this.printRange,\r\n copies: this.copies,\r\n manual_duplex: this.manualDuplex,\r\n reverse: this.printInReverseOrder,\r\n duplex_message: this.manualDuplexMessage\r\n };\r\n };\r\n PrintFileGroup.prototype._getBLOBContent = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n return [2, new Promise(function (ok, err) { return __awaiter(_this, void 0, void 0, function () {\r\n var writer, zipped_files, e_2;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n _a.trys.push([0, 2, , 3]);\r\n writer = new zip.ZipWriter(new zip.BlobWriter(\"application/zip\"));\r\n zipped_files = this.fileContent.map(function (file) { return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {\r\n var blob_content, e_3;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n _a.trys.push([0, 3, , 4]);\r\n return [4, _super.prototype._getBLOBContent.call(this, file.fileContentType, file.fileContent)];\r\n case 1:\r\n blob_content = _a.sent();\r\n return [4, writer.add(file.fileName, new zip.BlobReader(blob_content))];\r\n case 2:\r\n _a.sent();\r\n resolve();\r\n return [3, 4];\r\n case 3:\r\n e_3 = _a.sent();\r\n reject(e_3);\r\n return [3, 4];\r\n case 4: return [2];\r\n }\r\n });\r\n }); }); });\r\n return [4, writer.add(\"metadata.json\", new zip.BlobReader(new Blob([JSON.stringify(this.fileContent.map(function (pf) { return pf.getProperties(); }))])))];\r\n case 1:\r\n _a.sent();\r\n Promise.all(zipped_files).then(function (_) { return __awaiter(_this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n writer.close().then(function (zip_f) { return ok(zip_f); }).catch(function (e) { return err(e); });\r\n return [2];\r\n });\r\n }); }).catch(function (e) { return err(e); });\r\n return [3, 3];\r\n case 2:\r\n e_2 = _a.sent();\r\n err(e_2);\r\n return [3, 3];\r\n case 3: return [2];\r\n }\r\n });\r\n }); })];\r\n });\r\n });\r\n };\r\n PrintFileGroup.prototype.getContent = function () {\r\n var _this = this;\r\n return new Promise(function (ok, err) { return __awaiter(_this, void 0, void 0, function () {\r\n var file_content;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4, this._getBLOBContent()];\r\n case 1:\r\n file_content = _a.sent();\r\n ok(new zip.BlobReader(file_content));\r\n return [2];\r\n }\r\n });\r\n }); });\r\n };\r\n return PrintFileGroup;\r\n }(JSPM.PrintFileDuplexable));\r\n JSPM.PrintFileGroup = PrintFileGroup;\r\n})(JSPM || (JSPM = {}));\r\nvar JSPM;\r\n(function (JSPM) {\r\n var PrintFilePDF = (function (_super) {\r\n __extends(PrintFilePDF, _super);\r\n function PrintFilePDF(fileContent, fileContentType, fileName, copies) {\r\n var _this = _super.call(this, fileContent, fileContentType, fileName, copies) || this;\r\n _this.pageSizing = JSPM.Sizing.None;\r\n _this.printAutoRotate = false;\r\n _this.printAutoCenter = false;\r\n _this.encryptedPassword = \"\";\r\n _this.printAsGrayscale = false;\r\n _this.printAnnotations = false;\r\n _this.printRotation = JSPM.PrintRotation.None;\r\n return _this;\r\n }\r\n PrintFilePDF.prototype.getProperties = function () {\r\n return {\r\n file_type: JSPM.PrintFileType.WPDF,\r\n file_name: this.fileName,\r\n copies: this.copies,\r\n manual_duplex: this.manualDuplex,\r\n grayscale: this.printAsGrayscale,\r\n annotations: this.printAnnotations,\r\n reverse: this.printInReverseOrder,\r\n auto_rotate: this.printAutoRotate,\r\n auto_center: this.printAutoCenter,\r\n duplex_message: this.manualDuplexMessage,\r\n range: this.printRange,\r\n password: this.encryptedPassword,\r\n rotation: this.printRotation,\r\n sizing: this.pageSizing\r\n };\r\n };\r\n PrintFilePDF.prototype.getContent = function () {\r\n var _this = this;\r\n return new Promise(function (ok, err) {\r\n var SEP = ';';\r\n if (!_this.isValidRange(_this.printRange))\r\n err('Invalid Print Range');\r\n _this._getBLOBContent(_this.fileContentType, _this.fileContent)\r\n .then(function (file_content) {\r\n ok(new zip.BlobReader(file_content));\r\n })\r\n .catch(function (reason) { return err(reason); });\r\n });\r\n };\r\n return PrintFilePDF;\r\n }(JSPM.PrintFileDuplexable));\r\n JSPM.PrintFilePDF = PrintFilePDF;\r\n})(JSPM || (JSPM = {}));\r\nvar JSPM;\r\n(function (JSPM) {\r\n var PrintFileTIF = (function (_super) {\r\n __extends(PrintFileTIF, _super);\r\n function PrintFileTIF(fileContent, fileContentType, fileName, copies) {\r\n var _this = _super.call(this, fileContent, fileContentType, fileName, copies) || this;\r\n _this.printAutoRotate = false;\r\n _this.printAutoCenter = false;\r\n _this.printAsGrayscale = false;\r\n _this.printRotation = JSPM.PrintRotation.None;\r\n _this.pageSizing = JSPM.Sizing.None;\r\n return _this;\r\n }\r\n PrintFileTIF.prototype.isValidRange = function (range) {\r\n if (range == null || range == '')\r\n return true;\r\n var reg = /([0-9])+((-[0-9]+)|(,[0-9]+))*/;\r\n var test = reg.exec(range);\r\n if (test == null)\r\n return false;\r\n if (test[0].length != range.length)\r\n return false;\r\n return true;\r\n };\r\n PrintFileTIF.prototype.getProperties = function () {\r\n return {\r\n file_type: JSPM.PrintFileType.WTIF,\r\n file_name: this.fileName,\r\n copies: this.copies,\r\n manual_duplex: this.manualDuplex,\r\n grayscale: this.printAsGrayscale,\r\n reverse: this.printInReverseOrder,\r\n auto_rotate: this.printAutoRotate,\r\n auto_center: this.printAutoCenter,\r\n duplex_message: this.manualDuplexMessage,\r\n range: this.printRange,\r\n rotation: this.printRotation,\r\n sizing: this.pageSizing\r\n };\r\n };\r\n PrintFileTIF.prototype.getContent = function () {\r\n var _this = this;\r\n return new Promise(function (ok, err) {\r\n var SEP = ';';\r\n if (!_this.isValidRange(_this.printRange))\r\n err('Invalid Print Range');\r\n _this._getBLOBContent(_this.fileContentType, _this.fileContent)\r\n .then(function (file_content) {\r\n ok(new zip.BlobReader(file_content));\r\n })\r\n .catch(function (reason) { return err(reason); });\r\n });\r\n };\r\n return PrintFileTIF;\r\n }(JSPM.PrintFileDuplexable));\r\n JSPM.PrintFileTIF = PrintFileTIF;\r\n})(JSPM || (JSPM = {}));\r\nvar JSPM;\r\n(function (JSPM) {\r\n var PrintFileTXT = (function (_super) {\r\n __extends(PrintFileTXT, _super);\r\n function PrintFileTXT(fileContent, fileName, copies, fileContentType) {\r\n var _this = _super.call(this, fileContent, fileContentType ? fileContentType : JSPM.FileSourceType.Text, fileName, copies) || this;\r\n _this.textContent = '';\r\n _this.textAligment = JSPM.TextAlignment.Left;\r\n _this.fontName = '';\r\n _this.fontBold = false;\r\n _this.fontItalic = false;\r\n _this.fontUnderline = false;\r\n _this.fontStrikethrough = false;\r\n _this.fontSize = 10;\r\n _this.fontColor = '#000000';\r\n _this.printOrientation = JSPM.PrintOrientation.Portrait;\r\n _this.marginLeft = 0.5;\r\n _this.marginRight = 0.5;\r\n _this.marginTop = 0.5;\r\n _this.marginBottom = 0.5;\r\n return _this;\r\n }\r\n PrintFileTXT.prototype.getProperties = function () {\r\n return {\r\n file_name: this.fileName,\r\n file_type: JSPM.PrintFileType.WTXT,\r\n alignment: this.textAligment,\r\n bold: this.fontBold,\r\n color: this.fontColor,\r\n copies: this.copies,\r\n font_name: this.fontName,\r\n font_size: this.fontSize,\r\n italic: this.fontItalic,\r\n margin_bottom: this.marginBottom,\r\n margin_left: this.marginLeft,\r\n margin_right: this.marginRight,\r\n margin_top: this.marginTop,\r\n orientation: this.printOrientation,\r\n range: this.printRange,\r\n duplex_message: this.manualDuplexMessage,\r\n manual_duplex: this.manualDuplex,\r\n reverse: this.printInReverseOrder,\r\n strikethrough: this.fontStrikethrough,\r\n underline: this.fontUnderline\r\n };\r\n };\r\n PrintFileTXT.prototype.getContent = function () {\r\n var _this = this;\r\n return new Promise(function (ok, err) {\r\n var SEP = '|';\r\n _this._getBLOBContent(_this.fileContentType, _this.fileContent)\r\n .then(function (file_content) {\r\n var blob = new Blob([file_content]);\r\n ok(new zip.BlobReader(blob));\r\n })\r\n .catch(function (e) { err(e); });\r\n });\r\n };\r\n return PrintFileTXT;\r\n }(JSPM.PrintFileDuplexable));\r\n JSPM.PrintFileTXT = PrintFileTXT;\r\n})(JSPM || (JSPM = {}));\r\nvar JSPM;\r\n(function (JSPM) {\r\n var PrintFileXLS = (function (_super) {\r\n __extends(PrintFileXLS, _super);\r\n function PrintFileXLS(fileContent, fileContentType, fileName, copies) {\r\n var _this = _super.call(this, fileContent, fileContentType, fileName, copies) || this;\r\n _this.encryptedPassword = \"\";\r\n _this.pageFrom = 0;\r\n _this.pageTo = 0;\r\n return _this;\r\n }\r\n PrintFileXLS.prototype.getProperties = function () {\r\n return {\r\n file_type: JSPM.PrintFileType.WXLS,\r\n file_name: this.fileName,\r\n copies: this.copies,\r\n from_page: this.pageFrom,\r\n to_page: this.pageTo,\r\n password: this.encryptedPassword,\r\n };\r\n };\r\n PrintFileXLS.prototype.getContent = function () {\r\n var _this = this;\r\n return new Promise(function (ok, err) {\r\n if (_this.pageFrom > _this.pageTo)\r\n err('Invalid Print Range');\r\n _this._getBLOBContent(_this.fileContentType, _this.fileContent)\r\n .then(function (file_content) {\r\n ok(new zip.BlobReader(file_content));\r\n })\r\n .catch(function (reason) { return err(reason); });\r\n });\r\n };\r\n return PrintFileXLS;\r\n }(JSPM.PrintFile));\r\n JSPM.PrintFileXLS = PrintFileXLS;\r\n})(JSPM || (JSPM = {}));\r\nvar JSPM;\r\n(function (JSPM) {\r\n var SerialComm = (function () {\r\n function SerialComm(portName, baudRate, parity, stopBits, dataBits, flowControl) {\r\n this._id = \"\";\r\n this._isOpen = false;\r\n this._port = \"\";\r\n this._baud_rate = 9600;\r\n this._parity = JSPM.Serial.Parity.None;\r\n this._stop_bits = JSPM.Serial.StopBits.One;\r\n this._data_bits = JSPM.Serial.DataBits.Eight;\r\n this._flow_control = JSPM.Serial.Handshake.XOnXOff;\r\n this._updated_values = {};\r\n this.SERIAL_TIMEOUT = 5000;\r\n if (!portName)\r\n throw \"The specified serial port name is null or empty.\";\r\n this._port = portName;\r\n this._baud_rate = baudRate;\r\n this._parity = parity;\r\n this._stop_bits = stopBits;\r\n this._data_bits = dataBits;\r\n this._flow_control = flowControl;\r\n }\r\n Object.defineProperty(SerialComm.prototype, \"portName\", {\r\n get: function () {\r\n return this._port;\r\n },\r\n set: function (value) {\r\n this._port = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SerialComm.prototype, \"isOpen\", {\r\n get: function () {\r\n return this._isOpen;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SerialComm.prototype, \"baudRate\", {\r\n get: function () {\r\n return this._baud_rate;\r\n },\r\n set: function (value) {\r\n this._baud_rate = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SerialComm.prototype, \"parity\", {\r\n get: function () {\r\n return this._parity;\r\n },\r\n set: function (value) {\r\n this._parity = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SerialComm.prototype, \"stopBits\", {\r\n get: function () {\r\n return this._stop_bits;\r\n },\r\n set: function (value) {\r\n this._stop_bits = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SerialComm.prototype, \"dataBits\", {\r\n get: function () {\r\n return this._data_bits;\r\n },\r\n set: function (value) {\r\n this._data_bits = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SerialComm.prototype, \"flowControl\", {\r\n get: function () {\r\n return this._flow_control;\r\n },\r\n set: function (value) {\r\n this._flow_control = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SerialComm.prototype, \"dsr\", {\r\n get: function () {\r\n var _this = this;\r\n if (!this._isOpen) {\r\n throw \"Connection closed\";\r\n }\r\n JSPM.JSPrintManager.WS.send(JSON.stringify({ dsr: true }), this.propertiesJSON());\r\n return new Promise(function (ok, err) {\r\n setTimeout(function () { return err('Timeout'); }, _this.SERIAL_TIMEOUT);\r\n var wait_for_value = function () {\r\n if (!('dsr' in _this._updated_values))\r\n setTimeout(wait_for_value, 100);\r\n var val = _this._updated_values['dsr'];\r\n delete _this._updated_values['dsr'];\r\n ok(val);\r\n };\r\n wait_for_value();\r\n });\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SerialComm.prototype, \"cts\", {\r\n get: function () {\r\n var _this = this;\r\n if (!this._isOpen) {\r\n throw \"Connection closed\";\r\n }\r\n JSPM.JSPrintManager.WS.send(JSON.stringify({ dsr: true }), this.propertiesJSON());\r\n return new Promise(function (ok, err) {\r\n setTimeout(function () { return err('Timeout'); }, _this.SERIAL_TIMEOUT);\r\n var wait_for_value = function () {\r\n if (!('cts' in _this._updated_values))\r\n setTimeout(wait_for_value, 100);\r\n var val = _this._updated_values['cts'];\r\n delete _this._updated_values['cts'];\r\n ok(val);\r\n };\r\n wait_for_value();\r\n });\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SerialComm.prototype, \"rts\", {\r\n set: function (value) {\r\n if (!this._isOpen) {\r\n throw \"Connection closed\";\r\n }\r\n if (this._flow_control in [JSPM.Serial.Handshake.RequestToSend, JSPM.Serial.Handshake.RequestToSendXOnXOff])\r\n throw \"Invalid operation. Flow control manages RTS\";\r\n JSPM.JSPrintManager.WS.send(JSON.stringify({ rts: value }), this.propertiesJSON());\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SerialComm.prototype, \"dtr\", {\r\n set: function (value) {\r\n if (!this._isOpen) {\r\n throw \"Connection closed\";\r\n }\r\n JSPM.JSPrintManager.WS.send(JSON.stringify({ dtr: value }), this.propertiesJSON());\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n SerialComm.prototype.onError = function (data, critical) { };\r\n SerialComm.prototype.onDataReceived = function (data) { };\r\n SerialComm.prototype._onDataReceived = function (data) {\r\n if ('dsr' in data) {\r\n this._updated_values['dsr'] = data.dsr;\r\n }\r\n else if ('cts' in data) {\r\n this._updated_values['cts'] = data.cts;\r\n }\r\n else {\r\n this.onDataReceived(data.data);\r\n }\r\n };\r\n SerialComm.prototype.onClose = function (data) { };\r\n SerialComm.prototype.open = function () {\r\n var _this = this;\r\n return new Promise(function (ok, err) {\r\n if (_this._isOpen) {\r\n throw \"Connection is already open\";\r\n }\r\n var props = _this.propertiesJSON();\r\n props['on_update'] = function (data, first, last) {\r\n if (first) {\r\n if (data.result && data.result == \"Open\" && _this._isOpen == false)\r\n _this._isOpen = true;\r\n ok(data);\r\n }\r\n else if (last) {\r\n _this.onClose(data);\r\n _this._id = \"\";\r\n _this._isOpen = false;\r\n }\r\n else\r\n _this._onDataReceived(data);\r\n };\r\n props['on_error'] = function (data, first, critical) {\r\n if (first)\r\n err(data);\r\n else\r\n _this.onError(data, critical);\r\n };\r\n _this._id = JSPM.JSPrintManager.WS.send(JSON.stringify({\r\n port: _this._port,\r\n baud_rate: _this._baud_rate,\r\n data_bits: _this._data_bits,\r\n flow_control: _this._flow_control,\r\n parity: _this._parity,\r\n stop_bits: _this._stop_bits\r\n }), props);\r\n });\r\n };\r\n SerialComm.prototype.send = function (utf8string) {\r\n var props = this.propertiesJSON();\r\n JSPM.JSPrintManager.WS.send(JSON.stringify({ data: utf8string }), props);\r\n };\r\n SerialComm.prototype.close = function () {\r\n JSPM.JSPrintManager.WS.send(JSON.stringify({ close: true }), this.propertiesJSON());\r\n };\r\n SerialComm.prototype.propertiesJSON = function () {\r\n if (!this.portName)\r\n throw \"The specified serial port name is null or empty.\";\r\n var p = {\r\n type: 'serial'\r\n };\r\n if (this._id)\r\n p['id'] = this._id;\r\n return p;\r\n };\r\n return SerialComm;\r\n }());\r\n JSPM.SerialComm = SerialComm;\r\n})(JSPM || (JSPM = {}));\r\nvar JSPM;\r\n(function (JSPM) {\r\n JSPM.VERSION = '4.0';\r\n var Mutex = (function () {\r\n function Mutex() {\r\n this.mutex = Promise.resolve();\r\n }\r\n Mutex.prototype.lock = function () {\r\n var begin = function (unlock) { };\r\n this.mutex = this.mutex.then(function () {\r\n return new Promise(begin);\r\n });\r\n return new Promise(function (res) {\r\n begin = res;\r\n });\r\n };\r\n return Mutex;\r\n }());\r\n JSPM.Mutex = Mutex;\r\n var Utils = (function () {\r\n function Utils() {\r\n }\r\n Utils._intToByteArray = function (number) {\r\n return new Uint8Array([number & 0xFF,\r\n (number >> 8) & 0xFF,\r\n (number >> 16) & 0xFF,\r\n (number >> 24) & 0xFF]);\r\n };\r\n Utils._str2UTF8Array = function (str) {\r\n var utf8 = [];\r\n for (var i = 0; i < str.length; i++) {\r\n var charcode = str.charCodeAt(i);\r\n if ((i == 0) && charcode == 0xef &&\r\n (i + 1 < str.length && str.charCodeAt(i + 1) == 0xbb) &&\r\n (i + 2 < str.length && str.charCodeAt(i + 2) == 0xbf)) {\r\n utf8.push(0xef);\r\n utf8.push(0xbb);\r\n utf8.push(0xbf);\r\n i += 2;\r\n }\r\n else if (charcode < 0x80)\r\n utf8.push(charcode);\r\n else if (charcode < 0x800) {\r\n utf8.push(0xc0 | (charcode >> 6), 0x80 | (charcode & 0x3f));\r\n }\r\n else if (charcode < 0xd800 || charcode >= 0xe000) {\r\n utf8.push(0xe0 | (charcode >> 12), 0x80 | ((charcode >> 6) & 0x3f), 0x80 | (charcode & 0x3f));\r\n }\r\n else {\r\n i++;\r\n charcode = 0x10000 + (((charcode & 0x3ff) << 10)\r\n | (str.charCodeAt(i) & 0x3ff));\r\n utf8.push(0xf0 | (charcode >> 18), 0x80 | ((charcode >> 12) & 0x3f), 0x80 | ((charcode >> 6) & 0x3f), 0x80 | (charcode & 0x3f));\r\n }\r\n }\r\n return utf8;\r\n };\r\n return Utils;\r\n }());\r\n JSPM.Utils = Utils;\r\n})(JSPM || (JSPM = {}));\r\n\r\n(function() {\r\n if (typeof define === 'function' && define.amd) {\r\n define(JSPM);\r\n } else if (typeof exports === 'object') {\r\n module.exports = JSPM;\r\n } else {\r\n window.JSPM = JSPM;\r\n }\r\n})();\r\n"],"x_google_ignoreList":[]}