import{inflateRaw as L}from"zlib";import{promisify as _}from"util";var x=_(L);var R=new TextDecoder,a=e=>{throw new Error("but-unzip~"+e)},d=e=>R.decode(e),z=(...e)=>[...g(...e)];function*g(e,m=x){let t=e.length-20,E=Math.max(t-65516,2);for(;(t=e.lastIndexOf(80,t-1))!==-1&&!(e[t+1]===75&&e[t+2]===5&&e[t+3]===6)&&t>E;);t===-1&&a(2);let r=(n,s)=>e.subarray(t+=n,t+=s),l=new DataView(e.buffer,e.byteOffset),o=n=>l.getUint16(n+t,!0),c=n=>l.getUint32(n+t,!0),f=o(10);for(f!==o(8)&&a(3),t=c(16);f--;){let n=o(10),s=o(30),u=o(32),p=c(20),b=c(42),y=d(r(46,o(28))),h=d(r(s,u)),D=t,i;t=b,i=r(30+o(26)+o(28),p),yield{filename:y,comment:h,read:()=>n&8?m(i):n?a(1):i},t=D}}export{x as inflateRaw,g as iter,z as unzip};