diff --git a/tests/core.js b/tests/core.js index cce7b48..3845f9c 100644 --- a/tests/core.js +++ b/tests/core.js @@ -129,6 +129,13 @@ var paths = { hlxlsx: dir + 'hyperlink_stress_test_2011.xlsx', hlxlsb: dir + 'hyperlink_stress_test_2011.xlsb', + ilxls: dir + 'internal_link.xls', + ilxls5: dir + 'internal_link.biff5', + ilxml: dir + 'internal_link.xml', + ilxlsx: dir + 'internal_link.xlsx', + ilxlsb: dir + 'internal_link.xlsb', + ilods: dir + 'internal_link.ods', + lonxls: dir + 'LONumbers.xls', lonxlsx: dir + 'LONumbers.xlsx', @@ -183,6 +190,7 @@ var NFPaths = pathit("nf", ["xlsx", "xlsb", "xls", "xml"]); var DTPaths = pathit("dt", ["xlsx", "xlsb", "xls", "xml"]); var NFPaths = pathit("nf", ["xlsx", "xlsb", "xls", "xml"]); var HLPaths = pathit("hl", ["xlsx", "xlsb", "xls", "xml"]); +var ILPaths = pathit("il", ["xlsx", "xlsb", "xls", "xml", "ods", "xls5"]); var OLPaths = pathit("ol", ["xlsx", "xlsb", "xls", "ods", "xls5"]); var PMPaths = pathit("pm", ["xlsx", "xlsb", "xls", "xml", "xls5"]); var SVPaths = pathit("sv", ["xlsx", "xlsb", "xls", "xml", "xls5"]); @@ -714,20 +722,28 @@ function diffsty(ws, r1,r2) { }); } -function hlink(ws) { - [ - ["A1", "http://www.sheetjs.com"], - ["A2", "http://oss.sheetjs.com"], - ["A3", "http://oss.sheetjs.com#foo"], - ["A4", "mailto:dev@sheetjs.com"], - ["A5", "mailto:dev@sheetjs.com?subject=hyperlink"], - ["A6", "../../sheetjs/Documents/Test.xlsx"], - ["A7", "http://sheetjs.com", "foo bar baz"] - ].forEach(function(r) { - assert.equal(get_cell(ws, r[0]).l.Target, r[1]); - assert.equal(get_cell(ws, r[0]).l.Tooltip, r[2]); - }); -} +function hlink1(ws) {[ + ["A1", "http://www.sheetjs.com"], + ["A2", "http://oss.sheetjs.com"], + ["A3", "http://oss.sheetjs.com#foo"], + ["A4", "mailto:dev@sheetjs.com"], + ["A5", "mailto:dev@sheetjs.com?subject=hyperlink"], + ["A6", "../../sheetjs/Documents/Test.xlsx"], + ["A7", "http://sheetjs.com", "foo bar baz"] +].forEach(function(r) { + assert.equal(get_cell(ws, r[0]).l.Target, r[1]); + if(r[2]) assert.equal(get_cell(ws, r[0]).l.Tooltip, r[2]); +}); } + +function hlink2(ws) { [ + ["A1", "#Sheet2!A1"], + ["A2", "#WBScope"], + ["A3", "#Sheet1!WSScope1", "#Sheet1!C7:E8"], + ["A5", "#Sheet1!A5"] +].forEach(function(r) { + if(r[2] && get_cell(ws, r[0]).l.Target == r[2]) return; + assert.equal(get_cell(ws, r[0]).l.Target, r[1]); +}); } function check_margin(margins, exp) { ["left", "right", "top", "bottom", "header", "footer"].forEach(function(m,i) { @@ -977,16 +993,20 @@ describe('parse features', function() { }); describe('should find hyperlinks', function() { - var wbs; + var wb1, wb2; var bef = (function() { X = require(modp); - wbs = HLPaths.map(function(p) { return X.read(fs.readFileSync(p), {type:TYPE}); }); + wb1 = HLPaths.map(function(p) { return X.read(fs.readFileSync(p), {type:TYPE}); }); + wb2 = ILPaths.map(function(p) { return X.read(fs.readFileSync(p), {type:TYPE}); }); }); if(typeof before != 'undefined') before(bef); else it('before', bef); - ['XLSX', 'XLSB', 'XLS', 'XML'].forEach(function(x, i) { - it(x, function() { hlink(wbs[i].Sheets.Sheet1); }); + ['xlsx', 'xlsb', 'xls', 'xml'].forEach(function(x, i) { + it(x + " external", function() { hlink1(wb1[i].Sheets.Sheet1); }); + }); + ['xlsx', 'xlsb', 'xls', 'xml', 'ods'].forEach(function(x, i) { + it(x + " internal", function() { hlink2(wb2[i].Sheets.Sheet1); }); }); }); @@ -1351,13 +1371,19 @@ describe('roundtrip features', function() { }); }); }); describe('should preserve hyperlink', function() { [ - ['xlml', paths.hlxml], - ['xlsx', paths.hlxlsx], - ['xlsb', paths.hlxlsb] - ].forEach(function(w) { it(w[0], function() { - var wb = X.read(fs.readFileSync(w[1]), {type:TYPE}); - hlink(wb.Sheets.Sheet1); - wb = X.read(X.write(wb, {bookType:w[0], type:TYPE}), {type:TYPE}); + ['xlml', paths.hlxml, true], + ['xls', paths.hlxls, true], + ['xlsx', paths.hlxlsx, true], + ['xlsb', paths.hlxlsb, true], + ['xlml', paths.ilxml, false], + ['xls', paths.ilxls, false], + ['xlsx', paths.ilxlsx, false], + ['xlsb', paths.ilxlsb, false], + ['ods', paths.ilods, false] + ].forEach(function(w) { it(w[0]+" "+(w[2]?"ex":"in")+ "ternal", function() { + var wb = X.read(fs.readFileSync(w[1]), {type:TYPE, WTF:opts.WTF}); + var hlink = (w[2] ? hlink1 : hlink2); hlink(wb.Sheets.Sheet1); + wb = X.read(X.write(wb, {bookType:w[0], type:TYPE, WTF:opts.WTF}), {type:TYPE, WTF:opts.WTF}); hlink(wb.Sheets.Sheet1); }); }); }); @@ -1881,6 +1907,20 @@ describe('HTML', function() { assert.equal(get_cell(ws, "A1").v, "A&B"); assert.equal(get_cell(ws, "B1").v, "A·B"); }); + describe('type override', function() { + function chk(ws) { + assert.equal(get_cell(ws, "A1").t, "s"); + assert.equal(get_cell(ws, "A1").v, "1234567890"); + assert.equal(get_cell(ws, "B1").t, "n"); + assert.equal(get_cell(ws, "B1").v, 1234567890); + } + var html = "
1234567890 | 1234567890 |
0){if(e.strm.data_type===o){e.strm.data_type=fe(e)}ne(e,e.l_desc);ne(e,e.d_desc);l=oe(e);i=e.opt_len+3+7>>>3;s=e.static_len+3+7>>>3;if(s<=i){i=s}}else{i=s=t+5}if(t+4<=i&&r!==-1){he(e,r,t,a)}else if(e.strategy===n||s===i){G(e,(c<<1)+(a?1:0),3);ae(e,D,O)}else{G(e,(u<<1)+(a?1:0),3);le(e,e.l_desc.max_code+1,e.d_desc.max_code+1,l+1);ae(e,e.dyn_ltree,e.dyn_dtree)}J(e);if(a){q(e)}}function pe(e,r,t){e.pending_buf[e.d_buf+e.last_lit*2]=r>>>8&255;e.pending_buf[e.d_buf+e.last_lit*2+1]=r&255;e.pending_buf[e.l_buf+e.last_lit]=t&255;e.last_lit++;if(r===0){e.dyn_ltree[t*2]++}else{e.matches++;r--;e.dyn_ltree[(P[t]+p+1)*2]++;e.dyn_dtree[V(r)*2]++}return e.last_lit===e.lit_bufsize-1}t._tr_init=ue;t._tr_stored_block=he;t._tr_flush_block=ve;t._tr_tally=pe;t._tr_align=de},{"../utils/common":27}],39:[function(e,r,t){"use strict";function a(){this.input=null;this.next_in=0;this.avail_in=0;this.total_in=0;this.output=null;this.next_out=0;this.avail_out=0;this.total_out=0;this.msg="";this.state=null;this.data_type=2;this.adler=0}r.exports=a},{}]},{},[9])(9)});var XLSX={};(function e(r){r.version="0.11.13";var t=1200;if(typeof module!=="undefined"&&typeof require!=="undefined"){if(typeof cptable==="undefined")global.cptable=undefined}function a(){n(1200)}var n=function(e){t=e};function i(e){var r=[];for(var t=0,a=e.length;t>1;++t)r[t]=String.fromCharCode(e.charCodeAt(2*t)+(e.charCodeAt(2*t+1)<<8));return r.join("")}function o(e){var r=[];for(var t=0;t0&&u!==R)B[u].name="!MiniFAT";B[v[0]].name="!FAT";B.fat_addrs=v;B.ssz=a;var _={},T=[],x=[],I=[];k(s,B,C,T,n,_,x,u);c(x,I,T);T.shift();var A={FileIndex:x,FullPaths:I};if(r&&r.raw)A.raw={header:m,sectors:C};return A}function o(e){e.chk(D,"Header Signature: ");e.chk(F,"CLSID: ");var r=e._R(2,"u");return[e._R(2,"u"),r]}function l(e,r){var t=9;e.l+=2;switch(t=e._R(2)){case 9:if(r!=3)throw new Error("Sector Shift: Expected 9 saw "+t);break;case 12:if(r!=4)throw new Error("Sector Shift: Expected 12 saw "+t);break;default:throw new Error("Sector Shift: Expected 9 or 12 saw "+t);}e.chk("0600","Mini Sector Shift: ");e.chk("000000000000","Reserved: ")}function f(e,r){var t=Math.ceil(e.length/r)-1;var a=[];for(var n=1;na.l)a=a.slice(0,a.l);if(a.length>0)e.push(a);a=null};var i=function c(e){if(a&&e":a.strike=1;break;case"":break;case"":;case"":a.u=1;break;case"":break;case"":;case"":a.b=1;break;case"":break;case"":;case"":a.i=1;break;case"":break;case"");t.push("")}if(i=="superscript")i="sup";else if(i=="subscript")i="sub";if(i!=""){r.push("<"+i+">");t.push(""+i+">")}t.push("");return n};function s(t){var a=[[],"",[]];var s=t.match(e),o=65001;if(!x(s))return"";a[1]=s[1];var l=t.match(r);if(x(l))o=i(l[1],a[0],a[2]);return a[0].join("")+a[1].replace(n,"
")+a[2].join("")}return function l(e){return e.replace(t,"").split(a).map(s).join("")}}();var As=/<(?:\w+:)?t[^>]*>([^<]*)<\/(?:\w+:)?t>/g,ys=/<(?:\w+:)?r>/;var Rs=/<(?:\w+:)?rPh.*?>([\s\S]*?)<\/(?:\w+:)?rPh>/g;function Ds(e,r){var t=r?r.cellHTML:true;var a={};if(!e)return null;var n;if(e.match(/^\s*<(?:\w+:)?t[^>]*>/)){a.t=pe(_e(e.slice(e.indexOf(">")+1).split(/<\/(?:\w+:)?t>/)[0]||""));a.r=_e(e);if(t)a.h=we(a.t)}else if(n=e.match(ys)){a.r=_e(e);a.t=pe(_e((e.replace(Rs,"").match(As)||[]).join("").replace(le,"")));if(t)a.h=Is(a.r)}return a}var Os=/<(?:\w+:)?sst([^>]*)>([\s\S]*)<\/(?:\w+:)?sst>/;var Fs=/<(?:\w+:)?(?:si|sstItem)>/g;var Ps=/<\/(?:\w+:)?(?:si|sstItem)>/;function Ns(e,r){var t=[],a="";if(!e)return t;var n=e.match(Os);if(x(n)){a=n[2].replace(Fs,"").split(Ps);for(var i=0;i!=a.length;++i){var s=Ds(a[i].trim(),r);if(s!=null)t[t.length]=s}n=ue(n[1]);t.Count=n.count;t.Unique=n.uniqueCount}return t}ha.SST="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings";var Ls=/^\s|\s$|[\t\n\r]/;function Ms(e,r){if(!r.bookSST)return"";var t=[se];t[t.length]=Ue("sst",null,{xmlns:ze.main[0],count:e.Count,uniqueCount:e.Unique});for(var a=0;a!=e.length;++a){if(e[a]==null)continue;var n=e[a];var i="":n.strike=1;break;case""+s+"
");a.push(Tv(i,r,e,t));return a.join("")}function Dv(e,r){var t=[];t.push(Cv(e,r));t.push(Bv(e,r));t.push(_v(e,r));for(var a=0;a]*>)/i," ");var f=-1,u=0,h=0,d=0;var v={s:{r:1e7,c:1e7},e:{r:0,c:0}};var p=[],b=0;for(s=0;s ";return p+i.join("")+" "}function a(e,r,t){var a=[];return a.join("")+""}var n='
"+f);return c.join("")}return{to_workbook:r,to_sheet:e,_row:t,BEGIN:n,END:i,_preamble:a,from_sheet:s}}();function np(e,r){var t=r||{};if(c!=null)t.dense=c;var a=t.dense?[]:{};var n=e.getElementsByTagName("tr");var i={s:{r:0,c:0},e:{r:n.length-1,c:0}};var s=[],o=0;var l=0,f=0,u=0,h=0,d=0;for(;l1){l[a++]=65533;continue}if(n<65536){l[a++]=n}else{n-=65536;l[a++]=55296|n>>10&1023;l[a++]=56320|n&1023}}return f(l,a)};t.utf8border=function(e,r){var t;r=r||e.length;if(r>e.length){r=e.length}t=r-1;while(t>=0&&(e[t]&192)===128){t--}if(t<0){return r}if(t===0){return r}return t+o[e[t]]>r?t:r}},{"./common":27}],29:[function(e,r,t){"use strict";function a(e,r,t,a){var n=e&65535|0,i=e>>>16&65535|0,s=0;while(t!==0){s=t>2e3?2e3:t;t-=s;do{n=n+r[a++]|0;i=i+n|0}while(--s);n%=65521;i%=65521}return n|i<<16|0}r.exports=a},{}],30:[function(e,r,t){r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],31:[function(e,r,t){"use strict";function a(){var e,r=[];for(var t=0;t<256;t++){e=t;for(var a=0;a<8;a++){e=e&1?3988292384^e>>>1:e>>>1}r[t]=e}return r}var n=a();function i(e,r,t,a){var i=n,s=a+t;e=e^-1;for(var o=a;o>>8^i[(e^r[o])&255]}return e^-1}r.exports=i},{}],32:[function(e,r,t){"use strict";var a=e("../utils/common");var n=e("./trees");var i=e("./adler32");var s=e("./crc32");var o=e("./messages");var l=0;var f=1;var c=3;var u=4;var h=5;var d=0;var v=1;var p=-2;var b=-3;var m=-5;var g=-1;var E=1;var k=2;var w=3;var S=4;var C=0;var _=2;var B=8;var T=9;var x=15;var I=8;var A=29;var y=256;var R=y+1+A;var D=30;var O=19;var F=2*R+1;var P=15;var N=3;var L=258;var M=L+N+1;var U=32;var H=42;var W=69;var z=73;var V=91;var X=103;var G=113;var j=666;var K=1;var Y=2;var $=3;var Z=4;var Q=3;function J(e,r){e.msg=o[r];return r}function q(e){return(e<<1)-(e>4?9:0)}function ee(e){var r=e.length;while(--r>=0){e[r]=0}}function re(e){var r=e.state;var t=r.pending;if(t>e.avail_out){t=e.avail_out}if(t===0){return}a.arraySet(e.output,r.pending_buf,r.pending_out,t,e.next_out);e.next_out+=t;r.pending_out+=t;e.total_out+=t;e.avail_out-=t;r.pending-=t;if(r.pending===0){r.pending_out=0}}function te(e,r){n._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,r);e.block_start=e.strstart;re(e.strm)}function ae(e,r){e.pending_buf[e.pending++]=r}function ne(e,r){e.pending_buf[e.pending++]=r>>>8&255;e.pending_buf[e.pending++]=r&255}function ie(e,r,t,n){var o=e.avail_in;if(o>n){o=n}if(o===0){return 0}e.avail_in-=o;a.arraySet(r,e.input,e.next_in,o,t);if(e.state.wrap===1){e.adler=i(e.adler,r,o,t)}else if(e.state.wrap===2){e.adler=s(e.adler,r,o,t)}e.next_in+=o;e.total_in+=o;return o}function se(e,r){var t=e.max_chain_length;var a=e.strstart;var n;var i;var s=e.prev_length;var o=e.nice_match;var l=e.strstart>e.w_size-M?e.strstart-(e.w_size-M):0;var f=e.window;var c=e.w_mask;var u=e.prev;var h=e.strstart+L;var d=f[a+s-1];var v=f[a+s];if(e.prev_length>=e.good_match){t>>=2}if(o>e.lookahead){o=e.lookahead}do{n=r;if(f[n+s]!==v||f[n+s-1]!==d||f[n]!==f[a]||f[++n]!==f[a+1]){continue}a+=2;n++;do{}while(f[++a]===f[++n]&&f[++a]===f[++n]&&f[++a]===f[++n]&&f[++a]===f[++n]&&f[++a]===f[++n]&&f[++a]===f[++n]&&f[++a]===f[++n]&&f[++a]===f[++n]&&ae.lookahead){e.match_length=e.lookahead}}}if(e.match_length>=N){t=n._tr_tally(e,1,e.match_length-N);e.lookahead-=e.match_length;e.strstart+=e.match_length;e.match_length=0}else{t=n._tr_tally(e,0,e.window[e.strstart]);e.lookahead--;e.strstart++}if(t){te(e,false);if(e.strm.avail_out===0){return K}}}e.insert=0;if(r===u){te(e,true);if(e.strm.avail_out===0){return $}return Z}if(e.last_lit){te(e,false);if(e.strm.avail_out===0){return K}}return Y}function he(e,r){var t;for(;;){if(e.lookahead===0){oe(e);if(e.lookahead===0){if(r===l){return K}break}}e.match_length=0;t=n._tr_tally(e,0,e.window[e.strstart]);e.lookahead--;e.strstart++;if(t){te(e,false);if(e.strm.avail_out===0){return K}}}e.insert=0;if(r===u){te(e,true);if(e.strm.avail_out===0){return $}return Z}if(e.last_lit){te(e,false);if(e.strm.avail_out===0){return K}}return Y}var de=function(e,r,t,a,n){this.good_length=e;this.max_lazy=r;this.nice_length=t;this.max_chain=a;this.func=n};var ve;ve=[new de(0,0,0,0,le),new de(4,4,8,4,fe),new de(4,5,16,8,fe),new de(4,6,32,32,fe),new de(4,4,16,16,ce),new de(8,16,32,32,ce),new de(8,16,128,128,ce),new de(8,32,128,256,ce),new de(32,128,258,1024,ce),new de(32,258,258,4096,ce)];function pe(e){e.window_size=2*e.w_size;ee(e.head);e.max_lazy_match=ve[e.level].max_lazy;e.good_match=ve[e.level].good_length;e.nice_match=ve[e.level].nice_length;e.max_chain_length=ve[e.level].max_chain;e.strstart=0;e.block_start=0;e.lookahead=0;e.insert=0;e.match_length=e.prev_length=N-1;e.match_available=0;e.ins_h=0}function be(){this.strm=null;this.status=0;this.pending_buf=null;this.pending_buf_size=0;this.pending_out=0;this.pending=0;this.wrap=0;this.gzhead=null;this.gzindex=0;this.method=B;this.last_flush=-1;this.w_size=0;this.w_bits=0;this.w_mask=0;this.window=null;this.window_size=0;this.prev=null;this.head=null;this.ins_h=0;this.hash_size=0;this.hash_bits=0;this.hash_mask=0;this.hash_shift=0;this.block_start=0;this.match_length=0;this.prev_match=0;this.match_available=0;this.strstart=0;this.match_start=0;this.lookahead=0;this.prev_length=0;this.max_chain_length=0;this.max_lazy_match=0;this.level=0;this.strategy=0;this.good_match=0;this.nice_match=0;this.dyn_ltree=new a.Buf16(F*2);this.dyn_dtree=new a.Buf16((2*D+1)*2);this.bl_tree=new a.Buf16((2*O+1)*2);ee(this.dyn_ltree);ee(this.dyn_dtree);ee(this.bl_tree);this.l_desc=null;this.d_desc=null;this.bl_desc=null;this.bl_count=new a.Buf16(P+1);this.heap=new a.Buf16(2*R+1);ee(this.heap);this.heap_len=0;this.heap_max=0;this.depth=new a.Buf16(2*R+1);ee(this.depth);this.l_buf=0;this.lit_bufsize=0;this.last_lit=0;this.d_buf=0;this.opt_len=0;this.static_len=0;this.matches=0;this.insert=0;this.bi_buf=0;this.bi_valid=0}function me(e){var r;if(!e||!e.state){return J(e,p)}e.total_in=e.total_out=0;e.data_type=_;r=e.state;r.pending=0;r.pending_out=0;if(r.wrap<0){r.wrap=-r.wrap}r.status=r.wrap?H:G;e.adler=r.wrap===2?0:1;r.last_flush=l;n._tr_init(r);return d}function ge(e){var r=me(e);if(r===d){pe(e.state)}return r}function Ee(e,r){if(!e||!e.state){return p}if(e.state.wrap!==2){return p}e.state.gzhead=r;return d}function ke(e,r,t,n,i,s){if(!e){return p}var o=1;if(r===g){r=6}if(n<0){o=0;n=-n}else if(n>15){o=2;n-=16}if(i<1||i>T||t!==B||n<8||n>15||r<0||r>9||s<0||s>S){return J(e,p)}if(n===8){n=9}var l=new be;e.state=l;l.strm=e;l.wrap=o;l.gzhead=null;l.w_bits=n;l.w_size=1<>>=S;b-=S}if(b<15){p+=x[i++]<>>24;p>>>=S;b-=S;S=w>>>16&255;if(S&16){_=w&65535;S&=15;if(bc){e.msg="invalid distance too far back";t.mode=a;break e}p>>>=S;b-=S;S=o-l;if(_>S){S=_-S;if(S>h){if(t.sane){e.msg="invalid distance too far back";t.mode=a;break e}}B=0;T=v;if(d===0){B+=u-S;if(S>3;i-=C;b-=C<<3;p&=(1<>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function ie(){this.mode=0;this.last=false;this.wrap=0;this.havedict=false;this.flags=0;this.dmax=0;this.check=0;this.total=0;this.head=null;this.wbits=0;this.wsize=0;this.whave=0;this.wnext=0;this.window=null;this.hold=0;this.bits=0;this.length=0;this.offset=0;this.extra=0;this.lencode=null;this.distcode=null;this.lenbits=0;this.distbits=0;this.ncode=0;this.nlen=0;this.ndist=0;this.have=0;this.next=null;this.lens=new a.Buf16(320);this.work=new a.Buf16(288);this.lendyn=null;this.distdyn=null;this.sane=0;this.back=0;this.was=0}function se(e){var r;if(!e||!e.state){return m}r=e.state;e.total_in=e.total_out=r.total=0;e.msg="";if(r.wrap){e.adler=r.wrap&1}r.mode=S;r.last=0;r.havedict=0;r.dmax=32768;r.head=null;r.hold=0;r.bits=0;r.lencode=r.lendyn=new a.Buf32(ee);r.distcode=r.distdyn=new a.Buf32(re);r.sane=1;r.back=-1;return v}function oe(e){var r;if(!e||!e.state){return m}r=e.state;r.wsize=0;r.whave=0;r.wnext=0;return se(e)}function le(e,r){var t;var a;if(!e||!e.state){return m}a=e.state;if(r<0){t=0;r=-r}else{t=(r>>4)+1;if(r<48){r&=15}}if(r&&(r<8||r>15)){return m}if(a.window!==null&&a.wbits!==r){a.window=null}a.wrap=t;a.wbits=r;return oe(e)}function fe(e,r){var t;var a;if(!e){return m}a=new ie;e.state=a;a.window=null;t=le(e,r);if(t!==v){e.state=null}return t}function ce(e){return fe(e,ae)}var ue=true;var he,de;function ve(e){if(ue){var r;he=new a.Buf32(512);de=new a.Buf32(32);r=0;while(r<144){e.lens[r++]=8}while(r<256){e.lens[r++]=9}while(r<280){e.lens[r++]=7}while(r<288){e.lens[r++]=8}o(f,e.lens,0,288,he,0,e.work,{bits:9});r=0;while(r<32){e.lens[r++]=5}o(c,e.lens,0,32,de,0,e.work,{bits:5});ue=false}e.lencode=he;e.lenbits=9;e.distcode=de;e.distbits=5}function pe(e,r,t,n){var i;var s=e.state;if(s.window===null){s.wsize=1<