just-bash 2.14.0 → 2.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/chunks/chunk-VRUXUVWB.js +63 -0
- package/dist/bin/{shell/chunks/flag-coverage-LBMWMYOO.js → chunks/flag-coverage-NSXW5TJP.js} +1 -1
- package/dist/bin/{shell/chunks/tar-TOWX2TDU.js → chunks/tar-DNUNEW4Z.js} +1 -1
- package/dist/bin/just-bash.js +1 -1
- package/dist/bin/shell/chunks/chunk-VRUXUVWB.js +63 -0
- package/dist/bin/{chunks/flag-coverage-LBMWMYOO.js → shell/chunks/flag-coverage-NSXW5TJP.js} +1 -1
- package/dist/bin/{chunks/tar-TOWX2TDU.js → shell/chunks/tar-DNUNEW4Z.js} +1 -1
- package/dist/bin/shell/shell.js +1 -1
- package/dist/bundle/chunks/chunk-BRGMQKJV.js +62 -0
- package/dist/bundle/chunks/{flag-coverage-LMTH7T5F.js → flag-coverage-QT4N2Z44.js} +1 -1
- package/dist/bundle/chunks/{tar-232RCEFK.js → tar-ANUBEFJY.js} +1 -1
- package/dist/bundle/index.cjs +565 -565
- package/dist/bundle/index.js +1 -1
- package/dist/commands/tar/bzip2-compress.d.ts +17 -0
- package/package.json +7 -7
- package/dist/bin/chunks/chunk-WS6P4H4S.js +0 -63
- package/dist/bin/shell/chunks/chunk-WS6P4H4S.js +0 -63
- package/dist/bundle/chunks/chunk-ZXL7TQLN.js +0 -62
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as ye}from"./chunk-YMMJLYIX.js";import{b as ee}from"./chunk-YU6OGPZR.js";import{a as O}from"./chunk-SE4C7FJY.js";import{a as we,b as Se,c as te}from"./chunk-GTNBSMZR.js";var ie="file",_e="link",Te="symlink",H="directory",Ve={file:"0",link:"1",symlink:"2","character-device":"3","block-device":"4",directory:"5",fifo:"6","pax-header":"x","pax-global-header":"g","gnu-long-name":"L","gnu-long-link-name":"K"},Je={0:ie,1:_e,2:Te,3:"character-device",4:"block-device",5:H,6:"fifo",x:"pax-header",g:"pax-global-header",L:"gnu-long-name",K:"gnu-long-link-name"},Qe=new Uint8Array(512),G=new Uint8Array(0),M=new TextEncoder,xe=new TextDecoder;function z(e,t,i,r){r&&M.encodeInto(r,e.subarray(t,t+i))}function B(e,t,i,r){if(r===void 0)return;let n=r.toString(8).padStart(i-1,"0");M.encodeInto(n,e.subarray(t,t+i-1))}function v(e,t,i){let r=e.indexOf(0,t),n=r===-1||r>t+i?t+i:r;return xe.decode(e.subarray(t,n))}function se(e,t,i){let r=0,n=t+i;for(let s=t;s<n;s++){let o=e[s];if(o===0)break;o!==32&&(r=r*8+(o-48))}return r}function D(e,t,i){if(e[t]&128){let r=0;r=e[t]&127;for(let n=1;n<i;n++)r=r*256+e[t+n];if(!Number.isSafeInteger(r))throw new Error("TAR number too large");return r}return se(e,t,i)}var Z=e=>e.type===H||e.type===Te||e.type===_e;async function Ce(e){if(e==null)return G;if(e instanceof Uint8Array)return e;if(typeof e=="string")return M.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(e instanceof Blob)return new Uint8Array(await e.arrayBuffer());throw new TypeError("Unsupported content type for entry body.")}function be(e,t){let{strip:i,filter:r,map:n}=t;if(!i&&!r&&!n)return e;let s={...e};if(i&&i>0){let a=s.name.split("/").filter(Boolean);if(i>=a.length)return null;let c=a.slice(i).join("/");if(s.name=s.type===H&&!c.endsWith("/")?`${c}/`:c,s.linkname?.startsWith("/")){let l=s.linkname.split("/").filter(Boolean);s.linkname=i>=l.length?"/":`/${l.slice(i).join("/")}`}}if(r?.(s)===!1)return null;let o=n?n(s):s;return o&&(!o.name||!o.name.trim()||o.name==="."||o.name==="/")?null:o}var ne=32,et=48;function tt(e){let t=se(e,148,8),i=0;for(let r=0;r<e.length;r++)r>=148&&r<156?i+=ne:i+=e[r];return t===i}function rt(e){e.fill(ne,148,156);let t=0;for(let i of e)t+=i;for(let i=153;i>=148;i--)e[i]=(t&7)+et,t>>=3;e[154]=0,e[155]=ne}function nt(e){let t={};e.name.length>100&&Ue(e.name)===null&&(t.path=e.name),e.linkname&&e.linkname.length>100&&(t.linkpath=e.linkname),e.uname&&e.uname.length>32&&(t.uname=e.uname),e.gname&&e.gname.length>32&&(t.gname=e.gname),e.uid!=null&&e.uid>2097151&&(t.uid=String(e.uid)),e.gid!=null&&e.gid>2097151&&(t.gid=String(e.gid)),e.size!=null&&e.size>8589934591&&(t.size=String(e.size)),e.pax&&Object.assign(t,e.pax);let i=Object.entries(t);if(i.length===0)return null;let r=M.encode(i.map(([n,s])=>{let o=`${n}=${s}
|
|
3
|
+
`,a=M.encode(o).length+1,c=a+String(a).length;return c=a+String(c).length,`${c} ${o}`}).join(""));return{paxHeader:Ie({name:xe.decode(M.encode(`PaxHeader/${e.name}`).slice(0,100)),size:r.length,type:"pax-header",mode:420,mtime:e.mtime,uname:e.uname,gname:e.gname,uid:e.uid,gid:e.gid}),paxBody:r}}function Ue(e){if(e.length<=100)return null;let t=e.length-100-1,i=e.lastIndexOf("/",155);return i>0&&i>=t?{prefix:e.slice(0,i),name:e.slice(i+1)}:null}function Ie(e){let t=new Uint8Array(512),i=Z(e)?0:e.size??0,r=e.name,n="";if(!e.pax?.path){let s=Ue(r);s&&(r=s.name,n=s.prefix)}return z(t,0,100,r),B(t,100,8,e.mode??(e.type===H?493:420)),B(t,108,8,e.uid??0),B(t,116,8,e.gid??0),B(t,124,12,i),B(t,136,12,Math.floor((e.mtime?.getTime()??Date.now())/1e3)),z(t,156,1,Ve[e.type??ie]),z(t,157,100,e.linkname),z(t,257,6,"ustar\0"),z(t,263,2,"00"),z(t,265,32,e.uname),z(t,297,32,e.gname),z(t,345,155,n),rt(t),t}function it(e,t){if(t&&!tt(e))throw new Error("Invalid tar header checksum.");let i=v(e,156,1),r={name:v(e,0,100),mode:se(e,100,8),uid:D(e,108,8),gid:D(e,116,8),size:D(e,124,12),mtime:new Date(D(e,136,12)*1e3),type:Je[i]||ie,linkname:v(e,157,100)},n=v(e,257,6);return n.trim()==="ustar"&&(r.uname=v(e,265,32),r.gname=v(e,297,32)),n==="ustar"&&(r.prefix=v(e,345,155)),r}var st={path:["name",e=>e],linkpath:["linkname",e=>e],size:["size",e=>parseInt(e,10)],mtime:["mtime",parseFloat],uid:["uid",e=>parseInt(e,10)],gid:["gid",e=>parseInt(e,10)],uname:["uname",e=>e],gname:["gname",e=>e]};function ot(e){let t=new TextDecoder("utf-8"),i={},r={},n=0;for(;n<e.length;){let s=e.indexOf(32,n);if(s===-1)break;let o=parseInt(t.decode(e.subarray(n,s)),10);if(Number.isNaN(o)||o===0)break;let a=n+o,[c,l]=t.decode(e.subarray(s+1,a-1)).split("=",2);if(c&&l!==void 0){r[c]=l;let f=st[c];if(f){let[u,w]=f,g=w(l);(typeof g=="string"||!Number.isNaN(g))&&(i[u]=g)}}n=a}return Object.keys(r).length>0&&(i.pax=r),i}function Ee(e,t){t.name!==void 0&&(e.name=t.name),t.linkname!==void 0&&(e.linkname=t.linkname),t.size!==void 0&&(e.size=t.size),t.mtime!==void 0&&(e.mtime=new Date(t.mtime*1e3)),t.uid!==void 0&&(e.uid=t.uid),t.gid!==void 0&&(e.gid=t.gid),t.uname!==void 0&&(e.uname=t.uname),t.gname!==void 0&&(e.gname=t.gname),t.pax&&(e.pax=Object.assign({},e.pax??{},t.pax))}function at(e){switch(e){case"pax-global-header":case"pax-header":return ot;case"gnu-long-name":return t=>({name:v(t,0,t.length)});case"gnu-long-link-name":return t=>({linkname:v(t,0,t.length)});default:return}}function ct(e){let t=Ie(e),i=nt(e);if(!i)return[t];let r=-i.paxBody.length&511,n=r>0?[Qe.subarray(0,r)]:[];return[i.paxHeader,i.paxBody,...n,t]}var lt=new Uint8Array(512*2);function ve(e,t,i){let r=null,n=0,s=!1;return{add(o){if(s){let a=new Error("No new tar entries after finalize.");throw t(a),a}if(r!==null){let a=new Error("Previous entry must be completed before adding a new one");throw t(a),a}try{let a=Z(o)?0:o.size??0,c=ct({...o,size:a});for(let l of c)e(l);r={...o,size:a},n=0}catch(a){t(a)}},write(o){if(!r){let c=new Error("No active tar entry.");throw t(c),c}if(s){let c=new Error("Cannot write data after finalize.");throw t(c),c}let a=n+o.length;if(a>r.size){let c=new Error(`"${r.name}" exceeds given size of ${r.size} bytes.`);throw t(c),c}try{n=a,e(o)}catch(c){t(c)}},endEntry(){if(!r){let o=new Error("No active entry to end.");throw t(o),o}if(s){let o=new Error("Cannot end entry after finalize.");throw t(o),o}try{if(n!==r.size){let a=new Error(`Size mismatch for "${r.name}".`);throw t(a),a}let o=-r.size&511;o>0&&e(new Uint8Array(o)),r=null,n=0}catch(o){throw t(o),o}},finalize(){if(s){let o=new Error("Archive has already been finalized");throw t(o),o}if(r!==null){let o=new Error("Cannot finalize while an entry is still active");throw t(o),o}try{e(lt),s=!0,i&&i()}catch(o){t(o)}}}}var P=256;function ft(){let e=new Array(P),t=e.length-1,i=0,r=0,n=0,s=a=>{let c=e[i];a===c.length?(e[i]=G,i=i+1&t):e[i]=c.subarray(a),n-=a,n===0&&e.length>P&&(e=new Array(P),t=P-1,i=0,r=0)};function o(a,c){if(c){let g=0,h=Math.min(a,n);for(;h>0;){let p=e[i],m=Math.min(h,p.length),E=m===p.length?p:p.subarray(0,m);if(s(m),h-=m,g+=m,!c(E))break}return g}if(n<a)return null;if(a===0)return G;let l=e[i];if(l.length>=a){let g=l.length===a?l:l.subarray(0,a);return s(a),g}let f=new Uint8Array(a),u=0,w=a;for(;w>0;){let g=e[i],h=Math.min(w,g.length);f.set(h===g.length?g:g.subarray(0,h),u),u+=h,w-=h,s(h)}return f}return{push:a=>{if(a.length===0)return;let c=r+1&t;if(c===i){let l=e.length,f=l*2,u=new Array(f),w=r-i+l&l-1;if(i<r)for(let g=0;g<w;g++)u[g]=e[i+g];else if(w>0){let g=l-i;for(let h=0;h<g;h++)u[h]=e[i+h];for(let h=0;h<r;h++)u[g+h]=e[h]}e=u,t=f-1,i=0,r=w,c=r+1&t}e[r]=a,r=c,n+=a.length},available:()=>n,peek:a=>{if(n<a)return null;if(a===0)return G;let c=e[i];if(c.length>=a)return c.length===a?c:c.subarray(0,a);let l=new Uint8Array(a),f=0,u=i;for(;f<a;){let w=e[u],g=Math.min(a-f,w.length);g===w.length?l.set(w,f):l.set(w.subarray(0,g),f),f+=g,u=u+1&t}return l},discard:a=>{if(a>n)throw new Error("Too many bytes consumed");if(a===0)return;let c=a;for(;c>0;){let l=e[i],f=Math.min(c,l.length);s(f),c-=f}},pull:o}}var re=0,$=1,K=new Error("Tar archive is truncated.");function ke(e={}){let t=e.strict??!1,{available:i,peek:r,push:n,discard:s,pull:o}=ft(),a=re,c=!1,l=!1,f=!1,u=null,w={},g={},h={isEntryActive:()=>a===$,isBodyComplete:()=>!u||u.remaining===0,write(p){if(c)throw new Error("Archive already ended.");n(p)},end(){c=!0},readHeader(){if(a!==re)throw new Error("Cannot read header while an entry is active");if(!l)for(;!l;){if(i()<512){if(c){if(i()>0&&t)throw K;l=!0;return}return null}let p=r(512);if(Ae(p)){if(i()<512*2){if(c){if(t)throw K;l=!0;return}return null}if(Ae(r(512*2).subarray(512))){s(512*2),l=!0,f=!0;return}if(t)throw new Error("Invalid tar header.");s(512);continue}let m;try{m=it(p,t)}catch(b){if(t)throw b;s(512);continue}let E=at(m.type);if(E){let b=m.size+511&-512;if(i()<512+b){if(c&&t)throw K;return null}s(512);let A=E(o(b).subarray(0,m.size)),U=m.type==="pax-global-header"?w:g;for(let T in A)U[T]=A[T];continue}s(512);let y=m;return m.prefix&&(y.name=`${m.prefix}/${y.name}`),Ee(y,w),Ee(y,g),g={},u={header:y,remaining:y.size,padding:-y.size&511},a=$,y}},streamBody(p){if(a!==$||!u||u.remaining===0)return 0;let m=Math.min(u.remaining,i());if(m===0)return 0;let E=o(m,p);return u.remaining-=E,E},skipPadding(){if(a!==$||!u)return!0;if(u.remaining>0)throw new Error("Body not fully consumed");return i()<u.padding?!1:(s(u.padding),u=null,a=re,!0)},skipEntry(){if(a!==$||!u)return!0;let p=Math.min(u.remaining,i());return p>0&&(s(p),u.remaining-=p),u.remaining>0?!1:h.skipPadding()},validateEOF(){if(t){if(!f)throw K;if(i()>0&&o(i()).some(p=>p!==0))throw new Error("Invalid EOF.")}}};return h}function Ae(e){if(e.byteOffset%8===0){let t=new BigUint64Array(e.buffer,e.byteOffset,e.length/8);for(let i=0;i<t.length;i++)if(t[i]!==0n)return!1;return!0}for(let t=0;t<e.length;t++)if(e[t]!==0)return!1;return!0}function ze(){return new CompressionStream("gzip")}function Re(){return new DecompressionStream("gzip")}function ut(){let e,t;return{readable:new ReadableStream({start(i){e=i,t=ve(i.enqueue.bind(i),i.error.bind(i),i.close.bind(i))}}),controller:{add(i){let r=Z(i),n={...i};return r&&(n.size=0),t.add(n),r&&t.endEntry(),new WritableStream({write(s){t.write(s)},close(){r||t.endEntry()},abort(s){e.error(s)}})},finalize(){t.finalize()},error(i){e.error(i)}}}}async function Oe(e){let t=[],i=e.getReader(),r=0;try{for(;;){let{done:o,value:a}=await i.read();if(o)break;t.push(a),r+=a.length}let n=new Uint8Array(r),s=0;for(let o of t)n.set(o,s),s+=o.length;return n}finally{i.releaseLock()}}var Fe=e=>e.pipeTo(new WritableStream);function dt(e={}){let t=ke(e),i=null,r=!1,n=s=>{if(!r){r=!0;try{for(;;)if(t.isEntryActive()){if(i){if(t.streamBody(o=>(i.enqueue(o),!0))===0&&!t.isBodyComplete())break}else if(!t.skipEntry())break;if(t.isBodyComplete()){try{i?.close()}catch{}if(i=null,!t.skipPadding())break}}else{let o=t.readHeader();if(o==null)break;s.enqueue({header:o,body:new ReadableStream({start(a){o.size===0?a.close():i=a},pull:()=>n(s),cancel(){i=null,n(s)}})})}}catch(o){try{i?.error(o)}catch{}throw i=null,o}finally{r=!1}}};return new TransformStream({transform(s,o){try{t.write(s),n(o)}catch(a){try{i?.error(a)}catch{}throw a}},flush(s){try{if(t.end(),n(s),t.validateEOF(),t.isEntryActive()&&!t.isBodyComplete())try{i?.close()}catch{}}catch(o){try{i?.error(o)}catch{}throw o}}},void 0,{highWaterMark:1})}async function Me(e){let{readable:t,controller:i}=ut();return await(async()=>{for(let r of e){let n=i.add(r.header),s="body"in r?r.body:r.data;if(!s){await n.close();continue}if(s instanceof ReadableStream)await s.pipeTo(n);else if(s instanceof Blob)await s.stream().pipeTo(n);else try{let o=await Ce(s);if(o.length>0){let a=n.getWriter();await a.write(o),await a.close()}else await n.close()}catch{throw new TypeError(`Unsupported content type for entry "${r.header.name}".`)}}})().then(()=>i.finalize()).catch(r=>i.error(r)),new Uint8Array(await Oe(t))}async function Be(e,t={}){let i=e instanceof ReadableStream?e:new ReadableStream({start(s){s.enqueue(e instanceof Uint8Array?e:new Uint8Array(e)),s.close()}}),r=[],n=i.pipeThrough(dt(t));for await(let s of n){let o;try{o=be(s.header,t)}catch(a){throw await s.body.cancel(),a}if(o===null){await Fe(s.body);continue}Z(o)?(await Fe(s.body),r.push({header:o})):r.push({header:o,data:await Oe(s.body)})}return r}import Tt from"seek-bzip";var mt=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let i=t<<24;for(let r=0;r<8;r++)i=i&2147483648?i<<1^79764919:i<<1;e[t]=i>>>0}return e})();function ht(e,t){return(e<<8^mt[(e>>>24^t)&255])>>>0}var oe=class{buffer=[];current=0;bitCount=0;writeBits(t,i){for(let r=t-1;r>=0;r--)this.current=this.current<<1|i>>>r&1,this.bitCount++,this.bitCount===8&&(this.buffer.push(this.current),this.current=0,this.bitCount=0)}writeBit(t){this.current=this.current<<1|t&1,this.bitCount++,this.bitCount===8&&(this.buffer.push(this.current),this.current=0,this.bitCount=0)}finish(){return this.bitCount>0&&this.buffer.push(this.current<<8-this.bitCount),new Uint8Array(this.buffer)}};function pt(e){let t=[],i=0;for(;i<e.length;){let r=e[i],n=1;for(;i+n<e.length&&e[i+n]===r&&n<255;)n++;n>=4?(t.push(r,r,r,r),t.push(n-4),i+=n):(t.push(r),i++)}return new Uint8Array(t)}function gt(e){let t=e.length;if(t===0)return{transformed:new Uint8Array(0),pointer:0};let i=wt(e),r=new Uint8Array(t),n=0;for(let s=0;s<t;s++)i[s]===0?(n=s,r[s]=e[t-1]):r[s]=e[i[s]-1];return{transformed:r,pointer:n}}function wt(e){let t=e.length,i=new Int32Array(t),r=new Int32Array(t);for(let n=0;n<t;n++)i[n]=n,r[n]=e[n];for(let n=1;n<t;n*=2){let s=r.slice();i.sort((o,a)=>s[o]!==s[a]?s[o]-s[a]:s[(o+n)%t]-s[(a+n)%t]),r[i[0]]=0;for(let o=1;o<t;o++)s[i[o]]===s[i[o-1]]&&s[(i[o]+n)%t]===s[(i[o-1]+n)%t]?r[i[o]]=r[i[o-1]]:r[i[o]]=r[i[o-1]]+1;if(r[i[t-1]]===t-1)break}return i}function St(e,t){let i=[];for(let o=0;o<256;o++)t[o]&&i.push(o);let r=new Array(256).fill(-1);for(let o=0;o<i.length;o++)r[i[o]]=o;let n=new Uint16Array(e.length),s=i.slice();for(let o=0;o<e.length;o++){let a=e[o],c=0;for(;s[c]!==a;)c++;if(n[o]=c,c>0){let l=s[c];for(let f=c;f>0;f--)s[f]=s[f-1];s[0]=l}}return{encoded:n,length:e.length}}function yt(e,t,i){let s=i+1,o=[],a=0;for(;a<t;)if(e[a]===0){let l=0;for(;a<t&&e[a]===0;)l++,a++;let f=l;for(;f>0;)f--,f&1?o.push(1):o.push(0),f>>>=1}else o.push(e[a]+1),a++;o.push(s);let c=new Uint16Array(o.length);for(let l=0;l<o.length;l++)c[l]=o[l];return{symbols:c,length:o.length,eob:s}}function $e(e,t,i){if(t<=1){let l=new Array(e.length).fill(0);for(let f=0;f<e.length;f++)e[f]>0&&(l[f]=1);return{codeLengths:l,maxLen:1,minLen:1}}let r=[];for(let l=0;l<e.length;l++)e[l]>0&&r.push({freq:e[l],symbol:l,left:null,right:null});if(r.length===0)return{codeLengths:new Array(e.length).fill(0),maxLen:0,minLen:0};if(r.length===1){let l=new Array(e.length).fill(0);return l[r[0].symbol]=1,{codeLengths:l,maxLen:1,minLen:1}}for(;r.length>1;){r.sort((u,w)=>u.freq-w.freq);let l=r.shift(),f=r.shift();r.push({freq:l.freq+f.freq,symbol:-1,left:l,right:f})}let n=new Array(e.length).fill(0);function s(l,f){if(!l.left&&!l.right){n[l.symbol]=f;return}l.left&&s(l.left,f+1),l.right&&s(l.right,f+1)}s(r[0],0);let o=!0;for(;o;){o=!1;for(let l=0;l<n.length;l++)n[l]>i&&(n[l]=i,o=!0);if(o){let l=0;for(let f=0;f<n.length;f++)n[f]>0&&(l+=1/(1<<n[f]));if(l>1)for(let f=1;f<i&&l>1;f++)for(let u=0;u<n.length&&l>1;u++)n[u]===f&&(n[u]++,l-=1/(1<<f)-1/(1<<f+1));o=!1;for(let f=0;f<n.length;f++)if(n[f]>i){o=!0;break}}}let a=i,c=0;for(let l=0;l<n.length;l++)n[l]>0&&(n[l]<a&&(a=n[l]),n[l]>c&&(c=n[l]));return{codeLengths:n,maxLen:c,minLen:a}}function Et(e,t){let i=new Array(t).fill(0),r=e.slice(0,t),n=Math.max(...r,0),s=new Array(n+1).fill(0);for(let c=0;c<t;c++)r[c]>0&&s[r[c]]++;let o=new Array(n+1).fill(0),a=0;for(let c=1;c<=n;c++)a=a+s[c-1]<<1,o[c]=a;for(let c=0;c<t;c++)r[c]>0&&(i[c]=o[r[c]]++);return{codes:i,lengths:r}}function At(e,t,i){e.writeBits(24,3227993),e.writeBits(24,2511705),e.writeBits(32,i),e.writeBit(0);let r=pt(t),{transformed:n,pointer:s}=gt(r);e.writeBits(24,s);let o=new Array(256).fill(!1);for(let d=0;d<n.length;d++)o[n[d]]=!0;let a=new Array(16).fill(!1);for(let d=0;d<16;d++)for(let S=0;S<16;S++)if(o[d*16+S]){a[d]=!0;break}for(let d=0;d<16;d++)e.writeBit(a[d]?1:0);for(let d=0;d<16;d++)if(a[d])for(let S=0;S<16;S++)e.writeBit(o[d*16+S]?1:0);let c=0;for(let d=0;d<256;d++)o[d]&&c++;let{encoded:l,length:f}=St(n,o),{symbols:u,length:w}=yt(l,f,c),g=c+2,h=50,p=Math.ceil(w/h),m;w<200?m=2:w<600?m=3:w<1200?m=4:w<2400?m=5:m=6,m>p&&(m=Math.max(2,p));let E=[];for(let d=0;d<m;d++)E.push(new Array(g).fill(0));let y=new Int32Array(p);for(let d=0;d<p;d++)y[d]=d%m;for(let d=0;d<p;d++){let S=d*h,_=Math.min(S+h,w),I=y[d];for(let x=S;x<_;x++)E[I][u[x]]++}function b(d){for(let S=0;S<g;S++)d[S]<1&&(d[S]=1)}let A=[];for(let d=0;d<m;d++)b(E[d]),A.push($e(E[d],g,20));for(let d=0;d<4;d++){for(let S=0;S<m;S++)E[S].fill(0);for(let S=0;S<p;S++){let _=S*h,I=Math.min(_+h,w),x=0,L=1/0;for(let F=0;F<m;F++){let J=0;for(let Q=_;Q<I;Q++)J+=A[F].codeLengths[u[Q]]||20;J<L&&(L=J,x=F)}y[S]=x;for(let F=_;F<I;F++)E[x][u[F]]++}for(let S=0;S<m;S++)b(E[S]),A[S]=$e(E[S],g,20)}e.writeBits(3,m),e.writeBits(15,p);let U=[],T=[];for(let d=0;d<m;d++)T.push(d);for(let d=0;d<p;d++){let S=y[d],_=0;for(;T[_]!==S;)_++;if(U.push(_),_>0){let I=T[_];for(let x=_;x>0;x--)T[x]=T[x-1];T[0]=I}}for(let d=0;d<p;d++){for(let S=0;S<U[d];S++)e.writeBit(1);e.writeBit(0)}for(let d=0;d<m;d++){let S=A[d].codeLengths,_=S[0];e.writeBits(5,_);for(let I=0;I<g;I++){let x=S[I];for(;_<x;)e.writeBit(1),e.writeBit(0),_++;for(;_>x;)e.writeBit(1),e.writeBit(1),_--;e.writeBit(0)}}for(let d=0;d<m;d++){let{codes:S,lengths:_}=Et(A[d].codeLengths,g);A[d]=Object.assign(A[d],{_codes:S,_lengths:_})}let ge=0,N=0;for(let d=0;d<w;d++){(N===0||N>=h)&&(d>0&&ge++,N=0);let S=y[ge],_=A[S],I=u[d],x=_._lengths[I],L=_._codes[I];x>0&&e.writeBits(x,L),N++}}var _t=10*1024*1024;function Ze(e,t=9,i=_t){if(t<1||t>9)throw new Error("Block size level must be 1-9");if(e.length>i)throw new Error(`Input too large for bzip2 compression (${e.length} bytes, max ${i})`);let r=t*1e5,n=new oe;n.writeBits(8,66),n.writeBits(8,90),n.writeBits(8,104),n.writeBits(8,48+t);let s=0,o=0;for(;o<e.length;){let a=Math.min(o+r,e.length),c=e.subarray(o,a),l=4294967295;for(let f=0;f<c.length;f++)l=ht(l,c[f]);l=~l>>>0,s=(s<<1|s>>>31)>>>0,s=(s^l)>>>0,At(n,c,l),o=a}return n.writeBits(24,1536581),n.writeBits(24,3690640),n.writeBits(32,s),n.finish()}var W=null,X=null;async function De(){if(W)return W;if(X)throw X;try{return W=await ee.runTrustedAsync(()=>import("node-liblzma")),W}catch{throw X=new Error("xz compression requires node-liblzma which failed to load. Install liblzma-dev (apt) or xz (brew) and reinstall dependencies."),X}}var j=null,q=null;async function Pe(){if(j)return j;if(q)throw q;try{return j=await ee.runTrustedAsync(()=>import("@mongodb-js/zstd")),j}catch{throw q=new Error("zstd compression requires @mongodb-js/zstd which is not installed. Install it with: npm install @mongodb-js/zstd"),q}}var C=100*1024*1024,Ne=512,Le=1e4;function xt(e){let t="file";e.isDirectory?t="directory":e.isSymlink&&(t="symlink");let i=e.name;e.isDirectory&&!i.endsWith("/")&&(i+="/");let r;e.content!==void 0&&(typeof e.content=="string"?r=new TextEncoder().encode(e.content):r=e.content);let n=e.isDirectory||e.isSymlink?0:r?.length??0;return{header:{name:i,mode:e.mode??(e.isDirectory?493:420),uid:e.uid??0,gid:e.gid??0,size:n,mtime:e.mtime??new Date,type:t,linkname:e.linkTarget??"",uname:"user",gname:"user"},body:r}}async function R(e){let t=e.map(xt);return Me(t)}async function Ke(e){let t=await R(e),n=new ReadableStream({start(l){l.enqueue(t),l.close()}}).pipeThrough(ze()).getReader(),s=[];for(;;){let{done:l,value:f}=await n.read();if(l)break;s.push(f)}let o=s.reduce((l,f)=>l+f.length,0),a=new Uint8Array(o),c=0;for(let l of s)a.set(l,c),c+=l.length;return a}async function k(e){if(e.length>C)return{entries:[],error:`Archive too large (max ${C} bytes)`};if(e.length<Ne||e.length%Ne!==0)return{entries:[],error:"Invalid tar archive format"};try{let t=await Be(e),i=[];for(let r of t){if(i.length>=Le)return{entries:i,error:`Too many entries (max ${Le})`};let n="file";switch(r.header.type){case"directory":n="directory";break;case"symlink":n="symlink";break;case"link":n="hardlink";break;case"file":n="file";break;default:n="other"}i.push({name:r.header.name,mode:r.header.mode??420,uid:r.header.uid??0,gid:r.header.gid??0,size:r.header.size,mtime:r.header.mtime??new Date,type:n,linkTarget:r.header.linkname||void 0,content:r.data??new Uint8Array(0)})}return{entries:i}}catch(t){let i=t instanceof Error?t.message:"Unknown error";return{entries:[],error:i}}}async function ae(e){if(e.length>C)return{entries:[],error:`Archive too large (max ${C} bytes)`};try{let r=new ReadableStream({start(c){c.enqueue(e),c.close()}}).pipeThrough(Re()).getReader(),n=[],s=0;for(;;){let{done:c,value:l}=await r.read();if(c)break;if(s+=l.length,s>C)return await r.cancel(),{entries:[],error:`Decompressed archive too large (max ${C} bytes)`};n.push(l)}let o=new Uint8Array(s),a=0;for(let c of n)o.set(c,a),a+=c.length;return k(o)}catch(t){let i=t instanceof Error?t.message:"Unknown error";return{entries:[],error:`Decompression failed: ${i}`}}}function ce(e){return e.length>=2&&e[0]===31&&e[1]===139}function le(e){return e.length>=3&&e[0]===66&&e[1]===90&&e[2]===104}function fe(e){return e.length>=6&&e[0]===253&&e[1]===55&&e[2]===122&&e[3]===88&&e[4]===90&&e[5]===0}async function Ct(e){let t=Tt.decode(Buffer.from(e));return new Uint8Array(t)}async function bt(e){return Ze(e,9)}async function Ut(e){let i=(await De()).unxzSync(Buffer.from(e));return new Uint8Array(i)}async function It(e){let i=(await De()).xzSync(Buffer.from(e));return new Uint8Array(i)}async function Ge(e){let t=await R(e);return bt(t)}async function He(e,t){if(!t?.allowNativeCodecs)throw new Error("xz compression is disabled by default (native codec risk). Pass { allowNativeCodecs: true } to opt in.");let i=await R(e);return It(i)}async function ue(e){if(e.length>C)return{entries:[],error:`Archive too large (max ${C} bytes)`};try{let t=await Ct(e);return t.length>C?{entries:[],error:`Decompressed archive too large (max ${C} bytes)`}:k(t)}catch(t){let i=t instanceof Error?t.message:"Unknown error";return{entries:[],error:i}}}async function de(e,t){if(!t?.allowNativeCodecs)return{entries:[],error:"xz decompression is disabled by default (native codec risk). Pass { allowNativeCodecs: true } to opt in, or decompress the archive externally before extraction."};if(e.length>C)return{entries:[],error:`Archive too large (max ${C} bytes)`};try{let i=await Ut(e);return i.length>C?{entries:[],error:`Decompressed archive too large (max ${C} bytes)`}:k(i)}catch(i){let r=i instanceof Error?i.message:"Unknown error";return{entries:[],error:r}}}function me(e){return e.length>=4&&e[0]===40&&e[1]===181&&e[2]===47&&e[3]===253}async function vt(e){let i=await(await Pe()).compress(Buffer.from(e),3);return new Uint8Array(i)}async function kt(e){let i=await(await Pe()).decompress(Buffer.from(e));return new Uint8Array(i)}async function We(e,t){if(!t?.allowNativeCodecs)throw new Error("zstd compression is disabled by default (native codec risk). Pass { allowNativeCodecs: true } to opt in.");let i=await R(e);return vt(i)}async function he(e,t){if(!t?.allowNativeCodecs)return{entries:[],error:"zstd decompression is disabled by default (native codec risk). Pass { allowNativeCodecs: true } to opt in, or decompress the archive externally before extraction."};if(e.length>C)return{entries:[],error:`Archive too large (max ${C} bytes)`};try{let i=await kt(e);return i.length>C?{entries:[],error:`Decompressed archive too large (max ${C} bytes)`}:k(i)}catch(i){let r=i instanceof Error?i.message:"Unknown error";return{entries:[],error:r}}}function Xe(e){let t={create:!1,append:!1,update:!1,extract:!1,list:!1,file:"",autoCompress:!1,gzip:!1,bzip2:!1,xz:!1,zstd:!1,verbose:!1,toStdout:!1,keepOldFiles:!1,touch:!1,directory:"",preserve:!1,absoluteNames:!1,strip:0,exclude:[],filesFrom:"",excludeFrom:"",wildcards:!1},i=[],r=0;for(;r<e.length;){let n=e[r];if(n.startsWith("-")&&!n.startsWith("--")&&n.length>2){if(/^-\d+$/.test(n)){i.push(n),r++;continue}for(let s=1;s<n.length;s++){let o=n[s];switch(o){case"c":t.create=!0;break;case"r":t.append=!0;break;case"u":t.update=!0;break;case"x":t.extract=!0;break;case"t":t.list=!0;break;case"a":t.autoCompress=!0;break;case"z":t.gzip=!0;break;case"j":t.bzip2=!0;break;case"J":t.xz=!0;break;case"v":t.verbose=!0;break;case"O":t.toStdout=!0;break;case"k":t.keepOldFiles=!0;break;case"m":t.touch=!0;break;case"p":t.preserve=!0;break;case"P":t.absoluteNames=!0;break;case"f":if(s<n.length-1)t.file=n.substring(s+1),s=n.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'f'
|
|
4
|
+
`,exitCode:2}};t.file=e[r]}break;case"C":if(s<n.length-1)t.directory=n.substring(s+1),s=n.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'C'
|
|
5
|
+
`,exitCode:2}};t.directory=e[r]}break;case"T":if(s<n.length-1)t.filesFrom=n.substring(s+1),s=n.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'T'
|
|
6
|
+
`,exitCode:2}};t.filesFrom=e[r]}break;case"X":if(s<n.length-1)t.excludeFrom=n.substring(s+1),s=n.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'X'
|
|
7
|
+
`,exitCode:2}};t.excludeFrom=e[r]}break;default:return{ok:!1,error:te("tar",`-${o}`)}}}r++;continue}if(n==="-c"||n==="--create")t.create=!0;else if(n==="-r"||n==="--append")t.append=!0;else if(n==="-u"||n==="--update")t.update=!0;else if(n==="-x"||n==="--extract"||n==="--get")t.extract=!0;else if(n==="-t"||n==="--list")t.list=!0;else if(n==="-a"||n==="--auto-compress")t.autoCompress=!0;else if(n==="-z"||n==="--gzip"||n==="--gunzip")t.gzip=!0;else if(n==="-j"||n==="--bzip2")t.bzip2=!0;else if(n==="-J"||n==="--xz")t.xz=!0;else if(n==="--zstd")t.zstd=!0;else if(n==="-v"||n==="--verbose")t.verbose=!0;else if(n==="-O"||n==="--to-stdout")t.toStdout=!0;else if(n==="-k"||n==="--keep-old-files")t.keepOldFiles=!0;else if(n==="-m"||n==="--touch")t.touch=!0;else if(n==="--wildcards")t.wildcards=!0;else if(n==="-p"||n==="--preserve"||n==="--preserve-permissions")t.preserve=!0;else if(n==="-P"||n==="--absolute-names")t.absoluteNames=!0;else if(n==="-f"||n==="--file"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'f'
|
|
8
|
+
`,exitCode:2}};t.file=e[r]}else if(n.startsWith("--file="))t.file=n.substring(7);else if(n==="-C"||n==="--directory"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'C'
|
|
9
|
+
`,exitCode:2}};t.directory=e[r]}else if(n.startsWith("--directory="))t.directory=n.substring(12);else if(n.startsWith("--strip-components=")||n.startsWith("--strip=")){let s=n.includes("--strip-components=")?n.substring(19):n.substring(8),o=parseInt(s,10);if(Number.isNaN(o)||o<0)return{ok:!1,error:{stdout:"",stderr:`tar: invalid number for --strip: '${s}'
|
|
10
|
+
`,exitCode:2}};t.strip=o}else if(n.startsWith("--exclude="))t.exclude.push(n.substring(10));else if(n==="--exclude"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option '--exclude' requires an argument
|
|
11
|
+
`,exitCode:2}};t.exclude.push(e[r])}else if(n==="-T"||n==="--files-from"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'T'
|
|
12
|
+
`,exitCode:2}};t.filesFrom=e[r]}else if(n.startsWith("--files-from="))t.filesFrom=n.substring(13);else if(n==="-X"||n==="--exclude-from"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'X'
|
|
13
|
+
`,exitCode:2}};t.excludeFrom=e[r]}else if(n.startsWith("--exclude-from="))t.excludeFrom=n.substring(15);else if(n==="--"){i.push(...e.slice(r+1));break}else{if(n.startsWith("-"))return{ok:!1,error:te("tar",n)};i.push(n)}r++}return{ok:!0,options:t,files:i}}var je=100,Ft={name:"tar",summary:"manipulate tape archives",usage:"tar [options] [file...]",description:["Create, extract, or list contents of tar archives.","","One of -c, -r, -u, -x, or -t is required to specify the operation."],options:["-c, --create create a new archive","-r, --append append files to the end of an archive","-u, --update only append files newer than copy in archive","-x, --extract extract files from an archive","-t, --list list contents of an archive","-f, --file=ARCHIVE use archive file ARCHIVE","-a, --auto-compress use archive suffix to determine compression","-z, --gzip filter archive through gzip","-j, --bzip2 filter archive through bzip2","-J, --xz filter archive through xz","--zstd filter archive through zstd","-v, --verbose verbosely list files processed","-O, --to-stdout extract files to standard output","-k, --keep-old-files don't replace existing files when extracting","-m, --touch don't extract file modified time","-C, --directory=DIR change to directory DIR before performing operations","-p, --preserve preserve permissions","-P, --absolute-names do not strip leading '/' or block '..' paths","-T, --files-from=FILE read files to extract/create from FILE","-X, --exclude-from=FILE read exclude patterns from FILE","--strip=N strip N leading path components on extraction","--exclude=PATTERN exclude files matching PATTERN","--wildcards use wildcards for pattern matching"," --help display this help and exit"],examples:["tar -cvf archive.tar file1 file2 Create archive from files","tar -czvf archive.tar.gz dir/ Create gzip-compressed archive","tar -cjvf archive.tar.bz2 dir/ Create bzip2-compressed archive","tar -rf archive.tar newfile.txt Append file to archive","tar -uf archive.tar dir/ Update archive with newer files","tar -xvf archive.tar Extract archive","tar -xvf archive.tar -C /tmp Extract to /tmp","tar -tvf archive.tar List archive contents","tar -xzf archive.tar.gz Extract gzip archive","tar -xf archive.tar file1.txt Extract specific file","tar -xOf archive.tar file.txt Extract file to stdout","tar -xf archive.tar --wildcards '*.txt' Extract matching files"]};function pe(e,t){let i=e.includes("/")?e.substring(e.lastIndexOf("/")+1):e;for(let r of t){let n=r.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"<<<GLOBSTAR>>>").replace(/\*/g,"[^/]*").replace(/<<<GLOBSTAR>>>/g,".*").replace(/\?/g,".");if(O(`^${n}$`).test(e)||O(`^${n}/`).test(e)||!r.includes("/")&&O(`^${n}$`).test(i))return!0}return!1}function Y(e,t){let i=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"<<<GLOBSTAR>>>").replace(/\*/g,"[^/]*").replace(/<<<GLOBSTAR>>>/g,".*").replace(/\?/g,"."),r=e.includes("/")?e.substring(e.lastIndexOf("/")+1):e;return O(`^${i}$`).test(e)||O(`^${i}$`).test(r)}function qe(e,t){if(t<=0)return e;let i=e.split("/").filter(r=>r!=="");return i.length<=t?"":i.slice(t).join("/")}function Ye(e){return e.split("/").some(t=>t==="..")}function zt(e,t){if(t)return{safePath:e};let i=e.replace(/^\/+/,"");return i.length===0?{safePath:""}:Ye(i)?{error:"Path contains '..'"}:{safePath:i}}function Rt(e){let i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],r=e.getDate().toString().padStart(2," "),n=e.getHours().toString().padStart(2,"0"),s=e.getMinutes().toString().padStart(2,"0");return`${i} ${r} ${n}:${s}`}async function V(e,t,i,r){let n=[],s=[],o=e.fs.resolvePath(t,i);try{let a=await e.fs.stat(o);if(pe(i,r))return{entries:n,errors:s};if(a.isDirectory){n.push({name:i,isDirectory:!0,mode:a.mode,mtime:a.mtime});let c=await e.fs.readdir(o);for(let l=0;l<c.length;l+=je){let f=c.slice(l,l+je),u=await Promise.all(f.map(w=>V(e,t,i?`${i}/${w}`:w,r)));for(let w of u)n.push(...w.entries),s.push(...w.errors)}}else if(a.isFile){let c=await e.fs.readFileBuffer(o);n.push({name:i,content:c,mode:a.mode,mtime:a.mtime})}else if(a.isSymbolicLink){let c=await e.fs.readlink(o);n.push({name:i,isSymlink:!0,linkTarget:c,mode:a.mode,mtime:a.mtime})}}catch(a){let c=a instanceof Error?a.message:"unknown error";s.push(`tar: ${i}: ${c}`)}return{entries:n,errors:s}}async function Ot(e,t,i){if(i.length===0)return{stdout:"",stderr:`tar: Cowardly refusing to create an empty archive
|
|
14
|
+
`,exitCode:2};let r=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,n=[],s=[],o="";for(let f of i){let{entries:u,errors:w}=await V(e,r,f,t.exclude);if(n.push(...u),s.push(...w),t.verbose)for(let g of u)o+=`${g.name}${g.isDirectory?"/":""}
|
|
15
|
+
`}if(n.length===0&&s.length>0)return{stdout:"",stderr:`${s.join(`
|
|
16
|
+
`)}
|
|
17
|
+
`,exitCode:2};let a;try{t.gzip?a=await Ke(n):t.bzip2?a=await Ge(n):t.xz?a=await He(n):t.zstd?a=await We(n):a=await R(n)}catch(f){return{stdout:"",stderr:`tar: error creating archive: ${f instanceof Error?f.message:"unknown error"}
|
|
18
|
+
`,exitCode:2}}let c="";if(t.file&&t.file!=="-"){let f=e.fs.resolvePath(e.cwd,t.file);try{await e.fs.writeFile(f,a)}catch(u){let w=u instanceof Error?u.message:"unknown error";return{stdout:"",stderr:`tar: ${t.file}: ${w}
|
|
19
|
+
`,exitCode:2}}}else c=Buffer.from(a).toString("latin1");let l=o;return s.length>0&&(l+=`${s.join(`
|
|
20
|
+
`)}
|
|
21
|
+
`),{stdout:c,stderr:l,exitCode:s.length>0?2:0}}async function Mt(e,t,i){if(!t.file||t.file==="-")return{stdout:"",stderr:`tar: Cannot append to stdin/stdout
|
|
22
|
+
`,exitCode:2};if(i.length===0)return{stdout:"",stderr:`tar: Cowardly refusing to append nothing to archive
|
|
23
|
+
`,exitCode:2};let r=e.fs.resolvePath(e.cwd,t.file),n;try{n=await e.fs.readFileBuffer(r)}catch{return{stdout:"",stderr:`tar: ${t.file}: Cannot open: No such file or directory
|
|
24
|
+
`,exitCode:2}}let s=await k(n);if(s.error)return{stdout:"",stderr:`tar: ${s.error}
|
|
25
|
+
`,exitCode:2};let o=s.entries.map(h=>({name:h.name,content:h.content,mode:h.mode,mtime:h.mtime,isDirectory:h.type==="directory",isSymlink:h.type==="symlink",linkTarget:h.linkTarget,uid:h.uid,gid:h.gid})),a=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,c=[],l=[],f="";for(let h of i){let{entries:p,errors:m}=await V(e,a,h,t.exclude);if(c.push(...p),l.push(...m),t.verbose)for(let E of p)f+=`${E.name}${E.isDirectory?"/":""}
|
|
26
|
+
`}let u=[...o,...c],w;try{w=await R(u)}catch(h){return{stdout:"",stderr:`tar: error creating archive: ${h instanceof Error?h.message:"unknown error"}
|
|
27
|
+
`,exitCode:2}}try{await e.fs.writeFile(r,w)}catch(h){let p=h instanceof Error?h.message:"unknown error";return{stdout:"",stderr:`tar: ${t.file}: ${p}
|
|
28
|
+
`,exitCode:2}}let g=f;return l.length>0&&(g+=`${l.join(`
|
|
29
|
+
`)}
|
|
30
|
+
`),{stdout:"",stderr:g,exitCode:l.length>0?2:0}}async function Bt(e,t,i){if(!t.file||t.file==="-")return{stdout:"",stderr:`tar: Cannot update stdin/stdout
|
|
31
|
+
`,exitCode:2};if(i.length===0)return{stdout:"",stderr:`tar: Cowardly refusing to update with nothing
|
|
32
|
+
`,exitCode:2};let r=e.fs.resolvePath(e.cwd,t.file),n;try{n=await e.fs.readFileBuffer(r)}catch{return{stdout:"",stderr:`tar: ${t.file}: Cannot open: No such file or directory
|
|
33
|
+
`,exitCode:2}}let s=await k(n);if(s.error)return{stdout:"",stderr:`tar: ${s.error}
|
|
34
|
+
`,exitCode:2};let o=new Map;for(let m of s.entries)o.set(m.name,m.mtime);let a=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,c=[],l=[],f="";for(let m of i){let{entries:E,errors:y}=await V(e,a,m,t.exclude);l.push(...y);for(let b of E){let A=o.get(b.name);(!A||b.mtime&&b.mtime.getTime()>A.getTime())&&(c.push(b),t.verbose&&(f+=`${b.name}${b.isDirectory?"/":""}
|
|
35
|
+
`))}}if(c.length===0){let m="";return l.length>0&&(m=`${l.join(`
|
|
36
|
+
`)}
|
|
37
|
+
`),{stdout:"",stderr:m,exitCode:l.length>0?2:0}}let u=new Set(c.map(m=>m.name)),g=[...s.entries.filter(m=>!u.has(m.name)).map(m=>({name:m.name,content:m.content,mode:m.mode,mtime:m.mtime,isDirectory:m.type==="directory",isSymlink:m.type==="symlink",linkTarget:m.linkTarget,uid:m.uid,gid:m.gid})),...c],h;try{h=await R(g)}catch(m){return{stdout:"",stderr:`tar: error creating archive: ${m instanceof Error?m.message:"unknown error"}
|
|
38
|
+
`,exitCode:2}}try{await e.fs.writeFile(r,h)}catch(m){let E=m instanceof Error?m.message:"unknown error";return{stdout:"",stderr:`tar: ${t.file}: ${E}
|
|
39
|
+
`,exitCode:2}}let p=f;return l.length>0&&(p+=`${l.join(`
|
|
40
|
+
`)}
|
|
41
|
+
`),{stdout:"",stderr:p,exitCode:l.length>0?2:0}}async function $t(e,t,i){let r;if(t.file&&t.file!=="-"){let p=e.fs.resolvePath(e.cwd,t.file);try{r=await e.fs.readFileBuffer(p)}catch{return{stdout:"",stderr:`tar: ${t.file}: Cannot open: No such file or directory
|
|
42
|
+
`,exitCode:2}}}else r=Uint8Array.from(e.stdin,p=>p.charCodeAt(0));let n,s=t.gzip||ce(r),o=t.bzip2||le(r),a=t.xz||fe(r),c=t.zstd||me(r);if(s?n=await ae(r):o?n=await ue(r):a?n=await de(r):c?n=await he(r):n=await k(r),n.error)return{stdout:"",stderr:`tar: ${n.error}
|
|
43
|
+
`,exitCode:2};let l=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,f=t.absoluteNames?i:i.map(p=>p.replace(/^\/+/,"")).filter(p=>p.length>0),u="",w="",g=[];if(t.directory&&!t.toStdout)try{await e.fs.mkdir(l,{recursive:!0})}catch{}for(let p of n.entries){let m=qe(p.name,t.strip);if(!m)continue;let E=zt(m,t.absoluteNames);if(E.error){g.push(`tar: ${m}: ${E.error}`);continue}let y=E.safePath??"";if(!y)continue;let b=y.endsWith("/")?y.slice(0,-1):y;if(f.length>0){let U;if(t.wildcards?U=f.some(T=>Y(y,T)||Y(b,T)||y.startsWith(`${T}/`)):U=f.some(T=>y===T||y.startsWith(`${T}/`)||b===T),!U)continue}if(pe(y,t.exclude))continue;let A=e.fs.resolvePath(l,y);try{if(p.type==="directory"){if(t.toStdout)continue;await e.fs.mkdir(A,{recursive:!0}),t.verbose&&(u+=`${y}
|
|
44
|
+
`)}else if(p.type==="file"){if(t.toStdout){w+=new TextDecoder().decode(p.content),t.verbose&&(u+=`${y}
|
|
45
|
+
`);continue}if(t.keepOldFiles)try{await e.fs.stat(A),t.verbose&&(u+=`${y}: not overwritten, file exists
|
|
46
|
+
`);continue}catch{}let U=A.substring(0,A.lastIndexOf("/"));if(U)try{await e.fs.mkdir(U,{recursive:!0})}catch{}if(await e.fs.writeFile(A,p.content),t.preserve&&p.mode)try{await e.fs.chmod(A,p.mode)}catch{}t.verbose&&(u+=`${y}
|
|
47
|
+
`)}else if(p.type==="symlink"&&p.linkTarget){if(t.toStdout)continue;if(!t.absoluteNames&&(p.linkTarget.startsWith("/")||Ye(p.linkTarget))){g.push(`tar: ${y}: unsafe symlink target`);continue}if(t.keepOldFiles)try{await e.fs.stat(A),t.verbose&&(u+=`${y}: not overwritten, file exists
|
|
48
|
+
`);continue}catch{}let U=A.substring(0,A.lastIndexOf("/"));if(U)try{await e.fs.mkdir(U,{recursive:!0})}catch{}try{await e.fs.symlink(p.linkTarget,A)}catch{}t.verbose&&(u+=`${y}
|
|
49
|
+
`)}}catch(U){let T=U instanceof Error?U.message:"unknown error";g.push(`tar: ${y}: ${T}`)}}let h=u;return g.length>0&&(h+=`${g.join(`
|
|
50
|
+
`)}
|
|
51
|
+
`),{stdout:w,stderr:h,exitCode:g.length>0?2:0}}async function Zt(e,t,i){let r;if(t.file&&t.file!=="-"){let f=e.fs.resolvePath(e.cwd,t.file);try{r=await e.fs.readFileBuffer(f)}catch{return{stdout:"",stderr:`tar: ${t.file}: Cannot open: No such file or directory
|
|
52
|
+
`,exitCode:2}}}else r=Uint8Array.from(e.stdin,f=>f.charCodeAt(0));let n,s=t.gzip||ce(r),o=t.bzip2||le(r),a=t.xz||fe(r),c=t.zstd||me(r);if(s?n=await ae(r):o?n=await ue(r):a?n=await de(r):c?n=await he(r):n=await k(r),n.error)return{stdout:"",stderr:`tar: ${n.error}
|
|
53
|
+
`,exitCode:2};let l="";for(let f of n.entries){let u=qe(f.name,t.strip);if(!u)continue;let w=u.endsWith("/")?u.slice(0,-1):u;if(i.length>0){let g;if(t.wildcards?g=i.some(h=>Y(u,h)||Y(w,h)||u.startsWith(`${h}/`)):g=i.some(h=>u===h||u.startsWith(`${h}/`)||w===h),!g)continue}if(!pe(u,t.exclude))if(t.verbose){let g=f.type==="directory",h=ye(f.mode,g),p=`${f.uid}/${f.gid}`,m=f.size.toString().padStart(8," "),E=Rt(f.mtime),y=`${h} ${p.padEnd(10)} ${m} ${E} ${u}`;f.type==="symlink"&&f.linkTarget&&(y+=` -> ${f.linkTarget}`),l+=`${y}
|
|
54
|
+
`}else l+=`${u}
|
|
55
|
+
`}return{stdout:l,stderr:"",exitCode:0}}var tr={name:"tar",async execute(e,t){if(Se(e))return we(Ft);let i=Xe(e);if(!i.ok)return i.error;let{options:r,files:n}=i,s=[r.create,r.append,r.update,r.extract,r.list].filter(Boolean).length;if(s===0)return{stdout:"",stderr:`tar: You must specify one of -c, -r, -u, -x, or -t
|
|
56
|
+
`,exitCode:2};if(s>1)return{stdout:"",stderr:`tar: You may not specify more than one of -c, -r, -u, -x, or -t
|
|
57
|
+
`,exitCode:2};if(r.autoCompress&&r.file&&r.create){let c=r.file.toLowerCase();c.endsWith(".tar.gz")||c.endsWith(".tgz")?r.gzip=!0:c.endsWith(".tar.bz2")||c.endsWith(".tbz2")?r.bzip2=!0:c.endsWith(".tar.xz")||c.endsWith(".txz")?r.xz=!0:(c.endsWith(".tar.zst")||c.endsWith(".tzst"))&&(r.zstd=!0)}let o=[r.gzip,r.bzip2,r.xz,r.zstd].filter(Boolean).length;if(o>1)return{stdout:"",stderr:`tar: You may not specify more than one compression option
|
|
58
|
+
`,exitCode:2};if((r.append||r.update)&&o>0)return{stdout:"",stderr:`tar: Cannot append/update compressed archives - decompress first
|
|
59
|
+
`,exitCode:2};let a=n;if(r.filesFrom){let c=t.fs.resolvePath(t.cwd,r.filesFrom);try{let f=(await t.fs.readFile(c)).split(`
|
|
60
|
+
`).map(u=>u.trim()).filter(u=>u.length>0&&!u.startsWith("#"));a=[...n,...f]}catch{return{stdout:"",stderr:`tar: ${r.filesFrom}: Cannot open: No such file or directory
|
|
61
|
+
`,exitCode:2}}}if(r.excludeFrom){let c=t.fs.resolvePath(t.cwd,r.excludeFrom);try{let f=(await t.fs.readFile(c)).split(`
|
|
62
|
+
`).map(u=>u.trim()).filter(u=>u.length>0&&!u.startsWith("#"));r.exclude.push(...f)}catch{return{stdout:"",stderr:`tar: ${r.excludeFrom}: Cannot open: No such file or directory
|
|
63
|
+
`,exitCode:2}}}return r.create?Ot(t,r,a):r.append?Mt(t,r,a):r.update?Bt(t,r,a):r.extract?$t(t,r,a):Zt(t,r,a)}},rr={name:"tar",flags:[{flag:"-c",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-f",type:"value",valueHint:"path"},{flag:"-z",type:"boolean"},{flag:"-j",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-C",type:"value",valueHint:"path"},{flag:"--strip-components",type:"value",valueHint:"number"},{flag:"--exclude",type:"value",valueHint:"pattern"}],needsArgs:!0};export{tr as a,rr as b};
|
package/dist/bin/{shell/chunks/flag-coverage-LBMWMYOO.js → chunks/flag-coverage-NSXW5TJP.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{b as yr}from"./chunk-
|
|
2
|
+
import{b as yr}from"./chunk-VRUXUVWB.js";import{b as Ar}from"./chunk-L2JBII6Z.js";import{b as $r}from"./chunk-B3RU2PUI.js";import"./chunk-GZHFXDDO.js";import"./chunk-QSDVMMYI.js";import{c as Sr}from"./chunk-CM4532DS.js";import{b as wr}from"./chunk-XKPFI566.js";import{b as xr}from"./chunk-ORUYSLP4.js";import{b as vr}from"./chunk-IDGH4PGU.js";import{b as kr}from"./chunk-F3LGZXLQ.js";import{b as qr}from"./chunk-BYDV4VEF.js";import{b as Cr}from"./chunk-JLX6YWGA.js";import{b as br}from"./chunk-FLPVVSN5.js";import{d as Ir,e as Mr,f as jr}from"./chunk-54G6AE72.js";import{b as tr}from"./chunk-DOXYBGNA.js";import{b as lr}from"./chunk-WXMBDX4P.js";import{b as ur}from"./chunk-THALLNXT.js";import{b as pr}from"./chunk-NLBRLRWD.js";import{b as er}from"./chunk-3Y32LPNT.js";import{b as dr}from"./chunk-7BORMNPQ.js";import{b as cr}from"./chunk-N43DJTSI.js";import"./chunk-OBI37ZY4.js";import{b as hr}from"./chunk-N5OTVT4F.js";import{c as or,d as ar}from"./chunk-MAVV76T4.js";import{b as sr}from"./chunk-JTF74J6E.js";import{c as ir,d as gr}from"./chunk-GO6FXSC4.js";import{b as mr}from"./chunk-VHUYNUT7.js";import"./chunk-ZO5PSLKR.js";import{b as Fr}from"./chunk-GOJZHH3L.js";import{b as zr}from"./chunk-P6GNZPVW.js";import{b as fr}from"./chunk-LOJMXC4F.js";import{b as nr}from"./chunk-AXWFPG37.js";import"./chunk-YTIURC67.js";import{b as R}from"./chunk-PQNTKMH3.js";import{b as U}from"./chunk-PPBQJBC2.js";import{b as V}from"./chunk-NSUMEERA.js";import{b as W}from"./chunk-XY5HGZW5.js";import{c as X,d as Y}from"./chunk-AAW7UMPO.js";import{c as Z,d as _}from"./chunk-3MBAUIBB.js";import{b as N}from"./chunk-RT7TRQVZ.js";import{b as rr}from"./chunk-CQG2HEAL.js";import{b as G}from"./chunk-RJSAGJQJ.js";import{b as H}from"./chunk-YEKSVVRC.js";import{b as J}from"./chunk-26NO42TF.js";import{b as K}from"./chunk-LGJM5YFT.js";import{b as L}from"./chunk-LMK6G2HH.js";import{b as O}from"./chunk-ZKC5HQYO.js";import{b as P}from"./chunk-ROJPSS6N.js";import{b as Q}from"./chunk-THNL3XFF.js";import{b as y}from"./chunk-CGE2EHYP.js";import{b as A}from"./chunk-ZA4HUKJ3.js";import{b as $}from"./chunk-WWZVR5NN.js";import{b as S}from"./chunk-JQBC3FXE.js";import{b as T}from"./chunk-NAX7MTAR.js";import{b as B}from"./chunk-5G2VOPPJ.js";import{b as D}from"./chunk-SGA7Y45Z.js";import{b as E}from"./chunk-EUXCM6C4.js";import{b as w}from"./chunk-YLE2OYY6.js";import{b as x}from"./chunk-S7OHMN3F.js";import{b as v}from"./chunk-YWZOGBFE.js";import"./chunk-YMMJLYIX.js";import{d as k,e as q,f as C}from"./chunk-YFPDB4PH.js";import"./chunk-SXB55JOI.js";import{b}from"./chunk-HJEHIH4P.js";import"./chunk-V7ZOPVQS.js";import"./chunk-4OALHZXB.js";import"./chunk-G43H2WGH.js";import{b as I}from"./chunk-RMQC3GS7.js";import{b as M}from"./chunk-SDLWFYVT.js";import{b as j}from"./chunk-FA2CHD73.js";import{b as t}from"./chunk-EPPBDXOG.js";import{b as l}from"./chunk-PS4LOXE5.js";import{b as u}from"./chunk-VNER2XXL.js";import{b as p}from"./chunk-AZ3RUDR2.js";import{b as e}from"./chunk-7ADG3DNO.js";import{b as d}from"./chunk-TEFXEYX3.js";import{b as c}from"./chunk-ZSVBYEY4.js";import{b as h}from"./chunk-SXRVLCZ4.js";import"./chunk-FSZWFMB4.js";import"./chunk-LIYVQA3X.js";import"./chunk-OOJCYVYF.js";import"./chunk-4PRVMER6.js";import"./chunk-MO4RPBN2.js";import"./chunk-YU6OGPZR.js";import"./chunk-SE4C7FJY.js";import{b as i}from"./chunk-LJKIWB5F.js";import{b as g}from"./chunk-MRP4ZCD7.js";import"./chunk-5WFYIUU2.js";import{b as m}from"./chunk-ND23BJUM.js";import"./chunk-D5WP4CKS.js";import"./chunk-6KZRLMG3.js";import{b as F}from"./chunk-MXVNCVD6.js";import"./chunk-OBH7XN5N.js";import{b as z}from"./chunk-7G3MC56B.js";import"./chunk-RLNOQILG.js";import{b as f}from"./chunk-EJQKHROT.js";import"./chunk-JBABAK44.js";import{b as n}from"./chunk-ITA43A73.js";import"./chunk-4VDEBYW7.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var Er=[i,g,m,F,z,f,n,t,l,u,p,e,d,c,h,w,x,v,k,q,C,b,I,M,j,y,A,$,S,T,B,D,E,G,H,J,K,L,O,P,Q,R,U,V,W,X,Y,Z,_,N,rr,or,ar,sr,ir,gr,mr,Fr,zr,fr,nr,tr,lr,ur,pr,er,dr,cr,hr,wr,xr,vr,kr,qr,Cr,br,Ir,Mr,jr,yr,Ar,$r,Sr];function Tr(){return Er}var Br=new Map;for(let r of Tr())Br.set(r.name,new Set(r.flags.map(o=>o.flag)));function Fa(r,o,Dr){let a=Br.get(o);if(!(!a||a.size===0))for(let s of Dr)a.has(s)&&r.hit(`cmd:flag:${o}:${s}`)}export{Fa as emitFlagCoverage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a,b}from"./chunk-
|
|
2
|
+
import{a,b}from"./chunk-VRUXUVWB.js";import"./chunk-YMMJLYIX.js";import"./chunk-YU6OGPZR.js";import"./chunk-SE4C7FJY.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as tarCommand};
|
package/dist/bin/just-bash.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{B as Mr,C as Wr,D as le,E as Be,F as ee,G as $e,H as Ot,I as zr,J as x,K as Vr,L as Br,M as Ae,N as gs,O as Dt,P as j,a as Or,b as fs,c as Dr,d as Nt,e as Q,f as V,g as ve,h as se,i as Se,j as Re,k as ds,l as kt,m as Tr,n as hs,o as xr,p as me,q as Oe,r as Ir,s as Rr,t as ps,u as ms,v as Le,w as Lr,x as Fr,y as be,z as ys}from"./chunks/chunk-A3HQTYHR.js";import{a as M,b as W,c as Ke,d as Ct,e as Pt,f as Xe,g as us,h as _r,i as Cr,j as Pr,k as Nr,l as kr}from"./chunks/chunk-MY5PY2PL.js";import{c as cs}from"./chunks/chunk-LIYVQA3X.js";import{a as br,b as $r}from"./chunks/chunk-OOJCYVYF.js";import{a as Ie,b as pe,c as ls}from"./chunks/chunk-4PRVMER6.js";import{a as ut,b as Ar}from"./chunks/chunk-MO4RPBN2.js";import{a as Ge,b as ge}from"./chunks/chunk-YU6OGPZR.js";import{a as ct}from"./chunks/chunk-SE4C7FJY.js";import{a as ue,b as fe,c as oe,d as de,e as Er,f as B,g as Ve,h as Et,i as St,j as Sr,k as Y,l as At,m as xe,n as _t,o as we}from"./chunks/chunk-6KZRLMG3.js";import"./chunks/chunk-OBH7XN5N.js";import{a as he}from"./chunks/chunk-RLNOQILG.js";import{a as ke}from"./chunks/chunk-4VDEBYW7.js";import"./chunks/chunk-KGOUQS5A.js";import{resolve as Di}from"node:path";var Ye=[{name:"echo",load:async()=>(await import("./chunks/echo-2MUAOGUE.js")).echoCommand},{name:"cat",load:async()=>(await import("./chunks/cat-XZIJZXKP.js")).catCommand},{name:"printf",load:async()=>(await import("./chunks/printf-P3QVL4IO.js")).printfCommand},{name:"ls",load:async()=>(await import("./chunks/ls-G2PXHSNX.js")).lsCommand},{name:"mkdir",load:async()=>(await import("./chunks/mkdir-Z47OISSR.js")).mkdirCommand},{name:"rmdir",load:async()=>(await import("./chunks/rmdir-5KLM4EA6.js")).rmdirCommand},{name:"touch",load:async()=>(await import("./chunks/touch-DWKSZGOQ.js")).touchCommand},{name:"rm",load:async()=>(await import("./chunks/rm-L3NZOLLG.js")).rmCommand},{name:"cp",load:async()=>(await import("./chunks/cp-XH2ZB7WT.js")).cpCommand},{name:"mv",load:async()=>(await import("./chunks/mv-OY7X62QC.js")).mvCommand},{name:"ln",load:async()=>(await import("./chunks/ln-EGC4HRXZ.js")).lnCommand},{name:"chmod",load:async()=>(await import("./chunks/chmod-N5CQATDW.js")).chmodCommand},{name:"pwd",load:async()=>(await import("./chunks/pwd-6VBAPL3Y.js")).pwdCommand},{name:"readlink",load:async()=>(await import("./chunks/readlink-BD5VFOC5.js")).readlinkCommand},{name:"head",load:async()=>(await import("./chunks/head-YMNRW3F3.js")).headCommand},{name:"tail",load:async()=>(await import("./chunks/tail-V537TDFR.js")).tailCommand},{name:"wc",load:async()=>(await import("./chunks/wc-ZIV3TFVG.js")).wcCommand},{name:"stat",load:async()=>(await import("./chunks/stat-XS2LXYS2.js")).statCommand},{name:"grep",load:async()=>(await import("./chunks/grep-OZJTRD4D.js")).grepCommand},{name:"fgrep",load:async()=>(await import("./chunks/grep-OZJTRD4D.js")).fgrepCommand},{name:"egrep",load:async()=>(await import("./chunks/grep-OZJTRD4D.js")).egrepCommand},{name:"rg",load:async()=>(await import("./chunks/rg-C6KMBFNG.js")).rgCommand},{name:"sed",load:async()=>(await import("./chunks/sed-HALRQZKY.js")).sedCommand},{name:"awk",load:async()=>(await import("./chunks/awk2-VTJMI54B.js")).awkCommand2},{name:"sort",load:async()=>(await import("./chunks/sort-7GENYU2I.js")).sortCommand},{name:"uniq",load:async()=>(await import("./chunks/uniq-TMSAIZM3.js")).uniqCommand},{name:"comm",load:async()=>(await import("./chunks/comm-R3F3Z5DX.js")).commCommand},{name:"cut",load:async()=>(await import("./chunks/cut-5EY2XPXX.js")).cutCommand},{name:"paste",load:async()=>(await import("./chunks/paste-3UVLMQ2K.js")).pasteCommand},{name:"tr",load:async()=>(await import("./chunks/tr-4FPGAEVB.js")).trCommand},{name:"rev",load:async()=>(await import("./chunks/rev-UHEPS2UL.js")).rev},{name:"nl",load:async()=>(await import("./chunks/nl-XH3L75DR.js")).nl},{name:"fold",load:async()=>(await import("./chunks/fold-XSVNTAWH.js")).fold},{name:"expand",load:async()=>(await import("./chunks/expand-26XPP5KB.js")).expand},{name:"unexpand",load:async()=>(await import("./chunks/unexpand-OYZ7KOYR.js")).unexpand},{name:"strings",load:async()=>(await import("./chunks/strings-XXKZCWY5.js")).strings},{name:"split",load:async()=>(await import("./chunks/split-YWV64TJH.js")).split},{name:"column",load:async()=>(await import("./chunks/column-XGV32UPN.js")).column},{name:"join",load:async()=>(await import("./chunks/join-Y4Q5WVVE.js")).join},{name:"tee",load:async()=>(await import("./chunks/tee-HK2SYCAR.js")).teeCommand},{name:"find",load:async()=>(await import("./chunks/find-GAYRV4IF.js")).findCommand},{name:"basename",load:async()=>(await import("./chunks/basename-KBUKWB2E.js")).basenameCommand},{name:"dirname",load:async()=>(await import("./chunks/dirname-5FAOMLBL.js")).dirnameCommand},{name:"tree",load:async()=>(await import("./chunks/tree-HEKABARE.js")).treeCommand},{name:"du",load:async()=>(await import("./chunks/du-LDAPXSGF.js")).duCommand},{name:"env",load:async()=>(await import("./chunks/env-NTPN5QYM.js")).envCommand},{name:"printenv",load:async()=>(await import("./chunks/env-NTPN5QYM.js")).printenvCommand},{name:"alias",load:async()=>(await import("./chunks/alias-3GODYSFD.js")).aliasCommand},{name:"unalias",load:async()=>(await import("./chunks/alias-3GODYSFD.js")).unaliasCommand},{name:"history",load:async()=>(await import("./chunks/history-UUKG55YW.js")).historyCommand},{name:"xargs",load:async()=>(await import("./chunks/xargs-SCYIFXOW.js")).xargsCommand},{name:"true",load:async()=>(await import("./chunks/true-DP5UZP52.js")).trueCommand},{name:"false",load:async()=>(await import("./chunks/true-DP5UZP52.js")).falseCommand},{name:"clear",load:async()=>(await import("./chunks/clear-KRGKPFOI.js")).clearCommand},{name:"bash",load:async()=>(await import("./chunks/bash-6ZHZ6BX7.js")).bashCommand},{name:"sh",load:async()=>(await import("./chunks/bash-6ZHZ6BX7.js")).shCommand},{name:"jq",load:async()=>(await import("./chunks/jq-FIV5Q5T4.js")).jqCommand},{name:"base64",load:async()=>(await import("./chunks/base64-43M2R3GA.js")).base64Command},{name:"diff",load:async()=>(await import("./chunks/diff-LE7GMFZD.js")).diffCommand},{name:"date",load:async()=>(await import("./chunks/date-WUPBL2TL.js")).dateCommand},{name:"sleep",load:async()=>(await import("./chunks/sleep-ND6FZRZ4.js")).sleepCommand},{name:"timeout",load:async()=>(await import("./chunks/timeout-Z24MNWOP.js")).timeoutCommand},{name:"time",load:async()=>(await import("./chunks/time-5R4QWCYF.js")).timeCommand},{name:"seq",load:async()=>(await import("./chunks/seq-V7KBLSQ7.js")).seqCommand},{name:"expr",load:async()=>(await import("./chunks/expr-4CJYC4LY.js")).exprCommand},{name:"md5sum",load:async()=>(await import("./chunks/md5sum-NCLXV2S3.js")).md5sumCommand},{name:"sha1sum",load:async()=>(await import("./chunks/sha1sum-BHNJ5ALF.js")).sha1sumCommand},{name:"sha256sum",load:async()=>(await import("./chunks/sha256sum-HJJ3NJ5L.js")).sha256sumCommand},{name:"file",load:async()=>(await import("./chunks/file-D5YKS5NV.js")).fileCommand},{name:"html-to-markdown",load:async()=>(await import("./chunks/html-to-markdown-WVZA3MCP.js")).htmlToMarkdownCommand},{name:"help",load:async()=>(await import("./chunks/help-DVG4AAGE.js")).helpCommand},{name:"which",load:async()=>(await import("./chunks/which-5PO4LAOG.js")).whichCommand},{name:"tac",load:async()=>(await import("./chunks/tac-T42SKDDI.js")).tac},{name:"hostname",load:async()=>(await import("./chunks/hostname-WY6RKE32.js")).hostname},{name:"whoami",load:async()=>(await import("./chunks/whoami-E7PN2UWC.js")).whoami},{name:"od",load:async()=>(await import("./chunks/od-52FBC34W.js")).od},{name:"gzip",load:async()=>(await import("./chunks/gzip-LHOO65AN.js")).gzipCommand},{name:"gunzip",load:async()=>(await import("./chunks/gzip-LHOO65AN.js")).gunzipCommand},{name:"zcat",load:async()=>(await import("./chunks/gzip-LHOO65AN.js")).zcatCommand}];(typeof __BROWSER__>"u"||!__BROWSER__)&&(Ye.push({name:"tar",load:async()=>(await import("./chunks/tar-TOWX2TDU.js")).tarCommand}),Ye.push({name:"yq",load:async()=>(await import("./chunks/yq-Q47JUWL6.js")).yqCommand}),Ye.push({name:"xan",load:async()=>(await import("./chunks/xan-MOZFJGMY.js")).xanCommand}),Ye.push({name:"sqlite3",load:async()=>(await import("./chunks/sqlite3-CVNFMP3Z.js")).sqlite3Command}));var ws=[];(typeof __BROWSER__>"u"||!__BROWSER__)&&(ws.push({name:"python3",load:async()=>(await import("./chunks/python3-VCIXXAXF.js")).python3Command}),ws.push({name:"python",load:async()=>(await import("./chunks/python3-VCIXXAXF.js")).pythonCommand}));var vs=[];(typeof __BROWSER__>"u"||!__BROWSER__)&&(vs.push({name:"js-exec",load:async()=>(await import("./chunks/js-exec-BDQGEAU6.js")).jsExecCommand}),vs.push({name:"node",load:async()=>(await import("./chunks/js-exec-BDQGEAU6.js")).nodeStubCommand}));var Li=[{name:"curl",load:async()=>(await import("./chunks/curl-SRTMGOVV.js")).curlCommand}],jr=new Map;function Tt(e){return{name:e.name,async execute(t,s){let r=jr.get(e.name);if(r||(r=await ge.runTrustedAsync(()=>e.load()),jr.set(e.name,r)),s.coverage&&(typeof __BROWSER__>"u"||!__BROWSER__)){let{emitFlagCoverage:n}=await import("./chunks/flag-coverage-LBMWMYOO.js");n(s.coverage,e.name,t)}return r.execute(t,s)}}}function Hr(e){return(e?Ye.filter(s=>e.includes(s.name)):Ye).map(Tt)}function Ur(){return Li.map(Tt)}function Zr(){return ws.map(Tt)}function qr(){return vs.map(Tt)}function Gr(e){return"load"in e&&typeof e.load=="function"}function Kr(e){let t=null;return{name:e.name,trusted:!0,async execute(s,r){return t||(t=await e.load()),t.execute(s,r)}}}var Fi=new TextEncoder,Mi=new TextDecoder;function Qe(e,t){if(e instanceof Uint8Array)return e;if(t==="base64")return Uint8Array.from(atob(e),s=>s.charCodeAt(0));if(t==="hex"){let s=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)s[r/2]=parseInt(e.slice(r,r+2),16);return s}if(t==="binary"||t==="latin1"){if(e.length<=65536)return Uint8Array.from(e,n=>n.charCodeAt(0));let r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}return Fi.encode(e)}function xt(e,t){if(t==="base64"){if(typeof Buffer<"u")return Buffer.from(e).toString("base64");let s=65536,r="";for(let n=0;n<e.length;n+=s){let i=e.subarray(n,n+s);r+=String.fromCharCode(...i)}return btoa(r)}if(t==="hex")return Array.from(e).map(s=>s.toString(16).padStart(2,"0")).join("");if(t==="binary"||t==="latin1"){if(typeof Buffer<"u")return Buffer.from(e).toString(t);let s=65536;if(e.length<=s)return String.fromCharCode(...e);let r="";for(let n=0;n<e.length;n+=s){let i=e.subarray(n,n+s);r+=String.fromCharCode(...i)}return r}return Mi.decode(e)}function Fe(e){if(e!=null)return typeof e=="string"?e:e.encoding??void 0}var Je=new TextEncoder;function Wi(e){return typeof e=="object"&&e!==null&&!(e instanceof Uint8Array)&&"content"in e}var ft=class{data=new Map;constructor(t){if(this.data.set("/",{type:"directory",mode:493,mtime:new Date}),t)for(let[s,r]of Object.entries(t))typeof r=="function"?this.writeFileLazy(s,r):Wi(r)?this.writeFileSync(s,r.content,void 0,{mode:r.mode,mtime:r.mtime}):this.writeFileSync(s,r)}ensureParentDirs(t){let s=Ke(t);s!=="/"&&(this.data.has(s)||(this.ensureParentDirs(s),this.data.set(s,{type:"directory",mode:493,mtime:new Date})))}writeFileSync(t,s,r,n){W(t,"write");let i=M(t);this.ensureParentDirs(i);let o=Fe(r),a=Qe(s,o);this.data.set(i,{type:"file",content:a,mode:n?.mode??420,mtime:n?.mtime??new Date})}writeFileLazy(t,s,r){W(t,"write");let n=M(t);this.ensureParentDirs(n),this.data.set(n,{type:"file",lazy:s,mode:r?.mode??420,mtime:r?.mtime??new Date})}async materializeLazy(t,s){let r=await s.lazy(),i={type:"file",content:typeof r=="string"?Je.encode(r):r,mode:s.mode,mtime:s.mtime};return this.data.set(t,i),i}async readFile(t,s){let r=await this.readFileBuffer(t),n=Fe(s);return xt(r,n)}async readFileBuffer(t){W(t,"open");let s=this.resolvePathWithSymlinks(t),r=this.data.get(s);if(!r)throw new Error(`ENOENT: no such file or directory, open '${t}'`);if(r.type!=="file")throw new Error(`EISDIR: illegal operation on a directory, read '${t}'`);if("lazy"in r){let n=await this.materializeLazy(s,r);return n.content instanceof Uint8Array?n.content:Je.encode(n.content)}return r.content instanceof Uint8Array?r.content:Je.encode(r.content)}async writeFile(t,s,r){this.writeFileSync(t,s,r)}async appendFile(t,s,r){W(t,"append");let n=M(t),i=this.data.get(n);if(i&&i.type==="directory")throw new Error(`EISDIR: illegal operation on a directory, write '${t}'`);let o=Fe(r),a=Qe(s,o);if(i?.type==="file"){let l=i;"lazy"in l&&(l=await this.materializeLazy(n,l));let u="content"in l&&l.content instanceof Uint8Array?l.content:Je.encode("content"in l?l.content:""),c=new Uint8Array(u.length+a.length);c.set(u),c.set(a,u.length),this.data.set(n,{type:"file",content:c,mode:l.mode,mtime:new Date})}else this.writeFileSync(t,s,r)}async exists(t){if(t.includes("\0"))return!1;try{let s=this.resolvePathWithSymlinks(t);return this.data.has(s)}catch{return!1}}async stat(t){W(t,"stat");let s=this.resolvePathWithSymlinks(t),r=this.data.get(s);if(!r)throw new Error(`ENOENT: no such file or directory, stat '${t}'`);r.type==="file"&&"lazy"in r&&(r=await this.materializeLazy(s,r));let n=0;return r.type==="file"&&"content"in r&&r.content&&(r.content instanceof Uint8Array?n=r.content.length:n=Je.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:n,mtime:r.mtime||new Date}}async lstat(t){W(t,"lstat");let s=this.resolveIntermediateSymlinks(t),r=this.data.get(s);if(!r)throw new Error(`ENOENT: no such file or directory, lstat '${t}'`);if(r.type==="symlink")return{isFile:!1,isDirectory:!1,isSymbolicLink:!0,mode:r.mode,size:r.target.length,mtime:r.mtime||new Date};r.type==="file"&&"lazy"in r&&(r=await this.materializeLazy(s,r));let n=0;return r.type==="file"&&"content"in r&&r.content&&(r.content instanceof Uint8Array?n=r.content.length:n=Je.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:n,mtime:r.mtime||new Date}}resolveIntermediateSymlinks(t){let s=M(t);if(s==="/")return"/";let r=s.slice(1).split("/");if(r.length<=1)return s;let n="",i=new Set;for(let o=0;o<r.length-1;o++){let a=r[o];n=`${n}/${a}`;let l=this.data.get(n),u=0,c=40;for(;l&&l.type==="symlink"&&u<c;){if(i.has(n))throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`);i.add(n),n=Xe(n,l.target),l=this.data.get(n),u++}if(u>=c)throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`)}return`${n}/${r[r.length-1]}`}resolvePathWithSymlinks(t){let s=M(t);if(s==="/")return"/";let r=s.slice(1).split("/"),n="",i=new Set;for(let o of r){n=`${n}/${o}`;let a=this.data.get(n),l=0,u=40;for(;a&&a.type==="symlink"&&l<u;){if(i.has(n))throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`);i.add(n),n=Xe(n,a.target),a=this.data.get(n),l++}if(l>=u)throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`)}return n}async mkdir(t,s){this.mkdirSync(t,s)}mkdirSync(t,s){W(t,"mkdir");let r=M(t);if(this.data.has(r)){if(this.data.get(r)?.type==="file")throw new Error(`EEXIST: file already exists, mkdir '${t}'`);if(!s?.recursive)throw new Error(`EEXIST: directory already exists, mkdir '${t}'`);return}let n=Ke(r);if(n!=="/"&&!this.data.has(n))if(s?.recursive)this.mkdirSync(n,{recursive:!0});else throw new Error(`ENOENT: no such file or directory, mkdir '${t}'`);this.data.set(r,{type:"directory",mode:493,mtime:new Date})}async readdir(t){return(await this.readdirWithFileTypes(t)).map(r=>r.name)}async readdirWithFileTypes(t){W(t,"scandir");let s=M(t),r=this.data.get(s);if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${t}'`);let n=new Set;for(;r&&r.type==="symlink";){if(n.has(s))throw new Error(`ELOOP: too many levels of symbolic links, scandir '${t}'`);n.add(s),s=Xe(s,r.target),r=this.data.get(s)}if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${t}'`);if(r.type!=="directory")throw new Error(`ENOTDIR: not a directory, scandir '${t}'`);let i=s==="/"?"/":`${s}/`,o=new Map;for(let[a,l]of this.data.entries())if(a!==s&&a.startsWith(i)){let u=a.slice(i.length),c=u.split("/")[0];c&&!u.includes("/",c.length)&&!o.has(c)&&o.set(c,{name:c,isFile:l.type==="file",isDirectory:l.type==="directory",isSymbolicLink:l.type==="symlink"})}return Array.from(o.values()).sort((a,l)=>a.name<l.name?-1:a.name>l.name?1:0)}async rm(t,s){W(t,"rm");let r=M(t),n=this.data.get(r);if(!n){if(s?.force)return;throw new Error(`ENOENT: no such file or directory, rm '${t}'`)}if(n.type==="directory"){let i=await this.readdir(r);if(i.length>0){if(!s?.recursive)throw new Error(`ENOTEMPTY: directory not empty, rm '${t}'`);for(let o of i){let a=Pt(r,o);await this.rm(a,s)}}}this.data.delete(r)}async cp(t,s,r){W(t,"cp"),W(s,"cp");let n=M(t),i=M(s),o=this.data.get(n);if(!o)throw new Error(`ENOENT: no such file or directory, cp '${t}'`);if(o.type==="file")if(this.ensureParentDirs(i),"content"in o){let a=o.content instanceof Uint8Array?new Uint8Array(o.content):o.content;this.data.set(i,{...o,content:a})}else this.data.set(i,{...o});else if(o.type==="symlink")this.ensureParentDirs(i),this.data.set(i,{...o});else if(o.type==="directory"){if(!r?.recursive)throw new Error(`EISDIR: is a directory, cp '${t}'`);await this.mkdir(i,{recursive:!0});let a=await this.readdir(n);for(let l of a){let u=Pt(n,l),c=Pt(i,l);await this.cp(u,c,r)}}}async mv(t,s){await this.cp(t,s,{recursive:!0}),await this.rm(t,{recursive:!0})}getAllPaths(){return Array.from(this.data.keys())}resolvePath(t,s){return Ct(t,s)}async chmod(t,s){W(t,"chmod");let r=M(t),n=this.data.get(r);if(!n)throw new Error(`ENOENT: no such file or directory, chmod '${t}'`);n.mode=s}async symlink(t,s){W(s,"symlink");let r=M(s);if(this.data.has(r))throw new Error(`EEXIST: file already exists, symlink '${s}'`);this.ensureParentDirs(r),this.data.set(r,{type:"symlink",target:t,mode:511,mtime:new Date})}async link(t,s){W(t,"link"),W(s,"link");let r=M(t),n=M(s),i=this.data.get(r);if(!i)throw new Error(`ENOENT: no such file or directory, link '${t}'`);if(i.type!=="file")throw new Error(`EPERM: operation not permitted, link '${t}'`);if(this.data.has(n))throw new Error(`EEXIST: file already exists, link '${s}'`);let o=i;"lazy"in o&&(o=await this.materializeLazy(r,o)),this.ensureParentDirs(n),this.data.set(n,{type:"file",content:o.content,mode:o.mode,mtime:o.mtime})}async readlink(t){W(t,"readlink");let s=M(t),r=this.data.get(s);if(!r)throw new Error(`ENOENT: no such file or directory, readlink '${t}'`);if(r.type!=="symlink")throw new Error(`EINVAL: invalid argument, readlink '${t}'`);return r.target}async realpath(t){W(t,"realpath");let s=this.resolvePathWithSymlinks(t);if(!this.data.has(s))throw new Error(`ENOENT: no such file or directory, realpath '${t}'`);return s}async utimes(t,s,r){W(t,"utimes");let n=M(t),i=this.resolvePathWithSymlinks(n),o=this.data.get(i);if(!o)throw new Error(`ENOENT: no such file or directory, utimes '${t}'`);o.mtime=r}};function zi(e){let t=e;return typeof t.mkdirSync=="function"&&typeof t.writeFileSync=="function"}function Vi(e,t){e.mkdirSync("/bin",{recursive:!0}),e.mkdirSync("/usr/bin",{recursive:!0}),t&&(e.mkdirSync("/home/user",{recursive:!0}),e.mkdirSync("/tmp",{recursive:!0}))}function Bi(e){e.mkdirSync("/dev",{recursive:!0}),e.writeFileSync("/dev/null",""),e.writeFileSync("/dev/zero",new Uint8Array(0)),e.writeFileSync("/dev/stdin",""),e.writeFileSync("/dev/stdout",""),e.writeFileSync("/dev/stderr","")}function ji(e,t){e.mkdirSync("/proc/self/fd",{recursive:!0}),e.writeFileSync("/proc/version",`${Or}
|
|
2
|
+
import{B as Mr,C as Wr,D as le,E as Be,F as ee,G as $e,H as Ot,I as zr,J as x,K as Vr,L as Br,M as Ae,N as gs,O as Dt,P as j,a as Or,b as fs,c as Dr,d as Nt,e as Q,f as V,g as ve,h as se,i as Se,j as Re,k as ds,l as kt,m as Tr,n as hs,o as xr,p as me,q as Oe,r as Ir,s as Rr,t as ps,u as ms,v as Le,w as Lr,x as Fr,y as be,z as ys}from"./chunks/chunk-A3HQTYHR.js";import{a as M,b as W,c as Ke,d as Ct,e as Pt,f as Xe,g as us,h as _r,i as Cr,j as Pr,k as Nr,l as kr}from"./chunks/chunk-MY5PY2PL.js";import{c as cs}from"./chunks/chunk-LIYVQA3X.js";import{a as br,b as $r}from"./chunks/chunk-OOJCYVYF.js";import{a as Ie,b as pe,c as ls}from"./chunks/chunk-4PRVMER6.js";import{a as ut,b as Ar}from"./chunks/chunk-MO4RPBN2.js";import{a as Ge,b as ge}from"./chunks/chunk-YU6OGPZR.js";import{a as ct}from"./chunks/chunk-SE4C7FJY.js";import{a as ue,b as fe,c as oe,d as de,e as Er,f as B,g as Ve,h as Et,i as St,j as Sr,k as Y,l as At,m as xe,n as _t,o as we}from"./chunks/chunk-6KZRLMG3.js";import"./chunks/chunk-OBH7XN5N.js";import{a as he}from"./chunks/chunk-RLNOQILG.js";import{a as ke}from"./chunks/chunk-4VDEBYW7.js";import"./chunks/chunk-KGOUQS5A.js";import{resolve as Di}from"node:path";var Ye=[{name:"echo",load:async()=>(await import("./chunks/echo-2MUAOGUE.js")).echoCommand},{name:"cat",load:async()=>(await import("./chunks/cat-XZIJZXKP.js")).catCommand},{name:"printf",load:async()=>(await import("./chunks/printf-P3QVL4IO.js")).printfCommand},{name:"ls",load:async()=>(await import("./chunks/ls-G2PXHSNX.js")).lsCommand},{name:"mkdir",load:async()=>(await import("./chunks/mkdir-Z47OISSR.js")).mkdirCommand},{name:"rmdir",load:async()=>(await import("./chunks/rmdir-5KLM4EA6.js")).rmdirCommand},{name:"touch",load:async()=>(await import("./chunks/touch-DWKSZGOQ.js")).touchCommand},{name:"rm",load:async()=>(await import("./chunks/rm-L3NZOLLG.js")).rmCommand},{name:"cp",load:async()=>(await import("./chunks/cp-XH2ZB7WT.js")).cpCommand},{name:"mv",load:async()=>(await import("./chunks/mv-OY7X62QC.js")).mvCommand},{name:"ln",load:async()=>(await import("./chunks/ln-EGC4HRXZ.js")).lnCommand},{name:"chmod",load:async()=>(await import("./chunks/chmod-N5CQATDW.js")).chmodCommand},{name:"pwd",load:async()=>(await import("./chunks/pwd-6VBAPL3Y.js")).pwdCommand},{name:"readlink",load:async()=>(await import("./chunks/readlink-BD5VFOC5.js")).readlinkCommand},{name:"head",load:async()=>(await import("./chunks/head-YMNRW3F3.js")).headCommand},{name:"tail",load:async()=>(await import("./chunks/tail-V537TDFR.js")).tailCommand},{name:"wc",load:async()=>(await import("./chunks/wc-ZIV3TFVG.js")).wcCommand},{name:"stat",load:async()=>(await import("./chunks/stat-XS2LXYS2.js")).statCommand},{name:"grep",load:async()=>(await import("./chunks/grep-OZJTRD4D.js")).grepCommand},{name:"fgrep",load:async()=>(await import("./chunks/grep-OZJTRD4D.js")).fgrepCommand},{name:"egrep",load:async()=>(await import("./chunks/grep-OZJTRD4D.js")).egrepCommand},{name:"rg",load:async()=>(await import("./chunks/rg-C6KMBFNG.js")).rgCommand},{name:"sed",load:async()=>(await import("./chunks/sed-HALRQZKY.js")).sedCommand},{name:"awk",load:async()=>(await import("./chunks/awk2-VTJMI54B.js")).awkCommand2},{name:"sort",load:async()=>(await import("./chunks/sort-7GENYU2I.js")).sortCommand},{name:"uniq",load:async()=>(await import("./chunks/uniq-TMSAIZM3.js")).uniqCommand},{name:"comm",load:async()=>(await import("./chunks/comm-R3F3Z5DX.js")).commCommand},{name:"cut",load:async()=>(await import("./chunks/cut-5EY2XPXX.js")).cutCommand},{name:"paste",load:async()=>(await import("./chunks/paste-3UVLMQ2K.js")).pasteCommand},{name:"tr",load:async()=>(await import("./chunks/tr-4FPGAEVB.js")).trCommand},{name:"rev",load:async()=>(await import("./chunks/rev-UHEPS2UL.js")).rev},{name:"nl",load:async()=>(await import("./chunks/nl-XH3L75DR.js")).nl},{name:"fold",load:async()=>(await import("./chunks/fold-XSVNTAWH.js")).fold},{name:"expand",load:async()=>(await import("./chunks/expand-26XPP5KB.js")).expand},{name:"unexpand",load:async()=>(await import("./chunks/unexpand-OYZ7KOYR.js")).unexpand},{name:"strings",load:async()=>(await import("./chunks/strings-XXKZCWY5.js")).strings},{name:"split",load:async()=>(await import("./chunks/split-YWV64TJH.js")).split},{name:"column",load:async()=>(await import("./chunks/column-XGV32UPN.js")).column},{name:"join",load:async()=>(await import("./chunks/join-Y4Q5WVVE.js")).join},{name:"tee",load:async()=>(await import("./chunks/tee-HK2SYCAR.js")).teeCommand},{name:"find",load:async()=>(await import("./chunks/find-GAYRV4IF.js")).findCommand},{name:"basename",load:async()=>(await import("./chunks/basename-KBUKWB2E.js")).basenameCommand},{name:"dirname",load:async()=>(await import("./chunks/dirname-5FAOMLBL.js")).dirnameCommand},{name:"tree",load:async()=>(await import("./chunks/tree-HEKABARE.js")).treeCommand},{name:"du",load:async()=>(await import("./chunks/du-LDAPXSGF.js")).duCommand},{name:"env",load:async()=>(await import("./chunks/env-NTPN5QYM.js")).envCommand},{name:"printenv",load:async()=>(await import("./chunks/env-NTPN5QYM.js")).printenvCommand},{name:"alias",load:async()=>(await import("./chunks/alias-3GODYSFD.js")).aliasCommand},{name:"unalias",load:async()=>(await import("./chunks/alias-3GODYSFD.js")).unaliasCommand},{name:"history",load:async()=>(await import("./chunks/history-UUKG55YW.js")).historyCommand},{name:"xargs",load:async()=>(await import("./chunks/xargs-SCYIFXOW.js")).xargsCommand},{name:"true",load:async()=>(await import("./chunks/true-DP5UZP52.js")).trueCommand},{name:"false",load:async()=>(await import("./chunks/true-DP5UZP52.js")).falseCommand},{name:"clear",load:async()=>(await import("./chunks/clear-KRGKPFOI.js")).clearCommand},{name:"bash",load:async()=>(await import("./chunks/bash-6ZHZ6BX7.js")).bashCommand},{name:"sh",load:async()=>(await import("./chunks/bash-6ZHZ6BX7.js")).shCommand},{name:"jq",load:async()=>(await import("./chunks/jq-FIV5Q5T4.js")).jqCommand},{name:"base64",load:async()=>(await import("./chunks/base64-43M2R3GA.js")).base64Command},{name:"diff",load:async()=>(await import("./chunks/diff-LE7GMFZD.js")).diffCommand},{name:"date",load:async()=>(await import("./chunks/date-WUPBL2TL.js")).dateCommand},{name:"sleep",load:async()=>(await import("./chunks/sleep-ND6FZRZ4.js")).sleepCommand},{name:"timeout",load:async()=>(await import("./chunks/timeout-Z24MNWOP.js")).timeoutCommand},{name:"time",load:async()=>(await import("./chunks/time-5R4QWCYF.js")).timeCommand},{name:"seq",load:async()=>(await import("./chunks/seq-V7KBLSQ7.js")).seqCommand},{name:"expr",load:async()=>(await import("./chunks/expr-4CJYC4LY.js")).exprCommand},{name:"md5sum",load:async()=>(await import("./chunks/md5sum-NCLXV2S3.js")).md5sumCommand},{name:"sha1sum",load:async()=>(await import("./chunks/sha1sum-BHNJ5ALF.js")).sha1sumCommand},{name:"sha256sum",load:async()=>(await import("./chunks/sha256sum-HJJ3NJ5L.js")).sha256sumCommand},{name:"file",load:async()=>(await import("./chunks/file-D5YKS5NV.js")).fileCommand},{name:"html-to-markdown",load:async()=>(await import("./chunks/html-to-markdown-WVZA3MCP.js")).htmlToMarkdownCommand},{name:"help",load:async()=>(await import("./chunks/help-DVG4AAGE.js")).helpCommand},{name:"which",load:async()=>(await import("./chunks/which-5PO4LAOG.js")).whichCommand},{name:"tac",load:async()=>(await import("./chunks/tac-T42SKDDI.js")).tac},{name:"hostname",load:async()=>(await import("./chunks/hostname-WY6RKE32.js")).hostname},{name:"whoami",load:async()=>(await import("./chunks/whoami-E7PN2UWC.js")).whoami},{name:"od",load:async()=>(await import("./chunks/od-52FBC34W.js")).od},{name:"gzip",load:async()=>(await import("./chunks/gzip-LHOO65AN.js")).gzipCommand},{name:"gunzip",load:async()=>(await import("./chunks/gzip-LHOO65AN.js")).gunzipCommand},{name:"zcat",load:async()=>(await import("./chunks/gzip-LHOO65AN.js")).zcatCommand}];(typeof __BROWSER__>"u"||!__BROWSER__)&&(Ye.push({name:"tar",load:async()=>(await import("./chunks/tar-DNUNEW4Z.js")).tarCommand}),Ye.push({name:"yq",load:async()=>(await import("./chunks/yq-Q47JUWL6.js")).yqCommand}),Ye.push({name:"xan",load:async()=>(await import("./chunks/xan-MOZFJGMY.js")).xanCommand}),Ye.push({name:"sqlite3",load:async()=>(await import("./chunks/sqlite3-CVNFMP3Z.js")).sqlite3Command}));var ws=[];(typeof __BROWSER__>"u"||!__BROWSER__)&&(ws.push({name:"python3",load:async()=>(await import("./chunks/python3-VCIXXAXF.js")).python3Command}),ws.push({name:"python",load:async()=>(await import("./chunks/python3-VCIXXAXF.js")).pythonCommand}));var vs=[];(typeof __BROWSER__>"u"||!__BROWSER__)&&(vs.push({name:"js-exec",load:async()=>(await import("./chunks/js-exec-BDQGEAU6.js")).jsExecCommand}),vs.push({name:"node",load:async()=>(await import("./chunks/js-exec-BDQGEAU6.js")).nodeStubCommand}));var Li=[{name:"curl",load:async()=>(await import("./chunks/curl-SRTMGOVV.js")).curlCommand}],jr=new Map;function Tt(e){return{name:e.name,async execute(t,s){let r=jr.get(e.name);if(r||(r=await ge.runTrustedAsync(()=>e.load()),jr.set(e.name,r)),s.coverage&&(typeof __BROWSER__>"u"||!__BROWSER__)){let{emitFlagCoverage:n}=await import("./chunks/flag-coverage-NSXW5TJP.js");n(s.coverage,e.name,t)}return r.execute(t,s)}}}function Hr(e){return(e?Ye.filter(s=>e.includes(s.name)):Ye).map(Tt)}function Ur(){return Li.map(Tt)}function Zr(){return ws.map(Tt)}function qr(){return vs.map(Tt)}function Gr(e){return"load"in e&&typeof e.load=="function"}function Kr(e){let t=null;return{name:e.name,trusted:!0,async execute(s,r){return t||(t=await e.load()),t.execute(s,r)}}}var Fi=new TextEncoder,Mi=new TextDecoder;function Qe(e,t){if(e instanceof Uint8Array)return e;if(t==="base64")return Uint8Array.from(atob(e),s=>s.charCodeAt(0));if(t==="hex"){let s=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)s[r/2]=parseInt(e.slice(r,r+2),16);return s}if(t==="binary"||t==="latin1"){if(e.length<=65536)return Uint8Array.from(e,n=>n.charCodeAt(0));let r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}return Fi.encode(e)}function xt(e,t){if(t==="base64"){if(typeof Buffer<"u")return Buffer.from(e).toString("base64");let s=65536,r="";for(let n=0;n<e.length;n+=s){let i=e.subarray(n,n+s);r+=String.fromCharCode(...i)}return btoa(r)}if(t==="hex")return Array.from(e).map(s=>s.toString(16).padStart(2,"0")).join("");if(t==="binary"||t==="latin1"){if(typeof Buffer<"u")return Buffer.from(e).toString(t);let s=65536;if(e.length<=s)return String.fromCharCode(...e);let r="";for(let n=0;n<e.length;n+=s){let i=e.subarray(n,n+s);r+=String.fromCharCode(...i)}return r}return Mi.decode(e)}function Fe(e){if(e!=null)return typeof e=="string"?e:e.encoding??void 0}var Je=new TextEncoder;function Wi(e){return typeof e=="object"&&e!==null&&!(e instanceof Uint8Array)&&"content"in e}var ft=class{data=new Map;constructor(t){if(this.data.set("/",{type:"directory",mode:493,mtime:new Date}),t)for(let[s,r]of Object.entries(t))typeof r=="function"?this.writeFileLazy(s,r):Wi(r)?this.writeFileSync(s,r.content,void 0,{mode:r.mode,mtime:r.mtime}):this.writeFileSync(s,r)}ensureParentDirs(t){let s=Ke(t);s!=="/"&&(this.data.has(s)||(this.ensureParentDirs(s),this.data.set(s,{type:"directory",mode:493,mtime:new Date})))}writeFileSync(t,s,r,n){W(t,"write");let i=M(t);this.ensureParentDirs(i);let o=Fe(r),a=Qe(s,o);this.data.set(i,{type:"file",content:a,mode:n?.mode??420,mtime:n?.mtime??new Date})}writeFileLazy(t,s,r){W(t,"write");let n=M(t);this.ensureParentDirs(n),this.data.set(n,{type:"file",lazy:s,mode:r?.mode??420,mtime:r?.mtime??new Date})}async materializeLazy(t,s){let r=await s.lazy(),i={type:"file",content:typeof r=="string"?Je.encode(r):r,mode:s.mode,mtime:s.mtime};return this.data.set(t,i),i}async readFile(t,s){let r=await this.readFileBuffer(t),n=Fe(s);return xt(r,n)}async readFileBuffer(t){W(t,"open");let s=this.resolvePathWithSymlinks(t),r=this.data.get(s);if(!r)throw new Error(`ENOENT: no such file or directory, open '${t}'`);if(r.type!=="file")throw new Error(`EISDIR: illegal operation on a directory, read '${t}'`);if("lazy"in r){let n=await this.materializeLazy(s,r);return n.content instanceof Uint8Array?n.content:Je.encode(n.content)}return r.content instanceof Uint8Array?r.content:Je.encode(r.content)}async writeFile(t,s,r){this.writeFileSync(t,s,r)}async appendFile(t,s,r){W(t,"append");let n=M(t),i=this.data.get(n);if(i&&i.type==="directory")throw new Error(`EISDIR: illegal operation on a directory, write '${t}'`);let o=Fe(r),a=Qe(s,o);if(i?.type==="file"){let l=i;"lazy"in l&&(l=await this.materializeLazy(n,l));let u="content"in l&&l.content instanceof Uint8Array?l.content:Je.encode("content"in l?l.content:""),c=new Uint8Array(u.length+a.length);c.set(u),c.set(a,u.length),this.data.set(n,{type:"file",content:c,mode:l.mode,mtime:new Date})}else this.writeFileSync(t,s,r)}async exists(t){if(t.includes("\0"))return!1;try{let s=this.resolvePathWithSymlinks(t);return this.data.has(s)}catch{return!1}}async stat(t){W(t,"stat");let s=this.resolvePathWithSymlinks(t),r=this.data.get(s);if(!r)throw new Error(`ENOENT: no such file or directory, stat '${t}'`);r.type==="file"&&"lazy"in r&&(r=await this.materializeLazy(s,r));let n=0;return r.type==="file"&&"content"in r&&r.content&&(r.content instanceof Uint8Array?n=r.content.length:n=Je.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:n,mtime:r.mtime||new Date}}async lstat(t){W(t,"lstat");let s=this.resolveIntermediateSymlinks(t),r=this.data.get(s);if(!r)throw new Error(`ENOENT: no such file or directory, lstat '${t}'`);if(r.type==="symlink")return{isFile:!1,isDirectory:!1,isSymbolicLink:!0,mode:r.mode,size:r.target.length,mtime:r.mtime||new Date};r.type==="file"&&"lazy"in r&&(r=await this.materializeLazy(s,r));let n=0;return r.type==="file"&&"content"in r&&r.content&&(r.content instanceof Uint8Array?n=r.content.length:n=Je.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:n,mtime:r.mtime||new Date}}resolveIntermediateSymlinks(t){let s=M(t);if(s==="/")return"/";let r=s.slice(1).split("/");if(r.length<=1)return s;let n="",i=new Set;for(let o=0;o<r.length-1;o++){let a=r[o];n=`${n}/${a}`;let l=this.data.get(n),u=0,c=40;for(;l&&l.type==="symlink"&&u<c;){if(i.has(n))throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`);i.add(n),n=Xe(n,l.target),l=this.data.get(n),u++}if(u>=c)throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`)}return`${n}/${r[r.length-1]}`}resolvePathWithSymlinks(t){let s=M(t);if(s==="/")return"/";let r=s.slice(1).split("/"),n="",i=new Set;for(let o of r){n=`${n}/${o}`;let a=this.data.get(n),l=0,u=40;for(;a&&a.type==="symlink"&&l<u;){if(i.has(n))throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`);i.add(n),n=Xe(n,a.target),a=this.data.get(n),l++}if(l>=u)throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`)}return n}async mkdir(t,s){this.mkdirSync(t,s)}mkdirSync(t,s){W(t,"mkdir");let r=M(t);if(this.data.has(r)){if(this.data.get(r)?.type==="file")throw new Error(`EEXIST: file already exists, mkdir '${t}'`);if(!s?.recursive)throw new Error(`EEXIST: directory already exists, mkdir '${t}'`);return}let n=Ke(r);if(n!=="/"&&!this.data.has(n))if(s?.recursive)this.mkdirSync(n,{recursive:!0});else throw new Error(`ENOENT: no such file or directory, mkdir '${t}'`);this.data.set(r,{type:"directory",mode:493,mtime:new Date})}async readdir(t){return(await this.readdirWithFileTypes(t)).map(r=>r.name)}async readdirWithFileTypes(t){W(t,"scandir");let s=M(t),r=this.data.get(s);if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${t}'`);let n=new Set;for(;r&&r.type==="symlink";){if(n.has(s))throw new Error(`ELOOP: too many levels of symbolic links, scandir '${t}'`);n.add(s),s=Xe(s,r.target),r=this.data.get(s)}if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${t}'`);if(r.type!=="directory")throw new Error(`ENOTDIR: not a directory, scandir '${t}'`);let i=s==="/"?"/":`${s}/`,o=new Map;for(let[a,l]of this.data.entries())if(a!==s&&a.startsWith(i)){let u=a.slice(i.length),c=u.split("/")[0];c&&!u.includes("/",c.length)&&!o.has(c)&&o.set(c,{name:c,isFile:l.type==="file",isDirectory:l.type==="directory",isSymbolicLink:l.type==="symlink"})}return Array.from(o.values()).sort((a,l)=>a.name<l.name?-1:a.name>l.name?1:0)}async rm(t,s){W(t,"rm");let r=M(t),n=this.data.get(r);if(!n){if(s?.force)return;throw new Error(`ENOENT: no such file or directory, rm '${t}'`)}if(n.type==="directory"){let i=await this.readdir(r);if(i.length>0){if(!s?.recursive)throw new Error(`ENOTEMPTY: directory not empty, rm '${t}'`);for(let o of i){let a=Pt(r,o);await this.rm(a,s)}}}this.data.delete(r)}async cp(t,s,r){W(t,"cp"),W(s,"cp");let n=M(t),i=M(s),o=this.data.get(n);if(!o)throw new Error(`ENOENT: no such file or directory, cp '${t}'`);if(o.type==="file")if(this.ensureParentDirs(i),"content"in o){let a=o.content instanceof Uint8Array?new Uint8Array(o.content):o.content;this.data.set(i,{...o,content:a})}else this.data.set(i,{...o});else if(o.type==="symlink")this.ensureParentDirs(i),this.data.set(i,{...o});else if(o.type==="directory"){if(!r?.recursive)throw new Error(`EISDIR: is a directory, cp '${t}'`);await this.mkdir(i,{recursive:!0});let a=await this.readdir(n);for(let l of a){let u=Pt(n,l),c=Pt(i,l);await this.cp(u,c,r)}}}async mv(t,s){await this.cp(t,s,{recursive:!0}),await this.rm(t,{recursive:!0})}getAllPaths(){return Array.from(this.data.keys())}resolvePath(t,s){return Ct(t,s)}async chmod(t,s){W(t,"chmod");let r=M(t),n=this.data.get(r);if(!n)throw new Error(`ENOENT: no such file or directory, chmod '${t}'`);n.mode=s}async symlink(t,s){W(s,"symlink");let r=M(s);if(this.data.has(r))throw new Error(`EEXIST: file already exists, symlink '${s}'`);this.ensureParentDirs(r),this.data.set(r,{type:"symlink",target:t,mode:511,mtime:new Date})}async link(t,s){W(t,"link"),W(s,"link");let r=M(t),n=M(s),i=this.data.get(r);if(!i)throw new Error(`ENOENT: no such file or directory, link '${t}'`);if(i.type!=="file")throw new Error(`EPERM: operation not permitted, link '${t}'`);if(this.data.has(n))throw new Error(`EEXIST: file already exists, link '${s}'`);let o=i;"lazy"in o&&(o=await this.materializeLazy(r,o)),this.ensureParentDirs(n),this.data.set(n,{type:"file",content:o.content,mode:o.mode,mtime:o.mtime})}async readlink(t){W(t,"readlink");let s=M(t),r=this.data.get(s);if(!r)throw new Error(`ENOENT: no such file or directory, readlink '${t}'`);if(r.type!=="symlink")throw new Error(`EINVAL: invalid argument, readlink '${t}'`);return r.target}async realpath(t){W(t,"realpath");let s=this.resolvePathWithSymlinks(t);if(!this.data.has(s))throw new Error(`ENOENT: no such file or directory, realpath '${t}'`);return s}async utimes(t,s,r){W(t,"utimes");let n=M(t),i=this.resolvePathWithSymlinks(n),o=this.data.get(i);if(!o)throw new Error(`ENOENT: no such file or directory, utimes '${t}'`);o.mtime=r}};function zi(e){let t=e;return typeof t.mkdirSync=="function"&&typeof t.writeFileSync=="function"}function Vi(e,t){e.mkdirSync("/bin",{recursive:!0}),e.mkdirSync("/usr/bin",{recursive:!0}),t&&(e.mkdirSync("/home/user",{recursive:!0}),e.mkdirSync("/tmp",{recursive:!0}))}function Bi(e){e.mkdirSync("/dev",{recursive:!0}),e.writeFileSync("/dev/null",""),e.writeFileSync("/dev/zero",new Uint8Array(0)),e.writeFileSync("/dev/stdin",""),e.writeFileSync("/dev/stdout",""),e.writeFileSync("/dev/stderr","")}function ji(e,t){e.mkdirSync("/proc/self/fd",{recursive:!0}),e.writeFileSync("/proc/version",`${Or}
|
|
3
3
|
`),e.writeFileSync("/proc/self/exe","/bin/bash"),e.writeFileSync("/proc/self/cmdline","bash\0"),e.writeFileSync("/proc/self/comm",`bash
|
|
4
4
|
`),e.writeFileLazy?e.writeFileLazy("/proc/self/status",()=>fs(t)):e.writeFileSync("/proc/self/status",fs(t)),e.writeFileSync("/proc/self/fd/0","/dev/stdin"),e.writeFileSync("/proc/self/fd/1","/dev/stdout"),e.writeFileSync("/proc/self/fd/2","/dev/stderr")}function Xr(e,t,s={pid:1,ppid:0,uid:1e3,gid:1e3}){zi(e)&&(Vi(e,t),Bi(e),ji(e,s))}var Hi=["allexport","errexit","noglob","noclobber","noexec","nounset","pipefail","posix","verbose","xtrace"],Ui=["braceexpand","hashall","interactive-comments"];function $s(e){let t=[],s=[...Ui.map(r=>({name:r,enabled:!0})),...Hi.map(r=>({name:r,enabled:e[r]}))].sort((r,n)=>r.name.localeCompare(n.name));for(let r of s)r.enabled&&t.push(r.name);return t.join(":")}function tt(e){e.state.env.set("SHELLOPTS",$s(e.state.options))}var Zi=["dotglob","expand_aliases","extglob","failglob","globskipdots","globstar","lastpipe","nocaseglob","nocasematch","nullglob","xpg_echo"];function Es(e){let t=[];for(let s of Zi)e[s]&&t.push(s);return t.join(":")}function Ss(e){e.state.env.set("BASHOPTS",Es(e.state.shoptOptions))}var qi="BASH_ALIAS_";function Yr(e){return e.parts.length!==1?!1:e.parts[0].type==="Literal"}function Qr(e){if(e.parts.length!==1)return null;let t=e.parts[0];return t.type==="Literal"?t.value:null}function Jr(e,t){return e.env.get(`${qi}${t}`)}function As(e,t,s){if(!t.name||!Yr(t.name))return t;let r=Qr(t.name);if(!r)return t;let n=Jr(e,r);if(!n||s.has(r))return t;try{s.add(r);let i=new V,o=n,a=n.endsWith(" ");if(!a)for(let f of t.args){let d=tn(f);o+=` ${d}`}let l;try{l=i.parse(o)}catch(f){if(f instanceof Nt)throw f;return t}if(l.statements.length!==1||l.statements[0].pipelines.length!==1||l.statements[0].pipelines[0].commands.length!==1)return en(t,n);let u=l.statements[0].pipelines[0].commands[0];if(u.type!=="SimpleCommand")return en(t,n);let c={...u,assignments:[...t.assignments,...u.assignments],redirections:[...u.redirections,...t.redirections],line:t.line};if(a&&t.args.length>0&&(c={...c,args:[...c.args,...t.args]},c.args.length>0)){let f=c.args[0];if(Yr(f)){let d=Qr(f);if(d&&Jr(e,d)){let h={type:"SimpleCommand",name:f,args:c.args.slice(1),assignments:[],redirections:[]},p=As(e,h,s);p!==h&&(c={...c,name:p.name,args:[...p.args]})}}}return c}catch(i){throw s.delete(r),i}}function en(e,t){let s=t;for(let o of e.args){let a=tn(o);s+=` ${a}`}let r=new V,n=r.parseWordFromString("eval",!1,!1),i=r.parseWordFromString(`'${s.replace(/'/g,"'\\''")}'`,!1,!1);return{type:"SimpleCommand",name:n,args:[i],assignments:e.assignments,redirections:e.redirections,line:e.line}}function tn(e){let t="";for(let s of e.parts)switch(s.type){case"Literal":t+=s.value.replace(/([\s"'$`\\*?[\]{}()<>|&;#!])/g,"\\$1");break;case"SingleQuoted":t+=`'${s.value}'`;break;case"DoubleQuoted":t+=`"${s.parts.map(r=>r.type==="Literal"?r.value:`$${r.type}`).join("")}"`;break;case"ParameterExpansion":t+=`\${${s.parameter}}`;break;case"CommandSubstitution":t+="$(...)";break;case"ArithmeticExpansion":t+=`$((${s.expression}))`;break;case"Glob":t+=s.pattern;break;default:break}return t}async function sn(e,t){let s=t.parts.map(c=>c.type==="Literal"?c.value:"\0").join(""),r=s.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);if(!r||!s.endsWith(")"))return null;let n=r[1],i=[],o=!1,a="",l=!1;for(let c of t.parts)if(c.type==="Literal"){let f=c.value;if(!o){let d=f.indexOf("=(");d!==-1&&(o=!0,f=f.slice(d+2))}if(o){f.endsWith(")")&&(f=f.slice(0,-1));let d=f.split(/(\s+)/);for(let h of d)/^\s+$/.test(h)?(a||l)&&(i.push(a),a="",l=!1):h&&(a+=h)}}else if(o)if(c.type==="BraceExpansion")if(/^\[.+\]=/.test(a))a+=kt({type:"Word",parts:[c]});else{(a||l)&&(i.push(a),a="",l=!1);let d=await Ae(e,{type:"Word",parts:[c]});i.push(...d.values)}else{(c.type==="SingleQuoted"||c.type==="DoubleQuoted"||c.type==="Escaped")&&(l=!0);let f=await x(e,{type:"Word",parts:[c]});a+=f}(a||l)&&i.push(a);let u=i.map(c=>/^\[.+\]=/.test(c)?c:c===""?"''":/[\s"'\\$`!*?[\]{}|&;<>()]/.test(c)&&!c.startsWith("'")&&!c.startsWith('"')?`'${c.replace(/'/g,"'\\''")}'`:c);return`${n}=(${u.join(" ")})`}async function rn(e,t){let s=-1,r=-1,n=!1;for(let m=0;m<t.parts.length;m++){let y=t.parts[m];if(y.type==="Literal"){let b=y.value.indexOf("+=");if(b!==-1){let A=y.value.slice(0,b);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(A)){s=m,r=b,n=!0;break}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(A)){s=m,r=b,n=!0;break}}let v=y.value.indexOf("=");if(v!==-1&&(v===0||y.value[v-1]!=="+")){let A=y.value.slice(0,v);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(A)||/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(A)){s=m,r=v;break}}}}if(s===-1)return null;let i=t.parts.slice(0,s),o=t.parts[s];if(o.type!=="Literal")return null;let a=n?2:1,l=o.value.slice(0,r),u=o.value.slice(r+a),c=t.parts.slice(s+1),f="";for(let m of i)f+=await x(e,{type:"Word",parts:[m]});f+=l;let d={type:"Word",parts:u!==""?[{type:"Literal",value:u},...c]:c},h=d.parts.length>0?await x(e,d):"";return`${f}${n?"+=":"="}${h}`}var Gi=["tar","yq","xan","sqlite3","python3","python"];function nn(e){return Gi.includes(e)}var L=Object.freeze({stdout:"",stderr:"",exitCode:0});function F(e=""){return{stdout:e,stderr:"",exitCode:0}}function _(e,t=1){return{stdout:"",stderr:e,exitCode:t}}function P(e,t,s){return{stdout:e,stderr:t,exitCode:s}}function X(e){return{stdout:"",stderr:"",exitCode:e?0:1}}function _e(e,t,s="",r=""){throw new Y(e,t,s,r)}function ie(e){let t=e.state.fileDescriptors;if(t&&t.size>=e.limits.maxFileDescriptors)throw new Y(`too many open file descriptors (max ${e.limits.maxFileDescriptors})`,"file_descriptors")}function _s(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new xe;return L}if(t.length>1)throw new B(1,"",`bash: break: too many arguments
|
|
5
5
|
`);let s=1;if(t.length>0){let r=Number.parseInt(t[0],10);if(Number.isNaN(r)||r<1)throw new B(128,"",`bash: break: ${t[0]}: numeric argument required
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as ye}from"./chunk-YMMJLYIX.js";import{b as ee}from"./chunk-YU6OGPZR.js";import{a as O}from"./chunk-SE4C7FJY.js";import{a as we,b as Se,c as te}from"./chunk-GTNBSMZR.js";var ie="file",_e="link",Te="symlink",H="directory",Ve={file:"0",link:"1",symlink:"2","character-device":"3","block-device":"4",directory:"5",fifo:"6","pax-header":"x","pax-global-header":"g","gnu-long-name":"L","gnu-long-link-name":"K"},Je={0:ie,1:_e,2:Te,3:"character-device",4:"block-device",5:H,6:"fifo",x:"pax-header",g:"pax-global-header",L:"gnu-long-name",K:"gnu-long-link-name"},Qe=new Uint8Array(512),G=new Uint8Array(0),M=new TextEncoder,xe=new TextDecoder;function z(e,t,i,r){r&&M.encodeInto(r,e.subarray(t,t+i))}function B(e,t,i,r){if(r===void 0)return;let n=r.toString(8).padStart(i-1,"0");M.encodeInto(n,e.subarray(t,t+i-1))}function v(e,t,i){let r=e.indexOf(0,t),n=r===-1||r>t+i?t+i:r;return xe.decode(e.subarray(t,n))}function se(e,t,i){let r=0,n=t+i;for(let s=t;s<n;s++){let o=e[s];if(o===0)break;o!==32&&(r=r*8+(o-48))}return r}function D(e,t,i){if(e[t]&128){let r=0;r=e[t]&127;for(let n=1;n<i;n++)r=r*256+e[t+n];if(!Number.isSafeInteger(r))throw new Error("TAR number too large");return r}return se(e,t,i)}var Z=e=>e.type===H||e.type===Te||e.type===_e;async function Ce(e){if(e==null)return G;if(e instanceof Uint8Array)return e;if(typeof e=="string")return M.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(e instanceof Blob)return new Uint8Array(await e.arrayBuffer());throw new TypeError("Unsupported content type for entry body.")}function be(e,t){let{strip:i,filter:r,map:n}=t;if(!i&&!r&&!n)return e;let s={...e};if(i&&i>0){let a=s.name.split("/").filter(Boolean);if(i>=a.length)return null;let c=a.slice(i).join("/");if(s.name=s.type===H&&!c.endsWith("/")?`${c}/`:c,s.linkname?.startsWith("/")){let l=s.linkname.split("/").filter(Boolean);s.linkname=i>=l.length?"/":`/${l.slice(i).join("/")}`}}if(r?.(s)===!1)return null;let o=n?n(s):s;return o&&(!o.name||!o.name.trim()||o.name==="."||o.name==="/")?null:o}var ne=32,et=48;function tt(e){let t=se(e,148,8),i=0;for(let r=0;r<e.length;r++)r>=148&&r<156?i+=ne:i+=e[r];return t===i}function rt(e){e.fill(ne,148,156);let t=0;for(let i of e)t+=i;for(let i=153;i>=148;i--)e[i]=(t&7)+et,t>>=3;e[154]=0,e[155]=ne}function nt(e){let t={};e.name.length>100&&Ue(e.name)===null&&(t.path=e.name),e.linkname&&e.linkname.length>100&&(t.linkpath=e.linkname),e.uname&&e.uname.length>32&&(t.uname=e.uname),e.gname&&e.gname.length>32&&(t.gname=e.gname),e.uid!=null&&e.uid>2097151&&(t.uid=String(e.uid)),e.gid!=null&&e.gid>2097151&&(t.gid=String(e.gid)),e.size!=null&&e.size>8589934591&&(t.size=String(e.size)),e.pax&&Object.assign(t,e.pax);let i=Object.entries(t);if(i.length===0)return null;let r=M.encode(i.map(([n,s])=>{let o=`${n}=${s}
|
|
3
|
+
`,a=M.encode(o).length+1,c=a+String(a).length;return c=a+String(c).length,`${c} ${o}`}).join(""));return{paxHeader:Ie({name:xe.decode(M.encode(`PaxHeader/${e.name}`).slice(0,100)),size:r.length,type:"pax-header",mode:420,mtime:e.mtime,uname:e.uname,gname:e.gname,uid:e.uid,gid:e.gid}),paxBody:r}}function Ue(e){if(e.length<=100)return null;let t=e.length-100-1,i=e.lastIndexOf("/",155);return i>0&&i>=t?{prefix:e.slice(0,i),name:e.slice(i+1)}:null}function Ie(e){let t=new Uint8Array(512),i=Z(e)?0:e.size??0,r=e.name,n="";if(!e.pax?.path){let s=Ue(r);s&&(r=s.name,n=s.prefix)}return z(t,0,100,r),B(t,100,8,e.mode??(e.type===H?493:420)),B(t,108,8,e.uid??0),B(t,116,8,e.gid??0),B(t,124,12,i),B(t,136,12,Math.floor((e.mtime?.getTime()??Date.now())/1e3)),z(t,156,1,Ve[e.type??ie]),z(t,157,100,e.linkname),z(t,257,6,"ustar\0"),z(t,263,2,"00"),z(t,265,32,e.uname),z(t,297,32,e.gname),z(t,345,155,n),rt(t),t}function it(e,t){if(t&&!tt(e))throw new Error("Invalid tar header checksum.");let i=v(e,156,1),r={name:v(e,0,100),mode:se(e,100,8),uid:D(e,108,8),gid:D(e,116,8),size:D(e,124,12),mtime:new Date(D(e,136,12)*1e3),type:Je[i]||ie,linkname:v(e,157,100)},n=v(e,257,6);return n.trim()==="ustar"&&(r.uname=v(e,265,32),r.gname=v(e,297,32)),n==="ustar"&&(r.prefix=v(e,345,155)),r}var st={path:["name",e=>e],linkpath:["linkname",e=>e],size:["size",e=>parseInt(e,10)],mtime:["mtime",parseFloat],uid:["uid",e=>parseInt(e,10)],gid:["gid",e=>parseInt(e,10)],uname:["uname",e=>e],gname:["gname",e=>e]};function ot(e){let t=new TextDecoder("utf-8"),i={},r={},n=0;for(;n<e.length;){let s=e.indexOf(32,n);if(s===-1)break;let o=parseInt(t.decode(e.subarray(n,s)),10);if(Number.isNaN(o)||o===0)break;let a=n+o,[c,l]=t.decode(e.subarray(s+1,a-1)).split("=",2);if(c&&l!==void 0){r[c]=l;let f=st[c];if(f){let[u,w]=f,g=w(l);(typeof g=="string"||!Number.isNaN(g))&&(i[u]=g)}}n=a}return Object.keys(r).length>0&&(i.pax=r),i}function Ee(e,t){t.name!==void 0&&(e.name=t.name),t.linkname!==void 0&&(e.linkname=t.linkname),t.size!==void 0&&(e.size=t.size),t.mtime!==void 0&&(e.mtime=new Date(t.mtime*1e3)),t.uid!==void 0&&(e.uid=t.uid),t.gid!==void 0&&(e.gid=t.gid),t.uname!==void 0&&(e.uname=t.uname),t.gname!==void 0&&(e.gname=t.gname),t.pax&&(e.pax=Object.assign({},e.pax??{},t.pax))}function at(e){switch(e){case"pax-global-header":case"pax-header":return ot;case"gnu-long-name":return t=>({name:v(t,0,t.length)});case"gnu-long-link-name":return t=>({linkname:v(t,0,t.length)});default:return}}function ct(e){let t=Ie(e),i=nt(e);if(!i)return[t];let r=-i.paxBody.length&511,n=r>0?[Qe.subarray(0,r)]:[];return[i.paxHeader,i.paxBody,...n,t]}var lt=new Uint8Array(512*2);function ve(e,t,i){let r=null,n=0,s=!1;return{add(o){if(s){let a=new Error("No new tar entries after finalize.");throw t(a),a}if(r!==null){let a=new Error("Previous entry must be completed before adding a new one");throw t(a),a}try{let a=Z(o)?0:o.size??0,c=ct({...o,size:a});for(let l of c)e(l);r={...o,size:a},n=0}catch(a){t(a)}},write(o){if(!r){let c=new Error("No active tar entry.");throw t(c),c}if(s){let c=new Error("Cannot write data after finalize.");throw t(c),c}let a=n+o.length;if(a>r.size){let c=new Error(`"${r.name}" exceeds given size of ${r.size} bytes.`);throw t(c),c}try{n=a,e(o)}catch(c){t(c)}},endEntry(){if(!r){let o=new Error("No active entry to end.");throw t(o),o}if(s){let o=new Error("Cannot end entry after finalize.");throw t(o),o}try{if(n!==r.size){let a=new Error(`Size mismatch for "${r.name}".`);throw t(a),a}let o=-r.size&511;o>0&&e(new Uint8Array(o)),r=null,n=0}catch(o){throw t(o),o}},finalize(){if(s){let o=new Error("Archive has already been finalized");throw t(o),o}if(r!==null){let o=new Error("Cannot finalize while an entry is still active");throw t(o),o}try{e(lt),s=!0,i&&i()}catch(o){t(o)}}}}var P=256;function ft(){let e=new Array(P),t=e.length-1,i=0,r=0,n=0,s=a=>{let c=e[i];a===c.length?(e[i]=G,i=i+1&t):e[i]=c.subarray(a),n-=a,n===0&&e.length>P&&(e=new Array(P),t=P-1,i=0,r=0)};function o(a,c){if(c){let g=0,h=Math.min(a,n);for(;h>0;){let p=e[i],m=Math.min(h,p.length),E=m===p.length?p:p.subarray(0,m);if(s(m),h-=m,g+=m,!c(E))break}return g}if(n<a)return null;if(a===0)return G;let l=e[i];if(l.length>=a){let g=l.length===a?l:l.subarray(0,a);return s(a),g}let f=new Uint8Array(a),u=0,w=a;for(;w>0;){let g=e[i],h=Math.min(w,g.length);f.set(h===g.length?g:g.subarray(0,h),u),u+=h,w-=h,s(h)}return f}return{push:a=>{if(a.length===0)return;let c=r+1&t;if(c===i){let l=e.length,f=l*2,u=new Array(f),w=r-i+l&l-1;if(i<r)for(let g=0;g<w;g++)u[g]=e[i+g];else if(w>0){let g=l-i;for(let h=0;h<g;h++)u[h]=e[i+h];for(let h=0;h<r;h++)u[g+h]=e[h]}e=u,t=f-1,i=0,r=w,c=r+1&t}e[r]=a,r=c,n+=a.length},available:()=>n,peek:a=>{if(n<a)return null;if(a===0)return G;let c=e[i];if(c.length>=a)return c.length===a?c:c.subarray(0,a);let l=new Uint8Array(a),f=0,u=i;for(;f<a;){let w=e[u],g=Math.min(a-f,w.length);g===w.length?l.set(w,f):l.set(w.subarray(0,g),f),f+=g,u=u+1&t}return l},discard:a=>{if(a>n)throw new Error("Too many bytes consumed");if(a===0)return;let c=a;for(;c>0;){let l=e[i],f=Math.min(c,l.length);s(f),c-=f}},pull:o}}var re=0,$=1,K=new Error("Tar archive is truncated.");function ke(e={}){let t=e.strict??!1,{available:i,peek:r,push:n,discard:s,pull:o}=ft(),a=re,c=!1,l=!1,f=!1,u=null,w={},g={},h={isEntryActive:()=>a===$,isBodyComplete:()=>!u||u.remaining===0,write(p){if(c)throw new Error("Archive already ended.");n(p)},end(){c=!0},readHeader(){if(a!==re)throw new Error("Cannot read header while an entry is active");if(!l)for(;!l;){if(i()<512){if(c){if(i()>0&&t)throw K;l=!0;return}return null}let p=r(512);if(Ae(p)){if(i()<512*2){if(c){if(t)throw K;l=!0;return}return null}if(Ae(r(512*2).subarray(512))){s(512*2),l=!0,f=!0;return}if(t)throw new Error("Invalid tar header.");s(512);continue}let m;try{m=it(p,t)}catch(b){if(t)throw b;s(512);continue}let E=at(m.type);if(E){let b=m.size+511&-512;if(i()<512+b){if(c&&t)throw K;return null}s(512);let A=E(o(b).subarray(0,m.size)),U=m.type==="pax-global-header"?w:g;for(let T in A)U[T]=A[T];continue}s(512);let y=m;return m.prefix&&(y.name=`${m.prefix}/${y.name}`),Ee(y,w),Ee(y,g),g={},u={header:y,remaining:y.size,padding:-y.size&511},a=$,y}},streamBody(p){if(a!==$||!u||u.remaining===0)return 0;let m=Math.min(u.remaining,i());if(m===0)return 0;let E=o(m,p);return u.remaining-=E,E},skipPadding(){if(a!==$||!u)return!0;if(u.remaining>0)throw new Error("Body not fully consumed");return i()<u.padding?!1:(s(u.padding),u=null,a=re,!0)},skipEntry(){if(a!==$||!u)return!0;let p=Math.min(u.remaining,i());return p>0&&(s(p),u.remaining-=p),u.remaining>0?!1:h.skipPadding()},validateEOF(){if(t){if(!f)throw K;if(i()>0&&o(i()).some(p=>p!==0))throw new Error("Invalid EOF.")}}};return h}function Ae(e){if(e.byteOffset%8===0){let t=new BigUint64Array(e.buffer,e.byteOffset,e.length/8);for(let i=0;i<t.length;i++)if(t[i]!==0n)return!1;return!0}for(let t=0;t<e.length;t++)if(e[t]!==0)return!1;return!0}function ze(){return new CompressionStream("gzip")}function Re(){return new DecompressionStream("gzip")}function ut(){let e,t;return{readable:new ReadableStream({start(i){e=i,t=ve(i.enqueue.bind(i),i.error.bind(i),i.close.bind(i))}}),controller:{add(i){let r=Z(i),n={...i};return r&&(n.size=0),t.add(n),r&&t.endEntry(),new WritableStream({write(s){t.write(s)},close(){r||t.endEntry()},abort(s){e.error(s)}})},finalize(){t.finalize()},error(i){e.error(i)}}}}async function Oe(e){let t=[],i=e.getReader(),r=0;try{for(;;){let{done:o,value:a}=await i.read();if(o)break;t.push(a),r+=a.length}let n=new Uint8Array(r),s=0;for(let o of t)n.set(o,s),s+=o.length;return n}finally{i.releaseLock()}}var Fe=e=>e.pipeTo(new WritableStream);function dt(e={}){let t=ke(e),i=null,r=!1,n=s=>{if(!r){r=!0;try{for(;;)if(t.isEntryActive()){if(i){if(t.streamBody(o=>(i.enqueue(o),!0))===0&&!t.isBodyComplete())break}else if(!t.skipEntry())break;if(t.isBodyComplete()){try{i?.close()}catch{}if(i=null,!t.skipPadding())break}}else{let o=t.readHeader();if(o==null)break;s.enqueue({header:o,body:new ReadableStream({start(a){o.size===0?a.close():i=a},pull:()=>n(s),cancel(){i=null,n(s)}})})}}catch(o){try{i?.error(o)}catch{}throw i=null,o}finally{r=!1}}};return new TransformStream({transform(s,o){try{t.write(s),n(o)}catch(a){try{i?.error(a)}catch{}throw a}},flush(s){try{if(t.end(),n(s),t.validateEOF(),t.isEntryActive()&&!t.isBodyComplete())try{i?.close()}catch{}}catch(o){try{i?.error(o)}catch{}throw o}}},void 0,{highWaterMark:1})}async function Me(e){let{readable:t,controller:i}=ut();return await(async()=>{for(let r of e){let n=i.add(r.header),s="body"in r?r.body:r.data;if(!s){await n.close();continue}if(s instanceof ReadableStream)await s.pipeTo(n);else if(s instanceof Blob)await s.stream().pipeTo(n);else try{let o=await Ce(s);if(o.length>0){let a=n.getWriter();await a.write(o),await a.close()}else await n.close()}catch{throw new TypeError(`Unsupported content type for entry "${r.header.name}".`)}}})().then(()=>i.finalize()).catch(r=>i.error(r)),new Uint8Array(await Oe(t))}async function Be(e,t={}){let i=e instanceof ReadableStream?e:new ReadableStream({start(s){s.enqueue(e instanceof Uint8Array?e:new Uint8Array(e)),s.close()}}),r=[],n=i.pipeThrough(dt(t));for await(let s of n){let o;try{o=be(s.header,t)}catch(a){throw await s.body.cancel(),a}if(o===null){await Fe(s.body);continue}Z(o)?(await Fe(s.body),r.push({header:o})):r.push({header:o,data:await Oe(s.body)})}return r}import Tt from"seek-bzip";var mt=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let i=t<<24;for(let r=0;r<8;r++)i=i&2147483648?i<<1^79764919:i<<1;e[t]=i>>>0}return e})();function ht(e,t){return(e<<8^mt[(e>>>24^t)&255])>>>0}var oe=class{buffer=[];current=0;bitCount=0;writeBits(t,i){for(let r=t-1;r>=0;r--)this.current=this.current<<1|i>>>r&1,this.bitCount++,this.bitCount===8&&(this.buffer.push(this.current),this.current=0,this.bitCount=0)}writeBit(t){this.current=this.current<<1|t&1,this.bitCount++,this.bitCount===8&&(this.buffer.push(this.current),this.current=0,this.bitCount=0)}finish(){return this.bitCount>0&&this.buffer.push(this.current<<8-this.bitCount),new Uint8Array(this.buffer)}};function pt(e){let t=[],i=0;for(;i<e.length;){let r=e[i],n=1;for(;i+n<e.length&&e[i+n]===r&&n<255;)n++;n>=4?(t.push(r,r,r,r),t.push(n-4),i+=n):(t.push(r),i++)}return new Uint8Array(t)}function gt(e){let t=e.length;if(t===0)return{transformed:new Uint8Array(0),pointer:0};let i=wt(e),r=new Uint8Array(t),n=0;for(let s=0;s<t;s++)i[s]===0?(n=s,r[s]=e[t-1]):r[s]=e[i[s]-1];return{transformed:r,pointer:n}}function wt(e){let t=e.length,i=new Int32Array(t),r=new Int32Array(t);for(let n=0;n<t;n++)i[n]=n,r[n]=e[n];for(let n=1;n<t;n*=2){let s=r.slice();i.sort((o,a)=>s[o]!==s[a]?s[o]-s[a]:s[(o+n)%t]-s[(a+n)%t]),r[i[0]]=0;for(let o=1;o<t;o++)s[i[o]]===s[i[o-1]]&&s[(i[o]+n)%t]===s[(i[o-1]+n)%t]?r[i[o]]=r[i[o-1]]:r[i[o]]=r[i[o-1]]+1;if(r[i[t-1]]===t-1)break}return i}function St(e,t){let i=[];for(let o=0;o<256;o++)t[o]&&i.push(o);let r=new Array(256).fill(-1);for(let o=0;o<i.length;o++)r[i[o]]=o;let n=new Uint16Array(e.length),s=i.slice();for(let o=0;o<e.length;o++){let a=e[o],c=0;for(;s[c]!==a;)c++;if(n[o]=c,c>0){let l=s[c];for(let f=c;f>0;f--)s[f]=s[f-1];s[0]=l}}return{encoded:n,length:e.length}}function yt(e,t,i){let s=i+1,o=[],a=0;for(;a<t;)if(e[a]===0){let l=0;for(;a<t&&e[a]===0;)l++,a++;let f=l;for(;f>0;)f--,f&1?o.push(1):o.push(0),f>>>=1}else o.push(e[a]+1),a++;o.push(s);let c=new Uint16Array(o.length);for(let l=0;l<o.length;l++)c[l]=o[l];return{symbols:c,length:o.length,eob:s}}function $e(e,t,i){if(t<=1){let l=new Array(e.length).fill(0);for(let f=0;f<e.length;f++)e[f]>0&&(l[f]=1);return{codeLengths:l,maxLen:1,minLen:1}}let r=[];for(let l=0;l<e.length;l++)e[l]>0&&r.push({freq:e[l],symbol:l,left:null,right:null});if(r.length===0)return{codeLengths:new Array(e.length).fill(0),maxLen:0,minLen:0};if(r.length===1){let l=new Array(e.length).fill(0);return l[r[0].symbol]=1,{codeLengths:l,maxLen:1,minLen:1}}for(;r.length>1;){r.sort((u,w)=>u.freq-w.freq);let l=r.shift(),f=r.shift();r.push({freq:l.freq+f.freq,symbol:-1,left:l,right:f})}let n=new Array(e.length).fill(0);function s(l,f){if(!l.left&&!l.right){n[l.symbol]=f;return}l.left&&s(l.left,f+1),l.right&&s(l.right,f+1)}s(r[0],0);let o=!0;for(;o;){o=!1;for(let l=0;l<n.length;l++)n[l]>i&&(n[l]=i,o=!0);if(o){let l=0;for(let f=0;f<n.length;f++)n[f]>0&&(l+=1/(1<<n[f]));if(l>1)for(let f=1;f<i&&l>1;f++)for(let u=0;u<n.length&&l>1;u++)n[u]===f&&(n[u]++,l-=1/(1<<f)-1/(1<<f+1));o=!1;for(let f=0;f<n.length;f++)if(n[f]>i){o=!0;break}}}let a=i,c=0;for(let l=0;l<n.length;l++)n[l]>0&&(n[l]<a&&(a=n[l]),n[l]>c&&(c=n[l]));return{codeLengths:n,maxLen:c,minLen:a}}function Et(e,t){let i=new Array(t).fill(0),r=e.slice(0,t),n=Math.max(...r,0),s=new Array(n+1).fill(0);for(let c=0;c<t;c++)r[c]>0&&s[r[c]]++;let o=new Array(n+1).fill(0),a=0;for(let c=1;c<=n;c++)a=a+s[c-1]<<1,o[c]=a;for(let c=0;c<t;c++)r[c]>0&&(i[c]=o[r[c]]++);return{codes:i,lengths:r}}function At(e,t,i){e.writeBits(24,3227993),e.writeBits(24,2511705),e.writeBits(32,i),e.writeBit(0);let r=pt(t),{transformed:n,pointer:s}=gt(r);e.writeBits(24,s);let o=new Array(256).fill(!1);for(let d=0;d<n.length;d++)o[n[d]]=!0;let a=new Array(16).fill(!1);for(let d=0;d<16;d++)for(let S=0;S<16;S++)if(o[d*16+S]){a[d]=!0;break}for(let d=0;d<16;d++)e.writeBit(a[d]?1:0);for(let d=0;d<16;d++)if(a[d])for(let S=0;S<16;S++)e.writeBit(o[d*16+S]?1:0);let c=0;for(let d=0;d<256;d++)o[d]&&c++;let{encoded:l,length:f}=St(n,o),{symbols:u,length:w}=yt(l,f,c),g=c+2,h=50,p=Math.ceil(w/h),m;w<200?m=2:w<600?m=3:w<1200?m=4:w<2400?m=5:m=6,m>p&&(m=Math.max(2,p));let E=[];for(let d=0;d<m;d++)E.push(new Array(g).fill(0));let y=new Int32Array(p);for(let d=0;d<p;d++)y[d]=d%m;for(let d=0;d<p;d++){let S=d*h,_=Math.min(S+h,w),I=y[d];for(let x=S;x<_;x++)E[I][u[x]]++}function b(d){for(let S=0;S<g;S++)d[S]<1&&(d[S]=1)}let A=[];for(let d=0;d<m;d++)b(E[d]),A.push($e(E[d],g,20));for(let d=0;d<4;d++){for(let S=0;S<m;S++)E[S].fill(0);for(let S=0;S<p;S++){let _=S*h,I=Math.min(_+h,w),x=0,L=1/0;for(let F=0;F<m;F++){let J=0;for(let Q=_;Q<I;Q++)J+=A[F].codeLengths[u[Q]]||20;J<L&&(L=J,x=F)}y[S]=x;for(let F=_;F<I;F++)E[x][u[F]]++}for(let S=0;S<m;S++)b(E[S]),A[S]=$e(E[S],g,20)}e.writeBits(3,m),e.writeBits(15,p);let U=[],T=[];for(let d=0;d<m;d++)T.push(d);for(let d=0;d<p;d++){let S=y[d],_=0;for(;T[_]!==S;)_++;if(U.push(_),_>0){let I=T[_];for(let x=_;x>0;x--)T[x]=T[x-1];T[0]=I}}for(let d=0;d<p;d++){for(let S=0;S<U[d];S++)e.writeBit(1);e.writeBit(0)}for(let d=0;d<m;d++){let S=A[d].codeLengths,_=S[0];e.writeBits(5,_);for(let I=0;I<g;I++){let x=S[I];for(;_<x;)e.writeBit(1),e.writeBit(0),_++;for(;_>x;)e.writeBit(1),e.writeBit(1),_--;e.writeBit(0)}}for(let d=0;d<m;d++){let{codes:S,lengths:_}=Et(A[d].codeLengths,g);A[d]=Object.assign(A[d],{_codes:S,_lengths:_})}let ge=0,N=0;for(let d=0;d<w;d++){(N===0||N>=h)&&(d>0&&ge++,N=0);let S=y[ge],_=A[S],I=u[d],x=_._lengths[I],L=_._codes[I];x>0&&e.writeBits(x,L),N++}}var _t=10*1024*1024;function Ze(e,t=9,i=_t){if(t<1||t>9)throw new Error("Block size level must be 1-9");if(e.length>i)throw new Error(`Input too large for bzip2 compression (${e.length} bytes, max ${i})`);let r=t*1e5,n=new oe;n.writeBits(8,66),n.writeBits(8,90),n.writeBits(8,104),n.writeBits(8,48+t);let s=0,o=0;for(;o<e.length;){let a=Math.min(o+r,e.length),c=e.subarray(o,a),l=4294967295;for(let f=0;f<c.length;f++)l=ht(l,c[f]);l=~l>>>0,s=(s<<1|s>>>31)>>>0,s=(s^l)>>>0,At(n,c,l),o=a}return n.writeBits(24,1536581),n.writeBits(24,3690640),n.writeBits(32,s),n.finish()}var W=null,X=null;async function De(){if(W)return W;if(X)throw X;try{return W=await ee.runTrustedAsync(()=>import("node-liblzma")),W}catch{throw X=new Error("xz compression requires node-liblzma which failed to load. Install liblzma-dev (apt) or xz (brew) and reinstall dependencies."),X}}var j=null,q=null;async function Pe(){if(j)return j;if(q)throw q;try{return j=await ee.runTrustedAsync(()=>import("@mongodb-js/zstd")),j}catch{throw q=new Error("zstd compression requires @mongodb-js/zstd which is not installed. Install it with: npm install @mongodb-js/zstd"),q}}var C=100*1024*1024,Ne=512,Le=1e4;function xt(e){let t="file";e.isDirectory?t="directory":e.isSymlink&&(t="symlink");let i=e.name;e.isDirectory&&!i.endsWith("/")&&(i+="/");let r;e.content!==void 0&&(typeof e.content=="string"?r=new TextEncoder().encode(e.content):r=e.content);let n=e.isDirectory||e.isSymlink?0:r?.length??0;return{header:{name:i,mode:e.mode??(e.isDirectory?493:420),uid:e.uid??0,gid:e.gid??0,size:n,mtime:e.mtime??new Date,type:t,linkname:e.linkTarget??"",uname:"user",gname:"user"},body:r}}async function R(e){let t=e.map(xt);return Me(t)}async function Ke(e){let t=await R(e),n=new ReadableStream({start(l){l.enqueue(t),l.close()}}).pipeThrough(ze()).getReader(),s=[];for(;;){let{done:l,value:f}=await n.read();if(l)break;s.push(f)}let o=s.reduce((l,f)=>l+f.length,0),a=new Uint8Array(o),c=0;for(let l of s)a.set(l,c),c+=l.length;return a}async function k(e){if(e.length>C)return{entries:[],error:`Archive too large (max ${C} bytes)`};if(e.length<Ne||e.length%Ne!==0)return{entries:[],error:"Invalid tar archive format"};try{let t=await Be(e),i=[];for(let r of t){if(i.length>=Le)return{entries:i,error:`Too many entries (max ${Le})`};let n="file";switch(r.header.type){case"directory":n="directory";break;case"symlink":n="symlink";break;case"link":n="hardlink";break;case"file":n="file";break;default:n="other"}i.push({name:r.header.name,mode:r.header.mode??420,uid:r.header.uid??0,gid:r.header.gid??0,size:r.header.size,mtime:r.header.mtime??new Date,type:n,linkTarget:r.header.linkname||void 0,content:r.data??new Uint8Array(0)})}return{entries:i}}catch(t){let i=t instanceof Error?t.message:"Unknown error";return{entries:[],error:i}}}async function ae(e){if(e.length>C)return{entries:[],error:`Archive too large (max ${C} bytes)`};try{let r=new ReadableStream({start(c){c.enqueue(e),c.close()}}).pipeThrough(Re()).getReader(),n=[],s=0;for(;;){let{done:c,value:l}=await r.read();if(c)break;if(s+=l.length,s>C)return await r.cancel(),{entries:[],error:`Decompressed archive too large (max ${C} bytes)`};n.push(l)}let o=new Uint8Array(s),a=0;for(let c of n)o.set(c,a),a+=c.length;return k(o)}catch(t){let i=t instanceof Error?t.message:"Unknown error";return{entries:[],error:`Decompression failed: ${i}`}}}function ce(e){return e.length>=2&&e[0]===31&&e[1]===139}function le(e){return e.length>=3&&e[0]===66&&e[1]===90&&e[2]===104}function fe(e){return e.length>=6&&e[0]===253&&e[1]===55&&e[2]===122&&e[3]===88&&e[4]===90&&e[5]===0}async function Ct(e){let t=Tt.decode(Buffer.from(e));return new Uint8Array(t)}async function bt(e){return Ze(e,9)}async function Ut(e){let i=(await De()).unxzSync(Buffer.from(e));return new Uint8Array(i)}async function It(e){let i=(await De()).xzSync(Buffer.from(e));return new Uint8Array(i)}async function Ge(e){let t=await R(e);return bt(t)}async function He(e,t){if(!t?.allowNativeCodecs)throw new Error("xz compression is disabled by default (native codec risk). Pass { allowNativeCodecs: true } to opt in.");let i=await R(e);return It(i)}async function ue(e){if(e.length>C)return{entries:[],error:`Archive too large (max ${C} bytes)`};try{let t=await Ct(e);return t.length>C?{entries:[],error:`Decompressed archive too large (max ${C} bytes)`}:k(t)}catch(t){let i=t instanceof Error?t.message:"Unknown error";return{entries:[],error:i}}}async function de(e,t){if(!t?.allowNativeCodecs)return{entries:[],error:"xz decompression is disabled by default (native codec risk). Pass { allowNativeCodecs: true } to opt in, or decompress the archive externally before extraction."};if(e.length>C)return{entries:[],error:`Archive too large (max ${C} bytes)`};try{let i=await Ut(e);return i.length>C?{entries:[],error:`Decompressed archive too large (max ${C} bytes)`}:k(i)}catch(i){let r=i instanceof Error?i.message:"Unknown error";return{entries:[],error:r}}}function me(e){return e.length>=4&&e[0]===40&&e[1]===181&&e[2]===47&&e[3]===253}async function vt(e){let i=await(await Pe()).compress(Buffer.from(e),3);return new Uint8Array(i)}async function kt(e){let i=await(await Pe()).decompress(Buffer.from(e));return new Uint8Array(i)}async function We(e,t){if(!t?.allowNativeCodecs)throw new Error("zstd compression is disabled by default (native codec risk). Pass { allowNativeCodecs: true } to opt in.");let i=await R(e);return vt(i)}async function he(e,t){if(!t?.allowNativeCodecs)return{entries:[],error:"zstd decompression is disabled by default (native codec risk). Pass { allowNativeCodecs: true } to opt in, or decompress the archive externally before extraction."};if(e.length>C)return{entries:[],error:`Archive too large (max ${C} bytes)`};try{let i=await kt(e);return i.length>C?{entries:[],error:`Decompressed archive too large (max ${C} bytes)`}:k(i)}catch(i){let r=i instanceof Error?i.message:"Unknown error";return{entries:[],error:r}}}function Xe(e){let t={create:!1,append:!1,update:!1,extract:!1,list:!1,file:"",autoCompress:!1,gzip:!1,bzip2:!1,xz:!1,zstd:!1,verbose:!1,toStdout:!1,keepOldFiles:!1,touch:!1,directory:"",preserve:!1,absoluteNames:!1,strip:0,exclude:[],filesFrom:"",excludeFrom:"",wildcards:!1},i=[],r=0;for(;r<e.length;){let n=e[r];if(n.startsWith("-")&&!n.startsWith("--")&&n.length>2){if(/^-\d+$/.test(n)){i.push(n),r++;continue}for(let s=1;s<n.length;s++){let o=n[s];switch(o){case"c":t.create=!0;break;case"r":t.append=!0;break;case"u":t.update=!0;break;case"x":t.extract=!0;break;case"t":t.list=!0;break;case"a":t.autoCompress=!0;break;case"z":t.gzip=!0;break;case"j":t.bzip2=!0;break;case"J":t.xz=!0;break;case"v":t.verbose=!0;break;case"O":t.toStdout=!0;break;case"k":t.keepOldFiles=!0;break;case"m":t.touch=!0;break;case"p":t.preserve=!0;break;case"P":t.absoluteNames=!0;break;case"f":if(s<n.length-1)t.file=n.substring(s+1),s=n.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'f'
|
|
4
|
+
`,exitCode:2}};t.file=e[r]}break;case"C":if(s<n.length-1)t.directory=n.substring(s+1),s=n.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'C'
|
|
5
|
+
`,exitCode:2}};t.directory=e[r]}break;case"T":if(s<n.length-1)t.filesFrom=n.substring(s+1),s=n.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'T'
|
|
6
|
+
`,exitCode:2}};t.filesFrom=e[r]}break;case"X":if(s<n.length-1)t.excludeFrom=n.substring(s+1),s=n.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'X'
|
|
7
|
+
`,exitCode:2}};t.excludeFrom=e[r]}break;default:return{ok:!1,error:te("tar",`-${o}`)}}}r++;continue}if(n==="-c"||n==="--create")t.create=!0;else if(n==="-r"||n==="--append")t.append=!0;else if(n==="-u"||n==="--update")t.update=!0;else if(n==="-x"||n==="--extract"||n==="--get")t.extract=!0;else if(n==="-t"||n==="--list")t.list=!0;else if(n==="-a"||n==="--auto-compress")t.autoCompress=!0;else if(n==="-z"||n==="--gzip"||n==="--gunzip")t.gzip=!0;else if(n==="-j"||n==="--bzip2")t.bzip2=!0;else if(n==="-J"||n==="--xz")t.xz=!0;else if(n==="--zstd")t.zstd=!0;else if(n==="-v"||n==="--verbose")t.verbose=!0;else if(n==="-O"||n==="--to-stdout")t.toStdout=!0;else if(n==="-k"||n==="--keep-old-files")t.keepOldFiles=!0;else if(n==="-m"||n==="--touch")t.touch=!0;else if(n==="--wildcards")t.wildcards=!0;else if(n==="-p"||n==="--preserve"||n==="--preserve-permissions")t.preserve=!0;else if(n==="-P"||n==="--absolute-names")t.absoluteNames=!0;else if(n==="-f"||n==="--file"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'f'
|
|
8
|
+
`,exitCode:2}};t.file=e[r]}else if(n.startsWith("--file="))t.file=n.substring(7);else if(n==="-C"||n==="--directory"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'C'
|
|
9
|
+
`,exitCode:2}};t.directory=e[r]}else if(n.startsWith("--directory="))t.directory=n.substring(12);else if(n.startsWith("--strip-components=")||n.startsWith("--strip=")){let s=n.includes("--strip-components=")?n.substring(19):n.substring(8),o=parseInt(s,10);if(Number.isNaN(o)||o<0)return{ok:!1,error:{stdout:"",stderr:`tar: invalid number for --strip: '${s}'
|
|
10
|
+
`,exitCode:2}};t.strip=o}else if(n.startsWith("--exclude="))t.exclude.push(n.substring(10));else if(n==="--exclude"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option '--exclude' requires an argument
|
|
11
|
+
`,exitCode:2}};t.exclude.push(e[r])}else if(n==="-T"||n==="--files-from"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'T'
|
|
12
|
+
`,exitCode:2}};t.filesFrom=e[r]}else if(n.startsWith("--files-from="))t.filesFrom=n.substring(13);else if(n==="-X"||n==="--exclude-from"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'X'
|
|
13
|
+
`,exitCode:2}};t.excludeFrom=e[r]}else if(n.startsWith("--exclude-from="))t.excludeFrom=n.substring(15);else if(n==="--"){i.push(...e.slice(r+1));break}else{if(n.startsWith("-"))return{ok:!1,error:te("tar",n)};i.push(n)}r++}return{ok:!0,options:t,files:i}}var je=100,Ft={name:"tar",summary:"manipulate tape archives",usage:"tar [options] [file...]",description:["Create, extract, or list contents of tar archives.","","One of -c, -r, -u, -x, or -t is required to specify the operation."],options:["-c, --create create a new archive","-r, --append append files to the end of an archive","-u, --update only append files newer than copy in archive","-x, --extract extract files from an archive","-t, --list list contents of an archive","-f, --file=ARCHIVE use archive file ARCHIVE","-a, --auto-compress use archive suffix to determine compression","-z, --gzip filter archive through gzip","-j, --bzip2 filter archive through bzip2","-J, --xz filter archive through xz","--zstd filter archive through zstd","-v, --verbose verbosely list files processed","-O, --to-stdout extract files to standard output","-k, --keep-old-files don't replace existing files when extracting","-m, --touch don't extract file modified time","-C, --directory=DIR change to directory DIR before performing operations","-p, --preserve preserve permissions","-P, --absolute-names do not strip leading '/' or block '..' paths","-T, --files-from=FILE read files to extract/create from FILE","-X, --exclude-from=FILE read exclude patterns from FILE","--strip=N strip N leading path components on extraction","--exclude=PATTERN exclude files matching PATTERN","--wildcards use wildcards for pattern matching"," --help display this help and exit"],examples:["tar -cvf archive.tar file1 file2 Create archive from files","tar -czvf archive.tar.gz dir/ Create gzip-compressed archive","tar -cjvf archive.tar.bz2 dir/ Create bzip2-compressed archive","tar -rf archive.tar newfile.txt Append file to archive","tar -uf archive.tar dir/ Update archive with newer files","tar -xvf archive.tar Extract archive","tar -xvf archive.tar -C /tmp Extract to /tmp","tar -tvf archive.tar List archive contents","tar -xzf archive.tar.gz Extract gzip archive","tar -xf archive.tar file1.txt Extract specific file","tar -xOf archive.tar file.txt Extract file to stdout","tar -xf archive.tar --wildcards '*.txt' Extract matching files"]};function pe(e,t){let i=e.includes("/")?e.substring(e.lastIndexOf("/")+1):e;for(let r of t){let n=r.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"<<<GLOBSTAR>>>").replace(/\*/g,"[^/]*").replace(/<<<GLOBSTAR>>>/g,".*").replace(/\?/g,".");if(O(`^${n}$`).test(e)||O(`^${n}/`).test(e)||!r.includes("/")&&O(`^${n}$`).test(i))return!0}return!1}function Y(e,t){let i=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"<<<GLOBSTAR>>>").replace(/\*/g,"[^/]*").replace(/<<<GLOBSTAR>>>/g,".*").replace(/\?/g,"."),r=e.includes("/")?e.substring(e.lastIndexOf("/")+1):e;return O(`^${i}$`).test(e)||O(`^${i}$`).test(r)}function qe(e,t){if(t<=0)return e;let i=e.split("/").filter(r=>r!=="");return i.length<=t?"":i.slice(t).join("/")}function Ye(e){return e.split("/").some(t=>t==="..")}function zt(e,t){if(t)return{safePath:e};let i=e.replace(/^\/+/,"");return i.length===0?{safePath:""}:Ye(i)?{error:"Path contains '..'"}:{safePath:i}}function Rt(e){let i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],r=e.getDate().toString().padStart(2," "),n=e.getHours().toString().padStart(2,"0"),s=e.getMinutes().toString().padStart(2,"0");return`${i} ${r} ${n}:${s}`}async function V(e,t,i,r){let n=[],s=[],o=e.fs.resolvePath(t,i);try{let a=await e.fs.stat(o);if(pe(i,r))return{entries:n,errors:s};if(a.isDirectory){n.push({name:i,isDirectory:!0,mode:a.mode,mtime:a.mtime});let c=await e.fs.readdir(o);for(let l=0;l<c.length;l+=je){let f=c.slice(l,l+je),u=await Promise.all(f.map(w=>V(e,t,i?`${i}/${w}`:w,r)));for(let w of u)n.push(...w.entries),s.push(...w.errors)}}else if(a.isFile){let c=await e.fs.readFileBuffer(o);n.push({name:i,content:c,mode:a.mode,mtime:a.mtime})}else if(a.isSymbolicLink){let c=await e.fs.readlink(o);n.push({name:i,isSymlink:!0,linkTarget:c,mode:a.mode,mtime:a.mtime})}}catch(a){let c=a instanceof Error?a.message:"unknown error";s.push(`tar: ${i}: ${c}`)}return{entries:n,errors:s}}async function Ot(e,t,i){if(i.length===0)return{stdout:"",stderr:`tar: Cowardly refusing to create an empty archive
|
|
14
|
+
`,exitCode:2};let r=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,n=[],s=[],o="";for(let f of i){let{entries:u,errors:w}=await V(e,r,f,t.exclude);if(n.push(...u),s.push(...w),t.verbose)for(let g of u)o+=`${g.name}${g.isDirectory?"/":""}
|
|
15
|
+
`}if(n.length===0&&s.length>0)return{stdout:"",stderr:`${s.join(`
|
|
16
|
+
`)}
|
|
17
|
+
`,exitCode:2};let a;try{t.gzip?a=await Ke(n):t.bzip2?a=await Ge(n):t.xz?a=await He(n):t.zstd?a=await We(n):a=await R(n)}catch(f){return{stdout:"",stderr:`tar: error creating archive: ${f instanceof Error?f.message:"unknown error"}
|
|
18
|
+
`,exitCode:2}}let c="";if(t.file&&t.file!=="-"){let f=e.fs.resolvePath(e.cwd,t.file);try{await e.fs.writeFile(f,a)}catch(u){let w=u instanceof Error?u.message:"unknown error";return{stdout:"",stderr:`tar: ${t.file}: ${w}
|
|
19
|
+
`,exitCode:2}}}else c=Buffer.from(a).toString("latin1");let l=o;return s.length>0&&(l+=`${s.join(`
|
|
20
|
+
`)}
|
|
21
|
+
`),{stdout:c,stderr:l,exitCode:s.length>0?2:0}}async function Mt(e,t,i){if(!t.file||t.file==="-")return{stdout:"",stderr:`tar: Cannot append to stdin/stdout
|
|
22
|
+
`,exitCode:2};if(i.length===0)return{stdout:"",stderr:`tar: Cowardly refusing to append nothing to archive
|
|
23
|
+
`,exitCode:2};let r=e.fs.resolvePath(e.cwd,t.file),n;try{n=await e.fs.readFileBuffer(r)}catch{return{stdout:"",stderr:`tar: ${t.file}: Cannot open: No such file or directory
|
|
24
|
+
`,exitCode:2}}let s=await k(n);if(s.error)return{stdout:"",stderr:`tar: ${s.error}
|
|
25
|
+
`,exitCode:2};let o=s.entries.map(h=>({name:h.name,content:h.content,mode:h.mode,mtime:h.mtime,isDirectory:h.type==="directory",isSymlink:h.type==="symlink",linkTarget:h.linkTarget,uid:h.uid,gid:h.gid})),a=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,c=[],l=[],f="";for(let h of i){let{entries:p,errors:m}=await V(e,a,h,t.exclude);if(c.push(...p),l.push(...m),t.verbose)for(let E of p)f+=`${E.name}${E.isDirectory?"/":""}
|
|
26
|
+
`}let u=[...o,...c],w;try{w=await R(u)}catch(h){return{stdout:"",stderr:`tar: error creating archive: ${h instanceof Error?h.message:"unknown error"}
|
|
27
|
+
`,exitCode:2}}try{await e.fs.writeFile(r,w)}catch(h){let p=h instanceof Error?h.message:"unknown error";return{stdout:"",stderr:`tar: ${t.file}: ${p}
|
|
28
|
+
`,exitCode:2}}let g=f;return l.length>0&&(g+=`${l.join(`
|
|
29
|
+
`)}
|
|
30
|
+
`),{stdout:"",stderr:g,exitCode:l.length>0?2:0}}async function Bt(e,t,i){if(!t.file||t.file==="-")return{stdout:"",stderr:`tar: Cannot update stdin/stdout
|
|
31
|
+
`,exitCode:2};if(i.length===0)return{stdout:"",stderr:`tar: Cowardly refusing to update with nothing
|
|
32
|
+
`,exitCode:2};let r=e.fs.resolvePath(e.cwd,t.file),n;try{n=await e.fs.readFileBuffer(r)}catch{return{stdout:"",stderr:`tar: ${t.file}: Cannot open: No such file or directory
|
|
33
|
+
`,exitCode:2}}let s=await k(n);if(s.error)return{stdout:"",stderr:`tar: ${s.error}
|
|
34
|
+
`,exitCode:2};let o=new Map;for(let m of s.entries)o.set(m.name,m.mtime);let a=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,c=[],l=[],f="";for(let m of i){let{entries:E,errors:y}=await V(e,a,m,t.exclude);l.push(...y);for(let b of E){let A=o.get(b.name);(!A||b.mtime&&b.mtime.getTime()>A.getTime())&&(c.push(b),t.verbose&&(f+=`${b.name}${b.isDirectory?"/":""}
|
|
35
|
+
`))}}if(c.length===0){let m="";return l.length>0&&(m=`${l.join(`
|
|
36
|
+
`)}
|
|
37
|
+
`),{stdout:"",stderr:m,exitCode:l.length>0?2:0}}let u=new Set(c.map(m=>m.name)),g=[...s.entries.filter(m=>!u.has(m.name)).map(m=>({name:m.name,content:m.content,mode:m.mode,mtime:m.mtime,isDirectory:m.type==="directory",isSymlink:m.type==="symlink",linkTarget:m.linkTarget,uid:m.uid,gid:m.gid})),...c],h;try{h=await R(g)}catch(m){return{stdout:"",stderr:`tar: error creating archive: ${m instanceof Error?m.message:"unknown error"}
|
|
38
|
+
`,exitCode:2}}try{await e.fs.writeFile(r,h)}catch(m){let E=m instanceof Error?m.message:"unknown error";return{stdout:"",stderr:`tar: ${t.file}: ${E}
|
|
39
|
+
`,exitCode:2}}let p=f;return l.length>0&&(p+=`${l.join(`
|
|
40
|
+
`)}
|
|
41
|
+
`),{stdout:"",stderr:p,exitCode:l.length>0?2:0}}async function $t(e,t,i){let r;if(t.file&&t.file!=="-"){let p=e.fs.resolvePath(e.cwd,t.file);try{r=await e.fs.readFileBuffer(p)}catch{return{stdout:"",stderr:`tar: ${t.file}: Cannot open: No such file or directory
|
|
42
|
+
`,exitCode:2}}}else r=Uint8Array.from(e.stdin,p=>p.charCodeAt(0));let n,s=t.gzip||ce(r),o=t.bzip2||le(r),a=t.xz||fe(r),c=t.zstd||me(r);if(s?n=await ae(r):o?n=await ue(r):a?n=await de(r):c?n=await he(r):n=await k(r),n.error)return{stdout:"",stderr:`tar: ${n.error}
|
|
43
|
+
`,exitCode:2};let l=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,f=t.absoluteNames?i:i.map(p=>p.replace(/^\/+/,"")).filter(p=>p.length>0),u="",w="",g=[];if(t.directory&&!t.toStdout)try{await e.fs.mkdir(l,{recursive:!0})}catch{}for(let p of n.entries){let m=qe(p.name,t.strip);if(!m)continue;let E=zt(m,t.absoluteNames);if(E.error){g.push(`tar: ${m}: ${E.error}`);continue}let y=E.safePath??"";if(!y)continue;let b=y.endsWith("/")?y.slice(0,-1):y;if(f.length>0){let U;if(t.wildcards?U=f.some(T=>Y(y,T)||Y(b,T)||y.startsWith(`${T}/`)):U=f.some(T=>y===T||y.startsWith(`${T}/`)||b===T),!U)continue}if(pe(y,t.exclude))continue;let A=e.fs.resolvePath(l,y);try{if(p.type==="directory"){if(t.toStdout)continue;await e.fs.mkdir(A,{recursive:!0}),t.verbose&&(u+=`${y}
|
|
44
|
+
`)}else if(p.type==="file"){if(t.toStdout){w+=new TextDecoder().decode(p.content),t.verbose&&(u+=`${y}
|
|
45
|
+
`);continue}if(t.keepOldFiles)try{await e.fs.stat(A),t.verbose&&(u+=`${y}: not overwritten, file exists
|
|
46
|
+
`);continue}catch{}let U=A.substring(0,A.lastIndexOf("/"));if(U)try{await e.fs.mkdir(U,{recursive:!0})}catch{}if(await e.fs.writeFile(A,p.content),t.preserve&&p.mode)try{await e.fs.chmod(A,p.mode)}catch{}t.verbose&&(u+=`${y}
|
|
47
|
+
`)}else if(p.type==="symlink"&&p.linkTarget){if(t.toStdout)continue;if(!t.absoluteNames&&(p.linkTarget.startsWith("/")||Ye(p.linkTarget))){g.push(`tar: ${y}: unsafe symlink target`);continue}if(t.keepOldFiles)try{await e.fs.stat(A),t.verbose&&(u+=`${y}: not overwritten, file exists
|
|
48
|
+
`);continue}catch{}let U=A.substring(0,A.lastIndexOf("/"));if(U)try{await e.fs.mkdir(U,{recursive:!0})}catch{}try{await e.fs.symlink(p.linkTarget,A)}catch{}t.verbose&&(u+=`${y}
|
|
49
|
+
`)}}catch(U){let T=U instanceof Error?U.message:"unknown error";g.push(`tar: ${y}: ${T}`)}}let h=u;return g.length>0&&(h+=`${g.join(`
|
|
50
|
+
`)}
|
|
51
|
+
`),{stdout:w,stderr:h,exitCode:g.length>0?2:0}}async function Zt(e,t,i){let r;if(t.file&&t.file!=="-"){let f=e.fs.resolvePath(e.cwd,t.file);try{r=await e.fs.readFileBuffer(f)}catch{return{stdout:"",stderr:`tar: ${t.file}: Cannot open: No such file or directory
|
|
52
|
+
`,exitCode:2}}}else r=Uint8Array.from(e.stdin,f=>f.charCodeAt(0));let n,s=t.gzip||ce(r),o=t.bzip2||le(r),a=t.xz||fe(r),c=t.zstd||me(r);if(s?n=await ae(r):o?n=await ue(r):a?n=await de(r):c?n=await he(r):n=await k(r),n.error)return{stdout:"",stderr:`tar: ${n.error}
|
|
53
|
+
`,exitCode:2};let l="";for(let f of n.entries){let u=qe(f.name,t.strip);if(!u)continue;let w=u.endsWith("/")?u.slice(0,-1):u;if(i.length>0){let g;if(t.wildcards?g=i.some(h=>Y(u,h)||Y(w,h)||u.startsWith(`${h}/`)):g=i.some(h=>u===h||u.startsWith(`${h}/`)||w===h),!g)continue}if(!pe(u,t.exclude))if(t.verbose){let g=f.type==="directory",h=ye(f.mode,g),p=`${f.uid}/${f.gid}`,m=f.size.toString().padStart(8," "),E=Rt(f.mtime),y=`${h} ${p.padEnd(10)} ${m} ${E} ${u}`;f.type==="symlink"&&f.linkTarget&&(y+=` -> ${f.linkTarget}`),l+=`${y}
|
|
54
|
+
`}else l+=`${u}
|
|
55
|
+
`}return{stdout:l,stderr:"",exitCode:0}}var tr={name:"tar",async execute(e,t){if(Se(e))return we(Ft);let i=Xe(e);if(!i.ok)return i.error;let{options:r,files:n}=i,s=[r.create,r.append,r.update,r.extract,r.list].filter(Boolean).length;if(s===0)return{stdout:"",stderr:`tar: You must specify one of -c, -r, -u, -x, or -t
|
|
56
|
+
`,exitCode:2};if(s>1)return{stdout:"",stderr:`tar: You may not specify more than one of -c, -r, -u, -x, or -t
|
|
57
|
+
`,exitCode:2};if(r.autoCompress&&r.file&&r.create){let c=r.file.toLowerCase();c.endsWith(".tar.gz")||c.endsWith(".tgz")?r.gzip=!0:c.endsWith(".tar.bz2")||c.endsWith(".tbz2")?r.bzip2=!0:c.endsWith(".tar.xz")||c.endsWith(".txz")?r.xz=!0:(c.endsWith(".tar.zst")||c.endsWith(".tzst"))&&(r.zstd=!0)}let o=[r.gzip,r.bzip2,r.xz,r.zstd].filter(Boolean).length;if(o>1)return{stdout:"",stderr:`tar: You may not specify more than one compression option
|
|
58
|
+
`,exitCode:2};if((r.append||r.update)&&o>0)return{stdout:"",stderr:`tar: Cannot append/update compressed archives - decompress first
|
|
59
|
+
`,exitCode:2};let a=n;if(r.filesFrom){let c=t.fs.resolvePath(t.cwd,r.filesFrom);try{let f=(await t.fs.readFile(c)).split(`
|
|
60
|
+
`).map(u=>u.trim()).filter(u=>u.length>0&&!u.startsWith("#"));a=[...n,...f]}catch{return{stdout:"",stderr:`tar: ${r.filesFrom}: Cannot open: No such file or directory
|
|
61
|
+
`,exitCode:2}}}if(r.excludeFrom){let c=t.fs.resolvePath(t.cwd,r.excludeFrom);try{let f=(await t.fs.readFile(c)).split(`
|
|
62
|
+
`).map(u=>u.trim()).filter(u=>u.length>0&&!u.startsWith("#"));r.exclude.push(...f)}catch{return{stdout:"",stderr:`tar: ${r.excludeFrom}: Cannot open: No such file or directory
|
|
63
|
+
`,exitCode:2}}}return r.create?Ot(t,r,a):r.append?Mt(t,r,a):r.update?Bt(t,r,a):r.extract?$t(t,r,a):Zt(t,r,a)}},rr={name:"tar",flags:[{flag:"-c",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-f",type:"value",valueHint:"path"},{flag:"-z",type:"boolean"},{flag:"-j",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-C",type:"value",valueHint:"path"},{flag:"--strip-components",type:"value",valueHint:"number"},{flag:"--exclude",type:"value",valueHint:"pattern"}],needsArgs:!0};export{tr as a,rr as b};
|
package/dist/bin/{chunks/flag-coverage-LBMWMYOO.js → shell/chunks/flag-coverage-NSXW5TJP.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{b as yr}from"./chunk-
|
|
2
|
+
import{b as yr}from"./chunk-VRUXUVWB.js";import{b as Ar}from"./chunk-L2JBII6Z.js";import{b as $r}from"./chunk-B3RU2PUI.js";import"./chunk-GZHFXDDO.js";import"./chunk-QSDVMMYI.js";import{c as Sr}from"./chunk-CM4532DS.js";import{b as wr}from"./chunk-XKPFI566.js";import{b as xr}from"./chunk-ORUYSLP4.js";import{b as vr}from"./chunk-IDGH4PGU.js";import{b as kr}from"./chunk-F3LGZXLQ.js";import{b as qr}from"./chunk-BYDV4VEF.js";import{b as Cr}from"./chunk-JLX6YWGA.js";import{b as br}from"./chunk-FLPVVSN5.js";import{d as Ir,e as Mr,f as jr}from"./chunk-54G6AE72.js";import{b as tr}from"./chunk-DOXYBGNA.js";import{b as lr}from"./chunk-WXMBDX4P.js";import{b as ur}from"./chunk-THALLNXT.js";import{b as pr}from"./chunk-NLBRLRWD.js";import{b as er}from"./chunk-3Y32LPNT.js";import{b as dr}from"./chunk-7BORMNPQ.js";import{b as cr}from"./chunk-N43DJTSI.js";import"./chunk-OBI37ZY4.js";import{b as hr}from"./chunk-N5OTVT4F.js";import{c as or,d as ar}from"./chunk-MAVV76T4.js";import{b as sr}from"./chunk-JTF74J6E.js";import{c as ir,d as gr}from"./chunk-GO6FXSC4.js";import{b as mr}from"./chunk-VHUYNUT7.js";import"./chunk-ZO5PSLKR.js";import{b as Fr}from"./chunk-GOJZHH3L.js";import{b as zr}from"./chunk-P6GNZPVW.js";import{b as fr}from"./chunk-LOJMXC4F.js";import{b as nr}from"./chunk-AXWFPG37.js";import"./chunk-YTIURC67.js";import{b as R}from"./chunk-PQNTKMH3.js";import{b as U}from"./chunk-PPBQJBC2.js";import{b as V}from"./chunk-NSUMEERA.js";import{b as W}from"./chunk-XY5HGZW5.js";import{c as X,d as Y}from"./chunk-AAW7UMPO.js";import{c as Z,d as _}from"./chunk-3MBAUIBB.js";import{b as N}from"./chunk-RT7TRQVZ.js";import{b as rr}from"./chunk-CQG2HEAL.js";import{b as G}from"./chunk-RJSAGJQJ.js";import{b as H}from"./chunk-YEKSVVRC.js";import{b as J}from"./chunk-26NO42TF.js";import{b as K}from"./chunk-LGJM5YFT.js";import{b as L}from"./chunk-LMK6G2HH.js";import{b as O}from"./chunk-ZKC5HQYO.js";import{b as P}from"./chunk-ROJPSS6N.js";import{b as Q}from"./chunk-THNL3XFF.js";import{b as y}from"./chunk-CGE2EHYP.js";import{b as A}from"./chunk-ZA4HUKJ3.js";import{b as $}from"./chunk-WWZVR5NN.js";import{b as S}from"./chunk-JQBC3FXE.js";import{b as T}from"./chunk-NAX7MTAR.js";import{b as B}from"./chunk-5G2VOPPJ.js";import{b as D}from"./chunk-SGA7Y45Z.js";import{b as E}from"./chunk-EUXCM6C4.js";import{b as w}from"./chunk-YLE2OYY6.js";import{b as x}from"./chunk-S7OHMN3F.js";import{b as v}from"./chunk-YWZOGBFE.js";import"./chunk-YMMJLYIX.js";import{d as k,e as q,f as C}from"./chunk-YFPDB4PH.js";import"./chunk-SXB55JOI.js";import{b}from"./chunk-HJEHIH4P.js";import"./chunk-V7ZOPVQS.js";import"./chunk-4OALHZXB.js";import"./chunk-G43H2WGH.js";import{b as I}from"./chunk-RMQC3GS7.js";import{b as M}from"./chunk-SDLWFYVT.js";import{b as j}from"./chunk-FA2CHD73.js";import{b as t}from"./chunk-EPPBDXOG.js";import{b as l}from"./chunk-PS4LOXE5.js";import{b as u}from"./chunk-VNER2XXL.js";import{b as p}from"./chunk-AZ3RUDR2.js";import{b as e}from"./chunk-7ADG3DNO.js";import{b as d}from"./chunk-TEFXEYX3.js";import{b as c}from"./chunk-ZSVBYEY4.js";import{b as h}from"./chunk-SXRVLCZ4.js";import"./chunk-FSZWFMB4.js";import"./chunk-LIYVQA3X.js";import"./chunk-OOJCYVYF.js";import"./chunk-4PRVMER6.js";import"./chunk-MO4RPBN2.js";import"./chunk-YU6OGPZR.js";import"./chunk-SE4C7FJY.js";import{b as i}from"./chunk-LJKIWB5F.js";import{b as g}from"./chunk-MRP4ZCD7.js";import"./chunk-5WFYIUU2.js";import{b as m}from"./chunk-ND23BJUM.js";import"./chunk-D5WP4CKS.js";import"./chunk-6KZRLMG3.js";import{b as F}from"./chunk-MXVNCVD6.js";import"./chunk-OBH7XN5N.js";import{b as z}from"./chunk-7G3MC56B.js";import"./chunk-RLNOQILG.js";import{b as f}from"./chunk-EJQKHROT.js";import"./chunk-JBABAK44.js";import{b as n}from"./chunk-ITA43A73.js";import"./chunk-4VDEBYW7.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var Er=[i,g,m,F,z,f,n,t,l,u,p,e,d,c,h,w,x,v,k,q,C,b,I,M,j,y,A,$,S,T,B,D,E,G,H,J,K,L,O,P,Q,R,U,V,W,X,Y,Z,_,N,rr,or,ar,sr,ir,gr,mr,Fr,zr,fr,nr,tr,lr,ur,pr,er,dr,cr,hr,wr,xr,vr,kr,qr,Cr,br,Ir,Mr,jr,yr,Ar,$r,Sr];function Tr(){return Er}var Br=new Map;for(let r of Tr())Br.set(r.name,new Set(r.flags.map(o=>o.flag)));function Fa(r,o,Dr){let a=Br.get(o);if(!(!a||a.size===0))for(let s of Dr)a.has(s)&&r.hit(`cmd:flag:${o}:${s}`)}export{Fa as emitFlagCoverage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a,b}from"./chunk-
|
|
2
|
+
import{a,b}from"./chunk-VRUXUVWB.js";import"./chunk-YMMJLYIX.js";import"./chunk-YU6OGPZR.js";import"./chunk-SE4C7FJY.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as tarCommand};
|