var te=Object.defineProperty;var ie=(e,r,n)=>r in e?te(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n;var k=(e,r,n)=>ie(e,typeof r!="symbol"?r+"":r,n);var _=class extends Error{constructor(n,t={}){let{cause:i,context:o}=t;super(n,{cause:i});k(this,"context");this.name=this.constructor.name,this.context=o}};var er=class extends _{};var nr=class extends er{constructor(){super(...arguments);k(this,"message","An error occured while trying to decompress the data")}};var Tr={},oe=function(e,r,n,t,i){var o=new Worker(Tr[r]||(Tr[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 o.onmessage=function(a){var s=a.data,f=s.$e$;if(f){var c=new Error(f[0]);c.code=f[1],c.stack=f[2],i(c,null)}else i(null,s)},o.postMessage(n,t),o},E=Uint8Array,H=Uint16Array,Rr=Int32Array,pr=new E([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]),mr=new E([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]),Ur=new E([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Lr=function(e,r){for(var n=new H(31),t=0;t<31;++t)n[t]=r+=1<>1|(l&21845)<<1,L=(L&52428)>>2|(L&13107)<<2,L=(L&61680)>>4|(L&3855)<<4,ar[l]=((L&65280)>>8|(L&255)<<8)>>1;var L,l,q=function(e,r,n){for(var t=e.length,i=0,o=new H(r);i>f]=c}else for(s=new H(t),i=0;i>15-e[i]);return s},Q=new E(288);for(l=0;l<144;++l)Q[l]=8;var l;for(l=144;l<256;++l)Q[l]=9;var l;for(l=256;l<280;++l)Q[l]=7;var l;for(l=280;l<288;++l)Q[l]=8;var l,Fr=new E(32);for(l=0;l<32;++l)Fr[l]=5;var l;var kr=q(Q,9,1);var _r=q(Fr,5,1),ir=function(e){for(var r=e[0],n=1;nr&&(r=e[n]);return r},S=function(e,r,n){var t=r/8|0;return(e[t]|e[t+1]<<8)>>(r&7)&n},or=function(e,r){var n=r/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(r&7)},Br=function(e){return(e+7)/8|0},sr=function(e,r,n){return(r==null||r<0)&&(r=0),(n==null||n>e.length)&&(n=e.length),new E(e.subarray(r,n))};var Hr=["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"],w=function(e,r,n){var t=new Error(r||Hr[e]);if(t.code=e,Error.captureStackTrace&&Error.captureStackTrace(t,w),!n)throw t;return t},Wr=function(e,r,n,t){var i=e.length,o=t?t.length:0;if(!i||r.f&&!r.l)return n||new E(0);var a=!n,s=a||r.i!=2,f=r.i;a&&(n=new E(i*3));var c=function(Or){var Sr=n.length;if(Or>Sr){var zr=new E(Math.max(Sr*2,Or));zr.set(n),n=zr}},p=r.f||0,u=r.p||0,v=r.b||0,h=r.l,g=r.d,x=r.m,A=r.n,D=i*8;do{if(!h){p=S(e,u,1);var b=S(e,u+1,3);if(u+=3,b)if(b==1)h=kr,g=_r,x=9,A=5;else if(b==2){var j=S(e,u,31)+257,V=S(e,u+10,15)+4,B=j+S(e,u+5,31)+1;u+=14;for(var O=new E(B),J=new E(19),m=0;m>4;if(y<16)O[m++]=y;else{var G=0,rr=0;for(y==16?(rr=3+S(e,u,3),u+=2,G=O[m-1]):y==17?(rr=3+S(e,u,7),u+=3):y==18&&(rr=11+S(e,u,127),u+=7);rr--;)O[m++]=G}}var xr=O.subarray(0,j),F=O.subarray(j);x=ir(xr),A=ir(F),h=q(xr,x,1),g=q(F,A,1)}else w(1);else{var y=Br(u)+4,U=e[y-4]|e[y-3]<<8,Z=y+U;if(Z>i){f&&w(0);break}s&&c(v+U),n.set(e.subarray(y,Z),v),r.b=v+=U,r.p=u=Z*8,r.f=p;continue}if(u>D){f&&w(0);break}}s&&c(v+131072);for(var re=(1<>4;if(u+=G&15,u>D){f&&w(0);break}if(G||w(2),N<256)n[v++]=N;else if(N==256){fr=u,h=null;break}else{var Ar=N-254;if(N>264){var m=N-257,Y=pr[m];Ar=S(e,u,(1<>4;hr||w(3),u+=hr&15;var F=br[lr];if(lr>3){var Y=mr[lr];F+=or(e,u)&(1<D){f&&w(0);break}s&&c(v+131072);var Dr=v+Ar;if(v>>0},cr=function(e,r){return I(e,r)+I(e,r+4)*4294967296};function ve(e,r,n){return n||(n=r,r={}),typeof n!="function"&&w(7),ce(e,r,[le],function(t){return Zr(yr(t.data[0],Jr(t.data[1])))},1,n)}function yr(e,r){return Wr(e,{i:2},r&&r.out,r&&r.dictionary)}var vr=typeof TextDecoder<"u"&&new TextDecoder,pe=0;try{vr.decode(se,{stream:!0}),pe=1}catch{}var me=function(e){for(var r="",n=0;;){var t=e[n++],i=(t>127)+(t>223)+(t>239);if(n+i>e.length)return{s:r,r:sr(e,n-1)};i?i==3?(t=((t&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,r+=String.fromCharCode(55296|t>>10,56320|t&1023)):i&1?r+=String.fromCharCode((t&31)<<6|e[n++]&63):r+=String.fromCharCode((t&15)<<12|(e[n++]&63)<<6|e[n++]&63):r+=String.fromCharCode(t)}};function ge(e,r){if(r){for(var n="",t=0;t65558)return a(w(13,0,1),null),i;var f=C(e,s+8);if(f){var c=f,p=I(e,s+16),u=p==4294967295||c==65535;if(u){var v=I(e,s-12);u=I(e,v)==101075792,u&&(c=f=I(e,v+32),p=I(e,v+48))}for(var h=r&&r.filter,g=function(A){var D=we(e,p,u),b=D[0],y=D[1],U=D[2],Z=D[3],j=D[4],V=D[5],B=ye(e,V);p=j;var O=function(m,$){m?(i(),a(m,null)):($&&(o[Z]=$),--f||a(null,o))};if(!h||h({name:Z,size:y,originalSize:U,compression:b}))if(!b)O(null,sr(e,B,B+y));else if(b==8){var J=e.subarray(B,B+y);if(U<524288||y>.8*U)try{O(null,yr(J,{out:new E(U)}))}catch(m){O(m,null)}else t.push(ve(J,{size:U},O))}else O(w(14,"unknown compression type "+b,1),null);else O(null,null)},x=0;x{let t=r.isOk()?{type:"Ok",value:r.value}:{type:"Err",value:r.error},i=n.withStackTrace?new Error().stack:void 0;return{data:t,message:e,stack:i}};function K(e,r,n,t){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function s(p){try{c(t.next(p))}catch(u){a(u)}}function f(p){try{c(t.throw(p))}catch(u){a(u)}}function c(p){p.done?o(p.value):i(p.value).then(s,f)}c((t=t.apply(e,r||[])).next())})}function Nr(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 R(e){return this instanceof R?(this.v=e,this):new R(e)}function qr(e,r,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=n.apply(e,r||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),i[Symbol.asyncIterator]=function(){return this},i;function a(h){return function(g){return Promise.resolve(g).then(h,u)}}function s(h,g){t[h]&&(i[h]=function(x){return new Promise(function(A,D){o.push([h,x,A,D])>1||f(h,x)})},g&&(i[h]=g(i[h])))}function f(h,g){try{c(t[h](g))}catch(x){v(o[0][3],x)}}function c(h){h.value instanceof R?Promise.resolve(h.value.v).then(p,u):v(o[0][2],h)}function p(h){f("next",h)}function u(h){f("throw",h)}function v(h,g){h(g),o.shift(),o.length&&f(o[0][0],o[0][1])}}function Ae(e){var r,n;return r={},t("next"),t("throw",function(i){throw i}),t("return"),r[Symbol.iterator]=function(){return this},r;function t(i,o){r[i]=e[i]?function(a){return(n=!n)?{value:R(e[i](a)),done:!1}:o?o(a):a}:o}}function De(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 Nr=="function"?Nr(e):e[Symbol.iterator](),n={},t("next"),t("throw"),t("return"),n[Symbol.asyncIterator]=function(){return this},n);function t(o){n[o]=e[o]&&function(a){return new Promise(function(s,f){a=e[o](a),i(s,f,a.done,a.value)})}}function i(o,a,s,f){Promise.resolve(f).then(function(c){o({value:c,done:s})},a)}}var d=class e{constructor(r){this._promise=r}static fromSafePromise(r){let n=r.then(t=>new z(t));return new e(n)}static fromPromise(r,n){let t=r.then(i=>new z(i)).catch(i=>new T(n(i)));return new e(t)}static fromThrowable(r,n){return(...t)=>new e(K(this,void 0,void 0,function*(){try{return new z(yield r(...t))}catch(i){return new T(n?n(i):i)}}))}static combine(r){return de(r)}static combineWithAllErrors(r){return Oe(r)}map(r){return new e(this._promise.then(n=>K(this,void 0,void 0,function*(){return n.isErr()?new T(n.error):new z(yield r(n.value))})))}andThrough(r){return new e(this._promise.then(n=>K(this,void 0,void 0,function*(){if(n.isErr())return new T(n.error);let t=yield r(n.value);return t.isErr()?new T(t.error):new z(n.value)})))}andTee(r){return new e(this._promise.then(n=>K(this,void 0,void 0,function*(){if(n.isErr())return new T(n.error);try{yield r(n.value)}catch{}return new z(n.value)})))}mapErr(r){return new e(this._promise.then(n=>K(this,void 0,void 0,function*(){return n.isOk()?new z(n.value):new T(yield r(n.error))})))}andThen(r){return new e(this._promise.then(n=>{if(n.isErr())return new T(n.error);let t=r(n.value);return t instanceof e?t._promise:t}))}orElse(r){return new e(this._promise.then(n=>K(this,void 0,void 0,function*(){return n.isErr()?r(n.error):new z(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 qr(this,arguments,function*(){return yield R(yield R(yield*Ae(De(yield R(this._promise.then(n=>n.safeUnwrap()))))))})}then(r,n){return this._promise.then(r,n)}[Symbol.asyncIterator](){return qr(this,arguments,function*(){let n=yield R(this._promise);return n.isErr()&&(yield yield R(P(n.error))),yield R(n.value)})}},jr=e=>new d(Promise.resolve(new z(e))),P=e=>new d(Promise.resolve(new T(e))),Fe=d.fromPromise,ke=d.fromSafePromise,_e=d.fromThrowable,$r=e=>{let r=W([]);for(let n of e)if(n.isErr()){r=M(n.error);break}else r.map(t=>t.push(n.value));return r},de=e=>d.fromSafePromise(Promise.all(e)).andThen($r),Yr=e=>{let r=W([]);for(let n of e)n.isErr()&&r.isErr()?r.error.push(n.error):n.isErr()&&r.isOk()?r=M([n.error]):n.isOk()&&r.isOk()&&r.value.push(n.value);return r},Oe=e=>d.fromSafePromise(Promise.all(e)).andThen(Yr),wr;(function(e){function r(i,o){return(...a)=>{try{let s=i(...a);return W(s)}catch(s){return M(o?o(s):s)}}}e.fromThrowable=r;function n(i){return $r(i)}e.combine=n;function t(i){return Yr(i)}e.combineWithAllErrors=t})(wr||(wr={}));var W=e=>new z(e);function M(e){return new T(e)}var z=class{constructor(r){this.value=r}isOk(){return!0}isErr(){return!this.isOk()}map(r){return W(r(this.value))}mapErr(r){return W(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 W(this.value)}orElse(r){return W(this.value)}asyncAndThen(r){return r(this.value)}asyncAndThrough(r){return r(this.value).map(()=>this.value)}asyncMap(r){return d.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 Kr("Called `_unsafeUnwrapErr` on an Ok",this,r)}*[Symbol.iterator](){return this.value}},T=class{constructor(r){this.error=r}isOk(){return!1}isErr(){return!this.isOk()}map(r){return M(this.error)}mapErr(r){return M(r(this.error))}andThrough(r){return M(this.error)}andTee(r){return M(this.error)}andThen(r){return M(this.error)}orElse(r){return r(this.error)}asyncAndThen(r){return P(this.error)}asyncAndThrough(r){return P(this.error)}asyncMap(r){return P(this.error)}unwrapOr(r){return r}match(r,n){return n(this.error)}safeUnwrap(){let r=this.error;return function*(){throw yield M(r),new Error("Do not use this generator out of `safeTry`")}()}_unsafeUnwrap(r){throw Kr("Called `_unsafeUnwrap` on an Err",this,r)}_unsafeUnwrapErr(r){return this.error}*[Symbol.iterator](){let r=this;return yield r,r}},Be=wr.fromThrowable;var ur=class extends _{};var X=class extends ur{constructor(){super(...arguments);k(this,"message","Parameter must be defined")}};var Qr=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=>{Se(e.data).map(()=>{self.postMessage({event:"ARCHIVE_DECOMPRESSED"})}).mapErr(r=>{self.postMessage({event:"OPERATION_FAILED",error:r})})};var Se=e=>{let{archive:r}=e.args;if(r){let n=async()=>{if(r.file){let t=await r.file.bytes();return new Promise((i,o)=>{Gr(t,(a,s)=>{a&&o(a),i(s)})})}else return Promise.reject(new X("archive.file must be defined"))};return d.fromPromise(n(),t=>t).andThen(t=>{try{for(let i in t)self.postMessage({event:"ARCHIVE_RETRIEVED_FILE",file:{buffer:t[i].buffer,path:i}},[t[i].buffer]);return jr(void 0)}catch(i){return P(i)}}).orElse(t=>P(new nr(void 0,{cause:Qr(t)})))}else return P(new X("archive must be defined"))};