experimental-ash 0.8.2 → 0.9.0

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/dist/docs/public/channels/slack.md +53 -25
  3. package/dist/src/compiled/.vendor-stamp.json +14 -14
  4. package/dist/src/compiled/@ai-sdk/anthropic/index.js +2 -2
  5. package/dist/src/compiled/@ai-sdk/google/index.js +4 -4
  6. package/dist/src/compiled/@ai-sdk/mcp/index.js +1 -1
  7. package/dist/src/compiled/@ai-sdk/openai/index.js +6 -6
  8. package/dist/src/compiled/@ai-sdk/otel/index.js +1 -1
  9. package/dist/src/compiled/@ai-sdk/provider/_json-schema.d.ts +5 -0
  10. package/dist/src/compiled/@ai-sdk/provider/index.d.ts +6632 -1
  11. package/dist/src/compiled/@chat-adapter/slack/_chat-adapter-shared.d.ts +9 -0
  12. package/dist/src/compiled/@chat-adapter/slack/index.d.ts +632 -54
  13. package/dist/src/compiled/@chat-adapter/slack/index.js +25 -29
  14. package/dist/src/compiled/@chat-adapter/slack/package.json +1 -1
  15. package/dist/src/compiled/@chat-adapter/state-memory/index.d.ts +41 -25
  16. package/dist/src/compiled/@chat-adapter/state-memory/package.json +1 -1
  17. package/dist/src/compiled/@standard-schema/spec/index.d.ts +115 -62
  18. package/dist/src/compiled/@vercel/sandbox/index.d.ts +4 -1
  19. package/dist/src/compiled/@vercel/sandbox/index.js +5 -5
  20. package/dist/src/compiled/@workflow/core/index.js +1 -1
  21. package/dist/src/compiled/@workflow/core/runtime.d.ts +6 -2
  22. package/dist/src/compiled/@workflow/core/runtime.js +4 -4
  23. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  24. package/dist/src/compiled/@workflow/errors/_ms.d.ts +4 -0
  25. package/dist/src/compiled/@workflow/errors/error-codes.d.ts +17 -0
  26. package/dist/src/compiled/@workflow/errors/index.d.ts +438 -56
  27. package/dist/src/compiled/@workflow/errors/index.js +1 -1
  28. package/dist/src/compiled/_chunks/node/{auth-CdwuOxMs.js → auth-vbe4XEEK.js} +2 -2
  29. package/dist/src/compiled/_chunks/node/{dist-B6IOtzm1.js → dist-BdWHjlRQ.js} +12 -12
  30. package/dist/src/compiled/_chunks/node/retry-BOcy5BbJ.js +1 -0
  31. package/dist/src/compiled/_chunks/workflow/{context-errors-CXifqq6a.js → context-errors-zbKocOyk.js} +1 -1
  32. package/dist/src/compiled/_chunks/workflow/{dist-BuELZxm6.js → dist-Ci2brnHh.js} +3 -3
  33. package/dist/src/compiled/_chunks/workflow/{resume-hook-CgfgCU87.js → resume-hook-CL8Ed91K.js} +2 -2
  34. package/dist/src/compiled/_chunks/workflow/sleep-Dn3i9nxI.js +1 -0
  35. package/dist/src/compiled/chat/_mdast.d.ts +24 -0
  36. package/dist/src/compiled/chat/_workflow-serde.d.ts +5 -0
  37. package/dist/src/compiled/chat/index.d.ts +3851 -72
  38. package/dist/src/compiled/chat/index.js +1 -1
  39. package/dist/src/compiled/chat/jsx-runtime-DxGwoLu2.d.ts +782 -0
  40. package/dist/src/compiled/chat/package.json +1 -1
  41. package/dist/src/compiled/just-bash/index.js +1 -1
  42. package/dist/src/execution/authorization-challenge-defaults.d.ts +1 -1
  43. package/dist/src/execution/authorization-challenge-defaults.js +1 -1
  44. package/dist/src/internal/application/package.js +1 -1
  45. package/dist/src/public/channels/slack/index.d.ts +1 -1
  46. package/dist/src/public/channels/slack/slack.js +4 -1
  47. package/dist/src/public/channels/slack/slackChannel.d.ts +64 -1
  48. package/dist/src/public/channels/slack/slackChannel.js +50 -7
  49. package/dist/src/runtime/connections/authorization-tokens.d.ts +1 -1
  50. package/dist/src/runtime/connections/authorization-tokens.js +1 -1
  51. package/package.json +16 -16
  52. package/dist/src/compiled/_chunks/node/ms-B2k_qBoq.js +0 -1
  53. package/dist/src/compiled/_chunks/workflow/sleep-BzS_cSYx.js +0 -1
  54. /package/dist/src/compiled/_chunks/workflow/{dist-C9DdsXoK.js → dist-0iNBqPYp.js} +0 -0
  55. /package/dist/src/compiled/_chunks/workflow/{dist-BHbmiLmM.js → dist-D774SUM4.js} +0 -0
  56. /package/dist/src/compiled/_chunks/workflow/{src-CidBwKAD.js → src-ClRYdO4-.js} +0 -0
  57. /package/dist/src/compiled/_chunks/workflow/{symbols-BC0BVTM7.js → symbols-D-4tVV8x.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "experimental-ash-compiled-chat",
3
- "version": "4.27.0",
3
+ "version": "4.28.1",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "license": "MIT"
@@ -852,7 +852,7 @@ With -d, decompress instead.`,options:[`-c, --stdout write to standard outp
852
852
 
853
853
  When no FILE is given, or when FILE is -, read from standard input.`,options:[`-c, --stdout write to standard output, keep original files`,`-f, --force force overwrite of output file`,`-k, --keep keep (don't delete) input files`,`-l, --list list compressed file contents`,`-n, --no-name do not restore the original name and timestamp`,`-N, --name restore the original file name and timestamp`,`-q, --quiet suppress all warnings`,`-r, --recursive operate recursively on directories`,`-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)`,`-t, --test test compressed file integrity`,`-v, --verbose verbose mode`,` --help display this help and exit`]},gj={name:`zcat`,summary:`decompress files to stdout`,usage:`zcat [OPTION]... [FILE]...`,description:`Decompress FILEs to standard output.
854
854
 
855
- When no FILE is given, or when FILE is -, read from standard input.`,options:[`-f, --force force; read compressed data even from a terminal`,`-l, --list list compressed file contents`,`-q, --quiet suppress all warnings`,`-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)`,`-t, --test test compressed file integrity`,`-v, --verbose verbose mode`,` --help display this help and exit`]},_j={stdout:{short:`c`,long:`stdout`,type:`boolean`},toStdout:{long:`to-stdout`,type:`boolean`},decompress:{short:`d`,long:`decompress`,type:`boolean`},uncompress:{long:`uncompress`,type:`boolean`},force:{short:`f`,long:`force`,type:`boolean`},keep:{short:`k`,long:`keep`,type:`boolean`},list:{short:`l`,long:`list`,type:`boolean`},noName:{short:`n`,long:`no-name`,type:`boolean`},name:{short:`N`,long:`name`,type:`boolean`},quiet:{short:`q`,long:`quiet`,type:`boolean`},recursive:{short:`r`,long:`recursive`,type:`boolean`},suffix:{short:`S`,long:`suffix`,type:`string`,default:`.gz`},test:{short:`t`,long:`test`,type:`boolean`},verbose:{short:`v`,long:`verbose`,type:`boolean`},fast:{short:`1`,long:`fast`,type:`boolean`},level2:{short:`2`,type:`boolean`},level3:{short:`3`,type:`boolean`},level4:{short:`4`,type:`boolean`},level5:{short:`5`,type:`boolean`},level6:{short:`6`,type:`boolean`},level7:{short:`7`,type:`boolean`},level8:{short:`8`,type:`boolean`},best:{short:`9`,long:`best`,type:`boolean`}},vj={name:`gzip`,async execute(e,t){return{...await pj(e,t,`gzip`),stdoutEncoding:`binary`}}},yj={name:`gunzip`,async execute(e,t){return{...await pj(e,t,`gunzip`),stdoutEncoding:`binary`}}},bj={name:`zcat`,async execute(e,t){return{...await pj(e,t,`zcat`),stdoutEncoding:`binary`}}},xj={name:`gzip`,flags:[{flag:`-c`,type:`boolean`},{flag:`-d`,type:`boolean`},{flag:`-f`,type:`boolean`},{flag:`-k`,type:`boolean`},{flag:`-l`,type:`boolean`},{flag:`-n`,type:`boolean`},{flag:`-q`,type:`boolean`},{flag:`-r`,type:`boolean`},{flag:`-t`,type:`boolean`},{flag:`-v`,type:`boolean`},{flag:`-1`,type:`boolean`},{flag:`-9`,type:`boolean`}],stdinType:`binary`,needsFiles:!0},Sj={name:`gunzip`,flags:[{flag:`-c`,type:`boolean`},{flag:`-f`,type:`boolean`},{flag:`-k`,type:`boolean`},{flag:`-q`,type:`boolean`},{flag:`-v`,type:`boolean`}],stdinType:`binary`,needsFiles:!0},Cj={name:`zcat`,flags:[{flag:`-f`,type:`boolean`},{flag:`-q`,type:`boolean`},{flag:`-v`,type:`boolean`}],stdinType:`binary`,needsFiles:!0}})),Tj=w({flagsForFuzzing:()=>xj,gunzipCommand:()=>yj,gunzipFlagsForFuzzing:()=>Sj,gzipCommand:()=>vj,zcatCommand:()=>bj,zcatFlagsForFuzzing:()=>Cj}),Ej=S((()=>{wj(),W()})),Dj=C(((e,t)=>{var n=[0,1,3,7,15,31,63,127,255],r=function(e){this.stream=e,this.bitOffset=0,this.curByte=0,this.hasByte=!1};r.prototype._ensureByte=function(){this.hasByte||=(this.curByte=this.stream.readByte(),!0)},r.prototype.read=function(e){for(var t=0;e>0;){this._ensureByte();var r=8-this.bitOffset;if(e>=r)t<<=r,t|=n[r]&this.curByte,this.hasByte=!1,this.bitOffset=0,e-=r;else{t<<=e;var i=r-e;t|=(this.curByte&n[e]<<i)>>i,this.bitOffset+=e,e=0}}return t},r.prototype.seek=function(e){var t=e%8,n=(e-t)/8;this.bitOffset=t,this.stream.seek(n),this.hasByte=!1},r.prototype.pi=function(){var e=new Buffer(6),t;for(t=0;t<e.length;t++)e[t]=this.read(8);return e.toString(`hex`)},t.exports=r})),Oj=C(((e,t)=>{var n=function(){};n.prototype.readByte=function(){throw Error(`abstract method readByte() not implemented`)},n.prototype.read=function(e,t,n){for(var r=0;r<n;){var i=this.readByte();if(i<0)return r===0?-1:r;e[t++]=i,r++}return r},n.prototype.seek=function(e){throw Error(`abstract method seek() not implemented`)},n.prototype.writeByte=function(e){throw Error(`abstract method readByte() not implemented`)},n.prototype.write=function(e,t,n){var r;for(r=0;r<n;r++)this.writeByte(e[t++]);return n},n.prototype.flush=function(){},t.exports=n})),kj=C(((e,t)=>{t.exports=(function(){var e=new Uint32Array([0,79764919,159529838,222504665,319059676,398814059,445009330,507990021,638119352,583659535,797628118,726387553,890018660,835552979,1015980042,944750013,1276238704,1221641927,1167319070,1095957929,1595256236,1540665371,1452775106,1381403509,1780037320,1859660671,1671105958,1733955601,2031960084,2111593891,1889500026,1952343757,2552477408,2632100695,2443283854,2506133561,2334638140,2414271883,2191915858,2254759653,3190512472,3135915759,3081330742,3009969537,2905550212,2850959411,2762807018,2691435357,3560074640,3505614887,3719321342,3648080713,3342211916,3287746299,3467911202,3396681109,4063920168,4143685023,4223187782,4286162673,3779000052,3858754371,3904687514,3967668269,881225847,809987520,1023691545,969234094,662832811,591600412,771767749,717299826,311336399,374308984,453813921,533576470,25881363,88864420,134795389,214552010,2023205639,2086057648,1897238633,1976864222,1804852699,1867694188,1645340341,1724971778,1587496639,1516133128,1461550545,1406951526,1302016099,1230646740,1142491917,1087903418,2896545431,2825181984,2770861561,2716262478,3215044683,3143675388,3055782693,3001194130,2326604591,2389456536,2200899649,2280525302,2578013683,2640855108,2418763421,2498394922,3769900519,3832873040,3912640137,3992402750,4088425275,4151408268,4197601365,4277358050,3334271071,3263032808,3476998961,3422541446,3585640067,3514407732,3694837229,3640369242,1762451694,1842216281,1619975040,1682949687,2047383090,2127137669,1938468188,2001449195,1325665622,1271206113,1183200824,1111960463,1543535498,1489069629,1434599652,1363369299,622672798,568075817,748617968,677256519,907627842,853037301,1067152940,995781531,51762726,131386257,177728840,240578815,269590778,349224269,429104020,491947555,4046411278,4126034873,4172115296,4234965207,3794477266,3874110821,3953728444,4016571915,3609705398,3555108353,3735388376,3664026991,3290680682,3236090077,3449943556,3378572211,3174993278,3120533705,3032266256,2961025959,2923101090,2868635157,2813903052,2742672763,2604032198,2683796849,2461293480,2524268063,2284983834,2364738477,2175806836,2238787779,1569362073,1498123566,1409854455,1355396672,1317987909,1246755826,1192025387,1137557660,2072149281,2135122070,1912620623,1992383480,1753615357,1816598090,1627664531,1707420964,295390185,358241886,404320391,483945776,43990325,106832002,186451547,266083308,932423249,861060070,1041341759,986742920,613929101,542559546,756411363,701822548,3316196985,3244833742,3425377559,3370778784,3601682597,3530312978,3744426955,3689838204,3819031489,3881883254,3928223919,4007849240,4037393693,4100235434,4180117107,4259748804,2310601993,2373574846,2151335527,2231098320,2596047829,2659030626,2470359227,2550115596,2947551409,2876312838,2788305887,2733848168,3165939309,3094707162,3040238851,2985771188]);return function(){var t=4294967295;this.getCRC=function(){return~t>>>0},this.updateCRC=function(n){t=t<<8^e[(t>>>24^n)&255]},this.updateCRCRun=function(n,r){for(;r-- >0;)t=t<<8^e[(t>>>24^n)&255]}}})()})),Aj=C(((e,t)=>{t.exports={name:`seek-bzip`,version:`2.0.0`,contributors:[`C. Scott Ananian (http://cscott.net)`,`Eli Skeggs`,`Kevin Kwok`,`Rob Landley (http://landley.net)`],description:`a pure-JavaScript Node.JS module for random-access decoding bzip2 data`,main:`./lib/index.js`,repository:{type:`git`,url:`https://github.com/cscott/seek-bzip.git`},license:`MIT`,bin:{"seek-bunzip":`./bin/seek-bunzip`,"seek-table":`./bin/seek-bzip-table`},directories:{test:`test`},dependencies:{commander:`^6.0.0`},devDependencies:{fibers:`^5.0.0`,mocha:`^8.1.0`},scripts:{test:`mocha`}}})),jj=C(((e,t)=>{var n=Dj(),r=Oj(),i=kj(),a=Aj(),o=20,s=258,c=0,l=1,u=2,d=6,f=50,p=`314159265359`,m=`177245385090`,h=function(e,t){var n=e[t],r;for(r=t;r>0;r--)e[r]=e[r-1];return e[0]=n,n},g={OK:0,LAST_BLOCK:-1,NOT_BZIP_DATA:-2,UNEXPECTED_INPUT_EOF:-3,UNEXPECTED_OUTPUT_EOF:-4,DATA_ERROR:-5,OUT_OF_MEMORY:-6,OBSOLETE_INPUT:-7,END_OF_BLOCK:-8},_={};_[g.LAST_BLOCK]=`Bad file checksum`,_[g.NOT_BZIP_DATA]=`Not bzip data`,_[g.UNEXPECTED_INPUT_EOF]=`Unexpected input EOF`,_[g.UNEXPECTED_OUTPUT_EOF]=`Unexpected output EOF`,_[g.DATA_ERROR]=`Data error`,_[g.OUT_OF_MEMORY]=`Out of memory`,_[g.OBSOLETE_INPUT]=`Obsolete (pre 0.9.5) bzip format not supported.`;var v=function(e,t){var n=_[e]||`unknown error`;t&&(n+=`: `+t);var r=TypeError(n);throw r.errorCode=e,r},y=function(e,t){this.writePos=this.writeCurrent=this.writeCount=0,this._start_bunzip(e,t)};y.prototype._init_block=function(){return this._get_next_block()?(this.blockCRC=new i,!0):(this.writeCount=-1,!1)},y.prototype._start_bunzip=function(e,t){var r=new Buffer(4);(e.read(r,0,4)!==4||String.fromCharCode(r[0],r[1],r[2])!==`BZh`)&&v(g.NOT_BZIP_DATA,`bad magic`);var i=r[3]-48;(i<1||i>9)&&v(g.NOT_BZIP_DATA,`level out of range`),this.reader=new n(e),this.dbufSize=1e5*i,this.nextoutput=0,this.outputStream=t,this.streamCRC=0},y.prototype._get_next_block=function(){var e,t,n,r=this.reader,i=r.pi();if(i===m)return!1;i!==p&&v(g.NOT_BZIP_DATA),this.targetBlockCRC=r.read(32)>>>0,this.streamCRC=(this.targetBlockCRC^(this.streamCRC<<1|this.streamCRC>>>31))>>>0,r.read(1)&&v(g.OBSOLETE_INPUT);var a=r.read(24);a>this.dbufSize&&v(g.DATA_ERROR,`initial position out of bounds`);var _=r.read(16),y=new Buffer(256),b=0;for(e=0;e<16;e++)if(_&1<<15-e){var x=e*16;for(n=r.read(16),t=0;t<16;t++)n&1<<15-t&&(y[b++]=x+t)}var S=r.read(3);(S<u||S>d)&&v(g.DATA_ERROR);var C=r.read(15);C===0&&v(g.DATA_ERROR);var w=new Buffer(256);for(e=0;e<S;e++)w[e]=e;var T=new Buffer(C);for(e=0;e<C;e++){for(t=0;r.read(1);t++)t>=S&&v(g.DATA_ERROR);T[e]=h(w,t)}var E=b+2,ee=[],D;for(t=0;t<S;t++){var te=new Buffer(E),O=new Uint16Array(o+1);for(_=r.read(5),e=0;e<E;e++){for(;(_<1||_>o)&&v(g.DATA_ERROR),r.read(1);)r.read(1)?_--:_++;te[e]=_}var k=A=te[0],A;for(e=1;e<E;e++)te[e]>A?A=te[e]:te[e]<k&&(k=te[e]);D={},ee.push(D),D.permute=new Uint16Array(s),D.limit=new Uint32Array(o+2),D.base=new Uint32Array(o+1),D.minLen=k,D.maxLen=A;var j=0;for(e=k;e<=A;e++)for(O[e]=D.limit[e]=0,_=0;_<E;_++)te[_]===e&&(D.permute[j++]=_);for(e=0;e<E;e++)O[te[e]]++;for(j=_=0,e=k;e<A;e++)j+=O[e],D.limit[e]=j-1,j<<=1,_+=O[e],D.base[e+1]=j-_;D.limit[A+1]=Number.MAX_VALUE,D.limit[A]=j+O[A]-1,D.base[k]=0}var ne=new Uint32Array(256);for(e=0;e<256;e++)w[e]=e;var M=0,N=0,re=0,ie,P=this.dbuf=new Uint32Array(this.dbufSize);for(E=0;;){for(E--||(E=f-1,re>=C&&v(g.DATA_ERROR),D=ee[T[re++]]),e=D.minLen,t=r.read(e);e>D.maxLen&&v(g.DATA_ERROR),!(t<=D.limit[e]);e++)t=t<<1|r.read(1);t-=D.base[e],(t<0||t>=s)&&v(g.DATA_ERROR);var ae=D.permute[t];if(ae===c||ae===l){M||(M=1,_=0),ae===c?_+=M:_+=2*M,M<<=1;continue}if(M)for(M=0,N+_>this.dbufSize&&v(g.DATA_ERROR),ie=y[w[0]],ne[ie]+=_;_--;)P[N++]=ie;if(ae>b)break;N>=this.dbufSize&&v(g.DATA_ERROR),e=ae-1,ie=h(w,e),ie=y[ie],ne[ie]++,P[N++]=ie}for((a<0||a>=N)&&v(g.DATA_ERROR),t=0,e=0;e<256;e++)n=t+ne[e],ne[e]=t,t=n;for(e=0;e<N;e++)ie=P[e]&255,P[ne[ie]]|=e<<8,ne[ie]++;var oe=0,se=0,ce=0;return N&&(oe=P[a],se=oe&255,oe>>=8,ce=-1),this.writePos=oe,this.writeCurrent=se,this.writeCount=N,this.writeRun=ce,!0},y.prototype._read_bunzip=function(e,t){var n,r,i;if(this.writeCount<0)return 0;var a=this.dbuf,o=this.writePos,s=this.writeCurrent,c=this.writeCount;this.outputsize;for(var l=this.writeRun;c;){for(c--,r=s,o=a[o],s=o&255,o>>=8,l++===3?(n=s,i=r,s=-1):(n=1,i=s),this.blockCRC.updateCRCRun(i,n);n--;)this.outputStream.writeByte(i),this.nextoutput++;s!=r&&(l=0)}return this.writeCount=c,this.blockCRC.getCRC()!==this.targetBlockCRC&&v(g.DATA_ERROR,`Bad block CRC (got `+this.blockCRC.getCRC().toString(16)+` expected `+this.targetBlockCRC.toString(16)+`)`),this.nextoutput};var b=function(e){if(`readByte`in e)return e;var t=new r;return t.pos=0,t.readByte=function(){return e[this.pos++]},t.seek=function(e){this.pos=e},t.eof=function(){return this.pos>=e.length},t},x=function(e){var t=new r,n=!0;if(e)if(typeof e==`number`)t.buffer=new Buffer(e),n=!1;else if(`writeByte`in e)return e;else t.buffer=e,n=!1;else t.buffer=new Buffer(16384);return t.pos=0,t.writeByte=function(e){if(n&&this.pos>=this.buffer.length){var t=new Buffer(this.buffer.length*2);this.buffer.copy(t),this.buffer=t}this.buffer[this.pos++]=e},t.getBuffer=function(){if(this.pos!==this.buffer.length){if(!n)throw TypeError(`outputsize does not match decoded input`);var e=new Buffer(this.pos);this.buffer.copy(e,0,0,this.pos),this.buffer=e}return this.buffer},t._coerced=!0,t};y.Err=g,y.decode=function(e,t,n){for(var r=b(e),i=x(t),a=new y(r,i);!(`eof`in r&&r.eof());)if(a._init_block())a._read_bunzip();else{var o=a.reader.read(32)>>>0;if(o!==a.streamCRC&&v(g.DATA_ERROR,`Bad stream CRC (got `+a.streamCRC.toString(16)+` expected `+o.toString(16)+`)`),n&&`eof`in r&&!r.eof())a._start_bunzip(r,i);else break}if(`getBuffer`in i)return i.getBuffer()},y.decodeBlock=function(e,t,n){var r=b(e),a=x(n),o=new y(r,a);if(o.reader.seek(t),o._get_next_block()&&(o.blockCRC=new i,o.writeCopies=0,o._read_bunzip()),`getBuffer`in a)return a.getBuffer()},y.table=function(e,t,n){var i=new r;i.delegate=b(e),i.pos=0,i.readByte=function(){return this.pos++,this.delegate.readByte()},i.delegate.eof&&(i.eof=i.delegate.eof.bind(i.delegate));var a=new r;a.pos=0,a.writeByte=function(){this.pos++};for(var o=new y(i,a),s=o.dbufSize;!(`eof`in i&&i.eof());){var c=i.pos*8+o.reader.bitOffset;if(o.reader.hasByte&&(c-=8),o._init_block()){var l=a.pos;o._read_bunzip(),t(c,a.pos-l)}else if(o.reader.read(32),n&&`eof`in i&&!i.eof())o._start_bunzip(i,a),console.assert(o.dbufSize===s,`shouldn't change block size within multistream file`);else break}},y.Stream=r,y.version=a.version,y.license=a.license,t.exports=y})),Mj=w({}),Nj=S((()=>{throw Error(`Optional just-bash native dependency "node-liblzma" is not bundled in experimental-ash.`)})),Pj=w({}),Fj=S((()=>{throw Error(`Optional just-bash native dependency "@mongodb-js/zstd" is not bundled in experimental-ash.`)}));function Ij(e,t,n,r){r&&dN.encodeInto(r,e.subarray(t,t+n))}function Lj(e,t,n,r){if(r===void 0)return;let i=r.toString(8).padStart(n-1,`0`);dN.encodeInto(i,e.subarray(t,t+n-1))}function Rj(e,t,n){let r=e.indexOf(0,t),i=r===-1||r>t+n?t+n:r;return fN.decode(e.subarray(t,i))}function zj(e,t,n){let r=0,i=t+n;for(let n=t;n<i;n++){let t=e[n];if(t===0)break;t!==32&&(r=r*8+(t-48))}return r}function Bj(e,t,n){if(e[t]&128){let r=0;r=e[t]&127;for(let i=1;i<n;i++)r=r*256+e[t+i];if(!Number.isSafeInteger(r))throw Error(`TAR number too large`);return r}return zj(e,t,n)}async function Vj(e){if(e==null)return uN;if(e instanceof Uint8Array)return e;if(typeof e==`string`)return dN.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(e instanceof Blob)return new Uint8Array(await e.arrayBuffer());throw TypeError(`Unsupported content type for entry body.`)}function Hj(e,t){let{strip:n,filter:r,map:i}=t;if(!n&&!r&&!i)return e;let a={...e};if(n&&n>0){let e=mN(a.name,n);if(!e)return null;if(a.name=a.type===`directory`&&!e.endsWith(`/`)?`${e}/`:e,a.linkname){let e=a.linkname.startsWith(`/`);if(e||a.type===`link`){let t=mN(a.linkname,n);a.linkname=e?`/${t}`||`/`:t}}}if(r?.(a)===!1)return null;let o=i?i(a):a;return o&&(!o.name||!o.name.trim()||o.name===`.`||o.name===`/`)?null:o}function Uj(e){let t=zj(e,148,8),n=0;for(let t=0;t<e.length;t++)t>=148&&t<156?n+=hN:n+=e[t];return t===n}function Wj(e){e.fill(hN,148,156);let t=0;for(let n of e)t+=n;for(let n=153;n>=148;n--)e[n]=(t&7)+gN,t>>=3;e[154]=0,e[155]=hN}function Gj(e){let t={};dN.encode(e.name).length>100&&Kj(e.name)===null&&(t.path=e.name),e.linkname&&dN.encode(e.linkname).length>100&&(t.linkpath=e.linkname),e.uname&&dN.encode(e.uname).length>32&&(t.uname=e.uname),e.gname&&dN.encode(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 n=Object.entries(t);if(n.length===0)return null;let r=dN.encode(n.map(([e,t])=>{let n=`${e}=${t}
855
+ When no FILE is given, or when FILE is -, read from standard input.`,options:[`-f, --force force; read compressed data even from a terminal`,`-l, --list list compressed file contents`,`-q, --quiet suppress all warnings`,`-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)`,`-t, --test test compressed file integrity`,`-v, --verbose verbose mode`,` --help display this help and exit`]},_j={stdout:{short:`c`,long:`stdout`,type:`boolean`},toStdout:{long:`to-stdout`,type:`boolean`},decompress:{short:`d`,long:`decompress`,type:`boolean`},uncompress:{long:`uncompress`,type:`boolean`},force:{short:`f`,long:`force`,type:`boolean`},keep:{short:`k`,long:`keep`,type:`boolean`},list:{short:`l`,long:`list`,type:`boolean`},noName:{short:`n`,long:`no-name`,type:`boolean`},name:{short:`N`,long:`name`,type:`boolean`},quiet:{short:`q`,long:`quiet`,type:`boolean`},recursive:{short:`r`,long:`recursive`,type:`boolean`},suffix:{short:`S`,long:`suffix`,type:`string`,default:`.gz`},test:{short:`t`,long:`test`,type:`boolean`},verbose:{short:`v`,long:`verbose`,type:`boolean`},fast:{short:`1`,long:`fast`,type:`boolean`},level2:{short:`2`,type:`boolean`},level3:{short:`3`,type:`boolean`},level4:{short:`4`,type:`boolean`},level5:{short:`5`,type:`boolean`},level6:{short:`6`,type:`boolean`},level7:{short:`7`,type:`boolean`},level8:{short:`8`,type:`boolean`},best:{short:`9`,long:`best`,type:`boolean`}},vj={name:`gzip`,async execute(e,t){return{...await pj(e,t,`gzip`),stdoutEncoding:`binary`}}},yj={name:`gunzip`,async execute(e,t){return{...await pj(e,t,`gunzip`),stdoutEncoding:`binary`}}},bj={name:`zcat`,async execute(e,t){return{...await pj(e,t,`zcat`),stdoutEncoding:`binary`}}},xj={name:`gzip`,flags:[{flag:`-c`,type:`boolean`},{flag:`-d`,type:`boolean`},{flag:`-f`,type:`boolean`},{flag:`-k`,type:`boolean`},{flag:`-l`,type:`boolean`},{flag:`-n`,type:`boolean`},{flag:`-q`,type:`boolean`},{flag:`-r`,type:`boolean`},{flag:`-t`,type:`boolean`},{flag:`-v`,type:`boolean`},{flag:`-1`,type:`boolean`},{flag:`-9`,type:`boolean`}],stdinType:`binary`,needsFiles:!0},Sj={name:`gunzip`,flags:[{flag:`-c`,type:`boolean`},{flag:`-f`,type:`boolean`},{flag:`-k`,type:`boolean`},{flag:`-q`,type:`boolean`},{flag:`-v`,type:`boolean`}],stdinType:`binary`,needsFiles:!0},Cj={name:`zcat`,flags:[{flag:`-f`,type:`boolean`},{flag:`-q`,type:`boolean`},{flag:`-v`,type:`boolean`}],stdinType:`binary`,needsFiles:!0}})),Tj=w({flagsForFuzzing:()=>xj,gunzipCommand:()=>yj,gunzipFlagsForFuzzing:()=>Sj,gzipCommand:()=>vj,zcatCommand:()=>bj,zcatFlagsForFuzzing:()=>Cj}),Ej=S((()=>{wj(),W()})),Dj=C(((e,t)=>{var n=[0,1,3,7,15,31,63,127,255],r=function(e){this.stream=e,this.bitOffset=0,this.curByte=0,this.hasByte=!1};r.prototype._ensureByte=function(){this.hasByte||=(this.curByte=this.stream.readByte(),!0)},r.prototype.read=function(e){for(var t=0;e>0;){this._ensureByte();var r=8-this.bitOffset;if(e>=r)t<<=r,t|=n[r]&this.curByte,this.hasByte=!1,this.bitOffset=0,e-=r;else{t<<=e;var i=r-e;t|=(this.curByte&n[e]<<i)>>i,this.bitOffset+=e,e=0}}return t},r.prototype.seek=function(e){var t=e%8,n=(e-t)/8;this.bitOffset=t,this.stream.seek(n),this.hasByte=!1},r.prototype.pi=function(){var e=new Buffer(6),t;for(t=0;t<e.length;t++)e[t]=this.read(8);return e.toString(`hex`)},t.exports=r})),Oj=C(((e,t)=>{var n=function(){};n.prototype.readByte=function(){throw Error(`abstract method readByte() not implemented`)},n.prototype.read=function(e,t,n){for(var r=0;r<n;){var i=this.readByte();if(i<0)return r===0?-1:r;e[t++]=i,r++}return r},n.prototype.seek=function(e){throw Error(`abstract method seek() not implemented`)},n.prototype.writeByte=function(e){throw Error(`abstract method readByte() not implemented`)},n.prototype.write=function(e,t,n){var r;for(r=0;r<n;r++)this.writeByte(e[t++]);return n},n.prototype.flush=function(){},t.exports=n})),kj=C(((e,t)=>{t.exports=(function(){var e=new Uint32Array([0,79764919,159529838,222504665,319059676,398814059,445009330,507990021,638119352,583659535,797628118,726387553,890018660,835552979,1015980042,944750013,1276238704,1221641927,1167319070,1095957929,1595256236,1540665371,1452775106,1381403509,1780037320,1859660671,1671105958,1733955601,2031960084,2111593891,1889500026,1952343757,2552477408,2632100695,2443283854,2506133561,2334638140,2414271883,2191915858,2254759653,3190512472,3135915759,3081330742,3009969537,2905550212,2850959411,2762807018,2691435357,3560074640,3505614887,3719321342,3648080713,3342211916,3287746299,3467911202,3396681109,4063920168,4143685023,4223187782,4286162673,3779000052,3858754371,3904687514,3967668269,881225847,809987520,1023691545,969234094,662832811,591600412,771767749,717299826,311336399,374308984,453813921,533576470,25881363,88864420,134795389,214552010,2023205639,2086057648,1897238633,1976864222,1804852699,1867694188,1645340341,1724971778,1587496639,1516133128,1461550545,1406951526,1302016099,1230646740,1142491917,1087903418,2896545431,2825181984,2770861561,2716262478,3215044683,3143675388,3055782693,3001194130,2326604591,2389456536,2200899649,2280525302,2578013683,2640855108,2418763421,2498394922,3769900519,3832873040,3912640137,3992402750,4088425275,4151408268,4197601365,4277358050,3334271071,3263032808,3476998961,3422541446,3585640067,3514407732,3694837229,3640369242,1762451694,1842216281,1619975040,1682949687,2047383090,2127137669,1938468188,2001449195,1325665622,1271206113,1183200824,1111960463,1543535498,1489069629,1434599652,1363369299,622672798,568075817,748617968,677256519,907627842,853037301,1067152940,995781531,51762726,131386257,177728840,240578815,269590778,349224269,429104020,491947555,4046411278,4126034873,4172115296,4234965207,3794477266,3874110821,3953728444,4016571915,3609705398,3555108353,3735388376,3664026991,3290680682,3236090077,3449943556,3378572211,3174993278,3120533705,3032266256,2961025959,2923101090,2868635157,2813903052,2742672763,2604032198,2683796849,2461293480,2524268063,2284983834,2364738477,2175806836,2238787779,1569362073,1498123566,1409854455,1355396672,1317987909,1246755826,1192025387,1137557660,2072149281,2135122070,1912620623,1992383480,1753615357,1816598090,1627664531,1707420964,295390185,358241886,404320391,483945776,43990325,106832002,186451547,266083308,932423249,861060070,1041341759,986742920,613929101,542559546,756411363,701822548,3316196985,3244833742,3425377559,3370778784,3601682597,3530312978,3744426955,3689838204,3819031489,3881883254,3928223919,4007849240,4037393693,4100235434,4180117107,4259748804,2310601993,2373574846,2151335527,2231098320,2596047829,2659030626,2470359227,2550115596,2947551409,2876312838,2788305887,2733848168,3165939309,3094707162,3040238851,2985771188]);return function(){var t=4294967295;this.getCRC=function(){return~t>>>0},this.updateCRC=function(n){t=t<<8^e[(t>>>24^n)&255]},this.updateCRCRun=function(n,r){for(;r-- >0;)t=t<<8^e[(t>>>24^n)&255]}}})()})),Aj=C(((e,t)=>{t.exports={name:`seek-bzip`,version:`2.0.0`,contributors:[`C. Scott Ananian (http://cscott.net)`,`Eli Skeggs`,`Kevin Kwok`,`Rob Landley (http://landley.net)`],description:`a pure-JavaScript Node.JS module for random-access decoding bzip2 data`,main:`./lib/index.js`,repository:{type:`git`,url:`https://github.com/cscott/seek-bzip.git`},license:`MIT`,bin:{"seek-bunzip":`./bin/seek-bunzip`,"seek-table":`./bin/seek-bzip-table`},directories:{test:`test`},dependencies:{commander:`^6.0.0`},devDependencies:{fibers:`^5.0.0`,mocha:`^8.1.0`},scripts:{test:`mocha`}}})),jj=C(((e,t)=>{var n=Dj(),r=Oj(),i=kj(),a=Aj(),o=20,s=258,c=0,l=1,u=2,d=6,f=50,p=`314159265359`,m=`177245385090`,h=function(e,t){var n=e[t],r;for(r=t;r>0;r--)e[r]=e[r-1];return e[0]=n,n},g={OK:0,LAST_BLOCK:-1,NOT_BZIP_DATA:-2,UNEXPECTED_INPUT_EOF:-3,UNEXPECTED_OUTPUT_EOF:-4,DATA_ERROR:-5,OUT_OF_MEMORY:-6,OBSOLETE_INPUT:-7,END_OF_BLOCK:-8},_={};_[g.LAST_BLOCK]=`Bad file checksum`,_[g.NOT_BZIP_DATA]=`Not bzip data`,_[g.UNEXPECTED_INPUT_EOF]=`Unexpected input EOF`,_[g.UNEXPECTED_OUTPUT_EOF]=`Unexpected output EOF`,_[g.DATA_ERROR]=`Data error`,_[g.OUT_OF_MEMORY]=`Out of memory`,_[g.OBSOLETE_INPUT]=`Obsolete (pre 0.9.5) bzip format not supported.`;var v=function(e,t){var n=_[e]||`unknown error`;t&&(n+=`: `+t);var r=TypeError(n);throw r.errorCode=e,r},y=function(e,t){this.writePos=this.writeCurrent=this.writeCount=0,this._start_bunzip(e,t)};y.prototype._init_block=function(){return this._get_next_block()?(this.blockCRC=new i,!0):(this.writeCount=-1,!1)},y.prototype._start_bunzip=function(e,t){var r=new Buffer(4);(e.read(r,0,4)!==4||String.fromCharCode(r[0],r[1],r[2])!==`BZh`)&&v(g.NOT_BZIP_DATA,`bad magic`);var i=r[3]-48;(i<1||i>9)&&v(g.NOT_BZIP_DATA,`level out of range`),this.reader=new n(e),this.dbufSize=1e5*i,this.nextoutput=0,this.outputStream=t,this.streamCRC=0},y.prototype._get_next_block=function(){var e,t,n,r=this.reader,i=r.pi();if(i===m)return!1;i!==p&&v(g.NOT_BZIP_DATA),this.targetBlockCRC=r.read(32)>>>0,this.streamCRC=(this.targetBlockCRC^(this.streamCRC<<1|this.streamCRC>>>31))>>>0,r.read(1)&&v(g.OBSOLETE_INPUT);var a=r.read(24);a>this.dbufSize&&v(g.DATA_ERROR,`initial position out of bounds`);var _=r.read(16),y=new Buffer(256),b=0;for(e=0;e<16;e++)if(_&1<<15-e){var x=e*16;for(n=r.read(16),t=0;t<16;t++)n&1<<15-t&&(y[b++]=x+t)}var S=r.read(3);(S<u||S>d)&&v(g.DATA_ERROR);var C=r.read(15);C===0&&v(g.DATA_ERROR);var w=new Buffer(256);for(e=0;e<S;e++)w[e]=e;var T=new Buffer(C);for(e=0;e<C;e++){for(t=0;r.read(1);t++)t>=S&&v(g.DATA_ERROR);T[e]=h(w,t)}var E=b+2,ee=[],D;for(t=0;t<S;t++){var te=new Buffer(E),O=new Uint16Array(o+1);for(_=r.read(5),e=0;e<E;e++){for(;(_<1||_>o)&&v(g.DATA_ERROR),r.read(1);)r.read(1)?_--:_++;te[e]=_}var k=A=te[0],A;for(e=1;e<E;e++)te[e]>A?A=te[e]:te[e]<k&&(k=te[e]);D={},ee.push(D),D.permute=new Uint16Array(s),D.limit=new Uint32Array(o+2),D.base=new Uint32Array(o+1),D.minLen=k,D.maxLen=A;var j=0;for(e=k;e<=A;e++)for(O[e]=D.limit[e]=0,_=0;_<E;_++)te[_]===e&&(D.permute[j++]=_);for(e=0;e<E;e++)O[te[e]]++;for(j=_=0,e=k;e<A;e++)j+=O[e],D.limit[e]=j-1,j<<=1,_+=O[e],D.base[e+1]=j-_;D.limit[A+1]=Number.MAX_VALUE,D.limit[A]=j+O[A]-1,D.base[k]=0}var ne=new Uint32Array(256);for(e=0;e<256;e++)w[e]=e;var M=0,N=0,re=0,ie,P=this.dbuf=new Uint32Array(this.dbufSize);for(E=0;;){for(E--||(E=f-1,re>=C&&v(g.DATA_ERROR),D=ee[T[re++]]),e=D.minLen,t=r.read(e);e>D.maxLen&&v(g.DATA_ERROR),!(t<=D.limit[e]);e++)t=t<<1|r.read(1);t-=D.base[e],(t<0||t>=s)&&v(g.DATA_ERROR);var ae=D.permute[t];if(ae===c||ae===l){M||(M=1,_=0),ae===c?_+=M:_+=2*M,M<<=1;continue}if(M)for(M=0,N+_>this.dbufSize&&v(g.DATA_ERROR),ie=y[w[0]],ne[ie]+=_;_--;)P[N++]=ie;if(ae>b)break;N>=this.dbufSize&&v(g.DATA_ERROR),e=ae-1,ie=h(w,e),ie=y[ie],ne[ie]++,P[N++]=ie}for((a<0||a>=N)&&v(g.DATA_ERROR),t=0,e=0;e<256;e++)n=t+ne[e],ne[e]=t,t=n;for(e=0;e<N;e++)ie=P[e]&255,P[ne[ie]]|=e<<8,ne[ie]++;var oe=0,se=0,ce=0;return N&&(oe=P[a],se=oe&255,oe>>=8,ce=-1),this.writePos=oe,this.writeCurrent=se,this.writeCount=N,this.writeRun=ce,!0},y.prototype._read_bunzip=function(e,t){var n,r,i;if(this.writeCount<0)return 0;var a=this.dbuf,o=this.writePos,s=this.writeCurrent,c=this.writeCount;this.outputsize;for(var l=this.writeRun;c;){for(c--,r=s,o=a[o],s=o&255,o>>=8,l++===3?(n=s,i=r,s=-1):(n=1,i=s),this.blockCRC.updateCRCRun(i,n);n--;)this.outputStream.writeByte(i),this.nextoutput++;s!=r&&(l=0)}return this.writeCount=c,this.blockCRC.getCRC()!==this.targetBlockCRC&&v(g.DATA_ERROR,`Bad block CRC (got `+this.blockCRC.getCRC().toString(16)+` expected `+this.targetBlockCRC.toString(16)+`)`),this.nextoutput};var b=function(e){if(`readByte`in e)return e;var t=new r;return t.pos=0,t.readByte=function(){return e[this.pos++]},t.seek=function(e){this.pos=e},t.eof=function(){return this.pos>=e.length},t},x=function(e){var t=new r,n=!0;if(e)if(typeof e==`number`)t.buffer=new Buffer(e),n=!1;else if(`writeByte`in e)return e;else t.buffer=e,n=!1;else t.buffer=new Buffer(16384);return t.pos=0,t.writeByte=function(e){if(n&&this.pos>=this.buffer.length){var t=new Buffer(this.buffer.length*2);this.buffer.copy(t),this.buffer=t}this.buffer[this.pos++]=e},t.getBuffer=function(){if(this.pos!==this.buffer.length){if(!n)throw TypeError(`outputsize does not match decoded input`);var e=new Buffer(this.pos);this.buffer.copy(e,0,0,this.pos),this.buffer=e}return this.buffer},t._coerced=!0,t};y.Err=g,y.decode=function(e,t,n){for(var r=b(e),i=x(t),a=new y(r,i);!(`eof`in r&&r.eof());)if(a._init_block())a._read_bunzip();else{var o=a.reader.read(32)>>>0;if(o!==a.streamCRC&&v(g.DATA_ERROR,`Bad stream CRC (got `+a.streamCRC.toString(16)+` expected `+o.toString(16)+`)`),n&&`eof`in r&&!r.eof())a._start_bunzip(r,i);else break}if(`getBuffer`in i)return i.getBuffer()},y.decodeBlock=function(e,t,n){var r=b(e),a=x(n),o=new y(r,a);if(o.reader.seek(t),o._get_next_block()&&(o.blockCRC=new i,o.writeCopies=0,o._read_bunzip()),`getBuffer`in a)return a.getBuffer()},y.table=function(e,t,n){var i=new r;i.delegate=b(e),i.pos=0,i.readByte=function(){return this.pos++,this.delegate.readByte()},i.delegate.eof&&(i.eof=i.delegate.eof.bind(i.delegate));var a=new r;a.pos=0,a.writeByte=function(){this.pos++};for(var o=new y(i,a),s=o.dbufSize;!(`eof`in i&&i.eof());){var c=i.pos*8+o.reader.bitOffset;if(o.reader.hasByte&&(c-=8),o._init_block()){var l=a.pos;o._read_bunzip(),t(c,a.pos-l)}else if(o.reader.read(32),n&&`eof`in i&&!i.eof())o._start_bunzip(i,a),console.assert(o.dbufSize===s,`shouldn't change block size within multistream file`);else break}},y.Stream=r,y.version=a.version,y.license=a.license,t.exports=y})),Mj=w({}),Nj=S((()=>{throw Error(`Optional native dependency "node-liblzma" is not bundled in this vendored module.`)})),Pj=w({}),Fj=S((()=>{throw Error(`Optional native dependency "@mongodb-js/zstd" is not bundled in this vendored module.`)}));function Ij(e,t,n,r){r&&dN.encodeInto(r,e.subarray(t,t+n))}function Lj(e,t,n,r){if(r===void 0)return;let i=r.toString(8).padStart(n-1,`0`);dN.encodeInto(i,e.subarray(t,t+n-1))}function Rj(e,t,n){let r=e.indexOf(0,t),i=r===-1||r>t+n?t+n:r;return fN.decode(e.subarray(t,i))}function zj(e,t,n){let r=0,i=t+n;for(let n=t;n<i;n++){let t=e[n];if(t===0)break;t!==32&&(r=r*8+(t-48))}return r}function Bj(e,t,n){if(e[t]&128){let r=0;r=e[t]&127;for(let i=1;i<n;i++)r=r*256+e[t+i];if(!Number.isSafeInteger(r))throw Error(`TAR number too large`);return r}return zj(e,t,n)}async function Vj(e){if(e==null)return uN;if(e instanceof Uint8Array)return e;if(typeof e==`string`)return dN.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(e instanceof Blob)return new Uint8Array(await e.arrayBuffer());throw TypeError(`Unsupported content type for entry body.`)}function Hj(e,t){let{strip:n,filter:r,map:i}=t;if(!n&&!r&&!i)return e;let a={...e};if(n&&n>0){let e=mN(a.name,n);if(!e)return null;if(a.name=a.type===`directory`&&!e.endsWith(`/`)?`${e}/`:e,a.linkname){let e=a.linkname.startsWith(`/`);if(e||a.type===`link`){let t=mN(a.linkname,n);a.linkname=e?`/${t}`||`/`:t}}}if(r?.(a)===!1)return null;let o=i?i(a):a;return o&&(!o.name||!o.name.trim()||o.name===`.`||o.name===`/`)?null:o}function Uj(e){let t=zj(e,148,8),n=0;for(let t=0;t<e.length;t++)t>=148&&t<156?n+=hN:n+=e[t];return t===n}function Wj(e){e.fill(hN,148,156);let t=0;for(let n of e)t+=n;for(let n=153;n>=148;n--)e[n]=(t&7)+gN,t>>=3;e[154]=0,e[155]=hN}function Gj(e){let t={};dN.encode(e.name).length>100&&Kj(e.name)===null&&(t.path=e.name),e.linkname&&dN.encode(e.linkname).length>100&&(t.linkpath=e.linkname),e.uname&&dN.encode(e.uname).length>32&&(t.uname=e.uname),e.gname&&dN.encode(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 n=Object.entries(t);if(n.length===0)return null;let r=dN.encode(n.map(([e,t])=>{let n=`${e}=${t}
856
856
  `,r=dN.encode(n).length+1,i=r+String(r).length;return i=r+String(i).length,`${i} ${n}`}).join(``));return{paxHeader:qj({name:fN.decode(dN.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 Kj(e){let t=dN.encode(e).length;if(t<=100||t>_N)return null;for(let t=e.length-1;t>0;t--){if(e[t]!==`/`)continue;let n=e.slice(0,t),r=e.slice(t+1);if(dN.encode(n).length<=155&&dN.encode(r).length<=100)return{prefix:n,name:r}}return null}function qj(e){let t=new Uint8Array(512),n=pN(e)?0:e.size??0,r=e.name,i=``;if(!e.pax?.path){let e=Kj(r);e&&(r=e.name,i=e.prefix)}return Ij(t,0,100,r),Lj(t,100,8,e.mode??(e.type===`directory`?493:420)),Lj(t,108,8,e.uid??0),Lj(t,116,8,e.gid??0),Lj(t,124,12,n),Lj(t,136,12,Math.floor((e.mtime?.getTime()??Date.now())/1e3)),Ij(t,156,1,sN[e.type??`file`]),Ij(t,157,100,e.linkname),Ij(t,257,6,`ustar\0`),Ij(t,263,2,`00`),Ij(t,265,32,e.uname),Ij(t,297,32,e.gname),Ij(t,345,155,i),Wj(t),t}function Jj(e,t){if(t&&!Uj(e))throw Error(`Invalid tar header checksum.`);let n=Rj(e,156,1),r={name:Rj(e,0,100),mode:zj(e,100,8),uid:Bj(e,108,8),gid:Bj(e,116,8),size:Bj(e,124,12),mtime:new Date(Bj(e,136,12)*1e3),type:cN[n]||`file`,linkname:Rj(e,157,100)},i=Rj(e,257,6);return pN(r)&&(r.size=0),i.trim()===`ustar`&&(r.uname=Rj(e,265,32),r.gname=Rj(e,297,32)),i===`ustar`&&(r.prefix=Rj(e,345,155)),r}function Yj(e){let t=new TextDecoder(`utf-8`),n=Object.create(null),r=Object.create(null),i=0;for(;i<e.length;){let a=e.indexOf(32,i);if(a===-1)break;let o=parseInt(t.decode(e.subarray(i,a)),10);if(Number.isNaN(o)||o===0)break;let s=i+o,[c,l]=t.decode(e.subarray(a+1,s-1)).split(`=`,2);if(c&&l!==void 0&&(r[c]=l,Object.hasOwn(vN,c))){let[e,t]=vN[c],r=t(l);(typeof r==`string`||!Number.isNaN(r))&&(n[e]=r)}i=s}return Object.keys(r).length>0&&(n.pax=r),n}function Xj(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 Zj(e){switch(e){case`pax-global-header`:case`pax-header`:return Yj;case`gnu-long-name`:return e=>({name:Rj(e,0,e.length)});case`gnu-long-link-name`:return e=>({linkname:Rj(e,0,e.length)});default:return}}function Qj(e){let t=qj(e),n=Gj(e);if(!n)return[t];let r=-n.paxBody.length&511,i=r>0?[lN.subarray(0,r)]:[];return[n.paxHeader,n.paxBody,...i,t]}function $j(e,t,n){let r=null,i=0,a=!1,o=e=>{let n=Error(e);throw t(n),n};return{add(n){a&&o(`No new tar entries after finalize.`),r!==null&&o(`Previous entry must be completed before adding a new one`);let s=pN(n)?0:n.size;(!Number.isSafeInteger(s)||s<0)&&o(`Invalid tar entry size.`);try{let t=Qj({...n,size:s});for(let n of t)e(n);r={...n,size:s},i=0}catch(e){t(e)}},write(n){r||o(`No active tar entry.`),a&&o(`Cannot write data after finalize.`);let s=i+n.length;s>r.size&&o(`"${r.name}" exceeds given size of ${r.size} bytes.`);try{i=s,e(n)}catch(e){t(e)}},endEntry(){r||o(`No active entry to end.`),a&&o(`Cannot end entry after finalize.`);try{i!==r.size&&o(`Size mismatch for "${r.name}".`);let t=-r.size&511;t>0&&e(new Uint8Array(t)),r=null,i=0}catch(e){throw t(e),e}},finalize(){a&&o(`Archive has already been finalized`),r!==null&&o(`Cannot finalize while an entry is still active`);try{e(yN),a=!0,n&&n()}catch(e){t(e)}}}}function eM(){let e=Array(bN),t=e.length-1,n=0,r=0,i=0,a=a=>{let o=e[n];a===o.length?(e[n]=uN,n=n+1&t):e[n]=o.subarray(a),i-=a,i===0&&e.length>bN&&(e=Array(bN),t=bN-1,n=0,r=0)};function o(t,r){if(r){let o=0,s=Math.min(t,i);for(;s>0;){let t=e[n],i=Math.min(s,t.length),c=i===t.length?t:t.subarray(0,i);if(a(i),s-=i,o+=i,!r(c))break}return o}if(i<t)return null;if(t===0)return uN;let o=e[n];if(o.length>=t){let e=o.length===t?o:o.subarray(0,t);return a(t),e}let s=new Uint8Array(t),c=0,l=t;for(;l>0;){let t=e[n],r=Math.min(l,t.length);s.set(r===t.length?t:t.subarray(0,r),c),c+=r,l-=r,a(r)}return s}return{push:a=>{if(a.length===0)return;let o=r+1&t;if(o===n){let i=e.length,a=i*2,s=Array(a),c=r-n+i&i-1;if(n<r)for(let t=0;t<c;t++)s[t]=e[n+t];else if(c>0){let t=i-n;for(let r=0;r<t;r++)s[r]=e[n+r];for(let n=0;n<r;n++)s[t+n]=e[n]}e=s,t=a-1,n=0,r=c,o=r+1&t}e[r]=a,r=o,i+=a.length},available:()=>i,peek:r=>{if(i<r)return null;if(r===0)return uN;let a=e[n];if(a.length>=r)return a.length===r?a:a.subarray(0,r);let o=new Uint8Array(r),s=0,c=n;for(;s<r;){let n=e[c],i=Math.min(r-s,n.length);i===n.length?o.set(n,s):o.set(n.subarray(0,i),s),s+=i,c=c+1&t}return o},discard:t=>{if(t>i)throw Error(`Too many bytes consumed`);if(t===0)return;let r=t;for(;r>0;){let t=e[n],i=Math.min(r,t.length);a(i),r-=i}},pull:o}}function tM(e={}){let t=e.strict??!1,{available:n,peek:r,push:i,discard:a,pull:o}=eM(),s=xN,c=!1,l=!1,u=!1,d=null,f={},p={},m={isEntryActive:()=>s===SN,isBodyComplete:()=>!d||d.remaining===0,canFinish:()=>!d||n()>=d.remaining+d.padding,write(e){if(c)throw Error(`Archive already ended.`);i(e)},end(){c=!0},readHeader(){if(s!==xN)throw Error(`Cannot read header while an entry is active`);if(!l)for(;!l;){if(n()<512){if(c){if(n()>0&&t)throw CN;l=!0;return}return null}let e=r(512);if(nM(e)){if(n()<512*2){if(c){if(t)throw CN;l=!0;return}return null}if(nM(r(512*2).subarray(512))){a(512*2),l=!0,u=!0;return}if(t)throw Error(`Invalid tar header.`);a(512);continue}let i;try{i=Jj(e,t)}catch(e){if(t)throw e;a(512);continue}let m=Zj(i.type);if(m){let e=i.size+(-i.size&511);if(n()<512+e){if(c&&t)throw CN;return null}a(512);let r=m(o(e).subarray(0,i.size)),s=i.type===`pax-global-header`?f:p;for(let e in r)s[e]=r[e];continue}a(512);let h=i;return i.prefix&&(h.name=`${i.prefix}/${h.name}`),Xj(h,f),Xj(h,p),h.name.endsWith(`/`)&&h.type===`file`&&(h.type=oN),p={},d={header:h,remaining:h.size,padding:-h.size&511},s=SN,h}},streamBody(e){if(s!==SN||!d||d.remaining===0)return 0;let t=Math.min(d.remaining,n());if(t===0)return 0;let r=o(t,e);return d.remaining-=r,r},skipPadding(){if(s!==SN||!d)return!0;if(d.remaining>0)throw Error(`Body not fully consumed`);return n()<d.padding?!1:(a(d.padding),d=null,s=xN,!0)},skipEntry(){if(s!==SN||!d)return!0;let e=Math.min(d.remaining,n());return e>0&&(a(e),d.remaining-=e),d.remaining>0?!1:m.skipPadding()},validateEOF(){if(t){if(!u)throw CN;if(n()>0&&o(n()).some(e=>e!==0))throw Error(`Invalid EOF.`)}}};return m}function nM(e){if(e.byteOffset%8==0){let t=new BigUint64Array(e.buffer,e.byteOffset,e.length/8);for(let e=0;e<t.length;e++)if(t[e]!==0n)return!1;return!0}for(let t=0;t<e.length;t++)if(e[t]!==0)return!1;return!0}function rM(){return new CompressionStream(`gzip`)}function iM(){return new DecompressionStream(`gzip`)}function aM(){let e,t;return{readable:new ReadableStream({start(n){e=n,t=$j(n.enqueue.bind(n),n.error.bind(n),n.close.bind(n))}}),controller:{add(n){let r=pN(n);return t.add(n),r&&t.endEntry(),new WritableStream({write(e){t.write(e)},close(){r||t.endEntry()},abort(t){e.error(t)}})},finalize(){t.finalize()},error(t){e.error(t)}}}}async function oM(e){let t=[],n=e.getReader(),r=0;try{for(;;){let{done:e,value:i}=await n.read();if(e)break;t.push(i),r+=i.length}let e=new Uint8Array(r),i=0;for(let n of t)e.set(n,i),i+=n.length;return e}finally{n.releaseLock()}}function sM(e={}){let t=tM(e),n=e.strict??!1,r=null,i=null,a=!1,o=!1,s=!1,c=!1,l=()=>{try{i?.close()}catch{}i=null},u=e=>{if(!c){c=!0;try{i?.error(e)}catch{}i=null;try{r.error(e)}catch{}r=null}},d=()=>{if(!c){c=!0,l();try{r.close()}catch{}r=null}},f=()=>{if(n)throw Error(`Tar archive is truncated.`);d()},p=()=>{if(!(a||c||!r)){a=!0;try{for(;;){if(o){s&&(t.validateEOF(),d());break}if(t.isEntryActive()){if(s&&!t.canFinish()){f();break}if(i){if((i.desiredSize??1)<=0)break;if(t.streamBody(e=>(i.enqueue(e),(i.desiredSize??1)>0))===0&&!t.isBodyComplete()){s&&f();break}}else if(!t.skipEntry()){s&&f();break}if(t.isBodyComplete()&&(l(),!t.skipPadding())){s&&f();break}}else{if((r.desiredSize??0)<0)break;let e=t.readHeader();if(e===null){s&&d();break}if(e===void 0){if(s){t.validateEOF(),d();break}o=!0;break}r.enqueue({header:e,body:new ReadableStream({start(t){e.size===0?t.close():i=t},pull:p,cancel(){i=null,p()}})})}}}catch(e){throw u(e),e}finally{a=!1}}};return{readable:new ReadableStream({start(e){r=e},pull:p,cancel(e){e===void 0?d():u(e)}},{highWaterMark:2}),writable:new WritableStream({write(e){try{if(o&&n&&e.some(e=>e!==0))throw Error(`Invalid EOF.`);t.write(e),p()}catch(e){throw u(e),e}},close(){try{s=!0,t.end(),p()}catch(e){throw u(e),e}},abort(e){u(e)}})}}async function cM(e){let{readable:t,controller:n}=aM();return await(async()=>{for(let t of e){let e=n.add(t.header),r=`body`in t?t.body:t.data;if(!r){await e.close();continue}if(r instanceof ReadableStream)await r.pipeTo(e);else if(r instanceof Blob)await r.stream().pipeTo(e);else try{let t=await Vj(r);if(t.length>0){let n=e.getWriter();await n.write(t),await n.close()}else await e.close()}catch{throw TypeError(`Unsupported content type for entry "${t.header.name}".`)}}})().then(()=>n.finalize()).catch(e=>n.error(e)),new Uint8Array(await oM(t))}async function lM(e,t={}){let n=e instanceof ReadableStream?e:new ReadableStream({start(t){t.enqueue(e instanceof Uint8Array?e:new Uint8Array(e)),t.close()}}),r=[],i=n.pipeThrough(sM(t));for await(let e of i){let n;try{n=Hj(e.header,t)}catch(t){throw await e.body.cancel(),t}if(n===null){await wN(e.body);continue}pN(n)?(await wN(e.body),r.push({header:n})):r.push({header:n,data:await oM(e.body)})}return r}function uM(e,t){return(e<<8^TN[(e>>>24^t)&255])>>>0}function dM(e){let t=[],n=0;for(;n<e.length;){let r=e[n],i=1;for(;n+i<e.length&&e[n+i]===r&&i<255;)i++;i>=4?(t.push(r,r,r,r),t.push(i-4),n+=i):(t.push(r),n++)}return new Uint8Array(t)}function fM(e){let t=e.length;if(t===0)return{transformed:new Uint8Array,pointer:0};let n=pM(e),r=new Uint8Array(t),i=0;for(let a=0;a<t;a++)n[a]===0?(i=a,r[a]=e[t-1]):r[a]=e[n[a]-1];return{transformed:r,pointer:i}}function pM(e){let t=e.length,n=new Int32Array(t),r=new Int32Array(t);for(let i=0;i<t;i++)n[i]=i,r[i]=e[i];for(let e=1;e<t;e*=2){let i=r.slice();n.sort((n,r)=>i[n]===i[r]?i[(n+e)%t]-i[(r+e)%t]:i[n]-i[r]),r[n[0]]=0;for(let a=1;a<t;a++)i[n[a]]===i[n[a-1]]&&i[(n[a]+e)%t]===i[(n[a-1]+e)%t]?r[n[a]]=r[n[a-1]]:r[n[a]]=r[n[a-1]]+1;if(r[n[t-1]]===t-1)break}return n}function mM(e,t){let n=[];for(let e=0;e<256;e++)t[e]&&n.push(e);let r=Array(256).fill(-1);for(let e=0;e<n.length;e++)r[n[e]]=e;let i=new Uint16Array(e.length),a=n.slice();for(let t=0;t<e.length;t++){let n=e[t],r=0;for(;a[r]!==n;)r++;if(i[t]=r,r>0){let e=a[r];for(let e=r;e>0;e--)a[e]=a[e-1];a[0]=e}}return{encoded:i,length:e.length}}function hM(e,t,n){let r=n+1,i=[],a=0;for(;a<t;)if(e[a]===0){let n=0;for(;a<t&&e[a]===0;)n++,a++;let r=n;for(;r>0;)r--,r&1?i.push(1):i.push(0),r>>>=1}else i.push(e[a]+1),a++;i.push(r);let o=new Uint16Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e];return{symbols:o,length:i.length,eob:r}}function gM(e,t,n){if(t<=1){let t=Array(e.length).fill(0);for(let n=0;n<e.length;n++)e[n]>0&&(t[n]=1);return{codeLengths:t,maxLen:1,minLen:1}}let r=[];for(let t=0;t<e.length;t++)e[t]>0&&r.push({freq:e[t],symbol:t,left:null,right:null});if(r.length===0)return{codeLengths:Array(e.length).fill(0),maxLen:0,minLen:0};if(r.length===1){let t=Array(e.length).fill(0);return t[r[0].symbol]=1,{codeLengths:t,maxLen:1,minLen:1}}for(;r.length>1;){r.sort((e,t)=>e.freq-t.freq);let e=r.shift(),t=r.shift();r.push({freq:e.freq+t.freq,symbol:-1,left:e,right:t})}let i=Array(e.length).fill(0);function a(e,t){if(!e.left&&!e.right){i[e.symbol]=t;return}e.left&&a(e.left,t+1),e.right&&a(e.right,t+1)}a(r[0],0);let o=!0;for(;o;){o=!1;for(let e=0;e<i.length;e++)i[e]>n&&(i[e]=n,o=!0);if(o){let e=0;for(let t=0;t<i.length;t++)i[t]>0&&(e+=1/(1<<i[t]));if(e>1)for(let t=1;t<n&&e>1;t++)for(let n=0;n<i.length&&e>1;n++)i[n]===t&&(i[n]++,e-=1/(1<<t)-1/(1<<t+1));o=!1;for(let e=0;e<i.length;e++)if(i[e]>n){o=!0;break}}}let s=n,c=0;for(let e=0;e<i.length;e++)i[e]>0&&(i[e]<s&&(s=i[e]),i[e]>c&&(c=i[e]));return{codeLengths:i,maxLen:c,minLen:s}}function _M(e,t){let n=Array(t).fill(0),r=e.slice(0,t),i=Math.max(...r,0),a=Array(i+1).fill(0);for(let e=0;e<t;e++)r[e]>0&&a[r[e]]++;let o=Array(i+1).fill(0),s=0;for(let e=1;e<=i;e++)s=s+a[e-1]<<1,o[e]=s;for(let e=0;e<t;e++)r[e]>0&&(n[e]=o[r[e]]++);return{codes:n,lengths:r}}function vM(e,t,n){e.writeBits(24,3227993),e.writeBits(24,2511705),e.writeBits(32,n),e.writeBit(0);let{transformed:r,pointer:i}=fM(dM(t));e.writeBits(24,i);let a=Array(256).fill(!1);for(let e=0;e<r.length;e++)a[r[e]]=!0;let o=Array(16).fill(!1);for(let e=0;e<16;e++)for(let t=0;t<16;t++)if(a[e*16+t]){o[e]=!0;break}for(let t=0;t<16;t++)e.writeBit(+!!o[t]);for(let t=0;t<16;t++)if(o[t])for(let n=0;n<16;n++)e.writeBit(+!!a[t*16+n]);let s=0;for(let e=0;e<256;e++)a[e]&&s++;let{encoded:c,length:l}=mM(r,a),{symbols:u,length:d}=hM(c,l,s),f=s+2,p=Math.ceil(d/50),m;m=d<200?2:d<600?3:d<1200?4:d<2400?5:6,m>p&&(m=Math.max(2,p));let h=[];for(let e=0;e<m;e++)h.push(Array(f).fill(0));let g=new Int32Array(p);for(let e=0;e<p;e++)g[e]=e%m;for(let e=0;e<p;e++){let t=e*50,n=Math.min(t+50,d),r=g[e];for(let e=t;e<n;e++)h[r][u[e]]++}function _(e){for(let t=0;t<f;t++)e[t]<1&&(e[t]=1)}let v=[];for(let e=0;e<m;e++)_(h[e]),v.push(gM(h[e],f,20));for(let e=0;e<4;e++){for(let e=0;e<m;e++)h[e].fill(0);for(let e=0;e<p;e++){let t=e*50,n=Math.min(t+50,d),r=0,i=1/0;for(let e=0;e<m;e++){let a=0;for(let r=t;r<n;r++)a+=v[e].codeLengths[u[r]]||20;a<i&&(i=a,r=e)}g[e]=r;for(let e=t;e<n;e++)h[r][u[e]]++}for(let e=0;e<m;e++)_(h[e]),v[e]=gM(h[e],f,20)}e.writeBits(3,m),e.writeBits(15,p);let y=[],b=[];for(let e=0;e<m;e++)b.push(e);for(let e=0;e<p;e++){let t=g[e],n=0;for(;b[n]!==t;)n++;if(y.push(n),n>0){let e=b[n];for(let e=n;e>0;e--)b[e]=b[e-1];b[0]=e}}for(let t=0;t<p;t++){for(let n=0;n<y[t];n++)e.writeBit(1);e.writeBit(0)}for(let t=0;t<m;t++){let n=v[t].codeLengths,r=n[0];e.writeBits(5,r);for(let t=0;t<f;t++){let i=n[t];for(;r<i;)e.writeBit(1),e.writeBit(0),r++;for(;r>i;)e.writeBit(1),e.writeBit(1),r--;e.writeBit(0)}}for(let e=0;e<m;e++){let{codes:t,lengths:n}=_M(v[e].codeLengths,f);v[e]=Object.assign(v[e],{_codes:t,_lengths:n})}let x=0,S=0;for(let t=0;t<d;t++){(S===0||S>=50)&&(t>0&&x++,S=0);let n=v[g[x]],r=u[t],i=n._lengths[r],a=n._codes[r];i>0&&e.writeBits(i,a),S++}}function yM(e,t=9,n=DN){if(t<1||t>9)throw Error(`Block size level must be 1-9`);if(e.length>n)throw Error(`Input too large for bzip2 compression (${e.length} bytes, max ${n})`);let r=t*1e5,i=new EN;i.writeBits(8,66),i.writeBits(8,90),i.writeBits(8,104),i.writeBits(8,48+t);let a=0,o=0;for(;o<e.length;){let t=Math.min(o+r,e.length),n=e.subarray(o,t),s=4294967295;for(let e=0;e<n.length;e++)s=uM(s,n[e]);s=~s>>>0,a=(a<<1|a>>>31)>>>0,a=(a^s)>>>0,vM(i,n,s),o=t}return i.writeBits(24,1536581),i.writeBits(24,3690640),i.writeBits(32,a),i.finish()}async function bM(){if(ON)return ON;if(kN)throw kN;try{return ON=await Os.runTrustedAsync(()=>Promise.resolve().then(()=>(Nj(),Mj))),ON}catch{throw kN=Error(`xz compression requires node-liblzma which failed to load. Install liblzma-dev (apt) or xz (brew) and reinstall dependencies.`),kN}}async function xM(){if(AN)return AN;if(jN)throw jN;try{return AN=await Os.runTrustedAsync(()=>Promise.resolve().then(()=>(Fj(),Pj))),AN}catch{throw jN=Error(`zstd compression requires @mongodb-js/zstd which is not installed. Install it with: npm install @mongodb-js/zstd`),jN}}function SM(e){let t=`file`;e.isDirectory?t=`directory`:e.isSymlink&&(t=`symlink`);let n=e.name;e.isDirectory&&!n.endsWith(`/`)&&(n+=`/`);let r;e.content!==void 0&&(r=typeof e.content==`string`?new TextEncoder().encode(e.content):e.content);let i=e.isDirectory||e.isSymlink?0:r?.length??0;return{header:{name:n,mode:e.mode??(e.isDirectory?493:420),uid:e.uid??0,gid:e.gid??0,size:i,mtime:e.mtime??new Date,type:t,linkname:e.linkTarget??``,uname:`user`,gname:`user`},body:r}}async function CM(e){return cM(e.map(SM))}async function wM(e){let t=await CM(e),n=new ReadableStream({start(e){e.enqueue(t),e.close()}}).pipeThrough(rM()).getReader(),r=[];for(;;){let{done:e,value:t}=await n.read();if(e)break;r.push(t)}let i=r.reduce((e,t)=>e+t.length,0),a=new Uint8Array(i),o=0;for(let e of r)a.set(e,o),o+=e.length;return a}async function TM(e){if(e.length>MN)return{entries:[],error:`Archive too large (max ${MN} bytes)`};if(e.length<NN||e.length%NN!==0)return{entries:[],error:`Invalid tar archive format`};try{let t=await lM(e),n=[];for(let e of t){if(n.length>=PN)return{entries:n,error:`Too many entries (max ${PN})`};let t=`file`;switch(e.header.type){case`directory`:t=`directory`;break;case`symlink`:t=`symlink`;break;case`link`:t=`hardlink`;break;case`file`:t=`file`;break;default:t=`other`}n.push({name:e.header.name,mode:e.header.mode??420,uid:e.header.uid??0,gid:e.header.gid??0,size:e.header.size,mtime:e.header.mtime??new Date,type:t,linkTarget:e.header.linkname||void 0,content:e.data??new Uint8Array})}return{entries:n}}catch(e){return{entries:[],error:e instanceof Error?e.message:`Unknown error`}}}async function EM(e){if(e.length>MN)return{entries:[],error:`Archive too large (max ${MN} bytes)`};try{let t=new ReadableStream({start(t){t.enqueue(e),t.close()}}).pipeThrough(iM()).getReader(),n=[],r=0;for(;;){let{done:e,value:i}=await t.read();if(e)break;if(r+=i.length,r>MN)return await t.cancel(),{entries:[],error:`Decompressed archive too large (max ${MN} bytes)`};n.push(i)}let i=new Uint8Array(r),a=0;for(let e of n)i.set(e,a),a+=e.length;return TM(i)}catch(e){return{entries:[],error:`Decompression failed: ${e instanceof Error?e.message:`Unknown error`}`}}}function DM(e){return e.length>=2&&e[0]===31&&e[1]===139}function OM(e){return e.length>=3&&e[0]===66&&e[1]===90&&e[2]===104}function kM(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 AM(e){let t=nN.default.decode(Buffer.from(e));return new Uint8Array(t)}async function jM(e){return yM(e,9)}async function MM(e){let t=(await bM()).unxzSync(Buffer.from(e));return new Uint8Array(t)}async function NM(e){let t=(await bM()).xzSync(Buffer.from(e));return new Uint8Array(t)}async function PM(e){return jM(await CM(e))}async function FM(e,t){if(!t?.allowNativeCodecs)throw Error(`xz compression is disabled by default (native codec risk). Pass { allowNativeCodecs: true } to opt in.`);return NM(await CM(e))}async function IM(e){if(e.length>MN)return{entries:[],error:`Archive too large (max ${MN} bytes)`};try{let t=await AM(e);return t.length>MN?{entries:[],error:`Decompressed archive too large (max ${MN} bytes)`}:TM(t)}catch(e){return{entries:[],error:e instanceof Error?e.message:`Unknown error`}}}async function LM(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>MN)return{entries:[],error:`Archive too large (max ${MN} bytes)`};try{let t=await MM(e);return t.length>MN?{entries:[],error:`Decompressed archive too large (max ${MN} bytes)`}:TM(t)}catch(e){return{entries:[],error:e instanceof Error?e.message:`Unknown error`}}}function RM(e){return e.length>=4&&e[0]===40&&e[1]===181&&e[2]===47&&e[3]===253}async function zM(e){let t=await(await xM()).compress(Buffer.from(e),3);return new Uint8Array(t)}async function BM(e){let t=await(await xM()).decompress(Buffer.from(e));return new Uint8Array(t)}async function VM(e,t){if(!t?.allowNativeCodecs)throw Error(`zstd compression is disabled by default (native codec risk). Pass { allowNativeCodecs: true } to opt in.`);return zM(await CM(e))}async function HM(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>MN)return{entries:[],error:`Archive too large (max ${MN} bytes)`};try{let t=await BM(e);return t.length>MN?{entries:[],error:`Decompressed archive too large (max ${MN} bytes)`}:TM(t)}catch(e){return{entries:[],error:e instanceof Error?e.message:`Unknown error`}}}function UM(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},n=[],r=0;for(;r<e.length;){let i=e[r];if(i.startsWith(`-`)&&!i.startsWith(`--`)&&i.length>2){if(/^-\d+$/.test(i)){n.push(i),r++;continue}for(let n=1;n<i.length;n++){let a=i[n];switch(a){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(n<i.length-1)t.file=i.substring(n+1),n=i.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:``,stderr:`tar: option requires an argument -- 'f'
857
857
  `,exitCode:2}};t.file=e[r]}break;case`C`:if(n<i.length-1)t.directory=i.substring(n+1),n=i.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:``,stderr:`tar: option requires an argument -- 'C'
858
858
  `,exitCode:2}};t.directory=e[r]}break;case`T`:if(n<i.length-1)t.filesFrom=i.substring(n+1),n=i.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:``,stderr:`tar: option requires an argument -- 'T'
@@ -34,7 +34,7 @@ import type { ConnectionAuthorizationChallenge } from "#public/connections/error
34
34
  * best-effort cosmetic pass — it will not magically produce
35
35
  * `GitHub`, `AWS`, or `npm`. Connections that want exact brand
36
36
  * casing should set `challenge.instructions` explicitly (directly or
37
- * via a Connex helper's `instructions` option).
37
+ * via a Connect helper's `instructions` option).
38
38
  *
39
39
  * Connections that want a custom prompt (localization, brand-specific
40
40
  * wording) set `challenge.instructions` explicitly and it passes
@@ -33,7 +33,7 @@
33
33
  * best-effort cosmetic pass — it will not magically produce
34
34
  * `GitHub`, `AWS`, or `npm`. Connections that want exact brand
35
35
  * casing should set `challenge.instructions` explicitly (directly or
36
- * via a Connex helper's `instructions` option).
36
+ * via a Connect helper's `instructions` option).
37
37
  *
38
38
  * Connections that want a custom prompt (localization, brand-specific
39
39
  * wording) set `challenge.instructions` explicitly and it passes
@@ -6,7 +6,7 @@ import { ASH_PACKAGE_NAME } from "#package-name.js";
6
6
  let cachedPackageInfo;
7
7
  // The package build stamps the published version into `dist` so bundled
8
8
  // deployments can still report package metadata without resolving package.json.
9
- const BUNDLED_FALLBACK_PACKAGE_VERSION = "0.8.2";
9
+ const BUNDLED_FALLBACK_PACKAGE_VERSION = "0.9.0";
10
10
  const BUNDLED_FALLBACK_PACKAGE_VERSION_PLACEHOLDER = "__ASH_PACKAGE_VERSION_PLACEHOLDER__";
11
11
  const WORKFLOW_MODULE_ALIASES = {
12
12
  "workflow/api": "src/compiled/@workflow/core/runtime.js",
@@ -1,4 +1,4 @@
1
1
  export { slack, type SlackOptions } from "#public/channels/slack/slack.js";
2
- export { slackChannel, type SlackApiHandle, type SlackApiResponse, type SlackChannel, type SlackChannelConfig, type SlackChannelEvents, type SlackChannelCredentials, type SlackChannelState, type SlackContext, type SlackInteractionAction, type SlackReceiveArgs, } from "#public/channels/slack/slackChannel.js";
2
+ export { slackChannel, type SlackApiHandle, type SlackApiResponse, type SlackChannel, type SlackChannelConfig, type SlackChannelEvents, type SlackChannelCredentials, type SlackChannelState, type SlackContext, type SlackInteractionAction, type SlackReceiveArgs, type SlackWebhookVerifier, } from "#public/channels/slack/slackChannel.js";
3
3
  export { Actions, Button, Card, CardText, Divider, Fields, Image, LinkButton, Modal, RadioSelect, Section, Select, SelectOption, Table, TextInput, } from "#compiled/chat/index.js";
4
4
  export type { AdapterPostableMessage, Attachment, Author, CardElement, FileUpload, Message, PostableMessage, SentMessage, Thread, } from "#compiled/chat/index.js";
@@ -18,9 +18,12 @@ export function slack(options = {}) {
18
18
  run(_ctx, message) {
19
19
  return { auth: resolveAuth(message) };
20
20
  },
21
+ async onMention(ctx) {
22
+ await ctx.thread.startTyping("Thinking...");
23
+ },
21
24
  events: {
22
25
  async "turn.started"(_event, ctx) {
23
- await ctx.thread.startTyping("Thinking...");
26
+ await ctx.thread.startTyping("Working...");
24
27
  },
25
28
  async "actions.requested"(event, ctx) {
26
29
  const labels = event.actions.map((a) => (a.kind === "tool-call" ? a.toolName : a.kind));
@@ -28,9 +28,29 @@ export interface SlackChannelState {
28
28
  serializedThread: SerializedThread | null;
29
29
  teamId: string | null;
30
30
  }
31
+ /**
32
+ * Verifies an inbound Slack webhook request. Returns when the request
33
+ * is authentic, throws otherwise. Used as an alternative to HMAC
34
+ * verification with `signingSecret` — for example, the Connect SDK
35
+ * supplies a verifier that authenticates Connect-forwarded webhooks
36
+ * with Vercel OIDC instead of Slack's signing secret.
37
+ */
38
+ export type SlackWebhookVerifier = (request: Request, body: string) => unknown | Promise<unknown>;
31
39
  export interface SlackChannelCredentials {
32
40
  readonly botToken?: SlackBotToken;
41
+ /**
42
+ * Slack signing secret used to HMAC-verify inbound webhook requests.
43
+ * Falls back to `process.env.SLACK_SIGNING_SECRET` when neither this
44
+ * nor `webhookVerifier` is supplied.
45
+ */
33
46
  readonly signingSecret?: string;
47
+ /**
48
+ * Custom inbound webhook verifier. When supplied, ash skips the
49
+ * `SLACK_SIGNING_SECRET` fallback and delegates verification to this
50
+ * function. Typically populated by integrations (e.g. Connect) that
51
+ * authenticate webhooks out-of-band.
52
+ */
53
+ readonly webhookVerifier?: SlackWebhookVerifier;
34
54
  }
35
55
  export interface SlackReceiveArgs {
36
56
  readonly channelId: string;
@@ -55,6 +75,7 @@ export interface SlackInteractionAction {
55
75
  export type SlackRunResult = {
56
76
  auth: import("#channel/types.js").SessionAuthContext | null;
57
77
  } | null;
78
+ export type SlackRunResultOrPromise = SlackRunResult | Promise<SlackRunResult>;
58
79
  export interface SlackChannelEvents {
59
80
  readonly "turn.started"?: SlackEventHandler<"turn.started">;
60
81
  readonly "actions.requested"?: SlackEventHandler<"actions.requested">;
@@ -83,7 +104,49 @@ export interface SlackChannelConfig {
83
104
  * Defaults to the framework's 25 MB cap with unrestricted media types.
84
105
  */
85
106
  readonly uploadPolicy?: Partial<UploadPolicy>;
86
- run?(ctx: SlackContext, message: Message): SlackRunResult;
107
+ /**
108
+ * Synchronous-or-async filter and auth resolver invoked the moment a
109
+ * Slack `app_mention` arrives, before the framework dispatches a
110
+ * turn. Return `{ auth }` to dispatch with that session auth context,
111
+ * or `null` to silently drop the mention. Runs on the inbound webhook
112
+ * side, so cold-start latency does not affect it.
113
+ */
114
+ run?(ctx: SlackContext, message: Message): SlackRunResultOrPromise;
115
+ /**
116
+ * Free-form pre-dispatch hook invoked after `run()` accepts but
117
+ * before the framework enqueues the turn. Use it for side effects
118
+ * that should fire on the inbound webhook side — for example,
119
+ * starting a typing indicator so the user sees feedback before the
120
+ * workflow runtime cold-starts.
121
+ *
122
+ * The framework awaits this handler and catches thrown errors (the
123
+ * turn still dispatches if `onMention` throws). It does not alter
124
+ * dispatch — to skip a turn, return `null` from `run()`.
125
+ */
126
+ onMention?(ctx: SlackContext, message: Message): void | Promise<void>;
127
+ /**
128
+ * Handler for Slack `block_actions` interactive callbacks (button
129
+ * clicks, select changes, etc.) that are **not** consumed by the
130
+ * framework's HITL pipeline.
131
+ *
132
+ * Slack POSTs interactive payloads to the same webhook route as
133
+ * mentions. The framework decodes the payload, routes any action
134
+ * whose `action_id` starts with `ash_input:` to the runtime as an
135
+ * HITL response (resuming a paused session), and forwards everything
136
+ * else to this handler — one invocation per non-HITL action in the
137
+ * payload.
138
+ *
139
+ * Runs on the inbound webhook side via `waitUntil()`, so the channel
140
+ * returns `200 OK` to Slack immediately. Errors are caught and
141
+ * logged; they do not affect the webhook response or sibling
142
+ * handler invocations.
143
+ *
144
+ * The `SlackContext` passed here is rebuilt from the interaction
145
+ * payload (channel id, thread ts, team id) — it is **not** the
146
+ * persisted thread state used by event handlers. Use
147
+ * `ctx.slack.request(...)` for arbitrary Slack Web API calls and
148
+ * `action.messageTs` to target `chat.update` on the clicked message.
149
+ */
87
150
  onInteraction?(action: SlackInteractionAction, ctx: SlackContext): void | Promise<void>;
88
151
  readonly events?: SlackChannelEvents;
89
152
  }
@@ -1,4 +1,5 @@
1
1
  import { createSlackAdapter } from "#compiled/@chat-adapter/slack/index.js";
2
+ import { createMemoryState } from "#compiled/@chat-adapter/state-memory/index.js";
2
3
  import { ThreadImpl, } from "#compiled/chat/index.js";
3
4
  import { createLogger } from "#internal/logging.js";
4
5
  import { buildSlackTurnMessage, collectSlackFileParts, createSlackFetchFile, } from "#public/channels/slack/attachments.js";
@@ -75,9 +76,30 @@ function extractSelectedOptionValue(action) {
75
76
  const selected = action.selected_option;
76
77
  return typeof selected?.value === "string" ? selected.value : undefined;
77
78
  }
78
- function rebuildSlackContext(state, botToken) {
79
+ /**
80
+ * Resolve credential fields fed to `createSlackAdapter`. Both adapter
81
+ * instantiation sites (`getChat` for inbound webhook routing and
82
+ * `rebuildSlackContext` for outbound event-handler dispatch) must pass
83
+ * the same shape, otherwise webhook-mode validation trips when one
84
+ * site forgets the verifier — see the original bug where Connect's
85
+ * `webhookVerifier` reached the inbound adapter but not the rebuild
86
+ * adapter, breaking terminal `session.failed` delivery.
87
+ */
88
+ function resolveSlackAdapterCredentials(credentials) {
89
+ const botToken = credentials?.botToken ?? process.env.SLACK_BOT_TOKEN;
90
+ const webhookVerifier = credentials?.webhookVerifier;
91
+ // Skip the SLACK_SIGNING_SECRET env-var fallback when a webhook
92
+ // verifier is supplied, so integrations like Connect don't need the
93
+ // signing secret set in the environment at all.
94
+ const signingSecret = credentials?.signingSecret ?? (webhookVerifier ? undefined : process.env.SLACK_SIGNING_SECRET);
95
+ return { botToken, signingSecret, webhookVerifier };
96
+ }
97
+ function rebuildSlackContext(state, credentials) {
98
+ const { botToken, signingSecret, webhookVerifier } = resolveSlackAdapterCredentials(credentials);
79
99
  const adapter = createSlackAdapter({
80
- botToken: botToken ?? process.env.SLACK_BOT_TOKEN,
100
+ botToken,
101
+ signingSecret,
102
+ webhookVerifier,
81
103
  });
82
104
  const thread = state.serializedThread
83
105
  ? ThreadImpl.fromJSON(state.serializedThread, adapter)
@@ -87,7 +109,20 @@ function rebuildSlackContext(state, botToken) {
87
109
  id: "slack::",
88
110
  isDM: false,
89
111
  });
90
- thread._adapter = adapter;
112
+ // Pin both private adapter slots so the thread is fully self-
113
+ // contained — no `Chat.getSingleton()` lookup needed when handlers
114
+ // call `thread.post()`, `thread.startTyping()`, `thread.setState()`,
115
+ // `thread.subscribe()`, etc. The `_adapter` line matches the runtime
116
+ // behavior chat itself relies on for `ThreadImpl.fromJSON(json,
117
+ // adapter)`. `ThreadImpl.fromJSON` does NOT pin a state adapter, so
118
+ // without `_stateAdapterInstance` set, state-touching paths (cards,
119
+ // callback URLs, `state`/`setState`, `subscribe()`/`isSubscribed()`)
120
+ // would fall through to the singleton and throw — we use an in-
121
+ // memory state adapter scoped to this rebuild so the asymmetry with
122
+ // the fallback branch goes away and both branches converge to a
123
+ // fully-pinned thread.
124
+ Reflect.set(thread, "_adapter", adapter);
125
+ Reflect.set(thread, "_stateAdapterInstance", createMemoryState());
91
126
  return {
92
127
  thread,
93
128
  slack: buildSlackApiHandle(thread, botToken, state.teamId ?? undefined),
@@ -122,8 +157,7 @@ export function slackChannel(config = {}) {
122
157
  if (chatPromise)
123
158
  return chatPromise;
124
159
  const promise = (async () => {
125
- const botToken = config.credentials?.botToken ?? process.env.SLACK_BOT_TOKEN;
126
- const signingSecret = config.credentials?.signingSecret ?? process.env.SLACK_SIGNING_SECRET;
160
+ const { botToken, signingSecret, webhookVerifier } = resolveSlackAdapterCredentials(config.credentials);
127
161
  if (!botToken) {
128
162
  throw new Error("slackChannel requires a bot token. Pass credentials.botToken or set SLACK_BOT_TOKEN.");
129
163
  }
@@ -135,6 +169,7 @@ export function slackChannel(config = {}) {
135
169
  const slackAdapter = slackModule.createSlackAdapter({
136
170
  botToken,
137
171
  signingSecret,
172
+ webhookVerifier,
138
173
  userName: config.botName,
139
174
  });
140
175
  const chat = new chatModule.Chat({
@@ -156,7 +191,7 @@ export function slackChannel(config = {}) {
156
191
  state: { serializedThread: null, teamId: null },
157
192
  fetchFile: slackFetchFile,
158
193
  context(state) {
159
- return rebuildSlackContext(state, config.credentials?.botToken);
194
+ return rebuildSlackContext(state, config.credentials);
160
195
  },
161
196
  routes: [
162
197
  POST(config.route ?? "/ash/v1/slack", async (req, { send, waitUntil }) => {
@@ -233,9 +268,17 @@ export function slackChannel(config = {}) {
233
268
  thread,
234
269
  slack: buildSlackApiHandle(thread, config.credentials?.botToken, teamId),
235
270
  };
236
- const runOpts = config.run ? config.run(slackCtx, message) : { auth: null };
271
+ const runOpts = config.run ? await config.run(slackCtx, message) : { auth: null };
237
272
  if (runOpts === null)
238
273
  return;
274
+ if (config.onMention) {
275
+ try {
276
+ await config.onMention(slackCtx, message);
277
+ }
278
+ catch (error) {
279
+ log.error("onMention handler failed", { error });
280
+ }
281
+ }
239
282
  const decoded = decodeThreadId(thread.id ?? "");
240
283
  const continuationToken = `slack:${decoded.channelId}:${decoded.threadTs}`;
241
284
  const fileParts = collectSlackFileParts(message, uploadPolicy);
@@ -6,7 +6,7 @@
6
6
  * context value and wiped between workflow steps, so bearer tokens
7
7
  * are never serialized into the durable step payload. Cross-step
8
8
  * reuse is delegated to the upstream authorization provider (for
9
- * example Connex's server-side cache), which owns the refresh grant.
9
+ * example Connect's server-side cache), which owns the refresh grant.
10
10
  *
11
11
  * TODO(ash): once a server-derivable session key is available, promote
12
12
  * this back to durable context via an AEAD codec so cross-step reuse
@@ -6,7 +6,7 @@
6
6
  * context value and wiped between workflow steps, so bearer tokens
7
7
  * are never serialized into the durable step payload. Cross-step
8
8
  * reuse is delegated to the upstream authorization provider (for
9
- * example Connex's server-side cache), which owns the refresh grant.
9
+ * example Connect's server-side cache), which owns the refresh grant.
10
10
  *
11
11
  * TODO(ash): once a server-derivable session key is available, promote
12
12
  * this back to durable context via an AEAD codec so cross-step reuse
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "experimental-ash",
3
- "version": "0.8.2",
3
+ "version": "0.9.0",
4
4
  "bin": {
5
5
  "ash": "./bin/ash.js",
6
6
  "experimental-ash": "./bin/ash.js"
@@ -151,28 +151,28 @@
151
151
  "@ai-sdk/openai": "4.0.0-canary.49",
152
152
  "@ai-sdk/otel": "1.0.0-canary.77",
153
153
  "@ai-sdk/provider": "4.0.0-canary.16",
154
- "@chat-adapter/slack": "^4.27.0",
155
- "@chat-adapter/state-memory": "^4.27.0",
156
- "@standard-schema/spec": "^1.1.0",
157
- "@types/json-schema": "^7.0.15",
158
- "@vercel/oidc": "^3.4.0",
154
+ "@chat-adapter/slack": "4.28.1",
155
+ "@chat-adapter/state-memory": "4.28.1",
156
+ "@standard-schema/spec": "1.1.0",
157
+ "@types/json-schema": "7.0.15",
158
+ "@vercel/oidc": "3.4.0",
159
159
  "@vercel/sandbox": "2.0.0-beta.14",
160
160
  "@workflow/core": "5.0.0-beta.5",
161
161
  "@workflow/errors": "5.0.0-beta.2",
162
162
  "@workflow/world-local": "5.0.0-beta.4",
163
163
  "ai": "7.0.0-canary.131",
164
- "autoevals": "^0.0.132",
165
- "chat": "^4.27.0",
166
- "chokidar": "^5.0.0",
167
- "commander": "^14.0.3",
168
- "gray-matter": "^4.0.3",
169
- "jose": "^6.2.3",
170
- "jsonc-parser": "^3.3.1",
171
- "just-bash": "^2.14.5",
164
+ "autoevals": "0.0.132",
165
+ "chat": "4.28.1",
166
+ "chokidar": "5.0.0",
167
+ "commander": "14.0.3",
168
+ "gray-matter": "4.0.3",
169
+ "jose": "6.2.3",
170
+ "jsonc-parser": "3.3.1",
171
+ "just-bash": "2.14.5",
172
172
  "picocolors": "^1.1.1",
173
- "turndown": "^7.2.4",
173
+ "turndown": "7.2.4",
174
174
  "zod": "^4.4.3",
175
- "zod-validation-error": "^5.0.0"
175
+ "zod-validation-error": "5.0.0"
176
176
  },
177
177
  "peerDependencies": {
178
178
  "@opentelemetry/api": "^1.9.0",
@@ -1 +0,0 @@
1
- import{t as e}from"./chunk-Dd2tEFlW.js";var t=e(((e,t)=>{function n(e,t){typeof t==`boolean`&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(Error(`RetryOperation timeout occurred`)),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n),this._options.unref&&this._timer.unref(),!0},n.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},n.prototype.try=function(e){console.log(`Using RetryOperation.try() is deprecated`),this.attempt(e)},n.prototype.start=function(e){console.log(`Using RetryOperation.start() is deprecated`),this.attempt(e)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],a=i.message,o=(e[a]||0)+1;e[a]=o,o>=n&&(t=i,n=o)}return t}})),n=e((e=>{var n=t();e.operation=function(t){return new n(e.timeouts(t),{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error(`minTimeout is greater than maxTimeout`);for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*Math.max(t.minTimeout,1)*t.factor**+e);return r=Math.min(r,t.maxTimeout),r},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var i in r=[],t)typeof t[i]==`function`&&r.push(i);for(var a=0;a<r.length;a++){var o=r[a],s=t[o];t[o]=function(r){var i=e.operation(n),a=Array.prototype.slice.call(arguments,1),o=a.pop();a.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))}),i.attempt(function(){r.apply(t,a)})}.bind(t,s),t[o].options=n}}})),r=e(((e,t)=>{t.exports=n()})),i=e(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}}));export{r as n,i as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./context-errors-CXifqq6a.js";import{p as t}from"./symbols-BC0BVTM7.js";async function n(r){let i=globalThis[t];return i||e(`sleep()`,`https://workflow-sdk.dev/docs/api-reference/workflow/sleep`,n),i(r)}export{n as t};