diff --git a/main.js b/main.js index 98e1b4d..ab3e355 100644 --- a/main.js +++ b/main.js @@ -3,8 +3,8 @@ THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ -var Dt=Object.create;var vt=Object.defineProperty;var Pt=Object.getOwnPropertyDescriptor;var Ut=Object.getOwnPropertyNames;var Nt=Object.getPrototypeOf,Lt=Object.prototype.hasOwnProperty;var jt=(_,T)=>()=>(T||_((T={exports:{}}).exports,T),T.exports),Wt=(_,T)=>{for(var p in T)vt(_,p,{get:T[p],enumerable:!0})},At=(_,T,p,a)=>{if(T&&typeof T=="object"||typeof T=="function")for(let s of Ut(T))!Lt.call(_,s)&&s!==p&&vt(_,s,{get:()=>T[s],enumerable:!(a=Pt(T,s))||a.enumerable});return _};var Zt=(_,T,p)=>(p=_!=null?Dt(Nt(_)):{},At(T||!_||!_.__esModule?vt(p,"default",{value:_,enumerable:!0}):p,_)),Mt=_=>At(vt({},"__esModule",{value:!0}),_);var Ot=jt((It,kt)=>{(function(_){typeof It=="object"&&typeof kt!="undefined"?kt.exports=_():typeof define=="function"&&define.amd?define([],_):(typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:this).JSZip=_()})(function(){return function _(T,p,a){function s(b,y){if(!p[b]){if(!T[b]){var m=typeof require=="function"&&require;if(!y&&m)return m(b,!0);if(r)return r(b,!0);var v=new Error("Cannot find module '"+b+"'");throw v.code="MODULE_NOT_FOUND",v}var i=p[b]={exports:{}};T[b][0].call(i.exports,function(f){var n=T[b][1][f];return s(n||f)},i,i.exports,_,T,p,a)}return p[b].exports}for(var r=typeof require=="function"&&require,h=0;h>2,i=(3&b)<<4|y>>4,f=1>6:64,n=2>4,y=(15&v)<<4|(i=r.indexOf(h.charAt(n++)))>>2,m=(3&i)<<6|(f=r.indexOf(h.charAt(n++))),d[u++]=b,i!==64&&(d[u++]=y),f!==64&&(d[u++]=m);return d}},{"./support":30,"./utils":32}],2:[function(_,T,p){"use strict";var a=_("./external"),s=_("./stream/DataWorker"),r=_("./stream/Crc32Probe"),h=_("./stream/DataLengthProbe");function b(y,m,v,i,f){this.compressedSize=y,this.uncompressedSize=m,this.crc32=v,this.compression=i,this.compressedContent=f}b.prototype={getContentWorker:function(){var y=new s(a.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new h("data_length")),m=this;return y.on("end",function(){if(this.streamInfo.data_length!==m.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),y},getCompressedWorker:function(){return new s(a.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},b.createWorkerFrom=function(y,m,v){return y.pipe(new r).pipe(new h("uncompressedSize")).pipe(m.compressWorker(v)).pipe(new h("compressedSize")).withStreamInfo("compression",m)},T.exports=b},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(_,T,p){"use strict";var a=_("./stream/GenericWorker");p.STORE={magic:"\0\0",compressWorker:function(){return new a("STORE compression")},uncompressWorker:function(){return new a("STORE decompression")}},p.DEFLATE=_("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(_,T,p){"use strict";var a=_("./utils"),s=function(){for(var r,h=[],b=0;b<256;b++){r=b;for(var y=0;y<8;y++)r=1&r?3988292384^r>>>1:r>>>1;h[b]=r}return h}();T.exports=function(r,h){return r!==void 0&&r.length?a.getTypeOf(r)!=="string"?function(b,y,m,v){var i=s,f=v+m;b^=-1;for(var n=v;n>>8^i[255&(b^y[n])];return-1^b}(0|h,r,r.length,0):function(b,y,m,v){var i=s,f=v+m;b^=-1;for(var n=v;n>>8^i[255&(b^y.charCodeAt(n))];return-1^b}(0|h,r,r.length,0):0}},{"./utils":32}],5:[function(_,T,p){"use strict";p.base64=!1,p.binary=!1,p.dir=!1,p.createFolders=!0,p.date=null,p.compression=null,p.compressionOptions=null,p.comment=null,p.unixPermissions=null,p.dosPermissions=null},{}],6:[function(_,T,p){"use strict";var a=null;a=typeof Promise!="undefined"?Promise:_("lie"),T.exports={Promise:a}},{lie:37}],7:[function(_,T,p){"use strict";var a=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",s=_("pako"),r=_("./utils"),h=_("./stream/GenericWorker"),b=a?"uint8array":"array";function y(m,v){h.call(this,"FlateWorker/"+m),this._pako=null,this._pakoAction=m,this._pakoOptions=v,this.meta={}}p.magic="\b\0",r.inherits(y,h),y.prototype.processChunk=function(m){this.meta=m.meta,this._pako===null&&this._createPako(),this._pako.push(r.transformTo(b,m.data),!1)},y.prototype.flush=function(){h.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},y.prototype.cleanUp=function(){h.prototype.cleanUp.call(this),this._pako=null},y.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var m=this;this._pako.onData=function(v){m.push({data:v,meta:m.meta})}},p.compressWorker=function(m){return new y("Deflate",m)},p.uncompressWorker=function(){return new y("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(_,T,p){"use strict";function a(i,f){var n,u="";for(n=0;n>>=8;return u}function s(i,f,n,u,o,d){var w,S,x=i.file,R=i.compression,O=d!==b.utf8encode,N=r.transformTo("string",d(x.name)),I=r.transformTo("string",b.utf8encode(x.name)),M=x.comment,X=r.transformTo("string",d(M)),g=r.transformTo("string",b.utf8encode(M)),F=I.length!==x.name.length,e=g.length!==M.length,D="",q="",L="",Q=x.dir,j=x.date,V={crc32:0,compressedSize:0,uncompressedSize:0};f&&!n||(V.crc32=i.crc32,V.compressedSize=i.compressedSize,V.uncompressedSize=i.uncompressedSize);var E=0;f&&(E|=8),O||!F&&!e||(E|=2048);var z=0,Y=0;Q&&(z|=16),o==="UNIX"?(Y=798,z|=function(H,it){var lt=H;return H||(lt=it?16893:33204),(65535<)<<16}(x.unixPermissions,Q)):(Y=20,z|=function(H){return 63&(H||0)}(x.dosPermissions)),w=j.getUTCHours(),w<<=6,w|=j.getUTCMinutes(),w<<=5,w|=j.getUTCSeconds()/2,S=j.getUTCFullYear()-1980,S<<=4,S|=j.getUTCMonth()+1,S<<=5,S|=j.getUTCDate(),F&&(q=a(1,1)+a(y(N),4)+I,D+="up"+a(q.length,2)+q),e&&(L=a(1,1)+a(y(X),4)+g,D+="uc"+a(L.length,2)+L);var G="";return G+=` -\0`,G+=a(E,2),G+=R.magic,G+=a(w,2),G+=a(S,2),G+=a(V.crc32,4),G+=a(V.compressedSize,4),G+=a(V.uncompressedSize,4),G+=a(N.length,2),G+=a(D.length,2),{fileRecord:m.LOCAL_FILE_HEADER+G+N+D,dirRecord:m.CENTRAL_FILE_HEADER+a(Y,2)+G+a(X.length,2)+"\0\0\0\0"+a(z,4)+a(u,4)+N+D+X}}var r=_("../utils"),h=_("../stream/GenericWorker"),b=_("../utf8"),y=_("../crc32"),m=_("../signature");function v(i,f,n,u){h.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=f,this.zipPlatform=n,this.encodeFileName=u,this.streamFiles=i,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}r.inherits(v,h),v.prototype.push=function(i){var f=i.meta.percent||0,n=this.entriesCount,u=this._sources.length;this.accumulate?this.contentBuffer.push(i):(this.bytesWritten+=i.data.length,h.prototype.push.call(this,{data:i.data,meta:{currentFile:this.currentFile,percent:n?(f+100*(n-u-1))/n:100}}))},v.prototype.openedSource=function(i){this.currentSourceOffset=this.bytesWritten,this.currentFile=i.file.name;var f=this.streamFiles&&!i.file.dir;if(f){var n=s(i,f,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},v.prototype.closedSource=function(i){this.accumulate=!1;var f=this.streamFiles&&!i.file.dir,n=s(i,f,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),f)this.push({data:function(u){return m.DATA_DESCRIPTOR+a(u.crc32,4)+a(u.compressedSize,4)+a(u.uncompressedSize,4)}(i),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},v.prototype.flush=function(){for(var i=this.bytesWritten,f=0;f=this.index;h--)b=(b<<8)+this.byteAt(h);return this.index+=r,b},readString:function(r){return a.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))}},T.exports=s},{"../utils":32}],19:[function(_,T,p){"use strict";var a=_("./Uint8ArrayReader");function s(r){a.call(this,r)}_("../utils").inherits(s,a),s.prototype.readData=function(r){this.checkOffset(r);var h=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,h},T.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(_,T,p){"use strict";var a=_("./DataReader");function s(r){a.call(this,r)}_("../utils").inherits(s,a),s.prototype.byteAt=function(r){return this.data.charCodeAt(this.zero+r)},s.prototype.lastIndexOfSignature=function(r){return this.data.lastIndexOf(r)-this.zero},s.prototype.readAndCheckSignature=function(r){return r===this.readData(4)},s.prototype.readData=function(r){this.checkOffset(r);var h=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,h},T.exports=s},{"../utils":32,"./DataReader":18}],21:[function(_,T,p){"use strict";var a=_("./ArrayReader");function s(r){a.call(this,r)}_("../utils").inherits(s,a),s.prototype.readData=function(r){if(this.checkOffset(r),r===0)return new Uint8Array(0);var h=this.data.subarray(this.zero+this.index,this.zero+this.index+r);return this.index+=r,h},T.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(_,T,p){"use strict";var a=_("../utils"),s=_("../support"),r=_("./ArrayReader"),h=_("./StringReader"),b=_("./NodeBufferReader"),y=_("./Uint8ArrayReader");T.exports=function(m){var v=a.getTypeOf(m);return a.checkSupport(v),v!=="string"||s.uint8array?v==="nodebuffer"?new b(m):s.uint8array?new y(a.transformTo("uint8array",m)):new r(a.transformTo("array",m)):new h(m)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(_,T,p){"use strict";p.LOCAL_FILE_HEADER="PK",p.CENTRAL_FILE_HEADER="PK",p.CENTRAL_DIRECTORY_END="PK",p.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",p.ZIP64_CENTRAL_DIRECTORY_END="PK",p.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(_,T,p){"use strict";var a=_("./GenericWorker"),s=_("../utils");function r(h){a.call(this,"ConvertWorker to "+h),this.destType=h}s.inherits(r,a),r.prototype.processChunk=function(h){this.push({data:s.transformTo(this.destType,h.data),meta:h.meta})},T.exports=r},{"../utils":32,"./GenericWorker":28}],25:[function(_,T,p){"use strict";var a=_("./GenericWorker"),s=_("../crc32");function r(){a.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}_("../utils").inherits(r,a),r.prototype.processChunk=function(h){this.streamInfo.crc32=s(h.data,this.streamInfo.crc32||0),this.push(h)},T.exports=r},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(_,T,p){"use strict";var a=_("../utils"),s=_("./GenericWorker");function r(h){s.call(this,"DataLengthProbe for "+h),this.propName=h,this.withStreamInfo(h,0)}a.inherits(r,s),r.prototype.processChunk=function(h){if(h){var b=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=b+h.data.length}s.prototype.processChunk.call(this,h)},T.exports=r},{"../utils":32,"./GenericWorker":28}],27:[function(_,T,p){"use strict";var a=_("../utils"),s=_("./GenericWorker");function r(h){s.call(this,"DataWorker");var b=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,h.then(function(y){b.dataIsReady=!0,b.data=y,b.max=y&&y.length||0,b.type=a.getTypeOf(y),b.isPaused||b._tickAndRepeat()},function(y){b.error(y)})}a.inherits(r,s),r.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},r.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,a.delay(this._tickAndRepeat,[],this)),!0)},r.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(a.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},r.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var h=null,b=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":h=this.data.substring(this.index,b);break;case"uint8array":h=this.data.subarray(this.index,b);break;case"array":case"nodebuffer":h=this.data.slice(this.index,b)}return this.index=b,this.push({data:h,meta:{percent:this.max?this.index/this.max*100:0}})},T.exports=r},{"../utils":32,"./GenericWorker":28}],28:[function(_,T,p){"use strict";function a(s){this.name=s||"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}a.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,r){return this._listeners[s].push(r),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,r){if(this._listeners[s])for(var h=0;h "+s:s}},T.exports=a},{}],29:[function(_,T,p){"use strict";var a=_("../utils"),s=_("./ConvertWorker"),r=_("./GenericWorker"),h=_("../base64"),b=_("../support"),y=_("../external"),m=null;if(b.nodestream)try{m=_("../nodejs/NodejsStreamOutputAdapter")}catch(f){}function v(f,n){return new y.Promise(function(u,o){var d=[],w=f._internalType,S=f._outputType,x=f._mimeType;f.on("data",function(R,O){d.push(R),n&&n(O)}).on("error",function(R){d=[],o(R)}).on("end",function(){try{var R=function(O,N,I){switch(O){case"blob":return a.newBlob(a.transformTo("arraybuffer",N),I);case"base64":return h.encode(N);default:return a.transformTo(O,N)}}(S,function(O,N){var I,M=0,X=null,g=0;for(I=0;I>>6:(u<65536?n[w++]=224|u>>>12:(n[w++]=240|u>>>18,n[w++]=128|u>>>12&63),n[w++]=128|u>>>6&63),n[w++]=128|63&u);return n}(i)},p.utf8decode=function(i){return s.nodebuffer?a.transformTo("nodebuffer",i).toString("utf-8"):function(f){var n,u,o,d,w=f.length,S=new Array(2*w);for(n=u=0;n>10&1023,S[u++]=56320|1023&o)}return S.length!==u&&(S.subarray?S=S.subarray(0,u):S.length=u),a.applyFromCharCode(S)}(i=a.transformTo(s.uint8array?"uint8array":"array",i))},a.inherits(m,h),m.prototype.processChunk=function(i){var f=a.transformTo(s.uint8array?"uint8array":"array",i.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var n=f;(f=new Uint8Array(n.length+this.leftOver.length)).set(this.leftOver,0),f.set(n,this.leftOver.length)}else f=this.leftOver.concat(f);this.leftOver=null}var u=function(d,w){var S;for((w=w||d.length)>d.length&&(w=d.length),S=w-1;0<=S&&(192&d[S])==128;)S--;return S<0||S===0?w:S+b[d[S]]>w?S:w}(f),o=f;u!==f.length&&(s.uint8array?(o=f.subarray(0,u),this.leftOver=f.subarray(u,f.length)):(o=f.slice(0,u),this.leftOver=f.slice(u,f.length))),this.push({data:p.utf8decode(o),meta:i.meta})},m.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:p.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},p.Utf8DecodeWorker=m,a.inherits(v,h),v.prototype.processChunk=function(i){this.push({data:p.utf8encode(i.data),meta:i.meta})},p.Utf8EncodeWorker=v},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(_,T,p){"use strict";var a=_("./support"),s=_("./base64"),r=_("./nodejsUtils"),h=_("./external");function b(n){return n}function y(n,u){for(var o=0;o>8;this.dir=!!(16&this.externalFileAttributes),i==0&&(this.dosPermissions=63&this.externalFileAttributes),i==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var i=a(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=i.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=i.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=i.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=i.readInt(4))}},readExtraFields:function(i){var f,n,u,o=i.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});i.index+4>>6:(i<65536?v[u++]=224|i>>>12:(v[u++]=240|i>>>18,v[u++]=128|i>>>12&63),v[u++]=128|i>>>6&63),v[u++]=128|63&i);return v},p.buf2binstring=function(m){return y(m,m.length)},p.binstring2buf=function(m){for(var v=new a.Buf8(m.length),i=0,f=v.length;i>10&1023,d[f++]=56320|1023&n)}return y(d,f)},p.utf8border=function(m,v){var i;for((v=v||m.length)>m.length&&(v=m.length),i=v-1;0<=i&&(192&m[i])==128;)i--;return i<0||i===0?v:i+h[m[i]]>v?i:v}},{"./common":41}],43:[function(_,T,p){"use strict";T.exports=function(a,s,r,h){for(var b=65535&a|0,y=a>>>16&65535|0,m=0;r!==0;){for(r-=m=2e3>>1:s>>>1;r[h]=s}return r}();T.exports=function(s,r,h,b){var y=a,m=b+h;s^=-1;for(var v=b;v>>8^y[255&(s^r[v])];return-1^s}},{}],46:[function(_,T,p){"use strict";var a,s=_("../utils/common"),r=_("./trees"),h=_("./adler32"),b=_("./crc32"),y=_("./messages"),m=0,v=4,i=0,f=-2,n=-1,u=4,o=2,d=8,w=9,S=286,x=30,R=19,O=2*S+1,N=15,I=3,M=258,X=M+I+1,g=42,F=113,e=1,D=2,q=3,L=4;function Q(t,B){return t.msg=y[B],B}function j(t){return(t<<1)-(4t.avail_out&&(A=t.avail_out),A!==0&&(s.arraySet(t.output,B.pending_buf,B.pending_out,A,t.next_out),t.next_out+=A,B.pending_out+=A,t.total_out+=A,t.avail_out-=A,B.pending-=A,B.pending===0&&(B.pending_out=0))}function z(t,B){r._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,B),t.block_start=t.strstart,E(t.strm)}function Y(t,B){t.pending_buf[t.pending++]=B}function G(t,B){t.pending_buf[t.pending++]=B>>>8&255,t.pending_buf[t.pending++]=255&B}function H(t,B){var A,c,l=t.max_chain_length,k=t.strstart,P=t.prev_length,U=t.nice_match,C=t.strstart>t.w_size-X?t.strstart-(t.w_size-X):0,W=t.window,$=t.w_mask,Z=t.prev,K=t.strstart+M,nt=W[k+P-1],et=W[k+P];t.prev_length>=t.good_match&&(l>>=2),U>t.lookahead&&(U=t.lookahead);do if(W[(A=B)+P]===et&&W[A+P-1]===nt&&W[A]===W[k]&&W[++A]===W[k+1]){k+=2,A++;do;while(W[++k]===W[++A]&&W[++k]===W[++A]&&W[++k]===W[++A]&&W[++k]===W[++A]&&W[++k]===W[++A]&&W[++k]===W[++A]&&W[++k]===W[++A]&&W[++k]===W[++A]&&kC&&--l!=0);return P<=t.lookahead?P:t.lookahead}function it(t){var B,A,c,l,k,P,U,C,W,$,Z=t.w_size;do{if(l=t.window_size-t.lookahead-t.strstart,t.strstart>=Z+(Z-X)){for(s.arraySet(t.window,t.window,Z,Z,0),t.match_start-=Z,t.strstart-=Z,t.block_start-=Z,B=A=t.hash_size;c=t.head[--B],t.head[B]=Z<=c?c-Z:0,--A;);for(B=A=Z;c=t.prev[--B],t.prev[B]=Z<=c?c-Z:0,--A;);l+=Z}if(t.strm.avail_in===0)break;if(P=t.strm,U=t.window,C=t.strstart+t.lookahead,W=l,$=void 0,$=P.avail_in,W<$&&($=W),A=$===0?0:(P.avail_in-=$,s.arraySet(U,P.input,P.next_in,$,C),P.state.wrap===1?P.adler=h(P.adler,U,$,C):P.state.wrap===2&&(P.adler=b(P.adler,U,$,C)),P.next_in+=$,P.total_in+=$,$),t.lookahead+=A,t.lookahead+t.insert>=I)for(k=t.strstart-t.insert,t.ins_h=t.window[k],t.ins_h=(t.ins_h<=I&&(t.ins_h=(t.ins_h<=I)if(c=r._tr_tally(t,t.strstart-t.match_start,t.match_length-I),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=I){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<=I&&(t.ins_h=(t.ins_h<=I&&t.match_length<=t.prev_length){for(l=t.strstart+t.lookahead-I,c=r._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-I),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=l&&(t.ins_h=(t.ins_h<t.pending_buf_size-5&&(A=t.pending_buf_size-5);;){if(t.lookahead<=1){if(it(t),t.lookahead===0&&B===m)return e;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var c=t.block_start+A;if((t.strstart===0||t.strstart>=c)&&(t.lookahead=t.strstart-c,t.strstart=c,z(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-X&&(z(t,!1),t.strm.avail_out===0))return e}return t.insert=0,B===v?(z(t,!0),t.strm.avail_out===0?q:L):(t.strstart>t.block_start&&(z(t,!1),t.strm.avail_out),e)}),new rt(4,4,8,4,lt),new rt(4,5,16,8,lt),new rt(4,6,32,32,lt),new rt(4,4,16,16,tt),new rt(8,16,32,32,tt),new rt(8,16,128,128,tt),new rt(8,32,128,256,tt),new rt(32,128,258,1024,tt),new rt(32,258,258,4096,tt)],p.deflateInit=function(t,B){return ut(t,B,d,15,8,0)},p.deflateInit2=ut,p.deflateReset=ct,p.deflateResetKeep=st,p.deflateSetHeader=function(t,B){return t&&t.state?t.state.wrap!==2?f:(t.state.gzhead=B,i):f},p.deflate=function(t,B){var A,c,l,k;if(!t||!t.state||5>8&255),Y(c,c.gzhead.time>>16&255),Y(c,c.gzhead.time>>24&255),Y(c,c.level===9?2:2<=c.strategy||c.level<2?4:0),Y(c,255&c.gzhead.os),c.gzhead.extra&&c.gzhead.extra.length&&(Y(c,255&c.gzhead.extra.length),Y(c,c.gzhead.extra.length>>8&255)),c.gzhead.hcrc&&(t.adler=b(t.adler,c.pending_buf,c.pending,0)),c.gzindex=0,c.status=69):(Y(c,0),Y(c,0),Y(c,0),Y(c,0),Y(c,0),Y(c,c.level===9?2:2<=c.strategy||c.level<2?4:0),Y(c,3),c.status=F);else{var P=d+(c.w_bits-8<<4)<<8;P|=(2<=c.strategy||c.level<2?0:c.level<6?1:c.level===6?2:3)<<6,c.strstart!==0&&(P|=32),P+=31-P%31,c.status=F,G(c,P),c.strstart!==0&&(G(c,t.adler>>>16),G(c,65535&t.adler)),t.adler=1}if(c.status===69)if(c.gzhead.extra){for(l=c.pending;c.gzindex<(65535&c.gzhead.extra.length)&&(c.pending!==c.pending_buf_size||(c.gzhead.hcrc&&c.pending>l&&(t.adler=b(t.adler,c.pending_buf,c.pending-l,l)),E(t),l=c.pending,c.pending!==c.pending_buf_size));)Y(c,255&c.gzhead.extra[c.gzindex]),c.gzindex++;c.gzhead.hcrc&&c.pending>l&&(t.adler=b(t.adler,c.pending_buf,c.pending-l,l)),c.gzindex===c.gzhead.extra.length&&(c.gzindex=0,c.status=73)}else c.status=73;if(c.status===73)if(c.gzhead.name){l=c.pending;do{if(c.pending===c.pending_buf_size&&(c.gzhead.hcrc&&c.pending>l&&(t.adler=b(t.adler,c.pending_buf,c.pending-l,l)),E(t),l=c.pending,c.pending===c.pending_buf_size)){k=1;break}k=c.gzindexl&&(t.adler=b(t.adler,c.pending_buf,c.pending-l,l)),k===0&&(c.gzindex=0,c.status=91)}else c.status=91;if(c.status===91)if(c.gzhead.comment){l=c.pending;do{if(c.pending===c.pending_buf_size&&(c.gzhead.hcrc&&c.pending>l&&(t.adler=b(t.adler,c.pending_buf,c.pending-l,l)),E(t),l=c.pending,c.pending===c.pending_buf_size)){k=1;break}k=c.gzindexl&&(t.adler=b(t.adler,c.pending_buf,c.pending-l,l)),k===0&&(c.status=103)}else c.status=103;if(c.status===103&&(c.gzhead.hcrc?(c.pending+2>c.pending_buf_size&&E(t),c.pending+2<=c.pending_buf_size&&(Y(c,255&t.adler),Y(c,t.adler>>8&255),t.adler=0,c.status=F)):c.status=F),c.pending!==0){if(E(t),t.avail_out===0)return c.last_flush=-1,i}else if(t.avail_in===0&&j(B)<=j(A)&&B!==v)return Q(t,-5);if(c.status===666&&t.avail_in!==0)return Q(t,-5);if(t.avail_in!==0||c.lookahead!==0||B!==m&&c.status!==666){var U=c.strategy===2?function(C,W){for(var $;;){if(C.lookahead===0&&(it(C),C.lookahead===0)){if(W===m)return e;break}if(C.match_length=0,$=r._tr_tally(C,0,C.window[C.strstart]),C.lookahead--,C.strstart++,$&&(z(C,!1),C.strm.avail_out===0))return e}return C.insert=0,W===v?(z(C,!0),C.strm.avail_out===0?q:L):C.last_lit&&(z(C,!1),C.strm.avail_out===0)?e:D}(c,B):c.strategy===3?function(C,W){for(var $,Z,K,nt,et=C.window;;){if(C.lookahead<=M){if(it(C),C.lookahead<=M&&W===m)return e;if(C.lookahead===0)break}if(C.match_length=0,C.lookahead>=I&&0C.lookahead&&(C.match_length=C.lookahead)}if(C.match_length>=I?($=r._tr_tally(C,1,C.match_length-I),C.lookahead-=C.match_length,C.strstart+=C.match_length,C.match_length=0):($=r._tr_tally(C,0,C.window[C.strstart]),C.lookahead--,C.strstart++),$&&(z(C,!1),C.strm.avail_out===0))return e}return C.insert=0,W===v?(z(C,!0),C.strm.avail_out===0?q:L):C.last_lit&&(z(C,!1),C.strm.avail_out===0)?e:D}(c,B):a[c.level].func(c,B);if(U!==q&&U!==L||(c.status=666),U===e||U===q)return t.avail_out===0&&(c.last_flush=-1),i;if(U===D&&(B===1?r._tr_align(c):B!==5&&(r._tr_stored_block(c,0,0,!1),B===3&&(V(c.head),c.lookahead===0&&(c.strstart=0,c.block_start=0,c.insert=0))),E(t),t.avail_out===0))return c.last_flush=-1,i}return B!==v?i:c.wrap<=0?1:(c.wrap===2?(Y(c,255&t.adler),Y(c,t.adler>>8&255),Y(c,t.adler>>16&255),Y(c,t.adler>>24&255),Y(c,255&t.total_in),Y(c,t.total_in>>8&255),Y(c,t.total_in>>16&255),Y(c,t.total_in>>24&255)):(G(c,t.adler>>>16),G(c,65535&t.adler)),E(t),0=A.w_size&&(k===0&&(V(A.head),A.strstart=0,A.block_start=0,A.insert=0),W=new s.Buf8(A.w_size),s.arraySet(W,B,$-A.w_size,A.w_size,0),B=W,$=A.w_size),P=t.avail_in,U=t.next_in,C=t.input,t.avail_in=$,t.next_in=0,t.input=B,it(A);A.lookahead>=I;){for(c=A.strstart,l=A.lookahead-(I-1);A.ins_h=(A.ins_h<>>=I=N>>>24,w-=I,(I=N>>>16&255)===0)D[y++]=65535&N;else{if(!(16&I)){if(!(64&I)){N=S[(65535&N)+(d&(1<>>=I,w-=I),w<15&&(d+=e[h++]<>>=I=N>>>24,w-=I,!(16&(I=N>>>16&255))){if(!(64&I)){N=x[(65535&N)+(d&(1<>>=I,w-=I,(I=y-m)>3,d&=(1<<(w-=M<<3))-1,a.next_in=h,a.next_out=y,a.avail_in=h>>24&255)+(g>>>8&65280)+((65280&g)<<8)+((255&g)<<24)}function d(){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 a.Buf16(320),this.work=new a.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(g){var F;return g&&g.state?(F=g.state,g.total_in=g.total_out=F.total=0,g.msg="",F.wrap&&(g.adler=1&F.wrap),F.mode=f,F.last=0,F.havedict=0,F.dmax=32768,F.head=null,F.hold=0,F.bits=0,F.lencode=F.lendyn=new a.Buf32(n),F.distcode=F.distdyn=new a.Buf32(u),F.sane=1,F.back=-1,v):i}function S(g){var F;return g&&g.state?((F=g.state).wsize=0,F.whave=0,F.wnext=0,w(g)):i}function x(g,F){var e,D;return g&&g.state?(D=g.state,F<0?(e=0,F=-F):(e=1+(F>>4),F<48&&(F&=15)),F&&(F<8||15=L.wsize?(a.arraySet(L.window,F,e-L.wsize,L.wsize,0),L.wnext=0,L.whave=L.wsize):(D<(q=L.wsize-L.wnext)&&(q=D),a.arraySet(L.window,F,e-D,q,L.wnext),(D-=q)?(a.arraySet(L.window,F,e-D,D,0),L.wnext=D,L.whave=L.wsize):(L.wnext+=q,L.wnext===L.wsize&&(L.wnext=0),L.whave>>8&255,e.check=r(e.check,k,2,0),z=E=0,e.mode=2;break}if(e.flags=0,e.head&&(e.head.done=!1),!(1&e.wrap)||(((255&E)<<8)+(E>>8))%31){g.msg="incorrect header check",e.mode=30;break}if((15&E)!=8){g.msg="unknown compression method",e.mode=30;break}if(z-=4,t=8+(15&(E>>>=4)),e.wbits===0)e.wbits=t;else if(t>e.wbits){g.msg="invalid window size",e.mode=30;break}e.dmax=1<>8&1),512&e.flags&&(k[0]=255&E,k[1]=E>>>8&255,e.check=r(e.check,k,2,0)),z=E=0,e.mode=3;case 3:for(;z<32;){if(j===0)break t;j--,E+=D[L++]<>>8&255,k[2]=E>>>16&255,k[3]=E>>>24&255,e.check=r(e.check,k,4,0)),z=E=0,e.mode=4;case 4:for(;z<16;){if(j===0)break t;j--,E+=D[L++]<>8),512&e.flags&&(k[0]=255&E,k[1]=E>>>8&255,e.check=r(e.check,k,2,0)),z=E=0,e.mode=5;case 5:if(1024&e.flags){for(;z<16;){if(j===0)break t;j--,E+=D[L++]<>>8&255,e.check=r(e.check,k,2,0)),z=E=0}else e.head&&(e.head.extra=null);e.mode=6;case 6:if(1024&e.flags&&(j<(H=e.length)&&(H=j),H&&(e.head&&(t=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Array(e.head.extra_len)),a.arraySet(e.head.extra,D,L,H,t)),512&e.flags&&(e.check=r(e.check,D,H,L)),j-=H,L+=H,e.length-=H),e.length))break t;e.length=0,e.mode=7;case 7:if(2048&e.flags){if(j===0)break t;for(H=0;t=D[L+H++],e.head&&t&&e.length<65536&&(e.head.name+=String.fromCharCode(t)),t&&H>9&1,e.head.done=!0),g.adler=e.check=0,e.mode=12;break;case 10:for(;z<32;){if(j===0)break t;j--,E+=D[L++]<>>=7&z,z-=7&z,e.mode=27;break}for(;z<3;){if(j===0)break t;j--,E+=D[L++]<>>=1)){case 0:e.mode=14;break;case 1:if(M(e),e.mode=20,F!==6)break;E>>>=2,z-=2;break t;case 2:e.mode=17;break;case 3:g.msg="invalid block type",e.mode=30}E>>>=2,z-=2;break;case 14:for(E>>>=7&z,z-=7&z;z<32;){if(j===0)break t;j--,E+=D[L++]<>>16^65535)){g.msg="invalid stored block lengths",e.mode=30;break}if(e.length=65535&E,z=E=0,e.mode=15,F===6)break t;case 15:e.mode=16;case 16:if(H=e.length){if(j>>=5,z-=5,e.ndist=1+(31&E),E>>>=5,z-=5,e.ncode=4+(15&E),E>>>=4,z-=4,286>>=3,z-=3}for(;e.have<19;)e.lens[P[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,A={bits:e.lenbits},B=b(0,e.lens,0,19,e.lencode,0,e.work,A),e.lenbits=A.bits,B){g.msg="invalid code lengths set",e.mode=30;break}e.have=0,e.mode=19;case 19:for(;e.have>>16&255,ot=65535&l,!((tt=l>>>24)<=z);){if(j===0)break t;j--,E+=D[L++]<>>=tt,z-=tt,e.lens[e.have++]=ot;else{if(ot===16){for(c=tt+2;z>>=tt,z-=tt,e.have===0){g.msg="invalid bit length repeat",e.mode=30;break}t=e.lens[e.have-1],H=3+(3&E),E>>>=2,z-=2}else if(ot===17){for(c=tt+3;z>>=tt)),E>>>=3,z-=3}else{for(c=tt+7;z>>=tt)),E>>>=7,z-=7}if(e.have+H>e.nlen+e.ndist){g.msg="invalid bit length repeat",e.mode=30;break}for(;H--;)e.lens[e.have++]=t}}if(e.mode===30)break;if(e.lens[256]===0){g.msg="invalid code -- missing end-of-block",e.mode=30;break}if(e.lenbits=9,A={bits:e.lenbits},B=b(y,e.lens,0,e.nlen,e.lencode,0,e.work,A),e.lenbits=A.bits,B){g.msg="invalid literal/lengths set",e.mode=30;break}if(e.distbits=6,e.distcode=e.distdyn,A={bits:e.distbits},B=b(m,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,A),e.distbits=A.bits,B){g.msg="invalid distances set",e.mode=30;break}if(e.mode=20,F===6)break t;case 20:e.mode=21;case 21:if(6<=j&&258<=V){g.next_out=Q,g.avail_out=V,g.next_in=L,g.avail_in=j,e.hold=E,e.bits=z,h(g,G),Q=g.next_out,q=g.output,V=g.avail_out,L=g.next_in,D=g.input,j=g.avail_in,E=e.hold,z=e.bits,e.mode===12&&(e.back=-1);break}for(e.back=0;rt=(l=e.lencode[E&(1<>>16&255,ot=65535&l,!((tt=l>>>24)<=z);){if(j===0)break t;j--,E+=D[L++]<>st)])>>>16&255,ot=65535&l,!(st+(tt=l>>>24)<=z);){if(j===0)break t;j--,E+=D[L++]<>>=st,z-=st,e.back+=st}if(E>>>=tt,z-=tt,e.back+=tt,e.length=ot,rt===0){e.mode=26;break}if(32&rt){e.back=-1,e.mode=12;break}if(64&rt){g.msg="invalid literal/length code",e.mode=30;break}e.extra=15&rt,e.mode=22;case 22:if(e.extra){for(c=e.extra;z>>=e.extra,z-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=23;case 23:for(;rt=(l=e.distcode[E&(1<>>16&255,ot=65535&l,!((tt=l>>>24)<=z);){if(j===0)break t;j--,E+=D[L++]<>st)])>>>16&255,ot=65535&l,!(st+(tt=l>>>24)<=z);){if(j===0)break t;j--,E+=D[L++]<>>=st,z-=st,e.back+=st}if(E>>>=tt,z-=tt,e.back+=tt,64&rt){g.msg="invalid distance code",e.mode=30;break}e.offset=ot,e.extra=15&rt,e.mode=24;case 24:if(e.extra){for(c=e.extra;z>>=e.extra,z-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){g.msg="invalid distance too far back",e.mode=30;break}e.mode=25;case 25:if(V===0)break t;if(H=G-V,e.offset>H){if((H=e.offset-H)>e.whave&&e.sane){g.msg="invalid distance too far back",e.mode=30;break}it=H>e.wnext?(H-=e.wnext,e.wsize-H):e.wnext-H,H>e.length&&(H=e.length),lt=e.window}else lt=q,it=Q-e.offset,H=e.length;for(VO?(I=it[lt+u[F]],z[Y+u[F]]):(I=96,0),d=1<>Q)+(w-=d)]=N<<24|I<<16|M|0,w!==0;);for(d=1<>=1;if(d!==0?(E&=d-1,E+=d):E=0,F++,--G[g]==0){if(g===D)break;g=m[v+u[F]]}if(q>>7)]}function Y(l,k){l.pending_buf[l.pending++]=255&k,l.pending_buf[l.pending++]=k>>>8&255}function G(l,k,P){l.bi_valid>o-P?(l.bi_buf|=k<>o-l.bi_valid,l.bi_valid+=P-o):(l.bi_buf|=k<>>=1,P<<=1,0<--k;);return P>>>1}function lt(l,k,P){var U,C,W=new Array(u+1),$=0;for(U=1;U<=u;U++)W[U]=$=$+P[U-1]<<1;for(C=0;C<=k;C++){var Z=l[2*C+1];Z!==0&&(l[2*C]=it(W[Z]++,Z))}}function tt(l){var k;for(k=0;k>1;1<=P;P--)st(l,W,P);for(C=K;P=l.heap[1],l.heap[1]=l.heap[l.heap_len--],st(l,W,1),U=l.heap[1],l.heap[--l.heap_max]=P,l.heap[--l.heap_max]=U,W[2*C]=W[2*P]+W[2*U],l.depth[C]=(l.depth[P]>=l.depth[U]?l.depth[P]:l.depth[U])+1,W[2*P+1]=W[2*U+1]=C,l.heap[1]=C++,st(l,W,1),2<=l.heap_len;);l.heap[--l.heap_max]=l.heap[1],function(et,ht){var pt,dt,mt,at,gt,yt,ft=ht.dyn_tree,zt=ht.max_code,Tt=ht.stat_desc.static_tree,Bt=ht.stat_desc.has_stree,Rt=ht.stat_desc.extra_bits,Et=ht.stat_desc.extra_base,_t=ht.stat_desc.max_length,bt=0;for(at=0;at<=u;at++)et.bl_count[at]=0;for(ft[2*et.heap[et.heap_max]+1]=0,pt=et.heap_max+1;pt>=7;C>>=1)if(1&nt&&Z.dyn_ltree[2*K]!==0)return s;if(Z.dyn_ltree[18]!==0||Z.dyn_ltree[20]!==0||Z.dyn_ltree[26]!==0)return r;for(K=32;K>>3,(W=l.static_len+3+7>>>3)<=C&&(C=W)):C=W=P+5,P+4<=C&&k!==-1?c(l,k,P,U):l.strategy===4||W===C?(G(l,2+(U?1:0),3),ct(l,X,g)):(G(l,4+(U?1:0),3),function(Z,K,nt,et){var ht;for(G(Z,K-257,5),G(Z,nt-1,5),G(Z,et-4,4),ht=0;ht>>8&255,l.pending_buf[l.d_buf+2*l.last_lit+1]=255&k,l.pending_buf[l.l_buf+l.last_lit]=255&P,l.last_lit++,k===0?l.dyn_ltree[2*P]++:(l.matches++,k--,l.dyn_ltree[2*(e[P]+m+1)]++,l.dyn_dtree[2*z(k)]++),l.last_lit===l.lit_bufsize-1},p._tr_align=function(l){G(l,2,3),H(l,w,X),function(k){k.bi_valid===16?(Y(k,k.bi_buf),k.bi_buf=0,k.bi_valid=0):8<=k.bi_valid&&(k.pending_buf[k.pending++]=255&k.bi_buf,k.bi_buf>>=8,k.bi_valid-=8)}(l)}},{"../utils/common":41}],53:[function(_,T,p){"use strict";T.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(_,T,p){(function(a){(function(s,r){"use strict";if(!s.setImmediate){var h,b,y,m,v=1,i={},f=!1,n=s.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(s);u=u&&u.setTimeout?u:s,h={}.toString.call(s.process)==="[object process]"?function(S){process.nextTick(function(){d(S)})}:function(){if(s.postMessage&&!s.importScripts){var S=!0,x=s.onmessage;return s.onmessage=function(){S=!1},s.postMessage("","*"),s.onmessage=x,S}}()?(m="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",w,!1):s.attachEvent("onmessage",w),function(S){s.postMessage(m+S,"*")}):s.MessageChannel?((y=new MessageChannel).port1.onmessage=function(S){d(S.data)},function(S){y.port2.postMessage(S)}):n&&"onreadystatechange"in n.createElement("script")?(b=n.documentElement,function(S){var x=n.createElement("script");x.onreadystatechange=function(){d(S),x.onreadystatechange=null,b.removeChild(x),x=null},b.appendChild(x)}):function(S){setTimeout(d,0,S)},u.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var x=new Array(arguments.length-1),R=0;Rwt});module.exports=Mt(Gt);var J=require("obsidian"),Ft=Zt(Ot()),Ht={targetFolder:"Course Modules"},xt=class extends J.Modal{constructor(p,a){super(p);this.result="";this.onSubmit=a}onOpen(){let{contentEl:p}=this;p.empty(),p.createEl("h2",{text:"Enter Course Module URL"}),new J.Setting(p).setName("URL").addText(a=>a.onChange(s=>{this.result=s.trim()}).inputEl.focus()),new J.Setting(p).addButton(a=>a.setButtonText("Download and Unzip").setCta().onClick(()=>{this.result?(this.close(),this.onSubmit(this.result)):new J.Notice("Please enter a URL.")})),p.addEventListener("keypress",a=>{a.key==="Enter"&&(a.preventDefault(),this.result?(this.close(),this.onSubmit(this.result)):new J.Notice("Please enter a URL."))})}onClose(){let{contentEl:p}=this;p.empty()}},St=class extends J.FuzzySuggestModal{constructor(p,a,s,r){super(p);this.plugin=a,this.settingDisplayElement=s,this.preFetchedFolders=r,this.setPlaceholder("Search for a folder...")}getItems(){if(this.preFetchedFolders)return this.preFetchedFolders;console.warn("FolderSuggestModal: Pre-fetched list not available, fetching manually.");let p=this.app.vault.getAllLoadedFiles().filter(s=>s instanceof J.TFolder),a=this.app.vault.getRoot();return p.some(s=>s.path==="/")||p.unshift(a),p}getItemText(p){return p.path==="/"?"/ (Vault Root)":p.path}onChooseItem(p,a){let s=p.path;this.plugin.settings.targetFolder=s,this.plugin.saveSettings(),new J.Notice(`Target folder set to: ${s}`),this.settingDisplayElement.value=s}renderSuggestion(p,a){if(super.renderSuggestion(p,a),p.item.path==="/"){let s=a.querySelector(".suggestion-content");s?s.textContent="/ (Vault Root)":a.setText("/ (Vault Root)")}}},Ct=class extends J.PluginSettingTab{constructor(p,a){super(p,a);this.plugin=a}display(){let{containerEl:p}=this;p.empty(),p.createEl("h2",{text:"Course Material Downloader Settings"});let a=new J.Setting(p).setName("Target Folder").setDesc("The folder where downloaded modules will be unzipped.");a.addText(s=>{s.setValue(this.plugin.settings.targetFolder).setDisabled(!0),s.inputEl.addClass("course-material-downloader-wide-input");let r=s.inputEl;a.addButton(h=>{h.setButtonText("Change Folder").onClick(()=>{let b=this.app.vault.getAllLoadedFiles().filter(m=>m instanceof J.TFolder),y=this.app.vault.getRoot();b.some(m=>m.path==="/")||b.unshift(y),new St(this.app,this.plugin,r,b).open()})})}),p.createEl("p",{text:"Note: If the desired folder doesn't exist, it will be created during the download process (if possible)."})}},wt=class extends J.Plugin{async onload(){await this.loadSettings(),this.addCommand({id:"download-course-module",name:"Download and Unzip Course Module",callback:()=>{this.showUrlInputModal()}}),this.addSettingTab(new Ct(this.app,this))}onunload(){}async loadSettings(){this.settings=Object.assign({},Ht,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}async ensureFolderExists(p){if(p==="/"||p==="")return this.app.vault.getRoot();let a=p.replace(/^\/|\/$/g,"");if(a==="")return this.app.vault.getRoot();try{let s=this.app.vault.getAbstractFileByPath(a);if(s instanceof J.TFolder)return s;if(s instanceof J.TFile)return console.error(`Cannot create folder '${a}', a file with this name already exists.`),new J.Notice(`Cannot create folder '${a}', a file exists there.`),null;try{let r=await this.app.vault.createFolder(a);return new J.Notice(`Created folder: ${a}`),r}catch(r){console.error(`Error creating folder '${a}':`,r);let h=this.app.vault.getAbstractFileByPath(a);return h instanceof J.TFolder?h:(new J.Notice(`Error creating folder '${a}'. Check console.`),null)}}catch(s){return console.error(`Unexpected error ensuring folder exists '${a}':`,s),new J.Notice(`Unexpected error checking folder '${a}'. Check console.`),null}}showUrlInputModal(){new xt(this.app,p=>{this.downloadAndUnzip(p)}).open()}async downloadAndUnzip(p){var b,y;if(!p.startsWith("http://")&&!p.startsWith("https://")){new J.Notice("Invalid URL received. Must start with http:// or https://");return}p=p.replace("www.dropbox.com","dl.dropboxusercontent.com"),p.includes("dropbox.com")&&!p.includes("dl=1")&&(p=p.includes("?")?`${p}&dl=1`:`${p}?dl=1`);let a=this.settings.targetFolder,s=await this.ensureFolderExists(a);if(!s){new J.Notice(`Target folder "${a}" could not be found or created. Aborting.`);return}let r=s.path==="/"?"":s.path,h;try{new J.Notice("Downloading module..."),h=(await(0,J.requestUrl)({url:p})).arrayBuffer,new J.Notice("Download complete. Unzipping...")}catch(m){console.error("Download Error:",m),new J.Notice(`Failed to download file: ${m.message}. Check console (Ctrl+Shift+I or Cmd+Opt+I).`);return}try{let m=await Ft.default.loadAsync(h),v=0,i=new Set;for(let f in m.files){let n=f.split("/").pop();if(f.startsWith("__MACOSX/")||n===".DS_Store"||!f)continue;let u=m.files[f],d=(r?`${r}/${f}`:f).replace(/\\/g,"/").replace(/\/+/g,"/");if(u.dir){let w=d.endsWith("/")?d.slice(0,-1):d;w&&!i.has(w)&&(await this.ensureFolderExists(w)?i.add(w):console.warn(`Could not ensure directory exists: ${w}. Skipping contents.`))}else{let w=await u.async("arraybuffer"),S=d.lastIndexOf("/"),x=S>0?d.substring(0,S):S===0?"/":"";if(x&&x!==r&&!i.has(x))if(await this.ensureFolderExists(x))i.add(x);else{console.warn(`Could not ensure parent directory exists: ${x}. Skipping file: ${d}`);continue}let R=d.startsWith("/")?d.substring(1):d;if(R===""&&d==="/"){console.warn("Attempting to check root path '/' for a file. Skipping.");continue}let O=R?this.app.vault.getAbstractFileByPath(R):null;if(O instanceof J.TFile)continue;if(O instanceof J.TFolder){console.error(`Skipping file write: A folder exists at path ${d}`),new J.Notice(`Skipping file write: Folder exists at ${d}`);continue}else try{await this.app.vault.createBinary(d,w,{mtime:Date.now()}),v++}catch(N){(b=N.message)!=null&&b.toLowerCase().includes("file already exists")?console.warn(`Caught 'File already exists' on createBinary for ${d}. Skipping.`):(console.error(`Error creating file '${d}':`,N),new J.Notice(`Error creating file '${d}'. Check console.`))}}}new J.Notice(`Successfully extracted ${v} new file(s) to '${s.path}'.`)}catch(m){console.error("Unzip/Write Error:",m),(y=m.message)!=null&&y.toLowerCase().includes("file already exists")?(console.warn("Caught 'File already exists' error during unzip/write phase, possibly handled. Check logic if files were missed."),new J.Notice("An unexpected 'File already exists' error occurred during processing. Some files might not have been processed correctly. Check console.")):new J.Notice(`Failed to unzip or write files: ${m.message}. Check console.`)}}}; +var Pt=Object.create;var vt=Object.defineProperty;var Ut=Object.getOwnPropertyDescriptor;var Nt=Object.getOwnPropertyNames;var Lt=Object.getPrototypeOf,jt=Object.prototype.hasOwnProperty;var Wt=(_,T)=>()=>(T||_((T={exports:{}}).exports,T),T.exports),Zt=(_,T)=>{for(var p in T)vt(_,p,{get:T[p],enumerable:!0})},At=(_,T,p,s)=>{if(T&&typeof T=="object"||typeof T=="function")for(let a of Nt(T))!jt.call(_,a)&&a!==p&&vt(_,a,{get:()=>T[a],enumerable:!(s=Ut(T,a))||s.enumerable});return _};var Mt=(_,T,p)=>(p=_!=null?Pt(Lt(_)):{},At(T||!_||!_.__esModule?vt(p,"default",{value:_,enumerable:!0}):p,_)),Ht=_=>At(vt({},"__esModule",{value:!0}),_);var Ot=Wt((It,kt)=>{(function(_){typeof It=="object"&&typeof kt!="undefined"?kt.exports=_():typeof define=="function"&&define.amd?define([],_):(typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:this).JSZip=_()})(function(){return function _(T,p,s){function a(b,y){if(!p[b]){if(!T[b]){var m=typeof require=="function"&&require;if(!y&&m)return m(b,!0);if(r)return r(b,!0);var v=new Error("Cannot find module '"+b+"'");throw v.code="MODULE_NOT_FOUND",v}var i=p[b]={exports:{}};T[b][0].call(i.exports,function(f){var n=T[b][1][f];return a(n||f)},i,i.exports,_,T,p,s)}return p[b].exports}for(var r=typeof require=="function"&&require,h=0;h>2,i=(3&b)<<4|y>>4,f=1>6:64,n=2>4,y=(15&v)<<4|(i=r.indexOf(h.charAt(n++)))>>2,m=(3&i)<<6|(f=r.indexOf(h.charAt(n++))),d[u++]=b,i!==64&&(d[u++]=y),f!==64&&(d[u++]=m);return d}},{"./support":30,"./utils":32}],2:[function(_,T,p){"use strict";var s=_("./external"),a=_("./stream/DataWorker"),r=_("./stream/Crc32Probe"),h=_("./stream/DataLengthProbe");function b(y,m,v,i,f){this.compressedSize=y,this.uncompressedSize=m,this.crc32=v,this.compression=i,this.compressedContent=f}b.prototype={getContentWorker:function(){var y=new a(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new h("data_length")),m=this;return y.on("end",function(){if(this.streamInfo.data_length!==m.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),y},getCompressedWorker:function(){return new a(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},b.createWorkerFrom=function(y,m,v){return y.pipe(new r).pipe(new h("uncompressedSize")).pipe(m.compressWorker(v)).pipe(new h("compressedSize")).withStreamInfo("compression",m)},T.exports=b},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(_,T,p){"use strict";var s=_("./stream/GenericWorker");p.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},p.DEFLATE=_("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(_,T,p){"use strict";var s=_("./utils"),a=function(){for(var r,h=[],b=0;b<256;b++){r=b;for(var y=0;y<8;y++)r=1&r?3988292384^r>>>1:r>>>1;h[b]=r}return h}();T.exports=function(r,h){return r!==void 0&&r.length?s.getTypeOf(r)!=="string"?function(b,y,m,v){var i=a,f=v+m;b^=-1;for(var n=v;n>>8^i[255&(b^y[n])];return-1^b}(0|h,r,r.length,0):function(b,y,m,v){var i=a,f=v+m;b^=-1;for(var n=v;n>>8^i[255&(b^y.charCodeAt(n))];return-1^b}(0|h,r,r.length,0):0}},{"./utils":32}],5:[function(_,T,p){"use strict";p.base64=!1,p.binary=!1,p.dir=!1,p.createFolders=!0,p.date=null,p.compression=null,p.compressionOptions=null,p.comment=null,p.unixPermissions=null,p.dosPermissions=null},{}],6:[function(_,T,p){"use strict";var s=null;s=typeof Promise!="undefined"?Promise:_("lie"),T.exports={Promise:s}},{lie:37}],7:[function(_,T,p){"use strict";var s=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",a=_("pako"),r=_("./utils"),h=_("./stream/GenericWorker"),b=s?"uint8array":"array";function y(m,v){h.call(this,"FlateWorker/"+m),this._pako=null,this._pakoAction=m,this._pakoOptions=v,this.meta={}}p.magic="\b\0",r.inherits(y,h),y.prototype.processChunk=function(m){this.meta=m.meta,this._pako===null&&this._createPako(),this._pako.push(r.transformTo(b,m.data),!1)},y.prototype.flush=function(){h.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},y.prototype.cleanUp=function(){h.prototype.cleanUp.call(this),this._pako=null},y.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var m=this;this._pako.onData=function(v){m.push({data:v,meta:m.meta})}},p.compressWorker=function(m){return new y("Deflate",m)},p.uncompressWorker=function(){return new y("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(_,T,p){"use strict";function s(i,f){var n,u="";for(n=0;n>>=8;return u}function a(i,f,n,u,o,d){var w,S,x=i.file,R=i.compression,O=d!==b.utf8encode,N=r.transformTo("string",d(x.name)),I=r.transformTo("string",b.utf8encode(x.name)),M=x.comment,X=r.transformTo("string",d(M)),g=r.transformTo("string",b.utf8encode(M)),F=I.length!==x.name.length,e=g.length!==M.length,D="",q="",L="",Q=x.dir,j=x.date,V={crc32:0,compressedSize:0,uncompressedSize:0};f&&!n||(V.crc32=i.crc32,V.compressedSize=i.compressedSize,V.uncompressedSize=i.uncompressedSize);var E=0;f&&(E|=8),O||!F&&!e||(E|=2048);var z=0,Y=0;Q&&(z|=16),o==="UNIX"?(Y=798,z|=function(H,it){var lt=H;return H||(lt=it?16893:33204),(65535<)<<16}(x.unixPermissions,Q)):(Y=20,z|=function(H){return 63&(H||0)}(x.dosPermissions)),w=j.getUTCHours(),w<<=6,w|=j.getUTCMinutes(),w<<=5,w|=j.getUTCSeconds()/2,S=j.getUTCFullYear()-1980,S<<=4,S|=j.getUTCMonth()+1,S<<=5,S|=j.getUTCDate(),F&&(q=s(1,1)+s(y(N),4)+I,D+="up"+s(q.length,2)+q),e&&(L=s(1,1)+s(y(X),4)+g,D+="uc"+s(L.length,2)+L);var G="";return G+=` +\0`,G+=s(E,2),G+=R.magic,G+=s(w,2),G+=s(S,2),G+=s(V.crc32,4),G+=s(V.compressedSize,4),G+=s(V.uncompressedSize,4),G+=s(N.length,2),G+=s(D.length,2),{fileRecord:m.LOCAL_FILE_HEADER+G+N+D,dirRecord:m.CENTRAL_FILE_HEADER+s(Y,2)+G+s(X.length,2)+"\0\0\0\0"+s(z,4)+s(u,4)+N+D+X}}var r=_("../utils"),h=_("../stream/GenericWorker"),b=_("../utf8"),y=_("../crc32"),m=_("../signature");function v(i,f,n,u){h.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=f,this.zipPlatform=n,this.encodeFileName=u,this.streamFiles=i,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}r.inherits(v,h),v.prototype.push=function(i){var f=i.meta.percent||0,n=this.entriesCount,u=this._sources.length;this.accumulate?this.contentBuffer.push(i):(this.bytesWritten+=i.data.length,h.prototype.push.call(this,{data:i.data,meta:{currentFile:this.currentFile,percent:n?(f+100*(n-u-1))/n:100}}))},v.prototype.openedSource=function(i){this.currentSourceOffset=this.bytesWritten,this.currentFile=i.file.name;var f=this.streamFiles&&!i.file.dir;if(f){var n=a(i,f,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},v.prototype.closedSource=function(i){this.accumulate=!1;var f=this.streamFiles&&!i.file.dir,n=a(i,f,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),f)this.push({data:function(u){return m.DATA_DESCRIPTOR+s(u.crc32,4)+s(u.compressedSize,4)+s(u.uncompressedSize,4)}(i),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},v.prototype.flush=function(){for(var i=this.bytesWritten,f=0;f=this.index;h--)b=(b<<8)+this.byteAt(h);return this.index+=r,b},readString:function(r){return s.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))}},T.exports=a},{"../utils":32}],19:[function(_,T,p){"use strict";var s=_("./Uint8ArrayReader");function a(r){s.call(this,r)}_("../utils").inherits(a,s),a.prototype.readData=function(r){this.checkOffset(r);var h=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,h},T.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(_,T,p){"use strict";var s=_("./DataReader");function a(r){s.call(this,r)}_("../utils").inherits(a,s),a.prototype.byteAt=function(r){return this.data.charCodeAt(this.zero+r)},a.prototype.lastIndexOfSignature=function(r){return this.data.lastIndexOf(r)-this.zero},a.prototype.readAndCheckSignature=function(r){return r===this.readData(4)},a.prototype.readData=function(r){this.checkOffset(r);var h=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,h},T.exports=a},{"../utils":32,"./DataReader":18}],21:[function(_,T,p){"use strict";var s=_("./ArrayReader");function a(r){s.call(this,r)}_("../utils").inherits(a,s),a.prototype.readData=function(r){if(this.checkOffset(r),r===0)return new Uint8Array(0);var h=this.data.subarray(this.zero+this.index,this.zero+this.index+r);return this.index+=r,h},T.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(_,T,p){"use strict";var s=_("../utils"),a=_("../support"),r=_("./ArrayReader"),h=_("./StringReader"),b=_("./NodeBufferReader"),y=_("./Uint8ArrayReader");T.exports=function(m){var v=s.getTypeOf(m);return s.checkSupport(v),v!=="string"||a.uint8array?v==="nodebuffer"?new b(m):a.uint8array?new y(s.transformTo("uint8array",m)):new r(s.transformTo("array",m)):new h(m)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(_,T,p){"use strict";p.LOCAL_FILE_HEADER="PK",p.CENTRAL_FILE_HEADER="PK",p.CENTRAL_DIRECTORY_END="PK",p.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",p.ZIP64_CENTRAL_DIRECTORY_END="PK",p.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(_,T,p){"use strict";var s=_("./GenericWorker"),a=_("../utils");function r(h){s.call(this,"ConvertWorker to "+h),this.destType=h}a.inherits(r,s),r.prototype.processChunk=function(h){this.push({data:a.transformTo(this.destType,h.data),meta:h.meta})},T.exports=r},{"../utils":32,"./GenericWorker":28}],25:[function(_,T,p){"use strict";var s=_("./GenericWorker"),a=_("../crc32");function r(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}_("../utils").inherits(r,s),r.prototype.processChunk=function(h){this.streamInfo.crc32=a(h.data,this.streamInfo.crc32||0),this.push(h)},T.exports=r},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(_,T,p){"use strict";var s=_("../utils"),a=_("./GenericWorker");function r(h){a.call(this,"DataLengthProbe for "+h),this.propName=h,this.withStreamInfo(h,0)}s.inherits(r,a),r.prototype.processChunk=function(h){if(h){var b=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=b+h.data.length}a.prototype.processChunk.call(this,h)},T.exports=r},{"../utils":32,"./GenericWorker":28}],27:[function(_,T,p){"use strict";var s=_("../utils"),a=_("./GenericWorker");function r(h){a.call(this,"DataWorker");var b=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,h.then(function(y){b.dataIsReady=!0,b.data=y,b.max=y&&y.length||0,b.type=s.getTypeOf(y),b.isPaused||b._tickAndRepeat()},function(y){b.error(y)})}s.inherits(r,a),r.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},r.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},r.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},r.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var h=null,b=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":h=this.data.substring(this.index,b);break;case"uint8array":h=this.data.subarray(this.index,b);break;case"array":case"nodebuffer":h=this.data.slice(this.index,b)}return this.index=b,this.push({data:h,meta:{percent:this.max?this.index/this.max*100:0}})},T.exports=r},{"../utils":32,"./GenericWorker":28}],28:[function(_,T,p){"use strict";function s(a){this.name=a||"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}s.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,r){return this._listeners[a].push(r),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,r){if(this._listeners[a])for(var h=0;h "+a:a}},T.exports=s},{}],29:[function(_,T,p){"use strict";var s=_("../utils"),a=_("./ConvertWorker"),r=_("./GenericWorker"),h=_("../base64"),b=_("../support"),y=_("../external"),m=null;if(b.nodestream)try{m=_("../nodejs/NodejsStreamOutputAdapter")}catch(f){}function v(f,n){return new y.Promise(function(u,o){var d=[],w=f._internalType,S=f._outputType,x=f._mimeType;f.on("data",function(R,O){d.push(R),n&&n(O)}).on("error",function(R){d=[],o(R)}).on("end",function(){try{var R=function(O,N,I){switch(O){case"blob":return s.newBlob(s.transformTo("arraybuffer",N),I);case"base64":return h.encode(N);default:return s.transformTo(O,N)}}(S,function(O,N){var I,M=0,X=null,g=0;for(I=0;I>>6:(u<65536?n[w++]=224|u>>>12:(n[w++]=240|u>>>18,n[w++]=128|u>>>12&63),n[w++]=128|u>>>6&63),n[w++]=128|63&u);return n}(i)},p.utf8decode=function(i){return a.nodebuffer?s.transformTo("nodebuffer",i).toString("utf-8"):function(f){var n,u,o,d,w=f.length,S=new Array(2*w);for(n=u=0;n>10&1023,S[u++]=56320|1023&o)}return S.length!==u&&(S.subarray?S=S.subarray(0,u):S.length=u),s.applyFromCharCode(S)}(i=s.transformTo(a.uint8array?"uint8array":"array",i))},s.inherits(m,h),m.prototype.processChunk=function(i){var f=s.transformTo(a.uint8array?"uint8array":"array",i.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var n=f;(f=new Uint8Array(n.length+this.leftOver.length)).set(this.leftOver,0),f.set(n,this.leftOver.length)}else f=this.leftOver.concat(f);this.leftOver=null}var u=function(d,w){var S;for((w=w||d.length)>d.length&&(w=d.length),S=w-1;0<=S&&(192&d[S])==128;)S--;return S<0||S===0?w:S+b[d[S]]>w?S:w}(f),o=f;u!==f.length&&(a.uint8array?(o=f.subarray(0,u),this.leftOver=f.subarray(u,f.length)):(o=f.slice(0,u),this.leftOver=f.slice(u,f.length))),this.push({data:p.utf8decode(o),meta:i.meta})},m.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:p.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},p.Utf8DecodeWorker=m,s.inherits(v,h),v.prototype.processChunk=function(i){this.push({data:p.utf8encode(i.data),meta:i.meta})},p.Utf8EncodeWorker=v},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(_,T,p){"use strict";var s=_("./support"),a=_("./base64"),r=_("./nodejsUtils"),h=_("./external");function b(n){return n}function y(n,u){for(var o=0;o>8;this.dir=!!(16&this.externalFileAttributes),i==0&&(this.dosPermissions=63&this.externalFileAttributes),i==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var i=s(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=i.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=i.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=i.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=i.readInt(4))}},readExtraFields:function(i){var f,n,u,o=i.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});i.index+4>>6:(i<65536?v[u++]=224|i>>>12:(v[u++]=240|i>>>18,v[u++]=128|i>>>12&63),v[u++]=128|i>>>6&63),v[u++]=128|63&i);return v},p.buf2binstring=function(m){return y(m,m.length)},p.binstring2buf=function(m){for(var v=new s.Buf8(m.length),i=0,f=v.length;i>10&1023,d[f++]=56320|1023&n)}return y(d,f)},p.utf8border=function(m,v){var i;for((v=v||m.length)>m.length&&(v=m.length),i=v-1;0<=i&&(192&m[i])==128;)i--;return i<0||i===0?v:i+h[m[i]]>v?i:v}},{"./common":41}],43:[function(_,T,p){"use strict";T.exports=function(s,a,r,h){for(var b=65535&s|0,y=s>>>16&65535|0,m=0;r!==0;){for(r-=m=2e3>>1:a>>>1;r[h]=a}return r}();T.exports=function(a,r,h,b){var y=s,m=b+h;a^=-1;for(var v=b;v>>8^y[255&(a^r[v])];return-1^a}},{}],46:[function(_,T,p){"use strict";var s,a=_("../utils/common"),r=_("./trees"),h=_("./adler32"),b=_("./crc32"),y=_("./messages"),m=0,v=4,i=0,f=-2,n=-1,u=4,o=2,d=8,w=9,S=286,x=30,R=19,O=2*S+1,N=15,I=3,M=258,X=M+I+1,g=42,F=113,e=1,D=2,q=3,L=4;function Q(t,B){return t.msg=y[B],B}function j(t){return(t<<1)-(4t.avail_out&&(A=t.avail_out),A!==0&&(a.arraySet(t.output,B.pending_buf,B.pending_out,A,t.next_out),t.next_out+=A,B.pending_out+=A,t.total_out+=A,t.avail_out-=A,B.pending-=A,B.pending===0&&(B.pending_out=0))}function z(t,B){r._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,B),t.block_start=t.strstart,E(t.strm)}function Y(t,B){t.pending_buf[t.pending++]=B}function G(t,B){t.pending_buf[t.pending++]=B>>>8&255,t.pending_buf[t.pending++]=255&B}function H(t,B){var A,c,l=t.max_chain_length,k=t.strstart,P=t.prev_length,U=t.nice_match,C=t.strstart>t.w_size-X?t.strstart-(t.w_size-X):0,W=t.window,$=t.w_mask,Z=t.prev,K=t.strstart+M,nt=W[k+P-1],et=W[k+P];t.prev_length>=t.good_match&&(l>>=2),U>t.lookahead&&(U=t.lookahead);do if(W[(A=B)+P]===et&&W[A+P-1]===nt&&W[A]===W[k]&&W[++A]===W[k+1]){k+=2,A++;do;while(W[++k]===W[++A]&&W[++k]===W[++A]&&W[++k]===W[++A]&&W[++k]===W[++A]&&W[++k]===W[++A]&&W[++k]===W[++A]&&W[++k]===W[++A]&&W[++k]===W[++A]&&kC&&--l!=0);return P<=t.lookahead?P:t.lookahead}function it(t){var B,A,c,l,k,P,U,C,W,$,Z=t.w_size;do{if(l=t.window_size-t.lookahead-t.strstart,t.strstart>=Z+(Z-X)){for(a.arraySet(t.window,t.window,Z,Z,0),t.match_start-=Z,t.strstart-=Z,t.block_start-=Z,B=A=t.hash_size;c=t.head[--B],t.head[B]=Z<=c?c-Z:0,--A;);for(B=A=Z;c=t.prev[--B],t.prev[B]=Z<=c?c-Z:0,--A;);l+=Z}if(t.strm.avail_in===0)break;if(P=t.strm,U=t.window,C=t.strstart+t.lookahead,W=l,$=void 0,$=P.avail_in,W<$&&($=W),A=$===0?0:(P.avail_in-=$,a.arraySet(U,P.input,P.next_in,$,C),P.state.wrap===1?P.adler=h(P.adler,U,$,C):P.state.wrap===2&&(P.adler=b(P.adler,U,$,C)),P.next_in+=$,P.total_in+=$,$),t.lookahead+=A,t.lookahead+t.insert>=I)for(k=t.strstart-t.insert,t.ins_h=t.window[k],t.ins_h=(t.ins_h<=I&&(t.ins_h=(t.ins_h<=I)if(c=r._tr_tally(t,t.strstart-t.match_start,t.match_length-I),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=I){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<=I&&(t.ins_h=(t.ins_h<=I&&t.match_length<=t.prev_length){for(l=t.strstart+t.lookahead-I,c=r._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-I),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=l&&(t.ins_h=(t.ins_h<t.pending_buf_size-5&&(A=t.pending_buf_size-5);;){if(t.lookahead<=1){if(it(t),t.lookahead===0&&B===m)return e;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var c=t.block_start+A;if((t.strstart===0||t.strstart>=c)&&(t.lookahead=t.strstart-c,t.strstart=c,z(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-X&&(z(t,!1),t.strm.avail_out===0))return e}return t.insert=0,B===v?(z(t,!0),t.strm.avail_out===0?q:L):(t.strstart>t.block_start&&(z(t,!1),t.strm.avail_out),e)}),new rt(4,4,8,4,lt),new rt(4,5,16,8,lt),new rt(4,6,32,32,lt),new rt(4,4,16,16,tt),new rt(8,16,32,32,tt),new rt(8,16,128,128,tt),new rt(8,32,128,256,tt),new rt(32,128,258,1024,tt),new rt(32,258,258,4096,tt)],p.deflateInit=function(t,B){return ut(t,B,d,15,8,0)},p.deflateInit2=ut,p.deflateReset=ct,p.deflateResetKeep=st,p.deflateSetHeader=function(t,B){return t&&t.state?t.state.wrap!==2?f:(t.state.gzhead=B,i):f},p.deflate=function(t,B){var A,c,l,k;if(!t||!t.state||5>8&255),Y(c,c.gzhead.time>>16&255),Y(c,c.gzhead.time>>24&255),Y(c,c.level===9?2:2<=c.strategy||c.level<2?4:0),Y(c,255&c.gzhead.os),c.gzhead.extra&&c.gzhead.extra.length&&(Y(c,255&c.gzhead.extra.length),Y(c,c.gzhead.extra.length>>8&255)),c.gzhead.hcrc&&(t.adler=b(t.adler,c.pending_buf,c.pending,0)),c.gzindex=0,c.status=69):(Y(c,0),Y(c,0),Y(c,0),Y(c,0),Y(c,0),Y(c,c.level===9?2:2<=c.strategy||c.level<2?4:0),Y(c,3),c.status=F);else{var P=d+(c.w_bits-8<<4)<<8;P|=(2<=c.strategy||c.level<2?0:c.level<6?1:c.level===6?2:3)<<6,c.strstart!==0&&(P|=32),P+=31-P%31,c.status=F,G(c,P),c.strstart!==0&&(G(c,t.adler>>>16),G(c,65535&t.adler)),t.adler=1}if(c.status===69)if(c.gzhead.extra){for(l=c.pending;c.gzindex<(65535&c.gzhead.extra.length)&&(c.pending!==c.pending_buf_size||(c.gzhead.hcrc&&c.pending>l&&(t.adler=b(t.adler,c.pending_buf,c.pending-l,l)),E(t),l=c.pending,c.pending!==c.pending_buf_size));)Y(c,255&c.gzhead.extra[c.gzindex]),c.gzindex++;c.gzhead.hcrc&&c.pending>l&&(t.adler=b(t.adler,c.pending_buf,c.pending-l,l)),c.gzindex===c.gzhead.extra.length&&(c.gzindex=0,c.status=73)}else c.status=73;if(c.status===73)if(c.gzhead.name){l=c.pending;do{if(c.pending===c.pending_buf_size&&(c.gzhead.hcrc&&c.pending>l&&(t.adler=b(t.adler,c.pending_buf,c.pending-l,l)),E(t),l=c.pending,c.pending===c.pending_buf_size)){k=1;break}k=c.gzindexl&&(t.adler=b(t.adler,c.pending_buf,c.pending-l,l)),k===0&&(c.gzindex=0,c.status=91)}else c.status=91;if(c.status===91)if(c.gzhead.comment){l=c.pending;do{if(c.pending===c.pending_buf_size&&(c.gzhead.hcrc&&c.pending>l&&(t.adler=b(t.adler,c.pending_buf,c.pending-l,l)),E(t),l=c.pending,c.pending===c.pending_buf_size)){k=1;break}k=c.gzindexl&&(t.adler=b(t.adler,c.pending_buf,c.pending-l,l)),k===0&&(c.status=103)}else c.status=103;if(c.status===103&&(c.gzhead.hcrc?(c.pending+2>c.pending_buf_size&&E(t),c.pending+2<=c.pending_buf_size&&(Y(c,255&t.adler),Y(c,t.adler>>8&255),t.adler=0,c.status=F)):c.status=F),c.pending!==0){if(E(t),t.avail_out===0)return c.last_flush=-1,i}else if(t.avail_in===0&&j(B)<=j(A)&&B!==v)return Q(t,-5);if(c.status===666&&t.avail_in!==0)return Q(t,-5);if(t.avail_in!==0||c.lookahead!==0||B!==m&&c.status!==666){var U=c.strategy===2?function(C,W){for(var $;;){if(C.lookahead===0&&(it(C),C.lookahead===0)){if(W===m)return e;break}if(C.match_length=0,$=r._tr_tally(C,0,C.window[C.strstart]),C.lookahead--,C.strstart++,$&&(z(C,!1),C.strm.avail_out===0))return e}return C.insert=0,W===v?(z(C,!0),C.strm.avail_out===0?q:L):C.last_lit&&(z(C,!1),C.strm.avail_out===0)?e:D}(c,B):c.strategy===3?function(C,W){for(var $,Z,K,nt,et=C.window;;){if(C.lookahead<=M){if(it(C),C.lookahead<=M&&W===m)return e;if(C.lookahead===0)break}if(C.match_length=0,C.lookahead>=I&&0C.lookahead&&(C.match_length=C.lookahead)}if(C.match_length>=I?($=r._tr_tally(C,1,C.match_length-I),C.lookahead-=C.match_length,C.strstart+=C.match_length,C.match_length=0):($=r._tr_tally(C,0,C.window[C.strstart]),C.lookahead--,C.strstart++),$&&(z(C,!1),C.strm.avail_out===0))return e}return C.insert=0,W===v?(z(C,!0),C.strm.avail_out===0?q:L):C.last_lit&&(z(C,!1),C.strm.avail_out===0)?e:D}(c,B):s[c.level].func(c,B);if(U!==q&&U!==L||(c.status=666),U===e||U===q)return t.avail_out===0&&(c.last_flush=-1),i;if(U===D&&(B===1?r._tr_align(c):B!==5&&(r._tr_stored_block(c,0,0,!1),B===3&&(V(c.head),c.lookahead===0&&(c.strstart=0,c.block_start=0,c.insert=0))),E(t),t.avail_out===0))return c.last_flush=-1,i}return B!==v?i:c.wrap<=0?1:(c.wrap===2?(Y(c,255&t.adler),Y(c,t.adler>>8&255),Y(c,t.adler>>16&255),Y(c,t.adler>>24&255),Y(c,255&t.total_in),Y(c,t.total_in>>8&255),Y(c,t.total_in>>16&255),Y(c,t.total_in>>24&255)):(G(c,t.adler>>>16),G(c,65535&t.adler)),E(t),0=A.w_size&&(k===0&&(V(A.head),A.strstart=0,A.block_start=0,A.insert=0),W=new a.Buf8(A.w_size),a.arraySet(W,B,$-A.w_size,A.w_size,0),B=W,$=A.w_size),P=t.avail_in,U=t.next_in,C=t.input,t.avail_in=$,t.next_in=0,t.input=B,it(A);A.lookahead>=I;){for(c=A.strstart,l=A.lookahead-(I-1);A.ins_h=(A.ins_h<>>=I=N>>>24,w-=I,(I=N>>>16&255)===0)D[y++]=65535&N;else{if(!(16&I)){if(!(64&I)){N=S[(65535&N)+(d&(1<>>=I,w-=I),w<15&&(d+=e[h++]<>>=I=N>>>24,w-=I,!(16&(I=N>>>16&255))){if(!(64&I)){N=x[(65535&N)+(d&(1<>>=I,w-=I,(I=y-m)>3,d&=(1<<(w-=M<<3))-1,s.next_in=h,s.next_out=y,s.avail_in=h>>24&255)+(g>>>8&65280)+((65280&g)<<8)+((255&g)<<24)}function d(){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 s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(g){var F;return g&&g.state?(F=g.state,g.total_in=g.total_out=F.total=0,g.msg="",F.wrap&&(g.adler=1&F.wrap),F.mode=f,F.last=0,F.havedict=0,F.dmax=32768,F.head=null,F.hold=0,F.bits=0,F.lencode=F.lendyn=new s.Buf32(n),F.distcode=F.distdyn=new s.Buf32(u),F.sane=1,F.back=-1,v):i}function S(g){var F;return g&&g.state?((F=g.state).wsize=0,F.whave=0,F.wnext=0,w(g)):i}function x(g,F){var e,D;return g&&g.state?(D=g.state,F<0?(e=0,F=-F):(e=1+(F>>4),F<48&&(F&=15)),F&&(F<8||15=L.wsize?(s.arraySet(L.window,F,e-L.wsize,L.wsize,0),L.wnext=0,L.whave=L.wsize):(D<(q=L.wsize-L.wnext)&&(q=D),s.arraySet(L.window,F,e-D,q,L.wnext),(D-=q)?(s.arraySet(L.window,F,e-D,D,0),L.wnext=D,L.whave=L.wsize):(L.wnext+=q,L.wnext===L.wsize&&(L.wnext=0),L.whave>>8&255,e.check=r(e.check,k,2,0),z=E=0,e.mode=2;break}if(e.flags=0,e.head&&(e.head.done=!1),!(1&e.wrap)||(((255&E)<<8)+(E>>8))%31){g.msg="incorrect header check",e.mode=30;break}if((15&E)!=8){g.msg="unknown compression method",e.mode=30;break}if(z-=4,t=8+(15&(E>>>=4)),e.wbits===0)e.wbits=t;else if(t>e.wbits){g.msg="invalid window size",e.mode=30;break}e.dmax=1<>8&1),512&e.flags&&(k[0]=255&E,k[1]=E>>>8&255,e.check=r(e.check,k,2,0)),z=E=0,e.mode=3;case 3:for(;z<32;){if(j===0)break t;j--,E+=D[L++]<>>8&255,k[2]=E>>>16&255,k[3]=E>>>24&255,e.check=r(e.check,k,4,0)),z=E=0,e.mode=4;case 4:for(;z<16;){if(j===0)break t;j--,E+=D[L++]<>8),512&e.flags&&(k[0]=255&E,k[1]=E>>>8&255,e.check=r(e.check,k,2,0)),z=E=0,e.mode=5;case 5:if(1024&e.flags){for(;z<16;){if(j===0)break t;j--,E+=D[L++]<>>8&255,e.check=r(e.check,k,2,0)),z=E=0}else e.head&&(e.head.extra=null);e.mode=6;case 6:if(1024&e.flags&&(j<(H=e.length)&&(H=j),H&&(e.head&&(t=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Array(e.head.extra_len)),s.arraySet(e.head.extra,D,L,H,t)),512&e.flags&&(e.check=r(e.check,D,H,L)),j-=H,L+=H,e.length-=H),e.length))break t;e.length=0,e.mode=7;case 7:if(2048&e.flags){if(j===0)break t;for(H=0;t=D[L+H++],e.head&&t&&e.length<65536&&(e.head.name+=String.fromCharCode(t)),t&&H>9&1,e.head.done=!0),g.adler=e.check=0,e.mode=12;break;case 10:for(;z<32;){if(j===0)break t;j--,E+=D[L++]<>>=7&z,z-=7&z,e.mode=27;break}for(;z<3;){if(j===0)break t;j--,E+=D[L++]<>>=1)){case 0:e.mode=14;break;case 1:if(M(e),e.mode=20,F!==6)break;E>>>=2,z-=2;break t;case 2:e.mode=17;break;case 3:g.msg="invalid block type",e.mode=30}E>>>=2,z-=2;break;case 14:for(E>>>=7&z,z-=7&z;z<32;){if(j===0)break t;j--,E+=D[L++]<>>16^65535)){g.msg="invalid stored block lengths",e.mode=30;break}if(e.length=65535&E,z=E=0,e.mode=15,F===6)break t;case 15:e.mode=16;case 16:if(H=e.length){if(j>>=5,z-=5,e.ndist=1+(31&E),E>>>=5,z-=5,e.ncode=4+(15&E),E>>>=4,z-=4,286>>=3,z-=3}for(;e.have<19;)e.lens[P[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,A={bits:e.lenbits},B=b(0,e.lens,0,19,e.lencode,0,e.work,A),e.lenbits=A.bits,B){g.msg="invalid code lengths set",e.mode=30;break}e.have=0,e.mode=19;case 19:for(;e.have>>16&255,ot=65535&l,!((tt=l>>>24)<=z);){if(j===0)break t;j--,E+=D[L++]<>>=tt,z-=tt,e.lens[e.have++]=ot;else{if(ot===16){for(c=tt+2;z>>=tt,z-=tt,e.have===0){g.msg="invalid bit length repeat",e.mode=30;break}t=e.lens[e.have-1],H=3+(3&E),E>>>=2,z-=2}else if(ot===17){for(c=tt+3;z>>=tt)),E>>>=3,z-=3}else{for(c=tt+7;z>>=tt)),E>>>=7,z-=7}if(e.have+H>e.nlen+e.ndist){g.msg="invalid bit length repeat",e.mode=30;break}for(;H--;)e.lens[e.have++]=t}}if(e.mode===30)break;if(e.lens[256]===0){g.msg="invalid code -- missing end-of-block",e.mode=30;break}if(e.lenbits=9,A={bits:e.lenbits},B=b(y,e.lens,0,e.nlen,e.lencode,0,e.work,A),e.lenbits=A.bits,B){g.msg="invalid literal/lengths set",e.mode=30;break}if(e.distbits=6,e.distcode=e.distdyn,A={bits:e.distbits},B=b(m,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,A),e.distbits=A.bits,B){g.msg="invalid distances set",e.mode=30;break}if(e.mode=20,F===6)break t;case 20:e.mode=21;case 21:if(6<=j&&258<=V){g.next_out=Q,g.avail_out=V,g.next_in=L,g.avail_in=j,e.hold=E,e.bits=z,h(g,G),Q=g.next_out,q=g.output,V=g.avail_out,L=g.next_in,D=g.input,j=g.avail_in,E=e.hold,z=e.bits,e.mode===12&&(e.back=-1);break}for(e.back=0;rt=(l=e.lencode[E&(1<>>16&255,ot=65535&l,!((tt=l>>>24)<=z);){if(j===0)break t;j--,E+=D[L++]<>st)])>>>16&255,ot=65535&l,!(st+(tt=l>>>24)<=z);){if(j===0)break t;j--,E+=D[L++]<>>=st,z-=st,e.back+=st}if(E>>>=tt,z-=tt,e.back+=tt,e.length=ot,rt===0){e.mode=26;break}if(32&rt){e.back=-1,e.mode=12;break}if(64&rt){g.msg="invalid literal/length code",e.mode=30;break}e.extra=15&rt,e.mode=22;case 22:if(e.extra){for(c=e.extra;z>>=e.extra,z-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=23;case 23:for(;rt=(l=e.distcode[E&(1<>>16&255,ot=65535&l,!((tt=l>>>24)<=z);){if(j===0)break t;j--,E+=D[L++]<>st)])>>>16&255,ot=65535&l,!(st+(tt=l>>>24)<=z);){if(j===0)break t;j--,E+=D[L++]<>>=st,z-=st,e.back+=st}if(E>>>=tt,z-=tt,e.back+=tt,64&rt){g.msg="invalid distance code",e.mode=30;break}e.offset=ot,e.extra=15&rt,e.mode=24;case 24:if(e.extra){for(c=e.extra;z>>=e.extra,z-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){g.msg="invalid distance too far back",e.mode=30;break}e.mode=25;case 25:if(V===0)break t;if(H=G-V,e.offset>H){if((H=e.offset-H)>e.whave&&e.sane){g.msg="invalid distance too far back",e.mode=30;break}it=H>e.wnext?(H-=e.wnext,e.wsize-H):e.wnext-H,H>e.length&&(H=e.length),lt=e.window}else lt=q,it=Q-e.offset,H=e.length;for(VO?(I=it[lt+u[F]],z[Y+u[F]]):(I=96,0),d=1<>Q)+(w-=d)]=N<<24|I<<16|M|0,w!==0;);for(d=1<>=1;if(d!==0?(E&=d-1,E+=d):E=0,F++,--G[g]==0){if(g===D)break;g=m[v+u[F]]}if(q>>7)]}function Y(l,k){l.pending_buf[l.pending++]=255&k,l.pending_buf[l.pending++]=k>>>8&255}function G(l,k,P){l.bi_valid>o-P?(l.bi_buf|=k<>o-l.bi_valid,l.bi_valid+=P-o):(l.bi_buf|=k<>>=1,P<<=1,0<--k;);return P>>>1}function lt(l,k,P){var U,C,W=new Array(u+1),$=0;for(U=1;U<=u;U++)W[U]=$=$+P[U-1]<<1;for(C=0;C<=k;C++){var Z=l[2*C+1];Z!==0&&(l[2*C]=it(W[Z]++,Z))}}function tt(l){var k;for(k=0;k>1;1<=P;P--)st(l,W,P);for(C=K;P=l.heap[1],l.heap[1]=l.heap[l.heap_len--],st(l,W,1),U=l.heap[1],l.heap[--l.heap_max]=P,l.heap[--l.heap_max]=U,W[2*C]=W[2*P]+W[2*U],l.depth[C]=(l.depth[P]>=l.depth[U]?l.depth[P]:l.depth[U])+1,W[2*P+1]=W[2*U+1]=C,l.heap[1]=C++,st(l,W,1),2<=l.heap_len;);l.heap[--l.heap_max]=l.heap[1],function(et,ht){var pt,dt,mt,at,gt,yt,ft=ht.dyn_tree,zt=ht.max_code,Bt=ht.stat_desc.static_tree,Rt=ht.stat_desc.has_stree,Dt=ht.stat_desc.extra_bits,Et=ht.stat_desc.extra_base,_t=ht.stat_desc.max_length,bt=0;for(at=0;at<=u;at++)et.bl_count[at]=0;for(ft[2*et.heap[et.heap_max]+1]=0,pt=et.heap_max+1;pt>=7;C>>=1)if(1&nt&&Z.dyn_ltree[2*K]!==0)return a;if(Z.dyn_ltree[18]!==0||Z.dyn_ltree[20]!==0||Z.dyn_ltree[26]!==0)return r;for(K=32;K>>3,(W=l.static_len+3+7>>>3)<=C&&(C=W)):C=W=P+5,P+4<=C&&k!==-1?c(l,k,P,U):l.strategy===4||W===C?(G(l,2+(U?1:0),3),ct(l,X,g)):(G(l,4+(U?1:0),3),function(Z,K,nt,et){var ht;for(G(Z,K-257,5),G(Z,nt-1,5),G(Z,et-4,4),ht=0;ht>>8&255,l.pending_buf[l.d_buf+2*l.last_lit+1]=255&k,l.pending_buf[l.l_buf+l.last_lit]=255&P,l.last_lit++,k===0?l.dyn_ltree[2*P]++:(l.matches++,k--,l.dyn_ltree[2*(e[P]+m+1)]++,l.dyn_dtree[2*z(k)]++),l.last_lit===l.lit_bufsize-1},p._tr_align=function(l){G(l,2,3),H(l,w,X),function(k){k.bi_valid===16?(Y(k,k.bi_buf),k.bi_buf=0,k.bi_valid=0):8<=k.bi_valid&&(k.pending_buf[k.pending++]=255&k.bi_buf,k.bi_buf>>=8,k.bi_valid-=8)}(l)}},{"../utils/common":41}],53:[function(_,T,p){"use strict";T.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(_,T,p){(function(s){(function(a,r){"use strict";if(!a.setImmediate){var h,b,y,m,v=1,i={},f=!1,n=a.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(a);u=u&&u.setTimeout?u:a,h={}.toString.call(a.process)==="[object process]"?function(S){process.nextTick(function(){d(S)})}:function(){if(a.postMessage&&!a.importScripts){var S=!0,x=a.onmessage;return a.onmessage=function(){S=!1},a.postMessage("","*"),a.onmessage=x,S}}()?(m="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",w,!1):a.attachEvent("onmessage",w),function(S){a.postMessage(m+S,"*")}):a.MessageChannel?((y=new MessageChannel).port1.onmessage=function(S){d(S.data)},function(S){y.port2.postMessage(S)}):n&&"onreadystatechange"in n.createElement("script")?(b=n.documentElement,function(S){var x=n.createElement("script");x.onreadystatechange=function(){d(S),x.onreadystatechange=null,b.removeChild(x),x=null},b.appendChild(x)}):function(S){setTimeout(d,0,S)},u.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var x=new Array(arguments.length-1),R=0;Rwt});module.exports=Ht($t);var J=require("obsidian"),Ft=Mt(Ot()),Gt={targetFolder:"Course Modules"};function Tt(_){return _ instanceof J.TFolder}var xt=class extends J.Modal{constructor(p,s){super(p);this.result="";this.onSubmit=s}onOpen(){let{contentEl:p}=this;p.empty(),p.createEl("h2",{text:"Enter Course Module URL"}),new J.Setting(p).setName("URL").addText(s=>s.onChange(a=>{this.result=a.trim()}).inputEl.focus()),new J.Setting(p).addButton(s=>s.setButtonText("Download and Unzip").setCta().onClick(()=>{this.result?(this.close(),this.onSubmit(this.result)):new J.Notice("Please enter a URL.")})),p.addEventListener("keypress",s=>{s.key==="Enter"&&(s.preventDefault(),this.result?(this.close(),this.onSubmit(this.result)):new J.Notice("Please enter a URL."))})}onClose(){let{contentEl:p}=this;p.empty()}},St=class extends J.FuzzySuggestModal{constructor(p,s,a,r){super(p);this.plugin=s,this.settingDisplayElement=a,this.preFetchedFolders=r,this.setPlaceholder("Search for a folder...")}getItems(){if(this.preFetchedFolders)return this.preFetchedFolders;console.warn("FolderSuggestModal: Pre-fetched list not available, fetching manually.");let p=this.app.vault.getAllLoadedFiles().filter(Tt),s=this.app.vault.getRoot();return p.some(a=>a.path==="/")||p.unshift(s),p}getItemText(p){return p.path==="/"?"/ (Vault Root)":p.path}onChooseItem(p,s){let a=p.path;this.plugin.settings.targetFolder=a,this.plugin.saveSettings(),new J.Notice(`Target folder set to: ${a}`),this.settingDisplayElement.value=a}renderSuggestion(p,s){if(super.renderSuggestion(p,s),p.item.path==="/"){let a=s.querySelector(".suggestion-content");a?a.textContent="/ (Vault Root)":s.setText("/ (Vault Root)")}}},Ct=class extends J.PluginSettingTab{constructor(p,s){super(p,s);this.plugin=s}display(){let{containerEl:p}=this;p.empty(),p.createEl("h2",{text:"Course Material Downloader Settings"});let s=new J.Setting(p).setName("Target Folder").setDesc("The folder where downloaded modules will be unzipped.");s.addText(a=>{a.setValue(this.plugin.settings.targetFolder).setDisabled(!0),a.inputEl.addClass("course-material-downloader-wide-input");let r=a.inputEl;s.addButton(h=>{h.setButtonText("Change Folder").onClick(()=>{let b=this.app.vault.getAllLoadedFiles().filter(Tt),y=this.app.vault.getRoot();b.some(m=>m.path==="/")||b.unshift(y),new St(this.app,this.plugin,r,b).open()})})}),p.createEl("p",{text:"Note: If the desired folder doesn't exist, it will be created during the download process (if possible)."})}},wt=class extends J.Plugin{async onload(){await this.loadSettings(),this.addCommand({id:"download-course-module",name:"Download and Unzip Course Module",callback:()=>{this.showUrlInputModal()}}),this.addSettingTab(new Ct(this.app,this))}onunload(){}async loadSettings(){this.settings=Object.assign({},Gt,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}async ensureFolderExists(p){if(p==="/"||p==="")return this.app.vault.getRoot();let s=p.replace(/^\/|\/$/g,"");if(s==="")return this.app.vault.getRoot();try{let a=this.app.vault.getAbstractFileByPath(s);if(a instanceof J.TFolder)return a;if(a instanceof J.TFile)return console.error(`Cannot create folder '${s}', a file with this name already exists.`),new J.Notice(`Cannot create folder '${s}', a file exists there.`),null;try{let r=await this.app.vault.createFolder(s);return new J.Notice(`Created folder: ${s}`),r}catch(r){console.error(`Error creating folder '${s}':`,r);let h=this.app.vault.getAbstractFileByPath(s);return h instanceof J.TFolder?h:(new J.Notice(`Error creating folder '${s}'. Check console.`),null)}}catch(a){return console.error(`Unexpected error ensuring folder exists '${s}':`,a),new J.Notice(`Unexpected error checking folder '${s}'. Check console.`),null}}showUrlInputModal(){new xt(this.app,p=>{this.downloadAndUnzip(p)}).open()}async downloadAndUnzip(p){var b,y;if(!p.startsWith("http://")&&!p.startsWith("https://")){new J.Notice("Invalid URL received. Must start with http:// or https://");return}p=p.replace("www.dropbox.com","dl.dropboxusercontent.com"),p.includes("dropbox.com")&&!p.includes("dl=1")&&(p=p.includes("?")?`${p}&dl=1`:`${p}?dl=1`);let s=this.settings.targetFolder,a=await this.ensureFolderExists(s);if(!a){new J.Notice(`Target folder "${s}" could not be found or created. Aborting.`);return}let r=a.path==="/"?"":a.path,h;try{new J.Notice("Downloading module..."),h=(await(0,J.requestUrl)({url:p})).arrayBuffer,new J.Notice("Download complete. Unzipping...")}catch(m){console.error("Download Error:",m),new J.Notice(`Failed to download file: ${m.message}. Check console (Ctrl+Shift+I or Cmd+Opt+I).`);return}try{let m=await Ft.default.loadAsync(h),v=0,i=new Set;for(let f in m.files){let n=f.split("/").pop();if(f.startsWith("__MACOSX/")||n===".DS_Store"||!f)continue;let u=m.files[f],d=(r?`${r}/${f}`:f).replace(/\\/g,"/").replace(/\/+/g,"/");if(u.dir){let w=d.endsWith("/")?d.slice(0,-1):d;w&&!i.has(w)&&(await this.ensureFolderExists(w)?i.add(w):console.warn(`Could not ensure directory exists: ${w}. Skipping contents.`))}else{let w=await u.async("arraybuffer"),S=d.lastIndexOf("/"),x=S>0?d.substring(0,S):S===0?"/":"";if(x&&x!==r&&!i.has(x))if(await this.ensureFolderExists(x))i.add(x);else{console.warn(`Could not ensure parent directory exists: ${x}. Skipping file: ${d}`);continue}let R=d.startsWith("/")?d.substring(1):d;if(R===""&&d==="/"){console.warn("Attempting to check root path '/' for a file. Skipping.");continue}let O=R?this.app.vault.getAbstractFileByPath(R):null;if(O instanceof J.TFile)continue;if(O instanceof J.TFolder){console.error(`Skipping file write: A folder exists at path ${d}`),new J.Notice(`Skipping file write: Folder exists at ${d}`);continue}else try{await this.app.vault.createBinary(d,w,{mtime:Date.now()}),v++}catch(N){(b=N.message)!=null&&b.toLowerCase().includes("file already exists")?console.warn(`Caught 'File already exists' on createBinary for ${d}. Skipping.`):(console.error(`Error creating file '${d}':`,N),new J.Notice(`Error creating file '${d}'. Check console.`))}}}new J.Notice(`Successfully extracted ${v} new file(s) to '${a.path}'.`)}catch(m){console.error("Unzip/Write Error:",m),(y=m.message)!=null&&y.toLowerCase().includes("file already exists")?(console.warn("Caught 'File already exists' error during unzip/write phase, possibly handled. Check logic if files were missed."),new J.Notice("An unexpected 'File already exists' error occurred during processing. Some files might not have been processed correctly. Check console.")):new J.Notice(`Failed to unzip or write files: ${m.message}. Check console.`)}}}; /*! Bundled license information: jszip/dist/jszip.min.js: diff --git a/main.ts b/main.ts index 206b475..21b880c 100644 --- a/main.ts +++ b/main.ts @@ -12,7 +12,7 @@ import { FuzzySuggestModal, FuzzyMatch } from 'obsidian'; -import JSZip from 'jszip'; +import JSZip from 'jszip'; // Keep this import as is with allowSyntheticDefaultImports: true // Settings Interface interface CourseMaterialPluginSettings { @@ -24,6 +24,14 @@ const DEFAULT_SETTINGS: CourseMaterialPluginSettings = { targetFolder: 'Course Modules' // Default folder name } +// --- Type Guard Function --- +// This function explicitly checks if a file is a TFolder and tells TypeScript +function isTFolder(file: TAbstractFile): file is TFolder { + return file instanceof TFolder; +} +// --- End Type Guard --- + + // ---------------------------------------- // URL Input Modal Class // ---------------------------------------- @@ -87,7 +95,7 @@ class UrlInputModal extends Modal { // ---------------------------------------- -// Folder Suggest Modal Class (Cleaned up logs) +// Folder Suggest Modal Class (Using Type Guard) // ---------------------------------------- class FolderSuggestModal extends FuzzySuggestModal { plugin: CourseMaterialPlugin; @@ -100,7 +108,6 @@ class FolderSuggestModal extends FuzzySuggestModal { this.settingDisplayElement = settingDisplayElement; this.preFetchedFolders = folders; // Store the passed list this.setPlaceholder("Search for a folder..."); - } getItems(): TFolder[] { @@ -109,27 +116,28 @@ class FolderSuggestModal extends FuzzySuggestModal { return this.preFetchedFolders; } - // Fallback: Fetch if list wasn't provided (shouldn't happen with new settings tab logic) - console.warn("FolderSuggestModal: Pre-fetched list not available, fetching manually."); // Keep warning + // Fallback: Fetch if list wasn't provided + console.warn("FolderSuggestModal: Pre-fetched list not available, fetching manually."); + // --- USE TYPE GUARD & REMOVE CAST --- const folders = this.app.vault.getAllLoadedFiles() - .filter(file => file instanceof TFolder) as TFolder[]; + .filter(isTFolder); // Use the type guard function const root = this.app.vault.getRoot(); if (!folders.some(f => f.path === '/')) { folders.unshift(root); } + // TypeScript should now correctly infer the type as TFolder[] return folders; } getItemText(folder: TFolder): string { - return folder.path === '/' ? '/ (Vault Root)' : folder.path; // Display the full path, special label for root + return folder.path === '/' ? '/ (Vault Root)' : folder.path; } onChooseItem(folder: TFolder, evt: MouseEvent | KeyboardEvent): void { - const selectedPath = folder.path; // Path is '/' for root + const selectedPath = folder.path; this.plugin.settings.targetFolder = selectedPath; this.plugin.saveSettings(); new Notice(`Target folder set to: ${selectedPath}`); - this.settingDisplayElement.value = selectedPath; } @@ -145,7 +153,7 @@ class FolderSuggestModal extends FuzzySuggestModal { // ---------------------------------------- -// Settings Tab Class (Using CSS class for styling) +// Settings Tab Class (Using Type Guard) // ---------------------------------------- class CourseMaterialSettingTab extends PluginSettingTab { plugin: CourseMaterialPlugin; @@ -165,26 +173,22 @@ class CourseMaterialSettingTab extends PluginSettingTab { .setName('Target Folder') .setDesc('The folder where downloaded modules will be unzipped.'); - // Add a non-editable text element to display the current setting setting.addText(text => { text.setValue(this.plugin.settings.targetFolder).setDisabled(true); - text.inputEl.addClass('course-material-downloader-wide-input'); const displayElement = text.inputEl; - // Add the button to the same setting control container setting.addButton(button => { button.setButtonText('Change Folder') .onClick(() => { - - const currentFolders = (this.app.vault.getAllLoadedFiles() - .filter(file => file instanceof TFolder) as TFolder[]); + // --- USE TYPE GUARD & REMOVE CAST --- + const currentFolders = this.app.vault.getAllLoadedFiles() + .filter(isTFolder); // Use the type guard function const root = this.app.vault.getRoot(); if (!currentFolders.some(f => f.path === '/')) { currentFolders.unshift(root); } - - + // TypeScript should now correctly infer the type as TFolder[] new FolderSuggestModal(this.app, this.plugin, displayElement, currentFolders).open(); }); }); @@ -202,7 +206,6 @@ export default class CourseMaterialPlugin extends Plugin { settings: CourseMaterialPluginSettings; async onload() { - await this.loadSettings(); this.addCommand({ @@ -217,7 +220,7 @@ export default class CourseMaterialPlugin extends Plugin { } onunload() { - + // Cleanup logic if needed } async loadSettings() { @@ -242,22 +245,18 @@ export default class CourseMaterialPlugin extends Plugin { if (existingItem instanceof TFolder) { return existingItem; } else if (existingItem instanceof TFile) { - console.error(`Cannot create folder '${normalizedPath}', a file with this name already exists.`); new Notice(`Cannot create folder '${normalizedPath}', a file exists there.`); return null; } else { - try { const newFolder = await this.app.vault.createFolder(normalizedPath); new Notice(`Created folder: ${normalizedPath}`); return newFolder; } catch (creationError) { - console.error(`Error creating folder '${normalizedPath}':`, creationError); const checkAgain = this.app.vault.getAbstractFileByPath(normalizedPath); if (checkAgain instanceof TFolder) { - return checkAgain; } new Notice(`Error creating folder '${normalizedPath}'. Check console.`); @@ -265,7 +264,6 @@ export default class CourseMaterialPlugin extends Plugin { } } } catch (error) { - console.error(`Unexpected error ensuring folder exists '${normalizedPath}':`, error); new Notice(`Unexpected error checking folder '${normalizedPath}'. Check console.`); return null; @@ -307,13 +305,10 @@ export default class CourseMaterialPlugin extends Plugin { let zipData: ArrayBuffer; try { new Notice('Downloading module...'); - const response = await requestUrl({ url: url }); zipData = response.arrayBuffer; new Notice('Download complete. Unzipping...'); - } catch (error) { - console.error('Download Error:', error); new Notice(`Failed to download file: ${error.message}. Check console (Ctrl+Shift+I or Cmd+Opt+I).`); return; @@ -341,7 +336,6 @@ export default class CourseMaterialPlugin extends Plugin { if (dirPath && !folderPathsCreated.has(dirPath)) { const folderExists = await this.ensureFolderExists(dirPath); if (!folderExists) { - console.warn(`Could not ensure directory exists: ${dirPath}. Skipping contents.`); } else { folderPathsCreated.add(dirPath); @@ -358,7 +352,6 @@ export default class CourseMaterialPlugin extends Plugin { if (parentPath && parentPath !== cleanTargetFolderPath && !folderPathsCreated.has(parentPath)) { const parentFolderExists = await this.ensureFolderExists(parentPath); if (!parentFolderExists) { - console.warn(`Could not ensure parent directory exists: ${parentPath}. Skipping file: ${normalizedDestPath}`); continue; } else { @@ -368,7 +361,6 @@ export default class CourseMaterialPlugin extends Plugin { const pathToCheck = normalizedDestPath.startsWith('/') ? normalizedDestPath.substring(1) : normalizedDestPath; if (pathToCheck === '' && normalizedDestPath === '/') { - console.warn("Attempting to check root path '/' for a file. Skipping."); continue; } @@ -378,7 +370,6 @@ export default class CourseMaterialPlugin extends Plugin { continue; } else if (existingItem instanceof TFolder) { - console.error(`Skipping file write: A folder exists at path ${normalizedDestPath}`); new Notice(`Skipping file write: Folder exists at ${normalizedDestPath}`); continue; @@ -386,15 +377,12 @@ export default class CourseMaterialPlugin extends Plugin { } else { // File does not exist. Create it. try { - await this.app.vault.createBinary(normalizedDestPath, fileData, { mtime: Date.now() }); fileCount++; } catch (writeError) { if (writeError.message?.toLowerCase().includes("file already exists")) { - console.warn(`Caught 'File already exists' on createBinary for ${normalizedDestPath}. Skipping.`); } else { - console.error(`Error creating file '${normalizedDestPath}':`, writeError); new Notice(`Error creating file '${normalizedDestPath}'. Check console.`); } @@ -404,13 +392,10 @@ export default class CourseMaterialPlugin extends Plugin { } // End of for loop new Notice(`Successfully extracted ${fileCount} new file(s) to '${targetFolder.path}'.`); - } catch (error) { - console.error('Unzip/Write Error:', error); if (error.message?.toLowerCase().includes("file already exists")) { - console.warn("Caught 'File already exists' error during unzip/write phase, possibly handled. Check logic if files were missed."); new Notice("An unexpected 'File already exists' error occurred during processing. Some files might not have been processed correctly. Check console."); } else {