generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.js
More file actions
128 lines (123 loc) · 157 KB
/
main.js
File metadata and controls
128 lines (123 loc) · 157 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var Xt=Object.create;var Be=Object.defineProperty;var Rt=Object.getOwnPropertyDescriptor;var Lt=Object.getOwnPropertyNames;var Ut=Object.getPrototypeOf,$t=Object.prototype.hasOwnProperty;var Ae=(n,l)=>()=>(l||n((l={exports:{}}).exports,l),l.exports),Wt=(n,l)=>{for(var t in l)Be(n,t,{get:l[t],enumerable:!0})},ht=(n,l,t,e)=>{if(l&&typeof l=="object"||typeof l=="function")for(let i of Lt(l))!$t.call(n,i)&&i!==t&&Be(n,i,{get:()=>l[i],enumerable:!(e=Rt(l,i))||e.enumerable});return n};var Ke=(n,l,t)=>(t=n!=null?Xt(Ut(n)):{},ht(l||!n||!n.__esModule?Be(t,"default",{value:n,enumerable:!0}):t,n)),jt=n=>ht(Be({},"__esModule",{value:!0}),n);var bt=Ae((sn,gt)=>{gt.exports=De;function De(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}De.prototype.go=function(n){this.pending<this.max?mt(this,n):this.waiting.push(n)};De.prototype.wait=function(n){this.pending===0?n(this.error):this.listeners.push(n)};De.prototype.hold=function(){return pt(this)};function pt(n){n.pending+=1;var l=!1;return t;function t(i){if(l)throw new Error("callback called twice");if(l=!0,n.error=n.error||i,n.pending-=1,n.waiting.length>0&&n.pending<n.max)mt(n,n.waiting.shift());else if(n.pending===0){var r=n.listeners;n.listeners=[],r.forEach(e)}}function e(i){i(n.error)}}function mt(n,l){l(pt(n))}});var vt=Ae(Ie=>{var ze=require("fs"),Xe=require("util"),Je=require("stream"),yt=Je.Readable,Qe=Je.Writable,Zt=Je.PassThrough,qt=bt(),Re=require("events").EventEmitter;Ie.createFromBuffer=Gt;Ie.createFromFd=Ht;Ie.BufferSlicer=ve;Ie.FdSlicer=ye;Xe.inherits(ye,Re);function ye(n,l){l=l||{},Re.call(this),this.fd=n,this.pend=new qt,this.pend.max=1,this.refCount=0,this.autoClose=!!l.autoClose}ye.prototype.read=function(n,l,t,e,i){var r=this;r.pend.go(function(s){ze.read(r.fd,n,l,t,e,function(d,m,f){s(),i(d,m,f)})})};ye.prototype.write=function(n,l,t,e,i){var r=this;r.pend.go(function(s){ze.write(r.fd,n,l,t,e,function(d,m,f){s(),i(d,m,f)})})};ye.prototype.createReadStream=function(n){return new Le(this,n)};ye.prototype.createWriteStream=function(n){return new Ue(this,n)};ye.prototype.ref=function(){this.refCount+=1};ye.prototype.unref=function(){var n=this;if(n.refCount-=1,n.refCount>0)return;if(n.refCount<0)throw new Error("invalid unref");n.autoClose&&ze.close(n.fd,l);function l(t){t?n.emit("error",t):n.emit("close")}};Xe.inherits(Le,yt);function Le(n,l){l=l||{},yt.call(this,l),this.context=n,this.context.ref(),this.start=l.start||0,this.endOffset=l.end,this.pos=this.start,this.destroyed=!1}Le.prototype._read=function(n){var l=this;if(!l.destroyed){var t=Math.min(l._readableState.highWaterMark,n);if(l.endOffset!=null&&(t=Math.min(t,l.endOffset-l.pos)),t<=0){l.destroyed=!0,l.push(null),l.context.unref();return}l.context.pend.go(function(e){if(l.destroyed)return e();var i=Buffer.allocUnsafe(t);ze.read(l.context.fd,i,0,t,l.pos,function(r,s){r?l.destroy(r):s===0?(l.destroyed=!0,l.push(null),l.context.unref()):(l.pos+=s,l.push(i.slice(0,s))),e()})})}};Le.prototype.destroy=function(n){this.destroyed||(n=n||new Error("stream destroyed"),this.destroyed=!0,this.emit("error",n),this.context.unref())};Xe.inherits(Ue,Qe);function Ue(n,l){l=l||{},Qe.call(this,l),this.context=n,this.context.ref(),this.start=l.start||0,this.endOffset=l.end==null?1/0:+l.end,this.bytesWritten=0,this.pos=this.start,this.destroyed=!1,this.on("finish",this.destroy.bind(this))}Ue.prototype._write=function(n,l,t){var e=this;if(!e.destroyed){if(e.pos+n.length>e.endOffset){var i=new Error("maximum file length exceeded");i.code="ETOOBIG",e.destroy(),t(i);return}e.context.pend.go(function(r){if(e.destroyed)return r();ze.write(e.context.fd,n,0,n.length,e.pos,function(s,d){s?(e.destroy(),r(),t(s)):(e.bytesWritten+=d,e.pos+=d,e.emit("progress"),r(),t())})})}};Ue.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.context.unref())};Xe.inherits(ve,Re);function ve(n,l){Re.call(this),l=l||{},this.refCount=0,this.buffer=n,this.maxChunkSize=l.maxChunkSize||Number.MAX_SAFE_INTEGER}ve.prototype.read=function(n,l,t,e,i){if(!(0<=l&&l<=n.length))throw new RangeError("offset outside buffer: 0 <= "+l+" <= "+n.length);if(e<0)throw new RangeError("position is negative: "+e);if(l+t>n.length&&(t=n.length-l),e+t>this.buffer.length&&(t=this.buffer.length-e),t<=0){setImmediate(function(){i(null,0)});return}this.buffer.copy(n,l,e,e+t),setImmediate(function(){i(null,t)})};ve.prototype.write=function(n,l,t,e,i){n.copy(this.buffer,e,l,l+t),setImmediate(function(){i(null,t,n)})};ve.prototype.createReadStream=function(n){n=n||{};var l=new Zt(n);l.destroyed=!1,l.start=n.start||0,l.endOffset=n.end,l.pos=l.endOffset||this.buffer.length;for(var t=this.buffer.slice(l.start,l.pos),e=0;;){var i=e+this.maxChunkSize;if(i>=t.length){e<t.length&&l.write(t.slice(e,t.length));break}l.write(t.slice(e,i)),e=i}return l.end(),l.destroy=function(){l.destroyed=!0},l};ve.prototype.createWriteStream=function(n){var l=this;n=n||{};var t=new Qe(n);return t.start=n.start||0,t.endOffset=n.end==null?this.buffer.length:+n.end,t.bytesWritten=0,t.pos=t.start,t.destroyed=!1,t._write=function(e,i,r){if(!t.destroyed){var s=t.pos+e.length;if(s>t.endOffset){var d=new Error("maximum file length exceeded");d.code="ETOOBIG",t.destroyed=!0,r(d);return}e.copy(l.buffer,t.pos,0,e.length),t.bytesWritten+=e.length,t.pos=s,t.emit("progress"),r()}},t.destroy=function(){t.destroyed=!0},t};ve.prototype.ref=function(){this.refCount+=1};ve.prototype.unref=function(){if(this.refCount-=1,this.refCount<0)throw new Error("invalid unref")};function Gt(n,l){return new ve(n,l)}function Ht(n,l){return new ye(n,l)}});var _t=Ae((ln,wt)=>{var _e=require("buffer").Buffer,et=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];typeof Int32Array!="undefined"&&(et=new Int32Array(et));function xt(n){if(_e.isBuffer(n))return n;var l=typeof _e.alloc=="function"&&typeof _e.from=="function";if(typeof n=="number")return l?_e.alloc(n):new _e(n);if(typeof n=="string")return l?_e.from(n):new _e(n);throw new Error("input must be buffer, number, or string, received "+typeof n)}function Vt(n){var l=xt(4);return l.writeInt32BE(n,0),l}function tt(n,l){n=xt(n),_e.isBuffer(l)&&(l=l.readUInt32BE(0));for(var t=~~l^-1,e=0;e<n.length;e++)t=et[(t^n[e])&255]^t>>>8;return t^-1}function nt(){return Vt(tt.apply(null,arguments))}nt.signed=function(){return tt.apply(null,arguments)};nt.unsigned=function(){return tt.apply(null,arguments)>>>0};wt.exports=nt});var Tt=Ae(ce=>{var rt=require("fs"),Yt=require("zlib"),kt=vt(),Kt=_t(),je=require("util"),Ze=require("events").EventEmitter,Et=require("stream").Transform,at=require("stream").PassThrough,Jt=require("stream").Writable;ce.open=Qt;ce.fromFd=Ct;ce.fromBuffer=en;ce.fromRandomAccessReader=st;ce.dosDateTimeToDate=Mt;ce.getFileNameLowLevel=At;ce.validateFileName=zt;ce.parseExtraFields=It;ce.ZipFile=ge;ce.Entry=Te;ce.LocalFileHeader=Ft;ce.RandomAccessReader=ke;function Qt(n,l,t){typeof l=="function"&&(t=l,l=null),l==null&&(l={}),l.autoClose==null&&(l.autoClose=!0),l.lazyEntries==null&&(l.lazyEntries=!1),l.decodeStrings==null&&(l.decodeStrings=!0),l.validateEntrySizes==null&&(l.validateEntrySizes=!0),l.strictFileNames==null&&(l.strictFileNames=!1),t==null&&(t=We),rt.open(n,"r",function(e,i){if(e)return t(e);Ct(i,l,function(r,s){r&&rt.close(i,We),t(r,s)})})}function Ct(n,l,t){typeof l=="function"&&(t=l,l=null),l==null&&(l={}),l.autoClose==null&&(l.autoClose=!1),l.lazyEntries==null&&(l.lazyEntries=!1),l.decodeStrings==null&&(l.decodeStrings=!0),l.validateEntrySizes==null&&(l.validateEntrySizes=!0),l.strictFileNames==null&&(l.strictFileNames=!1),t==null&&(t=We),rt.fstat(n,function(e,i){if(e)return t(e);var r=kt.createFromFd(n,{autoClose:!0});st(r,i.size,l,t)})}function en(n,l,t){typeof l=="function"&&(t=l,l=null),l==null&&(l={}),l.autoClose=!1,l.lazyEntries==null&&(l.lazyEntries=!1),l.decodeStrings==null&&(l.decodeStrings=!0),l.validateEntrySizes==null&&(l.validateEntrySizes=!0),l.strictFileNames==null&&(l.strictFileNames=!1);var e=kt.createFromBuffer(n,{maxChunkSize:65536});st(e,n.length,l,t)}function st(n,l,t,e){typeof t=="function"&&(e=t,t=null),t==null&&(t={}),t.autoClose==null&&(t.autoClose=!0),t.lazyEntries==null&&(t.lazyEntries=!1),t.decodeStrings==null&&(t.decodeStrings=!0);var i=!!t.decodeStrings;if(t.validateEntrySizes==null&&(t.validateEntrySizes=!0),t.strictFileNames==null&&(t.strictFileNames=!1),e==null&&(e=We),typeof l!="number")throw new Error("expected totalSize parameter to be a number");if(l>Number.MAX_SAFE_INTEGER)throw new Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.");n.ref();var r=22,s=20,d=65535,m=Math.min(s+r+d,l),f=xe(m),h=l-f.length;Ce(n,f,0,m,h,function(c){if(c)return e(c);for(var p=m-r;p>=0;p-=1)if(f.readUInt32LE(p)===101010256){var u=f.subarray(p),b=u.readUInt16LE(4),g=u.readUInt16LE(10),v=u.readUInt32LE(16),w=u.readUInt16LE(20),k=u.length-r;if(w!==k)return e(new Error("Invalid comment length. Expected: "+k+". Found: "+w+". Are there extra bytes at the end of the file? Or is the end of central dir signature `PK\u263A\u263B` in the comment?"));var E=i?$e(u.subarray(22),!1):u.subarray(22);if(p-s>=0&&f.readUInt32LE(p-s)===117853008){var T=f.subarray(p-s,p-s+s),M=Ee(T,8),O=xe(56);return Ce(n,O,0,O.length,M,function(A){return A?e(A):O.readUInt32LE(0)!==101075792?e(new Error("invalid zip64 end of central directory record signature")):(b=O.readUInt32LE(16),b!==0?e(new Error("multi-disk zip files are not supported: found disk number: "+b)):(g=Ee(O,32),v=Ee(O,48),e(null,new ge(n,v,l,g,E,t.autoClose,t.lazyEntries,i,t.validateEntrySizes,t.strictFileNames))))})}return b!==0?e(new Error("multi-disk zip files are not supported: found disk number: "+b)):e(null,new ge(n,v,l,g,E,t.autoClose,t.lazyEntries,i,t.validateEntrySizes,t.strictFileNames))}e(new Error("End of central directory record signature not found. Either not a zip file, or file is truncated."))})}je.inherits(ge,Ze);function ge(n,l,t,e,i,r,s,d,m,f){var h=this;Ze.call(h),h.reader=n,h.reader.on("error",function(c){St(h,c)}),h.reader.once("close",function(){h.emit("close")}),h.readEntryCursor=l,h.fileSize=t,h.entryCount=e,h.comment=i,h.entriesRead=0,h.autoClose=!!r,h.lazyEntries=!!s,h.decodeStrings=!!d,h.validateEntrySizes=!!m,h.strictFileNames=!!f,h.isOpen=!0,h.emittedError=!1,h.lazyEntries||h._readEntry()}ge.prototype.close=function(){this.isOpen&&(this.isOpen=!1,this.reader.unref())};function me(n,l){n.autoClose&&n.close(),St(n,l)}function St(n,l){n.emittedError||(n.emittedError=!0,n.emit("error",l))}ge.prototype.readEntry=function(){if(!this.lazyEntries)throw new Error("readEntry() called without lazyEntries:true");this._readEntry()};ge.prototype._readEntry=function(){var n=this;if(n.entryCount===n.entriesRead){setImmediate(function(){n.autoClose&&n.close(),!n.emittedError&&n.emit("end")});return}if(!n.emittedError){var l=xe(46);Ce(n.reader,l,0,l.length,n.readEntryCursor,function(t){if(t)return me(n,t);if(!n.emittedError){var e=new Te,i=l.readUInt32LE(0);if(i!==33639248)return me(n,new Error("invalid central directory file header signature: 0x"+i.toString(16)));if(e.versionMadeBy=l.readUInt16LE(4),e.versionNeededToExtract=l.readUInt16LE(6),e.generalPurposeBitFlag=l.readUInt16LE(8),e.compressionMethod=l.readUInt16LE(10),e.lastModFileTime=l.readUInt16LE(12),e.lastModFileDate=l.readUInt16LE(14),e.crc32=l.readUInt32LE(16),e.compressedSize=l.readUInt32LE(20),e.uncompressedSize=l.readUInt32LE(24),e.fileNameLength=l.readUInt16LE(28),e.extraFieldLength=l.readUInt16LE(30),e.fileCommentLength=l.readUInt16LE(32),e.internalFileAttributes=l.readUInt16LE(36),e.externalFileAttributes=l.readUInt32LE(38),e.relativeOffsetOfLocalHeader=l.readUInt32LE(42),e.generalPurposeBitFlag&64)return me(n,new Error("strong encryption is not supported"));n.readEntryCursor+=46,l=xe(e.fileNameLength+e.extraFieldLength+e.fileCommentLength),Ce(n.reader,l,0,l.length,n.readEntryCursor,function(r){if(r)return me(n,r);if(!n.emittedError){e.fileNameRaw=l.subarray(0,e.fileNameLength);var s=e.fileNameLength+e.extraFieldLength;e.extraFieldRaw=l.subarray(e.fileNameLength,s),e.fileCommentRaw=l.subarray(s,s+e.fileCommentLength);try{e.extraFields=It(e.extraFieldRaw)}catch(g){return me(n,g)}if(n.decodeStrings){var d=(e.generalPurposeBitFlag&2048)!==0;e.fileComment=$e(e.fileCommentRaw,d),e.fileName=At(e.generalPurposeBitFlag,e.fileNameRaw,e.extraFields,n.strictFileNames);var m=zt(e.fileName);if(m!=null)return me(n,new Error(m))}else e.fileComment=e.fileCommentRaw,e.fileName=e.fileNameRaw;e.comment=e.fileComment,n.readEntryCursor+=l.length,n.entriesRead+=1;for(var f=0;f<e.extraFields.length;f++){var h=e.extraFields[f];if(h.id===1){var c=h.data,p=0;if(e.uncompressedSize===4294967295){if(p+8>c.length)return me(n,new Error("zip64 extended information extra field does not include uncompressed size"));e.uncompressedSize=Ee(c,p),p+=8}if(e.compressedSize===4294967295){if(p+8>c.length)return me(n,new Error("zip64 extended information extra field does not include compressed size"));e.compressedSize=Ee(c,p),p+=8}if(e.relativeOffsetOfLocalHeader===4294967295){if(p+8>c.length)return me(n,new Error("zip64 extended information extra field does not include relative header offset"));e.relativeOffsetOfLocalHeader=Ee(c,p),p+=8}break}}if(n.validateEntrySizes&&e.compressionMethod===0){var u=e.uncompressedSize;if(e.isEncrypted()&&(u+=12),e.compressedSize!==u){var b="compressed/uncompressed size mismatch for stored file: "+e.compressedSize+" != "+e.uncompressedSize;return me(n,new Error(b))}}n.emit("entry",e),n.lazyEntries||n._readEntry()}})}})}};ge.prototype.openReadStream=function(n,l,t){var e=this,i=0,r=n.compressedSize;if(t==null&&(t=l,l=null),l==null)l={};else{if(l.decrypt!=null){if(!n.isEncrypted())throw new Error("options.decrypt can only be specified for encrypted entries");if(l.decrypt!==!1)throw new Error("invalid options.decrypt value: "+l.decrypt);if(n.isCompressed()&&l.decompress!==!1)throw new Error("entry is encrypted and compressed, and options.decompress !== false")}if(l.decompress!=null){if(!n.isCompressed())throw new Error("options.decompress can only be specified for compressed entries");if(!(l.decompress===!1||l.decompress===!0))throw new Error("invalid options.decompress value: "+l.decompress)}if(l.start!=null||l.end!=null){if(n.isCompressed()&&l.decompress!==!1)throw new Error("start/end range not allowed for compressed entry without options.decompress === false");if(n.isEncrypted()&&l.decrypt!==!1)throw new Error("start/end range not allowed for encrypted entry without options.decrypt === false")}if(l.start!=null){if(i=l.start,i<0)throw new Error("options.start < 0");if(i>n.compressedSize)throw new Error("options.start > entry.compressedSize")}if(l.end!=null){if(r=l.end,r<0)throw new Error("options.end < 0");if(r>n.compressedSize)throw new Error("options.end > entry.compressedSize");if(r<i)throw new Error("options.end < options.start")}}if(!e.isOpen)return t(new Error("closed"));if(n.isEncrypted()&&l.decrypt!==!1)return t(new Error("entry is encrypted, and options.decrypt !== false"));var s;if(n.compressionMethod===0)s=!1;else if(n.compressionMethod===8)s=l.decompress!=null?l.decompress:!0;else return t(new Error("unsupported compression method: "+n.compressionMethod));e.readLocalFileHeader(n,{minimal:!0},function(d,m){if(d)return t(d);e.openReadStreamLowLevel(m.fileDataStart,n.compressedSize,i,r,s,n.uncompressedSize,t)})};ge.prototype.openReadStreamLowLevel=function(n,l,t,e,i,r,s){var d=this,m=n+l,f=d.reader.createReadStream({start:n+t,end:n+e}),h=f;if(i){var c=!1,p=Yt.createInflateRaw();f.on("error",function(u){setImmediate(function(){c||p.emit("error",u)})}),f.pipe(p),d.validateEntrySizes?(h=new Pe(r),p.on("error",function(u){setImmediate(function(){c||h.emit("error",u)})}),p.pipe(h)):h=p,it(h,function(){c=!0,p!==h&&p.unpipe(h),f.unpipe(p),f.destroy()})}s(null,h)};ge.prototype.readLocalFileHeader=function(n,l,t){var e=this;t==null&&(t=l,l=null),l==null&&(l={}),e.reader.ref();var i=xe(30);Ce(e.reader,i,0,i.length,n.relativeOffsetOfLocalHeader,function(r){try{if(r)return t(r);var s=i.readUInt32LE(0);if(s!==67324752)return t(new Error("invalid local file header signature: 0x"+s.toString(16)));var d=i.readUInt16LE(26),m=i.readUInt16LE(28),f=n.relativeOffsetOfLocalHeader+30+d+m;if(f+n.compressedSize>e.fileSize)return t(new Error("file data overflows file bounds: "+f+" + "+n.compressedSize+" > "+e.fileSize));if(l.minimal)return t(null,{fileDataStart:f});var h=new Ft;h.fileDataStart=f,h.versionNeededToExtract=i.readUInt16LE(4),h.generalPurposeBitFlag=i.readUInt16LE(6),h.compressionMethod=i.readUInt16LE(8),h.lastModFileTime=i.readUInt16LE(10),h.lastModFileDate=i.readUInt16LE(12),h.crc32=i.readUInt32LE(14),h.compressedSize=i.readUInt32LE(18),h.uncompressedSize=i.readUInt32LE(22),h.fileNameLength=d,h.extraFieldLength=m,i=xe(d+m),e.reader.ref(),Ce(e.reader,i,0,i.length,n.relativeOffsetOfLocalHeader+30,function(c){try{return c?t(c):(h.fileName=i.subarray(0,d),h.extraField=i.subarray(d),t(null,h))}finally{e.reader.unref()}})}finally{e.reader.unref()}})};function Te(){}Te.prototype.getLastModDate=function(n){if(n==null&&(n={}),!n.forceDosFormat)for(var l=0;l<this.extraFields.length;l++){var t=this.extraFields[l];if(t.id===21589){var e=t.data;if(e.length<5)continue;var i=e[0],r=1;if(!(i&r))continue;var s=e.readInt32LE(1);return new Date(s*1e3)}else if(t.id===10)for(var e=t.data,d=4;d<e.length+4;){var m=e.readUInt16LE(d);d+=2;var f=e.readUInt16LE(d);if(d+=2,m!==1){d+=f;continue}if(f<8||d+f>e.length)break;var h=4294967296*e.readInt32LE(d+4)+e.readUInt32LE(d),c=h/1e4-116444736e5;return new Date(c)}}return Mt(this.lastModFileDate,this.lastModFileTime,n.timezone)};Te.prototype.isEncrypted=function(){return(this.generalPurposeBitFlag&1)!==0};Te.prototype.isCompressed=function(){return this.compressionMethod===8};function Ft(){}function Mt(n,l,t){var e=n&31,i=(n>>5&15)-1,r=(n>>9&127)+1980,s=0,d=(l&31)*2,m=l>>5&63,f=l>>11&31;if(t==null||t==="local")return new Date(r,i,e,f,m,d,s);if(t==="UTC")return new Date(Date.UTC(r,i,e,f,m,d,s));throw new Error("unrecognized options.timezone: "+options.timezone)}function At(n,l,t,e){for(var i=null,r=0;r<t.length;r++){var s=t[r];if(s.id===28789){if(s.data.length<6||s.data.readUInt8(0)!==1)continue;var d=s.data.readUInt32LE(1);if(Kt.unsigned(l)!==d)continue;i=$e(s.data.subarray(5),!0);break}}if(i==null){var m=(n&2048)!==0;i=$e(l,m)}return e||(i=i.replace(/\\/g,"/")),i}function zt(n){return n.indexOf("\\")!==-1?"invalid characters in fileName: "+n:/^[a-zA-Z]:/.test(n)||/^\//.test(n)?"absolute path: "+n:n.split("/").indexOf("..")!==-1?"invalid relative path: "+n:null}function It(n){for(var l=[],t=0;t<n.length-3;){var e=n.readUInt16LE(t+0),i=n.readUInt16LE(t+2),r=t+4,s=r+i;if(s>n.length)throw new Error("extra field length exceeds extra field buffer size");var d=n.subarray(r,s);l.push({id:e,data:d}),t=s}return l}function Ce(n,l,t,e,i,r){if(e===0)return setImmediate(function(){r(null,xe(0))});n.read(l,t,e,i,function(s,d){if(s)return r(s);if(d<e)return r(new Error("unexpected EOF"));r()})}je.inherits(Pe,Et);function Pe(n){Et.call(this),this.actualByteCount=0,this.expectedByteCount=n}Pe.prototype._transform=function(n,l,t){if(this.actualByteCount+=n.length,this.actualByteCount>this.expectedByteCount){var e="too many bytes in the stream. expected "+this.expectedByteCount+". got at least "+this.actualByteCount;return t(new Error(e))}t(null,n)};Pe.prototype._flush=function(n){if(this.actualByteCount<this.expectedByteCount){var l="not enough bytes in the stream. expected "+this.expectedByteCount+". got only "+this.actualByteCount;return n(new Error(l))}n()};je.inherits(ke,Ze);function ke(){Ze.call(this),this.refCount=0}ke.prototype.ref=function(){this.refCount+=1};ke.prototype.unref=function(){var n=this;if(n.refCount-=1,n.refCount>0)return;if(n.refCount<0)throw new Error("invalid unref");n.close(l);function l(t){if(t)return n.emit("error",t);n.emit("close")}};ke.prototype.createReadStream=function(n){n==null&&(n={});var l=n.start,t=n.end;if(l===t){var e=new at;return setImmediate(function(){e.end()}),e}var i=this._readStreamForRange(l,t),r=!1,s=new qe(this);i.on("error",function(m){setImmediate(function(){r||s.emit("error",m)})}),it(s,function(){i.unpipe(s),s.unref(),i.destroy()});var d=new Pe(t-l);return s.on("error",function(m){setImmediate(function(){r||d.emit("error",m)})}),it(d,function(){r=!0,s.unpipe(d),s.destroy()}),i.pipe(s).pipe(d)};ke.prototype._readStreamForRange=function(n,l){throw new Error("not implemented")};ke.prototype.read=function(n,l,t,e,i){var r=this.createReadStream({start:e,end:e+t}),s=new Jt,d=0;s._write=function(m,f,h){m.copy(n,l+d,0,m.length),d+=m.length,h()},s.on("finish",i),r.on("error",function(m){i(m)}),r.pipe(s)};ke.prototype.close=function(n){setImmediate(n)};je.inherits(qe,at);function qe(n){at.call(this),this.context=n,this.context.ref(),this.unreffedYet=!1}qe.prototype._flush=function(n){this.unref(),n()};qe.prototype.unref=function(n){this.unreffedYet||(this.unreffedYet=!0,this.context.unref())};var tn="\0\u263A\u263B\u2665\u2666\u2663\u2660\u2022\u25D8\u25CB\u25D9\u2642\u2640\u266A\u266B\u263C\u25BA\u25C4\u2195\u203C\xB6\xA7\u25AC\u21A8\u2191\u2193\u2192\u2190\u221F\u2194\u25B2\u25BC !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u2302\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0";function $e(n,l){if(l)return n.toString("utf8");for(var t="",e=0;e<n.length;e++)t+=tn[n[e]];return t}function Ee(n,l){var t=n.readUInt32LE(l),e=n.readUInt32LE(l+4);return e*4294967296+t}var xe;typeof Buffer.allocUnsafe=="function"?xe=function(n){return Buffer.allocUnsafe(n)}:xe=function(n){return new Buffer(n)};function it(n,l){typeof n.destroy=="function"?n._destroy=function(t,e){l(),e!=null&&e(t)}:n.destroy=l}function We(n){if(n)throw n}});var Nt=Ae((Pt,ot)=>{(function(n){typeof Pt=="object"&&typeof ot!="undefined"?ot.exports=n():typeof define=="function"&&define.amd?define([],n):(typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:this).JSZip=n()})(function(){return function n(l,t,e){function i(d,m){if(!t[d]){if(!l[d]){var f=typeof require=="function"&&require;if(!m&&f)return f(d,!0);if(r)return r(d,!0);var h=new Error("Cannot find module '"+d+"'");throw h.code="MODULE_NOT_FOUND",h}var c=t[d]={exports:{}};l[d][0].call(c.exports,function(p){var u=l[d][1][p];return i(u||p)},c,c.exports,n,l,t,e)}return t[d].exports}for(var r=typeof require=="function"&&require,s=0;s<e.length;s++)i(e[s]);return i}({1:[function(n,l,t){"use strict";var e=n("./utils"),i=n("./support"),r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.encode=function(s){for(var d,m,f,h,c,p,u,b=[],g=0,v=s.length,w=v,k=e.getTypeOf(s)!=="string";g<s.length;)w=v-g,f=k?(d=s[g++],m=g<v?s[g++]:0,g<v?s[g++]:0):(d=s.charCodeAt(g++),m=g<v?s.charCodeAt(g++):0,g<v?s.charCodeAt(g++):0),h=d>>2,c=(3&d)<<4|m>>4,p=1<w?(15&m)<<2|f>>6:64,u=2<w?63&f:64,b.push(r.charAt(h)+r.charAt(c)+r.charAt(p)+r.charAt(u));return b.join("")},t.decode=function(s){var d,m,f,h,c,p,u=0,b=0,g="data:";if(s.substr(0,g.length)===g)throw new Error("Invalid base64 input, it looks like a data url.");var v,w=3*(s=s.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(s.charAt(s.length-1)===r.charAt(64)&&w--,s.charAt(s.length-2)===r.charAt(64)&&w--,w%1!=0)throw new Error("Invalid base64 input, bad content length.");for(v=i.uint8array?new Uint8Array(0|w):new Array(0|w);u<s.length;)d=r.indexOf(s.charAt(u++))<<2|(h=r.indexOf(s.charAt(u++)))>>4,m=(15&h)<<4|(c=r.indexOf(s.charAt(u++)))>>2,f=(3&c)<<6|(p=r.indexOf(s.charAt(u++))),v[b++]=d,c!==64&&(v[b++]=m),p!==64&&(v[b++]=f);return v}},{"./support":30,"./utils":32}],2:[function(n,l,t){"use strict";var e=n("./external"),i=n("./stream/DataWorker"),r=n("./stream/Crc32Probe"),s=n("./stream/DataLengthProbe");function d(m,f,h,c,p){this.compressedSize=m,this.uncompressedSize=f,this.crc32=h,this.compression=c,this.compressedContent=p}d.prototype={getContentWorker:function(){var m=new i(e.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new s("data_length")),f=this;return m.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),m},getCompressedWorker:function(){return new i(e.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},d.createWorkerFrom=function(m,f,h){return m.pipe(new r).pipe(new s("uncompressedSize")).pipe(f.compressWorker(h)).pipe(new s("compressedSize")).withStreamInfo("compression",f)},l.exports=d},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,l,t){"use strict";var e=n("./stream/GenericWorker");t.STORE={magic:"\0\0",compressWorker:function(){return new e("STORE compression")},uncompressWorker:function(){return new e("STORE decompression")}},t.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,l,t){"use strict";var e=n("./utils"),i=function(){for(var r,s=[],d=0;d<256;d++){r=d;for(var m=0;m<8;m++)r=1&r?3988292384^r>>>1:r>>>1;s[d]=r}return s}();l.exports=function(r,s){return r!==void 0&&r.length?e.getTypeOf(r)!=="string"?function(d,m,f,h){var c=i,p=h+f;d^=-1;for(var u=h;u<p;u++)d=d>>>8^c[255&(d^m[u])];return-1^d}(0|s,r,r.length,0):function(d,m,f,h){var c=i,p=h+f;d^=-1;for(var u=h;u<p;u++)d=d>>>8^c[255&(d^m.charCodeAt(u))];return-1^d}(0|s,r,r.length,0):0}},{"./utils":32}],5:[function(n,l,t){"use strict";t.base64=!1,t.binary=!1,t.dir=!1,t.createFolders=!0,t.date=null,t.compression=null,t.compressionOptions=null,t.comment=null,t.unixPermissions=null,t.dosPermissions=null},{}],6:[function(n,l,t){"use strict";var e=null;e=typeof Promise!="undefined"?Promise:n("lie"),l.exports={Promise:e}},{lie:37}],7:[function(n,l,t){"use strict";var e=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",i=n("pako"),r=n("./utils"),s=n("./stream/GenericWorker"),d=e?"uint8array":"array";function m(f,h){s.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=h,this.meta={}}t.magic="\b\0",r.inherits(m,s),m.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(r.transformTo(d,f.data),!1)},m.prototype.flush=function(){s.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},m.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},m.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(h){f.push({data:h,meta:f.meta})}},t.compressWorker=function(f){return new m("Deflate",f)},t.uncompressWorker=function(){return new m("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,l,t){"use strict";function e(c,p){var u,b="";for(u=0;u<p;u++)b+=String.fromCharCode(255&c),c>>>=8;return b}function i(c,p,u,b,g,v){var w,k,E=c.file,T=c.compression,M=v!==d.utf8encode,O=r.transformTo("string",v(E.name)),A=r.transformTo("string",d.utf8encode(E.name)),R=E.comment,G=r.transformTo("string",v(R)),_=r.transformTo("string",d.utf8encode(R)),P=A.length!==E.name.length,o=_.length!==R.length,N="",H="",D="",Q=E.dir,U=E.date,J={crc32:0,compressedSize:0,uncompressedSize:0};p&&!u||(J.crc32=c.crc32,J.compressedSize=c.compressedSize,J.uncompressedSize=c.uncompressedSize);var z=0;p&&(z|=8),M||!P&&!o||(z|=2048);var F=0,Y=0;Q&&(F|=16),g==="UNIX"?(Y=798,F|=function(j,ae){var de=j;return j||(de=ae?16893:33204),(65535&de)<<16}(E.unixPermissions,Q)):(Y=20,F|=function(j){return 63&(j||0)}(E.dosPermissions)),w=U.getUTCHours(),w<<=6,w|=U.getUTCMinutes(),w<<=5,w|=U.getUTCSeconds()/2,k=U.getUTCFullYear()-1980,k<<=4,k|=U.getUTCMonth()+1,k<<=5,k|=U.getUTCDate(),P&&(H=e(1,1)+e(m(O),4)+A,N+="up"+e(H.length,2)+H),o&&(D=e(1,1)+e(m(G),4)+_,N+="uc"+e(D.length,2)+D);var Z="";return Z+=`
\0`,Z+=e(z,2),Z+=T.magic,Z+=e(w,2),Z+=e(k,2),Z+=e(J.crc32,4),Z+=e(J.compressedSize,4),Z+=e(J.uncompressedSize,4),Z+=e(O.length,2),Z+=e(N.length,2),{fileRecord:f.LOCAL_FILE_HEADER+Z+O+N,dirRecord:f.CENTRAL_FILE_HEADER+e(Y,2)+Z+e(G.length,2)+"\0\0\0\0"+e(F,4)+e(b,4)+O+N+G}}var r=n("../utils"),s=n("../stream/GenericWorker"),d=n("../utf8"),m=n("../crc32"),f=n("../signature");function h(c,p,u,b){s.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=u,this.encodeFileName=b,this.streamFiles=c,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}r.inherits(h,s),h.prototype.push=function(c){var p=c.meta.percent||0,u=this.entriesCount,b=this._sources.length;this.accumulate?this.contentBuffer.push(c):(this.bytesWritten+=c.data.length,s.prototype.push.call(this,{data:c.data,meta:{currentFile:this.currentFile,percent:u?(p+100*(u-b-1))/u:100}}))},h.prototype.openedSource=function(c){this.currentSourceOffset=this.bytesWritten,this.currentFile=c.file.name;var p=this.streamFiles&&!c.file.dir;if(p){var u=i(c,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:u.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(c){this.accumulate=!1;var p=this.streamFiles&&!c.file.dir,u=i(c,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(u.dirRecord),p)this.push({data:function(b){return f.DATA_DESCRIPTOR+e(b.crc32,4)+e(b.compressedSize,4)+e(b.uncompressedSize,4)}(c),meta:{percent:100}});else for(this.push({data:u.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var c=this.bytesWritten,p=0;p<this.dirRecords.length;p++)this.push({data:this.dirRecords[p],meta:{percent:100}});var u=this.bytesWritten-c,b=function(g,v,w,k,E){var T=r.transformTo("string",E(k));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+e(g,2)+e(g,2)+e(v,4)+e(w,4)+e(T.length,2)+T}(this.dirRecords.length,u,c,this.zipComment,this.encodeFileName);this.push({data:b,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(c){this._sources.push(c);var p=this;return c.on("data",function(u){p.processChunk(u)}),c.on("end",function(){p.closedSource(p.previous.streamInfo),p._sources.length?p.prepareNextSource():p.end()}),c.on("error",function(u){p.error(u)}),this},h.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(c){var p=this._sources;if(!s.prototype.error.call(this,c))return!1;for(var u=0;u<p.length;u++)try{p[u].error(c)}catch(b){}return!0},h.prototype.lock=function(){s.prototype.lock.call(this);for(var c=this._sources,p=0;p<c.length;p++)c[p].lock()},l.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,l,t){"use strict";var e=n("../compressions"),i=n("./ZipFileWorker");t.generateWorker=function(r,s,d){var m=new i(s.streamFiles,d,s.platform,s.encodeFileName),f=0;try{r.forEach(function(h,c){f++;var p=function(v,w){var k=v||w,E=e[k];if(!E)throw new Error(k+" is not a valid compression method !");return E}(c.options.compression,s.compression),u=c.options.compressionOptions||s.compressionOptions||{},b=c.dir,g=c.date;c._compressWorker(p,u).withStreamInfo("file",{name:h,dir:b,date:g,comment:c.comment||"",unixPermissions:c.unixPermissions,dosPermissions:c.dosPermissions}).pipe(m)}),m.entriesCount=f}catch(h){m.error(h)}return m}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,l,t){"use strict";function e(){if(!(this instanceof e))return new e;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var i=new e;for(var r in this)typeof this[r]!="function"&&(i[r]=this[r]);return i}}(e.prototype=n("./object")).loadAsync=n("./load"),e.support=n("./support"),e.defaults=n("./defaults"),e.version="3.10.1",e.loadAsync=function(i,r){return new e().loadAsync(i,r)},e.external=n("./external"),l.exports=e},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,l,t){"use strict";var e=n("./utils"),i=n("./external"),r=n("./utf8"),s=n("./zipEntries"),d=n("./stream/Crc32Probe"),m=n("./nodejsUtils");function f(h){return new i.Promise(function(c,p){var u=h.decompressed.getContentWorker().pipe(new d);u.on("error",function(b){p(b)}).on("end",function(){u.streamInfo.crc32!==h.decompressed.crc32?p(new Error("Corrupted zip : CRC32 mismatch")):c()}).resume()})}l.exports=function(h,c){var p=this;return c=e.extend(c||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:r.utf8decode}),m.isNode&&m.isStream(h)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):e.prepareContent("the loaded zip file",h,!0,c.optimizedBinaryString,c.base64).then(function(u){var b=new s(c);return b.load(u),b}).then(function(u){var b=[i.Promise.resolve(u)],g=u.files;if(c.checkCRC32)for(var v=0;v<g.length;v++)b.push(f(g[v]));return i.Promise.all(b)}).then(function(u){for(var b=u.shift(),g=b.files,v=0;v<g.length;v++){var w=g[v],k=w.fileNameStr,E=e.resolve(w.fileNameStr);p.file(E,w.decompressed,{binary:!0,optimizedBinaryString:!0,date:w.date,dir:w.dir,comment:w.fileCommentStr.length?w.fileCommentStr:null,unixPermissions:w.unixPermissions,dosPermissions:w.dosPermissions,createFolders:c.createFolders}),w.dir||(p.file(E).unsafeOriginalName=k)}return b.zipComment.length&&(p.comment=b.zipComment),p})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,l,t){"use strict";var e=n("../utils"),i=n("../stream/GenericWorker");function r(s,d){i.call(this,"Nodejs stream input adapter for "+s),this._upstreamEnded=!1,this._bindStream(d)}e.inherits(r,i),r.prototype._bindStream=function(s){var d=this;(this._stream=s).pause(),s.on("data",function(m){d.push({data:m,meta:{percent:0}})}).on("error",function(m){d.isPaused?this.generatedError=m:d.error(m)}).on("end",function(){d.isPaused?d._upstreamEnded=!0:d.end()})},r.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},r.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},l.exports=r},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,l,t){"use strict";var e=n("readable-stream").Readable;function i(r,s,d){e.call(this,s),this._helper=r;var m=this;r.on("data",function(f,h){m.push(f)||m._helper.pause(),d&&d(h)}).on("error",function(f){m.emit("error",f)}).on("end",function(){m.push(null)})}n("../utils").inherits(i,e),i.prototype._read=function(){this._helper.resume()},l.exports=i},{"../utils":32,"readable-stream":16}],14:[function(n,l,t){"use strict";l.exports={isNode:typeof Buffer!="undefined",newBufferFrom:function(e,i){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,i);if(typeof e=="number")throw new Error('The "data" argument must not be a number');return new Buffer(e,i)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var i=new Buffer(e);return i.fill(0),i},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&typeof e.on=="function"&&typeof e.pause=="function"&&typeof e.resume=="function"}}},{}],15:[function(n,l,t){"use strict";function e(E,T,M){var O,A=r.getTypeOf(T),R=r.extend(M||{},m);R.date=R.date||new Date,R.compression!==null&&(R.compression=R.compression.toUpperCase()),typeof R.unixPermissions=="string"&&(R.unixPermissions=parseInt(R.unixPermissions,8)),R.unixPermissions&&16384&R.unixPermissions&&(R.dir=!0),R.dosPermissions&&16&R.dosPermissions&&(R.dir=!0),R.dir&&(E=g(E)),R.createFolders&&(O=b(E))&&v.call(this,O,!0);var G=A==="string"&&R.binary===!1&&R.base64===!1;M&&M.binary!==void 0||(R.binary=!G),(T instanceof f&&T.uncompressedSize===0||R.dir||!T||T.length===0)&&(R.base64=!1,R.binary=!0,T="",R.compression="STORE",A="string");var _=null;_=T instanceof f||T instanceof s?T:p.isNode&&p.isStream(T)?new u(E,T):r.prepareContent(E,T,R.binary,R.optimizedBinaryString,R.base64);var P=new h(E,_,R);this.files[E]=P}var i=n("./utf8"),r=n("./utils"),s=n("./stream/GenericWorker"),d=n("./stream/StreamHelper"),m=n("./defaults"),f=n("./compressedObject"),h=n("./zipObject"),c=n("./generate"),p=n("./nodejsUtils"),u=n("./nodejs/NodejsStreamInputAdapter"),b=function(E){E.slice(-1)==="/"&&(E=E.substring(0,E.length-1));var T=E.lastIndexOf("/");return 0<T?E.substring(0,T):""},g=function(E){return E.slice(-1)!=="/"&&(E+="/"),E},v=function(E,T){return T=T!==void 0?T:m.createFolders,E=g(E),this.files[E]||e.call(this,E,null,{dir:!0,createFolders:T}),this.files[E]};function w(E){return Object.prototype.toString.call(E)==="[object RegExp]"}var k={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(E){var T,M,O;for(T in this.files)O=this.files[T],(M=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&E(M,O)},filter:function(E){var T=[];return this.forEach(function(M,O){E(M,O)&&T.push(O)}),T},file:function(E,T,M){if(arguments.length!==1)return E=this.root+E,e.call(this,E,T,M),this;if(w(E)){var O=E;return this.filter(function(R,G){return!G.dir&&O.test(R)})}var A=this.files[this.root+E];return A&&!A.dir?A:null},folder:function(E){if(!E)return this;if(w(E))return this.filter(function(A,R){return R.dir&&E.test(A)});var T=this.root+E,M=v.call(this,T),O=this.clone();return O.root=M.name,O},remove:function(E){E=this.root+E;var T=this.files[E];if(T||(E.slice(-1)!=="/"&&(E+="/"),T=this.files[E]),T&&!T.dir)delete this.files[E];else for(var M=this.filter(function(A,R){return R.name.slice(0,E.length)===E}),O=0;O<M.length;O++)delete this.files[M[O].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(E){var T,M={};try{if((M=r.extend(E||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=M.type.toLowerCase(),M.compression=M.compression.toUpperCase(),M.type==="binarystring"&&(M.type="string"),!M.type)throw new Error("No output type specified.");r.checkSupport(M.type),M.platform!=="darwin"&&M.platform!=="freebsd"&&M.platform!=="linux"&&M.platform!=="sunos"||(M.platform="UNIX"),M.platform==="win32"&&(M.platform="DOS");var O=M.comment||this.comment||"";T=c.generateWorker(this,M,O)}catch(A){(T=new s("error")).error(A)}return new d(T,M.type||"string",M.mimeType)},generateAsync:function(E,T){return this.generateInternalStream(E).accumulate(T)},generateNodeStream:function(E,T){return(E=E||{}).type||(E.type="nodebuffer"),this.generateInternalStream(E).toNodejsStream(T)}};l.exports=k},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,l,t){"use strict";l.exports=n("stream")},{stream:void 0}],17:[function(n,l,t){"use strict";var e=n("./DataReader");function i(r){e.call(this,r);for(var s=0;s<this.data.length;s++)r[s]=255&r[s]}n("../utils").inherits(i,e),i.prototype.byteAt=function(r){return this.data[this.zero+r]},i.prototype.lastIndexOfSignature=function(r){for(var s=r.charCodeAt(0),d=r.charCodeAt(1),m=r.charCodeAt(2),f=r.charCodeAt(3),h=this.length-4;0<=h;--h)if(this.data[h]===s&&this.data[h+1]===d&&this.data[h+2]===m&&this.data[h+3]===f)return h-this.zero;return-1},i.prototype.readAndCheckSignature=function(r){var s=r.charCodeAt(0),d=r.charCodeAt(1),m=r.charCodeAt(2),f=r.charCodeAt(3),h=this.readData(4);return s===h[0]&&d===h[1]&&m===h[2]&&f===h[3]},i.prototype.readData=function(r){if(this.checkOffset(r),r===0)return[];var s=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,s},l.exports=i},{"../utils":32,"./DataReader":18}],18:[function(n,l,t){"use strict";var e=n("../utils");function i(r){this.data=r,this.length=r.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(r){this.checkIndex(this.index+r)},checkIndex:function(r){if(this.length<this.zero+r||r<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+r+"). Corrupted zip ?")},setIndex:function(r){this.checkIndex(r),this.index=r},skip:function(r){this.setIndex(this.index+r)},byteAt:function(){},readInt:function(r){var s,d=0;for(this.checkOffset(r),s=this.index+r-1;s>=this.index;s--)d=(d<<8)+this.byteAt(s);return this.index+=r,d},readString:function(r){return e.transformTo("string",this.readData(r))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var r=this.readInt(4);return new Date(Date.UTC(1980+(r>>25&127),(r>>21&15)-1,r>>16&31,r>>11&31,r>>5&63,(31&r)<<1))}},l.exports=i},{"../utils":32}],19:[function(n,l,t){"use strict";var e=n("./Uint8ArrayReader");function i(r){e.call(this,r)}n("../utils").inherits(i,e),i.prototype.readData=function(r){this.checkOffset(r);var s=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,s},l.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,l,t){"use strict";var e=n("./DataReader");function i(r){e.call(this,r)}n("../utils").inherits(i,e),i.prototype.byteAt=function(r){return this.data.charCodeAt(this.zero+r)},i.prototype.lastIndexOfSignature=function(r){return this.data.lastIndexOf(r)-this.zero},i.prototype.readAndCheckSignature=function(r){return r===this.readData(4)},i.prototype.readData=function(r){this.checkOffset(r);var s=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,s},l.exports=i},{"../utils":32,"./DataReader":18}],21:[function(n,l,t){"use strict";var e=n("./ArrayReader");function i(r){e.call(this,r)}n("../utils").inherits(i,e),i.prototype.readData=function(r){if(this.checkOffset(r),r===0)return new Uint8Array(0);var s=this.data.subarray(this.zero+this.index,this.zero+this.index+r);return this.index+=r,s},l.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(n,l,t){"use strict";var e=n("../utils"),i=n("../support"),r=n("./ArrayReader"),s=n("./StringReader"),d=n("./NodeBufferReader"),m=n("./Uint8ArrayReader");l.exports=function(f){var h=e.getTypeOf(f);return e.checkSupport(h),h!=="string"||i.uint8array?h==="nodebuffer"?new d(f):i.uint8array?new m(e.transformTo("uint8array",f)):new r(e.transformTo("array",f)):new s(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,l,t){"use strict";t.LOCAL_FILE_HEADER="PK",t.CENTRAL_FILE_HEADER="PK",t.CENTRAL_DIRECTORY_END="PK",t.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",t.ZIP64_CENTRAL_DIRECTORY_END="PK",t.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,l,t){"use strict";var e=n("./GenericWorker"),i=n("../utils");function r(s){e.call(this,"ConvertWorker to "+s),this.destType=s}i.inherits(r,e),r.prototype.processChunk=function(s){this.push({data:i.transformTo(this.destType,s.data),meta:s.meta})},l.exports=r},{"../utils":32,"./GenericWorker":28}],25:[function(n,l,t){"use strict";var e=n("./GenericWorker"),i=n("../crc32");function r(){e.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(r,e),r.prototype.processChunk=function(s){this.streamInfo.crc32=i(s.data,this.streamInfo.crc32||0),this.push(s)},l.exports=r},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,l,t){"use strict";var e=n("../utils"),i=n("./GenericWorker");function r(s){i.call(this,"DataLengthProbe for "+s),this.propName=s,this.withStreamInfo(s,0)}e.inherits(r,i),r.prototype.processChunk=function(s){if(s){var d=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=d+s.data.length}i.prototype.processChunk.call(this,s)},l.exports=r},{"../utils":32,"./GenericWorker":28}],27:[function(n,l,t){"use strict";var e=n("../utils"),i=n("./GenericWorker");function r(s){i.call(this,"DataWorker");var d=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,s.then(function(m){d.dataIsReady=!0,d.data=m,d.max=m&&m.length||0,d.type=e.getTypeOf(m),d.isPaused||d._tickAndRepeat()},function(m){d.error(m)})}e.inherits(r,i),r.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},r.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,e.delay(this._tickAndRepeat,[],this)),!0)},r.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(e.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},r.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var s=null,d=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":s=this.data.substring(this.index,d);break;case"uint8array":s=this.data.subarray(this.index,d);break;case"array":case"nodebuffer":s=this.data.slice(this.index,d)}return this.index=d,this.push({data:s,meta:{percent:this.max?this.index/this.max*100:0}})},l.exports=r},{"../utils":32,"./GenericWorker":28}],28:[function(n,l,t){"use strict";function e(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}e.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,r){return this._listeners[i].push(r),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,r){if(this._listeners[i])for(var s=0;s<this._listeners[i].length;s++)this._listeners[i][s].call(this,r)},pipe:function(i){return i.registerPrevious(this)},registerPrevious:function(i){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=i.streamInfo,this.mergeStreamInfo(),this.previous=i;var r=this;return i.on("data",function(s){r.processChunk(s)}),i.on("end",function(){r.end()}),i.on("error",function(s){r.error(s)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var i=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),i=!0),this.previous&&this.previous.resume(),!i},flush:function(){},processChunk:function(i){this.push(i)},withStreamInfo:function(i,r){return this.extraStreamInfo[i]=r,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var i in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,i)&&(this.streamInfo[i]=this.extraStreamInfo[i])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var i="Worker "+this.name;return this.previous?this.previous+" -> "+i:i}},l.exports=e},{}],29:[function(n,l,t){"use strict";var e=n("../utils"),i=n("./ConvertWorker"),r=n("./GenericWorker"),s=n("../base64"),d=n("../support"),m=n("../external"),f=null;if(d.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch(p){}function h(p,u){return new m.Promise(function(b,g){var v=[],w=p._internalType,k=p._outputType,E=p._mimeType;p.on("data",function(T,M){v.push(T),u&&u(M)}).on("error",function(T){v=[],g(T)}).on("end",function(){try{var T=function(M,O,A){switch(M){case"blob":return e.newBlob(e.transformTo("arraybuffer",O),A);case"base64":return s.encode(O);default:return e.transformTo(M,O)}}(k,function(M,O){var A,R=0,G=null,_=0;for(A=0;A<O.length;A++)_+=O[A].length;switch(M){case"string":return O.join("");case"array":return Array.prototype.concat.apply([],O);case"uint8array":for(G=new Uint8Array(_),A=0;A<O.length;A++)G.set(O[A],R),R+=O[A].length;return G;case"nodebuffer":return Buffer.concat(O);default:throw new Error("concat : unsupported type '"+M+"'")}}(w,v),E);b(T)}catch(M){g(M)}v=[]}).resume()})}function c(p,u,b){var g=u;switch(u){case"blob":case"arraybuffer":g="uint8array";break;case"base64":g="string"}try{this._internalType=g,this._outputType=u,this._mimeType=b,e.checkSupport(g),this._worker=p.pipe(new i(g)),p.lock()}catch(v){this._worker=new r("error"),this._worker.error(v)}}c.prototype={accumulate:function(p){return h(this,p)},on:function(p,u){var b=this;return p==="data"?this._worker.on(p,function(g){u.call(b,g.data,g.meta)}):this._worker.on(p,function(){e.delay(u,arguments,b)}),this},resume:function(){return e.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(p){if(e.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},p)}},l.exports=c},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,l,t){"use strict";if(t.base64=!0,t.array=!0,t.string=!0,t.arraybuffer=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined",t.nodebuffer=typeof Buffer!="undefined",t.uint8array=typeof Uint8Array!="undefined",typeof ArrayBuffer=="undefined")t.blob=!1;else{var e=new ArrayBuffer(0);try{t.blob=new Blob([e],{type:"application/zip"}).size===0}catch(r){try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(e),t.blob=i.getBlob("application/zip").size===0}catch(s){t.blob=!1}}}try{t.nodestream=!!n("readable-stream").Readable}catch(r){t.nodestream=!1}},{"readable-stream":16}],31:[function(n,l,t){"use strict";for(var e=n("./utils"),i=n("./support"),r=n("./nodejsUtils"),s=n("./stream/GenericWorker"),d=new Array(256),m=0;m<256;m++)d[m]=252<=m?6:248<=m?5:240<=m?4:224<=m?3:192<=m?2:1;d[254]=d[254]=1;function f(){s.call(this,"utf-8 decode"),this.leftOver=null}function h(){s.call(this,"utf-8 encode")}t.utf8encode=function(c){return i.nodebuffer?r.newBufferFrom(c,"utf-8"):function(p){var u,b,g,v,w,k=p.length,E=0;for(v=0;v<k;v++)(64512&(b=p.charCodeAt(v)))==55296&&v+1<k&&(64512&(g=p.charCodeAt(v+1)))==56320&&(b=65536+(b-55296<<10)+(g-56320),v++),E+=b<128?1:b<2048?2:b<65536?3:4;for(u=i.uint8array?new Uint8Array(E):new Array(E),v=w=0;w<E;v++)(64512&(b=p.charCodeAt(v)))==55296&&v+1<k&&(64512&(g=p.charCodeAt(v+1)))==56320&&(b=65536+(b-55296<<10)+(g-56320),v++),b<128?u[w++]=b:(b<2048?u[w++]=192|b>>>6:(b<65536?u[w++]=224|b>>>12:(u[w++]=240|b>>>18,u[w++]=128|b>>>12&63),u[w++]=128|b>>>6&63),u[w++]=128|63&b);return u}(c)},t.utf8decode=function(c){return i.nodebuffer?e.transformTo("nodebuffer",c).toString("utf-8"):function(p){var u,b,g,v,w=p.length,k=new Array(2*w);for(u=b=0;u<w;)if((g=p[u++])<128)k[b++]=g;else if(4<(v=d[g]))k[b++]=65533,u+=v-1;else{for(g&=v===2?31:v===3?15:7;1<v&&u<w;)g=g<<6|63&p[u++],v--;1<v?k[b++]=65533:g<65536?k[b++]=g:(g-=65536,k[b++]=55296|g>>10&1023,k[b++]=56320|1023&g)}return k.length!==b&&(k.subarray?k=k.subarray(0,b):k.length=b),e.applyFromCharCode(k)}(c=e.transformTo(i.uint8array?"uint8array":"array",c))},e.inherits(f,s),f.prototype.processChunk=function(c){var p=e.transformTo(i.uint8array?"uint8array":"array",c.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var u=p;(p=new Uint8Array(u.length+this.leftOver.length)).set(this.leftOver,0),p.set(u,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var b=function(v,w){var k;for((w=w||v.length)>v.length&&(w=v.length),k=w-1;0<=k&&(192&v[k])==128;)k--;return k<0||k===0?w:k+d[v[k]]>w?k:w}(p),g=p;b!==p.length&&(i.uint8array?(g=p.subarray(0,b),this.leftOver=p.subarray(b,p.length)):(g=p.slice(0,b),this.leftOver=p.slice(b,p.length))),this.push({data:t.utf8decode(g),meta:c.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:t.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},t.Utf8DecodeWorker=f,e.inherits(h,s),h.prototype.processChunk=function(c){this.push({data:t.utf8encode(c.data),meta:c.meta})},t.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,l,t){"use strict";var e=n("./support"),i=n("./base64"),r=n("./nodejsUtils"),s=n("./external");function d(u){return u}function m(u,b){for(var g=0;g<u.length;++g)b[g]=255&u.charCodeAt(g);return b}n("setimmediate"),t.newBlob=function(u,b){t.checkSupport("blob");try{return new Blob([u],{type:b})}catch(v){try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return g.append(u),g.getBlob(b)}catch(w){throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(u,b,g){var v=[],w=0,k=u.length;if(k<=g)return String.fromCharCode.apply(null,u);for(;w<k;)b==="array"||b==="nodebuffer"?v.push(String.fromCharCode.apply(null,u.slice(w,Math.min(w+g,k)))):v.push(String.fromCharCode.apply(null,u.subarray(w,Math.min(w+g,k)))),w+=g;return v.join("")},stringifyByChar:function(u){for(var b="",g=0;g<u.length;g++)b+=String.fromCharCode(u[g]);return b},applyCanBeUsed:{uint8array:function(){try{return e.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch(u){return!1}}(),nodebuffer:function(){try{return e.nodebuffer&&String.fromCharCode.apply(null,r.allocBuffer(1)).length===1}catch(u){return!1}}()}};function h(u){var b=65536,g=t.getTypeOf(u),v=!0;if(g==="uint8array"?v=f.applyCanBeUsed.uint8array:g==="nodebuffer"&&(v=f.applyCanBeUsed.nodebuffer),v)for(;1<b;)try{return f.stringifyByChunk(u,g,b)}catch(w){b=Math.floor(b/2)}return f.stringifyByChar(u)}function c(u,b){for(var g=0;g<u.length;g++)b[g]=u[g];return b}t.applyFromCharCode=h;var p={};p.string={string:d,array:function(u){return m(u,new Array(u.length))},arraybuffer:function(u){return p.string.uint8array(u).buffer},uint8array:function(u){return m(u,new Uint8Array(u.length))},nodebuffer:function(u){return m(u,r.allocBuffer(u.length))}},p.array={string:h,array:d,arraybuffer:function(u){return new Uint8Array(u).buffer},uint8array:function(u){return new Uint8Array(u)},nodebuffer:function(u){return r.newBufferFrom(u)}},p.arraybuffer={string:function(u){return h(new Uint8Array(u))},array:function(u){return c(new Uint8Array(u),new Array(u.byteLength))},arraybuffer:d,uint8array:function(u){return new Uint8Array(u)},nodebuffer:function(u){return r.newBufferFrom(new Uint8Array(u))}},p.uint8array={string:h,array:function(u){return c(u,new Array(u.length))},arraybuffer:function(u){return u.buffer},uint8array:d,nodebuffer:function(u){return r.newBufferFrom(u)}},p.nodebuffer={string:h,array:function(u){return c(u,new Array(u.length))},arraybuffer:function(u){return p.nodebuffer.uint8array(u).buffer},uint8array:function(u){return c(u,new Uint8Array(u.length))},nodebuffer:d},t.transformTo=function(u,b){if(b=b||"",!u)return b;t.checkSupport(u);var g=t.getTypeOf(b);return p[g][u](b)},t.resolve=function(u){for(var b=u.split("/"),g=[],v=0;v<b.length;v++){var w=b[v];w==="."||w===""&&v!==0&&v!==b.length-1||(w===".."?g.pop():g.push(w))}return g.join("/")},t.getTypeOf=function(u){return typeof u=="string"?"string":Object.prototype.toString.call(u)==="[object Array]"?"array":e.nodebuffer&&r.isBuffer(u)?"nodebuffer":e.uint8array&&u instanceof Uint8Array?"uint8array":e.arraybuffer&&u instanceof ArrayBuffer?"arraybuffer":void 0},t.checkSupport=function(u){if(!e[u.toLowerCase()])throw new Error(u+" is not supported by this platform")},t.MAX_VALUE_16BITS=65535,t.MAX_VALUE_32BITS=-1,t.pretty=function(u){var b,g,v="";for(g=0;g<(u||"").length;g++)v+="\\x"+((b=u.charCodeAt(g))<16?"0":"")+b.toString(16).toUpperCase();return v},t.delay=function(u,b,g){setImmediate(function(){u.apply(g||null,b||[])})},t.inherits=function(u,b){function g(){}g.prototype=b.prototype,u.prototype=new g},t.extend=function(){var u,b,g={};for(u=0;u<arguments.length;u++)for(b in arguments[u])Object.prototype.hasOwnProperty.call(arguments[u],b)&&g[b]===void 0&&(g[b]=arguments[u][b]);return g},t.prepareContent=function(u,b,g,v,w){return s.Promise.resolve(b).then(function(k){return e.blob&&(k instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(k))!==-1)&&typeof FileReader!="undefined"?new s.Promise(function(E,T){var M=new FileReader;M.onload=function(O){E(O.target.result)},M.onerror=function(O){T(O.target.error)},M.readAsArrayBuffer(k)}):k}).then(function(k){var E=t.getTypeOf(k);return E?(E==="arraybuffer"?k=t.transformTo("uint8array",k):E==="string"&&(w?k=i.decode(k):g&&v!==!0&&(k=function(T){return m(T,e.uint8array?new Uint8Array(T.length):new Array(T.length))}(k))),k):s.Promise.reject(new Error("Can't read the data of '"+u+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,l,t){"use strict";var e=n("./reader/readerFor"),i=n("./utils"),r=n("./signature"),s=n("./zipEntry"),d=n("./support");function m(f){this.files=[],this.loadOptions=f}m.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var h=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(h)+", expected "+i.pretty(f)+")")}},isSignature:function(f,h){var c=this.reader.index;this.reader.setIndex(f);var p=this.reader.readString(4)===h;return this.reader.setIndex(c),p},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),h=d.uint8array?"uint8array":"array",c=i.transformTo(h,f);this.zipComment=this.loadOptions.decodeFileName(c)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,h,c,p=this.zip64EndOfCentralSize-44;0<p;)f=this.reader.readInt(2),h=this.reader.readInt(4),c=this.reader.readData(h),this.zip64ExtensibleData[f]={id:f,length:h,value:c}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,h;for(f=0;f<this.files.length;f++)h=this.files[f],this.reader.setIndex(h.localHeaderOffset),this.checkSignature(r.LOCAL_FILE_HEADER),h.readLocalPart(this.reader),h.handleUTF8(),h.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(r.CENTRAL_FILE_HEADER);)(f=new s({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(r.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,r.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var h=f;if(this.checkSignature(r.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(r.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(r.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,r.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(r.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(r.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var c=this.centralDirOffset+this.centralDirSize;this.zip64&&(c+=20,c+=12+this.zip64EndOfCentralSize);var p=h-c;if(0<p)this.isSignature(h,r.CENTRAL_FILE_HEADER)||(this.reader.zero=p);else if(p<0)throw new Error("Corrupted zip: missing "+Math.abs(p)+" bytes.")},prepareReader:function(f){this.reader=e(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},l.exports=m},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,l,t){"use strict";var e=n("./reader/readerFor"),i=n("./utils"),r=n("./compressedObject"),s=n("./crc32"),d=n("./utf8"),m=n("./compressions"),f=n("./support");function h(c,p){this.options=c,this.loadOptions=p}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(c){var p,u;if(c.skip(22),this.fileNameLength=c.readInt(2),u=c.readInt(2),this.fileName=c.readData(this.fileNameLength),c.skip(u),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((p=function(b){for(var g in m)if(Object.prototype.hasOwnProperty.call(m,g)&&m[g].magic===b)return m[g];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new r(this.compressedSize,this.uncompressedSize,this.crc32,p,c.readData(this.compressedSize))},readCentralPart:function(c){this.versionMadeBy=c.readInt(2),c.skip(2),this.bitFlag=c.readInt(2),this.compressionMethod=c.readString(2),this.date=c.readDate(),this.crc32=c.readInt(4),this.compressedSize=c.readInt(4),this.uncompressedSize=c.readInt(4);var p=c.readInt(2);if(this.extraFieldsLength=c.readInt(2),this.fileCommentLength=c.readInt(2),this.diskNumberStart=c.readInt(2),this.internalFileAttributes=c.readInt(2),this.externalFileAttributes=c.readInt(4),this.localHeaderOffset=c.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");c.skip(p),this.readExtraFields(c),this.parseZIP64ExtraField(c),this.fileComment=c.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var c=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),c==0&&(this.dosPermissions=63&this.externalFileAttributes),c==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var c=e(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=c.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=c.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=c.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=c.readInt(4))}},readExtraFields:function(c){var p,u,b,g=c.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});c.index+4<g;)p=c.readInt(2),u=c.readInt(2),b=c.readData(u),this.extraFields[p]={id:p,length:u,value:b};c.setIndex(g)},handleUTF8:function(){var c=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=d.utf8decode(this.fileName),this.fileCommentStr=d.utf8decode(this.fileComment);else{var p=this.findExtraFieldUnicodePath();if(p!==null)this.fileNameStr=p;else{var u=i.transformTo(c,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(u)}var b=this.findExtraFieldUnicodeComment();if(b!==null)this.fileCommentStr=b;else{var g=i.transformTo(c,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(g)}}},findExtraFieldUnicodePath:function(){var c=this.extraFields[28789];if(c){var p=e(c.value);return p.readInt(1)!==1||s(this.fileName)!==p.readInt(4)?null:d.utf8decode(p.readData(c.length-5))}return null},findExtraFieldUnicodeComment:function(){var c=this.extraFields[25461];if(c){var p=e(c.value);return p.readInt(1)!==1||s(this.fileComment)!==p.readInt(4)?null:d.utf8decode(p.readData(c.length-5))}return null}},l.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,l,t){"use strict";function e(p,u,b){this.name=p,this.dir=b.dir,this.date=b.date,this.comment=b.comment,this.unixPermissions=b.unixPermissions,this.dosPermissions=b.dosPermissions,this._data=u,this._dataBinary=b.binary,this.options={compression:b.compression,compressionOptions:b.compressionOptions}}var i=n("./stream/StreamHelper"),r=n("./stream/DataWorker"),s=n("./utf8"),d=n("./compressedObject"),m=n("./stream/GenericWorker");e.prototype={internalStream:function(p){var u=null,b="string";try{if(!p)throw new Error("No output type specified.");var g=(b=p.toLowerCase())==="string"||b==="text";b!=="binarystring"&&b!=="text"||(b="string"),u=this._decompressWorker();var v=!this._dataBinary;v&&!g&&(u=u.pipe(new s.Utf8EncodeWorker)),!v&&g&&(u=u.pipe(new s.Utf8DecodeWorker))}catch(w){(u=new m("error")).error(w)}return new i(u,b,"")},async:function(p,u){return this.internalStream(p).accumulate(u)},nodeStream:function(p,u){return this.internalStream(p||"nodebuffer").toNodejsStream(u)},_compressWorker:function(p,u){if(this._data instanceof d&&this._data.compression.magic===p.magic)return this._data.getCompressedWorker();var b=this._decompressWorker();return this._dataBinary||(b=b.pipe(new s.Utf8EncodeWorker)),d.createWorkerFrom(b,p,u)},_decompressWorker:function(){return this._data instanceof d?this._data.getContentWorker():this._data instanceof m?this._data:new r(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},c=0;c<f.length;c++)e.prototype[f[c]]=h;l.exports=e},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,l,t){(function(e){"use strict";var i,r,s=e.MutationObserver||e.WebKitMutationObserver;if(s){var d=0,m=new s(p),f=e.document.createTextNode("");m.observe(f,{characterData:!0}),i=function(){f.data=d=++d%2}}else if(e.setImmediate||e.MessageChannel===void 0)i="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var u=e.document.createElement("script");u.onreadystatechange=function(){p(),u.onreadystatechange=null,u.parentNode.removeChild(u),u=null},e.document.documentElement.appendChild(u)}:function(){setTimeout(p,0)};else{var h=new e.MessageChannel;h.port1.onmessage=p,i=function(){h.port2.postMessage(0)}}var c=[];function p(){var u,b;r=!0;for(var g=c.length;g;){for(b=c,c=[],u=-1;++u<g;)b[u]();g=c.length}r=!1}l.exports=function(u){c.push(u)!==1||r||i()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],37:[function(n,l,t){"use strict";var e=n("immediate");function i(){}var r={},s=["REJECTED"],d=["FULFILLED"],m=["PENDING"];function f(g){if(typeof g!="function")throw new TypeError("resolver must be a function");this.state=m,this.queue=[],this.outcome=void 0,g!==i&&u(this,g)}function h(g,v,w){this.promise=g,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof w=="function"&&(this.onRejected=w,this.callRejected=this.otherCallRejected)}function c(g,v,w){e(function(){var k;try{k=v(w)}catch(E){return r.reject(g,E)}k===g?r.reject(g,new TypeError("Cannot resolve promise with itself")):r.resolve(g,k)})}function p(g){var v=g&&g.then;if(g&&(typeof g=="object"||typeof g=="function")&&typeof v=="function")return function(){v.apply(g,arguments)}}function u(g,v){var w=!1;function k(M){w||(w=!0,r.reject(g,M))}function E(M){w||(w=!0,r.resolve(g,M))}var T=b(function(){v(E,k)});T.status==="error"&&k(T.value)}function b(g,v){var w={};try{w.value=g(v),w.status="success"}catch(k){w.status="error",w.value=k}return w}(l.exports=f).prototype.finally=function(g){if(typeof g!="function")return this;var v=this.constructor;return this.then(function(w){return v.resolve(g()).then(function(){return w})},function(w){return v.resolve(g()).then(function(){throw w})})},f.prototype.catch=function(g){return this.then(null,g)},f.prototype.then=function(g,v){if(typeof g!="function"&&this.state===d||typeof v!="function"&&this.state===s)return this;var w=new this.constructor(i);return this.state!==m?c(w,this.state===d?g:v,this.outcome):this.queue.push(new h(w,g,v)),w},h.prototype.callFulfilled=function(g){r.resolve(this.promise,g)},h.prototype.otherCallFulfilled=function(g){c(this.promise,this.onFulfilled,g)},h.prototype.callRejected=function(g){r.reject(this.promise,g)},h.prototype.otherCallRejected=function(g){c(this.promise,this.onRejected,g)},r.resolve=function(g,v){var w=b(p,v);if(w.status==="error")return r.reject(g,w.value);var k=w.value;if(k)u(g,k);else{g.state=d,g.outcome=v;for(var E=-1,T=g.queue.length;++E<T;)g.queue[E].callFulfilled(v)}return g},r.reject=function(g,v){g.state=s,g.outcome=v;for(var w=-1,k=g.queue.length;++w<k;)g.queue[w].callRejected(v);return g},f.resolve=function(g){return g instanceof this?g:r.resolve(new this(i),g)},f.reject=function(g){var v=new this(i);return r.reject(v,g)},f.all=function(g){var v=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=g.length,k=!1;if(!w)return this.resolve([]);for(var E=new Array(w),T=0,M=-1,O=new this(i);++M<w;)A(g[M],M);return O;function A(R,G){v.resolve(R).then(function(_){E[G]=_,++T!==w||k||(k=!0,r.resolve(O,E))},function(_){k||(k=!0,r.reject(O,_))})}},f.race=function(g){var v=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=g.length,k=!1;if(!w)return this.resolve([]);for(var E=-1,T=new this(i);++E<w;)M=g[E],v.resolve(M).then(function(O){k||(k=!0,r.resolve(T,O))},function(O){k||(k=!0,r.reject(T,O))});var M;return T}},{immediate:36}],38:[function(n,l,t){"use strict";var e={};(0,n("./lib/utils/common").assign)(e,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),l.exports=e},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,l,t){"use strict";var e=n("./zlib/deflate"),i=n("./utils/common"),r=n("./utils/strings"),s=n("./zlib/messages"),d=n("./zlib/zstream"),m=Object.prototype.toString,f=0,h=-1,c=0,p=8;function u(g){if(!(this instanceof u))return new u(g);this.options=i.assign({level:h,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:c,to:""},g||{});var v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var w=e.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(w!==f)throw new Error(s[w]);if(v.header&&e.deflateSetHeader(this.strm,v.header),v.dictionary){var k;if(k=typeof v.dictionary=="string"?r.string2buf(v.dictionary):m.call(v.dictionary)==="[object ArrayBuffer]"?new Uint8Array(v.dictionary):v.dictionary,(w=e.deflateSetDictionary(this.strm,k))!==f)throw new Error(s[w]);this._dict_set=!0}}function b(g,v){var w=new u(v);if(w.push(g,!0),w.err)throw w.msg||s[w.err];return w.result}u.prototype.push=function(g,v){var w,k,E=this.strm,T=this.options.chunkSize;if(this.ended)return!1;k=v===~~v?v:v===!0?4:0,typeof g=="string"?E.input=r.string2buf(g):m.call(g)==="[object ArrayBuffer]"?E.input=new Uint8Array(g):E.input=g,E.next_in=0,E.avail_in=E.input.length;do{if(E.avail_out===0&&(E.output=new i.Buf8(T),E.next_out=0,E.avail_out=T),(w=e.deflate(E,k))!==1&&w!==f)return this.onEnd(w),!(this.ended=!0);E.avail_out!==0&&(E.avail_in!==0||k!==4&&k!==2)||(this.options.to==="string"?this.onData(r.buf2binstring(i.shrinkBuf(E.output,E.next_out))):this.onData(i.shrinkBuf(E.output,E.next_out)))}while((0<E.avail_in||E.avail_out===0)&&w!==1);return k===4?(w=e.deflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===f):k!==2||(this.onEnd(f),!(E.avail_out=0))},u.prototype.onData=function(g){this.chunks.push(g)},u.prototype.onEnd=function(g){g===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},t.Deflate=u,t.deflate=b,t.deflateRaw=function(g,v){return(v=v||{}).raw=!0,b(g,v)},t.gzip=function(g,v){return(v=v||{}).gzip=!0,b(g,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,l,t){"use strict";var e=n("./zlib/inflate"),i=n("./utils/common"),r=n("./utils/strings"),s=n("./zlib/constants"),d=n("./zlib/messages"),m=n("./zlib/zstream"),f=n("./zlib/gzheader"),h=Object.prototype.toString;function c(u){if(!(this instanceof c))return new c(u);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},u||{});var b=this.options;b.raw&&0<=b.windowBits&&b.windowBits<16&&(b.windowBits=-b.windowBits,b.windowBits===0&&(b.windowBits=-15)),!(0<=b.windowBits&&b.windowBits<16)||u&&u.windowBits||(b.windowBits+=32),15<b.windowBits&&b.windowBits<48&&!(15&b.windowBits)&&(b.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new m,this.strm.avail_out=0;var g=e.inflateInit2(this.strm,b.windowBits);if(g!==s.Z_OK)throw new Error(d[g]);this.header=new f,e.inflateGetHeader(this.strm,this.header)}function p(u,b){var g=new c(b);if(g.push(u,!0),g.err)throw g.msg||d[g.err];return g.result}c.prototype.push=function(u,b){var g,v,w,k,E,T,M=this.strm,O=this.options.chunkSize,A=this.options.dictionary,R=!1;if(this.ended)return!1;v=b===~~b?b:b===!0?s.Z_FINISH:s.Z_NO_FLUSH,typeof u=="string"?M.input=r.binstring2buf(u):h.call(u)==="[object ArrayBuffer]"?M.input=new Uint8Array(u):M.input=u,M.next_in=0,M.avail_in=M.input.length;do{if(M.avail_out===0&&(M.output=new i.Buf8(O),M.next_out=0,M.avail_out=O),(g=e.inflate(M,s.Z_NO_FLUSH))===s.Z_NEED_DICT&&A&&(T=typeof A=="string"?r.string2buf(A):h.call(A)==="[object ArrayBuffer]"?new Uint8Array(A):A,g=e.inflateSetDictionary(this.strm,T)),g===s.Z_BUF_ERROR&&R===!0&&(g=s.Z_OK,R=!1),g!==s.Z_STREAM_END&&g!==s.Z_OK)return this.onEnd(g),!(this.ended=!0);M.next_out&&(M.avail_out!==0&&g!==s.Z_STREAM_END&&(M.avail_in!==0||v!==s.Z_FINISH&&v!==s.Z_SYNC_FLUSH)||(this.options.to==="string"?(w=r.utf8border(M.output,M.next_out),k=M.next_out-w,E=r.buf2string(M.output,w),M.next_out=k,M.avail_out=O-k,k&&i.arraySet(M.output,M.output,w,k,0),this.onData(E)):this.onData(i.shrinkBuf(M.output,M.next_out)))),M.avail_in===0&&M.avail_out===0&&(R=!0)}while((0<M.avail_in||M.avail_out===0)&&g!==s.Z_STREAM_END);return g===s.Z_STREAM_END&&(v=s.Z_FINISH),v===s.Z_FINISH?(g=e.inflateEnd(this.strm),this.onEnd(g),this.ended=!0,g===s.Z_OK):v!==s.Z_SYNC_FLUSH||(this.onEnd(s.Z_OK),!(M.avail_out=0))},c.prototype.onData=function(u){this.chunks.push(u)},c.prototype.onEnd=function(u){u===s.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=u,this.msg=this.strm.msg},t.Inflate=c,t.inflate=p,t.inflateRaw=function(u,b){return(b=b||{}).raw=!0,p(u,b)},t.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,l,t){"use strict";var e=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";t.assign=function(s){for(var d=Array.prototype.slice.call(arguments,1);d.length;){var m=d.shift();if(m){if(typeof m!="object")throw new TypeError(m+"must be non-object");for(var f in m)m.hasOwnProperty(f)&&(s[f]=m[f])}}return s},t.shrinkBuf=function(s,d){return s.length===d?s:s.subarray?s.subarray(0,d):(s.length=d,s)};var i={arraySet:function(s,d,m,f,h){if(d.subarray&&s.subarray)s.set(d.subarray(m,m+f),h);else for(var c=0;c<f;c++)s[h+c]=d[m+c]},flattenChunks:function(s){var d,m,f,h,c,p;for(d=f=0,m=s.length;d<m;d++)f+=s[d].length;for(p=new Uint8Array(f),d=h=0,m=s.length;d<m;d++)c=s[d],p.set(c,h),h+=c.length;return p}},r={arraySet:function(s,d,m,f,h){for(var c=0;c<f;c++)s[h+c]=d[m+c]},flattenChunks:function(s){return[].concat.apply([],s)}};t.setTyped=function(s){s?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,i)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,r))},t.setTyped(e)},{}],42:[function(n,l,t){"use strict";var e=n("./common"),i=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch(f){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(f){r=!1}for(var s=new e.Buf8(256),d=0;d<256;d++)s[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;function m(f,h){if(h<65537&&(f.subarray&&r||!f.subarray&&i))return String.fromCharCode.apply(null,e.shrinkBuf(f,h));for(var c="",p=0;p<h;p++)c+=String.fromCharCode(f[p]);return c}s[254]=s[254]=1,t.string2buf=function(f){var h,c,p,u,b,g=f.length,v=0;for(u=0;u<g;u++)(64512&(c=f.charCodeAt(u)))==55296&&u+1<g&&(64512&(p=f.charCodeAt(u+1)))==56320&&(c=65536+(c-55296<<10)+(p-56320),u++),v+=c<128?1:c<2048?2:c<65536?3:4;for(h=new e.Buf8(v),u=b=0;b<v;u++)(64512&(c=f.charCodeAt(u)))==55296&&u+1<g&&(64512&(p=f.charCodeAt(u+1)))==56320&&(c=65536+(c-55296<<10)+(p-56320),u++),c<128?h[b++]=c:(c<2048?h[b++]=192|c>>>6:(c<65536?h[b++]=224|c>>>12:(h[b++]=240|c>>>18,h[b++]=128|c>>>12&63),h[b++]=128|c>>>6&63),h[b++]=128|63&c);return h},t.buf2binstring=function(f){return m(f,f.length)},t.binstring2buf=function(f){for(var h=new e.Buf8(f.length),c=0,p=h.length;c<p;c++)h[c]=f.charCodeAt(c);return h},t.buf2string=function(f,h){var c,p,u,b,g=h||f.length,v=new Array(2*g);for(c=p=0;c<g;)if((u=f[c++])<128)v[p++]=u;else if(4<(b=s[u]))v[p++]=65533,c+=b-1;else{for(u&=b===2?31:b===3?15:7;1<b&&c<g;)u=u<<6|63&f[c++],b--;1<b?v[p++]=65533:u<65536?v[p++]=u:(u-=65536,v[p++]=55296|u>>10&1023,v[p++]=56320|1023&u)}return m(v,p)},t.utf8border=function(f,h){var c;for((h=h||f.length)>f.length&&(h=f.length),c=h-1;0<=c&&(192&f[c])==128;)c--;return c<0||c===0?h:c+s[f[c]]>h?c:h}},{"./common":41}],43:[function(n,l,t){"use strict";l.exports=function(e,i,r,s){for(var d=65535&e|0,m=e>>>16&65535|0,f=0;r!==0;){for(r-=f=2e3<r?2e3:r;m=m+(d=d+i[s++]|0)|0,--f;);d%=65521,m%=65521}return d|m<<16|0}},{}],44:[function(n,l,t){"use strict";l.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}},{}],45:[function(n,l,t){"use strict";var e=function(){for(var i,r=[],s=0;s<256;s++){i=s;for(var d=0;d<8;d++)i=1&i?3988292384^i>>>1:i>>>1;r[s]=i}return r}();l.exports=function(i,r,s,d){var m=e,f=d+s;i^=-1;for(var h=d;h<f;h++)i=i>>>8^m[255&(i^r[h])];return-1^i}},{}],46:[function(n,l,t){"use strict";var e,i=n("../utils/common"),r=n("./trees"),s=n("./adler32"),d=n("./crc32"),m=n("./messages"),f=0,h=4,c=0,p=-2,u=-1,b=4,g=2,v=8,w=9,k=286,E=30,T=19,M=2*k+1,O=15,A=3,R=258,G=R+A+1,_=42,P=113,o=1,N=2,H=3,D=4;function Q(a,B){return a.msg=m[B],B}function U(a){return(a<<1)-(4<a?9:0)}function J(a){for(var B=a.length;0<=--B;)a[B]=0}function z(a){var B=a.state,I=B.pending;I>a.avail_out&&(I=a.avail_out),I!==0&&(i.arraySet(a.output,B.pending_buf,B.pending_out,I,a.next_out),a.next_out+=I,B.pending_out+=I,a.total_out+=I,a.avail_out-=I,B.pending-=I,B.pending===0&&(B.pending_out=0))}function F(a,B){r._tr_flush_block(a,0<=a.block_start?a.block_start:-1,a.strstart-a.block_start,B),a.block_start=a.strstart,z(a.strm)}function Y(a,B){a.pending_buf[a.pending++]=B}function Z(a,B){a.pending_buf[a.pending++]=B>>>8&255,a.pending_buf[a.pending++]=255&B}function j(a,B){var I,x,y=a.max_chain_length,C=a.strstart,X=a.prev_length,L=a.nice_match,S=a.strstart>a.w_size-G?a.strstart-(a.w_size-G):0,$=a.window,q=a.w_mask,W=a.prev,V=a.strstart+R,ie=$[C+X-1],te=$[C+X];a.prev_length>=a.good_match&&(y>>=2),L>a.lookahead&&(L=a.lookahead);do if($[(I=B)+X]===te&&$[I+X-1]===ie&&$[I]===$[C]&&$[++I]===$[C+1]){C+=2,I++;do;while($[++C]===$[++I]&&$[++C]===$[++I]&&$[++C]===$[++I]&&$[++C]===$[++I]&&$[++C]===$[++I]&&$[++C]===$[++I]&&$[++C]===$[++I]&&$[++C]===$[++I]&&C<V);if(x=R-(V-C),C=V-R,X<x){if(a.match_start=B,L<=(X=x))break;ie=$[C+X-1],te=$[C+X]}}while((B=W[B&q])>S&&--y!=0);return X<=a.lookahead?X:a.lookahead}function ae(a){var B,I,x,y,C,X,L,S,$,q,W=a.w_size;do{if(y=a.window_size-a.lookahead-a.strstart,a.strstart>=W+(W-G)){for(i.arraySet(a.window,a.window,W,W,0),a.match_start-=W,a.strstart-=W,a.block_start-=W,B=I=a.hash_size;x=a.head[--B],a.head[B]=W<=x?x-W:0,--I;);for(B=I=W;x=a.prev[--B],a.prev[B]=W<=x?x-W:0,--I;);y+=W}if(a.strm.avail_in===0)break;if(X=a.strm,L=a.window,S=a.strstart+a.lookahead,$=y,q=void 0,q=X.avail_in,$<q&&(q=$),I=q===0?0:(X.avail_in-=q,i.arraySet(L,X.input,X.next_in,q,S),X.state.wrap===1?X.adler=s(X.adler,L,q,S):X.state.wrap===2&&(X.adler=d(X.adler,L,q,S)),X.next_in+=q,X.total_in+=q,q),a.lookahead+=I,a.lookahead+a.insert>=A)for(C=a.strstart-a.insert,a.ins_h=a.window[C],a.ins_h=(a.ins_h<<a.hash_shift^a.window[C+1])&a.hash_mask;a.insert&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[C+A-1])&a.hash_mask,a.prev[C&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=C,C++,a.insert--,!(a.lookahead+a.insert<A)););}while(a.lookahead<G&&a.strm.avail_in!==0)}function de(a,B){for(var I,x;;){if(a.lookahead<G){if(ae(a),a.lookahead<G&&B===f)return o;if(a.lookahead===0)break}if(I=0,a.lookahead>=A&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+A-1])&a.hash_mask,I=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),I!==0&&a.strstart-I<=a.w_size-G&&(a.match_length=j(a,I)),a.match_length>=A)if(x=r._tr_tally(a,a.strstart-a.match_start,a.match_length-A),a.lookahead-=a.match_length,a.match_length<=a.max_lazy_match&&a.lookahead>=A){for(a.match_length--;a.strstart++,a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+A-1])&a.hash_mask,I=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart,--a.match_length!=0;);a.strstart++}else a.strstart+=a.match_length,a.match_length=0,a.ins_h=a.window[a.strstart],a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+1])&a.hash_mask;else x=r._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++;if(x&&(F(a,!1),a.strm.avail_out===0))return o}return a.insert=a.strstart<A-1?a.strstart:A-1,B===h?(F(a,!0),a.strm.avail_out===0?H:D):a.last_lit&&(F(a,!1),a.strm.avail_out===0)?o:N}function ee(a,B){for(var I,x,y;;){if(a.lookahead<G){if(ae(a),a.lookahead<G&&B===f)return o;if(a.lookahead===0)break}if(I=0,a.lookahead>=A&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+A-1])&a.hash_mask,I=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),a.prev_length=a.match_length,a.prev_match=a.match_start,a.match_length=A-1,I!==0&&a.prev_length<a.max_lazy_match&&a.strstart-I<=a.w_size-G&&(a.match_length=j(a,I),a.match_length<=5&&(a.strategy===1||a.match_length===A&&4096<a.strstart-a.match_start)&&(a.match_length=A-1)),a.prev_length>=A&&a.match_length<=a.prev_length){for(y=a.strstart+a.lookahead-A,x=r._tr_tally(a,a.strstart-1-a.prev_match,a.prev_length-A),a.lookahead-=a.prev_length-1,a.prev_length-=2;++a.strstart<=y&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+A-1])&a.hash_mask,I=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),--a.prev_length!=0;);if(a.match_available=0,a.match_length=A-1,a.strstart++,x&&(F(a,!1),a.strm.avail_out===0))return o}else if(a.match_available){if((x=r._tr_tally(a,0,a.window[a.strstart-1]))&&F(a,!1),a.strstart++,a.lookahead--,a.strm.avail_out===0)return o}else a.match_available=1,a.strstart++,a.lookahead--}return a.match_available&&(x=r._tr_tally(a,0,a.window[a.strstart-1]),a.match_available=0),a.insert=a.strstart<A-1?a.strstart:A-1,B===h?(F(a,!0),a.strm.avail_out===0?H:D):a.last_lit&&(F(a,!1),a.strm.avail_out===0)?o:N}function ne(a,B,I,x,y){this.good_length=a,this.max_lazy=B,this.nice_length=I,this.max_chain=x,this.func=y}function le(){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=v,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 i.Buf16(2*M),this.dyn_dtree=new i.Buf16(2*(2*E+1)),this.bl_tree=new i.Buf16(2*(2*T+1)),J(this.dyn_ltree),J(this.dyn_dtree),J(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(O+1),this.heap=new i.Buf16(2*k+1),J(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*k+1),J(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 se(a){var B;return a&&a.state?(a.total_in=a.total_out=0,a.data_type=g,(B=a.state).pending=0,B.pending_out=0,B.wrap<0&&(B.wrap=-B.wrap),B.status=B.wrap?_:P,a.adler=B.wrap===2?0:1,B.last_flush=f,r._tr_init(B),c):Q(a,p)}function he(a){var B=se(a);return B===c&&function(I){I.window_size=2*I.w_size,J(I.head),I.max_lazy_match=e[I.level].max_lazy,I.good_match=e[I.level].good_length,I.nice_match=e[I.level].nice_length,I.max_chain_length=e[I.level].max_chain,I.strstart=0,I.block_start=0,I.lookahead=0,I.insert=0,I.match_length=I.prev_length=A-1,I.match_available=0,I.ins_h=0}(a.state),B}function fe(a,B,I,x,y,C){if(!a)return p;var X=1;if(B===u&&(B=6),x<0?(X=0,x=-x):15<x&&(X=2,x-=16),y<1||w<y||I!==v||x<8||15<x||B<0||9<B||C<0||b<C)return Q(a,p);x===8&&(x=9);var L=new le;return(a.state=L).strm=a,L.wrap=X,L.gzhead=null,L.w_bits=x,L.w_size=1<<L.w_bits,L.w_mask=L.w_size-1,L.hash_bits=y+7,L.hash_size=1<<L.hash_bits,L.hash_mask=L.hash_size-1,L.hash_shift=~~((L.hash_bits+A-1)/A),L.window=new i.Buf8(2*L.w_size),L.head=new i.Buf16(L.hash_size),L.prev=new i.Buf16(L.w_size),L.lit_bufsize=1<<y+6,L.pending_buf_size=4*L.lit_bufsize,L.pending_buf=new i.Buf8(L.pending_buf_size),L.d_buf=1*L.lit_bufsize,L.l_buf=3*L.lit_bufsize,L.level=B,L.strategy=C,L.method=I,he(a)}e=[new ne(0,0,0,0,function(a,B){var I=65535;for(I>a.pending_buf_size-5&&(I=a.pending_buf_size-5);;){if(a.lookahead<=1){if(ae(a),a.lookahead===0&&B===f)return o;if(a.lookahead===0)break}a.strstart+=a.lookahead,a.lookahead=0;var x=a.block_start+I;if((a.strstart===0||a.strstart>=x)&&(a.lookahead=a.strstart-x,a.strstart=x,F(a,!1),a.strm.avail_out===0)||a.strstart-a.block_start>=a.w_size-G&&(F(a,!1),a.strm.avail_out===0))return o}return a.insert=0,B===h?(F(a,!0),a.strm.avail_out===0?H:D):(a.strstart>a.block_start&&(F(a,!1),a.strm.avail_out),o)}),new ne(4,4,8,4,de),new ne(4,5,16,8,de),new ne(4,6,32,32,de),new ne(4,4,16,16,ee),new ne(8,16,32,32,ee),new ne(8,16,128,128,ee),new ne(8,32,128,256,ee),new ne(32,128,258,1024,ee),new ne(32,258,258,4096,ee)],t.deflateInit=function(a,B){return fe(a,B,v,15,8,0)},t.deflateInit2=fe,t.deflateReset=he,t.deflateResetKeep=se,t.deflateSetHeader=function(a,B){return a&&a.state?a.state.wrap!==2?p:(a.state.gzhead=B,c):p},t.deflate=function(a,B){var I,x,y,C;if(!a||!a.state||5<B||B<0)return a?Q(a,p):p;if(x=a.state,!a.output||!a.input&&a.avail_in!==0||x.status===666&&B!==h)return Q(a,a.avail_out===0?-5:p);if(x.strm=a,I=x.last_flush,x.last_flush=B,x.status===_)if(x.wrap===2)a.adler=0,Y(x,31),Y(x,139),Y(x,8),x.gzhead?(Y(x,(x.gzhead.text?1:0)+(x.gzhead.hcrc?2:0)+(x.gzhead.extra?4:0)+(x.gzhead.name?8:0)+(x.gzhead.comment?16:0)),Y(x,255&x.gzhead.time),Y(x,x.gzhead.time>>8&255),Y(x,x.gzhead.time>>16&255),Y(x,x.gzhead.time>>24&255),Y(x,x.level===9?2:2<=x.strategy||x.level<2?4:0),Y(x,255&x.gzhead.os),x.gzhead.extra&&x.gzhead.extra.length&&(Y(x,255&x.gzhead.extra.length),Y(x,x.gzhead.extra.length>>8&255)),x.gzhead.hcrc&&(a.adler=d(a.adler,x.pending_buf,x.pending,0)),x.gzindex=0,x.status=69):(Y(x,0),Y(x,0),Y(x,0),Y(x,0),Y(x,0),Y(x,x.level===9?2:2<=x.strategy||x.level<2?4:0),Y(x,3),x.status=P);else{var X=v+(x.w_bits-8<<4)<<8;X|=(2<=x.strategy||x.level<2?0:x.level<6?1:x.level===6?2:3)<<6,x.strstart!==0&&(X|=32),X+=31-X%31,x.status=P,Z(x,X),x.strstart!==0&&(Z(x,a.adler>>>16),Z(x,65535&a.adler)),a.adler=1}if(x.status===69)if(x.gzhead.extra){for(y=x.pending;x.gzindex<(65535&x.gzhead.extra.length)&&(x.pending!==x.pending_buf_size||(x.gzhead.hcrc&&x.pending>y&&(a.adler=d(a.adler,x.pending_buf,x.pending-y,y)),z(a),y=x.pending,x.pending!==x.pending_buf_size));)Y(x,255&x.gzhead.extra[x.gzindex]),x.gzindex++;x.gzhead.hcrc&&x.pending>y&&(a.adler=d(a.adler,x.pending_buf,x.pending-y,y)),x.gzindex===x.gzhead.extra.length&&(x.gzindex=0,x.status=73)}else x.status=73;if(x.status===73)if(x.gzhead.name){y=x.pending;do{if(x.pending===x.pending_buf_size&&(x.gzhead.hcrc&&x.pending>y&&(a.adler=d(a.adler,x.pending_buf,x.pending-y,y)),z(a),y=x.pending,x.pending===x.pending_buf_size)){C=1;break}C=x.gzindex<x.gzhead.name.length?255&x.gzhead.name.charCodeAt(x.gzindex++):0,Y(x,C)}while(C!==0);x.gzhead.hcrc&&x.pending>y&&(a.adler=d(a.adler,x.pending_buf,x.pending-y,y)),C===0&&(x.gzindex=0,x.status=91)}else x.status=91;if(x.status===91)if(x.gzhead.comment){y=x.pending;do{if(x.pending===x.pending_buf_size&&(x.gzhead.hcrc&&x.pending>y&&(a.adler=d(a.adler,x.pending_buf,x.pending-y,y)),z(a),y=x.pending,x.pending===x.pending_buf_size)){C=1;break}C=x.gzindex<x.gzhead.comment.length?255&x.gzhead.comment.charCodeAt(x.gzindex++):0,Y(x,C)}while(C!==0);x.gzhead.hcrc&&x.pending>y&&(a.adler=d(a.adler,x.pending_buf,x.pending-y,y)),C===0&&(x.status=103)}else x.status=103;if(x.status===103&&(x.gzhead.hcrc?(x.pending+2>x.pending_buf_size&&z(a),x.pending+2<=x.pending_buf_size&&(Y(x,255&a.adler),Y(x,a.adler>>8&255),a.adler=0,x.status=P)):x.status=P),x.pending!==0){if(z(a),a.avail_out===0)return x.last_flush=-1,c}else if(a.avail_in===0&&U(B)<=U(I)&&B!==h)return Q(a,-5);if(x.status===666&&a.avail_in!==0)return Q(a,-5);if(a.avail_in!==0||x.lookahead!==0||B!==f&&x.status!==666){var L=x.strategy===2?function(S,$){for(var q;;){if(S.lookahead===0&&(ae(S),S.lookahead===0)){if($===f)return o;break}if(S.match_length=0,q=r._tr_tally(S,0,S.window[S.strstart]),S.lookahead--,S.strstart++,q&&(F(S,!1),S.strm.avail_out===0))return o}return S.insert=0,$===h?(F(S,!0),S.strm.avail_out===0?H:D):S.last_lit&&(F(S,!1),S.strm.avail_out===0)?o:N}(x,B):x.strategy===3?function(S,$){for(var q,W,V,ie,te=S.window;;){if(S.lookahead<=R){if(ae(S),S.lookahead<=R&&$===f)return o;if(S.lookahead===0)break}if(S.match_length=0,S.lookahead>=A&&0<S.strstart&&(W=te[V=S.strstart-1])===te[++V]&&W===te[++V]&&W===te[++V]){ie=S.strstart+R;do;while(W===te[++V]&&W===te[++V]&&W===te[++V]&&W===te[++V]&&W===te[++V]&&W===te[++V]&&W===te[++V]&&W===te[++V]&&V<ie);S.match_length=R-(ie-V),S.match_length>S.lookahead&&(S.match_length=S.lookahead)}if(S.match_length>=A?(q=r._tr_tally(S,1,S.match_length-A),S.lookahead-=S.match_length,S.strstart+=S.match_length,S.match_length=0):(q=r._tr_tally(S,0,S.window[S.strstart]),S.lookahead--,S.strstart++),q&&(F(S,!1),S.strm.avail_out===0))return o}return S.insert=0,$===h?(F(S,!0),S.strm.avail_out===0?H:D):S.last_lit&&(F(S,!1),S.strm.avail_out===0)?o:N}(x,B):e[x.level].func(x,B);if(L!==H&&L!==D||(x.status=666),L===o||L===H)return a.avail_out===0&&(x.last_flush=-1),c;if(L===N&&(B===1?r._tr_align(x):B!==5&&(r._tr_stored_block(x,0,0,!1),B===3&&(J(x.head),x.lookahead===0&&(x.strstart=0,x.block_start=0,x.insert=0))),z(a),a.avail_out===0))return x.last_flush=-1,c}return B!==h?c:x.wrap<=0?1:(x.wrap===2?(Y(x,255&a.adler),Y(x,a.adler>>8&255),Y(x,a.adler>>16&255),Y(x,a.adler>>24&255),Y(x,255&a.total_in),Y(x,a.total_in>>8&255),Y(x,a.total_in>>16&255),Y(x,a.total_in>>24&255)):(Z(x,a.adler>>>16),Z(x,65535&a.adler)),z(a),0<x.wrap&&(x.wrap=-x.wrap),x.pending!==0?c:1)},t.deflateEnd=function(a){var B;return a&&a.state?(B=a.state.status)!==_&&B!==69&&B!==73&&B!==91&&B!==103&&B!==P&&B!==666?Q(a,p):(a.state=null,B===P?Q(a,-3):c):p},t.deflateSetDictionary=function(a,B){var I,x,y,C,X,L,S,$,q=B.length;if(!a||!a.state||(C=(I=a.state).wrap)===2||C===1&&I.status!==_||I.lookahead)return p;for(C===1&&(a.adler=s(a.adler,B,q,0)),I.wrap=0,q>=I.w_size&&(C===0&&(J(I.head),I.strstart=0,I.block_start=0,I.insert=0),$=new i.Buf8(I.w_size),i.arraySet($,B,q-I.w_size,I.w_size,0),B=$,q=I.w_size),X=a.avail_in,L=a.next_in,S=a.input,a.avail_in=q,a.next_in=0,a.input=B,ae(I);I.lookahead>=A;){for(x=I.strstart,y=I.lookahead-(A-1);I.ins_h=(I.ins_h<<I.hash_shift^I.window[x+A-1])&I.hash_mask,I.prev[x&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=x,x++,--y;);I.strstart=x,I.lookahead=A-1,ae(I)}return I.strstart+=I.lookahead,I.block_start=I.strstart,I.insert=I.lookahead,I.lookahead=0,I.match_length=I.prev_length=A-1,I.match_available=0,a.next_in=L,a.input=S,a.avail_in=X,I.wrap=C,c},t.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,l,t){"use strict";l.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,l,t){"use strict";l.exports=function(e,i){var r,s,d,m,f,h,c,p,u,b,g,v,w,k,E,T,M,O,A,R,G,_,P,o,N;r=e.state,s=e.next_in,o=e.input,d=s+(e.avail_in-5),m=e.next_out,N=e.output,f=m-(i-e.avail_out),h=m+(e.avail_out-257),c=r.dmax,p=r.wsize,u=r.whave,b=r.wnext,g=r.window,v=r.hold,w=r.bits,k=r.lencode,E=r.distcode,T=(1<<r.lenbits)-1,M=(1<<r.distbits)-1;e:do{w<15&&(v+=o[s++]<<w,w+=8,v+=o[s++]<<w,w+=8),O=k[v&T];t:for(;;){if(v>>>=A=O>>>24,w-=A,(A=O>>>16&255)===0)N[m++]=65535&O;else{if(!(16&A)){if(!(64&A)){O=k[(65535&O)+(v&(1<<A)-1)];continue t}if(32&A){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}R=65535&O,(A&=15)&&(w<A&&(v+=o[s++]<<w,w+=8),R+=v&(1<<A)-1,v>>>=A,w-=A),w<15&&(v+=o[s++]<<w,w+=8,v+=o[s++]<<w,w+=8),O=E[v&M];n:for(;;){if(v>>>=A=O>>>24,w-=A,!(16&(A=O>>>16&255))){if(!(64&A)){O=E[(65535&O)+(v&(1<<A)-1)];continue n}e.msg="invalid distance code",r.mode=30;break e}if(G=65535&O,w<(A&=15)&&(v+=o[s++]<<w,(w+=8)<A&&(v+=o[s++]<<w,w+=8)),c<(G+=v&(1<<A)-1)){e.msg="invalid distance too far back",r.mode=30;break e}if(v>>>=A,w-=A,(A=m-f)<G){if(u<(A=G-A)&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(P=g,(_=0)===b){if(_+=p-A,A<R){for(R-=A;N[m++]=g[_++],--A;);_=m-G,P=N}}else if(b<A){if(_+=p+b-A,(A-=b)<R){for(R-=A;N[m++]=g[_++],--A;);if(_=0,b<R){for(R-=A=b;N[m++]=g[_++],--A;);_=m-G,P=N}}}else if(_+=b-A,A<R){for(R-=A;N[m++]=g[_++],--A;);_=m-G,P=N}for(;2<R;)N[m++]=P[_++],N[m++]=P[_++],N[m++]=P[_++],R-=3;R&&(N[m++]=P[_++],1<R&&(N[m++]=P[_++]))}else{for(_=m-G;N[m++]=N[_++],N[m++]=N[_++],N[m++]=N[_++],2<(R-=3););R&&(N[m++]=N[_++],1<R&&(N[m++]=N[_++]))}break}}break}}while(s<d&&m<h);s-=R=w>>3,v&=(1<<(w-=R<<3))-1,e.next_in=s,e.next_out=m,e.avail_in=s<d?d-s+5:5-(s-d),e.avail_out=m<h?h-m+257:257-(m-h),r.hold=v,r.bits=w}},{}],49:[function(n,l,t){"use strict";var e=n("../utils/common"),i=n("./adler32"),r=n("./crc32"),s=n("./inffast"),d=n("./inftrees"),m=1,f=2,h=0,c=-2,p=1,u=852,b=592;function g(_){return(_>>>24&255)+(_>>>8&65280)+((65280&_)<<8)+((255&_)<<24)}function v(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,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 e.Buf16(320),this.work=new e.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(_){var P;return _&&_.state?(P=_.state,_.total_in=_.total_out=P.total=0,_.msg="",P.wrap&&(_.adler=1&P.wrap),P.mode=p,P.last=0,P.havedict=0,P.dmax=32768,P.head=null,P.hold=0,P.bits=0,P.lencode=P.lendyn=new e.Buf32(u),P.distcode=P.distdyn=new e.Buf32(b),P.sane=1,P.back=-1,h):c}function k(_){var P;return _&&_.state?((P=_.state).wsize=0,P.whave=0,P.wnext=0,w(_)):c}function E(_,P){var o,N;return _&&_.state?(N=_.state,P<0?(o=0,P=-P):(o=1+(P>>4),P<48&&(P&=15)),P&&(P<8||15<P)?c:(N.window!==null&&N.wbits!==P&&(N.window=null),N.wrap=o,N.wbits=P,k(_))):c}function T(_,P){var o,N;return _?(N=new v,(_.state=N).window=null,(o=E(_,P))!==h&&(_.state=null),o):c}var M,O,A=!0;function R(_){if(A){var P;for(M=new e.Buf32(512),O=new e.Buf32(32),P=0;P<144;)_.lens[P++]=8;for(;P<256;)_.lens[P++]=9;for(;P<280;)_.lens[P++]=7;for(;P<288;)_.lens[P++]=8;for(d(m,_.lens,0,288,M,0,_.work,{bits:9}),P=0;P<32;)_.lens[P++]=5;d(f,_.lens,0,32,O,0,_.work,{bits:5}),A=!1}_.lencode=M,_.lenbits=9,_.distcode=O,_.distbits=5}function G(_,P,o,N){var H,D=_.state;return D.window===null&&(D.wsize=1<<D.wbits,D.wnext=0,D.whave=0,D.window=new e.Buf8(D.wsize)),N>=D.wsize?(e.arraySet(D.window,P,o-D.wsize,D.wsize,0),D.wnext=0,D.whave=D.wsize):(N<(H=D.wsize-D.wnext)&&(H=N),e.arraySet(D.window,P,o-N,H,D.wnext),(N-=H)?(e.arraySet(D.window,P,o-N,N,0),D.wnext=N,D.whave=D.wsize):(D.wnext+=H,D.wnext===D.wsize&&(D.wnext=0),D.whave<D.wsize&&(D.whave+=H))),0}t.inflateReset=k,t.inflateReset2=E,t.inflateResetKeep=w,t.inflateInit=function(_){return T(_,15)},t.inflateInit2=T,t.inflate=function(_,P){var o,N,H,D,Q,U,J,z,F,Y,Z,j,ae,de,ee,ne,le,se,he,fe,a,B,I,x,y=0,C=new e.Buf8(4),X=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!_||!_.state||!_.output||!_.input&&_.avail_in!==0)return c;(o=_.state).mode===12&&(o.mode=13),Q=_.next_out,H=_.output,J=_.avail_out,D=_.next_in,N=_.input,U=_.avail_in,z=o.hold,F=o.bits,Y=U,Z=J,B=h;e:for(;;)switch(o.mode){case p:if(o.wrap===0){o.mode=13;break}for(;F<16;){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}if(2&o.wrap&&z===35615){C[o.check=0]=255&z,C[1]=z>>>8&255,o.check=r(o.check,C,2,0),F=z=0,o.mode=2;break}if(o.flags=0,o.head&&(o.head.done=!1),!(1&o.wrap)||(((255&z)<<8)+(z>>8))%31){_.msg="incorrect header check",o.mode=30;break}if((15&z)!=8){_.msg="unknown compression method",o.mode=30;break}if(F-=4,a=8+(15&(z>>>=4)),o.wbits===0)o.wbits=a;else if(a>o.wbits){_.msg="invalid window size",o.mode=30;break}o.dmax=1<<a,_.adler=o.check=1,o.mode=512&z?10:12,F=z=0;break;case 2:for(;F<16;){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}if(o.flags=z,(255&o.flags)!=8){_.msg="unknown compression method",o.mode=30;break}if(57344&o.flags){_.msg="unknown header flags set",o.mode=30;break}o.head&&(o.head.text=z>>8&1),512&o.flags&&(C[0]=255&z,C[1]=z>>>8&255,o.check=r(o.check,C,2,0)),F=z=0,o.mode=3;case 3:for(;F<32;){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}o.head&&(o.head.time=z),512&o.flags&&(C[0]=255&z,C[1]=z>>>8&255,C[2]=z>>>16&255,C[3]=z>>>24&255,o.check=r(o.check,C,4,0)),F=z=0,o.mode=4;case 4:for(;F<16;){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}o.head&&(o.head.xflags=255&z,o.head.os=z>>8),512&o.flags&&(C[0]=255&z,C[1]=z>>>8&255,o.check=r(o.check,C,2,0)),F=z=0,o.mode=5;case 5:if(1024&o.flags){for(;F<16;){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}o.length=z,o.head&&(o.head.extra_len=z),512&o.flags&&(C[0]=255&z,C[1]=z>>>8&255,o.check=r(o.check,C,2,0)),F=z=0}else o.head&&(o.head.extra=null);o.mode=6;case 6:if(1024&o.flags&&(U<(j=o.length)&&(j=U),j&&(o.head&&(a=o.head.extra_len-o.length,o.head.extra||(o.head.extra=new Array(o.head.extra_len)),e.arraySet(o.head.extra,N,D,j,a)),512&o.flags&&(o.check=r(o.check,N,j,D)),U-=j,D+=j,o.length-=j),o.length))break e;o.length=0,o.mode=7;case 7:if(2048&o.flags){if(U===0)break e;for(j=0;a=N[D+j++],o.head&&a&&o.length<65536&&(o.head.name+=String.fromCharCode(a)),a&&j<U;);if(512&o.flags&&(o.check=r(o.check,N,j,D)),U-=j,D+=j,a)break e}else o.head&&(o.head.name=null);o.length=0,o.mode=8;case 8:if(4096&o.flags){if(U===0)break e;for(j=0;a=N[D+j++],o.head&&a&&o.length<65536&&(o.head.comment+=String.fromCharCode(a)),a&&j<U;);if(512&o.flags&&(o.check=r(o.check,N,j,D)),U-=j,D+=j,a)break e}else o.head&&(o.head.comment=null);o.mode=9;case 9:if(512&o.flags){for(;F<16;){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}if(z!==(65535&o.check)){_.msg="header crc mismatch",o.mode=30;break}F=z=0}o.head&&(o.head.hcrc=o.flags>>9&1,o.head.done=!0),_.adler=o.check=0,o.mode=12;break;case 10:for(;F<32;){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}_.adler=o.check=g(z),F=z=0,o.mode=11;case 11:if(o.havedict===0)return _.next_out=Q,_.avail_out=J,_.next_in=D,_.avail_in=U,o.hold=z,o.bits=F,2;_.adler=o.check=1,o.mode=12;case 12:if(P===5||P===6)break e;case 13:if(o.last){z>>>=7&F,F-=7&F,o.mode=27;break}for(;F<3;){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}switch(o.last=1&z,F-=1,3&(z>>>=1)){case 0:o.mode=14;break;case 1:if(R(o),o.mode=20,P!==6)break;z>>>=2,F-=2;break e;case 2:o.mode=17;break;case 3:_.msg="invalid block type",o.mode=30}z>>>=2,F-=2;break;case 14:for(z>>>=7&F,F-=7&F;F<32;){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}if((65535&z)!=(z>>>16^65535)){_.msg="invalid stored block lengths",o.mode=30;break}if(o.length=65535&z,F=z=0,o.mode=15,P===6)break e;case 15:o.mode=16;case 16:if(j=o.length){if(U<j&&(j=U),J<j&&(j=J),j===0)break e;e.arraySet(H,N,D,j,Q),U-=j,D+=j,J-=j,Q+=j,o.length-=j;break}o.mode=12;break;case 17:for(;F<14;){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}if(o.nlen=257+(31&z),z>>>=5,F-=5,o.ndist=1+(31&z),z>>>=5,F-=5,o.ncode=4+(15&z),z>>>=4,F-=4,286<o.nlen||30<o.ndist){_.msg="too many length or distance symbols",o.mode=30;break}o.have=0,o.mode=18;case 18:for(;o.have<o.ncode;){for(;F<3;){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}o.lens[X[o.have++]]=7&z,z>>>=3,F-=3}for(;o.have<19;)o.lens[X[o.have++]]=0;if(o.lencode=o.lendyn,o.lenbits=7,I={bits:o.lenbits},B=d(0,o.lens,0,19,o.lencode,0,o.work,I),o.lenbits=I.bits,B){_.msg="invalid code lengths set",o.mode=30;break}o.have=0,o.mode=19;case 19:for(;o.have<o.nlen+o.ndist;){for(;ne=(y=o.lencode[z&(1<<o.lenbits)-1])>>>16&255,le=65535&y,!((ee=y>>>24)<=F);){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}if(le<16)z>>>=ee,F-=ee,o.lens[o.have++]=le;else{if(le===16){for(x=ee+2;F<x;){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}if(z>>>=ee,F-=ee,o.have===0){_.msg="invalid bit length repeat",o.mode=30;break}a=o.lens[o.have-1],j=3+(3&z),z>>>=2,F-=2}else if(le===17){for(x=ee+3;F<x;){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}F-=ee,a=0,j=3+(7&(z>>>=ee)),z>>>=3,F-=3}else{for(x=ee+7;F<x;){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}F-=ee,a=0,j=11+(127&(z>>>=ee)),z>>>=7,F-=7}if(o.have+j>o.nlen+o.ndist){_.msg="invalid bit length repeat",o.mode=30;break}for(;j--;)o.lens[o.have++]=a}}if(o.mode===30)break;if(o.lens[256]===0){_.msg="invalid code -- missing end-of-block",o.mode=30;break}if(o.lenbits=9,I={bits:o.lenbits},B=d(m,o.lens,0,o.nlen,o.lencode,0,o.work,I),o.lenbits=I.bits,B){_.msg="invalid literal/lengths set",o.mode=30;break}if(o.distbits=6,o.distcode=o.distdyn,I={bits:o.distbits},B=d(f,o.lens,o.nlen,o.ndist,o.distcode,0,o.work,I),o.distbits=I.bits,B){_.msg="invalid distances set",o.mode=30;break}if(o.mode=20,P===6)break e;case 20:o.mode=21;case 21:if(6<=U&&258<=J){_.next_out=Q,_.avail_out=J,_.next_in=D,_.avail_in=U,o.hold=z,o.bits=F,s(_,Z),Q=_.next_out,H=_.output,J=_.avail_out,D=_.next_in,N=_.input,U=_.avail_in,z=o.hold,F=o.bits,o.mode===12&&(o.back=-1);break}for(o.back=0;ne=(y=o.lencode[z&(1<<o.lenbits)-1])>>>16&255,le=65535&y,!((ee=y>>>24)<=F);){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}if(ne&&!(240&ne)){for(se=ee,he=ne,fe=le;ne=(y=o.lencode[fe+((z&(1<<se+he)-1)>>se)])>>>16&255,le=65535&y,!(se+(ee=y>>>24)<=F);){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}z>>>=se,F-=se,o.back+=se}if(z>>>=ee,F-=ee,o.back+=ee,o.length=le,ne===0){o.mode=26;break}if(32&ne){o.back=-1,o.mode=12;break}if(64&ne){_.msg="invalid literal/length code",o.mode=30;break}o.extra=15&ne,o.mode=22;case 22:if(o.extra){for(x=o.extra;F<x;){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}o.length+=z&(1<<o.extra)-1,z>>>=o.extra,F-=o.extra,o.back+=o.extra}o.was=o.length,o.mode=23;case 23:for(;ne=(y=o.distcode[z&(1<<o.distbits)-1])>>>16&255,le=65535&y,!((ee=y>>>24)<=F);){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}if(!(240&ne)){for(se=ee,he=ne,fe=le;ne=(y=o.distcode[fe+((z&(1<<se+he)-1)>>se)])>>>16&255,le=65535&y,!(se+(ee=y>>>24)<=F);){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}z>>>=se,F-=se,o.back+=se}if(z>>>=ee,F-=ee,o.back+=ee,64&ne){_.msg="invalid distance code",o.mode=30;break}o.offset=le,o.extra=15&ne,o.mode=24;case 24:if(o.extra){for(x=o.extra;F<x;){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}o.offset+=z&(1<<o.extra)-1,z>>>=o.extra,F-=o.extra,o.back+=o.extra}if(o.offset>o.dmax){_.msg="invalid distance too far back",o.mode=30;break}o.mode=25;case 25:if(J===0)break e;if(j=Z-J,o.offset>j){if((j=o.offset-j)>o.whave&&o.sane){_.msg="invalid distance too far back",o.mode=30;break}ae=j>o.wnext?(j-=o.wnext,o.wsize-j):o.wnext-j,j>o.length&&(j=o.length),de=o.window}else de=H,ae=Q-o.offset,j=o.length;for(J<j&&(j=J),J-=j,o.length-=j;H[Q++]=de[ae++],--j;);o.length===0&&(o.mode=21);break;case 26:if(J===0)break e;H[Q++]=o.length,J--,o.mode=21;break;case 27:if(o.wrap){for(;F<32;){if(U===0)break e;U--,z|=N[D++]<<F,F+=8}if(Z-=J,_.total_out+=Z,o.total+=Z,Z&&(_.adler=o.check=o.flags?r(o.check,H,Z,Q-Z):i(o.check,H,Z,Q-Z)),Z=J,(o.flags?z:g(z))!==o.check){_.msg="incorrect data check",o.mode=30;break}F=z=0}o.mode=28;case 28:if(o.wrap&&o.flags){for(;F<32;){if(U===0)break e;U--,z+=N[D++]<<F,F+=8}if(z!==(4294967295&o.total)){_.msg="incorrect length check",o.mode=30;break}F=z=0}o.mode=29;case 29:B=1;break e;case 30:B=-3;break e;case 31:return-4;case 32:default:return c}return _.next_out=Q,_.avail_out=J,_.next_in=D,_.avail_in=U,o.hold=z,o.bits=F,(o.wsize||Z!==_.avail_out&&o.mode<30&&(o.mode<27||P!==4))&&G(_,_.output,_.next_out,Z-_.avail_out)?(o.mode=31,-4):(Y-=_.avail_in,Z-=_.avail_out,_.total_in+=Y,_.total_out+=Z,o.total+=Z,o.wrap&&Z&&(_.adler=o.check=o.flags?r(o.check,H,Z,_.next_out-Z):i(o.check,H,Z,_.next_out-Z)),_.data_type=o.bits+(o.last?64:0)+(o.mode===12?128:0)+(o.mode===20||o.mode===15?256:0),(Y==0&&Z===0||P===4)&&B===h&&(B=-5),B)},t.inflateEnd=function(_){if(!_||!_.state)return c;var P=_.state;return P.window&&(P.window=null),_.state=null,h},t.inflateGetHeader=function(_,P){var o;return _&&_.state&&2&(o=_.state).wrap?((o.head=P).done=!1,h):c},t.inflateSetDictionary=function(_,P){var o,N=P.length;return _&&_.state?(o=_.state).wrap!==0&&o.mode!==11?c:o.mode===11&&i(1,P,N,0)!==o.check?-3:G(_,P,N,N)?(o.mode=31,-4):(o.havedict=1,h):c},t.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,l,t){"use strict";var e=n("../utils/common"),i=[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],r=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],s=[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],d=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];l.exports=function(m,f,h,c,p,u,b,g){var v,w,k,E,T,M,O,A,R,G=g.bits,_=0,P=0,o=0,N=0,H=0,D=0,Q=0,U=0,J=0,z=0,F=null,Y=0,Z=new e.Buf16(16),j=new e.Buf16(16),ae=null,de=0;for(_=0;_<=15;_++)Z[_]=0;for(P=0;P<c;P++)Z[f[h+P]]++;for(H=G,N=15;1<=N&&Z[N]===0;N--);if(N<H&&(H=N),N===0)return p[u++]=20971520,p[u++]=20971520,g.bits=1,0;for(o=1;o<N&&Z[o]===0;o++);for(H<o&&(H=o),_=U=1;_<=15;_++)if(U<<=1,(U-=Z[_])<0)return-1;if(0<U&&(m===0||N!==1))return-1;for(j[1]=0,_=1;_<15;_++)j[_+1]=j[_]+Z[_];for(P=0;P<c;P++)f[h+P]!==0&&(b[j[f[h+P]]++]=P);if(M=m===0?(F=ae=b,19):m===1?(F=i,Y-=257,ae=r,de-=257,256):(F=s,ae=d,-1),_=o,T=u,Q=P=z=0,k=-1,E=(J=1<<(D=H))-1,m===1&&852<J||m===2&&592<J)return 1;for(;;){for(O=_-Q,R=b[P]<M?(A=0,b[P]):b[P]>M?(A=ae[de+b[P]],F[Y+b[P]]):(A=96,0),v=1<<_-Q,o=w=1<<D;p[T+(z>>Q)+(w-=v)]=O<<24|A<<16|R|0,w!==0;);for(v=1<<_-1;z&v;)v>>=1;if(v!==0?(z&=v-1,z+=v):z=0,P++,--Z[_]==0){if(_===N)break;_=f[h+b[P]]}if(H<_&&(z&E)!==k){for(Q===0&&(Q=H),T+=o,U=1<<(D=_-Q);D+Q<N&&!((U-=Z[D+Q])<=0);)D++,U<<=1;if(J+=1<<D,m===1&&852<J||m===2&&592<J)return 1;p[k=z&E]=H<<24|D<<16|T-u|0}}return z!==0&&(p[T+z]=_-Q<<24|64<<16|0),g.bits=H,0}},{"../utils/common":41}],51:[function(n,l,t){"use strict";l.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,l,t){"use strict";var e=n("../utils/common"),i=0,r=1;function s(y){for(var C=y.length;0<=--C;)y[C]=0}var d=0,m=29,f=256,h=f+1+m,c=30,p=19,u=2*h+1,b=15,g=16,v=7,w=256,k=16,E=17,T=18,M=[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],O=[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],A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],R=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],G=new Array(2*(h+2));s(G);var _=new Array(2*c);s(_);var P=new Array(512);s(P);var o=new Array(256);s(o);var N=new Array(m);s(N);var H,D,Q,U=new Array(c);function J(y,C,X,L,S){this.static_tree=y,this.extra_bits=C,this.extra_base=X,this.elems=L,this.max_length=S,this.has_stree=y&&y.length}function z(y,C){this.dyn_tree=y,this.max_code=0,this.stat_desc=C}function F(y){return y<256?P[y]:P[256+(y>>>7)]}function Y(y,C){y.pending_buf[y.pending++]=255&C,y.pending_buf[y.pending++]=C>>>8&255}function Z(y,C,X){y.bi_valid>g-X?(y.bi_buf|=C<<y.bi_valid&65535,Y(y,y.bi_buf),y.bi_buf=C>>g-y.bi_valid,y.bi_valid+=X-g):(y.bi_buf|=C<<y.bi_valid&65535,y.bi_valid+=X)}function j(y,C,X){Z(y,X[2*C],X[2*C+1])}function ae(y,C){for(var X=0;X|=1&y,y>>>=1,X<<=1,0<--C;);return X>>>1}function de(y,C,X){var L,S,$=new Array(b+1),q=0;for(L=1;L<=b;L++)$[L]=q=q+X[L-1]<<1;for(S=0;S<=C;S++){var W=y[2*S+1];W!==0&&(y[2*S]=ae($[W]++,W))}}function ee(y){var C;for(C=0;C<h;C++)y.dyn_ltree[2*C]=0;for(C=0;C<c;C++)y.dyn_dtree[2*C]=0;for(C=0;C<p;C++)y.bl_tree[2*C]=0;y.dyn_ltree[2*w]=1,y.opt_len=y.static_len=0,y.last_lit=y.matches=0}function ne(y){8<y.bi_valid?Y(y,y.bi_buf):0<y.bi_valid&&(y.pending_buf[y.pending++]=y.bi_buf),y.bi_buf=0,y.bi_valid=0}function le(y,C,X,L){var S=2*C,$=2*X;return y[S]<y[$]||y[S]===y[$]&&L[C]<=L[X]}function se(y,C,X){for(var L=y.heap[X],S=X<<1;S<=y.heap_len&&(S<y.heap_len&&le(C,y.heap[S+1],y.heap[S],y.depth)&&S++,!le(C,L,y.heap[S],y.depth));)y.heap[X]=y.heap[S],X=S,S<<=1;y.heap[X]=L}function he(y,C,X){var L,S,$,q,W=0;if(y.last_lit!==0)for(;L=y.pending_buf[y.d_buf+2*W]<<8|y.pending_buf[y.d_buf+2*W+1],S=y.pending_buf[y.l_buf+W],W++,L===0?j(y,S,C):(j(y,($=o[S])+f+1,C),(q=M[$])!==0&&Z(y,S-=N[$],q),j(y,$=F(--L),X),(q=O[$])!==0&&Z(y,L-=U[$],q)),W<y.last_lit;);j(y,w,C)}function fe(y,C){var X,L,S,$=C.dyn_tree,q=C.stat_desc.static_tree,W=C.stat_desc.has_stree,V=C.stat_desc.elems,ie=-1;for(y.heap_len=0,y.heap_max=u,X=0;X<V;X++)$[2*X]!==0?(y.heap[++y.heap_len]=ie=X,y.depth[X]=0):$[2*X+1]=0;for(;y.heap_len<2;)$[2*(S=y.heap[++y.heap_len]=ie<2?++ie:0)]=1,y.depth[S]=0,y.opt_len--,W&&(y.static_len-=q[2*S+1]);for(C.max_code=ie,X=y.heap_len>>1;1<=X;X--)se(y,$,X);for(S=V;X=y.heap[1],y.heap[1]=y.heap[y.heap_len--],se(y,$,1),L=y.heap[1],y.heap[--y.heap_max]=X,y.heap[--y.heap_max]=L,$[2*S]=$[2*X]+$[2*L],y.depth[S]=(y.depth[X]>=y.depth[L]?y.depth[X]:y.depth[L])+1,$[2*X+1]=$[2*L+1]=S,y.heap[1]=S++,se(y,$,1),2<=y.heap_len;);y.heap[--y.heap_max]=y.heap[1],function(te,ue){var Se,pe,Fe,oe,Ne,Ye,be=ue.dyn_tree,ut=ue.max_code,Ot=ue.stat_desc.static_tree,Bt=ue.stat_desc.has_stree,Dt=ue.stat_desc.extra_bits,ft=ue.stat_desc.extra_base,Me=ue.stat_desc.max_length,Oe=0;for(oe=0;oe<=b;oe++)te.bl_count[oe]=0;for(be[2*te.heap[te.heap_max]+1]=0,Se=te.heap_max+1;Se<u;Se++)Me<(oe=be[2*be[2*(pe=te.heap[Se])+1]+1]+1)&&(oe=Me,Oe++),be[2*pe+1]=oe,ut<pe||(te.bl_count[oe]++,Ne=0,ft<=pe&&(Ne=Dt[pe-ft]),Ye=be[2*pe],te.opt_len+=Ye*(oe+Ne),Bt&&(te.static_len+=Ye*(Ot[2*pe+1]+Ne)));if(Oe!==0){do{for(oe=Me-1;te.bl_count[oe]===0;)oe--;te.bl_count[oe]--,te.bl_count[oe+1]+=2,te.bl_count[Me]--,Oe-=2}while(0<Oe);for(oe=Me;oe!==0;oe--)for(pe=te.bl_count[oe];pe!==0;)ut<(Fe=te.heap[--Se])||(be[2*Fe+1]!==oe&&(te.opt_len+=(oe-be[2*Fe+1])*be[2*Fe],be[2*Fe+1]=oe),pe--)}}(y,C),de($,ie,y.bl_count)}function a(y,C,X){var L,S,$=-1,q=C[1],W=0,V=7,ie=4;for(q===0&&(V=138,ie=3),C[2*(X+1)+1]=65535,L=0;L<=X;L++)S=q,q=C[2*(L+1)+1],++W<V&&S===q||(W<ie?y.bl_tree[2*S]+=W:S!==0?(S!==$&&y.bl_tree[2*S]++,y.bl_tree[2*k]++):W<=10?y.bl_tree[2*E]++:y.bl_tree[2*T]++,$=S,ie=(W=0)===q?(V=138,3):S===q?(V=6,3):(V=7,4))}function B(y,C,X){var L,S,$=-1,q=C[1],W=0,V=7,ie=4;for(q===0&&(V=138,ie=3),L=0;L<=X;L++)if(S=q,q=C[2*(L+1)+1],!(++W<V&&S===q)){if(W<ie)for(;j(y,S,y.bl_tree),--W!=0;);else S!==0?(S!==$&&(j(y,S,y.bl_tree),W--),j(y,k,y.bl_tree),Z(y,W-3,2)):W<=10?(j(y,E,y.bl_tree),Z(y,W-3,3)):(j(y,T,y.bl_tree),Z(y,W-11,7));$=S,ie=(W=0)===q?(V=138,3):S===q?(V=6,3):(V=7,4)}}s(U);var I=!1;function x(y,C,X,L){Z(y,(d<<1)+(L?1:0),3),function(S,$,q,W){ne(S),W&&(Y(S,q),Y(S,~q)),e.arraySet(S.pending_buf,S.window,$,q,S.pending),S.pending+=q}(y,C,X,!0)}t._tr_init=function(y){I||(function(){var C,X,L,S,$,q=new Array(b+1);for(S=L=0;S<m-1;S++)for(N[S]=L,C=0;C<1<<M[S];C++)o[L++]=S;for(o[L-1]=S,S=$=0;S<16;S++)for(U[S]=$,C=0;C<1<<O[S];C++)P[$++]=S;for($>>=7;S<c;S++)for(U[S]=$<<7,C=0;C<1<<O[S]-7;C++)P[256+$++]=S;for(X=0;X<=b;X++)q[X]=0;for(C=0;C<=143;)G[2*C+1]=8,C++,q[8]++;for(;C<=255;)G[2*C+1]=9,C++,q[9]++;for(;C<=279;)G[2*C+1]=7,C++,q[7]++;for(;C<=287;)G[2*C+1]=8,C++,q[8]++;for(de(G,h+1,q),C=0;C<c;C++)_[2*C+1]=5,_[2*C]=ae(C,5);H=new J(G,M,f+1,h,b),D=new J(_,O,0,c,b),Q=new J(new Array(0),A,0,p,v)}(),I=!0),y.l_desc=new z(y.dyn_ltree,H),y.d_desc=new z(y.dyn_dtree,D),y.bl_desc=new z(y.bl_tree,Q),y.bi_buf=0,y.bi_valid=0,ee(y)},t._tr_stored_block=x,t._tr_flush_block=function(y,C,X,L){var S,$,q=0;0<y.level?(y.strm.data_type===2&&(y.strm.data_type=function(W){var V,ie=4093624447;for(V=0;V<=31;V++,ie>>>=1)if(1&ie&&W.dyn_ltree[2*V]!==0)return i;if(W.dyn_ltree[18]!==0||W.dyn_ltree[20]!==0||W.dyn_ltree[26]!==0)return r;for(V=32;V<f;V++)if(W.dyn_ltree[2*V]!==0)return r;return i}(y)),fe(y,y.l_desc),fe(y,y.d_desc),q=function(W){var V;for(a(W,W.dyn_ltree,W.l_desc.max_code),a(W,W.dyn_dtree,W.d_desc.max_code),fe(W,W.bl_desc),V=p-1;3<=V&&W.bl_tree[2*R[V]+1]===0;V--);return W.opt_len+=3*(V+1)+5+5+4,V}(y),S=y.opt_len+3+7>>>3,($=y.static_len+3+7>>>3)<=S&&(S=$)):S=$=X+5,X+4<=S&&C!==-1?x(y,C,X,L):y.strategy===4||$===S?(Z(y,2+(L?1:0),3),he(y,G,_)):(Z(y,4+(L?1:0),3),function(W,V,ie,te){var ue;for(Z(W,V-257,5),Z(W,ie-1,5),Z(W,te-4,4),ue=0;ue<te;ue++)Z(W,W.bl_tree[2*R[ue]+1],3);B(W,W.dyn_ltree,V-1),B(W,W.dyn_dtree,ie-1)}(y,y.l_desc.max_code+1,y.d_desc.max_code+1,q+1),he(y,y.dyn_ltree,y.dyn_dtree)),ee(y),L&&ne(y)},t._tr_tally=function(y,C,X){return y.pending_buf[y.d_buf+2*y.last_lit]=C>>>8&255,y.pending_buf[y.d_buf+2*y.last_lit+1]=255&C,y.pending_buf[y.l_buf+y.last_lit]=255&X,y.last_lit++,C===0?y.dyn_ltree[2*X]++:(y.matches++,C--,y.dyn_ltree[2*(o[X]+f+1)]++,y.dyn_dtree[2*F(C)]++),y.last_lit===y.lit_bufsize-1},t._tr_align=function(y){Z(y,2,3),j(y,w,G),function(C){C.bi_valid===16?(Y(C,C.bi_buf),C.bi_buf=0,C.bi_valid=0):8<=C.bi_valid&&(C.pending_buf[C.pending++]=255&C.bi_buf,C.bi_buf>>=8,C.bi_valid-=8)}(y)}},{"../utils/common":41}],53:[function(n,l,t){"use strict";l.exports=function(){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}},{}],54:[function(n,l,t){(function(e){(function(i,r){"use strict";if(!i.setImmediate){var s,d,m,f,h=1,c={},p=!1,u=i.document,b=Object.getPrototypeOf&&Object.getPrototypeOf(i);b=b&&b.setTimeout?b:i,s={}.toString.call(i.process)==="[object process]"?function(k){process.nextTick(function(){v(k)})}:function(){if(i.postMessage&&!i.importScripts){var k=!0,E=i.onmessage;return i.onmessage=function(){k=!1},i.postMessage("","*"),i.onmessage=E,k}}()?(f="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",w,!1):i.attachEvent("onmessage",w),function(k){i.postMessage(f+k,"*")}):i.MessageChannel?((m=new MessageChannel).port1.onmessage=function(k){v(k.data)},function(k){m.port2.postMessage(k)}):u&&"onreadystatechange"in u.createElement("script")?(d=u.documentElement,function(k){var E=u.createElement("script");E.onreadystatechange=function(){v(k),E.onreadystatechange=null,d.removeChild(E),E=null},d.appendChild(E)}):function(k){setTimeout(v,0,k)},b.setImmediate=function(k){typeof k!="function"&&(k=new Function(""+k));for(var E=new Array(arguments.length-1),T=0;T<E.length;T++)E[T]=arguments[T+1];var M={callback:k,args:E};return c[h]=M,s(h),h++},b.clearImmediate=g}function g(k){delete c[k]}function v(k){if(p)setTimeout(v,0,k);else{var E=c[k];if(E){p=!0;try{(function(T){var M=T.callback,O=T.args;switch(O.length){case 0:M();break;case 1:M(O[0]);break;case 2:M(O[0],O[1]);break;case 3:M(O[0],O[1],O[2]);break;default:M.apply(r,O)}})(E)}finally{g(k),p=!1}}}}function w(k){k.source===i&&typeof k.data=="string"&&k.data.indexOf(f)===0&&v(+k.data.slice(f.length))}})(typeof self=="undefined"?e===void 0?this:e:self)}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}]},{},[10])(10)})});var rn={};Wt(rn,{XMindSettingTab:()=>Ve,default:()=>He});module.exports=jt(rn);var K=require("obsidian"),Ge=require("child_process"),we=Ke(require("path")),re=Ke(require("fs")),ct=Ke(Tt()),nn={templatePath:"",dailyNotesIntegration:!0},lt="xmind-preview";var dt=class extends K.ItemView{constructor(t,e){super(t);this.plugin=e,console.log("XMindPreviewView constructor called with plugin:",e)}getViewType(){return lt}async onload(){await super.onload(),console.log("Loading XMind preview view")}getDisplayText(){return this.file?`${this.file.basename} (XMind Preview)`:"XMind Preview"}getIcon(){return"document"}async setState(t,e){return console.log("Setting state:",t),this.file=this.app.vault.getAbstractFileByPath(t.file),await this.onOpen(),super.setState(t,e)}getState(){var t;return{file:(t=this.file)==null?void 0:t.path}}async onOpen(){if(this.contentEl.empty(),this.file&&this.file.extension==="xmind")try{let e=this.app.vault.adapter.getFullPath(this.file.path);await this.extractThumbnail(e);let i=this.contentEl.createDiv({cls:"xmind-preview-container"});if(i.style.display="flex",i.style.flexDirection="column",i.style.alignItems="center",i.style.justifyContent="center",i.style.height="100%",i.style.padding="20px",this.thumbnailPath&&re.existsSync(this.thumbnailPath))try{let d=`data:image/png;base64,${re.readFileSync(this.thumbnailPath).toString("base64")}`,m=i.createEl("img",{cls:"xmind-thumbnail",attr:{src:d,style:"max-width: 100%; height: auto; margin-bottom: 20px;"}})}catch(s){console.error("Error loading thumbnail:",s),this.showNoPreview(i)}else this.showNoPreview(i);i.createEl("button",{text:"Open in XMind",cls:"mod-cta"}).addEventListener("click",()=>{this.plugin&&this.plugin.openXMindFile(this.file)})}catch(t){console.error("Error displaying XMind preview:",t),this.contentEl.setText("Error loading XMind preview")}}showNoPreview(t){t.createEl("div",{text:"No preview available",cls:"xmind-no-preview"})}async extractThumbnail(t){try{if(console.log("Plugin instance:",this.plugin),!this.plugin){console.error("Plugin instance is null");return}let e=this.plugin.tempDirPath;console.log("Temp directory:",e);let i=Date.now();return this.thumbnailPath=we.join(e,`thumbnail_${i}.png`),console.log("Extracting thumbnail from:",t),console.log("Will save thumbnail to:",this.thumbnailPath),new Promise((r,s)=>{try{ct.open(t,{lazyEntries:!0},(d,m)=>{if(d){console.error("Error opening xmind file:",d),r();return}console.log("Successfully opened xmind file");let f=!1;m.readEntry(),m.on("entry",h=>{console.log("Reading entry:",h.fileName),h.fileName==="Thumbnails/thumbnail.png"?(console.log("Found thumbnail!"),f=!0,console.log("Will save thumbnail to:",this.thumbnailPath),m.openReadStream(h,(c,p)=>{if(c){console.error("Error opening read stream:",c),r();return}console.log("Successfully opened read stream");let u=re.createWriteStream(this.thumbnailPath);p.pipe(u),u.on("finish",()=>{console.log("Successfully wrote thumbnail"),m.close(),r()}),u.on("error",b=>{console.error("Error writing thumbnail:",b),r()})})):m.readEntry()}),m.on("end",()=>{console.log("Finished reading zip file, found thumbnail:",f),f||(this.thumbnailPath=void 0,r())}),m.on("error",h=>{console.error("Error reading zip file:",h),r()})})}catch(d){console.error("Error in extractThumbnail:",d),r()}})}catch(e){console.error("Error extracting thumbnail:",e),this.thumbnailPath=void 0}}},He=class extends K.Plugin{constructor(){super(...arguments);this.view=null;this.thumbnailCache=new Map;this.lastCheckedTimes=new Map}async onload(){if(console.log("Loading XMind plugin"),await this.loadSettings(),K.Platform.isMacOS){let e=process.env.TMPDIR||"/tmp";this.tempDirPath=we.join(e,"obsidian-xmind-temp")}else this.tempDirPath=we.join(require("os").tmpdir(),"obsidian-xmind-temp");console.log("XMind temp directory:",this.tempDirPath),this.initializeDirectory(this.tempDirPath);let t=document.createElement("style");t.textContent=`
.xmind-preview-container {
display: flex;
flex-direction: column;
align-items: center;
padding: 10px;
border: 1px solid var(--background-modifier-border);
border-radius: 4px;
margin: 10px 0;
}
.xmind-thumbnail {
max-width: 100%;
margin-bottom: 10px;
}
.xmind-thumbnail img {
max-width: 100%;
height: auto;
border-radius: 4px;
}
.xmind-button-container {
margin-top: 10px;
}
.xmind-open-button {
display: inline-flex;
align-items: center;
padding: 4px 8px;
background-color: var(--interactive-accent);
color: var(--text-on-accent);
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.2s ease;
}
.xmind-open-button:hover {
background-color: var(--interactive-accent-hover);
}
.xmind-no-preview {
padding: 20px;
text-align: center;
color: var(--text-muted);
}
.internal-embed[src$=".xmind"] {
display: block;
text-align: center;
}
.cm-embed-block.cm-embed-xmind {
padding: 10px;
border: 1px solid var(--background-modifier-border);
border-radius: 4px;
margin: 10px 0;
}
`,document.head.appendChild(t),this.register(()=>t.remove()),console.log("XMind CSS styles added"),this.registerExtensions(["xmind"],lt),console.log("XMind extensions registered"),this.registerView(lt,e=>(console.log("Creating XMind preview view"),this.view=new dt(e,this),this.view)),this.registerFileHandler(),console.log("XMind file handler registered"),this.setupEditorExtension(),console.log("XMind editor extension setup complete"),this.addSettingTab(new Ve(this.app,this)),console.log("XMind settings tab added"),this.addCommand({id:"create-xmind-for-current-file",name:"\u4E3A\u5F53\u524D\u6587\u4EF6\u521B\u5EFAXMind\u601D\u7EF4\u5BFC\u56FE",checkCallback:e=>{let i=this.app.workspace.getActiveFile();return i&&i.extension==="md"?(e||(console.log(`[XMind] Manually creating XMind for file: ${i.path}`),this.createXMindForFile(i)),!0):!1}}),this.registerEvent(this.app.workspace.on("layout-change",()=>{console.log("Layout changed - checking for XMind embeds");let e=this.app.workspace.getLeavesOfType("markdown");console.log(`Found ${e.length} markdown views`);for(let i of e){let r=i.view;if(r){if(console.log(`Checking markdown view: ${r.getDisplayText()}, mode: ${r.getMode()}`),r.getMode()==="source"){let s=r.contentEl.querySelector(".cm-editor");if(!s){console.log("No editor element found");continue}let d=s.querySelectorAll(".cm-embed-block");console.log(`Found ${d.length} embed blocks in editor`);for(let h of Array.from(d)){let c=h.getAttribute("data-embed-src");console.log(`Embed block src: ${c}`),c&&c.endsWith(".xmind")&&console.log(`Found XMind embed: ${c}`)}let f=r.editor.getValue().match(/!\[\[(.*?\.xmind)\]\]/g);if(console.log(`Found ${(f==null?void 0:f.length)||0} XMind wiki links in content`),f)for(let h of f)console.log(`XMind wiki link: ${h}`)}else if(r.getMode()==="preview"){let s=r.contentEl.querySelectorAll('.internal-embed[src$=".xmind"]');console.log(`Found ${s.length} XMind embeds in preview mode`)}}}})),this.registerEvent(this.app.workspace.on("file-menu",(e,i)=>{e.addItem(r=>{r.setTitle("New XMind File").setIcon("document").onClick(async()=>{var s;try{let d=i instanceof K.TFolder?i.path:((s=i==null?void 0:i.parent)==null?void 0:s.path)||"",f=we.join(d,"New Mind Map.xmind"),h=this.app.vault.adapter,c=h.getFullPath(f);if(this.settings.templatePath){let p=h.getFullPath(this.settings.templatePath);re.existsSync(p)?(re.copyFileSync(p,c),this.app.vault.adapter.exists(f,!1).then(()=>{this.app.vault.trigger("create",this.app.vault.getAbstractFileByPath(f))}),new K.Notice("XMind file created")):new K.Notice("Template file not found")}else new K.Notice("Template Path not set")}catch(d){console.error("Error creating XMind file:",d),new K.Notice("Error creating XMind file")}})})})),this.registerDailyNotesIntegration()}setupEditorExtension(){console.log("Setting up XMind editor extension"),this.registerMarkdownPostProcessor((r,s)=>{var d;console.log("Markdown post processor called",{contextPath:s.sourcePath,frontmatter:s.frontmatter,sections:((d=s.getSectionInfo(r))==null?void 0:d.text)||"No section info"}),this.processXMindEmbeds(r,s)});let t=null,e=(r,s)=>{t&&clearTimeout(t),t=setTimeout(()=>{this.processEditorXMindEmbeds(r,s),t=null},300)};this.registerEvent(this.app.workspace.on("editor-change",r=>{console.log("Editor changed");let s=this.app.workspace.getActiveViewOfType(K.MarkdownView);if(!s){console.log("No active markdown view found");return}if(s.getMode()!=="source"){console.log("View is not in source mode, current mode:",s.getMode());return}console.log("Processing editor change in source mode");let d=s.contentEl.querySelector(".cm-editor");if(!d){console.log("No editor element found in the view");return}console.log("Editor element found, scheduling XMind embed processing"),e(d,s)})),this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{if(console.log("Active leaf changed"),r&&r.view instanceof K.MarkdownView){let s=r.view;if(console.log(`Active leaf is a markdown view: ${s.getDisplayText()}, mode: ${s.getMode()}`),s.getMode()==="source"){let d=s.contentEl.querySelector(".cm-editor");if(!d){console.log("No editor element found in the view");return}console.log("Editor element found, scheduling XMind embed processing"),setTimeout(()=>{this.processEditorXMindEmbeds(d,s)},500)}}}));let i=new MutationObserver(r=>{var m,f;let s=this.app.workspace.getActiveViewOfType(K.MarkdownView);if(!s||s.getMode()!=="source")return;console.log("DOM mutation detected"),t&&clearTimeout(t);let d=!1;for(let h of r){if(h.type==="childList"){for(let c of Array.from(h.addedNodes))if(c instanceof Element&&(c.classList.contains("file-embed")||c.querySelector(".file-embed")||c.classList.contains("cm-embed-block")&&!c.classList.contains("cm-embed-xmind")||c.querySelector(".cm-embed-block:not(.cm-embed-xmind)")||c.classList.contains("cm-line")&&((m=c.textContent)!=null&&m.includes("![["))&&((f=c.textContent)!=null&&f.includes(".xmind]]"))&&!c.querySelector(".xmind-preview-container"))){d=!0;break}}if(d)break}if(d){let h=s.contentEl.querySelector(".cm-editor");if(!h)return;t=setTimeout(()=>{this.processEditorXMindEmbeds(h,s),t=null},500)}});this.app.workspace.onLayoutReady(()=>{let r=document.querySelector(".cm-editor");r?(i.observe(r,{childList:!0,subtree:!0,attributes:!1,characterData:!1}),console.log("Started observing editor DOM for changes")):(console.log("No editor element found for observation"),i.observe(document.body,{childList:!0,subtree:!0,attributes:!1,characterData:!1}),console.log("Started observing document body for changes"));let s=this.app.workspace.getActiveViewOfType(K.MarkdownView);s&&s.getMode()==="source"&&r&&(console.log("Processing initial embeds"),this.processEditorXMindEmbeds(r,s))}),this.register(()=>i.disconnect())}processEditorXMindEmbeds(t,e){var d,m,f,h,c,p,u,b,g;console.log("Processing XMind embeds in editor");let i=t.querySelectorAll(".file-embed");console.log(`Found ${i.length} file-embed elements`);let r=new Set;for(let v of Array.from(i)){let w=this.getElementPath(v);if(r.has(w)){console.log(`Skipping already processed embed: ${w}`);continue}r.add(w);let k=v.querySelector(".file-embed-title");if(k&&(console.log(`File embed title: "${k.textContent}"`),k.textContent&&k.textContent.includes(".xmind"))){if(console.log("Found XMind embed in file-embed element"),v.querySelector(".xmind-preview-container")){console.log("XMind preview already exists, skipping");continue}let E=k.textContent.trim();console.log(`Extracted XMind path: ${E}`);let T=this.getFileFromPath(E,(d=e.file)==null?void 0:d.path);if(T){console.log(`Found XMind file: ${T.path}`),this.checkAndClearCacheIfNeeded(T);let M=v.querySelector(".file-embed-content");if(M)console.log("Found file-embed-content element, replacing with XMind preview"),M.empty(),this.createXMindPreview(M,T),console.log("Added XMind preview to file-embed-content");else{console.log("No file-embed-content element found, creating one");let O=createDiv({cls:"file-embed-content"});v.appendChild(O),this.createXMindPreview(O,T),console.log("Added XMind preview to new file-embed-content")}}else console.log(`XMind file not found: ${E}`)}}let s=t.querySelectorAll(".cm-embed-block");console.log(`Found ${s.length} embed blocks`);for(let v of Array.from(s)){let w=this.getElementPath(v);if(r.has(w))continue;r.add(w);let k=v.getAttribute("data-embed-src");if(console.log(`Processing embed block with src: ${k}`),!k){let T=v.textContent||"";console.log(`Block content: "${T}"`);let M=T.match(/!\[\[(.*?\.xmind)\]\]/);if(M){let O=M[1];if(console.log(`Found XMind wiki link in block: ${O}`),v.classList.contains("cm-embed-xmind")){console.log("Block already processed, skipping");continue}v.classList.add("cm-embed-xmind");let A=this.getFileFromPath(O,(m=e.file)==null?void 0:m.path);if(A){console.log(`Found XMind file: ${A.path}`),this.checkAndClearCacheIfNeeded(A);let R=createDiv({cls:"xmind-preview-container"});v.appendChild(R),this.processXMindEmbed(R,A)}else{console.log(`XMind file not found: ${O}`);let R=createDiv({cls:"xmind-no-preview",text:`XMind file not found: ${O}`});v.appendChild(R)}continue}}if(!k||!k.endsWith(".xmind")){console.log("Not an XMind embed, skipping");continue}if(v.classList.contains("cm-embed-xmind")){console.log("Block already processed, skipping");continue}console.log(`Found unprocessed XMind embed: ${k}`),v.classList.add("cm-embed-xmind");let E=this.getFileFromPath(k,(f=e.file)==null?void 0:f.path);if(E)console.log(`Found XMind file: ${E.path}`),this.checkAndClearCacheIfNeeded(E),this.createXMindPreview(v,E);else{console.log(`XMind file not found: ${k}`);let T=createDiv({cls:"xmind-no-preview",text:`XMind file not found: ${k}`});v.empty(),v.appendChild(T)}}if(e.editor){let w=e.editor.getValue().match(/!\[\[(.*?\.xmind)\]\]/g);if(console.log(`Found ${(w==null?void 0:w.length)||0} XMind wiki links in content`),w&&w.length>0)for(let k of w){let E=k.match(/!\[\[(.*?\.xmind)\]\]/);if(E){let T=E[1];console.log(`XMind wiki link: ${k}`);let M=this.getFileFromPath(T,(h=e.file)==null?void 0:h.path);if(!M){console.log(`XMind file not found: ${T}`);continue}console.log(`Found XMind file: ${M.path}`),this.checkAndClearCacheIfNeeded(M);let O=`![[${T}]]`,A=Array.from(t.querySelectorAll(".cm-line"));console.log(`Found ${A.length} editor lines to check`);let R=!1;for(let G of A)if((c=G.textContent)!=null&&c.includes(O)){if(console.log(`Found line with XMind link: "${G.textContent}"`),G.querySelector(".xmind-preview-container")){console.log("Line already has XMind preview, skipping"),R=!0;continue}let _=G.parentElement,P=!1;for(;_&&_!==t;){if(_.classList.contains("cm-embed-xmind")||_.querySelector(".xmind-preview-container")){P=!0;break}_=_.parentElement}if(P){console.log("Line is inside a processed block, skipping"),R=!0;continue}let o=Array.from(G.querySelectorAll("span")),N=null;for(let H of o)if(H.textContent===O){N=H;break}if(N){console.log("Found exact span with link");let H=this.getElementPath(N);if(r.has(H)){console.log("Span already processed, skipping"),R=!0;continue}r.add(H);let D=createDiv({cls:"xmind-preview-container"});N.insertAdjacentElement("afterend",D),this.processXMindEmbed(D,M),R=!0}else{console.log("Could not find exact span, adding preview after line");let H=createDiv({cls:"xmind-preview-container"});G.appendChild(H),this.processXMindEmbed(H,M),R=!0}}if(!R){console.log("Could not find line with link, looking for widget containers");let G=Array.from(t.querySelectorAll(".cm-widgetBuffer"));for(let _ of G){let P=_.nextElementSibling;if(P&&((p=P.textContent)!=null&&p.includes(O))){console.log("Found widget container with link");let o=this.getElementPath(_);if(r.has(o)){console.log("Container already processed, skipping");continue}r.add(o);let N=createDiv({cls:"xmind-preview-container"});_.insertAdjacentElement("afterend",N),this.processXMindEmbed(N,M),R=!0}}}if(!R){console.log("Could not find suitable place to insert preview, creating new embed block");let _=Array.from(t.querySelectorAll(".cm-embed-block")).filter(D=>{var Q;return((Q=D.textContent)==null?void 0:Q.includes(O))||D.classList.contains("cm-embed-xmind")});if(_.length>=2){console.log(`Already have ${_.length} XMind embed blocks, skipping to prevent infinite loop`);return}let P=createDiv({cls:"cm-embed-block cm-embed-xmind"});P.textContent=O;let o=createDiv({cls:"xmind-preview-container"});P.appendChild(o),this.processXMindEmbed(o,M);let N=Array.from(t.querySelectorAll(".cm-line")),H=!1;for(let D of N)if((u=D.textContent)!=null&&u.includes(O)){D.nextElementSibling?(b=D.parentElement)==null||b.insertBefore(P,D.nextElementSibling):(g=D.parentElement)==null||g.appendChild(P),H=!0;break}H||console.log("Could not find suitable place to insert preview, skipping to prevent infinite loop")}}}}}getElementPath(t){let e=[],i=t;for(;i&&i!==document.body;){let r=i.tagName.toLowerCase();if(i.id)r+=`#${i.id}`;else{let s=1,d=i.previousElementSibling;for(;d;)d.tagName===i.tagName&&s++,d=d.previousElementSibling;r+=`:nth-of-type(${s})`}e.unshift(r),i=i.parentElement}return e.join(" > ")}async createXMindPreview(t,e){console.log(`Creating XMind preview for ${e.path}`),t.empty();let i=createDiv({cls:"xmind-preview-container"});console.log("Getting thumbnail for file");let r=await this.getThumbnailForFile(e);if(console.log(`Thumbnail obtained: ${r?"yes":"no"}`),r){let s=createDiv({cls:"xmind-thumbnail"}),d=document.createElement("img");d.src=r,d.alt="XMind Preview",s.appendChild(d),i.appendChild(s);let m=createDiv({cls:"xmind-button-container"}),f=document.createElement("button");f.className="xmind-open-button mod-cta",f.textContent="Open in XMind",f.onclick=h=>(h.stopPropagation(),h.preventDefault(),this.openXMindFile(e),!1),m.appendChild(f),i.appendChild(m)}else{let s=createDiv({cls:"xmind-no-preview",text:"No preview available"});i.appendChild(s);let d=createDiv({cls:"xmind-button-container"}),m=document.createElement("button");m.className="xmind-open-button mod-cta",m.textContent="Open in XMind",m.onclick=f=>(f.stopPropagation(),f.preventDefault(),this.openXMindFile(e),!1),d.appendChild(m),i.appendChild(d)}t.appendChild(i),console.log("XMind preview created and added to element")}processXMindEmbeds(t,e){console.log("Processing XMind embeds in element",{elementClasses:t.className,contextPath:e.sourcePath});let i=Array.from(t.querySelectorAll('.internal-embed[src$=".xmind"]'));console.log(`Found ${i.length} XMind embeds`);for(let r of i){let s=r.getAttribute("src");if(console.log(`Processing embed with src: ${s}`),!s)continue;let d=document.createElement("div");d.className="xmind-preview-container";let m=this.getFileFromPath(s,e.sourcePath);if(m)console.log(`Found XMind file: ${m.path}`),this.checkAndClearCacheIfNeeded(m),this.processXMindEmbed(d,m),r.replaceWith(d);else{console.log(`XMind file not found: ${s}`);let f=document.createElement("div");f.className="xmind-no-preview",f.textContent="XMind file not found",d.appendChild(f),r.replaceWith(d)}}}async processXMindEmbed(t,e){let i=await this.getThumbnailForFile(e);if(i){let r=document.createElement("div");r.className="xmind-thumbnail";let s=document.createElement("img");s.src=i,s.alt="XMind Preview",r.appendChild(s),t.appendChild(r);let d=document.createElement("div");d.className="xmind-button-container";let m=document.createElement("button");m.className="xmind-open-button mod-cta",m.textContent="Open in XMind",m.onclick=f=>(f.stopPropagation(),f.preventDefault(),this.openXMindFile(e),!1),d.appendChild(m),t.appendChild(d)}else{let r=document.createElement("div");r.className="xmind-no-preview",r.textContent="No preview available",t.appendChild(r);let s=document.createElement("div");s.className="xmind-button-container";let d=document.createElement("button");d.className="xmind-open-button mod-cta",d.textContent="Open in XMind",d.onclick=m=>(m.stopPropagation(),m.preventDefault(),this.openXMindFile(e),!1),s.appendChild(d),t.appendChild(s)}}registerFileHandler(){this.registerMarkdownPostProcessor(async(t,e)=>{let i=Array.from(t.querySelectorAll('.internal-embed[src$=".xmind"]'));for(let r of i){let s=r.getAttribute("src");if(!s)continue;let d=document.createElement("div");d.className="xmind-preview-container";let m=this.getFileFromPath(s,e.sourcePath);if(m){this.checkAndClearCacheIfNeeded(m);let f=await this.getThumbnailForFile(m);if(f){let h=document.createElement("div");h.className="xmind-thumbnail";let c=document.createElement("img");c.src=f,c.alt="XMind Preview",h.appendChild(c),d.appendChild(h);let p=document.createElement("div");p.className="xmind-button-container";let u=document.createElement("button");u.className="xmind-open-button mod-cta",u.textContent="Open in XMind",u.onclick=b=>(b.stopPropagation(),b.preventDefault(),this.openXMindFile(m),!1),p.appendChild(u),d.appendChild(p)}else{let h=document.createElement("div");h.className="xmind-no-preview",h.textContent="No preview available",d.appendChild(h);let c=document.createElement("div");c.className="xmind-button-container";let p=document.createElement("button");p.className="xmind-open-button mod-cta",p.textContent="Open in XMind",p.onclick=u=>(u.stopPropagation(),u.preventDefault(),this.openXMindFile(m),!1),c.appendChild(p),d.appendChild(c)}}else{let f=document.createElement("div");f.className="xmind-no-preview",f.textContent="XMind file not found",d.appendChild(f)}r.replaceWith(d)}})}getFileFromPath(t,e){console.log(`Getting file from path: ${t}, source: ${e||"none"}`);let i=this.app.vault.getAbstractFileByPath(t);if(i instanceof K.TFile)return console.log(`Found file directly: ${i.path}`),i;if(e){let m=e.substring(0,e.lastIndexOf("/")+1)+t;if(console.log(`Trying resolved path: ${m}`),i=this.app.vault.getAbstractFileByPath(m),i instanceof K.TFile)return console.log(`Found file with resolved path: ${i.path}`),i}let r=t.substring(t.lastIndexOf("/")+1);console.log(`Searching by basename: ${r}`);let s=this.app.vault.getAllLoadedFiles();for(let d of s)if(d instanceof K.TFile&&d.basename+"."+d.extension===r)return console.log(`Found file by basename: ${d.path}`),d;return console.log("File not found"),null}async getThumbnailForFile(t){if(console.log(`Getting thumbnail for ${t.path}`),this.thumbnailCache.has(t.path))return console.log("Thumbnail found in cache"),this.thumbnailCache.get(t.path)||null;console.log("Thumbnail not in cache, extracting from file");try{let e=await this.extractThumbnailToBase64(t.path);return e?(console.log("Thumbnail extracted successfully"),this.thumbnailCache.set(t.path,e),e):(console.log("Failed to extract thumbnail"),null)}catch(e){return console.error("Error getting thumbnail:",e),null}}async extractThumbnailToBase64(t){console.log(`Extracting thumbnail from ${t} to base64`);try{let e=this.app.vault.getAbstractFileByPath(t);if(!(e instanceof K.TFile))return console.log("File not found"),null;let i=await this.app.vault.readBinary(e),r=await this.extractThumbnail(i);if(r){let s=`data:image/png;base64,${r.toString("base64")}`;return console.log("Thumbnail extracted and converted to base64"),s}else return console.log("No thumbnail found in XMind file"),null}catch(e){return console.error("Error extracting thumbnail:",e),null}}initializeDirectory(t){try{re.existsSync(t)||(re.mkdirSync(t,{recursive:!0}),console.log("Created directory:",t))}catch(e){console.error("Failed to create directory:",t,e),new K.Notice(`Failed to create directory: ${t}`)}}async openXMindFile(t){try{let i=this.app.vault.adapter.getFullPath(t.path);console.log("Opening file:",i),console.log("Platform:",K.Platform.isMacOS?"macOS":K.Platform.isWin?"Windows":"Linux");let r=d=>{d.stopPropagation(),d.preventDefault()};document.addEventListener("click",r,!0),setTimeout(()=>{document.removeEventListener("click",r,!0)},100);let s=(d,m,f)=>{d?(console.error("Error opening file:",d),console.error("stderr:",f),new K.Notice("Error opening file")):(console.log("File opened successfully"),console.log("stdout:",m))};if(K.Platform.isMacOS)console.log("Using open command"),(0,Ge.exec)(`open "${i}"`,s);else if(K.Platform.isWin){console.log("Using cmd /c start command");let d=`cmd /c start "" "${i}"`;console.log("Command:",d),(0,Ge.exec)(d,s)}else console.log("Using xdg-open command"),(0,Ge.exec)(`xdg-open "${i}"`,s)}catch(e){console.error("Error in openXMindFile:",e),new K.Notice("Error opening file")}}async extractThumbnail(t){try{console.log("Extracting thumbnail from buffer");let e=we.join(this.tempDirPath,`temp_${Date.now()}.xmind`);return re.writeFileSync(e,Buffer.from(t)),new Promise((i,r)=>{try{ct.open(e,{lazyEntries:!0},(s,d)=>{if(s){console.error("Error opening xmind file:",s),re.unlinkSync(e),i(null);return}console.log("Successfully opened xmind file");let m=null;d.readEntry(),d.on("entry",f=>{console.log("Reading entry:",f.fileName),f.fileName==="Thumbnails/thumbnail.png"?(console.log("Found thumbnail!"),d.openReadStream(f,(h,c)=>{if(h){console.error("Error opening read stream:",h),d.readEntry();return}console.log("Successfully opened read stream");let p=[];c.on("data",u=>{p.push(u)}),c.on("end",()=>{console.log("Successfully read thumbnail data"),m=Buffer.concat(p),d.readEntry()}),c.on("error",u=>{console.error("Error reading thumbnail:",u),d.readEntry()})})):d.readEntry()}),d.on("end",()=>{console.log("Finished reading zip file, found thumbnail:",!!m),re.unlinkSync(e),i(m)}),d.on("error",f=>{console.error("Error reading zip file:",f),re.unlinkSync(e),i(null)})})}catch(s){console.error("Error in extractThumbnail:",s),re.unlinkSync(e),i(null)}})}catch(e){return console.error("Error extracting thumbnail:",e),null}}async onunload(){console.log("Unloading XMind plugin");try{if(re.existsSync(this.tempDirPath)){let t=re.readdirSync(this.tempDirPath);for(let e of t)re.unlinkSync(we.join(this.tempDirPath,e))}}catch(t){console.error("Failed to clean up temp directory:",t)}}async loadSettings(){this.settings=Object.assign({},nn,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}checkAndClearCacheIfNeeded(t){let e=this.lastCheckedTimes.get(t.path)||0;t.stat.mtime>e?(console.log(`File ${t.path} has been modified since last check, clearing cache`),this.clearCache(t.path),this.lastCheckedTimes.set(t.path,Date.now())):console.log(`File ${t.path} has not been modified since last check, keeping cache`)}clearCache(t){this.thumbnailCache.has(t)&&(console.log(`Clearing cache for ${t}`),this.thumbnailCache.delete(t))}clearXMindCacheForFile(t){if(!t.endsWith(".md"))return;let e=this.app.vault.getAbstractFileByPath(t);e instanceof K.TFile&&this.app.vault.read(e).then(i=>{let r=i.match(/!\[\[(.*?\.xmind)\]\]/g);if(r){console.log(`Found ${r.length} XMind links in ${t}`);for(let s of r){let d=s.match(/!\[\[(.*?\.xmind)\]\]/);if(d){let m=d[1];console.log(`Found XMind link: ${m}`);let f=this.getFileFromPath(m,t);f&&(console.log(`Checking cache for XMind file: ${f.path}`),this.checkAndClearCacheIfNeeded(f))}}}})}registerDailyNotesIntegration(){if(console.log("[XMind] Initializing Daily Notes integration"),!this.settings.dailyNotesIntegration){console.log("[XMind] Daily Notes integration is disabled in settings");return}this.registerEvent(this.app.vault.on("create",t=>{if(console.log(`[XMind] File created event: ${t.path}`),!(t instanceof K.TFile)){console.log("[XMind] Not a TFile, ignoring");return}if(t.extension!=="md"){console.log("[XMind] Not a markdown file, ignoring");return}console.log("[XMind] Checking if this is a daily note"),this.checkAndCreateXMindForDailyNote(t)})),this.registerEvent(this.app.workspace.on("file-menu",(t,e)=>{e instanceof K.TFile&&e.extension==="md"&&t.addItem(i=>{i.setTitle("\u4E3A\u6B64\u6587\u4EF6\u521B\u5EFAXMind\u601D\u7EF4\u5BFC\u56FE").setIcon("document").onClick(()=>{this.createXMindForFile(e)})})})),console.log("[XMind] Daily Notes integration setup complete")}async checkAndCreateXMindForDailyNote(t){var e,i,r,s,d,m;try{console.log(`[XMind] Checking if ${t.path} is a daily note`);let f=Date.now(),h=t.stat.ctime,c=f-h;if(c>3e4){console.log(`[XMind] File was created ${c}ms ago, skipping (only process files created within 30s)`);return}console.log(`[XMind] File was created ${c}ms ago, within threshold`);let p=!1,u="",b="";try{let w=this.app.internalPlugins;if(w){let k=w.plugins["daily-notes"];if(k&&k.enabled){console.log("[XMind] Core Daily Notes plugin is enabled");let E=k.instance.options;if(console.log("[XMind] Core Daily Notes settings:",E),E&&(E.folder&&(u=E.folder,console.log(`[XMind] Core Daily Notes folder: ${u}`)),E.format&&(b=E.format,console.log(`[XMind] Core Daily Notes format: ${b}`)),u&&t.path.startsWith(u)&&(p=!0,console.log("[XMind] File is in Core Daily Notes folder")),b&&!p)){let T=b.replace(/YYYY/g,"\\d{4}").replace(/MM/g,"\\d{2}").replace(/DD/g,"\\d{2}").replace(/ddd/g,"[A-Za-z]+").replace(/dddd/g,"[A-Za-z]+").replace(/\./g,"\\.").replace(/\-/g,"\\-").replace(/\//g,"\\/");T=T.replace(/周[一二三四五六日]/g,"\u5468[\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u65E5]").replace(/星期[一二三四五六日]/g,"\u661F\u671F[\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u65E5]"),console.log(`[XMind] Format regex: ${T}`),new RegExp(`^${T}$`).test(t.basename)&&(p=!0,console.log(`[XMind] File name matches core daily note format: ${t.basename}`))}}}}catch(w){console.log("[XMind] Error checking core daily notes plugin:",w)}let g=(i=(e=this.app.plugins)==null?void 0:e.plugins)==null?void 0:i["daily-notes"];if(g&&!p){console.log("[XMind] Checking against Daily Notes plugin");let w=g.options;if(w&&(w.folder&&(u=w.folder,console.log(`[XMind] Daily Notes folder: ${u}`)),w.format&&(b=w.format,console.log(`[XMind] Daily Notes format: ${b}`)),u&&t.path.startsWith(u)&&(p=!0,console.log("[XMind] File is in Daily Notes folder")),b&&!p)){let k=b.replace(/YYYY/g,"\\d{4}").replace(/MM/g,"\\d{2}").replace(/DD/g,"\\d{2}").replace(/ddd/g,"[A-Za-z]+").replace(/dddd/g,"[A-Za-z]+").replace(/\./g,"\\.").replace(/\-/g,"\\-").replace(/\//g,"\\/");console.log(`[XMind] Format regex: ${k}`),new RegExp(`^${k}$`).test(t.basename)&&(p=!0,console.log(`[XMind] File name matches daily note format: ${t.basename}`))}}let v=(s=(r=this.app.plugins)==null?void 0:r.plugins)==null?void 0:s["periodic-notes"];if(v&&!p){console.log("[XMind] Checking against Periodic Notes plugin");let w=(d=v.settings)==null?void 0:d.daily;w&&(u=w.folder,console.log(`[XMind] Periodic Notes daily folder: ${u}`),t.path.startsWith(u)&&(p=!0,console.log("[XMind] File is in Periodic Notes daily folder")))}if(!p&&(console.log("[XMind] Checking against common daily note patterns"),t.path.includes("journal/")||t.path.includes("journals/")||t.path.includes("diary/")||t.path.includes("diaries/")||t.path.includes("daily/"))){console.log("[XMind] File is in a journal-like folder");let w=[/\d{4}-\d{2}-\d{2}/,/\d{2}-\d{2}-\d{4}/,/\d{4}\.\d{2}\.\d{2}/,/\d{2}\.\d{2}\.\d{4}/,/\d{4}_\d{2}_\d{2}/,/\d{2}_\d{2}_\d{4}/];for(let k of w)if(k.test(t.basename)){p=!0,console.log(`[XMind] File name matches date pattern: ${k}`);break}!p&&(t.basename.includes("\u5468")||t.basename.includes("\u661F\u671F"))&&(p=!0,console.log("[XMind] File name contains week indicator"))}if(p){console.log(`[XMind] Confirmed ${t.path} is a daily note`);let w=`${t.basename}.xmind`,k=we.join(((m=t.parent)==null?void 0:m.path)||"",w);if(console.log(`[XMind] Will create XMind file at: ${k}`),this.app.vault.getAbstractFileByPath(k)){console.log(`[XMind] XMind file already exists: ${k}`);return}let T=this.app.vault.adapter,M=T.getFullPath(k);if(console.log(`[XMind] Absolute path for new file: ${M}`),this.settings.templatePath){console.log(`[XMind] Using template: ${this.settings.templatePath}`);let O=T.getFullPath(this.settings.templatePath);console.log(`[XMind] Template absolute path: ${O}`),re.existsSync(O)?(console.log("[XMind] Template file exists, copying..."),re.copyFileSync(O,M),console.log("[XMind] Template file copied successfully"),console.log("[XMind] Refreshing Obsidian view"),this.app.vault.adapter.exists(k,!1).then(A=>{if(console.log(`[XMind] File exists check: ${A}`),A){let R=this.app.vault.getAbstractFileByPath(k);console.log(`[XMind] Got new file reference: ${!!R}`),R&&(this.app.vault.trigger("create",R),console.log("[XMind] Triggered create event"))}}),new K.Notice(`Created XMind file for daily note: ${w}`)):(console.log("[XMind] Template file not found"),new K.Notice("Template file not found"))}else console.log("[XMind] Template path not set"),new K.Notice("XMind template path not set. Please set it in settings.")}else console.log(`[XMind] ${t.path} is not a daily note`)}catch(f){console.error("[XMind] Error creating XMind for daily note:",f),new K.Notice("Error creating XMind file for daily note")}}async createXMindForFile(t){var e;try{console.log(`[XMind] Creating XMind file for: ${t.path}`);let i=`${t.basename}.xmind`,r=we.join(((e=t.parent)==null?void 0:e.path)||"",i);if(console.log(`[XMind] Will create XMind file at: ${r}`),this.app.vault.getAbstractFileByPath(r)){console.log(`[XMind] XMind file already exists: ${r}`),new K.Notice(`XMind file already exists: ${i}`);return}let d=this.app.vault.adapter,m=d.getFullPath(r);if(console.log(`[XMind] Absolute path for new file: ${m}`),this.settings.templatePath){console.log(`[XMind] Using template: ${this.settings.templatePath}`);let f=d.getFullPath(this.settings.templatePath);console.log(`[XMind] Template absolute path: ${f}`),re.existsSync(f)?(console.log("[XMind] Template file exists, copying..."),re.copyFileSync(f,m),console.log("[XMind] Template file copied successfully"),console.log("[XMind] Refreshing Obsidian view"),this.app.vault.adapter.exists(r,!1).then(h=>{if(console.log(`[XMind] File exists check: ${h}`),h){let c=this.app.vault.getAbstractFileByPath(r);console.log(`[XMind] Got new file reference: ${!!c}`),c&&(this.app.vault.trigger("create",c),console.log("[XMind] Triggered create event"))}}),new K.Notice(`Created XMind file: ${i}`)):(console.log("[XMind] Template file not found"),new K.Notice("Template file not found"))}else console.log("[XMind] Template path not set"),new K.Notice("XMind template path not set. Please set it in settings.")}catch(i){console.error("[XMind] Error creating XMind file:",i),new K.Notice("Error creating XMind file")}}createEmptyXMindFile(t){try{console.log(`[XMind] Creating empty XMind file at: ${t}`);let e=Nt(),i=new e,r=`<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xmap-content xmlns="urn:xmind:xmap:xmlns:content:2.0" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" modified-by="XMind" timestamp="1584912227692" version="2.0">
<sheet id="sheet-1" modified-by="XMind" theme="theme-1" timestamp="1584912227692">
<topic id="topic-1" modified-by="XMind" structure-class="org.xmind.ui.map.clockwise" timestamp="1584912227692">
<title>Central Topic</title>
<children>
<topics type="attached">
<topic id="topic-2" modified-by="XMind" timestamp="1584912227692">
<title>Main Topic 1</title>
</topic>
<topic id="topic-3" modified-by="XMind" timestamp="1584912227692">
<title>Main Topic 2</title>
</topic>
<topic id="topic-4" modified-by="XMind" timestamp="1584912227692">
<title>Main Topic 3</title>
</topic>
</topics>
</children>
</topic>
<title>Sheet 1</title>
</sheet>
</xmap-content>`,s=`<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<meta xmlns="urn:xmind:xmap:xmlns:meta:2.0" version="2.0">
<Creator>
<Name>XMind</Name>
<Version>3.7.0</Version>
</Creator>
<Thumbnail>
<Origin>
<X>124</X>
<Y>81</Y>
</Origin>
<BackgroundColor>#FFFFFF</BackgroundColor>
</Thumbnail>
</meta>`,d=`<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<manifest xmlns="urn:xmind:xmap:xmlns:manifest:1.0">
<file-entry full-path="content.xml" media-type="text/xml"/>
<file-entry full-path="meta.xml" media-type="text/xml"/>
<file-entry full-path="META-INF/" media-type=""/>
<file-entry full-path="META-INF/manifest.xml" media-type="text/xml"/>
<file-entry full-path="styles.xml" media-type="text/xml"/>
</manifest>`,m=`<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xmap-styles xmlns="urn:xmind:xmap:xmlns:style:2.0" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg" version="2.0">
<styles>
<style id="theme-1" name="Default" type="theme">
<map-properties>
<property key="line-tapered" value="none"/>
</map-properties>
</style>
</styles>
<automatic-styles/>
<master-styles>
<master-style name="Default" style-id="theme-1"/>
</master-styles>
</xmap-styles>`;return i.file("content.xml",r),i.file("meta.xml",s),i.file("styles.xml",m),i.folder("META-INF").file("manifest.xml",d),i.generateNodeStream({type:"nodebuffer",streamFiles:!0}).pipe(re.createWriteStream(t)).on("finish",function(){console.log("[XMind] Empty XMind file created successfully")}),!0}catch(e){return console.error("[XMind] Error creating empty XMind file:",e),!1}}},Ve=class extends K.PluginSettingTab{constructor(t,e){super(t,e);this.plugin=e}display(){let{containerEl:t}=this;t.empty(),t.createEl("h2",{text:"XMind Settings"}),new K.Setting(t).setName("Template Path").setDesc("Path to your custom XMind template file (relative to vault root)").addText(e=>e.setPlaceholder("templates/custom.xmind").setValue(this.plugin.settings.templatePath).onChange(async i=>{this.plugin.settings.templatePath=i,await this.plugin.saveSettings()})),new K.Setting(t).setName("Daily Notes Integration").setDesc("Enable or disable automatic XMind file creation for daily notes").addToggle(e=>e.setValue(this.plugin.settings.dailyNotesIntegration).onChange(async i=>{this.plugin.settings.dailyNotesIntegration=i,await this.plugin.saveSettings()}))}};
/*! Bundled license information:
jszip/dist/jszip.min.js:
(*!
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
<http://stuartk.com/jszip>
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
JSZip uses the library pako released under the MIT license :
https://github.com/nodeca/pako/blob/main/LICENSE
*)
*/