var ve=Object.defineProperty;var pe=(e,r,n)=>r in e?ve(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n;var Y=(e,r,n)=>pe(e,typeof r!="symbol"?r+"":r,n);var Q=class extends Error{constructor(n,t={}){let{cause:o,context:i}=t;super(n,{cause:o});Y(this,"context");this.name=this.constructor.name,this.context=i}};var lr=class extends Q{};var cr=class extends lr{constructor(){super(...arguments);Y(this,"message","An error occured while trying to compress the data")}};var Hr={},me=function(e,r,n,t,o){var i=new Worker(Hr[r]||(Hr[r]=URL.createObjectURL(new Blob([e+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return i.onmessage=function(a){var s=a.data,h=s.$e$;if(h){var f=new Error(h[0]);f.code=h[1],f.stack=h[2],o(f,null)}else o(null,s)},i.postMessage(n,t),i},S=Uint8Array,b=Uint16Array,wr=Int32Array,Er=new S([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,0,0,0]),xr=new S([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,0,0]),zr=new S([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$r=function(e,r){for(var n=new b(31),t=0;t<31;++t)n[t]=r+=1<>1|(g&21845)<<1,K=(K&52428)>>2|(K&13107)<<2,K=(K&61680)>>4|(K&3855)<<4,gr[g]=((K&65280)>>8|(K&255)<<8)>>1;var K,g,or=function(e,r,n){for(var t=e.length,o=0,i=new b(r);o>h]=f}else for(s=new b(t),o=0;o>15-e[o]);return s},X=new S(288);for(g=0;g<144;++g)X[g]=8;var g;for(g=144;g<256;++g)X[g]=9;var g;for(g=256;g<280;++g)X[g]=7;var g;for(g=280;g<288;++g)X[g]=8;var g,fr=new S(32);for(g=0;g<32;++g)fr[g]=5;var g,Qr=or(X,9,0);var Xr=or(fr,5,0);var Rr=function(e){return(e+7)/8|0},Lr=function(e,r,n){return(r==null||r<0)&&(r=0),(n==null||n>e.length)&&(n=e.length),new S(e.subarray(r,n))};var ye=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ar=function(e,r,n){var t=new Error(r||ye[e]);if(t.code=e,Error.captureStackTrace&&Error.captureStackTrace(t,ar),!n)throw t;return t};var J=function(e,r,n){n<<=r&7;var t=r/8|0;e[t]|=n,e[t+1]|=n>>8},tr=function(e,r,n){n<<=r&7;var t=r/8|0;e[t]|=n,e[t+1]|=n>>8,e[t+2]|=n>>16},pr=function(e,r){for(var n=[],t=0;tE&&(E=i[t].s);var l=new b(E+1),x=yr(n[u-1],l,0);if(x>r){var t=0,y=0,w=x-r,z=1<r)y+=z-(1<>=w;y>0;){var T=i[t].s;l[T]=0&&y;--t){var p=i[t].s;l[p]==r&&(--l[p],++y)}x=r}return{t:new S(l),l:x}},yr=function(e,r,n){return e.s==-1?Math.max(yr(e.l,r,n+1),yr(e.r,r,n+1)):r[e.s]=n},Ir=function(e){for(var r=e.length;r&&!e[--r];);for(var n=new b(++r),t=0,o=e[0],i=1,a=function(h){n[t++]=h},s=1;s<=r;++s)if(e[s]==o&&s!=r)++i;else{if(!o&&i>2){for(;i>138;i-=138)a(32754);i>2&&(a(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(a(o),--i;i>6;i-=6)a(8304);i>2&&(a(i-3<<5|8208),i=0)}for(;i--;)a(o);i=1,o=e[s]}return{c:n.subarray(0,t),n:r}},ir=function(e,r){for(var n=0,t=0;t>8,e[o+2]=e[o]^255,e[o+3]=e[o+1]^255;for(var i=0;i4&&!O[zr[R-1]];--R);var q=f+5<<3,U=ir(o,X)+ir(i,fr)+a,L=ir(o,E)+ir(i,y)+a+14+3*R+ir(A,O)+2*A[16]+3*A[17]+7*A[18];if(h>=0&&q<=U&&q<=L)return Mr(r,u,e.subarray(h,h+f));var F,D,W,j;if(J(r,u,1+(L15&&(J(r,u,er[v]>>5&127),u+=er[v]>>12)}}else F=Qr,D=X,W=Xr,j=fr;for(var v=0;v255){var H=M>>18&31;tr(r,u,F[H+257]),u+=D[H+257],H>7&&(J(r,u,M>>23&31),u+=Er[H]);var nr=M&31;tr(r,u,W[nr]),u+=j[nr],nr>3&&(tr(r,u,M>>5&8191),u+=xr[nr])}else tr(r,u,F[M]),u+=D[M]}return tr(r,u,F[256]),u+D[256]},Vr=new wr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Pr=new S(0),re=function(e,r,n,t,o,i){var a=i.z||e.length,s=new S(t+a+5*(1+Math.ceil(a/7e3))+o),h=s.subarray(t,s.length-o),f=i.l,u=(i.r||0)&7;if(r){u&&(h[0]=i.r>>3);for(var m=Vr[r-1],E=m>>13,l=m&8191,x=(1<7e3||O>24576)&&(F>423||!f)){u=Ur(e,h,0,p,d,I,v,O,R,c-R,u),O=A=v=0,R=c;for(var D=0;D<286;++D)d[D]=0;for(var D=0;D<30;++D)I[D]=0}var W=2,j=0,Dr=l,Z=U-L&32767;if(F>2&&q==T(c-Z))for(var ur=Math.min(E,F)-1,er=Math.min(32767,c),H=Math.min(258,F);Z<=er&&--Dr&&U!=L;){if(e[c+W]==e[c+W-Z]){for(var M=0;MW){if(W=M,j=Z,M>ur)break;for(var nr=Math.min(Z,M-2),_r=0,D=0;D_r&&(_r=Br,L=dr)}}}U=L,L=y[U],Z+=U-L&32767}if(j){p[O++]=268435456|mr[W]<<18|Tr[j];var Wr=mr[W]&31,Zr=Tr[j]&31;v+=Er[Wr]+xr[Zr],++d[257+Wr],++I[Zr],N=c+W,++A}else p[O++]=e[c],++d[e[c]]}}for(c=Math.max(c,N);c=a&&(h[u/8|0]=f,Or=a),u=Mr(h,u+1,e.subarray(c,Or))}i.i=a}return Lr(s,0,t+Rr(u)+o)},we=function(){for(var e=new Int32Array(256),r=0;r<256;++r){for(var n=r,t=9;--t;)n=(n&1&&-306674912)^n>>>1;e[r]=n}return e}(),Ee=function(){var e=-1;return{p:function(r){for(var n=e,t=0;t>>8;e=n},d:function(){return~e}}};var ee=function(e,r,n,t,o){if(!o&&(o={l:1},r.dictionary)){var i=r.dictionary.subarray(-32768),a=new S(i.length+e.length);a.set(i),a.set(e,i.length),e=a,o.w=i.length}return re(e,r.level==null?6:r.level,r.mem==null?o.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+r.mem,n,t,o)},br=function(e,r){var n={};for(var t in e)n[t]=e[t];for(var t in r)n[t]=r[t];return n},Jr=function(e,r,n){for(var t=e(),o=e.toString(),i=o.slice(o.indexOf("[")+1,o.lastIndexOf("]")).replace(/\s+/g,"").split(","),a=0;a>>=8};function Oe(e,r,n){return n||(n=r,r={}),typeof n!="function"&&ar(7),de(e,r,[De],function(t){return ne(Fr(t.data[0],t.data[1]))},0,n)}function Fr(e,r){return ee(e,r||{},0,0)}var te=function(e,r,n,t){for(var o in e){var i=e[o],a=r+o,s=t;Array.isArray(i)&&(s=br(t,i[1]),i=i[0]),i instanceof S?n[a]=[i,s]:(n[a+="/"]=[new S(0),s],te(i,a,n,t))}},Gr=typeof TextEncoder<"u"&&new TextEncoder,Se=typeof TextDecoder<"u"&&new TextDecoder,ze=0;try{Se.decode(Pr,{stream:!0}),ze=1}catch{}function Nr(e,r){if(r){for(var n=new S(e.length),t=0;t>1)),a=0,s=function(u){i[a++]=u},t=0;ti.length){var h=new S(a+8+(o-t<<1));h.set(i),i=h}var f=e.charCodeAt(t);f<128||r?s(f):f<2048?(s(192|f>>6),s(128|f&63)):f>55295&&f<57344?(f=65536+(f&1047552)|e.charCodeAt(++t)&1023,s(240|f>>18),s(128|f>>12&63),s(128|f>>6&63),s(128|f&63)):(s(224|f>>12),s(128|f>>6&63),s(128|f&63))}return Lr(i,0,a)}var Cr=function(e){var r=0;if(e)for(var n in e){var t=e[n].length;t>65535&&ar(9),r+=t+4}return r},qr=function(e,r,n,t,o,i,a,s){var h=t.length,f=n.extra,u=s&&s.length,m=Cr(f);C(e,r,a!=null?33639248:67324752),r+=4,a!=null&&(e[r++]=20,e[r++]=n.os),e[r]=20,r+=2,e[r++]=n.flag<<1|(i<0&&8),e[r++]=o&&8,e[r++]=n.compression&255,e[r++]=n.compression>>8;var E=new Date(n.mtime==null?Date.now():n.mtime),l=E.getFullYear()-1980;if((l<0||l>119)&&ar(10),C(e,r,l<<25|E.getMonth()+1<<21|E.getDate()<<16|E.getHours()<<11|E.getMinutes()<<5|E.getSeconds()>>1),r+=4,i!=-1&&(C(e,r,n.crc),C(e,r+4,i<0?-i-2:i),C(e,r+8,n.size)),C(e,r+12,h),C(e,r+14,m),r+=16,a!=null&&(C(e,r,u),C(e,r+6,n.attrs),C(e,r+10,a),r+=14),e.set(t,r),r+=h,m)for(var x in f){var y=f[x],w=y.length;C(e,r,+x),C(e,r+2,w),e.set(y,r+4),r+=4+w}return u&&(e.set(s,r),r+=u),r},Te=function(e,r,n,t,o){C(e,r,101010256),C(e,r+8,n),C(e,r+10,n),C(e,r+12,t),C(e,r+16,o)};function ie(e,r,n){n||(n=r,r={}),typeof n!="function"&&ar(7);var t={};te(e,"",t,r);var o=Object.keys(t),i=o.length,a=0,s=0,h=i,f=new Array(i),u=[],m=function(){for(var w=0;w65535&&U(ar(11,0,1),null),!q)U(null,T);else if(I<16e4)try{U(null,Fr(T,p))}catch(L){U(L,null)}else u.push(Oe(T,p,U))},y=0;y{let t=r.isOk()?{type:"Ok",value:r.value}:{type:"Err",value:r.error},o=n.withStackTrace?new Error().stack:void 0;return{data:t,message:e,stack:o}};function sr(e,r,n,t){function o(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function s(u){try{f(t.next(u))}catch(m){a(m)}}function h(u){try{f(t.throw(u))}catch(m){a(m)}}function f(u){u.done?i(u.value):o(u.value).then(s,h)}f((t=t.apply(e,r||[])).next())})}function oe(e){var r=typeof Symbol=="function"&&Symbol.iterator,n=r&&e[r],t=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function G(e){return this instanceof G?(this.v=e,this):new G(e)}function ae(e,r,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=n.apply(e,r||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(l){return function(x){return Promise.resolve(x).then(l,m)}}function s(l,x){t[l]&&(o[l]=function(y){return new Promise(function(w,z){i.push([l,y,w,z])>1||h(l,y)})},x&&(o[l]=x(o[l])))}function h(l,x){try{f(t[l](x))}catch(y){E(i[0][3],y)}}function f(l){l.value instanceof G?Promise.resolve(l.value.v).then(u,m):E(i[0][2],l)}function u(l){h("next",l)}function m(l){h("throw",l)}function E(l,x){l(x),i.shift(),i.length&&h(i[0][0],i[0][1])}}function Ue(e){var r,n;return r={},t("next"),t("throw",function(o){throw o}),t("return"),r[Symbol.iterator]=function(){return this},r;function t(o,i){r[o]=e[o]?function(a){return(n=!n)?{value:G(e[o](a)),done:!1}:i?i(a):a}:i}}function Ce(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e[Symbol.asyncIterator],n;return r?r.call(e):(e=typeof oe=="function"?oe(e):e[Symbol.iterator](),n={},t("next"),t("throw"),t("return"),n[Symbol.asyncIterator]=function(){return this},n);function t(i){n[i]=e[i]&&function(a){return new Promise(function(s,h){a=e[i](a),o(s,h,a.done,a.value)})}}function o(i,a,s,h){Promise.resolve(h).then(function(f){i({value:f,done:s})},a)}}var k=class e{constructor(r){this._promise=r}static fromSafePromise(r){let n=r.then(t=>new _(t));return new e(n)}static fromPromise(r,n){let t=r.then(o=>new _(o)).catch(o=>new B(n(o)));return new e(t)}static fromThrowable(r,n){return(...t)=>new e(sr(this,void 0,void 0,function*(){try{return new _(yield r(...t))}catch(o){return new B(n?n(o):o)}}))}static combine(r){return Re(r)}static combineWithAllErrors(r){return Le(r)}map(r){return new e(this._promise.then(n=>sr(this,void 0,void 0,function*(){return n.isErr()?new B(n.error):new _(yield r(n.value))})))}andThrough(r){return new e(this._promise.then(n=>sr(this,void 0,void 0,function*(){if(n.isErr())return new B(n.error);let t=yield r(n.value);return t.isErr()?new B(t.error):new _(n.value)})))}andTee(r){return new e(this._promise.then(n=>sr(this,void 0,void 0,function*(){if(n.isErr())return new B(n.error);try{yield r(n.value)}catch{}return new _(n.value)})))}mapErr(r){return new e(this._promise.then(n=>sr(this,void 0,void 0,function*(){return n.isOk()?new _(n.value):new B(yield r(n.error))})))}andThen(r){return new e(this._promise.then(n=>{if(n.isErr())return new B(n.error);let t=r(n.value);return t instanceof e?t._promise:t}))}orElse(r){return new e(this._promise.then(n=>sr(this,void 0,void 0,function*(){return n.isErr()?r(n.error):new _(n.value)})))}match(r,n){return this._promise.then(t=>t.match(r,n))}unwrapOr(r){return this._promise.then(n=>n.unwrapOr(r))}safeUnwrap(){return ae(this,arguments,function*(){return yield G(yield G(yield*Ue(Ce(yield G(this._promise.then(n=>n.safeUnwrap()))))))})}then(r,n){return this._promise.then(r,n)}[Symbol.asyncIterator](){return ae(this,arguments,function*(){let n=yield G(this._promise);return n.isErr()&&(yield yield G(V(n.error))),yield G(n.value)})}},ue=e=>new k(Promise.resolve(new _(e))),V=e=>new k(Promise.resolve(new B(e))),Ge=k.fromPromise,Ne=k.fromSafePromise,qe=k.fromThrowable,fe=e=>{let r=rr([]);for(let n of e)if(n.isErr()){r=$(n.error);break}else r.map(t=>t.push(n.value));return r},Re=e=>k.fromSafePromise(Promise.all(e)).andThen(fe),he=e=>{let r=rr([]);for(let n of e)n.isErr()&&r.isErr()?r.error.push(n.error):n.isErr()&&r.isOk()?r=$([n.error]):n.isOk()&&r.isOk()&&r.value.push(n.value);return r},Le=e=>k.fromSafePromise(Promise.all(e)).andThen(he),kr;(function(e){function r(o,i){return(...a)=>{try{let s=o(...a);return rr(s)}catch(s){return $(i?i(s):s)}}}e.fromThrowable=r;function n(o){return fe(o)}e.combine=n;function t(o){return he(o)}e.combineWithAllErrors=t})(kr||(kr={}));var rr=e=>new _(e);function $(e){return new B(e)}var _=class{constructor(r){this.value=r}isOk(){return!0}isErr(){return!this.isOk()}map(r){return rr(r(this.value))}mapErr(r){return rr(this.value)}andThen(r){return r(this.value)}andThrough(r){return r(this.value).map(n=>this.value)}andTee(r){try{r(this.value)}catch{}return rr(this.value)}orElse(r){return rr(this.value)}asyncAndThen(r){return r(this.value)}asyncAndThrough(r){return r(this.value).map(()=>this.value)}asyncMap(r){return k.fromSafePromise(r(this.value))}unwrapOr(r){return this.value}match(r,n){return r(this.value)}safeUnwrap(){let r=this.value;return function*(){return r}()}_unsafeUnwrap(r){return this.value}_unsafeUnwrapErr(r){throw se("Called `_unsafeUnwrapErr` on an Ok",this,r)}*[Symbol.iterator](){return this.value}},B=class{constructor(r){this.error=r}isOk(){return!1}isErr(){return!this.isOk()}map(r){return $(this.error)}mapErr(r){return $(r(this.error))}andThrough(r){return $(this.error)}andTee(r){return $(this.error)}andThen(r){return $(this.error)}orElse(r){return r(this.error)}asyncAndThen(r){return V(this.error)}asyncAndThrough(r){return V(this.error)}asyncMap(r){return V(this.error)}unwrapOr(r){return r}match(r,n){return n(this.error)}safeUnwrap(){let r=this.error;return function*(){throw yield $(r),new Error("Do not use this generator out of `safeTry`")}()}_unsafeUnwrap(r){throw se("Called `_unsafeUnwrap` on an Err",this,r)}_unsafeUnwrapErr(r){return this.error}*[Symbol.iterator](){let r=this;return yield r,r}},Ke=kr.fromThrowable;var Ar=class extends Q{};var hr=class extends Ar{constructor(){super(...arguments);Y(this,"message","Parameter must be defined")}};var le=e=>{if(e instanceof Error)return e;let r="[Unable to stringify the thrown value]";try{r=JSON.stringify(e)}catch{}return new Error(r)};self.onmessage=e=>{Me(e.data).map(r=>{self.postMessage({event:"ARCHIVE_CREATED",buffer:r.buffer},[r.buffer])}).mapErr(r=>{self.postMessage({event:"OPERATION_FAILED",error:r})})};var Me=e=>{let{archive:r}=e.args;if(r){let n=()=>new Promise((t,o)=>{r.entries?ie(r.entries,(i,a)=>{i&&o(i),t(a)}):o(new hr("archive.entries must be defined"))});return k.fromPromise(n(),t=>t).andThen(t=>ue(t)).orElse(t=>V(new cr(void 0,{cause:le(t)})))}else return V(new hr("archive must be defined"))};